Merge branch 'sirjonasxx-master'

This commit is contained in:
WiredSpast 2022-02-12 05:03:57 +01:00
commit 41e64ab2aa
59 changed files with 472 additions and 536 deletions

View File

@ -5,6 +5,7 @@ on:
paths:
- '.github/workflows/**'
- 'G-Earth/**'
- 'pom.xml'
jobs:
build:

View File

@ -0,0 +1,17 @@
<assembly
xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2 http://maven.apache.org/xsd/assembly-1.1.2.xsd">
<id>zip</id>
<formats>
<format>zip</format>
</formats>
<includeBaseDirectory>false</includeBaseDirectory>
<fileSets>
<fileSet>
<directory>../Build/Linux/</directory>
<useDefaultExcludes>true</useDefaultExcludes>
<outputDirectory>../G-Earth/</outputDirectory>
</fileSet>
</fileSets>
</assembly>

17
G-Earth/assembly/mac.xml Normal file
View File

@ -0,0 +1,17 @@
<assembly
xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2 http://maven.apache.org/xsd/assembly-1.1.2.xsd">
<id>zip</id>
<formats>
<format>zip</format>
</formats>
<includeBaseDirectory>false</includeBaseDirectory>
<fileSets>
<fileSet>
<directory>../Build/Mac/</directory>
<useDefaultExcludes>true</useDefaultExcludes>
<outputDirectory>../G-Earth/</outputDirectory>
</fileSet>
</fileSets>
</assembly>

View File

@ -0,0 +1,17 @@
<assembly
xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2 http://maven.apache.org/xsd/assembly-1.1.2.xsd">
<id>zip</id>
<formats>
<format>zip</format>
</formats>
<includeBaseDirectory>false</includeBaseDirectory>
<fileSets>
<fileSet>
<directory>../Build/Windows_32bit/</directory>
<useDefaultExcludes>true</useDefaultExcludes>
<outputDirectory>../G-Earth/</outputDirectory>
</fileSet>
</fileSets>
</assembly>

View File

@ -0,0 +1,17 @@
<assembly
xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2 http://maven.apache.org/xsd/assembly-1.1.2.xsd">
<id>zip</id>
<formats>
<format>zip</format>
</formats>
<includeBaseDirectory>false</includeBaseDirectory>
<fileSets>
<fileSet>
<directory>../Build/Windows_64bit/</directory>
<useDefaultExcludes>true</useDefaultExcludes>
<outputDirectory>../G-Earth/</outputDirectory>
</fileSet>
</fileSets>
</assembly>

View File

@ -8,8 +8,6 @@
<packaging>jar</packaging>
<version>1.5.1</version>
<properties>
<javafx.version>1.8</javafx.version>
<jettyVersion>9.4.41.v20210516</jettyVersion>
@ -22,55 +20,50 @@
</parent>
<build>
<finalName>G-Earth</finalName>
<plugins>
<!-- this builds a non-standalone JAR file -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>3.2.0</version>
<executions>
<execution>
<id>copy-dependencies</id>
<phase>prepare-package</phase>
<goals>
<goal>copy-dependencies</goal>
</goals>
<configuration>
<outputDirectory>${project.build.directory}/bin/Dependencies</outputDirectory>
<overWriteReleases>false</overWriteReleases>
<overWriteSnapshots>false</overWriteSnapshots>
<overWriteIfNewer>true</overWriteIfNewer>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>3.1.2</version>
<version>3.2.2</version>
<configuration>
<outputDirectory>${project.build.directory}/bin</outputDirectory>
<archive>
<manifest>
<addDefaultImplementationEntries>true</addDefaultImplementationEntries>
<addClasspath>true</addClasspath>
<classpathPrefix>lib/</classpathPrefix>
<mainClass>gearth.Main</mainClass>
<useUniqueVersions>false</useUniqueVersions>
<classpathPrefix>Dependencies/</classpathPrefix>
<mainClass>gearth.GEarth</mainClass>
<addDefaultImplementationEntries>true</addDefaultImplementationEntries>
<addDefaultSpecificationEntries>true</addDefaultSpecificationEntries>
</manifest>
</archive>
</configuration>
</plugin>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<version>3.1.1</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
<configuration>
<outputDirectory>${project.build.directory}/bin</outputDirectory>
<archive>
<manifest>
<mainClass>gearth.Main</mainClass>
</manifest>
</archive>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
<!--<finalName>G-Earth-${project.version}</finalName>-->
<finalName>G-Earth</finalName>
<appendAssemblyId>false</appendAssemblyId>
</configuration>
</plugin>
<!-- global build folder -->
<!-- global build folder-->
<plugin>
<artifactId>maven-antrun-plugin</artifactId>
<version>3.0.0</version>
@ -80,41 +73,26 @@
<phase>package</phase>
<configuration>
<target name="copy G-Earth.jar to Build folder">
<copy file="target/bin/G-Earth.jar" todir="../Build/Mac/"/>
<copy file="target/bin/G-Earth.jar" todir="../Build/Linux/"/>
<copy file="target/bin/G-Earth.jar" todir="../Build/Windows_32bit/"/>
<copy file="target/bin/G-Earth.jar" todir="../Build/Windows_64bit/"/>
<copy file="src/main/resources/build/messages.json" todir="../Build/Mac/"/>
<copy file="src/main/resources/build/messages.json" todir="../Build/Linux/"/>
<copy file="src/main/resources/build/messages.json" todir="../Build/Windows_32bit/"/>
<copy file="src/main/resources/build/messages.json" todir="../Build/Windows_64bit/"/>
<copy todir="../Build/Mac/">
<fileset dir="src/main/resources/build/mac" includes="**/*" />
<fileset dir="target/bin" includes="**/*" />
<fileset dir="src/main/resources/build/common" includes="**/*" />
<fileset dir="src/main/resources/build/mac" includes="**/*" excludes=".gitkeep" />
</copy>
<copy todir="../Build/Linux/">
<fileset dir="target/bin" includes="**/*" />
<fileset dir="src/main/resources/build/common" includes="**/*" />
<fileset dir="src/main/resources/build/linux" includes="**/*" excludes=".gitkeep" />
</copy>
<copy todir="../Build/Windows_32bit/">
<fileset dir="src/main/resources/build/windows/32bit" includes="**/*" />
<fileset dir="target/bin" includes="**/*" />
<fileset dir="src/main/resources/build/common" includes="**/*" />
<fileset dir="src/main/resources/build/windows/32bit" includes="**/*" excludes=".gitkeep" />
</copy>
<copy todir="../Build/Windows_64bit/">
<fileset dir="src/main/resources/build/windows/64bit" includes="**/*" />
</copy>
<copy todir="../Build/Mac/Cache">
<fileset dir="src/main/resources/build/cache" includes="**/*" />
</copy>
<copy todir="../Build/Linux/Cache">
<fileset dir="src/main/resources/build/cache" includes="**/*" />
</copy>
<copy todir="../Build/Windows_32bit/Cache">
<fileset dir="src/main/resources/build/cache" includes="**/*" />
</copy>
<copy todir="../Build/Windows_64bit/Cache">
<fileset dir="src/main/resources/build/cache" includes="**/*" />
<fileset dir="target/bin" includes="**/*" />
<fileset dir="src/main/resources/build/common" includes="**/*" />
<fileset dir="src/main/resources/build/windows/64bit" includes="**/*" excludes=".gitkeep" />
</copy>
</target>
@ -139,6 +117,75 @@
</executions>
</plugin>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<version>3.3.0</version>
<executions>
<execution>
<id>ziprelease-mac</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
<configuration>
<appendAssemblyId>false</appendAssemblyId>
<outputDirectory>../Build</outputDirectory>
<finalName>G-Earth-${project.version}-Mac</finalName>
<descriptors>
<descriptor>${basedir}/assembly/mac.xml</descriptor>
</descriptors>
</configuration>
</execution>
<execution>
<id>ziprelease-linux</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
<configuration>
<appendAssemblyId>false</appendAssemblyId>
<outputDirectory>../Build</outputDirectory>
<finalName>G-Earth-${project.version}-Linux</finalName>
<descriptors>
<descriptor>${basedir}/assembly/linux.xml</descriptor>
</descriptors>
</configuration>
</execution>
<execution>
<id>ziprelease-windows_32bit</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
<configuration>
<appendAssemblyId>false</appendAssemblyId>
<outputDirectory>../Build</outputDirectory>
<finalName>G-Earth-${project.version}-Windows_32bit</finalName>
<descriptors>
<descriptor>${basedir}/assembly/windows_32bit.xml</descriptor>
</descriptors>
</configuration>
</execution>
<execution>
<id>ziprelease-windows_64bit</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
<configuration>
<appendAssemblyId>false</appendAssemblyId>
<outputDirectory>../Build</outputDirectory>
<finalName>G-Earth-${project.version}-Windows_64bit</finalName>
<descriptors>
<descriptor>${basedir}/assembly/windows_64bit.xml</descriptor>
</descriptors>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
@ -235,8 +282,8 @@
<dependency>
<groupId>G-Earth</groupId>
<artifactId>G-Wasm</artifactId>
<version>1.0.1</version>
<artifactId>G-Wasm-Minimal</artifactId>
<version>1.0.3</version>
</dependency>
</dependencies>

View File

@ -1,3 +1,3 @@
Manifest-Version: 1.0
Main-Class: gearth.Main
Main-Class: gearth.GEarth

View File

