Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
b7542ae
Pre splash phases
tttsaurus Oct 14, 2026
def1ba0
Merge branch 'develop/0.8' into feat/pre-splash
tttsaurus Oct 16, 2026
e83c306
Merge branch 'develop/0.8' into feat/pre-splash
tttsaurus Nov 3, 2026
710d813
chore: update kirino
tttsaurus Nov 3, 2026
ca5eaf9
feat: add patches to notify the current phase
tttsaurus Nov 3, 2026
0bb5819
chore: fix patches; add back `hasError` check before `refreshMcFontIf…
tttsaurus Nov 3, 2026
dd3c30e
chore: update kirino
tttsaurus Nov 4, 2026
e7779cd
feat: dedicated rendering thread, sdl window, gl context. isolate cla…
tttsaurus Nov 4, 2026
3a4c871
fix: revert some unnecessary CoreModManager patches
tttsaurus Nov 4, 2026
cb078e0
feat: dual backend, sdl & swing
tttsaurus Nov 7, 2026
6b0b759
feat: now the renderer decides when to release game thread pause
tttsaurus Nov 7, 2026
cc41fe7
chore: update kirino
tttsaurus Nov 7, 2026
c34c1fc
feat: early mc font loading for SdlSplashRenderer + logger for both S…
tttsaurus Nov 8, 2026
11ec54a
fix: swing renderer not consuming some logs before quit
tttsaurus Nov 8, 2026
eb40d67
chore: update kirino
tttsaurus Nov 8, 2026
0f27eb9
chore: update kirino
tttsaurus Nov 9, 2026
c5d76f8
refactor(sdl renderer): remove Minecraft dependency
tttsaurus Nov 9, 2026
b3a80f4
feat(sdl renderer): intro UI & animation
tttsaurus Nov 10, 2026
0cccc36
feat(sdl renderer): intro title typing effect
tttsaurus Nov 10, 2026
cd9fb27
feat(sdl renderer): loading UI
tttsaurus Nov 11, 2026
d1bc11e
feat: loading details
tttsaurus Nov 11, 2026
baa0e0b
feat(sdl renderer): background glow
tttsaurus Nov 11, 2026
e4a8032
feat(sdl renderer): background glow toggle
tttsaurus Nov 11, 2026
2984179
fix: MMC launcher native library already loaded in another classloader
tttsaurus Nov 11, 2026
3cd5dfc
fix: Windows specific fixes for a LWJGL 3.4.3 upstream issue
tttsaurus Nov 12, 2026
3aa7e10
chore: update kirino
tttsaurus Nov 12, 2026
f36ea76
chore: switch to compat profile
tttsaurus Nov 12, 2026
c3082cf
chore: migrate to latest kirino
tttsaurus Nov 13, 2026
da6051b
refactor: prefer XWayland + apply niri integration on both renderer +…
tttsaurus Nov 17, 2026
6177714
Merge branch 'develop/0.8' into feat/pre-splash
tttsaurus Nov 23, 2026
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
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
/*
* Copyright (c) 2026 CleanroomMC contributors
*
* This file is licensed under the CleanroomMC License Version 1.0.
* See the applicable LICENSE file in this directory or a parent directory
* for the full licence terms.
*
* This is visible-source software and is not open-source software.
*/

package com.cleanroommc.cleanroom.splash.pre;

import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.net.MalformedURLException;
import java.net.URL;
import java.net.URLClassLoader;
import java.util.ArrayList;
import java.util.List;

/**
* Motivation is to keep pre splash's untransformed classes out of the game's loader.
*
* <p>Note: Only applied to {@link PreSplashScreenContainer.SdlRenderer}.</p>
*/
final class PreSplashClassLoader extends URLClassLoader {

PreSplashClassLoader(ClassLoader parent) {
super(nativeLibraryPaths(), parent);
}

private static URL[] nativeLibraryPaths() {
List<URL> paths = new ArrayList<>();
for (String property : List.of("org.lwjgl.librarypath", "java.library.path")) {
String value = System.getProperty(property);
if (value == null || value.isEmpty()) {
continue;
}
for (String directory : value.split(File.pathSeparator)) {
if (directory.isEmpty()) {
continue;
}
try {
paths.add(new File(directory).toURI().toURL());
} catch (MalformedURLException e) {
throw new IllegalStateException("Invalid native library directory: " + directory, e);
}
}
}
return paths.toArray(URL[]::new);
}

private static boolean isIsolated(String name) {
return name.startsWith("org.lwjgl.")
|| name.startsWith("com.cleanroommc.kirino.")
|| name.startsWith("com.cleanroommc.mcttf.")
|| name.startsWith("com.cleanroommc.cleanroom.splash.pre.PreSplashScreenContainer$")
|| name.startsWith("com.cleanroommc.cleanroom.splash.pre.renderer.");
}

@Override
protected Class<?> loadClass(String name, boolean resolve) throws ClassNotFoundException {
if (!isIsolated(name)) {
return super.loadClass(name, resolve);
}

synchronized (getClassLoadingLock(name)) {
Class<?> loaded = findLoadedClass(name);

if (loaded == null) {
String resource = name.replace('.', '/') + ".class";
try (InputStream input = getParent().getResourceAsStream(resource)) {
if (input == null) {
throw new ClassNotFoundException(name);
}

byte[] bytes = input.readAllBytes();
loaded = defineClass(name, bytes, 0, bytes.length);
} catch (IOException e) {
throw new ClassNotFoundException(name, e);
}
}

if (resolve) {
resolveClass(loaded);
}

return loaded;
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
/*
* Copyright (c) 2026 CleanroomMC contributors
*
* This file is licensed under the CleanroomMC License Version 1.0.
* See the applicable LICENSE file in this directory or a parent directory
* for the full licence terms.
*
* This is visible-source software and is not open-source software.
*/

package com.cleanroommc.cleanroom.splash.pre;

import com.google.common.base.Preconditions;
import org.jetbrains.annotations.ApiStatus;
import org.jspecify.annotations.Nullable;

import java.util.Queue;
import java.util.concurrent.ConcurrentLinkedQueue;

/**
* This is not a client-side only class, but it's only intended to work for client-side bootstrapping.
*/
public final class PreSplashManager {

public static final PreSplashManager INSTANCE = new PreSplashManager();

private final PreSplashPhaseFSM fsm = new PreSplashPhaseFSM();
private final Queue<PreSplashState> states = new ConcurrentLinkedQueue<>();
private volatile @Nullable PreSplashPhase currentPhase = null;

private PreSplashManager() {
}

private static String title() {
return "Cleanroom";
}

private static String phaseMsg(PreSplashPhase phase) {
return switch (phase) {
case FML_SETUP -> "Preparing Forge Mod Loader";
case INITIAL_MOD_SCAN -> "Discovering mods";
case CORE_MOD_LAUNCH -> "Loading core mods";
case MINECRAFT_INIT -> "Initializing Minecraft";
case RIGHT_BEFORE_SPLASH -> "Starting mod loading";
};
}

/**
* Thread-safe.
*
* @param phase The next observed phase
*/
@ApiStatus.Internal
public synchronized void notifyPhase(PreSplashPhase phase) {
Preconditions.checkNotNull(phase);
Preconditions.checkState(phase == fsm.getState(),
"Expected pre splash phase: %s; Observed: %s", fsm.getState(), phase);

fsm.next();

states.add(new PreSplashState(title(), phaseMsg(phase), ""));
currentPhase = phase;
}

/**
* Thread-safe. Must be called after the first {@link #notifyPhase(PreSplashPhase)}.
*
* @param phase The current phase that owns this detail update (acts like a filter)
*/
@SuppressWarnings("DataFlowIssue")
@ApiStatus.Internal
public synchronized void notifyDetails(PreSplashPhase phase, String details) {
Preconditions.checkNotNull(phase);
Preconditions.checkNotNull(details);
Preconditions.checkNotNull(currentPhase);

if (currentPhase == phase) {
states.add(new PreSplashState(title(), phaseMsg(currentPhase), details));
}
}

/**
* Thread-safe. Only intended to be read after the first phase has been published.
*/
@ApiStatus.Internal
PreSplashPhase readPhase() {
return Preconditions.checkNotNull(currentPhase);
}

/**
* Thread-safe.
*/
@Nullable
PreSplashState peek() {
return states.peek();
}

/**
* Thread-safe.
*/
@Nullable
PreSplashState poll() {
return states.poll();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
/*
* Copyright (c) 2026 CleanroomMC contributors
*
* This file is licensed under the CleanroomMC License Version 1.0.
* See the applicable LICENSE file in this directory or a parent directory
* for the full licence terms.
*
* This is visible-source software and is not open-source software.
*/

package com.cleanroommc.cleanroom.splash.pre;

import com.cleanroommc.discovery.CleanroomModDiscoverer;

import net.minecraft.client.Minecraft;
import net.minecraft.launchwrapper.LaunchClassLoader;
import net.minecraftforge.fml.common.launcher.FMLTweaker;
import net.minecraftforge.fml.relauncher.CoreModManager;

import java.io.File;

public enum PreSplashPhase {

/**
* @see FMLTweaker#injectIntoClassLoader(LaunchClassLoader)
*/
FML_SETUP,

/**
* @see CleanroomModDiscoverer#CleanroomModDiscoverer()
*/
INITIAL_MOD_SCAN,

/**
* @see CoreModManager#handleLaunch(File, LaunchClassLoader, FMLTweaker)
*/
CORE_MOD_LAUNCH,

/**
* @see Minecraft#init()
*/
MINECRAFT_INIT,

/**
* @see Minecraft#init()
*/
RIGHT_BEFORE_SPLASH
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
/*
* Copyright (c) 2026 CleanroomMC contributors
*
* This file is licensed under the CleanroomMC License Version 1.0.
* See the applicable LICENSE file in this directory or a parent directory
* for the full licence terms.
*
* This is visible-source software and is not open-source software.
*/

package com.cleanroommc.cleanroom.splash.pre;

import com.cleanroommc.kirino.schemata.fsm.FiniteStateMachine;

import com.google.common.base.Preconditions;

final class PreSplashPhaseFSM {

private final FiniteStateMachine<PreSplashPhase, Integer> fsm;

private boolean finished = false;

PreSplashPhaseFSM() {
fsm = FiniteStateMachine.BuilderImpl
.enumIntStateMachine(PreSplashPhase.class, 0, 0)
.initialState(PreSplashPhase.FML_SETUP)
.addTransition(PreSplashPhase.FML_SETUP, 0, PreSplashPhase.INITIAL_MOD_SCAN)
.addTransition(PreSplashPhase.INITIAL_MOD_SCAN, 0, PreSplashPhase.CORE_MOD_LAUNCH)
.addTransition(PreSplashPhase.CORE_MOD_LAUNCH, 0, PreSplashPhase.MINECRAFT_INIT)
.addTransition(PreSplashPhase.MINECRAFT_INIT, 0, PreSplashPhase.RIGHT_BEFORE_SPLASH)
.error((state, input) -> {
throw new RuntimeException(String.format(
"An error occurred inside PreSplashPhaseFSM. The input=%d leads to a non-existent route. Current state=%s.", input, state));
})
.validate()
.build();
}

public PreSplashPhase getState() {
return fsm.state();
}

public void next() {
Preconditions.checkState(!finished);

if (fsm.state() == PreSplashPhase.RIGHT_BEFORE_SPLASH) {
finished = true;
} else {
fsm.accept(0);
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
/*
* Copyright (c) 2026 CleanroomMC contributors
*
* This file is licensed under the CleanroomMC License Version 1.0.
* See the applicable LICENSE file in this directory or a parent directory
* for the full licence terms.
*
* This is visible-source software and is not open-source software.
*/

package com.cleanroommc.cleanroom.splash.pre;

import com.google.common.base.Preconditions;
import org.jspecify.annotations.Nullable;

public final class PreSplashPresentation {

private final PreSplashManager manager;
private PreSplashState current;

public PreSplashPresentation(PreSplashManager manager) {
this.manager = manager;
current = Preconditions.checkNotNull(manager.peek(),
"The initial pre splash frame must be published.");
}

public boolean isFinished() {
return manager.readPhase() == PreSplashPhase.RIGHT_BEFORE_SPLASH;
}

@Nullable
public PreSplashState peek() {
return manager.peek();
}

@Nullable
public PreSplashState poll() {
PreSplashState next = manager.poll();
if (next != null) {
current = next;
}
return next;
}

public PreSplashState nextFrame() {
if (peek() != null) {
poll();
}
return current;
}
}
Loading
Loading