(Win32 refresh) Update DirectXHelpers.cpp

The DirectInput / DirectSound version defs need to be exposed to other parts of the engine, so they are moved to the header instead of the cpp file.

The includes can be consolidated after that.

I'm also replacing the usage of a raw array of char *'s with an RString and using c_str() to get its value - a small change, but raw arrays are unreliable.
This commit is contained in:
sukibaby
2025-01-20 09:46:15 -08:00
committed by teejusb
parent f783588adb
commit 3a51f00147
2 changed files with 14 additions and 10 deletions
+10 -10
View File
@@ -1,6 +1,14 @@
#include "global.h"
#include "DirectXHelpers.h"
#include "RageUtil.h"
#include <cstdarg>
#include <dinput.h>
#include <d3d9.h>
#include <mmsystem.h> // dsound.h needs this
#include <dsound.h>
#include <stdexcept>
RString GetErrorString(HRESULT hr);
RString hr_ssprintf( int hr, const char *fmt, ... )
{
@@ -9,18 +17,10 @@ RString hr_ssprintf( int hr, const char *fmt, ... )
RString s = vssprintf( fmt, va );
va_end(va);
const char *szError = GetErrorString( hr );
return s + ssprintf( " (%s)", szError );
RString szError = GetErrorString(hr);
return s + ssprintf(" (%s)", szError.c_str());
}
// needed for defines
#define DIRECTINPUT_VERSION 0x0800
#define DIRECTSOUND_VERSION 0x0700
#include <dinput.h>
#include <d3d9.h>
#include <mmsystem.h> // dsound.h needs this
#include <dsound.h>
#define DXERRMSG(hrcode, dummy) case hrcode: return #hrcode;
RString GetErrorString(HRESULT hr)
+4
View File
@@ -7,6 +7,10 @@ RString hr_ssprintf( int hr, const char *fmt, ... );
RString GetErrorString(HRESULT hr);
// These defined need to be exposed anywhere this is included.
#define DIRECTINPUT_VERSION 0x0800
#define DIRECTSOUND_VERSION 0x0700
#endif
/*