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

[WIP] Multithreading fixes #152

Merged
merged 15 commits into from
Aug 2, 2023
Merged

[WIP] Multithreading fixes #152

merged 15 commits into from
Aug 2, 2023

Conversation

wheremyfoodat
Copy link
Owner

@wheremyfoodat wheremyfoodat commented Jul 28, 2023

Various changes to the thread scheduler. Fixes or improves a bunch of games including the following

  • Captain Toad Treasure Tracker
  • Sonic Boom something about Crystals
  • Fire Emblem Awakening (probably Fates too)
  • Rhythm Heaven Megamix (USA only)
  • Bust-A-Move Universe
  • Nintendogs
  • Probably a lot more

This is still WIP and won't be merged until all regressions are fixed and some stubborn games are fixed

Partially covers #124

@@ -48,7 +48,7 @@ bool Kernel::signalEvent(Handle handle) {
// We must reschedule our threads if we signalled one. Some games such as FE: Awakening rely on this
// If this does not happen, we can have phenomena such as a thread waiting up a higher priority thread,
// and the higher priority thread just never running
rescheduleThreads();
requireReschedule();
Copy link
Owner Author

Choose a reason for hiding this comment

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

I am not sure if this should happen.
Also need to investigate how OneShot events work a bit better

@@ -121,7 +121,6 @@ void Kernel::waitSynchronization1() {
if (!shouldWaitOnObject(object)) {
acquireSyncObject(object, threads[currentThreadIndex]); // Acquire the object since it's ready
regs[0] = Result::Success;
rescheduleThreads();
Copy link
Owner Author

Choose a reason for hiding this comment

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

This may or may not need to request a reschedule, still

if (!waitAll) {
// If there's ready objects, acquire the first one and return
if (oneObjectReady) {
regs[0] = Result::Success;
regs[1] = firstReadyObjectIndex; // Return index of the acquired object
acquireSyncObject(waitObjects[firstReadyObjectIndex].second, t); // Acquire object
rescheduleThreads();
Copy link
Owner Author

Choose a reason for hiding this comment

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

Ditto from WaitSync1

@wheremyfoodat
Copy link
Owner Author

Note: some of the games above need my local "Sleep thread on SendSyncRequest" as well

@wheremyfoodat wheremyfoodat force-pushed the panda-kith branch 2 times, most recently from 2ae08e3 to 57c3224 Compare August 1, 2023 23:27
@wheremyfoodat wheremyfoodat merged commit 1e7078c into master Aug 2, 2023
@wheremyfoodat
Copy link
Owner Author

(This code will likely be revisited soon but might as well merge it)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant