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

qimageinterface fixes, remove old lodepng, address more comments

This commit is contained in:
Khangaroo 2019-08-07 14:21:47 -04:00 committed by James Rowe
parent 93aab2c109
commit 391e552927
10 changed files with 32 additions and 7959 deletions

View File

@ -1,7 +1,7 @@
add_library(lodepng add_library(lodepng
lodepng.cpp lodepng/lodepng.cpp
lodepng.h lodepng/lodepng.h
) )
create_target_directory_groups(lodepng) create_target_directory_groups(lodepng)
target_include_directories(lodepng INTERFACE .) target_include_directories(lodepng INTERFACE lodepng)

View File

@ -1,21 +0,0 @@
Copyright (c) 2005-2018 Lode Vandevenne
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be
appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
3. This notice may not be removed or altered from any source
distribution.

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -18,8 +18,19 @@ ConfigureGraphics::ConfigureGraphics(QWidget* parent)
SetConfiguration(); SetConfiguration();
ui->hw_renderer_group->setEnabled(ui->toggle_hw_renderer->isChecked()); ui->hw_renderer_group->setEnabled(ui->toggle_hw_renderer->isChecked());
connect(ui->toggle_hw_renderer, &QCheckBox::toggled, ui->hw_renderer_group, connect(ui->toggle_hw_renderer, &QCheckBox::toggled, this, [this] {
&QWidget::setEnabled); auto checked = ui->toggle_hw_renderer->isChecked();
ui->hw_renderer_group->setEnabled(checked);
ui->toggle_custom_textures->setEnabled(checked);
ui->toggle_dump_textures->setEnabled(checked);
ui->toggle_preload_textures->setEnabled(checked);
if (!checked) {
ui->toggle_custom_textures->setChecked(false);
ui->toggle_dump_textures->setChecked(false);
ui->toggle_preload_textures->setChecked(false);
}
});
ui->hw_shader_group->setEnabled(ui->toggle_hw_shader->isChecked()); ui->hw_shader_group->setEnabled(ui->toggle_hw_shader->isChecked());
connect(ui->toggle_hw_shader, &QCheckBox::toggled, ui->hw_shader_group, &QWidget::setEnabled); connect(ui->toggle_hw_shader, &QCheckBox::toggled, ui->hw_shader_group, &QWidget::setEnabled);
#ifdef __APPLE__ #ifdef __APPLE__

View File

@ -340,7 +340,7 @@
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Replace textures with PNG files.&lt;/p&gt;&lt;p&gt;Textures are loaded from load/textures/[Title ID]/.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string> <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Replace textures with PNG files.&lt;/p&gt;&lt;p&gt;Textures are loaded from load/textures/[Title ID]/.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property> </property>
<property name="text"> <property name="text">
<string>Use Custom Textures (Hardware Renderer only)</string> <string>Use Custom Textures</string>
</property> </property>
</widget> </widget>
</item> </item>
@ -350,7 +350,7 @@
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Dump textures to PNG files.&lt;/p&gt;&lt;p&gt;Textures are dumped to dump/textures/[Title ID]/.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string> <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Dump textures to PNG files.&lt;/p&gt;&lt;p&gt;Textures are dumped to dump/textures/[Title ID]/.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property> </property>
<property name="text"> <property name="text">
<string>Dump Textures (Hardware Renderer only)</string> <string>Dump Textures</string>
</property> </property>
</widget> </widget>
</item> </item>

View File

@ -21,9 +21,9 @@ bool QtImageInterface::DecodePNG(std::vector<u8>& dst, u32& width, u32& height,
height = image.height(); height = image.height();
// Write RGBA8 to vector // Write RGBA8 to vector
for (u32 y = 1; y < image.height() + 1; y++) { for (int y = 0; y < image.height(); y++) {
for (u32 x = 1; x < image.width() + 1; x++) { for (int x = 0; x < image.width(); x++) {
const QColor pixel(image.pixel(y, x)); const QColor pixel(image.pixelColor(x, y));
dst.push_back(pixel.red()); dst.push_back(pixel.red());
dst.push_back(pixel.green()); dst.push_back(pixel.green());
dst.push_back(pixel.blue()); dst.push_back(pixel.blue());
@ -38,7 +38,7 @@ bool QtImageInterface::EncodePNG(const std::string& path, const std::vector<u8>&
u32 height) { u32 height) {
QImage image(src.data(), width, height, QImage::Format_RGBA8888); QImage image(src.data(), width, height, QImage::Format_RGBA8888);
if (!image.save(QString::fromStdString(path))) { if (!image.save(QString::fromStdString(path), "PNG")) {
LOG_ERROR(Frontend, "Failed to save {}", path); LOG_ERROR(Frontend, "Failed to save {}", path);
return false; return false;
} }

View File

@ -24,11 +24,11 @@ bool CustomTexCache::IsTextureCached(u64 hash) const {
return custom_textures.find(hash) != custom_textures.end(); return custom_textures.find(hash) != custom_textures.end();
} }
const CustomTexInfo& CustomTexCache::LookupTexture(const u64 hash) { const CustomTexInfo& CustomTexCache::LookupTexture(u64 hash) {
return custom_textures.at(hash); return custom_textures.at(hash);
} }
void CustomTexCache::CacheTexture(const u64 hash, const std::vector<u8>& tex, u32 width, void CustomTexCache::CacheTexture(u64 hash, const std::vector<u8>& tex, u32 width,
u32 height) { u32 height) {
custom_textures[hash] = {width, height, tex}; custom_textures[hash] = {width, height, tex};
} }

View File

@ -13,6 +13,9 @@ namespace Frontend {
class ImageInterface { class ImageInterface {
public: public:
ImageInterface() = default;
~ImageInterface() = default;
// Error logging should be handled by the frontend // Error logging should be handled by the frontend
virtual bool DecodePNG(std::vector<u8>& dst, u32& width, u32& height, const std::string& path) { virtual bool DecodePNG(std::vector<u8>& dst, u32& width, u32& height, const std::string& path) {
LOG_CRITICAL(Frontend, "Attempted to decode PNG without an image interface!"); LOG_CRITICAL(Frontend, "Attempted to decode PNG without an image interface!");

View File

@ -955,11 +955,13 @@ void CachedSurface::UploadGLTexture(const Common::Rectangle<u32>& rect, GLuint r
if (Settings::values.custom_textures) if (Settings::values.custom_textures)
use_custom_tex = LoadCustomTexture(tex_hash, custom_tex_info, custom_rect); use_custom_tex = LoadCustomTexture(tex_hash, custom_tex_info, custom_rect);
if (Settings::values.dump_textures && !use_custom_tex) if (Settings::values.dump_textures && !use_custom_tex) {
if (auto temp_dump_path = GetDumpPath(tex_hash)) { auto temp_dump_path = GetDumpPath(tex_hash);
dump_path = temp_dump_path.value(); if (temp_dump_path.has_value()) {
dump_path = *temp_dump_path;
dump_tex = true; dump_tex = true;
} }
}
// Load data from memory to the surface // Load data from memory to the surface
GLint x0 = static_cast<GLint>(custom_rect.left); GLint x0 = static_cast<GLint>(custom_rect.left);