mirror of https://github.com/PrimeDecomp/prime.git
CGBASupport: Add version differences for korean release
Former-commit-id: 87a74c0b48
This commit is contained in:
parent
0fbdb1f381
commit
dd5e5fb342
|
@ -8,13 +8,20 @@
|
||||||
#include "rstl/math.hpp"
|
#include "rstl/math.hpp"
|
||||||
|
|
||||||
void joyboot_callback(s32 chan, s32 ret) {}
|
void joyboot_callback(s32 chan, s32 ret) {}
|
||||||
|
#if VERSION < 2
|
||||||
const uint MAGIC = 0x414d5445;
|
const uint MAGIC = 0x414d5445;
|
||||||
|
#endif
|
||||||
|
|
||||||
static CGBASupport* g_GBA;
|
static CGBASupport* g_GBA;
|
||||||
|
|
||||||
|
inline bool GetFontEncoding() { return OSGetFontEncode() == 1; }
|
||||||
|
|
||||||
CGBASupport::CGBASupport()
|
CGBASupport::CGBASupport()
|
||||||
|
#if VERSION >= 2
|
||||||
|
: x0_file(GetFontEncoding() ? "client_jap.bin" : "client_pad.bin")
|
||||||
|
#else
|
||||||
: x0_file("client_pad.bin")
|
: x0_file("client_pad.bin")
|
||||||
|
#endif
|
||||||
, x28_fileSize(OSRoundUp32B(x0_file.Length()))
|
, x28_fileSize(OSRoundUp32B(x0_file.Length()))
|
||||||
, x2c_buffer((uchar*)CMemory::Alloc(x28_fileSize, IAllocator::kHI_RoundUpLen))
|
, x2c_buffer((uchar*)CMemory::Alloc(x28_fileSize, IAllocator::kHI_RoundUpLen))
|
||||||
, x30_dvdReq(x0_file.SyncRead(x2c_buffer.get(), x28_fileSize))
|
, x30_dvdReq(x0_file.SyncRead(x2c_buffer.get(), x28_fileSize))
|
||||||
|
@ -26,6 +33,9 @@ CGBASupport::CGBASupport()
|
||||||
, x45_fusionBeat(false) {
|
, x45_fusionBeat(false) {
|
||||||
GBAInit();
|
GBAInit();
|
||||||
g_GBA = this;
|
g_GBA = this;
|
||||||
|
#if VERSION >= 2
|
||||||
|
OSGetFontEncode();
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
CGBASupport::~CGBASupport() { g_GBA = nullptr; }
|
CGBASupport::~CGBASupport() { g_GBA = nullptr; }
|
||||||
|
@ -56,8 +66,18 @@ inline bool CGBASupport::CheckReadyStatus() {
|
||||||
buff[0xc9] = (tick >> 8);
|
buff[0xc9] = (tick >> 8);
|
||||||
buff[0xca] = (tick >> 16);
|
buff[0xca] = (tick >> 16);
|
||||||
buff[0xcb] = (tick >> 24);
|
buff[0xcb] = (tick >> 24);
|
||||||
|
#if VERSION < 2
|
||||||
buff[0xaf] = 'E'; // set region to 'E' instead of 'J'
|
buff[0xaf] = 'E'; // set region to 'E' instead of 'J'
|
||||||
buff[0xbd] = 0xc9;
|
buff[0xbd] = 0xc9;
|
||||||
|
#else
|
||||||
|
if (GetFontEncoding()) {
|
||||||
|
buff[0xaf] = 'J'; // set region to 'E' instead of 'J'
|
||||||
|
buff[0xbd] = 0xc4;
|
||||||
|
} else {
|
||||||
|
buff[0xaf] = 'E'; // set region to 'E' instead of 'J'
|
||||||
|
buff[0xbd] = 0xc9;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
@ -97,8 +117,8 @@ void CGBASupport::Update(float dt) {
|
||||||
|
|
||||||
case kP_StartJoyBusBoot:
|
case kP_StartJoyBusBoot:
|
||||||
x34_phase = kP_PollJoyBusBoot;
|
x34_phase = kP_PollJoyBusBoot;
|
||||||
GBAJoyBootAsync(x40_siChan, x40_siChan << 1, 2, x2c_buffer.get(), x0_file.Length(),
|
GBAJoyBootAsync(x40_siChan, x40_siChan << 1, 2, x2c_buffer.get(), x0_file.Length(), &x3c_status,
|
||||||
&x3c_status, &joyboot_callback);
|
&joyboot_callback);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case kP_PollJoyBusBoot:
|
case kP_PollJoyBusBoot:
|
||||||
|
@ -161,22 +181,39 @@ bool CGBASupport::PollResponse() {
|
||||||
if (gbaStatus != 0x28) {
|
if (gbaStatus != 0x28) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if VERSION >= 2
|
||||||
|
const uint targetMagic = GetFontEncoding() ? 0x414D544A : 0x414D5445;
|
||||||
|
#endif
|
||||||
|
|
||||||
uint magic;
|
uint magic;
|
||||||
if (GBARead(x40_siChan, reinterpret_cast<u8*>(&magic), &gbaStatus) == GBA_NOT_READY) {
|
if (GBARead(x40_siChan, (u8*)(&magic), &gbaStatus) == GBA_NOT_READY) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
#if VERSION < 2
|
||||||
if (magic != 0x414d5445) { // "AMTE"
|
if (magic != 0x414d5445) { // "AMTE"
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
if (magic != targetMagic) { // "AMTE"
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
if (GBAGetStatus(x40_siChan, &gbaStatus) == GBA_NOT_READY) {
|
if (GBAGetStatus(x40_siChan, &gbaStatus) == GBA_NOT_READY) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (gbaStatus != 0x20) {
|
if (gbaStatus != 0x20) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
#if VERSION < 2
|
||||||
if (GBAWrite(x40_siChan, (u8*)(&MAGIC), &gbaStatus) == GBA_NOT_READY) {
|
if (GBAWrite(x40_siChan, (u8*)(&MAGIC), &gbaStatus) == GBA_NOT_READY) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
if (GBAWrite(x40_siChan, (u8*)(&targetMagic), &gbaStatus) == GBA_NOT_READY) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
if (GBAGetStatus(x40_siChan, &gbaStatus) == GBA_NOT_READY) {
|
if (GBAGetStatus(x40_siChan, &gbaStatus) == GBA_NOT_READY) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue