diff --git a/.gitignore b/.gitignore
index d39e785..d6e5bb5 100644
--- a/.gitignore
+++ b/.gitignore
@@ -3,5 +3,5 @@
out/
META-INF/
target/
-gui/target/
-patcher/target/
\ No newline at end of file
+*/target/
+dist/src/main/resources/jre.zip
\ No newline at end of file
diff --git a/README.md b/README.md
index ab8f530..90ee6dd 100644
--- a/README.md
+++ b/README.md
@@ -13,22 +13,46 @@ Open ``gui/src/main/resources/arma3launcher.json`` and edit the variables as you
To configure your logo replace the _logo\*_ files inside the ``gui/src/main/resources/icons/`` folder.
### Build
-To build this project simply run
+To build this project you need JDK12+ and maven.
+To compile a single module run
+```bash
+mvn package -pl {gui/patcher}
+```
+
+To compile the project for distribution you a bundled JRE in ``dist/src/main/resources/jre.zip``.
+A bundled JRE should be an OpenJDK with the following folder structure:
+
+```
+jre.zip
+└── jre
+ ├── bin
+ ├── conf
+ ├── include
+ ├── jmods
+ ├── legal
+ ├── lib
+ └── release
+```
+
+After that run
```bash
mvn package
```
-After building the package you find the universal auto patcher inside ``patcher/target/patcher.jar``.
-Inside ``gui/target/`` you find the gui as jar, jar with dependencies, jar wrapper build with launch4j and an assembled zip file.
+After building the project for distribution you find the universal auto patcher inside ``patcher/target/patcher.jar``.
+Inside ``gui/target/`` you find the gui as jar and jar with dependencies.
+The jar wrapper build with packr can be found as an assembled zip file
+inside the ``dis/target/`` folder.
### Distribute
-After building the package you find inside the ``gui/target/`` folder an zip file.
-This zip file contains an empty ``jre/`` and an empty ``logs/`` folder.
-Bundle your own JRE with minimum JRE12 and put it in the ``*.zip/jre/``.
-The ``jre/`` folder should then contain ``{bin,conf,lib}/``.
+After building the package you find inside the ``dist/target/`` folder an zip file.
+This zip file contains the bundled ``jre/`` folder and an empty ``logs/`` folder.
+
+**Please note that the .exe does not have an icon!!**
+I tried [*rcedit*](https://github.com/electron/rcedit) to edit the resource icon in assembly but many anti virus scanner flag the wrapper than an false positive!
Linux/Mac users can run the *arma3launcher-gui.jar*.
-Windows users can simply run the *arma3launcher.exe* and the launch4j wrapper prioritize the local JRE else use the bundled jre.
+Windows users can simply run the *arma3launcher.exe* and the packr wrapper prioritize the local JRE else use the bundled jre.
### Server side setup
For the server side you need a simple webserver with no special configuration.
diff --git a/dist/packr.jar b/dist/packr.jar
new file mode 100644
index 0000000..103041d
Binary files /dev/null and b/dist/packr.jar differ
diff --git a/dist/pom.xml b/dist/pom.xml
new file mode 100644
index 0000000..a9e0c0c
--- /dev/null
+++ b/dist/pom.xml
@@ -0,0 +1,88 @@
+
+
+
+ arma3launcher
+ de.mc8051
+ 1.0-SNAPSHOT
+
+ 4.0.0
+
+ dist
+
+
+
+
+ maven-jar-plugin
+ 3.2.0
+
+
+ default-jar
+ none
+
+ unwanted
+ unwanted
+
+
+
+
+
+ org.codehaus.mojo
+ exec-maven-plugin
+ 1.6.0
+
+
+ make-exe
+ prepare-package
+
+ exec
+
+
+
+ java
+ target/packr-exec.log
+ ./
+
+ -jar
+ packr.jar
+ --platform
+ windows64
+ --jdk
+ src/main/resources/jre.zip
+ --executable
+ ${project.parent.artifactId}
+ --output
+ target/launcher/
+ --mainclass
+ ${project.parent.groupId}.${project.parent.artifactId}.ArmA3Launcher
+ --classpath
+ ${project.parent.artifactId}-gui.jar
+
+
+
+
+
+
+ maven-assembly-plugin
+ 3.2.0
+
+
+ dist
+ package
+
+ single
+
+
+ ${project.parent.artifactId}
+ false
+
+ src/main/zip.xml
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/gui/src/main/resources/icons/logo.ico b/dist/src/main/resources/logo.ico
similarity index 100%
rename from gui/src/main/resources/icons/logo.ico
rename to dist/src/main/resources/logo.ico
diff --git a/dist/src/main/zip.xml b/dist/src/main/zip.xml
new file mode 100644
index 0000000..9a3a37a
--- /dev/null
+++ b/dist/src/main/zip.xml
@@ -0,0 +1,51 @@
+
+
+
+ distribution
+
+ zip
+
+
+ true
+ ./
+
+
+
+
+ ${project.parent.artifactId}-gui.jar
+ ./
+
+
+
+
+
+ ./
+ logs
+
+ */**
+
+
+
+ target/launcher/
+ ./
+
+
+
+
\ No newline at end of file
diff --git a/gui/launcher.exe.manifest b/gui/launcher.exe.manifest
deleted file mode 100644
index 026f926..0000000
--- a/gui/launcher.exe.manifest
+++ /dev/null
@@ -1,12 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/gui/pom.xml b/gui/pom.xml
index 0d0c903..402297b 100644
--- a/gui/pom.xml
+++ b/gui/pom.xml
@@ -10,8 +10,14 @@
1.0-SNAPSHOT
+
+
+ jitpack.io
+ https://jitpack.io
+
+
+
gui
- 0.1.1001
@@ -29,11 +35,6 @@
flatlaf0.28
-
- com.github.RalleYTN
- SimpleRegistry
- java8-7949ac7f06-1
- org.ini4jini4j
@@ -102,7 +103,7 @@
package
- ${parent.artifactId}-${project.artifactId}-${project.version}
+ ${project.parent.artifactId}-${project.artifactId}-${gui.version}false
@@ -111,69 +112,11 @@
- ${project.groupId}.${parent.artifactId}.ArmA3Launcher
+ ${project.parent.groupId}.${project.parent.artifactId}.ArmA3Launcher
-
- dist
- package
-
- single
-
-
- ${parent.artifactId}-${project.version}
- false
-
- zip.xml
-
-
-
-
-
-
- com.akathist.maven.plugins.launch4j
- launch4j-maven-plugin
- 1.7.25
-
-
- l4j-gui
- prepare-package
-
- launch4j
-
-
- true
- gui
- target/${parent.artifactId}.exe
- ${parent.artifactId}-${project.artifactId}.jar
-
- jre/
- true
- true
- 12
- preferJre
- 64/32
-
- src/main/resources/icons/logo.ico
- launcher.exe.manifest
-
- 1.0.0.0
- 1.0.0.0
- Launcher
- mc8051
- 1.0.0.0
- 1.0.0.0
- Launcher
-
- ${parent.artifactId}
- ${parent.artifactId}.exe
-
- ENGLISH_US
-
-
-
diff --git a/gui/src/main/java/de/mc8051/arma3launcher/WinRegistry.java b/gui/src/main/java/de/mc8051/arma3launcher/WinRegistry.java
new file mode 100644
index 0000000..58eb782
--- /dev/null
+++ b/gui/src/main/java/de/mc8051/arma3launcher/WinRegistry.java
@@ -0,0 +1,28 @@
+package de.mc8051.arma3launcher;
+
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStreamReader;
+
+public class WinRegistry {
+
+ public static String getValue(String keyPath, String keyName) throws IOException, InterruptedException {
+ Process keyReader = Runtime.getRuntime().exec(
+ "reg query \"" + keyPath + "\" /v \"" + keyName + "\"");
+
+ BufferedReader outputReader;
+ String readLine;
+ StringBuffer outputBuffer = new StringBuffer();
+
+ outputReader = new BufferedReader(new InputStreamReader(
+ keyReader.getInputStream()));
+
+ while ((readLine = outputReader.readLine()) != null) {
+ outputBuffer.append(readLine);
+ }
+
+ String[] outputComponents = outputBuffer.toString().split(" ");
+ keyReader.waitFor();
+ return outputComponents[outputComponents.length - 1];
+ }
+}
\ No newline at end of file
diff --git a/gui/src/main/java/de/mc8051/arma3launcher/steam/SteamTimer.java b/gui/src/main/java/de/mc8051/arma3launcher/steam/SteamTimer.java
index 9f670c5..16cdf2a 100644
--- a/gui/src/main/java/de/mc8051/arma3launcher/steam/SteamTimer.java
+++ b/gui/src/main/java/de/mc8051/arma3launcher/steam/SteamTimer.java
@@ -1,9 +1,8 @@
package de.mc8051.arma3launcher.steam;
-import de.mc8051.arma3launcher.utils.SteamUtils;
+import de.mc8051.arma3launcher.WinRegistry;
import de.mc8051.arma3launcher.interfaces.Observer;
-import de.ralleytn.simple.registry.Key;
-import de.ralleytn.simple.registry.Registry;
+import de.mc8051.arma3launcher.utils.SteamUtils;
import java.io.IOException;
import java.util.ArrayList;
@@ -17,31 +16,32 @@ import java.util.logging.Logger;
public class SteamTimer extends TimerTask {
private static ArrayList observers = new ArrayList<>();
+ private static boolean old_steamrunning = false;
public static boolean steam_running = false;
+ private static boolean old_arma_running = false;
public static boolean arma_running = false;
+ public static boolean firstRun = false;
@Override
public void run() {
String OS = System.getProperty("os.name").toUpperCase();
if (!OS.contains("WIN")) return;
- boolean old_steamrunning = steam_running;
- boolean old_arma_running = arma_running;
+ old_steamrunning = steam_running;
+ old_arma_running = arma_running;
try {
- if(!SteamUtils.findProcess("steam.exe")) {
+ if (!SteamUtils.findProcess("steam.exe")) {
steam_running = false;
- if(old_steamrunning != steam_running) notifyObservers("steamtimer");
+ notifyObservers("steamtimer");
return;
}
- Key activeSteamUserKey = Registry.getKey(Registry.HKEY_CURRENT_USER + "\\Software\\Valve\\Steam\\ActiveProcess");
- String activeSteamUser = activeSteamUserKey.getValueByName("ActiveUser").getRawValue();
-
- if(activeSteamUser.equals("0x0")) {
+ String activeSteamUser = WinRegistry.getValue("HKEY_CURRENT_USER\\Software\\Valve\\Steam\\ActiveProcess", "ActiveUser");
+ if (activeSteamUser.equals("0x0")) {
steam_running = false;
- if(old_steamrunning != steam_running) notifyObservers("steamtimer");
+ notifyObservers("steamtimer");
return;
}
@@ -52,8 +52,8 @@ public class SteamTimer extends TimerTask {
|| SteamUtils.findProcess("arma3battleye.exe")
|| SteamUtils.findProcess("arma3launcher.exe");
- if(old_steamrunning != steam_running || old_arma_running != arma_running) notifyObservers("steamtimer");
- } catch (IOException e) {
+ notifyObservers("steamtimer");
+ } catch (IOException | InterruptedException e) {
steam_running = false;
arma_running = false;
notifyObservers("steamtimer");
@@ -66,6 +66,9 @@ public class SteamTimer extends TimerTask {
}
public void notifyObservers(String obj) {
- for(Observer o : observers) o.update(obj);
+ if (old_arma_running != arma_running || old_steamrunning != steam_running || !firstRun) {
+ for (Observer o : observers) o.update(obj);
+ firstRun = true;
+ }
}
}
diff --git a/gui/src/main/java/de/mc8051/arma3launcher/utils/ArmaUtils.java b/gui/src/main/java/de/mc8051/arma3launcher/utils/ArmaUtils.java
index 8ae53cf..a1b2683 100644
--- a/gui/src/main/java/de/mc8051/arma3launcher/utils/ArmaUtils.java
+++ b/gui/src/main/java/de/mc8051/arma3launcher/utils/ArmaUtils.java
@@ -2,12 +2,12 @@ package de.mc8051.arma3launcher.utils;
import de.mc8051.arma3launcher.Parameter;
import de.mc8051.arma3launcher.Parameters;
+import de.mc8051.arma3launcher.WinRegistry;
import de.mc8051.arma3launcher.objects.Modset;
-import de.ralleytn.simple.registry.Key;
-import de.ralleytn.simple.registry.Registry;
import java.io.File;
import java.io.IOException;
+import java.lang.reflect.InvocationTargetException;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.ArrayList;
@@ -23,19 +23,19 @@ import java.util.stream.Collectors;
public class ArmaUtils {
public static Path getInstallationPath() {
- Key regKey = null;
+ String regKey = null;
try {
- regKey = Registry.getKey(Registry.HKEY_LOCAL_MASHINE + "\\SOFTWARE\\bohemia interactive\\arma 3");
- } catch (IOException ignored) {
+ regKey = WinRegistry.getValue("HKEY_LOCAL_MACHINE\\SOFTWARE\\bohemia interactive\\arma 3", "main");
+ } catch (IOException | InterruptedException ignored) {
try {
- regKey = Registry.getKey("HKEY_LOCAL_MACHINE\\SOFTWARE\\WOW6432Node\\bohemia interactive\\arma 3");
- } catch (IOException e) {
+ regKey = WinRegistry.getValue("HKEY_LOCAL_MACHINE\\SOFTWARE\\WOW6432Node\\bohemia interactive\\arma 3", "main");
+ } catch (IOException | InterruptedException e) {
Logger.getLogger(ArmaUtils.class.getName()).log(Level.INFO, "Arma patch cant be detected automatically");
}
}
if (regKey == null) return null;
- final Path main = Paths.get(regKey.getValueByName("main").getRawValue());
+ final Path main = Paths.get(regKey);
if (!checkArmaPath(main)) return null;
return main;
}
diff --git a/gui/src/main/resources/disclaimer.html b/gui/src/main/resources/disclaimer.html
index 434e86c..3b99bcb 100644
--- a/gui/src/main/resources/disclaimer.html
+++ b/gui/src/main/resources/disclaimer.html
@@ -91,32 +91,6 @@ nicht jeder Fehler unsererseits behoben werden kann.
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
com.github.RalleYTN.SimpleRegistry
-https://github.com/RalleYTN/SimpleRegistry
-
- MIT License
-
- Copyright (c) 2017 Ralph Niemitz
-
- Permission is hereby granted, free of charge, to any person obtaining a copy
- of this software and associated documentation files (the "Software"), to deal
- in the Software without restriction, including without limitation the rights
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- copies of the Software, and to permit persons to whom the Software is
- furnished to do so, subject to the following conditions:
-
- The above copyright notice and this permission notice shall be included in all
- copies or substantial portions of the Software.
-
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- SOFTWARE.
-
-
com.typesafe.config
https://github.com/lightbend/config
diff --git a/gui/src/main/resources/project.properties b/gui/src/main/resources/project.properties
index a2273e2..a880c1e 100644
--- a/gui/src/main/resources/project.properties
+++ b/gui/src/main/resources/project.properties
@@ -1,2 +1,2 @@
-version=${project.version}
-artifactId=${project.artifactId}
\ No newline at end of file
+version=${gui.version}
+artifactId=${project.parent.artifactId}
\ No newline at end of file
diff --git a/gui/zip.xml b/gui/zip.xml
deleted file mode 100644
index 456f26e..0000000
--- a/gui/zip.xml
+++ /dev/null
@@ -1,41 +0,0 @@
-
- distribution
-
- zip
-
-
- true
- ./
-
-
-
-
- ${parent.artifactId}-${project.artifactId}.jar
- ./
-
-
-
- ./
-
-
-
-
-
- ./
- logs
-
- */**
-
-
-
- ./
- jre
-
- */**
-
-
-
-
-
\ No newline at end of file
diff --git a/patcher/pom.xml b/patcher/pom.xml
index bbec26c..f6025eb 100644
--- a/patcher/pom.xml
+++ b/patcher/pom.xml
@@ -58,7 +58,7 @@
- ${project.groupId}.${parent.artifactId}.Arma3LauncherPatcher
+ ${project.parent.groupId}.${project.parent.artifactId}.Arma3LauncherPatcher
diff --git a/pom.xml b/pom.xml
index ca3f13e..879641a 100644
--- a/pom.xml
+++ b/pom.xml
@@ -4,20 +4,18 @@
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
4.0.0
+
+ 0.1.1002
+
+
de.mc8051arma3launcher1.0-SNAPSHOTpom
-
-
- jitpack.io
- https://jitpack.io
-
-
-
guipatcher
+ dist
\ No newline at end of file