From a2e9eae460330bcad02e22940d60050884f2b4ed Mon Sep 17 00:00:00 2001 From: Dmitry Isaenko Date: Sun, 28 Dec 2025 13:02:07 +0300 Subject: [PATCH] rollback unnecessary workarounds --- src/main/java/nsusbloader/AppPreferences.java | 2 +- .../com/usb/UsbCommunications.java | 6 +- .../nsusbloader/com/usb/gl/GoldLeaf_111.java | 118 ------------------ 3 files changed, 2 insertions(+), 124 deletions(-) delete mode 100644 src/main/java/nsusbloader/com/usb/gl/GoldLeaf_111.java diff --git a/src/main/java/nsusbloader/AppPreferences.java b/src/main/java/nsusbloader/AppPreferences.java index 9124a3c..ceb9542 100644 --- a/src/main/java/nsusbloader/AppPreferences.java +++ b/src/main/java/nsusbloader/AppPreferences.java @@ -29,7 +29,7 @@ public class AppPreferences { private final Preferences preferences; private final Locale locale; - public static final String[] GOLDLEAF_SUPPORTED_VERSIONS = {"v0.5", "v0.7.x", "v0.8-0.9", "v0.10-1.0.0", "v1.1.1"}; + public static final String[] GOLDLEAF_SUPPORTED_VERSIONS = {"v0.5", "v0.7.x", "v0.8-0.9", "v0.10+"}; private static final Font DEFAULT_FONT = Font.getDefault(); private AppPreferences(){ diff --git a/src/main/java/nsusbloader/com/usb/UsbCommunications.java b/src/main/java/nsusbloader/com/usb/UsbCommunications.java index 55ac2b9..92a929e 100644 --- a/src/main/java/nsusbloader/com/usb/UsbCommunications.java +++ b/src/main/java/nsusbloader/com/usb/UsbCommunications.java @@ -25,7 +25,6 @@ import nsusbloader.NSLDataTypes.EFileStatus; import nsusbloader.NSLDataTypes.EModule; import nsusbloader.NSLDataTypes.EMsgType; import nsusbloader.com.usb.gl.GoldLeaf_010; -import nsusbloader.com.usb.gl.GoldLeaf_111; import org.usb4java.*; import java.io.*; @@ -68,10 +67,7 @@ public class UsbCommunications extends CancellableRunnable { case "TinFoil": module = new TinFoil(handler, nspMap, this, logPrinter); break; - case "GoldLeaf v1.1.1": - module = new GoldLeaf_111(handler, nspMap, this, logPrinter, nspFilterForGl); - break; - case "GoldLeaf v0.10-1.0.0": + case "GoldLeaf v0.10+": module = new GoldLeaf_010(handler, nspMap, this, logPrinter, nspFilterForGl); break; case "GoldLeaf v0.8-0.9": diff --git a/src/main/java/nsusbloader/com/usb/gl/GoldLeaf_111.java b/src/main/java/nsusbloader/com/usb/gl/GoldLeaf_111.java deleted file mode 100644 index 7ed498c..0000000 --- a/src/main/java/nsusbloader/com/usb/gl/GoldLeaf_111.java +++ /dev/null @@ -1,118 +0,0 @@ -/* - Copyright 2019-2025 Dmitry Isaenko - - This file is part of NS-USBloader. - - NS-USBloader is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - NS-USBloader is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with NS-USBloader. If not, see . -*/ -package nsusbloader.com.usb.gl; - -import nsusbloader.ModelControllers.CancellableRunnable; -import nsusbloader.ModelControllers.ILogPrinter; -import nsusbloader.NSLDataTypes.EMsgType; -import org.usb4java.DeviceHandle; - -import java.io.*; -import java.nio.charset.StandardCharsets; -import java.util.*; - -import static nsusbloader.com.usb.gl.Converters.*; - -/** - * GoldLeaf 1.1.1 processing - */ -public class GoldLeaf_111 extends GoldLeaf_010{ - - public GoldLeaf_111(DeviceHandle handler, LinkedHashMap nspMap, - CancellableRunnable task, - ILogPrinter logPrinter, - boolean nspFilter) { - super(handler, nspMap, task, logPrinter, nspFilter); - } - - @Override - protected void printWelcomeMessage(){ - print("=========== GoldLeaf v1.1.1 ===========\n\t" + - "VIRT:/ equals files added into the application\n\t" + - "HOME:/ equals " + homePath + "\n\t" + - "BE CAREFUL!\n\t" + - "Due to some strange behaviour with Goldleaf v1.1.1, you will see last menu entry " + - "'Do not click (crashes Atmosphere)'\n\t" + - "You should better not clicking on it", EMsgType.INFO); - } - - /** - * Fixes issues with incorrect request for 'Home' & 'Virtual'. Forces both to return 'HOME:/' - * v1.1.1 specific fix - * Otherwise v.1.1.1 returns 'HOME:/' once 'Virtual' requested and ':/' once requested 'Home' - * */ - - @Override - protected boolean getDriveCount(){ - return writeGL_PASS(intToArrLE(3),"GL Handle 'ListDrives' command"); - } - - @Override - protected boolean getDriveInfo(int driveNo){ - if (driveNo < 0 || driveNo > 2) - return writeGL_FAIL(INVALID_INDEX, "GL Handle 'GetDriveInfo' command [no such drive]"); - - byte[] driveLabel, - driveLabelLen, - driveLetter, - driveLetterLen, - totalFreeSpace; - long totalSizeLong; - - switch (driveNo){ - case 0: - driveLabel = "Home".getBytes(StandardCharsets.UTF_8); // yes, it's hotfix - driveLabelLen = intToArrLE(driveLabel.length); - driveLetter = "VIRT".getBytes(StandardCharsets.UTF_8); // and this is fine - driveLetterLen = intToArrLE(driveLetter.length); - totalFreeSpace = new byte[4]; - totalSizeLong = virtDriveSize; - break; - case 1: - driveLabel = "Virtual".getBytes(StandardCharsets.UTF_8); // here as well - driveLabelLen = intToArrLE(driveLabel.length); - driveLetter = "HOME".getBytes(StandardCharsets.UTF_8); // and here - driveLetterLen = intToArrLE(driveLetter.length); - var userHomeDir = new File(System.getProperty("user.home")); - totalFreeSpace = Arrays.copyOfRange(longToArrLE(userHomeDir.getFreeSpace()), 0, 4);; - totalSizeLong = userHomeDir.getTotalSpace(); - break; - default: - driveLabel = "Do not click (crashes Atmosphere)".getBytes(StandardCharsets.UTF_8); // and this one is necessary too - driveLabelLen = intToArrLE(driveLabel.length); - driveLetter = "VIRT".getBytes(StandardCharsets.UTF_8); - driveLetterLen = intToArrLE(driveLetter.length); - totalFreeSpace = new byte[4]; - totalSizeLong = virtDriveSize; - break; - } - - var totalSize = Arrays.copyOfRange(longToArrLE(totalSizeLong), 0, 4); - - var command = Arrays.asList( - driveLabelLen, - driveLabel, - driveLetterLen, - driveLetter, - totalFreeSpace, - totalSize); - - return writeGL_PASS(command, "GL Handle 'GetDriveInfo' command"); - } -}