Skip to content

Instantly share code, notes, and snippets.

@Calinou
Created January 12, 2023 03:21
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Calinou/8990fd37c3c8dd7c3dfa7503ba10922f to your computer and use it in GitHub Desktop.
Save Calinou/8990fd37c3c8dd7c3dfa7503ba10922f to your computer and use it in GitHub Desktop.
Dirt Rally Linux fix (source: https://news.ycombinator.com/item?id=25818126)
// Source: <https://news.ycombinator.com/item?id=25818126>
//
// Instructions:
// 1. Paste contents of this file to a new file called "game.c" within your home folder.
// 2. Open a terminal, install GCC from distribution repositories and compile this source file: gcc game.c -shared -o game.so
// 3. Move game.so to the same folder as the DirtRally binary (within the bin/ folder, not DirtRally.sh).
// Use Manage > Browse Local Files on Dirt Rally to reach this folder, then enter the bin/ folder.
// 4. Modify Steam launch options: LD_PRELOAD=./game.so %command%
// 5. Run the game on Steam.
#include <sys/mman.h>
#include <unistd.h>
#include <sys/syscall.h>
int mprotect(void *addr, size_t len, int prot) {
if (prot == PROT_EXEC) {
prot |= PROT_READ;
}
return syscall(__NR_mprotect, addr, len, prot);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment