Skip to content
Snippets Groups Projects
Verified Commit 0cc09f02 authored by João Magalhães's avatar João Magalhães :rocket:
Browse files

chore: improved access to name and version

parent 27500c52
No related branches found
No related tags found
1 merge request!31System state save
Pipeline #3218 failed
...@@ -5,11 +5,10 @@ pub mod consts; ...@@ -5,11 +5,10 @@ pub mod consts;
use boytacean::{ use boytacean::{
debugln, debugln,
gb::{AudioProvider, GameBoy}, gb::{AudioProvider, GameBoy},
gen::{NAME, VERSION}, info::{name, version},
pad::PadKey, pad::PadKey,
ppu::{DISPLAY_HEIGHT, DISPLAY_WIDTH, FRAME_BUFFER_SIZE, XRGB8888_SIZE}, ppu::{DISPLAY_HEIGHT, DISPLAY_WIDTH, FRAME_BUFFER_SIZE, XRGB8888_SIZE},
rom::Cartridge, rom::Cartridge,
util::capitalize,
}; };
use consts::{ use consts::{
REGION_NTSC, RETRO_API_VERSION, RETRO_DEVICE_ID_JOYPAD_A, RETRO_DEVICE_ID_JOYPAD_B, REGION_NTSC, RETRO_API_VERSION, RETRO_DEVICE_ID_JOYPAD_A, RETRO_DEVICE_ID_JOYPAD_B,
...@@ -174,8 +173,8 @@ pub extern "C" fn retro_reset() { ...@@ -174,8 +173,8 @@ pub extern "C" fn retro_reset() {
#[no_mangle] #[no_mangle]
pub unsafe extern "C" fn retro_get_system_info(info: *mut RetroSystemInfo) { pub unsafe extern "C" fn retro_get_system_info(info: *mut RetroSystemInfo) {
debugln!("retro_get_system_info()"); debugln!("retro_get_system_info()");
(*info).library_name = format!("{}\0", capitalize(NAME)).as_ptr() as *const c_char; (*info).library_name = format!("{}\0", name()).as_ptr() as *const c_char;
(*info).library_version = format!("v{}\0", VERSION).as_ptr() as *const c_char; (*info).library_version = format!("v{}\0", version()).as_ptr() as *const c_char;
(*info).valid_extensions = "gb|gbc\0".as_ptr() as *const c_char; (*info).valid_extensions = "gb|gbc\0".as_ptr() as *const c_char;
(*info).need_fullpath = false; (*info).need_fullpath = false;
(*info).block_extract = false; (*info).block_extract = false;
......
...@@ -9,13 +9,13 @@ use audio::Audio; ...@@ -9,13 +9,13 @@ use audio::Audio;
use boytacean::{ use boytacean::{
devices::{printer::PrinterDevice, stdout::StdoutDevice}, devices::{printer::PrinterDevice, stdout::StdoutDevice},
gb::{AudioProvider, GameBoy, GameBoyMode}, gb::{AudioProvider, GameBoy, GameBoyMode},
gen::{NAME, VERSION}, info::{name, version},
pad::PadKey, pad::PadKey,
ppu::PaletteInfo, ppu::PaletteInfo,
rom::Cartridge, rom::Cartridge,
serial::{NullDevice, SerialDevice}, serial::{NullDevice, SerialDevice},
state::save_state_file, state::save_state_file,
util::{capitalize, replace_ext, write_file}, util::{replace_ext, write_file},
}; };
use chrono::Utc; use chrono::Utc;
use clap::Parser; use clap::Parser;
...@@ -95,7 +95,7 @@ impl Emulator { ...@@ -95,7 +95,7 @@ impl Emulator {
unlimited: options.unlimited.unwrap_or(false), unlimited: options.unlimited.unwrap_or(false),
sdl: None, sdl: None,
audio: None, audio: None,
title: format!("{} v{}", capitalize(NAME), VERSION), title: format!("{} v{}", name(), version()),
rom_path: String::from("invalid"), rom_path: String::from("invalid"),
ram_path: String::from("invalid"), ram_path: String::from("invalid"),
logic_frequency: GameBoy::CPU_FREQ, logic_frequency: GameBoy::CPU_FREQ,
...@@ -826,7 +826,7 @@ fn main() { ...@@ -826,7 +826,7 @@ fn main() {
game_boy.load(!args.no_boot); game_boy.load(!args.no_boot);
// prints the current version of the emulator (informational message) // prints the current version of the emulator (informational message)
println!("========= {} =========\n{}", capitalize(NAME), game_boy); println!("========= {} =========\n{}", name(), game_boy);
// creates a new generic emulator structure then starts // creates a new generic emulator structure then starts
// both the video and audio sub-systems, loads default // both the video and audio sub-systems, loads default
......
...@@ -7,7 +7,6 @@ use std::{ ...@@ -7,7 +7,6 @@ use std::{
use crate::{ use crate::{
gb::GameBoy, gb::GameBoy,
info::{name, version}, info::{name, version},
util::capitalize,
}; };
pub trait Serialize { pub trait Serialize {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment