1
0
mirror of https://github.com/RPCS3/rpcs3.git synced 2024-11-22 10:42:36 +01:00

sys_game: Fixed potential bugs in sys_game_get_system_sw_version()

sys_game: Implemented sys_game_set_system_sw_version()
This commit is contained in:
brian218 2023-04-20 20:04:10 +08:00 committed by Ivan
parent 3de0f042c6
commit 98c46f7eb0
3 changed files with 39 additions and 3 deletions

View File

@ -424,7 +424,7 @@ const std::array<std::pair<ppu_intrp_func_t, std::string_view>, 1024> g_ppu_sysc
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_set_system_sw_version), //375 (0x177) 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

View File

@ -1,17 +1,38 @@
#include "stdafx.h"
#include "util/sysinfo.hpp"
#include "util/v128.hpp"
#include "Emu/Cell/lv2/sys_process.h"
#include "Emu/Memory/vm_ptr.h"
#include "Emu/Cell/ErrorCodes.h"
#include "Emu/System.h"
#include "Emu/system_utils.hpp"
#include "Emu/IdManager.h"
#include "Utilities/StrUtil.h"
#include "Utilities/Thread.h"
#include "sys_game.h"
LOG_CHANNEL(sys_game);
struct system_sw_version
{
system_sw_version()
{
f64 version_f = 0;
if (!try_to_float(&version_f, utils::get_firmware_version(), 0, 99.9999))
sys_game.error("Error parsing firmware version");
version = version_f * 10000;
}
system_sw_version(const system_sw_version&) = delete;
system_sw_version& operator=(const system_sw_version&) = delete;
~system_sw_version() = default;
u64 version;
};
struct board_storage
{
public:
@ -46,7 +67,7 @@ public:
board_storage(const board_storage&) = delete;
board_storage& operator =(const board_storage&) = delete;
board_storage& operator=(const board_storage&) = delete;
~board_storage()
{
@ -209,9 +230,23 @@ error_code _sys_game_watchdog_clear()
return CELL_OK;
}
error_code _sys_game_set_system_sw_version(u64 version)
{
sys_game.trace("sys_game_set_system_sw_version(version=%d)", version);
if (!g_ps3_process_info.has_root_perm())
return CELL_EPERM;
g_fxo->get<system_sw_version>().version = version;
return CELL_OK;
}
u64 _sys_game_get_system_sw_version()
{
return stof(utils::get_firmware_version()) * 10000;
sys_game.trace("sys_game_get_system_sw_version()");
return g_fxo->get<system_sw_version>().version;
}
error_code _sys_game_board_storage_read(vm::ptr<u8> buffer, vm::ptr<u8> status)

View File

@ -5,6 +5,7 @@ void abort_lv2_watchdog();
error_code _sys_game_watchdog_start(u32 timeout);
error_code _sys_game_watchdog_stop();
error_code _sys_game_watchdog_clear();
error_code _sys_game_set_system_sw_version(u64 version);
u64 _sys_game_get_system_sw_version();
error_code _sys_game_board_storage_read(vm::ptr<u8> buffer, vm::ptr<u8> status);
error_code _sys_game_board_storage_write(vm::ptr<u8> buffer, vm::ptr<u8> status);