DOOM-3-BFG

DOOM 3 BFG Edition
Log | Files | Refs

i_system.cpp (3806B)


      1 /*
      2 ===========================================================================
      3 
      4 Doom 3 BFG Edition GPL Source Code
      5 Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company. 
      6 
      7 This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").  
      8 
      9 Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify
     10 it under the terms of the GNU General Public License as published by
     11 the Free Software Foundation, either version 3 of the License, or
     12 (at your option) any later version.
     13 
     14 Doom 3 BFG Edition Source Code is distributed in the hope that it will be useful,
     15 but WITHOUT ANY WARRANTY; without even the implied warranty of
     16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     17 GNU General Public License for more details.
     18 
     19 You should have received a copy of the GNU General Public License
     20 along with Doom 3 BFG Edition Source Code.  If not, see <http://www.gnu.org/licenses/>.
     21 
     22 In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code.  If not, please request a copy in writing from id Software at the address below.
     23 
     24 If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.
     25 
     26 ===========================================================================
     27 */
     28 
     29 #include "Precompiled.h"
     30 #include "globaldata.h"
     31 
     32 
     33 #include <stdlib.h>
     34 #include <stdio.h>
     35 #include <string.h>
     36 
     37 #include <stdarg.h>
     38 
     39 #include "doomdef.h"
     40 #include "m_misc.h"
     41 #include "i_video.h"
     42 #include "i_sound.h"
     43 
     44 #include "d_net.h"
     45 #include "g_game.h"
     46 
     47 #ifdef __GNUG__
     48 #pragma implementation "i_system.h"
     49 #endif
     50 #include "i_system.h"
     51 
     52 #include "Main.h"
     53 
     54 #if  1
     55 
     56 
     57 
     58 ticcmd_t*	I_BaseTiccmd(void)
     59 {
     60     return &::g->emptycmd;
     61 }
     62 
     63 
     64 int  I_GetHeapSize (void)
     65 {
     66     return ::g->mb_used*1024*1024;
     67 }
     68 
     69 
     70 //
     71 // I_GetTime
     72 // returns time in 1/70th second tics
     73 //
     74 int  I_GetTime (void)
     75 {
     76 	return ::g->current_time;
     77 }
     78 
     79 void I_SetTime( int time_in )
     80 {
     81 	::g->current_time = time_in;
     82 }
     83 
     84 
     85 
     86 //
     87 // I_Init
     88 //
     89 void I_Init (void)
     90 {
     91     I_InitSound();
     92     //  I_InitGraphics();
     93 }
     94 
     95 //
     96 // I_Quit
     97 //
     98 void I_Quit (void)
     99 {
    100     D_QuitNetGame ();
    101     I_ShutdownSound();
    102     I_ShutdownMusic();
    103     M_SaveDefaults ();
    104     I_ShutdownGraphics();
    105 //    exit(0);
    106 
    107 // Exceptions disabled by default on PS3
    108 //	throw;
    109 }
    110 
    111 void I_WaitVBL(int count)
    112 {
    113 	// PS3 fixme
    114 	//Sleep(0);
    115 }
    116 
    117 void I_BeginRead(void)
    118 {
    119 }
    120 
    121 void I_EndRead(void)
    122 {
    123 }
    124 
    125 //
    126 // I_Error
    127 //
    128 extern bool debugOutput;
    129 void I_Printf(char* msg, ...)
    130 {
    131 	char pmsg[1024];
    132     va_list	argptr;
    133 
    134     // Message first.
    135 	if( debugOutput ) {
    136 		va_start (argptr,msg);
    137 		vsprintf (pmsg, msg, argptr);
    138 
    139 		safeOutputDebug(pmsg);
    140 
    141 		va_end (argptr);
    142 	}
    143 }
    144 
    145 
    146 void I_PrintfE(char* msg, ...)
    147 {
    148 	char pmsg[1024];
    149     va_list	argptr;
    150 
    151     // Message first.
    152 	if( debugOutput ) {
    153 		va_start (argptr,msg);
    154 		vsprintf (pmsg, msg, argptr);
    155 
    156 		safeOutputDebug("ERROR: ");
    157 		safeOutputDebug(pmsg);
    158 
    159 	    va_end (argptr);
    160 	}
    161 }
    162 
    163 void I_Error(char *error, ...)
    164 {
    165 	const int ERROR_MSG_SIZE = 1024;
    166 	char error_msg[ERROR_MSG_SIZE];
    167     va_list	argptr;
    168 
    169     // Message first.
    170 	if( debugOutput ) {
    171 		va_start (argptr,error);
    172 		idStr::vsnPrintf (error_msg, ERROR_MSG_SIZE, error, argptr);
    173 
    174 		safeOutputDebug("Error: ");
    175 		safeOutputDebug(error_msg);
    176 		safeOutputDebug("\n");
    177 
    178 		va_end (argptr);
    179 	}
    180 
    181 	// CRASH DUMP - enable this to get extra info on error from crash dumps
    182 	//*(int*)0x0 = 21;
    183 	DoomLib::Interface.QuitCurrentGame();
    184 	idLib::Printf( "DOOM Classic error: %s", error_msg );
    185 	common->SwitchToGame( DOOM3_BFG );
    186 }
    187 
    188 #endif
    189