Skip to content

Commit

Permalink
SCRIPTS 简化patch文件
Browse files Browse the repository at this point in the history
  • Loading branch information
way-zer committed Jul 18, 2024
1 parent 61637a1 commit e859bec
Show file tree
Hide file tree
Showing 83 changed files with 1,212 additions and 6,497 deletions.
489 changes: 91 additions & 398 deletions patches/client/0001-BUILD-build.gradle.kts-and-clear.patch

Large diffs are not rendered by default.

116 changes: 16 additions & 100 deletions patches/client/0003-CS-Version.patch
Original file line number Diff line number Diff line change
Expand Up @@ -21,142 +21,75 @@ diff --git a/.gitignore b/.gitignore
index 7d91d3191096c431b739d2d5ecd951a764feead3..ba271e6bd0dd06971fff6fa2314254149cc90087 100644
--- a/.gitignore
+++ b/.gitignore
@@ -4,6 +4,7 @@ logs/
/core/assets/mindustry-maps/
/core/assets/bundles/output/
/core/assets/.gifimages/
@@ -6,0 +7 @@ logs/
+/core/assets/MindustryX.hjson
/deploy/
/out/
ios/libs/
diff --git a/android/AndroidManifest.xml b/android/AndroidManifest.xml
index 8cae20eee7a480cef6a14576fc72b096d38271e1..25602c4ab4070b7db9b31803c88281c7e4aa449e 100644
--- a/android/AndroidManifest.xml
+++ b/android/AndroidManifest.xml
@@ -1,6 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
@@ -2,2 +2 @@
-<manifest xmlns:android="http://schemas.android.com/apk/res/android"
- package="io.anuke.mindustry">
+<manifest xmlns:android="http://schemas.android.com/apk/res/android">

<uses-feature android:glEsVersion="0x00020000" android:required="true"/>
<uses-feature android:name="android.hardware.type.pc" android:required="false" />
diff --git a/android/build.gradle b/android/build.gradle
index 8b9676e3f124728d59ee80367d14f433853c0c40..c39484bf6b00b8031b7ae8862cc172f8946f12cc 100644
--- a/android/build.gradle
+++ b/android/build.gradle
@@ -18,7 +18,7 @@ configurations{ natives }

