1
0
Fork 0
mirror of https://github.com/zeldaret/oot.git synced 2025-02-22 06:45:31 +00:00
oot/src/boot/z_locale.c

93 lines
2.2 KiB
C
Raw Normal View History

#include "global.h"
#include "region.h"
#include "terminal.h"
#include "versions.h"
2020-03-17 00:31:30 -04:00
s32 gCurrentRegion = 0;
2020-03-17 00:31:30 -04:00
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;
2020-03-17 00:31:30 -04:00
osEPiReadIo(gCartHandle, 0x38, &sCartInfo.mediaFormat);
osEPiReadIo(gCartHandle, 0x3C, &sCartInfo.regionInfo);
countryCode = sCartInfo.countryCode;
#endif
switch (countryCode) {
case 'J': // "NTSC-J (Japan)"
2020-03-17 00:31:30 -04:00
gCurrentRegion = REGION_JP;
break;
case 'E': // "NTSC-U (North America)"
gCurrentRegion = REGION_US;
break;
#if OOT_VERSION >= PAL_1_0
2020-03-17 00:31:30 -04:00
case 'P': // "PAL (Europe)"
gCurrentRegion = REGION_EU;
break;
#endif
2020-03-17 00:31:30 -04:00
default:
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
PRINTF(VT_RST);
2020-03-17 00:31:30 -04:00
break;
}
PRINTF(T("z_locale_init:日本用かアメリカ用か3コンで判断させる\n",
"z_locale_init: Determine whether it is for Japan or America using 3 controls\n"));
2020-03-17 00:31:30 -04:00
}
void Locale_ResetRegion(void) {
2020-03-17 00:31:30 -04:00
gCurrentRegion = REGION_NULL;
}
#if OOT_DEBUG
u32 func_80001F48(void) {
if (gCurrentRegion == OOT_REGION) {
2020-03-17 00:31:30 -04:00
return 0;
2020-03-22 22:19:43 +01:00
}
2020-03-17 00:31:30 -04:00
if (gPadMgr.validCtrlrsMask & 4) {
2020-03-17 00:31:30 -04:00
return 0;
2020-03-22 22:19:43 +01:00
}
2020-03-17 00:31:30 -04:00
return 1;
}
u32 func_80001F8C(void) {
if (gCurrentRegion == OOT_REGION) {
2020-03-17 00:31:30 -04:00
return 0;
2020-03-22 22:19:43 +01:00
}
2020-03-17 00:31:30 -04:00
if (gPadMgr.validCtrlrsMask & 4) {
2020-03-17 00:31:30 -04:00
return 1;
2020-03-22 22:19:43 +01:00
}
2020-03-17 00:31:30 -04:00
return 0;
}
// This function appears to be unused?
u32 Locale_IsRegionNative(void) {
return gCurrentRegion == OOT_REGION;
2020-03-17 00:31:30 -04:00
}
#endif