Add on init callback to GameEntry, fix thread_queue_remove not actually removing the thread (#87)

This commit is contained in:
Wiseguy 2025-02-17 21:34:22 -05:00 committed by GitHub
parent 0afeb089a5
commit a2f201db84
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 8 additions and 2 deletions

View file

@ -30,9 +30,11 @@ namespace recomp {
bool has_compressed_code = false;
gpr entrypoint_address;
void (*entrypoint)(uint8_t* rdram, recomp_context* context);
void (*entrypoint)(uint8_t* rdram, recomp_context* context) = nullptr;
void (*thread_create_callback)(uint8_t* rdram, recomp_context* context);
void (*thread_create_callback)(uint8_t* rdram, recomp_context* context) = nullptr;
void (*on_init_callback)(uint8_t* rdram, recomp_context* context) = nullptr;
std::u8string stored_filename() const;
};

View file

@ -530,6 +530,9 @@ bool wait_for_game_started(uint8_t* rdram, recomp_context* context) {
const recomp::GameEntry& game_entry = find_it->second;
init(rdram, context, game_entry.entrypoint_address);
if (game_entry.on_init_callback) {
game_entry.on_init_callback(rdram, context);
}
uint32_t mod_ram_used = 0;
if (!game_entry.mod_game_id.empty()) {

View file

@ -47,6 +47,7 @@ bool ultramodern::thread_queue_remove(RDRAM_ARG PTR(PTR(OSThread)) queue_, PTR(O
while (cur != NULLPTR) {
PTR(OSThread)* cur_ptr = queue_to_ptr(PASS_RDRAM queue_);
if (*cur_ptr == t_) {
*cur_ptr = TO_PTR(OSThread, *cur_ptr)->next;
return true;
}
cur = TO_PTR(OSThread, *cur_ptr)->next;