mirror of
https://github.com/shadps4-emu/shadPS4.git
synced 2026-04-29 15:33:35 -06:00
General Misses (0.15.1 WIP part 5) (#4164)
* more from 0.15.1 WIP branch * fixup
This commit is contained in:
parent
edd50ab2d0
commit
d0a4718fb9
@ -318,6 +318,38 @@ s32 PS4_SYSV_ABI sceKernelMapFlexibleMemory(void** addr_in_out, u64 len, s32 pro
|
||||
return sceKernelMapNamedFlexibleMemory(addr_in_out, len, prot, flags, "anon");
|
||||
}
|
||||
|
||||
s32 PS4_SYSV_ABI sceKernelMapNamedSystemFlexibleMemory(void** addr_in_out, u64 len, s32 prot,
|
||||
s32 flags, const char* name) {
|
||||
LOG_INFO(Kernel_Vmm, "in_addr = {}, len = {:#x}, prot = {:#x}, flags = {:#x}, name = '{}'",
|
||||
fmt::ptr(*addr_in_out), len, prot, flags, name);
|
||||
if (len == 0 || !Common::Is16KBAligned(len)) {
|
||||
LOG_ERROR(Kernel_Vmm, "len is 0 or not 16kb multiple");
|
||||
return ORBIS_KERNEL_ERROR_EINVAL;
|
||||
}
|
||||
|
||||
if (name == nullptr) {
|
||||
LOG_ERROR(Kernel_Vmm, "name is invalid!");
|
||||
return ORBIS_KERNEL_ERROR_EFAULT;
|
||||
}
|
||||
|
||||
if (std::strlen(name) >= ORBIS_KERNEL_MAXIMUM_NAME_LENGTH) {
|
||||
LOG_ERROR(Kernel_Vmm, "name exceeds 32 bytes!");
|
||||
return ORBIS_KERNEL_ERROR_ENAMETOOLONG;
|
||||
}
|
||||
|
||||
VAddr in_addr = reinterpret_cast<VAddr>(*addr_in_out);
|
||||
if (in_addr == 0) {
|
||||
in_addr = 0x880000000;
|
||||
}
|
||||
const auto mem_prot = static_cast<Core::MemoryProt>(prot);
|
||||
const auto map_flags = static_cast<Core::MemoryMapFlags>(flags);
|
||||
auto* memory = Core::Memory::Instance();
|
||||
const auto ret = memory->MapMemory(addr_in_out, in_addr, len, mem_prot, map_flags,
|
||||
Core::VMAType::Stack, name);
|
||||
LOG_INFO(Kernel_Vmm, "out_addr = {}", fmt::ptr(*addr_in_out));
|
||||
return ret;
|
||||
}
|
||||
|
||||
s32 PS4_SYSV_ABI sceKernelQueryMemoryProtection(void* addr, void** start, void** end, u32* prot) {
|
||||
auto* memory = Core::Memory::Instance();
|
||||
return memory->QueryProtection(std::bit_cast<VAddr>(addr), start, end, prot);
|
||||
@ -833,6 +865,7 @@ void RegisterMemory(Core::Loader::SymbolsResolver* sym) {
|
||||
LIB_FUNCTION("PGhQHd-dzv8", "libkernel", 1, "libkernel", sceKernelMmap);
|
||||
LIB_FUNCTION("cQke9UuBQOk", "libkernel", 1, "libkernel", sceKernelMunmap);
|
||||
LIB_FUNCTION("mL8NDH86iQI", "libkernel", 1, "libkernel", sceKernelMapNamedFlexibleMemory);
|
||||
LIB_FUNCTION("kc+LEEIYakc", "libkernel", 1, "libkernel", sceKernelMapNamedSystemFlexibleMemory);
|
||||
LIB_FUNCTION("aNz11fnnzi4", "libkernel", 1, "libkernel", sceKernelAvailableFlexibleMemorySize);
|
||||
LIB_FUNCTION("aNz11fnnzi4", "libkernel_avlfmem", 1, "libkernel",
|
||||
sceKernelAvailableFlexibleMemorySize);
|
||||
|
||||
@ -4,7 +4,7 @@
|
||||
#include <deque>
|
||||
#include <mutex>
|
||||
|
||||
#include "common/config.h"
|
||||
#include "common/logging/log.h"
|
||||
#include "core/emulator_settings.h"
|
||||
#include "core/libraries/error_codes.h"
|
||||
#include "core/libraries/libs.h"
|
||||
|
||||
@ -9,6 +9,7 @@
|
||||
#include "common/config.h"
|
||||
#include "common/path_util.h"
|
||||
#include "common/singleton.h"
|
||||
#include "core/emulator_settings.h"
|
||||
#include "core/file_sys/fs.h"
|
||||
#include "save_backup.h"
|
||||
#include "save_instance.h"
|
||||
@ -71,7 +72,7 @@ fs::path SaveInstance::GetParamSFOPath(const fs::path& dir_path) {
|
||||
|
||||
void SaveInstance::SetupDefaultParamSFO(PSF& param_sfo, std::string dir_name,
|
||||
std::string game_serial) {
|
||||
int locale = Config::GetLanguage();
|
||||
int locale = EmulatorSettings.GetConsoleLanguage();
|
||||
if (!default_title.contains(locale)) {
|
||||
locale = 1; // default to en_US if not found
|
||||
}
|
||||
|
||||
@ -2,7 +2,6 @@
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#include <cstdlib>
|
||||
#include "common/config.h"
|
||||
#include "common/singleton.h"
|
||||
#include "core/emulator_settings.h"
|
||||
#include "core/file_sys/fs.h"
|
||||
|
||||
@ -4,6 +4,7 @@
|
||||
#include "common/config.h"
|
||||
#include "common/logging/log.h"
|
||||
|
||||
#include <queue>
|
||||
#include "core/libraries/libs.h"
|
||||
#include "core/libraries/system/userservice.h"
|
||||
#include "core/libraries/system/userservice_error.h"
|
||||
@ -105,6 +106,13 @@ int PS4_SYSV_ABI sceUserServiceGetDiscPlayerFlag() {
|
||||
return ORBIS_OK;
|
||||
}
|
||||
|
||||
std::queue<OrbisUserServiceEvent> user_service_event_queue = {};
|
||||
|
||||
void AddUserServiceEvent(const OrbisUserServiceEvent e) {
|
||||
LOG_DEBUG(Lib_UserService, "Event added to queue: {} {}", (u8)e.event, e.userId);
|
||||
user_service_event_queue.push(e);
|
||||
}
|
||||
|
||||
s32 PS4_SYSV_ABI sceUserServiceGetEvent(OrbisUserServiceEvent* event) {
|
||||
LOG_TRACE(Lib_UserService, "(DUMMY) called");
|
||||
// fake a loggin event
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project
|
||||
// SPDX-FileCopyrightText: Copyright 2026 shadPS4 Emulator Project
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
// reference :
|
||||
// https://github.com/OpenOrbis/OpenOrbis-PS4-Toolchain/blob/master/include/orbis/_types/user.h
|
||||
@ -57,6 +57,8 @@ struct OrbisUserServiceEvent {
|
||||
OrbisUserServiceUserId userId;
|
||||
};
|
||||
|
||||
void AddUserServiceEvent(const OrbisUserServiceEvent e);
|
||||
|
||||
int PS4_SYSV_ABI sceUserServiceInitializeForShellCore();
|
||||
int PS4_SYSV_ABI sceUserServiceTerminateForShellCore();
|
||||
int PS4_SYSV_ABI sceUserServiceDestroyUser();
|
||||
|
||||
@ -54,17 +54,16 @@ struct EntryParams {
|
||||
};
|
||||
|
||||
struct HeapAPI {
|
||||
PS4_SYSV_ABI void* (*heap_malloc)(size_t);
|
||||
PS4_SYSV_ABI void* (*heap_malloc)(u64);
|
||||
PS4_SYSV_ABI void (*heap_free)(void*);
|
||||
PS4_SYSV_ABI void* (*heap_calloc)(size_t, size_t);
|
||||
PS4_SYSV_ABI void* (*heap_realloc)(void*, size_t);
|
||||
PS4_SYSV_ABI void* (*heap_memalign)(size_t, size_t);
|
||||
PS4_SYSV_ABI int (*heap_posix_memalign)(void**, size_t, size_t);
|
||||
// NOTE: Fields below may be inaccurate
|
||||
PS4_SYSV_ABI int (*heap_reallocalign)(void);
|
||||
PS4_SYSV_ABI void (*heap_malloc_stats)(void);
|
||||
PS4_SYSV_ABI int (*heap_malloc_stats_fast)(void);
|
||||
PS4_SYSV_ABI size_t (*heap_malloc_usable_size)(void*);
|
||||
PS4_SYSV_ABI void* (*heap_calloc)(u64, u64);
|
||||
PS4_SYSV_ABI void* (*heap_realloc)(void*, u64);
|
||||
PS4_SYSV_ABI void* (*heap_memalign)(u64, u64);
|
||||
PS4_SYSV_ABI s32 (*heap_posix_memalign)(void**, u64, u64);
|
||||
PS4_SYSV_ABI s32 (*heap_reallocalign)(void*, u64, u64);
|
||||
PS4_SYSV_ABI s32 (*heap_malloc_stats)(void*);
|
||||
PS4_SYSV_ABI s32 (*heap_malloc_stats_fast)(void*);
|
||||
PS4_SYSV_ABI u64 (*heap_malloc_usable_size)(void*);
|
||||
};
|
||||
|
||||
using AppHeapAPI = HeapAPI*;
|
||||
|
||||
@ -172,6 +172,27 @@ LoggedInUsers UserManager::GetLoggedInUsers() const {
|
||||
return logged_in_users;
|
||||
}
|
||||
|
||||
using namespace Libraries::UserService;
|
||||
|
||||
void UserManager::LoginUser(User* u, s32 player_index) {
|
||||
if (!u) {
|
||||
return;
|
||||
}
|
||||
u->logged_in = true;
|
||||
// u->player_index = player_index;
|
||||
AddUserServiceEvent({OrbisUserServiceEventType::Login, u->user_id});
|
||||
logged_in_users[player_index - 1] = u;
|
||||
}
|
||||
|
||||
void UserManager::LogoutUser(User* u) {
|
||||
if (!u) {
|
||||
return;
|
||||
}
|
||||
u->logged_in = false;
|
||||
AddUserServiceEvent({OrbisUserServiceEventType::Logout, u->user_id});
|
||||
logged_in_users[u->player_index - 1] = {};
|
||||
}
|
||||
|
||||
bool UserManager::Save() const {
|
||||
return UserSettings.Save();
|
||||
}
|
||||
@ -42,6 +42,8 @@ public:
|
||||
void SetControllerPort(u32 user_id, int port);
|
||||
std::vector<User> GetValidUsers() const;
|
||||
LoggedInUsers GetLoggedInUsers() const;
|
||||
void LoginUser(User* u, s32 player_index);
|
||||
void LogoutUser(User* u);
|
||||
|
||||
Users& GetUsers() {
|
||||
return m_users;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user