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

Support dynamic base addresses #3

Closed
nmlgc opened this issue Jul 6, 2013 · 2 comments
Closed

Support dynamic base addresses #3

nmlgc opened this issue Jul 6, 2013 · 2 comments
Assignees
Milestone

Comments

@nmlgc
Copy link
Contributor

nmlgc commented Jul 6, 2013

Dynamic base addresses

Description

Right now, thcrap_loader, the binary hack system and the breakpoint system all assume a game's main module to be loaded at a constant place in memory. Thus, a game loaded to a dynamic base address essentially can't be patched at all.

This feature is required for supporting Hopeless Masquerade and the PC-98 games at all.

Prerequisites

None.

Implementation

  • For binary hack and breakpoint addresses, add rva as an alternative key for addresses relative to the module's base address.
@Riatre
Copy link

Riatre commented Aug 12, 2013

Would you like to explain why we need a scheme using PE section names?
I think finding the base address by module name(maybe NULL for main exe module) then using RVA to locate is enough for binhack and breakpoint addresses, at least on Windows. For PC-98 DOS, there are even no PE sections.

@nmlgc
Copy link
Contributor Author

nmlgc commented Aug 14, 2013

Yeah, you're right. I was under the impression that base address randomization could also randomly move the individual PE sections, but after some research (which I admittedly haven't done when posting the implementation part), that doesn't seem to be the case.

On PC-98 DOS, I have verified that, I just wasn't so sure about Windows. So, RVA is the way to go.

@ghost ghost assigned nmlgc Aug 25, 2013
nmlgc pushed a commit that referenced this issue Sep 9, 2013
…e's base address.

First half of #3. A lot cleaner than what I originally had in mind.
@nmlgc nmlgc closed this as completed in 80605dc Sep 11, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants