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

Revert "chore: temporary reversion of changes"

This reverts commit 866c2306.
parent 866c2306
No related branches found
No related tags found
No related merge requests found
......@@ -168,6 +168,8 @@ 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
......
......@@ -365,16 +365,19 @@ 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 extern "C" fn retro_cheat_set(_index: c_uint, enabled: bool, code: *const c_char) {
pub unsafe 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 = unsafe { EMULATOR.as_mut().unwrap() };
let code_c = unsafe { CStr::from_ptr(code) };
let emulator = EMULATOR.as_mut().unwrap();
let code_c = CStr::from_ptr(code);
let code_s = code_c.to_string_lossy().into_owned();
emulator.add_cheat_code(&code_s).unwrap();
}
......
......@@ -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;
}
......
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