mirror of
https://github.com/encounter/tp.git
synced 2026-03-30 11:40:53 -07:00
2f4904dae2
* move d_a_itembase_static * move d_a_item_static * moved Z2StatusMgr * clang * fixes * clang? * move d_save * move d_meter2_info * some d_meter2_info fixes * move most d_a_player * move d_bg_s stuff * move c_cc_s stuff * move d_cc stuff * move d_attention / d_event / d_stage
35 lines
960 B
C++
35 lines
960 B
C++
//
|
|
//
|
|
//
|
|
|
|
#include "dol2asm.h"
|
|
#include "dolphin/types.h"
|
|
|
|
struct __destructor_chain {
|
|
__destructor_chain* next;
|
|
void* destructor;
|
|
void* object;
|
|
};
|
|
|
|
#define CALL_DTOR(DTOR, OBJECT, VALUE) (((void (*)(void*, short))(DTOR))((OBJECT), VALUE))
|
|
#define CALL_DTOR_ALL(DTOR, OBJECT) CALL_DTOR(DTOR, OBJECT, (-1))
|
|
|
|
static __destructor_chain* __global_destructor_chain;
|
|
|
|
extern "C" void __register_global_object(void* object, void* destructor, __destructor_chain* link) {
|
|
link->next = __global_destructor_chain;
|
|
link->destructor = destructor;
|
|
link->object = object;
|
|
__global_destructor_chain = link;
|
|
}
|
|
|
|
extern "C" void __destroy_global_chain() {
|
|
__destructor_chain* gcd;
|
|
while ((gcd = __global_destructor_chain) != NULL) {
|
|
__global_destructor_chain = gcd->next;
|
|
|
|
CALL_DTOR_ALL(gcd->destructor, gcd->object);
|
|
}
|
|
}
|
|
|
|
SECTION_DTORS10 extern void* const __destroy_global_chain_reference = (void*)__destroy_global_chain; |