Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master' 0.93
Browse files Browse the repository at this point in the history
# Conflicts:
#	.gitignore
#	src/rotp/Rotp.java
#	src/rotp/model/empires/Empire.java
#	src/rotp/ui/main/GalaxyMapPanel.java
  • Loading branch information
coder111111 committed Jun 7, 2021
2 parents 31c3f93 + 54230ee commit 005f8eb
Show file tree
Hide file tree
Showing 369 changed files with 13,329 additions and 1,991 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ test
build
build.xml
manifest.mf
launch4j/Remnants/
target/
.idea/
*.iml
34 changes: 34 additions & 0 deletions launch4j/launch4j.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<?xml version="1.0" encoding="UTF-8"?>
<launch4jConfig>
<dontWrapJar>false</dontWrapJar>
<headerType>gui</headerType>
<jar>C:\Users\RayGame\Documents\NB\Remnants\dist\Remnants.jar</jar>
<outfile>C:\Users\RayGame\Documents\NB\Remnants\launch4j\Remnants\Remnants.exe</outfile>
<errTitle></errTitle>
<cmdLine></cmdLine>
<chdir>.</chdir>
<priority>normal</priority>
<downloadUrl>http://java.com/download</downloadUrl>
<supportUrl></supportUrl>
<stayAlive>false</stayAlive>
<restartOnCrash>false</restartOnCrash>
<manifest></manifest>
<icon>C:\Users\RayGame\Documents\NB\Remnants\launch4j\rotp.ico</icon>
<jre>
<path>jre</path>
<bundledJre64Bit>true</bundledJre64Bit>
<bundledJreAsFallback>false</bundledJreAsFallback>
<minVersion></minVersion>
<maxVersion></maxVersion>
<jdkPreference>preferJre</jdkPreference>
<runtimeBits>64</runtimeBits>
<initialHeapSize>2000</initialHeapSize>
<maxHeapSize>3500</maxHeapSize>
</jre>
<splash>
<file>C:\Users\RayGame\Documents\NB\Remnants\launch4j\rotp_splash.bmp</file>
<waitForWindow>false</waitForWindow>
<timeout>15</timeout>
<timeoutErr>false</timeoutErr>
</splash>
</launch4jConfig>
Binary file added launch4j/rotp.ico
Binary file not shown.
Binary file added launch4j/rotp_splash.bmp
Binary file not shown.
55 changes: 54 additions & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>com.rayfowler</groupId>

