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

cellRtc: misc. improvements, set to HLE by default #15496

Merged
merged 7 commits into from Apr 27, 2024

Conversation

capriots
Copy link
Contributor

  • Fixed hopefully any inaccuracies that were left
  • Stubbed two syscalls used in cellRtc
  • Simplified a bunch of functions, especially cellRtcTickAddMonths() and cellRtcTickAddYears()
  • Implemented the rest of cellRtcGetCurrentSecureTick()
    • To fix Ghidra's decompilation you need to nop the instructions at 0x3b20 and 0x3b24 (removes the initializers for two variables)
  • Added sanity checks where there are no nullptr checks on LLE
  • Moved constants into header file
  • Removed unused functions
  • Replaced vm::check_addr() with sys_memory_get_page_attribute() everywhere to be more accurate to LLE
  • Set log level to notice everywhere (trace if I found a game where it was being spammed)

}

error_code cellRtcIsLeapYear(s32 year)
{
cellRtc.todo("cellRtcIsLeapYear(year=%d)", year);
cellRtc.notice("cellRtcIsLeapYear(year=%d)", year);
Copy link
Contributor

Choose a reason for hiding this comment

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

just set them all to trace, syscalls are already logged anyways.

@@ -268,10 +268,10 @@ const std::array<std::pair<ppu_intrp_func_t, std::string_view>, 1024> g_ppu_sysc
BIND_SYSC(sys_event_port_connect_ipc), //140 (0x08C)
BIND_SYSC(sys_timer_usleep), //141 (0x08D)
BIND_SYSC(sys_timer_sleep), //142 (0x08E)
NULL_FUNC(sys_time_set_timezone), //143 (0x08F) ROOT
BIND_SYSC(sys_time_set_timezone), //143 (0x08F) ROOT
Copy link
Contributor

Choose a reason for hiding this comment

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

This is a root syscall though, games do not have access to it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

They are used in cellRtc, so I need them defined as a function. Do you want me to add a root check?

Copy link
Contributor

Choose a reason for hiding this comment

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

Yeah

@Megamouse
Copy link
Contributor

I'll review the rtc changes sometime this week.

rpcs3/Emu/Cell/Modules/cellRtc.cpp Outdated Show resolved Hide resolved
Comment on lines 1388 to 1401
if (ret >= CELL_OK)
{
tick->tick += *time * cellRtcGetTickResolution();
}
else if (ret == static_cast<s32>(SYS_SS_RTC_ERROR_UNK))
{
switch (*status)
{
case 1: ret = CELL_RTC_ERROR_NO_CLOCK; break;
case 2: ret = CELL_RTC_ERROR_NOT_INITIALIZED; break;
case 4: ret = CELL_RTC_ERROR_INVALID_VALUE; break;
case 8: ret = CELL_RTC_ERROR_NO_CLOCK; break;
}
}
Copy link
Contributor

Choose a reason for hiding this comment

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

I can't really verify this. maybe my analyser is borked. But whatever...

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Right click the instruction at 0x3b20 > click "Patch Instruction" > type in ori r0,r0,0
Do the same for the next instruction

Copy link
Contributor

Choose a reason for hiding this comment

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

missing default in switch btw

rpcs3/Emu/Cell/Modules/cellRtc.cpp Outdated Show resolved Hide resolved
@Megamouse
Copy link
Contributor

sweaty-sweat

@Megamouse Megamouse merged commit e2402b1 into RPCS3:master Apr 27, 2024
6 checks passed
@capriots capriots deleted the cellRtc branch April 27, 2024 12:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants