citra-emu
/
citra-canary
Archived
1
0
Fork 0

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
This commit is contained in:
Khangaroo 2019-08-17 09:15:18 -04:00 committed by James Rowe
parent ae4aaf2fc1
commit 5450d4980d
5 changed files with 7 additions and 9 deletions

View File

@ -3,8 +3,8 @@
// Refer to the license.txt file included. // Refer to the license.txt file included.
#include <lodepng.h> #include <lodepng.h>
#include "common/logging/log.h"
#include "citra/lodepng_image_interface.h" #include "citra/lodepng_image_interface.h"
#include "common/logging/log.h"
bool LodePNGImageInterface::DecodePNG(std::vector<u8>& dst, u32& width, u32& height, bool LodePNGImageInterface::DecodePNG(std::vector<u8>& dst, u32& width, u32& height,
const std::string& path) { const std::string& path) {

View File

@ -99,9 +99,6 @@ void ConfigureEnhancements::ApplyConfiguration() {
Settings::values.swap_screen = ui->swap_screen->isChecked(); Settings::values.swap_screen = ui->swap_screen->isChecked();
Settings::values.dump_textures = ui->toggle_dump_textures->isChecked(); Settings::values.dump_textures = ui->toggle_dump_textures->isChecked();
Settings::values.custom_textures = ui->toggle_custom_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.preload_textures = ui->toggle_preload_textures->isChecked();
Settings::values.bg_red = static_cast<float>(bg_color.redF()); Settings::values.bg_red = static_cast<float>(bg_color.redF());
Settings::values.bg_green = static_cast<float>(bg_color.greenF()); Settings::values.bg_green = static_cast<float>(bg_color.greenF());

View File

@ -198,8 +198,8 @@ System::ResultStatus System::Init(Frontend::EmuWindow& emu_window, u32 system_mo
timing = std::make_unique<Timing>(); timing = std::make_unique<Timing>();
kernel = std::make_unique<Kernel::KernelSystem>( kernel = std::make_unique<Kernel::KernelSystem>(*memory, *timing,
*memory, *timing, [this] { PrepareReschedule(); }, system_mode); [this] { PrepareReschedule(); }, system_mode);
if (Settings::values.use_cpu_jit) { if (Settings::values.use_cpu_jit) {
#ifdef ARCHITECTURE_x86_64 #ifdef ARCHITECTURE_x86_64

View File

@ -34,7 +34,7 @@ void CustomTexCache::CacheTexture(u64 hash, const std::vector<u8>& tex, u32 widt
} }
void CustomTexCache::AddTexturePath(u64 hash, const std::string& path) { 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); LOG_ERROR(Core, "Textures {} and {} conflict!", custom_texture_paths[hash].path, path);
else else
custom_texture_paths[hash] = {path, hash}; custom_texture_paths[hash] = {path, hash};
@ -79,7 +79,8 @@ void CustomTexCache::PreloadTextures() {
const auto& image_interface = Core::System::GetInstance().GetImageInterface(); const auto& image_interface = Core::System::GetInstance().GetImageInterface();
const auto& path_info = path.second; const auto& path_info = path.second;
Core::CustomTexInfo tex_info; 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 // Make sure the texture size is a power of 2
if ((ceil(log2(tex_info.width)) == floor(log2(tex_info.width))) && if ((ceil(log2(tex_info.width)) == floor(log2(tex_info.width))) &&
(ceil(log2(tex_info.height)) == floor(log2(tex_info.height)))) { (ceil(log2(tex_info.height)) == floor(log2(tex_info.height)))) {

View File

@ -1009,7 +1009,7 @@ void CachedSurface::UploadGLTexture(const Common::Rectangle<u32>& rect, GLuint r
} }
glPixelStorei(GL_UNPACK_ROW_LENGTH, 0); glPixelStorei(GL_UNPACK_ROW_LENGTH, 0);
if (Settings::values.dump_textures) if (Settings::values.dump_textures && !is_custom)
DumpTexture(target_tex, tex_hash); DumpTexture(target_tex, tex_hash);
cur_state.texture_units[0].texture_2d = old_tex; cur_state.texture_units[0].texture_2d = old_tex;