Skip to content
This repository has been archived by the owner on Dec 22, 2024. It is now read-only.

Commit

Permalink
Fix misunderstood value in .wwise_stream/.wwise_bank header
Browse files Browse the repository at this point in the history
The value is not actually an offset to a footer, but the length of the actual data. This fixes corrupted .wem/.bnk file exports
  • Loading branch information
Xaymar committed Feb 29, 2024
1 parent 2defbc5 commit 4e82fd8
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 5 deletions.
3 changes: 2 additions & 1 deletion extra/vgmstream/decode.bat
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ SET "SCRIPTROOT=%~dp0"
CALL :INDEX "%~1"
SHIFT /1
IF "%~n1" == "" (
PAUSE
GOTO :EOF
)
GOTO :FILELOOP
Expand Down Expand Up @@ -49,7 +50,7 @@ EXIT /B 0

:TRANSCODE
ECHO %~dpn1
"%~dp0\vgmstream-cli.exe" -o "%~dpn1.wav" "%~1"
"%~dp0\vgmstream-cli.exe" -o "%SCRIPTROOT%\%~n1.wav" "%~1"
if ERRORLEVEL 1 (
PAUSE
)
Expand Down
3 changes: 1 addition & 2 deletions source/hd2_wwise_bank.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,8 @@ helldivers2::wwise_bank::~wwise_bank() {}
helldivers2::wwise_bank::wwise_bank(helldivers2::data::meta_t meta) : _meta(meta)
{
_header = reinterpret_cast<decltype(_header)>(_meta.main);
_footer = reinterpret_cast<decltype(_footer)>(reinterpret_cast<uint8_t const*>(_meta.main) + _header->offset);
_data = reinterpret_cast<decltype(_data)>(_meta.main) + sizeof(header_t);
_data_sz = _meta.main_size - sizeof(header_t) - sizeof(footer_t);
_data_sz = _header->size;
}

size_t helldivers2::wwise_bank::size()
Expand Down
3 changes: 1 addition & 2 deletions source/hd2_wwise_stream.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@ helldivers2::wwise_stream::wwise_stream(helldivers2::data::meta_t meta) : _meta(
{
_header = reinterpret_cast<decltype(_header)>(_meta.main);
_data = reinterpret_cast<decltype(_data)>(_meta.stream ? _meta.stream : _meta.gpu);
_footer = reinterpret_cast<decltype(_footer)>(reinterpret_cast<uint8_t const*>(_data) + _header->offset - _meta.main_size);
_data_sz = (_meta.stream_size ? _meta.stream_size : _meta.gpu_size) - sizeof(footer_t);
_data_sz = _header->size;
}

size_t helldivers2::wwise_stream::size()
Expand Down

0 comments on commit 4e82fd8

Please sign in to comment.