In-process JVM loading for Windows exe-restricted Minecraft launcher#6
Draft
PythonChicken123 wants to merge 24 commits into
Draft
In-process JVM loading for Windows exe-restricted Minecraft launcher#6PythonChicken123 wants to merge 24 commits into
PythonChicken123 wants to merge 24 commits into
Conversation
### 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
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Add .gitattributes to exclude generated files from diffs
Owner
Author
|
@sourcery-ai review |
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.
Contributor
|
Linting and formatting changes were found. Please run |
Owner
Author
|
@sourcery-ai review |
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
|
Sorry, we are unable to review this pull request The GitHub API does not allow us to fetch diffs exceeding 20000 lines |
Co-authored-by: PythonChicken123 <101510622+PythonChicken123@users.noreply.github.com>
refactor: integrate portablemc 5.x with in-memory loading
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
In-process JVM loading for Windows exe-restricted Minecraft launcher
Option 5 Works!