diff --git a/gfx/common/d3d_common.c b/gfx/common/d3d_common.c index 523299f74f..f68f066fe7 100644 --- a/gfx/common/d3d_common.c +++ b/gfx/common/d3d_common.c @@ -138,15 +138,21 @@ bool d3d_surface_lock_rect(void *data, void *data2) { LPDIRECT3DSURFACE surf = (LPDIRECT3DSURFACE)data; #if defined(HAVE_D3D9) && !defined(__cplusplus) +#if defined(_XBOX) + IDirect3DSurface9_LockRect(surf, (D3DLOCKED_RECT*)data2, NULL, D3DLOCK_READONLY); +#else if (FAILED(IDirect3DSurface9_LockRect(surf, (D3DLOCKED_RECT*)data2, NULL, D3DLOCK_READONLY))) + return false; +#endif #elif defined(HAVE_D3D8) && !defined(__cplusplus) if (FAILED(IDirect3DSurface8_LockRect(surf, (D3DLOCKED_RECT*)data2, NULL, D3DLOCK_READONLY))) + return false; #elif defined(_XBOX) surf->LockRect((D3DLOCKED_RECT*)data2, NULL, D3DLOCK_READONLY); #else if (FAILED(surf->LockRect((D3DLOCKED_RECT*)data2, NULL, D3DLOCK_READONLY))) + return false; #endif - return false; return true; } @@ -332,7 +338,7 @@ bool d3d_device_create_offscreen_plain_surface( void **surf_data, void *data) { -#if defined(HAVE_D3D9) +#if defined(HAVE_D3D9) && !defined(_XBOX) #ifdef __cplusplus if (SUCCEEDED(dev->CreateOffscreenPlainSurface(width, height, (D3DFORMAT)format, (D3DPOOL)pool, @@ -351,6 +357,8 @@ bool d3d_device_create_offscreen_plain_surface( return false; } +#ifndef _XBOX360 +/* XBox 360 has no fixed-function pipeline. */ static void d3d_set_texture_stage_state(LPDIRECT3DDEVICE dev, unsigned sampler, unsigned value, unsigned type) { @@ -362,6 +370,7 @@ static void d3d_set_texture_stage_state(LPDIRECT3DDEVICE dev, dev->SetTextureStageState(sampler, (D3DTEXTURESTAGESTATETYPE)type, value); #endif } +#endif void d3d_set_sampler_address_u(LPDIRECT3DDEVICE dev, unsigned sampler, unsigned value) @@ -434,16 +443,23 @@ void d3d_set_sampler_magfilter(LPDIRECT3DDEVICE dev, bool d3d_begin_scene(LPDIRECT3DDEVICE dev) { #if defined(HAVE_D3D9) && !defined(__cplusplus) - if (SUCCEEDED(IDirect3DDevice9_BeginScene(dev))) +#if defined(_XBOX) + IDirect3DDevice9_BeginScene(dev); +#else + if (FAILED(IDirect3DDevice9_BeginScene(dev))) + return false; +#endif #elif defined(HAVE_D3D8) && !defined(__cplusplus) - if (SUCCEEDED(IDirect3DDevice8_BeginScene(dev))) + if (FAILED(IDirect3DDevice8_BeginScene(dev))) + return false; #elif defined(_XBOX) dev->BeginScene(); #else - if (SUCCEEDED(dev->BeginScene())) + if (FAILED(dev->BeginScene())) + return false; #endif - return true; - return false; + + return true; } void d3d_end_scene(LPDIRECT3DDEVICE dev) @@ -510,10 +526,10 @@ bool d3d_device_get_render_target_data(LPDIRECT3DDEVICE dev, { LPDIRECT3DSURFACE src = (LPDIRECT3DSURFACE)_src; LPDIRECT3DSURFACE dst = (LPDIRECT3DSURFACE)_dst; -#if defined(HAVE_D3D9) && !defined(__cplusplus) +#if defined(HAVE_D3D9) && !defined(__cplusplus) && !defined(_XBOX) if (SUCCEEDED(IDirect3DDevice9_GetRenderTargetData(dev, src, dst))) return true; -#else +#elif !defined(_XBOX) if (SUCCEEDED(dev->GetRenderTargetData(src, dst))) return true; #endif @@ -609,7 +625,11 @@ void d3d_set_texture(LPDIRECT3DDEVICE dev, unsigned sampler, D3DTAG_MASKENCODE(D3DTAG_START(D3DTAG_FETCHCONSTANTS) + fetchConstant, D3DTAG_START(D3DTAG_FETCHCONSTANTS) + fetchConstant); +#if defined(__cplusplus) D3DDevice_SetTexture(dev, sampler, tex, pendingMask3); +#else + D3DDevice_SetTexture(dev, sampler, (D3DBaseTexture*)tex, pendingMask3); +#endif #elif defined(HAVE_D3D9) && !defined(__cplusplus) IDirect3DDevice9_SetTexture(dev, sampler, (IDirect3DBaseTexture9*)tex); #elif defined(HAVE_D3D8) && !defined(__cplusplus) @@ -782,9 +802,9 @@ static bool d3d_reset_internal(LPDIRECT3DDEVICE dev, static HRESULT d3d_test_cooperative_level(LPDIRECT3DDEVICE dev) { -#if defined(HAVE_D3D9) && !defined(__cplusplus) +#if defined(HAVE_D3D9) && !defined(__cplusplus) && !defined(_XBOX) return IDirect3DDevice9_TestCooperativeLevel(dev); -#elif defined(HAVE_D3D8) && !defined(__cplusplus) +#elif defined(HAVE_D3D8) && !defined(__cplusplus) && !defined(_XBOX) return IDirect3DDevice8_TestCooperativeLevel(dev); #elif defined(_XBOX) return E_FAIL; diff --git a/gfx/drivers/d3d.c b/gfx/drivers/d3d.c index 63c007c081..f45b7903fe 100644 --- a/gfx/drivers/d3d.c +++ b/gfx/drivers/d3d.c @@ -605,8 +605,10 @@ void d3d_make_d3dpp(void *data, if (widescreen_mode) d3dpp->Flags |= D3DPRESENTFLAG_WIDESCREEN; #elif defined(_XBOX360) +#if 0 if (!widescreen_mode) d3dpp->Flags |= D3DPRESENTFLAG_NO_LETTERBOX; +#endif if (global->console.screen.gamma_correction) d3dpp->FrontBufferFormat = (D3DFORMAT) diff --git a/gfx/drivers_context/d3d_ctx.c b/gfx/drivers_context/d3d_ctx.c index c7916b59d8..d5e3923be9 100644 --- a/gfx/drivers_context/d3d_ctx.c +++ b/gfx/drivers_context/d3d_ctx.c @@ -246,13 +246,14 @@ static void gfx_ctx_d3d_get_video_size(void *data, unsigned *width, unsigned *height) { #ifdef _XBOX +#ifdef _XBOX360 + XVIDEO_MODE video_mode; +#endif d3d_video_t *d3d = (d3d_video_t*)data; (void)width; (void)height; #if defined(_XBOX360) - XVIDEO_MODE video_mode; - XGetVideoMode(&video_mode); *width = video_mode.dwDisplayWidth; diff --git a/gfx/video_filters/2xbr.c b/gfx/video_filters/2xbr.c index c88f3b09e4..4dd94db1d0 100644 --- a/gfx/video_filters/2xbr.c +++ b/gfx/video_filters/2xbr.c @@ -224,11 +224,10 @@ static void *twoxbr_generic_create(const struct softfilter_config *config, unsigned max_width, unsigned max_height, unsigned threads, softfilter_simd_mask_t simd, void *userdata) { + struct filter_data *filt = (struct filter_data*)calloc(1, sizeof(*filt)); (void)simd; (void)config; (void)userdata; - - struct filter_data *filt = (struct filter_data*)calloc(1, sizeof(*filt)); if (!filt) return NULL; filt->workers = (struct softfilter_thread_data*) diff --git a/gfx/video_filters/2xsai.c b/gfx/video_filters/2xsai.c index 45fd1194d9..42a005143a 100644 --- a/gfx/video_filters/2xsai.c +++ b/gfx/video_filters/2xsai.c @@ -67,11 +67,11 @@ static void *twoxsai_generic_create(const struct softfilter_config *config, unsigned max_width, unsigned max_height, unsigned threads, softfilter_simd_mask_t simd, void *userdata) { + struct filter_data *filt = (struct filter_data*)calloc(1, sizeof(*filt)); + (void)simd; (void)config; (void)userdata; - - struct filter_data *filt = (struct filter_data*)calloc(1, sizeof(*filt)); if (!filt) return NULL; filt->workers = (struct softfilter_thread_data*) diff --git a/gfx/video_filters/blargg_ntsc_snes.c b/gfx/video_filters/blargg_ntsc_snes.c index 85e59338d6..a8a3ea715a 100644 --- a/gfx/video_filters/blargg_ntsc_snes.c +++ b/gfx/video_filters/blargg_ntsc_snes.c @@ -124,9 +124,8 @@ static void *blargg_ntsc_snes_generic_create(const struct softfilter_config *con unsigned max_width, unsigned max_height, unsigned threads, softfilter_simd_mask_t simd, void *userdata) { - (void)simd; - struct filter_data *filt = (struct filter_data*)calloc(1, sizeof(*filt)); + (void)simd; if (!filt) return NULL; filt->workers = (struct softfilter_thread_data*) diff --git a/gfx/video_filters/darken.c b/gfx/video_filters/darken.c index 0a9fc1a0d0..b4b3a573a1 100644 --- a/gfx/video_filters/darken.c +++ b/gfx/video_filters/darken.c @@ -66,11 +66,10 @@ static void *darken_create(const struct softfilter_config *config, unsigned max_width, unsigned max_height, unsigned threads, softfilter_simd_mask_t simd, void *userdata) { + struct filter_data *filt = (struct filter_data*)calloc(1, sizeof(*filt)); (void)simd; (void)config; (void)userdata; - - struct filter_data *filt = (struct filter_data*)calloc(1, sizeof(*filt)); if (!filt) return NULL; filt->workers = (struct softfilter_thread_data*) diff --git a/gfx/video_filters/epx.c b/gfx/video_filters/epx.c index ec8c031cec..2fa0407d96 100644 --- a/gfx/video_filters/epx.c +++ b/gfx/video_filters/epx.c @@ -67,11 +67,10 @@ static void *epx_generic_create(const struct softfilter_config *config, unsigned max_width, unsigned max_height, unsigned threads, softfilter_simd_mask_t simd, void *userdata) { + struct filter_data *filt = (struct filter_data*)calloc(1, sizeof(*filt)); (void)simd; (void)config; (void)userdata; - - struct filter_data *filt = (struct filter_data*)calloc(1, sizeof(*filt)); if (!filt) return NULL; filt->workers = (struct softfilter_thread_data*) diff --git a/gfx/video_filters/lq2x.c b/gfx/video_filters/lq2x.c index 643dcefbfc..fc362801ad 100644 --- a/gfx/video_filters/lq2x.c +++ b/gfx/video_filters/lq2x.c @@ -66,11 +66,10 @@ static void *lq2x_generic_create(const struct softfilter_config *config, unsigned max_width, unsigned max_height, unsigned threads, softfilter_simd_mask_t simd, void *userdata) { + struct filter_data *filt = (struct filter_data*)calloc(1, sizeof(*filt)); (void)simd; (void)config; (void)userdata; - - struct filter_data *filt = (struct filter_data*)calloc(1, sizeof(*filt)); if (!filt) return NULL; filt->workers = (struct softfilter_thread_data*) diff --git a/gfx/video_filters/scale2x.c b/gfx/video_filters/scale2x.c index 2b71eb5f74..34269b236d 100644 --- a/gfx/video_filters/scale2x.c +++ b/gfx/video_filters/scale2x.c @@ -129,11 +129,10 @@ static void *scale2x_generic_create(const struct softfilter_config *config, unsigned max_width, unsigned max_height, unsigned threads, softfilter_simd_mask_t simd, void *userdata) { + struct filter_data *filt = (struct filter_data*)calloc(1, sizeof(*filt)); (void)simd; (void)config; (void)userdata; - - struct filter_data *filt = (struct filter_data*)calloc(1, sizeof(*filt)); if (!filt) return NULL; filt->workers = (struct softfilter_thread_data*) diff --git a/gfx/video_filters/supereagle.c b/gfx/video_filters/supereagle.c index 1901e6a369..06b7c4c8c1 100644 --- a/gfx/video_filters/supereagle.c +++ b/gfx/video_filters/supereagle.c @@ -68,11 +68,10 @@ static void *supereagle_generic_create(const struct softfilter_config *config, unsigned max_width, unsigned max_height, unsigned threads, softfilter_simd_mask_t simd, void *userdata) { + struct filter_data *filt = (struct filter_data*)calloc(1, sizeof(*filt)); (void)simd; (void)config; (void)userdata; - - struct filter_data *filt = (struct filter_data*)calloc(1, sizeof(*filt)); if (!filt) return NULL; filt->workers = (struct softfilter_thread_data*)calloc(threads, sizeof(struct softfilter_thread_data)); diff --git a/input/drivers/xdk_xinput_input.c b/input/drivers/xdk_xinput_input.c index 57293d87e7..6b3b365121 100644 --- a/input/drivers/xdk_xinput_input.c +++ b/input/drivers/xdk_xinput_input.c @@ -112,15 +112,16 @@ static uint64_t xdk_input_get_capabilities(void *data) static bool xdk_input_set_rumble(void *data, unsigned port, enum retro_rumble_effect effect, uint16_t strength) { +#ifdef _XBOX360 + XINPUT_VIBRATION rumble_state; +#endif xdk_input_t *xdk = (xdk_input_t*)data; + bool val = false; + (void)xdk; - bool val = false; - #if 0 #if defined(_XBOX360) - XINPUT_VIBRATION rumble_state; - if (effect == RETRO_RUMBLE_STRONG) rumble_state.wLeftMotorSpeed = strength; else if (effect == RETRO_RUMBLE_WEAK) diff --git a/input/drivers_joypad/xdk_joypad.c b/input/drivers_joypad/xdk_joypad.c index d9549428a3..6bdb3d25b3 100644 --- a/input/drivers_joypad/xdk_joypad.c +++ b/input/drivers_joypad/xdk_joypad.c @@ -142,6 +142,9 @@ static void xdk_joypad_poll(void) for (port = 0; port < MAX_PADS; port++) { + unsigned i, j; + XINPUT_STATE state_tmp; + uint64_t *state_cur = NULL; #ifdef _XBOX1 XINPUT_CAPABILITIES caps[MAX_PADS]; (void)caps; @@ -187,8 +190,6 @@ static void xdk_joypad_poll(void) * the device handle will be NULL. */ #endif - XINPUT_STATE state_tmp; - #if defined(_XBOX1) if (XInputPoll(gamepads[port]) != ERROR_SUCCESS) continue; @@ -200,7 +201,7 @@ static void xdk_joypad_poll(void) continue; #endif - uint64_t *state_cur = &pad_state[port]; + state_cur = &pad_state[port]; *state_cur = 0; *state_cur |= ((state_tmp.Gamepad.wButtons & XINPUT_GAMEPAD_DPAD_LEFT) ? (UINT64_C(1) << RETRO_DEVICE_ID_JOYPAD_LEFT) : 0); @@ -237,8 +238,8 @@ static void xdk_joypad_poll(void) analog_state[port][RETRO_DEVICE_INDEX_ANALOG_RIGHT][RETRO_DEVICE_ID_ANALOG_X] = state_tmp.Gamepad.sThumbRX; analog_state[port][RETRO_DEVICE_INDEX_ANALOG_RIGHT][RETRO_DEVICE_ID_ANALOG_Y] = state_tmp.Gamepad.sThumbRY; - for (int i = 0; i < 2; i++) - for (int j = 0; j < 2; j++) + for (i = 0; i < 2; i++) + for (j = 0; j < 2; j++) if (analog_state[port][i][j] == -0x8000) analog_state[port][i][j] = -0x7fff; } diff --git a/libretro-common/audio/dsp_filters/fft/fft.c b/libretro-common/audio/dsp_filters/fft/fft.c index cc6b958161..e8c80f4f9d 100644 --- a/libretro-common/audio/dsp_filters/fft/fft.c +++ b/libretro-common/audio/dsp_filters/fft/fft.c @@ -98,12 +98,12 @@ static void resolve_float(float *out, const fft_complex_t *in, unsigned samples, fft_t *fft_new(unsigned block_size_log2) { + unsigned size; fft_t *fft = (fft_t*)calloc(1, sizeof(*fft)); if (!fft) return NULL; - unsigned size = 1 << block_size_log2; - + size = 1 << block_size_log2; fft->interleave_buffer = (fft_complex_t*)calloc(size, sizeof(*fft->interleave_buffer)); fft->bitinverse_buffer = (unsigned*)calloc(size, sizeof(*fft->bitinverse_buffer)); fft->phase_lut = (fft_complex_t*)calloc(2 * size + 1, sizeof(*fft->phase_lut)); diff --git a/pkg/msvc/RetroArch-360/RetroArch-360.vcxproj b/pkg/msvc/RetroArch-360/RetroArch-360.vcxproj index c45fedc947..3006d90de9 100644 --- a/pkg/msvc/RetroArch-360/RetroArch-360.vcxproj +++ b/pkg/msvc/RetroArch-360/RetroArch-360.vcxproj @@ -355,7 +355,14 @@ - + + CompileAsC + CompileAsC + CompileAsC + CompileAsC + CompileAsC + CompileAsC + @@ -438,4 +445,4 @@ - + \ No newline at end of file