Allow CartGameSolarSensor::LightLevel to be set explicitly (#2179)
Some checks are pending
macOS / ${{ matrix.arch }} (arm64) (push) Waiting to run
macOS / ${{ matrix.arch }} (x86_64) (push) Waiting to run
macOS / Universal binary (push) Blocked by required conditions
Ubuntu / x86_64 (push) Waiting to run
Ubuntu / aarch64 (push) Waiting to run
Windows / build (push) Waiting to run

* Allow `CartGameSolarSensor::LightLevel` to be set explicitly

* Add `CartGameSolarSensor::GetLightLevel`

* Update GBACart.cpp

---------

Co-authored-by: Kemal Afzal <RSDuck@users.noreply.github.com>
This commit is contained in:
Jesse Talavera 2024-10-29 20:10:32 -04:00 committed by GitHub
parent 7a4255b732
commit 3877a8e46b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 7 additions and 0 deletions

View File

@ -582,6 +582,11 @@ int CartGameSolarSensor::SetInput(int num, bool pressed)
return -1;
}
void CartGameSolarSensor::SetLightLevel(u8 level) noexcept
{
LightLevel = std::clamp<u8>(level, 0, 10);
}
void CartGameSolarSensor::ProcessGPIO()
{
if (GPIO.data & 4) return; // Boktai chip select

View File

@ -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;