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

What does Sleepless Window thread actually do and how is it implemented? #45

Closed
Aetopia opened this issue Dec 31, 2022 · 2 comments
Closed

Comments

@Aetopia
Copy link

Aetopia commented Dec 31, 2022

Reference:

const bool sleepless_window = config.render.framerate.sleepless_window;

As the name of the option, suggests it makes the Window Thread sleepless but in what sense? Additionally how is it implemented?

@Aemony
Copy link
Member

Aemony commented Dec 31, 2022

Same way the CPU core spoofing was implemented — it detours some standard Win32 API calls and implements custom code/checks that manipulates the input (that being the game’s originally coded sleep duration) and executes Special K’s custom duration instead.

Any game that implements sleeping using the detoured API calls will end up running SK’s code instead, which allows us to skip the sleep call entirely or adjust it to our own liking.

@Kaldaien
Copy link
Member

It replaces Sleep (...) calls on window threads with a wait function (MsgWaitForMultipleObjects (...)) that will wake up when there's a waiting message on the queue.

@Aemony Aemony closed this as completed Jan 3, 2023
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

No branches or pull requests

3 participants