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

sys_game: Implemented sys_game_get_rtc_status() & Updated sys_game_board_storage_read() #13268

Merged
merged 3 commits into from
Jan 26, 2023

Conversation

brian218
Copy link
Contributor

@brian218 brian218 commented Jan 21, 2023

After looking into a number of System 357 games' decompilation, I figured out that the buffer status is supposed be set to all 0 by sys_game_get_rtc_status() if the RTC is successfully checked (required by Dark Escape 4D).

Also, with more System 357 games being discovered, I figured out that sys_game_board_storage_read() should always give buffer1 all 0, and players are responsible for setting a correct PSID in the emulator configuration on a game basis in order to play System 357 games.

@elad335
Copy link
Contributor

elad335 commented Jan 21, 2023

I want to sleep, I gave you the LV2 disassembly in the past.

@brian218
Copy link
Contributor Author

I want to sleep, I gave you the LV2 disassembly in the past.

Good night, bro!
Image
Though it seems weird as I was unable to locate sys_game_get_rtc_status.

@clienthax
Copy link
Contributor

I want to sleep, I gave you the LV2 disassembly in the past.

Good night, bro! Image Though it seems weird as I was unable to locate sys_game_get_rtc_status.

Some syscalls might be referred to by their number or outright missing depending on the lv2 kernel

@isJuhn
Copy link
Contributor

isJuhn commented Jan 21, 2023

This syscall doesn't exist in CEX kernel. Looks like it's simply copying 4 bytes unless copy_to_user has some alignment memes going on?
image

@brian218
Copy link
Contributor Author

This syscall doesn't exist in CEX kernel. Looks like it's simply copying 4 bytes unless copy_to_user has some alignment memes going on? image

Interesting.
Ghidra indicates the passed buffer is undefined auStack16 [16];
Image

@elad335
Copy link
Contributor

elad335 commented Jan 22, 2023

If you had counted only on ghidra that parameter would be deemed unused, ghidra is not always trustworthy.

@brian218
Copy link
Contributor Author

If you had counted only on ghidra that parameter would be deemed unused, ghidra is not always trustworthy.

Alright, noted that.

@brian218
Copy link
Contributor Author

Okay, I've confirmed that the buffer status of sys_game_get_rtc_status() is a pointer to a s32, and that the initial value passed by the game is -1.

@kd-11 kd-11 requested review from Megamouse and RipleyTom January 25, 2023 21:33
@RipleyTom
Copy link
Contributor

RipleyTom commented Jan 26, 2023

I'm really not a big fan of having a thread at 100% usage, the sleep is only 200us. If it is not rescheduled in time the system is probably already overwhelmed. So yes it will reduce latency on an overwhelmed system but it will reduce perf in all games that use usb devices for really no reason.

I personally tried Taiko and didn't notice any lag from input with that 200us sleep.

The current sleep is obviously not ideal but removing the sleep really isn't either.
Please at least put a std::this_thread::yield(); in there.

@brian218
Copy link
Contributor Author

I'm really not a big fan of having a thread at 100% usage, the sleep is only 200us. If it is not rescheduled in time the system is probably already overwhelmed. So yes it will reduce latency on an overwhelmed system but it will reduce perf in all games that use usb devices for really no reason.

I personally tried Taiko and didn't notice any lag from input with that 200us sleep.

The current sleep is obviously not ideal but removing the sleep really isn't either. Please at least put a std::this_thread::yield(); in there.

Thank you for your suggestion.
I've added std::this_thread::yield();

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.

7 participants