From 8ca227c219793cd2f1de2bb4dd8e6fd7c81dbc6d Mon Sep 17 00:00:00 2001 From: gamerbross <55158797+gamerbross@users.noreply.github.com> Date: Sun, 12 May 2024 15:56:28 +0200 Subject: [PATCH] Fix Incorrect playerId use --- source/funkin/save/Save.hx | 29 +++++------------------------ 1 file changed, 5 insertions(+), 24 deletions(-) diff --git a/source/funkin/save/Save.hx b/source/funkin/save/Save.hx index acbe59edd..69b57073b 100644 --- a/source/funkin/save/Save.hx +++ b/source/funkin/save/Save.hx @@ -53,7 +53,8 @@ class Save public function new(?data:RawSaveData) { if (data == null) this.data = Save.getDefault(); - else this.data = data; + else + this.data = data; } public static function getDefault():RawSaveData @@ -559,9 +560,9 @@ class Save switch (inputType) { case Keys: - return (playerId == 0) ? data?.options?.controls?.p1.keyboard : data?.options?.controls?.p2.keyboard; + return (playerId == 1) ? data?.options?.controls?.p1.keyboard : data?.options?.controls?.p2.keyboard; case Gamepad(_): - return (playerId == 0) ? data?.options?.controls?.p1.gamepad : data?.options?.controls?.p2.gamepad; + return (playerId == 1) ? data?.options?.controls?.p1.gamepad : data?.options?.controls?.p2.gamepad; } } @@ -576,27 +577,7 @@ class Save public function setControls(playerId:Int, inputType:Device, controls:SaveControlsData):Void { - switch (inputType) - { - case Keys: - if (playerId == 0) - { - data.options.controls.p1.keyboard = controls; - } - else - { - data.options.controls.p2.keyboard = controls; - } - case Gamepad(_): - if (playerId == 0) - { - data.options.controls.p1.gamepad = controls; - } - else - { - data.options.controls.p2.gamepad = controls; - } - } + getControls(playerId, inputType) = controls; flush(); }