#pragma once //TODO: move this to the gui module struct WindowInfo { std::pair size; std::pair position; //the (-1,-1) values are currently used because of wxWidgets using it gdicmn.h as default size and default postion WindowInfo(const std::pair _size = { -1, -1 }, const std::pair _position = { -1, -1 }) : size(_size) , position(_position) { } }; class Ini { public: virtual ~Ini(); protected: void* m_config; Ini(); void Save(const std::string& section, const std::string& key, int value); void Save(const std::string& section, const std::string& key, bool value); void Save(const std::string& section, const std::string& key, std::pair value); void Save(const std::string& section, const std::string& key, const std::string& value); void Save(const std::string& section, const std::string& key, WindowInfo value); int Load(const std::string& section, const std::string& key, const int def_value); bool Load(const std::string& section, const std::string& key, const bool def_value); std::pair Load(const std::string& section, const std::string& key, const std::pair def_value); std::string Load(const std::string& section, const std::string& key, const std::string& def_value); WindowInfo Load(const std::string& section, const std::string& key, const WindowInfo& def_value); }; template struct IniEntry : public Ini { T m_value; std::string m_key; std::string m_section; IniEntry() : Ini() { } void Init(const std::string& key, const std::string& section) { m_key = key; m_section = section; } void SetValue(const T& value) { m_value = value; } T GetValue() const { return m_value; } T LoadValue(const T& defvalue) { return Ini::Load(m_section, m_key, defvalue); } void SaveValue(const T& value) { Ini::Save(m_section, m_key, value); } void Save() { Ini::Save(m_section, m_key, m_value); } T Load(const T& defvalue) { return (m_value = Ini::Load(m_section, m_key, defvalue)); } }; class Inis { private: const std::string DefPath; public: // Core IniEntry CPUDecoderMode; IniEntry SPUDecoderMode; IniEntry HookStFunc; IniEntry LoadLibLv2; // Graphics IniEntry GSRenderMode; IniEntry GSResolution; IniEntry GSAspectRatio; IniEntry GSFrameLimit; IniEntry GSLogPrograms; IniEntry GSDumpColorBuffers; IniEntry GSDumpDepthBuffer; IniEntry GSReadColorBuffer; IniEntry GSVSyncEnable; IniEntry GS3DTV; // Audio IniEntry AudioOutMode; IniEntry AudioDumpToFile; IniEntry AudioConvertToU16; // Camera IniEntry Camera; IniEntry CameraType; // Input/Output IniEntry PadHandlerMode; IniEntry KeyboardHandlerMode; IniEntry MouseHandlerMode; IniEntry PadHandlerLStickLeft; IniEntry PadHandlerLStickDown; IniEntry PadHandlerLStickRight; IniEntry PadHandlerLStickUp; IniEntry PadHandlerLeft; IniEntry PadHandlerDown; IniEntry PadHandlerRight; IniEntry PadHandlerUp; IniEntry PadHandlerStart; IniEntry PadHandlerR3; IniEntry PadHandlerL3; IniEntry PadHandlerSelect; IniEntry PadHandlerSquare; IniEntry PadHandlerCross; IniEntry PadHandlerCircle; IniEntry PadHandlerTriangle; IniEntry PadHandlerR1; IniEntry PadHandlerL1; IniEntry PadHandlerR2; IniEntry PadHandlerL2; IniEntry PadHandlerRStickLeft; IniEntry PadHandlerRStickDown; IniEntry PadHandlerRStickRight; IniEntry PadHandlerRStickUp; // HLE/Miscs IniEntry HLELogLvl; IniEntry NETStatus; IniEntry NETInterface; IniEntry HLELogging; IniEntry RSXLogging; IniEntry HLESaveTTY; IniEntry HLEExitOnStop; IniEntry HLEAlwaysStart; // Auto Pause IniEntry DBGAutoPauseSystemCall; IniEntry DBGAutoPauseFunctionCall; // Custom EmulationDir IniEntry SysEmulationDirPath; IniEntry SysEmulationDirPathEnable; // Language IniEntry SysLanguage; public: Inis() : DefPath("EmuSettings") { std::string path; path = DefPath; // Core CPUDecoderMode.Init("CORE_DecoderMode", path); SPUDecoderMode.Init("CORE_SPUDecoderMode", path); HookStFunc.Init("CORE_HookStFunc", path); LoadLibLv2.Init("CORE_LoadLibLv2", path); // Graphics GSRenderMode.Init("GS_RenderMode", path); GSResolution.Init("GS_Resolution", path); GSAspectRatio.Init("GS_AspectRatio", path); GSFrameLimit.Init("GS_FrameLimit", path); GSLogPrograms.Init("GS_LogPrograms", path); GSDumpColorBuffers.Init("GS_DumpColorBuffers", path); GSDumpDepthBuffer.Init("GS_DumpDepthBuffer", path); GSReadColorBuffer.Init("GS_GSReadColorBuffer", path); GSVSyncEnable.Init("GS_VSyncEnable", path); GS3DTV.Init("GS_3DTV", path); // Audio AudioOutMode.Init("Audio_AudioOutMode", path); AudioDumpToFile.Init("Audio_AudioDumpToFile", path); AudioConvertToU16.Init("Audio_AudioConvertToU16", path); // Camera Camera.Init("Camera", path); CameraType.Init("Camera_Type", path); // Input/Output PadHandlerMode.Init("IO_PadHandlerMode", path); KeyboardHandlerMode.Init("IO_KeyboardHandlerMode", path); MouseHandlerMode.Init("IO_MouseHandlerMode", path); PadHandlerLStickLeft.Init("ControlSetings_PadHandlerLStickLeft", path); PadHandlerLStickDown.Init("ControlSetings_PadHandlerLStickDown", path); PadHandlerLStickRight.Init("ControlSetings_PadHandlerLStickRight", path); PadHandlerLStickUp.Init("ControlSetings_PadHandlerLStickUp", path); PadHandlerLeft.Init("ControlSetings_PadHandlerLeft", path); PadHandlerDown.Init("ControlSetings_PadHandlerDown", path); PadHandlerRight.Init("ControlSetings_PadHandlerRight", path); PadHandlerUp.Init("ControlSetings_PadHandlerUp", path); PadHandlerStart.Init("ControlSetings_PadHandlerStart", path); PadHandlerR3.Init("ControlSetings_PadHandlerR3", path); PadHandlerL3.Init("ControlSetings_PadHandlerL3", path); PadHandlerSelect.Init("ControlSetings_PadHandlerSelect", path); PadHandlerSquare.Init("ControlSetings_PadHandlerSquare", path); PadHandlerCross.Init("ControlSetings_PadHandlerCross", path); PadHandlerCircle.Init("ControlSetings_PadHandlerCircle", path); PadHandlerTriangle.Init("ControlSetings_PadHandlerTriangle", path); PadHandlerR1.Init("ControlSetings_PadHandlerR1", path); PadHandlerL1.Init("ControlSetings_PadHandlerL1", path); PadHandlerR2.Init("ControlSetings_PadHandlerR2", path); PadHandlerL2.Init("ControlSetings_PadHandlerL2", path); PadHandlerRStickLeft.Init("ControlSetings_PadHandlerRStickLeft", path); PadHandlerRStickDown.Init("ControlSetings_PadHandlerRStickDown", path); PadHandlerRStickRight.Init("ControlSetings_PadHandlerRStickRight", path); PadHandlerRStickUp.Init("ControlSetings_PadHandlerRStickUp", path); // Miscellaneous HLELogging.Init("HLE_HLELogging", path); RSXLogging.Init("RSX_Logging", path); NETStatus.Init("NET_Status", path); NETInterface.Init("NET_Interface", path); HLESaveTTY.Init("HLE_HLESaveTTY", path); HLEExitOnStop.Init("HLE_HLEExitOnStop", path); HLELogLvl.Init("HLE_HLELogLvl", path); HLEAlwaysStart.Init("HLE_HLEAlwaysStart", path); // Auto Pause DBGAutoPauseFunctionCall.Init("DBG_AutoPauseFunctionCall", path); DBGAutoPauseSystemCall.Init("DBG_AutoPauseSystemCall", path); // Customed EmulationDir SysEmulationDirPath.Init("System_EmulationDir", path); SysEmulationDirPathEnable.Init("System_EmulationDirEnable", path); // Language SysLanguage.Init("Sytem_SysLanguage", path); } void Load() { // Core CPUDecoderMode.Load(0); SPUDecoderMode.Load(0); HookStFunc.Load(false); LoadLibLv2.Load(false); // Graphics GSRenderMode.Load(1); GSResolution.Load(4); GSAspectRatio.Load(2); GSFrameLimit.Load(0); GSLogPrograms.Load(false); GSDumpColorBuffers.Load(false); GSDumpDepthBuffer.Load(false); GSReadColorBuffer.Load(false); GSVSyncEnable.Load(false); GS3DTV.Load(false); // Audio AudioOutMode.Load(1); AudioDumpToFile.Load(false); AudioConvertToU16.Load(false); // Camera Camera.Load(1); CameraType.Load(2); // Input/Ouput PadHandlerMode.Load(1); KeyboardHandlerMode.Load(0); MouseHandlerMode.Load(0); PadHandlerLStickLeft.Load(314); //WXK_LEFT PadHandlerLStickDown.Load(317); //WXK_DOWN PadHandlerLStickRight.Load(316); //WXK_RIGHT PadHandlerLStickUp.Load(315); //WXK_UP PadHandlerLeft.Load(static_cast('A')); PadHandlerDown.Load(static_cast('S')); PadHandlerRight.Load(static_cast('D')); PadHandlerUp.Load(static_cast('W')); PadHandlerStart.Load(13); //WXK_RETURN PadHandlerR3.Load(static_cast('C')); PadHandlerL3.Load(static_cast('Z')); PadHandlerSelect.Load(32); //WXK_SPACE PadHandlerSquare.Load(static_cast('J')); PadHandlerCross.Load(static_cast('K')); PadHandlerCircle.Load(static_cast('L')); PadHandlerTriangle.Load(static_cast('I')); PadHandlerR1.Load(static_cast('3')); PadHandlerL1.Load(static_cast('1')); PadHandlerR2.Load(static_cast('E')); PadHandlerL2.Load(static_cast('Q')); PadHandlerRStickLeft.Load(313); //WXK_HOME PadHandlerRStickDown.Load(367); //WXK_PAGEDOWN PadHandlerRStickRight.Load(312); //WXK_END PadHandlerRStickUp.Load(366); //WXK_PAGEUP // Miscellaneous HLELogging.Load(false); RSXLogging.Load(false); NETStatus.Load(0); NETInterface.Load(0); HLESaveTTY.Load(false); HLEExitOnStop.Load(false); HLELogLvl.Load(3); HLEAlwaysStart.Load(true); //Auto Pause DBGAutoPauseFunctionCall.Load(false); DBGAutoPauseSystemCall.Load(false); // Language SysLanguage.Load(1); // Customed EmulationDir SysEmulationDirPath.Load(""); SysEmulationDirPathEnable.Load(false); } void Save() { // Core CPUDecoderMode.Save(); SPUDecoderMode.Save(); HookStFunc.Save(); LoadLibLv2.Save(); // Graphics GSRenderMode.Save(); GSResolution.Save(); GSAspectRatio.Save(); GSFrameLimit.Save(); GSLogPrograms.Save(); GSDumpColorBuffers.Save(); GSDumpDepthBuffer.Save(); GSReadColorBuffer.Save(); GSVSyncEnable.Save(); GS3DTV.Save(); // Audio AudioOutMode.Save(); AudioDumpToFile.Save(); AudioConvertToU16.Save(); // Camera Camera.Save(); CameraType.Save(); // Input/Output PadHandlerMode.Save(); KeyboardHandlerMode.Save(); MouseHandlerMode.Save(); PadHandlerLStickLeft.Save(); PadHandlerLStickDown.Save(); PadHandlerLStickRight.Save(); PadHandlerLStickUp.Save(); PadHandlerLeft.Save(); PadHandlerDown.Save(); PadHandlerRight.Save(); PadHandlerUp.Save(); PadHandlerStart.Save(); PadHandlerR3.Save(); PadHandlerL3.Save(); PadHandlerSelect.Save(); PadHandlerSquare.Save(); PadHandlerCross.Save(); PadHandlerCircle.Save(); PadHandlerTriangle.Save(); PadHandlerR1.Save(); PadHandlerL1.Save(); PadHandlerR2.Save(); PadHandlerL2.Save(); PadHandlerRStickLeft.Save(); PadHandlerRStickDown.Save(); PadHandlerRStickRight.Save(); PadHandlerRStickUp.Save(); // Miscellaneous HLELogging.Save(); RSXLogging.Save(); NETStatus.Save(); NETInterface.Save(); HLESaveTTY.Save(); HLEExitOnStop.Save(); HLELogLvl.Save(); HLEAlwaysStart.Save(); //Auto Pause DBGAutoPauseFunctionCall.Save(); DBGAutoPauseSystemCall.Save(); // Language SysLanguage.Save(); // Customed EmulationDir SysEmulationDirPath.Save(); SysEmulationDirPathEnable.Save(); } }; extern Inis Ini;