Small changes to improve compatibility with GCC. (PR #902)

* Fix GCC build.

1) do not fwd declare enums
2) include only base class header file IPropertySheet.

* DSInit(): make sure sound devices are cleaned before the 2nd call.

And use std::string to avoid need of memory management.
This commit is contained in:
Andrea 2020-12-29 21:17:03 +00:00 committed by GitHub
parent 6cf907f303
commit b226bdfd53
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 8 additions and 4 deletions

View File

@ -11,7 +11,7 @@
#include "Video.h"
Video& GetVideo(void);
#include "Configuration/PropertySheet.h"
#include "Configuration/IPropertySheet.h"
IPropertySheet& GetPropertySheet(void);
#include "FrameBase.h"

View File

@ -1,5 +1,7 @@
#pragma once
#include "Video.h"
// Globals (Public)
extern uint16_t g_nVideoClockVert;
extern uint16_t g_nVideoClockHorz;
@ -21,7 +23,6 @@
extern void NTSC_VideoUpdateCycles( UINT cycles6502 );
extern void NTSC_VideoRedrawWholeScreen( void );
enum VideoRefreshRate_e;
void NTSC_SetRefreshRate(VideoRefreshRate_e rate);
UINT NTSC_GetCyclesPerFrame(void);
UINT NTSC_GetCyclesPerLine(void);

View File

@ -38,7 +38,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#define MAX_SOUND_DEVICES 10
static char *sound_devices[MAX_SOUND_DEVICES];
static std::string sound_devices[MAX_SOUND_DEVICES];
static GUID sound_device_guid[MAX_SOUND_DEVICES];
static int num_sound_devices = 0;
@ -67,7 +67,9 @@ static BOOL CALLBACK DSEnumProc(LPGUID lpGUID, LPCTSTR lpszDesc, LPCTSTR lpszDrv
return TRUE;
if(lpGUID != NULL)
memcpy(&sound_device_guid[i], lpGUID, sizeof (GUID));
sound_devices[i] = _strdup(lpszDesc);
else
memset(&sound_device_guid[i], 0, sizeof(GUID));
sound_devices[i] = lpszDesc;
if(g_fh) fprintf(g_fh, "%d: %s - %s\n",i,lpszDesc,lpszDrvName);
@ -491,6 +493,7 @@ bool DSInit()
return true; // Already initialised successfully
}
num_sound_devices = 0;
HRESULT hr = DirectSoundEnumerate((LPDSENUMCALLBACK)DSEnumProc, NULL);
if(FAILED(hr))
{