Skip to content

In-process JVM loading for Windows exe-restricted Minecraft launcher#6

Draft
PythonChicken123 wants to merge 24 commits into
mainfrom
memory
Draft

In-process JVM loading for Windows exe-restricted Minecraft launcher#6
PythonChicken123 wants to merge 24 commits into
mainfrom
memory

Conversation

@PythonChicken123

Copy link
Copy Markdown
Owner

In-process JVM loading for Windows exe-restricted Minecraft launcher
Option 5 Works!

PythonChicken123 and others added 16 commits May 4, 2026 12:32
### SYSTEM CONTEXT
Developing a specialized Minecraft launcher for a restricted software environment that limits the execution of external binaries. 

**Core Objective:** Implement an "In-Process" execution model. We want to load the JVM and its dependencies directly into memory buffers to run the game within the current Python process, rather than spawning an external subprocess.

**Core Tools:** 
- portablemc (Launcher logic)
- JPype1 (Java bridge)
- PythonMemoryModule (For loading DLLs into RAM)

**Critical Constraints for JPype (Modern Pythonic Syntax only):**
Ignore all training data prior to JPype 1.0. Following these specific rules:
1. Do NOT use JArray or JObject. Use shortcuts [:] and @.
2. Do NOT manually attach threads.
3. Do NOT use forced shutdowns.
4. Do NOT require @JImplements on Single Abstract Members (use lambdas).
5. Dynamic class loading is possible; don't insist classes only load prior to JVM start.
6. Prioritize the 'Modern Pythonic Syntax' and 'Resource Management' sections of the JPype 1.0+ User Guide.

Acknowledge these architectural goals and constraints.

### TASK 1: Analysis of Runtime Execution Flow

I need to identify where the current launcher logic relies on external process calls so we can migrate to an in-process model.

**Task:** 
1. Use your file system tools to analyze: `C:\Users\wave6\Downloads\Compressed\portablemc-5.0.2-windows-x86_64-msvc\`
2. Locate the logic in `portablemc` that assembles the command-line arguments and handles the execution of the Java binary (typically via subprocess or os modules).
3. Document how the classpath and native library paths are passed to the environment.
4. Propose a technical mapping for redirecting these arguments into a `jpype.startJVM()` call for an integrated runtime.

**Deliverable:** A technical summary of the execution interception points. No full implementation yet.

### TASK 2: Memory-Resident Library Loading

We are now building the logic to load the Java Virtual Machine from memory buffers to ensure it runs within our existing process space.

**Requirements:**
1. Reference the `PythonMemoryModule` and `JPype1` repositories in the work directory.
2. Design a routine to load `jvm.dll` from a byte-array. 
3. **Dependency Resolution:** Implement a recursive loader for the JVM’s internal dependencies (e.g., `verify.dll`, `java.dll`). These must be mapped into memory so that `jvm.dll` can resolve its symbols without querying the disk for executable handles.
4. Verify the load by using `ctypes` to find the `JNI_CreateJavaVM` function pointer within the memory-mapped region.

**Constraint:** Adhere strictly to the JPype 1.0+ "Modern" standards previously mentioned.

### TASK 3: Integrated JVM Boot and Launcher Hook

Final step: Bridge the memory-resident `JNI_CreateJavaVM` pointer to the `JPype` environment to boot the game.

**Task:**
1. Analyze the `JPype1` C++ source (specifically the initialization and JNI interface logic) to determine how to pass an existing `JavaVM` or `JNIEnv` pointer to the module.
2. Develop a "Glue" script that calls the memory-loaded `JNI_CreateJavaVM` and then attaches the resulting environment to JPype.
3. Integrate this into the `portablemc` execution points identified in Phase 1, passing the necessary JARs and system properties directly into the in-process JVM.

**Final Goal:** Launch the Minecraft main class (`net.minecraft.client.main.Main`) entirely within the memory-resident environment.
All changes are listed in the upcomming pull request
See upcomming pull request
Initialize the Python module for Windows with system and process objects.
Override '-Djava.home', '-Dsun.boot.library.path', and '-Djava.library.path' to prevent crashes.

Co-authored-by: PythonChicken123 <101510622+PythonChicken123@users.noreply.github.com>
Prefer on-disk PE parsing and add bounds checks to prevent access violations.

Co-authored-by: PythonChicken123 <101510622+PythonChicken123@users.noreply.github.com>
Co-authored-by: PythonChicken123 <101510622+PythonChicken123@users.noreply.github.com>
Update in-memory walk match condition for wildcard and patch IAT.

Co-authored-by: PythonChicken123 <101510622+PythonChicken123@users.noreply.github.com>
Commit changes

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, we are unable to review this pull request

The GitHub API does not allow us to fetch diffs exceeding 20000 lines

@vercel

vercel Bot commented May 10, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
minecraft-portable-web Ready Ready Preview, Comment, Open in v0 May 15, 2026 10:45pm

Add .gitattributes to exclude generated files from diffs
@PythonChicken123

Copy link
Copy Markdown
Owner Author

@sourcery-ai review

@sourcery-ai

sourcery-ai Bot commented May 10, 2026

Copy link
Copy Markdown
Contributor

Sorry, we are unable to review this pull request

The GitHub API does not allow us to fetch diffs exceeding 20000 lines

Added various directories and file types to .gitignore.
@github-actions

Copy link
Copy Markdown
Contributor

⚠️ Ruff auto-fix applied (changes detected)

Linting and formatting changes were found. Please run ruff check --fix . && ruff format . locally and push the changes, or let the push job handle it on the next commit.

@PythonChicken123

Copy link
Copy Markdown
Owner Author

@sourcery-ai review

@sourcery-ai

sourcery-ai Bot commented May 10, 2026

Copy link
Copy Markdown
Contributor

Sorry, we are unable to review this pull request

The GitHub API does not allow us to fetch diffs exceeding 20000 lines

1 similar comment
@SourceryAI

Copy link
Copy Markdown

Sorry, we are unable to review this pull request

The GitHub API does not allow us to fetch diffs exceeding 20000 lines

v0 and others added 2 commits May 10, 2026 17:44
Co-authored-by: PythonChicken123 <101510622+PythonChicken123@users.noreply.github.com>
refactor: integrate portablemc 5.x with in-memory loading
v0 and others added 2 commits May 10, 2026 17:54
Create build scripts and package structure for portablemc 5.x wheel generation

Co-authored-by: PythonChicken123 <101510622+PythonChicken123@users.noreply.github.com>
feat: scaffold portablemc 5.x build and packaging
Updated project description and added new features to the README.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants