feat(relinker): add --skip-sce-module flag

This commit is contained in:
boykopovar
2026-09-26 16:45:41 +03:00
parent 5887c8d6e2
commit 630cb018c0
3 changed files with 10 additions and 2 deletions
+1
View File
@@ -8,6 +8,7 @@ namespace Cli {
struct Args {
bool skipSyscallCheck = false;
bool skipSceModule = false;
bool toIntel = false;
bool writeRegistry = false;
bool toWindows = false;
+3 -1
View File
@@ -13,6 +13,8 @@ Args ParseArgs(int argc, char* argv[]) {
const std::string arg = argv[i];
if (arg == "--skip-syscall-check") {
args.skipSyscallCheck = true;
} else if (arg == "--skip-sce-module") {
args.skipSceModule = true;
} else if (arg == "--to-intel") {
args.toIntel = true;
} else if (arg.rfind("unused-filter=", 0) == 0) {
@@ -51,7 +53,7 @@ Args ParseArgs(int argc, char* argv[]) {
if (args.inputPath.empty() || args.outputPath.empty())
throw std::runtime_error(
"Usage: relinker [--windows] [--windows-diagnostics] [--skip-syscall-check] [--to-intel] [unused-filter=0|1|2] [--registry] [--rpath <path>] [--lazy-binding] [--autorun] <input.elf> <output.elf>\n"
"Usage: relinker [--windows] [--windows-diagnostics] [--skip-syscall-check] [--skip-sce-module] [--to-intel] [unused-filter=0|1|2] [--registry] [--rpath <path>] [--lazy-binding] [--autorun] <input.elf> <output.elf>\n"
"Example: relinker input.elf output.elf"
);
+6 -1
View File
@@ -23,6 +23,7 @@
#include <iostream>
#include <memory>
#include <string>
#include <vector>
int main(const int argc, char* argv[]) {
Cli::Args args;
@@ -66,6 +67,7 @@ int main(const int argc, char* argv[]) {
);
std::cout << "System: " << (args.toWindows ? "Windows" : "Linux") << "; unused-filter=" << args.unusedFilterLevel << "\n";
std::cout << "sce_module/sce_modules processing: " << (args.skipSceModule ? "disabled (--skip-sce-module)" : "enabled") << '\n';
auto result = pipeline->Relink(sourceBytes);
for (const auto& patch : result.Patches) {
if (patch.Offset > sourceBytes.size() || patch.Bytes.size() > sourceBytes.size() - patch.Offset)
@@ -73,7 +75,10 @@ int main(const int argc, char* argv[]) {
for (std::size_t index = 0; index < patch.Bytes.size(); ++index) sourceBytes[patch.Offset + index] = patch.Bytes[index];
}
const auto guestArtifacts = Relinker::GuestModuleBuilder().Build(args.inputPath, absPath, result.DynamicSection, args.toWindows, args.toIntel, args.skipSyscallCheck, args.lazyBinding, args.runPath);
std::vector<Relinker::GuestArtifact> guestArtifacts;
if (!args.skipSceModule) {
guestArtifacts = Relinker::GuestModuleBuilder().Build(args.inputPath, absPath, result.DynamicSection, args.toWindows, args.toIntel, args.skipSyscallCheck, args.lazyBinding, args.runPath);
}
if (args.writeRegistry) {
const std::filesystem::path outFsPath(absPath);