Fixed a bug in the (new) VideoManager which was causing file handles to leak, eventually breaking the game forever. This was noticeable after a few hours of the attract loop. I also modified Error Mode to reboot the game after 10 minutes of being neglected at the error screen.

This commit is contained in:
allenseitz
2014-12-20 01:11:05 +00:00
parent 562b3808ee
commit a7e03ca426
6 changed files with 25 additions and 5 deletions

Binary file not shown.

View File

@@ -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);

View File

@@ -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";
}

View File

@@ -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' )

View File

@@ -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();

View File

@@ -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;
}