Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
62 changes: 32 additions & 30 deletions CPP/GameAPI/GameVariables.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -411,34 +411,6 @@ void RegisterGlobals(void **globals, int32 size);
#ifndef GAME_NO_GLOBALS
// Globals Example

#if !GAME_IS_MANIA && !GAME_IS_S3 && !defined(GAME_NO_VARIABLES)
// forward declare
struct GlobalVariables;

extern GlobalVariables *globals;

struct GlobalVariables {
struct Constructor {
Constructor()
{
#if RETRO_REV0U
RegisterGlobals((void **)&globals, sizeof(GlobalVariables), &GlobalVariables::Init);
#else
RegisterGlobals((void **)&globals, sizeof(GlobalVariables));
#endif
}
};

static Constructor c;

#if RETRO_REV0U
static void Init(void *g);
#endif

// Your Variables Go Here
};
#endif

#if GAME_IS_MANIA
// Use this if you're hooking onto Sonic Mania
struct ManiaGlobalVariables {
Expand Down Expand Up @@ -513,9 +485,10 @@ struct ManiaGlobalVariables {
int32 hasPlusInitial;
#endif
};
#endif

#if GAME_IS_S3
typedef ManiaGlobalVariables GlobalVariables;
extern GlobalVariables *globals;
#elif GAME_IS_S3
// Use this if you're hooking onto Origins' S3
struct S3GlobalVariables {
int32 gameMode;
Expand Down Expand Up @@ -683,6 +656,35 @@ struct S3GlobalVariables {
int32 field_447D9C;
#endif
};

typedef S3GlobalVariables GlobalVariables;
extern GlobalVariables *globals;
#elif !defined(GAME_NO_VARIABLES)
// forward declare
struct GlobalVariables;

extern GlobalVariables *globals;

struct GlobalVariables {
struct Constructor {
Constructor()
{
#if RETRO_REV0U
RegisterGlobals((void **)&globals, sizeof(GlobalVariables), &GlobalVariables::Init);
#else
RegisterGlobals((void **)&globals, sizeof(GlobalVariables));
#endif
}
};

static Constructor c;

#if RETRO_REV0U
static void Init(void *g);
#endif

// Your Variables Go Here
};
#endif

#endif
Expand Down