diff --git a/asm/unknown_070110/func_80070B04.s b/asm/unknown_070110/func_80070B04.s index fc219a86..3ad9426a 100644 --- a/asm/unknown_070110/func_80070B04.s +++ b/asm/unknown_070110/func_80070B04.s @@ -11,4 +11,4 @@ glabel func_80070B04 /* 071724 80070B24 00000000 */ nop /* 071728 80070B28 00000000 */ nop -/* 07172C 80070B2C 00000000 */ nop \ No newline at end of file +/* 07172C 80070B2C 00000000 */ nop diff --git a/include/PR/os_message.h b/include/PR/os_message.h index 191e1b1d..1418d898 100644 --- a/include/PR/os_message.h +++ b/include/PR/os_message.h @@ -160,4 +160,4 @@ extern void osSetEventMesg(OSEvent, OSMesgQueue *, OSMesg); } #endif -#endif /* !_OS_MESSAGE_H_ */ \ No newline at end of file +#endif /* !_OS_MESSAGE_H_ */ diff --git a/include/PR/os_vi.h b/include/PR/os_vi.h index 522bd1e0..9293ab08 100644 --- a/include/PR/os_vi.h +++ b/include/PR/os_vi.h @@ -111,4 +111,4 @@ void osViSwapBuffer(void *vaddr); extern OSViMode osViModeTable[]; /* Global VI mode table */ -#endif \ No newline at end of file +#endif diff --git a/lib/asm/non_matchings/unknown_0D3020/__osProbeTLB.s b/lib/asm/__osProbeTLB.s similarity index 89% rename from lib/asm/non_matchings/unknown_0D3020/__osProbeTLB.s rename to lib/asm/__osProbeTLB.s index acfe56d2..3e3e9539 100644 --- a/lib/asm/non_matchings/unknown_0D3020/__osProbeTLB.s +++ b/lib/asm/__osProbeTLB.s @@ -1,3 +1,13 @@ +/* The comment below is needed for this file to be picked up by generate_ld */ +/* RAM_POS: 0x800D35B0 */ + +.include "globals.inc" +.include "macros.inc" + +.set noat # allow manual use of $at +.set noreorder # dont insert nops after branches +.set gp=64 # 64-bit instructions are used + glabel __osProbeTLB /* 0D41B0 800D35B0 40085000 */ mfc0 $t0, $10 /* 0D41B4 800D35B4 310900FF */ andi $t1, $t0, 0xff diff --git a/lib/asm/exception.s b/lib/asm/exception.s new file mode 100644 index 00000000..44eb877d --- /dev/null +++ b/lib/asm/exception.s @@ -0,0 +1,18 @@ +/* The comment below is needed for this file to be picked up by generate_ld */ +/* RAM_POS: 0x800D2CB0 */ + +.include "globals.inc" +.include "macros.inc" + +.set noat # allow manual use of $at +.set noreorder # dont insert nops after branches +.set gp=64 # 64-bit instructions are used + +.include "lib/asm/exception/__osExceptionPreamble.s" +.include "lib/asm/exception/__osException.s" +.include "lib/asm/exception/send_mesg.s" +.include "lib/asm/exception/__osEnqueueAndYield.s" +.include "lib/asm/exception/__osEnqueueThread.s" +.include "lib/asm/exception/__osPopThread.s" +.include "lib/asm/exception/__osDispatchThread.s" +.include "lib/asm/exception/D_800D35A0.s" diff --git a/lib/asm/non_matchings/unknown_0D3020/D_800D35A0.s b/lib/asm/exception/D_800D35A0.s similarity index 100% rename from lib/asm/non_matchings/unknown_0D3020/D_800D35A0.s rename to lib/asm/exception/D_800D35A0.s diff --git a/lib/asm/non_matchings/unknown_0D3020/__osDispatchThread.s b/lib/asm/exception/__osDispatchThread.s similarity index 100% rename from lib/asm/non_matchings/unknown_0D3020/__osDispatchThread.s rename to lib/asm/exception/__osDispatchThread.s diff --git a/lib/asm/non_matchings/unknown_0D3020/__osEnqueueAndYield.s b/lib/asm/exception/__osEnqueueAndYield.s similarity index 100% rename from lib/asm/non_matchings/unknown_0D3020/__osEnqueueAndYield.s rename to lib/asm/exception/__osEnqueueAndYield.s diff --git a/lib/asm/non_matchings/unknown_0D3020/__osEnqueueThread.s b/lib/asm/exception/__osEnqueueThread.s similarity index 100% rename from lib/asm/non_matchings/unknown_0D3020/__osEnqueueThread.s rename to lib/asm/exception/__osEnqueueThread.s diff --git a/lib/asm/non_matchings/unknown_0D3020/__osException.s b/lib/asm/exception/__osException.s similarity index 100% rename from lib/asm/non_matchings/unknown_0D3020/__osException.s rename to lib/asm/exception/__osException.s diff --git a/lib/asm/non_matchings/unknown_0D3020/__osExceptionPreamble.s b/lib/asm/exception/__osExceptionPreamble.s similarity index 100% rename from lib/asm/non_matchings/unknown_0D3020/__osExceptionPreamble.s rename to lib/asm/exception/__osExceptionPreamble.s diff --git a/lib/asm/non_matchings/unknown_0D3020/__osPopThread.s b/lib/asm/exception/__osPopThread.s similarity index 100% rename from lib/asm/non_matchings/unknown_0D3020/__osPopThread.s rename to lib/asm/exception/__osPopThread.s diff --git a/lib/asm/non_matchings/unknown_0D3020/send_mesg.s b/lib/asm/exception/send_mesg.s similarity index 100% rename from lib/asm/non_matchings/unknown_0D3020/send_mesg.s rename to lib/asm/exception/send_mesg.s diff --git a/lib/asm/non_matchings/unknown_0D3020/D_800D25A0.s b/lib/asm/non_matchings/unknown_0D3160/D_800D25A0.s similarity index 100% rename from lib/asm/non_matchings/unknown_0D3020/D_800D25A0.s rename to lib/asm/non_matchings/unknown_0D3160/D_800D25A0.s diff --git a/lib/asm/non_matchings/unknown_0D3020/D_800D2680.s b/lib/asm/non_matchings/unknown_0D3160/D_800D2680.s similarity index 100% rename from lib/asm/non_matchings/unknown_0D3020/D_800D2680.s rename to lib/asm/non_matchings/unknown_0D3160/D_800D2680.s diff --git a/lib/asm/non_matchings/unknown_0D3020/D_800D2760.s b/lib/asm/non_matchings/unknown_0D3160/D_800D2760.s similarity index 100% rename from lib/asm/non_matchings/unknown_0D3020/D_800D2760.s rename to lib/asm/non_matchings/unknown_0D3160/D_800D2760.s diff --git a/lib/asm/non_matchings/unknown_0D3020/__osDequeueThread.s b/lib/asm/non_matchings/unknown_0D3160/__osDequeueThread.s similarity index 100% rename from lib/asm/non_matchings/unknown_0D3020/__osDequeueThread.s rename to lib/asm/non_matchings/unknown_0D3160/__osDequeueThread.s diff --git a/lib/asm/non_matchings/unknown_0D3020/__osDisableInt.s b/lib/asm/non_matchings/unknown_0D3160/__osDisableInt.s similarity index 100% rename from lib/asm/non_matchings/unknown_0D3020/__osDisableInt.s rename to lib/asm/non_matchings/unknown_0D3160/__osDisableInt.s diff --git a/lib/asm/non_matchings/unknown_0D3020/__osRestoreInt.s b/lib/asm/non_matchings/unknown_0D3160/__osRestoreInt.s similarity index 100% rename from lib/asm/non_matchings/unknown_0D3020/__osRestoreInt.s rename to lib/asm/non_matchings/unknown_0D3160/__osRestoreInt.s diff --git a/lib/asm/non_matchings/unknown_0D3020/__osViInit.s b/lib/asm/non_matchings/unknown_0D3160/__osViInit.s similarity index 100% rename from lib/asm/non_matchings/unknown_0D3020/__osViInit.s rename to lib/asm/non_matchings/unknown_0D3160/__osViInit.s diff --git a/lib/asm/non_matchings/unknown_0D3020/func_800D2C60.s b/lib/asm/non_matchings/unknown_0D3160/func_800D2C60.s similarity index 100% rename from lib/asm/non_matchings/unknown_0D3020/func_800D2C60.s rename to lib/asm/non_matchings/unknown_0D3160/func_800D2C60.s diff --git a/lib/asm/non_matchings/unknown_0D3020/_Printf.s b/lib/asm/non_matchings/unknown_0D4270/_Printf.s similarity index 100% rename from lib/asm/non_matchings/unknown_0D3020/_Printf.s rename to lib/asm/non_matchings/unknown_0D4270/_Printf.s diff --git a/lib/asm/non_matchings/unknown_0D3020/_Putfld.s b/lib/asm/non_matchings/unknown_0D4270/_Putfld.s similarity index 100% rename from lib/asm/non_matchings/unknown_0D3020/_Putfld.s rename to lib/asm/non_matchings/unknown_0D4270/_Putfld.s diff --git a/lib/asm/non_matchings/unknown_0D3020/__osGetSR.s b/lib/asm/non_matchings/unknown_0D4270/__osGetSR.s similarity index 100% rename from lib/asm/non_matchings/unknown_0D3020/__osGetSR.s rename to lib/asm/non_matchings/unknown_0D4270/__osGetSR.s diff --git a/lib/asm/non_matchings/unknown_0D3020/__osSetFpcCsr.s b/lib/asm/non_matchings/unknown_0D4270/__osSetFpcCsr.s similarity index 100% rename from lib/asm/non_matchings/unknown_0D3020/__osSetFpcCsr.s rename to lib/asm/non_matchings/unknown_0D4270/__osSetFpcCsr.s diff --git a/lib/asm/non_matchings/unknown_0D3020/__osSetSR.s b/lib/asm/non_matchings/unknown_0D4270/__osSetSR.s similarity index 100% rename from lib/asm/non_matchings/unknown_0D3020/__osSetSR.s rename to lib/asm/non_matchings/unknown_0D4270/__osSetSR.s diff --git a/lib/asm/non_matchings/unknown_0D3020/__osSiRawReadIo.s b/lib/asm/non_matchings/unknown_0D4270/__osSiRawReadIo.s similarity index 100% rename from lib/asm/non_matchings/unknown_0D3020/__osSiRawReadIo.s rename to lib/asm/non_matchings/unknown_0D4270/__osSiRawReadIo.s diff --git a/lib/asm/non_matchings/unknown_0D3020/__osSiRawWriteIo.s b/lib/asm/non_matchings/unknown_0D4270/__osSiRawWriteIo.s similarity index 100% rename from lib/asm/non_matchings/unknown_0D3020/__osSiRawWriteIo.s rename to lib/asm/non_matchings/unknown_0D4270/__osSiRawWriteIo.s diff --git a/lib/asm/non_matchings/unknown_0D3020/func_800D3670.s b/lib/asm/non_matchings/unknown_0D4270/func_800D3670.s similarity index 100% rename from lib/asm/non_matchings/unknown_0D3020/func_800D3670.s rename to lib/asm/non_matchings/unknown_0D4270/func_800D3670.s diff --git a/lib/asm/non_matchings/unknown_0D3020/func_800D3820.s b/lib/asm/non_matchings/unknown_0D4270/func_800D3820.s similarity index 100% rename from lib/asm/non_matchings/unknown_0D3020/func_800D3820.s rename to lib/asm/non_matchings/unknown_0D4270/func_800D3820.s diff --git a/lib/asm/non_matchings/unknown_0D3020/func_800D47F0.s b/lib/asm/non_matchings/unknown_0D4270/func_800D47F0.s similarity index 100% rename from lib/asm/non_matchings/unknown_0D3020/func_800D47F0.s rename to lib/asm/non_matchings/unknown_0D4270/func_800D47F0.s diff --git a/lib/asm/non_matchings/unknown_0D3020/osJamMesg.s b/lib/asm/non_matchings/unknown_0D4270/osJamMesg.s similarity index 100% rename from lib/asm/non_matchings/unknown_0D3020/osJamMesg.s rename to lib/asm/non_matchings/unknown_0D4270/osJamMesg.s diff --git a/lib/asm/non_matchings/unknown_0D3020/osMapTLBRdb.s b/lib/asm/non_matchings/unknown_0D4270/osMapTLBRdb.s similarity index 100% rename from lib/asm/non_matchings/unknown_0D3020/osMapTLBRdb.s rename to lib/asm/non_matchings/unknown_0D4270/osMapTLBRdb.s diff --git a/lib/asm/non_matchings/unknown_0D3020/osPiGetCmdQueue.s b/lib/asm/non_matchings/unknown_0D4270/osPiGetCmdQueue.s similarity index 100% rename from lib/asm/non_matchings/unknown_0D3020/osPiGetCmdQueue.s rename to lib/asm/non_matchings/unknown_0D4270/osPiGetCmdQueue.s diff --git a/lib/asm/non_matchings/unknown_0D3020/osPiRawWriteIo.s b/lib/asm/non_matchings/unknown_0D4270/osPiRawWriteIo.s similarity index 100% rename from lib/asm/non_matchings/unknown_0D3020/osPiRawWriteIo.s rename to lib/asm/non_matchings/unknown_0D4270/osPiRawWriteIo.s diff --git a/lib/asm/non_matchings/unknown_0D3020/osWritebackDCache.s b/lib/asm/non_matchings/unknown_0D4270/osWritebackDCache.s similarity index 100% rename from lib/asm/non_matchings/unknown_0D3020/osWritebackDCache.s rename to lib/asm/non_matchings/unknown_0D4270/osWritebackDCache.s diff --git a/lib/asm/non_matchings/unknown_0D3020/osWritebackICache.s b/lib/asm/non_matchings/unknown_0D4270/osWritebackICache.s similarity index 100% rename from lib/asm/non_matchings/unknown_0D3020/osWritebackICache.s rename to lib/asm/non_matchings/unknown_0D4270/osWritebackICache.s diff --git a/lib/src/osRecvMesg.c b/lib/src/osRecvMesg.c index 08e28a7f..c8f3efc8 100644 --- a/lib/src/osRecvMesg.c +++ b/lib/src/osRecvMesg.c @@ -7,7 +7,6 @@ extern OSThread *__osRunningThread; -//GLOBAL_ASM("lib/asm/non_matchings/unknown_0C96F0/osRecvMesg.s") s32 osRecvMesg(OSMesgQueue *mq, OSMesg *msg, s32 flags) { register u32 saveMask; diff --git a/lib/src/osSetTimer.c b/lib/src/osSetTimer.c index 34620e4d..c969461b 100644 --- a/lib/src/osSetTimer.c +++ b/lib/src/osSetTimer.c @@ -3,10 +3,10 @@ #include "macros.h" +#if 1 GLOBAL_ASM("lib/asm/non_matchings/unknown_0D3020/osSetTimer.s") - - -/*#include "libultra_internal.h" +#else +#include "libultra_internal.h" extern OSTimer *D_800E4910; @@ -25,4 +25,5 @@ u32 osSetTimer(OSTimer *t, OSTime value, OSTime interval, OSMesgQueue *mq, OSMes __osSetTimerIntr(time); } return 0; -}*/ \ No newline at end of file +} +#endif diff --git a/lib/src/osTimer.c b/lib/src/osTimer.c index dc3937b5..28d038e3 100644 --- a/lib/src/osTimer.c +++ b/lib/src/osTimer.c @@ -13,8 +13,10 @@ extern u32 D_8012D230; OSTime __osInsertTimer(OSTimer *t); +#if 1 GLOBAL_ASM("lib/asm/non_matchings/unknown_0D3020/__osTimerServicesInit.s") -/*void __osTimerServicesInit(void) +#else +void __osTimerServicesInit(void) { //D_8012D224 = 0; __osCurrentTime = 0; @@ -26,7 +28,8 @@ GLOBAL_ASM("lib/asm/non_matchings/unknown_0D3020/__osTimerServicesInit.s") D_800E4910->interval = D_800E4910->remaining; D_800E4910->mq = NULL; D_800E4910->msg = 0; -}*/ +} +#endif void __osTimerInterrupt(void) { @@ -67,8 +70,10 @@ void __osTimerInterrupt(void) } } +#if 1 GLOBAL_ASM("lib/asm/non_matchings/unknown_0D3020/__osSetTimerIntr.s") -/*void __osSetTimerIntr(OSTime tim) +#else +void __osSetTimerIntr(OSTime tim) { OSTime NewTime; u32 savedMask; @@ -77,8 +82,8 @@ GLOBAL_ASM("lib/asm/non_matchings/unknown_0D3020/__osSetTimerIntr.s") NewTime = tim + D_8012D230; __osSetCompare(NewTime); __osRestoreInt(savedMask); -}*/ - +} +#endif OSTime __osInsertTimer(OSTimer *t) diff --git a/lib/src/osViSwapBuffer.c b/lib/src/osViSwapBuffer.c index a0086baa..710fea86 100644 --- a/lib/src/osViSwapBuffer.c +++ b/lib/src/osViSwapBuffer.c @@ -10,4 +10,4 @@ void osViSwapBuffer(void* frameBufPtr){ D_800E4874->buffer = frameBufPtr; D_800E4874->unk00 |= 0x10; __osRestoreInt(saveMask); -} \ No newline at end of file +} diff --git a/lib/src/unknown_0D3160.c b/lib/src/unknown_0D3160.c index 8a8d2217..da6e3282 100644 --- a/lib/src/unknown_0D3160.c +++ b/lib/src/unknown_0D3160.c @@ -4,36 +4,11 @@ #include "types.h" #include "macros.h" -GLOBAL_ASM("lib/asm/non_matchings/unknown_0D3020/__osDisableInt.s") -GLOBAL_ASM("lib/asm/non_matchings/unknown_0D3020/__osRestoreInt.s") -GLOBAL_ASM("lib/asm/non_matchings/unknown_0D3020/D_800D25A0.s") -GLOBAL_ASM("lib/asm/non_matchings/unknown_0D3020/D_800D2680.s") -GLOBAL_ASM("lib/asm/non_matchings/unknown_0D3020/D_800D2760.s") -GLOBAL_ASM("lib/asm/non_matchings/unknown_0D3020/__osViInit.s") -GLOBAL_ASM("lib/asm/non_matchings/unknown_0D3020/func_800D2C60.s") -GLOBAL_ASM("lib/asm/non_matchings/unknown_0D3020/__osDequeueThread.s") -GLOBAL_ASM("lib/asm/non_matchings/unknown_0D3020/__osExceptionPreamble.s") -GLOBAL_ASM("lib/asm/non_matchings/unknown_0D3020/__osException.s") -GLOBAL_ASM("lib/asm/non_matchings/unknown_0D3020/send_mesg.s") -GLOBAL_ASM("lib/asm/non_matchings/unknown_0D3020/__osEnqueueAndYield.s") -GLOBAL_ASM("lib/asm/non_matchings/unknown_0D3020/__osEnqueueThread.s") -GLOBAL_ASM("lib/asm/non_matchings/unknown_0D3020/__osPopThread.s") -GLOBAL_ASM("lib/asm/non_matchings/unknown_0D3020/__osDispatchThread.s") -GLOBAL_ASM("lib/asm/non_matchings/unknown_0D3020/D_800D35A0.s") -GLOBAL_ASM("lib/asm/non_matchings/unknown_0D3020/__osProbeTLB.s") -GLOBAL_ASM("lib/asm/non_matchings/unknown_0D3020/func_800D3670.s") -GLOBAL_ASM("lib/asm/non_matchings/unknown_0D3020/osJamMesg.s") -GLOBAL_ASM("lib/asm/non_matchings/unknown_0D3020/osPiGetCmdQueue.s") -GLOBAL_ASM("lib/asm/non_matchings/unknown_0D3020/func_800D3820.s") -GLOBAL_ASM("lib/asm/non_matchings/unknown_0D3020/_Putfld.s") -GLOBAL_ASM("lib/asm/non_matchings/unknown_0D3020/_Printf.s") -GLOBAL_ASM("lib/asm/non_matchings/unknown_0D3020/__osSetSR.s") -GLOBAL_ASM("lib/asm/non_matchings/unknown_0D3020/__osGetSR.s") -GLOBAL_ASM("lib/asm/non_matchings/unknown_0D3020/__osSetFpcCsr.s") -GLOBAL_ASM("lib/asm/non_matchings/unknown_0D3020/__osSiRawReadIo.s") -GLOBAL_ASM("lib/asm/non_matchings/unknown_0D3020/__osSiRawWriteIo.s") -GLOBAL_ASM("lib/asm/non_matchings/unknown_0D3020/osWritebackDCache.s") -GLOBAL_ASM("lib/asm/non_matchings/unknown_0D3020/osWritebackICache.s") -GLOBAL_ASM("lib/asm/non_matchings/unknown_0D3020/osMapTLBRdb.s") -GLOBAL_ASM("lib/asm/non_matchings/unknown_0D3020/osPiRawWriteIo.s") -GLOBAL_ASM("lib/asm/non_matchings/unknown_0D3020/func_800D47F0.s") +GLOBAL_ASM("lib/asm/non_matchings/unknown_0D3160/__osDisableInt.s") +GLOBAL_ASM("lib/asm/non_matchings/unknown_0D3160/__osRestoreInt.s") +GLOBAL_ASM("lib/asm/non_matchings/unknown_0D3160/D_800D25A0.s") +GLOBAL_ASM("lib/asm/non_matchings/unknown_0D3160/D_800D2680.s") +GLOBAL_ASM("lib/asm/non_matchings/unknown_0D3160/D_800D2760.s") +GLOBAL_ASM("lib/asm/non_matchings/unknown_0D3160/__osViInit.s") +GLOBAL_ASM("lib/asm/non_matchings/unknown_0D3160/func_800D2C60.s") +GLOBAL_ASM("lib/asm/non_matchings/unknown_0D3160/__osDequeueThread.s") diff --git a/lib/src/unknown_0D4270.c b/lib/src/unknown_0D4270.c new file mode 100644 index 00000000..e9e75c2f --- /dev/null +++ b/lib/src/unknown_0D4270.c @@ -0,0 +1,22 @@ +/* The comment below is needed for this file to be picked up by generate_ld */ +/* RAM_POS: 0x800D3670 */ + +#include "types.h" +#include "macros.h" + +GLOBAL_ASM("lib/asm/non_matchings/unknown_0D4270/func_800D3670.s") +GLOBAL_ASM("lib/asm/non_matchings/unknown_0D4270/osJamMesg.s") +GLOBAL_ASM("lib/asm/non_matchings/unknown_0D4270/osPiGetCmdQueue.s") +GLOBAL_ASM("lib/asm/non_matchings/unknown_0D4270/func_800D3820.s") +GLOBAL_ASM("lib/asm/non_matchings/unknown_0D4270/_Putfld.s") +GLOBAL_ASM("lib/asm/non_matchings/unknown_0D4270/_Printf.s") +GLOBAL_ASM("lib/asm/non_matchings/unknown_0D4270/__osSetSR.s") +GLOBAL_ASM("lib/asm/non_matchings/unknown_0D4270/__osGetSR.s") +GLOBAL_ASM("lib/asm/non_matchings/unknown_0D4270/__osSetFpcCsr.s") +GLOBAL_ASM("lib/asm/non_matchings/unknown_0D4270/__osSiRawReadIo.s") +GLOBAL_ASM("lib/asm/non_matchings/unknown_0D4270/__osSiRawWriteIo.s") +GLOBAL_ASM("lib/asm/non_matchings/unknown_0D4270/osWritebackDCache.s") +GLOBAL_ASM("lib/asm/non_matchings/unknown_0D4270/osWritebackICache.s") +GLOBAL_ASM("lib/asm/non_matchings/unknown_0D4270/osMapTLBRdb.s") +GLOBAL_ASM("lib/asm/non_matchings/unknown_0D4270/osPiRawWriteIo.s") +GLOBAL_ASM("lib/asm/non_matchings/unknown_0D4270/func_800D47F0.s") diff --git a/tools/python/score.py b/tools/python/score.py index e790095f..18435543 100644 --- a/tools/python/score.py +++ b/tools/python/score.py @@ -9,6 +9,7 @@ ASM_FOLDERS = [ './asm/unknown_070110', './asm/gzip', './lib/asm', + './lib/asm/exception', ] # These will automatically be added to the adventure one percentage. @@ -25,7 +26,7 @@ for folder in ASM_FOLDERS: SRC_DIRECTORY = './src' LIB_SRC_DIRECTORY = './lib/src' -FUNCTION_REGEX = r'([/][*]([^*]|([*][^/]))*[*][/][\n]\s*)?(void|s64|s32|s16|s8|u64|u32|u16|u8|f32|f64)(\s|[*])*([0-9A-Za-z_]+)\s*[(][^)]*[)]\s*{' +FUNCTION_REGEX = r'([/][*][*]([^*]|([*][^/]))*[*][/][\n]\s*)?(void|s64|s32|s16|s8|u64|u32|u16|u8|f32|f64)(\s|[*])*([0-9A-Za-z_]+)\s*[(][^)]*[)]\s*{' GLOBAL_ASM_REGEX = r'GLOBAL_ASM[(]".*(?=\/)\/([^.]+).s"[)]' WIP_REGEX = r'#if(.|\n)*?(GLOBAL_ASM[(]([^)]*)[)])(.|\n)*?#else(.|\n)*?#endif' @@ -35,23 +36,27 @@ CODE_SIZE = CODE_END - CODE_START class DkrMapFile: def __init__(self): - with open('./build/dkr.map', 'r') as mapFile: - self.functionSizes = {} - functions = [] - lines = mapFile.read().split('\n') - for line in lines: - if line.startswith(' 0x00000000'): - if '=' in line: - line = line[0:line.find('=')-1] - address = int(line[26:26+8], 16) - if address >= CODE_START and address < CODE_END: - symbol = line[line.rfind(' ')+1:] - functions.append((symbol, address)) - functions.sort(key=lambda x:x[1]) # Sort by RAM address - for i in range(0, len(functions) - 1): - self.functionSizes[functions[i][0]] = functions[i + 1][1] - functions[i][1] - self.functionSizes[functions[len(functions) - 1][0]] = CODE_END - 0x800D7570 - self.numFunctions = len(functions) + try: + with open('./build/dkr.map', 'r') as mapFile: + self.functionSizes = {} + functions = [] + lines = mapFile.read().split('\n') + for line in lines: + if line.startswith(' 0x00000000'): + if '=' in line: + line = line[0:line.find('=')-1] + address = int(line[26:26+8], 16) + if address >= CODE_START and address < CODE_END: + symbol = line[line.rfind(' ')+1:] + functions.append((symbol, address)) + functions.sort(key=lambda x:x[1]) # Sort by RAM address + for i in range(0, len(functions) - 1): + self.functionSizes[functions[i][0]] = functions[i + 1][1] - functions[i][1] + self.functionSizes[functions[len(functions) - 1][0]] = CODE_END - 0x800D7570 + self.numFunctions = len(functions) + except FileNotFoundError: + print("You must build a rom before it can be scored!") + sys.exit() MAP_FILE = DkrMapFile()