mirror of
https://git.citron-emu.org/Citron/Citron.git
synced 2025-02-13 12:06:25 +01:00
service/set: improve settings handling and update serial number
- Update default console serial number prefix from "YUZ" to "CIT" - Improve GetSettingsItemValueImpl template implementation: * Add proper buffer management using std::vector * Fix potential buffer overflow issues * Use clearer variable naming * Add proper size handling with actual_size * Use memcpy for safer data copying These changes improve the safety of settings handling while updating the emulator's identity to use the Citron prefix instead of yuzu's.
This commit is contained in:
parent
cc48197448
commit
b89a85e228
2 changed files with 11 additions and 6 deletions
|
@ -939,7 +939,7 @@ Result ISystemSettingsServer::GetBatteryLot(Out<BatteryLot> out_battery_lot) {
|
|||
Result ISystemSettingsServer::GetSerialNumber(Out<SerialNumber> out_console_serial) {
|
||||
LOG_INFO(Service_SET, "called");
|
||||
|
||||
*out_console_serial = {"YUZ10000000001"};
|
||||
*out_console_serial = SerialNumber{"CIT10000000001"};
|
||||
R_SUCCEED();
|
||||
}
|
||||
|
||||
|
|
|
@ -38,11 +38,16 @@ public:
|
|||
const std::string& category, const std::string& name);
|
||||
|
||||
template <typename T>
|
||||
Result GetSettingsItemValueImpl(T& out_value, const std::string& category,
|
||||
const std::string& name) {
|
||||
u64 size{};
|
||||
R_RETURN(GetSettingsItemValueImpl(std::span{reinterpret_cast<u8*>(&out_value), sizeof(T)},
|
||||
size, category, name));
|
||||
Result GetSettingsItemValueImpl(T& output_value, const std::string& category,
|
||||
const std::string& name) {
|
||||
const size_t value_size = sizeof(T);
|
||||
std::vector<u8> raw_data(value_size);
|
||||
u64 actual_size{};
|
||||
|
||||
R_TRY(GetSettingsItemValueImpl(raw_data, actual_size, category, name));
|
||||
std::memcpy(&output_value, raw_data.data(), actual_size);
|
||||
|
||||
R_SUCCEED();
|
||||
}
|
||||
|
||||
public:
|
||||
|
|
Loading…
Reference in a new issue