Applied feedback from @raphaelthegreat

This commit is contained in:
raziel1000 2024-07-25 01:13:14 -06:00 committed by georgemoralis
parent b62836d29f
commit fa76a723ad
6 changed files with 22 additions and 8 deletions

View File

@ -228,7 +228,8 @@ int PS4_SYSV_ABI sceKernelGetDirectMemoryType(u64 addr, int* directMemoryTypeOut
s32 PS4_SYSV_ABI sceKernelBatchMap(OrbisKernelBatchMapEntry* entries, int numEntries, s32 PS4_SYSV_ABI sceKernelBatchMap(OrbisKernelBatchMapEntry* entries, int numEntries,
int* numEntriesOut) { int* numEntriesOut) {
return sceKernelBatchMap2(entries, numEntries, numEntriesOut, 0x10); // 0x10 : Fixed / 0x410 return sceKernelBatchMap2(entries, numEntries, numEntriesOut,
MemoryFlags::SCE_KERNEL_MAP_FIXED); // 0x10, 0x410?
} }
int PS4_SYSV_ABI sceKernelMunmap(void* addr, size_t len); int PS4_SYSV_ABI sceKernelMunmap(void* addr, size_t len);
@ -243,7 +244,7 @@ s32 PS4_SYSV_ABI sceKernelBatchMap2(OrbisKernelBatchMapEntry* entries, int numEn
break; // break and assign a value to numEntriesOut. break; // break and assign a value to numEntriesOut.
} }
if (entries[i].operation == 0) { // MAP_DIRECT if (entries[i].operation == MemoryOpTypes::SCE_KERNEL_MAP_OP_MAP_DIRECT) {
result = sceKernelMapNamedDirectMemory(&entries[i].start, entries[i].length, result = sceKernelMapNamedDirectMemory(&entries[i].start, entries[i].length,
entries[i].protection, flags, entries[i].protection, flags,
static_cast<s64>(entries[i].offset), 0, ""); static_cast<s64>(entries[i].offset), 0, "");

View File

@ -31,6 +31,14 @@ enum MemoryProtection : u32 {
SCE_KERNEL_PROT_GPU_RW = 0x30 // Permit reads/writes from the GPU SCE_KERNEL_PROT_GPU_RW = 0x30 // Permit reads/writes from the GPU
}; };
enum MemoryOpTypes : u32 {
SCE_KERNEL_MAP_OP_MAP_DIRECT = 0,
SCE_KERNEL_MAP_OP_UNMAP = 1,
SCE_KERNEL_MAP_OP_PROTECT = 2,
SCE_KERNEL_MAP_OP_MAP_FLEXIBLE = 3,
SCE_KERNEL_MAP_OP_TYPE_PROTECT = 4
};
struct OrbisQueryInfo { struct OrbisQueryInfo {
uintptr_t start; uintptr_t start;
uintptr_t end; uintptr_t end;

View File

@ -1336,6 +1336,10 @@ int PS4_SYSV_ABI posix_sem_wait(sem_t* sem) {
return sem_wait(sem); return sem_wait(sem);
} }
int PS4_SYSV_ABI posix_sem_timedwait(sem_t* sem, const timespec* t) {
return sem_timedwait(sem, t);
}
int PS4_SYSV_ABI posix_sem_post(sem_t* sem) { int PS4_SYSV_ABI posix_sem_post(sem_t* sem) {
return sem_post(sem); return sem_post(sem);
} }
@ -1543,6 +1547,7 @@ void pthreadSymbolsRegister(Core::Loader::SymbolsResolver* sym) {
LIB_FUNCTION("Xs9hdiD7sAA", "libScePosix", 1, "libkernel", 1, 1, posix_pthread_setschedparam); LIB_FUNCTION("Xs9hdiD7sAA", "libScePosix", 1, "libkernel", 1, 1, posix_pthread_setschedparam);
LIB_FUNCTION("pDuPEf3m4fI", "libScePosix", 1, "libkernel", 1, 1, posix_sem_init); LIB_FUNCTION("pDuPEf3m4fI", "libScePosix", 1, "libkernel", 1, 1, posix_sem_init);
LIB_FUNCTION("YCV5dGGBcCo", "libScePosix", 1, "libkernel", 1, 1, posix_sem_wait); LIB_FUNCTION("YCV5dGGBcCo", "libScePosix", 1, "libkernel", 1, 1, posix_sem_wait);
LIB_FUNCTION("w5IHyvahg-o", "libScePosix", 1, "libkernel", 1, 1, posix_sem_timedwait);
LIB_FUNCTION("IKP8typ0QUk", "libScePosix", 1, "libkernel", 1, 1, posix_sem_post); LIB_FUNCTION("IKP8typ0QUk", "libScePosix", 1, "libkernel", 1, 1, posix_sem_post);
LIB_FUNCTION("cDW233RAwWo", "libScePosix", 1, "libkernel", 1, 1, posix_sem_destroy); LIB_FUNCTION("cDW233RAwWo", "libScePosix", 1, "libkernel", 1, 1, posix_sem_destroy);
LIB_FUNCTION("Bq+LRV-N6Hk", "libScePosix", 1, "libkernel", 1, 1, posix_sem_getvalue); LIB_FUNCTION("Bq+LRV-N6Hk", "libScePosix", 1, "libkernel", 1, 1, posix_sem_getvalue);

View File

@ -95,7 +95,8 @@ void Emulator::Run(const std::filesystem::path& file) {
} }
} }
} }
std::string game_title = id + " - " + title + " <" + app_version + ">"; std::string game_title = fmt::format("{} - {} <{}>", id, title, app_version);
window = window =
std::make_unique<Frontend::WindowSDL>(WindowWidth, WindowHeight, controller, game_title); std::make_unique<Frontend::WindowSDL>(WindowWidth, WindowHeight, controller, game_title);

