Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ExeReader: Support 64 Bit executables #3317

Merged
merged 1 commit into from
Dec 22, 2024
Merged

Conversation

Ghabry
Copy link
Member

@Ghabry Ghabry commented Dec 21, 2024

Maniac Patch is now detected when the new exe is used.


The difference between 32bit PE and 64 bit PE is actually not that huge when you only care about the resources.

The differences:

  • The machine type is 0x8664
  • In the optional header the magic at the beginning is 0x20b instead of 0x10b (0x20b is a "PE32+" header, 0x10b is a "PE32" header)
  • The data direction offset is different because the PE32+ image file header is larger

The offset calculation was the major change:

Before the resource offset was hardcoded to 0x88 (136) which is actually size_of_optional_header (24) + size_of_image_file_header (96/112 [PE+]) + 16.

All the resource format itself is the same. (lucky for us).


Tested it with:

Player.exe, both 32 Bit and 64 Bit: PASSED

Maniac exe: PASSED

Various RPG_RT (32 bit): PASSED

@Ghabry Ghabry added this to the 0.8.1 milestone Dec 21, 2024
src/exe_reader.cpp Outdated Show resolved Hide resolved
Maniac Patch is now detected when the new exe is used.

The difference between 32bit PE and 64 bit PE is actually not that huge when you only care about the resources.

The differences:

- The machine type is 0x8664
- In the optional header the magic at the beginning is 0x20b instead of 0x10b (0x20b is a "PE32+" header, 0x10b is a "PE32" header)
- The data direction offset is different because the PE32+ image file header is larger

The offset calculation was the major change:

Before the resource offset was hardcoded to 0x88 (136) which is actually "size_of_optional_header (24) + size_of_image_file_header (96/112 [PE+]) + 16".
@carstene1ns carstene1ns merged commit 39b022f into EasyRPG:master Dec 22, 2024
14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging this pull request may close these issues.

3 participants