mirror of
https://github.com/boykopovar/AnyPS5.git
synced 2026-11-06 13:30:00 +00:00
revert(relinker): defer the runtime modules another deferred module needs on Windows (#12621)
This reverts the code, tests and USAGE.md change of commit420b6a064e(#12621). The docs/dev/debt/relinker.md line is left for the follow-up that brings the deferral back with dependency start, to keep a running batch that edits the same file valid. Soul Hackers 2 (PPSA03743) stops about 2.6 s into boot on Windows with an access violation on UnityGfxDeviceWorker inside SPFXUnityPlugin.prx since this change. klosixgaming-arch bisected main's merge commits to420b6a064eand confirmed that undoing its dependency filter makes the title boot again (https://github.com/boykopovar/AnyPS5/pull/12621#issuecomment-6587462742). SPFXUnityPlugin (Media/Plugins) calls into Il2CppUserAssemblies (Media/Modules). With #12621 that dependency is deferred, and loading a deferred module does not start the deferred modules it needs, so it is never started. The revert restores the previous Windows behaviour, where a module another module needs starts at startup.
This commit is contained in:
1 parent
9090972b7e
commit
987ebe9855
4 files changed
+2
-27
No files matched your search
@@ -326,7 +326,7 @@ std::vector<GuestArtifact> GuestModuleBuilder::Build(const std::filesystem::path
|
||||
for (const auto provider : executableProviders) require(provider);
|
||||
for (std::size_t index = 0; index < images.size(); ++index) {
|
||||
if (!isRuntime(index)) require(index);
|
||||
if (windows) for (const auto dependency : dependencies[index]) if (standardDirectory(dependency)) require(dependency);
|
||||
if (windows) for (const auto dependency : dependencies[index]) require(dependency);
|
||||
}
|
||||
const auto deferred = [&](const std::size_t index) {
|
||||
return !required[index] && isRuntime(index);
|
||||
|
||||
@@ -415,21 +415,6 @@ void runtimeDirectories() {
|
||||
require(output.Modules.size() == 1, "Module was not converted");
|
||||
require(exports(output.Modules.front().Bytes, Relinker::GuestInitializeExport) == (std::string_view(directory) == "Media/Modules"), "Wrong start of a runtime module the executable needs");
|
||||
}
|
||||
for (const auto* directory : {"sce_module", "sce_modules", "prx", "Media/Modules"}) {
|
||||
auto source = input();
|
||||
const auto parent = source.ModuleRoot / directory;
|
||||
const auto plugins = source.ModuleRoot / "Media/Plugins";
|
||||
source.Modules.push_back({plugins / "plugin.prx", fixture("needed.prx")});
|
||||
source.Modules.push_back({parent / "needed.prx", fixture()});
|
||||
source.RuntimeDirectories.push_back(plugins);
|
||||
source.RuntimeDirectories.push_back(parent);
|
||||
const auto output = converter.Convert(std::move(source), options);
|
||||
require(output.Modules.size() == 2, "Modules were not converted");
|
||||
for (const auto& module : output.Modules) {
|
||||
const bool plugin = module.SourcePath.filename() == "plugin.prx";
|
||||
require(exports(module.Bytes, Relinker::GuestInitializeExport) == (plugin || std::string_view(directory) == "Media/Modules"), "Wrong start of a runtime module another runtime module needs");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void relocationValidation() {
|
||||
|
||||
@@ -8,7 +8,6 @@ import tempfile
|
||||
|
||||
from test_guest_intel_trampolines import main_fixture
|
||||
from test_guest_module_args import args_module, load_and_record
|
||||
from test_guest_module_dir import pe_export_names
|
||||
from test_guest_module_directories import module_with_symbol, needed_libraries
|
||||
from test_guest_needed_modules import executable_with_needed, module_with_needed
|
||||
from test_guest_symbol_names import DYNAMIC, GOT, RELOCATIONS, importing_executable
|
||||
@@ -114,15 +113,6 @@ def main():
|
||||
dependency = f"@executable_path/app0/Media/Plugins/{name}.prx.guest.prx"
|
||||
expected = root == "imported" and name == "provider"
|
||||
assert (dependency in needed) == expected, (root, name, needed)
|
||||
windows = case / "windows"
|
||||
windows.mkdir()
|
||||
target = windows / "output.exe"
|
||||
result = subprocess.run([str(relinker), "--windows", "--skip-syscall-check", "--module-dir", "Media/Plugins", str(source), str(target)],
|
||||
capture_output=True, text=True, timeout=30)
|
||||
assert result.returncode == 0, (root, result.stdout, result.stderr)
|
||||
for name in ("plugin", "consumer", "provider"):
|
||||
exports = pe_export_names((windows / "app0" / "Media" / "Plugins" / f"{name}.prx.guest.prx").read_bytes())
|
||||
assert ("__aps5_guest_initialize" in exports) == (root != "bundled"), (root, name, exports)
|
||||
if sys.platform == "linux" and os.uname().machine == "x86_64":
|
||||
libraries = case / "libs"
|
||||
libraries.mkdir()
|
||||
|
||||
+1
-1
@@ -84,7 +84,7 @@ All switches are disabled by default. `unused-filter` defaults to `0`; `--rpath`
|
||||
| `--rpath <path>` | Set the system library search path. Quote `$ORIGIN` to prevent shell expansion, for example `--rpath '$ORIGIN/libs'` in Bash or PowerShell. On Linux every colon-separated entry must be nonempty, and with guest modules each must be absolute or begin with `$ORIGIN`. Windows requires a nonempty ASCII path and supports `$ORIGIN` as the executable directory. |
|
||||
| `--autorun` | Run the output after conversion, print its exit code, and wait for Enter. Requires the target OS and prepared runtime layout. |
|
||||
| `--sce-module-path <path>` | Parent of the module directories, not the module directory itself. Default: input ELF parent; relative input paths resolve from the process working directory. Explicit absolute path: used directly. Explicit relative path (including `.` and `..`): relative to the process working directory. Output path has no effect. Requires one nonempty value; repeats, nonexistent or nondirectory paths, access failures, and combination with `--skip-sce-module` are errors. |
|
||||
| `--module-dir <dir>` | Relink the ELF modules of a directory under the module parent directory, besides `sce_module`/`sce_modules`/`prx`; outputs keep the relative path. Needed modules are mapped at startup. On Linux, modules in these extra directories initialize only when explicitly loaded, with the arguments from `sceKernelLoadStartModule` (for example Unity plugins in `Media/Plugins`). On Windows, such a module initializes when explicitly loaded unless a module outside these directories needs it, directly or through other modules; then it initializes at startup. On macOS, a module another module or the executable needs initializes at startup. Other modules initialize when loaded. Repeatable; `.` is the parent itself, without the input ELF. Conflicts with `--skip-sce-module`. |
|
||||
| `--module-dir <dir>` | Relink the ELF modules of a directory under the module parent directory, besides `sce_module`/`sce_modules`/`prx`; outputs keep the relative path. Needed modules are mapped at startup. On Linux, modules in these extra directories initialize only when explicitly loaded, with the arguments from `sceKernelLoadStartModule` (for example Unity plugins in `Media/Plugins`). A module another module needs initializes at startup on Windows and macOS; one only the executable needs initializes when explicitly loaded on Windows and at startup on macOS. Other modules initialize when loaded. Repeatable; `.` is the parent itself, without the input ELF. Conflicts with `--skip-sce-module`. |
|
||||
| `--executable <path>` | Also convert another executable of the title, which it starts with `sceSystemServiceLoadExec`; the path is relative to the module parent directory, for example `picker/picker.bin`. It is written beside the output, named after the path with `/` replaced by `.` and given the output's extension (`picker.picker.bin.exe`), and uses the same `libs/`, `app0/` and guest modules. It is an error if a guest module converts differently for it. Repeatable. Conflicts with `--skip-sce-module`. |
|
||||
| `--patches <file>` | Apply the byte patches of this file during conversion, see [game patches](#game-patches). Overrides `relinker-patches.toml` discovery. Conflicts with `--no-patches`. |
|
||||
| `--no-patches` | Do not apply patches, and do not load `relinker-patches.toml` from the input directory. |
|
||||
|
||||
Reference in new issue
Block a user