Skip to content

Commit

Permalink
fx
Browse files Browse the repository at this point in the history
  • Loading branch information
zhangwei committed Jun 8, 2023
1 parent 899edcc commit c570445
Show file tree
Hide file tree
Showing 5 changed files with 39 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/android/app/src/main/assets/config/config-games.ini
Expand Up @@ -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
31 changes: 31 additions & 0 deletions src/core/cheats/gateway_cheat.cpp
Expand Up @@ -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<char, 7> 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) {
Expand Down Expand Up @@ -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); };
Expand Down Expand Up @@ -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;
}
}
}
}
Expand Down
1 change: 1 addition & 0 deletions src/core/cheats/gateway_cheat.h
Expand Up @@ -41,6 +41,7 @@ class GatewayCheat final : public CheatBase {
AddOffset = 0xDC,
Joker = 0xDD,
Patch = 0xE,
ShowText= 0xF,
};

struct CheatLine {
Expand Down
2 changes: 2 additions & 0 deletions src/core/core.h
Expand Up @@ -272,6 +272,8 @@ class System {
///
void SetCpuUsageLimit(bool enabled);

std::vector<std::string> cheat_texts;

private:
/**
* Initialize the emulated system.
Expand Down
2 changes: 2 additions & 0 deletions src/core/settings.h
Expand Up @@ -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;
Expand Down

0 comments on commit c570445

Please sign in to comment.