Implement getargc and getargv (#3562)

* Implement getargc and getargv

* update copyright year

* the loathsome clang-formatter
This commit is contained in:
kalaposfos13
2025-09-09 23:58:22 +02:00
committed by GitHub
parent c05695fde5
commit 4abc6b3010
4 changed files with 22 additions and 9 deletions

View File

@@ -1,4 +1,4 @@
// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project
// SPDX-FileCopyrightText: Copyright 2025 shadPS4 Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later
#include <thread>
@@ -35,6 +35,7 @@
#include <common/singleton.h>
#include <core/libraries/network/net_error.h>
#include <core/libraries/network/sockets.h>
#include <core/linker.h>
#include "aio.h"
namespace Libraries::Kernel {
@@ -47,6 +48,8 @@ static std::condition_variable_any cv_asio_req;
static std::atomic<u32> asio_requests;
static std::jthread service_thread;
Core::EntryParams entry_params{};
void KernelSignalRequest() {
std::unique_lock lock{m_asio_req};
++asio_requests;
@@ -245,6 +248,14 @@ s32 PS4_SYSV_ABI sceKernelGetSystemSwVersion(SwVersionStruct* ret) {
return ORBIS_OK;
}
s32 PS4_SYSV_ABI getargc() {
return entry_params.argc;
}
const char** PS4_SYSV_ABI getargv() {
return entry_params.argv;
}
void RegisterLib(Core::Loader::SymbolsResolver* sym) {
service_thread = std::jthread{KernelServiceThread};
@@ -314,6 +325,8 @@ void RegisterLib(Core::Loader::SymbolsResolver* sym) {
LIB_FUNCTION("4oXYe9Xmk0Q", "libkernel", 1, "libkernel", sceKernelGetGPI);
LIB_FUNCTION("ca7v6Cxulzs", "libkernel", 1, "libkernel", sceKernelSetGPO);
LIB_FUNCTION("iKJMWrAumPE", "libkernel", 1, "libkernel", getargc);
LIB_FUNCTION("FJmglmTMdr4", "libkernel", 1, "libkernel", getargv);
}
} // namespace Libraries::Kernel

View File

@@ -1,10 +1,11 @@
// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project
// SPDX-FileCopyrightText: Copyright 2025 shadPS4 Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later
#pragma once
#include "common/types.h"
#include "core/libraries/kernel/orbis_error.h"
#include "core/linker.h"
namespace Core::Loader {
class SymbolsResolver;
@@ -17,6 +18,8 @@ s32 ErrnoToSceKernelError(s32 e);
void SetPosixErrno(s32 e);
s32* PS4_SYSV_ABI __Error();
extern Core::EntryParams entry_params;
template <class F, F f>
struct OrbisWrapperImpl;

View File

@@ -1,4 +1,4 @@
// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project
// SPDX-FileCopyrightText: Copyright 2025 shadPS4 Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later
#include "common/alignment.h"
@@ -13,6 +13,7 @@
#include "core/aerolib/aerolib.h"
#include "core/aerolib/stubs.h"
#include "core/devtools/widget/module_list.h"
#include "core/libraries/kernel/kernel.h"
#include "core/libraries/kernel/memory.h"
#include "core/libraries/kernel/threads.h"
#include "core/linker.h"
@@ -135,7 +136,7 @@ void Linker::Execute(const std::vector<std::string> args) {
ASSERT_MSG(result == 0, "Unable to emulate libSceGnmDriver initialization");
// Start main module.
EntryParams params{};
EntryParams& params = Libraries::Kernel::entry_params;
params.argc = 1;
params.argv[0] = "eboot.bin";
if (!args.empty()) {

View File

@@ -1,4 +1,4 @@
// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project
// SPDX-FileCopyrightText: Copyright 2025 shadPS4 Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later
#pragma once
@@ -17,10 +17,6 @@
#include "video_core/texture_cache/sampler.h"
#include "video_core/texture_cache/tile_manager.h"
namespace Core::Libraries::VideoOut {
struct BufferAttributeGroup;
}
namespace VideoCore {
class BufferCache;