From d1b71f705f978bb23df1c44601cb6701188d70bd Mon Sep 17 00:00:00 2001 From: bnnm Date: Fri, 27 Aug 2021 22:20:26 +0200 Subject: [PATCH 1/3] Add .xsh+xsd variations [Minority Report (Xbox)] --- src/meta/xsh_xsd_xss.c | 56 ++++++++++++++++++++++++++---------------- 1 file changed, 35 insertions(+), 21 deletions(-) diff --git a/src/meta/xsh_xsd_xss.c b/src/meta/xsh_xsd_xss.c index 2f12b540..4e9a80e0 100644 --- a/src/meta/xsh_xsd_xss.c +++ b/src/meta/xsh_xsd_xss.c @@ -2,7 +2,7 @@ #include "../coding/coding.h" -/* XSH+XSD/XSS - from Treyarch games [Spider-Man 2002 (Xbox), Kelly Slater's Pro Surfer (Xbox)] */ +/* XSH+XSD/XSS - from Treyarch games */ VGMSTREAM* init_vgmstream_xsh_xsd_xss(STREAMFILE* sf) { VGMSTREAM* vgmstream = NULL; STREAMFILE* sf_body = NULL; @@ -30,34 +30,47 @@ VGMSTREAM* init_vgmstream_xsh_xsd_xss(STREAMFILE* sf) { if (target_subsong < 0 || target_subsong > total_subsongs || total_subsongs < 1) goto fail; switch(version) { - case 0x009D: + case 0x009D: /* Spider-Man 2002 (Xbox) */ offset = 0x0c + (target_subsong-1) * 0x60; name_offset = offset + 0x00; name_size = 0x20; - stream_type = read_u32le(offset + 0x20,sf); - stream_offset = read_u32le(offset + 0x24,sf); - stream_size = read_u32le(offset + 0x28,sf); - flags = read_u32le(offset + 0x34,sf); - /* 0x38: flags? */ + offset += 0x20; + + stream_type = read_u32le(offset + 0x00,sf); + stream_offset = read_u32le(offset + 0x04,sf); + stream_size = read_u32le(offset + 0x08,sf); + flags = read_u32le(offset + 0x14,sf); + /* 0x18: flags? */ num_samples = 0; - offset = offset + 0x3c; + offset += 0x1c; break; - case 0x0100: - offset = 0x0c + (target_subsong-1) * 0x64; + case 0x0100: /* Kelly Slater's Pro Surfer (Xbox) */ + case 0x0101: /* Minority Report: Everybody Runs (Xbox), NHL 2K3 (Xbox) */ + /* NHL has stream IDs instead of names */ + if (read_u32le(0x0c,sf) > 0x1000) { + offset = 0x0c + (target_subsong-1) * 0x64; + name_offset = offset + 0x00; + name_size = 0x20; + offset += 0x20; + } + else { + offset = 0x0c + (target_subsong-1) * 0x48; + name_offset = offset + 0x00; + name_size = 0x00; + offset += 0x04; + } - name_offset = offset + 0x00; - name_size = 0x20; - stream_type = read_u32le(offset + 0x20,sf); - stream_offset = read_u32le(offset + 0x24,sf); - stream_size = read_u32le(offset + 0x28,sf); - flags = read_u32le(offset + 0x34,sf); - num_samples = read_u32le(offset + 0x38,sf); - /* 0x3c: flags? */ + stream_type = read_u32le(offset + 0x00,sf); + stream_offset = read_u32le(offset + 0x04,sf); + stream_size = read_u32le(offset + 0x08,sf); + flags = read_u32le(offset + 0x14,sf); + num_samples = read_u32le(offset + 0x18,sf); + /* 0x1c: flags? */ - offset = offset + 0x40; + offset += 0x20; break; default: @@ -90,7 +103,7 @@ VGMSTREAM* init_vgmstream_xsh_xsd_xss(STREAMFILE* sf) { char filename[255]; switch (version) { case 0x009D: - /* stream is a named .xss, with stream_offset/size = 0 (Spider-Man) */ + /* stream is a named .xss, with stream_offset/size = 0 */ read_string(filename, name_size, name_offset,sf); strcat(filename, ".xss"); @@ -112,7 +125,8 @@ VGMSTREAM* init_vgmstream_xsh_xsd_xss(STREAMFILE* sf) { //break; case 0x0100: - /* bigfile with all streams (Kelly Slater) */ + case 0x0101: + /* bigfile with all streams */ snprintf(filename, sizeof(filename), "%s", "STREAMS.XSS"); sf_body = open_streamfile_by_filename(sf,filename); if (!sf_body) { From c8b2a63920158be2f4770be7dde438bed1b76d59 Mon Sep 17 00:00:00 2001 From: bnnm Date: Fri, 27 Aug 2021 22:20:44 +0200 Subject: [PATCH 2/3] Ignore loop count 0 in foobar/winamp --- fb2k/foo_prefs.cpp | 4 ++++ winamp/in_config.c | 8 ++++++++ 2 files changed, 12 insertions(+) diff --git a/fb2k/foo_prefs.cpp b/fb2k/foo_prefs.cpp index 8bf6f79b..b7b43cb0 100755 --- a/fb2k/foo_prefs.cpp +++ b/fb2k/foo_prefs.cpp @@ -40,6 +40,10 @@ void input_vgmstream::load_settings() { override_title = cfg_OverrideTitle; //exts_unknown_on = cfg_ExtsUnknownOn; //exts_common_on = cfg_ExtsCommonOn; + + /* exact 0 was allowed before (AKA "intro only") but confuses people and may result in unplayable files */ + if (loop_count <= 0) + loop_count = 1; } void input_vgmstream::g_load_cfg(int *accept_unknown, int *accept_common) { //todo improve diff --git a/winamp/in_config.c b/winamp/in_config.c index 720aa20a..a0f7349b 100644 --- a/winamp/in_config.c +++ b/winamp/in_config.c @@ -169,6 +169,10 @@ static void ini_set_b(const char *inifile, const char *entry, int val) { if (settings->loop_forever && settings->ignore_loop) settings->ignore_loop = 0; + + /* exact 0 was allowed before (AKA "intro only") but confuses people and may result in unplayable files */ + if (settings->loop_count <= 0) + settings->loop_count = 1; } static void save_config(In_Module* input_module, winamp_settings_t* settings) { @@ -277,6 +281,10 @@ static int dlg_load_form(HWND hDlg, winamp_settings_t* settings) { dlg_combo_get(hDlg, IDC_GAIN_TYPE, (int*)&settings->gain_type); dlg_combo_get(hDlg, IDC_CLIP_TYPE, (int*)&settings->clip_type); + /* exact 0 was allowed before (AKA "intro only") but confuses people and may result in unplayable files */ + if (settings->loop_count <= 0) + settings->loop_count = 1; + return err ? 0 : 1; } From 7502e89ff441358911c17a89e69f4a4f90651248 Mon Sep 17 00:00:00 2001 From: bnnm Date: Fri, 27 Aug 2021 22:21:04 +0200 Subject: [PATCH 3/3] build: tweaks --- .github/workflows/cmake-lx.yml | 69 ++++++++++++++++++---------------- .github/workflows/vs-win.yml | 2 +- msvc-build.ps1 | 2 +- 3 files changed, 38 insertions(+), 35 deletions(-) diff --git a/.github/workflows/cmake-lx.yml b/.github/workflows/cmake-lx.yml index 9849e0ee..4da17888 100644 --- a/.github/workflows/cmake-lx.yml +++ b/.github/workflows/cmake-lx.yml @@ -1,3 +1,5 @@ +# github workflow to automate builds + name: Linux build on: [push, pull_request] @@ -18,17 +20,17 @@ jobs: steps: - uses: actions/checkout@v2 - - name: Fetch Git Tags + - name: Fetch Git tags run: | git fetch --prune --unshallow --tags - - name: Install Dependencies + - name: Install dependencies run: | sudo apt-get update sudo apt-get install -y libmpg123-dev libvorbis-dev libavformat-dev libavcodec-dev libavutil-dev libswresample-dev sudo apt-get install -y libao-dev audacious-dev libjansson-dev - - name: Create Build Environment + - name: Create build environment # Some projects don't allow in-source building, so create a separate build directory # We'll use this as our working directory for all subsequent commands run: cmake -E make_directory ${{runner.workspace}}/build @@ -48,34 +50,35 @@ jobs: shell: bash # Execute the build. You can specify a specific target with "--target " run: cmake --build . --config $BUILD_TYPE - - - name: Upload CLI Tools Artifact - uses: actions/upload-artifact@v2 - with: - path: | - ${{runner.workspace}}/build/cli/vgmstream_cli - ${{runner.workspace}}/build/cli/vgmstream123 - name: vgmstream_cli - - - name: Upload Audacious Plugin Artifact - uses: actions/upload-artifact@v2 - with: - path: ${{runner.workspace}}/build/audacious/vgmstream.so - name: vgmstream-audacious - - name: Upload Artifacts to S3 - if: github.event_name != 'pull_request' - working-directory: ${{runner.workspace}}/build - shell: bash - env: - AWS_DEFAULT_REGION: us-west-1 - AWS_ACCESS_KEY_ID: ${{secrets.AWS_ACCESS_KEY_ID}} - AWS_SECRET_ACCESS_KEY: ${{secrets.AWS_SECRET_ACCESS_KEY}} - run: | - cd cli - tar cvfz vgmstream-cli.tar.gz vgmstream_cli vgmstream123 - cd ../audacious - tar cvfz vgmstream-audacious.tar.gz vgmstream.so - cd .. - aws s3 cp cli/vgmstream-cli.tar.gz s3://vgmstream-builds/${{github.sha}}/linux/vgmstream-cli.tar.gz --acl public-read - aws s3 cp audacious/vgmstream-audacious.tar.gz s3://vgmstream-builds/${{github.sha}}/linux/vgmstream-audacious.tar.gz --acl public-read + # not useful since sharing artifacts between Linux distros ain't fun + #- name: Upload CLI tools artifact + # uses: actions/upload-artifact@v2 + # with: + # path: | + # ${{runner.workspace}}/build/cli/vgmstream-cli + # ${{runner.workspace}}/build/cli/vgmstream123 + # name: vgmstream-cli + + #- name: Upload Audacious plugin artifact + # uses: actions/upload-artifact@v2 + # with: + # path: ${{runner.workspace}}/build/audacious/vgmstream.so + # name: vgmstream-audacious + + #- name: Upload artifacts to S3 + # if: github.event_name != 'pull_request' + # working-directory: ${{runner.workspace}}/build + # shell: bash + # env: + # AWS_DEFAULT_REGION: us-west-1 + # AWS_ACCESS_KEY_ID: ${{secrets.AWS_ACCESS_KEY_ID}} + # AWS_SECRET_ACCESS_KEY: ${{secrets.AWS_SECRET_ACCESS_KEY}} + # run: | + # cd cli + # tar cvfz vgmstream-cli.tar.gz vgmstream-cli vgmstream123 + # cd ../audacious + # tar cvfz vgmstream-audacious.tar.gz vgmstream.so + # cd .. + # aws s3 cp cli/vgmstream-cli.tar.gz s3://vgmstream-builds/${{github.sha}}/linux/vgmstream-cli.tar.gz --acl public-read + # aws s3 cp audacious/vgmstream-audacious.tar.gz s3://vgmstream-builds/${{github.sha}}/linux/vgmstream-audacious.tar.gz --acl public-read diff --git a/.github/workflows/vs-win.yml b/.github/workflows/vs-win.yml index de4a08c3..e4e3a2a4 100644 --- a/.github/workflows/vs-win.yml +++ b/.github/workflows/vs-win.yml @@ -1,4 +1,4 @@ -# This is a basic workflow to help you get started with Actions +# github workflow to automate builds name: Windows build diff --git a/msvc-build.ps1 b/msvc-build.ps1 index 5a8f486f..d412b862 100644 --- a/msvc-build.ps1 +++ b/msvc-build.ps1 @@ -200,7 +200,7 @@ $cliPdbFiles = @( function Package { - if(!(Test-Path "Release/test.exe")) { Build } + Build if(!(Test-Path "Release/test.exe")) { Write-Error "Unable to find binaries, check for compilation errors"