From c570445df7779255fa4b4354bc3d559b9dd011bf Mon Sep 17 00:00:00 2001 From: zhangwei Date: Thu, 8 Jun 2023 17:09:18 +0800 Subject: [PATCH] fx --- .../src/main/assets/config/config-games.ini | 6 ++-- src/core/cheats/gateway_cheat.cpp | 31 +++++++++++++++++++ src/core/cheats/gateway_cheat.h | 1 + src/core/core.h | 2 ++ src/core/settings.h | 2 ++ 5 files changed, 39 insertions(+), 3 deletions(-) diff --git a/src/android/app/src/main/assets/config/config-games.ini b/src/android/app/src/main/assets/config/config-games.ini index 23fc04f30a7..01e54ee49ce 100644 --- a/src/android/app/src/main/assets/config/config-games.ini +++ b/src/android/app/src/main/assets/config/config-games.ini @@ -339,9 +339,9 @@ 000400000012DE00,180A6280 00040000001A2B00,18108D00 0004000000166B00,18407B00 -000400000016E100,18084800,18080800,1847D400,1849D400 -000400000011D700,18084800,18080800,1847D400,1849D400 -0004000000197100,18084800,18080800,1847D400,1849D400 +000400000016E100,18084800,18080800 +000400000011D700,18084800,18080800 +0004000000197100,18084800,18080800 0004000000072000,18422000,18412000 0004000000144500,18400100,18404180 00040000001A4800,18025180,1802A700,18024100,18029680,18020080 diff --git a/src/core/cheats/gateway_cheat.cpp b/src/core/cheats/gateway_cheat.cpp index af61375936d..628f736cf49 100644 --- a/src/core/cheats/gateway_cheat.cpp +++ b/src/core/cheats/gateway_cheat.cpp @@ -178,6 +178,31 @@ static inline void PatchOp(const GatewayCheat::CheatLine& line, State& state, Co } } +static inline void ShowText(const GatewayCheat::CheatLine& line, State& state, + Core::System& system) { + std::string result; + std::array texts; + texts[0] = (line.address >> 16) & 0xFF; + texts[1] = (line.address >> 8) & 0xFF; + texts[2] = (line.address >> 0) & 0xFF; + + texts[3] = (line.value >> 24) & 0xFF; + texts[4] = (line.value >> 16) & 0xFF; + texts[5] = (line.value >> 8) & 0xFF; + texts[6] = (line.value >> 0) & 0xFF; + + for (auto c : texts) { + if (c > 0) { + result += c; + } else { + break; + } + } + + result += std::to_string(state.reg); + system.cheat_texts.emplace_back(std::move(result)); +} + GatewayCheat::CheatLine::CheatLine(const std::string& line) { constexpr std::size_t cheat_length = 17; if (line.length() != cheat_length) { @@ -230,6 +255,7 @@ GatewayCheat::~GatewayCheat() = default; void GatewayCheat::Execute(Core::System& system) const { State state; + system.cheat_texts.clear(); Memory::MemorySystem& memory = system.Memory(); auto Read8 = [&memory](VAddr addr) { return memory.Read8(addr); }; auto Read16 = [&memory](VAddr addr) { return memory.Read16(addr); }; @@ -418,6 +444,11 @@ void GatewayCheat::Execute(Core::System& system) const { PatchOp(line, state, system, cheat_lines); break; } + case CheatType::ShowText: { + // F0XXXXXX XXXXXXXX + ShowText(line, state, system); + break; + } } } } diff --git a/src/core/cheats/gateway_cheat.h b/src/core/cheats/gateway_cheat.h index 46512fb96dd..009eba63950 100644 --- a/src/core/cheats/gateway_cheat.h +++ b/src/core/cheats/gateway_cheat.h @@ -41,6 +41,7 @@ class GatewayCheat final : public CheatBase { AddOffset = 0xDC, Joker = 0xDD, Patch = 0xE, + ShowText= 0xF, }; struct CheatLine { diff --git a/src/core/core.h b/src/core/core.h index ae97406462c..3eb48ee9bd6 100644 --- a/src/core/core.h +++ b/src/core/core.h @@ -272,6 +272,8 @@ class System { /// void SetCpuUsageLimit(bool enabled); + std::vector cheat_texts; + private: /** * Initialize the emulated system. diff --git a/src/core/settings.h b/src/core/settings.h index 97d5a0996dc..287c9de3048 100644 --- a/src/core/settings.h +++ b/src/core/settings.h @@ -226,6 +226,8 @@ struct Values { AccurateMul shaders_accurate_mul; std::string remote_shader_host; u8 force_texture_filter; + float joystick_range; + float joystick_deadzone; // WebService std::string web_api_url;