This commit is contained in:
UnitedAirforce
2025-06-17 19:47:08 +08:00
parent 3553ab88d4
commit 621dbd7ffa
4 changed files with 117 additions and 0 deletions
@@ -0,0 +1,35 @@
import os
SEVEN_ZIP_PATH = r"C:\Program Files\7-Zip\7z.exe"
PASSWORD = "eiprblFFv69R83J5"
OUTPUT_FOLDER = "output"
def generate_zipcrypto_commands():
cwd = os.getcwd()
output_path = os.path.join(cwd, OUTPUT_FOLDER)
os.makedirs(output_path, exist_ok=True)
commands = []
for root, _, files in os.walk(cwd):
if root == output_path:
continue
for file in files:
file_path = os.path.join(root, file)
zip_filename = file + ".zip"
zip_path = os.path.join(output_path, zip_filename)
cmd = f'"{SEVEN_ZIP_PATH}" a -p{PASSWORD} -mem=ZipCrypto "{zip_path}" "{file_path}"'
commands.append(cmd)
return commands
if __name__ == "__main__":
zip_commands = generate_zipcrypto_commands()
for cmd in zip_commands:
print(cmd)
@@ -0,0 +1,27 @@
import os
import subprocess
from pathlib import Path
INPUT_DIR = Path("audio")
OUTPUT_DIR = Path("audio_shifted")
OUTPUT_DIR.mkdir(exist_ok=True)
def shift_audio(file_path: Path):
output_file = OUTPUT_DIR / file_path.name
cmd = [
"ffmpeg",
"-y",
"-ss", "0.02321",
"-i", str(file_path),
"-c", "copy",
str(output_file)
]
print(f"Processing {file_path.name}...")
subprocess.run(cmd, stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)
def main():
for file in INPUT_DIR.glob("*.m4a"):
shift_audio(file)
if __name__ == "__main__":
main()
@@ -0,0 +1,16 @@
These are to correct an obscure issue where the ios M4A audio are offseted by 23ms. This is a universal issue (across all ios audio files) and should not pose much issue for the majority of users.
For preservation sake, I do not want to alter the original game file. Thus, those who wish to correct this issue should process the audio on their local environment.
Process.
Copy/cut all the `.m4a.zip` to the working directory.
Run `unpack.py`. All files will be extracted to `audio` folder.
Run `process.py`, all the audios within `audio` folder will be shifted and saved to `audio_shifted` folder.
Go into `audio_shifted` folder. Run `111_genzp.py`, it will provide the 7-zip compression commands for all the files, with output to `../audio_shifted/output`. Make sure to edit the python script's 7zip install location.
Simply copy the `zips` located in `output` folder and replace existing ones.
@@ -0,0 +1,39 @@
import os
import zipfile
import threading
import traceback
ZIP_PASSWORD = b"eiprblFFv69R83J5"
OUTPUT_DIR = "audio"
MAX_THREADS = 4
semaphore = threading.Semaphore(MAX_THREADS)
def unpack_zip(zip_path):
with semaphore:
try:
with zipfile.ZipFile(zip_path) as zf:
print(f"Extracting {zip_path}...")
zf.extractall(OUTPUT_DIR, pwd=ZIP_PASSWORD)
print(f"Unpacked: {zip_path}")
except Exception as e:
print(f"Failed to unpack {zip_path}: {e}")
traceback.print_exc()
def main():
if not os.path.exists(OUTPUT_DIR):
os.makedirs(OUTPUT_DIR)
zip_files = [f for f in os.listdir('.') if f.lower().endswith('.zip')]
print(f"Found ZIP files: {zip_files}")
threads = []
for zip_file in zip_files:
t = threading.Thread(target=unpack_zip, args=(zip_file,))
t.start()
threads.append(t)
for t in threads:
t.join()
if __name__ == "__main__":
main()