Zal0 / ZGB

Game Boy / Color engine with lots of features
MIT License
706 stars 50 forks source link

Incorrect initialization of hUGEDriver #48

Closed SuperDisk closed 1 year ago

SuperDisk commented 2 years ago

This line is incorrect; hUGE_init is for initializing to a song descriptor, but 0 isn't one. Up until now, I believe this went unnoticed since hUGE_init doesn't do any unbounded looping, but when I added song decompression to a fork of hUGEDriver, this broke.

Here's a patch which fixes things up :)

diff --git a/common/include/Music.h b/common/include/Music.h
index 8ed475d..e36ae0c 100644
--- a/common/include/Music.h
+++ b/common/include/Music.h
@@ -13,7 +13,7 @@ void MusicCallback() __nonbanked;
    extern BYTE hUGE_paused;
    void hUGE_mute(UBYTE mute);

-   #define INIT_MUSIC hUGE_init(0)
+   #define INIT_MUSIC
    #define DECLARE_MUSIC(SONG) extern const void __bank_ ## SONG ## _uge; extern const hUGESong_t SONG ## _uge
    #define PlayMusic(SONG, LOOP) __PlayMusic(&SONG ## _uge, (uint8_t)&__bank_ ## SONG ## _uge, 0)
    #define StopMusic hUGE_paused = 1; hUGE_mute(HT_CH_MUTE); last_music = 0
Zal0 commented 1 year ago

Thaks for the info, I have updated the code in this commit https://github.com/Zal0/ZGB/commit/b64f79c715cdba1a57947bddd0b73bfa78dc46ce