News: 11 March 2016 - Forum Rules
Current Moderators - DarkSol, KingMike, MathOnNapkins, Azkadellia, Danke

Author Topic: Starting a first timer snes project....could use a bit of guidance  (Read 3849 times)

shadowman357

  • Jr. Member
  • **
  • Posts: 8
    • View Profile
I'm looking at starting my first serious project, a hack of Robotrek for the good ol snes. Mostly I want to accomplish a rebalance: weapon power, enemy Hp, robot stats ect.  Maybe add an extra weapon or two but in general not a whole lot of graphical changes.

I have programming experience with c, c++, basic, matlab, so hopefully I'm not in too far over my head.

I've done plenty of reading already and have been able to make some graphical and text edits using wind hex (although it's been hard to get much graphics outside of the garbled mess).

What I'm trying to figure out next is how to actually get into the code itself. I've read a few docs on assembly language I'm just not sure how to proceed from here.

Any help or direction would be appreciated.

April 24, 2012, 12:47:07 am - (Auto Merged - Double Posts are not allowed before 7 days.)
So, I've dumped the ROM using Tracer - but line after line of code doesn't help me out.   :banghead:

Now I'm using SNES9x debugger to attempt and figure out where and what the game is executing.  (Am I on the right path here?)

Since I'm interested in changing weapon strengths, I went to the equipment screen which shows the current power of equipped items.  I tried changing an item and stepping through frames at a time to see what lines of code are being executed.  I get a couple of REP #$20 and some JMP $8BFB43[$8B:FB43] but not much else.

Is there a way to make the 9X debugger log all processing lines as opposed to hitting a button and trying to step through them?

« Last Edit: April 24, 2012, 12:47:07 am by shadowman357 »

DarknessSavior

  • Hero Member
  • *****
  • Posts: 5031
  • Darkness.
    • View Profile
    • DS: No, not the Nintendo one.
Re: Starting a first timer snes project....could use a bit of guidance
« Reply #1 on: April 24, 2012, 01:08:33 am »
You're definitely on the right track.

If you want to change weapon power, this is how I would find it.

You have a table for the game, right? Open the game in Geiger's SNES9x, and go to the equipment screen. It prints out data showing the power of your weapons, right?

Open the hex editor in Geiger's. Load your table. Find the place in RAM where the game stores the text for the attack power of whatever weapon. Place a write breakpoint on that RAM location. Go out of the equipment menu. Then set the emulator to log the CPU (buncha checkboxes near the top of the commands, tick CPU). Then go back in. The emulator should break when the number for the attack power of a weapon is written (if it doesn't, hit "run" and it'll go until the next time something is written there).

Since you told the emulator to log CPU functions, it will create a log file with all of the instructions between being out of the menu, lasting until something writes to the spot in memory where attack power is stored.

What good does this do for you? Well, obviously it had to get that number somewhere, right? Since the last instruction of your log should be the instruction before storing the attack power number, you can look through the ASM and see where it got the number from. That's likely where the game stores the attack power variable for whatever weapon you've got equipped.

Make sense?

Hope that helps,

