From 4c8c2b15e56434ca97111cfe8a08037d3ba85b8c Mon Sep 17 00:00:00 2001 From: Glenn Maynard Date: Fri, 24 Jan 2003 23:09:31 +0000 Subject: [PATCH] arch interface for little hooks that don't need their own drivers --- stepmania/src/StepMania.cpp | 22 ++++++-------- stepmania/src/StepMania.dsp | 24 +++++++++++++-- stepmania/src/StepMania.h | 4 +-- stepmania/src/StepMania.vcproj | 14 ++++++++- stepmania/src/arch/ArchHooks/ArchHooks.h | 30 +++++++++++++++++++ .../src/arch/ArchHooks/ArchHooks_Win32.cpp | 18 +++++++++++ .../src/arch/ArchHooks/ArchHooks_Win32.h | 19 ++++++++++++ stepmania/src/arch/ArchHooks/ArchHooks_none.h | 17 +++++++++++ stepmania/src/arch/arch.cpp | 1 + stepmania/src/arch/arch.h | 4 ++- stepmania/src/arch/arch_Win32.h | 1 + stepmania/src/arch/arch_default.h | 1 + 12 files changed, 136 insertions(+), 19 deletions(-) create mode 100644 stepmania/src/arch/ArchHooks/ArchHooks.h create mode 100644 stepmania/src/arch/ArchHooks/ArchHooks_Win32.cpp create mode 100644 stepmania/src/arch/ArchHooks/ArchHooks_Win32.h create mode 100644 stepmania/src/arch/ArchHooks/ArchHooks_none.h diff --git a/stepmania/src/StepMania.cpp b/stepmania/src/StepMania.cpp index b878483023..6e1eaa86ea 100644 --- a/stepmania/src/StepMania.cpp +++ b/stepmania/src/StepMania.cpp @@ -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 diff --git a/stepmania/src/StepMania.dsp b/stepmania/src/StepMania.dsp index 23eb7d38b6..71495373af 100644 --- a/stepmania/src/StepMania.dsp +++ b/stepmania/src/StepMania.dsp @@ -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 diff --git a/stepmania/src/StepMania.h b/stepmania/src/StepMania.h index c280634371..0b15d97c99 100644 --- a/stepmania/src/StepMania.h +++ b/stepmania/src/StepMania.h @@ -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 diff --git a/stepmania/src/StepMania.vcproj b/stepmania/src/StepMania.vcproj index a218b1b764..fa4e067498 100644 --- a/stepmania/src/StepMania.vcproj +++ b/stepmania/src/StepMania.vcproj @@ -742,8 +742,20 @@ cl /Zl /nologo /c verstub.cpp /Fo$(IntDir)\ + + + + + + + +