mirror of
https://github.com/SquidDev-CC/CC-Tweaked
synced 2024-11-17 23:34:51 +00:00
18c9723308
Does it count as an emulator when it's official? I hope not, as this'd make it my fourth or fifth emulator at this point. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Developing/debugging CraftOS is a massive pain to do inside Minecraft, as any change to resources requires a compile+hot swap cycle (and sometimes a `/reload` in-game). As such, it's often more convenient to spin up an emulator, pointing it to load the ROM from CC:T's sources. However, this isn't practical when also making changes to the Java classes. In this case, we either need to go in-game, or build a custom version of CCEmuX. This commit offers an alternative option: we now have our own emulator, which allows us to hot swap both Lua and Java to our heart's content. Most of the code here is based on our monitor TBO renderer. We probably could share some more of this, but there's not really a good place for it - feels a bit weird just to chuck it in :core. This is *not* a general-purpose emulator. It's limited in a lot of ways (won't launch on Mac[^1], no support for multiple computers) - just stick to what's there already. [^1]: We require OpenGL 4.5 due to our use of DSA.
54 lines
1.8 KiB
Plaintext
54 lines
1.8 KiB
Plaintext
// SPDX-FileCopyrightText: 2023 The CC: Tweaked Developers
|
|
//
|
|
// SPDX-License-Identifier: MPL-2.0
|
|
|
|
plugins {
|
|
id("cc-tweaked.java-convention")
|
|
application
|
|
}
|
|
|
|
val lwjglNatives = Unit.run {
|
|
val name = System.getProperty("os.name")!!
|
|
val arch = System.getProperty("os.arch")
|
|
when {
|
|
arrayOf("Linux", "FreeBSD", "SunOS", "Unit").any { name.startsWith(it) } -> when {
|
|
arrayOf("arm", "aarch64").any { arch.startsWith(it) } -> "natives-linux${if (arch.contains("64") || arch.startsWith("armv8")) "-arm64" else "-arm32"}"
|
|
else -> "natives-linux"
|
|
}
|
|
|
|
arrayOf("Mac OS X", "Darwin").any { name.startsWith(it) } ->
|
|
"natives-macos${if (arch.startsWith("aarch64")) "-arm64" else ""}"
|
|
|
|
arrayOf("Windows").any { name.startsWith(it) } -> when {
|
|
arch.contains("64") -> "natives-windows${if (arch.startsWith("aarch64")) "-arm64" else ""}"
|
|
else -> "natives-windows-x86"
|
|
}
|
|
|
|
else -> throw GradleException("Unrecognized or unsupported platform.")
|
|
}
|
|
}
|
|
|
|
dependencies {
|
|
implementation(project(":core"))
|
|
implementation(libs.commonsCli)
|
|
implementation(libs.slf4j)
|
|
runtimeOnly(libs.slf4j.simple)
|
|
|
|
implementation(platform(libs.lwjgl.bom))
|
|
implementation(libs.lwjgl.core)
|
|
implementation(libs.lwjgl.glfw)
|
|
implementation(libs.lwjgl.opengl)
|
|
runtimeOnly(variantOf(libs.lwjgl.core) { classifier(lwjglNatives) })
|
|
runtimeOnly(variantOf(libs.lwjgl.glfw) { classifier(lwjglNatives) })
|
|
runtimeOnly(variantOf(libs.lwjgl.opengl) { classifier(lwjglNatives) })
|
|
}
|
|
|
|
application {
|
|
mainClass.set("cc.tweaked.standalone.Main")
|
|
}
|
|
|
|
tasks.named("run", JavaExec::class.java) {
|
|
workingDir = rootProject.projectDir
|
|
args = listOf("-r", project(":core").layout.projectDirectory.dir("src/main/resources").asFile.absolutePath)
|
|
}
|