fix crashes, add custom texture cache, load textures from load directory
This commit is contained in:
parent
f866b2a917
commit
6d90c42a79
16 changed files with 167 additions and 49 deletions
|
@ -36,6 +36,8 @@ add_library(core STATIC
|
|||
core.h
|
||||
core_timing.cpp
|
||||
core_timing.h
|
||||
custom_tex_cache.cpp
|
||||
custom_tex_cache.h
|
||||
dumping/backend.cpp
|
||||
dumping/backend.h
|
||||
file_sys/archive_backend.cpp
|
||||
|
|
|
@ -16,10 +16,14 @@
|
|||
#include "core/cheats/cheats.h"
|
||||
#include "core/core.h"
|
||||
#include "core/core_timing.h"
|
||||
<<<<<<< HEAD
|
||||
#include "core/dumping/backend.h"
|
||||
#ifdef ENABLE_FFMPEG_VIDEO_DUMPER
|
||||
#include "core/dumping/ffmpeg_backend.h"
|
||||
#endif
|
||||
=======
|
||||
#include "core/custom_tex_cache.h"
|
||||
>>>>>>> 387a49d7... fix crashes, add custom texture cache, load textures from load directory
|
||||
#include "core/gdbstub/gdbstub.h"
|
||||
#include "core/hle/kernel/client_port.h"
|
||||
#include "core/hle/kernel/kernel.h"
|
||||
|
@ -146,12 +150,16 @@ System::ResultStatus System::Load(Frontend::EmuWindow& emu_window, const std::st
|
|||
}
|
||||
}
|
||||
cheat_engine = std::make_unique<Cheats::CheatEngine>(*this);
|
||||
<<<<<<< HEAD
|
||||
u64 title_id{0};
|
||||
if (app_loader->ReadProgramId(title_id) != Loader::ResultStatus::Success) {
|
||||
LOG_ERROR(Core, "Failed to find title id for ROM (Error {})",
|
||||
static_cast<u32>(load_result));
|
||||
}
|
||||
perf_stats = std::make_unique<PerfStats>(title_id);
|
||||
=======
|
||||
custom_tex_cache = std::make_unique<Core::CustomTexCache>();
|
||||
>>>>>>> 387a49d7... fix crashes, add custom texture cache, load textures from load directory
|
||||
status = ResultStatus::Success;
|
||||
m_emu_window = &emu_window;
|
||||
m_filepath = filepath;
|
||||
|
@ -290,12 +298,21 @@ const Cheats::CheatEngine& System::CheatEngine() const {
|
|||
return *cheat_engine;
|
||||
}
|
||||
|
||||
<<<<<<< HEAD
|
||||
VideoDumper::Backend& System::VideoDumper() {
|
||||
return *video_dumper;
|
||||
}
|
||||
|
||||
const VideoDumper::Backend& System::VideoDumper() const {
|
||||
return *video_dumper;
|
||||
=======
|
||||
Core::CustomTexCache& System::CustomTexCache() {
|
||||
return *custom_tex_cache;
|
||||
}
|
||||
|
||||
const Core::CustomTexCache& System::CustomTexCache() const {
|
||||
return *custom_tex_cache;
|
||||
>>>>>>> 387a49d7... fix crashes, add custom texture cache, load textures from load directory
|
||||
}
|
||||
|
||||
void System::RegisterMiiSelector(std::shared_ptr<Frontend::MiiSelector> mii_selector) {
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
#include <memory>
|
||||
#include <string>
|
||||
#include "common/common_types.h"
|
||||
#include "core/custom_tex_cache.h"
|
||||
#include "core/frontend/applets/mii_selector.h"
|
||||
#include "core/frontend/applets/swkbd.h"
|
||||
#include "core/loader/loader.h"
|
||||
|
@ -216,7 +217,12 @@ public:
|
|||
/// Gets a const reference to the video dumper backend
|
||||
const VideoDumper::Backend& VideoDumper() const;
|
||||
|
||||
std::unique_ptr<PerfStats> perf_stats;
|
||||
/// Gets a reference to the custom texture cache system
|
||||
Core::CustomTexCache& CustomTexCache();
|
||||
|
||||
/// Gets a const reference to the custom texture cache system
|
||||
const Core::CustomTexCache& CustomTexCache() const;
|
||||
|
||||
FrameLimiter frame_limiter;
|
||||
|
||||
void SetStatus(ResultStatus new_status, const char* details = nullptr) {
|
||||
|
@ -289,6 +295,9 @@ private:
|
|||
/// Video dumper backend
|
||||
std::unique_ptr<VideoDumper::Backend> video_dumper;
|
||||
|
||||
/// Custom texture cache system
|
||||
std::unique_ptr<Core::CustomTexCache> custom_tex_cache;
|
||||
|
||||
/// RPC Server for scripting support
|
||||
std::unique_ptr<RPC::RPCServer> rpc_server;
|
||||
|
||||
|
|
27
src/core/custom_tex_cache.cpp
Normal file
27
src/core/custom_tex_cache.cpp
Normal file
|
@ -0,0 +1,27 @@
|
|||
#include <stdexcept>
|
||||
#include <vector>
|
||||
#include "common/common_types.h"
|
||||
#include "custom_tex_cache.h"
|
||||
|
||||
namespace Core {
|
||||
const bool CustomTexCache::IsTextureDumped(const u64 hash) {
|
||||
return dumped_textures.find(hash) != dumped_textures.end();
|
||||
}
|
||||
|
||||
void CustomTexCache::SetTextureDumped(const u64 hash) {
|
||||
dumped_textures[hash] = true;
|
||||
}
|
||||
|
||||
const bool CustomTexCache::IsTextureCached(const u64 hash) {
|
||||
return custom_textures.find(hash) != custom_textures.end();
|
||||
}
|
||||
|
||||
const CustomTexInfo& CustomTexCache::LookupTexture(const u64 hash) {
|
||||
return custom_textures.at(hash);
|
||||
}
|
||||
|
||||
void CustomTexCache::CacheTexture(const u64 hash, const std::vector<u8>& tex, u32 width,
|
||||
u32 height) {
|
||||
custom_textures[hash] = {width, height, tex};
|
||||
}
|
||||
} // namespace Core
|
28
src/core/custom_tex_cache.h
Normal file
28
src/core/custom_tex_cache.h
Normal file
|
@ -0,0 +1,28 @@
|
|||
#pragma once
|
||||
|
||||
#include <unordered_map>
|
||||
#include <vector>
|
||||
#include "common/common_types.h"
|
||||
|
||||
namespace Core {
|
||||
struct CustomTexInfo {
|
||||
u32 width;
|
||||
u32 height;
|
||||
std::vector<u8> tex;
|
||||
};
|
||||
|
||||
// TODO: think of a better name for this class...
|
||||
class CustomTexCache {
|
||||
public:
|
||||
const bool IsTextureDumped(const u64 hash);
|
||||
void SetTextureDumped(const u64 hash);
|
||||
|
||||
const bool IsTextureCached(const u64 hash);
|
||||
const CustomTexInfo& LookupTexture(const u64 hash);
|
||||
void CacheTexture(const u64 hash, const std::vector<u8>& tex, u32 width, u32 height);
|
||||
|
||||
private:
|
||||
std::unordered_map<u64, bool> dumped_textures;
|
||||
std::unordered_map<u64, CustomTexInfo> custom_textures;
|
||||
};
|
||||
} // namespace Core
|
|
@ -88,6 +88,7 @@ void LogSettings() {
|
|||
LogSetting("Layout_LayoutOption", static_cast<int>(Settings::values.layout_option));
|
||||
LogSetting("Layout_SwapScreen", Settings::values.swap_screen);
|
||||
LogSetting("Utility_DumpTextures", Settings::values.dump_textures);
|
||||
LogSetting("Utility_CustomTextures", Settings::values.custom_textures);
|
||||
LogSetting("Audio_EnableDspLle", Settings::values.enable_dsp_lle);
|
||||
LogSetting("Audio_EnableDspLleMultithread", Settings::values.enable_dsp_lle_multithread);
|
||||
LogSetting("Audio_OutputEngine", Settings::values.sink_id);
|
||||
|
|
|
@ -171,6 +171,7 @@ struct Values {
|
|||
std::string pp_shader_name;
|
||||
|
||||
bool dump_textures;
|
||||
bool custom_textures;
|
||||
|
||||
// Audio
|
||||
bool enable_dsp_lle;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue