Skip to content

Commit 5d719d3

Browse files
ilianaInfoTeddy
authored andcommitted
Add magic string to the start of the game global
The `-addresses` command-line option added in 64be99d 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.
1 parent 2201cfe commit 5d719d3

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

desktop_version/src/Game.cpp

+2
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,8 @@ static const char* get_summary(
158158

159159
void Game::init(void)
160160
{
161+
SDL_strlcpy(magic, "[vVvVvV]game", sizeof(magic));
162+
161163
roomx = 0;
162164
roomy = 0;
163165
prevroomx = 0;

desktop_version/src/Game.h

+2
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,8 @@ struct CustomLevelStat
132132

133133
class Game
134134
{
135+
char magic[16];
136+
135137
public:
136138
void init(void);
137139

0 commit comments

Comments
 (0)