Adds minimal Steam fiddling protection
This commit is contained in:
parent
6e3343aa3b
commit
ae44d5c2bc
|
@ -7,7 +7,7 @@ project(breakhack C)
|
|||
set(breakhack_GAME_TITLE "BreakHack")
|
||||
set(breakhack_MAJOR_VERSION 1)
|
||||
set(breakhack_MINOR_VERSION 1)
|
||||
set(breakhack_PATCH_VERSION 3)
|
||||
set(breakhack_PATCH_VERSION 4)
|
||||
set(breakhack_RELEASE_TYPE "")
|
||||
|
||||
include(FindLua)
|
||||
|
|
13
src/main.c
13
src/main.c
|
@ -526,16 +526,21 @@ resetGame(void)
|
|||
static bool
|
||||
init(void)
|
||||
{
|
||||
#ifdef STEAM_BUILD
|
||||
if (!steam_restart_needed()) {
|
||||
steam_init();
|
||||
} else {
|
||||
error("%s needs to be started through Steam", GAME_TITLE);
|
||||
return false;
|
||||
}
|
||||
#endif // STEAM_BUILD
|
||||
|
||||
if (!initSDL()) {
|
||||
return false;
|
||||
} else if (!initGame()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
#ifdef STEAM_BUILD
|
||||
steam_init();
|
||||
#endif // STEAM_BUILD
|
||||
|
||||
settings_init();
|
||||
hiscore_init();
|
||||
initMainMenu();
|
||||
|
|
|
@ -58,6 +58,12 @@ leaderboard_received(Sint64 hLeaderboard, const char *name)
|
|||
m_hKillsLeaderboard = hLeaderboard;
|
||||
}
|
||||
|
||||
bool
|
||||
steam_restart_needed()
|
||||
{
|
||||
return c_SteamAPI_RestartAppIfNecessary();
|
||||
}
|
||||
|
||||
void
|
||||
steam_init()
|
||||
{
|
||||
|
|
|
@ -25,6 +25,8 @@ typedef struct Achievement {
|
|||
int m_iIconImage;
|
||||
} Achievement;
|
||||
|
||||
bool steam_restart_needed(void);
|
||||
|
||||
void steam_init(void);
|
||||
|
||||
void steam_shutdown(void);
|
||||
|
|
|
@ -47,6 +47,11 @@ c_SteamAPI_GetAppID()
|
|||
return m_AppId;
|
||||
}
|
||||
|
||||
bool c_SteamAPI_RestartAppIfNecessary()
|
||||
{
|
||||
return SteamAPI_RestartAppIfNecessary(931040);
|
||||
}
|
||||
|
||||
void
|
||||
c_SteamAPI_RunCallbacks(void)
|
||||
{
|
||||
|
|
|
@ -26,6 +26,9 @@ c_SteamAPI_Init(void);
|
|||
int64_t
|
||||
c_SteamAPI_GetAppID(void);
|
||||
|
||||
bool
|
||||
c_SteamAPI_RestartAppIfNecessary(void);
|
||||
|
||||
void
|
||||
c_SteamAPI_RunCallbacks(void);
|
||||
|
||||
|
|
Loading…
Reference in New Issue