diff --git a/common/util/FileUtil.cpp b/common/util/FileUtil.cpp index 732515f1ad..f9f0626564 100644 --- a/common/util/FileUtil.cpp +++ b/common/util/FileUtil.cpp @@ -88,6 +88,11 @@ fs::path get_user_memcard_dir(GameVersion game_version) { return get_user_config_dir() / game_version_name / "saves"; } +fs::path get_user_screenshots_dir(GameVersion game_version) { + auto game_version_name = game_version_names[game_version]; + return get_user_config_dir() / game_version_name / "screenshots"; +} + fs::path get_user_misc_dir(GameVersion game_version) { auto game_version_name = game_version_names[game_version]; return get_user_config_dir() / game_version_name / "misc"; @@ -695,15 +700,13 @@ void copy_file(const fs::path& src, const fs::path& dst) { std::string make_screenshot_filepath(const GameVersion game_version, const std::string& name) { std::string file_name; if (name.empty()) { - file_name = fmt::format("{}_{}.png", version_to_game_name(game_version), - str_util::current_local_timestamp_no_colons()); + file_name = fmt::format("{}.png", str_util::current_local_timestamp_no_colons()); } else { - file_name = fmt::format("{}_{}_{}.png", version_to_game_name(game_version), name, - str_util::current_local_timestamp_no_colons()); + file_name = fmt::format("{}.png", name); } - const auto file_path = file_util::get_file_path({"screenshots", file_name}); + const auto file_path = get_user_screenshots_dir(game_version) / file_name; file_util::create_dir_if_needed_for_file(file_path); - return file_path; + return file_path.string(); } std::string get_majority_file_line_endings(const std::string& file_contents) { diff --git a/common/util/FileUtil.h b/common/util/FileUtil.h index 942a3d0e7d..3b1c50de1f 100644 --- a/common/util/FileUtil.h +++ b/common/util/FileUtil.h @@ -31,6 +31,7 @@ fs::path get_user_home_dir(); fs::path get_user_config_dir(); fs::path get_user_settings_dir(GameVersion game_version); fs::path get_user_memcard_dir(GameVersion game_version); +fs::path get_user_screenshots_dir(GameVersion game_version); fs::path get_user_misc_dir(GameVersion game_version); fs::path get_jak_project_dir(); diff --git a/game/graphics/opengl_renderer/OpenGLRenderer.cpp b/game/graphics/opengl_renderer/OpenGLRenderer.cpp index b3e6e2980d..18c0ebb05d 100644 --- a/game/graphics/opengl_renderer/OpenGLRenderer.cpp +++ b/game/graphics/opengl_renderer/OpenGLRenderer.cpp @@ -883,8 +883,8 @@ void OpenGLRenderer::setup_frame(const RenderOptions& settings) { m_fbo_state.render_fbo = &m_fbo_state.resources.render_buffer; if (settings.msaa_samples != 1) { - lg::info("FBO Setup: using second temporary buffer: res: {}x{} {}x{}", window_fb.width, - window_fb.height, settings.game_res_w, settings.game_res_h); + lg::info("FBO Setup: using second temporary buffer: res: {}x{}", settings.game_res_w, + settings.game_res_h); // we'll need a temporary fbo to do the msaa resolve step // non-multisampled, and doesn't need z/stencil diff --git a/game/graphics/opengl_renderer/debug_gui.cpp b/game/graphics/opengl_renderer/debug_gui.cpp index d51a2a469b..48383211a2 100644 --- a/game/graphics/opengl_renderer/debug_gui.cpp +++ b/game/graphics/opengl_renderer/debug_gui.cpp @@ -117,7 +117,7 @@ void OpenGlDebugGui::draw(const DmaStats& dma_stats) { ImGui::InputInt("Width", &screenshot_width); ImGui::InputInt("Height", &screenshot_height); ImGui::InputInt("MSAA", &screenshot_samples); - ImGui::Checkbox("Screenshot on F2", &screenshot_hotkey_enabled); + ImGui::Checkbox("Quick-Screenshot on F2", &screenshot_hotkey_enabled); ImGui::EndMenu(); } ImGui::MenuItem("Subtitle Editor", nullptr, &m_subtitle_editor); diff --git a/game/graphics/opengl_renderer/debug_gui.h b/game/graphics/opengl_renderer/debug_gui.h index 5d4aa0010c..f8f0d0b1ae 100644 --- a/game/graphics/opengl_renderer/debug_gui.h +++ b/game/graphics/opengl_renderer/debug_gui.h @@ -84,6 +84,6 @@ class OpenGlDebugGui { bool m_subtitle_editor = false; bool m_filters_menu = false; bool m_want_screenshot = false; - char m_screenshot_save_name[256] = "screenshot.png"; + char m_screenshot_save_name[256] = "screenshot"; float target_fps_input = 60.f; }; diff --git a/game/graphics/pipelines/opengl.cpp b/game/graphics/pipelines/opengl.cpp index c49ccae8a8..9d68a8fb46 100644 --- a/game/graphics/pipelines/opengl.cpp +++ b/game/graphics/pipelines/opengl.cpp @@ -130,8 +130,9 @@ static int gl_init(GfxGlobalSettings& settings) { SDL_GL_SetAttribute(SDL_GL_CONTEXT_FLAGS, 0); } SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 4); +#ifndef __APPLE__ SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 3); -#ifdef __APPLE__ +#else SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 1); #endif SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, 24); @@ -400,8 +401,11 @@ void render_game_frame(int game_width, } if (g_gfx_data->debug_gui.get_screenshot_flag()) { options.save_screenshot = true; + options.internal_res_screenshot = true; options.game_res_w = g_gfx_data->debug_gui.screenshot_width; options.game_res_h = g_gfx_data->debug_gui.screenshot_height; + options.window_framebuffer_width = options.game_res_w; + options.window_framebuffer_height = options.game_res_h; options.draw_region_width = options.game_res_w; options.draw_region_height = options.game_res_h; options.msaa_samples = g_gfx_data->debug_gui.screenshot_samples;