Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .github/workflows/nightly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@ jobs:
- name: Checkout sources
uses: actions/checkout@v7

- name: Setup JDK 25
- name: Setup JDK 21
uses: actions/setup-java@v5
with:
distribution: temurin
java-version: 25
java-version: 21

- name: Setup Gradle
uses: gradle/actions/setup-gradle@v6
Expand All @@ -26,5 +26,5 @@ jobs:
- name: Upload Artifact
uses: actions/upload-artifact@v7
with:
name: lenis-nightly
name: pylon-nightly
path: build/libs
4 changes: 2 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@ jobs:
- name: Checkout sources
uses: actions/checkout@v7

- name: Setup JDK 25
- name: Setup JDK 21
uses: actions/setup-java@v5
with:
distribution: temurin
java-version: 25
java-version: 21

- name: Setup Gradle
uses: gradle/actions/setup-gradle@v6
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
.gradle
.DS_Store
.idea/
.kotlin/
build/
!**/tomgirl/pylon/build
run/
16 changes: 7 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
<img alt="Lenis logo" src="src/main/resources/assets/lenis/icon.png" width="128px" />
<img alt="Pylon logo" src="src/main/resources/assets/pylon/icon.png" width="128px" />

# Lenis
Lenis allows legacy Minecraft versions to run with LWJGL 3. It replaces the outdated windowing system with SDL 3, and serves as a library for mods.

Currently only 1.8.9 on Ornithe is supported, with support for more versions coming soon.
# Pylon
Pylon allows legacy Minecraft versions to run with LWJGL 3. It replaces the outdated windowing system with SDL 3, and serves as a library for mods.

