Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Any way to extract every rom file? #72

Open
Murderhead opened this issue May 16, 2024 · 1 comment
Open

Any way to extract every rom file? #72

Murderhead opened this issue May 16, 2024 · 1 comment

Comments

@Murderhead
Copy link

Would it be possible to add a function to extract every rom file?

@Marcinbar
Copy link

Marcinbar commented Jul 18, 2024

I wrote such a script in python. Searches for roms in the "ROMS" directory and the unpacked roms are placed in the "UNPACKED" directory.

import zipfile
import os

onlyfiles = [f for f in os.listdir("./ROMS")]
for f in onlyfiles:
    with open("./ROMS/" + f, 'rb') as in_file:
        with open(f+'.zip', 'wb') as out_file:
            out_file.write(in_file.read()[59904:])
            with zipfile.ZipFile(f+'.zip',"r") as zip_ref:
                if not os.path.exists("./UNPACKED"):
                    os.makedirs("./UNPACKED")
                zip_ref.extractall("./UNPACKED")
    os.remove(f+'.zip')

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants