News: 11 March 2016 - Forum Rules

Author Topic: Micro Machines 2 - Remove Lap limit.  (Read 709 times)

CraigMc

  • Jr. Member
  • **
  • Posts: 3
    • View Profile
Micro Machines 2 - Remove Lap limit.
« on: October 26, 2021, 05:20:51 am »
Hello!

I've recently been interested in learning a bit about ROMs and assembly language in general (I'm a developer but completely new to AL).

As a learning project I've decided to take a look at the ROM for micro machines 2 (SNES) with the challenge of making a small change to the Head to Head mode:

- Currently in head to head mode, if both players still have lives, then the game has a maximum of 3 laps before sudden elimination.
- I want to make a small change to have 0 lap limit - the players keep playing until one player looses all lives.

I have used the DiztinGUIish tool to convert my smc file into the (potential) 1 million lines of AL. And also some experiments with connecting this to the BSNESPLUS emulator in debug mode while playing which is showing me some lines of code being hit during gameplay.

However, I'm a bit lost with the sheer size of the code.
Any advise/assistance would be greatly appreciated :-)

Many Thanks,
Craig

Cyneprepou4uk

  • Hero Member
  • *****
  • Posts: 734
  • I am the baldest romhacker
    • View Profile
Re: Micro Machines 2 - Remove Lap limit.
« Reply #1 on: October 26, 2021, 09:24:35 am »
What you actually should be doing is find a lap counter in RAM, set a read breakpoint to it, and then change the code which is checking for laps to trigger a sudden elimination.

CraigMc

  • Jr. Member
  • **
  • Posts: 3
    • View Profile
Re: Micro Machines 2 - Remove Lap limit.
« Reply #2 on: October 26, 2021, 12:26:54 pm »
Thanks Cyneprepou4uk

I'll definitely try your suggestion as a next step.
I'm using BSNES emulator which does seem to come with a bunch of useful tools to view the various memories during gameplay. There seem to be a number of different things to monitor, as a starting point would you recommend I focus on the VRAM, or do you think that could something like the lap counter could be held elsewhere (OAM, CGRAM....or potentially one of the registers?

FAST6191

  • Hero Member
  • *****
  • Posts: 3348
    • View Profile
Re: Micro Machines 2 - Remove Lap limit.
« Reply #3 on: October 26, 2021, 05:03:33 pm »
You could do some flavour of graphics and backwards, might even make a tiny bit more sense here. However the first port of call for most is cheats and the searching thereof to find values directly related to the stuff the game is using (graphics can be several steps removed if they need to convert to something more display friendly). If doing whole laps is going to be tedious vs more conventional cheat targets you can quickly consume in small amounts endlessly (think gold, life, potions...) then that is where you can contemplate doing the graphics stuff instead.

https://web.archive.org/web/20080309104350/http://etk.scener.org/?op=tutorial is for the GBA but cheat searching works much the same regardless of device.

Also outside chance the sudden death option is a flag. Find that (might be hard by cheats but I have found flags before) and you can hold that off with a cheat as well.

KingMike

  • Forum Moderator
  • Hero Member
  • *****
  • Posts: 7255
  • *sigh* A changed avatar. Big deal.
    • View Profile
Re: Micro Machines 2 - Remove Lap limit.
« Reply #4 on: October 26, 2021, 05:33:11 pm »
Thanks Cyneprepou4uk

I'll definitely try your suggestion as a next step.
I'm using BSNES emulator which does seem to come with a bunch of useful tools to view the various memories during gameplay. There seem to be a number of different things to monitor, as a starting point would you recommend I focus on the VRAM, or do you think that could something like the lap counter could be held elsewhere (OAM, CGRAM....or potentially one of the registers?

Somewhere in RAM (technically called WRAM).
OAM is sprite data, CGRAM is palettes, VRAM is the loaded tile data. None of those are going to be related to what you're looking for: the lap counter.
"My watch says 30 chickens" Google, 2018

CraigMc

  • Jr. Member
  • **
  • Posts: 3
    • View Profile
Re: Micro Machines 2 - Remove Lap limit.
« Reply #5 on: October 27, 2021, 08:30:08 am »
Thanks everyone for the feedback.

Using the BSNES debugger I managed to dump the RAM before and after going over a lap and could track down the memory location where the counter is held :-)

As a first hack I have just increased the initialization of the counter from '03' to '2F' to increase the number of laps to around 50 which will do the job for now.

I'll have a bit more of a dig to do a slightly better hack and prevent the 'DEC.W' statement in the future.

Thanks all :-)

phonymike

  • Jr. Member
  • **
  • Posts: 69
    • View Profile
Re: Micro Machines 2 - Remove Lap limit.
« Reply #6 on: October 28, 2021, 10:30:35 pm »
Nice job on the modification.

I have a program that might help. It's called SNES Opcode Searcher. It runs in Windows and is command line, and if you give it the rom file and memory address, it'll try to find the assembly instruction that modifies that address, and tell you where the instruction is. It doesn't search for INC or DEC, but does search for LDA (load accumulator), CMP (compare accumulator with memory), and several others. It can't tell the difference between data and code, but it works really well.

Edit: I just submitted an update to include INC and DEC and the rest of the instructions that access memory. It should show up soon it's version 0.1.4b.
« Last Edit: October 29, 2021, 07:41:40 pm by phonymike »