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

Add 東京Necro hook #362

Merged

Conversation

Jazzinghen
Copy link
Contributor

Tl;dr

Added a 東京Necro hook after finding it using Cheat Engine.

The hook code is the following: HS-14*8@B5420:TokyoNecro.exe

Implementation details

  • Modified engine match function to check for TOKYONECRO as text resource if Nitroplus package files are found
  • Added a hooking function to the engine

Testing

  • Try to hook 東京Necro and all the text should appear

Additional notes

  • There is an additional hook that I found on a wiki that can extract the contents of the Encyclopedia as they are shown on the screen, we could add that as a secondary hook
  • The hook also gets the real-time clock that's rendered on the main menu
  • The hook doesn't seem to get the very first string after loading a game

This thing is pointing at a wrong memory location due to the fact that
there's another function that STARTS THE SAME.

I'll use another method to do this.
@Jazzinghen
Copy link
Contributor Author

After implementing everything I am wondering if the hook should be HS-14*4@B5420:TokyoNecro.exe because at that line the information is contained in the first position and then, when we get to the address I found at first, the information is in [ebp+8].

@Artikash
Copy link
Owner

Searching for this much data shouldn't be necessary. If you're finding the wrong function try using Util::SearchMemory which returns all matches and hooking all of them.

@Jazzinghen
Copy link
Contributor Author

Searching for this much data shouldn't be necessary. If you're finding the wrong function try using Util::SearchMemory which returns all matches and hooking all of them.

Ok, will try to reduce the amount of memory to look for and if that doesn't work I'll use SearchMemory.

@Jazzinghen
Copy link
Contributor Author

Searching for this much data shouldn't be necessary. If you're finding the wrong function try using Util::SearchMemory which returns all matches and hooking all of them.

Ok, will try to reduce the amount of memory to look for and if that doesn't work I'll use SearchMemory.

Reducing the amount of memory and using SearchMemory yields to too many hooks installed:

vnreng: TokyoNecro. Hook address: 7d0ac0
Textractor: inserting hook: TokyoNecro
vnreng: TokyoNecro. Hook address: 7d0b60
Textractor: inserting hook: TokyoNecro
vnreng: TokyoNecro. Hook address: 7d65e0
Textractor: inserting hook: TokyoNecro
vnreng: TokyoNecro. Hook address: 7d67e0
Textractor: inserting hook: TokyoNecro
vnreng: TokyoNecro. Hook address: 7d6b80
Textractor: inserting hook: TokyoNecro
vnreng: TokyoNecro. Hook address: 7d6d00
Textractor: inserting hook: TokyoNecro
vnreng: TokyoNecro. Hook address: 7d6e90
Textractor: inserting hook: TokyoNecro
vnreng: TokyoNecro. Hook address: 7d75c0
Textractor: inserting hook: TokyoNecro
vnreng: TokyoNecro. Hook address: 7d7660
Textractor: inserting hook: TokyoNecro
vnreng: TokyoNecro. Hook address: 7d7740
Textractor: inserting hook: TokyoNecro
vnreng: TokyoNecro. Hook address: 7d77e0
Textractor: inserting hook: TokyoNecro
vnreng: TokyoNecro. Hook address: 7d7910
Textractor: inserting hook: TokyoNecro
vnreng: TokyoNecro. Hook address: 7d8ad0
Textractor: inserting hook: TokyoNecro
vnreng: TokyoNecro. Hook address: 7d8b70
Textractor: inserting hook: TokyoNecro
vnreng: TokyoNecro. Hook address: 7e0760
Textractor: inserting hook: TokyoNecro
vnreng: TokyoNecro. Hook address: 7e0ac0
Textractor: inserting hook: TokyoNecro
vnreng: TokyoNecro. Hook address: 7e0b60
Textractor: inserting hook: TokyoNecro
vnreng: TokyoNecro. Hook address: 7e0d20
Textractor: inserting hook: TokyoNecro
vnreng: TokyoNecro. Hook address: 7e0dd0
Textractor: inserting hook: TokyoNecro
vnreng: TokyoNecro. Hook address: 7eed60
Textractor: inserting hook: TokyoNecro
vnreng: TokyoNecro. Hook address: 7fdc80
Textractor: inserting hook: TokyoNecro
vnreng: TokyoNecro. Hook address: 805380
Textractor: inserting hook: TokyoNecro
vnreng: TokyoNecro. Hook address: 805420
Textractor: inserting hook: TokyoNecro
vnreng: TokyoNecro. Hook address: 805580
Textractor: inserting hook: TokyoNecro
vnreng: TokyoNecro. Hook address: 805620
Textractor: inserting hook: TokyoNecro
vnreng: TokyoNecro. Hook address: 8057f0
Textractor: inserting hook: TokyoNecro

I'll try to use a different piece of code that's inside the function we need as this doesn't seem ideal.

@Jazzinghen
Copy link
Contributor Author

The function now looks for 10 bytes. Maybe we could look for even less, but I wanted to be sure.
I have also added the Database hook, but there's a problem: even if the function that's hooked is called multiple times it is as if no new lines are inserted between calls, meaning that all the text is mangled together in a single line.
I wanted to add a new line at the end of each call, but I don't know if that's the proper way to handle this or not.

@Jazzinghen
Copy link
Contributor Author

Also, given the implementation, should I update the hook code description to be HS4*@B5420:TokyoNecro.exe?

@Artikash Artikash merged commit b4303e4 into Artikash:master Aug 12, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants