1
0
Fork 0
mirror of https://github.com/TerryCavanagh/VVVVVV.git synced 2024-09-28 01:07:23 +02:00

Add magic string to the start of the game global

The `-addresses` command-line option added in 64be99d4 helps
autosplitters on platforms where VVVVVV is not built as a
position-independent executable. macOS has made it increasingly
difficult, or impossible, to build binaries without PIE.

Adding an obvious string to search for will help tools that need to deal
with versions of VVVVVV built with PIE. The bytestring to search for is
`[vVvVvV]game`, followed by four null bytes (to avoid finding it in the
program code section). This identifies the beginning of the game object;
addresses to other objects can be figured out by relative offsets
printed by `-addresses`, since ASLR can only change where the globals
begin.

Partially fixes #928; it may still be advisable to figure out how to
explicitly disable PIE on Windows/Linux.
This commit is contained in:
iliana etaoin 2023-02-21 12:09:43 -08:00 committed by Misa Elizabeth Kai
parent 2201cfe1e9
commit 5d719d3e90
2 changed files with 4 additions and 0 deletions

View file

@ -158,6 +158,8 @@ end:
void Game::init(void)
{
SDL_strlcpy(magic, "[vVvVvV]game", sizeof(magic));
roomx = 0;
roomy = 0;
prevroomx = 0;

View file

@ -132,6 +132,8 @@ struct CustomLevelStat
class Game
{
char magic[16];
public:
void init(void);