mirror of
https://github.com/libretro/RetroArch.git
synced 2024-11-24 00:20:01 +00:00
Merge branch 'master' of https://github.com/libretro/RetroArch
This commit is contained in:
commit
355b6dcbdd
@ -1,5 +1,6 @@
|
||||
# 1.6.8 (future)
|
||||
- Audio: Fix the Audio DSP picker
|
||||
- GUI: (MaterialUI) Fix crash that happened on context reset with Vulkan.
|
||||
- GUI: (MaterialUI) Skip querying and drawing items that are not visible; Cache content height and bbox calculation.
|
||||
- GUI: (XMB) Skip drawing the fading list when it is already transparent. Optimization.
|
||||
- GUI: (XMB) Comment out visible item calculation in xmb_draw_items().
|
||||
@ -12,6 +13,7 @@
|
||||
- INPUT: Ignore keyboard input if window is not active on udev driver
|
||||
- LOBBIES: Fix crash on navigating left / right from the lobby menu
|
||||
- LOCALIZATION: Update Italian translation.
|
||||
- LOCALIZATION: Update Japanese translation.
|
||||
- LOCALIZATION: Update Portuguese-Brazilian translation.
|
||||
- LOCALIZATION: Update Russian translation.
|
||||
- LINUX/PI: Broadcom VC4: Add Videocore config option
|
||||
@ -23,6 +25,8 @@
|
||||
- WII: Use custom, embedded libogc SDK.
|
||||
- WIIU: Initial touchscreen support for WiiU gamepad.
|
||||
- SCANNER: Fix archive scanning.
|
||||
- SCANNER: Support CHD files.
|
||||
- SCANNER: Use primary data track of disc images for CRC lookups rather than cue files. This is slower but finds matches more reliably, and is necessary for CHD files to work at all. Update your databases!
|
||||
|
||||
# 1.6.7
|
||||
- SCANNER: Fix directory scanning.
|
||||
|
@ -1,4 +1,4 @@
|
||||
RARCH_VERSION = "1.6.7.0"
|
||||
include version.all
|
||||
|
||||
DEBUG = 0
|
||||
|
||||
|
14
Makefile.ps3
14
Makefile.ps3
@ -1,4 +1,4 @@
|
||||
RARCH_VERSION = "1.6.7.0"
|
||||
include version.all
|
||||
|
||||
#which compiler to build with - GCC or SNC
|
||||
#set to GCC for debug builds for use with debugger
|
||||
@ -163,20 +163,20 @@ pkg: $(PPU_TARGET) create-shaders copy-media-files create-npdrm-salamander crea
|
||||
$(MAKE_PACKAGE_NPDRM) pkg/ps3/package.conf pkg/ps3
|
||||
|
||||
pkg-signed: $(PPU_TARGET) create-shaders copy-media-files create-salamander create-core
|
||||
$(PYTHON2) $(PKG_SCRIPT) --contentid $(CONTENT_ID_FULL) pkg/ps3 retroarch-ps3-cfw-$(RARCH_VERSION).pkg
|
||||
$(PYTHON2) $(PKG_SCRIPT) --contentid $(CONTENT_ID_FULL) pkg/ps3 retroarch-ps3-cfw-$(PACKAGE_VERSION).pkg
|
||||
|
||||
pkg-signed-standalone: $(PPU_TARGET) create-shaders copy-media-files create-core
|
||||
$(MAKE_SELF) $(PPU_TARGET) $(EBOOT_PATH) $(CONTENT_ID)
|
||||
$(PYTHON2) $(PKG_SCRIPT) --contentid $(CONTENT_ID_FULL) pkg/ps3 retroarch-ps3-cfw-$(RARCH_VERSION).pkg
|
||||
$(PYTHON2) $(PKG_SCRIPT) --contentid $(CONTENT_ID_FULL) pkg/ps3 retroarch-ps3-cfw-$(PACKAGE_VERSION).pkg
|
||||
|
||||
pkg-signed-cfw: $(PPU_TARGET) create-shaders copy-media-files create-salamander create-core
|
||||
$(PYTHON2) $(PKG_SCRIPT) --contentid $(CONTENT_ID_FULL) pkg/ps3 retroarch-ps3-cfw-$(RARCH_VERSION)-kmeaw.pkg
|
||||
$(PKG_FINALIZE) retroarch-ps3-cfw-$(RARCH_VERSION)-kmeaw.pkg
|
||||
$(PYTHON2) $(PKG_SCRIPT) --contentid $(CONTENT_ID_FULL) pkg/ps3 retroarch-ps3-cfw-$(PACKAGE_VERSION)-kmeaw.pkg
|
||||
$(PKG_FINALIZE) retroarch-ps3-cfw-$(PACKAGE_VERSION)-kmeaw.pkg
|
||||
|
||||
pkg-signed-cfw-standalone: $(PPU_TARGET) create-shaders copy-media-files create-core
|
||||
$(MAKE_SELF) $(PPU_TARGET) $(EBOOT_PATH) $(CONTENT_ID)
|
||||
$(PYTHON2) $(PKG_SCRIPT) --contentid $(CONTENT_ID_FULL) pkg/ps3 retroarch-ps3-cfw-$(RARCH_VERSION).pkg
|
||||
$(PKG_FINALIZE) retroarch-ps3-cfw-$(RARCH_VERSION)-kmeaw.pkg
|
||||
$(PYTHON2) $(PKG_SCRIPT) --contentid $(CONTENT_ID_FULL) pkg/ps3 retroarch-ps3-cfw-$(PACKAGE_VERSION).pkg
|
||||
$(PKG_FINALIZE) retroarch-ps3-cfw-$(PACKAGE_VERSION)-kmeaw.pkg
|
||||
|
||||
clean-selfs:
|
||||
ifeq ($(EBOOT_EXISTS),1)
|
||||
|
@ -1,4 +1,4 @@
|
||||
RARCH_VERSION = "1.6.7.0"
|
||||
include version.all
|
||||
|
||||
#which compiler to build with - GCC or SNC
|
||||
#set to GCC for debug builds for use with debugger
|
||||
@ -159,20 +159,20 @@ pkg: $(PPU_TARGET) create-shaders copy-media-files create-npdrm-salamander crea
|
||||
$(MAKE_PACKAGE_NPDRM) pkg/ps3/package.conf pkg/ps3
|
||||
|
||||
pkg-signed: $(PPU_TARGET) create-shaders copy-media-files create-salamander create-core
|
||||
$(PYTHON2) $(PKG_SCRIPT) --contentid $(CONTENT_ID_FULL) pkg/ps3 retroarch-ps3-cfw-$(RARCH_VERSION).pkg
|
||||
$(PYTHON2) $(PKG_SCRIPT) --contentid $(CONTENT_ID_FULL) pkg/ps3 retroarch-ps3-cfw-$(PACKAGE_VERSION).pkg
|
||||
|
||||
pkg-signed-standalone: $(PPU_TARGET) create-shaders copy-media-files create-core
|
||||
$(MAKE_SELF) $(PPU_TARGET) $(EBOOT_PATH) $(CONTENT_ID)
|
||||
$(PYTHON2) $(PKG_SCRIPT) --contentid $(CONTENT_ID_FULL) pkg/ps3 retroarch-ps3-cfw-$(RARCH_VERSION).pkg
|
||||
$(PYTHON2) $(PKG_SCRIPT) --contentid $(CONTENT_ID_FULL) pkg/ps3 retroarch-ps3-cfw-$(PACKAGE_VERSION).pkg
|
||||
|
||||
pkg-signed-cfw: $(PPU_TARGET) create-shaders copy-media-files create-salamander create-core
|
||||
$(PYTHON2) $(PKG_SCRIPT) --contentid $(CONTENT_ID_FULL) pkg/ps3 retroarch-ps3-cfw-$(RARCH_VERSION)-kmeaw.pkg
|
||||
$(PKG_FINALIZE) retroarch-ps3-cfw-$(RARCH_VERSION)-kmeaw.pkg
|
||||
$(PYTHON2) $(PKG_SCRIPT) --contentid $(CONTENT_ID_FULL) pkg/ps3 retroarch-ps3-cfw-$(PACKAGE_VERSION)-kmeaw.pkg
|
||||
$(PKG_FINALIZE) retroarch-ps3-cfw-$(PACKAGE_VERSION)-kmeaw.pkg
|
||||
|
||||
pkg-signed-cfw-standalone: $(PPU_TARGET) create-shaders copy-media-files create-core
|
||||
$(MAKE_SELF) $(PPU_TARGET) $(EBOOT_PATH) $(CONTENT_ID)
|
||||
$(PYTHON2) $(PKG_SCRIPT) --contentid $(CONTENT_ID_FULL) pkg/ps3 retroarch-ps3-cfw-$(RARCH_VERSION).pkg
|
||||
$(PKG_FINALIZE) retroarch-ps3-cfw-$(RARCH_VERSION)-kmeaw.pkg
|
||||
$(PYTHON2) $(PKG_SCRIPT) --contentid $(CONTENT_ID_FULL) pkg/ps3 retroarch-ps3-cfw-$(PACKAGE_VERSION).pkg
|
||||
$(PKG_FINALIZE) retroarch-ps3-cfw-$(PACKAGE_VERSION)-kmeaw.pkg
|
||||
|
||||
clean-selfs:
|
||||
ifeq ($(EBOOT_EXISTS),1)
|
||||
|
@ -1,4 +1,4 @@
|
||||
RARCH_VERSION = "1.6.7.0"
|
||||
include version.all
|
||||
|
||||
DEBUG = 0
|
||||
HAVE_LOGGER = 0
|
||||
@ -121,7 +121,7 @@ pkg: $(ELF_TARGET) create-npdrm-core
|
||||
$(MAKE_PACKAGE_NPDRM) pkg/ps3/package.conf ps3/pkg
|
||||
|
||||
pkg-signed: $(ELF_TARGET) create-core
|
||||
$(PYTHON2) $(PKG_SCRIPT) --contentid $(CONTENT_ID_FULL) pkg/ps3 retroarch-ps3-cfw-$(RARCH_VERSION).pkg
|
||||
$(PYTHON2) $(PKG_SCRIPT) --contentid $(CONTENT_ID_FULL) pkg/ps3 retroarch-ps3-cfw-$(PACKAGE_VERSION).pkg
|
||||
|
||||
clean:
|
||||
rm -f $(ELF_TARGET)
|
||||
|
@ -38,7 +38,7 @@ ifeq ($(GRIFFIN_BUILD), 1)
|
||||
OBJ += griffin/griffin.o
|
||||
DEFINES += -DHAVE_GRIFFIN=1 -DHAVE_MENU -DHAVE_RGUI -DHAVE_LIBRETRODB
|
||||
DEFINES += -DHAVE_ZLIB -DHAVE_RPNG -DHAVE_RJPEG -DHAVE_RBMP -DHAVE_RTGA -DWANT_ZLIB -DHAVE_CC_RESAMPLER
|
||||
DEFINES += -DHAVE_STB_FONT -DHAVE_STB_VORBIS -DHAVE_LANGEXTRA -DHAVE_LIBRETRODB -DHAVE_NETWORKING -DHAVE_KEYMAPPER
|
||||
DEFINES += -DHAVE_STB_FONT -DHAVE_STB_VORBIS -DHAVE_LANGEXTRA -DHAVE_LIBRETRODB -DHAVE_NETWORKING
|
||||
# DEFINES += -DWANT_IFADDRS
|
||||
# DEFINES += -DHAVE_FREETYPE
|
||||
DEFINES += -DHAVE_XMB -DHAVE_MATERIALUI
|
||||
@ -52,6 +52,7 @@ else
|
||||
HAVE_ZLIB = 1
|
||||
HAVE_7ZIP = 1
|
||||
HAVE_BUILTINZLIB = 1
|
||||
HAVE_KEYMAPPER = 1
|
||||
HAVE_LIBRETRODB = 1
|
||||
HAVE_ZARCH = 0
|
||||
HAVE_MATERIALUI = 1
|
||||
@ -62,7 +63,6 @@ else
|
||||
HAVE_LIBRETRODB = 1
|
||||
HAVE_NETWORKING = 1
|
||||
# WANT_IFADDRS = 1
|
||||
HAVE_KEYMAPPER = 1
|
||||
|
||||
include Makefile.common
|
||||
BLACKLIST :=
|
||||
@ -98,6 +98,7 @@ else
|
||||
OBJ += libretro-common/audio/dsp_filters/wahwah.o
|
||||
endif
|
||||
|
||||
DEFINES += -DHAVE_KEYMAPPER
|
||||
|
||||
ifeq ($(strip $(DEVKITPPC)),)
|
||||
$(error "Please set DEVKITPPC in your environment. export DEVKITPPC=<path to>devkitPPC")
|
||||
|
91
README.md
91
README.md
@ -125,94 +125,5 @@ Users only need to configure a certain option if the desired value deviates from
|
||||
To configure joypads, use the built-in menu or the `retroarch-joyconfig` command-line tool.
|
||||
|
||||
## Compiling and installing
|
||||
**Linux**
|
||||
|
||||
- Prerequisites:
|
||||
```bash
|
||||
sudo apt-get install -y make git-core curl g++ pkg-config libglu1-mesa-dev freeglut3-dev mesa-common-dev libsdl1.2-dev libsdl-image1.2-dev libsdl-mixer1.2-dev libsdl-ttf2.0-dev
|
||||
```
|
||||
- Compiling:
|
||||
```bash
|
||||
./configure
|
||||
make
|
||||
```
|
||||
|
||||
**Mac**
|
||||
|
||||
- Prerequisites: [XCode](https://www.google.com/url?sa=t&rct=j&q=&esrc=s&source=web&cd=1&cad=rja&uact=8&ved=0CB4QFjAA&url=https%3A%2F%2Fitunes.apple.com%2Fus%2Fapp%2Fxcode%2Fid497799835%3Fmt%3D12&ei=ZmfeVNPtIILVoASBnoCYBw&usg=AFQjCNGrxKmVtXUdvUU3MhqZhP4MHT6Gtg&sig2=RIXKsWQ79YTQBt_lK5fdKA&bvm=bv.85970519,d.cGU), [Cg](https://developer.nvidia.com/cg-toolkit-download).
|
||||
- You can open the project (**pkg/apple/RetroArch.xcodeproj**) in the Xcode IDE and build (**⌘-B**) and run (**⌘-R**) it there. Or you can use the command line...
|
||||
- Debug:
|
||||
```bash
|
||||
# Build
|
||||
xcodebuild -target RetroArch -configuration Debug -project pkg/apple/RetroArch.xcodeproj
|
||||
# Run
|
||||
open ./pkg/apple/build/Debug/RetroArch.app/
|
||||
```
|
||||
- Release:
|
||||
```bash
|
||||
# Build
|
||||
xcodebuild -target RetroArch -configuration Release -project pkg/apple/RetroArch.xcodeproj
|
||||
# Run
|
||||
open ./pkg/apple/build/Release/RetroArch.app/
|
||||
```
|
||||
|
||||
**PC**
|
||||
|
||||
Instructions for compiling on PC can be found in the [wiki](https://github.com/Themaister/RetroArch/wiki).
|
||||
|
||||
**PlayStation 3**
|
||||
|
||||
RetroArch PS3 needs to be compiled in the following order:
|
||||
|
||||
1) Compile RetroArch Salamander
|
||||
|
||||
make -f Makefile.ps3.salamander
|
||||
|
||||
2) Finally, compile RetroArch packed together with the GUI:
|
||||
|
||||
make -f Makefile.ps3
|
||||
|
||||
**PlayStation 3 - Creating a PKG installable file**
|
||||
|
||||
You can add `pkg` as a parameter in order to make a PKG file - for example:
|
||||
|
||||
make -f Makefile.ps3 pkg
|
||||
|
||||
This creates an NPDRM package. This can be installed on debug PS3s.
|
||||
|
||||
To make a non-NPDRM package that can be installed on a jailbroken/CFW PS3 (such as PSGroove or PS3 CFWs and other 3.55 CFW derivatives), do:
|
||||
|
||||
make -f Makefile.ps3 pkg-signed
|
||||
|
||||
If you're using Kmeaw 3.55 firmware, the package needs to be signed:
|
||||
|
||||
make -f Makefile.ps3 pkg-signed-cfw
|
||||
|
||||
NOTE: A pre-existing libretro library needs to be present in the root directory in order to link RetroArch PS3. This file needs to be called ***`libretro_ps3.a`***.
|
||||
|
||||
**Xbox 360 (XeXDK)**
|
||||
|
||||
You will need Microsoft Visual Studio 2010 installed (or higher) in order to compile RetroArch 360.
|
||||
|
||||
The solution file can be found at the following location:
|
||||
|
||||
pkg/msvc-360/RetroArch-360.sln
|
||||
|
||||
NOTE: A pre-existing libretro library needs to be present in the `pkg/msvc-360/RetroArch-360/Release` directory in order to link RetroArch 360. This file needs to be
|
||||
called ***`libretro_xdk360.lib`***.
|
||||
|
||||
**Xbox 360 (Libxenon)**
|
||||
|
||||
You will need to have the libxenon libraries and a working Devkit Xenon toolchain installed in order to compile RetroArch 360 Libxenon.
|
||||
|
||||
make -f Makefile.xenon
|
||||
|
||||
NOTE: A pre-existing libretro library needs to be present in the root directory in order to link RetroArch 360 Libxenon. This file needs to be called ***`libretro_xenon360.a`***.
|
||||
|
||||
**Wii**
|
||||
|
||||
You will need to have the libogc libraries and a working Devkit PPC toolchain installed in order to compile RetroArch Wii.
|
||||
|
||||
make -f Makefile.griffin platform=wii
|
||||
|
||||
NOTE: A pre-existing libretro library needs to be present in the root directory in order to link RetroArch Wii. This file needs to be called ***`libretro_wii.a`***.
|
||||
Instructions for compiling and installing RetroArch can be found in the [Libretro/RetroArch Documentation Center](https://buildbot.libretro.com/docs).
|
||||
|
@ -1172,7 +1172,9 @@ bool audio_driver_callback(void)
|
||||
|
||||
bool audio_driver_has_callback(void)
|
||||
{
|
||||
return audio_callback.callback;
|
||||
if (audio_callback.callback)
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
bool audio_driver_toggle_mute(void)
|
||||
|
@ -38,36 +38,92 @@
|
||||
|
||||
DEFINE_PROPERTYKEY(PKEY_Device_FriendlyName, 0xa45c254e, 0xdf1c, 0x4efd, 0x80, 0x20, 0x67, 0xd1, 0x46, 0xa8, 0x50, 0xe0, 14); /* DEVPROP_TYPE_STRING */
|
||||
|
||||
#ifdef __cplusplus
|
||||
#define _IMMDeviceCollection_Item(This,nDevice,ppdevice) (This)->Item(nDevice,ppdevice)
|
||||
#define _IAudioClient_Start(This) ( (This)->Start() )
|
||||
#define _IAudioClient_Stop(This) ( (This)->Stop() )
|
||||
#define _IAudioClient_GetCurrentPadding(This,pNumPaddingFrames) \
|
||||
( (This)->GetCurrentPadding(pNumPaddingFrames) )
|
||||
#define _IAudioRenderClient_GetBuffer(This,NumFramesRequested,ppData) \
|
||||
( (This)->GetBuffer(NumFramesRequested,ppData) )
|
||||
#define _IAudioRenderClient_ReleaseBuffer(This,NumFramesWritten,dwFlags) \
|
||||
( (This)->ReleaseBuffer(NumFramesWritten,dwFlags) )
|
||||
#define _IAudioClient_GetService(This,riid,ppv) ( (This)->GetService(riid,ppv) )
|
||||
#define _IAudioClient_SetEventHandle(This,eventHandle) ( (This)->SetEventHandle(eventHandle) )
|
||||
#define _IAudioClient_GetBufferSize(This,pNumBufferFrames) ( (This)->GetBufferSize(pNumBufferFrames) )
|
||||
#define _IAudioClient_GetStreamLatency(This,phnsLatency) ( (This)->GetStreamLatency(phnsLatency) )
|
||||
#define _IAudioClient_GetDevicePeriod(This,phnsDefaultDevicePeriod,phnsMinimumDevicePeriod) ( (This)->GetDevicePeriod(phnsDefaultDevicePeriod,phnsMinimumDevicePeriod) )
|
||||
#define _IMMDevice_Activate(This,iid,dwClsCtx,pActivationParams,ppv) ((This)->Activate(iid,(dwClsCtx),pActivationParams,ppv))
|
||||
#define _IMMDeviceEnumerator_EnumAudioEndpoints(This,dataFlow,dwStateMask,ppDevices) (This)->EnumAudioEndpoints(dataFlow,dwStateMask,ppDevices)
|
||||
#define _IMMDeviceEnumerator_GetDefaultAudioEndpoint(This,dataFlow,role,ppEndpoint) (This)->GetDefaultAudioEndpoint(dataFlow,role,ppEndpoint)
|
||||
#define _IMMDevice_OpenPropertyStore(This,stgmAccess,ppProperties) (This)->OpenPropertyStore(stgmAccess,ppProperties)
|
||||
#define _IMMDevice_GetId(This,ppstrId) ((This)->GetId(ppstrId))
|
||||
#define _IPropertyStore_GetValue(This,key,pv) ( (This)->GetValue(key,pv) )
|
||||
#define _IMMDeviceCollection_GetCount(This,cProps) ( (This)->GetCount(cProps) )
|
||||
#else
|
||||
#define _IMMDeviceCollection_Item(This,nDevice,ppdevice) (This)->lpVtbl->Item(This,nDevice,ppdevice)
|
||||
#define _IAudioClient_Start(This) ( (This)->lpVtbl -> Start(This) )
|
||||
#define _IAudioClient_Stop(This) ( (This)->lpVtbl -> Stop(This) )
|
||||
#define _IAudioClient_GetCurrentPadding(This,pNumPaddingFrames) \
|
||||
( (This)->lpVtbl -> GetCurrentPadding(This,pNumPaddingFrames) )
|
||||
#define _IAudioRenderClient_GetBuffer(This,NumFramesRequested,ppData) \
|
||||
( (This)->lpVtbl -> GetBuffer(This,NumFramesRequested,ppData) )
|
||||
#define _IAudioRenderClient_ReleaseBuffer(This,NumFramesWritten,dwFlags) \
|
||||
( (This)->lpVtbl -> ReleaseBuffer(This,NumFramesWritten,dwFlags) )
|
||||
#define _IAudioClient_GetService(This,riid,ppv) ( (This)->lpVtbl -> GetService(This,&(riid),ppv) )
|
||||
#define _IAudioClient_SetEventHandle(This,eventHandle) ( (This)->lpVtbl -> SetEventHandle(This,eventHandle) )
|
||||
#define _IAudioClient_GetBufferSize(This,pNumBufferFrames) ( (This)->lpVtbl -> GetBufferSize(This,pNumBufferFrames) )
|
||||
#define _IAudioClient_GetStreamLatency(This,phnsLatency) ( (This)->lpVtbl -> GetStreamLatency(This,phnsLatency) )
|
||||
#define _IAudioClient_GetDevicePeriod(This,phnsDefaultDevicePeriod,phnsMinimumDevicePeriod) ( (This)->lpVtbl -> GetDevicePeriod(This,phnsDefaultDevicePeriod,phnsMinimumDevicePeriod) )
|
||||
#define _IMMDevice_Activate(This,iid,dwClsCtx,pActivationParams,ppv) ((This)->lpVtbl->Activate(This,&(iid),dwClsCtx,pActivationParams,ppv))
|
||||
#define _IMMDeviceEnumerator_EnumAudioEndpoints(This,dataFlow,dwStateMask,ppDevices) (This)->lpVtbl->EnumAudioEndpoints(This,dataFlow,dwStateMask,ppDevices)
|
||||
#define _IMMDeviceEnumerator_GetDefaultAudioEndpoint(This,dataFlow,role,ppEndpoint) (This)->lpVtbl->GetDefaultAudioEndpoint(This,dataFlow,role,ppEndpoint)
|
||||
#define _IMMDevice_OpenPropertyStore(This,stgmAccess,ppProperties) (This)->lpVtbl->OpenPropertyStore(This,stgmAccess,ppProperties)
|
||||
#define _IMMDevice_GetId(This,ppstrId) (This)->lpVtbl->GetId(This,ppstrId)
|
||||
#define _IPropertyStore_GetValue(This,key,pv) ( (This)->lpVtbl -> GetValue(This,&(key),pv) )
|
||||
#define _IMMDeviceCollection_GetCount(This,cProps) ( (This)->lpVtbl -> GetCount(This,cProps) )
|
||||
#endif
|
||||
|
||||
#define WASAPI_WARN(bool_exp, err_str, warn_exp)\
|
||||
if (!(bool_exp)) {\
|
||||
wasapi_warn(err_str);\
|
||||
#define WASAPI_WARN(bool_exp, err_str, warn_exp) \
|
||||
if (!(bool_exp)) { \
|
||||
RARCH_WARN("[WASAPI]: %s.\n", err_str); \
|
||||
warn_exp; }
|
||||
|
||||
#define WASAPI_CHECK(bool_exp, err_str, err_exp)\
|
||||
if (!(bool_exp)) {\
|
||||
wasapi_err(err_str);\
|
||||
#define WASAPI_CHECK(bool_exp, err_str, err_exp) \
|
||||
if (!(bool_exp)) { \
|
||||
RARCH_ERR("[WASAPI]: %s.\n", err_str); \
|
||||
err_exp; }
|
||||
|
||||
#define WASAPI_HR_CHECK(hr, fun_str, err_exp)\
|
||||
if (FAILED(hr)) {\
|
||||
wasapi_com_err(fun_str, hr);\
|
||||
#define WASAPI_HR_CHECK(hr, fun_str, err_exp) \
|
||||
if (FAILED(hr)) { \
|
||||
RARCH_ERR("[WASAPI]: %s failed with error 0x%.8X.\n", fun_str, hr); \
|
||||
err_exp; }
|
||||
|
||||
#define WASAPI_HR_WARN(hr, fun_str, warn_exp)\
|
||||
if (FAILED(hr)) {\
|
||||
wasapi_com_warn(fun_str, hr);\
|
||||
#define WASAPI_HR_WARN(hr, fun_str, warn_exp) \
|
||||
if (FAILED(hr)) { \
|
||||
RARCH_WARN("[WASAPI]: %s failed with error 0x%.8X.\n", fun_str, hr); \
|
||||
warn_exp; }
|
||||
|
||||
#define WASAPI_SR_CHECK(bool_exp, fun_str, err_exp)\
|
||||
if (!(bool_exp)) {\
|
||||
wasapi_sys_err(fun_str);\
|
||||
#define WASAPI_SR_CHECK(bool_exp, fun_str, err_exp) \
|
||||
if (!(bool_exp)) { \
|
||||
RARCH_ERR("[WASAPI]: %s failed with error %d.\n", fun_str, GetLastError()); \
|
||||
err_exp; }
|
||||
|
||||
#define WASAPI_RELEASE(iface)\
|
||||
if(iface) {\
|
||||
#ifdef __cplusplus
|
||||
#define WASAPI_RELEASE(iface) \
|
||||
if(iface) \
|
||||
{ \
|
||||
iface->Release(); \
|
||||
iface = NULL; \
|
||||
}
|
||||
#else
|
||||
#define WASAPI_RELEASE(iface) \
|
||||
if(iface) \
|
||||
{ \
|
||||
iface->lpVtbl->Release(iface);\
|
||||
iface = NULL; }\
|
||||
iface = NULL; \
|
||||
}
|
||||
#endif
|
||||
|
||||
#define WASAPI_FREE(ptr)\
|
||||
if(ptr) {\
|
||||
@ -81,48 +137,18 @@ DEFINE_PROPERTYKEY(PKEY_Device_FriendlyName, 0xa45c254e, 0xdf1c, 0x4efd, 0x80, 0
|
||||
|
||||
typedef struct
|
||||
{
|
||||
IMMDevice *device;
|
||||
IAudioClient *client;
|
||||
IAudioRenderClient *renderer;
|
||||
HANDLE write_event;
|
||||
fifo_buffer_t *buffer; /* NULL in unbuffered shared mode */
|
||||
size_t frame_size; /* 4 or 8 only */
|
||||
size_t engine_buffer_size;
|
||||
bool exclusive;
|
||||
bool blocking;
|
||||
bool running;
|
||||
size_t frame_size; /* 4 or 8 only */
|
||||
size_t engine_buffer_size;
|
||||
HANDLE write_event;
|
||||
IMMDevice *device;
|
||||
IAudioClient *client;
|
||||
IAudioRenderClient *renderer;
|
||||
fifo_buffer_t *buffer; /* NULL in unbuffered shared mode */
|
||||
} wasapi_t;
|
||||
|
||||
static void wasapi_log(const char *msg)
|
||||
{
|
||||
RARCH_LOG("[WASAPI]: %s.\n", msg);
|
||||
}
|
||||
|
||||
static void wasapi_warn(const char *warn)
|
||||
{
|
||||
RARCH_WARN("[WASAPI]: %s.\n", warn);
|
||||
}
|
||||
|
||||
static void wasapi_err(const char *err)
|
||||
{
|
||||
RARCH_ERR("[WASAPI]: %s.\n", err);
|
||||
}
|
||||
|
||||
static void wasapi_com_warn(const char *fun, HRESULT hr)
|
||||
{
|
||||
RARCH_WARN("[WASAPI]: %s failed with error 0x%.8X.\n", fun, hr);
|
||||
}
|
||||
|
||||
static void wasapi_com_err(const char *fun, HRESULT hr)
|
||||
{
|
||||
RARCH_ERR("[WASAPI]: %s failed with error 0x%.8X.\n", fun, hr);
|
||||
}
|
||||
|
||||
static void wasapi_sys_err(const char *fun)
|
||||
{
|
||||
RARCH_ERR("[WASAPI]: %s failed with error %d.\n", fun, GetLastError());
|
||||
}
|
||||
|
||||
static bool wasapi_check_device_id(IMMDevice *device, const char *id)
|
||||
{
|
||||
HRESULT hr;
|
||||
@ -138,7 +164,7 @@ static bool wasapi_check_device_id(IMMDevice *device, const char *id)
|
||||
id_length = MultiByteToWideChar(CP_ACP, 0, id, -1, dev_cmp_id, id_length);
|
||||
WASAPI_SR_CHECK(id_length > 0, "MultiByteToWideChar", goto error);
|
||||
|
||||
hr = device->lpVtbl->GetId(device, &dev_id);
|
||||
hr = _IMMDevice_GetId(device, &dev_id);
|
||||
WASAPI_HR_CHECK(hr, "IMMDevice::GetId", goto error);
|
||||
|
||||
result = lstrcmpW(dev_cmp_id, dev_id) == 0 ? true : false;
|
||||
@ -164,27 +190,36 @@ static IMMDevice *wasapi_init_device(const char *id)
|
||||
IMMDeviceCollection *collection = NULL;
|
||||
|
||||
if (id)
|
||||
{
|
||||
RARCH_LOG("[WASAPI]: Initializing device %s ...\n", id);
|
||||
}
|
||||
else
|
||||
wasapi_log("Initializing default device ..");
|
||||
{
|
||||
RARCH_LOG("[WASAPI]: Initializing default device.. \n");
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
hr = CoCreateInstance(CLSID_MMDeviceEnumerator, NULL, CLSCTX_ALL,
|
||||
IID_IMMDeviceEnumerator, (void **)&enumerator);
|
||||
#else
|
||||
hr = CoCreateInstance(&CLSID_MMDeviceEnumerator, NULL, CLSCTX_ALL,
|
||||
&IID_IMMDeviceEnumerator, (void **)&enumerator);
|
||||
#endif
|
||||
WASAPI_HR_CHECK(hr, "CoCreateInstance", goto error);
|
||||
|
||||
if (id)
|
||||
{
|
||||
hr = enumerator->lpVtbl->EnumAudioEndpoints(enumerator,
|
||||
eRender, DEVICE_STATE_ACTIVE, &collection);
|
||||
hr = _IMMDeviceEnumerator_EnumAudioEndpoints(enumerator,
|
||||
eRender, DEVICE_STATE_ACTIVE, &collection);
|
||||
WASAPI_HR_CHECK(hr, "IMMDeviceEnumerator::EnumAudioEndpoints",
|
||||
goto error);
|
||||
|
||||
hr = collection->lpVtbl->GetCount(collection, &dev_count);
|
||||
hr = _IMMDeviceCollection_GetCount(collection, &dev_count);
|
||||
WASAPI_HR_CHECK(hr, "IMMDeviceCollection::GetCount", goto error);
|
||||
|
||||
for (i = 0; i < dev_count; ++i)
|
||||
{
|
||||
hr = collection->lpVtbl->Item(collection, i, &device);
|
||||
hr = _IMMDeviceCollection_Item(collection, i, &device);
|
||||
WASAPI_HR_CHECK(hr, "IMMDeviceCollection::Item", continue);
|
||||
|
||||
if (wasapi_check_device_id(device, id))
|
||||
@ -195,8 +230,8 @@ static IMMDevice *wasapi_init_device(const char *id)
|
||||
}
|
||||
else
|
||||
{
|
||||
hr = enumerator->lpVtbl->GetDefaultAudioEndpoint(enumerator,
|
||||
eRender, eConsole, &device);
|
||||
hr = _IMMDeviceEnumerator_GetDefaultAudioEndpoint(
|
||||
enumerator, eRender, eConsole, &device);
|
||||
WASAPI_HR_CHECK(hr, "IMMDeviceEnumerator::GetDefaultAudioEndpoint",
|
||||
goto error);
|
||||
}
|
||||
@ -207,8 +242,6 @@ static IMMDevice *wasapi_init_device(const char *id)
|
||||
WASAPI_RELEASE(collection);
|
||||
WASAPI_RELEASE(enumerator);
|
||||
|
||||
wasapi_log("Device initialized");
|
||||
|
||||
return device;
|
||||
|
||||
error:
|
||||
@ -216,9 +249,13 @@ error:
|
||||
WASAPI_RELEASE(enumerator);
|
||||
|
||||
if (id)
|
||||
wasapi_warn("Failed to initialize device");
|
||||
{
|
||||
RARCH_WARN("[WASAPI]: Failed to initialize device.\n");
|
||||
}
|
||||
else
|
||||
wasapi_err("Failed to initialize device");
|
||||
{
|
||||
RARCH_ERR("[WASAPI]: Failed to initialize device.\n");
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
@ -268,7 +305,8 @@ static IAudioClient *wasapi_init_client_sh(IMMDevice *device,
|
||||
IAudioClient *client = NULL;
|
||||
bool float_fmt_res = *float_fmt;
|
||||
unsigned rate_res = *rate;
|
||||
HRESULT hr = device->lpVtbl->Activate(device, &IID_IAudioClient,
|
||||
HRESULT hr = _IMMDevice_Activate(device,
|
||||
IID_IAudioClient,
|
||||
CLSCTX_ALL, NULL, (void**)&client);
|
||||
WASAPI_HR_CHECK(hr, "IMMDevice::Activate", return NULL);
|
||||
|
||||
@ -286,19 +324,33 @@ static IAudioClient *wasapi_init_client_sh(IMMDevice *device,
|
||||
float_fmt_res ? "float" : "pcm", rate_res, latency);
|
||||
|
||||
wasapi_set_format(&wf, float_fmt_res, rate_res);
|
||||
#ifdef __cplusplus
|
||||
hr = client->Initialize(AUDCLNT_SHAREMODE_SHARED,
|
||||
AUDCLNT_STREAMFLAGS_EVENTCALLBACK | AUDCLNT_STREAMFLAGS_NOPERSIST,
|
||||
0, 0, (WAVEFORMATEX*)&wf, NULL);
|
||||
#else
|
||||
hr = client->lpVtbl->Initialize(client, AUDCLNT_SHAREMODE_SHARED,
|
||||
AUDCLNT_STREAMFLAGS_EVENTCALLBACK | AUDCLNT_STREAMFLAGS_NOPERSIST,
|
||||
0, 0, (WAVEFORMATEX*)&wf, NULL);
|
||||
#endif
|
||||
|
||||
if (hr == AUDCLNT_E_ALREADY_INITIALIZED)
|
||||
{
|
||||
client->lpVtbl->Release(client);
|
||||
hr = device->lpVtbl->Activate(device, &IID_IAudioClient,
|
||||
CLSCTX_ALL, NULL, (void**)&client);
|
||||
WASAPI_RELEASE(client);
|
||||
HRESULT hr = _IMMDevice_Activate(device,
|
||||
IID_IAudioClient,
|
||||
CLSCTX_ALL, NULL, (void**)&client);
|
||||
WASAPI_HR_CHECK(hr, "IMMDevice::Activate", return NULL);
|
||||
|
||||
#ifdef __cplusplus
|
||||
hr = client->Initialize(AUDCLNT_SHAREMODE_SHARED,
|
||||
AUDCLNT_STREAMFLAGS_EVENTCALLBACK | AUDCLNT_STREAMFLAGS_NOPERSIST,
|
||||
0, 0, (WAVEFORMATEX*)&wf, NULL);
|
||||
#else
|
||||
hr = client->lpVtbl->Initialize(client, AUDCLNT_SHAREMODE_SHARED,
|
||||
AUDCLNT_STREAMFLAGS_EVENTCALLBACK | AUDCLNT_STREAMFLAGS_NOPERSIST,
|
||||
0, 0, (WAVEFORMATEX*)&wf, NULL);
|
||||
#endif
|
||||
}
|
||||
if (hr != AUDCLNT_E_UNSUPPORTED_FORMAT)
|
||||
{
|
||||
@ -306,7 +358,7 @@ static IAudioClient *wasapi_init_client_sh(IMMDevice *device,
|
||||
break;
|
||||
}
|
||||
|
||||
wasapi_warn("Unsupported format");
|
||||
RARCH_WARN("[WASAPI]: Unsupported format.\n");
|
||||
rate_res = wasapi_pref_rate(j);
|
||||
if (rate_res == *rate) /* requested rate is allready tested */
|
||||
rate_res = wasapi_pref_rate(++j); /* skip it */
|
||||
@ -337,12 +389,12 @@ static IAudioClient *wasapi_init_client_ex(IMMDevice *device,
|
||||
REFERENCE_TIME minimum_period = 0;
|
||||
REFERENCE_TIME buffer_duration = 0;
|
||||
UINT32 buffer_length = 0;
|
||||
HRESULT hr = device->lpVtbl->Activate(
|
||||
device, &IID_IAudioClient,
|
||||
HRESULT hr = _IMMDevice_Activate(device,
|
||||
IID_IAudioClient,
|
||||
CLSCTX_ALL, NULL, (void**)&client);
|
||||
WASAPI_HR_CHECK(hr, "IMMDevice::Activate", return NULL);
|
||||
|
||||
hr = client->lpVtbl->GetDevicePeriod(client, NULL, &minimum_period);
|
||||
hr = _IAudioClient_GetDevicePeriod(client, NULL, &minimum_period);
|
||||
WASAPI_HR_CHECK(hr, "IAudioClient::GetDevicePeriod", goto error);
|
||||
|
||||
/* buffer_duration is in 100ns units */
|
||||
@ -364,34 +416,54 @@ static IAudioClient *wasapi_init_client_ex(IMMDevice *device,
|
||||
float_fmt_res ? "float" : "pcm", rate_res, latency);
|
||||
|
||||
wasapi_set_format(&wf, float_fmt_res, rate_res);
|
||||
#ifdef __cplusplus
|
||||
hr = client->Initialize(AUDCLNT_SHAREMODE_EXCLUSIVE,
|
||||
AUDCLNT_STREAMFLAGS_EVENTCALLBACK | AUDCLNT_STREAMFLAGS_NOPERSIST,
|
||||
buffer_duration, buffer_duration, (WAVEFORMATEX*)&wf, NULL);
|
||||
#else
|
||||
hr = client->lpVtbl->Initialize(client, AUDCLNT_SHAREMODE_EXCLUSIVE,
|
||||
AUDCLNT_STREAMFLAGS_EVENTCALLBACK | AUDCLNT_STREAMFLAGS_NOPERSIST,
|
||||
buffer_duration, buffer_duration, (WAVEFORMATEX*)&wf, NULL);
|
||||
#endif
|
||||
if (hr == AUDCLNT_E_BUFFER_SIZE_NOT_ALIGNED)
|
||||
{
|
||||
hr = client->lpVtbl->GetBufferSize(client, &buffer_length);
|
||||
hr = _IAudioClient_GetBufferSize(client, &buffer_length);
|
||||
WASAPI_HR_CHECK(hr, "IAudioClient::GetBufferSize", goto error);
|
||||
|
||||
client->lpVtbl->Release(client);
|
||||
hr = device->lpVtbl->Activate(device, &IID_IAudioClient,
|
||||
CLSCTX_ALL, NULL, (void**)&client);
|
||||
WASAPI_RELEASE(client);
|
||||
hr = _IMMDevice_Activate(device,
|
||||
IID_IAudioClient,
|
||||
CLSCTX_ALL, NULL, (void**)&client);
|
||||
WASAPI_HR_CHECK(hr, "IMMDevice::Activate", return NULL);
|
||||
|
||||
buffer_duration = 10000.0 * 1000.0 / rate_res * buffer_length + 0.5;
|
||||
#ifdef __cplusplus
|
||||
hr = client->Initialize(AUDCLNT_SHAREMODE_EXCLUSIVE,
|
||||
AUDCLNT_STREAMFLAGS_EVENTCALLBACK | AUDCLNT_STREAMFLAGS_NOPERSIST,
|
||||
buffer_duration, buffer_duration, (WAVEFORMATEX*)&wf, NULL);
|
||||
#else
|
||||
hr = client->lpVtbl->Initialize(client, AUDCLNT_SHAREMODE_EXCLUSIVE,
|
||||
AUDCLNT_STREAMFLAGS_EVENTCALLBACK | AUDCLNT_STREAMFLAGS_NOPERSIST,
|
||||
buffer_duration, buffer_duration, (WAVEFORMATEX*)&wf, NULL);
|
||||
#endif
|
||||
}
|
||||
if (hr == AUDCLNT_E_ALREADY_INITIALIZED)
|
||||
{
|
||||
client->lpVtbl->Release(client);
|
||||
hr = device->lpVtbl->Activate(device, &IID_IAudioClient,
|
||||
CLSCTX_ALL, NULL, (void**)&client);
|
||||
WASAPI_RELEASE(client);
|
||||
hr = _IMMDevice_Activate(device,
|
||||
IID_IAudioClient,
|
||||
CLSCTX_ALL, NULL, (void**)&client);
|
||||
WASAPI_HR_CHECK(hr, "IMMDevice::Activate", return NULL);
|
||||
|
||||
#ifdef __cplusplus
|
||||
hr = client->Initialize(AUDCLNT_SHAREMODE_EXCLUSIVE,
|
||||
AUDCLNT_STREAMFLAGS_EVENTCALLBACK | AUDCLNT_STREAMFLAGS_NOPERSIST,
|
||||
buffer_duration, buffer_duration, (WAVEFORMATEX*)&wf, NULL);
|
||||
#else
|
||||
hr = client->lpVtbl->Initialize(client, AUDCLNT_SHAREMODE_EXCLUSIVE,
|
||||
AUDCLNT_STREAMFLAGS_EVENTCALLBACK | AUDCLNT_STREAMFLAGS_NOPERSIST,
|
||||
buffer_duration, buffer_duration, (WAVEFORMATEX*)&wf, NULL);
|
||||
#endif
|
||||
}
|
||||
if (hr != AUDCLNT_E_UNSUPPORTED_FORMAT)
|
||||
{
|
||||
@ -405,7 +477,7 @@ static IAudioClient *wasapi_init_client_ex(IMMDevice *device,
|
||||
break;
|
||||
}
|
||||
|
||||
wasapi_warn("Unsupported format");
|
||||
RARCH_WARN("[WASAPI]: Unsupported format.\n");
|
||||
rate_res = wasapi_pref_rate(j);
|
||||
if (rate_res == *rate) /* requested rate is allready tested */
|
||||
rate_res = wasapi_pref_rate(++j); /* skip it */
|
||||
@ -461,22 +533,29 @@ static IAudioClient *wasapi_init_client(IMMDevice *device, bool *exclusive,
|
||||
/* next calls are allowed to fail (we losing info only) */
|
||||
|
||||
if (*exclusive)
|
||||
hr = client->lpVtbl->GetDevicePeriod(client, NULL, &device_period);
|
||||
hr = _IAudioClient_GetDevicePeriod(client, NULL, &device_period);
|
||||
else
|
||||
hr = client->lpVtbl->GetDevicePeriod(client, &device_period, NULL);
|
||||
hr = _IAudioClient_GetDevicePeriod(client, &device_period, NULL);
|
||||
|
||||
if (FAILED(hr))
|
||||
wasapi_com_warn("IAudioClient::GetDevicePeriod", hr);
|
||||
{
|
||||
RARCH_WARN("[WASAPI]: IAudioClient::GetDevicePeriod failed with error 0x%.8X.\n", hr);
|
||||
}
|
||||
|
||||
if (!*exclusive)
|
||||
{
|
||||
hr = client->lpVtbl->GetStreamLatency(client, &stream_latency);
|
||||
hr = _IAudioClient_GetStreamLatency(client, &stream_latency);
|
||||
if (FAILED(hr))
|
||||
wasapi_com_warn("IAudioClient::GetStreamLatency", hr);
|
||||
{
|
||||
RARCH_WARN("[WASAPI]: IAudioClient::GetStreamLatency failed with error 0x%.8X.\n", hr);
|
||||
}
|
||||
}
|
||||
|
||||
hr = client->lpVtbl->GetBufferSize(client, &buffer_length);
|
||||
hr = _IAudioClient_GetBufferSize(client, &buffer_length);
|
||||
if (FAILED(hr))
|
||||
wasapi_com_warn("IAudioClient::GetBufferSize", hr);
|
||||
{
|
||||
RARCH_WARN("[WASAPI]: IAudioClient::GetBufferSize failed with error 0x%.8X.\n", hr);
|
||||
}
|
||||
|
||||
if (*exclusive)
|
||||
latency_res = (double)buffer_length * 1000.0 / (*rate);
|
||||
@ -528,7 +607,7 @@ static void *wasapi_init(const char *dev_id, unsigned rate, unsigned latency,
|
||||
if (!w->client)
|
||||
goto error;
|
||||
|
||||
hr = w->client->lpVtbl->GetBufferSize(w->client, &frame_count);
|
||||
hr = _IAudioClient_GetBufferSize(w->client, &frame_count);
|
||||
WASAPI_HR_CHECK(hr, "IAudioClient::GetBufferSize", goto error);
|
||||
|
||||
w->frame_size = float_format ? 8 : 4;
|
||||
@ -545,7 +624,7 @@ static void *wasapi_init(const char *dev_id, unsigned rate, unsigned latency,
|
||||
{
|
||||
if (sh_buffer_length < 0)
|
||||
{
|
||||
hr = w->client->lpVtbl->GetDevicePeriod(w->client, &dev_period, NULL);
|
||||
hr = _IAudioClient_GetDevicePeriod(w->client, &dev_period, NULL);
|
||||
WASAPI_HR_CHECK(hr, "IAudioClient::GetDevicePeriod", goto error);
|
||||
|
||||
sh_buffer_length = dev_period * rate / 10000000;
|
||||
@ -558,26 +637,29 @@ static void *wasapi_init(const char *dev_id, unsigned rate, unsigned latency,
|
||||
sh_buffer_length, (double)sh_buffer_length * 1000.0 / rate);
|
||||
}
|
||||
else
|
||||
wasapi_log("Intermediate buffer is off");
|
||||
{
|
||||
RARCH_LOG("[WASAPI]: Intermediate buffer is off. \n");
|
||||
}
|
||||
|
||||
w->write_event = CreateEventA(NULL, FALSE, FALSE, NULL);
|
||||
WASAPI_SR_CHECK(w->write_event, "CreateEventA", goto error);
|
||||
|
||||
hr = w->client->lpVtbl->SetEventHandle(w->client, w->write_event);
|
||||
hr = _IAudioClient_SetEventHandle(w->client, w->write_event);
|
||||
WASAPI_HR_CHECK(hr, "IAudioClient::SetEventHandle", goto error);
|
||||
|
||||
hr = w->client->lpVtbl->GetService(w->client,
|
||||
&IID_IAudioRenderClient, (void**)&w->renderer);
|
||||
hr = _IAudioClient_GetService(w->client,
|
||||
IID_IAudioRenderClient, (void**)&w->renderer);
|
||||
WASAPI_HR_CHECK(hr, "IAudioClient::GetService", goto error);
|
||||
|
||||
hr = w->renderer->lpVtbl->GetBuffer(w->renderer, frame_count, &dest);
|
||||
hr = _IAudioRenderClient_GetBuffer(w->renderer, frame_count, &dest);
|
||||
WASAPI_HR_CHECK(hr, "IAudioRenderClient::GetBuffer", goto error);
|
||||
|
||||
hr = w->renderer->lpVtbl->ReleaseBuffer(w->renderer, frame_count,
|
||||
hr = _IAudioRenderClient_ReleaseBuffer(
|
||||
w->renderer, frame_count,
|
||||
AUDCLNT_BUFFERFLAGS_SILENT);
|
||||
WASAPI_HR_CHECK(hr, "IAudioRenderClient::ReleaseBuffer", goto error);
|
||||
|
||||
hr = w->client->lpVtbl->Start(w->client);
|
||||
hr = _IAudioClient_Start(w->client);
|
||||
WASAPI_HR_CHECK(hr, "IAudioClient::Start", goto error);
|
||||
w->running = true;
|
||||
w->blocking = settings->bools.audio_sync;
|
||||
@ -603,13 +685,14 @@ static bool wasapi_flush(wasapi_t * w, const void * data, size_t size)
|
||||
{
|
||||
BYTE *dest = NULL;
|
||||
UINT32 frame_count = size / w->frame_size;
|
||||
HRESULT hr = w->renderer->lpVtbl->GetBuffer(w->renderer, frame_count, &dest);
|
||||
|
||||
HRESULT hr = _IAudioRenderClient_GetBuffer(
|
||||
w->renderer, frame_count, &dest);
|
||||
WASAPI_HR_CHECK(hr, "IAudioRenderClient::GetBuffer", return false)
|
||||
|
||||
memcpy(dest, data, size);
|
||||
hr = w->renderer->lpVtbl->ReleaseBuffer(w->renderer, frame_count, 0);
|
||||
|
||||
hr = _IAudioRenderClient_ReleaseBuffer(
|
||||
w->renderer, frame_count,
|
||||
0);
|
||||
WASAPI_HR_CHECK(hr, "IAudioRenderClient::ReleaseBuffer", return false);
|
||||
|
||||
return true;
|
||||
@ -619,13 +702,14 @@ static bool wasapi_flush_buffer(wasapi_t * w, size_t size)
|
||||
{
|
||||
BYTE *dest = NULL;
|
||||
UINT32 frame_count = size / w->frame_size;
|
||||
HRESULT hr = w->renderer->lpVtbl->GetBuffer(w->renderer, frame_count, &dest);
|
||||
|
||||
HRESULT hr = _IAudioRenderClient_GetBuffer(
|
||||
w->renderer, frame_count, &dest);
|
||||
WASAPI_HR_CHECK(hr, "IAudioRenderClient::GetBuffer", return false)
|
||||
|
||||
fifo_read(w->buffer, dest, size);
|
||||
hr = w->renderer->lpVtbl->ReleaseBuffer(w->renderer, frame_count, 0);
|
||||
|
||||
hr = _IAudioRenderClient_ReleaseBuffer(
|
||||
w->renderer, frame_count,
|
||||
0);
|
||||
WASAPI_HR_CHECK(hr, "IAudioRenderClient::ReleaseBuffer", return false);
|
||||
|
||||
return true;
|
||||
@ -634,42 +718,41 @@ static bool wasapi_flush_buffer(wasapi_t * w, size_t size)
|
||||
static ssize_t wasapi_write_sh(wasapi_t *w, const void * data, size_t size)
|
||||
{
|
||||
DWORD ir;
|
||||
size_t read_avail;
|
||||
size_t write_avail;
|
||||
HRESULT hr;
|
||||
bool br;
|
||||
ssize_t writen = -1;
|
||||
UINT32 padding = 0;
|
||||
size_t write_avail = 0;
|
||||
ssize_t written = -1;
|
||||
UINT32 padding = 0;
|
||||
|
||||
if (w->buffer)
|
||||
{
|
||||
write_avail = fifo_write_avail(w->buffer);
|
||||
if (!write_avail)
|
||||
{
|
||||
size_t read_avail = 0;
|
||||
|
||||
if (w->blocking)
|
||||
{
|
||||
ir = WaitForSingleObject(w->write_event, INFINITE);
|
||||
WASAPI_SR_CHECK(ir == WAIT_OBJECT_0, "WaitForSingleObject", return -1);
|
||||
}
|
||||
|
||||
hr = w->client->lpVtbl->GetCurrentPadding(w->client, &padding);
|
||||
hr = _IAudioClient_GetCurrentPadding(w->client, &padding);
|
||||
WASAPI_HR_CHECK(hr, "IAudioClient::GetCurrentPadding", return -1);
|
||||
|
||||
read_avail = fifo_read_avail(w->buffer);
|
||||
read_avail = fifo_read_avail(w->buffer);
|
||||
write_avail = w->engine_buffer_size - padding * w->frame_size;
|
||||
writen = read_avail < write_avail ? read_avail : write_avail;
|
||||
if (writen)
|
||||
written = read_avail < write_avail ? read_avail : write_avail;
|
||||
if (written)
|
||||
{
|
||||
br = wasapi_flush_buffer(w, writen);
|
||||
if (!br)
|
||||
if (!wasapi_flush_buffer(w, written))
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
write_avail = fifo_write_avail(w->buffer);
|
||||
writen = size < write_avail ? size : write_avail;
|
||||
if (writen)
|
||||
fifo_write(w->buffer, data, writen);
|
||||
written = size < write_avail ? size : write_avail;
|
||||
if (written)
|
||||
fifo_write(w->buffer, data, written);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -679,46 +762,42 @@ static ssize_t wasapi_write_sh(wasapi_t *w, const void * data, size_t size)
|
||||
WASAPI_SR_CHECK(ir == WAIT_OBJECT_0, "WaitForSingleObject", return -1);
|
||||
}
|
||||
|
||||
hr = w->client->lpVtbl->GetCurrentPadding(w->client, &padding);
|
||||
hr = _IAudioClient_GetCurrentPadding(w->client, &padding);
|
||||
WASAPI_HR_CHECK(hr, "IAudioClient::GetCurrentPadding", return -1);
|
||||
|
||||
write_avail = w->engine_buffer_size - padding * w->frame_size;
|
||||
if (!write_avail)
|
||||
return 0;
|
||||
|
||||
writen = size < write_avail ? size : write_avail;
|
||||
if (writen)
|
||||
written = size < write_avail ? size : write_avail;
|
||||
if (written)
|
||||
{
|
||||
br = wasapi_flush(w, data, writen);
|
||||
if (!br)
|
||||
if (!wasapi_flush(w, data, written))
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
return writen;
|
||||
return written;
|
||||
}
|
||||
|
||||
static ssize_t wasapi_write_ex(wasapi_t *w, const void * data, size_t size)
|
||||
{
|
||||
DWORD ir;
|
||||
size_t write_avail;
|
||||
bool br = false;
|
||||
ssize_t writen = 0;
|
||||
ssize_t writen = 0;
|
||||
size_t write_avail = fifo_write_avail(w->buffer);
|
||||
|
||||
write_avail = fifo_write_avail(w->buffer);
|
||||
if (!write_avail)
|
||||
{
|
||||
ir = WaitForSingleObject(w->write_event, w->blocking ? INFINITE : 0);
|
||||
DWORD ir = WaitForSingleObject(
|
||||
w->write_event, w->blocking ? INFINITE : 0);
|
||||
if (ir != WAIT_OBJECT_0 && w->blocking)
|
||||
{
|
||||
wasapi_sys_err("WaitForSingleObject");
|
||||
RARCH_ERR("[WASAPI]: WaitForSingleObject failed with error %d.\n", GetLastError());
|
||||
return -1;
|
||||
}
|
||||
if (ir != WAIT_OBJECT_0)
|
||||
return 0;
|
||||
|
||||
br = wasapi_flush_buffer(w, w->engine_buffer_size);
|
||||
if (!br)
|
||||
if (!wasapi_flush_buffer(w, w->engine_buffer_size))
|
||||
return -1;
|
||||
|
||||
write_avail = w->engine_buffer_size;
|
||||
@ -732,34 +811,34 @@ static ssize_t wasapi_write_ex(wasapi_t *w, const void * data, size_t size)
|
||||
|
||||
static ssize_t wasapi_write(void *wh, const void *data, size_t size)
|
||||
{
|
||||
size_t writen;
|
||||
ssize_t ir;
|
||||
size_t written;
|
||||
wasapi_t *w = (wasapi_t*)wh;
|
||||
|
||||
if (w->blocking)
|
||||
{
|
||||
for (writen = 0, ir = -1; writen < size; writen += ir)
|
||||
ssize_t ir;
|
||||
for (written = 0, ir = -1; written < size; written += ir)
|
||||
{
|
||||
if (w->exclusive)
|
||||
ir = wasapi_write_ex(w, (char*)data + writen, size - writen);
|
||||
ir = wasapi_write_ex(w, (char*)data + written, size - written);
|
||||
else
|
||||
ir = wasapi_write_sh(w, (char*)data + writen, size - writen);
|
||||
ir = wasapi_write_sh(w, (char*)data + written, size - written);
|
||||
if (ir == -1)
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
else if (w->exclusive)
|
||||
writen = wasapi_write_ex(w, data, size);
|
||||
written = wasapi_write_ex(w, data, size);
|
||||
else
|
||||
writen = wasapi_write_sh(w, data, size);
|
||||
written = wasapi_write_sh(w, data, size);
|
||||
|
||||
return writen;
|
||||
return written;
|
||||
}
|
||||
|
||||
static bool wasapi_stop(void *wh)
|
||||
{
|
||||
wasapi_t *w = (wasapi_t*)wh;
|
||||
HRESULT hr = w->client->lpVtbl->Stop(w->client);
|
||||
HRESULT hr = _IAudioClient_Stop(w->client);
|
||||
WASAPI_HR_CHECK(hr, "IAudioClient::Stop", return !w->running);
|
||||
|
||||
w->running = false;
|
||||
@ -770,7 +849,7 @@ static bool wasapi_stop(void *wh)
|
||||
static bool wasapi_start(void *wh, bool u)
|
||||
{
|
||||
wasapi_t *w = (wasapi_t*)wh;
|
||||
HRESULT hr = w->client->lpVtbl->Start(w->client);
|
||||
HRESULT hr = _IAudioClient_Start(w->client);
|
||||
|
||||
if (hr == AUDCLNT_E_NOT_STOPPED)
|
||||
return true;
|
||||
@ -800,13 +879,13 @@ static void wasapi_set_nonblock_state(void *wh, bool nonblock)
|
||||
|
||||
static void wasapi_free(void *wh)
|
||||
{
|
||||
DWORD ir;
|
||||
wasapi_t *w = (wasapi_t*)wh;
|
||||
HANDLE write_event = w->write_event;
|
||||
DWORD ir;
|
||||
|
||||
WASAPI_RELEASE(w->renderer);
|
||||
if (w->client)
|
||||
w->client->lpVtbl->Stop(w->client);
|
||||
_IAudioClient_Stop(w->client);
|
||||
WASAPI_RELEASE(w->client);
|
||||
WASAPI_RELEASE(w->device);
|
||||
CoUninitialize();
|
||||
@ -816,7 +895,9 @@ static void wasapi_free(void *wh)
|
||||
|
||||
ir = WaitForSingleObject(write_event, 20);
|
||||
if (ir == WAIT_FAILED)
|
||||
wasapi_sys_err("WaitForSingleObject");
|
||||
{
|
||||
RARCH_ERR("[WASAPI]: WaitForSingleObject failed with error %d.\n", GetLastError());
|
||||
}
|
||||
|
||||
/* If event isn't signaled log and leak */
|
||||
WASAPI_CHECK(ir == WAIT_OBJECT_0, "Memory leak in wasapi_free", return);
|
||||
@ -850,28 +931,31 @@ static void *wasapi_device_list_new(void *u)
|
||||
char *dev_name_str = NULL;
|
||||
struct string_list *sl = string_list_new();
|
||||
|
||||
wasapi_log("Enumerating active devices ..");
|
||||
|
||||
WASAPI_CHECK(sl, "string_list_new failed", return NULL);
|
||||
|
||||
attr.i = 0;
|
||||
#ifdef __cplusplus
|
||||
hr = CoCreateInstance(CLSID_MMDeviceEnumerator, NULL, CLSCTX_ALL,
|
||||
IID_IMMDeviceEnumerator, (void **)&enumerator);
|
||||
#else
|
||||
hr = CoCreateInstance(&CLSID_MMDeviceEnumerator, NULL, CLSCTX_ALL,
|
||||
&IID_IMMDeviceEnumerator, (void **)&enumerator);
|
||||
#endif
|
||||
WASAPI_HR_CHECK(hr, "CoCreateInstance", goto error);
|
||||
|
||||
hr = enumerator->lpVtbl->EnumAudioEndpoints(enumerator,
|
||||
hr = _IMMDeviceEnumerator_EnumAudioEndpoints(enumerator,
|
||||
eRender, DEVICE_STATE_ACTIVE, &collection);
|
||||
WASAPI_HR_CHECK(hr, "IMMDeviceEnumerator::EnumAudioEndpoints", goto error);
|
||||
|
||||
hr = collection->lpVtbl->GetCount(collection, &dev_count);
|
||||
hr = _IMMDeviceCollection_GetCount(collection, &dev_count);
|
||||
WASAPI_HR_CHECK(hr, "IMMDeviceCollection::GetCount", goto error);
|
||||
|
||||
for (i = 0; i < dev_count; ++i)
|
||||
{
|
||||
hr = collection->lpVtbl->Item(collection, i, &device);
|
||||
hr = _IMMDeviceCollection_Item(collection, i, &device);
|
||||
WASAPI_HR_CHECK(hr, "IMMDeviceCollection::Item", goto error);
|
||||
|
||||
hr = device->lpVtbl->GetId(device, &dev_id_wstr);
|
||||
hr = _IMMDevice_GetId(device, &dev_id_wstr);
|
||||
WASAPI_HR_CHECK(hr, "IMMDevice::GetId", goto error);
|
||||
|
||||
ir = WideCharToMultiByte(CP_ACP, 0, dev_id_wstr, -1,
|
||||
@ -885,13 +969,13 @@ static void *wasapi_device_list_new(void *u)
|
||||
dev_id_str, ir, NULL, NULL);
|
||||
WASAPI_SR_CHECK(ir, "WideCharToMultiByte", goto error);
|
||||
|
||||
hr = device->lpVtbl->OpenPropertyStore(device, STGM_READ, &prop_store);
|
||||
hr = _IMMDevice_OpenPropertyStore(device, STGM_READ, &prop_store);
|
||||
WASAPI_HR_CHECK(hr, "IMMDevice::OpenPropertyStore", goto error);
|
||||
|
||||
PropVariantInit(&prop_var);
|
||||
prop_var_init = true;
|
||||
hr = prop_store->lpVtbl->GetValue(prop_store,
|
||||
&PKEY_Device_FriendlyName, &prop_var);
|
||||
hr = _IPropertyStore_GetValue(prop_store, PKEY_Device_FriendlyName,
|
||||
&prop_var);
|
||||
WASAPI_HR_CHECK(hr, "IPropertyStore::GetValue", goto error);
|
||||
|
||||
ir = WideCharToMultiByte(CP_ACP, 0, prop_var.pwszVal, -1,
|
||||
@ -922,8 +1006,6 @@ static void *wasapi_device_list_new(void *u)
|
||||
WASAPI_RELEASE(collection);
|
||||
WASAPI_RELEASE(enumerator);
|
||||
|
||||
wasapi_log("Devices enumerated");
|
||||
|
||||
return sl;
|
||||
|
||||
error:
|
||||
@ -939,7 +1021,7 @@ error:
|
||||
if (sl)
|
||||
string_list_free(sl);
|
||||
|
||||
wasapi_err("Device enumeration failed");
|
||||
RARCH_ERR("[WASAPI]: Device enumeration failed.\n");
|
||||
|
||||
return NULL;
|
||||
}
|
||||
@ -960,7 +1042,7 @@ static size_t wasapi_write_avail(void *wh)
|
||||
if (w->buffer)
|
||||
return fifo_write_avail(w->buffer);
|
||||
|
||||
hr = w->client->lpVtbl->GetCurrentPadding(w->client, &padding);
|
||||
hr = _IAudioClient_GetCurrentPadding(w->client, &padding);
|
||||
WASAPI_HR_CHECK(hr, "IAudioClient::GetCurrentPadding", return 0);
|
||||
|
||||
return w->engine_buffer_size - padding * w->frame_size;
|
||||
|
@ -53,8 +53,13 @@ typedef struct
|
||||
size_t bufsize;
|
||||
} xa_t;
|
||||
|
||||
#ifdef __cplusplus
|
||||
struct xaudio2 : public IXAudio2VoiceCallback
|
||||
#else
|
||||
struct xaudio2
|
||||
#endif
|
||||
{
|
||||
#ifdef __cplusplus
|
||||
xaudio2() :
|
||||
buf(0), pXAudio2(0), pMasterVoice(0),
|
||||
pSourceVoice(0), hEvent(0), buffers(0), bufsize(0),
|
||||
@ -74,6 +79,9 @@ struct xaudio2 : public IXAudio2VoiceCallback
|
||||
STDMETHOD_(void, OnVoiceError) (void *, HRESULT) {}
|
||||
STDMETHOD_(void, OnVoiceProcessingPassEnd) () {}
|
||||
STDMETHOD_(void, OnVoiceProcessingPassStart) (UINT32) {}
|
||||
#else
|
||||
const IXAudio2VoiceCallbackVtbl *lpVtbl;
|
||||
#endif
|
||||
|
||||
uint8_t *buf;
|
||||
IXAudio2 *pXAudio2;
|
||||
@ -87,6 +95,31 @@ struct xaudio2 : public IXAudio2VoiceCallback
|
||||
unsigned write_buffer;
|
||||
};
|
||||
|
||||
#ifndef __cplusplus
|
||||
static void WINAPI voice_on_buffer_end(void *handle_, void *data)
|
||||
{
|
||||
xaudio2_t *handle = (xaudio2_t*)handle_;
|
||||
(void)data;
|
||||
InterlockedDecrement((LONG volatile*)&handle->buffers);
|
||||
SetEvent(handle->hEvent);
|
||||
}
|
||||
|
||||
static void WINAPI dummy_voidp(void *handle, void *data) { (void)handle; (void)data; }
|
||||
static void WINAPI dummy_nil(void *handle) { (void)handle; }
|
||||
static void WINAPI dummy_uint32(void *handle, UINT32 dummy) { (void)handle; (void)dummy; }
|
||||
static void WINAPI dummy_voidp_hresult(void *handle, void *data, HRESULT dummy) { (void)handle; (void)data; (void)dummy; }
|
||||
|
||||
const struct IXAudio2VoiceCallbackVtbl voice_vtable = {
|
||||
dummy_uint32,
|
||||
dummy_nil,
|
||||
dummy_nil,
|
||||
dummy_voidp,
|
||||
voice_on_buffer_end,
|
||||
dummy_voidp,
|
||||
dummy_voidp_hresult,
|
||||
};
|
||||
#endif
|
||||
|
||||
#if 0
|
||||
static void xaudio2_enumerate_devices(xaudio2_t *xa)
|
||||
{
|
||||
@ -97,13 +130,13 @@ static void xaudio2_enumerate_devices(xaudio2_t *xa)
|
||||
(void)i;
|
||||
(void)dev_count;
|
||||
#ifndef _XBOX
|
||||
xa->pXAudio2->GetDeviceCount(&dev_count);
|
||||
IXAudio2_GetDeviceCount(xa->pXAudio2, &dev_count);
|
||||
fprintf(stderr, "XAudio2 devices:\n");
|
||||
|
||||
for (i = 0; i < dev_count; i++)
|
||||
{
|
||||
XAUDIO2_DEVICE_DETAILS dev_detail;
|
||||
xa->pXAudio2->GetDeviceDetails(i, &dev_detail);
|
||||
IXAudio2_GetDeviceDetails(xa->pXAudio2, i, &dev_detail);
|
||||
fwprintf(stderr, L"\t%u: %s\n", i, dev_detail.DisplayName);
|
||||
}
|
||||
#endif
|
||||
@ -130,21 +163,31 @@ static void xaudio2_free(xaudio2_t *handle)
|
||||
|
||||
if (handle->pSourceVoice)
|
||||
{
|
||||
handle->pSourceVoice->Stop(0, XAUDIO2_COMMIT_NOW);
|
||||
handle->pSourceVoice->DestroyVoice();
|
||||
IXAudio2SourceVoice_Stop(handle->pSourceVoice,
|
||||
0, XAUDIO2_COMMIT_NOW);
|
||||
IXAudio2SourceVoice_DestroyVoice(handle->pSourceVoice);
|
||||
}
|
||||
|
||||
if (handle->pMasterVoice)
|
||||
handle->pMasterVoice->DestroyVoice();
|
||||
{
|
||||
IXAudio2MasteringVoice_DestroyVoice(handle->pMasterVoice);
|
||||
}
|
||||
|
||||
if (handle->pXAudio2)
|
||||
handle->pXAudio2->Release();
|
||||
{
|
||||
IXAudio2_Release(handle->pXAudio2);
|
||||
}
|
||||
|
||||
if (handle->hEvent)
|
||||
CloseHandle(handle->hEvent);
|
||||
|
||||
free(handle->buf);
|
||||
|
||||
#ifdef __cplusplus
|
||||
delete handle;
|
||||
#else
|
||||
free(handle);
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifndef COINIT_MULTITHREADED
|
||||
@ -154,27 +197,38 @@ static void xaudio2_free(xaudio2_t *handle)
|
||||
static xaudio2_t *xaudio2_new(unsigned samplerate, unsigned channels,
|
||||
size_t size, unsigned device)
|
||||
{
|
||||
xaudio2_t *handle;
|
||||
WAVEFORMATEX wfx = {0};
|
||||
xaudio2_t *handle = NULL;
|
||||
WAVEFORMATEX wfx = {0};
|
||||
|
||||
#ifndef _XBOX
|
||||
CoInitializeEx(0, COINIT_MULTITHREADED);
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
handle = new xaudio2;
|
||||
#else
|
||||
handle = (xaudio2_t*)calloc(1, sizeof(*handle));
|
||||
#endif
|
||||
|
||||
if (!handle)
|
||||
goto error;
|
||||
|
||||
#ifndef __cplusplus
|
||||
handle->lpVtbl = &voice_vtable;
|
||||
#endif
|
||||
|
||||
if (FAILED(XAudio2Create(&handle->pXAudio2, 0, XAUDIO2_DEFAULT_PROCESSOR)))
|
||||
goto error;
|
||||
|
||||
if (FAILED(handle->pXAudio2->CreateMasteringVoice(&handle->pMasterVoice,
|
||||
channels, samplerate, 0, device, NULL)))
|
||||
if (FAILED(IXAudio2_CreateMasteringVoice(handle->pXAudio2, &handle->pMasterVoice, channels, samplerate, 0, device, NULL)))
|
||||
goto error;
|
||||
|
||||
xaudio2_set_wavefmt(&wfx, channels, samplerate);
|
||||
|
||||
if (FAILED(handle->pXAudio2->CreateSourceVoice(&handle->pSourceVoice, &wfx,
|
||||
XAUDIO2_VOICE_NOSRC, XAUDIO2_DEFAULT_FREQ_RATIO,
|
||||
handle)))
|
||||
if (FAILED(IXAudio2_CreateSourceVoice(handle->pXAudio2,
|
||||
&handle->pSourceVoice, &wfx,
|
||||
XAUDIO2_VOICE_NOSRC, XAUDIO2_DEFAULT_FREQ_RATIO,
|
||||
(IXAudio2VoiceCallback*)handle, 0, 0)))
|
||||
goto error;
|
||||
|
||||
handle->hEvent = CreateEvent(0, FALSE, FALSE, 0);
|
||||
@ -186,7 +240,8 @@ static xaudio2_t *xaudio2_new(unsigned samplerate, unsigned channels,
|
||||
if (!handle->buf)
|
||||
goto error;
|
||||
|
||||
if (FAILED(handle->pSourceVoice->Start(0)))
|
||||
if (FAILED(IXAudio2SourceVoice_Start(handle->pSourceVoice, 0,
|
||||
XAUDIO2_COMMIT_NOW)))
|
||||
goto error;
|
||||
|
||||
return handle;
|
||||
@ -210,7 +265,8 @@ static size_t xaudio2_write(xaudio2_t *handle, const void *buf, size_t bytes_)
|
||||
{
|
||||
unsigned need = MIN(bytes, handle->bufsize - handle->bufptr);
|
||||
|
||||
memcpy(handle->buf + handle->write_buffer * handle->bufsize + handle->bufptr,
|
||||
memcpy(handle->buf + handle->write_buffer *
|
||||
handle->bufsize + handle->bufptr,
|
||||
buffer, need);
|
||||
|
||||
handle->bufptr += need;
|
||||
@ -219,15 +275,23 @@ static size_t xaudio2_write(xaudio2_t *handle, const void *buf, size_t bytes_)
|
||||
|
||||
if (handle->bufptr == handle->bufsize)
|
||||
{
|
||||
XAUDIO2_BUFFER xa2buffer = {0};
|
||||
XAUDIO2_BUFFER xa2buffer;
|
||||
|
||||
while (handle->buffers == MAX_BUFFERS - 1)
|
||||
WaitForSingleObject(handle->hEvent, INFINITE);
|
||||
|
||||
xa2buffer.Flags = 0;
|
||||
xa2buffer.AudioBytes = handle->bufsize;
|
||||
xa2buffer.pAudioData = handle->buf + handle->write_buffer * handle->bufsize;
|
||||
xa2buffer.PlayBegin = 0;
|
||||
xa2buffer.PlayLength = 0;
|
||||
xa2buffer.LoopBegin = 0;
|
||||
xa2buffer.LoopLength = 0;
|
||||
xa2buffer.LoopCount = 0;
|
||||
xa2buffer.pContext = NULL;
|
||||
|
||||
if (FAILED(handle->pSourceVoice->SubmitSourceBuffer(&xa2buffer, NULL)))
|
||||
if (FAILED(IXAudio2SourceVoice_SubmitSourceBuffer(
|
||||
handle->pSourceVoice, &xa2buffer, NULL)))
|
||||
return 0;
|
||||
|
||||
InterlockedIncrement((LONG volatile*)&handle->buffers);
|
@ -15,20 +15,29 @@
|
||||
* If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
// Kinda stripped down. Only contains the bare essentials used in RetroArch.
|
||||
/* Kinda stripped down. Only contains the bare essentials used in RetroArch. */
|
||||
|
||||
#ifndef XAUDIO2_STRIPPED_H
|
||||
#define XAUDIO2_STRIPPED_H
|
||||
|
||||
#include <retro_inline.h>
|
||||
#include <retro_environment.h>
|
||||
|
||||
// All structures defined in this file use tight field packing
|
||||
/* All structures defined in this file use tight field packing */
|
||||
#pragma pack(push, 1)
|
||||
|
||||
#ifdef __cplusplus
|
||||
#define X2DEFAULT(x) = (x)
|
||||
#else
|
||||
#define X2DEFAULT(x)
|
||||
#endif
|
||||
|
||||
#ifdef _XBOX
|
||||
#include <xtl.h>
|
||||
|
||||
#ifndef __cplusplus
|
||||
#define OPAQUE interface
|
||||
#endif
|
||||
#define DEFINE_CLSID(className, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8) \
|
||||
DEFINE_GUID(CLSID_##className, 0x##l, 0x##w1, 0x##w2, 0x##b1, 0x##b2, 0x##b3, 0x##b4, 0x##b5, 0x##b6, 0x##b7, 0x##b8)
|
||||
#define DEFINE_IID(interfaceName, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8) \
|
||||
@ -38,7 +47,7 @@ DEFINE_CLSID(XAudio2, 3eda9b49, 2085, 498b, 9b, b2, 39, a6, 77, 84, 93, de);
|
||||
DEFINE_CLSID(XAudio2_Debug, 47199894, 7cc2, 444d, 98, 73, ce, d2, 56, 2c, c6, 0e);
|
||||
DEFINE_IID(IXAudio2, 8bcf1f58, 9fe7, 4583, 8a, c6, e2, ad, c4, 65, c8, bb);
|
||||
|
||||
#include <audiodefs.h> // Basic audio data types and constants
|
||||
#include <audiodefs.h> /* Basic audio data types and constants */
|
||||
|
||||
#else
|
||||
|
||||
@ -48,6 +57,11 @@ DEFINE_IID(IXAudio2, 8bcf1f58, 9fe7, 4583, 8a, c6, e2, ad, c4, 65, c8, bb);
|
||||
#include <objbase.h>
|
||||
#include <mmreg.h>
|
||||
|
||||
#ifndef __cplusplus
|
||||
#undef OPAQUE
|
||||
#define OPAQUE struct
|
||||
#endif
|
||||
|
||||
#define DEFINE_GUID_X(n, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8) \
|
||||
static const GUID n = { l, w1, w2, { b1, b2, b3, b4, b5, b6, b7, b8 } }
|
||||
#define DEFINE_CLSID_X(className, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8) \
|
||||
@ -55,7 +69,13 @@ DEFINE_IID(IXAudio2, 8bcf1f58, 9fe7, 4583, 8a, c6, e2, ad, c4, 65, c8, bb);
|
||||
#define DEFINE_IID_X(interfaceName, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8) \
|
||||
DEFINE_GUID_X(IID_##interfaceName, 0x##l, 0x##w1, 0x##w2, 0x##b1, 0x##b2, 0x##b3, 0x##b4, 0x##b5, 0x##b6, 0x##b7, 0x##b8)
|
||||
|
||||
DEFINE_CLSID_X(XAudio2, 5a508685, a254, 4fba, 9b, 82, 9a, 24, b0, 03, 06, af); // 2.7
|
||||
#ifndef __cplusplus
|
||||
#ifndef INTERFACE
|
||||
#define INTERFACE void
|
||||
#endif
|
||||
#endif
|
||||
|
||||
DEFINE_CLSID_X(XAudio2, 5a508685, a254, 4fba, 9b, 82, 9a, 24, b0, 03, 06, af); /* 2.7 */
|
||||
DEFINE_IID_X(IXAudio2, 8bcf1f58, 9fe7, 4583, 8a, c6, e2, ad, c4, 65, c8, bb);
|
||||
|
||||
#endif
|
||||
@ -99,7 +119,11 @@ typedef enum XAUDIO2_XBOX_HWTHREAD_SPECIFIER
|
||||
#else
|
||||
typedef enum XAUDIO2_WINDOWS_PROCESSOR_SPECIFIER
|
||||
{
|
||||
#if defined(__STDC_C89__)
|
||||
XAUDIO2_ANY_PROCESSOR = 0xffff,
|
||||
#else
|
||||
XAUDIO2_ANY_PROCESSOR = 0xffffffff,
|
||||
#endif
|
||||
XAUDIO2_DEFAULT_PROCESSOR = XAUDIO2_ANY_PROCESSOR
|
||||
} XAUDIO2_WINDOWS_PROCESSOR_SPECIFIER, XAUDIO2_PROCESSOR;
|
||||
#endif
|
||||
@ -118,7 +142,8 @@ typedef struct XAUDIO2_DEVICE_DETAILS
|
||||
WAVEFORMATEXTENSIBLE OutputFormat;
|
||||
} XAUDIO2_DEVICE_DETAILS;
|
||||
|
||||
// Forward declarations.
|
||||
/* Forward declarations. */
|
||||
#ifdef __cplusplus
|
||||
struct XAUDIO2_VOICE_DETAILS;
|
||||
struct XAUDIO2_VOICE_SENDS;
|
||||
struct XAUDIO2_EFFECT_DESCRIPTOR;
|
||||
@ -130,6 +155,20 @@ struct XAUDIO2_PERFORMANCE_DATA;
|
||||
struct XAUDIO2_DEBUG_CONFIGURATION;
|
||||
struct IXAudio2EngineCallback;
|
||||
struct IXAudio2SubmixVoice;
|
||||
#else
|
||||
typedef OPAQUE XAUDIO2_VOICE_DETAILS XAUDIO2_VOICE_DETAILS;
|
||||
typedef OPAQUE XAUDIO2_VOICE_SENDS XAUDIO2_VOICE_SENDS;
|
||||
typedef OPAQUE XAUDIO2_EFFECT_DESCRIPTOR XAUDIO2_EFFECT_DESCRIPTOR;
|
||||
typedef OPAQUE XAUDIO2_EFFECT_CHAIN XAUDIO2_EFFECT_CHAIN;
|
||||
typedef OPAQUE XAUDIO2_FILTER_PARAMETERS XAUDIO2_FILTER_PARAMETERS;
|
||||
typedef OPAQUE XAUDIO2_BUFFER_WMA XAUDIO2_BUFFER_WMA;
|
||||
typedef OPAQUE XAUDIO2_VOICE_STATE XAUDIO2_VOICE_STATE;
|
||||
typedef OPAQUE XAUDIO2_PERFORMANCE_DATA XAUDIO2_PERFORMANCE_DATA;
|
||||
typedef OPAQUE XAUDIO2_DEBUG_CONFIGURATION XAUDIO2_DEBUG_CONFIGURATION;
|
||||
typedef OPAQUE IXAudio2EngineCallback IXAudio2EngineCallback;
|
||||
typedef OPAQUE IXAudio2SubmixVoice IXAudio2SubmixVoice;
|
||||
#endif
|
||||
|
||||
|
||||
typedef struct XAUDIO2_BUFFER
|
||||
{
|
||||
@ -253,31 +292,65 @@ DECLARE_INTERFACE_(IXAudio2, IUnknown)
|
||||
void *pReserved X2DEFAULT(NULL)) PURE;
|
||||
};
|
||||
|
||||
#ifdef __cplusplus
|
||||
/* C++ hooks */
|
||||
#define IXAudio2_Initialize(handle,a,b) handle->Initialize(a, b)
|
||||
#define IXAudio2SourceVoice_SubmitSourceBuffer(handle, a, b) handle->SubmitSourceBuffer(a, b)
|
||||
#define IXAudio2SourceVoice_Stop(handle, a, b) handle->Stop(a, b)
|
||||
#define IXAudio2SourceVoice_DestroyVoice(handle) handle->DestroyVoice()
|
||||
#define IXAudio2MasteringVoice_DestroyVoice(handle) handle->DestroyVoice()
|
||||
#define IXAudio2_Release(handle) handle->Release()
|
||||
#define IXAudio2_CreateSourceVoice(handle, a, b, c, d, e, f, g) handle->CreateSourceVoice(a, b, c, d, e, f, g)
|
||||
#define IXAudio2_CreateMasteringVoice(handle, a, b, c, d, e, f) handle->CreateMasteringVoice(a, b, c, d, e, f)
|
||||
#define IXAudio2SourceVoice_Start(handle, a, b) handle->Start(a, b)
|
||||
#else
|
||||
/* C hooks */
|
||||
#define IXAudio2_Initialize(THIS,a,b) (THIS)->lpVtbl->Initialize(THIS, a, b)
|
||||
#define IXAudio2_Release(THIS) (THIS)->lpVtbl->Release(THIS)
|
||||
#define IXAudio2_CreateSourceVoice(THIS,ppSourceVoice,pSourceFormat,Flags,MaxFrequencyRatio,pCallback,pSendList,pEffectChain) (THIS)->lpVtbl->CreateSourceVoice(THIS, ppSourceVoice,pSourceFormat,Flags,MaxFrequencyRatio,pCallback,pSendList,pEffectChain)
|
||||
#define IXAudio2_CreateMasteringVoice(THIS,ppMasteringVoice,InputChannels,InputSampleRate,Flags,DeviceIndex,pEffectChain) (THIS)->lpVtbl->CreateMasteringVoice(THIS, ppMasteringVoice,InputChannels,InputSampleRate,Flags,DeviceIndex,pEffectChain)
|
||||
#define IXAudio2_GetDeviceCount(THIS, puCount) (THIS)->lpVtbl->GetDeviceCount(THIS, puCount)
|
||||
#define IXAudio2_GetDeviceDetails(THIS, Index,pDeviceDetails) (THIS)->lpVtbl->GetDeviceDetails(THIS, Index, pDeviceDetails)
|
||||
#define IXAudio2SourceVoice_Start(THIS, Flags, OperationSet) (THIS)->lpVtbl->Start(THIS, Flags, OperationSet)
|
||||
#define IXAudio2SourceVoice_Stop(THIS, Flags, OperationSet) (THIS)->lpVtbl->Stop(THIS, Flags, OperationSet)
|
||||
#define IXAudio2SourceVoice_SubmitSourceBuffer(THIS, pBuffer, pBufferWMA) (THIS)->lpVtbl->SubmitSourceBuffer(THIS, pBuffer, pBufferWMA)
|
||||
#define IXAudio2SourceVoice_DestroyVoice(THIS) (THIS)->lpVtbl->DestroyVoice(THIS)
|
||||
#define IXAudio2MasteringVoice_DestroyVoice(THIS) (THIS)->lpVtbl->DestroyVoice(THIS)
|
||||
#endif
|
||||
|
||||
#ifdef _XBOX
|
||||
STDAPI XAudio2Create(__deref_out IXAudio2** ppXAudio2, UINT32 Flags X2DEFAULT(0),
|
||||
XAUDIO2_PROCESSOR XAudio2Processor X2DEFAULT(XAUDIO2_DEFAULT_PROCESSOR));
|
||||
#else
|
||||
static INLINE HRESULT XAudio2Create(IXAudio2 **ppXAudio2, UINT32, XAUDIO2_PROCESSOR)
|
||||
static INLINE HRESULT XAudio2Create(IXAudio2 **ppXAudio2, UINT32 flags, XAUDIO2_PROCESSOR proc)
|
||||
{
|
||||
IXAudio2 *pXAudio2;
|
||||
HRESULT hr;
|
||||
IXAudio2 *pXAudio2 = NULL;
|
||||
|
||||
HRESULT hr = CoCreateInstance(CLSID_XAudio2, NULL, CLSCTX_INPROC_SERVER, IID_IXAudio2, (void**)&pXAudio2);
|
||||
(void)flags;
|
||||
(void)proc;
|
||||
|
||||
#ifdef __cplusplus
|
||||
hr = CoCreateInstance(CLSID_XAudio2, NULL, CLSCTX_INPROC_SERVER, IID_IXAudio2, (void**)&pXAudio2);
|
||||
#else
|
||||
hr = CoCreateInstance(&CLSID_XAudio2, NULL, CLSCTX_INPROC_SERVER, &IID_IXAudio2, (void**)&pXAudio2);
|
||||
#endif
|
||||
|
||||
if (SUCCEEDED(hr))
|
||||
{
|
||||
//hr = IXAudio2_Initialize(pXAudio2, 0, XAUDIO2_DEFAULT_PROCESSOR);
|
||||
hr = pXAudio2->Initialize(0, XAUDIO2_DEFAULT_PROCESSOR);
|
||||
hr = IXAudio2_Initialize(pXAudio2, 0, XAUDIO2_DEFAULT_PROCESSOR);
|
||||
if (SUCCEEDED(hr))
|
||||
*ppXAudio2 = pXAudio2;
|
||||
else
|
||||
//IXAudio2_Release(pXAudio2);
|
||||
pXAudio2->Release();
|
||||
{
|
||||
IXAudio2_Release(pXAudio2);
|
||||
}
|
||||
}
|
||||
return hr;
|
||||
}
|
||||
#endif
|
||||
|
||||
// Undo the #pragma pack(push, 1) directive at the top of this file
|
||||
/* Undo the #pragma pack(push, 1) directive at the top of this file */
|
||||
#pragma pack(pop)
|
||||
|
||||
#endif
|
||||
|
File diff suppressed because it is too large
Load Diff
464
command.c
464
command.c
@ -89,23 +89,6 @@
|
||||
#define DEFAULT_NETWORK_CMD_PORT 55355
|
||||
#define STDIN_BUF_SIZE 4096
|
||||
|
||||
extern int libui_main(void);
|
||||
|
||||
struct command
|
||||
{
|
||||
#ifdef HAVE_STDIN_CMD
|
||||
bool stdin_enable;
|
||||
char stdin_buf[STDIN_BUF_SIZE];
|
||||
size_t stdin_buf_ptr;
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_NETWORKING) && defined(HAVE_NETWORK_CMD)
|
||||
int net_fd;
|
||||
#endif
|
||||
|
||||
bool state[RARCH_BIND_LIST_END];
|
||||
};
|
||||
|
||||
enum cmd_source_t
|
||||
{
|
||||
CMD_NONE = 0,
|
||||
@ -113,39 +96,6 @@ enum cmd_source_t
|
||||
CMD_NETWORK
|
||||
};
|
||||
|
||||
#if defined(HAVE_STDIN_CMD) || defined(HAVE_NETWORK_CMD) && defined(HAVE_NETWORKING)
|
||||
static enum cmd_source_t lastcmd_source;
|
||||
#endif
|
||||
#if defined(HAVE_NETWORKING) && defined(HAVE_NETWORK_CMD)
|
||||
static int lastcmd_net_fd;
|
||||
static struct sockaddr_storage lastcmd_net_source;
|
||||
static socklen_t lastcmd_net_source_len;
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_CHEEVOS
|
||||
#if defined(HAVE_STDIN_CMD) || defined(HAVE_NETWORK_CMD) && defined(HAVE_NETWORKING)
|
||||
static bool command_reply(const char * data, size_t len)
|
||||
{
|
||||
#ifdef HAVE_STDIN_CMD
|
||||
if (lastcmd_source == CMD_STDIN)
|
||||
{
|
||||
fwrite(data, 1,len, stdout);
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
#if defined(HAVE_NETWORKING) && defined(HAVE_NETWORK_CMD)
|
||||
if (lastcmd_source == CMD_NETWORK)
|
||||
{
|
||||
sendto(lastcmd_net_fd, data, len, 0,
|
||||
(struct sockaddr*)&lastcmd_net_source, lastcmd_net_source_len);
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
struct cmd_map
|
||||
{
|
||||
const char *str;
|
||||
@ -159,107 +109,27 @@ struct cmd_action_map
|
||||
const char *arg_desc;
|
||||
};
|
||||
|
||||
bool command_set_shader(const char *arg)
|
||||
struct command
|
||||
{
|
||||
char msg[256];
|
||||
enum rarch_shader_type type = RARCH_SHADER_NONE;
|
||||
|
||||
switch (msg_hash_to_file_type(msg_hash_calculate(path_get_extension(arg))))
|
||||
{
|
||||
case FILE_TYPE_SHADER_GLSL:
|
||||
case FILE_TYPE_SHADER_PRESET_GLSLP:
|
||||
type = RARCH_SHADER_GLSL;
|
||||
break;
|
||||
case FILE_TYPE_SHADER_CG:
|
||||
case FILE_TYPE_SHADER_PRESET_CGP:
|
||||
type = RARCH_SHADER_CG;
|
||||
break;
|
||||
case FILE_TYPE_SHADER_SLANG:
|
||||
case FILE_TYPE_SHADER_PRESET_SLANGP:
|
||||
type = RARCH_SHADER_SLANG;
|
||||
break;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
|
||||
snprintf(msg, sizeof(msg), "Shader: \"%s\"", arg);
|
||||
runloop_msg_queue_push(msg, 1, 120, true);
|
||||
RARCH_LOG("%s \"%s\".\n",
|
||||
msg_hash_to_str(MSG_APPLYING_SHADER),
|
||||
arg);
|
||||
|
||||
return video_driver_set_shader(type, arg);
|
||||
}
|
||||
|
||||
#ifdef HAVE_COMMAND
|
||||
#ifdef HAVE_CHEEVOS
|
||||
static bool command_read_ram(const char *arg)
|
||||
{
|
||||
cheevos_var_t var;
|
||||
unsigned i;
|
||||
unsigned nbytes;
|
||||
char reply[256];
|
||||
const uint8_t * data = NULL;
|
||||
char *reply_at = NULL;
|
||||
|
||||
reply[0] = '\0';
|
||||
|
||||
strlcpy(reply, "READ_CORE_RAM ", sizeof(reply));
|
||||
reply_at = reply + strlen("READ_CORE_RAM ");
|
||||
strlcpy(reply_at, arg, sizeof(reply)-strlen(reply));
|
||||
|
||||
cheevos_parse_guest_addr(&var, strtoul(reply_at, (char**)&reply_at, 16));
|
||||
data = cheevos_get_memory(&var);
|
||||
|
||||
if (data)
|
||||
{
|
||||
unsigned nbytes = strtol(reply_at, NULL, 10);
|
||||
|
||||
for (i=0;i<nbytes;i++)
|
||||
{
|
||||
sprintf(reply_at+3*i, " %.2X", data[i]);
|
||||
}
|
||||
reply_at[3*nbytes] = '\n';
|
||||
command_reply(reply, reply_at+3*nbytes+1 - reply);
|
||||
}
|
||||
else
|
||||
{
|
||||
strlcpy(reply_at, " -1\n", sizeof(reply)-strlen(reply));
|
||||
command_reply(reply, reply_at+strlen(" -1\n") - reply);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool command_write_ram(const char *arg)
|
||||
{
|
||||
int i;
|
||||
cheevos_var_t var;
|
||||
unsigned nbytes;
|
||||
uint8_t * data = NULL;
|
||||
|
||||
cheevos_parse_guest_addr(&var, strtoul(arg, (char**)&arg, 16));
|
||||
|
||||
data = cheevos_get_memory(&var);
|
||||
|
||||
if (!data)
|
||||
return false;
|
||||
|
||||
while (*arg)
|
||||
{
|
||||
*data = strtoul(arg, (char**)&arg, 16);
|
||||
data++;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
bool stdin_enable;
|
||||
bool state[RARCH_BIND_LIST_END];
|
||||
#ifdef HAVE_STDIN_CMD
|
||||
char stdin_buf[STDIN_BUF_SIZE];
|
||||
size_t stdin_buf_ptr;
|
||||
#endif
|
||||
#if defined(HAVE_NETWORKING) && defined(HAVE_NETWORK_CMD)
|
||||
int net_fd;
|
||||
#endif
|
||||
};
|
||||
|
||||
static bool command_read_ram(const char *arg);
|
||||
static bool command_write_ram(const char *arg);
|
||||
|
||||
static const struct cmd_action_map action_map[] = {
|
||||
{ "SET_SHADER", command_set_shader, "<shader path>" },
|
||||
{ "SET_SHADER", command_set_shader, "<shader path>" },
|
||||
#ifdef HAVE_CHEEVOS
|
||||
{ "READ_CORE_RAM", command_read_ram, "<address> <number of bytes>" },
|
||||
{ "WRITE_CORE_RAM", command_write_ram, "<address> <byte1> <byte2> ..." },
|
||||
{ "READ_CORE_RAM", command_read_ram, "<address> <number of bytes>" },
|
||||
{ "WRITE_CORE_RAM", command_write_ram, "<address> <byte1> <byte2> ..." },
|
||||
#endif
|
||||
};
|
||||
|
||||
@ -306,6 +176,142 @@ static const struct cmd_map map[] = {
|
||||
{ "MENU_B", RETRO_DEVICE_ID_JOYPAD_B },
|
||||
};
|
||||
|
||||
static enum cmd_source_t lastcmd_source;
|
||||
#if defined(HAVE_NETWORKING) && defined(HAVE_NETWORK_CMD)
|
||||
static int lastcmd_net_fd;
|
||||
static struct sockaddr_storage lastcmd_net_source;
|
||||
static socklen_t lastcmd_net_source_len;
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_CHEEVOS
|
||||
#if defined(HAVE_STDIN_CMD) || defined(HAVE_NETWORK_CMD) && defined(HAVE_NETWORKING)
|
||||
static bool command_reply(const char * data, size_t len)
|
||||
{
|
||||
switch (lastcmd_source)
|
||||
{
|
||||
case CMD_NONE:
|
||||
break;
|
||||
case CMD_STDIN:
|
||||
#ifdef HAVE_STDIN_CMD
|
||||
fwrite(data, 1,len, stdout);
|
||||
return true;
|
||||
#else
|
||||
break;
|
||||
#endif
|
||||
case CMD_NETWORK:
|
||||
#if defined(HAVE_NETWORKING) && defined(HAVE_NETWORK_CMD)
|
||||
sendto(lastcmd_net_fd, data, len, 0,
|
||||
(struct sockaddr*)&lastcmd_net_source, lastcmd_net_source_len);
|
||||
return true;
|
||||
#else
|
||||
break;
|
||||
#endif
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
bool command_set_shader(const char *arg)
|
||||
{
|
||||
char msg[256];
|
||||
enum rarch_shader_type type = RARCH_SHADER_NONE;
|
||||
|
||||
switch (msg_hash_to_file_type(msg_hash_calculate(path_get_extension(arg))))
|
||||
{
|
||||
case FILE_TYPE_SHADER_GLSL:
|
||||
case FILE_TYPE_SHADER_PRESET_GLSLP:
|
||||
type = RARCH_SHADER_GLSL;
|
||||
break;
|
||||
case FILE_TYPE_SHADER_CG:
|
||||
case FILE_TYPE_SHADER_PRESET_CGP:
|
||||
type = RARCH_SHADER_CG;
|
||||
break;
|
||||
case FILE_TYPE_SHADER_SLANG:
|
||||
case FILE_TYPE_SHADER_PRESET_SLANGP:
|
||||
type = RARCH_SHADER_SLANG;
|
||||
break;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
|
||||
snprintf(msg, sizeof(msg), "Shader: \"%s\"", arg);
|
||||
runloop_msg_queue_push(msg, 1, 120, true);
|
||||
RARCH_LOG("%s \"%s\".\n",
|
||||
msg_hash_to_str(MSG_APPLYING_SHADER),
|
||||
arg);
|
||||
|
||||
return video_driver_set_shader(type, arg);
|
||||
}
|
||||
|
||||
static bool command_read_ram(const char *arg)
|
||||
{
|
||||
#if defined(HAVE_COMMAND) && defined(HAVE_CHEEVOS)
|
||||
cheevos_var_t var;
|
||||
unsigned i;
|
||||
unsigned nbytes;
|
||||
char reply[256];
|
||||
const uint8_t * data = NULL;
|
||||
char *reply_at = NULL;
|
||||
|
||||
reply[0] = '\0';
|
||||
|
||||
strlcpy(reply, "READ_CORE_RAM ", sizeof(reply));
|
||||
reply_at = reply + strlen("READ_CORE_RAM ");
|
||||
strlcpy(reply_at, arg, sizeof(reply)-strlen(reply));
|
||||
|
||||
cheevos_parse_guest_addr(&var, strtoul(reply_at, (char**)&reply_at, 16));
|
||||
data = cheevos_get_memory(&var);
|
||||
|
||||
if (data)
|
||||
{
|
||||
unsigned nbytes = strtol(reply_at, NULL, 10);
|
||||
|
||||
for (i=0;i<nbytes;i++)
|
||||
sprintf(reply_at+3*i, " %.2X", data[i]);
|
||||
reply_at[3*nbytes] = '\n';
|
||||
command_reply(reply, reply_at+3*nbytes+1 - reply);
|
||||
}
|
||||
else
|
||||
{
|
||||
strlcpy(reply_at, " -1\n", sizeof(reply)-strlen(reply));
|
||||
command_reply(reply, reply_at+strlen(" -1\n") - reply);
|
||||
}
|
||||
|
||||
return true;
|
||||
#else
|
||||
return false;
|
||||
#endif
|
||||
}
|
||||
|
||||
static bool command_write_ram(const char *arg)
|
||||
{
|
||||
#if defined(HAVE_COMMAND) && defined(HAVE_CHEEVOS)
|
||||
int i;
|
||||
cheevos_var_t var;
|
||||
unsigned nbytes = 0;
|
||||
uint8_t *data = NULL;
|
||||
|
||||
cheevos_parse_guest_addr(&var, strtoul(arg, (char**)&arg, 16));
|
||||
|
||||
data = cheevos_get_memory(&var);
|
||||
|
||||
if (data)
|
||||
{
|
||||
while (*arg)
|
||||
{
|
||||
*data = strtoul(arg, (char**)&arg, 16);
|
||||
data++;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
static bool command_get_arg(const char *tok,
|
||||
const char **arg, unsigned *index)
|
||||
{
|
||||
@ -369,22 +375,7 @@ static void command_parse_sub_msg(command_t *handle, const char *tok)
|
||||
msg_hash_to_str(MSG_RECEIVED));
|
||||
}
|
||||
|
||||
static void command_parse_msg(command_t *handle, char *buf, enum cmd_source_t source)
|
||||
{
|
||||
char *save = NULL;
|
||||
const char *tok = strtok_r(buf, "\n", &save);
|
||||
|
||||
lastcmd_source = source;
|
||||
|
||||
while (tok)
|
||||
{
|
||||
command_parse_sub_msg(handle, tok);
|
||||
tok = strtok_r(NULL, "\n", &save);
|
||||
}
|
||||
lastcmd_source = CMD_NONE;
|
||||
}
|
||||
|
||||
#if defined(HAVE_NETWORKING) && defined(HAVE_NETWORK_CMD)
|
||||
#if defined(HAVE_NETWORKING) && defined(HAVE_NETWORK_CMD) && defined(HAVE_COMMAND)
|
||||
static bool command_network_init(command_t *handle, uint16_t port)
|
||||
{
|
||||
struct addrinfo *res = NULL;
|
||||
@ -438,8 +429,67 @@ static bool command_verify(const char *cmd)
|
||||
return false;
|
||||
}
|
||||
|
||||
#ifdef HAVE_COMMAND
|
||||
static void command_parse_msg(command_t *handle, char *buf, enum cmd_source_t source)
|
||||
{
|
||||
char *save = NULL;
|
||||
const char *tok = strtok_r(buf, "\n", &save);
|
||||
|
||||
lastcmd_source = source;
|
||||
|
||||
while (tok)
|
||||
{
|
||||
command_parse_sub_msg(handle, tok);
|
||||
tok = strtok_r(NULL, "\n", &save);
|
||||
}
|
||||
lastcmd_source = CMD_NONE;
|
||||
}
|
||||
|
||||
static void command_network_poll(command_t *handle)
|
||||
{
|
||||
fd_set fds;
|
||||
struct timeval tmp_tv = {0};
|
||||
|
||||
if (handle->net_fd < 0)
|
||||
return;
|
||||
|
||||
FD_ZERO(&fds);
|
||||
FD_SET(handle->net_fd, &fds);
|
||||
|
||||
if (socket_select(handle->net_fd + 1, &fds, NULL, NULL, &tmp_tv) <= 0)
|
||||
return;
|
||||
|
||||
if (!FD_ISSET(handle->net_fd, &fds))
|
||||
return;
|
||||
|
||||
for (;;)
|
||||
{
|
||||
ssize_t ret;
|
||||
char buf[1024];
|
||||
|
||||
buf[0] = '\0';
|
||||
|
||||
lastcmd_net_fd = handle->net_fd;
|
||||
lastcmd_net_source_len = sizeof(lastcmd_net_source);
|
||||
ret = recvfrom(handle->net_fd, buf,
|
||||
sizeof(buf) - 1, 0,
|
||||
(struct sockaddr*)&lastcmd_net_source,
|
||||
&lastcmd_net_source_len);
|
||||
|
||||
if (ret <= 0)
|
||||
break;
|
||||
|
||||
buf[ret] = '\0';
|
||||
|
||||
command_parse_msg(handle, buf, CMD_NETWORK);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
bool command_network_send(const char *cmd_)
|
||||
{
|
||||
#if defined(HAVE_COMMAND) && defined(HAVE_NETWORKING) && defined(HAVE_NETWORK_CMD)
|
||||
bool ret = false;
|
||||
char *command = NULL;
|
||||
char *save = NULL;
|
||||
@ -483,49 +533,10 @@ bool command_network_send(const char *cmd_)
|
||||
free(command);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
#ifdef HAVE_COMMAND
|
||||
static void command_network_poll(command_t *handle)
|
||||
{
|
||||
fd_set fds;
|
||||
struct timeval tmp_tv = {0};
|
||||
|
||||
if (handle->net_fd < 0)
|
||||
return;
|
||||
|
||||
FD_ZERO(&fds);
|
||||
FD_SET(handle->net_fd, &fds);
|
||||
|
||||
if (socket_select(handle->net_fd + 1, &fds, NULL, NULL, &tmp_tv) <= 0)
|
||||
return;
|
||||
|
||||
if (!FD_ISSET(handle->net_fd, &fds))
|
||||
return;
|
||||
|
||||
for (;;)
|
||||
{
|
||||
ssize_t ret;
|
||||
char buf[1024];
|
||||
|
||||
buf[0] = '\0';
|
||||
|
||||
lastcmd_net_fd = handle->net_fd;
|
||||
lastcmd_net_source_len = sizeof(lastcmd_net_source);
|
||||
ret = recvfrom(handle->net_fd, buf,
|
||||
sizeof(buf) - 1, 0, (struct sockaddr*)&lastcmd_net_source, &lastcmd_net_source_len);
|
||||
|
||||
if (ret <= 0)
|
||||
break;
|
||||
|
||||
buf[ret] = '\0';
|
||||
|
||||
command_parse_msg(handle, buf, CMD_NETWORK);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#else
|
||||
return false;
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef HAVE_STDIN_CMD
|
||||
static bool command_stdin_init(command_t *handle)
|
||||
@ -560,7 +571,7 @@ bool command_network_new(
|
||||
if (!handle)
|
||||
return false;
|
||||
|
||||
#if defined(HAVE_NETWORKING) && defined(HAVE_NETWORK_CMD)
|
||||
#if defined(HAVE_NETWORKING) && defined(HAVE_NETWORK_CMD) && defined(HAVE_COMMAND)
|
||||
handle->net_fd = -1;
|
||||
if (network_enable && !command_network_init(handle, port))
|
||||
goto error;
|
||||
@ -582,26 +593,22 @@ error:
|
||||
}
|
||||
|
||||
#ifdef HAVE_STDIN_CMD
|
||||
|
||||
|
||||
static void command_stdin_poll(command_t *handle)
|
||||
{
|
||||
ssize_t ret;
|
||||
ptrdiff_t msg_len;
|
||||
char *last_newline = NULL;
|
||||
|
||||
if (!handle->stdin_enable)
|
||||
return;
|
||||
|
||||
ret = read_stdin(handle->stdin_buf + handle->stdin_buf_ptr,
|
||||
ssize_t ret = read_stdin(
|
||||
handle->stdin_buf + handle->stdin_buf_ptr,
|
||||
STDIN_BUF_SIZE - handle->stdin_buf_ptr - 1);
|
||||
|
||||
if (ret == 0)
|
||||
return;
|
||||
|
||||
handle->stdin_buf_ptr += ret;
|
||||
handle->stdin_buf[handle->stdin_buf_ptr] = '\0';
|
||||
handle->stdin_buf_ptr += ret;
|
||||
handle->stdin_buf[handle->stdin_buf_ptr] = '\0';
|
||||
|
||||
last_newline = strrchr(handle->stdin_buf, '\n');
|
||||
last_newline =
|
||||
strrchr(handle->stdin_buf, '\n');
|
||||
|
||||
if (!last_newline)
|
||||
{
|
||||
@ -610,14 +617,14 @@ static void command_stdin_poll(command_t *handle)
|
||||
if (handle->stdin_buf_ptr + 1 >= STDIN_BUF_SIZE)
|
||||
{
|
||||
handle->stdin_buf_ptr = 0;
|
||||
handle->stdin_buf[0] = '\0';
|
||||
handle->stdin_buf[0] = '\0';
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
*last_newline++ = '\0';
|
||||
msg_len = last_newline - handle->stdin_buf;
|
||||
msg_len = last_newline - handle->stdin_buf;
|
||||
|
||||
command_parse_msg(handle, handle->stdin_buf, CMD_STDIN);
|
||||
|
||||
@ -626,18 +633,16 @@ static void command_stdin_poll(command_t *handle)
|
||||
handle->stdin_buf_ptr -= msg_len;
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
bool command_poll(command_t *handle)
|
||||
{
|
||||
#if defined(HAVE_NETWORKING) && defined(HAVE_NETWORK_CMD)
|
||||
#ifdef HAVE_COMMAND
|
||||
#if defined(HAVE_NETWORKING) && defined(HAVE_NETWORK_CMD) && defined(HAVE_COMMAND)
|
||||
command_network_poll(handle);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_STDIN_CMD
|
||||
command_stdin_poll(handle);
|
||||
if (handle->stdin_enable)
|
||||
command_stdin_poll(handle);
|
||||
#endif
|
||||
|
||||
return true;
|
||||
@ -662,11 +667,9 @@ bool command_set(command_handle_t *handle)
|
||||
|
||||
bool command_free(command_t *handle)
|
||||
{
|
||||
#if defined(HAVE_NETWORKING) && defined(HAVE_NETWORK_CMD)
|
||||
#ifdef HAVE_COMMAND
|
||||
#if defined(HAVE_NETWORKING) && defined(HAVE_NETWORK_CMD) && defined(HAVE_COMMAND)
|
||||
if (handle && handle->net_fd >= 0)
|
||||
socket_close(handle->net_fd);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
free(handle);
|
||||
@ -1018,9 +1021,9 @@ static void command_event_init_controllers(void)
|
||||
set_controller = true;
|
||||
break;
|
||||
case RETRO_DEVICE_JOYPAD:
|
||||
/* ideally these checks shouldn't be required but if we always
|
||||
* call core_set_controller_port_device input won't work on
|
||||
* cores that don't set port information properly */
|
||||
/* Ideally these checks shouldn't be required but if we always
|
||||
* call core_set_controller_port_device input won't work on
|
||||
* cores that don't set port information properly */
|
||||
if (info->ports.size != 0 && i < info->ports.size)
|
||||
set_controller = true;
|
||||
break;
|
||||
@ -1591,8 +1594,8 @@ static bool command_event_main_state(unsigned cmd)
|
||||
char msg[128];
|
||||
char *state_path = (char*)malloc(PATH_MAX_LENGTH * sizeof(char));
|
||||
size_t state_path_size = PATH_MAX_LENGTH * sizeof(char);
|
||||
bool ret = false;
|
||||
global_t *global = global_get_ptr();
|
||||
bool ret = false;
|
||||
bool push_msg = true;
|
||||
|
||||
state_path[0] = msg[0] = '\0';
|
||||
@ -2689,6 +2692,7 @@ TODO: Add a setting for these tweaks */
|
||||
break;
|
||||
case CMD_EVENT_LIBUI_TEST:
|
||||
#if HAVE_LIBUI
|
||||
extern int libui_main(void);
|
||||
libui_main();
|
||||
#endif
|
||||
break;
|
||||
|
@ -231,11 +231,7 @@ enum event_command
|
||||
|
||||
bool command_set_shader(const char *arg);
|
||||
|
||||
#ifdef HAVE_COMMAND
|
||||
#if defined(HAVE_NETWORKING) && defined(HAVE_NETWORK_CMD)
|
||||
bool command_network_send(const char *cmd_);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
bool command_network_new(
|
||||
command_t *handle,
|
||||
@ -253,8 +249,6 @@ bool command_set(command_handle_t *handle);
|
||||
|
||||
bool command_free(command_t *handle);
|
||||
|
||||
bool command_event_quit(void);
|
||||
|
||||
/**
|
||||
* command_event:
|
||||
* @cmd : Command index.
|
||||
|
@ -64,6 +64,7 @@ static bool materialui_icons_enable = true;
|
||||
|
||||
static const bool def_history_list_enable = true;
|
||||
static const bool def_playlist_entry_remove = true;
|
||||
static const bool def_playlist_entry_rename = true;
|
||||
|
||||
static const unsigned int def_user_language = 0;
|
||||
|
||||
|
@ -901,7 +901,6 @@ const char *config_get_default_location(void)
|
||||
return "null";
|
||||
}
|
||||
|
||||
#ifdef HAVE_MENU
|
||||
/**
|
||||
* config_get_default_menu:
|
||||
*
|
||||
@ -911,6 +910,7 @@ const char *config_get_default_location(void)
|
||||
**/
|
||||
const char *config_get_default_menu(void)
|
||||
{
|
||||
#ifdef HAVE_MENU
|
||||
enum menu_driver_enum default_driver = MENU_DEFAULT_DRIVER;
|
||||
|
||||
if (!string_is_empty(g_defaults.settings.menu))
|
||||
@ -931,12 +931,11 @@ const char *config_get_default_menu(void)
|
||||
case MENU_NULL:
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
|
||||
return "null";
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
bool config_overlay_enable_default(void)
|
||||
{
|
||||
if (g_defaults.overlay.set)
|
||||
@ -990,6 +989,7 @@ static struct config_path_setting *populate_settings_path(settings_t *settings,
|
||||
/* Paths */
|
||||
#ifdef HAVE_XMB
|
||||
SETTING_PATH("xmb_font", settings->paths.path_menu_xmb_font, false, NULL, true);
|
||||
SETTING_PATH("xmb_show_settings_password", settings->paths.menu_xmb_show_settings_password, false, NULL, true);
|
||||
#endif
|
||||
SETTING_PATH("netplay_nickname", settings->paths.username, false, NULL, true);
|
||||
SETTING_PATH("video_filter", settings->paths.path_softfilter_plugin, false, NULL, true);
|
||||
@ -1254,6 +1254,7 @@ static struct config_bool_setting *populate_settings_bool(settings_t *settings,
|
||||
SETTING_BOOL("savestate_thumbnail_enable", &settings->bools.savestate_thumbnail_enable, true, savestate_thumbnail_enable, false);
|
||||
SETTING_BOOL("history_list_enable", &settings->bools.history_list_enable, true, def_history_list_enable, false);
|
||||
SETTING_BOOL("playlist_entry_remove", &settings->bools.playlist_entry_remove, true, def_playlist_entry_remove, false);
|
||||
SETTING_BOOL("playlist_entry_rename", &settings->bools.playlist_entry_rename, true, def_playlist_entry_rename, false);
|
||||
SETTING_BOOL("game_specific_options", &settings->bools.game_specific_options, true, default_game_specific_options, false);
|
||||
SETTING_BOOL("auto_overrides_enable", &settings->bools.auto_overrides_enable, true, default_auto_overrides_enable, false);
|
||||
SETTING_BOOL("auto_remaps_enable", &settings->bools.auto_remaps_enable, true, default_auto_remaps_enable, false);
|
||||
@ -1302,7 +1303,7 @@ static struct config_float_setting *populate_settings_float(settings_t *settings
|
||||
#endif
|
||||
#ifdef HAVE_MENU
|
||||
SETTING_FLOAT("menu_wallpaper_opacity", &settings->floats.menu_wallpaper_opacity, true, menu_wallpaper_opacity, false);
|
||||
SETTING_FLOAT("menu_framebuffer_opacity", &settings->floats.menu_framebuffer_opacity, true, menu_framebuffer_opacity, false);
|
||||
SETTING_FLOAT("menu_framebuffer_opacity", &settings->floats.menu_framebuffer_opacity, true, menu_framebuffer_opacity, false);
|
||||
SETTING_FLOAT("menu_footer_opacity", &settings->floats.menu_footer_opacity, true, menu_footer_opacity, false);
|
||||
SETTING_FLOAT("menu_header_opacity", &settings->floats.menu_header_opacity, true, menu_header_opacity, false);
|
||||
#endif
|
||||
@ -2603,14 +2604,21 @@ static bool config_load_file(const char *path, bool set_defaults,
|
||||
}
|
||||
}
|
||||
|
||||
/* Safe-guard against older behavior. */
|
||||
if (path_is_directory(path_get(RARCH_PATH_CORE)))
|
||||
#ifdef RARCH_CONSOLE
|
||||
if (!string_is_empty(path_get(RARCH_PATH_CORE)))
|
||||
{
|
||||
RARCH_WARN("\"libretro_path\" is a directory, using this for \"libretro_directory\" instead.\n");
|
||||
strlcpy(settings->paths.directory_libretro, path_get(RARCH_PATH_CORE),
|
||||
sizeof(settings->paths.directory_libretro));
|
||||
path_clear(RARCH_PATH_CORE);
|
||||
#endif
|
||||
/* Safe-guard against older behavior. */
|
||||
if (path_is_directory(path_get(RARCH_PATH_CORE)))
|
||||
{
|
||||
RARCH_WARN("\"libretro_path\" is a directory, using this for \"libretro_directory\" instead.\n");
|
||||
strlcpy(settings->paths.directory_libretro, path_get(RARCH_PATH_CORE),
|
||||
sizeof(settings->paths.directory_libretro));
|
||||
path_clear(RARCH_PATH_CORE);
|
||||
}
|
||||
#ifdef RARCH_CONSOLE
|
||||
}
|
||||
#endif
|
||||
|
||||
if (string_is_equal_fast(settings->paths.path_menu_wallpaper, "default", 7))
|
||||
*settings->paths.path_menu_wallpaper = '\0';
|
||||
|
117
configuration.h
117
configuration.h
@ -25,13 +25,26 @@
|
||||
#include <retro_common_api.h>
|
||||
#include <retro_miscellaneous.h>
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include "gfx/video_driver.h"
|
||||
#include "input/input_defines.h"
|
||||
|
||||
#define configuration_set_float(settings, var, newvar) \
|
||||
settings->modified = true; \
|
||||
var = newvar
|
||||
|
||||
#define configuration_set_bool(settings, var, newvar) \
|
||||
settings->modified = true; \
|
||||
var = newvar
|
||||
|
||||
#define configuration_set_uint(settings, var, newvar) \
|
||||
settings->modified = true; \
|
||||
var = newvar
|
||||
|
||||
#define configuration_set_int(settings, var, newvar) \
|
||||
settings->modified = true; \
|
||||
var = newvar
|
||||
|
||||
|
||||
enum override_type
|
||||
{
|
||||
OVERRIDE_NONE = 0,
|
||||
@ -53,9 +66,7 @@ typedef struct settings
|
||||
bool video_vsync;
|
||||
bool video_hard_sync;
|
||||
bool video_black_frame_insertion;
|
||||
#ifdef GEKKO
|
||||
bool video_vfilter;
|
||||
#endif
|
||||
bool video_smooth;
|
||||
bool video_force_aspect;
|
||||
bool video_crop_overscan;
|
||||
@ -77,10 +88,8 @@ typedef struct settings
|
||||
bool audio_enable;
|
||||
bool audio_sync;
|
||||
bool audio_rate_control;
|
||||
#ifdef HAVE_WASAPI
|
||||
bool audio_wasapi_exclusive_mode;
|
||||
bool audio_wasapi_float_format;
|
||||
#endif
|
||||
|
||||
/* Input */
|
||||
bool input_remap_binds_enable;
|
||||
@ -93,16 +102,11 @@ typedef struct settings
|
||||
bool input_descriptor_hide_unbound;
|
||||
bool input_all_users_control_menu;
|
||||
bool input_menu_swap_ok_cancel_buttons;
|
||||
#if defined(VITA)
|
||||
bool input_backtouch_enable;
|
||||
bool input_backtouch_toggle;
|
||||
#endif
|
||||
#if TARGET_OS_IPHONE
|
||||
bool input_small_keyboard_enable;
|
||||
#endif
|
||||
bool input_keyboard_gamepad_enable;
|
||||
|
||||
#ifdef HAVE_MENU
|
||||
/* Menu */
|
||||
bool filter_by_current_core;
|
||||
bool menu_show_start_screen;
|
||||
@ -134,9 +138,7 @@ typedef struct settings
|
||||
bool menu_xmb_show_history;
|
||||
bool menu_xmb_show_add;
|
||||
bool menu_unified_controls;
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_NETWORKING
|
||||
/* Netplay */
|
||||
bool netplay_public_announce;
|
||||
bool netplay_start_as_spectator;
|
||||
@ -146,7 +148,6 @@ typedef struct settings
|
||||
bool netplay_swap_input;
|
||||
bool netplay_nat_traversal;
|
||||
bool netplay_use_mitm_server;
|
||||
#endif
|
||||
|
||||
/* Network */
|
||||
bool network_buildbot_auto_extract_archive;
|
||||
@ -157,13 +158,11 @@ typedef struct settings
|
||||
bool ui_companion_start_on_boot;
|
||||
bool ui_companion_enable;
|
||||
|
||||
#ifdef HAVE_CHEEVOS
|
||||
/* Cheevos */
|
||||
bool cheevos_enable;
|
||||
bool cheevos_test_unofficial;
|
||||
bool cheevos_hardcore_mode_enable;
|
||||
bool cheevos_verbose_enable;
|
||||
#endif
|
||||
|
||||
/* Camera */
|
||||
bool camera_allow;
|
||||
@ -183,13 +182,12 @@ typedef struct settings
|
||||
bool bundle_assets_extract_enable;
|
||||
|
||||
/* Misc. */
|
||||
#ifdef HAVE_THREADS
|
||||
bool threaded_data_runloop_enable;
|
||||
#endif
|
||||
bool set_supports_no_game_enable;
|
||||
bool auto_screenshot_filename;
|
||||
bool history_list_enable;
|
||||
bool playlist_entry_remove;
|
||||
bool playlist_entry_rename;
|
||||
bool rewind_enable;
|
||||
bool pause_nonactive;
|
||||
bool block_sram_overwrite;
|
||||
@ -219,11 +217,9 @@ typedef struct settings
|
||||
bool savestates_in_content_dir;
|
||||
bool screenshots_in_content_dir;
|
||||
bool systemfiles_in_content_dir;
|
||||
#ifdef HAVE_LAKKA
|
||||
bool ssh_enable;
|
||||
bool samba_enable;
|
||||
bool bluetooth_enable;
|
||||
#endif
|
||||
} bools;
|
||||
|
||||
struct
|
||||
@ -262,10 +258,7 @@ typedef struct settings
|
||||
int location_update_interval_ms;
|
||||
int location_update_interval_distance;
|
||||
int state_slot;
|
||||
|
||||
#ifdef HAVE_WASAPI
|
||||
int audio_wasapi_sh_buffer_length;
|
||||
#endif
|
||||
} ints;
|
||||
|
||||
struct
|
||||
@ -274,17 +267,8 @@ typedef struct settings
|
||||
unsigned audio_out_rate;
|
||||
unsigned audio_block_frames;
|
||||
unsigned audio_latency;
|
||||
unsigned input_remap_ids[MAX_USERS][RARCH_CUSTOM_BIND_LIST_END];
|
||||
unsigned input_keymapper_ids[RARCH_CUSTOM_BIND_LIST_END];
|
||||
|
||||
/* Set by autoconfiguration in joypad_autoconfig_dir.
|
||||
* Does not override main binds. */
|
||||
unsigned input_libretro_device[MAX_USERS];
|
||||
unsigned input_analog_dpad_mode[MAX_USERS];
|
||||
|
||||
unsigned input_joypad_map[MAX_USERS];
|
||||
unsigned input_device[MAX_USERS];
|
||||
unsigned input_mouse_index[MAX_USERS];
|
||||
|
||||
unsigned input_turbo_period;
|
||||
unsigned input_turbo_duty_cycle;
|
||||
@ -315,9 +299,7 @@ typedef struct settings
|
||||
unsigned video_swap_interval;
|
||||
unsigned video_hard_sync_frames;
|
||||
unsigned video_frame_delay;
|
||||
#ifdef GEKKO
|
||||
unsigned video_viwidth;
|
||||
#endif
|
||||
unsigned video_aspect_ratio_idx;
|
||||
unsigned video_rotation;
|
||||
|
||||
@ -337,34 +319,45 @@ typedef struct settings
|
||||
unsigned camera_height;
|
||||
|
||||
unsigned input_overlay_show_physical_inputs_port;
|
||||
|
||||
unsigned input_joypad_map[MAX_USERS];
|
||||
unsigned input_device[MAX_USERS];
|
||||
unsigned input_mouse_index[MAX_USERS];
|
||||
/* Set by autoconfiguration in joypad_autoconfig_dir.
|
||||
* Does not override main binds. */
|
||||
unsigned input_libretro_device[MAX_USERS];
|
||||
unsigned input_analog_dpad_mode[MAX_USERS];
|
||||
|
||||
unsigned input_keymapper_ids[RARCH_CUSTOM_BIND_LIST_END];
|
||||
|
||||
unsigned input_remap_ids[MAX_USERS][RARCH_CUSTOM_BIND_LIST_END];
|
||||
} uints;
|
||||
|
||||
struct
|
||||
{
|
||||
char placeholder;
|
||||
|
||||
char playlist_names[PATH_MAX_LENGTH];
|
||||
char playlist_cores[PATH_MAX_LENGTH];
|
||||
char video_driver[32];
|
||||
char record_driver[32];
|
||||
char camera_driver[32];
|
||||
char wifi_driver[32];
|
||||
char location_driver[32];
|
||||
#ifdef HAVE_MENU
|
||||
char menu_driver[32];
|
||||
#endif
|
||||
char audio_device[255];
|
||||
char camera_device[255];
|
||||
#ifdef HAVE_CHEEVOS
|
||||
char cheevos_username[32];
|
||||
char cheevos_password[32];
|
||||
#endif
|
||||
char video_context_driver[32];
|
||||
char audio_driver[32];
|
||||
char audio_resampler[32];
|
||||
char input_driver[32];
|
||||
char input_joypad_driver[32];
|
||||
|
||||
char input_keyboard_layout[64];
|
||||
|
||||
char audio_device[255];
|
||||
char camera_device[255];
|
||||
|
||||
char playlist_names[PATH_MAX_LENGTH];
|
||||
char playlist_cores[PATH_MAX_LENGTH];
|
||||
char bundle_assets_src[PATH_MAX_LENGTH];
|
||||
char bundle_assets_dst[PATH_MAX_LENGTH];
|
||||
char bundle_assets_dst_subdir[PATH_MAX_LENGTH];
|
||||
@ -374,12 +367,16 @@ typedef struct settings
|
||||
{
|
||||
char placeholder;
|
||||
|
||||
|
||||
char username[32];
|
||||
char netplay_password[128];
|
||||
char netplay_spectate_password[128];
|
||||
char netplay_server[255];
|
||||
char network_buildbot_url[255];
|
||||
char network_buildbot_assets_url[255];
|
||||
char browse_url[4096];
|
||||
|
||||
#ifdef HAVE_MENU
|
||||
char path_menu_xmb_font[PATH_MAX_LENGTH];
|
||||
#endif
|
||||
char menu_xmb_show_settings_password[PATH_MAX_LENGTH];
|
||||
char path_cheat_database[PATH_MAX_LENGTH];
|
||||
char path_content_database[PATH_MAX_LENGTH];
|
||||
char path_overlay[PATH_MAX_LENGTH];
|
||||
@ -397,8 +394,6 @@ typedef struct settings
|
||||
char path_shader[PATH_MAX_LENGTH];
|
||||
char path_font[PATH_MAX_LENGTH];
|
||||
|
||||
char network_buildbot_url[255];
|
||||
char network_buildbot_assets_url[255];
|
||||
|
||||
char directory_audio_filter[PATH_MAX_LENGTH];
|
||||
char directory_autoconfig[PATH_MAX_LENGTH];
|
||||
@ -421,12 +416,6 @@ typedef struct settings
|
||||
char directory_thumbnails[PATH_MAX_LENGTH];
|
||||
char directory_menu_config[PATH_MAX_LENGTH];
|
||||
char directory_menu_content[PATH_MAX_LENGTH];
|
||||
#ifdef HAVE_NETWORKING
|
||||
char netplay_server[255];
|
||||
char netplay_password[128];
|
||||
char netplay_spectate_password[128];
|
||||
#endif
|
||||
char username[32];
|
||||
} paths;
|
||||
|
||||
bool modified;
|
||||
@ -436,22 +425,6 @@ typedef struct settings
|
||||
size_t rewind_buffer_size;
|
||||
} settings_t;
|
||||
|
||||
#define configuration_set_float(settings, var, newvar) \
|
||||
settings->modified = true; \
|
||||
var = newvar
|
||||
|
||||
#define configuration_set_bool(settings, var, newvar) \
|
||||
settings->modified = true; \
|
||||
var = newvar
|
||||
|
||||
#define configuration_set_uint(settings, var, newvar) \
|
||||
settings->modified = true; \
|
||||
var = newvar
|
||||
|
||||
#define configuration_set_int(settings, var, newvar) \
|
||||
settings->modified = true; \
|
||||
var = newvar
|
||||
|
||||
/**
|
||||
* config_get_default_camera:
|
||||
*
|
||||
@ -524,7 +497,6 @@ const char *config_get_default_input(void);
|
||||
**/
|
||||
const char *config_get_default_joypad(void);
|
||||
|
||||
#ifdef HAVE_MENU
|
||||
/**
|
||||
* config_get_default_menu:
|
||||
*
|
||||
@ -533,7 +505,6 @@ const char *config_get_default_joypad(void);
|
||||
* Returns: Default menu driver.
|
||||
**/
|
||||
const char *config_get_default_menu(void);
|
||||
#endif
|
||||
|
||||
const char *config_get_default_record(void);
|
||||
|
||||
|
@ -46,9 +46,6 @@ static void core_info_list_resolve_all_extensions(
|
||||
size_t all_ext_len = 0;
|
||||
char *all_ext = NULL;
|
||||
|
||||
if (!core_info_list)
|
||||
return;
|
||||
|
||||
for (i = 0; i < core_info_list->count; i++)
|
||||
{
|
||||
if (core_info_list->list[i].supported_extensions)
|
||||
@ -405,10 +402,11 @@ static core_info_list_t *core_info_list_new(const char *path)
|
||||
strdup(path_basename(core_info[i].path));
|
||||
}
|
||||
|
||||
core_info_list_resolve_all_extensions(core_info_list);
|
||||
|
||||
if (core_info_list)
|
||||
{
|
||||
core_info_list_resolve_all_extensions(core_info_list);
|
||||
core_info_list_resolve_all_firmware(core_info_list);
|
||||
}
|
||||
|
||||
dir_list_free(contents);
|
||||
return core_info_list;
|
||||
|
@ -37,6 +37,8 @@ typedef struct
|
||||
|
||||
typedef struct
|
||||
{
|
||||
bool supports_no_game;
|
||||
size_t firmware_count;
|
||||
char *path;
|
||||
void *config_data;
|
||||
char *display_name;
|
||||
@ -57,10 +59,7 @@ typedef struct
|
||||
struct string_list *authors_list;
|
||||
struct string_list *permissions_list;
|
||||
struct string_list *licenses_list;
|
||||
|
||||
core_info_firmware_t *firmware;
|
||||
size_t firmware_count;
|
||||
bool supports_no_game;
|
||||
void *userdata;
|
||||
} core_info_t;
|
||||
|
||||
|
@ -507,11 +507,14 @@ database_info_list_t *database_info_list_new(
|
||||
goto end;
|
||||
|
||||
database_info_list = (database_info_list_t*)
|
||||
calloc(1, sizeof(*database_info_list));
|
||||
malloc(sizeof(*database_info_list));
|
||||
|
||||
if (!database_info_list)
|
||||
goto end;
|
||||
|
||||
database_info_list->count = 0;
|
||||
database_info_list->list = NULL;
|
||||
|
||||
while (ret != -1)
|
||||
{
|
||||
database_info_t db_info = {0};
|
||||
|
@ -81,6 +81,18 @@ typedef struct
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int analog_supported;
|
||||
int rumble_supported;
|
||||
int coop_supported;
|
||||
uint32_t crc32;
|
||||
unsigned size;
|
||||
unsigned famitsu_magazine_rating;
|
||||
unsigned edge_magazine_rating;
|
||||
unsigned edge_magazine_issue;
|
||||
unsigned max_users;
|
||||
unsigned releasemonth;
|
||||
unsigned releaseyear;
|
||||
unsigned tgdb_rating;
|
||||
char *name;
|
||||
char *rom_name;
|
||||
char *serial;
|
||||
@ -97,27 +109,15 @@ typedef struct
|
||||
char *pegi_rating;
|
||||
char *cero_rating;
|
||||
char *enhancement_hw;
|
||||
uint32_t crc32;
|
||||
char *sha1;
|
||||
char *md5;
|
||||
unsigned size;
|
||||
unsigned famitsu_magazine_rating;
|
||||
unsigned edge_magazine_rating;
|
||||
unsigned edge_magazine_issue;
|
||||
unsigned max_users;
|
||||
unsigned releasemonth;
|
||||
unsigned releaseyear;
|
||||
unsigned tgdb_rating;
|
||||
int analog_supported;
|
||||
int rumble_supported;
|
||||
int coop_supported;
|
||||
void *userdata;
|
||||
} database_info_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
database_info_t *list;
|
||||
size_t count;
|
||||
database_info_t *list;
|
||||
} database_info_list_t;
|
||||
|
||||
database_info_list_t *database_info_list_new(const char *rdb_path,
|
||||
|
@ -21,6 +21,8 @@
|
||||
/* Direct3D 9 */
|
||||
#include <d3d9.h>
|
||||
|
||||
#define ID3DSURFACE IDirect3DSurface9
|
||||
|
||||
#define LPDIRECT3D LPDIRECT3D9
|
||||
#define LPDIRECT3DDEVICE LPDIRECT3DDEVICE9
|
||||
#define LPDIRECT3DTEXTURE LPDIRECT3DTEXTURE9
|
||||
@ -60,6 +62,7 @@
|
||||
#define D3DVERTEXELEMENT D3DVERTEXELEMENT8
|
||||
#define D3DVIEWPORT D3DVIEWPORT8
|
||||
|
||||
#define ID3DSURFACE IDirect3DSurface8
|
||||
#define D3DCREATE_CTX Direct3DCreate8
|
||||
|
||||
#if !defined(D3DLOCK_NOSYSLOCK) && defined(_XBOX)
|
||||
|
10
deps/libFLAC/bitreader.c
vendored
10
deps/libFLAC/bitreader.c
vendored
@ -114,7 +114,7 @@ struct FLAC__BitReader {
|
||||
void *client_data;
|
||||
};
|
||||
|
||||
static inline void crc16_update_word_(FLAC__BitReader *br, brword word)
|
||||
static INLINE void crc16_update_word_(FLAC__BitReader *br, brword word)
|
||||
{
|
||||
register unsigned crc = br->read_crc16;
|
||||
#if FLAC__BYTES_PER_WORD == 4
|
||||
@ -347,17 +347,17 @@ FLAC__uint16 FLAC__bitreader_get_read_crc16(FLAC__BitReader *br)
|
||||
return br->read_crc16;
|
||||
}
|
||||
|
||||
inline FLAC__bool FLAC__bitreader_is_consumed_byte_aligned(const FLAC__BitReader *br)
|
||||
INLINE FLAC__bool FLAC__bitreader_is_consumed_byte_aligned(const FLAC__BitReader *br)
|
||||
{
|
||||
return ((br->consumed_bits & 7) == 0);
|
||||
}
|
||||
|
||||
inline unsigned FLAC__bitreader_bits_left_for_byte_alignment(const FLAC__BitReader *br)
|
||||
INLINE unsigned FLAC__bitreader_bits_left_for_byte_alignment(const FLAC__BitReader *br)
|
||||
{
|
||||
return 8 - (br->consumed_bits & 7);
|
||||
}
|
||||
|
||||
inline unsigned FLAC__bitreader_get_input_bits_unconsumed(const FLAC__BitReader *br)
|
||||
INLINE unsigned FLAC__bitreader_get_input_bits_unconsumed(const FLAC__BitReader *br)
|
||||
{
|
||||
return (br->words-br->consumed_words)*FLAC__BITS_PER_WORD + br->bytes*8 - br->consumed_bits;
|
||||
}
|
||||
@ -476,7 +476,7 @@ FLAC__bool FLAC__bitreader_read_raw_uint64(FLAC__BitReader *br, FLAC__uint64 *va
|
||||
return true;
|
||||
}
|
||||
|
||||
inline FLAC__bool FLAC__bitreader_read_uint32_little_endian(FLAC__BitReader *br, FLAC__uint32 *val)
|
||||
INLINE FLAC__bool FLAC__bitreader_read_uint32_little_endian(FLAC__BitReader *br, FLAC__uint32 *val)
|
||||
{
|
||||
FLAC__uint32 x8, x32 = 0;
|
||||
|
||||
|
56
deps/libFLAC/cpu.c
vendored
56
deps/libFLAC/cpu.c
vendored
@ -49,11 +49,6 @@
|
||||
|
||||
#ifdef DEBUG
|
||||
#include <stdio.h>
|
||||
|
||||
#define dfprintf fprintf
|
||||
#else
|
||||
/* This is bad practice, it should be a static void empty function */
|
||||
#define dfprintf(file, format, ...)
|
||||
#endif
|
||||
|
||||
|
||||
@ -138,21 +133,23 @@ ia32_cpu_info (FLAC__CPUInfo *info)
|
||||
info->ia32.avx2 = (flags_ebx & FLAC__CPUINFO_IA32_CPUID_AVX2 ) ? true : false;
|
||||
}
|
||||
|
||||
dfprintf(stderr, "CPU info (IA-32):\n");
|
||||
dfprintf(stderr, " CMOV ....... %c\n", info->ia32.cmov ? 'Y' : 'n');
|
||||
dfprintf(stderr, " MMX ........ %c\n", info->ia32.mmx ? 'Y' : 'n');
|
||||
dfprintf(stderr, " SSE ........ %c\n", info->ia32.sse ? 'Y' : 'n');
|
||||
dfprintf(stderr, " SSE2 ....... %c\n", info->ia32.sse2 ? 'Y' : 'n');
|
||||
dfprintf(stderr, " SSE3 ....... %c\n", info->ia32.sse3 ? 'Y' : 'n');
|
||||
dfprintf(stderr, " SSSE3 ...... %c\n", info->ia32.ssse3 ? 'Y' : 'n');
|
||||
dfprintf(stderr, " SSE41 ...... %c\n", info->ia32.sse41 ? 'Y' : 'n');
|
||||
dfprintf(stderr, " SSE42 ...... %c\n", info->ia32.sse42 ? 'Y' : 'n');
|
||||
#if 0
|
||||
fprintf(stderr, "CPU info (IA-32):\n");
|
||||
fprintf(stderr, " CMOV ....... %c\n", info->ia32.cmov ? 'Y' : 'n');
|
||||
fprintf(stderr, " MMX ........ %c\n", info->ia32.mmx ? 'Y' : 'n');
|
||||
fprintf(stderr, " SSE ........ %c\n", info->ia32.sse ? 'Y' : 'n');
|
||||
fprintf(stderr, " SSE2 ....... %c\n", info->ia32.sse2 ? 'Y' : 'n');
|
||||
fprintf(stderr, " SSE3 ....... %c\n", info->ia32.sse3 ? 'Y' : 'n');
|
||||
fprintf(stderr, " SSSE3 ...... %c\n", info->ia32.ssse3 ? 'Y' : 'n');
|
||||
fprintf(stderr, " SSE41 ...... %c\n", info->ia32.sse41 ? 'Y' : 'n');
|
||||
fprintf(stderr, " SSE42 ...... %c\n", info->ia32.sse42 ? 'Y' : 'n');
|
||||
|
||||
if (FLAC__HAS_X86INTRIN && FLAC__AVX_SUPPORTED) {
|
||||
dfprintf(stderr, " AVX ........ %c\n", info->ia32.avx ? 'Y' : 'n');
|
||||
dfprintf(stderr, " FMA ........ %c\n", info->ia32.fma ? 'Y' : 'n');
|
||||
dfprintf(stderr, " AVX2 ....... %c\n", info->ia32.avx2 ? 'Y' : 'n');
|
||||
fprintf(stderr, " AVX ........ %c\n", info->ia32.avx ? 'Y' : 'n');
|
||||
fprintf(stderr, " FMA ........ %c\n", info->ia32.fma ? 'Y' : 'n');
|
||||
fprintf(stderr, " AVX2 ....... %c\n", info->ia32.avx2 ? 'Y' : 'n');
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
* now have to check for OS support of AVX instructions
|
||||
@ -164,9 +161,10 @@ ia32_cpu_info (FLAC__CPUInfo *info)
|
||||
info->ia32.fma = false;
|
||||
}
|
||||
|
||||
if (FLAC__HAS_X86INTRIN && FLAC__AVX_SUPPORTED) {
|
||||
dfprintf(stderr, " AVX OS sup . %c\n", info->ia32.avx ? 'Y' : 'n');
|
||||
}
|
||||
#if 0
|
||||
if (FLAC__HAS_X86INTRIN && FLAC__AVX_SUPPORTED)
|
||||
fprintf(stderr, " AVX OS sup . %c\n", info->ia32.avx ? 'Y' : 'n');
|
||||
#endif
|
||||
#else
|
||||
info->use_asm = false;
|
||||
#endif
|
||||
@ -199,16 +197,16 @@ x86_64_cpu_info (FLAC__CPUInfo *info)
|
||||
info->x86.avx2 = (flags_ebx & FLAC__CPUINFO_IA32_CPUID_AVX2 ) ? true : false;
|
||||
}
|
||||
|
||||
dfprintf(stderr, "CPU info (x86-64):\n");
|
||||
dfprintf(stderr, " SSE3 ....... %c\n", info->x86.sse3 ? 'Y' : 'n');
|
||||
dfprintf(stderr, " SSSE3 ...... %c\n", info->x86.ssse3 ? 'Y' : 'n');
|
||||
dfprintf(stderr, " SSE41 ...... %c\n", info->x86.sse41 ? 'Y' : 'n');
|
||||
dfprintf(stderr, " SSE42 ...... %c\n", info->x86.sse42 ? 'Y' : 'n');
|
||||
fprintf(stderr, "CPU info (x86-64):\n");
|
||||
fprintf(stderr, " SSE3 ....... %c\n", info->x86.sse3 ? 'Y' : 'n');
|
||||
fprintf(stderr, " SSSE3 ...... %c\n", info->x86.ssse3 ? 'Y' : 'n');
|
||||
fprintf(stderr, " SSE41 ...... %c\n", info->x86.sse41 ? 'Y' : 'n');
|
||||
fprintf(stderr, " SSE42 ...... %c\n", info->x86.sse42 ? 'Y' : 'n');
|
||||
|
||||
if (FLAC__AVX_SUPPORTED) {
|
||||
dfprintf(stderr, " AVX ........ %c\n", info->x86.avx ? 'Y' : 'n');
|
||||
dfprintf(stderr, " FMA ........ %c\n", info->x86.fma ? 'Y' : 'n');
|
||||
dfprintf(stderr, " AVX2 ....... %c\n", info->x86.avx2 ? 'Y' : 'n');
|
||||
fprintf(stderr, " AVX ........ %c\n", info->x86.avx ? 'Y' : 'n');
|
||||
fprintf(stderr, " FMA ........ %c\n", info->x86.fma ? 'Y' : 'n');
|
||||
fprintf(stderr, " AVX2 ....... %c\n", info->x86.avx2 ? 'Y' : 'n');
|
||||
}
|
||||
|
||||
/*
|
||||
@ -222,7 +220,7 @@ x86_64_cpu_info (FLAC__CPUInfo *info)
|
||||
}
|
||||
|
||||
if (FLAC__AVX_SUPPORTED) {
|
||||
dfprintf(stderr, " AVX OS sup . %c\n", info->x86.avx ? 'Y' : 'n');
|
||||
fprintf(stderr, " AVX OS sup . %c\n", info->x86.avx ? 'Y' : 'n');
|
||||
}
|
||||
#else
|
||||
/* Silence compiler warnings. */
|
||||
|
18
deps/libFLAC/include/private/bitmath.h
vendored
18
deps/libFLAC/include/private/bitmath.h
vendored
@ -33,6 +33,8 @@
|
||||
#ifndef FLAC__PRIVATE__BITMATH_H
|
||||
#define FLAC__PRIVATE__BITMATH_H
|
||||
|
||||
#include <retro_inline.h>
|
||||
|
||||
#include "FLAC/ordinals.h"
|
||||
#include "FLAC/assert.h"
|
||||
|
||||
@ -43,7 +45,7 @@
|
||||
#endif
|
||||
|
||||
/* Will never be emitted for MSVC, GCC, Intel compilers */
|
||||
static inline unsigned int FLAC__clz_soft_uint32(FLAC__uint32 word)
|
||||
static INLINE unsigned int FLAC__clz_soft_uint32(FLAC__uint32 word)
|
||||
{
|
||||
static const unsigned char byte_to_unary_table[] = {
|
||||
8, 7, 6, 6, 5, 5, 5, 5, 4, 4, 4, 4, 4, 4, 4, 4,
|
||||
@ -70,7 +72,7 @@ static inline unsigned int FLAC__clz_soft_uint32(FLAC__uint32 word)
|
||||
byte_to_unary_table[word] + 24;
|
||||
}
|
||||
|
||||
static inline unsigned int FLAC__clz_uint32(FLAC__uint32 v)
|
||||
static INLINE unsigned int FLAC__clz_uint32(FLAC__uint32 v)
|
||||
{
|
||||
/* Never used with input 0 */
|
||||
FLAC__ASSERT(v > 0);
|
||||
@ -92,13 +94,13 @@ static inline unsigned int FLAC__clz_uint32(FLAC__uint32 v)
|
||||
}
|
||||
|
||||
/* Used when 64-bit bsr/clz is unavailable; can use 32-bit bsr/clz when possible */
|
||||
static inline unsigned int FLAC__clz_soft_uint64(FLAC__uint64 word)
|
||||
static INLINE unsigned int FLAC__clz_soft_uint64(FLAC__uint64 word)
|
||||
{
|
||||
return (FLAC__uint32)(word>>32) ? FLAC__clz_uint32((FLAC__uint32)(word>>32)) :
|
||||
FLAC__clz_uint32((FLAC__uint32)word) + 32;
|
||||
}
|
||||
|
||||
static inline unsigned int FLAC__clz_uint64(FLAC__uint64 v)
|
||||
static INLINE unsigned int FLAC__clz_uint64(FLAC__uint64 v)
|
||||
{
|
||||
/* Never used with input 0 */
|
||||
FLAC__ASSERT(v > 0);
|
||||
@ -116,14 +118,14 @@ static inline unsigned int FLAC__clz_uint64(FLAC__uint64 v)
|
||||
}
|
||||
|
||||
/* These two functions work with input 0 */
|
||||
static inline unsigned int FLAC__clz2_uint32(FLAC__uint32 v)
|
||||
static INLINE unsigned int FLAC__clz2_uint32(FLAC__uint32 v)
|
||||
{
|
||||
if (!v)
|
||||
return 32;
|
||||
return FLAC__clz_uint32(v);
|
||||
}
|
||||
|
||||
static inline unsigned int FLAC__clz2_uint64(FLAC__uint64 v)
|
||||
static INLINE unsigned int FLAC__clz2_uint64(FLAC__uint64 v)
|
||||
{
|
||||
if (!v)
|
||||
return 64;
|
||||
@ -153,7 +155,7 @@ static inline unsigned int FLAC__clz2_uint64(FLAC__uint64 v)
|
||||
* ilog2(18) = 4
|
||||
*/
|
||||
|
||||
static inline unsigned FLAC__bitmath_ilog2(FLAC__uint32 v)
|
||||
static INLINE unsigned FLAC__bitmath_ilog2(FLAC__uint32 v)
|
||||
{
|
||||
FLAC__ASSERT(v > 0);
|
||||
#if defined(__INTEL_COMPILER)
|
||||
@ -169,7 +171,7 @@ static inline unsigned FLAC__bitmath_ilog2(FLAC__uint32 v)
|
||||
#endif
|
||||
}
|
||||
|
||||
static inline unsigned FLAC__bitmath_ilog2_wide(FLAC__uint64 v)
|
||||
static INLINE unsigned FLAC__bitmath_ilog2_wide(FLAC__uint64 v)
|
||||
{
|
||||
FLAC__ASSERT(v > 0);
|
||||
#if defined(__GNUC__) && (__GNUC__ >= 4 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
|
||||
|
@ -1,6 +1,6 @@
|
||||
#!/bin/sh
|
||||
|
||||
RARCH_VERSION=1.6.7
|
||||
source ../version.all
|
||||
PLATFORM=$1
|
||||
SALAMANDER=no
|
||||
MAKEFILE_GRIFFIN=no
|
||||
|
@ -5,7 +5,7 @@
|
||||
# and icons (https://github.com/libretro/retroarch-assets/tree/master/pkg/wiiu) to this directory then run
|
||||
# the script. the output will be in retroarch/pkg/wiiu
|
||||
|
||||
RARCH_VERSION=1.3.6
|
||||
source ../version.all
|
||||
|
||||
platform=wiiu
|
||||
EXT=a
|
||||
@ -51,7 +51,7 @@ gen_meta_xml()
|
||||
echo '<app version="1">' >> "$1"_meta.xml
|
||||
echo ' <name>'$corename'</name>' >> "$1"_meta.xml
|
||||
echo ' <coder>'$authors'</coder>' >> "$1"_meta.xml
|
||||
echo ' <version>'$RARCH_VERSION' r'$build_hash'</version>' >> "$1"_meta.xml
|
||||
echo ' <version>'$PACKAGE_VERSION' r'$build_hash'</version>' >> "$1"_meta.xml
|
||||
echo ' <release_date>'$date'</release_date>' >> "$1"_meta.xml
|
||||
echo ' <short_description>RetroArch</short_description>' >> "$1"_meta.xml
|
||||
echo -e ' <long_description>'$display_name'\n\nSystem: '$systemname'\nLicense: '$license'</long_description>' >> "$1"_meta.xml
|
||||
|
@ -61,7 +61,7 @@ var LibraryRWebAudio = {
|
||||
else startTime = RA.context.currentTime;
|
||||
RA.buffers[index].endTime = startTime + RA.buffers[index].duration;
|
||||
|
||||
var bufferSource = RA.context.createBufferSource();
|
||||
const bufferSource = RA.context.createBufferSource();
|
||||
bufferSource.buffer = RA.buffers[index];
|
||||
bufferSource.connect(RA.context.destination);
|
||||
bufferSource.start(startTime);
|
||||
|
@ -2125,7 +2125,7 @@ static uint64_t frontend_unix_get_mem_total(void)
|
||||
|
||||
while (fgets(line, sizeof(line), data))
|
||||
{
|
||||
if (sscanf(line, "MemTotal: " STRING_REP_ULONG " kB", (size_t*)&total) == 1)
|
||||
if (sscanf(line, "MemTotal: " STRING_REP_USIZE " kB", (size_t*)&total) == 1)
|
||||
{
|
||||
fclose(data);
|
||||
total *= 1024;
|
||||
@ -2150,13 +2150,13 @@ static uint64_t frontend_unix_get_mem_used(void)
|
||||
|
||||
while (fgets(line, sizeof(line), data))
|
||||
{
|
||||
if (sscanf(line, "MemTotal: " STRING_REP_ULONG " kB", (size_t*)&total) == 1)
|
||||
if (sscanf(line, "MemTotal: " STRING_REP_USIZE " kB", (size_t*)&total) == 1)
|
||||
total *= 1024;
|
||||
if (sscanf(line, "MemFree: " STRING_REP_ULONG " kB", (size_t*)&freemem) == 1)
|
||||
if (sscanf(line, "MemFree: " STRING_REP_USIZE " kB", (size_t*)&freemem) == 1)
|
||||
freemem *= 1024;
|
||||
if (sscanf(line, "Buffers: " STRING_REP_ULONG " kB", (size_t*)&buffers) == 1)
|
||||
if (sscanf(line, "Buffers: " STRING_REP_USIZE " kB", (size_t*)&buffers) == 1)
|
||||
buffers *= 1024;
|
||||
if (sscanf(line, "Cached: " STRING_REP_ULONG " kB", (size_t*)&cached) == 1)
|
||||
if (sscanf(line, "Cached: " STRING_REP_USIZE " kB", (size_t*)&cached) == 1)
|
||||
cached *= 1024;
|
||||
}
|
||||
|
||||
|
@ -1100,12 +1100,25 @@ static void frontend_xdk_get_environment_settings(int *argc, char *argv[],
|
||||
void *args, void *params_data)
|
||||
{
|
||||
HRESULT ret;
|
||||
(void)ret;
|
||||
|
||||
#ifdef _XBOX360
|
||||
unsigned long license_mask;
|
||||
DWORD volume_device_type;
|
||||
#endif
|
||||
#ifndef IS_SALAMANDER
|
||||
static char path[PATH_MAX_LENGTH] = {0};
|
||||
#if defined(_XBOX1)
|
||||
LAUNCH_DATA ptr;
|
||||
DWORD launch_type;
|
||||
#elif defined(_XBOX360)
|
||||
DWORD dwLaunchDataSize;
|
||||
#endif
|
||||
#endif
|
||||
#ifndef IS_SALAMANDER
|
||||
bool original_verbose = verbosity_is_enabled();
|
||||
#endif
|
||||
|
||||
(void)ret;
|
||||
|
||||
#ifndef IS_SALAMANDER
|
||||
#if defined(HAVE_LOGGER)
|
||||
logger_init();
|
||||
@ -1116,9 +1129,6 @@ static void frontend_xdk_get_environment_settings(int *argc, char *argv[],
|
||||
|
||||
#ifdef _XBOX360
|
||||
/* Detect install environment. */
|
||||
unsigned long license_mask;
|
||||
DWORD volume_device_type;
|
||||
|
||||
if (XContentGetLicenseMask(&license_mask, NULL) == ERROR_SUCCESS)
|
||||
{
|
||||
XContentQueryVolumeDeviceType("GAME",&volume_device_type, NULL);
|
||||
@ -1181,11 +1191,7 @@ static void frontend_xdk_get_environment_settings(int *argc, char *argv[],
|
||||
"info", sizeof(g_defaults.dirs[DEFAULT_DIR_CORE_INFO]));
|
||||
|
||||
#ifndef IS_SALAMANDER
|
||||
static char path[PATH_MAX_LENGTH] = {0};
|
||||
#if defined(_XBOX1)
|
||||
LAUNCH_DATA ptr;
|
||||
DWORD launch_type;
|
||||
|
||||
if (XGetLaunchInfo(&launch_type, &ptr) == ERROR_SUCCESS)
|
||||
{
|
||||
char *extracted_path = NULL;
|
||||
@ -1204,14 +1210,15 @@ static void frontend_xdk_get_environment_settings(int *argc, char *argv[],
|
||||
}
|
||||
}
|
||||
#elif defined(_XBOX360)
|
||||
DWORD dwLaunchDataSize;
|
||||
if (XGetLaunchDataSize(&dwLaunchDataSize) == ERROR_SUCCESS)
|
||||
{
|
||||
BYTE* pLaunchData = new BYTE[dwLaunchDataSize];
|
||||
XGetLaunchData(pLaunchData, dwLaunchDataSize);
|
||||
char *extracted_path = (char*)calloc(dwLaunchDataSize, sizeof(char));
|
||||
BYTE* pLaunchData = (BYTE*)calloc(dwLaunchDataSize, sizeof(BYTE));
|
||||
AURORA_LAUNCHDATA_EXECUTABLE* aurora = (AURORA_LAUNCHDATA_EXECUTABLE*)pLaunchData;
|
||||
char* extracted_path = new char[dwLaunchDataSize];
|
||||
|
||||
XGetLaunchData(pLaunchData, dwLaunchDataSize);
|
||||
memset(extracted_path, 0, dwLaunchDataSize);
|
||||
|
||||
if (aurora->ApplicationId == AURORA_LAUNCHDATA_APPID && aurora->FunctionId == AURORA_LAUNCHDATA_EXECUTABLE_FUNCID)
|
||||
{
|
||||
if (xbox_io_mount("aurora:", aurora->SystemPath) >= 0)
|
||||
@ -1219,15 +1226,14 @@ static void frontend_xdk_get_environment_settings(int *argc, char *argv[],
|
||||
"aurora:%s%s", aurora->RelativePath, aurora->Exectutable);
|
||||
}
|
||||
else
|
||||
snprintf(extracted_path,
|
||||
dwLaunchDataSize, "%s", pLaunchData);
|
||||
strlcpy(extracted_path, pLaunchData, dwLaunchDataSize);
|
||||
|
||||
/* Auto-start game */
|
||||
if (!string_is_empty(extracted_path))
|
||||
strlcpy(path, extracted_path, sizeof(path));
|
||||
|
||||
if (pLaunchData)
|
||||
delete []pLaunchData;
|
||||
free(pLaunchData);
|
||||
}
|
||||
#endif
|
||||
if (!string_is_empty(path))
|
||||
@ -1278,6 +1284,13 @@ static void frontend_xdk_exec(const char *path, bool should_load_game)
|
||||
{
|
||||
#ifndef IS_SALAMANDER
|
||||
bool original_verbose = verbosity_is_enabled();
|
||||
#endif
|
||||
#if defined(_XBOX)
|
||||
#if defined(_XBOX1)
|
||||
LAUNCH_DATA ptr;
|
||||
#elif defined(_XBOX360)
|
||||
char game_path[1024] = {0};
|
||||
#endif
|
||||
#endif
|
||||
(void)should_load_game;
|
||||
|
||||
@ -1287,7 +1300,6 @@ static void frontend_xdk_exec(const char *path, bool should_load_game)
|
||||
#else
|
||||
#ifdef _XBOX
|
||||
#if defined(_XBOX1)
|
||||
LAUNCH_DATA ptr;
|
||||
memset(&ptr, 0, sizeof(ptr));
|
||||
|
||||
if (should_load_game && !path_is_empty(RARCH_PATH_CONTENT))
|
||||
@ -1296,8 +1308,6 @@ static void frontend_xdk_exec(const char *path, bool should_load_game)
|
||||
if (!string_is_empty(path))
|
||||
XLaunchNewImage(path, !string_is_empty((const char*)ptr.Data) ? &ptr : NULL);
|
||||
#elif defined(_XBOX360)
|
||||
char game_path[1024] = {0};
|
||||
|
||||
if (should_load_game && !path_is_empty(RARCH_PATH_CONTENT))
|
||||
{
|
||||
strlcpy(game_path, path_get(RARCH_PATH_CONTENT), sizeof(game_path));
|
||||
@ -1305,7 +1315,7 @@ static void frontend_xdk_exec(const char *path, bool should_load_game)
|
||||
}
|
||||
|
||||
if (!string_is_empty(path))
|
||||
XLaunchNewImage(path, NULL);
|
||||
XLaunchNewImage(path, 0);
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
@ -31,7 +31,10 @@ bool d3d_swap(void *data, LPDIRECT3DDEVICE dev)
|
||||
#elif defined(_XBOX360)
|
||||
D3DDevice_Present(dev);
|
||||
#elif defined(HAVE_D3D9) && !defined(__cplusplus)
|
||||
if (IDirect3DDevice9_Present(dev, NULL, NULL, NULL, NULL) == D3DERR_DEVICE_LOST)
|
||||
if (IDirect3DDevice9_Present(dev, NULL, NULL, NULL, NULL) == D3DERR_DEVICELOST)
|
||||
return false;
|
||||
#elif defined(HAVE_D3D8) && !defined(__cplusplus)
|
||||
if (IDirect3DDevice8_Present(dev, NULL, NULL, NULL, NULL) == D3DERR_DEVICELOST)
|
||||
return false;
|
||||
#else
|
||||
if (dev->Present(NULL, NULL, NULL, NULL) != D3D_OK)
|
||||
@ -43,13 +46,15 @@ bool d3d_swap(void *data, LPDIRECT3DDEVICE dev)
|
||||
void d3d_set_transform(LPDIRECT3DDEVICE dev,
|
||||
D3DTRANSFORMSTATETYPE state, CONST D3DMATRIX *matrix)
|
||||
{
|
||||
#ifdef _XBOX1
|
||||
#if defined(_XBOX1)
|
||||
D3DDevice_SetTransform(state, matrix);
|
||||
#elif !defined(_XBOX360)
|
||||
/* XBox 360 D3D9 does not support fixed-function pipeline. */
|
||||
|
||||
#if defined(HAVE_D3D9) && !defined(__cplusplus)
|
||||
IDirect3DDevice9_SetTransform(dev, state, matrix);
|
||||
#elif defined(HAVE_D3D8) && !defined(__cplusplus)
|
||||
IDirect3DDevice8_SetTransform(dev, state, matrix);
|
||||
#else
|
||||
dev->SetTransform(state, matrix);
|
||||
#endif
|
||||
@ -57,6 +62,47 @@ void d3d_set_transform(LPDIRECT3DDEVICE dev,
|
||||
#endif
|
||||
}
|
||||
|
||||
bool d3d_texture_get_level_desc(LPDIRECT3DTEXTURE tex,
|
||||
unsigned idx, void *_ppsurface_level)
|
||||
{
|
||||
if (!tex)
|
||||
return false;
|
||||
#if defined(HAVE_D3D9) && !defined(__cplusplus)
|
||||
#if defined(_XBOX)
|
||||
D3DTexture_GetLevelDesc(tex, idx, (D3DSURFACE_DESC*)_ppsurface_level);
|
||||
return true;
|
||||
#else
|
||||
if (SUCCEEDED(IDirect3DTexture9_GetLevelDesc(tex, idx, (D3DSURFACE_DESC*)_ppsurface_level)))
|
||||
return true;
|
||||
#endif
|
||||
#elif defined(HAVE_D3D8) && !defined(__cplusplus)
|
||||
if (SUCCEEDED(IDirect3DTexture8_GetLevelDesc(tex, idx, (D3DSURFACE_DESC*)_ppsurface_level)))
|
||||
return true;
|
||||
#else
|
||||
if (SUCCEEDED(tex->GetLevelDesc(idx, (D3DSURFACE_DESC*)_ppsurface_level)))
|
||||
return true;
|
||||
#endif
|
||||
return false;
|
||||
}
|
||||
|
||||
bool d3d_texture_get_surface_level(LPDIRECT3DTEXTURE tex,
|
||||
unsigned idx, void **_ppsurface_level)
|
||||
{
|
||||
if (!tex)
|
||||
return false;
|
||||
#if defined(HAVE_D3D9) && !defined(__cplusplus)
|
||||
if (SUCCEEDED(IDirect3DTexture9_GetSurfaceLevel(tex, idx, (IDirect3DSurface9**)_ppsurface_level)))
|
||||
return true;
|
||||
#elif defined(HAVE_D3D8) && !defined(__cplusplus)
|
||||
if (SUCCEEDED(IDirect3DTexture8_GetSurfaceLevel(tex, idx, (LPDIRECT3DSURFACE**)_ppsurface_level)))
|
||||
return true;
|
||||
#else
|
||||
if (SUCCEEDED(tex->GetSurfaceLevel(idx, (ID3DSURFACE**)_ppsurface_level)))
|
||||
return true;
|
||||
#endif
|
||||
return false;
|
||||
}
|
||||
|
||||
LPDIRECT3DTEXTURE d3d_texture_new(LPDIRECT3DDEVICE dev,
|
||||
const char *path, unsigned width, unsigned height,
|
||||
unsigned miplevels, unsigned usage, D3DFORMAT format,
|
||||
@ -75,12 +121,20 @@ LPDIRECT3DTEXTURE d3d_texture_new(LPDIRECT3DDEVICE dev,
|
||||
palette, &buf);
|
||||
else
|
||||
{
|
||||
#if defined(HAVE_D3D9) && !defined(__cplusplus)
|
||||
hr = IDirect3DDevice9_CreateTexture(dev, width, height, miplevels, usage,
|
||||
format, pool, &buf, NULL);
|
||||
#elif defined(HAVE_D3D8) && !defined(__cplusplus)
|
||||
hr = IDirect3DDevice8_CreateTexture(dev, width, height, miplevels, usage,
|
||||
format, pool, &buf);
|
||||
#else
|
||||
hr = dev->CreateTexture(width, height, miplevels, usage,
|
||||
format, pool, &buf
|
||||
#ifndef HAVE_D3D8
|
||||
, NULL
|
||||
#endif
|
||||
);
|
||||
#endif
|
||||
}
|
||||
|
||||
if (FAILED(hr))
|
||||
@ -95,12 +149,77 @@ void d3d_texture_free(LPDIRECT3DTEXTURE tex)
|
||||
{
|
||||
#if defined(HAVE_D3D9) && !defined(__cplusplus)
|
||||
IDirect3DTexture9_Release(tex);
|
||||
#elif defined(HAVE_D3D8) && !defined(__cplusplus)
|
||||
IDirect3DTexture8_Release(tex);
|
||||
#else
|
||||
tex->Release();
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
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 true;
|
||||
}
|
||||
|
||||
void d3d_surface_unlock_rect(void *data)
|
||||
{
|
||||
LPDIRECT3DSURFACE surf = (LPDIRECT3DSURFACE)data;
|
||||
if (surf)
|
||||
{
|
||||
#if defined(HAVE_D3D9) && !defined(__cplusplus)
|
||||
IDirect3DSurface9_UnlockRect(surf);
|
||||
#elif defined(HAVE_D3D8) && !defined(__cplusplus)
|
||||
IDirect3DSurface8_UnlockRect(surf);
|
||||
#else
|
||||
surf->UnlockRect();
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
void d3d_surface_free(void *data)
|
||||
{
|
||||
LPDIRECT3DSURFACE surf = (LPDIRECT3DSURFACE)data;
|
||||
if (!surf)
|
||||
return;
|
||||
#if defined(HAVE_D3D9) && !defined(__cplusplus)
|
||||
IDirect3DSurface9_Release(surf);
|
||||
#elif defined(HAVE_D3D8) && !defined(__cplusplus)
|
||||
IDirect3DSurface8_Release(surf);
|
||||
#else
|
||||
surf->Release();
|
||||
#endif
|
||||
}
|
||||
|
||||
void d3d_vertex_declaration_free(void *data)
|
||||
{
|
||||
LPDIRECT3DVERTEXDECLARATION vertex_decl = (LPDIRECT3DVERTEXDECLARATION)data;
|
||||
if (!vertex_decl)
|
||||
return;
|
||||
#if defined(HAVE_D3D9) && !defined(__cplusplus)
|
||||
IDirect3DVertexDeclaration9_Release(vertex_decl);
|
||||
#else
|
||||
vertex_decl->Release();
|
||||
#endif
|
||||
}
|
||||
|
||||
bool d3d_vertex_declaration_new(LPDIRECT3DDEVICE dev,
|
||||
const void *vertex_data, void **decl_data)
|
||||
{
|
||||
@ -108,7 +227,11 @@ bool d3d_vertex_declaration_new(LPDIRECT3DDEVICE dev,
|
||||
const D3DVERTEXELEMENT *vertex_elements = (const D3DVERTEXELEMENT*)vertex_data;
|
||||
LPDIRECT3DVERTEXDECLARATION **vertex_decl = (LPDIRECT3DVERTEXDECLARATION**)decl_data;
|
||||
|
||||
#if defined(__cplusplus)
|
||||
if (SUCCEEDED(dev->CreateVertexDeclaration(vertex_elements, (IDirect3DVertexDeclaration9**)vertex_decl)))
|
||||
#else
|
||||
if (SUCCEEDED(IDirect3DDevice9_CreateVertexDeclaration(dev, vertex_elements, (IDirect3DVertexDeclaration9**)vertex_decl)))
|
||||
#endif
|
||||
return true;
|
||||
#endif
|
||||
return false;
|
||||
@ -122,21 +245,25 @@ LPDIRECT3DVERTEXBUFFER d3d_vertex_buffer_new(LPDIRECT3DDEVICE dev,
|
||||
LPDIRECT3DVERTEXBUFFER buf;
|
||||
|
||||
#ifndef _XBOX
|
||||
#ifndef HAVE_D3D8
|
||||
if (usage == 0)
|
||||
{
|
||||
#if defined(HAVE_D3D9) && !defined(__cplusplus)
|
||||
if (IDirect3DDevice9_GetSoftwareVertexProcessing(dev))
|
||||
#elif defined(HAVE_D3D8) && !defined(__cplusplus)
|
||||
if (IDirect3DDevice8_GetSoftwareVertexProcessing(dev))
|
||||
#else
|
||||
if (dev->GetSoftwareVertexProcessing())
|
||||
#endif
|
||||
usage = D3DUSAGE_SOFTWAREPROCESSING;
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_D3D8)
|
||||
hr = IDirect3DDevice8_CreateVertexBuffer(dev, length, usage, fvf, pool,
|
||||
&buf);
|
||||
#elif defined(HAVE_D3D9)
|
||||
#if defined(HAVE_D3D9) && !defined(__cplusplus)
|
||||
hr = IDirect3DDevice9_CreateVertexBuffer(dev, length, usage, fvf, pool,
|
||||
&buf, NULL);
|
||||
#elif defined(HAVE_D3D8) && !defined(__cplusplus)
|
||||
hr = IDirect3DDevice8_CreateVertexBuffer(dev, length, usage, fvf, pool,
|
||||
&buf);
|
||||
#else
|
||||
hr = dev->CreateVertexBuffer(length, usage, fvf, pool, &buf, NULL);
|
||||
#endif
|
||||
@ -155,7 +282,9 @@ void d3d_vertex_buffer_unlock(void *vertbuf_ptr)
|
||||
D3DVertexBuffer_Unlock(vertbuf);
|
||||
#elif defined(HAVE_D3D9) && !defined(__cplusplus)
|
||||
IDirect3DVertexBuffer9_Unlock(vertbuf);
|
||||
#elif defined(HAVE_D3D9)
|
||||
#elif defined(HAVE_D3D8) && !defined(__cplusplus)
|
||||
IDirect3DVertexBuffer8_Unlock(vertbuf);
|
||||
#else
|
||||
vertbuf->Unlock();
|
||||
#endif
|
||||
}
|
||||
@ -169,7 +298,9 @@ void *d3d_vertex_buffer_lock(void *vertbuf_ptr)
|
||||
buf = (void*)D3DVertexBuffer_Lock2(vertbuf, 0);
|
||||
#elif defined(_XBOX360)
|
||||
buf = D3DVertexBuffer_Lock(vertbuf, 0, 0, 0);
|
||||
#elif defined(HAVE_D3D9)
|
||||
#elif defined(HAVE_D3D9) && !defined(__cplusplus)
|
||||
IDirect3DVertexBuffer9_Lock(vertbuf, 0, sizeof(buf), &buf, 0);
|
||||
#else
|
||||
vertbuf->Lock(0, sizeof(buf), &buf, 0);
|
||||
#endif
|
||||
|
||||
@ -184,7 +315,11 @@ void d3d_vertex_buffer_free(void *vertex_data, void *vertex_declaration)
|
||||
if (vertex_data)
|
||||
{
|
||||
LPDIRECT3DVERTEXBUFFER buf = (LPDIRECT3DVERTEXBUFFER)vertex_data;
|
||||
#if defined(HAVE_D3D9) && !defined(__cplusplus)
|
||||
IDirect3DVertexBuffer9_Release(buf);
|
||||
#else
|
||||
buf->Release();
|
||||
#endif
|
||||
buf = NULL;
|
||||
}
|
||||
|
||||
@ -192,7 +327,7 @@ void d3d_vertex_buffer_free(void *vertex_data, void *vertex_declaration)
|
||||
if (vertex_declaration)
|
||||
{
|
||||
LPDIRECT3DVERTEXDECLARATION vertex_decl = (LPDIRECT3DVERTEXDECLARATION)vertex_declaration;
|
||||
vertex_decl->Release();
|
||||
d3d_vertex_declaration_free(vertex_decl);
|
||||
vertex_decl = NULL;
|
||||
}
|
||||
#endif
|
||||
@ -203,19 +338,63 @@ void d3d_set_stream_source(LPDIRECT3DDEVICE dev, unsigned stream_no,
|
||||
unsigned stride)
|
||||
{
|
||||
LPDIRECT3DVERTEXBUFFER stream_vertbuf = (LPDIRECT3DVERTEXBUFFER)stream_vertbuf_ptr;
|
||||
#if defined(HAVE_D3D8)
|
||||
IDirect3DDevice8_SetStreamSource(dev, stream_no, stream_vertbuf, stride);
|
||||
#elif defined(_XBOX360)
|
||||
#if defined(_XBOX360)
|
||||
D3DDevice_SetStreamSource_Inline(dev, stream_no, stream_vertbuf,
|
||||
offset_bytes, stride);
|
||||
#elif defined(HAVE_D3D9) && !defined(__cplusplus)
|
||||
IDirect3DDevice9_SetStreamSource(dev, stream_no, stream_vertbuf, offset_bytes,
|
||||
IDirect3DDevice9_SetStreamSource(dev, stream_no, stream_vertbuf,
|
||||
offset_bytes,
|
||||
stride);
|
||||
#elif defined(HAVE_D3D8) && !defined(__cplusplus)
|
||||
IDirect3DDevice8_SetStreamSource(dev, stream_no, stream_vertbuf, stride);
|
||||
#else
|
||||
dev->SetStreamSource(stream_no, stream_vertbuf, offset_bytes, stride);
|
||||
#endif
|
||||
}
|
||||
|
||||
bool d3d_device_create_offscreen_plain_surface(
|
||||
LPDIRECT3DDEVICE dev,
|
||||
unsigned width,
|
||||
unsigned height,
|
||||
unsigned format,
|
||||
unsigned pool,
|
||||
void **surf_data,
|
||||
void *data)
|
||||
{
|
||||
#if defined(HAVE_D3D9) && !defined(_XBOX)
|
||||
#ifdef __cplusplus
|
||||
if (SUCCEEDED(dev->CreateOffscreenPlainSurface(width, height,
|
||||
(D3DFORMAT)format, (D3DPOOL)pool,
|
||||
(LPDIRECT3DSURFACE*)surf_data,
|
||||
(HANDLE*)data)))
|
||||
return true;
|
||||
#else
|
||||
if (SUCCEEDED(IDirect3DDevice9_CreateOffscreenPlainSurface(dev,
|
||||
width, height,
|
||||
(D3DFORMAT)format, (D3DPOOL)pool,
|
||||
(LPDIRECT3DSURFACE*)surf_data,
|
||||
(HANDLE*)data)))
|
||||
return true;
|
||||
#endif
|
||||
#endif
|
||||
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)
|
||||
{
|
||||
#if defined(HAVE_D3D9) && !defined(__cplusplus)
|
||||
IDirect3DDevice9_SetTextureStageState(dev, sampler, (D3DTEXTURESTAGESTATETYPE)type, value);
|
||||
#elif defined(HAVE_D3D8) && !defined(__cplusplus)
|
||||
IDirect3DDevice8_SetTextureStageState(dev, sampler, (D3DTEXTURESTAGESTATETYPE)type, value);
|
||||
#else
|
||||
dev->SetTextureStageState(sampler, (D3DTEXTURESTAGESTATETYPE)type, value);
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
void d3d_set_sampler_address_u(LPDIRECT3DDEVICE dev,
|
||||
unsigned sampler, unsigned value)
|
||||
{
|
||||
@ -227,7 +406,7 @@ void d3d_set_sampler_address_u(LPDIRECT3DDEVICE dev,
|
||||
#elif defined(HAVE_D3D9) && !defined(__cplusplus)
|
||||
IDirect3DDevice9_SetSamplerState(dev, sampler, D3DSAMP_ADDRESSU, value);
|
||||
#elif defined(HAVE_D3D8)
|
||||
dev->SetTextureStageState(sampler, D3DTSS_ADDRESSU, value);
|
||||
d3d_set_texture_stage(dev, sampler, D3DTSS_ADDRESSU, value);
|
||||
#else
|
||||
dev->SetSamplerState(sampler, D3DSAMP_ADDRESSU, value);
|
||||
#endif
|
||||
@ -244,7 +423,7 @@ void d3d_set_sampler_address_v(LPDIRECT3DDEVICE dev,
|
||||
#elif defined(HAVE_D3D9) && !defined(__cplusplus)
|
||||
IDirect3DDevice9_SetSamplerState(dev, sampler, D3DSAMP_ADDRESSV, value);
|
||||
#elif defined(HAVE_D3D8)
|
||||
dev->SetTextureStageState(sampler, D3DTSS_ADDRESSV, value);
|
||||
d3d_set_texture_stage(dev, sampler, D3DTSS_ADDRESSV, value);
|
||||
#else
|
||||
dev->SetSamplerState(sampler, D3DSAMP_ADDRESSV, value);
|
||||
#endif
|
||||
@ -261,7 +440,7 @@ void d3d_set_sampler_minfilter(LPDIRECT3DDEVICE dev,
|
||||
#elif defined(HAVE_D3D9) && !defined(__cplusplus)
|
||||
IDirect3DDevice9_SetSamplerState(dev, sampler, D3DSAMP_MINFILTER, value);
|
||||
#elif defined(HAVE_D3D8)
|
||||
dev->SetTextureStageState(sampler, D3DTSS_MINFILTER, value);
|
||||
d3d_set_texture_stage(dev, sampler, D3DTSS_MINFILTER, value);
|
||||
#else
|
||||
dev->SetSamplerState(sampler, D3DSAMP_MINFILTER, value);
|
||||
#endif
|
||||
@ -278,12 +457,57 @@ void d3d_set_sampler_magfilter(LPDIRECT3DDEVICE dev,
|
||||
#elif defined(HAVE_D3D9) && !defined(__cplusplus)
|
||||
IDirect3DDevice9_SetSamplerState(dev, sampler, D3DSAMP_MAGFILTER, value);
|
||||
#elif defined(HAVE_D3D8)
|
||||
dev->SetTextureStageState(sampler, D3DTSS_MAGFILTER, value);
|
||||
d3d_set_texture_stage(dev, sampler, D3DTSS_MAGFILTER, value);
|
||||
#else
|
||||
dev->SetSamplerState(sampler, D3DSAMP_MAGFILTER, value);
|
||||
#endif
|
||||
}
|
||||
|
||||
bool d3d_begin_scene(LPDIRECT3DDEVICE dev)
|
||||
{
|
||||
#if defined(HAVE_D3D9) && !defined(__cplusplus)
|
||||
#if defined(_XBOX)
|
||||
IDirect3DDevice9_BeginScene(dev);
|
||||
#else
|
||||
if (FAILED(IDirect3DDevice9_BeginScene(dev)))
|
||||
return false;
|
||||
#endif
|
||||
#elif defined(HAVE_D3D8) && !defined(__cplusplus)
|
||||
if (FAILED(IDirect3DDevice8_BeginScene(dev)))
|
||||
return false;
|
||||
#elif defined(_XBOX)
|
||||
dev->BeginScene();
|
||||
#else
|
||||
if (FAILED(dev->BeginScene()))
|
||||
return false;
|
||||
#endif
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void d3d_end_scene(LPDIRECT3DDEVICE dev)
|
||||
{
|
||||
#if defined(HAVE_D3D9) && !defined(__cplusplus)
|
||||
IDirect3DDevice9_EndScene(dev);
|
||||
#elif defined(HAVE_D3D8) && !defined(__cplusplus)
|
||||
IDirect3DDevice8_EndScene(dev);
|
||||
#else
|
||||
dev->EndScene();
|
||||
#endif
|
||||
}
|
||||
|
||||
static void d3d_draw_primitive_internal(LPDIRECT3DDEVICE dev,
|
||||
D3DPRIMITIVETYPE type, unsigned start, unsigned count)
|
||||
{
|
||||
#if defined(HAVE_D3D9) && !defined(__cplusplus)
|
||||
IDirect3DDevice9_DrawPrimitive(dev, type, start, count);
|
||||
#elif defined(HAVE_D3D8) && !defined(__cplusplus)
|
||||
IDirect3DDevice8_DrawPrimitive(dev, type, start, count);
|
||||
#else
|
||||
dev->DrawPrimitive(type, start, count);
|
||||
#endif
|
||||
}
|
||||
|
||||
void d3d_draw_primitive(LPDIRECT3DDEVICE dev,
|
||||
D3DPRIMITIVETYPE type, unsigned start, unsigned count)
|
||||
{
|
||||
@ -291,15 +515,11 @@ void d3d_draw_primitive(LPDIRECT3DDEVICE dev,
|
||||
D3DDevice_DrawVertices(type, start, D3DVERTEXCOUNT(type, count));
|
||||
#elif defined(_XBOX360)
|
||||
D3DDevice_DrawVertices(dev, type, start, D3DVERTEXCOUNT(type, count));
|
||||
#elif defined(HAVE_D3D9) && !defined(__cplusplus)
|
||||
IDirect3DDevice9_BeginScene(dev);
|
||||
IDirect3DDevice9_DrawPrimitive(dev, type, start, count);
|
||||
IDirect3DDevice9_EndScene(dev);
|
||||
#else
|
||||
if (SUCCEEDED(dev->BeginScene()))
|
||||
if (d3d_begin_scene(dev))
|
||||
{
|
||||
dev->DrawPrimitive(type, start, count);
|
||||
dev->EndScene();
|
||||
d3d_draw_primitive_internal(dev, type, start, count);
|
||||
d3d_end_scene(dev);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
@ -316,11 +536,47 @@ void d3d_clear(LPDIRECT3DDEVICE dev,
|
||||
#elif defined(HAVE_D3D9) && !defined(__cplusplus)
|
||||
IDirect3DDevice9_Clear(dev, count, rects, flags,
|
||||
color, z, stencil);
|
||||
#elif defined(HAVE_D3D8) && !defined(__cplusplus)
|
||||
IDirect3DDevice8_Clear(dev, count, rects, flags,
|
||||
color, z, stencil);
|
||||
#else
|
||||
dev->Clear(count, rects, flags, color, z, stencil);
|
||||
#endif
|
||||
}
|
||||
|
||||
bool d3d_device_get_render_target_data(LPDIRECT3DDEVICE dev,
|
||||
void *_src, void *_dst)
|
||||
{
|
||||
LPDIRECT3DSURFACE src = (LPDIRECT3DSURFACE)_src;
|
||||
LPDIRECT3DSURFACE dst = (LPDIRECT3DSURFACE)_dst;
|
||||
#if defined(HAVE_D3D9) && !defined(__cplusplus) && !defined(_XBOX)
|
||||
if (SUCCEEDED(IDirect3DDevice9_GetRenderTargetData(dev, src, dst)))
|
||||
return true;
|
||||
#elif !defined(_XBOX)
|
||||
if (SUCCEEDED(dev->GetRenderTargetData(src, dst)))
|
||||
return true;
|
||||
#endif
|
||||
return false;
|
||||
}
|
||||
|
||||
bool d3d_device_get_render_target(LPDIRECT3DDEVICE dev,
|
||||
unsigned idx, void **data)
|
||||
{
|
||||
#if defined(HAVE_D3D9) && !defined(__cplusplus)
|
||||
if (FAILED(IDirect3DDevice9_GetRenderTarget(dev, idx,
|
||||
(LPDIRECT3DSURFACE*)data)))
|
||||
#elif defined(HAVE_D3D8) && !defined(__cplusplus)
|
||||
if (FAILED(IDirect3DDevice8_GetRenderTarget(dev,
|
||||
(LPDIRECT3DSURFACE*)data)))
|
||||
#else
|
||||
if (FAILED(dev->GetRenderTarget(idx,
|
||||
(LPDIRECT3DSURFACE*)data)))
|
||||
#endif
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
bool d3d_lock_rectangle(LPDIRECT3DTEXTURE tex,
|
||||
unsigned level, D3DLOCKED_RECT *lock_rect, RECT *rect,
|
||||
unsigned rectangle_height, unsigned flags)
|
||||
@ -328,7 +584,10 @@ bool d3d_lock_rectangle(LPDIRECT3DTEXTURE tex,
|
||||
#if defined(_XBOX)
|
||||
D3DTexture_LockRect(tex, level, lock_rect, rect, flags);
|
||||
#elif defined(HAVE_D3D9) && !defined(__cplusplus)
|
||||
if (IDirect3DSurface9_LockRect(tex, lock_rect, rect, flags) != D3D_OK)
|
||||
if (IDirect3DTexture9_LockRect(tex, level, lock_rect, (const RECT*)rect, flags) != D3D_OK)
|
||||
return false;
|
||||
#elif defined(HAVE_D3D8) && !defined(__cplusplus)
|
||||
if (IDirect3DTexture8_LockRect(tex, lock_rect, rect, flags) != D3D_OK)
|
||||
return false;
|
||||
#else
|
||||
if (FAILED(tex->LockRect(level, lock_rect, rect, flags)))
|
||||
@ -342,7 +601,9 @@ void d3d_unlock_rectangle(LPDIRECT3DTEXTURE tex)
|
||||
#ifdef _XBOX
|
||||
D3DTexture_UnlockRect(tex, 0);
|
||||
#elif defined(HAVE_D3D9) && !defined(__cplusplus)
|
||||
IDirect3DSurface9_UnlockRect(tex);
|
||||
IDirect3DTexture9_UnlockRect(tex, 0);
|
||||
#elif defined(HAVE_D3D8) && !defined(__cplusplus)
|
||||
IDirect3DTexture8_UnlockRect(tex);
|
||||
#else
|
||||
tex->UnlockRect(0);
|
||||
#endif
|
||||
@ -367,6 +628,8 @@ void d3d_set_viewports(LPDIRECT3DDEVICE dev, D3DVIEWPORT *vp)
|
||||
D3DDevice_SetViewport(vp);
|
||||
#elif defined(HAVE_D3D9) && !defined(__cplusplus)
|
||||
IDirect3DDevice9_SetViewport(dev, vp);
|
||||
#elif defined(HAVE_D3D8) && !defined(__cplusplus)
|
||||
IDirect3DDevice8_SetViewport(dev, vp);
|
||||
#else
|
||||
dev->SetViewport(vp);
|
||||
#endif
|
||||
@ -385,9 +648,15 @@ 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, tex);
|
||||
IDirect3DDevice9_SetTexture(dev, sampler, (IDirect3DBaseTexture9*)tex);
|
||||
#elif defined(HAVE_D3D8) && !defined(__cplusplus)
|
||||
IDirect3DDevice8_SetTexture(dev, sampler, tex);
|
||||
#else
|
||||
dev->SetTexture(sampler, tex);
|
||||
#endif
|
||||
@ -402,8 +671,12 @@ HRESULT d3d_set_vertex_shader(LPDIRECT3DDEVICE dev, unsigned index,
|
||||
LPDIRECT3DVERTEXSHADER shader = (LPDIRECT3DVERTEXSHADER)data;
|
||||
D3DDevice_SetVertexShader(dev, shader);
|
||||
return S_OK;
|
||||
#elif defined(HAVE_D3D8)
|
||||
return E_FAIL;
|
||||
#elif defined(HAVE_D3D8) && !defined(__cplusplus)
|
||||
LPDIRECT3DVERTEXSHADER shader = (LPDIRECT3DVERTEXSHADER)data;
|
||||
return IDirect3DDevice8_SetVertexShader(index);
|
||||
#elif defined(HAVE_D3D9) && !defined(__cplusplus)
|
||||
LPDIRECT3DVERTEXSHADER shader = (LPDIRECT3DVERTEXSHADER)data;
|
||||
return IDirect3DDevice9_SetVertexShader(dev, shader);
|
||||
#else
|
||||
LPDIRECT3DVERTEXSHADER shader = (LPDIRECT3DVERTEXSHADER)data;
|
||||
return dev->SetVertexShader(shader);
|
||||
@ -419,7 +692,7 @@ void d3d_texture_blit(unsigned pixel_size,
|
||||
{
|
||||
#if defined(_XBOX360)
|
||||
D3DSURFACE_DESC desc;
|
||||
tex->GetLevelDesc(0, &desc);
|
||||
d3d_texture_get_level_desc(tex, 0, &desc);
|
||||
XGCopySurface(lr->pBits, lr->Pitch, width, height, desc.Format, NULL,
|
||||
frame, pitch, desc.Format, NULL, 0, 0);
|
||||
#else
|
||||
@ -444,6 +717,8 @@ void d3d_set_render_state(void *data, D3DRENDERSTATETYPE state, DWORD value)
|
||||
|
||||
#if defined(HAVE_D3D9) && !defined(__cplusplus)
|
||||
IDirect3DDevice9_SetRenderState(dev, state, value);
|
||||
#elif defined(HAVE_D3D8) && !defined(__cplusplus)
|
||||
IDirect3DDevice8_SetRenderState(dev, state, value);
|
||||
#else
|
||||
dev->SetRenderState(state, value);
|
||||
#endif
|
||||
@ -461,6 +736,19 @@ void d3d_enable_blend_func(void *data)
|
||||
d3d_set_render_state(dev, D3DRS_ALPHABLENDENABLE, true);
|
||||
}
|
||||
|
||||
void d3d_device_set_render_target(LPDIRECT3DDEVICE dev, unsigned idx,
|
||||
void *data)
|
||||
{
|
||||
LPDIRECT3DSURFACE surf = (LPDIRECT3DSURFACE)data;
|
||||
#if defined(HAVE_D3D9) && !defined(__cplusplus)
|
||||
IDirect3DDevice9_SetRenderTarget(dev, idx, surf);
|
||||
#elif defined(HAVE_D3D8) && !defined(__cplusplus)
|
||||
IDirect3DDevice8_SetRenderTarget(dev, idx, surf);
|
||||
#else
|
||||
dev->SetRenderTarget(idx, surf);
|
||||
#endif
|
||||
}
|
||||
|
||||
void d3d_enable_alpha_blend_texture_func(void *data)
|
||||
{
|
||||
LPDIRECT3DDEVICE dev = (LPDIRECT3DDEVICE)data;
|
||||
@ -470,9 +758,9 @@ void d3d_enable_alpha_blend_texture_func(void *data)
|
||||
|
||||
#ifndef _XBOX360
|
||||
/* Also blend the texture with the set alpha value. */
|
||||
dev->SetTextureStageState(0, D3DTSS_ALPHAOP, D3DTOP_MODULATE);
|
||||
dev->SetTextureStageState(0, D3DTSS_ALPHAARG1, D3DTA_DIFFUSE);
|
||||
dev->SetTextureStageState(0, D3DTSS_ALPHAARG2, D3DTA_TEXTURE);
|
||||
d3d_set_texture_stage_state(dev, 0, D3DTSS_ALPHAOP, D3DTOP_MODULATE);
|
||||
d3d_set_texture_stage_state(dev, 0, D3DTSS_ALPHAARG1, D3DTA_DIFFUSE);
|
||||
d3d_set_texture_stage_state(dev, 0, D3DTSS_ALPHAARG2, D3DTA_TEXTURE);
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -522,21 +810,102 @@ void d3d_set_vertex_declaration(void *data, void *vertex_data)
|
||||
#endif
|
||||
}
|
||||
|
||||
static bool d3d_reset_internal(LPDIRECT3DDEVICE dev,
|
||||
D3DPRESENT_PARAMETERS *d3dpp
|
||||
)
|
||||
{
|
||||
#if defined(HAVE_D3D9) && !defined(__cplusplus)
|
||||
return (IDirect3DDevice9_Reset(dev, d3dpp) == D3D_OK);
|
||||
#elif defined(HAVE_D3D8) && !defined(__cplusplus)
|
||||
return (IDirect3DDevice8_Reset(dev, d3dpp) == D3D_OK);
|
||||
#else
|
||||
return (dev->Reset(d3dpp) == D3D_OK);
|
||||
#endif
|
||||
}
|
||||
|
||||
static HRESULT d3d_test_cooperative_level(LPDIRECT3DDEVICE dev)
|
||||
{
|
||||
#if defined(HAVE_D3D9) && !defined(__cplusplus) && !defined(_XBOX)
|
||||
return IDirect3DDevice9_TestCooperativeLevel(dev);
|
||||
#elif defined(HAVE_D3D8) && !defined(__cplusplus) && !defined(_XBOX)
|
||||
return IDirect3DDevice8_TestCooperativeLevel(dev);
|
||||
#elif defined(_XBOX)
|
||||
return E_FAIL;
|
||||
#else
|
||||
return dev->TestCooperativeLevel();
|
||||
#endif
|
||||
}
|
||||
|
||||
static bool d3d_create_device_internal(LPDIRECT3DDEVICE *dev,
|
||||
D3DPRESENT_PARAMETERS *d3dpp,
|
||||
LPDIRECT3D d3d,
|
||||
HWND focus_window,
|
||||
unsigned cur_mon_id,
|
||||
DWORD behavior_flags)
|
||||
{
|
||||
#if defined(HAVE_D3D9) && !defined(__cplusplus)
|
||||
if (SUCCEEDED(IDirect3D9_CreateDevice(d3d,
|
||||
cur_mon_id,
|
||||
D3DDEVTYPE_HAL,
|
||||
focus_window,
|
||||
behavior_flags,
|
||||
d3dpp,
|
||||
dev)))
|
||||
return true;
|
||||
#elif defined(HAVE_D3D8) && !defined(__cplusplus)
|
||||
if (SUCCEEDED(IDirect3D8_CreateDevice(d3d,
|
||||
cur_mon_id,
|
||||
D3DDEVTYPE_HAL,
|
||||
focus_window,
|
||||
behavior_flags,
|
||||
d3dpp,
|
||||
dev)))
|
||||
return true;
|
||||
#else
|
||||
if (SUCCEEDED(d3d->CreateDevice(
|
||||
cur_mon_id,
|
||||
D3DDEVTYPE_HAL,
|
||||
focus_window,
|
||||
behavior_flags,
|
||||
d3dpp,
|
||||
dev)))
|
||||
return true;
|
||||
#endif
|
||||
return false;
|
||||
}
|
||||
|
||||
bool d3d_create_device(LPDIRECT3DDEVICE *dev,
|
||||
D3DPRESENT_PARAMETERS *d3dpp,
|
||||
LPDIRECT3D d3d,
|
||||
HWND focus_window,
|
||||
unsigned cur_mon_id)
|
||||
{
|
||||
if (!d3d_create_device_internal(dev,
|
||||
d3dpp,
|
||||
d3d,
|
||||
focus_window,
|
||||
cur_mon_id,
|
||||
D3DCREATE_HARDWARE_VERTEXPROCESSING))
|
||||
if (!d3d_create_device_internal(
|
||||
dev, d3dpp, d3d, focus_window,
|
||||
cur_mon_id,
|
||||
D3DCREATE_SOFTWARE_VERTEXPROCESSING))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool d3d_reset(LPDIRECT3DDEVICE dev, D3DPRESENT_PARAMETERS *d3dpp)
|
||||
{
|
||||
#ifndef _XBOX
|
||||
HRESULT res;
|
||||
#endif
|
||||
const char *err = NULL;
|
||||
|
||||
if (dev->Reset(d3dpp) == D3D_OK)
|
||||
if (d3d_reset_internal(dev, d3dpp))
|
||||
return true;
|
||||
|
||||
/* Try to recreate the device completely. */
|
||||
#ifndef _XBOX
|
||||
res = dev->TestCooperativeLevel();
|
||||
RARCH_WARN("[D3D]: Attempting to recover from dead state...\n");
|
||||
|
||||
switch (res)
|
||||
#ifndef _XBOX
|
||||
/* Try to recreate the device completely. */
|
||||
switch (d3d_test_cooperative_level(dev))
|
||||
{
|
||||
case D3DERR_DEVICELOST:
|
||||
err = "DEVICELOST";
|
||||
@ -553,10 +922,7 @@ bool d3d_reset(LPDIRECT3DDEVICE dev, D3DPRESENT_PARAMETERS *d3dpp)
|
||||
default:
|
||||
err = "Unknown";
|
||||
}
|
||||
RARCH_WARN("[D3D]: Attempting to recover from dead state (%s).\n",
|
||||
err);
|
||||
#else
|
||||
RARCH_WARN("[D3D]: Attempting to recover from dead state.\n");
|
||||
RARCH_WARN("[D3D]: recovering from dead state: (%s).\n", err);
|
||||
#endif
|
||||
|
||||
return false;
|
||||
@ -568,6 +934,8 @@ void d3d_device_free(LPDIRECT3DDEVICE dev, LPDIRECT3D pd3d)
|
||||
{
|
||||
#if defined(HAVE_D3D9) && !defined(__cplusplus)
|
||||
IDirect3DDevice9_Release(dev);
|
||||
#elif defined(HAVE_D3D8) && !defined(__cplusplus)
|
||||
IDirect3DDevice8_Release(dev);
|
||||
#else
|
||||
dev->Release();
|
||||
#endif
|
||||
@ -576,6 +944,8 @@ void d3d_device_free(LPDIRECT3DDEVICE dev, LPDIRECT3D pd3d)
|
||||
{
|
||||
#if defined(HAVE_D3D9) && !defined(__cplusplus)
|
||||
IDirect3D9_Release(pd3d);
|
||||
#elif defined(HAVE_D3D8) && !defined(__cplusplus)
|
||||
IDirect3D8_Release(pd3d);
|
||||
#else
|
||||
pd3d->Release();
|
||||
#endif
|
||||
@ -601,3 +971,85 @@ D3DTEXTUREFILTERTYPE d3d_translate_filter(unsigned type)
|
||||
|
||||
return D3DTEXF_POINT;
|
||||
}
|
||||
|
||||
|
||||
void *d3d_matrix_transpose(void *_pout, const void *_pm)
|
||||
{
|
||||
unsigned i,j;
|
||||
D3DMATRIX *pout = (D3DMATRIX*)_pout;
|
||||
CONST D3DMATRIX *pm = (D3DMATRIX*)_pm;
|
||||
|
||||
for (i = 0; i < 4; i++)
|
||||
{
|
||||
for (j = 0; j < 4; j++)
|
||||
pout->m[i][j] = pm->m[j][i];
|
||||
}
|
||||
return pout;
|
||||
}
|
||||
|
||||
|
||||
void *d3d_matrix_identity(void *_pout)
|
||||
{
|
||||
D3DMATRIX *pout = (D3DMATRIX*)_pout;
|
||||
if ( !pout )
|
||||
return NULL;
|
||||
|
||||
pout->m[0][1] = 0.0f;
|
||||
pout->m[0][2] = 0.0f;
|
||||
pout->m[0][3] = 0.0f;
|
||||
pout->m[1][0] = 0.0f;
|
||||
pout->m[1][2] = 0.0f;
|
||||
pout->m[1][3] = 0.0f;
|
||||
pout->m[2][0] = 0.0f;
|
||||
pout->m[2][1] = 0.0f;
|
||||
pout->m[2][3] = 0.0f;
|
||||
pout->m[3][0] = 0.0f;
|
||||
pout->m[3][1] = 0.0f;
|
||||
pout->m[3][2] = 0.0f;
|
||||
pout->m[0][0] = 1.0f;
|
||||
pout->m[1][1] = 1.0f;
|
||||
pout->m[2][2] = 1.0f;
|
||||
pout->m[3][3] = 1.0f;
|
||||
return pout;
|
||||
}
|
||||
|
||||
void *d3d_matrix_ortho_off_center_lh(void *_pout, float l, float r, float b, float t, float zn, float zf)
|
||||
{
|
||||
D3DMATRIX *pout = (D3DMATRIX*)_pout;
|
||||
|
||||
d3d_matrix_identity(pout);
|
||||
|
||||
pout->m[0][0] = 2.0f / (r - l);
|
||||
pout->m[1][1] = 2.0f / (t - b);
|
||||
pout->m[2][2] = 1.0f / (zf -zn);
|
||||
pout->m[3][0] = -1.0f -2.0f *l / (r - l);
|
||||
pout->m[3][1] = 1.0f + 2.0f * t / (b - t);
|
||||
pout->m[3][2] = zn / (zn -zf);
|
||||
return pout;
|
||||
}
|
||||
|
||||
void *d3d_matrix_multiply(void *_pout, const void *_pm1, const void *_pm2)
|
||||
{
|
||||
unsigned i,j;
|
||||
D3DMATRIX *pout = (D3DMATRIX*)_pout;
|
||||
CONST D3DMATRIX *pm1 = (CONST D3DMATRIX*)_pm1;
|
||||
CONST D3DMATRIX *pm2 = (CONST D3DMATRIX*)_pm2;
|
||||
|
||||
for (i=0; i<4; i++)
|
||||
{
|
||||
for (j=0; j<4; j++)
|
||||
pout->m[i][j] = pm1->m[i][0] * pm2->m[0][j] + pm1->m[i][1] * pm2->m[1][j] + pm1->m[i][2] * pm2->m[2][j] + pm1->m[i][3] * pm2->m[3][j];
|
||||
}
|
||||
return pout;
|
||||
}
|
||||
|
||||
void *d3d_matrix_rotation_z(void *_pout, float angle)
|
||||
{
|
||||
D3DMATRIX *pout = (D3DMATRIX*)_pout;
|
||||
d3d_matrix_identity(pout);
|
||||
pout->m[0][0] = cos(angle);
|
||||
pout->m[1][1] = cos(angle);
|
||||
pout->m[0][1] = sin(angle);
|
||||
pout->m[1][0] = -sin(angle);
|
||||
return pout;
|
||||
}
|
@ -35,6 +35,12 @@ void d3d_vertex_buffer_unlock(void *data);
|
||||
|
||||
void d3d_vertex_buffer_free(void *vertex_data, void *vertex_declaration);
|
||||
|
||||
bool d3d_texture_get_level_desc(LPDIRECT3DTEXTURE tex,
|
||||
unsigned idx, void *_ppsurface_level);
|
||||
|
||||
bool d3d_texture_get_surface_level(LPDIRECT3DTEXTURE tex,
|
||||
unsigned idx, void **_ppsurface_level);
|
||||
|
||||
LPDIRECT3DTEXTURE d3d_texture_new(LPDIRECT3DDEVICE dev,
|
||||
const char *path, unsigned width, unsigned height,
|
||||
unsigned miplevels, unsigned usage, D3DFORMAT format,
|
||||
@ -63,6 +69,10 @@ void d3d_set_sampler_minfilter(LPDIRECT3DDEVICE dev,
|
||||
void d3d_set_sampler_magfilter(LPDIRECT3DDEVICE dev,
|
||||
unsigned sampler, unsigned value);
|
||||
|
||||
bool d3d_begin_scene(LPDIRECT3DDEVICE dev);
|
||||
|
||||
void d3d_end_scene(LPDIRECT3DDEVICE dev);
|
||||
|
||||
void d3d_draw_primitive(LPDIRECT3DDEVICE dev,
|
||||
D3DPRIMITIVETYPE type, unsigned start, unsigned count);
|
||||
|
||||
@ -94,6 +104,8 @@ void d3d_texture_blit(unsigned pixel_size,
|
||||
bool d3d_vertex_declaration_new(LPDIRECT3DDEVICE dev,
|
||||
const void *vertex_data, void **decl_data);
|
||||
|
||||
void d3d_vertex_declaration_free(void *data);
|
||||
|
||||
void d3d_set_viewports(LPDIRECT3DDEVICE dev, D3DVIEWPORT *vp);
|
||||
|
||||
void d3d_enable_blend_func(void *data);
|
||||
@ -106,8 +118,53 @@ void d3d_enable_alpha_blend_texture_func(void *data);
|
||||
|
||||
void d3d_frame_postprocess(void *data);
|
||||
|
||||
void d3d_surface_free(void *data);
|
||||
|
||||
bool d3d_device_get_render_target_data(LPDIRECT3DDEVICE dev,
|
||||
void *_src, void *_dst);
|
||||
|
||||
bool d3d_device_get_render_target(LPDIRECT3DDEVICE dev,
|
||||
unsigned idx, void **data);
|
||||
|
||||
void d3d_device_set_render_target(LPDIRECT3DDEVICE dev, unsigned idx,
|
||||
void *data);
|
||||
|
||||
void d3d_set_render_state(void *data, D3DRENDERSTATETYPE state, DWORD value);
|
||||
|
||||
void d3d_device_set_render_target(LPDIRECT3DDEVICE dev, unsigned idx,
|
||||
void *data);
|
||||
|
||||
bool d3d_device_create_offscreen_plain_surface(
|
||||
LPDIRECT3DDEVICE dev,
|
||||
unsigned width,
|
||||
unsigned height,
|
||||
unsigned format,
|
||||
unsigned pool,
|
||||
void **surf_data,
|
||||
void *data);
|
||||
|
||||
bool d3d_surface_lock_rect(void *data, void *data2);
|
||||
|
||||
void d3d_surface_unlock_rect(void *data);
|
||||
|
||||
void *d3d_matrix_transpose(void *_pout, const void *_pm);
|
||||
|
||||
void *d3d_matrix_multiply(void *_pout,
|
||||
const void *_pm1, const void *_pm2);
|
||||
|
||||
void *d3d_matrix_ortho_off_center_lh(void *_pout,
|
||||
float l, float r, float b, float t, float zn, float zf);
|
||||
|
||||
void * d3d_matrix_identity(void *_pout);
|
||||
|
||||
void *d3d_matrix_rotation_z(void *_pout, float angle);
|
||||
|
||||
bool d3d_create_device(LPDIRECT3DDEVICE *dev,
|
||||
D3DPRESENT_PARAMETERS *d3dpp,
|
||||
LPDIRECT3D d3d,
|
||||
HWND focus_window,
|
||||
unsigned cur_mon_id);
|
||||
|
||||
bool d3d_reset(LPDIRECT3DDEVICE dev, D3DPRESENT_PARAMETERS *d3dpp);
|
||||
|
||||
void d3d_device_free(LPDIRECT3DDEVICE dev, LPDIRECT3D pd3d);
|
||||
|
@ -1308,11 +1308,15 @@ end:
|
||||
return ret;
|
||||
}
|
||||
|
||||
static bool vulkan_find_device_extensions(VkPhysicalDevice gpu, const char **exts, unsigned num_exts)
|
||||
static bool vulkan_find_device_extensions(VkPhysicalDevice gpu,
|
||||
const char **enabled, unsigned *enabled_count,
|
||||
const char **exts, unsigned num_exts,
|
||||
const char **optional_exts, unsigned num_optional_exts)
|
||||
{
|
||||
bool ret = true;
|
||||
VkExtensionProperties *properties = NULL;
|
||||
uint32_t property_count;
|
||||
unsigned i;
|
||||
|
||||
if (vkEnumerateDeviceExtensionProperties(gpu, NULL, &property_count, NULL) != VK_SUCCESS)
|
||||
return false;
|
||||
@ -1332,11 +1336,18 @@ static bool vulkan_find_device_extensions(VkPhysicalDevice gpu, const char **ext
|
||||
|
||||
if (!vulkan_find_extensions(exts, num_exts, properties, property_count))
|
||||
{
|
||||
RARCH_ERR("[Vulkan]: Could not find device extensions. Will attempt without them.\n");
|
||||
RARCH_ERR("[Vulkan]: Could not find device extension. Will attempt without it.\n");
|
||||
ret = false;
|
||||
goto end;
|
||||
}
|
||||
|
||||
memcpy(enabled, exts, num_exts * sizeof(*exts));
|
||||
*enabled_count = num_exts;
|
||||
|
||||
for (i = 0; i < num_optional_exts; i++)
|
||||
if (vulkan_find_extensions(&optional_exts[i], 1, properties, property_count))
|
||||
enabled[(*enabled_count)++] = optional_exts[i];
|
||||
|
||||
end:
|
||||
free(properties);
|
||||
return ret;
|
||||
@ -1396,10 +1407,17 @@ static bool vulkan_context_init_device(gfx_ctx_vulkan_data_t *vk)
|
||||
VkDeviceQueueCreateInfo queue_info = { VK_STRUCTURE_TYPE_DEVICE_QUEUE_CREATE_INFO };
|
||||
VkDeviceCreateInfo device_info = { VK_STRUCTURE_TYPE_DEVICE_CREATE_INFO };
|
||||
|
||||
const char *enabled_device_extensions[8];
|
||||
unsigned enabled_device_extension_count = 0;
|
||||
|
||||
static const char *device_extensions[] = {
|
||||
"VK_KHR_swapchain",
|
||||
};
|
||||
|
||||
static const char *optional_device_extensions[] = {
|
||||
"VK_KHR_sampler_mirror_clamp_to_edge",
|
||||
};
|
||||
|
||||
#ifdef VULKAN_DEBUG
|
||||
static const char *device_layers[] = { "VK_LAYER_LUNARG_standard_validation" };
|
||||
#endif
|
||||
@ -1523,7 +1541,15 @@ static bool vulkan_context_init_device(gfx_ctx_vulkan_data_t *vk)
|
||||
}
|
||||
|
||||
use_device_ext = vulkan_find_device_extensions(vk->context.gpu,
|
||||
device_extensions, ARRAY_SIZE(device_extensions));
|
||||
enabled_device_extensions, &enabled_device_extension_count,
|
||||
device_extensions, ARRAY_SIZE(device_extensions),
|
||||
optional_device_extensions, ARRAY_SIZE(optional_device_extensions));
|
||||
|
||||
if (!use_device_ext)
|
||||
{
|
||||
RARCH_ERR("[Vulkan]: Could not find required device extensions.\n");
|
||||
return false;
|
||||
}
|
||||
|
||||
queue_info.queueFamilyIndex = vk->context.graphics_queue_index;
|
||||
queue_info.queueCount = 1;
|
||||
@ -1531,8 +1557,8 @@ static bool vulkan_context_init_device(gfx_ctx_vulkan_data_t *vk)
|
||||
|
||||
device_info.queueCreateInfoCount = 1;
|
||||
device_info.pQueueCreateInfos = &queue_info;
|
||||
device_info.enabledExtensionCount = use_device_ext ? ARRAY_SIZE(device_extensions) : 0;
|
||||
device_info.ppEnabledExtensionNames = use_device_ext ? device_extensions : NULL;
|
||||
device_info.enabledExtensionCount = enabled_device_extension_count;
|
||||
device_info.ppEnabledExtensionNames = enabled_device_extension_count ? enabled_device_extensions : NULL;
|
||||
device_info.pEnabledFeatures = &features;
|
||||
#ifdef VULKAN_DEBUG
|
||||
device_info.enabledLayerCount = ARRAY_SIZE(device_layers);
|
||||
|
@ -94,7 +94,7 @@ static bool d3d_init_imports(d3d_video_t *d3d)
|
||||
{
|
||||
retro_ctx_memory_info_t mem_info;
|
||||
state_tracker_t *state_tracker = NULL;
|
||||
state_tracker_info tracker_info = {0};
|
||||
struct state_tracker_info tracker_info = {0};
|
||||
|
||||
if (!d3d->shader.variables)
|
||||
return true;
|
||||
@ -136,8 +136,8 @@ static bool d3d_init_imports(d3d_video_t *d3d)
|
||||
static bool d3d_init_chain(d3d_video_t *d3d, const video_info_t *video_info)
|
||||
{
|
||||
unsigned current_width, current_height, out_width, out_height;
|
||||
unsigned i = 0;
|
||||
LinkInfo link_info = {0};
|
||||
unsigned i = 0;
|
||||
struct LinkInfo link_info = {0};
|
||||
|
||||
(void)i;
|
||||
(void)current_width;
|
||||
@ -222,7 +222,7 @@ static bool d3d_init_chain(d3d_video_t *d3d, const video_info_t *video_info)
|
||||
static bool d3d_init_singlepass(d3d_video_t *d3d)
|
||||
{
|
||||
#ifndef _XBOX
|
||||
video_shader_pass *pass = NULL;
|
||||
struct video_shader_pass *pass = NULL;
|
||||
|
||||
if (!d3d)
|
||||
return false;
|
||||
@ -230,7 +230,7 @@ static bool d3d_init_singlepass(d3d_video_t *d3d)
|
||||
memset(&d3d->shader, 0, sizeof(d3d->shader));
|
||||
d3d->shader.passes = 1;
|
||||
|
||||
pass = (video_shader_pass*)
|
||||
pass = (struct video_shader_pass*)
|
||||
&d3d->shader.pass[0];
|
||||
|
||||
pass->fbo.valid = true;
|
||||
@ -238,8 +238,10 @@ static bool d3d_init_singlepass(d3d_video_t *d3d)
|
||||
pass->fbo.type_y = RARCH_SCALE_VIEWPORT;
|
||||
pass->fbo.scale_x = pass->fbo.scale_y;
|
||||
pass->fbo.type_x = pass->fbo.type_y;
|
||||
strlcpy(pass->source.path, d3d->shader_path.c_str(),
|
||||
sizeof(pass->source.path));
|
||||
|
||||
if (!string_is_empty(d3d->shader_path))
|
||||
strlcpy(pass->source.path, d3d->shader_path,
|
||||
sizeof(pass->source.path));
|
||||
#endif
|
||||
|
||||
return true;
|
||||
@ -250,8 +252,8 @@ static bool d3d_init_multipass(d3d_video_t *d3d)
|
||||
{
|
||||
unsigned i;
|
||||
bool use_extra_pass = false;
|
||||
video_shader_pass *pass = NULL;
|
||||
config_file_t *conf = config_file_new(d3d->shader_path.c_str());
|
||||
struct video_shader_pass *pass = NULL;
|
||||
config_file_t *conf = !string_is_empty(d3d->shader_path) ? config_file_new(d3d->shader_path) : NULL;
|
||||
|
||||
if (!conf)
|
||||
{
|
||||
@ -270,7 +272,8 @@ static bool d3d_init_multipass(d3d_video_t *d3d)
|
||||
#endif
|
||||
config_file_free(conf);
|
||||
#ifdef HAVE_SHADERPIPELINE
|
||||
video_shader_resolve_relative(&d3d->shader, d3d->shader_path.c_str());
|
||||
if (!string_is_empty(d3d->shader_path))
|
||||
video_shader_resolve_relative(&d3d->shader, d3d->shader_path);
|
||||
#endif
|
||||
RARCH_LOG("[D3D]: Found %u shaders.\n", d3d->shader.passes);
|
||||
|
||||
@ -291,7 +294,7 @@ static bool d3d_init_multipass(d3d_video_t *d3d)
|
||||
if (use_extra_pass)
|
||||
{
|
||||
d3d->shader.passes++;
|
||||
pass = (video_shader_pass*)
|
||||
pass = (struct video_shader_pass*)
|
||||
&d3d->shader.pass[d3d->shader.passes - 1];
|
||||
|
||||
pass->fbo.scale_x = pass->fbo.scale_y = 1.0f;
|
||||
@ -300,7 +303,7 @@ static bool d3d_init_multipass(d3d_video_t *d3d)
|
||||
}
|
||||
else
|
||||
{
|
||||
pass = (video_shader_pass*)
|
||||
pass = (struct video_shader_pass*)
|
||||
&d3d->shader.pass[d3d->shader.passes - 1];
|
||||
|
||||
pass->fbo.scale_x = pass->fbo.scale_y = 1.0f;
|
||||
@ -314,7 +317,8 @@ static bool d3d_init_multipass(d3d_video_t *d3d)
|
||||
static bool d3d_process_shader(d3d_video_t *d3d)
|
||||
{
|
||||
#ifdef HAVE_FBO
|
||||
if (string_is_equal_fast(path_get_extension(d3d->shader_path.c_str()), "cgp", 3))
|
||||
if (d3d && !string_is_empty(d3d->shader_path) &&
|
||||
string_is_equal_fast(path_get_extension(d3d->shader_path), "cgp", 3))
|
||||
return d3d_init_multipass(d3d);
|
||||
#endif
|
||||
|
||||
@ -418,9 +422,9 @@ static void d3d_overlay_render(d3d_video_t *d3d, video_frame_info_t *video_info,
|
||||
D3DDECLUSAGE_COLOR, 0},
|
||||
D3DDECL_END()
|
||||
};
|
||||
d3d->dev->CreateVertexDeclaration(vElems, &vertex_decl);
|
||||
d3d_vertex_declaration_new(d3d->dev, &vElems, (void**)&vertex_decl);
|
||||
d3d_set_vertex_declaration(d3d->dev, vertex_decl);
|
||||
vertex_decl->Release();
|
||||
d3d_vertex_declaration_free(vertex_decl);
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -601,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)
|
||||
@ -617,7 +623,8 @@ void d3d_make_d3dpp(void *data,
|
||||
static bool d3d_init_base(void *data, const video_info_t *info)
|
||||
{
|
||||
D3DPRESENT_PARAMETERS d3dpp;
|
||||
d3d_video_t *d3d = (d3d_video_t*)data;
|
||||
HWND focus_window = NULL;
|
||||
d3d_video_t *d3d = (d3d_video_t*)data;
|
||||
|
||||
d3d_make_d3dpp(d3d, info, &d3dpp);
|
||||
|
||||
@ -631,49 +638,18 @@ static bool d3d_init_base(void *data, const video_info_t *info)
|
||||
#ifdef _XBOX360
|
||||
d3d->cur_mon_id = 0;
|
||||
#endif
|
||||
|
||||
#ifdef _XBOX
|
||||
if (FAILED(d3d->d3d_err = g_pD3D->CreateDevice(
|
||||
d3d->cur_mon_id,
|
||||
D3DDEVTYPE_HAL,
|
||||
NULL,
|
||||
D3DCREATE_HARDWARE_VERTEXPROCESSING,
|
||||
&d3dpp,
|
||||
&d3d->dev)))
|
||||
#else
|
||||
if (FAILED(d3d->d3d_err = g_pD3D->CreateDevice(
|
||||
d3d->cur_mon_id,
|
||||
D3DDEVTYPE_HAL,
|
||||
win32_get_window(),
|
||||
D3DCREATE_HARDWARE_VERTEXPROCESSING,
|
||||
&d3dpp,
|
||||
&d3d->dev)))
|
||||
#ifndef _XBOX
|
||||
focus_window = win32_get_window();
|
||||
#endif
|
||||
|
||||
if (!d3d_create_device(&d3d->dev, &d3dpp,
|
||||
g_pD3D,
|
||||
focus_window,
|
||||
d3d->cur_mon_id)
|
||||
)
|
||||
{
|
||||
RARCH_WARN("[D3D]: Failed to init device with hardware vertex processing (code: 0x%x). Trying to fall back to software vertex processing.\n",
|
||||
(unsigned)d3d->d3d_err);
|
||||
|
||||
#ifdef _XBOX
|
||||
if (FAILED(d3d->d3d_err = g_pD3D->CreateDevice(
|
||||
d3d->cur_mon_id,
|
||||
D3DDEVTYPE_HAL,
|
||||
NULL,
|
||||
D3DCREATE_SOFTWARE_VERTEXPROCESSING,
|
||||
&d3dpp,
|
||||
&d3d->dev)))
|
||||
#else
|
||||
if (FAILED(d3d->d3d_err = g_pD3D->CreateDevice(
|
||||
d3d->cur_mon_id,
|
||||
D3DDEVTYPE_HAL,
|
||||
win32_get_window(),
|
||||
D3DCREATE_SOFTWARE_VERTEXPROCESSING,
|
||||
&d3dpp,
|
||||
&d3d->dev)))
|
||||
#endif
|
||||
{
|
||||
RARCH_ERR("[D3D]: Failed to initialize device.\n");
|
||||
return false;
|
||||
}
|
||||
RARCH_ERR("[D3D]: Failed to initialize device.\n");
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
@ -751,15 +727,15 @@ static void d3d_calculate_rect(void *data,
|
||||
}
|
||||
else if (device_aspect > desired_aspect)
|
||||
{
|
||||
delta = (desired_aspect / device_aspect - 1.0f) / 2.0f + 0.5f;
|
||||
*x = int(roundf(*width * (0.5f - delta)));
|
||||
*width = unsigned(roundf(2.0f * (*width) * delta));
|
||||
delta = (desired_aspect / device_aspect - 1.0f) / 2.0f + 0.5f;
|
||||
*x = (int)(roundf(*width * (0.5f - delta)));
|
||||
*width = (unsigned)(roundf(2.0f * (*width) * delta));
|
||||
}
|
||||
else
|
||||
{
|
||||
delta = (device_aspect / desired_aspect - 1.0f) / 2.0f + 0.5f;
|
||||
*y = int(roundf(*height * (0.5f - delta)));
|
||||
*height = unsigned(roundf(2.0f * (*height) * delta));
|
||||
delta = (device_aspect / desired_aspect - 1.0f) / 2.0f + 0.5f;
|
||||
*y = (int)(roundf(*height * (0.5f - delta)));
|
||||
*height = (unsigned)(roundf(2.0f * (*height) * delta));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -992,7 +968,23 @@ static bool d3d_construct(d3d_video_t *d3d,
|
||||
void **input_data)
|
||||
{
|
||||
gfx_ctx_input_t inp;
|
||||
unsigned full_x, full_y;
|
||||
#ifdef HAVE_MONITOR
|
||||
bool windowed_full;
|
||||
RECT mon_rect;
|
||||
MONITORINFOEX current_mon;
|
||||
HMONITOR hm_to_use;
|
||||
#endif
|
||||
#ifdef HAVE_SHADERS
|
||||
enum rarch_shader_type type;
|
||||
#endif
|
||||
#ifdef HAVE_WINDOW
|
||||
DWORD style;
|
||||
unsigned win_width = 0;
|
||||
unsigned win_height = 0;
|
||||
RECT rect = {0};
|
||||
#endif
|
||||
unsigned full_x = 0;
|
||||
unsigned full_y = 0;
|
||||
settings_t *settings = config_get_ptr();
|
||||
|
||||
d3d->should_resize = false;
|
||||
@ -1021,11 +1013,6 @@ static bool d3d_construct(d3d_video_t *d3d,
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_MONITOR
|
||||
bool windowed_full;
|
||||
RECT mon_rect;
|
||||
MONITORINFOEX current_mon;
|
||||
HMONITOR hm_to_use;
|
||||
|
||||
win32_monitor_info(¤t_mon, &hm_to_use, &d3d->cur_mon_id);
|
||||
mon_rect = current_mon.rcMonitor;
|
||||
g_resize_width = info->width;
|
||||
@ -1057,10 +1044,6 @@ static bool d3d_construct(d3d_video_t *d3d,
|
||||
}
|
||||
|
||||
#ifdef HAVE_WINDOW
|
||||
DWORD style;
|
||||
unsigned win_width, win_height;
|
||||
RECT rect = {0};
|
||||
|
||||
video_driver_get_size(&win_width, &win_height);
|
||||
|
||||
win32_set_style(¤t_mon, &hm_to_use, &win_width, &win_height,
|
||||
@ -1077,10 +1060,14 @@ static bool d3d_construct(d3d_video_t *d3d,
|
||||
/* This should only be done once here
|
||||
* to avoid set_shader() to be overridden
|
||||
* later. */
|
||||
enum rarch_shader_type type =
|
||||
type =
|
||||
video_shader_parse_type(settings->paths.path_shader, RARCH_SHADER_NONE);
|
||||
if (settings->bools.video_shader_enable && type == RARCH_SHADER_CG)
|
||||
d3d->shader_path = settings->paths.path_shader;
|
||||
{
|
||||
if (!string_is_empty(d3d->shader_path))
|
||||
free(d3d->shader_path);
|
||||
d3d->shader_path = strdup(settings->paths.path_shader);
|
||||
}
|
||||
|
||||
if (!d3d_process_shader(d3d))
|
||||
return false;
|
||||
@ -1159,7 +1146,7 @@ static void *d3d_init(const video_info_t *info,
|
||||
}
|
||||
#endif
|
||||
|
||||
d3d = new d3d_video_t();
|
||||
d3d = (d3d_video_t*)calloc(1, sizeof(*d3d));
|
||||
if (!d3d)
|
||||
goto error;
|
||||
|
||||
@ -1200,7 +1187,7 @@ static void *d3d_init(const video_info_t *info,
|
||||
error:
|
||||
video_context_driver_destroy();
|
||||
if (d3d)
|
||||
delete d3d;
|
||||
free(d3d);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@ -1212,9 +1199,11 @@ static void d3d_free_overlays(d3d_video_t *d3d)
|
||||
if (!d3d)
|
||||
return;
|
||||
|
||||
for (i = 0; i < d3d->overlays.size(); i++)
|
||||
for (i = 0; i < d3d->overlays_size; i++)
|
||||
d3d_free_overlay(d3d, &d3d->overlays[i]);
|
||||
d3d->overlays.clear();
|
||||
free(d3d->overlays);
|
||||
d3d->overlays = NULL;
|
||||
d3d->overlays_size = 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -1225,32 +1214,39 @@ static void d3d_free(void *data)
|
||||
if (!d3d)
|
||||
return;
|
||||
|
||||
d3d_deinitialize(d3d);
|
||||
#ifdef HAVE_OVERLAY
|
||||
d3d_free_overlays(d3d);
|
||||
if (d3d->overlays)
|
||||
free(d3d->overlays);
|
||||
d3d->overlays = NULL;
|
||||
d3d->overlays_size = 0;
|
||||
#endif
|
||||
|
||||
video_context_driver_free();
|
||||
|
||||
#ifndef _XBOX
|
||||
#ifdef HAVE_MENU
|
||||
d3d_free_overlay(d3d, d3d->menu);
|
||||
if (d3d->menu)
|
||||
free(d3d->menu);
|
||||
d3d->menu = NULL;
|
||||
#endif
|
||||
d3d->menu = NULL;
|
||||
#endif
|
||||
|
||||
d3d_deinitialize(d3d);
|
||||
|
||||
video_context_driver_free();
|
||||
|
||||
if (!string_is_empty(d3d->shader_path))
|
||||
free(d3d->shader_path);
|
||||
|
||||
d3d->shader_path = NULL;
|
||||
d3d_device_free(d3d->dev, g_pD3D);
|
||||
d3d->dev = NULL;
|
||||
g_pD3D = NULL;
|
||||
d3d->dev = NULL;
|
||||
g_pD3D = NULL;
|
||||
|
||||
#ifndef _XBOX
|
||||
win32_monitor_from_window();
|
||||
#endif
|
||||
|
||||
if (d3d)
|
||||
delete d3d;
|
||||
free(d3d);
|
||||
|
||||
#ifndef _XBOX
|
||||
win32_destroy_window();
|
||||
@ -1296,7 +1292,8 @@ static bool d3d_overlay_load(void *data,
|
||||
const void *image_data, unsigned num_images)
|
||||
{
|
||||
unsigned i, y;
|
||||
d3d_video_t *d3d = (d3d_video_t*)data;
|
||||
overlay_t *new_overlays = NULL;
|
||||
d3d_video_t *d3d = (d3d_video_t*)data;
|
||||
const struct texture_image *images = (const struct texture_image*)
|
||||
image_data;
|
||||
|
||||
@ -1304,7 +1301,8 @@ static bool d3d_overlay_load(void *data,
|
||||
return false;
|
||||
|
||||
d3d_free_overlays(d3d);
|
||||
d3d->overlays.resize(num_images);
|
||||
d3d->overlays = (overlay_t*)calloc(num_images, sizeof(*d3d->overlays));
|
||||
d3d->overlays_size = num_images;
|
||||
|
||||
for (i = 0; i < num_images; i++)
|
||||
{
|
||||
@ -1357,7 +1355,7 @@ static void d3d_overlay_enable(void *data, bool state)
|
||||
if (!d3d)
|
||||
return;
|
||||
|
||||
for (i = 0; i < d3d->overlays.size(); i++)
|
||||
for (i = 0; i < d3d->overlays_size; i++)
|
||||
d3d->overlays_enabled = state;
|
||||
|
||||
video_context_driver_show_mouse(&state);
|
||||
@ -1368,7 +1366,7 @@ static void d3d_overlay_full_screen(void *data, bool enable)
|
||||
unsigned i;
|
||||
d3d_video_t *d3d = (d3d_video_t*)data;
|
||||
|
||||
for (i = 0; i < d3d->overlays.size(); i++)
|
||||
for (i = 0; i < d3d->overlays_size; i++)
|
||||
d3d->overlays[i].fullscreen = enable;
|
||||
}
|
||||
|
||||
@ -1401,6 +1399,7 @@ static bool d3d_frame(void *data, const void *frame,
|
||||
uint64_t frame_count, unsigned pitch,
|
||||
const char *msg, video_frame_info_t *video_info)
|
||||
{
|
||||
D3DVIEWPORT screen_vp;
|
||||
unsigned i = 0;
|
||||
d3d_video_t *d3d = (d3d_video_t*)data;
|
||||
#ifndef _XBOX
|
||||
@ -1441,7 +1440,6 @@ static bool d3d_frame(void *data, const void *frame,
|
||||
|
||||
/* render_chain() only clears out viewport,
|
||||
* clear out everything. */
|
||||
D3DVIEWPORT screen_vp;
|
||||
screen_vp.X = 0;
|
||||
screen_vp.Y = 0;
|
||||
screen_vp.MinZ = 0;
|
||||
@ -1486,7 +1484,7 @@ static bool d3d_frame(void *data, const void *frame,
|
||||
#ifdef HAVE_OVERLAY
|
||||
if (d3d->overlays_enabled)
|
||||
{
|
||||
for (i = 0; i < d3d->overlays.size(); i++)
|
||||
for (i = 0; i < d3d->overlays_size; i++)
|
||||
d3d_overlay_render(d3d, video_info, &d3d->overlays[i]);
|
||||
}
|
||||
#endif
|
||||
@ -1516,28 +1514,33 @@ static bool d3d_set_shader(void *data,
|
||||
enum rarch_shader_type type, const char *path)
|
||||
{
|
||||
d3d_video_t *d3d = (d3d_video_t*)data;
|
||||
std::string old_shader = d3d ? d3d->shader_path : "";
|
||||
std::string shader = "";
|
||||
char *old_shader = (d3d && !string_is_empty(d3d->shader_path)) ? strdup(d3d->shader_path) : NULL;
|
||||
|
||||
if (!string_is_empty(d3d->shader_path))
|
||||
free(d3d->shader_path);
|
||||
d3d->shader_path = NULL;
|
||||
|
||||
switch (type)
|
||||
{
|
||||
case RARCH_SHADER_CG:
|
||||
case RARCH_SHADER_HLSL:
|
||||
if (path)
|
||||
shader = path;
|
||||
if (!string_is_empty(path))
|
||||
d3d->shader_path = strdup(path);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
d3d->shader_path = shader;
|
||||
|
||||
if (!d3d_process_shader(d3d) || !d3d_restore(d3d))
|
||||
{
|
||||
RARCH_ERR("[D3D]: Setting shader failed.\n");
|
||||
d3d->shader_path = old_shader;
|
||||
d3d_process_shader(d3d);
|
||||
d3d_restore(d3d);
|
||||
if (!string_is_empty(old_shader))
|
||||
{
|
||||
d3d->shader_path = strdup(old_shader);
|
||||
d3d_process_shader(d3d);
|
||||
d3d_restore(d3d);
|
||||
}
|
||||
free(old_shader);
|
||||
return false;
|
||||
}
|
||||
|
@ -17,9 +17,6 @@
|
||||
#ifndef __D3DVIDEO_INTF_H__
|
||||
#define __D3DVIDEO_INTF_H__
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "../../config.h"
|
||||
#endif
|
||||
@ -80,8 +77,6 @@ typedef struct d3d_video
|
||||
unsigned cur_mon_id;
|
||||
unsigned dev_rotation;
|
||||
|
||||
HRESULT d3d_err;
|
||||
|
||||
#if defined(HAVE_MENU)
|
||||
overlay_t *menu;
|
||||
#endif
|
||||
@ -98,10 +93,11 @@ typedef struct d3d_video
|
||||
LPDIRECT3DDEVICE dev;
|
||||
D3DVIEWPORT final_viewport;
|
||||
|
||||
std::string shader_path;
|
||||
char *shader_path;
|
||||
|
||||
#ifdef HAVE_OVERLAY
|
||||
std::vector<overlay_t> overlays;
|
||||
size_t overlays_size;
|
||||
overlay_t *overlays;
|
||||
#endif
|
||||
} d3d_video_t;
|
||||
|
||||
|
@ -34,6 +34,7 @@
|
||||
#include <formats/image.h>
|
||||
#include <retro_inline.h>
|
||||
#include <retro_miscellaneous.h>
|
||||
#include <retro_math.h>
|
||||
#include <string/stdstring.h>
|
||||
#include <libretro.h>
|
||||
|
||||
|
@ -118,23 +118,32 @@ static struct
|
||||
} menu_tex ATTRIBUTE_ALIGN(32);
|
||||
|
||||
static OSCond g_video_cond;
|
||||
static unsigned g_current_framebuf;
|
||||
static volatile bool g_draw_done = false;
|
||||
static bool g_vsync = false;
|
||||
static uint32_t g_orientation = 0;
|
||||
|
||||
static uint32_t retraceCount;
|
||||
static uint32_t referenceRetraceCount;
|
||||
static volatile bool g_draw_done = false;
|
||||
static bool g_vsync = false;
|
||||
|
||||
static uint8_t gx_fifo[256 * 1024] ATTRIBUTE_ALIGN(32);
|
||||
static uint8_t display_list[1024] ATTRIBUTE_ALIGN(32);
|
||||
static size_t display_list_size;
|
||||
uint16_t gx_xOrigin, gx_yOrigin;
|
||||
int8_t gx_system_xOrigin, gx_used_system_xOrigin;
|
||||
int8_t gx_xOriginNeg, gx_xOriginPos;
|
||||
int8_t gx_yOriginNeg, gx_yOriginPos;
|
||||
|
||||
static uint8_t gx_fifo[256 * 1024] ATTRIBUTE_ALIGN(32);
|
||||
static uint8_t display_list[1024] ATTRIBUTE_ALIGN(32);
|
||||
|
||||
static uint16_t gx_xOrigin = 0;
|
||||
static uint16_t gx_yOrigin = 0;
|
||||
|
||||
static unsigned g_current_framebuf = 0;
|
||||
static uint32_t g_orientation = 0;
|
||||
|
||||
static uint32_t retraceCount = 0;
|
||||
static uint32_t referenceRetraceCount = 0;
|
||||
|
||||
static unsigned gx_old_width = 0;
|
||||
static unsigned gx_old_height = 0;
|
||||
|
||||
static size_t display_list_size;
|
||||
|
||||
GXRModeObj gx_mode;
|
||||
unsigned gx_old_width, gx_old_height;
|
||||
|
||||
float verts[16] ATTRIBUTE_ALIGN(32) = {
|
||||
-1, 1, -0.5,
|
||||
@ -247,7 +256,7 @@ unsigned menu_gx_resolutions[][2] = {
|
||||
|
||||
static void retrace_callback(u32 retrace_count)
|
||||
{
|
||||
u32 level = 0;
|
||||
uint32_t level = 0;
|
||||
|
||||
(void)retrace_count;
|
||||
|
||||
@ -276,14 +285,19 @@ static bool gx_isValidYOrigin(int origin)
|
||||
static void gx_set_video_mode(void *data, unsigned fbWidth, unsigned lines,
|
||||
bool fullscreen)
|
||||
{
|
||||
f32 y_scale;
|
||||
int tmpOrigin;
|
||||
float refresh_rate;
|
||||
u16 xfbWidth, xfbHeight;
|
||||
bool progressive;
|
||||
unsigned modetype, viHeightMultiplier, viWidth, tvmode,
|
||||
max_width, i;
|
||||
gx_video_t *gx = (gx_video_t*)data;
|
||||
settings_t *settings = config_get_ptr();
|
||||
size_t new_fb_pitch = 0;
|
||||
unsigned new_fb_width = 0;
|
||||
unsigned new_fb_height = 0;
|
||||
float y_scale = 0.0f;
|
||||
uint16_t xfbWidth = 0;
|
||||
uint16_t xfbHeight = 0;
|
||||
gx_video_t *gx = (gx_video_t*)data;
|
||||
settings_t *settings = config_get_ptr();
|
||||
|
||||
/* stop vsync callback */
|
||||
VIDEO_SetPostRetraceCallback(NULL);
|
||||
@ -391,7 +405,8 @@ static void gx_set_video_mode(void *data, unsigned fbWidth, unsigned lines,
|
||||
while(viWidth + gx_used_system_xOrigin > 720) gx_used_system_xOrigin++;
|
||||
}
|
||||
|
||||
int tmpOrigin = (max_width - gx_mode.viWidth) / 2;
|
||||
tmpOrigin = (max_width - gx_mode.viWidth) / 2;
|
||||
|
||||
if(gx_system_xOrigin > 0)
|
||||
{
|
||||
while(!gx_isValidXOrigin(tmpOrigin)) tmpOrigin--;
|
||||
@ -446,10 +461,7 @@ static void gx_set_video_mode(void *data, unsigned fbWidth, unsigned lines,
|
||||
gx->should_resize = true;
|
||||
|
||||
/* calculate menu dimensions */
|
||||
size_t new_fb_pitch;
|
||||
unsigned new_fb_width;
|
||||
unsigned new_fb_height = (gx_mode.efbHeight /
|
||||
(gx->double_strike ? 1 : 2)) & ~3;
|
||||
new_fb_height = (gx_mode.efbHeight / (gx->double_strike ? 1 : 2)) & ~3;
|
||||
|
||||
if (new_fb_height > 240)
|
||||
new_fb_height = 240;
|
||||
@ -466,10 +478,10 @@ static void gx_set_video_mode(void *data, unsigned fbWidth, unsigned lines,
|
||||
GX_SetViewportJitter(0, 0, gx_mode.fbWidth, gx_mode.efbHeight, 0, 1, 1);
|
||||
GX_SetDispCopySrc(0, 0, gx_mode.fbWidth, gx_mode.efbHeight);
|
||||
|
||||
y_scale = GX_GetYScaleFactor(gx_mode.efbHeight, gx_mode.xfbHeight);
|
||||
xfbWidth = VIDEO_PadFramebufferWidth(gx_mode.fbWidth);
|
||||
xfbHeight = GX_SetDispCopyYScale(y_scale);
|
||||
GX_SetDispCopyDst(xfbWidth, xfbHeight);
|
||||
y_scale = GX_GetYScaleFactor(gx_mode.efbHeight, gx_mode.xfbHeight);
|
||||
xfbWidth = VIDEO_PadFramebufferWidth(gx_mode.fbWidth);
|
||||
xfbHeight = GX_SetDispCopyYScale((f32)y_scale);
|
||||
GX_SetDispCopyDst((u16)xfbWidth, (u16)xfbHeight);
|
||||
|
||||
GX_SetCopyFilter(gx_mode.aa, gx_mode.sample_pattern,
|
||||
(gx_mode.xfbMode == VI_XFBMODE_SF)
|
||||
@ -585,17 +597,16 @@ static void setup_video_mode(gx_video_t *gx)
|
||||
|
||||
static void init_texture(void *data, unsigned width, unsigned height)
|
||||
{
|
||||
unsigned g_filter;
|
||||
size_t fb_pitch;
|
||||
unsigned fb_width, fb_height;
|
||||
gx_video_t *gx = (gx_video_t*)data;
|
||||
GXTexObj *fb_ptr = (GXTexObj*)&g_tex.obj;
|
||||
GXTexObj *menu_ptr = (GXTexObj*)&menu_tex.obj;
|
||||
settings_t *settings = config_get_ptr();
|
||||
unsigned g_filter = settings->bools.video_smooth ? GX_LINEAR : GX_NEAR;
|
||||
|
||||
width &= ~3;
|
||||
height &= ~3;
|
||||
g_filter = settings->bools.video_smooth ? GX_LINEAR : GX_NEAR;
|
||||
|
||||
menu_display_get_fb_size(&fb_width, &fb_height,
|
||||
&fb_pitch);
|
||||
@ -614,8 +625,8 @@ static void init_texture(void *data, unsigned width, unsigned height)
|
||||
static void init_vtx(void *data, const video_info_t *video)
|
||||
{
|
||||
Mtx44 m;
|
||||
gx_video_t *gx = (gx_video_t*)data;
|
||||
u32 level = 0;
|
||||
gx_video_t *gx = (gx_video_t*)data;
|
||||
uint32_t level = 0;
|
||||
_CPU_ISR_Disable(level);
|
||||
referenceRetraceCount = retraceCount;
|
||||
_CPU_ISR_Restore(level);
|
||||
@ -898,6 +909,7 @@ static void convert_texture32(const uint32_t *_src, uint32_t *_dst,
|
||||
|
||||
static void gx_resize(void *data)
|
||||
{
|
||||
int gamma;
|
||||
unsigned degrees;
|
||||
unsigned width, height;
|
||||
Mtx44 m1, m2;
|
||||
@ -915,11 +927,11 @@ static void gx_resize(void *data)
|
||||
|
||||
#ifdef HW_RVL
|
||||
VIDEO_SetTrapFilter(global->console.softfilter_enable);
|
||||
int gamma = global->console.screen.gamma_correction;
|
||||
gamma = global->console.screen.gamma_correction;
|
||||
if(gamma == 0) gamma = 10; //default 1.0 gamma value
|
||||
VIDEO_SetGamma(gamma);
|
||||
#else
|
||||
int gamma = global->console.screen.gamma_correction;
|
||||
gamma = global->console.screen.gamma_correction;
|
||||
GX_SetDispCopyGamma(MAX(0,MIN(2,gamma)));
|
||||
#endif
|
||||
|
||||
@ -1484,7 +1496,7 @@ static bool gx_frame(void *data, const void *frame,
|
||||
char fps_text_buf[128];
|
||||
gx_video_t *gx = (gx_video_t*)data;
|
||||
u8 clear_efb = GX_FALSE;
|
||||
u32 level = 0;
|
||||
uint32_t level = 0;
|
||||
|
||||
fps_text_buf[0] = '\0';
|
||||
|
||||
|
@ -25,6 +25,7 @@
|
||||
#include <formats/image.h>
|
||||
#include <retro_inline.h>
|
||||
#include <retro_miscellaneous.h>
|
||||
#include <retro_math.h>
|
||||
#include <retro_assert.h>
|
||||
#include <libretro.h>
|
||||
|
||||
|
@ -215,7 +215,7 @@ static void* wiiu_gfx_init(const video_info_t* video,
|
||||
*input_data = wiiuinput;
|
||||
}
|
||||
|
||||
/* video init */
|
||||
/* video initialize */
|
||||
wiiu->cmd_buffer = MEM2_alloc(0x400000, 0x40);
|
||||
u32 init_attributes[] =
|
||||
{
|
||||
@ -276,19 +276,14 @@ static void* wiiu_gfx_init(const video_info_t* video,
|
||||
GX2SetScissor(0, 0, wiiu->color_buffer.surface.width, wiiu->color_buffer.surface.height);
|
||||
GX2SetDepthOnlyControl(GX2_DISABLE, GX2_DISABLE, GX2_COMPARE_FUNC_ALWAYS);
|
||||
GX2SetColorControl(GX2_LOGIC_OP_COPY, 1, GX2_DISABLE, GX2_ENABLE);
|
||||
#if 1
|
||||
GX2SetBlendControl(GX2_RENDER_TARGET_0, GX2_BLEND_MODE_SRC_ALPHA, GX2_BLEND_MODE_INV_SRC_ALPHA, GX2_BLEND_COMBINE_MODE_ADD,
|
||||
GX2_ENABLE, GX2_BLEND_MODE_SRC_ALPHA, GX2_BLEND_MODE_INV_SRC_ALPHA, GX2_BLEND_COMBINE_MODE_ADD);
|
||||
#else
|
||||
GX2SetBlendControl(GX2_RENDER_TARGET_0, GX2_BLEND_MODE_ONE, GX2_BLEND_MODE_ZERO, GX2_BLEND_COMBINE_MODE_ADD,
|
||||
GX2_DISABLE, GX2_BLEND_MODE_ONE, GX2_BLEND_MODE_ZERO, GX2_BLEND_COMBINE_MODE_ADD);
|
||||
#endif
|
||||
GX2SetCullOnlyControl(GX2_FRONT_FACE_CCW, GX2_DISABLE, GX2_DISABLE);
|
||||
#ifdef GX2_CAN_ACCESS_DATA_SECTION
|
||||
wiiu->shader = &tex_shader;
|
||||
#else
|
||||
|
||||
/* init shader */
|
||||
/* Initialize shader */
|
||||
wiiu->shader = MEM2_alloc(sizeof(tex_shader), 0x1000);
|
||||
memcpy(wiiu->shader, &tex_shader, sizeof(tex_shader));
|
||||
GX2Invalidate(GX2_INVALIDATE_MODE_CPU, wiiu->shader, sizeof(tex_shader));
|
||||
@ -341,7 +336,7 @@ static void* wiiu_gfx_init(const video_info_t* video,
|
||||
wiiu_set_tex_coords(wiiu->menu.tex_coord, &wiiu->menu.texture, 0, 0,
|
||||
wiiu->menu.texture.surface.width, wiiu->menu.texture.surface.height, 0);
|
||||
|
||||
/* init frame texture */
|
||||
/* Initialize frame texture */
|
||||
memset(&wiiu->texture, 0, sizeof(GX2Texture));
|
||||
wiiu->texture.surface.width = video->input_scale * RARCH_SCALE_BASE;
|
||||
wiiu->texture.surface.height = video->input_scale * RARCH_SCALE_BASE;
|
||||
@ -390,12 +385,14 @@ static void* wiiu_gfx_init(const video_info_t* video,
|
||||
GX2Invalidate(GX2_INVALIDATE_MODE_CPU_TEXTURE, wiiu->menu.texture.surface.image,
|
||||
wiiu->menu.texture.surface.imageSize);
|
||||
|
||||
wiiu->vertex_cache.size = 0x1000;
|
||||
wiiu->vertex_cache.current = 0;
|
||||
wiiu->vertex_cache.positions = MEM2_alloc(wiiu->vertex_cache.size * sizeof(position_t), GX2_VERTEX_BUFFER_ALIGNMENT);
|
||||
wiiu->vertex_cache.tex_coords = MEM2_alloc(wiiu->vertex_cache.size * sizeof(tex_coord_t), GX2_VERTEX_BUFFER_ALIGNMENT);
|
||||
wiiu->vertex_cache.size = 0x1000;
|
||||
wiiu->vertex_cache.current = 0;
|
||||
wiiu->vertex_cache.positions = MEM2_alloc(wiiu->vertex_cache.size
|
||||
* sizeof(position_t), GX2_VERTEX_BUFFER_ALIGNMENT);
|
||||
wiiu->vertex_cache.tex_coords = MEM2_alloc(wiiu->vertex_cache.size
|
||||
* sizeof(tex_coord_t), GX2_VERTEX_BUFFER_ALIGNMENT);
|
||||
|
||||
/* init samplers */
|
||||
/* Initialize samplers */
|
||||
GX2InitSampler(&wiiu->sampler_nearest, GX2_TEX_CLAMP_MODE_CLAMP, GX2_TEX_XY_FILTER_MODE_POINT);
|
||||
GX2InitSampler(&wiiu->sampler_linear, GX2_TEX_CLAMP_MODE_CLAMP, GX2_TEX_XY_FILTER_MODE_LINEAR);
|
||||
|
||||
@ -415,10 +412,10 @@ static void* wiiu_gfx_init(const video_info_t* video,
|
||||
GX2SetTVEnable(GX2_ENABLE);
|
||||
GX2SetDRCEnable(GX2_ENABLE);
|
||||
|
||||
wiiu->keep_aspect = true;
|
||||
wiiu->should_resize = true;
|
||||
wiiu->smooth = video->smooth;
|
||||
wiiu->vsync = video->vsync;
|
||||
wiiu->keep_aspect = true;
|
||||
wiiu->should_resize = true;
|
||||
wiiu->smooth = video->smooth;
|
||||
wiiu->vsync = video->vsync;
|
||||
GX2SetSwapInterval(!!video->vsync);
|
||||
|
||||
wiiu->vp.x = 0;
|
||||
@ -495,11 +492,17 @@ static bool wiiu_gfx_frame(void* data, const void* frame,
|
||||
unsigned width, unsigned height, uint64_t frame_count,
|
||||
unsigned pitch, const char* msg, video_frame_info_t *video_info)
|
||||
{
|
||||
(void)msg;
|
||||
#if 0
|
||||
static float fps;
|
||||
static u32 frames;
|
||||
static u32 lastTick , currentTick;
|
||||
u32 diff;
|
||||
#endif
|
||||
int i;
|
||||
|
||||
wiiu_video_t* wiiu = (wiiu_video_t*) data;
|
||||
|
||||
(void)msg;
|
||||
|
||||
if(wiiu->vsync)
|
||||
{
|
||||
uint32_t swap_count;
|
||||
@ -517,32 +520,32 @@ static bool wiiu_gfx_frame(void* data, const void* frame,
|
||||
else
|
||||
wiiu->last_vsync = last_vsync;
|
||||
}
|
||||
GX2WaitForFlip();
|
||||
|
||||
GX2WaitForFlip();
|
||||
|
||||
if (!width || !height)
|
||||
return true;
|
||||
|
||||
static u32 lastTick , currentTick;
|
||||
#if 0
|
||||
currentTick = OSGetSystemTick();
|
||||
u32 diff = currentTick - lastTick;
|
||||
static float fps;
|
||||
static u32 frames;
|
||||
diff = currentTick - lastTick;
|
||||
|
||||
frames++;
|
||||
|
||||
if(diff > wiiu_timer_clock)
|
||||
{
|
||||
fps = (float)frames * ((float) wiiu_timer_clock / (float) diff);
|
||||
lastTick = currentTick;
|
||||
frames = 0;
|
||||
}
|
||||
#if 0
|
||||
|
||||
static u32 last_frame_tick;
|
||||
if (!(wiiu->menu.enable))
|
||||
printf("frame time : %10.6f ms \r", (float)(currentTick - last_frame_tick) * 1000.0f / (float)wiiu_timer_clock);
|
||||
last_frame_tick = currentTick;
|
||||
#endif
|
||||
printf("fps: %8.8f frames : %5i\r", fps, wiiu->frames++);
|
||||
fflush(stdout);
|
||||
#endif
|
||||
|
||||
if (wiiu->should_resize)
|
||||
wiiu_gfx_update_viewport(wiiu);
|
||||
@ -559,8 +562,9 @@ static bool wiiu_gfx_frame(void* data, const void* frame,
|
||||
if (height > wiiu->texture.surface.height)
|
||||
height = wiiu->texture.surface.height;
|
||||
|
||||
wiiu->width = width;
|
||||
wiiu->width = width;
|
||||
wiiu->height = height;
|
||||
|
||||
if(wiiu->rgb32)
|
||||
{
|
||||
const uint32_t* src = frame;
|
||||
@ -577,12 +581,12 @@ static bool wiiu_gfx_frame(void* data, const void* frame,
|
||||
}
|
||||
else
|
||||
{
|
||||
const uint16_t* src = frame;
|
||||
uint16_t* dst = (uint16_t*)wiiu->texture.surface.image;
|
||||
const uint16_t *src = frame;
|
||||
uint16_t *dst = (uint16_t*)wiiu->texture.surface.image;
|
||||
|
||||
for (i = 0; i < height; i++)
|
||||
{
|
||||
int j;
|
||||
unsigned j;
|
||||
for(j = 0; j < width; j++)
|
||||
dst[j] = __builtin_bswap16(src[j]);
|
||||
dst += wiiu->texture.surface.pitch;
|
||||
@ -596,8 +600,10 @@ static bool wiiu_gfx_frame(void* data, const void* frame,
|
||||
wiiu_set_tex_coords(wiiu->tex_coord, &wiiu->texture, 0, 0, width, height, wiiu->rotation);
|
||||
}
|
||||
|
||||
GX2SetAttribBuffer(0, 4 * sizeof(*wiiu->position), sizeof(*wiiu->position), wiiu->position);
|
||||
GX2SetAttribBuffer(1, 4 * sizeof(*wiiu->tex_coord), sizeof(*wiiu->tex_coord), wiiu->tex_coord);
|
||||
GX2SetAttribBuffer(0, 4 * sizeof(*wiiu->position),
|
||||
sizeof(*wiiu->position), wiiu->position);
|
||||
GX2SetAttribBuffer(1, 4 * sizeof(*wiiu->tex_coord),
|
||||
sizeof(*wiiu->tex_coord), wiiu->tex_coord);
|
||||
|
||||
GX2SetPixelTexture(&wiiu->texture, wiiu->shader->sampler.location);
|
||||
GX2SetPixelSampler(wiiu->smooth? &wiiu->sampler_linear : &wiiu->sampler_nearest,
|
||||
@ -607,8 +613,10 @@ static bool wiiu_gfx_frame(void* data, const void* frame,
|
||||
|
||||
if (wiiu->menu.enable)
|
||||
{
|
||||
GX2SetAttribBuffer(0, 4 * sizeof(*wiiu->menu.position), sizeof(*wiiu->menu.position), wiiu->menu.position);
|
||||
GX2SetAttribBuffer(1, 4 * sizeof(*wiiu->menu.tex_coord), sizeof(*wiiu->menu.tex_coord), wiiu->menu.tex_coord);
|
||||
GX2SetAttribBuffer(0, 4 * sizeof(*wiiu->menu.position),
|
||||
sizeof(*wiiu->menu.position), wiiu->menu.position);
|
||||
GX2SetAttribBuffer(1, 4 * sizeof(*wiiu->menu.tex_coord),
|
||||
sizeof(*wiiu->menu.tex_coord), wiiu->menu.tex_coord);
|
||||
|
||||
GX2SetPixelTexture(&wiiu->menu.texture, wiiu->shader->sampler.location);
|
||||
GX2SetPixelSampler(&wiiu->sampler_linear, wiiu->shader->sampler.location);
|
||||
@ -617,8 +625,10 @@ static bool wiiu_gfx_frame(void* data, const void* frame,
|
||||
}
|
||||
|
||||
wiiu->vertex_cache.current = 0;
|
||||
GX2SetAttribBuffer(0, wiiu->vertex_cache.size * sizeof(position_t), sizeof(position_t), wiiu->vertex_cache.positions);
|
||||
GX2SetAttribBuffer(1, wiiu->vertex_cache.size * sizeof(tex_coord_t), sizeof(tex_coord_t), wiiu->vertex_cache.tex_coords);
|
||||
GX2SetAttribBuffer(0, wiiu->vertex_cache.size * sizeof(position_t),
|
||||
sizeof(position_t), wiiu->vertex_cache.positions);
|
||||
GX2SetAttribBuffer(1, wiiu->vertex_cache.size * sizeof(tex_coord_t),
|
||||
sizeof(tex_coord_t), wiiu->vertex_cache.tex_coords);
|
||||
GX2SetPixelSampler(&wiiu->sampler_linear, wiiu->shader->sampler.location);
|
||||
|
||||
wiiu->render_msg_enabled = true;
|
||||
@ -631,8 +641,10 @@ static bool wiiu_gfx_frame(void* data, const void* frame,
|
||||
|
||||
wiiu->render_msg_enabled = false;
|
||||
|
||||
GX2Invalidate(GX2_INVALIDATE_MODE_CPU_ATTRIBUTE_BUFFER, wiiu->vertex_cache.positions, wiiu->vertex_cache.current * sizeof(position_t));
|
||||
GX2Invalidate(GX2_INVALIDATE_MODE_CPU_ATTRIBUTE_BUFFER, wiiu->vertex_cache.tex_coords, wiiu->vertex_cache.current * sizeof(tex_coord_t));
|
||||
GX2Invalidate(GX2_INVALIDATE_MODE_CPU_ATTRIBUTE_BUFFER,
|
||||
wiiu->vertex_cache.positions, wiiu->vertex_cache.current * sizeof(position_t));
|
||||
GX2Invalidate(GX2_INVALIDATE_MODE_CPU_ATTRIBUTE_BUFFER,
|
||||
wiiu->vertex_cache.tex_coords, wiiu->vertex_cache.current * sizeof(tex_coord_t));
|
||||
|
||||
if (wiiu->menu.enable)
|
||||
GX2DrawDone();
|
||||
@ -729,8 +741,8 @@ static uintptr_t wiiu_gfx_load_texture(void* video_data, void* data,
|
||||
texture->surface.tileMode = GX2_TILE_MODE_LINEAR_ALIGNED;
|
||||
texture->viewNumSlices = 1;
|
||||
|
||||
texture->surface.format = GX2_SURFACE_FORMAT_UNORM_R8_G8_B8_A8;
|
||||
texture->compMap = GX2_COMP_SEL(_G, _B, _A, _R);
|
||||
texture->surface.format = GX2_SURFACE_FORMAT_UNORM_R8_G8_B8_A8;
|
||||
texture->compMap = GX2_COMP_SEL(_G, _B, _A, _R);
|
||||
|
||||
GX2CalcSurfaceSizeAndAlignment(&texture->surface);
|
||||
GX2InitTextureRegs(texture);
|
||||
@ -768,15 +780,15 @@ static void wiiu_gfx_apply_state_changes(void* data)
|
||||
|
||||
if (wiiu)
|
||||
wiiu->should_resize = true;
|
||||
|
||||
|
||||
}
|
||||
|
||||
static void wiiu_gfx_set_texture_frame(void* data, const void* frame, bool rgb32,
|
||||
unsigned width, unsigned height, float alpha)
|
||||
{
|
||||
int i;
|
||||
wiiu_video_t* wiiu = (wiiu_video_t*) data;
|
||||
const uint16_t *src = NULL;
|
||||
uint16_t *dst = NULL;
|
||||
wiiu_video_t* wiiu = (wiiu_video_t*) data;
|
||||
|
||||
if (!wiiu)
|
||||
return;
|
||||
@ -790,11 +802,11 @@ static void wiiu_gfx_set_texture_frame(void* data, const void* frame, bool rgb32
|
||||
if (height > wiiu->menu.texture.surface.height)
|
||||
height = wiiu->menu.texture.surface.height;
|
||||
|
||||
wiiu->menu.width = width;
|
||||
wiiu->menu.width = width;
|
||||
wiiu->menu.height = height;
|
||||
|
||||
const uint16_t* src = frame;
|
||||
uint16_t* dst = (uint16_t*)wiiu->menu.texture.surface.image;
|
||||
src = frame;
|
||||
dst = (uint16_t*)wiiu->menu.texture.surface.image;
|
||||
|
||||
for (i = 0; i < height; i++)
|
||||
{
|
||||
@ -807,7 +819,6 @@ static void wiiu_gfx_set_texture_frame(void* data, const void* frame, bool rgb32
|
||||
wiiu->menu.texture.surface.imageSize);
|
||||
|
||||
wiiu_set_tex_coords(wiiu->menu.tex_coord, &wiiu->menu.texture, 0, 0, width, height, 0);
|
||||
// wiiu_set_tex_coords(wiiu->menu.tex_coord, &wiiu->menu.texture, 0, 0, wiiu->menu.texture.surface.width, wiiu->menu.texture.surface.height, 0);
|
||||
}
|
||||
|
||||
static void wiiu_gfx_set_texture_enable(void* data, bool state, bool full_screen)
|
||||
@ -860,7 +871,7 @@ static const video_poke_interface_t wiiu_poke_interface =
|
||||
};
|
||||
|
||||
static void wiiu_gfx_get_poke_interface(void* data,
|
||||
const video_poke_interface_t** iface)
|
||||
const video_poke_interface_t** iface)
|
||||
{
|
||||
(void)data;
|
||||
*iface = &wiiu_poke_interface;
|
||||
|
@ -247,7 +247,10 @@ static void *cocoagl_gfx_ctx_init(video_frame_info_t *video_info, void *video_dr
|
||||
|
||||
static void cocoagl_gfx_ctx_destroy(void *data)
|
||||
{
|
||||
(void)data;
|
||||
cocoa_ctx_data_t *cocoa_ctx = (cocoa_ctx_data_t*)data;
|
||||
|
||||
if (!cocoa_ctx)
|
||||
return;
|
||||
|
||||
[GLContextClass clearCurrentContext];
|
||||
|
||||
@ -268,6 +271,8 @@ static void cocoagl_gfx_ctx_destroy(void *data)
|
||||
#endif
|
||||
[GLContextClass clearCurrentContext];
|
||||
g_context = nil;
|
||||
|
||||
free(cocoa_ctx);
|
||||
}
|
||||
|
||||
static bool cocoagl_gfx_ctx_bind_api(void *data, enum gfx_ctx_api api, unsigned major, unsigned minor)
|
||||
|
@ -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;
|
@ -34,16 +34,22 @@
|
||||
typedef struct
|
||||
{
|
||||
d3d_video_t *d3d;
|
||||
#ifdef __cplusplus
|
||||
LPD3DXFONT font;
|
||||
#else
|
||||
ID3DXFont *font;
|
||||
#endif
|
||||
uint32_t color;
|
||||
} d3dfonts_t;
|
||||
|
||||
#ifdef __cplusplus
|
||||
#else
|
||||
#endif
|
||||
|
||||
static void *d3dfonts_w32_init_font(void *video_data,
|
||||
const char *font_path, float font_size,
|
||||
bool is_threaded)
|
||||
{
|
||||
uint32_t r, g, b;
|
||||
d3dfonts_t *d3dfonts = NULL;
|
||||
settings_t *settings = config_get_ptr();
|
||||
D3DXFONT_DESC desc = {
|
||||
(int)(font_size), 0, 400, 0,
|
||||
@ -51,30 +57,40 @@ static void *d3dfonts_w32_init_font(void *video_data,
|
||||
OUT_TT_PRECIS,
|
||||
CLIP_DEFAULT_PRECIS,
|
||||
DEFAULT_PITCH,
|
||||
#ifdef UNICODE
|
||||
_T(L"Verdana") /* Hardcode FTL */
|
||||
#else
|
||||
_T("Verdana") /* Hardcode FTL */
|
||||
#endif
|
||||
};
|
||||
|
||||
d3dfonts = (d3dfonts_t*)calloc(1, sizeof(*d3dfonts));
|
||||
|
||||
if (!d3dfonts)
|
||||
return NULL;
|
||||
|
||||
(void)font_path;
|
||||
|
||||
r = (settings->floats.video_msg_color_r * 255);
|
||||
g = (settings->floats.video_msg_color_g * 255);
|
||||
b = (settings->floats.video_msg_color_b * 255);
|
||||
d3dfonts_t *d3dfonts = (d3dfonts_t*)calloc(1, sizeof(*d3dfonts));
|
||||
uint32_t r = (settings->floats.video_msg_color_r * 255);
|
||||
uint32_t g = (settings->floats.video_msg_color_g * 255);
|
||||
uint32_t b = (settings->floats.video_msg_color_b * 255);
|
||||
r &= 0xff;
|
||||
g &= 0xff;
|
||||
b &= 0xff;
|
||||
|
||||
if (!d3dfonts)
|
||||
return NULL;
|
||||
|
||||
d3dfonts->d3d = (d3d_video_t*)video_data;
|
||||
d3dfonts->color = D3DCOLOR_XRGB(r, g, b);
|
||||
|
||||
if (SUCCEEDED(D3DXCreateFontIndirect(
|
||||
#ifdef __cplusplus
|
||||
if (FAILED(D3DXCreateFontIndirect(
|
||||
d3dfonts->d3d->dev, &desc, &d3dfonts->font)))
|
||||
return d3dfonts;
|
||||
goto error;
|
||||
#else
|
||||
if (FAILED(D3DXCreateFontIndirect(
|
||||
d3dfonts->d3d->dev, &desc,
|
||||
(struct ID3DXFont**)&d3dfonts->font)))
|
||||
goto error;
|
||||
#endif
|
||||
|
||||
return d3dfonts;
|
||||
|
||||
error:
|
||||
free(d3dfonts);
|
||||
return NULL;
|
||||
}
|
||||
@ -86,8 +102,13 @@ static void d3dfonts_w32_free_font(void *data, bool is_threaded)
|
||||
if (!d3dfonts)
|
||||
return;
|
||||
|
||||
#ifdef __cplusplus
|
||||
if (d3dfonts->font)
|
||||
d3dfonts->font->Release();
|
||||
#else
|
||||
if (d3dfonts->font)
|
||||
d3dfonts->font->lpVtbl->Release(d3dfonts->font);
|
||||
#endif
|
||||
d3dfonts->font = NULL;
|
||||
|
||||
free(d3dfonts);
|
||||
@ -105,9 +126,10 @@ static void d3dfonts_w32_render_msg(video_frame_info_t *video_info, void *data,
|
||||
if (!msg)
|
||||
return;
|
||||
d3d_set_viewports(d3dfonts->d3d->dev, &d3dfonts->d3d->final_viewport);
|
||||
if (!(SUCCEEDED(d3dfonts->d3d->dev->BeginScene())))
|
||||
if (!d3d_begin_scene(d3dfonts->d3d->dev))
|
||||
return;
|
||||
|
||||
#ifdef __cplusplus
|
||||
d3dfonts->font->DrawTextA(NULL,
|
||||
msg,
|
||||
-1,
|
||||
@ -121,8 +143,27 @@ static void d3dfonts_w32_render_msg(video_frame_info_t *video_info, void *data,
|
||||
&d3dfonts->d3d->font_rect,
|
||||
DT_LEFT,
|
||||
d3dfonts->color | 0xff000000);
|
||||
#else
|
||||
d3dfonts->font->lpVtbl->DrawTextA(
|
||||
d3dfonts->font,
|
||||
NULL,
|
||||
msg,
|
||||
-1,
|
||||
&d3dfonts->d3d->font_rect_shifted,
|
||||
DT_LEFT,
|
||||
((d3dfonts->color >> 2) & 0x3f3f3f) | 0xff000000);
|
||||
|
||||
d3dfonts->d3d->dev->EndScene();
|
||||
d3dfonts->font->lpVtbl->DrawTextA(
|
||||
d3dfonts->font,
|
||||
NULL,
|
||||
msg,
|
||||
-1,
|
||||
&d3dfonts->d3d->font_rect,
|
||||
DT_LEFT,
|
||||
d3dfonts->color | 0xff000000);
|
||||
#endif
|
||||
|
||||
d3d_end_scene(d3dfonts->d3d->dev);
|
||||
}
|
||||
|
||||
font_renderer_t d3d_win32_font = {
|
@ -19,6 +19,7 @@
|
||||
#include <string/stdstring.h>
|
||||
|
||||
#include "../drivers/d3d.h"
|
||||
#include "../common/d3d_common.h"
|
||||
#include "../font_driver.h"
|
||||
|
||||
#include "../drivers/d3d_shaders/font.hlsl.d3d9.h"
|
||||
@ -58,18 +59,18 @@ enum
|
||||
class PackedResource
|
||||
{
|
||||
protected:
|
||||
BYTE* m_pSysMemData; // Alloc'ed memory for resource headers etc.
|
||||
BYTE* m_pSysMemData; /* Allocated memory for resource headers etc. */
|
||||
DWORD m_dwSysMemDataSize;
|
||||
|
||||
BYTE* m_pVidMemData; // Alloc'ed memory for resource data, etc.
|
||||
BYTE* m_pVidMemData; /* Allocated memory for resource data, etc. */
|
||||
DWORD m_dwVidMemDataSize;
|
||||
|
||||
XBRESOURCE* m_pResourceTags; // Tags to associate names with the resources
|
||||
DWORD m_dwNumResourceTags; // Number of resource tags
|
||||
BOOL m_bInitialized; // Resource is fully initialized
|
||||
XBRESOURCE* m_pResourceTags; /* Tags to associate names with the resources */
|
||||
DWORD m_dwNumResourceTags; /* Number of resource tags */
|
||||
BOOL m_bInitialized; /* Resource is fully initialized */
|
||||
|
||||
public:
|
||||
// Loads the resources out of the specified bundle
|
||||
/* Loads the resources out of the specified bundle */
|
||||
#if defined(_XBOX1)
|
||||
HRESULT Create( const char *strFilename, DWORD dwNumResourceTags = 0L,
|
||||
XBRESOURCE* pResourceTags = NULL );
|
||||
@ -82,19 +83,19 @@ class PackedResource
|
||||
BOOL Initialized() const;
|
||||
|
||||
#ifdef _XBOX360
|
||||
// Retrieves the resource tags
|
||||
/* Retrieves the resource tags */
|
||||
void GetResourceTags( DWORD* pdwNumResourceTags, XBRESOURCE** ppResourceTags );
|
||||
#endif
|
||||
|
||||
// Helper function to make sure a resource is registered
|
||||
/* Helper function to make sure a resource is registered */
|
||||
LPDIRECT3DRESOURCE RegisterResource( LPDIRECT3DRESOURCE pResource ) const
|
||||
{
|
||||
#ifdef _XBOX1
|
||||
// Register the resource, if it has not yet been registered. We mark
|
||||
// a resource as registered by upping it's reference count.
|
||||
/* Register the resource, if it has not yet been registered. We mark
|
||||
* a resource as registered by upping it's reference count. */
|
||||
if( pResource && ( pResource->Common & D3DCOMMON_REFCOUNT_MASK ) == 1 )
|
||||
{
|
||||
// Special case CPU-copy push buffers (which live in system memory)
|
||||
/* Special case CPU-copy push buffers (which live in system memory) */
|
||||
if( ( pResource->Common & D3DCOMMON_TYPE_PUSHBUFFER ) &&
|
||||
( pResource->Common & D3DPUSHBUFFER_RUN_USING_CPU_COPY ) )
|
||||
pResource->Data += (DWORD)m_pSysMemData;
|
||||
@ -107,7 +108,7 @@ class PackedResource
|
||||
return pResource;
|
||||
}
|
||||
|
||||
// Functions to retrieve resources by their offset
|
||||
/* Functions to retrieve resources by their offset */
|
||||
void *GetData( DWORD dwOffset ) const
|
||||
{ return &m_pSysMemData[dwOffset]; }
|
||||
|
||||
@ -120,7 +121,7 @@ class PackedResource
|
||||
LPDIRECT3DVERTEXBUFFER GetVertexBuffer( DWORD dwOffset ) const
|
||||
{ return (LPDIRECT3DVERTEXBUFFER)GetResource( dwOffset ); }
|
||||
|
||||
// Functions to retrieve resources by their name
|
||||
/* Functions to retrieve resources by their name */
|
||||
void *GetData( const char* strName ) const;
|
||||
|
||||
LPDIRECT3DRESOURCE GetResource( const char* strName ) const
|
||||
@ -132,7 +133,7 @@ class PackedResource
|
||||
LPDIRECT3DVERTEXBUFFER GetVertexBuffer( const char* strName ) const
|
||||
{ return (LPDIRECT3DVERTEXBUFFER)GetResource( strName ); }
|
||||
|
||||
// Constructor/destructor
|
||||
/* Constructor/destructor */
|
||||
PackedResource();
|
||||
~PackedResource();
|
||||
};
|
||||
@ -270,7 +271,7 @@ HRESULT PackedResource::Create(const char *strFilename)
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
// Compute memory requirements
|
||||
/* Compute memory requirements */
|
||||
#if defined(_XBOX1)
|
||||
m_dwSysMemDataSize = xprh.dwHeaderSize - sizeof(XPR_HEADER);
|
||||
m_dwVidMemDataSize = xprh.dwTotalSize - xprh.dwHeaderSize;
|
||||
@ -279,7 +280,7 @@ HRESULT PackedResource::Create(const char *strFilename)
|
||||
m_dwVidMemDataSize = xprh.dwDataSize;
|
||||
#endif
|
||||
|
||||
// Allocate memory
|
||||
/* Allocate memory */
|
||||
m_pSysMemData = (BYTE*)malloc(m_dwSysMemDataSize);
|
||||
if (m_pSysMemData == NULL)
|
||||
{
|
||||
@ -304,7 +305,7 @@ HRESULT PackedResource::Create(const char *strFilename)
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
// Read in the data from the file
|
||||
/* Read in the data from the file */
|
||||
if( !ReadFile( hFile, m_pSysMemData, m_dwSysMemDataSize, &dwNumBytesRead, NULL) ||
|
||||
!ReadFile( hFile, m_pVidMemData, m_dwVidMemDataSize, &dwNumBytesRead, NULL))
|
||||
{
|
||||
@ -312,7 +313,7 @@ HRESULT PackedResource::Create(const char *strFilename)
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
// Done with the file
|
||||
/* Done with the file */
|
||||
CloseHandle( hFile);
|
||||
|
||||
#ifdef _XBOX1
|
||||
@ -471,10 +472,7 @@ static HRESULT xdk360_video_font_create_shaders(xdk360_video_font_t * font)
|
||||
D3DDECL_END()
|
||||
};
|
||||
|
||||
|
||||
hr = d3dr->CreateVertexDeclaration( decl, &font->s_FontLocals.m_pFontVertexDecl );
|
||||
|
||||
if (hr >= 0)
|
||||
if (d3d_vertex_declaration_new(d3dr,decl, (void**)&font->s_FontLocals.m_pFontVertexDecl))
|
||||
{
|
||||
ID3DXBuffer* pShaderCode;
|
||||
|
||||
@ -510,8 +508,8 @@ static HRESULT xdk360_video_font_create_shaders(xdk360_video_font_t * font)
|
||||
font->s_FontLocals.m_pFontVertexShader = NULL;
|
||||
}
|
||||
|
||||
font->s_FontLocals.m_pFontVertexDecl->Release();
|
||||
}
|
||||
d3d_vertex_declaration_free(font->s_FontLocals.m_pFontVertexDecl);
|
||||
}
|
||||
font->s_FontLocals.m_pFontVertexDecl = NULL;
|
||||
}while(0);
|
||||
|
||||
@ -611,7 +609,7 @@ static void xdk360_free_font(void *data, bool is_threaded)
|
||||
if (font->s_FontLocals.m_pFontVertexShader)
|
||||
font->s_FontLocals.m_pFontVertexShader->Release();
|
||||
if (font->s_FontLocals.m_pFontVertexDecl)
|
||||
font->s_FontLocals.m_pFontVertexDecl->Release();
|
||||
d3d_vertex_declaration_free(font->s_FontLocals.m_pFontVertexDecl);
|
||||
|
||||
font->s_FontLocals.m_pFontPixelShader = NULL;
|
||||
font->s_FontLocals.m_pFontVertexShader = NULL;
|
||||
@ -629,10 +627,10 @@ static void xdk360_render_msg_post(xdk360_video_font_t * font)
|
||||
LPDIRECT3DDEVICE d3dr = font->d3d->dev;
|
||||
|
||||
d3d_set_texture(d3dr, 0, NULL);
|
||||
d3dr->SetVertexDeclaration(NULL);
|
||||
d3d_set_vertex_declaration(d3dr, NULL);
|
||||
d3d_set_vertex_shader(d3dr, 0, NULL);
|
||||
D3DDevice_SetPixelShader(d3dr, NULL);
|
||||
d3dr->SetRenderState( D3DRS_VIEWPORTENABLE, font->m_dwSavedState );
|
||||
d3d_set_render_state(d3dr, D3DRS_VIEWPORTENABLE, font->m_dwSavedState);
|
||||
}
|
||||
|
||||
static void xdk360_render_msg_pre(xdk360_video_font_t * font)
|
||||
@ -645,19 +643,20 @@ static void xdk360_render_msg_pre(xdk360_video_font_t * font)
|
||||
d3dr->GetRenderState( D3DRS_VIEWPORTENABLE, (DWORD*)&font->m_dwSavedState );
|
||||
|
||||
/* Set the texture scaling factor as a vertex shader constant. */
|
||||
D3DTexture_GetLevelDesc(font->m_pFontTexture, 0, &TextureDesc); // Get the description
|
||||
/* Get the description */
|
||||
d3d_texture_get_level_desc(font->m_pFontTexture, 0, &TextureDesc);
|
||||
|
||||
/* Set render state. */
|
||||
d3d_set_texture(d3dr, 0, font->m_pFontTexture);
|
||||
|
||||
/* Read the TextureDesc here to ensure no load/hit/store from GetLevelDesc(). */
|
||||
/* Read the TextureDesc here to ensure no load/hit/store from d3d_texture_get_level_desc(). */
|
||||
vTexScale[0] = 1.0f / TextureDesc.Width; /* LHS due to int->float conversion. */
|
||||
vTexScale[1] = 1.0f / TextureDesc.Height;
|
||||
vTexScale[2] = 0.0f;
|
||||
vTexScale[3] = 0.0f;
|
||||
|
||||
d3dr->SetRenderState( D3DRS_VIEWPORTENABLE, FALSE );
|
||||
d3dr->SetVertexDeclaration(font->s_FontLocals.m_pFontVertexDecl);
|
||||
d3d_set_render_state(d3dr, D3DRS_VIEWPORTENABLE, FALSE);
|
||||
d3d_set_vertex_declaration(d3dr, font->s_FontLocals.m_pFontVertexDecl);
|
||||
d3d_set_vertex_shader(d3dr, 0, font->s_FontLocals.m_pFontVertexShader);
|
||||
d3dr->SetPixelShader(font->s_FontLocals.m_pFontPixelShader);
|
||||
|
||||
@ -773,10 +772,10 @@ static void xdk360_draw_text(xdk360_video_font_t *font,
|
||||
pVertex[12] = m_fCursorX;
|
||||
pVertex[13] = m_fCursorY + fHeight;
|
||||
#ifdef MSB_FIRST
|
||||
((volatile uint32_t *)pVertex)[2] = (tu1 << 16) | tv1; // Merged using big endian rules
|
||||
((volatile uint32_t *)pVertex)[6] = (tu2 << 16) | tv1; // Merged using big endian rules
|
||||
((volatile uint32_t*)pVertex)[10] = (tu2 << 16) | tv2; // Merged using big endian rules
|
||||
((volatile uint32_t*)pVertex)[14] = (tu1 << 16) | tv2; // Merged using big endian rules
|
||||
((volatile uint32_t *)pVertex)[2] = (tu1 << 16) | tv1; /* Merged using big endian rules */
|
||||
((volatile uint32_t *)pVertex)[6] = (tu2 << 16) | tv1; /* Merged using big endian rules */
|
||||
((volatile uint32_t*)pVertex)[10] = (tu2 << 16) | tv2; /* Merged using big endian rules */
|
||||
((volatile uint32_t*)pVertex)[14] = (tu1 << 16) | tv2; /* Merged using big endian rules */
|
||||
#endif
|
||||
pVertex[15] = 0;
|
||||
pVertex += 16;
|
||||
|
@ -48,11 +48,11 @@ static void renderchain_set_mvp(void *data, unsigned vp_width,
|
||||
{
|
||||
d3d_video_t *d3d = (d3d_video_t*)data;
|
||||
LPDIRECT3DDEVICE d3dr = (LPDIRECT3DDEVICE)d3d->dev;
|
||||
D3DXMATRIX p_out, p_rotate, mat;
|
||||
D3DMATRIX p_out, p_rotate, mat;
|
||||
|
||||
D3DXMatrixOrthoOffCenterLH(&mat, 0, vp_width, vp_height, 0, 0.0f, 1.0f);
|
||||
D3DXMatrixIdentity(&p_out);
|
||||
D3DXMatrixRotationZ(&p_rotate, rotation * (M_PI / 2.0));
|
||||
d3d_matrix_ortho_off_center_lh(&mat, 0, vp_width, vp_height, 0, 0.0f, 1.0f);
|
||||
d3d_matrix_identity(&p_out);
|
||||
d3d_matrix_rotation_z(&p_rotate, rotation * (M_PI / 2.0));
|
||||
|
||||
d3d_set_transform(d3dr, D3DTS_WORLD, &p_rotate);
|
||||
d3d_set_transform(d3dr, D3DTS_VIEW, &p_out);
|
||||
@ -74,7 +74,7 @@ static bool renderchain_create_first_pass(void *data,
|
||||
LPDIRECT3DDEVICE d3dr = (LPDIRECT3DDEVICE)d3d->dev;
|
||||
d3d8_renderchain_t *chain = (d3d8_renderchain_t*)d3d->renderchain_data;
|
||||
|
||||
chain->vertex_buf = d3d_vertex_buffer_new(d3dr, 4 * sizeof(Vertex),
|
||||
chain->vertex_buf = d3d_vertex_buffer_new(d3dr, 4 * sizeof(Vertex),
|
||||
D3DUSAGE_WRITEONLY, D3DFVF_CUSTOMVERTEX, D3DPOOL_MANAGED,
|
||||
NULL);
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -29,16 +29,16 @@
|
||||
typedef struct hlsl_d3d9_renderchain
|
||||
{
|
||||
unsigned pixel_size;
|
||||
LPDIRECT3DDEVICE dev;
|
||||
const video_info_t *video_info;
|
||||
LPDIRECT3DTEXTURE tex;
|
||||
LPDIRECT3DVERTEXBUFFER vertex_buf;
|
||||
unsigned last_width;
|
||||
unsigned last_height;
|
||||
LPDIRECT3DVERTEXDECLARATION vertex_decl;
|
||||
unsigned tex_w;
|
||||
unsigned tex_h;
|
||||
uint64_t frame_count;
|
||||
LPDIRECT3DDEVICE dev;
|
||||
LPDIRECT3DTEXTURE tex;
|
||||
LPDIRECT3DVERTEXBUFFER vertex_buf;
|
||||
LPDIRECT3DVERTEXDECLARATION vertex_decl;
|
||||
const video_info_t *video_info;
|
||||
} hlsl_d3d9_renderchain_t;
|
||||
|
||||
/* TODO/FIXME - this forward declaration should not be necesary */
|
||||
@ -82,10 +82,8 @@ static bool hlsl_d3d9_renderchain_init_shader_fvf(void *data, void *pass_data)
|
||||
|
||||
(void)pass_data;
|
||||
|
||||
if (FAILED(d3dr->CreateVertexDeclaration(VertexElements, &chain->vertex_decl)))
|
||||
return false;
|
||||
|
||||
return true;
|
||||
return d3d_vertex_declaration_new(d3dr,
|
||||
VertexElements, (void**)&chain->vertex_decl);
|
||||
}
|
||||
|
||||
static bool renderchain_create_first_pass(void *data,
|
||||
|
@ -914,7 +914,7 @@ static void *gl_glsl_init(void *data, const char *path)
|
||||
if (*glsl->shader->script_class)
|
||||
info.script_class= glsl->shader->script_class;
|
||||
#endif
|
||||
info.script_is_file = NULL;
|
||||
info.script_is_file = false;
|
||||
|
||||
glsl->state_tracker = state_tracker_init(&info);
|
||||
|
||||
|
@ -119,9 +119,9 @@ static void hlsl_set_uniform_parameter(
|
||||
}
|
||||
|
||||
#define set_param_2f(param, xy, constanttable) \
|
||||
if (param) constanttable->SetFloatArray(d3d_device_ptr, param, xy, 2)
|
||||
if (param) constanttable->SetFloatArray(d3dr, param, xy, 2)
|
||||
#define set_param_1f(param, x, constanttable) \
|
||||
if (param) constanttable->SetFloat(d3d_device_ptr, param, x)
|
||||
if (param) constanttable->SetFloat(d3dr, param, x)
|
||||
|
||||
static void hlsl_set_params(void *data, void *shader_data,
|
||||
unsigned width, unsigned height,
|
||||
@ -134,7 +134,7 @@ static void hlsl_set_params(void *data, void *shader_data,
|
||||
const void *_fbo_info, unsigned fbo_info_cnt)
|
||||
{
|
||||
d3d_video_t *d3d = (d3d_video_t*)data;
|
||||
LPDIRECT3DDEVICE d3d_device_ptr = (LPDIRECT3DDEVICE)d3d->dev;
|
||||
LPDIRECT3DDEVICE d3dr = (LPDIRECT3DDEVICE)d3d->dev;
|
||||
const struct video_tex_info *info = (const struct video_tex_info*)_info;
|
||||
const struct video_tex_info *prev_info = (const struct video_tex_info*)_prev_info;
|
||||
const struct video_tex_info *fbo_info = (const struct video_tex_info*)_fbo_info;
|
||||
@ -148,8 +148,8 @@ static void hlsl_set_params(void *data, void *shader_data,
|
||||
const float out_size[2] = { (float)out_width, (float)out_height };
|
||||
float frame_cnt = frame_counter;
|
||||
|
||||
hlsl->prg[hlsl->active_idx].f_ctable->SetDefaults(d3d_device_ptr);
|
||||
hlsl->prg[hlsl->active_idx].v_ctable->SetDefaults(d3d_device_ptr);
|
||||
hlsl->prg[hlsl->active_idx].f_ctable->SetDefaults(d3dr);
|
||||
hlsl->prg[hlsl->active_idx].v_ctable->SetDefaults(d3dr);
|
||||
|
||||
set_param_2f(hlsl->prg[hlsl->active_idx].vid_size_f, ori_size, hlsl->prg[hlsl->active_idx].f_ctable);
|
||||
set_param_2f(hlsl->prg[hlsl->active_idx].tex_size_f, tex_size, hlsl->prg[hlsl->active_idx].f_ctable);
|
||||
@ -176,7 +176,7 @@ static bool hlsl_compile_program(
|
||||
hlsl_shader_data_t *hlsl = (hlsl_shader_data_t*)data;
|
||||
d3d_video_t *d3d = (d3d_video_t*)hlsl->d3d;
|
||||
struct shader_program_hlsl_data *program = (struct shader_program_hlsl_data*)program_data;
|
||||
LPDIRECT3DDEVICE d3d_device_ptr = (LPDIRECT3DDEVICE)d3d->dev;
|
||||
LPDIRECT3DDEVICE d3dr = (LPDIRECT3DDEVICE)d3d->dev;
|
||||
ID3DXBuffer *listing_f = NULL;
|
||||
ID3DXBuffer *listing_v = NULL;
|
||||
ID3DXBuffer *code_f = NULL;
|
||||
@ -213,8 +213,8 @@ static bool hlsl_compile_program(
|
||||
goto end;
|
||||
}
|
||||
|
||||
d3d_device_ptr->CreatePixelShader((const DWORD*)code_f->GetBufferPointer(), &program->fprg);
|
||||
d3d_device_ptr->CreateVertexShader((const DWORD*)code_v->GetBufferPointer(), &program->vprg);
|
||||
d3dr->CreatePixelShader((const DWORD*)code_f->GetBufferPointer(), &program->fprg);
|
||||
d3dr->CreateVertexShader((const DWORD*)code_v->GetBufferPointer(), &program->vprg);
|
||||
code_f->Release();
|
||||
code_v->Release();
|
||||
|
||||
@ -499,13 +499,13 @@ static void hlsl_shader_scale(void *data, unsigned idx, struct gfx_fbo_scale *sc
|
||||
|
||||
static bool hlsl_set_mvp(void *data, void *shader_data, const math_matrix_4x4 *mat)
|
||||
{
|
||||
d3d_video_t *d3d = (d3d_video_t*)data;
|
||||
LPDIRECT3DDEVICE d3d_device_ptr = (LPDIRECT3DDEVICE)d3d->dev;
|
||||
hlsl_shader_data_t *hlsl_data = (hlsl_shader_data_t*)shader_data;
|
||||
d3d_video_t *d3d = (d3d_video_t*)data;
|
||||
LPDIRECT3DDEVICE d3dr = (LPDIRECT3DDEVICE)d3d->dev;
|
||||
hlsl_shader_data_t *hlsl_data = (hlsl_shader_data_t*)shader_data;
|
||||
|
||||
if(hlsl_data && hlsl_data->prg[hlsl_data->active_idx].mvp)
|
||||
{
|
||||
hlsl_data->prg[hlsl_data->active_idx].v_ctable->SetMatrix(d3d_device_ptr,
|
||||
hlsl_data->prg[hlsl_data->active_idx].v_ctable->SetMatrix(d3dr,
|
||||
hlsl_data->prg[hlsl_data->active_idx].mvp,
|
||||
(D3DXMATRIX*)&hlsl_data->prg[hlsl_data->active_idx].mvp_val);
|
||||
return true;
|
||||
|
@ -57,25 +57,26 @@ public:
|
||||
D3DXFLOAT16( FLOAT );
|
||||
D3DXFLOAT16( CONST D3DXFLOAT16& );
|
||||
|
||||
// casting
|
||||
/* casting */
|
||||
operator FLOAT ();
|
||||
|
||||
// binary operators
|
||||
/* binary operators */
|
||||
BOOL operator == ( CONST D3DXFLOAT16& ) const;
|
||||
BOOL operator != ( CONST D3DXFLOAT16& ) const;
|
||||
|
||||
protected:
|
||||
#endif //__cplusplus
|
||||
#endif /*__cplusplus */
|
||||
WORD value;
|
||||
} D3DXFLOAT16, *LPD3DXFLOAT16;
|
||||
|
||||
|
||||
|
||||
//===========================================================================
|
||||
//
|
||||
// Vectors
|
||||
//
|
||||
//===========================================================================
|
||||
/*===========================================================================
|
||||
*
|
||||
* Vectors
|
||||
*
|
||||
*===========================================================================
|
||||
*/
|
||||
|
||||
|
||||
//--------------------------
|
||||
@ -90,21 +91,21 @@ public:
|
||||
D3DXVECTOR2( CONST D3DXFLOAT16 * );
|
||||
D3DXVECTOR2( FLOAT x, FLOAT y );
|
||||
|
||||
// casting
|
||||
/* casting */
|
||||
operator FLOAT* ();
|
||||
operator CONST FLOAT* () const;
|
||||
|
||||
// assignment operators
|
||||
/* assignment operators */
|
||||
D3DXVECTOR2& operator += ( CONST D3DXVECTOR2& );
|
||||
D3DXVECTOR2& operator -= ( CONST D3DXVECTOR2& );
|
||||
D3DXVECTOR2& operator *= ( FLOAT );
|
||||
D3DXVECTOR2& operator /= ( FLOAT );
|
||||
|
||||
// unary operators
|
||||
/* unary operators */
|
||||
D3DXVECTOR2 operator + () const;
|
||||
D3DXVECTOR2 operator - () const;
|
||||
|
||||
// binary operators
|
||||
/* binary operators */
|
||||
D3DXVECTOR2 operator + ( CONST D3DXVECTOR2& ) const;
|
||||
D3DXVECTOR2 operator - ( CONST D3DXVECTOR2& ) const;
|
||||
D3DXVECTOR2 operator * ( FLOAT ) const;
|
||||
@ -117,7 +118,7 @@ public:
|
||||
|
||||
|
||||
public:
|
||||
#endif //__cplusplus
|
||||
#endif /*__cplusplus */
|
||||
FLOAT x, y;
|
||||
} D3DXVECTOR2, *LPD3DXVECTOR2;
|
||||
|
||||
@ -136,25 +137,24 @@ public:
|
||||
D3DXVECTOR2_16F( CONST D3DXFLOAT16 * );
|
||||
D3DXVECTOR2_16F( CONST D3DXFLOAT16 &x, CONST D3DXFLOAT16 &y );
|
||||
|
||||
// casting
|
||||
/* casting */
|
||||
operator D3DXFLOAT16* ();
|
||||
operator CONST D3DXFLOAT16* () const;
|
||||
|
||||
// binary operators
|
||||
/* binary operators */
|
||||
BOOL operator == ( CONST D3DXVECTOR2_16F& ) const;
|
||||
BOOL operator != ( CONST D3DXVECTOR2_16F& ) const;
|
||||
|
||||
public:
|
||||
#endif //__cplusplus
|
||||
#endif /*__cplusplus */
|
||||
D3DXFLOAT16 x, y;
|
||||
|
||||
} D3DXVECTOR2_16F, *LPD3DXVECTOR2_16F;
|
||||
|
||||
|
||||
|
||||
//--------------------------
|
||||
// 3D Vector
|
||||
//--------------------------
|
||||
/*--------------------------
|
||||
* 3D Vector
|
||||
*--------------------------
|
||||
*/
|
||||
#ifdef __cplusplus
|
||||
typedef struct D3DXVECTOR3 : public D3DVECTOR
|
||||
{
|
||||
@ -165,21 +165,21 @@ public:
|
||||
D3DXVECTOR3( CONST D3DXFLOAT16 * );
|
||||
D3DXVECTOR3( FLOAT x, FLOAT y, FLOAT z );
|
||||
|
||||
// casting
|
||||
/* casting */
|
||||
operator FLOAT* ();
|
||||
operator CONST FLOAT* () const;
|
||||
|
||||
// assignment operators
|
||||
/* assignment operators */
|
||||
D3DXVECTOR3& operator += ( CONST D3DXVECTOR3& );
|
||||
D3DXVECTOR3& operator -= ( CONST D3DXVECTOR3& );
|
||||
D3DXVECTOR3& operator *= ( FLOAT );
|
||||
D3DXVECTOR3& operator /= ( FLOAT );
|
||||
|
||||
// unary operators
|
||||
/* unary operators */
|
||||
D3DXVECTOR3 operator + () const;
|
||||
D3DXVECTOR3 operator - () const;
|
||||
|
||||
// binary operators
|
||||
/* binary operators */
|
||||
D3DXVECTOR3 operator + ( CONST D3DXVECTOR3& ) const;
|
||||
D3DXVECTOR3 operator - ( CONST D3DXVECTOR3& ) const;
|
||||
D3DXVECTOR3 operator * ( FLOAT ) const;
|
||||
@ -192,15 +192,15 @@ public:
|
||||
|
||||
} D3DXVECTOR3, *LPD3DXVECTOR3;
|
||||
|
||||
#else //!__cplusplus
|
||||
#else /* !__cplusplus */
|
||||
typedef struct _D3DVECTOR D3DXVECTOR3, *LPD3DXVECTOR3;
|
||||
#endif //!__cplusplus
|
||||
#endif /* !__cplusplus */
|
||||
|
||||
/*--------------------------
|
||||
* 3D Vector (16 bit)
|
||||
*--------------------------
|
||||
*/
|
||||
|
||||
|
||||
//--------------------------
|
||||
// 3D Vector (16 bit)
|
||||
//--------------------------
|
||||
typedef struct D3DXVECTOR3_16F
|
||||
{
|
||||
#ifdef __cplusplus
|
||||
@ -211,25 +211,24 @@ public:
|
||||
D3DXVECTOR3_16F( CONST D3DXFLOAT16 * );
|
||||
D3DXVECTOR3_16F( CONST D3DXFLOAT16 &x, CONST D3DXFLOAT16 &y, CONST D3DXFLOAT16 &z );
|
||||
|
||||
// casting
|
||||
/* casting */
|
||||
operator D3DXFLOAT16* ();
|
||||
operator CONST D3DXFLOAT16* () const;
|
||||
|
||||
// binary operators
|
||||
/* binary operators */
|
||||
BOOL operator == ( CONST D3DXVECTOR3_16F& ) const;
|
||||
BOOL operator != ( CONST D3DXVECTOR3_16F& ) const;
|
||||
|
||||
public:
|
||||
#endif //__cplusplus
|
||||
#endif /*__cplusplus */
|
||||
D3DXFLOAT16 x, y, z;
|
||||
|
||||
} D3DXVECTOR3_16F, *LPD3DXVECTOR3_16F;
|
||||
|
||||
|
||||
|
||||
//--------------------------
|
||||
// 4D Vector
|
||||
//--------------------------
|
||||
/*--------------------------
|
||||
* 4D Vector
|
||||
*--------------------------
|
||||
*/
|
||||
typedef struct D3DXVECTOR4
|
||||
{
|
||||
#ifdef __cplusplus
|
||||
@ -240,21 +239,21 @@ public:
|
||||
D3DXVECTOR4( CONST D3DVECTOR& xyz, FLOAT w );
|
||||
D3DXVECTOR4( FLOAT x, FLOAT y, FLOAT z, FLOAT w );
|
||||
|
||||
// casting
|
||||
/* casting */
|
||||
operator FLOAT* ();
|
||||
operator CONST FLOAT* () const;
|
||||
|
||||
// assignment operators
|
||||
/* assignment operators */
|
||||
D3DXVECTOR4& operator += ( CONST D3DXVECTOR4& );
|
||||
D3DXVECTOR4& operator -= ( CONST D3DXVECTOR4& );
|
||||
D3DXVECTOR4& operator *= ( FLOAT );
|
||||
D3DXVECTOR4& operator /= ( FLOAT );
|
||||
|
||||
// unary operators
|
||||
/* unary operators */
|
||||
D3DXVECTOR4 operator + () const;
|
||||
D3DXVECTOR4 operator - () const;
|
||||
|
||||
// binary operators
|
||||
/* binary operators */
|
||||
D3DXVECTOR4 operator + ( CONST D3DXVECTOR4& ) const;
|
||||
D3DXVECTOR4 operator - ( CONST D3DXVECTOR4& ) const;
|
||||
D3DXVECTOR4 operator * ( FLOAT ) const;
|
||||
@ -266,14 +265,15 @@ public:
|
||||
BOOL operator != ( CONST D3DXVECTOR4& ) const;
|
||||
|
||||
public:
|
||||
#endif //__cplusplus
|
||||
#endif /*__cplusplus */
|
||||
FLOAT x, y, z, w;
|
||||
} D3DXVECTOR4, *LPD3DXVECTOR4;
|
||||
|
||||
|
||||
//--------------------------
|
||||
// 4D Vector (16 bit)
|
||||
//--------------------------
|
||||
/*--------------------------
|
||||
* 4D Vector (16 bit)
|
||||
*--------------------------
|
||||
*/
|
||||
typedef struct D3DXVECTOR4_16F
|
||||
{
|
||||
#ifdef __cplusplus
|
||||
@ -284,27 +284,26 @@ public:
|
||||
D3DXVECTOR4_16F( CONST D3DXVECTOR3_16F& xyz, CONST D3DXFLOAT16& w );
|
||||
D3DXVECTOR4_16F( CONST D3DXFLOAT16& x, CONST D3DXFLOAT16& y, CONST D3DXFLOAT16& z, CONST D3DXFLOAT16& w );
|
||||
|
||||
// casting
|
||||
/* casting */
|
||||
operator D3DXFLOAT16* ();
|
||||
operator CONST D3DXFLOAT16* () const;
|
||||
|
||||
// binary operators
|
||||
/* binary operators */
|
||||
BOOL operator == ( CONST D3DXVECTOR4_16F& ) const;
|
||||
BOOL operator != ( CONST D3DXVECTOR4_16F& ) const;
|
||||
|
||||
public:
|
||||
#endif //__cplusplus
|
||||
#endif /* __cplusplus */
|
||||
D3DXFLOAT16 x, y, z, w;
|
||||
|
||||
} D3DXVECTOR4_16F, *LPD3DXVECTOR4_16F;
|
||||
|
||||
|
||||
|
||||
//===========================================================================
|
||||
//
|
||||
// Matrices
|
||||
//
|
||||
//===========================================================================
|
||||
/*===========================================================================
|
||||
*
|
||||
* Matrices
|
||||
*
|
||||
*===========================================================================
|
||||
*/
|
||||
#ifdef __cplusplus
|
||||
typedef struct D3DXMATRIX : public D3DMATRIX
|
||||
{
|
||||
@ -319,26 +318,26 @@ public:
|
||||
FLOAT _41, FLOAT _42, FLOAT _43, FLOAT _44 );
|
||||
|
||||
|
||||
// access grants
|
||||
/* access grants */
|
||||
FLOAT& operator () ( UINT Row, UINT Col );
|
||||
FLOAT operator () ( UINT Row, UINT Col ) const;
|
||||
|
||||
// casting operators
|
||||
/* casting operators */
|
||||
operator FLOAT* ();
|
||||
operator CONST FLOAT* () const;
|
||||
|
||||
// assignment operators
|
||||
/* assignment operators */
|
||||
D3DXMATRIX& operator *= ( CONST D3DXMATRIX& );
|
||||
D3DXMATRIX& operator += ( CONST D3DXMATRIX& );
|
||||
D3DXMATRIX& operator -= ( CONST D3DXMATRIX& );
|
||||
D3DXMATRIX& operator *= ( FLOAT );
|
||||
D3DXMATRIX& operator /= ( FLOAT );
|
||||
|
||||
// unary operators
|
||||
/* unary operators */
|
||||
D3DXMATRIX operator + () const;
|
||||
D3DXMATRIX operator - () const;
|
||||
|
||||
// binary operators
|
||||
/* binary operators */
|
||||
D3DXMATRIX operator * ( CONST D3DXMATRIX& ) const;
|
||||
D3DXMATRIX operator + ( CONST D3DXMATRIX& ) const;
|
||||
D3DXMATRIX operator - ( CONST D3DXMATRIX& ) const;
|
||||
@ -352,27 +351,28 @@ public:
|
||||
|
||||
} D3DXMATRIX, *LPD3DXMATRIX;
|
||||
|
||||
#else //!__cplusplus
|
||||
#else /* !__cplusplus */
|
||||
typedef struct _D3DMATRIX D3DXMATRIX, *LPD3DXMATRIX;
|
||||
#endif //!__cplusplus
|
||||
#endif /* !__cplusplus */
|
||||
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
// Aligned Matrices
|
||||
//
|
||||
// This class helps keep matrices 16-byte aligned as preferred by P4 cpus.
|
||||
// It aligns matrices on the stack and on the heap or in global scope.
|
||||
// It does this using __declspec(align(16)) which works on VC7 and on VC 6
|
||||
// with the processor pack. Unfortunately there is no way to detect the
|
||||
// latter so this is turned on only on VC7. On other compilers this is the
|
||||
// the same as D3DXMATRIX.
|
||||
//
|
||||
// Using this class on a compiler that does not actually do the alignment
|
||||
// can be dangerous since it will not expose bugs that ignore alignment.
|
||||
// E.g if an object of this class in inside a struct or class, and some code
|
||||
// memcopys data in it assuming tight packing. This could break on a compiler
|
||||
// that eventually start aligning the matrix.
|
||||
//---------------------------------------------------------------------------
|
||||
/*---------------------------------------------------------------------------
|
||||
* Aligned Matrices
|
||||
*
|
||||
* This class helps keep matrices 16-byte aligned as preferred by P4 cpus.
|
||||
* It aligns matrices on the stack and on the heap or in global scope.
|
||||
* It does this using __declspec(align(16)) which works on VC7 and on VC 6
|
||||
* with the processor pack. Unfortunately there is no way to detect the
|
||||
* latter so this is turned on only on VC7. On other compilers this is the
|
||||
* the same as D3DXMATRIX.
|
||||
*
|
||||
* Using this class on a compiler that does not actually do the alignment
|
||||
* can be dangerous since it will not expose bugs that ignore alignment.
|
||||
* E.g if an object of this class in inside a struct or class, and some code
|
||||
* memcopys data in it assuming tight packing. This could break on a compiler
|
||||
* that eventually start aligning the matrix.
|
||||
*---------------------------------------------------------------------------
|
||||
*/
|
||||
#ifdef __cplusplus
|
||||
typedef struct _D3DXMATRIXA16 : public D3DXMATRIX
|
||||
{
|
||||
@ -385,35 +385,31 @@ typedef struct _D3DXMATRIXA16 : public D3DXMATRIX
|
||||
FLOAT _31, FLOAT _32, FLOAT _33, FLOAT _34,
|
||||
FLOAT _41, FLOAT _42, FLOAT _43, FLOAT _44 );
|
||||
|
||||
// new operators
|
||||
/* new operators */
|
||||
void* operator new ( size_t );
|
||||
void* operator new[] ( size_t );
|
||||
|
||||
// delete operators
|
||||
void operator delete ( void* ); // These are NOT virtual; Do not
|
||||
void operator delete[] ( void* ); // cast to D3DXMATRIX and delete.
|
||||
/* delete operators */
|
||||
void operator delete ( void* ); /* These are NOT virtual; Do not */
|
||||
void operator delete[] ( void* ); /* cast to D3DXMATRIX and delete. */
|
||||
|
||||
// assignment operators
|
||||
/* assignment operators */
|
||||
_D3DXMATRIXA16& operator = ( CONST D3DXMATRIX& );
|
||||
|
||||
} _D3DXMATRIXA16;
|
||||
|
||||
#else //!__cplusplus
|
||||
#else /* !__cplusplus */
|
||||
typedef D3DXMATRIX _D3DXMATRIXA16;
|
||||
#endif //!__cplusplus
|
||||
#endif /* !__cplusplus */
|
||||
|
||||
|
||||
|
||||
#if _MSC_VER >= 1300 // VC7
|
||||
#if _MSC_VER >= 1300 /* VC7 */
|
||||
#define D3DX_ALIGN16 __declspec(align(16))
|
||||
#else
|
||||
#define D3DX_ALIGN16 // Earlier compiler may not understand this, do nothing.
|
||||
#define D3DX_ALIGN16 /* Earlier compiler may not understand this, do nothing. */
|
||||
#endif
|
||||
|
||||
typedef D3DX_ALIGN16 _D3DXMATRIXA16 D3DXMATRIXA16, *LPD3DXMATRIXA16;
|
||||
|
||||
|
||||
|
||||
//===========================================================================
|
||||
//
|
||||
// Quaternions
|
||||
@ -898,7 +894,7 @@ BOOL D3DXMatrixIsIdentity
|
||||
( CONST D3DXMATRIX *pM );
|
||||
|
||||
|
||||
// non-inline
|
||||
/* non-inline */
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
@ -1062,19 +1058,19 @@ D3DXMATRIX* WINAPI D3DXMatrixReflect
|
||||
// Quaternion
|
||||
//--------------------------
|
||||
|
||||
// inline
|
||||
/* inline */
|
||||
|
||||
FLOAT D3DXQuaternionLength
|
||||
( CONST D3DXQUATERNION *pQ );
|
||||
|
||||
// Length squared, or "norm"
|
||||
/* Length squared, or "norm" */
|
||||
FLOAT D3DXQuaternionLengthSq
|
||||
( CONST D3DXQUATERNION *pQ );
|
||||
|
||||
FLOAT D3DXQuaternionDot
|
||||
( CONST D3DXQUATERNION *pQ1, CONST D3DXQUATERNION *pQ2 );
|
||||
|
||||
// (0, 0, 0, 1)
|
||||
/* (0, 0, 0, 1) */
|
||||
D3DXQUATERNION* D3DXQuaternionIdentity
|
||||
( D3DXQUATERNION *pOut );
|
||||
|
||||
@ -1513,11 +1509,12 @@ HRESULT WINAPI D3DXSHProjectCubeMap
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#if 0
|
||||
#include "d3dx9math.inl"
|
||||
#endif
|
||||
|
||||
#if _MSC_VER >= 1200
|
||||
#pragma warning(pop)
|
||||
#endif
|
||||
|
||||
#endif // __D3DX9MATH_H__
|
||||
#endif /* __D3DX9MATH_H__ */
|
||||
|
@ -1577,7 +1577,9 @@ bool video_driver_supports_viewport_read(void)
|
||||
|
||||
bool video_driver_supports_read_frame_raw(void)
|
||||
{
|
||||
return current_video->read_frame_raw;
|
||||
if (current_video->read_frame_raw)
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
void video_driver_set_viewport_config(void)
|
||||
|
@ -403,9 +403,7 @@ typedef struct video_info
|
||||
*/
|
||||
unsigned input_scale;
|
||||
|
||||
#ifndef RARCH_INTERNAL
|
||||
uintptr_t parent;
|
||||
#endif
|
||||
} video_info_t;
|
||||
|
||||
typedef struct video_frame_info
|
||||
|
@ -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*)
|
||||
|
@ -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*)
|
||||
|
@ -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*)
|
||||
|
@ -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*)
|
||||
|
@ -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*)
|
||||
|
@ -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*)
|
||||
|
@ -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*)
|
||||
|
@ -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));
|
||||
|
@ -342,7 +342,7 @@ static bool video_thread_handle_packet(
|
||||
case CMD_INIT:
|
||||
thr->driver_data = thr->driver->init(&thr->info,
|
||||
thr->input, thr->input_data);
|
||||
pkt.data.b = thr->driver_data;
|
||||
pkt.data.b = (thr->driver_data != NULL);
|
||||
thr->driver->viewport_info(thr->driver_data, &thr->vp);
|
||||
video_thread_reply(thr, &pkt);
|
||||
break;
|
||||
|
@ -309,6 +309,24 @@ VIDEO IMAGE
|
||||
/*============================================================
|
||||
VIDEO DRIVER
|
||||
============================================================ */
|
||||
#if defined(HAVE_D3D)
|
||||
#include "../gfx/common/d3d_common.c"
|
||||
#include "../gfx/drivers/d3d.c"
|
||||
#include "../gfx/drivers_context/d3d_ctx.c"
|
||||
|
||||
#if defined(HAVE_D3D8)
|
||||
#include "../gfx/drivers_renderchain/d3d8_renderchain.c"
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_D3D9)
|
||||
|
||||
#ifdef HAVE_CG
|
||||
#include "../gfx/drivers_renderchain/d3d9_cg_renderchain.c"
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
#if defined(GEKKO)
|
||||
#ifdef HW_RVL
|
||||
@ -395,6 +413,10 @@ FONTS
|
||||
#include "../gfx/drivers_font_renderer/bitmapfont.c"
|
||||
#include "../gfx/font_driver.c"
|
||||
|
||||
#if defined(HAVE_D3D9) && !defined(_XBOX)
|
||||
#include "../gfx/drivers_font/d3d_w32_font.c"
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_STB_FONT)
|
||||
#include "../gfx/drivers_font_renderer/stb_unicode.c"
|
||||
#include "../gfx/drivers_font_renderer/stb.c"
|
||||
@ -662,6 +684,10 @@ AUDIO
|
||||
#include "../audio/drivers/ctr_dsp_audio.c"
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_XAUDIO
|
||||
#include "../audio/drivers/xaudio.c"
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_SDL2)
|
||||
#include "../audio/drivers/sdl_audio.c"
|
||||
#endif
|
||||
@ -807,6 +833,11 @@ FRONTEND
|
||||
#if defined(_WIN32) && !defined(_XBOX)
|
||||
#include "../frontend/drivers/platform_win32.c"
|
||||
#endif
|
||||
|
||||
#ifdef _XBOX
|
||||
#include "../frontend/drivers/platform_xdk.c"
|
||||
#endif
|
||||
|
||||
#if defined(__CELLOS_LV2__)
|
||||
#include "../frontend/drivers/platform_ps3.c"
|
||||
#elif defined(GEKKO)
|
||||
@ -844,6 +875,7 @@ UI
|
||||
|
||||
#if defined(_WIN32) && !defined(_XBOX)
|
||||
#include "../ui/drivers/ui_win32.c"
|
||||
#include "../ui/drivers/win32/ui_win32_window.c"
|
||||
#include "../ui/drivers/win32/ui_win32_browser_window.c"
|
||||
#include "../ui/drivers/win32/ui_win32_msg_window.c"
|
||||
#include "../ui/drivers/win32/ui_win32_application.c"
|
||||
@ -1026,6 +1058,10 @@ MENU
|
||||
|
||||
#include "../menu/drivers_display/menu_display_null.c"
|
||||
|
||||
#if defined(HAVE_D3D)
|
||||
#include "../menu/drivers_display/menu_display_d3d.c"
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_OPENGL
|
||||
#include "../menu/drivers_display/menu_display_gl.c"
|
||||
#endif
|
||||
|
@ -90,13 +90,6 @@
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/*============================================================
|
||||
AUDIO
|
||||
============================================================ */
|
||||
#ifdef HAVE_XAUDIO
|
||||
#include "../audio/drivers/xaudio.cpp"
|
||||
#endif
|
||||
|
||||
/*============================================================
|
||||
MENU
|
||||
============================================================ */
|
||||
@ -104,16 +97,11 @@ MENU
|
||||
#include "../menu/drivers/xui.cpp"
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_D3D)
|
||||
#include "../menu/drivers_display/menu_display_d3d.cpp"
|
||||
#endif
|
||||
|
||||
/*============================================================
|
||||
VIDEO CONTEXT
|
||||
============================================================ */
|
||||
|
||||
#if defined(HAVE_D3D)
|
||||
#include "../gfx/drivers_context/d3d_ctx.cpp"
|
||||
|
||||
#ifdef HAVE_HLSL
|
||||
#include "../gfx/drivers_shader/shader_hlsl.cpp"
|
||||
@ -123,11 +111,6 @@ VIDEO CONTEXT
|
||||
/*============================================================
|
||||
UI
|
||||
============================================================ */
|
||||
|
||||
#if defined(_WIN32) && !defined(_XBOX)
|
||||
#include "../ui/drivers/win32/ui_win32_window.cpp"
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_QT)
|
||||
#include "../ui/drivers/ui_qt.cpp"
|
||||
|
||||
@ -144,31 +127,10 @@ UI
|
||||
/*============================================================
|
||||
VIDEO DRIVER
|
||||
============================================================ */
|
||||
#ifdef _XBOX
|
||||
#include "../frontend/drivers/platform_xdk.cpp"
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_D3D)
|
||||
#include "../gfx/common/d3d_common.cpp"
|
||||
#include "../gfx/drivers/d3d.cpp"
|
||||
|
||||
|
||||
#if defined(HAVE_D3D8)
|
||||
#include "../gfx/drivers_renderchain/d3d8_renderchain.cpp"
|
||||
#elif defined(HAVE_D3D9)
|
||||
|
||||
#ifdef HAVE_HLSL
|
||||
#if defined(HAVE_D3D) && defined(HAVE_D3D9) && defined(HAVE_HLSL)
|
||||
#include "../gfx/drivers_renderchain/d3d9_hlsl_renderchain.cpp"
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_CG
|
||||
#include "../gfx/drivers_renderchain/d3d9_cg_renderchain.cpp"
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_VULKAN
|
||||
#include "../gfx/drivers_shader/shader_vulkan.cpp"
|
||||
#include "../gfx/drivers_shader/glslang_util.cpp"
|
||||
@ -180,11 +142,6 @@ VIDEO DRIVER
|
||||
/*============================================================
|
||||
FONTS
|
||||
============================================================ */
|
||||
|
||||
#if defined(HAVE_D3D9) && !defined(_XBOX)
|
||||
#include "../gfx/drivers_font/d3d_w32_font.cpp"
|
||||
#endif
|
||||
|
||||
#if defined(_XBOX360)
|
||||
#include "../gfx/drivers_font/xdk360_fonts.cpp"
|
||||
#endif
|
||||
|
@ -59,10 +59,12 @@ static int16_t ctr_input_state(void *data,
|
||||
switch (device)
|
||||
{
|
||||
case RETRO_DEVICE_JOYPAD:
|
||||
return input_joypad_pressed(ctr->joypad, joypad_info, port, binds[port], id);
|
||||
return input_joypad_pressed(ctr->joypad,
|
||||
joypad_info, port, binds[port], id);
|
||||
case RETRO_DEVICE_ANALOG:
|
||||
if (binds[port])
|
||||
return input_joypad_analog(ctr->joypad, joypad_info, port, idx, id, binds[port]);
|
||||
return input_joypad_analog(ctr->joypad,
|
||||
joypad_info, port, idx, id, binds[port]);
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -53,10 +53,12 @@ static int16_t gx_input_state(void *data,
|
||||
switch (device)
|
||||
{
|
||||
case RETRO_DEVICE_JOYPAD:
|
||||
return input_joypad_pressed(gx->joypad, joypad_info, port, binds[port], id);
|
||||
return input_joypad_pressed(gx->joypad,
|
||||
joypad_info, port, binds[port], id);
|
||||
case RETRO_DEVICE_ANALOG:
|
||||
if (binds[port])
|
||||
return input_joypad_analog(gx->joypad, joypad_info, port, idx, id, binds[port]);
|
||||
return input_joypad_analog(gx->joypad,
|
||||
joypad_info, port, idx, id, binds[port]);
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -36,9 +36,9 @@
|
||||
#define MAX_PADS 5
|
||||
|
||||
static unsigned char keyboardChannel = 0x00;
|
||||
static KBDModifier keyboardModifier = 0x00;
|
||||
static unsigned char keyboardCode = 0x00;
|
||||
static KEYState keyboardState[256] = { KBD_WIIU_NULL };
|
||||
static KBDModifier keyboardModifier = 0x00;
|
||||
static unsigned char keyboardCode = 0x00;
|
||||
static KEYState keyboardState[256] = { KBD_WIIU_NULL };
|
||||
|
||||
typedef struct wiiu_input
|
||||
{
|
||||
|
@ -22,14 +22,6 @@
|
||||
#include "../../gfx/video_driver.h"
|
||||
#include "../../verbosity.h"
|
||||
|
||||
#define WINRAW_LOG(msg) RARCH_LOG("[WINRAW]: "msg"\n")
|
||||
#define WINRAW_ERR(err) RARCH_ERR("[WINRAW]: "err"\n")
|
||||
|
||||
#define WINRAW_SYS_WRN(fun)\
|
||||
RARCH_WARN("[WINRAW]: "fun" failed with error %lu.\n", GetLastError())
|
||||
#define WINRAW_SYS_ERR(fun)\
|
||||
RARCH_ERR("[WINRAW]: "fun" failed with error %lu.\n", GetLastError())
|
||||
|
||||
typedef struct
|
||||
{
|
||||
uint8_t keys[256];
|
||||
@ -45,12 +37,12 @@ typedef struct
|
||||
|
||||
typedef struct
|
||||
{
|
||||
winraw_keyboard_t keyboard;
|
||||
winraw_mouse_t *mice;
|
||||
const input_device_driver_t *joypad;
|
||||
HWND window;
|
||||
bool kbd_mapp_block;
|
||||
bool mouse_grab;
|
||||
winraw_keyboard_t keyboard;
|
||||
HWND window;
|
||||
winraw_mouse_t *mice;
|
||||
const input_device_driver_t *joypad;
|
||||
} winraw_input_t;
|
||||
|
||||
static winraw_keyboard_t *g_keyboard = NULL;
|
||||
@ -69,7 +61,7 @@ static HWND winraw_create_window(WNDPROC wnd_proc)
|
||||
|
||||
if (!wc.hInstance)
|
||||
{
|
||||
WINRAW_SYS_ERR("GetModuleHandleA");
|
||||
RARCH_ERR("[WINRAW]: GetModuleHandleA failed with error %lu.\n", GetLastError());
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@ -77,7 +69,7 @@ static HWND winraw_create_window(WNDPROC wnd_proc)
|
||||
wc.lpszClassName = "winraw-input";
|
||||
if (!RegisterClassA(&wc) && GetLastError() != ERROR_CLASS_ALREADY_EXISTS)
|
||||
{
|
||||
WINRAW_SYS_ERR("RegisterClassA");
|
||||
RARCH_ERR("[WINRAW]: RegisterClassA failed with error %lu.\n", GetLastError());
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@ -85,7 +77,7 @@ static HWND winraw_create_window(WNDPROC wnd_proc)
|
||||
HWND_MESSAGE, NULL, NULL, NULL);
|
||||
if (!wnd)
|
||||
{
|
||||
WINRAW_SYS_ERR("CreateWindowExA");
|
||||
RARCH_ERR("[WINRAW]: CreateWindowExA failed with error %lu.\n", GetLastError());
|
||||
goto error;
|
||||
}
|
||||
|
||||
@ -106,12 +98,16 @@ static void winraw_destroy_window(HWND wnd)
|
||||
r = DestroyWindow(wnd);
|
||||
|
||||
if (!r)
|
||||
WINRAW_SYS_WRN("DestroyWindow");
|
||||
{
|
||||
RARCH_WARN("[WINRAW]: DestroyWindow failed with error %lu.\n", GetLastError());
|
||||
}
|
||||
|
||||
r = UnregisterClassA("winraw-input", NULL);
|
||||
|
||||
if (!r)
|
||||
WINRAW_SYS_WRN("UnregisterClassA");
|
||||
{
|
||||
RARCH_WARN("[WINRAW]: UnregisterClassA failed with error %lu.\n", GetLastError());
|
||||
}
|
||||
}
|
||||
|
||||
static bool winraw_set_keyboard_input(HWND window)
|
||||
@ -128,7 +124,7 @@ static bool winraw_set_keyboard_input(HWND window)
|
||||
|
||||
if (!r)
|
||||
{
|
||||
WINRAW_SYS_ERR("RegisterRawInputDevices");
|
||||
RARCH_ERR("[WINRAW]: RegisterRawInputDevices failed with error %lu.\n", GetLastError());
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -137,10 +133,10 @@ static bool winraw_set_keyboard_input(HWND window)
|
||||
|
||||
static void winraw_log_mice_info(winraw_mouse_t *mice, unsigned mouse_cnt)
|
||||
{
|
||||
char name[256];
|
||||
UINT name_size = sizeof(name);
|
||||
UINT r;
|
||||
unsigned i;
|
||||
char name[256];
|
||||
UINT name_size = sizeof(name);
|
||||
|
||||
for (i = 0; i < mouse_cnt; ++i)
|
||||
{
|
||||
@ -153,31 +149,29 @@ static void winraw_log_mice_info(winraw_mouse_t *mice, unsigned mouse_cnt)
|
||||
|
||||
static bool winraw_init_devices(winraw_mouse_t **mice, unsigned *mouse_cnt)
|
||||
{
|
||||
UINT r, i;
|
||||
UINT i;
|
||||
POINT crs_pos;
|
||||
winraw_mouse_t *mice_r = NULL;
|
||||
unsigned mouse_cnt_r = 0;
|
||||
RAWINPUTDEVICELIST *devs = NULL;
|
||||
UINT dev_cnt = 0;
|
||||
UINT r = GetRawInputDeviceList(
|
||||
NULL, &dev_cnt, sizeof(RAWINPUTDEVICELIST));
|
||||
|
||||
r = GetRawInputDeviceList(NULL, &dev_cnt, sizeof(RAWINPUTDEVICELIST));
|
||||
if (r == (UINT)-1)
|
||||
{
|
||||
WINRAW_SYS_ERR("GetRawInputDeviceList");
|
||||
RARCH_ERR("[WINRAW]: GetRawInputDeviceList failed with error %lu.\n", GetLastError());
|
||||
goto error;
|
||||
}
|
||||
|
||||
devs = (RAWINPUTDEVICELIST*)malloc(dev_cnt * sizeof(RAWINPUTDEVICELIST));
|
||||
if (!devs)
|
||||
{
|
||||
WINRAW_ERR("malloc failed");
|
||||
goto error;
|
||||
}
|
||||
|
||||
dev_cnt = GetRawInputDeviceList(devs, &dev_cnt, sizeof(RAWINPUTDEVICELIST));
|
||||
if (dev_cnt == (UINT)-1)
|
||||
{
|
||||
WINRAW_SYS_ERR("GetRawInputDeviceList");
|
||||
RARCH_ERR("[WINRAW]: GetRawInputDeviceList failed with error %lu.\n", GetLastError());
|
||||
goto error;
|
||||
}
|
||||
|
||||
@ -191,10 +185,7 @@ static bool winraw_init_devices(winraw_mouse_t **mice, unsigned *mouse_cnt)
|
||||
goto error;
|
||||
|
||||
if (!GetCursorPos(&crs_pos))
|
||||
{
|
||||
WINRAW_SYS_WRN("GetCursorPos");
|
||||
goto error;
|
||||
}
|
||||
|
||||
for (i = 0; i < mouse_cnt_r; ++i)
|
||||
{
|
||||
@ -243,7 +234,7 @@ static bool winraw_set_mouse_input(HWND window, bool grab)
|
||||
|
||||
if (!r)
|
||||
{
|
||||
WINRAW_SYS_ERR("RegisterRawInputDevices");
|
||||
RARCH_ERR("[WINRAW]: RegisterRawInputDevice failed with error %lu.\n", GetLastError());
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -356,9 +347,13 @@ static void winraw_update_mouse_state(winraw_mouse_t *mouse, RAWMOUSE *state)
|
||||
InterlockedExchangeAdd(&mouse->dlt_y, state->lLastY);
|
||||
|
||||
if (!GetCursorPos(&crs_pos))
|
||||
WINRAW_SYS_WRN("GetCursorPos");
|
||||
{
|
||||
RARCH_WARN("[WINRAW]: GetCursorPos failed with error %lu.\n", GetLastError());
|
||||
}
|
||||
else if (!ScreenToClient((HWND)video_driver_window_get(), &crs_pos))
|
||||
WINRAW_SYS_WRN("ScreenToClient");
|
||||
{
|
||||
RARCH_WARN("[WINRAW]: ScreenToClient failed with error %lu.\n", GetLastError());
|
||||
}
|
||||
else
|
||||
{
|
||||
mouse->x = crs_pos.x;
|
||||
@ -401,13 +396,16 @@ static LRESULT CALLBACK winraw_callback(HWND wnd, UINT msg, WPARAM wpar, LPARAM
|
||||
if (msg != WM_INPUT)
|
||||
return DefWindowProcA(wnd, msg, wpar, lpar);
|
||||
|
||||
if (GET_RAWINPUT_CODE_WPARAM(wpar) != RIM_INPUT) /* app is in the background */
|
||||
/* app is in the background */
|
||||
if (GET_RAWINPUT_CODE_WPARAM(wpar) != RIM_INPUT)
|
||||
goto end;
|
||||
|
||||
r = GetRawInputData((HRAWINPUT)lpar, RID_INPUT, data, &size, sizeof(RAWINPUTHEADER));
|
||||
r = GetRawInputData((HRAWINPUT)lpar, RID_INPUT,
|
||||
data, &size, sizeof(RAWINPUTHEADER));
|
||||
if (r == (UINT)-1)
|
||||
{
|
||||
WINRAW_SYS_WRN("GetRawInputData");
|
||||
RARCH_WARN("[WINRAW]: GetRawInputData failed with error %lu.\n",
|
||||
GetLastError());
|
||||
goto end;
|
||||
}
|
||||
|
||||
@ -438,61 +436,50 @@ end:
|
||||
static void *winraw_init(const char *joypad_driver)
|
||||
{
|
||||
bool r;
|
||||
winraw_input_t *wr = (winraw_input_t *)calloc(1, sizeof(winraw_input_t));
|
||||
g_keyboard = (winraw_keyboard_t*)calloc(1, sizeof(winraw_keyboard_t));
|
||||
winraw_input_t *wr = (winraw_input_t *)
|
||||
calloc(1, sizeof(winraw_input_t));
|
||||
g_keyboard = (winraw_keyboard_t*)
|
||||
calloc(1, sizeof(winraw_keyboard_t));
|
||||
|
||||
if (!wr || !g_keyboard)
|
||||
goto error;
|
||||
|
||||
WINRAW_LOG("Initializing input driver ...");
|
||||
RARCH_LOG("[WINRAW]: Initializing input driver... \n");
|
||||
|
||||
input_keymaps_init_keyboard_lut(rarch_key_map_winraw);
|
||||
|
||||
wr->window = winraw_create_window(winraw_callback);
|
||||
if (!wr->window)
|
||||
{
|
||||
WINRAW_ERR("winraw_create_window failed.");
|
||||
goto error;
|
||||
}
|
||||
|
||||
r = winraw_init_devices(&g_mice, &g_mouse_cnt);
|
||||
if (!r)
|
||||
{
|
||||
WINRAW_ERR("winraw_init_devices failed.");
|
||||
goto error;
|
||||
}
|
||||
|
||||
if (!g_mouse_cnt)
|
||||
WINRAW_LOG("Mouse unavailable.");
|
||||
{
|
||||
RARCH_LOG("[WINRAW]: Mouse unavailable.\n");
|
||||
}
|
||||
else
|
||||
{
|
||||
wr->mice = (winraw_mouse_t*)malloc(g_mouse_cnt * sizeof(winraw_mouse_t));
|
||||
wr->mice = (winraw_mouse_t*)
|
||||
malloc(g_mouse_cnt * sizeof(winraw_mouse_t));
|
||||
if (!wr->mice)
|
||||
{
|
||||
WINRAW_ERR("malloc failed.");
|
||||
goto error;
|
||||
}
|
||||
|
||||
memcpy(wr->mice, g_mice, g_mouse_cnt * sizeof(winraw_mouse_t));
|
||||
}
|
||||
|
||||
r = winraw_set_keyboard_input(wr->window);
|
||||
if (!r)
|
||||
{
|
||||
WINRAW_ERR("winraw_set_keyboard_input failed.");
|
||||
goto error;
|
||||
}
|
||||
|
||||
r = winraw_set_mouse_input(wr->window, false);
|
||||
if (!r)
|
||||
{
|
||||
WINRAW_ERR("winraw_set_mouse_input failed.");
|
||||
goto error;
|
||||
}
|
||||
|
||||
wr->joypad = input_joypad_init_driver(joypad_driver, wr);
|
||||
|
||||
WINRAW_LOG("Input driver initialized.");
|
||||
return wr;
|
||||
|
||||
error:
|
||||
@ -507,7 +494,6 @@ error:
|
||||
if (wr)
|
||||
free(wr->mice);
|
||||
free(wr);
|
||||
WINRAW_ERR("Input driver initialization failed.");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@ -528,8 +514,8 @@ static void winraw_poll(void *d)
|
||||
|
||||
for (i = 0; i < g_mouse_cnt; ++i)
|
||||
{
|
||||
wr->mice[i].x = g_mice[i].x;
|
||||
wr->mice[i].y = g_mice[i].y;
|
||||
wr->mice[i].x = g_mice[i].x;
|
||||
wr->mice[i].y = g_mice[i].y;
|
||||
wr->mice[i].dlt_x = InterlockedExchange(&g_mice[i].dlt_x, 0);
|
||||
wr->mice[i].dlt_y = InterlockedExchange(&g_mice[i].dlt_y, 0);
|
||||
wr->mice[i].whl_u = InterlockedExchange(&g_mice[i].whl_u, 0);
|
||||
@ -583,8 +569,6 @@ static void winraw_free(void *d)
|
||||
{
|
||||
winraw_input_t *wr = (winraw_input_t*)d;
|
||||
|
||||
WINRAW_LOG("Deinitializing input driver ...");
|
||||
|
||||
if (wr->joypad)
|
||||
wr->joypad->destroy();
|
||||
winraw_set_mouse_input(NULL, false);
|
||||
@ -596,8 +580,6 @@ static void winraw_free(void *d)
|
||||
free(wr);
|
||||
|
||||
g_mouse_xy_mapping_ready = false;
|
||||
|
||||
WINRAW_LOG("Input driver deinitialized.");
|
||||
}
|
||||
|
||||
static uint64_t winraw_get_capabilities(void *u)
|
||||
@ -610,18 +592,15 @@ static uint64_t winraw_get_capabilities(void *u)
|
||||
|
||||
static void winraw_grab_mouse(void *d, bool grab)
|
||||
{
|
||||
bool r = false;
|
||||
winraw_input_t *wr = (winraw_input_t*)d;
|
||||
bool r;
|
||||
|
||||
if (grab == wr->mouse_grab)
|
||||
return;
|
||||
|
||||
r = winraw_set_mouse_input(wr->window, grab);
|
||||
if (!r)
|
||||
{
|
||||
WINRAW_ERR("Mouse grab failed.");
|
||||
return;
|
||||
}
|
||||
|
||||
wr->mouse_grab = grab;
|
||||
}
|
||||
|
@ -112,15 +112,18 @@ 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
|
||||
#if 0
|
||||
XINPUT_VIBRATION rumble_state;
|
||||
#endif
|
||||
#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)
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -2318,7 +2318,10 @@ void input_config_parse_joy_button(void *data, const char *prefix,
|
||||
|
||||
if (config_get_string(conf, key_label, &tmp_a))
|
||||
{
|
||||
strlcpy(bind->joykey_label, tmp_a, sizeof(bind->joykey_label));
|
||||
if (!string_is_empty(bind->joykey_label))
|
||||
free(bind->joykey_label);
|
||||
|
||||
bind->joykey_label = strdup(tmp_a);
|
||||
free(tmp_a);
|
||||
}
|
||||
}
|
||||
@ -2361,7 +2364,10 @@ void input_config_parse_joy_axis(void *data, const char *prefix,
|
||||
|
||||
if (config_get_string(conf, key_label, &tmp_a))
|
||||
{
|
||||
strlcpy(bind->joyaxis_label, tmp_a, sizeof(bind->joyaxis_label));
|
||||
if (bind->joyaxis_label &&
|
||||
!string_is_empty(bind->joyaxis_label))
|
||||
free(bind->joyaxis_label);
|
||||
bind->joyaxis_label = strdup(tmp_a);
|
||||
free(tmp_a);
|
||||
}
|
||||
}
|
||||
@ -2375,7 +2381,8 @@ static void input_config_get_bind_string_joykey(
|
||||
|
||||
if (GET_HAT_DIR(bind->joykey))
|
||||
{
|
||||
if (!string_is_empty(bind->joykey_label) && label_show)
|
||||
if (bind->joykey_label &&
|
||||
!string_is_empty(bind->joykey_label) && label_show)
|
||||
snprintf(buf, size, "%s %s ", prefix, bind->joykey_label);
|
||||
else
|
||||
{
|
||||
@ -2405,7 +2412,8 @@ static void input_config_get_bind_string_joykey(
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!string_is_empty(bind->joykey_label) && label_show)
|
||||
if (bind->joykey_label &&
|
||||
!string_is_empty(bind->joykey_label) && label_show)
|
||||
snprintf(buf, size, "%s%s (btn) ", prefix, bind->joykey_label);
|
||||
else
|
||||
snprintf(buf, size, "%s%u (%s) ", prefix, (unsigned)bind->joykey,
|
||||
@ -2418,7 +2426,8 @@ static void input_config_get_bind_string_joyaxis(char *buf, const char *prefix,
|
||||
{
|
||||
settings_t *settings = config_get_ptr();
|
||||
|
||||
if (!string_is_empty(bind->joyaxis_label)
|
||||
if (bind->joyaxis_label &&
|
||||
!string_is_empty(bind->joyaxis_label)
|
||||
&& settings->bools.input_descriptor_label_show)
|
||||
snprintf(buf, size, "%s%s (axis) ", prefix, bind->joyaxis_label);
|
||||
else
|
||||
|
@ -114,8 +114,8 @@ struct retro_keybind
|
||||
/* Used by input_{push,pop}_analog_dpad(). */
|
||||
uint32_t orig_joyaxis;
|
||||
|
||||
char joykey_label[64];
|
||||
char joyaxis_label[64];
|
||||
char *joykey_label;
|
||||
char *joyaxis_label;
|
||||
};
|
||||
|
||||
typedef struct rarch_joypad_info
|
||||
|
@ -96,27 +96,34 @@ enum overlay_image_transfer_status
|
||||
|
||||
struct overlay
|
||||
{
|
||||
unsigned id;
|
||||
bool full_screen;
|
||||
bool block_scale;
|
||||
|
||||
struct overlay_desc *descs;
|
||||
size_t size;
|
||||
size_t pos;
|
||||
unsigned load_images_size;
|
||||
unsigned id;
|
||||
unsigned pos_increment;
|
||||
|
||||
struct texture_image image;
|
||||
size_t size;
|
||||
size_t pos;
|
||||
|
||||
bool block_scale;
|
||||
float mod_x, mod_y, mod_w, mod_h;
|
||||
float x, y, w, h;
|
||||
float scale;
|
||||
float center_x, center_y;
|
||||
|
||||
bool full_screen;
|
||||
struct overlay_desc *descs;
|
||||
struct texture_image *load_images;
|
||||
|
||||
struct texture_image image;
|
||||
|
||||
char name[64];
|
||||
|
||||
struct
|
||||
{
|
||||
bool normalized;
|
||||
float alpha_mod;
|
||||
float range_mod;
|
||||
|
||||
struct
|
||||
{
|
||||
char key[64];
|
||||
@ -140,41 +147,36 @@ struct overlay
|
||||
unsigned size;
|
||||
} descs;
|
||||
|
||||
bool normalized;
|
||||
float alpha_mod;
|
||||
float range_mod;
|
||||
} config;
|
||||
|
||||
struct texture_image *load_images;
|
||||
unsigned load_images_size;
|
||||
};
|
||||
|
||||
struct overlay_desc
|
||||
{
|
||||
float x;
|
||||
float y;
|
||||
|
||||
enum overlay_hitbox hitbox;
|
||||
float range_x, range_y;
|
||||
float range_x_mod, range_y_mod;
|
||||
float mod_x, mod_y, mod_w, mod_h;
|
||||
float delta_x, delta_y;
|
||||
|
||||
enum overlay_type type;
|
||||
uint64_t key_mask;
|
||||
float analog_saturate_pct;
|
||||
|
||||
bool updated;
|
||||
bool movable;
|
||||
|
||||
unsigned next_index;
|
||||
char next_index_name[64];
|
||||
|
||||
struct texture_image image;
|
||||
unsigned image_index;
|
||||
|
||||
float alpha_mod;
|
||||
float range_mod;
|
||||
float analog_saturate_pct;
|
||||
float range_x, range_y;
|
||||
float range_x_mod, range_y_mod;
|
||||
float mod_x, mod_y, mod_w, mod_h;
|
||||
float delta_x, delta_y;
|
||||
float x;
|
||||
float y;
|
||||
|
||||
bool updated;
|
||||
bool movable;
|
||||
uint64_t key_mask;
|
||||
|
||||
char next_index_name[64];
|
||||
|
||||
struct texture_image image;
|
||||
};
|
||||
|
||||
typedef struct overlay_desc overlay_desc_t;
|
||||
@ -183,13 +185,13 @@ typedef struct input_overlay input_overlay_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
struct overlay *overlays;
|
||||
struct overlay *active;
|
||||
size_t size;
|
||||
bool hide_in_menu;
|
||||
bool overlay_enable;
|
||||
size_t size;
|
||||
float overlay_opacity;
|
||||
float overlay_scale;
|
||||
struct overlay *overlays;
|
||||
struct overlay *active;
|
||||
} overlay_task_data_t;
|
||||
|
||||
/**
|
||||
|
@ -46,8 +46,10 @@ bool input_remapping_load_file(void *data, const char *path)
|
||||
if (!conf || string_is_empty(path))
|
||||
return false;
|
||||
|
||||
strlcpy(global->name.remapfile, path,
|
||||
sizeof(global->name.remapfile));
|
||||
if (global->name.remapfile
|
||||
&& !string_is_empty(global->name.remapfile))
|
||||
free(global->name.remapfile);
|
||||
global->name.remapfile = strdup(path);
|
||||
|
||||
for (i = 0; i < MAX_USERS; i++)
|
||||
{
|
||||
@ -257,7 +259,10 @@ void input_remapping_set_defaults(bool deinit)
|
||||
|
||||
if (deinit)
|
||||
{
|
||||
global->name.remapfile[0] = '\0';
|
||||
if (global->name.remapfile
|
||||
&& !string_is_empty(global->name.remapfile))
|
||||
free(global->name.remapfile);
|
||||
global->name.remapfile = NULL;
|
||||
rarch_ctl(RARCH_CTL_UNSET_REMAPS_CORE_ACTIVE, NULL);
|
||||
rarch_ctl(RARCH_CTL_UNSET_REMAPS_GAME_ACTIVE, NULL);
|
||||
}
|
||||
|
@ -48,30 +48,27 @@
|
||||
|
||||
struct remote_message
|
||||
{
|
||||
uint16_t state;
|
||||
int port;
|
||||
int device;
|
||||
int index;
|
||||
int id;
|
||||
uint16_t state;
|
||||
};
|
||||
|
||||
struct input_remote
|
||||
{
|
||||
|
||||
bool state[RARCH_BIND_LIST_END];
|
||||
#if defined(HAVE_NETWORKING) && defined(HAVE_NETWORKGAMEPAD)
|
||||
int net_fd[MAX_USERS];
|
||||
#endif
|
||||
|
||||
bool state[RARCH_BIND_LIST_END];
|
||||
};
|
||||
|
||||
typedef struct input_remote_state
|
||||
{
|
||||
/* This is a bitmask of (1 << key_bind_id). */
|
||||
uint64_t buttons[MAX_USERS];
|
||||
/* Left X, Left Y, Right X, Right Y */
|
||||
int16_t analog[4][MAX_USERS];
|
||||
|
||||
/* This is a bitmask of (1 << key_bind_id). */
|
||||
uint64_t buttons[MAX_USERS];
|
||||
} input_remote_state_t;
|
||||
|
||||
static input_remote_state_t remote_st_ptr;
|
||||
@ -257,7 +254,7 @@ void input_remote_poll(input_remote_t *handle, unsigned max_users)
|
||||
else if ((ret != -1) || ((errno != EAGAIN) && (errno != ENOENT)))
|
||||
#endif
|
||||
{
|
||||
input_state->buttons[user] = 0;
|
||||
input_state->buttons[user] = 0;
|
||||
input_state->analog[0][user] = 0;
|
||||
input_state->analog[1][user] = 0;
|
||||
input_state->analog[2][user] = 0;
|
||||
|
@ -1,4 +1,4 @@
|
||||
MSG_HASH(
|
||||
MSG_HASH(
|
||||
MSG_COMPILER,
|
||||
"编译器"
|
||||
)
|
||||
@ -3017,9 +3017,9 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_CORE_DELETE,
|
||||
"Delete core")
|
||||
MSG_HASH(MENU_ENUM_SUBLABEL_CORE_DELETE,
|
||||
"Remove this core from disk.")
|
||||
MSG_HASH(MENU_ENUM_LABEL_VALUE_PLAYLIST_ENTRY_RENAME,
|
||||
MSG_HASH(MENU_ENUM_LABEL_VALUE_RENAME_ENTRY,
|
||||
"Rename the title of the entry.")
|
||||
MSG_HASH(MENU_ENUM_LABEL_PLAYLIST_ENTRY_RENAME,
|
||||
MSG_HASH(MENU_ENUM_LABEL_RENAME_ENTRY,
|
||||
"Rename")
|
||||
MSG_HASH(MENU_ENUM_LABEL_VALUE_MENU_FRAMEBUFFER_OPACITY,
|
||||
"Framebuffer Opacity")
|
||||
@ -3045,3 +3045,21 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_MATERIALUI_ICONS_ENABLE,
|
||||
"Menu Icons")
|
||||
MSG_HASH(MENU_ENUM_SUBLABEL_MATERIALUI_ICONS_ENABLE,
|
||||
"Enable/disable the menu icons shown at the lefthand side of the menu entries.")
|
||||
MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_MAIN_MENU_ENABLE_SETTINGS,
|
||||
"Enable Settings Tab")
|
||||
MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_SHOW_SETTINGS_PASSWORD,
|
||||
"Set Password For Enabling Settings Tab")
|
||||
MSG_HASH(MSG_INPUT_ENABLE_SETTINGS_PASSWORD,
|
||||
"Enter Password")
|
||||
MSG_HASH(MSG_INPUT_ENABLE_SETTINGS_PASSWORD_OK,
|
||||
"Password correct.")
|
||||
MSG_HASH(MSG_INPUT_ENABLE_SETTINGS_PASSWORD_NOK,
|
||||
"Password incorrect.")
|
||||
MSG_HASH(MENU_ENUM_SUBLABEL_XMB_MAIN_MENU_ENABLE_SETTINGS,
|
||||
"Enables the Settings tab. A restart is required for the tab to appear.")
|
||||
MSG_HASH(MENU_ENUM_SUBLABEL_XMB_SHOW_SETTINGS_PASSWORD,
|
||||
"Supplying a password when hiding the settings tab makes it possible to later restore it from the menu, by going to the Main Menu tab, selecting Enable Settings Tab and entering the password.")
|
||||
MSG_HASH(MENU_ENUM_SUBLABEL_PLAYLIST_ENTRY_RENAME,
|
||||
"Allow the user to rename entries in collections.")
|
||||
MSG_HASH(MENU_ENUM_LABEL_VALUE_PLAYLIST_ENTRY_RENAME,
|
||||
"Allow to rename entries")
|
||||
|
@ -1,4 +1,4 @@
|
||||
MSG_HASH(
|
||||
MSG_HASH(
|
||||
MSG_COMPILER,
|
||||
"編譯器"
|
||||
)
|
||||
@ -3017,9 +3017,9 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_CORE_DELETE,
|
||||
"Delete core")
|
||||
MSG_HASH(MENU_ENUM_SUBLABEL_CORE_DELETE,
|
||||
"Remove this core from disk.")
|
||||
MSG_HASH(MENU_ENUM_LABEL_VALUE_PLAYLIST_ENTRY_RENAME,
|
||||
MSG_HASH(MENU_ENUM_LABEL_VALUE_RENAME_ENTRY,
|
||||
"Rename the title of the entry.")
|
||||
MSG_HASH(MENU_ENUM_LABEL_PLAYLIST_ENTRY_RENAME,
|
||||
MSG_HASH(MENU_ENUM_LABEL_RENAME_ENTRY,
|
||||
"Rename")
|
||||
MSG_HASH(MENU_ENUM_LABEL_VALUE_MENU_FRAMEBUFFER_OPACITY,
|
||||
"Framebuffer Opacity")
|
||||
@ -3045,3 +3045,21 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_MATERIALUI_ICONS_ENABLE,
|
||||
"Menu Icons")
|
||||
MSG_HASH(MENU_ENUM_SUBLABEL_MATERIALUI_ICONS_ENABLE,
|
||||
"Enable/disable the menu icons shown at the lefthand side of the menu entries.")
|
||||
MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_MAIN_MENU_ENABLE_SETTINGS,
|
||||
"Enable Settings Tab")
|
||||
MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_SHOW_SETTINGS_PASSWORD,
|
||||
"Set Password For Enabling Settings Tab")
|
||||
MSG_HASH(MSG_INPUT_ENABLE_SETTINGS_PASSWORD,
|
||||
"Enter Password")
|
||||
MSG_HASH(MSG_INPUT_ENABLE_SETTINGS_PASSWORD_OK,
|
||||
"Password correct.")
|
||||
MSG_HASH(MSG_INPUT_ENABLE_SETTINGS_PASSWORD_NOK,
|
||||
"Password incorrect.")
|
||||
MSG_HASH(MENU_ENUM_SUBLABEL_XMB_MAIN_MENU_ENABLE_SETTINGS,
|
||||
"Enables the Settings tab. A restart is required for the tab to appear.")
|
||||
MSG_HASH(MENU_ENUM_SUBLABEL_XMB_SHOW_SETTINGS_PASSWORD,
|
||||
"Supplying a password when hiding the settings tab makes it possible to later restore it from the menu, by going to the Main Menu tab, selecting Enable Settings Tab and entering the password.")
|
||||
MSG_HASH(MENU_ENUM_SUBLABEL_PLAYLIST_ENTRY_RENAME,
|
||||
"Allow the user to rename entries in collections.")
|
||||
MSG_HASH(MENU_ENUM_LABEL_VALUE_PLAYLIST_ENTRY_RENAME,
|
||||
"Allow to rename entries")
|
||||
|
@ -3011,9 +3011,9 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_CORE_DELETE,
|
||||
"Delete core")
|
||||
MSG_HASH(MENU_ENUM_SUBLABEL_CORE_DELETE,
|
||||
"Remove this core from disk.")
|
||||
MSG_HASH(MENU_ENUM_LABEL_VALUE_PLAYLIST_ENTRY_RENAME,
|
||||
MSG_HASH(MENU_ENUM_LABEL_VALUE_RENAME_ENTRY,
|
||||
"Rename the title of the entry.")
|
||||
MSG_HASH(MENU_ENUM_LABEL_PLAYLIST_ENTRY_RENAME,
|
||||
MSG_HASH(MENU_ENUM_LABEL_RENAME_ENTRY,
|
||||
"Rename")
|
||||
MSG_HASH(MENU_ENUM_LABEL_VALUE_MENU_FRAMEBUFFER_OPACITY,
|
||||
"Framebuffer Opacity")
|
||||
@ -3039,3 +3039,21 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_MATERIALUI_ICONS_ENABLE,
|
||||
"Menu Icons")
|
||||
MSG_HASH(MENU_ENUM_SUBLABEL_MATERIALUI_ICONS_ENABLE,
|
||||
"Enable/disable the menu icons shown at the lefthand side of the menu entries.")
|
||||
MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_MAIN_MENU_ENABLE_SETTINGS,
|
||||
"Enable Settings Tab")
|
||||
MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_SHOW_SETTINGS_PASSWORD,
|
||||
"Set Password For Enabling Settings Tab")
|
||||
MSG_HASH(MSG_INPUT_ENABLE_SETTINGS_PASSWORD,
|
||||
"Enter Password")
|
||||
MSG_HASH(MSG_INPUT_ENABLE_SETTINGS_PASSWORD_OK,
|
||||
"Password correct.")
|
||||
MSG_HASH(MSG_INPUT_ENABLE_SETTINGS_PASSWORD_NOK,
|
||||
"Password incorrect.")
|
||||
MSG_HASH(MENU_ENUM_SUBLABEL_XMB_MAIN_MENU_ENABLE_SETTINGS,
|
||||
"Enables the Settings tab. A restart is required for the tab to appear.")
|
||||
MSG_HASH(MENU_ENUM_SUBLABEL_XMB_SHOW_SETTINGS_PASSWORD,
|
||||
"Supplying a password when hiding the settings tab makes it possible to later restore it from the menu, by going to the Main Menu tab, selecting Enable Settings Tab and entering the password.")
|
||||
MSG_HASH(MENU_ENUM_SUBLABEL_PLAYLIST_ENTRY_RENAME,
|
||||
"Allow the user to rename entries in collections.")
|
||||
MSG_HASH(MENU_ENUM_LABEL_VALUE_PLAYLIST_ENTRY_RENAME,
|
||||
"Allow to rename entries")
|
||||
|
@ -2880,9 +2880,9 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_CORE_DELETE,
|
||||
"Delete core")
|
||||
MSG_HASH(MENU_ENUM_SUBLABEL_CORE_DELETE,
|
||||
"Remove this core from disk.")
|
||||
MSG_HASH(MENU_ENUM_LABEL_VALUE_PLAYLIST_ENTRY_RENAME,
|
||||
MSG_HASH(MENU_ENUM_LABEL_VALUE_RENAME_ENTRY,
|
||||
"Rename the title of the entry.")
|
||||
MSG_HASH(MENU_ENUM_LABEL_PLAYLIST_ENTRY_RENAME,
|
||||
MSG_HASH(MENU_ENUM_LABEL_RENAME_ENTRY,
|
||||
"Rename")
|
||||
MSG_HASH(MENU_ENUM_LABEL_VALUE_MENU_FRAMEBUFFER_OPACITY,
|
||||
"Framebuffer Opacity")
|
||||
@ -2908,3 +2908,21 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_MATERIALUI_ICONS_ENABLE,
|
||||
"Menu Icons")
|
||||
MSG_HASH(MENU_ENUM_SUBLABEL_MATERIALUI_ICONS_ENABLE,
|
||||
"Enable/disable the menu icons shown at the lefthand side of the menu entries.")
|
||||
MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_MAIN_MENU_ENABLE_SETTINGS,
|
||||
"Enable Settings Tab")
|
||||
MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_SHOW_SETTINGS_PASSWORD,
|
||||
"Set Password For Enabling Settings Tab")
|
||||
MSG_HASH(MSG_INPUT_ENABLE_SETTINGS_PASSWORD,
|
||||
"Enter Password")
|
||||
MSG_HASH(MSG_INPUT_ENABLE_SETTINGS_PASSWORD_OK,
|
||||
"Password correct.")
|
||||
MSG_HASH(MSG_INPUT_ENABLE_SETTINGS_PASSWORD_NOK,
|
||||
"Password incorrect.")
|
||||
MSG_HASH(MENU_ENUM_SUBLABEL_XMB_MAIN_MENU_ENABLE_SETTINGS,
|
||||
"Enables the Settings tab. A restart is required for the tab to appear.")
|
||||
MSG_HASH(MENU_ENUM_SUBLABEL_XMB_SHOW_SETTINGS_PASSWORD,
|
||||
"Supplying a password when hiding the settings tab makes it possible to later restore it from the menu, by going to the Main Menu tab, selecting Enable Settings Tab and entering the password.")
|
||||
MSG_HASH(MENU_ENUM_SUBLABEL_PLAYLIST_ENTRY_RENAME,
|
||||
"Allow the user to rename entries in collections.")
|
||||
MSG_HASH(MENU_ENUM_LABEL_VALUE_PLAYLIST_ENTRY_RENAME,
|
||||
"Allow to rename entries")
|
||||
|
@ -3049,9 +3049,9 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_CORE_DELETE,
|
||||
"Delete core")
|
||||
MSG_HASH(MENU_ENUM_SUBLABEL_CORE_DELETE,
|
||||
"Remove this core from disk.")
|
||||
MSG_HASH(MENU_ENUM_LABEL_VALUE_PLAYLIST_ENTRY_RENAME,
|
||||
MSG_HASH(MENU_ENUM_LABEL_VALUE_RENAME_ENTRY,
|
||||
"Rename the title of the entry.")
|
||||
MSG_HASH(MENU_ENUM_LABEL_PLAYLIST_ENTRY_RENAME,
|
||||
MSG_HASH(MENU_ENUM_LABEL_RENAME_ENTRY,
|
||||
"Rename")
|
||||
MSG_HASH(MENU_ENUM_LABEL_VALUE_MENU_FRAMEBUFFER_OPACITY,
|
||||
"Framebuffer Opacity")
|
||||
@ -3077,3 +3077,21 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_MATERIALUI_ICONS_ENABLE,
|
||||
"Menu Icons")
|
||||
MSG_HASH(MENU_ENUM_SUBLABEL_MATERIALUI_ICONS_ENABLE,
|
||||
"Enable/disable the menu icons shown at the lefthand side of the menu entries.")
|
||||
MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_MAIN_MENU_ENABLE_SETTINGS,
|
||||
"Enable Settings Tab")
|
||||
MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_SHOW_SETTINGS_PASSWORD,
|
||||
"Set Password For Enabling Settings Tab")
|
||||
MSG_HASH(MSG_INPUT_ENABLE_SETTINGS_PASSWORD,
|
||||
"Enter Password")
|
||||
MSG_HASH(MSG_INPUT_ENABLE_SETTINGS_PASSWORD_OK,
|
||||
"Password correct.")
|
||||
MSG_HASH(MSG_INPUT_ENABLE_SETTINGS_PASSWORD_NOK,
|
||||
"Password incorrect.")
|
||||
MSG_HASH(MENU_ENUM_SUBLABEL_XMB_MAIN_MENU_ENABLE_SETTINGS,
|
||||
"Enables the Settings tab. A restart is required for the tab to appear.")
|
||||
MSG_HASH(MENU_ENUM_SUBLABEL_XMB_SHOW_SETTINGS_PASSWORD,
|
||||
"Supplying a password when hiding the settings tab makes it possible to later restore it from the menu, by going to the Main Menu tab, selecting Enable Settings Tab and entering the password.")
|
||||
MSG_HASH(MENU_ENUM_SUBLABEL_PLAYLIST_ENTRY_RENAME,
|
||||
"Allow the user to rename entries in collections.")
|
||||
MSG_HASH(MENU_ENUM_LABEL_VALUE_PLAYLIST_ENTRY_RENAME,
|
||||
"Allow to rename entries")
|
||||
|
@ -3103,9 +3103,9 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_CORE_DELETE,
|
||||
"Cancella core")
|
||||
MSG_HASH(MENU_ENUM_SUBLABEL_CORE_DELETE,
|
||||
"Rimuove questo core dal disco.")
|
||||
MSG_HASH(MENU_ENUM_SUBLABEL_PLAYLIST_ENTRY_RENAME,
|
||||
MSG_HASH(MENU_ENUM_SUBLABEL_RENAME_ENTRY,
|
||||
"Rinomina la voce del titolo.")
|
||||
MSG_HASH(MENU_ENUM_LABEL_VALUE_PLAYLIST_ENTRY_RENAME,
|
||||
MSG_HASH(MENU_ENUM_LABEL_VALUE_RENAME_ENTRY,
|
||||
"Rinomina")
|
||||
MSG_HASH(MENU_ENUM_LABEL_VALUE_MENU_FRAMEBUFFER_OPACITY,
|
||||
"Opacità Framebuffer")
|
||||
@ -3131,3 +3131,21 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_MATERIALUI_ICONS_ENABLE,
|
||||
"Icone del Menu")
|
||||
MSG_HASH(MENU_ENUM_SUBLABEL_MATERIALUI_ICONS_ENABLE,
|
||||
"Abilita/disabilita le icone del menu visualizzate sul lato sinistro di ogni voce.")
|
||||
MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_MAIN_MENU_ENABLE_SETTINGS,
|
||||
"Enable Settings Tab")
|
||||
MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_SHOW_SETTINGS_PASSWORD,
|
||||
"Set Password For Enabling Settings Tab")
|
||||
MSG_HASH(MSG_INPUT_ENABLE_SETTINGS_PASSWORD,
|
||||
"Enter Password")
|
||||
MSG_HASH(MSG_INPUT_ENABLE_SETTINGS_PASSWORD_OK,
|
||||
"Password correct.")
|
||||
MSG_HASH(MSG_INPUT_ENABLE_SETTINGS_PASSWORD_NOK,
|
||||
"Password incorrect.")
|
||||
MSG_HASH(MENU_ENUM_SUBLABEL_XMB_MAIN_MENU_ENABLE_SETTINGS,
|
||||
"Enables the Settings tab. A restart is required for the tab to appear.")
|
||||
MSG_HASH(MENU_ENUM_SUBLABEL_XMB_SHOW_SETTINGS_PASSWORD,
|
||||
"Supplying a password when hiding the settings tab makes it possible to later restore it from the menu, by going to the Main Menu tab, selecting Enable Settings Tab and entering the password.")
|
||||
MSG_HASH(MENU_ENUM_SUBLABEL_PLAYLIST_ENTRY_RENAME,
|
||||
"Allow the user to rename entries in collections.")
|
||||
MSG_HASH(MENU_ENUM_LABEL_VALUE_PLAYLIST_ENTRY_RENAME,
|
||||
"Allow to rename entries")
|
||||
|
@ -1,4 +1,4 @@
|
||||
#if defined(_MSC_VER) && !defined(_XBOX)
|
||||
#if defined(_MSC_VER) && !defined(_XBOX)
|
||||
/* https://support.microsoft.com/en-us/kb/980263 */
|
||||
#pragma execution_character_set("utf-8")
|
||||
#endif
|
||||
@ -845,6 +845,10 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_INPUT_OVERLAY_ENABLE,
|
||||
"ディスプレイのオーバーレイ")
|
||||
MSG_HASH(MENU_ENUM_LABEL_VALUE_INPUT_OVERLAY_HIDE_IN_MENU,
|
||||
"メニューにオーバーレイを隠す")
|
||||
MSG_HASH(MENU_ENUM_LABEL_VALUE_INPUT_OVERLAY_SHOW_PHYSICAL_INPUTS,
|
||||
"オーバーレイに入力を表示")
|
||||
MSG_HASH(MENU_ENUM_LABEL_VALUE_INPUT_OVERLAY_SHOW_PHYSICAL_INPUTS_PORT,
|
||||
"入力表示のポート番号")
|
||||
MSG_HASH(MENU_ENUM_LABEL_VALUE_INPUT_POLL_TYPE_BEHAVIOR,
|
||||
"ポールタイプの行動")
|
||||
MSG_HASH(MENU_ENUM_LABEL_VALUE_INPUT_POLL_TYPE_BEHAVIOR_EARLY,
|
||||
@ -967,10 +971,12 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_MENU_DRIVER,
|
||||
"メニューのドライバ")
|
||||
MSG_HASH(MENU_ENUM_LABEL_VALUE_MENU_ENUM_THROTTLE_FRAMERATE,
|
||||
"メニューのフレームレートを減速")
|
||||
MSG_HASH(MENU_ENUM_LABEL_VALUE_MENU_FILE_BROWSER_SETTINGS, /* TODO/FIXME - update */
|
||||
"メニューファイルブラウザー")
|
||||
MSG_HASH(MENU_ENUM_LABEL_VALUE_MENU_FILE_BROWSER_SETTINGS,
|
||||
"設定")
|
||||
MSG_HASH(MENU_ENUM_LABEL_VALUE_MENU_LINEAR_FILTER,
|
||||
"メニューのリニアフィルター")
|
||||
MSG_HASH(MENU_ENUM_LABEL_VALUE_MENU_HORIZONTAL_ANIMATION,
|
||||
"横アニメーション")
|
||||
MSG_HASH(MENU_ENUM_LABEL_VALUE_MENU_SETTINGS,
|
||||
"メニュー")
|
||||
MSG_HASH(MENU_ENUM_LABEL_VALUE_MENU_WALLPAPER,
|
||||
@ -1341,6 +1347,14 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_SORT_SAVEFILES_ENABLE,
|
||||
"フォルダでセーブファイルを並び替え")
|
||||
MSG_HASH(MENU_ENUM_LABEL_VALUE_SORT_SAVESTATES_ENABLE,
|
||||
"フォルダで保存状態を並び替え")
|
||||
MSG_HASH(MENU_ENUM_LABEL_VALUE_SAVESTATES_IN_CONTENT_DIR_ENABLE,
|
||||
"コンテンツフォルダに保存状態を書き込む")
|
||||
MSG_HASH(MENU_ENUM_LABEL_VALUE_SAVEFILES_IN_CONTENT_DIR_ENABLE,
|
||||
"コンテンツフォルダにセーブファイルを書き込む")
|
||||
MSG_HASH(MENU_ENUM_LABEL_VALUE_SYSTEMFILES_IN_CONTENT_DIR_ENABLE,
|
||||
"コンテンツフォルダからシステムファイルを読み込む")
|
||||
MSG_HASH(MENU_ENUM_LABEL_VALUE_SCREENSHOTS_IN_CONTENT_DIR_ENABLE,
|
||||
"コンテンツフォルダにスクリーンショットを書き込む")
|
||||
MSG_HASH(MENU_ENUM_LABEL_VALUE_SSH_ENABLE,
|
||||
"SSHを有効")
|
||||
MSG_HASH(MENU_ENUM_LABEL_VALUE_START_CORE,
|
||||
@ -1505,8 +1519,8 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_ZLIB_SUPPORT,
|
||||
"Zlib対応")
|
||||
MSG_HASH(MENU_ENUM_LABEL_VALUE_TAKE_SCREENSHOT,
|
||||
"スクリーンショットを撮る")
|
||||
MSG_HASH(MENU_ENUM_LABEL_VALUE_THREADED_DATA_RUNLOOP_ENABLE, /* TODO/FIXME - update */
|
||||
"データループをスレッド化")
|
||||
MSG_HASH(MENU_ENUM_LABEL_VALUE_THREADED_DATA_RUNLOOP_ENABLE,
|
||||
"スレッド化タスク")
|
||||
MSG_HASH(MENU_ENUM_LABEL_VALUE_THUMBNAILS,
|
||||
"サムネイル")
|
||||
MSG_HASH(MENU_ENUM_LABEL_VALUE_THUMBNAILS_DIRECTORY,
|
||||
@ -1751,6 +1765,8 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_SHOW_HISTORY,
|
||||
"履歴タブを表示")
|
||||
MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_SHOW_ADD,
|
||||
"コンテンツをインポートするタブを表示")
|
||||
MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_SHOW_FAVORITES,
|
||||
"お気に入りタブを表示")
|
||||
MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_SHOW_IMAGES,
|
||||
"画像タブを表示")
|
||||
MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_SHOW_MUSIC,
|
||||
@ -3003,12 +3019,12 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_CORE_DELETE,
|
||||
"Delete core")
|
||||
MSG_HASH(MENU_ENUM_SUBLABEL_CORE_DELETE,
|
||||
"Remove this core from disk.")
|
||||
MSG_HASH(MENU_ENUM_LABEL_VALUE_PLAYLIST_ENTRY_RENAME,
|
||||
MSG_HASH(MENU_ENUM_LABEL_VALUE_RENAME_ENTRY,
|
||||
"Rename the title of the entry.")
|
||||
MSG_HASH(MENU_ENUM_LABEL_PLAYLIST_ENTRY_RENAME,
|
||||
MSG_HASH(MENU_ENUM_LABEL_RENAME_ENTRY,
|
||||
"Rename")
|
||||
MSG_HASH(MENU_ENUM_LABEL_VALUE_MENU_FRAMEBUFFER_OPACITY,
|
||||
"Framebuffer Opacity")
|
||||
"フレームバッファーの透明性")
|
||||
MSG_HASH(MENU_ENUM_SUBLABEL_MENU_FRAMEBUFFER_OPACITY,
|
||||
"Modify the opacity of the framebuffer.")
|
||||
MSG_HASH(MENU_ENUM_LABEL_VALUE_GOTO_FAVORITES,
|
||||
@ -3031,3 +3047,21 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_MATERIALUI_ICONS_ENABLE,
|
||||
"Menu Icons")
|
||||
MSG_HASH(MENU_ENUM_SUBLABEL_MATERIALUI_ICONS_ENABLE,
|
||||
"Enable/disable the menu icons shown at the lefthand side of the menu entries.")
|
||||
MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_MAIN_MENU_ENABLE_SETTINGS,
|
||||
"設定タブを有効")
|
||||
MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_SHOW_SETTINGS_PASSWORD,
|
||||
"設定タブを有効するパスワード")
|
||||
MSG_HASH(MSG_INPUT_ENABLE_SETTINGS_PASSWORD,
|
||||
"パスワードを入力してください")
|
||||
MSG_HASH(MSG_INPUT_ENABLE_SETTINGS_PASSWORD_OK,
|
||||
"パスワードが正解")
|
||||
MSG_HASH(MSG_INPUT_ENABLE_SETTINGS_PASSWORD_NOK,
|
||||
"パスワードが違います")
|
||||
MSG_HASH(MENU_ENUM_SUBLABEL_XMB_MAIN_MENU_ENABLE_SETTINGS,
|
||||
"Enables the Settings tab. A restart is required for the tab to appear.")
|
||||
MSG_HASH(MENU_ENUM_SUBLABEL_XMB_SHOW_SETTINGS_PASSWORD,
|
||||
"Supplying a password when hiding the settings tab makes it possible to later restore it from the menu, by going to the Main Menu tab, selecting Enable Settings Tab and entering the password.")
|
||||
MSG_HASH(MENU_ENUM_SUBLABEL_PLAYLIST_ENTRY_RENAME,
|
||||
"Allow the user to rename entries in collections.")
|
||||
MSG_HASH(MENU_ENUM_LABEL_VALUE_PLAYLIST_ENTRY_RENAME,
|
||||
"エントリーの名前変更を許す")
|
||||
|
@ -1,4 +1,4 @@
|
||||
MSG_HASH(
|
||||
MSG_HASH(
|
||||
MSG_COMPILER,
|
||||
"컴파일러"
|
||||
)
|
||||
@ -3012,9 +3012,9 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_CORE_DELETE,
|
||||
"Delete core")
|
||||
MSG_HASH(MENU_ENUM_SUBLABEL_CORE_DELETE,
|
||||
"Remove this core from disk.")
|
||||
MSG_HASH(MENU_ENUM_LABEL_VALUE_PLAYLIST_ENTRY_RENAME,
|
||||
MSG_HASH(MENU_ENUM_LABEL_VALUE_RENAME_ENTRY,
|
||||
"Rename the title of the entry.")
|
||||
MSG_HASH(MENU_ENUM_LABEL_PLAYLIST_ENTRY_RENAME,
|
||||
MSG_HASH(MENU_ENUM_LABEL_RENAME_ENTRY,
|
||||
"Rename")
|
||||
MSG_HASH(MENU_ENUM_LABEL_VALUE_MENU_FRAMEBUFFER_OPACITY,
|
||||
"Framebuffer Opacity")
|
||||
@ -3040,3 +3040,21 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_MATERIALUI_ICONS_ENABLE,
|
||||
"Menu Icons")
|
||||
MSG_HASH(MENU_ENUM_SUBLABEL_MATERIALUI_ICONS_ENABLE,
|
||||
"Enable/disable the menu icons shown at the lefthand side of the menu entries.")
|
||||
MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_MAIN_MENU_ENABLE_SETTINGS,
|
||||
"Enable Settings Tab")
|
||||
MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_SHOW_SETTINGS_PASSWORD,
|
||||
"Set Password For Enabling Settings Tab")
|
||||
MSG_HASH(MSG_INPUT_ENABLE_SETTINGS_PASSWORD,
|
||||
"Enter Password")
|
||||
MSG_HASH(MSG_INPUT_ENABLE_SETTINGS_PASSWORD_OK,
|
||||
"Password correct.")
|
||||
MSG_HASH(MSG_INPUT_ENABLE_SETTINGS_PASSWORD_NOK,
|
||||
"Password incorrect.")
|
||||
MSG_HASH(MENU_ENUM_SUBLABEL_XMB_MAIN_MENU_ENABLE_SETTINGS,
|
||||
"Enables the Settings tab. A restart is required for the tab to appear.")
|
||||
MSG_HASH(MENU_ENUM_SUBLABEL_XMB_SHOW_SETTINGS_PASSWORD,
|
||||
"Supplying a password when hiding the settings tab makes it possible to later restore it from the menu, by going to the Main Menu tab, selecting Enable Settings Tab and entering the password.")
|
||||
MSG_HASH(MENU_ENUM_SUBLABEL_PLAYLIST_ENTRY_RENAME,
|
||||
"Allow the user to rename entries in collections.")
|
||||
MSG_HASH(MENU_ENUM_LABEL_VALUE_PLAYLIST_ENTRY_RENAME,
|
||||
"Allow to rename entries")
|
||||
|
@ -1151,6 +1151,8 @@ MSG_HASH(MENU_ENUM_LABEL_XMB_ALPHA_FACTOR,
|
||||
"xmb_alpha_factor")
|
||||
MSG_HASH(MENU_ENUM_LABEL_XMB_FONT,
|
||||
"xmb_font")
|
||||
MSG_HASH(MENU_ENUM_LABEL_XMB_MAIN_MENU_ENABLE_SETTINGS,
|
||||
"xmb_main_menu_enable_settings")
|
||||
MSG_HASH(MENU_ENUM_LABEL_XMB_MENU_COLOR_THEME,
|
||||
"xmb_menu_color_theme")
|
||||
MSG_HASH(MENU_ENUM_LABEL_XMB_RIBBON_ENABLE,
|
||||
@ -1171,6 +1173,8 @@ MSG_HASH(MENU_ENUM_LABEL_XMB_SHOW_MUSIC,
|
||||
"xmb_show_music")
|
||||
MSG_HASH(MENU_ENUM_LABEL_XMB_SHOW_SETTINGS,
|
||||
"xmb_show_settings")
|
||||
MSG_HASH(MENU_ENUM_LABEL_XMB_SHOW_SETTINGS_PASSWORD,
|
||||
"xmb_show_settings_password")
|
||||
MSG_HASH(MENU_ENUM_LABEL_XMB_SHOW_VIDEO,
|
||||
"xmb_show_video")
|
||||
MSG_HASH(MENU_ENUM_LABEL_XMB_SHOW_NETPLAY,
|
||||
@ -1297,3 +1301,5 @@ MSG_HASH(MENU_ENUM_LABEL_GOTO_VIDEO,
|
||||
"goto_video")
|
||||
MSG_HASH(MENU_ENUM_LABEL_MATERIALUI_ICONS_ENABLE,
|
||||
"materialui_icons_enable")
|
||||
MSG_HASH(MENU_ENUM_LABEL_RENAME_ENTRY,
|
||||
"rename_entry")
|
||||
|
@ -2880,9 +2880,9 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_CORE_DELETE,
|
||||
"Delete core")
|
||||
MSG_HASH(MENU_ENUM_SUBLABEL_CORE_DELETE,
|
||||
"Remove this core from disk.")
|
||||
MSG_HASH(MENU_ENUM_LABEL_VALUE_PLAYLIST_ENTRY_RENAME,
|
||||
MSG_HASH(MENU_ENUM_LABEL_VALUE_RENAME_ENTRY,
|
||||
"Rename the title of the entry.")
|
||||
MSG_HASH(MENU_ENUM_LABEL_PLAYLIST_ENTRY_RENAME,
|
||||
MSG_HASH(MENU_ENUM_LABEL_RENAME_ENTRY,
|
||||
"Rename")
|
||||
MSG_HASH(MENU_ENUM_LABEL_VALUE_MENU_FRAMEBUFFER_OPACITY,
|
||||
"Framebuffer Opacity")
|
||||
@ -2908,3 +2908,21 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_MATERIALUI_ICONS_ENABLE,
|
||||
"Menu Icons")
|
||||
MSG_HASH(MENU_ENUM_SUBLABEL_MATERIALUI_ICONS_ENABLE,
|
||||
"Enable/disable the menu icons shown at the lefthand side of the menu entries.")
|
||||
MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_MAIN_MENU_ENABLE_SETTINGS,
|
||||
"Enable Settings Tab")
|
||||
MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_SHOW_SETTINGS_PASSWORD,
|
||||
"Set Password For Enabling Settings Tab")
|
||||
MSG_HASH(MSG_INPUT_ENABLE_SETTINGS_PASSWORD,
|
||||
"Enter Password")
|
||||
MSG_HASH(MSG_INPUT_ENABLE_SETTINGS_PASSWORD_OK,
|
||||
"Password correct.")
|
||||
MSG_HASH(MSG_INPUT_ENABLE_SETTINGS_PASSWORD_NOK,
|
||||
"Password incorrect.")
|
||||
MSG_HASH(MENU_ENUM_SUBLABEL_XMB_MAIN_MENU_ENABLE_SETTINGS,
|
||||
"Enables the Settings tab. A restart is required for the tab to appear.")
|
||||
MSG_HASH(MENU_ENUM_SUBLABEL_XMB_SHOW_SETTINGS_PASSWORD,
|
||||
"Supplying a password when hiding the settings tab makes it possible to later restore it from the menu, by going to the Main Menu tab, selecting Enable Settings Tab and entering the password.")
|
||||
MSG_HASH(MENU_ENUM_SUBLABEL_PLAYLIST_ENTRY_RENAME,
|
||||
"Allow the user to rename entries in collections.")
|
||||
MSG_HASH(MENU_ENUM_LABEL_VALUE_PLAYLIST_ENTRY_RENAME,
|
||||
"Allow to rename entries")
|
||||
|
@ -857,10 +857,10 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_INPUT_META_SLOWMOTION,
|
||||
"Câmera Lenta"
|
||||
)
|
||||
MSG_HASH(MENU_ENUM_LABEL_VALUE_INPUT_META_STATE_SLOT_MINUS,
|
||||
"Box do Estado de Jogo -"
|
||||
"Posição do Estado de Jogo -"
|
||||
)
|
||||
MSG_HASH(MENU_ENUM_LABEL_VALUE_INPUT_META_STATE_SLOT_PLUS,
|
||||
"Box do Estado de Jogo +"
|
||||
"Posição do Estado de Jogo +"
|
||||
)
|
||||
MSG_HASH(MENU_ENUM_LABEL_VALUE_INPUT_META_VOLUME_DOWN,
|
||||
"Volume -"
|
||||
@ -1661,7 +1661,7 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_START_VIDEO_PROCESSOR,
|
||||
"Iniciar Processador de Vídeo"
|
||||
)
|
||||
MSG_HASH(MENU_ENUM_LABEL_VALUE_STATE_SLOT,
|
||||
"Box do Estado de Jogo"
|
||||
"Posição do Estado de Jogo"
|
||||
)
|
||||
MSG_HASH(MENU_ENUM_LABEL_VALUE_STATUS,
|
||||
"Condição"
|
||||
@ -2729,7 +2729,7 @@ MSG_HASH(MSG_FOUND_FIRST_DATA_TRACK_ON_FILE,
|
||||
"Encontrada primeira faixa de dados no arquivo"
|
||||
)
|
||||
MSG_HASH(MSG_FOUND_LAST_STATE_SLOT,
|
||||
"Encontrado último box de Estado de Jogo"
|
||||
"Encontrada última posição de Estado de Jogo"
|
||||
)
|
||||
MSG_HASH(MSG_FOUND_SHADER,
|
||||
"Shader encontrado"
|
||||
@ -2798,10 +2798,10 @@ MSG_HASH(MSG_LIBRETRO_FRONTEND,
|
||||
"Frontend para Libretro"
|
||||
)
|
||||
MSG_HASH(MSG_LOADED_STATE_FROM_SLOT,
|
||||
"Estado de Jogo carregado do box #%d."
|
||||
"Estado de Jogo carregado da posição #%d."
|
||||
)
|
||||
MSG_HASH(MSG_LOADED_STATE_FROM_SLOT_AUTO,
|
||||
"Estado de Jogo carregado do box #-1 (automático)."
|
||||
"Estado de Jogo carregado da posição #-1 (automático)."
|
||||
)
|
||||
MSG_HASH(MSG_LOADING,
|
||||
"Carregando"
|
||||
@ -2927,10 +2927,10 @@ MSG_HASH(MSG_SAVED_NEW_CONFIG_TO,
|
||||
"Nova configuração salva em"
|
||||
)
|
||||
MSG_HASH(MSG_SAVED_STATE_TO_SLOT,
|
||||
"Estado de Jogo salvo no box #%d."
|
||||
"Estado de Jogo salvo na posição #%d."
|
||||
)
|
||||
MSG_HASH(MSG_SAVED_STATE_TO_SLOT_AUTO,
|
||||
"Estado de Jogo salvo no box #-1 (automático)."
|
||||
"Estado de Jogo salvo na posição #-1 (automático)."
|
||||
)
|
||||
MSG_HASH(MSG_SAVED_SUCCESSFULLY_TO,
|
||||
"Salvo com sucesso em"
|
||||
@ -2981,7 +2981,7 @@ MSG_HASH(MSG_STATE_SIZE,
|
||||
"Tamanho do Estado de Jogo"
|
||||
)
|
||||
MSG_HASH(MSG_STATE_SLOT,
|
||||
"Box do Estado de Jogo"
|
||||
"Posição do Estado de Jogo"
|
||||
)
|
||||
MSG_HASH(MSG_TAKING_SCREENSHOT,
|
||||
"Fazendo captura de tela"
|
||||
@ -3584,10 +3584,10 @@ MSG_HASH(MENU_ENUM_SUBLABEL_CLOSE_CONTENT,
|
||||
"Fecha o conteúdo atual. Alterações não salvas serão perdidas."
|
||||
)
|
||||
MSG_HASH(MENU_ENUM_SUBLABEL_LOAD_STATE,
|
||||
"Carregar um Estado de Jogo do box selecionado atualmente."
|
||||
"Carregar um Estado de Jogo da posição selecionado atualmente."
|
||||
)
|
||||
MSG_HASH(MENU_ENUM_SUBLABEL_SAVE_STATE,
|
||||
"Salvar um Estado de Jogo no box selecionado atualmente."
|
||||
"Salvar um Estado de Jogo na posição selecionado atualmente."
|
||||
)
|
||||
MSG_HASH(MENU_ENUM_SUBLABEL_RESUME,
|
||||
"Retomar a execução do conteúdo atual e sair do Menu Rápido."
|
||||
@ -3596,7 +3596,7 @@ MSG_HASH(MENU_ENUM_SUBLABEL_RESUME_CONTENT,
|
||||
"Retomar a execução do conteúdo atual e sair do Menu Rápido."
|
||||
)
|
||||
MSG_HASH(MENU_ENUM_SUBLABEL_STATE_SLOT,
|
||||
"Altera o box do Estado de Jogo selecionado atualmente."
|
||||
"Altera a posição do Estado de Jogo selecionado atualmente."
|
||||
)
|
||||
MSG_HASH(MENU_ENUM_SUBLABEL_UNDO_LOAD_STATE,
|
||||
"Se um Estado de Jogo for carregado, o conteúdo voltará ao estado anterior ao carregamento."
|
||||
@ -3919,10 +3919,10 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_CORE_DELETE,
|
||||
MSG_HASH(MENU_ENUM_SUBLABEL_CORE_DELETE,
|
||||
"Remover este núcleo do disco."
|
||||
)
|
||||
MSG_HASH(MENU_ENUM_SUBLABEL_PLAYLIST_ENTRY_RENAME,
|
||||
MSG_HASH(MENU_ENUM_SUBLABEL_RENAME_ENTRY,
|
||||
"Renomear o título do item."
|
||||
)
|
||||
MSG_HASH(MENU_ENUM_LABEL_VALUE_PLAYLIST_ENTRY_RENAME,
|
||||
MSG_HASH(MENU_ENUM_LABEL_VALUE_RENAME_ENTRY,
|
||||
"Renomear"
|
||||
)
|
||||
MSG_HASH(MENU_ENUM_LABEL_VALUE_MENU_FRAMEBUFFER_OPACITY,
|
||||
@ -3960,4 +3960,31 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_MATERIALUI_ICONS_ENABLE,
|
||||
)
|
||||
MSG_HASH(MENU_ENUM_SUBLABEL_MATERIALUI_ICONS_ENABLE,
|
||||
"Habilitar/desabilitar os ícones exibidos do lado esquerdo dos itens de menu. "
|
||||
)
|
||||
)
|
||||
MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_MAIN_MENU_ENABLE_SETTINGS,
|
||||
"Enable Settings Tab"
|
||||
)
|
||||
MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_SHOW_SETTINGS_PASSWORD,
|
||||
"Set Password For Enabling Settings Tab"
|
||||
)
|
||||
MSG_HASH(MSG_INPUT_ENABLE_SETTINGS_PASSWORD,
|
||||
"Enter Password"
|
||||
)
|
||||
MSG_HASH(MSG_INPUT_ENABLE_SETTINGS_PASSWORD_OK,
|
||||
"Password correct."
|
||||
)
|
||||
MSG_HASH(MSG_INPUT_ENABLE_SETTINGS_PASSWORD_NOK,
|
||||
"Password incorrect."
|
||||
)
|
||||
MSG_HASH(MENU_ENUM_SUBLABEL_XMB_MAIN_MENU_ENABLE_SETTINGS,
|
||||
"Enables the Settings tab. A restart is required for the tab to appear."
|
||||
)
|
||||
MSG_HASH(MENU_ENUM_SUBLABEL_XMB_SHOW_SETTINGS_PASSWORD,
|
||||
"Supplying a password when hiding the settings tab makes it possible to later restore it from the menu, by going to the Main Menu tab, selecting Enable Settings Tab and entering the password."
|
||||
)
|
||||
MSG_HASH(MENU_ENUM_SUBLABEL_PLAYLIST_ENTRY_RENAME,
|
||||
"Allow the user to rename entries in collections."
|
||||
)
|
||||
MSG_HASH(MENU_ENUM_LABEL_VALUE_PLAYLIST_ENTRY_RENAME,
|
||||
"Allow to rename entries"
|
||||
)
|
||||
|
@ -57,7 +57,7 @@ int menu_hash_get_help_pt_pt_enum(enum msg_hash_enums msg, char *s, size_t len)
|
||||
"Esse driver funciona sem o X. \n"
|
||||
" \n"
|
||||
"Ele usa a recente API de joypads \n"
|
||||
"evdev para supporte a joystick. \n"
|
||||
"evdev para suporte a joystick. \n"
|
||||
"Suporta Hot-Swap e force feedback \n"
|
||||
"(se suportado pelo dispositivo). \n"
|
||||
" \n"
|
||||
@ -490,7 +490,7 @@ int menu_hash_get_help_pt_pt_enum(enum msg_hash_enums msg, char *s, size_t len)
|
||||
"compatibilidade.\n"
|
||||
" \n"
|
||||
"Esse valor deve ficar próximo de 60Hz para \n"
|
||||
"evitar grande mudanças de pitch. Se o monitor \n"
|
||||
"evitar grandes mudanças de pitch. Se o monitor \n"
|
||||
"não rodar a 60Hz, ou algo próximo a isso, desative\n"
|
||||
"o VSync, e deixe-o com valores padrão.";
|
||||
strlcpy(s, u, len);
|
||||
@ -822,7 +822,7 @@ int menu_hash_get_help_pt_pt_enum(enum msg_hash_enums msg, char *s, size_t len)
|
||||
case MENU_ENUM_LABEL_LOCATION_ALLOW:
|
||||
snprintf(s, len,
|
||||
"Autorizar ou desautorizar o acesso de \n"
|
||||
"serviços de localização pelos cores.");
|
||||
"serviços de localização pelas cores.");
|
||||
break;
|
||||
case MENU_ENUM_LABEL_TURBO:
|
||||
snprintf(s, len,
|
||||
|
@ -2987,9 +2987,9 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_CORE_DELETE,
|
||||
"Delete core")
|
||||
MSG_HASH(MENU_ENUM_SUBLABEL_CORE_DELETE,
|
||||
"Remove this core from disk.")
|
||||
MSG_HASH(MENU_ENUM_LABEL_VALUE_PLAYLIST_ENTRY_RENAME,
|
||||
MSG_HASH(MENU_ENUM_LABEL_VALUE_RENAME_ENTRY,
|
||||
"Rename the title of the entry.")
|
||||
MSG_HASH(MENU_ENUM_LABEL_PLAYLIST_ENTRY_RENAME,
|
||||
MSG_HASH(MENU_ENUM_LABEL_RENAME_ENTRY,
|
||||
"Rename")
|
||||
MSG_HASH(MENU_ENUM_LABEL_VALUE_MENU_FRAMEBUFFER_OPACITY,
|
||||
"Framebuffer Opacity")
|
||||
@ -3015,3 +3015,21 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_MATERIALUI_ICONS_ENABLE,
|
||||
"Menu Icons")
|
||||
MSG_HASH(MENU_ENUM_SUBLABEL_MATERIALUI_ICONS_ENABLE,
|
||||
"Enable/disable the menu icons shown at the lefthand side of the menu entries.")
|
||||
MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_MAIN_MENU_ENABLE_SETTINGS,
|
||||
"Enable Settings Tab")
|
||||
MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_SHOW_SETTINGS_PASSWORD,
|
||||
"Set Password For Enabling Settings Tab")
|
||||
MSG_HASH(MSG_INPUT_ENABLE_SETTINGS_PASSWORD,
|
||||
"Enter Password")
|
||||
MSG_HASH(MSG_INPUT_ENABLE_SETTINGS_PASSWORD_OK,
|
||||
"Password correct.")
|
||||
MSG_HASH(MSG_INPUT_ENABLE_SETTINGS_PASSWORD_NOK,
|
||||
"Password incorrect.")
|
||||
MSG_HASH(MENU_ENUM_SUBLABEL_XMB_MAIN_MENU_ENABLE_SETTINGS,
|
||||
"Enables the Settings tab. A restart is required for the tab to appear.")
|
||||
MSG_HASH(MENU_ENUM_SUBLABEL_XMB_SHOW_SETTINGS_PASSWORD,
|
||||
"Supplying a password when hiding the settings tab makes it possible to later restore it from the menu, by going to the Main Menu tab, selecting Enable Settings Tab and entering the password.")
|
||||
MSG_HASH(MENU_ENUM_SUBLABEL_PLAYLIST_ENTRY_RENAME,
|
||||
"Allow the user to rename entries in collections.")
|
||||
MSG_HASH(MENU_ENUM_LABEL_VALUE_PLAYLIST_ENTRY_RENAME,
|
||||
"Allow to rename entries")
|
||||
|
@ -1,4 +1,4 @@
|
||||
#if defined(_MSC_VER) && !defined(_XBOX)
|
||||
#if defined(_MSC_VER) && !defined(_XBOX)
|
||||
/* https://support.microsoft.com/en-us/kb/980263 */
|
||||
#pragma execution_character_set("utf-8")
|
||||
#endif
|
||||
@ -3070,9 +3070,9 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_CORE_DELETE,
|
||||
"Удалить ядро")
|
||||
MSG_HASH(MENU_ENUM_SUBLABEL_CORE_DELETE,
|
||||
"Удаление ядра с устройства.")
|
||||
MSG_HASH(MENU_ENUM_LABEL_VALUE_PLAYLIST_ENTRY_RENAME,
|
||||
MSG_HASH(MENU_ENUM_LABEL_VALUE_RENAME_ENTRY,
|
||||
"Переименовать название игры")
|
||||
MSG_HASH(MENU_ENUM_LABEL_PLAYLIST_ENTRY_RENAME,
|
||||
MSG_HASH(MENU_ENUM_LABEL_RENAME_ENTRY,
|
||||
"Переименовать")
|
||||
MSG_HASH(MENU_ENUM_LABEL_VALUE_MENU_FRAMEBUFFER_OPACITY,
|
||||
"Прозрачность кадра")
|
||||
@ -3098,3 +3098,21 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_MATERIALUI_ICONS_ENABLE,
|
||||
"Иконки интерфейса")
|
||||
MSG_HASH(MENU_ENUM_SUBLABEL_MATERIALUI_ICONS_ENABLE,
|
||||
"Отображать или скрывать иконки интерфейса, отображающиеся в левой части меню.")
|
||||
MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_MAIN_MENU_ENABLE_SETTINGS,
|
||||
"Enable Settings Tab")
|
||||
MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_SHOW_SETTINGS_PASSWORD,
|
||||
"Set Password For Enabling Settings Tab")
|
||||
MSG_HASH(MSG_INPUT_ENABLE_SETTINGS_PASSWORD,
|
||||
"Enter Password")
|
||||
MSG_HASH(MSG_INPUT_ENABLE_SETTINGS_PASSWORD_OK,
|
||||
"Password correct.")
|
||||
MSG_HASH(MSG_INPUT_ENABLE_SETTINGS_PASSWORD_NOK,
|
||||
"Password incorrect.")
|
||||
MSG_HASH(MENU_ENUM_SUBLABEL_XMB_MAIN_MENU_ENABLE_SETTINGS,
|
||||
"Enables the Settings tab. A restart is required for the tab to appear.")
|
||||
MSG_HASH(MENU_ENUM_SUBLABEL_XMB_SHOW_SETTINGS_PASSWORD,
|
||||
"Supplying a password when hiding the settings tab makes it possible to later restore it from the menu, by going to the Main Menu tab, selecting Enable Settings Tab and entering the password.")
|
||||
MSG_HASH(MENU_ENUM_SUBLABEL_PLAYLIST_ENTRY_RENAME,
|
||||
"Allow the user to rename entries in collections.")
|
||||
MSG_HASH(MENU_ENUM_LABEL_VALUE_PLAYLIST_ENTRY_RENAME,
|
||||
"Allow to rename entries")
|
||||
|
@ -3105,10 +3105,6 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_CORE_DELETE,
|
||||
"Delete core")
|
||||
MSG_HASH(MENU_ENUM_SUBLABEL_CORE_DELETE,
|
||||
"Remove this core from disk.")
|
||||
MSG_HASH(MENU_ENUM_SUBLABEL_PLAYLIST_ENTRY_RENAME,
|
||||
"Rename the title of the entry.")
|
||||
MSG_HASH(MENU_ENUM_LABEL_VALUE_PLAYLIST_ENTRY_RENAME,
|
||||
"Rename")
|
||||
MSG_HASH(MENU_ENUM_LABEL_VALUE_MENU_FRAMEBUFFER_OPACITY,
|
||||
"Framebuffer Opacity")
|
||||
MSG_HASH(MENU_ENUM_SUBLABEL_MENU_FRAMEBUFFER_OPACITY,
|
||||
@ -3133,3 +3129,25 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_MATERIALUI_ICONS_ENABLE,
|
||||
"Menu Icons")
|
||||
MSG_HASH(MENU_ENUM_SUBLABEL_MATERIALUI_ICONS_ENABLE,
|
||||
"Enable/disable the menu icons shown at the lefthand side of the menu entries.")
|
||||
MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_MAIN_MENU_ENABLE_SETTINGS,
|
||||
"Enable Settings Tab")
|
||||
MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_SHOW_SETTINGS_PASSWORD,
|
||||
"Set Password For Enabling Settings Tab")
|
||||
MSG_HASH(MSG_INPUT_ENABLE_SETTINGS_PASSWORD,
|
||||
"Enter Password")
|
||||
MSG_HASH(MSG_INPUT_ENABLE_SETTINGS_PASSWORD_OK,
|
||||
"Password correct.")
|
||||
MSG_HASH(MSG_INPUT_ENABLE_SETTINGS_PASSWORD_NOK,
|
||||
"Password incorrect.")
|
||||
MSG_HASH(MENU_ENUM_SUBLABEL_XMB_MAIN_MENU_ENABLE_SETTINGS,
|
||||
"Enables the Settings tab. A restart is required for the tab to appear.")
|
||||
MSG_HASH(MENU_ENUM_SUBLABEL_XMB_SHOW_SETTINGS_PASSWORD,
|
||||
"Supplying a password when hiding the settings tab makes it possible to later restore it from the menu, by going to the Main Menu tab, selecting Enable Settings Tab and entering the password.")
|
||||
MSG_HASH(MENU_ENUM_SUBLABEL_PLAYLIST_ENTRY_RENAME,
|
||||
"Allow the user to rename entries in collections.")
|
||||
MSG_HASH(MENU_ENUM_LABEL_VALUE_PLAYLIST_ENTRY_RENAME,
|
||||
"Allow to rename entries")
|
||||
MSG_HASH(MENU_ENUM_SUBLABEL_RENAME_ENTRY,
|
||||
"Rename the title of the entry.")
|
||||
MSG_HASH(MENU_ENUM_LABEL_VALUE_RENAME_ENTRY,
|
||||
"Rename")
|
||||
|
@ -1,4 +1,4 @@
|
||||
MSG_HASH(
|
||||
MSG_HASH(
|
||||
MSG_COMPILER,
|
||||
"Compiler"
|
||||
)
|
||||
@ -3041,9 +3041,9 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_MENU_SHOW_CORE_UPDATER,
|
||||
"Show Core Updater")
|
||||
MSG_HASH(MENU_ENUM_SUBLABEL_MENU_SHOW_CORE_UPDATER,
|
||||
"Show/hide the ability to update cores (and core info files).")
|
||||
MSG_HASH(MENU_ENUM_LABEL_VALUE_PLAYLIST_ENTRY_RENAME,
|
||||
MSG_HASH(MENU_ENUM_LABEL_VALUE_RENAME_ENTRY,
|
||||
"Rename the title of the entry.")
|
||||
MSG_HASH(MENU_ENUM_LABEL_PLAYLIST_ENTRY_RENAME,
|
||||
MSG_HASH(MENU_ENUM_LABEL_RENAME_ENTRY,
|
||||
"Rename")
|
||||
MSG_HASH(MENU_ENUM_LABEL_VALUE_MENU_FRAMEBUFFER_OPACITY,
|
||||
"Framebuffer Opacity")
|
||||
@ -3069,3 +3069,21 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_MATERIALUI_ICONS_ENABLE,
|
||||
"Menu Icons")
|
||||
MSG_HASH(MENU_ENUM_SUBLABEL_MATERIALUI_ICONS_ENABLE,
|
||||
"Enable/disable the menu icons shown at the lefthand side of the menu entries.")
|
||||
MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_MAIN_MENU_ENABLE_SETTINGS,
|
||||
"Enable Settings Tab")
|
||||
MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_SHOW_SETTINGS_PASSWORD,
|
||||
"Set Password For Enabling Settings Tab")
|
||||
MSG_HASH(MSG_INPUT_ENABLE_SETTINGS_PASSWORD,
|
||||
"Enter Password")
|
||||
MSG_HASH(MSG_INPUT_ENABLE_SETTINGS_PASSWORD_OK,
|
||||
"Password correct.")
|
||||
MSG_HASH(MSG_INPUT_ENABLE_SETTINGS_PASSWORD_NOK,
|
||||
"Password incorrect.")
|
||||
MSG_HASH(MENU_ENUM_SUBLABEL_XMB_MAIN_MENU_ENABLE_SETTINGS,
|
||||
"Enables the Settings tab. A restart is required for the tab to appear.")
|
||||
MSG_HASH(MENU_ENUM_SUBLABEL_XMB_SHOW_SETTINGS_PASSWORD,
|
||||
"Supplying a password when hiding the settings tab makes it possible to later restore it from the menu, by going to the Main Menu tab, selecting Enable Settings Tab and entering the password.")
|
||||
MSG_HASH(MENU_ENUM_SUBLABEL_PLAYLIST_ENTRY_RENAME,
|
||||
"Allow the user to rename entries in collections.")
|
||||
MSG_HASH(MENU_ENUM_LABEL_VALUE_PLAYLIST_ENTRY_RENAME,
|
||||
"Allow to rename entries")
|
||||
|
@ -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));
|
||||
|
@ -538,7 +538,7 @@ bool file_archive_extract_file(
|
||||
userdata.decomp_state.opt_file = NULL;
|
||||
userdata.decomp_state.needle = NULL;
|
||||
userdata.decomp_state.size = 0;
|
||||
userdata.decomp_state.found = NULL;
|
||||
userdata.decomp_state.found = false;
|
||||
|
||||
if (!list)
|
||||
{
|
||||
@ -602,7 +602,7 @@ struct string_list *file_archive_get_file_list(const char *path,
|
||||
userdata.decomp_state.opt_file = NULL;
|
||||
userdata.decomp_state.needle = NULL;
|
||||
userdata.decomp_state.size = 0;
|
||||
userdata.decomp_state.found = NULL;
|
||||
userdata.decomp_state.found = false;
|
||||
|
||||
if (!userdata.list)
|
||||
goto error;
|
||||
|
@ -52,10 +52,10 @@ struct config_entry_list
|
||||
/* If we got this from an #include,
|
||||
* do not allow overwrite. */
|
||||
bool readonly;
|
||||
char *key;
|
||||
char *value;
|
||||
uint32_t key_hash;
|
||||
|
||||
char *key;
|
||||
char *value;
|
||||
struct config_entry_list *next;
|
||||
};
|
||||
|
||||
@ -240,10 +240,11 @@ static void add_sub_conf(config_file_t *conf, char *path)
|
||||
char real_path[PATH_MAX_LENGTH];
|
||||
config_file_t *sub_conf = NULL;
|
||||
struct config_include_list *head = conf->includes;
|
||||
struct config_include_list *node = (struct config_include_list*)calloc(1, sizeof(*node));
|
||||
struct config_include_list *node = (struct config_include_list*)malloc(sizeof(*node));
|
||||
|
||||
if (node)
|
||||
{
|
||||
node->next = NULL;
|
||||
/* Add include list */
|
||||
node->path = strdup(path);
|
||||
|
||||
@ -365,23 +366,29 @@ error:
|
||||
static config_file_t *config_file_new_internal(
|
||||
const char *path, unsigned depth)
|
||||
{
|
||||
FILE *file = NULL;
|
||||
struct config_file *conf = (struct config_file*)calloc(1, sizeof(*conf));
|
||||
FILE *file = NULL;
|
||||
struct config_file *conf = (struct config_file*)malloc(sizeof(*conf));
|
||||
if (!conf)
|
||||
return NULL;
|
||||
|
||||
conf->path = NULL;
|
||||
conf->entries = NULL;
|
||||
conf->tail = NULL;
|
||||
conf->includes = NULL;
|
||||
conf->include_depth = 0;
|
||||
|
||||
if (!path || !*path)
|
||||
return conf;
|
||||
|
||||
if (path_is_directory(path))
|
||||
goto error;
|
||||
|
||||
conf->path = strdup(path);
|
||||
conf->path = strdup(path);
|
||||
if (!conf->path)
|
||||
goto error;
|
||||
|
||||
conf->include_depth = depth;
|
||||
file = fopen(path, "r");
|
||||
file = fopen(path, "r");
|
||||
|
||||
if (!file)
|
||||
{
|
||||
@ -392,9 +399,8 @@ static config_file_t *config_file_new_internal(
|
||||
|
||||
while (!feof(file))
|
||||
{
|
||||
struct config_entry_list *list = (struct config_entry_list*)
|
||||
calloc(1, sizeof(*list));
|
||||
char *line = NULL;
|
||||
char *line = NULL;
|
||||
struct config_entry_list *list = (struct config_entry_list*)malloc(sizeof(*list));
|
||||
|
||||
if (!list)
|
||||
{
|
||||
@ -403,7 +409,13 @@ static config_file_t *config_file_new_internal(
|
||||
return NULL;
|
||||
}
|
||||
|
||||
line = getaline(file);
|
||||
list->readonly = false;
|
||||
list->key_hash = 0;
|
||||
list->key = NULL;
|
||||
list->value = NULL;
|
||||
list->next = NULL;
|
||||
|
||||
line = getaline(file);
|
||||
|
||||
if (!line)
|
||||
{
|
||||
@ -500,14 +512,17 @@ config_file_t *config_file_new_from_string(const char *from_string)
|
||||
{
|
||||
size_t i;
|
||||
struct string_list *lines = NULL;
|
||||
struct config_file *conf = (struct config_file*)calloc(1, sizeof(*conf));
|
||||
struct config_file *conf = (struct config_file*)malloc(sizeof(*conf));
|
||||
if (!conf)
|
||||
return NULL;
|
||||
|
||||
if (!from_string)
|
||||
return conf;
|
||||
|
||||
conf->path = NULL;
|
||||
conf->path = NULL;
|
||||
conf->entries = NULL;
|
||||
conf->tail = NULL;
|
||||
conf->includes = NULL;
|
||||
conf->include_depth = 0;
|
||||
|
||||
lines = string_split(from_string, "\n");
|
||||
@ -516,9 +531,8 @@ config_file_t *config_file_new_from_string(const char *from_string)
|
||||
|
||||
for (i = 0; i < lines->size; i++)
|
||||
{
|
||||
struct config_entry_list *list = (struct config_entry_list*)
|
||||
calloc(1, sizeof(*list));
|
||||
char* line = lines->elems[i].data;
|
||||
struct config_entry_list *list = (struct config_entry_list*)malloc(sizeof(*list));
|
||||
char *line = lines->elems[i].data;
|
||||
|
||||
if (!list)
|
||||
{
|
||||
@ -527,6 +541,12 @@ config_file_t *config_file_new_from_string(const char *from_string)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
list->readonly = false;
|
||||
list->key_hash = 0;
|
||||
list->key = NULL;
|
||||
list->value = NULL;
|
||||
list->next = NULL;
|
||||
|
||||
if (line && conf)
|
||||
{
|
||||
if (*line && parse_line(conf, list, line))
|
||||
@ -761,16 +781,21 @@ void config_set_string(config_file_t *conf, const char *key, const char *val)
|
||||
return;
|
||||
}
|
||||
|
||||
if (!val) return;
|
||||
if (!val)
|
||||
return;
|
||||
|
||||
entry = (struct config_entry_list*)calloc(1, sizeof(*entry));
|
||||
if (!entry) return;
|
||||
entry = (struct config_entry_list*)malloc(sizeof(*entry));
|
||||
if (!entry)
|
||||
return;
|
||||
|
||||
entry->key = strdup(key);
|
||||
entry->value = strdup(val);
|
||||
entry->readonly = false;
|
||||
entry->key_hash = 0;
|
||||
entry->key = strdup(key);
|
||||
entry->value = strdup(val);
|
||||
entry->next = NULL;
|
||||
|
||||
if (last)
|
||||
last->next = entry;
|
||||
last->next = entry;
|
||||
else
|
||||
conf->entries = entry;
|
||||
}
|
||||
@ -849,11 +874,7 @@ void config_set_uint64(config_file_t *conf, const char *key, uint64_t val)
|
||||
char buf[128];
|
||||
|
||||
buf[0] = '\0';
|
||||
#ifdef _WIN32
|
||||
snprintf(buf, sizeof(buf), "%I64u", val);
|
||||
#else
|
||||
snprintf(buf, sizeof(buf), "%llu", (long long unsigned)val);
|
||||
#endif
|
||||
snprintf(buf, sizeof(buf), STRING_REP_UINT64, val);
|
||||
config_set_string(conf, key, buf);
|
||||
}
|
||||
|
||||
@ -875,12 +896,17 @@ bool config_file_write(config_file_t *conf, const char *path)
|
||||
{
|
||||
FILE *file;
|
||||
|
||||
if (path)
|
||||
if (path && !string_is_empty(path))
|
||||
{
|
||||
file = fopen(path, "w");
|
||||
if (!file)
|
||||
return false;
|
||||
#ifdef WIIU
|
||||
/* TODO: use FBF everywhere once https://i.imgur.com/muVhNeF.jpg is fixed */
|
||||
setvbuf(file, NULL, _IONBF, 0x4000);
|
||||
#else
|
||||
setvbuf(file, NULL, _IOFBF, 0x4000);
|
||||
#endif
|
||||
}
|
||||
else
|
||||
file = stdout;
|
||||
|
@ -92,28 +92,27 @@ struct rpng_process
|
||||
bool inflate_initialized;
|
||||
bool adam7_pass_initialized;
|
||||
bool pass_initialized;
|
||||
uint32_t *data;
|
||||
uint32_t *palette;
|
||||
struct png_ihdr ihdr;
|
||||
uint8_t *prev_scanline;
|
||||
uint8_t *decoded_scanline;
|
||||
uint8_t *inflate_buf;
|
||||
struct png_ihdr ihdr;
|
||||
size_t restore_buf_size;
|
||||
size_t adam7_restore_buf_size;
|
||||
size_t data_restore_buf_size;
|
||||
size_t inflate_buf_size;
|
||||
size_t avail_in;
|
||||
size_t avail_out;
|
||||
size_t total_out;
|
||||
size_t pass_size;
|
||||
unsigned bpp;
|
||||
unsigned pitch;
|
||||
unsigned h;
|
||||
struct
|
||||
{
|
||||
unsigned width;
|
||||
unsigned height;
|
||||
size_t size;
|
||||
unsigned pos;
|
||||
} pass;
|
||||
unsigned pass_width;
|
||||
unsigned pass_height;
|
||||
unsigned pass_pos;
|
||||
uint32_t *data;
|
||||
uint32_t *palette;
|
||||
void *stream;
|
||||
size_t avail_in, avail_out, total_out;
|
||||
const struct trans_stream_backend *stream_backend;
|
||||
};
|
||||
|
||||
@ -518,29 +517,29 @@ static int png_reverse_filter_init(const struct png_ihdr *ihdr,
|
||||
|
||||
if (!pngp->adam7_pass_initialized && ihdr->interlace)
|
||||
{
|
||||
if (ihdr->width <= passes[pngp->pass.pos].x ||
|
||||
ihdr->height <= passes[pngp->pass.pos].y) /* Empty pass */
|
||||
if (ihdr->width <= passes[pngp->pass_pos].x ||
|
||||
ihdr->height <= passes[pngp->pass_pos].y) /* Empty pass */
|
||||
return 1;
|
||||
|
||||
pngp->pass.width = (ihdr->width -
|
||||
passes[pngp->pass.pos].x + passes[pngp->pass.pos].stride_x - 1) / passes[pngp->pass.pos].stride_x;
|
||||
pngp->pass.height = (ihdr->height - passes[pngp->pass.pos].y +
|
||||
passes[pngp->pass.pos].stride_y - 1) / passes[pngp->pass.pos].stride_y;
|
||||
pngp->pass_width = (ihdr->width -
|
||||
passes[pngp->pass_pos].x + passes[pngp->pass_pos].stride_x - 1) / passes[pngp->pass_pos].stride_x;
|
||||
pngp->pass_height = (ihdr->height - passes[pngp->pass_pos].y +
|
||||
passes[pngp->pass_pos].stride_y - 1) / passes[pngp->pass_pos].stride_y;
|
||||
|
||||
pngp->data = (uint32_t*)malloc(
|
||||
pngp->pass.width * pngp->pass.height * sizeof(uint32_t));
|
||||
pngp->pass_width * pngp->pass_height * sizeof(uint32_t));
|
||||
|
||||
if (!pngp->data)
|
||||
return -1;
|
||||
|
||||
pngp->ihdr = *ihdr;
|
||||
pngp->ihdr.width = pngp->pass.width;
|
||||
pngp->ihdr.height = pngp->pass.height;
|
||||
pngp->ihdr.width = pngp->pass_width;
|
||||
pngp->ihdr.height = pngp->pass_height;
|
||||
|
||||
png_pass_geom(&pngp->ihdr, pngp->pass.width,
|
||||
pngp->pass.height, NULL, NULL, &pngp->pass.size);
|
||||
png_pass_geom(&pngp->ihdr, pngp->pass_width,
|
||||
pngp->pass_height, NULL, NULL, &pngp->pass_size);
|
||||
|
||||
if (pngp->pass.size > pngp->total_out)
|
||||
if (pngp->pass_size > pngp->total_out)
|
||||
{
|
||||
free(pngp->data);
|
||||
return -1;
|
||||
@ -561,8 +560,8 @@ static int png_reverse_filter_init(const struct png_ihdr *ihdr,
|
||||
|
||||
pngp->restore_buf_size = 0;
|
||||
pngp->data_restore_buf_size = 0;
|
||||
pngp->prev_scanline = (uint8_t*)calloc(1, pngp->pitch);
|
||||
pngp->decoded_scanline = (uint8_t*)calloc(1, pngp->pitch);
|
||||
pngp->prev_scanline = (uint8_t*)calloc(1, pngp->pitch);
|
||||
pngp->decoded_scanline = (uint8_t*)calloc(1, pngp->pitch);
|
||||
|
||||
if (!pngp->prev_scanline || !pngp->decoded_scanline)
|
||||
goto error;
|
||||
@ -686,7 +685,7 @@ static int png_reverse_filter_adam7_iterate(uint32_t **data_,
|
||||
struct rpng_process *pngp)
|
||||
{
|
||||
int ret = 0;
|
||||
bool to_next = pngp->pass.pos < ARRAY_SIZE(passes);
|
||||
bool to_next = pngp->pass_pos < ARRAY_SIZE(passes);
|
||||
uint32_t *data = *data_;
|
||||
|
||||
if (!to_next)
|
||||
@ -710,19 +709,19 @@ static int png_reverse_filter_adam7_iterate(uint32_t **data_,
|
||||
if (ret == IMAGE_PROCESS_ERROR || ret == IMAGE_PROCESS_ERROR_END)
|
||||
return IMAGE_PROCESS_ERROR;
|
||||
|
||||
pngp->inflate_buf += pngp->pass.size;
|
||||
pngp->adam7_restore_buf_size += pngp->pass.size;
|
||||
pngp->inflate_buf += pngp->pass_size;
|
||||
pngp->adam7_restore_buf_size += pngp->pass_size;
|
||||
|
||||
pngp->total_out -= pngp->pass.size;
|
||||
pngp->total_out -= pngp->pass_size;
|
||||
|
||||
png_reverse_filter_adam7_deinterlace_pass(data,
|
||||
ihdr, pngp->data, pngp->pass.width, pngp->pass.height, &passes[pngp->pass.pos]);
|
||||
ihdr, pngp->data, pngp->pass_width, pngp->pass_height, &passes[pngp->pass_pos]);
|
||||
|
||||
free(pngp->data);
|
||||
|
||||
pngp->pass.width = 0;
|
||||
pngp->pass.height = 0;
|
||||
pngp->pass.size = 0;
|
||||
pngp->pass_width = 0;
|
||||
pngp->pass_height = 0;
|
||||
pngp->pass_size = 0;
|
||||
pngp->adam7_pass_initialized = false;
|
||||
|
||||
return IMAGE_PROCESS_NEXT;
|
||||
@ -741,7 +740,7 @@ static int png_reverse_filter_adam7(uint32_t **data_,
|
||||
case IMAGE_PROCESS_END:
|
||||
break;
|
||||
case IMAGE_PROCESS_NEXT:
|
||||
pngp->pass.pos++;
|
||||
pngp->pass_pos++;
|
||||
return 0;
|
||||
case IMAGE_PROCESS_ERROR:
|
||||
if (pngp->data)
|
||||
@ -751,8 +750,8 @@ static int png_reverse_filter_adam7(uint32_t **data_,
|
||||
return -1;
|
||||
}
|
||||
|
||||
pngp->inflate_buf -= pngp->adam7_restore_buf_size;
|
||||
pngp->adam7_restore_buf_size = 0;
|
||||
pngp->inflate_buf -= pngp->adam7_restore_buf_size;
|
||||
pngp->adam7_restore_buf_size = 0;
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -868,11 +867,44 @@ bool png_realloc_idat(const struct png_chunk *chunk, struct idat_buffer *buf)
|
||||
static struct rpng_process *rpng_process_init(rpng_t *rpng, unsigned *width, unsigned *height)
|
||||
{
|
||||
uint8_t *inflate_buf = NULL;
|
||||
struct rpng_process *process = (struct rpng_process*)calloc(1, sizeof(*process));
|
||||
struct rpng_process *process = (struct rpng_process*)malloc(sizeof(*process));
|
||||
|
||||
if (!process)
|
||||
return NULL;
|
||||
|
||||
process->inflate_initialized = false;
|
||||
process->adam7_pass_initialized = false;
|
||||
process->pass_initialized = false;
|
||||
process->prev_scanline = NULL;
|
||||
process->decoded_scanline = NULL;
|
||||
process->inflate_buf = NULL;
|
||||
|
||||
process->ihdr.width = 0;
|
||||
process->ihdr.height = 0;
|
||||
process->ihdr.depth = 0;
|
||||
process->ihdr.color_type = 0;
|
||||
process->ihdr.compression = 0;
|
||||
process->ihdr.filter = 0;
|
||||
process->ihdr.interlace = 0;
|
||||
|
||||
process->restore_buf_size = 0;
|
||||
process->restore_buf_size = 0;
|
||||
process->adam7_restore_buf_size = 0;
|
||||
process->data_restore_buf_size = 0;
|
||||
process->inflate_buf_size = 0;
|
||||
process->avail_in = 0;
|
||||
process->avail_out = 0;
|
||||
process->total_out = 0;
|
||||
process->pass_size = 0;
|
||||
process->bpp = 0;
|
||||
process->pitch = 0;
|
||||
process->h = 0;
|
||||
process->pass_width = 0;
|
||||
process->pass_height = 0;
|
||||
process->pass_pos = 0;
|
||||
process->data = NULL;
|
||||
process->palette = NULL;
|
||||
process->stream = NULL;
|
||||
process->stream_backend = trans_stream_get_zlib_inflate_backend();
|
||||
|
||||
png_pass_geom(&rpng->ihdr, rpng->ihdr.width,
|
||||
|
@ -60,13 +60,13 @@ typedef struct file_archive_file_data file_archive_file_data_t;
|
||||
|
||||
typedef struct file_archive_transfer
|
||||
{
|
||||
enum file_archive_transfer_type type;
|
||||
int32_t archive_size;
|
||||
file_archive_file_data_t *handle;
|
||||
void *stream;
|
||||
const uint8_t *footer;
|
||||
const uint8_t *directory;
|
||||
const uint8_t *data;
|
||||
int32_t archive_size;
|
||||
enum file_archive_transfer_type type;
|
||||
const struct file_archive_file_backend *backend;
|
||||
} file_archive_transfer_t;
|
||||
|
||||
|
@ -31,13 +31,13 @@ RETRO_BEGIN_DECLS
|
||||
typedef struct
|
||||
{
|
||||
/* bits per sample */
|
||||
int bitspersample;
|
||||
unsigned int bitspersample;
|
||||
|
||||
/* number of channels */
|
||||
int numchannels;
|
||||
unsigned int numchannels;
|
||||
|
||||
/* sample rate */
|
||||
int samplerate;
|
||||
unsigned int samplerate;
|
||||
|
||||
/* number of *samples* */
|
||||
size_t numsamples;
|
||||
|
@ -76,17 +76,17 @@ typedef int ssize_t;
|
||||
#endif
|
||||
|
||||
#ifdef _WIN32
|
||||
#define STRING_REP_INT64 "%I64u"
|
||||
#define STRING_REP_INT64 "%I64d"
|
||||
#define STRING_REP_UINT64 "%I64u"
|
||||
#define STRING_REP_ULONG "%Iu"
|
||||
#define STRING_REP_USIZE "%Iu"
|
||||
#elif defined(__STDC_VERSION__) && __STDC_VERSION__>=199901L && !defined(VITA) && !defined(WIIU)
|
||||
#define STRING_REP_INT64 "%llu"
|
||||
#define STRING_REP_INT64 "%lld"
|
||||
#define STRING_REP_UINT64 "%llu"
|
||||
#define STRING_REP_ULONG "%zu"
|
||||
#define STRING_REP_USIZE "%zu"
|
||||
#else
|
||||
#define STRING_REP_INT64 "%llu"
|
||||
#define STRING_REP_INT64 "%lld"
|
||||
#define STRING_REP_UINT64 "%llu"
|
||||
#define STRING_REP_ULONG "%lu"
|
||||
#define STRING_REP_USIZE "%lu"
|
||||
#endif
|
||||
|
||||
/*
|
||||
|
95
libretro-common/lists/vector_list.c
Normal file
95
libretro-common/lists/vector_list.c
Normal file
@ -0,0 +1,95 @@
|
||||
/* Copyright (C) 2010-2017 The RetroArch team
|
||||
*
|
||||
* ---------------------------------------------------------------------------------------
|
||||
* The following license statement only applies to this file (vector_list.c).
|
||||
* ---------------------------------------------------------------------------------------
|
||||
*
|
||||
* Permission is hereby granted, free of charge,
|
||||
* to any person obtaining a copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation the rights to
|
||||
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software,
|
||||
* and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
|
||||
* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include <boolean.h>
|
||||
#include <stdlib.h>
|
||||
#include <stddef.h>
|
||||
|
||||
/* default type is void*, override by defining VECTOR_LIST_TYPE before inclusion */
|
||||
#ifndef VECTOR_LIST_TYPE
|
||||
#define VECTOR_LIST_TYPE void*
|
||||
#define VECTOR_LIST_TYPE_DEFINED
|
||||
#endif
|
||||
|
||||
/* default name is void, override by defining VECTOR_LIST_NAME before inclusion */
|
||||
#ifndef VECTOR_LIST_NAME
|
||||
#define VECTOR_LIST_NAME void
|
||||
#define VECTOR_LIST_NAME_DEFINED
|
||||
#endif
|
||||
|
||||
#define CAT_I(a,b) a##b
|
||||
#define CAT(a,b) CAT_I(a, b)
|
||||
#define MAKE_TYPE_NAME() CAT(VECTOR_LIST_NAME, _vector_list)
|
||||
#define TYPE_NAME() MAKE_TYPE_NAME()
|
||||
|
||||
struct TYPE_NAME()
|
||||
{
|
||||
/* VECTOR_LIST_TYPE for pointers will expand to a pointer-to-pointer */
|
||||
VECTOR_LIST_TYPE *data;
|
||||
unsigned size;
|
||||
unsigned count;
|
||||
};
|
||||
|
||||
static struct TYPE_NAME()* CAT(TYPE_NAME(), _new(void))
|
||||
{
|
||||
struct TYPE_NAME() *list = (struct TYPE_NAME()*)calloc(1, sizeof(*list));
|
||||
|
||||
list->size = 8;
|
||||
list->data = (VECTOR_LIST_TYPE*)calloc(list->size, sizeof(*list->data));
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
static bool CAT(TYPE_NAME(), _append(struct TYPE_NAME() *list, VECTOR_LIST_TYPE elem))
|
||||
{
|
||||
if (list->size == list->count)
|
||||
{
|
||||
list->size *= 2;
|
||||
list->data = (VECTOR_LIST_TYPE*)realloc(list->data, list->size * sizeof(*list->data));
|
||||
|
||||
if (!list->data)
|
||||
return false;
|
||||
}
|
||||
|
||||
list->data[list->count] = elem;
|
||||
list->count++;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
static void CAT(TYPE_NAME(), _free(struct TYPE_NAME() *list))
|
||||
{
|
||||
if (list)
|
||||
{
|
||||
if (list->data)
|
||||
free(list->data);
|
||||
free(list);
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef VECTOR_LIST_TYPE_DEFINED
|
||||
#undef VECTOR_LIST_TYPE
|
||||
#endif
|
||||
|
||||
#ifdef VECTOR_LIST_NAME_DEFINED
|
||||
#undef VECTOR_LIST_NAME
|
||||
#endif
|
@ -117,8 +117,8 @@ void net_http_urlencode_full(char **dest, const char *source)
|
||||
for (; *source; source++)
|
||||
{
|
||||
/* any non-ascii character will just be encoded without question */
|
||||
if ((int)*source < sizeof(urlencode_lut) && urlencode_lut[(int)*source])
|
||||
snprintf(enc, len, "%c", urlencode_lut[(int)*source]);
|
||||
if ((unsigned)*source < sizeof(urlencode_lut) && urlencode_lut[(unsigned)*source])
|
||||
snprintf(enc, len, "%c", urlencode_lut[(unsigned)*source]);
|
||||
else
|
||||
snprintf(enc, len, "%%%02X", *source & 0xFF);
|
||||
|
||||
|
@ -87,7 +87,8 @@ chdstream_get_meta(chd_file *chd, int idx, metadata_t *md)
|
||||
memset(md, 0, sizeof(*md));
|
||||
|
||||
err = chd_get_metadata(chd, CDROM_TRACK_METADATA2_TAG, idx, meta,
|
||||
sizeof(meta), &meta_size, NULL, NULL);
|
||||
sizeof(meta), &meta_size, NULL, NULL);
|
||||
|
||||
if (err == CHDERR_NONE)
|
||||
{
|
||||
sscanf(meta, CDROM_TRACK_METADATA2_FORMAT,
|
||||
@ -100,7 +101,8 @@ chdstream_get_meta(chd_file *chd, int idx, metadata_t *md)
|
||||
}
|
||||
|
||||
err = chd_get_metadata(chd, CDROM_TRACK_METADATA_TAG, idx, meta,
|
||||
sizeof(meta), &meta_size, NULL, NULL);
|
||||
sizeof(meta), &meta_size, NULL, NULL);
|
||||
|
||||
if (err == CHDERR_NONE)
|
||||
{
|
||||
sscanf(meta, CDROM_TRACK_METADATA_FORMAT, &md->track, md->type,
|
||||
@ -110,7 +112,8 @@ chdstream_get_meta(chd_file *chd, int idx, metadata_t *md)
|
||||
}
|
||||
|
||||
err = chd_get_metadata(chd, GDROM_TRACK_METADATA_TAG, idx, meta,
|
||||
sizeof(meta), &meta_size, NULL, NULL);
|
||||
sizeof(meta), &meta_size, NULL, NULL);
|
||||
|
||||
if (err == CHDERR_NONE)
|
||||
{
|
||||
sscanf(meta, GDROM_TRACK_METADATA_FORMAT, &md->track, md->type,
|
||||
@ -132,9 +135,7 @@ chdstream_find_track_number(chd_file *fd, int32_t track, metadata_t *meta)
|
||||
for (i = 0; true; ++i)
|
||||
{
|
||||
if (!chdstream_get_meta(fd, i, meta))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (track == meta->track)
|
||||
{
|
||||
@ -156,24 +157,29 @@ chdstream_find_special_track(chd_file *fd, int32_t track, metadata_t *meta)
|
||||
|
||||
for (i = 1; true; ++i)
|
||||
{
|
||||
if (!chdstream_find_track_number(fd, i, &iter)) {
|
||||
if (track == CHDSTREAM_TRACK_LAST && i > 1) {
|
||||
if (!chdstream_find_track_number(fd, i, &iter))
|
||||
{
|
||||
if (track == CHDSTREAM_TRACK_LAST && i > 1)
|
||||
{
|
||||
*meta = iter;
|
||||
return true;
|
||||
} else if (track == CHDSTREAM_TRACK_PRIMARY && largest_track != 0) {
|
||||
return chdstream_find_track_number(fd, largest_track, meta);
|
||||
}
|
||||
else if (track == CHDSTREAM_TRACK_PRIMARY && largest_track != 0)
|
||||
return chdstream_find_track_number(fd, largest_track, meta);
|
||||
}
|
||||
|
||||
switch (track) {
|
||||
switch (track)
|
||||
{
|
||||
case CHDSTREAM_TRACK_FIRST_DATA:
|
||||
if (strcmp(iter.type, "AUDIO")) {
|
||||
if (strcmp(iter.type, "AUDIO"))
|
||||
{
|
||||
*meta = iter;
|
||||
return true;
|
||||
}
|
||||
break;
|
||||
case CHDSTREAM_TRACK_PRIMARY:
|
||||
if (strcmp(iter.type, "AUDIO") && iter.frames > largest_size) {
|
||||
if (strcmp(iter.type, "AUDIO") && iter.frames > largest_size)
|
||||
{
|
||||
largest_size = iter.frames;
|
||||
largest_track = iter.track;
|
||||
}
|
||||
@ -187,21 +193,19 @@ chdstream_find_special_track(chd_file *fd, int32_t track, metadata_t *meta)
|
||||
static bool
|
||||
chdstream_find_track(chd_file *fd, int32_t track, metadata_t *meta)
|
||||
{
|
||||
if (track < 0) {
|
||||
if (track < 0)
|
||||
return chdstream_find_special_track(fd, track, meta);
|
||||
} else {
|
||||
return chdstream_find_track_number(fd, track, meta);
|
||||
}
|
||||
return chdstream_find_track_number(fd, track, meta);
|
||||
}
|
||||
|
||||
chdstream_t *chdstream_open(const char *path, int32_t track)
|
||||
{
|
||||
metadata_t meta;
|
||||
uint32_t pregap = 0;
|
||||
const chd_header *hd = NULL;
|
||||
chdstream_t *stream = NULL;
|
||||
chd_file *chd = NULL;
|
||||
chd_error err = chd_open(path, CHD_OPEN_READ, NULL, &chd);
|
||||
metadata_t meta;
|
||||
|
||||
if (err != CHDERR_NONE)
|
||||
goto error;
|
||||
@ -317,7 +321,7 @@ ssize_t chdstream_read(chdstream_t *stream, void *data, size_t bytes)
|
||||
uint32_t amount;
|
||||
size_t data_offset = 0;
|
||||
const chd_header *hd = chd_get_header(stream->chd);
|
||||
uint8_t *out = data;
|
||||
uint8_t *out = (uint8_t*)data;
|
||||
|
||||
if (stream->track_end - stream->offset < bytes)
|
||||
bytes = stream->track_end - stream->offset;
|
||||
@ -342,7 +346,6 @@ ssize_t chdstream_read(chdstream_t *stream, void *data, size_t bytes)
|
||||
|
||||
if (!chdstream_load_hunk(stream, hunk))
|
||||
{
|
||||
abort();
|
||||
return -1;
|
||||
}
|
||||
memcpy(out + data_offset,
|
||||
|
@ -62,6 +62,7 @@
|
||||
#endif
|
||||
|
||||
#include <streams/file_stream.h>
|
||||
#include <string/stdstring.h>
|
||||
#include <memmap.h>
|
||||
#include <retro_miscellaneous.h>
|
||||
|
||||
@ -567,7 +568,7 @@ int filestream_close(RFILE *stream)
|
||||
if (!stream)
|
||||
goto error;
|
||||
|
||||
if (stream->ext)
|
||||
if (!string_is_empty(stream->ext))
|
||||
free(stream->ext);
|
||||
|
||||
#if defined(PSP)
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user