GithubHelp home page GithubHelp logo

dkhachatrian / libspeedhack Goto Github PK

View Code? Open in Web Editor NEW

This project forked from evg-zhabotinsky/libspeedhack

8.0 1.0 0.0 6 KB

A simple dynamic library to slowdown or speedup games on Linux

License: MIT License

Makefile 4.91% C++ 90.11% Shell 4.98%

libspeedhack's Introduction

libSPEEDHACK

A simple dynamic library to slowdown or speedup games on Linux

https://github.com/evg-zhabotinsky/libspeedhack

https://github.com/evg-zhabotinsky/libspeedhack/releases/

The main purpose of this rather simple library is to change speed at which games run, for example, to make fights easier by slowing everything down and giving yourself more time to react, or to get from point A to point B faster in real time terms by speeding game up.

Think of it as CheatEngine's speedhack feature, but one that works on Linux. I have written this to make Undertale less impossible for me to win. ๐Ÿ˜„

It might have other uses, but I can't think of any just yet. Apart from faking benchmark scores, of course. ๐Ÿ˜„

How to build

Just run make. Or run make 32bit and/or make 64bit. Read the Makefile if curious.

How to use

If you simply ran make and didn't do anything fancy, this should work:

libspeedhack_directory/speedhack path/to/executable [args]

Example with glxgears and this repo in home directory:

~/libspeedhack/speedhack glxgears

To control speed, write floating point speedup multiplier into /tmp/speedhack_pipe. Example:

echo 0.5 >/tmp/speedhack_pipe  # 2x slowdown

Try to keep numbers short, or things might break.

To make it more practical, bind those echos to keyboard shortcuts. (Those are likely somewhere like control panel > keyboard > shortcuts) Like Win + 890-= for multipliers .25, .5, 1, 2 and 4.

All this should work with Steam games too, if you wonder. Just open launch options from game properties and put this there:

$HOME/libspeedhack/speedhack %command%

Don't forget to substiture real path to speedhack.

How it works

Libspeedhack consists of 2 parts: the library itself and a wrapper script to make using it easier.

Library itself, libspeedhack.so, implements wrappers around various standard functions that applications use to get timing information. It uses dlsym() to get pointers to the real functions from system libraries, calls these functions, and corrects timing values reported by them.

To make use of these wrappers, libspeedhack.so must be loaded into process using LD_PRELOAD, like this:

LD_PRELOAD="libspeedhack.so:$LD_PRELOAD" glxgears

Controlling how slow or fast things are is done by writing floating point multiplier into control fifo, which is currently hardcoded to /tmp/speedhack_pipe. It's kinda ugly as of now, use numbers as short as possible or else things might break. Or just fix how the lib reads them.

Wrapper script speedhack just creates control pipe if it does not exist yet and fills in LD_LIBRARY_PATH and LD_PRELOAD for library to work. Library directories lib32 and lib64 must reside in the same directory as wrapper script for it to be used as is.

libspeedhack's People

Contributors

evg-zhabotinsky avatar

Stargazers

Khalid Kanaan avatar Vinit Pandit avatar Mr.HyperBit avatar kain avatar dmytro lysak avatar mekb avatar Julian Stefanovic avatar  avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.