Merge pull request #107 from shadps4-emu/modules4

More module work focused on undertale
This commit is contained in:
georgemoralis 2024-04-05 20:41:26 +03:00 committed by GitHub
commit 598a6a88e0
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
23 changed files with 1068 additions and 36 deletions

View File

@ -98,6 +98,10 @@ set(AUDIO_CORE src/audio_core/sdl_audio.cpp
) )
set(LIBRARIES src/core/libraries/library_common.h set(LIBRARIES src/core/libraries/library_common.h
src/core/libraries/error_codes.h src/core/libraries/error_codes.h
src/core/libraries/libsceaudioin.cpp
src/core/libraries/libsceaudioin.h
src/core/libraries/libsceaudioout.cpp
src/core/libraries/libsceaudioout.h
src/core/libraries/libkernel.cpp src/core/libraries/libkernel.cpp
src/core/libraries/libkernel.h src/core/libraries/libkernel.h
src/core/libraries/libscecommondialog.cpp src/core/libraries/libscecommondialog.cpp
@ -124,8 +128,6 @@ set(LIBRARIES src/core/libraries/library_common.h
src/core/libraries/libscesystemservice.h src/core/libraries/libscesystemservice.h
src/core/libraries/libsceuserservice.cpp src/core/libraries/libsceuserservice.cpp
src/core/libraries/libsceuserservice.h src/core/libraries/libsceuserservice.h
src/core/libraries/libsceaudioout.cpp
src/core/libraries/libsceaudioout.h
) )
set(LIBC_SOURCES src/core/hle/libraries/libc/libc.cpp set(LIBC_SOURCES src/core/hle/libraries/libc/libc.cpp

View File

@ -19,6 +19,37 @@ void GameController::readState(State* state, bool* isConnected, int* connectedCo
*state = getLastState(); *state = getLastState();
} }
int GameController::ReadStates(State* states, int states_num, bool* isConnected,
int* connectedCount) {
std::scoped_lock lock{m_mutex};
*isConnected = m_connected;
*connectedCount = m_connected_count;
int ret_num = 0;
if (m_connected) {
if (m_states_num == 0) {
ret_num = 1;
states[0] = m_last_state;
} else {
for (uint32_t i = 0; i < m_states_num; i++) {
if (ret_num >= states_num) {
break;
}
auto index = (m_first_state + i) % MAX_STATES;
if (!m_private[index].obtained) {
m_private[index].obtained = true;
states[ret_num++] = m_states[index];
}
}
}
}
return ret_num;
}
State GameController::getLastState() const { State GameController::getLastState() const {
if (m_states_num == 0) { if (m_states_num == 0) {
return m_last_state; return m_last_state;
@ -39,7 +70,7 @@ void GameController::addState(const State& state) {
m_states[index] = state; m_states[index] = state;
m_last_state = state; m_last_state = state;
m_private[index].obtained = false;
m_states_num++; m_states_num++;
} }

View File

@ -20,11 +20,16 @@ public:
virtual ~GameController() = default; virtual ~GameController() = default;
void readState(State* state, bool* isConnected, int* connectedCount); void readState(State* state, bool* isConnected, int* connectedCount);
int ReadStates(State* states, int states_num, bool* isConnected, int* connectedCount);
State getLastState() const; State getLastState() const;
void checKButton(int id, u32 button, bool isPressed); void checKButton(int id, u32 button, bool isPressed);
void addState(const State& state); void addState(const State& state);
private: private:
struct StateInternal {
bool obtained = false;
};
std::mutex m_mutex; std::mutex m_mutex;
bool m_connected = false; bool m_connected = false;
State m_last_state; State m_last_state;
@ -32,6 +37,7 @@ private:
u32 m_states_num = 0; u32 m_states_num = 0;
u32 m_first_state = 0; u32 m_first_state = 0;
State m_states[MAX_STATES]; State m_states[MAX_STATES];
StateInternal m_private[MAX_STATES];
}; };
} // namespace Emulator::Host::Controller } // namespace Emulator::Host::Controller

View File

@ -108,4 +108,42 @@ s32 SDLAudio::AudioOutOutput(s32 handle, const void* ptr) {
return result; return result;
} }
bool SDLAudio::AudioOutSetVolume(s32 handle, s32 bitflag, s32* volume) {
using Libraries::AudioOut::OrbisAudioOutParam;
std::scoped_lock lock{m_mutex};
auto& port = portsOut[handle - 1];
if (!port.isOpen) {
return ORBIS_AUDIO_OUT_ERROR_INVALID_PORT;
}
for (int i = 0; i < port.channels_num; i++, bitflag >>= 1u) {
auto bit = bitflag & 0x1u;
if (bit == 1) {
int src_index = i;
if (port.format == OrbisAudioOutParam::ORBIS_AUDIO_OUT_PARAM_FORMAT_FLOAT_8CH_STD ||
port.format == OrbisAudioOutParam::ORBIS_AUDIO_OUT_PARAM_FORMAT_S16_8CH_STD) {
switch (i) {
case 4:
src_index = 6;
break;
case 5:
src_index = 7;
break;
case 6:
src_index = 4;
break;
case 7:
src_index = 5;
break;
default:
break;
}
}
port.volume[i] = volume[src_index];
}
}
return true;
}
} // namespace Audio } // namespace Audio

View File

