2006-02-24 04:48:15 +00:00
|
|
|
// Emacs style mode select -*- C++ -*-
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
// $Id:$
|
|
|
|
//
|
|
|
|
// Copyright (C) 1993-1996 by id Software, Inc.
|
|
|
|
//
|
|
|
|
// This source is available for distribution and/or modification
|
|
|
|
// only under the terms of the DOOM Source Code License as
|
|
|
|
// published by id Software. All rights reserved.
|
|
|
|
//
|
|
|
|
// The source is distributed in the hope that it will be useful,
|
|
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
// FITNESS FOR A PARTICULAR PURPOSE. See the DOOM Source Code License
|
|
|
|
// for more details.
|
|
|
|
//
|
|
|
|
// DESCRIPTION:
|
|
|
|
// System specific interface stuff.
|
|
|
|
//
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
|
|
|
|
#ifndef __I_SYSTEM__
|
|
|
|
#define __I_SYSTEM__
|
|
|
|
|
|
|
|
#include <dirent.h>
|
|
|
|
#include <ctype.h>
|
|
|
|
|
|
|
|
#include "d_main.h"
|
|
|
|
#include "d_ticcmd.h"
|
|
|
|
#include "d_event.h"
|
|
|
|
|
2006-04-12 01:50:09 +00:00
|
|
|
#ifndef SHARE_DIR
|
2006-02-24 04:48:15 +00:00
|
|
|
#define SHARE_DIR "/usr/local/share/"
|
2006-04-12 01:50:09 +00:00
|
|
|
#endif
|
2006-02-24 04:48:15 +00:00
|
|
|
|
|
|
|
// Index values into the LanguageIDs array
|
|
|
|
enum
|
|
|
|
{
|
|
|
|
LANGIDX_UserPreferred,
|
|
|
|
LANGIDX_UserDefault,
|
|
|
|
LANGIDX_SysPreferred,
|
|
|
|
LANGIDX_SysDefault
|
|
|
|
};
|
|
|
|
extern DWORD LanguageIDs[4];
|
|
|
|
extern void SetLanguageIDs ();
|
|
|
|
|
|
|
|
struct CPUInfo // 92 bytes
|
|
|
|
{
|
|
|
|
char VendorID[16];
|
|
|
|
char CPUString[48];
|
|
|
|
|
|
|
|
BYTE Stepping;
|
|
|
|
BYTE Model;
|
|
|
|
BYTE Family;
|
|
|
|
BYTE Type;
|
|
|
|
|
|
|
|
BYTE BrandIndex;
|
|
|
|
BYTE CLFlush;
|
|
|
|
BYTE CPUCount;
|
|
|
|
BYTE APICID;
|
|
|
|
|
|
|
|
DWORD bSSE3:1;
|
|
|
|
DWORD DontCare1:31;
|
|
|
|
|
|
|
|
DWORD bFPU:1;
|
|
|
|
DWORD bVME:1;
|
|
|
|
DWORD bDE:1;
|
|
|
|
DWORD bPSE:1;
|
|
|
|
DWORD bRDTSC:1;
|
|
|
|
DWORD bMSR:1;
|
|
|
|
DWORD bPAE:1;
|
|
|
|
DWORD bMCE:1;
|
|
|
|
DWORD bCX8:1;
|
|
|
|
DWORD bAPIC:1;
|
|
|
|
DWORD bReserved1:1;
|
|
|
|
DWORD bSEP:1;
|
|
|
|
DWORD bMTRR:1;
|
|
|
|
DWORD bPGE:1;
|
|
|
|
DWORD bMCA:1;
|
|
|
|
DWORD bCMOV:1;
|
|
|
|
DWORD bPAT:1;
|
|
|
|
DWORD bPSE36:1;
|
|
|
|
DWORD bPSN:1;
|
|
|
|
DWORD bCFLUSH:1;
|
|
|
|
DWORD bReserved2:1;
|
|
|
|
DWORD bDS:1;
|
|
|
|
DWORD bACPI:1;
|
|
|
|
DWORD bMMX:1;
|
|
|
|
DWORD bFXSR:1;
|
|
|
|
DWORD bSSE:1;
|
|
|
|
DWORD bSSE2:1;
|
|
|
|
DWORD bSS:1;
|
|
|
|
DWORD bHTT:1;
|
|
|
|
DWORD bTM:1;
|
|
|
|
DWORD bReserved3:1;
|
|
|
|
DWORD bPBE:1;
|
|
|
|
|
|
|
|
DWORD DontCare2:22;
|
|
|
|
DWORD bMMXPlus:1; // AMD's MMX extensions
|
|
|
|
DWORD bMMXAgain:1; // Just a copy of bMMX above
|
|
|
|
DWORD DontCare3:6;
|
|
|
|
DWORD b3DNowPlus:1;
|
|
|
|
DWORD b3DNow:1;
|
|
|
|
|
|
|
|
BYTE AMDStepping;
|
|
|
|
BYTE AMDModel;
|
|
|
|
BYTE AMDFamily;
|
|
|
|
BYTE bIsAMD;
|
|
|
|
|
|
|
|
BYTE DataL1LineSize;
|
|
|
|
BYTE DataL1LinesPerTag;
|
|
|
|
BYTE DataL1Associativity;
|
|
|
|
BYTE DataL1SizeKB;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
extern "C" {
|
|
|
|
extern CPUInfo CPU;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Called by DoomMain.
|
|
|
|
void I_Init (void);
|
|
|
|
|
|
|
|
// Called by D_DoomLoop,
|
|
|
|
// returns current time in tics.
|
|
|
|
extern int (*I_GetTime) (bool saveMS);
|
|
|
|
|
|
|
|
// like I_GetTime, except it waits for a new tic before returning
|
|
|
|
extern int (*I_WaitForTic) (int);
|
|
|
|
|
|
|
|
int I_GetTimePolled (bool saveMS);
|
|
|
|
int I_GetTimeFake (void);
|
|
|
|
|
2006-09-14 00:02:31 +00:00
|
|
|
fixed_t I_GetTimeFrac (uint32 *ms);
|
2006-02-24 04:48:15 +00:00
|
|
|
|
|
|
|
|
|
|
|
//
|
|
|
|
// Called by D_DoomLoop,
|
|
|
|
// called before processing any tics in a frame
|
|
|
|
// (just after displaying a frame).
|
|
|
|
// Time consuming syncronous operations
|
|
|
|
// are performed here (joystick reading).
|
|
|
|
// Can call D_PostEvent.
|
|
|
|
//
|
|
|
|
void I_StartFrame (void);
|
|
|
|
|
|
|
|
|
|
|
|
//
|
|
|
|
// Called by D_DoomLoop,
|
|
|
|
// called before processing each tic in a frame.
|
|
|
|
// Quick syncronous operations are performed here.
|
|
|
|
// Can call D_PostEvent.
|
|
|
|
void I_StartTic (void);
|
|
|
|
|
|
|
|
// Asynchronous interrupt functions should maintain private queues
|
|
|
|
// that are read by the synchronous functions
|
|
|
|
// to be converted into events.
|
|
|
|
|
|
|
|
// Either returns a null ticcmd,
|
|
|
|
// or calls a loadable driver to build it.
|
|
|
|
// This ticcmd will then be modified by the gameloop
|
|
|
|
// for normal input.
|
|
|
|
ticcmd_t *I_BaseTiccmd (void);
|
|
|
|
|
|
|
|
|
|
|
|
// Called by M_Responder when quit is selected.
|
|
|
|
// Clean exit, displays sell blurb.
|
2006-05-12 03:14:40 +00:00
|
|
|
void I_Quit (void);
|
2006-02-24 04:48:15 +00:00
|
|
|
|
|
|
|
|
|
|
|
void I_Tactile (int on, int off, int total);
|
|
|
|
|
|
|
|
void STACK_ARGS I_Error (const char *error, ...) GCCPRINTF(1,2);
|
|
|
|
void STACK_ARGS I_FatalError (const char *error, ...) GCCPRINTF(1,2);
|
|
|
|
|
2006-05-12 03:14:40 +00:00
|
|
|
void addterm (void (*func)(void), const char *name);
|
2006-02-24 04:48:15 +00:00
|
|
|
#define atterm(t) addterm (t, #t)
|
|
|
|
void popterm ();
|
|
|
|
|
|
|
|
// Print a console string
|
Note: I have not tried compiling these recent changes under Linux. I wouldn't
be surprised if it doesn't work.
- Reorganized the network startup loops so now they are event driven. There is
a single function that gets called to drive it, and it uses callbacks to
perform the different stages of the synchronization. This lets me have a nice,
responsive abort button instead of the previous unannounced hit-escape-to-
abort behavior, and I think the rearranged code is slightly easier to
understand too.
- Increased the number of bytes for version info during D_ArbitrateNetStart(),
in preparation for the day when NETGAMEVERSION requires more than one byte.
- I noticed an issue with Vista RC1 and the new fatal error setup. Even after
releasing a DirectDraw or Direct3D interface, the DWM can still use the
last image drawn using them when it composites the window. It doesn't always
do it but it does often enough that it is a real problem. At this point, I
don't know if it's a problem with the release version of Vista or not.
After messing around, I discovered the problem was caused by ~Win32Video()
hiding the window and then having it immediately shown soon after. The DWM
kept an image of the window to do the transition effect with, and then when
it didn't get a chance to do the transition, it didn't properly forget about
its saved image and kept plastering it on top of everything else
underneath.
- Added a network synchronization panel to the window during netgame startup.
- Fixed: PClass::CreateDerivedClass() must initialize StateList to NULL.
Otherwise, classic DECORATE definitions generate a big, fat crash.
- Resurrected the R_Init progress bar, now as a standard Windows control.
- Removed the sound failure dialog. The FMOD setup already defaulted to no
sound if initialization failed, so this only applies when snd_output is set
to "alternate" which now also falls back to no sound. In addition, it wasn't
working right, and I didn't feel like fixing it for the probably 0% of users
it affected.
- Fixed: The edit control used for logging output added text in reverse order
on Win9x.
- Went back to the roots and made graphics initialization one of the last
things to happen during setup. Now the startup text is visible again. More
importantly, the main window is no longer created invisible, which seems
to cause trouble with it not always appearing in the taskbar. The fatal
error dialog is now also embedded in the main window instead of being a
separate modal dialog, so you can play with the log window to see any
problems that might be reported there.
Rather than completely restoring the original startup order, I tried to
keep things as close to the way they were with early graphics startup. In
particular, V_Init() now creates a dummy screen so that things that need
screen dimensions can get them. It gets replaced by the real screen later
in I_InitGraphics(). Will need to check this under Linux to make sure it
didn't cause any problems there.
- Removed the following stubs that just called functions in Video:
- I_StartModeIterator()
- I_NextMode()
- I_DisplayType()
I_FullscreenChanged() was also removed, and a new fullscreen parameter
was added to IVideo::StartModeIterator(), since that's all it controlled.
- Renamed I_InitHardware() back to I_InitGraphics(), since that's all it's
initialized post-1.22.
SVN r416 (trunk)
2006-12-19 04:09:10 +00:00
|
|
|
void I_PrintStr (const char *str);
|
2006-02-24 04:48:15 +00:00
|
|
|
|
|
|
|
// Set the title string of the startup window
|
Note: I have not tried compiling these recent changes under Linux. I wouldn't
be surprised if it doesn't work.
- Reorganized the network startup loops so now they are event driven. There is
a single function that gets called to drive it, and it uses callbacks to
perform the different stages of the synchronization. This lets me have a nice,
responsive abort button instead of the previous unannounced hit-escape-to-
abort behavior, and I think the rearranged code is slightly easier to
understand too.
- Increased the number of bytes for version info during D_ArbitrateNetStart(),
in preparation for the day when NETGAMEVERSION requires more than one byte.
- I noticed an issue with Vista RC1 and the new fatal error setup. Even after
releasing a DirectDraw or Direct3D interface, the DWM can still use the
last image drawn using them when it composites the window. It doesn't always
do it but it does often enough that it is a real problem. At this point, I
don't know if it's a problem with the release version of Vista or not.
After messing around, I discovered the problem was caused by ~Win32Video()
hiding the window and then having it immediately shown soon after. The DWM
kept an image of the window to do the transition effect with, and then when
it didn't get a chance to do the transition, it didn't properly forget about
its saved image and kept plastering it on top of everything else
underneath.
- Added a network synchronization panel to the window during netgame startup.
- Fixed: PClass::CreateDerivedClass() must initialize StateList to NULL.
Otherwise, classic DECORATE definitions generate a big, fat crash.
- Resurrected the R_Init progress bar, now as a standard Windows control.
- Removed the sound failure dialog. The FMOD setup already defaulted to no
sound if initialization failed, so this only applies when snd_output is set
to "alternate" which now also falls back to no sound. In addition, it wasn't
working right, and I didn't feel like fixing it for the probably 0% of users
it affected.
- Fixed: The edit control used for logging output added text in reverse order
on Win9x.
- Went back to the roots and made graphics initialization one of the last
things to happen during setup. Now the startup text is visible again. More
importantly, the main window is no longer created invisible, which seems
to cause trouble with it not always appearing in the taskbar. The fatal
error dialog is now also embedded in the main window instead of being a
separate modal dialog, so you can play with the log window to see any
problems that might be reported there.
Rather than completely restoring the original startup order, I tried to
keep things as close to the way they were with early graphics startup. In
particular, V_Init() now creates a dummy screen so that things that need
screen dimensions can get them. It gets replaced by the real screen later
in I_InitGraphics(). Will need to check this under Linux to make sure it
didn't cause any problems there.
- Removed the following stubs that just called functions in Video:
- I_StartModeIterator()
- I_NextMode()
- I_DisplayType()
I_FullscreenChanged() was also removed, and a new fullscreen parameter
was added to IVideo::StartModeIterator(), since that's all it controlled.
- Renamed I_InitHardware() back to I_InitGraphics(), since that's all it's
initialized post-1.22.
SVN r416 (trunk)
2006-12-19 04:09:10 +00:00
|
|
|
struct IWADInfo;
|
|
|
|
void I_SetIWADInfo (const IWADInfo *info);
|
2006-02-24 04:48:15 +00:00
|
|
|
|
|
|
|
// Pick from multiple IWADs to use
|
2006-07-08 02:17:35 +00:00
|
|
|
int I_PickIWad (WadStuff *wads, int numwads, bool queryiwad, int defaultiwad);
|
2006-02-24 04:48:15 +00:00
|
|
|
|
2006-09-20 02:00:19 +00:00
|
|
|
// The ini could not be saved at exit
|
|
|
|
bool I_WriteIniFailed ();
|
|
|
|
|
2006-02-24 04:48:15 +00:00
|
|
|
// [RH] Returns millisecond-accurate time
|
|
|
|
unsigned int I_MSTime (void);
|
|
|
|
|
|
|
|
|
|
|
|
// Directory searching routines
|
|
|
|
|
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
int count;
|
|
|
|
struct dirent **namelist;
|
|
|
|
int current;
|
|
|
|
} findstate_t;
|
|
|
|
|
|
|
|
void *I_FindFirst (const char *filespec, findstate_t *fileinfo);
|
|
|
|
int I_FindNext (void *handle, findstate_t *fileinfo);
|
|
|
|
int I_FindClose (void *handle);
|
|
|
|
int I_FindAttr (findstate_t *fileinfo);
|
|
|
|
|
|
|
|
#define I_FindName(a) ((a)->namelist[(a)->current]->d_name)
|
|
|
|
|
|
|
|
#define FA_RDONLY 1
|
|
|
|
#define FA_HIDDEN 2
|
|
|
|
#define FA_SYSTEM 4
|
|
|
|
#define FA_DIREC 8
|
|
|
|
#define FA_ARCH 16
|
|
|
|
|
|
|
|
static inline char *strlwr(char *str)
|
|
|
|
{
|
|
|
|
char *ptr = str;
|
|
|
|
while(*ptr)
|
|
|
|
{
|
|
|
|
*ptr = tolower(*ptr);
|
|
|
|
++ptr;
|
|
|
|
}
|
|
|
|
return str;
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|