forked from tobspr-games/shapez.io
-
Notifications
You must be signed in to change notification settings - Fork 34
Basic ASAR modding #61
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Conversation
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
Consider mods broken in this commit. Many areas are unfinished and use weird or missing types.
Was removed completely along with the preloader script.
The linkApp method is removed as it was unused. A getter is used to ensure best development experience. It can be further improved by adding a guard for cases where GLOBAL_APP is not set yet.
Only load the mod with highest priority for now. Proper behavior would be to keep metadata for all duplicates and load the first that isn't disabled. This allows easy mod source switching (for example, user mods and development mods)
Remove the debug option and code that used it. It is redundant due to existence of --load-mod in the Electron wrapper.
Doesn't make much sense with how experimental CE is right now. A different logic for checking whether a mod is compatible will be used later.
d96b638 to
321f517
Compare
Also fix a few issues in Electron code. This is not as polished yet, UI from old mod support was reused for now and is likely broken. Mods can be loaded, but there isn't much QoL around the support for now.
The new mod locator system now respects the --safe-mode command line switch, ignoring the user and distro mod directories.
For now it only includes a helper function to resolve file URLs and a method that adds a CSS stylesheet to the document.
Not a complete rework. This is just a temporary improvement.
Not a proper fix, but this thing needs a huge refactor anyway. Goodbye, a bug that existed ever since the first version of mod support!
Collaborator
Author
|
Still needs a lot of work, but I'll consider it mergeable now. Real mods already exist :) |
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.
Draft. Mods are broken, but the foundations for ASAR modding are laid. Interesting parts:
await import("mod://mod-id/path/to/file.js")works and resolves to a module. The code is shown in Sources panel of devtoolsimport { func } from "./other_file.js"workawait fetch("mod://mod-id/mod.json").then(r => r.text())works. Proper resources were not tested (audio/video is more interesting as it requires streaming)The entire main process mod loader framework is quite overcomplicated, but it should be easy to expand even further, such as adding auto-reload support for development purposes. Right now mods are reloaded on each get-mods IPC call which is not the ideal solution, eventually this should be split into a different IPC method.
The renderer part is missing and will report errors if any mod is loaded.