de-dupe wave samples

This commit is contained in:
Oliver Bell committed 2026-05-10 15:53:18 +01:00
1 parent 0b412b575f
commit 2bc749f6b6
25 files changed
+82 -31

No files matched your search

+1
View File
@@ -2,3 +2,4 @@ graphics/*.pal
src/sa2
sound/sa2/songs/midi
sound/sa2/programmable_wave_samples
sound/shared/programmable_wave_samples
+1 -1
View File
@@ -91,7 +91,7 @@ SOUND_ASM_SUBDIR = sound
SOUND_ASM_BUILDDIR = $(OBJ_DIR)/$(SOUND_ASM_SUBDIR)
SAMPLE_SUBDIR = sound/direct_sound_samples
WAVE_SAMPLES_SUBDIR = sound/sa2/programmable_wave_samples
WAVE_SAMPLES_SUBDIR = sound/shared/programmable_wave_samples
C_SUBDIR = src
C_BUILDDIR = $(OBJ_DIR)/$(C_SUBDIR)
@@ -1,44 +1,44 @@
.align 2
.global ProgrammableWaveData_2016CCC
ProgrammableWaveData_2016CCC:
.incbin "sound/sa2/programmable_wave_samples/02.pcm"
.incbin "sound/shared/programmable_wave_samples/02.pcm"
.align 2
.global ProgrammableWaveData_2016CDC
ProgrammableWaveData_2016CDC:
.incbin "sound/sa2/programmable_wave_samples/03.pcm"
.incbin "sound/shared/programmable_wave_samples/03.pcm"
.align 2
.global ProgrammableWaveData_2016CEC
ProgrammableWaveData_2016CEC:
.incbin "sound/sa2/programmable_wave_samples/04.pcm"
.incbin "sound/shared/programmable_wave_samples/04.pcm"
.align 2
.global ProgrammableWaveData_2016CFC
ProgrammableWaveData_2016CFC:
.incbin "sound/sa2/programmable_wave_samples/05.pcm"
.incbin "sound/shared/programmable_wave_samples/05.pcm"
.align 2
.global ProgrammableWaveData_2016D0C
ProgrammableWaveData_2016D0C:
.incbin "sound/sa2/programmable_wave_samples/06.pcm"
.incbin "sound/shared/programmable_wave_samples/06.pcm"
.align 2
.global ProgrammableWaveData_2016D1C
ProgrammableWaveData_2016D1C:
.incbin "sound/sa2/programmable_wave_samples/07.pcm"
.incbin "sound/shared/programmable_wave_samples/07.pcm"
.align 2
.global ProgrammableWaveData_2016D2C
ProgrammableWaveData_2016D2C:
.incbin "sound/sa2/programmable_wave_samples/08.pcm"
.incbin "sound/shared/programmable_wave_samples/08.pcm"
.align 2
.global ProgrammableWaveData_2016D3C
ProgrammableWaveData_2016D3C:
.incbin "sound/sa2/programmable_wave_samples/09.pcm"
.incbin "sound/shared/programmable_wave_samples/09.pcm"
.align 2
.global ProgrammableWaveData_2016D4C
ProgrammableWaveData_2016D4C:
.incbin "sound/sa2/programmable_wave_samples/10.pcm"
.incbin "sound/shared/programmable_wave_samples/10.pcm"
File renamed without changes.
+53
View File
@@ -0,0 +1,53 @@
import os
import hashlib
import shutil
from pathlib import Path
files_by_hash = {}
sa2_to_sa1_sample = {}
for root, _, files in os.walk("sound/sa2/programmable_wave_samples"):
for file in files:
if file.endswith(".pcm"):
path = root + "/" + file
with open(path, 'rb') as f:
files_by_hash[hashlib.md5(f.read()).hexdigest()] = path
for root, _, files in os.walk("sound/sa1/programmable_wave_samples"):
for file in files:
if file.endswith(".pcm"):
path = root + "/" + file
with open(path, 'rb') as f:
hash = hashlib.md5(f.read()).hexdigest()
if hash in files_by_hash:
sa2_to_sa1_sample[files_by_hash[hash]] = path
for file in sa2_to_sa1_sample:
new_path = file.replace("/sa2/", "/shared/")
Path(new_path).parent.mkdir(parents=True, exist_ok=True)
shutil.copy(file, new_path)
contents = ""
with open("sound/sa1/programmable_wave_data.inc") as sound_data_file:
contents = sound_data_file.read()
for file in sa2_to_sa1_sample:
sa1_file = sa2_to_sa1_sample[file]
contents = contents.replace(sa1_file, file.replace("/sa2/", "/shared/"))
with open("sound/sa1/programmable_wave_data.inc", "w") as sound_data_file:
sound_data_file.write(contents)
contents = ""
with open("sound/sa2/programmable_wave_data.inc") as sound_data_file:
contents = sound_data_file.read()
for file in sa2_to_sa1_sample:
contents = contents.replace(file.replace(".aif", ".bin"), file.replace("/sa2/", "/shared/"))
with open("sound/sa2/programmable_wave_data.inc", "w") as sound_data_file:
sound_data_file.write(contents)
for sa2_file, sa1_file in sa2_to_sa1_sample.items():
os.remove(sa2_file)
os.remove(sa1_file)
+9 -9
View File
@@ -1,44 +1,44 @@
mAlignWord
.global ProgrammableWaveData_86DD6D0
ProgrammableWaveData_86DD6D0:
.incbin "sound/sa1/programmable_wave_samples/086DD6D0.pcm"
.incbin "sound/shared/programmable_wave_samples/02.pcm"
mAlignWord
.global ProgrammableWaveData_86DD6E0
ProgrammableWaveData_86DD6E0:
.incbin "sound/sa1/programmable_wave_samples/086DD6E0.pcm"
.incbin "sound/shared/programmable_wave_samples/03.pcm"
mAlignWord
.global ProgrammableWaveData_86DD6F0
ProgrammableWaveData_86DD6F0:
.incbin "sound/sa1/programmable_wave_samples/086DD6F0.pcm"
.incbin "sound/shared/programmable_wave_samples/04.pcm"
mAlignWord
.global ProgrammableWaveData_86DD700
ProgrammableWaveData_86DD700:
.incbin "sound/sa1/programmable_wave_samples/086DD700.pcm"
.incbin "sound/shared/programmable_wave_samples/05.pcm"
mAlignWord
.global ProgrammableWaveData_86DD710
ProgrammableWaveData_86DD710:
.incbin "sound/sa1/programmable_wave_samples/086DD710.pcm"
.incbin "sound/shared/programmable_wave_samples/06.pcm"
mAlignWord
.global ProgrammableWaveData_86DD720
ProgrammableWaveData_86DD720:
.incbin "sound/sa1/programmable_wave_samples/086DD720.pcm"
.incbin "sound/shared/programmable_wave_samples/07.pcm"
mAlignWord
.global ProgrammableWaveData_86DD730
ProgrammableWaveData_86DD730:
.incbin "sound/sa1/programmable_wave_samples/086DD730.pcm"
.incbin "sound/shared/programmable_wave_samples/08.pcm"
mAlignWord
.global ProgrammableWaveData_86DD740
ProgrammableWaveData_86DD740:
.incbin "sound/sa1/programmable_wave_samples/086DD740.pcm"
.incbin "sound/shared/programmable_wave_samples/09.pcm"
mAlignWord
.global ProgrammableWaveData_86DD750
ProgrammableWaveData_86DD750:
.incbin "sound/sa1/programmable_wave_samples/086DD750.pcm"
.incbin "sound/shared/programmable_wave_samples/10.pcm"
Binary file not shown.
@@ -1 +0,0 @@
#Eg‰«ÍďţÜş�vT2
Binary file not shown.
@@ -1 +0,0 @@
�ワコ刪��wwwfT2
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -1 +0,0 @@
��シャィ@GV�゙
+9 -9
View File
@@ -4,36 +4,36 @@ ProgrammableWaveData_1:
mAlignWord
ProgrammableWaveData_2:
.incbin "sound/sa2/programmable_wave_samples/02.pcm"
.incbin "sound/shared/programmable_wave_samples/02.pcm"
mAlignWord
ProgrammableWaveData_3:
.incbin "sound/sa2/programmable_wave_samples/03.pcm"
.incbin "sound/shared/programmable_wave_samples/03.pcm"
mAlignWord
ProgrammableWaveData_4:
.incbin "sound/sa2/programmable_wave_samples/04.pcm"
.incbin "sound/shared/programmable_wave_samples/04.pcm"
mAlignWord
ProgrammableWaveData_5:
.incbin "sound/sa2/programmable_wave_samples/05.pcm"
.incbin "sound/shared/programmable_wave_samples/05.pcm"
mAlignWord
ProgrammableWaveData_6:
.incbin "sound/sa2/programmable_wave_samples/06.pcm"
.incbin "sound/shared/programmable_wave_samples/06.pcm"
mAlignWord
ProgrammableWaveData_7:
.incbin "sound/sa2/programmable_wave_samples/07.pcm"
.incbin "sound/shared/programmable_wave_samples/07.pcm"
mAlignWord
ProgrammableWaveData_8:
.incbin "sound/sa2/programmable_wave_samples/08.pcm"
.incbin "sound/shared/programmable_wave_samples/08.pcm"
mAlignWord
ProgrammableWaveData_9:
.incbin "sound/sa2/programmable_wave_samples/09.pcm"
.incbin "sound/shared/programmable_wave_samples/09.pcm"
mAlignWord
ProgrammableWaveData_10:
.incbin "sound/sa2/programmable_wave_samples/10.pcm"
.incbin "sound/shared/programmable_wave_samples/10.pcm"