~DS
Red Comet: :'( Poor DS. Nobody loves him like RC does. :'(
Sliver-X: LET ME INFRINGE UPON IT WITH MY MOUTH
DSRH - Currently working on: Demon's Blazon, Romancing SaGa, FFIV EasyType.
http://www.youtube.com/user/DarknessSavior

Jorpho

  • Hero Member
  • *****
  • Posts: 4723
  • The cat screams with the voice of a man.
    • View Profile
Re: Starting a first timer snes project....could use a bit of guidance
« Reply #2 on: April 24, 2012, 01:11:00 am »
Mostly I want to accomplish a rebalance: weapon power, enemy Hp, robot stats ect.
Well, you can always brute-force it:
-find out what an enemy's HP is
-search the contents of the ROM for all occurrences of that value
-repeat with another enemy's HP
-see if you can find two values roughly in the same vicinity
-and try changing one of those values and see if anything happens.

Not especially elegant, though – and not helpful at all if the HP values are calculated and not stored as raw data.
This signature is an illusion and is a trap devised by Satan. Go ahead dauntlessly! Make rapid progres!

Alchemic

  • Jr. Member
  • **
  • Posts: 12
    • View Profile
Re: Starting a first timer snes project....could use a bit of guidance
« Reply #3 on: April 24, 2012, 12:13:14 pm »
There's an enemy-related data table at 0x3F591 to 0x3FB42 (with 18-byte entries), though I'm not sure if it has enemy HP in it. It DOES have the amount of experience points, though.

The table (spoilered for size):
Spoiler:
Code: [Select]
------------------------------------------------------------------------
Robotrek Enemy Data
------------------------------------------------------------------------

0x3F591 to 0x3FB42, 18-byte entries.
Asterisks before the name indicate unresolved ambiguity.

02 to 03 = Experience, in units of 0.1 (binary-coded decimal)



00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F 10 11
-----------------------------------------------------
05 00 01 00 00 00 02 00 60 09 02 00 60 09 00 00 00 00   Mine
1E 00 07 00 14 18 30 00 30 09 32 28 40 09 00 00 40 00   Turbo
05 00 01 00 00 00 03 00 60 09 03 00 60 21 00 00 00 00   Mushroom
1E 00 08 00 1E 18 3B 00 30 09 38 24 5D 21 00 00 00 00   Poison
12 00 03 00 0A 10 0F 00 40 0C 08 22 6A 23 81 00 20 00   Spider (0.3 exp)
1E 00 09 00 1E 18 2E 00 20 0C 2B 24 48 23 81 00 20 00   Spider (0.9 exp)
05 00 01 00 00 00 08 00 50 0C 02 22 56 23 21 00 00 00   Gel
28 00 08 00 22 18 3A 00 40 0C 36 24 4C 23 60 00 0C 00   Gelgel
32 00 14 00 28 1C 3F 00 40 09 37 02 52 21 00 00 00 00   Bosstoad
0A 00 02 00 00 10 08 00 30 09 05 00 50 21 20 00 00 00   Rushbird
1E 00 10 00 1E 30 52 00 20 09 4E 22 3F 21 20 00 00 00   Quickbird
1A 00 06 00 0C 00 1C 00 40 09 1E 0C 40 21 00 00 0B 00   Mole
30 00 10 00 1C 10 20 00 40 09 2E 30 4B 81 00 00 0B 00   Powermole
41 00 16 00 44 28 57 0C 20 81 54 00 40 21 81 00 00 00   Tackler
14 00 07 00 0E 10 22 0E 50 81 24 16 60 44 88 00 30 00   Plasmoke
1E 00 07 00 14 10 29 0E 50 81 2C 12 60 42 88 00 30 00   Elesmoke
14 00 06 00 05 1E 22 10 30 41 22 00 30 41 20 00 43 00   Monk
1E 00 08 00 14 08 28 26 6E 81 29 00 60 21 81 00 20 00   Mummy
28 00 09 00 19 08 2D 00 60 0B 29 32 6B 81 81 00 20 00   Franken
0A 00 06 00 14 18 24 34 4B 21 24 14 64 43 81 00 20 00   Ho Ho
32 00 11 00 14 28 37 28 30 23 34 00 30 21 00 00 00 00   Gator
38 00 13 00 2B 1E 44 0C 80 81 42 00 60 22 09 03 44 00   Gunrobot
3C 00 13 00 2B 1E 42 00 60 23 44 0E 80 22 09 03 44 00   CannonX
14 00 11 00 1E 28 3E 00 20 09 36 34 3F 81 81 01 00 00   Biolion
64 00 00 03 96 78 00 00 10 00 00 00 10 00 F0 03 00 00   Shell
14 00 09 00 3C 20 4A 00 30 23 46 24 1C 81 00 00 00 00   Urchin
1E 00 12 00 3C 38 48 00 10 23 48 00 10 23 C0 03 08 00   Luckstar
1E 00 09 00 28 22 52 16 30 44 4A 22 3A 21 42 03 00 00   Angler
1E 00 10 00 28 28 4D 0E 20 09 4C 00 50 21 00 00 00 00   *********************** Cmdr.
1E 00 10 00 28 28 4A 00 40 21 4A 22 4E 81 00 00 00 00   *********************** Cmdr.
3C 00 15 00 3C 20 50 0C 30 09 00 00 30 81 C0 00 41 00   Octopus
3C 00 15 00 3C 32 57 0C 10 81 55 00 10 22 08 00 44 00   Pumpy
50 00 18 00 46 5F 82 0C 10 81 82 00 10 22 08 00 44 00   Bumpy
78 00 20 00 50 4A 78 28 38 09 50 26 3E 81 48 00 20 00   Faceman
96 00 24 00 78 50 A5 28 38 09 96 28 38 23 48 00 20 00   Bigface
14 00 20 00 46 46 5A 06 12 81 92 10 10 41 C0 03 00 00   Redpixy
1E 00 22 00 5A 50 82 30 1F 81 9C 14 10 43 C0 03 00 00   Whitepixy
1E 00 22 00 5A 62 8C 32 1F 81 A6 12 10 42 C0 03 00 00   Goldpixy
50 00 18 00 73 3E 62 00 30 21 60 34 3F 81 C0 00 23 00   Knight
64 00 22 00 7D 54 88 00 30 21 88 26 3F 81 C0 00 23 00   Master
96 00 28 00 80 5A 9E 00 40 41 94 02 42 21 00 00 43 00   Gagarian
78 00 30 00 6E 6E 96 00 10 09 9C 00 10 21 C0 01 10 00   Ninja
08 00 02 00 00 02 02 00 80 09 05 00 80 09 00 00 00 00   *********************** Cmdr.
19 00 03 00 0A 05 0F 00 60 09 14 00 60 09 00 00 0C 00   *********************** Cmdr.
0A 00 03 00 05 05 1C 00 60 21 1C 00 60 21 00 00 00 00   *********************** Cmdr.
0A 00 03 00 05 05 1C 00 60 23 1C 00 60 23 00 00 00 00   *********************** Cmdr.
0A 00 03 00 0A 18 2A 28 40 09 2E 0C 40 09 00 00 00 00   *********************** Cmdr.
1E 00 04 00 1C 18 2E 28 20 09 38 0C 40 09 00 00 00 00   *********************** Cmdr.
1E 00 05 00 14 1E 3A 28 20 21 3E 00 20 22 00 00 00 00   *********************** Cmdr.
1E 00 04 00 14 1E 3E 00 20 23 3E 00 20 23 00 00 00 00   *********************** Cmdr.
1E 00 07 00 22 18 50 28 54 09 55 0C 60 09 40 00 00 00   *********************** Cmdr.
32 00 09 00 30 28 54 28 24 09 5A 0C 40 09 40 00 21 00   *********************** Cmdr.
2D 00 10 00 24 20 59 28 44 21 5C 00 40 22 40 00 00 00   *********************** Cmdr.
2C 00 10 00 1E 20 5C 14 40 41 5C 10 40 43 40 00 00 00   *********************** Cmdr.
05 00 04 00 14 14 3C 00 80 81 08 02 42 81 00 00 00 00   Minicom (0.4 exp)
0A 00 05 00 28 32 6E 00 80 81 3C 30 4F 81 00 00 00 00   Minicom (0.5 exp)
0A 00 06 00 50 50 8C 00 80 81 5A 32 4F 81 00 00 00 00   Minicom (0.6 exp)
32 00 16 00 48 46 82 00 20 09 84 24 28 09 40 00 00 00   *********************** Big Fan
32 00 16 00 46 44 88 00 30 23 8A 00 30 21 40 00 00 00   *********************** Big Fan
32 00 16 00 3C 44 8C 00 30 23 8B 00 30 21 40 00 00 00   *********************** Big Fan
00 00 00 00 00 00 00 00 80 00 00 00 80 00 00 00 00 00   Beeper
0A 00 01 00 00 00 00 02 32 81 00 00 80 00 00 00 00 00   *********************** Cmdr.
0A 00 20 00 50 28 BE 28 18 21 C0 00 10 21 C0 03 00 00   Masker (2.0 exp)
0A 00 26 00 64 14 78 00 10 21 78 00 10 21 C0 03 00 00   Masker (2.6 exp)
0A 00 28 00 64 1C A0 24 1C 23 A5 00 10 23 C0 03 00 00   Masker (2.8 exp)
0A 00 20 00 50 28 BE 28 18 21 C0 28 18 21 C0 03 00 00   Beret (2.0 exp)
0A 00 25 00 78 14 78 00 10 23 78 26 1A 23 C0 03 00 00   Beret (2.5 exp)
0A 00 26 00 64 1E A5 0C 10 81 AA 00 10 81 C0 01 00 00   Beret (2.6 exp)
05 00 01 00 00 00 00 00 80 00 00 00 80 00 00 00 00 00   -
C8 00 00 02 16 05 1E 0C 40 09 0A 00 40 21 81 01 00 00   Meta Crab
0A 00 01 00 0A 00 19 28 24 09 00 00 80 00 10 00 00 00   Smallcrab
90 01 00 05 28 18 2A 26 4E 81 36 12 40 42 81 01 00 00   Mamurana
58 02 00 07 40 28 50 0C 20 81 58 00 20 22 E0 00 0B 00   Big Eye
14 05 00 09 73 44 7E 28 14 21 8A 00 40 23 C0 00 0B 00   Blacktank
F0 0A 00 09 96 55 9E 00 10 21 A4 28 48 81 81 00 00 00   Gateau (90.0 exp)
20 03 50 00 78 46 8E 34 4E 22 8E 00 40 00 81 00 00 00   Soldier
50 14 00 00 96 5F B6 0C 20 81 AA 26 2A 81 C0 00 00 00   Gateau (Final boss)
D0 07 00 05 82 50 96 30 1F 22 A0 00 10 23 81 03 00 00   De Rose
60 09 00 04 87 46 A0 16 10 44 96 26 2B 22 C0 03 22 00   Bugbug (Second battle)
1C 02 00 03 50 26 44 28 3C 21 5C 00 30 23 C0 01 12 00   Papamecha
BC 02 00 04 6E 2A 82 16 10 44 7E 22 4A 22 C0 00 22 00   Bugbug (First battle)
-----------------------------------------------------

Since PAR codes are just six hex digits of address followed by two hex digits of value, the Robotrek PAR code guide on GameFAQs indicates memory addresses where robot stats are stored: Robot #1's Energy is at 7E068A-B, #1's Energy Max is at 7E0690-1, etc. Looking for code that writes to these addresses might be helpful.

One caveat: I think there's a typo in it for Robot #3's Energy stat (it's probably at 7E068E-F instead of 7E06AE-F).

shadowman357

  • Jr. Member
  • **
  • Posts: 8
    • View Profile
Re: Starting a first timer snes project....could use a bit of guidance
« Reply #4 on: April 26, 2012, 01:18:11 pm »
Thanks for all the help guys! Things are definitely starting to make sense  :thumbsup:

The PAR codes helps a ton to get me directed towards the right section of Rom. Sounds like the easiest might be to start changing values in the Rom and see what effects I get. Then find where the asm is writing these values and see where it's pulling values from.  Awesome.

Back at it. ....

April 28, 2012, 01:06:00 am - (Auto Merged - Double Posts are not allowed before 7 days.)
You have a table for the game, right? Open the game in Geiger's SNES9x, and go to the equipment screen. It prints out data showing the power of your weapons, right?

I saved a table that was already in WinHex and used in 9x.  Seems to display text correctly.  The equipment screen does show the power.

Open the hex editor in Geiger's. Load your table. Find the place in RAM where the game stores the text for the attack power of whatever weapon.

Is there a way to narrow this down or search in 9x?  I tried a text search in WinHex for 189 (current power) but this didn't return anything.
« Last Edit: April 28, 2012, 01:06:00 am by shadowman357 »

DarknessSavior

  • Hero Member
  • *****
  • Posts: 5031
  • Darkness.
    • View Profile
    • DS: No, not the Nintendo one.
Re: Starting a first timer snes project....could use a bit of guidance
« Reply #5 on: April 28, 2012, 10:39:36 pm »
Just open the Hex Editor in SNES9x, and look around in RAM for the name of the weapon. The attack power number should be nearby.

Follow my instructions from my last post, and you should be able to find your answer.

~DS
Red Comet: :'( Poor DS. Nobody loves him like RC does. :'(
Sliver-X: LET ME INFRINGE UPON IT WITH MY MOUTH
DSRH - Currently working on: Demon's Blazon, Romancing SaGa, FFIV EasyType.
http://www.youtube.com/user/DarknessSavior

shadowman357

  • Jr. Member
  • **
  • Posts: 8
    • View Profile
Re: Starting a first timer snes project....could use a bit of guidance
« Reply #6 on: September 30, 2012, 08:29:54 pm »
Well, I've come a long ways since April and the "Robotrek Recombined" project is moving along very nicely.  I've figured out how to modify just about everything that already exists within the ROM like data values, text and lines of processor code.

So now the big question - where should I start learning how to add NEW stuff?  New areas, items, enemies, ect.  I'm guessing the ROM needs to be expanded first, and then it gets real complicated.

Thanks in advance - maybe I'll start a project page if anyone knows this game or would be interested in the Recombined version.    :-\