citra: fix cemuhook module crash

fixes #4144. Updated inih to use the newly added GetString function which returns the default value on empty string.
This commit is contained in:
zhupengfei 2018-10-12 22:58:30 +08:00
parent 4ee914c7a8
commit b459164c2a
No known key found for this signature in database
GPG key ID: DD129E108BD09378
2 changed files with 22 additions and 22 deletions

2
externals/inih/inih vendored

@ -1 +1 @@
Subproject commit 56edbbbef9ba432521442ee47ba7d1c8de37e63d
Subproject commit 2023872dfffb38b6a98f2c45a0eb25652aaea91f

View file

@ -74,7 +74,7 @@ void Config::ReadValues() {
for (int i = 0; i < Settings::NativeButton::NumButtons; ++i) {
std::string default_param = InputCommon::GenerateKeyboardParam(default_buttons[i]);
Settings::values.buttons[i] =
sdl2_config->Get("Controls", Settings::NativeButton::mapping[i], default_param);
sdl2_config->GetString("Controls", Settings::NativeButton::mapping[i], default_param);
if (Settings::values.buttons[i].empty())
Settings::values.buttons[i] = default_param;
}
@ -84,18 +84,18 @@ void Config::ReadValues() {
default_analogs[i][0], default_analogs[i][1], default_analogs[i][2],
default_analogs[i][3], default_analogs[i][4], 0.5f);
Settings::values.analogs[i] =
sdl2_config->Get("Controls", Settings::NativeAnalog::mapping[i], default_param);
sdl2_config->GetString("Controls", Settings::NativeAnalog::mapping[i], default_param);
if (Settings::values.analogs[i].empty())
Settings::values.analogs[i] = default_param;
}
Settings::values.motion_device =
sdl2_config->Get("Controls", "motion_device",
"engine:motion_emu,update_period:100,sensitivity:0.01,tilt_clamp:90.0");
Settings::values.motion_device = sdl2_config->GetString(
"Controls", "motion_device",
"engine:motion_emu,update_period:100,sensitivity:0.01,tilt_clamp:90.0");
Settings::values.touch_device =
sdl2_config->Get("Controls", "touch_device", "engine:emu_window");
Settings::values.udp_input_address =
sdl2_config->Get("Controls", "udp_input_address", InputCommon::CemuhookUDP::DEFAULT_ADDR);
sdl2_config->GetString("Controls", "touch_device", "engine:emu_window");
Settings::values.udp_input_address = sdl2_config->GetString(
"Controls", "udp_input_address", InputCommon::CemuhookUDP::DEFAULT_ADDR);
Settings::values.udp_input_port = static_cast<u16>(sdl2_config->GetInteger(
"Controls", "udp_input_port", InputCommon::CemuhookUDP::DEFAULT_PORT));
@ -155,10 +155,10 @@ void Config::ReadValues() {
static_cast<u16>(sdl2_config->GetInteger("Layout", "custom_bottom_bottom", 480));
// Audio
Settings::values.sink_id = sdl2_config->Get("Audio", "output_engine", "auto");
Settings::values.sink_id = sdl2_config->GetString("Audio", "output_engine", "auto");
Settings::values.enable_audio_stretching =
sdl2_config->GetBoolean("Audio", "enable_audio_stretching", true);
Settings::values.audio_device_id = sdl2_config->Get("Audio", "output_device", "auto");
Settings::values.audio_device_id = sdl2_config->GetString("Audio", "output_device", "auto");
Settings::values.volume = sdl2_config->GetReal("Audio", "volume", 1);
// Data Storage
@ -181,7 +181,7 @@ void Config::ReadValues() {
t.tm_year = 100;
t.tm_isdst = 0;
std::istringstream string_stream(
sdl2_config->Get("System", "init_time", "2000-01-01 00:00:01"));
sdl2_config->GetString("System", "init_time", "2000-01-01 00:00:01"));
string_stream >> std::get_time(&t, "%Y-%m-%d %H:%M:%S");
if (string_stream.fail()) {
LOG_ERROR(Config, "Failed To parse init_time. Using 2000-01-01 00:00:01");
@ -195,26 +195,26 @@ void Config::ReadValues() {
// Camera
using namespace Service::CAM;
Settings::values.camera_name[OuterRightCamera] =
sdl2_config->Get("Camera", "camera_outer_right_name", "blank");
sdl2_config->GetString("Camera", "camera_outer_right_name", "blank");
Settings::values.camera_config[OuterRightCamera] =
sdl2_config->Get("Camera", "camera_outer_right_config", "");
sdl2_config->GetString("Camera", "camera_outer_right_config", "");
Settings::values.camera_flip[OuterRightCamera] =
sdl2_config->GetInteger("Camera", "camera_outer_right_flip", 0);
Settings::values.camera_name[InnerCamera] =
sdl2_config->Get("Camera", "camera_inner_name", "blank");
sdl2_config->GetString("Camera", "camera_inner_name", "blank");
Settings::values.camera_config[InnerCamera] =
sdl2_config->Get("Camera", "camera_inner_config", "");
sdl2_config->GetString("Camera", "camera_inner_config", "");
Settings::values.camera_flip[InnerCamera] =
sdl2_config->GetInteger("Camera", "camera_inner_flip", 0);
Settings::values.camera_name[OuterLeftCamera] =
sdl2_config->Get("Camera", "camera_outer_left_name", "blank");
sdl2_config->GetString("Camera", "camera_outer_left_name", "blank");
Settings::values.camera_config[OuterLeftCamera] =
sdl2_config->Get("Camera", "camera_outer_left_config", "");
sdl2_config->GetString("Camera", "camera_outer_left_config", "");
Settings::values.camera_flip[OuterLeftCamera] =
sdl2_config->GetInteger("Camera", "camera_outer_left_flip", 0);
// Miscellaneous
Settings::values.log_filter = sdl2_config->Get("Miscellaneous", "log_filter", "*:Info");
Settings::values.log_filter = sdl2_config->GetString("Miscellaneous", "log_filter", "*:Info");
// Debugging
Settings::values.use_gdbstub = sdl2_config->GetBoolean("Debugging", "use_gdbstub", false);
@ -230,9 +230,9 @@ void Config::ReadValues() {
Settings::values.enable_telemetry =
sdl2_config->GetBoolean("WebService", "enable_telemetry", true);
Settings::values.web_api_url =
sdl2_config->Get("WebService", "web_api_url", "https://api.citra-emu.org");
Settings::values.citra_username = sdl2_config->Get("WebService", "citra_username", "");
Settings::values.citra_token = sdl2_config->Get("WebService", "citra_token", "");
sdl2_config->GetString("WebService", "web_api_url", "https://api.citra-emu.org");
Settings::values.citra_username = sdl2_config->GetString("WebService", "citra_username", "");
Settings::values.citra_token = sdl2_config->GetString("WebService", "citra_token", "");
}
void Config::Reload() {