summaryrefslogtreecommitdiff
path: root/src/code
diff options
context:
space:
mode:
authorfig02 <fig02srl@gmail.com>2024-12-15 11:07:21 -0500
committerGitHub <noreply@github.com>2024-12-15 11:07:21 -0500
commitff78b1263b8d16da70031d04ff14af3431380b13 (patch)
treebc36ce42fc75809c7495e227658294d4bf74e65a /src/code
parent2eb0b9151675c056b46c629ee10aca2331903866 (diff)
Add macros for line number differences (#2365)
* initial work, think I got all of them * cleanup line_numbers.h * fix gc-eu-mq-dbg * fix matching problems * remove old lines * format * missed some stuff * comment fixes * other * review changes
Diffstat (limited to 'src/code')
-rw-r--r--src/code/game.c21
-rw-r--r--src/code/graph.c30
-rw-r--r--src/code/padmgr.c9
-rw-r--r--src/code/sys_cfb.c11
-rw-r--r--src/code/z_bgcheck.c16
-rw-r--r--src/code/z_play.c17
-rw-r--r--src/code/z_room.c22
7 files changed, 28 insertions, 98 deletions
diff --git a/src/code/game.c b/src/code/game.c
index bf7a4ce7c..2bed93e96 100644
--- a/src/code/game.c
+++ b/src/code/game.c
@@ -3,6 +3,7 @@
#include "libc64/os_malloc.h"
#include "terminal.h"
#include "versions.h"
+#include "line_numbers.h"
#if PLATFORM_N64
#include "n64dd.h"
#endif
@@ -390,15 +391,7 @@ void GameState_InitArena(GameState* gameState, size_t size) {
} else {
THA_Init(&gameState->tha, NULL, 0);
PRINTF(T("ハイラル確保失敗\n", "Failure to secure Hyrule\n"));
-#if OOT_VERSION < NTSC_1_1
- HUNGUP_AND_CRASH("../game.c", 895);
-#elif OOT_VERSION < PAL_1_0
- HUNGUP_AND_CRASH("../game.c", 898);
-#elif OOT_VERSION < GC_JP
- HUNGUP_AND_CRASH("../game.c", 985);
-#else
- HUNGUP_AND_CRASH("../game.c", 999);
-#endif
+ HUNGUP_AND_CRASH("../game.c", LN4(895, 898, 985, 999));
}
}
@@ -439,15 +432,7 @@ void GameState_Realloc(GameState* gameState, size_t size) {
SystemArena_Display();
#endif
-#if OOT_VERSION < NTSC_1_1
- HUNGUP_AND_CRASH("../game.c", 940);
-#elif OOT_VERSION < PAL_1_0
- HUNGUP_AND_CRASH("../game.c", 943);
-#elif OOT_VERSION < GC_JP
- HUNGUP_AND_CRASH("../game.c", 1030);
-#else
- HUNGUP_AND_CRASH("../game.c", 1044);
-#endif
+ HUNGUP_AND_CRASH("../game.c", LN4(940, 943, 1030, 1044));
}
}
diff --git a/src/code/graph.c b/src/code/graph.c
index 2564d83dd..84186386e 100644
--- a/src/code/graph.c
+++ b/src/code/graph.c
@@ -3,6 +3,7 @@
#include "terminal.h"
#include "ucode_disas.h"
#include "versions.h"
+#include "line_numbers.h"
#define GFXPOOL_HEAD_MAGIC 0x1234
#define GFXPOOL_TAIL_MAGIC 0x5678
@@ -379,30 +380,15 @@ void Graph_Update(GraphicsContext* gfxCtx, GameState* gameState) {
PRINTF("%c", BEL);
PRINTF(VT_COL(RED, WHITE) T("ダイナミック領域先頭が破壊されています\n", "Dynamic area head is destroyed\n")
VT_RST);
-#if OOT_VERSION < NTSC_1_1
- Fault_AddHungupAndCrash("../graph.c", 937);
-#elif OOT_VERSION < PAL_1_0
- Fault_AddHungupAndCrash("../graph.c", 940);
-#elif OOT_VERSION < GC_JP
- Fault_AddHungupAndCrash("../graph.c", 951);
-#else
- Fault_AddHungupAndCrash("../graph.c", 1070);
-#endif
+ Fault_AddHungupAndCrash("../graph.c", LN4(937, 940, 951, 1070));
}
+
if (pool->tailMagic != GFXPOOL_TAIL_MAGIC) {
problem = true;
PRINTF("%c", BEL);
PRINTF(VT_COL(RED, WHITE)
T("ダイナミック領域末尾が破壊されています\n", "Dynamic region tail is destroyed\n") VT_RST);
-#if OOT_VERSION < NTSC_1_1
- Fault_AddHungupAndCrash("../graph.c", 943);
-#elif OOT_VERSION < PAL_1_0
- Fault_AddHungupAndCrash("../graph.c", 946);
-#elif OOT_VERSION < GC_JP
- Fault_AddHungupAndCrash("../graph.c", 957);
-#else
- Fault_AddHungupAndCrash("../graph.c", 1076);
-#endif
+ Fault_AddHungupAndCrash("../graph.c", LN4(943, 946, 957, 1076));
}
}
@@ -494,14 +480,8 @@ void Graph_ThreadEntry(void* arg0) {
sprintf(faultMsg, "CLASS SIZE= %d bytes", size);
Fault_AddHungupAndCrashImpl("GAME CLASS MALLOC FAILED", faultMsg);
-#elif OOT_VERSION < NTSC_1_1
- Fault_AddHungupAndCrash("../graph.c", 1067);
-#elif OOT_VERSION < PAL_1_0
- Fault_AddHungupAndCrash("../graph.c", 1070);
-#elif OOT_VERSION < GC_JP
- Fault_AddHungupAndCrash("../graph.c", 1081);
#else
- Fault_AddHungupAndCrash("../graph.c", 1200);
+ Fault_AddHungupAndCrash("../graph.c", LN4(1067, 1070, 1081, 1200));
#endif
}
diff --git a/src/code/padmgr.c b/src/code/padmgr.c
index 4486e541a..33a505663 100644
--- a/src/code/padmgr.c
+++ b/src/code/padmgr.c
@@ -31,6 +31,7 @@
#include "global.h"
#include "fault.h"
#include "terminal.h"
+#include "line_numbers.h"
#define PADMGR_LOG(controllerNum, msg) \
if (DEBUG_FEATURES) { \
@@ -326,13 +327,7 @@ void PadMgr_UpdateInputs(PadMgr* padMgr) {
default:
// Unknown error response
LOG_HEX("padnow1->errno", pad->errno, "../padmgr.c", 396);
-#if OOT_VERSION < NTSC_1_1
- Fault_AddHungupAndCrash("../padmgr.c", 379);
-#elif OOT_VERSION < GC_JP
- Fault_AddHungupAndCrash("../padmgr.c", 382);
-#else
- Fault_AddHungupAndCrash("../padmgr.c", 397);
-#endif
+ Fault_AddHungupAndCrash("../padmgr.c", LN3(379, 382, 397));
break;
}
diff --git a/src/code/sys_cfb.c b/src/code/sys_cfb.c
index cbde146fa..9ad789176 100644
--- a/src/code/sys_cfb.c
+++ b/src/code/sys_cfb.c
@@ -1,4 +1,5 @@
#include "global.h"
+#include "line_numbers.h"
#pragma increment_block_number "gc-eu:128 gc-eu-mq:128 gc-jp:128 gc-jp-ce:128 gc-jp-mq:128 gc-us:128 gc-us-mq:128" \
"pal-1.1:128"
@@ -33,15 +34,7 @@ void SysCfb_Init(s32 n64dd) {
PRINTF("RAM4M mode\n");
sSysCfbEnd = 0x80400000;
} else {
-#if OOT_VERSION < NTSC_1_1
- LogUtils_HungupThread("../sys_cfb.c", 305);
-#elif OOT_VERSION < PAL_1_0
- LogUtils_HungupThread("../sys_cfb.c", 308);
-#elif OOT_VERSION < GC_JP
- LogUtils_HungupThread("../sys_cfb.c", 322);
-#else
- LogUtils_HungupThread("../sys_cfb.c", 354);
-#endif
+ LogUtils_HungupThread("../sys_cfb.c", LN4(305, 308, 322, 354));
}
screenSize = SCREEN_WIDTH * SCREEN_HEIGHT;
diff --git a/src/code/z_bgcheck.c b/src/code/z_bgcheck.c
index bb1b3a71f..c8b0e491d 100644
--- a/src/code/z_bgcheck.c
+++ b/src/code/z_bgcheck.c
@@ -1,5 +1,6 @@
#include "global.h"
#include "terminal.h"
+#include "line_numbers.h"
#pragma increment_block_number "ntsc-1.0:128 ntsc-1.1:128 ntsc-1.2:128"
@@ -1610,13 +1611,11 @@ void BgCheck_Allocate(CollisionContext* colCtx, PlayState* play, CollisionHeader
colCtx->subdivAmount.x * sizeof(StaticLookup) * colCtx->subdivAmount.y *
colCtx->subdivAmount.z,
ALIGNOF_MASK(StaticLookup));
+
if (colCtx->lookupTbl == NULL) {
-#if OOT_VERSION < NTSC_1_1
- LogUtils_HungupThread("../z_bgcheck.c", 4173);
-#else
- LogUtils_HungupThread("../z_bgcheck.c", 4176);
-#endif
+ LogUtils_HungupThread("../z_bgcheck.c", LN1(4173, 4176));
}
+
colCtx->minBounds.x = colCtx->colHeader->minBounds.x;
colCtx->minBounds.y = colCtx->colHeader->minBounds.y;
colCtx->minBounds.z = colCtx->colHeader->minBounds.z;
@@ -1633,17 +1632,14 @@ void BgCheck_Allocate(CollisionContext* colCtx, PlayState* play, CollisionHeader
colCtx->colHeader->numPolygons * sizeof(u8) + colCtx->dyna.polyNodesMax * sizeof(SSNode) +
colCtx->dyna.polyListMax * sizeof(CollisionPoly) + colCtx->dyna.vtxListMax * sizeof(Vec3s) +
sizeof(CollisionContext);
+
if (customNodeListMax > 0) {
// tblMax is set without checking if customNodeListMax will result in a memory overflow
// this is a non-issue as long as sceneSubdivisionList.nodeListMax is -1
tblMax = customNodeListMax;
} else {
if (colCtx->memSize < memSize) {
-#if OOT_VERSION < NTSC_1_1
- LogUtils_HungupThread("../z_bgcheck.c", 4227);
-#else
- LogUtils_HungupThread("../z_bgcheck.c", 4230);
-#endif
+ LogUtils_HungupThread("../z_bgcheck.c", LN1(4227, 4230));
}
tblMax = (colCtx->memSize - memSize) / sizeof(SSNode);
}
diff --git a/src/code/z_play.c b/src/code/z_play.c
index 068bc6ee8..29d692433 100644
--- a/src/code/z_play.c
+++ b/src/code/z_play.c
@@ -4,6 +4,7 @@
#include "quake.h"
#include "terminal.h"
#include "versions.h"
+#include "line_numbers.h"
#if PLATFORM_N64
#include "n64dd.h"
#endif
@@ -176,21 +177,7 @@ void Play_SetupTransition(PlayState* this, s32 transitionType) {
break;
default:
-#if OOT_VERSION < NTSC_1_1
- HUNGUP_AND_CRASH("../z_play.c", 2263);
-#elif OOT_VERSION < PAL_1_0
- HUNGUP_AND_CRASH("../z_play.c", 2266);
-#elif OOT_VERSION < PAL_1_1
- HUNGUP_AND_CRASH("../z_play.c", 2269);
-#elif OOT_VERSION < GC_JP
- HUNGUP_AND_CRASH("../z_play.c", 2272);
-#elif OOT_VERSION < GC_EU_MQ_DBG
- HUNGUP_AND_CRASH("../z_play.c", 2287);
-#elif OOT_VERSION < GC_JP_CE
- HUNGUP_AND_CRASH("../z_play.c", 2290);
-#else
- HUNGUP_AND_CRASH("../z_play.c", 2293);
-#endif
+ HUNGUP_AND_CRASH("../z_play.c", LN5(2263, 2266, 2269, 2272, 2287, 2290, 2293));
break;
}
}
diff --git a/src/code/z_room.c b/src/code/z_room.c
index 80154f61c..67d99eb21 100644
--- a/src/code/z_room.c
+++ b/src/code/z_room.c
@@ -2,6 +2,7 @@
#include "fault.h"
#include "terminal.h"
#include "versions.h"
+#include "line_numbers.h"
#if PLATFORM_N64
#include "n64dd.h"
#endif
@@ -456,14 +457,11 @@ RoomShapeImageMultiBgEntry* Room_GetImageMultiBgEntry(RoomShapeImageMulti* roomS
PRINTF(VT_COL(RED, WHITE) T("z_room.c:カメラIDに一致するデータが存在しません camid=%d\n",
"z_room.c: Data consistent with camera id does not exist camid=%d\n") VT_RST,
bgCamIndex);
-#if OOT_VERSION < NTSC_1_1
- Fault_AddHungupAndCrash("../z_room.c", 724);
-#elif OOT_VERSION < PAL_1_0
- Fault_AddHungupAndCrash("../z_room.c", 727);
-#elif OOT_VERSION < GC_JP
- Fault_AddHungupAndCrash("../z_room.c", 721);
-#else
+
+#if PLATFORM_GC
LogUtils_HungupThread("../z_room.c", 726);
+#else
+ Fault_AddHungupAndCrash("../z_room.c", LN2(724, 727, 721));
#endif
return NULL;
@@ -547,14 +545,10 @@ void Room_DrawImage(PlayState* play, Room* room, u32 flags) {
} else if (roomShape->amountType == ROOM_SHAPE_IMAGE_AMOUNT_MULTI) {
Room_DrawImageMulti(play, room, flags);
} else {
-#if OOT_VERSION < NTSC_1_1
- Fault_AddHungupAndCrash("../z_room.c", 849);
-#elif OOT_VERSION < PAL_1_0
- Fault_AddHungupAndCrash("../z_room.c", 852);
-#elif OOT_VERSION < GC_JP
- Fault_AddHungupAndCrash("../z_room.c", 836);
-#else
+#if PLATFORM_GC
LogUtils_HungupThread("../z_room.c", 841);
+#else
+ Fault_AddHungupAndCrash("../z_room.c", LN2(849, 852, 836));
#endif
}
}