mirror of
https://github.com/patchzyy/wiicompiled
synced 2026-10-23 14:31:38 -04:00
pass real wii remotes through emulated bluetooth
This commit is contained in:
@@ -80,33 +80,16 @@ extern "C" void OSFatal_HLE_801a4ec4(CpuContext* ctx) {
|
||||
|
||||
REGISTER_NATIVE_FUNCTION_AS(0x801A4EC4, OSFatal_HLE_801a4ec4, "OSFatal_HLE_801a4ec4");
|
||||
|
||||
extern "C" void GKI_delay_HLE_801301b4(CpuContext* ctx)
|
||||
extern "C" void GKI_delay_HLE_801301b4()
|
||||
{
|
||||
const uint32_t delayMs = ctx ? static_cast<uint32_t>(ctx->gpr[3]) : 0;
|
||||
const uint32_t sleepMs = delayMs == 0 ? 1u : std::min(delayMs, 10u);
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(sleepMs));
|
||||
// The guest's GKI_delay is empty: BTA_Init spins on it while the Bluetooth
|
||||
// module answers through IPC interrupts and the 2 ms BTU alarm. Service both
|
||||
// here and let the wall clock advance.
|
||||
OS_HLE_ProcessAlarms(32);
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(1));
|
||||
}
|
||||
|
||||
extern "C" uint32_t BTM_IsDeviceUp_HLE_8013a300(CpuContext* ctx)
|
||||
{
|
||||
// Force Bluetooth stack to "up" to avoid endless polling loops while we lack
|
||||
// real hardware bring-up.
|
||||
constexpr uint32_t kBtmCbBase = 0x80336278u;
|
||||
constexpr uint32_t kDevStateOffset = 0x64Eu;
|
||||
try {
|
||||
::Memory::Write8(kBtmCbBase + kDevStateOffset, 5u);
|
||||
} catch (const ::Memory::AccessViolation&) {
|
||||
// Ignore; best-effort write
|
||||
}
|
||||
|
||||
if (ctx) {
|
||||
ctx->gpr[3] = 1;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
PPC_NATIVE_OVERRIDE_VOID(801301B4, GKI_delay_HLE_801301b4, (CpuContext* ctx), (ctx));
|
||||
PPC_NATIVE_OVERRIDE(8013A300, BTM_IsDeviceUp_HLE_8013a300, uint32_t, (CpuContext* ctx), (ctx));
|
||||
PPC_NATIVE_OVERRIDE_VOID(801301B4, GKI_delay_HLE_801301b4, (), ());
|
||||
|
||||
// Serial Interface (SI) - GameCube controller ports; stubbed since we don't emulate the MMIO.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user