Allow "synchronous" loading of cartridge files #41
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 general, cartridge files live only in the kernel side, and cartridge processes must use an asynchronous RPC call to read them. This generally works for games made exclusively for Kate, however existing engines have varied needs of reading data "synchronously" (at least from the perspective of the game's code), so we need to support that as well.
This patch adds a way of pre-loading certain assets at the time the cartridge sandbox is being built, such that all reads of these assets from the cartridge's process appear to be synchronous (since they're moved to the cartridge's process at the time the sandbox is built). This in turn lets us support games written in RPG Maker MV and Godot 3 and 4 with no changes required on the game's code. The environment just fulfils all of the game's code expectations instead.
Note that Godot 4 games are not yet enabled in Kate due to the security vulnerability described in https://github.com/orgs/qteatime/discussions/1 --- cartridge processes need to be fully isolated before Godot 4 games can be enabled, as their processing requirements make it possible for cartridges to exploit Spectre vulnerabilities to read privileged information from the Kate kernel process, at least in theory.