1
0
Fork 0
mirror of https://github.com/zeldaret/oot.git synced 2024-11-14 21:40:03 +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

@ -399,6 +399,7 @@ $(shell mkdir -p $(foreach dir, \
endif
ifeq ($(COMPILER),ido)
$(BUILD_DIR)/src/boot/logutils.o: OPTFLAGS := -O2
$(BUILD_DIR)/src/boot/stackcheck.o: OPTFLAGS := -O2
$(BUILD_DIR)/src/code/__osMalloc.o: OPTFLAGS := -O2
@ -410,7 +411,6 @@ $(BUILD_DIR)/src/code/jpegutils.o: OPTFLAGS := -O2
$(BUILD_DIR)/src/code/jpegdecoder.o: OPTFLAGS := -O2
$(BUILD_DIR)/src/code/load.o: OPTFLAGS := -O2
$(BUILD_DIR)/src/code/loadfragment2.o: OPTFLAGS := -O2
$(BUILD_DIR)/src/code/logutils.o: OPTFLAGS := -O2
$(BUILD_DIR)/src/code/mtxuty-cvt.o: OPTFLAGS := -O2
$(BUILD_DIR)/src/code/padsetup.o: OPTFLAGS := -O2
$(BUILD_DIR)/src/code/padutils.o: OPTFLAGS := -O2

View file

@ -5,4 +5,6 @@
extern u32 B_80008EE0;
void func_80001720(void);
#endif

View file

@ -4,7 +4,6 @@
#include "z64.h"
#include "macros.h"
void cleararena(void);
void bootproc(void);
void Main_ThreadEntry(void* arg);
void Idle_ThreadEntry(void* arg);
@ -47,6 +46,15 @@ s32 osSendMesg(OSMesgQueue* mq, OSMesg msg, s32 flag);
void osStopThread(OSThread* thread);
void osViExtendVStart(u32 value);
s32 osRecvMesg(OSMesgQueue* mq, OSMesg* msg, s32 flag);
#if PLATFORM_N64
void osInitialize(void);
#else
#define osInitialize() \
{ \
__osInitialize_common(); \
__osInitialize_autodetect(); \
}
#endif
void __osInitialize_common(void);
void __osInitialize_autodetect(void);
void __osEnqueueAndYield(OSThread**);

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

View file

@ -1,5 +1,5 @@
entrypoint = 0x80000400; // type:func
cleararena = 0x80000460; // type:func
bootclear = 0x80000460; // type:func
bootproc = 0x80000498; // type:func
Main_ThreadEntry = 0x800005A0; // type:func
Idle_ThreadEntry = 0x8000063C; // type:func
@ -27,7 +27,7 @@ func_800015E8_unknown = 0x800015E8; // type:func
func_8000161C_unknown = 0x8000161C; // type:func
func_80001640_unknown = 0x80001640; // type:func
func_80001714_unknown = 0x80001714; // type:func
func_80001720_unknown = 0x80001720; // type:func
func_80001720 = 0x80001720; // type:func
osSyncPrintfUnused = 0x80001750; // type:func
osSyncPrintf = 0x8000176C; // type:func
rmonPrintf = 0x80001788; // type:func

View file

@ -9,3 +9,11 @@ D_0F000000 = 0x0F000000;
// z_bg_mjin
D_06000000 = 0x06000000;
#if PLATFORM_N64
// boot_main.c
func_80001720 = 0x80001720;
osInitialize = 0x80003230;
#endif