Low power usage 1.25.13

Eidolon

Member
Hey everyone, back with another quality of life tweak.

This is a modified 1.25.13 PsoBB.exe which has fairly reduced CPU usage. It's a cheap hack that simply calls into kernel32 Sleep for 0x10 milliseconds just after Device Clear has been called on d3d8. The idea is that it will reduce CPU usage enough that your laptop's battery life won't burn away too quickly while running. I found this to be particularly annoying while developing my server on my Macbook Air.

Download here. This is based on the 1.25.13 Tethealla Localhost binary.

I don't know if it will work on Ephinea server, though I did apply the in-memory code patches using x64dbg on the Ephinea binary and it worked just as well. The Ephinea binary is compressed so it's not possible to apply the same tweak to the EXE directly, and I only did this for server development purposes.

If you want to debug and change the delay time, search for 90 90 90 83 E0 FE A3 C0 96 AD E8 DA BA F6 FF A1 28 D5 AC 50 8B 10 FF.

EDIT: typoed 1.24, meant 1.25
 

Soly

Member
Re: Low power usage 1.24.13

In fact, it won't work on any server unless the patch is applied "on the fly", because the encryption, IPs (you can change that) and whatever else people have done to their own clients wont match.
Doesn't Teth use a newer version tho? ... might want to ask Soda if something could break using and older version... Or just apply the stuff to the newest version... (Or did you typo 12513?)
 

Eidolon

Member
Re: Low power usage 1.24.13

Soly said:
Doesn't Teth use a newer version tho? ... might want to ask Soda if something could break using and older version... Or just apply the stuff to the newest version... (Or did you typo 12513?)

I typoed 1.25.13.

After restarting my computer, it's no longer working. I'll investigate it more in a bit.
 

Eidolon

Member
Honestly this hack won't help much for lower end machines due to the way PSO handles its update loop. It will take some more reverse engineering to fully document the render loop and let it compensate correctly with a high precision timer.
 

Aleron Ives

Member
Eidolon said:
It will take some more reverse engineering to fully document the render loop and let it compensate correctly with a high precision timer.
It's possible that you might learn something about how to safely throttle the game by examining PSO PC, since Sega coded that port to not use 100% CPU.
 

qwerty

Member
i like this idea
but i don't want to binary patch client's exe
so i use api hooking to force client to call my detoured functions instead of original ones
on my 4 processors machine (dual core with hyper threading in fact)
the cpu usage is reduced to 2%~8%
it varies depending on which area the player is in

though this hack does have some drawbacks:
* psobb takes much longer to startup, this can be easily fixed
* mag feeding interval is around 3'40" in this case (Sleep and SleepEx are delayed by 2ms) according to my test
* S/D/J/Z and other status timers may slow down, and cause desync
 

Aleron Ives

Member
Yes, PSO uses your system clock to count the number of seconds that have passed since midnight on January 1, 1970 (Unix time). Console versions use the system clock for this purpose as well, but it is only used to set the Internet Time in offline mode. The server transmits the current .beat time in online mode for all versions to keep all clients synchronised.
 

Soly

Member
Was going to check this, but the exe crashes...

Found there are 2 parts where you changed the binary, if I change the first part back to the original it runs fine but with no cpu usage reduction
Also, in the (binary) string you pasted on the first post (90 90 90 83 E0 FE A3 C0 96 AD E8 DA BA F6 FF A1 28 D5 AC 50 8B 10 FF)
The file has only this (83 E0 FE A3 C0 96 AD E8 DA BA F6 FF A1 28 D5 AC 50 8B 10 FF) aka missing the first 3 NOPs
 
Top