More stubs

This commit is contained in:
igor725 2024-03-17 02:47:48 +03:00
parent 323559712e
commit db3e6f04a2
No known key found for this signature in database
GPG Key ID: 46F13BBE46F8569D
17 changed files with 249 additions and 20 deletions

View File

@ -353,8 +353,40 @@ size_t readv(int handle, const SceKernelIovec* iov, int iovcnt) {
size_t writev(int handle, const SceKernelIovec* iov, int iovcnt) {
LOG_USE_MODULE(filesystem);
LOG_ERR(L"todo %S", __FUNCTION__);
return Ok;
if (handle < FILE_DESCRIPTOR_MIN) {
return getErr(ErrCode::_EPERM);
}
auto file = accessFileManager().getFile(handle);
if (file == nullptr) {
return getErr(ErrCode::_EBADF);
}
if (!(*file)) {
LOG_TRACE(L"file end");
return 0;
}
size_t count = 0;
for (int n = 0; n < iovcnt; n++) {
auto* item = &iov[n];
if (item->iov_base == nullptr || item->iov_len == 0) continue;
auto const start = file->tellp();
file->write((const char*)item->iov_base, item->iov_len);
LOG_TRACE(L"KernelWrite[%d]: 0x%08llx:%llu write(%lld)", handle, (uint64_t)item->iov_base, item->iov_len, start);
count = file->tellp() - start;
if (!(*file)) {
LOG_TRACE(L"file end");
break;
}
}
return count;
}
int fchmod(int fd, SceKernelMode mode) {

View File

@ -204,7 +204,7 @@ EXPORT SYSV_ABI int32_t sceAudioOutClose(int32_t handle) {
EXPORT SYSV_ABI int32_t sceAudioOutOutput(int32_t handle, const void* ptr) {
auto pimpl = getData();
boost::unique_lock const lock(pimpl->mutexInt);
// boost::unique_lock const lock(pimpl->mutexInt);
return writeOut(pimpl, handle, ptr);
}
@ -240,7 +240,7 @@ EXPORT SYSV_ABI int32_t sceAudioOutSetVolume(int32_t handle, int32_t flag, int32
EXPORT SYSV_ABI int32_t sceAudioOutOutputs(SceAudioOutOutputParam* param, uint32_t num) {
auto pimpl = getData();
boost::unique_lock const lock(pimpl->mutexInt);
// boost::unique_lock const lock(pimpl->mutexInt); // dont block, causes audio artifacts
for (uint32_t i = 0; i < num; i++) {
if (auto err = writeOut(pimpl, param[i].handle, param[i].ptr); err != 0) return err;
}

View File

@ -0,0 +1,9 @@
cmake_minimum_required(VERSION 3.24)
include(../setupModule.cmake)
set(libName libSceHttp2)
project(${libName})
add_library(${libName} SHARED entry.cpp)
setupModule(${libName})

View File

@ -0,0 +1,4 @@
#pragma once
#include <stdint.h>
namespace Err {} // namespace Err

View File

@ -0,0 +1,15 @@
#include "codes.h"
#include "common.h"
#include "logging.h"
#include "types.h"
LOG_DEFINE_MODULE(libSceHttp2);
extern "C" {
EXPORT const char* MODULE_NAME = "libSceHttp2";
EXPORT SYSV_ABI int32_t sceHttp2Init() {
return Ok;
}
}

View File

@ -0,0 +1,2 @@
#pragma once
#include "codes.h"

View File

@ -0,0 +1,9 @@
cmake_minimum_required(VERSION 3.24)
include(../setupModule.cmake)
set(libName libSceJson2)
project(${libName})
add_library(${libName} SHARED entry.cpp)
setupModule(${libName})

View File

@ -0,0 +1,4 @@
#pragma once
#include <stdint.h>
namespace Err {} // namespace Err

View File

@ -0,0 +1,108 @@
#include "codes.h"
#include "common.h"
#include "logging.h"
#include "types.h"
LOG_DEFINE_MODULE(libSceJson2);
extern "C" {
EXPORT const char* MODULE_NAME = "libSceJson";
EXPORT SYSV_ABI int32_t __NID(_ZN3sce4Json12MemAllocatorC2Ev)() {
LOG_USE_MODULE(libSceJson2);
LOG_ERR(L"todo %S", __FUNCTION__);
return Ok;
}
EXPORT SYSV_ABI int32_t __NID(_ZN3sce4Json5ValueC1Ev)() {
LOG_USE_MODULE(libSceJson2);
LOG_ERR(L"todo %S", __FUNCTION__);
return Ok;
}
EXPORT SYSV_ABI int32_t __NID(_ZN3sce4Json5Value3setEb)() {
LOG_USE_MODULE(libSceJson2);
LOG_ERR(L"todo %S", __FUNCTION__);
return Ok;
}
EXPORT SYSV_ABI int32_t __NID(_ZN3sce4Json5Value3setEl)() {
LOG_USE_MODULE(libSceJson2);
LOG_ERR(L"todo %S", __FUNCTION__);
return Ok;
}
EXPORT SYSV_ABI int32_t __NID(_ZN3sce4Json5Value3setEm)() {
LOG_USE_MODULE(libSceJson2);
LOG_ERR(L"todo %S", __FUNCTION__);
return Ok;
}
EXPORT SYSV_ABI int32_t __NID(_ZN3sce4Json5Value3setEd)() {
LOG_USE_MODULE(libSceJson2);
LOG_ERR(L"todo %S", __FUNCTION__);
return Ok;
}
EXPORT SYSV_ABI int32_t __NID(_ZN3sce4Json6StringC1EPKc)() {
LOG_USE_MODULE(libSceJson2);
LOG_ERR(L"todo %S", __FUNCTION__);
return Ok;
}
EXPORT SYSV_ABI int32_t __NID(_ZN3sce4Json5Value3setERKNS0_6StringE)() {
LOG_USE_MODULE(libSceJson2);
LOG_ERR(L"todo %S", __FUNCTION__);
return Ok;
}
EXPORT SYSV_ABI int32_t __NID(_ZN3sce4Json6StringD1Ev)() {
LOG_USE_MODULE(libSceJson2);
LOG_ERR(L"todo %S", __FUNCTION__);
return Ok;
}
EXPORT SYSV_ABI int32_t __NID(_ZN3sce4Json5Value3setENS0_9ValueTypeE)() {
LOG_USE_MODULE(libSceJson2);
LOG_ERR(L"todo %S", __FUNCTION__);
return Ok;
}
EXPORT SYSV_ABI int32_t __NID_HEX(5923AE81EE48B028)() {
LOG_USE_MODULE(libSceJson2);
LOG_ERR(L"todo %S", __FUNCTION__);
return Ok;
}
EXPORT SYSV_ABI int32_t __NID_HEX(12EF798E6AA7E51C)() {
LOG_USE_MODULE(libSceJson2);
LOG_ERR(L"todo %S", __FUNCTION__);
return Ok;
}
EXPORT SYSV_ABI int32_t __NID_HEX(236402F0F6212566)() {
LOG_USE_MODULE(libSceJson2);
LOG_ERR(L"todo %S", __FUNCTION__);
return Ok;
}
EXPORT SYSV_ABI int32_t __NID(_ZN3sce4Json11InitializerC1Ev)() {
LOG_USE_MODULE(libSceJson2);
LOG_ERR(L"todo %S", __FUNCTION__);
return Ok;
}
EXPORT SYSV_ABI int32_t __NID(_ZN3sce4Json11Initializer10initializeEPKNS0_14InitParameter2E)() {
LOG_USE_MODULE(libSceJson2);
LOG_ERR(L"todo %S", __FUNCTION__);
return Ok;
}
EXPORT SYSV_ABI int32_t __NID_HEX(F9DAC3172012EAEE)() {
LOG_USE_MODULE(libSceJson2);
LOG_ERR(L"todo %S", __FUNCTION__);
return Ok;
}
}

View File

@ -0,0 +1,2 @@
#pragma once
#include "codes.h"

View File

@ -0,0 +1,9 @@
cmake_minimum_required(VERSION 3.24)
include(../setupModule.cmake)
set(libName libSceNpWebApi2)
project(${libName})
add_library(${libName} SHARED entry.cpp)
setupModule(${libName})

View File

@ -0,0 +1,4 @@
#pragma once
#include <stdint.h>
namespace Err {} // namespace Err

View File

@ -0,0 +1,15 @@
#include "codes.h"
#include "common.h"
#include "logging.h"
#include "types.h"
LOG_DEFINE_MODULE(libSceNpWebApi2);
extern "C" {
EXPORT const char* MODULE_NAME = "libSceNpWebApi2";
EXPORT SYSV_ABI int32_t sceNpWebApi2Initialize() {
return Ok;
}
}

View File

@ -0,0 +1,2 @@
#pragma once
#include "codes.h"

View File

@ -68,16 +68,6 @@ EXPORT SYSV_ABI void __NID(_exit)(int code) {
::exit(code);
}
EXPORT SYSV_ABI size_t __NID(_writev)(int fd, const struct iovec* iov, int iovcn) {
size_t total = 0;
for (int i = 0; i < iovcn; i++) {
total += ::fwrite(iov[i].iov_base, 1, iov[i].iov_len, stdout);
}
return total;
}
EXPORT SYSV_ABI int __NID(_is_signal_return)(uint64_t* param) {
if ((uintptr_t)param < 4 * 1024) return 1;
if (param[0] != 0x48006a40247c8d48 || param[1] != 0x050f000001a1c0c7 || (param[2] & 0xffffff) != 0xfdebf4)
@ -115,6 +105,25 @@ EXPORT SYSV_ABI int sceKernelInternalMemoryGetModuleSegmentInfo(ModulInfo* info)
return Ok;
}
EXPORT SYSV_ABI int sceKernelConvertUtcToLocaltime(time_t time, time_t* local_time, struct timesec* st, unsigned long* dstsec) {
const auto* tz = std::chrono::current_zone();
auto sys_inf = tz->get_info(std::chrono::system_clock::now());
*local_time = sys_inf.offset.count() + sys_inf.save.count() * 60 + time;
if (st != nullptr) {
st->t = time;
st->westsec = sys_inf.offset.count() * 60;
st->dstsec = sys_inf.save.count() * 60;
}
if (dstsec != nullptr) {
*dstsec = sys_inf.save.count() * 60;
}
return 0;
}
EXPORT SYSV_ABI unsigned int sceKernelSleep(unsigned int seconds) {
boost::this_thread::sleep_for(boost::chrono::seconds(seconds));
return Ok;

View File

@ -74,6 +74,10 @@ EXPORT SYSV_ABI size_t __NID(_readv)(int handle, const filesystem::SceKernelIove
return POSIX_CALL(filesystem::readv(handle, iov, iovcnt));
}
EXPORT SYSV_ABI size_t __NID(_writev)(int handle, const filesystem::SceKernelIovec* iov, int iovcnt) {
return POSIX_CALL(filesystem::writev(handle, iov, iovcnt));
}
EXPORT SYSV_ABI size_t sceKernelWritev(int handle, const filesystem::SceKernelIovec* iov, int iovcnt) {
return filesystem::writev(handle, iov, iovcnt);
}

View File

@ -6,7 +6,7 @@
using SceKernelModule = int32_t;
using get_thread_atexit_count_func_t = SYSV_ABI int (*)(SceKernelModule);
using thread_atexit_report_func_t = SYSV_ABI void (*)(SceKernelModule);
using thread_atexit_report_func_t = SYSV_ABI void (*)(SceKernelModule);
typedef int SceKernelAioSubmitId;
typedef void* sigset_t;
@ -92,7 +92,8 @@ struct rusage_t {
uint32_t ru_nivcsw = 0;
};
struct iovec {
void* iov_base;
size_t iov_len;
struct timesec {
time_t t;
unsigned long westsec;
unsigned long dstsec;
};