mirror of
https://github.com/nunuhara/xsystem4.git
synced 2026-10-01 19:38:06 +03:00
Fix multiple issues with resetting HLLs
Clear PartsEngine/SACT2/CharSpriteManager/audio state when resetting the VM. Fixes #113
This commit is contained in:
+1
-1
@@ -20,7 +20,7 @@
|
||||
#include <stdbool.h>
|
||||
|
||||
void audio_init(void);
|
||||
void audio_fini(void);
|
||||
void audio_reset(void);
|
||||
void audio_update(void);
|
||||
bool audio_play_sound(int sound_no);
|
||||
|
||||
|
||||
@@ -24,6 +24,7 @@ struct string;
|
||||
|
||||
// parts.c
|
||||
bool PE_Init(void);
|
||||
void PE_Reset(void);
|
||||
void PE_Update(int passed_time, bool message_window_show);
|
||||
void PE_UpdateComponent(int passed_time);
|
||||
void PE_UpdateParts(int passed_time, bool is_skip, bool message_window_show);
|
||||
|
||||
+13
@@ -54,6 +54,19 @@ void audio_init(void)
|
||||
audio_initialized = true;
|
||||
}
|
||||
|
||||
void audio_reset(void)
|
||||
{
|
||||
for (int i = 0; i < wav.nr_slots; i++) {
|
||||
wav_unprepare(i);
|
||||
}
|
||||
for (int i = 0; i < bgm.nr_slots; i++) {
|
||||
bgm_unprepare(i);
|
||||
}
|
||||
for (int i = 0; i < NR_ANONYMOUS_CHANNELS; i++) {
|
||||
anonymous_channels[i] = -1;
|
||||
}
|
||||
}
|
||||
|
||||
void audio_update(void)
|
||||
{
|
||||
for (int i = 0; i < NR_ANONYMOUS_CHANNELS; i++) {
|
||||
|
||||
@@ -35,6 +35,7 @@ static void ChipmunkSpriteEngine_PreLink(void);
|
||||
static void ChipmunkSpriteEngine_ModuleFini(void)
|
||||
{
|
||||
sact_ModuleFini();
|
||||
CharSpriteManager_Clear();
|
||||
}
|
||||
|
||||
static int ChipmunkSpriteEngine_Init(possibly_unused void *imain_system)
|
||||
|
||||
@@ -33,6 +33,7 @@ static void GUIEngine_ModuleInit(void)
|
||||
|
||||
static void GUIEngine_ModuleFini(void)
|
||||
{
|
||||
PE_Reset();
|
||||
}
|
||||
|
||||
bool GUIEngine_Save(struct page **buffer)
|
||||
|
||||
@@ -27,6 +27,7 @@ static void GoatGUIEngine_PreLink(void);
|
||||
|
||||
HLL_LIBRARY(GoatGUIEngine,
|
||||
HLL_EXPORT(_PreLink, GoatGUIEngine_PreLink),
|
||||
HLL_EXPORT(_ModuleFini, PE_Reset),
|
||||
HLL_EXPORT(Init, PE_Init),
|
||||
HLL_EXPORT(Update, PE_Update),
|
||||
HLL_EXPORT(SetPartsCG, PE_SetPartsCG),
|
||||
|
||||
@@ -24,6 +24,7 @@ static void PartsEngine_ModuleInit(void)
|
||||
|
||||
static void PartsEngine_ModuleFini(void)
|
||||
{
|
||||
PE_Reset();
|
||||
}
|
||||
|
||||
void PartsEngine_Update(int passed_time, bool is_skip, bool message_window_show)
|
||||
|
||||
@@ -131,6 +131,7 @@ static int sact_Init(possibly_unused void *imain_system, int cg_cache_size)
|
||||
void sact_ModuleFini(void)
|
||||
{
|
||||
sact_SP_DeleteAll();
|
||||
audio_reset();
|
||||
}
|
||||
|
||||
//int SACT2_Error(struct string *err);
|
||||
|
||||
@@ -321,6 +321,7 @@ static void StoatSpriteEngine_ModuleFini(void)
|
||||
{
|
||||
sact_ModuleFini();
|
||||
multisprite_clear();
|
||||
CharSpriteManager_Clear();
|
||||
}
|
||||
|
||||
static void multisprite_update_pos(struct multisprite *ms)
|
||||
|
||||
@@ -738,6 +738,12 @@ bool PE_Init(void)
|
||||
return true;
|
||||
}
|
||||
|
||||
void PE_Reset(void)
|
||||
{
|
||||
PE_ReleaseAllParts();
|
||||
sact_ModuleFini();
|
||||
}
|
||||
|
||||
static bool parts_has_dirty_parent(struct parts *parts)
|
||||
{
|
||||
for (struct parts *parent = parts->parent; parent; parent = parent->parent) {
|
||||
|
||||
Reference in New Issue
Block a user