@ -17,7 +17,7 @@ import javafx.scene.paint.Color;
import javafx.stage.Stage;
import javafx.stage.StageStyle;
public class Main extends Application {
public class GEarth extends Application {
public static Application main;
public static String version = "1.5.1";
@ -67,7 +67,7 @@ public class Main extends Application {
public static String[] args;
public static void main(String[] args) {
Main.args = args;
GEarth.args = args;
launch(args);
}

View File

@ -1,6 +1,6 @@
package gearth.extensions;
import gearth.Main;
import gearth.GEarth;
import gearth.protocol.HPacket;
@ -32,7 +32,7 @@ public class InternalExtension extends ExtensionBase {
@Override
public boolean requestFlags(FlagsCheckListener flagRequestCallback) {
flagRequestCallback.act(Main.args);
flagRequestCallback.act(GEarth.args);
return true;
}

View File

@ -1,6 +1,6 @@
package gearth.extensions;
import gearth.Main;
import gearth.GEarth;
import gearth.services.extension_handler.extensions.GEarthExtension;
import gearth.services.extension_handler.extensions.extensionproducers.ExtensionProducerObserver;
import javafx.application.Platform;
@ -51,7 +51,7 @@ public class InternalExtensionFormBuilder<L extends InternalExtensionFormLaunche
return extensionForm.canDelete();
}
};
extensionForm.hostServices = Main.main.getHostServices();
extensionForm.hostServices = GEarth.main.getHostServices();
extensionForm.extension = internalExtension;
extensionForm.primaryStage = stage;

View File

@ -1,6 +1,6 @@
package gearth.misc;
import gearth.Main;
import gearth.GEarth;
import org.json.JSONArray;
import org.json.JSONObject;
@ -22,7 +22,7 @@ public class Cacher {
static {
File GEarthDir = null;
try {
GEarthDir = new File(Main.class.getProtectionDomain().getCodeSource().getLocation().toURI()).getParentFile();
GEarthDir = new File(GEarth.class.getProtectionDomain().getCodeSource().getLocation().toURI()).getParentFile();
if (GEarthDir.getName().equals("Extensions")) {
GEarthDir = GEarthDir.getParentFile();
}

View File

@ -1,6 +1,6 @@
package gearth.misc;
import gearth.Main;
import gearth.GEarth;
import javafx.application.Platform;
import javafx.scene.control.Alert;
import javafx.scene.control.ButtonType;
@ -19,8 +19,8 @@ import java.io.IOException;
import java.net.URL;
import java.nio.charset.StandardCharsets;
import static gearth.Main.gitApi;
import static gearth.Main.version;
import static gearth.GEarth.gitApi;
import static gearth.GEarth.version;
public class UpdateChecker {
@ -38,15 +38,15 @@ public class UpdateChecker {
Alert alert = new Alert(isForcedUpdate ? Alert.AlertType.ERROR : Alert.AlertType.INFORMATION, "G-Earth is outdated!", ButtonType.OK);
Stage stage = (Stage) alert.getDialogPane().getScene().getWindow();
stage.getIcons().add(new Image(Main.class.getResourceAsStream(String.format("/gearth/themes/%s/logoSmall.png", Main.theme))));
stage.getScene().getStylesheets().add(Main.class.getResource(String.format("/gearth/themes/%s/styling.css", Main.theme)).toExternalForm());
stage.getIcons().add(new Image(GEarth.class.getResourceAsStream(String.format("/gearth/themes/%s/logoSmall.png", GEarth.theme))));
stage.getScene().getStylesheets().add(GEarth.class.getResource(String.format("/gearth/themes/%s/styling.css", GEarth.theme)).toExternalForm());
FlowPane fp = new FlowPane();
Label lbl = new Label("A new version of G-Earth has been found ("+gitv+")" + System.lineSeparator()+ System.lineSeparator() + "Update to the latest version:");
Hyperlink link = new Hyperlink("https://github.com/sirjonasxx/G-Earth/releases");
fp.getChildren().addAll( lbl, link);
link.setOnAction(event -> {
Main.main.getHostServices().showDocument(link.getText());
GEarth.main.getHostServices().showDocument(link.getText());
event.consume();
});

View File

@ -5,6 +5,7 @@ import gearth.protocol.HMessage;
import gearth.protocol.connection.*;
import gearth.protocol.connection.proxy.nitro.NitroConstants;
import gearth.protocol.connection.proxy.nitro.NitroProxyProvider;
import gearth.protocol.packethandler.nitro.NitroPacketHandler;
import javax.websocket.*;
import javax.websocket.server.ServerEndpoint;

View File

@ -4,6 +4,7 @@ import gearth.protocol.HConnection;
import gearth.protocol.HMessage;
import gearth.protocol.connection.proxy.nitro.NitroConstants;
import gearth.protocol.packethandler.PacketHandler;
import gearth.protocol.packethandler.nitro.NitroPacketHandler;
import javax.websocket.*;
import java.io.IOException;

View File

@ -1,6 +1,6 @@
package gearth.protocol.memory;
import gearth.Main;
import gearth.GEarth;
import gearth.protocol.HConnection;
import gearth.protocol.HMessage;
import gearth.protocol.HPacket;
@ -83,15 +83,15 @@ public class Rc4Obtainer {
Platform.runLater(() -> {
Alert alert = new Alert(Alert.AlertType.WARNING, "Something went wrong!", ButtonType.OK);
Stage stage = (Stage) alert.getDialogPane().getScene().getWindow();
stage.getIcons().add(new Image(Main.class.getResourceAsStream(String.format("/gearth/themes/%s/logoSmall.png", Main.theme))));
stage.getScene().getStylesheets().add(Main.class.getResource(String.format("/gearth/themes/%s/styling.css", Main.theme)).toExternalForm());
stage.getIcons().add(new Image(GEarth.class.getResourceAsStream(String.format("/gearth/themes/%s/logoSmall.png", GEarth.theme))));
stage.getScene().getStylesheets().add(GEarth.class.getResource(String.format("/gearth/themes/%s/styling.css", GEarth.theme)).toExternalForm());
FlowPane fp = new FlowPane();
Label lbl = new Label("G-Earth has experienced an issue" + System.lineSeparator()+ System.lineSeparator() + "Head over to our Troubleshooting page to solve the problem:");
Hyperlink link = new Hyperlink("https://github.com/sirjonasxx/G-Earth/wiki/Troubleshooting");
fp.getChildren().addAll( lbl, link);
link.setOnAction(event -> {
Main.main.getHostServices().showDocument(link.getText());
GEarth.main.getHostServices().showDocument(link.getText());
event.consume();
});
@ -101,7 +101,7 @@ public class Rc4Obtainer {
alert.getDialogPane().setMinHeight(Region.USE_PREF_SIZE);
alert.getDialogPane().setContent(fp);
alert.setOnCloseRequest(event -> {
Main.main.getHostServices().showDocument(link.getText());
GEarth.main.getHostServices().showDocument(link.getText());
});
alert.show();

View File

@ -32,4 +32,15 @@ public abstract class PacketHandler {
message.getPacket().resetReadIndex();
}
protected void awaitListeners(HMessage message, PacketSender packetSender) {
notifyListeners(0, message);
notifyListeners(1, message);
extensionHandler.handle(message, message2 -> {
notifyListeners(2, message2);
if (!message2.isBlocked()) {
packetSender.send(message2);
}
});
}
}

View File

@ -0,0 +1,9 @@
package gearth.protocol.packethandler;
import gearth.protocol.HMessage;
public interface PacketSender {
void send(HMessage hMessage);
}

View File

@ -8,7 +8,6 @@ import gearth.protocol.crypto.RC4;
import gearth.protocol.packethandler.PacketHandler;
import gearth.protocol.packethandler.PayloadBuffer;
import gearth.services.extension_handler.ExtensionHandler;
import gearth.services.extension_handler.OnHMessageHandled;
import java.io.IOException;
import java.io.OutputStream;
@ -116,10 +115,14 @@ public abstract class FlashPacketHandler extends PacketHandler {
}
public boolean sendToStream(byte[] buffer) {
return sendToStream(buffer, isEncryptedStream);
}
private boolean sendToStream(byte[] buffer, boolean isEncrypted) {
synchronized (sendLock) {
try {
out.write(
(!isEncryptedStream)
(!isEncrypted)
? buffer
: encryptcipher.rc4(buffer)
);
@ -139,29 +142,11 @@ public abstract class FlashPacketHandler extends PacketHandler {
HMessage hMessage = new HMessage(hpacket, getMessageSide(), currentIndex);
boolean isencrypted = isEncryptedStream;
OnHMessageHandled afterExtensionIntercept = hMessage1 -> {
if (isDataStream) {
notifyListeners(2, hMessage1);
}
if (!hMessage1.isBlocked()) {
synchronized (sendLock) {
out.write(
(!isencrypted)
? hMessage1.getPacket().toBytes()
: encryptcipher.rc4(hMessage1.getPacket().toBytes())
);
}
}
};
if (isDataStream) {
notifyListeners(0, hMessage);
notifyListeners(1, hMessage);
extensionHandler.handle(hMessage, afterExtensionIntercept);
awaitListeners(hMessage, hMessage1 -> sendToStream(hMessage1.getPacket().toBytes(), isencrypted));
}
else {
afterExtensionIntercept.finished(hMessage);
sendToStream(hMessage.getPacket().toBytes(), isencrypted);
}
currentIndex++;

View File

@ -1,11 +1,11 @@
package gearth.protocol.connection.proxy.nitro.websocket;
package gearth.protocol.packethandler.nitro;
import gearth.protocol.HMessage;
import gearth.protocol.HPacket;
import gearth.protocol.connection.proxy.nitro.websocket.NitroSession;
import gearth.protocol.packethandler.PacketHandler;
import gearth.protocol.packethandler.PayloadBuffer;
import gearth.services.extension_handler.ExtensionHandler;
import gearth.services.extension_handler.OnHMessageHandled;
import javax.websocket.Session;
import java.io.IOException;
@ -18,7 +18,7 @@ public class NitroPacketHandler extends PacketHandler {
private final PayloadBuffer payloadBuffer;
private final Object payloadLock;
protected NitroPacketHandler(HMessage.Direction direction, NitroSession session, ExtensionHandler extensionHandler, Object[] trafficObservables) {
public NitroPacketHandler(HMessage.Direction direction, NitroSession session, ExtensionHandler extensionHandler, Object[] trafficObservables) {
super(extensionHandler, trafficObservables);
this.direction = direction;
this.session = session;
@ -50,19 +50,7 @@ public class NitroPacketHandler extends PacketHandler {
synchronized (payloadLock) {
for (HPacket packet : payloadBuffer.receive()) {
HMessage hMessage = new HMessage(packet, direction, currentIndex);
OnHMessageHandled afterExtensionIntercept = hMessage1 -> {
notifyListeners(2, hMessage1);
if (!hMessage1.isBlocked()) {
sendToStream(hMessage1.getPacket().toBytes());
}
};
notifyListeners(0, hMessage);
notifyListeners(1, hMessage);
extensionHandler.handle(hMessage, afterExtensionIntercept);
awaitListeners(hMessage, hMessage1 -> sendToStream(hMessage1.getPacket().toBytes()));
currentIndex++;
}
}

View File

@ -5,7 +5,6 @@ import gearth.protocol.HPacket;
import gearth.protocol.packethandler.ByteArrayUtils;
import gearth.protocol.packethandler.PacketHandler;
import gearth.services.extension_handler.ExtensionHandler;
import gearth.services.extension_handler.OnHMessageHandled;
import javax.websocket.Session;
import java.io.IOException;
@ -34,19 +33,7 @@ public class UnityPacketHandler extends PacketHandler {
@Override
public void act(byte[] buffer) throws IOException {
HMessage hMessage = new HMessage(new HPacket(buffer), direction, currentIndex);
OnHMessageHandled afterExtensionIntercept = hMessage1 -> {
notifyListeners(2, hMessage1);
if (!hMessage1.isBlocked()) {
sendToStream(hMessage1.getPacket().toBytes());
}
};
notifyListeners(0, hMessage);
notifyListeners(1, hMessage);
extensionHandler.handle(hMessage, afterExtensionIntercept);
awaitListeners(hMessage, hMessage1 -> sendToStream(hMessage1.getPacket().toBytes()));
currentIndex++;
}
}

View File

@ -1,6 +1,6 @@
package gearth.services.extension_handler;
import gearth.Main;
import gearth.GEarth;
import gearth.misc.listenerpattern.Observable;
import gearth.protocol.HConnection;
import gearth.protocol.HMessage;
@ -184,7 +184,7 @@ public class ExtensionHandler {
ExtensionListener listener = new ExtensionListener() {
@Override
public void flagsRequest() {
extension.provideFlags(Main.args);
extension.provideFlags(GEarth.args);
}
@Override

View File

@ -1,6 +1,6 @@
package gearth.services.extension_handler.extensions.implementations.network.executer;
import gearth.Main;
import gearth.GEarth;
import gearth.services.extension_handler.extensions.implementations.network.authentication.Authenticator;
import gearth.services.internal_extensions.extensionstore.tools.StoreExtensionTools;
@ -23,9 +23,9 @@ public class NormalExtensionRunner implements ExtensionRunner {
static {
String value;
try {
value = new File(Main.class.getProtectionDomain().getCodeSource().getLocation().toURI()).getParent();
value = new File(GEarth.class.getProtectionDomain().getCodeSource().getLocation().toURI()).getParent();
} catch (URISyntaxException e) {
value = new File(Main.class.getProtectionDomain().getCodeSource().getLocation().getPath()).getParent();
value = new File(GEarth.class.getProtectionDomain().getCodeSource().getLocation().getPath()).getParent();
e.printStackTrace();
}
JARPATH = value;
@ -115,7 +115,7 @@ public class NormalExtensionRunner implements ExtensionRunner {
}
public static void maybeLogExtension(String path, Process proc) {
if (Main.hasFlag(ExtensionRunner.SHOW_EXTENSIONS_LOG)) {
if (GEarth.hasFlag(ExtensionRunner.SHOW_EXTENSIONS_LOG)) {
String sep = "" + System.lineSeparator();
synchronized (System.out) {
System.out.println(path + sep + "Launching" + sep + "----------" + sep);

View File

@ -1,6 +1,6 @@
package gearth.services.g_python;
import gearth.Main;
import gearth.GEarth;
import gearth.ui.extra.ExtraController;
import javafx.application.Platform;
import javafx.scene.control.Alert;
@ -171,8 +171,8 @@ public class GPythonShell {
Platform.runLater(() -> {
Alert alert = new Alert(Alert.AlertType.ERROR, "G-Python error", ButtonType.OK);
Stage stage = (Stage) alert.getDialogPane().getScene().getWindow();
stage.getIcons().add(new Image(Main.class.getResourceAsStream(String.format("/gearth/themes/%s/logoSmall.png", Main.theme))));
stage.getScene().getStylesheets().add(Main.class.getResource(String.format("/gearth/themes/%s/styling.css", Main.theme)).toExternalForm());
stage.getIcons().add(new Image(GEarth.class.getResourceAsStream(String.format("/gearth/themes/%s/logoSmall.png", GEarth.theme))));
stage.getScene().getStylesheets().add(GEarth.class.getResource(String.format("/gearth/themes/%s/styling.css", GEarth.theme)).toExternalForm());
alert.setTitle("G-Python error");
FlowPane fp = new FlowPane();
@ -182,7 +182,7 @@ public class GPythonShell {
Hyperlink link = new Hyperlink(ExtraController.INFO_URL_GPYTHON);
fp.getChildren().addAll(lbl, link);
link.setOnAction(event -> {
Main.main.getHostServices().showDocument(link.getText());
GEarth.main.getHostServices().showDocument(link.getText());
event.consume();
});

View File

@ -1,6 +1,6 @@
package gearth.services.internal_extensions.extensionstore;
import gearth.Main;
import gearth.GEarth;
import gearth.extensions.InternalExtensionFormLauncher;
import gearth.services.internal_extensions.extensionstore.application.GExtensionStoreController;
import gearth.ui.GEarthController;
@ -26,8 +26,8 @@ public class GExtensionStoreLauncher extends InternalExtensionFormLauncher<GExte
stage.setHeight(530);
stage.setScene(new Scene(root));
stage.getScene().getStylesheets().add(GEarthController.class.getResource(String.format("/gearth/themes/%s/styling.css", Main.theme)).toExternalForm());
stage.getIcons().add(new Image(Main.class.getResourceAsStream(String.format("/gearth/themes/%s/logoSmall.png", Main.theme))));
stage.getScene().getStylesheets().add(GEarthController.class.getResource(String.format("/gearth/themes/%s/styling.css", GEarth.theme)).toExternalForm());
stage.getIcons().add(new Image(GEarth.class.getResourceAsStream(String.format("/gearth/themes/%s/logoSmall.png", GEarth.theme))));
GExtensionStore gExtensionStore = new GExtensionStore();

View File

@ -7,6 +7,7 @@ import gearth.services.internal_extensions.extensionstore.application.entities.c
import gearth.services.internal_extensions.extensionstore.application.entities.installed.InstalledOverview;
import gearth.services.internal_extensions.extensionstore.application.entities.queriedoverviews.ByDateOverview;
import gearth.services.internal_extensions.extensionstore.application.entities.queriedoverviews.ByRatingOverview;
import gearth.services.internal_extensions.extensionstore.application.entities.queriedoverviews.ByUpdateOverview;
import gearth.services.internal_extensions.extensionstore.application.entities.search.SearchOverview;
import gearth.services.internal_extensions.extensionstore.repository.StoreRepository;
import javafx.application.Platform;
@ -47,20 +48,20 @@ public class GExtensionStoreController implements Initializable {
JSObject window = (JSObject) webView.getEngine().executeScript("window");
window.setMember("app", extensionStore);
Element by_date_link = webView.getEngine().getDocument().getElementById("overview_by_date");
Element by_update_link = webView.getEngine().getDocument().getElementById("overview_by_update");
Element by_rating_link = webView.getEngine().getDocument().getElementById("overview_by_rating");
Element by_category_link = webView.getEngine().getDocument().getElementById("overview_by_category");
Element installed_link = webView.getEngine().getDocument().getElementById("overview_installed");
Element seach_link = webView.getEngine().getDocument().getElementById("search_page");
Map<Element, Supplier<HOverview>> hOverviewSupplier = new HashMap<>();
hOverviewSupplier.put(by_date_link, () -> new ByDateOverview(null, 0, GExtensionStore.PAGESIZE, getStoreRepository()));
hOverviewSupplier.put(by_update_link, () -> new ByUpdateOverview(null, 0, GExtensionStore.PAGESIZE, getStoreRepository()));
hOverviewSupplier.put(by_rating_link, () -> new ByRatingOverview(null, 0, GExtensionStore.PAGESIZE, getStoreRepository()));
hOverviewSupplier.put(by_category_link, () -> new CategoryOverview(null, 0, GExtensionStore.PAGESIZE, getStoreRepository()));
hOverviewSupplier.put(installed_link, () -> new InstalledOverview(null, 0, GExtensionStore.PAGESIZE, getStoreRepository()));
hOverviewSupplier.put(seach_link, () -> new SearchOverview(null, getStoreRepository()));
Arrays.asList(by_date_link, by_rating_link, by_category_link, installed_link, seach_link).forEach(l ->
Arrays.asList(by_update_link, by_rating_link, by_category_link, installed_link, seach_link).forEach(l ->
((EventTarget) l).addEventListener("click", event -> {
if (initialized) setRootOverview(hOverviewSupplier.get(l).get());
}, true));
@ -210,7 +211,7 @@ public class GExtensionStoreController implements Initializable {
private void onFullInitialize() {
initialized = true;
setRootOverview(new ByDateOverview(null, 0, GExtensionStore.PAGESIZE, getStoreRepository()));
setRootOverview(new ByUpdateOverview(null, 0, GExtensionStore.PAGESIZE, getStoreRepository()));
}
public void gExtensionStore(GExtensionStore gExtensionStore) {

View File

@ -49,8 +49,12 @@ public class StoreExtensionDetailsItem implements ContentItem {
.append("*Author(s):* ").append(storeExtension.getAuthors().stream().map(StoreExtension.Author::getName).collect(Collectors.joining(", "))).append("\n\n")
.append("*Categories:* ").append(storeExtension.getCategories().stream().map(ExtCategory::getName).collect(Collectors.joining(", "))).append("\n\n");
contentBuilder.append("*Technical information*").append("\n")
.append("> Language: ").append(storeExtension.getLanguage()).append("\n")
contentBuilder.append("*Technical information*").append("\n");
if(storeExtension.getReleases() != null)
contentBuilder.append("> Releases: --url:Click Here-").append(storeExtension.getReleases()).append("\n");
contentBuilder.append("> Language: ").append(storeExtension.getLanguage()).append("\n")
.append("> Source: --url:Click Here-").append(storeExtension.getSource()).append("\n")
.append("> Framework: ").append(storeExtension.getFramework().getFramework().getName()).append(" - v").append(storeExtension.getFramework().getVersion()).append("\n")
.append("> Systems: ").append(String.join(", ", storeExtension.getCompatibility().getSystems())).append("\n \n");

View File

@ -0,0 +1,54 @@
package gearth.services.internal_extensions.extensionstore.application.entities.queriedoverviews;
import gearth.misc.OSValidator;
import gearth.services.internal_extensions.extensionstore.application.entities.HOverview;
import gearth.services.internal_extensions.extensionstore.repository.StoreRepository;
import gearth.services.internal_extensions.extensionstore.repository.models.StoreExtension;
import gearth.services.internal_extensions.extensionstore.repository.querying.ExtensionOrdering;
import java.util.Collections;
import java.util.List;
public class ByUpdateOverview extends QueriedExtensionOverview {
public ByUpdateOverview(HOverview parent, int startIndex, int size, StoreRepository storeRepository) {
super(parent, startIndex, size, storeRepository);
}
protected List<StoreExtension> query(int startIndex, int size) {
return storeRepository.getExtensions(startIndex, size, "", ExtensionOrdering.LAST_UPDATED,
Collections.singletonList(OSValidator.getOSFull()), null, null, null, false, false);
}
@Override
public Header header() {
return new Header() {
@Override
public String iconUrl() {
return "images/overviews/clock.png";
}
@Override
public String title() {
return "Recently Updated";
}
@Override
public String description() {
return "Extensions that were recently updated";
}
@Override
public String contentTitle() {
return "Recently Updated";
}
};
}
@Override
public HOverview getNewPage(int startIndex, int size) {
return new ByUpdateOverview(parent, startIndex, size, storeRepository);
}
}

View File

@ -1,6 +1,6 @@
package gearth.services.internal_extensions.extensionstore.repository;
import gearth.Main;
import gearth.GEarth;
import gearth.services.internal_extensions.extensionstore.repository.models.StoreData;
import org.apache.commons.io.IOUtils;
import org.json.JSONArray;
@ -19,7 +19,7 @@ public class StoreFetch {
}
public static void fetch(StoreFetchListener storeFetchListener) {
fetch(Main.version, storeFetchListener, "sirjonasxx/G-ExtensionStore");
fetch(GEarth.version, storeFetchListener, "sirjonasxx/G-ExtensionStore");
}
public static void fetch(String version, StoreFetchListener storeFetchListener) {
@ -34,11 +34,11 @@ public class StoreFetch {
new URL(String.format("https://raw.githubusercontent.com/%s/repo/%s/store/config.json", source, version))
.openStream(), StandardCharsets.UTF_8));
JSONArray exensions = new JSONArray(IOUtils.toString(
JSONArray extensions = new JSONArray(IOUtils.toString(
new URL(String.format("https://raw.githubusercontent.com/%s/repo/%s/.auto-generated/extensions.json", source, version))
.openStream(), StandardCharsets.UTF_8));
storeFetchListener.success(new StoreRepository(new StoreData(config, exensions), version, source));
storeFetchListener.success(new StoreRepository(new StoreData(config, extensions), version, source));
} catch (Exception e) {
storeFetchListener.fail(e.getLocalizedMessage());

View File

@ -78,7 +78,7 @@ public class StoreRepository {
}
public List<String> getClients() {
return Arrays.asList("Unity", "Flash");
return Arrays.asList("Unity", "Flash", "Nitro");
}
public List<String> getLanguages() {

View File

@ -10,7 +10,7 @@ import java.util.stream.Collectors;
public class StoreExtension {
public StoreExtension(String title, String description, List<Author> authors, String version, List<ExtCategory> categories, String source, String readme, boolean stable, Framework framework, String language, Commands commands, Compatibility compatibility, LocalDateTime submissionDate, LocalDateTime updateDate, boolean isOutdated, int rating) {
public StoreExtension(String title, String description, List<Author> authors, String version, List<ExtCategory> categories, String source, String readme, String releases, boolean stable, Framework framework, String language, Commands commands, Compatibility compatibility, LocalDateTime submissionDate, LocalDateTime updateDate, boolean isOutdated, int rating) {
this.title = title;
this.description = description;
this.authors = authors;
@ -18,6 +18,7 @@ public class StoreExtension {
this.categories = categories;
this.source = source;
this.readme = readme;
this.releases = releases;
this.stable = stable;
this.framework = framework;
this.language = language;
@ -38,6 +39,7 @@ public class StoreExtension {
.toList().stream().anyMatch(j -> j.equals(c.getName()))).collect(Collectors.toList());
this.source = object.getString("source");
this.readme = object.has("readme") ? object.getString("readme") : null;
this.releases = object.has("releases") ? object.getString("releases") : null;
this.stable = object.getBoolean("stable");
this.framework = new Framework(object.getJSONObject("framework"), storeConfig);
this.language = object.getString("language");
@ -201,6 +203,7 @@ public class StoreExtension {
private final String source;
private final String readme;
private final String releases;
private final boolean stable;
@ -246,6 +249,10 @@ public class StoreExtension {
return readme;
}
public String getReleases() {
return releases;
}
public boolean isStable() {
return stable;
}

View File

@ -1,6 +1,6 @@
package gearth.services.internal_extensions.extensionstore.tools;
import gearth.Main;
import gearth.GEarth;
import gearth.misc.OSValidator;
import gearth.services.extension_handler.extensions.implementations.network.authentication.Authenticator;
import gearth.services.extension_handler.extensions.implementations.network.executer.ExecutionInfo;
@ -242,7 +242,7 @@ public class StoreExtensionTools {
}
public static void main(String[] args) {
StoreFetch.fetch(Main.version, new StoreFetch.StoreFetchListener() {
StoreFetch.fetch(GEarth.version, new StoreFetch.StoreFetchListener() {
@Override
public void success(StoreRepository storeRepository) {
installExtension("G-BuildTools", storeRepository, new InstallExtListener() {

View File

@ -1,6 +1,6 @@
package gearth.services.internal_extensions.uilogger;
import gearth.Main;
import gearth.GEarth;
import gearth.extensions.InternalExtensionFormLauncher;
import javafx.fxml.FXMLLoader;
import javafx.scene.Parent;
@ -17,12 +17,12 @@ public class UiLoggerLauncher extends InternalExtensionFormLauncher<UiLogger> {
FXMLLoader loader = new FXMLLoader(UiLogger.class.getResource("UiLogger.fxml"));
Parent root = loader.load();
stage.setTitle(String.format("%s | Packet Logger", Main.theme));
stage.setTitle(String.format("%s | Packet Logger", GEarth.theme));
stage.initModality(Modality.NONE);
stage.getIcons().add(new Image(getClass().getResourceAsStream(String.format("/gearth/themes/%s/logoSmall.png", Main.theme))));
stage.getIcons().add(new Image(getClass().getResourceAsStream(String.format("/gearth/themes/%s/logoSmall.png", GEarth.theme))));
Scene scene = new Scene(root);
scene.getStylesheets().add(String.format("/gearth/themes/%s/styling.css", Main.theme));
scene.getStylesheets().add(String.format("/gearth/themes/%s/styling.css", GEarth.theme));
scene.getStylesheets().add("/gearth/services/internal_extensions/uilogger/logger.css");
UiLoggerController controller = loader.getController();

View File

@ -1,6 +1,6 @@
package gearth.services.packet_info.providers.implementations;
import gearth.Main;
import gearth.GEarth;
import gearth.services.packet_info.PacketInfo;
import gearth.services.packet_info.providers.PacketInfoProvider;
import gearth.protocol.HMessage;
@ -21,7 +21,7 @@ public class GEarthUnityPacketInfoProvider extends PacketInfoProvider {
@Override
protected File getFile() {
try {
return new File(new File(Main.class.getProtectionDomain().getCodeSource().getLocation().toURI())
return new File(new File(GEarth.class.getProtectionDomain().getCodeSource().getLocation().toURI())
.getParentFile(), "messages.json");
} catch (URISyntaxException e) {
e.printStackTrace();

View File

@ -1,6 +1,6 @@
package gearth.services.unity_tools;
import gearth.Main;
import gearth.GEarth;
import gearth.misc.Cacher;
import javax.servlet.ServletOutputStream;
@ -15,6 +15,7 @@ public class GUnityFileServer extends HttpServlet
{
public final static int FILESERVER_PORT = 9089;
private final static UnityWebModifyer modifyer = new UnityWebModifyer();
@Override
public void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException
@ -38,11 +39,10 @@ public class GUnityFileServer extends HttpServlet
String revision = url.split("/")[4];
if (path.equals("/prod")) getProd(revision, response);
else if (path.equals("/data")) getData(revision, response);
else if (path.equals("/wasm/code")) getWasmCode(revision, response);
else if (path.equals("/wasm/framework")) getWasmFramework(revision, response);
else if (path.equals("/unityloader")) getUnityLoader(revision, response);
if (path.equals("/data")) getData(revision, response);
else if (path.equals("/wasm")) getWasmCode(revision, response);
else if (path.equals("/framework")) getWasmFramework(revision, response);
else if (path.equals("/loader")) getLoader(revision, response);
else if (path.equals("/version")) getVersion(revision, response, url);
else if (path.equals("/logo")) getLogo(response);
else {
@ -76,10 +76,16 @@ public class GUnityFileServer extends HttpServlet
}
private void fileResponse(String file, HttpServletResponse response, String contentType) throws IOException {
private void fileResponse(String file, HttpServletResponse response, String contentType, boolean gzip) throws IOException {
ServletOutputStream out = response.getOutputStream();
InputStream in = new FileInputStream(file);
// response.setContentType(contentType);
if (contentType != null) {
response.setContentType(contentType);
}
if (gzip) {
response.setHeader("Content-Encoding", "gzip");
}
byte[] bytes = new byte[4096];
int bytesRead;
@ -93,31 +99,28 @@ public class GUnityFileServer extends HttpServlet
}
private void getProd(String revision, HttpServletResponse response) throws IOException {
UnityWebModifyer unitywebModifyer = new UnityWebModifyer(revision, getDir(revision));
unitywebModifyer.modifyAllFiles();
fileResponse(getDir(revision) + UnityWebModifyer.UNITY_PROD, response, "application/json");
}
private void getData(String revision, HttpServletResponse response) throws IOException {
// application/vnd.unity
fileResponse(getDir(revision) + UnityWebModifyer.UNITY_DATA, response, "application/vnd.unity");
modifyer.modifyAllFiles(revision, getDir(revision));
fileResponse(getDir(revision) + UnityWebModifyer.UNITY_DATA, response, null, true);
}
private void getWasmCode(String revision, HttpServletResponse response) throws IOException {
fileResponse(getDir(revision) + UnityWebModifyer.UNITY_CODE, response, "application/vnd.unity");
modifyer.modifyAllFiles(revision, getDir(revision));
fileResponse(getDir(revision) + UnityWebModifyer.UNITY_CODE, response, "application/wasm", true);
}
private void getWasmFramework(String revision, HttpServletResponse response) throws IOException {
fileResponse(getDir(revision) + UnityWebModifyer.UNITY_FRAMEWORK, response, "application/vnd.unity");
modifyer.modifyAllFiles(revision, getDir(revision));
fileResponse(getDir(revision) + UnityWebModifyer.UNITY_FRAMEWORK, response, "text/javascript", true);
}
private void getUnityLoader(String revision, HttpServletResponse response) throws IOException {
UnityWebModifyer unitywebModifyer = new UnityWebModifyer(revision, getDir(revision));
unitywebModifyer.modifyAllFiles();
private void getLoader(String revision, HttpServletResponse response) throws IOException {
modifyer.modifyAllFiles(revision, getDir(revision));
fileResponse(getDir(revision) + UnityWebModifyer.UNITY_LOADER, response, "text/javascript");
fileResponse(getDir(revision) + UnityWebModifyer.UNITY_LOADER, response, "text/javascript", false);
}
private void getVersion(String revision, HttpServletResponse response, String url) throws IOException {
@ -132,7 +135,7 @@ public class GUnityFileServer extends HttpServlet
private void getLogo(HttpServletResponse response) throws IOException {
OutputStream out = response.getOutputStream();
InputStream in = Main.class.getResourceAsStream(String.format("/gearth/themes/%s/logo.png", Main.theme));
InputStream in = GEarth.class.getResourceAsStream(String.format("/gearth/themes/%s/logo.png", GEarth.theme));
byte[] bytes = new byte[4096];
int bytesRead;

View File

@ -1,5 +1,6 @@
package gearth.services.unity_tools;
import org.apache.commons.io.IOUtils;
import org.codehaus.plexus.util.FileUtils;
import wasm.disassembly.InvalidOpCodeException;
@ -10,36 +11,34 @@ import java.net.URLConnection;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.util.zip.GZIPInputStream;
import java.util.zip.GZIPOutputStream;
public class UnityWebModifyer {
public final static String UNITY_PROD = "habbo2020-global-prod.json";
public final static String UNITY_DATA = "habbo2020-global-prod.data.unityweb";
public final static String UNITY_CODE = "habbo2020-global-prod.wasm.code.unityweb";
public final static String UNITY_FRAMEWORK = "habbo2020-global-prod.wasm.framework.unityweb";
public final static String UNITY_LOADER = "UnityLoader.js";
public final static String UNITY_DATA = "habbo2020-global-prod.data.gz";
public final static String UNITY_CODE = "habbo2020-global-prod.wasm.gz";
public final static String UNITY_FRAMEWORK = "habbo2020-global-prod.framework.js.gz";
public final static String UNITY_LOADER = "habbo2020-global-prod.loader.js";
private final static String UNITYFILES_URL = "https://images.habbo.com/habbo-webgl-clients/{revision}/WebGL/habbo2020-global-prod/Build/";
private final String revision;
private final File saveFolder;
private final String currentUrl;
private String revision;
private File saveFolder;
private String currentUrl;
public UnityWebModifyer(String revision, String saveFolder) {
public synchronized boolean modifyAllFiles(String revision, String saveFolderName) {
this.revision = revision;
this.currentUrl = UNITYFILES_URL.replace("{revision}", revision);
this.saveFolder = new File(saveFolder);
}
currentUrl = UNITYFILES_URL.replace("{revision}", revision);
saveFolder = new File(saveFolderName);
public boolean modifyAllFiles() {
if (saveFolder.exists()) {
return true;
}
saveFolder.mkdirs();
try {
modifyProdFile();
modifyDataFile();
modifyCodeFile();
modifyFrameworkFile();
@ -57,27 +56,6 @@ public class UnityWebModifyer {
return true;
}
// return urls for: data, code & framework file
private void modifyProdFile() throws IOException {
String prodUrl = currentUrl + UNITY_PROD;
URLConnection connection = new URL(prodUrl).openConnection();
InputStream is = connection.getInputStream();
BufferedReader in = new BufferedReader(new InputStreamReader(is, StandardCharsets.UTF_8));
FileWriter fileWriter = new FileWriter(new File(saveFolder, UNITY_PROD));
BufferedWriter bufferedWriter = new BufferedWriter(fileWriter);
String line;
while ((line = in.readLine()) != null) {
bufferedWriter.write(line);
bufferedWriter.newLine();
}
bufferedWriter.close();
in.close();
}
private void downloadToFile(URL url, File file) throws IOException {
BufferedInputStream in = new BufferedInputStream(url.openStream());
FileOutputStream fileOutputStream = new FileOutputStream(file);
@ -89,7 +67,7 @@ public class UnityWebModifyer {
fileOutputStream.close();
in.close();
}
//
private void modifyDataFile() throws IOException {
File dataFile = new File(saveFolder, UNITY_DATA);
URL dataUrl = new URL(currentUrl + UNITY_DATA);
@ -131,7 +109,7 @@ public class UnityWebModifyer {
downloadToFile(frameworkUrl, frameworkFile);
byte[] encoded = Files.readAllBytes(Paths.get(frameworkFile.getAbsolutePath()));
byte[] encoded = IOUtils.toByteArray(new GZIPInputStream(new FileInputStream(frameworkFile)));
String contents = new String(encoded, StandardCharsets.UTF_8);
contents = insertFrameworkCode(contents, 0, "js_code/unity_code.js");
@ -147,9 +125,10 @@ public class UnityWebModifyer {
contents = contents
.replace("var _free", "_free")
.replace("var _malloc", "_malloc")
.replace("var Module=typeof Module!==\"undefined\"?Module:{};", "var Module=typeof Module!==\"undefined\"?Module:{}; _module = Module")
.replace("{{RevisionName}}", revision);
BufferedWriter writer = new BufferedWriter(new FileWriter(frameworkFile));
BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(new GZIPOutputStream(new FileOutputStream(frameworkFile))));
writer.write(contents);
writer.close();
}
@ -162,14 +141,14 @@ public class UnityWebModifyer {
byte[] encoded = Files.readAllBytes(Paths.get(loaderFile.getAbsolutePath()));
String contents = new String(encoded, StandardCharsets.UTF_8);
contents = contents.replace("o.result.responseHeaders[e]==a.getResponseHeader(e)", "false");
contents = contents.replace("i.responseHeaders[e]=o.getResponseHeader(e)",
contents = contents.replace("o.result.responseHeaders[e]==s.getResponseHeader(e)", "false");
contents = contents.replace("a.responseHeaders[e]=o.getResponseHeader(e)",
"const genRanHex = size => [...Array(size)].map(() => Math.floor(Math.random() * 16).toString(16)).join('');\n" +
" if (e === \"ETag\") {\n" +
" i.responseHeaders[e] = \"W/\\\"\" + genRanHex(6) + \"-\" + genRanHex(13) + \"\\\"\"\n" +
" a.responseHeaders[e] = \"W/\\\"\" + genRanHex(6) + \"-\" + genRanHex(13) + \"\\\"\"\n" +
" }\n" +
" else {\n" +
" i.responseHeaders[e] = o.getResponseHeader(e)\n" +
" a.responseHeaders[e] = o.getResponseHeader(e)\n" +
" }");
BufferedWriter writer = new BufferedWriter(new FileWriter(loaderFile));

View File

@ -19,12 +19,12 @@ public class WasmCodePatcher {
}
public void patch() throws IOException, InvalidOpCodeException {
Module module = new Module(file, Arrays.asList(
Module module = new Module(file, true, Arrays.asList(
new SetKeyPatcher(),
new ReturnBytePatcher(),
new OutgoingPacketPatcher(),
new IncomingPacketPatcher()
));
module.assembleToFile(file);
module.assembleToFile(file, true);
}
}

View File

@ -1,225 +0,0 @@
//package gearth.services.unity_tools;
//
//import wasm.disassembly.InvalidOpCodeException;
//import wasm.disassembly.instructions.Expression;
//import wasm.disassembly.instructions.Instr;
//import wasm.disassembly.instructions.InstrType;
//import wasm.disassembly.instructions.control.CallInstr;
//import wasm.disassembly.instructions.variable.LocalVariableInstr;
//import wasm.disassembly.modules.Module;
//import wasm.disassembly.modules.indices.FuncIdx;
//import wasm.disassembly.modules.indices.LocalIdx;
//import wasm.disassembly.modules.indices.TypeIdx;
//import wasm.disassembly.modules.sections.code.Func;
//import wasm.disassembly.modules.sections.export.Export;
//import wasm.disassembly.modules.sections.export.ExportDesc;
//import wasm.disassembly.modules.sections.imprt.Import;
//import wasm.disassembly.modules.sections.imprt.ImportDesc;
//import wasm.disassembly.types.FuncType;
//import wasm.disassembly.types.ResultType;
//import wasm.disassembly.types.ValType;
//import wasm.misc.Function;
//
//import java.io.*;
//import java.util.*;
//
//public class WasmCodePatcherOld {
//
// private String file;
//
// public WasmCodePatcherOld(String file) {
// this.file = file;
// }
//
// public void patch() throws IOException, InvalidOpCodeException {
// Module module = new Module(file);
//
// FuncIdx returnByteId = findReturnByteFunc(module);
// FuncIdx setkey = findSetKeyFunc(module);
// FuncIdx outgoingIdx = findOutFunc(module);
// FuncIdx incomingIdx = findInFunc(module);
//
// hook(module, setkey, "g_chacha_setkey");
// copyEmptyHook(module, returnByteId, "_gearth_returnbyte_copy", "g_chacha_returnbyte");
// copyEmptyHook(module, outgoingIdx, "_gearth_outgoing_copy", "g_outgoing_packet");
// copyEmptyHook(module, incomingIdx, "_gearth_incoming_copy", "g_incoming_packet");
//
// module.assembleToFile(file);
// }
//
//
// private FuncIdx findOutFunc(Module module) {
// TypeIdx expectedTypeIdx = module.getTypeSection().getTypeIdxForFuncType(new FuncType(
// new ResultType(Arrays.asList(ValType.I32, ValType.I32, ValType.I32)),
// new ResultType(Collections.emptyList())
// ));
//
// outerloop:
// for (int i = 0; i < module.getCodeSection().getCodesEntries().size(); i++) {
// FuncIdx currentIdx = new FuncIdx(i + module.getImportSection().getTotalFuncImports(), module);
//
// Func func = module.getCodeSection().getByIdx(currentIdx);
// if (func.getLocalss().size() != 0) continue;
// if (!module.getFunctionSection().getByIdx(currentIdx).equals(expectedTypeIdx)) continue;
//
// List<Instr> expression = func.getExpression().getInstructions();
//
// if (expression.size() != 6) continue;
//
// if (expression.get(0).getInstrType() != InstrType.LOCAL_GET) continue;
// if (expression.get(1).getInstrType() != InstrType.LOCAL_GET) continue;
// if (expression.get(2).getInstrType() != InstrType.LOCAL_GET) continue;
// if (expression.get(3).getInstrType() != InstrType.I32_LOAD) continue;
// if (expression.get(4).getInstrType() != InstrType.I32_CONST) continue;
// if (expression.get(5).getInstrType() != InstrType.CALL) continue;
//
// return currentIdx;
// }
//
// return null;
// }
// private FuncIdx findSetKeyFunc(Module module) {
// FuncType expectedType = new FuncType(
// new ResultType(Arrays.asList(ValType.I32, ValType.I32, ValType.I32, ValType.I32)),
// new ResultType(Collections.emptyList())
// );
//
// List<InstrType> expectedExpr = Arrays.asList(InstrType.I32_CONST, InstrType.I32_LOAD8_S,
// InstrType.I32_EQZ, InstrType.IF, InstrType.BLOCK, InstrType.LOCAL_GET, InstrType.I32_CONST,
// InstrType.LOCAL_GET, InstrType.I32_LOAD, InstrType.I32_CONST, InstrType.I32_CONST, InstrType.I32_CONST,
// InstrType.CALL);
//
// outerloop:
// for (int i = 0; i < module.getCodeSection().getCodesEntries().size(); i++) {
// FuncIdx funcIdx = new FuncIdx(i + module.getImportSection().getTotalFuncImports(), module);
//
// Function function = new Function(module, funcIdx);
// if (!function.getFuncType().equals(expectedType)) continue;
// if (!(function.getLocalsFloored().size() == 1 && function.getLocalsFloored().get(0) == ValType.I32)) continue;
// if (function.getCode().getInstructions().size() != expectedExpr.size()) continue;
//
// for (int j = 0; j < function.getCode().getInstructions().size(); j++) {
// Instr instr = function.getCode().getInstructions().get(j);
// if (instr.getInstrType() != expectedExpr.get(j)) continue outerloop;
// }
//
// return funcIdx;
// }
//
// return null;
// }
// private FuncIdx findReturnByteFunc(Module module) {
// FuncType expectedType = new FuncType(
// new ResultType(Arrays.asList(ValType.I32, ValType.I32, ValType.I32)),
// new ResultType(Collections.singletonList(ValType.I32))
// );
//
// outerloop:
// for (int i = 0; i < module.getCodeSection().getCodesEntries().size(); i++) {
// FuncIdx funcIdx = new FuncIdx(i + module.getImportSection().getTotalFuncImports(), module);
//
// Function function = new Function(module, funcIdx);
// if (!function.getFuncType().equals(expectedType)) continue;
// if (function.getLocalsFloored().size() != 0) continue;
// if (function.getCode().getInstructions().size() != 30) continue;
//
// List<Instr> expr = function.getCode().getInstructions();
// if (expr.get(expr.size() - 1).getInstrType() != InstrType.I32_XOR) continue;
//
// return funcIdx;
// }
//
// return null;
// }
// private FuncIdx findInFunc(Module module) {
// FuncType expectedType = new FuncType(
// new ResultType(Arrays.asList(ValType.I32, ValType.I32, ValType.I32, ValType.I32, ValType.I32)),
// new ResultType(Collections.emptyList())
// );
//
// List<InstrType> expectedExpr = Arrays.asList(InstrType.I32_CONST, InstrType.I32_LOAD8_S,
// InstrType.I32_EQZ, InstrType.IF, InstrType.LOCAL_GET, InstrType.I32_LOAD, InstrType.LOCAL_TEE,
// InstrType.IF);
//
// outerloop:
// for (int i = 0; i < module.getCodeSection().getCodesEntries().size(); i++) {
// FuncIdx funcIdx = new FuncIdx(i + module.getImportSection().getTotalFuncImports(), module);
//
// Function function = new Function(module, funcIdx);
// if (!function.getFuncType().equals(expectedType)) continue;
// if (!(function.getLocalsFloored().size() == 1 && function.getLocalsFloored().get(0) == ValType.I32)) continue;
// if (function.getCode().getInstructions().size() != expectedExpr.size()) continue;
//
// for (int j = 0; j < function.getCode().getInstructions().size(); j++) {
// Instr instr = function.getCode().getInstructions().get(j);
// if (instr.getInstrType() != expectedExpr.get(j)) continue outerloop;
// }
//
// return funcIdx;
// }
//
// return null;
// }
//
// private void copyEmptyHook(Module module, FuncIdx orgFuncIdx, String exportName, String hookname) throws InvalidOpCodeException, IOException {
// // copies the method, empties the first one
// // export the copy
// // hooks to the emptied one
//
// Func func = module.getCodeSection().getByIdx(orgFuncIdx);
// FuncType funcType = module.getTypeSection().getByFuncIdx(orgFuncIdx);
//
// // copy the function
// Function copy = new Function(funcType, func.getLocalss(), func.getExpression());
// FuncIdx copyIdx = copy.addToModule(module);
//
// module.getExportSection().getExports().add(new Export(exportName, new ExportDesc(copyIdx)));
//
//
// // clear & hook original function, let it return whatever JS returns
// Import imp = new Import(
// "env",
// hookname,
// new ImportDesc(module.getTypeSection().getTypeIdxForFuncType(new FuncType(
// funcType.getParameterType(),
// funcType.getResultType()
// )))
// );
// FuncIdx hookIdx = module.getImportSection().importFunction(imp);
//
// CallInstr call = new CallInstr(hookIdx);
// List<Instr> newInstrs = new ArrayList<>();
// for (int i = 0; i < funcType.getParameterType().typeList().size(); i++) {
// newInstrs.add(new LocalVariableInstr(InstrType.LOCAL_GET, new LocalIdx(i)));
// }
// newInstrs.add(call);
// func.setExpression(new Expression(newInstrs));
//
// }
//
// private void hook(Module module, FuncIdx funcIdx, String jsFunctionName) throws InvalidOpCodeException, IOException {
// FuncType funcType = module.getTypeSection().getByFuncIdx(funcIdx);
//
// Import imp = new Import(
// "env",
// jsFunctionName,
// new ImportDesc(module.getTypeSection().getTypeIdxForFuncType(new FuncType(
// funcType.getParameterType(),
// new ResultType(Collections.emptyList())
// )))
// );
// FuncIdx hookIdx = module.getImportSection().importFunction(imp);
//
// CallInstr call = new CallInstr(hookIdx);
//
// Func root = module.getCodeSection().getByIdx(funcIdx);
// List<Instr> newInstrs = new ArrayList<>();
// for (int i = 0; i < funcType.getParameterType().typeList().size(); i++) {
// newInstrs.add(new LocalVariableInstr(InstrType.LOCAL_GET, new LocalIdx(i)));
// }
// newInstrs.add(call);
// newInstrs.addAll(root.getExpression().getInstructions());
// root.getExpression().setInstructions(newInstrs);
// }
//
//}

View File

@ -2,6 +2,10 @@ package gearth.services.unity_tools.codepatcher;
import wasm.disassembly.instructions.Instr;
import wasm.disassembly.instructions.InstrType;
import wasm.disassembly.instructions.control.IfElseInstr;
import wasm.disassembly.instructions.memory.MemArg;
import wasm.disassembly.instructions.memory.MemInstr;
import wasm.disassembly.instructions.variable.LocalVariableInstr;
import wasm.disassembly.modules.sections.code.Func;
import wasm.disassembly.modules.sections.code.Locals;
import wasm.disassembly.types.FuncType;
@ -52,6 +56,9 @@ public class IncomingPacketPatcher implements StreamReplacement {
if (instr.getInstrType() != expectedExpr.get(j)) return false;
}
if (((MemInstr)(code.getExpression().getInstructions().get(5))).getMemArg().getAlign() != 2 ||
((MemInstr)(code.getExpression().getInstructions().get(5))).getMemArg().getOffset() != 32) return false;
return true;
}

View File

@ -2,6 +2,7 @@ package gearth.services.unity_tools.codepatcher;
import wasm.disassembly.instructions.Instr;
import wasm.disassembly.instructions.InstrType;
import wasm.disassembly.instructions.variable.LocalVariableInstr;
import wasm.disassembly.modules.sections.code.Func;
import wasm.disassembly.types.FuncType;
import wasm.disassembly.types.ResultType;
@ -45,6 +46,8 @@ public class OutgoingPacketPatcher implements StreamReplacement {
if (expression.get(4).getInstrType() != InstrType.I32_CONST) return false;
if (expression.get(5).getInstrType() != InstrType.CALL) return false;
if (((LocalVariableInstr)(expression.get(2))).getLocalIdx().getX() != 1) return false;
return true;
}
}

View File

@ -37,7 +37,7 @@ public class ReturnBytePatcher implements StreamReplacement {
@Override
public boolean codeMatches(Func code) {
if (code.getLocalss().size() != 0) return false;
if (code.getExpression().getInstructions().size() != 30) return false;
if (code.getExpression().getInstructions().size() != 26) return false;
List<Instr> expr = code.getExpression().getInstructions();
if (expr.get(expr.size() - 1).getInstrType() != InstrType.I32_XOR) return false;
return true;

View File

@ -2,6 +2,8 @@ package gearth.services.unity_tools.codepatcher;
import wasm.disassembly.instructions.Instr;
import wasm.disassembly.instructions.InstrType;
import wasm.disassembly.instructions.numeric.NumericI32ConstInstr;
import wasm.disassembly.instructions.variable.LocalVariableInstr;
import wasm.disassembly.modules.sections.code.Func;
import wasm.disassembly.modules.sections.code.Locals;
import wasm.disassembly.types.FuncType;
@ -40,18 +42,20 @@ public class SetKeyPatcher implements StreamReplacement {
public boolean codeMatches(Func code) {
if (!(code.getLocalss().equals(Collections.singletonList(new Locals(1, ValType.I32)))))
return false;
List<InstrType> expectedExpr = Arrays.asList(InstrType.I32_CONST, InstrType.I32_LOAD8_S,
InstrType.I32_EQZ, InstrType.IF, InstrType.BLOCK, InstrType.LOCAL_GET, InstrType.I32_CONST,
InstrType.LOCAL_GET, InstrType.I32_LOAD, InstrType.I32_CONST, InstrType.I32_CONST, InstrType.I32_CONST,
InstrType.CALL);
List<Instr> expression = code.getExpression().getInstructions();
List<InstrType> expectedExpr = Arrays.asList(InstrType.BLOCK, InstrType.LOCAL_GET,
InstrType.I32_CONST, InstrType.LOCAL_GET, InstrType.I32_LOAD, InstrType.I32_CONST, InstrType.I32_CONST,
InstrType.I32_CONST, InstrType.CALL );
if (code.getExpression().getInstructions().size() != expectedExpr.size()) return false;
if (expression.size() != expectedExpr.size()) return false;
for (int j = 0; j < code.getExpression().getInstructions().size(); j++) {
Instr instr = code.getExpression().getInstructions().get(j);
for (int j = 0; j < expression.size(); j++) {
Instr instr = expression.get(j);
if (instr.getInstrType() != expectedExpr.get(j)) return false;
}
// if (((NumericI32ConstInstr)(expression.get(5))).getConstValue() != 14) return false;
return true;
}
}

View File

@ -1,6 +1,6 @@
package gearth.ui;
import gearth.Main;
import gearth.GEarth;
import gearth.protocol.connection.proxy.ProxyProviderFactory;
import gearth.protocol.connection.proxy.SocksConfiguration;
import gearth.ui.logger.loggerdisplays.PacketLoggerFactory;
@ -8,10 +8,7 @@ import javafx.application.Platform;
import javafx.scene.control.*;
import javafx.scene.image.Image;
import javafx.scene.input.MouseEvent;
import javafx.scene.layout.FlowPane;
import javafx.scene.layout.Pane;
import javafx.scene.layout.Region;
import javafx.scene.web.WebView;
import javafx.stage.Stage;
import gearth.protocol.HConnection;
import gearth.ui.connection.ConnectionController;
@ -127,18 +124,18 @@ public class GEarthController {
}
public void setTheme(String theme) {
Main.theme = theme;
GEarth.theme = theme;
getStage().getScene().getStylesheets().clear();
getStage().getScene().getStylesheets().add(Main.class.getResource(String.format("/gearth/themes/%s/styling.css", theme)).toExternalForm());
getStage().getScene().getStylesheets().add(GEarth.class.getResource(String.format("/gearth/themes/%s/styling.css", theme)).toExternalForm());
getStage().getIcons().clear();
getStage().getIcons().add(new Image(Main.class.getResourceAsStream(String.format("/gearth/themes/%s/logoSmall.png", theme))));
getStage().getIcons().add(new Image(GEarth.class.getResourceAsStream(String.format("/gearth/themes/%s/logoSmall.png", theme))));
getStage().setTitle(theme.split("_")[0] + " " + Main.version);
getStage().setTitle(theme.split("_")[0] + " " + GEarth.version);
titleLabel.setText(getStage().getTitle());
infoController.img_logo.setImage(new Image(Main.class.getResourceAsStream(String.format("/gearth/themes/%s/logo.png", theme))));
infoController.img_logo.setImage(new Image(GEarth.class.getResourceAsStream(String.format("/gearth/themes/%s/logo.png", theme))));
infoController.version.setText(getStage().getTitle());
}
@ -173,7 +170,7 @@ public class GEarthController {
}
public void toggleTheme(MouseEvent event) {
int themeIndex = Arrays.asList(Main.themes).indexOf(Main.theme);
setTheme(Main.themes[(themeIndex + 1) % Main.themes.length]);
int themeIndex = Arrays.asList(GEarth.themes).indexOf(GEarth.theme);
setTheme(GEarth.themes[(themeIndex + 1) % GEarth.themes.length]);
}
}

View File

@ -1,6 +1,6 @@
package gearth.ui.connection;
import gearth.Main;
import gearth.GEarth;
import gearth.misc.Cacher;
import gearth.protocol.connection.HClient;
import gearth.protocol.connection.HState;
@ -221,12 +221,12 @@ public class ConnectionController extends SubForm {
}
private void maybeConnectOnInit() {
String connectMode = Main.getArgument("--connect", "-c");
String connectMode = GEarth.getArgument("--connect", "-c");
if (connectMode != null) {
if (connectMode.equals("flash")) {
Platform.runLater(() -> rd_flash.setSelected(true));
String host = Main.getArgument("--host");
String port = Main.getArgument("--port");
String host = GEarth.getArgument("--host");
String port = GEarth.getArgument("--port");
if (host != null && port != null) {
Platform.runLater(() -> {
if (!inpHost.getItems().contains(host)) inpHost.getItems().add(host);

View File

@ -1,6 +1,6 @@
package gearth.ui.extensions.logger;
import gearth.Main;
import gearth.GEarth;
import javafx.fxml.FXMLLoader;
import javafx.scene.Parent;
import javafx.scene.Scene;
@ -35,15 +35,15 @@ public class ExtensionLogger {
stage = new Stage();
stage.setTitle(String.format("%s | Extension Console", Main.theme));
stage.setTitle(String.format("%s | Extension Console", GEarth.theme));
stage.initModality(Modality.NONE);
stage.getIcons().add(new Image(getClass().getResourceAsStream(String.format("/gearth/themes/%s/logoSmall.png", Main.theme))));
stage.getIcons().add(new Image(getClass().getResourceAsStream(String.format("/gearth/themes/%s/logoSmall.png", GEarth.theme))));
stage.setAlwaysOnTop(true);
stage.setMinHeight(235);
stage.setMinWidth(370);
Scene scene = new Scene(root);
scene.getStylesheets().add(String.format("/gearth/themes/%s/styling.css", Main.theme));
scene.getStylesheets().add(String.format("/gearth/themes/%s/styling.css", GEarth.theme));
scene.getStylesheets().add("/gearth/ui/extensions/logger/logger.css");
ExtensionLoggerController controller = loader.getController();
controller.setStage(stage);

View File

@ -1,10 +1,8 @@
package gearth.ui.extra;
import gearth.Main;
import gearth.GEarth;
import gearth.misc.Cacher;
import gearth.protocol.HConnection;
import gearth.protocol.HMessage;
import gearth.protocol.TrafficListener;
import gearth.protocol.connection.HState;
import gearth.protocol.connection.proxy.ProxyProviderFactory;
import gearth.protocol.connection.proxy.SocksConfiguration;
@ -178,8 +176,8 @@ public class ExtraController extends SubForm implements SocksConfiguration {
Platform.runLater(() -> {
Alert alert = new Alert(Alert.AlertType.ERROR, "G-Python installation", ButtonType.OK);
Stage stage = (Stage) alert.getDialogPane().getScene().getWindow();
stage.getIcons().add(new Image(Main.class.getResourceAsStream(String.format("/gearth/themes/%s/logoSmall.png", Main.theme))));
stage.getScene().getStylesheets().add(Main.class.getResource(String.format("/gearth/themes/%s/styling.css", Main.theme)).toExternalForm());
stage.getIcons().add(new Image(GEarth.class.getResourceAsStream(String.format("/gearth/themes/%s/logoSmall.png", GEarth.theme))));
stage.getScene().getStylesheets().add(GEarth.class.getResource(String.format("/gearth/themes/%s/styling.css", GEarth.theme)).toExternalForm());
alert.setTitle("G-Python installation");
FlowPane fp = new FlowPane();
@ -188,7 +186,7 @@ public class ExtraController extends SubForm implements SocksConfiguration {
Hyperlink link = new Hyperlink(INFO_URL_GPYTHON);
fp.getChildren().addAll( lbl, link);
link.setOnAction(event -> {
Main.main.getHostServices().showDocument(link.getText());
GEarth.main.getHostServices().showDocument(link.getText());
event.consume();
});

View File

@ -1,6 +1,6 @@
package gearth.ui.info;
import gearth.Main;
import gearth.GEarth;
import javafx.event.ActionEvent;
import javafx.scene.control.*;
import gearth.ui.SubForm;
@ -15,12 +15,12 @@ import javafx.stage.Stage;
*/
public class InfoController extends SubForm {
public ImageView img_logo;
public Hyperlink link_ase;
public Hyperlink link_darkbox;
public Hyperlink link_d_harble;
public Hyperlink link_g_gearth;
public Hyperlink link_g_tanji;
public Hyperlink link_d_gearth;
public Hyperlink link_g_store;
public Hyperlink link_t_gearth;
public Label version;
@ -28,25 +28,25 @@ public class InfoController extends SubForm {
link.setOnAction((ActionEvent event) -> {
Hyperlink h = (Hyperlink) event.getTarget();
String s = h.getTooltip().getText();
Main.main.getHostServices().showDocument(s);
GEarth.main.getHostServices().showDocument(s);
event.consume();
});
}
public void initialize() {
link_ase.setTooltip(new Tooltip("https://allseeingeye.to"));
link_darkbox.setTooltip(new Tooltip("https://darkbox.nl"));
link_d_harble.setTooltip(new Tooltip("https://discord.gg/CzRuHvW"));
link_d_gearth.setTooltip(new Tooltip("https://discord.gg/AVkcF8y"));
link_g_gearth.setTooltip(new Tooltip("https://github.com/sirjonasxx/G-Earth"));
link_g_tanji.setTooltip(new Tooltip("https://github.com/ArachisH/Tanji"));
link_g_store.setTooltip(new Tooltip("https://github.com/sirjonasxx/G-ExtensionStore"));
link_t_gearth.setTooltip(new Tooltip("https://twitter.com/Scripting_Habbo"));
activateHyperlink(link_ase);
activateHyperlink(link_darkbox);
activateHyperlink(link_d_harble);
activateHyperlink(link_d_gearth);
activateHyperlink(link_g_gearth);
activateHyperlink(link_g_tanji);
activateHyperlink(link_g_store);
activateHyperlink(link_t_gearth);
}
public void donate(ActionEvent actionEvent) {

View File

@ -1,6 +1,6 @@
package gearth.ui.logger.loggerdisplays;
import gearth.Main;
import gearth.GEarth;
import gearth.extensions.InternalExtensionFormBuilder;
import gearth.misc.OSValidator;
import gearth.services.extension_handler.ExtensionHandler;
@ -17,7 +17,7 @@ public class PacketLoggerFactory implements ExtensionProducer {
private UiLogger uiLogger;
public static boolean usesUIlogger() {
return (!Main.hasFlag("-t"));
return (!GEarth.hasFlag("-t"));
}
public PacketLoggerFactory(ExtensionHandler handler) {

View File

@ -1,3 +0,0 @@
{
"theme": "Tanji"
}

View File

@ -0,0 +1,3 @@
{
"theme": "G-Earth"
}

View File

@ -36,7 +36,7 @@
<div class="quick_links_container">
<div class="quick_links_item"><b>Quick Links:</b></div>
<div class="quick_links_item"><a id="overview_by_date">New Releases</a></div>
<div class="quick_links_item"><a id="overview_by_update">Recent</a></div>
<div class="quick_links_item"><a id="overview_by_rating">Popular</a></div>
<div class="quick_links_item"><a id="overview_by_category">Categories</a></div>
<div class="quick_links_item"><a id="overview_installed">Installed</a></div>

View File

@ -20,6 +20,7 @@ let _gearth_incoming_copy;
let _malloc;
let _free;
let _module;
var packetBuff = {"out": [], "in": []};
@ -97,10 +98,10 @@ function inject_out(packet) {
let inject_amount = Math.min(_g_packet_split, packet.length - i);
let packet_location = _malloc(inject_amount + 16);
unityInstance.Module.HEAPU8.set(out_packet_objid, packet_location);
unityInstance.Module.HEAPU8.fill(0, packet_location + 4, packet_location + 12);
unityInstance.Module.HEAPU8.set(writeLittleEndian(inject_amount), packet_location + 12);
unityInstance.Module.HEAPU8.set(packet.slice(i, i + inject_amount), packet_location + 16);
_module.HEAPU8.set(out_packet_objid, packet_location);
_module.HEAPU8.fill(0, packet_location + 4, packet_location + 12);
_module.HEAPU8.set(writeLittleEndian(inject_amount), packet_location + 12);
_module.HEAPU8.set(packet.slice(i, i + inject_amount), packet_location + 16);
_gearth_outgoing_copy(out_send_param1, packet_location, out_send_param3);
_free(packet_location);
@ -128,8 +129,8 @@ function inject_in(packet) {
let inject_amount = Math.min(_g_packet_split, packet.length - i);
let packet_location = _malloc(inject_amount + 16);
unityInstance.Module.HEAPU8.set(in_packet_prefix, packet_location);
unityInstance.Module.HEAPU8.set(packet.slice(i, i + inject_amount), packet_location + 16);
_module.HEAPU8.set(in_packet_prefix, packet_location);
_module.HEAPU8.set(packet.slice(i, i + inject_amount), packet_location + 16);
_gearth_incoming_copy(in_recv_param1, packet_location, 0, inject_amount, 0);
_free(packet_location);

View File

@ -1,10 +1,10 @@
function g_outgoing_packet(param1, param2, param3) {
out_send_param1 = param1;
out_send_param3 = param3;
out_packet_objid = unityInstance.Module.HEAPU8.slice(param2, param2 + 4);
out_packet_objid = Module.HEAPU8.slice(param2, param2 + 4);
let length = readLittleEndian(unityInstance.Module.HEAPU8.subarray(param2 + 12, param2 + 12 + 4));
let array = [].slice.call(unityInstance.Module.HEAPU8.subarray(param2 + 12 + 4, param2 + 12 + 4 + length));
let length = readLittleEndian(Module.HEAPU8.subarray(param2 + 12, param2 + 12 + 4));
let array = [].slice.call(Module.HEAPU8.subarray(param2 + 12 + 4, param2 + 12 + 4 + length));
packetBuff["out"] = packetBuff["out"].concat(array);
@ -15,9 +15,9 @@ function g_outgoing_packet(param1, param2, param3) {
function g_incoming_packet(param1, param2, param3, param4, param5) {
in_recv_param1 = param1;
in_packet_prefix = unityInstance.Module.HEAPU8.slice(param2, param2 + 16);
in_packet_prefix = Module.HEAPU8.slice(param2, param2 + 16);
let buffer = unityInstance.Module.HEAPU8.slice(param2 + 16, param2 + 16 + param4);
let buffer = Module.HEAPU8.slice(param2 + 16, param2 + 16 + param4);
packetBuff["in"] = packetBuff["in"].concat([].slice.call(buffer));
let packets = collect_packets("in");

View File

@ -25,63 +25,68 @@
<Font size="14.0" />
</font>
</Label>
<Label layoutX="260.0" layoutY="94.0" text="Made by:" textFill="#000000b2">
<Label layoutX="260.0" layoutY="92.0" text="Created by:" textFill="#000000b2">
<font>
<Font name="System Bold" size="14.0" />
</font>
</Label>
<Label layoutX="260.0" layoutY="114.0" text="sirjonasxx" textFill="#000000b2">
<Label layoutX="344.0" layoutY="92.0" text="sirjonasxx" textFill="#000000b2">
<font>
<Font size="14.0" />
</font>
</Label>
<Label layoutX="363.0" layoutY="94.0" text="Contributors:" textFill="#000000b2">
<Label layoutX="260.0" layoutY="124.0" text="Contributors:" textFill="#000000b2">
<font>
<Font name="System Bold" size="14.0" />
</font>
</Label>
<Label layoutX="363.0" layoutY="114.0" text="XePeleato" textFill="#000000b2">
<Label layoutX="260.0" layoutY="144.0" text="XePeleato" textFill="#000000b2">
<font>
<Font size="14.0" />
</font>
</Label>
<Label layoutX="363.0" layoutY="134.0" text="Scott Stamp" textFill="#000000b2">
<Label layoutX="260.0" layoutY="164.0" text="Scott Stamp" textFill="#000000b2">
<font>
<Font size="14.0" />
</font>
</Label>
<Label layoutX="363.0" layoutY="154.0" text="LittleJ" textFill="#000000b2">
<Label layoutX="260.0" layoutY="184.0" text="LittleJ" textFill="#000000b2">
<font>
<Font size="14.0" />
</font>
</Label>
<Label layoutX="363.0" layoutY="174.0" text="ArachisH" textFill="#000000b2">
<Label layoutX="260.0" layoutY="204.0" text="ArachisH" textFill="#000000b2">
<font>
<Font size="14.0" />
</font>
</Label>
<Label layoutX="363.0" layoutY="194.0" text="BurakDev" textFill="#000000b2">
<Label layoutX="363.0" layoutY="144.0" text="BurakDev" textFill="#000000b2">
<font>
<Font size="14.0" />
</font>
</Label>
<Label layoutX="363.0" layoutY="214.0" text="Mikee#0055" textFill="#000000b2">
<Label layoutX="363.0" layoutY="164.0" text="Mikee#0055" textFill="#000000b2">
<font>
<Font size="14.0" />
</font>
</Label>
<Label layoutX="491.0" layoutY="94.0" text="Links:" textFill="#000000b2">
<Label layoutX="363.0" layoutY="184.0" text="WiredSpast" textFill="#000000b2">
<font>
<Font size="14.0" />
</font>
</Label>
<Label layoutX="491.0" layoutY="92.0" text="Links:" textFill="#000000b2">
<font>
<Font name="System Bold" size="14.0" />
</font>
</Label>
<Hyperlink fx:id="link_ase" layoutX="487.0" layoutY="114.0" text="AllSeeingEye" />
<Hyperlink fx:id="link_darkbox" layoutX="487.0" layoutY="134.0" text="Darkbox" />
<Hyperlink fx:id="link_d_gearth" layoutX="487.0" layoutY="194.0" text="Discord - G-Earth" />
<Hyperlink fx:id="link_d_harble" layoutX="487.0" layoutY="214.0" text="Discord - Harble" />
<Hyperlink fx:id="link_g_gearth" layoutX="487.0" layoutY="154.0" text="Github - G-Earth" />
<Hyperlink fx:id="link_g_tanji" layoutX="487.0" layoutY="174.0" text="Github - Tanji" />
<Hyperlink fx:id="link_darkbox" layoutX="487.0" layoutY="112.0" text="Darkbox" />
<Hyperlink fx:id="link_g_gearth" layoutX="487.0" layoutY="132.0" text="Github - G-Earth" />
<Hyperlink fx:id="link_g_tanji" layoutX="487.0" layoutY="152.0" text="Github - Tanji" />
<Hyperlink fx:id="link_d_gearth" layoutX="487.0" layoutY="172.0" text="Discord - G-Earth" />
<Hyperlink fx:id="link_g_store" layoutX="487.0" layoutY="212.0" text="G-ExtensionStore" />
<Button layoutX="537.0" layoutY="14.0" mnemonicParsing="false" onAction="#donate" prefHeight="20.0" prefWidth="100.0" text="Donate BTC" />
<Hyperlink fx:id="link_t_gearth" layoutX="487.0" layoutY="192.0" text="Twitter - G-Earth" />
<!--<Hyperlink fx:id="link_d_bonnie" layoutX="400.0" layoutY="221.0" text="Discord - BonnieScripting (pt/br)" />-->
</children>
</AnchorPane>

View File

@ -6,7 +6,7 @@ If you're using a mac; make sure you have completed the mac-installation wiki pa
## Problem 1: G-Earth doesn't open
* It's recommended to use Java 8, some problems have occurred with people using Java 11 or other versions. It shouldn't be hard to fix this with a simple google search.
* On Linux, if you get a "Invalid MIT-MAGIC-COOKIE-1" exception, execute "xhost +local:" in a terminal
* On Linux, if you get a "could not find or load main class gearth.Main", javafx might not be installed. Execute "apt install openjfx" to install javafx
* On Linux, if you get a "could not find or load main class gearth.GEarth", javafx might not be installed. Execute "apt install openjfx" to install javafx
* It will almost always be an issue with Java, so try reinstalling
## Problem 2: Stuck at 76% or 57%