Add .bgm [Fortissimo (PC)]

This commit is contained in:
bnnm 2019-08-02 17:31:00 +02:00
parent ce96318551
commit 52dd56bc1a

View File

@ -172,6 +172,7 @@ VGMSTREAM * init_vgmstream_ogg_vorbis(STREAMFILE *streamFile) {
int is_gwm = 0; int is_gwm = 0;
int is_mus = 0; int is_mus = 0;
int is_lse = 0; int is_lse = 0;
int is_bgm = 0;
/* check extension */ /* check extension */
@ -201,6 +202,8 @@ VGMSTREAM * init_vgmstream_ogg_vorbis(STREAMFILE *streamFile) {
is_mus = 1; is_mus = 1;
} else if (check_extensions(streamFile,"lse")) { /* .lse: Labyrinth of Refrain: Coven of Dusk (PC) */ } else if (check_extensions(streamFile,"lse")) { /* .lse: Labyrinth of Refrain: Coven of Dusk (PC) */
is_lse = 1; is_lse = 1;
} else if (check_extensions(streamFile,"bgm")) { /* .bgm: Fortissimo (PC) */
is_bgm = 1;
} else { } else {
goto fail; goto fail;
} }
@ -413,6 +416,23 @@ VGMSTREAM * init_vgmstream_ogg_vorbis(STREAMFILE *streamFile) {
} }
} }
if (is_bgm) { /* [Fortissimo (PC)] */
size_t file_size = get_streamfile_size(streamFile);
uint8_t key[0x04];
uint32_t xor_be;
put_32bitLE(key, (uint32_t)file_size);
xor_be = (uint32_t)get_32bitBE(key);
if ((read_32bitBE(0x00,streamFile) ^ xor_be) == 0x4F676753) { /* "OggS" */
int i;
cfg.key_len = 4;
for (i = 0; i < cfg.key_len; i++) {
cfg.key[i] = key[i];
}
cfg.is_encrypted = 1;
}
}
if (cfg.is_encrypted) { if (cfg.is_encrypted) {
ovmi.meta_type = meta_OGG_encrypted; ovmi.meta_type = meta_OGG_encrypted;