-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 089e95b
Showing
40 changed files
with
726 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
/src/ | ||
build/ | ||
*.jar | ||
out/ | ||
.idea/ | ||
*.ipr | ||
*.iml | ||
*.iws | ||
.gradle/ | ||
*.zip |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
plugins { | ||
id 'java' | ||
id 'application' | ||
} | ||
|
||
mainClassName = 'tk.valoeghese.fc0.client.Main' | ||
sourceCompatibility = JavaVersion.VERSION_1_8 | ||
|
||
group 'tk.valoeghese' | ||
version '0.1.4' | ||
|
||
repositories { | ||
mavenCentral() | ||
|
||
maven { | ||
name = "FabricMC" | ||
url = "https://maven.fabricmc.net" | ||
} | ||
} | ||
|
||
configurations { | ||
enigma | ||
} | ||
|
||
def gameJar = project.file("2fc0f18-${version}.jar") | ||
def mappingsDir = project.file('mappings') | ||
|
||
dependencies { | ||
//implementation files(gameJar) | ||
|
||
// lwjgl | ||
implementation "org.lwjgl:lwjgl:${project.lwjgl_version}" | ||
implementation "org.lwjgl:lwjgl-assimp:${project.lwjgl_version}" | ||
//implementation "org.lwjgl:lwjgl-jawt:${project.lwjgl_version}" | ||
implementation "org.lwjgl:lwjgl-opengl:${project.lwjgl_version}" | ||
implementation "org.lwjgl:lwjgl-glfw:${project.lwjgl_version}" | ||
implementation "org.lwjgl:lwjgl-openal:${project.lwjgl_version}" | ||
implementation "org.lwjgl:lwjgl-stb:${project.lwjgl_version}" | ||
// joml | ||
implementation "org.joml:joml:${project.joml_version}" | ||
// fastutil | ||
implementation "it.unimi.dsi:fastutil:${project.fastutil_version}" | ||
// lwjgl natives | ||
runtimeOnly "org.lwjgl:lwjgl:${project.lwjgl_version}:${project.natives}" | ||
runtimeOnly "org.lwjgl:lwjgl-assimp:${project.lwjgl_version}:${project.natives}" | ||
runtimeOnly "org.lwjgl:lwjgl-opengl:${project.lwjgl_version}:${project.natives}" | ||
runtimeOnly "org.lwjgl:lwjgl-glfw:${project.lwjgl_version}:${project.natives}" | ||
runtimeOnly "org.lwjgl:lwjgl-openal:${project.lwjgl_version}:${project.natives}" | ||
runtimeOnly "org.lwjgl:lwjgl-stb:${project.lwjgl_version}:${project.natives}" | ||
|
||
compileOnly "com.google.code.findbugs:jsr305:3.0.2" | ||
testCompile group: 'junit', name: 'junit', version: '4.12' | ||
|
||
enigma "cuchaz:enigma:$project.enigma_version" | ||
} | ||
|
||
task deobf(type: DeobfuscateTask) { | ||
group = "build setup" | ||
mappings = mappingsDir | ||
inputJar = gameJar | ||
outputJar = file("build/deobf-${gameJar.name}") | ||
} | ||
|
||
task decompile(type: DecompileTask, dependsOn: deobf) { | ||
group = "build setup" | ||
input = deobf.outputJar | ||
output = file('src/main/java') | ||
} | ||
|
||
task extractResources(type: ExtractResourcesTask) { | ||
group = "build setup" | ||
input = gameJar | ||
output = file('src/main/resources') | ||
} | ||
|
||
task enigma() { | ||
doLast { | ||
ant.setLifecycleLogLevel "WARN" | ||
ant.java( | ||
classname: 'cuchaz.enigma.Main', | ||
classpath: configurations.enigma.asPath, | ||
fork: true, | ||
spawn: true | ||
) { | ||
jvmarg(value: "-Xmx2048m") | ||
arg(value: '-jar') | ||
arg(value: gameJar.getAbsolutePath()) | ||
arg(value: '-mappings') | ||
arg(value: mappingsDir.getAbsolutePath()) | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
repositories { | ||
mavenCentral() | ||
maven { | ||
name = "fabric" | ||
url = "https://maven.fabricmc.net" | ||
} | ||
} | ||
|
||
dependencies { | ||
implementation "org.benf:cfr:0.150" | ||
implementation "cuchaz:enigma:$enigma" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
enigma = 0.16.0+build.175:all |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
import org.benf.cfr.reader.api.CfrDriver | ||
import org.benf.cfr.reader.api.OutputSinkFactory | ||
import org.benf.cfr.reader.api.SinkReturns | ||
import org.gradle.api.DefaultTask | ||
import org.gradle.api.tasks.Input | ||
import org.gradle.api.tasks.TaskAction | ||
|
||
import java.nio.charset.StandardCharsets | ||
import java.nio.file.FileSystem | ||
import java.nio.file.FileSystems | ||
import java.nio.file.Files | ||
|
||
class DecompileTask extends DefaultTask { | ||
@Input | ||
File input | ||
|
||
@Input | ||
File output | ||
|
||
@TaskAction | ||
def run() { | ||
output.mkdirs() | ||
|
||
def driver = new CfrDriver.Builder() | ||
.withOptions(renamedupmembers: 'true') | ||
.withOutputSink(new SinkFactory()) | ||
.build() | ||
driver.analyse([input.getAbsolutePath()]) | ||
} | ||
|
||
private def accept(SinkReturns.Decompiled decompiled) { | ||
def dir = output.toPath().resolve(decompiled.packageName.replace('.', '/')) | ||
Files.createDirectories(dir) | ||
def sourceFile = dir.resolve(decompiled.className + ".java") | ||
|
||
Files.write(sourceFile, decompiled.java.getBytes(StandardCharsets.UTF_8)) | ||
} | ||
|
||
private class SinkFactory implements OutputSinkFactory { | ||
@Override | ||
List<SinkClass> getSupportedSinks(SinkType sinkType, Collection<SinkClass> available) { | ||
return [SinkClass.DECOMPILED] | ||
} | ||
|
||
@Override | ||
<T> Sink<T> getSink(SinkType sinkType, SinkClass sinkClass) { | ||
return (sinkClass == SinkClass.DECOMPILED && sinkType == SinkType.JAVA) | ||
? { data -> accept(data as SinkReturns.Decompiled) } | ||
: null | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import cuchaz.enigma.command.DeobfuscateCommand | ||
import org.gradle.api.DefaultTask | ||
import org.gradle.api.tasks.Input | ||
import org.gradle.api.tasks.TaskAction | ||
|
||
class DeobfuscateTask extends DefaultTask { | ||
@Input | ||
File mappings | ||
|
||
@Input | ||
File inputJar | ||
|
||
@Input | ||
File outputJar | ||
|
||
@TaskAction | ||
def run() { | ||
outputJar.parentFile.mkdirs() | ||
new DeobfuscateCommand().run(inputJar.absolutePath, outputJar.absolutePath, mappings.absolutePath) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import org.gradle.api.DefaultTask | ||
import org.gradle.api.tasks.Input | ||
import org.gradle.api.tasks.TaskAction | ||
|
||
import java.nio.file.FileSystems | ||
import java.nio.file.Files | ||
|
||
class ExtractResourcesTask extends DefaultTask { | ||
@Input | ||
File input | ||
|
||
@Input | ||
File output | ||
|
||
@TaskAction | ||
def run() { | ||
def resources = output.toPath() | ||
def fs = FileSystems.newFileSystem(URI.create("jar:" + input.toPath().toUri()), Collections.emptyMap(), null) | ||
try { | ||
for (def root : fs.rootDirectories) { | ||
Files.walk(root).filter({ Files.isRegularFile(it) && !it.toString().endsWith(".class") }).forEach({ | ||
def str = it.toString() | ||
def target = resources.resolve(str.startsWith("/") ? str.substring(1) : str) | ||
Files.createDirectories(target.parent) | ||
Files.copy(it, target) | ||
}) | ||
} | ||
} finally { | ||
fs.close() | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
lwjgl_version = 3.2.3 | ||
joml_version = 1.9.24 | ||
fastutil_version = 8.3.1 | ||
|
||
natives = natives-windows | ||
enigma_version = 0.16.0+build.175:all |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
#Mon Aug 22 17:36:22 EDT 2016 | ||
distributionBase=GRADLE_USER_HOME | ||
distributionPath=wrapper/dists | ||
zipStoreBase=GRADLE_USER_HOME | ||
zipStorePath=wrapper/dists | ||
distributionUrl=https\://services.gradle.org/distributions/gradle-6.3-bin.zip |
Oops, something went wrong.