diff --git a/Makefile b/Makefile index 3fdddf1c25..c4867112bb 100644 --- a/Makefile +++ b/Makefile @@ -16,10 +16,12 @@ include config.mk TARGET = retroarch +OBJDIR_BASE := obj-unix + ifeq ($(DEBUG), 1) - OBJDIR := obj-unix/debug + OBJDIR := $(OBJDIR_BASE)/debug else - OBJDIR := obj-unix/release + OBJDIR := $(OBJDIR_BASE)/release endif OBJ := @@ -236,7 +238,7 @@ uninstall: rm -rf $(DESTDIR)$(ASSETS_DIR)/retroarch clean: - rm -rf $(OBJDIR) + rm -rf $(OBJDIR_BASE) rm -f $(TARGET) rm -f *.d diff --git a/Makefile.msvc b/Makefile.msvc index 8dd970b0d4..93c9177ae2 100644 --- a/Makefile.msvc +++ b/Makefile.msvc @@ -126,7 +126,7 @@ FLAGS += -Gm- -Zc:inline -fp:precise -Zc:forScope -GR- -Gd -Oi -volatile:iso CFLAGS += -TC CXXFLAGS += -TP -EHsc WARNINGS += -WX -W3 -WARNINGS += -wd4101 -wd4996 -wd4244 -wd4267 -wd4090 -wd4305 -wd4146 -wd4334 -wd4018 +WARNINGS += -wd4101 -wd4996 -wd4244 -wd4267 -wd4090 -wd4305 -wd4146 -wd4334 -wd4018 -wd4800 CC = cl.exe CXX = cl.exe diff --git a/gfx/common/d3d10_common.h b/gfx/common/d3d10_common.h index d85cc7d7f3..18fc881a7a 100644 --- a/gfx/common/d3d10_common.h +++ b/gfx/common/d3d10_common.h @@ -17,66 +17,8 @@ #include -#ifdef __MINGW32__ -#define __REQUIRED_RPCNDR_H_VERSION__ 475 -#define _In_ -#define _In_opt_ -#define _Null_ - -#define _Out_writes_bytes_opt_(s) -#define _Inout_opt_bytecount_(s) - -#define __in -#define __out -#define __in_bcount(size) -#define __in_ecount(size) -#define __out_bcount(size) -#define __out_bcount_part(size, length) -#define __out_ecount(size) -#define __inout -#define __deref_out_ecount(size) -#endif - -#define CINTERFACE -#define COBJMACROS -#if 0 -#ifdef __GNUC__ -#define WIDL_C_INLINE_WRAPPERS -#include <_mingw.h> -#undef __forceinline -#define __forceinline inline __attribute__((__always_inline__)) -#endif -#endif - -#include #include "dxgi_common.h" - -#ifndef countof -#define countof(a) (sizeof(a) / sizeof(*a)) -#endif - -#ifndef __uuidof -#define __uuidof(type) & IID_##type -#endif - -#ifndef COM_RELEASE_DECLARED -#define COM_RELEASE_DECLARED -#if defined(__cplusplus) && !defined(CINTERFACE) -static INLINE ULONG Release(IUnknown* object) -{ - if (object) - return object->Release(); - return 0; -} -#else -static INLINE ULONG Release(void* object) -{ - if (object) - return ((IUnknown*)object)->lpVtbl->Release(object); - return 0; -} -#endif -#endif +#include typedef ID3D10InputLayout* D3D10InputLayout; typedef ID3D10RasterizerState* D3D10RasterizerState; @@ -823,7 +765,7 @@ static INLINE HRESULT D3D10OpenSharedResource(D3D10Device device, HANDLE h_resource, ID3D10Resource** out) { return device->lpVtbl->OpenSharedResource( - device, h_resource, __uuidof(ID3D10Resource), (void**)out); + device, h_resource, uuidof(ID3D10Resource), (void**)out); } static INLINE void D3D10SetTextFilterSize(D3D10Device device, UINT width, UINT height) { @@ -1049,7 +991,7 @@ static INLINE BOOL D3D10GetMuteDebugOutput(D3D10InfoQueue info_queue) static INLINE HRESULT DXGIGetSwapChainBufferD3D10(DXGISwapChain swap_chain, UINT buffer, D3D10Texture2D* out) { - return swap_chain->lpVtbl->GetBuffer(swap_chain, buffer, __uuidof(ID3D10Texture2D), (void**)out); + return swap_chain->lpVtbl->GetBuffer(swap_chain, buffer, uuidof(ID3D10Texture2D), (void**)out); } static INLINE void D3D10CopyTexture2DSubresourceRegion( D3D10Device device, diff --git a/gfx/common/d3d11_common.c b/gfx/common/d3d11_common.c index 36b5a51998..6866c5d3d8 100644 --- a/gfx/common/d3d11_common.c +++ b/gfx/common/d3d11_common.c @@ -19,7 +19,6 @@ #ifdef HAVE_DYNAMIC #include - HRESULT WINAPI D3D11CreateDeviceAndSwapChain( IDXGIAdapter* pAdapter, D3D_DRIVER_TYPE DriverType, @@ -34,7 +33,7 @@ HRESULT WINAPI D3D11CreateDeviceAndSwapChain( D3D_FEATURE_LEVEL* pFeatureLevel, ID3D11DeviceContext** ppImmediateContext) { - static dylib_t d3d11_dll; + static dylib_t d3d11_dll; static PFN_D3D11_CREATE_DEVICE_AND_SWAP_CHAIN fp; if (!d3d11_dll) @@ -86,11 +85,11 @@ void d3d11_init_texture(D3D11Device device, d3d11_texture_t* texture) D3D11CreateTexture2D(device, &texture->desc, NULL, &texture->handle); { - D3D11_SHADER_RESOURCE_VIEW_DESC view_desc = { 0 }; - view_desc.Format = texture->desc.Format; - view_desc.ViewDimension = D3D_SRV_DIMENSION_TEXTURE2D; - view_desc.Texture2D.MostDetailedMip = 0; - view_desc.Texture2D.MipLevels = -1; + D3D11_SHADER_RESOURCE_VIEW_DESC view_desc = { 0 }; + view_desc.Format = texture->desc.Format; + view_desc.ViewDimension = D3D_SRV_DIMENSION_TEXTURE2D; + view_desc.Texture2D.MostDetailedMip = 0; + view_desc.Texture2D.MipLevels = -1; D3D11CreateTexture2DShaderResourceView(device, texture->handle, &view_desc, &texture->view); } @@ -150,7 +149,7 @@ d3d11_get_closest_match(D3D11Device device, DXGI_FORMAT desired_format, UINT des bool d3d11_init_shader( D3D11Device device, - void* src, + const void* src, size_t size, LPCSTR vs_entry, LPCSTR ps_entry, diff --git a/gfx/common/d3d11_common.h b/gfx/common/d3d11_common.h index f44b420e82..a01a1e48d6 100644 --- a/gfx/common/d3d11_common.h +++ b/gfx/common/d3d11_common.h @@ -17,66 +17,8 @@ #include -#ifdef __MINGW32__ -#define __REQUIRED_RPCNDR_H_VERSION__ 475 -#define _In_ -#define _In_opt_ -#define _Null_ - -#define _Out_writes_bytes_opt_(s) -#define _Inout_opt_bytecount_(s) - -#define __in -#define __out -#define __in_bcount(size) -#define __in_ecount(size) -#define __out_bcount(size) -#define __out_bcount_part(size, length) -#define __out_ecount(size) -#define __inout -#define __deref_out_ecount(size) -#endif - -#define CINTERFACE -#define COBJMACROS -#if 0 -#ifdef __GNUC__ -#define WIDL_C_INLINE_WRAPPERS -#include <_mingw.h> -#undef __forceinline -#define __forceinline inline __attribute__((__always_inline__)) -#endif -#endif - -#include #include "dxgi_common.h" - -#ifndef countof -#define countof(a) (sizeof(a) / sizeof(*a)) -#endif - -#ifndef __uuidof -#define __uuidof(type) & IID_##type -#endif - -#ifndef COM_RELEASE_DECLARED -#define COM_RELEASE_DECLARED -#if defined(__cplusplus) && !defined(CINTERFACE) -static INLINE ULONG Release(IUnknown* object) -{ - if (object) - return object->Release(); - return 0; -} -#else -static INLINE ULONG Release(void* object) -{ - if (object) - return ((IUnknown*)object)->lpVtbl->Release(object); - return 0; -} -#endif -#endif +#include typedef ID3D11InputLayout* D3D11InputLayout; typedef ID3D11RasterizerState* D3D11RasterizerState; @@ -2103,7 +2045,7 @@ static INLINE HRESULT D3D11OpenSharedResource(D3D11Device device, HANDLE h_resource, ID3D11Resource** out) { return device->lpVtbl->OpenSharedResource( - device, h_resource, __uuidof(ID3D11Resource), (void**)out); + device, h_resource, uuidof(ID3D11Resource), (void**)out); } static INLINE HRESULT D3D11CheckFormatSupport(D3D11Device device, DXGI_FORMAT format, UINT* format_support) @@ -2393,7 +2335,7 @@ static INLINE BOOL D3D11GetMuteDebugOutput(D3D11InfoQueue info_queue) static INLINE HRESULT DXGIGetSwapChainBufferD3D11(DXGISwapChain swap_chain, UINT buffer, D3D11Texture2D* out) { - return swap_chain->lpVtbl->GetBuffer(swap_chain, buffer, __uuidof(ID3D11Texture2D), (void**)out); + return swap_chain->lpVtbl->GetBuffer(swap_chain, buffer, uuidof(ID3D11Texture2D), (void**)out); } static INLINE HRESULT D3D11MapTexture2D( @@ -2507,7 +2449,6 @@ typedef struct #define ALIGN(x) __declspec(align(x)) #else #define ALIGN(x) __attribute__((aligned(x))) -#define static_assert _Static_assert #endif #endif @@ -2614,7 +2555,7 @@ d3d11_set_texture_and_sampler(D3D11DeviceContext ctx, UINT slot, d3d11_texture_t bool d3d11_init_shader( D3D11Device device, - void* src, + const void* src, size_t size, LPCSTR vs_entry, LPCSTR ps_entry, diff --git a/gfx/common/d3d12_common.h b/gfx/common/d3d12_common.h index da1067c734..58b3c985d2 100644 --- a/gfx/common/d3d12_common.h +++ b/gfx/common/d3d12_common.h @@ -17,58 +17,8 @@ #include -#ifdef __MINGW32__ -#define __REQUIRED_RPCNDR_H_VERSION__ 475 -#define _In_ -#define _In_opt_ -#define _Null_ -#define __in_ecount_opt(s) -#define static_assert _Static_assert -#define _Out_writes_bytes_opt_(s) - -#define __in -#define __out -#define __in_bcount(size) -#define __in_ecount(size) -#define __out_bcount(size) -#define __out_bcount_part(size, length) -#define __out_ecount(size) -#define __inout -#define __deref_out_ecount(size) -#endif - -#define CINTERFACE -#include #include "dxgi_common.h" - -#ifndef countof -#define countof(a) (sizeof(a) / sizeof(*a)) -#endif - -#ifndef __uuidof -#define __uuidof(type) & IID_##type -#endif - -#ifndef COM_RELEASE_DECLARED -#define COM_RELEASE_DECLARED -#if defined(__cplusplus) && !defined(CINTERFACE) -static INLINE ULONG Release(IUnknown* object) -{ - if (object) - return object->Release(); - - return 0; -} -#else -static INLINE ULONG Release(void* object) -{ - if (object) - return ((IUnknown*)object)->lpVtbl->Release(object); - - return 0; -} -#endif -#endif +#include /* auto-generated */ @@ -690,25 +640,25 @@ static INLINE HRESULT D3D12CreateCommandQueue( D3D12Device device, D3D12_COMMAND_QUEUE_DESC* desc, ID3D12CommandQueue** out) { return device->lpVtbl->CreateCommandQueue( - device, desc, __uuidof(ID3D12CommandQueue), (void**)out); + device, desc, uuidof(ID3D12CommandQueue), (void**)out); } static INLINE HRESULT D3D12CreateCommandAllocator( D3D12Device device, D3D12_COMMAND_LIST_TYPE type, ID3D12CommandAllocator** out) { return device->lpVtbl->CreateCommandAllocator( - device, type, __uuidof(ID3D12CommandAllocator), (void**)out); + device, type, uuidof(ID3D12CommandAllocator), (void**)out); } static INLINE HRESULT D3D12CreateGraphicsPipelineState( D3D12Device device, D3D12_GRAPHICS_PIPELINE_STATE_DESC* desc, ID3D12PipelineState** out) { return device->lpVtbl->CreateGraphicsPipelineState( - device, desc, __uuidof(ID3D12PipelineState), (void**)out); + device, desc, uuidof(ID3D12PipelineState), (void**)out); } static INLINE HRESULT D3D12CreateComputePipelineState( D3D12Device device, D3D12_COMPUTE_PIPELINE_STATE_DESC* desc, ID3D12PipelineState** out) { return device->lpVtbl->CreateComputePipelineState( - device, desc, __uuidof(ID3D12PipelineState), (void**)out); + device, desc, uuidof(ID3D12PipelineState), (void**)out); } static INLINE HRESULT D3D12CreateCommandList( D3D12Device device, @@ -719,7 +669,7 @@ static INLINE HRESULT D3D12CreateCommandList( ID3D12CommandList** out) { return device->lpVtbl->CreateCommandList( - device, node_mask, type, command_allocator, initial_state, __uuidof(ID3D12CommandList), + device, node_mask, type, command_allocator, initial_state, uuidof(ID3D12CommandList), (void**)out); } static INLINE HRESULT D3D12CheckFeatureSupport( @@ -737,7 +687,7 @@ static INLINE HRESULT D3D12CreateDescriptorHeap( D3D12DescriptorHeap* out) { return device->lpVtbl->CreateDescriptorHeap( - device, descriptor_heap_desc, __uuidof(ID3D12DescriptorHeap), (void**)out); + device, descriptor_heap_desc, uuidof(ID3D12DescriptorHeap), (void**)out); } static INLINE UINT D3D12GetDescriptorHandleIncrementSize( D3D12Device device, D3D12_DESCRIPTOR_HEAP_TYPE descriptor_heap_type) @@ -753,7 +703,7 @@ static INLINE HRESULT D3D12CreateRootSignature( { return device->lpVtbl->CreateRootSignature( device, node_mask, blob_with_root_signature, blob_length_in_bytes, - __uuidof(ID3D12RootSignature), (void**)out); + uuidof(ID3D12RootSignature), (void**)out); } static INLINE void D3D12CreateConstantBufferView( D3D12Device device, @@ -853,11 +803,11 @@ static INLINE HRESULT D3D12CreateCommittedResource( { return device->lpVtbl->CreateCommittedResource( device, heap_properties, heap_flags, desc, initial_resource_state, optimized_clear_value, - __uuidof(ID3D12Resource), (void**)out); + uuidof(ID3D12Resource), (void**)out); } static INLINE HRESULT D3D12CreateHeap(D3D12Device device, D3D12_HEAP_DESC* desc, ID3D12Heap** out) { - return device->lpVtbl->CreateHeap(device, desc, __uuidof(ID3D12Heap), (void**)out); + return device->lpVtbl->CreateHeap(device, desc, uuidof(ID3D12Heap), (void**)out); } static INLINE HRESULT D3D12CreatePlacedResource( D3D12Device device, @@ -870,7 +820,7 @@ static INLINE HRESULT D3D12CreatePlacedResource( { return device->lpVtbl->CreatePlacedResource( device, heap, heap_offset, desc, initial_state, optimized_clear_value, - __uuidof(ID3D12Resource), (void**)out); + uuidof(ID3D12Resource), (void**)out); } static INLINE HRESULT D3D12CreateReservedResource( D3D12Device device, @@ -880,13 +830,13 @@ static INLINE HRESULT D3D12CreateReservedResource( ID3D12Resource** out) { return device->lpVtbl->CreateReservedResource( - device, desc, initial_state, optimized_clear_value, __uuidof(ID3D12Resource), (void**)out); + device, desc, initial_state, optimized_clear_value, uuidof(ID3D12Resource), (void**)out); } static INLINE HRESULT D3D12CreateFence( D3D12Device device, UINT64 initial_value, D3D12_FENCE_FLAGS flags, ID3D12Fence** out) { return device->lpVtbl->CreateFence( - device, initial_value, flags, __uuidof(ID3D12Fence), (void**)out); + device, initial_value, flags, uuidof(ID3D12Fence), (void**)out); } static INLINE HRESULT D3D12GetDeviceRemovedReason(D3D12Device device) { @@ -910,7 +860,7 @@ static INLINE void D3D12GetCopyableFootprints( static INLINE HRESULT D3D12CreateQueryHeap(D3D12Device device, D3D12_QUERY_HEAP_DESC* desc, ID3D12Heap** out) { - return device->lpVtbl->CreateQueryHeap(device, desc, __uuidof(ID3D12Heap), (void**)out); + return device->lpVtbl->CreateQueryHeap(device, desc, uuidof(ID3D12Heap), (void**)out); } static INLINE HRESULT D3D12SetStablePowerState(D3D12Device device, BOOL enable) { @@ -923,7 +873,7 @@ static INLINE HRESULT D3D12CreateCommandSignature( ID3D12CommandSignature** out) { return device->lpVtbl->CreateCommandSignature( - device, desc, root_signature, __uuidof(ID3D12CommandSignature), (void**)out); + device, desc, root_signature, uuidof(ID3D12CommandSignature), (void**)out); } static INLINE void D3D12GetResourceTiling( D3D12Device device, @@ -960,7 +910,7 @@ static INLINE HRESULT D3D12LoadGraphicsPipeline( ID3D12PipelineState** out) { return pipeline_library->lpVtbl->LoadGraphicsPipeline( - pipeline_library, name, desc, __uuidof(ID3D12PipelineState), (void**)out); + pipeline_library, name, desc, uuidof(ID3D12PipelineState), (void**)out); } static INLINE HRESULT D3D12LoadComputePipeline( D3D12PipelineLibrary pipeline_library, @@ -969,7 +919,7 @@ static INLINE HRESULT D3D12LoadComputePipeline( ID3D12PipelineState** out) { return pipeline_library->lpVtbl->LoadComputePipeline( - pipeline_library, name, desc, __uuidof(ID3D12PipelineState), (void**)out); + pipeline_library, name, desc, uuidof(ID3D12PipelineState), (void**)out); } static INLINE SIZE_T D3D12GetSerializedSize(D3D12PipelineLibrary pipeline_library) { @@ -1204,14 +1154,14 @@ static INLINE BOOL D3D12GetMuteDebugOutput(D3D12InfoQueue info_queue) static INLINE HRESULT D3D12GetDebugInterface_(D3D12Debug* out) { - return D3D12GetDebugInterface(__uuidof(ID3D12Debug), (void**)out); + return D3D12GetDebugInterface(uuidof(ID3D12Debug), (void**)out); } static INLINE HRESULT D3D12CreateDevice_(DXGIAdapter adapter, D3D_FEATURE_LEVEL MinimumFeatureLevel, D3D12Device* out) { return D3D12CreateDevice( - (IUnknown*)adapter, MinimumFeatureLevel, __uuidof(ID3D12Device), (void**)out); + (IUnknown*)adapter, MinimumFeatureLevel, uuidof(ID3D12Device), (void**)out); } static INLINE HRESULT D3D12CreateGraphicsCommandList( @@ -1224,7 +1174,7 @@ static INLINE HRESULT D3D12CreateGraphicsCommandList( { return device->lpVtbl->CreateCommandList( device, node_mask, type, command_allocator, initial_state, - __uuidof(ID3D12GraphicsCommandList), (void**)out); + uuidof(ID3D12GraphicsCommandList), (void**)out); } static INLINE void D3D12ClearRenderTargetView( @@ -1258,7 +1208,7 @@ static INLINE HRESULT DXGIGetSwapChainBuffer(DXGISwapChain swapchain, UINT buffer, D3D12Resource* surface) { return swapchain->lpVtbl->GetBuffer( - swapchain, buffer, __uuidof(ID3D12Resource), (void**)surface); + swapchain, buffer, uuidof(ID3D12Resource), (void**)surface); } static INLINE void D3D12SetDescriptorHeaps( D3D12GraphicsCommandList command_list, diff --git a/gfx/common/d3dcompiler_common.h b/gfx/common/d3dcompiler_common.h index a95e358b87..f05e3dc4d2 100644 --- a/gfx/common/d3dcompiler_common.h +++ b/gfx/common/d3dcompiler_common.h @@ -18,61 +18,15 @@ #include #include -#ifdef __MINGW32__ -#define __REQUIRED_RPCNDR_H_VERSION__ 475 -#define _In_ -#define _In_opt_ -#define _Null_ - -#define _Out_writes_bytes_opt_(s) - -#define __in -#define __out -#define __in_bcount(size) -#define __in_ecount(size) -#define __out_bcount(size) -#define __out_bcount_part(size, length) -#define __out_ecount(size) -#define __inout -#define __deref_out_ecount(size) -#endif - -#define CINTERFACE +#include "dxgi_common.h" #include #include -#ifndef countof -#define countof(a) (sizeof(a) / sizeof(*a)) -#endif - -#ifndef __uuidof -#define __uuidof(type) & IID_##type -#endif - -#ifndef COM_RELEASE_DECLARED -#define COM_RELEASE_DECLARED -#if defined(__cplusplus) && !defined(CINTERFACE) -static INLINE ULONG Release(IUnknown* object) -{ - if (object) - return object->Release(); - return 0; -} -#else -static INLINE ULONG Release(void* object) -{ - if (object) - return ((IUnknown*)object)->lpVtbl->Release(object); - return 0; -} -#endif -#endif - /* auto-generated */ typedef ID3DBlob* D3DBlob; typedef ID3DDestructionNotifier* D3DDestructionNotifier; - +#if !defined(__cplusplus) || defined(CINTERFACE) static INLINE ULONG D3DReleaseBlob(D3DBlob blob) { return blob->lpVtbl->Release(blob); } static INLINE LPVOID D3DGetBufferPointer(D3DBlob blob) { @@ -98,7 +52,7 @@ D3DUnregisterDestructionCallback(D3DDestructionNotifier destruction_notifier, UI return destruction_notifier->lpVtbl->UnregisterDestructionCallback( destruction_notifier, callback_id); } - +#endif /* end of auto-generated */ bool d3d_compile(const char* src, size_t size, LPCSTR entrypoint, LPCSTR target, D3DBlob* out); diff --git a/gfx/common/dxgi_common.c b/gfx/common/dxgi_common.c index a0436a2e1e..4b68a99ed1 100644 --- a/gfx/common/dxgi_common.c +++ b/gfx/common/dxgi_common.c @@ -13,15 +13,28 @@ * If not, see . */ +#include +#include #include -#include + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif #include "dxgi_common.h" +#include "../../configuration.h" +#include "../../verbosity.h" +#include "../../ui/ui_companion_driver.h" +#include "../video_driver.h" +#include "win32_common.h" + +#ifdef HAVE_DYNAMIC +#include HRESULT WINAPI CreateDXGIFactory1(REFIID riid, void** ppFactory) { static HRESULT(WINAPI * fp)(REFIID, void**); -#ifdef HAVE_DYNAMIC + static dylib_t dxgi_dll; if (!dxgi_dll) @@ -32,15 +45,13 @@ HRESULT WINAPI CreateDXGIFactory1(REFIID riid, void** ppFactory) if (!fp) fp = (HRESULT(WINAPI*)(REFIID, void**))dylib_proc(dxgi_dll, "CreateDXGIFactory1"); -#else - fp = CreateDXGIFactory1; -#endif if (!fp) return TYPE_E_CANTLOADLIBRARY; return fp(riid, ppFactory); } +#endif DXGI_FORMAT* dxgi_get_format_fallback_list(DXGI_FORMAT format) { @@ -267,3 +278,55 @@ void dxgi_copy( #ifdef _MSC_VER #pragma warning(default : 4293) #endif + +void dxgi_update_title(video_frame_info_t* video_info) +{ + const ui_window_t* window = ui_companion_driver_get_window_ptr(); + + if (video_info->fps_show) + { + MEMORYSTATUS stat; + char mem[128]; + + mem[0] = '\0'; + + GlobalMemoryStatus(&stat); + snprintf( + mem, sizeof(mem), "|| MEM: %.2f/%.2fMB", stat.dwAvailPhys / (1024.0f * 1024.0f), + stat.dwTotalPhys / (1024.0f * 1024.0f)); + strlcat(video_info->fps_text, mem, sizeof(video_info->fps_text)); + } + + if (window) + { + char title[128]; + + title[0] = '\0'; + + video_driver_get_window_title(title, sizeof(title)); + + if (title[0]) + window->set_title(&main_window, title); + } +} + +void dxgi_input_driver(const char* name, const input_driver_t** input, void** input_data) +{ + settings_t* settings = config_get_ptr(); + +#if _WIN32_WINNT >= 0x0501 + /* winraw only available since XP */ + if (string_is_equal(settings->arrays.input_driver, "raw")) + { + *input_data = input_winraw.init(name); + if (*input_data) + { + *input = &input_winraw; + return; + } + } +#endif + + *input_data = input_dinput.init(name); + *input = *input_data ? &input_dinput : NULL; +} diff --git a/gfx/common/dxgi_common.h b/gfx/common/dxgi_common.h index 2ec6721f80..7978604ea9 100644 --- a/gfx/common/dxgi_common.h +++ b/gfx/common/dxgi_common.h @@ -4,14 +4,211 @@ #ifdef __MINGW32__ #define __REQUIRED_RPCNDR_H_VERSION__ 475 +/* Pointer parameters */ #define _In_ -#define _In_opt_ -#define _Null_ +#define _Out_ +#define _Inout_ +#define _In_z_ +#define _Inout_z_ +#define _In_reads_(s) +#define _In_reads_bytes_(s) +#define _In_reads_z_(s) +#define _In_reads_or_z_(s) +#define _Out_writes_(s) +#define _Out_writes_bytes_(s) +#define _Out_writes_z_(s) +#define _Inout_updates_(s) +#define _Inout_updates_bytes_(s) +#define _Inout_updates_z_(s) +#define _Out_writes_to_(s,c) +#define _Out_writes_bytes_to_(s, c) +#define _Out_writes_all_(s) +#define _Out_writes_bytes_all_(s) +#define _Inout_updates_to_(s, c) +#define _Inout_updates_bytes_to_(s, c) +#define _Inout_updates_all_(s) +#define _Inout_updates_bytes_all_(s) +#define _In_reads_to_ptr_(p) +#define _In_reads_to_ptr_z_(p) +#define _Out_writes_to_ptr_(p) +#define _Out_writes_to_ptr_z(p) -#define _Out_writes_bytes_opt_(s) +/* Optional pointer parameters */ +#define __in_opt +#define __out_opt +#define __inout_opt +#define _In_opt_ +#define _Out_opt_ +#define _Inout_opt_ +#define _In_opt_z_ +#define _Inout_opt_z_ +#define _In_reads_opt_(s) +#define _In_reads_bytes_opt_(s) +#define _In_reads_opt_z_(s) + +#define _Out_writes_opt_(s) +#define _Out_writes_opt_z_(s) +#define _Inout_updates_opt_(s) +#define _Inout_updates_bytes_opt_(s) +#define _Inout_updates_opt_z_(s) +#define _Out_writes_to_opt_(s, c) +#define _Out_writes_bytes_to_opt_(s, c) +#define _Out_writes_all_opt_(s) +#define _Out_writes_bytes_all_opt_(s) + +#define _Inout_updates_to_opt_(s, c) +#define _Inout_updates_bytes_to_opt_(s, c) +#define _Inout_updates_all_opt_(s) +#define _Inout_updates_bytes_all_opt_(s) +#define _In_reads_to_ptr_opt_(p) +#define _In_reads_to_ptr_opt_z_(p) +#define _Out_writes_to_ptr_opt_(p) +#define _Out_writes_to_ptr_opt_z_(p) + +/* Output pointer parameters */ +#define _Outptr_ +#define _Outptr_opt_ +#define _Outptr_result_maybenull_ +#define _Outptr_opt_result_maybenull_ +#define _Outptr_result_z_ +#define _Outptr_opt_result_z_ +#define _Outptr_result_maybenull_z_ +#define _Outptr_opt_result_maybenull_z_ +#define _COM_Outptr_ +#define _COM_Outptr_opt_ +#define _COM_Outptr_result_maybenull_ +#define _COM_Outptr_opt_result_maybenull_ +#define _Outptr_result_buffer_(s) +#define _Outptr_result_bytebuffer_(s) +#define _Outptr_opt_result_buffer_(s) +#define _Outptr_opt_result_bytebuffer_(s) +#define _Outptr_result_buffer_to_(s, c) +#define _Outptr_result_bytebuffer_to_(s, c) +#define _Outptr_result_bytebuffer_maybenull_(s) +#define _Outptr_opt_result_buffer_to_(s, c) +#define _Outptr_opt_result_bytebuffer_to_(s, c) +#define _Result_nullonfailure_ +#define _Result_zeroonfailure_ +#define _Outptr_result_nullonfailure_ +#define _Outptr_opt_result_nullonfailure_ +#define _Outref_result_nullonfailure_ + +/* Output reference parameters */ +#define _Outref_ +#define _Outref_result_maybenull_ +#define _Outref_result_buffer_(s) +#define _Outref_result_bytebuffer_(s) +#define _Outref_result_buffer_to_(s, c) +#define _Outref_result_bytebuffer_to_(s, c) +#define _Outref_result_buffer_all_(s) +#define _Outref_result_bytebuffer_all_(s) +#define _Outref_result_buffer_maybenull_(s) +#define _Outref_result_bytebuffer_maybenull_(s) +#define _Outref_result_buffer_to_maybenull_(s, c) +#define _Outref_result_bytebuffer_to_maybenull_(s, c) +#define _Outref_result_buffer_all_maybenull_(s) +#define _Outref_result_bytebuffer_all_maybenull_(s) + +/* Return values */ +#define _Ret_z_ +#define _Ret_writes_(s) +#define _Ret_writes_bytes_(s) +#define _Ret_writes_z_(s) +#define _Ret_writes_bytes_to_(s, c) +#define _Ret_writes_maybenull_(s) +#define _Ret_writes_to_maybenull_(s, c) +#define _Ret_writes_maybenull_z_(s) +#define _Ret_maybenull_ +#define _Ret_maybenull_z_ +#define _Ret_null_ +#define _Ret_notnull_ +#define _Ret_writes_bytes_to_(s, c) +#define _Ret_writes_bytes_maybenull_(s) +#define _Ret_writes_bytes_to_maybenull_(s, c) + +/* Other common annotations */ +#define _In_range_(low, hi) +#define _Out_range_(low, hi) +#define _Ret_range_(low, hi) +#define _Deref_in_range_(low, hi) +#define _Deref_out_range_(low, hi) +#define _Deref_inout_range_(low, hi) +#define _Pre_equal_to_(expr) +#define _Post_equal_to_(expr) +#define _Struct_size_bytes_(size) + +/* Function annotations */ +#define _Called_from_function_class_(name) +#define _Check_return_ __checkReturn +#define _Function_class_(name) +#define _Raises_SEH_exception_ +#define _Maybe_raises_SEH_exception_ +#define _Must_inspect_result_ +#define _Use_decl_annotations_ + +/* Success/failure annotations */ +#define _Always_(anno_list) +#define _On_failure_(anno_list) +#define _Return_type_success_(expr) +#define _Success_(expr) + +#define _Reserved_ +#define _Const_ + +/* Buffer properties */ +#define _Readable_bytes_(s) +#define _Readable_elements_(s) +#define _Writable_bytes_(s) +#define _Writable_elements_(s) +#define _Null_terminated_ +#define _NullNull_terminated_ +#define _Pre_readable_size_(s) +#define _Pre_writable_size_(s) +#define _Pre_readable_byte_size_(s) +#define _Pre_writable_byte_size_(s) +#define _Post_readable_size_(s) +#define _Post_writable_size_(s) +#define _Post_readable_byte_size_(s) +#define _Post_writable_byte_size_(s) + +/* Field properties */ +#define _Field_size_(s) +#define _Field_size_full_(s) +#define _Field_size_full_opt_(s) +#define _Field_size_opt_(s) +#define _Field_size_part_(s, c) +#define _Field_size_part_opt_(s, c) +#define _Field_size_bytes_(size) +#define _Field_size_bytes_full_(size) +#define _Field_size_bytes_full_opt_(s) +#define _Field_size_bytes_opt_(s) +#define _Field_size_bytes_part_(s, c) +#define _Field_size_bytes_part_opt_(s, c) +#define _Field_z_ +#define _Field_range_(min, max) + +/* Structural annotations */ +#define _At_(e, a) +#define _At_buffer_(e, i, c, a) +#define _Group_(a) +#define _When_(e, a) + +/* printf/scanf annotations */ +#define _Printf_format_string_ +#define _Scanf_format_string_ +#define _Scanf_s_format_string_ +#define _Format_string_impl_(kind,where) +#define _Printf_format_string_params_(x) +#define _Scanf_format_string_params_(x) +#define _Scanf_s_format_string_params_(x) + +/* Analysis */ +#define _Analysis_assume_(expr) +#define _Analysis_assume_nullterminated_(expr) #define __in #define __out + #define __in_bcount(size) #define __in_ecount(size) #define __out_bcount(size) @@ -19,9 +216,22 @@ #define __out_ecount(size) #define __inout #define __deref_out_ecount(size) +#define __in_ecount_opt(s) + +#define _In_ +#define _In_opt_ +#define _Null_ + +#define _Out_writes_bytes_opt_(s) +#define _Out_writes_bytes_(s) +#define _In_reads_bytes_(s) +#define _Inout_opt_bytecount_(s) + +#ifndef __cplusplus +#define static_assert _Static_assert +#endif #endif -#define CINTERFACE #include #include @@ -29,8 +239,12 @@ #define countof(a) (sizeof(a) / sizeof(*a)) #endif -#ifndef __uuidof -#define __uuidof(type) & IID_##type +#ifndef uuidof +#if defined(__cplusplus) +#define uuidof(type) IID_##type +#else +#define uuidof(type) &IID_##type +#endif #endif #ifndef COM_RELEASE_DECLARED @@ -72,6 +286,7 @@ typedef IDXGIFactoryMedia* DXGIFactoryMedia; typedef IDXGISwapChainMedia* DXGISwapChainMedia; typedef IDXGISwapChain3* DXGISwapChain; +#if !defined(__cplusplus) || defined(CINTERFACE) static INLINE ULONG DXGIReleaseDeviceSubObject(DXGIDeviceSubObject device_sub_object) { return device_sub_object->lpVtbl->Release(device_sub_object); @@ -415,7 +630,7 @@ static INLINE HRESULT DXGIPresent(DXGISwapChain swap_chain, UINT sync_interval, } static INLINE HRESULT DXGIGetBuffer(DXGISwapChain swap_chain, UINT buffer, IDXGISurface** out) { - return swap_chain->lpVtbl->GetBuffer(swap_chain, buffer, __uuidof(IDXGISurface), (void**)out); + return swap_chain->lpVtbl->GetBuffer(swap_chain, buffer, uuidof(IDXGISurface), (void**)out); } static INLINE HRESULT DXGISetFullscreenState(DXGISwapChain swap_chain, BOOL fullscreen, DXGIOutput target) @@ -544,22 +759,26 @@ DXGISetColorSpace1(DXGISwapChain swap_chain, DXGI_COLOR_SPACE_TYPE color_space) { return swap_chain->lpVtbl->SetColorSpace1(swap_chain, color_space); } - +#endif /* end of auto-generated */ static INLINE HRESULT DXGICreateFactory(DXGIFactory* factory) { - return CreateDXGIFactory1(__uuidof(IDXGIFactory1), (void**)factory); + return CreateDXGIFactory1(uuidof(IDXGIFactory1), (void**)factory); } /* internal */ +#include "../video_driver.h" + #define DXGI_COLOR_RGBA(r, g, b, a) (((UINT32)(a) << 24) | ((UINT32)(b) << 16) | ((UINT32)(g) << 8) | ((UINT32)(r) << 0)) typedef enum { DXGI_FORMAT_EX_A4R4G4B4_UNORM = 1000, } DXGI_FORMAT_EX; +RETRO_BEGIN_DECLS + DXGI_FORMAT* dxgi_get_format_fallback_list(DXGI_FORMAT format); void dxgi_copy( @@ -572,6 +791,11 @@ void dxgi_copy( int dst_pitch, void* dst_data); +void dxgi_update_title(video_frame_info_t* video_info); +void dxgi_input_driver(const char* name, const input_driver_t** input, void** input_data); + +RETRO_END_DECLS + #if 1 #include "../../performance_counters.h" diff --git a/gfx/common/win32_common.c b/gfx/common/win32_common.c index c895c607d0..2b3ca65af7 100644 --- a/gfx/common/win32_common.c +++ b/gfx/common/win32_common.c @@ -569,7 +569,7 @@ static void win32_set_droppable(ui_window_win32_t *window, bool droppable) DragAcceptFiles_func(window->hwnd, droppable); } -#ifdef HAVE_D3D +#if defined(HAVE_D3D) || defined (HAVE_D3D10) || defined (HAVE_D3D11) || defined (HAVE_D3D12) LRESULT CALLBACK WndProcD3D(HWND hwnd, UINT message, WPARAM wparam, LPARAM lparam) { @@ -617,9 +617,13 @@ LRESULT CALLBACK WndProcD3D(HWND hwnd, UINT message, #endif #ifdef HAVE_DINPUT - if (dinput && dinput_handle_message(dinput, - message, wparam, lparam)) - return 0; + if (input_get_ptr() == &input_dinput) + { + void* input_data = input_get_data(); + if (input_data && dinput_handle_message(input_data, + message, wparam, lparam)) + return 0; + } #endif return DefWindowProc(hwnd, message, wparam, lparam); } diff --git a/gfx/drivers/d3d10.c b/gfx/drivers/d3d10.c index d18b8a7618..275cd630b8 100644 --- a/gfx/drivers/d3d10.c +++ b/gfx/drivers/d3d10.c @@ -78,7 +78,6 @@ d3d10_gfx_init(const video_info_t* video, const input_driver_t** input, void** i MONITORINFOEX current_mon; HMONITOR hm_to_use; settings_t* settings = config_get_ptr(); - gfx_ctx_input_t inp = { input, input_data }; d3d10_video_t* d3d10 = (d3d10_video_t*)calloc(1, sizeof(*d3d10)); if (!d3d10) @@ -105,7 +104,7 @@ d3d10_gfx_init(const video_info_t* video, const input_driver_t** input, void** i goto error; } - gfx_ctx_d3d.input_driver(NULL, settings->arrays.input_joypad_driver, input, input_data); + dxgi_input_driver(settings->arrays.input_joypad_driver, input, input_data); { UINT flags = 0; @@ -374,7 +373,7 @@ static bool d3d10_gfx_frame( PERF_STOP(); if (msg && *msg) - gfx_ctx_d3d.update_window_title(NULL, video_info); + dxgi_update_title(video_info); return true; } diff --git a/gfx/drivers/d3d11.c b/gfx/drivers/d3d11.c index d530a0a91b..2b513842a6 100644 --- a/gfx/drivers/d3d11.c +++ b/gfx/drivers/d3d11.c @@ -143,7 +143,6 @@ d3d11_gfx_init(const video_info_t* video, const input_driver_t** input, void** i MONITORINFOEX current_mon; HMONITOR hm_to_use; settings_t* settings = config_get_ptr(); - gfx_ctx_input_t inp = { input, input_data }; d3d11_video_t* d3d11 = (d3d11_video_t*)calloc(1, sizeof(*d3d11)); if (!d3d11) @@ -170,7 +169,7 @@ d3d11_gfx_init(const video_info_t* video, const input_driver_t** input, void** i goto error; } - gfx_ctx_d3d.input_driver(NULL, settings->arrays.input_joypad_driver, input, input_data); + dxgi_input_driver(settings->arrays.input_joypad_driver, input, input_data); { UINT flags = 0; @@ -547,7 +546,7 @@ static bool d3d11_gfx_frame( if (msg && *msg) { font_driver_render_msg(video_info, NULL, msg, NULL); - gfx_ctx_d3d.update_window_title(NULL, video_info); + dxgi_update_title(video_info); } d3d11->sprites.enabled = false; diff --git a/gfx/drivers/d3d12.c b/gfx/drivers/d3d12.c index 20b2d09fc8..f1c48a1ad2 100644 --- a/gfx/drivers/d3d12.c +++ b/gfx/drivers/d3d12.c @@ -83,7 +83,6 @@ d3d12_gfx_init(const video_info_t* video, const input_driver_t** input, void** i { WNDCLASSEX wndclass = { 0 }; settings_t* settings = config_get_ptr(); - gfx_ctx_input_t inp = { input, input_data }; d3d12_video_t* d3d12 = (d3d12_video_t*)calloc(1, sizeof(*d3d12)); if (!d3d12) @@ -100,7 +99,7 @@ d3d12_gfx_init(const video_info_t* video, const input_driver_t** input, void** i goto error; } - gfx_ctx_d3d.input_driver(NULL, settings->arrays.input_joypad_driver, input, input_data); + dxgi_input_driver(settings->arrays.input_joypad_driver, input, input_data); if (!d3d12_init_base(d3d12)) goto error; @@ -292,7 +291,7 @@ static bool d3d12_gfx_frame( PERF_STOP(); if (msg && *msg) - gfx_ctx_d3d.update_window_title(NULL, video_info); + dxgi_update_title(video_info); return true; } diff --git a/menu/cbs/menu_cbs_deferred_push.c b/menu/cbs/menu_cbs_deferred_push.c index be510af76c..6d29ea73d7 100644 --- a/menu/cbs/menu_cbs_deferred_push.c +++ b/menu/cbs/menu_cbs_deferred_push.c @@ -427,16 +427,17 @@ static int general_push(menu_displaylist_info_t *info, if (!string_is_empty(new_exts)) { - union string_list_elem_attr attr; size_t path_size = PATH_MAX_LENGTH * sizeof(char); struct string_list *str_list3 = string_split(new_exts, "|"); - attr.i = 0; - #ifdef HAVE_IBXM - string_list_append(str_list3, "s3m", attr); - string_list_append(str_list3, "mod", attr); - string_list_append(str_list3, "xm", attr); + { + union string_list_elem_attr attr; + attr.i = 0; + string_list_append(str_list3, "s3m", attr); + string_list_append(str_list3, "mod", attr); + string_list_append(str_list3, "xm", attr); + } #endif string_list_join_concat(newstring2, path_size, str_list3, "|"); @@ -500,14 +501,16 @@ static int general_push(menu_displaylist_info_t *info, str_list2, "|"); { - union string_list_elem_attr attr; struct string_list *str_list3 = string_split(newstring, "|"); - attr.i = 0; #ifdef HAVE_IBXM - string_list_append(str_list3, "s3m", attr); - string_list_append(str_list3, "mod", attr); - string_list_append(str_list3, "xm", attr); + { + union string_list_elem_attr attr; + attr.i = 0; + string_list_append(str_list3, "s3m", attr); + string_list_append(str_list3, "mod", attr); + string_list_append(str_list3, "xm", attr); + } #endif string_list_join_concat(newstring2, path_size, str_list3, "|"); diff --git a/retroarch.c b/retroarch.c index 288fa0e44f..a50fd67277 100644 --- a/retroarch.c +++ b/retroarch.c @@ -185,7 +185,7 @@ static char error_string[255] = {0}; #ifdef HAVE_THREAD_STORAGE static sthread_tls_t rarch_tls; -const void *MAGIC_POINTER = (void*)0xB16B00B5; +const void *MAGIC_POINTER = (void*)(uintptr_t)0xB16B00B5; #endif static retro_bits_t has_set_libretro_device; diff --git a/tools/com-parser/com-parse.cpp b/tools/com-parser/com-parse.cpp index 900a94040f..49abccc6e8 100644 --- a/tools/com-parser/com-parse.cpp +++ b/tools/com-parser/com-parse.cpp @@ -560,7 +560,7 @@ public: } if(!riid.empty()) - out << ", __uuidof(" << riid << "), (void**)out"; + out << ", uuidof(" << riid << "), (void**)out"; out << ");\n"; out << "}\n";