Cleanup when the application exits

This commit is contained in:
dwsJason 2019-10-09 21:57:19 -04:00
parent daf4734fea
commit d2951e11fb
2 changed files with 20 additions and 3 deletions

View File

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

View File

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