Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add the ability to set the PSID from the configuration #12637

Merged
merged 2 commits into from
Sep 12, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
19 changes: 15 additions & 4 deletions rpcs3/Emu/Cell/lv2/sys_ss.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,11 @@
#include "sys_ss.h"

#include "sys_process.h"
#include "Utilities/StrUtil.h"
#include "Emu/IdManager.h"
#include "Emu/Cell/PPUThread.h"
#include "Emu/Cell/timers.hpp"
#include "Emu/system_config.h"

#ifdef _WIN32
#include <Windows.h>
Expand Down Expand Up @@ -135,11 +137,20 @@ s32 sys_ss_get_console_id(vm::ptr<u8> buf)

s32 sys_ss_get_open_psid(vm::ptr<CellSsOpenPSID> psid)
{
u64 phigh, plow;
sys_ss.warning("sys_ss_get_open_psid(psid=*0x%x)", psid);

psid->high = 0;
psid->low = 0;

if (try_to_uint64(&phigh, g_cfg.sys.console_psid_high.to_string(), 0, umax) &&
try_to_uint64(&plow, g_cfg.sys.console_psid_low.to_string(), 0, umax))
{
psid->high = phigh;
psid->low = plow;
}
else
{
psid->high = 0;
psid->low = 0;
}
return CELL_OK;
}

Expand Down Expand Up @@ -335,4 +346,4 @@ error_code sys_ss_individual_info_manager(u64 pkg_id, u64 a2, vm::ptr<u64> out_s
}

return CELL_OK;
}
}
3 changes: 2 additions & 1 deletion rpcs3/Emu/system_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,8 @@ struct cfg_root : cfg::node
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::_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::string console_psid_high{ this, "PSID high", "0x0"};
cfg::string console_psid_low{ this, "PSID low", "0x0"};
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why use string instead of integer?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you have examples of it above.

Copy link
Contributor Author

@kigyui kigyui Sep 11, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just as thought that would make it easier for a gui string box (and so it gets saved as a hex string too rather than getting converted to dec)

Copy link
Contributor

@elad335 elad335 Sep 11, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe but the additional logic for it there is acceptable because the builtin error checking for values and improved usage performance in actual execution (in case the syscall is spammed) are more important.

Copy link
Contributor

@elad335 elad335 Sep 11, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(and so it gets saved as a hex string too rather than getting converted to dec)

Integer settings allow hex values, even negative hex. I think what's missing is default hex saving entry type, but that can be implemented later when GUI for it is implemented.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On second thought it doesn't really matter for GUI either and is a very specific QoL feature for manual config file reading which can be implemented at any time and for other settings as well.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

well that makes it every easier (and i see saving the config file doesn't alter unchanged settings anyway)

} sys{ this };

struct node_net : cfg::node
Expand Down