mirror of
https://github.com/boykopovar/AnyPS5.git
synced 2026-10-10 01:28:44 +02:00
feat(relinker): add --skip-sce-module flag
This commit is contained in:
@@ -8,6 +8,7 @@ namespace Cli {
|
||||
|
||||
struct Args {
|
||||
bool skipSyscallCheck = false;
|
||||
bool skipSceModule = false;
|
||||
bool toIntel = false;
|
||||
bool writeRegistry = false;
|
||||
bool toWindows = false;
|
||||
|
||||
@@ -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"
|
||||
);
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user