From d2951e11fb5db140426714023390d7e3cf822d1a Mon Sep 17 00:00:00 2001 From: dwsJason Date: Wed, 9 Oct 2019 21:57:19 -0400 Subject: [PATCH] Cleanup when the application exits --- src/sysvid.c | 19 +++++++++++++++++-- src/xrick.c | 4 +++- 2 files changed, 20 insertions(+), 3 deletions(-) diff --git a/src/sysvid.c b/src/sysvid.c index fd3bb14..21432c1 100644 --- a/src/sysvid.c +++ b/src/sysvid.c @@ -312,6 +312,21 @@ static LoadSegRec result; } +// +// Attempt a proper shutdown +// +void IIGShutdown() +{ + RemoveKeyboardDriver(); + ADBShutDown(); + EMShutDown(); + MTShutDown(); + + DisposeAll(userid()); + + //SystemMMShutDown(); +} + #endif @@ -355,7 +370,7 @@ sysvid_init(void) GetLoadSegments(); -#if 0 +#if 1 // Allocate Bank E1 memory - Actual Video memory printf("Allocate Bank $E1 memory\n"); hndl = NewHandle(0x8000, userid(), 0xC003, (pointer) 0xE12000); @@ -374,7 +389,7 @@ sysvid_init(void) directPageHandle = (U32*)NewHandle( 0x100, userid(), 0xC005, 0 ); if (toolerror()) { - printf("Unable to allocate 512 bytes Direct Page\n"); + printf("Unable to allocate 256 bytes Direct Page\n"); printf("Game can't run\n"); sys_sleep(5000); // Wait 5 seconds exit(1); diff --git a/src/xrick.c b/src/xrick.c index 2a6456b..27be1aa 100644 --- a/src/xrick.c +++ b/src/xrick.c @@ -31,13 +31,15 @@ */ void scr_credit(); - +void IIGShutdown(); /* * main */ int main(int argc, char *argv[]) { + atexit( IIGShutdown ); // Make Sure cleanup stuff is done + // Get the credit screen up ASAP scr_credit();