55#include "cardengine_header_arm9.h"
66
77#define dsiBios BIT(11)
8+ #define bypassExceptionHandler BIT(16)
89
910#define EXCEPTION_VECTOR_SDK1 (*(VoidFn *)(0x27FFD9C))
1011
@@ -31,12 +32,12 @@ void userException() {
3132void setExceptionHandler2 () {
3233//---------------------------------------------------------------------------------
3334 #ifdef TWLSDK
34- if (EXCEPTION_VECTOR == enterException && * exceptionC == userException ) return ;
35+ if (EXCEPTION_VECTOR == (( ce9 -> valueBits & bypassExceptionHandler ) ? 0 : enterException ) && * exceptionC == userException ) return ;
3536 #else
3637 if (!(ce9 -> valueBits & dsiBios )) {
37- if (EXCEPTION_VECTOR_SDK1 == enterException && * exceptionC == userException ) return ;
38+ if (EXCEPTION_VECTOR_SDK1 == (( ce9 -> valueBits & bypassExceptionHandler ) ? 0 : enterException ) && * exceptionC == userException ) return ;
3839 } else {
39- if (EXCEPTION_VECTOR == enterException && * exceptionC == userException ) return ;
40+ if (EXCEPTION_VECTOR == (( ce9 -> valueBits & bypassExceptionHandler ) ? 0 : enterException ) && * exceptionC == userException ) return ;
4041 }
4142 #endif
4243
@@ -47,13 +48,13 @@ void setExceptionHandler2() {
4748 #endif
4849 #ifdef TWLSDK
4950 exceptionStack = (u32 )EXCEPTION_STACK_LOCATION_SDK5 ;
50- EXCEPTION_VECTOR = enterException ;
51+ EXCEPTION_VECTOR = ( ce9 -> valueBits & bypassExceptionHandler ) ? 0 : enterException ;
5152 #else
5253 exceptionStack = (u32 )EXCEPTION_STACK_LOCATION ;
5354 if (!(ce9 -> valueBits & dsiBios )) {
54- EXCEPTION_VECTOR_SDK1 = enterException ;
55+ EXCEPTION_VECTOR_SDK1 = ( ce9 -> valueBits & bypassExceptionHandler ) ? 0 : enterException ;
5556 } else {
56- EXCEPTION_VECTOR = enterException ;
57+ EXCEPTION_VECTOR = ( ce9 -> valueBits & bypassExceptionHandler ) ? 0 : enterException ;
5758 }
5859 #endif
5960 * exceptionC = userException ;
0 commit comments