(Win32) Some build fixes

This commit is contained in:
twinaphex 2015-09-05 14:01:03 +02:00
parent 42b3c79b8e
commit b2f022ae30
3 changed files with 53 additions and 48 deletions

View File

@ -14,14 +14,25 @@
* If not, see <http://www.gnu.org/licenses/>. * If not, see <http://www.gnu.org/licenses/>.
*/ */
#if defined(_MSC_VER) && !defined(_XBOX) #include <stdint.h>
#pragma comment(lib, "dsound") #include <stdlib.h>
#pragma comment(lib, "dxguid") #include <stddef.h>
#include <string.h>
#include <dsound.h>
#ifndef _XBOX
#include <mmreg.h>
#endif #endif
#include <boolean.h>
#include <retro_inline.h> #include <retro_inline.h>
#include <retro_miscellaneous.h> #include <retro_miscellaneous.h>
#include <rthreads/rthreads.h> #include <rthreads/rthreads.h>
#include <queues/fifo_buffer.h>
#include "../../driver.h"
#include "../../general.h"
#ifdef _XBOX #ifdef _XBOX
#define DSERR_BUFFERLOST MAKE_DSHRESULT(150) #define DSERR_BUFFERLOST MAKE_DSHRESULT(150)
@ -29,21 +40,11 @@
#define DSERR_PRIOLEVELNEEDED MAKE_DSHRESULT(70) #define DSERR_PRIOLEVELNEEDED MAKE_DSHRESULT(70)
#endif #endif
#include "../../driver.h" #if defined(_MSC_VER) && !defined(_XBOX)
#include <stdlib.h> #pragma comment(lib, "dsound")
#include <boolean.h> #pragma comment(lib, "dxguid")
#include <stddef.h>
#include <stdint.h>
#include <string.h>
#ifndef _XBOX
// Need these includes in MinGW-w64 4.9 it seems ...
#include <mmreg.h>
#include <mmsystem.h>
#endif #endif
#include <dsound.h>
#include <queues/fifo_buffer.h>
#include "../../general.h"
typedef struct dsound typedef struct dsound
{ {
@ -68,7 +69,7 @@ static INLINE unsigned write_avail(unsigned read_ptr, unsigned write_ptr, unsign
return (read_ptr + buffer_size - write_ptr) % buffer_size; return (read_ptr + buffer_size - write_ptr) % buffer_size;
} }
static INLINE void get_positions(dsound_t *ds, DWORD *read_ptr, DWORD *write_ptr) static INLINE void get_positions(dsound_t *ds, uint32_t *read_ptr, uint32_t *write_ptr)
{ {
IDirectSoundBuffer_GetCurrentPosition(ds->dsb, read_ptr, write_ptr); IDirectSoundBuffer_GetCurrentPosition(ds->dsb, read_ptr, write_ptr);
} }
@ -79,11 +80,11 @@ struct audio_lock
{ {
void *chunk1; void *chunk1;
void *chunk2; void *chunk2;
DWORD size1; uint32_t size1;
DWORD size2; uint32_t size2;
}; };
static INLINE bool grab_region(dsound_t *ds, DWORD write_ptr, static INLINE bool grab_region(dsound_t *ds, uint32_t write_ptr,
struct audio_lock *region) struct audio_lock *region)
{ {
const char *err; const char *err;
@ -137,7 +138,7 @@ static INLINE void release_region(dsound_t *ds, const struct audio_lock *region)
static void dsound_thread(void *data) static void dsound_thread(void *data)
{ {
DWORD write_ptr; uint32_t write_ptr;
dsound_t *ds = (dsound_t*)data; dsound_t *ds = (dsound_t*)data;
SetThreadPriority(GetCurrentThread(), THREAD_PRIORITY_TIME_CRITICAL); SetThreadPriority(GetCurrentThread(), THREAD_PRIORITY_TIME_CRITICAL);
@ -148,7 +149,7 @@ static void dsound_thread(void *data)
while (ds->thread_alive) while (ds->thread_alive)
{ {
struct audio_lock region; struct audio_lock region;
DWORD read_ptr, avail, fifo_avail; uint32_t read_ptr, avail, fifo_avail;
get_positions(ds, &read_ptr, NULL); get_positions(ds, &read_ptr, NULL);
avail = write_avail(read_ptr, write_ptr, ds->buffer_size); avail = write_avail(read_ptr, write_ptr, ds->buffer_size);
@ -237,7 +238,7 @@ static bool dsound_start_thread(dsound_t *ds)
static void dsound_clear_buffer(dsound_t *ds) static void dsound_clear_buffer(dsound_t *ds)
{ {
void *ptr; void *ptr;
DWORD size; uint32_t size;
IDirectSoundBuffer_SetCurrentPosition(ds->dsb, 0); IDirectSoundBuffer_SetCurrentPosition(ds->dsb, 0);
if (IDirectSoundBuffer_Lock(ds->dsb, 0, 0, &ptr, &size, if (IDirectSoundBuffer_Lock(ds->dsb, 0, 0, &ptr, &size,

View File

@ -14,14 +14,17 @@
* If not, see <http://www.gnu.org/licenses/>. * If not, see <http://www.gnu.org/licenses/>.
*/ */
#include "../../driver.h"
#include <stdint.h>
#include <stdio.h> #include <stdio.h>
#include <stdint.h>
#include <stddef.h> #include <stddef.h>
#include <compat/msvc.h>
#include <boolean.h>
#include <stdlib.h> #include <stdlib.h>
#include <boolean.h>
#include <compat/msvc.h>
#include "xaudio.h" #include "xaudio.h"
#include "../../driver.h"
#include "../../general.h" #include "../../general.h"
typedef struct xaudio2 xaudio2_t; typedef struct xaudio2 xaudio2_t;
@ -71,7 +74,7 @@ struct xaudio2 : public IXAudio2VoiceCallback
IXAudio2SourceVoice *pSourceVoice; IXAudio2SourceVoice *pSourceVoice;
HANDLE hEvent; HANDLE hEvent;
volatile long buffers; unsigned long volatile buffers;
unsigned bufsize; unsigned bufsize;
unsigned bufptr; unsigned bufptr;
unsigned write_buffer; unsigned write_buffer;

View File

@ -17,25 +17,8 @@
#ifndef __RARCH_GENERAL_H #ifndef __RARCH_GENERAL_H
#define __RARCH_GENERAL_H #define __RARCH_GENERAL_H
#include <boolean.h>
#include <stdint.h> #include <stdint.h>
#include <limits.h> #include <limits.h>
#include <compat/strl.h>
#include <retro_inline.h>
#include <retro_assert.h>
#include <retro_miscellaneous.h>
#include "configuration.h"
#include "driver.h"
#include "playlist.h"
#include "runloop.h"
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#ifndef PACKAGE_VERSION
#define PACKAGE_VERSION "1.2.2"
#endif
/* Platform-specific headers */ /* Platform-specific headers */
@ -47,13 +30,32 @@
#define WIN32_LEAN_AND_MEAN #define WIN32_LEAN_AND_MEAN
#include <windows.h> #include <windows.h>
#endif #endif
#endif
#include <boolean.h>
#include <compat/strl.h>
#include <compat/posix_string.h> #include <compat/posix_string.h>
#include <retro_inline.h>
#include <retro_assert.h>
#include <retro_miscellaneous.h>
#include "configuration.h"
#include "driver.h"
#include "playlist.h"
#include "runloop.h"
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif #endif
#ifdef HAVE_COMMAND #ifdef HAVE_COMMAND
#include "command.h" #include "command.h"
#endif #endif
#ifndef PACKAGE_VERSION
#define PACKAGE_VERSION "1.2.2"
#endif
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
#endif #endif
@ -156,8 +158,7 @@ static INLINE void rarch_fail(int error_code, const char *error)
* just exit right away. */ * just exit right away. */
rarch_assert(global->inited.error); rarch_assert(global->inited.error);
strlcpy(global->error_string, error, strcpy(global->error_string, error);
sizeof(global->error_string));
longjmp(global->error_sjlj_context, error_code); longjmp(global->error_sjlj_context, error_code);
} }