diff --git a/libs/kaja/kaja.h b/libs/kaja/kaja.h index 9c2e984d..c33dbdde 100644 --- a/libs/kaja/kaja.h +++ b/libs/kaja/kaja.h @@ -28,8 +28,6 @@ typedef enum { // (DL) buffers, in KiB. These can be customized on the PMD command line // with the /M, /V and /E options respectively. PMD_GET_BUFFER_SIZES = 0x22, - - _kaja_func_t_FORCE_UINT16 = 0xFFFF } kaja_func_t; #define PMD 0x60 diff --git a/th02/snd/load.cpp b/th02/snd/load.cpp index 400b19e0..5228d547 100644 --- a/th02/snd/load.cpp +++ b/th02/snd/load.cpp @@ -8,7 +8,7 @@ extern "C" { extern char snd_load_fn[SND_FN_LEN]; -void snd_load(const char fn[SND_FN_LEN], kaja_func_t func) +void snd_load(const char fn[SND_FN_LEN], snd_load_func_t func) { int i; __asm { push ds; } diff --git a/th02/snd/snd.h b/th02/snd/snd.h index 99b4225f..24d46255 100644 --- a/th02/snd/snd.h +++ b/th02/snd/snd.h @@ -53,13 +53,7 @@ void snd_delay_until_volume(uint8_t volume); void snd_delay_until_measure(int measure); #endif -// Shorter symbols for the [func] parameter of snd_load() -#define SND_LOAD_SONG (kaja_func_t)(KAJA_GET_SONG_ADDRESS << 8) -#define SND_LOAD_SE (kaja_func_t)(PMD_GET_SE_ADDRESS << 8) - -#define SND_FN_LEN 13 - -#if defined(PMD) && (GAME <= 3) /* requires kaja.h */ +#if defined(PMD) /* requires kaja.h */ #if defined(__cplusplus) && (GAME <= 4) static inline uint16_t snd_load_size() { // ZUN bug: Should rather retrieve the maximum data size for song @@ -73,11 +67,21 @@ void snd_delay_until_volume(uint8_t volume); } #endif - // Loads a song in .M format ([func] = SND_LOAD_SONG) or a sound effect - // bank in EFC format ([func] = SND_LOAD_SE) into the respective work - // buffer of the sound driver. If MIDI is used, 'md' is appended to the - // file name. - void snd_load(const char fn[SND_FN_LEN], kaja_func_t func); + typedef enum { + SND_LOAD_SONG = (KAJA_GET_SONG_ADDRESS << 8), + SND_LOAD_SE = (PMD_GET_SE_ADDRESS << 8), + } snd_load_func_t; + + #define SND_FN_LEN 13 + + #if (GAME <= 3) + // Loads a song in .M format ([func] == SND_LOAD_SONG) or a sound + // effect bank in EFC format ([func] == SND_LOAD_SE) into the + // respective work buffer of the sound driver. If MIDI is used, 'md' + // is appended to the file name. + // [fn] still needs to be null-terminated, despite its fixed length. + void snd_load(const char fn[SND_FN_LEN], snd_load_func_t func); + #endif #endif void snd_se_reset(void); diff --git a/th04/snd/snd.h b/th04/snd/snd.h index f1c68ab1..207789cb 100644 --- a/th04/snd/snd.h +++ b/th04/snd/snd.h @@ -40,7 +40,7 @@ static inline bool16 snd_se_active() { int pascal snd_determine_modes(int req_bgm_mode, int req_se_mode); #if defined(PMD) /* requires kaja.h */ -// Loads a song ([func] = SND_LOAD_SONG) or a sound effect bank ([func] = +// Loads a song ([func] == SND_LOAD_SONG) or a sound effect bank ([func] == // SND_LOAD_SE) into the respective work buffer of the sound driver. [fn] must // not have any extension. Depending on [snd_bgm_mode], [snd_se_mode], and // game, the following file is loaded: @@ -60,7 +60,7 @@ int pascal snd_determine_modes(int req_bgm_mode, int req_se_mode); // // Note that the TH05 version will infinitely loop if neither the file for the // current [snd_bgm_mode] nor "[fn].m" exist. -void pascal snd_load(const char fn[SND_FN_LEN], int16_t func); +void pascal snd_load(const char fn[SND_FN_LEN], snd_load_func_t func); #if defined(__cplusplus) && (GAME == 5) // Refer to TH02's implementation for an explanation of how wrong this is. diff --git a/th05/snd/load.cpp b/th05/snd/load.cpp index 3a1faba7..44aece2f 100644 --- a/th05/snd/load.cpp +++ b/th05/snd/load.cpp @@ -12,7 +12,7 @@ extern "C" { extern char snd_load_fn[SND_FN_LEN]; extern const char SND_LOAD_EXT[4][4]; -void pascal snd_load(const char fn[SND_FN_LEN], int16_t func) +void pascal snd_load(const char fn[SND_FN_LEN], snd_load_func_t func) { #define _DI reinterpret_cast(_DI) #define func_local _BP