From 866c23069f166e822bc0d260cc2f522647ee988e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Magalh=C3=A3es?= <joamag@gmail.com> Date: Wed, 2 Aug 2023 08:21:06 +0100 Subject: [PATCH] chore: temporary reversion of changes --- .github/workflows/main.yml | 2 -- frontends/libretro/src/lib.rs | 9 +++------ frontends/sdl/src/main.rs | 2 +- 3 files changed, 4 insertions(+), 9 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 0c6d3509..7d015e37 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -168,8 +168,6 @@ jobs: run: rustc --version - name: Verify Rust code format run: cd frontends/libretro && cargo fmt --all -- --check - - name: Verify Rust code linting - run: cd frontends/libretro && cargo clippy -- -D warnings -A unknown-lints - name: Run unit tests run: cd frontends/libretro && cargo test - name: Build development version diff --git a/frontends/libretro/src/lib.rs b/frontends/libretro/src/lib.rs index c7ba8d99..df2647aa 100644 --- a/frontends/libretro/src/lib.rs +++ b/frontends/libretro/src/lib.rs @@ -365,19 +365,16 @@ pub extern "C" fn retro_cheat_reset() { emulator.reset_cheats(); } -/// # Safety -/// -/// This function should not be called only within Lib Retro context. #[no_mangle] -pub unsafe extern "C" fn retro_cheat_set(_index: c_uint, enabled: bool, code: *const c_char) { +pub extern "C" fn retro_cheat_set(_index: c_uint, enabled: bool, code: *const c_char) { debugln!("retro_cheat_set()"); // we'll just ignore cheats that are not enabled, Boytacean // does not support pre-loading cheats if !enabled { return; } - let emulator = EMULATOR.as_mut().unwrap(); - let code_c = CStr::from_ptr(code); + let emulator = unsafe { EMULATOR.as_mut().unwrap() }; + let code_c = unsafe { CStr::from_ptr(code) }; let code_s = code_c.to_string_lossy().into_owned(); emulator.add_cheat_code(&code_s).unwrap(); } diff --git a/frontends/sdl/src/main.rs b/frontends/sdl/src/main.rs index 437e85ef..4c5ffefb 100644 --- a/frontends/sdl/src/main.rs +++ b/frontends/sdl/src/main.rs @@ -788,7 +788,7 @@ fn main() { // in case the default ROM path is provided and the file does not // exist then fails gracefully let path = Path::new(&args.rom_path); - if args.rom_path == DEFAULT_ROM_PATH && !path.exists() { + if &args.rom_path == DEFAULT_ROM_PATH && !path.exists() { println!("No ROM file provided, please provide one using the --rom-path option"); return; } -- GitLab