1 // Emacs style mode select -*- C++ -*-
2 //-----------------------------------------------------------------------------
6 // Copyright (C) 1993-1996 by id Software, Inc.
8 // This program is free software; you can redistribute it and/or
9 // modify it under the terms of the GNU General Public License
10 // as published by the Free Software Foundation; either version 2
11 // of the License, or (at your option) any later version.
13 // This program is distributed in the hope that it will be useful,
14 // but WITHOUT ANY WARRANTY; without even the implied warranty of
15 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 // GNU General Public License for more details.
18 // $Log: i_system.c,v $
19 // Revision 1.9 2006-04-15 22:08:36 kkurbjun
20 // Slight code cleanups, fixed sound parameter - now it saves. Old configurations will be reset.
22 // Revision 1.8 2006-04-14 21:07:55 kkurbjun
23 // Start of profiling support for doom.
25 // Revision 1.7 2006-04-04 11:16:44 dave
26 // Correct the #ifdef logic for timer_unregister() and add a comment describing why we need to surround the use of the user timer with #ifdefs
28 // Revision 1.6 2006-04-03 17:32:46 dave
29 // Clean up the (incorrect) #ifdef spaghetti for the timer. We now have a user timer on the ipods, so we use it.
31 // Revision 1.5 2006-04-03 17:11:42 kkurbjun
34 // Revision 1.4 2006-04-03 17:00:56 dave
35 // Doom can't use the user timer at the same time as using the grayscale lib.
37 // Revision 1.3 2006-04-02 12:45:29 amiconn
38 // Use TIMER_FREQ for timers in plugins. Fixes timer speed on iPod.
40 // Revision 1.2 2006-04-02 01:52:44 kkurbjun
41 // Update adds prboom's high resolution support, also makes the scaling for platforms w/ resolution less then 320x200 much nicer. IDoom's lookup table code has been removed. Also fixed a pallete bug. Some graphic errors are present in menu and status bar. Also updates some headers and output formatting.
43 // Revision 1.1 2006-03-28 15:44:01 dave
44 // Patch #2969 - Doom! Currently only working on the H300.
49 //-----------------------------------------------------------------------------
61 #pragma implementation "i_system.h"
65 #include "rockmacros.h"
69 // returns time in 1/70th second tics
74 The user timer is used to generate a 70Hz tick for Doom. But it
75 is unavailable for the greyscale targets (it's used by the greyscale
76 lib) and is not implemented in the simulator - so we have to
77 approximate it using current_tick.
79 #if defined(HAVE_LCD_COLOR) && !defined(SIMULATOR) && !defined(RB_PROFILE)
80 volatile unsigned int doomtimer
=0;
90 #if defined(HAVE_LCD_COLOR) && !defined(SIMULATOR) && !defined(RB_PROFILE)
94 return ((7*(*rb
->current_tick
))/20);
96 #error FIX - I assumed HZ was 100
105 // I was looking into this and comparing the speed versus Prboom
106 // Turns out they are running the game much slower then I thought the game was
107 // played. This explains why run was unusable other then through straight stretches
108 // The game is much slower now (in terms of game speed).
111 #if defined(HAVE_LCD_COLOR) && !defined(SIMULATOR) && !defined(RB_PROFILE)
112 rb
->timer_register(1, NULL
, TIMER_FREQ
/TICRATE
, doomtime
IF_COP(, CPU
));
125 I_ShutdownGraphics();
126 #if defined(HAVE_LCD_COLOR) && !defined(SIMULATOR) && !defined(RB_PROFILE)
127 rb
->timer_unregister();
132 void I_WaitVBL(int count
)
140 extern boolean demorecording
;
142 void I_Error (char *error
, ...)
148 vsnprintf(p_buf
,sizeof(p_buf
), error
, ap
);
151 printf("%s\n",p_buf
);
153 // Shutdown. Here might be other errors.