1
0
Fork 0
mirror of https://github.com/zeldaret/oot.git synced 2025-07-08 08:55:17 +00:00

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
This commit is contained in:
fig02 2024-12-15 11:07:21 -05:00 committed by GitHub
parent 2eb0b91516
commit ff78b1263b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
13 changed files with 111 additions and 144 deletions

View file

@ -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));
}
}

View file

@ -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
}

View file

@ -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;
}

View file

@ -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;

View file

@ -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);
}

View file

@ -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;
}
}

View file

@ -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
}
}