Last active
March 6, 2023 23:10
-
-
Save paulguy/95d318de70b1ead191978f571d94fed9 to your computer and use it in GitHub Desktop.
Troubled Souls music converter
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env python | |
| import io | |
| import struct | |
| intstruct = struct.Struct('>I') | |
| buffers = [] | |
| editlist = None | |
| endFound = False | |
| with open("Music.rsrc", 'rb') as infile: | |
| infile.seek(0x14B, io.SEEK_SET) | |
| while True: | |
| size = intstruct.unpack(infile.read(4))[0] | |
| print(size) | |
| if size < 1024: | |
| if not endFound: | |
| infile.seek(size, io.SEEK_CUR) | |
| endFound = True | |
| continue | |
| else: | |
| editlist = infile.read(size) | |
| break | |
| infile.seek(42, io.SEEK_CUR) | |
| buffers.append(infile.read(size-42)) | |
| with open("Music.pcm", 'wb') as outfile: | |
| for item in editlist[1:]: | |
| item = item - ord('A') | |
| print(item) | |
| outfile.write(buffers[item]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment