diff --git a/src/GBACart.cpp b/src/GBACart.cpp index 4fd42894..a62aca6b 100644 --- a/src/GBACart.cpp +++ b/src/GBACart.cpp @@ -582,6 +582,11 @@ int CartGameSolarSensor::SetInput(int num, bool pressed) return -1; } +void CartGameSolarSensor::SetLightLevel(u8 level) noexcept +{ + LightLevel = std::clamp(level, 0, 10); +} + void CartGameSolarSensor::ProcessGPIO() { if (GPIO.data & 4) return; // Boktai chip select diff --git a/src/GBACart.h b/src/GBACart.h index f6fb95dd..726a234d 100644 --- a/src/GBACart.h +++ b/src/GBACart.h @@ -158,6 +158,8 @@ public: void DoSavestate(Savestate* file) override; int SetInput(int num, bool pressed) override; + void SetLightLevel(u8 level) noexcept; + [[nodiscard]] u8 GetLightLevel() const noexcept { return LightLevel; } protected: void ProcessGPIO() override;