mirror of
https://github.com/shadps4-emu/shadPS4.git
synced 2025-12-10 13:48:40 +00:00
Merge pull request #130 from shadps4-emu/kernel_stuff
Kernel stuff & others
This commit is contained in:
1
.github/workflows/windows-qt.yml
vendored
1
.github/workflows/windows-qt.yml
vendored
@@ -45,7 +45,6 @@ jobs:
|
||||
mkdir upload
|
||||
move build/Release/shadps4.exe upload
|
||||
move build/Release/zlib-ng2.dll upload
|
||||
move build/Release/libwinpthread-1.dll upload
|
||||
windeployqt --dir upload upload/shadps4.exe
|
||||
|
||||
- name: Upload executable
|
||||
|
||||
3
.github/workflows/windows.yml
vendored
3
.github/workflows/windows.yml
vendored
@@ -37,5 +37,4 @@ jobs:
|
||||
# A file, directory or wildcard pattern that describes what to upload
|
||||
path: |
|
||||
${{github.workspace}}/build/Release/shadps4.exe
|
||||
${{github.workspace}}/build/Release/SDL3.dll
|
||||
${{github.workspace}}/build/Release/libwinpthread-1.dll
|
||||
${{github.workspace}}/build/Release/SDL3.dll
|
||||
10
.gitmodules
vendored
10
.gitmodules
vendored
@@ -6,10 +6,6 @@
|
||||
path = third-party/zydis
|
||||
url = https://github.com/zyantific/zydis.git
|
||||
shallow = true
|
||||
[submodule "third-party/winpthread"]
|
||||
path = third-party/winpthread
|
||||
url = https://github.com/shadps4/winpthread.git
|
||||
branch = main
|
||||
[submodule "third-party/toml11"]
|
||||
path = third-party/toml11
|
||||
url = https://github.com/ToruNiina/toml11
|
||||
@@ -18,9 +14,6 @@
|
||||
path = third-party/xxHash
|
||||
url = https://github.com/Cyan4973/xxHash.git
|
||||
branch = dev
|
||||
[submodule "third-party/vulkan"]
|
||||
path = third-party/vulkan
|
||||
url = https://github.com/GPUCode/vulkan
|
||||
[submodule "externals/discord-rpc"]
|
||||
path = externals/discord-rpc
|
||||
url = https://github.com/shadps4-emu/ext-discord-rpc.git
|
||||
@@ -64,3 +57,6 @@
|
||||
[submodule "externals/xbyak"]
|
||||
path = externals/xbyak
|
||||
url = https://github.com/herumi/xbyak
|
||||
[submodule "externals/winpthreads"]
|
||||
path = externals/winpthreads
|
||||
url = https://github.com/shadps4-emu/winpthreads.git
|
||||
|
||||
@@ -403,7 +403,7 @@ if (ENABLE_QT_GUI)
|
||||
endif()
|
||||
|
||||
if (WIN32)
|
||||
target_link_libraries(shadps4 PRIVATE mincore winpthread clang_rt.builtins-x86_64.lib)
|
||||
target_link_libraries(shadps4 PRIVATE mincore winpthreads clang_rt.builtins-x86_64.lib)
|
||||
add_definitions(-D_CRT_SECURE_NO_WARNINGS -D_CRT_NONSTDC_NO_DEPRECATE -D_SCL_SECURE_NO_WARNINGS)
|
||||
add_definitions(-DNOMINMAX -DWIN32_LEAN_AND_MEAN)
|
||||
if (MSVC)
|
||||
@@ -438,9 +438,3 @@ add_custom_command(TARGET shadps4 POST_BUILD
|
||||
COMMAND ${CMAKE_COMMAND} -E copy_if_different
|
||||
$<TARGET_FILE:SDL3-shared>
|
||||
$<TARGET_FILE_DIR:shadps4>)
|
||||
|
||||
if (WIN32)
|
||||
add_custom_command(TARGET shadps4 POST_BUILD
|
||||
COMMAND ${CMAKE_COMMAND} -E copy_if_different
|
||||
"${PROJECT_SOURCE_DIR}/third-party/winpthread/bin/libwinpthread-1.dll" $<TARGET_FILE_DIR:shadps4>)
|
||||
endif()
|
||||
|
||||
6
externals/CMakeLists.txt
vendored
6
externals/CMakeLists.txt
vendored
@@ -66,3 +66,9 @@ add_subdirectory(robin-map EXCLUDE_FROM_ALL)
|
||||
|
||||
# Xbyak
|
||||
add_subdirectory(xbyak EXCLUDE_FROM_ALL)
|
||||
|
||||
# Winpthreads
|
||||
if (WIN32)
|
||||
add_subdirectory(winpthreads EXCLUDE_FROM_ALL)
|
||||
target_include_directories(winpthreads INTERFACE winpthreads/include)
|
||||
endif()
|
||||
|
||||
2
externals/fmt
vendored
2
externals/fmt
vendored
Submodule externals/fmt updated: aa52eb765d...d2473b7b73
2
externals/glslang
vendored
2
externals/glslang
vendored
Submodule externals/glslang updated: 2db79056b4...effcbf7893
2
externals/robin-map
vendored
2
externals/robin-map
vendored
Submodule externals/robin-map updated: 048eb1442a...1115dad3ff
2
externals/sdl3
vendored
2
externals/sdl3
vendored
Submodule externals/sdl3 updated: cbb3c69cb0...bcbf09acde
2
externals/vma
vendored
2
externals/vma
vendored
Submodule externals/vma updated: 5677097baf...eaf8fc27ee
2
externals/vulkan-headers
vendored
2
externals/vulkan-headers
vendored
Submodule externals/vulkan-headers updated: cfebfc96b2...4bc77c26ff
1
externals/winpthreads
vendored
Submodule
1
externals/winpthreads
vendored
Submodule
Submodule externals/winpthreads added at d937b60055
2
externals/zlib-ng
vendored
2
externals/zlib-ng
vendored
Submodule externals/zlib-ng updated: 3f35bfccff...1007e7a9c7
171520
scripts/aerolib.inl
Normal file
171520
scripts/aerolib.inl
Normal file
File diff suppressed because it is too large
Load Diff
105455
scripts/ps4_names.txt
105455
scripts/ps4_names.txt
File diff suppressed because it is too large
Load Diff
160294
src/core/aerolib/aerolib.inl
160294
src/core/aerolib/aerolib.inl
File diff suppressed because it is too large
Load Diff
@@ -1,6 +1,7 @@
|
||||
// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#include <chrono>
|
||||
#include <thread>
|
||||
#include "common/assert.h"
|
||||
#include "common/logging/log.h"
|
||||
@@ -16,7 +17,6 @@
|
||||
#include "core/libraries/kernel/time_management.h"
|
||||
#include "core/libraries/libs.h"
|
||||
#include "core/linker.h"
|
||||
|
||||
#ifdef _WIN64
|
||||
#include <io.h>
|
||||
#include <windows.h>
|
||||
@@ -158,6 +158,27 @@ s64 PS4_SYSV_ABI ps4__write(int d, const void* buf, std::size_t nbytes) {
|
||||
return ORBIS_OK;
|
||||
}
|
||||
|
||||
int PS4_SYSV_ABI sceKernelConvertUtcToLocaltime(time_t time, time_t* local_time,
|
||||
struct OrbisTimesec* st, unsigned long* dst_sec) {
|
||||
LOG_TRACE(Kernel, "Called");
|
||||
const auto* time_zone = std::chrono::current_zone();
|
||||
auto info = time_zone->get_info(std::chrono::system_clock::now());
|
||||
|
||||
*local_time = info.offset.count() + info.save.count() * 60 + time;
|
||||
|
||||
if (st != nullptr) {
|
||||
st->t = time;
|
||||
st->west_sec = info.offset.count() * 60;
|
||||
st->dst_sec = info.save.count() * 60;
|
||||
}
|
||||
|
||||
if (dst_sec != nullptr) {
|
||||
*dst_sec = info.save.count() * 60;
|
||||
}
|
||||
|
||||
return ORBIS_OK;
|
||||
}
|
||||
|
||||
void LibKernel_Register(Core::Loader::SymbolsResolver* sym) {
|
||||
// obj
|
||||
LIB_OBJ("f7uOxY9mM1U", "libkernel", 1, "libkernel", 1, 1, &g_stack_chk_guard);
|
||||
@@ -179,6 +200,7 @@ void LibKernel_Register(Core::Loader::SymbolsResolver* sym) {
|
||||
LIB_FUNCTION("1jfXLRVzisc", "libkernel", 1, "libkernel", 1, 1, sceKernelUsleep);
|
||||
LIB_FUNCTION("YSHRBRLn2pI", "libkernel", 1, "libkernel", 1, 1, _writev);
|
||||
LIB_FUNCTION("959qrazPIrg", "libkernel", 1, "libkernel", 1, 1, sceKernelGetProcParam);
|
||||
LIB_FUNCTION("-o5uEDpN+oY", "libkernel", 1, "libkernel", 1, 1, sceKernelConvertUtcToLocaltime);
|
||||
|
||||
Libraries::Kernel::fileSystemSymbolsRegister(sym);
|
||||
Libraries::Kernel::timeSymbolsRegister(sym);
|
||||
|
||||
@@ -12,6 +12,12 @@ class SymbolsResolver;
|
||||
|
||||
namespace Libraries::Kernel {
|
||||
|
||||
struct OrbisTimesec {
|
||||
time_t t;
|
||||
u64 west_sec;
|
||||
u64 dst_sec;
|
||||
};
|
||||
|
||||
int32_t PS4_SYSV_ABI sceKernelReleaseDirectMemory(off_t start, size_t len);
|
||||
int* PS4_SYSV_ABI __Error();
|
||||
|
||||
|
||||
@@ -8,6 +8,9 @@
|
||||
#include "core/libraries/error_codes.h"
|
||||
#include "core/libraries/kernel/thread_management.h"
|
||||
#include "core/libraries/libs.h"
|
||||
#ifdef _WIN64
|
||||
#include <windows.h>
|
||||
#endif
|
||||
|
||||
namespace Libraries::Kernel {
|
||||
|
||||
@@ -890,6 +893,12 @@ void PS4_SYSV_ABI scePthreadYield() {
|
||||
sched_yield();
|
||||
}
|
||||
|
||||
int PS4_SYSV_ABI scePthreadDetach(ScePthread thread) {
|
||||
LOG_INFO(Kernel_Pthread, "thread create name = {}", thread->name);
|
||||
thread->is_detached = true;
|
||||
return ORBIS_OK;
|
||||
}
|
||||
|
||||
void pthreadSymbolsRegister(Core::Loader::SymbolsResolver* sym) {
|
||||
LIB_FUNCTION("4+h9EzwKF4I", "libkernel", 1, "libkernel", 1, 1, scePthreadAttrSetschedpolicy);
|
||||
LIB_FUNCTION("-Wreprtu0Qs", "libkernel", 1, "libkernel", 1, 1, scePthreadAttrSetdetachstate);
|
||||
@@ -897,11 +906,13 @@ void pthreadSymbolsRegister(Core::Loader::SymbolsResolver* sym) {
|
||||
LIB_FUNCTION("DzES9hQF4f4", "libkernel", 1, "libkernel", 1, 1, scePthreadAttrSetschedparam);
|
||||
LIB_FUNCTION("nsYoNRywwNg", "libkernel", 1, "libkernel", 1, 1, scePthreadAttrInit);
|
||||
LIB_FUNCTION("62KCwEMmzcM", "libkernel", 1, "libkernel", 1, 1, scePthreadAttrDestroy);
|
||||
LIB_FUNCTION("4qGrR6eoP9Y", "libkernel", 1, "libkernel", 1, 1, scePthreadDetach);
|
||||
|
||||
LIB_FUNCTION("aI+OeCz8xrQ", "libkernel", 1, "libkernel", 1, 1, scePthreadSelf);
|
||||
LIB_FUNCTION("3qxgM4ezETA", "libkernel", 1, "libkernel", 1, 1, scePthreadAttrSetaffinity);
|
||||
LIB_FUNCTION("8+s5BzZjxSg", "libkernel", 1, "libkernel", 1, 1, scePthreadAttrGetaffinity);
|
||||
LIB_FUNCTION("x1X76arYMxU", "libkernel", 1, "libkernel", 1, 1, scePthreadAttrGet);
|
||||
LIB_FUNCTION("UTXzJbWhhTE", "libkernel", 1, "libkernel", 1, 1, scePthreadAttrSetstacksize);
|
||||
|
||||
LIB_FUNCTION("bt3CTBKmGyI", "libkernel", 1, "libkernel", 1, 1, scePthreadSetaffinity);
|
||||
LIB_FUNCTION("6UgtwV+0zb4", "libkernel", 1, "libkernel", 1, 1, scePthreadCreate);
|
||||
@@ -928,6 +939,7 @@ void pthreadSymbolsRegister(Core::Loader::SymbolsResolver* sym) {
|
||||
|
||||
LIB_FUNCTION("QBi7HCK03hw", "libkernel", 1, "libkernel", 1, 1, sceKernelClockGettime);
|
||||
LIB_FUNCTION("lLMT9vJAck0", "libkernel", 1, "libkernel", 1, 1, clock_gettime);
|
||||
LIB_FUNCTION("lLMT9vJAck0", "libScePosix", 1, "libkernel", 1, 1, clock_gettime);
|
||||
LIB_FUNCTION("yS8U2TGCe1A", "libScePosix", 1, "libkernel", 1, 1, nanosleep);
|
||||
|
||||
// openorbis weird functions
|
||||
|
||||
9
third-party/CMakeLists.txt
vendored
9
third-party/CMakeLists.txt
vendored
@@ -12,15 +12,6 @@ add_subdirectory(magic_enum EXCLUDE_FROM_ALL)
|
||||
# Toml11
|
||||
add_subdirectory(toml11 EXCLUDE_FROM_ALL)
|
||||
|
||||
# Vulkan
|
||||
add_subdirectory(vulkan EXCLUDE_FROM_ALL)
|
||||
|
||||
# Winpthreads
|
||||
if (WIN32)
|
||||
add_subdirectory(winpthread EXCLUDE_FROM_ALL)
|
||||
target_include_directories(winpthread INTERFACE winpthread/include)
|
||||
endif()
|
||||
|
||||
# xxHash
|
||||
add_library(xxhash INTERFACE)
|
||||
target_include_directories(xxhash INTERFACE xxhash)
|
||||
|
||||
1
third-party/vulkan
vendored
1
third-party/vulkan
vendored
Submodule third-party/vulkan deleted from 72b2e74075
1
third-party/winpthread
vendored
1
third-party/winpthread
vendored
Submodule third-party/winpthread deleted from 918de958b7
Reference in New Issue
Block a user