diff --git a/.gitattributes b/.gitattributes deleted file mode 100644 index bdb0cab..0000000 --- a/.gitattributes +++ /dev/null @@ -1,17 +0,0 @@ -# Auto detect text files and perform LF normalization -* text=auto - -# Custom for Visual Studio -*.cs diff=csharp - -# Standard to msysgit -*.doc diff=astextplain -*.DOC diff=astextplain -*.docx diff=astextplain -*.DOCX diff=astextplain -*.dot diff=astextplain -*.DOT diff=astextplain -*.pdf diff=astextplain -*.PDF diff=astextplain -*.rtf diff=astextplain -*.RTF diff=astextplain diff --git a/.gitignore b/.gitignore index aea509d..0ff425a 100644 --- a/.gitignore +++ b/.gitignore @@ -1,48 +1,5 @@ -# Windows image file caches -Thumbs.db -ehthumbs.db - -# Folder config file -Desktop.ini - -# Recycle Bin used on file shares -$RECYCLE.BIN/ - -# Windows Installer files -*.cab -*.msi -*.msm -*.msp - -# Windows shortcuts -*.lnk - -# ========================= -# Operating System Files -# ========================= - -# OSX -# ========================= - -.DS_Store -.AppleDouble -.LSOverride - -# Thumbnails -._* - -# Files that might appear on external disk -.Spotlight-V100 -.Trashes - -# Directories potentially created on remote AFP share -.AppleDB -.AppleDesktop -Network Trash Folder -Temporary Items -.apdisk - *.wem *.pck *.bnk *.wav +*.mp3 diff --git a/Game Files/.keep b/Game Files/.keep deleted file mode 100644 index 8b13789..0000000 --- a/Game Files/.keep +++ /dev/null @@ -1 +0,0 @@ - diff --git a/Game_Files/.keep b/Game_Files/.keep new file mode 100644 index 0000000..e69de29 diff --git a/Tools/wavescan.bms b/Tools/wavescan.bms index 3c9d6e1..2985b09 100644 --- a/Tools/wavescan.bms +++ b/Tools/wavescan.bms @@ -8,72 +8,72 @@ # - option to also write data between found wave files to disk # - option to automatically transform the file to a playable or at least decodable format -for i = 1 # run through loop with count variable i - FindLoc OFFSET string "WAVE" 0 "" # search for "WAVE", save position as variable OFFSET - if OFFSET == "" # when nothing is found - cleanexit # the script exits (e.g. at end of file) +for i = 1 # run through loop with count variable i + FindLoc OFFSET string "WAVE" 0 "" # search for "WAVE", save position as variable OFFSET + if OFFSET == "" # when nothing is found + cleanexit # the script exits (e.g. at end of file) endif - math OFFSET -= 8 # jump to possible - goto OFFSET # RIFF/RIFX file start - getDstring IDENT 4 # read string of 4 bytes, save variable as IDENT - if IDENT == "RIFX" # differentiate between header possibilities - endian big # set endianness to big, if file has RIFX identifier - callfunction write 1 # see function section below - elif IDENT == "RIFF" # endianness stays little - callfunction write 1 # also run function - else # string "WAVE" found, but doesn't belong to wave file - set SIZE 0xc # do as if something with 0xc bytes was found to continue search from the right position + math OFFSET -= 8 # jump to possible + goto OFFSET # RIFF/RIFX file start + getDstring IDENT 4 # read string of 4 bytes, save variable as IDENT + if IDENT == "RIFX" # differentiate between header possibilities + endian big # set endianness to big, if file has RIFX identifier + callfunction write 1 # see function section below + elif IDENT == "RIFF" # endianness stays little + callfunction write 1 # also run function + else # string "WAVE" found, but doesn't belong to wave file + set SIZE 0xc # do as if something with 0xc bytes was found to continue search from the right position endif - set SEARCH OFFSET # set marker to position from where to search next - math SEARCH += SIZE # (that would be after the file that was found) - if SEARCH == FSIZE # in case the last found file ends with the main file, we exit + set SEARCH OFFSET # set marker to position from where to search next + math SEARCH += SIZE # (that would be after the file that was found) + if SEARCH == FSIZE # in case the last found file ends with the main file, we exit cleanexit endif - goto SEARCH # if we haven't exited the script above, we set out cursor to after the last found file + goto SEARCH # if we haven't exited the script above, we set out cursor to after the last found file next i -startfunction write # function "write" starts here, is called when a wave file is found above - get NAME basename # save name without extension under variable NAME - string NAME += "_" # add underscore to the name - string NAME += i # add the loop variable to the name - goto OFFSET # set cursor to the beginning of the found file - get DUMMY long # RIFF/RIFX identifier, not needed - get DUMMY long # riff size, not needed - get DUMMY long # "WAVE", not needed, we arrive at the "fmt " section - for # loop search for the "data" section at the start of the stream (get the stream size from there) - getDstring AREA_NAME 4 # name of area in header - get AREA_SIZE long # size of area in header - savepos MYOFF # save position we are at - if AREA_NAME == "data" # when we arrive at the needed "data" area: - break # we exit the loop - else # otherwise: - if AREA_NAME == "LIST" # that's the area of the marker names - callfunction retrievename 1 # see below +startfunction write # function "write" starts here, is called when a wave file is found above + get NAME basename # save name without extension under variable NAME + string NAME += "_" # add underscore to the name + string NAME += i # add the loop variable to the name + goto OFFSET # set cursor to the beginning of the found file + get DUMMY long # RIFF/RIFX identifier, not needed + get DUMMY long # riff size, not needed + get DUMMY long # "WAVE", not needed, we arrive at the "fmt " section + for # loop search for the "data" section at the start of the stream (get the stream size from there) + getDstring AREA_NAME 4 # name of area in header + get AREA_SIZE long # size of area in header + savepos MYOFF # save position we are at + if AREA_NAME == "data" # when we arrive at the needed "data" area: + break # we exit the loop + else # otherwise: + if AREA_NAME == "LIST" # that's the area of the marker names + callfunction retrievename 1 # see below endif - math MYOFF += AREA_SIZE # not reached "data" area -> adjust cursor position... - goto MYOFF # ... and go there + math MYOFF += AREA_SIZE # not reached "data" area -> adjust cursor position... + goto MYOFF # ... and go there endif - next # remember: the cursor is now directly at the stream start - set STREAMSIZE AREA_SIZE # the last AREA_SIZE is the size we need (size of the audio stream) - set HEADERSIZE MYOFF # - math HEADERSIZE -= OFFSET # calculate the size of the stream header (offset - offset = size) - set SIZE HEADERSIZE # - math SIZE += STREAMSIZE # calculate complete file size (header + stream = file) - log MEMORY_FILE OFFSET SIZE # write file to memory - math SIZE -= 8 # subtract 8 bytes to get the riff size - putVarChr MEMORY_FILE 4 SIZE long # write the correct riff size to the header inside the memory - string NAME += ".wem" # add extension to the name (the name could contain the name of the first marker if the file has markers) - math SIZE += 8 # add the subtracted 8 bytes again - log NAME 0 SIZE MEMORY_FILE # write file in memory to disk -endfunction # remember that we continue with our next i now! + next # remember: the cursor is now directly at the stream start + set STREAMSIZE AREA_SIZE # the last AREA_SIZE is the size we need (size of the audio stream) + set HEADERSIZE MYOFF + math HEADERSIZE -= OFFSET # calculate the size of the stream header (offset - offset = size) + set SIZE HEADERSIZE + math SIZE += STREAMSIZE # calculate complete file size (header + stream = file) + log MEMORY_FILE OFFSET SIZE # write file to memory + math SIZE -= 8 # subtract 8 bytes to get the riff size + putVarChr MEMORY_FILE 4 SIZE long # write the correct riff size to the header inside the memory + string NAME += ".wem" # add extension to the name (the name could contain the name of the first marker if the file has markers) + math SIZE += 8 # add the subtracted 8 bytes again + log NAME 0 SIZE MEMORY_FILE # write file in memory to disk +endfunction # remember that we continue with our next i now! -startfunction retrievename # get possible file name from first marker name, rmember: our cursor is after the size of the LIST area - get DUMMY long # always "adtl", not needed - get DUMMY long # always "labl", not needed - get MSIZE long # size of the label area for this marker - math MSIZE -= 4 # subtracting 4 bytes leaves us with the length of the marker label - get DUMMY long # marker type, not needed - getDstring MNAME MSIZE # cursor is at the beginning of the label name, now get the marker name with the desired length MSIZE +startfunction retrievename # get possible file name from first marker name, remember: our cursor is after the size of the LIST area + get DUMMY long # always "adtl", not needed + get DUMMY long # always "labl", not needed + get MSIZE long # size of the label area for this marker + math MSIZE -= 4 # subtracting 4 bytes leaves us with the length of the marker label + get DUMMY long # marker type, not needed + getDstring MNAME MSIZE # cursor is at the beginning of the label name, now get the marker name with the desired length MSIZE string NAME += "~" - string NAME += MNAME # add the marker name to the file name -endfunction \ No newline at end of file + string NAME += MNAME # add the marker name to the file name +endfunction diff --git a/Unpack to MP3.bat b/Unpack to MP3.bat deleted file mode 100644 index b1908fd..0000000 --- a/Unpack to MP3.bat +++ /dev/null @@ -1,2 +0,0 @@ -@echo off -_unpack_common.bat MP3 diff --git a/Unpack to WAV.bat b/Unpack to WAV.bat deleted file mode 100644 index cfe4395..0000000 --- a/Unpack to WAV.bat +++ /dev/null @@ -1,2 +0,0 @@ -@echo off -_unpack_common.bat WAV diff --git a/_unpack_common.bat b/_unpack_common.bat deleted file mode 100644 index 1109112..0000000 --- a/_unpack_common.bat +++ /dev/null @@ -1,73 +0,0 @@ -@echo off - -set TYPE=%1 -echo === Wwise_Unpacker v1.2 === -echo. -echo -- Unpacking to '%TYPE%' - -goto:start - -rem ================= Methods -:UNPACK_WAV - echo -- UNPACK_WAV - mkdir Decoding > nul 2>&1 - mkdir WAV > nul 2>&1 - echo ... Running 'quickbms' - FOR %%a IN ("Game Files\*.PCK") DO ("Tools\quickbms.exe" "Tools\wwise_pck_extractor.bms" "%%a" "Decoding") - echo ... Running 'bnkextr' - FOR %%b IN ("Game Files\*.BNK") DO ("Tools\bnkextr.exe" "%%b" & REN *.wav *.wem & MOVE *.wem "Decoding") - echo ... Running 'vgmstream-cli' - FOR %%a IN ("Decoding\*.WEM") DO ("Tools\vgmstream-cli.exe" -o "WAV\%%~na.wav" "%%a" & echo.) -goto:eof - -:UNPACK_MP3 - echo -- UNPACK_MP3 - mkdir MP3 > nul 2>&1 - rem call :UNPACK_WAV - echo ... Running 'ffmpeg' - FOR %%e IN (WAV\*.WAV) DO (echo Converting %%e & "Tools\ffmpeg.exe" -loglevel error -y -i "%%e" -acodec libmp3lame -q:a 0 -y "MP3\%%~ne.mp3" & DEL "%%e") -goto:eof - - -rem ================= Main -:start -if "%TYPE%"=="WAV" ( - call :UNPACK_WAV -) -if "%TYPE%"=="MP3" ( - call :UNPACK_MP3 -) - - -rem ================= Footer -echo. -echo. -echo. -echo. -echo. -echo. -echo. -echo (( '####@@!!$$ )) -echo `#####@@!$$` )) -echo (( '####@!!$: -echo (( ,####@!!$: )) -echo .###@!!$: -echo `##@@!$: -echo `#@!!$ -echo !@# `#@!$: @#$ -echo #$ `#@!$: !@! -echo '@!$: -echo '`\ '!$: /`' -echo '\ '!: /' -echo '\ : /' -echo -.'-/\\\-.'//.-'/:'\.'-.JrS'.'-=_\\ -echo ' -.'-.\\'-.'//.-'.`-.'_\\-.'.-\'.-// -echo Watch out, it's the tornado! - -echo. -echo ------------------------------------------------------------- -echo Unpack finished! Files should be in the '%TYPE%' folder -echo ------------------------------------------------------------- -echo. - -pause \ No newline at end of file diff --git a/unpack.bat b/unpack.bat new file mode 100644 index 0000000..efbdd0e --- /dev/null +++ b/unpack.bat @@ -0,0 +1,65 @@ +@echo off + +set TYPE=%1 +echo === Wwise_Unpacker v1.3 === +echo. +echo == Unpacking to '%TYPE%' +echo. + +goto:start + +rem ================= Methods +:UNPACK_WAV + mkdir dest_raw > nul 2>&1 + mkdir dest_wav > nul 2>&1 + + echo ---- Running 'quickbms': Extract raw files + for %%a in ("Game_Files\*.pck") do (Tools\quickbms.exe -q -k Tools\wwise_pck_extractor.bms "%%a" "dest_raw") + echo. + + echo ---- Running 'bnkextr' + for %%b in ("Game_Files\*.bnk") do ( + Tools\bnkextr.exe "%%b" > nul + ren *.wav *.wem + move *.wem "dest_raw" + ) + echo. + + echo ---- Running 'vgmstream-cli': Convert to wav + for /r "dest_raw" %%c in ("*.wem") do (Tools\vgmstream-cli.exe -o "dest_wav\%%~nc.wav" "%%c" > nul) + echo. +goto:eof + + +:UNPACK_MP3 + if not exist dest_wav ( + call :UNPACK_WAV + ) + + mkdir dest_mp3 > nul 2>&1 + + echo ---- Running 'ffmpeg': Convert to mp3 + for /r "dest_wav" %%a in ("*.wav") do ( + echo Converting %%~nxa + Tools\ffmpeg.exe -loglevel error -y -i "%%a" -acodec libmp3lame -q:a 0 -y "dest_mp3\%%~na.mp3" + ) + echo. +goto:eof + + +rem ================= Main +:start +if "%TYPE%"=="wav" ( + call :UNPACK_WAV +) +if "%TYPE%"=="mp3" ( + call :UNPACK_MP3 +) + + +rem ================= Footer +echo ------------------------------------------------------------- +echo == Unpack finished! Files should be in the 'dest_%TYPE%' folder +echo ------------------------------------------------------------- + +pause diff --git a/unpack_mp3.bat b/unpack_mp3.bat new file mode 100644 index 0000000..7854acf --- /dev/null +++ b/unpack_mp3.bat @@ -0,0 +1,2 @@ +@echo off +unpack mp3 diff --git a/unpack_wav.bat b/unpack_wav.bat new file mode 100644 index 0000000..71f1fca --- /dev/null +++ b/unpack_wav.bat @@ -0,0 +1,2 @@ +@echo off +unpack wav