used a static atomic instead of a namespace boolean.

This commit is contained in:
LT-Schmiddy 2024-11-24 18:10:15 -05:00
parent 9e98499684
commit 50d2a2ac51
3 changed files with 7 additions and 8 deletions

View File

@ -6,7 +6,7 @@ namespace zelda64 {
//void quicksave_save();
//void quicksave_load();
extern bool should_game_reset;
void enqueue_game_reset();
};
#endif

View File

@ -15,8 +15,10 @@
#include "ultramodern/ultramodern.hpp"
#include "ultramodern/config.hpp"
namespace zelda64 {
bool should_game_reset;
static std::atomic<uint8_t> should_game_reset = 0x00;
void zelda64::enqueue_game_reset() {
should_game_reset.store(0x01);
}
extern "C" void recomp_update_inputs(uint8_t* rdram, recomp_context* ctx) {
@ -174,8 +176,5 @@ extern "C" void recomp_set_right_analog_suppressed(uint8_t* rdram, recomp_contex
extern "C" void recomp_should_reset_game(uint8_t* rdram, recomp_context* ctx) {
bool retVal = zelda64::should_game_reset;
zelda64::should_game_reset = false;
_return(ctx, retVal);
_return(ctx, should_game_reset.exchange(0x00));
}

View File

@ -287,7 +287,7 @@ void zelda64::open_reset_game_prompt() {
"Quit",
"Cancel",
[]() {
should_game_reset = true;
zelda64::enqueue_game_reset();
close_config_menu();
},
[]() {},