From 19ddaee13b5400b14ef3d3a6299474e7f715a948 Mon Sep 17 00:00:00 2001 From: Arisotura Date: Thu, 18 Nov 2021 01:17:51 +0100 Subject: finally decouple Config from the core. baahhahahahah --- src/ARM.cpp | 1 - src/ARMJIT_A64/ARMJIT_Compiler.cpp | 1 - src/ARMJIT_x64/ARMJIT_Compiler.cpp | 13 +- src/ARMJIT_x64/ARMJIT_LoadStore.cpp | 2 - src/CMakeLists.txt | 1 - src/Config.cpp | 143 -------- src/Config.h | 49 --- src/DSi_SD.cpp | 1 - src/GPU3D.cpp | 5 +- src/GPU3D_OpenGL.cpp | 1 - src/GPU3D_Soft.cpp | 1 - src/GPU_OpenGL.cpp | 1 - src/NDS.cpp | 8 +- src/Platform.h | 2 + src/SPU.cpp | 2 + src/frontend/Util_ROM.cpp | 1 - src/frontend/qt_sdl/AudioSettingsDialog.cpp | 1 - src/frontend/qt_sdl/CMakeLists.txt | 3 +- src/frontend/qt_sdl/CheatsDialog.cpp | 1 - src/frontend/qt_sdl/Config.cpp | 378 +++++++++++++++++++++ src/frontend/qt_sdl/Config.h | 161 +++++++++ src/frontend/qt_sdl/EmuSettingsDialog.cpp | 1 - src/frontend/qt_sdl/FirmwareSettingsDialog.cpp | 2 +- src/frontend/qt_sdl/Input.cpp | 2 +- .../qt_sdl/InputConfig/InputConfigDialog.cpp | 1 - src/frontend/qt_sdl/InterfaceSettingsDialog.cpp | 1 - src/frontend/qt_sdl/LAN_PCap.cpp | 2 +- src/frontend/qt_sdl/LAN_Socket.cpp | 1 - src/frontend/qt_sdl/OSD.cpp | 2 +- src/frontend/qt_sdl/Platform.cpp | 4 +- src/frontend/qt_sdl/PlatformConfig.cpp | 294 ---------------- src/frontend/qt_sdl/PlatformConfig.h | 147 -------- src/frontend/qt_sdl/ROMInfoDialog.cpp | 1 - src/frontend/qt_sdl/TitleManagerDialog.cpp | 1 - src/frontend/qt_sdl/VideoSettingsDialog.cpp | 1 - src/frontend/qt_sdl/WifiSettingsDialog.cpp | 1 - src/frontend/qt_sdl/main.cpp | 1 - 37 files changed, 565 insertions(+), 673 deletions(-) delete mode 100644 src/Config.cpp delete mode 100644 src/Config.h create mode 100644 src/frontend/qt_sdl/Config.cpp create mode 100644 src/frontend/qt_sdl/Config.h delete mode 100644 src/frontend/qt_sdl/PlatformConfig.cpp delete mode 100644 src/frontend/qt_sdl/PlatformConfig.h (limited to 'src') diff --git a/src/ARM.cpp b/src/ARM.cpp index 811dd7c..55f60bf 100644 --- a/src/ARM.cpp +++ b/src/ARM.cpp @@ -24,7 +24,6 @@ #include "ARMInterpreter.h" #include "AREngine.h" #include "ARMJIT.h" -#include "Config.h" #ifdef JIT_ENABLED #include "ARMJIT.h" diff --git a/src/ARMJIT_A64/ARMJIT_Compiler.cpp b/src/ARMJIT_A64/ARMJIT_Compiler.cpp index 5941656..1ad24b1 100644 --- a/src/ARMJIT_A64/ARMJIT_Compiler.cpp +++ b/src/ARMJIT_A64/ARMJIT_Compiler.cpp @@ -20,7 +20,6 @@ #include "../ARMJIT_Internal.h" #include "../ARMInterpreter.h" -#include "../Config.h" #ifdef __SWITCH__ #include diff --git a/src/ARMJIT_x64/ARMJIT_Compiler.cpp b/src/ARMJIT_x64/ARMJIT_Compiler.cpp index 8178684..6fffcec 100644 --- a/src/ARMJIT_x64/ARMJIT_Compiler.cpp +++ b/src/ARMJIT_x64/ARMJIT_Compiler.cpp @@ -19,7 +19,6 @@ #include "ARMJIT_Compiler.h" #include "../ARMInterpreter.h" -#include "../Config.h" #include #include @@ -638,11 +637,11 @@ const Compiler::CompileFunc T_Comp[ARMInstrInfo::tk_Count] = { // LDR/STR sp rel F(T_Comp_MemSPRel), F(T_Comp_MemSPRel), // PUSH/POP - F(T_Comp_PUSH_POP), F(T_Comp_PUSH_POP), + F(T_Comp_PUSH_POP), F(T_Comp_PUSH_POP), // LDMIA, STMIA - F(T_Comp_LDMIA_STMIA), F(T_Comp_LDMIA_STMIA), + F(T_Comp_LDMIA_STMIA), F(T_Comp_LDMIA_STMIA), // Branch - F(T_Comp_BCOND), F(T_Comp_BranchXchangeReg), F(T_Comp_BranchXchangeReg), F(T_Comp_B), F(T_Comp_BL_LONG_1), F(T_Comp_BL_LONG_2), + F(T_Comp_BCOND), F(T_Comp_BranchXchangeReg), F(T_Comp_BranchXchangeReg), F(T_Comp_B), F(T_Comp_BL_LONG_1), F(T_Comp_BL_LONG_2), // Unk, SVC NULL, NULL, F(T_Comp_BL_Merged) @@ -832,7 +831,7 @@ JitBlockEntry Compiler::CompileBlock(ARM* cpu, bool thumb, FetchedInstr instrs[] SetJumpTarget(skipExecute); } } - + } } @@ -888,7 +887,7 @@ void Compiler::Comp_AddCycles_CI(Gen::X64Reg i, int add) s32 cycles = Num ? NDS::ARM7MemTimings[CurInstr.CodeCycles][Thumb ? 0 : 2] : ((R15 & 0x2) ? 0 : CurInstr.CodeCycles); - + if (!Thumb && CurInstr.Cond() < 0xE) { LEA(32, RSCRATCH, MDisp(i, add + cycles)); @@ -933,7 +932,7 @@ void Compiler::Comp_AddCycles_CDI() { cycles = numC + numD + 1; } - + if (!Thumb && CurInstr.Cond() < 0xE) ADD(32, MDisp(RCPU, offsetof(ARM, Cycles)), Imm8(cycles)); else diff --git a/src/ARMJIT_x64/ARMJIT_LoadStore.cpp b/src/ARMJIT_x64/ARMJIT_LoadStore.cpp index c1a09fa..07cade4 100644 --- a/src/ARMJIT_x64/ARMJIT_LoadStore.cpp +++ b/src/ARMJIT_x64/ARMJIT_LoadStore.cpp @@ -18,8 +18,6 @@ #include "ARMJIT_Compiler.h" -#include "../Config.h" - using namespace Gen; namespace ARMJIT diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index d8250ae..16c68e1 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -11,7 +11,6 @@ add_library(core STATIC ARMInterpreter_ALU.cpp ARMInterpreter_Branch.cpp ARMInterpreter_LoadStore.cpp - Config.cpp CP15.cpp CRC32.cpp DMA.cpp diff --git a/src/Config.cpp b/src/Config.cpp deleted file mode 100644 index 0565a32..0000000 --- a/src/Config.cpp +++ /dev/null @@ -1,143 +0,0 @@ -/* - Copyright 2016-2021 Arisotura - - This file is part of melonDS. - - melonDS is free software: you can redistribute it and/or modify it under - the terms of the GNU General Public License as published by the Free - Software Foundation, either version 3 of the License, or (at your option) - any later version. - - melonDS is distributed in the hope that it will be useful, but WITHOUT ANY - WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with melonDS. If not, see http://www.gnu.org/licenses/. -*/ - -#include -#include -#include -#include "Config.h" -#include "Platform.h" - - -namespace Config -{ - -const char* kConfigFile = "melonDS.ini"; - - -int AudioBitrate; - -ConfigEntry ConfigFile[] = -{ - - {"AudioBitrate", 0, &AudioBitrate, 0, NULL, 0}, - - {"", -1, NULL, 0, NULL, 0} -}; - -extern ConfigEntry PlatformConfigFile[]; - - -void Load() -{ - ConfigEntry* entry = &ConfigFile[0]; - int c = 0; - for (;;) - { - if (!entry->Value) - { - if (c > 0) break; - entry = &PlatformConfigFile[0]; - if (!entry->Value) break; - c++; - } - - if (entry->Type == 0) - *(int*)entry->Value = entry->DefaultInt; - else - { - strncpy((char*)entry->Value, entry->DefaultStr, entry->StrLength); - ((char*)entry->Value)[entry->StrLength] = '\0'; - } - - entry++; - } - - FILE* f = Platform::OpenLocalFile(kConfigFile, "r"); - if (!f) return; - - char linebuf[1024]; - char entryname[32]; - char entryval[1024]; - while (!feof(f)) - { - if (fgets(linebuf, 1024, f) == nullptr) - break; - - int ret = sscanf(linebuf, "%31[A-Za-z_0-9]=%[^\t\r\n]", entryname, entryval); - entryname[31] = '\0'; - if (ret < 2) continue; - - ConfigEntry* entry = &ConfigFile[0]; - c = 0; - for (;;) - { - if (!entry->Value) - { - if (c > 0) break; - entry = &PlatformConfigFile[0]; - if (!entry->Value) break; - c++; - } - - if (!strncmp(entry->Name, entryname, 32)) - { - if (entry->Type == 0) - *(int*)entry->Value = strtol(entryval, NULL, 10); - else - strncpy((char*)entry->Value, entryval, entry->StrLength); - - break; - } - - entry++; - } - } - - fclose(f); -} - -void Save() -{ - FILE* f = Platform::OpenLocalFile(kConfigFile, "w"); - if (!f) return; - - ConfigEntry* entry = &ConfigFile[0]; - int c = 0; - for (;;) - { - if (!entry->Value) - { - if (c > 0) break; - entry = &PlatformConfigFile[0]; - if (!entry->Value) break; - c++; - } - - if (entry->Type == 0) - fprintf(f, "%s=%d\r\n", entry->Name, *(int*)entry->Value); - else - fprintf(f, "%s=%s\r\n", entry->Name, (char*)entry->Value); - - entry++; - } - - fclose(f); -} - - -} diff --git a/src/Config.h b/src/Config.h deleted file mode 100644 index 778fd0e..0000000 --- a/src/Config.h +++ /dev/null @@ -1,49 +0,0 @@ -/* - Copyright 2016-2021 Arisotura - - This file is part of melonDS. - - melonDS is free software: you can redistribute it and/or modify it under - the terms of the GNU General Public License as published by the Free - Software Foundation, either version 3 of the License, or (at your option) - any later version. - - melonDS is distributed in the hope that it will be useful, but WITHOUT ANY - WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with melonDS. If not, see http://www.gnu.org/licenses/. -*/ - -#ifndef CONFIG_H -#define CONFIG_H - -#include - -#include "types.h" - -namespace Config -{ - -struct ConfigEntry -{ - char Name[32]; - int Type; - void* Value; - int DefaultInt; - const char* DefaultStr; - int StrLength; // should be set to actual array length minus one -}; - -FILE* GetConfigFile(const char* fileName, const char* permissions); -bool HasConfigFile(const char* fileName); -void Load(); -void Save(); - - -extern int AudioBitrate; - -} - -#endif // CONFIG_H diff --git a/src/DSi_SD.cpp b/src/DSi_SD.cpp index 20c735d..4c2b085 100644 --- a/src/DSi_SD.cpp +++ b/src/DSi_SD.cpp @@ -22,7 +22,6 @@ #include "DSi_SD.h" #include "DSi_NWifi.h" #include "Platform.h" -#include "Config.h" // observed IRQ behavior during transfers diff --git a/src/GPU3D.cpp b/src/GPU3D.cpp index 9c02b2f..7fa04b3 100644 --- a/src/GPU3D.cpp +++ b/src/GPU3D.cpp @@ -22,7 +22,6 @@ #include "NDS.h" #include "GPU.h" #include "FIFO.h" -#include "Config.h" // 3D engine notes @@ -2164,7 +2163,7 @@ void ExecuteCommand() VertexSlotCounter = 0; VertexSlotsFree = 1; break; - + case 0x60: // viewport x1,y1,x2,y2 VertexPipelineCmdDelayed8(); // note: viewport Y coordinates are upside-down @@ -2413,7 +2412,7 @@ void ExecuteCommand() CurVertex[2] = ExecParams[1] & 0xFFFF; PosTest(); break; - + case 0x70: // box test NumTestCommands -= 3; BoxTest(ExecParams); diff --git a/src/GPU3D_OpenGL.cpp b/src/GPU3D_OpenGL.cpp index ccac08a..df7fc0b 100644 --- a/src/GPU3D_OpenGL.cpp +++ b/src/GPU3D_OpenGL.cpp @@ -22,7 +22,6 @@ #include #include "NDS.h" #include "GPU.h" -#include "Config.h" #include "GPU3D_OpenGL_shaders.h" namespace GPU3D diff --git a/src/GPU3D_Soft.cpp b/src/GPU3D_Soft.cpp index 2f0f825..fa22afa 100644 --- a/src/GPU3D_Soft.cpp +++ b/src/GPU3D_Soft.cpp @@ -23,7 +23,6 @@ #include #include "NDS.h" #include "GPU.h" -#include "Config.h" namespace GPU3D diff --git a/src/GPU_OpenGL.cpp b/src/GPU_OpenGL.cpp index 350012f..0dd25f0 100644 --- a/src/GPU_OpenGL.cpp +++ b/src/GPU_OpenGL.cpp @@ -23,7 +23,6 @@ #include "NDS.h" #include "GPU.h" -#include "Config.h" #include "OpenGLSupport.h" #include "GPU_OpenGL_shaders.h" diff --git a/src/NDS.cpp b/src/NDS.cpp index 287f120..b3e4d2c 100644 --- a/src/NDS.cpp +++ b/src/NDS.cpp @@ -19,7 +19,6 @@ #include #include #include -#include "Config.h" #include "NDS.h" #include "ARM.h" #include "NDSCart.h" @@ -634,6 +633,8 @@ void Reset() RTC::Reset(); Wifi::Reset(); + // TODO: move the SOUNDBIAS/degrade logic to SPU? + // The SOUNDBIAS register does nothing on DSi SPU::SetApplyBias(ConsoleType == 0); @@ -646,9 +647,10 @@ void Reset() degradeAudio = false; } - if (Config::AudioBitrate == 1) // Always 10-bit + int bitrate = Platform::GetConfigInt(Platform::AudioBitrate); + if (bitrate == 1) // Always 10-bit degradeAudio = true; - else if (Config::AudioBitrate == 2) // Always 16-bit + else if (bitrate == 2) // Always 16-bit degradeAudio = false; SPU::SetDegrade10Bit(degradeAudio); diff --git a/src/Platform.h b/src/Platform.h index 0323637..5d127e6 100644 --- a/src/Platform.h +++ b/src/Platform.h @@ -77,6 +77,8 @@ enum ConfigEntry Firm_BirthdayDay, Firm_Color, Firm_Message, + + AudioBitrate, }; int GetConfigInt(ConfigEntry entry); diff --git a/src/SPU.cpp b/src/SPU.cpp index e2f3277..3cd3a66 100644 --- a/src/SPU.cpp +++ b/src/SPU.cpp @@ -99,6 +99,8 @@ bool Init() AudioLock = Platform::Mutex_Create(); InterpType = 0; + ApplyBias = true; + Degrade10Bit = false; // generate interpolation tables // values are 1:1:14 fixed-point diff --git a/src/frontend/Util_ROM.cpp b/src/frontend/Util_ROM.cpp index 8f100c7..99c7054 100644 --- a/src/frontend/Util_ROM.cpp +++ b/src/frontend/Util_ROM.cpp @@ -25,7 +25,6 @@ #include "ArchiveUtil.h" #endif #include "FrontendUtil.h" -#include "Config.h" #include "SharedConfig.h" #include "Platform.h" diff --git a/src/frontend/qt_sdl/AudioSettingsDialog.cpp b/src/frontend/qt_sdl/AudioSettingsDialog.cpp index bf88eab..d4ce678 100644 --- a/src/frontend/qt_sdl/AudioSettingsDialog.cpp +++ b/src/frontend/qt_sdl/AudioSettingsDialog.cpp @@ -22,7 +22,6 @@ #include "types.h" #include "Platform.h" #include "Config.h" -#include "PlatformConfig.h" #include "AudioSettingsDialog.h" #include "ui_AudioSettingsDialog.h" diff --git a/src/frontend/qt_sdl/CMakeLists.txt b/src/frontend/qt_sdl/CMakeLists.txt index 1d987a4..ad38e37 100644 --- a/src/frontend/qt_sdl/CMakeLists.txt +++ b/src/frontend/qt_sdl/CMakeLists.txt @@ -4,6 +4,7 @@ SET(SOURCES_QT_SDL main.cpp main_shaders.h CheatsDialog.cpp + Config.cpp EmuSettingsDialog.cpp InputConfig/InputConfigDialog.cpp InputConfig/MapButton.h @@ -22,7 +23,6 @@ SET(SOURCES_QT_SDL OSD_shaders.h font.h Platform.cpp - PlatformConfig.cpp QPathInput.h ArchiveUtil.h @@ -33,6 +33,7 @@ SET(SOURCES_QT_SDL ../Util_Audio.cpp ../FrontendUtil.h ../mic_blow.h + ../SharedConfig.h ${CMAKE_SOURCE_DIR}/res/melon.qrc ) diff --git a/src/frontend/qt_sdl/CheatsDialog.cpp b/src/frontend/qt_sdl/CheatsDialog.cpp index 4a4c4b6..afa0805 100644 --- a/src/frontend/qt_sdl/CheatsDialog.cpp +++ b/src/frontend/qt_sdl/CheatsDialog.cpp @@ -24,7 +24,6 @@ #include "types.h" #include "Platform.h" #include "Config.h" -#include "PlatformConfig.h" #include "CheatsDialog.h" #include "ui_CheatsDialog.h" diff --git a/src/frontend/qt_sdl/Config.cpp b/src/frontend/qt_sdl/Config.cpp new file mode 100644 index 0000000..8c3690b --- /dev/null +++ b/src/frontend/qt_sdl/Config.cpp @@ -0,0 +1,378 @@ +/* + Copyright 2016-2021 Arisotura + + This file is part of melonDS. + + melonDS is free software: you can redistribute it and/or modify it under + the terms of the GNU General Public License as published by the Free + Software Foundation, either version 3 of the License, or (at your option) + any later version. + + melonDS is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along + with melonDS. If not, see http://www.gnu.org/licenses/. +*/ + +#include +#include +#include +#include "Platform.h" +#include "Config.h" + + +namespace Config +{ + +int KeyMapping[12]; +int JoyMapping[12]; + +int HKKeyMapping[HK_MAX]; +int HKJoyMapping[HK_MAX]; + +int JoystickID; + +int WindowWidth; +int WindowHeight; +int WindowMaximized; + +int ScreenRotation; +int ScreenGap; +int ScreenLayout; +int ScreenSwap; +int ScreenSizing; +int IntegerScaling; +int ScreenAspectTop; +int ScreenAspectBot; +int ScreenFilter; + +int ScreenUseGL; +int ScreenVSync; +int ScreenVSyncInterval; + +int _3DRenderer; +int Threaded3D; + +int GL_ScaleFactor; +int GL_BetterPolygons; + +int LimitFPS; +int AudioSync; +int ShowOSD; + +int ConsoleType; +int DirectBoot; + +#ifdef JIT_ENABLED +int JIT_Enable = false; +int JIT_MaxBlockSize = 32; +int JIT_BranchOptimisations = true; +int JIT_LiteralOptimisations = true; +int JIT_FastMemory = true; +#endif + +int ExternalBIOSEnable; + +char BIOS9Path[1024]; +char BIOS7Path[1024]; +char FirmwarePath[1024]; + +char DSiBIOS9Path[1024]; +char DSiBIOS7Path[1024]; +char DSiFirmwarePath[1024]; +char DSiNANDPath[1024]; + +int DLDIEnable; +char DLDISDPath[1024]; +int DLDISize; +int DLDIReadOnly; +int DLDIFolderSync; +char DLDIFolderPath[1024]; + +int DSiSDEnable; +char DSiSDPath[1024]; +int DSiSDSize; +int DSiSDReadOnly; +int DSiSDFolderSync; +char DSiSDFolderPath[1024]; + +int RandomizeMAC; +int FirmwareOverrideSettings; +char FirmwareUsername[64]; +int FirmwareLanguage; +int FirmwareBirthdayMonth; +int FirmwareBirthdayDay; +int FirmwareFavouriteColour; +char FirmwareMessage[1024]; + +int SocketBindAnyAddr; +char LANDevice[128]; +int DirectLAN; + +int SavestateRelocSRAM; + +int AudioInterp; +int AudioBitrate; +int AudioVolume; +int MicInputType; +char MicWavPath[1024]; + +char LastROMFolder[1024]; + +char RecentROMList[10][1024]; + +int EnableCheats; + +int MouseHide; +int MouseHideSeconds; + +int PauseLostFocus; + + +const char* kConfigFile = "melonDS.ini"; + +ConfigEntry ConfigFile[] = +{ + {"Key_A", 0, &KeyMapping[0], -1, NULL, 0}, + {"Key_B", 0, &KeyMapping[1], -1, NULL, 0}, + {"Key_Select", 0, &KeyMapping[2], -1, NULL, 0}, + {"Key_Start", 0, &KeyMapping[3], -1, NULL, 0}, + {"Key_Right", 0, &KeyMapping[4], -1, NULL, 0}, + {"Key_Left", 0, &KeyMapping[5], -1, NULL, 0}, + {"Key_Up", 0, &KeyMapping[6], -1, NULL, 0}, + {"Key_Down", 0, &KeyMapping[7], -1, NULL, 0}, + {"Key_R", 0, &KeyMapping[8], -1, NULL, 0}, + {"Key_L", 0, &KeyMapping[9], -1, NULL, 0}, + {"Key_X", 0, &KeyMapping[10], -1, NULL, 0}, + {"Key_Y", 0, &KeyMapping[11], -1, NULL, 0}, + + {"Joy_A", 0, &JoyMapping[0], -1, NULL, 0}, + {"Joy_B", 0, &JoyMapping[1], -1, NULL, 0}, + {"Joy_Select", 0, &JoyMapping[2], -1, NULL, 0}, + {"Joy_Start", 0, &JoyMapping[3], -1, NULL, 0}, + {"Joy_Right", 0, &JoyMapping[4], -1, NULL, 0}, + {"Joy_Left", 0, &JoyMapping[5], -1, NULL, 0}, + {"Joy_Up", 0, &JoyMapping[6], -1, NULL, 0}, + {"Joy_Down", 0, &JoyMapping[7], -1, NULL, 0}, + {"Joy_R", 0, &JoyMapping[8], -1, NULL, 0}, + {"Joy_L", 0, &JoyMapping[9], -1, NULL, 0}, + {"Joy_X", 0, &JoyMapping[10], -1, NULL, 0}, + {"Joy_Y", 0, &JoyMapping[11], -1, NULL, 0}, + + {"HKKey_Lid", 0, &HKKeyMapping[HK_Lid], -1, NULL, 0}, + {"HKKey_Mic", 0, &HKKeyMapping[HK_Mic], -1, NULL, 0}, + {"HKKey_Pause", 0, &HKKeyMapping[HK_Pause], -1, NULL, 0}, + {"HKKey_Reset", 0, &HKKeyMapping[HK_Reset], -1, NULL, 0}, + {"HKKey_FastForward", 0, &HKKeyMapping[HK_FastForward], -1, NULL, 0}, + {"HKKey_FastForwardToggle", 0, &HKKeyMapping[HK_FastForwardToggle], -1, NULL, 0}, + {"HKKey_FullscreenToggle", 0, &HKKeyMapping[HK_FullscreenToggle], -1, NULL, 0}, + {"HKKey_SwapScreens", 0, &HKKeyMapping[HK_SwapScreens], -1, NULL, 0}, + {"HKKey_SolarSensorDecrease", 0, &HKKeyMapping[HK_SolarSensorDecrease], -1, NULL, 0}, + {"HKKey_SolarSensorIncrease", 0, &HKKeyMapping[HK_SolarSensorIncrease], -1, NULL, 0}, + {"HKKey_FrameStep", 0, &HKKeyMapping[HK_FrameStep], -1, NULL, 0}, + + {"HKJoy_Lid", 0, &HKJoyMapping[HK_Lid], -1, NULL, 0}, + {"HKJoy_Mic", 0, &HKJoyMapping[HK_Mic], -1, NULL, 0}, + {"HKJoy_Pause", 0, &HKJoyMapping[HK_Pause], -1, NULL, 0}, + {"HKJoy_Reset", 0, &HKJoyMapping[HK_Reset], -1, NULL, 0}, + {"HKJoy_FastForward", 0, &HKJoyMapping[HK_FastForward], -1, NULL, 0}, + {"HKJoy_FastForwardToggle", 0, &HKJoyMapping[HK_FastForwardToggle], -1, NULL, 0}, + {"HKJoy_FullscreenToggle", 0, &HKJoyMapping[HK_FullscreenToggle], -1, NULL, 0}, + {"HKJoy_SwapScreens", 0, &HKJoyMapping[HK_SwapScreens], -1, NULL, 0}, + {"HKJoy_SolarSensorDecrease", 0, &HKJoyMapping[HK_SolarSensorDecrease], -1, NULL, 0}, + {"HKJoy_SolarSensorIncrease", 0, &HKJoyMapping[HK_SolarSensorIncrease], -1, NULL, 0}, + {"HKJoy_FrameStep", 0, &HKJoyMapping[HK_FrameStep], -1, NULL, 0}, + + {"JoystickID", 0, &JoystickID, 0, NULL, 0}, + + {"WindowWidth", 0, &WindowWidth, 256, NULL, 0}, + {"WindowHeight", 0, &WindowHeight, 384, NULL, 0}, + {"WindowMax", 0, &WindowMaximized, 0, NULL, 0}, + + {"ScreenRotation", 0, &ScreenRotation, 0, NULL, 0}, + {"ScreenGap", 0, &ScreenGap, 0, NULL, 0}, + {"ScreenLayout", 0, &ScreenLayout, 0, NULL, 0}, + {"ScreenSwap", 0, &ScreenSwap, 0, NULL, 0}, + {"ScreenSizing", 0, &ScreenSizing, 0, NULL, 0}, + {"IntegerScaling", 0, &IntegerScaling, 0, NULL, 0}, + {"ScreenAspectTop",0, &ScreenAspectTop,0, NULL, 0}, + {"ScreenAspectBot",0, &ScreenAspectBot,0, NULL, 0}, + {"ScreenFilter", 0, &ScreenFilter, 1, NULL, 0}, + + {"ScreenUseGL", 0, &ScreenUseGL, 0, NULL, 0}, + {"ScreenVSync", 0, &ScreenVSync, 0, NULL, 0}, + {"ScreenVSyncInterval", 0, &ScreenVSyncInterval, 1, NULL, 0}, + + {"3DRenderer", 0, &_3DRenderer, 0, NULL, 0}, + {"Threaded3D", 0, &Threaded3D, 1, NULL, 0}, + + {"GL_ScaleFactor", 0, &GL_ScaleFactor, 1, NULL, 0}, + {"GL_BetterPolygons", 0, &GL_BetterPolygons, 0, NULL, 0}, + + {"LimitFPS", 0, &LimitFPS, 1, NULL, 0}, + {"AudioSync", 0, &AudioSync, 0, NULL, 0}, + {"ShowOSD", 0, &ShowOSD, 1, NULL, 0}, + + {"ConsoleType", 0, &ConsoleType, 0, NULL, 0}, + {"DirectBoot", 0, &DirectBoot, 1, NULL, 0}, + +#ifdef JIT_ENABLED + {"JIT_Enable", 0, &JIT_Enable, 0, NULL, 0}, + {"JIT_MaxBlockSize", 0, &JIT_MaxBlockSize, 32, NULL, 0}, + {"JIT_BranchOptimisations", 0, &JIT_BranchOptimisations, 1, NULL, 0}, + {"JIT_LiteralOptimisations", 0, &JIT_LiteralOptimisations, 1, NULL, 0}, + #ifdef __APPLE__ + {"JIT_FastMemory", 0, &JIT_FastMemory, 0, NULL, 0}, + #else + {"JIT_FastMemory", 0, &JIT_FastMemory, 1, NULL, 0}, + #endif +#endif + + {"ExternalBIOSEnable", 0, &ExternalBIOSEnable, 0, NULL, 0}, + + {"BIOS9Path", 1, BIOS9Path, 0, "", 1023}, + {"BIOS7Path", 1, BIOS7Path, 0, "", 1023}, + {"FirmwarePath", 1, FirmwarePath, 0, "", 1023}, + + {"DSiBIOS9Path", 1, DSiBIOS9Path, 0, "", 1023}, + {"DSiBIOS7Path", 1, DSiBIOS7Path, 0, "", 1023}, + {"DSiFirmwarePath", 1, DSiFirmwarePath, 0, "", 1023}, + {"DSiNANDPath", 1, DSiNANDPath, 0, "", 1023}, + + {"DLDIEnable", 0, &DLDIEnable, 0, NULL, 0}, + {"DLDISDPath", 1, DLDISDPath, 0, "dldi.bin", 1023}, + {"DLDISize", 0, &DLDISize, 0, NULL, 0}, + {"DLDIReadOnly", 0, &DLDIReadOnly, 0, NULL, 0}, + {"DLDIFolderSync", 0, &DLDIFolderSync, 0, NULL, 0}, + {"DLDIFolderPath", 1, DLDIFolderPath, 0, "", 1023}, + + {"DSiSDEnable", 0, &DSiSDEnable, 0, NULL, 0}, + {"DSiSDPath", 1, DSiSDPath, 0, "dsisd.bin", 1023}, + {"DSiSDSize", 0, &DSiSDSize, 0, NULL, 0}, + {"DSiSDReadOnly", 0, &DSiSDReadOnly, 0, NULL, 0}, + {"DSiSDFolderSync", 0, &DSiSDFolderSync, 0, NULL, 0}, + {"DSiSDFolderPath", 1, DSiSDFolderPath, 0, "", 1023}, + + {"RandomizeMAC", 0, &RandomizeMAC, 0, NULL, 0}, + {"FirmwareOverrideSettings", 0, &FirmwareOverrideSettings, false, NULL, 0}, + {"FirmwareUsername", 1, FirmwareUsername, 0, "melonDS", 63}, + {"FirmwareLanguage", 0, &FirmwareLanguage, 1, NULL, 0}, + {"FirmwareBirthdayMonth", 0, &FirmwareBirthdayMonth, 0, NULL, 0}, + {"FirmwareBirthdayDay", 0, &FirmwareBirthdayDay, 0, NULL, 0}, + {"FirmwareFavouriteColour", 0, &FirmwareFavouriteColour, 0, NULL, 0}, + {"FirmwareMessage", 1, FirmwareMessage, 0, "", 1023}, + + {"SockBindAnyAddr", 0, &SocketBindAnyAddr, 0, NULL, 0}, + {"LANDevice", 1, LANDevice, 0, "", 127}, + {"DirectLAN", 0, &DirectLAN, 0, NULL, 0}, + + {"SavStaRelocSRAM", 0, &SavestateRelocSRAM, 0, NULL, 0}, + + {"AudioInterp", 0, &AudioInterp, 0, NULL, 0}, + {"AudioBitrate", 0, &AudioBitrate, 0, NULL, 0}, + {"AudioVolume", 0, &AudioVolume, 256, NULL, 0}, + {"MicInputType", 0, &MicInputType, 1, NULL, 0}, + {"MicWavPath", 1, MicWavPath, 0, "", 1023}, + + {"LastROMFolder", 1, LastROMFolder, 0, "", 1023}, + + {"RecentROM_0", 1, RecentROMList[0], 0, "", 1023}, + {"RecentROM_1", 1, RecentROMList[1], 0, "", 1023}, + {"RecentROM_2", 1, RecentROMList[2], 0, "", 1023}, + {"RecentROM_3", 1, RecentROMList[3], 0, "", 1023}, + {"RecentROM_4", 1, RecentROMList[4], 0, "", 1023}, + {"RecentROM_5", 1, RecentROMList[5], 0, "", 1023}, + {"RecentROM_6", 1, RecentROMList[6], 0, "", 1023}, + {"RecentROM_7", 1, RecentROMList[7], 0, "", 1023}, + {"RecentROM_8", 1, RecentROMList[8], 0, "", 1023}, + {"RecentROM_9", 1, RecentROMList[9], 0, "", 1023}, + + {"EnableCheats", 0, &EnableCheats, 0, NULL, 0}, + + {"MouseHide", 0, &MouseHide, 0, NULL, 0}, + {"MouseHideSeconds", 0, &MouseHideSeconds, 5, NULL, 0}, + {"PauseLostFocus", 0, &PauseLostFocus, 0, NULL, 0}, + + {"", -1, NULL, 0, NULL, 0} +}; + + +void Load() +{ + ConfigEntry* entry = &ConfigFile[0]; + for (;;) + { + if (!entry->Value) break; + + if (entry->Type == 0) + *(int*)entry->Value = entry->DefaultInt; + else + { + strncpy((char*)entry->Value, entry->DefaultStr, entry->StrLength); + ((char*)entry->Value)[entry->StrLength] = '\0'; + } + + entry++; + } + + FILE* f = Platform::OpenLocalFile(kConfigFile, "r"); + if (!f) return; + + char linebuf[1024]; + char entryname[32]; + char entryval[1024]; + while (!feof(f)) + { + if (fgets(linebuf, 1024, f) == nullptr) + break; + + int ret = sscanf(linebuf, "%31[A-Za-z_0-9]=%[^\t\r\n]", entryname, entryval); + entryname[31] = '\0'; + if (ret < 2) continue; + + ConfigEntry* entry = &ConfigFile[0]; + for (;;) + { + if (!entry->Value) break; + + if (!strncmp(entry->Name, entryname, 32)) + { + if (entry->Type == 0) + *(int*)entry->Value = strtol(entryval, NULL, 10); + else + strncpy((char*)entry->Value, entryval, entry->StrLength); + + break; + } + + entry++; + } + } + + fclose(f); +} + +void Save() +{ + FILE* f = Platform::OpenLocalFile(kConfigFile, "w"); + if (!f) return; + + ConfigEntry* entry = &ConfigFile[0]; + for (;;) + { + if (!entry->Value) break; + + if (entry->Type == 0) + fprintf(f, "%s=%d\r\n", entry->Name, *(int*)entry->Value); + else + fprintf(f, "%s=%s\r\n", entry->Name, (char*)entry->Value); + + entry++; + } + + fclose(f); +} + +} diff --git a/src/frontend/qt_sdl/Config.h b/src/frontend/qt_sdl/Config.h new file mode 100644 index 0000000..5914978 --- /dev/null +++ b/src/frontend/qt_sdl/Config.h @@ -0,0 +1,161 @@ +/* + Copyright 2016-2021 Arisotura + + This file is part of melonDS. + + melonDS is free software: you can redistribute it and/or modify it under + the terms of the GNU General Public License as published by the Free + Software Foundation, either version 3 of the License, or (at your option) + any later version. + + melonDS is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along + with melonDS. If not, see http://www.gnu.org/licenses/. +*/ + +#ifndef PLATFORMCONFIG_H +#define PLATFORMCONFIG_H + +enum +{ + HK_Lid = 0, + HK_Mic, + HK_Pause, + HK_Reset, + HK_FastForward, + HK_FastForwardToggle, + HK_FullscreenToggle, + HK_SwapScreens, + HK_SolarSensorDecrease, + HK_SolarSensorIncrease, + HK_FrameStep, + HK_MAX +}; + +namespace Config +{ + +struct ConfigEntry +{ + char Name[32]; + int Type; + void* Value; + int DefaultInt; + const char* DefaultStr; + int StrLength; // should be set to actual array length minus one +}; + + +extern int KeyMapping[12]; +extern int JoyMapping[12]; + +extern int HKKeyMapping[HK_MAX]; +extern int HKJoyMapping[HK_MAX]; + +extern int JoystickID; + +extern int WindowWidth; +extern int WindowHeight; +extern int WindowMaximized; + +extern int ScreenRotation; +extern int ScreenGap; +extern int ScreenLayout; +extern int ScreenSwap; +extern int ScreenSizing; +extern int ScreenAspectTop; +extern int ScreenAspectBot; +extern int IntegerScaling; +extern int ScreenFilter; + +extern int ScreenUseGL; +extern int ScreenVSync; +extern int ScreenVSyncInterval; + +extern int _3DRenderer; +extern int Threaded3D; + +extern int GL_ScaleFactor; +extern int GL_BetterPolygons; + +extern int LimitFPS; +extern int AudioSync; +extern int ShowOSD; + +extern int ConsoleType; +extern int DirectBoot; + +#ifdef JIT_ENABLED +extern int JIT_Enable; +extern int JIT_MaxBlockSize; +extern int JIT_BranchOptimisations; +extern int JIT_LiteralOptimisations; +extern int JIT_FastMemory; +#endif + +extern int ExternalBIOSEnable; + +extern char BIOS9Path[1024]; +extern char BIOS7Path[1024]; +extern char FirmwarePath[1024]; + +extern char DSiBIOS9Path[1024]; +extern char DSiBIOS7Path[1024]; +extern char DSiFirmwarePath[1024]; +extern char DSiNANDPath[1024]; + +extern int DLDIEnable; +extern char DLDISDPath[1024]; +extern int DLDISize; +extern int DLDIReadOnly; +extern int DLDIFolderSync; +extern char DLDIFolderPath[1024]; + +extern int DSiSDEnable; +extern char DSiSDPath[1024]; +extern int DSiSDSize; +extern int DSiSDReadOnly; +extern int DSiSDFolderSync; +extern char DSiSDFolderPath[1024]; + +extern int RandomizeMAC; +extern int FirmwareOverrideSettings; +extern char FirmwareUsername[64]; +extern int FirmwareLanguage; +extern int FirmwareBirthdayMonth; +extern int FirmwareBirthdayDay; +extern int FirmwareFavouriteColour; +extern char FirmwareMessage[1024]; + +extern int SocketBindAnyAddr; +extern char LANDevice[128]; +extern int DirectLAN; + +extern int SavestateRelocSRAM; + +extern int AudioInterp; +extern int AudioBitrate; +extern int AudioVolume; +extern int MicInputType; +extern char MicWavPath[1024]; + +extern char LastROMFolder[1024]; + +extern char RecentROMList[10][1024]; + +extern int EnableCheats; + +extern int MouseHide; +extern int MouseHideSeconds; +extern int PauseLostFocus; + + +void Load(); +void Save(); + +} + +#endif // PLATFORMCONFIG_H diff --git a/src/frontend/qt_sdl/EmuSettingsDialog.cpp b/src/frontend/qt_sdl/EmuSettingsDialog.cpp index 99c6630..379300f 100644 --- a/src/frontend/qt_sdl/EmuSettingsDialog.cpp +++ b/src/frontend/qt_sdl/EmuSettingsDialog.cpp @@ -25,7 +25,6 @@ #include "types.h" #include "Platform.h" #include "Config.h" -#include "PlatformConfig.h" #include "EmuSettingsDialog.h" #include "ui_EmuSettingsDialog.h" diff --git a/src/frontend/qt_sdl/FirmwareSettingsDialog.cpp b/src/frontend/qt_sdl/FirmwareSettingsDialog.cpp index 834624f..94e5f5a 100644 --- a/src/frontend/qt_sdl/FirmwareSettingsDialog.cpp +++ b/src/frontend/qt_sdl/FirmwareSettingsDialog.cpp @@ -16,7 +16,7 @@ with melonDS. If not, see http://www.gnu.org/licenses/. */ -#include "PlatformConfig.h" +#include "Config.h" #include "FirmwareSettingsDialog.h" #include "ui_FirmwareSettingsDialog.h" diff --git a/src/frontend/qt_sdl/Input.cpp b/src/frontend/qt_sdl/Input.cpp index 07e5252..cca11e7 100644 --- a/src/frontend/qt_sdl/Input.cpp +++ b/src/frontend/qt_sdl/Input.cpp @@ -20,7 +20,7 @@ #include #include "Input.h" -#include "PlatformConfig.h" +#include "Config.h" namespace Input diff --git a/src/frontend/qt_sdl/InputConfig/InputConfigDialog.cpp b/src/frontend/qt_sdl/InputConfig/InputConfigDialog.cpp index 4040079..2a50539 100644 --- a/src/frontend/qt_sdl/InputConfig/InputConfigDialog.cpp +++ b/src/frontend/qt_sdl/InputConfig/InputConfigDialog.cpp @@ -25,7 +25,6 @@ #include "types.h" #include "Config.h" -#include "PlatformConfig.h" #include "MapButton.h" #include "Input.h" diff --git a/src/frontend/qt_sdl/InterfaceSettingsDialog.cpp b/src/frontend/qt_sdl/InterfaceSettingsDialog.cpp index 3fad0ff..788e596 100644 --- a/src/frontend/qt_sdl/InterfaceSettingsDialog.cpp +++ b/src/frontend/qt_sdl/InterfaceSettingsDialog.cpp @@ -22,7 +22,6 @@ #include "types.h" #include "Platform.h" #include "Config.h" -#include "PlatformConfig.h" InterfaceSettingsDialog* InterfaceSettingsDialog::currentDlg = nullptr; diff --git a/src/frontend/qt_sdl/LAN_PCap.cpp b/src/frontend/qt_sdl/LAN_PCap.cpp index df647fc..ed3eee9 100644 --- a/src/frontend/qt_sdl/LAN_PCap.cpp +++ b/src/frontend/qt_sdl/LAN_PCap.cpp @@ -25,7 +25,7 @@ #include #include "../Wifi.h" #include "LAN_PCap.h" -#include "PlatformConfig.h" +#include "Config.h" #ifdef __WIN32__ #include diff --git a/src/frontend/qt_sdl/LAN_Socket.cpp b/src/frontend/qt_sdl/LAN_Socket.cpp index b385c6a..83ddd99 100644 --- a/src/frontend/qt_sdl/LAN_Socket.cpp +++ b/src/frontend/qt_sdl/LAN_Socket.cpp @@ -23,7 +23,6 @@ #include #include "Wifi.h" #include "LAN_Socket.h" -#include "Config.h" #include "FIFO.h" #include diff --git a/src/frontend/qt_sdl/OSD.cpp b/src/frontend/qt_sdl/OSD.cpp index bc3cd91..d9f75fd 100644 --- a/src/frontend/qt_sdl/OSD.cpp +++ b/src/frontend/qt_sdl/OSD.cpp @@ -29,7 +29,7 @@ #include "OSD_shaders.h" #include "font.h" -#include "PlatformConfig.h" +#include "Config.h" extern MainWindow* mainWindow; diff --git a/src/frontend/qt_sdl/Platform.cpp b/src/frontend/qt_sdl/Platform.cpp index c787092..9dfad06 100644 --- a/src/frontend/qt_sdl/Platform.cpp +++ b/src/frontend/qt_sdl/Platform.cpp @@ -51,7 +51,7 @@ #include #include "Platform.h" -#include "PlatformConfig.h" +#include "Config.h" #include "LAN_Socket.h" #include "LAN_PCap.h" #include @@ -140,6 +140,8 @@ int GetConfigInt(ConfigEntry entry) case Firm_BirthdayMonth: return Config::FirmwareBirthdayMonth; case Firm_BirthdayDay: return Config::FirmwareBirthdayDay; case Firm_Color: return Config::FirmwareFavouriteColour; + + case AudioBitrate: return Config::AudioBitrate; } return 0; diff --git a/src/frontend/qt_sdl/PlatformConfig.cpp b/src/frontend/qt_sdl/PlatformConfig.cpp deleted file mode 100644 index abecb2d..0000000 --- a/src/frontend/qt_sdl/PlatformConfig.cpp +++ /dev/null @@ -1,294 +0,0 @@ -/* - Copyright 2016-2021 Arisotura - - This file is part of melonDS. - - melonDS is free software: you can redistribute it and/or modify it under - the terms of the GNU General Public License as published by the Free - Software Foundation, either version 3 of the License, or (at your option) - any later version. - - melonDS is distributed in the hope that it will be useful, but WITHOUT ANY - WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with melonDS. If not, see http://www.gnu.org/licenses/. -*/ - -#include -#include -#include -#include "PlatformConfig.h" - -namespace Config -{ - -int KeyMapping[12]; -int JoyMapping[12]; - -int HKKeyMapping[HK_MAX]; -int HKJoyMapping[HK_MAX]; - -int JoystickID; - -int WindowWidth; -int WindowHeight; -int WindowMaximized; - -int ScreenRotation; -int ScreenGap; -int ScreenLayout; -int ScreenSwap; -int ScreenSizing; -int IntegerScaling; -int ScreenAspectTop; -int ScreenAspectBot; -int ScreenFilter; - -int ScreenUseGL; -int ScreenVSync; -int ScreenVSyncInterval; - -int _3DRenderer; -int Threaded3D; - -int GL_ScaleFactor; -int GL_BetterPolygons; - -int LimitFPS; -int AudioSync; -int ShowOSD; - -int ConsoleType; -int DirectBoot; - -#ifdef JIT_ENABLED -int JIT_Enable = false; -int JIT_MaxBlockSize = 32; -int JIT_BranchOptimisations = true; -int JIT_LiteralOptimisations = true; -int JIT_FastMemory = true; -#endif - -int ExternalBIOSEnable; - -char BIOS9Path[1024]; -char BIOS7Path[1024]; -char FirmwarePath[1024]; - -char DSiBIOS9Path[1024]; -char DSiBIOS7Path[1024]; -char DSiFirmwarePath[1024]; -char DSiNANDPath[1024]; - -int DLDIEnable; -char DLDISDPath[1024]; -int DLDISize; -int DLDIReadOnly; -int DLDIFolderSync; -char DLDIFolderPath[1024]; - -int DSiSDEnable; -char DSiSDPath[1024]; -int DSiSDSize; -int DSiSDReadOnly; -int DSiSDFolderSync; -char DSiSDFolderPath[1024]; - -int RandomizeMAC; -int FirmwareOverrideSettings; -char FirmwareUsername[64]; -int FirmwareLanguage; -int FirmwareBirthdayMonth; -int FirmwareBirthdayDay; -int FirmwareFavouriteColour; -char FirmwareMessage[1024]; - -int SocketBindAnyAddr; -char LANDevice[128]; -int DirectLAN; - -int SavestateRelocSRAM; - -int AudioInterp; -int AudioVolume; -int MicInputType; -char MicWavPath[1024]; - -char LastROMFolder[1024]; - -char RecentROMList[10][1024]; - -int EnableCheats; - -int MouseHide; -int MouseHideSeconds; - -int PauseLostFocus; - -ConfigEntry PlatformConfigFile[] = -{ - {"Key_A", 0, &KeyMapping[0], -1, NULL, 0}, - {"Key_B", 0, &KeyMapping[1], -1, NULL, 0}, - {"Key_Select", 0, &KeyMapping[2], -1, NULL, 0}, - {"Key_Start", 0, &KeyMapping[3], -1, NULL, 0}, - {"Key_Right", 0, &KeyMapping[4], -1, NULL, 0}, - {"Key_Left", 0, &KeyMapping[5], -1, NULL, 0}, - {"Key_Up", 0, &KeyMapping[6], -1, NULL, 0}, - {"Key_Down", 0, &KeyMapping[7], -1, NULL, 0}, - {"Key_R", 0, &KeyMapping[8], -1, NULL, 0}, - {"Key_L", 0, &KeyMapping[9], -1, NULL, 0}, - {"Key_X", 0, &KeyMapping[10], -1, NULL, 0}, - {"Key_Y", 0, &KeyMapping[11], -1, NULL, 0}, - - {"Joy_A", 0, &JoyMapping[0], -1, NULL, 0}, - {"Joy_B", 0, &JoyMapping[1], -1, NULL, 0}, - {"Joy_Select", 0, &JoyMapping[2], -1, NULL, 0}, - {"Joy_Start", 0, &JoyMapping[3], -1, NULL, 0}, - {"Joy_Right", 0, &JoyMapping[4], -1, NULL, 0}, - {"Joy_Left", 0, &JoyMapping[5], -1, NULL, 0}, - {"Joy_Up", 0, &JoyMapping[6], -1, NULL, 0}, - {"Joy_Down", 0, &JoyMapping[7], -1, NULL, 0}, - {"Joy_R", 0, &JoyMapping[8], -1, NULL, 0}, - {"Joy_L", 0, &JoyMapping[9], -1, NULL, 0}, - {"Joy_X", 0, &JoyMapping[10], -1, NULL, 0}, - {"Joy_Y", 0, &JoyMapping[11], -1, NULL, 0}, - - {"HKKey_Lid", 0, &HKKeyMapping[HK_Lid], -1, NULL, 0}, - {"HKKey_Mic", 0, &HKKeyMapping[HK_Mic], -1, NULL, 0}, - {"HKKey_Pause", 0, &HKKeyMapping[HK_Pause], -1, NULL, 0}, - {"HKKey_Reset", 0, &HKKeyMapping[HK_Reset], -1, NULL, 0}, - {"HKKey_FastForward", 0, &HKKeyMapping[HK_FastForward], -1, NULL, 0}, - {"HKKey_FastForwardToggle", 0, &HKKeyMapping[HK_FastForwardToggle], -1, NULL, 0}, - {"HKKey_FullscreenToggle", 0, &HKKeyMapping[HK_FullscreenToggle], -1, NULL, 0}, - {"HKKey_SwapScreens", 0, &HKKeyMapping[HK_SwapScreens], -1, NULL, 0}, - {"HKKey_SolarSensorDecrease", 0, &HKKeyMapping[HK_SolarSensorDecrease], -1, NULL, 0}, - {"HKKey_SolarSensorIncrease", 0, &HKKeyMapping[HK_SolarSensorIncrease], -1, NULL, 0}, - {"HKKey_FrameStep", 0, &HKKeyMapping[HK_FrameStep], -1, NULL, 0}, - - {"HKJoy_Lid", 0, &HKJoyMapping[HK_Lid], -1, NULL, 0}, - {"HKJoy_Mic", 0, &HKJoyMapping[HK_Mic], -1, NULL, 0}, - {"HKJoy_Pause", 0, &HKJoyMapping[HK_Pause], -1, NULL, 0}, - {"HKJoy_Reset", 0, &HKJoyMapping[HK_Reset], -1, NULL, 0}, - {"HKJoy_FastForward", 0, &HKJoyMapping[HK_FastForward], -1, NULL, 0}, - {"HKJoy_FastForwardToggle", 0, &HKJoyMapping[HK_FastForwardToggle], -1, NULL, 0}, - {"HKJoy_FullscreenToggle", 0, &HKJoyMapping[HK_FullscreenToggle], -1, NULL, 0}, - {"HKJoy_SwapScreens", 0, &HKJoyMapping[HK_SwapScreens], -1, NULL, 0}, - {"HKJoy_SolarSensorDecrease", 0, &HKJoyMapping[HK_SolarSensorDecrease], -1, NULL, 0}, - {"HKJoy_SolarSensorIncrease", 0, &HKJoyMapping[HK_SolarSensorIncrease], -1, NULL, 0}, - {"HKJoy_FrameStep", 0, &HKJoyMapping[HK_FrameStep], -1, NULL, 0}, - - {"JoystickID", 0, &JoystickID, 0, NULL, 0}, - - {"WindowWidth", 0, &WindowWidth, 256, NULL, 0}, - {"WindowHeight", 0, &WindowHeight, 384, NULL, 0}, - {"WindowMax", 0, &WindowMaximized, 0, NULL, 0}, - - {"ScreenRotation", 0, &ScreenRotation, 0, NULL, 0}, - {"ScreenGap", 0, &ScreenGap, 0, NULL, 0}, - {"ScreenLayout", 0, &ScreenLayout, 0, NULL, 0}, - {"ScreenSwap", 0, &ScreenSwap, 0, NULL, 0}, - {"ScreenSizing", 0, &ScreenSizing, 0, NULL, 0}, - {"IntegerScaling", 0, &IntegerScaling, 0, NULL, 0}, - {"ScreenAspectTop",0, &ScreenAspectTop,0, NULL, 0}, - {"ScreenAspectBot",0, &ScreenAspectBot,0, NULL, 0}, - {"ScreenFilter", 0, &ScreenFilter, 1, NULL, 0}, - - {"ScreenUseGL", 0, &ScreenUseGL, 0, NULL, 0}, - {"ScreenVSync", 0, &ScreenVSync, 0, NULL, 0}, - {"ScreenVSyncInterval", 0, &ScreenVSyncInterval, 1, NULL, 0}, - - {"3DRenderer", 0, &_3DRenderer, 0, NULL, 0}, - {"Threaded3D", 0, &Threaded3D, 1, NULL, 0}, - - {"GL_ScaleFactor", 0, &GL_ScaleFactor, 1, NULL, 0}, - {"GL_BetterPolygons", 0, &GL_BetterPolygons, 0, NULL, 0}, - - {"LimitFPS", 0, &LimitFPS, 1, NULL, 0}, - {"AudioSync", 0, &AudioSync, 0, NULL, 0}, - {"ShowOSD", 0, &ShowOSD, 1, NULL, 0}, - - {"ConsoleType", 0, &ConsoleType, 0, NULL, 0}, - {"DirectBoot", 0, &DirectBoot, 1, NULL, 0}, - -#ifdef JIT_ENABLED - {"JIT_Enable", 0, &JIT_Enable, 0, NULL, 0}, - {"JIT_MaxBlockSize", 0, &JIT_MaxBlockSize, 32, NULL, 0}, - {"JIT_BranchOptimisations", 0, &JIT_BranchOptimisations, 1, NULL, 0}, - {"JIT_LiteralOptimisations", 0, &JIT_LiteralOptimisations, 1, NULL, 0}, - #ifdef __APPLE__ - {"JIT_FastMemory", 0, &JIT_FastMemory, 0, NULL, 0}, - #else - {"JIT_FastMemory", 0, &JIT_FastMemory, 1, NULL, 0}, - #endif -#endif - - {"ExternalBIOSEnable", 0, &ExternalBIOSEnable, 0, NULL, 0}, - - {"BIOS9Path", 1, BIOS9Path, 0, "", 1023}, - {"BIOS7Path", 1, BIOS7Path, 0, "", 1023}, - {"FirmwarePath", 1, FirmwarePath, 0, "", 1023}, - - {"DSiBIOS9Path", 1, DSiBIOS9Path, 0, "", 1023}, - {"DSiBIOS7Path", 1, DSiBIOS7Path, 0, "", 1023}, - {"DSiFirmwarePath", 1, DSiFirmwarePath, 0, "", 1023}, - {"DSiNANDPath", 1, DSiNANDPath, 0, "", 1023}, - - {"DLDIEnable", 0, &DLDIEnable, 0, NULL, 0}, - {"DLDISDPath", 1, DLDISDPath, 0, "dldi.bin", 1023}, - {"DLDISize", 0, &DLDISize, 0, NULL, 0}, - {"DLDIReadOnly", 0, &DLDIReadOnly, 0, NULL, 0}, - {"DLDIFolderSync", 0, &DLDIFolderSync, 0, NULL, 0}, - {"DLDIFolderPath", 1, DLDIFolderPath, 0, "", 1023}, - - {"DSiSDEnable", 0, &DSiSDEnable, 0, NULL, 0}, - {"DSiSDPath", 1, DSiSDPath, 0, "dsisd.bin", 1023}, - {"DSiSDSize", 0, &DSiSDSize, 0, NULL, 0}, - {"DSiSDReadOnly", 0, &DSiSDReadOnly, 0, NULL, 0}, - {"DSiSDFolderSync", 0, &DSiSDFolderSync, 0, NULL, 0}, - {"DSiSDFolderPath", 1, DSiSDFolderPath, 0, "", 1023}, - - {"RandomizeMAC", 0, &RandomizeMAC, 0, NULL, 0}, - {"FirmwareOverrideSettings", 0, &FirmwareOverrideSettings, false, NULL, 0}, - {"FirmwareUsername", 1, FirmwareUsername, 0, "melonDS", 63}, - {"FirmwareLanguage", 0, &FirmwareLanguage, 1, NULL, 0}, - {"FirmwareBirthdayMonth", 0, &FirmwareBirthdayMonth, 0, NULL, 0}, - {"FirmwareBirthdayDay", 0, &FirmwareBirthdayDay, 0, NULL, 0}, - {"FirmwareFavouriteColour", 0, &FirmwareFavouriteColour, 0, NULL, 0}, - {"FirmwareMessage", 1, FirmwareMessage, 0, "", 1023}, - - {"SockBindAnyAddr", 0, &SocketBindAnyAddr, 0, NULL, 0}, - {"LANDevice", 1, LANDevice, 0, "", 127}, - {"DirectLAN", 0, &DirectLAN, 0, NULL, 0}, - - {"SavStaRelocSRAM", 0, &SavestateRelocSRAM, 0, NULL, 0}, - - {"AudioInterp", 0, &AudioInterp, 0, NULL, 0}, - {"AudioVolume", 0, &AudioVolume, 256, NULL, 0}, - {"MicInputType", 0, &MicInputType, 1, NULL, 0}, - {"MicWavPath", 1, MicWavPath, 0, "", 1023}, - - {"LastROMFolder", 1, LastROMFolder, 0, "", 1023}, - - {"RecentROM_0", 1, RecentROMList[0], 0, "", 1023}, - {"RecentROM_1", 1, RecentROMList[1], 0, "", 1023}, - {"RecentROM_2", 1, RecentROMList[2], 0, "", 1023}, - {"RecentROM_3", 1, RecentROMList[3], 0, "", 1023}, - {"RecentROM_4", 1, RecentROMList[4], 0, "", 1023}, - {"RecentROM_5", 1, RecentROMList[5], 0, "", 1023}, - {"RecentROM_6", 1, RecentROMList[6], 0, "", 1023}, - {"RecentROM_7", 1, RecentROMList[7], 0, "", 1023}, - {"RecentROM_8", 1, RecentROMList[8], 0, "", 1023}, - {"RecentROM_9", 1, RecentROMList[9], 0, "", 1023}, - - {"EnableCheats", 0, &EnableCheats, 0, NULL, 0}, - - {"MouseHide", 0, &MouseHide, 0, NULL, 0}, - {"MouseHideSeconds", 0, &MouseHideSeconds, 5, NULL, 0}, - {"PauseLostFocus", 0, &PauseLostFocus, 0, NULL, 0}, - - {"", -1, NULL, 0, NULL, 0} -}; - -} diff --git a/src/frontend/qt_sdl/PlatformConfig.h b/src/frontend/qt_sdl/PlatformConfig.h deleted file mode 100644 index 9fe7bbb..0000000 --- a/src/frontend/qt_sdl/PlatformConfig.h +++ /dev/null @@ -1,147 +0,0 @@ -/* - Copyright 2016-2021 Arisotura - - This file is part of melonDS. - - melonDS is free software: you can redistribute it and/or modify it under - the terms of the GNU General Public License as published by the Free - Software Foundation, either version 3 of the License, or (at your option) - any later version. - - melonDS is distributed in the hope that it will be useful, but WITHOUT ANY - WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with melonDS. If not, see http://www.gnu.org/licenses/. -*/ - -#ifndef PLATFORMCONFIG_H -#define PLATFORMCONFIG_H - -#include "Config.h" - -enum -{ - HK_Lid = 0, - HK_Mic, - HK_Pause, - HK_Reset, - HK_FastForward, - HK_FastForwardToggle, - HK_FullscreenToggle, - HK_SwapScreens, - HK_SolarSensorDecrease, - HK_SolarSensorIncrease, - HK_FrameStep, - HK_MAX -}; - -namespace Config -{ - -extern int KeyMapping[12]; -extern int JoyMapping[12]; - -extern int HKKeyMapping[HK_MAX]; -extern int HKJoyMapping[HK_MAX]; - -extern int JoystickID; - -extern int WindowWidth; -extern int WindowHeight; -extern int WindowMaximized; - -extern int ScreenRotation; -extern int ScreenGap; -extern int ScreenLayout; -extern int ScreenSwap; -extern int ScreenSizing; -extern int ScreenAspectTop; -extern int ScreenAspectBot; -extern int IntegerScaling; -extern int ScreenFilter; - -extern int ScreenUseGL; -extern int ScreenVSync; -extern int ScreenVSyncInterval; - -extern int _3DRenderer; -extern int Threaded3D; - -extern int GL_ScaleFactor; -extern int GL_BetterPolygons; - -extern int LimitFPS; -extern int AudioSync; -extern int ShowOSD; - -extern int ConsoleType; -extern int DirectBoot; - -#ifdef JIT_ENABLED -extern int JIT_Enable; -extern int JIT_MaxBlockSize; -extern int JIT_BranchOptimisations; -extern int JIT_LiteralOptimisations; -extern int JIT_FastMemory; -#endif - -extern int ExternalBIOSEnable; - -extern char BIOS9Path[1024]; -extern char BIOS7Path[1024]; -extern char FirmwarePath[1024]; - -extern char DSiBIOS9Path[1024]; -extern char DSiBIOS7Path[1024]; -extern char DSiFirmwarePath[1024]; -extern char DSiNANDPath[1024]; - -extern int DLDIEnable; -extern char DLDISDPath[1024]; -extern int DLDISize; -extern int DLDIReadOnly; -extern int DLDIFolderSync; -extern char DLDIFolderPath[1024]; - -extern int DSiSDEnable; -extern char DSiSDPath[1024]; -extern int DSiSDSize; -extern int DSiSDReadOnly; -extern int DSiSDFolderSync; -extern char DSiSDFolderPath[1024]; - -extern int RandomizeMAC; -extern int FirmwareOverrideSettings; -extern char FirmwareUsername[64]; -extern int FirmwareLanguage; -extern int FirmwareBirthdayMonth; -extern int FirmwareBirthdayDay; -extern int FirmwareFavouriteColour; -extern char FirmwareMessage[1024]; - -extern int SocketBindAnyAddr; -extern char LANDevice[128]; -extern int DirectLAN; - -extern int SavestateRelocSRAM; - -extern int AudioInterp; -extern int AudioVolume; -extern int MicInputType; -extern char MicWavPath[1024]; - -extern char LastROMFolder[1024]; - -extern char RecentROMList[10][1024]; - -extern int EnableCheats; - -extern int MouseHide; -extern int MouseHideSeconds; -extern int PauseLostFocus; - -} - -#endif // PLATFORMCONFIG_H diff --git a/src/frontend/qt_sdl/ROMInfoDialog.cpp b/src/frontend/qt_sdl/ROMInfoDialog.cpp index a0e24e4..9166efe 100644 --- a/src/frontend/qt_sdl/ROMInfoDialog.cpp +++ b/src/frontend/qt_sdl/ROMInfoDialog.cpp @@ -25,7 +25,6 @@ #include "NDSCart.h" #include "Platform.h" #include "Config.h" -#include "PlatformConfig.h" QString IntToHex(u64 num) { diff --git a/src/frontend/qt_sdl/TitleManagerDialog.cpp b/src/frontend/qt_sdl/TitleManagerDialog.cpp index cf2b735..0a5e65d 100644 --- a/src/frontend/qt_sdl/TitleManagerDialog.cpp +++ b/src/frontend/qt_sdl/TitleManagerDialog.cpp @@ -23,7 +23,6 @@ #include "types.h" #include "Platform.h" #include "Config.h" -#include "PlatformConfig.h" #include "FrontendUtil.h" #include "DSi_NAND.h" diff --git a/src/frontend/qt_sdl/VideoSettingsDialog.cpp b/src/frontend/qt_sdl/VideoSettingsDialog.cpp index 875b0e4..0c3f13e 100644 --- a/src/frontend/qt_sdl/VideoSettingsDialog.cpp +++ b/src/frontend/qt_sdl/VideoSettingsDialog.cpp @@ -23,7 +23,6 @@ #include "types.h" #include "Platform.h" #include "Config.h" -#include "PlatformConfig.h" #include "VideoSettingsDialog.h" #include "ui_VideoSettingsDialog.h" diff --git a/src/frontend/qt_sdl/WifiSettingsDialog.cpp b/src/frontend/qt_sdl/WifiSettingsDialog.cpp index 061d914..9c428ba 100644 --- a/src/frontend/qt_sdl/WifiSettingsDialog.cpp +++ b/src/frontend/qt_sdl/WifiSettingsDialog.cpp @@ -22,7 +22,6 @@ #include "types.h" #include "Platform.h" #include "Config.h" -#include "PlatformConfig.h" #include "LAN_Socket.h" #include "LAN_PCap.h" diff --git a/src/frontend/qt_sdl/main.cpp b/src/frontend/qt_sdl/main.cpp index fb1caea..99c32e0 100644 --- a/src/frontend/qt_sdl/main.cpp +++ b/src/frontend/qt_sdl/main.cpp @@ -75,7 +75,6 @@ #include "Wifi.h" #include "Platform.h" #include "Config.h" -#include "PlatformConfig.h" #include "Savestate.h" -- cgit v1.2.3