MCPcopy Create free account
hub / github.com/BanjoRecomp/BanjoRecomp / recomp_destroy_object_data

Function recomp_destroy_object_data

src/game/recomp_extension_api.cpp:171–194  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

169}
170
171extern "C" void recomp_destroy_object_data(uint8_t* rdram, recomp_context* ctx) {
172 u32 type_index = _arg<0, u32>(rdram, ctx);
173 u32 object_handle = _arg<1, u32>(rdram, ctx);
174 ExtensionContext& context = type_contexts[type_index];
175
176 std::lock_guard lock{ extension_mutex };
177
178 extension_data_map_t::key object_key{object_handle};
179
180 ExtensionData* data = context.extension_data.get(object_key);
181 if (data != nullptr) {
182 // printf("Freeing object data: address 0x%08X handle 0x%08X\n", data->data_addr, object_handle);
183 if (data->data_addr != NULLPTR) {
184 recomp::free(rdram, TO_PTR(void, data->data_addr));
185 context.free_count++;
186 }
187 context.extension_data.erase(extension_data_map_t::key{object_handle});
188 }
189 else {
190 // Not an irrecoverable error, but catch it in debug mode with an assert to help find bugs.
191 // *(volatile int*)object_handle = 0;
192 assert(false);
193 }
194}
195
196extern "C" void recomp_get_object_data(uint8_t* rdram, recomp_context* ctx) {
197 u32 type_index = _arg<0, u32>(rdram, ctx);

Callers 4

func_80332B2CFunction · 0.85
func_8032D9C0Function · 0.85
cube_freeFunction · 0.85

Calls 2

getMethod · 0.45
eraseMethod · 0.45

Tested by

no test coverage detected