mirror of
https://github.com/melonDS-emu/melonDS.git
synced 2025-07-26 15:50:00 -06:00
convert DSi I2C and camera
This commit is contained in:
@ -24,6 +24,7 @@
|
||||
#include "Platform.h"
|
||||
#include "Config.h"
|
||||
#include "NDS.h"
|
||||
#include "DSi.h"
|
||||
#include "DSi_I2C.h"
|
||||
|
||||
#include "AudioSettingsDialog.h"
|
||||
@ -126,7 +127,7 @@ void AudioSettingsDialog::onSyncVolumeLevel()
|
||||
if (Config::DSiVolumeSync && NDS::ConsoleType == 1)
|
||||
{
|
||||
bool state = ui->slVolume->blockSignals(true);
|
||||
ui->slVolume->setValue(DSi_BPTWL::GetVolumeLevel());
|
||||
ui->slVolume->setValue(DSi::I2C->GetBPTWL()->GetVolumeLevel());
|
||||
ui->slVolume->blockSignals(state);
|
||||
}
|
||||
}
|
||||
@ -181,7 +182,7 @@ void AudioSettingsDialog::on_slVolume_valueChanged(int val)
|
||||
{
|
||||
if (Config::DSiVolumeSync && NDS::ConsoleType == 1)
|
||||
{
|
||||
DSi_BPTWL::SetVolumeLevel(val);
|
||||
DSi::I2C->GetBPTWL()->SetVolumeLevel(val);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -196,7 +197,7 @@ void AudioSettingsDialog::on_chkSyncDSiVolume_clicked(bool checked)
|
||||
if (Config::DSiVolumeSync && NDS::ConsoleType == 1)
|
||||
{
|
||||
ui->slVolume->setMaximum(31);
|
||||
ui->slVolume->setValue(DSi_BPTWL::GetVolumeLevel());
|
||||
ui->slVolume->setValue(DSi::I2C->GetBPTWL()->GetVolumeLevel());
|
||||
ui->slVolume->setPageStep(4);
|
||||
ui->slVolume->setTickPosition(QSlider::TicksBelow);
|
||||
}
|
||||
|
@ -22,6 +22,7 @@
|
||||
#include "SPI.h"
|
||||
#include "DSi_I2C.h"
|
||||
#include "NDS.h"
|
||||
#include "DSi.h"
|
||||
#include "Config.h"
|
||||
#include "Platform.h"
|
||||
|
||||
@ -42,8 +43,8 @@ PowerManagementDialog::PowerManagementDialog(QWidget* parent) : QDialog(parent),
|
||||
{
|
||||
ui->grpDSBattery->setEnabled(false);
|
||||
|
||||
oldDSiBatteryLevel = DSi_BPTWL::GetBatteryLevel();
|
||||
oldDSiBatteryCharging = DSi_BPTWL::GetBatteryCharging();
|
||||
oldDSiBatteryLevel = DSi::I2C->GetBPTWL()->GetBatteryLevel();
|
||||
oldDSiBatteryCharging = DSi::I2C->GetBPTWL()->GetBatteryCharging();
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -54,9 +55,9 @@ PowerManagementDialog::PowerManagementDialog(QWidget* parent) : QDialog(parent),
|
||||
|
||||
updateDSBatteryLevelControls();
|
||||
|
||||
ui->cbDSiBatteryCharging->setChecked(DSi_BPTWL::GetBatteryCharging());
|
||||
ui->cbDSiBatteryCharging->setChecked(DSi::I2C->GetBPTWL()->GetBatteryCharging());
|
||||
int dsiBatterySliderPos;
|
||||
switch (DSi_BPTWL::GetBatteryLevel())
|
||||
switch (DSi::I2C->GetBPTWL()->GetBatteryLevel())
|
||||
{
|
||||
case DSi_BPTWL::batteryLevel_AlmostEmpty: dsiBatterySliderPos = 0; break;
|
||||
case DSi_BPTWL::batteryLevel_Low: dsiBatterySliderPos = 1; break;
|
||||
@ -86,8 +87,8 @@ void PowerManagementDialog::done(int r)
|
||||
{
|
||||
if (NDS::ConsoleType == 1)
|
||||
{
|
||||
Config::DSiBatteryLevel = DSi_BPTWL::GetBatteryLevel();
|
||||
Config::DSiBatteryCharging = DSi_BPTWL::GetBatteryCharging();
|
||||
Config::DSiBatteryLevel = DSi::I2C->GetBPTWL()->GetBatteryLevel();
|
||||
Config::DSiBatteryCharging = DSi::I2C->GetBPTWL()->GetBatteryCharging();
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -98,8 +99,8 @@ void PowerManagementDialog::done(int r)
|
||||
{
|
||||
if (NDS::ConsoleType == 1)
|
||||
{
|
||||
DSi_BPTWL::SetBatteryLevel(oldDSiBatteryLevel);
|
||||
DSi_BPTWL::SetBatteryCharging(oldDSiBatteryCharging);
|
||||
DSi::I2C->GetBPTWL()->SetBatteryLevel(oldDSiBatteryLevel);
|
||||
DSi::I2C->GetBPTWL()->SetBatteryCharging(oldDSiBatteryCharging);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -132,7 +133,7 @@ void PowerManagementDialog::updateDSBatteryLevelControls()
|
||||
|
||||
void PowerManagementDialog::on_cbDSiBatteryCharging_toggled()
|
||||
{
|
||||
DSi_BPTWL::SetBatteryCharging(ui->cbDSiBatteryCharging->isChecked());
|
||||
DSi::I2C->GetBPTWL()->SetBatteryCharging(ui->cbDSiBatteryCharging->isChecked());
|
||||
}
|
||||
|
||||
void PowerManagementDialog::on_sliderDSiBatteryLevel_valueChanged(int value)
|
||||
@ -142,13 +143,13 @@ void PowerManagementDialog::on_sliderDSiBatteryLevel_valueChanged(int value)
|
||||
u8 newBatteryLevel;
|
||||
switch (value)
|
||||
{
|
||||
case 0: newBatteryLevel = DSi_BPTWL::batteryLevel_AlmostEmpty; break;
|
||||
case 1: newBatteryLevel = DSi_BPTWL::batteryLevel_Low; break;
|
||||
case 2: newBatteryLevel = DSi_BPTWL::batteryLevel_Half; break;
|
||||
case 3: newBatteryLevel = DSi_BPTWL::batteryLevel_ThreeQuarters; break;
|
||||
case 4: newBatteryLevel = DSi_BPTWL::batteryLevel_Full; break;
|
||||
case 0: newBatteryLevel = DSi::I2C->GetBPTWL()->batteryLevel_AlmostEmpty; break;
|
||||
case 1: newBatteryLevel = DSi::I2C->GetBPTWL()->batteryLevel_Low; break;
|
||||
case 2: newBatteryLevel = DSi::I2C->GetBPTWL()->batteryLevel_Half; break;
|
||||
case 3: newBatteryLevel = DSi::I2C->GetBPTWL()->batteryLevel_ThreeQuarters; break;
|
||||
case 4: newBatteryLevel = DSi::I2C->GetBPTWL()->batteryLevel_Full; break;
|
||||
}
|
||||
DSi_BPTWL::SetBatteryLevel(newBatteryLevel);
|
||||
DSi::I2C->GetBPTWL()->SetBatteryLevel(newBatteryLevel);
|
||||
updateDSBatteryLevelControls();
|
||||
}
|
||||
|
||||
|
@ -583,8 +583,8 @@ void SetBatteryLevels()
|
||||
{
|
||||
if (NDS::ConsoleType == 1)
|
||||
{
|
||||
DSi_BPTWL::SetBatteryLevel(Config::DSiBatteryLevel);
|
||||
DSi_BPTWL::SetBatteryCharging(Config::DSiBatteryCharging);
|
||||
DSi::I2C->GetBPTWL()->SetBatteryLevel(Config::DSiBatteryLevel);
|
||||
DSi::I2C->GetBPTWL()->SetBatteryCharging(Config::DSiBatteryCharging);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -90,8 +90,9 @@
|
||||
#include "Platform.h"
|
||||
#include "LocalMP.h"
|
||||
#include "Config.h"
|
||||
#include "DSi_I2C.h"
|
||||
#include "RTC.h"
|
||||
#include "DSi.h"
|
||||
#include "DSi_I2C.h"
|
||||
|
||||
#include "Savestate.h"
|
||||
|
||||
@ -409,33 +410,33 @@ void EmuThread::run()
|
||||
// Handle power button
|
||||
if (Input::HotkeyDown(HK_PowerButton))
|
||||
{
|
||||
DSi_BPTWL::SetPowerButtonHeld(currentTime);
|
||||
DSi::I2C->GetBPTWL()->SetPowerButtonHeld(currentTime);
|
||||
}
|
||||
else if (Input::HotkeyReleased(HK_PowerButton))
|
||||
{
|
||||
DSi_BPTWL::SetPowerButtonReleased(currentTime);
|
||||
DSi::I2C->GetBPTWL()->SetPowerButtonReleased(currentTime);
|
||||
}
|
||||
|
||||
// Handle volume buttons
|
||||
if (Input::HotkeyDown(HK_VolumeUp))
|
||||
{
|
||||
DSi_BPTWL::SetVolumeSwitchHeld(DSi_BPTWL::volumeKey_Up);
|
||||
DSi::I2C->GetBPTWL()->SetVolumeSwitchHeld(DSi::I2C->GetBPTWL()->volumeKey_Up);
|
||||
}
|
||||
else if (Input::HotkeyReleased(HK_VolumeUp))
|
||||
{
|
||||
DSi_BPTWL::SetVolumeSwitchReleased(DSi_BPTWL::volumeKey_Up);
|
||||
DSi::I2C->GetBPTWL()->SetVolumeSwitchReleased(DSi::I2C->GetBPTWL()->volumeKey_Up);
|
||||
}
|
||||
|
||||
if (Input::HotkeyDown(HK_VolumeDown))
|
||||
{
|
||||
DSi_BPTWL::SetVolumeSwitchHeld(DSi_BPTWL::volumeKey_Down);
|
||||
DSi::I2C->GetBPTWL()->SetVolumeSwitchHeld(DSi::I2C->GetBPTWL()->volumeKey_Down);
|
||||
}
|
||||
else if (Input::HotkeyReleased(HK_VolumeDown))
|
||||
{
|
||||
DSi_BPTWL::SetVolumeSwitchReleased(DSi_BPTWL::volumeKey_Down);
|
||||
DSi::I2C->GetBPTWL()->SetVolumeSwitchReleased(DSi::I2C->GetBPTWL()->volumeKey_Down);
|
||||
}
|
||||
|
||||
DSi_BPTWL::ProcessVolumeSwitchInput(currentTime);
|
||||
DSi::I2C->GetBPTWL()->ProcessVolumeSwitchInput(currentTime);
|
||||
}
|
||||
|
||||
if (EmuRunning == emuStatus_Running || EmuRunning == emuStatus_FrameStep)
|
||||
@ -562,7 +563,7 @@ void EmuThread::run()
|
||||
|
||||
if (Config::DSiVolumeSync && NDS::ConsoleType == 1)
|
||||
{
|
||||
u8 volumeLevel = DSi_BPTWL::GetVolumeLevel();
|
||||
u8 volumeLevel = DSi::I2C->GetBPTWL()->GetVolumeLevel();
|
||||
if (volumeLevel != dsiVolumeLevel)
|
||||
{
|
||||
dsiVolumeLevel = volumeLevel;
|
||||
|
Reference in New Issue
Block a user