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
38
Location
Somewhere
XP
57
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,

Leatherhide

Member
Newcomer
Joined
Dec 17, 2022
Messages
6
Trophies
0
Age
32
XP
21
Country
Netherlands
I used your script on Donkey Kong Country and it worked. Boots on emulator with sound! However the hash doesn't match in the Dat-o-matic database. Can this be fixed or did Nintendo alter the rom too much?
 

godreborn

Welcome to the Machine
Member
Joined
Oct 10, 2009
Messages
38,473
Trophies
3
XP
28,921
Country
United States
I used your script on Donkey Kong Country and it worked. Boots on emulator with sound! However the hash doesn't match in the Dat-o-matic database. Can this be fixed or did Nintendo alter the rom too much?
Iirc, a non matching hash doesn't matter. It's possible to fix, but I forgot the app.
 

SuperSans64

New Member
Newbie
Joined
Sep 3, 2023
Messages
1
Trophies
0
Age
18
XP
3
Country
United States
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
Literally the only thing I've found that it doesn't work with is earthbound, everything else I've tried functions fine, and Earthbound does run, but the audio channels are scrambled, and won't run correctly, if any of you know a way to fix this please let me know, because some of the audio channels sound like a cheese grater on a microphone
Post automatically merged:

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
Literally the only thing I've found that it doesn't work with is earthbound, everything else I've tried functions fine, and Earthbound does run, but the audio channels are scrambled, and won't run correctly, if any of you know a way to fix this please let me know, because some of the audio channels sound like a cheese grater on a microphone
 

Site & Scene News

Popular threads in this forum

General chit-chat
Help Users
    K3N1 @ K3N1: https://register.ubisoft.com/acsyndicate/en-US