mirror of
https://github.com/vgmstream/vgmstream.git
synced 2025-01-17 23:36:41 +01:00
Add some encrypted files [The Pirate's Fate (PC)]
This commit is contained in:
parent
ce6877f1b8
commit
a464b7624c
@ -667,6 +667,10 @@
|
||||
<File
|
||||
RelativePath=".\meta\ea_wve_ad10.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\meta\encrypted.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\meta\mul.c"
|
||||
|
@ -311,6 +311,7 @@
|
||||
<ClCompile Include="meta\ea_eaac.c" />
|
||||
<ClCompile Include="meta\ea_wve_au00.c" />
|
||||
<ClCompile Include="meta\ea_wve_ad10.c" />
|
||||
<ClCompile Include="meta\encrypted.c" />
|
||||
<ClCompile Include="meta\mul.c" />
|
||||
<ClCompile Include="meta\exakt_sc.c" />
|
||||
<ClCompile Include="meta\ffw.c" />
|
||||
|
@ -451,6 +451,9 @@
|
||||
<ClCompile Include="meta\ea_wve_ad10.c">
|
||||
<Filter>meta\Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="meta\encrypted.c">
|
||||
<Filter>meta\Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="meta\mul.c">
|
||||
<Filter>meta\Source Files</Filter>
|
||||
</ClCompile>
|
||||
|
83
src/meta/encrypted.c
Normal file
83
src/meta/encrypted.c
Normal file
@ -0,0 +1,83 @@
|
||||
#include "meta.h"
|
||||
#include "../coding/coding.h"
|
||||
#include "ogg_vorbis_streamfile.h"
|
||||
|
||||
//todo fuse ogg encryptions and use generic names
|
||||
|
||||
|
||||
static const uint8_t tpf_key[] = {
|
||||
0x0a,0x2b,0x36,0x6f,0x0b,0x0a,0x2b,0x36,0x6f,0x0B
|
||||
};
|
||||
|
||||
static void load_key(ogg_vorbis_io_config_data* cfg, const uint8_t* key, size_t size) {
|
||||
cfg->is_encrypted = 1;
|
||||
cfg->key_len = size;
|
||||
memcpy(cfg->key, key, size);
|
||||
}
|
||||
|
||||
/* parser for various encrypted games */
|
||||
VGMSTREAM* init_vgmstream_encrypted(STREAMFILE* sf) {
|
||||
VGMSTREAM* vgmstream = NULL;
|
||||
STREAMFILE* temp_sf = NULL;
|
||||
ogg_vorbis_io_config_data cfg = {0};
|
||||
uint32_t id;
|
||||
|
||||
|
||||
/* checks */
|
||||
id = read_u32be(0x00, sf);
|
||||
|
||||
if (check_extensions(sf,"ogg,logg")) {
|
||||
/* The Pirate's Fate (PC) */
|
||||
if (id == 0x454C513C) { /* "OggS" xored */
|
||||
load_key(&cfg, tpf_key, sizeof(tpf_key));
|
||||
}
|
||||
else {
|
||||
goto fail;
|
||||
}
|
||||
|
||||
temp_sf = setup_ogg_vorbis_streamfile(sf, cfg);
|
||||
if (!temp_sf) goto fail;
|
||||
VGM_LOG("2\n");
|
||||
vgmstream = init_vgmstream_ogg_vorbis(temp_sf);
|
||||
close_streamfile(temp_sf);
|
||||
return vgmstream;
|
||||
}
|
||||
|
||||
if (check_extensions(sf,"mp3")) {
|
||||
/* The Pirate's Fate (PC) */
|
||||
if ((id & 0xFFFFFF00) == 0x436F0500) { /* "ID3\0" xored */
|
||||
load_key(&cfg, tpf_key, sizeof(tpf_key));
|
||||
}
|
||||
else {
|
||||
goto fail;
|
||||
}
|
||||
|
||||
temp_sf = setup_ogg_vorbis_streamfile(sf, cfg);
|
||||
if (!temp_sf) goto fail;
|
||||
|
||||
vgmstream = init_vgmstream_ffmpeg(temp_sf);
|
||||
close_streamfile(temp_sf);
|
||||
return vgmstream;
|
||||
}
|
||||
|
||||
if (check_extensions(sf,"wav,lwav")) {
|
||||
/* The Pirate's Fate (PC) */
|
||||
if (id == 0x58627029) { /* "RIFF" xored */
|
||||
load_key(&cfg, tpf_key, sizeof(tpf_key));
|
||||
}
|
||||
else {
|
||||
goto fail;
|
||||
}
|
||||
|
||||
temp_sf = setup_ogg_vorbis_streamfile(sf, cfg);
|
||||
if (!temp_sf) goto fail;
|
||||
|
||||
vgmstream = init_vgmstream_riff(temp_sf);
|
||||
close_streamfile(temp_sf);
|
||||
return vgmstream;
|
||||
}
|
||||
|
||||
|
||||
fail:
|
||||
return NULL;
|
||||
}
|
@ -891,4 +891,6 @@ VGMSTREAM * init_vgmstream_lrmd(STREAMFILE* sf);
|
||||
VGMSTREAM* init_vgmstream_bkhd(STREAMFILE* sf);
|
||||
VGMSTREAM* init_vgmstream_bkhd_fx(STREAMFILE* sf);
|
||||
|
||||
VGMSTREAM* init_vgmstream_encrypted(STREAMFILE* sf);
|
||||
|
||||
#endif /*_META_H*/
|
||||
|
@ -495,6 +495,7 @@ VGMSTREAM * (*init_vgmstream_functions[])(STREAMFILE *streamFile) = {
|
||||
|
||||
/* lowest priority metas (should go after all metas, and TXTH should go before raw formats) */
|
||||
init_vgmstream_txth, /* proper parsers should supersede TXTH, once added */
|
||||
init_vgmstream_encrypted, /* encrypted stuff */
|
||||
init_vgmstream_raw_int, /* .int raw PCM */
|
||||
init_vgmstream_ps_headerless, /* tries to detect a bunch of PS-ADPCM formats */
|
||||
init_vgmstream_raw_snds, /* .snds raw SNDS IMA (*after* ps_headerless) */
|
||||
|
Loading…
x
Reference in New Issue
Block a user