mirror of
				https://github.com/N64Recomp/N64ModernRuntime.git
				synced 2025-10-30 08:02:29 +00:00 
			
		
		
		
	Add on init callback to GameEntry, fix thread_queue_remove not actually removing the thread (#87)
This commit is contained in:
		
							parent
							
								
									0afeb089a5
								
							
						
					
					
						commit
						a2f201db84
					
				
					 3 changed files with 8 additions and 2 deletions
				
			
		|  | @ -30,9 +30,11 @@ namespace recomp { | ||||||
|         bool has_compressed_code = false; |         bool has_compressed_code = false; | ||||||
| 
 | 
 | ||||||
|         gpr entrypoint_address; |         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; |         std::u8string stored_filename() const; | ||||||
|     }; |     }; | ||||||
|  |  | ||||||
|  | @ -530,6 +530,9 @@ bool wait_for_game_started(uint8_t* rdram, recomp_context* context) { | ||||||
|                 const recomp::GameEntry& game_entry = find_it->second; |                 const recomp::GameEntry& game_entry = find_it->second; | ||||||
| 
 | 
 | ||||||
|                 init(rdram, context, game_entry.entrypoint_address); |                 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; |                 uint32_t mod_ram_used = 0; | ||||||
|                 if (!game_entry.mod_game_id.empty()) { |                 if (!game_entry.mod_game_id.empty()) { | ||||||
|  |  | ||||||
|  | @ -47,6 +47,7 @@ bool ultramodern::thread_queue_remove(RDRAM_ARG PTR(PTR(OSThread)) queue_, PTR(O | ||||||
|     while (cur != NULLPTR) { |     while (cur != NULLPTR) { | ||||||
|         PTR(OSThread)* cur_ptr = queue_to_ptr(PASS_RDRAM queue_); |         PTR(OSThread)* cur_ptr = queue_to_ptr(PASS_RDRAM queue_); | ||||||
|         if (*cur_ptr == t_) { |         if (*cur_ptr == t_) { | ||||||
|  |             *cur_ptr = TO_PTR(OSThread, *cur_ptr)->next; | ||||||
|             return true; |             return true; | ||||||
|         } |         } | ||||||
|         cur = TO_PTR(OSThread, *cur_ptr)->next; |         cur = TO_PTR(OSThread, *cur_ptr)->next; | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		
		Reference in a new issue
	
	 Wiseguy
						Wiseguy