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
+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 */