Skip to content

Commit

Permalink
Merge pull request vgmstream#1571 from bnnm/api-misc6
Browse files Browse the repository at this point in the history
- Add HCA keys
- Fix some custom/buggy .dsp
- foobar: tweak file info
- cleanup
  • Loading branch information
bnnm authored Aug 11, 2024
2 parents 8160794 + edcffe0 commit 7ab622d
Show file tree
Hide file tree
Showing 94 changed files with 1,985 additions and 1,891 deletions.
1 change: 1 addition & 0 deletions .github/formats-info.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@
'txth.c','txtp.c','genh.c',
'silence.c', 'mp4_faac.c', 'deblock_streamfile.c',
'ps_headerless.c', 'zwdsp.c',
'txtp_parser.c', 'txtp_process.c',
]

EXT_RENAMES = {'...': '(any)', '': '(extensionless)'}
Expand Down
11 changes: 4 additions & 7 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@ ipch
# build
/version_auto.h
/dependencies
/bin/**/*
/tmp/**/*
/bin
/tmp
/**/vgmstream-win.zip
/**/foo_input_vgmstream.fb2k-component

Expand All @@ -64,10 +64,7 @@ CMakeFiles
/audacious/Makefile
cmake_install.cmake

#doc build
doc/INFO.md
doc/_build

# doc stuff
changelog.txt
formats-info.md
__pycache__
__pycache__
6 changes: 6 additions & 0 deletions Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,12 @@

<ImportGroup Label="PropertySheets" />

<!-- size mismatch warnings, should rework stuff rather than castings all the time
(plus compilers can't detect code that logically can't lose precision, such as a clamped values) -->
<PropertyGroup>
<NoWarn>C4267;C4244</NoWarn>
</PropertyGroup>

<PropertyGroup Label="Configuration">
<PlatformToolset>v143</PlatformToolset>
</PropertyGroup>
Expand Down
8 changes: 4 additions & 4 deletions cli/api_example.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ static FILE* get_output_file(const char* filename) {
}

static libvgmstream_streamfile_t* get_streamfile(const char* filename) {
return libvgmstream_streamfile_from_filename(filename);
return libvgmstream_streamfile_open_from_stdio(filename);
}

