mirror of
https://github.com/SysRay/psOff_public.git
synced 2024-11-23 14:29:39 +00:00
More stubs
This commit is contained in:
parent
323559712e
commit
db3e6f04a2
@ -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) {
|
||||
@ -624,4 +656,4 @@ int64_t lwfsLseek(int fd, int64_t offset, int whence) {
|
||||
size_t lwfsWrite(int fd, const void* buf, size_t nbytes) {
|
||||
return Ok;
|
||||
}
|
||||
} // namespace filesystem
|
||||
} // namespace filesystem
|
||||
|
@ -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;
|
||||
}
|
||||
|
9
modules/libSceHttp2/CMakeLists.txt
Normal file
9
modules/libSceHttp2/CMakeLists.txt
Normal 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})
|
4
modules/libSceHttp2/codes.h
Normal file
4
modules/libSceHttp2/codes.h
Normal file
@ -0,0 +1,4 @@
|
||||
#pragma once
|
||||
#include <stdint.h>
|
||||
|
||||
namespace Err {} // namespace Err
|
15
modules/libSceHttp2/entry.cpp
Normal file
15
modules/libSceHttp2/entry.cpp
Normal 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;
|
||||
}
|
||||
}
|
2
modules/libSceHttp2/types.h
Normal file
2
modules/libSceHttp2/types.h
Normal file
@ -0,0 +1,2 @@
|
||||
#pragma once
|
||||
#include "codes.h"
|
9
modules/libSceJson2/CMakeLists.txt
Normal file
9
modules/libSceJson2/CMakeLists.txt
Normal 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})
|
4
modules/libSceJson2/codes.h
Normal file
4
modules/libSceJson2/codes.h
Normal file
@ -0,0 +1,4 @@
|
||||
#pragma once
|
||||
#include <stdint.h>
|
||||
|
||||
namespace Err {} // namespace Err
|
108
modules/libSceJson2/entry.cpp
Normal file
108
modules/libSceJson2/entry.cpp
Normal 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;
|
||||
}
|
||||
|
||||
}
|
2
modules/libSceJson2/types.h
Normal file
2
modules/libSceJson2/types.h
Normal file
@ -0,0 +1,2 @@
|
||||
#pragma once
|
||||
#include "codes.h"
|
9
modules/libSceNpWebApi2/CMakeLists.txt
Normal file
9
modules/libSceNpWebApi2/CMakeLists.txt
Normal 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})
|
4
modules/libSceNpWebApi2/codes.h
Normal file
4
modules/libSceNpWebApi2/codes.h
Normal file
@ -0,0 +1,4 @@
|
||||
#pragma once
|
||||
#include <stdint.h>
|
||||
|
||||
namespace Err {} // namespace Err
|
15
modules/libSceNpWebApi2/entry.cpp
Normal file
15
modules/libSceNpWebApi2/entry.cpp
Normal 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;
|
||||
}
|
||||
}
|
2
modules/libSceNpWebApi2/types.h
Normal file
2
modules/libSceNpWebApi2/types.h
Normal file
@ -0,0 +1,2 @@
|
||||
#pragma once
|
||||
#include "codes.h"
|
@ -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;
|
||||
|
@ -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);
|
||||
}
|
||||
@ -177,4 +181,4 @@ EXPORT SYSV_ABI int64_t sceKernelLwfsLseek(int fd, int64_t offset, int whence) {
|
||||
EXPORT SYSV_ABI size_t sceKernelLwfsWrite(int fd, const void* buf, size_t nbytes) {
|
||||
return filesystem::lwfsWrite(fd, buf, nbytes);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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;
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user