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

Author Topic: Need help with replacing the logo of StarFox (SNES)  (Read 384 times)

SquiddyGoat

  • Jr. Member
  • **
  • Posts: 18
    • View Profile
Need help with replacing the logo of StarFox (SNES)
« on: June 22, 2021, 06:27:49 pm »
Using Lunar Compress, I've successfully ripped the logo using "decomp.exe" from address B9CF4. However, when re-inserting my edited logo at B9CF4, the entire game becomes severely corrupted.

Even ripping and inserting the unedited logo right back in causes the same effect.

I'm not sure why this happens, since I've taken very careful measures to ensure that the graphic I'm inserting fits the unique and re-used tiles of the original. I've also tried the example in LC's readme, which involves extracting and re-inserting the title logo of SMRPG, and it worked perfectly so I'm not sure if this is a problem with the program or me.

The commands I'm using in LC are:

Ripping: decomp.exe StarFox1.sfc StarFox1.bin B9CF4 14 0
Insertion: recomp.exe StarFox1.bin StarFox1.sfc B9CF4 14 0

If anyone can point out what I'm doing wrong, it would be much appreciated.

Jorpho

  • Hero Member
  • *****
  • Posts: 4882
  • The cat screams with the voice of a man.
    • View Profile
Re: Need help with replacing the logo of StarFox (SNES)
« Reply #1 on: June 23, 2021, 11:08:35 am »
Even ripping and inserting the unedited logo right back in causes the same effect.
The obvious starting point would be to compare the ROM after ripping and inserting with the original ROM. Perhaps it a subtle matter of a byte or two?
This signature is an illusion and is a trap devised by Satan. Go ahead dauntlessly! Make rapid progres!

SquiddyGoat

  • Jr. Member
  • **
  • Posts: 18
    • View Profile
Re: Need help with replacing the logo of StarFox (SNES)
« Reply #2 on: June 23, 2021, 06:19:06 pm »
The obvious starting point would be to compare the ROM after ripping and inserting with the original ROM. Perhaps it a subtle matter of a byte or two?

Hmm... I'll try comparing the two.

Something I forgot to mention in the above post is that the sizes between the edited/original logos differ. The edited logo, according to LC, is 406 bytes while the the original is 430 bytes. Since it is smaller, I thought there would be no issue.

phonymike

  • Jr. Member
  • **
  • Posts: 56
    • View Profile
Re: Need help with replacing the logo of StarFox (SNES)
« Reply #3 on: June 26, 2021, 05:15:23 pm »
If your compressed logo is 406 bytes long, you'll need to write it to B98EE.



Looking at "LunarDLL.h" in the DLLcode folder, I see

Quote from: LunarDLL.h
LC_LZ15   Star Fox [GD] Star Fox 2 [GD]
A format decompressed by the SFX chip. Beware, the format is stored and read backwards! Thus, the address to start at should be the next byte past the END of the data structure!

So first I decompressed the logo and got this
Code: [Select]
decomp.exe StarFox1.sfc StarFox1.bin B9CF4 14 0
Source Offset       B9CF4
Compressed Size       430
Uncompressed Size     800

Then I just recompressed the logo without editing
Code: [Select]
recomp.exe StarFox1.bin StarFox1.sfc B9CF4 14 0
Destination Offset  B9CF4
Compressed Size       410
Uncompressed Size     800

And the title screen is a big mess.



Note, the original compressed size is 0x430 bytes, my new compressed size is 0x410 bytes. Since the data format is stored backwards, I tried inserting the compressed image at (0xB9CF4 - 0x410) and it worked! It seems LC reads this format backwards, but writes the data forwards.

Code: [Select]
recomp.exe StarFox1.bin StarFox1.sfc B98E4 14 0
Destination Offset  B98E4
Compressed Size       410
Uncompressed Size     800

So the destination offset for the title screen logo will be different for each image, but it is calculated with 0xB9CF4 - compressed size of new logo.

SquiddyGoat

  • Jr. Member
  • **
  • Posts: 18
    • View Profile
Re: Need help with replacing the logo of StarFox (SNES)
« Reply #4 on: June 26, 2021, 08:54:24 pm »
If your compressed logo is 406 bytes long, you'll need to write it to B98EE.

I see. I've never looked in LunarDLL.h so I never saw that. I tried this and it works perfectly.

Thank you very much!