@ -20,6 +20,7 @@ public:
int AudioOutOpen(int type, u32 samples_num, u32 freq, int AudioOutOpen(int type, u32 samples_num, u32 freq,
Libraries::AudioOut::OrbisAudioOutParam format); Libraries::AudioOut::OrbisAudioOutParam format);
s32 AudioOutOutput(s32 handle, const void* ptr); s32 AudioOutOutput(s32 handle, const void* ptr);
bool AudioOutSetVolume(s32 handle, s32 bitflag, s32* volume);
private: private:
struct PortOut { struct PortOut {

View File

@ -88,6 +88,7 @@ bool ParseFilterRule(Filter& instance, Iterator begin, Iterator end) {
SUB(Lib, CommonDlg) \ SUB(Lib, CommonDlg) \
SUB(Lib, MsgDlg) \ SUB(Lib, MsgDlg) \
SUB(Lib, AudioOut) \ SUB(Lib, AudioOut) \
SUB(Lib, AudioIn) \
SUB(Lib, Net) \ SUB(Lib, Net) \
SUB(Lib, NetCtl) \ SUB(Lib, NetCtl) \
SUB(Lib, SaveData) \ SUB(Lib, SaveData) \

View File

@ -55,6 +55,7 @@ enum class Class : u8 {
Lib_CommonDlg, ///< The LibSceCommonDialog implementation. Lib_CommonDlg, ///< The LibSceCommonDialog implementation.
Lib_MsgDlg, ///< The LibSceMsgDialog implementation. Lib_MsgDlg, ///< The LibSceMsgDialog implementation.
Lib_AudioOut, ///< The LibSceAudioOut implementation. Lib_AudioOut, ///< The LibSceAudioOut implementation.
Lib_AudioIn, ///< The LibSceAudioIn implementation.
Lib_Net, ///< The LibSceNet implementation. Lib_Net, ///< The LibSceNet implementation.
Lib_NetCtl, ///< The LibSecNetCtl implementation. Lib_NetCtl, ///< The LibSecNetCtl implementation.
Lib_SaveData, ///< The LibSceSaveData implementation. Lib_SaveData, ///< The LibSceSaveData implementation.

View File

@ -6,7 +6,7 @@
#include <array> #include <array>
#include <cstdint> #include <cstdint>
using s08 = std::int8_t; using s8 = std::int8_t;
using s16 = std::int16_t; using s16 = std::int16_t;
using s32 = std::int32_t; using s32 = std::int32_t;
using s64 = std::int64_t; using s64 = std::int64_t;

View File

@ -18,7 +18,7 @@ bool is16KBAligned(u64 n) {
} }
u64 PS4_SYSV_ABI sceKernelGetDirectMemorySize() { u64 PS4_SYSV_ABI sceKernelGetDirectMemorySize() {
LOG_WARNING(Kernel_Vmm, "(STUBBED) called"); LOG_WARNING(Kernel_Vmm, "called");
return SCE_KERNEL_MAIN_DMEM_SIZE; return SCE_KERNEL_MAIN_DMEM_SIZE;
} }

View File

@ -1,6 +1,7 @@
// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project // SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later // SPDX-License-Identifier: GPL-2.0-or-later
#include <mutex>
#include "common/assert.h" #include "common/assert.h"
#include "common/logging/log.h" #include "common/logging/log.h"
#include "core/hle/error_codes.h" #include "core/hle/error_codes.h"
@ -22,6 +23,12 @@ void init_pthreads() {
ScePthreadCondattr default_condattr = nullptr; ScePthreadCondattr default_condattr = nullptr;
scePthreadCondattrInit(&default_condattr); scePthreadCondattrInit(&default_condattr);
g_pthread_cxt->setDefaultCondattr(default_condattr); g_pthread_cxt->setDefaultCondattr(default_condattr);
// default attr init
ScePthreadAttr default_attr = nullptr;
scePthreadAttrInit(&default_attr);
g_pthread_cxt->SetDefaultAttr(default_attr);
g_pthread_cxt->SetPthreadPool(new PThreadPool);
} }
void pthreadInitSelfMainThread() { void pthreadInitSelfMainThread() {
@ -70,6 +77,72 @@ int PS4_SYSV_ABI scePthreadAttrDestroy(ScePthreadAttr* attr) {
return SCE_KERNEL_ERROR_EINVAL; return SCE_KERNEL_ERROR_EINVAL;
} }
int PS4_SYSV_ABI scePthreadAttrSetguardsize(ScePthreadAttr* attr, size_t guard_size) {
if (attr == nullptr || *attr == nullptr) {
return SCE_KERNEL_ERROR_EINVAL;
}
(*attr)->guard_size = guard_size;
return SCE_OK;
}
int PS4_SYSV_ABI scePthreadAttrGetguardsize(const ScePthreadAttr* attr, size_t* guard_size) {
if (guard_size == nullptr || attr == nullptr || *attr == nullptr) {
return SCE_KERNEL_ERROR_EINVAL;
}
*guard_size = (*attr)->guard_size;
return SCE_OK;
}
int PS4_SYSV_ABI scePthreadAttrGetinheritsched(const ScePthreadAttr* attr, int* inherit_sched) {
if (inherit_sched == nullptr || attr == nullptr || *attr == nullptr) {
return SCE_KERNEL_ERROR_EINVAL;
}
int result = pthread_attr_getinheritsched(&(*attr)->pth_attr, inherit_sched);
switch (*inherit_sched) {
case PTHREAD_EXPLICIT_SCHED:
*inherit_sched = 0;
break;
case PTHREAD_INHERIT_SCHED:
*inherit_sched = 4;
break;
default:
UNREACHABLE();
}
return (result == 0 ? SCE_OK : SCE_KERNEL_ERROR_EINVAL);
}
int PS4_SYSV_ABI scePthreadAttrGetdetachstate(const ScePthreadAttr* attr, int* state) {
if (state == nullptr || attr == nullptr || *attr == nullptr) {
return SCE_KERNEL_ERROR_EINVAL;
}
// int result = pthread_attr_getdetachstate(&(*attr)->p, state);
int result = 0;
*state = ((*attr)->detached ? PTHREAD_CREATE_DETACHED : PTHREAD_CREATE_JOINABLE);
switch (*state) {
case PTHREAD_CREATE_JOINABLE:
*state = 0;
break;
case PTHREAD_CREATE_DETACHED:
*state = 1;
break;
default:
UNREACHABLE();
}
return (result == 0 ? SCE_OK : SCE_KERNEL_ERROR_EINVAL);
}
int PS4_SYSV_ABI scePthreadAttrSetdetachstate(ScePthreadAttr* attr, int detachstate) { int PS4_SYSV_ABI scePthreadAttrSetdetachstate(ScePthreadAttr* attr, int detachstate) {
if (attr == nullptr || *attr == nullptr) { if (attr == nullptr || *attr == nullptr) {
return SCE_KERNEL_ERROR_EINVAL; return SCE_KERNEL_ERROR_EINVAL;
@ -118,6 +191,26 @@ int PS4_SYSV_ABI scePthreadAttrSetinheritsched(ScePthreadAttr* attr, int inherit
return result == 0 ? SCE_OK : SCE_KERNEL_ERROR_EINVAL; return result == 0 ? SCE_OK : SCE_KERNEL_ERROR_EINVAL;
} }
int PS4_SYSV_ABI scePthreadAttrGetschedparam(const ScePthreadAttr* attr,
SceKernelSchedParam* param) {
if (param == nullptr || attr == nullptr || *attr == nullptr) {
return SCE_KERNEL_ERROR_EINVAL;
}
int result = pthread_attr_getschedparam(&(*attr)->pth_attr, param);
if (param->sched_priority <= -2) {
param->sched_priority = 767;
} else if (param->sched_priority >= +2) {
param->sched_priority = 256;
} else {
param->sched_priority = 700;
}
return result == 0 ? SCE_OK : SCE_KERNEL_ERROR_EINVAL;
}
int PS4_SYSV_ABI scePthreadAttrSetschedparam(ScePthreadAttr* attr, int PS4_SYSV_ABI scePthreadAttrSetschedparam(ScePthreadAttr* attr,
const SceKernelSchedParam* param) { const SceKernelSchedParam* param) {
if (param == nullptr || attr == nullptr || *attr == nullptr) { if (param == nullptr || attr == nullptr || *attr == nullptr) {
@ -138,6 +231,31 @@ int PS4_SYSV_ABI scePthreadAttrSetschedparam(ScePthreadAttr* attr,
return result == 0 ? SCE_OK : SCE_KERNEL_ERROR_EINVAL; return result == 0 ? SCE_OK : SCE_KERNEL_ERROR_EINVAL;
} }
int PS4_SYSV_ABI scePthreadAttrGetschedpolicy(const ScePthreadAttr* attr, int* policy) {
if (policy == nullptr || attr == nullptr || *attr == nullptr) {
return SCE_KERNEL_ERROR_EINVAL;
}
int result = pthread_attr_getschedpolicy(&(*attr)->pth_attr, policy);
switch (*policy) {
case SCHED_OTHER:
*policy = (*attr)->policy;
break;
case SCHED_FIFO:
*policy = 1;
break;
case SCHED_RR:
*policy = 3;
break;
default:
UNREACHABLE();
}
return result == 0 ? SCE_OK : SCE_KERNEL_ERROR_EINVAL;
}
int PS4_SYSV_ABI scePthreadAttrSetschedpolicy(ScePthreadAttr* attr, int policy) { int PS4_SYSV_ABI scePthreadAttrSetschedpolicy(ScePthreadAttr* attr, int policy) {
if (attr == nullptr || *attr == nullptr) { if (attr == nullptr || *attr == nullptr) {
return SCE_KERNEL_ERROR_EINVAL; return SCE_KERNEL_ERROR_EINVAL;
@ -180,6 +298,51 @@ int PS4_SYSV_ABI scePthreadAttrGetaffinity(const ScePthreadAttr* pattr,
return SCE_OK; return SCE_OK;
} }
int PS4_SYSV_ABI scePthreadAttrGetstackaddr(const ScePthreadAttr* attr, void** stack_addr) {
if (stack_addr == nullptr || attr == nullptr || *attr == nullptr) {
return SCE_KERNEL_ERROR_EINVAL;
}
int result = pthread_attr_getstackaddr(&(*attr)->pth_attr, stack_addr);
return result == 0 ? SCE_OK : SCE_KERNEL_ERROR_EINVAL;
}
int PS4_SYSV_ABI scePthreadAttrGetstacksize(const ScePthreadAttr* attr, size_t* stack_size) {
if (stack_size == nullptr || attr == nullptr || *attr == nullptr) {
return SCE_KERNEL_ERROR_EINVAL;
}
int result = pthread_attr_getstacksize(&(*attr)->pth_attr, stack_size);
return result == 0 ? SCE_OK : SCE_KERNEL_ERROR_EINVAL;
}
int PS4_SYSV_ABI scePthreadAttrSetstackaddr(ScePthreadAttr* attr, void* addr) {
if (addr == nullptr || attr == nullptr || *attr == nullptr) {
return SCE_KERNEL_ERROR_EINVAL;
}
int result = pthread_attr_setstackaddr(&(*attr)->pth_attr, addr);
return result == 0 ? SCE_OK : SCE_KERNEL_ERROR_EINVAL;
}
int PS4_SYSV_ABI scePthreadAttrSetstacksize(ScePthreadAttr* attr, size_t stack_size) {
if (stack_size == 0 || attr == nullptr || *attr == nullptr) {
return SCE_KERNEL_ERROR_EINVAL;
}
int result = pthread_attr_setstacksize(&(*attr)->pth_attr, stack_size);
return result == 0 ? SCE_OK : SCE_KERNEL_ERROR_EINVAL;
}
int PS4_SYSV_ABI scePthreadSetaffinity(ScePthread thread, const /*SceKernelCpumask*/ u64 mask) { int PS4_SYSV_ABI scePthreadSetaffinity(ScePthread thread, const /*SceKernelCpumask*/ u64 mask) {
LOG_INFO(Kernel_Pthread, "called"); LOG_INFO(Kernel_Pthread, "called");
@ -191,11 +354,6 @@ int PS4_SYSV_ABI scePthreadSetaffinity(ScePthread thread, const /*SceKernelCpuma
return result; return result;
} }
int PS4_SYSV_ABI scePthreadCreate(ScePthread* thread, const ScePthreadAttr* attr,
pthreadEntryFunc start_routine, void* arg, const char* name) {
LOG_INFO(Kernel_Pthread, "(STUBBED) called");
return 0;
}
void* createMutex(void* addr) { void* createMutex(void* addr) {
if (addr == nullptr || *static_cast<ScePthreadMutex*>(addr) != nullptr) { if (addr == nullptr || *static_cast<ScePthreadMutex*>(addr) != nullptr) {
@ -244,6 +402,29 @@ int PS4_SYSV_ABI scePthreadMutexInit(ScePthreadMutex* mutex, const ScePthreadMut
} }
} }
int PS4_SYSV_ABI scePthreadMutexDestroy(ScePthreadMutex* mutex) {
if (mutex == nullptr || *mutex == nullptr) {
return SCE_KERNEL_ERROR_EINVAL;
}
int result = pthread_mutex_destroy(&(*mutex)->pth_mutex);
LOG_INFO(Kernel_Pthread, "name={}, result={}", (*mutex)->name, result);
delete *mutex;
*mutex = nullptr;
switch (result) {
case 0:
return SCE_OK;
case EBUSY:
return SCE_KERNEL_ERROR_EBUSY;
case EINVAL:
default:
return SCE_KERNEL_ERROR_EINVAL;
}
}
int PS4_SYSV_ABI scePthreadMutexattrInit(ScePthreadMutexattr* attr) { int PS4_SYSV_ABI scePthreadMutexattrInit(ScePthreadMutexattr* attr) {
*attr = new PthreadMutexattrInternal{}; *attr = new PthreadMutexattrInternal{};
@ -307,7 +488,6 @@ int PS4_SYSV_ABI scePthreadMutexattrSetprotocol(ScePthreadMutexattr* attr, int p
return result == 0 ? SCE_OK : SCE_KERNEL_ERROR_EINVAL; return result == 0 ? SCE_OK : SCE_KERNEL_ERROR_EINVAL;
} }
int PS4_SYSV_ABI scePthreadMutexLock(ScePthreadMutex* mutex) { int PS4_SYSV_ABI scePthreadMutexLock(ScePthreadMutex* mutex) {
LOG_INFO(Kernel_Pthread, "called");
mutex = static_cast<ScePthreadMutex*>(createMutex(mutex)); mutex = static_cast<ScePthreadMutex*>(createMutex(mutex));
if (mutex == nullptr) { if (mutex == nullptr) {
@ -315,7 +495,9 @@ int PS4_SYSV_ABI scePthreadMutexLock(ScePthreadMutex* mutex) {
} }
int result = pthread_mutex_lock(&(*mutex)->pth_mutex); int result = pthread_mutex_lock(&(*mutex)->pth_mutex);
if (result != 0) {
LOG_INFO(Kernel_Pthread, "name={}, result={}", (*mutex)->name, result); LOG_INFO(Kernel_Pthread, "name={}, result={}", (*mutex)->name, result);
}
switch (result) { switch (result) {
case 0: case 0:
return SCE_OK; return SCE_OK;
@ -330,14 +512,15 @@ int PS4_SYSV_ABI scePthreadMutexLock(ScePthreadMutex* mutex) {
} }
} }
int PS4_SYSV_ABI scePthreadMutexUnlock(ScePthreadMutex* mutex) { int PS4_SYSV_ABI scePthreadMutexUnlock(ScePthreadMutex* mutex) {
LOG_INFO(Kernel_Pthread, "called");
mutex = static_cast<ScePthreadMutex*>(createMutex(mutex)); mutex = static_cast<ScePthreadMutex*>(createMutex(mutex));
if (mutex == nullptr) { if (mutex == nullptr) {
return SCE_KERNEL_ERROR_EINVAL; return SCE_KERNEL_ERROR_EINVAL;
} }
int result = pthread_mutex_unlock(&(*mutex)->pth_mutex); int result = pthread_mutex_unlock(&(*mutex)->pth_mutex);
if (result != 0) {
LOG_INFO(Kernel_Pthread, "name={}, result={}", (*mutex)->name, result); LOG_INFO(Kernel_Pthread, "name={}, result={}", (*mutex)->name, result);
}
switch (result) { switch (result) {
case 0: case 0:
return SCE_OK; return SCE_OK;
@ -448,7 +631,7 @@ int PS4_SYSV_ABI scePthreadCondBroadcast(ScePthreadCond* cond) {
} }
int PS4_SYSV_ABI posix_pthread_mutex_init(ScePthreadMutex* mutex, const ScePthreadMutexattr* attr) { int PS4_SYSV_ABI posix_pthread_mutex_init(ScePthreadMutex* mutex, const ScePthreadMutexattr* attr) {
LOG_INFO(Kernel_Pthread, "posix pthread_mutex_init redirect to scePthreadMutexInit"); // LOG_INFO(Kernel_Pthread, "posix pthread_mutex_init redirect to scePthreadMutexInit");
int result = scePthreadMutexInit(mutex, attr, nullptr); int result = scePthreadMutexInit(mutex, attr, nullptr);
if (result < 0) { if (result < 0) {
int rt = result > SCE_KERNEL_ERROR_UNKNOWN && result <= SCE_KERNEL_ERROR_ESTOP int rt = result > SCE_KERNEL_ERROR_UNKNOWN && result <= SCE_KERNEL_ERROR_ESTOP
@ -460,7 +643,7 @@ int PS4_SYSV_ABI posix_pthread_mutex_init(ScePthreadMutex* mutex, const ScePthre
} }
int PS4_SYSV_ABI posix_pthread_mutex_lock(ScePthreadMutex* mutex) { int PS4_SYSV_ABI posix_pthread_mutex_lock(ScePthreadMutex* mutex) {
LOG_INFO(Kernel_Pthread, "posix pthread_mutex_lock redirect to scePthreadMutexLock"); // LOG_INFO(Kernel_Pthread, "posix pthread_mutex_lock redirect to scePthreadMutexLock");
int result = scePthreadMutexLock(mutex); int result = scePthreadMutexLock(mutex);
if (result < 0) { if (result < 0) {
int rt = result > SCE_KERNEL_ERROR_UNKNOWN && result <= SCE_KERNEL_ERROR_ESTOP int rt = result > SCE_KERNEL_ERROR_UNKNOWN && result <= SCE_KERNEL_ERROR_ESTOP
@ -472,7 +655,7 @@ int PS4_SYSV_ABI posix_pthread_mutex_lock(ScePthreadMutex* mutex) {
} }
int PS4_SYSV_ABI posix_pthread_mutex_unlock(ScePthreadMutex* mutex) { int PS4_SYSV_ABI posix_pthread_mutex_unlock(ScePthreadMutex* mutex) {
LOG_INFO(Kernel_Pthread, "posix pthread_mutex_unlock redirect to scePthreadMutexUnlock"); // LOG_INFO(Kernel_Pthread, "posix pthread_mutex_unlock redirect to scePthreadMutexUnlock");
int result = scePthreadMutexUnlock(mutex); int result = scePthreadMutexUnlock(mutex);
if (result < 0) { if (result < 0) {
int rt = result > SCE_KERNEL_ERROR_UNKNOWN && result <= SCE_KERNEL_ERROR_ESTOP int rt = result > SCE_KERNEL_ERROR_UNKNOWN && result <= SCE_KERNEL_ERROR_ESTOP
@ -496,6 +679,212 @@ int PS4_SYSV_ABI posix_pthread_cond_broadcast(ScePthreadCond* cond) {
return result; return result;
} }
int PS4_SYSV_ABI sceKernelClockGettime(s32 clock_id, SceKernelTimespec* tp) {
if (tp == nullptr) {
return SCE_KERNEL_ERROR_EFAULT;
}
clockid_t pclock_id = CLOCK_REALTIME;
switch (clock_id) {
case 0:
pclock_id = CLOCK_REALTIME;
break;
case 13:
case 4:
pclock_id = CLOCK_MONOTONIC;
break;
default:
UNREACHABLE();
}
timespec t{};
int result = clock_gettime(pclock_id, &t);
tp->tv_sec = t.tv_sec;
tp->tv_nsec = t.tv_nsec;
if (result == 0) {
return SCE_OK;
}
return SCE_KERNEL_ERROR_EINVAL;
}
int PS4_SYSV_ABI clock_gettime(s32 clock_id, SceKernelTimespec* time) {
int result = sceKernelClockGettime(clock_id, time);
if (result < 0) {
UNREACHABLE(); // TODO return posix error code
}
return result;
}
int PS4_SYSV_ABI sceKernelNanosleep(const SceKernelTimespec* rqtp, SceKernelTimespec* rmtp) {
if (rqtp == nullptr) {
return SCE_KERNEL_ERROR_EFAULT;
}
if (rqtp->tv_sec < 0 || rqtp->tv_nsec < 0) {
return SCE_KERNEL_ERROR_EINVAL;
}
u64 nanos = rqtp->tv_sec * 1000000000 + rqtp->tv_nsec;
std::this_thread::sleep_for(std::chrono::nanoseconds(nanos));
if (rmtp != nullptr) {
UNREACHABLE(); // not supported yet
}
return SCE_OK;
}
int PS4_SYSV_ABI nanosleep(const SceKernelTimespec* rqtp, SceKernelTimespec* rmtp) {
int result = sceKernelNanosleep(rqtp, rmtp);
if (result < 0) {
UNREACHABLE(); // TODO return posix error code
}
return result;
}
static int pthread_copy_attributes(ScePthreadAttr* dst, const ScePthreadAttr* src) {
if (dst == nullptr || *dst == nullptr || src == nullptr || *src == nullptr) {
return SCE_KERNEL_ERROR_EINVAL;
}
u64 mask = 0;
int state = 0;
size_t guard_size = 0;
int inherit_sched = 0;
SceKernelSchedParam param = {};
int policy = 0;
void* stack_addr = nullptr;
size_t stack_size = 0;
int result = 0;
result = (result == 0 ? scePthreadAttrGetaffinity(src, &mask) : result);
result = (result == 0 ? scePthreadAttrGetdetachstate(src, &state) : result);
result = (result == 0 ? scePthreadAttrGetguardsize(src, &guard_size) : result);
result = (result == 0 ? scePthreadAttrGetinheritsched(src, &inherit_sched) : result);
result = (result == 0 ? scePthreadAttrGetschedparam(src, &param) : result);
result = (result == 0 ? scePthreadAttrGetschedpolicy(src, &policy) : result);
result = (result == 0 ? scePthreadAttrGetstackaddr(src, &stack_addr) : result);
result = (result == 0 ? scePthreadAttrGetstacksize(src, &stack_size) : result);
result = (result == 0 ? scePthreadAttrSetaffinity(dst, mask) : result);
result = (result == 0 ? scePthreadAttrSetdetachstate(dst, state) : result);
result = (result == 0 ? scePthreadAttrSetguardsize(dst, guard_size) : result);
result = (result == 0 ? scePthreadAttrSetinheritsched(dst, inherit_sched) : result);
result = (result == 0 ? scePthreadAttrSetschedparam(dst, &param) : result);
result = (result == 0 ? scePthreadAttrSetschedpolicy(dst, policy) : result);
if (stack_addr != nullptr) {
result = (result == 0 ? scePthreadAttrSetstackaddr(dst, stack_addr) : result);
}
if (stack_size != 0) {
result = (result == 0 ? scePthreadAttrSetstacksize(dst, stack_size) : result);
}
return result;
}
int PS4_SYSV_ABI scePthreadAttrGet(ScePthread thread, ScePthreadAttr* attr) {
if (thread == nullptr || attr == nullptr || *attr == nullptr) {
return SCE_KERNEL_ERROR_EINVAL;
}
return pthread_copy_attributes(attr, &thread->attr);
}
static void cleanup_thread(void* arg) {
auto* thread = static_cast<ScePthread>(arg);
thread->is_almost_done = true;
}
static void* run_thread(void* arg) {
auto* thread = static_cast<ScePthread>(arg);
void* ret = nullptr;
g_pthread_self = thread;
pthread_cleanup_push(cleanup_thread, thread);
thread->is_started = true;
ret = thread->entry(thread->arg);
pthread_cleanup_pop(1);
return ret;
}
int PS4_SYSV_ABI scePthreadCreate(ScePthread* thread, const ScePthreadAttr* attr,
pthreadEntryFunc start_routine, void* arg, const char* name) {
if (thread == nullptr) {
return SCE_KERNEL_ERROR_EINVAL;
}
auto* pthread_pool = g_pthread_cxt->GetPthreadPool();
if (attr == nullptr) {
attr = g_pthread_cxt->GetDefaultAttr();
}
*thread = pthread_pool->Create();
if ((*thread)->attr != nullptr) {
scePthreadAttrDestroy(&(*thread)->attr);
}
scePthreadAttrInit(&(*thread)->attr);
int result = pthread_copy_attributes(&(*thread)->attr, attr);
if (result == 0) {
(*thread)->name = name;
(*thread)->entry = start_routine;
(*thread)->arg = arg;
(*thread)->is_almost_done = false;
(*thread)->is_detached = (*attr)->detached;
(*thread)->is_started = false;
result = pthread_create(&(*thread)->pth, &(*attr)->pth_attr, run_thread, *thread);
}
if (result == 0) {
while (!(*thread)->is_started) {
std::this_thread::sleep_for(std::chrono::microseconds(1000));
}
}
LOG_INFO(Kernel_Pthread, "thread create name = {}", (*thread)->name);
switch (result) {
case 0:
return SCE_OK;
case ENOMEM:
return SCE_KERNEL_ERROR_ENOMEM;
case EAGAIN:
return SCE_KERNEL_ERROR_EAGAIN;
case EDEADLK:
return SCE_KERNEL_ERROR_EDEADLK;
case EPERM:
return SCE_KERNEL_ERROR_EPERM;
default:
return SCE_KERNEL_ERROR_EINVAL;
}
}
ScePthread PThreadPool::Create() {
std::scoped_lock lock{m_mutex};
for (auto* p : m_threads) {
if (p->is_free) {
p->is_free = false;
return p;
}
}
auto* ret = new PthreadInternal{};
ret->is_free = false;
ret->is_detached = false;
ret->is_almost_done = false;
ret->attr = nullptr;
m_threads.push_back(ret);
return ret;
}
void PS4_SYSV_ABI scePthreadYield() {
sched_yield();
}
void pthreadSymbolsRegister(Loader::SymbolsResolver* sym) { void pthreadSymbolsRegister(Loader::SymbolsResolver* sym) {
LIB_FUNCTION("4+h9EzwKF4I", "libkernel", 1, "libkernel", 1, 1, scePthreadAttrSetschedpolicy); LIB_FUNCTION("4+h9EzwKF4I", "libkernel", 1, "libkernel", 1, 1, scePthreadAttrSetschedpolicy);
LIB_FUNCTION("-Wreprtu0Qs", "libkernel", 1, "libkernel", 1, 1, scePthreadAttrSetdetachstate); LIB_FUNCTION("-Wreprtu0Qs", "libkernel", 1, "libkernel", 1, 1, scePthreadAttrSetdetachstate);
@ -507,11 +896,15 @@ void pthreadSymbolsRegister(Loader::SymbolsResolver* sym) {
LIB_FUNCTION("aI+OeCz8xrQ", "libkernel", 1, "libkernel", 1, 1, scePthreadSelf); LIB_FUNCTION("aI+OeCz8xrQ", "libkernel", 1, "libkernel", 1, 1, scePthreadSelf);
LIB_FUNCTION("3qxgM4ezETA", "libkernel", 1, "libkernel", 1, 1, scePthreadAttrSetaffinity); LIB_FUNCTION("3qxgM4ezETA", "libkernel", 1, "libkernel", 1, 1, scePthreadAttrSetaffinity);
LIB_FUNCTION("8+s5BzZjxSg", "libkernel", 1, "libkernel", 1, 1, scePthreadAttrGetaffinity); LIB_FUNCTION("8+s5BzZjxSg", "libkernel", 1, "libkernel", 1, 1, scePthreadAttrGetaffinity);
LIB_FUNCTION("x1X76arYMxU", "libkernel", 1, "libkernel", 1, 1, scePthreadAttrGet);
LIB_FUNCTION("bt3CTBKmGyI", "libkernel", 1, "libkernel", 1, 1, scePthreadSetaffinity); LIB_FUNCTION("bt3CTBKmGyI", "libkernel", 1, "libkernel", 1, 1, scePthreadSetaffinity);
LIB_FUNCTION("6UgtwV+0zb4", "libkernel", 1, "libkernel", 1, 1, scePthreadCreate); LIB_FUNCTION("6UgtwV+0zb4", "libkernel", 1, "libkernel", 1, 1, scePthreadCreate);
LIB_FUNCTION("T72hz6ffq08", "libkernel", 1, "libkernel", 1, 1, scePthreadYield);
// mutex calls // mutex calls
LIB_FUNCTION("cmo1RIYva9o", "libkernel", 1, "libkernel", 1, 1, scePthreadMutexInit); LIB_FUNCTION("cmo1RIYva9o", "libkernel", 1, "libkernel", 1, 1, scePthreadMutexInit);
LIB_FUNCTION("2Of0f+3mhhE", "libkernel", 1, "libkernel", 1, 1, scePthreadMutexDestroy);
LIB_FUNCTION("F8bUHwAG284", "libkernel", 1, "libkernel", 1, 1, scePthreadMutexattrInit); LIB_FUNCTION("F8bUHwAG284", "libkernel", 1, "libkernel", 1, 1, scePthreadMutexattrInit);
LIB_FUNCTION("smWEktiyyG0", "libkernel", 1, "libkernel", 1, 1, scePthreadMutexattrDestroy); LIB_FUNCTION("smWEktiyyG0", "libkernel", 1, "libkernel", 1, 1, scePthreadMutexattrDestroy);
LIB_FUNCTION("iMp8QpE+XO4", "libkernel", 1, "libkernel", 1, 1, scePthreadMutexattrSettype); LIB_FUNCTION("iMp8QpE+XO4", "libkernel", 1, "libkernel", 1, 1, scePthreadMutexattrSettype);
@ -528,6 +921,10 @@ void pthreadSymbolsRegister(Loader::SymbolsResolver* sym) {
LIB_FUNCTION("2Z+PpY6CaJg", "libScePosix", 1, "libkernel", 1, 1, posix_pthread_mutex_unlock); LIB_FUNCTION("2Z+PpY6CaJg", "libScePosix", 1, "libkernel", 1, 1, posix_pthread_mutex_unlock);
LIB_FUNCTION("mkx2fVhNMsg", "libScePosix", 1, "libkernel", 1, 1, posix_pthread_cond_broadcast); LIB_FUNCTION("mkx2fVhNMsg", "libScePosix", 1, "libkernel", 1, 1, posix_pthread_cond_broadcast);
LIB_FUNCTION("QBi7HCK03hw", "libkernel", 1, "libkernel", 1, 1, sceKernelClockGettime);
LIB_FUNCTION("lLMT9vJAck0", "libkernel", 1, "libkernel", 1, 1, clock_gettime);
LIB_FUNCTION("yS8U2TGCe1A", "libScePosix", 1, "libkernel", 1, 1, nanosleep);
// openorbis weird functions // openorbis weird functions
LIB_FUNCTION("7H0iTOciTLo", "libkernel", 1, "libkernel", 1, 1, posix_pthread_mutex_lock); LIB_FUNCTION("7H0iTOciTLo", "libkernel", 1, "libkernel", 1, 1, posix_pthread_mutex_lock);
LIB_FUNCTION("2Z+PpY6CaJg", "libkernel", 1, "libkernel", 1, 1, posix_pthread_mutex_unlock); LIB_FUNCTION("2Z+PpY6CaJg", "libkernel", 1, "libkernel", 1, 1, posix_pthread_mutex_unlock);

View File

@ -4,10 +4,13 @@
#pragma once #pragma once
#define _TIMESPEC_DEFINED #define _TIMESPEC_DEFINED
#include <atomic>
#include <mutex>
#include <string> #include <string>
#include <thread>
#include <vector>
#include <pthread.h> #include <pthread.h>
#include <sched.h> #include <sched.h>
#include "common/types.h" #include "common/types.h"
namespace Core::Loader { namespace Core::Loader {
@ -33,11 +36,22 @@ using ScePthreadCondattr = PthreadCondAttrInternal*;
using pthreadEntryFunc = PS4_SYSV_ABI void* (*)(void*); using pthreadEntryFunc = PS4_SYSV_ABI void* (*)(void*);
struct SceKernelTimespec {
int64_t tv_sec;
int64_t tv_nsec;
};
struct PthreadInternal { struct PthreadInternal {
u8 reserved[4096]; u8 reserved[4096];
std::string name; std::string name;
pthread_t pth; pthread_t pth;
ScePthreadAttr attr; ScePthreadAttr attr;
pthreadEntryFunc entry;
void* arg;
std::atomic_bool is_started;
std::atomic_bool is_detached;
std::atomic_bool is_almost_done;
std::atomic_bool is_free;
}; };
struct PthreadAttrInternal { struct PthreadAttrInternal {
@ -72,6 +86,15 @@ struct PthreadCondAttrInternal {
pthread_condattr_t cond_attr; pthread_condattr_t cond_attr;
}; };
class PThreadPool {
public:
ScePthread Create();
private:
std::vector<ScePthread> m_threads;
std::mutex m_mutex;
};
class PThreadCxt { class PThreadCxt {
public: public:
ScePthreadMutexattr* getDefaultMutexattr() { ScePthreadMutexattr* getDefaultMutexattr() {
@ -86,10 +109,24 @@ public:
void setDefaultCondattr(ScePthreadCondattr attr) { void setDefaultCondattr(ScePthreadCondattr attr) {
m_default_condattr = attr; m_default_condattr = attr;
} }
ScePthreadAttr* GetDefaultAttr() {
return &m_default_attr;
}
void SetDefaultAttr(ScePthreadAttr attr) {
m_default_attr = attr;
}
PThreadPool* GetPthreadPool() {
return m_pthread_pool;
}
void SetPthreadPool(PThreadPool* pool) {
m_pthread_pool = pool;
}
private: private:
ScePthreadMutexattr m_default_mutexattr = nullptr; ScePthreadMutexattr m_default_mutexattr = nullptr;
ScePthreadCondattr m_default_condattr = nullptr; ScePthreadCondattr m_default_condattr = nullptr;
ScePthreadAttr m_default_attr = nullptr;
PThreadPool* m_pthread_pool = nullptr;
}; };
void init_pthreads(); void init_pthreads();

View File

@ -11,13 +11,13 @@
namespace OldLibraries::LibPad { namespace OldLibraries::LibPad {
int PS4_SYSV_ABI scePadInit() { int PS4_SYSV_ABI scePadInit() {
LOG_WARNING(Lib_Pad, "(STUBBED) called"); LOG_WARNING(Lib_Pad, "(DUMMY) called");
return SCE_OK; return SCE_OK;
} }
int PS4_SYSV_ABI scePadOpen(Libraries::UserService::OrbisUserServiceUserId user_id, s32 type, int PS4_SYSV_ABI scePadOpen(Libraries::UserService::OrbisUserServiceUserId user_id, s32 type,
s32 index, const ScePadOpenParam* pParam) { s32 index, const ScePadOpenParam* pParam) {
LOG_INFO(Lib_Pad, "(STUBBED) called user_id = {} type = {} index = {}", user_id, type, index); LOG_INFO(Lib_Pad, "(DUMMY) called user_id = {} type = {} index = {}", user_id, type, index);
return 1; // dummy return 1; // dummy
} }
@ -48,10 +48,79 @@ int PS4_SYSV_ABI scePadReadState(int32_t handle, ScePadData* pData) {
return SCE_OK; return SCE_OK;
} }
int PS4_SYSV_ABI scePadRead(int handle, ScePadData* pData, int num) {
int connected_count = 0;
bool connected = false;
Emulator::Host::Controller::State states[64];
auto* controller = Common::Singleton<Emulator::Host::Controller::GameController>::Instance();
int ret_num = controller->ReadStates(states, num, &connected, &connected_count);
if (!connected) {
ret_num = 1;
}
for (int i = 0; i < ret_num; i++) {
pData[i].buttons = states[i].buttonsState;
pData[i].leftStick.x = 128; // dummy
pData[i].leftStick.y = 128; // dummy
pData[i].rightStick.x = 0; // dummy
pData[i].rightStick.y = 0; // dummy
pData[i].analogButtons.l2 = 0; // dummy
pData[i].analogButtons.r2 = 0; // dummy
pData[i].orientation.x = 0.0f;
pData[i].orientation.y = 0.0f;
pData[i].orientation.z = 0.0f;
pData[i].orientation.w = 1.0f;
pData[i].acceleration.x = 0.0f;
pData[i].acceleration.y = 0.0f;
pData[i].acceleration.z = 0.0f;
pData[i].angularVelocity.x = 0.0f;
pData[i].angularVelocity.y = 0.0f;
pData[i].angularVelocity.z = 0.0f;
pData[i].touchData.touchNum = 0;
pData[i].touchData.touch[0].x = 0;
pData[i].touchData.touch[0].y = 0;
pData[i].touchData.touch[0].id = 1;
pData[i].touchData.touch[1].x = 0;
pData[i].touchData.touch[1].y = 0;
pData[i].touchData.touch[1].id = 2;
pData[i].connected = connected;
pData[i].timestamp = states[i].time;
pData[i].connectedCount = connected_count;
pData[i].deviceUniqueDataLen = 0;
}
return ret_num;
}
s32 PS4_SYSV_ABI scePadGetControllerInformation(s32 handle, OrbisPadInformation* info) {
LOG_INFO(Lib_Pad, "called handle = {}", handle);
info->touchpadDensity = 1;
info->touchResolutionX = 1920;
info->touchResolutionY = 950;
info->stickDeadzoneL = 2;
info->stickDeadzoneR = 2;
info->connectionType = ORBIS_PAD_CONNECTION_TYPE_STANDARD;
info->count = 1;
info->connected = 1;
info->deviceClass = ORBIS_PAD_PORT_TYPE_STANDARD;
return SCE_OK;
}
s32 PS4_SYSV_ABI scePadSetMotionSensorState(s32 handle, bool enable) {
LOG_INFO(Lib_Pad, "(DUMMY) called handle = {} enabled = {}", handle,
(enable ? "true" : "false"));
return SCE_OK;
}
void padSymbolsRegister(Core::Loader::SymbolsResolver* sym) { void padSymbolsRegister(Core::Loader::SymbolsResolver* sym) {
LIB_FUNCTION("hv1luiJrqQM", "libScePad", 1, "libScePad", 1, 1, scePadInit); LIB_FUNCTION("hv1luiJrqQM", "libScePad", 1, "libScePad", 1, 1, scePadInit);
LIB_FUNCTION("xk0AcarP3V4", "libScePad", 1, "libScePad", 1, 1, scePadOpen); LIB_FUNCTION("xk0AcarP3V4", "libScePad", 1, "libScePad", 1, 1, scePadOpen);
LIB_FUNCTION("YndgXqQVV7c", "libScePad", 1, "libScePad", 1, 1, scePadReadState); LIB_FUNCTION("YndgXqQVV7c", "libScePad", 1, "libScePad", 1, 1, scePadReadState);
LIB_FUNCTION("q1cHNfGycLI", "libScePad", 1, "libScePad", 1, 1, scePadRead);
LIB_FUNCTION("gjP9-KQzoUk", "libScePad", 1, "libScePad", 1, 1, scePadGetControllerInformation);
LIB_FUNCTION("clVvL4ZDntw", "libScePad", 1, "libScePad", 1, 1, scePadSetMotionSensorState);
} }
} // namespace OldLibraries::LibPad } // namespace OldLibraries::LibPad

View File

@ -12,6 +12,16 @@ class SymbolsResolver;
namespace OldLibraries::LibPad { namespace OldLibraries::LibPad {
#define ORBIS_PAD_PORT_TYPE_STANDARD 0
#define ORBIS_PAD_PORT_TYPE_SPECIAL 2
#define ORBIS_PAD_DEVICE_CLASS_PAD 0
#define ORBIS_PAD_DEVICE_CLASS_GUITAR 1
#define ORBIS_PAD_DEVICE_CLASS_DRUMS 2
#define ORBIS_PAD_CONNECTION_TYPE_STANDARD 0
#define ORBIS_PAD_CONNECTION_TYPE_REMOTE 2
enum ScePadButton : u32 { enum ScePadButton : u32 {
L3 = 0x00000002, L3 = 0x00000002,
R3 = 0x00000004, R3 = 0x00000004,
@ -95,6 +105,19 @@ struct ScePadData {
uint8_t deviceUniqueData[12]; uint8_t deviceUniqueData[12];
}; };
struct OrbisPadInformation {
float touchpadDensity;
u16 touchResolutionX;
u16 touchResolutionY;
u8 stickDeadzoneL;
u8 stickDeadzoneR;
u8 connectionType;
u8 count;
s8 connected;
s8 deviceClass;
u8 unknown[8];
};
int PS4_SYSV_ABI scePadInit(); int PS4_SYSV_ABI scePadInit();
int PS4_SYSV_ABI scePadOpen(Libraries::UserService::OrbisUserServiceUserId userId, s32 type, int PS4_SYSV_ABI scePadOpen(Libraries::UserService::OrbisUserServiceUserId userId, s32 type,
s32 index, const ScePadOpenParam* pParam); s32 index, const ScePadOpenParam* pParam);

View File

@ -9,6 +9,7 @@
#include "core/hle/libraries/libs.h" #include "core/hle/libraries/libs.h"
#include "core/hle/libraries/libscegnmdriver/libscegnmdriver.h" #include "core/hle/libraries/libscegnmdriver/libscegnmdriver.h"
#include "src/core/libraries/libkernel.h" #include "src/core/libraries/libkernel.h"
#include "src/core/libraries/libsceaudioin.h"
#include "src/core/libraries/libsceaudioout.h" #include "src/core/libraries/libsceaudioout.h"
#include "src/core/libraries/libscecommondialog.h" #include "src/core/libraries/libscecommondialog.h"
#include "src/core/libraries/libscehttp.h" #include "src/core/libraries/libscehttp.h"
@ -47,6 +48,7 @@ void InitHLELibs(Core::Loader::SymbolsResolver* sym) {
Libraries::SysModule::RegisterlibSceSysmodule(sym); Libraries::SysModule::RegisterlibSceSysmodule(sym);
Libraries::Kernel::Registerlibkernel(sym); Libraries::Kernel::Registerlibkernel(sym);
Libraries::Posix::Registerlibsceposix(sym); Libraries::Posix::Registerlibsceposix(sym);
Libraries::AudioIn::RegisterlibSceAudioIn(sym);
} }
} // namespace OldLibraries } // namespace OldLibraries

View File

@ -9,19 +9,60 @@
namespace Core::Libraries::LibSceGnmDriver { namespace Core::Libraries::LibSceGnmDriver {
int32_t sceGnmSubmitDone() { int32_t PS4_SYSV_ABI sceGnmSubmitDone() {
LOG_WARNING(Lib_GnmDriver, "(STUBBED) called"); LOG_WARNING(Lib_GnmDriver, "(STUBBED) called");
return 0; return 0;
} }
void sceGnmFlushGarlic() { void PS4_SYSV_ABI sceGnmFlushGarlic() {
LOG_WARNING(Lib_GnmDriver, "(STUBBED) called"); LOG_WARNING(Lib_GnmDriver, "(STUBBED) called");
GPU::flushGarlic(Emu::getGraphicCtx()); GPU::flushGarlic(Emu::getGraphicCtx());
} }
s32 PS4_SYSV_ABI sceGnmDrawIndex(u32* cmd, u64 size, u32 index_count, const void* index_addr,
u32 flags, u32 type) {
LOG_INFO(Lib_GnmDriver,
"(STUBBED) called cmd_buffer = 0x{:x} size = {} index_count = {} index_addr = 0x{:x} "
"flags = 0x{:x} type = {}",
reinterpret_cast<uint64_t>(cmd), size, index_count,
reinterpret_cast<uint64_t>(index_addr), flags, type);
return 0;
}
int PS4_SYSV_ABI sceGnmSetVsShader(u32* cmd, u64 size, const u32* vs_regs, u32 shader_modifier) {
LOG_INFO(Lib_GnmDriver,
"(STUBBED) called cmd_buffer = 0x{:x} size = {} shader_modifier = {} vs_reg0 = "
"0x{:x} vs_reg1 = 0x{:x} vs_reg2 = 0x{:x} vs_reg3 = 0x{:x} vs_reg4 = 0x{:x} vs_reg5 = "
"0x{:x} vs_reg6 = 0x{:x}",
reinterpret_cast<uint64_t>(cmd), size, shader_modifier, vs_regs[0], vs_regs[1],
vs_regs[2], vs_regs[3], vs_regs[4], vs_regs[5], vs_regs[6]);
return 0;
}
int PS4_SYSV_ABI sceGnmUpdateVsShader(u32* cmd, u64 size, const u32* vs_regs, u32 shader_modifier) {
LOG_INFO(Lib_GnmDriver,
"(STUBBED) called cmd_buffer = 0x{:x} size = {} shader_modifier = {} vs_reg0 = "
"0x{:x} vs_reg1 = 0x{:x} vs_reg2 = 0x{:x} vs_reg3 = 0x{:x} vs_reg4 = 0x{:x} vs_reg5 = "
"0x{:x} vs_reg6 = 0x{:x}",
reinterpret_cast<uint64_t>(cmd), size, shader_modifier, vs_regs[0], vs_regs[1],
vs_regs[2], vs_regs[3], vs_regs[4], vs_regs[5], vs_regs[6]);
return 0;
}
u32 PS4_SYSV_ABI sceGnmDrawInitDefaultHardwareState350(u32* cmd, u64 size) {
LOG_INFO(Lib_GnmDriver, "(STUBBED) called cmd_buffer = 0x{:x} size = {}",
reinterpret_cast<uint64_t>(cmd), size);
return 0;
}
void LibSceGnmDriver_Register(Loader::SymbolsResolver* sym) { void LibSceGnmDriver_Register(Loader::SymbolsResolver* sym) {
LIB_FUNCTION("yvZ73uQUqrk", "libSceGnmDriver", 1, "libSceGnmDriver", 1, 1, sceGnmSubmitDone); LIB_FUNCTION("yvZ73uQUqrk", "libSceGnmDriver", 1, "libSceGnmDriver", 1, 1, sceGnmSubmitDone);
LIB_FUNCTION("iBt3Oe00Kvc", "libSceGnmDriver", 1, "libSceGnmDriver", 1, 1, sceGnmFlushGarlic); LIB_FUNCTION("iBt3Oe00Kvc", "libSceGnmDriver", 1, "libSceGnmDriver", 1, 1, sceGnmFlushGarlic);
LIB_FUNCTION("HlTPoZ-oY7Y", "libSceGnmDriver", 1, "libSceGnmDriver", 1, 1, sceGnmDrawIndex);
LIB_FUNCTION("gAhCn6UiU4Y", "libSceGnmDriver", 1, "libSceGnmDriver", 1, 1, sceGnmSetVsShader);
LIB_FUNCTION("V31V01UiScY", "libSceGnmDriver", 1, "libSceGnmDriver", 1, 1,
sceGnmUpdateVsShader);
LIB_FUNCTION("yb2cRhagD1I", "libSceGnmDriver", 1, "libSceGnmDriver", 1, 1,
sceGnmDrawInitDefaultHardwareState350);
} }
}; // namespace Core::Libraries::LibSceGnmDriver }; // namespace Core::Libraries::LibSceGnmDriver

View File

@ -11,8 +11,8 @@ class SymbolsResolver;
namespace Core::Libraries::LibSceGnmDriver { namespace Core::Libraries::LibSceGnmDriver {
int32_t sceGnmSubmitDone(); int32_t PS4_SYSV_ABI sceGnmSubmitDone();
void sceGnmFlushGarlic(); void PS4_SYSV_ABI sceGnmFlushGarlic();
void LibSceGnmDriver_Register(Loader::SymbolsResolver* sym); void LibSceGnmDriver_Register(Loader::SymbolsResolver* sym);

View File

@ -0,0 +1,280 @@
// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later
// Generated By moduleGenerator
#include "common/logging/log.h"
#include "error_codes.h"
#include "libsceaudioin.h"
namespace Libraries::AudioIn {
int PS4_SYSV_ABI sceAudioInChangeAppModuleState() {
LOG_ERROR(Lib_AudioIn, "(STUBBED) called");
return ORBIS_OK;
}
int PS4_SYSV_ABI sceAudioInClose() {
LOG_ERROR(Lib_AudioIn, "(STUBBED) called");
return ORBIS_OK;
}
int PS4_SYSV_ABI sceAudioInCountPorts() {
LOG_ERROR(Lib_AudioIn, "(STUBBED) called");
return ORBIS_OK;
}
int PS4_SYSV_ABI sceAudioInDeviceHqOpen() {
LOG_ERROR(Lib_AudioIn, "(STUBBED) called");
return ORBIS_OK;
}
int PS4_SYSV_ABI sceAudioInDeviceIdHqOpen() {
LOG_ERROR(Lib_AudioIn, "(STUBBED) called");
return ORBIS_OK;
}
int PS4_SYSV_ABI sceAudioInDeviceIdOpen() {
LOG_ERROR(Lib_AudioIn, "(STUBBED) called");
return ORBIS_OK;
}
int PS4_SYSV_ABI sceAudioInDeviceOpen() {
LOG_ERROR(Lib_AudioIn, "(STUBBED) called");
return ORBIS_OK;
}
int PS4_SYSV_ABI sceAudioInDeviceOpenEx() {
LOG_ERROR(Lib_AudioIn, "(STUBBED) called");
return ORBIS_OK;
}
int PS4_SYSV_ABI sceAudioInExtClose() {
LOG_ERROR(Lib_AudioIn, "(STUBBED) called");
return ORBIS_OK;
}
int PS4_SYSV_ABI sceAudioInExtCtrl() {
LOG_ERROR(Lib_AudioIn, "(STUBBED) called");
return ORBIS_OK;
}
int PS4_SYSV_ABI sceAudioInExtInput() {
LOG_ERROR(Lib_AudioIn, "(STUBBED) called");
return ORBIS_OK;
}
int PS4_SYSV_ABI sceAudioInExtOpen() {
LOG_ERROR(Lib_AudioIn, "(STUBBED) called");
return ORBIS_OK;
}
int PS4_SYSV_ABI sceAudioInExtSetAecMode() {
LOG_ERROR(Lib_AudioIn, "(STUBBED) called");
return ORBIS_OK;
}
int PS4_SYSV_ABI sceAudioInGetGain() {
LOG_ERROR(Lib_AudioIn, "(STUBBED) called");
return ORBIS_OK;
}
int PS4_SYSV_ABI sceAudioInGetHandleStatusInfo() {
LOG_ERROR(Lib_AudioIn, "(STUBBED) called");
return ORBIS_OK;
}
int PS4_SYSV_ABI sceAudioInGetRerouteCount() {
LOG_ERROR(Lib_AudioIn, "(STUBBED) called");
return ORBIS_OK;
}
int PS4_SYSV_ABI sceAudioInGetSilentState() {
LOG_ERROR(Lib_AudioIn, "(STUBBED) called");
return ORBIS_OK;
}
int PS4_SYSV_ABI sceAudioInHqOpen() {
LOG_ERROR(Lib_AudioIn, "(STUBBED) called");
return ORBIS_OK;
}
int PS4_SYSV_ABI sceAudioInHqOpenEx() {
LOG_ERROR(Lib_AudioIn, "(STUBBED) called");
return ORBIS_OK;
}
int PS4_SYSV_ABI sceAudioInInit() {
LOG_ERROR(Lib_AudioIn, "(STUBBED) called");
return ORBIS_OK;
}
int PS4_SYSV_ABI sceAudioInInput() {
LOG_ERROR(Lib_AudioIn, "(STUBBED) called");
return ORBIS_OK;
}
int PS4_SYSV_ABI sceAudioInInputs() {
LOG_ERROR(Lib_AudioIn, "(STUBBED) called");
return ORBIS_OK;
}
int PS4_SYSV_ABI sceAudioInIsSharedDevice() {
LOG_ERROR(Lib_AudioIn, "(STUBBED) called");
return ORBIS_OK;
}
int PS4_SYSV_ABI sceAudioInOpen() {
LOG_ERROR(Lib_AudioIn, "(DUMMY) called");
return 0x80260005; // ports are full return
}
int PS4_SYSV_ABI sceAudioInOpenEx() {
LOG_ERROR(Lib_AudioIn, "(STUBBED) called");
return ORBIS_OK;
}
int PS4_SYSV_ABI sceAudioInSetAllMute() {
LOG_ERROR(Lib_AudioIn, "(STUBBED) called");
return ORBIS_OK;
}
int PS4_SYSV_ABI sceAudioInSetCompressorPreGain() {
LOG_ERROR(Lib_AudioIn, "(STUBBED) called");
return ORBIS_OK;
}
int PS4_SYSV_ABI sceAudioInSetConnections() {
LOG_ERROR(Lib_AudioIn, "(STUBBED) called");
return ORBIS_OK;
}
int PS4_SYSV_ABI sceAudioInSetConnectionsForUser() {
LOG_ERROR(Lib_AudioIn, "(STUBBED) called");
return ORBIS_OK;
}
int PS4_SYSV_ABI sceAudioInSetDevConnection() {
LOG_ERROR(Lib_AudioIn, "(STUBBED) called");
return ORBIS_OK;
}
int PS4_SYSV_ABI sceAudioInSetFocusForUser() {
LOG_ERROR(Lib_AudioIn, "(STUBBED) called");
return ORBIS_OK;
}
int PS4_SYSV_ABI sceAudioInSetMode() {
LOG_ERROR(Lib_AudioIn, "(STUBBED) called");
return ORBIS_OK;
}
int PS4_SYSV_ABI sceAudioInSetMode2() {
LOG_ERROR(Lib_AudioIn, "(STUBBED) called");
return ORBIS_OK;
}
int PS4_SYSV_ABI sceAudioInSetPortConnections() {
LOG_ERROR(Lib_AudioIn, "(STUBBED) called");
return ORBIS_OK;
}
int PS4_SYSV_ABI sceAudioInSetPortStatuses() {
LOG_ERROR(Lib_AudioIn, "(STUBBED) called");
return ORBIS_OK;
}
int PS4_SYSV_ABI sceAudioInSetSparkParam() {
LOG_ERROR(Lib_AudioIn, "(STUBBED) called");
return ORBIS_OK;
}
int PS4_SYSV_ABI sceAudioInSetSparkSideTone() {
LOG_ERROR(Lib_AudioIn, "(STUBBED) called");
return ORBIS_OK;
}
int PS4_SYSV_ABI sceAudioInSetUsbGain() {
LOG_ERROR(Lib_AudioIn, "(STUBBED) called");
return ORBIS_OK;
}
int PS4_SYSV_ABI sceAudioInSetUserMute() {
LOG_ERROR(Lib_AudioIn, "(STUBBED) called");
return ORBIS_OK;
}
int PS4_SYSV_ABI sceAudioInVmicCreate() {
LOG_ERROR(Lib_AudioIn, "(STUBBED) called");
return ORBIS_OK;
}
int PS4_SYSV_ABI sceAudioInVmicDestroy() {
LOG_ERROR(Lib_AudioIn, "(STUBBED) called");
return ORBIS_OK;
}
int PS4_SYSV_ABI sceAudioInVmicWrite() {
LOG_ERROR(Lib_AudioIn, "(STUBBED) called");
return ORBIS_OK;
}
void RegisterlibSceAudioIn(Core::Loader::SymbolsResolver* sym) {
LIB_FUNCTION("IQtWgnrw6v8", "libSceAudioIn", 1, "libSceAudioIn", 1, 1,
sceAudioInChangeAppModuleState);
LIB_FUNCTION("Jh6WbHhnI68", "libSceAudioIn", 1, "libSceAudioIn", 1, 1, sceAudioInClose);
LIB_FUNCTION("8mtcsG-Qp5E", "libSceAudioIn", 1, "libSceAudioIn", 1, 1, sceAudioInCountPorts);
LIB_FUNCTION("5qRVfxOmbno", "libSceAudioIn", 1, "libSceAudioIn", 1, 1, sceAudioInDeviceHqOpen);
LIB_FUNCTION("gUNabrUkZNg", "libSceAudioIn", 1, "libSceAudioIn", 1, 1,
sceAudioInDeviceIdHqOpen);
LIB_FUNCTION("X-AQLtdxQOo", "libSceAudioIn", 1, "libSceAudioIn", 1, 1, sceAudioInDeviceIdOpen);
LIB_FUNCTION("VoX9InuwwTg", "libSceAudioIn", 1, "libSceAudioIn", 1, 1, sceAudioInDeviceOpen);
LIB_FUNCTION("48-miagyJ2I", "libSceAudioIn", 1, "libSceAudioIn", 1, 1, sceAudioInDeviceOpenEx);
LIB_FUNCTION("kFKJ3MVcDuo", "libSceAudioIn", 1, "libSceAudioIn", 1, 1, sceAudioInExtClose);
LIB_FUNCTION("mhAfefP9m2g", "libSceAudioIn", 1, "libSceAudioIn", 1, 1, sceAudioInExtCtrl);
LIB_FUNCTION("KpBKoHKVKEc", "libSceAudioIn", 1, "libSceAudioIn", 1, 1, sceAudioInExtInput);
LIB_FUNCTION("YZ+3seW7CyY", "libSceAudioIn", 1, "libSceAudioIn", 1, 1, sceAudioInExtOpen);
LIB_FUNCTION("FVGWf8JaHOE", "libSceAudioIn", 1, "libSceAudioIn", 1, 1, sceAudioInExtSetAecMode);
LIB_FUNCTION("S-rDUfQk9sg", "libSceAudioIn", 1, "libSceAudioIn", 1, 1, sceAudioInGetGain);
LIB_FUNCTION("NJam1-F7lNY", "libSceAudioIn", 1, "libSceAudioIn", 1, 1,
sceAudioInGetHandleStatusInfo);
LIB_FUNCTION("3shKmTrTw6c", "libSceAudioIn", 1, "libSceAudioIn", 1, 1,
sceAudioInGetRerouteCount);
LIB_FUNCTION("BohEAQ7DlUE", "libSceAudioIn", 1, "libSceAudioIn", 1, 1,
sceAudioInGetSilentState);
LIB_FUNCTION("nya-R5gDYhM", "libSceAudioIn", 1, "libSceAudioIn", 1, 1, sceAudioInHqOpen);
LIB_FUNCTION("CTh72m+IYbU", "libSceAudioIn", 1, "libSceAudioIn", 1, 1, sceAudioInHqOpenEx);
LIB_FUNCTION("SxQprgjttKE", "libSceAudioIn", 1, "libSceAudioIn", 1, 1, sceAudioInInit);
LIB_FUNCTION("LozEOU8+anM", "libSceAudioIn", 1, "libSceAudioIn", 1, 1, sceAudioInInput);
LIB_FUNCTION("rmgXsZ-2Tyk", "libSceAudioIn", 1, "libSceAudioIn", 1, 1, sceAudioInInputs);
LIB_FUNCTION("6QP1MzdFWhs", "libSceAudioIn", 1, "libSceAudioIn", 1, 1,
sceAudioInIsSharedDevice);
LIB_FUNCTION("5NE8Sjc7VC8", "libSceAudioIn", 1, "libSceAudioIn", 1, 1, sceAudioInOpen);
LIB_FUNCTION("+DY07NwJb0s", "libSceAudioIn", 1, "libSceAudioIn", 1, 1, sceAudioInOpenEx);
LIB_FUNCTION("vYFsze1SqU8", "libSceAudioIn", 1, "libSceAudioIn", 1, 1, sceAudioInSetAllMute);
LIB_FUNCTION("vyh-T6sMqnw", "libSceAudioIn", 1, "libSceAudioIn", 1, 1,
sceAudioInSetCompressorPreGain);
LIB_FUNCTION("YeBSNVAELe4", "libSceAudioIn", 1, "libSceAudioIn", 1, 1,
sceAudioInSetConnections);
LIB_FUNCTION("thLNHvkWSeg", "libSceAudioIn", 1, "libSceAudioIn", 1, 1,
sceAudioInSetConnectionsForUser);
LIB_FUNCTION("rcgv2ciDrtc", "libSceAudioIn", 1, "libSceAudioIn", 1, 1,
sceAudioInSetDevConnection);
LIB_FUNCTION("iN3KqF-8R-w", "libSceAudioIn", 1, "libSceAudioIn", 1, 1,
sceAudioInSetFocusForUser);
LIB_FUNCTION("VAzfxqDwbQ0", "libSceAudioIn", 1, "libSceAudioIn", 1, 1, sceAudioInSetMode);
LIB_FUNCTION("CwBFvAlOv7k", "libSceAudioIn", 1, "libSceAudioIn", 1, 1, sceAudioInSetMode2);
LIB_FUNCTION("tQpOPpYwv7o", "libSceAudioIn", 1, "libSceAudioIn", 1, 1,
sceAudioInSetPortConnections);
LIB_FUNCTION("NUWqWguYcNQ", "libSceAudioIn", 1, "libSceAudioIn", 1, 1,
sceAudioInSetPortStatuses);
LIB_FUNCTION("U0ivfdKFZbA", "libSceAudioIn", 1, "libSceAudioIn", 1, 1, sceAudioInSetSparkParam);
LIB_FUNCTION("hWMCAPpqzDo", "libSceAudioIn", 1, "libSceAudioIn", 1, 1,
sceAudioInSetSparkSideTone);
LIB_FUNCTION("nqXpw3MaN50", "libSceAudioIn", 1, "libSceAudioIn", 1, 1, sceAudioInSetUsbGain);
LIB_FUNCTION("arJp991xk5k", "libSceAudioIn", 1, "libSceAudioIn", 1, 1, sceAudioInSetUserMute);
LIB_FUNCTION("DVTn+iMSpBM", "libSceAudioIn", 1, "libSceAudioIn", 1, 1, sceAudioInVmicCreate);
LIB_FUNCTION("3ULZGIl+Acc", "libSceAudioIn", 1, "libSceAudioIn", 1, 1, sceAudioInVmicDestroy);
LIB_FUNCTION("4kHw99LUG3A", "libSceAudioIn", 1, "libSceAudioIn", 1, 1, sceAudioInVmicWrite);
};
} // namespace Libraries::AudioIn

View File

@ -0,0 +1,54 @@
// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later
#pragma once
#include "library_common.h"
namespace Libraries::AudioIn {
int PS4_SYSV_ABI sceAudioInChangeAppModuleState();
int PS4_SYSV_ABI sceAudioInClose();
int PS4_SYSV_ABI sceAudioInCountPorts();
int PS4_SYSV_ABI sceAudioInDeviceHqOpen();
int PS4_SYSV_ABI sceAudioInDeviceIdHqOpen();
int PS4_SYSV_ABI sceAudioInDeviceIdOpen();
int PS4_SYSV_ABI sceAudioInDeviceOpen();
int PS4_SYSV_ABI sceAudioInDeviceOpenEx();
int PS4_SYSV_ABI sceAudioInExtClose();
int PS4_SYSV_ABI sceAudioInExtCtrl();
int PS4_SYSV_ABI sceAudioInExtInput();
int PS4_SYSV_ABI sceAudioInExtOpen();
int PS4_SYSV_ABI sceAudioInExtSetAecMode();
int PS4_SYSV_ABI sceAudioInGetGain();
int PS4_SYSV_ABI sceAudioInGetHandleStatusInfo();
int PS4_SYSV_ABI sceAudioInGetRerouteCount();
int PS4_SYSV_ABI sceAudioInGetSilentState();
int PS4_SYSV_ABI sceAudioInHqOpen();
int PS4_SYSV_ABI sceAudioInHqOpenEx();
int PS4_SYSV_ABI sceAudioInInit();
int PS4_SYSV_ABI sceAudioInInput();
int PS4_SYSV_ABI sceAudioInInputs();
int PS4_SYSV_ABI sceAudioInIsSharedDevice();
int PS4_SYSV_ABI sceAudioInOpen();
int PS4_SYSV_ABI sceAudioInOpenEx();
int PS4_SYSV_ABI sceAudioInSetAllMute();
int PS4_SYSV_ABI sceAudioInSetCompressorPreGain();
int PS4_SYSV_ABI sceAudioInSetConnections();
int PS4_SYSV_ABI sceAudioInSetConnectionsForUser();
int PS4_SYSV_ABI sceAudioInSetDevConnection();
int PS4_SYSV_ABI sceAudioInSetFocusForUser();
int PS4_SYSV_ABI sceAudioInSetMode();
int PS4_SYSV_ABI sceAudioInSetMode2();
int PS4_SYSV_ABI sceAudioInSetPortConnections();
int PS4_SYSV_ABI sceAudioInSetPortStatuses();
int PS4_SYSV_ABI sceAudioInSetSparkParam();
int PS4_SYSV_ABI sceAudioInSetSparkSideTone();
int PS4_SYSV_ABI sceAudioInSetUsbGain();
int PS4_SYSV_ABI sceAudioInSetUserMute();
int PS4_SYSV_ABI sceAudioInVmicCreate();
int PS4_SYSV_ABI sceAudioInVmicDestroy();
int PS4_SYSV_ABI sceAudioInVmicWrite();
void RegisterlibSceAudioIn(Core::Loader::SymbolsResolver* sym);
} // namespace Libraries::AudioIn

View File

@ -272,8 +272,11 @@ s32 PS4_SYSV_ABI sceAudioOutOutput(s32 handle, const void* ptr) {
return audio->AudioOutOutput(handle, ptr); return audio->AudioOutOutput(handle, ptr);
} }
int PS4_SYSV_ABI sceAudioOutOutputs() { int PS4_SYSV_ABI sceAudioOutOutputs(OrbisAudioOutOutputParam* param, u32 num) {
LOG_ERROR(Lib_AudioOut, "(STUBBED) called"); for (u32 i = 0; i < num; i++) {
if (auto err = audio->AudioOutOutput(param[i].handle, param[i].ptr); err != 0)
return err;
}
return ORBIS_OK; return ORBIS_OK;
} }
@ -367,8 +370,10 @@ int PS4_SYSV_ABI sceAudioOutSetUsbVolume() {
return ORBIS_OK; return ORBIS_OK;
} }
int PS4_SYSV_ABI sceAudioOutSetVolume() { s32 PS4_SYSV_ABI sceAudioOutSetVolume(s32 handle, s32 flag, s32* vol) {
LOG_ERROR(Lib_AudioOut, "(STUBBED) called"); if (!audio->AudioOutSetVolume(handle, flag, vol)) {
return ORBIS_AUDIO_OUT_ERROR_INVALID_PORT;
}
return ORBIS_OK; return ORBIS_OK;
} }

View File

@ -30,6 +30,11 @@ enum OrbisAudioOutParam {
ORBIS_AUDIO_OUT_PARAM_FORMAT_FLOAT_8CH_STD = 7 ORBIS_AUDIO_OUT_PARAM_FORMAT_FLOAT_8CH_STD = 7
}; };
struct OrbisAudioOutOutputParam {
s32 handle;
const void* ptr;
};
int PS4_SYSV_ABI sceAudioOutDeviceIdOpen(); int PS4_SYSV_ABI sceAudioOutDeviceIdOpen();
int PS4_SYSV_ABI sceAudioDeviceControlGet(); int PS4_SYSV_ABI sceAudioDeviceControlGet();
int PS4_SYSV_ABI sceAudioDeviceControlSet(); int PS4_SYSV_ABI sceAudioDeviceControlSet();
@ -69,7 +74,7 @@ s32 PS4_SYSV_ABI sceAudioOutOpen(UserService::OrbisUserServiceUserId user_id,
u32 sample_rate, OrbisAudioOutParam param_type); u32 sample_rate, OrbisAudioOutParam param_type);
int PS4_SYSV_ABI sceAudioOutOpenEx(); int PS4_SYSV_ABI sceAudioOutOpenEx();
s32 PS4_SYSV_ABI sceAudioOutOutput(s32 handle, const void* ptr); s32 PS4_SYSV_ABI sceAudioOutOutput(s32 handle, const void* ptr);
int PS4_SYSV_ABI sceAudioOutOutputs(); s32 PS4_SYSV_ABI sceAudioOutOutputs(OrbisAudioOutOutputParam* param, u32 num);
int PS4_SYSV_ABI sceAudioOutPtClose(); int PS4_SYSV_ABI sceAudioOutPtClose();
int PS4_SYSV_ABI sceAudioOutPtGetLastOutputTime(); int PS4_SYSV_ABI sceAudioOutPtGetLastOutputTime();
int PS4_SYSV_ABI sceAudioOutPtOpen(); int PS4_SYSV_ABI sceAudioOutPtOpen();
@ -88,7 +93,7 @@ int PS4_SYSV_ABI sceAudioOutSetPortStatuses();
int PS4_SYSV_ABI sceAudioOutSetRecMode(); int PS4_SYSV_ABI sceAudioOutSetRecMode();
int PS4_SYSV_ABI sceAudioOutSetSparkParam(); int PS4_SYSV_ABI sceAudioOutSetSparkParam();
int PS4_SYSV_ABI sceAudioOutSetUsbVolume(); int PS4_SYSV_ABI sceAudioOutSetUsbVolume();
int PS4_SYSV_ABI sceAudioOutSetVolume(); s32 PS4_SYSV_ABI sceAudioOutSetVolume(s32 handle, s32 flag, s32* vol);
int PS4_SYSV_ABI sceAudioOutSetVolumeDown(); int PS4_SYSV_ABI sceAudioOutSetVolumeDown();
int PS4_SYSV_ABI sceAudioOutStartAuxBroadcast(); int PS4_SYSV_ABI sceAudioOutStartAuxBroadcast();
int PS4_SYSV_ABI sceAudioOutStartSharePlay(); int PS4_SYSV_ABI sceAudioOutStartSharePlay();

View File

@ -84,7 +84,7 @@ int PS4_SYSV_ABI _ZTVN3sce16CommonDialogUtil6ClientE() {
} }
int PS4_SYSV_ABI sceCommonDialogInitialize() { int PS4_SYSV_ABI sceCommonDialogInitialize() {
LOG_ERROR(Lib_CommonDlg, "(STUBBED) called"); LOG_ERROR(Lib_CommonDlg, "(DUMMY) called");
return ORBIS_OK; return ORBIS_OK;
} }

View File

@ -2,6 +2,7 @@
// SPDX-License-Identifier: GPL-2.0-or-later // SPDX-License-Identifier: GPL-2.0-or-later
// Generated By moduleGenerator // Generated By moduleGenerator
#include <common/assert.h>
#include "common/logging/log.h" #include "common/logging/log.h"
#include "error_codes.h" #include "error_codes.h"
#include "libscesavedata.h" #include "libscesavedata.h"
@ -328,9 +329,15 @@ int PS4_SYSV_ABI sceSaveDataMount() {
return ORBIS_OK; return ORBIS_OK;
} }
int PS4_SYSV_ABI sceSaveDataMount2() { s32 PS4_SYSV_ABI sceSaveDataMount2(const OrbisSaveDataMount2* mount,
LOG_ERROR(Lib_SaveData, "(STUBBED) called"); OrbisSaveDataMountResult* mount_result) {
return ORBIS_OK; // will return save data not found , breakpoint for others
LOG_ERROR(Lib_SaveData, "(DUMMY) called user_id = {} dir_name = {} blocks = {} mount_mode = {}",
mount->user_id, mount->dir_name->data, mount->blocks, mount->mount_mode);
if (mount->mount_mode == 1) { // open
return 0x809F0008; // save data not found
}
UNREACHABLE();
} }
int PS4_SYSV_ABI sceSaveDataMount5() { int PS4_SYSV_ABI sceSaveDataMount5() {

View File

@ -7,6 +7,37 @@
namespace Libraries::SaveData { namespace Libraries::SaveData {
constexpr int ORBIS_SAVE_DATA_DIRNAME_DATA_MAXSIZE =
32; // Maximum size for a save data directory name
constexpr int ORBIS_SAVE_DATA_MOUNT_POINT_DATA_MAXSIZE = 16; // Maximum size for a mount point name
struct OrbisSaveDataDirName {
char data[ORBIS_SAVE_DATA_DIRNAME_DATA_MAXSIZE];
};
struct OrbisSaveDataMount2 {
s32 user_id;
s32 unk1;
const OrbisSaveDataDirName* dir_name;
u64 blocks;
u32 mount_mode;
u8 reserved[32];
s32 unk2;
};
struct OrbisSaveDataMountPoint {
char data[ORBIS_SAVE_DATA_MOUNT_POINT_DATA_MAXSIZE];
};
struct OrbisSaveDataMountResult {
OrbisSaveDataMountPoint mount_point;
u64 required_blocks;
u32 unused;
u32 mount_status;
u8 reserved[28];
s32 unk1;
};
int PS4_SYSV_ABI sceSaveDataAbort(); int PS4_SYSV_ABI sceSaveDataAbort();
int PS4_SYSV_ABI sceSaveDataBackup(); int PS4_SYSV_ABI sceSaveDataBackup();
int PS4_SYSV_ABI sceSaveDataBindPsnAccount(); int PS4_SYSV_ABI sceSaveDataBindPsnAccount();
@ -71,7 +102,8 @@ int PS4_SYSV_ABI sceSaveDataIsDeletingUsbDb();
int PS4_SYSV_ABI sceSaveDataIsMounted(); int PS4_SYSV_ABI sceSaveDataIsMounted();
int PS4_SYSV_ABI sceSaveDataLoadIcon(); int PS4_SYSV_ABI sceSaveDataLoadIcon();
int PS4_SYSV_ABI sceSaveDataMount(); int PS4_SYSV_ABI sceSaveDataMount();
int PS4_SYSV_ABI sceSaveDataMount2(); s32 PS4_SYSV_ABI sceSaveDataMount2(const OrbisSaveDataMount2* mount,
OrbisSaveDataMountResult* mount_result);
int PS4_SYSV_ABI sceSaveDataMount5(); int PS4_SYSV_ABI sceSaveDataMount5();
int PS4_SYSV_ABI sceSaveDataMountInternal(); int PS4_SYSV_ABI sceSaveDataMountInternal();
int PS4_SYSV_ABI sceSaveDataMountSys(); int PS4_SYSV_ABI sceSaveDataMountSys();