## Downloads
* [Latest Release](https://github.com/notdevcody/lenis/releases/latest)
* [Latest Nightly](https://nightly.link/notdevcody/lenis/workflows/nightly/main/lenis-nightly.zip)
* [Latest Release](https://github.com/notdevcody/pylon/releases/latest)
* [Latest Nightly](https://nightly.link/notdevcody/pylon/workflows/nightly/main/pylon-nightly.zip)

## Features
### Fixes
Expand All @@ -24,13 +22,13 @@ Currently only 1.8.9 on Ornithe is supported, with support for more versions com
- Better fullscreen and window resizing

## Developers
Lenis is published to the Clover Client Maven, and can be added as a dependency like so:
Pylon is published to the Clover Client Maven, and can be added as a dependency like so:
```kts
repositories {
maven("https://maven.cloverclient.com/releases")
}

dependencies {
modImplementation("pl.tomgirl:lenis:${version}")
modImplementation("pl.tomgirl:pylon:${version}")
}
```
23 changes: 23 additions & 0 deletions build-logic/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
plugins {
`kotlin-dsl`
}

repositories {
gradlePluginPortal()
mavenCentral()
}

dependencies {
implementation("com.gradleup.shadow:shadow-gradle-plugin:9.3.0")
implementation("org.ow2.asm:asm:9.10.1")
implementation("org.ow2.asm:asm-commons:9.10.1")
}

gradlePlugin {
plugins {
create("pylonBuild") {
id = "pylon.build"
implementationClass = "pl.tomgirl.pylon.build.PylonBuildPlugin"
}
}
}
1 change: 1 addition & 0 deletions build-logic/settings.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
rootProject.name = "pylon-build-logic"
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package pl.tomgirl.pylon.bakery.patch;

import java.nio.FloatBuffer;
import java.nio.IntBuffer;

@SuppressWarnings("unused")
public abstract class AL10Patch {
@CompatStub("alListenerfv")
private static void alListener(int paramName, FloatBuffer values) {}

@CompatStub("alSourcefv")
private static void alSource(int source, int param, FloatBuffer values) {}

@CompatStub("alSourceStopv")
private static void alSourceStop(IntBuffer sources) {}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
package pl.tomgirl.lenis.mixin;

import pl.tomgirl.lenis.plugin.CompatStub;
package pl.tomgirl.pylon.bakery.patch;

import java.nio.IntBuffer;

Expand All @@ -10,29 +8,26 @@
import org.lwjgl.openal.ALC10;
import org.lwjgl.openal.ALCCapabilities;
import org.lwjgl.system.MemoryStack;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Unique;

import static org.lwjgl.openal.AL.createCapabilities;

@SuppressWarnings("unused")
@Mixin(AL.class)
public abstract class ALMixin {
@Unique private static long _contextPtr;
@Unique private static long _devicePtr;
@Unique private static boolean _created;
public abstract class ALPatch {
private static long _contextPtr;
private static long _devicePtr;
private static boolean _created;

@Unique @CompatStub
@CompatStub
private static boolean isCreated() {
return _created;
}

@Unique @CompatStub
@CompatStub
private static void create(String deviceArguments, int contextFrequency, int contextRefresh, boolean contextSynchronized) throws LWJGLException {
create(deviceArguments, contextFrequency, contextRefresh, contextSynchronized, true);
}

@Unique @CompatStub
@CompatStub
private static void create(String deviceArguments, int contextFrequency, int contextRefresh, boolean contextSynchronized, boolean openDevice) throws LWJGLException {
if (_created) {
throw new IllegalStateException("Only one OpenAL context may be instantiated");
Expand All @@ -42,15 +37,14 @@ private static void create(String deviceArguments, int contextFrequency, int con
}
}

@Unique
private static void init(String deviceArguments, int contextFrequency, int contextRefresh, boolean contextSynchronized, boolean openDevice) throws LWJGLException {
try {
if (!openDevice) {
return;
}

_devicePtr = ALC10.alcOpenDevice(deviceArguments);
if (_devicePtr == -1L) {
if (_devicePtr == 0L) {
throw new LWJGLException("Could not open ALC device");
}

Expand All @@ -63,20 +57,21 @@ private static void init(String deviceArguments, int contextFrequency, int conte
}
}

ALC10.alcMakeContextCurrent(_contextPtr);
if (_contextPtr == 0L || !ALC10.alcMakeContextCurrent(_contextPtr)) {
throw new LWJGLException("Could not create or make current an OpenAL context");
}
createCapabilities(deviceCaps);
} catch (LWJGLException ex) {
} catch (LWJGLException | RuntimeException | Error ex) {
exit();
throw ex;
}
}

@Unique @CompatStub
@CompatStub
private static void create() throws LWJGLException {
create(null, 44100, 60, false);
}

@Unique
private static IntBuffer createAttributeList(int contextFrequency, int contextRefresh, int contextSynchronized, MemoryStack stack) {
IntBuffer buffer = stack.callocInt(7);
buffer.put(0, 4103);
Expand All @@ -89,19 +84,20 @@ private static IntBuffer createAttributeList(int contextFrequency, int contextRe
return buffer;
}

@Unique @CompatStub
@CompatStub
private static void exit() {
if (_contextPtr != -1L) {
if (_contextPtr != 0L) {
ALC10.alcMakeContextCurrent(0L);
ALC10.alcDestroyContext(_contextPtr);
_contextPtr = -1L;
_contextPtr = 0L;
}

if (_devicePtr != -1L) {
if (_devicePtr != 0L) {
ALC10.alcCloseDevice(_devicePtr);
_devicePtr = -1L;
_devicePtr = 0L;
}

AL.setCurrentProcess(null);
_created = false;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package pl.tomgirl.pylon.bakery.patch;

import java.nio.FloatBuffer;
import java.nio.IntBuffer;

@SuppressWarnings("unused")
public abstract class ARBShaderObjectsPatch {
@CompatStub("glGetObjectParameterivARB")
private static void glGetObjectParameterARB(int obj, int pname, IntBuffer params) {}

@CompatStub("glUniformMatrix4fvARB")
private static void glUniformMatrix4ARB(int location, boolean transpose, FloatBuffer value) {}

@CompatStub("glUniform1ivARB")
private static void glUniform1ARB(int location, IntBuffer value) {}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package pl.tomgirl.lenis.plugin;
package pl.tomgirl.pylon.bakery.patch;

import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
package pl.tomgirl.pylon.bakery.patch;

import java.nio.ByteBuffer;
import java.nio.FloatBuffer;
import java.nio.IntBuffer;
import java.nio.ShortBuffer;

import org.lwjgl.opengl.GL11;
import org.lwjgl.system.MemoryUtil;

@SuppressWarnings("unused")
public abstract class GL11Patch {
@CompatStub
private static void glDrawElements(int mode, int count, int type, ByteBuffer indices) {
GL11.nglDrawElements(mode, count, type, MemoryUtil.memAddress(indices));
}

@CompatStub
private static void glTexCoordPointer(int i, int stride, FloatBuffer pointer) {
GL11.glTexCoordPointer(i, 0x1406, stride, pointer);
}

@CompatStub
private static void glTexCoordPointer(int i, int stride, ShortBuffer pointer) {
GL11.glTexCoordPointer(i, 0x1402, stride, pointer);
}

@CompatStub
private static void glColorPointer(int i, boolean bl, int i2, ByteBuffer pointer) {
GL11.glColorPointer(i, 0x1401, i2, pointer);
}

@CompatStub
private static void glVertexPointer(int i, int i2, FloatBuffer pointer) {
GL11.glVertexPointer(i, 0x1406, i2, pointer);
}

@CompatStub
private static void glNormalPointer(int stride, ByteBuffer pointer) {
GL11.glNormalPointer(0x1400, stride, pointer);
}

@CompatStub("glGetBooleanv") private static void glGetBoolean(int pname, ByteBuffer params) {}
@CompatStub("glGetFloatv") private static void glGetFloat(int pname, FloatBuffer params) {}
@CompatStub("glGetIntegerv") private static void glGetInteger(int pname, IntBuffer params) {}
@CompatStub("glFogfv") private static void glFog(int pname, FloatBuffer params) {}
@CompatStub("glLightfv") private static void glLight(int light, int pname, FloatBuffer params) {}
@CompatStub("glLightModelfv") private static void glLightModel(int pname, FloatBuffer params) {}
@CompatStub("glMultMatrixf") private static void glMultMatrix(FloatBuffer matrix) {}
@CompatStub("glTexEnvfv") private static void glTexEnv(int target, int pname, FloatBuffer params) {}
@CompatStub("glTexGenfv") private static void glTexGen(int coord, int pname, FloatBuffer params) {}
@CompatStub("glLoadMatrixf") private static void glLoadMatrix(FloatBuffer matrix) {}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
package pl.tomgirl.pylon.bakery.patch;

import java.nio.FloatBuffer;
import java.nio.IntBuffer;
import org.lwjgl.opengl.GL20;

@SuppressWarnings("unused")
public abstract class GL20Patch {
@CompatStub
private static void glShaderSource(int shader, java.nio.ByteBuffer string) {
byte[] data = new byte[string.limit()];
string.position(0);
string.get(data);
string.position(0);
GL20.glShaderSource(shader, new String(data));
}

@CompatStub("glUniformMatrix4fv") private static void glUniformMatrix4(int location, boolean transpose, FloatBuffer value) {}
@CompatStub("glUniform2fv") private static void glUniform2(int location, FloatBuffer value) {}
@CompatStub("glUniform1iv") private static void glUniform1(int location, IntBuffer value) {}
@CompatStub("glUniform1fv") private static void glUniform1(int location, FloatBuffer value) {}
@CompatStub("glUniform2iv") private static void glUniform2i(int location, IntBuffer value) {}
@CompatStub("glUniform3iv") private static void glUniform3(int location, IntBuffer value) {}
@CompatStub("glUniform3fv") private static void glUniform3(int location, FloatBuffer value) {}
@CompatStub("glUniform4iv") private static void glUniform4(int location, IntBuffer value) {}
@CompatStub("glUniform4fv") private static void glUniform4(int location, FloatBuffer value) {}
@CompatStub("glUniformMatrix2fv") private static void glUniformMatrix2(int location, boolean transpose, FloatBuffer value) {}
@CompatStub("glUniformMatrix3fv") private static void glUniformMatrix3(int location, boolean transpose, FloatBuffer value) {}
}
Loading
Loading