Giter Site home page Giter Site logo

gm8x_fix's Introduction

gm8x_fix

gm8x_fix is a patcher that fixes certain issues in games made with GameMaker 7.0, 8.0, and 8.1. You can download the latest release from the Releases tab.

How do I use it?

Drag the executable file for your game onto gm8x_fix.exe. Or, if you're a commandline nerd, you can run it with:

gm8x_fix [options] FILE

Available options include:

  • -s Remove commandline output and apply any available patches.
  • -nb Disable the automatic backup. Please back up manually if you use this.
  • -ni Don't offer input lag patch.
  • -nj Don't offer joystick patch.
  • -ns Don't offer scheduler patch.
  • -nm Don't offer memory patch.
  • -nd Don't offer DirectPlay patch.

If you're automating patching, take note that the program will exit with code 1 on failure.

For building, you can just build the C file with your favourite compiler, it doesn't have any dependencies.

gm8x_fix currently supports games made in the following versions of GameMaker:

  • 7.0
  • 8.0
  • 8.1.65
  • 8.1.71
  • 8.1.91
  • 8.1.135
  • 8.1.140
  • 8.1.141

The issues this fixes, and how it fixes them

The input lag patch

When running a game, GameMaker 8 runs the game code, waits for the next frame to start, and then puts the image on the screen. This adds a frame of input lag. Studio and later swap the waiting and putting the image on the screen. The input lag patch changes it to act more like Studio: run the game code, then put the frame on the screen immediately before waiting for the next frame.

The joystick patch

Early versions of GameMaker have a terrible implementation of joystick support, which can cause games to slow down if joysticks are installed but not plugged in. This slowdown exists on games that don't use the joystick functions, but is much worse on games that do. This occurs because every frame, it polls the first two joysticks even if they aren't connected, and polling joysticks that aren't connected causes a massive search through the registry, which takes up a lot of time.
This patch replaces literally every call to the joystick API with some code that pretends there are no joysticks connected. Basically, it completely disables joystick support.

The scheduler patch

Between frames, GameMaker calls Sleep in order to limit the framerate. Unfortunately, this function isn't very precise, which means games can sleep for longer than they were intended to, which may lead to sluggish or inconsistent framerates on some computers. There is a function called timeBeginPeriod which allows us to make the function more precise, but GameMaker doesn't use it out of the box. This patch invokes that function at game start and improves the precision. The patch overwrites the import for one of the joystick functions, so using the scheduler patch without the joystick patch may cause issues.

Here's a YouTube video with a more detailed explanation.

This fix also exists as a DLL hack for GameMaker 8.1 and up (no 8.0, sorry). This includes GameMaker:Studio. Click here for more information on gms_scheduler_fix.

The memory patch

Some games also run into issues on some newer computers where the game crashes on startup with the message "Unexpected error occured when running the game" or "Out of memory".
This can, on some games, be fixed by enabling the flag in the header that tells the OS the program can understand addresses bigger than 2GB. Shoutouts to these guys for finding that.

The display reset patch

In all GameMaker 8.1.141 games, when the game loses its Direct3D handle (for example, through the computer being locked), without any surfaces having been created, the game will lock up. This patch makes it behave the same as if you had created and deleted a surface: it will try to get a new handle, then if that fails, wait for five seconds and try again, and if that fails it will close. This issue only affects specifically 8.1.141.

The DirectPlay patch

GameMaker games use DirectPlay for networking, but loading the DirectPlay DLL on newer versions of Windows brings up a prompt because DirectPlay is deprecated. In fact, on newer versions of Windows, it just doesn't work at all.
The patch replaces the attempt to load DirectPlay with an attempt to load literally nothing. This somehow doesn't break anything unless you're using the networking functions.

So what's the catch?

If the game used the builtin joystick functions, it will no longer work with joysticks if you apply the joystick patch. Some games use an external library like joydll or the newer gm82joy for joystick support. Those will work fine.

The scheduler patch overwrites some debug logging, but that shouldn't cause any issues.

I've heard reports of the input lag patch making the framepacing less consistent. See how it feels, and decide for yourself which you prefer.

The DirectPlay patch will break GameMaker's built-in networking. Any calls to the networking functions will probably trigger an access violation. If this causes problems outside of multiplayer modes in any games, open an issue and I'll make a less janky solution.

gm8x_fix's People

Contributors

skyfloogle avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Forkers

gm-archive

gm8x_fix's Issues

Patch fixups in the relocation table

At the moment, the patch does not do this, since it is assumed that GM will never be loaded to an address other than the base one. However, for the accuracy of the patch, this should still be done.

It should be also checked whether the current fixups overwrite the patched code on runner loading.

Fix GM 8.1 bug with `get_function_address()` segfault on scripts and extension functions

If you call get_function_address() with the name of a function from a dynamic library included by a GEX extension or a script (including ones from extensions), then at best, 0 or a garbage value may be returned, and at worst, an Access Violation error may occur.

The preferred fix for the get_function_address() is to simply return -1 in these cases, as it does for non-existent names.

Option to remove broken function names from the lookup table

It would be nice to have option to remove names of broken functions from the lookup table to make game literally uncompilable if it uses them. This will help not only to debug them but also to show much more production-ready error messages, especially in case of dynamic code execution (execute_string() etc).

For example, with DirectPlay patch it will remove mplay_* functions, and with scheduler patch it will remove functions that depend on the changed DLL import. Maybe it also should remove joystick_* functions as well with joystick patch.

Please note that for Delphi strings it's not enough to set first string byte to '\0', but the Pascal string header should be edited too. Or, if they're being added at run-time on initialization, we could just NOP these calls.

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.