|
|
@ -20,7 +20,7 @@
|
|
|
|
// * 59 Temple Place - Suite 330, Bostom, MA 02111-1307, USA.
|
|
|
|
// * 59 Temple Place - Suite 330, Bostom, MA 02111-1307, USA.
|
|
|
|
// *
|
|
|
|
// *
|
|
|
|
// * (c) 2018 wutno (#/g/punk - Rizon)
|
|
|
|
// * (c) 2018 wutno (#/g/punk - Rizon)
|
|
|
|
// * (c) 2018 RadWolfie
|
|
|
|
// * (c) 2018 RadWolfie
|
|
|
|
// * (c) 2019 ergo720
|
|
|
|
// * (c) 2019 ergo720
|
|
|
|
// *
|
|
|
|
// *
|
|
|
|
// * All rights reserved
|
|
|
|
// * All rights reserved
|
|
|
@ -30,7 +30,7 @@
|
|
|
|
#include "Settings.hpp"
|
|
|
|
#include "Settings.hpp"
|
|
|
|
#include "core\kernel\support\Emu.h"
|
|
|
|
#include "core\kernel\support\Emu.h"
|
|
|
|
#include "EmuShared.h"
|
|
|
|
#include "EmuShared.h"
|
|
|
|
#include <filesystem>
|
|
|
|
#include <filesystem>
|
|
|
|
#include "common\input\InputManager.h"
|
|
|
|
#include "common\input\InputManager.h"
|
|
|
|
#include "common\input\layout_xbox_controller.h"
|
|
|
|
#include "common\input\layout_xbox_controller.h"
|
|
|
|
|
|
|
|
|
|
|
@ -43,21 +43,21 @@ static_assert(false, "Please implement support for cross-platform's user profile
|
|
|
|
#include <QDir> // for create directory
|
|
|
|
#include <QDir> // for create directory
|
|
|
|
#include <QFile> // for check file existance
|
|
|
|
#include <QFile> // for check file existance
|
|
|
|
#include <QStandardPaths> // for cross-platform's user profile support
|
|
|
|
#include <QStandardPaths> // for cross-platform's user profile support
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
std::string g_exec_filepath;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Individual library version
|
|
|
|
|
|
|
|
uint16_t g_LibVersion_D3D8 = 0;
|
|
|
|
|
|
|
|
uint16_t g_LibVersion_DSOUND = 0;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// NOTE: Update settings_version when add/edit/delete setting's structure.
|
|
|
|
std::string g_exec_filepath;
|
|
|
|
///////////////////////////
|
|
|
|
|
|
|
|
// * History:
|
|
|
|
// Individual library version
|
|
|
|
// * 2: (RadWolfie), initial version
|
|
|
|
uint16_t g_LibVersion_D3D8 = 0;
|
|
|
|
// * 3: (ergo720), added logging settings
|
|
|
|
uint16_t g_LibVersion_DSOUND = 0;
|
|
|
|
// * 4: (LukeUsher), added network settings
|
|
|
|
|
|
|
|
// * 5: (ergo720), added new input gui settings and revision to core
|
|
|
|
// NOTE: Update settings_version when add/edit/delete setting's structure.
|
|
|
|
|
|
|
|
///////////////////////////
|
|
|
|
|
|
|
|
// * History:
|
|
|
|
|
|
|
|
// * 2: (RadWolfie), initial version
|
|
|
|
|
|
|
|
// * 3: (ergo720), added logging settings
|
|
|
|
|
|
|
|
// * 4: (LukeUsher), added network settings
|
|
|
|
|
|
|
|
// * 5: (ergo720), added new input gui settings and revision to core
|
|
|
|
///////////////////////////
|
|
|
|
///////////////////////////
|
|
|
|
const unsigned int settings_version = 5;
|
|
|
|
const unsigned int settings_version = 5;
|
|
|
|
|
|
|
|
|
|
|
@ -81,13 +81,13 @@ static struct {
|
|
|
|
} sect_gui_keys;
|
|
|
|
} sect_gui_keys;
|
|
|
|
|
|
|
|
|
|
|
|
static const char* section_core = "core";
|
|
|
|
static const char* section_core = "core";
|
|
|
|
static struct {
|
|
|
|
static struct {
|
|
|
|
const char* Revision = "Revision";
|
|
|
|
const char* Revision = "Revision";
|
|
|
|
const char* FlagsLLE = "FlagsLLE";
|
|
|
|
const char* FlagsLLE = "FlagsLLE";
|
|
|
|
const char* KrnlDebugMode = "KrnlDebugMode";
|
|
|
|
const char* KrnlDebugMode = "KrnlDebugMode";
|
|
|
|
const char* KrnlDebugLogFile = "KrnlDebugLogFile";
|
|
|
|
const char* KrnlDebugLogFile = "KrnlDebugLogFile";
|
|
|
|
const char* AllowAdminPrivilege = "AllowAdminPrivilege";
|
|
|
|
const char* AllowAdminPrivilege = "AllowAdminPrivilege";
|
|
|
|
const char* LoggedModules = "LoggedModules";
|
|
|
|
const char* LoggedModules = "LoggedModules";
|
|
|
|
const char* LogLevel = "LogLevel";
|
|
|
|
const char* LogLevel = "LogLevel";
|
|
|
|
} sect_core_keys;
|
|
|
|
} sect_core_keys;
|
|
|
|
|
|
|
|
|
|
|
@ -98,7 +98,7 @@ static struct {
|
|
|
|
const char* Direct3DDevice = "Direct3DDevice";
|
|
|
|
const char* Direct3DDevice = "Direct3DDevice";
|
|
|
|
const char* VSync = "VSync";
|
|
|
|
const char* VSync = "VSync";
|
|
|
|
const char* FullScreen = "FullScreen";
|
|
|
|
const char* FullScreen = "FullScreen";
|
|
|
|
const char* HardwareYUV = "HardwareYUV";
|
|
|
|
const char* HardwareYUV = "HardwareYUV";
|
|
|
|
const char* RenderResolution = "RenderResolution";
|
|
|
|
const char* RenderResolution = "RenderResolution";
|
|
|
|
} sect_video_keys;
|
|
|
|
} sect_video_keys;
|
|
|
|
|
|
|
|
|
|
|
@ -110,8 +110,8 @@ static struct {
|
|
|
|
const char* codec_xadpcm = "XADPCM";
|
|
|
|
const char* codec_xadpcm = "XADPCM";
|
|
|
|
const char* codec_unknown = "UnknownCodec";
|
|
|
|
const char* codec_unknown = "UnknownCodec";
|
|
|
|
const char* mute_on_unfocus = "MuteOnUnfocus";
|
|
|
|
const char* mute_on_unfocus = "MuteOnUnfocus";
|
|
|
|
} sect_audio_keys;
|
|
|
|
} sect_audio_keys;
|
|
|
|
|
|
|
|
|
|
|
|
static const char* section_network = "network";
|
|
|
|
static const char* section_network = "network";
|
|
|
|
static struct {
|
|
|
|
static struct {
|
|
|
|
const char* adapter_name = "adapter_name";
|
|
|
|
const char* adapter_name = "adapter_name";
|
|
|
@ -119,20 +119,20 @@ static struct {
|
|
|
|
|
|
|
|
|
|
|
|
static const char* section_controller_dinput = "controller-dinput";
|
|
|
|
static const char* section_controller_dinput = "controller-dinput";
|
|
|
|
static const char* section_controller_port = "controller-port";
|
|
|
|
static const char* section_controller_port = "controller-port";
|
|
|
|
|
|
|
|
|
|
|
|
static const char* section_input = "input-port-";
|
|
|
|
static const char* section_input = "input-port-";
|
|
|
|
static struct {
|
|
|
|
static struct {
|
|
|
|
const char* type = "Type";
|
|
|
|
const char* type = "Type";
|
|
|
|
const char* device = "DeviceName";
|
|
|
|
const char* device = "DeviceName";
|
|
|
|
const char* config = "ProfileName";
|
|
|
|
const char* config = "ProfileName";
|
|
|
|
} sect_input;
|
|
|
|
} sect_input;
|
|
|
|
|
|
|
|
|
|
|
|
static const char* section_input_profiles = "input-profile-";
|
|
|
|
static const char* section_input_profiles = "input-profile-";
|
|
|
|
static struct {
|
|
|
|
static struct {
|
|
|
|
const char* type = "Type";
|
|
|
|
const char* type = "Type";
|
|
|
|
const char* config = "ProfileName";
|
|
|
|
const char* config = "ProfileName";
|
|
|
|
const char* device = "DeviceName";
|
|
|
|
const char* device = "DeviceName";
|
|
|
|
const char* control = "%s";
|
|
|
|
const char* control = "%s";
|
|
|
|
} sect_input_profiles;
|
|
|
|
} sect_input_profiles;
|
|
|
|
|
|
|
|
|
|
|
|
static const char* section_hack = "hack";
|
|
|
|
static const char* section_hack = "hack";
|
|
|
@ -143,7 +143,7 @@ static struct {
|
|
|
|
} sect_hack_keys;
|
|
|
|
} sect_hack_keys;
|
|
|
|
|
|
|
|
|
|
|
|
std::string GenerateExecDirectoryStr()
|
|
|
|
std::string GenerateExecDirectoryStr()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
return g_exec_filepath.substr(0, g_exec_filepath.find_last_of("\\/"));
|
|
|
|
return g_exec_filepath.substr(0, g_exec_filepath.find_last_of("\\/"));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -167,31 +167,31 @@ std::string GenerateUserProfileDirectoryStr()
|
|
|
|
genDirectory.append(szSettings_cxbx_reloaded_directory);
|
|
|
|
genDirectory.append(szSettings_cxbx_reloaded_directory);
|
|
|
|
|
|
|
|
|
|
|
|
return genDirectory;
|
|
|
|
return genDirectory;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
std::string TrimQuoteFromString(const char* data)
|
|
|
|
std::string TrimQuoteFromString(const char* data)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
// Safeguard before continue on.
|
|
|
|
// Safeguard before continue on.
|
|
|
|
if (data == nullptr) {
|
|
|
|
if (data == nullptr) {
|
|
|
|
return "";
|
|
|
|
return "";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
std::string trim_str = data;
|
|
|
|
std::string trim_str = data;
|
|
|
|
size_t len = trim_str.size();
|
|
|
|
size_t len = trim_str.size();
|
|
|
|
if (len > 0) {
|
|
|
|
if (len > 0) {
|
|
|
|
// New method, in order to support spaces inside DeviceName value.
|
|
|
|
// New method, in order to support spaces inside DeviceName value.
|
|
|
|
if (data[0] == '"') {
|
|
|
|
if (data[0] == '"') {
|
|
|
|
len--; // Let's decrement since it also can act as offset too.
|
|
|
|
len--; // Let's decrement since it also can act as offset too.
|
|
|
|
if (trim_str.at(len) == '"') {
|
|
|
|
if (trim_str.at(len) == '"') {
|
|
|
|
len--;
|
|
|
|
len--;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
trim_str = trim_str.substr(1, len);
|
|
|
|
trim_str = trim_str.substr(1, len);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// Old method, don't do anything special.
|
|
|
|
// Old method, don't do anything special.
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return trim_str;
|
|
|
|
return trim_str;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#define AppendQuoteToString(d) "\"" + std::string(d) + "\""
|
|
|
|
#define AppendQuoteToString(d) "\"" + std::string(d) + "\""
|
|
|
|
|
|
|
|
|
|
|
|
bool Settings::Init()
|
|
|
|
bool Settings::Init()
|
|
|
@ -212,11 +212,11 @@ bool Settings::Init()
|
|
|
|
int iRet = MessageBox(nullptr, szSettings_save_user_option_message, "Cxbx-Reloaded", MB_YESNOCANCEL | MB_ICONQUESTION);
|
|
|
|
int iRet = MessageBox(nullptr, szSettings_save_user_option_message, "Cxbx-Reloaded", MB_YESNOCANCEL | MB_ICONQUESTION);
|
|
|
|
|
|
|
|
|
|
|
|
if (iRet == IDYES) {
|
|
|
|
if (iRet == IDYES) {
|
|
|
|
saveFile = GenerateExecDirectoryStr();
|
|
|
|
saveFile = GenerateExecDirectoryStr();
|
|
|
|
m_gui.DataStorageToggle = CXBX_DATA_EXECDIR;
|
|
|
|
m_gui.DataStorageToggle = CXBX_DATA_EXECDIR;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (iRet == IDNO){
|
|
|
|
else if (iRet == IDNO){
|
|
|
|
saveFile = GenerateUserProfileDirectoryStr();
|
|
|
|
saveFile = GenerateUserProfileDirectoryStr();
|
|
|
|
m_gui.DataStorageToggle = CXBX_DATA_APPDATA;
|
|
|
|
m_gui.DataStorageToggle = CXBX_DATA_APPDATA;
|
|
|
|
if (saveFile.size() == 0) {
|
|
|
|
if (saveFile.size() == 0) {
|
|
|
|
return false;
|
|
|
|
return false;
|
|
|
@ -240,7 +240,7 @@ bool Settings::Init()
|
|
|
|
saveFile.append(szSettings_settings_file);
|
|
|
|
saveFile.append(szSettings_settings_file);
|
|
|
|
|
|
|
|
|
|
|
|
// Call LoadConfig, this will load the config, applying defaults for any missing fields
|
|
|
|
// Call LoadConfig, this will load the config, applying defaults for any missing fields
|
|
|
|
bRet = LoadConfig();
|
|
|
|
bRet = LoadConfig();
|
|
|
|
|
|
|
|
|
|
|
|
if (!bRet) {
|
|
|
|
if (!bRet) {
|
|
|
|
MessageBox(nullptr, szSettings_setup_error, "Cxbx-Reloaded", MB_OK);
|
|
|
|
MessageBox(nullptr, szSettings_setup_error, "Cxbx-Reloaded", MB_OK);
|
|
|
@ -298,7 +298,7 @@ bool Settings::LoadConfig()
|
|
|
|
int iStatus;
|
|
|
|
int iStatus;
|
|
|
|
std::list<CSimpleIniA::Entry> si_list;
|
|
|
|
std::list<CSimpleIniA::Entry> si_list;
|
|
|
|
std::list<CSimpleIniA::Entry>::iterator si_list_iterator;
|
|
|
|
std::list<CSimpleIniA::Entry>::iterator si_list_iterator;
|
|
|
|
std::string trim_str;
|
|
|
|
std::string trim_str;
|
|
|
|
|
|
|
|
|
|
|
|
// ==== GUI Begin ===========
|
|
|
|
// ==== GUI Begin ===========
|
|
|
|
|
|
|
|
|
|
|
@ -350,7 +350,7 @@ bool Settings::LoadConfig()
|
|
|
|
// ==== GUI End =============
|
|
|
|
// ==== GUI End =============
|
|
|
|
|
|
|
|
|
|
|
|
// ==== Core Begin ==========
|
|
|
|
// ==== Core Begin ==========
|
|
|
|
|
|
|
|
|
|
|
|
m_core.Revision = m_si.GetLongValue(section_core, sect_core_keys.Revision, 4);
|
|
|
|
m_core.Revision = m_si.GetLongValue(section_core, sect_core_keys.Revision, 4);
|
|
|
|
m_core.FlagsLLE = m_si.GetLongValue(section_core, sect_core_keys.FlagsLLE, /*Default=*/LLE_NONE);
|
|
|
|
m_core.FlagsLLE = m_si.GetLongValue(section_core, sect_core_keys.FlagsLLE, /*Default=*/LLE_NONE);
|
|
|
|
m_core.KrnlDebugMode = (DebugMode)m_si.GetLongValue(section_core, sect_core_keys.KrnlDebugMode, /*Default=*/DM_NONE);
|
|
|
|
m_core.KrnlDebugMode = (DebugMode)m_si.GetLongValue(section_core, sect_core_keys.KrnlDebugMode, /*Default=*/DM_NONE);
|
|
|
@ -363,27 +363,27 @@ bool Settings::LoadConfig()
|
|
|
|
std::strncpy(m_core.szKrnlDebug, si_data, MAX_PATH);
|
|
|
|
std::strncpy(m_core.szKrnlDebug, si_data, MAX_PATH);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
m_core.allowAdminPrivilege = m_si.GetBoolValue(section_core, sect_core_keys.AllowAdminPrivilege, /*Default=*/false);
|
|
|
|
m_core.allowAdminPrivilege = m_si.GetBoolValue(section_core, sect_core_keys.AllowAdminPrivilege, /*Default=*/false);
|
|
|
|
|
|
|
|
|
|
|
|
m_core.LogLevel = m_si.GetLongValue(section_core, sect_core_keys.LogLevel, 1);
|
|
|
|
m_core.LogLevel = m_si.GetLongValue(section_core, sect_core_keys.LogLevel, 1);
|
|
|
|
si_list.clear();
|
|
|
|
si_list.clear();
|
|
|
|
index = 0;
|
|
|
|
index = 0;
|
|
|
|
list_max = std::size(m_core.LoggedModules);
|
|
|
|
list_max = std::size(m_core.LoggedModules);
|
|
|
|
bRet = m_si.GetAllValues(section_core, sect_core_keys.LoggedModules, si_list);
|
|
|
|
bRet = m_si.GetAllValues(section_core, sect_core_keys.LoggedModules, si_list);
|
|
|
|
if (bRet) {
|
|
|
|
if (bRet) {
|
|
|
|
si_list_iterator = si_list.begin();
|
|
|
|
si_list_iterator = si_list.begin();
|
|
|
|
for (si_list_iterator; si_list_iterator != si_list.end(); si_list_iterator++) {
|
|
|
|
for (si_list_iterator; si_list_iterator != si_list.end(); si_list_iterator++) {
|
|
|
|
// Exit loop when the list has reached the limit.
|
|
|
|
// Exit loop when the list has reached the limit.
|
|
|
|
if (index == list_max) {
|
|
|
|
if (index == list_max) {
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (std::strncmp(si_list_iterator->pItem, "0x", 2) == 0) {
|
|
|
|
if (std::strncmp(si_list_iterator->pItem, "0x", 2) == 0) {
|
|
|
|
si_list_iterator->pItem += 2;
|
|
|
|
si_list_iterator->pItem += 2;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
m_core.LoggedModules[index] = std::strtoul(si_list_iterator->pItem, nullptr, 16);
|
|
|
|
m_core.LoggedModules[index] = std::strtoul(si_list_iterator->pItem, nullptr, 16);
|
|
|
|
index++;
|
|
|
|
index++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
while (index < list_max) {
|
|
|
|
while (index < list_max) {
|
|
|
|
m_core.LoggedModules[index] = 0;
|
|
|
|
m_core.LoggedModules[index] = 0;
|
|
|
|
index++;
|
|
|
|
index++;
|
|
|
@ -415,7 +415,7 @@ bool Settings::LoadConfig()
|
|
|
|
m_video.direct3DDevice = m_si.GetLongValue(section_video, sect_video_keys.Direct3DDevice, /*Default=*/0);
|
|
|
|
m_video.direct3DDevice = m_si.GetLongValue(section_video, sect_video_keys.Direct3DDevice, /*Default=*/0);
|
|
|
|
m_video.bVSync = m_si.GetBoolValue(section_video, sect_video_keys.VSync, /*Default=*/false);
|
|
|
|
m_video.bVSync = m_si.GetBoolValue(section_video, sect_video_keys.VSync, /*Default=*/false);
|
|
|
|
m_video.bFullScreen = m_si.GetBoolValue(section_video, sect_video_keys.FullScreen, /*Default=*/false);
|
|
|
|
m_video.bFullScreen = m_si.GetBoolValue(section_video, sect_video_keys.FullScreen, /*Default=*/false);
|
|
|
|
m_video.bHardwareYUV = m_si.GetBoolValue(section_video, sect_video_keys.HardwareYUV, /*Default=*/false);
|
|
|
|
m_video.bHardwareYUV = m_si.GetBoolValue(section_video, sect_video_keys.HardwareYUV, /*Default=*/false);
|
|
|
|
m_video.renderScaleFactor = m_si.GetLongValue(section_video, sect_video_keys.RenderResolution, /*Default=*/1);
|
|
|
|
m_video.renderScaleFactor = m_si.GetLongValue(section_video, sect_video_keys.RenderResolution, /*Default=*/1);
|
|
|
|
|
|
|
|
|
|
|
|
// ==== Video End ===========
|
|
|
|
// ==== Video End ===========
|
|
|
@ -442,72 +442,80 @@ bool Settings::LoadConfig()
|
|
|
|
|
|
|
|
|
|
|
|
m_audio.codec_pcm = m_si.GetBoolValue(section_audio, sect_audio_keys.codec_pcm, /*Default=*/true, nullptr);
|
|
|
|
m_audio.codec_pcm = m_si.GetBoolValue(section_audio, sect_audio_keys.codec_pcm, /*Default=*/true, nullptr);
|
|
|
|
m_audio.codec_xadpcm = m_si.GetBoolValue(section_audio, sect_audio_keys.codec_xadpcm, /*Default=*/true, nullptr);
|
|
|
|
m_audio.codec_xadpcm = m_si.GetBoolValue(section_audio, sect_audio_keys.codec_xadpcm, /*Default=*/true, nullptr);
|
|
|
|
m_audio.codec_unknown = m_si.GetBoolValue(section_audio, sect_audio_keys.codec_unknown, /*Default=*/true, nullptr);
|
|
|
|
m_audio.codec_unknown = m_si.GetBoolValue(section_audio, sect_audio_keys.codec_unknown, /*Default=*/true, nullptr);
|
|
|
|
|
|
|
|
|
|
|
|
m_audio.mute_on_unfocus = m_si.GetBoolValue(section_audio, sect_audio_keys.mute_on_unfocus, /*Default=*/true, nullptr);
|
|
|
|
m_audio.mute_on_unfocus = m_si.GetBoolValue(section_audio, sect_audio_keys.mute_on_unfocus, /*Default=*/true, nullptr);
|
|
|
|
|
|
|
|
|
|
|
|
// ==== Audio End ===========
|
|
|
|
// ==== Audio End ===========
|
|
|
|
|
|
|
|
|
|
|
|
// ==== Network Begin =======
|
|
|
|
// ==== Network Begin =======
|
|
|
|
|
|
|
|
|
|
|
|
si_data = m_si.GetValue(section_network, sect_network_keys.adapter_name, /*Default=*/nullptr);
|
|
|
|
si_data = m_si.GetValue(section_network, sect_network_keys.adapter_name, /*Default=*/nullptr);
|
|
|
|
// Fallback to null string if value is empty or contains a bigger string.
|
|
|
|
// Fallback to null string if value is empty or contains a bigger string.
|
|
|
|
if (si_data == nullptr || std::strlen(si_data) >= std::size(m_network.adapter_name)) {
|
|
|
|
if (si_data == nullptr || std::strlen(si_data) >= std::size(m_network.adapter_name)) {
|
|
|
|
m_network.adapter_name[0] = '\0';
|
|
|
|
m_network.adapter_name[0] = '\0';
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
std::strncpy(m_network.adapter_name, si_data, std::size(m_network.adapter_name));
|
|
|
|
std::strncpy(m_network.adapter_name, si_data, std::size(m_network.adapter_name));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// ==== Network End =========
|
|
|
|
// ==== Network End =========
|
|
|
|
|
|
|
|
|
|
|
|
// ==== Input Begin ====
|
|
|
|
// ==== Input Begin ====
|
|
|
|
|
|
|
|
|
|
|
|
for (int port_num = 0; port_num < 4; port_num++) {
|
|
|
|
for (int port_num = 0; port_num < 4; port_num++) {
|
|
|
|
std::string current_section = std::string(section_input) + std::to_string(port_num);
|
|
|
|
std::string current_section = std::string(section_input) + std::to_string(port_num);
|
|
|
|
int ret = m_si.GetLongValue(current_section.c_str(), sect_input.type, -2);
|
|
|
|
int ret = m_si.GetLongValue(current_section.c_str(), sect_input.type, -2);
|
|
|
|
if (ret == -2) {
|
|
|
|
if (ret == -2) {
|
|
|
|
m_input[port_num].Type = to_underlying(XBOX_INPUT_DEVICE::DEVICE_INVALID);
|
|
|
|
m_input[port_num].Type = to_underlying(XBOX_INPUT_DEVICE::DEVICE_INVALID);
|
|
|
|
continue;
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
m_input[port_num].Type = ret;
|
|
|
|
m_input[port_num].Type = ret;
|
|
|
|
m_input[port_num].DeviceName = m_si.GetValue(current_section.c_str(), sect_input.device);
|
|
|
|
m_input[port_num].DeviceName = m_si.GetValue(current_section.c_str(), sect_input.device);
|
|
|
|
m_input[port_num].ProfileName = TrimQuoteFromString(m_si.GetValue(current_section.c_str(), sect_input.config));
|
|
|
|
m_input[port_num].ProfileName = TrimQuoteFromString(m_si.GetValue(current_section.c_str(), sect_input.config));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// ==== Input End ==============
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// ==== Input Profile Begin ====
|
|
|
|
|
|
|
|
std::array<std::vector<std::string>, to_underlying(XBOX_INPUT_DEVICE::DEVICE_MAX)> control_names;
|
|
|
|
|
|
|
|
|
|
|
|
// ==== Input End ==============
|
|
|
|
for (int device = 0; device < to_underlying(XBOX_INPUT_DEVICE::DEVICE_MAX); device++) {
|
|
|
|
|
|
|
|
if (dev_num_buttons[device] == 0) {
|
|
|
|
// ==== Input Profile Begin ====
|
|
|
|
continue;
|
|
|
|
std::array<std::vector<std::string>, to_underlying(XBOX_INPUT_DEVICE::DEVICE_MAX)> control_names;
|
|
|
|
|
|
|
|
for (int i = 0; i < dev_num_buttons[0]; i++) {
|
|
|
|
|
|
|
|
char control_name[30];
|
|
|
|
|
|
|
|
std::sprintf(control_name, sect_input_profiles.control, button_xbox_ctrl_names[i][0]);
|
|
|
|
|
|
|
|
control_names[0].push_back(control_name);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
// TODO: add the control names of the other devices
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
index = 0;
|
|
|
|
|
|
|
|
while (true) {
|
|
|
|
|
|
|
|
std::string current_section = std::string(section_input_profiles) + std::to_string(index);
|
|
|
|
|
|
|
|
if (m_si.GetSectionSize(current_section.c_str()) == -1) {
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
s_input_profiles local_profile;
|
|
|
|
|
|
|
|
local_profile.Type = m_si.GetLongValue(current_section.c_str(), sect_input_profiles.type);
|
|
|
|
for (int i = 0; i < dev_num_buttons[device]; i++) {
|
|
|
|
local_profile.ProfileName = TrimQuoteFromString(m_si.GetValue(current_section.c_str(), sect_input_profiles.config));
|
|
|
|
char control_name[30];
|
|
|
|
local_profile.DeviceName = m_si.GetValue(current_section.c_str(), sect_input_profiles.device);
|
|
|
|
std::sprintf(control_name, sect_input_profiles.control, button_xbox_ctrl_names[i][0]);
|
|
|
|
for (int vec_control_index = 0; vec_control_index < dev_num_buttons[local_profile.Type]; vec_control_index++) {
|
|
|
|
control_names[device].push_back(control_name);
|
|
|
|
local_profile.ControlList.push_back(m_si.GetValue(current_section.c_str(),
|
|
|
|
|
|
|
|
control_names[local_profile.Type][vec_control_index].c_str()));
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
m_input_profiles[local_profile.Type].push_back(std::move(local_profile));
|
|
|
|
}
|
|
|
|
index++;
|
|
|
|
|
|
|
|
|
|
|
|
// TODO: add the control names of the other devices
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
index = 0;
|
|
|
|
|
|
|
|
while (true) {
|
|
|
|
|
|
|
|
std::string current_section = std::string(section_input_profiles) + std::to_string(index);
|
|
|
|
|
|
|
|
if (m_si.GetSectionSize(current_section.c_str()) == -1) {
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
s_input_profiles local_profile;
|
|
|
|
|
|
|
|
local_profile.Type = m_si.GetLongValue(current_section.c_str(), sect_input_profiles.type);
|
|
|
|
|
|
|
|
local_profile.ProfileName = TrimQuoteFromString(m_si.GetValue(current_section.c_str(), sect_input_profiles.config));
|
|
|
|
|
|
|
|
local_profile.DeviceName = m_si.GetValue(current_section.c_str(), sect_input_profiles.device);
|
|
|
|
|
|
|
|
for (int vec_control_index = 0; vec_control_index < dev_num_buttons[local_profile.Type]; vec_control_index++) {
|
|
|
|
|
|
|
|
local_profile.ControlList.push_back(m_si.GetValue(current_section.c_str(),
|
|
|
|
|
|
|
|
control_names[local_profile.Type][vec_control_index].c_str()));
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
m_input_profiles[local_profile.Type].push_back(std::move(local_profile));
|
|
|
|
|
|
|
|
index++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// ==== Input Profile End ======
|
|
|
|
// ==== Input Profile End ======
|
|
|
|
|
|
|
|
|
|
|
|
// Delete legacy configs from previous revisions
|
|
|
|
// Delete legacy configs from previous revisions
|
|
|
|
RemoveLegacyConfigs(m_core.Revision);
|
|
|
|
RemoveLegacyConfigs(m_core.Revision);
|
|
|
|
m_core.Revision = settings_version;
|
|
|
|
m_core.Revision = settings_version;
|
|
|
|
|
|
|
|
|
|
|
|
return true;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -520,7 +528,7 @@ bool Settings::Save(std::string file_path)
|
|
|
|
|
|
|
|
|
|
|
|
// Minimal need is 25, 0x37 for GUID.
|
|
|
|
// Minimal need is 25, 0x37 for GUID.
|
|
|
|
char si_value[64];
|
|
|
|
char si_value[64];
|
|
|
|
std::string quote_str;
|
|
|
|
std::string quote_str;
|
|
|
|
|
|
|
|
|
|
|
|
// ==== GUI Begin ===========
|
|
|
|
// ==== GUI Begin ===========
|
|
|
|
|
|
|
|
|
|
|
@ -539,22 +547,22 @@ bool Settings::Save(std::string file_path)
|
|
|
|
// ==== GUI End =============
|
|
|
|
// ==== GUI End =============
|
|
|
|
|
|
|
|
|
|
|
|
// ==== Core Begin ==========
|
|
|
|
// ==== Core Begin ==========
|
|
|
|
|
|
|
|
|
|
|
|
m_si.SetLongValue(section_core, sect_core_keys.Revision, m_core.Revision, nullptr, false, true);
|
|
|
|
m_si.SetLongValue(section_core, sect_core_keys.Revision, m_core.Revision, nullptr, false, true);
|
|
|
|
m_si.SetLongValue(section_core, sect_core_keys.FlagsLLE, m_core.FlagsLLE, nullptr, true, true);
|
|
|
|
m_si.SetLongValue(section_core, sect_core_keys.FlagsLLE, m_core.FlagsLLE, nullptr, true, true);
|
|
|
|
m_si.SetLongValue(section_core, sect_core_keys.KrnlDebugMode, m_core.KrnlDebugMode, nullptr, true, true);
|
|
|
|
m_si.SetLongValue(section_core, sect_core_keys.KrnlDebugMode, m_core.KrnlDebugMode, nullptr, true, true);
|
|
|
|
m_si.SetValue(section_core, sect_core_keys.KrnlDebugLogFile, m_core.szKrnlDebug, nullptr, true);
|
|
|
|
m_si.SetValue(section_core, sect_core_keys.KrnlDebugLogFile, m_core.szKrnlDebug, nullptr, true);
|
|
|
|
m_si.SetBoolValue(section_core, sect_core_keys.AllowAdminPrivilege, m_core.allowAdminPrivilege, nullptr, true);
|
|
|
|
m_si.SetBoolValue(section_core, sect_core_keys.AllowAdminPrivilege, m_core.allowAdminPrivilege, nullptr, true);
|
|
|
|
m_si.SetLongValue(section_core, sect_core_keys.LogLevel, m_core.LogLevel, nullptr, false, true);
|
|
|
|
m_si.SetLongValue(section_core, sect_core_keys.LogLevel, m_core.LogLevel, nullptr, false, true);
|
|
|
|
|
|
|
|
|
|
|
|
std::stringstream stream;
|
|
|
|
std::stringstream stream;
|
|
|
|
stream << "0x" << std::hex << m_core.LoggedModules[0];
|
|
|
|
stream << "0x" << std::hex << m_core.LoggedModules[0];
|
|
|
|
m_si.SetValue(section_core, sect_core_keys.LoggedModules, stream.str().c_str(), nullptr, true);
|
|
|
|
m_si.SetValue(section_core, sect_core_keys.LoggedModules, stream.str().c_str(), nullptr, true);
|
|
|
|
for (int i = 1; i < NUM_INTEGERS_LOG; i++) {
|
|
|
|
for (int i = 1; i < NUM_INTEGERS_LOG; i++) {
|
|
|
|
stream.str("");
|
|
|
|
stream.str("");
|
|
|
|
stream << "0x" << std::hex << m_core.LoggedModules[i];
|
|
|
|
stream << "0x" << std::hex << m_core.LoggedModules[i];
|
|
|
|
m_si.SetValue(section_core, sect_core_keys.LoggedModules, stream.str().c_str(), nullptr, false);
|
|
|
|
m_si.SetValue(section_core, sect_core_keys.LoggedModules, stream.str().c_str(), nullptr, false);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// ==== Core End ============
|
|
|
|
// ==== Core End ============
|
|
|
|
|
|
|
|
|
|
|
@ -566,8 +574,8 @@ bool Settings::Save(std::string file_path)
|
|
|
|
m_si.SetLongValue(section_video, sect_video_keys.Direct3DDevice, m_video.direct3DDevice, nullptr, true, true);
|
|
|
|
m_si.SetLongValue(section_video, sect_video_keys.Direct3DDevice, m_video.direct3DDevice, nullptr, true, true);
|
|
|
|
m_si.SetBoolValue(section_video, sect_video_keys.VSync, m_video.bVSync, nullptr, true);
|
|
|
|
m_si.SetBoolValue(section_video, sect_video_keys.VSync, m_video.bVSync, nullptr, true);
|
|
|
|
m_si.SetBoolValue(section_video, sect_video_keys.FullScreen, m_video.bFullScreen, nullptr, true);
|
|
|
|
m_si.SetBoolValue(section_video, sect_video_keys.FullScreen, m_video.bFullScreen, nullptr, true);
|
|
|
|
m_si.SetBoolValue(section_video, sect_video_keys.HardwareYUV, m_video.bHardwareYUV, nullptr, true);
|
|
|
|
m_si.SetBoolValue(section_video, sect_video_keys.HardwareYUV, m_video.bHardwareYUV, nullptr, true);
|
|
|
|
m_si.SetLongValue(section_video, sect_video_keys.RenderResolution, m_video.renderScaleFactor, nullptr, false, true);
|
|
|
|
m_si.SetLongValue(section_video, sect_video_keys.RenderResolution, m_video.renderScaleFactor, nullptr, false, true);
|
|
|
|
// ==== Video End ===========
|
|
|
|
// ==== Video End ===========
|
|
|
|
|
|
|
|
|
|
|
|
// ==== Audio Begin =========
|
|
|
|
// ==== Audio Begin =========
|
|
|
@ -585,68 +593,75 @@ bool Settings::Save(std::string file_path)
|
|
|
|
m_si.SetBoolValue(section_audio, sect_audio_keys.codec_unknown, m_audio.codec_unknown, nullptr, true);
|
|
|
|
m_si.SetBoolValue(section_audio, sect_audio_keys.codec_unknown, m_audio.codec_unknown, nullptr, true);
|
|
|
|
m_si.SetBoolValue(section_audio, sect_audio_keys.mute_on_unfocus, m_audio.mute_on_unfocus, nullptr, true);
|
|
|
|
m_si.SetBoolValue(section_audio, sect_audio_keys.mute_on_unfocus, m_audio.mute_on_unfocus, nullptr, true);
|
|
|
|
|
|
|
|
|
|
|
|
// ==== Audio End ===========
|
|
|
|
// ==== Audio End ===========
|
|
|
|
|
|
|
|
|
|
|
|
// ==== Network Begin =======
|
|
|
|
// ==== Network Begin =======
|
|
|
|
|
|
|
|
|
|
|
|
m_si.SetValue(section_network, sect_network_keys.adapter_name, m_network.adapter_name, nullptr, true);
|
|
|
|
m_si.SetValue(section_network, sect_network_keys.adapter_name, m_network.adapter_name, nullptr, true);
|
|
|
|
|
|
|
|
|
|
|
|
// ==== Network End =========
|
|
|
|
// ==== Network End =========
|
|
|
|
|
|
|
|
|
|
|
|
// ==== Input Begin ====
|
|
|
|
// ==== Input Begin ====
|
|
|
|
|
|
|
|
|
|
|
|
for (int port_num = 0; port_num < 4; port_num++) {
|
|
|
|
for (int port_num = 0; port_num < 4; port_num++) {
|
|
|
|
std::string current_section = std::string(section_input) + std::to_string(port_num);
|
|
|
|
std::string current_section = std::string(section_input) + std::to_string(port_num);
|
|
|
|
std::string quoted_prf_str = m_input[port_num].ProfileName.insert(0, "\"");
|
|
|
|
std::string quoted_prf_str = m_input[port_num].ProfileName.insert(0, "\"");
|
|
|
|
quoted_prf_str += "\"";
|
|
|
|
quoted_prf_str += "\"";
|
|
|
|
m_si.SetLongValue(current_section.c_str(), sect_input.type, m_input[port_num].Type, nullptr, false, true);
|
|
|
|
m_si.SetLongValue(current_section.c_str(), sect_input.type, m_input[port_num].Type, nullptr, false, true);
|
|
|
|
m_si.SetValue(current_section.c_str(), sect_input.device, m_input[port_num].DeviceName.c_str(), nullptr, true);
|
|
|
|
m_si.SetValue(current_section.c_str(), sect_input.device, m_input[port_num].DeviceName.c_str(), nullptr, true);
|
|
|
|
m_si.SetValue(current_section.c_str(), sect_input.config, quoted_prf_str.c_str(), nullptr, true);
|
|
|
|
m_si.SetValue(current_section.c_str(), sect_input.config, quoted_prf_str.c_str(), nullptr, true);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// ==== Input End ==============
|
|
|
|
// ==== Input End ==============
|
|
|
|
|
|
|
|
|
|
|
|
// ==== Input Profile Begin ====
|
|
|
|
// ==== Input Profile Begin ====
|
|
|
|
|
|
|
|
|
|
|
|
std::array<std::vector<std::string>, to_underlying(XBOX_INPUT_DEVICE::DEVICE_MAX)> control_names;
|
|
|
|
std::array<std::vector<std::string>, to_underlying(XBOX_INPUT_DEVICE::DEVICE_MAX)> control_names;
|
|
|
|
for (int i = 0; i < dev_num_buttons[0]; i++) {
|
|
|
|
for (int device = 0; device < to_underlying(XBOX_INPUT_DEVICE::DEVICE_MAX); device++) {
|
|
|
|
char control_name[30];
|
|
|
|
if (dev_num_buttons[device] == 0) {
|
|
|
|
std::sprintf(control_name, sect_input_profiles.control, button_xbox_ctrl_names[i][0]);
|
|
|
|
continue;
|
|
|
|
control_names[0].push_back(control_name);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
// TODO: add the control names of the other devices
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int profile_num = 0;
|
|
|
|
|
|
|
|
for (int i = 0; i < to_underlying(XBOX_INPUT_DEVICE::DEVICE_MAX); i++) {
|
|
|
|
|
|
|
|
size_t vec_size = m_input_profiles[i].size();
|
|
|
|
|
|
|
|
if (vec_size == 0) {
|
|
|
|
|
|
|
|
continue;
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
for (unsigned int vec_index = 0; vec_index < vec_size; vec_index++, profile_num++) {
|
|
|
|
|
|
|
|
std::string current_section = std::string(section_input_profiles) + std::to_string(profile_num);
|
|
|
|
for (int i = 0; i < dev_num_buttons[device]; i++) {
|
|
|
|
std::string quoted_prf_str = m_input_profiles[i][vec_index].ProfileName.insert(0, "\"");
|
|
|
|
char control_name[30];
|
|
|
|
quoted_prf_str += "\"";
|
|
|
|
std::sprintf(control_name, sect_input_profiles.control, button_xbox_ctrl_names[i][0]);
|
|
|
|
m_si.SetLongValue(current_section.c_str(), sect_input_profiles.type, m_input_profiles[i][vec_index].Type, nullptr, false, true);
|
|
|
|
control_names[device].push_back(control_name);
|
|
|
|
m_si.SetValue(current_section.c_str(), sect_input_profiles.config, quoted_prf_str.c_str(), nullptr, true);
|
|
|
|
|
|
|
|
m_si.SetValue(current_section.c_str(), sect_input_profiles.device, m_input_profiles[i][vec_index].DeviceName.c_str(), nullptr, true);
|
|
|
|
|
|
|
|
size_t vec_control_size = m_input_profiles[i][vec_index].ControlList.size();
|
|
|
|
|
|
|
|
if (vec_control_size == 0) {
|
|
|
|
|
|
|
|
continue;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
m_si.SetValue(current_section.c_str(), control_names[i][0].c_str(), m_input_profiles[i][vec_index].ControlList[0].c_str(), nullptr, true);
|
|
|
|
|
|
|
|
for (unsigned int vec_control_index = 1; vec_control_index < vec_control_size; vec_control_index++) {
|
|
|
|
|
|
|
|
m_si.SetValue(current_section.c_str(), control_names[i][vec_control_index].c_str(),
|
|
|
|
|
|
|
|
m_input_profiles[i][vec_index].ControlList[vec_control_index].c_str(), nullptr, true);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
while (true) {
|
|
|
|
|
|
|
|
std::string current_section = std::string(section_input_profiles) + std::to_string(profile_num);
|
|
|
|
// TODO: add the control names of the other devices
|
|
|
|
if (m_si.GetSectionSize(current_section.c_str()) == -1) {
|
|
|
|
|
|
|
|
break;
|
|
|
|
int profile_num = 0;
|
|
|
|
}
|
|
|
|
for (int i = 0; i < to_underlying(XBOX_INPUT_DEVICE::DEVICE_MAX); i++) {
|
|
|
|
m_si.Delete(current_section.c_str(), nullptr, true);
|
|
|
|
size_t vec_size = m_input_profiles[i].size();
|
|
|
|
profile_num++;
|
|
|
|
if (vec_size == 0) {
|
|
|
|
|
|
|
|
continue;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
for (unsigned int vec_index = 0; vec_index < vec_size; vec_index++, profile_num++) {
|
|
|
|
|
|
|
|
std::string current_section = std::string(section_input_profiles) + std::to_string(profile_num);
|
|
|
|
|
|
|
|
std::string quoted_prf_str = m_input_profiles[i][vec_index].ProfileName.insert(0, "\"");
|
|
|
|
|
|
|
|
quoted_prf_str += "\"";
|
|
|
|
|
|
|
|
m_si.SetLongValue(current_section.c_str(), sect_input_profiles.type, m_input_profiles[i][vec_index].Type, nullptr, false, true);
|
|
|
|
|
|
|
|
m_si.SetValue(current_section.c_str(), sect_input_profiles.config, quoted_prf_str.c_str(), nullptr, true);
|
|
|
|
|
|
|
|
m_si.SetValue(current_section.c_str(), sect_input_profiles.device, m_input_profiles[i][vec_index].DeviceName.c_str(), nullptr, true);
|
|
|
|
|
|
|
|
size_t vec_control_size = m_input_profiles[i][vec_index].ControlList.size();
|
|
|
|
|
|
|
|
if (vec_control_size == 0) {
|
|
|
|
|
|
|
|
continue;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
m_si.SetValue(current_section.c_str(), control_names[i][0].c_str(), m_input_profiles[i][vec_index].ControlList[0].c_str(), nullptr, true);
|
|
|
|
|
|
|
|
for (unsigned int vec_control_index = 1; vec_control_index < vec_control_size; vec_control_index++) {
|
|
|
|
|
|
|
|
m_si.SetValue(current_section.c_str(), control_names[i][vec_control_index].c_str(),
|
|
|
|
|
|
|
|
m_input_profiles[i][vec_index].ControlList[vec_control_index].c_str(), nullptr, true);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
while (true) {
|
|
|
|
|
|
|
|
std::string current_section = std::string(section_input_profiles) + std::to_string(profile_num);
|
|
|
|
|
|
|
|
if (m_si.GetSectionSize(current_section.c_str()) == -1) {
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
m_si.Delete(current_section.c_str(), nullptr, true);
|
|
|
|
|
|
|
|
profile_num++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// ==== Input Profile End ======
|
|
|
|
// ==== Input Profile End ======
|
|
|
@ -683,38 +698,38 @@ void Settings::Delete()
|
|
|
|
void Settings::SyncToEmulator()
|
|
|
|
void Settings::SyncToEmulator()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
// register Core settings
|
|
|
|
// register Core settings
|
|
|
|
g_EmuShared->SetCoreSettings(&m_core);
|
|
|
|
g_EmuShared->SetCoreSettings(&m_core);
|
|
|
|
g_EmuShared->SetIsKrnlLogEnabled(m_core.KrnlDebugMode != DebugMode::DM_NONE);
|
|
|
|
g_EmuShared->SetIsKrnlLogEnabled(m_core.KrnlDebugMode != DebugMode::DM_NONE);
|
|
|
|
|
|
|
|
|
|
|
|
// register Video settings
|
|
|
|
// register Video settings
|
|
|
|
g_EmuShared->SetVideoSettings(&m_video);
|
|
|
|
g_EmuShared->SetVideoSettings(&m_video);
|
|
|
|
|
|
|
|
|
|
|
|
// register Audio settings
|
|
|
|
// register Audio settings
|
|
|
|
g_EmuShared->SetAudioSettings(&m_audio);
|
|
|
|
g_EmuShared->SetAudioSettings(&m_audio);
|
|
|
|
|
|
|
|
|
|
|
|
// register Network settings
|
|
|
|
// register Network settings
|
|
|
|
g_EmuShared->SetNetworkSettings(&m_network);
|
|
|
|
g_EmuShared->SetNetworkSettings(&m_network);
|
|
|
|
|
|
|
|
|
|
|
|
// register input settings
|
|
|
|
// register input settings
|
|
|
|
for (int i = 0; i < 4; i++) {
|
|
|
|
for (int i = 0; i < 4; i++) {
|
|
|
|
g_EmuShared->SetInputDevTypeSettings(&m_input[i].Type, i);
|
|
|
|
g_EmuShared->SetInputDevTypeSettings(&m_input[i].Type, i);
|
|
|
|
if (m_input[i].Type != to_underlying(XBOX_INPUT_DEVICE::DEVICE_INVALID)) {
|
|
|
|
if (m_input[i].Type != to_underlying(XBOX_INPUT_DEVICE::DEVICE_INVALID)) {
|
|
|
|
g_EmuShared->SetInputDevNameSettings(m_input[i].DeviceName.c_str(), i);
|
|
|
|
g_EmuShared->SetInputDevNameSettings(m_input[i].DeviceName.c_str(), i);
|
|
|
|
auto it = std::find_if(m_input_profiles[m_input[i].Type].begin(),
|
|
|
|
auto it = std::find_if(m_input_profiles[m_input[i].Type].begin(),
|
|
|
|
m_input_profiles[m_input[i].Type].end(), [this, i](const auto& profile) {
|
|
|
|
m_input_profiles[m_input[i].Type].end(), [this, i](const auto& profile) {
|
|
|
|
if (profile.ProfileName == m_input[i].ProfileName) {
|
|
|
|
if (profile.ProfileName == m_input[i].ProfileName) {
|
|
|
|
return true;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
return false;
|
|
|
|
});
|
|
|
|
});
|
|
|
|
if (it != m_input_profiles[m_input[i].Type].end()) {
|
|
|
|
if (it != m_input_profiles[m_input[i].Type].end()) {
|
|
|
|
char controls_name[XBOX_CTRL_NUM_BUTTONS][30];
|
|
|
|
char controls_name[XBOX_CTRL_NUM_BUTTONS][30];
|
|
|
|
for (int index = 0; index < dev_num_buttons[m_input[i].Type]; index++) {
|
|
|
|
for (int index = 0; index < dev_num_buttons[m_input[i].Type]; index++) {
|
|
|
|
strncpy(controls_name[index], it->ControlList[index].c_str(), 30);
|
|
|
|
strncpy(controls_name[index], it->ControlList[index].c_str(), 30);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
g_EmuShared->SetInputBindingsSettings(controls_name, XBOX_CTRL_NUM_BUTTONS, i);
|
|
|
|
g_EmuShared->SetInputBindingsSettings(controls_name, XBOX_CTRL_NUM_BUTTONS, i);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// register Hacks settings
|
|
|
|
// register Hacks settings
|
|
|
@ -805,17 +820,17 @@ std::string Settings::GetDataLocation()
|
|
|
|
return m_current_data_location;
|
|
|
|
return m_current_data_location;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void Settings::RemoveLegacyConfigs(unsigned int CurrentRevision)
|
|
|
|
void Settings::RemoveLegacyConfigs(unsigned int CurrentRevision)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
switch (CurrentRevision) {
|
|
|
|
switch (CurrentRevision) {
|
|
|
|
case 2:
|
|
|
|
case 2:
|
|
|
|
case 3:
|
|
|
|
case 3:
|
|
|
|
case 4:
|
|
|
|
case 4:
|
|
|
|
m_si.Delete(section_controller_dinput, nullptr, true);
|
|
|
|
m_si.Delete(section_controller_dinput, nullptr, true);
|
|
|
|
m_si.Delete(section_controller_port, nullptr, true);
|
|
|
|
m_si.Delete(section_controller_port, nullptr, true);
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
case 5:
|
|
|
|
case 5:
|
|
|
|
default:
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|