hey look, more shit
This commit is contained in:
parent
10380320c5
commit
2fc1ae780b
|
@ -30,6 +30,7 @@
|
|||
#include "AudioSettingsDialog.h"
|
||||
#include "ui_AudioSettingsDialog.h"
|
||||
#include "main.h"
|
||||
#include "EmuInstance.h"
|
||||
|
||||
using namespace melonDS;
|
||||
AudioSettingsDialog* AudioSettingsDialog::currentDlg = nullptr;
|
||||
|
@ -37,11 +38,14 @@ AudioSettingsDialog* AudioSettingsDialog::currentDlg = nullptr;
|
|||
extern std::string EmuDirectory;
|
||||
|
||||
|
||||
AudioSettingsDialog::AudioSettingsDialog(QWidget* parent, bool emuActive, EmuThread* emuThread) : QDialog(parent), ui(new Ui::AudioSettingsDialog), emuThread(emuThread)
|
||||
AudioSettingsDialog::AudioSettingsDialog(QWidget* parent) : QDialog(parent), ui(new Ui::AudioSettingsDialog)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
setAttribute(Qt::WA_DeleteOnClose);
|
||||
|
||||
emuInstance = ((MainWindow*)parent)->getEmuInstance();
|
||||
bool emuActive = emuInstance->getEmuThread()->emuIsActive();
|
||||
|
||||
oldInterp = Config::AudioInterp;
|
||||
oldBitDepth = Config::AudioBitDepth;
|
||||
oldVolume = Config::AudioVolume;
|
||||
|
@ -65,7 +69,7 @@ AudioSettingsDialog::AudioSettingsDialog(QWidget* parent, bool emuActive, EmuThr
|
|||
ui->chkSyncDSiVolume->setChecked(Config::DSiVolumeSync);
|
||||
|
||||
// Setup volume slider accordingly
|
||||
if (emuActive && emuThread->NDS->ConsoleType == 1)
|
||||
if (emuActive && emuInstance->getNDS()->ConsoleType == 1)
|
||||
{
|
||||
on_chkSyncDSiVolume_clicked(Config::DSiVolumeSync);
|
||||
}
|
||||
|
@ -125,11 +129,11 @@ AudioSettingsDialog::~AudioSettingsDialog()
|
|||
|
||||
void AudioSettingsDialog::onSyncVolumeLevel()
|
||||
{
|
||||
if (Config::DSiVolumeSync && emuThread->NDS->ConsoleType == 1)
|
||||
if (Config::DSiVolumeSync && emuInstance->getNDS()->ConsoleType == 1)
|
||||
{
|
||||
auto& dsi = static_cast<DSi&>(*emuThread->NDS);
|
||||
auto dsi = static_cast<DSi*>(emuInstance->getNDS());
|
||||
bool state = ui->slVolume->blockSignals(true);
|
||||
ui->slVolume->setValue(dsi.I2C.GetBPTWL()->GetVolumeLevel());
|
||||
ui->slVolume->setValue(dsi->I2C.GetBPTWL()->GetVolumeLevel());
|
||||
ui->slVolume->blockSignals(state);
|
||||
}
|
||||
}
|
||||
|
@ -137,7 +141,7 @@ void AudioSettingsDialog::onSyncVolumeLevel()
|
|||
void AudioSettingsDialog::onConsoleReset()
|
||||
{
|
||||
on_chkSyncDSiVolume_clicked(Config::DSiVolumeSync);
|
||||
ui->chkSyncDSiVolume->setEnabled(emuThread->NDS->ConsoleType == 1);
|
||||
ui->chkSyncDSiVolume->setEnabled(emuInstance->getNDS()->ConsoleType == 1);
|
||||
}
|
||||
|
||||
void AudioSettingsDialog::on_AudioSettingsDialog_accepted()
|
||||
|
@ -182,10 +186,10 @@ void AudioSettingsDialog::on_cbInterpolation_currentIndexChanged(int idx)
|
|||
|
||||
void AudioSettingsDialog::on_slVolume_valueChanged(int val)
|
||||
{
|
||||
if (Config::DSiVolumeSync && emuThread->NDS->ConsoleType == 1)
|
||||
if (Config::DSiVolumeSync && emuInstance->getNDS()->ConsoleType == 1)
|
||||
{
|
||||
auto& dsi = static_cast<DSi&>(*emuThread->NDS);
|
||||
dsi.I2C.GetBPTWL()->SetVolumeLevel(val);
|
||||
auto dsi = static_cast<DSi*>(emuInstance->getNDS());
|
||||
dsi->I2C.GetBPTWL()->SetVolumeLevel(val);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -197,11 +201,11 @@ void AudioSettingsDialog::on_chkSyncDSiVolume_clicked(bool checked)
|
|||
Config::DSiVolumeSync = checked;
|
||||
|
||||
bool state = ui->slVolume->blockSignals(true);
|
||||
if (Config::DSiVolumeSync && emuThread->NDS->ConsoleType == 1)
|
||||
if (Config::DSiVolumeSync && emuInstance->getNDS()->ConsoleType == 1)
|
||||
{
|
||||
auto& dsi = static_cast<DSi&>(*emuThread->NDS);
|
||||
auto dsi = static_cast<DSi*>(emuInstance->getNDS());
|
||||
ui->slVolume->setMaximum(31);
|
||||
ui->slVolume->setValue(dsi.I2C.GetBPTWL()->GetVolumeLevel());
|
||||
ui->slVolume->setValue(dsi->I2C.GetBPTWL()->GetVolumeLevel());
|
||||
ui->slVolume->setPageStep(4);
|
||||
ui->slVolume->setTickPosition(QSlider::TicksBelow);
|
||||
}
|
||||
|
|
|
@ -24,18 +24,19 @@
|
|||
|
||||
namespace Ui { class AudioSettingsDialog; }
|
||||
class AudioSettingsDialog;
|
||||
class EmuThread;
|
||||
|
||||
class EmuInstance;
|
||||
|
||||
class AudioSettingsDialog : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit AudioSettingsDialog(QWidget* parent, bool emuActive, EmuThread* emuThread);
|
||||
explicit AudioSettingsDialog(QWidget* parent);
|
||||
~AudioSettingsDialog();
|
||||
|
||||
static AudioSettingsDialog* currentDlg;
|
||||
static AudioSettingsDialog* openDlg(QWidget* parent, bool emuActive, EmuThread* emuThread)
|
||||
static AudioSettingsDialog* openDlg(QWidget* parent)
|
||||
{
|
||||
if (currentDlg)
|
||||
{
|
||||
|
@ -43,7 +44,7 @@ public:
|
|||
return currentDlg;
|
||||
}
|
||||
|
||||
currentDlg = new AudioSettingsDialog(parent, emuActive, emuThread);
|
||||
currentDlg = new AudioSettingsDialog(parent);
|
||||
currentDlg->show();
|
||||
return currentDlg;
|
||||
}
|
||||
|
@ -70,9 +71,10 @@ private slots:
|
|||
void on_btnMicWavBrowse_clicked();
|
||||
|
||||
private:
|
||||
EmuThread* emuThread;
|
||||
Ui::AudioSettingsDialog* ui;
|
||||
|
||||
EmuInstance* emuInstance;
|
||||
|
||||
int oldInterp;
|
||||
int oldBitDepth;
|
||||
int oldVolume;
|
||||
|
|
|
@ -43,10 +43,9 @@ CheatsDialog::CheatsDialog(QWidget* parent) : QDialog(parent), ui(new Ui::Cheats
|
|||
ui->setupUi(this);
|
||||
setAttribute(Qt::WA_DeleteOnClose);
|
||||
|
||||
MainWindow* win = (MainWindow*)parent;
|
||||
//
|
||||
emuInstance = ((MainWindow*)parent)->getEmuInstance();
|
||||
|
||||
codeFile = ROMManager::GetCheatFile();
|
||||
codeFile = emuInstance->getCheatFile();
|
||||
|
||||
QStandardItemModel* model = new QStandardItemModel();
|
||||
ui->tvCodeList->setModel(model);
|
||||
|
|
|
@ -33,6 +33,8 @@ Q_DECLARE_METATYPE(melonDS::ARCodeCatList::iterator)
|
|||
namespace Ui { class CheatsDialog; }
|
||||
class CheatsDialog;
|
||||
|
||||
class EmuInstance;
|
||||
|
||||
class ARCodeChecker : public QSyntaxHighlighter
|
||||
{
|
||||
Q_OBJECT
|
||||
|
@ -87,6 +89,8 @@ private slots:
|
|||
private:
|
||||
Ui::CheatsDialog* ui;
|
||||
|
||||
EmuInstance* emuInstance;
|
||||
|
||||
melonDS::ARCodeFile* codeFile;
|
||||
ARCodeChecker* codeChecker;
|
||||
};
|
||||
|
|
|
@ -408,217 +408,6 @@ LegacyEntry LegacyFile[] =
|
|||
{"", -1, "", false}
|
||||
};
|
||||
|
||||
ConfigEntry ConfigFile[] =
|
||||
{
|
||||
{"Key_A", 0, &KeyMapping[0], -1, true},
|
||||
{"Key_B", 0, &KeyMapping[1], -1, true},
|
||||
{"Key_Select", 0, &KeyMapping[2], -1, true},
|
||||
{"Key_Start", 0, &KeyMapping[3], -1, true},
|
||||
{"Key_Right", 0, &KeyMapping[4], -1, true},
|
||||
{"Key_Left", 0, &KeyMapping[5], -1, true},
|
||||
{"Key_Up", 0, &KeyMapping[6], -1, true},
|
||||
{"Key_Down", 0, &KeyMapping[7], -1, true},
|
||||
{"Key_R", 0, &KeyMapping[8], -1, true},
|
||||
{"Key_L", 0, &KeyMapping[9], -1, true},
|
||||
{"Key_X", 0, &KeyMapping[10], -1, true},
|
||||
{"Key_Y", 0, &KeyMapping[11], -1, true},
|
||||
|
||||
{"Joy_A", 0, &JoyMapping[0], -1, true},
|
||||
{"Joy_B", 0, &JoyMapping[1], -1, true},
|
||||
{"Joy_Select", 0, &JoyMapping[2], -1, true},
|
||||
{"Joy_Start", 0, &JoyMapping[3], -1, true},
|
||||
{"Joy_Right", 0, &JoyMapping[4], -1, true},
|
||||
{"Joy_Left", 0, &JoyMapping[5], -1, true},
|
||||
{"Joy_Up", 0, &JoyMapping[6], -1, true},
|
||||
{"Joy_Down", 0, &JoyMapping[7], -1, true},
|
||||
{"Joy_R", 0, &JoyMapping[8], -1, true},
|
||||
{"Joy_L", 0, &JoyMapping[9], -1, true},
|
||||
{"Joy_X", 0, &JoyMapping[10], -1, true},
|
||||
{"Joy_Y", 0, &JoyMapping[11], -1, true},
|
||||
|
||||
{"HKKey_Lid", 0, &HKKeyMapping[HK_Lid], -1, true},
|
||||
{"HKKey_Mic", 0, &HKKeyMapping[HK_Mic], -1, true},
|
||||
{"HKKey_Pause", 0, &HKKeyMapping[HK_Pause], -1, true},
|
||||
{"HKKey_Reset", 0, &HKKeyMapping[HK_Reset], -1, true},
|
||||
{"HKKey_FastForward", 0, &HKKeyMapping[HK_FastForward], -1, true},
|
||||
{"HKKey_FastForwardToggle", 0, &HKKeyMapping[HK_FastForwardToggle], -1, true},
|
||||
{"HKKey_FullscreenToggle", 0, &HKKeyMapping[HK_FullscreenToggle], -1, true},
|
||||
{"HKKey_SwapScreens", 0, &HKKeyMapping[HK_SwapScreens], -1, true},
|
||||
{"HKKey_SwapScreenEmphasis", 0, &HKKeyMapping[HK_SwapScreenEmphasis], -1, true},
|
||||
{"HKKey_SolarSensorDecrease", 0, &HKKeyMapping[HK_SolarSensorDecrease], -1, true},
|
||||
{"HKKey_SolarSensorIncrease", 0, &HKKeyMapping[HK_SolarSensorIncrease], -1, true},
|
||||
{"HKKey_FrameStep", 0, &HKKeyMapping[HK_FrameStep], -1, true},
|
||||
{"HKKey_PowerButton", 0, &HKKeyMapping[HK_PowerButton], -1, true},
|
||||
{"HKKey_VolumeUp", 0, &HKKeyMapping[HK_VolumeUp], -1, true},
|
||||
{"HKKey_VolumeDown", 0, &HKKeyMapping[HK_VolumeDown], -1, true},
|
||||
|
||||
{"HKJoy_Lid", 0, &HKJoyMapping[HK_Lid], -1, true},
|
||||
{"HKJoy_Mic", 0, &HKJoyMapping[HK_Mic], -1, true},
|
||||
{"HKJoy_Pause", 0, &HKJoyMapping[HK_Pause], -1, true},
|
||||
{"HKJoy_Reset", 0, &HKJoyMapping[HK_Reset], -1, true},
|
||||
{"HKJoy_FastForward", 0, &HKJoyMapping[HK_FastForward], -1, true},
|
||||
{"HKJoy_FastForwardToggle", 0, &HKJoyMapping[HK_FastForwardToggle], -1, true},
|
||||
{"HKJoy_FullscreenToggle", 0, &HKJoyMapping[HK_FullscreenToggle], -1, true},
|
||||
{"HKJoy_SwapScreens", 0, &HKJoyMapping[HK_SwapScreens], -1, true},
|
||||
{"HKJoy_SwapScreenEmphasis", 0, &HKJoyMapping[HK_SwapScreenEmphasis], -1, true},
|
||||
{"HKJoy_SolarSensorDecrease", 0, &HKJoyMapping[HK_SolarSensorDecrease], -1, true},
|
||||
{"HKJoy_SolarSensorIncrease", 0, &HKJoyMapping[HK_SolarSensorIncrease], -1, true},
|
||||
{"HKJoy_FrameStep", 0, &HKJoyMapping[HK_FrameStep], -1, true},
|
||||
{"HKJoy_PowerButton", 0, &HKJoyMapping[HK_PowerButton], -1, true},
|
||||
{"HKJoy_VolumeUp", 0, &HKJoyMapping[HK_VolumeUp], -1, true},
|
||||
{"HKJoy_VolumeDown", 0, &HKJoyMapping[HK_VolumeDown], -1, true},
|
||||
|
||||
{"JoystickID", 0, &JoystickID, 0, true},
|
||||
|
||||
{"WindowWidth", 0, &WindowWidth, 256, true},
|
||||
{"WindowHeight", 0, &WindowHeight, 384, true},
|
||||
{"WindowMax", 1, &WindowMaximized, false, true},
|
||||
|
||||
{"ScreenRotation", 0, &ScreenRotation, 0, true},
|
||||
{"ScreenGap", 0, &ScreenGap, 0, true},
|
||||
{"ScreenLayout", 0, &ScreenLayout, 0, true},
|
||||
{"ScreenSwap", 1, &ScreenSwap, false, true},
|
||||
{"ScreenSizing", 0, &ScreenSizing, 0, true},
|
||||
{"IntegerScaling", 1, &IntegerScaling, false, true},
|
||||
{"ScreenAspectTop",0, &ScreenAspectTop,0, true},
|
||||
{"ScreenAspectBot",0, &ScreenAspectBot,0, true},
|
||||
{"ScreenFilter", 1, &ScreenFilter, true, true},
|
||||
|
||||
{"ScreenUseGL", 1, &ScreenUseGL, false, false},
|
||||
{"ScreenVSync", 1, &ScreenVSync, false, false},
|
||||
{"ScreenVSyncInterval", 0, &ScreenVSyncInterval, 1, false},
|
||||
|
||||
{"3DRenderer", 0, &_3DRenderer, 0, false},
|
||||
{"Threaded3D", 1, &Threaded3D, true, false},
|
||||
|
||||
{"GL_ScaleFactor", 0, &GL_ScaleFactor, 1, false},
|
||||
{"GL_BetterPolygons", 1, &GL_BetterPolygons, false, false},
|
||||
|
||||
{"LimitFPS", 1, &LimitFPS, true, false},
|
||||
{"MaxFPS", 0, &MaxFPS, 1000, false},
|
||||
{"AudioSync", 1, &AudioSync, false},
|
||||
{"ShowOSD", 1, &ShowOSD, true, false},
|
||||
|
||||
{"ConsoleType", 0, &ConsoleType, 0, false},
|
||||
{"DirectBoot", 1, &DirectBoot, true, false},
|
||||
|
||||
#ifdef JIT_ENABLED
|
||||
{"JIT_Enable", 1, &JIT_Enable, false, false},
|
||||
{"JIT_MaxBlockSize", 0, &JIT_MaxBlockSize, 32, false},
|
||||
{"JIT_BranchOptimisations", 1, &JIT_BranchOptimisations, true, false},
|
||||
{"JIT_LiteralOptimisations", 1, &JIT_LiteralOptimisations, true, false},
|
||||
#ifdef __APPLE__
|
||||
{"JIT_FastMemory", 1, &JIT_FastMemory, false, false},
|
||||
#else
|
||||
{"JIT_FastMemory", 1, &JIT_FastMemory, true, false},
|
||||
#endif
|
||||
#endif
|
||||
|
||||
{"ExternalBIOSEnable", 1, &ExternalBIOSEnable, false, false},
|
||||
|
||||
{"BIOS9Path", 2, &BIOS9Path, (std::string)"", false},
|
||||
{"BIOS7Path", 2, &BIOS7Path, (std::string)"", false},
|
||||
{"FirmwarePath", 2, &FirmwarePath, (std::string)"", false},
|
||||
|
||||
{"DSiBIOS9Path", 2, &DSiBIOS9Path, (std::string)"", false},
|
||||
{"DSiBIOS7Path", 2, &DSiBIOS7Path, (std::string)"", false},
|
||||
{"DSiFirmwarePath", 2, &DSiFirmwarePath, (std::string)"", false},
|
||||
{"DSiNANDPath", 2, &DSiNANDPath, (std::string)"", false},
|
||||
|
||||
{"DLDIEnable", 1, &DLDIEnable, false, false},
|
||||
{"DLDISDPath", 2, &DLDISDPath, (std::string)"dldi.bin", false},
|
||||
{"DLDISize", 0, &DLDISize, 0, false},
|
||||
{"DLDIReadOnly", 1, &DLDIReadOnly, false, false},
|
||||
{"DLDIFolderSync", 1, &DLDIFolderSync, false, false},
|
||||
{"DLDIFolderPath", 2, &DLDIFolderPath, (std::string)"", false},
|
||||
|
||||
{"DSiSDEnable", 1, &DSiSDEnable, false, false},
|
||||
{"DSiSDPath", 2, &DSiSDPath, (std::string)"dsisd.bin", false},
|
||||
{"DSiSDSize", 0, &DSiSDSize, 0, false},
|
||||
{"DSiSDReadOnly", 1, &DSiSDReadOnly, false, false},
|
||||
{"DSiSDFolderSync", 1, &DSiSDFolderSync, false, false},
|
||||
{"DSiSDFolderPath", 2, &DSiSDFolderPath, (std::string)"", false},
|
||||
|
||||
{"FirmwareOverrideSettings", 1, &FirmwareOverrideSettings, false, true},
|
||||
{"FirmwareUsername", 2, &FirmwareUsername, (std::string)"melonDS", true},
|
||||
{"FirmwareLanguage", 0, &FirmwareLanguage, 1, true},
|
||||
{"FirmwareBirthdayMonth", 0, &FirmwareBirthdayMonth, 1, true},
|
||||
{"FirmwareBirthdayDay", 0, &FirmwareBirthdayDay, 1, true},
|
||||
{"FirmwareFavouriteColour", 0, &FirmwareFavouriteColour, 0, true},
|
||||
{"FirmwareMessage", 2, &FirmwareMessage, (std::string)"", true},
|
||||
{"FirmwareMAC", 2, &FirmwareMAC, (std::string)"", true},
|
||||
|
||||
{"MPAudioMode", 0, &MPAudioMode, 1, false},
|
||||
{"MPRecvTimeout", 0, &MPRecvTimeout, 25, false},
|
||||
|
||||
{"LANDevice", 2, &LANDevice, (std::string)"", false},
|
||||
{"DirectLAN", 1, &DirectLAN, false, false},
|
||||
|
||||
{"SavStaRelocSRAM", 1, &SavestateRelocSRAM, false, false},
|
||||
|
||||
{"AudioInterp", 0, &AudioInterp, 0, false},
|
||||
{"AudioBitDepth", 0, &AudioBitDepth, 0, false},
|
||||
{"AudioVolume", 0, &AudioVolume, 256, true},
|
||||
{"DSiVolumeSync", 1, &DSiVolumeSync, false, true},
|
||||
{"MicInputType", 0, &MicInputType, 1, false},
|
||||
{"MicDevice", 2, &MicDevice, (std::string)"", false},
|
||||
{"MicWavPath", 2, &MicWavPath, (std::string)"", false},
|
||||
|
||||
{"LastROMFolder", 2, &LastROMFolder, (std::string)"", true},
|
||||
{"LastBIOSFolder", 2, &LastBIOSFolder, (std::string)"", true},
|
||||
|
||||
{"RecentROM_0", 2, &RecentROMList[0], (std::string)"", true},
|
||||
{"RecentROM_1", 2, &RecentROMList[1], (std::string)"", true},
|
||||
{"RecentROM_2", 2, &RecentROMList[2], (std::string)"", true},
|
||||
{"RecentROM_3", 2, &RecentROMList[3], (std::string)"", true},
|
||||
{"RecentROM_4", 2, &RecentROMList[4], (std::string)"", true},
|
||||
{"RecentROM_5", 2, &RecentROMList[5], (std::string)"", true},
|
||||
{"RecentROM_6", 2, &RecentROMList[6], (std::string)"", true},
|
||||
{"RecentROM_7", 2, &RecentROMList[7], (std::string)"", true},
|
||||
{"RecentROM_8", 2, &RecentROMList[8], (std::string)"", true},
|
||||
{"RecentROM_9", 2, &RecentROMList[9], (std::string)"", true},
|
||||
|
||||
{"SaveFilePath", 2, &SaveFilePath, (std::string)"", true},
|
||||
{"SavestatePath", 2, &SavestatePath, (std::string)"", true},
|
||||
{"CheatFilePath", 2, &CheatFilePath, (std::string)"", true},
|
||||
|
||||
{"EnableCheats", 1, &EnableCheats, false, true},
|
||||
|
||||
{"MouseHide", 1, &MouseHide, false, false},
|
||||
{"MouseHideSeconds", 0, &MouseHideSeconds, 5, false},
|
||||
{"PauseLostFocus", 1, &PauseLostFocus, false, false},
|
||||
{"UITheme", 2, &UITheme, (std::string)"", false},
|
||||
|
||||
{"RTCOffset", 3, &RTCOffset, (int64_t)0, true},
|
||||
|
||||
{"DSBatteryLevelOkay", 1, &DSBatteryLevelOkay, true, true},
|
||||
{"DSiBatteryLevel", 0, &DSiBatteryLevel, 0xF, true},
|
||||
{"DSiBatteryCharging", 1, &DSiBatteryCharging, true, true},
|
||||
|
||||
{"DSiFullBIOSBoot", 1, &DSiFullBIOSBoot, false, true},
|
||||
|
||||
#ifdef GDBSTUB_ENABLED
|
||||
{"GdbEnabled", 1, &GdbEnabled, false, false},
|
||||
{"GdbPortARM7", 0, &GdbPortARM7, 3334, true},
|
||||
{"GdbPortARM9", 0, &GdbPortARM9, 3333, true},
|
||||
{"GdbARM7BreakOnStartup", 1, &GdbARM7BreakOnStartup, false, true},
|
||||
{"GdbARM9BreakOnStartup", 1, &GdbARM9BreakOnStartup, false, true},
|
||||
#endif
|
||||
|
||||
// TODO!!
|
||||
// we need a more elegant way to deal with this
|
||||
{"Camera0_InputType", 0, &Camera[0].InputType, 0, false},
|
||||
{"Camera0_ImagePath", 2, &Camera[0].ImagePath, (std::string)"", false},
|
||||
{"Camera0_CamDeviceName", 2, &Camera[0].CamDeviceName, (std::string)"", false},
|
||||
{"Camera0_XFlip", 1, &Camera[0].XFlip, false, false},
|
||||
{"Camera1_InputType", 0, &Camera[1].InputType, 0, false},
|
||||
{"Camera1_ImagePath", 2, &Camera[1].ImagePath, (std::string)"", false},
|
||||
{"Camera1_CamDeviceName", 2, &Camera[1].CamDeviceName, (std::string)"", false},
|
||||
{"Camera1_XFlip", 1, &Camera[1].XFlip, false, false},
|
||||
|
||||
{"", -1, nullptr, 0, false}
|
||||
};
|
||||
|
||||
|
||||
Array::Array(toml::value& data) : Data(data)
|
||||
{
|
||||
|
@ -879,62 +668,6 @@ template<typename T> T Table::FindDefault(const std::string& path, T def, Defaul
|
|||
}
|
||||
|
||||
|
||||
bool LoadFile(int inst, int actualinst)
|
||||
{
|
||||
Platform::FileHandle* f;
|
||||
if (inst > 0)
|
||||
{
|
||||
char name[100] = {0};
|
||||
snprintf(name, 99, kLegacyUniqueConfigFile, inst+1);
|
||||
f = Platform::OpenLocalFile(name, Platform::FileMode::ReadText);
|
||||
|
||||
if (!Platform::CheckLocalFileWritable(name)) return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
f = Platform::OpenLocalFile(kLegacyConfigFile, Platform::FileMode::ReadText);
|
||||
|
||||
if (actualinst == 0 && !Platform::CheckLocalFileWritable(kLegacyConfigFile)) return false;
|
||||
}
|
||||
|
||||
if (!f) return true;
|
||||
|
||||
char linebuf[1024];
|
||||
char entryname[32];
|
||||
char entryval[1024];
|
||||
while (!Platform::IsEndOfFile(f))
|
||||
{
|
||||
if (!Platform::FileReadLine(linebuf, 1024, f))
|
||||
break;
|
||||
|
||||
int ret = sscanf(linebuf, "%31[A-Za-z_0-9]=%[^\t\r\n]", entryname, entryval);
|
||||
entryname[31] = '\0';
|
||||
if (ret < 2) continue;
|
||||
|
||||
for (ConfigEntry* entry = &ConfigFile[0]; entry->Value; entry++)
|
||||
{
|
||||
if (!strncmp(entry->Name, entryname, 32))
|
||||
{
|
||||
if ((inst > 0) && (!entry->InstanceUnique))
|
||||
break;
|
||||
|
||||
switch (entry->Type)
|
||||
{
|
||||
case 0: *(int*)entry->Value = strtol(entryval, NULL, 10); break;
|
||||
case 1: *(bool*)entry->Value = strtol(entryval, NULL, 10) ? true:false; break;
|
||||
case 2: *(std::string*)entry->Value = entryval; break;
|
||||
case 3: *(int64_t*)entry->Value = strtoll(entryval, NULL, 10); break;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
CloseFile(f);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool LoadLegacyFile(int inst)
|
||||
{
|
||||
Platform::FileHandle* f;
|
||||
|
|
|
@ -66,7 +66,7 @@ EmuInstance::EmuInstance(int inst) : instanceID(inst),
|
|||
globalCfg(Config::GetGlobalTable()),
|
||||
localCfg(Config::GetLocalTable(inst))
|
||||
{
|
||||
emuThread = new EmuThread();
|
||||
emuThread = new EmuThread(this);
|
||||
|
||||
numWindows = 0;
|
||||
mainWindow = nullptr;
|
||||
|
@ -109,7 +109,7 @@ void EmuInstance::createWindow()
|
|||
if (id == -1)
|
||||
return;
|
||||
|
||||
MainWindow* win = new MainWindow(topWindow);
|
||||
MainWindow* win = new MainWindow(this, topWindow);
|
||||
if (!topWindow) topWindow = win;
|
||||
if (!mainWindow) mainWindow = win;
|
||||
windowList[id] = win;
|
||||
|
|
|
@ -33,6 +33,10 @@ public:
|
|||
EmuInstance(int inst);
|
||||
~EmuInstance();
|
||||
|
||||
int getInstanceID() { return instanceID; }
|
||||
EmuThread* getEmuThread() { return emuThread; }
|
||||
melonDS::NDS* getNDS() { return nds; }
|
||||
|
||||
void createWindow();
|
||||
|
||||
// return: empty string = setup OK, non-empty = error message
|
||||
|
@ -40,6 +44,18 @@ public:
|
|||
|
||||
bool updateConsole(UpdateConsoleNDSArgs&& ndsargs, UpdateConsoleGBAArgs&& gbaargs) noexcept;
|
||||
|
||||
void enableCheats(bool enable);
|
||||
melonDS::ARCodeFile* getCheatFile();
|
||||
|
||||
void romIcon(const melonDS::u8 (&data)[512],
|
||||
const melonDS::u16 (&palette)[16],
|
||||
melonDS::u32 (&iconRef)[32*32]);
|
||||
void animatedROMIcon(const melonDS::u8 (&data)[8][512],
|
||||
const melonDS::u16 (&palette)[8][16],
|
||||
const melonDS::u16 (&sequence)[64],
|
||||
melonDS::u32 (&animatedIconRef)[64][32*32],
|
||||
std::vector<int> &animatedSequenceRef);
|
||||
|
||||
private:
|
||||
static int lastSep(const std::string& path);
|
||||
std::string getAssetPath(bool gba, const std::string& configpath, const std::string& ext, const std::string& file);
|
||||
|
@ -68,8 +84,6 @@ private:
|
|||
std::optional<melonDS::DSi_NAND::NANDImage> loadNAND(const std::array<melonDS::u8, melonDS::DSiBIOSSize>& arm7ibios) noexcept;
|
||||
std::optional<melonDS::FATStorageArgs> getSDCardArgs(const std::string& key) noexcept;
|
||||
std::optional<melonDS::FATStorage> loadSDCard(const std::string& key) noexcept;
|
||||
void enableCheats(bool enable);
|
||||
melonDS::ARCodeFile* getCheatFile();
|
||||
void setBatteryLevels();
|
||||
void setDateTime();
|
||||
void reset();
|
||||
|
@ -90,8 +104,6 @@ private:
|
|||
void ejectGBACart();
|
||||
bool gbaCartInserted();
|
||||
QString gbaCartLabel();
|
||||
void romIcon(const melonDS::u8 (&data)[512], const melonDS::u16 (&palette)[16], melonDS::u32 (&iconRef)[32*32]);
|
||||
void animatedROMIcon(const melonDS::u8 (&data)[8][512], const melonDS::u16 (&palette)[8][16], const melonDS::u16 (&sequence)[64], melonDS::u32 (&animatedIconRef)[64][32*32], std::vector<int> &animatedSequenceRef);
|
||||
|
||||
int instanceID;
|
||||
|
||||
|
|
|
@ -41,6 +41,7 @@
|
|||
#include "duckstation/gl/context.h"
|
||||
|
||||
#include "main.h"
|
||||
#include "EmuInstance.h"
|
||||
|
||||
#include "NDS.h"
|
||||
#include "GPU.h"
|
||||
|
@ -57,8 +58,6 @@ using namespace melonDS;
|
|||
|
||||
|
||||
// TEMP
|
||||
extern MainWindow* mainWindow;
|
||||
extern EmuThread* emuThread;
|
||||
extern bool RunningSomething;
|
||||
extern int autoScreenSizing;
|
||||
|
||||
|
@ -72,6 +71,18 @@ ScreenPanel::ScreenPanel(QWidget* parent) : QWidget(parent)
|
|||
{
|
||||
setMouseTracking(true);
|
||||
setAttribute(Qt::WA_AcceptTouchEvents);
|
||||
|
||||
QWidget* w = parent;
|
||||
for (;;)
|
||||
{
|
||||
mainWindow = qobject_cast<MainWindow*>(w);
|
||||
if (mainWindow) break;
|
||||
w = w->parentWidget();
|
||||
if (!w) break;
|
||||
}
|
||||
|
||||
emuInstance = mainWindow->getEmuInstance();
|
||||
|
||||
QTimer* mouseTimer = setupMouseTimer();
|
||||
connect(mouseTimer, &QTimer::timeout, [=] { if (Config::MouseHide) setCursor(Qt::BlankCursor);});
|
||||
|
||||
|
@ -190,8 +201,8 @@ void ScreenPanel::mousePressEvent(QMouseEvent* event)
|
|||
if (Frontend::GetTouchCoords(x, y, false))
|
||||
{
|
||||
touching = true;
|
||||
assert(emuThread->NDS != nullptr);
|
||||
emuThread->NDS->TouchScreen(x, y);
|
||||
assert(emuInstance->getNDS() != nullptr);
|
||||
emuInstance->getNDS()->TouchScreen(x, y);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -203,8 +214,8 @@ void ScreenPanel::mouseReleaseEvent(QMouseEvent* event)
|
|||
if (touching)
|
||||
{
|
||||
touching = false;
|
||||
assert(emuThread->NDS != nullptr);
|
||||
emuThread->NDS->ReleaseScreen();
|
||||
assert(emuInstance->getNDS() != nullptr);
|
||||
emuInstance->getNDS()->ReleaseScreen();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -222,8 +233,8 @@ void ScreenPanel::mouseMoveEvent(QMouseEvent* event)
|
|||
|
||||
if (Frontend::GetTouchCoords(x, y, true))
|
||||
{
|
||||
assert(emuThread->NDS != nullptr);
|
||||
emuThread->NDS->TouchScreen(x, y);
|
||||
assert(emuInstance->getNDS() != nullptr);
|
||||
emuInstance->getNDS()->TouchScreen(x, y);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -242,16 +253,16 @@ void ScreenPanel::tabletEvent(QTabletEvent* event)
|
|||
if (Frontend::GetTouchCoords(x, y, event->type()==QEvent::TabletMove))
|
||||
{
|
||||
touching = true;
|
||||
assert(emuThread->NDS != nullptr);
|
||||
emuThread->NDS->TouchScreen(x, y);
|
||||
assert(emuInstance->getNDS() != nullptr);
|
||||
emuInstance->getNDS()->TouchScreen(x, y);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case QEvent::TabletRelease:
|
||||
if (touching)
|
||||
{
|
||||
assert(emuThread->NDS != nullptr);
|
||||
emuThread->NDS->ReleaseScreen();
|
||||
assert(emuInstance->getNDS() != nullptr);
|
||||
emuInstance->getNDS()->ReleaseScreen();
|
||||
touching = false;
|
||||
}
|
||||
break;
|
||||
|
@ -277,16 +288,16 @@ void ScreenPanel::touchEvent(QTouchEvent* event)
|
|||
if (Frontend::GetTouchCoords(x, y, event->type()==QEvent::TouchUpdate))
|
||||
{
|
||||
touching = true;
|
||||
assert(emuThread->NDS != nullptr);
|
||||
emuThread->NDS->TouchScreen(x, y);
|
||||
assert(emuInstance->getNDS() != nullptr);
|
||||
emuInstance->getNDS()->TouchScreen(x, y);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case QEvent::TouchEnd:
|
||||
if (touching)
|
||||
{
|
||||
assert(emuThread->NDS != nullptr);
|
||||
emuThread->NDS->ReleaseScreen();
|
||||
assert(emuInstance->getNDS() != nullptr);
|
||||
emuInstance->getNDS()->ReleaseScreen();
|
||||
touching = false;
|
||||
}
|
||||
break;
|
||||
|
@ -618,19 +629,23 @@ void ScreenPanelNative::paintEvent(QPaintEvent* event)
|
|||
// fill background
|
||||
painter.fillRect(event->rect(), QColor::fromRgb(0, 0, 0));
|
||||
|
||||
auto emuThread = emuInstance->getEmuThread();
|
||||
|
||||
if (emuThread->emuIsActive())
|
||||
{
|
||||
assert(emuThread->NDS != nullptr);
|
||||
auto nds = emuInstance->getNDS();
|
||||
|
||||
assert(nds != nullptr);
|
||||
emuThread->FrontBufferLock.lock();
|
||||
int frontbuf = emuThread->FrontBuffer;
|
||||
if (!emuThread->NDS->GPU.Framebuffer[frontbuf][0] || !emuThread->NDS->GPU.Framebuffer[frontbuf][1])
|
||||
if (!nds->GPU.Framebuffer[frontbuf][0] || !nds->GPU.Framebuffer[frontbuf][1])
|
||||
{
|
||||
emuThread->FrontBufferLock.unlock();
|
||||
return;
|
||||
}
|
||||
|
||||
memcpy(screen[0].scanLine(0), emuThread->NDS->GPU.Framebuffer[frontbuf][0].get(), 256 * 192 * 4);
|
||||
memcpy(screen[1].scanLine(0), emuThread->NDS->GPU.Framebuffer[frontbuf][1].get(), 256 * 192 * 4);
|
||||
memcpy(screen[0].scanLine(0), nds->GPU.Framebuffer[frontbuf][0].get(), 256 * 192 * 4);
|
||||
memcpy(screen[1].scanLine(0), nds->GPU.Framebuffer[frontbuf][1].get(), 256 * 192 * 4);
|
||||
emuThread->FrontBufferLock.unlock();
|
||||
|
||||
QRect screenrc(0, 0, 256, 192);
|
||||
|
@ -891,7 +906,11 @@ void ScreenPanelGL::osdDeleteItem(OSDItem* item)
|
|||
void ScreenPanelGL::drawScreenGL()
|
||||
{
|
||||
if (!glContext) return;
|
||||
if (!emuThread->NDS) return;
|
||||
|
||||
auto nds = emuInstance->getNDS();
|
||||
if (!nds) return;
|
||||
|
||||
auto emuThread = emuInstance->getEmuThread();
|
||||
|
||||
glContext->MakeCurrent();
|
||||
|
||||
|
@ -916,10 +935,10 @@ void ScreenPanelGL::drawScreenGL()
|
|||
glActiveTexture(GL_TEXTURE0);
|
||||
|
||||
#ifdef OGLRENDERER_ENABLED
|
||||
if (emuThread->NDS->GPU.GetRenderer3D().Accelerated)
|
||||
if (nds->GPU.GetRenderer3D().Accelerated)
|
||||
{
|
||||
// hardware-accelerated render
|
||||
static_cast<GLRenderer&>(emuThread->NDS->GPU.GetRenderer3D()).GetCompositor().BindOutputTexture(frontbuf);
|
||||
static_cast<GLRenderer&>(nds->GPU.GetRenderer3D()).GetCompositor().BindOutputTexture(frontbuf);
|
||||
}
|
||||
else
|
||||
#endif
|
||||
|
@ -927,12 +946,12 @@ void ScreenPanelGL::drawScreenGL()
|
|||
// regular render
|
||||
glBindTexture(GL_TEXTURE_2D, screenTexture);
|
||||
|
||||
if (emuThread->NDS->GPU.Framebuffer[frontbuf][0] && emuThread->NDS->GPU.Framebuffer[frontbuf][1])
|
||||
if (nds->GPU.Framebuffer[frontbuf][0] && nds->GPU.Framebuffer[frontbuf][1])
|
||||
{
|
||||
glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, 256, 192, GL_RGBA,
|
||||
GL_UNSIGNED_BYTE, emuThread->NDS->GPU.Framebuffer[frontbuf][0].get());
|
||||
GL_UNSIGNED_BYTE, nds->GPU.Framebuffer[frontbuf][0].get());
|
||||
glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 192+2, 256, 192, GL_RGBA,
|
||||
GL_UNSIGNED_BYTE, emuThread->NDS->GPU.Framebuffer[frontbuf][1].get());
|
||||
GL_UNSIGNED_BYTE, nds->GPU.Framebuffer[frontbuf][1].get());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -35,7 +35,8 @@
|
|||
#include "duckstation/gl/context.h"
|
||||
|
||||
|
||||
class EmuThread;
|
||||
class MainWindow;
|
||||
class EmuInstance;
|
||||
|
||||
|
||||
const struct { int id; float ratio; const char* label; } aspectRatios[] =
|
||||
|
@ -69,6 +70,9 @@ private slots:
|
|||
void onScreenLayoutChanged();
|
||||
|
||||
protected:
|
||||
MainWindow* mainWindow;
|
||||
EmuInstance* emuInstance;
|
||||
|
||||
struct OSDItem
|
||||
{
|
||||
unsigned int id;
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
#include "types.h"
|
||||
#include "Platform.h"
|
||||
#include "Config.h"
|
||||
#include "ROMManager.h"
|
||||
#include "EmuInstance.h"
|
||||
#include "DSi_NAND.h"
|
||||
|
||||
#include "TitleManagerDialog.h"
|
||||
|
@ -44,6 +44,8 @@ TitleManagerDialog::TitleManagerDialog(QWidget* parent, DSi_NAND::NANDImage& ima
|
|||
ui->setupUi(this);
|
||||
setAttribute(Qt::WA_DeleteOnClose);
|
||||
|
||||
emuInstance = ((MainWindow*)parent)->getEmuInstance();
|
||||
|
||||
ui->lstTitleList->setIconSize(QSize(32, 32));
|
||||
|
||||
const u32 category = 0x00030004;
|
||||
|
@ -113,7 +115,7 @@ void TitleManagerDialog::createTitleItem(u32 category, u32 titleid)
|
|||
nandmount.GetTitleInfo(category, titleid, version, &header, &banner);
|
||||
|
||||
u32 icondata[32*32];
|
||||
ROMManager::ROMIcon(banner.Icon, banner.Palette, icondata);
|
||||
emuInstance->romIcon(banner.Icon, banner.Palette, icondata);
|
||||
QImage iconimg((const uchar*)icondata, 32, 32, QImage::Format_RGBA8888);
|
||||
QIcon icon(QPixmap::fromImage(iconimg.copy()));
|
||||
|
||||
|
|
|
@ -41,6 +41,8 @@ namespace Ui
|
|||
class TitleManagerDialog;
|
||||
class TitleImportDialog;
|
||||
|
||||
class EmuInstance;
|
||||
|
||||
class TitleManagerDialog : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
@ -94,6 +96,8 @@ private slots:
|
|||
void onExportTitleData();
|
||||
|
||||
private:
|
||||
EmuInstance* emuInstance;
|
||||
|
||||
melonDS::DSi_NAND::NANDMount nandmount;
|
||||
Ui::TitleManagerDialog* ui;
|
||||
|
||||
|
|
|
@ -104,6 +104,8 @@ public:
|
|||
explicit MainWindow(EmuInstance* inst, QWidget* parent = nullptr);
|
||||
~MainWindow();
|
||||
|
||||
EmuInstance* getEmuInstance() { return emuInstance; }
|
||||
|
||||
void attachEmuThread(EmuThread* thread);
|
||||
|
||||
bool hasOpenGL() { return hasOGL; }
|
||||
|
|
Loading…
Reference in New Issue