Archive incari-client (client, 26.3, clean)

This commit is contained in:
2026-11-28 00:54:38 -06:00
parent 7a6174687f
commit 12838e838c
2383 changed files with 280266 additions and 0 deletions
@@ -0,0 +1,38 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: incari-client <335801235+incari-client@users.noreply.github.com>
Date: Sat, 26 Sep 2026 11:05:35 -0400
Subject: [PATCH] platform: Build VideoMode from platform display modes, not
SDL
diff --git a/src/main/java/com/mojang/blaze3d/platform/VideoMode.java b/src/main/java/com/mojang/blaze3d/platform/VideoMode.java
index 248664d64cf1cb439640ea322b27e1a94b56714c..3bd14611dae5dc8698f8e310b2c965d01d4841b3 100644
--- a/src/main/java/com/mojang/blaze3d/platform/VideoMode.java
+++ b/src/main/java/com/mojang/blaze3d/platform/VideoMode.java
@@ -13,5 +13,2 @@
import org.jspecify.annotations.Nullable;
-import org.lwjgl.sdl.SDLPixels;
-import org.lwjgl.sdl.SDL_DisplayMode;
-import org.lwjgl.sdl.SDL_PixelFormatDetails;
import org.slf4j.Logger;
@@ -43,3 +40,5 @@
- private VideoMode(final int width, final int height, final int redBits, final int greenBits, final int blueBits, final float refreshRate) {
+ // Incari start: platform display modes carry fractional refresh rates (59.94 Hz)
+ public VideoMode(final int width, final int height, final int redBits, final int greenBits, final int blueBits, final float refreshRate) {
+ // Incari end
this.width = width;
@@ -52,11 +51,4 @@
- public VideoMode(final SDL_DisplayMode mode) {
- this.width = mode.w();
- this.height = mode.h();
- this.refreshRate = mode.refresh_rate();
- SDL_PixelFormatDetails details = SDLPixels.SDL_GetPixelFormatDetails(mode.format());
- this.redBits = details != null ? details.Rbits() : 8;
- this.greenBits = details != null ? details.Gbits() : 8;
- this.blueBits = details != null ? details.Bbits() : 8;
- }
+ // Incari start: display modes come from the platform (incari.client.platform.DisplayModes), not SDL
+ // Incari end
@@ -0,0 +1,49 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: incari-client <335801235+incari-client@users.noreply.github.com>
Date: Sat, 26 Sep 2026 11:05:52 -0400
Subject: [PATCH] platform: Read keys, key names and the mouse grab through the
platform
diff --git a/src/main/java/com/mojang/blaze3d/platform/InputConstants.java b/src/main/java/com/mojang/blaze3d/platform/InputConstants.java
index 6b1727fe3f92467b2cf7b49bfd7d3eaf9c0832ec..6c87c6e5f1ea00f919066f601c41693b98593ffd 100644
--- a/src/main/java/com/mojang/blaze3d/platform/InputConstants.java
+++ b/src/main/java/com/mojang/blaze3d/platform/InputConstants.java
@@ -20,5 +20,2 @@
import net.minecraft.network.chat.Component;
-import org.lwjgl.sdl.SDLError;
-import org.lwjgl.sdl.SDLKeyboard;
-import org.lwjgl.sdl.SDLMouse;
import org.slf4j.Logger;
@@ -217,4 +214,4 @@
public static boolean isKeyDown(final int key) {
- ByteBuffer keyboardState = SDLKeyboard.SDL_GetKeyboardState();
- return keyboardState != null && keyboardState.get(key) != 0;
+ // Incari start: keyboard and mouse through the platform
+ return incari.client.platform.PlatformInputHooks.isKeyDown(key);
}
@@ -222,6 +219,3 @@
public static void grabMouse(final Window window, final double xpos, final double ypos) {
- SDLMouse.SDL_WarpMouseInWindow(window.handle(), (float)xpos, (float)ypos);
- if (!SDLMouse.SDL_SetWindowRelativeMouseMode(window.handle(), true)) {
- LOGGER.warn("Failed to enable relative mouse mode: {}", SDLError.SDL_GetError());
- }
+ incari.client.platform.PlatformInputHooks.setMouseGrabbed(window, xpos, ypos, true);
}
@@ -229,6 +223,4 @@
public static void releaseMouse(final Window window, final double xpos, final double ypos) {
- SDLMouse.SDL_WarpMouseInWindow(window.handle(), (float)xpos, (float)ypos);
- if (!SDLMouse.SDL_SetWindowRelativeMouseMode(window.handle(), false)) {
- LOGGER.warn("Failed to disable relative mouse mode: {}", SDLError.SDL_GetError());
- }
+ incari.client.platform.PlatformInputHooks.setMouseGrabbed(window, xpos, ypos, false);
+ // Incari end
}
@@ -311,4 +303,5 @@
- int keycode = SDLKeyboard.SDL_GetKeyFromScancode(value, (short)0, false);
- String systemName = SDLKeyboard.SDL_GetKeyName(keycode);
+ // Incari start: key names in the player's layout come from the platform
+ String systemName = incari.client.platform.PlatformInputHooks.keyName(value);
+ // Incari end
return systemName != null && systemName.codePointCount(0, systemName.length()) == 1
@@ -0,0 +1,55 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: incari-client <335801235+incari-client@users.noreply.github.com>
Date: Sat, 26 Sep 2026 11:05:57 -0400
Subject: [PATCH] platform: Read modifier keys and the cursor position through
the platform
diff --git a/src/main/java/net/minecraft/client/MouseHandler.java b/src/main/java/net/minecraft/client/MouseHandler.java
index 07751df566499d9c3b6b9c3573af21e489c83506..2fd7b4bb27d63fd16221421c8844086e022eb51f 100644
--- a/src/main/java/net/minecraft/client/MouseHandler.java
+++ b/src/main/java/net/minecraft/client/MouseHandler.java
@@ -30,5 +30,2 @@
import org.jspecify.annotations.Nullable;
-import org.lwjgl.sdl.SDLMouse;
-import org.lwjgl.sdl.SDLVideo;
-import org.lwjgl.system.MemoryStack;
import org.slf4j.Logger;
@@ -376,17 +373,7 @@
if (!this.mouseGrabbed) {
- try (MemoryStack stack = MemoryStack.stackPush()) {
- FloatBuffer x = stack.mallocFloat(1);
- FloatBuffer y = stack.mallocFloat(1);
- IntBuffer windowX = stack.mallocInt(1);
- IntBuffer windowY = stack.mallocInt(1);
- SDLMouse.SDL_GetGlobalMouseState(x, y);
- if (SDLVideo.SDL_GetWindowPosition(this.minecraft.getWindow().handle(), windowX, windowY)) {
- this.xpos = x.get(0) - windowX.get(0);
- this.ypos = y.get(0) - windowY.get(0);
- } else {
- SDLMouse.SDL_GetMouseState(x, y);
- this.xpos = x.get(0);
- this.ypos = y.get(0);
- }
- }
+ // Incari start: the cursor position comes from the platform
+ double[] position = incari.client.platform.PlatformInputHooks.cursorPosition(this.minecraft.getWindow());
+ this.xpos = position[0];
+ this.ypos = position[1];
+ // Incari end
}
diff --git a/src/main/java/net/minecraft/client/input/InputQuirks.java b/src/main/java/net/minecraft/client/input/InputQuirks.java
index e9182b3c01a7fff28abc6b227921cc87f692e2db..6dc7b5ca723b0a3f307eb76f1f7397ad8ef4a9ee 100644
--- a/src/main/java/net/minecraft/client/input/InputQuirks.java
+++ b/src/main/java/net/minecraft/client/input/InputQuirks.java
@@ -5,3 +5,2 @@
import net.minecraft.util.Util;
-import org.lwjgl.sdl.SDLKeyboard;
@@ -19,3 +18,5 @@
public static boolean isQuitShortcutDown() {
- int modifiers = SDLKeyboard.SDL_GetModState();
+ // Incari start: modifier state from the platform
+ int modifiers = incari.client.platform.PlatformInputHooks.modifiers();
+ // Incari end
return ON_OSX ? (modifiers & 3072) != 0 && InputConstants.isKeyDown(20) : (modifiers & 768) != 0 && InputConstants.isKeyDown(61);
@@ -0,0 +1,62 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: incari-client <335801235+incari-client@users.noreply.github.com>
Date: Sat, 26 Sep 2026 11:06:14 -0400
Subject: [PATCH] platform: Start and stop the platform where the game started
SDL
diff --git a/src/main/java/com/mojang/blaze3d/systems/RenderSystem.java b/src/main/java/com/mojang/blaze3d/systems/RenderSystem.java
index 5bd55b32473701e1f40472fff4adfb101c715e93..fdeff68214d6520994cf14103767f8f50c8a1dcb 100644
--- a/src/main/java/com/mojang/blaze3d/systems/RenderSystem.java
+++ b/src/main/java/com/mojang/blaze3d/systems/RenderSystem.java
@@ -6,3 +6,2 @@
import com.mojang.blaze3d.platform.SDLEventHandler;
-import com.mojang.blaze3d.platform.SdlDebug;
import com.mojang.logging.LogUtils;
@@ -33,6 +32,2 @@
import org.lwjgl.Version;
-import org.lwjgl.sdl.SDLError;
-import org.lwjgl.sdl.SDLHints;
-import org.lwjgl.sdl.SDLInit;
-import org.lwjgl.sdl.SDLTimer;
import org.lwjgl.system.MemoryUtil;
@@ -198,21 +193,5 @@
public static TimeSource.NanoTimeSource initBackendSystem() {
- SdlDebug.init();
- SDLInit.SDL_SetAppMetadataProperty("SDL.app.metadata.name", "Minecraft");
- SDLInit.SDL_SetAppMetadataProperty("SDL.app.metadata.version", SharedConstants.getCurrentVersion().name());
- SDLInit.SDL_SetAppMetadataProperty("SDL.app.metadata.identifier", "com.mojang.minecraft");
- SDLInit.SDL_SetAppMetadataProperty("SDL.app.metadata.creator", "Mojang Studios");
- SDLInit.SDL_SetAppMetadataProperty("SDL.app.metadata.copyright", "Copyright Mojang AB.");
- SDLInit.SDL_SetAppMetadataProperty("SDL.app.metadata.url", "https://www.minecraft.net");
- SDLInit.SDL_SetAppMetadataProperty("SDL.app.metadata.type", "game");
- SDLHints.SDL_SetHint("SDL_NO_SIGNAL_HANDLERS", "1");
- SDLHints.SDL_SetHint("SDL_VIDEO_MINIMIZE_ON_FOCUS_LOSS", "0");
- SDLHints.SDL_SetHint("SDL_QUIT_ON_LAST_WINDOW_CLOSE", "0");
- SDLHints.SDL_SetHint("SDL_MOUSE_FOCUS_CLICKTHROUGH", "1");
- SDLHints.SDL_SetHint("SDL_ENABLE_SCREEN_KEYBOARD", "0");
- SDLHints.SDL_SetHint("SDL_IME_IMPLEMENTED_UI", "composition");
- if (!SDLInit.SDL_Init(32)) {
- throw new IllegalStateException("Unable to initialize SDL: " + SDLError.SDL_GetError());
- } else {
- return SDLTimer::SDL_GetTicksNS;
- }
+ // Incari start: the platform starts the window system and provides the clock
+ return incari.client.platform.PlatformLifecycle.start();
+ // Incari end
}
diff --git a/src/main/java/net/minecraft/client/Minecraft.java b/src/main/java/net/minecraft/client/Minecraft.java
index 5a2e5bb721a6104be3dde617d6ed548fd7d24229..35571cc31b3e18bb5d0e3643681b25fc81045081 100644
--- a/src/main/java/net/minecraft/client/Minecraft.java
+++ b/src/main/java/net/minecraft/client/Minecraft.java
@@ -261,3 +261,2 @@
import org.jspecify.annotations.Nullable;
-import org.lwjgl.sdl.SDLInit;
import org.slf4j.Logger;
@@ -1153,3 +1152,5 @@
RenderSystem.unloadTrackedBackendLibrary();
- SDLInit.SDL_Quit();
+ // Incari start: stop the platform instead of SDL directly
+ incari.client.platform.PlatformLifecycle.stop();
+ // Incari end
Util.shutdownExecutors();
@@ -0,0 +1,17 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: incari-client <335801235+incari-client@users.noreply.github.com>
Date: Sat, 26 Sep 2026 13:35:51 -0400
Subject: [PATCH] platform: Let the entry point load the native libraries
diff --git a/src/main/java/net/minecraft/client/main/Main.java b/src/main/java/net/minecraft/client/main/Main.java
index 998dbcfc63e8830cdc489bda2c2454c0a2a4aa86..13b612664ea48508907f8dfc2c444a68e354477c 100644
--- a/src/main/java/net/minecraft/client/main/Main.java
+++ b/src/main/java/net/minecraft/client/main/Main.java
@@ -126,3 +126,5 @@
try {
- NativeLibrariesBootstrap.loadLibraries();
+ // Incari start: the entry point loads native libraries (desktop has them, a page doesn't)
+ incari.client.platform.PlatformLifecycle.loadNativeLibraries();
+ // Incari end
} catch (Throwable t) {
@@ -0,0 +1,20 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: incari-client <335801235+incari-client@users.noreply.github.com>
Date: Sat, 26 Sep 2026 22:45:52 -0400
Subject: [PATCH] platform: Untrack debug allocations only where LWJGL's
natives are loaded
diff --git a/src/main/java/com/mojang/blaze3d/platform/NativeImage.java b/src/main/java/com/mojang/blaze3d/platform/NativeImage.java
index b59f462a94c69aec9a58f575e12e23aaedf2ca8f..082824e8b9816cdfad7817153ace5a951612dcb9 100644
--- a/src/main/java/com/mojang/blaze3d/platform/NativeImage.java
+++ b/src/main/java/com/mojang/blaze3d/platform/NativeImage.java
@@ -443,3 +443,7 @@
public void untrack() {
- DebugMemoryUntracker.untrack(this.pixels);
+ // Incari start: LWJGL's debug allocator exists only where its native libraries do
+ if (incari.client.platform.PlatformLifecycle.hasNativeLibraries()) {
+ DebugMemoryUntracker.untrack(this.pixels);
+ }
+ // Incari end
}
@@ -0,0 +1,16 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: incari-client <335801235+incari-client@users.noreply.github.com>
Date: Mon, 28 Sep 2026 22:47:06 -0400
Subject: [PATCH] platform: Let the platform pace frames under the frame limit
diff --git a/src/main/java/net/minecraft/client/FramerateLimiter.java b/src/main/java/net/minecraft/client/FramerateLimiter.java
index 4a4cf66c65065475ff2614789cf64830a2b59fa7..b13f2a5b0fa5f2eba44b42c525a8f9e769c73a2d 100644
--- a/src/main/java/net/minecraft/client/FramerateLimiter.java
+++ b/src/main/java/net/minecraft/client/FramerateLimiter.java
@@ -15,2 +15,5 @@
public static void limitDisplayFPS(final int framerateLimit) {
+ // Incari start: a platform that paces frames itself (the browser) delays the next frame instead of sleeping in this one
+ if (incari.client.platform.ClientPlatform.get().limitFrameRate(framerateLimit)) return;
+ // Incari end
long targetTimePerFrame = 1000000000L / framerateLimit;