<version>3.92.1</version>
<version>3.93.1</version>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<java.version>8</java.version>
Expand Down Expand Up @@ -266,6 +266,59 @@
</execution>
</executions>
</plugin>
<plugin>
<groupId>com.akathist.maven.plugins.launch4j</groupId>
<artifactId>launch4j-maven-plugin</artifactId>
<executions>
<execution>
<!-- disabled for now. For this to work, we need to download and package a JRE, and I don't want to go through the hassle yet.
<phase>package</phase>
<goals>
<goal>launch4j</goal>
</goals>
-->
<configuration>
<icon>launch4j/rotp.ico</icon>
<splash>
<file>launch4j/rotp_splash.bmp</file>
<waitForWindow>false</waitForWindow>
<timeout>15</timeout>
<timeoutErr>false</timeoutErr>
</splash>
<headerType>gui</headerType>
<outfile>target/rotp-${project.version}.exe</outfile>
<jar>target/rotp-${project.version}-mini.jar</jar>
<errTitle>ROTP</errTitle>
<classPath>
<mainClass>rotp.RotpGovernor</mainClass>
<addDependencies>false</addDependencies>
<preCp>anything</preCp>
</classPath>
<jre>
<path>jre</path>
<minVersion>11</minVersion>
<bundledJre64Bit>true</bundledJre64Bit>
<bundledJreAsFallback>false</bundledJreAsFallback>
<runtimeBits>64</runtimeBits>
<jdkPreference>preferJre</jdkPreference>
<initialHeapSize>2000</initialHeapSize>
<maxHeapSize>3500</maxHeapSize>
</jre>
<versionInfo>
<fileVersion>${project.version}.1</fileVersion>
<txtFileVersion>${project.version}</txtFileVersion>
<fileDescription>Remnants of the Precursors</fileDescription>
<copyright>Copyright Ray Fowler</copyright>
<productVersion>${project.version}.1</productVersion>
<txtProductVersion>${project.version}</txtProductVersion>
<productName>Remnants of the Precursors</productName>
<internalName>rotp</internalName>
<originalFilename>rotp-${project.version}.exe</originalFilename>
</versionInfo>
</configuration>
</execution>
</executions>
</plugin>
<!-- runs with github-release:github-release -->
<plugin>
<groupId>com.ragedunicorn.tools.maven</groupId>
Expand Down
33 changes: 22 additions & 11 deletions src/rotp/Rotp.java
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,11 @@ public class Rotp {
public static int IMG_W = 1229;
public static int IMG_H = 768;
public static String jarFileName = "rotp-"+RotpGovernor.governorVersion()+RotpGovernor.miniSuffix()+".jar";
public static String exeFileName = "Remnants.exe";
public static boolean countWords = false;
private static String jarPath;
private static String startupDir;
private static JFrame frame;
public static String releaseId = "0.92";
public static String releaseId = "0.93";
public static long startMs = System.currentTimeMillis();
public static long maxHeapMemory = Runtime.getRuntime().maxMemory() / 1048576;
public static long maxUsedMemory;
Expand All @@ -59,11 +60,17 @@ public class Rotp {
static GraphicsDevice device = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice();
public static void main(String[] args) {
frame = new JFrame("Remnants of the Precursors");
String loadSaveFile = "";
if (args.length == 0) {
if (restartWithMoreMemory(frame, false))
return;
logging = false;
}
else {
if (args[0].toLowerCase().endsWith(".rotp"))
loadSaveFile = args[0];
}

reloadRecentSave = containsArg(args, "reload");
logging = containsArg(args, "log");
stopIfInsufficientMemory(frame, (int)maxHeapMemory);
Expand Down Expand Up @@ -101,16 +108,18 @@ else if (UserPreferences.borderless()) {
setFrameSize();
}

if (reloadRecentSave)
GameSession.instance().loadRecentSession(false);

// this will not catch 32-bit JREs on all platforms, but better than nothing
String bits = System.getProperty("sun.arch.data.model").trim();
if (bits.equals("32"))
RotPUI.instance().mainUI().showJava32BitPrompt();
else if (reloadRecentSave)
GameSession.instance().loadRecentSession(false);
else if (!loadSaveFile.isEmpty())
GameSession.instance().loadSession("", loadSaveFile, false);

frame.setVisible(true);
becomeVisible();
}
public static void becomeVisible() { frame.setVisible(true); }
public static BufferedImage toBufferedImage(Image img)
{
if (img instanceof BufferedImage)
Expand Down Expand Up @@ -169,16 +178,16 @@ public static float resizeAmt() {
return resizeAmt;
}
public static String jarPath() {
if (jarPath == null) {
if (startupDir == null) {
try {
File jarFile = new File(Rotp.class.getProtectionDomain().getCodeSource().getLocation().toURI().getPath());
jarPath = jarFile.getParentFile().getPath();
startupDir = jarFile.getParentFile().getPath();
} catch (URISyntaxException ex) {
System.out.println("Unable to resolve jar path: "+ex.toString());
jarPath = ".";
startupDir = ".";
}
}
return jarPath;
return startupDir;
}
private static void stopIfInsufficientMemory(JFrame frame, int allocMb) {
if (allocMb < 260) {
Expand All @@ -194,7 +203,9 @@ public static boolean memoryLow() {
return (max == total) && (free < 300);
}
public static void restart() {
String execStr = actualAlloc < 0 ? "java -jar "+jarFileName : "java -Xmx"+actualAlloc+"m -jar "+jarFileName+" arg1";
File exeFile = new File(startupDir+"/"+exeFileName);
String execStr = exeFile.exists() ? exeFileName : actualAlloc < 0 ? "java -jar "+jarFileName : "java -Xmx"+actualAlloc+"m -jar "+jarFileName+" arg1";

try {
Runtime.getRuntime().exec(execStr);
System.exit(0);
Expand Down
2 changes: 1 addition & 1 deletion src/rotp/RotpGovernor.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
* to get more memory it uses the right jar file name.
*/
public class RotpGovernor {
static String expectedROTPVersion = "0.92";
static String expectedROTPVersion = "0.93";
public static boolean GRAALVM_NATIVE = System.getProperty("org.graalvm.nativeimage.imagecode") != null;

private static String governorVersion = null;
Expand Down

0 comments on commit 005f8eb

Please sign in to comment.