Files
wiicompiled/runtime/src/hle/hollywood_gpio.cpp
T
patchzyy dfe32f61e1 Real Wii Remote support over Bluetooth (#323)
* pass real wii remotes through emulated bluetooth

* build bluetooth tests on macos ci

* address review comments

* cancel replaced bluetooth reads
2026-10-20 12:21:46 +02:00

33 lines
886 B
C++

#include "hle/hollywood_gpio.h"
#include "runtime_log.h"
#include <atomic>
namespace HollywoodGpio {
constexpr uint32_t kSensorBarPower = 0x100;
std::atomic<uint32_t> g_gpioBOut{0};
} // namespace HollywoodGpio
bool HollywoodGpio_Read32(uint32_t address, uint32_t& value) {
if (address != kHollywoodGpioBOut) {
return false;
}
value = HollywoodGpio::g_gpioBOut.load(std::memory_order_relaxed);
return true;
}
bool HollywoodGpio_Write32(uint32_t address, uint32_t value) {
if (address != kHollywoodGpioBOut) {
return false;
}
const uint32_t previous = HollywoodGpio::g_gpioBOut.exchange(value, std::memory_order_relaxed);
if ((previous ^ value) & HollywoodGpio::kSensorBarPower) {
RT_LOG(RT_TAG_HLE) << "Sensor bar power " << ((value & HollywoodGpio::kSensorBarPower) ? "on" : "off") << std::endl;
}
return true;
}