From 62ef67b3087de72f765b2649e86e84abd8331ea3 Mon Sep 17 00:00:00 2001 From: UnfamiliarLegacy <74633542+UnfamiliarLegacy@users.noreply.github.com> Date: Sat, 20 Jul 2024 06:59:25 +0200 Subject: [PATCH] Invert FLASH to SHOCKWAVE checks to fix NITRO compatibility --- .../connection/packetsafety/PacketTypeChecker.java | 2 +- .../protocol/connection/proxy/ProxyProviderFactory.java | 8 ++++---- .../gearth/ui/subforms/injection/InjectionController.java | 6 +++--- pom.xml | 2 +- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/G-Earth/src/main/java/gearth/protocol/connection/packetsafety/PacketTypeChecker.java b/G-Earth/src/main/java/gearth/protocol/connection/packetsafety/PacketTypeChecker.java index b78a980..eab2642 100644 --- a/G-Earth/src/main/java/gearth/protocol/connection/packetsafety/PacketTypeChecker.java +++ b/G-Earth/src/main/java/gearth/protocol/connection/packetsafety/PacketTypeChecker.java @@ -26,7 +26,7 @@ public class PacketTypeChecker { throw new PacketTypeException(String.format("ShockPacketIncoming expected for %s", clientType)); } } else if (packet.getFormat() != HPacketFormat.EVA_WIRE) { - throw new PacketTypeException(String.format("Invalid packet, expected HPacket for %s", clientType)); + throw new PacketTypeException(String.format("Invalid packet, expected %s for client type %s, got %s", HPacketFormat.EVA_WIRE, clientType, packet.getFormat())); } } } diff --git a/G-Earth/src/main/java/gearth/protocol/connection/proxy/ProxyProviderFactory.java b/G-Earth/src/main/java/gearth/protocol/connection/proxy/ProxyProviderFactory.java index 806f488..ea893f1 100644 --- a/G-Earth/src/main/java/gearth/protocol/connection/proxy/ProxyProviderFactory.java +++ b/G-Earth/src/main/java/gearth/protocol/connection/proxy/ProxyProviderFactory.java @@ -101,7 +101,7 @@ public class ProxyProviderFactory { } public ProxyProvider provide(HClient client) { - return provide(client, client == HClient.FLASH ? autoDetectHosts : autoDetectHostsOrigins); + return provide(client, client == HClient.SHOCKWAVE ? autoDetectHostsOrigins : autoDetectHosts); } public ProxyProvider provide(HClient client, String domain, int port) { @@ -152,9 +152,9 @@ public class ProxyProviderFactory { } private ProxyProvider provide(HClient client, List potentialHosts) { - return client == HClient.FLASH - ? new FlashProxy(proxySetter, stateSetter, hConnection, potentialHosts, socksConfig.useSocks() && !socksConfig.onlyUseIfNeeded()) - : new ShockwaveProxy(proxySetter, stateSetter, hConnection, potentialHosts); + return client == HClient.SHOCKWAVE + ? new ShockwaveProxy(proxySetter, stateSetter, hConnection, potentialHosts) + : new FlashProxy(proxySetter, stateSetter, hConnection, potentialHosts, socksConfig.useSocks() && !socksConfig.onlyUseIfNeeded()); } public static void setSocksConfig(SocksConfiguration configuration) { diff --git a/G-Earth/src/main/java/gearth/ui/subforms/injection/InjectionController.java b/G-Earth/src/main/java/gearth/ui/subforms/injection/InjectionController.java index 55d6d87..f22ba45 100644 --- a/G-Earth/src/main/java/gearth/ui/subforms/injection/InjectionController.java +++ b/G-Earth/src/main/java/gearth/ui/subforms/injection/InjectionController.java @@ -117,7 +117,7 @@ public class InjectionController extends SubForm { lbl_corruption.getStyleClass().add("not-corrupted-label"); // For Shockwave parse with either WEDGIE_INCOMING or WEDGIE_OUTGOING, both will validate the same expression. - HPacketFormat format = getHConnection().getClientType() == HClient.FLASH ? HPacketFormat.EVA_WIRE : HPacketFormat.WEDGIE_INCOMING; + HPacketFormat format = getHConnection().getClientType() == HClient.SHOCKWAVE ? HPacketFormat.WEDGIE_INCOMING : HPacketFormat.EVA_WIRE; HPacket[] packets = parsePackets(format, inputPacket.getText()); if (packets.length == 0) { @@ -203,7 +203,7 @@ public class InjectionController extends SubForm { } public void sendToServer_clicked(ActionEvent actionEvent) { - HPacketFormat format = getHConnection().getClientType() == HClient.FLASH ? HPacketFormat.EVA_WIRE : HPacketFormat.WEDGIE_OUTGOING; + HPacketFormat format = getHConnection().getClientType() == HClient.SHOCKWAVE ? HPacketFormat.WEDGIE_OUTGOING : HPacketFormat.EVA_WIRE; HPacket[] packets = parsePackets(format, inputPacket.getText()); for (HPacket packet : packets) { getHConnection().sendToServer(packet); @@ -214,7 +214,7 @@ public class InjectionController extends SubForm { } public void sendToClient_clicked(ActionEvent actionEvent) { - HPacketFormat format = getHConnection().getClientType() == HClient.FLASH ? HPacketFormat.EVA_WIRE : HPacketFormat.WEDGIE_INCOMING; + HPacketFormat format = getHConnection().getClientType() == HClient.SHOCKWAVE ? HPacketFormat.WEDGIE_INCOMING : HPacketFormat.EVA_WIRE; HPacket[] packets = parsePackets(format, inputPacket.getText()); for (HPacket packet : packets) { getHConnection().sendToClient(packet); diff --git a/pom.xml b/pom.xml index 757f796..706c02d 100644 --- a/pom.xml +++ b/pom.xml @@ -11,7 +11,7 @@ - 1.5.4-beta-7 + 1.5.4-beta-8 -SNAPSHOT 1.5.3