Skip to content

Commit

Permalink
[rpcsx-os] add --system flag
Browse files Browse the repository at this point in the history
  • Loading branch information
DHrpcs3 committed Oct 30, 2023
1 parent 9865be8 commit 563c5ea
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 1 deletion.
1 change: 1 addition & 0 deletions orbis-kernel/include/orbis/thread/Process.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ struct Process final {

std::uint64_t nextTlsSlot = 1;
std::uint64_t lastTlsOffset = 0;
bool isSystem = false;

utils::RcIdMap<EventFlag, sint, 4097, 1> evfMap;
utils::RcIdMap<Semaphore, sint, 4097, 1> semMap;
Expand Down
2 changes: 1 addition & 1 deletion orbis-kernel/src/sys/sys_sysctl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ orbis::SysResult orbis::sys___sysctl(Thread *thread, ptr<sint> name,
// std::printf(" kern.14.35.%u\n", name[3]);
app_info result{
.appType = 0,
// .unk5 = slong(0x80000000'00000000),
.unk5 = (thread->tproc->isSystem ? slong(0x80000000'00000000) : 0),
};

return uwrite((ptr<app_info>)old, result);
Expand Down
8 changes: 8 additions & 0 deletions rpcsx-os/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -561,6 +561,7 @@ int main(int argc, const char *argv[]) {

bool enableAudio = false;
bool asRoot = false;
bool isSystem = false;

int argIndex = 1;
while (argIndex < argc) {
Expand Down Expand Up @@ -596,6 +597,12 @@ int main(int argc, const char *argv[]) {
continue;
}

if (argv[argIndex] == std::string_view("--system")) {
argIndex++;
isSystem = true;
continue;
}

if (argv[argIndex] == std::string_view("--override") ||
argv[argIndex] == std::string_view("-o")) {
if (argc <= argIndex + 2) {
Expand Down Expand Up @@ -704,6 +711,7 @@ int main(int argc, const char *argv[]) {
initProcess->onSysEnter = onSysEnter;
initProcess->onSysExit = onSysExit;
initProcess->ops = &rx::procOpsTable;
initProcess->isSystem = isSystem;

auto [baseId, mainThread] = initProcess->threadsMap.emplace();
mainThread->tproc = initProcess;
Expand Down

0 comments on commit 563c5ea

Please sign in to comment.