diff --git a/deploy/DMX.exe b/deploy/DMX.exe index 2de29a8..dc877c2 100644 Binary files a/deploy/DMX.exe and b/deploy/DMX.exe differ diff --git a/src/headers/common.h b/src/headers/common.h index 90864c2..2a17b9f 100644 --- a/src/headers/common.h +++ b/src/headers/common.h @@ -98,11 +98,12 @@ struct AL_POINT #define VOTEMODE 17 #define BOOTMODE 18 #ifdef DMXDEBUG - #define FIRST_GAME_MODE BOOTMODE + //#define FIRST_GAME_MODE VIDEOTEST + //#define FIRST_GAME_MODE BOOTMODE //#define FIRST_GAME_MODE SONGWHEEL //#define FIRST_GAME_MODE GAMEPLAY //#define FIRST_GAME_MODE PLAYERSELECT - //#define FIRST_GAME_MODE ATTRACT + #define FIRST_GAME_MODE ATTRACT #else #define FIRST_GAME_MODE BOOTMODE #endif @@ -126,6 +127,7 @@ struct AL_POINT #define PLAYER_PREFS_LOST 5001 #define PLAYER_SCORES_LOST 5002 #define UPDATE_FAILED 6001 +#define REBOOT_FAILED 6002 #define EXTIO_ERROR 7001 void globalError(long errorCode, const char* errorInfo); diff --git a/src/headers/gameStateManager.h b/src/headers/gameStateManager.h index b723eca..989cef7 100644 --- a/src/headers/gameStateManager.h +++ b/src/headers/gameStateManager.h @@ -458,6 +458,7 @@ public: case PLAYER_SCORES_LOST: return "PLAYER SCORE DATA LOST"; case 6000: return "UNSPECIFIC UPDATE ERROR"; case UPDATE_FAILED: return "FAILED TO START UPDATE PROCESS"; + case REBOOT_FAILED: return "UNABLE TO SELF-RESTART"; case 7000: return "UNSPECIFIC HARDWARE ERROR"; case EXTIO_ERROR: return "I/O BOARD SYNC ERROR"; } diff --git a/src/source/VideoManager.cpp b/src/source/VideoManager.cpp index 786aa02..29bcaad 100644 --- a/src/source/VideoManager.cpp +++ b/src/source/VideoManager.cpp @@ -163,6 +163,7 @@ void VideoManager::loadVideo(char* filename) // load the entire video into an unreasonably large memory buffer! videoBuffer = malloc(fsize); fread(videoBuffer, fsize, 1, fp); + fclose(fp); // sanity check the buffer contents or else APEG may hang if ( ((char*)videoBuffer)[0] == 'O' && ((char*)videoBuffer)[1] == 'g' && ((char*)videoBuffer)[2] == 'g' && ((char*)videoBuffer)[3] == 'S' ) diff --git a/src/source/main.cpp b/src/source/main.cpp index 3b9832c..b8ce1a2 100644 --- a/src/source/main.cpp +++ b/src/source/main.cpp @@ -131,6 +131,7 @@ void mainCautionLoop(UTIME dt); void renderCreditsDisplay(); void getUpdateAndRestart(); +void giveUpAndRestart(); void renderDebugOverlay(); // operator menus @@ -305,6 +306,7 @@ int main() if ( time > last_utime ) { UTIME dt = time - last_utime; + //dt *= 1000; // FOR SOAK TESTING, CAUSES HILLARIOUS THINGS TO HAPPEN last_utime = time; totalGameTime += dt; @@ -596,11 +598,11 @@ void mainErrorLoop(UTIME dt) textprintf_centre(rm.m_backbuf, font, 320, 300, makecol(255,255,255), "PLEASE PRESS TEST BUTTON"); textprintf_centre(rm.m_backbuf, font, 320, 410, makecol(255,255,255), "time = %d", accumulate/1000); - // nevermind? no one is coming to the rescue? just carry on after 10 minutes + // nevermind? no one is coming to the rescue? just reboot after 10 minutes if ( accumulate/1000 > 600 ) { - gs.g_currentGameMode = MAINMENU; - gs.g_gameModeTransition = 1; + giveUpAndRestart(); + accumulate = 600000 - 10000; } } @@ -695,6 +697,16 @@ void getUpdateAndRestart() } } +// This is used in the event of a fatal error. +void giveUpAndRestart() +{ + if ( _execl("dmx.exe", "dmx.exe", NULL) == -1 ) + { + globalError(REBOOT_FAILED, "please reboot the machine"); + em.playSample(SFX_LOUD_BELL); + } +} + void firstOperatorLoop() { bm.forceBookkeepingSave(); diff --git a/src/source/render_dmx.cpp b/src/source/render_dmx.cpp index 8be1273..4d02dec 100644 --- a/src/source/render_dmx.cpp +++ b/src/source/render_dmx.cpp @@ -700,6 +700,10 @@ void renderBatteryLivesDMX(int player) for ( int i = 0; i < gs.player[player].lifebarLives; i++ ) { int frame = getValueFromRange(0, 7, (gs.player[player].stepZoneBeatTimer*100 / gs.player[player].stepZoneTimePerBeat)); + if ( frame < 0 || frame > 7 ) + { + frame = 7; + } masked_stretch_blit(m_notesDMX[2], rm.m_backbuf, 0, frame*40, 40, 40, xpos, ypos, 20, 20); ypos += 20*direction; }