mirror of
https://github.com/nunuhara/xsystem4.git
synced 2026-09-22 23:18:01 +03:00
PartsEngine: Fix "Invalid controller number" error after vm_reset
PE_Reset() zeroed the controller stack, leaving it with no default controller. Since PE_Reset() does not clear parts_engine_initialized, the subsequent PE_Init() returns early so the stack stays empty. Reset the stack with ctrl_stack_init() instead, which re-creates the default controller. ctrl_stack_fini() is now unused and removed.
This commit is contained in:
+1
-7
@@ -40,7 +40,6 @@ struct parts_controller_stack ctrl_stack;
|
||||
bool parts_multi_controller;
|
||||
|
||||
static void ctrl_stack_init(void);
|
||||
static void ctrl_stack_fini(void);
|
||||
|
||||
#define PARTS_PARAMS_INITIALIZER (struct parts_params) { \
|
||||
.z = 1, \
|
||||
@@ -1062,7 +1061,7 @@ void PE_Reset(void)
|
||||
{
|
||||
PE_ReleaseAllParts();
|
||||
PE_ReleaseMessage();
|
||||
ctrl_stack_fini();
|
||||
ctrl_stack_init();
|
||||
sact_ModuleFini();
|
||||
}
|
||||
|
||||
@@ -2110,11 +2109,6 @@ static void ctrl_stack_init(void)
|
||||
PE_AddController(-1);
|
||||
}
|
||||
|
||||
static void ctrl_stack_fini(void)
|
||||
{
|
||||
memset(&ctrl_stack, 0, sizeof(ctrl_stack));
|
||||
}
|
||||
|
||||
// Adds a new controller to the stack and makes it active. The `index`
|
||||
// parameter specifies the position in the stack at which to insert the new
|
||||
// controller; -1 means "insert directly after the currently active
|
||||
|
||||
Reference in New Issue
Block a user