From 49455965c0e2aa9385d78811e29dbe0de1c974e0 Mon Sep 17 00:00:00 2001 From: brian218 Date: Mon, 23 Jan 2023 11:26:43 +0800 Subject: [PATCH] sys_game: Implemented sys_game_get_rtc_status() & Updated sys_game_board_storage_read() --- rpcs3/Emu/Cell/PPUThread.cpp | 1 + rpcs3/Emu/Cell/lv2/lv2.cpp | 10 +++++----- rpcs3/Emu/Cell/lv2/sys_game.cpp | 34 ++++++++++++++++----------------- rpcs3/Emu/Cell/lv2/sys_game.h | 1 + 4 files changed, 24 insertions(+), 22 deletions(-) diff --git a/rpcs3/Emu/Cell/PPUThread.cpp b/rpcs3/Emu/Cell/PPUThread.cpp index bc36fd4b37..5673ab3c8a 100644 --- a/rpcs3/Emu/Cell/PPUThread.cpp +++ b/rpcs3/Emu/Cell/PPUThread.cpp @@ -3350,6 +3350,7 @@ bool ppu_initialize(const ppu_module& info, bool check_only) { "sys_game_watchdog_clear", reinterpret_cast(ppu_execute_syscall) }, { "sys_game_get_system_sw_version", reinterpret_cast(ppu_execute_syscall) }, { "sys_game_board_storage_read", reinterpret_cast(ppu_execute_syscall) }, + { "sys_game_get_rtc_status", reinterpret_cast(ppu_execute_syscall) }, { "__trap", reinterpret_cast(&ppu_trap) }, { "__error", reinterpret_cast(&ppu_error) }, { "__check", reinterpret_cast(&ppu_check) }, diff --git a/rpcs3/Emu/Cell/lv2/lv2.cpp b/rpcs3/Emu/Cell/lv2/lv2.cpp index a07d9df079..698fd3fc07 100644 --- a/rpcs3/Emu/Cell/lv2/lv2.cpp +++ b/rpcs3/Emu/Cell/lv2/lv2.cpp @@ -420,11 +420,11 @@ const std::array, 1024> g_ppu_sysc BIND_SYSC(sys_uart_send), //369 (0x171) ROOT BIND_SYSC(sys_uart_get_params), //370 (0x172) ROOT uns_func, //371 (0x173) UNS - BIND_SYSC(_sys_game_watchdog_start), //372 (0x174) - BIND_SYSC(_sys_game_watchdog_stop), //373 (0x175) - BIND_SYSC(_sys_game_watchdog_clear), //374 (0x176) + BIND_SYSC(_sys_game_watchdog_start), //372 (0x174) + BIND_SYSC(_sys_game_watchdog_stop), //373 (0x175) + BIND_SYSC(_sys_game_watchdog_clear), //374 (0x176) NULL_FUNC(sys_game_set_system_sw_version), //375 (0x177) ROOT - BIND_SYSC(_sys_game_get_system_sw_version), //376 (0x178) ROOT + BIND_SYSC(_sys_game_get_system_sw_version), //376 (0x178) ROOT BIND_SYSC(sys_sm_set_shop_mode), //377 (0x179) ROOT BIND_SYSC(sys_sm_get_ext_event2), //378 (0x17A) ROOT BIND_SYSC(sys_sm_shutdown), //379 (0x17B) ROOT @@ -460,7 +460,7 @@ const std::array, 1024> g_ppu_sysc NULL_FUNC(sys_sm_get_fan_policy), //409 (0x199) PM BIND_SYSC(_sys_game_board_storage_read), //410 (0x19A) NULL_FUNC(sys_game_board_storage_write), //411 (0x19B) - NULL_FUNC(sys_game_get_rtc_status), //412 (0x19C) + BIND_SYSC(_sys_game_get_rtc_status), //412 (0x19C) null_func,//BIND_SYSC(sys_...), //413 (0x19D) ROOT null_func,//BIND_SYSC(sys_...), //414 (0x19E) ROOT null_func,//BIND_SYSC(sys_...), //415 (0x19F) ROOT diff --git a/rpcs3/Emu/Cell/lv2/sys_game.cpp b/rpcs3/Emu/Cell/lv2/sys_game.cpp index 6c898edc68..359ae6f277 100644 --- a/rpcs3/Emu/Cell/lv2/sys_game.cpp +++ b/rpcs3/Emu/Cell/lv2/sys_game.cpp @@ -3,7 +3,6 @@ #include "Emu/Memory/vm_ptr.h" #include "Emu/Cell/ErrorCodes.h" #include "Emu/System.h" -#include "Emu/system_config.h" #include "Emu/IdManager.h" #include "Utilities/Thread.h" @@ -163,26 +162,27 @@ error_code _sys_game_board_storage_read(vm::ptr buffer1, vm::ptr buffer2 { sys_game.trace("sys_game_board_storage_read(buffer1=*0x%x, buffer2=*0x%x)", buffer1, buffer2); - if (!buffer1) + if (!buffer1 || !buffer2) { return CELL_EFAULT; } - be_t psid[2] = { +g_cfg.sys.console_psid_high, +g_cfg.sys.console_psid_low }; - u8* psid_bytes = reinterpret_cast(psid); - u8 response[16] = { 0x01, 0xFC, 0x43, 0x50, 0xA7, 0x9B, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF }; - for (int i = 0; i < 16; i++) - { - response[i] ^= psid_bytes[i]; - } - memcpy(buffer1.get_ptr(), response, 16); - - if (!buffer2) - { - return CELL_EFAULT; - } - - *buffer2 = 0x00; + memset(buffer1.get_ptr(), 0, 16); + *buffer2 = 0; + + return CELL_OK; +} + +error_code _sys_game_get_rtc_status(vm::ptr status) +{ + sys_game.trace("sys_game_get_rtc_status(status=*0x%x)", status); + + if (!status) + { + return CELL_EFAULT; + } + + *status = 0; return CELL_OK; } diff --git a/rpcs3/Emu/Cell/lv2/sys_game.h b/rpcs3/Emu/Cell/lv2/sys_game.h index 9e66e407ba..db6a1f5bc8 100644 --- a/rpcs3/Emu/Cell/lv2/sys_game.h +++ b/rpcs3/Emu/Cell/lv2/sys_game.h @@ -7,3 +7,4 @@ error_code _sys_game_watchdog_stop(); error_code _sys_game_watchdog_clear(); u64 _sys_game_get_system_sw_version(); error_code _sys_game_board_storage_read(vm::ptr buffer1, vm::ptr buffer2); +error_code _sys_game_get_rtc_status(vm::ptr status);