repositories{
mavenCentral()
@@ -21 +21 @@ repositories{
- maven{ url "https://maven.google.com" }
+ maven{ url "https://dl.google.com/dl/android/maven2/" }
}

android{
@@ -46,7 +46,7 @@ android{
defaultConfig{
def versionNameResult = "$versionNumber-$versionType-${getBuildVersion().replace(" ", "-")}"

@@ -49 +49 @@ android{
- applicationId "io.anuke.mindustry"
+ applicationId "com.github.tinylake.mindustryX"
minSdkVersion 14
targetSdkVersion 33

diff --git a/android/res/values/strings.xml b/android/res/values/strings.xml
index d42ffe6d4a318ce558f1010eae46140f88ed5c99..bf44ead5c58abfb79c500e6daae30c3e7c322bed 100644
--- a/android/res/values/strings.xml
+++ b/android/res/values/strings.xml
@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
@@ -3 +3 @@
- <string name="app_name">Mindustry</string>
+ <string name="app_name">MindustryX</string>
</resources>
diff --git a/build.gradle b/build.gradle
index 0cb5c6337c2d6a41243907d2c34c679b63112d61..fb6808e41d2fbff78c81f3904d01eb4e8e413492 100644
--- a/build.gradle
+++ b/build.gradle
@@ -21,12 +21,12 @@ allprojects{
apply plugin: 'maven-publish'

version = project.hasProperty("packageVersion") ? project.getProperty("packageVersion") : 'release'
@@ -24 +24 @@ allprojects{
- group = 'com.github.Anuken'
+ group = 'cf.wayzer.MindustryX'

ext{
versionNumber = '7'
if(!project.hasProperty("versionModifier")) versionModifier = 'release'
@@ -29 +29 @@ allprojects{
- if(!project.hasProperty("versionType")) versionType = 'official'
+ if(!project.hasProperty("versionType")) versionType = 'MindustryX'
appName = 'Mindustry'
steamworksVersion = '0b86023401880bb5e586bc404bedbaae9b1f1c94'
rhinoVersion = '73a812444ac388ac2d94013b5cadc8f70b7ea027'
diff --git a/core/build.gradle.kts b/core/build.gradle.kts
index e2a6d4ede97677940bc6b73de42f6f5ff71fc0be..9d9d170c1fb00fbd4bf35c1a2f04bcff6dca09cf 100644
--- a/core/build.gradle.kts
+++ b/core/build.gradle.kts
@@ -46,7 +46,7 @@ tasks{
property("type", findProperty("versionType") ?: "official")
property("modifier", findProperty("versionModifier") ?: "release")
property("number", '7')
@@ -49 +49 @@ tasks{
- property("build", findProperty("buildversion") ?: "custom build")
+ property("build", findProperty("upstreamBuild") ?: "custom build")
}
processResources.configure {
dependsOn(generateLocales, generateBasePartNames, writeVersion)
diff --git a/core/src/mindustry/Vars.java b/core/src/mindustry/Vars.java
index bc4c6a494aec88af73f001906598ba91a50ac6a3..d08d04a6f0e8107cec995876b2072c46aa85b3c2 100644
--- a/core/src/mindustry/Vars.java
+++ b/core/src/mindustry/Vars.java
@@ -77,7 +77,7 @@ public class Vars implements Loadable{
//TODO merge with v6 list upon release
public static final String serverJsonURL = "https://raw.githubusercontent.com/Anuken/Mindustry/master/servers_v7.json";
/** URL of the github issue report template.*/
@@ -80 +80 @@ public class Vars implements Loadable{
- public static final String reportIssueURL = "https://github.com/Anuken/Mindustry/issues/new?labels=bug&template=bug_report.md";
+ public static final String reportIssueURL = "https://github.com/TinyLake/MindustryX/issues/new?labels=bug&template=bug_report.md";
/** list of built-in servers.*/
public static final Seq<ServerGroup> defaultServers = Seq.with();
/** maximum size of any block, do not change unless you know what you're doing */
diff --git a/core/src/mindustry/core/NetClient.java b/core/src/mindustry/core/NetClient.java
index 8171a89797a0d1cb29fb50364a94b6d3130698ae..6b05845bad6eb3862dea511563e099085d15b479 100644
--- a/core/src/mindustry/core/NetClient.java
+++ b/core/src/mindustry/core/NetClient.java
@@ -135,6 +135,8 @@ public class NetClient implements ApplicationListener{
Log.info("Received world data: @ bytes.", data.stream.available());
NetworkIO.loadWorld(new InflaterInputStream(data.stream));

@@ -137,0 +138,2 @@ public class NetClient implements ApplicationListener{
+ Call.serverPacketReliable("ARC", Version.mdtXBuild);
+ Call.serverPacketReliable("MDTX", Version.mdtXBuild);
finishConnecting();
});
}
diff --git a/core/src/mindustry/core/Version.java b/core/src/mindustry/core/Version.java
index 73bbd59416cc8e1b64bcb5538fdd73886a455451..8698103654e40dd4e85451e1020563ca562ed2d2 100644
--- a/core/src/mindustry/core/Version.java
+++ b/core/src/mindustry/core/Version.java
@@ -6,6 +6,8 @@ import arc.files.*;
import arc.struct.*;
import arc.util.*;
import arc.util.io.*;
@@ -8,0 +9,2 @@ import arc.util.io.*;
+import arc.util.serialization.*;
+import mindustryX.*;

public class Version{
/** Build type. 'official' for official releases; 'custom' or 'bleeding edge' are also used. */
@@ -20,6 +22,8 @@ public class Version{
public static int revision = 0;
/** Whether version loading is enabled. */
public static boolean enabled = true;
@@ -22,0 +25,2 @@ public class Version{
+ @MindustryXApi
+ public static String mdtXBuild;

public static void init(){
if(!enabled) return;
@@ -44,6 +48,15 @@ public class Version{
}else{
build = Strings.canParseInt(map.get("build")) ? Integer.parseInt(map.get("build")) : -1;
}
@@ -46,0 +51,9 @@ public class Version{
+ //MDTX: mdtXBuild
+ if(Core.files == null) return;
+ try{
Expand All @@ -166,39 +99,22 @@ index 73bbd59416cc8e1b64bcb5538fdd73886a455451..8698103654e40dd4e85451e1020563ca
+ e.printStackTrace();
+ mdtXBuild = "custom build";
+ }
}

/** @return whether the current game version is greater than the specified version string, e.g. "120.1"*/
@@ -73,6 +86,7 @@ public class Version{
if(build == -1){
return "custom build";
}
@@ -76 +89,2 @@ public class Version{
- return (type.equals("official") ? modifier : type) + " build " + build + (revision == 0 ? "" : "." + revision);
+ return (type.equals("official") ? modifier : type) + " build " + build + (revision == 0 ? "" : "." + revision) +
+ "\nMindustryX " + mdtXBuild;
}
}
diff --git a/core/src/mindustry/net/NetworkIO.java b/core/src/mindustry/net/NetworkIO.java
index 48599c6b96474117057e7ca2b87b545873a0ea31..4366eeef830845fb13132a0ae3534129b7a859dc 100644
--- a/core/src/mindustry/net/NetworkIO.java
+++ b/core/src/mindustry/net/NetworkIO.java
@@ -107,7 +107,7 @@ public class NetworkIO{
buffer.putInt(Core.settings.getInt("totalPlayers", Groups.player.size()));
buffer.putInt(state.wave);
buffer.putInt(Version.build);
@@ -110 +110 @@ public class NetworkIO{
- writeString(buffer, Version.type);
+ writeString(buffer, "MindustryX");

buffer.put((byte)state.rules.mode().ordinal());
buffer.putInt(netServer.admins.getPlayerLimit());
diff --git a/gradle.properties b/gradle.properties
index f43e22ea642fe0dcd62cf970a518de025db65ea4..b1921b8ac0d8d0ca7ac86e4d551a694d1ae38ed9 100644
--- a/gradle.properties
+++ b/gradle.properties
@@ -28,3 +28,5 @@ org.gradle.caching=true
org.gradle.internal.http.socketTimeout=100000
org.gradle.internal.http.connectionTimeout=100000
archash=7d6e89dffd
@@ -30,0 +31,2 @@ archash=7d6e89dffd
+
+upstreamBuild=25087
\ No newline at end of file
24 changes: 3 additions & 21 deletions patches/client/0004-API-Hooks.patch
Original file line number Diff line number Diff line change
Expand Up @@ -15,26 +15,14 @@ diff --git a/core/src/mindustry/ClientLauncher.java b/core/src/mindustry/ClientL
index 2a7b133588279145272136f6aa2a02276f34d824..fa6e5c5b52cfdb83de5b50539d57c579aa6e0c95 100644
--- a/core/src/mindustry/ClientLauncher.java
+++ b/core/src/mindustry/ClientLauncher.java
@@ -171,6 +171,7 @@ public abstract class ClientLauncher extends ApplicationCore implements Platform
add(ui = new UI());
add(netServer = new NetServer());
add(netClient = new NetClient());
@@ -173,0 +174 @@ public abstract class ClientLauncher extends ApplicationCore implements Platform
+ add(new mindustryX.Hooks());

assets.load(schematics);

diff --git a/core/src/mindustry/Vars.java b/core/src/mindustry/Vars.java
index d08d04a6f0e8107cec995876b2072c46aa85b3c2..793c1759060a5e28e1df276bae2fdcf23f78284e 100644
--- a/core/src/mindustry/Vars.java
+++ b/core/src/mindustry/Vars.java
@@ -269,6 +269,7 @@ public class Vars implements Loadable{
}

public static void init(){
@@ -271,0 +272 @@ public class Vars implements Loadable{
+ mindustryX.Hooks.beforeInit();
Groups.init();

if(loadLocales){
diff --git a/core/src/mindustryX/Hooks.java b/core/src/mindustryX/Hooks.java
new file mode 100644
index 0000000000000000000000000000000000000000..499a9f3403c6769288ad44e7fb4a68ffb36bc591
Expand Down Expand Up @@ -62,11 +50,5 @@ diff --git a/server/src/mindustry/server/ServerLauncher.java b/server/src/mindus
index 1aea11b2cc877ef9a35280575e6419d9fab16f01..1799c999b2affdc0de392841212edc1f544e4751 100644
--- a/server/src/mindustry/server/ServerLauncher.java
+++ b/server/src/mindustry/server/ServerLauncher.java
@@ -76,6 +76,7 @@ public class ServerLauncher implements ApplicationListener{
Core.app.addListener(netServer = new NetServer());
Core.app.addListener(new ServerControl(args));
Core.app.addListener(new ApplicationListener(){public void update(){ asyncCore.end(); }});
@@ -78,0 +79 @@ public class ServerLauncher implements ApplicationListener{
+ Core.app.addListener(new mindustryX.Hooks());

mods.eachClass(Mod::init);

22 changes: 4 additions & 18 deletions patches/client/0005-CS-Bundle-Extend.patch
Original file line number Diff line number Diff line change
Expand Up @@ -16,27 +16,14 @@ diff --git a/core/src/mindustryX/Hooks.java b/core/src/mindustryX/Hooks.java
index 499a9f3403c6769288ad44e7fb4a68ffb36bc591..ca6144798666f96ee074838e489b51df1a10d19d 100644
--- a/core/src/mindustryX/Hooks.java
+++ b/core/src/mindustryX/Hooks.java
@@ -1,12 +1,16 @@
package mindustryX;

import arc.*;
@@ -3,0 +4 @@ import arc.*;
+import arc.files.*;
import arc.util.*;

@@ -5,0 +7,2 @@ import arc.util.*;
+import java.util.*;
+
public class Hooks implements ApplicationListener{
/** invoke before `Vars.init`. Note that may be executed from `Vars.loadAsync` */
public static void beforeInit(){
Log.infoTag("MindustryX", "Hooks.beforeInit");
@@ -9,0 +13 @@ public class Hooks implements ApplicationListener{
+ registerBundle();
}

/** invoke after loading, just before `Mod::init` */
@@ -14,4 +18,22 @@ public class Hooks implements ApplicationListener{
public void init(){
Log.infoTag("MindustryX", "Hooks.init");
}
@@ -16,0 +21,18 @@ public class Hooks implements ApplicationListener{
+
+ private static void registerBundle(){
+ //MDTX: bundle overwrite
Expand All @@ -55,4 +42,3 @@ index 499a9f3403c6769288ad44e7fb4a68ffb36bc591..ca6144798666f96ee074838e489b51df
+ Log.err(e);
+ }
+ }
}
8 changes: 1 addition & 7 deletions patches/client/0006-S-update-TypeIO.writeRequest.patch
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,9 @@ diff --git a/core/src/mindustry/io/TypeIO.java b/core/src/mindustry/io/TypeIO.ja
index 70d1543c366b4eeef80c67f4eaeb05643c93451e..fe9682663342ccd1f3537cf82ea4c74996655440 100644
--- a/core/src/mindustry/io/TypeIO.java
+++ b/core/src/mindustry/io/TypeIO.java
@@ -414,8 +414,9 @@ public class TypeIO{
if(!plan.breaking){
write.s(plan.block.id);
write.b((byte)plan.rotation);
@@ -417,2 +417,3 @@ public class TypeIO{
- write.b(1); //always has config
- writeObject(write, plan.config);
+ boolean writePlan = !headless || !net.server();
+ write.b(writePlan ? 1 : 0); //always has config
+ writeObject(write, writePlan ? plan.config : null);
}
}

32 changes: 4 additions & 28 deletions patches/client/0007-API-Add-LogicBlock.running.patch
Original file line number Diff line number Diff line change
Expand Up @@ -11,36 +11,12 @@ diff --git a/core/src/mindustry/world/blocks/logic/LogicBlock.java b/core/src/mi
index 655cf48e4f974d2e05cdca66deb361f1ee9f65bf..6f4d08ac40d461d0c41dbb292866add7565ed784 100644
--- a/core/src/mindustry/world/blocks/logic/LogicBlock.java
+++ b/core/src/mindustry/world/blocks/logic/LogicBlock.java
@@ -24,6 +24,7 @@ import mindustry.ui.*;
import mindustry.world.*;
import mindustry.world.blocks.ConstructBlock.*;
import mindustry.world.meta.*;
@@ -26,0 +27 @@ import mindustry.world.meta.*;
+import mindustryX.*;

import java.io.*;
import java.util.zip.*;
@@ -31,6 +32,8 @@ import java.util.zip.*;
import static mindustry.Vars.*;

public class LogicBlock extends Block{
@@ -33,0 +35,2 @@ public class LogicBlock extends Block{
+ @MindustryXApi
+ public static boolean running = false;
private static final int maxByteLen = 1024 * 100;
public static final int maxNameLength = 32;

@@ -531,6 +534,7 @@ public class LogicBlock extends Block{

if(accumulator > maxInstructionScale * ipt) accumulator = maxInstructionScale * ipt;

@@ -533,0 +537 @@ public class LogicBlock extends Block{
+ running = true;
for(int i = 0; i < (int)accumulator; i++){
executor.runOnce();
accumulator --;
@@ -539,6 +543,7 @@ public class LogicBlock extends Block{
break;
}
}
@@ -541,0 +546 @@ public class LogicBlock extends Block{
+ running = false;
}
}

Loading

0 comments on commit e859bec

Please sign in to comment.