arch interface for little hooks that don't need their own drivers

This commit is contained in:
Glenn Maynard
2003-01-24 23:09:31 +00:00
parent bca879f9b0
commit 4c8c2b15e5
12 changed files with 136 additions and 19 deletions
+9 -13
View File
@@ -10,6 +10,8 @@
-----------------------------------------------------------------------------
*/
#include "StepMania.h"
//
// Rage global classes
//
@@ -46,13 +48,8 @@
#include "InputQueue.h"
#include "SongCacheIndex.h"
#include "archutils/win32/tls.h"
#include "archutils/win32/crash.h"
#include "SDL.h"
#include "SDL_opengl.h"
/* This is also a global class; we own it. */
ArchHooks *HOOKS = NULL;
#ifdef DEBUG
@@ -217,14 +214,13 @@ static void RestoreAppPri()
int main(int argc, char* argv[])
{
/* Set up arch hooks first. This may set up crash handling. */
HOOKS = MakeArchHooks();
ChangeToDirOfExecutable(argv[0]);
atexit(SDL_Quit); /* Clean up on exit */
SetUnhandledExceptionFilter(CrashHandler);
InitThreadData("Main thread");
VDCHECKPOINT;
/* Fire up the SDL, but don't actually start any subsystems. */
int SDL_flags = 0;
#ifdef WIN32
@@ -365,8 +361,8 @@ int main(int argc, char* argv[])
SAFE_DELETE( TEXTUREMAN );
SAFE_DELETE( DISPLAY );
SAFE_DELETE( LOG );
SAFE_DELETE( HOOKS );
if( g_sErrorString != "" )
{
// throw up a pretty error dialog
+22 -2
View File
@@ -60,7 +60,7 @@ IntDir=.\../Release6
TargetDir=\temp\stepmania
TargetName=StepMania
SOURCE="$(InputPath)"
PreLink_Cmds=disasm\verinc cl /Zl /nologo /c verstub.cpp /Fo$(IntDir)\
PreLink_Cmds=disasm\verinc cl /Zl /nologo /c verstub.cpp /Fo$(IntDir)\
PostBuild_Cmds=disasm\mapconv $(IntDir)\$(TargetName).map $(TargetDir)\StepMania.vdi ia32.vdi
# End Special Build Tool
@@ -95,7 +95,7 @@ IntDir=.\../Debug6
TargetDir=\temp\stepmania
TargetName=StepMania-debug
SOURCE="$(InputPath)"
PreLink_Cmds=disasm\verinc cl /Zl /nologo /c verstub.cpp /Fo$(IntDir)\
PreLink_Cmds=disasm\verinc cl /Zl /nologo /c verstub.cpp /Fo$(IntDir)\
PostBuild_Cmds=disasm\mapconv $(IntDir)\$(TargetName).map $(TargetDir)\StepMania.vdi ia32.vdi
# End Special Build Tool
@@ -644,6 +644,26 @@ SOURCE=.\arch\ErrorDialog\ErrorDialog_Win32.cpp
SOURCE=.\arch\ErrorDialog\ErrorDialog_Win32.h
# End Source File
# End Group
# Begin Group "ArchHooks"
# PROP Default_Filter ""
# Begin Source File
SOURCE=.\arch\ArchHooks\ArchHooks.h
# End Source File
# Begin Source File
SOURCE=.\arch\ArchHooks\ArchHooks_none.h
# End Source File
# Begin Source File
SOURCE=.\arch\ArchHooks\ArchHooks_Win32.cpp
# End Source File
# Begin Source File
SOURCE=.\arch\ArchHooks\ArchHooks_Win32.h
# End Source File
# End Group
# Begin Source File
SOURCE=.\arch\arch.cpp
+2 -2
View File
@@ -13,10 +13,10 @@
void ApplyGraphicOptions();
void ExitGame();
void ResetGame();
#include "arch/ArchHooks/ArchHooks.h"
extern ArchHooks *HOOKS; // global and accessable from anywhere in our program
#endif
+13 -1
View File
@@ -742,8 +742,20 @@ cl /Zl /nologo /c verstub.cpp /Fo$(IntDir)\
</File>
</Filter>
<Filter
Name="DebugInfo"
Name="ArchHooks"
Filter="">
<File
RelativePath="arch\ArchHooks\ArchHooks.h">
</File>
<File
RelativePath="arch\ArchHooks\ArchHooks_Win32.cpp">
</File>
<File
RelativePath="arch\ArchHooks\ArchHooks_Win32.h">
</File>
<File
RelativePath="arch\ArchHooks\ArchHooks_none.h">
</File>
</Filter>
</Filter>
<Filter
+30
View File
@@ -0,0 +1,30 @@
#ifndef ARCH_HOOKS_H
#define ARCH_HOOKS_H
/*
* I'm undecided about when it's a good idea to use arch; I'm experimenting
* a bit.
*
* This arch driver is simply called at various important points, to let
* architectures do things. Windows can use this to start up the crash
* handler and to output Windows-specific debug information, for example.
*
* This class should have one-way data transfer only: functions are called,
* they may do something, and no data is returned. (We don't want to have
* to deal with error handling and so on when using these functions.)
*
* This class is constructed at the very start of the program.
*/
class ArchHooks
{
public:
virtual ~ArchHooks() { }
};
#endif
/*
* Copyright (c) 2002-2003 by the person(s) listed below. All rights reserved.
*
* Glenn Maynard
*/
@@ -0,0 +1,18 @@
#include "stdafx.h"
#include "ArchHooks_Win32.h"
#include "archutils/win32/tls.h"
#include "archutils/win32/crash.h"
ArchHooks_Win32::ArchHooks_Win32()
{
SetUnhandledExceptionFilter(CrashHandler);
InitThreadData("Main thread");
VDCHECKPOINT;
}
/*
* Copyright (c) 2002-2003 by the person(s) listed below. All rights reserved.
*
* Glenn Maynard
*/
@@ -0,0 +1,19 @@
#ifndef ARCH_HOOKS_WIN32_H
#define ARCH_HOOKS_WIN32_H
#include "ArchHooks.h"
class ArchHooks_Win32: public ArchHooks
{
public:
ArchHooks_Win32();
};
#undef ARCH_HOOKS
#define ARCH_HOOKS ArchHooks_Win32
#endif
/*
* Copyright (c) 2002-2003 by the person(s) listed below. All rights reserved.
*
* Glenn Maynard
*/
@@ -0,0 +1,17 @@
#ifndef ARCH_HOOKS_NONE_H
#define ARCH_HOOKS_NONE_H
#include "ArchHooks.h"
class ArchHooks_none: public ArchHooks
{
};
#undef ARCH_HOOKS
#define ARCH_HOOKS ArchHooks_none
#endif
/*
* Copyright (c) 2002-2003 by the person(s) listed below. All rights reserved.
*
* Glenn Maynard
*/
+1
View File
@@ -19,6 +19,7 @@
LoadingWindow *MakeLoadingWindow() { return new ARCH_LOADING_WINDOW; }
ErrorDialog *MakeErrorDialog() { return new ARCH_ERROR_DIALOG; }
ArchHooks *MakeArchHooks() { return new ARCH_HOOKS; }
/* Err, this is ugly--breaks arch encapsulation. Hmm. */
RageSoundDriver *MakeRageSoundDriver(CString drivers)
+3 -1
View File
@@ -5,10 +5,12 @@
class ErrorDialog;
class LoadingWindow;
class RageSoundDriver;
class ArchHooks;
ErrorDialog *MakeErrorDialog();
LoadingWindow *MakeLoadingWindow();
RageSoundDriver *MakeRageSoundDriver(CString drivers);
ArchHooks *MakeArchHooks();
/* Define the default list of sound drivers for each arch. */
#if defined(WIN32)
@@ -18,7 +20,7 @@ RageSoundDriver *MakeRageSoundDriver(CString drivers);
#endif
/*
* Copyright (c) 2002 by the person(s) listed below. All rights reserved.
* Copyright (c) 2002-2003 by the person(s) listed below. All rights reserved.
*
* Glenn Maynard
*/
+1
View File
@@ -4,6 +4,7 @@
/* Load drivers for Win32. */
#include "LoadingWindow/LoadingWindow_Win32.h"
#include "ErrorDialog/ErrorDialog_Win32.h"
#include "ArchHooks/ArchHooks_Win32.h"
#include "Sound/RageSoundDriver_DSound.h"
#include "Sound/RageSoundDriver_DSound_Software.h"
+1
View File
@@ -7,6 +7,7 @@
/* Load default fallback drivers; some of these may be overridden by arch-specific drivers. */
#include "LoadingWindow/LoadingWindow_SDL.h"
#include "ErrorDialog/ErrorDialog_stdout.h"
#include "ArchHooks/ArchHooks_none.h"
/* no default sound driver */