Scripting: Detach adapter peripherals when detaching adapter

This commit is contained in:
Vicki Pfau 2023-06-18 21:48:35 -07:00
parent 82f7e52fc6
commit a82c390fe9
1 changed files with 5 additions and 1 deletions

View File

@ -1053,7 +1053,11 @@ void mScriptContextDetachCore(struct mScriptContext* context) {
if (!value) {
return;
}
_clearMemoryMap(context, value->value.opaque, true);
struct mScriptCoreAdapter* adapter = value->value.opaque;
_clearMemoryMap(context, adapter, true);
adapter->core->setPeripheral(adapter->core, mPERIPH_RUMBLE, adapter->oldRumble);
mScriptContextRemoveGlobal(context, "emu");
}