diff --git a/common/formatter/formatting_rules.h b/common/formatter/formatting_rules.h index 0347ee01e6..25453de659 100644 --- a/common/formatter/formatting_rules.h +++ b/common/formatter/formatting_rules.h @@ -37,6 +37,7 @@ class FormatterTreeNode; // "world") class FormattingRule { public: + virtual ~FormattingRule() = default; virtual void append_newline(std::string& curr_text, const FormatterTreeNode& node, const FormatterTreeNode& containing_node, diff --git a/common/serialization/subtitles/subtitles_ser.cpp b/common/serialization/subtitles/subtitles_ser.cpp index c815f5e42d..ae2e947e98 100644 --- a/common/serialization/subtitles/subtitles_ser.cpp +++ b/common/serialization/subtitles/subtitles_ser.cpp @@ -270,7 +270,9 @@ void parse_text_json(const nlohmann::json& json, * Each scene should be (scene-name ... ) * This adds the subtitle to each of the specified languages. */ -void parse_subtitle(const goos::Object& data, GameSubtitleDB& db, const std::string& file_path) { +void parse_subtitle(const goos::Object& data, + GameSubtitleDB& db, + const std::string& /*file_path*/) { const GameTextFontBank* font = nullptr; std::map> banks; @@ -485,7 +487,7 @@ void parse_subtitle_json(GameSubtitleDB& db, const GameSubtitleDefinitionFile& f } else { if (lines_file.speakers.find(line.speaker) == lines_file.speakers.end() || lines_file.cutscenes.find(cutscene_name) == lines_file.cutscenes.end() || - lines_file.cutscenes.at(cutscene_name).size() < line_idx) { + int(lines_file.cutscenes.at(cutscene_name).size()) < line_idx) { lg::warn( "{} Couldn't find {} in line file, or line list is too small, or speaker could not " "be resolved {}!", @@ -504,7 +506,7 @@ void parse_subtitle_json(GameSubtitleDB& db, const GameSubtitleDefinitionFile& f } } // Verify we added the amount of lines we expected to - if (lines_added != cutscene_lines.size()) { + if (lines_added != int(cutscene_lines.size())) { throw std::runtime_error( fmt::format("Cutscene: '{}' has a mismatch in metadata lines vs text lines. Expected {} " "only added {} lines", @@ -540,7 +542,7 @@ void parse_subtitle_json(GameSubtitleDB& db, const GameSubtitleDefinitionFile& f } else { if (lines_file.speakers.find(line.speaker) == lines_file.speakers.end() || lines_file.hints.find(hint_name) == lines_file.hints.end() || - lines_file.hints.at(hint_name).size() < line_idx) { + int(lines_file.hints.at(hint_name).size()) < line_idx) { lg::warn( "{} Couldn't find {} in line file, or line list is too small, or speaker could not " "be resolved {}!", @@ -558,7 +560,7 @@ void parse_subtitle_json(GameSubtitleDB& db, const GameSubtitleDefinitionFile& f } } // Verify we added the amount of lines we expected to - if (lines_added != hint_info.lines.size()) { + if (lines_added != int(hint_info.lines.size())) { throw std::runtime_error( fmt::format("Hint: '{}' has a mismatch in metadata lines vs text lines. Expected {} " "only added {} lines", diff --git a/game/graphics/pipelines/opengl.cpp b/game/graphics/pipelines/opengl.cpp index 1ebfd02def..3765c2c10b 100644 --- a/game/graphics/pipelines/opengl.cpp +++ b/game/graphics/pipelines/opengl.cpp @@ -183,7 +183,6 @@ static void init_imgui(SDL_Window* window, } // set up to get inputs for this window - auto test = SDL_GetCurrentVideoDriver(); ImGui_ImplSDL2_InitForOpenGL(window, gl_context); // NOTE: imgui's setup calls functions that may fail intentionally, and attempts to disable error @@ -198,7 +197,7 @@ static void init_imgui(SDL_Window* window, static std::shared_ptr gl_make_display(int width, int height, const char* title, - GfxGlobalSettings& settings, + GfxGlobalSettings& /*settings*/, GameVersion game_version, bool is_main) { // Setup the window @@ -291,8 +290,8 @@ static std::shared_ptr gl_make_display(int width, GLDisplay::GLDisplay(SDL_Window* window, SDL_GLContext gl_context, bool is_main) : m_window(window), m_gl_context(gl_context), - m_input_manager(std::make_shared()), - m_display_manager(std::make_shared(window)) { + m_display_manager(std::make_shared(window)), + m_input_manager(std::make_shared()) { m_main = is_main; // Register commands diff --git a/game/kernel/common/kmachine.cpp b/game/kernel/common/kmachine.cpp index 4ce9e9effe..6b8bf9601f 100644 --- a/game/kernel/common/kmachine.cpp +++ b/game/kernel/common/kmachine.cpp @@ -424,7 +424,7 @@ void pc_memmove(u32 dst, u32 src, u32 size) { memmove(Ptr(dst).c(), Ptr(src).c(), size); } -void send_gfx_dma_chain(u32 bank, u32 chain) { +void send_gfx_dma_chain(u32 /*bank*/, u32 chain) { if (Gfx::GetCurrentRenderer()) { Gfx::GetCurrentRenderer()->send_chain(g_ee_main_mem, chain); } diff --git a/game/kernel/jak2/kmachine.cpp b/game/kernel/jak2/kmachine.cpp index d2ca1cb022..f0b8870d41 100644 --- a/game/kernel/jak2/kmachine.cpp +++ b/game/kernel/jak2/kmachine.cpp @@ -606,7 +606,7 @@ u32 alloc_vagdir_names(u32 heap_sym) { *alloced_heap = gVagDir.count; // use entry -1 to get the amount alloced_heap = alloced_heap + 8; - for (int i = 0; i < gVagDir.count; ++i) { + for (size_t i = 0; i < gVagDir.count; ++i) { char vagname_temp[9]; memcpy(vagname_temp, gVagDir.vag[i].name, 8); for (int j = 0; j < 8; ++j) { diff --git a/game/sce/libpad.cpp b/game/sce/libpad.cpp index 41dcfb649b..6186ae671f 100644 --- a/game/sce/libpad.cpp +++ b/game/sce/libpad.cpp @@ -76,13 +76,13 @@ int scePadRead(int port, int /*slot*/, u8* rdata) { std::tie(cpad->leftx, cpad->lefty) = pad_data.value()->analog_left(); // pressure sensitivity. ignore for now. - for (int i = 0; i < PAD_DATA_PRESSURE_INDEX_ORDER.size(); i++) { + for (size_t i = 0; i < PAD_DATA_PRESSURE_INDEX_ORDER.size(); i++) { cpad->abutton[i] = pad_data.value()->button_data.at(PAD_DATA_PRESSURE_INDEX_ORDER.at(i)) * 255; } cpad->button0 = 0; - for (int i = 0; i < pad_data.value()->button_data.size(); i++) { + for (size_t i = 0; i < pad_data.value()->button_data.size(); i++) { cpad->button0 |= pad_data.value()->button_data.at(i) << i; } } diff --git a/game/system/hid/devices/game_controller.cpp b/game/system/hid/devices/game_controller.cpp index af141940da..dd1ec960dc 100644 --- a/game/system/hid/devices/game_controller.cpp +++ b/game/system/hid/devices/game_controller.cpp @@ -56,10 +56,10 @@ void GameController::process_event(const SDL_Event& event, const CommandBindingGroups& commands, std::shared_ptr data, std::optional& bind_assignment, - bool ignore_inputs) { + bool /*ignore_inputs*/) { if (event.type == SDL_CONTROLLERAXISMOTION && event.caxis.which == m_sdl_instance_id) { // https://wiki.libsdl.org/SDL2/SDL_GameControllerAxis - if (event.caxis.axis <= SDL_CONTROLLER_AXIS_INVALID || + if ((int)event.caxis.axis <= SDL_CONTROLLER_AXIS_INVALID || event.caxis.axis >= SDL_CONTROLLER_AXIS_MAX) { return; } @@ -98,7 +98,7 @@ void GameController::process_event(const SDL_Event& event, auto& binds = m_settings->controller_binds.at(m_guid); // https://wiki.libsdl.org/SDL2/SDL_GameControllerButton - if (event.cbutton.button <= SDL_CONTROLLER_BUTTON_INVALID || + if ((int)event.cbutton.button <= SDL_CONTROLLER_BUTTON_INVALID || event.cbutton.button >= SDL_CONTROLLER_BUTTON_MAX) { return; } diff --git a/game/system/hid/devices/keyboard.cpp b/game/system/hid/devices/keyboard.cpp index 03a8251be3..311b974a3b 100644 --- a/game/system/hid/devices/keyboard.cpp +++ b/game/system/hid/devices/keyboard.cpp @@ -19,7 +19,7 @@ void KeyboardDevice::process_event(const SDL_Event& event, if (key_event.repeat != 0) { return; } - if (m_ignore_key_on_keyup && m_ignore_key_on_keyup.value() == key_event.keysym.sym && + if (m_ignore_key_on_keyup && m_ignore_key_on_keyup.value() == (u32)key_event.keysym.sym && event.type == SDL_KEYUP) { m_ignore_key_on_keyup = std::nullopt; return; diff --git a/game/system/hid/display_manager.cpp b/game/system/hid/display_manager.cpp index 0bbb5ec9b1..05866c236d 100644 --- a/game/system/hid/display_manager.cpp +++ b/game/system/hid/display_manager.cpp @@ -94,7 +94,7 @@ int DisplayManager::get_screen_height() { } Resolution DisplayManager::get_resolution(int id) { - if (id < m_available_resolutions.size()) { + if (id < (int)m_available_resolutions.size()) { return m_available_resolutions.at(id); } return {0, 0, 0.0}; @@ -199,7 +199,7 @@ void DisplayManager::set_window_display_mode(WindowDisplayMode mode) { } void DisplayManager::set_fullscreen_display_id(int display_id) { - if (display_id >= m_current_display_modes.size()) { + if (display_id >= (int)m_current_display_modes.size()) { display_id = 0; } bool update_fullscreen = m_window_display_mode != WindowDisplayMode::Windowed && diff --git a/game/system/hid/input_bindings.cpp b/game/system/hid/input_bindings.cpp index 499cca8c59..9ef78c12f9 100644 --- a/game/system/hid/input_bindings.cpp +++ b/game/system/hid/input_bindings.cpp @@ -205,7 +205,7 @@ void InputBindingGroups::assign_analog_bind(u32 sdl_idx, analog_axii[sdl_idx] = {InputBinding((PadData::AnalogIndex)bind_meta.pad_idx, bind_meta.for_analog_minimum, modifiers)}; // there already a bind, so swap (as long as it's not the same key) - if (!current_binds.empty() && current_binds.front().sdl_idx != sdl_idx) { + if (!current_binds.empty() && (u32)current_binds.front().sdl_idx != sdl_idx) { analog_axii[current_binds.front().sdl_idx] = existing_binds; } } else { @@ -254,7 +254,7 @@ void InputBindingGroups::assign_button_bind(u32 sdl_idx, buttons[sdl_idx] = {InputBinding((PadData::ButtonIndex)bind_meta.pad_idx, modifiers)}; } // there already a bind, so swap (as long as it's not the same key) - if (!current_binds.empty() && current_binds.front().sdl_idx != sdl_idx) { + if (!current_binds.empty() && current_binds.front().sdl_idx != (s32)sdl_idx) { if (current_binds.front().analog_button) { button_axii[current_binds.front().sdl_idx] = existing_binds; } else { diff --git a/game/system/hid/input_bindings.h b/game/system/hid/input_bindings.h index f5e9e68780..1728fb0477 100644 --- a/game/system/hid/input_bindings.h +++ b/game/system/hid/input_bindings.h @@ -1,7 +1,5 @@ #pragma once -#pragma once -#include #include #include #include @@ -129,15 +127,15 @@ struct PadData { } void clear() { - for (int i = 0; i < button_data.size(); i++) { - button_data[i] = 0; + for (auto& x : button_data) { + x = 0; } clear_analogs(); } void clear_analogs() { - for (int i = 0; i < analog_data.size(); i++) { - analog_data[i] = ANALOG_NEUTRAL; + for (auto& x : analog_data) { + x = ANALOG_NEUTRAL; } analog_sim_tracker = 0; } diff --git a/game/system/hid/input_manager.cpp b/game/system/hid/input_manager.cpp index a04ee1970f..e8026fc360 100644 --- a/game/system/hid/input_manager.cpp +++ b/game/system/hid/input_manager.cpp @@ -85,7 +85,7 @@ void InputManager::refresh_device_list() { } // If the controller that was last selected to be port 0 is around, prioritize it if (!m_settings->last_selected_controller_guid.empty()) { - for (int i = 0; i < m_available_controllers.size(); i++) { + for (size_t i = 0; i < m_available_controllers.size(); i++) { const auto& controller_guid = m_available_controllers.at(i)->get_guid(); if (controller_guid == m_settings->last_selected_controller_guid) { m_controller_port_mapping[0] = i; @@ -148,7 +148,7 @@ void InputManager::process_sdl_event(const SDL_Event& event, // Send event to active controller device // This goes last so it takes precedence for (const auto& [port, controller_idx] : m_controller_port_mapping) { - if (m_data.find(port) != m_data.end() && m_available_controllers.size() > controller_idx) { + if (m_data.find(port) != m_data.end() && (int)m_available_controllers.size() > controller_idx) { m_available_controllers.at(controller_idx) ->process_event(event, m_command_binds, m_data.at(port), m_waiting_for_bind); } @@ -211,7 +211,7 @@ void InputManager::register_command(const CommandBinding::Source source, } std::string InputManager::get_controller_name(const int controller_id) { - if (controller_id >= m_available_controllers.size()) { + if ((size_t)controller_id >= m_available_controllers.size()) { return ""; } return m_available_controllers.at(controller_id)->get_name(); @@ -226,7 +226,7 @@ std::string InputManager::get_current_bind(const int port, switch (device_type) { case InputDeviceType::CONTROLLER: if (m_controller_port_mapping.find(port) != m_controller_port_mapping.end() && - m_controller_port_mapping.at(port) < m_available_controllers.size() && + m_controller_port_mapping.at(port) < (int)m_available_controllers.size() && m_settings->controller_binds.find( m_available_controllers.at(m_controller_port_mapping.at(port))->get_guid()) != m_settings->controller_binds.end()) { @@ -256,7 +256,7 @@ std::string InputManager::get_current_bind(const int port, } void InputManager::set_controller_for_port(const int controller_id, const int port) { - if (controller_id < m_available_controllers.size()) { + if (controller_id < (int)m_available_controllers.size()) { // Reset inputs as this device won't be able to be read from again! clear_inputs(); auto& controller = m_available_controllers.at(controller_id); @@ -275,7 +275,7 @@ bool InputManager::controller_has_led(const int port) { return false; } const auto id = m_controller_port_mapping.at(port); - if (id >= m_available_controllers.size()) { + if (id >= (int)m_available_controllers.size()) { return false; } return m_available_controllers.at(id)->has_led(); @@ -286,7 +286,7 @@ void InputManager::set_controller_led(const int port, const u8 red, const u8 gre return; } const auto id = m_controller_port_mapping.at(port); - if (id >= m_available_controllers.size()) { + if (id >= (int)m_available_controllers.size()) { return; } m_available_controllers.at(id)->set_led(red, green, blue); @@ -342,7 +342,7 @@ void InputManager::reset_input_bindings_to_defaults(const int port, switch (device_type) { case InputDeviceType::CONTROLLER: if (m_controller_port_mapping.find(port) != m_controller_port_mapping.end() && - m_controller_port_mapping.at(port) < m_available_controllers.size() && + m_controller_port_mapping.at(port) < (int)m_available_controllers.size() && m_settings->controller_binds.find( m_available_controllers.at(m_controller_port_mapping.at(port))->get_guid()) != m_settings->controller_binds.end()) { diff --git a/goal_src/jak1/engine/common-obs/generic-obs.gc b/goal_src/jak1/engine/common-obs/generic-obs.gc index aa2f296797..7a9ab7a693 100644 --- a/goal_src/jak1/engine/common-obs/generic-obs.gc +++ b/goal_src/jak1/engine/common-obs/generic-obs.gc @@ -1249,6 +1249,7 @@ (.mov v1-37 vf16) ) (suspend) + (init-vf0-vector) ) (none) ) diff --git a/goal_src/jak1/levels/sunken/sun-exit-chamber.gc b/goal_src/jak1/levels/sunken/sun-exit-chamber.gc index c76df15d30..1125d1f2e5 100644 --- a/goal_src/jak1/levels/sunken/sun-exit-chamber.gc +++ b/goal_src/jak1/levels/sunken/sun-exit-chamber.gc @@ -287,6 +287,7 @@ (eco-blue-glow gp-1) ) (suspend) + (init-vf0-vector) ) (none) ) diff --git a/goal_src/jak2/engine/draw/drawable.gc b/goal_src/jak2/engine/draw/drawable.gc index d051dc4e24..d31c9d9075 100644 --- a/goal_src/jak2/engine/draw/drawable.gc +++ b/goal_src/jak2/engine/draw/drawable.gc @@ -844,7 +844,6 @@ ;; - does bone calcs for merc ;; - does VU0/CPU stuff for generic/shadow/lightning - (defun dma-add-process-drawable ((pd process-drawable) (dc draw-control) (flag symbol) (dma-buf dma-buffer)) "Draw a normal process-drawable. Set up lighting/shadow settings, then pass on to foreground renderer." (local-vars @@ -1143,8 +1142,12 @@ ) ;; lod hacks! (with-pc - (if (not (-> *pc-settings* ps2-lod-dist?)) - (set! lod-idx (minmax (-> *pc-settings* lod-force-actor) 0 (-> dc lod-set max-lod)))) + (when (not (-> *pc-settings* ps2-lod-dist?)) + (set! lod-idx (minmax (-> *pc-settings* lod-force-actor) 0 (-> dc lod-set max-lod))) + (when (> (-> dc force-lod) -1) + (set! lod-idx (-> dc force-lod)) + ) + ) ) (if (#if (not PC_PORT) (and (< (-> dc lod-set lod lod-idx dist) dist-w) (< (-> dc force-lod) 0)) diff --git a/goal_src/jak2/levels/city/common/pilot-states.gc b/goal_src/jak2/levels/city/common/pilot-states.gc index 083863bd1c..dcf2666c9f 100644 --- a/goal_src/jak2/levels/city/common/pilot-states.gc +++ b/goal_src/jak2/levels/city/common/pilot-states.gc @@ -500,6 +500,7 @@ ) ) ) + (init-vf0-vector) (.svf (&-> (-> gp-0 accel-array) 0 quad) vf0) ) (go target-pilot-stance) diff --git a/goal_src/jak2/levels/mars_tomb/tomb-obs.gc b/goal_src/jak2/levels/mars_tomb/tomb-obs.gc index 75e866f0eb..6d073f24da 100644 --- a/goal_src/jak2/levels/mars_tomb/tomb-obs.gc +++ b/goal_src/jak2/levels/mars_tomb/tomb-obs.gc @@ -1881,6 +1881,8 @@ This commonly includes things such as: (sound-play "tomb-lasr-loop" :id (the-as sound-id (-> self sound-id)) :position s3-1) ) (suspend) + ;; WORKAROUND for GOAL bug - vf0 is clobbered on suspend. + (init-vf0-vector) ) ) ) @@ -1963,6 +1965,8 @@ This commonly includes things such as: (s2-0 s1-0 sv-112) ) (suspend) + ;; WORKAROUND for GOAL bug - vf0 is clobbered on suspend. + (init-vf0-vector) ) ) ) diff --git a/goal_src/jak2/levels/underport/under-shoot-block.gc b/goal_src/jak2/levels/underport/under-shoot-block.gc index 00dd646cb1..9446779998 100644 --- a/goal_src/jak2/levels/underport/under-shoot-block.gc +++ b/goal_src/jak2/levels/underport/under-shoot-block.gc @@ -1421,6 +1421,8 @@ ) ) (suspend) + ;; WORKAROUND for GOAL bug - vf0 is clobbered on suspend. + (init-vf0-vector) ) ) #f