Allow `CartGameSolarSensor::LightLevel` to be set explicitly (#2179)
* 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:
parent
7a4255b732
commit
3877a8e46b
|
@ -582,6 +582,11 @@ int CartGameSolarSensor::SetInput(int num, bool pressed)
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CartGameSolarSensor::SetLightLevel(u8 level) noexcept
|
||||||
|
{
|
||||||
|
LightLevel = std::clamp<u8>(level, 0, 10);
|
||||||
|
}
|
||||||
|
|
||||||
void CartGameSolarSensor::ProcessGPIO()
|
void CartGameSolarSensor::ProcessGPIO()
|
||||||
{
|
{
|
||||||
if (GPIO.data & 4) return; // Boktai chip select
|
if (GPIO.data & 4) return; // Boktai chip select
|
||||||
|
|
|
@ -158,6 +158,8 @@ public:
|
||||||
void DoSavestate(Savestate* file) override;
|
void DoSavestate(Savestate* file) override;
|
||||||
|
|
||||||
int SetInput(int num, bool pressed) override;
|
int SetInput(int num, bool pressed) override;
|
||||||
|
void SetLightLevel(u8 level) noexcept;
|
||||||
|
[[nodiscard]] u8 GetLightLevel() const noexcept { return LightLevel; }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void ProcessGPIO() override;
|
void ProcessGPIO() override;
|
||||||
|
|
Loading…
Reference in New Issue