News: 11 March 2016 - Forum Rules

Author Topic: NES Trainers  (Read 5020 times)

wyndcrosser

  • Full Member
  • ***
  • Posts: 199
    • View Profile
NES Trainers
« on: June 13, 2013, 12:49:29 pm »
Has anyone have any expertise in developing trainers inside a game?

i.e. giving the option to turn on an infinite energy/health cheat with a famicom/NES game?

I'll continue looking around.

Thanks

FAST6191

  • Hero Member
  • *****
  • Posts: 3357
    • View Profile
Re: NES Trainers
« Reply #1 on: June 13, 2013, 05:27:28 pm »
GBA and DS sure (at least before GABSharky/GBAATM and DSATM got good) but there you have a lot more resources and a lot fewer complications.

Generally the two options are

Proto cheat engine -- a normal RAM manipulating cheat device will hook the game every vblank or something and force the value high. You do the same.

ASM cheat -- you find all the functions that fiddle with health and nerf them however you will. If the death check is just on one line you can also shift the health value to another place and just have the death check act on that new value which should remain unchanged.

Despite normally not being that similar they are fairly similar here but more on that in a moment.

Selectable is one thing, are you especially attached to a method (pre game intro vs in game button combo usually being the big two -- harder on the NES though as you lack buttons to make truly complex/hard to do by accident ones)? I mainly ask for many that make trainers observe a distinction there (and woe betide you should you rock up with a hardcoded/always on hack).
Likewise you will also have to contend with what happens if you are having fun with mappers/bankswitching and the particular loop the game is on at the time has your code on another or you have a lack of space (it can take a fair few instructions to get proper coverage and though it is not quite as bad as atari it is still every byte counts for the NES).

Anyway the selectable thing is usually twofold
The check -- this is the basic IF ELSE arrangement. You might choose to get slightly fancier and change a sub to a mov or add as part of the payload.
Getting the "cheats active" flag value into RAM. Hooking the game before the game loads and injecting the "cheats active" flag is fine save for the aggro of hooking the game and/or making a menu.
Hooking the game based on control inputs at a given time is traditionally somewhat easier if you want in game selectable. I am not so familiar with what the NES passes off as interrupts for controls at this point but that is the main route. That said I would love to see a in game menu added as a nes hack.
The cheating bastard method (always my favourite style of hack) though no less valid is if say the game has a menu with options you can find in the game is you tie the "cheats active" flag to a throwaway option/option combo* as the game will have done all the hard work for you and stuck a value into memory. Such menus can also be a nice point to try hooking a game.

Nothing stopping you doing some combination of the lot I guess.

Option 3. Usually done as a workaround for games that have you lose as part of the story but "button combo to refill health" is a good one.

horst

  • Jr. Member
  • **
  • Posts: 3
    • View Profile
Re: NES Trainers
« Reply #2 on: January 28, 2014, 04:49:55 pm »
sorry for reviving this topic. if you're still interested, I wrote some examples a few years ago. but they work on emulators, only. Hope you find the information useful anyway.

https://github.com/patois/NESTrainers