summaryrefslogtreecommitdiff
path: root/src/boot
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/boot
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/boot')
-rw-r--r--src/boot/z_locale.c11
-rw-r--r--src/boot/z_std_dma.c30
2 files changed, 12 insertions, 29 deletions
diff --git a/src/boot/z_locale.c b/src/boot/z_locale.c
index cf5a64d2f..41c6ea00c 100644
--- a/src/boot/z_locale.c
+++ b/src/boot/z_locale.c
@@ -2,6 +2,7 @@
#include "region.h"
#include "terminal.h"
#include "versions.h"
+#include "line_numbers.h"
s32 gCurrentRegion = 0;
@@ -39,15 +40,7 @@ void Locale_Init(void) {
PRINTF(VT_COL(RED, WHITE));
PRINTF(T("z_locale_init: 日本用かアメリカ用か判別できません\n",
"z_locale_init: Can't tell if it's for Japan or America\n"));
-#if OOT_VERSION < NTSC_1_1
- LogUtils_HungupThread("../z_locale.c", 86);
-#elif OOT_VERSION < PAL_1_0
- LogUtils_HungupThread("../z_locale.c", 92);
-#elif OOT_VERSION < GC_JP
- LogUtils_HungupThread("../z_locale.c", 101);
-#else
- LogUtils_HungupThread("../z_locale.c", 118);
-#endif
+ LogUtils_HungupThread("../z_locale.c", LN4(86, 92, 101, 118));
PRINTF(VT_RST);
break;
}
diff --git a/src/boot/z_std_dma.c b/src/boot/z_std_dma.c
index 350c98e02..d962f6788 100644
--- a/src/boot/z_std_dma.c
+++ b/src/boot/z_std_dma.c
@@ -22,6 +22,7 @@
#include "fault.h"
#include "stack.h"
#include "terminal.h"
+#include "line_numbers.h"
#if PLATFORM_N64
#include "n64dd.h"
#endif
@@ -296,14 +297,9 @@ NORETURN void DmaMgr_Error(DmaRequest* req, const char* filename, const char* er
Fault_AddHungupAndCrashImpl(buff1, buff2);
}
-#define DMA_ERROR(req, filename, errorName, errorDesc, file, line1, line2, line3) \
- DmaMgr_Error(req, filename, errorName, errorDesc)
-#elif OOT_VERSION < NTSC_1_1
-#define DMA_ERROR(req, filename, errorName, errorDesc, file, line1, line2, line3) Fault_AddHungupAndCrash(file, line1)
-#elif OOT_VERSION < GC_JP
-#define DMA_ERROR(req, filename, errorName, errorDesc, file, line1, line2, line3) Fault_AddHungupAndCrash(file, line2)
+#define DMA_ERROR(req, filename, errorName, errorDesc, file, line) DmaMgr_Error(req, filename, errorName, errorDesc)
#else
-#define DMA_ERROR(req, filename, errorName, errorDesc, file, line1, line2, line3) Fault_AddHungupAndCrash(file, line3)
+#define DMA_ERROR(req, filename, errorName, errorDesc, file, line) Fault_AddHungupAndCrash(file, line)
#endif
#if PLATFORM_GC
@@ -409,7 +405,7 @@ void DmaMgr_ProcessRequest(DmaRequest* req) {
DMA_ERROR(req, filename, "Segment Alignment Error",
T("セグメント境界をまたがってDMA転送することはできません",
"DMA transfers cannot cross segment boundaries"),
- "../z_std_dma.c", 575, 578, 726);
+ "../z_std_dma.c", LN3(575, 578, 726));
}
DmaMgr_DmaRomToRam(iter->romStart + (vrom - iter->file.vromStart), ram, size);
@@ -430,7 +426,7 @@ void DmaMgr_ProcessRequest(DmaRequest* req) {
DMA_ERROR(req, filename, "Can't Transfer Segment",
T("圧縮されたセグメントの途中からはDMA転送することはできません",
"DMA transfer cannot be performed from the middle of a compressed segment"),
- "../z_std_dma.c", 595, 598, 746);
+ "../z_std_dma.c", LN3(595, 598, 746));
}
if (size != iter->file.vromEnd - iter->file.vromStart) {
@@ -439,7 +435,7 @@ void DmaMgr_ProcessRequest(DmaRequest* req) {
DMA_ERROR(req, filename, "Can't Transfer Segment",
T("圧縮されたセグメントの一部だけをDMA転送することはできません",
"It is not possible to DMA only part of a compressed segment"),
- "../z_std_dma.c", 601, 604, 752);
+ "../z_std_dma.c", LN3(601, 604, 752));
}
// Reduce the thread priority and decompress the file, the decompression routine handles the DMA
@@ -472,8 +468,8 @@ void DmaMgr_ProcessRequest(DmaRequest* req) {
// Error, rom is compressed so DMA may only be requested within the filesystem bounds
DMA_ERROR(req, NULL, "DATA DON'T EXIST",
- T("該当するデータが存在しません", "Corresponding data does not exist"), "../z_std_dma.c", 621,
- 624, 771);
+ T("該当するデータが存在しません", "Corresponding data does not exist"), "../z_std_dma.c",
+ LN3(621, 624, 771));
return;
} else {
// ROM is uncompressed, allow arbitrary DMA even if the region is not marked in the filesystem
@@ -543,7 +539,7 @@ s32 DmaMgr_RequestAsync(DmaRequest* req, void* ram, uintptr_t vrom, size_t size,
(size == 0) || (size & 1)) {
//! @bug `req` is passed to `DMA_ERROR` without rom, ram and size being set
DMA_ERROR(req, NULL, "ILLIGAL DMA-FUNCTION CALL", T("パラメータ異常です", "Parameter error"), "../z_std_dma.c",
- UNK_LINE, UNK_LINE, UNK_LINE);
+ UNK_LINE);
}
#endif
@@ -645,13 +641,7 @@ void DmaMgr_Init(void) {
PRINTF("_bootSegmentRomStart(%08x) != dma_rom_ad[0].rom_b(%08x)\n", _bootSegmentRomStart,
gDmaDataTable[0].file.vromEnd);
//! @bug The main code file where fault.c resides is not yet loaded
-#if OOT_VERSION < NTSC_1_1
- Fault_AddHungupAndCrash("../z_std_dma.c", 837);
-#elif OOT_VERSION < GC_JP
- Fault_AddHungupAndCrash("../z_std_dma.c", 840);
-#else
- Fault_AddHungupAndCrash("../z_std_dma.c", 1055);
-#endif
+ Fault_AddHungupAndCrash("../z_std_dma.c", LN3(837, 840, 1055));
}
// Start the DMA manager