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

Author Topic: [HELP] Restoring the Kirby sprite (Debug menu) in EarthBound (for MaternalBound)  (Read 2049 times)

ShadowOne333

  • Hero Member
  • *****
  • Posts: 961
    • View Profile
Good day, RomHacking community.

I am seeking help with one issue I stumbled upon, which I've been trying to fix throughout half a month already, but haven’t been able to do so at the moment, and it’s something every EarthBound ROM compiled with CoilSnake suffers from, including clean ROMs without modifications.

You see, there’s this particular Debug menu that uses Kirby as its cursor sprite, more widely known as the Boot-up Debug Menu. For those that are not familiar with this, here's the entry in The Cutting Room Floor for it and how to enable it:
https://tcrf.net/EarthBound/Boot-Up_Debug_Menu

Once you enable said Debug menu, and you start the game, you enter directly into the Menu itself with Kirby making a neat cameo appearance:


However, when you try to do this with a compiled CoilSnake ROM, Kirby’s sprite does one of two things:
  • Does not appear at all
  • Is a garbled mess.
Here are some examples of that:

NOTE: The garbled effect might vary, I sometimes get other portions of the sprite to appear, or with other colours, etc

(Another side-effect to this is that the palette for the Windows inside the “View Map” option show random colours instead of the pinkish one from the Cutting Room Floor site)

You can try it out for yourself, make a clean dump of EB’s files alongside its script, and then compile it back, then try to boot-up this Debug menu with the cheat codes and you will have a similar result.

I stumbled into this when trying to fix the options of the Debug Menu found inside the “View Map” option.
I ended up fixing the options without issues, but for some reason I cannot seem to fix Kirby’s sprite here.

I tried to fix this by repointing stuff from the Debug bank (according to Data crystal) to no success, I even grabbed the Hex data of Kirby’s sprite and put it in a CCS file with its newly repointed pointer, but nothing.


From the test that I have done, I still haven't narrowed down what the culprit of the problem might be.
I think it is related to the Title Screen module in CoilSnake, but I'm unsure yet.
If anyone knows better, please let me know.
I’ve been trying hard to restore it, but so far I haven’t had any luck at all.

So I was wondering if perhaps someone here could lend a helping hand on restoring this Kirby sprite.
There are two ways one can go about restoring the sprite:

  • Checking out which CoilSnake build broke it.
    It has to be a commit between CoilSnake 2.3.1 and CoilSnake 3.0, or commits between June 14th, 2017 and January 24th, 2017, since the Kirby sprite shows up fine with ROMs compiled with CoilSnake 2.3.1, but they started to fail on 3.0 and onwards.
  • Make a fix to the compiled ROM directly.
    Perhaps taking the data from an original ROM and implementing it into a compiled one.
    I just need to know what changes are required for the fix to hopefully implement them into MaternalBound's CCS files and make the fix work on any compiled ROM afterwards.

I am leaning more towards the later, perhaps finding out why the sprite is disappearing on compiled ROMs and how to fix it in a compiled one could lead to a fix to CoilSnake source, but right now all I want to do is simply fix it in a compiled ROM, no need to touch the CoilSnake source, I simply want to know what is causing the sprite to not appear and how to fix it on my end.

Here's the MaternalBound source:
https://github.com/ShadowOne333/MaternalBound

And here's a link to CoilSnake to compile it:
http://mrtenda.github.io/CoilSnake/


So far that is the only issue I’ve come across.
Perhaps I am being to nitpicky or OCD-driven, but I’d like to have this feature restored, more so because it seems to be something that CoilSnake is doing during compilation.

Any kind of help would be greatly appreciated!
Thank you!
« Last Edit: October 04, 2018, 05:58:56 pm by ShadowOne333 »

ShadowOne333

  • Hero Member
  • *****
  • Posts: 961
    • View Profile
Following on this issue.
I haven't been able to fix it yet, but PK Hack user d-man has been helping to narrow down the problem.

He did some tests on his own to a completely clean ROM and compiled it back with CoilSnake.
He started compiling a ROM with no changes made to it and adding certain ranges of addresses into the "used_ranges.yml" file. This YML file tells CoilSnake what addresses NOT to touch during compilation.

Right now, it has come down to the following ranges (the ones with # are commented out):

Code: [Select]
- (0x17E83F, 0x17FFFC)
# - (0x180000, 0x18FFFF)
 - (0x190000, 0x19FFFF)
# - (0x1A0000, 0x1AFFFF)
 - (0x1B0000, 0x1BFFFF)
 - (0x1C0000, 0x1CFFFF)
 - (0x1D0000, 0x1DFFFF)
 - (0x1E0000, 0x1EFFFF)
 - (0x1F0000, 0x1FB36D)
(They all seem to be related to tileset data according to Data Crystal)

However, I cannot test this on my own, as when I try to add these ranges on MaternalBound, I run out of free space on the ROM to compile it. So we still have yet to narrow it down even further.

One thing of importance, it seems that whenever CoilSnake starts its compilation, it frees-up these ranges, since the original data that used to go here gets repointed and moved into another place in the ROM.
To add to this even further, it seems that once CoilSnake frees up these ranges, what usually gets placed in this addresses is the Title Screen data. I'm not sure if this has something to do with it or not, but perhaps the Title Screen data could be somehow related to the Kirby sprite.

I will try to debug this even further, but if someone else has more insight or figures out how to restore the sprite, please let us know!