Shipwright/soh/src/boot/z_locale.c
Baoulettes a5df9dddf0
Use Macro for __FILE__ & __LINE__ when possible (#559)
* First batch some overlay

* Almost all overlay

* effect & gamestate

* kaleido stuffs

* more overlay

* more left over from code folder

* remaining hardcoded line and file

* Open & Close _DISP __FILE__ & __LINE__ clean up

* Some if (1) {} remove

* LOG_xxxx __FILE__ , __LINE__ cleaned

* ASSERT macro __FILE__ __LINE__

* mtx without line/file in functions

* " if (1) {} " & "if (0) {}" and tab/white place

* LogUtils as macro

* GameState_, GameAlloc_, SystemArena_ & ZeldaArena_

* Revert "GameState_, GameAlloc_, SystemArena_ & ZeldaArena_"

This reverts commit 0d85caaf7e.

* Like last commit but as macro

* Fix matrix not using macros

* use function not macro

* DebugArena_* functions
GameAlloc_MallocDebug
BgCheck_PosErrorCheck as macros
removed issues with ; in macro file
2022-07-05 19:29:34 -04:00

64 lines
1.4 KiB
C

#include "global.h"
#include "vt.h"
u32 gCurrentRegion = 0;
LocaleCartInfo sCartInfo;
void Locale_Init(void) {
osEPiReadIo(gCartHandle, 0x38, &sCartInfo.mediaFormat);
osEPiReadIo(gCartHandle, 0x3C, &sCartInfo.regionInfo);
switch (sCartInfo.countryCode) {
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");
LOG_HUNGUP_THREAD();
osSyncPrintf(VT_RST);
break;
}
osSyncPrintf("z_locale_init:日本用かアメリカ用か3コンで判断させる\n");
}
void Locale_ResetRegion(void) {
gCurrentRegion = REGION_NULL;
}
u32 func_80001F48(void) {
if (gCurrentRegion == REGION_NATIVE) {
return 0;
}
if (gPadMgr.validCtrlrsMask & 4) {
return 0;
}
return 1;
}
u32 func_80001F8C(void) {
if (gCurrentRegion == REGION_NATIVE) {
return 0;
}
if (gPadMgr.validCtrlrsMask & 4) {
return 1;
}
return 0;
}
// This function appears to be unused?
u32 Locale_IsRegionNative(void) {
return gCurrentRegion == REGION_NATIVE;
}