diff options
author | mrb0nk500 <b0nk@b0nk.xyz> | 2023-01-30 11:25:36 -0400 |
---|---|---|
committer | mrb0nk500 <b0nk@b0nk.xyz> | 2023-01-30 11:25:36 -0400 |
commit | 96140b0d163d18c0158f29b2063307efad918e18 (patch) | |
tree | e422c051d5ac7767acd1723ddf136ee67132bb52 /src/Runtime/Gecko_ExceptionPPC.cpp | |
parent | 5c7f3b06b3c04b461c93f8bc03fd7981b041bbd6 (diff) |
Global: Add necessary files to test linking
Diffstat (limited to 'src/Runtime/Gecko_ExceptionPPC.cpp')
-rw-r--r-- | src/Runtime/Gecko_ExceptionPPC.cpp | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/src/Runtime/Gecko_ExceptionPPC.cpp b/src/Runtime/Gecko_ExceptionPPC.cpp new file mode 100644 index 0000000..693aa25 --- /dev/null +++ b/src/Runtime/Gecko_ExceptionPPC.cpp @@ -0,0 +1,42 @@ +// This file was taken from the Metroid Prime decompilation project. +// https://github.com/PrimeDecomp/prime/blob/main/src/Runtime/Gecko_ExceptionPPC.cpp +#include "__ppc_eabi_linker.h" +#include "NMWException.h" + +#if __MWERKS__ +#pragma exceptions on +#endif + +typedef struct ProcessInfo { + __eti_init_info* exception_info; + char* TOC; + int active; +} ProcessInfo; + +static ProcessInfo fragmentinfo[1]; + +int __register_fragment(struct __eti_init_info* info, char* TOC) { + ProcessInfo* f; + int i; + + for (i = 0, f = fragmentinfo; i < 1; ++i, ++f) { + if (f->active == 0) { + f->exception_info = info; + f->TOC = TOC; + f->active = 1; + return (i); + } + } + + return (-1); +} + +void __unregister_fragment(int fragmentId) { + ProcessInfo* f; + if (fragmentId >= 0 && fragmentId < 1) { + f = &fragmentinfo[fragmentId]; + f->exception_info = 0; + f->TOC = 0; + f->active = 0; + } +} |