From 5450d4980da133d30ada1a63eae98b36d0ed400f Mon Sep 17 00:00:00 2001 From: Khangaroo Date: Sat, 17 Aug 2019 09:15:18 -0400 Subject: [PATCH] crash hotfix (no clang-format because on phone) hotfix 2: check if the texture is custom before dumping hotfix 4: fix custom texture conflict detection --- src/citra/lodepng_image_interface.cpp | 2 +- src/citra_qt/configuration/configure_enhancements.cpp | 3 --- src/core/core.cpp | 4 ++-- src/core/custom_tex_cache.cpp | 5 +++-- src/video_core/renderer_opengl/gl_rasterizer_cache.cpp | 2 +- 5 files changed, 7 insertions(+), 9 deletions(-) diff --git a/src/citra/lodepng_image_interface.cpp b/src/citra/lodepng_image_interface.cpp index ecf8b21b22..e490f40a75 100644 --- a/src/citra/lodepng_image_interface.cpp +++ b/src/citra/lodepng_image_interface.cpp @@ -3,8 +3,8 @@ // Refer to the license.txt file included. #include -#include "common/logging/log.h" #include "citra/lodepng_image_interface.h" +#include "common/logging/log.h" bool LodePNGImageInterface::DecodePNG(std::vector& dst, u32& width, u32& height, const std::string& path) { diff --git a/src/citra_qt/configuration/configure_enhancements.cpp b/src/citra_qt/configuration/configure_enhancements.cpp index 33fc1298fc..677f868c20 100644 --- a/src/citra_qt/configuration/configure_enhancements.cpp +++ b/src/citra_qt/configuration/configure_enhancements.cpp @@ -99,9 +99,6 @@ void ConfigureEnhancements::ApplyConfiguration() { Settings::values.swap_screen = ui->swap_screen->isChecked(); Settings::values.dump_textures = ui->toggle_dump_textures->isChecked(); Settings::values.custom_textures = ui->toggle_custom_textures->isChecked(); - auto& custom_tex_cache = Core::System::GetInstance().CustomTexCache(); - if (Settings::values.custom_textures && custom_tex_cache.IsTexturePathMapEmpty()) - custom_tex_cache.FindCustomTextures(); Settings::values.preload_textures = ui->toggle_preload_textures->isChecked(); Settings::values.bg_red = static_cast(bg_color.redF()); Settings::values.bg_green = static_cast(bg_color.greenF()); diff --git a/src/core/core.cpp b/src/core/core.cpp index 66e661e4a8..c0dc93b559 100644 --- a/src/core/core.cpp +++ b/src/core/core.cpp @@ -198,8 +198,8 @@ System::ResultStatus System::Init(Frontend::EmuWindow& emu_window, u32 system_mo timing = std::make_unique(); - kernel = std::make_unique( - *memory, *timing, [this] { PrepareReschedule(); }, system_mode); + kernel = std::make_unique(*memory, *timing, + [this] { PrepareReschedule(); }, system_mode); if (Settings::values.use_cpu_jit) { #ifdef ARCHITECTURE_x86_64 diff --git a/src/core/custom_tex_cache.cpp b/src/core/custom_tex_cache.cpp index 29cbf63d1e..c0b42f5150 100644 --- a/src/core/custom_tex_cache.cpp +++ b/src/core/custom_tex_cache.cpp @@ -34,7 +34,7 @@ void CustomTexCache::CacheTexture(u64 hash, const std::vector& tex, u32 widt } void CustomTexCache::AddTexturePath(u64 hash, const std::string& path) { - if (custom_textures.count(hash)) + if (custom_texture_paths.count(hash)) LOG_ERROR(Core, "Textures {} and {} conflict!", custom_texture_paths[hash].path, path); else custom_texture_paths[hash] = {path, hash}; @@ -79,7 +79,8 @@ void CustomTexCache::PreloadTextures() { const auto& image_interface = Core::System::GetInstance().GetImageInterface(); const auto& path_info = path.second; Core::CustomTexInfo tex_info; - if (image_interface->DecodePNG(tex_info.tex, tex_info.width, tex_info.height, path_info.path)) { + if (image_interface->DecodePNG(tex_info.tex, tex_info.width, tex_info.height, + path_info.path)) { // Make sure the texture size is a power of 2 if ((ceil(log2(tex_info.width)) == floor(log2(tex_info.width))) && (ceil(log2(tex_info.height)) == floor(log2(tex_info.height)))) { diff --git a/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp b/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp index fae91b3c49..65f3000dd7 100644 --- a/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp +++ b/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp @@ -1009,7 +1009,7 @@ void CachedSurface::UploadGLTexture(const Common::Rectangle& rect, GLuint r } glPixelStorei(GL_UNPACK_ROW_LENGTH, 0); - if (Settings::values.dump_textures) + if (Settings::values.dump_textures && !is_custom) DumpTexture(target_tex, tex_hash); cur_state.texture_units[0].texture_2d = old_tex;