Cxbx-reloaded: Improve Fiber Support

Created on 12 Mar 2017  路  8Comments  路  Source: Cxbx-Reloaded/Cxbx-Reloaded

Our current method of implementing Fibers is very poor.

Rather than switch to a specific requested fiber, when a title calls SwitchToFiber, we currently run ALL registered fibers, then reset the fiber counter to 0.

The 'right' way would be to remove our Fiber patches and let the Kernel handle it, but this is not possible until we implement our own thread context switching rather than relying on Windows, until then, we require patches.

These patches need to be modified to perform closer to the Xbox implementation.

All 8 comments

I'm working on this as part of my attempts to fix Futurama

This might fix issue #212

It still needs testing with other titles, but Fibers in Futurama are now being created and executed without and XAPI patches to Fiber functions (in my latest Futurama branch)

Cool! I'm curious to how you're been able to detect they work like they're supposed to?

I set code breakpoints around the unpatched switchtofiber function

I've been thinking about something that could ease our debugging adventures, if we could enable a logging detour for all detected but unpatched functions. I've seen genetic kernel API code by jayfoxrox for this somewhere.

EDIT : Found it again; https://github.com/JayFoxRox/Chihiro-Launcher/blob/master/hook.h#L1341

Fibers have been confirmed working unpatched, this issue can be closed.

Great stuff!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

PatrickvL picture PatrickvL  路  3Comments

PatrickvL picture PatrickvL  路  3Comments

gandalfthewhite19890404 picture gandalfthewhite19890404  路  3Comments

LukeUsher picture LukeUsher  路  4Comments

jackchentwkh picture jackchentwkh  路  3Comments