@echo off
if not exist touhouSE.exe goto error0
if not exist th155.pak goto error1
if not exist th155b.pak goto error2
if not exist oggdec.exe goto error3

md th155tmp
copy touhouSE.exe th155tmp
copy th155.pak th155tmp
copy th155b.pak th155tmp
copy oggdec.exe th155tmp
cd th155tmp
md th155_wave
touhouSE.exe --cui th155.pak
touhouSE.exe --cui th155b.pak
oggdec.exe -w th155_wave\155reimu1.wav data\bgm\155reimu1.ogg
oggdec.exe -w th155_wave\155marisa1.wav data\bgm\155marisa1.ogg
oggdec.exe -w th155_wave\155ichirin1.wav data\bgm\155ichirin1.ogg
oggdec.exe -w th155_wave\155hijiri1.wav data\bgm\155hijiri1.ogg
oggdec.exe -w th155_wave\155futo1.wav data\bgm\155futo1.ogg
oggdec.exe -w th155_wave\155miko1.wav data\bgm\155miko1.ogg
oggdec.exe -w th155_wave\155nitori1.wav data\bgm\155nitori1.ogg
oggdec.exe -w th155_wave\155koishi1.wav data\bgm\155koishi1.ogg
oggdec.exe -w th155_wave\155mamizou1.wav data\bgm\155mamizou1.ogg
oggdec.exe -w th155_wave\155kokoro1.wav data\bgm\155kokoro1.ogg
oggdec.exe -w th155_wave\155mokou1.wav data\bgm\155mokou1.ogg
oggdec.exe -w th155_wave\155sinmyoumaru1.wav data\bgm\155sinmyoumaru1.ogg
oggdec.exe -w th155_wave\155kasen1.wav data\bgm\155kasen1.ogg
oggdec.exe -w th155_wave\155usami1.wav data\bgm\155usami1.ogg
oggdec.exe -w th155_wave\155udonge1.wav data\bgm\155udonge1.ogg
oggdec.exe -w th155_wave\155doremy1.wav data\bgm\155doremy1.ogg
oggdec.exe -w th155_wave\155tenshi1.wav data\bgm\155tenshi1(1).ogg
oggdec.exe -w th155_wave\155yukari1.wav data\bgm\155yukari1(1).ogg
oggdec.exe -w th155_wave\bgst01.wav data\bgm\bgst01.ogg
oggdec.exe -w th155_wave\bgst02.wav data\bgm\bgst02.ogg
oggdec.exe -w th155_wave\bgst03.wav data\bgm\bgst03(1).ogg
oggdec.exe -w th155_wave\bgst04.wav data\bgm\bgst04.ogg
oggdec.exe -w th155_wave\bgst05.wav data\bgm\bgst05.ogg
oggdec.exe -w th155_wave\bgst06.wav data\bgm\bgst06(1).ogg
oggdec.exe -w th155_wave\bgst07.wav data\bgm\bgst07.ogg
oggdec.exe -w th155_wave\bgst08.wav data\bgm\bgst08.ogg
oggdec.exe -w th155_wave\bgst09.wav data\bgm\bgst09.ogg
oggdec.exe -w th155_wave\bgst10.wav data\bgm\bgst10.ogg
oggdec.exe -w th155_wave\bgst11.wav data\bgm\bgst11(1).ogg
oggdec.exe -w th155_wave\bgst12.wav data\bgm\bgst12.ogg
oggdec.exe -w th155_wave\bgst13.wav data\bgm\bgst13.ogg
oggdec.exe -w th155_wave\bgst14.wav data\bgm\bgst14.ogg
oggdec.exe -w th155_wave\bgst15.wav data\bgm\bgst15.ogg
oggdec.exe -w th155_wave\bgst16.wav data\bgm\bgst16.ogg
oggdec.exe -w th155_wave\bgst17.wav data\bgm\bgst17.ogg
oggdec.exe -w th155_wave\midboss.wav data\bgm\midboss.ogg
oggdec.exe -w th155_wave\lastboss.wav data\bgm\lastboss.ogg
oggdec.exe -w th155_wave\145st01.wav data\bgm\145st01.ogg
oggdec.exe -w th155_wave\145st02.wav data\bgm\145st02.ogg
oggdec.exe -w th155_wave\145st03.wav data\bgm\145st03.ogg
oggdec.exe -w th155_wave\145st04.wav data\bgm\145st04.ogg
oggdec.exe -w th155_wave\story01.wav data\bgm\story01.ogg
oggdec.exe -w th155_wave\story02.wav data\bgm\story02.ogg
oggdec.exe -w th155_wave\story03.wav data\bgm\story03.ogg
oggdec.exe -w th155_wave\story04.wav data\bgm\story04.ogg
oggdec.exe -w th155_wave\story05.wav data\bgm\story05.ogg
oggdec.exe -w th155_wave\story06.wav data\bgm\story06.ogg
oggdec.exe -w th155_wave\story07.wav data\bgm\story07.ogg
oggdec.exe -w th155_wave\story08.wav data\bgm\story08.ogg
oggdec.exe -w th155_wave\story09.wav data\bgm\story09.ogg
oggdec.exe -w th155_wave\ending.wav data\bgm\ending.ogg
oggdec.exe -w th155_wave\th155op1.wav data\bgm\th155op1.ogg
oggdec.exe -w th155_wave\th155op2.wav data\bgm\th155op2.ogg
oggdec.exe -w th155_wave\staffroll0.wav data\bgm\staffroll0.ogg
oggdec.exe -w th155_wave\th155op3.wav data\bgm\th155op3.ogg
oggdec.exe -w th155_wave\staffroll1.wav data\bgm\staffroll1.ogg
oggdec.exe -w th155_wave\th155op4.wav data\bgm\th155op4.ogg
oggdec.exe -w th155_wave\staffroll2.wav data\bgm\staffroll2.ogg

cd th155_wave
copy /b 155reimu1.wav + 155marisa1.wav + 155ichirin1.wav + 155hijiri1.wav + 155futo1.wav + 155miko1.wav + 155nitori1.wav + 155koishi1.wav + 155mamizou1.wav + 155kokoro1.wav + 155mokou1.wav + 155sinmyoumaru1.wav + 155kasen1.wav + 155usami1.wav + 155udonge1.wav + 155doremy1.wav + 155tenshi1.wav + 155yukari1.wav + bgst01.wav + bgst02.wav + bgst03.wav + bgst04.wav + bgst05.wav + bgst06.wav + bgst07.wav + bgst08.wav + bgst09.wav + bgst10.wav + bgst11.wav + bgst12.wav + bgst13.wav + bgst14.wav + bgst15.wav + bgst16.wav + bgst17.wav + midboss.wav + lastboss.wav + 145st01.wav + 145st02.wav + 145st03.wav + 145st04.wav + story01.wav + story02.wav + story03.wav + story04.wav + story05.wav + story06.wav + story07.wav + story08.wav + story09.wav + ending.wav + th155op1.wav + th155op2.wav + staffroll0.wav + th155op3.wav + staffroll1.wav + th155op4.wav + staffroll2.wav ..\..\th155_bgm_tmp.dat
cd ..\..\
rd /s /q th155tmp
goto success

:error1
echo touhouSE.exeが見つかりません。
echo 処理は失敗しました。
goto end

:error1
echo th155.pakが見つかりません。
echo 処理は失敗しました。
goto end

:error2
echo th155b.pakが見つかりません。
echo 処理は失敗しました。
goto end

:error3
echo oggdec.exeが見つかりません。
echo 処理は失敗しました。
goto end

:success
echo 処理は正常に終了しました。

:end
pause
