From 35fe9ae6901042020519df8eebf800ee614b8a0b Mon Sep 17 00:00:00 2001 From: Randy Heit Date: Thu, 26 Mar 2009 02:33:37 +0000 Subject: [PATCH] - Made fmodex.dll delay-loaded so the game should be runnable on Windows 95 again, though without sound. SVN r1506 (trunk) --- docs/rh-log.txt | 2 + src/sound/fmodsound.cpp | 42 ++- zdoom.vcproj | 752 ++++++++++++++++++++-------------------- 3 files changed, 420 insertions(+), 376 deletions(-) diff --git a/docs/rh-log.txt b/docs/rh-log.txt index f46b28d88d..551109f7ff 100644 --- a/docs/rh-log.txt +++ b/docs/rh-log.txt @@ -1,4 +1,6 @@ March 25, 2009 +- Made fmodex.dll delay-loaded so the game should no be runnable on Windows + 95 again, though without sound. - Changed gameinfo_t and gameborder_t to be named structs instead of typedef'ed anonymous structs. - Fixed: P_AutoUseHealth() used autousemodes 0 and 1 instead of 1 and 2. diff --git a/src/sound/fmodsound.cpp b/src/sound/fmodsound.cpp index c03bfe0aa9..6fa967582a 100644 --- a/src/sound/fmodsound.cpp +++ b/src/sound/fmodsound.cpp @@ -1,9 +1,9 @@ /* -** i_sound.cpp +** fmodsound.cpp ** System interface for sound; uses FMOD Ex. ** **--------------------------------------------------------------------------- -** Copyright 1998-2008 Randy Heit +** Copyright 1998-2009 Randy Heit ** All rights reserved. ** ** Redistribution and use in source and binary forms, with or without @@ -582,6 +582,28 @@ bool FMODSoundRenderer::IsValid() return InitSuccess; } +#ifdef _MSC_VER +//========================================================================== +// +// CheckException +// +//========================================================================== + +#define FACILITY_VISUALCPP ((LONG)0x6d) +#define VcppException(sev,err) ((sev) | (FACILITY_VISUALCPP<<16) | err) + +static int CheckException(DWORD code) +{ + if (code == VcppException(ERROR_SEVERITY_ERROR,ERROR_MOD_NOT_FOUND) || + code == VcppException(ERROR_SEVERITY_ERROR,ERROR_PROC_NOT_FOUND)) + { + return EXCEPTION_EXECUTE_HANDLER; + } + return EXCEPTION_CONTINUE_SEARCH; +} + +#endif + //========================================================================== // // FMODSoundRenderer :: Init @@ -619,7 +641,23 @@ bool FMODSoundRenderer::Init() Printf("I_InitSound: Initializing FMOD\n"); // Create a System object and initialize. +#ifdef _MSC_VER + __try { +#endif result = FMOD::System_Create(&Sys); +#ifdef _MSC_VER + } + __except(CheckException(GetExceptionCode())) + { + Sys = NULL; + Printf(TEXTCOLOR_ORANGE"Failed to load fmodex" +#ifdef _WIN64 + "64" +#endif + ".dll\n"); + return false; + } +#endif if (result != FMOD_OK) { Sys = NULL; diff --git a/zdoom.vcproj b/zdoom.vcproj index 9cd643f177..e298ccd3b3 100644 --- a/zdoom.vcproj +++ b/zdoom.vcproj @@ -1,7 +1,7 @@ - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - @@ -1860,6 +1856,14 @@ Outputs="$(IntDir)/$(InputName).obj" /> + + + @@ -2025,6 +2029,14 @@ Outputs="$(IntDir)\$(InputName).obj" /> + + + @@ -2035,14 +2047,6 @@ Outputs="$(IntDir)\$(InputName).obj" /> - - - + + + - - - + + + @@ -5343,14 +5355,6 @@ AdditionalIncludeDirectories="src\win32;$(NoInherit)" /> - - - @@ -5629,7 +5633,7 @@ />