I managed to extract SNES roms from VC. With working audio

migraineboy

New Member
OP
Newbie
Joined
May 19, 2022
Messages
1
Trophies
0
Age
36
Location
Somewhere
XP
26
Country
Brazil
Hey guys,
I've recently thought about creating my original SNES rom library, and buying from VC seemed like a great idea to acomplish that, UNTIL I bought a few roms and realized that they were different from the original roms and they woudn't work on emulators.
Searching online I stumbled on this post from gbatemp: "Extracting SNES VC Rom & Restoring Audio" (coudn't post the link because my account is brand new, but it's easy to find)
And it really helped.

The complaints were that the audio would get glitched, weird and stuff, but it's just a matter of slicing the data.bin file correctly and using snesrestore.py afterwards.

Doing it manually
1. Open data.bin on HxD.exe.
2. Go to the position 0x14 by pressing Ctrl+G, writing 14 and pressing ENTER.
3. From there, select the next 4 bytes by holding SHIFT and pressing the right arrow 4 times.
4. Make sure that hexadecimal base and little endian are selected (bottom right), then at the right of the program, copy the value for Int24, this represents the end of the rom in this data.bin file.
5. Jump there with Ctrl+G, pasting the number you have just copied and pressing enter.
6. From the cursor, hold SHIFT + CTRL and press END to SELECT EVERYTHING to the end of the file, cut this text, create a new empty file, paste it and save this file as game.pcm.
7. Now, go to the beginning of the data.bin file (the one that you cut out the pcm text), select the text from position 0 to 60 (first 60 bytes), then delete it.
8. Save this file as game.rom
9. Run snesrestore.py as: python2 snesrestore.py game.rom game.pcm output.smc.

There is your rom.

if you want to speed this up a little bit, you can use the python code below that I created and am using for my own roms.
Just create a file called whatever.py paste the code below into it
Code:
import os
import struct

if __name__ == '__main__':
    if len(os.sys.argv) != 2:
        print("Use: python splita_rom_virtual_console_3ds.py /path/to/data.bin")
        os.sys.exit(1)

    fabs = os.sys.argv[1]

    try:
        with open(fabs, "rb") as fi:
            b = bytearray(fi.read())
            rom_size = struct.unpack('<I', b[0x31:0x34] + b'\0')[0]
            rom_data = b[0x60:0x60 + rom_size]
            print(f'ROM size: {rom_size} ({hex(rom_size)})')

            pcm_data = b[0x60 + rom_size:]
            print(f'PCM size: {len(pcm_data)} ({hex(len(pcm_data))})')

            with open('game.rom', 'wb') as fo:
                fo.write(rom_data)

            with open('game.pcm', 'wb') as fo:
                fo.write(pcm_data)

        print('SUCCESS')
    except Exception as e:
        print('ERROR' + str(e))


And run it as:
python3 whatever.py /path/to/data.bin

It will create two files in the current directory: game.rom and game.pcm. Then you can follow step 9 above for finishing the job (that program is the real deal).

Hopefully this will help some people support Nintendo a little bit more by buying a few more original games.
So far, I've used this method (the .py file) for the following games, sucesfully:

The Legend of Zelda: A Link to the Past
The Legend of the Mystical Ninja
Super Punch-Out!!
Super Metroid
 
Last edited by migraineboy,
  • Like
Reactions: ack and E1ite007
General chit-chat
Help Users
    NoobletCheese @ NoobletCheese: if it doesnt have rollback netcode it can be safely ignored