Merge pull request #113 from shadps4-emu/cleanup

src: Reorganize and cleanup libraries
This commit is contained in:
georgemoralis 2024-04-14 11:32:57 +03:00 committed by GitHub
commit 5979fa74c5
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
85 changed files with 828 additions and 8681 deletions

View File

@ -96,103 +96,84 @@ endif()
set(AUDIO_CORE src/audio_core/sdl_audio.cpp set(AUDIO_CORE src/audio_core/sdl_audio.cpp
src/audio_core/sdl_audio.h src/audio_core/sdl_audio.h
) )
set(LIBRARIES src/core/libraries/library_common.h
src/core/libraries/error_codes.h set(AUDIO_LIB src/core/libraries/audio/audioin.cpp
src/core/libraries/libsceaudioin.cpp src/core/libraries/audio/audioin.h
src/core/libraries/libsceaudioin.h src/core/libraries/audio/audioout.cpp
src/core/libraries/libsceaudioout.cpp src/core/libraries/audio/audioout.h
src/core/libraries/libsceaudioout.h
src/core/libraries/libkernel.cpp
src/core/libraries/libkernel.h
src/core/libraries/libscecommondialog.cpp
src/core/libraries/libscecommondialog.h
src/core/libraries/libscegnmdriver.cpp
src/core/libraries/libscegnmdriver.h
src/core/libraries/libscehttp.cpp
src/core/libraries/libscehttp.h
src/core/libraries/libscemsgdialog.cpp
src/core/libraries/libscemsgdialog.h
src/core/libraries/libscenet.cpp
src/core/libraries/libscenet.h
src/core/libraries/libscenetctl.cpp
src/core/libraries/libscenetctl.h
src/core/libraries/libsceposix.cpp
src/core/libraries/libsceposix.h
src/core/libraries/libscesavedata.cpp
src/core/libraries/libscesavedata.h
src/core/libraries/libscesavedatadialog.cpp
src/core/libraries/libscesavedatadialog.h
src/core/libraries/libscessl.cpp
src/core/libraries/libscessl.h
src/core/libraries/libscesysmodule.cpp
src/core/libraries/libscesysmodule.h
src/core/libraries/libscesystemservice.cpp
src/core/libraries/libscesystemservice.h
src/core/libraries/libsceuserservice.cpp
src/core/libraries/libsceuserservice.h
) )
set(LIBC_SOURCES src/core/hle/libraries/libc/libc.cpp set(GNM_LIB src/core/libraries/gnmdriver/gnmdriver.cpp
src/core/hle/libraries/libc/libc.h src/core/libraries/gnmdriver/gnmdriver.h
src/core/hle/libraries/libc/printf.h
src/core/hle/libraries/libc/va_ctx.h
src/core/hle/libraries/libc/libc_cxa.cpp
src/core/hle/libraries/libc/libc_cxa.h
src/core/hle/libraries/libc/libc_stdio.cpp
src/core/hle/libraries/libc/libc_stdio.h
src/core/hle/libraries/libc/libc_math.cpp
src/core/hle/libraries/libc/libc_math.h
src/core/hle/libraries/libc/libc_string.cpp
src/core/hle/libraries/libc/libc_string.h
src/core/hle/libraries/libc/libc_stdlib.cpp
src/core/hle/libraries/libc/libc_stdlib.h
) )
set(PAD_SOURCES src/core/hle/libraries/libpad/pad.cpp set(KERNEL_LIB src/core/libraries/kernel/cpu_management.cpp
src/core/hle/libraries/libpad/pad.h src/core/libraries/kernel/cpu_management.h
src/core/libraries/kernel/event_queue.cpp
src/core/libraries/kernel/event_queue.h
src/core/libraries/kernel/event_queues.cpp
src/core/libraries/kernel/event_queues.h
src/core/libraries/kernel/file_system.cpp
src/core/libraries/kernel/file_system.h
src/core/libraries/kernel/libkernel.cpp
src/core/libraries/kernel/libkernel.h
src/core/libraries/kernel/memory_management.cpp
src/core/libraries/kernel/memory_management.h
src/core/libraries/kernel/physical_memory.cpp
src/core/libraries/kernel/physical_memory.h
src/core/libraries/kernel/thread_management.cpp
src/core/libraries/kernel/thread_management.h
src/core/libraries/kernel/time_management.cpp
src/core/libraries/kernel/time_management.h
) )
set(FILESYSTEM_SOURCES src/core/hle/libraries/libkernel/file_system.cpp set(NETWORK_LIBS src/core/libraries/network/http.cpp
src/core/hle/libraries/libkernel/file_system.h src/core/libraries/network/http.h
src/core/file_sys/fs.cpp src/core/libraries/network/net.cpp
src/core/file_sys/fs.h src/core/libraries/network/netctl.cpp
src/core/libraries/network/netctl.h
src/core/libraries/network/net.h
src/core/libraries/network/ssl.cpp
src/core/libraries/network/ssl.h
) )
set(HOST_SOURCES src/Emulator/Host/controller.cpp set(SYSTEM_LIBS src/core/libraries/system/commondialog.cpp
src/Emulator/Host/controller.h src/core/libraries/system/commondialog.h
src/core/libraries/system/msgdialog.cpp
src/core/libraries/system/msgdialog.h
src/core/libraries/system/posix.cpp
src/core/libraries/system/posix.h
src/core/libraries/system/savedata.cpp
src/core/libraries/system/savedatadialog.cpp
src/core/libraries/system/savedatadialog.h
src/core/libraries/system/savedata.h
src/core/libraries/system/sysmodule.cpp
src/core/libraries/system/sysmodule.h
src/core/libraries/system/systemservice.cpp
src/core/libraries/system/systemservice.h
src/core/libraries/system/userservice.cpp
src/core/libraries/system/userservice.h
) )
# the above is shared in sdl and qt version (TODO share them all) set(LIBC_SOURCES src/core/libraries/libc/libc.cpp
src/core/libraries/libc/libc.h
src/core/libraries/libc/printf.h
src/core/libraries/libc/va_ctx.h
src/core/libraries/libc/libc_cxa.cpp
src/core/libraries/libc/libc_cxa.h
src/core/libraries/libc/libc_stdio.cpp
src/core/libraries/libc/libc_stdio.h
src/core/libraries/libc/libc_math.cpp
src/core/libraries/libc/libc_math.h
src/core/libraries/libc/libc_string.cpp
src/core/libraries/libc/libc_string.h
src/core/libraries/libc/libc_stdlib.cpp
src/core/libraries/libc/libc_stdlib.h
)
if(ENABLE_QT_GUI) set(PAD_LIB src/core/libraries/pad/pad.cpp
qt_add_resources(RESOURCE_FILES src/shadps4.qrc) src/core/libraries/pad/pad.h
set(QT_GUI )
src/qt_gui/main_window_ui.h
src/qt_gui/main_window.cpp
src/qt_gui/main_window.h
src/qt_gui/gui_settings.cpp
src/qt_gui/gui_settings.h
src/qt_gui/gui_save.h
src/qt_gui/gui_context_menus.h
src/qt_gui/game_list_utils.h
src/qt_gui/game_info.cpp
src/qt_gui/game_info.h
src/qt_gui/game_list_frame.cpp
src/qt_gui/game_list_frame.h
src/qt_gui/game_grid_frame.cpp
src/qt_gui/game_grid_frame.h
src/qt_gui/game_install_dialog.cpp
src/qt_gui/game_install_dialog.h
src/qt_gui/pkg_viewer.cpp
src/qt_gui/pkg_viewer.h
src/qt_gui/settings.cpp
src/qt_gui/settings.h
src/qt_gui/main_window_themes.cpp
src/qt_gui/main_window_themes.h
src/qt_gui/main.cpp
${RESOURCE_FILES}
)
endif()
set(COMMON src/common/logging/backend.cpp set(COMMON src/common/logging/backend.cpp
src/common/logging/backend.h src/common/logging/backend.h
@ -236,96 +217,120 @@ set(COMMON src/common/logging/backend.cpp
src/common/version.h src/common/version.h
) )
set(CORE src/core/loader.cpp set(CORE src/core/aerolib/stubs.cpp
src/core/aerolib/stubs.h
src/core/aerolib/aerolib.cpp
src/core/aerolib/aerolib.h
src/core/crypto/crypto.cpp
src/core/crypto/crypto.h
src/core/crypto/keys.h
src/core/file_format/pfs.h
src/core/file_format/pkg.cpp
src/core/file_format/pkg.h
src/core/file_format/pkg_type.cpp
src/core/file_format/pkg_type.h
src/core/file_format/psf.cpp
src/core/file_format/psf.h
src/core/file_sys/fs.cpp
src/core/file_sys/fs.h
src/core/loader.cpp
src/core/loader.h src/core/loader.h
src/core/loader/elf.cpp
src/core/loader/elf.h
src/core/loader/symbols_resolver.h
src/core/loader/symbols_resolver.cpp
src/core/libraries/error_codes.h
src/core/libraries/libs.h
src/core/libraries/libs.cpp
${AUDIO_LIB}
${GNM_LIB}
${KERNEL_LIB}
${NETWORK_LIBS}
${SYSTEM_LIBS}
${LIBC_SOURCES}
${PAD_LIB}
src/core/linker.cpp
src/core/linker.h
src/core/tls.cpp
src/core/tls.h
src/core/virtual_memory.cpp
src/core/virtual_memory.h
) )
set(CRYPTO src/core/crypto/crypto.cpp set(VIDEO_CORE src/core/PS4/HLE/Graphics/video_out.cpp
src/core/crypto/crypto.h src/core/PS4/HLE/Graphics/video_out.h
src/core/crypto/keys.h src/core/PS4/HLE/Graphics/Objects/video_out_ctx.cpp
src/core/PS4/HLE/Graphics/Objects/video_out_ctx.h
src/core/PS4/HLE/Graphics/graphics_ctx.h
src/core/PS4/GPU/gpu_memory.cpp
src/core/PS4/GPU/gpu_memory.h
src/core/PS4/GPU/video_out_buffer.cpp
src/core/PS4/GPU/video_out_buffer.h
src/core/PS4/HLE/Graphics/graphics_render.cpp
src/core/PS4/HLE/Graphics/graphics_render.h
src/core/PS4/GPU/tile_manager.cpp
src/core/PS4/GPU/tile_manager.h
src/vulkan_util.cpp
src/vulkan_util.h
) )
set(FILE_FORMAT src/core/file_format/pfs.h
src/core/file_format/pkg.cpp set(INPUT src/input/controller.cpp
src/core/file_format/pkg.h src/input/controller.h
src/core/file_format/pkg_type.cpp
src/core/file_format/pkg_type.h
src/core/file_format/psf.cpp
src/core/file_format/psf.h
) )
# the above is shared in sdl and qt version (TODO share them all)
if(ENABLE_QT_GUI)
qt_add_resources(RESOURCE_FILES src/shadps4.qrc)
set(QT_GUI
src/qt_gui/main_window_ui.h
src/qt_gui/main_window.cpp
src/qt_gui/main_window.h
src/qt_gui/gui_settings.cpp
src/qt_gui/gui_settings.h
src/qt_gui/gui_save.h
src/qt_gui/gui_context_menus.h
src/qt_gui/game_list_utils.h
src/qt_gui/game_info.cpp
src/qt_gui/game_info.h
src/qt_gui/game_list_frame.cpp
src/qt_gui/game_list_frame.h
src/qt_gui/game_grid_frame.cpp
src/qt_gui/game_grid_frame.h
src/qt_gui/game_install_dialog.cpp
src/qt_gui/game_install_dialog.h
src/qt_gui/pkg_viewer.cpp
src/qt_gui/pkg_viewer.h
src/qt_gui/settings.cpp
src/qt_gui/settings.h
src/qt_gui/main_window_themes.cpp
src/qt_gui/main_window_themes.h
src/qt_gui/main.cpp
${RESOURCE_FILES}
)
endif()
if(ENABLE_QT_GUI) if(ENABLE_QT_GUI)
qt_add_executable(shadps4 qt_add_executable(shadps4
${AUDIO_CORE}
${INPUT}
${QT_GUI} ${QT_GUI}
${COMMON} ${COMMON}
${CORE} ${CORE}
${CRYPTO} ${VIDEO_CORE}
${FILE_FORMAT} src/emulator.cpp
src/emulator.h
) )
else() else()
add_executable(shadps4 add_executable(shadps4
${AUDIO_CORE} ${AUDIO_CORE}
${LIBC_SOURCES} ${INPUT}
${PAD_SOURCES}
${FILESYSTEM_SOURCES}
${HOST_SOURCES}
${LIBRARIES}
src/main.cpp
src/core/loader/elf.cpp
src/core/loader/elf.h
src/core/virtual_memory.cpp
src/core/virtual_memory.h
src/core/linker.cpp
src/core/linker.h
src/core/aerolib/stubs.cpp
src/core/aerolib/stubs.h
src/core/aerolib/aerolib.cpp
src/core/aerolib/aerolib.h
src/core/hle/kernel/Objects/physical_memory.h
src/core/hle/kernel/Objects/physical_memory.cpp
src/core/PS4/HLE/Graphics/video_out.cpp
src/core/PS4/HLE/Graphics/video_out.h
src/core/hle/kernel/event_queues.cpp
src/core/hle/kernel/event_queues.h
src/core/hle/kernel/cpu_management.cpp
src/core/hle/kernel/cpu_management.h
src/core/loader/symbols_resolver.h
src/core/loader/symbols_resolver.cpp
src/core/hle/libraries/libs.cpp
src/core/hle/libraries/libs.h
src/core/hle/libraries/libkernel/libkernel.cpp
src/core/hle/libraries/libkernel/libkernel.h
src/core/hle/libraries/libscegnmdriver/libscegnmdriver.cpp
src/core/hle/libraries/libscegnmdriver/libscegnmdriver.h
src/core/hle/libraries/libkernel/thread_management.cpp
src/core/hle/libraries/libkernel/thread_management.h
src/core/hle/kernel/memory_management.cpp
src/core/hle/kernel/memory_management.h
src/core/hle/error_codes.h
src/core/PS4/GPU/gpu_memory.cpp
src/core/PS4/GPU/gpu_memory.h
src/emulator.cpp
src/emulator.h
src/core/hle/kernel/Objects/event_queue.h
src/core/hle/kernel/Objects/event_queue.cpp
src/core/PS4/HLE/Graphics/Objects/video_out_ctx.cpp
src/core/PS4/HLE/Graphics/Objects/video_out_ctx.h
src/core/PS4/HLE/Graphics/graphics_ctx.h
src/vulkan_util.cpp
src/vulkan_util.h
src/core/PS4/GPU/video_out_buffer.cpp
src/core/PS4/GPU/video_out_buffer.h
src/core/PS4/HLE/Graphics/graphics_render.cpp
src/core/PS4/HLE/Graphics/graphics_render.h
src/core/PS4/GPU/tile_manager.cpp
src/core/PS4/GPU/tile_manager.h
src/core/hle/libraries/libkernel/time_management.cpp
src/core/hle/libraries/libkernel/time_management.h
src/core/tls.cpp
src/core/tls.h
${COMMON} ${COMMON}
${CORE} ${CORE}
${CRYPTO} ${VIDEO_CORE}
${FILE_FORMAT} src/main.cpp
src/emulator.cpp
src/emulator.h
) )
endif() endif()

View File

@ -5,9 +5,8 @@
#include <mutex> #include <mutex>
#include <SDL.h> #include <SDL.h>
#include <core/libraries/libsceaudioout.h>
#include "src/common/types.h" #include "core/libraries/audio/audioout.h"
namespace Audio { namespace Audio {

View File

@ -3,7 +3,7 @@
#include "common/debug.h" #include "common/debug.h"
#include "core/PS4/HLE/Graphics/Objects/video_out_ctx.h" #include "core/PS4/HLE/Graphics/Objects/video_out_ctx.h"
#include "core/hle/libraries/libkernel/time_management.h" #include "core/libraries/kernel/time_management.h"
namespace HLE::Graphics::Objects { namespace HLE::Graphics::Objects {
@ -62,9 +62,8 @@ void VideoOutCtx::Vblank() {
if (m_video_out_ctx.isOpened) { if (m_video_out_ctx.isOpened) {
m_video_out_ctx.m_mutex.lock(); m_video_out_ctx.m_mutex.lock();
m_video_out_ctx.m_vblank_status.count++; m_video_out_ctx.m_vblank_status.count++;
m_video_out_ctx.m_vblank_status.processTime = m_video_out_ctx.m_vblank_status.processTime = Libraries::Kernel::sceKernelGetProcessTime();
Core::Libraries::LibKernel::sceKernelGetProcessTime(); m_video_out_ctx.m_vblank_status.tsc = Libraries::Kernel::sceKernelReadTsc();
m_video_out_ctx.m_vblank_status.tsc = Core::Libraries::LibKernel::sceKernelReadTsc();
m_video_out_ctx.m_mutex.unlock(); m_video_out_ctx.m_mutex.unlock();
} }
} }
@ -91,7 +90,7 @@ bool FlipQueue::submitFlip(VideoConfigInternal* cfg, s32 index, s64 flip_arg) {
r.cfg = cfg; r.cfg = cfg;
r.index = index; r.index = index;
r.flip_arg = flip_arg; r.flip_arg = flip_arg;
r.submit_tsc = Core::Libraries::LibKernel::sceKernelReadTsc(); r.submit_tsc = Libraries::Kernel::sceKernelReadTsc();
m_requests.push_back(r); m_requests.push_back(r);
@ -127,7 +126,7 @@ bool FlipQueue::flip(u32 micros) {
std::scoped_lock cfg_lock{request->cfg->m_mutex}; std::scoped_lock cfg_lock{request->cfg->m_mutex};
for (auto& flip_eq : request->cfg->m_flip_evtEq) { for (auto& flip_eq : request->cfg->m_flip_evtEq) {
if (flip_eq != nullptr) { if (flip_eq != nullptr) {
flip_eq->triggerEvent(SCE_VIDEO_OUT_EVENT_FLIP, Core::Kernel::EVFILT_VIDEO_OUT, flip_eq->triggerEvent(SCE_VIDEO_OUT_EVENT_FLIP, Libraries::Kernel::EVFILT_VIDEO_OUT,
reinterpret_cast<void*>(request->flip_arg)); reinterpret_cast<void*>(request->flip_arg));
} }
} }
@ -137,8 +136,8 @@ bool FlipQueue::flip(u32 micros) {
m_done_cond.notify_one(); m_done_cond.notify_one();
request->cfg->m_flip_status.count++; request->cfg->m_flip_status.count++;
request->cfg->m_flip_status.processTime = Core::Libraries::LibKernel::sceKernelGetProcessTime(); request->cfg->m_flip_status.processTime = Libraries::Kernel::sceKernelGetProcessTime();
request->cfg->m_flip_status.tsc = Core::Libraries::LibKernel::sceKernelReadTsc(); request->cfg->m_flip_status.tsc = Libraries::Kernel::sceKernelReadTsc();
request->cfg->m_flip_status.submitTsc = request->submit_tsc; request->cfg->m_flip_status.submitTsc = request->submit_tsc;
request->cfg->m_flip_status.flipArg = request->flip_arg; request->cfg->m_flip_status.flipArg = request->flip_arg;
request->cfg->m_flip_status.currentBuffer = request->index; request->cfg->m_flip_status.currentBuffer = request->index;

View File

@ -27,7 +27,7 @@ struct VideoConfigInternal {
bool isOpened = false; bool isOpened = false;
SceVideoOutFlipStatus m_flip_status; SceVideoOutFlipStatus m_flip_status;
SceVideoOutVblankStatus m_vblank_status; SceVideoOutVblankStatus m_vblank_status;
std::vector<Core::Kernel::SceKernelEqueue> m_flip_evtEq; std::vector<Libraries::Kernel::SceKernelEqueue> m_flip_evtEq;
int m_flip_rate = 0; int m_flip_rate = 0;
VideoOutBufferInfo buffers[16]; VideoOutBufferInfo buffers[16];
std::vector<VideoOutBufferSetInternal> buffers_sets; std::vector<VideoOutBufferSetInternal> buffers_sets;

View File

@ -1,7 +1,6 @@
// 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 <cstdio>
#include <string> #include <string>
#include "Objects/video_out_ctx.h" #include "Objects/video_out_ctx.h"
#include "common/config.h" #include "common/config.h"
@ -12,12 +11,12 @@
#include "core/PS4/GPU/video_out_buffer.h" #include "core/PS4/GPU/video_out_buffer.h"
#include "core/PS4/HLE/Graphics/graphics_render.h" #include "core/PS4/HLE/Graphics/graphics_render.h"
#include "core/PS4/HLE/Graphics/video_out.h" #include "core/PS4/HLE/Graphics/video_out.h"
#include "core/hle/error_codes.h" #include "core/libraries/error_codes.h"
#include "core/hle/libraries/libs.h" #include "core/libraries/gnmdriver/gnmdriver.h"
#include "core/hle/libraries/libscegnmdriver/libscegnmdriver.h" #include "core/libraries/libs.h"
#include "core/loader/symbols_resolver.h" #include "core/loader/symbols_resolver.h"
#include "emulator.h" #include "emulator.h"
#include "src/core/libraries/libsceuserservice.h" #include "src/core/libraries/system/userservice.h"
namespace HLE::Libs::Graphics::VideoOut { namespace HLE::Libs::Graphics::VideoOut {
@ -78,24 +77,24 @@ void PS4_SYSV_ABI sceVideoOutSetBufferAttribute(SceVideoOutBufferAttribute* attr
attribute->option = SCE_VIDEO_OUT_BUFFER_ATTRIBUTE_OPTION_NONE; attribute->option = SCE_VIDEO_OUT_BUFFER_ATTRIBUTE_OPTION_NONE;
} }
static void flip_reset_event_func(Core::Kernel::EqueueEvent* event) { static void flip_reset_event_func(Libraries::Kernel::EqueueEvent* event) {
event->isTriggered = false; event->isTriggered = false;
event->event.fflags = 0; event->event.fflags = 0;
event->event.data = 0; event->event.data = 0;
} }
static void flip_trigger_event_func(Core::Kernel::EqueueEvent* event, void* trigger_data) { static void flip_trigger_event_func(Libraries::Kernel::EqueueEvent* event, void* trigger_data) {
event->isTriggered = true; event->isTriggered = true;
event->event.fflags++; event->event.fflags++;
event->event.data = reinterpret_cast<intptr_t>(trigger_data); event->event.data = reinterpret_cast<intptr_t>(trigger_data);
} }
static void flip_delete_event_func(Core::Kernel::SceKernelEqueue eq, static void flip_delete_event_func(Libraries::Kernel::SceKernelEqueue eq,
Core::Kernel::EqueueEvent* event) { Libraries::Kernel::EqueueEvent* event) {
BREAKPOINT(); // TODO BREAKPOINT(); // TODO
} }
s32 PS4_SYSV_ABI sceVideoOutAddFlipEvent(Core::Kernel::SceKernelEqueue eq, s32 handle, s32 PS4_SYSV_ABI sceVideoOutAddFlipEvent(Libraries::Kernel::SceKernelEqueue eq, s32 handle,
void* udata) { void* udata) {
LOG_INFO(Lib_VideoOut, "handle = {}", handle); LOG_INFO(Lib_VideoOut, "handle = {}", handle);
@ -112,10 +111,10 @@ s32 PS4_SYSV_ABI sceVideoOutAddFlipEvent(Core::Kernel::SceKernelEqueue eq, s32 h
return SCE_VIDEO_OUT_ERROR_INVALID_EVENT_QUEUE; return SCE_VIDEO_OUT_ERROR_INVALID_EVENT_QUEUE;
} }
Core::Kernel::EqueueEvent event{}; Libraries::Kernel::EqueueEvent event{};
event.isTriggered = false; event.isTriggered = false;
event.event.ident = SCE_VIDEO_OUT_EVENT_FLIP; event.event.ident = SCE_VIDEO_OUT_EVENT_FLIP;
event.event.filter = Core::Kernel::EVFILT_VIDEO_OUT; event.event.filter = Libraries::Kernel::EVFILT_VIDEO_OUT;
event.event.udata = udata; event.event.udata = udata;
event.event.fflags = 0; event.event.fflags = 0;
event.event.data = 0; event.event.data = 0;
@ -280,8 +279,8 @@ s32 PS4_SYSV_ABI sceVideoOutSubmitFlip(s32 handle, s32 bufferIndex, s32 flipMode
LOG_ERROR(Lib_VideoOut, "Flip queue is full"); LOG_ERROR(Lib_VideoOut, "Flip queue is full");
return SCE_VIDEO_OUT_ERROR_FLIP_QUEUE_FULL; return SCE_VIDEO_OUT_ERROR_FLIP_QUEUE_FULL;
} }
Core::Libraries::LibSceGnmDriver::sceGnmFlushGarlic(); // hackish should be done that neccesary Libraries::GnmDriver::sceGnmFlushGarlic(); // hackish should be done that neccesary
// for niko's homebrew // for niko's homebrew
return SCE_OK; return SCE_OK;
} }

View File

@ -4,7 +4,7 @@
#pragma once #pragma once
#include <string> #include <string>
#include "core/hle/kernel/event_queues.h" #include "core/libraries/kernel/event_queues.h"
namespace Core::Loader { namespace Core::Loader {
class SymbolsResolver; class SymbolsResolver;
@ -115,7 +115,8 @@ void VideoOutVblank();
void PS4_SYSV_ABI sceVideoOutSetBufferAttribute(SceVideoOutBufferAttribute* attribute, void PS4_SYSV_ABI sceVideoOutSetBufferAttribute(SceVideoOutBufferAttribute* attribute,
u32 pixelFormat, u32 tilingMode, u32 aspectRatio, u32 pixelFormat, u32 tilingMode, u32 aspectRatio,
u32 width, u32 height, u32 pitchInPixel); u32 width, u32 height, u32 pitchInPixel);
s32 PS4_SYSV_ABI sceVideoOutAddFlipEvent(Core::Kernel::SceKernelEqueue eq, s32 handle, void* udata); s32 PS4_SYSV_ABI sceVideoOutAddFlipEvent(Libraries::Kernel::SceKernelEqueue eq, s32 handle,
void* udata);
s32 PS4_SYSV_ABI sceVideoOutRegisterBuffers(s32 handle, s32 startIndex, void* const* addresses, s32 PS4_SYSV_ABI sceVideoOutRegisterBuffers(s32 handle, s32 startIndex, void* const* addresses,
s32 bufferNum, s32 bufferNum,
const SceVideoOutBufferAttribute* attribute); const SceVideoOutBufferAttribute* attribute);

View File

@ -1,247 +0,0 @@
// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later
#pragma once
// posix error codes
constexpr int POSIX_EPERM = 1;
constexpr int POSIX_ENOENT = 2;
constexpr int POSIX_ESRCH = 3;
constexpr int POSIX_EINTR = 4;
constexpr int POSIX_EIO = 5;
constexpr int POSIX_ENXIO = 6;
constexpr int POSIX_E2BIG = 7;
constexpr int POSIX_ENOEXEC = 8;
constexpr int POSIX_EBADF = 9;
constexpr int POSIX_ECHILD = 10;
constexpr int POSIX_EDEADLK = 11;
constexpr int POSIX_ENOMEM = 12;
constexpr int POSIX_EACCES = 13;
constexpr int POSIX_EFAULT = 14;
constexpr int POSIX_ENOTBLK = 15;
constexpr int POSIX_EBUSY = 16;
constexpr int POSIX_EEXIST = 17;
constexpr int POSIX_EXDEV = 18;
constexpr int POSIX_ENODEV = 19;
constexpr int POSIX_ENOTDIR = 20;
constexpr int POSIX_EISDIR = 21;
constexpr int POSIX_EINVAL = 22;
constexpr int POSIX_ENFILE = 23;
constexpr int POSIX_EMFILE = 24;
constexpr int POSIX_ENOTTY = 25;
constexpr int POSIX_ETXTBSY = 26;
constexpr int POSIX_EFBIG = 27;
constexpr int POSIX_ENOSPC = 28;
constexpr int POSIX_ESPIPE = 29;
constexpr int POSIX_EROFS = 30;
constexpr int POSIX_EMLINK = 31;
constexpr int POSIX_EPIPE = 32;
constexpr int POSIX_EDOM = 33;
constexpr int POSIX_ERANGE = 34;
constexpr int POSIX_EAGAIN = 35;
constexpr int POSIX_EWOULDBLOCK = 35;
constexpr int POSIX_EINPROGRESS = 36;
constexpr int POSIX_EALREADY = 37;
constexpr int POSIX_ENOTSOCK = 38;
constexpr int POSIX_EDESTADDRREQ = 39;
constexpr int POSIX_EMSGSIZE = 40;
constexpr int POSIX_EPROTOTYPE = 41;
constexpr int POSIX_ENOPROTOOPT = 42;
constexpr int POSIX_EPROTONOSUPPORT = 43;
constexpr int POSIX_ESOCKTNOSUPPORT = 44;
constexpr int POSIX_EOPNOTSUPP = 45;
constexpr int POSIX_ENOTSUP = 45;
constexpr int POSIX_EPFNOSUPPORT = 46;
constexpr int POSIX_EAFNOSUPPORT = 47;
constexpr int POSIX_EADDRINUSE = 48;
constexpr int POSIX_EADDRNOTAVAIL = 49;
constexpr int POSIX_ENETDOWN = 50;
constexpr int POSIX_ENETUNREACH = 51;
constexpr int POSIX_ENETRESET = 52;
constexpr int POSIX_ECONNABORTED = 53;
constexpr int POSIX_ECONNRESET = 54;
constexpr int POSIX_ENOBUFS = 55;
constexpr int POSIX_EISCONN = 56;
constexpr int POSIX_ENOTCONN = 57;
constexpr int POSIX_ESHUTDOWN = 58;
constexpr int POSIX_ETOOMANYREFS = 59;
constexpr int POSIX_ETIMEDOUT = 60;
constexpr int POSIX_ECONNREFUSED = 61;
constexpr int POSIX_ELOOP = 62;
constexpr int POSIX_ENAMETOOLONG = 63;
constexpr int POSIX_EHOSTDOWN = 64;
constexpr int POSIX_EHOSTUNREACH = 65;
constexpr int POSIX_ENOTEMPTY = 66;
constexpr int POSIX_EPROCLIM = 67;
constexpr int POSIX_EUSERS = 68;
constexpr int POSIX_EDQUOT = 69;
constexpr int POSIX_ESTALE = 70;
constexpr int POSIX_EREMOTE = 71;
constexpr int POSIX_EBADRPC = 72;
constexpr int POSIX_ERPCMISMATCH = 73;
constexpr int POSIX_EPROGUNAVAIL = 74;
constexpr int POSIX_EPROGMISMATCH = 75;
constexpr int POSIX_EPROCUNAVAIL = 76;
constexpr int POSIX_ENOLCK = 77;
constexpr int POSIX_ENOSYS = 78;
constexpr int POSIX_EFTYPE = 79;
constexpr int POSIX_EAUTH = 80;
constexpr int POSIX_ENEEDAUTH = 81;
constexpr int POSIX_EIDRM = 82;
constexpr int POSIX_ENOMSG = 83;
constexpr int POSIX_EOVERFLOW = 84;
constexpr int POSIX_ECANCELED = 85;
constexpr int POSIX_EILSEQ = 86;
constexpr int POSIX_ENOATTR = 87;
constexpr int POSIX_EDOOFUS = 88;
constexpr int POSIX_EBADMSG = 89;
constexpr int POSIX_EMULTIHOP = 90;
constexpr int POSIX_ENOLINK = 91;
constexpr int POSIX_EPROTO = 92;
constexpr int POSIX_ENOTCAPABLE = 93;
constexpr int POSIX_ECAPMODE = 94;
constexpr int POSIX_ENOBLK = 95;
constexpr int POSIX_EICV = 96;
constexpr int POSIX_ENOPLAYGOENT = 97;
constexpr int POSIX_EREVOKE = 98;
constexpr int POSIX_ESDKVERSION = 99;
constexpr int POSIX_ESTART = 100;
constexpr int POSIX_ESTOP = 101;
constexpr int POSIX_EINVALID2MB = 102;
constexpr int POSIX_ELAST = 102;
constexpr int POSIX_EADHOC = 160;
constexpr int POSIX_EINACTIVEDISABLED = 163;
constexpr int POSIX_ENETNODATA = 164;
constexpr int POSIX_ENETDESC = 165;
constexpr int POSIX_ENETDESCTIMEDOUT = 166;
constexpr int POSIX_ENETINTR = 167;
constexpr int POSIX_ERETURN = 205;
constexpr int POSIX_EFPOS = 152;
constexpr int POSIX_ENODATA = 1040;
constexpr int POSIX_ENOSR = 1050;
constexpr int POSIX_ENOSTR = 1051;
constexpr int POSIX_ENOTRECOVERABLE = 1056;
constexpr int POSIX_EOTHER = 1062;
constexpr int POSIX_EOWNERDEAD = 1064;
constexpr int POSIX_ETIME = 1074;
constexpr int SCE_OK = 0;
// kernel error codes
constexpr int SCE_KERNEL_ERROR_UNKNOWN = 0x80020000;
constexpr int SCE_KERNEL_ERROR_EPERM = 0x80020001;
constexpr int SCE_KERNEL_ERROR_ENOENT = 0x80020002;
constexpr int SCE_KERNEL_ERROR_ESRCH = 0x80020003;
constexpr int SCE_KERNEL_ERROR_EINTR = 0x80020004;
constexpr int SCE_KERNEL_ERROR_EIO = 0x80020005;
constexpr int SCE_KERNEL_ERROR_ENXIO = 0x80020006;
constexpr int SCE_KERNEL_ERROR_E2BIG = 0x80020007;
constexpr int SCE_KERNEL_ERROR_ENOEXEC = 0x80020008;
constexpr int SCE_KERNEL_ERROR_EBADF = 0x80020009;
constexpr int SCE_KERNEL_ERROR_ECHILD = 0x8002000A;
constexpr int SCE_KERNEL_ERROR_EDEADLK = 0x8002000B;
constexpr int SCE_KERNEL_ERROR_ENOMEM = 0x8002000C;
constexpr int SCE_KERNEL_ERROR_EACCES = 0x8002000D;
constexpr int SCE_KERNEL_ERROR_EFAULT = 0x8002000E;
constexpr int SCE_KERNEL_ERROR_ENOTBLK = 0x8002000F;
constexpr int SCE_KERNEL_ERROR_EBUSY = 0x80020010;
constexpr int SCE_KERNEL_ERROR_EEXIST = 0x80020011;
constexpr int SCE_KERNEL_ERROR_EXDEV = 0x80020012;
constexpr int SCE_KERNEL_ERROR_ENODEV = 0x80020013;
constexpr int SCE_KERNEL_ERROR_ENOTDIR = 0x80020014;
constexpr int SCE_KERNEL_ERROR_EISDIR = 0x80020015;
constexpr int SCE_KERNEL_ERROR_EINVAL = 0x80020016;
constexpr int SCE_KERNEL_ERROR_ENFILE = 0x80020017;
constexpr int SCE_KERNEL_ERROR_EMFILE = 0x80020018;
constexpr int SCE_KERNEL_ERROR_ENOTTY = 0x80020019;
constexpr int SCE_KERNEL_ERROR_ETXTBSY = 0x8002001A;
constexpr int SCE_KERNEL_ERROR_EFBIG = 0x8002001B;
constexpr int SCE_KERNEL_ERROR_ENOSPC = 0x8002001C;
constexpr int SCE_KERNEL_ERROR_ESPIPE = 0x8002001D;
constexpr int SCE_KERNEL_ERROR_EROFS = 0x8002001E;
constexpr int SCE_KERNEL_ERROR_EMLINK = 0x8002001F;
constexpr int SCE_KERNEL_ERROR_EPIPE = 0x80020020;
constexpr int SCE_KERNEL_ERROR_EDOM = 0x80020021;
constexpr int SCE_KERNEL_ERROR_ERANGE = 0x80020022;
constexpr int SCE_KERNEL_ERROR_EAGAIN = 0x80020023;
constexpr int SCE_KERNEL_ERROR_EWOULDBLOCK = 0x80020023;
constexpr int SCE_KERNEL_ERROR_EINPROGRESS = 0x80020024;
constexpr int SCE_KERNEL_ERROR_EALREADY = 0x80020025;
constexpr int SCE_KERNEL_ERROR_ENOTSOCK = 0x80020026;
constexpr int SCE_KERNEL_ERROR_EDESTADDRREQ = 0x80020027;
constexpr int SCE_KERNEL_ERROR_EMSGSIZE = 0x80020028;
constexpr int SCE_KERNEL_ERROR_EPROTOTYPE = 0x80020029;
constexpr int SCE_KERNEL_ERROR_ENOPROTOOPT = 0x8002002A;
constexpr int SCE_KERNEL_ERROR_EPROTONOSUPPORT = 0x8002002B;
constexpr int SCE_KERNEL_ERROR_ESOCKTNOSUPPORT = 0x8002002C;
constexpr int SCE_KERNEL_ERROR_EOPNOTSUPP = 0x8002002D;
constexpr int SCE_KERNEL_ERROR_ENOTSUP = 0x8002002D;
constexpr int SCE_KERNEL_ERROR_EPFNOSUPPORT = 0x8002002E;
constexpr int SCE_KERNEL_ERROR_EAFNOSUPPORT = 0x8002002F;
constexpr int SCE_KERNEL_ERROR_EADDRINUSE = 0x80020030;
constexpr int SCE_KERNEL_ERROR_EADDRNOTAVAIL = 0x80020031;
constexpr int SCE_KERNEL_ERROR_ENETDOWN = 0x80020032;
constexpr int SCE_KERNEL_ERROR_ENETUNREACH = 0x80020033;
constexpr int SCE_KERNEL_ERROR_ENETRESET = 0x80020034;
constexpr int SCE_KERNEL_ERROR_ECONNABORTED = 0x80020035;
constexpr int SCE_KERNEL_ERROR_ECONNRESET = 0x80020036;
constexpr int SCE_KERNEL_ERROR_ENOBUFS = 0x80020037;
constexpr int SCE_KERNEL_ERROR_EISCONN = 0x80020038;
constexpr int SCE_KERNEL_ERROR_ENOTCONN = 0x80020039;
constexpr int SCE_KERNEL_ERROR_ESHUTDOWN = 0x8002003A;
constexpr int SCE_KERNEL_ERROR_ETOOMANYREFS = 0x8002003B;
constexpr int SCE_KERNEL_ERROR_ETIMEDOUT = 0x8002003C;
constexpr int SCE_KERNEL_ERROR_ECONNREFUSED = 0x8002003D;
constexpr int SCE_KERNEL_ERROR_ELOOP = 0x8002003E;
constexpr int SCE_KERNEL_ERROR_ENAMETOOLONG = 0x8002003F;
constexpr int SCE_KERNEL_ERROR_EHOSTDOWN = 0x80020040;
constexpr int SCE_KERNEL_ERROR_EHOSTUNREACH = 0x80020041;
constexpr int SCE_KERNEL_ERROR_ENOTEMPTY = 0x80020042;
constexpr int SCE_KERNEL_ERROR_EPROCLIM = 0x80020043;
constexpr int SCE_KERNEL_ERROR_EUSERS = 0x80020044;
constexpr int SCE_KERNEL_ERROR_EDQUOT = 0x80020045;
constexpr int SCE_KERNEL_ERROR_ESTALE = 0x80020046;
constexpr int SCE_KERNEL_ERROR_EREMOTE = 0x80020047;
constexpr int SCE_KERNEL_ERROR_EBADRPC = 0x80020048;
constexpr int SCE_KERNEL_ERROR_ERPCMISMATCH = 0x80020049;
constexpr int SCE_KERNEL_ERROR_EPROGUNAVAIL = 0x8002004A;
constexpr int SCE_KERNEL_ERROR_EPROGMISMATCH = 0x8002004B;
constexpr int SCE_KERNEL_ERROR_EPROCUNAVAIL = 0x8002004C;
constexpr int SCE_KERNEL_ERROR_ENOLCK = 0x8002004D;
constexpr int SCE_KERNEL_ERROR_ENOSYS = 0x8002004E;
constexpr int SCE_KERNEL_ERROR_EFTYPE = 0x8002004F;
constexpr int SCE_KERNEL_ERROR_EAUTH = 0x80020050;
constexpr int SCE_KERNEL_ERROR_ENEEDAUTH = 0x80020051;
constexpr int SCE_KERNEL_ERROR_EIDRM = 0x80020052;
constexpr int SCE_KERNEL_ERROR_ENOMSG = 0x80020053;
constexpr int SCE_KERNEL_ERROR_EOVERFLOW = 0x80020054;
constexpr int SCE_KERNEL_ERROR_ECANCELED = 0x80020055;
constexpr int SCE_KERNEL_ERROR_EILSEQ = 0x80020056;
constexpr int SCE_KERNEL_ERROR_ENOATTR = 0x80020057;
constexpr int SCE_KERNEL_ERROR_EDOOFUS = 0x80020058;
constexpr int SCE_KERNEL_ERROR_EBADMSG = 0x80020059;
constexpr int SCE_KERNEL_ERROR_EMULTIHOP = 0x8002005A;
constexpr int SCE_KERNEL_ERROR_ENOLINK = 0x8002005B;
constexpr int SCE_KERNEL_ERROR_EPROTO = 0x8002005C;
constexpr int SCE_KERNEL_ERROR_ENOTCAPABLE = 0x8002005D;
constexpr int SCE_KERNEL_ERROR_ECAPMODE = 0x8002005E;
constexpr int SCE_KERNEL_ERROR_ENOBLK = 0x8002005F;
constexpr int SCE_KERNEL_ERROR_EICV = 0x80020060;
constexpr int SCE_KERNEL_ERROR_ENOPLAYGOENT = 0x80020061;
constexpr int SCE_KERNEL_ERROR_EREVOKE = 0x80020062;
constexpr int SCE_KERNEL_ERROR_ESDKVERSION = 0x80020063;
constexpr int SCE_KERNEL_ERROR_ESTART = 0x80020064;
constexpr int SCE_KERNEL_ERROR_ESTOP = 0x80020065;
// videoOut
constexpr int SCE_VIDEO_OUT_ERROR_INVALID_VALUE = 0x80290001; // invalid argument
constexpr int SCE_VIDEO_OUT_ERROR_INVALID_ADDRESS = 0x80290002; // invalid addresses
constexpr int SCE_VIDEO_OUT_ERROR_INVALID_TILING_MODE = 0x80290007; // invalid tiling mode
constexpr int SCE_VIDEO_OUT_ERROR_INVALID_ASPECT_RATIO = 0x80290008; // invalid aspect ration
constexpr int SCE_VIDEO_OUT_ERROR_RESOURCE_BUSY = 0x80290009; // already opened
constexpr int SCE_VIDEO_OUT_ERROR_INVALID_INDEX = 0x8029000A; // invalid buffer index
constexpr int SCE_VIDEO_OUT_ERROR_INVALID_HANDLE = 0x8029000B; // invalid handle
constexpr int SCE_VIDEO_OUT_ERROR_INVALID_EVENT_QUEUE = 0x8029000C; // Invalid event queue
constexpr int SCE_VIDEO_OUT_ERROR_SLOT_OCCUPIED = 0x80290010; // slot already used
constexpr int SCE_VIDEO_OUT_ERROR_FLIP_QUEUE_FULL = 0x80290012; // flip queue is full
constexpr int SCE_VIDEO_OUT_ERROR_INVALID_OPTION = 0x8029001A; // Invalid buffer attribute option

View File

@ -1,56 +0,0 @@
// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later
#include <common/config.h>
#include "core/PS4/HLE/Graphics/video_out.h"
#include "core/hle/libraries/libc/libc.h"
#include "core/hle/libraries/libkernel/libkernel.h"
#include "core/hle/libraries/libpad/pad.h"
#include "core/hle/libraries/libs.h"
#include "core/hle/libraries/libscegnmdriver/libscegnmdriver.h"
#include "src/core/libraries/libkernel.h"
#include "src/core/libraries/libsceaudioin.h"
#include "src/core/libraries/libsceaudioout.h"
#include "src/core/libraries/libscecommondialog.h"
#include "src/core/libraries/libscehttp.h"
#include "src/core/libraries/libscemsgdialog.h"
#include "src/core/libraries/libscenet.h"
#include "src/core/libraries/libscenetctl.h"
#include "src/core/libraries/libsceposix.h"
#include "src/core/libraries/libscesavedata.h"
#include "src/core/libraries/libscesavedatadialog.h"
#include "src/core/libraries/libscessl.h"
#include "src/core/libraries/libscesysmodule.h"
#include "src/core/libraries/libscesystemservice.h"
#include "src/core/libraries/libsceuserservice.h"
namespace OldLibraries {
void InitHLELibs(Core::Loader::SymbolsResolver* sym) {
Core::Libraries::LibKernel::LibKernel_Register(sym);
HLE::Libs::Graphics::VideoOut::videoOutRegisterLib(sym);
Core::Libraries::LibSceGnmDriver::LibSceGnmDriver_Register(sym);
OldLibraries::LibPad::padSymbolsRegister(sym);
if (!Config::isLleLibc()) {
Core::Libraries::LibC::libcSymbolsRegister(sym);
}
// new libraries folder from autogen
Libraries::UserService::RegisterlibSceUserService(sym);
Libraries::SystemService::RegisterlibSceSystemService(sym);
Libraries::CommonDialog::RegisterlibSceCommonDialog(sym);
Libraries::MsgDialog::RegisterlibSceMsgDialog(sym);
Libraries::AudioOut::RegisterlibSceAudioOut(sym);
Libraries::Http::RegisterlibSceHttp(sym);
Libraries::Net::RegisterlibSceNet(sym);
Libraries::NetCtl::RegisterlibSceNetCtl(sym);
Libraries::SaveData::RegisterlibSceSaveData(sym);
Libraries::Ssl::RegisterlibSceSsl(sym);
Libraries::SysModule::RegisterlibSceSysmodule(sym);
Libraries::Kernel::Registerlibkernel(sym);
Libraries::Posix::Registerlibsceposix(sym);
Libraries::AudioIn::RegisterlibSceAudioIn(sym);
Libraries::SaveDataDialog::RegisterlibSceSaveDataDialog(sym);
}
} // namespace OldLibraries

View File

@ -1,68 +0,0 @@
// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later
#include "common/logging/log.h"
#include "core/PS4/GPU/gpu_memory.h"
#include "core/hle/libraries/libs.h"
#include "core/hle/libraries/libscegnmdriver/libscegnmdriver.h"
#include "emulator.h"
namespace Core::Libraries::LibSceGnmDriver {
int32_t PS4_SYSV_ABI sceGnmSubmitDone() {
LOG_WARNING(Lib_GnmDriver, "(STUBBED) called");
return 0;
}
void PS4_SYSV_ABI sceGnmFlushGarlic() {
LOG_WARNING(Lib_GnmDriver, "(STUBBED) called");
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) {
LIB_FUNCTION("yvZ73uQUqrk", "libSceGnmDriver", 1, "libSceGnmDriver", 1, 1, sceGnmSubmitDone);
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

View File

@ -1,19 +0,0 @@
// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later
#pragma once
#include "common/types.h"
namespace Core::Loader {
class SymbolsResolver;
}
namespace Core::Libraries::LibSceGnmDriver {
int32_t PS4_SYSV_ABI sceGnmSubmitDone();
void PS4_SYSV_ABI sceGnmFlushGarlic();
void LibSceGnmDriver_Register(Loader::SymbolsResolver* sym);
}; // namespace Core::Libraries::LibSceGnmDriver

View File

@ -1,10 +1,10 @@
// 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
// Generated By moduleGenerator
#include "common/logging/log.h" #include "common/logging/log.h"
#include "error_codes.h" #include "core/libraries/audio/audioin.h"
#include "libsceaudioin.h" #include "core/libraries/error_codes.h"
#include "core/libraries/libs.h"
namespace Libraries::AudioIn { namespace Libraries::AudioIn {

View File

@ -3,7 +3,11 @@
#pragma once #pragma once
#include "library_common.h" #include "common/types.h"
namespace Core::Loader {
class SymbolsResolver;
}
namespace Libraries::AudioIn { namespace Libraries::AudioIn {

View File

@ -1,13 +1,13 @@
// 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
// Generated By moduleGenerator #include <memory>
#include <common/singleton.h>
#include <magic_enum.hpp> #include <magic_enum.hpp>
#include "audio_core/sdl_audio.h"
#include "common/logging/log.h" #include "common/logging/log.h"
#include "error_codes.h" #include "core/libraries/audio/audioout.h"
#include "libsceaudioout.h" #include "core/libraries/error_codes.h"
#include "src/audio_core/sdl_audio.h" #include "core/libraries/libs.h"
namespace Libraries::AudioOut { namespace Libraries::AudioOut {

View File

@ -3,8 +3,7 @@
#pragma once #pragma once
#include "library_common.h" #include "core/libraries/system/userservice.h"
#include "libsceuserservice.h"
namespace Libraries::AudioOut { namespace Libraries::AudioOut {

View File

@ -3,6 +3,249 @@
#pragma once #pragma once
// posix error codes
constexpr int POSIX_EPERM = 1;
constexpr int POSIX_ENOENT = 2;
constexpr int POSIX_ESRCH = 3;
constexpr int POSIX_EINTR = 4;
constexpr int POSIX_EIO = 5;
constexpr int POSIX_ENXIO = 6;
constexpr int POSIX_E2BIG = 7;
constexpr int POSIX_ENOEXEC = 8;
constexpr int POSIX_EBADF = 9;
constexpr int POSIX_ECHILD = 10;
constexpr int POSIX_EDEADLK = 11;
constexpr int POSIX_ENOMEM = 12;
constexpr int POSIX_EACCES = 13;
constexpr int POSIX_EFAULT = 14;
constexpr int POSIX_ENOTBLK = 15;
constexpr int POSIX_EBUSY = 16;
constexpr int POSIX_EEXIST = 17;
constexpr int POSIX_EXDEV = 18;
constexpr int POSIX_ENODEV = 19;
constexpr int POSIX_ENOTDIR = 20;
constexpr int POSIX_EISDIR = 21;
constexpr int POSIX_EINVAL = 22;
constexpr int POSIX_ENFILE = 23;
constexpr int POSIX_EMFILE = 24;
constexpr int POSIX_ENOTTY = 25;
constexpr int POSIX_ETXTBSY = 26;
constexpr int POSIX_EFBIG = 27;
constexpr int POSIX_ENOSPC = 28;
constexpr int POSIX_ESPIPE = 29;
constexpr int POSIX_EROFS = 30;
constexpr int POSIX_EMLINK = 31;
constexpr int POSIX_EPIPE = 32;
constexpr int POSIX_EDOM = 33;
constexpr int POSIX_ERANGE = 34;
constexpr int POSIX_EAGAIN = 35;
constexpr int POSIX_EWOULDBLOCK = 35;
constexpr int POSIX_EINPROGRESS = 36;
constexpr int POSIX_EALREADY = 37;
constexpr int POSIX_ENOTSOCK = 38;
constexpr int POSIX_EDESTADDRREQ = 39;
constexpr int POSIX_EMSGSIZE = 40;
constexpr int POSIX_EPROTOTYPE = 41;
constexpr int POSIX_ENOPROTOOPT = 42;
constexpr int POSIX_EPROTONOSUPPORT = 43;
constexpr int POSIX_ESOCKTNOSUPPORT = 44;
constexpr int POSIX_EOPNOTSUPP = 45;
constexpr int POSIX_ENOTSUP = 45;
constexpr int POSIX_EPFNOSUPPORT = 46;
constexpr int POSIX_EAFNOSUPPORT = 47;
constexpr int POSIX_EADDRINUSE = 48;
constexpr int POSIX_EADDRNOTAVAIL = 49;
constexpr int POSIX_ENETDOWN = 50;
constexpr int POSIX_ENETUNREACH = 51;
constexpr int POSIX_ENETRESET = 52;
constexpr int POSIX_ECONNABORTED = 53;
constexpr int POSIX_ECONNRESET = 54;
constexpr int POSIX_ENOBUFS = 55;
constexpr int POSIX_EISCONN = 56;
constexpr int POSIX_ENOTCONN = 57;
constexpr int POSIX_ESHUTDOWN = 58;
constexpr int POSIX_ETOOMANYREFS = 59;
constexpr int POSIX_ETIMEDOUT = 60;
constexpr int POSIX_ECONNREFUSED = 61;
constexpr int POSIX_ELOOP = 62;
constexpr int POSIX_ENAMETOOLONG = 63;
constexpr int POSIX_EHOSTDOWN = 64;
constexpr int POSIX_EHOSTUNREACH = 65;
constexpr int POSIX_ENOTEMPTY = 66;
constexpr int POSIX_EPROCLIM = 67;
constexpr int POSIX_EUSERS = 68;
constexpr int POSIX_EDQUOT = 69;
constexpr int POSIX_ESTALE = 70;
constexpr int POSIX_EREMOTE = 71;
constexpr int POSIX_EBADRPC = 72;
constexpr int POSIX_ERPCMISMATCH = 73;
constexpr int POSIX_EPROGUNAVAIL = 74;
constexpr int POSIX_EPROGMISMATCH = 75;
constexpr int POSIX_EPROCUNAVAIL = 76;
constexpr int POSIX_ENOLCK = 77;
constexpr int POSIX_ENOSYS = 78;
constexpr int POSIX_EFTYPE = 79;
constexpr int POSIX_EAUTH = 80;
constexpr int POSIX_ENEEDAUTH = 81;
constexpr int POSIX_EIDRM = 82;
constexpr int POSIX_ENOMSG = 83;
constexpr int POSIX_EOVERFLOW = 84;
constexpr int POSIX_ECANCELED = 85;
constexpr int POSIX_EILSEQ = 86;
constexpr int POSIX_ENOATTR = 87;
constexpr int POSIX_EDOOFUS = 88;
constexpr int POSIX_EBADMSG = 89;
constexpr int POSIX_EMULTIHOP = 90;
constexpr int POSIX_ENOLINK = 91;
constexpr int POSIX_EPROTO = 92;
constexpr int POSIX_ENOTCAPABLE = 93;
constexpr int POSIX_ECAPMODE = 94;
constexpr int POSIX_ENOBLK = 95;
constexpr int POSIX_EICV = 96;
constexpr int POSIX_ENOPLAYGOENT = 97;
constexpr int POSIX_EREVOKE = 98;
constexpr int POSIX_ESDKVERSION = 99;
constexpr int POSIX_ESTART = 100;
constexpr int POSIX_ESTOP = 101;
constexpr int POSIX_EINVALID2MB = 102;
constexpr int POSIX_ELAST = 102;
constexpr int POSIX_EADHOC = 160;
constexpr int POSIX_EINACTIVEDISABLED = 163;
constexpr int POSIX_ENETNODATA = 164;
constexpr int POSIX_ENETDESC = 165;
constexpr int POSIX_ENETDESCTIMEDOUT = 166;
constexpr int POSIX_ENETINTR = 167;
constexpr int POSIX_ERETURN = 205;
constexpr int POSIX_EFPOS = 152;
constexpr int POSIX_ENODATA = 1040;
constexpr int POSIX_ENOSR = 1050;
constexpr int POSIX_ENOSTR = 1051;
constexpr int POSIX_ENOTRECOVERABLE = 1056;
constexpr int POSIX_EOTHER = 1062;
constexpr int POSIX_EOWNERDEAD = 1064;
constexpr int POSIX_ETIME = 1074;
constexpr int SCE_OK = 0;
// kernel error codes
constexpr int SCE_KERNEL_ERROR_UNKNOWN = 0x80020000;
constexpr int SCE_KERNEL_ERROR_EPERM = 0x80020001;
constexpr int SCE_KERNEL_ERROR_ENOENT = 0x80020002;
constexpr int SCE_KERNEL_ERROR_ESRCH = 0x80020003;
constexpr int SCE_KERNEL_ERROR_EINTR = 0x80020004;
constexpr int SCE_KERNEL_ERROR_EIO = 0x80020005;
constexpr int SCE_KERNEL_ERROR_ENXIO = 0x80020006;
constexpr int SCE_KERNEL_ERROR_E2BIG = 0x80020007;
constexpr int SCE_KERNEL_ERROR_ENOEXEC = 0x80020008;
constexpr int SCE_KERNEL_ERROR_EBADF = 0x80020009;
constexpr int SCE_KERNEL_ERROR_ECHILD = 0x8002000A;
constexpr int SCE_KERNEL_ERROR_EDEADLK = 0x8002000B;
constexpr int SCE_KERNEL_ERROR_ENOMEM = 0x8002000C;
constexpr int SCE_KERNEL_ERROR_EACCES = 0x8002000D;
constexpr int SCE_KERNEL_ERROR_EFAULT = 0x8002000E;
constexpr int SCE_KERNEL_ERROR_ENOTBLK = 0x8002000F;
constexpr int SCE_KERNEL_ERROR_EBUSY = 0x80020010;
constexpr int SCE_KERNEL_ERROR_EEXIST = 0x80020011;
constexpr int SCE_KERNEL_ERROR_EXDEV = 0x80020012;
constexpr int SCE_KERNEL_ERROR_ENODEV = 0x80020013;
constexpr int SCE_KERNEL_ERROR_ENOTDIR = 0x80020014;
constexpr int SCE_KERNEL_ERROR_EISDIR = 0x80020015;
constexpr int SCE_KERNEL_ERROR_EINVAL = 0x80020016;
constexpr int SCE_KERNEL_ERROR_ENFILE = 0x80020017;
constexpr int SCE_KERNEL_ERROR_EMFILE = 0x80020018;
constexpr int SCE_KERNEL_ERROR_ENOTTY = 0x80020019;
constexpr int SCE_KERNEL_ERROR_ETXTBSY = 0x8002001A;
constexpr int SCE_KERNEL_ERROR_EFBIG = 0x8002001B;
constexpr int SCE_KERNEL_ERROR_ENOSPC = 0x8002001C;
constexpr int SCE_KERNEL_ERROR_ESPIPE = 0x8002001D;
constexpr int SCE_KERNEL_ERROR_EROFS = 0x8002001E;
constexpr int SCE_KERNEL_ERROR_EMLINK = 0x8002001F;
constexpr int SCE_KERNEL_ERROR_EPIPE = 0x80020020;
constexpr int SCE_KERNEL_ERROR_EDOM = 0x80020021;
constexpr int SCE_KERNEL_ERROR_ERANGE = 0x80020022;
constexpr int SCE_KERNEL_ERROR_EAGAIN = 0x80020023;
constexpr int SCE_KERNEL_ERROR_EWOULDBLOCK = 0x80020023;
constexpr int SCE_KERNEL_ERROR_EINPROGRESS = 0x80020024;
constexpr int SCE_KERNEL_ERROR_EALREADY = 0x80020025;
constexpr int SCE_KERNEL_ERROR_ENOTSOCK = 0x80020026;
constexpr int SCE_KERNEL_ERROR_EDESTADDRREQ = 0x80020027;
constexpr int SCE_KERNEL_ERROR_EMSGSIZE = 0x80020028;
constexpr int SCE_KERNEL_ERROR_EPROTOTYPE = 0x80020029;
constexpr int SCE_KERNEL_ERROR_ENOPROTOOPT = 0x8002002A;
constexpr int SCE_KERNEL_ERROR_EPROTONOSUPPORT = 0x8002002B;
constexpr int SCE_KERNEL_ERROR_ESOCKTNOSUPPORT = 0x8002002C;
constexpr int SCE_KERNEL_ERROR_EOPNOTSUPP = 0x8002002D;
constexpr int SCE_KERNEL_ERROR_ENOTSUP = 0x8002002D;
constexpr int SCE_KERNEL_ERROR_EPFNOSUPPORT = 0x8002002E;
constexpr int SCE_KERNEL_ERROR_EAFNOSUPPORT = 0x8002002F;
constexpr int SCE_KERNEL_ERROR_EADDRINUSE = 0x80020030;
constexpr int SCE_KERNEL_ERROR_EADDRNOTAVAIL = 0x80020031;
constexpr int SCE_KERNEL_ERROR_ENETDOWN = 0x80020032;
constexpr int SCE_KERNEL_ERROR_ENETUNREACH = 0x80020033;
constexpr int SCE_KERNEL_ERROR_ENETRESET = 0x80020034;
constexpr int SCE_KERNEL_ERROR_ECONNABORTED = 0x80020035;
constexpr int SCE_KERNEL_ERROR_ECONNRESET = 0x80020036;
constexpr int SCE_KERNEL_ERROR_ENOBUFS = 0x80020037;
constexpr int SCE_KERNEL_ERROR_EISCONN = 0x80020038;
constexpr int SCE_KERNEL_ERROR_ENOTCONN = 0x80020039;
constexpr int SCE_KERNEL_ERROR_ESHUTDOWN = 0x8002003A;
constexpr int SCE_KERNEL_ERROR_ETOOMANYREFS = 0x8002003B;
constexpr int SCE_KERNEL_ERROR_ETIMEDOUT = 0x8002003C;
constexpr int SCE_KERNEL_ERROR_ECONNREFUSED = 0x8002003D;
constexpr int SCE_KERNEL_ERROR_ELOOP = 0x8002003E;
constexpr int SCE_KERNEL_ERROR_ENAMETOOLONG = 0x8002003F;
constexpr int SCE_KERNEL_ERROR_EHOSTDOWN = 0x80020040;
constexpr int SCE_KERNEL_ERROR_EHOSTUNREACH = 0x80020041;
constexpr int SCE_KERNEL_ERROR_ENOTEMPTY = 0x80020042;
constexpr int SCE_KERNEL_ERROR_EPROCLIM = 0x80020043;
constexpr int SCE_KERNEL_ERROR_EUSERS = 0x80020044;
constexpr int SCE_KERNEL_ERROR_EDQUOT = 0x80020045;
constexpr int SCE_KERNEL_ERROR_ESTALE = 0x80020046;
constexpr int SCE_KERNEL_ERROR_EREMOTE = 0x80020047;
constexpr int SCE_KERNEL_ERROR_EBADRPC = 0x80020048;
constexpr int SCE_KERNEL_ERROR_ERPCMISMATCH = 0x80020049;
constexpr int SCE_KERNEL_ERROR_EPROGUNAVAIL = 0x8002004A;
constexpr int SCE_KERNEL_ERROR_EPROGMISMATCH = 0x8002004B;
constexpr int SCE_KERNEL_ERROR_EPROCUNAVAIL = 0x8002004C;
constexpr int SCE_KERNEL_ERROR_ENOLCK = 0x8002004D;
constexpr int SCE_KERNEL_ERROR_ENOSYS = 0x8002004E;
constexpr int SCE_KERNEL_ERROR_EFTYPE = 0x8002004F;
constexpr int SCE_KERNEL_ERROR_EAUTH = 0x80020050;
constexpr int SCE_KERNEL_ERROR_ENEEDAUTH = 0x80020051;
constexpr int SCE_KERNEL_ERROR_EIDRM = 0x80020052;
constexpr int SCE_KERNEL_ERROR_ENOMSG = 0x80020053;
constexpr int SCE_KERNEL_ERROR_EOVERFLOW = 0x80020054;
constexpr int SCE_KERNEL_ERROR_ECANCELED = 0x80020055;
constexpr int SCE_KERNEL_ERROR_EILSEQ = 0x80020056;
constexpr int SCE_KERNEL_ERROR_ENOATTR = 0x80020057;
constexpr int SCE_KERNEL_ERROR_EDOOFUS = 0x80020058;
constexpr int SCE_KERNEL_ERROR_EBADMSG = 0x80020059;
constexpr int SCE_KERNEL_ERROR_EMULTIHOP = 0x8002005A;
constexpr int SCE_KERNEL_ERROR_ENOLINK = 0x8002005B;
constexpr int SCE_KERNEL_ERROR_EPROTO = 0x8002005C;
constexpr int SCE_KERNEL_ERROR_ENOTCAPABLE = 0x8002005D;
constexpr int SCE_KERNEL_ERROR_ECAPMODE = 0x8002005E;
constexpr int SCE_KERNEL_ERROR_ENOBLK = 0x8002005F;
constexpr int SCE_KERNEL_ERROR_EICV = 0x80020060;
constexpr int SCE_KERNEL_ERROR_ENOPLAYGOENT = 0x80020061;
constexpr int SCE_KERNEL_ERROR_EREVOKE = 0x80020062;
constexpr int SCE_KERNEL_ERROR_ESDKVERSION = 0x80020063;
constexpr int SCE_KERNEL_ERROR_ESTART = 0x80020064;
constexpr int SCE_KERNEL_ERROR_ESTOP = 0x80020065;
// videoOut
constexpr int SCE_VIDEO_OUT_ERROR_INVALID_VALUE = 0x80290001; // invalid argument
constexpr int SCE_VIDEO_OUT_ERROR_INVALID_ADDRESS = 0x80290002; // invalid addresses
constexpr int SCE_VIDEO_OUT_ERROR_INVALID_TILING_MODE = 0x80290007; // invalid tiling mode
constexpr int SCE_VIDEO_OUT_ERROR_INVALID_ASPECT_RATIO = 0x80290008; // invalid aspect ration
constexpr int SCE_VIDEO_OUT_ERROR_RESOURCE_BUSY = 0x80290009; // already opened
constexpr int SCE_VIDEO_OUT_ERROR_INVALID_INDEX = 0x8029000A; // invalid buffer index
constexpr int SCE_VIDEO_OUT_ERROR_INVALID_HANDLE = 0x8029000B; // invalid handle
constexpr int SCE_VIDEO_OUT_ERROR_INVALID_EVENT_QUEUE = 0x8029000C; // Invalid event queue
constexpr int SCE_VIDEO_OUT_ERROR_SLOT_OCCUPIED = 0x80290010; // slot already used
constexpr int SCE_VIDEO_OUT_ERROR_FLIP_QUEUE_FULL = 0x80290012; // flip queue is full
constexpr int SCE_VIDEO_OUT_ERROR_INVALID_OPTION = 0x8029001A; // Invalid buffer attribute option
// Generic // Generic
constexpr int ORBIS_OK = 0x00000000; constexpr int ORBIS_OK = 0x00000000;
constexpr int ORBIS_FAIL = 0xFFFFFFFF; constexpr int ORBIS_FAIL = 0xFFFFFFFF;

View File

@ -1,10 +1,12 @@
// 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
// Generated By moduleGenerator
#include "common/logging/log.h" #include "common/logging/log.h"
#include "error_codes.h" #include "core/PS4/GPU/gpu_memory.h"
#include "libscegnmdriver.h" #include "core/libraries/error_codes.h"
#include "core/libraries/gnmdriver/gnmdriver.h"
#include "core/libraries/libs.h"
#include "emulator.h"
namespace Libraries::GnmDriver { namespace Libraries::GnmDriver {
@ -133,9 +135,14 @@ int PS4_SYSV_ABI sceGnmDispatchInitDefaultHardwareState() {
return ORBIS_OK; return ORBIS_OK;
} }
int PS4_SYSV_ABI sceGnmDrawIndex() { s32 PS4_SYSV_ABI sceGnmDrawIndex(u32* cmd, u64 size, u32 index_count, const void* index_addr,
LOG_ERROR(Lib_GnmDriver, "(STUBBED) called"); u32 flags, u32 type) {
return ORBIS_OK; 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 sceGnmDrawIndexAuto() { int PS4_SYSV_ABI sceGnmDrawIndexAuto() {
@ -198,9 +205,10 @@ int PS4_SYSV_ABI sceGnmDrawInitDefaultHardwareState200() {
return ORBIS_OK; return ORBIS_OK;
} }
int PS4_SYSV_ABI sceGnmDrawInitDefaultHardwareState350() { int PS4_SYSV_ABI sceGnmDrawInitDefaultHardwareState350(u32* cmd, u64 size) {
LOG_ERROR(Lib_GnmDriver, "(STUBBED) called"); LOG_INFO(Lib_GnmDriver, "(STUBBED) called cmd_buffer = 0x{:x} size = {}",
return ORBIS_OK; reinterpret_cast<uint64_t>(cmd), size);
return 0;
} }
int PS4_SYSV_ABI sceGnmDrawInitToDefaultContextState() { int PS4_SYSV_ABI sceGnmDrawInitToDefaultContextState() {
@ -283,9 +291,9 @@ int PS4_SYSV_ABI sceGnmFindResourcesPublic() {
return ORBIS_OK; return ORBIS_OK;
} }
int PS4_SYSV_ABI sceGnmFlushGarlic() { void PS4_SYSV_ABI sceGnmFlushGarlic() {
LOG_ERROR(Lib_GnmDriver, "(STUBBED) called"); LOG_WARNING(Lib_GnmDriver, "(STUBBED) called");
return ORBIS_OK; GPU::flushGarlic(Emu::getGraphicCtx());
} }
int PS4_SYSV_ABI sceGnmGetCoredumpAddress() { int PS4_SYSV_ABI sceGnmGetCoredumpAddress() {
@ -683,9 +691,14 @@ int PS4_SYSV_ABI sceGnmSetVgtControl() {
return ORBIS_OK; return ORBIS_OK;
} }
int PS4_SYSV_ABI sceGnmSetVsShader() { int PS4_SYSV_ABI sceGnmSetVsShader(u32* cmd, u64 size, const u32* vs_regs, u32 shader_modifier) {
LOG_ERROR(Lib_GnmDriver, "(STUBBED) called"); LOG_INFO(Lib_GnmDriver,
return ORBIS_OK; "(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 sceGnmSetWaveLimitMultiplier() { int PS4_SYSV_ABI sceGnmSetWaveLimitMultiplier() {
@ -948,8 +961,13 @@ int PS4_SYSV_ABI sceGnmUpdatePsShader350() {
return ORBIS_OK; return ORBIS_OK;
} }
int PS4_SYSV_ABI sceGnmUpdateVsShader() { int PS4_SYSV_ABI sceGnmUpdateVsShader(u32* cmd, u64 size, const u32* vs_regs, u32 shader_modifier) {
LOG_ERROR(Lib_GnmDriver, "(STUBBED) called"); 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 ORBIS_OK; return ORBIS_OK;
} }

View File

@ -3,7 +3,11 @@
#pragma once #pragma once
#include "library_common.h" #include "common/types.h"
namespace Core::Loader {
class SymbolsResolver;
}
namespace Libraries::GnmDriver { namespace Libraries::GnmDriver {
@ -32,7 +36,8 @@ int PS4_SYSV_ABI sceGnmDispatchDirect();
int PS4_SYSV_ABI sceGnmDispatchIndirect(); int PS4_SYSV_ABI sceGnmDispatchIndirect();
int PS4_SYSV_ABI sceGnmDispatchIndirectOnMec(); int PS4_SYSV_ABI sceGnmDispatchIndirectOnMec();
int PS4_SYSV_ABI sceGnmDispatchInitDefaultHardwareState(); int PS4_SYSV_ABI sceGnmDispatchInitDefaultHardwareState();
int PS4_SYSV_ABI sceGnmDrawIndex(); s32 PS4_SYSV_ABI sceGnmDrawIndex(u32* cmd, u64 size, u32 index_count, const void* index_addr,
u32 flags, u32 type);
int PS4_SYSV_ABI sceGnmDrawIndexAuto(); int PS4_SYSV_ABI sceGnmDrawIndexAuto();
int PS4_SYSV_ABI sceGnmDrawIndexIndirect(); int PS4_SYSV_ABI sceGnmDrawIndexIndirect();
int PS4_SYSV_ABI sceGnmDrawIndexIndirectCountMulti(); int PS4_SYSV_ABI sceGnmDrawIndexIndirectCountMulti();
@ -45,7 +50,7 @@ int PS4_SYSV_ABI sceGnmDrawIndirectMulti();
int PS4_SYSV_ABI sceGnmDrawInitDefaultHardwareState(); int PS4_SYSV_ABI sceGnmDrawInitDefaultHardwareState();
int PS4_SYSV_ABI sceGnmDrawInitDefaultHardwareState175(); int PS4_SYSV_ABI sceGnmDrawInitDefaultHardwareState175();
int PS4_SYSV_ABI sceGnmDrawInitDefaultHardwareState200(); int PS4_SYSV_ABI sceGnmDrawInitDefaultHardwareState200();
int PS4_SYSV_ABI sceGnmDrawInitDefaultHardwareState350(); int PS4_SYSV_ABI sceGnmDrawInitDefaultHardwareState350(u32* cmd, u64 size);
int PS4_SYSV_ABI sceGnmDrawInitToDefaultContextState(); int PS4_SYSV_ABI sceGnmDrawInitToDefaultContextState();
int PS4_SYSV_ABI sceGnmDrawInitToDefaultContextState400(); int PS4_SYSV_ABI sceGnmDrawInitToDefaultContextState400();
int PS4_SYSV_ABI sceGnmDrawOpaqueAuto(); int PS4_SYSV_ABI sceGnmDrawOpaqueAuto();
@ -62,7 +67,7 @@ int PS4_SYSV_ABI sceGnmDriverTraceInProgress();
int PS4_SYSV_ABI sceGnmDriverTriggerCapture(); int PS4_SYSV_ABI sceGnmDriverTriggerCapture();
int PS4_SYSV_ABI sceGnmEndWorkload(); int PS4_SYSV_ABI sceGnmEndWorkload();
int PS4_SYSV_ABI sceGnmFindResourcesPublic(); int PS4_SYSV_ABI sceGnmFindResourcesPublic();
int PS4_SYSV_ABI sceGnmFlushGarlic(); void PS4_SYSV_ABI sceGnmFlushGarlic();
int PS4_SYSV_ABI sceGnmGetCoredumpAddress(); int PS4_SYSV_ABI sceGnmGetCoredumpAddress();
int PS4_SYSV_ABI sceGnmGetCoredumpMode(); int PS4_SYSV_ABI sceGnmGetCoredumpMode();
int PS4_SYSV_ABI sceGnmGetCoredumpProtectionFaultTimestamp(); int PS4_SYSV_ABI sceGnmGetCoredumpProtectionFaultTimestamp();
@ -142,7 +147,7 @@ int PS4_SYSV_ABI sceGnmSetSpiEnableSqCounters();
int PS4_SYSV_ABI sceGnmSetSpiEnableSqCountersForUnitInstance(); int PS4_SYSV_ABI sceGnmSetSpiEnableSqCountersForUnitInstance();
int PS4_SYSV_ABI sceGnmSetupMipStatsReport(); int PS4_SYSV_ABI sceGnmSetupMipStatsReport();
int PS4_SYSV_ABI sceGnmSetVgtControl(); int PS4_SYSV_ABI sceGnmSetVgtControl();
int PS4_SYSV_ABI sceGnmSetVsShader(); int PS4_SYSV_ABI sceGnmSetVsShader(u32* cmd, u64 size, const u32* vs_regs, u32 shader_modifier);
int PS4_SYSV_ABI sceGnmSetWaveLimitMultiplier(); int PS4_SYSV_ABI sceGnmSetWaveLimitMultiplier();
int PS4_SYSV_ABI sceGnmSetWaveLimitMultipliers(); int PS4_SYSV_ABI sceGnmSetWaveLimitMultipliers();
int PS4_SYSV_ABI sceGnmSpmEndSpm(); int PS4_SYSV_ABI sceGnmSpmEndSpm();
@ -195,7 +200,7 @@ int PS4_SYSV_ABI sceGnmUpdateGsShader();
int PS4_SYSV_ABI sceGnmUpdateHsShader(); int PS4_SYSV_ABI sceGnmUpdateHsShader();
int PS4_SYSV_ABI sceGnmUpdatePsShader(); int PS4_SYSV_ABI sceGnmUpdatePsShader();
int PS4_SYSV_ABI sceGnmUpdatePsShader350(); int PS4_SYSV_ABI sceGnmUpdatePsShader350();
int PS4_SYSV_ABI sceGnmUpdateVsShader(); int PS4_SYSV_ABI sceGnmUpdateVsShader(u32* cmd, u64 size, const u32* vs_regs, u32 shader_modifier);
int PS4_SYSV_ABI sceGnmValidateCommandBuffers(); int PS4_SYSV_ABI sceGnmValidateCommandBuffers();
int PS4_SYSV_ABI sceGnmValidateDisableDiagnostics(); int PS4_SYSV_ABI sceGnmValidateDisableDiagnostics();
int PS4_SYSV_ABI sceGnmValidateDisableDiagnostics2(); int PS4_SYSV_ABI sceGnmValidateDisableDiagnostics2();

View File

@ -3,13 +3,13 @@
#include "common/config.h" #include "common/config.h"
#include "common/logging/log.h" #include "common/logging/log.h"
#include "core/hle/kernel/cpu_management.h" #include "core/libraries/kernel/cpu_management.h"
namespace Core::Kernel { namespace Libraries::Kernel {
int PS4_SYSV_ABI sceKernelIsNeoMode() { int PS4_SYSV_ABI sceKernelIsNeoMode() {
LOG_INFO(Kernel_Sce, "called"); LOG_INFO(Kernel_Sce, "called");
return Config::isNeoMode(); return Config::isNeoMode();
} }
} // namespace Core::Kernel } // namespace Libraries::Kernel

View File

@ -5,8 +5,8 @@
#include "common/types.h" #include "common/types.h"
namespace Core::Kernel { namespace Libraries::Kernel {
int PS4_SYSV_ABI sceKernelIsNeoMode(); int PS4_SYSV_ABI sceKernelIsNeoMode();
} // namespace Core::Kernel } // namespace Libraries::Kernel

View File

@ -2,9 +2,9 @@
// SPDX-License-Identifier: GPL-2.0-or-later // SPDX-License-Identifier: GPL-2.0-or-later
#include "common/debug.h" #include "common/debug.h"
#include "core/hle/kernel/Objects/event_queue.h" #include "core/libraries/kernel/event_queue.h"
namespace Core::Kernel { namespace Libraries::Kernel {
EqueueInternal::~EqueueInternal() = default; EqueueInternal::~EqueueInternal() = default;
@ -79,4 +79,4 @@ int EqueueInternal::getTriggeredEvents(SceKernelEvent* ev, int num) {
return ret; return ret;
} }
} // namespace Core::Kernel } // namespace Libraries::Kernel

View File

@ -9,7 +9,7 @@
#include <vector> #include <vector>
#include "common/types.h" #include "common/types.h"
namespace Core::Kernel { namespace Libraries::Kernel {
constexpr s16 EVFILT_READ = -1; constexpr s16 EVFILT_READ = -1;
constexpr s16 EVFILT_WRITE = -2; constexpr s16 EVFILT_WRITE = -2;
@ -82,4 +82,4 @@ private:
std::condition_variable m_cond; std::condition_variable m_cond;
}; };
} // namespace Core::Kernel } // namespace Libraries::Kernel

View File

@ -3,10 +3,10 @@
#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/libraries/error_codes.h"
#include "core/hle/kernel/event_queues.h" #include "core/libraries/kernel/event_queues.h"
namespace Core::Kernel { namespace Libraries::Kernel {
int PS4_SYSV_ABI sceKernelCreateEqueue(SceKernelEqueue* eq, const char* name) { int PS4_SYSV_ABI sceKernelCreateEqueue(SceKernelEqueue* eq, const char* name) {
if (eq == nullptr) { if (eq == nullptr) {
@ -69,4 +69,4 @@ int PS4_SYSV_ABI sceKernelWaitEqueue(SceKernelEqueue eq, SceKernelEvent* ev, int
return SCE_OK; return SCE_OK;
} }
} // namespace Core::Kernel } // namespace Libraries::Kernel

View File

@ -3,9 +3,9 @@
#pragma once #pragma once
#include "core/hle/kernel/Objects/event_queue.h" #include "core/libraries/kernel/event_queue.h"
namespace Core::Kernel { namespace Libraries::Kernel {
using SceKernelUseconds = u32; using SceKernelUseconds = u32;
using SceKernelEqueue = EqueueInternal*; using SceKernelEqueue = EqueueInternal*;
@ -14,4 +14,4 @@ int PS4_SYSV_ABI sceKernelCreateEqueue(SceKernelEqueue* eq, const char* name);
int PS4_SYSV_ABI sceKernelWaitEqueue(SceKernelEqueue eq, SceKernelEvent* ev, int num, int* out, int PS4_SYSV_ABI sceKernelWaitEqueue(SceKernelEqueue eq, SceKernelEvent* ev, int num, int* out,
SceKernelUseconds* timo); SceKernelUseconds* timo);
} // namespace Core::Kernel } // namespace Libraries::Kernel

View File

@ -5,11 +5,11 @@
#include "common/logging/log.h" #include "common/logging/log.h"
#include "common/singleton.h" #include "common/singleton.h"
#include "core/file_sys/fs.h" #include "core/file_sys/fs.h"
#include "core/hle/error_codes.h" #include "core/libraries/error_codes.h"
#include "core/hle/libraries/libkernel/file_system.h" #include "core/libraries/kernel/file_system.h"
#include "core/hle/libraries/libs.h" #include "core/libraries/libs.h"
namespace Core::Libraries::LibKernel { namespace Libraries::Kernel {
int PS4_SYSV_ABI sceKernelOpen(const char* path, int flags, u16 mode) { int PS4_SYSV_ABI sceKernelOpen(const char* path, int flags, u16 mode) {
LOG_INFO(Kernel_Fs, "path = {} flags = {:#x} mode = {:#x}", path, flags, mode); LOG_INFO(Kernel_Fs, "path = {} flags = {:#x} mode = {:#x}", path, flags, mode);
@ -111,7 +111,7 @@ s64 PS4_SYSV_ABI sceKernelRead(int d, void* buf, size_t nbytes) {
return bytes_read; return bytes_read;
} }
void fileSystemSymbolsRegister(Loader::SymbolsResolver* sym) { void fileSystemSymbolsRegister(Core::Loader::SymbolsResolver* sym) {
LIB_FUNCTION("1G3lF1Gg1k8", "libkernel", 1, "libkernel", 1, 1, sceKernelOpen); LIB_FUNCTION("1G3lF1Gg1k8", "libkernel", 1, "libkernel", 1, 1, sceKernelOpen);
LIB_FUNCTION("wuCroIGjt2g", "libScePosix", 1, "libkernel", 1, 1, posix_open); LIB_FUNCTION("wuCroIGjt2g", "libScePosix", 1, "libkernel", 1, 1, posix_open);
LIB_FUNCTION("UK2Tl2DWUns", "libkernel", 1, "libkernel", 1, 1, sceKernelClose); LIB_FUNCTION("UK2Tl2DWUns", "libkernel", 1, "libkernel", 1, 1, sceKernelClose);
@ -126,4 +126,4 @@ void fileSystemSymbolsRegister(Loader::SymbolsResolver* sym) {
posix_open); // _open shoudld be equal to open function posix_open); // _open shoudld be equal to open function
} }
} // namespace Core::Libraries::LibKernel } // namespace Libraries::Kernel

View File

@ -9,7 +9,7 @@ namespace Core::Loader {
class SymbolsResolver; class SymbolsResolver;
} }
namespace Core::Libraries::LibKernel { namespace Libraries::Kernel {
struct SceKernelIovec { struct SceKernelIovec {
void* iov_base; void* iov_base;
@ -21,6 +21,6 @@ int PS4_SYSV_ABI sceKernelOpen(const char* path, int flags, /* SceKernelMode*/ u
int PS4_SYSV_ABI posix_open(const char* path, int flags, /* SceKernelMode*/ u16 mode); int PS4_SYSV_ABI posix_open(const char* path, int flags, /* SceKernelMode*/ u16 mode);
s64 PS4_SYSV_ABI lseek(int d, s64 offset, int whence); s64 PS4_SYSV_ABI lseek(int d, s64 offset, int whence);
void fileSystemSymbolsRegister(Loader::SymbolsResolver* sym); void fileSystemSymbolsRegister(Core::Loader::SymbolsResolver* sym);
} // namespace Core::Libraries::LibKernel } // namespace Libraries::Kernel

View File

@ -3,15 +3,17 @@
#include "common/assert.h" #include "common/assert.h"
#include "common/logging/log.h" #include "common/logging/log.h"
#include "core/hle/kernel/cpu_management.h" #include "common/singleton.h"
#include "core/hle/kernel/event_queues.h" #include "core/libraries/error_codes.h"
#include "core/hle/kernel/memory_management.h" #include "core/libraries/kernel/cpu_management.h"
#include "core/hle/libraries/libkernel/file_system.h" #include "core/libraries/kernel/event_queues.h"
#include "core/hle/libraries/libkernel/libkernel.h" #include "core/libraries/kernel/file_system.h"
#include "core/hle/libraries/libkernel/thread_management.h" #include "core/libraries/kernel/libkernel.h"
#include "core/hle/libraries/libkernel/time_management.h" #include "core/libraries/kernel/memory_management.h"
#include "core/hle/libraries/libs.h" #include "core/libraries/kernel/thread_management.h"
#include "core/loader/elf.h" #include "core/libraries/kernel/time_management.h"
#include "core/libraries/libs.h"
#include "core/linker.h"
#ifdef _WIN64 #ifdef _WIN64
#include <io.h> #include <io.h>
@ -19,10 +21,8 @@
#else #else
#include <sys/mman.h> #include <sys/mman.h>
#endif #endif
#include <common/singleton.h>
#include <core/linker.h>
namespace Core::Libraries::LibKernel { namespace Libraries::Kernel {
static u64 g_stack_chk_guard = 0xDEADBEEF54321ABC; // dummy return static u64 g_stack_chk_guard = 0xDEADBEEF54321ABC; // dummy return
@ -141,23 +141,34 @@ void PS4_SYSV_ABI sceLibcHeapGetTraceInfo(HeapInfoInfo* info) {
info->getSegmentInfo = 0; info->getSegmentInfo = 0;
} }
void LibKernel_Register(Loader::SymbolsResolver* sym) { s64 PS4_SYSV_ABI ps4__write(int d, const void* buf, std::size_t nbytes) {
if (d <= 2) { // stdin,stdout,stderr
char* str = strdup((const char*)buf);
if (str[nbytes - 1] == '\n')
str[nbytes - 1] = 0;
LOG_INFO(Tty, "{}", str);
free(str);
return nbytes;
}
LOG_ERROR(Kernel, "(STUBBED) called d = {} nbytes = {} ", d, nbytes);
UNREACHABLE(); // normal write , is it a posix call??
return ORBIS_OK;
}
void LibKernel_Register(Core::Loader::SymbolsResolver* sym) {
// obj // obj
LIB_OBJ("f7uOxY9mM1U", "libkernel", 1, "libkernel", 1, 1, &g_stack_chk_guard); LIB_OBJ("f7uOxY9mM1U", "libkernel", 1, "libkernel", 1, 1, &g_stack_chk_guard);
// memory // memory
LIB_FUNCTION("rTXw65xmLIA", "libkernel", 1, "libkernel", 1, 1, LIB_FUNCTION("rTXw65xmLIA", "libkernel", 1, "libkernel", 1, 1, sceKernelAllocateDirectMemory);
Kernel::sceKernelAllocateDirectMemory); LIB_FUNCTION("pO96TwzOm5E", "libkernel", 1, "libkernel", 1, 1, sceKernelGetDirectMemorySize);
LIB_FUNCTION("pO96TwzOm5E", "libkernel", 1, "libkernel", 1, 1, LIB_FUNCTION("L-Q3LEjIbgA", "libkernel", 1, "libkernel", 1, 1, sceKernelMapDirectMemory);
Kernel::sceKernelGetDirectMemorySize);
LIB_FUNCTION("L-Q3LEjIbgA", "libkernel", 1, "libkernel", 1, 1,
Kernel::sceKernelMapDirectMemory);
LIB_FUNCTION("MBuItvba6z8", "libkernel", 1, "libkernel", 1, 1, sceKernelReleaseDirectMemory); LIB_FUNCTION("MBuItvba6z8", "libkernel", 1, "libkernel", 1, 1, sceKernelReleaseDirectMemory);
LIB_FUNCTION("cQke9UuBQOk", "libkernel", 1, "libkernel", 1, 1, sceKernelMunmap); LIB_FUNCTION("cQke9UuBQOk", "libkernel", 1, "libkernel", 1, 1, sceKernelMunmap);
// equeue // equeue
LIB_FUNCTION("D0OdFMjp46I", "libkernel", 1, "libkernel", 1, 1, Kernel::sceKernelCreateEqueue); LIB_FUNCTION("D0OdFMjp46I", "libkernel", 1, "libkernel", 1, 1, sceKernelCreateEqueue);
LIB_FUNCTION("fzyMKs9kim0", "libkernel", 1, "libkernel", 1, 1, Kernel::sceKernelWaitEqueue); LIB_FUNCTION("fzyMKs9kim0", "libkernel", 1, "libkernel", 1, 1, sceKernelWaitEqueue);
// misc // misc
LIB_FUNCTION("WslcK1FQcGI", "libkernel", 1, "libkernel", 1, 1, Kernel::sceKernelIsNeoMode); LIB_FUNCTION("WslcK1FQcGI", "libkernel", 1, "libkernel", 1, 1, sceKernelIsNeoMode);
LIB_FUNCTION("Ou3iL1abvng", "libkernel", 1, "libkernel", 1, 1, stack_chk_fail); LIB_FUNCTION("Ou3iL1abvng", "libkernel", 1, "libkernel", 1, 1, stack_chk_fail);
LIB_FUNCTION("9BcDykPmo1I", "libkernel", 1, "libkernel", 1, 1, __Error); LIB_FUNCTION("9BcDykPmo1I", "libkernel", 1, "libkernel", 1, 1, __Error);
LIB_FUNCTION("BPE9s9vQQXo", "libkernel", 1, "libkernel", 1, 1, posix_mmap); LIB_FUNCTION("BPE9s9vQQXo", "libkernel", 1, "libkernel", 1, 1, posix_mmap);
@ -165,13 +176,14 @@ void LibKernel_Register(Loader::SymbolsResolver* sym) {
LIB_FUNCTION("YSHRBRLn2pI", "libkernel", 1, "libkernel", 1, 1, _writev); LIB_FUNCTION("YSHRBRLn2pI", "libkernel", 1, "libkernel", 1, 1, _writev);
LIB_FUNCTION("959qrazPIrg", "libkernel", 1, "libkernel", 1, 1, sceKernelGetProcParam); LIB_FUNCTION("959qrazPIrg", "libkernel", 1, "libkernel", 1, 1, sceKernelGetProcParam);
Core::Libraries::LibKernel::fileSystemSymbolsRegister(sym); Libraries::Kernel::fileSystemSymbolsRegister(sym);
Core::Libraries::LibKernel::timeSymbolsRegister(sym); Libraries::Kernel::timeSymbolsRegister(sym);
Core::Libraries::LibKernel::pthreadSymbolsRegister(sym); Libraries::Kernel::pthreadSymbolsRegister(sym);
// temp // temp
LIB_FUNCTION("NWtTN10cJzE", "libSceLibcInternalExt", 1, "libSceLibcInternal", 1, 1, LIB_FUNCTION("NWtTN10cJzE", "libSceLibcInternalExt", 1, "libSceLibcInternal", 1, 1,
sceLibcHeapGetTraceInfo); sceLibcHeapGetTraceInfo);
LIB_FUNCTION("FxVZqBAA7ks", "libkernel", 1, "libkernel", 1, 1, ps4__write);
} }
} // namespace Core::Libraries::LibKernel } // namespace Libraries::Kernel

View File

@ -10,11 +10,11 @@ namespace Core::Loader {
class SymbolsResolver; class SymbolsResolver;
} }
namespace Core::Libraries::LibKernel { namespace Libraries::Kernel {
int32_t PS4_SYSV_ABI sceKernelReleaseDirectMemory(off_t start, size_t len); int32_t PS4_SYSV_ABI sceKernelReleaseDirectMemory(off_t start, size_t len);
int* PS4_SYSV_ABI __Error(); int* PS4_SYSV_ABI __Error();
void LibKernel_Register(Loader::SymbolsResolver* sym); void LibKernel_Register(Core::Loader::SymbolsResolver* sym);
} // namespace Core::Libraries::LibKernel } // namespace Libraries::Kernel

View File

@ -6,12 +6,12 @@
#include "common/logging/log.h" #include "common/logging/log.h"
#include "common/singleton.h" #include "common/singleton.h"
#include "core/PS4/GPU/gpu_memory.h" #include "core/PS4/GPU/gpu_memory.h"
#include "core/hle/error_codes.h" #include "core/libraries/error_codes.h"
#include "core/hle/kernel/Objects/physical_memory.h" #include "core/libraries/kernel/memory_management.h"
#include "core/hle/kernel/memory_management.h" #include "core/libraries/kernel/physical_memory.h"
#include "core/virtual_memory.h" #include "core/virtual_memory.h"
namespace Core::Kernel { namespace Libraries::Kernel {
bool is16KBAligned(u64 n) { bool is16KBAligned(u64 n) {
return ((n % (16ull * 1024) == 0)); return ((n % (16ull * 1024) == 0));
@ -122,4 +122,4 @@ int PS4_SYSV_ABI sceKernelMapDirectMemory(void** addr, u64 len, int prot, int fl
return SCE_OK; return SCE_OK;
} }
} // namespace Core::Kernel } // namespace Libraries::Kernel

View File

@ -7,7 +7,7 @@
constexpr u64 SCE_KERNEL_MAIN_DMEM_SIZE = 5376_MB; // ~ 6GB constexpr u64 SCE_KERNEL_MAIN_DMEM_SIZE = 5376_MB; // ~ 6GB
namespace Core::Kernel { namespace Libraries::Kernel {
enum MemoryTypes : u32 { enum MemoryTypes : u32 {
SCE_KERNEL_WB_ONION = 0, // write - back mode (Onion bus) SCE_KERNEL_WB_ONION = 0, // write - back mode (Onion bus)
@ -36,4 +36,4 @@ int PS4_SYSV_ABI sceKernelAllocateDirectMemory(s64 searchStart, s64 searchEnd, u
int PS4_SYSV_ABI sceKernelMapDirectMemory(void** addr, u64 len, int prot, int flags, int PS4_SYSV_ABI sceKernelMapDirectMemory(void** addr, u64 len, int prot, int flags,
s64 directMemoryStart, u64 alignment); s64 directMemoryStart, u64 alignment);
} // namespace Core::Kernel } // namespace Libraries::Kernel

View File

@ -1,9 +1,9 @@
// 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 "core/hle/kernel/Objects/physical_memory.h" #include "core/libraries/kernel/physical_memory.h"
namespace Core::Kernel { namespace Libraries::Kernel {
static u64 AlignUp(u64 pos, u64 align) { static u64 AlignUp(u64 pos, u64 align) {
return (align != 0 ? (pos + (align - 1)) & ~(align - 1) : pos); return (align != 0 ? (pos + (align - 1)) & ~(align - 1) : pos);
@ -68,4 +68,4 @@ bool PhysicalMemory::Map(u64 virtual_addr, u64 phys_addr, u64 len, int prot,
return false; return false;
} }
} // namespace Core::Kernel } // namespace Libraries::Kernel

View File

@ -9,7 +9,7 @@
#include "core/PS4/GPU/gpu_memory.h" #include "core/PS4/GPU/gpu_memory.h"
#include "core/virtual_memory.h" #include "core/virtual_memory.h"
namespace Core::Kernel { namespace Libraries::Kernel {
class PhysicalMemory { class PhysicalMemory {
public: public:
@ -37,4 +37,4 @@ private:
std::mutex m_mutex; std::mutex m_mutex;
}; };
} // namespace Core::Kernel } // namespace Libraries::Kernel

View File

@ -2,13 +2,14 @@
// SPDX-License-Identifier: GPL-2.0-or-later // SPDX-License-Identifier: GPL-2.0-or-later
#include <mutex> #include <mutex>
#include <thread>
#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/libraries/error_codes.h"
#include "core/hle/libraries/libkernel/thread_management.h" #include "core/libraries/kernel/thread_management.h"
#include "core/hle/libraries/libs.h" #include "core/libraries/libs.h"
namespace Core::Libraries::LibKernel { namespace Libraries::Kernel {
thread_local ScePthread g_pthread_self{}; thread_local ScePthread g_pthread_self{};
PThreadCxt* g_pthread_cxt = nullptr; PThreadCxt* g_pthread_cxt = nullptr;
@ -885,7 +886,7 @@ void PS4_SYSV_ABI scePthreadYield() {
sched_yield(); sched_yield();
} }
void pthreadSymbolsRegister(Loader::SymbolsResolver* sym) { void pthreadSymbolsRegister(Core::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);
LIB_FUNCTION("eXbUSpEaTsA", "libkernel", 1, "libkernel", 1, 1, scePthreadAttrSetinheritsched); LIB_FUNCTION("eXbUSpEaTsA", "libkernel", 1, "libkernel", 1, 1, scePthreadAttrSetinheritsched);
@ -931,4 +932,4 @@ void pthreadSymbolsRegister(Loader::SymbolsResolver* sym) {
LIB_FUNCTION("mkx2fVhNMsg", "libkernel", 1, "libkernel", 1, 1, posix_pthread_cond_broadcast); LIB_FUNCTION("mkx2fVhNMsg", "libkernel", 1, "libkernel", 1, 1, posix_pthread_cond_broadcast);
} }
} // namespace Core::Libraries::LibKernel } // namespace Libraries::Kernel

View File

@ -6,7 +6,6 @@
#include <atomic> #include <atomic>
#include <mutex> #include <mutex>
#include <string> #include <string>
#include <thread>
#include <vector> #include <vector>
#include <pthread.h> #include <pthread.h>
#include <sched.h> #include <sched.h>
@ -16,7 +15,7 @@ namespace Core::Loader {
class SymbolsResolver; class SymbolsResolver;
} }
namespace Core::Libraries::LibKernel { namespace Libraries::Kernel {
struct PthreadInternal; struct PthreadInternal;
struct PthreadAttrInternal; struct PthreadAttrInternal;
@ -169,5 +168,5 @@ 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);
int PS4_SYSV_ABI posix_pthread_cond_broadcast(ScePthreadCond* cond); int PS4_SYSV_ABI posix_pthread_cond_broadcast(ScePthreadCond* cond);
void pthreadSymbolsRegister(Loader::SymbolsResolver* sym); void pthreadSymbolsRegister(Core::Loader::SymbolsResolver* sym);
} // namespace Core::Libraries::LibKernel } // namespace Libraries::Kernel

View File

@ -2,10 +2,10 @@
// SPDX-License-Identifier: GPL-2.0-or-later // SPDX-License-Identifier: GPL-2.0-or-later
#include "common/native_clock.h" #include "common/native_clock.h"
#include "core/hle/libraries/libkernel/time_management.h" #include "core/libraries/kernel/time_management.h"
#include "core/hle/libraries/libs.h" #include "core/libraries/libs.h"
namespace Core::Libraries::LibKernel { namespace Libraries::Kernel {
static u64 initial_ptc; static u64 initial_ptc;
static std::unique_ptr<Common::NativeClock> clock; static std::unique_ptr<Common::NativeClock> clock;
@ -26,7 +26,7 @@ u64 PS4_SYSV_ABI sceKernelReadTsc() {
return clock->GetUptime(); return clock->GetUptime();
} }
void timeSymbolsRegister(Loader::SymbolsResolver* sym) { void timeSymbolsRegister(Core::Loader::SymbolsResolver* sym) {
clock = std::make_unique<Common::NativeClock>(); clock = std::make_unique<Common::NativeClock>();
initial_ptc = clock->GetUptime(); initial_ptc = clock->GetUptime();
LIB_FUNCTION("4J2sUJmuHZQ", "libkernel", 1, "libkernel", 1, 1, sceKernelGetProcessTime); LIB_FUNCTION("4J2sUJmuHZQ", "libkernel", 1, "libkernel", 1, 1, sceKernelGetProcessTime);
@ -36,4 +36,4 @@ void timeSymbolsRegister(Loader::SymbolsResolver* sym) {
LIB_FUNCTION("-2IRUCO--PM", "libkernel", 1, "libkernel", 1, 1, sceKernelReadTsc); LIB_FUNCTION("-2IRUCO--PM", "libkernel", 1, "libkernel", 1, 1, sceKernelReadTsc);
} }
} // namespace Core::Libraries::LibKernel } // namespace Libraries::Kernel

View File

@ -9,13 +9,13 @@ namespace Core::Loader {
class SymbolsResolver; class SymbolsResolver;
} }
namespace Core::Libraries::LibKernel { namespace Libraries::Kernel {
u64 PS4_SYSV_ABI sceKernelGetProcessTime(); u64 PS4_SYSV_ABI sceKernelGetProcessTime();
u64 PS4_SYSV_ABI sceKernelGetProcessTimeCounter(); u64 PS4_SYSV_ABI sceKernelGetProcessTimeCounter();
u64 PS4_SYSV_ABI sceKernelGetProcessTimeCounterFrequency(); u64 PS4_SYSV_ABI sceKernelGetProcessTimeCounterFrequency();
u64 PS4_SYSV_ABI sceKernelReadTsc(); u64 PS4_SYSV_ABI sceKernelReadTsc();
void timeSymbolsRegister(Loader::SymbolsResolver* sym); void timeSymbolsRegister(Core::Loader::SymbolsResolver* sym);
} // namespace Core::Libraries::LibKernel } // namespace Libraries::Kernel

View File

@ -5,13 +5,13 @@
#include "common/debug.h" #include "common/debug.h"
#include "common/logging/log.h" #include "common/logging/log.h"
#include "common/singleton.h" #include "common/singleton.h"
#include "core/hle/libraries/libc/libc.h" #include "core/libraries/libc/libc.h"
#include "core/hle/libraries/libc/libc_cxa.h" #include "core/libraries/libc/libc_cxa.h"
#include "core/hle/libraries/libc/libc_math.h" #include "core/libraries/libc/libc_math.h"
#include "core/hle/libraries/libc/libc_stdio.h" #include "core/libraries/libc/libc_stdio.h"
#include "core/hle/libraries/libc/libc_stdlib.h" #include "core/libraries/libc/libc_stdlib.h"
#include "core/hle/libraries/libc/libc_string.h" #include "core/libraries/libc/libc_string.h"
#include "core/hle/libraries/libs.h" #include "core/libraries/libs.h"
namespace Core::Libraries::LibC { namespace Core::Libraries::LibC {

View File

@ -2,7 +2,7 @@
// SPDX-License-Identifier: GPL-2.0-or-later // SPDX-License-Identifier: GPL-2.0-or-later
#include "common/logging/log.h" #include "common/logging/log.h"
#include "core/hle/libraries/libc/libc_cxa.h" #include "core/libraries/libc/libc_cxa.h"
// adapted from // adapted from
// https://opensource.apple.com/source/libcppabi/libcppabi-14/src/cxa_guard.cxx.auto.html // https://opensource.apple.com/source/libcppabi/libcppabi-14/src/cxa_guard.cxx.auto.html

View File

@ -2,7 +2,7 @@
// SPDX-License-Identifier: GPL-2.0-or-later // SPDX-License-Identifier: GPL-2.0-or-later
#include <cmath> #include <cmath>
#include "core/hle/libraries/libc/libc_math.h" #include "core/libraries/libc/libc_math.h"
namespace Core::Libraries::LibC { namespace Core::Libraries::LibC {

View File

@ -4,7 +4,7 @@
#include "common/assert.h" #include "common/assert.h"
#include "common/singleton.h" #include "common/singleton.h"
#include "core/file_sys/fs.h" #include "core/file_sys/fs.h"
#include "core/hle/libraries/libc/libc_stdio.h" #include "core/libraries/libc/libc_stdio.h"
namespace Core::Libraries::LibC { namespace Core::Libraries::LibC {

View File

@ -4,7 +4,7 @@
#pragma once #pragma once
#include "common/types.h" #include "common/types.h"
#include "core/hle/libraries/libc/printf.h" #include "core/libraries/libc/printf.h"
namespace Core::Libraries::LibC { namespace Core::Libraries::LibC {

View File

@ -3,7 +3,7 @@
#include <cstdlib> #include <cstdlib>
#include "common/assert.h" #include "common/assert.h"
#include "core/hle/libraries/libc/libc_stdlib.h" #include "core/libraries/libc/libc_stdlib.h"
namespace Core::Libraries::LibC { namespace Core::Libraries::LibC {

View File

@ -3,7 +3,7 @@
#include <cstdlib> #include <cstdlib>
#include <cstring> #include <cstring>
#include "core/hle/libraries/libc/libc_string.h" #include "core/libraries/libc/libc_string.h"
namespace Core::Libraries::LibC { namespace Core::Libraries::LibC {

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1,6 +0,0 @@
// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later
#pragma once
// TODO placeholder until port finishes
#include "core/hle/libraries/libs.h"

View File

@ -0,0 +1,54 @@
// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later
#include "common/config.h"
#include "core/PS4/HLE/Graphics/video_out.h"
#include "core/libraries/audio/audioin.h"
#include "core/libraries/audio/audioout.h"
#include "core/libraries/gnmdriver/gnmdriver.h"
#include "core/libraries/kernel/libkernel.h"
#include "core/libraries/libc/libc.h"
#include "core/libraries/libs.h"
#include "core/libraries/network/http.h"
#include "core/libraries/network/net.h"
#include "core/libraries/network/netctl.h"
#include "core/libraries/network/ssl.h"
#include "core/libraries/pad/pad.h"
#include "core/libraries/system/commondialog.h"
#include "core/libraries/system/msgdialog.h"
#include "core/libraries/system/posix.h"
#include "core/libraries/system/savedata.h"
#include "core/libraries/system/savedatadialog.h"
#include "core/libraries/system/sysmodule.h"
#include "core/libraries/system/systemservice.h"
#include "core/libraries/system/userservice.h"
namespace Libraries {
void InitHLELibs(Core::Loader::SymbolsResolver* sym) {
Libraries::Kernel::LibKernel_Register(sym);
HLE::Libs::Graphics::VideoOut::videoOutRegisterLib(sym);
Libraries::GnmDriver::RegisterlibSceGnmDriver(sym);
Libraries::LibPad::padSymbolsRegister(sym);
if (!Config::isLleLibc()) {
Core::Libraries::LibC::libcSymbolsRegister(sym);
}
// New libraries folder from autogen
Libraries::UserService::RegisterlibSceUserService(sym);
Libraries::SystemService::RegisterlibSceSystemService(sym);
Libraries::CommonDialog::RegisterlibSceCommonDialog(sym);
Libraries::MsgDialog::RegisterlibSceMsgDialog(sym);
Libraries::AudioOut::RegisterlibSceAudioOut(sym);
Libraries::Http::RegisterlibSceHttp(sym);
Libraries::Net::RegisterlibSceNet(sym);
Libraries::NetCtl::RegisterlibSceNetCtl(sym);
Libraries::SaveData::RegisterlibSceSaveData(sym);
Libraries::Ssl::RegisterlibSceSsl(sym);
Libraries::SysModule::RegisterlibSceSysmodule(sym);
Libraries::Posix::Registerlibsceposix(sym);
Libraries::AudioIn::RegisterlibSceAudioIn(sym);
Libraries::SaveDataDialog::RegisterlibSceSaveDataDialog(sym);
}
} // namespace Libraries

View File

@ -34,8 +34,8 @@
sym->AddSymbol(sr, func); \ sym->AddSymbol(sr, func); \
} }
namespace OldLibraries { namespace Libraries {
void InitHLELibs(Core::Loader::SymbolsResolver* sym); void InitHLELibs(Core::Loader::SymbolsResolver* sym);
} // namespace OldLibraries } // namespace Libraries

View File

@ -1,10 +1,10 @@
// 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
// Generated By moduleGenerator
#include "common/logging/log.h" #include "common/logging/log.h"
#include "error_codes.h" #include "core/libraries/error_codes.h"
#include "libscehttp.h" #include "core/libraries/libs.h"
#include "core/libraries/network/http.h"
namespace Libraries::Http { namespace Libraries::Http {

View File

@ -3,7 +3,11 @@
#pragma once #pragma once
#include "library_common.h" #include "common/types.h"
namespace Core::Loader {
class SymbolsResolver;
}
namespace Libraries::Http { namespace Libraries::Http {

View File

@ -1,10 +1,10 @@
// 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
// Generated By moduleGenerator
#include "common/logging/log.h" #include "common/logging/log.h"
#include "error_codes.h" #include "core/libraries/error_codes.h"
#include "libscenet.h" #include "core/libraries/libs.h"
#include "core/libraries/network/net.h"
namespace Libraries::Net { namespace Libraries::Net {

View File

@ -3,7 +3,11 @@
#pragma once #pragma once
#include "library_common.h" #include "common/types.h"
namespace Core::Loader {
class SymbolsResolver;
}
namespace Libraries::Net { namespace Libraries::Net {

View File

@ -1,10 +1,10 @@
// 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
// Generated By moduleGenerator
#include "common/logging/log.h" #include "common/logging/log.h"
#include "error_codes.h" #include "core/libraries/error_codes.h"
#include "libscenetctl.h" #include "core/libraries/libs.h"
#include "core/libraries/network/netctl.h"
namespace Libraries::NetCtl { namespace Libraries::NetCtl {

View File

@ -3,7 +3,11 @@
#pragma once #pragma once
#include "library_common.h" #include "common/types.h"
namespace Core::Loader {
class SymbolsResolver;
}
namespace Libraries::NetCtl { namespace Libraries::NetCtl {

View File

@ -1,10 +1,10 @@
// 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
// Generated By moduleGenerator
#include "common/logging/log.h" #include "common/logging/log.h"
#include "error_codes.h" #include "core/libraries/error_codes.h"
#include "libscessl.h" #include "core/libraries/libs.h"
#include "core/libraries/network/ssl.h"
namespace Libraries::Ssl { namespace Libraries::Ssl {

View File

@ -3,7 +3,11 @@
#pragma once #pragma once
#include "library_common.h" #include "common/types.h"
namespace Core::Loader {
class SymbolsResolver;
}
namespace Libraries::Ssl { namespace Libraries::Ssl {

View File

@ -1,14 +1,14 @@
// 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 "Emulator/Host/controller.h"
#include "common/logging/log.h" #include "common/logging/log.h"
#include "common/singleton.h" #include "common/singleton.h"
#include "core/hle/error_codes.h" #include "core/libraries/error_codes.h"
#include "core/hle/libraries/libpad/pad.h" #include "core/libraries/libs.h"
#include "core/hle/libraries/libs.h" #include "core/libraries/pad/pad.h"
#include "input/controller.h"
namespace OldLibraries::LibPad { namespace Libraries::LibPad {
int PS4_SYSV_ABI scePadInit() { int PS4_SYSV_ABI scePadInit() {
LOG_WARNING(Lib_Pad, "(DUMMY) called"); LOG_WARNING(Lib_Pad, "(DUMMY) called");
@ -22,11 +22,11 @@ int PS4_SYSV_ABI scePadOpen(Libraries::UserService::OrbisUserServiceUserId user_
} }
int PS4_SYSV_ABI scePadReadState(int32_t handle, ScePadData* pData) { int PS4_SYSV_ABI scePadReadState(int32_t handle, ScePadData* pData) {
auto* controller = Common::Singleton<Emulator::Host::Controller::GameController>::Instance(); auto* controller = Common::Singleton<Input::GameController>::Instance();
int connectedCount = 0; int connectedCount = 0;
bool isConnected = false; bool isConnected = false;
Emulator::Host::Controller::State state; Input::State state;
controller->readState(&state, &isConnected, &connectedCount); controller->readState(&state, &isConnected, &connectedCount);
pData->buttons = state.buttonsState; pData->buttons = state.buttonsState;
@ -51,8 +51,8 @@ int PS4_SYSV_ABI scePadReadState(int32_t handle, ScePadData* pData) {
int PS4_SYSV_ABI scePadRead(int handle, ScePadData* pData, int num) { int PS4_SYSV_ABI scePadRead(int handle, ScePadData* pData, int num) {
int connected_count = 0; int connected_count = 0;
bool connected = false; bool connected = false;
Emulator::Host::Controller::State states[64]; Input::State states[64];
auto* controller = Common::Singleton<Emulator::Host::Controller::GameController>::Instance(); auto* controller = Common::Singleton<Input::GameController>::Instance();
int ret_num = controller->ReadStates(states, num, &connected, &connected_count); int ret_num = controller->ReadStates(states, num, &connected, &connected_count);
if (!connected) { if (!connected) {
@ -123,4 +123,4 @@ void padSymbolsRegister(Core::Loader::SymbolsResolver* sym) {
LIB_FUNCTION("clVvL4ZDntw", "libScePad", 1, "libScePad", 1, 1, scePadSetMotionSensorState); LIB_FUNCTION("clVvL4ZDntw", "libScePad", 1, "libScePad", 1, 1, scePadSetMotionSensorState);
} }
} // namespace OldLibraries::LibPad } // namespace Libraries::LibPad

View File

@ -4,23 +4,23 @@
#pragma once #pragma once
#include "common/types.h" #include "common/types.h"
#include "src/core/libraries/libsceuserservice.h" #include "src/core/libraries/system/userservice.h"
namespace Core::Loader { namespace Core::Loader {
class SymbolsResolver; class SymbolsResolver;
} }
namespace OldLibraries::LibPad { namespace Libraries::LibPad {
#define ORBIS_PAD_PORT_TYPE_STANDARD 0 constexpr s8 ORBIS_PAD_PORT_TYPE_STANDARD = 0;
#define ORBIS_PAD_PORT_TYPE_SPECIAL 2 constexpr s8 ORBIS_PAD_PORT_TYPE_SPECIAL = 2;
#define ORBIS_PAD_DEVICE_CLASS_PAD 0 constexpr s8 ORBIS_PAD_DEVICE_CLASS_PAD = 0;
#define ORBIS_PAD_DEVICE_CLASS_GUITAR 1 constexpr s8 ORBIS_PAD_DEVICE_CLASS_GUITAR = 1;
#define ORBIS_PAD_DEVICE_CLASS_DRUMS 2 constexpr s8 ORBIS_PAD_DEVICE_CLASS_DRUMS = 2;
#define ORBIS_PAD_CONNECTION_TYPE_STANDARD 0 constexpr s8 ORBIS_PAD_CONNECTION_TYPE_STANDARD = 0;
#define ORBIS_PAD_CONNECTION_TYPE_REMOTE 2 constexpr s8 ORBIS_PAD_CONNECTION_TYPE_REMOTE = 2;
enum ScePadButton : u32 { enum ScePadButton : u32 {
L3 = 0x00000002, L3 = 0x00000002,
@ -125,4 +125,4 @@ int PS4_SYSV_ABI scePadReadState(int32_t handle, ScePadData* pData);
void padSymbolsRegister(Core::Loader::SymbolsResolver* sym); void padSymbolsRegister(Core::Loader::SymbolsResolver* sym);
}; // namespace OldLibraries::LibPad }; // namespace Libraries::LibPad

View File

@ -1,10 +1,10 @@
// 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
// Generated By moduleGenerator
#include "common/logging/log.h" #include "common/logging/log.h"
#include "error_codes.h" #include "core/libraries/error_codes.h"
#include "libscecommondialog.h" #include "core/libraries/libs.h"
#include "core/libraries/system/commondialog.h"
namespace Libraries::CommonDialog { namespace Libraries::CommonDialog {

View File

@ -3,7 +3,11 @@
#pragma once #pragma once
#include "library_common.h" #include "common/types.h"
namespace Core::Loader {
class SymbolsResolver;
}
namespace Libraries::CommonDialog { namespace Libraries::CommonDialog {

View File

@ -1,10 +1,10 @@
// 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
// Generated By moduleGenerator
#include "common/logging/log.h" #include "common/logging/log.h"
#include "error_codes.h" #include "core/libraries/error_codes.h"
#include "libscemsgdialog.h" #include "core/libraries/libs.h"
#include "core/libraries/system/msgdialog.h"
namespace Libraries::MsgDialog { namespace Libraries::MsgDialog {

View File

@ -3,8 +3,12 @@
#pragma once #pragma once
#include "library_common.h" #include "common/types.h"
#include "libscecommondialog.h" #include "core/libraries/system/commondialog.h"
namespace Core::Loader {
class SymbolsResolver;
}
namespace Libraries::MsgDialog { namespace Libraries::MsgDialog {

View File

@ -1,10 +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
// Generated By moduleGenerator #include "core/libraries/system/posix.h"
#include "common/logging/log.h"
#include "error_codes.h"
#include "libsceposix.h"
namespace Libraries::Posix { namespace Libraries::Posix {

View File

@ -3,7 +3,9 @@
#pragma once #pragma once
#include "library_common.h" namespace Core::Loader {
class SymbolsResolver;
}
namespace Libraries::Posix { namespace Libraries::Posix {
void Registerlibsceposix(Core::Loader::SymbolsResolver* sym); void Registerlibsceposix(Core::Loader::SymbolsResolver* sym);

View File

@ -1,11 +1,11 @@
// 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
// Generated By moduleGenerator #include "common/assert.h"
#include <common/assert.h>
#include "common/logging/log.h" #include "common/logging/log.h"
#include "error_codes.h" #include "core/libraries/error_codes.h"
#include "libscesavedata.h" #include "core/libraries/libs.h"
#include "core/libraries/system/savedata.h"
namespace Libraries::SaveData { namespace Libraries::SaveData {

View File

@ -3,7 +3,11 @@
#pragma once #pragma once
#include "library_common.h" #include "common/types.h"
namespace Core::Loader {
class SymbolsResolver;
}
namespace Libraries::SaveData { namespace Libraries::SaveData {

View File

@ -1,10 +1,10 @@
// 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
// Generated By moduleGenerator
#include "common/logging/log.h" #include "common/logging/log.h"
#include "error_codes.h" #include "core/libraries/error_codes.h"
#include "libscesavedatadialog.h" #include "core/libraries/libs.h"
#include "core/libraries/system/savedatadialog.h"
namespace Libraries::SaveDataDialog { namespace Libraries::SaveDataDialog {

View File

@ -3,7 +3,11 @@
#pragma once #pragma once
#include "library_common.h" #include "common/types.h"
namespace Core::Loader {
class SymbolsResolver;
}
namespace Libraries::SaveDataDialog { namespace Libraries::SaveDataDialog {

View File

@ -1,13 +1,14 @@
// 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
// Generated By moduleGenerator
#define MAGIC_ENUM_RANGE_MIN 0 #define MAGIC_ENUM_RANGE_MIN 0
#define MAGIC_ENUM_RANGE_MAX 300 #define MAGIC_ENUM_RANGE_MAX 300
#include <magic_enum.hpp> #include <magic_enum.hpp>
#include "common/logging/log.h" #include "common/logging/log.h"
#include "error_codes.h" #include "core/libraries/error_codes.h"
#include "libscesysmodule.h" #include "core/libraries/libs.h"
#include "core/libraries/system/sysmodule.h"
namespace Libraries::SysModule { namespace Libraries::SysModule {

View File

@ -3,7 +3,11 @@
#pragma once #pragma once
#include "library_common.h" #include "common/types.h"
namespace Core::Loader {
class SymbolsResolver;
}
namespace Libraries::SysModule { namespace Libraries::SysModule {

View File

@ -1,10 +1,10 @@
// 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
// Generated By moduleGenerator
#include "common/logging/log.h" #include "common/logging/log.h"
#include "error_codes.h" #include "core/libraries/error_codes.h"
#include "libscesystemservice.h" #include "core/libraries/libs.h"
#include "core/libraries/system/systemservice.h"
namespace Libraries::SystemService { namespace Libraries::SystemService {

View File

@ -4,7 +4,11 @@
// https://github.com/OpenOrbis/OpenOrbis-PS4-Toolchain/blob/master/include/orbis/_types/sys_service.h // https://github.com/OpenOrbis/OpenOrbis-PS4-Toolchain/blob/master/include/orbis/_types/sys_service.h
#pragma once #pragma once
#include "library_common.h" #include "common/types.h"
namespace Core::Loader {
class SymbolsResolver;
}
namespace Libraries::SystemService { namespace Libraries::SystemService {

View File

@ -1,10 +1,10 @@
// 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
// Generated By moduleGenerator
#include "common/logging/log.h" #include "common/logging/log.h"
#include "error_codes.h" #include "core/libraries/error_codes.h"
#include "libsceuserservice.h" #include "core/libraries/libs.h"
#include "core/libraries/system/userservice.h"
namespace Libraries::UserService { namespace Libraries::UserService {

View File

@ -4,7 +4,11 @@
// https://github.com/OpenOrbis/OpenOrbis-PS4-Toolchain/blob/master/include/orbis/_types/user.h // https://github.com/OpenOrbis/OpenOrbis-PS4-Toolchain/blob/master/include/orbis/_types/user.h
#pragma once #pragma once
#include "library_common.h" #include "common/types.h"
namespace Core::Loader {
class SymbolsResolver;
}
namespace Libraries::UserService { namespace Libraries::UserService {

View File

@ -9,7 +9,7 @@
#include "common/string_util.h" #include "common/string_util.h"
#include "core/aerolib/aerolib.h" #include "core/aerolib/aerolib.h"
#include "core/aerolib/stubs.h" #include "core/aerolib/stubs.h"
#include "core/hle/libraries/libkernel/thread_management.h" #include "core/libraries/kernel/thread_management.h"
#include "core/linker.h" #include "core/linker.h"
#include "core/tls.h" #include "core/tls.h"
#include "core/virtual_memory.h" #include "core/virtual_memory.h"
@ -662,7 +662,7 @@ static void RunMainEntry(u64 addr, EntryParams* params, exit_func_t exit_func) {
// there's no coming back // there's no coming back
: :
: "r"(addr), "r"(params), "r"(exit_func) : "r"(addr), "r"(params), "r"(exit_func)
: "rax", "rsi", "rdi", "rsp", "rbp"); : "rax", "rsi", "rdi", "rsp");
} }
void Linker::Execute() { void Linker::Execute() {
@ -670,8 +670,8 @@ void Linker::Execute() {
DebugDump(); DebugDump();
} }
Core::Libraries::LibKernel::pthreadInitSelfMainThread(); Libraries::Kernel::pthreadInitSelfMainThread();
// relocate all modules // Relocate all modules
for (const auto& m : m_modules) { for (const auto& m : m_modules) {
Relocate(m.get()); Relocate(m.get());
} }

View File

@ -2,14 +2,14 @@
// SPDX-License-Identifier: GPL-2.0-or-later // SPDX-License-Identifier: GPL-2.0-or-later
#include <fmt/core.h> #include <fmt/core.h>
#include <vulkan_util.h>
#include "Emulator/Host/controller.h"
#include "common/singleton.h" #include "common/singleton.h"
#include "common/version.h" #include "common/version.h"
#include "core/PS4/HLE/Graphics/graphics_render.h" #include "core/PS4/HLE/Graphics/graphics_render.h"
#include "core/PS4/HLE/Graphics/video_out.h" #include "core/PS4/HLE/Graphics/video_out.h"
#include "core/hle/libraries/libpad/pad.h" #include "core/libraries/pad/pad.h"
#include "emulator.h" #include "emulator.h"
#include "input/controller.h"
#include "vulkan_util.h"
namespace Emu { namespace Emu {
@ -308,7 +308,7 @@ void DrawBuffer(HLE::Libs::Graphics::VideoOutVulkanImage* image) {
} }
void keyboardEvent(SDL_Event* event) { void keyboardEvent(SDL_Event* event) {
using OldLibraries::LibPad::ScePadButton; using Libraries::LibPad::ScePadButton;
if (event->type == SDL_EVENT_KEY_DOWN || event->type == SDL_EVENT_KEY_UP) { if (event->type == SDL_EVENT_KEY_DOWN || event->type == SDL_EVENT_KEY_UP) {
u32 button = 0; u32 button = 0;
@ -344,8 +344,7 @@ void keyboardEvent(SDL_Event* event) {
break; break;
} }
if (button != 0) { if (button != 0) {
auto* controller = auto* controller = Common::Singleton<Input::GameController>::Instance();
Common::Singleton<Emulator::Host::Controller::GameController>::Instance();
controller->checKButton(0, button, event->type == SDL_EVENT_KEY_DOWN); controller->checKButton(0, button, event->type == SDL_EVENT_KEY_DOWN);
} }
} }

View File

@ -1,10 +1,10 @@
// 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 "Emulator/Host/controller.h" #include "core/libraries/kernel/time_management.h"
#include "core/hle/libraries/libkernel/time_management.h" #include "input/controller.h"
namespace Emulator::Host::Controller { namespace Input {
GameController::GameController() { GameController::GameController() {
m_states_num = 0; m_states_num = 0;
@ -77,7 +77,7 @@ void GameController::addState(const State& state) {
void GameController::checKButton(int id, u32 button, bool isPressed) { void GameController::checKButton(int id, u32 button, bool isPressed) {
std::scoped_lock lock{m_mutex}; std::scoped_lock lock{m_mutex};
auto state = getLastState(); auto state = getLastState();
state.time = Core::Libraries::LibKernel::sceKernelGetProcessTime(); state.time = Libraries::Kernel::sceKernelGetProcessTime();
if (isPressed) { if (isPressed) {
state.buttonsState |= button; state.buttonsState |= button;
} else { } else {
@ -87,4 +87,4 @@ void GameController::checKButton(int id, u32 button, bool isPressed) {
addState(state); addState(state);
} }
} // namespace Emulator::Host::Controller } // namespace Input

View File

@ -6,7 +6,8 @@
#include <mutex> #include <mutex>
#include "common/types.h" #include "common/types.h"
namespace Emulator::Host::Controller { namespace Input {
struct State { struct State {
u32 buttonsState = 0; u32 buttonsState = 0;
u64 time = 0; u64 time = 0;
@ -36,8 +37,8 @@ private:
int m_connected_count = 0; int m_connected_count = 0;
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]; std::array<State, MAX_STATES> m_states;
StateInternal m_private[MAX_STATES]; std::array<StateInternal, MAX_STATES> m_private;
}; };
} // namespace Emulator::Host::Controller } // namespace Input

View File

@ -1,26 +1,22 @@
// 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 <thread>
#include <SDL3/SDL.h> #include <SDL3/SDL.h>
#include <Zydis/Zydis.h> #include <Zydis/Zydis.h>
#include <fmt/core.h> #include <fmt/core.h>
#include <cinttypes>
#include <cstdio>
#include <thread>
#include <common/logging/log.h>
#include <core/hle/libraries/libc/libc.h>
#include <core/hle/libraries/libkernel/thread_management.h>
#include "common/config.h" #include "common/config.h"
#include "common/discord.h" #include "common/discord.h"
#include "common/logging/backend.h" #include "common/logging/backend.h"
#include "common/logging/log.h"
#include "common/path_util.h" #include "common/path_util.h"
#include "common/singleton.h" #include "common/singleton.h"
#include "common/types.h"
#include "core/PS4/HLE/Graphics/video_out.h" #include "core/PS4/HLE/Graphics/video_out.h"
#include "core/file_sys/fs.h" #include "core/file_sys/fs.h"
#include "core/hle/libraries/libs.h" #include "core/libraries/kernel/thread_management.h"
#include "core/libraries/libc/libc.h"
#include "core/libraries/libs.h"
#include "core/linker.h" #include "core/linker.h"
#include "core/tls.h" #include "core/tls.h"
#include "emulator.h" #include "emulator.h"
@ -34,7 +30,7 @@ int main(int argc, char* argv[]) {
Config::load(config_dir / "config.toml"); Config::load(config_dir / "config.toml");
Common::Log::Initialize(); Common::Log::Initialize();
Common::Log::Start(); Common::Log::Start();
Core::Libraries::LibKernel::init_pthreads(); Libraries::Kernel::init_pthreads();
auto width = Config::getScreenWidth(); auto width = Config::getScreenWidth();
auto height = Config::getScreenHeight(); auto height = Config::getScreenHeight();
Emu::emuInit(width, height); Emu::emuInit(width, height);
@ -48,7 +44,7 @@ int main(int argc, char* argv[]) {
mnt->Mount(p.parent_path(), "/app0"); mnt->Mount(p.parent_path(), "/app0");
auto linker = Common::Singleton<Core::Linker>::Instance(); auto linker = Common::Singleton<Core::Linker>::Instance();
OldLibraries::InitHLELibs(&linker->getHLESymbols()); Libraries::InitHLELibs(&linker->getHLESymbols());
Core::InstallTlsHandler(); Core::InstallTlsHandler();
linker->LoadModule(path); linker->LoadModule(path);
// check if there is a libc.prx in sce_module folder // check if there is a libc.prx in sce_module folder