View File

@ -19,14 +19,14 @@
namespace Frontend { namespace Frontend {
WindowSDL::WindowSDL(s32 width_, s32 height_, Input::GameController* controller_, WindowSDL::WindowSDL(s32 width_, s32 height_, Input::GameController* controller_,
std::string game_title_) std::string_view game_title)
: width{width_}, height{height_}, controller{controller_}, game_title{game_title_} { : width{width_}, height{height_}, controller{controller_}{
if (SDL_Init(SDL_INIT_VIDEO) < 0) { if (SDL_Init(SDL_INIT_VIDEO) < 0) {
UNREACHABLE_MSG("Failed to initialize SDL video subsystem: {}", SDL_GetError()); UNREACHABLE_MSG("Failed to initialize SDL video subsystem: {}", SDL_GetError());
} }
SDL_InitSubSystem(SDL_INIT_AUDIO); SDL_InitSubSystem(SDL_INIT_AUDIO);
const std::string title = "shadPS4 v" + std::string(Common::VERSION) + " | " + game_title; const std::string title = fmt::format("shadPS4 v{} | {}", Common::VERSION, game_title);
SDL_PropertiesID props = SDL_CreateProperties(); SDL_PropertiesID props = SDL_CreateProperties();
SDL_SetStringProperty(props, SDL_PROP_WINDOW_CREATE_TITLE_STRING, title.c_str()); SDL_SetStringProperty(props, SDL_PROP_WINDOW_CREATE_TITLE_STRING, title.c_str());
SDL_SetNumberProperty(props, SDL_PROP_WINDOW_CREATE_X_NUMBER, SDL_WINDOWPOS_CENTERED); SDL_SetNumberProperty(props, SDL_PROP_WINDOW_CREATE_X_NUMBER, SDL_WINDOWPOS_CENTERED);

View File

@ -42,7 +42,7 @@ struct WindowSystemInfo {
class WindowSDL { class WindowSDL {
public: public:
explicit WindowSDL(s32 width, s32 height, Input::GameController* controller, explicit WindowSDL(s32 width, s32 height, Input::GameController* controller,
std::string game_title); std::string_view game_title);
~WindowSDL(); ~WindowSDL();
s32 getWidth() const { s32 getWidth() const {
@ -70,7 +70,6 @@ private:
private: private:
s32 width; s32 width;
s32 height; s32 height;
std::string game_title;
Input::GameController* controller; Input::GameController* controller;
WindowSystemInfo window_info{}; WindowSystemInfo window_info{};
SDL_Window* window{}; SDL_Window* window{};