From a6136f9e46a223bd7ea92d3e9b336fc45040bc04 Mon Sep 17 00:00:00 2001 From: SerpentSpirale Date: Fri, 28 May 2021 20:17:47 +0200 Subject: [PATCH] Add versionning for the custom controls. --- .../pojavlaunch/customcontrols/CustomControls.java | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/app_pojavlauncher/src/main/java/net/kdt/pojavlaunch/customcontrols/CustomControls.java b/app_pojavlauncher/src/main/java/net/kdt/pojavlaunch/customcontrols/CustomControls.java index 1e99f252e..0d05f5e65 100644 --- a/app_pojavlauncher/src/main/java/net/kdt/pojavlaunch/customcontrols/CustomControls.java +++ b/app_pojavlauncher/src/main/java/net/kdt/pojavlaunch/customcontrols/CustomControls.java @@ -5,13 +5,13 @@ import java.util.*; import net.kdt.pojavlaunch.*; import org.lwjgl.glfw.*; -public class CustomControls -{ +public class CustomControls { + public int version = -1; public float scaledAt; public List mControlDataList; public List mDrawerDataList; public CustomControls() { - this(new ArrayList(), new ArrayList()); + this(new ArrayList<>(), new ArrayList<>()); } @@ -47,7 +47,9 @@ public class CustomControls shiftData.isToggle = true; this.mControlDataList.add(shiftData); this.mControlDataList.add(new ControlData(ctx, R.string.control_jump, new int[]{LWJGLGLFWKeycode.GLFW_KEY_SPACE}, "${right} - ${margin} * 2 - ${width}", "${bottom} - ${margin} * 2 - ${height}", true)); - + + //The default controls are conform to the V2 + version = 2; } public ControlData findControlData(int keycode) { @@ -62,6 +64,9 @@ public class CustomControls } public void save(String path) throws Exception { + //Current version is the V2 so the version as to be marked as 2 ! + version = 2; + Tools.write(path, Tools.GLOBAL_GSON.toJson(this)); } }