diff options
author | red031000 <rubenru09@aol.com> | 2020-08-31 18:11:34 +0100 |
---|---|---|
committer | red031000 <rubenru09@aol.com> | 2020-08-31 18:11:34 +0100 |
commit | 683f3b18d536f2f000d217f241967f2520ba7593 (patch) | |
tree | 39d86dd1d5a0a85583ceed75a29c9c72024bc7a5 | |
parent | 79a290495b0b1fe4df5f8f55d9b3f008410ae83d (diff) |
error_handling
-rw-r--r-- | arm9/asm/error_handling.s | 17 | ||||
-rw-r--r-- | arm9/src/error_handling.c | 16 | ||||
-rw-r--r-- | include/error_handling.h | 6 | ||||
-rw-r--r-- | include/global.h | 3 |
4 files changed, 23 insertions, 19 deletions
diff --git a/arm9/asm/error_handling.s b/arm9/asm/error_handling.s deleted file mode 100644 index d6330897..00000000 --- a/arm9/asm/error_handling.s +++ /dev/null @@ -1,17 +0,0 @@ - .include "asm/macros.inc" - .include "global.inc" - - .text - - thumb_func_start ErrorHandling -ErrorHandling: ; 0x02020C2C - push {r3, lr} - bl FUN_02031810 - cmp r0, #0x0 - beq _02020C42 - bl OS_GetProcMode - cmp r0, #0x12 - beq _02020C42 - bl PrintErrorMessageAndReset -_02020C42: - pop {r3, pc} diff --git a/arm9/src/error_handling.c b/arm9/src/error_handling.c new file mode 100644 index 00000000..7ccadd95 --- /dev/null +++ b/arm9/src/error_handling.c @@ -0,0 +1,16 @@ +#include "global.h" +#include "error_handling.h" + +extern u32 FUN_02031810(void); +extern void PrintErrorMessageAndReset(void); + +THUMB_FUNC void ErrorHandling(void) +{ + if (FUN_02031810()) + { + if (OS_GetProcMode() != OS_PROCMODE_IRQ) + { + PrintErrorMessageAndReset(); + } + } +}
\ No newline at end of file diff --git a/include/error_handling.h b/include/error_handling.h new file mode 100644 index 00000000..1299fcba --- /dev/null +++ b/include/error_handling.h @@ -0,0 +1,6 @@ +#ifndef POKEDIAMOND_ERROR_HANDLING_H +#define POKEDIAMOND_ERROR_HANDLING_H + +void ErrorHandling(void); + +#endif //POKEDIAMOND_ERROR_HANDLING_H diff --git a/include/global.h b/include/global.h index 3b377e5e..e0e8cb22 100644 --- a/include/global.h +++ b/include/global.h @@ -8,11 +8,10 @@ #include "nitro.h" #include "global.fieldmap.h" #include "constants/global.h" +#include "error_handling.h" #define NELEMS(a) (sizeof(a) / sizeof(*(a))) -extern void ErrorHandling(void); - #define GF_ASSERT(expr) do {if (!(expr)) ErrorHandling();} while (0) #ifndef IN_MAIN_C |