mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-03-29 22:20:48 +00:00
sys_game: Implemented sys_game_board_storage_write() & Made it modifiable
This commit is contained in:
parent
780a6a7b40
commit
53e906d0f3
@ -3350,6 +3350,7 @@ bool ppu_initialize(const ppu_module& info, bool check_only)
|
|||||||
{ "sys_game_watchdog_clear", reinterpret_cast<u64>(ppu_execute_syscall) },
|
{ "sys_game_watchdog_clear", reinterpret_cast<u64>(ppu_execute_syscall) },
|
||||||
{ "sys_game_get_system_sw_version", reinterpret_cast<u64>(ppu_execute_syscall) },
|
{ "sys_game_get_system_sw_version", reinterpret_cast<u64>(ppu_execute_syscall) },
|
||||||
{ "sys_game_board_storage_read", reinterpret_cast<u64>(ppu_execute_syscall) },
|
{ "sys_game_board_storage_read", reinterpret_cast<u64>(ppu_execute_syscall) },
|
||||||
|
{ "sys_game_board_storage_write", reinterpret_cast<u64>(ppu_execute_syscall) },
|
||||||
{ "sys_game_get_rtc_status", reinterpret_cast<u64>(ppu_execute_syscall) },
|
{ "sys_game_get_rtc_status", reinterpret_cast<u64>(ppu_execute_syscall) },
|
||||||
{ "__trap", reinterpret_cast<u64>(&ppu_trap) },
|
{ "__trap", reinterpret_cast<u64>(&ppu_trap) },
|
||||||
{ "__error", reinterpret_cast<u64>(&ppu_error) },
|
{ "__error", reinterpret_cast<u64>(&ppu_error) },
|
||||||
|
@ -459,7 +459,7 @@ const std::array<std::pair<ppu_intrp_func_t, std::string_view>, 1024> g_ppu_sysc
|
|||||||
NULL_FUNC(sys_sm_get_tzpb), //408 (0x198) PM
|
NULL_FUNC(sys_sm_get_tzpb), //408 (0x198) PM
|
||||||
NULL_FUNC(sys_sm_get_fan_policy), //409 (0x199) PM
|
NULL_FUNC(sys_sm_get_fan_policy), //409 (0x199) PM
|
||||||
BIND_SYSC(_sys_game_board_storage_read), //410 (0x19A)
|
BIND_SYSC(_sys_game_board_storage_read), //410 (0x19A)
|
||||||
NULL_FUNC(sys_game_board_storage_write), //411 (0x19B)
|
BIND_SYSC(_sys_game_board_storage_write), //411 (0x19B)
|
||||||
BIND_SYSC(_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_...), //413 (0x19D) ROOT
|
||||||
null_func,//BIND_SYSC(sys_...), //414 (0x19E) ROOT
|
null_func,//BIND_SYSC(sys_...), //414 (0x19E) ROOT
|
||||||
|
@ -1,9 +1,10 @@
|
|||||||
#include "stdafx.h"
|
#include "stdafx.h"
|
||||||
#include "util/sysinfo.hpp"
|
#include "util/sysinfo.hpp"
|
||||||
|
#include "util/v128.hpp"
|
||||||
#include "Emu/Memory/vm_ptr.h"
|
#include "Emu/Memory/vm_ptr.h"
|
||||||
#include "Emu/Cell/ErrorCodes.h"
|
#include "Emu/Cell/ErrorCodes.h"
|
||||||
#include "Emu/System.h"
|
#include "Emu/System.h"
|
||||||
|
#include "Emu/system_utils.hpp"
|
||||||
#include "Emu/IdManager.h"
|
#include "Emu/IdManager.h"
|
||||||
#include "Utilities/Thread.h"
|
#include "Utilities/Thread.h"
|
||||||
|
|
||||||
@ -11,6 +12,62 @@
|
|||||||
|
|
||||||
LOG_CHANNEL(sys_game);
|
LOG_CHANNEL(sys_game);
|
||||||
|
|
||||||
|
struct board_storage
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
bool read(u8* buffer)
|
||||||
|
{
|
||||||
|
if (!buffer)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
const auto data = storage.load();
|
||||||
|
memcpy(buffer, &data, size);
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool write(u8* buffer)
|
||||||
|
{
|
||||||
|
if (!buffer)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
storage.store(read_from_ptr<be_t<v128>>(buffer));
|
||||||
|
written = true;
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
board_storage()
|
||||||
|
{
|
||||||
|
if (fs::file file; file.open(file_path, fs::read))
|
||||||
|
file.read(&storage.raw(), size);
|
||||||
|
else
|
||||||
|
memset(&storage.raw(), 0, size);
|
||||||
|
}
|
||||||
|
|
||||||
|
board_storage(const board_storage&) = delete;
|
||||||
|
|
||||||
|
board_storage& operator =(const board_storage&) = delete;
|
||||||
|
|
||||||
|
~board_storage()
|
||||||
|
{
|
||||||
|
if (written)
|
||||||
|
{
|
||||||
|
if (fs::file file; file.open(file_path, fs::create + fs::write + fs::lock))
|
||||||
|
{
|
||||||
|
file.write(&storage.raw(), size);
|
||||||
|
file.trunc(size);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
atomic_be_t<v128> storage;
|
||||||
|
bool written = false;
|
||||||
|
const std::string file_path = rpcs3::utils::get_hdd1_dir() + "/caches/board_storage.bin";
|
||||||
|
static constexpr size_t size = sizeof(v128);
|
||||||
|
};
|
||||||
|
|
||||||
struct watchdog_t
|
struct watchdog_t
|
||||||
{
|
{
|
||||||
struct alignas(8) control_t
|
struct alignas(8) control_t
|
||||||
@ -167,8 +224,21 @@ error_code _sys_game_board_storage_read(vm::ptr<u8> buffer1, vm::ptr<u8> buffer2
|
|||||||
return CELL_EFAULT;
|
return CELL_EFAULT;
|
||||||
}
|
}
|
||||||
|
|
||||||
memset(buffer1.get_ptr(), 0, 16);
|
*buffer2 = g_fxo->get<board_storage>().read(buffer1.get_ptr()) ? 0x00 : 0xFF;
|
||||||
*buffer2 = 0;
|
|
||||||
|
return CELL_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
error_code _sys_game_board_storage_write(vm::ptr<u8> buffer1, vm::ptr<u8> buffer2)
|
||||||
|
{
|
||||||
|
sys_game.trace("sys_game_board_storage_write(buffer1=*0x%x, buffer2=*0x%x)", buffer1, buffer2);
|
||||||
|
|
||||||
|
if (!buffer1 || !buffer2)
|
||||||
|
{
|
||||||
|
return CELL_EFAULT;
|
||||||
|
}
|
||||||
|
|
||||||
|
*buffer2 = g_fxo->get<board_storage>().write(buffer1.get_ptr()) ? 0x00 : 0xFF;
|
||||||
|
|
||||||
return CELL_OK;
|
return CELL_OK;
|
||||||
}
|
}
|
||||||
|
@ -7,4 +7,5 @@ error_code _sys_game_watchdog_stop();
|
|||||||
error_code _sys_game_watchdog_clear();
|
error_code _sys_game_watchdog_clear();
|
||||||
u64 _sys_game_get_system_sw_version();
|
u64 _sys_game_get_system_sw_version();
|
||||||
error_code _sys_game_board_storage_read(vm::ptr<u8> buffer1, vm::ptr<u8> buffer2);
|
error_code _sys_game_board_storage_read(vm::ptr<u8> buffer1, vm::ptr<u8> buffer2);
|
||||||
|
error_code _sys_game_board_storage_write(vm::ptr<u8> buffer1, vm::ptr<u8> buffer2);
|
||||||
error_code _sys_game_get_rtc_status(vm::ptr<s32> status);
|
error_code _sys_game_get_rtc_status(vm::ptr<s32> status);
|
||||||
|
@ -181,8 +181,7 @@ error_code sys_ss_appliance_info_manager(u32 code, vm::ptr<u8> buffer)
|
|||||||
{
|
{
|
||||||
// AIM_get_open_ps_id
|
// AIM_get_open_ps_id
|
||||||
be_t<u64> psid[2] = { +g_cfg.sys.console_psid_high, +g_cfg.sys.console_psid_low };
|
be_t<u64> psid[2] = { +g_cfg.sys.console_psid_high, +g_cfg.sys.console_psid_low };
|
||||||
u8* psid_bytes = reinterpret_cast<u8*>(psid);
|
std::memcpy(buffer.get_ptr(), psid, 16);
|
||||||
std::memcpy(buffer.get_ptr(), psid_bytes, 16);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 0x19006:
|
case 0x19006:
|
||||||
|
@ -140,7 +140,6 @@ void usb_device_usio::save_backup()
|
|||||||
|
|
||||||
const u64 file_size = g_fxo->get<usio_memory>().backup_memory.size();
|
const u64 file_size = g_fxo->get<usio_memory>().backup_memory.size();
|
||||||
|
|
||||||
usio_backup_file.seek(0, fs::seek_set);
|
|
||||||
usio_backup_file.write(g_fxo->get<usio_memory>().backup_memory.data(), file_size);
|
usio_backup_file.write(g_fxo->get<usio_memory>().backup_memory.data(), file_size);
|
||||||
usio_backup_file.trunc(file_size);
|
usio_backup_file.trunc(file_size);
|
||||||
}
|
}
|
||||||
|
@ -285,9 +285,8 @@ struct cfg_root : cfg::node
|
|||||||
cfg::_enum<CellKbMappingType> keyboard_type{ this, "Keyboard Type", CellKbMappingType{0} }; // CELL_KB_MAPPING_101 = US
|
cfg::_enum<CellKbMappingType> keyboard_type{ this, "Keyboard Type", CellKbMappingType{0} }; // CELL_KB_MAPPING_101 = US
|
||||||
cfg::_enum<enter_button_assign> enter_button_assignment{ this, "Enter button assignment", enter_button_assign::cross };
|
cfg::_enum<enter_button_assign> enter_button_assignment{ this, "Enter button assignment", enter_button_assign::cross };
|
||||||
cfg::_int<-60*60*24*365*100LL, 60*60*24*365*100LL> console_time_offset{ this, "Console time offset (s)", 0 }; // console time offset, limited to +/-100years
|
cfg::_int<-60*60*24*365*100LL, 60*60*24*365*100LL> console_time_offset{ this, "Console time offset (s)", 0 }; // console time offset, limited to +/-100years
|
||||||
cfg::uint<0,umax> console_psid_high{ this, "PSID high"};
|
cfg::uint<0, umax> console_psid_high{this, "PSID high"};
|
||||||
cfg::uint<0,umax> console_psid_low{ this, "PSID low"};
|
cfg::uint<0, umax> console_psid_low{this, "PSID low"};
|
||||||
|
|
||||||
} sys{ this };
|
} sys{ this };
|
||||||
|
|
||||||
struct node_net : cfg::node
|
struct node_net : cfg::node
|
||||||
|
Loading…
x
Reference in New Issue
Block a user