Exemple #1
0
void Quit(const char *error)
{
	memptr screen = NULL;

	if (!error || !*error) {
		CA_CacheGrChunk(ORDERSCREEN);
		screen = grsegs[ORDERSCREEN];
		WriteConfig();
	} else if (error) {
		CA_CacheGrChunk(ERRORSCREEN);
		screen = grsegs[ERRORSCREEN];
	}
	
	ShutdownId();
	
	if (screen) {
		/* printf("spiffy ansi screen goes here..\n"); */
	}
	
	if (error && *error) {
		fprintf(stderr, "Quit: %s\n", error);
		exit(EXIT_FAILURE);
 	}
	exit(EXIT_SUCCESS);
}
Exemple #2
0
void	TEDDeath(void)
{
	ShutdownId();
	// REFKEEN - DISABLED
	BE_ST_ExitWithErrorMsg("Sorry, but TED5.EXE cannot be launched from game in this source port.");
	//execlp("TED5.EXE","TED5.EXE","/LAUNCH",NULL);
}
Exemple #3
0
void Quit(const char *error)
{
	memptr screen = NULL;

	if (!error || !*error) {
		CA_CacheGrChunk(ORDERSCREEN);
		screen = grsegs[ORDERSCREEN];
		WriteConfig();
	} else if (error) {
		CA_CacheGrChunk(ERRORSCREEN);
		screen = grsegs[ERRORSCREEN];
	}
	
	ShutdownId();
	
	if (screen) {
		//DisplayTextSplash(screen);
	}
	
	if (error && *error) {
		fprintf(stderr, "Quit: %s\n", error);
		exit(EXIT_FAILURE);
 	}
	exit(EXIT_SUCCESS);
}
Exemple #4
0
void Quit (const id0_char_t *error)
{
  ShutdownId ();
  if (error && *error)
  {
	BE_ST_clrscr();
	BE_ST_puts(error);
	BE_ST_puts("\n");
#ifdef REFKEEN_VER_KDREAMS_CGA_ALL
//      BE_ST_puts("For techinical assistance with running this software, type HELP at");
//      BE_ST_puts("    the DOS prompt or call Softdisk Publishing at 1-318-221-8311");
#else
	if (refkeen_current_gamever == BE_GAMEVER_KDREAMSE113)
	{
		BE_ST_puts("For techinical assistance with running this software, type HELP at");
		BE_ST_puts("    the DOS prompt or call Gamer's Edge at 1-318-221-8311");
	}
#endif
	// No additional lines for later versions (registered v1.93, shareware v1.20)
	BE_ST_HandleExit(1);
  }

// TODO (REFKEEN) Maybe we can define CATALOG based on version?
#if (!defined REFKEEN_VER_KDREAMS_CGA_ALL) || (!defined CATALOG)
#ifndef REFKEEN_VER_KDREAMS_CGA_ALL
	if (refkeen_current_gamever == BE_GAMEVER_KDREAMSE113)
#endif
	{
		id0_argc = 2;
		id0_argv[1] = "LAST.SHL";
		id0_argv[2] = "ENDSCN.SCN";
		id0_argv[3] = NULL;

		//if (execv("LOADSCN.EXE", _argv) == -1)
		//	Quit("Couldn't find executable LOADSCN.EXE.\n");
		void loadscn2_main(int argc, const char **argv);
		loadscn2_main(id0_argc+1, id0_argv);
	}
#endif

#if (defined REFKEEN_VER_KDREAMS_CGA_ALL) && (defined CATALOG)
	VW_SetScreenMode(TEXTGR);
	BE_ST_HandleExit(0);
#endif

// For all other versions (registered v1.93, shareware v1.20), just exit
#ifndef REFKEEN_VER_KDREAMS_CGA_ALL
	if (refkeen_current_gamever != BE_GAMEVER_KDREAMSE113)
	{
		BE_ST_HandleExit(0);
	}
#endif

}
void Quit (const char *errorStr, ...)
{
    char error[256];
    if(errorStr != NULL)
    {
        va_list vlist;
        va_start(vlist, errorStr);
        vsprintf(error, errorStr, vlist);
        va_end(vlist);
    }
    else
        error[0] = 0;

    /* don't try to display the red box before it's loaded */
    if (!pictable)
    {
        ShutdownId();
        if (error && *error)
        {
            puts(error);
            VW_WaitVBL(100);
        }
        exit(1);
    }

    if (!error || !*error)
        WriteConfig ();

    ShutdownId ();

    if (error && *error)
    {
        puts(error);
        VW_WaitVBL(200);
        exit(1);
    }

    exit(0);
}
Exemple #6
0
void	CheckMemory(void)
{
	id0_byte_t *finscreen;
	//id0_unsigned_t	finscreen;

	if (mminfo.nearheap+mminfo.farheap+mminfo.EMSmem+mminfo.XMSmem
		>= MINMEMORY)
		return;

	CA_CacheGrChunk (OUTOFMEM);
	finscreen = (id0_byte_t *)grsegs[OUTOFMEM];
	//finscreen = (id0_unsigned_t)grsegs[OUTOFMEM];
	ShutdownId ();
	memcpy(BE_ST_GetTextModeMemoryPtr(), finscreen+7, 4000);
	//movedata (finscreen,7,0xb800,0,4000);
	BE_ST_MoveTextCursorTo(0, 23); //gotoxy (1,24);
	BE_ST_HandleExit(1);
}
Exemple #7
0
void	CheckMemory(void)
{
	id0_unsigned_t	finscreen;

	if (Flags & FL_NOMEMCHECK)
		return;

	if (mminfo.nearheap+mminfo.farheap+mminfo.EMSmem+mminfo.XMSmem
		>= MINMEMORY)
		return;

	CA_CacheGrChunk (OUTOFMEM);
	finscreen = (id0_unsigned_t)grsegs[OUTOFMEM];
	ShutdownId ();
	movedata (finscreen,7,0xb800,0,4000);
	gotoxy (1,24);
	exit(1);
}
Exemple #8
0
void Quit (const id0_char_t *error)
{
	void *finscreen;
	//id0_unsigned_t	finscreen;

	if (refkeen_current_gamever == BE_GAMEVER_CAT3D100)
	{
		if (!error)
		{
			CA_SetAllPurge ();
			CA_CacheGrChunk (PIRACY);
			finscreen = grsegs[PIRACY];
			//finscreen = (id0_unsigned_t)grsegs[PIRACY];
		}
	}

	ShutdownId ();
	if (error && *error)
	{
	  BE_ST_puts(error);
	  BE_ST_HandleExit(1);
	}

	if (refkeen_current_gamever == BE_GAMEVER_CAT3D100)
	{
		if (!NoWait)
		{
			// REFKEEN - Alternative controllers support
			extern BE_ST_ControllerMapping g_ingame_altcontrol_mapping_inackback;
			BE_ST_AltControlScheme_PrepareControllerMapping(&g_ingame_altcontrol_mapping_inackback);

			memcpy(BE_ST_GetTextModeMemoryPtr(), finscreen, 4000);
			//movedata (finscreen,0,0xb800,0,4000);
			BE_ST_BiosScanCode (0);
			BE_ST_clrscr();
		}
	}

	BE_ST_HandleExit(0);
}
Exemple #9
0
int
USL_HardError(word errval,int ax,int bp,int si)
{
#define IGNORE  0
#define RETRY   1
#define	ABORT   2
extern	void	ShutdownId(void);

static	char		buf[32];
static	WindowRec	wr;
		int			di;
		char		c,*s,*t;

	di = _DI;

	if (ax < 0)
		s = "DEVICE ERROR";
	else
	{
		if ((di & 0x00ff) == 0)
			s = "DRIVE ~ IS WRITE PROTECTED";
		else
			s = "ERROR ON DRIVE ~";
		for (t = buf;*s;s++,t++)	// Can't use sprintf()
			if ((*t = *s) == '~')
				*t = (ax & 0x00ff) + 'A';
		*t = '\0';
		s = buf;
	}

	c = peekb(0x40,0x49);	// Get the current screen mode
	if ((c < 4) || (c == 7))
		goto oh_kill_me;

	// DEBUG - handle screen cleanup

   fontnumber = 4;
	US_SaveWindow(&wr);
	US_CenterWindow(30,3);
	US_CPrint(s);
	US_CPrint("(R)ETRY or (A)BORT?");
	VW_UpdateScreen();
	IN_ClearKeysDown();

asm	sti	// Let the keyboard interrupts come through

	while (true)
	{
		switch (IN_WaitForASCII())
		{
		case key_Escape:
		case 'a':
		case 'A':
			goto oh_kill_me;
			break;
		case key_Return:
		case key_Space:
		case 'r':
		case 'R':
			US_ClearWindow();
			VW_UpdateScreen();
			US_RestoreWindow(&wr);
			return(RETRY);
			break;
		}
	}

oh_kill_me:
	abortprogram = s;
	ShutdownId();
	fprintf(stderr,"TERMINAL ERROR: %s\n",s);
	return(ABORT);

#undef	IGNORE
#undef	RETRY
#undef	ABORT
}
Exemple #10
0
void
TEDDeath(void)
{
	ShutdownId();
	execlp("TED5.EXE","TED5.EXE","/LAUNCH","KDREAMS",NULL);
}
Exemple #11
0
int
USL_HardError(word errval,int ax,int bp,int si)
{
#define IGNORE  0
#define RETRY   1
#define	ABORT   2
extern	void	ShutdownId(void);

static	char		buf[32];
static	WindowRec	wr;
		int			di;
		char		c,*s,*t;


	di = _DI;

	if (ax < 0)
		s = "Device Error";
	else
	{
		if ((di & 0x00ff) == 0)
			s = "Drive ~ is Write Protected";
		else
			s = "Error on Drive ~";
		for (t = buf;*s;s++,t++)	// Can't use sprintf()
			if ((*t = *s) == '~')
				*t = (ax & 0x00ff) + 'A';
		*t = '\0';
		s = buf;
	}

	c = peekb(0x40,0x49);	// Get the current screen mode
	if ((c < 4) || (c == 7))
		goto oh_kill_me;

	// DEBUG - handle screen cleanup

	US_SaveWindow(&wr);
	US_CenterWindow(30,3);
	US_CPrint(s);
	US_CPrint("(R)etry or (A)bort?");
	VW_UpdateScreen();
	IN_ClearKeysDown();

asm	sti	// Let the keyboard interrupts come through

	while (true)
	{
		switch (IN_WaitForASCII())
		{
		case key_Escape:
		case 'a':
		case 'A':
			goto oh_kill_me;
			break;
		case key_Return:
		case key_Space:
		case 'r':
		case 'R':
			US_ClearWindow();
			VW_UpdateScreen();
			US_RestoreWindow(&wr);
			return(RETRY);
			break;
		}
	}

oh_kill_me:
	abortprogram = s;
	ShutdownId();
	fprintf(stderr,"Terminal Error: %s\n",s);
	if (tedlevel)
		fprintf(stderr,"You launched from TED. I suggest that you reboot...\n");

	return(ABORT);
#undef	IGNORE
#undef	RETRY
#undef	ABORT
}
Exemple #12
0
void Quit (const id0_char_t *error, ...)
{
	id0_short_t exit_code=0;
#ifndef CATALOG
	void *finscreen;
	//id0_unsigned_t	finscreen;
#endif

	va_list ap;

	va_start(ap,error);

#ifndef CATALOG
	if (!error)
	{
		CA_SetAllPurge ();
		CA_CacheGrChunk (PIRACY);
		finscreen = grsegs[PIRACY];
		//finscreen = (id0_unsigned_t)grsegs[PIRACY];
	}
#endif

	ShutdownId ();

	if (error && *error)
	{
		BE_ST_vprintf(error,ap);
		exit_code = 1;
	}
#ifndef CATALOG
	else
	if (!NoWait)
	{
		memcpy(BE_ST_GetTextModeMemoryPtr(), finscreen, 4000);
		BE_ST_MarkGfxForUpdate();
		//movedata (finscreen,0,0xb800,0,4000);
		BE_ST_BiosScanCode(0);
	}
#endif

	va_end(ap);

#ifndef CATALOG
	if (!error)
	{
		id0_argc = 2;
		id0_argv[1] = "LAST.SHL";
		id0_argv[2] = "ENDSCN.SCN";
		id0_argv[3] = NULL;
#if 0
		if (execv("LOADSCN.EXE", id0_argv) == -1)
		{
			BE_ST_clrscr();
			BE_ST_puts("Couldn't find executable LOADSCN.EXE.\n");
			BE_ST_HandleExit(1);
		}
#endif
		void loadscn_exe_main(void);
		BE_Cross_Bexecv(loadscn_exe_main, id0_argv, NULL, false);
	}
#endif

	BE_ST_HandleExit(exit_code);
}
Exemple #13
0
void Quit (const id0_char_t *error, ...)
{
	id0_short_t exit_code=0;
	void *finscreen;
	//id0_unsigned_t	finscreen;

	va_list ap;

	va_start(ap,error);

	if (!error)
	{
		CA_SetAllPurge ();
		if (!refkeen_compat_c4_main_def_catalog)
		{
			CA_CacheGrChunk (PIRACY);
			finscreen = grsegs[PIRACY];
			//finscreen = (id0_unsigned_t)grsegs[PIRACY];
		}
	}
	ShutdownId ();

	if (error && *error)
	{
		BE_ST_vprintf(error,ap);
		exit_code = 1;
	}

	else if (!refkeen_compat_c4_main_def_catalog)
	{
		if ((refkeen_current_gamever == BE_GAMEVER_CATABYSS124) || !NoWait)
		{
			memcpy(BE_ST_GetTextModeMemoryPtr(), finscreen, 4000);
			BE_ST_MarkGfxForUpdate();
			//movedata (finscreen,0,0xb800,0,4000);
			if (refkeen_current_gamever == BE_GAMEVER_CATABYSS124)
			{
				if (BE_ST_KbHit())
				{
					while (BE_ST_KbHit())
						BE_ST_BiosScanCode(0);
				}
			}
			BE_ST_BiosScanCode(0);
		}
	}

	va_end(ap);

	if (!refkeen_compat_c4_main_def_catalog)
	{
		if (!error)
		{

			id0_argc = 2;
			id0_argv[1] = "LAST.SHL";
			id0_argv[2] = "ENDSCN.SCN";
			id0_argv[3] = NULL;
	#if 0
			if (execv("LOADSCN.EXE", id0_argv) == -1)
			{
				BE_ST_clrscr();
				BE_ST_puts("Couldn't find executable LOADSCN.EXE.\n");
				BE_ST_HandleExit(1);
			}
	#endif
			void loadscn_exe_main(void);
			BE_Cross_Bexecv(loadscn_exe_main, id0_argv, NULL, false);
		}
	}

	BE_ST_HandleExit(exit_code);
}
Exemple #14
0
void Quit (const char *errorStr, ...)
{
#ifdef NOTYET
    byte *screen;
#endif
    char error[256];
    if(errorStr != NULL)
    {
        va_list vlist;
        va_start(vlist, errorStr);
        vsprintf(error, errorStr, vlist);
        va_end(vlist);
    }
    else error[0] = 0;

    if (!pictable)  // don't try to display the red box before it's loaded
    {
        ShutdownId();
        if (error && *error)
        {
#ifdef NOTYET
            SetTextCursor(0,0);
#endif
            puts(error);
#ifdef NOTYET
            SetTextCursor(0,2);
#endif
            VW_WaitVBL(100);
        }
        exit(1);
    }

    if (!error || !*error)
    {
#ifdef NOTYET
        #ifndef JAPAN
        CA_CacheGrChunk (ORDERSCREEN);
        screen = grsegs[ORDERSCREEN];
        #endif
#endif
        WriteConfig ();
    }
#ifdef NOTYET
    else
    {
        CA_CacheGrChunk (ERRORSCREEN);
        screen = grsegs[ERRORSCREEN];
    }
#endif

    ShutdownId ();

    if (error && *error)
    {
#ifdef NOTYET
        memcpy((byte *)0xb8000,screen+7,7*160);
        SetTextCursor(9,3);
#endif
        puts(error);
#ifdef NOTYET
        SetTextCursor(0,7);
#endif
        VW_WaitVBL(200);
        exit(1);
    }
    else
    if (!error || !(*error))
    {
#ifdef NOTYET
        #ifndef JAPAN
        memcpy((byte *)0xb8000,screen+7,24*160); // 24 for SPEAR/UPLOAD compatibility
        #endif
        SetTextCursor(0,23);
#endif
    }

    exit(0);
}
Exemple #15
0
static void InitGame()
{
#ifndef SPEARDEMO
    boolean didjukebox=false;
#endif

    // initialize SDL
#if defined _WIN32
    putenv("SDL_VIDEODRIVER=directx");
#endif
    if(SDL_Init(SDL_INIT_VIDEO | SDL_INIT_AUDIO | SDL_INIT_JOYSTICK) < 0)
    {
        printf("Unable to init SDL: %s\n", SDL_GetError());
        exit(1);
    }
    atexit(SDL_Quit);

    int numJoysticks = SDL_NumJoysticks();
    if(param_joystickindex && (param_joystickindex < -1 || param_joystickindex >= numJoysticks))
    {
        if(!numJoysticks)
            printf("No joysticks are available to SDL!\n");
        else
            printf("The joystick index must be between -1 and %i!\n", numJoysticks - 1);
        exit(1);
    }

#if defined(GP2X_940)
    GP2X_MemoryInit();
#endif

    SignonScreen ();

#if defined _WIN32
    if(!fullscreen)
    {
        struct SDL_SysWMinfo wmInfo;
        SDL_VERSION(&wmInfo.version);

        if(SDL_GetWMInfo(&wmInfo) != -1)
        {
            HWND hwndSDL = wmInfo.window;
            DWORD style = GetWindowLong(hwndSDL, GWL_STYLE) & ~WS_SYSMENU;
            SetWindowLong(hwndSDL, GWL_STYLE, style);
            SetWindowPos(hwndSDL, NULL, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER | SWP_FRAMECHANGED);
        }
    }
#endif
	VW_UpdateScreen();

    VH_Startup ();
    IN_Startup ();
    PM_Startup ();
    SD_Startup ();
    CA_Startup ();
    US_Startup ();

    // TODO: Will any memory checking be needed someday??
#ifdef NOTYET
#ifndef SPEAR
    if (mminfo.mainmem < 235000L)
#else
    if (mminfo.mainmem < 257000L && !MS_CheckParm("debugmode"))
#endif
    {
        byte *screen;

        CA_CacheGrChunk (ERRORSCREEN);
        screen = grsegs[ERRORSCREEN];
        ShutdownId();
/*        memcpy((byte *)0xb8000,screen+7+7*160,17*160);
        gotoxy (1,23);*/
        exit(1);
    }
#endif


//
// build some tables
//
    InitDigiMap ();

    ReadConfig ();

    SetupSaveGames();

//
// HOLDING DOWN 'M' KEY?
//
	IN_ProcessEvents();

#ifndef SPEARDEMO
    if (Keyboard[sc_M])
    {
        DoJukebox();
        didjukebox=true;
    }
    else
#endif

//
// draw intro screen stuff
//
    IntroScreen ();

#ifdef _arch_dreamcast
    //TODO: VMU Selection Screen
#endif

//
// load in and lock down some basic chunks
//

    CA_CacheGrChunk(STARTFONT);
    CA_CacheGrChunk(STATUSBARPIC);

    LoadLatchMem ();
    BuildTables ();          // trig tables
    SetupWalls ();

    NewViewSize (viewsize);

//
// initialize variables
//
    InitRedShifts ();
#ifndef SPEARDEMO
    if(!didjukebox)
#endif
        FinishSignon();

#ifdef NOTYET
    vdisp = (byte *) (0xa0000+PAGE1START);
    vbuf = (byte *) (0xa0000+PAGE2START);
#endif
}