Closed thomasasfk closed 1 year ago
import argparse
import os
import struct
def get_s3v0_header(file):
header = {}
magic = file.read(4)
if magic != b'S3V0':
raise ValueError("Invalid S3V0 magic")
header['size'], header['original_size'], header['data_hash'] = struct.unpack("<III", file.read(12))
file.read(16) # skip 16 bytes
return header
if __name__ == "__main__":
parser = argparse.ArgumentParser()
parser.add_argument('--input', help='Input S3P file', required=True)
args = parser.parse_args()
with open(args.input, "rb") as infile:
magic = infile.read(4)
if magic != b'S3P0':
raise ValueError("Invalid S3P0 magic")
num_files = struct.unpack("<I", infile.read(4))[0]
index = []
for i in range(num_files):
offset, size = struct.unpack("<II", infile.read(8))
index.append((offset, size))
for i, (offset, size) in enumerate(index):
infile.seek(offset, 0)
header = get_s3v0_header(infile)
data = infile.read(header['original_size'])
output_file = os.path.join(f"{i}.wma")
with open(output_file, "wb") as outfile:
outfile.write(data)
Converter was easy... but the .s3p
files I have are only of the intro/preview sections, not the whole songs :/
Sorted in https://github.com/thomasasfk/drs2dd/pull/4 - found the files elsewhere :)
We have beatmaps for these, but no
.ogg
- we could either source the songs manually and line them up, or find/write some converter for the.s3p
files.