static int api_example(const char* infile) {
Expand Down Expand Up @@ -204,10 +204,10 @@ static libvgmstream_streamfile_t* test_libsf_open() {

libvgmstream_streamfile_t* libsf = NULL;

libsf = libvgmstream_streamfile_from_filename("api.bin_wrong");
libsf = libvgmstream_streamfile_open_from_stdio("api.bin_wrong");
assert(libsf == NULL);

libsf = libvgmstream_streamfile_from_filename("api.bin");
libsf = libvgmstream_streamfile_open_from_stdio("api.bin");
assert(libsf != NULL);

return libsf;
Expand Down Expand Up @@ -335,7 +335,7 @@ static void test_lib_tags() {
libvgmstream_tags_t* tags = NULL;
bool more = false;

libsf = libvgmstream_streamfile_from_filename("sample_!tags.m3u");
libsf = libvgmstream_streamfile_open_from_stdio("sample_!tags.m3u");
assert(libsf != NULL);

tags = libvgmstream_tags_init(libsf);
Expand Down
4 changes: 2 additions & 2 deletions cli/vgmstream123.c
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,7 @@ static int play_vgmstream(const char* filename, song_settings_t* cfg) {
if (!buffer) goto fail;
}

max_buffer_samples = buffer_size / (input_channels * sizeof(sample));
max_buffer_samples = buffer_size / (input_channels * sizeof(sample_t));

vgmstream_mixing_enable(vgmstream, max_buffer_samples, NULL, NULL); /* enable */

Expand Down Expand Up @@ -423,7 +423,7 @@ static int play_vgmstream(const char* filename, song_settings_t* cfg) {
fflush(stdout);
}

if (!ao_play(device, (char *)buffer, to_do * output_channels * sizeof(sample))) {
if (!ao_play(device, (char *)buffer, to_do * output_channels * sizeof(sample_t))) {
fputs("\nAudio playback error\n", stderr);
ao_close(device);
device = NULL;
Expand Down
26 changes: 13 additions & 13 deletions doc/FORMATS.md
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@ different internally (encrypted, different versions, etc) and not always can be
- RIFX WAVE header (smpl looping) [*RIFX_WAVE_smpl*]
- *riff*: `.wav .lwav .xwav .mwv .da .dax .cd .med .snd .adx .adp .xss .xsew .adpcm .adw .wd .(extensionless) .sbv .wvx .str .at3 .rws .aud .at9 .ckd .saf .ima .nsa .pcm .xvag .ogg .logg .p1d .xms .mus .dat .ldat .wma .lwma .caf .wax .voi .se`
- *rifx*: `.wav .lwav`
- Codecs: AICA_int PCM32LE PCM24LE PCM16BE PCM16LE PCM8_U MSADPCM IMA PCMFLOAT MS_IMA AICA MPEG_custom XBOX_IMA MS_IMA_3BIT DVI_IMA L5_555 OGG_VORBIS ATRAC9 ATRAC3 MPEG MSADPCM_mono
- Codecs: AICA_int PCM32LE PCM24LE PCM16BE PCM16LE PCM8_U MSADPCM IMA PCMFLOAT MS_IMA AICA MPEG_custom XBOX_IMA MS_IMA_3BIT DVI_IMA LEVEL5 OGG_VORBIS ATRAC9 ATRAC3 MPEG MSADPCM_mono
- **nwa.c**
- VisualArt's NWA header (NWAINFO.INI looping) [*NWA_NWAINFOINI*]
- VisualArt's NWA header (Gameexe.ini looping) [*NWA_GAMEEXEINI*]
Expand Down Expand Up @@ -389,10 +389,6 @@ different internally (encrypted, different versions, etc) and not always can be
- Square Enix .vsv Header [*VSV*]
- *vsv*: `.vsv .psh`
- Codecs: PSX
- **ps2_pcm.c**
- Konami .PCM header [*PS2_PCM*]
- *ps2_pcm*: `.pcm`
- Codecs: PCM16LE
- **rkv.c**
- Legacy of Kain - Blood Omen 2 RKV PS2 header [*PS2_RKV*]
- Legacy of Kain - Blood Omen 2 RKV GC header [*NGC_RKV*]
Expand Down Expand Up @@ -503,8 +499,8 @@ different internally (encrypted, different versions, etc) and not always can be
- Subfiles: *ogg_vorbis_config*
- Codecs: PCM16LE PCM16BE PSX XBOX_IMA_mch XBOX_IMA NGC_DSP NGC_DSP_subint RAD_IMA OGG FFmpeg(various) ATRAC3 XMA
- **bgw.c**
- Square Enix .BGW header [*FFXI_BGW*]
- Square Enix .SPW header [*FFXI_SPW*]
- Square Enix BGMStream header [*BGW*]
- Square Enix SeWave header [*SPW*]
- *bgw*: `.bgw`
- *spw*: `.spw`
- Codecs: PSX_cfg ATRAC3 PCM16LE
Expand Down Expand Up @@ -676,9 +672,9 @@ different internally (encrypted, different versions, etc) and not always can be
- beatmania IIDX 2DX9 header [*2DX9*]
- *2dx9*: `.2dx9`
- Codecs: MSADPCM
- **ngc_dsp_ygo.c**
- Konami custom DSP Header [*DSP_YGO*]
- *dsp_ygo*: `.dsp`
- **dsp_kceje.c**
- Konami .DSP Header [*DSP_KCEJE*]
- *dsp_kceje*: `.dsp`
- Codecs: NGC_DSP
- **ps2_vgv.c**
- Rune: Viking Warlord VGV Header [*PS2_VGV*]
Expand Down Expand Up @@ -894,7 +890,7 @@ different internally (encrypted, different versions, etc) and not always can be
- *alp*: `.tun .pcm`
- Codecs: HV_IMA
- **wpd.c**
- WPD 'DPW' header [*WPD*]
- Navel WPD header [*WPD*]
- *wpd*: `.wpd`
- Codecs: PCM16LE
- **mn_str.c**
Expand Down Expand Up @@ -1095,7 +1091,7 @@ different internally (encrypted, different versions, etc) and not always can be
- Rockstar AWC header [*AWC*]
- *awc*: `.awc`
- Subfiles: *riff*
- Codecs: PCM16BE PCM16LE AWC_IMA XMA2 MPEG VORBIS_custom ATRAC9 NGC_DSP
- Codecs: PCM16BE PCM16LE AWC_IMA XMA2 MPEG_custom MPEG VORBIS_custom ATRAC9 NGC_DSP
- **opus.c**
- Nintendo Switch OPUS header [*OPUS*]
- *opus_std*: `.opus .lopus .bgm .opu .ogg .logg + .psi`
Expand Down Expand Up @@ -1878,6 +1874,10 @@ different internally (encrypted, different versions, etc) and not always can be
- Naxat .ASD header [*ASD_NAXAT*]
- *asd_naxat*: `.asd`
- Codecs: PCM16LE
- **pcm_kceje.c**
- Konami .PCM header [*PCM_KCEJE*]
- *pcm_kceje*: `.pcm`
- Codecs: PCM16LE
- **pos.c**
- RIFF WAVE header (.pos looping) [*RIFF_WAVE_POS*]
- *pos*: `.pos + .wav`
Expand Down Expand Up @@ -2014,7 +2014,7 @@ are used in few games.
- Konami MTA2 ADPCM
- FMOD FADPCM ADPCM
- Procyon Studio ADPCM
- Level-5 0x555 ADPCM
- Level-5 ADPCM
- Konami XMD ADPCM
- Argonaut ASF ADPCM
- Tantalus ADPCM
Expand Down
60 changes: 32 additions & 28 deletions fb2k/foo_filetypes.h
Original file line number Diff line number Diff line change
@@ -1,28 +1,32 @@
#ifndef _FOO_FILETYPES_H_
#define _FOO_FILETYPES_H_

class input_file_type_v2_impl_vgmstream : public input_file_type_v2 {
public:
input_file_type_v2_impl_vgmstream() {
ext_list = vgmstream_get_formats(&ext_list_len);
}
unsigned get_count() { return ext_list_len; }
bool is_associatable(unsigned idx) { return true; }
void get_format_name(unsigned idx, pfc::string_base & out, bool isPlural) {
out.reset();
pfc::stringToUpperAppend(out, ext_list[idx], pfc::strlen_utf8(ext_list[idx]));
out += " Audio File";
if (isPlural) out += "s";
}
void get_extensions(unsigned idx, pfc::string_base & out) {
out = ext_list[idx];
}

private:
const char ** ext_list;
size_t ext_list_len;
};

namespace { static service_factory_single_t<input_file_type_v2_impl_vgmstream> g_filetypes; }

#endif /*_FOO_FILETYPES_H_ */
#ifndef _FOO_FILETYPES_H_
#define _FOO_FILETYPES_H_

class input_file_type_v2_impl_vgmstream : public input_file_type_v2 {
public:
input_file_type_v2_impl_vgmstream() {
ext_list = vgmstream_get_formats(&ext_list_len);
}

unsigned get_count() { return ext_list_len; }

bool is_associatable(unsigned idx) { return true; }

void get_format_name(unsigned idx, pfc::string_base & out, bool isPlural) {
out.reset();
pfc::stringToUpperAppend(out, ext_list[idx], pfc::strlen_utf8(ext_list[idx]));
out += " Audio File";
if (isPlural) out += "s";
}

void get_extensions(unsigned idx, pfc::string_base & out) {
out = ext_list[idx];
}

private:
const char ** ext_list;
size_t ext_list_len;
};

namespace { static service_factory_single_t<input_file_type_v2_impl_vgmstream> g_filetypes; }

#endif /*_FOO_FILETYPES_H_ */
Loading

0 comments on commit 7ab622d

Please sign in to comment.