diff --git a/src/core/scripting.c b/src/core/scripting.c index 0b3150039..e2d518b3a 100644 --- a/src/core/scripting.c +++ b/src/core/scripting.c @@ -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"); }