mirror of
https://github.com/open-goal/jak-project
synced 2026-07-11 23:30:16 -04:00
game: ensure settings are loaded after custom location is set
This commit is contained in:
@@ -55,6 +55,7 @@ u32 Init(GameVersion version) {
|
||||
prof().instant_event("ROOT");
|
||||
|
||||
g_debug_settings = game_settings::DebugSettings();
|
||||
g_debug_settings.load_settings();
|
||||
{
|
||||
auto p = scoped_prof("startup::gfx::get_renderer");
|
||||
g_global_settings.renderer = GetRenderer(GfxPipeline::OpenGL);
|
||||
|
||||
@@ -526,7 +526,7 @@ void link_control::jak1_finish(bool jump_from_c_to_goal) {
|
||||
*EnableMethodSet = *EnableMethodSet + m_keep_debug;
|
||||
|
||||
ObjectFileHeader* ofh = m_link_block_ptr.cast<ObjectFileHeader>().c();
|
||||
lg::info("link finish: {}", m_object_name);
|
||||
lg::debug("link finish: {}", m_object_name);
|
||||
if (ofh->object_file_version == 3) {
|
||||
// todo check function type of entry
|
||||
|
||||
|
||||
@@ -544,7 +544,7 @@ void link_control::jak2_finish(bool jump_from_c_to_goal) {
|
||||
*EnableMethodSet = *EnableMethodSet + m_keep_debug;
|
||||
|
||||
ObjectFileHeader* ofh = m_link_block_ptr.cast<ObjectFileHeader>().c();
|
||||
lg::info("link finish: {}", m_object_name);
|
||||
lg::debug("link finish: {}", m_object_name);
|
||||
if (ofh->object_file_version == 3) {
|
||||
// todo check function type of entry
|
||||
|
||||
|
||||
+3
-1
@@ -42,7 +42,7 @@ void setup_logging(const std::string& game_name, bool verbose, bool disable_ansi
|
||||
lg::set_flush_level(lg::level::debug);
|
||||
} else {
|
||||
lg::set_file_level(lg::level::debug);
|
||||
lg::set_stdout_level(lg::level::warn);
|
||||
lg::set_stdout_level(lg::level::info);
|
||||
lg::set_flush_level(lg::level::warn);
|
||||
}
|
||||
if (disable_ansi_colors) {
|
||||
@@ -141,9 +141,11 @@ int main(int argc, char** argv) {
|
||||
// Override the user's config dir, potentially (either because it was explicitly provided
|
||||
// or because it's portable mode)
|
||||
if (enable_portable) {
|
||||
lg::info("Portable mod enabled");
|
||||
user_config_dir_override = file_util::get_current_executable_path();
|
||||
}
|
||||
if (!user_config_dir_override.empty()) {
|
||||
lg::info("Overriding config directory with: {}", user_config_dir_override.string());
|
||||
file_util::override_user_config_dir(user_config_dir_override, !disable_save_location_override);
|
||||
}
|
||||
|
||||
|
||||
@@ -33,7 +33,9 @@ void from_json(const json& j, DebugSettings& obj) {
|
||||
json_deserialize_if_exists(hide_imgui_key);
|
||||
}
|
||||
|
||||
DebugSettings::DebugSettings() {
|
||||
DebugSettings::DebugSettings() {}
|
||||
|
||||
void DebugSettings::load_settings() {
|
||||
try {
|
||||
std::string file_path =
|
||||
(file_util::get_user_misc_dir(g_game_version) / "debug-settings.json").string();
|
||||
@@ -71,7 +73,9 @@ void from_json(const json& j, DisplaySettings& obj) {
|
||||
json_deserialize_if_exists(window_ypos);
|
||||
}
|
||||
|
||||
DisplaySettings::DisplaySettings() {
|
||||
DisplaySettings::DisplaySettings() {}
|
||||
|
||||
void DisplaySettings::load_settings() {
|
||||
try {
|
||||
std::string file_path =
|
||||
(file_util::get_user_settings_dir(g_game_version) / "display-settings.json").string();
|
||||
@@ -114,7 +118,9 @@ void from_json(const json& j, InputSettings& obj) {
|
||||
json_deserialize_if_exists(keyboard_enabled);
|
||||
}
|
||||
|
||||
InputSettings::InputSettings() {
|
||||
InputSettings::InputSettings() {}
|
||||
|
||||
void InputSettings::load_settings() {
|
||||
try {
|
||||
keyboard_binds = DEFAULT_KEYBOARD_BINDS;
|
||||
mouse_binds = DEFAULT_MOUSE_BINDS;
|
||||
@@ -131,6 +137,7 @@ InputSettings::InputSettings() {
|
||||
lg::error("Error encountered when attempting to load input settings {}", e.what());
|
||||
}
|
||||
}
|
||||
|
||||
void InputSettings::save_settings() {
|
||||
json data = *this;
|
||||
auto file_path = file_util::get_user_settings_dir(g_game_version) / "input-settings.json";
|
||||
|
||||
@@ -25,6 +25,7 @@ struct DebugSettings {
|
||||
float text_max_range = 0;
|
||||
u32 hide_imgui_key = SDLK_LALT;
|
||||
|
||||
void load_settings();
|
||||
void save_settings();
|
||||
};
|
||||
void to_json(json& j, const DebugSettings& obj);
|
||||
@@ -39,6 +40,7 @@ struct DisplaySettings {
|
||||
int window_ypos = 50;
|
||||
int display_id = 0;
|
||||
|
||||
void load_settings();
|
||||
void save_settings();
|
||||
};
|
||||
|
||||
@@ -60,6 +62,7 @@ struct InputSettings {
|
||||
bool keyboard_temp_enabled =
|
||||
false; // not saved or restored, flips on if no controllers are detected
|
||||
|
||||
void load_settings();
|
||||
void save_settings();
|
||||
};
|
||||
|
||||
|
||||
@@ -12,6 +12,7 @@ DisplayManager::DisplayManager(SDL_Window* window)
|
||||
prof().instant_event("ROOT");
|
||||
{
|
||||
auto p = scoped_prof("display_manager::init");
|
||||
m_display_settings.load_settings();
|
||||
#ifdef _WIN32
|
||||
// Windows hint to disable OS level forced scaling and allow native resolution at non 100%
|
||||
// scales
|
||||
|
||||
@@ -22,6 +22,7 @@ InputManager::InputManager()
|
||||
prof().instant_event("ROOT");
|
||||
{
|
||||
auto p = scoped_prof("input_manager::init");
|
||||
m_settings->load_settings();
|
||||
{
|
||||
auto p = scoped_prof("input_manager::init::sdl_init_subsystem");
|
||||
// initializing the controllers on startup can sometimes take a very long time
|
||||
|
||||
Reference in New Issue
Block a user