1
0
Fork 0
mirror of https://github.com/zeldaret/oot.git synced 2025-07-18 13:54:46 +00:00

[ntsc-1.2] Match boot_main.c, logutils.c, z_locale.c (text) (#2053)

* Match boot_main.c, logutils.c, z_locale.c (text)

* review

* review 2
This commit is contained in:
Dragorn421 2024-08-19 22:17:41 +02:00 committed by GitHub
parent f5fd8daffb
commit 6bc6cedaf8
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
8 changed files with 59 additions and 13 deletions

View file

@ -1,5 +1,8 @@
#include "global.h"
#include "boot.h"
#if PLATFORM_N64
#include "cic6105.h"
#endif
StackEntry sBootThreadInfo;
OSThread sIdleThread;
@ -15,9 +18,11 @@ void bootproc(void) {
StackCheck_Init(&sBootThreadInfo, sBootThreadStack, STACK_TOP(sBootThreadStack), 0, -1, "boot");
osMemSize = osGetMemSize();
#if PLATFORM_N64
func_80001720();
#endif
bootclear();
__osInitialize_common();
__osInitialize_autodetect();
osInitialize();
gCartHandle = osCartRomInit();
osDriveRomInit();

View file

@ -1,16 +1,18 @@
#include "global.h"
#include "terminal.h"
#if OOT_DEBUG
#if PLATFORM_N64 || OOT_DEBUG
f32 LogUtils_CheckFloatRange(const char* exp, int line, const char* valueName, f32 value, const char* minName, f32 min,
const char* maxName, f32 max) {
if (value < min || max < value) {
PRINTF("%s %d: range error %s(%f) < %s(%f) < %s(%f)\n", exp, line, minName, min, valueName, value, maxName,
max);
osSyncPrintf("%s %d: range error %s(%f) < %s(%f) < %s(%f)\n", exp, line, minName, min, valueName, value,
maxName, max);
}
return value;
}
#endif
#if OOT_DEBUG
s32 LogUtils_CheckIntRange(const char* exp, int line, const char* valueName, s32 value, const char* minName, s32 min,
const char* maxName, s32 max) {
if (value < min || max < value) {
@ -105,11 +107,15 @@ void LogUtils_LogThreadId(const char* name, int line) {
void LogUtils_HungupThread(const char* name, int line) {
OSId threadId = osGetThreadId(NULL);
PRINTF("*** HungUp in thread %d, [%s:%d] ***\n", threadId, name, line);
#if PLATFORM_N64 || OOT_DEBUG
osSyncPrintf("*** HungUp in thread %d, [%s:%d] ***\n", threadId, name, line);
#endif
Fault_AddHungupAndCrash(name, line);
}
void LogUtils_ResetHungup(void) {
PRINTF("*** Reset ***\n");
#if PLATFORM_N64 || OOT_DEBUG
osSyncPrintf("*** Reset ***\n");
#endif
Fault_AddHungupAndCrash("Reset", 0);
}

View file

@ -3,13 +3,26 @@
#include "terminal.h"
s32 gCurrentRegion = 0;
LocaleCartInfo sCartInfo;
void Locale_Init(void) {
#if PLATFORM_N64
ALIGNED(4) u8 regionInfo[4];
u8 countryCode;
osEPiReadIo(gCartHandle, 0x3C, (u32*)regionInfo);
countryCode = regionInfo[2];
#else
static LocaleCartInfo sCartInfo;
u8 countryCode;
osEPiReadIo(gCartHandle, 0x38, &sCartInfo.mediaFormat);
osEPiReadIo(gCartHandle, 0x3C, &sCartInfo.regionInfo);
switch (sCartInfo.countryCode) {
countryCode = sCartInfo.countryCode;
#endif
switch (countryCode) {
case 'J': // "NTSC-J (Japan)"
gCurrentRegion = REGION_JP;
break;
@ -22,7 +35,11 @@ void Locale_Init(void) {
default:
PRINTF(VT_COL(RED, WHITE));
PRINTF("z_locale_init: 日本用かアメリカ用か判別できません\n");
#if PLATFORM_N64
LogUtils_HungupThread("../z_locale.c", 101);
#else
LogUtils_HungupThread("../z_locale.c", 118);
#endif
PRINTF(VT_RST);
break;
}