Merge pull request #80 from igor725/features

NpToolkit2, NpParty, Voice stubs
This commit is contained in:
SysRay 2024-04-11 21:24:29 +02:00 committed by GitHub
commit 523688991e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
13 changed files with 404 additions and 29 deletions

View File

@ -152,6 +152,16 @@ int SYSV_ABI sceGnmSetCsShaderWithModifier(uint32_t* cmdOut, uint64_t size, cons
return Ok;
}
int SYSV_ABI sceGnmSetEmbeddedPsShader(uint32_t* cmdOut, uint64_t size, uint32_t id, uint32_t shader_modifier) {
LOG_USE_MODULE(libSceGraphicsDriver);
LOG_TRACE(L"%S 0x%08llx", __FUNCTION__, (uint64_t)cmdOut);
cmdOut[0] = Pm4::create(size, Pm4::Custom::R_PS_EMBEDDED);
cmdOut[1] = shader_modifier;
cmdOut[2] = id;
return Ok;
}
int SYSV_ABI sceGnmSetEmbeddedVsShader(uint32_t* cmdOut, uint64_t size, uint32_t id, uint32_t shader_modifier) {
LOG_USE_MODULE(libSceGraphicsDriver);
LOG_TRACE(L"%S 0x%08llx", __FUNCTION__, (uint64_t)cmdOut);

View File

@ -5,8 +5,9 @@ set(libName libSceLibcInternal)
project(${libName})
add_library(${libName} SHARED entry.cpp mspace.cpp)
target_compile_definitions(${libName} PRIVATE BOOST_ALL_NO_LIB)
add_dependencies(${libName} core)
target_link_libraries(${libName} PRIVATE core.lib)
add_dependencies(${libName} core third_party boost)
target_link_libraries(${libName} PRIVATE core.lib libboost_thread)
setupModule(${libName})

View File

@ -5,6 +5,7 @@
#include "logging.h"
#include "types.h"
#include <boost/thread.hpp>
#include <cstdlib>
#include <vector>
LOG_DEFINE_MODULE(libSceLibcInternal);
@ -108,21 +109,39 @@ EXPORT SYSV_ABI int __NID(gmtime_s)(tm* tm, const time_t* time) {
return ::gmtime_s(tm, time);
}
EXPORT SYSV_ABI int __NID(__cxa_guard_acquire)(uint64_t* guard_object) {
static boost::recursive_mutex _guard_mtx;
struct GuardObject {
bool initHasRun;
bool inUse;
};
EXPORT SYSV_ABI int __NID(__cxa_guard_acquire)(GuardObject* go) {
LOG_USE_MODULE(libSceLibcInternal);
LOG_ERR(L"todo %S", __FUNCTION__);
if (go->initHasRun) return 0;
_guard_mtx.lock();
if (go->initHasRun) {
_guard_mtx.unlock();
return 0;
}
if (go->inUse) LOG_CRIT(L"initializer for function local static variable called enclosing function");
go->inUse = true;
return 1;
}
EXPORT SYSV_ABI int __NID(__cxa_guard_release)(GuardObject* go) {
go->initHasRun = true;
_guard_mtx.unlock();
return 0;
}
EXPORT SYSV_ABI int __NID(__cxa_guard_release)(uint64_t* guard_object) {
LOG_USE_MODULE(libSceLibcInternal);
LOG_ERR(L"todo %S", __FUNCTION__);
return 0;
}
EXPORT SYSV_ABI int __NID(__cxa_guard_abort)(uint64_t* guard_object) {
LOG_USE_MODULE(libSceLibcInternal);
LOG_ERR(L"todo %S", __FUNCTION__);
EXPORT SYSV_ABI int __NID(__cxa_guard_abort)(GuardObject* go) {
_guard_mtx.unlock();
go->inUse = false;
return 0;
}

View File

@ -0,0 +1,9 @@
cmake_minimum_required(VERSION 3.24)
include(../setupModule.cmake)
set(libName libSceNpParty)
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,23 @@
#include "codes.h"
#include "common.h"
#include "logging.h"
#include "types.h"
LOG_DEFINE_MODULE(libSceNpParty);
extern "C" {
EXPORT const char* MODULE_NAME = "libSceNpParty";
EXPORT SYSV_ABI int32_t sceNpPartyInitialize() {
LOG_USE_MODULE(libSceNpParty);
LOG_ERR(L"todo %S", __FUNCTION__);
return Ok;
}
EXPORT SYSV_ABI int32_t sceNpPartyCheckCallback() {
LOG_USE_MODULE(libSceNpParty);
LOG_ERR(L"todo %S", __FUNCTION__);
return Ok;
}
}

View File

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

View File

@ -152,4 +152,249 @@ EXPORT SYSV_ABI int __NID(_ZN3sce7Toolkit2NP2V26Trophy7Request6UnlockD1Ev)() {
LOG_ERR(L"todo %S", __FUNCTION__);
return Ok;
}
/**
* @brief sce::Toolkit::NP::V2::Core::Response<sce::Toolkit::NP::V2::NetworkUtils::NetStateBasic>::Response()
*
*/
EXPORT SYSV_ABI int32_t __NID(_ZN3sce7Toolkit2NP2V24Core8ResponseINS2_12NetworkUtils13NetStateBasicEEC1Ev)() {
LOG_USE_MODULE(libSceNpToolkit2);
LOG_ERR(L"todo %S", __FUNCTION__);
return Ok;
}
/**
* @brief sce::Toolkit::NP::V2::Core::Response<sce::Toolkit::NP::V2::Friend::Friends>::Response()
*
*/
EXPORT SYSV_ABI int32_t __NID(_ZN3sce7Toolkit2NP2V24Core8ResponseINS2_6Friend7FriendsEEC1Ev)() {
LOG_USE_MODULE(libSceNpToolkit2);
LOG_ERR(L"todo %S", __FUNCTION__);
return Ok;
}
/**
* @brief sce::Toolkit::NP::V2::Core::Response<sce::Toolkit::NP::V2::Friend::BlockedUsers>::Response()
*
*/
EXPORT SYSV_ABI int32_t __NID(_ZN3sce7Toolkit2NP2V24Core8ResponseINS2_6Friend12BlockedUsersEEC1Ev)() {
LOG_USE_MODULE(libSceNpToolkit2);
LOG_ERR(L"todo %S", __FUNCTION__);
return Ok;
}
/**
* @brief sce::Toolkit::NP::V2::NetworkUtils::Request::GetBasicNetworkInfo::GetBasicNetworkInfo()
*
*/
EXPORT SYSV_ABI int32_t __NID(_ZN3sce7Toolkit2NP2V212NetworkUtils7Request19GetBasicNetworkInfoC1Ev)() {
LOG_USE_MODULE(libSceNpToolkit2);
LOG_ERR(L"todo %S", __FUNCTION__);
return Ok;
}
/**
* @brief sce::Toolkit::NP::V2::Matching::Room::Room()
*
*/
EXPORT SYSV_ABI int32_t __NID(_ZN3sce7Toolkit2NP2V28Matching4RoomC1Ev)() {
LOG_USE_MODULE(libSceNpToolkit2);
LOG_ERR(L"todo %S", __FUNCTION__);
return Ok;
}
/**
* @brief sce::Toolkit::NP::V2::NetworkUtils::getBasicNetworkInfo(sce::Toolkit::NP::V2::NetworkUtils::Request::GetBasicNetworkInfo const&,
* sce::Toolkit::NP::V2::Core::Response<sce::Toolkit::NP::V2::NetworkUtils::NetStateBasic>*)
*
*/
EXPORT SYSV_ABI int32_t
__NID(_ZN3sce7Toolkit2NP2V212NetworkUtils19getBasicNetworkInfoERKNS3_7Request19GetBasicNetworkInfoEPNS2_4Core8ResponseINS3_13NetStateBasicEEE)() {
LOG_USE_MODULE(libSceNpToolkit2);
LOG_ERR(L"todo %S", __FUNCTION__);
return Ok;
}
/**
* @brief sce::Toolkit::NP::V2::Core::Response<sce::Toolkit::NP::V2::Matching::Room>::Response()
*
*/
EXPORT SYSV_ABI int32_t __NID(_ZN3sce7Toolkit2NP2V24Core8ResponseINS2_8Matching4RoomEEC1Ev)() {
LOG_USE_MODULE(libSceNpToolkit2);
LOG_ERR(L"todo %S", __FUNCTION__);
return Ok;
}
/**
* @brief sce::Toolkit::NP::V2::NetworkUtils::Request::GetBasicNetworkInfo::~GetBasicNetworkInfo()
*
*/
EXPORT SYSV_ABI int32_t __NID(_ZN3sce7Toolkit2NP2V212NetworkUtils7Request19GetBasicNetworkInfoD1Ev)() {
LOG_USE_MODULE(libSceNpToolkit2);
LOG_ERR(L"todo %S", __FUNCTION__);
return Ok;
}
/**
* @brief sce::Toolkit::NP::V2::Core::Response<sce::Toolkit::NP::V2::Matching::Rooms>::Response()
*
*/
EXPORT SYSV_ABI int32_t __NID(_ZN3sce7Toolkit2NP2V24Core8ResponseINS2_8Matching5RoomsEEC1Ev)() {
LOG_USE_MODULE(libSceNpToolkit2);
LOG_ERR(L"todo %S", __FUNCTION__);
return Ok;
}
/**
* @brief sce::Toolkit::NP::V2::Matching::AttributeMetadata::AttributeMetadata()
*
*/
EXPORT SYSV_ABI int32_t __NID(_ZN3sce7Toolkit2NP2V28Matching17AttributeMetadataC1Ev)() {
LOG_USE_MODULE(libSceNpToolkit2);
LOG_ERR(L"todo %S", __FUNCTION__);
return Ok;
}
/**
* @brief sce::Toolkit::NP::V2::Matching::Request::SetInitConfiguration::SetInitConfiguration()
*
*/
EXPORT SYSV_ABI int32_t __NID(_ZN3sce7Toolkit2NP2V28Matching7Request20SetInitConfigurationC1Ev)() {
LOG_USE_MODULE(libSceNpToolkit2);
LOG_ERR(L"todo %S", __FUNCTION__);
return Ok;
}
/**
* @brief sce::Toolkit::NP::V2::Matching::setInitConfiguration(sce::Toolkit::NP::V2::Matching::Request::SetInitConfiguration const&,
* sce::Toolkit::NP::V2::Core::Response<sce::Toolkit::NP::V2::Core::Empty>*)
*
*/
EXPORT SYSV_ABI int32_t __NID(_ZN3sce7Toolkit2NP2V28Matching20setInitConfigurationERKNS3_7Request20SetInitConfigurationEPNS2_4Core8ResponseINS8_5EmptyEEE)() {
LOG_USE_MODULE(libSceNpToolkit2);
LOG_ERR(L"todo %S", __FUNCTION__);
return Ok;
}
/**
* @brief sce::Toolkit::NP::V2::Matching::Request::SetInitConfiguration::~SetInitConfiguration()
*
*/
EXPORT SYSV_ABI int32_t __NID(_ZN3sce7Toolkit2NP2V28Matching7Request20SetInitConfigurationD1Ev)() {
LOG_USE_MODULE(libSceNpToolkit2);
LOG_ERR(L"todo %S", __FUNCTION__);
return Ok;
}
/**
* @brief sce::Toolkit::NP::V2::Matching::AttributeMetadata::~AttributeMetadata()
*
*/
EXPORT SYSV_ABI int32_t __NID(_ZN3sce7Toolkit2NP2V28Matching17AttributeMetadataD1Ev)() {
LOG_USE_MODULE(libSceNpToolkit2);
LOG_ERR(L"todo %S", __FUNCTION__);
return Ok;
}
/**
* @brief ???
*
*/
EXPORT SYSV_ABI int32_t __NID_HEX(F53AE1B86CDB7AB4)() {
LOG_USE_MODULE(libSceNpToolkit2);
LOG_ERR(L"todo %S", __FUNCTION__);
return Ok;
}
/**
* @brief sce::Toolkit::NP::V2::Core::Response<sce::Toolkit::NP::V2::Session::SessionId>::Response()
*
*/
EXPORT SYSV_ABI int32_t __NID(_ZN3sce7Toolkit2NP2V24Core8ResponseINS2_7Session9SessionIdEEC1Ev)() {
LOG_USE_MODULE(libSceNpToolkit2);
LOG_ERR(L"todo %S", __FUNCTION__);
return Ok;
}
/**
* @brief sce::Toolkit::NP::V2::Core::Response<sce::Toolkit::NP::V2::Session::Session>::Response()
*
*/
EXPORT SYSV_ABI int32_t __NID(_ZN3sce7Toolkit2NP2V24Core8ResponseINS2_7Session7SessionEEC1Ev)() {
LOG_USE_MODULE(libSceNpToolkit2);
LOG_ERR(L"todo %S", __FUNCTION__);
return Ok;
}
/**
* @brief sce::Toolkit::NP::V2::Core::Response<sce::Toolkit::NP::V2::Session::SessionId>::reset()
*
*/
EXPORT SYSV_ABI int32_t __NID(_ZN3sce7Toolkit2NP2V24Core8ResponseINS2_7Session9SessionIdEE5resetEv)() {
LOG_USE_MODULE(libSceNpToolkit2);
LOG_ERR(L"todo %S", __FUNCTION__);
return Ok;
}
/**
* @brief sce::Toolkit::NP::V2::Core::Response<sce::Toolkit::NP::V2::Core::Empty>::reset()
*
*/
EXPORT SYSV_ABI int32_t __NID(_ZN3sce7Toolkit2NP2V24Core8ResponseINS3_5EmptyEE5resetEv)() {
LOG_USE_MODULE(libSceNpToolkit2);
LOG_ERR(L"todo %S", __FUNCTION__);
return Ok;
}
/**
* @brief sce::Toolkit::NP::V2::Core::Response<sce::Toolkit::NP::V2::Session::Session>::reset()
*
*/
EXPORT SYSV_ABI int32_t __NID(_ZN3sce7Toolkit2NP2V24Core8ResponseINS2_7Session7SessionEE5resetEv)() {
LOG_USE_MODULE(libSceNpToolkit2);
LOG_ERR(L"todo %S", __FUNCTION__);
return Ok;
}
/**
* @brief sce::Toolkit::NP::V2::Core::Response<sce::Toolkit::NP::V2::Session::SessionData>::Response()
*
*/
EXPORT SYSV_ABI int32_t __NID(_ZN3sce7Toolkit2NP2V24Core8ResponseINS2_7Session11SessionDataEEC1Ev)() {
LOG_USE_MODULE(libSceNpToolkit2);
LOG_ERR(L"todo %S", __FUNCTION__);
return Ok;
}
/**
* @brief sce::Toolkit::NP::V2::Core::ResponseBase::getState() const
*
*/
EXPORT SYSV_ABI int32_t __NID(_ZNK3sce7Toolkit2NP2V24Core12ResponseBase8getStateEv)() {
LOG_USE_MODULE(libSceNpToolkit2);
LOG_ERR(L"todo %S", __FUNCTION__);
return Ok;
}
}

View File

@ -0,0 +1,9 @@
cmake_minimum_required(VERSION 3.24)
include(../setupModule.cmake)
set(libName libSceVoice)
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,29 @@
#include "codes.h"
#include "common.h"
#include "logging.h"
#include "types.h"
LOG_DEFINE_MODULE(libSceVoice);
extern "C" {
EXPORT const char* MODULE_NAME = "libSceVoice";
EXPORT SYSV_ABI int32_t sceVoiceInit() {
LOG_USE_MODULE(libSceVoice);
LOG_ERR(L"todo %S", __FUNCTION__);
return Ok;
}
EXPORT SYSV_ABI int32_t sceVoiceSetThreadsParams() {
LOG_USE_MODULE(libSceVoice);
LOG_ERR(L"todo %S", __FUNCTION__);
return Ok;
}
EXPORT SYSV_ABI int32_t sceVoiceStart() {
LOG_USE_MODULE(libSceVoice);
LOG_ERR(L"todo %S", __FUNCTION__);
return Ok;
}
}

View File

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

View File

@ -1,4 +1,4 @@
import fs from 'fs';
import fs from 'fs/promises';
import path from 'path';
import process, { argv } from 'process';
import { spawn } from 'child_process';
@ -10,19 +10,21 @@ const runTest = (binary) => {
const noExt = path.parse(binary).name;
const binPath = path.join(testsDir, binary);
const testPath = `testRunner\\summary\\${noExt}.json`;
let testTimer = null;
spawn(binPath, [`--gtest_output=json:${testPath}`]).on('exit', (code) => {
resolve([testPath, code]);
const proc = spawn(binPath, [`--gtest_output=json:${testPath}`]).on('exit', (code) => {
if (testTimer != null) clearTimeout(testTimer);
resolve([testPath, binPath, code]);
});
testTimer = setTimeout(() => {
proc.kill();
testTimer = null;
}, 2000);
});
};
fs.readdir(testsDir, (err, files) => {
if (err !== null) {
console.error('Could not scan the directory: ', err);
process.exit(1);
}
fs.readdir(testsDir).then((files) => {
const procs = [];
files.forEach((file, idx) => {
@ -34,13 +36,16 @@ fs.readdir(testsDir, (err, files) => {
const md_fd = process.stdout;
md_fd.write('# Test results🚀\n\n');
Promise.all(procs).then((values) => {
values.forEach((ret) => {
fs.readFile(ret[0], 'utf-8', (err, data) => {
if (err !== null) {
console.error('Failed to open %s: %s', ret[0], err);
return;
}
const iops = [];
let someCrashed = false;
values.forEach((ret) => {
if (ret[2] !== 0) {
someCrashed = true;
return;
}
iops.push(fs.readFile(ret[0], 'utf-8').then((data) => {
try {
const jdata = JSON.parse(data);
md_fd.write(`## ${jdata.name} (${jdata.time})\n`);
@ -53,7 +58,20 @@ fs.readdir(testsDir, (err, files) => {
} catch (ex) {
console.error(ex);
}
});
}).catch((err) => {
console.error('Failed to open %s: %s', ret[0], err);
}));
});
Promise.all(iops).then(() => {
if (someCrashed === true) {
md_fd.write('\n## Some tests were crashed or killed!😱\n');
values.forEach((ret) => ret[2] !== 0 ? md_fd.write(`* ${ret[1]}: ${ret[2] == null ? 'timeout' : ret[2]}\n`) : false);
md_fd.write('\n');
}
});
});
}).catch((err) => {
console.error('Could not scan the directory: ', err);
process.exit(1);
});