1
0
Fork 0
mirror of https://github.com/zeldaret/oot.git synced 2024-11-14 21:40:03 +00:00
oot/src/boot/z_locale.c

73 lines
1.6 KiB
C
Raw Normal View History

2020-03-17 04:31:30 +00:00
#include <ultra64.h>
#include <global.h>
#include <vt.h>
#include <padmgr.h>
u32 gCurrentRegion = 0;
LocaleCartInfo sCartInfo;
2020-03-22 21:19:43 +00:00
// temporary
2020-03-17 04:31:30 +00:00
extern PadMgr gPadMgr;
2020-03-22 21:19:43 +00:00
void Locale_Init() {
2020-03-17 04:31:30 +00:00
osEPiReadIo(gCartHandle, 0x38, &sCartInfo.mediaFormat);
osEPiReadIo(gCartHandle, 0x3C, &sCartInfo.regionInfo);
2020-03-22 21:19:43 +00:00
switch (sCartInfo.countryCode) {
2020-03-17 04:31:30 +00:00
case 'J': // "NTSC-U (North America)"
gCurrentRegion = REGION_US;
break;
case 'E': // "NTSC-J (Japan)"
gCurrentRegion = REGION_JP;
break;
case 'P': // "PAL (Europe)"
gCurrentRegion = REGION_EU;
break;
default:
osSyncPrintf(VT_COL(RED, WHITE));
osSyncPrintf("z_locale_init: 日本用かアメリカ用か判別できません\n");
LogUtils_HungupThread("../z_locale.c", 0x76);
osSyncPrintf(VT_RST);
break;
}
osSyncPrintf("z_locale_init:日本用かアメリカ用か3コンで判断させる\n");
}
2020-03-22 21:19:43 +00:00
void Locale_ResetRegion() {
2020-03-17 04:31:30 +00:00
gCurrentRegion = REGION_NULL;
}
2020-03-22 21:19:43 +00:00
u32 func_80001F48() {
PadMgr* padMgr = (PadMgr*)(u32)&gPadMgr; // cast required to match
2020-03-17 04:31:30 +00:00
2020-03-22 21:19:43 +00:00
if (gCurrentRegion == REGION_NATIVE) {
2020-03-17 04:31:30 +00:00
return 0;
2020-03-22 21:19:43 +00:00
}
2020-03-17 04:31:30 +00:00
2020-03-22 21:19:43 +00:00
if (padMgr->unk_2A8 & 4) {
2020-03-17 04:31:30 +00:00
return 0;
2020-03-22 21:19:43 +00:00
}
2020-03-17 04:31:30 +00:00
return 1;
}
2020-03-22 21:19:43 +00:00
u32 func_80001F8C() {
PadMgr* padMgr = (PadMgr*)(u32)&gPadMgr; // cast required to match
2020-03-17 04:31:30 +00:00
2020-03-22 21:19:43 +00:00
if (gCurrentRegion == REGION_NATIVE) {
2020-03-17 04:31:30 +00:00
return 0;
2020-03-22 21:19:43 +00:00
}
2020-03-17 04:31:30 +00:00
2020-03-22 21:19:43 +00:00
if (padMgr->unk_2A8 & 4) {
2020-03-17 04:31:30 +00:00
return 1;
2020-03-22 21:19:43 +00:00
}
2020-03-17 04:31:30 +00:00
return 0;
}
// This function appears to be unused?
2020-03-22 21:19:43 +00:00
u32 Locale_IsRegionNative() {
2020-03-17 04:31:30 +00:00
return gCurrentRegion == REGION_NATIVE;
}