From 5a68224a13f9bcebcdc0c5b69839f9f60b574601 Mon Sep 17 00:00:00 2001 From: georgemoralis Date: Mon, 5 Aug 2024 19:27:03 +0300 Subject: [PATCH] update submodules , fixed sdl update , rewrote config with new toml11 v4 --- externals/fmt | 2 +- externals/glslang | 2 +- externals/magic_enum | 2 +- externals/sdl3 | 2 +- externals/toml11 | 2 +- externals/vulkan-headers | 2 +- src/common/config.cpp | 108 +++++++++++++++++---------------------- src/sdl_window.cpp | 4 +- 8 files changed, 55 insertions(+), 69 deletions(-) diff --git a/externals/fmt b/externals/fmt index bc8d32e9..15f939c3 160000 --- a/externals/fmt +++ b/externals/fmt @@ -1 +1 @@ -Subproject commit bc8d32e9643d2be5fc070abf2a50bc021544545d +Subproject commit 15f939c3de44d4e7521432b0c9d82f9358b24c2a diff --git a/externals/glslang b/externals/glslang index 52f68dc6..e40c14a3 160000 --- a/externals/glslang +++ b/externals/glslang @@ -1 +1 @@ -Subproject commit 52f68dc6b2a9d017b43161f31f13a6f44636ee7c +Subproject commit e40c14a3e007fac0e4f2e4164fdf14d1712355bd diff --git a/externals/magic_enum b/externals/magic_enum index 664ee62c..dae6bbf1 160000 --- a/externals/magic_enum +++ b/externals/magic_enum @@ -1 +1 @@ -Subproject commit 664ee62c12570948b0e025d15b42d641fba8d54a +Subproject commit dae6bbf16c363e9ead4e628a47fdb02956a634f3 diff --git a/externals/sdl3 b/externals/sdl3 index f9a06c20..881e2bc3 160000 --- a/externals/sdl3 +++ b/externals/sdl3 @@ -1 +1 @@ -Subproject commit f9a06c20ed85fb1d6754fc2280d6183382217910 +Subproject commit 881e2bc344f43bf04927fb2045f46f3d3f611d36 diff --git a/externals/toml11 b/externals/toml11 index b389bbc4..12c0f379 160000 --- a/externals/toml11 +++ b/externals/toml11 @@ -1 +1 @@ -Subproject commit b389bbc4ebf90fa2fe7651de3046fb19f661ba3c +Subproject commit 12c0f379f2e865b4ce984758d5ae004f9de07d69 diff --git a/externals/vulkan-headers b/externals/vulkan-headers index b379292b..595c8d47 160000 --- a/externals/vulkan-headers +++ b/externals/vulkan-headers @@ -1 +1 @@ -Subproject commit b379292b2ab6df5771ba9870d53cf8b2c9295daf +Subproject commit 595c8d4794410a4e64b98dc58d27c0310d7ea2fd diff --git a/src/common/config.cpp b/src/common/config.cpp index 7e677f84..c2ea1fe3 100644 --- a/src/common/config.cpp +++ b/src/common/config.cpp @@ -223,90 +223,76 @@ void load(const std::filesystem::path& path) { fmt::print("Got exception trying to load config file. Exception: {}\n", ex.what()); return; } - if (data.contains("General")) { - auto generalResult = toml::expect(data.at("General")); - if (generalResult.is_ok()) { - auto general = generalResult.unwrap(); + const toml::value& general = data.at("General"); - isNeo = toml::find_or(general, "isPS4Pro", false); - isFullscreen = toml::find_or(general, "Fullscreen", false); - logFilter = toml::find_or(general, "logFilter", ""); - logType = toml::find_or(general, "logType", "sync"); - isShowSplash = toml::find_or(general, "showSplash", true); - } + isNeo = toml::find_or(general, "isPS4Pro", false); + isFullscreen = toml::find_or(general, "Fullscreen", false); + logFilter = toml::find_or(general, "logFilter", ""); + logType = toml::find_or(general, "logType", "sync"); + isShowSplash = toml::find_or(general, "showSplash", true); } + if (data.contains("GPU")) { - auto gpuResult = toml::expect(data.at("GPU")); - if (gpuResult.is_ok()) { - auto gpu = gpuResult.unwrap(); + const toml::value& gpu = data.at("GPU"); - screenWidth = toml::find_or(gpu, "screenWidth", screenWidth); - screenHeight = toml::find_or(gpu, "screenHeight", screenHeight); - isNullGpu = toml::find_or(gpu, "nullGpu", false); - shouldDumpShaders = toml::find_or(gpu, "dumpShaders", false); - shouldDumpPM4 = toml::find_or(gpu, "dumpPM4", false); - vblankDivider = toml::find_or(gpu, "vblankDivider", 1); - } + screenWidth = toml::find_or(gpu, "screenWidth", screenWidth); + screenHeight = toml::find_or(gpu, "screenHeight", screenHeight); + isNullGpu = toml::find_or(gpu, "nullGpu", false); + shouldDumpShaders = toml::find_or(gpu, "dumpShaders", false); + shouldDumpPM4 = toml::find_or(gpu, "dumpPM4", false); + vblankDivider = toml::find_or(gpu, "vblankDivider", 1); } + if (data.contains("Vulkan")) { - const auto vkResult = toml::expect(data.at("Vulkan")); - if (vkResult.is_ok()) { - auto vk = vkResult.unwrap(); + const toml::value& vk = data.at("Vulkan"); - gpuId = toml::find_or(vk, "gpuId", 0); - vkValidation = toml::find_or(vk, "validation", true); - vkValidationSync = toml::find_or(vk, "validation_sync", true); - rdocEnable = toml::find_or(vk, "rdocEnable", false); - } + gpuId = toml::find_or(vk, "gpuId", -1); + vkValidation = toml::find_or(vk, "validation", false); + vkValidationSync = toml::find_or(vk, "validation_sync", false); + rdocEnable = toml::find_or(vk, "rdocEnable", false); } + if (data.contains("Debug")) { - auto debugResult = toml::expect(data.at("Debug")); - if (debugResult.is_ok()) { - auto debug = debugResult.unwrap(); + const toml::value& debug = data.at("Debug"); - isDebugDump = toml::find_or(debug, "DebugDump", false); - } + isDebugDump = toml::find_or(debug, "DebugDump", false); } + if (data.contains("LLE")) { - auto lleResult = toml::expect(data.at("LLE")); - if (lleResult.is_ok()) { - auto lle = lleResult.unwrap(); + const toml::value& lle = data.at("LLE"); - isLibc = toml::find_or(lle, "libc", true); - } + isLibc = toml::find_or(lle, "libc", true); } - if (data.contains("GUI")) { - auto guiResult = toml::expect(data.at("GUI")); - if (guiResult.is_ok()) { - auto gui = guiResult.unwrap(); - m_icon_size = toml::find_or(gui, "iconSize", 0); - m_icon_size_grid = toml::find_or(gui, "iconSizeGrid", 0); - m_slider_pos = toml::find_or(gui, "sliderPos", 0); - m_slider_pos_grid = toml::find_or(gui, "sliderPosGrid", 0); - mw_themes = toml::find_or(gui, "theme", 0); - m_window_size_W = toml::find_or(gui, "mw_width", 0); - m_window_size_H = toml::find_or(gui, "mw_height", 0); - settings_install_dir = toml::find_or(gui, "installDir", ""); - main_window_geometry_x = toml::find_or(gui, "geometry_x", 0); - main_window_geometry_y = toml::find_or(gui, "geometry_y", 0); - main_window_geometry_w = toml::find_or(gui, "geometry_w", 0); - main_window_geometry_h = toml::find_or(gui, "geometry_h", 0); - m_pkg_viewer = toml::find_or>(gui, "pkgDirs", {}); - m_elf_viewer = toml::find_or>(gui, "elfDirs", {}); - m_recent_files = toml::find_or>(gui, "recentFiles", {}); - m_table_mode = toml::find_or(gui, "gameTableMode", 0); - } + if (data.contains("GUI")) { + const toml::value& gui = data.at("GUI"); + + m_icon_size = toml::find_or(gui, "iconSize", 0); + m_icon_size_grid = toml::find_or(gui, "iconSizeGrid", 0); + m_slider_pos = toml::find_or(gui, "sliderPos", 0); + m_slider_pos_grid = toml::find_or(gui, "sliderPosGrid", 0); + mw_themes = toml::find_or(gui, "theme", 0); + m_window_size_W = toml::find_or(gui, "mw_width", 0); + m_window_size_H = toml::find_or(gui, "mw_height", 0); + settings_install_dir = toml::find_or(gui, "installDir", ""); + main_window_geometry_x = toml::find_or(gui, "geometry_x", 0); + main_window_geometry_y = toml::find_or(gui, "geometry_y", 0); + main_window_geometry_w = toml::find_or(gui, "geometry_w", 0); + main_window_geometry_h = toml::find_or(gui, "geometry_h", 0); + m_pkg_viewer = toml::find_or>(gui, "pkgDirs", {}); + m_elf_viewer = toml::find_or>(gui, "elfDirs", {}); + m_recent_files = toml::find_or>(gui, "recentFiles", {}); + m_table_mode = toml::find_or(gui, "gameTableMode", 0); } } void save(const std::filesystem::path& path) { - toml::basic_value data; + toml::value data; std::error_code error; if (std::filesystem::exists(path, error)) { try { - data = toml::parse(path); + data = toml::parse(path); } catch (const std::exception& ex) { fmt::print("Exception trying to parse config file. Exception: {}\n", ex.what()); return; diff --git a/src/sdl_window.cpp b/src/sdl_window.cpp index 0d25cd3f..5084a5ae 100644 --- a/src/sdl_window.cpp +++ b/src/sdl_window.cpp @@ -45,8 +45,8 @@ WindowSDL::WindowSDL(s32 width_, s32 height_, Input::GameController* controller_ #if defined(SDL_PLATFORM_WIN32) window_info.type = WindowSystemType::Windows; - window_info.render_surface = - SDL_GetProperty(SDL_GetWindowProperties(window), SDL_PROP_WINDOW_WIN32_HWND_POINTER, NULL); + window_info.render_surface = SDL_GetPointerProperty(SDL_GetWindowProperties(window), + SDL_PROP_WINDOW_WIN32_HWND_POINTER, NULL); #elif defined(SDL_PLATFORM_LINUX) if (SDL_strcmp(SDL_GetCurrentVideoDriver(), "x11") == 0) { window_info.type = WindowSystemType::X11;