From b8ce8cf9f5c47229d4fbc89097dd280937a87896 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lumi=C3=A8re=20=C3=89lev=C3=A9?= <88174309+PoneyClairDeLune@users.noreply.github.com> Date: Thu, 15 Feb 2024 12:16:49 +0000 Subject: [PATCH] Allowed ACE releases and resets. --- src/state/index.mjs | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/state/index.mjs b/src/state/index.mjs index 1b352251..7512e359 100644 --- a/src/state/index.mjs +++ b/src/state/index.mjs @@ -1472,6 +1472,24 @@ let OctaviaDevice = class extends CustomEventSource { console.warn(`ACE slots are full.`); }; }; + releaseAce(cc) { + let continueScan = true, pointer = 0; + while (continueScan && pointer < allocated.ace) { + if (this.#ace[pointer] == cc) { + this.#ace[pointer] = 0; + continueScan = false; + }; + pointer ++; + }; + if (continueScan) { + getDebugState() && console.debug(`No ACE slot was allocated to cc${cc}.`); + }; + }; + resetAce() { + // Clear all allocated ACE + this.#ace.fill(0); + console.info(`All ACE slots have been reset.`); + }; getAce() { return this.#ace; };