Skip to content

Commit

Permalink
oh shit here we go again
Browse files Browse the repository at this point in the history
  • Loading branch information
Kolyah35 committed Jan 5, 2025
1 parent 443cec9 commit 449522c
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 12 deletions.
6 changes: 3 additions & 3 deletions api/stringPatch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -373,22 +373,22 @@ namespace gdl {
*(int32_t*)(patch + 1) = (int32_t)relAddr;

if (auto p = Mod::get()->patch((void*)blocks[0].start, ByteVector(patch, patch + sizeof(patch))); p.isErr()) {
log::error("patch error {}", p.error());
log::error("patch error {}", p.err());
return false;
}

for (auto i = 1; i < blocks.size(); i++) {
auto& block = blocks[i];
if (block.len < 5) {
if (auto p = Mod::get()->patch((void*)block.start, ByteVector(block.len, 0x90)); p.isErr()) {
log::error("patch error {}", p.error());
log::error("patch error {}", p.err());
return false;
}
} else {
uint8_t patch2[] = {0xe9, 0x00, 0x00, 0x00, 0x00};
*(int32_t*)(patch2 + 1) = block.len - 5;
if (auto p = Mod::get()->patch((void*)block.start, ByteVector(patch2, patch2 + sizeof(patch2))); p.isErr()) {
log::error("patch error {}", p.error());
log::error("patch error {}", p.err());
return false;
}
}
Expand Down
7 changes: 3 additions & 4 deletions mod.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
{
"geode": "3.1.1",
"geode": "4.1.2",
"version": "v2.0.0",
"gd": {
"android": "2.206",
"win": "2.206"
"win": "2.2074"
},
"id": "gdlteam.gdl",
"name": "GDL",
"developer": "GDL Team",
"description": "A mod that translates GD into Russian language",
"description": "Mod that translates GD into Russian language",
"early-load": true,
"resources": {
"files": [
Expand Down
11 changes: 6 additions & 5 deletions src/patches.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,18 @@ using namespace geode::prelude;
void patches::fixCyrillicP() {
// this fixes a bug when comments with cyrillic Р (and other letters containing byte 0xA0) are replaced with something by robtop and break the unicode sequence.
// We patch any other unused byte instead of 0xA0.
Result<Patch*> res;
#if defined(GEODE_IS_WINDOWS)
res = Mod::get()->patch((void*)(base::get() + 0xB44E6), {0x48, 0xC7, 0xC0, 0x01, 0x00, 0x00, 0x00}); // mov rax, 0x01
auto res = Mod::get()->patch((void*)(base::get() + 0xB44E6), {0x48, 0xC7, 0xC0, 0x01, 0x00, 0x00, 0x00}); // mov rax, 0x01
#elif defined(GEODE_IS_ANDROID32)
res = Mod::get()->patch((void*)(base::get() + 0x93E795), {0x01});
auto res = Mod::get()->patch((void*)(base::get() + 0x93E795), {0x01});
#elif defined(GEODE_IS_ANDROID64)
res = Mod::get()->patch((void*)(base::get() + 0xE7F440), {0x01});
auto res = Mod::get()->patch((void*)(base::get() + 0xE7F440), {0x01});
#else
#error "Unsupported platform"
#endif

if (res.isErr())
log::warn("Failed to patch the Рррр fix ({}), be aware that CommentCell with cyrillic comments may crash!", res.error());
log::warn("Failed to patch the Рррр fix ({}), be aware that CommentCell with cyrillic comments may crash!", res.err());
}

void patches::patchStrings() {
Expand Down

0 comments on commit 449522c

Please sign in to comment.