feat: Add support for IIDX25-26 to transcoder
> added support for adpcm_ms wav codec required by these versions > related to #1
This commit is contained in:
@@ -925,6 +925,7 @@ namespace avs {
|
||||
.avs_fs_close = "XCgsqzn0000055",
|
||||
.avs_fs_dump_mountpoint = "XCgsqzn0000068",
|
||||
.avs_fs_mount = "XCgsqzn000004b",
|
||||
.avs_fs_umount = "XCgsqzn000004d",
|
||||
.avs_fs_fstat = "XCgsqzn0000062",
|
||||
.avs_fs_lstat = "XCgsqzn0000063",
|
||||
.avs_fs_lseek = "XCgsqzn000004f",
|
||||
|
||||
+14
-6
@@ -16,9 +16,8 @@ enum pcm_resampler : int8_t
|
||||
bmswac_resampler_none = -1,
|
||||
bmswac_resampler_u8,
|
||||
bmswac_resampler_s16,
|
||||
bmswac_resampler_s32,
|
||||
bmswac_resampler_f32,
|
||||
bmswac_resampler_d64
|
||||
bmswac_resampler_s16_ad,
|
||||
bmswac_resampler_f32
|
||||
};
|
||||
typedef enum pcm_resampler pcm_resampler_t;
|
||||
typedef void (*BmswConfigInit_t)(const char *path);
|
||||
@@ -477,12 +476,18 @@ public:
|
||||
return SNDPATHFMT;
|
||||
return it;
|
||||
}
|
||||
inline static avcodec::pcm_resampler_t resampler() noexcept
|
||||
{
|
||||
return resampler_;
|
||||
}
|
||||
|
||||
private:
|
||||
static constexpr avs::core::avs_file_t E_NOT_FOUND = 0x80070002;
|
||||
static constexpr uint8_t UID_INVALID = 0x00;
|
||||
static snd_bank *cache_;
|
||||
static size_t cachesz_;
|
||||
static avcodec::pcm_resampler_t resampler_;
|
||||
friend void hooks::soundbank::init(HINSTANCE hmodule, const char *ext);
|
||||
|
||||
uint8_t uid_;
|
||||
uint32_t mnt_;
|
||||
@@ -691,6 +696,7 @@ static struct offset_t
|
||||
} offset_;
|
||||
snd_bank *snd_bank::cache_ = nullptr;
|
||||
size_t snd_bank::cachesz_ = 0;
|
||||
avcodec::pcm_resampler_t snd_bank::resampler_ = avcodec::bmswac_resampler_s16;
|
||||
static BmsbEnumValidSoundbanks_t BmsbEnumValidSoundbanks;
|
||||
static avs::core::AVS_FS_LSTAT_T avs_fs_lstat_;
|
||||
static avs::core::AVS_FS_MOUNT_T avs_fs_mount_;
|
||||
@@ -745,7 +751,7 @@ void on_enum_valid_soundbanks(void *song, int32_t difficulty, int32_t unk2)
|
||||
j = snd2dx->voice_emplace(snd_2dx::assertsz_asf(voicesrc->sz));
|
||||
snd_2dx::bank::voice_hdr *voicedst = snd2dx->voice(j);
|
||||
BYTE *voicedst_wave = voicedst->wave();
|
||||
avcodec::BmswTranscoderAsfToWav(voicesrc->asf(), voicesrc->sz, &voicedst_wave, &voicedst->sz, avcodec::bmswac_resampler_s16);
|
||||
avcodec::BmswTranscoderAsfToWav(voicesrc->asf(), voicesrc->sz, &voicedst_wave, &voicedst->sz, snd_bank::resampler());
|
||||
snd2dx->voice_ptr(j)->sz(voicedst); // updates voice_ptr table, do not skip
|
||||
}
|
||||
|
||||
@@ -830,7 +836,7 @@ void run_tests()
|
||||
snd_2dx::bank::voice_hdr *voicedst = snd2dx->voice(j);
|
||||
BYTE *voicedst_wave = voicedst->wave();
|
||||
//mf_broken::asf_to_wav(voicesrc->asf(), voicesrc->sz, &voicedst_wave, &voicedst->sz);
|
||||
avcodec::BmswTranscoderAsfToWav(voicesrc->asf(), voicesrc->sz, &voicedst_wave, &voicedst->sz, avcodec::bmswac_resampler_s16);
|
||||
avcodec::BmswTranscoderAsfToWav(voicesrc->asf(), voicesrc->sz, &voicedst_wave, &voicedst->sz, snd_bank::resampler());
|
||||
snd2dx->voice_ptr(j)->sz(voicedst); // updates voice_ptr table, do not skip
|
||||
|
||||
}
|
||||
@@ -885,11 +891,13 @@ void init(HINSTANCE hmodule, const char *ext)
|
||||
case offset_t::by_ext("2018091900"):
|
||||
offset_.TX_BmsbEnumValidSoundbanks = (intptr_t) hmodule + 0x1170b0;
|
||||
offset_.DAT_song_id = 0x1C8;
|
||||
snd_bank::resampler_ = avcodec::bmswac_resampler_s16_ad;
|
||||
break;
|
||||
case offset_t::by_ext("2019090200"):
|
||||
case offset_t::by_ext("2019100700"):
|
||||
offset_.TX_BmsbEnumValidSoundbanks = (intptr_t) hmodule + 0x37a540;
|
||||
offset_.DAT_song_id = 0x1C8;
|
||||
snd_bank::resampler_ = avcodec::bmswac_resampler_s16_ad;
|
||||
break;
|
||||
case offset_t::by_ext("2020092900"):
|
||||
offset_.TX_BmsbEnumValidSoundbanks = (intptr_t) hmodule + 0x5ac460;
|
||||
@@ -933,7 +941,7 @@ void init(HINSTANCE hmodule, const char *ext)
|
||||
log_info("hooks::soundbank", "Soundbank preprocessor ready");
|
||||
|
||||
// Tests
|
||||
if (getenv("SPICE_TESTING") && offset_t::by_ext(ext) == offset_t::by_ext("2023090500"))
|
||||
if (getenv("SPICE_TESTING"))
|
||||
run_tests();
|
||||
}
|
||||
void deinit(HINSTANCE hmodule)
|
||||
|
||||
Reference in New Issue
Block a user