diff --git a/CHANGES.md b/CHANGES.md index 5498b913d0..4ea542a340 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -15,28 +15,40 @@ - D3D9: Add menu support for MaterialUI/XMB. - D3D10: Initial video driver implementation. - D3D11: Initial video driver implementation. +- D3D11: SPIRV-Cross/slang shader support for D3D11. - D3D12: Initial video driver implementation. - DINPUT: don't reinitialize input driver on network events / media insertion / network drive connection - INPUT: show friendly names when available under input binds and system information - INPUT: show the config name when available under system information - GUI: Allow changing menu font color. - GUI: Menu visibility options for RGUI and MaterialUI. +- GUI/MaterialUI: Works now with D3D8, D3D9 Cg, D3D11 and D3D12 drivers. - GUI/XMB: Add Monochrome Inverted icon theme. - GUI/XMB: Allow changing menu scale to 200%. +- GUI/XMB: Works now with D3D8, D3D9 Cg, D3D11 and D3D12 drivers. Menu shader effects currently don't work on D3D8/D3D9 Cg. - HAIKU: Restored port. - KEYMAPPER: prevent a condition that caused input_menu_toggle to stop working when a RETRO_DEVICE_KEYBOARD type device is enabled - GL: ignore hard gpu sync when fast-forwarding - IOS10/11: Handle hardware keyboards and iCade controllers - LOCALIZATION: Update Italian translation. - LOCALIZATION: Update Japanese translation. +- LOCALIZATION: Update Portuguese-Brazilian translation. - LOCALIZATION: Update Spanish translation. -- OSX: Modify HID buttons detection algorithm. +- NETPLAY: Add menu option to select different MITM (relay) server locations. +- OSX: Modify HID buttons detection algorithm. +- QB: Added --datarootdir. +- QB: Added --bindir and --mandir and deprecated --with-bin_dir and --with-man_dir. +- QB: Added --docdir. +- SHADERS: Allow saving of shader presets based on the parent directory (Saving one for */foo/bar/mario.sfc* would result in *shaders/presets/corename/bar.ext*). We decided it's safer to still isolate the presets to a single core because different cores may treat video output differently. +- SHADERS: Don't save the path to the current preset to the main config. This was causing weird behavior, instead it will try to load *currentconfig.ext* and it will save a preset with that name when select *apply shader preset*. The resulting shader will restore properly after restarting and even after core/parent/game specific presets are loaded - SOLARIS: Initial port. - SWITCH: Initial Nintendo Switch port, based on libtransistor SDK. - PS3: Enable Cheevos. - PSP: Enable threading support through pthreads. +- SHADERS: SPIRV-Cross/slang shader support for D3D11. - SHIELD ATV: Allow the remote / gamepad takeover hack to work with the 2017 gamepad -- VULKAN: Fix swapchain recreation bug on Nvidia GPUs with Windows 10 through workaround (will be properly resolved in a future driver version). +- SUBSYSTEM: Subsystem saves now respect the save directory +- VULKAN: Fix swapchain recreation bug on Nvidia GPUs with Windows 10 (resolved in Windows Nvidia driver version 390.77). - WINDOWS: Improved Unicode support (for cores/directory creation and 7zip archives). - WINDOWS: Show progress meter on taskbar for downloads (Windows 7 and up). - WINDOWS: WS_EX_LAYERED drastically decreases performance, so only set it when needed (transparency in windowed mode). @@ -45,6 +57,7 @@ - WIIU: Increased stability during core switching. - WIIU: Shader support. - WIIU: Menu shader effects added (shaders). +- WIIU: Add missing time/clock support. (also fixes RTC [Real Time Clock] in Gambatte) - XBOX OG: Restored port. # 1.7.0 diff --git a/Makefile b/Makefile index c4867112bb..9a33100f44 100644 --- a/Makefile +++ b/Makefile @@ -201,29 +201,33 @@ install: $(TARGET) rm -f $(OBJDIR)/git_version.o mkdir -p $(DESTDIR)$(BIN_DIR) 2>/dev/null || /bin/true mkdir -p $(DESTDIR)$(GLOBAL_CONFIG_DIR) 2>/dev/null || /bin/true - mkdir -p $(DESTDIR)$(PREFIX)/share/applications 2>/dev/null || /bin/true + mkdir -p $(DESTDIR)$(DATA_DIR)/applications 2>/dev/null || /bin/true + mkdir -p $(DESTDIR)$(DOC_DIR) 2>/dev/null || /bin/true mkdir -p $(DESTDIR)$(MAN_DIR)/man6 2>/dev/null || /bin/true - mkdir -p $(DESTDIR)$(PREFIX)/share/pixmaps 2>/dev/null || /bin/true + mkdir -p $(DESTDIR)$(DATA_DIR)/pixmaps 2>/dev/null || /bin/true cp $(TARGET) $(DESTDIR)$(BIN_DIR) cp tools/cg2glsl.py $(DESTDIR)$(BIN_DIR)/retroarch-cg2glsl cp retroarch.cfg $(DESTDIR)$(GLOBAL_CONFIG_DIR) - cp retroarch.desktop $(DESTDIR)$(PREFIX)/share/applications + cp retroarch.desktop $(DESTDIR)$(DATA_DIR)/applications cp docs/retroarch.6 $(DESTDIR)$(MAN_DIR)/man6 cp docs/retroarch-cg2glsl.6 $(DESTDIR)$(MAN_DIR)/man6 - cp media/retroarch.svg $(DESTDIR)$(PREFIX)/share/pixmaps + cp media/retroarch.svg $(DESTDIR)$(DATA_DIR)/pixmaps + cp COPYING $(DESTDIR)$(DOC_DIR) + cp README.md $(DESTDIR)$(DOC_DIR) chmod 755 $(DESTDIR)$(BIN_DIR)/$(TARGET) chmod 755 $(DESTDIR)$(BIN_DIR)/retroarch-cg2glsl chmod 644 $(DESTDIR)$(GLOBAL_CONFIG_DIR)/retroarch.cfg - chmod 644 $(DESTDIR)$(PREFIX)/share/applications/retroarch.desktop + chmod 644 $(DESTDIR)$(DATA_DIR)/applications/retroarch.desktop chmod 644 $(DESTDIR)$(MAN_DIR)/man6/retroarch.6 chmod 644 $(DESTDIR)$(MAN_DIR)/man6/retroarch-cg2glsl.6 - chmod 644 $(DESTDIR)$(PREFIX)/share/pixmaps/retroarch.svg + chmod 644 $(DESTDIR)$(DATA_DIR)/pixmaps/retroarch.svg @if test -d media/assets; then \ echo "Installing media assets..."; \ - mkdir -p $(DESTDIR)$(ASSETS_DIR)/retroarch/assets/xmb; \ - mkdir -p $(DESTDIR)$(ASSETS_DIR)/retroarch/assets/glui; \ - cp -r media/assets/xmb/ $(DESTDIR)$(ASSETS_DIR)/retroarch/assets; \ - cp -r media/assets/glui/ $(DESTDIR)$(ASSETS_DIR)/retroarch/assets; \ + mkdir -p $(DESTDIR)$(ASSETS_DIR)/assets/xmb; \ + mkdir -p $(DESTDIR)$(ASSETS_DIR)/assets/glui; \ + cp -r media/assets/xmb/ $(DESTDIR)$(ASSETS_DIR)/assets; \ + cp -r media/assets/glui/ $(DESTDIR)$(ASSETS_DIR)/assets; \ + cp media/assets/COPYING $(DESTDIR)$(DOC_DIR)/COPYING.assets; \ echo "Asset copying done."; \ fi @@ -231,11 +235,14 @@ uninstall: rm -f $(DESTDIR)$(BIN_DIR)/retroarch rm -f $(DESTDIR)$(BIN_DIR)/retroarch-cg2glsl rm -f $(DESTDIR)$(GLOBAL_CONFIG_DIR)/retroarch.cfg - rm -f $(DESTDIR)$(PREFIX)/share/applications/retroarch.desktop + rm -f $(DESTDIR)$(DATA_DIR)/applications/retroarch.desktop + rm -f $(DESTDIR)$(DATA_DIR)/pixmaps/retroarch.svg + rm -f $(DESTDIR)$(DOC_DIR)/COPYING + rm -f $(DESTDIR)$(DOC_DIR)/COPYING.assets + rm -f $(DESTDIR)$(DOC_DIR)/README.md rm -f $(DESTDIR)$(MAN_DIR)/man6/retroarch.6 rm -f $(DESTDIR)$(MAN_DIR)/man6/retroarch-cg2glsl.6 - rm -f $(DESTDIR)$(PREFIX)/share/pixmaps/retroarch.svg - rm -rf $(DESTDIR)$(ASSETS_DIR)/retroarch + rm -rf $(DESTDIR)$(ASSETS_DIR) clean: rm -rf $(OBJDIR_BASE) diff --git a/Makefile.common b/Makefile.common index 62039e6871..db49fc94b3 100644 --- a/Makefile.common +++ b/Makefile.common @@ -284,7 +284,8 @@ OBJ += intl/msg_hash_de.o \ intl/msg_hash_ru.o \ intl/msg_hash_vn.o \ intl/msg_hash_chs.o \ - intl/msg_hash_cht.o + intl/msg_hash_cht.o \ + intl/msg_hash_ar.o endif @@ -1267,8 +1268,12 @@ ifeq ($(HAVE_D3D11), 1) endif ifeq ($(HAVE_D3D12), 1) - OBJ += gfx/drivers/d3d12.o gfx/common/d3d12_common.o + OBJ += gfx/drivers/d3d12.o gfx/common/d3d12_common.o \ + gfx/drivers_font/d3d12_font.o menu/drivers_display/menu_display_d3d12.o DEFINES += -DHAVE_D3D12 + HAVE_SLANG = 1 + HAVE_GLSLANG = 1 + HAVE_SPIRV_CROSS = 1 endif ifneq ($(findstring 1, $(HAVE_D3D10) $(HAVE_D3D11) $(HAVE_D3D12)),) @@ -1355,11 +1360,13 @@ ifeq ($(HAVE_GLSLANG), 1) endif ifeq ($(HAVE_SPIRV_CROSS), 1) + DEFINES += -DHAVE_SPIRV_CROSS INCLUDE_DIRS += -I$(DEPS_DIR)/SPIRV-Cross OBJ += $(DEPS_DIR)/SPIRV-Cross/spirv_cross.o OBJ += $(DEPS_DIR)/SPIRV-Cross/spirv_cfg.o OBJ += $(DEPS_DIR)/SPIRV-Cross/spirv_glsl.o OBJ += $(DEPS_DIR)/SPIRV-Cross/spirv_hlsl.o + OBJ += $(DEPS_DIR)/SPIRV-Cross/spirv_msl.o endif ifeq ($(WANT_WGL), 1) diff --git a/Makefile.griffin b/Makefile.griffin index 182281628b..4f565c7a60 100644 --- a/Makefile.griffin +++ b/Makefile.griffin @@ -671,6 +671,10 @@ ifeq ($(HAVE_GRIFFIN_CPP), 1) OBJ += griffin/griffin_cpp.o endif +ifeq ($(WANT_GLSLANG), 1) + OBJ += griffin/griffin_glslang.o +endif + ifeq ($(HAVE_LOGGER), 1) CFLAGS += -DHAVE_LOGGER CFLAGS += -DPC_DEVELOPMENT_IP_ADDRESS=\"$(PC_DEVELOPMENT_IP_ADDRESS)\" -DPC_DEVELOPMENT_UDP_PORT=$(PC_DEVELOPMENT_UDP_PORT) diff --git a/Makefile.msvc b/Makefile.msvc index b21810c96f..77d02fc9fa 100644 --- a/Makefile.msvc +++ b/Makefile.msvc @@ -5,6 +5,7 @@ OS = Win32 ARCH = amd64 #TARGET_ARCH = x86 BUILD_DIR = objs/msvc +CXX_BUILD = 0 WindowsSdkDir = C:\Program Files (x86)\Windows Kits\10\$(NOTHING) @@ -54,12 +55,12 @@ HAVE_LANGEXTRA := 1 HAVE_CHEEVOS := 1 HAVE_KEYMAPPER := 1 HAVE_SHADERPIPELINE := 1 +HAVE_IMAGEVIEWER := 1 include Makefile.common INCLUDE_DIRS := $(patsubst -isystem%,-I%,$(INCLUDE_DIRS)) CFLAGS := $(filter-out -Wno-unknown-pragmas,$(CFLAGS)) CXXFLAGS := $(filter-out -fpermissive -Wno-switch -Wno-sign-compare -fno-strict-aliasing -Wno-maybe-uninitialized -Wno-reorder -Wno-parentheses,$(CXXFLAGS)) -CXXFLAGS += $(CFLAGS) LIBS := $(filter-out -lstdc++,$(LIBS)) ifeq ($(ARCH),x64) @@ -124,11 +125,16 @@ FLAGS += -Gm- -Zc:inline -fp:precise -Zc:forScope -GR- -Gd -Oi -volatile:iso #FLAGS += -utf-8 #FLAGS += -source-charset:utf-8 +CXXFLAGS += $(CFLAGS) -TP -EHsc +ifeq ($(CXX_BUILD),1) + CFLAGS := $(CXXFLAGS) + DEFINES += -DCXX_BUILD +else + CFLAGS += -TC +endif -CFLAGS += -TC -CXXFLAGS += -TP -EHsc WARNINGS += -WX -W3 -WARNINGS += -wd4101 -wd4996 -wd4244 -wd4267 -wd4090 -wd4305 -wd4146 -wd4334 -wd4018 -wd4800 +WARNINGS += -wd4101 -wd4996 -wd4244 -wd4267 -wd4090 -wd4305 -wd4146 -wd4334 -wd4018 -wd4800 -wd4838 CC = cl.exe CXX = cl.exe diff --git a/audio/audio_driver.c b/audio/audio_driver.c index 3a182c560d..bc2231c76e 100644 --- a/audio/audio_driver.c +++ b/audio/audio_driver.c @@ -146,8 +146,10 @@ static size_t audio_driver_rewind_size = 0; static int16_t *audio_driver_rewind_buf = NULL; static int16_t *audio_driver_output_samples_conv_buf = NULL; +#ifdef DEBUG static unsigned audio_driver_free_samples_buf[AUDIO_BUFFER_FREE_SAMPLES_COUNT]; static uint64_t audio_driver_free_samples_count = 0; +#endif static size_t audio_driver_buffer_size = 0; static size_t audio_driver_data_ptr = 0; @@ -191,6 +193,7 @@ enum resampler_quality audio_driver_get_resampler_quality(void) return (enum resampler_quality)settings->uints.audio_resampler_quality; } +#ifdef DEBUG /** * compute_audio_buffer_statistics: * @@ -255,6 +258,7 @@ static void compute_audio_buffer_statistics(void) (100.0 * low_water_count) / (samples - 1), (100.0 * high_water_count) / (samples - 1)); } +#endif /** * audio_driver_find_handle: @@ -339,7 +343,9 @@ static bool audio_driver_deinit_internal(void) command_event(CMD_EVENT_DSP_FILTER_DEINIT, NULL); +#ifdef DEBUG compute_audio_buffer_statistics(); +#endif return true; } @@ -508,7 +514,9 @@ static bool audio_driver_init_internal(bool audio_cb_inited) command_event(CMD_EVENT_DSP_FILTER_INIT, NULL); +#ifdef DEBUG audio_driver_free_samples_count = 0; +#endif audio_mixer_init(settings->uints.audio_out_rate); @@ -612,17 +620,19 @@ static void audio_driver_flush(const int16_t *data, size_t samples) if (audio_driver_control) { /* Readjust the audio input rate. */ - unsigned write_idx = audio_driver_free_samples_count++ & - (AUDIO_BUFFER_FREE_SAMPLES_COUNT - 1); int half_size = (int)(audio_driver_buffer_size / 2); int avail = (int)current_audio->write_avail(audio_driver_context_audio_data); int delta_mid = avail - half_size; double direction = (double)delta_mid / half_size; double adjust = 1.0 + audio_driver_rate_control_delta * direction; +#ifdef DEBUG + unsigned write_idx = audio_driver_free_samples_count++ & + (AUDIO_BUFFER_FREE_SAMPLES_COUNT - 1); audio_driver_free_samples_buf [write_idx] = avail; +#endif audio_source_ratio_current = audio_source_ratio_original * adjust; diff --git a/audio/drivers/xaudio.c b/audio/drivers/xaudio.c index f267cb04e0..d344508b70 100644 --- a/audio/drivers/xaudio.c +++ b/audio/drivers/xaudio.c @@ -59,13 +59,13 @@ typedef struct size_t bufsize; } xa_t; -#ifdef __cplusplus +#if defined(__cplusplus) && !defined(CINTERFACE) struct xaudio2 : public IXAudio2VoiceCallback #else struct xaudio2 #endif { -#ifdef __cplusplus +#if defined(__cplusplus) && !defined(CINTERFACE) xaudio2() : buf(0), pXAudio2(0), pMasterVoice(0), pSourceVoice(0), hEvent(0), buffers(0), bufsize(0), @@ -101,8 +101,8 @@ struct xaudio2 unsigned write_buffer; }; -#ifndef __cplusplus -static void WINAPI voice_on_buffer_end(void *handle_, void *data) +#if !defined(__cplusplus) || defined(CINTERFACE) +static void WINAPI voice_on_buffer_end(IXAudio2VoiceCallback *handle_, void *data) { xaudio2_t *handle = (xaudio2_t*)handle_; (void)data; @@ -110,10 +110,10 @@ static void WINAPI voice_on_buffer_end(void *handle_, void *data) 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; } +static void WINAPI dummy_voidp(IXAudio2VoiceCallback *handle, void *data) { (void)handle; (void)data; } +static void WINAPI dummy_nil(IXAudio2VoiceCallback *handle) { (void)handle; } +static void WINAPI dummy_uint32(IXAudio2VoiceCallback *handle, UINT32 dummy) { (void)handle; (void)dummy; } +static void WINAPI dummy_voidp_hresult(IXAudio2VoiceCallback *handle, void *data, HRESULT dummy) { (void)handle; (void)data; (void)dummy; } const struct IXAudio2VoiceCallbackVtbl voice_vtable = { dummy_uint32, @@ -189,7 +189,7 @@ static void xaudio2_free(xaudio2_t *handle) free(handle->buf); -#ifdef __cplusplus +#if defined(__cplusplus) && !defined(CINTERFACE) delete handle; #else free(handle); @@ -206,7 +206,7 @@ static xaudio2_t *xaudio2_new(unsigned samplerate, unsigned channels, CoInitializeEx(0, COINIT_MULTITHREADED); #endif -#ifdef __cplusplus +#if defined(__cplusplus) && !defined(CINTERFACE) handle = new xaudio2; #else handle = (xaudio2_t*)calloc(1, sizeof(*handle)); @@ -215,7 +215,7 @@ static xaudio2_t *xaudio2_new(unsigned samplerate, unsigned channels, if (!handle) goto error; -#ifndef __cplusplus +#if !defined(__cplusplus) || defined(CINTERFACE) handle->lpVtbl = &voice_vtable; #endif diff --git a/audio/drivers/xaudio.h b/audio/drivers/xaudio.h index 4c03e60035..788fe16789 100644 --- a/audio/drivers/xaudio.h +++ b/audio/drivers/xaudio.h @@ -26,7 +26,7 @@ /* All structures defined in this file use tight field packing */ #pragma pack(push, 1) -#ifdef __cplusplus +#if defined(__cplusplus) && !defined(CINTERFACE) #define X2DEFAULT(x) = (x) #else #define X2DEFAULT(x) @@ -183,6 +183,9 @@ typedef struct XAUDIO2_BUFFER void *pContext; } XAUDIO2_BUFFER; +#undef INTERFACE +#define INTERFACE IXAudio2VoiceCallback + DECLARE_INTERFACE(IXAudio2VoiceCallback) { STDMETHOD_(void, OnVoiceProcessingPassStart) (THIS_ UINT32 BytesRequired) PURE; @@ -194,6 +197,9 @@ DECLARE_INTERFACE(IXAudio2VoiceCallback) STDMETHOD_(void, OnVoiceError) (THIS_ void *pBufferContext, HRESULT Error) PURE; }; +#undef INTERFACE +#define INTERFACE IXAudio2Voice + DECLARE_INTERFACE(IXAudio2Voice) { #define Declare_IXAudio2Voice_Methods() \ @@ -235,11 +241,17 @@ DECLARE_INTERFACE(IXAudio2Voice) Declare_IXAudio2Voice_Methods(); }; +#undef INTERFACE +#define INTERFACE IXAudio2MasteringVoice + DECLARE_INTERFACE_(IXAudio2MasteringVoice, IXAudio2Voice) { Declare_IXAudio2Voice_Methods(); }; +#undef INTERFACE +#define INTERFACE IXAudio2SourceVoice + DECLARE_INTERFACE_(IXAudio2SourceVoice, IXAudio2Voice) { Declare_IXAudio2Voice_Methods(); @@ -255,6 +267,8 @@ DECLARE_INTERFACE_(IXAudio2SourceVoice, IXAudio2Voice) STDMETHOD_(void, GetFrequencyRatio) (THIS_ float* pRatio) PURE; }; +#undef INTERFACE +#define INTERFACE IXAudio2 DECLARE_INTERFACE_(IXAudio2, IUnknown) { @@ -292,7 +306,7 @@ DECLARE_INTERFACE_(IXAudio2, IUnknown) void *pReserved X2DEFAULT(NULL)) PURE; }; -#ifdef __cplusplus +#if defined(__cplusplus) && !defined(CINTERFACE) /* C++ hooks */ #define IXAudio2_Initialize(handle,a,b) handle->Initialize(a, b) #define IXAudio2SourceVoice_SubmitSourceBuffer(handle, a, b) handle->SubmitSourceBuffer(a, b) @@ -305,17 +319,17 @@ DECLARE_INTERFACE_(IXAudio2, IUnknown) #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) +#define IXAudio2_Initialize(handle,a,b) (handle)->lpVtbl->Initialize(handle, a, b) +#define IXAudio2_Release(handle) (handle)->lpVtbl->Release(handle) +#define IXAudio2_CreateSourceVoice(handle,ppSourceVoice,pSourceFormat,Flags,MaxFrequencyRatio,pCallback,pSendList,pEffectChain) (handle)->lpVtbl->CreateSourceVoice(handle, ppSourceVoice,pSourceFormat,Flags,MaxFrequencyRatio,pCallback,pSendList,pEffectChain) +#define IXAudio2_CreateMasteringVoice(handle,ppMasteringVoice,InputChannels,InputSampleRate,Flags,DeviceIndex,pEffectChain) (handle)->lpVtbl->CreateMasteringVoice(handle, ppMasteringVoice,InputChannels,InputSampleRate,Flags,DeviceIndex,pEffectChain) +#define IXAudio2_GetDeviceCount(handle, puCount) (handle)->lpVtbl->GetDeviceCount(handle, puCount) +#define IXAudio2_GetDeviceDetails(handle, Index,pDeviceDetails) (handle)->lpVtbl->GetDeviceDetails(handle, Index, pDeviceDetails) +#define IXAudio2SourceVoice_Start(handle, Flags, OperationSet) (handle)->lpVtbl->Start(handle, Flags, OperationSet) +#define IXAudio2SourceVoice_Stop(handle, Flags, OperationSet) (handle)->lpVtbl->Stop(handle, Flags, OperationSet) +#define IXAudio2SourceVoice_SubmitSourceBuffer(handle, pBuffer, pBufferWMA) (handle)->lpVtbl->SubmitSourceBuffer(handle, pBuffer, pBufferWMA) +#define IXAudio2SourceVoice_DestroyVoice(handle) (handle)->lpVtbl->DestroyVoice(handle) +#define IXAudio2MasteringVoice_DestroyVoice(handle) (handle)->lpVtbl->DestroyVoice(handle) #endif #ifdef _XBOX diff --git a/cheevos/cheevos.c b/cheevos/cheevos.c index 425577807e..8fd423a885 100644 --- a/cheevos/cheevos.c +++ b/cheevos/cheevos.c @@ -611,19 +611,19 @@ static void cheevos_build_memaddr(const cheevos_condition_t* condition, case CHEEVOS_COND_OP_EQUALS: cheevos_add_char(&aux, &left, '='); break; - case CHEEVOS_COND_OP_GREATER_THAN: + case CHEEVOS_COND_OP_GREATER_THAN: cheevos_add_char(&aux, &left, '>'); break; - case CHEEVOS_COND_OP_GREATER_THAN_OR_EQUAL: + case CHEEVOS_COND_OP_GREATER_THAN_OR_EQUAL: cheevos_add_string(&aux, &left, ">="); break; - case CHEEVOS_COND_OP_LESS_THAN: + case CHEEVOS_COND_OP_LESS_THAN: cheevos_add_char(&aux, &left, '<'); break; - case CHEEVOS_COND_OP_LESS_THAN_OR_EQUAL: + case CHEEVOS_COND_OP_LESS_THAN_OR_EQUAL: cheevos_add_string(&aux, &left, "<="); break; - case CHEEVOS_COND_OP_NOT_EQUAL_TO: + case CHEEVOS_COND_OP_NOT_EQUAL_TO: cheevos_add_string(&aux, &left, "!="); break; } @@ -1028,11 +1028,11 @@ static int cheevos_parse_expression(cheevos_expr_t *expr, const char* mem) cheevos_term_t *terms = NULL; char *end = NULL; - if (expr) - { - expr->count = 1; - expr->compare_count = 1; - } + if (!expr) + return -1; + + expr->count = 1; + expr->compare_count = 1; for (aux = mem;; aux++) { @@ -2359,49 +2359,49 @@ void cheevos_populate_menu(void *data) menu_displaylist_info_t *info = (menu_displaylist_info_t*)data; cheevo_t *end = NULL; cheevo_t *cheevo = cheevos_locals.core.cheevos; - - if (!cheevo) - return; - end = cheevo + cheevos_locals.core.count; - for (i = 0; cheevo < end; i++, cheevo++) + if (cheevo) { - if (!(cheevo->active & CHEEVOS_ACTIVE_HARDCORE)) + for (i = 0; cheevo < end; i++, cheevo++) { + if (!(cheevo->active & CHEEVOS_ACTIVE_HARDCORE)) + { menu_entries_append_enum(info->list, cheevo->title, - cheevo->description, - MENU_ENUM_LABEL_CHEEVOS_UNLOCKED_ENTRY_HARDCORE, - MENU_SETTINGS_CHEEVOS_START + i, 0, 0); + cheevo->description, + MENU_ENUM_LABEL_CHEEVOS_UNLOCKED_ENTRY_HARDCORE, + MENU_SETTINGS_CHEEVOS_START + i, 0, 0); items_found++; set_badge_info(&badges_ctx, i, cheevo->badge, (cheevo->active & CHEEVOS_ACTIVE_HARDCORE)); - } - else if (!(cheevo->active & CHEEVOS_ACTIVE_SOFTCORE)) - { + } + else if (!(cheevo->active & CHEEVOS_ACTIVE_SOFTCORE)) + { menu_entries_append_enum(info->list, cheevo->title, - cheevo->description, - MENU_ENUM_LABEL_CHEEVOS_UNLOCKED_ENTRY, - MENU_SETTINGS_CHEEVOS_START + i, 0, 0); + cheevo->description, + MENU_ENUM_LABEL_CHEEVOS_UNLOCKED_ENTRY, + MENU_SETTINGS_CHEEVOS_START + i, 0, 0); items_found++; set_badge_info(&badges_ctx, i, cheevo->badge, (cheevo->active & CHEEVOS_ACTIVE_SOFTCORE)); - } - else - { + } + else + { menu_entries_append_enum(info->list, cheevo->title, - cheevo->description, - MENU_ENUM_LABEL_CHEEVOS_LOCKED_ENTRY, - MENU_SETTINGS_CHEEVOS_START + i, 0, 0); + cheevo->description, + MENU_ENUM_LABEL_CHEEVOS_LOCKED_ENTRY, + MENU_SETTINGS_CHEEVOS_START + i, 0, 0); items_found++; set_badge_info(&badges_ctx, i, cheevo->badge, (cheevo->active & CHEEVOS_ACTIVE_SOFTCORE)); + } } } - if (settings->bools.cheevos_test_unofficial) + cheevo = cheevos_locals.unofficial.cheevos; + + if (cheevo && settings->bools.cheevos_test_unofficial) { - cheevo = cheevos_locals.unofficial.cheevos; end = cheevo + cheevos_locals.unofficial.count; for (i = cheevos_locals.core.count; cheevo < end; i++, cheevo++) @@ -2487,8 +2487,9 @@ bool cheevos_apply_cheats(bool *data_bool) bool cheevos_unload(void) { + bool running; CHEEVOS_LOCK(cheevos_locals.task_lock); - bool running = cheevos_locals.task != NULL; + running = cheevos_locals.task != NULL; CHEEVOS_UNLOCK(cheevos_locals.task_lock); if (running) @@ -3095,6 +3096,26 @@ found: if ((void*)coro->json) free((void*)coro->json); + if ( cheevos_locals.core.count == 0 + && cheevos_locals.unofficial.count == 0 + && cheevos_locals.lboard_count == 0) + { + runloop_msg_queue_push( + "This game has no achievements.", + 0, 5 * 60, false); + + cheevos_free_cheevo_set(&cheevos_locals.core); + cheevos_free_cheevo_set(&cheevos_locals.unofficial); + + cheevos_locals.core.cheevos = NULL; + cheevos_locals.unofficial.cheevos = NULL; + cheevos_locals.core.count = 0; + cheevos_locals.unofficial.count = 0; + + cheevos_loaded = false; + CORO_STOP(); + } + cheevos_loaded = true; /* @@ -3109,40 +3130,28 @@ found: */ CORO_GOSUB(PLAYING); - if (coro->settings->bools.cheevos_verbose_enable) + if (coro->settings->bools.cheevos_verbose_enable && cheevos_locals.core.count > 0) { - if(cheevos_locals.core.count > 0) - { - char msg[256]; - int mode = CHEEVOS_ACTIVE_SOFTCORE; - const cheevo_t* cheevo = cheevos_locals.core.cheevos; - const cheevo_t* end = cheevo + cheevos_locals.core.count; - int number_of_unlocked = cheevos_locals.core.count; + char msg[256]; + int mode = CHEEVOS_ACTIVE_SOFTCORE; + const cheevo_t* cheevo = cheevos_locals.core.cheevos; + const cheevo_t* end = cheevo + cheevos_locals.core.count; + int number_of_unlocked = cheevos_locals.core.count; - if (coro->settings->bools.cheevos_hardcore_mode_enable) - mode = CHEEVOS_ACTIVE_HARDCORE; + if (coro->settings->bools.cheevos_hardcore_mode_enable) + mode = CHEEVOS_ACTIVE_HARDCORE; - for (; cheevo < end; cheevo++) - if(cheevo->active & mode) - number_of_unlocked--; + for (; cheevo < end; cheevo++) + if(cheevo->active & mode) + number_of_unlocked--; - snprintf(msg, sizeof(msg), - "You have %d of %d achievements unlocked.", - number_of_unlocked, cheevos_locals.core.count); - msg[sizeof(msg) - 1] = 0; - runloop_msg_queue_push(msg, 0, 6 * 60, false); - } - else - runloop_msg_queue_push( - "This game has no achievements.", - 0, 5 * 60, false); + snprintf(msg, sizeof(msg), + "You have %d of %d achievements unlocked.", + number_of_unlocked, cheevos_locals.core.count); + msg[sizeof(msg) - 1] = 0; + runloop_msg_queue_push(msg, 0, 6 * 60, false); } - if ( cheevos_locals.core.count == 0 - && cheevos_locals.unofficial.count == 0 - && cheevos_locals.lboard_count == 0) - cheevos_unload(); - CORO_GOSUB(GET_BADGES); CORO_STOP(); diff --git a/command.c b/command.c index ec0fcfbf02..27ebfdeb72 100644 --- a/command.c +++ b/command.c @@ -220,6 +220,7 @@ bool command_set_shader(const char *arg) { char msg[256]; enum rarch_shader_type type = RARCH_SHADER_NONE; + struct video_shader *shader = menu_shader_get(); switch (msg_hash_to_file_type(msg_hash_calculate(path_get_extension(arg)))) { @@ -245,7 +246,8 @@ bool command_set_shader(const char *arg) msg_hash_to_str(MSG_APPLYING_SHADER), arg); - return video_driver_set_shader(type, arg); + retroarch_set_shader_preset(arg); + return menu_shader_manager_set_preset(shader, type, arg); } #if defined(HAVE_COMMAND) && defined(HAVE_CHEEVOS) @@ -1295,31 +1297,13 @@ static void command_event_disable_overrides(void) return; /* reload the original config */ - config_unload_override(); rarch_ctl(RARCH_CTL_UNSET_OVERRIDES_ACTIVE, NULL); } static void command_event_restore_default_shader_preset(void) { - if (!path_is_empty(RARCH_PATH_DEFAULT_SHADER_PRESET)) - { - /* auto shader preset: reload the original shader */ - settings_t *settings = config_get_ptr(); - const char *shader_preset = path_get(RARCH_PATH_DEFAULT_SHADER_PRESET); - - if (!string_is_empty(shader_preset)) - { - RARCH_LOG("%s %s\n", - msg_hash_to_str(MSG_RESTORING_DEFAULT_SHADER_PRESET_TO), - shader_preset); - strlcpy(settings->paths.path_shader, - shader_preset, - sizeof(settings->paths.path_shader)); - } - } - - path_clear(RARCH_PATH_DEFAULT_SHADER_PRESET); + retroarch_unset_shader_preset(); } static void command_event_restore_remaps(void) @@ -1418,29 +1402,37 @@ static bool command_event_save_core_config(void) bool found_path = false; bool overrides_active = false; const char *core_path = NULL; - char *config_dir = (char*)malloc(PATH_MAX_LENGTH * sizeof(char)); - char *config_name = (char*)malloc(PATH_MAX_LENGTH * sizeof(char)); - char *config_path = (char*)malloc(PATH_MAX_LENGTH * sizeof(char)); + char *config_name = NULL; + char *config_path = NULL; + char *config_dir = NULL; size_t config_size = PATH_MAX_LENGTH * sizeof(char); settings_t *settings = config_get_ptr(); - config_dir[0] = config_name[0] = - config_path[0] = msg[0] = '\0'; + msg[0] = '\0'; - if (!string_is_empty(settings->paths.directory_menu_config)) - strlcpy(config_dir, settings->paths.directory_menu_config, - config_size); + if (settings && !string_is_empty(settings->paths.directory_menu_config)) + config_dir = strdup(settings->paths.directory_menu_config); else if (!path_is_empty(RARCH_PATH_CONFIG)) /* Fallback */ + { + config_dir = (char*)malloc(PATH_MAX_LENGTH * sizeof(char)); + config_dir[0] = '\0'; fill_pathname_basedir(config_dir, path_get(RARCH_PATH_CONFIG), config_size); - else + } + + if (string_is_empty(config_dir)) { runloop_msg_queue_push(msg_hash_to_str(MSG_CONFIG_DIRECTORY_NOT_SET), 1, 180, true); RARCH_ERR("[Config]: %s\n", msg_hash_to_str(MSG_CONFIG_DIRECTORY_NOT_SET)); - goto error; + free (config_dir); + return false; } - core_path = path_get(RARCH_PATH_CORE); + core_path = path_get(RARCH_PATH_CORE); + config_name = (char*)malloc(PATH_MAX_LENGTH * sizeof(char)); + config_path = (char*)malloc(PATH_MAX_LENGTH * sizeof(char)); + config_name[0] = '\0'; + config_path[0] = '\0'; /* Infer file name based on libretro core. */ if (!string_is_empty(core_path) && filestream_exists(core_path)) @@ -1514,12 +1506,6 @@ static bool command_event_save_core_config(void) free(config_name); free(config_path); return ret; - -error: - free(config_dir); - free(config_name); - free(config_path); - return false; } /** diff --git a/config.def.h b/config.def.h index 529b282ffa..dec7ad2eb3 100644 --- a/config.def.h +++ b/config.def.h @@ -125,6 +125,9 @@ static const unsigned fullscreen_y = 0; */ static const unsigned window_opacity = 100; +/* Whether to show the usual window decorations like border, titlebar etc. */ +static const bool window_decorations = true; + #if defined(RARCH_CONSOLE) || defined(__APPLE__) static const bool load_dummy_on_core_shutdown = false; #else @@ -551,6 +554,8 @@ static const int netplay_check_frames = 600; static const bool netplay_use_mitm_server = false; +static const char *netplay_mitm_server = "nyc"; + #ifdef HAVE_NETWORKING static const unsigned netplay_share_digital = RARCH_NETPLAY_SHARE_DIGITAL_NO_PREFERENCE; diff --git a/configuration.c b/configuration.c index e7a8cae859..08edaa52b6 100644 --- a/configuration.c +++ b/configuration.c @@ -1036,6 +1036,7 @@ static struct config_array_setting *populate_settings_array(settings_t *settings SETTING_ARRAY("bundle_assets_dst_path", settings->arrays.bundle_assets_dst, false, NULL, true); SETTING_ARRAY("bundle_assets_dst_path_subdir", settings->arrays.bundle_assets_dst_subdir, false, NULL, true); SETTING_ARRAY("led_driver", settings->arrays.led_driver, false, NULL, true); + SETTING_ARRAY("netplay_mitm_server", settings->arrays.netplay_mitm_server, false, NULL, true); *size = count; return tmp; @@ -1378,6 +1379,7 @@ static struct config_bool_setting *populate_settings_bool(settings_t *settings, SETTING_BOOL("screenshots_in_content_dir", &settings->bools.screenshots_in_content_dir, true, default_screenshots_in_content_dir, false); SETTING_BOOL("video_msg_bgcolor_enable", &settings->bools.video_msg_bgcolor_enable, true, message_bgcolor_enable, false); + SETTING_BOOL("video_window_show_decorations", &settings->bools.video_window_show_decorations, true, window_decorations, false); *size = count; @@ -1551,6 +1553,7 @@ static void config_set_defaults(void) const char *def_led = config_get_default_led(); const char *def_location = config_get_default_location(); const char *def_record = config_get_default_record(); + const char *def_mitm = netplay_mitm_server; struct config_float_setting *float_settings = populate_settings_float (settings, &float_settings_size); struct config_bool_setting *bool_settings = populate_settings_bool (settings, &bool_settings_size); struct config_int_setting *int_settings = populate_settings_int (settings, &int_settings_size); @@ -1630,6 +1633,9 @@ static void config_set_defaults(void) if (def_record) strlcpy(settings->arrays.record_driver, def_record, sizeof(settings->arrays.record_driver)); + if (def_mitm) + strlcpy(settings->arrays.netplay_mitm_server, + def_mitm, sizeof(settings->arrays.netplay_mitm_server)); #ifdef HAVE_MENU if (def_menu) strlcpy(settings->arrays.menu_driver, @@ -2267,6 +2273,7 @@ static bool check_shader_compatibility(enum file_path_enum enum_idx) if (string_is_equal(settings->arrays.video_driver, "vulkan") || string_is_equal(settings->arrays.video_driver, "d3d11") || + string_is_equal(settings->arrays.video_driver, "d3d12") || string_is_equal(settings->arrays.video_driver, "gx2")) { if (enum_idx != FILE_PATH_SLANGP_EXTENSION) @@ -2363,6 +2370,7 @@ static bool config_load_file(const char *path, bool set_defaults, #endif const char *path_core = NULL; const char *path_config = NULL; + const char *shader_ext = NULL; int bool_settings_size = sizeof(settings->bools) / sizeof(settings->bools.placeholder); int float_settings_size = sizeof(settings->floats) / sizeof(settings->floats.placeholder); int int_settings_size = sizeof(settings->ints) / sizeof(settings->ints.placeholder); @@ -2870,29 +2878,28 @@ static bool config_load_file(const char *path, bool set_defaults, config_read_keybinds_conf(conf); + shader_ext = path_get_extension(settings->paths.path_shader); + + if (!string_is_empty(shader_ext)) + { + for(i = FILE_PATH_CGP_EXTENSION; i <= FILE_PATH_SLANGP_EXTENSION; i++) + { + enum file_path_enum ext = (enum file_path_enum)(i); + if(!strstr(file_path_str(ext), shader_ext)) + continue; + + if (check_shader_compatibility(ext)) + continue; + + RARCH_LOG("Incompatible shader for backend %s, clearing...\n", + settings->arrays.video_driver); + settings->paths.path_shader[0] = '\0'; + break; + } +} + ret = true; - { - const char *shader_ext = path_get_extension(settings->paths.path_shader); - - if (!string_is_empty(shader_ext)) - { - for(i = FILE_PATH_CGP_EXTENSION; i <= FILE_PATH_SLANGP_EXTENSION; i++) - { - enum file_path_enum ext = (enum file_path_enum)(i); - if(!strstr(file_path_str(ext), shader_ext)) - continue; - - if (check_shader_compatibility(ext)) - continue; - - RARCH_LOG("Incompatible shader for backend %s, clearing...\n", - settings->arrays.video_driver); - settings->paths.path_shader[0] = '\0'; - break; - } - } - } end: if (conf) @@ -2935,24 +2942,23 @@ end: bool config_load_override(void) { size_t path_size = PATH_MAX_LENGTH * sizeof(char); - char *buf = (char*)malloc(PATH_MAX_LENGTH * sizeof(char)); - char *config_directory = (char*)malloc(PATH_MAX_LENGTH * sizeof(char)); - char *core_path = (char*)malloc(PATH_MAX_LENGTH * sizeof(char)); - char *game_path = (char*)malloc(PATH_MAX_LENGTH * sizeof(char)); + char *buf = NULL; + char *core_path = NULL; + char *game_path = NULL; + char *config_directory = NULL; config_file_t *new_conf = NULL; - const char *core_name = NULL; - const char *game_name = NULL; bool should_append = false; rarch_system_info_t *system = runloop_get_system_info(); - - if (system) - core_name = system->info.library_name; - - game_name = path_basename(path_get(RARCH_PATH_BASENAME)); + const char *core_name = system ? system->info.library_name : NULL; + const char *game_name = path_basename(path_get(RARCH_PATH_BASENAME)); if (string_is_empty(core_name) || string_is_empty(game_name)) - goto error; + return false; + game_path = (char*)malloc(PATH_MAX_LENGTH * sizeof(char)); + core_path = (char*)malloc(PATH_MAX_LENGTH * sizeof(char)); + buf = (char*)malloc(PATH_MAX_LENGTH * sizeof(char)); + config_directory = (char*)malloc(PATH_MAX_LENGTH * sizeof(char)); config_directory[0] = core_path[0] = game_path[0] = '\0'; fill_pathname_application_special(config_directory, path_size, @@ -3105,28 +3111,29 @@ bool config_unload_override(void) bool config_load_remap(void) { size_t path_size = PATH_MAX_LENGTH * sizeof(char); - char *remap_directory = (char*)malloc(PATH_MAX_LENGTH * sizeof(char)); /* path to the directory containing retroarch.cfg (prefix) */ - char *core_path = (char*)malloc(PATH_MAX_LENGTH * sizeof(char)); /* final path for core-specific configuration (prefix+suffix) */ - char *game_path = (char*)malloc(PATH_MAX_LENGTH * sizeof(char)); /* final path for game-specific configuration (prefix+suffix) */ + char *remap_directory = NULL; + char *core_path = NULL; + char *game_path = NULL; config_file_t *new_conf = NULL; - const char *core_name = NULL; - const char *game_name = NULL; settings_t *settings = config_get_ptr(); rarch_system_info_t *system = runloop_get_system_info(); - - if (system) - core_name = system->info.library_name; - - game_name = path_basename(path_get(RARCH_PATH_BASENAME)); + const char *core_name = system ? system->info.library_name : NULL; + const char *game_name = path_basename(path_get(RARCH_PATH_BASENAME)); if (string_is_empty(core_name) || string_is_empty(game_name)) - goto error; + return false; /* Remap directory: remap_directory. * Try remap directory setting, no fallbacks defined */ if (string_is_empty(settings->paths.directory_input_remapping)) - goto error; + return false; + /* path to the directory containing retroarch.cfg (prefix) */ + remap_directory = (char*)malloc(PATH_MAX_LENGTH * sizeof(char)); + /* final path for core-specific configuration (prefix+suffix) */ + core_path = (char*)malloc(PATH_MAX_LENGTH * sizeof(char)); + /* final path for game-specific configuration (prefix+suffix) */ + game_path = (char*)malloc(PATH_MAX_LENGTH * sizeof(char)); remap_directory[0] = core_path[0] = game_path[0] = '\0'; strlcpy(remap_directory, @@ -3189,7 +3196,6 @@ bool config_load_remap(void) new_conf = NULL; -error: free(remap_directory); free(core_path); free(game_path); @@ -3218,28 +3224,37 @@ success: bool config_load_shader_preset(void) { unsigned idx; - config_file_t *new_conf = NULL; size_t path_size = PATH_MAX_LENGTH * sizeof(char); - char *shader_directory = (char*)malloc(PATH_MAX_LENGTH * sizeof(char)); /* path to the directory containing retroarch.cfg (prefix) */ - char *core_path = (char*)malloc(PATH_MAX_LENGTH * sizeof(char)); /* final path for core-specific configuration (prefix+suffix) */ - char *game_path = (char*)malloc(PATH_MAX_LENGTH * sizeof(char)); /* final path for game-specific configuration (prefix+suffix) */ - const char *core_name = NULL; - const char *game_name = NULL; + config_file_t *new_conf = NULL; + char *shader_directory = NULL; + char *core_path = NULL; + char *game_path = NULL; + char *parent_path = NULL; settings_t *settings = config_get_ptr(); rarch_system_info_t *system = runloop_get_system_info(); + const char *core_name = system ? system->info.library_name : NULL; + const char *game_name = path_basename(path_get(RARCH_PATH_BASENAME)); + char parent_name[PATH_MAX_LENGTH]; - if (system) - core_name = system->info.library_name; - - game_name = path_basename(path_get(RARCH_PATH_BASENAME)); + if (!string_is_empty(path_get(RARCH_PATH_BASENAME))) + fill_pathname_parent_dir_name(parent_name, path_get(RARCH_PATH_BASENAME), sizeof(parent_name)); if (string_is_empty(core_name) || string_is_empty(game_name)) - goto error; + return false; /* Shader directory: shader_directory. * Try shader directory setting, no fallbacks defined */ if (string_is_empty(settings->paths.directory_video_shader)) - goto error; + return false; + + /* path to the directory containing retroarch.cfg (prefix) */ + shader_directory = (char*)malloc(PATH_MAX_LENGTH * sizeof(char)); + /* final path for core-specific configuration (prefix+suffix) */ + core_path = (char*)malloc(PATH_MAX_LENGTH * sizeof(char)); + /* final path for game-specific configuration (prefix+suffix) */ + game_path = (char*)malloc(PATH_MAX_LENGTH * sizeof(char)); + /* final path for parent-dir-specific configuration (prefix+suffix) */ + parent_path = (char*)malloc(PATH_MAX_LENGTH * sizeof(char)); shader_directory[0] = core_path[0] = game_path[0] = '\0'; @@ -3277,9 +3292,33 @@ bool config_load_shader_preset(void) /* Game shader preset exists, load it. */ RARCH_LOG("Shaders: game-specific shader preset found at %s.\n", game_path); + retroarch_set_shader_preset(game_path); + goto success; + } - path_set(RARCH_PATH_DEFAULT_SHADER_PRESET, settings->paths.path_shader); - strlcpy(settings->paths.path_shader, game_path, sizeof(settings->paths.path_shader)); + for(idx = FILE_PATH_CGP_EXTENSION; idx <= FILE_PATH_SLANGP_EXTENSION; idx++) + { + if (!check_shader_compatibility((enum file_path_enum)(idx))) + continue; + /* Concatenate strings into full paths for core_path, parent path */ + fill_pathname_join_special_ext(parent_path, + shader_directory, core_name, + parent_name, + file_path_str((enum file_path_enum)(idx)), + path_size); + + /* Create a new config file from parent path */ + new_conf = config_file_new(parent_path); + + if (!new_conf) + { + RARCH_LOG("Shaders: no parent-dir-specific preset found at %s.\n", parent_path); + continue; + } + + /* Parent-dir shader preset exists, load it. */ + RARCH_LOG("Shaders: parent-dir-specific shader preset found at %s.\n", parent_path); + retroarch_set_shader_preset(parent_path); goto success; } @@ -3305,12 +3344,10 @@ bool config_load_shader_preset(void) /* Core shader preset exists, load it. */ RARCH_LOG("Shaders: core-specific shader preset found at %s.\n", core_path); - path_set(RARCH_PATH_DEFAULT_SHADER_PRESET, settings->paths.path_shader); - strlcpy(settings->paths.path_shader, core_path, sizeof(settings->paths.path_shader)); + retroarch_set_shader_preset(core_path); goto success; } -error: free(shader_directory); free(core_path); free(game_path); @@ -3320,6 +3357,7 @@ success: free(shader_directory); free(core_path); free(game_path); + free(parent_path); config_file_free(new_conf); return true; } @@ -3591,24 +3629,25 @@ static bool config_save_keybinds_file(const char *path) bool config_save_autoconf_profile(const char *path, unsigned user) { unsigned i; - char *buf = (char*)malloc(PATH_MAX_LENGTH * sizeof(char)); - char *autoconf_file = (char*)malloc(PATH_MAX_LENGTH * sizeof(char)); + char *buf = NULL; + char *autoconf_file = NULL; char *path_new = NULL; + config_file_t *conf = NULL; size_t path_size = PATH_MAX_LENGTH * sizeof(char); int32_t pid_user = 0; int32_t vid_user = 0; bool ret = false; - config_file_t *conf = NULL; settings_t *settings = config_get_ptr(); const char *autoconf_dir = settings->paths.directory_autoconfig; const char *joypad_ident = settings->arrays.input_joypad_driver; - buf[0] = autoconf_file[0] = '\0'; - if (string_is_empty(path)) - goto error; + return false; - path_new = strdup(path); + buf = (char*)malloc(PATH_MAX_LENGTH * sizeof(char)); + autoconf_file = (char*)malloc(PATH_MAX_LENGTH * sizeof(char)); + buf[0] = autoconf_file[0] = '\0'; + path_new = strdup(path); for (i = 0; invalid_filename_chars[i]; i++) { @@ -3915,15 +3954,9 @@ bool config_save_file(const char *path) bool config_save_overrides(int override_type) { size_t path_size = PATH_MAX_LENGTH * sizeof(char); - char *config_directory = (char*)malloc(PATH_MAX_LENGTH * sizeof(char)); - char *override_directory = (char*)malloc(PATH_MAX_LENGTH * sizeof(char)); - char *core_path = (char*)malloc(PATH_MAX_LENGTH * sizeof(char)); - char *game_path = (char*)malloc(PATH_MAX_LENGTH * sizeof(char)); int tmp_i = 0; unsigned i = 0; bool ret = false; - const char *core_name = NULL; - const char *game_name = NULL; config_file_t *conf = NULL; settings_t *settings = NULL; struct config_bool_setting *bool_settings = NULL; @@ -3938,6 +3971,10 @@ bool config_save_overrides(int override_type) struct config_array_setting *array_overrides= NULL; struct config_path_setting *path_settings = NULL; struct config_path_setting *path_overrides = NULL; + char *config_directory = NULL; + char *override_directory = NULL; + char *core_path = NULL; + char *game_path = NULL; settings_t *overrides = config_get_ptr(); int bool_settings_size = sizeof(settings->bools) / sizeof(settings->bools.placeholder); int float_settings_size = sizeof(settings->floats) / sizeof(settings->floats.placeholder); @@ -3946,16 +3983,17 @@ bool config_save_overrides(int override_type) int array_settings_size = sizeof(settings->arrays) / sizeof(settings->arrays.placeholder); int path_settings_size = sizeof(settings->paths) / sizeof(settings->paths.placeholder); rarch_system_info_t *system = runloop_get_system_info(); - - if (system) - core_name = system->info.library_name; - - game_name = path_basename(path_get(RARCH_PATH_BASENAME)); + const char *core_name = system ? system->info.library_name : NULL; + const char *game_name = path_basename(path_get(RARCH_PATH_BASENAME)); if (string_is_empty(core_name) || string_is_empty(game_name)) - goto error; + return false; - settings = (settings_t*)calloc(1, sizeof(settings_t)); + settings = (settings_t*)calloc(1, sizeof(settings_t)); + config_directory = (char*)malloc(PATH_MAX_LENGTH * sizeof(char)); + override_directory = (char*)malloc(PATH_MAX_LENGTH * sizeof(char)); + core_path = (char*)malloc(PATH_MAX_LENGTH * sizeof(char)); + game_path = (char*)malloc(PATH_MAX_LENGTH * sizeof(char)); config_directory[0] = override_directory[0] = core_path[0] = game_path[0] = '\0'; @@ -4170,14 +4208,6 @@ bool config_save_overrides(int override_type) free(game_path); return ret; - -error: - free(config_directory); - free(override_directory); - free(core_path); - free(game_path); - - return false; } /* Replaces currently loaded configuration file with diff --git a/configuration.h b/configuration.h index 21c7b75e99..19582b7047 100644 --- a/configuration.h +++ b/configuration.h @@ -254,6 +254,7 @@ typedef struct settings bool bluetooth_enable; bool automatically_add_content_to_playlist; + bool video_window_show_decorations; } bools; struct @@ -408,6 +409,8 @@ typedef struct settings char bundle_assets_src[PATH_MAX_LENGTH]; char bundle_assets_dst[PATH_MAX_LENGTH]; char bundle_assets_dst_subdir[PATH_MAX_LENGTH]; + + char netplay_mitm_server[255]; } arrays; struct diff --git a/core_info.c b/core_info.c index 8b56cf394f..76b979046b 100644 --- a/core_info.c +++ b/core_info.c @@ -189,14 +189,16 @@ static bool core_info_list_iterate( struct string_list *contents, size_t i) { size_t info_path_base_size = PATH_MAX_LENGTH * sizeof(char); - char *info_path_base = (char*)malloc(PATH_MAX_LENGTH * sizeof(char)); -#if defined(RARCH_MOBILE) || (defined(RARCH_CONSOLE) && !defined(PSP) && !defined(_3DS) && !defined(VITA)) + char *info_path_base = NULL; char *substr = NULL; -#endif - const char *current_path = contents->elems[i].data; + const char *current_path = contents ? contents->elems[i].data : NULL; - if (!contents || !current_path) - goto error; + (void)substr; + + if (!current_path) + return false; + + info_path_base = (char*)malloc(PATH_MAX_LENGTH * sizeof(char)); info_path_base[0] = '\0'; @@ -220,10 +222,6 @@ static bool core_info_list_iterate( free(info_path_base); return true; - -error: - free(info_path_base); - return false; } static core_info_list_t *core_info_list_new(const char *path) @@ -524,19 +522,21 @@ static bool core_info_list_update_missing_firmware_internal( { size_t i; core_info_t *info = NULL; + char *path = NULL; size_t path_size = PATH_MAX_LENGTH * sizeof(char); - char *path = (char*)malloc(PATH_MAX_LENGTH * sizeof(char)); if (!core_info_list || !core) - goto error; + return false; - path[0] = '\0'; - info = core_info_find_internal(core_info_list, core); + info = core_info_find_internal(core_info_list, core); if (!info) - goto error; + return false; + path = (char*)malloc(PATH_MAX_LENGTH * sizeof(char)); + path[0] = '\0'; rarch_ctl(RARCH_CTL_UNSET_MISSING_BIOS, NULL); + for (i = 0; i < info->firmware_count; i++) { if (string_is_empty(info->firmware[i].path)) @@ -554,10 +554,6 @@ static bool core_info_list_update_missing_firmware_internal( free(path); return true; - -error: - free(path); - return false; } #if 0 diff --git a/deps/SPIRV-Cross/checkout_glslang_spirv_tools.sh b/deps/SPIRV-Cross/checkout_glslang_spirv_tools.sh old mode 100644 new mode 100755 diff --git a/deps/SPIRV-Cross/reference/opt/shaders-hlsl/frag/constant-composites.frag b/deps/SPIRV-Cross/reference/opt/shaders-hlsl/frag/constant-composites.frag new file mode 100644 index 0000000000..0514eef1ee --- /dev/null +++ b/deps/SPIRV-Cross/reference/opt/shaders-hlsl/frag/constant-composites.frag @@ -0,0 +1,43 @@ +struct Foo +{ + float a; + float b; +}; + +static const float _16[4] = { 1.0f, 4.0f, 3.0f, 2.0f }; +static const Foo _24 = { 10.0f, 20.0f }; +static const Foo _27 = { 30.0f, 40.0f }; +static const Foo _28[2] = { { 10.0f, 20.0f }, { 30.0f, 40.0f } }; + +static float4 FragColor; +static int _line; + +struct SPIRV_Cross_Input +{ + nointerpolation int _line : TEXCOORD0; +}; + +struct SPIRV_Cross_Output +{ + float4 FragColor : SV_Target0; +}; + +static float lut[4]; +static Foo foos[2]; + +void frag_main() +{ + lut = _16; + foos = _28; + FragColor = lut[_line].xxxx; + FragColor += (foos[_line].a * (foos[1 - _line].a)).xxxx; +} + +SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input) +{ + _line = stage_input._line; + frag_main(); + SPIRV_Cross_Output stage_output; + stage_output.FragColor = FragColor; + return stage_output; +} diff --git a/deps/SPIRV-Cross/reference/opt/shaders-hlsl/frag/texture-size-combined-image-sampler.frag b/deps/SPIRV-Cross/reference/opt/shaders-hlsl/frag/texture-size-combined-image-sampler.frag new file mode 100644 index 0000000000..d5c373746d --- /dev/null +++ b/deps/SPIRV-Cross/reference/opt/shaders-hlsl/frag/texture-size-combined-image-sampler.frag @@ -0,0 +1,30 @@ +Texture2D uTex : register(t0); +SamplerState uSampler : register(s1); + +static int2 FooOut; + +struct SPIRV_Cross_Output +{ + int2 FooOut : SV_Target0; +}; + +uint2 SPIRV_Cross_textureSize(Texture2D Tex, uint Level, out uint Param) +{ + uint2 ret; + Tex.GetDimensions(Level, ret.x, ret.y, Param); + return ret; +} + +void frag_main() +{ + uint _23_dummy_parameter; + FooOut = int2(SPIRV_Cross_textureSize(uTex, uint(0), _23_dummy_parameter)); +} + +SPIRV_Cross_Output main() +{ + frag_main(); + SPIRV_Cross_Output stage_output; + stage_output.FooOut = FooOut; + return stage_output; +} diff --git a/deps/SPIRV-Cross/reference/opt/shaders-msl/asm/comp/storage-buffer-basic.asm.comp b/deps/SPIRV-Cross/reference/opt/shaders-msl/asm/comp/storage-buffer-basic.asm.comp index 1dff618b3a..3df6161fc2 100644 --- a/deps/SPIRV-Cross/reference/opt/shaders-msl/asm/comp/storage-buffer-basic.asm.comp +++ b/deps/SPIRV-Cross/reference/opt/shaders-msl/asm/comp/storage-buffer-basic.asm.comp @@ -14,7 +14,7 @@ struct _6 float _m0[1]; }; -kernel void main0(uint3 gl_WorkGroupID [[threadgroup_position_in_grid]], device _6& _8 [[buffer(0)]], device _6& _9 [[buffer(1)]]) +kernel void main0(device _6& _8 [[buffer(0)]], device _6& _9 [[buffer(1)]], uint3 gl_WorkGroupID [[threadgroup_position_in_grid]]) { _8._m0[gl_WorkGroupID.x] = _9._m0[gl_WorkGroupID.x] + _8._m0[gl_WorkGroupID.x]; } diff --git a/deps/SPIRV-Cross/reference/opt/shaders-msl/asm/frag/inliner-dominator-inside-loop.asm.frag b/deps/SPIRV-Cross/reference/opt/shaders-msl/asm/frag/inliner-dominator-inside-loop.asm.frag index 98a1674865..2ac8cbe015 100644 --- a/deps/SPIRV-Cross/reference/opt/shaders-msl/asm/frag/inliner-dominator-inside-loop.asm.frag +++ b/deps/SPIRV-Cross/reference/opt/shaders-msl/asm/frag/inliner-dominator-inside-loop.asm.frag @@ -101,7 +101,7 @@ struct main0_out float4 _entryPointOutput [[color(0)]]; }; -fragment main0_out main0(main0_in in [[stage_in]], float4 gl_FragCoord [[position]], constant CB0& _19 [[buffer(0)]], texture3d LightMapTexture [[texture(0)]], sampler LightMapSampler [[sampler(0)]], sampler ShadowMapSampler [[sampler(1)]], texture2d ShadowMapTexture [[texture(1)]], texturecube EnvironmentMapTexture [[texture(2)]], sampler EnvironmentMapSampler [[sampler(2)]], sampler DiffuseMapSampler [[sampler(3)]], texture2d DiffuseMapTexture [[texture(3)]], sampler NormalMapSampler [[sampler(4)]], texture2d NormalMapTexture [[texture(4)]], texture2d NormalDetailMapTexture [[texture(5)]], sampler NormalDetailMapSampler [[sampler(5)]], texture2d StudsMapTexture [[texture(6)]], sampler StudsMapSampler [[sampler(6)]], sampler SpecularMapSampler [[sampler(7)]], texture2d SpecularMapTexture [[texture(7)]]) +fragment main0_out main0(main0_in in [[stage_in]], constant CB0& _19 [[buffer(0)]], texture3d LightMapTexture [[texture(0)]], texture2d ShadowMapTexture [[texture(1)]], texturecube EnvironmentMapTexture [[texture(2)]], texture2d DiffuseMapTexture [[texture(3)]], texture2d NormalMapTexture [[texture(4)]], texture2d NormalDetailMapTexture [[texture(5)]], texture2d StudsMapTexture [[texture(6)]], texture2d SpecularMapTexture [[texture(7)]], sampler LightMapSampler [[sampler(0)]], sampler ShadowMapSampler [[sampler(1)]], sampler EnvironmentMapSampler [[sampler(2)]], sampler DiffuseMapSampler [[sampler(3)]], sampler NormalMapSampler [[sampler(4)]], sampler NormalDetailMapSampler [[sampler(5)]], sampler StudsMapSampler [[sampler(6)]], sampler SpecularMapSampler [[sampler(7)]], float4 gl_FragCoord [[position]]) { main0_out out = {}; VertexOutput _128 = _121; diff --git a/deps/SPIRV-Cross/reference/opt/shaders-msl/asm/frag/vector-shuffle-oom.asm.frag b/deps/SPIRV-Cross/reference/opt/shaders-msl/asm/frag/vector-shuffle-oom.asm.frag index 17cd528d41..97daea5d90 100644 --- a/deps/SPIRV-Cross/reference/opt/shaders-msl/asm/frag/vector-shuffle-oom.asm.frag +++ b/deps/SPIRV-Cross/reference/opt/shaders-msl/asm/frag/vector-shuffle-oom.asm.frag @@ -95,7 +95,7 @@ struct main0_out float4 m_5 [[color(0)]]; }; -fragment main0_out main0(float4 gl_FragCoord [[position]], constant _6& _7 [[buffer(0)]], texture2d _8 [[texture(0)]], sampler _9 [[sampler(0)]], constant _10& _11 [[buffer(1)]], texture2d _12 [[texture(1)]], sampler _13 [[sampler(1)]], texture2d _14 [[texture(2)]], sampler _15 [[sampler(2)]], constant _18& _19 [[buffer(2)]]) +fragment main0_out main0(constant _6& _7 [[buffer(0)]], constant _10& _11 [[buffer(1)]], constant _18& _19 [[buffer(2)]], texture2d _8 [[texture(0)]], texture2d _12 [[texture(1)]], texture2d _14 [[texture(2)]], sampler _9 [[sampler(0)]], sampler _13 [[sampler(1)]], sampler _15 [[sampler(2)]], float4 gl_FragCoord [[position]]) { main0_out out = {}; _28 _77 = _74; diff --git a/deps/SPIRV-Cross/reference/opt/shaders-msl/comp/basic.comp b/deps/SPIRV-Cross/reference/opt/shaders-msl/comp/basic.comp index 363c207186..c41f7c0acf 100644 --- a/deps/SPIRV-Cross/reference/opt/shaders-msl/comp/basic.comp +++ b/deps/SPIRV-Cross/reference/opt/shaders-msl/comp/basic.comp @@ -21,7 +21,7 @@ struct SSBO3 uint counter; }; -kernel void main0(uint3 gl_GlobalInvocationID [[thread_position_in_grid]], device SSBO& _23 [[buffer(0)]], device SSBO2& _45 [[buffer(1)]], device SSBO3& _48 [[buffer(2)]]) +kernel void main0(device SSBO& _23 [[buffer(0)]], device SSBO2& _45 [[buffer(1)]], device SSBO3& _48 [[buffer(2)]], uint3 gl_GlobalInvocationID [[thread_position_in_grid]]) { float4 _29 = _23.in_data[gl_GlobalInvocationID.x]; if (dot(_29, float4(1.0, 5.0, 6.0, 2.0)) > 8.19999980926513671875) diff --git a/deps/SPIRV-Cross/reference/opt/shaders-msl/comp/culling.comp b/deps/SPIRV-Cross/reference/opt/shaders-msl/comp/culling.comp index 64127d2c26..b20480bb45 100644 --- a/deps/SPIRV-Cross/reference/opt/shaders-msl/comp/culling.comp +++ b/deps/SPIRV-Cross/reference/opt/shaders-msl/comp/culling.comp @@ -23,7 +23,7 @@ struct SSBO3 uint count; }; -kernel void main0(uint3 gl_GlobalInvocationID [[thread_position_in_grid]], device SSBO& _22 [[buffer(0)]], device SSBO2& _38 [[buffer(1)]], device SSBO3& _41 [[buffer(2)]]) +kernel void main0(device SSBO& _22 [[buffer(0)]], device SSBO2& _38 [[buffer(1)]], device SSBO3& _41 [[buffer(2)]], uint3 gl_GlobalInvocationID [[thread_position_in_grid]]) { float _28 = _22.in_data[gl_GlobalInvocationID.x]; if (_28 > 12.0) diff --git a/deps/SPIRV-Cross/reference/opt/shaders-msl/comp/dowhile.comp b/deps/SPIRV-Cross/reference/opt/shaders-msl/comp/dowhile.comp index fca434d9a4..d76ca819c4 100644 --- a/deps/SPIRV-Cross/reference/opt/shaders-msl/comp/dowhile.comp +++ b/deps/SPIRV-Cross/reference/opt/shaders-msl/comp/dowhile.comp @@ -14,7 +14,7 @@ struct SSBO2 float4 out_data[1]; }; -kernel void main0(uint3 gl_GlobalInvocationID [[thread_position_in_grid]], device SSBO& _28 [[buffer(0)]], device SSBO2& _52 [[buffer(1)]]) +kernel void main0(device SSBO& _28 [[buffer(0)]], device SSBO2& _52 [[buffer(1)]], uint3 gl_GlobalInvocationID [[thread_position_in_grid]]) { int i = 0; float4 _56; diff --git a/deps/SPIRV-Cross/reference/opt/shaders-msl/comp/image.comp b/deps/SPIRV-Cross/reference/opt/shaders-msl/comp/image.comp index edccd31bc9..d615fb2736 100644 --- a/deps/SPIRV-Cross/reference/opt/shaders-msl/comp/image.comp +++ b/deps/SPIRV-Cross/reference/opt/shaders-msl/comp/image.comp @@ -3,7 +3,7 @@ using namespace metal; -kernel void main0(texture2d uImageIn [[texture(0)]], uint3 gl_GlobalInvocationID [[thread_position_in_grid]], texture2d uImageOut [[texture(1)]]) +kernel void main0(texture2d uImageIn [[texture(0)]], texture2d uImageOut [[texture(1)]], uint3 gl_GlobalInvocationID [[thread_position_in_grid]]) { uImageOut.write(uImageIn.read(uint2((int2(gl_GlobalInvocationID.xy) + int2(uImageIn.get_width(), uImageIn.get_height())))), uint2(int2(gl_GlobalInvocationID.xy))); } diff --git a/deps/SPIRV-Cross/reference/opt/shaders-msl/comp/loop.noopt.comp b/deps/SPIRV-Cross/reference/opt/shaders-msl/comp/loop.noopt.comp index 55d850d191..00ed570b31 100644 --- a/deps/SPIRV-Cross/reference/opt/shaders-msl/comp/loop.noopt.comp +++ b/deps/SPIRV-Cross/reference/opt/shaders-msl/comp/loop.noopt.comp @@ -14,7 +14,7 @@ struct SSBO2 float4 out_data[1]; }; -kernel void main0(uint3 gl_GlobalInvocationID [[thread_position_in_grid]], device SSBO& _24 [[buffer(0)]], device SSBO2& _177 [[buffer(1)]]) +kernel void main0(device SSBO& _24 [[buffer(0)]], device SSBO2& _177 [[buffer(1)]], uint3 gl_GlobalInvocationID [[thread_position_in_grid]]) { uint ident = gl_GlobalInvocationID.x; float4 idat = _24.in_data[ident]; diff --git a/deps/SPIRV-Cross/reference/opt/shaders-msl/comp/mat3.comp b/deps/SPIRV-Cross/reference/opt/shaders-msl/comp/mat3.comp index e466d25f97..72f08dd85e 100644 --- a/deps/SPIRV-Cross/reference/opt/shaders-msl/comp/mat3.comp +++ b/deps/SPIRV-Cross/reference/opt/shaders-msl/comp/mat3.comp @@ -8,7 +8,7 @@ struct SSBO2 float3x3 out_data[1]; }; -kernel void main0(uint3 gl_GlobalInvocationID [[thread_position_in_grid]], device SSBO2& _22 [[buffer(0)]]) +kernel void main0(device SSBO2& _22 [[buffer(0)]], uint3 gl_GlobalInvocationID [[thread_position_in_grid]]) { _22.out_data[gl_GlobalInvocationID.x] = float3x3(float3(10.0), float3(20.0), float3(40.0)); } diff --git a/deps/SPIRV-Cross/reference/opt/shaders-msl/comp/mod.comp b/deps/SPIRV-Cross/reference/opt/shaders-msl/comp/mod.comp index 01dc6726ed..86bde9c27d 100644 --- a/deps/SPIRV-Cross/reference/opt/shaders-msl/comp/mod.comp +++ b/deps/SPIRV-Cross/reference/opt/shaders-msl/comp/mod.comp @@ -22,7 +22,7 @@ Tx mod(Tx x, Ty y) return x - y * floor(x / y); } -kernel void main0(uint3 gl_GlobalInvocationID [[thread_position_in_grid]], device SSBO& _23 [[buffer(0)]], device SSBO2& _33 [[buffer(1)]]) +kernel void main0(device SSBO& _23 [[buffer(0)]], device SSBO2& _33 [[buffer(1)]], uint3 gl_GlobalInvocationID [[thread_position_in_grid]]) { _33.out_data[gl_GlobalInvocationID.x] = mod(_23.in_data[gl_GlobalInvocationID.x], _33.out_data[gl_GlobalInvocationID.x]); _33.out_data[gl_GlobalInvocationID.x] = as_type(as_type(_23.in_data[gl_GlobalInvocationID.x]) % as_type(_33.out_data[gl_GlobalInvocationID.x])); diff --git a/deps/SPIRV-Cross/reference/opt/shaders-msl/comp/modf.comp b/deps/SPIRV-Cross/reference/opt/shaders-msl/comp/modf.comp index 3a4cfd6975..40cbb40cea 100644 --- a/deps/SPIRV-Cross/reference/opt/shaders-msl/comp/modf.comp +++ b/deps/SPIRV-Cross/reference/opt/shaders-msl/comp/modf.comp @@ -13,7 +13,7 @@ struct SSBO2 float4 out_data[1]; }; -kernel void main0(uint3 gl_GlobalInvocationID [[thread_position_in_grid]], device SSBO& _23 [[buffer(0)]], device SSBO2& _35 [[buffer(1)]]) +kernel void main0(device SSBO& _23 [[buffer(0)]], device SSBO2& _35 [[buffer(1)]], uint3 gl_GlobalInvocationID [[thread_position_in_grid]]) { float4 i; float4 _31 = modf(_23.in_data[gl_GlobalInvocationID.x], i); diff --git a/deps/SPIRV-Cross/reference/opt/shaders-msl/comp/return.comp b/deps/SPIRV-Cross/reference/opt/shaders-msl/comp/return.comp index eaa25c5c7b..06ce8d7662 100644 --- a/deps/SPIRV-Cross/reference/opt/shaders-msl/comp/return.comp +++ b/deps/SPIRV-Cross/reference/opt/shaders-msl/comp/return.comp @@ -10,7 +10,7 @@ struct SSBO2 constant int _69 = {}; -kernel void main0(uint3 gl_GlobalInvocationID [[thread_position_in_grid]], device SSBO2& _27 [[buffer(0)]]) +kernel void main0(device SSBO2& _27 [[buffer(0)]], uint3 gl_GlobalInvocationID [[thread_position_in_grid]]) { if (gl_GlobalInvocationID.x == 2u) { diff --git a/deps/SPIRV-Cross/reference/opt/shaders-msl/comp/shared-array-of-arrays.comp b/deps/SPIRV-Cross/reference/opt/shaders-msl/comp/shared-array-of-arrays.comp new file mode 100644 index 0000000000..db1ffebf2b --- /dev/null +++ b/deps/SPIRV-Cross/reference/opt/shaders-msl/comp/shared-array-of-arrays.comp @@ -0,0 +1,20 @@ +#include +#include + +using namespace metal; + +constant uint3 gl_WorkGroupSize = uint3(4u, 4u, 1u); + +struct SSBO +{ + float out_data[1]; +}; + +kernel void main0(device SSBO& _67 [[buffer(0)]], uint3 gl_LocalInvocationID [[thread_position_in_threadgroup]], uint gl_LocalInvocationIndex [[thread_index_in_threadgroup]], uint3 gl_GlobalInvocationID [[thread_position_in_grid]]) +{ + threadgroup float foo[4][4]; + foo[gl_LocalInvocationID.x][gl_LocalInvocationID.y] = float(gl_LocalInvocationIndex); + threadgroup_barrier(mem_flags::mem_threadgroup); + _67.out_data[gl_GlobalInvocationID.x] = (((0.0 + foo[gl_LocalInvocationID.x][0]) + foo[gl_LocalInvocationID.x][1]) + foo[gl_LocalInvocationID.x][2]) + foo[gl_LocalInvocationID.x][3]; +} + diff --git a/deps/SPIRV-Cross/reference/opt/shaders-msl/comp/shared.comp b/deps/SPIRV-Cross/reference/opt/shaders-msl/comp/shared.comp index 7408e3ecb1..ef82961e2b 100644 --- a/deps/SPIRV-Cross/reference/opt/shaders-msl/comp/shared.comp +++ b/deps/SPIRV-Cross/reference/opt/shaders-msl/comp/shared.comp @@ -15,7 +15,7 @@ struct SSBO2 float out_data[1]; }; -kernel void main0(uint3 gl_GlobalInvocationID [[thread_position_in_grid]], device SSBO& _22 [[buffer(0)]], uint gl_LocalInvocationIndex [[thread_index_in_threadgroup]], device SSBO2& _44 [[buffer(1)]]) +kernel void main0(device SSBO& _22 [[buffer(0)]], device SSBO2& _44 [[buffer(1)]], uint3 gl_GlobalInvocationID [[thread_position_in_grid]], uint gl_LocalInvocationIndex [[thread_index_in_threadgroup]]) { threadgroup float sShared[4]; sShared[gl_LocalInvocationIndex] = _22.in_data[gl_GlobalInvocationID.x]; diff --git a/deps/SPIRV-Cross/reference/opt/shaders-msl/comp/struct-layout.comp b/deps/SPIRV-Cross/reference/opt/shaders-msl/comp/struct-layout.comp index 28e81e7361..aa11cc966a 100644 --- a/deps/SPIRV-Cross/reference/opt/shaders-msl/comp/struct-layout.comp +++ b/deps/SPIRV-Cross/reference/opt/shaders-msl/comp/struct-layout.comp @@ -18,7 +18,7 @@ struct SSBO Foo in_data[1]; }; -kernel void main0(uint3 gl_GlobalInvocationID [[thread_position_in_grid]], device SSBO2& _23 [[buffer(0)]], device SSBO& _30 [[buffer(1)]]) +kernel void main0(device SSBO2& _23 [[buffer(0)]], device SSBO& _30 [[buffer(1)]], uint3 gl_GlobalInvocationID [[thread_position_in_grid]]) { _23.out_data[gl_GlobalInvocationID.x].m = _30.in_data[gl_GlobalInvocationID.x].m * _30.in_data[gl_GlobalInvocationID.x].m; } diff --git a/deps/SPIRV-Cross/reference/opt/shaders-msl/comp/torture-loop.comp b/deps/SPIRV-Cross/reference/opt/shaders-msl/comp/torture-loop.comp index 47acff93b0..1b239550e1 100644 --- a/deps/SPIRV-Cross/reference/opt/shaders-msl/comp/torture-loop.comp +++ b/deps/SPIRV-Cross/reference/opt/shaders-msl/comp/torture-loop.comp @@ -16,15 +16,15 @@ struct SSBO2 constant uint _98 = {}; -kernel void main0(uint3 gl_GlobalInvocationID [[thread_position_in_grid]], device SSBO& _24 [[buffer(0)]], device SSBO2& _89 [[buffer(1)]]) +kernel void main0(device SSBO& _24 [[buffer(0)]], device SSBO2& _89 [[buffer(1)]], uint3 gl_GlobalInvocationID [[thread_position_in_grid]]) { float4 _93; int _94; _93 = _24.in_data[gl_GlobalInvocationID.x]; _94 = 0; - int _48; int _40; float4 _46; + int _48; for (;;) { _40 = _94 + 1; diff --git a/deps/SPIRV-Cross/reference/opt/shaders-msl/comp/type-alias.comp b/deps/SPIRV-Cross/reference/opt/shaders-msl/comp/type-alias.comp index 167d4370c0..02e23e733e 100644 --- a/deps/SPIRV-Cross/reference/opt/shaders-msl/comp/type-alias.comp +++ b/deps/SPIRV-Cross/reference/opt/shaders-msl/comp/type-alias.comp @@ -28,7 +28,7 @@ struct SSBO2 float4 outputs[1]; }; -kernel void main0(device SSBO0& _36 [[buffer(0)]], uint3 gl_GlobalInvocationID [[thread_position_in_grid]], device SSBO1& _55 [[buffer(1)]], device SSBO2& _66 [[buffer(2)]]) +kernel void main0(device SSBO0& _36 [[buffer(0)]], device SSBO1& _55 [[buffer(1)]], device SSBO2& _66 [[buffer(2)]], uint3 gl_GlobalInvocationID [[thread_position_in_grid]]) { _66.outputs[gl_GlobalInvocationID.x] = _36.s0s[gl_GlobalInvocationID.x].a + _55.s1s[gl_GlobalInvocationID.x].a; } diff --git a/deps/SPIRV-Cross/reference/opt/shaders-msl/comp/udiv.comp b/deps/SPIRV-Cross/reference/opt/shaders-msl/comp/udiv.comp index ed82369b99..32874ad787 100644 --- a/deps/SPIRV-Cross/reference/opt/shaders-msl/comp/udiv.comp +++ b/deps/SPIRV-Cross/reference/opt/shaders-msl/comp/udiv.comp @@ -13,7 +13,7 @@ struct SSBO uint inputs[1]; }; -kernel void main0(device SSBO2& _10 [[buffer(0)]], uint3 gl_GlobalInvocationID [[thread_position_in_grid]], device SSBO& _23 [[buffer(1)]]) +kernel void main0(device SSBO2& _10 [[buffer(0)]], device SSBO& _23 [[buffer(1)]], uint3 gl_GlobalInvocationID [[thread_position_in_grid]]) { _10.outputs[gl_GlobalInvocationID.x] = _23.inputs[gl_GlobalInvocationID.x] / 29u; } diff --git a/deps/SPIRV-Cross/reference/opt/shaders-msl/desktop-only/frag/sampler-ms-query.desktop.frag b/deps/SPIRV-Cross/reference/opt/shaders-msl/desktop-only/frag/sampler-ms-query.desktop.frag index 4d2eee11c5..937e27465e 100644 --- a/deps/SPIRV-Cross/reference/opt/shaders-msl/desktop-only/frag/sampler-ms-query.desktop.frag +++ b/deps/SPIRV-Cross/reference/opt/shaders-msl/desktop-only/frag/sampler-ms-query.desktop.frag @@ -8,7 +8,7 @@ struct main0_out float4 FragColor [[color(0)]]; }; -fragment main0_out main0(texture2d_ms uSampler [[texture(0)]], sampler uSamplerSmplr [[sampler(0)]], texture2d_ms uSamplerArray [[texture(1)]], sampler uSamplerArraySmplr [[sampler(1)]], texture2d_ms uImage [[texture(2)]], texture2d_ms uImageArray [[texture(3)]]) +fragment main0_out main0(texture2d_ms uSampler [[texture(0)]], texture2d_ms uSamplerArray [[texture(1)]], texture2d_ms uImage [[texture(2)]], texture2d_ms uImageArray [[texture(3)]], sampler uSamplerSmplr [[sampler(0)]], sampler uSamplerArraySmplr [[sampler(1)]]) { main0_out out = {}; out.FragColor = float4(float(((int(uSampler.get_num_samples()) + int(uSamplerArray.get_num_samples())) + int(uImage.get_num_samples())) + int(uImageArray.get_num_samples()))); diff --git a/deps/SPIRV-Cross/reference/opt/shaders-msl/frag/bitcasting.frag b/deps/SPIRV-Cross/reference/opt/shaders-msl/frag/bitcasting.frag index 8a7f750f90..659d320e9f 100644 --- a/deps/SPIRV-Cross/reference/opt/shaders-msl/frag/bitcasting.frag +++ b/deps/SPIRV-Cross/reference/opt/shaders-msl/frag/bitcasting.frag @@ -14,7 +14,7 @@ struct main0_out float4 FragColor1 [[color(1)]]; }; -fragment main0_out main0(main0_in in [[stage_in]], texture2d TextureBase [[texture(0)]], sampler TextureBaseSmplr [[sampler(0)]], texture2d TextureDetail [[texture(1)]], sampler TextureDetailSmplr [[sampler(1)]]) +fragment main0_out main0(main0_in in [[stage_in]], texture2d TextureBase [[texture(0)]], texture2d TextureDetail [[texture(1)]], sampler TextureBaseSmplr [[sampler(0)]], sampler TextureDetailSmplr [[sampler(1)]]) { main0_out out = {}; float4 _20 = TextureBase.sample(TextureBaseSmplr, in.VertGeom.xy); diff --git a/deps/SPIRV-Cross/reference/opt/shaders-msl/frag/constant-composites.frag b/deps/SPIRV-Cross/reference/opt/shaders-msl/frag/constant-composites.frag new file mode 100644 index 0000000000..1962db1752 --- /dev/null +++ b/deps/SPIRV-Cross/reference/opt/shaders-msl/frag/constant-composites.frag @@ -0,0 +1,31 @@ +#include +#include + +using namespace metal; + +struct Foo +{ + float a; + float b; +}; + +struct main0_in +{ + int line [[user(locn0)]]; +}; + +struct main0_out +{ + float4 FragColor [[color(0)]]; +}; + +fragment main0_out main0(main0_in in [[stage_in]]) +{ + main0_out out = {}; + float lut[4] = {1.0, 4.0, 3.0, 2.0}; + Foo foos[2] = {{10.0, 20.0}, {30.0, 40.0}}; + out.FragColor = float4(lut[in.line]); + out.FragColor += float4(foos[in.line].a * (foos[1 - in.line].a)); + return out; +} + diff --git a/deps/SPIRV-Cross/reference/opt/shaders-msl/frag/sampler-ms.frag b/deps/SPIRV-Cross/reference/opt/shaders-msl/frag/sampler-ms.frag index 5fcb3bcbfb..8245ed8263 100644 --- a/deps/SPIRV-Cross/reference/opt/shaders-msl/frag/sampler-ms.frag +++ b/deps/SPIRV-Cross/reference/opt/shaders-msl/frag/sampler-ms.frag @@ -8,7 +8,7 @@ struct main0_out float4 FragColor [[color(0)]]; }; -fragment main0_out main0(float4 gl_FragCoord [[position]], texture2d_ms uSampler [[texture(0)]], sampler uSamplerSmplr [[sampler(0)]]) +fragment main0_out main0(texture2d_ms uSampler [[texture(0)]], sampler uSamplerSmplr [[sampler(0)]], float4 gl_FragCoord [[position]]) { main0_out out = {}; int2 _17 = int2(gl_FragCoord.xy); diff --git a/deps/SPIRV-Cross/reference/opt/shaders-msl/frag/texture-proj-shadow.frag b/deps/SPIRV-Cross/reference/opt/shaders-msl/frag/texture-proj-shadow.frag index c31e6d9623..8b9b03a59e 100644 --- a/deps/SPIRV-Cross/reference/opt/shaders-msl/frag/texture-proj-shadow.frag +++ b/deps/SPIRV-Cross/reference/opt/shaders-msl/frag/texture-proj-shadow.frag @@ -15,7 +15,7 @@ struct main0_out float FragColor [[color(0)]]; }; -fragment main0_out main0(main0_in in [[stage_in]], depth2d uShadow2D [[texture(0)]], sampler uShadow2DSmplr [[sampler(0)]], texture1d uSampler1D [[texture(1)]], sampler uSampler1DSmplr [[sampler(1)]], texture2d uSampler2D [[texture(2)]], sampler uSampler2DSmplr [[sampler(2)]], texture3d uSampler3D [[texture(3)]], sampler uSampler3DSmplr [[sampler(3)]]) +fragment main0_out main0(main0_in in [[stage_in]], depth2d uShadow2D [[texture(0)]], texture1d uSampler1D [[texture(1)]], texture2d uSampler2D [[texture(2)]], texture3d uSampler3D [[texture(3)]], sampler uShadow2DSmplr [[sampler(0)]], sampler uSampler1DSmplr [[sampler(1)]], sampler uSampler2DSmplr [[sampler(2)]], sampler uSampler3DSmplr [[sampler(3)]]) { main0_out out = {}; float4 _20 = in.vClip4; diff --git a/deps/SPIRV-Cross/reference/opt/shaders/asm/frag/loop-header-to-continue.asm.frag b/deps/SPIRV-Cross/reference/opt/shaders/asm/frag/loop-header-to-continue.asm.frag new file mode 100644 index 0000000000..f3a6b4eceb --- /dev/null +++ b/deps/SPIRV-Cross/reference/opt/shaders/asm/frag/loop-header-to-continue.asm.frag @@ -0,0 +1,39 @@ +#version 450 + +struct Params +{ + vec4 TextureSize; + vec4 Params1; + vec4 Params2; + vec4 Params3; + vec4 Params4; + vec4 Bloom; +}; + +layout(binding = 1, std140) uniform CB1 +{ + Params CB1; +} _8; + +uniform sampler2D SPIRV_Cross_CombinedmapTexturemapSampler; + +layout(location = 0) in vec2 IN_uv; +layout(location = 0) out vec4 _entryPointOutput; + +void main() +{ + vec4 _49 = texture(SPIRV_Cross_CombinedmapTexturemapSampler, IN_uv); + float _50 = _49.y; + float _55; + float _58; + _55 = 0.0; + _58 = 0.0; + float _64; + vec4 _72; + float _78; + for (int _60 = -3; _60 <= 3; _64 = float(_60), _72 = texture(SPIRV_Cross_CombinedmapTexturemapSampler, IN_uv + (vec2(0.0, _8.CB1.TextureSize.w) * _64)), _78 = exp(((-_64) * _64) * 0.2222220003604888916015625) * float(abs(_72.y - _50) < clamp((_50 * 80.0) * 0.0007999999797903001308441162109375, 7.999999797903001308441162109375e-05, 0.008000000379979610443115234375)), _55 += (_72.x * _78), _58 += _78, _60++) + { + } + _entryPointOutput = vec4(_55 / _58, _50, 0.0, 1.0); +} + diff --git a/deps/SPIRV-Cross/reference/opt/shaders/comp/torture-loop.comp b/deps/SPIRV-Cross/reference/opt/shaders/comp/torture-loop.comp index 8002984f18..640142b30a 100644 --- a/deps/SPIRV-Cross/reference/opt/shaders/comp/torture-loop.comp +++ b/deps/SPIRV-Cross/reference/opt/shaders/comp/torture-loop.comp @@ -20,9 +20,9 @@ void main() int _94; _93 = _24.in_data[gl_GlobalInvocationID.x]; _94 = 0; - int _48; int _40; vec4 _46; + int _48; for (;;) { _40 = _94 + 1; diff --git a/deps/SPIRV-Cross/reference/opt/shaders/frag/constant-composites.frag b/deps/SPIRV-Cross/reference/opt/shaders/frag/constant-composites.frag new file mode 100644 index 0000000000..ab0816c3d2 --- /dev/null +++ b/deps/SPIRV-Cross/reference/opt/shaders/frag/constant-composites.frag @@ -0,0 +1,23 @@ +#version 310 es +precision mediump float; +precision highp int; + +struct Foo +{ + float a; + float b; +}; + +layout(location = 0) out vec4 FragColor; +layout(location = 0) flat in mediump int _line; +float lut[4]; +Foo foos[2]; + +void main() +{ + lut = float[](1.0, 4.0, 3.0, 2.0); + foos = Foo[](Foo(10.0, 20.0), Foo(30.0, 40.0)); + FragColor = vec4(lut[_line]); + FragColor += vec4(foos[_line].a * (foos[1 - _line].a)); +} + diff --git a/deps/SPIRV-Cross/reference/shaders-hlsl/frag/constant-composites.frag b/deps/SPIRV-Cross/reference/shaders-hlsl/frag/constant-composites.frag new file mode 100644 index 0000000000..0514eef1ee --- /dev/null +++ b/deps/SPIRV-Cross/reference/shaders-hlsl/frag/constant-composites.frag @@ -0,0 +1,43 @@ +struct Foo +{ + float a; + float b; +}; + +static const float _16[4] = { 1.0f, 4.0f, 3.0f, 2.0f }; +static const Foo _24 = { 10.0f, 20.0f }; +static const Foo _27 = { 30.0f, 40.0f }; +static const Foo _28[2] = { { 10.0f, 20.0f }, { 30.0f, 40.0f } }; + +static float4 FragColor; +static int _line; + +struct SPIRV_Cross_Input +{ + nointerpolation int _line : TEXCOORD0; +}; + +struct SPIRV_Cross_Output +{ + float4 FragColor : SV_Target0; +}; + +static float lut[4]; +static Foo foos[2]; + +void frag_main() +{ + lut = _16; + foos = _28; + FragColor = lut[_line].xxxx; + FragColor += (foos[_line].a * (foos[1 - _line].a)).xxxx; +} + +SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input) +{ + _line = stage_input._line; + frag_main(); + SPIRV_Cross_Output stage_output; + stage_output.FragColor = FragColor; + return stage_output; +} diff --git a/deps/SPIRV-Cross/reference/shaders-hlsl/frag/partial-write-preserve.frag b/deps/SPIRV-Cross/reference/shaders-hlsl/frag/partial-write-preserve.frag index 4ed4d42747..402c8108c1 100644 --- a/deps/SPIRV-Cross/reference/shaders-hlsl/frag/partial-write-preserve.frag +++ b/deps/SPIRV-Cross/reference/shaders-hlsl/frag/partial-write-preserve.frag @@ -4,6 +4,8 @@ struct B float b; }; +static const B _80 = { 10.0f, 20.0f }; + cbuffer _42 : register(b0) { int _42_some_value : packoffset(c0); @@ -61,7 +63,7 @@ void frag_main() float4 param_3; branchy_inout_2(param_3); a = param_3; - B b = { 10.0f, 20.0f }; + B b = _80; B param_4 = b; partial_inout(param_4); b = param_4; diff --git a/deps/SPIRV-Cross/reference/shaders-hlsl/frag/texture-size-combined-image-sampler.frag b/deps/SPIRV-Cross/reference/shaders-hlsl/frag/texture-size-combined-image-sampler.frag new file mode 100644 index 0000000000..d5c373746d --- /dev/null +++ b/deps/SPIRV-Cross/reference/shaders-hlsl/frag/texture-size-combined-image-sampler.frag @@ -0,0 +1,30 @@ +Texture2D uTex : register(t0); +SamplerState uSampler : register(s1); + +static int2 FooOut; + +struct SPIRV_Cross_Output +{ + int2 FooOut : SV_Target0; +}; + +uint2 SPIRV_Cross_textureSize(Texture2D Tex, uint Level, out uint Param) +{ + uint2 ret; + Tex.GetDimensions(Level, ret.x, ret.y, Param); + return ret; +} + +void frag_main() +{ + uint _23_dummy_parameter; + FooOut = int2(SPIRV_Cross_textureSize(uTex, uint(0), _23_dummy_parameter)); +} + +SPIRV_Cross_Output main() +{ + frag_main(); + SPIRV_Cross_Output stage_output; + stage_output.FooOut = FooOut; + return stage_output; +} diff --git a/deps/SPIRV-Cross/reference/shaders-msl-no-opt/vert/functions_nested.vert b/deps/SPIRV-Cross/reference/shaders-msl-no-opt/vert/functions_nested.vert index ff0f60dbef..aa66304682 100644 --- a/deps/SPIRV-Cross/reference/shaders-msl-no-opt/vert/functions_nested.vert +++ b/deps/SPIRV-Cross/reference/shaders-msl-no-opt/vert/functions_nested.vert @@ -167,7 +167,7 @@ void vs_adjust(thread float4& dst_reg0, thread float4& dst_reg1, thread float4& dst_reg0.x = float4(dot(float4(tmp0.xyz, 1.0), v_309.vc[0])).x; } -vertex main0_out main0(constant VertexBuffer& v_227 [[buffer(0)]], uint gl_VertexIndex [[vertex_id]], texture2d buff_in_2 [[texture(0)]], texture2d buff_in_1 [[texture(1)]], constant VertexConstantsBuffer& v_309 [[buffer(1)]]) +vertex main0_out main0(constant VertexBuffer& v_227 [[buffer(0)]], constant VertexConstantsBuffer& v_309 [[buffer(1)]], texture2d buff_in_2 [[texture(0)]], texture2d buff_in_1 [[texture(1)]], uint gl_VertexIndex [[vertex_id]]) { main0_out out = {}; float4 dst_reg0 = float4(0.0, 0.0, 0.0, 1.0); diff --git a/deps/SPIRV-Cross/reference/shaders-msl/asm/comp/storage-buffer-basic.asm.comp b/deps/SPIRV-Cross/reference/shaders-msl/asm/comp/storage-buffer-basic.asm.comp index 19d753afa7..9e37362dbd 100644 --- a/deps/SPIRV-Cross/reference/shaders-msl/asm/comp/storage-buffer-basic.asm.comp +++ b/deps/SPIRV-Cross/reference/shaders-msl/asm/comp/storage-buffer-basic.asm.comp @@ -14,7 +14,7 @@ struct _6 float _m0[1]; }; -kernel void main0(uint3 gl_WorkGroupID [[threadgroup_position_in_grid]], device _6& _8 [[buffer(0)]], device _6& _9 [[buffer(1)]]) +kernel void main0(device _6& _8 [[buffer(0)]], device _6& _9 [[buffer(1)]], uint3 gl_WorkGroupID [[threadgroup_position_in_grid]]) { uint3 _23 = gl_WorkGroupSize; _8._m0[gl_WorkGroupID.x] = _9._m0[gl_WorkGroupID.x] + _8._m0[gl_WorkGroupID.x]; diff --git a/deps/SPIRV-Cross/reference/shaders-msl/asm/frag/inliner-dominator-inside-loop.asm.frag b/deps/SPIRV-Cross/reference/shaders-msl/asm/frag/inliner-dominator-inside-loop.asm.frag index 98a1674865..2ac8cbe015 100644 --- a/deps/SPIRV-Cross/reference/shaders-msl/asm/frag/inliner-dominator-inside-loop.asm.frag +++ b/deps/SPIRV-Cross/reference/shaders-msl/asm/frag/inliner-dominator-inside-loop.asm.frag @@ -101,7 +101,7 @@ struct main0_out float4 _entryPointOutput [[color(0)]]; }; -fragment main0_out main0(main0_in in [[stage_in]], float4 gl_FragCoord [[position]], constant CB0& _19 [[buffer(0)]], texture3d LightMapTexture [[texture(0)]], sampler LightMapSampler [[sampler(0)]], sampler ShadowMapSampler [[sampler(1)]], texture2d ShadowMapTexture [[texture(1)]], texturecube EnvironmentMapTexture [[texture(2)]], sampler EnvironmentMapSampler [[sampler(2)]], sampler DiffuseMapSampler [[sampler(3)]], texture2d DiffuseMapTexture [[texture(3)]], sampler NormalMapSampler [[sampler(4)]], texture2d NormalMapTexture [[texture(4)]], texture2d NormalDetailMapTexture [[texture(5)]], sampler NormalDetailMapSampler [[sampler(5)]], texture2d StudsMapTexture [[texture(6)]], sampler StudsMapSampler [[sampler(6)]], sampler SpecularMapSampler [[sampler(7)]], texture2d SpecularMapTexture [[texture(7)]]) +fragment main0_out main0(main0_in in [[stage_in]], constant CB0& _19 [[buffer(0)]], texture3d LightMapTexture [[texture(0)]], texture2d ShadowMapTexture [[texture(1)]], texturecube EnvironmentMapTexture [[texture(2)]], texture2d DiffuseMapTexture [[texture(3)]], texture2d NormalMapTexture [[texture(4)]], texture2d NormalDetailMapTexture [[texture(5)]], texture2d StudsMapTexture [[texture(6)]], texture2d SpecularMapTexture [[texture(7)]], sampler LightMapSampler [[sampler(0)]], sampler ShadowMapSampler [[sampler(1)]], sampler EnvironmentMapSampler [[sampler(2)]], sampler DiffuseMapSampler [[sampler(3)]], sampler NormalMapSampler [[sampler(4)]], sampler NormalDetailMapSampler [[sampler(5)]], sampler StudsMapSampler [[sampler(6)]], sampler SpecularMapSampler [[sampler(7)]], float4 gl_FragCoord [[position]]) { main0_out out = {}; VertexOutput _128 = _121; diff --git a/deps/SPIRV-Cross/reference/shaders-msl/asm/frag/vector-shuffle-oom.asm.frag b/deps/SPIRV-Cross/reference/shaders-msl/asm/frag/vector-shuffle-oom.asm.frag index 17cd528d41..97daea5d90 100644 --- a/deps/SPIRV-Cross/reference/shaders-msl/asm/frag/vector-shuffle-oom.asm.frag +++ b/deps/SPIRV-Cross/reference/shaders-msl/asm/frag/vector-shuffle-oom.asm.frag @@ -95,7 +95,7 @@ struct main0_out float4 m_5 [[color(0)]]; }; -fragment main0_out main0(float4 gl_FragCoord [[position]], constant _6& _7 [[buffer(0)]], texture2d _8 [[texture(0)]], sampler _9 [[sampler(0)]], constant _10& _11 [[buffer(1)]], texture2d _12 [[texture(1)]], sampler _13 [[sampler(1)]], texture2d _14 [[texture(2)]], sampler _15 [[sampler(2)]], constant _18& _19 [[buffer(2)]]) +fragment main0_out main0(constant _6& _7 [[buffer(0)]], constant _10& _11 [[buffer(1)]], constant _18& _19 [[buffer(2)]], texture2d _8 [[texture(0)]], texture2d _12 [[texture(1)]], texture2d _14 [[texture(2)]], sampler _9 [[sampler(0)]], sampler _13 [[sampler(1)]], sampler _15 [[sampler(2)]], float4 gl_FragCoord [[position]]) { main0_out out = {}; _28 _77 = _74; diff --git a/deps/SPIRV-Cross/reference/shaders-msl/comp/basic.comp b/deps/SPIRV-Cross/reference/shaders-msl/comp/basic.comp index 2c34c3543c..732b1cb257 100644 --- a/deps/SPIRV-Cross/reference/shaders-msl/comp/basic.comp +++ b/deps/SPIRV-Cross/reference/shaders-msl/comp/basic.comp @@ -21,7 +21,7 @@ struct SSBO3 uint counter; }; -kernel void main0(uint3 gl_GlobalInvocationID [[thread_position_in_grid]], device SSBO& _23 [[buffer(0)]], device SSBO2& _45 [[buffer(1)]], device SSBO3& _48 [[buffer(2)]]) +kernel void main0(device SSBO& _23 [[buffer(0)]], device SSBO2& _45 [[buffer(1)]], device SSBO3& _48 [[buffer(2)]], uint3 gl_GlobalInvocationID [[thread_position_in_grid]]) { uint ident = gl_GlobalInvocationID.x; float4 idata = _23.in_data[ident]; diff --git a/deps/SPIRV-Cross/reference/shaders-msl/comp/culling.comp b/deps/SPIRV-Cross/reference/shaders-msl/comp/culling.comp index 7eb6fe864e..ef84f1d19d 100644 --- a/deps/SPIRV-Cross/reference/shaders-msl/comp/culling.comp +++ b/deps/SPIRV-Cross/reference/shaders-msl/comp/culling.comp @@ -23,7 +23,7 @@ struct SSBO3 uint count; }; -kernel void main0(uint3 gl_GlobalInvocationID [[thread_position_in_grid]], device SSBO& _22 [[buffer(0)]], device SSBO2& _38 [[buffer(1)]], device SSBO3& _41 [[buffer(2)]]) +kernel void main0(device SSBO& _22 [[buffer(0)]], device SSBO2& _38 [[buffer(1)]], device SSBO3& _41 [[buffer(2)]], uint3 gl_GlobalInvocationID [[thread_position_in_grid]]) { uint ident = gl_GlobalInvocationID.x; float idata = _22.in_data[ident]; diff --git a/deps/SPIRV-Cross/reference/shaders-msl/comp/dowhile.comp b/deps/SPIRV-Cross/reference/shaders-msl/comp/dowhile.comp index ff772941a4..5decd415ff 100644 --- a/deps/SPIRV-Cross/reference/shaders-msl/comp/dowhile.comp +++ b/deps/SPIRV-Cross/reference/shaders-msl/comp/dowhile.comp @@ -14,7 +14,7 @@ struct SSBO2 float4 out_data[1]; }; -kernel void main0(uint3 gl_GlobalInvocationID [[thread_position_in_grid]], device SSBO& _28 [[buffer(0)]], device SSBO2& _52 [[buffer(1)]]) +kernel void main0(device SSBO& _28 [[buffer(0)]], device SSBO2& _52 [[buffer(1)]], uint3 gl_GlobalInvocationID [[thread_position_in_grid]]) { uint ident = gl_GlobalInvocationID.x; int i = 0; diff --git a/deps/SPIRV-Cross/reference/shaders-msl/comp/functions.comp b/deps/SPIRV-Cross/reference/shaders-msl/comp/functions.comp index 6127a39ca7..d8f6e55a46 100644 --- a/deps/SPIRV-Cross/reference/shaders-msl/comp/functions.comp +++ b/deps/SPIRV-Cross/reference/shaders-msl/comp/functions.comp @@ -5,7 +5,7 @@ using namespace metal; -void myfunc(threadgroup int* foo) +void myfunc(threadgroup int (&foo)[1337]) { foo[0] = 13; } diff --git a/deps/SPIRV-Cross/reference/shaders-msl/comp/image.comp b/deps/SPIRV-Cross/reference/shaders-msl/comp/image.comp index 85b48da797..f3bc1455db 100644 --- a/deps/SPIRV-Cross/reference/shaders-msl/comp/image.comp +++ b/deps/SPIRV-Cross/reference/shaders-msl/comp/image.comp @@ -3,7 +3,7 @@ using namespace metal; -kernel void main0(texture2d uImageIn [[texture(0)]], uint3 gl_GlobalInvocationID [[thread_position_in_grid]], texture2d uImageOut [[texture(1)]]) +kernel void main0(texture2d uImageIn [[texture(0)]], texture2d uImageOut [[texture(1)]], uint3 gl_GlobalInvocationID [[thread_position_in_grid]]) { float4 v = uImageIn.read(uint2((int2(gl_GlobalInvocationID.xy) + int2(uImageIn.get_width(), uImageIn.get_height())))); uImageOut.write(v, uint2(int2(gl_GlobalInvocationID.xy))); diff --git a/deps/SPIRV-Cross/reference/shaders-msl/comp/loop.noopt.comp b/deps/SPIRV-Cross/reference/shaders-msl/comp/loop.noopt.comp index 55d850d191..00ed570b31 100644 --- a/deps/SPIRV-Cross/reference/shaders-msl/comp/loop.noopt.comp +++ b/deps/SPIRV-Cross/reference/shaders-msl/comp/loop.noopt.comp @@ -14,7 +14,7 @@ struct SSBO2 float4 out_data[1]; }; -kernel void main0(uint3 gl_GlobalInvocationID [[thread_position_in_grid]], device SSBO& _24 [[buffer(0)]], device SSBO2& _177 [[buffer(1)]]) +kernel void main0(device SSBO& _24 [[buffer(0)]], device SSBO2& _177 [[buffer(1)]], uint3 gl_GlobalInvocationID [[thread_position_in_grid]]) { uint ident = gl_GlobalInvocationID.x; float4 idat = _24.in_data[ident]; diff --git a/deps/SPIRV-Cross/reference/shaders-msl/comp/mat3.comp b/deps/SPIRV-Cross/reference/shaders-msl/comp/mat3.comp index 4a315ce72c..c2d9a7c838 100644 --- a/deps/SPIRV-Cross/reference/shaders-msl/comp/mat3.comp +++ b/deps/SPIRV-Cross/reference/shaders-msl/comp/mat3.comp @@ -8,7 +8,7 @@ struct SSBO2 float3x3 out_data[1]; }; -kernel void main0(uint3 gl_GlobalInvocationID [[thread_position_in_grid]], device SSBO2& _22 [[buffer(0)]]) +kernel void main0(device SSBO2& _22 [[buffer(0)]], uint3 gl_GlobalInvocationID [[thread_position_in_grid]]) { uint ident = gl_GlobalInvocationID.x; _22.out_data[ident] = float3x3(float3(10.0), float3(20.0), float3(40.0)); diff --git a/deps/SPIRV-Cross/reference/shaders-msl/comp/mod.comp b/deps/SPIRV-Cross/reference/shaders-msl/comp/mod.comp index 9d13a2edd2..1a8c5c5fef 100644 --- a/deps/SPIRV-Cross/reference/shaders-msl/comp/mod.comp +++ b/deps/SPIRV-Cross/reference/shaders-msl/comp/mod.comp @@ -22,7 +22,7 @@ Tx mod(Tx x, Ty y) return x - y * floor(x / y); } -kernel void main0(uint3 gl_GlobalInvocationID [[thread_position_in_grid]], device SSBO& _23 [[buffer(0)]], device SSBO2& _33 [[buffer(1)]]) +kernel void main0(device SSBO& _23 [[buffer(0)]], device SSBO2& _33 [[buffer(1)]], uint3 gl_GlobalInvocationID [[thread_position_in_grid]]) { uint ident = gl_GlobalInvocationID.x; float4 v = mod(_23.in_data[ident], _33.out_data[ident]); diff --git a/deps/SPIRV-Cross/reference/shaders-msl/comp/modf.comp b/deps/SPIRV-Cross/reference/shaders-msl/comp/modf.comp index b358e9478c..9abd457cad 100644 --- a/deps/SPIRV-Cross/reference/shaders-msl/comp/modf.comp +++ b/deps/SPIRV-Cross/reference/shaders-msl/comp/modf.comp @@ -13,7 +13,7 @@ struct SSBO2 float4 out_data[1]; }; -kernel void main0(uint3 gl_GlobalInvocationID [[thread_position_in_grid]], device SSBO& _23 [[buffer(0)]], device SSBO2& _35 [[buffer(1)]]) +kernel void main0(device SSBO& _23 [[buffer(0)]], device SSBO2& _35 [[buffer(1)]], uint3 gl_GlobalInvocationID [[thread_position_in_grid]]) { uint ident = gl_GlobalInvocationID.x; float4 i; diff --git a/deps/SPIRV-Cross/reference/shaders-msl/comp/return.comp b/deps/SPIRV-Cross/reference/shaders-msl/comp/return.comp index 24e498c1f4..71fcfbe391 100644 --- a/deps/SPIRV-Cross/reference/shaders-msl/comp/return.comp +++ b/deps/SPIRV-Cross/reference/shaders-msl/comp/return.comp @@ -8,7 +8,7 @@ struct SSBO2 float4 out_data[1]; }; -kernel void main0(uint3 gl_GlobalInvocationID [[thread_position_in_grid]], device SSBO2& _27 [[buffer(0)]]) +kernel void main0(device SSBO2& _27 [[buffer(0)]], uint3 gl_GlobalInvocationID [[thread_position_in_grid]]) { uint ident = gl_GlobalInvocationID.x; if (ident == 2u) diff --git a/deps/SPIRV-Cross/reference/shaders-msl/comp/shared-array-of-arrays.comp b/deps/SPIRV-Cross/reference/shaders-msl/comp/shared-array-of-arrays.comp new file mode 100644 index 0000000000..3133e5f294 --- /dev/null +++ b/deps/SPIRV-Cross/reference/shaders-msl/comp/shared-array-of-arrays.comp @@ -0,0 +1,32 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" + +#include +#include + +using namespace metal; + +constant uint3 gl_WorkGroupSize = uint3(4u, 4u, 1u); + +struct SSBO +{ + float out_data[1]; +}; + +void work(threadgroup float (&foo)[4][4], thread uint3& gl_LocalInvocationID, thread uint& gl_LocalInvocationIndex, device SSBO& v_67, thread uint3& gl_GlobalInvocationID) +{ + foo[gl_LocalInvocationID.x][gl_LocalInvocationID.y] = float(gl_LocalInvocationIndex); + threadgroup_barrier(mem_flags::mem_threadgroup); + float x = 0.0; + x += foo[gl_LocalInvocationID.x][0]; + x += foo[gl_LocalInvocationID.x][1]; + x += foo[gl_LocalInvocationID.x][2]; + x += foo[gl_LocalInvocationID.x][3]; + v_67.out_data[gl_GlobalInvocationID.x] = x; +} + +kernel void main0(device SSBO& v_67 [[buffer(0)]], uint3 gl_LocalInvocationID [[thread_position_in_threadgroup]], uint gl_LocalInvocationIndex [[thread_index_in_threadgroup]], uint3 gl_GlobalInvocationID [[thread_position_in_grid]]) +{ + threadgroup float foo[4][4]; + work(foo, gl_LocalInvocationID, gl_LocalInvocationIndex, v_67, gl_GlobalInvocationID); +} + diff --git a/deps/SPIRV-Cross/reference/shaders-msl/comp/shared.comp b/deps/SPIRV-Cross/reference/shaders-msl/comp/shared.comp index 20f9538bd2..5aeaa4f8c1 100644 --- a/deps/SPIRV-Cross/reference/shaders-msl/comp/shared.comp +++ b/deps/SPIRV-Cross/reference/shaders-msl/comp/shared.comp @@ -15,7 +15,7 @@ struct SSBO2 float out_data[1]; }; -kernel void main0(uint3 gl_GlobalInvocationID [[thread_position_in_grid]], device SSBO& _22 [[buffer(0)]], uint gl_LocalInvocationIndex [[thread_index_in_threadgroup]], device SSBO2& _44 [[buffer(1)]]) +kernel void main0(device SSBO& _22 [[buffer(0)]], device SSBO2& _44 [[buffer(1)]], uint3 gl_GlobalInvocationID [[thread_position_in_grid]], uint gl_LocalInvocationIndex [[thread_index_in_threadgroup]]) { uint ident = gl_GlobalInvocationID.x; float idata = _22.in_data[ident]; diff --git a/deps/SPIRV-Cross/reference/shaders-msl/comp/struct-layout.comp b/deps/SPIRV-Cross/reference/shaders-msl/comp/struct-layout.comp index 27714ef09c..6c0f929480 100644 --- a/deps/SPIRV-Cross/reference/shaders-msl/comp/struct-layout.comp +++ b/deps/SPIRV-Cross/reference/shaders-msl/comp/struct-layout.comp @@ -18,7 +18,7 @@ struct SSBO Foo in_data[1]; }; -kernel void main0(uint3 gl_GlobalInvocationID [[thread_position_in_grid]], device SSBO2& _23 [[buffer(0)]], device SSBO& _30 [[buffer(1)]]) +kernel void main0(device SSBO2& _23 [[buffer(0)]], device SSBO& _30 [[buffer(1)]], uint3 gl_GlobalInvocationID [[thread_position_in_grid]]) { uint ident = gl_GlobalInvocationID.x; _23.out_data[ident].m = _30.in_data[ident].m * _30.in_data[ident].m; diff --git a/deps/SPIRV-Cross/reference/shaders-msl/comp/torture-loop.comp b/deps/SPIRV-Cross/reference/shaders-msl/comp/torture-loop.comp index 759af12685..9257088161 100644 --- a/deps/SPIRV-Cross/reference/shaders-msl/comp/torture-loop.comp +++ b/deps/SPIRV-Cross/reference/shaders-msl/comp/torture-loop.comp @@ -14,7 +14,7 @@ struct SSBO2 float4 out_data[1]; }; -kernel void main0(uint3 gl_GlobalInvocationID [[thread_position_in_grid]], device SSBO& _24 [[buffer(0)]], device SSBO2& _89 [[buffer(1)]]) +kernel void main0(device SSBO& _24 [[buffer(0)]], device SSBO2& _89 [[buffer(1)]], uint3 gl_GlobalInvocationID [[thread_position_in_grid]]) { uint ident = gl_GlobalInvocationID.x; float4 idat = _24.in_data[ident]; diff --git a/deps/SPIRV-Cross/reference/shaders-msl/comp/type-alias.comp b/deps/SPIRV-Cross/reference/shaders-msl/comp/type-alias.comp index e47c2ba946..d842132995 100644 --- a/deps/SPIRV-Cross/reference/shaders-msl/comp/type-alias.comp +++ b/deps/SPIRV-Cross/reference/shaders-msl/comp/type-alias.comp @@ -40,7 +40,7 @@ float4 overload(thread const S1& s1) return s1.a; } -kernel void main0(device SSBO0& _36 [[buffer(0)]], uint3 gl_GlobalInvocationID [[thread_position_in_grid]], device SSBO1& _55 [[buffer(1)]], device SSBO2& _66 [[buffer(2)]]) +kernel void main0(device SSBO0& _36 [[buffer(0)]], device SSBO1& _55 [[buffer(1)]], device SSBO2& _66 [[buffer(2)]], uint3 gl_GlobalInvocationID [[thread_position_in_grid]]) { S0 s0; s0.a = _36.s0s[gl_GlobalInvocationID.x].a; diff --git a/deps/SPIRV-Cross/reference/shaders-msl/comp/udiv.comp b/deps/SPIRV-Cross/reference/shaders-msl/comp/udiv.comp index ed82369b99..32874ad787 100644 --- a/deps/SPIRV-Cross/reference/shaders-msl/comp/udiv.comp +++ b/deps/SPIRV-Cross/reference/shaders-msl/comp/udiv.comp @@ -13,7 +13,7 @@ struct SSBO uint inputs[1]; }; -kernel void main0(device SSBO2& _10 [[buffer(0)]], uint3 gl_GlobalInvocationID [[thread_position_in_grid]], device SSBO& _23 [[buffer(1)]]) +kernel void main0(device SSBO2& _10 [[buffer(0)]], device SSBO& _23 [[buffer(1)]], uint3 gl_GlobalInvocationID [[thread_position_in_grid]]) { _10.outputs[gl_GlobalInvocationID.x] = _23.inputs[gl_GlobalInvocationID.x] / 29u; } diff --git a/deps/SPIRV-Cross/reference/shaders-msl/desktop-only/frag/sampler-ms-query.desktop.frag b/deps/SPIRV-Cross/reference/shaders-msl/desktop-only/frag/sampler-ms-query.desktop.frag index 4d2eee11c5..937e27465e 100644 --- a/deps/SPIRV-Cross/reference/shaders-msl/desktop-only/frag/sampler-ms-query.desktop.frag +++ b/deps/SPIRV-Cross/reference/shaders-msl/desktop-only/frag/sampler-ms-query.desktop.frag @@ -8,7 +8,7 @@ struct main0_out float4 FragColor [[color(0)]]; }; -fragment main0_out main0(texture2d_ms uSampler [[texture(0)]], sampler uSamplerSmplr [[sampler(0)]], texture2d_ms uSamplerArray [[texture(1)]], sampler uSamplerArraySmplr [[sampler(1)]], texture2d_ms uImage [[texture(2)]], texture2d_ms uImageArray [[texture(3)]]) +fragment main0_out main0(texture2d_ms uSampler [[texture(0)]], texture2d_ms uSamplerArray [[texture(1)]], texture2d_ms uImage [[texture(2)]], texture2d_ms uImageArray [[texture(3)]], sampler uSamplerSmplr [[sampler(0)]], sampler uSamplerArraySmplr [[sampler(1)]]) { main0_out out = {}; out.FragColor = float4(float(((int(uSampler.get_num_samples()) + int(uSamplerArray.get_num_samples())) + int(uImage.get_num_samples())) + int(uImageArray.get_num_samples()))); diff --git a/deps/SPIRV-Cross/reference/shaders-msl/frag/bitcasting.frag b/deps/SPIRV-Cross/reference/shaders-msl/frag/bitcasting.frag index fcbced0efe..a2d624510f 100644 --- a/deps/SPIRV-Cross/reference/shaders-msl/frag/bitcasting.frag +++ b/deps/SPIRV-Cross/reference/shaders-msl/frag/bitcasting.frag @@ -14,7 +14,7 @@ struct main0_out float4 FragColor1 [[color(1)]]; }; -fragment main0_out main0(main0_in in [[stage_in]], texture2d TextureBase [[texture(0)]], sampler TextureBaseSmplr [[sampler(0)]], texture2d TextureDetail [[texture(1)]], sampler TextureDetailSmplr [[sampler(1)]]) +fragment main0_out main0(main0_in in [[stage_in]], texture2d TextureBase [[texture(0)]], texture2d TextureDetail [[texture(1)]], sampler TextureBaseSmplr [[sampler(0)]], sampler TextureDetailSmplr [[sampler(1)]]) { main0_out out = {}; float4 texSample0 = TextureBase.sample(TextureBaseSmplr, in.VertGeom.xy); diff --git a/deps/SPIRV-Cross/reference/shaders-msl/frag/constant-composites.frag b/deps/SPIRV-Cross/reference/shaders-msl/frag/constant-composites.frag new file mode 100644 index 0000000000..1962db1752 --- /dev/null +++ b/deps/SPIRV-Cross/reference/shaders-msl/frag/constant-composites.frag @@ -0,0 +1,31 @@ +#include +#include + +using namespace metal; + +struct Foo +{ + float a; + float b; +}; + +struct main0_in +{ + int line [[user(locn0)]]; +}; + +struct main0_out +{ + float4 FragColor [[color(0)]]; +}; + +fragment main0_out main0(main0_in in [[stage_in]]) +{ + main0_out out = {}; + float lut[4] = {1.0, 4.0, 3.0, 2.0}; + Foo foos[2] = {{10.0, 20.0}, {30.0, 40.0}}; + out.FragColor = float4(lut[in.line]); + out.FragColor += float4(foos[in.line].a * (foos[1 - in.line].a)); + return out; +} + diff --git a/deps/SPIRV-Cross/reference/shaders-msl/frag/sampler-ms.frag b/deps/SPIRV-Cross/reference/shaders-msl/frag/sampler-ms.frag index 6b5e20d720..1ceb3f96bd 100644 --- a/deps/SPIRV-Cross/reference/shaders-msl/frag/sampler-ms.frag +++ b/deps/SPIRV-Cross/reference/shaders-msl/frag/sampler-ms.frag @@ -8,7 +8,7 @@ struct main0_out float4 FragColor [[color(0)]]; }; -fragment main0_out main0(float4 gl_FragCoord [[position]], texture2d_ms uSampler [[texture(0)]], sampler uSamplerSmplr [[sampler(0)]]) +fragment main0_out main0(texture2d_ms uSampler [[texture(0)]], sampler uSamplerSmplr [[sampler(0)]], float4 gl_FragCoord [[position]]) { main0_out out = {}; int2 coord = int2(gl_FragCoord.xy); diff --git a/deps/SPIRV-Cross/reference/shaders-msl/frag/texture-proj-shadow.frag b/deps/SPIRV-Cross/reference/shaders-msl/frag/texture-proj-shadow.frag index c31e6d9623..8b9b03a59e 100644 --- a/deps/SPIRV-Cross/reference/shaders-msl/frag/texture-proj-shadow.frag +++ b/deps/SPIRV-Cross/reference/shaders-msl/frag/texture-proj-shadow.frag @@ -15,7 +15,7 @@ struct main0_out float FragColor [[color(0)]]; }; -fragment main0_out main0(main0_in in [[stage_in]], depth2d uShadow2D [[texture(0)]], sampler uShadow2DSmplr [[sampler(0)]], texture1d uSampler1D [[texture(1)]], sampler uSampler1DSmplr [[sampler(1)]], texture2d uSampler2D [[texture(2)]], sampler uSampler2DSmplr [[sampler(2)]], texture3d uSampler3D [[texture(3)]], sampler uSampler3DSmplr [[sampler(3)]]) +fragment main0_out main0(main0_in in [[stage_in]], depth2d uShadow2D [[texture(0)]], texture1d uSampler1D [[texture(1)]], texture2d uSampler2D [[texture(2)]], texture3d uSampler3D [[texture(3)]], sampler uShadow2DSmplr [[sampler(0)]], sampler uSampler1DSmplr [[sampler(1)]], sampler uSampler2DSmplr [[sampler(2)]], sampler uSampler3DSmplr [[sampler(3)]]) { main0_out out = {}; float4 _20 = in.vClip4; diff --git a/deps/SPIRV-Cross/reference/shaders/asm/frag/loop-header-to-continue.asm.frag b/deps/SPIRV-Cross/reference/shaders/asm/frag/loop-header-to-continue.asm.frag new file mode 100644 index 0000000000..f3a6b4eceb --- /dev/null +++ b/deps/SPIRV-Cross/reference/shaders/asm/frag/loop-header-to-continue.asm.frag @@ -0,0 +1,39 @@ +#version 450 + +struct Params +{ + vec4 TextureSize; + vec4 Params1; + vec4 Params2; + vec4 Params3; + vec4 Params4; + vec4 Bloom; +}; + +layout(binding = 1, std140) uniform CB1 +{ + Params CB1; +} _8; + +uniform sampler2D SPIRV_Cross_CombinedmapTexturemapSampler; + +layout(location = 0) in vec2 IN_uv; +layout(location = 0) out vec4 _entryPointOutput; + +void main() +{ + vec4 _49 = texture(SPIRV_Cross_CombinedmapTexturemapSampler, IN_uv); + float _50 = _49.y; + float _55; + float _58; + _55 = 0.0; + _58 = 0.0; + float _64; + vec4 _72; + float _78; + for (int _60 = -3; _60 <= 3; _64 = float(_60), _72 = texture(SPIRV_Cross_CombinedmapTexturemapSampler, IN_uv + (vec2(0.0, _8.CB1.TextureSize.w) * _64)), _78 = exp(((-_64) * _64) * 0.2222220003604888916015625) * float(abs(_72.y - _50) < clamp((_50 * 80.0) * 0.0007999999797903001308441162109375, 7.999999797903001308441162109375e-05, 0.008000000379979610443115234375)), _55 += (_72.x * _78), _58 += _78, _60++) + { + } + _entryPointOutput = vec4(_55 / _58, _50, 0.0, 1.0); +} + diff --git a/deps/SPIRV-Cross/reference/shaders/frag/constant-composites.frag b/deps/SPIRV-Cross/reference/shaders/frag/constant-composites.frag new file mode 100644 index 0000000000..ab0816c3d2 --- /dev/null +++ b/deps/SPIRV-Cross/reference/shaders/frag/constant-composites.frag @@ -0,0 +1,23 @@ +#version 310 es +precision mediump float; +precision highp int; + +struct Foo +{ + float a; + float b; +}; + +layout(location = 0) out vec4 FragColor; +layout(location = 0) flat in mediump int _line; +float lut[4]; +Foo foos[2]; + +void main() +{ + lut = float[](1.0, 4.0, 3.0, 2.0); + foos = Foo[](Foo(10.0, 20.0), Foo(30.0, 40.0)); + FragColor = vec4(lut[_line]); + FragColor += vec4(foos[_line].a * (foos[1 - _line].a)); +} + diff --git a/deps/SPIRV-Cross/shaders-hlsl/frag/constant-composites.frag b/deps/SPIRV-Cross/shaders-hlsl/frag/constant-composites.frag new file mode 100644 index 0000000000..a12e22ff4f --- /dev/null +++ b/deps/SPIRV-Cross/shaders-hlsl/frag/constant-composites.frag @@ -0,0 +1,20 @@ +#version 310 es +precision mediump float; + +float lut[4] = float[](1.0, 4.0, 3.0, 2.0); + +struct Foo +{ + float a; + float b; +}; +Foo foos[2] = Foo[](Foo(10.0, 20.0), Foo(30.0, 40.0)); + +layout(location = 0) out vec4 FragColor; +layout(location = 0) flat in int line; + +void main() +{ + FragColor = vec4(lut[line]); + FragColor += foos[line].a * foos[1 - line].a; +} diff --git a/deps/SPIRV-Cross/shaders-hlsl/frag/texture-size-combined-image-sampler.frag b/deps/SPIRV-Cross/shaders-hlsl/frag/texture-size-combined-image-sampler.frag new file mode 100644 index 0000000000..9488059595 --- /dev/null +++ b/deps/SPIRV-Cross/shaders-hlsl/frag/texture-size-combined-image-sampler.frag @@ -0,0 +1,9 @@ +#version 450 +layout(set = 0, binding = 0) uniform texture2D uTex; +layout(set = 0, binding = 1) uniform sampler uSampler; +layout(location = 0) out ivec2 FooOut; + +void main() +{ + FooOut = textureSize(sampler2D(uTex, uSampler), 0); +} diff --git a/deps/SPIRV-Cross/shaders-msl/comp/shared-array-of-arrays.comp b/deps/SPIRV-Cross/shaders-msl/comp/shared-array-of-arrays.comp new file mode 100644 index 0000000000..009b4e41d4 --- /dev/null +++ b/deps/SPIRV-Cross/shaders-msl/comp/shared-array-of-arrays.comp @@ -0,0 +1,29 @@ +#version 310 es +layout(local_size_x = 4, local_size_y = 4) in; + +shared float foo[4][4]; + +layout(binding = 0, std430) buffer SSBO +{ + float out_data[]; +}; + +void work() +{ + foo[gl_LocalInvocationID.x][gl_LocalInvocationID.y] = float(gl_LocalInvocationIndex); + memoryBarrierShared(); + barrier(); + + float x = 0.0; + x += foo[gl_LocalInvocationID.x][0]; + x += foo[gl_LocalInvocationID.x][1]; + x += foo[gl_LocalInvocationID.x][2]; + x += foo[gl_LocalInvocationID.x][3]; + out_data[gl_GlobalInvocationID.x] = x; +} + +void main() +{ + work(); +} + diff --git a/deps/SPIRV-Cross/shaders-msl/frag/constant-composites.frag b/deps/SPIRV-Cross/shaders-msl/frag/constant-composites.frag new file mode 100644 index 0000000000..a12e22ff4f --- /dev/null +++ b/deps/SPIRV-Cross/shaders-msl/frag/constant-composites.frag @@ -0,0 +1,20 @@ +#version 310 es +precision mediump float; + +float lut[4] = float[](1.0, 4.0, 3.0, 2.0); + +struct Foo +{ + float a; + float b; +}; +Foo foos[2] = Foo[](Foo(10.0, 20.0), Foo(30.0, 40.0)); + +layout(location = 0) out vec4 FragColor; +layout(location = 0) flat in int line; + +void main() +{ + FragColor = vec4(lut[line]); + FragColor += foos[line].a * foos[1 - line].a; +} diff --git a/deps/SPIRV-Cross/shaders/asm/frag/loop-header-to-continue.asm.frag b/deps/SPIRV-Cross/shaders/asm/frag/loop-header-to-continue.asm.frag new file mode 100644 index 0000000000..54807d911c --- /dev/null +++ b/deps/SPIRV-Cross/shaders/asm/frag/loop-header-to-continue.asm.frag @@ -0,0 +1,132 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 3 +; Bound: 279 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %IN_p %IN_uv %_entryPointOutput + OpExecutionMode %main OriginUpperLeft + OpSource HLSL 500 + OpName %main "main" + OpName %Params "Params" + OpMemberName %Params 0 "TextureSize" + OpMemberName %Params 1 "Params1" + OpMemberName %Params 2 "Params2" + OpMemberName %Params 3 "Params3" + OpMemberName %Params 4 "Params4" + OpMemberName %Params 5 "Bloom" + OpName %CB1 "CB1" + OpMemberName %CB1 0 "CB1" + OpName %_ "" + OpName %mapSampler "mapSampler" + OpName %mapTexture "mapTexture" + OpName %IN_p "IN.p" + OpName %IN_uv "IN.uv" + OpName %_entryPointOutput "@entryPointOutput" + OpMemberDecorate %Params 0 Offset 0 + OpMemberDecorate %Params 1 Offset 16 + OpMemberDecorate %Params 2 Offset 32 + OpMemberDecorate %Params 3 Offset 48 + OpMemberDecorate %Params 4 Offset 64 + OpMemberDecorate %Params 5 Offset 80 + OpMemberDecorate %CB1 0 Offset 0 + OpDecorate %CB1 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 1 + OpDecorate %mapSampler DescriptorSet 1 + OpDecorate %mapSampler Binding 2 + OpDecorate %mapTexture DescriptorSet 1 + OpDecorate %mapTexture Binding 2 + OpDecorate %IN_p BuiltIn FragCoord + OpDecorate %IN_uv Location 0 + OpDecorate %_entryPointOutput Location 0 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 + %9 = OpTypeSampler + %11 = OpTypeImage %float 2D 0 0 0 1 Unknown + %v4float = OpTypeVector %float 4 +%float_0_222222 = OpConstant %float 0.222222 + %33 = OpTypeSampledImage %11 + %uint = OpTypeInt 32 0 + %float_80 = OpConstant %float 80 +%float_0_0008 = OpConstant %float 0.0008 +%float_8en05 = OpConstant %float 8e-05 +%float_0_008 = OpConstant %float 0.008 + %float_0 = OpConstant %float 0 + %int = OpTypeInt 32 1 + %int_n3 = OpConstant %int -3 + %int_3 = OpConstant %int 3 + %bool = OpTypeBool + %float_1 = OpConstant %float 1 + %int_1 = OpConstant %int 1 + %Params = OpTypeStruct %v4float %v4float %v4float %v4float %v4float %v4float + %CB1 = OpTypeStruct %Params +%_ptr_Uniform_CB1 = OpTypePointer Uniform %CB1 + %_ = OpVariable %_ptr_Uniform_CB1 Uniform + %int_0 = OpConstant %int 0 + %uint_3 = OpConstant %uint 3 +%_ptr_Uniform_float = OpTypePointer Uniform %float +%_ptr_UniformConstant_9 = OpTypePointer UniformConstant %9 + %mapSampler = OpVariable %_ptr_UniformConstant_9 UniformConstant +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %mapTexture = OpVariable %_ptr_UniformConstant_11 UniformConstant +%_ptr_Input_v4float = OpTypePointer Input %v4float + %IN_p = OpVariable %_ptr_Input_v4float Input +%_ptr_Input_v2float = OpTypePointer Input %v2float + %IN_uv = OpVariable %_ptr_Input_v2float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%_entryPointOutput = OpVariable %_ptr_Output_v4float Output + %main = OpFunction %void None %3 + %5 = OpLabel + %158 = OpLoad %v2float %IN_uv + %178 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_0 %uint_3 + %179 = OpLoad %float %178 + %180 = OpCompositeConstruct %v2float %float_0 %179 + %184 = OpLoad %9 %mapSampler + %185 = OpLoad %11 %mapTexture + %204 = OpSampledImage %33 %185 %184 + %206 = OpImageSampleImplicitLod %v4float %204 %158 + %207 = OpCompositeExtract %float %206 1 + %209 = OpFMul %float %207 %float_80 + %210 = OpFMul %float %209 %float_0_0008 + %211 = OpExtInst %float %1 FClamp %210 %float_8en05 %float_0_008 + OpBranch %212 + %212 = OpLabel + %276 = OpPhi %float %float_0 %5 %252 %218 + %277 = OpPhi %float %float_0 %5 %255 %218 + %278 = OpPhi %int %int_n3 %5 %257 %218 + %217 = OpSLessThanEqual %bool %278 %int_3 + OpLoopMerge %213 %218 None + OpBranchConditional %217 %218 %213 + %218 = OpLabel + %220 = OpConvertSToF %float %278 + %222 = OpFNegate %float %220 + %224 = OpFMul %float %222 %220 + %226 = OpFMul %float %224 %float_0_222222 + %227 = OpExtInst %float %1 Exp %226 + %230 = OpSampledImage %33 %185 %184 + %234 = OpVectorTimesScalar %v2float %180 %220 + %235 = OpFAdd %v2float %158 %234 + %236 = OpImageSampleImplicitLod %v4float %230 %235 + %273 = OpCompositeExtract %float %236 1 + %241 = OpFSub %float %273 %207 + %242 = OpExtInst %float %1 FAbs %241 + %244 = OpFOrdLessThan %bool %242 %211 + %245 = OpSelect %float %244 %float_1 %float_0 + %246 = OpFMul %float %227 %245 + %275 = OpCompositeExtract %float %236 0 + %250 = OpFMul %float %275 %246 + %252 = OpFAdd %float %276 %250 + %255 = OpFAdd %float %277 %246 + %257 = OpIAdd %int %278 %int_1 + OpBranch %212 + %213 = OpLabel + %260 = OpFDiv %float %276 %277 + %190 = OpCompositeConstruct %v4float %260 %207 %float_0 %float_1 + OpStore %_entryPointOutput %190 + OpReturn + OpFunctionEnd diff --git a/deps/SPIRV-Cross/shaders/frag/constant-composites.frag b/deps/SPIRV-Cross/shaders/frag/constant-composites.frag new file mode 100644 index 0000000000..a12e22ff4f --- /dev/null +++ b/deps/SPIRV-Cross/shaders/frag/constant-composites.frag @@ -0,0 +1,20 @@ +#version 310 es +precision mediump float; + +float lut[4] = float[](1.0, 4.0, 3.0, 2.0); + +struct Foo +{ + float a; + float b; +}; +Foo foos[2] = Foo[](Foo(10.0, 20.0), Foo(30.0, 40.0)); + +layout(location = 0) out vec4 FragColor; +layout(location = 0) flat in int line; + +void main() +{ + FragColor = vec4(lut[line]); + FragColor += foos[line].a * foos[1 - line].a; +} diff --git a/deps/SPIRV-Cross/spirv_cfg.cpp b/deps/SPIRV-Cross/spirv_cfg.cpp index 815fdee682..c76698a740 100644 --- a/deps/SPIRV-Cross/spirv_cfg.cpp +++ b/deps/SPIRV-Cross/spirv_cfg.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2016-2017 ARM Limited + * Copyright 2016-2018 ARM Limited * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/deps/SPIRV-Cross/spirv_cfg.hpp b/deps/SPIRV-Cross/spirv_cfg.hpp index 3f7ec01d33..104e494c22 100644 --- a/deps/SPIRV-Cross/spirv_cfg.hpp +++ b/deps/SPIRV-Cross/spirv_cfg.hpp @@ -1,5 +1,5 @@ /* - * Copyright 2016-2017 ARM Limited + * Copyright 2016-2018 ARM Limited * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/deps/SPIRV-Cross/spirv_common.hpp b/deps/SPIRV-Cross/spirv_common.hpp index eeb8532542..550bc86e4d 100644 --- a/deps/SPIRV-Cross/spirv_common.hpp +++ b/deps/SPIRV-Cross/spirv_common.hpp @@ -1,5 +1,5 @@ /* - * Copyright 2015-2017 ARM Limited + * Copyright 2015-2018 ARM Limited * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -723,16 +723,30 @@ struct SPIRConstant : IVariant { Constant r[4]; // If != 0, this element is a specialization constant, and we should keep track of it as such. - uint32_t id[4] = {}; + uint32_t id[4]; uint32_t vecsize = 1; + + ConstantVector() + { + unsigned i; + for (i = 0; i < 4; i++) + id[i] = 0; + } }; struct ConstantMatrix { ConstantVector c[4]; // If != 0, this column is a specialization constant, and we should keep track of it as such. - uint32_t id[4] = {}; + uint32_t id[4]; uint32_t columns = 1; + + ConstantMatrix() + { + unsigned i; + for (i = 0; i < 4; i++) + id[i] = 0; + } }; inline uint32_t specialization_constant_id(uint32_t col, uint32_t row) const diff --git a/deps/SPIRV-Cross/spirv_cpp.cpp b/deps/SPIRV-Cross/spirv_cpp.cpp index 45f6d6a273..69ef138e43 100644 --- a/deps/SPIRV-Cross/spirv_cpp.cpp +++ b/deps/SPIRV-Cross/spirv_cpp.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2015-2017 ARM Limited + * Copyright 2015-2018 ARM Limited * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/deps/SPIRV-Cross/spirv_cpp.hpp b/deps/SPIRV-Cross/spirv_cpp.hpp index a2576feb9d..57f815f3c0 100644 --- a/deps/SPIRV-Cross/spirv_cpp.hpp +++ b/deps/SPIRV-Cross/spirv_cpp.hpp @@ -1,5 +1,5 @@ /* - * Copyright 2015-2017 ARM Limited + * Copyright 2015-2018 ARM Limited * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/deps/SPIRV-Cross/spirv_cross.cpp b/deps/SPIRV-Cross/spirv_cross.cpp index 26983a4358..c5db07d60a 100644 --- a/deps/SPIRV-Cross/spirv_cross.cpp +++ b/deps/SPIRV-Cross/spirv_cross.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2015-2017 ARM Limited + * Copyright 2015-2018 ARM Limited * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -3368,7 +3368,7 @@ void Compiler::analyze_variable_scope(SPIRFunction &entry) CFG cfg(*this, entry); // Analyze if there are parameters which need to be implicitly preserved with an "in" qualifier. - analyze_parameter_preservation(entry, cfg, handler.accessed_variables_to_block, + this->analyze_parameter_preservation(entry, cfg, handler.accessed_variables_to_block, handler.complete_write_variables_to_block); unordered_map potential_loop_variables; @@ -3393,7 +3393,7 @@ void Compiler::analyze_variable_scope(SPIRFunction &entry) // The continue block is dominated by the inner part of the loop, which does not make sense in high-level // language output because it will be declared before the body, // so we will have to lift the dominator up to the relevant loop header instead. - builder.add_block(continue_block_to_loop_header[block]); + builder.add_block(this->continue_block_to_loop_header[block]); if (type.vecsize == 1 && type.columns == 1) { @@ -3447,7 +3447,7 @@ void Compiler::analyze_variable_scope(SPIRFunction &entry) // If a temporary is used in more than one block, we might have to lift continue block // access up to loop header like we did for variables. if (blocks.size() != 1 && this->is_continue(block)) - builder.add_block(continue_block_to_loop_header[block]); + builder.add_block(this->continue_block_to_loop_header[block]); } uint32_t dominating_block = builder.get_dominator(); @@ -3462,10 +3462,10 @@ void Compiler::analyze_variable_scope(SPIRFunction &entry) // This should be very rare, but if we try to declare a temporary inside a loop, // and that temporary is used outside the loop as well (spirv-opt inliner likes this) // we should actually emit the temporary outside the loop. - hoisted_temporaries.insert(var.first); - forced_temporaries.insert(var.first); + this->hoisted_temporaries.insert(var.first); + this->forced_temporaries.insert(var.first); - auto &block_temporaries = get(dominating_block).declare_temporary; + auto &block_temporaries = this->get(dominating_block).declare_temporary; block_temporaries.emplace_back(handler.result_id_to_type[var.first], var.first); } } diff --git a/deps/SPIRV-Cross/spirv_cross.hpp b/deps/SPIRV-Cross/spirv_cross.hpp index ce928f7eb9..c477ea952f 100644 --- a/deps/SPIRV-Cross/spirv_cross.hpp +++ b/deps/SPIRV-Cross/spirv_cross.hpp @@ -1,5 +1,5 @@ /* - * Copyright 2015-2017 ARM Limited + * Copyright 2015-2018 ARM Limited * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/deps/SPIRV-Cross/spirv_glsl.cpp b/deps/SPIRV-Cross/spirv_glsl.cpp index ea80c20ce4..10c61b82d4 100644 --- a/deps/SPIRV-Cross/spirv_glsl.cpp +++ b/deps/SPIRV-Cross/spirv_glsl.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2015-2017 ARM Limited + * Copyright 2015-2018 ARM Limited * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -1634,10 +1634,10 @@ void CompilerGLSL::replace_illegal_names() "iimageCubeArray", "image1D", "image1DArray", "image2D", "image2DArray", "image2DMS", "image2DMSArray", "image2DRect", "image3D", "imageBuffer", "imageCube", "imageCubeArray", "in", "inline", "inout", "input", "int", "interface", "invariant", "isampler1D", "isampler1DArray", "isampler2D", "isampler2DArray", "isampler2DMS", "isampler2DMSArray", "isampler2DRect", - "isampler3D", "isamplerBuffer", "isamplerCube", "isamplerCubeArray", "ivec2", "ivec3", "ivec4", "layout", "long", "lowp", - "mat2", "mat2x2", "mat2x3", "mat2x4", "mat3", "mat3x2", "mat3x3", "mat3x4", "mat4", "mat4x2", "mat4x3", "mat4x4", "mediump", - "namespace", "noinline", "noperspective", "out", "output", "packed", "partition", "patch", "precision", "public", "readonly", - "resource", "restrict", "return", "row_major", "sample", "sampler1D", "sampler1DArray", "sampler1DArrayShadow", + "isampler3D", "isamplerBuffer", "isamplerCube", "isamplerCubeArray", "ivec2", "ivec3", "ivec4", "layout", "line", "linear", "long", "lowp", + "mat2", "mat2x2", "mat2x3", "mat2x4", "mat3", "mat3x2", "mat3x3", "mat3x4", "mat4", "mat4x2", "mat4x3", "mat4x4", "matrix", "mediump", + "namespace", "noinline", "noperspective", "out", "output", "packed", "partition", "patch", "point", "precision", "public", "readonly", + "resource", "restrict", "return", "row_major", "sample", "sampler", "sampler1D", "sampler1DArray", "sampler1DArrayShadow", "sampler1DShadow", "sampler2D", "sampler2DArray", "sampler2DArrayShadow", "sampler2DMS", "sampler2DMSArray", "sampler2DRect", "sampler2DRectShadow", "sampler2DShadow", "sampler3D", "sampler3DRect", "samplerBuffer", "samplerCube", "samplerCubeArray", "samplerCubeArrayShadow", "samplerCubeShadow", "short", "sizeof", "smooth", "static", @@ -2256,6 +2256,7 @@ string CompilerGLSL::to_expression(uint32_t id) case TypeConstant: { auto &c = get(id); + auto &type = get(c.constant_type); // WorkGroupSize may be a constant. auto &dec = meta[c.self].decoration; @@ -2263,6 +2264,10 @@ string CompilerGLSL::to_expression(uint32_t id) return builtin_to_glsl(dec.builtin_type, StorageClassGeneric); else if (c.specialization && options.vulkan_semantics) return to_name(id); + else if (type.basetype == SPIRType::Struct && !backend.can_declare_struct_inline) + return to_name(id); + else if (!type.array.empty() && !backend.can_declare_arrays_inline) + return to_name(id); else return constant_expression(c); } @@ -5497,6 +5502,8 @@ void CompilerGLSL::emit_instruction(const Instruction &instruction) if (out_type.basetype == SPIRType::Struct && !backend.can_declare_struct_inline) forward = false; + if (!out_type.array.empty() && !backend.can_declare_arrays_inline) + forward = false; string constructor_op; if (backend.use_initializer_list && composite) @@ -7881,11 +7888,29 @@ void CompilerGLSL::branch(uint32_t from, uint32_t to) else { auto &from_block = get(from); - auto &dominator = get(from_block.loop_dominator); + bool outside_control_flow = false; + uint32_t loop_dominator = 0; - // For non-complex continue blocks, we implicitly branch to the continue block - // by having the continue block be part of the loop header in for (; ; continue-block). - bool outside_control_flow = block_is_outside_flow_control_from_block(dominator, from_block); + // FIXME: Refactor this to not use the old loop_dominator tracking. + if (from_block.merge_block) + { + // If we are a loop header, we don't set the loop dominator, + // so just use "self" here. + loop_dominator = from; + } + else if (from_block.loop_dominator != -1u) + { + loop_dominator = from_block.loop_dominator; + } + + if (loop_dominator != 0) + { + auto &dominator = get(loop_dominator); + + // For non-complex continue blocks, we implicitly branch to the continue block + // by having the continue block be part of the loop header in for (; ; continue-block). + outside_control_flow = block_is_outside_flow_control_from_block(dominator, from_block); + } // Some simplification for for-loops. We always end up with a useless continue; // statement since we branch to a loop block. @@ -8265,6 +8290,10 @@ void CompilerGLSL::emit_block_chain(SPIRBlock &block) bool emitted_for_loop_header = false; // If we need to force temporaries for certain IDs due to continue blocks, do it before starting loop header. + // Need to sort these to ensure that reference output is stable. + sort(begin(block.declare_temporary), end(block.declare_temporary), + [](const pair &a, const pair &b) { return a.second < b.second; }); + for (auto &tmp : block.declare_temporary) { auto flags = meta[tmp.second].decoration.decoration_flags; diff --git a/deps/SPIRV-Cross/spirv_glsl.hpp b/deps/SPIRV-Cross/spirv_glsl.hpp index 5421f258e9..0cae70c09b 100644 --- a/deps/SPIRV-Cross/spirv_glsl.hpp +++ b/deps/SPIRV-Cross/spirv_glsl.hpp @@ -1,5 +1,5 @@ /* - * Copyright 2015-2017 ARM Limited + * Copyright 2015-2018 ARM Limited * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -323,6 +323,7 @@ protected: bool use_initializer_list = false; bool use_typed_initializer_list = false; bool can_declare_struct_inline = true; + bool can_declare_arrays_inline = true; bool native_row_major_matrix = true; bool use_constructor_splatting = true; bool boolean_mix_support = true; diff --git a/deps/SPIRV-Cross/spirv_hlsl.cpp b/deps/SPIRV-Cross/spirv_hlsl.cpp index 09c6a502aa..6d486c6213 100644 --- a/deps/SPIRV-Cross/spirv_hlsl.cpp +++ b/deps/SPIRV-Cross/spirv_hlsl.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2016-2017 Robert Konrad + * Copyright 2016-2018 Robert Konrad * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -204,7 +204,7 @@ static string image_format_to_type(ImageFormat fmt, SPIRType::BaseType basetype) } // Returns true if an arithmetic operation does not change behavior depending on signedness. -static bool opcode_is_sign_invariant(Op opcode) +static bool hlsl_opcode_is_sign_invariant(Op opcode) { switch (opcode) { @@ -841,6 +841,34 @@ void CompilerHLSL::emit_builtin_variables() } } +void CompilerHLSL::emit_composite_constants() +{ + // HLSL cannot declare structs or arrays inline, so we must move them out to + // global constants directly. + bool emitted = false; + + for (auto &id : ids) + { + if (id.get_type() == TypeConstant) + { + auto &c = id.get(); + if (c.specialization) + continue; + + auto &type = get(c.constant_type); + if (type.basetype == SPIRType::Struct || !type.array.empty()) + { + auto name = to_name(c.self); + statement("static const ", variable_decl(type, name), " = ", constant_expression(c), ";"); + emitted = true; + } + } + } + + if (emitted) + statement(""); +} + void CompilerHLSL::emit_specialization_constants() { bool emitted = false; @@ -880,6 +908,8 @@ void CompilerHLSL::emit_resources() { auto &execution = get_entry_point(); + replace_illegal_names(); + emit_specialization_constants(); // Output all basic struct types which are not Block or BufferBlock as these are declared inplace @@ -898,6 +928,8 @@ void CompilerHLSL::emit_resources() } } + emit_composite_constants(); + bool emitted = false; // Output UBOs and SSBOs @@ -3022,15 +3054,24 @@ void CompilerHLSL::emit_instruction(const Instruction &instruction) auto ops = stream(instruction); auto opcode = static_cast(instruction.op); +#undef BOP +#undef BOP_CAST +#undef UOP +#undef QFOP +#undef TFOP +#undef BFOP +#undef BFOP_CAST +#undef BFOP +#undef UFOP #define BOP(op) emit_binary_op(ops[0], ops[1], ops[2], ops[3], #op) #define BOP_CAST(op, type) \ - emit_binary_op_cast(ops[0], ops[1], ops[2], ops[3], #op, type, opcode_is_sign_invariant(opcode)) + emit_binary_op_cast(ops[0], ops[1], ops[2], ops[3], #op, type, hlsl_opcode_is_sign_invariant(opcode)) #define UOP(op) emit_unary_op(ops[0], ops[1], ops[2], #op) #define QFOP(op) emit_quaternary_func_op(ops[0], ops[1], ops[2], ops[3], ops[4], ops[5], #op) #define TFOP(op) emit_trinary_func_op(ops[0], ops[1], ops[2], ops[3], ops[4], #op) #define BFOP(op) emit_binary_func_op(ops[0], ops[1], ops[2], ops[3], #op) #define BFOP_CAST(op, type) \ - emit_binary_func_op_cast(ops[0], ops[1], ops[2], ops[3], #op, type, opcode_is_sign_invariant(opcode)) + emit_binary_func_op_cast(ops[0], ops[1], ops[2], ops[3], #op, type, hlsl_opcode_is_sign_invariant(opcode)) #define BFOP(op) emit_binary_func_op(ops[0], ops[1], ops[2], ops[3], #op) #define UFOP(op) emit_unary_func_op(ops[0], ops[1], ops[2], #op) @@ -3088,8 +3129,11 @@ void CompilerHLSL::emit_instruction(const Instruction &instruction) { uint32_t result_type = ops[0]; uint32_t id = ops[1]; - emit_op(result_type, id, to_expression(ops[2]), true, true); - // TODO: Maybe change this when separate samplers/images are supported + auto *combined = maybe_get(ops[2]); + if (combined) + emit_op(result_type, id, to_expression(combined->image), true, true); + else + emit_op(result_type, id, to_expression(ops[2]), true, true); break; } @@ -3645,6 +3689,7 @@ string CompilerHLSL::compile() backend.boolean_mix_support = false; backend.can_swizzle_scalar = true; backend.can_declare_struct_inline = false; + backend.can_declare_arrays_inline = false; update_active_builtins(); analyze_sampler_comparison_states(); diff --git a/deps/SPIRV-Cross/spirv_hlsl.hpp b/deps/SPIRV-Cross/spirv_hlsl.hpp index 7144b5cdca..9b3261737c 100644 --- a/deps/SPIRV-Cross/spirv_hlsl.hpp +++ b/deps/SPIRV-Cross/spirv_hlsl.hpp @@ -1,5 +1,5 @@ /* - * Copyright 2016-2017 Robert Konrad + * Copyright 2016-2018 Robert Konrad * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -91,6 +91,7 @@ private: void emit_modern_uniform(const SPIRVariable &var); void emit_legacy_uniform(const SPIRVariable &var); void emit_specialization_constants(); + void emit_composite_constants(); void emit_fixup() override; std::string builtin_to_glsl(spv::BuiltIn builtin, spv::StorageClass storage) override; std::string layout_for_member(const SPIRType &type, uint32_t index) override; diff --git a/deps/SPIRV-Cross/spirv_msl.cpp b/deps/SPIRV-Cross/spirv_msl.cpp index 70e9b4108f..9ddfb81029 100644 --- a/deps/SPIRV-Cross/spirv_msl.cpp +++ b/deps/SPIRV-Cross/spirv_msl.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2016-2017 The Brenwill Workshop Ltd. + * Copyright 2016-2018 The Brenwill Workshop Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -1230,7 +1230,13 @@ void CompilerMSL::emit_specialization_constants() // Override for MSL-specific syntax instructions void CompilerMSL::emit_instruction(const Instruction &instruction) { - +#undef BOP +#undef BOP_CAST +#undef UOP +#undef QFOP +#undef TFOP +#undef BFOP +#undef BFOP_CAST #define BOP(op) emit_binary_op(ops[0], ops[1], ops[2], ops[3], #op) #define BOP_CAST(op, type) \ emit_binary_op_cast(ops[0], ops[1], ops[2], ops[3], #op, type, opcode_is_sign_invariant(opcode)) @@ -2692,7 +2698,19 @@ string CompilerMSL::entry_point_args(bool append_comma) convert_to_string(nsi_var.first) + ")]]"; } - // Uniforms + // Output resources, sorted by resource index & type + // We need to sort to work around a bug on macOS 10.13 with NVidia drivers where switching between shaders + // with different order of buffers can result in issues with buffer assignments inside the driver. + struct Resource + { + Variant *id; + string name; + SPIRType::BaseType basetype; + uint32_t index; + }; + + vector resources; + for (auto &id : ids) { if (id.get_type() == TypeVariable) @@ -2706,48 +2724,75 @@ string CompilerMSL::entry_point_args(bool append_comma) var.storage == StorageClassPushConstant || var.storage == StorageClassStorageBuffer) && !is_hidden_variable(var)) { - switch (type.basetype) + if (type.basetype == SPIRType::SampledImage) { - case SPIRType::Struct: - { - auto &m = meta.at(type.self); - if (m.members.size() == 0) - break; - if (!ep_args.empty()) - ep_args += ", "; - ep_args += get_argument_address_space(var) + " " + type_to_glsl(type) + "& " + to_name(var_id); - ep_args += " [[buffer(" + convert_to_string(get_metal_resource_index(var, type.basetype)) + ")]]"; - break; - } - case SPIRType::Sampler: - if (!ep_args.empty()) - ep_args += ", "; - ep_args += type_to_glsl(type) + " " + to_name(var_id); - ep_args += " [[sampler(" + convert_to_string(get_metal_resource_index(var, type.basetype)) + ")]]"; - break; - case SPIRType::Image: - if (!ep_args.empty()) - ep_args += ", "; - ep_args += type_to_glsl(type, var_id) + " " + to_name(var_id); - ep_args += " [[texture(" + convert_to_string(get_metal_resource_index(var, type.basetype)) + ")]]"; - break; - case SPIRType::SampledImage: - if (!ep_args.empty()) - ep_args += ", "; - ep_args += type_to_glsl(type, var_id) + " " + to_name(var_id); - ep_args += - " [[texture(" + convert_to_string(get_metal_resource_index(var, SPIRType::Image)) + ")]]"; + resources.push_back( + { &id, to_name(var_id), SPIRType::Image, get_metal_resource_index(var, SPIRType::Image) }); + if (type.image.dim != DimBuffer) - { - ep_args += ", sampler " + to_sampler_expression(var_id); - ep_args += - " [[sampler(" + convert_to_string(get_metal_resource_index(var, SPIRType::Sampler)) + ")]]"; - } - break; - default: - break; + resources.push_back({ &id, to_sampler_expression(var_id), SPIRType::Sampler, + get_metal_resource_index(var, SPIRType::Sampler) }); + } + else + { + resources.push_back( + { &id, to_name(var_id), type.basetype, get_metal_resource_index(var, type.basetype) }); } } + } + } + + std::sort(resources.begin(), resources.end(), [](const Resource &lhs, const Resource &rhs) { + return tie(lhs.basetype, lhs.index) < tie(rhs.basetype, rhs.index); + }); + + for (auto &r : resources) + { + auto &var = r.id->get(); + auto &type = get(var.basetype); + + uint32_t var_id = var.self; + + switch (r.basetype) + { + case SPIRType::Struct: + { + auto &m = meta.at(type.self); + if (m.members.size() == 0) + break; + if (!ep_args.empty()) + ep_args += ", "; + ep_args += get_argument_address_space(var) + " " + type_to_glsl(type) + "& " + r.name; + ep_args += " [[buffer(" + convert_to_string(r.index) + ")]]"; + break; + } + case SPIRType::Sampler: + if (!ep_args.empty()) + ep_args += ", "; + ep_args += "sampler " + r.name; + ep_args += " [[sampler(" + convert_to_string(r.index) + ")]]"; + break; + case SPIRType::Image: + if (!ep_args.empty()) + ep_args += ", "; + ep_args += type_to_glsl(type, var_id) + " " + r.name; + ep_args += " [[texture(" + convert_to_string(r.index) + ")]]"; + break; + default: + SPIRV_CROSS_THROW("Unexpected resource type"); + break; + } + } + + // Builtin variables + for (auto &id : ids) + { + if (id.get_type() == TypeVariable) + { + auto &var = id.get(); + + uint32_t var_id = var.self; + if (var.storage == StorageClassInput && is_builtin_variable(var)) { if (!ep_args.empty()) @@ -2837,17 +2882,28 @@ string CompilerMSL::argument_decl(const SPIRFunction::Parameter &arg) decl += "const "; if (is_builtin_variable(var)) - decl += builtin_type_decl((BuiltIn)get_decoration(arg.id, DecorationBuiltIn)); + decl += builtin_type_decl(static_cast(get_decoration(arg.id, DecorationBuiltIn))); else decl += type_to_glsl(type, arg.id); if (is_array(type)) - decl += "*"; + { + decl += " (&"; + decl += to_name(var.self); + decl += ")"; + decl += type_to_array_glsl(type); + } else if (!pointer) + { decl += "&"; - - decl += " "; - decl += to_name(var.self); + decl += " "; + decl += to_name(var.self); + } + else + { + decl += " "; + decl += to_name(var.self); + } return decl; } diff --git a/deps/SPIRV-Cross/spirv_msl.hpp b/deps/SPIRV-Cross/spirv_msl.hpp index fbc8dadf40..6187585577 100644 --- a/deps/SPIRV-Cross/spirv_msl.hpp +++ b/deps/SPIRV-Cross/spirv_msl.hpp @@ -1,5 +1,5 @@ /* - * Copyright 2016-2017 The Brenwill Workshop Ltd. + * Copyright 2016-2018 The Brenwill Workshop Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -18,6 +18,7 @@ #define SPIRV_CROSS_MSL_HPP #include "spirv_glsl.hpp" +#include #include #include #include @@ -64,7 +65,7 @@ using MSLStructMemberKey = uint64_t; // Special constant used in a MSLResourceBinding desc_set // element to indicate the bindings for the push constants. -static const uint32_t kPushConstDescSet = std::numeric_limits::max(); +static const uint32_t kPushConstDescSet = ((uint32_t)-1); // Special constant used in a MSLResourceBinding binding // element to indicate the bindings for the push constants. diff --git a/deps/SPIRV-Cross/test_shaders.sh b/deps/SPIRV-Cross/test_shaders.sh old mode 100644 new mode 100755 diff --git a/deps/SPIRV-Cross/update_test_shaders.sh b/deps/SPIRV-Cross/update_test_shaders.sh old mode 100644 new mode 100755 diff --git a/deps/glslang/glslang.cpp b/deps/glslang/glslang.cpp index 4a7eda479d..a90b47c5f6 100644 --- a/deps/glslang/glslang.cpp +++ b/deps/glslang/glslang.cpp @@ -363,7 +363,7 @@ bool glslang::compile_spirv(const string &source, Stage stage, std::vectortokenize(parseContext.getPpContext(), token); + return _parseContext.getScanContext()->tokenize(_parseContext.getPpContext(), token); } namespace { -struct str_eq -{ - bool operator()(const char* lhs, const char* rhs) const - { - return strcmp(lhs, rhs) == 0; - } -}; - -struct str_hash -{ - size_t operator()(const char* str) const - { - // djb2 - unsigned long hash = 5381; - int c; - - while ((c = *str++) != 0) - hash = ((hash << 5) + hash) + c; - - return hash; - } -}; - // A single global usable by all threads, by all versions, by all languages. // After a single process-level initialization, this is read only and thread safe std::unordered_map* KeywordMap = nullptr; @@ -670,7 +648,7 @@ int TScanContext::tokenize(TPpContext* pp, TParserToken& token) case '{': return LEFT_BRACE; case '}': return RIGHT_BRACE; case '\\': - parseContext.error(loc, "illegal use of escape character", "\\", ""); + _parseContext.error(loc, "illegal use of escape character", "\\", ""); break; case PpAtomAdd: return ADD_ASSIGN; @@ -722,7 +700,7 @@ int TScanContext::tokenize(TPpContext* pp, TParserToken& token) char buf[2]; buf[0] = (char)ppToken.token; buf[1] = 0; - parseContext.error(loc, "unexpected token", buf, ""); + _parseContext.error(loc, "unexpected token", buf, ""); break; } } while (true); @@ -761,8 +739,8 @@ int TScanContext::tokenizeIdentifier() case SWITCH: case DEFAULT: - if ((parseContext.profile == EEsProfile && parseContext.version < 300) || - (parseContext.profile != EEsProfile && parseContext.version < 130)) + if ((_parseContext.profile == EEsProfile && _parseContext.version < 300) || + (_parseContext.profile != EEsProfile && _parseContext.version < 130)) reservedWord(); return keyword; @@ -796,19 +774,19 @@ int TScanContext::tokenizeIdentifier() case ATTRIBUTE: case VARYING: - if (parseContext.profile == EEsProfile && parseContext.version >= 300) + if (_parseContext.profile == EEsProfile && _parseContext.version >= 300) reservedWord(); return keyword; case BUFFER: - if ((parseContext.profile == EEsProfile && parseContext.version < 310) || - (parseContext.profile != EEsProfile && parseContext.version < 430)) + if ((_parseContext.profile == EEsProfile && _parseContext.version < 310) || + (_parseContext.profile != EEsProfile && _parseContext.version < 430)) return identifierOrType(); return keyword; case ATOMIC_UINT: - if ((parseContext.profile == EEsProfile && parseContext.version >= 310) || - parseContext.extensionTurnedOn(E_GL_ARB_shader_atomic_counters)) + if ((_parseContext.profile == EEsProfile && _parseContext.version >= 310) || + _parseContext.extensionTurnedOn(E_GL_ARB_shader_atomic_counters)) return keyword; return es30ReservedFromGLSL(420); @@ -816,14 +794,14 @@ int TScanContext::tokenizeIdentifier() case RESTRICT: case READONLY: case WRITEONLY: - if (parseContext.profile == EEsProfile && parseContext.version >= 310) + if (_parseContext.profile == EEsProfile && _parseContext.version >= 310) return keyword; - return es30ReservedFromGLSL(parseContext.extensionTurnedOn(E_GL_ARB_shader_image_load_store) ? 130 : 420); + return es30ReservedFromGLSL(_parseContext.extensionTurnedOn(E_GL_ARB_shader_image_load_store) ? 130 : 420); case VOLATILE: - if (parseContext.profile == EEsProfile && parseContext.version >= 310) + if (_parseContext.profile == EEsProfile && _parseContext.version >= 310) return keyword; - if (! parseContext.symbolTable.atBuiltInLevel() && (parseContext.profile == EEsProfile || (parseContext.version < 420 && ! parseContext.extensionTurnedOn(E_GL_ARB_shader_image_load_store)))) + if (!_parseContext.symbolTable.atBuiltInLevel() && (_parseContext.profile == EEsProfile || (_parseContext.version < 420 && ! _parseContext.extensionTurnedOn(E_GL_ARB_shader_image_load_store)))) reservedWord(); return keyword; @@ -832,28 +810,28 @@ int TScanContext::tokenizeIdentifier() const int numLayoutExts = 2; const char* layoutExts[numLayoutExts] = { E_GL_ARB_shading_language_420pack, E_GL_ARB_explicit_attrib_location }; - if ((parseContext.profile == EEsProfile && parseContext.version < 300) || - (parseContext.profile != EEsProfile && parseContext.version < 140 && - ! parseContext.extensionsTurnedOn(numLayoutExts, layoutExts))) + if ((_parseContext.profile == EEsProfile && _parseContext.version < 300) || + (_parseContext.profile != EEsProfile && _parseContext.version < 140 && + !_parseContext.extensionsTurnedOn(numLayoutExts, layoutExts))) return identifierOrType(); return keyword; } case SHARED: - if ((parseContext.profile == EEsProfile && parseContext.version < 300) || - (parseContext.profile != EEsProfile && parseContext.version < 140)) + if ((_parseContext.profile == EEsProfile && _parseContext.version < 300) || + (_parseContext.profile != EEsProfile && _parseContext.version < 140)) return identifierOrType(); return keyword; case PATCH: - if (parseContext.symbolTable.atBuiltInLevel() || - (parseContext.profile == EEsProfile && parseContext.extensionsTurnedOn(Num_AEP_tessellation_shader, AEP_tessellation_shader)) || - (parseContext.profile != EEsProfile && parseContext.extensionTurnedOn(E_GL_ARB_tessellation_shader))) + if (_parseContext.symbolTable.atBuiltInLevel() || + (_parseContext.profile == EEsProfile && _parseContext.extensionsTurnedOn(Num_AEP_tessellation_shader, AEP_tessellation_shader)) || + (_parseContext.profile != EEsProfile && _parseContext.extensionTurnedOn(E_GL_ARB_tessellation_shader))) return keyword; return es30ReservedFromGLSL(400); case SAMPLE: - if (parseContext.extensionsTurnedOn(1, &E_GL_OES_shader_multisample_interpolation)) + if (_parseContext.extensionsTurnedOn(1, &E_GL_OES_shader_multisample_interpolation)) return keyword; return es30ReservedFromGLSL(400); @@ -907,7 +885,7 @@ int TScanContext::tokenizeIdentifier() case IIMAGEBUFFER: case UIMAGEBUFFER: afterType = true; - if (parseContext.extensionsTurnedOn(Num_AEP_texture_buffer, AEP_texture_buffer)) + if (_parseContext.extensionsTurnedOn(Num_AEP_texture_buffer, AEP_texture_buffer)) return keyword; return firstGenerationImage(false); @@ -930,7 +908,7 @@ int TScanContext::tokenizeIdentifier() case IIMAGECUBEARRAY: case UIMAGECUBEARRAY: afterType = true; - if (parseContext.extensionsTurnedOn(Num_AEP_texture_cube_map_array, AEP_texture_cube_map_array)) + if (_parseContext.extensionsTurnedOn(Num_AEP_texture_cube_map_array, AEP_texture_cube_map_array)) return keyword; return secondGenerationImage(); @@ -948,7 +926,7 @@ int TScanContext::tokenizeIdentifier() case DVEC3: case DVEC4: afterType = true; - if (parseContext.profile == EEsProfile || parseContext.version < 400) + if (_parseContext.profile == EEsProfile || _parseContext.version < 400) reservedWord(); return keyword; @@ -961,9 +939,9 @@ int TScanContext::tokenizeIdentifier() case U64VEC3: case U64VEC4: afterType = true; - if (parseContext.symbolTable.atBuiltInLevel() || - (parseContext.extensionTurnedOn(E_GL_ARB_gpu_shader_int64) && - parseContext.profile != EEsProfile && parseContext.version >= 450)) + if (_parseContext.symbolTable.atBuiltInLevel() || + (_parseContext.extensionTurnedOn(E_GL_ARB_gpu_shader_int64) && + _parseContext.profile != EEsProfile && _parseContext.version >= 450)) return keyword; return identifierOrType(); @@ -997,9 +975,9 @@ int TScanContext::tokenizeIdentifier() case ISAMPLERCUBEARRAY: case USAMPLERCUBEARRAY: afterType = true; - if (parseContext.extensionsTurnedOn(Num_AEP_texture_cube_map_array, AEP_texture_cube_map_array)) + if (_parseContext.extensionsTurnedOn(Num_AEP_texture_cube_map_array, AEP_texture_cube_map_array)) return keyword; - if (parseContext.profile == EEsProfile || (parseContext.version < 400 && ! parseContext.extensionTurnedOn(E_GL_ARB_texture_cube_map_array))) + if (_parseContext.profile == EEsProfile || (_parseContext.version < 400 && ! _parseContext.extensionTurnedOn(E_GL_ARB_texture_cube_map_array))) reservedWord(); return keyword; @@ -1036,14 +1014,14 @@ int TScanContext::tokenizeIdentifier() case SAMPLERBUFFER: afterType = true; - if (parseContext.extensionsTurnedOn(Num_AEP_texture_buffer, AEP_texture_buffer)) + if (_parseContext.extensionsTurnedOn(Num_AEP_texture_buffer, AEP_texture_buffer)) return keyword; return es30ReservedFromGLSL(130); case ISAMPLERBUFFER: case USAMPLERBUFFER: afterType = true; - if (parseContext.extensionsTurnedOn(Num_AEP_texture_buffer, AEP_texture_buffer)) + if (_parseContext.extensionsTurnedOn(Num_AEP_texture_buffer, AEP_texture_buffer)) return keyword; return es30ReservedFromGLSL(140); @@ -1051,7 +1029,7 @@ int TScanContext::tokenizeIdentifier() case ISAMPLER2DMS: case USAMPLER2DMS: afterType = true; - if (parseContext.profile == EEsProfile && parseContext.version >= 310) + if (_parseContext.profile == EEsProfile && _parseContext.version >= 310) return keyword; return es30ReservedFromGLSL(150); @@ -1059,39 +1037,39 @@ int TScanContext::tokenizeIdentifier() case ISAMPLER2DMSARRAY: case USAMPLER2DMSARRAY: afterType = true; - if (parseContext.extensionsTurnedOn(1, &E_GL_OES_texture_storage_multisample_2d_array)) + if (_parseContext.extensionsTurnedOn(1, &E_GL_OES_texture_storage_multisample_2d_array)) return keyword; return es30ReservedFromGLSL(150); case SAMPLER1D: case SAMPLER1DSHADOW: afterType = true; - if (parseContext.profile == EEsProfile) + if (_parseContext.profile == EEsProfile) reservedWord(); return keyword; case SAMPLER3D: afterType = true; - if (parseContext.profile == EEsProfile && parseContext.version < 300) { - if (! parseContext.extensionTurnedOn(E_GL_OES_texture_3D)) + if (_parseContext.profile == EEsProfile && _parseContext.version < 300) { + if (!_parseContext.extensionTurnedOn(E_GL_OES_texture_3D)) reservedWord(); } return keyword; case SAMPLER2DSHADOW: afterType = true; - if (parseContext.profile == EEsProfile && parseContext.version < 300) + if (_parseContext.profile == EEsProfile && _parseContext.version < 300) reservedWord(); return keyword; case SAMPLER2DRECT: case SAMPLER2DRECTSHADOW: afterType = true; - if (parseContext.profile == EEsProfile) + if (_parseContext.profile == EEsProfile) reservedWord(); - else if (parseContext.version < 140 && ! parseContext.symbolTable.atBuiltInLevel() && ! parseContext.extensionTurnedOn(E_GL_ARB_texture_rectangle)) { - if (parseContext.relaxedErrors()) - parseContext.requireExtensions(loc, 1, &E_GL_ARB_texture_rectangle, "texture-rectangle sampler keyword"); + else if (_parseContext.version < 140 && ! _parseContext.symbolTable.atBuiltInLevel() && ! _parseContext.extensionTurnedOn(E_GL_ARB_texture_rectangle)) { + if (_parseContext.relaxedErrors()) + _parseContext.requireExtensions(loc, 1, &E_GL_ARB_texture_rectangle, "texture-rectangle sampler keyword"); else reservedWord(); } @@ -1099,16 +1077,16 @@ int TScanContext::tokenizeIdentifier() case SAMPLER1DARRAY: afterType = true; - if (parseContext.profile == EEsProfile && parseContext.version == 300) + if (_parseContext.profile == EEsProfile && _parseContext.version == 300) reservedWord(); - else if ((parseContext.profile == EEsProfile && parseContext.version < 300) || - (parseContext.profile != EEsProfile && parseContext.version < 130)) + else if ((_parseContext.profile == EEsProfile && _parseContext.version < 300) || + (_parseContext.profile != EEsProfile && _parseContext.version < 130)) return identifierOrType(); return keyword; case SAMPLEREXTERNALOES: afterType = true; - if (parseContext.symbolTable.atBuiltInLevel() || parseContext.extensionTurnedOn(E_GL_OES_EGL_image_external)) + if (_parseContext.symbolTable.atBuiltInLevel() || _parseContext.extensionTurnedOn(E_GL_OES_EGL_image_external)) return keyword; return identifierOrType(); @@ -1147,7 +1125,7 @@ int TScanContext::tokenizeIdentifier() case TEXTURE1DARRAY: case SAMPLER: case SAMPLERSHADOW: - if (parseContext.spvVersion.vulkan >= 100) + if (_parseContext.spvVersion.vulkan >= 100) return keyword; else return identifierOrType(); @@ -1158,7 +1136,7 @@ int TScanContext::tokenizeIdentifier() case ISUBPASSINPUTMS: case USUBPASSINPUT: case USUBPASSINPUTMS: - if (parseContext.spvVersion.vulkan >= 100) + if (_parseContext.spvVersion.vulkan >= 100) return keyword; else return identifierOrType(); @@ -1167,8 +1145,8 @@ int TScanContext::tokenizeIdentifier() return es30ReservedFromGLSL(130); case SMOOTH: - if ((parseContext.profile == EEsProfile && parseContext.version < 300) || - (parseContext.profile != EEsProfile && parseContext.version < 130)) + if ((_parseContext.profile == EEsProfile && _parseContext.version < 300) || + (_parseContext.profile != EEsProfile && _parseContext.version < 130)) return identifierOrType(); return keyword; @@ -1181,52 +1159,52 @@ int TScanContext::tokenizeIdentifier() #endif case FLAT: - if (parseContext.profile == EEsProfile && parseContext.version < 300) + if (_parseContext.profile == EEsProfile && _parseContext.version < 300) reservedWord(); - else if (parseContext.profile != EEsProfile && parseContext.version < 130) + else if (_parseContext.profile != EEsProfile && _parseContext.version < 130) return identifierOrType(); return keyword; case CENTROID: - if (parseContext.version < 120) + if (_parseContext.version < 120) return identifierOrType(); return keyword; case PRECISE: - if ((parseContext.profile == EEsProfile && parseContext.extensionsTurnedOn(Num_AEP_gpu_shader5, AEP_gpu_shader5)) || - (parseContext.profile != EEsProfile && parseContext.version >= 400)) + if ((_parseContext.profile == EEsProfile && _parseContext.extensionsTurnedOn(Num_AEP_gpu_shader5, AEP_gpu_shader5)) || + (_parseContext.profile != EEsProfile && _parseContext.version >= 400)) return keyword; - if (parseContext.profile == EEsProfile && parseContext.version == 310) { + if (_parseContext.profile == EEsProfile && _parseContext.version == 310) { reservedWord(); return keyword; } return identifierOrType(); case INVARIANT: - if (parseContext.profile != EEsProfile && parseContext.version < 120) + if (_parseContext.profile != EEsProfile && _parseContext.version < 120) return identifierOrType(); return keyword; case PACKED: - if ((parseContext.profile == EEsProfile && parseContext.version < 300) || - (parseContext.profile != EEsProfile && parseContext.version < 330)) + if ((_parseContext.profile == EEsProfile && _parseContext.version < 300) || + (_parseContext.profile != EEsProfile && _parseContext.version < 330)) return reservedWord(); return identifierOrType(); case RESOURCE: { - bool reserved = (parseContext.profile == EEsProfile && parseContext.version >= 300) || - (parseContext.profile != EEsProfile && parseContext.version >= 420); + bool reserved = (_parseContext.profile == EEsProfile && _parseContext.version >= 300) || + (_parseContext.profile != EEsProfile && _parseContext.version >= 420); return identifierOrReserved(reserved); } case SUPERP: { - bool reserved = parseContext.profile == EEsProfile || parseContext.version >= 130; + bool reserved = _parseContext.profile == EEsProfile || _parseContext.version >= 130; return identifierOrReserved(reserved); } default: - parseContext.infoSink.info.message(EPrefixInternalError, "Unknown glslang keyword", loc); + _parseContext.infoSink.info.message(EPrefixInternalError, "Unknown glslang keyword", loc); return 0; } } @@ -1237,7 +1215,7 @@ int TScanContext::identifierOrType() if (field) return IDENTIFIER; - parserToken->sType.lex.symbol = parseContext.symbolTable.find(*parserToken->sType.lex.string); + parserToken->sType.lex.symbol = _parseContext.symbolTable.find(*parserToken->sType.lex.string); if (afterType == false && parserToken->sType.lex.symbol) { if (const TVariable* variable = parserToken->sType.lex.symbol->getAsVariable()) { if (variable->isUserType()) { @@ -1256,8 +1234,8 @@ int TScanContext::identifierOrType() // extension support before the extension is enabled. int TScanContext::reservedWord() { - if (! parseContext.symbolTable.atBuiltInLevel()) - parseContext.error(loc, "Reserved word.", tokenText, "", ""); + if (!_parseContext.symbolTable.atBuiltInLevel()) + _parseContext.error(loc, "Reserved word.", tokenText, "", ""); return 0; } @@ -1270,8 +1248,8 @@ int TScanContext::identifierOrReserved(bool reserved) return 0; } - if (parseContext.forwardCompatible) - parseContext.warn(loc, "using future reserved keyword", tokenText, ""); + if (_parseContext.forwardCompatible) + _parseContext.warn(loc, "using future reserved keyword", tokenText, ""); return identifierOrType(); } @@ -1280,16 +1258,16 @@ int TScanContext::identifierOrReserved(bool reserved) // but then got reserved by ES 3.0. int TScanContext::es30ReservedFromGLSL(int version) { - if (parseContext.symbolTable.atBuiltInLevel()) + if (_parseContext.symbolTable.atBuiltInLevel()) return keyword; - if ((parseContext.profile == EEsProfile && parseContext.version < 300) || - (parseContext.profile != EEsProfile && parseContext.version < version)) { - if (parseContext.forwardCompatible) - parseContext.warn(loc, "future reserved word in ES 300 and keyword in GLSL", tokenText, ""); + if ((_parseContext.profile == EEsProfile && _parseContext.version < 300) || + (_parseContext.profile != EEsProfile && _parseContext.version < version)) { + if (_parseContext.forwardCompatible) + _parseContext.warn(loc, "future reserved word in ES 300 and keyword in GLSL", tokenText, ""); return identifierOrType(); - } else if (parseContext.profile == EEsProfile && parseContext.version >= 300) + } else if (_parseContext.profile == EEsProfile && _parseContext.version >= 300) reservedWord(); return keyword; @@ -1299,10 +1277,10 @@ int TScanContext::es30ReservedFromGLSL(int version) // showed up, both in an es version and a non-ES version. int TScanContext::nonreservedKeyword(int esVersion, int nonEsVersion) { - if ((parseContext.profile == EEsProfile && parseContext.version < esVersion) || - (parseContext.profile != EEsProfile && parseContext.version < nonEsVersion)) { - if (parseContext.forwardCompatible) - parseContext.warn(loc, "using future keyword", tokenText, ""); + if ((_parseContext.profile == EEsProfile && _parseContext.version < esVersion) || + (_parseContext.profile != EEsProfile && _parseContext.version < nonEsVersion)) { + if (_parseContext.forwardCompatible) + _parseContext.warn(loc, "using future keyword", tokenText, ""); return identifierOrType(); } @@ -1312,11 +1290,11 @@ int TScanContext::nonreservedKeyword(int esVersion, int nonEsVersion) int TScanContext::precisionKeyword() { - if (parseContext.profile == EEsProfile || parseContext.version >= 130) + if (_parseContext.profile == EEsProfile || _parseContext.version >= 130) return keyword; - if (parseContext.forwardCompatible) - parseContext.warn(loc, "using ES precision qualifier keyword", tokenText, ""); + if (_parseContext.forwardCompatible) + _parseContext.warn(loc, "using ES precision qualifier keyword", tokenText, ""); return identifierOrType(); } @@ -1325,11 +1303,11 @@ int TScanContext::matNxM() { afterType = true; - if (parseContext.version > 110) + if (_parseContext.version > 110) return keyword; - if (parseContext.forwardCompatible) - parseContext.warn(loc, "using future non-square matrix type keyword", tokenText, ""); + if (_parseContext.forwardCompatible) + _parseContext.warn(loc, "using future non-square matrix type keyword", tokenText, ""); return identifierOrType(); } @@ -1338,55 +1316,55 @@ int TScanContext::dMat() { afterType = true; - if (parseContext.profile == EEsProfile && parseContext.version >= 300) { + if (_parseContext.profile == EEsProfile && _parseContext.version >= 300) { reservedWord(); return keyword; } - if (parseContext.profile != EEsProfile && parseContext.version >= 400) + if (_parseContext.profile != EEsProfile && _parseContext.version >= 400) return keyword; - if (parseContext.forwardCompatible) - parseContext.warn(loc, "using future type keyword", tokenText, ""); + if (_parseContext.forwardCompatible) + _parseContext.warn(loc, "using future type keyword", tokenText, ""); return identifierOrType(); } int TScanContext::firstGenerationImage(bool inEs310) { - if (parseContext.symbolTable.atBuiltInLevel() || - (parseContext.profile != EEsProfile && (parseContext.version >= 420 || parseContext.extensionTurnedOn(E_GL_ARB_shader_image_load_store))) || - (inEs310 && parseContext.profile == EEsProfile && parseContext.version >= 310)) + if (_parseContext.symbolTable.atBuiltInLevel() || + (_parseContext.profile != EEsProfile && (_parseContext.version >= 420 || _parseContext.extensionTurnedOn(E_GL_ARB_shader_image_load_store))) || + (inEs310 && _parseContext.profile == EEsProfile && _parseContext.version >= 310)) return keyword; - if ((parseContext.profile == EEsProfile && parseContext.version >= 300) || - (parseContext.profile != EEsProfile && parseContext.version >= 130)) { + if ((_parseContext.profile == EEsProfile && _parseContext.version >= 300) || + (_parseContext.profile != EEsProfile && _parseContext.version >= 130)) { reservedWord(); return keyword; } - if (parseContext.forwardCompatible) - parseContext.warn(loc, "using future type keyword", tokenText, ""); + if (_parseContext.forwardCompatible) + _parseContext.warn(loc, "using future type keyword", tokenText, ""); return identifierOrType(); } int TScanContext::secondGenerationImage() { - if (parseContext.profile == EEsProfile && parseContext.version >= 310) { + if (_parseContext.profile == EEsProfile && _parseContext.version >= 310) { reservedWord(); return keyword; } - if (parseContext.symbolTable.atBuiltInLevel() || - (parseContext.profile != EEsProfile && - (parseContext.version >= 420 || parseContext.extensionTurnedOn(E_GL_ARB_shader_image_load_store)))) + if (_parseContext.symbolTable.atBuiltInLevel() || + (_parseContext.profile != EEsProfile && + (_parseContext.version >= 420 || _parseContext.extensionTurnedOn(E_GL_ARB_shader_image_load_store)))) return keyword; - if (parseContext.forwardCompatible) - parseContext.warn(loc, "using future type keyword", tokenText, ""); + if (_parseContext.forwardCompatible) + _parseContext.warn(loc, "using future type keyword", tokenText, ""); return identifierOrType(); } diff --git a/deps/glslang/glslang/glslang/MachineIndependent/ScanContext.h b/deps/glslang/glslang/glslang/MachineIndependent/ScanContext.h index f237bee9f2..7f0a1b513a 100644 --- a/deps/glslang/glslang/glslang/MachineIndependent/ScanContext.h +++ b/deps/glslang/glslang/glslang/MachineIndependent/ScanContext.h @@ -33,6 +33,9 @@ //POSSIBILITY OF SUCH DAMAGE. // +#ifndef _MACHINE_INDEPENDENT_SCAN_CONTEXT_H +#define _MACHINE_INDEPENDENT_SCAN_CONTEXT_H + // // This holds context specific to the GLSL scanner, which // sits between the preprocessor scanner and parser. @@ -48,7 +51,7 @@ class TParserToken; class TScanContext { public: - explicit TScanContext(TParseContextBase& pc) : parseContext(pc), afterType(false), field(false) { } + explicit TScanContext(TParseContextBase& pc) : _parseContext(pc), afterType(false), field(false) { } virtual ~TScanContext() { } static void fillInKeywordMap(); @@ -72,7 +75,7 @@ protected: int firstGenerationImage(bool inEs310); int secondGenerationImage(); - TParseContextBase& parseContext; + TParseContextBase& _parseContext; bool afterType; // true if we've recognized a type, so can only be looking for an identifier bool field; // true if we're on a field, right after a '.' TSourceLoc loc; @@ -84,3 +87,5 @@ protected: }; } // end namespace glslang + +#endif diff --git a/deps/glslang/glslang/glslang/MachineIndependent/ShaderLang.cpp b/deps/glslang/glslang/glslang/MachineIndependent/ShaderLang.cpp index e50b12f255..596e0ee649 100644 --- a/deps/glslang/glslang/glslang/MachineIndependent/ShaderLang.cpp +++ b/deps/glslang/glslang/glslang/MachineIndependent/ShaderLang.cpp @@ -217,15 +217,15 @@ bool InitializeSymbolTable(const TString& builtIns, int version, EProfile profil intermediate.setSource(source); - std::unique_ptr parseContext(CreateParseContext(symbolTable, intermediate, version, profile, source, + std::unique_ptr _parseContext(CreateParseContext(symbolTable, intermediate, version, profile, source, language, infoSink, spvVersion, true, EShMsgDefault, true)); TShader::ForbidInclude includer; - TPpContext ppContext(*parseContext, "", includer); - TScanContext scanContext(*parseContext); - parseContext->setScanContext(&scanContext); - parseContext->setPpContext(&ppContext); + TPpContext ppContext(*_parseContext, "", includer); + TScanContext scanContext(*_parseContext); + _parseContext->setScanContext(&scanContext); + _parseContext->setPpContext(&ppContext); // // Push the symbol table to give it an initial scope. This @@ -244,7 +244,7 @@ bool InitializeSymbolTable(const TString& builtIns, int version, EProfile profil return true; TInputScanner input(1, builtInShaders, builtInLengths); - if (! parseContext->parseShaderStrings(ppContext, input) != 0) { + if (!_parseContext->parseShaderStrings(ppContext, input) != 0) { infoSink.info.message(EPrefixInternalError, "Unable to parse built-ins"); printf("Unable to parse built-ins\n%s\n", infoSink.info.c_str()); printf("%s\n", builtInShaders[0]); @@ -732,32 +732,32 @@ bool ProcessDeferred( // Now we can process the full shader under proper symbols and rules. // - TParseContextBase* parseContext = CreateParseContext(symbolTable, intermediate, version, profile, source, + TParseContextBase *_parseContext = CreateParseContext(symbolTable, intermediate, version, profile, source, compiler->getLanguage(), compiler->infoSink, spvVersion, forwardCompatible, messages, false, sourceEntryPointName); - TPpContext ppContext(*parseContext, names[numPre]? names[numPre]: "", includer); + TPpContext ppContext(*_parseContext, names[numPre]? names[numPre]: "", includer); // only GLSL (bison triggered, really) needs an externally set scan context - glslang::TScanContext scanContext(*parseContext); + glslang::TScanContext scanContext(*_parseContext); if ((messages & EShMsgReadHlsl) == 0) - parseContext->setScanContext(&scanContext); + _parseContext->setScanContext(&scanContext); - parseContext->setPpContext(&ppContext); - parseContext->setLimits(*resources); + _parseContext->setPpContext(&ppContext); + _parseContext->setLimits(*resources); if (! goodVersion) - parseContext->addError(); + _parseContext->addError(); if (warnVersionNotFirst) { TSourceLoc loc; loc.init(); - parseContext->warn(loc, "Illegal to have non-comment, non-whitespace tokens before #version", "#version", ""); + _parseContext->warn(loc, "Illegal to have non-comment, non-whitespace tokens before #version", "#version", ""); } - parseContext->initializeExtensionBehavior(); + _parseContext->initializeExtensionBehavior(); // Fill in the strings as outlined above. std::string preamble; - parseContext->getPreamble(preamble); + _parseContext->getPreamble(preamble); strings[0] = preamble.c_str(); lengths[0] = strlen(strings[0]); names[0] = nullptr; @@ -776,14 +776,14 @@ bool ProcessDeferred( // Push a new symbol allocation scope that will get used for the shader's globals. symbolTable.push(); - bool success = processingContext(*parseContext, ppContext, fullInput, + bool success = processingContext(*_parseContext, ppContext, fullInput, versionWillBeError, symbolTable, intermediate, optLevel, messages); // Clean up the symbol table. The AST is self-sufficient now. delete symbolTableMemory; - delete parseContext; + delete _parseContext; delete [] lengths; delete [] strings; delete [] names; @@ -860,7 +860,7 @@ private: // It places the result in the "string" argument to its constructor. struct DoPreprocessing { explicit DoPreprocessing(std::string* string): outputString(string) {} - bool operator()(TParseContextBase& parseContext, TPpContext& ppContext, + bool operator()(TParseContextBase&_parseContext, TPpContext& ppContext, TInputScanner& input, bool versionWillBeError, TSymbolTable&, TIntermediate&, EShOptimizationLevel, EShMessages) @@ -870,20 +870,20 @@ struct DoPreprocessing { static const std::string noSpaceBeforeTokens = ","; glslang::TPpToken token; - parseContext.setScanner(&input); + _parseContext.setScanner(&input); ppContext.setInput(input, versionWillBeError); std::stringstream outputStream; SourceLineSynchronizer lineSync( std::bind(&TInputScanner::getLastValidSourceIndex, &input), &outputStream); - parseContext.setExtensionCallback([&lineSync, &outputStream]( + _parseContext.setExtensionCallback([&lineSync, &outputStream]( int line, const char* extension, const char* behavior) { lineSync.syncToLine(line); outputStream << "#extension " << extension << " : " << behavior; }); - parseContext.setLineCallback([&lineSync, &outputStream, &parseContext]( + _parseContext.setLineCallback([&lineSync, &outputStream, &_parseContext]( int curLineNum, int newLineNum, bool hasSource, int sourceNum, const char* sourceName) { // SourceNum is the number of the source-string that is being parsed. lineSync.syncToLine(curLineNum); @@ -896,7 +896,7 @@ struct DoPreprocessing { outputStream << sourceNum; } } - if (parseContext.lineDirectiveShouldSetNextLine()) { + if (_parseContext.lineDirectiveShouldSetNextLine()) { // newLineNum is the new line number for the line following the #line // directive. So the new line number for the current line is newLineNum -= 1; @@ -906,7 +906,7 @@ struct DoPreprocessing { lineSync.setLineNum(newLineNum + 1); }); - parseContext.setVersionCallback( + _parseContext.setVersionCallback( [&lineSync, &outputStream](int line, int version, const char* str) { lineSync.syncToLine(line); outputStream << "#version " << version; @@ -915,7 +915,7 @@ struct DoPreprocessing { } }); - parseContext.setPragmaCallback([&lineSync, &outputStream]( + _parseContext.setPragmaCallback([&lineSync, &outputStream]( int line, const glslang::TVector& ops) { lineSync.syncToLine(line); outputStream << "#pragma "; @@ -924,7 +924,7 @@ struct DoPreprocessing { } }); - parseContext.setErrorCallback([&lineSync, &outputStream]( + _parseContext.setErrorCallback([&lineSync, &outputStream]( int line, const char* errorMessage) { lineSync.syncToLine(line); outputStream << "#error " << errorMessage; @@ -958,10 +958,10 @@ struct DoPreprocessing { *outputString = outputStream.str(); bool success = true; - if (parseContext.getNumErrors() > 0) { + if (_parseContext.getNumErrors() > 0) { success = false; - parseContext.infoSink.info.prefix(EPrefixError); - parseContext.infoSink.info << parseContext.getNumErrors() << " compilation errors. No code generated.\n\n"; + _parseContext.infoSink.info.prefix(EPrefixError); + _parseContext.infoSink.info << _parseContext.getNumErrors() << " compilation errors. No code generated.\n\n"; } return success; } @@ -971,28 +971,28 @@ struct DoPreprocessing { // DoFullParse is a valid ProcessingConext template argument for fully // parsing the shader. It populates the "intermediate" with the AST. struct DoFullParse{ - bool operator()(TParseContextBase& parseContext, TPpContext& ppContext, + bool operator()(TParseContextBase&_parseContext, TPpContext& ppContext, TInputScanner& fullInput, bool versionWillBeError, TSymbolTable&, TIntermediate& intermediate, EShOptimizationLevel optLevel, EShMessages messages) { bool success = true; // Parse the full shader. - if (! parseContext.parseShaderStrings(ppContext, fullInput, versionWillBeError)) + if (!_parseContext.parseShaderStrings(ppContext, fullInput, versionWillBeError)) success = false; if (success && intermediate.getTreeRoot()) { if (optLevel == EShOptNoGeneration) - parseContext.infoSink.info.message(EPrefixNone, "No errors. No code generation or linking was requested."); + _parseContext.infoSink.info.message(EPrefixNone, "No errors. No code generation or linking was requested."); else - success = intermediate.postProcess(intermediate.getTreeRoot(), parseContext.getLanguage()); + success = intermediate.postProcess(intermediate.getTreeRoot(), _parseContext.getLanguage()); } else if (! success) { - parseContext.infoSink.info.prefix(EPrefixError); - parseContext.infoSink.info << parseContext.getNumErrors() << " compilation errors. No code generated.\n\n"; + _parseContext.infoSink.info.prefix(EPrefixError); + _parseContext.infoSink.info << _parseContext.getNumErrors() << " compilation errors. No code generated.\n\n"; } if (messages & EShMsgAST) - intermediate.output(parseContext.infoSink, true); + intermediate.output(_parseContext.infoSink, true); return success; } diff --git a/deps/glslang/glslang/glslang/MachineIndependent/preprocessor/Compare.h b/deps/glslang/glslang/glslang/MachineIndependent/preprocessor/Compare.h new file mode 100644 index 0000000000..92d288c08d --- /dev/null +++ b/deps/glslang/glslang/glslang/MachineIndependent/preprocessor/Compare.h @@ -0,0 +1,32 @@ +#ifndef _MACHINE_INDEPENDENT_COMPARE_H +#define _MACHINE_INDEPENDENT_COMPARE_H + +#include "../../../hlsl/hlslTokens.h" + +namespace { + + struct str_eq + { + bool operator()(const char* lhs, const char* rhs) const + { + return strcmp(lhs, rhs) == 0; + } + }; + + struct str_hash + { + size_t operator()(const char* str) const + { + // djb2 + unsigned long hash = 5381; + int c; + + while ((c = *str++) != 0) + hash = ((hash << 5) + hash) + c; + + return hash; + } + }; +}; + +#endif diff --git a/deps/glslang/glslang/glslang/MachineIndependent/preprocessor/Pp.cpp b/deps/glslang/glslang/glslang/MachineIndependent/preprocessor/Pp.cpp index 824a69a9c7..9138d230ea 100644 --- a/deps/glslang/glslang/glslang/MachineIndependent/preprocessor/Pp.cpp +++ b/deps/glslang/glslang/glslang/MachineIndependent/preprocessor/Pp.cpp @@ -107,12 +107,12 @@ int TPpContext::CPPdefine(TPpToken* ppToken) // get macro name int token = scanToken(ppToken); if (token != PpAtomIdentifier) { - parseContext.ppError(ppToken->loc, "must be followed by macro name", "#define", ""); + _parseContext.ppError(ppToken->loc, "must be followed by macro name", "#define", ""); return token; } if (ppToken->loc.string >= 0) { // We are in user code; check for reserved name use: - parseContext.reservedPpErrorCheck(ppToken->loc, ppToken->name, "#define"); + _parseContext.reservedPpErrorCheck(ppToken->loc, ppToken->name, "#define"); } // save the original atom @@ -128,7 +128,7 @@ int TPpContext::CPPdefine(TPpToken* ppToken) if (argc == 0 && token == ')') break; if (token != PpAtomIdentifier) { - parseContext.ppError(ppToken->loc, "bad argument", "#define", ""); + _parseContext.ppError(ppToken->loc, "bad argument", "#define", ""); return token; } @@ -136,7 +136,7 @@ int TPpContext::CPPdefine(TPpToken* ppToken) bool duplicate = false; for (int a = 0; a < argc; ++a) { if (args[a] == ppToken->atom) { - parseContext.ppError(ppToken->loc, "duplicate macro parameter", "#define", ""); + _parseContext.ppError(ppToken->loc, "duplicate macro parameter", "#define", ""); duplicate = true; break; } @@ -145,12 +145,12 @@ int TPpContext::CPPdefine(TPpToken* ppToken) if (argc < maxMacroArgs) args[argc++] = ppToken->atom; else - parseContext.ppError(ppToken->loc, "too many macro parameters", "#define", ""); + _parseContext.ppError(ppToken->loc, "too many macro parameters", "#define", ""); } token = scanToken(ppToken); } while (token == ','); if (token != ')') { - parseContext.ppError(ppToken->loc, "missing parenthesis", "#define", ""); + _parseContext.ppError(ppToken->loc, "missing parenthesis", "#define", ""); return token; } @@ -178,11 +178,11 @@ int TPpContext::CPPdefine(TPpToken* ppToken) // "Two replacement lists are identical if and only if the preprocessing tokens in both have the same number, // ordering, spelling, and white-space separation, where all white-space separations are considered identical." if (symb->mac.argc != mac.argc) - parseContext.ppError(defineLoc, "Macro redefined; different number of arguments:", "#define", GetAtomString(defAtom)); + _parseContext.ppError(defineLoc, "Macro redefined; different number of arguments:", "#define", GetAtomString(defAtom)); else { for (int argc = 0; argc < mac.argc; argc++) { if (symb->mac.args[argc] != mac.args[argc]) - parseContext.ppError(defineLoc, "Macro redefined; different argument names:", "#define", GetAtomString(defAtom)); + _parseContext.ppError(defineLoc, "Macro redefined; different argument names:", "#define", GetAtomString(defAtom)); } RewindTokenStream(symb->mac.body); RewindTokenStream(mac.body); @@ -194,7 +194,7 @@ int TPpContext::CPPdefine(TPpToken* ppToken) oldToken = ReadToken(symb->mac.body, &oldPpToken); newToken = ReadToken(mac.body, &newPpToken); if (oldToken != newToken || oldPpToken != newPpToken) { - parseContext.ppError(defineLoc, "Macro redefined; different substitutions:", "#define", GetAtomString(defAtom)); + _parseContext.ppError(defineLoc, "Macro redefined; different substitutions:", "#define", GetAtomString(defAtom)); break; } } while (newToken > 0); @@ -215,12 +215,12 @@ int TPpContext::CPPundef(TPpToken* ppToken) int token = scanToken(ppToken); Symbol *symb; if (token != PpAtomIdentifier) { - parseContext.ppError(ppToken->loc, "must be followed by macro name", "#undef", ""); + _parseContext.ppError(ppToken->loc, "must be followed by macro name", "#undef", ""); return token; } - parseContext.reservedPpErrorCheck(ppToken->loc, ppToken->name, "#undef"); + _parseContext.reservedPpErrorCheck(ppToken->loc, ppToken->name, "#undef"); symb = LookUpSymbol(ppToken->atom); if (symb) { @@ -228,7 +228,7 @@ int TPpContext::CPPundef(TPpToken* ppToken) } token = scanToken(ppToken); if (token != '\n') - parseContext.ppError(ppToken->loc, "can only be followed by a single macro name", "#undef", ""); + _parseContext.ppError(ppToken->loc, "can only be followed by a single macro name", "#undef", ""); return token; } @@ -284,7 +284,7 @@ int TPpContext::CPPelse(int matchelse, TPpToken* ppToken) break; } else if (atom == PpAtomElif) { if (elseSeen[elsetracker]) - parseContext.ppError(ppToken->loc, "#elif after #else", "#elif", ""); + _parseContext.ppError(ppToken->loc, "#elif after #else", "#elif", ""); /* we decrement ifdepth here, because CPPif will increment * it and we really want to leave it alone */ if (ifdepth) { @@ -297,13 +297,13 @@ int TPpContext::CPPelse(int matchelse, TPpToken* ppToken) } } else if (atom == PpAtomElse) { if (elseSeen[elsetracker]) - parseContext.ppError(ppToken->loc, "#else after #else", "#else", ""); + _parseContext.ppError(ppToken->loc, "#else after #else", "#else", ""); else elseSeen[elsetracker] = true; token = extraTokenCheck(atom, ppToken, scanToken(ppToken)); } else if (atom == PpAtomElif) { if (elseSeen[elsetracker]) - parseContext.ppError(ppToken->loc, "#elif after #else", "#elif", ""); + _parseContext.ppError(ppToken->loc, "#elif after #else", "#elif", ""); } } @@ -330,10 +330,10 @@ int TPpContext::extraTokenCheck(int atom, TPpToken* ppToken, int token) else label = ""; - if (parseContext.relaxedErrors()) - parseContext.ppWarn(ppToken->loc, message, label, ""); + if (_parseContext.relaxedErrors()) + _parseContext.ppWarn(ppToken->loc, message, label, ""); else - parseContext.ppError(ppToken->loc, message, label, ""); + _parseContext.ppError(ppToken->loc, message, label, ""); while (token != '\n' && token != EndOfInput) token = scanToken(ppToken); @@ -421,7 +421,7 @@ int TPpContext::eval(int token, int precedence, bool shortCircuit, int& res, boo token = scanToken(ppToken); } if (token != PpAtomIdentifier) { - parseContext.ppError(loc, "incorrect directive, expected identifier", "preprocessor evaluation", ""); + _parseContext.ppError(loc, "incorrect directive, expected identifier", "preprocessor evaluation", ""); err = true; res = 0; @@ -432,7 +432,7 @@ int TPpContext::eval(int token, int precedence, bool shortCircuit, int& res, boo token = scanToken(ppToken); if (needclose) { if (token != ')') { - parseContext.ppError(loc, "expected ')'", "preprocessor evaluation", ""); + _parseContext.ppError(loc, "expected ')'", "preprocessor evaluation", ""); err = true; res = 0; @@ -452,7 +452,7 @@ int TPpContext::eval(int token, int precedence, bool shortCircuit, int& res, boo token = eval(token, MIN_PRECEDENCE, shortCircuit, res, err, ppToken); if (! err) { if (token != ')') { - parseContext.ppError(loc, "expected ')'", "preprocessor evaluation", ""); + _parseContext.ppError(loc, "expected ')'", "preprocessor evaluation", ""); err = true; res = 0; @@ -471,7 +471,7 @@ int TPpContext::eval(int token, int precedence, bool shortCircuit, int& res, boo token = eval(token, UNARY, shortCircuit, res, err, ppToken); res = unop[op].op(res); } else { - parseContext.ppError(loc, "bad expression", "preprocessor evaluation", ""); + _parseContext.ppError(loc, "bad expression", "preprocessor evaluation", ""); err = true; res = 0; @@ -507,7 +507,7 @@ int TPpContext::eval(int token, int precedence, bool shortCircuit, int& res, boo if (binop[op].op == op_div || binop[op].op == op_mod) { if (res == 0) { - parseContext.ppError(loc, "division by 0", "preprocessor evaluation", ""); + _parseContext.ppError(loc, "division by 0", "preprocessor evaluation", ""); res = 1; } } @@ -523,19 +523,19 @@ int TPpContext::evalToToken(int token, bool shortCircuit, int& res, bool& err, T while (token == PpAtomIdentifier && ppToken->atom != PpAtomDefined) { int macroReturn = MacroExpand(ppToken->atom, ppToken, true, false); if (macroReturn == 0) { - parseContext.ppError(ppToken->loc, "can't evaluate expression", "preprocessor evaluation", ""); + _parseContext.ppError(ppToken->loc, "can't evaluate expression", "preprocessor evaluation", ""); err = true; res = 0; token = scanToken(ppToken); break; } if (macroReturn == -1) { - if (! shortCircuit && parseContext.profile == EEsProfile) { + if (! shortCircuit && _parseContext.profile == EEsProfile) { const char* message = "undefined macro in expression not allowed in es profile"; - if (parseContext.relaxedErrors()) - parseContext.ppWarn(ppToken->loc, message, "preprocessor evaluation", ppToken->name); + if (_parseContext.relaxedErrors()) + _parseContext.ppWarn(ppToken->loc, message, "preprocessor evaluation", ppToken->name); else - parseContext.ppError(ppToken->loc, message, "preprocessor evaluation", ppToken->name); + _parseContext.ppError(ppToken->loc, message, "preprocessor evaluation", ppToken->name); } } token = scanToken(ppToken); @@ -551,7 +551,7 @@ int TPpContext::CPPif(TPpToken* ppToken) elsetracker++; ifdepth++; if (ifdepth > maxIfNesting) { - parseContext.ppError(ppToken->loc, "maximum nesting depth exceeded", "#if", ""); + _parseContext.ppError(ppToken->loc, "maximum nesting depth exceeded", "#if", ""); return 0; } int res = 0; @@ -570,20 +570,20 @@ int TPpContext::CPPifdef(int defined, TPpToken* ppToken) int token = scanToken(ppToken); int name = ppToken->atom; if (++ifdepth > maxIfNesting) { - parseContext.ppError(ppToken->loc, "maximum nesting depth exceeded", "#ifdef", ""); + _parseContext.ppError(ppToken->loc, "maximum nesting depth exceeded", "#ifdef", ""); return 0; } elsetracker++; if (token != PpAtomIdentifier) { if (defined) - parseContext.ppError(ppToken->loc, "must be followed by macro name", "#ifdef", ""); + _parseContext.ppError(ppToken->loc, "must be followed by macro name", "#ifdef", ""); else - parseContext.ppError(ppToken->loc, "must be followed by macro name", "#ifndef", ""); + _parseContext.ppError(ppToken->loc, "must be followed by macro name", "#ifndef", ""); } else { Symbol *s = LookUpSymbol(name); token = scanToken(ppToken); if (token != '\n') { - parseContext.ppError(ppToken->loc, "unexpected tokens following #ifdef directive - expected a newline", "#ifdef", ""); + _parseContext.ppError(ppToken->loc, "unexpected tokens following #ifdef directive - expected a newline", "#ifdef", ""); while (token != '\n' && token != EndOfInput) token = scanToken(ppToken); } @@ -601,18 +601,18 @@ int TPpContext::CPPinclude(TPpToken* ppToken) int token = scanToken(ppToken); if (token != PpAtomConstString) { // TODO: handle angle brackets. - parseContext.ppError(directiveLoc, "must be followed by a file designation", "#include", ""); + _parseContext.ppError(directiveLoc, "must be followed by a file designation", "#include", ""); } else { // Make a copy of the name because it will be overwritten by the next token scan. const std::string filename = ppToken->name; token = scanToken(ppToken); if (token != '\n' && token != EndOfInput) { - parseContext.ppError(ppToken->loc, "extra content after file designation", "#include", ""); + _parseContext.ppError(ppToken->loc, "extra content after file designation", "#include", ""); } else { TShader::Includer::IncludeResult* res = includer.include(filename.c_str(), TShader::Includer::EIncludeRelative, currentSourceFile.c_str(), includeStack.size() + 1); if (res && !res->file_name.empty()) { if (res->file_data && res->file_length) { - const bool forNextLine = parseContext.lineDirectiveShouldSetNextLine(); + const bool forNextLine = _parseContext.lineDirectiveShouldSetNextLine(); std::ostringstream prologue; std::ostringstream epilogue; prologue << "#line " << forNextLine << " " << "\"" << res->file_name << "\"\n"; @@ -620,14 +620,14 @@ int TPpContext::CPPinclude(TPpToken* ppToken) pushInput(new TokenizableIncludeFile(directiveLoc, prologue.str(), res, epilogue.str(), this)); } // At EOF, there's no "current" location anymore. - if (token != EndOfInput) parseContext.setCurrentColumn(0); + if (token != EndOfInput) _parseContext.setCurrentColumn(0); // Don't accidentally return EndOfInput, which will end all preprocessing. return '\n'; } else { std::string message = res ? std::string(res->file_data, res->file_length) : std::string("Could not process include directive"); - parseContext.ppError(directiveLoc, message.c_str(), "#include", ""); + _parseContext.ppError(directiveLoc, message.c_str(), "#include", ""); if (res) { includer.releaseInclude(res); } @@ -647,7 +647,7 @@ int TPpContext::CPPline(TPpToken* ppToken) int token = scanToken(ppToken); const TSourceLoc directiveLoc = ppToken->loc; if (token == '\n') { - parseContext.ppError(ppToken->loc, "must by followed by an integral literal", "#line", ""); + _parseContext.ppError(ppToken->loc, "must by followed by an integral literal", "#line", ""); return token; } @@ -664,31 +664,31 @@ int TPpContext::CPPline(TPpToken* ppToken) if (token == '\n') ++lineRes; - if (parseContext.lineDirectiveShouldSetNextLine()) + if (_parseContext.lineDirectiveShouldSetNextLine()) --lineRes; - parseContext.setCurrentLine(lineRes); + _parseContext.setCurrentLine(lineRes); if (token != '\n') { if (token == PpAtomConstString) { - parseContext.ppRequireExtensions(directiveLoc, 1, &E_GL_GOOGLE_cpp_style_line_directive, "filename-based #line"); + _parseContext.ppRequireExtensions(directiveLoc, 1, &E_GL_GOOGLE_cpp_style_line_directive, "filename-based #line"); // We need to save a copy of the string instead of pointing // to the name field of the token since the name field // will likely be overwritten by the next token scan. sourceName = GetAtomString(LookUpAddString(ppToken->name)); - parseContext.setCurrentSourceName(sourceName); + _parseContext.setCurrentSourceName(sourceName); hasFile = true; token = scanToken(ppToken); } else { token = eval(token, MIN_PRECEDENCE, false, fileRes, fileErr, ppToken); if (! fileErr) { - parseContext.setCurrentString(fileRes); + _parseContext.setCurrentString(fileRes); hasFile = true; } } } } if (!fileErr && !lineErr) { - parseContext.notifyLineDirective(directiveLoc.line, lineToken, hasFile, fileRes, sourceName); + _parseContext.notifyLineDirective(directiveLoc.line, lineToken, hasFile, fileRes, sourceName); } token = extraTokenCheck(PpAtomLine, ppToken, token); @@ -718,9 +718,9 @@ int TPpContext::CPPerror(TPpToken* ppToken) message.append(" "); token = scanToken(ppToken); } - parseContext.notifyErrorDirective(loc.line, message.c_str()); + _parseContext.notifyErrorDirective(loc.line, message.c_str()); //store this msg into the shader's information log..set the Compile Error flag!!!! - parseContext.ppError(loc, message.c_str(), "#error", ""); + _parseContext.ppError(loc, message.c_str(), "#error", ""); return '\n'; } @@ -756,9 +756,9 @@ int TPpContext::CPPpragma(TPpToken* ppToken) } if (token == EndOfInput) - parseContext.ppError(loc, "directive must end with a newline", "#pragma", ""); + _parseContext.ppError(loc, "directive must end with a newline", "#pragma", ""); else - parseContext.handlePragma(loc, tokens); + _parseContext.handlePragma(loc, tokens); return token; } @@ -769,17 +769,17 @@ int TPpContext::CPPversion(TPpToken* ppToken) int token = scanToken(ppToken); if (errorOnVersion || versionSeen) - parseContext.ppError(ppToken->loc, "must occur first in shader", "#version", ""); + _parseContext.ppError(ppToken->loc, "must occur first in shader", "#version", ""); versionSeen = true; if (token == '\n') { - parseContext.ppError(ppToken->loc, "must be followed by version number", "#version", ""); + _parseContext.ppError(ppToken->loc, "must be followed by version number", "#version", ""); return token; } if (token != PpAtomConstInt) - parseContext.ppError(ppToken->loc, "must be followed by version number", "#version", ""); + _parseContext.ppError(ppToken->loc, "must be followed by version number", "#version", ""); ppToken->ival = atoi(ppToken->name); int versionNumber = ppToken->ival; @@ -787,20 +787,20 @@ int TPpContext::CPPversion(TPpToken* ppToken) token = scanToken(ppToken); if (token == '\n') { - parseContext.notifyVersion(line, versionNumber, nullptr); + _parseContext.notifyVersion(line, versionNumber, nullptr); return token; } else { if (ppToken->atom != PpAtomCore && ppToken->atom != PpAtomCompatibility && ppToken->atom != PpAtomEs) - parseContext.ppError(ppToken->loc, "bad profile name; use es, core, or compatibility", "#version", ""); - parseContext.notifyVersion(line, versionNumber, ppToken->name); + _parseContext.ppError(ppToken->loc, "bad profile name; use es, core, or compatibility", "#version", ""); + _parseContext.notifyVersion(line, versionNumber, ppToken->name); token = scanToken(ppToken); if (token == '\n') return token; else - parseContext.ppError(ppToken->loc, "bad tokens following profile -- expected newline", "#version", ""); + _parseContext.ppError(ppToken->loc, "bad tokens following profile -- expected newline", "#version", ""); } return token; @@ -814,36 +814,36 @@ int TPpContext::CPPextension(TPpToken* ppToken) char extensionName[MaxTokenLength + 1]; if (token=='\n') { - parseContext.ppError(ppToken->loc, "extension name not specified", "#extension", ""); + _parseContext.ppError(ppToken->loc, "extension name not specified", "#extension", ""); return token; } if (token != PpAtomIdentifier) - parseContext.ppError(ppToken->loc, "extension name expected", "#extension", ""); + _parseContext.ppError(ppToken->loc, "extension name expected", "#extension", ""); assert(strlen(ppToken->name) <= MaxTokenLength); strcpy(extensionName, ppToken->name); token = scanToken(ppToken); if (token != ':') { - parseContext.ppError(ppToken->loc, "':' missing after extension name", "#extension", ""); + _parseContext.ppError(ppToken->loc, "':' missing after extension name", "#extension", ""); return token; } token = scanToken(ppToken); if (token != PpAtomIdentifier) { - parseContext.ppError(ppToken->loc, "behavior for extension not specified", "#extension", ""); + _parseContext.ppError(ppToken->loc, "behavior for extension not specified", "#extension", ""); return token; } - parseContext.updateExtensionBehavior(line, extensionName, ppToken->name); - parseContext.notifyExtensionDirective(line, extensionName, ppToken->name); + _parseContext.updateExtensionBehavior(line, extensionName, ppToken->name); + _parseContext.notifyExtensionDirective(line, extensionName, ppToken->name); token = scanToken(ppToken); if (token == '\n') return token; else - parseContext.ppError(ppToken->loc, "extra tokens -- expected newline", "#extension",""); + _parseContext.ppError(ppToken->loc, "extra tokens -- expected newline", "#extension",""); return token; } @@ -859,18 +859,18 @@ int TPpContext::readCPPline(TPpToken* ppToken) break; case PpAtomElse: if (elsetracker[elseSeen]) - parseContext.ppError(ppToken->loc, "#else after #else", "#else", ""); + _parseContext.ppError(ppToken->loc, "#else after #else", "#else", ""); elsetracker[elseSeen] = true; if (! ifdepth) - parseContext.ppError(ppToken->loc, "mismatched statements", "#else", ""); + _parseContext.ppError(ppToken->loc, "mismatched statements", "#else", ""); token = extraTokenCheck(PpAtomElse, ppToken, scanToken(ppToken)); token = CPPelse(0, ppToken); break; case PpAtomElif: if (! ifdepth) - parseContext.ppError(ppToken->loc, "mismatched statements", "#elif", ""); + _parseContext.ppError(ppToken->loc, "mismatched statements", "#elif", ""); if (elseSeen[elsetracker]) - parseContext.ppError(ppToken->loc, "#elif after #else", "#elif", ""); + _parseContext.ppError(ppToken->loc, "#elif after #else", "#elif", ""); // this token is really a dont care, but we still need to eat the tokens token = scanToken(ppToken); while (token != '\n' && token != EndOfInput) @@ -879,7 +879,7 @@ int TPpContext::readCPPline(TPpToken* ppToken) break; case PpAtomEndif: if (! ifdepth) - parseContext.ppError(ppToken->loc, "mismatched statements", "#endif", ""); + _parseContext.ppError(ppToken->loc, "mismatched statements", "#endif", ""); else { elseSeen[elsetracker] = false; --elsetracker; @@ -897,8 +897,8 @@ int TPpContext::readCPPline(TPpToken* ppToken) token = CPPifdef(0, ppToken); break; case PpAtomInclude: - if(!parseContext.isReadingHLSL()) { - parseContext.ppRequireExtensions(ppToken->loc, 1, &E_GL_GOOGLE_include_directive, "#include"); + if(!_parseContext.isReadingHLSL()) { + _parseContext.ppRequireExtensions(ppToken->loc, 1, &E_GL_GOOGLE_include_directive, "#include"); } token = CPPinclude(ppToken); break; @@ -921,11 +921,11 @@ int TPpContext::readCPPline(TPpToken* ppToken) token = CPPextension(ppToken); break; default: - parseContext.ppError(ppToken->loc, "invalid directive:", "#", ppToken->name); + _parseContext.ppError(ppToken->loc, "invalid directive:", "#", ppToken->name); break; } } else if (token != '\n' && token != EndOfInput) - parseContext.ppError(ppToken->loc, "invalid directive", "#", ""); + _parseContext.ppError(ppToken->loc, "invalid directive", "#", ""); while (token != '\n' && token != EndOfInput) token = scanToken(ppToken); @@ -1017,22 +1017,22 @@ int TPpContext::MacroExpand(int atom, TPpToken* ppToken, bool expandUndef, bool ppToken->space = false; switch (atom) { case PpAtomLineMacro: - ppToken->ival = parseContext.getCurrentLoc().line; + ppToken->ival = _parseContext.getCurrentLoc().line; snprintf(ppToken->name, sizeof(ppToken->name), "%d", ppToken->ival); UngetToken(PpAtomConstInt, ppToken); return 1; case PpAtomFileMacro: { - if (parseContext.getCurrentLoc().name) - parseContext.ppRequireExtensions(ppToken->loc, 1, &E_GL_GOOGLE_cpp_style_line_directive, "filename-based __FILE__"); - ppToken->ival = parseContext.getCurrentLoc().string; + if (_parseContext.getCurrentLoc().name) + _parseContext.ppRequireExtensions(ppToken->loc, 1, &E_GL_GOOGLE_cpp_style_line_directive, "filename-based __FILE__"); + ppToken->ival = _parseContext.getCurrentLoc().string; snprintf(ppToken->name, sizeof(ppToken->name), "%s", ppToken->loc.getStringNameOrNum().c_str()); UngetToken(PpAtomConstInt, ppToken); return 1; } case PpAtomVersionMacro: - ppToken->ival = parseContext.version; + ppToken->ival = _parseContext.version; snprintf(ppToken->name, sizeof(ppToken->name), "%d", ppToken->ival); UngetToken(PpAtomConstInt, ppToken); return 1; @@ -1070,7 +1070,7 @@ int TPpContext::MacroExpand(int atom, TPpToken* ppToken, bool expandUndef, bool token = scanToken(ppToken); } if (token != '(') { - parseContext.ppError(loc, "expected '(' following", "macro expansion", GetAtomString(atom)); + _parseContext.ppError(loc, "expected '(' following", "macro expansion", GetAtomString(atom)); UngetToken(token, ppToken); ppToken->atom = atom; @@ -1087,20 +1087,20 @@ int TPpContext::MacroExpand(int atom, TPpToken* ppToken, bool expandUndef, bool while (1) { token = scanToken(ppToken); if (token == EndOfInput) { - parseContext.ppError(loc, "End of input in macro", "macro expansion", GetAtomString(atom)); + _parseContext.ppError(loc, "End of input in macro", "macro expansion", GetAtomString(atom)); delete in; return 0; } if (token == '\n') { if (! newLineOkay) { - parseContext.ppError(loc, "End of line in macro substitution:", "macro expansion", GetAtomString(atom)); + _parseContext.ppError(loc, "End of line in macro substitution:", "macro expansion", GetAtomString(atom)); delete in; return 0; } continue; } if (token == '#') { - parseContext.ppError(ppToken->loc, "unexpected '#'", "macro expansion", GetAtomString(atom)); + _parseContext.ppError(ppToken->loc, "unexpected '#'", "macro expansion", GetAtomString(atom)); delete in; return 0; } @@ -1125,7 +1125,7 @@ int TPpContext::MacroExpand(int atom, TPpToken* ppToken, bool expandUndef, bool } while (arg < in->mac->argc); if (arg < in->mac->argc) - parseContext.ppError(loc, "Too few args in Macro", "macro expansion", GetAtomString(atom)); + _parseContext.ppError(loc, "Too few args in Macro", "macro expansion", GetAtomString(atom)); else if (token != ')') { depth=0; while (token != EndOfInput && (depth > 0 || token != ')')) { @@ -1137,11 +1137,11 @@ int TPpContext::MacroExpand(int atom, TPpToken* ppToken, bool expandUndef, bool } if (token == EndOfInput) { - parseContext.ppError(loc, "End of input in macro", "macro expansion", GetAtomString(atom)); + _parseContext.ppError(loc, "End of input in macro", "macro expansion", GetAtomString(atom)); delete in; return 0; } - parseContext.ppError(loc, "Too many args in macro", "macro expansion", GetAtomString(atom)); + _parseContext.ppError(loc, "Too many args in macro", "macro expansion", GetAtomString(atom)); } for (int i = 0; i < in->mac->argc; i++) in->args[i] = PrescanMacroArg(in->args[i], ppToken, newLineOkay); diff --git a/deps/glslang/glslang/glslang/MachineIndependent/preprocessor/PpContext.cpp b/deps/glslang/glslang/glslang/MachineIndependent/preprocessor/PpContext.cpp index 6791fef599..c0bbda814c 100644 --- a/deps/glslang/glslang/glslang/MachineIndependent/preprocessor/PpContext.cpp +++ b/deps/glslang/glslang/glslang/MachineIndependent/preprocessor/PpContext.cpp @@ -83,7 +83,7 @@ NVIDIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. namespace glslang { TPpContext::TPpContext(TParseContextBase& pc, const std::string& rootFileName, TShader::Includer& inclr) : - preamble(0), strings(0), parseContext(pc), includer(inclr), inComment(false), + preamble(0), strings(0), _parseContext(pc), includer(inclr), inComment(false), rootFileName(rootFileName), currentSourceFile(rootFileName) { diff --git a/deps/glslang/glslang/glslang/MachineIndependent/preprocessor/PpContext.h b/deps/glslang/glslang/glslang/MachineIndependent/preprocessor/PpContext.h index f1c2f31108..dcd858efab 100644 --- a/deps/glslang/glslang/glslang/MachineIndependent/preprocessor/PpContext.h +++ b/deps/glslang/glslang/glslang/MachineIndependent/preprocessor/PpContext.h @@ -215,7 +215,7 @@ protected: // Scanner data: int previous_token; - TParseContextBase& parseContext; + TParseContextBase& _parseContext; // Get the next token from *stack* of input sources, popping input sources // that are out of tokens, down until an input source is found that has a token. @@ -372,7 +372,7 @@ protected: // Move past escaped newlines, as many as sequentially exist do { if (input->peek() == '\r' || input->peek() == '\n') { - bool allowed = pp->parseContext.lineContinuationCheck(input->getSourceLoc(), pp->inComment); + bool allowed = pp->_parseContext.lineContinuationCheck(input->getSourceLoc(), pp->inComment); if (! allowed && pp->inComment) return '\\'; @@ -475,14 +475,14 @@ protected: void notifyActivated() override { - prevScanner = pp->parseContext.getScanner(); - pp->parseContext.setScanner(&scanner); + prevScanner = pp->_parseContext.getScanner(); + pp->_parseContext.setScanner(&scanner); pp->push_include(includedFile_); } void notifyDeleted() override { - pp->parseContext.setScanner(prevScanner); + pp->_parseContext.setScanner(prevScanner); pp->pop_include(); } diff --git a/deps/glslang/glslang/glslang/MachineIndependent/preprocessor/PpScanner.cpp b/deps/glslang/glslang/glslang/MachineIndependent/preprocessor/PpScanner.cpp index 518dbdee4c..0113532dc4 100644 --- a/deps/glslang/glslang/glslang/MachineIndependent/preprocessor/PpScanner.cpp +++ b/deps/glslang/glslang/glslang/MachineIndependent/preprocessor/PpScanner.cpp @@ -140,7 +140,7 @@ int TPpContext::lFloatConst(int len, int ch, TPpToken* ppToken) } ch = getChar(); } else { - parseContext.ppError(ppToken->loc, "float literal too long", "", ""); + _parseContext.ppError(ppToken->loc, "float literal too long", "", ""); len = 1; str_len = 1; } @@ -152,7 +152,7 @@ int TPpContext::lFloatConst(int len, int ch, TPpToken* ppToken) if (ch == 'e' || ch == 'E') { HasDecimalOrExponent = true; if (len >= MaxTokenLength) { - parseContext.ppError(ppToken->loc, "float literal too long", "", ""); + _parseContext.ppError(ppToken->loc, "float literal too long", "", ""); len = 1; str_len = 1; } else { @@ -171,13 +171,13 @@ int TPpContext::lFloatConst(int len, int ch, TPpToken* ppToken) str[len++] = (char)ch; ch = getChar(); } else { - parseContext.ppError(ppToken->loc, "float literal too long", "", ""); + _parseContext.ppError(ppToken->loc, "float literal too long", "", ""); len = 1; str_len = 1; } } } else { - parseContext.ppError(ppToken->loc, "bad character in float exponent", "", ""); + _parseContext.ppError(ppToken->loc, "bad character in float exponent", "", ""); } } } @@ -187,9 +187,9 @@ int TPpContext::lFloatConst(int len, int ch, TPpToken* ppToken) strcpy(str, "0.0"); } else { if (ch == 'l' || ch == 'L') { - parseContext.doubleCheck(ppToken->loc, "double floating-point suffix"); + _parseContext.doubleCheck(ppToken->loc, "double floating-point suffix"); if (! HasDecimalOrExponent) - parseContext.ppError(ppToken->loc, "float literal needs a decimal point or exponent", "", ""); + _parseContext.ppError(ppToken->loc, "float literal needs a decimal point or exponent", "", ""); int ch2 = getChar(); if (ch2 != 'f' && ch2 != 'F') { ungetChar(); @@ -200,7 +200,7 @@ int TPpContext::lFloatConst(int len, int ch, TPpToken* ppToken) str[len++] = (char)ch2; isDouble = 1; } else { - parseContext.ppError(ppToken->loc, "float literal too long", "", ""); + _parseContext.ppError(ppToken->loc, "float literal too long", "", ""); len = 1,str_len=1; } } @@ -227,15 +227,15 @@ int TPpContext::lFloatConst(int len, int ch, TPpToken* ppToken) } #endif } else if (ch == 'f' || ch == 'F') { - parseContext.profileRequires(ppToken->loc, EEsProfile, 300, nullptr, "floating-point suffix"); - if (! parseContext.relaxedErrors()) - parseContext.profileRequires(ppToken->loc, ~EEsProfile, 120, nullptr, "floating-point suffix"); + _parseContext.profileRequires(ppToken->loc, EEsProfile, 300, nullptr, "floating-point suffix"); + if (!_parseContext.relaxedErrors()) + _parseContext.profileRequires(ppToken->loc, ~EEsProfile, 120, nullptr, "floating-point suffix"); if (! HasDecimalOrExponent) - parseContext.ppError(ppToken->loc, "float literal needs a decimal point or exponent", "", ""); + _parseContext.ppError(ppToken->loc, "float literal needs a decimal point or exponent", "", ""); if (len < MaxTokenLength) str[len++] = (char)ch; else { - parseContext.ppError(ppToken->loc, "float literal too long", "", ""); + _parseContext.ppError(ppToken->loc, "float literal too long", "", ""); len = 1,str_len=1; } } else @@ -267,7 +267,7 @@ int TPpContext::tStringInput::scan(TPpToken* ppToken) int ch = 0; int ii = 0; unsigned long long ival = 0; - bool enableInt64 = pp->parseContext.version >= 450 && pp->parseContext.extensionTurnedOn(E_GL_ARB_gpu_shader_int64); + bool enableInt64 = pp->_parseContext.version >= 450 && pp->_parseContext.extensionTurnedOn(E_GL_ARB_gpu_shader_int64); ppToken->ival = 0; ppToken->i64val = 0; @@ -279,7 +279,7 @@ int TPpContext::tStringInput::scan(TPpToken* ppToken) ch = getch(); } - ppToken->loc = pp->parseContext.getCurrentLoc(); + ppToken->loc = pp->_parseContext.getCurrentLoc(); len = 0; switch (ch) { default: @@ -304,7 +304,7 @@ int TPpContext::tStringInput::scan(TPpToken* ppToken) ch = getch(); } else { if (! AlreadyComplained) { - pp->parseContext.ppError(ppToken->loc, "name too long", "", ""); + pp->_parseContext.ppError(ppToken->loc, "name too long", "", ""); AlreadyComplained = 1; } ch = getch(); @@ -347,11 +347,11 @@ int TPpContext::tStringInput::scan(TPpToken* ppToken) } else if (ch >= 'a' && ch <= 'f') { ii = ch - 'a' + 10; } else - pp->parseContext.ppError(ppToken->loc, "bad digit in hexadecimal literal", "", ""); + pp->_parseContext.ppError(ppToken->loc, "bad digit in hexadecimal literal", "", ""); ival = (ival << 4) | ii; } else { if (! AlreadyComplained) { - pp->parseContext.ppError(ppToken->loc, "hexadecimal literal too big", "", ""); + pp->_parseContext.ppError(ppToken->loc, "hexadecimal literal too big", "", ""); AlreadyComplained = 1; } ival = 0xffffffffffffffffull; @@ -361,7 +361,7 @@ int TPpContext::tStringInput::scan(TPpToken* ppToken) (ch >= 'A' && ch <= 'F') || (ch >= 'a' && ch <= 'f')); } else { - pp->parseContext.ppError(ppToken->loc, "bad digit in hexadecimal literal", "", ""); + pp->_parseContext.ppError(ppToken->loc, "bad digit in hexadecimal literal", "", ""); } if (ch == 'u' || ch == 'U') { if (len < MaxTokenLength) @@ -407,7 +407,7 @@ int TPpContext::tStringInput::scan(TPpToken* ppToken) if (len < MaxTokenLength) ppToken->name[len++] = (char)ch; else if (! AlreadyComplained) { - pp->parseContext.ppError(ppToken->loc, "numeric literal too long", "", ""); + pp->_parseContext.ppError(ppToken->loc, "numeric literal too long", "", ""); AlreadyComplained = 1; } if (ival <= 0x1fffffff || (enableInt64 && ival <= 0x1fffffffffffffffull)) { @@ -425,7 +425,7 @@ int TPpContext::tStringInput::scan(TPpToken* ppToken) if (len < MaxTokenLength) ppToken->name[len++] = (char)ch; else if (! AlreadyComplained) { - pp->parseContext.ppError(ppToken->loc, "numeric literal too long", "", ""); + pp->_parseContext.ppError(ppToken->loc, "numeric literal too long", "", ""); AlreadyComplained = 1; } ch = getch(); @@ -436,7 +436,7 @@ int TPpContext::tStringInput::scan(TPpToken* ppToken) // wasn't a float, so must be octal... if (nonOctal) - pp->parseContext.ppError(ppToken->loc, "octal literal digit too large", "", ""); + pp->_parseContext.ppError(ppToken->loc, "octal literal digit too large", "", ""); if (ch == 'u' || ch == 'U') { if (len < MaxTokenLength) @@ -462,7 +462,7 @@ int TPpContext::tStringInput::scan(TPpToken* ppToken) ppToken->name[len] = '\0'; if (octalOverflow) - pp->parseContext.ppError(ppToken->loc, "octal literal too big", "", ""); + pp->_parseContext.ppError(ppToken->loc, "octal literal too big", "", ""); if (isInt64) { ppToken->i64val = ival; @@ -481,7 +481,7 @@ int TPpContext::tStringInput::scan(TPpToken* ppToken) if (len < MaxTokenLength) ppToken->name[len++] = (char)ch; else if (! AlreadyComplained) { - pp->parseContext.ppError(ppToken->loc, "numeric literal too long", "", ""); + pp->_parseContext.ppError(ppToken->loc, "numeric literal too long", "", ""); AlreadyComplained = 1; } ch = getch(); @@ -524,7 +524,7 @@ int TPpContext::tStringInput::scan(TPpToken* ppToken) ch = ppToken->name[i] - '0'; if ((enableInt64 == false && ((ival > oneTenthMaxInt) || (ival == oneTenthMaxInt && (unsigned)ch > remainderMaxInt))) || (enableInt64 && ((ival > oneTenthMaxInt64) || (ival == oneTenthMaxInt64 && (unsigned long long)ch > remainderMaxInt64)))) { - pp->parseContext.ppError(ppToken->loc, "numeric literal too big", "", ""); + pp->_parseContext.ppError(ppToken->loc, "numeric literal too big", "", ""); ival = 0xFFFFFFFFFFFFFFFFull; break; } else @@ -682,14 +682,14 @@ int TPpContext::tStringInput::scan(TPpToken* ppToken) do { while (ch != '*') { if (ch == EndOfInput) { - pp->parseContext.ppError(ppToken->loc, "End of input in comment", "comment", ""); + pp->_parseContext.ppError(ppToken->loc, "End of input in comment", "comment", ""); return ch; } ch = getch(); } ch = getch(); if (ch == EndOfInput) { - pp->parseContext.ppError(ppToken->loc, "End of input in comment", "comment", ""); + pp->_parseContext.ppError(ppToken->loc, "End of input in comment", "comment", ""); return ch; } } while (ch != '/'); @@ -716,7 +716,7 @@ int TPpContext::tStringInput::scan(TPpToken* ppToken) tokenText[len] = '\0'; if (ch != '"') { ungetch(); - pp->parseContext.ppError(ppToken->loc, "End of line in string", "string", ""); + pp->_parseContext.ppError(ppToken->loc, "End of line in string", "string", ""); } return PpAtomConstString; } @@ -752,7 +752,7 @@ const char* TPpContext::tokenize(TPpToken* ppToken) } continue; } else { - parseContext.ppError(ppToken->loc, "preprocessor directive cannot be preceded by another token", "#", ""); + _parseContext.ppError(ppToken->loc, "preprocessor directive cannot be preceded by another token", "#", ""); return nullptr; } } @@ -780,15 +780,15 @@ const char* TPpContext::tokenize(TPpToken* ppToken) tokenString = ppToken->name; break; case PpAtomConstString: - if (parseContext.intermediate.getSource() == EShSourceHlsl) { + if (_parseContext.intermediate.getSource() == EShSourceHlsl) { // HLSL allows string literals. tokenString = ppToken->name; } else { - parseContext.ppError(ppToken->loc, "string literals not supported", "\"\"", ""); + _parseContext.ppError(ppToken->loc, "string literals not supported", "\"\"", ""); } break; case '\'': - parseContext.ppError(ppToken->loc, "character literals not supported", "\'", ""); + _parseContext.ppError(ppToken->loc, "character literals not supported", "\'", ""); break; default: tokenString = GetAtomString(token); @@ -804,7 +804,7 @@ const char* TPpContext::tokenize(TPpToken* ppToken) void TPpContext::missingEndifCheck() { if (ifdepth > 0) - parseContext.ppError(parseContext.getCurrentLoc(), "missing #endif", "", ""); + _parseContext.ppError(_parseContext.getCurrentLoc(), "missing #endif", "", ""); } } // end namespace glslang diff --git a/deps/glslang/glslang/glslang/MachineIndependent/preprocessor/PpTokens.cpp b/deps/glslang/glslang/glslang/MachineIndependent/preprocessor/PpTokens.cpp index 23b617d37c..25e1720c0d 100644 --- a/deps/glslang/glslang/glslang/MachineIndependent/preprocessor/PpTokens.cpp +++ b/deps/glslang/glslang/glslang/MachineIndependent/preprocessor/PpTokens.cpp @@ -177,7 +177,7 @@ int TPpContext::ReadToken(TokenStream *pTok, TPpToken *ppToken) int ch; ltoken = lReadByte(pTok); - ppToken->loc = parseContext.getCurrentLoc(); + ppToken->loc = _parseContext.getCurrentLoc(); if (ltoken > 127) ltoken += 128; switch (ltoken) { @@ -185,9 +185,9 @@ int TPpContext::ReadToken(TokenStream *pTok, TPpToken *ppToken) // Check for ##, unless the current # is the last character if (pTok->current < pTok->data.size()) { if (lReadByte(pTok) == '#') { - parseContext.requireProfile(ppToken->loc, ~EEsProfile, "token pasting (##)"); - parseContext.profileRequires(ppToken->loc, ~EEsProfile, 130, 0, "token pasting (##)"); - parseContext.error(ppToken->loc, "token pasting not implemented (internal error)", "##", ""); + _parseContext.requireProfile(ppToken->loc, ~EEsProfile, "token pasting (##)"); + _parseContext.profileRequires(ppToken->loc, ~EEsProfile, 130, 0, "token pasting (##)"); + _parseContext.error(ppToken->loc, "token pasting not implemented (internal error)", "##", ""); //return PpAtomPaste; return ReadToken(pTok, ppToken); } else @@ -213,7 +213,7 @@ int TPpContext::ReadToken(TokenStream *pTok, TPpToken *ppToken) len++; ch = lReadByte(pTok); } else { - parseContext.error(ppToken->loc, "token too long", "", ""); + _parseContext.error(ppToken->loc, "token too long", "", ""); break; } } diff --git a/deps/glslang/glslang/glslang/OSDependent/Windows/ossource.cpp b/deps/glslang/glslang/glslang/OSDependent/Windows/ossource.cpp index f71fac9cb6..2edde83870 100644 --- a/deps/glslang/glslang/glslang/OSDependent/Windows/ossource.cpp +++ b/deps/glslang/glslang/glslang/OSDependent/Windows/ossource.cpp @@ -31,9 +31,9 @@ //ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE //POSSIBILITY OF SUCH DAMAGE. // - #include "../osinclude.h" +#undef STRICT #define STRICT #define VC_EXTRALEAN 1 #include diff --git a/deps/glslang/glslang/hlsl/hlslGrammar.cpp b/deps/glslang/glslang/hlsl/hlslGrammar.cpp index e676e95e10..c9152e2a14 100755 --- a/deps/glslang/glslang/hlsl/hlslGrammar.cpp +++ b/deps/glslang/glslang/hlsl/hlslGrammar.cpp @@ -67,12 +67,12 @@ bool HlslGrammar::parse() void HlslGrammar::expected(const char* syntax) { - parseContext.error(token.loc, "Expected", syntax, ""); + _parseContext.error(token.loc, "Expected", syntax, ""); } void HlslGrammar::unimplemented(const char* error) { - parseContext.error(token.loc, "Unimplemented", error, ""); + _parseContext.error(token.loc, "Unimplemented", error, ""); } // Only process the next token if it is an identifier. @@ -154,7 +154,7 @@ bool HlslGrammar::acceptSamplerState() if (! acceptTokenClass(EHTokLeftBrace)) return true; - parseContext.warn(token.loc, "unimplemented", "immediate sampler state", ""); + _parseContext.warn(token.loc, "unimplemented", "immediate sampler state", ""); do { // read state name @@ -311,7 +311,7 @@ bool HlslGrammar::acceptDeclaration(TIntermNode*& node) TString* fnName = idToken.string; // Potentially rename shader entry point function. No-op most of the time. - parseContext.renameShaderFunction(fnName); + _parseContext.renameShaderFunction(fnName); // function_parameters TFunction& function = *new TFunction(fnName, declaredType); @@ -322,18 +322,18 @@ bool HlslGrammar::acceptDeclaration(TIntermNode*& node) // compound_statement (function body definition) or just a prototype? if (peekTokenClass(EHTokLeftBrace)) { if (list) - parseContext.error(idToken.loc, "function body can't be in a declarator list", "{", ""); + _parseContext.error(idToken.loc, "function body can't be in a declarator list", "{", ""); if (typedefDecl) - parseContext.error(idToken.loc, "function body can't be in a typedef", "{", ""); + _parseContext.error(idToken.loc, "function body can't be in a typedef", "{", ""); return acceptFunctionDefinition(function, node, attributes); } else { if (typedefDecl) - parseContext.error(idToken.loc, "function typedefs not implemented", "{", ""); - parseContext.handleFunctionDeclarator(idToken.loc, function, true); + _parseContext.error(idToken.loc, "function typedefs not implemented", "{", ""); + _parseContext.handleFunctionDeclarator(idToken.loc, function, true); } } else { // A variable declaration. Fix the storage qualifier if it's a global. - if (declaredType.getQualifier().storage == EvqTemporary && parseContext.symbolTable.atGlobalLevel()) + if (declaredType.getQualifier().storage == EvqTemporary && _parseContext.symbolTable.atGlobalLevel()) declaredType.getQualifier().storage = EvqUniform; // We can handle multiple variables per type declaration, so @@ -356,7 +356,7 @@ bool HlslGrammar::acceptDeclaration(TIntermNode*& node) // In the most general case, arrayness is potentially coming both from the // declared type and from the variable: "int[] a[];" or just one or the other. // Merge it all to the variableType, so all arrayness is part of the variableType. - parseContext.arrayDimMerge(variableType, arraySizes); + _parseContext.arrayDimMerge(variableType, arraySizes); } // samplers accept immediate sampler state @@ -372,7 +372,7 @@ bool HlslGrammar::acceptDeclaration(TIntermNode*& node) TIntermTyped* expressionNode = nullptr; if (acceptTokenClass(EHTokAssign)) { if (typedefDecl) - parseContext.error(idToken.loc, "can't have an initializer", "typedef", ""); + _parseContext.error(idToken.loc, "can't have an initializer", "typedef", ""); if (! acceptAssignmentExpression(expressionNode)) { expected("initializer"); return false; @@ -383,21 +383,21 @@ bool HlslGrammar::acceptDeclaration(TIntermNode*& node) // TODO: things scoped within an annotation need their own name space; // TODO: strings are not yet handled. - if (variableType.getBasicType() != EbtString && parseContext.getAnnotationNestingLevel() == 0) { + if (variableType.getBasicType() != EbtString && _parseContext.getAnnotationNestingLevel() == 0) { if (typedefDecl) - parseContext.declareTypedef(idToken.loc, *idToken.string, variableType); + _parseContext.declareTypedef(idToken.loc, *idToken.string, variableType); else if (variableType.getBasicType() == EbtBlock) - parseContext.declareBlock(idToken.loc, variableType, idToken.string); + _parseContext.declareBlock(idToken.loc, variableType, idToken.string); else { if (variableType.getQualifier().storage == EvqUniform && ! variableType.containsOpaque()) { // this isn't really an individual variable, but a member of the $Global buffer - parseContext.growGlobalUniformBlock(idToken.loc, variableType, *idToken.string); + _parseContext.growGlobalUniformBlock(idToken.loc, variableType, *idToken.string); } else { // Declare the variable and add any initializer code to the AST. // The top-level node is always made into an aggregate, as that's // historically how the AST has been. node = intermediate.growAggregate(node, - parseContext.declareVariable(idToken.loc, *idToken.string, variableType, + _parseContext.declareVariable(idToken.loc, *idToken.string, variableType, expressionNode), idToken.loc); } @@ -456,7 +456,7 @@ bool HlslGrammar::acceptControlDeclaration(TIntermNode*& node) return false; } - node = parseContext.declareVariable(idToken.loc, *idToken.string, type, expressionNode); + node = _parseContext.declareVariable(idToken.loc, *idToken.string, type, expressionNode); return true; } @@ -479,10 +479,10 @@ bool HlslGrammar::acceptFullySpecifiedType(TType& type) return false; if (type.getBasicType() == EbtBlock) { // the type was a block, which set some parts of the qualifier - parseContext.mergeQualifiers(type.getQualifier(), qualifier); + _parseContext.mergeQualifiers(type.getQualifier(), qualifier); // further, it can create an anonymous instance of the block if (peekTokenClass(EHTokSemicolon)) - parseContext.declareBlock(loc, type); + _parseContext.declareBlock(loc, type); } else { // Some qualifiers are set when parsing the type. Merge those with // whatever comes from acceptQualifier. @@ -510,7 +510,7 @@ bool HlslGrammar::acceptQualifier(TQualifier& qualifier) do { switch (peek()) { case EHTokStatic: - qualifier.storage = parseContext.symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary; + qualifier.storage = _parseContext.symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary; break; case EHTokExtern: // TODO: no meaning in glslang? @@ -572,27 +572,27 @@ bool HlslGrammar::acceptQualifier(TQualifier& qualifier) // for output variables. case EHTokPoint: qualifier.storage = EvqIn; - if (!parseContext.handleInputGeometry(token.loc, ElgPoints)) + if (!_parseContext.handleInputGeometry(token.loc, ElgPoints)) return false; break; case EHTokLine: qualifier.storage = EvqIn; - if (!parseContext.handleInputGeometry(token.loc, ElgLines)) + if (!_parseContext.handleInputGeometry(token.loc, ElgLines)) return false; break; case EHTokTriangle: qualifier.storage = EvqIn; - if (!parseContext.handleInputGeometry(token.loc, ElgTriangles)) + if (!_parseContext.handleInputGeometry(token.loc, ElgTriangles)) return false; break; case EHTokLineAdj: qualifier.storage = EvqIn; - if (!parseContext.handleInputGeometry(token.loc, ElgLinesAdjacency)) + if (!_parseContext.handleInputGeometry(token.loc, ElgLinesAdjacency)) return false; break; case EHTokTriangleAdj: qualifier.storage = EvqIn; - if (!parseContext.handleInputGeometry(token.loc, ElgTrianglesAdjacency)) + if (!_parseContext.handleInputGeometry(token.loc, ElgTrianglesAdjacency)) return false; break; @@ -634,9 +634,9 @@ bool HlslGrammar::acceptLayoutQualifierList(TQualifier& qualifier) expected("expression"); return false; } - parseContext.setLayoutQualifier(idToken.loc, qualifier, *idToken.string, expr); + _parseContext.setLayoutQualifier(idToken.loc, qualifier, *idToken.string, expr); } else - parseContext.setLayoutQualifier(idToken.loc, qualifier, *idToken.string); + _parseContext.setLayoutQualifier(idToken.loc, qualifier, *idToken.string); // COMMA if (! acceptTokenClass(EHTokComma)) @@ -864,7 +864,7 @@ bool HlslGrammar::acceptAnnotations(TQualifier&) return false; // note that we are nesting a name space - parseContext.nestAnnotations(); + _parseContext.nestAnnotations(); // declaration SEMI_COLON ... declaration SEMICOLON RIGHT_ANGLE do { @@ -883,7 +883,7 @@ bool HlslGrammar::acceptAnnotations(TQualifier&) } } while (true); - parseContext.unnestAnnotations(); + _parseContext.unnestAnnotations(); return true; } @@ -1045,7 +1045,7 @@ bool HlslGrammar::acceptTextureType(TType& type) // Buffer, RWBuffer and RWTexture (images) require a TLayoutFormat. We handle only a limit set. if (image || dim == EsdBuffer) - format = parseContext.getLayoutFromTxType(token.loc, txType); + format = _parseContext.getLayoutFromTxType(token.loc, txType); // Non-image Buffers are combined if (dim == EsdBuffer && !image) { @@ -1099,7 +1099,7 @@ bool HlslGrammar::acceptType(TType& type) if (! acceptStreamOutTemplateType(type, geometry)) return false; - if (! parseContext.handleOutputGeometry(token.loc, geometry)) + if (!_parseContext.handleOutputGeometry(token.loc, geometry)) return false; return true; @@ -1144,7 +1144,7 @@ bool HlslGrammar::acceptType(TType& type) // An identifier could be for a user-defined type. // Note we cache the symbol table lookup, to save for a later rule // when this is not a type. - token.symbol = parseContext.symbolTable.find(*token.string); + token.symbol = _parseContext.symbolTable.find(*token.string); if (token.symbol && token.symbol->getAsVariable() && token.symbol->getAsVariable()->isUserType()) { type.shallowCopy(token.symbol->getType()); advanceToken(); @@ -1655,8 +1655,8 @@ bool HlslGrammar::acceptStruct(TType& type) // case the name is not a type.) if (type.getBasicType() != EbtBlock && structName.size() > 0) { TVariable* userTypeDef = new TVariable(&structName, type, true); - if (! parseContext.symbolTable.insert(*userTypeDef)) - parseContext.error(token.loc, "redefinition", structName.c_str(), "struct"); + if (!_parseContext.symbolTable.insert(*userTypeDef)) + _parseContext.error(token.loc, "redefinition", structName.c_str(), "struct"); } return true; @@ -1788,7 +1788,7 @@ bool HlslGrammar::acceptParameterDeclaration(TFunction& function) acceptArraySpecifier(arraySizes); if (arraySizes) { if (arraySizes->isImplicit()) { - parseContext.error(token.loc, "function parameter array cannot be implicitly sized", "", ""); + _parseContext.error(token.loc, "function parameter array cannot be implicitly sized", "", ""); return false; } @@ -1798,7 +1798,7 @@ bool HlslGrammar::acceptParameterDeclaration(TFunction& function) // post_decls acceptPostDecls(type->getQualifier()); - parseContext.paramFix(*type); + _parseContext.paramFix(*type); TParameter param = { idToken.string, type }; function.addParameter(param); @@ -1810,16 +1810,16 @@ bool HlslGrammar::acceptParameterDeclaration(TFunction& function) // parsing the body (compound_statement). bool HlslGrammar::acceptFunctionDefinition(TFunction& function, TIntermNode*& node, const TAttributeMap& attributes) { - TFunction& functionDeclarator = parseContext.handleFunctionDeclarator(token.loc, function, false /* not prototype */); + TFunction& functionDeclarator = _parseContext.handleFunctionDeclarator(token.loc, function, false /* not prototype */); TSourceLoc loc = token.loc; // This does a pushScope() - node = parseContext.handleFunctionDefinition(loc, functionDeclarator, attributes); + node = _parseContext.handleFunctionDefinition(loc, functionDeclarator, attributes); // compound_statement TIntermNode* functionBody = nullptr; if (acceptCompoundStatement(functionBody)) { - parseContext.handleFunctionBody(loc, functionDeclarator, functionBody, node); + _parseContext.handleFunctionBody(loc, functionDeclarator, functionBody, node); return true; } @@ -1991,11 +1991,11 @@ bool HlslGrammar::acceptAssignmentExpression(TIntermTyped*& node) return false; } - node = parseContext.handleAssign(loc, assignOp, node, rightNode); - node = parseContext.handleLvalue(loc, "assign", node); + node = _parseContext.handleAssign(loc, assignOp, node, rightNode); + node = _parseContext.handleLvalue(loc, "assign", node); if (node == nullptr) { - parseContext.error(loc, "could not create assignment", "", ""); + _parseContext.error(loc, "could not create assignment", "", ""); return false; } @@ -2083,7 +2083,7 @@ bool HlslGrammar::acceptBinaryExpression(TIntermTyped*& node, PrecedenceLevel pr node = intermediate.addBinaryMath(op, node, rightNode, loc); if (node == nullptr) { - parseContext.error(loc, "Could not perform requested binary operation", "", ""); + _parseContext.error(loc, "Could not perform requested binary operation", "", ""); return false; } } while (true); @@ -2114,14 +2114,14 @@ bool HlslGrammar::acceptUnaryExpression(TIntermTyped*& node) return false; // Hook it up like a constructor - TFunction* constructorFunction = parseContext.handleConstructorCall(loc, castType); + TFunction* constructorFunction = _parseContext.handleConstructorCall(loc, castType); if (constructorFunction == nullptr) { expected("type that can be constructed"); return false; } TIntermTyped* arguments = nullptr; - parseContext.handleFunctionArgument(constructorFunction, arguments, node); - node = parseContext.handleFunctionCall(loc, constructorFunction, arguments); + _parseContext.handleFunctionArgument(constructorFunction, arguments, node); + node = _parseContext.handleFunctionCall(loc, constructorFunction, arguments); return true; } else { @@ -2160,7 +2160,7 @@ bool HlslGrammar::acceptUnaryExpression(TIntermTyped*& node) // These unary ops require lvalues if (unaryOp == EOpPreIncrement || unaryOp == EOpPreDecrement) - node = parseContext.handleLvalue(loc, "unary operator", node); + node = _parseContext.handleLvalue(loc, "unary operator", node); return node != nullptr; } @@ -2203,7 +2203,7 @@ bool HlslGrammar::acceptPostfixExpression(TIntermTyped*& node) } else if (acceptIdentifier(idToken)) { // identifier or function_call name if (! peekTokenClass(EHTokLeftParen)) { - node = parseContext.handleVariable(idToken.loc, idToken.symbol, token.string); + node = _parseContext.handleVariable(idToken.loc, idToken.symbol, token.string); } else if (acceptFunctionCall(idToken, node)) { // function_call (nothing else to do yet) } else { @@ -2218,16 +2218,16 @@ bool HlslGrammar::acceptPostfixExpression(TIntermTyped*& node) // This is to guarantee we do this no matter how we get out of the stack frame. // This way there's no bug if an early return forgets to do it. struct tFinalize { - tFinalize(HlslParseContext& p) : parseContext(p) { } - ~tFinalize() { parseContext.finalizeFlattening(); } - HlslParseContext& parseContext; - } finalize(parseContext); + tFinalize(HlslParseContext& p) : _parseContext(p) { } + ~tFinalize() { _parseContext.finalizeFlattening(); } + HlslParseContext& _parseContext; + } finalize(_parseContext); // Initialize the flattening accumulation data, so we can track data across multiple bracket or // dot operators. This can also be nested, e.g, for [], so we have to track each nesting // level: hence the init and finalize. Even though in practice these must be // constants, they are parsed no matter what. - parseContext.initFlattening(); + _parseContext.initFlattening(); // Something was found, chain as many postfix operations as exist. do { @@ -2259,7 +2259,7 @@ bool HlslGrammar::acceptPostfixExpression(TIntermTyped*& node) } TIntermTyped* base = node; // preserve for method function calls - node = parseContext.handleDotDereference(field.loc, node, *field.string); + node = _parseContext.handleDotDereference(field.loc, node, *field.string); // In the event of a method node, we look for an open paren and accept the function call. if (node != nullptr && node->getAsMethodNode() != nullptr && peekTokenClass(EHTokLeftParen)) { @@ -2281,7 +2281,7 @@ bool HlslGrammar::acceptPostfixExpression(TIntermTyped*& node) return false; } advanceToken(); - node = parseContext.handleBracketDereference(indexNode->getLoc(), node, indexNode); + node = _parseContext.handleBracketDereference(indexNode->getLoc(), node, indexNode); break; } case EOpPostIncrement: @@ -2290,7 +2290,7 @@ bool HlslGrammar::acceptPostfixExpression(TIntermTyped*& node) case EOpPostDecrement: // DEC_OP node = intermediate.addUnaryMath(postOp, node, loc); - node = parseContext.handleLvalue(loc, "unary operator", node); + node = _parseContext.handleLvalue(loc, "unary operator", node); break; default: assert(0); @@ -2307,7 +2307,7 @@ bool HlslGrammar::acceptConstructor(TIntermTyped*& node) // type TType type; if (acceptType(type)) { - TFunction* constructorFunction = parseContext.handleConstructorCall(token.loc, type); + TFunction* constructorFunction = _parseContext.handleConstructorCall(token.loc, type); if (constructorFunction == nullptr) return false; @@ -2319,7 +2319,7 @@ bool HlslGrammar::acceptConstructor(TIntermTyped*& node) } // hook it up - node = parseContext.handleFunctionCall(arguments->getLoc(), constructorFunction, arguments); + node = _parseContext.handleFunctionCall(arguments->getLoc(), constructorFunction, arguments); return true; } @@ -2340,12 +2340,12 @@ bool HlslGrammar::acceptFunctionCall(HlslToken idToken, TIntermTyped*& node, TIn // methods have an implicit first argument of the calling object. if (base != nullptr) - parseContext.handleFunctionArgument(function, arguments, base); + _parseContext.handleFunctionArgument(function, arguments, base); if (! acceptArguments(function, arguments)) return false; - node = parseContext.handleFunctionCall(idToken.loc, function, arguments); + node = _parseContext.handleFunctionCall(idToken.loc, function, arguments); return true; } @@ -2369,7 +2369,7 @@ bool HlslGrammar::acceptArguments(TFunction* function, TIntermTyped*& arguments) break; // hook it up - parseContext.handleFunctionArgument(function, arguments, arg); + _parseContext.handleFunctionArgument(function, arguments, arg); // COMMA if (! acceptTokenClass(EHTokComma)) @@ -2434,7 +2434,7 @@ bool HlslGrammar::acceptCompoundStatement(TIntermNode*& retStatement) if (branch != nullptr && (branch->getFlowOp() == EOpCase || branch->getFlowOp() == EOpDefault)) { // hook up individual subsequences within a switch statement - parseContext.wrapupSwitchSubsequence(compoundStatement, statement); + _parseContext.wrapupSwitchSubsequence(compoundStatement, statement); compoundStatement = nullptr; } else { // hook it up to the growing compound statement @@ -2452,18 +2452,18 @@ bool HlslGrammar::acceptCompoundStatement(TIntermNode*& retStatement) bool HlslGrammar::acceptScopedStatement(TIntermNode*& statement) { - parseContext.pushScope(); + _parseContext.pushScope(); bool result = acceptStatement(statement); - parseContext.popScope(); + _parseContext.popScope(); return result; } bool HlslGrammar::acceptScopedCompoundStatement(TIntermNode*& statement) { - parseContext.pushScope(); + _parseContext.pushScope(); bool result = acceptCompoundStatement(statement); - parseContext.popScope(); + _parseContext.popScope(); return result; } @@ -2642,7 +2642,7 @@ bool HlslGrammar::acceptSelectionStatement(TIntermNode*& statement) // so that something declared in the condition is scoped to the lifetimes // of the then-else statements - parseContext.pushScope(); + _parseContext.pushScope(); // LEFT_PAREN expression RIGHT_PAREN TIntermTyped* condition; @@ -2669,7 +2669,7 @@ bool HlslGrammar::acceptSelectionStatement(TIntermNode*& statement) // Put the pieces together statement = intermediate.addSelection(condition, thenElse, loc); - parseContext.popScope(); + _parseContext.popScope(); return true; } @@ -2685,21 +2685,21 @@ bool HlslGrammar::acceptSwitchStatement(TIntermNode*& statement) return false; // LEFT_PAREN expression RIGHT_PAREN - parseContext.pushScope(); + _parseContext.pushScope(); TIntermTyped* switchExpression; if (! acceptParenExpression(switchExpression)) { - parseContext.popScope(); + _parseContext.popScope(); return false; } // compound_statement - parseContext.pushSwitchSequence(new TIntermSequence); + _parseContext.pushSwitchSequence(new TIntermSequence); bool statementOkay = acceptCompoundStatement(statement); if (statementOkay) - statement = parseContext.addSwitch(loc, switchExpression, statement ? statement->getAsAggregate() : nullptr); + statement = _parseContext.addSwitch(loc, switchExpression, statement ? statement->getAsAggregate() : nullptr); - parseContext.popSwitchSequence(); - parseContext.popScope(); + _parseContext.popSwitchSequence(); + _parseContext.popScope(); return statementOkay; } @@ -2725,8 +2725,8 @@ bool HlslGrammar::acceptIterationStatement(TIntermNode*& statement) case EHTokWhile: // so that something declared in the condition is scoped to the lifetime // of the while sub-statement - parseContext.pushScope(); - parseContext.nestLooping(); + _parseContext.pushScope(); + _parseContext.nestLooping(); // LEFT_PAREN condition RIGHT_PAREN if (! acceptParenExpression(condition)) @@ -2738,15 +2738,15 @@ bool HlslGrammar::acceptIterationStatement(TIntermNode*& statement) return false; } - parseContext.unnestLooping(); - parseContext.popScope(); + _parseContext.unnestLooping(); + _parseContext.popScope(); statement = intermediate.addLoop(statement, condition, nullptr, true, loc); return true; case EHTokDo: - parseContext.nestLooping(); + _parseContext.nestLooping(); if (! acceptTokenClass(EHTokLeftBrace)) expected("{"); @@ -2774,7 +2774,7 @@ bool HlslGrammar::acceptIterationStatement(TIntermNode*& statement) if (! acceptTokenClass(EHTokSemicolon)) expected(";"); - parseContext.unnestLooping(); + _parseContext.unnestLooping(); statement = intermediate.addLoop(statement, condition, 0, false, loc); @@ -2788,7 +2788,7 @@ bool HlslGrammar::acceptIterationStatement(TIntermNode*& statement) // so that something declared in the condition is scoped to the lifetime // of the for sub-statement - parseContext.pushScope(); + _parseContext.pushScope(); // initializer TIntermNode* initNode = nullptr; @@ -2801,7 +2801,7 @@ bool HlslGrammar::acceptIterationStatement(TIntermNode*& statement) if (! acceptTokenClass(EHTokSemicolon)) expected(";"); - parseContext.nestLooping(); + _parseContext.nestLooping(); // condition SEMI_COLON acceptExpression(condition); @@ -2822,8 +2822,8 @@ bool HlslGrammar::acceptIterationStatement(TIntermNode*& statement) statement = intermediate.addForLoop(statement, initNode, condition, iterator, true, loc); - parseContext.popScope(); - parseContext.unnestLooping(); + _parseContext.popScope(); + _parseContext.unnestLooping(); return true; } @@ -2872,7 +2872,7 @@ bool HlslGrammar::acceptJumpStatement(TIntermNode*& statement) TIntermTyped* node; if (acceptExpression(node)) { // hook it up - statement = parseContext.handleReturnValue(token.loc, node); + statement = _parseContext.handleReturnValue(token.loc, node); } else statement = intermediate.addBranch(EOpReturn, token.loc); break; @@ -2910,7 +2910,7 @@ bool HlslGrammar::acceptCaseLabel(TIntermNode*& statement) return false; } - statement = parseContext.intermediate.addBranch(EOpCase, expression, loc); + statement = _parseContext.intermediate.addBranch(EOpCase, expression, loc); return true; } @@ -2929,7 +2929,7 @@ bool HlslGrammar::acceptDefaultLabel(TIntermNode*& statement) return false; } - statement = parseContext.intermediate.addBranch(EOpDefault, loc); + statement = _parseContext.intermediate.addBranch(EOpDefault, loc); return true; } @@ -2964,7 +2964,7 @@ void HlslGrammar::acceptArraySpecifier(TArraySizes*& arraySizes) if (hasArraySize) { TArraySize arraySize; - parseContext.arraySizeCheck(loc, sizeExpr, arraySize); + _parseContext.arraySizeCheck(loc, sizeExpr, arraySize); arraySizes->addInnerSize(arraySize); } else { arraySizes->addInnerSize(0); // sized by initializers. @@ -3009,7 +3009,7 @@ void HlslGrammar::acceptPostDecls(TQualifier& qualifier) expected(")"); break; } - parseContext.handlePackOffset(locationToken.loc, qualifier, *locationToken.string, componentToken.string); + _parseContext.handlePackOffset(locationToken.loc, qualifier, *locationToken.string, componentToken.string); } else if (! acceptIdentifier(idToken)) { expected("layout, semantic, packoffset, or register"); return; @@ -3063,10 +3063,10 @@ void HlslGrammar::acceptPostDecls(TQualifier& qualifier) expected(")"); break; } - parseContext.handleRegister(registerDesc.loc, qualifier, profile.string, *registerDesc.string, subComponent, spaceDesc.string); + _parseContext.handleRegister(registerDesc.loc, qualifier, profile.string, *registerDesc.string, subComponent, spaceDesc.string); } else { // semantic, in idToken.string - parseContext.handleSemantic(idToken.loc, qualifier, *idToken.string); + _parseContext.handleSemantic(idToken.loc, qualifier, *idToken.string); } } else if (peekTokenClass(EHTokLeftAngle)) acceptAnnotations(qualifier); diff --git a/deps/glslang/glslang/hlsl/hlslGrammar.h b/deps/glslang/glslang/hlsl/hlslGrammar.h index ad124cb755..3de13b317b 100755 --- a/deps/glslang/glslang/hlsl/hlslGrammar.h +++ b/deps/glslang/glslang/hlsl/hlslGrammar.h @@ -50,8 +50,8 @@ namespace glslang { class HlslGrammar : public HlslTokenStream { public: - HlslGrammar(HlslScanContext& scanner, HlslParseContext& parseContext) - : HlslTokenStream(scanner), parseContext(parseContext), intermediate(parseContext.intermediate) { } + HlslGrammar(HlslScanContext& scanner, HlslParseContext&_parseContext) + : HlslTokenStream(scanner), _parseContext(_parseContext), intermediate(_parseContext.intermediate) { } virtual ~HlslGrammar() { } bool parse(); @@ -112,7 +112,7 @@ namespace glslang { void acceptArraySpecifier(TArraySizes*&); void acceptPostDecls(TQualifier&); - HlslParseContext& parseContext; // state of parsing and helper functions for building the intermediate + HlslParseContext&_parseContext; // state of parsing and helper functions for building the intermediate TIntermediate& intermediate; // the final product, the intermediate representation, includes the AST }; diff --git a/deps/glslang/glslang/hlsl/hlslParseHelper.cpp b/deps/glslang/glslang/hlsl/hlslParseHelper.cpp index 54cd10fcc6..0239f2c41e 100755 --- a/deps/glslang/glslang/hlsl/hlslParseHelper.cpp +++ b/deps/glslang/glslang/hlsl/hlslParseHelper.cpp @@ -887,8 +887,8 @@ void HlslParseContext::flatten(const TSourceLoc& loc, const TVariable& variable) const TType& type = variable.getType(); // emplace gives back a pair whose .first is an iterator to the item... - auto entry = flattenMap.emplace(variable.getUniqueId(), - TFlattenData(type.getQualifier().layoutBinding)); + auto entry = flattenMap.emplace(std::pair(variable.getUniqueId(), + TFlattenData(type.getQualifier().layoutBinding))); // ... and the item is a map pair, so first->second is the TFlattenData itself. flatten(loc, variable, type, entry.first->second, ""); diff --git a/deps/glslang/glslang/hlsl/hlslScanContext.cpp b/deps/glslang/glslang/hlsl/hlslScanContext.cpp index 4e355ba7ca..abd59389cf 100755 --- a/deps/glslang/glslang/hlsl/hlslScanContext.cpp +++ b/deps/glslang/glslang/hlsl/hlslScanContext.cpp @@ -52,329 +52,306 @@ // preprocessor includes #include "../glslang/MachineIndependent/preprocessor/PpContext.h" #include "../glslang/MachineIndependent/preprocessor/PpTokens.h" +#include "../glslang/MachineIndependent/preprocessor/Compare.h" namespace { -struct str_eq -{ - bool operator()(const char* lhs, const char* rhs) const - { - return strcmp(lhs, rhs) == 0; - } -}; - -struct str_hash -{ - size_t operator()(const char* str) const - { - // djb2 - unsigned long hash = 5381; - int c; - - while ((c = *str++) != 0) - hash = ((hash << 5) + hash) + c; - - return hash; - } -}; - // A single global usable by all threads, by all versions, by all languages. // After a single process-level initialization, this is read only and thread safe -std::unordered_map* KeywordMap = nullptr; -std::unordered_set* ReservedSet = nullptr; - +std::unordered_map* hlslKeywordMap = nullptr; +std::unordered_set* hlslReservedSet = nullptr; }; namespace glslang { void HlslScanContext::fillInKeywordMap() { - if (KeywordMap != nullptr) { + if (hlslKeywordMap != nullptr) { // this is really an error, as this should called only once per process // but, the only risk is if two threads called simultaneously return; } - KeywordMap = new std::unordered_map; + hlslKeywordMap = new std::unordered_map; - (*KeywordMap)["static"] = EHTokStatic; - (*KeywordMap)["const"] = EHTokConst; - (*KeywordMap)["unorm"] = EHTokUnorm; - (*KeywordMap)["snorm"] = EHTokSNorm; - (*KeywordMap)["extern"] = EHTokExtern; - (*KeywordMap)["uniform"] = EHTokUniform; - (*KeywordMap)["volatile"] = EHTokVolatile; - (*KeywordMap)["precise"] = EHTokPrecise; - (*KeywordMap)["shared"] = EHTokShared; - (*KeywordMap)["groupshared"] = EHTokGroupShared; - (*KeywordMap)["linear"] = EHTokLinear; - (*KeywordMap)["centroid"] = EHTokCentroid; - (*KeywordMap)["nointerpolation"] = EHTokNointerpolation; - (*KeywordMap)["noperspective"] = EHTokNoperspective; - (*KeywordMap)["sample"] = EHTokSample; - (*KeywordMap)["row_major"] = EHTokRowMajor; - (*KeywordMap)["column_major"] = EHTokColumnMajor; - (*KeywordMap)["packoffset"] = EHTokPackOffset; - (*KeywordMap)["in"] = EHTokIn; - (*KeywordMap)["out"] = EHTokOut; - (*KeywordMap)["inout"] = EHTokInOut; - (*KeywordMap)["layout"] = EHTokLayout; + (*hlslKeywordMap)["static"] = EHTokStatic; + (*hlslKeywordMap)["const"] = EHTokConst; + (*hlslKeywordMap)["unorm"] = EHTokUnorm; + (*hlslKeywordMap)["snorm"] = EHTokSNorm; + (*hlslKeywordMap)["extern"] = EHTokExtern; + (*hlslKeywordMap)["uniform"] = EHTokUniform; + (*hlslKeywordMap)["volatile"] = EHTokVolatile; + (*hlslKeywordMap)["precise"] = EHTokPrecise; + (*hlslKeywordMap)["shared"] = EHTokShared; + (*hlslKeywordMap)["groupshared"] = EHTokGroupShared; + (*hlslKeywordMap)["linear"] = EHTokLinear; + (*hlslKeywordMap)["centroid"] = EHTokCentroid; + (*hlslKeywordMap)["nointerpolation"] = EHTokNointerpolation; + (*hlslKeywordMap)["noperspective"] = EHTokNoperspective; + (*hlslKeywordMap)["sample"] = EHTokSample; + (*hlslKeywordMap)["row_major"] = EHTokRowMajor; + (*hlslKeywordMap)["column_major"] = EHTokColumnMajor; + (*hlslKeywordMap)["packoffset"] = EHTokPackOffset; + (*hlslKeywordMap)["in"] = EHTokIn; + (*hlslKeywordMap)["out"] = EHTokOut; + (*hlslKeywordMap)["inout"] = EHTokInOut; + (*hlslKeywordMap)["layout"] = EHTokLayout; - (*KeywordMap)["point"] = EHTokPoint; - (*KeywordMap)["line"] = EHTokLine; - (*KeywordMap)["triangle"] = EHTokTriangle; - (*KeywordMap)["lineadj"] = EHTokLineAdj; - (*KeywordMap)["triangleadj"] = EHTokTriangleAdj; + (*hlslKeywordMap)["point"] = EHTokPoint; + (*hlslKeywordMap)["line"] = EHTokLine; + (*hlslKeywordMap)["triangle"] = EHTokTriangle; + (*hlslKeywordMap)["lineadj"] = EHTokLineAdj; + (*hlslKeywordMap)["triangleadj"] = EHTokTriangleAdj; - (*KeywordMap)["PointStream"] = EHTokPointStream; - (*KeywordMap)["LineStream"] = EHTokLineStream; - (*KeywordMap)["TriangleStream"] = EHTokTriangleStream; + (*hlslKeywordMap)["PointStream"] = EHTokPointStream; + (*hlslKeywordMap)["LineStream"] = EHTokLineStream; + (*hlslKeywordMap)["TriangleStream"] = EHTokTriangleStream; - (*KeywordMap)["Buffer"] = EHTokBuffer; - (*KeywordMap)["vector"] = EHTokVector; - (*KeywordMap)["matrix"] = EHTokMatrix; + (*hlslKeywordMap)["Buffer"] = EHTokBuffer; + (*hlslKeywordMap)["vector"] = EHTokVector; + (*hlslKeywordMap)["matrix"] = EHTokMatrix; - (*KeywordMap)["void"] = EHTokVoid; - (*KeywordMap)["string"] = EHTokString; - (*KeywordMap)["bool"] = EHTokBool; - (*KeywordMap)["int"] = EHTokInt; - (*KeywordMap)["uint"] = EHTokUint; - (*KeywordMap)["dword"] = EHTokDword; - (*KeywordMap)["half"] = EHTokHalf; - (*KeywordMap)["float"] = EHTokFloat; - (*KeywordMap)["double"] = EHTokDouble; - (*KeywordMap)["min16float"] = EHTokMin16float; - (*KeywordMap)["min10float"] = EHTokMin10float; - (*KeywordMap)["min16int"] = EHTokMin16int; - (*KeywordMap)["min12int"] = EHTokMin12int; - (*KeywordMap)["min16uint"] = EHTokMin16uint; + (*hlslKeywordMap)["void"] = EHTokVoid; + (*hlslKeywordMap)["string"] = EHTokString; + (*hlslKeywordMap)["bool"] = EHTokBool; + (*hlslKeywordMap)["int"] = EHTokInt; + (*hlslKeywordMap)["uint"] = EHTokUint; + (*hlslKeywordMap)["dword"] = EHTokDword; + (*hlslKeywordMap)["half"] = EHTokHalf; + (*hlslKeywordMap)["float"] = EHTokFloat; + (*hlslKeywordMap)["double"] = EHTokDouble; + (*hlslKeywordMap)["min16float"] = EHTokMin16float; + (*hlslKeywordMap)["min10float"] = EHTokMin10float; + (*hlslKeywordMap)["min16int"] = EHTokMin16int; + (*hlslKeywordMap)["min12int"] = EHTokMin12int; + (*hlslKeywordMap)["min16uint"] = EHTokMin16uint; - (*KeywordMap)["bool1"] = EHTokBool1; - (*KeywordMap)["bool2"] = EHTokBool2; - (*KeywordMap)["bool3"] = EHTokBool3; - (*KeywordMap)["bool4"] = EHTokBool4; - (*KeywordMap)["float1"] = EHTokFloat1; - (*KeywordMap)["float2"] = EHTokFloat2; - (*KeywordMap)["float3"] = EHTokFloat3; - (*KeywordMap)["float4"] = EHTokFloat4; - (*KeywordMap)["int1"] = EHTokInt1; - (*KeywordMap)["int2"] = EHTokInt2; - (*KeywordMap)["int3"] = EHTokInt3; - (*KeywordMap)["int4"] = EHTokInt4; - (*KeywordMap)["double1"] = EHTokDouble1; - (*KeywordMap)["double2"] = EHTokDouble2; - (*KeywordMap)["double3"] = EHTokDouble3; - (*KeywordMap)["double4"] = EHTokDouble4; - (*KeywordMap)["uint1"] = EHTokUint1; - (*KeywordMap)["uint2"] = EHTokUint2; - (*KeywordMap)["uint3"] = EHTokUint3; - (*KeywordMap)["uint4"] = EHTokUint4; + (*hlslKeywordMap)["bool1"] = EHTokBool1; + (*hlslKeywordMap)["bool2"] = EHTokBool2; + (*hlslKeywordMap)["bool3"] = EHTokBool3; + (*hlslKeywordMap)["bool4"] = EHTokBool4; + (*hlslKeywordMap)["float1"] = EHTokFloat1; + (*hlslKeywordMap)["float2"] = EHTokFloat2; + (*hlslKeywordMap)["float3"] = EHTokFloat3; + (*hlslKeywordMap)["float4"] = EHTokFloat4; + (*hlslKeywordMap)["int1"] = EHTokInt1; + (*hlslKeywordMap)["int2"] = EHTokInt2; + (*hlslKeywordMap)["int3"] = EHTokInt3; + (*hlslKeywordMap)["int4"] = EHTokInt4; + (*hlslKeywordMap)["double1"] = EHTokDouble1; + (*hlslKeywordMap)["double2"] = EHTokDouble2; + (*hlslKeywordMap)["double3"] = EHTokDouble3; + (*hlslKeywordMap)["double4"] = EHTokDouble4; + (*hlslKeywordMap)["uint1"] = EHTokUint1; + (*hlslKeywordMap)["uint2"] = EHTokUint2; + (*hlslKeywordMap)["uint3"] = EHTokUint3; + (*hlslKeywordMap)["uint4"] = EHTokUint4; - (*KeywordMap)["min16float1"] = EHTokMin16float1; - (*KeywordMap)["min16float2"] = EHTokMin16float2; - (*KeywordMap)["min16float3"] = EHTokMin16float3; - (*KeywordMap)["min16float4"] = EHTokMin16float4; - (*KeywordMap)["min10float1"] = EHTokMin10float1; - (*KeywordMap)["min10float2"] = EHTokMin10float2; - (*KeywordMap)["min10float3"] = EHTokMin10float3; - (*KeywordMap)["min10float4"] = EHTokMin10float4; - (*KeywordMap)["min16int1"] = EHTokMin16int1; - (*KeywordMap)["min16int2"] = EHTokMin16int2; - (*KeywordMap)["min16int3"] = EHTokMin16int3; - (*KeywordMap)["min16int4"] = EHTokMin16int4; - (*KeywordMap)["min12int1"] = EHTokMin12int1; - (*KeywordMap)["min12int2"] = EHTokMin12int2; - (*KeywordMap)["min12int3"] = EHTokMin12int3; - (*KeywordMap)["min12int4"] = EHTokMin12int4; - (*KeywordMap)["min16uint1"] = EHTokMin16uint1; - (*KeywordMap)["min16uint2"] = EHTokMin16uint2; - (*KeywordMap)["min16uint3"] = EHTokMin16uint3; - (*KeywordMap)["min16uint4"] = EHTokMin16uint4; + (*hlslKeywordMap)["min16float1"] = EHTokMin16float1; + (*hlslKeywordMap)["min16float2"] = EHTokMin16float2; + (*hlslKeywordMap)["min16float3"] = EHTokMin16float3; + (*hlslKeywordMap)["min16float4"] = EHTokMin16float4; + (*hlslKeywordMap)["min10float1"] = EHTokMin10float1; + (*hlslKeywordMap)["min10float2"] = EHTokMin10float2; + (*hlslKeywordMap)["min10float3"] = EHTokMin10float3; + (*hlslKeywordMap)["min10float4"] = EHTokMin10float4; + (*hlslKeywordMap)["min16int1"] = EHTokMin16int1; + (*hlslKeywordMap)["min16int2"] = EHTokMin16int2; + (*hlslKeywordMap)["min16int3"] = EHTokMin16int3; + (*hlslKeywordMap)["min16int4"] = EHTokMin16int4; + (*hlslKeywordMap)["min12int1"] = EHTokMin12int1; + (*hlslKeywordMap)["min12int2"] = EHTokMin12int2; + (*hlslKeywordMap)["min12int3"] = EHTokMin12int3; + (*hlslKeywordMap)["min12int4"] = EHTokMin12int4; + (*hlslKeywordMap)["min16uint1"] = EHTokMin16uint1; + (*hlslKeywordMap)["min16uint2"] = EHTokMin16uint2; + (*hlslKeywordMap)["min16uint3"] = EHTokMin16uint3; + (*hlslKeywordMap)["min16uint4"] = EHTokMin16uint4; - (*KeywordMap)["bool1x1"] = EHTokBool1x1; - (*KeywordMap)["bool1x2"] = EHTokBool1x2; - (*KeywordMap)["bool1x3"] = EHTokBool1x3; - (*KeywordMap)["bool1x4"] = EHTokBool1x4; - (*KeywordMap)["bool2x1"] = EHTokBool2x1; - (*KeywordMap)["bool2x2"] = EHTokBool2x2; - (*KeywordMap)["bool2x3"] = EHTokBool2x3; - (*KeywordMap)["bool2x4"] = EHTokBool2x4; - (*KeywordMap)["bool3x1"] = EHTokBool3x1; - (*KeywordMap)["bool3x2"] = EHTokBool3x2; - (*KeywordMap)["bool3x3"] = EHTokBool3x3; - (*KeywordMap)["bool3x4"] = EHTokBool3x4; - (*KeywordMap)["bool4x1"] = EHTokBool4x1; - (*KeywordMap)["bool4x2"] = EHTokBool4x2; - (*KeywordMap)["bool4x3"] = EHTokBool4x3; - (*KeywordMap)["bool4x4"] = EHTokBool4x4; - (*KeywordMap)["int1x1"] = EHTokInt1x1; - (*KeywordMap)["int1x2"] = EHTokInt1x2; - (*KeywordMap)["int1x3"] = EHTokInt1x3; - (*KeywordMap)["int1x4"] = EHTokInt1x4; - (*KeywordMap)["int2x1"] = EHTokInt2x1; - (*KeywordMap)["int2x2"] = EHTokInt2x2; - (*KeywordMap)["int2x3"] = EHTokInt2x3; - (*KeywordMap)["int2x4"] = EHTokInt2x4; - (*KeywordMap)["int3x1"] = EHTokInt3x1; - (*KeywordMap)["int3x2"] = EHTokInt3x2; - (*KeywordMap)["int3x3"] = EHTokInt3x3; - (*KeywordMap)["int3x4"] = EHTokInt3x4; - (*KeywordMap)["int4x1"] = EHTokInt4x1; - (*KeywordMap)["int4x2"] = EHTokInt4x2; - (*KeywordMap)["int4x3"] = EHTokInt4x3; - (*KeywordMap)["int4x4"] = EHTokInt4x4; - (*KeywordMap)["uint1x1"] = EHTokUint1x1; - (*KeywordMap)["uint1x2"] = EHTokUint1x2; - (*KeywordMap)["uint1x3"] = EHTokUint1x3; - (*KeywordMap)["uint1x4"] = EHTokUint1x4; - (*KeywordMap)["uint2x1"] = EHTokUint2x1; - (*KeywordMap)["uint2x2"] = EHTokUint2x2; - (*KeywordMap)["uint2x3"] = EHTokUint2x3; - (*KeywordMap)["uint2x4"] = EHTokUint2x4; - (*KeywordMap)["uint3x1"] = EHTokUint3x1; - (*KeywordMap)["uint3x2"] = EHTokUint3x2; - (*KeywordMap)["uint3x3"] = EHTokUint3x3; - (*KeywordMap)["uint3x4"] = EHTokUint3x4; - (*KeywordMap)["uint4x1"] = EHTokUint4x1; - (*KeywordMap)["uint4x2"] = EHTokUint4x2; - (*KeywordMap)["uint4x3"] = EHTokUint4x3; - (*KeywordMap)["uint4x4"] = EHTokUint4x4; - (*KeywordMap)["bool1x1"] = EHTokBool1x1; - (*KeywordMap)["bool1x2"] = EHTokBool1x2; - (*KeywordMap)["bool1x3"] = EHTokBool1x3; - (*KeywordMap)["bool1x4"] = EHTokBool1x4; - (*KeywordMap)["bool2x1"] = EHTokBool2x1; - (*KeywordMap)["bool2x2"] = EHTokBool2x2; - (*KeywordMap)["bool2x3"] = EHTokBool2x3; - (*KeywordMap)["bool2x4"] = EHTokBool2x4; - (*KeywordMap)["bool3x1"] = EHTokBool3x1; - (*KeywordMap)["bool3x2"] = EHTokBool3x2; - (*KeywordMap)["bool3x3"] = EHTokBool3x3; - (*KeywordMap)["bool3x4"] = EHTokBool3x4; - (*KeywordMap)["bool4x1"] = EHTokBool4x1; - (*KeywordMap)["bool4x2"] = EHTokBool4x2; - (*KeywordMap)["bool4x3"] = EHTokBool4x3; - (*KeywordMap)["bool4x4"] = EHTokBool4x4; - (*KeywordMap)["float1x1"] = EHTokFloat1x1; - (*KeywordMap)["float1x2"] = EHTokFloat1x2; - (*KeywordMap)["float1x3"] = EHTokFloat1x3; - (*KeywordMap)["float1x4"] = EHTokFloat1x4; - (*KeywordMap)["float2x1"] = EHTokFloat2x1; - (*KeywordMap)["float2x2"] = EHTokFloat2x2; - (*KeywordMap)["float2x3"] = EHTokFloat2x3; - (*KeywordMap)["float2x4"] = EHTokFloat2x4; - (*KeywordMap)["float3x1"] = EHTokFloat3x1; - (*KeywordMap)["float3x2"] = EHTokFloat3x2; - (*KeywordMap)["float3x3"] = EHTokFloat3x3; - (*KeywordMap)["float3x4"] = EHTokFloat3x4; - (*KeywordMap)["float4x1"] = EHTokFloat4x1; - (*KeywordMap)["float4x2"] = EHTokFloat4x2; - (*KeywordMap)["float4x3"] = EHTokFloat4x3; - (*KeywordMap)["float4x4"] = EHTokFloat4x4; - (*KeywordMap)["double1x1"] = EHTokDouble1x1; - (*KeywordMap)["double1x2"] = EHTokDouble1x2; - (*KeywordMap)["double1x3"] = EHTokDouble1x3; - (*KeywordMap)["double1x4"] = EHTokDouble1x4; - (*KeywordMap)["double2x1"] = EHTokDouble2x1; - (*KeywordMap)["double2x2"] = EHTokDouble2x2; - (*KeywordMap)["double2x3"] = EHTokDouble2x3; - (*KeywordMap)["double2x4"] = EHTokDouble2x4; - (*KeywordMap)["double3x1"] = EHTokDouble3x1; - (*KeywordMap)["double3x2"] = EHTokDouble3x2; - (*KeywordMap)["double3x3"] = EHTokDouble3x3; - (*KeywordMap)["double3x4"] = EHTokDouble3x4; - (*KeywordMap)["double4x1"] = EHTokDouble4x1; - (*KeywordMap)["double4x2"] = EHTokDouble4x2; - (*KeywordMap)["double4x3"] = EHTokDouble4x3; - (*KeywordMap)["double4x4"] = EHTokDouble4x4; + (*hlslKeywordMap)["bool1x1"] = EHTokBool1x1; + (*hlslKeywordMap)["bool1x2"] = EHTokBool1x2; + (*hlslKeywordMap)["bool1x3"] = EHTokBool1x3; + (*hlslKeywordMap)["bool1x4"] = EHTokBool1x4; + (*hlslKeywordMap)["bool2x1"] = EHTokBool2x1; + (*hlslKeywordMap)["bool2x2"] = EHTokBool2x2; + (*hlslKeywordMap)["bool2x3"] = EHTokBool2x3; + (*hlslKeywordMap)["bool2x4"] = EHTokBool2x4; + (*hlslKeywordMap)["bool3x1"] = EHTokBool3x1; + (*hlslKeywordMap)["bool3x2"] = EHTokBool3x2; + (*hlslKeywordMap)["bool3x3"] = EHTokBool3x3; + (*hlslKeywordMap)["bool3x4"] = EHTokBool3x4; + (*hlslKeywordMap)["bool4x1"] = EHTokBool4x1; + (*hlslKeywordMap)["bool4x2"] = EHTokBool4x2; + (*hlslKeywordMap)["bool4x3"] = EHTokBool4x3; + (*hlslKeywordMap)["bool4x4"] = EHTokBool4x4; + (*hlslKeywordMap)["int1x1"] = EHTokInt1x1; + (*hlslKeywordMap)["int1x2"] = EHTokInt1x2; + (*hlslKeywordMap)["int1x3"] = EHTokInt1x3; + (*hlslKeywordMap)["int1x4"] = EHTokInt1x4; + (*hlslKeywordMap)["int2x1"] = EHTokInt2x1; + (*hlslKeywordMap)["int2x2"] = EHTokInt2x2; + (*hlslKeywordMap)["int2x3"] = EHTokInt2x3; + (*hlslKeywordMap)["int2x4"] = EHTokInt2x4; + (*hlslKeywordMap)["int3x1"] = EHTokInt3x1; + (*hlslKeywordMap)["int3x2"] = EHTokInt3x2; + (*hlslKeywordMap)["int3x3"] = EHTokInt3x3; + (*hlslKeywordMap)["int3x4"] = EHTokInt3x4; + (*hlslKeywordMap)["int4x1"] = EHTokInt4x1; + (*hlslKeywordMap)["int4x2"] = EHTokInt4x2; + (*hlslKeywordMap)["int4x3"] = EHTokInt4x3; + (*hlslKeywordMap)["int4x4"] = EHTokInt4x4; + (*hlslKeywordMap)["uint1x1"] = EHTokUint1x1; + (*hlslKeywordMap)["uint1x2"] = EHTokUint1x2; + (*hlslKeywordMap)["uint1x3"] = EHTokUint1x3; + (*hlslKeywordMap)["uint1x4"] = EHTokUint1x4; + (*hlslKeywordMap)["uint2x1"] = EHTokUint2x1; + (*hlslKeywordMap)["uint2x2"] = EHTokUint2x2; + (*hlslKeywordMap)["uint2x3"] = EHTokUint2x3; + (*hlslKeywordMap)["uint2x4"] = EHTokUint2x4; + (*hlslKeywordMap)["uint3x1"] = EHTokUint3x1; + (*hlslKeywordMap)["uint3x2"] = EHTokUint3x2; + (*hlslKeywordMap)["uint3x3"] = EHTokUint3x3; + (*hlslKeywordMap)["uint3x4"] = EHTokUint3x4; + (*hlslKeywordMap)["uint4x1"] = EHTokUint4x1; + (*hlslKeywordMap)["uint4x2"] = EHTokUint4x2; + (*hlslKeywordMap)["uint4x3"] = EHTokUint4x3; + (*hlslKeywordMap)["uint4x4"] = EHTokUint4x4; + (*hlslKeywordMap)["bool1x1"] = EHTokBool1x1; + (*hlslKeywordMap)["bool1x2"] = EHTokBool1x2; + (*hlslKeywordMap)["bool1x3"] = EHTokBool1x3; + (*hlslKeywordMap)["bool1x4"] = EHTokBool1x4; + (*hlslKeywordMap)["bool2x1"] = EHTokBool2x1; + (*hlslKeywordMap)["bool2x2"] = EHTokBool2x2; + (*hlslKeywordMap)["bool2x3"] = EHTokBool2x3; + (*hlslKeywordMap)["bool2x4"] = EHTokBool2x4; + (*hlslKeywordMap)["bool3x1"] = EHTokBool3x1; + (*hlslKeywordMap)["bool3x2"] = EHTokBool3x2; + (*hlslKeywordMap)["bool3x3"] = EHTokBool3x3; + (*hlslKeywordMap)["bool3x4"] = EHTokBool3x4; + (*hlslKeywordMap)["bool4x1"] = EHTokBool4x1; + (*hlslKeywordMap)["bool4x2"] = EHTokBool4x2; + (*hlslKeywordMap)["bool4x3"] = EHTokBool4x3; + (*hlslKeywordMap)["bool4x4"] = EHTokBool4x4; + (*hlslKeywordMap)["float1x1"] = EHTokFloat1x1; + (*hlslKeywordMap)["float1x2"] = EHTokFloat1x2; + (*hlslKeywordMap)["float1x3"] = EHTokFloat1x3; + (*hlslKeywordMap)["float1x4"] = EHTokFloat1x4; + (*hlslKeywordMap)["float2x1"] = EHTokFloat2x1; + (*hlslKeywordMap)["float2x2"] = EHTokFloat2x2; + (*hlslKeywordMap)["float2x3"] = EHTokFloat2x3; + (*hlslKeywordMap)["float2x4"] = EHTokFloat2x4; + (*hlslKeywordMap)["float3x1"] = EHTokFloat3x1; + (*hlslKeywordMap)["float3x2"] = EHTokFloat3x2; + (*hlslKeywordMap)["float3x3"] = EHTokFloat3x3; + (*hlslKeywordMap)["float3x4"] = EHTokFloat3x4; + (*hlslKeywordMap)["float4x1"] = EHTokFloat4x1; + (*hlslKeywordMap)["float4x2"] = EHTokFloat4x2; + (*hlslKeywordMap)["float4x3"] = EHTokFloat4x3; + (*hlslKeywordMap)["float4x4"] = EHTokFloat4x4; + (*hlslKeywordMap)["double1x1"] = EHTokDouble1x1; + (*hlslKeywordMap)["double1x2"] = EHTokDouble1x2; + (*hlslKeywordMap)["double1x3"] = EHTokDouble1x3; + (*hlslKeywordMap)["double1x4"] = EHTokDouble1x4; + (*hlslKeywordMap)["double2x1"] = EHTokDouble2x1; + (*hlslKeywordMap)["double2x2"] = EHTokDouble2x2; + (*hlslKeywordMap)["double2x3"] = EHTokDouble2x3; + (*hlslKeywordMap)["double2x4"] = EHTokDouble2x4; + (*hlslKeywordMap)["double3x1"] = EHTokDouble3x1; + (*hlslKeywordMap)["double3x2"] = EHTokDouble3x2; + (*hlslKeywordMap)["double3x3"] = EHTokDouble3x3; + (*hlslKeywordMap)["double3x4"] = EHTokDouble3x4; + (*hlslKeywordMap)["double4x1"] = EHTokDouble4x1; + (*hlslKeywordMap)["double4x2"] = EHTokDouble4x2; + (*hlslKeywordMap)["double4x3"] = EHTokDouble4x3; + (*hlslKeywordMap)["double4x4"] = EHTokDouble4x4; - (*KeywordMap)["sampler"] = EHTokSampler; - (*KeywordMap)["sampler1D"] = EHTokSampler1d; - (*KeywordMap)["sampler2D"] = EHTokSampler2d; - (*KeywordMap)["sampler3D"] = EHTokSampler3d; - (*KeywordMap)["samplerCube"] = EHTokSamplerCube; - (*KeywordMap)["sampler_state"] = EHTokSamplerState; - (*KeywordMap)["SamplerState"] = EHTokSamplerState; - (*KeywordMap)["SamplerComparisonState"] = EHTokSamplerComparisonState; - (*KeywordMap)["texture"] = EHTokTexture; - (*KeywordMap)["Texture1D"] = EHTokTexture1d; - (*KeywordMap)["Texture1DArray"] = EHTokTexture1darray; - (*KeywordMap)["Texture2D"] = EHTokTexture2d; - (*KeywordMap)["Texture2DArray"] = EHTokTexture2darray; - (*KeywordMap)["Texture3D"] = EHTokTexture3d; - (*KeywordMap)["TextureCube"] = EHTokTextureCube; - (*KeywordMap)["TextureCubeArray"] = EHTokTextureCubearray; - (*KeywordMap)["Texture2DMS"] = EHTokTexture2DMS; - (*KeywordMap)["Texture2DMSArray"] = EHTokTexture2DMSarray; - (*KeywordMap)["RWTexture1D"] = EHTokRWTexture1d; - (*KeywordMap)["RWTexture1DArray"] = EHTokRWTexture1darray; - (*KeywordMap)["RWTexture2D"] = EHTokRWTexture2d; - (*KeywordMap)["RWTexture2DArray"] = EHTokRWTexture2darray; - (*KeywordMap)["RWTexture3D"] = EHTokRWTexture3d; - (*KeywordMap)["RWBuffer"] = EHTokRWBuffer; + (*hlslKeywordMap)["sampler"] = EHTokSampler; + (*hlslKeywordMap)["sampler1D"] = EHTokSampler1d; + (*hlslKeywordMap)["sampler2D"] = EHTokSampler2d; + (*hlslKeywordMap)["sampler3D"] = EHTokSampler3d; + (*hlslKeywordMap)["samplerCube"] = EHTokSamplerCube; + (*hlslKeywordMap)["sampler_state"] = EHTokSamplerState; + (*hlslKeywordMap)["SamplerState"] = EHTokSamplerState; + (*hlslKeywordMap)["SamplerComparisonState"] = EHTokSamplerComparisonState; + (*hlslKeywordMap)["texture"] = EHTokTexture; + (*hlslKeywordMap)["Texture1D"] = EHTokTexture1d; + (*hlslKeywordMap)["Texture1DArray"] = EHTokTexture1darray; + (*hlslKeywordMap)["Texture2D"] = EHTokTexture2d; + (*hlslKeywordMap)["Texture2DArray"] = EHTokTexture2darray; + (*hlslKeywordMap)["Texture3D"] = EHTokTexture3d; + (*hlslKeywordMap)["TextureCube"] = EHTokTextureCube; + (*hlslKeywordMap)["TextureCubeArray"] = EHTokTextureCubearray; + (*hlslKeywordMap)["Texture2DMS"] = EHTokTexture2DMS; + (*hlslKeywordMap)["Texture2DMSArray"] = EHTokTexture2DMSarray; + (*hlslKeywordMap)["RWTexture1D"] = EHTokRWTexture1d; + (*hlslKeywordMap)["RWTexture1DArray"] = EHTokRWTexture1darray; + (*hlslKeywordMap)["RWTexture2D"] = EHTokRWTexture2d; + (*hlslKeywordMap)["RWTexture2DArray"] = EHTokRWTexture2darray; + (*hlslKeywordMap)["RWTexture3D"] = EHTokRWTexture3d; + (*hlslKeywordMap)["RWBuffer"] = EHTokRWBuffer; - (*KeywordMap)["struct"] = EHTokStruct; - (*KeywordMap)["cbuffer"] = EHTokCBuffer; - (*KeywordMap)["tbuffer"] = EHTokTBuffer; - (*KeywordMap)["typedef"] = EHTokTypedef; + (*hlslKeywordMap)["struct"] = EHTokStruct; + (*hlslKeywordMap)["cbuffer"] = EHTokCBuffer; + (*hlslKeywordMap)["tbuffer"] = EHTokTBuffer; + (*hlslKeywordMap)["typedef"] = EHTokTypedef; - (*KeywordMap)["true"] = EHTokBoolConstant; - (*KeywordMap)["false"] = EHTokBoolConstant; + (*hlslKeywordMap)["true"] = EHTokBoolConstant; + (*hlslKeywordMap)["false"] = EHTokBoolConstant; - (*KeywordMap)["for"] = EHTokFor; - (*KeywordMap)["do"] = EHTokDo; - (*KeywordMap)["while"] = EHTokWhile; - (*KeywordMap)["break"] = EHTokBreak; - (*KeywordMap)["continue"] = EHTokContinue; - (*KeywordMap)["if"] = EHTokIf; - (*KeywordMap)["else"] = EHTokElse; - (*KeywordMap)["discard"] = EHTokDiscard; - (*KeywordMap)["return"] = EHTokReturn; - (*KeywordMap)["switch"] = EHTokSwitch; - (*KeywordMap)["case"] = EHTokCase; - (*KeywordMap)["default"] = EHTokDefault; + (*hlslKeywordMap)["for"] = EHTokFor; + (*hlslKeywordMap)["do"] = EHTokDo; + (*hlslKeywordMap)["while"] = EHTokWhile; + (*hlslKeywordMap)["break"] = EHTokBreak; + (*hlslKeywordMap)["continue"] = EHTokContinue; + (*hlslKeywordMap)["if"] = EHTokIf; + (*hlslKeywordMap)["else"] = EHTokElse; + (*hlslKeywordMap)["discard"] = EHTokDiscard; + (*hlslKeywordMap)["return"] = EHTokReturn; + (*hlslKeywordMap)["switch"] = EHTokSwitch; + (*hlslKeywordMap)["case"] = EHTokCase; + (*hlslKeywordMap)["default"] = EHTokDefault; // TODO: get correct set here - ReservedSet = new std::unordered_set; + hlslReservedSet = new std::unordered_set; - ReservedSet->insert("auto"); - ReservedSet->insert("catch"); - ReservedSet->insert("char"); - ReservedSet->insert("class"); - ReservedSet->insert("const_cast"); - ReservedSet->insert("enum"); - ReservedSet->insert("explicit"); - ReservedSet->insert("friend"); - ReservedSet->insert("goto"); - ReservedSet->insert("long"); - ReservedSet->insert("mutable"); - ReservedSet->insert("new"); - ReservedSet->insert("operator"); - ReservedSet->insert("private"); - ReservedSet->insert("protected"); - ReservedSet->insert("public"); - ReservedSet->insert("reinterpret_cast"); - ReservedSet->insert("short"); - ReservedSet->insert("signed"); - ReservedSet->insert("sizeof"); - ReservedSet->insert("static_cast"); - ReservedSet->insert("template"); - ReservedSet->insert("this"); - ReservedSet->insert("throw"); - ReservedSet->insert("try"); - ReservedSet->insert("typename"); - ReservedSet->insert("union"); - ReservedSet->insert("unsigned"); - ReservedSet->insert("using"); - ReservedSet->insert("virtual"); + hlslReservedSet->insert("auto"); + hlslReservedSet->insert("catch"); + hlslReservedSet->insert("char"); + hlslReservedSet->insert("class"); + hlslReservedSet->insert("const_cast"); + hlslReservedSet->insert("enum"); + hlslReservedSet->insert("explicit"); + hlslReservedSet->insert("friend"); + hlslReservedSet->insert("goto"); + hlslReservedSet->insert("long"); + hlslReservedSet->insert("mutable"); + hlslReservedSet->insert("new"); + hlslReservedSet->insert("operator"); + hlslReservedSet->insert("private"); + hlslReservedSet->insert("protected"); + hlslReservedSet->insert("public"); + hlslReservedSet->insert("reinterpret_cast"); + hlslReservedSet->insert("short"); + hlslReservedSet->insert("signed"); + hlslReservedSet->insert("sizeof"); + hlslReservedSet->insert("static_cast"); + hlslReservedSet->insert("template"); + hlslReservedSet->insert("this"); + hlslReservedSet->insert("throw"); + hlslReservedSet->insert("try"); + hlslReservedSet->insert("typename"); + hlslReservedSet->insert("union"); + hlslReservedSet->insert("unsigned"); + hlslReservedSet->insert("using"); + hlslReservedSet->insert("virtual"); } void HlslScanContext::deleteKeywordMap() { - delete KeywordMap; - KeywordMap = nullptr; - delete ReservedSet; - ReservedSet = nullptr; + delete hlslKeywordMap; + hlslKeywordMap = nullptr; + delete hlslReservedSet; + hlslReservedSet = nullptr; } // Wrapper for tokenizeClass()"] = to get everything inside the token. @@ -426,7 +403,7 @@ EHlslTokenClass HlslScanContext::tokenizeClass(HlslToken& token) case '{': return EHTokLeftBrace; case '}': return EHTokRightBrace; case '\\': - parseContext.error(loc, "illegal use of escape character", "\\", ""); + _parseContext.error(loc, "illegal use of escape character", "\\", ""); break; case PpAtomAdd: return EHTokAddAssign; @@ -477,7 +454,7 @@ EHlslTokenClass HlslScanContext::tokenizeClass(HlslToken& token) char buf[2]; buf[0] = (char)ppToken.token; buf[1] = 0; - parseContext.error(loc, "unexpected token", buf, ""); + _parseContext.error(loc, "unexpected token", buf, ""); break; } } while (true); @@ -485,11 +462,11 @@ EHlslTokenClass HlslScanContext::tokenizeClass(HlslToken& token) EHlslTokenClass HlslScanContext::tokenizeIdentifier() { - if (ReservedSet->find(tokenText) != ReservedSet->end()) + if (hlslReservedSet->find(tokenText) != hlslReservedSet->end()) return reservedWord(); - auto it = KeywordMap->find(tokenText); - if (it == KeywordMap->end()) { + auto it = hlslKeywordMap->find(tokenText); + if (it == hlslKeywordMap->end()) { // Should have an identifier of some sort return identifierOrType(); } @@ -738,7 +715,7 @@ EHlslTokenClass HlslScanContext::tokenizeIdentifier() return keyword; default: - parseContext.infoSink.info.message(EPrefixInternalError, "Unknown glslang keyword", loc); + _parseContext.infoSink.info.message(EPrefixInternalError, "Unknown glslang keyword", loc); return EHTokNone; } } @@ -755,8 +732,8 @@ EHlslTokenClass HlslScanContext::identifierOrType() // extension support before the extension is enabled. EHlslTokenClass HlslScanContext::reservedWord() { - if (! parseContext.symbolTable.atBuiltInLevel()) - parseContext.error(loc, "Reserved word.", tokenText, "", ""); + if (!_parseContext.symbolTable.atBuiltInLevel()) + _parseContext.error(loc, "Reserved word.", tokenText, "", ""); return EHTokNone; } @@ -769,8 +746,8 @@ EHlslTokenClass HlslScanContext::identifierOrReserved(bool reserved) return EHTokNone; } - if (parseContext.forwardCompatible) - parseContext.warn(loc, "using future reserved keyword", tokenText, ""); + if (_parseContext.forwardCompatible) + _parseContext.warn(loc, "using future reserved keyword", tokenText, ""); return identifierOrType(); } @@ -779,7 +756,7 @@ EHlslTokenClass HlslScanContext::identifierOrReserved(bool reserved) // showed up. EHlslTokenClass HlslScanContext::nonreservedKeyword(int version) { - if (parseContext.version < version) + if (_parseContext.version < version) return identifierOrType(); return keyword; diff --git a/deps/glslang/glslang/hlsl/hlslScanContext.h b/deps/glslang/glslang/hlsl/hlslScanContext.h index 144a85343f..32cd0e7f20 100755 --- a/deps/glslang/glslang/hlsl/hlslScanContext.h +++ b/deps/glslang/glslang/hlsl/hlslScanContext.h @@ -74,8 +74,8 @@ struct HlslToken { // class HlslScanContext { public: - HlslScanContext(TParseContextBase& parseContext, TPpContext& ppContext) - : parseContext(parseContext), ppContext(ppContext) { } + HlslScanContext(TParseContextBase& _parseContext, TPpContext& ppContext) + : _parseContext(_parseContext), ppContext(ppContext) { } virtual ~HlslScanContext() { } static void fillInKeywordMap(); @@ -94,7 +94,7 @@ protected: EHlslTokenClass identifierOrReserved(bool reserved); EHlslTokenClass nonreservedKeyword(int version); - TParseContextBase& parseContext; + TParseContextBase&_parseContext; TPpContext& ppContext; TSourceLoc loc; TPpToken* ppToken; diff --git a/deps/libFLAC/bitreader.c b/deps/libFLAC/bitreader.c index a29334985a..902c3a3327 100644 --- a/deps/libFLAC/bitreader.c +++ b/deps/libFLAC/bitreader.c @@ -349,17 +349,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) +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) +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) +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; } @@ -478,7 +478,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) +FLAC__bool FLAC__bitreader_read_uint32_little_endian(FLAC__BitReader *br, FLAC__uint32 *val) { FLAC__uint32 x8, x32 = 0; diff --git a/deps/libz/adler32.c b/deps/libz/adler32.c index 67d6030f95..dad0dacf9d 100644 --- a/deps/libz/adler32.c +++ b/deps/libz/adler32.c @@ -8,6 +8,7 @@ #define ZLIB_INTERNAL #include #include +#include #define BASE 65521UL /* largest prime smaller than 65536 */ #define NMAX 5552 diff --git a/dist-scripts/dist-cores.sh b/dist-scripts/dist-cores.sh index d2e5fba30d..9153b6a4df 100755 --- a/dist-scripts/dist-cores.sh +++ b/dist-scripts/dist-cores.sh @@ -1,6 +1,6 @@ #!/bin/sh -source ../version.all +. ../version.all PLATFORM=$1 SALAMANDER=no MAKEFILE_GRIFFIN=no diff --git a/dist-scripts/wiiu-cores.sh b/dist-scripts/wiiu-cores.sh index 70c4777591..8d597243fe 100755 --- a/dist-scripts/wiiu-cores.sh +++ b/dist-scripts/wiiu-cores.sh @@ -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 -source ../version.all +. ../version.all platform=wiiu EXT=a diff --git a/dist-scripts/wiiu-new-cores.sh b/dist-scripts/wiiu-new-cores.sh index 1e8a53c463..9f595dcfd8 100755 --- a/dist-scripts/wiiu-new-cores.sh +++ b/dist-scripts/wiiu-new-cores.sh @@ -1,6 +1,6 @@ #!/bin/bash -source ../version.all +. ../version.all platform=wiiu EXT=a scriptDir= diff --git a/file_path_special.c b/file_path_special.c index f248a0bc6d..e58d10032f 100644 --- a/file_path_special.c +++ b/file_path_special.c @@ -383,19 +383,18 @@ void fill_pathname_application_special(char *s, void fill_short_pathname_representation_wrapper(char* out_rep, const char *in_path, size_t size) { - char *path_short = (char*)malloc(PATH_MAX_LENGTH * sizeof(char)); #ifdef HAVE_COMPRESSION + char *path_short = (char*)malloc(PATH_MAX_LENGTH * sizeof(char)); char *last_slash = NULL; -#endif - path_short[0] = '\0'; + path_short[0] = '\0'; fill_pathname(path_short, path_basename(in_path), "", PATH_MAX_LENGTH * sizeof(char) ); -#ifdef HAVE_COMPRESSION last_slash = find_last_slash(path_short); + if (last_slash != NULL) { /* We handle paths like: @@ -410,8 +409,9 @@ void fill_short_pathname_representation_wrapper(char* out_rep, free(path_short); return; } + + free(path_short); #endif fill_short_pathname_representation(out_rep, in_path, size); - free(path_short); } diff --git a/frontend/drivers/platform_unix.c b/frontend/drivers/platform_unix.c index 1262709da3..66dd728ad5 100644 --- a/frontend/drivers/platform_unix.c +++ b/frontend/drivers/platform_unix.c @@ -24,6 +24,7 @@ #include #include +#include #include #include @@ -35,7 +36,6 @@ #define INOTIFY_BUF_LEN (1024 * (sizeof(struct inotify_event) + 16)) #include -#include #define VECTOR_LIST_TYPE int #define VECTOR_LIST_NAME int @@ -2346,7 +2346,7 @@ static void frontend_unix_watch_path_for_changes(struct string_list *list, int f return; } - if (!socket_nonblock(fd)) + if (fcntl(fd, F_SETFL, fcntl(fd, F_GETFL) | O_NONBLOCK)) { RARCH_WARN("watch_path_for_changes: Could not set socket to non-blocking.\n"); return; diff --git a/frontend/drivers/platform_win32.c b/frontend/drivers/platform_win32.c index b0dec9dd78..cce85bce6e 100644 --- a/frontend/drivers/platform_win32.c +++ b/frontend/drivers/platform_win32.c @@ -41,6 +41,7 @@ #include "../../defaults.h" #include "../../retroarch.h" #include "../../verbosity.h" +#include "../../ui/drivers/ui_win32.h" /* We only load this library once, so we let it be * unloaded at application shutdown, since unloading diff --git a/frontend/drivers/platform_xdk.c b/frontend/drivers/platform_xdk.c index 461b84c523..82e68124f0 100644 --- a/frontend/drivers/platform_xdk.c +++ b/frontend/drivers/platform_xdk.c @@ -46,1031 +46,10 @@ #endif #include "../../verbosity.h" -#ifdef _XBOX360 - -#define AURORA_LAUNCHDATA_APPID 'AUOA' -#define AURORA_LAUNCHDATA_EXECUTABLE_FUNCID 'ROMS' -#define AURORA_LAUNCHDATA_EXECUTABLE_VERSION 1 - -typedef struct _AURORA_LAUNCHDATA_EXECUTABLE -{ - DWORD ApplicationId; // AURORA_LAUNCHDATA_APPID - DWORD FunctionId; // AURORA_LAUNCHDATA_EXECUTABLE_FUNCID - DWORD FunctionVersion; // AURORA_LAUNCHDATA_EXECUTABLE_VERSION - CHAR SystemPath[0x40]; // /System/Harddisk0/Parition0 - CHAR RelativePath[0x104]; // /SomeCore/Content/ - CHAR Exectutable[0x28]; // SomeContent.zip - CHAR Reserved[0x100]; // Reserved for future use -} AURORA_LAUNCHDATA_EXECUTABLE, *PAURORA_LAUNCH_DATA_EXECUTABLE; - -#endif - -#ifdef _XBOX1 - -#include - -// Don't do __declspec(dllimport) for things like emulators -#if defined(NTSYSAPI) && defined(DONT_IMPORT_INTERNAL) -#undef NTSYSAPI -#endif -#ifdef DONT_IMPORT_INTERNAL -#define NTSYSAPI -#endif - -// The normal headers don't have this...? -#define FASTCALL __fastcall - -// The usual NTSTATUS -typedef LONG NTSTATUS; - -// The usual NT_SUCCESS -#define NT_SUCCESS(Status) ((NTSTATUS)(Status) >= 0) - -// Just for documentation -#define EXPORTNUM(x) - - -// Needed for object structures and related things -typedef CONST SHORT CSHORT; - - -// String types -typedef CHAR *PSZ; -typedef CONST CHAR *PCSZ; - -// ANSI_STRING -// Differences from NT: None. -typedef struct _STRING { - USHORT Length; - USHORT MaximumLength; - PCHAR Buffer; -} STRING; -typedef STRING *PSTRING; - -typedef STRING ANSI_STRING; -typedef PSTRING PANSI_STRING; - - -// IO Status Block type (UNVERIFIED) -// Differences from NT: None. -typedef struct _IO_STATUS_BLOCK { - union { - NTSTATUS Status; - PVOID Pointer; - }; - - ULONG_PTR Information; -} IO_STATUS_BLOCK, *PIO_STATUS_BLOCK; - -// APC routine -typedef -VOID -(NTAPI *PIO_APC_ROUTINE) ( - IN PVOID ApcContext, - IN PIO_STATUS_BLOCK IoStatusBlock, - IN ULONG Reserved - ); - - -// Header for dispatcher objects -// Differences from NT: None. -typedef struct _DISPATCHER_HEADER { - UCHAR Type; - UCHAR Absolute; - UCHAR Size; - UCHAR Inserted; - LONG SignalState; - LIST_ENTRY WaitListHead; -} DISPATCHER_HEADER; - - -// Object types -#define NotificationTimerObject 8 -#define SynchronizationTimerObject 9 -#define DpcObject 19 - - -// Object Attributes type -// Differences from NT: There are no Length, SecurityDescriptor, or -// SecurityQualityOfService fields. Also, ObjectName is ANSI, not -// Unicode. -typedef struct _OBJECT_ATTRIBUTES { - HANDLE RootDirectory; - PANSI_STRING ObjectName; - ULONG Attributes; -} OBJECT_ATTRIBUTES; -typedef OBJECT_ATTRIBUTES *POBJECT_ATTRIBUTES; - -// Flags for OBJECT_ATTRIBUTES::Attributes -#define OBJ_INHERIT 0x00000002L -#define OBJ_PERMANENT 0x00000010L -#define OBJ_EXCLUSIVE 0x00000020L -#define OBJ_CASE_INSENSITIVE 0x00000040L -#define OBJ_OPENIF 0x00000080L -#define OBJ_OPENLINK 0x00000100L -#define OBJ_KERNEL_HANDLE 0x00000200L -#define OBJ_VALID_ATTRIBUTES 0x000003F2L - -// CreateDisposition values for NtCreateFile() -#define FILE_SUPERSEDE 0x00000000 -#define FILE_OPEN 0x00000001 -#define FILE_CREATE 0x00000002 -#define FILE_OPEN_IF 0x00000003 -#define FILE_OVERWRITE 0x00000004 -#define FILE_OVERWRITE_IF 0x00000005 -#define FILE_MAXIMUM_DISPOSITION 0x00000005 - -// CreateOption values for NtCreateFile() -// FILE_NON_DIRECTORY_FILE | FILE_SYNCHRONOUS_IO_NONALERT is what CreateFile -// uses for most things when translating to NtCreateFile. -#define FILE_DIRECTORY_FILE 0x00000001 -#define FILE_WRITE_THROUGH 0x00000002 -#define FILE_SEQUENTIAL_ONLY 0x00000004 -#define FILE_NO_INTERMEDIATE_BUFFERING 0x00000008 -#define FILE_SYNCHRONOUS_IO_ALERT 0x00000010 -#define FILE_SYNCHRONOUS_IO_NONALERT 0x00000020 -#define FILE_NON_DIRECTORY_FILE 0x00000040 -#define FILE_CREATE_TREE_CONNECTION 0x00000080 -#define FILE_COMPLETE_IF_OPLOCKED 0x00000100 -#define FILE_NO_EA_KNOWLEDGE 0x00000200 -#define FILE_OPEN_FOR_RECOVERY 0x00000400 -#define FILE_RANDOM_ACCESS 0x00000800 -#define FILE_DELETE_ON_CLOSE 0x00001000 -#define FILE_OPEN_BY_FILE_ID 0x00002000 -#define FILE_OPEN_FOR_BACKUP_INTENT 0x00004000 -#define FILE_NO_COMPRESSION 0x00008000 -#define FILE_RESERVE_OPFILTER 0x00100000 -#define FILE_OPEN_REPARSE_POINT 0x00200000 -#define FILE_OPEN_NO_RECALL 0x00400000 -#define FILE_OPEN_FOR_FREE_SPACE_QUERY 0x00800000 -#define FILE_COPY_STRUCTURED_STORAGE 0x00000041 -#define FILE_STRUCTURED_STORAGE 0x00000441 -#define FILE_VALID_OPTION_FLAGS 0x00ffffff -#define FILE_VALID_PIPE_OPTION_FLAGS 0x00000032 -#define FILE_VALID_MAILSLOT_OPTION_FLAGS 0x00000032 -#define FILE_VALID_SET_FLAGS 0x00000036 - - -// NtQueryVolumeInformation / NtSetVolumeInformation stuff -// Type of information to retrieve; FileFsSizeInformation and -// FileFsDeviceInformation are the only ones confirmed to work. -typedef enum _FSINFOCLASS { - FileFsVolumeInformation = 1, - FileFsLabelInformation, - FileFsSizeInformation, - FileFsDeviceInformation, - FileFsAttributeInformation, - FileFsControlInformation, - FileFsFullSizeInformation, - FileFsObjectInformation -} FS_INFORMATION_CLASS, *PFS_INFORMATION_CLASS; - -// Structure of FileFsSizeInformation -typedef struct _FILE_FS_SIZE_INFORMATION { - LARGE_INTEGER TotalAllocationUnits; - LARGE_INTEGER AvailableAllocationUnits; - ULONG SectorsPerAllocationUnit; - ULONG BytesPerSector; -} FILE_FS_SIZE_INFORMATION, *PFILE_FS_SIZE_INFORMATION; - -#define DEVICE_TYPE ULONG - -// Structure of FileFsDeviceInformation -typedef struct _FILE_FS_DEVICE_INFORMATION { - DEVICE_TYPE DeviceType; - ULONG Characteristics; -} FILE_FS_DEVICE_INFORMATION, *PFILE_FS_DEVICE_INFORMATION; - -// DEVICE_TYPEs (I took a guess as to which the XBOX might have.) -#define FILE_DEVICE_CD_ROM 0x00000002 -#define FILE_DEVICE_CD_ROM_FILE_SYSTEM 0x00000003 -#define FILE_DEVICE_CONTROLLER 0x00000004 -#define FILE_DEVICE_DISK 0x00000007 -#define FILE_DEVICE_DISK_FILE_SYSTEM 0x00000008 -#define FILE_DEVICE_FILE_SYSTEM 0x00000009 -#define FILE_DEVICE_NULL 0x00000015 -#define FILE_DEVICE_SCREEN 0x0000001c -#define FILE_DEVICE_SOUND 0x0000001d -#define FILE_DEVICE_UNKNOWN 0x00000022 -#define FILE_DEVICE_VIDEO 0x00000023 -#define FILE_DEVICE_VIRTUAL_DISK 0x00000024 -#define FILE_DEVICE_FULLSCREEN_VIDEO 0x00000034 - -// Characteristics -#define FILE_REMOVABLE_MEDIA 0x00000001 -#define FILE_READ_ONLY_DEVICE 0x00000002 -#define FILE_FLOPPY_DISKETTE 0x00000004 -#define FILE_WRITE_ONCE_MEDIA 0x00000008 -#define FILE_REMOTE_DEVICE 0x00000010 -#define FILE_DEVICE_IS_MOUNTED 0x00000020 -#define FILE_VIRTUAL_VOLUME 0x00000040 -#define FILE_AUTOGENERATED_DEVICE_NAME 0x00000080 -#define FILE_DEVICE_SECURE_OPEN 0x00000100 - -/* Physical address - * Differences from NT: 32 bit address instead of 64. */ -typedef ULONG PHYSICAL_ADDRESS, *PPHYSICAL_ADDRESS; - -/* NtCreateFile/NtOpenFile stuff */ -#define FILE_SUPERSEDED 0x00000000 -#define FILE_OPENED 0x00000001 -#define FILE_CREATED 0x00000002 -#define FILE_OVERWRITTEN 0x00000003 -#define FILE_EXISTS 0x00000004 -#define FILE_DOES_NOT_EXIST 0x00000005 - -// NtReadFile/NtWriteFile stuff -#define FILE_WRITE_TO_END_OF_FILE 0xffffffff -#define FILE_USE_FILE_POINTER_POSITION 0xfffffffe - -// Device types -#define FILE_DEVICE_CD_ROM 0x00000002 -#define FILE_DEVICE_CD_ROM_FILE_SYSTEM 0x00000003 -#define FILE_DEVICE_CONTROLLER 0x00000004 -#define FILE_DEVICE_SCSI FILE_DEVICE_CONTROLLER -#define IOCTL_SCSI_BASE FILE_DEVICE_CONTROLLER -#define FILE_DEVICE_DISK 0x00000007 -#define FILE_DEVICE_DISK_FILE_SYSTEM 0x00000008 -#define FILE_DEVICE_DVD 0x00000033 - -// Access types -#define FILE_ANY_ACCESS 0 -#define FILE_READ_ACCESS 0x0001 /* file & pipe */ -#define FILE_WRITE_ACCESS 0x0002 /* file & pipe */ - -// Method types -#define METHOD_BUFFERED 0 -#define METHOD_IN_DIRECT 1 -#define METHOD_OUT_DIRECT 2 -#define METHOD_NEITHER 3 - -// The all-important CTL_CODE -#define CTL_CODE( DeviceType, Function, Method, Access ) ( \ - ((DeviceType) << 16) | ((Access) << 14) | ((Function) << 2) | (Method) \ -) - -// IDE/SCSI codes -// IOCTL_SCSI_PASS_THROUGH_DIRECT is the only one known to be used. -// Differences from NT: None. -#define IOCTL_SCSI_PASS_THROUGH CTL_CODE(IOCTL_SCSI_BASE, 0x0401, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS) -#define IOCTL_SCSI_MINIPORT CTL_CODE(IOCTL_SCSI_BASE, 0x0402, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS) -#define IOCTL_SCSI_GET_INQUIRY_DATA CTL_CODE(IOCTL_SCSI_BASE, 0x0403, METHOD_BUFFERED, FILE_ANY_ACCESS) -#define IOCTL_SCSI_GET_CAPABILITIES CTL_CODE(IOCTL_SCSI_BASE, 0x0404, METHOD_BUFFERED, FILE_ANY_ACCESS) -#define IOCTL_SCSI_PASS_THROUGH_DIRECT CTL_CODE(IOCTL_SCSI_BASE, 0x0405, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS) -#define IOCTL_SCSI_GET_ADDRESS CTL_CODE(IOCTL_SCSI_BASE, 0x0406, METHOD_BUFFERED, FILE_ANY_ACCESS) -#define IOCTL_SCSI_RESCAN_BUS CTL_CODE(IOCTL_SCSI_BASE, 0x0407, METHOD_BUFFERED, FILE_ANY_ACCESS) -#define IOCTL_SCSI_GET_DUMP_POINTERS CTL_CODE(IOCTL_SCSI_BASE, 0x0408, METHOD_BUFFERED, FILE_ANY_ACCESS) -#define IOCTL_SCSI_FREE_DUMP_POINTERS CTL_CODE(IOCTL_SCSI_BASE, 0x0409, METHOD_BUFFERED, FILE_ANY_ACCESS) -#define IOCTL_IDE_PASS_THROUGH CTL_CODE(IOCTL_SCSI_BASE, 0x040a, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS) - -// Special XBOX code? -#define IOCTL_CDROM_AUTHENTICATE_DISK CTL_CODE(FILE_DEVICE_CD_ROM, 0x0020, METHOD_BUFFERED, FILE_READ_ACCESS) - -/* Structure for IOCTL_SCSI_PASS_THROUGH_DIRECT - * Differences from NT: None, believe it or not. */ -typedef struct _SCSI_PASS_THROUGH_DIRECT { - /*000*/ USHORT Length; - /*002*/ UCHAR ScsiStatus; - /*003*/ UCHAR PathId; - /*004*/ UCHAR TargetId; - /*005*/ UCHAR Lun; - /*006*/ UCHAR CdbLength; - /*007*/ UCHAR SenseInfoLength; - /*008*/ UCHAR DataIn; - /*00C*/ ULONG DataTransferLength; - /*010*/ ULONG TimeOutValue; - /*014*/ PVOID DataBuffer; - /*018*/ ULONG SenseInfoOffset; - /*01C*/ UCHAR Cdb[16]; -}SCSI_PASS_THROUGH_DIRECT, *PSCSI_PASS_THROUGH_DIRECT; - -/* DataIn fields for IOCTL_SCSI_PASS_THROUGH_DIRECT */ -#define SCSI_IOCTL_DATA_OUT 0 -#define SCSI_IOCTL_DATA_IN 1 -#define SCSI_IOCTL_DATA_UNSPECIFIED 2 - -/* Kernel object type (unsure about the structure...) */ -typedef struct _OBJECT_TYPE -{ - // Same prototype as ExAllocatePoolWithTag, because that's the usual one - PVOID - (NTAPI *AllocationFunction)( - SIZE_T NumberOfBytes, - ULONG Tag - ); - - // Same prototype as ExFreePool, because that's the usual one - VOID - (NTAPI *FreeFunction)( - IN PVOID P - ); - - // The prototypes of these are unknown - void *CloseFunction; - void *DeleteFunction; - void *ParseFunction; - - // Unknown DWORD... Size of this object type maybe? - void *DefaultObjectMaybe; - - // 4 letter tag for this object type - CHAR Tag[4]; -} OBJECT_TYPE; -typedef OBJECT_TYPE *POBJECT_TYPE; - -// Object types -extern POBJECT_TYPE IoFileObjectType; -extern POBJECT_TYPE ExEventObjectType; -extern POBJECT_TYPE ExSemaphoreObjectType; -extern POBJECT_TYPE IoCompletionObjectType; -extern POBJECT_TYPE IoDeviceObjectType; - - -// *_OBJECT and related structures (mostly opaque since I'm lazy) -typedef struct _DRIVER_OBJECT { - CSHORT Type; - CSHORT Size; - struct _DEVICE_OBJECT *DeviceObject; - // ... -} DRIVER_OBJECT; -typedef DRIVER_OBJECT *PDRIVER_OBJECT; - -typedef struct _DEVICE_OBJECT { - CSHORT Type; - USHORT Size; - LONG ReferenceCount; - PDRIVER_OBJECT DriverObject; - // ... -} DEVICE_OBJECT; -typedef DEVICE_OBJECT *PDEVICE_OBJECT; - -typedef struct _FILE_OBJECT { - CSHORT Type; - CSHORT Size; - PDEVICE_OBJECT DeviceObject; - // ... -} FILE_OBJECT; -typedef FILE_OBJECT *PFILE_OBJECT; - - -/* Thread information structures */ - -/* IRQL */ -typedef UCHAR KIRQL, *PKIRQL; -#define PASSIVE_LEVEL 0 // Passive release level -#define LOW_LEVEL 0 // Lowest interrupt level -#define APC_LEVEL 1 // APC interrupt level -#define DISPATCH_LEVEL 2 // Dispatcher level - -// Thread entry point -// NOTE: This is not a standard call! You can't call this function from C code! -// You push registers like stdcall, but ebp + 4 must point to the first argument before the call! -// -// Differences from NT: 2 parameters instead of 1; strange calling convention -typedef -VOID -(NTAPI *PKSTART_ROUTINE) ( - IN PVOID StartContext1, - IN PVOID StartContext2 - ); - -// Structure of a critical section -// Same as the XBOX's RTL_CRITICAL_SECTION, but with the more explicit header -typedef struct _KCRITICAL_SECTION -{ - // 000 Dispatcher header - DISPATCHER_HEADER Header; - // 010 Lock count of the critical section - LONG LockCount; - // 014 Recursion count of the critical section - LONG RecursionCount; - // 018 Thread ID of the thread that currently owns this critical section - ULONG OwningThread; -} KCRITICAL_SECTION, *PKCRITICAL_SECTION; - -// Structure of a thread object -typedef struct _KTHREAD -{ - // 000 Dispatcher header - DISPATCHER_HEADER Header; - // 010 Unknown - BYTE unknown[0x18]; - // 028 Pointer to TLS data - PVOID TlsData; - // ??? just padding - real size is unknown - BYTE unknown2[0x100]; -} KTHREAD, *PKTHREAD; - -// Structure of the data at FS -typedef struct _FS_STRUCTURE -{ - // 000 Current exception handler information - PVOID *ExceptionFrame; - // 004 Pointer to current TLS data top - PVOID TlsDataTop; - // 008 - BYTE unknown2[0x1C]; - // 024 Current IRQL of the OS - KIRQL CurrentIrql; - // 028 Thread structure of the current thread - PKTHREAD ThreadObject; - // ??? just padding - real size is unknown - BYTE unknown3[0x100]; -} FS_STRUCTURE, *PFS_STRUCTURE; - -// DPC routine -typedef -VOID -(*PKDEFERRED_ROUTINE) ( - IN struct _KDPC *Dpc, - IN PVOID DeferredContext, - IN PVOID SystemArgument1, - IN PVOID SystemArgument2 - ); - -// DPC information -// It's not known which of these fields are used on XBOX. -typedef struct _KDPC { - CSHORT Type; - UCHAR Number; - UCHAR Importance; - LIST_ENTRY DpcListEntry; - PKDEFERRED_ROUTINE DeferredRoutine; - PVOID DeferredContext; - PVOID SystemArgument1; - PVOID SystemArgument2; - PULONG_PTR Lock; -} KDPC, *PKDPC; - - -// Timers -typedef enum _TIMER_TYPE { - NotificationTimer, - SynchronizationTimer - } TIMER_TYPE; - -typedef struct _KTIMER { - DISPATCHER_HEADER Header; - ULARGE_INTEGER DueTime; - LIST_ENTRY TimerListEntry; - struct _KDPC *Dpc; - LONG Period; -} KTIMER, *PKTIMER; - -/* XBE stuff - * Not used in any exported kernel calls, but still useful. - */ - -/* XBE header information */ -typedef struct _XBE_HEADER -{ - // 000 "XBEH" - CHAR Magic[4]; - // 004 RSA digital signature of the entire header area - UCHAR HeaderSignature[256]; - // 104 Base address of XBE image (must be 0x00010000?) - PVOID BaseAddress; - // 108 Size of all headers combined - other headers must be within this - ULONG HeaderSize; - // 10C Size of entire image - ULONG ImageSize; - // 110 Size of this header (always 0x178?) - ULONG XbeHeaderSize; - // 114 Image timestamp - unknown format - ULONG Timestamp; - // 118 Pointer to certificate data (must be within HeaderSize) - struct _XBE_CERTIFICATE *Certificate; - // 11C Number of sections - DWORD NumSections; - // 120 Pointer to section headers (must be within HeaderSize) - struct _XBE_SECTION *Sections; - // 124 Initialization flags - ULONG InitFlags; - // 128 Entry point (XOR'd; see xboxhacker.net) - PVOID EntryPoint; - // 12C Pointer to TLS directory - struct _XBE_TLS_DIRECTORY *TlsDirectory; - // 130 Stack commit size - ULONG StackCommit; - // 134 Heap reserve size - ULONG HeapReserve; - // 138 Heap commit size - ULONG HeapCommit; - // 13C PE base address (?) - PVOID PeBaseAddress; - // 140 PE image size (?) - ULONG PeImageSize; - // 144 PE checksum (?) - ULONG PeChecksum; - // 148 PE timestamp (?) - ULONG PeTimestamp; - // 14C PC path and filename to EXE file from which XBE is derived - PCSZ PcExePath; - // 150 PC filename (last part of PcExePath) from which XBE is derived - PCSZ PcExeFilename; - // 154 PC filename (Unicode version of PcExeFilename) - PWSTR PcExeFilenameUnicode; - // 158 Pointer to kernel thunk table (XOR'd; EFB1F152 debug) - ULONG_PTR *KernelThunkTable; - // 15C Non-kernel import table (debug only) - PVOID DebugImportTable; - // 160 Number of library headers - ULONG NumLibraries; - // 164 Pointer to library headers - struct _XBE_LIBRARY *Libraries; - // 168 Pointer to kernel library header - struct _XBE_LIBRARY *KernelLibrary; - // 16C Pointer to XAPI library - struct _XBE_LIBRARY *XapiLibrary; - // 170 Pointer to logo bitmap (NULL = use default of Microsoft) - PVOID LogoBitmap; - // 174 Size of logo bitmap - ULONG LogoBitmapSize; - // 178 -} XBE_HEADER, *PXBE_HEADER; - -// Certificate structure -typedef struct _XBE_CERTIFICATE { - // 000 Size of certificate - ULONG Size; - // 004 Certificate timestamp (unknown format) - ULONG Timestamp; - // 008 Title ID - ULONG TitleId; - // 00C Name of the game (Unicode) - WCHAR TitleName[40]; - // 05C Alternate title ID's (0-terminated) - ULONG AlternateTitleIds[16]; - // 09C Allowed media types - 1 bit match between XBE and media = boots - ULONG MediaTypes; - // 0A0 Allowed game regions - 1 bit match between this and XBOX = boots - ULONG GameRegion; - // 0A4 Allowed game ratings - 1 bit match between this and XBOX = boots - ULONG GameRating; - // 0A8 Disk number (?) - ULONG DiskNumber; - // 0AC Version (?) - ULONG Version; - // 0B0 LAN key for this game - UCHAR LanKey[16]; - // 0C0 Signature key for this game - UCHAR SignatureKey[16]; - // 0D0 Signature keys for the alternate title ID's - UCHAR AlternateSignatureKeys[16][16]; - // 1D0 -} XBE_CERTIFICATE, *PXBE_CERTIFICATE; - -// Section headers -typedef struct _XBE_SECTION { - // 000 Flags - ULONG Flags; - // 004 Virtual address (where this section loads in RAM) - PVOID VirtualAddress; - // 008 Virtual size (size of section in RAM; after FileSize it's 00'd) - ULONG VirtualSize; - // 00C File address (where in the file from which this section comes) - ULONG FileAddress; - // 010 File size (size of the section in the XBE file) - ULONG FileSize; - // 014 Pointer to section name - PCSZ SectionName; - // 018 Section reference count - when >= 1, section is loaded - LONG SectionReferenceCount; - // 01C Pointer to head shared page reference count - WORD *HeadReferenceCount; - // 020 Pointer to tail shared page reference count - WORD *TailReferenceCount; - // 024 SHA hash. Hash DWORD containing FileSize, then hash section. - DWORD ShaHash[5]; - // 038 -} XBE_SECTION, *PXBE_SECTION; - -/* TLS directory information needed later - * Library version data needed later */ - -/* Initialization flags */ -#define XBE_INIT_MOUNT_UTILITY 0x00000001 -#define XBE_INIT_FORMAT_UTILITY 0x00000002 -#define XBE_INIT_64M_RAM_ONLY 0x00000004 -#define XBE_INIT_DONT_SETUP_HDD 0x00000008 - -/* Region codes */ -#define XBE_REGION_US_CANADA 0x00000001 -#define XBE_REGION_JAPAN 0x00000002 -#define XBE_REGION_ELSEWHERE 0x00000004 -#define XBE_REGION_DEBUG 0x80000000 - -/* Media types */ -#define XBE_MEDIA_HDD 0x00000001 -#define XBE_MEDIA_XBOX_DVD 0x00000002 -#define XBE_MEDIA_ANY_CD_OR_DVD 0x00000004 -#define XBE_MEDIA_CD 0x00000008 -#define XBE_MEDIA_1LAYER_DVDROM 0x00000010 -#define XBE_MEDIA_2LAYER_DVDROM 0x00000020 -#define XBE_MEDIA_1LAYER_DVDR 0x00000040 -#define XBE_MEDIA_2LAYER_DVDR 0x00000080 -#define XBE_MEDIA_USB 0x00000100 -#define XBE_MEDIA_ALLOW_UNLOCKED_HDD 0x40000000 - -/* Section flags */ -#define XBE_SEC_WRITABLE 0x00000001 -#define XBE_SEC_PRELOAD 0x00000002 -#define XBE_SEC_EXECUTABLE 0x00000004 -#define XBE_SEC_INSERTED_FILE 0x00000008 -#define XBE_SEC_RO_HEAD_PAGE 0x00000010 -#define XBE_SEC_RO_TAIL_PAGE 0x00000020 - -/* x86 page size */ -#define PAGE_SIZE 0x1000 - -/* Native NT API calls on the XBOX */ - -/* PAGE_ALIGN: - * Returns an address rounded down to the nearest page boundary. - * - * Differences from NT: None. - */ -#define PAGE_ALIGN(Va) ((PVOID)((ULONG_PTR)(Va) & ~(PAGE_SIZE - 1))) - -// NtReadFile: -// Reads a file. -// -// Differences from NT: There is no Key parameter. -NTSYSAPI -EXPORTNUM(219) -NTSTATUS -NTAPI -NtReadFile( - IN HANDLE FileHandle, - IN HANDLE Event OPTIONAL, - IN PIO_APC_ROUTINE ApcRoutine OPTIONAL, - IN PVOID ApcContext OPTIONAL, - OUT PIO_STATUS_BLOCK IoStatusBlock, - OUT PVOID Buffer, - IN ULONG Length, - IN PLARGE_INTEGER ByteOffset - ); - -// NtWriteFile: -// Writes a file. -// -// Differences from NT: There is no Key parameter. -NTSYSAPI -EXPORTNUM(236) -NTSTATUS -NTAPI -NtWriteFile( - IN HANDLE FileHandle, - IN HANDLE Event OPTIONAL, - IN PIO_APC_ROUTINE ApcRoutine OPTIONAL, - IN PVOID ApcContext OPTIONAL, - OUT PIO_STATUS_BLOCK IoStatusBlock, - IN PVOID Buffer, - IN ULONG Length, - IN PLARGE_INTEGER ByteOffset - ); - -// NtQueryVolumeInformation: -// Queries information about a file system. This is not documented by -// Microsoft even under NT. -// -// Differences from NT: None known. -NTSYSAPI -EXPORTNUM(218) -NTSTATUS -NTAPI -NtQueryVolumeInformationFile( - IN HANDLE FileHandle, - OUT PIO_STATUS_BLOCK IoStatusBlock, - OUT PVOID VolumeInformation, - IN ULONG VolumeInformationLength, - IN FS_INFORMATION_CLASS VolumeInformationClass - ); - -// NtClose: -// Closes a file or other handle. -// -// Differences from NT: None. -NTSYSAPI -EXPORTNUM(187) -NTSTATUS -NTAPI -NtClose( - IN HANDLE Handle - ); - -// NtAllocateVirtualMemory: -// Allocates virtual memory. -// -// Differences from NT: There is no ProcessHandle parameter. -NTSYSAPI -EXPORTNUM(184) -NTSTATUS -NTAPI -NtAllocateVirtualMemory( - IN OUT PVOID *BaseAddress, - IN ULONG ZeroBits, - IN OUT PULONG AllocationSize, - IN ULONG AllocationType, - IN ULONG Protect - ); - -// NtFreeVirtualMemory: -// Frees virtual memory. -// -// Differences from NT: There is no ProcessHandle parameter. -NTSYSAPI -EXPORTNUM(199) -NTSTATUS -NTAPI -NtFreeVirtualMemory( - IN OUT PVOID *BaseAddress, - IN OUT PULONG FreeSize, - IN ULONG FreeType - ); - - -// Kernel-level routines - -// MmMapIoSpace: -// Maps a physical address area into the virtual address space. -// DO NOT USE MEMORY MAPPED WITH THIS AS A BUFFER TO OTHER CALLS. For -// example, don't WriteFile or NtWriteFile these buffers. Copy them first. -// -// Differences from NT: PhysicalAddress is 32 bit, not 64. ProtectionType -// specifies the page protections, but it's a Win32 PAGE_ macro instead -// of the normal NT enumeration. PAGE_READWRITE is probably what you -// want... -NTSYSAPI -EXPORTNUM(177) -PVOID -NTAPI -MmMapIoSpace( - IN PHYSICAL_ADDRESS PhysicalAddress, - IN ULONG NumberOfBytes, - IN ULONG ProtectionType - ); - -// MmGetPhysicalAddress: -// Translates a virtual address into a physical address. -// -// Differences from NT: PhysicalAddress is 32 bit, not 64. -NTSYSAPI -EXPORTNUM(173) -PHYSICAL_ADDRESS -NTAPI -MmGetPhysicalAddress( - IN PVOID BaseAddress - ); - -// MmUnmapIoSpace: -// Unmaps a virtual address mapping made by MmMapIoSpace. -// -// Differences from NT: None. -NTSYSAPI -EXPORTNUM(183) -PVOID -NTAPI -MmUnmapIoSpace( - IN PVOID BaseAddress, - IN ULONG NumberOfBytes - ); - -// MmAllocateContiguousMemory: -// Allocates a range of physically contiguous, cache-aligned memory from the -// non-paged pool (= main pool on XBOX). -// -// Differences from NT: HighestAcceptableAddress was deleted, opting instead -// to not care about the highest address. -NTSYSAPI -EXPORTNUM(165) -PVOID -NTAPI -MmAllocateContiguousMemory( - IN ULONG NumberOfBytes - ); - -// MmFreeContiguousMemory: -// Frees memory allocated with MmAllocateContiguousMemory. -// -// Differences from NT: None. -NTSYSAPI -EXPORTNUM(171) -VOID -NTAPI -MmFreeContiguousMemory( - IN PVOID BaseAddress - ); - -// IoCreateSymbolicLink: -// Creates a symbolic link in the object namespace. -// NtCreateSymbolicLinkObject is much harder to use than this simple -// function, so just use this one. -// -// Differences from NT: Uses ANSI_STRING instead of UNICODE_STRING. -NTSYSAPI -EXPORTNUM(67) -NTSTATUS -NTAPI -IoCreateSymbolicLink( - IN PANSI_STRING SymbolicLinkName, - IN PANSI_STRING DeviceName - ); - -// IoDeleteSymbolicLink: -// Creates a symbolic link in the object namespace. Deleting symbolic links -// through the Nt* functions is a pain, so use this instead. -// -// Differences from NT: Uses ANSI_STRING instead of UNICODE_STRING. -NTSYSAPI -EXPORTNUM(69) -NTSTATUS -NTAPI -IoDeleteSymbolicLink( - IN PANSI_STRING SymbolicLinkName - ); - - -// ObReferenceObjectByHandle: -// Turns a handle into a kernel object pointer. The ObjectType parameter -// specifies what type of object it is. This function also increments the -// object's reference count. -// -// Differences from NT: There are no DesiredAccess, AccessMode, or -// HandleInformation parameters. -NTSYSAPI -EXPORTNUM(246) -NTSTATUS -NTAPI -ObReferenceObjectByHandle( - IN HANDLE Handle, - IN POBJECT_TYPE ObjectType OPTIONAL, - OUT PVOID *Object - ); - -// ObfReferenceObject/ObReferenceObject: -// Increments the object's reference count. -// -// Differences from NT: None. -#define ObReferenceObject(Object) ObfReferenceObject(Object) -NTSYSAPI -EXPORTNUM(251) -VOID -FASTCALL -ObfReferenceObject( - IN PVOID Object - ); - -// ObfDereferenceObject/ObDereferenceObject: -// Decrements the object's reference count, deleting it if it is now unused. -// -// Differences from NT: None. -#define ObDereferenceObject(a) ObfDereferenceObject(a) -NTSYSAPI -EXPORTNUM(250) -VOID -FASTCALL -ObfDereferenceObject( - IN PVOID Object - ); - -// Kernel routines only in the XBOX - -// HalEnableSecureTrayEject: -// Notifies the SMBUS that ejecting the DVD-ROM should not reset the system. -// Note that this function can't really be called directly... -// -// New to the XBOX. -NTSYSAPI -EXPORTNUM(365) -VOID -NTAPI -HalEnableSecureTrayEject( - VOID - ); - -// XeLoadSection: -// Adds one to the reference count of the specified section and loads if the -// count is now above zero. -// -// New to the XBOX. -NTSYSAPI -EXPORTNUM(327) -NTSTATUS -NTAPI -XeLoadSection( - IN OUT PXBE_SECTION section - ); - -/* Error codes */ -#define STATUS_SUCCESS 0x00000000 -#define STATUS_UNSUCCESSFUL 0xC0000001 -#define STATUS_UNRECOGNIZED_MEDIA 0xC0000014 - -/* The SCSI input buffer was too large (not necessarily an error!) */ -#define STATUS_DATA_OVERRUN 0xC000003C -#define STATUS_INVALID_IMAGE_FORMAT 0xC000007B -#define STATUS_INSUFFICIENT_RESOURCES 0xC000009A -#define STATUS_TOO_MANY_SECRETS 0xC0000156 -#define STATUS_REGION_MISMATCH 0xC0050001 - -#include - - // Thanks and credit go to Woodoo - extern VOID WINAPI HalWriteSMBusValue(BYTE, BYTE, BOOL, BYTE); - extern VOID WINAPI HalReadSMCTrayState(DWORD* state, DWORD* count); - - // Thanks and credit go to Team Evox - extern VOID WINAPI HalReturnToFirmware(DWORD); - - extern INT WINAPI XNetLoadConfigParams(LPBYTE); - extern INT WINAPI XNetSaveConfigParams(LPBYTE); - - extern INT WINAPI XWriteTitleInfoNoReboot(LPVOID,LPVOID,DWORD,DWORD,LPVOID); - - extern DWORD* LaunchDataPage; -#endif +#include "platform_xdk.h" static enum frontend_fork xdk_fork_mode = FRONTEND_FORK_NONE; -#ifdef _XBOX360 -typedef struct _STRING -{ - USHORT Length; - USHORT MaximumLength; - PCHAR Buffer; -} STRING, *PSTRING; - -VOID RtlInitAnsiString(PSTRING DestinationString, PCHAR SourceString); -HRESULT ObDeleteSymbolicLink(PSTRING SymbolicLinkName); -HRESULT ObCreateSymbolicLink(PSTRING SymbolicLinkName, PSTRING DeviceName); - -static HRESULT xbox_io_mount(const char* szDrive, char* szDevice) -{ - STRING DeviceName, LinkName; - char szDestinationDrive[PATH_MAX_LENGTH]; - - snprintf(szDestinationDrive, sizeof(szDestinationDrive), - "\\??\\%s", szDrive); - RtlInitAnsiString(&DeviceName, szDevice); - RtlInitAnsiString(&LinkName, (PCHAR)szDestinationDrive); - ObDeleteSymbolicLink(&LinkName); - return (HRESULT)ObCreateSymbolicLink(&LinkName, &DeviceName); -} -#endif - -#ifdef _XBOX1 -static HRESULT xbox_io_mount(char *szDrive, char *szDevice) -{ - STRING DeviceName, LinkName; -#ifndef IS_SALAMANDER - bool original_verbose = verbosity_is_enabled(); -#endif - char szSourceDevice[48] = {0}; - char szDestinationDrive[16] = {0}; - - snprintf(szSourceDevice, sizeof(szSourceDevice), - "\\Device\\%s", szDevice); - snprintf(szDestinationDrive, sizeof(szDestinationDrive), - "\\??\\%s", szDrive); - - DeviceName.Length = strlen(szSourceDevice); - DeviceName.MaximumLength = strlen(szSourceDevice) + 1; - DeviceName.Buffer = szSourceDevice; - - LinkName.Length = strlen(szDestinationDrive); - LinkName.MaximumLength = strlen(szDestinationDrive) + 1; - LinkName.Buffer = szDestinationDrive; - - IoCreateSymbolicLink(&LinkName, &DeviceName); - -#ifndef IS_SALAMANDER - if (original_verbose) - verbosity_enable(); - else - verbosity_disable(); -#endif - return S_OK; -} - -static HRESULT xbox_io_unmount(char *szDrive) -{ - STRING LinkName; - char szDestinationDrive[16] = {0}; - - snprintf(szDestinationDrive, sizeof(szDestinationDrive), - "\\??\\%s", szDrive); - - LinkName.Length = strlen(szDestinationDrive); - LinkName.MaximumLength = strlen(szDestinationDrive) + 1; - LinkName.Buffer = szDestinationDrive; - - IoDeleteSymbolicLink(&LinkName); - - return S_OK; -} -#endif - static void frontend_xdk_get_environment_settings(int *argc, char *argv[], void *args, void *params_data) { @@ -1189,19 +168,11 @@ static void frontend_xdk_get_environment_settings(int *argc, char *argv[], { char *extracted_path = (char*)calloc(dwLaunchDataSize, sizeof(char)); BYTE* pLaunchData = (BYTE*)calloc(dwLaunchDataSize, sizeof(BYTE)); - AURORA_LAUNCHDATA_EXECUTABLE* aurora = (AURORA_LAUNCHDATA_EXECUTABLE*)pLaunchData; 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) - snprintf(extracted_path, dwLaunchDataSize, - "aurora:%s%s", aurora->RelativePath, aurora->Exectutable); - } - else - strlcpy(extracted_path, pLaunchData, dwLaunchDataSize); + strlcpy(extracted_path, pLaunchData, dwLaunchDataSize); /* Auto-start game */ if (!string_is_empty(extracted_path)) diff --git a/frontend/drivers/platform_xdk.h b/frontend/drivers/platform_xdk.h new file mode 100644 index 0000000000..fa6121fca6 --- /dev/null +++ b/frontend/drivers/platform_xdk.h @@ -0,0 +1,1000 @@ +#ifdef _XBOX1 +#include + +// Don't do __declspec(dllimport) for things like emulators +#if defined(NTSYSAPI) && defined(DONT_IMPORT_INTERNAL) +#undef NTSYSAPI +#endif +#ifdef DONT_IMPORT_INTERNAL +#define NTSYSAPI +#endif + +// The normal headers don't have this...? +#define FASTCALL __fastcall + +// The usual NTSTATUS +typedef LONG NTSTATUS; + +// The usual NT_SUCCESS +#define NT_SUCCESS(Status) ((NTSTATUS)(Status) >= 0) + +// Just for documentation +#define EXPORTNUM(x) + + +// Needed for object structures and related things +typedef CONST SHORT CSHORT; + + +// String types +typedef CHAR *PSZ; +typedef CONST CHAR *PCSZ; + +// ANSI_STRING +// Differences from NT: None. +typedef struct _STRING { + USHORT Length; + USHORT MaximumLength; + PCHAR Buffer; +} STRING; +typedef STRING *PSTRING; + +typedef STRING ANSI_STRING; +typedef PSTRING PANSI_STRING; + + +// IO Status Block type (UNVERIFIED) +// Differences from NT: None. +typedef struct _IO_STATUS_BLOCK { + union { + NTSTATUS Status; + PVOID Pointer; + }; + + ULONG_PTR Information; +} IO_STATUS_BLOCK, *PIO_STATUS_BLOCK; + +// APC routine +typedef +VOID +(NTAPI *PIO_APC_ROUTINE) ( + IN PVOID ApcContext, + IN PIO_STATUS_BLOCK IoStatusBlock, + IN ULONG Reserved + ); + + +// Header for dispatcher objects +// Differences from NT: None. +typedef struct _DISPATCHER_HEADER { + UCHAR Type; + UCHAR Absolute; + UCHAR Size; + UCHAR Inserted; + LONG SignalState; + LIST_ENTRY WaitListHead; +} DISPATCHER_HEADER; + + +// Object types +#define NotificationTimerObject 8 +#define SynchronizationTimerObject 9 +#define DpcObject 19 + + +// Object Attributes type +// Differences from NT: There are no Length, SecurityDescriptor, or +// SecurityQualityOfService fields. Also, ObjectName is ANSI, not +// Unicode. +typedef struct _OBJECT_ATTRIBUTES { + HANDLE RootDirectory; + PANSI_STRING ObjectName; + ULONG Attributes; +} OBJECT_ATTRIBUTES; +typedef OBJECT_ATTRIBUTES *POBJECT_ATTRIBUTES; + +// Flags for OBJECT_ATTRIBUTES::Attributes +#define OBJ_INHERIT 0x00000002L +#define OBJ_PERMANENT 0x00000010L +#define OBJ_EXCLUSIVE 0x00000020L +#define OBJ_CASE_INSENSITIVE 0x00000040L +#define OBJ_OPENIF 0x00000080L +#define OBJ_OPENLINK 0x00000100L +#define OBJ_KERNEL_HANDLE 0x00000200L +#define OBJ_VALID_ATTRIBUTES 0x000003F2L + +// CreateDisposition values for NtCreateFile() +#define FILE_SUPERSEDE 0x00000000 +#define FILE_OPEN 0x00000001 +#define FILE_CREATE 0x00000002 +#define FILE_OPEN_IF 0x00000003 +#define FILE_OVERWRITE 0x00000004 +#define FILE_OVERWRITE_IF 0x00000005 +#define FILE_MAXIMUM_DISPOSITION 0x00000005 + +// CreateOption values for NtCreateFile() +// FILE_NON_DIRECTORY_FILE | FILE_SYNCHRONOUS_IO_NONALERT is what CreateFile +// uses for most things when translating to NtCreateFile. +#define FILE_DIRECTORY_FILE 0x00000001 +#define FILE_WRITE_THROUGH 0x00000002 +#define FILE_SEQUENTIAL_ONLY 0x00000004 +#define FILE_NO_INTERMEDIATE_BUFFERING 0x00000008 +#define FILE_SYNCHRONOUS_IO_ALERT 0x00000010 +#define FILE_SYNCHRONOUS_IO_NONALERT 0x00000020 +#define FILE_NON_DIRECTORY_FILE 0x00000040 +#define FILE_CREATE_TREE_CONNECTION 0x00000080 +#define FILE_COMPLETE_IF_OPLOCKED 0x00000100 +#define FILE_NO_EA_KNOWLEDGE 0x00000200 +#define FILE_OPEN_FOR_RECOVERY 0x00000400 +#define FILE_RANDOM_ACCESS 0x00000800 +#define FILE_DELETE_ON_CLOSE 0x00001000 +#define FILE_OPEN_BY_FILE_ID 0x00002000 +#define FILE_OPEN_FOR_BACKUP_INTENT 0x00004000 +#define FILE_NO_COMPRESSION 0x00008000 +#define FILE_RESERVE_OPFILTER 0x00100000 +#define FILE_OPEN_REPARSE_POINT 0x00200000 +#define FILE_OPEN_NO_RECALL 0x00400000 +#define FILE_OPEN_FOR_FREE_SPACE_QUERY 0x00800000 +#define FILE_COPY_STRUCTURED_STORAGE 0x00000041 +#define FILE_STRUCTURED_STORAGE 0x00000441 +#define FILE_VALID_OPTION_FLAGS 0x00ffffff +#define FILE_VALID_PIPE_OPTION_FLAGS 0x00000032 +#define FILE_VALID_MAILSLOT_OPTION_FLAGS 0x00000032 +#define FILE_VALID_SET_FLAGS 0x00000036 + + +// NtQueryVolumeInformation / NtSetVolumeInformation stuff +// Type of information to retrieve; FileFsSizeInformation and +// FileFsDeviceInformation are the only ones confirmed to work. +typedef enum _FSINFOCLASS { + FileFsVolumeInformation = 1, + FileFsLabelInformation, + FileFsSizeInformation, + FileFsDeviceInformation, + FileFsAttributeInformation, + FileFsControlInformation, + FileFsFullSizeInformation, + FileFsObjectInformation +} FS_INFORMATION_CLASS, *PFS_INFORMATION_CLASS; + +// Structure of FileFsSizeInformation +typedef struct _FILE_FS_SIZE_INFORMATION { + LARGE_INTEGER TotalAllocationUnits; + LARGE_INTEGER AvailableAllocationUnits; + ULONG SectorsPerAllocationUnit; + ULONG BytesPerSector; +} FILE_FS_SIZE_INFORMATION, *PFILE_FS_SIZE_INFORMATION; + +#define DEVICE_TYPE ULONG + +// Structure of FileFsDeviceInformation +typedef struct _FILE_FS_DEVICE_INFORMATION { + DEVICE_TYPE DeviceType; + ULONG Characteristics; +} FILE_FS_DEVICE_INFORMATION, *PFILE_FS_DEVICE_INFORMATION; + +// DEVICE_TYPEs (I took a guess as to which the XBOX might have.) +#define FILE_DEVICE_CD_ROM 0x00000002 +#define FILE_DEVICE_CD_ROM_FILE_SYSTEM 0x00000003 +#define FILE_DEVICE_CONTROLLER 0x00000004 +#define FILE_DEVICE_DISK 0x00000007 +#define FILE_DEVICE_DISK_FILE_SYSTEM 0x00000008 +#define FILE_DEVICE_FILE_SYSTEM 0x00000009 +#define FILE_DEVICE_NULL 0x00000015 +#define FILE_DEVICE_SCREEN 0x0000001c +#define FILE_DEVICE_SOUND 0x0000001d +#define FILE_DEVICE_UNKNOWN 0x00000022 +#define FILE_DEVICE_VIDEO 0x00000023 +#define FILE_DEVICE_VIRTUAL_DISK 0x00000024 +#define FILE_DEVICE_FULLSCREEN_VIDEO 0x00000034 + +// Characteristics +#define FILE_REMOVABLE_MEDIA 0x00000001 +#define FILE_READ_ONLY_DEVICE 0x00000002 +#define FILE_FLOPPY_DISKETTE 0x00000004 +#define FILE_WRITE_ONCE_MEDIA 0x00000008 +#define FILE_REMOTE_DEVICE 0x00000010 +#define FILE_DEVICE_IS_MOUNTED 0x00000020 +#define FILE_VIRTUAL_VOLUME 0x00000040 +#define FILE_AUTOGENERATED_DEVICE_NAME 0x00000080 +#define FILE_DEVICE_SECURE_OPEN 0x00000100 + +/* Physical address + * Differences from NT: 32 bit address instead of 64. */ +typedef ULONG PHYSICAL_ADDRESS, *PPHYSICAL_ADDRESS; + +/* NtCreateFile/NtOpenFile stuff */ +#define FILE_SUPERSEDED 0x00000000 +#define FILE_OPENED 0x00000001 +#define FILE_CREATED 0x00000002 +#define FILE_OVERWRITTEN 0x00000003 +#define FILE_EXISTS 0x00000004 +#define FILE_DOES_NOT_EXIST 0x00000005 + +// NtReadFile/NtWriteFile stuff +#define FILE_WRITE_TO_END_OF_FILE 0xffffffff +#define FILE_USE_FILE_POINTER_POSITION 0xfffffffe + +// Device types +#define FILE_DEVICE_CD_ROM 0x00000002 +#define FILE_DEVICE_CD_ROM_FILE_SYSTEM 0x00000003 +#define FILE_DEVICE_CONTROLLER 0x00000004 +#define FILE_DEVICE_SCSI FILE_DEVICE_CONTROLLER +#define IOCTL_SCSI_BASE FILE_DEVICE_CONTROLLER +#define FILE_DEVICE_DISK 0x00000007 +#define FILE_DEVICE_DISK_FILE_SYSTEM 0x00000008 +#define FILE_DEVICE_DVD 0x00000033 + +// Access types +#define FILE_ANY_ACCESS 0 +#define FILE_READ_ACCESS 0x0001 /* file & pipe */ +#define FILE_WRITE_ACCESS 0x0002 /* file & pipe */ + +// Method types +#define METHOD_BUFFERED 0 +#define METHOD_IN_DIRECT 1 +#define METHOD_OUT_DIRECT 2 +#define METHOD_NEITHER 3 + +// The all-important CTL_CODE +#define CTL_CODE( DeviceType, Function, Method, Access ) ( \ + ((DeviceType) << 16) | ((Access) << 14) | ((Function) << 2) | (Method) \ +) + +// IDE/SCSI codes +// IOCTL_SCSI_PASS_THROUGH_DIRECT is the only one known to be used. +// Differences from NT: None. +#define IOCTL_SCSI_PASS_THROUGH CTL_CODE(IOCTL_SCSI_BASE, 0x0401, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS) +#define IOCTL_SCSI_MINIPORT CTL_CODE(IOCTL_SCSI_BASE, 0x0402, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS) +#define IOCTL_SCSI_GET_INQUIRY_DATA CTL_CODE(IOCTL_SCSI_BASE, 0x0403, METHOD_BUFFERED, FILE_ANY_ACCESS) +#define IOCTL_SCSI_GET_CAPABILITIES CTL_CODE(IOCTL_SCSI_BASE, 0x0404, METHOD_BUFFERED, FILE_ANY_ACCESS) +#define IOCTL_SCSI_PASS_THROUGH_DIRECT CTL_CODE(IOCTL_SCSI_BASE, 0x0405, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS) +#define IOCTL_SCSI_GET_ADDRESS CTL_CODE(IOCTL_SCSI_BASE, 0x0406, METHOD_BUFFERED, FILE_ANY_ACCESS) +#define IOCTL_SCSI_RESCAN_BUS CTL_CODE(IOCTL_SCSI_BASE, 0x0407, METHOD_BUFFERED, FILE_ANY_ACCESS) +#define IOCTL_SCSI_GET_DUMP_POINTERS CTL_CODE(IOCTL_SCSI_BASE, 0x0408, METHOD_BUFFERED, FILE_ANY_ACCESS) +#define IOCTL_SCSI_FREE_DUMP_POINTERS CTL_CODE(IOCTL_SCSI_BASE, 0x0409, METHOD_BUFFERED, FILE_ANY_ACCESS) +#define IOCTL_IDE_PASS_THROUGH CTL_CODE(IOCTL_SCSI_BASE, 0x040a, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS) + +// Special XBOX code? +#define IOCTL_CDROM_AUTHENTICATE_DISK CTL_CODE(FILE_DEVICE_CD_ROM, 0x0020, METHOD_BUFFERED, FILE_READ_ACCESS) + +/* Structure for IOCTL_SCSI_PASS_THROUGH_DIRECT + * Differences from NT: None, believe it or not. */ +typedef struct _SCSI_PASS_THROUGH_DIRECT { + /*000*/ USHORT Length; + /*002*/ UCHAR ScsiStatus; + /*003*/ UCHAR PathId; + /*004*/ UCHAR TargetId; + /*005*/ UCHAR Lun; + /*006*/ UCHAR CdbLength; + /*007*/ UCHAR SenseInfoLength; + /*008*/ UCHAR DataIn; + /*00C*/ ULONG DataTransferLength; + /*010*/ ULONG TimeOutValue; + /*014*/ PVOID DataBuffer; + /*018*/ ULONG SenseInfoOffset; + /*01C*/ UCHAR Cdb[16]; +}SCSI_PASS_THROUGH_DIRECT, *PSCSI_PASS_THROUGH_DIRECT; + +/* DataIn fields for IOCTL_SCSI_PASS_THROUGH_DIRECT */ +#define SCSI_IOCTL_DATA_OUT 0 +#define SCSI_IOCTL_DATA_IN 1 +#define SCSI_IOCTL_DATA_UNSPECIFIED 2 + +/* Kernel object type (unsure about the structure...) */ +typedef struct _OBJECT_TYPE +{ + // Same prototype as ExAllocatePoolWithTag, because that's the usual one + PVOID + (NTAPI *AllocationFunction)( + SIZE_T NumberOfBytes, + ULONG Tag + ); + + // Same prototype as ExFreePool, because that's the usual one + VOID + (NTAPI *FreeFunction)( + IN PVOID P + ); + + // The prototypes of these are unknown + void *CloseFunction; + void *DeleteFunction; + void *ParseFunction; + + // Unknown DWORD... Size of this object type maybe? + void *DefaultObjectMaybe; + + // 4 letter tag for this object type + CHAR Tag[4]; +} OBJECT_TYPE; +typedef OBJECT_TYPE *POBJECT_TYPE; + +// Object types +extern POBJECT_TYPE IoFileObjectType; +extern POBJECT_TYPE ExEventObjectType; +extern POBJECT_TYPE ExSemaphoreObjectType; +extern POBJECT_TYPE IoCompletionObjectType; +extern POBJECT_TYPE IoDeviceObjectType; + + +// *_OBJECT and related structures (mostly opaque since I'm lazy) +typedef struct _DRIVER_OBJECT { + CSHORT Type; + CSHORT Size; + struct _DEVICE_OBJECT *DeviceObject; + // ... +} DRIVER_OBJECT; +typedef DRIVER_OBJECT *PDRIVER_OBJECT; + +typedef struct _DEVICE_OBJECT { + CSHORT Type; + USHORT Size; + LONG ReferenceCount; + PDRIVER_OBJECT DriverObject; + // ... +} DEVICE_OBJECT; +typedef DEVICE_OBJECT *PDEVICE_OBJECT; + +typedef struct _FILE_OBJECT { + CSHORT Type; + CSHORT Size; + PDEVICE_OBJECT DeviceObject; + // ... +} FILE_OBJECT; +typedef FILE_OBJECT *PFILE_OBJECT; + + +/* Thread information structures */ + +/* IRQL */ +typedef UCHAR KIRQL, *PKIRQL; +#define PASSIVE_LEVEL 0 // Passive release level +#define LOW_LEVEL 0 // Lowest interrupt level +#define APC_LEVEL 1 // APC interrupt level +#define DISPATCH_LEVEL 2 // Dispatcher level + +// Thread entry point +// NOTE: This is not a standard call! You can't call this function from C code! +// You push registers like stdcall, but ebp + 4 must point to the first argument before the call! +// +// Differences from NT: 2 parameters instead of 1; strange calling convention +typedef +VOID +(NTAPI *PKSTART_ROUTINE) ( + IN PVOID StartContext1, + IN PVOID StartContext2 + ); + +// Structure of a critical section +// Same as the XBOX's RTL_CRITICAL_SECTION, but with the more explicit header +typedef struct _KCRITICAL_SECTION +{ + // 000 Dispatcher header + DISPATCHER_HEADER Header; + // 010 Lock count of the critical section + LONG LockCount; + // 014 Recursion count of the critical section + LONG RecursionCount; + // 018 Thread ID of the thread that currently owns this critical section + ULONG OwningThread; +} KCRITICAL_SECTION, *PKCRITICAL_SECTION; + +// Structure of a thread object +typedef struct _KTHREAD +{ + // 000 Dispatcher header + DISPATCHER_HEADER Header; + // 010 Unknown + BYTE unknown[0x18]; + // 028 Pointer to TLS data + PVOID TlsData; + // ??? just padding - real size is unknown + BYTE unknown2[0x100]; +} KTHREAD, *PKTHREAD; + +// Structure of the data at FS +typedef struct _FS_STRUCTURE +{ + // 000 Current exception handler information + PVOID *ExceptionFrame; + // 004 Pointer to current TLS data top + PVOID TlsDataTop; + // 008 + BYTE unknown2[0x1C]; + // 024 Current IRQL of the OS + KIRQL CurrentIrql; + // 028 Thread structure of the current thread + PKTHREAD ThreadObject; + // ??? just padding - real size is unknown + BYTE unknown3[0x100]; +} FS_STRUCTURE, *PFS_STRUCTURE; + +// DPC routine +typedef +VOID +(*PKDEFERRED_ROUTINE) ( + IN struct _KDPC *Dpc, + IN PVOID DeferredContext, + IN PVOID SystemArgument1, + IN PVOID SystemArgument2 + ); + +// DPC information +// It's not known which of these fields are used on XBOX. +typedef struct _KDPC { + CSHORT Type; + UCHAR Number; + UCHAR Importance; + LIST_ENTRY DpcListEntry; + PKDEFERRED_ROUTINE DeferredRoutine; + PVOID DeferredContext; + PVOID SystemArgument1; + PVOID SystemArgument2; + PULONG_PTR Lock; +} KDPC, *PKDPC; + + +// Timers +typedef enum _TIMER_TYPE { + NotificationTimer, + SynchronizationTimer + } TIMER_TYPE; + +typedef struct _KTIMER { + DISPATCHER_HEADER Header; + ULARGE_INTEGER DueTime; + LIST_ENTRY TimerListEntry; + struct _KDPC *Dpc; + LONG Period; +} KTIMER, *PKTIMER; + +/* XBE stuff + * Not used in any exported kernel calls, but still useful. + */ + +/* XBE header information */ +typedef struct _XBE_HEADER +{ + // 000 "XBEH" + CHAR Magic[4]; + // 004 RSA digital signature of the entire header area + UCHAR HeaderSignature[256]; + // 104 Base address of XBE image (must be 0x00010000?) + PVOID BaseAddress; + // 108 Size of all headers combined - other headers must be within this + ULONG HeaderSize; + // 10C Size of entire image + ULONG ImageSize; + // 110 Size of this header (always 0x178?) + ULONG XbeHeaderSize; + // 114 Image timestamp - unknown format + ULONG Timestamp; + // 118 Pointer to certificate data (must be within HeaderSize) + struct _XBE_CERTIFICATE *Certificate; + // 11C Number of sections + DWORD NumSections; + // 120 Pointer to section headers (must be within HeaderSize) + struct _XBE_SECTION *Sections; + // 124 Initialization flags + ULONG InitFlags; + // 128 Entry point (XOR'd; see xboxhacker.net) + PVOID EntryPoint; + // 12C Pointer to TLS directory + struct _XBE_TLS_DIRECTORY *TlsDirectory; + // 130 Stack commit size + ULONG StackCommit; + // 134 Heap reserve size + ULONG HeapReserve; + // 138 Heap commit size + ULONG HeapCommit; + // 13C PE base address (?) + PVOID PeBaseAddress; + // 140 PE image size (?) + ULONG PeImageSize; + // 144 PE checksum (?) + ULONG PeChecksum; + // 148 PE timestamp (?) + ULONG PeTimestamp; + // 14C PC path and filename to EXE file from which XBE is derived + PCSZ PcExePath; + // 150 PC filename (last part of PcExePath) from which XBE is derived + PCSZ PcExeFilename; + // 154 PC filename (Unicode version of PcExeFilename) + PWSTR PcExeFilenameUnicode; + // 158 Pointer to kernel thunk table (XOR'd; EFB1F152 debug) + ULONG_PTR *KernelThunkTable; + // 15C Non-kernel import table (debug only) + PVOID DebugImportTable; + // 160 Number of library headers + ULONG NumLibraries; + // 164 Pointer to library headers + struct _XBE_LIBRARY *Libraries; + // 168 Pointer to kernel library header + struct _XBE_LIBRARY *KernelLibrary; + // 16C Pointer to XAPI library + struct _XBE_LIBRARY *XapiLibrary; + // 170 Pointer to logo bitmap (NULL = use default of Microsoft) + PVOID LogoBitmap; + // 174 Size of logo bitmap + ULONG LogoBitmapSize; + // 178 +} XBE_HEADER, *PXBE_HEADER; + +// Certificate structure +typedef struct _XBE_CERTIFICATE { + // 000 Size of certificate + ULONG Size; + // 004 Certificate timestamp (unknown format) + ULONG Timestamp; + // 008 Title ID + ULONG TitleId; + // 00C Name of the game (Unicode) + WCHAR TitleName[40]; + // 05C Alternate title ID's (0-terminated) + ULONG AlternateTitleIds[16]; + // 09C Allowed media types - 1 bit match between XBE and media = boots + ULONG MediaTypes; + // 0A0 Allowed game regions - 1 bit match between this and XBOX = boots + ULONG GameRegion; + // 0A4 Allowed game ratings - 1 bit match between this and XBOX = boots + ULONG GameRating; + // 0A8 Disk number (?) + ULONG DiskNumber; + // 0AC Version (?) + ULONG Version; + // 0B0 LAN key for this game + UCHAR LanKey[16]; + // 0C0 Signature key for this game + UCHAR SignatureKey[16]; + // 0D0 Signature keys for the alternate title ID's + UCHAR AlternateSignatureKeys[16][16]; + // 1D0 +} XBE_CERTIFICATE, *PXBE_CERTIFICATE; + +// Section headers +typedef struct _XBE_SECTION { + // 000 Flags + ULONG Flags; + // 004 Virtual address (where this section loads in RAM) + PVOID VirtualAddress; + // 008 Virtual size (size of section in RAM; after FileSize it's 00'd) + ULONG VirtualSize; + // 00C File address (where in the file from which this section comes) + ULONG FileAddress; + // 010 File size (size of the section in the XBE file) + ULONG FileSize; + // 014 Pointer to section name + PCSZ SectionName; + // 018 Section reference count - when >= 1, section is loaded + LONG SectionReferenceCount; + // 01C Pointer to head shared page reference count + WORD *HeadReferenceCount; + // 020 Pointer to tail shared page reference count + WORD *TailReferenceCount; + // 024 SHA hash. Hash DWORD containing FileSize, then hash section. + DWORD ShaHash[5]; + // 038 +} XBE_SECTION, *PXBE_SECTION; + +/* TLS directory information needed later + * Library version data needed later */ + +/* Initialization flags */ +#define XBE_INIT_MOUNT_UTILITY 0x00000001 +#define XBE_INIT_FORMAT_UTILITY 0x00000002 +#define XBE_INIT_64M_RAM_ONLY 0x00000004 +#define XBE_INIT_DONT_SETUP_HDD 0x00000008 + +/* Region codes */ +#define XBE_REGION_US_CANADA 0x00000001 +#define XBE_REGION_JAPAN 0x00000002 +#define XBE_REGION_ELSEWHERE 0x00000004 +#define XBE_REGION_DEBUG 0x80000000 + +/* Media types */ +#define XBE_MEDIA_HDD 0x00000001 +#define XBE_MEDIA_XBOX_DVD 0x00000002 +#define XBE_MEDIA_ANY_CD_OR_DVD 0x00000004 +#define XBE_MEDIA_CD 0x00000008 +#define XBE_MEDIA_1LAYER_DVDROM 0x00000010 +#define XBE_MEDIA_2LAYER_DVDROM 0x00000020 +#define XBE_MEDIA_1LAYER_DVDR 0x00000040 +#define XBE_MEDIA_2LAYER_DVDR 0x00000080 +#define XBE_MEDIA_USB 0x00000100 +#define XBE_MEDIA_ALLOW_UNLOCKED_HDD 0x40000000 + +/* Section flags */ +#define XBE_SEC_WRITABLE 0x00000001 +#define XBE_SEC_PRELOAD 0x00000002 +#define XBE_SEC_EXECUTABLE 0x00000004 +#define XBE_SEC_INSERTED_FILE 0x00000008 +#define XBE_SEC_RO_HEAD_PAGE 0x00000010 +#define XBE_SEC_RO_TAIL_PAGE 0x00000020 + +/* x86 page size */ +#define PAGE_SIZE 0x1000 + +/* Native NT API calls on the XBOX */ + +/* PAGE_ALIGN: + * Returns an address rounded down to the nearest page boundary. + * + * Differences from NT: None. + */ +#define PAGE_ALIGN(Va) ((PVOID)((ULONG_PTR)(Va) & ~(PAGE_SIZE - 1))) + +// NtReadFile: +// Reads a file. +// +// Differences from NT: There is no Key parameter. +NTSYSAPI +EXPORTNUM(219) +NTSTATUS +NTAPI +NtReadFile( + IN HANDLE FileHandle, + IN HANDLE Event OPTIONAL, + IN PIO_APC_ROUTINE ApcRoutine OPTIONAL, + IN PVOID ApcContext OPTIONAL, + OUT PIO_STATUS_BLOCK IoStatusBlock, + OUT PVOID Buffer, + IN ULONG Length, + IN PLARGE_INTEGER ByteOffset + ); + +// NtWriteFile: +// Writes a file. +// +// Differences from NT: There is no Key parameter. +NTSYSAPI +EXPORTNUM(236) +NTSTATUS +NTAPI +NtWriteFile( + IN HANDLE FileHandle, + IN HANDLE Event OPTIONAL, + IN PIO_APC_ROUTINE ApcRoutine OPTIONAL, + IN PVOID ApcContext OPTIONAL, + OUT PIO_STATUS_BLOCK IoStatusBlock, + IN PVOID Buffer, + IN ULONG Length, + IN PLARGE_INTEGER ByteOffset + ); + +// NtQueryVolumeInformation: +// Queries information about a file system. This is not documented by +// Microsoft even under NT. +// +// Differences from NT: None known. +NTSYSAPI +EXPORTNUM(218) +NTSTATUS +NTAPI +NtQueryVolumeInformationFile( + IN HANDLE FileHandle, + OUT PIO_STATUS_BLOCK IoStatusBlock, + OUT PVOID VolumeInformation, + IN ULONG VolumeInformationLength, + IN FS_INFORMATION_CLASS VolumeInformationClass + ); + +// NtClose: +// Closes a file or other handle. +// +// Differences from NT: None. +NTSYSAPI +EXPORTNUM(187) +NTSTATUS +NTAPI +NtClose( + IN HANDLE Handle + ); + +// NtAllocateVirtualMemory: +// Allocates virtual memory. +// +// Differences from NT: There is no ProcessHandle parameter. +NTSYSAPI +EXPORTNUM(184) +NTSTATUS +NTAPI +NtAllocateVirtualMemory( + IN OUT PVOID *BaseAddress, + IN ULONG ZeroBits, + IN OUT PULONG AllocationSize, + IN ULONG AllocationType, + IN ULONG Protect + ); + +// NtFreeVirtualMemory: +// Frees virtual memory. +// +// Differences from NT: There is no ProcessHandle parameter. +NTSYSAPI +EXPORTNUM(199) +NTSTATUS +NTAPI +NtFreeVirtualMemory( + IN OUT PVOID *BaseAddress, + IN OUT PULONG FreeSize, + IN ULONG FreeType + ); + + +// Kernel-level routines + +// MmMapIoSpace: +// Maps a physical address area into the virtual address space. +// DO NOT USE MEMORY MAPPED WITH THIS AS A BUFFER TO OTHER CALLS. For +// example, don't WriteFile or NtWriteFile these buffers. Copy them first. +// +// Differences from NT: PhysicalAddress is 32 bit, not 64. ProtectionType +// specifies the page protections, but it's a Win32 PAGE_ macro instead +// of the normal NT enumeration. PAGE_READWRITE is probably what you +// want... +NTSYSAPI +EXPORTNUM(177) +PVOID +NTAPI +MmMapIoSpace( + IN PHYSICAL_ADDRESS PhysicalAddress, + IN ULONG NumberOfBytes, + IN ULONG ProtectionType + ); + +// MmGetPhysicalAddress: +// Translates a virtual address into a physical address. +// +// Differences from NT: PhysicalAddress is 32 bit, not 64. +NTSYSAPI +EXPORTNUM(173) +PHYSICAL_ADDRESS +NTAPI +MmGetPhysicalAddress( + IN PVOID BaseAddress + ); + +// MmUnmapIoSpace: +// Unmaps a virtual address mapping made by MmMapIoSpace. +// +// Differences from NT: None. +NTSYSAPI +EXPORTNUM(183) +PVOID +NTAPI +MmUnmapIoSpace( + IN PVOID BaseAddress, + IN ULONG NumberOfBytes + ); + +// MmAllocateContiguousMemory: +// Allocates a range of physically contiguous, cache-aligned memory from the +// non-paged pool (= main pool on XBOX). +// +// Differences from NT: HighestAcceptableAddress was deleted, opting instead +// to not care about the highest address. +NTSYSAPI +EXPORTNUM(165) +PVOID +NTAPI +MmAllocateContiguousMemory( + IN ULONG NumberOfBytes + ); + +// MmFreeContiguousMemory: +// Frees memory allocated with MmAllocateContiguousMemory. +// +// Differences from NT: None. +NTSYSAPI +EXPORTNUM(171) +VOID +NTAPI +MmFreeContiguousMemory( + IN PVOID BaseAddress + ); + +// IoCreateSymbolicLink: +// Creates a symbolic link in the object namespace. +// NtCreateSymbolicLinkObject is much harder to use than this simple +// function, so just use this one. +// +// Differences from NT: Uses ANSI_STRING instead of UNICODE_STRING. +NTSYSAPI +EXPORTNUM(67) +NTSTATUS +NTAPI +IoCreateSymbolicLink( + IN PANSI_STRING SymbolicLinkName, + IN PANSI_STRING DeviceName + ); + +// IoDeleteSymbolicLink: +// Creates a symbolic link in the object namespace. Deleting symbolic links +// through the Nt* functions is a pain, so use this instead. +// +// Differences from NT: Uses ANSI_STRING instead of UNICODE_STRING. +NTSYSAPI +EXPORTNUM(69) +NTSTATUS +NTAPI +IoDeleteSymbolicLink( + IN PANSI_STRING SymbolicLinkName + ); + + +// ObReferenceObjectByHandle: +// Turns a handle into a kernel object pointer. The ObjectType parameter +// specifies what type of object it is. This function also increments the +// object's reference count. +// +// Differences from NT: There are no DesiredAccess, AccessMode, or +// HandleInformation parameters. +NTSYSAPI +EXPORTNUM(246) +NTSTATUS +NTAPI +ObReferenceObjectByHandle( + IN HANDLE Handle, + IN POBJECT_TYPE ObjectType OPTIONAL, + OUT PVOID *Object + ); + +// ObfReferenceObject/ObReferenceObject: +// Increments the object's reference count. +// +// Differences from NT: None. +#define ObReferenceObject(Object) ObfReferenceObject(Object) +NTSYSAPI +EXPORTNUM(251) +VOID +FASTCALL +ObfReferenceObject( + IN PVOID Object + ); + +// ObfDereferenceObject/ObDereferenceObject: +// Decrements the object's reference count, deleting it if it is now unused. +// +// Differences from NT: None. +#define ObDereferenceObject(a) ObfDereferenceObject(a) +NTSYSAPI +EXPORTNUM(250) +VOID +FASTCALL +ObfDereferenceObject( + IN PVOID Object + ); + +// Kernel routines only in the XBOX + +// HalEnableSecureTrayEject: +// Notifies the SMBUS that ejecting the DVD-ROM should not reset the system. +// Note that this function can't really be called directly... +// +// New to the XBOX. +NTSYSAPI +EXPORTNUM(365) +VOID +NTAPI +HalEnableSecureTrayEject( + VOID + ); + +// XeLoadSection: +// Adds one to the reference count of the specified section and loads if the +// count is now above zero. +// +// New to the XBOX. +NTSYSAPI +EXPORTNUM(327) +NTSTATUS +NTAPI +XeLoadSection( + IN OUT PXBE_SECTION section + ); + +/* Error codes */ +#define STATUS_SUCCESS 0x00000000 +#define STATUS_UNSUCCESSFUL 0xC0000001 +#define STATUS_UNRECOGNIZED_MEDIA 0xC0000014 + +/* The SCSI input buffer was too large (not necessarily an error!) */ +#define STATUS_DATA_OVERRUN 0xC000003C +#define STATUS_INVALID_IMAGE_FORMAT 0xC000007B +#define STATUS_INSUFFICIENT_RESOURCES 0xC000009A +#define STATUS_TOO_MANY_SECRETS 0xC0000156 +#define STATUS_REGION_MISMATCH 0xC0050001 + +#include + + // Thanks and credit go to Woodoo + extern VOID WINAPI HalWriteSMBusValue(BYTE, BYTE, BOOL, BYTE); + extern VOID WINAPI HalReadSMCTrayState(DWORD* state, DWORD* count); + + // Thanks and credit go to Team Evox + extern VOID WINAPI HalReturnToFirmware(DWORD); + + extern INT WINAPI XNetLoadConfigParams(LPBYTE); + extern INT WINAPI XNetSaveConfigParams(LPBYTE); + + extern INT WINAPI XWriteTitleInfoNoReboot(LPVOID,LPVOID,DWORD,DWORD,LPVOID); + + extern DWORD* LaunchDataPage; + +static HRESULT xbox_io_mount(char *szDrive, char *szDevice) +{ + STRING DeviceName, LinkName; +#ifndef IS_SALAMANDER + bool original_verbose = verbosity_is_enabled(); +#endif + char szSourceDevice[48] = {0}; + char szDestinationDrive[16] = {0}; + + snprintf(szSourceDevice, sizeof(szSourceDevice), + "\\Device\\%s", szDevice); + snprintf(szDestinationDrive, sizeof(szDestinationDrive), + "\\??\\%s", szDrive); + + DeviceName.Length = strlen(szSourceDevice); + DeviceName.MaximumLength = strlen(szSourceDevice) + 1; + DeviceName.Buffer = szSourceDevice; + + LinkName.Length = strlen(szDestinationDrive); + LinkName.MaximumLength = strlen(szDestinationDrive) + 1; + LinkName.Buffer = szDestinationDrive; + + IoCreateSymbolicLink(&LinkName, &DeviceName); + +#ifndef IS_SALAMANDER + if (original_verbose) + verbosity_enable(); + else + verbosity_disable(); +#endif + return S_OK; +} + +static HRESULT xbox_io_unmount(char *szDrive) +{ + STRING LinkName; + char szDestinationDrive[16] = {0}; + + snprintf(szDestinationDrive, sizeof(szDestinationDrive), + "\\??\\%s", szDrive); + + LinkName.Length = strlen(szDestinationDrive); + LinkName.MaximumLength = strlen(szDestinationDrive) + 1; + LinkName.Buffer = szDestinationDrive; + + IoDeleteSymbolicLink(&LinkName); + + return S_OK; +} +#endif + +#ifdef _XBOX360 +typedef struct _STRING +{ + USHORT Length; + USHORT MaximumLength; + PCHAR Buffer; +} STRING, *PSTRING; + +VOID RtlInitAnsiString(PSTRING DestinationString, PCHAR SourceString); +HRESULT ObDeleteSymbolicLink(PSTRING SymbolicLinkName); +HRESULT ObCreateSymbolicLink(PSTRING SymbolicLinkName, PSTRING DeviceName); + +static HRESULT xbox_io_mount(const char* szDrive, char* szDevice) +{ + STRING DeviceName, LinkName; + char szDestinationDrive[PATH_MAX_LENGTH]; + + snprintf(szDestinationDrive, sizeof(szDestinationDrive), + "\\??\\%s", szDrive); + RtlInitAnsiString(&DeviceName, szDevice); + RtlInitAnsiString(&LinkName, (PCHAR)szDestinationDrive); + ObDeleteSymbolicLink(&LinkName); + return (HRESULT)ObCreateSymbolicLink(&LinkName, &DeviceName); +} +#endif diff --git a/frontend/frontend.c b/frontend/frontend.c index 137d9fa0bf..bd2fecde6e 100644 --- a/frontend/frontend.c +++ b/frontend/frontend.c @@ -146,6 +146,9 @@ int rarch_main(int argc, char *argv[], void *data) } #ifndef HAVE_MAIN +#ifdef __cplusplus +extern "C" +#endif int main(int argc, char *argv[]) { return rarch_main(argc, argv, NULL); diff --git a/gfx/common/d3d10_common.c b/gfx/common/d3d10_common.c index 5d91071db6..45d364d08f 100644 --- a/gfx/common/d3d10_common.c +++ b/gfx/common/d3d10_common.c @@ -13,6 +13,8 @@ * If not, see . */ +#define CINTERFACE + #include #include "d3d10_common.h" @@ -55,7 +57,7 @@ HRESULT WINAPI D3D10CreateDeviceAndSwapChain( d3d10_dll, "D3D10CreateDeviceAndSwapChain"); if (!fp) - return TYPE_E_CANTLOADLIBRARY; + return TYPE_E_DLLFUNCTIONNOTFOUND; return fp( pAdapter, DriverType, Software, Flags, SDKVersion, @@ -82,7 +84,7 @@ void d3d10_init_texture(D3D10Device device, d3d10_texture_t* texture) D3D10CreateTexture2D(device, &texture->desc, NULL, &texture->handle); { - D3D10_SHADER_RESOURCE_VIEW_DESC view_desc = { 0 }; + D3D10_SHADER_RESOURCE_VIEW_DESC view_desc = { DXGI_FORMAT_UNKNOWN }; view_desc.Format = texture->desc.Format; view_desc.ViewDimension = D3D_SRV_DIMENSION_TEXTURE2D; view_desc.Texture2D.MostDetailedMip = 0; @@ -132,7 +134,7 @@ void d3d10_update_texture( texture->dirty = true; } -DXGI_FORMAT + DXGI_FORMAT d3d10_get_closest_match(D3D10Device device, DXGI_FORMAT desired_format, UINT desired_format_support) { @@ -146,7 +148,7 @@ d3d10_get_closest_match(D3D10Device device, { UINT format_support; if (SUCCEEDED(D3D10CheckFormatSupport(device, *format, &format_support)) && - ((format_support & desired_format_support) == desired_format_support)) + ((format_support & desired_format_support) == desired_format_support)) break; format++; } diff --git a/gfx/common/d3d10_common.h b/gfx/common/d3d10_common.h index 18fc881a7a..4ae2074295 100644 --- a/gfx/common/d3d10_common.h +++ b/gfx/common/d3d10_common.h @@ -50,6 +50,7 @@ typedef ID3D10Debug* D3D10Debug; typedef ID3D10SwitchToRef* D3D10SwitchToRef; typedef ID3D10InfoQueue* D3D10InfoQueue; +#if !defined(__cplusplus) || defined(CINTERFACE) static INLINE void D3D10SetResourceEvictionPriority(D3D10Resource resource, UINT eviction_priority) { resource->lpVtbl->SetEvictionPriority(resource, eviction_priority); @@ -1024,7 +1025,7 @@ static INLINE HRESULT D3D10CreateTexture2DShaderResourceView( { return device->lpVtbl->CreateShaderResourceView(device, (D3D10Resource)texture, desc, srview); } - +#endif /* internal */ #include diff --git a/gfx/common/d3d11_common.c b/gfx/common/d3d11_common.c index 29db2222f5..8198db080e 100644 --- a/gfx/common/d3d11_common.c +++ b/gfx/common/d3d11_common.c @@ -13,6 +13,8 @@ * If not, see . */ +#define CINTERFACE + #include #include "d3d11_common.h" @@ -49,7 +51,7 @@ HRESULT WINAPI D3D11CreateDeviceAndSwapChain( d3d11_dll, "D3D11CreateDeviceAndSwapChain"); if (!fp) - return TYPE_E_CANTLOADLIBRARY; + return TYPE_E_DLLFUNCTIONNOTFOUND; return fp( pAdapter, DriverType, Software, Flags, pFeatureLevels, FeatureLevels, SDKVersion, @@ -68,15 +70,18 @@ void d3d11_init_texture(D3D11Device device, d3d11_texture_t* texture) texture->desc.ArraySize = 1; texture->desc.SampleDesc.Count = 1; texture->desc.SampleDesc.Quality = 0; - texture->desc.BindFlags |= D3D11_BIND_SHADER_RESOURCE; - texture->desc.CPUAccessFlags = - texture->desc.Usage == D3D11_USAGE_DYNAMIC ? D3D11_CPU_ACCESS_WRITE : 0; + texture->desc.BindFlags |= D3D11_BIND_SHADER_RESOURCE; + texture->desc.CPUAccessFlags = + texture->desc.Usage == D3D11_USAGE_DYNAMIC ? D3D11_CPU_ACCESS_WRITE : 0; if (texture->desc.MiscFlags & D3D11_RESOURCE_MISC_GENERATE_MIPS) { + unsigned width, height; + texture->desc.BindFlags |= D3D11_BIND_RENDER_TARGET; - unsigned width = texture->desc.Width >> 5; - unsigned height = texture->desc.Height >> 5; + width = texture->desc.Width >> 5; + height = texture->desc.Height >> 5; + while (width && height) { width >>= 1; @@ -93,7 +98,7 @@ void d3d11_init_texture(D3D11Device device, d3d11_texture_t* texture) D3D11CreateTexture2D(device, &texture->desc, NULL, &texture->handle); { - D3D11_SHADER_RESOURCE_VIEW_DESC view_desc = { 0 }; + D3D11_SHADER_RESOURCE_VIEW_DESC view_desc = { DXGI_FORMAT_UNKNOWN }; view_desc.Format = texture->desc.Format; view_desc.ViewDimension = D3D_SRV_DIMENSION_TEXTURE2D; view_desc.Texture2D.MostDetailedMip = 0; @@ -122,9 +127,9 @@ void d3d11_init_texture(D3D11Device device, d3d11_texture_t* texture) void d3d11_update_texture( D3D11DeviceContext ctx, - int width, - int height, - int pitch, + unsigned width, + unsigned height, + unsigned pitch, DXGI_FORMAT format, const void* data, d3d11_texture_t* texture) @@ -147,7 +152,7 @@ void d3d11_update_texture( D3D11GenerateMips(ctx, texture->view); } -DXGI_FORMAT + DXGI_FORMAT d3d11_get_closest_match(D3D11Device device, DXGI_FORMAT desired_format, UINT desired_format_support) { DXGI_FORMAT default_list[] = {desired_format, DXGI_FORMAT_UNKNOWN}; @@ -160,7 +165,7 @@ d3d11_get_closest_match(D3D11Device device, DXGI_FORMAT desired_format, UINT des { UINT format_support; if (SUCCEEDED(D3D11CheckFormatSupport(device, *format, &format_support)) && - ((format_support & desired_format_support) == desired_format_support)) + ((format_support & desired_format_support) == desired_format_support)) break; format++; } @@ -188,11 +193,11 @@ bool d3d11_init_shader( if (!src) /* LPCWSTR filename */ { - if (vs_entry && !d3d_compile_from_file(src_name, vs_entry, "vs_5_0", &vs_code)) + if (vs_entry && !d3d_compile_from_file((LPCWSTR)src_name, vs_entry, "vs_5_0", &vs_code)) success = false; - if (ps_entry && !d3d_compile_from_file(src_name, ps_entry, "ps_5_0", &ps_code)) + if (ps_entry && !d3d_compile_from_file((LPCWSTR)src_name, ps_entry, "ps_5_0", &ps_code)) success = false; - if (gs_entry && !d3d_compile_from_file(src_name, gs_entry, "gs_5_0", &gs_code)) + if (gs_entry && !d3d_compile_from_file((LPCWSTR)src_name, gs_entry, "gs_5_0", &gs_code)) success = false; } else /* char array */ @@ -200,11 +205,11 @@ bool d3d11_init_shader( if (!size) size = strlen(src); - if (vs_entry && !d3d_compile(src, size, src_name, vs_entry, "vs_5_0", &vs_code)) + if (vs_entry && !d3d_compile(src, size, (LPCSTR)src_name, vs_entry, "vs_5_0", &vs_code)) success = false; - if (ps_entry && !d3d_compile(src, size, src_name, ps_entry, "ps_5_0", &ps_code)) + if (ps_entry && !d3d_compile(src, size, (LPCSTR)src_name, ps_entry, "ps_5_0", &ps_code)) success = false; - if (gs_entry && !d3d_compile(src, size, src_name, gs_entry, "gs_5_0", &gs_code)) + if (gs_entry && !d3d_compile(src, size, (LPCSTR)src_name, gs_entry, "gs_5_0", &gs_code)) success = false; } diff --git a/gfx/common/d3d11_common.h b/gfx/common/d3d11_common.h index 626353f967..388e1a3f47 100644 --- a/gfx/common/d3d11_common.h +++ b/gfx/common/d3d11_common.h @@ -18,6 +18,9 @@ #include #include "dxgi_common.h" +#ifdef CINTERFACE +#define D3D11_NO_HELPERS +#endif #include typedef const ID3D11ShaderResourceView* D3D11ShaderResourceViewRef; @@ -213,7 +216,8 @@ static INLINE void D3D11SetPShaderResources( ID3D11ShaderResourceView* const* shader_resource_views) { device_context->lpVtbl->PSSetShaderResources( - device_context, start_slot, num_views, shader_resource_views); + device_context, start_slot, num_views, + shader_resource_views); } static INLINE void D3D11SetPShader( D3D11DeviceContext device_context, @@ -225,13 +229,13 @@ static INLINE void D3D11SetPShader( device_context, pixel_shader, class_instances, num_class_instances); } static INLINE void D3D11SetPShaderSamplers( - D3D11DeviceContext device_context, - UINT start_slot, - UINT num_samplers, - D3D11SamplerStateRef* samplers) + D3D11DeviceContext device_context, + UINT start_slot, + UINT num_samplers, + ID3D11SamplerState* const* samplers) { device_context->lpVtbl->PSSetSamplers( - device_context, start_slot, num_samplers, (D3D11SamplerState* const)samplers); + device_context, start_slot, num_samplers, samplers); } static INLINE void D3D11SetVShader( D3D11DeviceContext device_context, @@ -2419,14 +2423,6 @@ D3D11UnmapBuffer(D3D11DeviceContext device_context, D3D11Buffer buffer, UINT sub #include "../video_driver.h" #include "../drivers_shader/slang_process.h" -typedef struct -{ - float x; - float y; - float z; - float w; -} float4_t; - typedef struct d3d11_vertex_t { float position[2]; @@ -2499,13 +2495,12 @@ typedef struct DXGISwapChain swapChain; D3D11Device device; D3D_FEATURE_LEVEL supportedFeatureLevel; - D3D11DeviceContext ctx; + D3D11DeviceContext context; D3D11RasterizerState state; D3D11RenderTargetView renderTargetView; D3D11Buffer ubo; d3d11_uniform_t ubo_values; - D3D11SamplerState sampler_nearest; - D3D11SamplerState sampler_linear; + D3D11SamplerState samplers[RARCH_FILTER_MAX][RARCH_WRAP_MAX]; D3D11BlendState blend_enable; D3D11BlendState blend_disable; D3D11BlendState blend_pipeline; @@ -2519,7 +2514,8 @@ typedef struct bool resize_chain; bool keep_aspect; bool resize_viewport; - bool resize_fbos; + bool resize_render_targets; + bool init_history; d3d11_shader_t shaders[GFX_MAX_SHADERS]; struct @@ -2542,7 +2538,7 @@ typedef struct struct { - d3d11_texture_t texture; + d3d11_texture_t texture[GFX_MAX_FRAME_HISTORY + 1]; D3D11Buffer vbo; D3D11Buffer ubo; D3D11_VIEWPORT viewport; @@ -2556,10 +2552,9 @@ typedef struct D3D11SamplerStateRef sampler; D3D11Buffer buffers[SLANG_CBUFFER_MAX]; d3d11_texture_t rt; + d3d11_texture_t feedback; D3D11_VIEWPORT viewport; pass_semantics_t semantics; - D3D11ShaderResourceViewRef textures[SLANG_NUM_BINDINGS]; - D3D11SamplerStateRef samplers[SLANG_NUM_BINDINGS]; uint32_t frame_count; } pass[GFX_MAX_SHADERS]; @@ -2578,9 +2573,9 @@ static INLINE void d3d11_release_texture(d3d11_texture_t* texture) void d3d11_update_texture( D3D11DeviceContext ctx, - int width, - int height, - int pitch, + unsigned width, + unsigned height, + unsigned pitch, DXGI_FORMAT format, const void* data, d3d11_texture_t* texture); @@ -2612,7 +2607,7 @@ static INLINE void d3d11_set_texture_and_sampler(D3D11DeviceContext ctx, UINT slot, d3d11_texture_t* texture) { D3D11SetPShaderResources(ctx, slot, 1, &texture->view); - D3D11SetPShaderSamplers(ctx, slot, 1, &texture->sampler); + D3D11SetPShaderSamplers(ctx, slot, 1, (D3D11SamplerState*)&texture->sampler); } static INLINE void d3d11_set_shader(D3D11DeviceContext ctx, d3d11_shader_t* shader) diff --git a/gfx/common/d3d12_common.c b/gfx/common/d3d12_common.c index a92986b5c2..cecbc0d1be 100644 --- a/gfx/common/d3d12_common.c +++ b/gfx/common/d3d12_common.c @@ -13,6 +13,10 @@ * If not, see . */ +#define CINTERFACE + +#include + #include "d3d12_common.h" #include "dxgi_common.h" #include "d3dcompiler_common.h" @@ -25,7 +29,11 @@ #ifdef __MINGW32__ /* clang-format off */ +#ifdef __cplusplus +#define DEFINE_GUIDW(name, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8) EXTERN_C const GUID DECLSPEC_SELECTANY name = { l, w1, w2, { b1, b2, b3, b4, b5, b6, b7, b8 } } +#else #define DEFINE_GUIDW(name, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8) const GUID DECLSPEC_SELECTANY name = { l, w1, w2, { b1, b2, b3, b4, b5, b6, b7, b8 } } +#endif DEFINE_GUIDW(IID_ID3D12PipelineState, 0x765a30f3, 0xf624, 0x4c6f, 0xa8, 0x28, 0xac, 0xe9, 0x48, 0x62, 0x24, 0x45); DEFINE_GUIDW(IID_ID3D12RootSignature, 0xc54a6b66, 0x72df, 0x4ee8, 0x8b, 0xe5, 0xa9, 0x46, 0xa1, 0x42, 0x92, 0x14); @@ -64,21 +72,20 @@ static const char* d3d12_dll_name = "d3d12.dll"; HRESULT WINAPI D3D12CreateDevice( IUnknown* pAdapter, D3D_FEATURE_LEVEL MinimumFeatureLevel, REFIID riid, void** ppDevice) { - static PFN_D3D12_CREATE_DEVICE fp; + static PFN_D3D12_CREATE_DEVICE fp; if (!d3d12_dll) d3d12_dll = dylib_load(d3d12_dll_name); if (!d3d12_dll) - goto error; + return TYPE_E_CANTLOADLIBRARY; if (!fp) fp = (PFN_D3D12_CREATE_DEVICE)dylib_proc(d3d12_dll, "D3D12CreateDevice"); - if (fp) - return fp(pAdapter, MinimumFeatureLevel, riid, ppDevice); + if (!fp) + return TYPE_E_DLLFUNCTIONNOTFOUND; -error: - return TYPE_E_CANTLOADLIBRARY; + return fp(pAdapter, MinimumFeatureLevel, riid, ppDevice); } HRESULT WINAPI D3D12GetDebugInterface(REFIID riid, void** ppvDebug) @@ -88,16 +95,15 @@ HRESULT WINAPI D3D12GetDebugInterface(REFIID riid, void** ppvDebug) d3d12_dll = dylib_load(d3d12_dll_name); if (!d3d12_dll) - goto error; + return TYPE_E_CANTLOADLIBRARY; if (!fp) fp = (PFN_D3D12_GET_DEBUG_INTERFACE)dylib_proc(d3d12_dll, "D3D12GetDebugInterface"); - if (fp) - return fp(riid, ppvDebug); + if (!fp) + return TYPE_E_DLLFUNCTIONNOTFOUND; -error: - return TYPE_E_CANTLOADLIBRARY; + return fp(riid, ppvDebug); } HRESULT WINAPI D3D12SerializeRootSignature( @@ -111,17 +117,15 @@ HRESULT WINAPI D3D12SerializeRootSignature( d3d12_dll = dylib_load(d3d12_dll_name); if (!d3d12_dll) - goto error; + return TYPE_E_CANTLOADLIBRARY; if (!fp) - fp = (PFN_D3D12_SERIALIZE_ROOT_SIGNATURE)dylib_proc( - d3d12_dll, "D3D12SerializeRootSignature"); + fp = (PFN_D3D12_SERIALIZE_ROOT_SIGNATURE)dylib_proc(d3d12_dll, "D3D12SerializeRootSignature"); - if (fp) - return fp(pRootSignature, Version, ppBlob, ppErrorBlob); + if (!fp) + return TYPE_E_DLLFUNCTIONNOTFOUND; -error: - return TYPE_E_CANTLOADLIBRARY; + return fp(pRootSignature, Version, ppBlob, ppErrorBlob); } HRESULT WINAPI D3D12SerializeVersionedRootSignature( @@ -134,17 +138,16 @@ HRESULT WINAPI D3D12SerializeVersionedRootSignature( d3d12_dll = dylib_load(d3d12_dll_name); if (!d3d12_dll) - goto error; + return TYPE_E_CANTLOADLIBRARY; if (!fp) fp = (PFN_D3D12_SERIALIZE_VERSIONED_ROOT_SIGNATURE)dylib_proc( - d3d12_dll, "D3D12SerializeRootSignature"); + d3d12_dll, "D3D12SerializeRootSignature"); - if (fp) - return fp(pRootSignature, ppBlob, ppErrorBlob); + if (!fp) + return TYPE_E_DLLFUNCTIONNOTFOUND; -error: - return TYPE_E_CANTLOADLIBRARY; + return fp(pRootSignature, ppBlob, ppErrorBlob); } #endif @@ -179,10 +182,8 @@ bool d3d12_init_base(d3d12_video_t* d3d12) bool d3d12_init_queue(d3d12_video_t* d3d12) { { - static const D3D12_COMMAND_QUEUE_DESC desc = { - .Type = D3D12_COMMAND_LIST_TYPE_DIRECT, - .Flags = D3D12_COMMAND_QUEUE_FLAG_NONE, - }; + static const D3D12_COMMAND_QUEUE_DESC desc = { D3D12_COMMAND_LIST_TYPE_DIRECT, 0, + D3D12_COMMAND_QUEUE_FLAG_NONE, 0 }; D3D12CreateCommandQueue( d3d12->device, (D3D12_COMMAND_QUEUE_DESC*)&desc, &d3d12->queue.handle); } @@ -192,7 +193,7 @@ bool d3d12_init_queue(d3d12_video_t* d3d12) D3D12CreateGraphicsCommandList( d3d12->device, 0, D3D12_COMMAND_LIST_TYPE_DIRECT, d3d12->queue.allocator, - d3d12->pipe.handle, &d3d12->queue.cmd); + d3d12->pipes[VIDEO_SHADER_STOCK_BLEND], &d3d12->queue.cmd); D3D12CloseGraphicsCommandList(d3d12->queue.cmd); @@ -206,26 +207,25 @@ bool d3d12_init_queue(d3d12_video_t* d3d12) bool d3d12_init_swapchain(d3d12_video_t* d3d12, int width, int height, HWND hwnd) { { - DXGI_SWAP_CHAIN_DESC desc = { - .BufferCount = countof(d3d12->chain.renderTargets), - .BufferDesc.Width = width, - .BufferDesc.Height = height, - .BufferDesc.Format = DXGI_FORMAT_R8G8B8A8_UNORM, - .SampleDesc.Count = 1, + DXGI_SWAP_CHAIN_DESC desc = { 0 }; + desc.BufferCount = countof(d3d12->chain.renderTargets); + desc.BufferDesc.Width = width; + desc.BufferDesc.Height = height; + desc.BufferDesc.Format = DXGI_FORMAT_R8G8B8A8_UNORM; + desc.SampleDesc.Count = 1; #if 0 - .BufferDesc.RefreshRate.Numerator = 60, - .BufferDesc.RefreshRate.Denominator = 1, - .SampleDesc.Quality = 0, + desc.BufferDesc.RefreshRate.Numerator = 60; + desc.BufferDesc.RefreshRate.Denominator = 1; + desc.SampleDesc.Quality = 0; #endif - .BufferUsage = DXGI_USAGE_RENDER_TARGET_OUTPUT, - .OutputWindow = hwnd, - .Windowed = TRUE, + desc.BufferUsage = DXGI_USAGE_RENDER_TARGET_OUTPUT; + desc.OutputWindow = hwnd; + desc.Windowed = TRUE; #if 0 - .SwapEffect = DXGI_SWAP_EFFECT_FLIP_SEQUENTIAL, + desc.SwapEffect = DXGI_SWAP_EFFECT_FLIP_SEQUENTIAL; #else - .SwapEffect = DXGI_SWAP_EFFECT_FLIP_DISCARD, + desc.SwapEffect = DXGI_SWAP_EFFECT_FLIP_DISCARD; #endif - }; DXGICreateSwapChain(d3d12->factory, d3d12->queue.handle, &desc, &d3d12->chain.handle); } @@ -235,8 +235,6 @@ bool d3d12_init_swapchain(d3d12_video_t* d3d12, int width, int height, HWND hwnd for (int i = 0; i < countof(d3d12->chain.renderTargets); i++) { - d3d12->chain.desc_handles[i].ptr = - d3d12->pipe.rtv_heap.cpu.ptr + i * d3d12->pipe.rtv_heap.stride; DXGIGetSwapChainBuffer(d3d12->chain.handle, i, &d3d12->chain.renderTargets[i]); D3D12CreateRenderTargetView( d3d12->device, d3d12->chain.renderTargets[i], NULL, d3d12->chain.desc_handles[i]); @@ -256,240 +254,314 @@ static void d3d12_init_descriptor_heap(D3D12Device device, d3d12_descriptor_heap out->cpu = D3D12GetCPUDescriptorHandleForHeapStart(out->handle); out->gpu = D3D12GetGPUDescriptorHandleForHeapStart(out->handle); out->stride = D3D12GetDescriptorHandleIncrementSize(device, out->desc.Type); + out->map = (bool*)calloc(out->desc.NumDescriptors, sizeof(bool)); } -static void d3d12_init_sampler( - D3D12Device device, - d3d12_descriptor_heap_t* heap, - descriptor_heap_slot_t heap_index, - D3D12_FILTER filter, - D3D12_TEXTURE_ADDRESS_MODE address_mode, - D3D12_GPU_DESCRIPTOR_HANDLE* dst) +static inline void d3d12_release_descriptor_heap(d3d12_descriptor_heap_t* heap) { - D3D12_SAMPLER_DESC sampler_desc = { - .Filter = filter, - .AddressU = address_mode, - .AddressV = address_mode, - .AddressW = address_mode, - .MipLODBias = 0, - .MaxAnisotropy = 0, - .ComparisonFunc = D3D12_COMPARISON_FUNC_NEVER, - .BorderColor = { 0.0f }, - .MinLOD = 0.0f, - .MaxLOD = D3D12_FLOAT32_MAX, - }; - D3D12_CPU_DESCRIPTOR_HANDLE handle = { heap->cpu.ptr + heap_index * heap->stride }; - D3D12CreateSampler(device, &sampler_desc, handle); - dst->ptr = heap->gpu.ptr + heap_index * heap->stride; + free(heap->map); + Release(heap->handle); +} + +static D3D12_CPU_DESCRIPTOR_HANDLE d3d12_descriptor_heap_slot_alloc(d3d12_descriptor_heap_t* heap) +{ + int i; + D3D12_CPU_DESCRIPTOR_HANDLE handle = { 0 }; + + for (i = heap->start; i < heap->desc.NumDescriptors; i++) + { + if (!heap->map[i]) + { + heap->map[i] = true; + handle.ptr = heap->cpu.ptr + i * heap->stride; + heap->start = i + 1; + return handle; + } + } + /* if you get here try increasing NumDescriptors for this heap */ + assert(0); + return handle; +} + +static void +d3d12_descriptor_heap_slot_free(d3d12_descriptor_heap_t* heap, D3D12_CPU_DESCRIPTOR_HANDLE handle) +{ + int i; + + if (!handle.ptr) + return; + + assert(((handle.ptr - heap->cpu.ptr) % heap->stride) == 0); + + i = (handle.ptr - heap->cpu.ptr) / heap->stride; + assert(i >= 0 && i < heap->desc.NumDescriptors); + assert(heap->map[i]); + + heap->map[i] = false; + if (heap->start > i) + heap->start = i; +} + +bool d3d12_create_root_signature( + D3D12Device device, D3D12_ROOT_SIGNATURE_DESC* desc, D3D12RootSignature* out) +{ + D3DBlob signature; + D3DBlob error; + D3D12SerializeRootSignature(desc, D3D_ROOT_SIGNATURE_VERSION_1, &signature, &error); + + if (error) + { + RARCH_ERR( + "[D3D12]: CreateRootSignature failed : %s", (const char*)D3DGetBufferPointer(error)); + Release(error); + return false; + } + + D3D12CreateRootSignature( + device, 0, D3DGetBufferPointer(signature), D3DGetBufferSize(signature), out); + Release(signature); + + return true; } bool d3d12_init_descriptors(d3d12_video_t* d3d12) { + int i, j; D3D12_ROOT_SIGNATURE_DESC desc; - static const D3D12_DESCRIPTOR_RANGE srv_table[] = { - { - .RangeType = D3D12_DESCRIPTOR_RANGE_TYPE_SRV, - .NumDescriptors = 1, - .BaseShaderRegister = 0, - .RegisterSpace = 0, -#if 0 - .Flags = D3D12_DESCRIPTOR_RANGE_FLAG_DATA_STATIC, /* version 1_1 only */ -#endif - .OffsetInDescriptorsFromTableStart = D3D12_DESCRIPTOR_RANGE_OFFSET_APPEND, - }, - }; - static const D3D12_DESCRIPTOR_RANGE sampler_table[] = { - { - .RangeType = D3D12_DESCRIPTOR_RANGE_TYPE_SAMPLER, - .NumDescriptors = 1, - .BaseShaderRegister = 0, - .RegisterSpace = 0, - .OffsetInDescriptorsFromTableStart = D3D12_DESCRIPTOR_RANGE_OFFSET_APPEND, - }, - }; + D3D12_DESCRIPTOR_RANGE srv_tbl[1] = { { D3D12_DESCRIPTOR_RANGE_TYPE_SRV, 1 } }; + D3D12_DESCRIPTOR_RANGE uav_tbl[1] = { { D3D12_DESCRIPTOR_RANGE_TYPE_UAV, 1 } }; + D3D12_DESCRIPTOR_RANGE sampler_tbl[1] = { { D3D12_DESCRIPTOR_RANGE_TYPE_SAMPLER, 1 } }; + D3D12_STATIC_SAMPLER_DESC static_sampler = { D3D12_FILTER_MIN_MAG_MIP_POINT }; + D3D12_ROOT_PARAMETER root_params[ROOT_ID_MAX]; + D3D12_ROOT_PARAMETER cs_root_params[CS_ROOT_ID_MAX]; - D3D12_ROOT_PARAMETER rootParameters[ROOT_INDEX_MAX] = { - { - D3D12_ROOT_PARAMETER_TYPE_DESCRIPTOR_TABLE, - {{0}}, - D3D12_SHADER_VISIBILITY_PIXEL, - }, - { - D3D12_ROOT_PARAMETER_TYPE_DESCRIPTOR_TABLE, - {{0}}, - D3D12_SHADER_VISIBILITY_PIXEL, - }, - { - D3D12_ROOT_PARAMETER_TYPE_CBV, - {{0}}, - D3D12_SHADER_VISIBILITY_VERTEX, - } - }; + root_params[ROOT_ID_TEXTURE_T].ParameterType = D3D12_ROOT_PARAMETER_TYPE_DESCRIPTOR_TABLE; + root_params[ROOT_ID_TEXTURE_T].DescriptorTable.NumDescriptorRanges = countof(srv_tbl); + root_params[ROOT_ID_TEXTURE_T].DescriptorTable.pDescriptorRanges = srv_tbl; + root_params[ROOT_ID_TEXTURE_T].ShaderVisibility = D3D12_SHADER_VISIBILITY_PIXEL; - rootParameters[0].DescriptorTable.NumDescriptorRanges = countof(srv_table); - rootParameters[0].DescriptorTable.pDescriptorRanges = srv_table; - rootParameters[1].DescriptorTable.NumDescriptorRanges = countof(sampler_table); - rootParameters[1].DescriptorTable.pDescriptorRanges = sampler_table; - rootParameters[2].Descriptor.RegisterSpace = 0; - rootParameters[2].Descriptor.ShaderRegister = 0; + root_params[ROOT_ID_SAMPLER_T].ParameterType = D3D12_ROOT_PARAMETER_TYPE_DESCRIPTOR_TABLE; + root_params[ROOT_ID_SAMPLER_T].DescriptorTable.NumDescriptorRanges = countof(sampler_tbl); + root_params[ROOT_ID_SAMPLER_T].DescriptorTable.pDescriptorRanges = sampler_tbl; + root_params[ROOT_ID_SAMPLER_T].ShaderVisibility = D3D12_SHADER_VISIBILITY_PIXEL; - desc.NumParameters = countof(rootParameters); - desc.pParameters = rootParameters; + root_params[ROOT_ID_UBO].ParameterType = D3D12_ROOT_PARAMETER_TYPE_CBV; + root_params[ROOT_ID_UBO].Descriptor.RegisterSpace = 0; + root_params[ROOT_ID_UBO].Descriptor.ShaderRegister = 0; + root_params[ROOT_ID_UBO].ShaderVisibility = D3D12_SHADER_VISIBILITY_ALL; + + root_params[ROOT_ID_PC].ParameterType = D3D12_ROOT_PARAMETER_TYPE_CBV; + root_params[ROOT_ID_PC].Descriptor.RegisterSpace = 0; + root_params[ROOT_ID_PC].Descriptor.ShaderRegister = 1; + root_params[ROOT_ID_PC].ShaderVisibility = D3D12_SHADER_VISIBILITY_ALL; + + desc.NumParameters = countof(root_params); + desc.pParameters = root_params; desc.NumStaticSamplers = 0; desc.pStaticSamplers = NULL; desc.Flags = D3D12_ROOT_SIGNATURE_FLAG_ALLOW_INPUT_ASSEMBLER_INPUT_LAYOUT; + d3d12_create_root_signature(d3d12->device, &desc, &d3d12->desc.rootSignature); + + srv_tbl[0].NumDescriptors = SLANG_NUM_BINDINGS; + sampler_tbl[0].NumDescriptors = SLANG_NUM_BINDINGS; + d3d12_create_root_signature(d3d12->device, &desc, &d3d12->desc.sl_rootSignature); + + cs_root_params[CS_ROOT_ID_TEXTURE_T].ParameterType = D3D12_ROOT_PARAMETER_TYPE_DESCRIPTOR_TABLE; + cs_root_params[CS_ROOT_ID_TEXTURE_T].DescriptorTable.NumDescriptorRanges = countof(srv_tbl); + cs_root_params[CS_ROOT_ID_TEXTURE_T].DescriptorTable.pDescriptorRanges = srv_tbl; + cs_root_params[CS_ROOT_ID_TEXTURE_T].ShaderVisibility = 0; + + cs_root_params[CS_ROOT_ID_UAV_T].ParameterType = D3D12_ROOT_PARAMETER_TYPE_DESCRIPTOR_TABLE; + cs_root_params[CS_ROOT_ID_UAV_T].DescriptorTable.NumDescriptorRanges = countof(uav_tbl); + cs_root_params[CS_ROOT_ID_UAV_T].DescriptorTable.pDescriptorRanges = uav_tbl; + cs_root_params[CS_ROOT_ID_UAV_T].ShaderVisibility = 0; + + cs_root_params[CS_ROOT_ID_CONSTANTS].ParameterType = D3D12_ROOT_PARAMETER_TYPE_32BIT_CONSTANTS; + cs_root_params[CS_ROOT_ID_CONSTANTS].Constants.Num32BitValues = 3; + cs_root_params[CS_ROOT_ID_CONSTANTS].Constants.RegisterSpace = 0; + cs_root_params[CS_ROOT_ID_CONSTANTS].Constants.ShaderRegister = 0; + cs_root_params[CS_ROOT_ID_CONSTANTS].ShaderVisibility = 0; + + static_sampler.AddressU = D3D12_TEXTURE_ADDRESS_MODE_CLAMP; + static_sampler.AddressV = D3D12_TEXTURE_ADDRESS_MODE_CLAMP; + static_sampler.AddressW = D3D12_TEXTURE_ADDRESS_MODE_CLAMP; +#if 0 + static_sampler.MaxAnisotropy = 1; + static_sampler.ComparisonFunc = D3D12_COMPARISON_FUNC_NEVER; + static_sampler.MinLOD = -D3D12_FLOAT32_MAX; + static_sampler.MaxLOD = D3D12_FLOAT32_MAX; +#endif + + desc.NumParameters = countof(cs_root_params); + desc.pParameters = cs_root_params; + desc.NumStaticSamplers = 1; + desc.pStaticSamplers = &static_sampler; + desc.Flags = D3D12_ROOT_SIGNATURE_FLAG_DENY_VERTEX_SHADER_ROOT_ACCESS | + D3D12_ROOT_SIGNATURE_FLAG_DENY_HULL_SHADER_ROOT_ACCESS | + D3D12_ROOT_SIGNATURE_FLAG_DENY_DOMAIN_SHADER_ROOT_ACCESS | + D3D12_ROOT_SIGNATURE_FLAG_DENY_GEOMETRY_SHADER_ROOT_ACCESS | + D3D12_ROOT_SIGNATURE_FLAG_DENY_PIXEL_SHADER_ROOT_ACCESS; + + d3d12_create_root_signature(d3d12->device, &desc, &d3d12->desc.cs_rootSignature); + + d3d12->desc.rtv_heap.desc.Type = D3D12_DESCRIPTOR_HEAP_TYPE_RTV; + d3d12->desc.rtv_heap.desc.NumDescriptors = countof(d3d12->chain.renderTargets) + GFX_MAX_SHADERS; + d3d12->desc.rtv_heap.desc.Flags = D3D12_DESCRIPTOR_HEAP_FLAG_NONE; + d3d12_init_descriptor_heap(d3d12->device, &d3d12->desc.rtv_heap); + + d3d12->desc.srv_heap.desc.Type = D3D12_DESCRIPTOR_HEAP_TYPE_CBV_SRV_UAV; + d3d12->desc.srv_heap.desc.NumDescriptors = SLANG_NUM_BINDINGS * GFX_MAX_SHADERS + 1024; + d3d12->desc.srv_heap.desc.Flags = D3D12_DESCRIPTOR_HEAP_FLAG_SHADER_VISIBLE; + d3d12_init_descriptor_heap(d3d12->device, &d3d12->desc.srv_heap); + + d3d12->desc.sampler_heap.desc.Type = D3D12_DESCRIPTOR_HEAP_TYPE_SAMPLER; + d3d12->desc.sampler_heap.desc.NumDescriptors = + SLANG_NUM_BINDINGS * GFX_MAX_SHADERS + 2 * RARCH_WRAP_MAX; + d3d12->desc.sampler_heap.desc.Flags = D3D12_DESCRIPTOR_HEAP_FLAG_SHADER_VISIBLE; + d3d12_init_descriptor_heap(d3d12->device, &d3d12->desc.sampler_heap); + + for (i = 0; i < countof(d3d12->chain.renderTargets); i++) { - D3DBlob signature; - D3DBlob error; - D3D12SerializeRootSignature(&desc, D3D_ROOT_SIGNATURE_VERSION_1, &signature, &error); - - if (error) - { - RARCH_ERR( - "[D3D12]: CreateRootSignature failed :\n%s\n", - (const char*)D3DGetBufferPointer(error)); - Release(error); - return false; - } - - D3D12CreateRootSignature( - d3d12->device, 0, D3DGetBufferPointer(signature), D3DGetBufferSize(signature), - &d3d12->pipe.rootSignature); - Release(signature); + d3d12->chain.desc_handles[i].ptr = + d3d12->desc.rtv_heap.cpu.ptr + i * d3d12->desc.rtv_heap.stride; } - d3d12->pipe.rtv_heap.desc.Type = D3D12_DESCRIPTOR_HEAP_TYPE_RTV; - d3d12->pipe.rtv_heap.desc.NumDescriptors = countof(d3d12->chain.renderTargets); - d3d12->pipe.rtv_heap.desc.Flags = D3D12_DESCRIPTOR_HEAP_FLAG_NONE; - d3d12_init_descriptor_heap(d3d12->device, &d3d12->pipe.rtv_heap); + for (i = 0; i < GFX_MAX_SHADERS; i++) + { + d3d12->pass[i].rt.rt_view.ptr = + d3d12->desc.rtv_heap.cpu.ptr + + (countof(d3d12->chain.renderTargets) + i) * d3d12->desc.rtv_heap.stride; - d3d12->pipe.srv_heap.desc.Type = D3D12_DESCRIPTOR_HEAP_TYPE_CBV_SRV_UAV; - d3d12->pipe.srv_heap.desc.NumDescriptors = SRV_HEAP_SLOT_MAX; - d3d12->pipe.srv_heap.desc.Flags = D3D12_DESCRIPTOR_HEAP_FLAG_SHADER_VISIBLE; - d3d12_init_descriptor_heap(d3d12->device, &d3d12->pipe.srv_heap); + d3d12->pass[i].textures.ptr = d3d12_descriptor_heap_slot_alloc(&d3d12->desc.srv_heap).ptr - + d3d12->desc.srv_heap.cpu.ptr + d3d12->desc.srv_heap.gpu.ptr; + d3d12->pass[i].samplers.ptr = + d3d12_descriptor_heap_slot_alloc(&d3d12->desc.sampler_heap).ptr - + d3d12->desc.sampler_heap.cpu.ptr + d3d12->desc.sampler_heap.gpu.ptr; - d3d12->pipe.sampler_heap.desc.Type = D3D12_DESCRIPTOR_HEAP_TYPE_SAMPLER; - d3d12->pipe.sampler_heap.desc.NumDescriptors = SAMPLER_HEAP_SLOT_MAX; - d3d12->pipe.sampler_heap.desc.Flags = D3D12_DESCRIPTOR_HEAP_FLAG_SHADER_VISIBLE; - d3d12_init_descriptor_heap(d3d12->device, &d3d12->pipe.sampler_heap); + for (j = 1; j < SLANG_NUM_BINDINGS; j++) + { + d3d12_descriptor_heap_slot_alloc(&d3d12->desc.srv_heap); + d3d12_descriptor_heap_slot_alloc(&d3d12->desc.sampler_heap); + } + } - d3d12_init_sampler( - d3d12->device, &d3d12->pipe.sampler_heap, SAMPLER_HEAP_SLOT_LINEAR, - D3D12_FILTER_MIN_MAG_MIP_LINEAR, D3D12_TEXTURE_ADDRESS_MODE_BORDER, - &d3d12->sampler_linear); - d3d12_init_sampler( - d3d12->device, &d3d12->pipe.sampler_heap, SAMPLER_HEAP_SLOT_NEAREST, - D3D12_FILTER_MIN_MAG_MIP_POINT, D3D12_TEXTURE_ADDRESS_MODE_BORDER, - &d3d12->sampler_nearest); return true; } -bool d3d12_init_pipeline(d3d12_video_t* d3d12) +static INLINE D3D12_GPU_DESCRIPTOR_HANDLE + d3d12_create_sampler(D3D12Device device, D3D12_SAMPLER_DESC* desc, d3d12_descriptor_heap_t* heap) { - D3DBlob vs_code; - D3DBlob ps_code; + D3D12_CPU_DESCRIPTOR_HANDLE cpu_handle = d3d12_descriptor_heap_slot_alloc(heap); + D3D12_GPU_DESCRIPTOR_HANDLE gpu_handle = { cpu_handle.ptr - heap->cpu.ptr + heap->gpu.ptr }; - static const char stock[] = -#include "../drivers/d3d_shaders/opaque_sm5.hlsl.h" - ; + D3D12CreateSampler(device, desc, cpu_handle); + return gpu_handle; +} - static const D3D12_INPUT_ELEMENT_DESC inputElementDesc[] = { - { "POSITION", 0, DXGI_FORMAT_R32G32_FLOAT, 0, offsetof(d3d12_vertex_t, position), - D3D12_INPUT_CLASSIFICATION_PER_VERTEX_DATA, 0 }, - { "TEXCOORD", 0, DXGI_FORMAT_R32G32_FLOAT, 0, offsetof(d3d12_vertex_t, texcoord), - D3D12_INPUT_CLASSIFICATION_PER_VERTEX_DATA, 0 }, - { "COLOR", 0, DXGI_FORMAT_R32G32B32A32_FLOAT, 0, offsetof(d3d12_vertex_t, color), - D3D12_INPUT_CLASSIFICATION_PER_VERTEX_DATA, 0 }, - }; - - static const D3D12_RASTERIZER_DESC rasterizerDesc = { - .FillMode = D3D12_FILL_MODE_SOLID, - .CullMode = D3D12_CULL_MODE_BACK, - .FrontCounterClockwise = FALSE, - .DepthBias = D3D12_DEFAULT_DEPTH_BIAS, - .DepthBiasClamp = D3D12_DEFAULT_DEPTH_BIAS_CLAMP, - .SlopeScaledDepthBias = D3D12_DEFAULT_SLOPE_SCALED_DEPTH_BIAS, - .DepthClipEnable = TRUE, - .MultisampleEnable = FALSE, - .AntialiasedLineEnable = FALSE, - .ForcedSampleCount = 0, - .ConservativeRaster = D3D12_CONSERVATIVE_RASTERIZATION_MODE_OFF, - }; - - static const D3D12_BLEND_DESC blendDesc = { - .AlphaToCoverageEnable = FALSE, - .IndependentBlendEnable = FALSE, - .RenderTarget[0] = - { - .BlendEnable = TRUE, - .LogicOpEnable = FALSE, - D3D12_BLEND_SRC_ALPHA, - D3D12_BLEND_INV_SRC_ALPHA, - D3D12_BLEND_OP_ADD, - D3D12_BLEND_SRC_ALPHA, - D3D12_BLEND_INV_SRC_ALPHA, - D3D12_BLEND_OP_ADD, - D3D12_LOGIC_OP_NOOP, - D3D12_COLOR_WRITE_ENABLE_ALL, - }, - }; - - if (!d3d_compile(stock, sizeof(stock), NULL, "VSMain", "vs_5_0", &vs_code)) - return false; - - if (!d3d_compile(stock, sizeof(stock), NULL, "PSMain", "ps_5_0", &ps_code)) - return false; +void d3d12_init_samplers(d3d12_video_t* d3d12) +{ + int i; + D3D12_SAMPLER_DESC desc = { D3D12_FILTER_MIN_MAG_MIP_POINT }; + desc.MaxAnisotropy = 1; + desc.ComparisonFunc = D3D12_COMPARISON_FUNC_NEVER; + desc.MinLOD = -D3D12_FLOAT32_MAX; + desc.MaxLOD = D3D12_FLOAT32_MAX; + for (i = 0; i < RARCH_WRAP_MAX; i++) { - D3D12_GRAPHICS_PIPELINE_STATE_DESC psodesc = { - .pRootSignature = d3d12->pipe.rootSignature, - .VS.pShaderBytecode = D3DGetBufferPointer(vs_code), - .VS.BytecodeLength = D3DGetBufferSize(vs_code), - .PS.pShaderBytecode = D3DGetBufferPointer(ps_code), - .PS.BytecodeLength = D3DGetBufferSize(ps_code), - .BlendState.AlphaToCoverageEnable = FALSE, - .BlendState.IndependentBlendEnable = FALSE, - .BlendState.RenderTarget[0] = - { - .BlendEnable = TRUE, - .LogicOpEnable = FALSE, - D3D12_BLEND_SRC_ALPHA, - D3D12_BLEND_INV_SRC_ALPHA, - D3D12_BLEND_OP_ADD, - D3D12_BLEND_SRC_ALPHA, - D3D12_BLEND_INV_SRC_ALPHA, - D3D12_BLEND_OP_ADD, - D3D12_LOGIC_OP_NOOP, - D3D12_COLOR_WRITE_ENABLE_ALL, - }, - .SampleMask = UINT_MAX, - .RasterizerState.FillMode = D3D12_FILL_MODE_SOLID, - .RasterizerState.CullMode = D3D12_CULL_MODE_BACK, - .RasterizerState.FrontCounterClockwise = FALSE, - .RasterizerState.DepthBias = D3D12_DEFAULT_DEPTH_BIAS, - .RasterizerState.DepthBiasClamp = D3D12_DEFAULT_DEPTH_BIAS_CLAMP, - .RasterizerState.SlopeScaledDepthBias = D3D12_DEFAULT_SLOPE_SCALED_DEPTH_BIAS, - .RasterizerState.DepthClipEnable = TRUE, - .RasterizerState.MultisampleEnable = FALSE, - .RasterizerState.AntialiasedLineEnable = FALSE, - .RasterizerState.ForcedSampleCount = 0, - .RasterizerState.ConservativeRaster = D3D12_CONSERVATIVE_RASTERIZATION_MODE_OFF, - .DepthStencilState.DepthEnable = FALSE, - .DepthStencilState.StencilEnable = FALSE, - .InputLayout.pInputElementDescs = inputElementDesc, - .InputLayout.NumElements = countof(inputElementDesc), - .PrimitiveTopologyType = D3D12_PRIMITIVE_TOPOLOGY_TYPE_TRIANGLE, - .NumRenderTargets = 1, - .RTVFormats[0] = DXGI_FORMAT_R8G8B8A8_UNORM, - .SampleDesc.Count = 1, - }; + switch (i) + { + case RARCH_WRAP_BORDER: + desc.AddressU = D3D12_TEXTURE_ADDRESS_MODE_BORDER; + break; - D3D12CreateGraphicsPipelineState(d3d12->device, &psodesc, &d3d12->pipe.handle); + case RARCH_WRAP_EDGE: + desc.AddressU = D3D12_TEXTURE_ADDRESS_MODE_CLAMP; + break; + + case RARCH_WRAP_REPEAT: + desc.AddressU = D3D12_TEXTURE_ADDRESS_MODE_WRAP; + break; + + case RARCH_WRAP_MIRRORED_REPEAT: + desc.AddressU = D3D12_TEXTURE_ADDRESS_MODE_MIRROR; + break; + } + desc.AddressV = desc.AddressU; + desc.AddressW = desc.AddressU; + + desc.Filter = D3D12_FILTER_MIN_MAG_MIP_LINEAR; + d3d12->samplers[RARCH_FILTER_LINEAR][i] = + d3d12_create_sampler(d3d12->device, &desc, &d3d12->desc.sampler_heap); + + desc.Filter = D3D12_FILTER_MIN_MAG_MIP_POINT; + d3d12->samplers[RARCH_FILTER_NEAREST][i] = + d3d12_create_sampler(d3d12->device, &desc, &d3d12->desc.sampler_heap); + } +} + +D3D12_RENDER_TARGET_BLEND_DESC d3d12_blend_enable_desc = { + TRUE, + FALSE, + D3D12_BLEND_SRC_ALPHA, + D3D12_BLEND_INV_SRC_ALPHA, + D3D12_BLEND_OP_ADD, + D3D12_BLEND_SRC_ALPHA, + D3D12_BLEND_INV_SRC_ALPHA, + D3D12_BLEND_OP_ADD, + D3D12_LOGIC_OP_NOOP, + D3D12_COLOR_WRITE_ENABLE_ALL, +}; + +bool d3d12_init_pipeline( + D3D12Device device, + D3DBlob vs_code, + D3DBlob ps_code, + D3DBlob gs_code, + D3D12_GRAPHICS_PIPELINE_STATE_DESC* desc, + D3D12PipelineState* out) +{ + if (vs_code) + { + desc->VS.pShaderBytecode = D3DGetBufferPointer(vs_code); + desc->VS.BytecodeLength = D3DGetBufferSize(vs_code); + } + else + { + desc->VS.pShaderBytecode = NULL; + desc->VS.BytecodeLength = 0; } - Release(vs_code); - Release(ps_code); + if (ps_code) + { + desc->PS.pShaderBytecode = D3DGetBufferPointer(ps_code); + desc->PS.BytecodeLength = D3DGetBufferSize(ps_code); + } + else + { + desc->PS.pShaderBytecode = NULL; + desc->PS.BytecodeLength = 0; + } + + if (gs_code) + { + desc->GS.pShaderBytecode = D3DGetBufferPointer(gs_code); + desc->GS.BytecodeLength = D3DGetBufferSize(gs_code); + } + else + { + desc->GS.pShaderBytecode = NULL; + desc->GS.BytecodeLength = 0; + } + + desc->SampleMask = UINT_MAX; + desc->RasterizerState.FillMode = D3D12_FILL_MODE_SOLID; + desc->RasterizerState.CullMode = D3D12_CULL_MODE_NONE; + desc->NumRenderTargets = 1; + desc->SampleDesc.Count = 1; + + D3D12CreateGraphicsPipelineState(device, desc, out); return true; } @@ -497,21 +569,16 @@ bool d3d12_init_pipeline(d3d12_video_t* d3d12) D3D12_GPU_VIRTUAL_ADDRESS d3d12_create_buffer(D3D12Device device, UINT size_in_bytes, D3D12Resource* buffer) { - static const D3D12_HEAP_PROPERTIES heap_props = { - .Type = D3D12_HEAP_TYPE_UPLOAD, - .CreationNodeMask = 1, - .VisibleNodeMask = 1, - }; + D3D12_HEAP_PROPERTIES heap_props = { D3D12_HEAP_TYPE_UPLOAD, D3D12_CPU_PAGE_PROPERTY_UNKNOWN, + D3D12_MEMORY_POOL_UNKNOWN, 1, 1 }; + D3D12_RESOURCE_DESC resource_desc = { D3D12_RESOURCE_DIMENSION_BUFFER }; - D3D12_RESOURCE_DESC resource_desc = { - .Dimension = D3D12_RESOURCE_DIMENSION_BUFFER, - .Width = size_in_bytes, - .Height = 1, - .DepthOrArraySize = 1, - .MipLevels = 1, - .SampleDesc.Count = 1, - .Layout = D3D12_TEXTURE_LAYOUT_ROW_MAJOR, - }; + resource_desc.Width = size_in_bytes; + resource_desc.Height = 1; + resource_desc.DepthOrArraySize = 1; + resource_desc.MipLevels = 1; + resource_desc.SampleDesc.Count = 1; + resource_desc.Layout = D3D12_TEXTURE_LAYOUT_ROW_MAJOR; D3D12CreateCommittedResource( device, (D3D12_HEAP_PROPERTIES*)&heap_props, D3D12_HEAP_FLAG_NONE, &resource_desc, @@ -520,72 +587,167 @@ d3d12_create_buffer(D3D12Device device, UINT size_in_bytes, D3D12Resource* buffe return D3D12GetGPUVirtualAddress(*buffer); } -void d3d12_init_texture( - D3D12Device device, - d3d12_descriptor_heap_t* heap, - descriptor_heap_slot_t heap_index, - d3d12_texture_t* texture) +void d3d12_release_texture(d3d12_texture_t* texture) { + if (!texture->handle) + return; + + if (texture->srv_heap && texture->desc.MipLevels <= countof(texture->cpu_descriptor)) + { + int i; + for (i = 0; i < texture->desc.MipLevels; i++) + { + d3d12_descriptor_heap_slot_free(texture->srv_heap, texture->cpu_descriptor[i]); + texture->cpu_descriptor[i].ptr = 0; + } + } + Release(texture->handle); Release(texture->upload_buffer); +} +void d3d12_init_texture(D3D12Device device, d3d12_texture_t* texture) +{ + int i; + d3d12_release_texture(texture); + + if (!texture->desc.MipLevels) + texture->desc.MipLevels = 1; + + if (!(texture->desc.Width >> (texture->desc.MipLevels - 1)) && + !(texture->desc.Height >> (texture->desc.MipLevels - 1))) + { + unsigned width = texture->desc.Width >> 5; + unsigned height = texture->desc.Height >> 5; + texture->desc.MipLevels = 1; + while (width && height) + { + width >>= 1; + height >>= 1; + texture->desc.MipLevels++; + } + } { + D3D12_FEATURE_DATA_FORMAT_SUPPORT format_support = { + texture->desc.Format, D3D12_FORMAT_SUPPORT1_TEXTURE2D | D3D12_FORMAT_SUPPORT1_SHADER_SAMPLE + }; + D3D12_HEAP_PROPERTIES heap_props = { D3D12_HEAP_TYPE_DEFAULT, D3D12_CPU_PAGE_PROPERTY_UNKNOWN, + D3D12_MEMORY_POOL_UNKNOWN, 1, 1 }; + + if (texture->desc.MipLevels > 1) + { + texture->desc.Flags |= D3D12_RESOURCE_FLAG_ALLOW_UNORDERED_ACCESS; + format_support.Support1 |= D3D12_FORMAT_SUPPORT1_MIP; + format_support.Support2 |= D3D12_FORMAT_SUPPORT2_UAV_TYPED_STORE; + } + + if (texture->desc.Flags & D3D12_RESOURCE_FLAG_ALLOW_RENDER_TARGET) + format_support.Support1 |= D3D12_FORMAT_SUPPORT1_RENDER_TARGET; + texture->desc.Dimension = D3D12_RESOURCE_DIMENSION_TEXTURE2D; texture->desc.DepthOrArraySize = 1; - texture->desc.MipLevels = 1; texture->desc.SampleDesc.Count = 1; + texture->desc.Format = d3d12_get_closest_match(device, &format_support); - D3D12_HEAP_PROPERTIES heap_props = { D3D12_HEAP_TYPE_DEFAULT, 0, 0, 1, 1 }; D3D12CreateCommittedResource( device, &heap_props, D3D12_HEAP_FLAG_NONE, &texture->desc, D3D12_RESOURCE_STATE_PIXEL_SHADER_RESOURCE, NULL, &texture->handle); } - D3D12GetCopyableFootprints( - device, &texture->desc, 0, 1, 0, &texture->layout, &texture->num_rows, - &texture->row_size_in_bytes, &texture->total_bytes); + assert(texture->srv_heap); { - D3D12_RESOURCE_DESC buffer_desc = { - .Dimension = D3D12_RESOURCE_DIMENSION_BUFFER, - .Width = texture->total_bytes, - .Height = 1, - .DepthOrArraySize = 1, - .MipLevels = 1, - .SampleDesc.Count = 1, - .Layout = D3D12_TEXTURE_LAYOUT_ROW_MAJOR, - }; - D3D12_HEAP_PROPERTIES heap_props = { D3D12_HEAP_TYPE_UPLOAD, 0, 0, 1, 1 }; + D3D12_SHADER_RESOURCE_VIEW_DESC desc = { texture->desc.Format }; + + desc.Shader4ComponentMapping = D3D12_DEFAULT_SHADER_4_COMPONENT_MAPPING; + desc.ViewDimension = D3D12_SRV_DIMENSION_TEXTURE2D; + desc.Texture2D.MipLevels = texture->desc.MipLevels; + + texture->cpu_descriptor[0] = d3d12_descriptor_heap_slot_alloc(texture->srv_heap); + D3D12CreateShaderResourceView(device, texture->handle, &desc, texture->cpu_descriptor[0]); + texture->gpu_descriptor[0].ptr = texture->cpu_descriptor[0].ptr - texture->srv_heap->cpu.ptr + + texture->srv_heap->gpu.ptr; + } + + for (i = 1; i < texture->desc.MipLevels; i++) + { + D3D12_UNORDERED_ACCESS_VIEW_DESC desc = { texture->desc.Format }; + + desc.ViewDimension = D3D12_UAV_DIMENSION_TEXTURE2D; + desc.Texture2D.MipSlice = i; + + texture->cpu_descriptor[i] = d3d12_descriptor_heap_slot_alloc(texture->srv_heap); + D3D12CreateUnorderedAccessView( + device, texture->handle, NULL, &desc, texture->cpu_descriptor[i]); + texture->gpu_descriptor[i].ptr = texture->cpu_descriptor[i].ptr - texture->srv_heap->cpu.ptr + + texture->srv_heap->gpu.ptr; + } + + if (texture->desc.Flags & D3D12_RESOURCE_FLAG_ALLOW_RENDER_TARGET) + { + assert(texture->rt_view.ptr); + D3D12CreateRenderTargetView(device, texture->handle, NULL, texture->rt_view); + } + else + { + D3D12_HEAP_PROPERTIES heap_props = { D3D12_HEAP_TYPE_UPLOAD, D3D12_CPU_PAGE_PROPERTY_UNKNOWN, + D3D12_MEMORY_POOL_UNKNOWN, 1, 1 }; + D3D12_RESOURCE_DESC buffer_desc = { D3D12_RESOURCE_DIMENSION_BUFFER }; + + D3D12GetCopyableFootprints( + device, &texture->desc, 0, 1, 0, &texture->layout, &texture->num_rows, + &texture->row_size_in_bytes, &texture->total_bytes); + + buffer_desc.Width = texture->total_bytes; + buffer_desc.Height = 1; + buffer_desc.DepthOrArraySize = 1; + buffer_desc.MipLevels = 1; + buffer_desc.SampleDesc.Count = 1; + buffer_desc.Layout = D3D12_TEXTURE_LAYOUT_ROW_MAJOR; +#if 0 + buffer_desc.Flags = D3D12_RESOURCE_FLAG_DENY_SHADER_RESOURCE; +#endif D3D12CreateCommittedResource( device, &heap_props, D3D12_HEAP_FLAG_NONE, &buffer_desc, D3D12_RESOURCE_STATE_GENERIC_READ, NULL, &texture->upload_buffer); } - { - D3D12_CPU_DESCRIPTOR_HANDLE handle; - D3D12_SHADER_RESOURCE_VIEW_DESC view_desc = { 0 }; - - view_desc.Shader4ComponentMapping = D3D12_DEFAULT_SHADER_4_COMPONENT_MAPPING; - view_desc.Format = texture->desc.Format; - view_desc.ViewDimension = D3D12_SRV_DIMENSION_TEXTURE2D; - view_desc.Texture2D.MipLevels = texture->desc.MipLevels; - - handle.ptr = heap->cpu.ptr + heap_index * heap->stride; - - D3D12CreateShaderResourceView(device, texture->handle, &view_desc, handle); - texture->gpu_descriptor.ptr = heap->gpu.ptr + heap_index * heap->stride; - } + texture->size_data.x = texture->desc.Width; + texture->size_data.y = texture->desc.Height; + texture->size_data.z = 1.0f / texture->desc.Width; + texture->size_data.w = 1.0f / texture->desc.Height; } +void d3d12_update_texture( + int width, + int height, + int pitch, + DXGI_FORMAT format, + const void* data, + d3d12_texture_t* texture) +{ + uint8_t* dst; + D3D12_RANGE read_range = { 0, 0 }; + + D3D12Map(texture->upload_buffer, 0, &read_range, (void**)&dst); + + dxgi_copy( + width, height, format, pitch, data, texture->desc.Format, + texture->layout.Footprint.RowPitch, dst + texture->layout.Offset); + + D3D12Unmap(texture->upload_buffer, 0, NULL); + + texture->dirty = true; +} void d3d12_upload_texture(D3D12GraphicsCommandList cmd, d3d12_texture_t* texture) { D3D12_TEXTURE_COPY_LOCATION src = { 0 }; D3D12_TEXTURE_COPY_LOCATION dst = { 0 }; - src.pResource = texture->upload_buffer; - src.Type = D3D12_TEXTURE_COPY_TYPE_PLACED_FOOTPRINT; - src.PlacedFootprint = texture->layout; + src.pResource = texture->upload_buffer; + src.Type = D3D12_TEXTURE_COPY_TYPE_PLACED_FOOTPRINT; + src.PlacedFootprint = texture->layout; dst.pResource = texture->handle; dst.Type = D3D12_TEXTURE_COPY_TYPE_SUBRESOURCE_INDEX; @@ -601,6 +763,56 @@ void d3d12_upload_texture(D3D12GraphicsCommandList cmd, d3d12_texture_t* texture cmd, texture->handle, D3D12_RESOURCE_STATE_COPY_DEST, D3D12_RESOURCE_STATE_PIXEL_SHADER_RESOURCE); + if (texture->desc.MipLevels > 1) + { + unsigned i; + d3d12_video_t* d3d12 = (d3d12_video_t*)video_driver_get_ptr(false); + + D3D12SetComputeRootSignature(cmd, d3d12->desc.cs_rootSignature); + D3D12SetPipelineState(cmd, d3d12->mipmapgen_pipe); + D3D12SetComputeRootDescriptorTable(cmd, CS_ROOT_ID_TEXTURE_T, texture->gpu_descriptor[0]); + + for (i = 1; i < texture->desc.MipLevels; i++) + { + unsigned width = texture->desc.Width >> i; + unsigned height = texture->desc.Height >> i; + struct + { + uint32_t src_level; + float texel_size[2]; + } cbuffer = { i - 1, { 1.0f / width, 1.0f / height } }; + + { + D3D12_RESOURCE_BARRIER barrier = { D3D12_RESOURCE_BARRIER_TYPE_TRANSITION }; + barrier.Transition.pResource = texture->handle; + barrier.Transition.StateBefore = D3D12_RESOURCE_STATE_PIXEL_SHADER_RESOURCE; + barrier.Transition.StateAfter = D3D12_RESOURCE_STATE_UNORDERED_ACCESS; + barrier.Transition.Subresource = i; + D3D12ResourceBarrier(cmd, 1, &barrier); + } + + D3D12SetComputeRootDescriptorTable(cmd, CS_ROOT_ID_UAV_T, texture->gpu_descriptor[i]); + D3D12SetComputeRoot32BitConstants( + cmd, CS_ROOT_ID_CONSTANTS, sizeof(cbuffer) / sizeof(uint32_t), &cbuffer, 0); + D3D12Dispatch(cmd, (width + 0x7) >> 3, (height + 0x7) >> 3, 1); + + { + D3D12_RESOURCE_BARRIER barrier = { D3D12_RESOURCE_BARRIER_TYPE_UAV }; + barrier.UAV.pResource = texture->handle; + D3D12ResourceBarrier(cmd, 1, &barrier); + } + + { + D3D12_RESOURCE_BARRIER barrier = { D3D12_RESOURCE_BARRIER_TYPE_TRANSITION }; + barrier.Transition.pResource = texture->handle; + barrier.Transition.StateBefore = D3D12_RESOURCE_STATE_UNORDERED_ACCESS; + barrier.Transition.StateAfter = D3D12_RESOURCE_STATE_PIXEL_SHADER_RESOURCE; + barrier.Transition.Subresource = i; + D3D12ResourceBarrier(cmd, 1, &barrier); + } + } + } + texture->dirty = false; } @@ -628,13 +840,12 @@ void d3d12_create_fullscreen_quad_vbo( } } -DXGI_FORMAT d3d12_get_closest_match( - D3D12Device device, DXGI_FORMAT desired_format, D3D12_FORMAT_SUPPORT1 desired_format_support) +DXGI_FORMAT d3d12_get_closest_match(D3D12Device device, D3D12_FEATURE_DATA_FORMAT_SUPPORT* desired) { - DXGI_FORMAT default_list[] = {desired_format, DXGI_FORMAT_UNKNOWN}; - DXGI_FORMAT* format = dxgi_get_format_fallback_list(desired_format); + DXGI_FORMAT default_list[] = { desired->Format, DXGI_FORMAT_UNKNOWN }; + DXGI_FORMAT* format = dxgi_get_format_fallback_list(desired->Format); - if(!format) + if (!format) format = default_list; while (*format != DXGI_FORMAT_UNKNOWN) @@ -642,7 +853,8 @@ DXGI_FORMAT d3d12_get_closest_match( D3D12_FEATURE_DATA_FORMAT_SUPPORT format_support = { *format }; if (SUCCEEDED(D3D12CheckFeatureSupport( device, D3D12_FEATURE_FORMAT_SUPPORT, &format_support, sizeof(format_support))) && - ((format_support.Support1 & desired_format_support) == desired_format_support)) + ((format_support.Support1 & desired->Support1) == desired->Support1) && + ((format_support.Support2 & desired->Support2) == desired->Support2)) break; format++; } diff --git a/gfx/common/d3d12_common.h b/gfx/common/d3d12_common.h index 58b3c985d2..fb2b653326 100644 --- a/gfx/common/d3d12_common.h +++ b/gfx/common/d3d12_common.h @@ -20,6 +20,8 @@ #include "dxgi_common.h" #include +typedef const ID3D12PipelineState* D3D12PipelineStateRef; + /* auto-generated */ typedef ID3D12Object* D3D12Object; @@ -49,7 +51,7 @@ typedef ID3D12InfoQueue* D3D12InfoQueue; static INLINE ULONG D3D12Release(void* object) { - return ((ID3D12Object*)object)->lpVtbl->Release(object); + return ((ID3D12Object*)object)->lpVtbl->Release((ID3D12Object*)object); } static INLINE ULONG D3D12ReleaseDeviceChild(D3D12DeviceChild device_child) { @@ -96,20 +98,22 @@ static INLINE ULONG D3D12ReleasePageable(D3D12Pageable pageable) static INLINE ULONG D3D12ReleaseHeap(D3D12Heap heap) { return heap->lpVtbl->Release(heap); } static INLINE ULONG D3D12ReleaseResource(void* resource) { - return ((ID3D12Resource*)resource)->lpVtbl->Release(resource); + return ((ID3D12Resource*)resource)->lpVtbl->Release((ID3D12Resource*)resource); } static INLINE HRESULT D3D12Map(void* resource, UINT subresource, D3D12_RANGE* read_range, void** data) { - return ((ID3D12Resource*)resource)->lpVtbl->Map(resource, subresource, read_range, data); + return ((ID3D12Resource*)resource) + ->lpVtbl->Map((ID3D12Resource*)resource, subresource, read_range, data); } static INLINE void D3D12Unmap(void* resource, UINT subresource, D3D12_RANGE* written_range) { - ((ID3D12Resource*)resource)->lpVtbl->Unmap(resource, subresource, written_range); + ((ID3D12Resource*)resource) + ->lpVtbl->Unmap((ID3D12Resource*)resource, subresource, written_range); } static INLINE D3D12_GPU_VIRTUAL_ADDRESS D3D12GetGPUVirtualAddress(void* resource) { - return ((ID3D12Resource*)resource)->lpVtbl->GetGPUVirtualAddress(resource); + return ((ID3D12Resource*)resource)->lpVtbl->GetGPUVirtualAddress((ID3D12Resource*)resource); } static INLINE HRESULT D3D12WriteToSubresource( void* resource, @@ -121,7 +125,8 @@ static INLINE HRESULT D3D12WriteToSubresource( { return ((ID3D12Resource*)resource) ->lpVtbl->WriteToSubresource( - resource, dst_subresource, dst_box, src_data, src_row_pitch, src_depth_pitch); + (ID3D12Resource*)resource, dst_subresource, dst_box, src_data, src_row_pitch, + src_depth_pitch); } static INLINE HRESULT D3D12ReadFromSubresource( void* resource, @@ -133,13 +138,14 @@ static INLINE HRESULT D3D12ReadFromSubresource( { return ((ID3D12Resource*)resource) ->lpVtbl->ReadFromSubresource( - resource, dst_data, dst_row_pitch, dst_depth_pitch, src_subresource, src_box); + (ID3D12Resource*)resource, dst_data, dst_row_pitch, dst_depth_pitch, src_subresource, + src_box); } static INLINE HRESULT D3D12GetHeapProperties( void* resource, D3D12_HEAP_PROPERTIES* heap_properties, D3D12_HEAP_FLAGS* heap_flags) { return ((ID3D12Resource*)resource) - ->lpVtbl->GetHeapProperties(resource, heap_properties, heap_flags); + ->lpVtbl->GetHeapProperties((ID3D12Resource*)resource, heap_properties, heap_flags); } static INLINE ULONG D3D12ReleaseCommandAllocator(D3D12CommandAllocator command_allocator) { @@ -314,9 +320,9 @@ D3D12OMSetStencilRef(D3D12GraphicsCommandList graphics_command_list, UINT stenci graphics_command_list->lpVtbl->OMSetStencilRef(graphics_command_list, stencil_ref); } static INLINE void D3D12SetPipelineState( - D3D12GraphicsCommandList graphics_command_list, D3D12PipelineState pipeline_state) + D3D12GraphicsCommandList graphics_command_list, D3D12PipelineStateRef pipeline_state) { - graphics_command_list->lpVtbl->SetPipelineState(graphics_command_list, pipeline_state); + graphics_command_list->lpVtbl->SetPipelineState(graphics_command_list, (D3D12PipelineState)pipeline_state); } static INLINE void D3D12ResourceBarrier( D3D12GraphicsCommandList graphics_command_list, @@ -639,8 +645,7 @@ static INLINE UINT D3D12GetNodeCount(D3D12Device device) static INLINE HRESULT D3D12CreateCommandQueue( D3D12Device device, D3D12_COMMAND_QUEUE_DESC* desc, ID3D12CommandQueue** out) { - return device->lpVtbl->CreateCommandQueue( - device, desc, uuidof(ID3D12CommandQueue), (void**)out); + return device->lpVtbl->CreateCommandQueue(device, desc, uuidof(ID3D12CommandQueue), (void**)out); } static INLINE HRESULT D3D12CreateCommandAllocator( D3D12Device device, D3D12_COMMAND_LIST_TYPE type, ID3D12CommandAllocator** out) @@ -1207,8 +1212,7 @@ static INLINE void D3D12ExecuteGraphicsCommandLists( static INLINE HRESULT DXGIGetSwapChainBuffer(DXGISwapChain swapchain, UINT buffer, D3D12Resource* surface) { - return swapchain->lpVtbl->GetBuffer( - swapchain, buffer, uuidof(ID3D12Resource), (void**)surface); + return swapchain->lpVtbl->GetBuffer(swapchain, buffer, uuidof(ID3D12Resource), (void**)surface); } static INLINE void D3D12SetDescriptorHeaps( D3D12GraphicsCommandList command_list, @@ -1250,9 +1254,12 @@ D3D12GetGPUDescriptorHandleForHeapStart(D3D12DescriptorHeap descriptor_heap) /* internal */ #include +#include #include +#include "../common/d3dcompiler_common.h" #include "../video_driver.h" +#include "../drivers_shader/slang_process.h" typedef struct d3d12_vertex_t { @@ -1261,6 +1268,24 @@ typedef struct d3d12_vertex_t float color[4]; } d3d12_vertex_t; +typedef struct +{ + struct + { + float x, y, w, h; + } pos; + struct + { + float u, v, w, h; + } coords; + UINT32 colors[4]; + struct + { + float scaling; + float rotation; + } params; +} d3d12_sprite_t; + typedef struct { D3D12DescriptorHeap handle; /* descriptor pool */ @@ -1268,7 +1293,8 @@ typedef struct D3D12_CPU_DESCRIPTOR_HANDLE cpu; /* descriptor */ D3D12_GPU_DESCRIPTOR_HANDLE gpu; /* descriptor */ UINT stride; - UINT count; + bool* map; + int start; } d3d12_descriptor_heap_t; typedef struct @@ -1276,14 +1302,42 @@ typedef struct D3D12Resource handle; D3D12Resource upload_buffer; D3D12_RESOURCE_DESC desc; - D3D12_GPU_DESCRIPTOR_HANDLE gpu_descriptor; + /* the first view is srv, the rest are mip levels uavs */ + D3D12_CPU_DESCRIPTOR_HANDLE cpu_descriptor[D3D12_MAX_TEXTURE_DIMENSION_2_TO_EXP - 5]; + D3D12_GPU_DESCRIPTOR_HANDLE gpu_descriptor[D3D12_MAX_TEXTURE_DIMENSION_2_TO_EXP - 5]; + D3D12_GPU_DESCRIPTOR_HANDLE sampler; + D3D12_CPU_DESCRIPTOR_HANDLE rt_view; D3D12_PLACED_SUBRESOURCE_FOOTPRINT layout; UINT num_rows; UINT64 row_size_in_bytes; UINT64 total_bytes; + d3d12_descriptor_heap_t* srv_heap; bool dirty; + float4_t size_data; } d3d12_texture_t; +#ifndef ALIGN +#ifdef _MSC_VER +#define ALIGN(x) __declspec(align(x)) +#else +#define ALIGN(x) __attribute__((aligned(x))) +#endif +#endif + +typedef struct ALIGN(16) +{ + math_matrix_4x4 mvp; + struct + { + float width; + float height; + } OutputSize; + float time; +} d3d12_uniform_t; + +static_assert( + (!(sizeof(d3d12_uniform_t) & 0xF)), "sizeof(d3d12_uniform_t) must be a multiple of 16"); + typedef struct { unsigned cur_mon_id; @@ -1303,12 +1357,13 @@ typedef struct struct { - D3D12PipelineState handle; - D3D12RootSignature rootSignature; /* descriptor layout */ - d3d12_descriptor_heap_t srv_heap; /* ShaderResouceView descritor heap */ - d3d12_descriptor_heap_t rtv_heap; /* RenderTargetView descritor heap */ + D3D12RootSignature cs_rootSignature; /* descriptor layout */ + D3D12RootSignature sl_rootSignature; /* descriptor layout */ + D3D12RootSignature rootSignature; /* descriptor layout */ + d3d12_descriptor_heap_t srv_heap; /* ShaderResouceView descritor heap */ + d3d12_descriptor_heap_t rtv_heap; /* RenderTargetView descritor heap */ d3d12_descriptor_heap_t sampler_heap; - } pipe; + } desc; struct { @@ -1324,91 +1379,147 @@ typedef struct struct { + d3d12_texture_t texture[GFX_MAX_FRAME_HISTORY + 1]; D3D12Resource ubo; D3D12_CONSTANT_BUFFER_VIEW_DESC ubo_view; D3D12Resource vbo; D3D12_VERTEX_BUFFER_VIEW vbo_view; - d3d12_texture_t texture; - D3D12_GPU_DESCRIPTOR_HANDLE sampler; D3D12_VIEWPORT viewport; D3D12_RECT scissorRect; + float4_t output_size; int rotation; } frame; struct { - D3D12Resource vbo; - D3D12_VERTEX_BUFFER_VIEW vbo_view; - d3d12_texture_t texture; - D3D12_GPU_DESCRIPTOR_HANDLE sampler; + D3D12Resource vbo; + D3D12_VERTEX_BUFFER_VIEW vbo_view; + d3d12_texture_t texture; float alpha; bool enabled; bool fullscreen; } menu; + struct + { + D3D12PipelineStateRef pipe; + D3D12PipelineState pipe_blend; + D3D12PipelineState pipe_noblend; + D3D12PipelineState pipe_font; + D3D12Resource vbo; + D3D12_VERTEX_BUFFER_VIEW vbo_view; + int offset; + int capacity; + bool enabled; + } sprites; + + struct + { + D3D12PipelineState pipe; + D3D12_GPU_DESCRIPTOR_HANDLE sampler; + D3D12Resource buffers[SLANG_CBUFFER_MAX]; + D3D12_CONSTANT_BUFFER_VIEW_DESC buffer_view[SLANG_CBUFFER_MAX]; + d3d12_texture_t rt; + d3d12_texture_t feedback; + D3D12_VIEWPORT viewport; + D3D12_RECT scissorRect; + pass_semantics_t semantics; + uint32_t frame_count; + D3D12_GPU_DESCRIPTOR_HANDLE textures; + D3D12_GPU_DESCRIPTOR_HANDLE samplers; + } pass[GFX_MAX_SHADERS]; + + struct video_shader* shader_preset; + d3d12_texture_t luts[GFX_MAX_TEXTURES]; + + D3D12PipelineState pipes[GFX_MAX_SHADERS]; + D3D12PipelineState mipmapgen_pipe; + d3d12_uniform_t ubo_values; D3D12Resource ubo; D3D12_CONSTANT_BUFFER_VIEW_DESC ubo_view; DXGI_FORMAT format; - D3D12_GPU_DESCRIPTOR_HANDLE sampler_linear; - D3D12_GPU_DESCRIPTOR_HANDLE sampler_nearest; + D3D12_GPU_DESCRIPTOR_HANDLE samplers[RARCH_FILTER_MAX][RARCH_WRAP_MAX]; math_matrix_4x4 mvp, mvp_no_rot; struct video_viewport vp; bool resize_chain; bool keep_aspect; bool resize_viewport; + bool resize_render_targets; + bool init_history; + D3D12Resource menu_pipeline_vbo; + D3D12_VERTEX_BUFFER_VIEW menu_pipeline_vbo_view; #ifdef DEBUG D3D12Debug debugController; #endif } d3d12_video_t; -enum -{ - ROOT_INDEX_TEXTURE_TABLE = 0, - ROOT_INDEX_SAMPLER_TABLE, - ROOT_INDEX_UBO, - ROOT_INDEX_MAX, +typedef enum { + ROOT_ID_TEXTURE_T = 0, + ROOT_ID_SAMPLER_T, + ROOT_ID_UBO, + ROOT_ID_PC, + ROOT_ID_MAX, } root_signature_parameter_index_t; typedef enum { - SAMPLER_HEAP_SLOT_LINEAR = 0, - SAMPLER_HEAP_SLOT_NEAREST, - SAMPLER_HEAP_SLOT_MAX, + CS_ROOT_ID_TEXTURE_T = 0, + CS_ROOT_ID_UAV_T, + CS_ROOT_ID_CONSTANTS, + CS_ROOT_ID_MAX, +} compute_root_index_t; - SRV_HEAP_SLOT_FRAME_TEXTURE = 0, - SRV_HEAP_SLOT_MENU_TEXTURE, - SRV_HEAP_SLOT_CUSTOM, - SRV_HEAP_SLOT_MAX = 16 -} descriptor_heap_slot_t; +RETRO_BEGIN_DECLS + +extern D3D12_RENDER_TARGET_BLEND_DESC d3d12_blend_enable_desc; bool d3d12_init_base(d3d12_video_t* d3d12); + bool d3d12_init_descriptors(d3d12_video_t* d3d12); -bool d3d12_init_pipeline(d3d12_video_t* d3d12); +void d3d12_init_samplers(d3d12_video_t* d3d12); + +bool d3d12_init_pipeline( + D3D12Device device, + D3DBlob vs_code, + D3DBlob ps_code, + D3DBlob gs_code, + D3D12_GRAPHICS_PIPELINE_STATE_DESC* desc, + D3D12PipelineState* out); + bool d3d12_init_swapchain(d3d12_video_t* d3d12, int width, int height, HWND hwnd); + bool d3d12_init_queue(d3d12_video_t* d3d12); D3D12_GPU_VIRTUAL_ADDRESS d3d12_create_buffer(D3D12Device device, UINT size_in_bytes, D3D12Resource* buffer); -void d3d12_init_texture( - D3D12Device device, - d3d12_descriptor_heap_t* heap, - descriptor_heap_slot_t heap_index, - d3d12_texture_t* tex); +void d3d12_init_texture(D3D12Device device, d3d12_texture_t* tex); +void d3d12_release_texture(d3d12_texture_t* texture); + +void d3d12_update_texture( + int width, + int height, + int pitch, + DXGI_FORMAT format, + const void* data, + d3d12_texture_t* texture); void d3d12_upload_texture(D3D12GraphicsCommandList cmd, d3d12_texture_t* texture); void d3d12_create_fullscreen_quad_vbo( D3D12Device device, D3D12_VERTEX_BUFFER_VIEW* view, D3D12Resource* vbo); +DXGI_FORMAT d3d12_get_closest_match(D3D12Device device, D3D12_FEATURE_DATA_FORMAT_SUPPORT* desired); + +#if !defined(__cplusplus) || defined(CINTERFACE) static INLINE void d3d12_resource_transition( D3D12GraphicsCommandList cmd, D3D12Resource resource, D3D12_RESOURCE_STATES state_before, D3D12_RESOURCE_STATES state_after) { - D3D12_RESOURCE_BARRIER barrier = { 0 }; + D3D12_RESOURCE_BARRIER barrier; barrier.Type = D3D12_RESOURCE_BARRIER_TYPE_TRANSITION; barrier.Flags = D3D12_RESOURCE_BARRIER_FLAG_NONE; barrier.Transition.pResource = resource; @@ -1420,44 +1531,22 @@ static INLINE void d3d12_resource_transition( static INLINE void d3d12_set_texture(D3D12GraphicsCommandList cmd, const d3d12_texture_t* texture) { - D3D12SetGraphicsRootDescriptorTable(cmd, ROOT_INDEX_TEXTURE_TABLE, texture->gpu_descriptor); + D3D12SetGraphicsRootDescriptorTable(cmd, ROOT_ID_TEXTURE_T, texture->gpu_descriptor[0]); } static INLINE void d3d12_set_sampler(D3D12GraphicsCommandList cmd, D3D12_GPU_DESCRIPTOR_HANDLE sampler) { - D3D12SetGraphicsRootDescriptorTable(cmd, ROOT_INDEX_SAMPLER_TABLE, sampler); + D3D12SetGraphicsRootDescriptorTable(cmd, ROOT_ID_SAMPLER_T, sampler); } -static INLINE void d3d12_update_texture( - int width, - int height, - int pitch, - DXGI_FORMAT format, - const void* data, - d3d12_texture_t* texture) +static INLINE void +d3d12_set_texture_and_sampler(D3D12GraphicsCommandList cmd, const d3d12_texture_t* texture) { - uint8_t* dst; - D3D12_RANGE read_range = { 0, 0 }; - - D3D12Map(texture->upload_buffer, 0, &read_range, (void**)&dst); - - dxgi_copy( - width, height, format, pitch, data, texture->desc.Format, - texture->layout.Footprint.RowPitch, dst + texture->layout.Offset); - - D3D12Unmap(texture->upload_buffer, 0, NULL); - - texture->dirty = true; + D3D12SetGraphicsRootDescriptorTable(cmd, ROOT_ID_TEXTURE_T, texture->gpu_descriptor[0]); + D3D12SetGraphicsRootDescriptorTable(cmd, ROOT_ID_SAMPLER_T, texture->sampler); } -DXGI_FORMAT d3d12_get_closest_match( - D3D12Device device, DXGI_FORMAT desired_format, D3D12_FORMAT_SUPPORT1 desired_format_support); +#endif -static INLINE DXGI_FORMAT -d3d12_get_closest_match_texture2D(D3D12Device device, DXGI_FORMAT desired_format) -{ - return d3d12_get_closest_match( - device, desired_format, - D3D12_FORMAT_SUPPORT1_TEXTURE2D | D3D12_FORMAT_SUPPORT1_SHADER_SAMPLE); -} +RETRO_END_DECLS diff --git a/gfx/common/d3d_common.c b/gfx/common/d3d_common.c index 301b53b2c7..4d8fc4406b 100644 --- a/gfx/common/d3d_common.c +++ b/gfx/common/d3d_common.c @@ -358,7 +358,7 @@ bool d3d_check_device_type(void *_d3d, LPDIRECT3D9 d3d = (LPDIRECT3D9)_d3d; if (!d3d) return false; -#ifdef __cplusplus +#if defined(__cplusplus) && !defined(CINTERFACE) if (FAILED(d3d->CheckDeviceType( 0, D3DDEVTYPE_HAL, @@ -427,7 +427,7 @@ bool d3d_get_adapter_display_mode( return false; #ifdef _XBOX return true; -#elif defined(__cplusplus) +#elif defined(__cplusplus) && !defined(CINTERFACE) if (FAILED(d3d->GetAdapterDisplayMode(idx, (D3DDISPLAYMODE*)display_mode))) return false; #else @@ -469,7 +469,7 @@ bool d3d_swap(void *data, void *_dev) { #ifdef HAVE_D3D9 LPDIRECT3DDEVICE9 dev = (LPDIRECT3DDEVICE9)_dev; -#ifdef __cplusplus +#if defined(__cplusplus) && !defined(CINTERFACE) #ifdef _XBOX dev->Present(NULL, NULL, NULL, NULL); #else @@ -522,7 +522,7 @@ void d3d_set_transform(void *_dev, #ifdef HAVE_D3D9 #ifndef _XBOX LPDIRECT3DDEVICE9 dev = (LPDIRECT3DDEVICE9)_dev; -#ifdef __cplusplus +#if defined(__cplusplus) && !defined(CINTERFACE) dev->SetTransform((D3DTRANSFORMSTATETYPE)state, matrix); #else IDirect3DDevice9_SetTransform(dev, (D3DTRANSFORMSTATETYPE)state, matrix); @@ -558,7 +558,7 @@ bool d3d_texture_get_level_desc(void *_tex, { #ifdef HAVE_D3D9 LPDIRECT3DTEXTURE9 tex = (LPDIRECT3DTEXTURE9)_tex; -#ifdef __cplusplus +#if defined(__cplusplus) && !defined(CINTERFACE) if (SUCCEEDED(tex->GetLevelDesc(idx, (D3DSURFACE_DESC*)_ppsurface_level))) return true; #else @@ -606,7 +606,7 @@ bool d3d_texture_get_surface_level(void *_tex, LPDIRECT3DTEXTURE9 tex = (LPDIRECT3DTEXTURE9)_tex; if (!tex) return false; -#ifdef __cplusplus +#if defined(__cplusplus) && !defined(CINTERFACE) if (SUCCEEDED(tex->GetSurfaceLevel(idx, (IDirect3DSurface9**)_ppsurface_level))) return true; #else @@ -715,7 +715,7 @@ void *d3d_texture_new(void *_dev, if (want_mipmap) usage |= D3DUSAGE_AUTOGENMIPMAP; #endif -#ifdef __cplusplus +#if defined(__cplusplus) && !defined(CINTERFACE) hr = dev->CreateTexture( width, height, miplevels, usage, (D3DFORMAT)format, @@ -768,7 +768,7 @@ void d3d_texture_free(void *_tex) LPDIRECT3DTEXTURE9 tex = (LPDIRECT3DTEXTURE9)_tex; if (!tex) return; -#ifdef __cplusplus +#if defined(__cplusplus) && !defined(CINTERFACE) tex->Release(); #else IDirect3DTexture9_Release(tex); @@ -806,7 +806,7 @@ bool d3d_surface_lock_rect(void *data, void *data2) LPDIRECT3DSURFACE9 surf = (LPDIRECT3DSURFACE9)data; if (!surf) return false; -#ifdef __cplusplus +#if defined(__cplusplus) && !defined(CINTERFACE) if (FAILED(surf->LockRect((D3DLOCKED_RECT*)data2, NULL, D3DLOCK_READONLY))) return false; #else @@ -855,7 +855,7 @@ void d3d_surface_unlock_rect(void *data) LPDIRECT3DSURFACE9 surf = (LPDIRECT3DSURFACE9)data; if (!surf) return; -#ifdef __cplusplus +#if defined(__cplusplus) && !defined(CINTERFACE) surf->UnlockRect(); #else IDirect3DSurface9_UnlockRect(surf); @@ -893,7 +893,7 @@ void d3d_surface_free(void *data) LPDIRECT3DSURFACE9 surf = (LPDIRECT3DSURFACE9)data; if (!surf) return; -#ifdef __cplusplus +#if defined(__cplusplus) && !defined(CINTERFACE) surf->Release(); #else IDirect3DSurface9_Release(surf); @@ -930,7 +930,7 @@ void d3d_vertex_declaration_free(void *data) { case GFX_CTX_DIRECT3D9_API: #ifdef HAVE_D3D9 -#ifdef __cplusplus +#if defined(__cplusplus) && !defined(CINTERFACE) { LPDIRECT3DVERTEXDECLARATION9 vertex_decl = (LPDIRECT3DVERTEXDECLARATION9)data; @@ -961,7 +961,7 @@ bool d3d_vertex_declaration_new(void *_dev, const D3DVERTEXELEMENT9 *vertex_elements = (const D3DVERTEXELEMENT9*)vertex_data; LPDIRECT3DVERTEXDECLARATION9 **vertex_decl = (LPDIRECT3DVERTEXDECLARATION9**)decl_data; -#if defined(__cplusplus) +#if defined(__cplusplus) && !defined(CINTERFACE) if (SUCCEEDED(dev->CreateVertexDeclaration(vertex_elements, (IDirect3DVertexDeclaration9**)vertex_decl))) return true; #else @@ -996,7 +996,7 @@ void *d3d_vertex_buffer_new(void *_dev, if (usage == 0) { #ifndef _XBOX -#ifdef __cplusplus +#if defined(__cplusplus) && !defined(CINTERFACE) if (dev->GetSoftwareVertexProcessing()) usage = D3DUSAGE_SOFTWAREPROCESSING; #else @@ -1006,7 +1006,7 @@ void *d3d_vertex_buffer_new(void *_dev, #endif } -#ifdef __cplusplus +#if defined(__cplusplus) && !defined(CINTERFACE) hr = dev->CreateVertexBuffer(length, usage, fvf, (D3DPOOL)pool, (LPDIRECT3DVERTEXBUFFER9*)&buf, NULL); @@ -1055,7 +1055,7 @@ void d3d_vertex_buffer_unlock(void *vertbuf_ptr) if (!vertbuf) return; -#ifdef __cplusplus +#if defined(__cplusplus) && !defined(CINTERFACE) vertbuf->Unlock(); #else IDirect3DVertexBuffer9_Unlock(vertbuf); @@ -1097,7 +1097,7 @@ void *d3d_vertex_buffer_lock(void *vertbuf_ptr) LPDIRECT3DVERTEXBUFFER9 vertbuf = (LPDIRECT3DVERTEXBUFFER9)vertbuf_ptr; if (!vertbuf) return NULL; -#ifdef __cplusplus +#if defined(__cplusplus) && !defined(CINTERFACE) vertbuf->Lock(0, 0, &buf, 0); #else IDirect3DVertexBuffer9_Lock(vertbuf, 0, 0, &buf, 0); @@ -1139,7 +1139,7 @@ void d3d_vertex_buffer_free(void *vertex_data, void *vertex_declaration) if (vertex_data) { LPDIRECT3DVERTEXBUFFER9 buf = (LPDIRECT3DVERTEXBUFFER9)vertex_data; -#ifdef __cplusplus +#if defined(__cplusplus) && !defined(CINTERFACE) buf->Release(); #else IDirect3DVertexBuffer9_Release(buf); @@ -1189,7 +1189,7 @@ void d3d_set_stream_source(void *_dev, unsigned stream_no, LPDIRECT3DVERTEXBUFFER9 stream_vertbuf = (LPDIRECT3DVERTEXBUFFER9)stream_vertbuf_ptr; if (!stream_vertbuf) return; -#ifdef __cplusplus +#if defined(__cplusplus) && !defined(CINTERFACE) dev->SetStreamSource(stream_no, stream_vertbuf, offset_bytes, stride); #else IDirect3DDevice9_SetStreamSource(dev, stream_no, stream_vertbuf, @@ -1236,7 +1236,7 @@ bool d3d_device_create_offscreen_plain_surface( #ifndef _XBOX #ifdef HAVE_D3D9 LPDIRECT3DDEVICE9 dev = (LPDIRECT3DDEVICE9)_dev; -#ifdef __cplusplus +#if defined(__cplusplus) && !defined(CINTERFACE) if (SUCCEEDED(dev->CreateOffscreenPlainSurface(width, height, (D3DFORMAT)format, (D3DPOOL)pool, (LPDIRECT3DSURFACE9*)surf_data, @@ -1274,7 +1274,7 @@ static void d3d_set_texture_stage_state(void *_dev, #ifndef _XBOX #ifdef HAVE_D3D9 LPDIRECT3DDEVICE9 dev = (LPDIRECT3DDEVICE9)_dev; -#ifdef __cplusplus +#if defined(__cplusplus) && !defined(CINTERFACE) if (dev->SetTextureStageState(sampler, (D3DTEXTURESTAGESTATETYPE)type, value) != D3D_OK) RARCH_ERR("SetTextureStageState call failed, sampler: %d, value: %d, type: %d\n", sampler, value, type); #else @@ -1314,7 +1314,7 @@ void d3d_set_sampler_address_u(void *_dev, { #ifdef HAVE_D3D9 LPDIRECT3DDEVICE9 dev = (LPDIRECT3DDEVICE9)_dev; -#ifdef __cplusplus +#if defined(__cplusplus) && !defined(CINTERFACE) dev->SetSamplerState(sampler, D3DSAMP_ADDRESSU, value); #else IDirect3DDevice9_SetSamplerState(dev, sampler, D3DSAMP_ADDRESSU, value); @@ -1345,7 +1345,7 @@ void d3d_set_sampler_address_v(void *_dev, { #ifdef HAVE_D3D9 LPDIRECT3DDEVICE9 dev = (LPDIRECT3DDEVICE9)_dev; -#ifdef __cplusplus +#if defined(__cplusplus) && !defined(CINTERFACE) dev->SetSamplerState(sampler, D3DSAMP_ADDRESSV, value); #else IDirect3DDevice9_SetSamplerState(dev, sampler, D3DSAMP_ADDRESSV, value); @@ -1378,7 +1378,7 @@ void d3d_set_sampler_minfilter(void *_dev, LPDIRECT3DDEVICE9 dev = (LPDIRECT3DDEVICE9)_dev; if (!dev) return; -#ifdef __cplusplus +#if defined(__cplusplus) && !defined(CINTERFACE) dev->SetSamplerState(sampler, D3DSAMP_MINFILTER, value); #else IDirect3DDevice9_SetSamplerState(dev, sampler, D3DSAMP_MINFILTER, value); @@ -1408,7 +1408,7 @@ void d3d_set_sampler_magfilter(void *_dev, LPDIRECT3DDEVICE9 dev = (LPDIRECT3DDEVICE9)_dev; if (!dev) return; -#ifdef __cplusplus +#if defined(__cplusplus) && !defined(CINTERFACE) dev->SetSamplerState(sampler, D3DSAMP_MAGFILTER, value); #else IDirect3DDevice9_SetSamplerState(dev, sampler, D3DSAMP_MAGFILTER, value); @@ -1460,7 +1460,7 @@ bool d3d_begin_scene(void *_dev) LPDIRECT3DDEVICE9 dev = (LPDIRECT3DDEVICE9)_dev; if (!dev) return false; -#ifdef __cplusplus +#if defined(__cplusplus) && !defined(CINTERFACE) if (FAILED(dev->BeginScene())) return false; #else @@ -1516,7 +1516,7 @@ void d3d_end_scene(void *_dev) LPDIRECT3DDEVICE9 dev = (LPDIRECT3DDEVICE9)_dev; if (!dev) return; -#ifdef __cplusplus +#if defined(__cplusplus) && !defined(CINTERFACE) dev->EndScene(); #else IDirect3DDevice9_EndScene(dev); @@ -1555,7 +1555,7 @@ static void d3d_draw_primitive_internal(void *_dev, LPDIRECT3DDEVICE9 dev = (LPDIRECT3DDEVICE9)_dev; if (!dev) return; -#ifdef __cplusplus +#if defined(__cplusplus) && !defined(CINTERFACE) dev->DrawPrimitive(type, start, count); #else IDirect3DDevice9_DrawPrimitive(dev, type, start, count); @@ -1605,7 +1605,7 @@ void d3d_clear(void *_dev, LPDIRECT3DDEVICE9 dev = (LPDIRECT3DDEVICE9)_dev; if (!dev) return; -#ifdef __cplusplus +#if defined(__cplusplus) && !defined(CINTERFACE) dev->Clear(count, (const D3DRECT*)rects, flags, color, z, stencil); #else IDirect3DDevice9_Clear(dev, count, (const D3DRECT*)rects, flags, @@ -1650,7 +1650,7 @@ bool d3d_device_get_render_target_data(void *_dev, LPDIRECT3DDEVICE9 dev = (LPDIRECT3DDEVICE9)_dev; if (!dev) return false; -#ifdef __cplusplus +#if defined(__cplusplus) && !defined(CINTERFACE) if (SUCCEEDED(dev->GetRenderTargetData(src, dst))) return true; #else @@ -1682,7 +1682,7 @@ bool d3d_device_get_render_target(void *_dev, LPDIRECT3DDEVICE9 dev = (LPDIRECT3DDEVICE9)_dev; if (!dev) return false; -#ifdef __cplusplus +#if defined(__cplusplus) && !defined(CINTERFACE) if (SUCCEEDED(dev->GetRenderTarget(idx, (LPDIRECT3DSURFACE9*)data))) return true; @@ -1735,7 +1735,7 @@ bool d3d_lock_rectangle(void *_tex, LPDIRECT3DTEXTURE9 tex = (LPDIRECT3DTEXTURE9)_tex; if (!tex) return false; -#ifdef __cplusplus +#if defined(__cplusplus) && !defined(CINTERFACE) if (FAILED(tex->LockRect(level, lr, rect, flags))) return false; #else @@ -1783,7 +1783,7 @@ void d3d_unlock_rectangle(void *_tex) LPDIRECT3DTEXTURE9 tex = (LPDIRECT3DTEXTURE9)_tex; if (!tex) return; -#ifdef __cplusplus +#if defined(__cplusplus) && !defined(CINTERFACE) tex->UnlockRect(0); #else IDirect3DTexture9_UnlockRect(tex, 0); @@ -1834,7 +1834,7 @@ void d3d_set_viewports(void *_dev, void *_vp) D3DVIEWPORT9 *vp = (D3DVIEWPORT9*)_vp; if (!dev) return; -#ifdef __cplusplus +#if defined(__cplusplus) && !defined(CINTERFACE) dev->SetViewport(vp); #else IDirect3DDevice9_SetViewport(dev, vp); @@ -1875,7 +1875,7 @@ void d3d_set_texture(void *_dev, unsigned sampler, LPDIRECT3DDEVICE9 dev = (LPDIRECT3DDEVICE9)_dev; if (!dev || !tex) return; -#ifdef __cplusplus +#if defined(__cplusplus) && !defined(CINTERFACE) dev->SetTexture(sampler, tex); #else IDirect3DDevice9_SetTexture(dev, sampler, @@ -1917,7 +1917,7 @@ void d3d_free_vertex_shader(void *_dev, void *data) IDirect3DVertexShader9 *vs = (IDirect3DVertexShader9*)data; if (!dev || !vs) return; -#ifdef __cplusplus +#if defined(__cplusplus) && !defined(CINTERFACE) vs->Release(); #else IDirect3DVertexShader9_Release(vs); @@ -1943,7 +1943,7 @@ void d3d_free_pixel_shader(void *_dev, void *data) IDirect3DPixelShader9 *ps = (IDirect3DPixelShader9*)data; if (!dev || !ps) return; -#ifdef __cplusplus +#if defined(__cplusplus) && !defined(CINTERFACE) ps->Release(); #else IDirect3DPixelShader9_Release(ps); @@ -1969,7 +1969,7 @@ bool d3d_create_vertex_shader(void *_dev, const DWORD *a, void **b) { #ifdef HAVE_D3D9 LPDIRECT3DDEVICE9 dev = (LPDIRECT3DDEVICE9)_dev; -#if defined(__cplusplus) +#if defined(__cplusplus) && !defined(CINTERFACE) if (dev->CreateVertexShader(a, (IDirect3DVertexShader9**)b) == D3D_OK) return true; #else @@ -2000,7 +2000,7 @@ bool d3d_create_pixel_shader(void *_dev, const DWORD *a, void **b) { #ifdef HAVE_D3D9 LPDIRECT3DDEVICE9 dev = (LPDIRECT3DDEVICE9)_dev; -#ifdef __cplusplus +#if defined(__cplusplus) && !defined(CINTERFACE) if (dev->CreatePixelShader(a, (IDirect3DPixelShader9**)b) == D3D_OK) return true; #else @@ -2031,7 +2031,7 @@ bool d3d_set_pixel_shader(void *_dev, void *data) LPDIRECT3DPIXELSHADER9 d3dps = (LPDIRECT3DPIXELSHADER9)data; if (!dev || !d3dps) return false; -#if defined(__cplusplus) +#if defined(__cplusplus) && !defined(CINTERFACE) if (dev->SetPixelShader(d3dps) == D3D_OK) return true; #else @@ -2066,7 +2066,7 @@ bool d3d_set_vertex_shader(void *_dev, unsigned index, #ifdef HAVE_D3D9 LPDIRECT3DDEVICE9 dev = (LPDIRECT3DDEVICE9)_dev; LPDIRECT3DVERTEXSHADER9 shader = (LPDIRECT3DVERTEXSHADER9)data; -#ifdef __cplusplus +#if defined(__cplusplus) && !defined(CINTERFACE) if (dev->SetVertexShader(shader) != D3D_OK) return false; #else @@ -2114,7 +2114,7 @@ bool d3d_set_vertex_shader_constantf(void *_dev, { #if defined(HAVE_D3D9) LPDIRECT3DDEVICE9 dev = (LPDIRECT3DDEVICE9)_dev; -#ifdef __cplusplus +#if defined(__cplusplus) && !defined(CINTERFACE) #ifdef _XBOX dev->SetVertexShaderConstantF( start_register, constant_data, vector4f_count); @@ -2170,7 +2170,7 @@ bool d3d_get_render_state(void *data, INT32 state, DWORD *value) { #ifdef HAVE_D3D9 LPDIRECT3DDEVICE9 dev = (LPDIRECT3DDEVICE9)data; -#ifdef __cplusplus +#if defined(__cplusplus) && !defined(CINTERFACE) if (dev && dev->GetRenderState((D3DRENDERSTATETYPE)state, value) == D3D_OK) return true; #else @@ -2219,7 +2219,7 @@ void d3d_set_render_state(void *data, INT32 state, DWORD value) LPDIRECT3DDEVICE9 dev = (LPDIRECT3DDEVICE9)data; if (!dev) return; -#ifdef __cplusplus +#if defined(__cplusplus) && !defined(CINTERFACE) dev->SetRenderState((D3DRENDERSTATETYPE)state, value); #else IDirect3DDevice9_SetRenderState(dev, (D3DRENDERSTATETYPE)state, value); @@ -2270,7 +2270,7 @@ void d3d_device_set_render_target(void *_dev, unsigned idx, LPDIRECT3DDEVICE9 dev = (LPDIRECT3DDEVICE9)_dev; if (!dev) return; -#ifdef __cplusplus +#if defined(__cplusplus) && !defined(CINTERFACE) dev->SetRenderTarget(idx, surf); #else IDirect3DDevice9_SetRenderTarget(dev, idx, surf); @@ -2354,7 +2354,7 @@ void d3d_set_vertex_declaration(void *data, void *vertex_data) LPDIRECT3DDEVICE9 dev = (LPDIRECT3DDEVICE9)data; if (!dev) return; -#ifdef __cplusplus +#if defined(__cplusplus) && !defined(CINTERFACE) dev->SetVertexDeclaration((LPDIRECT3DVERTEXDECLARATION9)vertex_data); #else IDirect3DDevice9_SetVertexDeclaration(dev, (LPDIRECT3DVERTEXDECLARATION9)vertex_data); @@ -2381,7 +2381,7 @@ static bool d3d_reset_internal(void *data, LPDIRECT3DDEVICE9 dev = (LPDIRECT3DDEVICE9)data; if (!dev) return false; -#ifdef __cplusplus +#if defined(__cplusplus) && !defined(CINTERFACE) if ((dev->Reset(d3dpp) == D3D_OK)) return true; #else @@ -2426,7 +2426,7 @@ static HRESULT d3d_test_cooperative_level(void *data) LPDIRECT3DDEVICE9 dev = (LPDIRECT3DDEVICE9)data; if (!dev) return E_FAIL; -#ifdef __cplusplus +#if defined(__cplusplus) && !defined(CINTERFACE) return dev->TestCooperativeLevel(); #else return IDirect3DDevice9_TestCooperativeLevel(dev); @@ -2476,7 +2476,7 @@ static bool d3d_create_device_internal( LPDIRECT3DDEVICE9 dev = (LPDIRECT3DDEVICE9)data; if (!dev) return false; -#ifdef __cplusplus +#if defined(__cplusplus) && !defined(CINTERFACE) if (SUCCEEDED(d3d->CreateDevice( cur_mon_id, D3DDEVTYPE_HAL, @@ -2602,7 +2602,7 @@ bool d3d_device_get_backbuffer(void *_dev, LPDIRECT3DDEVICE9 dev = (LPDIRECT3DDEVICE9)_dev; if (!dev) return false; -#ifdef __cplusplus +#if defined(__cplusplus) && !defined(CINTERFACE) if (SUCCEEDED(dev->GetBackBuffer( swapchain_idx, idx, (D3DBACKBUFFER_TYPE)backbuffer_type, @@ -2658,7 +2658,7 @@ void d3d_device_free(void *_dev, void *_pd3d) LPDIRECT3DDEVICE9 dev = (LPDIRECT3DDEVICE9)_dev; if (dev) { -#ifdef __cplusplus +#if defined(__cplusplus) && !defined(CINTERFACE) dev->Release(); #else IDirect3DDevice9_Release(dev); @@ -2667,7 +2667,7 @@ void d3d_device_free(void *_dev, void *_pd3d) if (pd3d) { -#ifdef __cplusplus +#if defined(__cplusplus) && !defined(CINTERFACE) pd3d->Release(); #else IDirect3D9_Release(pd3d); @@ -2872,7 +2872,7 @@ void d3dxbuffer_release(void *data) if (!p) return; -#ifdef __cplusplus +#if defined(__cplusplus) && !defined(CINTERFACE) p->Release(); #else p->lpVtbl->Release(p); @@ -3053,7 +3053,7 @@ const void *d3dx_get_buffer_ptr(void *data) ID3DXBuffer *listing = (ID3DXBuffer*)data; if (!listing) return NULL; -#ifdef __cplusplus +#if defined(__cplusplus) && !defined(CINTERFACE) return listing->GetBufferPointer(); #else return listing->lpVtbl->GetBufferPointer(listing); @@ -3073,7 +3073,7 @@ const bool d3dx_constant_table_set_float(void *p, LPD3DXCONSTANTTABLE consttbl = (LPD3DXCONSTANTTABLE)p; if (!consttbl || !dev || !handle) return false; -#ifdef __cplusplus +#if defined(__cplusplus) && !defined(CINTERFACE) if (consttbl->SetFloat(dev, handle, val) == D3D_OK) return true; #else diff --git a/gfx/common/d3dcompiler_common.c b/gfx/common/d3dcompiler_common.c index f28bde2789..6da87c1ba4 100644 --- a/gfx/common/d3dcompiler_common.c +++ b/gfx/common/d3dcompiler_common.c @@ -13,7 +13,10 @@ * If not, see . */ +#define CINTERFACE + #include +#include #ifdef HAVE_CONFIG_H #include "config.h" @@ -57,12 +60,12 @@ HRESULT WINAPI D3DCompile( if (!fp) fp = (pD3DCompile)dylib_proc(d3dcompiler_dll, "D3DCompile"); - if (fp) - return fp( - pSrcData, SrcDataSize, pSourceName, pDefines, pInclude, pEntrypoint, pTarget, Flags1, - Flags2, ppCode, ppErrorMsgs); + if (!fp) + return TYPE_E_DLLFUNCTIONNOTFOUND; - return TYPE_E_CANTLOADLIBRARY; + return fp( + pSrcData, SrcDataSize, pSourceName, pDefines, pInclude, pEntrypoint, pTarget, Flags1, + Flags2, ppCode, ppErrorMsgs); } HRESULT WINAPI D3DCompileFromFile( @@ -77,9 +80,8 @@ HRESULT WINAPI D3DCompileFromFile( ID3DBlob** ppErrorMsgs) { typedef HRESULT(WINAPI * pD3DCompileFromFile)( - LPCWSTR pFileName, const D3D_SHADER_MACRO* pDefines, ID3DInclude* pInclude, - LPCSTR pEntrypoint, LPCSTR pTarget, UINT Flags1, UINT Flags2, ID3DBlob** ppCode, - ID3DBlob** ppErrorMsgs); + LPCWSTR, const D3D_SHADER_MACRO*, ID3DInclude*, LPCSTR, LPCSTR, UINT, UINT, ID3DBlob**, + ID3DBlob**); static pD3DCompileFromFile fp; const char** dll_name = d3dcompiler_dll_list; while (!d3dcompiler_dll && *dll_name) @@ -91,19 +93,17 @@ HRESULT WINAPI D3DCompileFromFile( if (!fp) fp = (pD3DCompileFromFile)dylib_proc(d3dcompiler_dll, "D3DCompileFromFile"); - if (fp) - return fp( - pFileName, pDefines, pInclude, pEntrypoint, pTarget, Flags1, Flags2, ppCode, - ppErrorMsgs); + if (!fp) + return TYPE_E_DLLFUNCTIONNOTFOUND; - return TYPE_E_CANTLOADLIBRARY; + return fp( + pFileName, pDefines, pInclude, pEntrypoint, pTarget, Flags1, Flags2, ppCode, ppErrorMsgs); } HRESULT WINAPI D3DReflect(LPCVOID pSrcData, SIZE_T SrcDataSize, REFIID pInterface, void** ppReflector) { - typedef HRESULT(WINAPI * pD3DCompileFromFile)( - LPCVOID pSrcData, SIZE_T SrcDataSize, REFIID pInterface, void** ppReflector); + typedef HRESULT(WINAPI * pD3DCompileFromFile)(LPCVOID, SIZE_T, REFIID, void**); static pD3DCompileFromFile fp; const char** dll_name = d3dcompiler_dll_list; @@ -116,10 +116,10 @@ HRESULT WINAPI if (!fp) fp = (pD3DCompileFromFile)dylib_proc(d3dcompiler_dll, "D3DReflect"); - if (fp) - return fp(pSrcData, SrcDataSize, pInterface, ppReflector); + if (!fp) + return TYPE_E_DLLFUNCTIONNOTFOUND; - return TYPE_E_CANTLOADLIBRARY; + return fp(pSrcData, SrcDataSize, pInterface, ppReflector); } #endif @@ -132,6 +132,10 @@ bool d3d_compile(const char* src, size_t size, LPCSTR src_name, LPCSTR entrypoin compileflags |= D3DCOMPILE_DEBUG | D3DCOMPILE_SKIP_OPTIMIZATION; #endif + + if (!size) + size = strlen(src); + if (FAILED(D3DCompile( src, size, src_name, NULL, NULL, entrypoint, target, compileflags, 0, out, &error_msg))) { diff --git a/gfx/common/dxgi_common.c b/gfx/common/dxgi_common.c index dae80ff877..3ab17dbe64 100644 --- a/gfx/common/dxgi_common.c +++ b/gfx/common/dxgi_common.c @@ -47,7 +47,7 @@ HRESULT WINAPI CreateDXGIFactory1(REFIID riid, void** ppFactory) fp = (HRESULT(WINAPI*)(REFIID, void**))dylib_proc(dxgi_dll, "CreateDXGIFactory1"); if (!fp) - return TYPE_E_CANTLOADLIBRARY; + return TYPE_E_DLLFUNCTIONNOTFOUND; return fp(riid, ppFactory); } @@ -143,8 +143,8 @@ DXGI_FORMAT* dxgi_get_format_fallback_list(DXGI_FORMAT format) ((src_bs == dst_bs && src_bb == dst_bb) || !dst_bb) && \ ((src_as == dst_as && src_ab == dst_ab) || !dst_ab)) \ { \ - const UINT8* in = src_data; \ - UINT8* out = dst_data; \ + const UINT8* in = (const UINT8*)src_data; \ + UINT8* out = (UINT8*)dst_data; \ for (i = 0; i < height; i++) \ { \ memcpy(out, in, width * sizeof(src_type)); \ diff --git a/gfx/common/dxgi_common.h b/gfx/common/dxgi_common.h index d5f09e78f4..a35090dfb5 100644 --- a/gfx/common/dxgi_common.h +++ b/gfx/common/dxgi_common.h @@ -247,21 +247,13 @@ #endif #endif +#if !defined(__cplusplus) || defined(CINTERFACE) #ifndef COM_RELEASE_DECLARED #define COM_RELEASE_DECLARED -#if defined(__cplusplus) && !defined(CINTERFACE) -static INLINE ULONG Release(IUnknown* object) -{ - if (object) - return object->Release(); - - return 0; -} -#else static INLINE ULONG Release(void* object) { if (object) - return ((IUnknown*)object)->lpVtbl->Release(object); + return ((IUnknown*)object)->lpVtbl->Release((IUnknown*)object); return 0; } @@ -293,19 +285,19 @@ static INLINE ULONG DXGIReleaseDeviceSubObject(DXGIDeviceSubObject device_sub_ob } static INLINE HRESULT DXGIGetSharedHandle(void* resource, HANDLE* shared_handle) { - return ((IDXGIResource*)resource)->lpVtbl->GetSharedHandle(resource, shared_handle); + return ((IDXGIResource*)resource)->lpVtbl->GetSharedHandle((IDXGIResource*)resource, shared_handle); } static INLINE HRESULT DXGIGetUsage(void* resource, DXGI_USAGE* usage) { - return ((IDXGIResource*)resource)->lpVtbl->GetUsage(resource, usage); + return ((IDXGIResource*)resource)->lpVtbl->GetUsage((IDXGIResource*)resource, usage); } static INLINE HRESULT DXGISetEvictionPriority(void* resource, UINT eviction_priority) { - return ((IDXGIResource*)resource)->lpVtbl->SetEvictionPriority(resource, eviction_priority); + return ((IDXGIResource*)resource)->lpVtbl->SetEvictionPriority((IDXGIResource*)resource, eviction_priority); } static INLINE HRESULT DXGIGetEvictionPriority(void* resource, UINT* eviction_priority) { - return ((IDXGIResource*)resource)->lpVtbl->GetEvictionPriority(resource, eviction_priority); + return ((IDXGIResource*)resource)->lpVtbl->GetEvictionPriority((IDXGIResource*)resource, eviction_priority); } static INLINE ULONG DXGIReleaseKeyedMutex(DXGIKeyedMutex keyed_mutex) { @@ -778,6 +770,14 @@ typedef enum { DXGI_FORMAT_EX_A4R4G4B4_UNORM = 1000, } DXGI_FORMAT_EX; +typedef struct +{ + float x; + float y; + float z; + float w; +} float4_t; + RETRO_BEGIN_DECLS DXGI_FORMAT* dxgi_get_format_fallback_list(DXGI_FORMAT format); diff --git a/gfx/common/win32_common.c b/gfx/common/win32_common.c index 2b3ca65af7..6a1af71c1f 100644 --- a/gfx/common/win32_common.c +++ b/gfx/common/win32_common.c @@ -561,8 +561,6 @@ static LRESULT CALLBACK WndProcCommon(bool *quit, HWND hwnd, UINT message, return 0; } -extern VOID (WINAPI *DragAcceptFiles_func)(HWND, BOOL); - static void win32_set_droppable(ui_window_win32_t *window, bool droppable) { if (DragAcceptFiles_func != NULL) @@ -810,7 +808,7 @@ bool win32_window_create(void *data, unsigned style, notification_handler = RegisterDeviceNotification( main_window.hwnd, ¬ification_filter, DEVICE_NOTIFY_WINDOW_HANDLE); - if (notification_handler) + if (!notification_handler) RARCH_ERR("Error registering for notifications\n"); #endif @@ -819,8 +817,11 @@ bool win32_window_create(void *data, unsigned style, video_driver_window_set((uintptr_t)main_window.hwnd); #if defined(_WIN32_WINNT) && _WIN32_WINNT >= 0x0500 /* 2K */ + if (!settings->bools.video_window_show_decorations) + SetWindowLongPtr(main_window.hwnd, GWL_STYLE, WS_POPUP); + /* Windows 2000 and above use layered windows to enable transparency */ - if(settings->uints.video_window_opacity < 100) + if (settings->uints.video_window_opacity < 100) { SetWindowLongPtr(main_window.hwnd, GWL_EXSTYLE, diff --git a/gfx/display_servers/dispserv_null.c b/gfx/display_servers/dispserv_null.c index 83df0a772f..aa02bcc9c4 100644 --- a/gfx/display_servers/dispserv_null.c +++ b/gfx/display_servers/dispserv_null.c @@ -48,6 +48,7 @@ const video_display_server_t dispserv_null = { null_display_server_destroy, null_set_window_opacity, null_set_window_progress, + NULL, "null" }; diff --git a/gfx/display_servers/dispserv_win32.c b/gfx/display_servers/dispserv_win32.c index 620b4f5cf2..ce72e247f9 100644 --- a/gfx/display_servers/dispserv_win32.c +++ b/gfx/display_servers/dispserv_win32.c @@ -42,7 +42,7 @@ static ITaskbarList3 *g_taskbarList = NULL; /* MSVC really doesn't want CINTERFACE to be used with shobjidl for some reason, but since we use C++ mode, * we need a workaround... so use the names of the COBJMACROS functions instead. */ -#ifdef __cplusplus +#if defined(__cplusplus) && !defined(CINTERFACE) #define ITaskbarList3_Release(x) g_taskbarList->Release() #define ITaskbarList3_SetProgressState(a, b, c) g_taskbarList->SetProgressState(b, c) #define ITaskbarList3_SetProgressValue(a, b, c, d) g_taskbarList->SetProgressValue(b, c, d) @@ -54,6 +54,7 @@ typedef struct { unsigned opacity; int progress; + bool decorations; } dispserv_win32_t; /* @@ -85,7 +86,7 @@ static void* win32_display_server_init(void) if (!SUCCEEDED(hr)) { - g_taskbarList = false; + g_taskbarList = NULL; RARCH_ERR("[dispserv]: CoCreateInstance of ITaskbarList3 failed.\n"); } #endif @@ -180,11 +181,23 @@ static bool win32_set_window_progress(void *data, int progress, bool finished) return ret; } +static bool win32_set_window_decorations(void *data, bool on) +{ + dispserv_win32_t *serv = (dispserv_win32_t*)data; + + serv->decorations = on; + + /* menu_setting performs a reinit instead to properly apply decoration changes */ + + return true; +} + const video_display_server_t dispserv_win32 = { win32_display_server_init, win32_display_server_destroy, win32_set_window_opacity, win32_set_window_progress, + win32_set_window_decorations, "win32" }; diff --git a/gfx/display_servers/dispserv_x11.c b/gfx/display_servers/dispserv_x11.c index f39faeb9c1..0d20343315 100644 --- a/gfx/display_servers/dispserv_x11.c +++ b/gfx/display_servers/dispserv_x11.c @@ -22,6 +22,7 @@ typedef struct { unsigned opacity; + bool decorations; } dispserv_x11_t; static void* x11_display_server_init(void) @@ -47,7 +48,6 @@ static bool x11_set_window_opacity(void *data, unsigned opacity) dispserv_x11_t *serv = (dispserv_x11_t*)data; Atom net_wm_opacity = XInternAtom(g_x11_dpy, "_NET_WM_WINDOW_OPACITY", False); Atom cardinal = XInternAtom(g_x11_dpy, "CARDINAL", False); - settings_t *settings = config_get_ptr(); serv->opacity = opacity; @@ -61,11 +61,23 @@ static bool x11_set_window_opacity(void *data, unsigned opacity) return true; } +static bool x11_set_window_decorations(void *data, bool on) +{ + dispserv_x11_t *serv = (dispserv_x11_t*)data; + + serv->decorations = on; + + /* menu_setting performs a reinit instead to properly apply decoration changes */ + + return true; +} + const video_display_server_t dispserv_x11 = { x11_display_server_init, x11_display_server_destroy, x11_set_window_opacity, NULL, + x11_set_window_decorations, "x11" }; diff --git a/gfx/drivers/d3d10.c b/gfx/drivers/d3d10.c index dc3d895f66..c0f41e9f2d 100644 --- a/gfx/drivers/d3d10.c +++ b/gfx/drivers/d3d10.c @@ -13,6 +13,8 @@ * If not, see . */ +#define CINTERFACE + #include #include @@ -71,7 +73,7 @@ static void d3d10_update_viewport(void* data, bool force_full) d3d10->resize_viewport = false; } -static void* + static void* d3d10_gfx_init(const video_info_t* video, const input_driver_t** input, void** input_data) { WNDCLASSEX wndclass = { 0 }; @@ -108,27 +110,27 @@ d3d10_gfx_init(const video_info_t* video, const input_driver_t** input, void** i { UINT flags = 0; - DXGI_SWAP_CHAIN_DESC desc = { - .BufferCount = 2, - .BufferDesc.Width = video->width, - .BufferDesc.Height = video->height, - .BufferDesc.Format = DXGI_FORMAT_R8G8B8A8_UNORM, + DXGI_SWAP_CHAIN_DESC desc = {0}; + + desc.BufferCount = 2; + desc.BufferDesc.Width = video->width; + desc.BufferDesc.Height = video->height; + desc.BufferDesc.Format = DXGI_FORMAT_R8G8B8A8_UNORM; #if 0 - .BufferDesc.RefreshRate.Numerator = 60, - .BufferDesc.RefreshRate.Denominator = 1, + desc.BufferDesc.RefreshRate.Numerator = 60; + desc.BufferDesc.RefreshRate.Denominator = 1; #endif - .BufferUsage = DXGI_USAGE_RENDER_TARGET_OUTPUT, - .OutputWindow = main_window.hwnd, - .SampleDesc.Count = 1, - .SampleDesc.Quality = 0, - .Windowed = TRUE, - .SwapEffect = DXGI_SWAP_EFFECT_DISCARD, + desc.BufferUsage = DXGI_USAGE_RENDER_TARGET_OUTPUT; + desc.OutputWindow = main_window.hwnd; + desc.SampleDesc.Count = 1; + desc.SampleDesc.Quality = 0; + desc.Windowed = TRUE; + desc.SwapEffect = DXGI_SWAP_EFFECT_DISCARD; #if 0 - .SwapEffect = DXGI_SWAP_EFFECT_SEQUENTIAL, - .SwapEffect = DXGI_SWAP_EFFECT_FLIP_SEQUENTIAL, - .SwapEffect = DXGI_SWAP_EFFECT_FLIP_DISCARD, + desc.SwapEffect = DXGI_SWAP_EFFECT_SEQUENTIAL; + desc.SwapEffect = DXGI_SWAP_EFFECT_FLIP_SEQUENTIAL; + desc.SwapEffect = DXGI_SWAP_EFFECT_FLIP_DISCARD; #endif - }; #ifdef DEBUG flags |= D3D10_CREATE_DEVICE_DEBUG; @@ -156,7 +158,7 @@ d3d10_gfx_init(const video_info_t* video, const input_driver_t** input, void** i d3d10->format = video->rgb32 ? DXGI_FORMAT_B8G8R8X8_UNORM : DXGI_FORMAT_B5G6R5_UNORM; d3d10->frame.texture.desc.Format = - d3d10_get_closest_match_texture2D(d3d10->device, d3d10->format); + d3d10_get_closest_match_texture2D(d3d10->device, d3d10->format); d3d10->frame.texture.desc.Usage = D3D10_USAGE_DEFAULT; d3d10->menu.texture.desc.Usage = D3D10_USAGE_DEFAULT; @@ -164,29 +166,41 @@ d3d10_gfx_init(const video_info_t* video, const input_driver_t** input, void** i matrix_4x4_ortho(d3d10->mvp_no_rot, 0.0f, 1.0f, 0.0f, 1.0f, -1.0f, 1.0f); { - D3D10_BUFFER_DESC desc = { - .ByteWidth = sizeof(math_matrix_4x4), - .Usage = D3D10_USAGE_DYNAMIC, - .BindFlags = D3D10_BIND_CONSTANT_BUFFER, - .CPUAccessFlags = D3D10_CPU_ACCESS_WRITE, - }; - D3D10_SUBRESOURCE_DATA ubo_data = { &d3d10->mvp_no_rot }; + D3D10_BUFFER_DESC desc; + D3D10_SUBRESOURCE_DATA ubo_data; + + desc.ByteWidth = sizeof(math_matrix_4x4); + desc.Usage = D3D10_USAGE_DYNAMIC; + desc.BindFlags = D3D10_BIND_CONSTANT_BUFFER; + desc.CPUAccessFlags = D3D10_CPU_ACCESS_WRITE; + desc.MiscFlags = 0; + + ubo_data.pSysMem = &d3d10->mvp_no_rot; + ubo_data.SysMemPitch = 0; + ubo_data.SysMemSlicePitch = 0; + D3D10CreateBuffer(d3d10->device, &desc, &ubo_data, &d3d10->ubo); D3D10CreateBuffer(d3d10->device, &desc, NULL, &d3d10->frame.ubo); } d3d10_gfx_set_rotation(d3d10, 0); { - D3D10_SAMPLER_DESC desc = { - .Filter = D3D10_FILTER_MIN_MAG_MIP_POINT, - .AddressU = D3D10_TEXTURE_ADDRESS_BORDER, - .AddressV = D3D10_TEXTURE_ADDRESS_BORDER, - .AddressW = D3D10_TEXTURE_ADDRESS_BORDER, - .MaxAnisotropy = 1, - .ComparisonFunc = D3D10_COMPARISON_NEVER, - .MinLOD = -D3D10_FLOAT32_MAX, - .MaxLOD = D3D10_FLOAT32_MAX, - }; + unsigned k; + D3D10_SAMPLER_DESC desc; + + desc.Filter = D3D10_FILTER_MIN_MAG_MIP_POINT; + desc.AddressU = D3D10_TEXTURE_ADDRESS_BORDER; + desc.AddressV = D3D10_TEXTURE_ADDRESS_BORDER; + desc.AddressW = D3D10_TEXTURE_ADDRESS_BORDER; + desc.MipLODBias = 0.0f; + desc.MaxAnisotropy = 1; + desc.ComparisonFunc = D3D10_COMPARISON_NEVER; + desc.MinLOD = -D3D10_FLOAT32_MAX; + desc.MaxLOD = D3D10_FLOAT32_MAX; + + for (k = 0; k < 4; k++) + desc.BorderColor[k] = 0.0f; + D3D10CreateSamplerState(d3d10->device, &desc, &d3d10->sampler_nearest); desc.Filter = D3D10_FILTER_MIN_MAG_MIP_LINEAR; @@ -204,13 +218,19 @@ d3d10_gfx_init(const video_info_t* video, const input_driver_t** input, void** i }; { - D3D10_BUFFER_DESC desc = { - .ByteWidth = sizeof(vertices), - .Usage = D3D10_USAGE_DYNAMIC, - .BindFlags = D3D10_BIND_VERTEX_BUFFER, - .CPUAccessFlags = D3D10_CPU_ACCESS_WRITE, - }; - D3D10_SUBRESOURCE_DATA vertexData = { vertices }; + D3D10_SUBRESOURCE_DATA vertexData; + D3D10_BUFFER_DESC desc; + + desc.ByteWidth = sizeof(vertices); + desc.Usage = D3D10_USAGE_DYNAMIC; + desc.BindFlags = D3D10_BIND_VERTEX_BUFFER; + desc.CPUAccessFlags = D3D10_CPU_ACCESS_WRITE; + desc.MiscFlags = 0; + + vertexData.pSysMem = vertices; + vertexData.SysMemPitch = 0; + vertexData.SysMemSlicePitch = 0; + D3D10CreateBuffer(d3d10->device, &desc, &vertexData, &d3d10->frame.vbo); desc.Usage = D3D10_USAGE_IMMUTABLE; desc.CPUAccessFlags = 0; @@ -225,15 +245,15 @@ d3d10_gfx_init(const video_info_t* video, const input_driver_t** input, void** i static const char stock[] = #include "d3d_shaders/opaque_sm5.hlsl.h" - ; + ; D3D10_INPUT_ELEMENT_DESC desc[] = { { "POSITION", 0, DXGI_FORMAT_R32G32_FLOAT, 0, offsetof(d3d10_vertex_t, position), - D3D10_INPUT_PER_VERTEX_DATA, 0 }, + D3D10_INPUT_PER_VERTEX_DATA, 0 }, { "TEXCOORD", 0, DXGI_FORMAT_R32G32_FLOAT, 0, offsetof(d3d10_vertex_t, texcoord), - D3D10_INPUT_PER_VERTEX_DATA, 0 }, + D3D10_INPUT_PER_VERTEX_DATA, 0 }, { "COLOR", 0, DXGI_FORMAT_R32G32B32A32_FLOAT, 0, offsetof(d3d10_vertex_t, color), - D3D10_INPUT_PER_VERTEX_DATA, 0 }, + D3D10_INPUT_PER_VERTEX_DATA, 0 }, }; d3d_compile(stock, sizeof(stock), NULL, "VSMain", "vs_4_0", &vs_code); @@ -256,17 +276,25 @@ d3d10_gfx_init(const video_info_t* video, const input_driver_t** input, void** i D3D10SetPShader(d3d10->device, d3d10->ps); { - D3D10_BLEND_DESC blend_desc = { - .AlphaToCoverageEnable = FALSE, - .BlendEnable = { TRUE }, - D3D10_BLEND_SRC_ALPHA, - D3D10_BLEND_INV_SRC_ALPHA, - D3D10_BLEND_OP_ADD, - D3D10_BLEND_SRC_ALPHA, - D3D10_BLEND_INV_SRC_ALPHA, - D3D10_BLEND_OP_ADD, - { D3D10_COLOR_WRITE_ENABLE_ALL }, - }; + unsigned k; + D3D10_BLEND_DESC blend_desc; + + + + for (k = 0; k < 8; k++) + { + blend_desc.BlendEnable[k] = TRUE; + blend_desc.RenderTargetWriteMask[k] = D3D10_COLOR_WRITE_ENABLE_ALL; + } + + blend_desc.AlphaToCoverageEnable = FALSE; + blend_desc.SrcBlend = D3D10_BLEND_SRC_ALPHA; + blend_desc.DestBlend = D3D10_BLEND_INV_SRC_ALPHA; + blend_desc.BlendOp = D3D10_BLEND_OP_ADD; + blend_desc.SrcBlendAlpha = D3D10_BLEND_SRC_ALPHA; + blend_desc.DestBlendAlpha = D3D10_BLEND_INV_SRC_ALPHA; + blend_desc.BlendOpAlpha = D3D10_BLEND_OP_ADD; + D3D10CreateBlendState(d3d10->device, &blend_desc, &d3d10->blend_enable); blend_desc.BlendEnable[0] = FALSE; D3D10CreateBlendState(d3d10->device, &blend_desc, &d3d10->blend_disable); @@ -298,7 +326,7 @@ static bool d3d10_gfx_frame( D3D10Texture2D backBuffer; Release(d3d10->renderTargetView); - DXGIResizeBuffers(d3d10->swapChain, 0, 0, 0, 0, 0); + DXGIResizeBuffers(d3d10->swapChain, 0, 0, 0, (DXGI_FORMAT)0, 0); DXGIGetSwapChainBufferD3D10(d3d10->swapChain, 0, &backBuffer); D3D10CreateTexture2DRenderTargetView( @@ -337,9 +365,9 @@ static bool d3d10_gfx_frame( UINT stride = sizeof(d3d10_vertex_t); UINT offset = 0; #if 0 /* custom viewport doesn't call apply_state_changes, so we can't rely on this for now */ - if (d3d10->resize_viewport) + if (d3d10->resize_viewport) #endif - d3d10_update_viewport(d3d10, false); + d3d10_update_viewport(d3d10, false); D3D10SetViewports(d3d10->device, 1, &d3d10->frame.viewport); D3D10SetVertexBuffers(d3d10->device, 0, 1, &d3d10->frame.vbo, &stride, &offset); @@ -473,7 +501,7 @@ static void d3d10_set_menu_texture_frame( { d3d10_video_t* d3d10 = (d3d10_video_t*)data; int pitch = width * (rgb32 ? sizeof(uint32_t) : sizeof(uint16_t)); - DXGI_FORMAT format = rgb32 ? DXGI_FORMAT_B8G8R8A8_UNORM : DXGI_FORMAT_EX_A4R4G4B4_UNORM; + DXGI_FORMAT format = rgb32 ? DXGI_FORMAT_B8G8R8A8_UNORM : (DXGI_FORMAT)DXGI_FORMAT_EX_A4R4G4B4_UNORM; if (d3d10->menu.texture.desc.Width != width || d3d10->menu.texture.desc.Height != height) { @@ -485,7 +513,7 @@ static void d3d10_set_menu_texture_frame( d3d10_update_texture(width, height, pitch, format, frame, &d3d10->menu.texture); d3d10->menu.sampler = config_get_ptr()->bools.menu_linear_filter ? d3d10->sampler_linear - : d3d10->sampler_nearest; + : d3d10->sampler_nearest; } static void d3d10_set_menu_texture_enable(void* data, bool state, bool full_screen) { @@ -510,8 +538,10 @@ static void d3d10_gfx_apply_state_changes(void* data) { d3d10_video_t* d3d10 = (d3d10_video_t*)data; - // if (d3d10) - // d3d10->resize_viewport = true; +#if 0 + if (d3d10) + d3d10->resize_viewport = true; +#endif } static const video_poke_interface_t d3d10_poke_interface = { diff --git a/gfx/drivers/d3d11.c b/gfx/drivers/d3d11.c index f6db4471a0..f36dc9039f 100644 --- a/gfx/drivers/d3d11.c +++ b/gfx/drivers/d3d11.c @@ -13,6 +13,8 @@ * If not, see . */ +#define CINTERFACE + #include #include @@ -33,16 +35,22 @@ #include "../common/d3d11_common.h" #include "../common/dxgi_common.h" #include "../common/d3dcompiler_common.h" +#ifdef HAVE_SLANG #include "../drivers_shader/slang_process.h" +#endif static void d3d11_set_filtering(void* data, unsigned index, bool smooth) { + unsigned i; d3d11_video_t* d3d11 = (d3d11_video_t*)data; - if (smooth) - d3d11->frame.texture.sampler = d3d11->sampler_linear; - else - d3d11->frame.texture.sampler = d3d11->sampler_nearest; + for (i = 0; i < RARCH_WRAP_MAX; i++) + { + if (smooth) + d3d11->samplers[RARCH_FILTER_UNSPEC][i] = d3d11->samplers[RARCH_FILTER_LINEAR][i]; + else + d3d11->samplers[RARCH_FILTER_UNSPEC][i] = d3d11->samplers[RARCH_FILTER_NEAREST][i]; + } } static void d3d11_gfx_set_rotation(void* data, unsigned rotation) @@ -53,15 +61,13 @@ static void d3d11_gfx_set_rotation(void* data, unsigned rotation) if (!d3d11) return; - d3d11->frame.rotation = rotation; - - matrix_4x4_rotate_z(rot, d3d11->frame.rotation * (M_PI / 2.0f)); + matrix_4x4_rotate_z(rot, rotation * (M_PI / 2.0f)); matrix_4x4_multiply(d3d11->mvp, rot, d3d11->ubo_values.mvp); D3D11_MAPPED_SUBRESOURCE mapped_ubo; - D3D11MapBuffer(d3d11->ctx, d3d11->frame.ubo, 0, D3D11_MAP_WRITE_DISCARD, 0, &mapped_ubo); + D3D11MapBuffer(d3d11->context, d3d11->frame.ubo, 0, D3D11_MAP_WRITE_DISCARD, 0, &mapped_ubo); *(math_matrix_4x4*)mapped_ubo.pData = d3d11->mvp; - D3D11UnmapBuffer(d3d11->ctx, d3d11->frame.ubo, 0); + D3D11UnmapBuffer(d3d11->context, d3d11->frame.ubo, 0); } static void d3d11_update_viewport(void* data, bool force_full) @@ -76,9 +82,10 @@ static void d3d11_update_viewport(void* data, bool force_full) d3d11->frame.viewport.Height = d3d11->vp.height; d3d11->frame.viewport.MaxDepth = 0.0f; d3d11->frame.viewport.MaxDepth = 1.0f; - if (d3d11->frame.output_size.x != d3d11->vp.width || - d3d11->frame.output_size.y != d3d11->vp.height) - d3d11->resize_fbos = true; + + if (d3d11->shader_preset && (d3d11->frame.output_size.x != d3d11->vp.width || + d3d11->frame.output_size.y != d3d11->vp.height)) + d3d11->resize_render_targets = true; d3d11->frame.output_size.x = d3d11->vp.width; d3d11->frame.output_size.y = d3d11->vp.height; @@ -90,17 +97,22 @@ static void d3d11_update_viewport(void* data, bool force_full) static void d3d11_free_shader_preset(d3d11_video_t* d3d11) { + unsigned i; if (!d3d11->shader_preset) return; - for (int i = 0; i < d3d11->shader_preset->passes; i++) + for (i = 0; i < d3d11->shader_preset->passes; i++) { + unsigned j; + free(d3d11->shader_preset->pass[i].source.string.vertex); free(d3d11->shader_preset->pass[i].source.string.fragment); + free(d3d11->pass[i].semantics.textures); d3d11_release_shader(&d3d11->pass[i].shader); d3d11_release_texture(&d3d11->pass[i].rt); - free(d3d11->pass[i].semantics.textures); - for (int j = 0; j < SLANG_CBUFFER_MAX; j++) + d3d11_release_texture(&d3d11->pass[i].feedback); + + for (j = 0; j < SLANG_CBUFFER_MAX; j++) { free(d3d11->pass[i].semantics.cbuffers[j].uniforms); Release(d3d11->pass[i].buffers[j]); @@ -109,23 +121,36 @@ static void d3d11_free_shader_preset(d3d11_video_t* d3d11) memset(d3d11->pass, 0, sizeof(d3d11->pass)); - for (int i = 0; i < d3d11->shader_preset->luts; i++) + /* only free the history textures here */ + for (i = 1; i <= d3d11->shader_preset->history_size; i++) + d3d11_release_texture(&d3d11->frame.texture[i]); + + memset( + &d3d11->frame.texture[1], 0, + sizeof(d3d11->frame.texture[1]) * d3d11->shader_preset->history_size); + + for (i = 0; i < d3d11->shader_preset->luts; i++) d3d11_release_texture(&d3d11->luts[i]); memset(d3d11->luts, 0, sizeof(d3d11->luts)); free(d3d11->shader_preset); - d3d11->shader_preset = NULL; + d3d11->shader_preset = NULL; + d3d11->init_history = false; + d3d11->resize_render_targets = false; } static bool d3d11_gfx_set_shader(void* data, enum rarch_shader_type type, const char* path) { - d3d11_video_t* d3d11 = (d3d11_video_t*)data; +#if defined(HAVE_SLANG) && defined(HAVE_SPIRV_CROSS) + unsigned i; + d3d11_texture_t* source; + d3d11_video_t* d3d11 = (d3d11_video_t*)data; if (!d3d11) return false; - D3D11Flush(d3d11->ctx); + D3D11Flush(d3d11->context); d3d11_free_shader_preset(d3d11); if (!path) @@ -142,117 +167,114 @@ static bool d3d11_gfx_set_shader(void* data, enum rarch_shader_type type, const if (!conf) return false; - d3d11->shader_preset = calloc(1, sizeof(*d3d11->shader_preset)); + d3d11->shader_preset = (struct video_shader*)calloc(1, sizeof(*d3d11->shader_preset)); if (!video_shader_read_conf_cgp(conf, d3d11->shader_preset)) goto error; video_shader_resolve_relative(d3d11->shader_preset, path); - d3d11_texture_t* source = &d3d11->frame.texture; - for (int i = 0; i < d3d11->shader_preset->passes; i++) + source = &d3d11->frame.texture[0]; + for (i = 0; i < d3d11->shader_preset->passes; source = &d3d11->pass[i++].rt) { - { - /* no history support yet */ - texture_map_t texture_map[3 + GFX_MAX_SHADERS + GFX_MAX_TEXTURES + 1] = { - SL_TEXTURE_MAP( - SLANG_TEXTURE_SEMANTIC_ORIGINAL, d3d11->frame.texture, d3d11->pass[i].sampler, - d3d11->frame.texture.size_data), - SL_TEXTURE_MAP( - SLANG_TEXTURE_SEMANTIC_SOURCE, *source, d3d11->pass[i].sampler, - source->size_data), - SL_TEXTURE_MAP( - SLANG_TEXTURE_SEMANTIC_ORIGINAL_HISTORY, d3d11->frame.texture, - d3d11->pass[i].sampler, d3d11->frame.texture.size_data), - }; - + unsigned j; + /* clang-format off */ + semantics_map_t semantics_map = { { - texture_map_t* ptr = texture_map; - while (ptr->texture_data) - ptr++; + /* Original */ + { &d3d11->frame.texture[0].view, 0, + &d3d11->frame.texture[0].size_data, 0, + &d3d11->pass[i].sampler, 0 }, - for (int j = 0; j < i; j++) - { - *ptr = (texture_map_t)SL_TEXTURE_MAP_ARRAY( - SLANG_TEXTURE_SEMANTIC_PASS_OUTPUT, j, d3d11->pass[j].rt, - d3d11->pass[i].sampler, d3d11->pass[j].rt.size_data); - ptr++; - } + /* Source */ + { &source->view, 0, + &source->size_data, 0, + &d3d11->pass[i].sampler, 0 }, - for (int j = 0; j < d3d11->shader_preset->luts; j++) - { - *ptr = (texture_map_t)SL_TEXTURE_MAP_ARRAY( - SLANG_TEXTURE_SEMANTIC_USER, j, d3d11->luts[j], d3d11->luts[j].sampler, - d3d11->luts[j].size_data); - ptr++; - } + /* OriginalHistory */ + { &d3d11->frame.texture[0].view, sizeof(*d3d11->frame.texture), + &d3d11->frame.texture[0].size_data, sizeof(*d3d11->frame.texture), + &d3d11->pass[i].sampler, 0 }, + + /* PassOutput */ + { &d3d11->pass[0].rt.view, sizeof(*d3d11->pass), + &d3d11->pass[0].rt.size_data, sizeof(*d3d11->pass), + &d3d11->pass[i].sampler, 0 }, + + /* PassFeedback */ + { &d3d11->pass[0].feedback.view, sizeof(*d3d11->pass), + &d3d11->pass[0].feedback.size_data, sizeof(*d3d11->pass), + &d3d11->pass[i].sampler, 0 }, + + /* User */ + { &d3d11->luts[0].view, sizeof(*d3d11->luts), + &d3d11->luts[0].size_data, sizeof(*d3d11->luts), + &d3d11->luts[0].sampler, sizeof(*d3d11->luts) }, + }, + { + &d3d11->mvp, /* MVP */ + &d3d11->pass[i].rt.size_data, /* OutputSize */ + &d3d11->frame.output_size, /* FinalViewportSize */ + &d3d11->pass[i].frame_count, /* FrameCount */ } + }; + /* clang-format on */ - uniform_map_t uniform_map[] = { - SL_UNIFORM_MAP(SLANG_SEMANTIC_MVP, d3d11->mvp), - SL_UNIFORM_MAP(SLANG_SEMANTIC_OUTPUT, d3d11->pass[i].rt.size_data), - SL_UNIFORM_MAP(SLANG_SEMANTIC_FRAME_COUNT, d3d11->pass[i].frame_count), - SL_UNIFORM_MAP(SLANG_SEMANTIC_FINAL_VIEWPORT, d3d11->frame.output_size), - { 0 } - }; - - semantics_map_t semantics_map = { texture_map, uniform_map }; - - if (!slang_process( - d3d11->shader_preset, i, RARCH_SHADER_HLSL, 50, &semantics_map, - &d3d11->pass[i].semantics)) - goto error; - } + if (!slang_process( + d3d11->shader_preset, i, RARCH_SHADER_HLSL, 50, &semantics_map, + &d3d11->pass[i].semantics)) + goto error; { static const D3D11_INPUT_ELEMENT_DESC desc[] = { { "TEXCOORD", 0, DXGI_FORMAT_R32G32_FLOAT, 0, offsetof(d3d11_vertex_t, position), - D3D11_INPUT_PER_VERTEX_DATA, 0 }, + D3D11_INPUT_PER_VERTEX_DATA, 0 }, { "TEXCOORD", 1, DXGI_FORMAT_R32G32_FLOAT, 0, offsetof(d3d11_vertex_t, texcoord), - D3D11_INPUT_PER_VERTEX_DATA, 0 }, + D3D11_INPUT_PER_VERTEX_DATA, 0 }, }; #ifdef DEBUG bool save_hlsl = true; #else bool save_hlsl = false; #endif - const char* vs_src = d3d11->shader_preset->pass[i].source.string.vertex; - const char* ps_src = d3d11->shader_preset->pass[i].source.string.fragment; - const char* vs_ext = ".vs.hlsl"; - const char* ps_ext = ".ps.hlsl"; - int base_len = strlen(d3d11->shader_preset->pass[i].source.path) - strlen(".slang"); - char* vs_filename = (char*)malloc(base_len + strlen(vs_ext) + 1); - char* ps_filename = (char*)malloc(base_len + strlen(ps_ext) + 1); + static const char vs_ext[] = ".vs.hlsl"; + static const char ps_ext[] = ".ps.hlsl"; + char vs_path[PATH_MAX_LENGTH]; + char ps_path[PATH_MAX_LENGTH]; + const char* slang_path = d3d11->shader_preset->pass[i].source.path; + const char* vs_src = d3d11->shader_preset->pass[i].source.string.vertex; + const char* ps_src = d3d11->shader_preset->pass[i].source.string.fragment; + int base_len = strlen(slang_path) - strlen(".slang"); - strncpy(vs_filename, d3d11->shader_preset->pass[i].source.path, base_len); - strncpy(ps_filename, d3d11->shader_preset->pass[i].source.path, base_len); - strncpy(vs_filename + base_len, vs_ext, strlen(vs_ext) + 1); - strncpy(ps_filename + base_len, ps_ext, strlen(ps_ext) + 1); + if (base_len <= 0) + base_len = strlen(slang_path); + + strncpy(vs_path, slang_path, base_len); + strncpy(ps_path, slang_path, base_len); + strncpy(vs_path + base_len, vs_ext, sizeof(vs_ext)); + strncpy(ps_path + base_len, ps_ext, sizeof(ps_ext)); if (!d3d11_init_shader( - d3d11->device, vs_src, 0, vs_filename, "main", NULL, NULL, desc, countof(desc), - &d3d11->pass[i].shader)) + d3d11->device, vs_src, 0, vs_path, "main", NULL, NULL, desc, countof(desc), + &d3d11->pass[i].shader)) save_hlsl = true; if (!d3d11_init_shader( - d3d11->device, ps_src, 0, ps_filename, NULL, "main", NULL, NULL, 0, - &d3d11->pass[i].shader)) + d3d11->device, ps_src, 0, ps_path, NULL, "main", NULL, NULL, 0, + &d3d11->pass[i].shader)) save_hlsl = true; if (save_hlsl) { - FILE* fp = fopen(vs_filename, "w"); + FILE* fp = fopen(vs_path, "w"); fwrite(vs_src, 1, strlen(vs_src), fp); fclose(fp); - fp = fopen(ps_filename, "w"); + fp = fopen(ps_path, "w"); fwrite(ps_src, 1, strlen(ps_src), fp); fclose(fp); } - free(vs_filename); - free(ps_filename); - free(d3d11->shader_preset->pass[i].source.string.vertex); free(d3d11->shader_preset->pass[i].source.string.fragment); @@ -263,57 +285,67 @@ static bool d3d11_gfx_set_shader(void* data, enum rarch_shader_type type, const goto error; } - for (int j = 0; j < SLANG_CBUFFER_MAX; j++) + for (j = 0; j < SLANG_CBUFFER_MAX; j++) { - D3D11_BUFFER_DESC desc = { - .ByteWidth = d3d11->pass[i].semantics.cbuffers[j].size, - .Usage = D3D11_USAGE_DYNAMIC, - .BindFlags = D3D11_BIND_CONSTANT_BUFFER, - .CPUAccessFlags = D3D11_CPU_ACCESS_WRITE, - }; + D3D11_BUFFER_DESC desc; + desc.ByteWidth = d3d11->pass[i].semantics.cbuffers[j].size; + desc.Usage = D3D11_USAGE_DYNAMIC; + desc.BindFlags = D3D11_BIND_CONSTANT_BUFFER; + desc.CPUAccessFlags = D3D11_CPU_ACCESS_WRITE; + desc.MiscFlags = 0; + desc.StructureByteStride = 0; if (!desc.ByteWidth) continue; D3D11CreateBuffer(d3d11->device, &desc, NULL, &d3d11->pass[i].buffers[j]); } - - source = &d3d11->pass[i].rt; } - for (int i = 0; i < d3d11->shader_preset->luts; i++) + for (i = 0; i < d3d11->shader_preset->luts; i++) { struct texture_image image = { 0 }; image.supports_rgba = true; if (!image_texture_load(&image, d3d11->shader_preset->lut[i].path)) goto error; + d3d11->luts[i].desc.Width = image.width; d3d11->luts[i].desc.Height = image.height; d3d11->luts[i].desc.Format = DXGI_FORMAT_R8G8B8A8_UNORM; + + if (d3d11->shader_preset->lut[i].mipmap) + d3d11->luts[i].desc.MiscFlags = D3D11_RESOURCE_MISC_GENERATE_MIPS; + d3d11_init_texture(d3d11->device, &d3d11->luts[i]); + d3d11_update_texture( - d3d11->ctx, image.width, image.height, 0, DXGI_FORMAT_R8G8B8A8_UNORM, image.pixels, + d3d11->context, image.width, image.height, 0, DXGI_FORMAT_R8G8B8A8_UNORM, image.pixels, &d3d11->luts[i]); + image_texture_free(&image); - d3d11->luts[i].sampler = d3d11->shader_preset->lut[i].filter == RARCH_FILTER_NEAREST - ? d3d11->sampler_nearest - : d3d11->sampler_linear; + d3d11->luts[i].sampler = + d3d11->samplers[d3d11->shader_preset->lut[i].filter][d3d11->shader_preset->lut[i].wrap]; } video_shader_resolve_current_parameters(conf, d3d11->shader_preset); config_file_free(conf); + d3d11->resize_render_targets = true; + d3d11->init_history = true; + return true; error: d3d11_free_shader_preset(d3d11); +#endif return false; } static void d3d11_gfx_free(void* data) { + unsigned i; d3d11_video_t* d3d11 = (d3d11_video_t*)data; if (!d3d11) @@ -321,7 +353,7 @@ static void d3d11_gfx_free(void* data) d3d11_free_shader_preset(d3d11); - d3d11_release_texture(&d3d11->frame.texture); + d3d11_release_texture(&d3d11->frame.texture[0]); Release(d3d11->frame.ubo); Release(d3d11->frame.vbo); @@ -332,13 +364,8 @@ static void d3d11_gfx_free(void* data) d3d11_release_shader(&d3d11->sprites.shader_font); Release(d3d11->sprites.vbo); - d3d11_release_shader(&d3d11->shaders[VIDEO_SHADER_STOCK_BLEND]); - d3d11_release_shader(&d3d11->shaders[VIDEO_SHADER_MENU]); - d3d11_release_shader(&d3d11->shaders[VIDEO_SHADER_MENU_2]); - d3d11_release_shader(&d3d11->shaders[VIDEO_SHADER_MENU_3]); - d3d11_release_shader(&d3d11->shaders[VIDEO_SHADER_MENU_4]); - d3d11_release_shader(&d3d11->shaders[VIDEO_SHADER_MENU_5]); - d3d11_release_shader(&d3d11->shaders[VIDEO_SHADER_MENU_6]); + for (i = 0; i < GFX_MAX_SHADERS; i++) + d3d11_release_shader(&d3d11->shaders[i]); Release(d3d11->menu_pipeline_vbo); Release(d3d11->blend_pipeline); @@ -348,8 +375,11 @@ static void d3d11_gfx_free(void* data) Release(d3d11->blend_enable); Release(d3d11->blend_disable); - Release(d3d11->sampler_nearest); - Release(d3d11->sampler_linear); + for (i = 0; i < RARCH_WRAP_MAX; i++) + { + Release(d3d11->samplers[RARCH_FILTER_LINEAR][i]); + Release(d3d11->samplers[RARCH_FILTER_NEAREST][i]); + } Release(d3d11->state); Release(d3d11->renderTargetView); @@ -357,7 +387,7 @@ static void d3d11_gfx_free(void* data) font_driver_free_osd(); - Release(d3d11->ctx); + Release(d3d11->context); Release(d3d11->device); win32_monitor_from_window(); @@ -365,9 +395,10 @@ static void d3d11_gfx_free(void* data) free(d3d11); } -static void* + static void* d3d11_gfx_init(const video_info_t* video, const input_driver_t** input, void** input_data) { + unsigned i; WNDCLASSEX wndclass = { 0 }; MONITORINFOEX current_mon; HMONITOR hm_to_use; @@ -403,25 +434,25 @@ d3d11_gfx_init(const video_info_t* video, const input_driver_t** input, void** i { UINT flags = 0; D3D_FEATURE_LEVEL requested_feature_level = D3D_FEATURE_LEVEL_11_0; - DXGI_SWAP_CHAIN_DESC desc = { - .BufferCount = 1, - .BufferDesc.Width = d3d11->vp.full_width, - .BufferDesc.Height = d3d11->vp.full_height, - .BufferDesc.Format = DXGI_FORMAT_R8G8B8A8_UNORM, - .BufferDesc.RefreshRate.Numerator = 60, - .BufferDesc.RefreshRate.Denominator = 1, - .BufferUsage = DXGI_USAGE_RENDER_TARGET_OUTPUT, - .OutputWindow = main_window.hwnd, - .SampleDesc.Count = 1, - .SampleDesc.Quality = 0, - .Windowed = TRUE, - .SwapEffect = DXGI_SWAP_EFFECT_SEQUENTIAL, + DXGI_SWAP_CHAIN_DESC desc = { 0 }; + + desc.BufferCount = 1; + desc.BufferDesc.Width = d3d11->vp.full_width; + desc.BufferDesc.Height = d3d11->vp.full_height; + desc.BufferDesc.Format = DXGI_FORMAT_R8G8B8A8_UNORM; + desc.BufferDesc.RefreshRate.Numerator = 60; + desc.BufferDesc.RefreshRate.Denominator = 1; + desc.BufferUsage = DXGI_USAGE_RENDER_TARGET_OUTPUT; + desc.OutputWindow = main_window.hwnd; + desc.SampleDesc.Count = 1; + desc.SampleDesc.Quality = 0; + desc.Windowed = TRUE; + desc.SwapEffect = DXGI_SWAP_EFFECT_SEQUENTIAL; #if 0 - .SwapEffect = DXGI_SWAP_EFFECT_DISCARD, - .SwapEffect = DXGI_SWAP_EFFECT_FLIP_SEQUENTIAL, - .SwapEffect = DXGI_SWAP_EFFECT_FLIP_DISCARD, + desc.SwapEffect = DXGI_SWAP_EFFECT_DISCARD; + desc.SwapEffect = DXGI_SWAP_EFFECT_FLIP_SEQUENTIAL; + desc.SwapEffect = DXGI_SWAP_EFFECT_FLIP_DISCARD; #endif - }; #ifdef DEBUG flags |= D3D11_CREATE_DEVICE_DEBUG; @@ -430,7 +461,7 @@ d3d11_gfx_init(const video_info_t* video, const input_driver_t** input, void** i D3D11CreateDeviceAndSwapChain( NULL, D3D_DRIVER_TYPE_HARDWARE, NULL, flags, &requested_feature_level, 1, D3D11_SDK_VERSION, &desc, (IDXGISwapChain**)&d3d11->swapChain, &d3d11->device, - &d3d11->supportedFeatureLevel, &d3d11->ctx); + &d3d11->supportedFeatureLevel, &d3d11->context); } { @@ -441,7 +472,7 @@ d3d11_gfx_init(const video_info_t* video, const input_driver_t** input, void** i Release(backBuffer); } - D3D11SetRenderTargets(d3d11->ctx, 1, &d3d11->renderTargetView, NULL); + D3D11SetRenderTargets(d3d11->context, 1, &d3d11->renderTargetView, NULL); video_driver_set_size(&d3d11->vp.full_width, &d3d11->vp.full_height); d3d11->viewport.Width = d3d11->vp.full_width; @@ -450,8 +481,8 @@ d3d11_gfx_init(const video_info_t* video, const input_driver_t** input, void** i d3d11->vsync = video->vsync; d3d11->format = video->rgb32 ? DXGI_FORMAT_B8G8R8X8_UNORM : DXGI_FORMAT_B5G6R5_UNORM; - d3d11->frame.texture.desc.Format = d3d11->format; - d3d11->frame.texture.desc.Usage = D3D11_USAGE_DEFAULT; + d3d11->frame.texture[0].desc.Format = d3d11->format; + d3d11->frame.texture[0].desc.Usage = D3D11_USAGE_DEFAULT; d3d11->menu.texture.desc.Usage = D3D11_USAGE_DEFAULT; @@ -461,13 +492,19 @@ d3d11_gfx_init(const video_info_t* video, const input_driver_t** input, void** i d3d11->ubo_values.OutputSize.height = d3d11->viewport.Height; { - D3D11_BUFFER_DESC desc = { - .ByteWidth = sizeof(d3d11->ubo_values), - .Usage = D3D11_USAGE_DYNAMIC, - .BindFlags = D3D11_BIND_CONSTANT_BUFFER, - .CPUAccessFlags = D3D11_CPU_ACCESS_WRITE, - }; - D3D11_SUBRESOURCE_DATA ubo_data = { &d3d11->ubo_values.mvp }; + D3D11_SUBRESOURCE_DATA ubo_data; + D3D11_BUFFER_DESC desc; + desc.ByteWidth = sizeof(d3d11->ubo_values); + desc.Usage = D3D11_USAGE_DYNAMIC; + desc.BindFlags = D3D11_BIND_CONSTANT_BUFFER; + desc.CPUAccessFlags = D3D11_CPU_ACCESS_WRITE; + desc.MiscFlags = 0; + desc.StructureByteStride = 0; + + ubo_data.pSysMem = &d3d11->ubo_values.mvp; + ubo_data.SysMemPitch = 0; + ubo_data.SysMemSlicePitch = 0; + D3D11CreateBuffer(d3d11->device, &desc, &ubo_data, &d3d11->ubo); D3D11CreateBuffer(d3d11->device, &desc, NULL, &d3d11->frame.ubo); } @@ -475,20 +512,42 @@ d3d11_gfx_init(const video_info_t* video, const input_driver_t** input, void** i d3d11_gfx_set_rotation(d3d11, 0); { - D3D11_SAMPLER_DESC desc = { - .Filter = D3D11_FILTER_MIN_MAG_MIP_POINT, - .AddressU = D3D11_TEXTURE_ADDRESS_CLAMP, - .AddressV = D3D11_TEXTURE_ADDRESS_CLAMP, - .AddressW = D3D11_TEXTURE_ADDRESS_CLAMP, - .MaxAnisotropy = 1, - .ComparisonFunc = D3D11_COMPARISON_NEVER, - .MinLOD = -D3D11_FLOAT32_MAX, - .MaxLOD = D3D11_FLOAT32_MAX, - }; - D3D11CreateSamplerState(d3d11->device, &desc, &d3d11->sampler_nearest); + D3D11_SAMPLER_DESC desc = { D3D11_FILTER_MIN_MAG_MIP_POINT }; + desc.MaxAnisotropy = 1; + desc.ComparisonFunc = D3D11_COMPARISON_NEVER; + desc.MinLOD = -D3D11_FLOAT32_MAX; + desc.MaxLOD = D3D11_FLOAT32_MAX; - desc.Filter = D3D11_FILTER_MIN_MAG_MIP_LINEAR; - D3D11CreateSamplerState(d3d11->device, &desc, &d3d11->sampler_linear); + /* Initialize samplers */ + for (i = 0; i < RARCH_WRAP_MAX; i++) + { + switch (i) + { + case RARCH_WRAP_BORDER: + desc.AddressU = D3D11_TEXTURE_ADDRESS_BORDER; + break; + + case RARCH_WRAP_EDGE: + desc.AddressU = D3D11_TEXTURE_ADDRESS_CLAMP; + break; + + case RARCH_WRAP_REPEAT: + desc.AddressU = D3D11_TEXTURE_ADDRESS_WRAP; + break; + + case RARCH_WRAP_MIRRORED_REPEAT: + desc.AddressU = D3D11_TEXTURE_ADDRESS_MIRROR; + break; + } + desc.AddressV = desc.AddressU; + desc.AddressW = desc.AddressU; + + desc.Filter = D3D11_FILTER_MIN_MAG_MIP_LINEAR; + D3D11CreateSamplerState(d3d11->device, &desc, &d3d11->samplers[RARCH_FILTER_LINEAR][i]); + + desc.Filter = D3D11_FILTER_MIN_MAG_MIP_POINT; + D3D11CreateSamplerState(d3d11->device, &desc, &d3d11->samplers[RARCH_FILTER_NEAREST][i]); + } } d3d11_set_filtering(d3d11, 0, video->smooth); @@ -502,11 +561,11 @@ d3d11_gfx_init(const video_info_t* video, const input_driver_t** input, void** i }; { - D3D11_BUFFER_DESC desc = { - .Usage = D3D11_USAGE_IMMUTABLE, - .ByteWidth = sizeof(vertices), - .BindFlags = D3D11_BIND_VERTEX_BUFFER, - }; + D3D11_BUFFER_DESC desc = { 0 }; + desc.Usage = D3D11_USAGE_IMMUTABLE; + desc.ByteWidth = sizeof(vertices); + desc.BindFlags = D3D11_BIND_VERTEX_BUFFER; + D3D11_SUBRESOURCE_DATA vertexData = { vertices }; D3D11CreateBuffer(d3d11->device, &desc, &vertexData, &d3d11->frame.vbo); desc.Usage = D3D11_USAGE_DYNAMIC; @@ -522,52 +581,52 @@ d3d11_gfx_init(const video_info_t* video, const input_driver_t** input, void** i { D3D11_INPUT_ELEMENT_DESC desc[] = { { "POSITION", 0, DXGI_FORMAT_R32G32_FLOAT, 0, offsetof(d3d11_vertex_t, position), - D3D11_INPUT_PER_VERTEX_DATA, 0 }, + D3D11_INPUT_PER_VERTEX_DATA, 0 }, { "TEXCOORD", 0, DXGI_FORMAT_R32G32_FLOAT, 0, offsetof(d3d11_vertex_t, texcoord), - D3D11_INPUT_PER_VERTEX_DATA, 0 }, + D3D11_INPUT_PER_VERTEX_DATA, 0 }, { "COLOR", 0, DXGI_FORMAT_R32G32B32A32_FLOAT, 0, offsetof(d3d11_vertex_t, color), - D3D11_INPUT_PER_VERTEX_DATA, 0 }, + D3D11_INPUT_PER_VERTEX_DATA, 0 }, }; static const char shader[] = #include "d3d_shaders/opaque_sm5.hlsl.h" - ; + ; if (!d3d11_init_shader( - d3d11->device, shader, sizeof(shader), NULL, "VSMain", "PSMain", NULL, desc, - countof(desc), &d3d11->shaders[VIDEO_SHADER_STOCK_BLEND])) + d3d11->device, shader, sizeof(shader), NULL, "VSMain", "PSMain", NULL, desc, + countof(desc), &d3d11->shaders[VIDEO_SHADER_STOCK_BLEND])) goto error; } { D3D11_INPUT_ELEMENT_DESC desc[] = { { "POSITION", 0, DXGI_FORMAT_R32G32B32A32_FLOAT, 0, offsetof(d3d11_sprite_t, pos), - D3D11_INPUT_PER_VERTEX_DATA, 0 }, + D3D11_INPUT_PER_VERTEX_DATA, 0 }, { "TEXCOORD", 0, DXGI_FORMAT_R32G32B32A32_FLOAT, 0, offsetof(d3d11_sprite_t, coords), - D3D11_INPUT_PER_VERTEX_DATA, 0 }, + D3D11_INPUT_PER_VERTEX_DATA, 0 }, { "COLOR", 0, DXGI_FORMAT_R8G8B8A8_UNORM, 0, offsetof(d3d11_sprite_t, colors[0]), - D3D11_INPUT_PER_VERTEX_DATA, 0 }, + D3D11_INPUT_PER_VERTEX_DATA, 0 }, { "COLOR", 1, DXGI_FORMAT_R8G8B8A8_UNORM, 0, offsetof(d3d11_sprite_t, colors[1]), - D3D11_INPUT_PER_VERTEX_DATA, 0 }, + D3D11_INPUT_PER_VERTEX_DATA, 0 }, { "COLOR", 2, DXGI_FORMAT_R8G8B8A8_UNORM, 0, offsetof(d3d11_sprite_t, colors[2]), - D3D11_INPUT_PER_VERTEX_DATA, 0 }, + D3D11_INPUT_PER_VERTEX_DATA, 0 }, { "COLOR", 3, DXGI_FORMAT_R8G8B8A8_UNORM, 0, offsetof(d3d11_sprite_t, colors[3]), - D3D11_INPUT_PER_VERTEX_DATA, 0 }, + D3D11_INPUT_PER_VERTEX_DATA, 0 }, { "PARAMS", 0, DXGI_FORMAT_R32G32_FLOAT, 0, offsetof(d3d11_sprite_t, params), - D3D11_INPUT_PER_VERTEX_DATA, 0 }, + D3D11_INPUT_PER_VERTEX_DATA, 0 }, }; static const char shader[] = #include "d3d_shaders/sprite_sm4.hlsl.h" - ; + ; if (!d3d11_init_shader( - d3d11->device, shader, sizeof(shader), NULL, "VSMain", "PSMain", "GSMain", desc, - countof(desc), &d3d11->sprites.shader)) + d3d11->device, shader, sizeof(shader), NULL, "VSMain", "PSMain", "GSMain", desc, + countof(desc), &d3d11->sprites.shader)) goto error; if (!d3d11_init_shader( - d3d11->device, shader, sizeof(shader), NULL, "VSMain", "PSMainA8", "GSMain", desc, - countof(desc), &d3d11->sprites.shader_font)) + d3d11->device, shader, sizeof(shader), NULL, "VSMain", "PSMainA8", "GSMain", desc, + countof(desc), &d3d11->sprites.shader_font)) goto error; } @@ -578,79 +637,76 @@ d3d11_gfx_init(const video_info_t* video, const input_driver_t** input, void** i static const char ribbon[] = #include "d3d_shaders/ribbon_sm4.hlsl.h" - ; + ; static const char ribbon_simple[] = #include "d3d_shaders/ribbon_simple_sm4.hlsl.h" - ; + ; if (!d3d11_init_shader( - d3d11->device, ribbon, sizeof(ribbon), NULL, "VSMain", "PSMain", NULL, desc, - countof(desc), &d3d11->shaders[VIDEO_SHADER_MENU])) + d3d11->device, ribbon, sizeof(ribbon), NULL, "VSMain", "PSMain", NULL, desc, + countof(desc), &d3d11->shaders[VIDEO_SHADER_MENU])) goto error; if (!d3d11_init_shader( - d3d11->device, ribbon_simple, sizeof(ribbon_simple), NULL, "VSMain", "PSMain", NULL, - desc, countof(desc), &d3d11->shaders[VIDEO_SHADER_MENU_2])) + d3d11->device, ribbon_simple, sizeof(ribbon_simple), NULL, "VSMain", "PSMain", NULL, + desc, countof(desc), &d3d11->shaders[VIDEO_SHADER_MENU_2])) goto error; } { D3D11_INPUT_ELEMENT_DESC desc[] = { { "POSITION", 0, DXGI_FORMAT_R32G32_FLOAT, 0, offsetof(d3d11_vertex_t, position), - D3D11_INPUT_PER_VERTEX_DATA, 0 }, + D3D11_INPUT_PER_VERTEX_DATA, 0 }, { "TEXCOORD", 0, DXGI_FORMAT_R32G32_FLOAT, 0, offsetof(d3d11_vertex_t, texcoord), - D3D11_INPUT_PER_VERTEX_DATA, 0 }, + D3D11_INPUT_PER_VERTEX_DATA, 0 }, }; static const char simple_snow[] = #include "d3d_shaders/simple_snow_sm4.hlsl.h" - ; + ; static const char snow[] = #include "d3d_shaders/snow_sm4.hlsl.h" - ; + ; static const char bokeh[] = #include "d3d_shaders/bokeh_sm4.hlsl.h" - ; + ; static const char snowflake[] = #include "d3d_shaders/snowflake_sm4.hlsl.h" - ; + ; if (!d3d11_init_shader( - d3d11->device, simple_snow, sizeof(simple_snow), NULL, "VSMain", "PSMain", NULL, - desc, countof(desc), &d3d11->shaders[VIDEO_SHADER_MENU_3])) + d3d11->device, simple_snow, sizeof(simple_snow), NULL, "VSMain", "PSMain", NULL, + desc, countof(desc), &d3d11->shaders[VIDEO_SHADER_MENU_3])) goto error; if (!d3d11_init_shader( - d3d11->device, snow, sizeof(snow), NULL, "VSMain", "PSMain", NULL, desc, - countof(desc), &d3d11->shaders[VIDEO_SHADER_MENU_4])) + d3d11->device, snow, sizeof(snow), NULL, "VSMain", "PSMain", NULL, desc, + countof(desc), &d3d11->shaders[VIDEO_SHADER_MENU_4])) goto error; if (!d3d11_init_shader( - d3d11->device, bokeh, sizeof(bokeh), NULL, "VSMain", "PSMain", NULL, desc, - countof(desc), &d3d11->shaders[VIDEO_SHADER_MENU_5])) + d3d11->device, bokeh, sizeof(bokeh), NULL, "VSMain", "PSMain", NULL, desc, + countof(desc), &d3d11->shaders[VIDEO_SHADER_MENU_5])) goto error; if (!d3d11_init_shader( - d3d11->device, snowflake, sizeof(snowflake), NULL, "VSMain", "PSMain", NULL, desc, - countof(desc), &d3d11->shaders[VIDEO_SHADER_MENU_6])) + d3d11->device, snowflake, sizeof(snowflake), NULL, "VSMain", "PSMain", NULL, desc, + countof(desc), &d3d11->shaders[VIDEO_SHADER_MENU_6])) goto error; } { - D3D11_BLEND_DESC blend_desc = { - .AlphaToCoverageEnable = FALSE, - .IndependentBlendEnable = FALSE, - .RenderTarget[0] = - { - .BlendEnable = TRUE, - D3D11_BLEND_SRC_ALPHA, - D3D11_BLEND_INV_SRC_ALPHA, - D3D11_BLEND_OP_ADD, - D3D11_BLEND_SRC_ALPHA, - D3D11_BLEND_INV_SRC_ALPHA, - D3D11_BLEND_OP_ADD, - D3D11_COLOR_WRITE_ENABLE_ALL, - }, - }; + D3D11_BLEND_DESC blend_desc = { 0 }; + + blend_desc.AlphaToCoverageEnable = FALSE; + blend_desc.IndependentBlendEnable = FALSE; + blend_desc.RenderTarget[0].BlendEnable = TRUE; + blend_desc.RenderTarget[0].SrcBlend = D3D11_BLEND_SRC_ALPHA; + blend_desc.RenderTarget[0].DestBlend = D3D11_BLEND_INV_SRC_ALPHA; + blend_desc.RenderTarget[0].BlendOp = D3D11_BLEND_OP_ADD; + blend_desc.RenderTarget[0].SrcBlendAlpha = D3D11_BLEND_SRC_ALPHA; + blend_desc.RenderTarget[0].DestBlendAlpha = D3D11_BLEND_INV_SRC_ALPHA; + blend_desc.RenderTarget[0].BlendOpAlpha = D3D11_BLEND_OP_ADD; + blend_desc.RenderTarget[0].RenderTargetWriteMask = D3D11_COLOR_WRITE_ENABLE_ALL; D3D11CreateBlendState(d3d11->device, &blend_desc, &d3d11->blend_enable); blend_desc.RenderTarget[0].SrcBlend = D3D11_BLEND_ONE; @@ -661,13 +717,14 @@ d3d11_gfx_init(const video_info_t* video, const input_driver_t** input, void** i D3D11CreateBlendState(d3d11->device, &blend_desc, &d3d11->blend_disable); } { - D3D11_RASTERIZER_DESC desc = { - .FillMode = D3D11_FILL_SOLID, - .CullMode = D3D11_CULL_NONE, - }; + D3D11_RASTERIZER_DESC desc = {(D3D11_FILL_MODE)0}; + + desc.FillMode = D3D11_FILL_SOLID; + desc.CullMode = D3D11_CULL_NONE; + D3D11CreateRasterizerState(d3d11->device, &desc, &d3d11->state); } - D3D11SetState(d3d11->ctx, d3d11->state); + D3D11SetState(d3d11->context, d3d11->state); font_driver_init_osd(d3d11, false, video->is_threaded, FONT_DRIVER_RENDER_D3D11_API); @@ -685,32 +742,44 @@ error: d3d11_gfx_free(d3d11); return NULL; } -static bool d3d11_init_frame_textures(d3d11_video_t* d3d11, unsigned width, unsigned height) + +static void d3d11_init_history(d3d11_video_t* d3d11, unsigned width, unsigned height) { - if (d3d11->shader_preset) + unsigned i; + + /* todo: should we init history to max_width/max_height instead ? + * to prevent out of memory errors happening several frames later + * and to reduce memory fragmentation */ + + assert(d3d11->shader_preset); + for (i = 0; i < d3d11->shader_preset->history_size + 1; i++) { - for (int i = 0; i < d3d11->shader_preset->passes; i++) - { - d3d11_release_texture(&d3d11->pass[i].rt); - memset(&d3d11->pass[i].rt, 0x00, sizeof(d3d11->pass[i].rt)); - } + d3d11->frame.texture[i].desc.Width = width; + d3d11->frame.texture[i].desc.Height = height; + d3d11->frame.texture[i].desc.Format = d3d11->frame.texture[0].desc.Format; + d3d11->frame.texture[i].desc.Usage = d3d11->frame.texture[0].desc.Usage; + d3d11_init_texture(d3d11->device, &d3d11->frame.texture[i]); + /* todo: clear texture ? */ } + d3d11->init_history = false; +} +static void d3d11_init_render_targets(d3d11_video_t* d3d11, unsigned width, unsigned height) +{ + unsigned i; - d3d11->frame.texture.desc.Width = width; - d3d11->frame.texture.desc.Height = height; - d3d11_init_texture(d3d11->device, &d3d11->frame.texture); + assert(d3d11->shader_preset); - if (d3d11->shader_preset) + for (i = 0; i < d3d11->shader_preset->passes; i++) { - for (int i = 0; i < d3d11->shader_preset->passes; i++) + struct video_shader_pass* pass = &d3d11->shader_preset->pass[i]; + + if (pass->fbo.valid) { - struct video_shader_pass* pass = &d3d11->shader_preset->pass[i]; switch (pass->fbo.type_x) { case RARCH_SCALE_INPUT: - if (pass->fbo.scale_x) - width *= pass->fbo.scale_x; + width *= pass->fbo.scale_x; break; case RARCH_SCALE_VIEWPORT: @@ -725,11 +794,13 @@ static bool d3d11_init_frame_textures(d3d11_video_t* d3d11, unsigned width, unsi break; } + if (!width) + width = d3d11->vp.width; + switch (pass->fbo.type_y) { case RARCH_SCALE_INPUT: - if (pass->fbo.scale_y) - height *= pass->fbo.scale_y; + height *= pass->fbo.scale_y; break; case RARCH_SCALE_VIEWPORT: @@ -744,12 +815,20 @@ static bool d3d11_init_frame_textures(d3d11_video_t* d3d11, unsigned width, unsi break; } - if (!width) - width = d3d11->vp.width; - if (!height) height = d3d11->vp.height; + } + else if (i == (d3d11->shader_preset->passes - 1)) + { + width = d3d11->vp.width; + height = d3d11->vp.height; + } + RARCH_LOG("[D3D11]: Updating framebuffer size %u x %u.\n", width, height); + + if ((i != (d3d11->shader_preset->passes - 1)) || (width != d3d11->vp.width) || + (height != d3d11->vp.height)) + { d3d11->pass[i].viewport.Width = width; d3d11->pass[i].viewport.Height = height; d3d11->pass[i].viewport.MaxDepth = 1.0; @@ -757,37 +836,28 @@ static bool d3d11_init_frame_textures(d3d11_video_t* d3d11, unsigned width, unsi d3d11->pass[i].rt.desc.Height = height; d3d11->pass[i].rt.desc.BindFlags = D3D11_BIND_RENDER_TARGET; d3d11->pass[i].rt.desc.Format = glslang_format_to_dxgi(d3d11->pass[i].semantics.format); + d3d11_init_texture(d3d11->device, &d3d11->pass[i].rt); - if ((i != (d3d11->shader_preset->passes - 1)) || (width != d3d11->vp.width) || - (height != d3d11->vp.height)) + if (pass->feedback) { - d3d11_init_texture(d3d11->device, &d3d11->pass[i].rt); - } - else - { - d3d11->pass[i].rt.size_data.x = width; - d3d11->pass[i].rt.size_data.y = height; - d3d11->pass[i].rt.size_data.z = 1.0f / width; - d3d11->pass[i].rt.size_data.w = 1.0f / height; - } - - d3d11->pass[i].sampler = pass->filter == RARCH_FILTER_NEAREST ? d3d11->sampler_nearest - : d3d11->sampler_linear; - - for (int j = 0; j < d3d11->pass[i].semantics.texture_count; j++) - { - texture_sem_t* texture_sem = &d3d11->pass[i].semantics.textures[j]; - D3D11ShaderResourceView view = ((d3d11_texture_t*)texture_sem->texture_data)->view; - D3D11SamplerStateRef sampler = *(D3D11SamplerStateRef*)texture_sem->sampler_data; - - d3d11->pass[i].textures[texture_sem->binding] = view; - d3d11->pass[i].samplers[texture_sem->binding] = sampler; + d3d11->pass[i].feedback.desc = d3d11->pass[i].rt.desc; + d3d11_init_texture(d3d11->device, &d3d11->pass[i].feedback); + /* todo: do we need to clear it to black here ? */ } } + else + { + d3d11->pass[i].rt.size_data.x = width; + d3d11->pass[i].rt.size_data.y = height; + d3d11->pass[i].rt.size_data.z = 1.0f / width; + d3d11->pass[i].rt.size_data.w = 1.0f / height; + } + + d3d11->pass[i].sampler = d3d11->samplers[pass->filter][pass->wrap]; } - d3d11->resize_fbos = false; - return true; + d3d11->resize_render_targets = false; + #if 0 error: d3d11_free_shader_preset(d3d11); @@ -805,21 +875,24 @@ static bool d3d11_gfx_frame( const char* msg, video_frame_info_t* video_info) { - d3d11_video_t* d3d11 = (d3d11_video_t*)data; + unsigned i; + d3d11_texture_t* texture = NULL; + d3d11_video_t* d3d11 = (d3d11_video_t*)data; + D3D11DeviceContext context = d3d11->context; if (d3d11->resize_chain) { D3D11Texture2D backBuffer; Release(d3d11->renderTargetView); - DXGIResizeBuffers(d3d11->swapChain, 0, 0, 0, 0, 0); + DXGIResizeBuffers(d3d11->swapChain, 0, 0, 0, DXGI_FORMAT_UNKNOWN, 0); DXGIGetSwapChainBufferD3D11(d3d11->swapChain, 0, &backBuffer); D3D11CreateTexture2DRenderTargetView( d3d11->device, backBuffer, NULL, &d3d11->renderTargetView); Release(backBuffer); - D3D11SetRenderTargets(d3d11->ctx, 1, &d3d11->renderTargetView, NULL); + D3D11SetRenderTargets(context, 1, &d3d11->renderTargetView, NULL); d3d11->viewport.Width = video_info->width; d3d11->viewport.Height = video_info->height; @@ -837,39 +910,88 @@ static bool d3d11_gfx_frame( #if 0 /* custom viewport doesn't call apply_state_changes, so we can't rely on this for now */ if (d3d11->resize_viewport) #endif - d3d11_update_viewport(d3d11, false); + d3d11_update_viewport(d3d11, false); - D3D11SetPrimitiveTopology(d3d11->ctx, D3D11_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP); + D3D11SetPrimitiveTopology(context, D3D11_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP); if (frame && width && height) { - if (d3d11->frame.texture.desc.Width != width || d3d11->frame.texture.desc.Height != height) - d3d11_init_frame_textures(d3d11, width, height); + if (d3d11->shader_preset) + { + if (d3d11->frame.texture[0].desc.Width != width || + d3d11->frame.texture[0].desc.Height != height) + d3d11->resize_render_targets = true; + + if (d3d11->resize_render_targets) + { + /* release all render targets first to avoid memory fragmentation */ + for (i = 0; i < d3d11->shader_preset->passes; i++) + d3d11_release_texture(&d3d11->pass[i].rt); + } + + if (d3d11->shader_preset->history_size) + { + if (d3d11->init_history) + d3d11_init_history(d3d11, width, height); + else + { + int k; + /* todo: what about frame-duping ? + * maybe clone d3d11_texture_t with AddRef */ + d3d11_texture_t tmp = d3d11->frame.texture[d3d11->shader_preset->history_size]; + for (k = d3d11->shader_preset->history_size; k > 0; k--) + d3d11->frame.texture[k] = d3d11->frame.texture[k - 1]; + d3d11->frame.texture[0] = tmp; + } + } + } + + /* either no history, or we moved a texture of a different size in the front slot */ + if (d3d11->frame.texture[0].desc.Width != width || + d3d11->frame.texture[0].desc.Height != height) + { + d3d11->frame.texture[0].desc.Width = width; + d3d11->frame.texture[0].desc.Height = height; + d3d11_init_texture(d3d11->device, &d3d11->frame.texture[0]); + } + + if (d3d11->resize_render_targets) + d3d11_init_render_targets(d3d11, width, height); d3d11_update_texture( - d3d11->ctx, width, height, pitch, d3d11->format, frame, &d3d11->frame.texture); + context, width, height, pitch, d3d11->format, frame, &d3d11->frame.texture[0]); } - D3D11SetVertexBuffer(d3d11->ctx, 0, d3d11->frame.vbo, sizeof(d3d11_vertex_t), 0); - D3D11SetBlendState(d3d11->ctx, d3d11->blend_disable, NULL, D3D11_DEFAULT_SAMPLE_MASK); + D3D11SetVertexBuffer(context, 0, d3d11->frame.vbo, sizeof(d3d11_vertex_t), 0); + D3D11SetBlendState(context, d3d11->blend_disable, NULL, D3D11_DEFAULT_SAMPLE_MASK); - /* todo: single pass shaders can also have an empty rt texture */ - if (d3d11->shader_preset && (d3d11->resize_fbos || !d3d11->pass[0].rt.handle)) - d3d11_init_frame_textures(d3d11, width, height); - - d3d11_texture_t* texture = &d3d11->frame.texture; + texture = d3d11->frame.texture; if (d3d11->shader_preset) { - for (int i = 0; i < d3d11->shader_preset->passes; i++) + for (i = 0; i < d3d11->shader_preset->passes; i++) { + if (d3d11->shader_preset->pass[i].feedback) + { + d3d11_texture_t tmp = d3d11->pass[i].feedback; + d3d11->pass[i].feedback = d3d11->pass[i].rt; + d3d11->pass[i].rt = tmp; + } + } + + for (i = 0; i < d3d11->shader_preset->passes; i++) + { + unsigned j; + + d3d11_set_shader(context, &d3d11->pass[i].shader); + if (d3d11->shader_preset->pass[i].frame_count_mod) d3d11->pass[i].frame_count = - frame_count % d3d11->shader_preset->pass[i].frame_count_mod; + frame_count % d3d11->shader_preset->pass[i].frame_count_mod; else d3d11->pass[i].frame_count = frame_count; - for (int j = 0; j < SLANG_CBUFFER_MAX; j++) + for (j = 0; j < SLANG_CBUFFER_MAX; j++) { D3D11Buffer buffer = d3d11->pass[i].buffers[j]; cbuffer_sem_t* buffer_sem = &d3d11->pass[i].semantics.cbuffers[j]; @@ -879,37 +1001,52 @@ static bool d3d11_gfx_frame( D3D11_MAPPED_SUBRESOURCE res; uniform_sem_t* uniform = buffer_sem->uniforms; - D3D11MapBuffer(d3d11->ctx, buffer, 0, D3D11_MAP_WRITE_DISCARD, 0, &res); + D3D11MapBuffer(context, buffer, 0, D3D11_MAP_WRITE_DISCARD, 0, &res); while (uniform->size) { if (uniform->data) memcpy((uint8_t*)res.pData + uniform->offset, uniform->data, uniform->size); uniform++; } - D3D11UnmapBuffer(d3d11->ctx, buffer, 0); + D3D11UnmapBuffer(context, buffer, 0); if (buffer_sem->stage_mask & SLANG_STAGE_VERTEX_MASK) - D3D11SetVShaderConstantBuffers(d3d11->ctx, buffer_sem->binding, 1, &buffer); + D3D11SetVShaderConstantBuffers(context, buffer_sem->binding, 1, &buffer); if (buffer_sem->stage_mask & SLANG_STAGE_FRAGMENT_MASK) - D3D11SetPShaderConstantBuffers(d3d11->ctx, buffer_sem->binding, 1, &buffer); + D3D11SetPShaderConstantBuffers(context, buffer_sem->binding, 1, &buffer); } } - d3d11_set_shader(d3d11->ctx, &d3d11->pass[i].shader); + { + D3D11RenderTargetView null_rt = NULL; + D3D11SetRenderTargets(context, 1, &null_rt, NULL); + } - D3D11RenderTargetView null_rt = NULL; - D3D11SetRenderTargets(d3d11->ctx, 1, &null_rt, NULL); - D3D11SetPShaderResources(d3d11->ctx, 0, SLANG_NUM_BINDINGS, d3d11->pass[i].textures); - D3D11SetPShaderSamplers(d3d11->ctx, 0, SLANG_NUM_BINDINGS, d3d11->pass[i].samplers); + { + D3D11ShaderResourceView textures[SLANG_NUM_BINDINGS] = { NULL }; + D3D11SamplerState samplers[SLANG_NUM_BINDINGS] = { NULL }; + + texture_sem_t* texture_sem = d3d11->pass[i].semantics.textures; + while (texture_sem->stage_mask) + { + int binding = texture_sem->binding; + textures[binding] = *(D3D11ShaderResourceView*)texture_sem->texture_data; + samplers[binding] = *(D3D11SamplerState*)texture_sem->sampler_data; + texture_sem++; + } + + D3D11SetPShaderResources(context, 0, SLANG_NUM_BINDINGS, textures); + D3D11SetPShaderSamplers(context, 0, SLANG_NUM_BINDINGS, samplers); + } if (d3d11->pass[i].rt.handle) { - D3D11SetRenderTargets(d3d11->ctx, 1, &d3d11->pass[i].rt.rt_view, NULL); - D3D11ClearRenderTargetView(d3d11->ctx, d3d11->pass[i].rt.rt_view, d3d11->clearcolor); - D3D11SetViewports(d3d11->ctx, 1, &d3d11->pass[i].viewport); + D3D11SetRenderTargets(context, 1, &d3d11->pass[i].rt.rt_view, NULL); + D3D11ClearRenderTargetView(context, d3d11->pass[i].rt.rt_view, d3d11->clearcolor); + D3D11SetViewports(context, 1, &d3d11->pass[i].viewport); - D3D11Draw(d3d11->ctx, 4, 0); + D3D11Draw(context, 4, 0); texture = &d3d11->pass[i].rt; } else @@ -918,43 +1055,44 @@ static bool d3d11_gfx_frame( break; } } - D3D11SetRenderTargets(d3d11->ctx, 1, &d3d11->renderTargetView, NULL); + D3D11SetRenderTargets(context, 1, &d3d11->renderTargetView, NULL); } if (texture) { - d3d11_set_shader(d3d11->ctx, &d3d11->shaders[VIDEO_SHADER_STOCK_BLEND]); - D3D11SetPShaderResources(d3d11->ctx, 0, 1, &texture->view); - D3D11SetPShaderSamplers(d3d11->ctx, 0, 1, &d3d11->frame.texture.sampler); - D3D11SetVShaderConstantBuffers(d3d11->ctx, 0, 1, &d3d11->frame.ubo); + d3d11_set_shader(context, &d3d11->shaders[VIDEO_SHADER_STOCK_BLEND]); + D3D11SetPShaderResources(context, 0, 1, &texture->view); + D3D11SetPShaderSamplers( + context, 0, 1, &d3d11->samplers[RARCH_FILTER_UNSPEC][RARCH_WRAP_DEFAULT]); + D3D11SetVShaderConstantBuffers(context, 0, 1, &d3d11->frame.ubo); } - D3D11ClearRenderTargetView(d3d11->ctx, d3d11->renderTargetView, d3d11->clearcolor); - D3D11SetViewports(d3d11->ctx, 1, &d3d11->frame.viewport); + D3D11ClearRenderTargetView(context, d3d11->renderTargetView, d3d11->clearcolor); + D3D11SetViewports(context, 1, &d3d11->frame.viewport); - D3D11Draw(d3d11->ctx, 4, 0); + D3D11Draw(context, 4, 0); - D3D11SetBlendState(d3d11->ctx, d3d11->blend_enable, NULL, D3D11_DEFAULT_SAMPLE_MASK); + D3D11SetBlendState(context, d3d11->blend_enable, NULL, D3D11_DEFAULT_SAMPLE_MASK); if (d3d11->menu.enabled && d3d11->menu.texture.handle) { if (d3d11->menu.fullscreen) - D3D11SetViewports(d3d11->ctx, 1, &d3d11->viewport); + D3D11SetViewports(context, 1, &d3d11->viewport); - d3d11_set_shader(d3d11->ctx, &d3d11->shaders[VIDEO_SHADER_STOCK_BLEND]); - D3D11SetVertexBuffer(d3d11->ctx, 0, d3d11->menu.vbo, sizeof(d3d11_vertex_t), 0); - D3D11SetVShaderConstantBuffers(d3d11->ctx, 0, 1, &d3d11->ubo); - d3d11_set_texture_and_sampler(d3d11->ctx, 0, &d3d11->menu.texture); - D3D11Draw(d3d11->ctx, 4, 0); + d3d11_set_shader(context, &d3d11->shaders[VIDEO_SHADER_STOCK_BLEND]); + D3D11SetVertexBuffer(context, 0, d3d11->menu.vbo, sizeof(d3d11_vertex_t), 0); + D3D11SetVShaderConstantBuffers(context, 0, 1, &d3d11->ubo); + d3d11_set_texture_and_sampler(context, 0, &d3d11->menu.texture); + D3D11Draw(context, 4, 0); } - D3D11SetViewports(d3d11->ctx, 1, &d3d11->viewport); + D3D11SetViewports(context, 1, &d3d11->viewport); - d3d11_set_shader(d3d11->ctx, &d3d11->sprites.shader); - D3D11SetPrimitiveTopology(d3d11->ctx, D3D11_PRIMITIVE_TOPOLOGY_POINTLIST); - D3D11SetVertexBuffer(d3d11->ctx, 0, d3d11->sprites.vbo, sizeof(d3d11_sprite_t), 0); - D3D11SetVShaderConstantBuffer(d3d11->ctx, 0, d3d11->ubo); - D3D11SetPShaderConstantBuffer(d3d11->ctx, 0, d3d11->ubo); + d3d11_set_shader(context, &d3d11->sprites.shader); + D3D11SetPrimitiveTopology(context, D3D11_PRIMITIVE_TOPOLOGY_POINTLIST); + D3D11SetVertexBuffer(context, 0, d3d11->sprites.vbo, sizeof(d3d11_sprite_t), 0); + D3D11SetVShaderConstantBuffer(context, 0, d3d11->ubo); + D3D11SetPShaderConstantBuffer(context, 0, d3d11->ubo); d3d11->sprites.enabled = true; @@ -1040,8 +1178,9 @@ static bool d3d11_gfx_read_viewport(void* data, uint8_t* buffer, bool is_idle) static void d3d11_set_menu_texture_frame( void* data, const void* frame, bool rgb32, unsigned width, unsigned height, float alpha) { - d3d11_video_t* d3d11 = (d3d11_video_t*)data; - DXGI_FORMAT format = rgb32 ? DXGI_FORMAT_B8G8R8A8_UNORM : DXGI_FORMAT_EX_A4R4G4B4_UNORM; + d3d11_video_t* d3d11 = (d3d11_video_t*)data; + DXGI_FORMAT format = + rgb32 ? DXGI_FORMAT_B8G8R8A8_UNORM : (DXGI_FORMAT)DXGI_FORMAT_EX_A4R4G4B4_UNORM; if (d3d11->menu.texture.desc.Width != width || d3d11->menu.texture.desc.Height != height) { @@ -1051,10 +1190,11 @@ static void d3d11_set_menu_texture_frame( d3d11_init_texture(d3d11->device, &d3d11->menu.texture); } - d3d11_update_texture(d3d11->ctx, width, height, 0, format, frame, &d3d11->menu.texture); - d3d11->menu.texture.sampler = config_get_ptr()->bools.menu_linear_filter - ? d3d11->sampler_linear - : d3d11->sampler_nearest; + d3d11_update_texture(d3d11->context, width, height, 0, format, frame, &d3d11->menu.texture); + d3d11->menu.texture.sampler = d3d11->samplers + [config_get_ptr()->bools.menu_linear_filter + ? RARCH_FILTER_LINEAR + : RARCH_FILTER_NEAREST][RARCH_WRAP_DEFAULT]; } static void d3d11_set_menu_texture_enable(void* data, bool state, bool full_screen) @@ -1112,19 +1252,22 @@ static uintptr_t d3d11_gfx_load_texture( texture = (d3d11_texture_t*)calloc(1, sizeof(*texture)); + if (!texture) + return 0; + switch (filter_type) { case TEXTURE_FILTER_MIPMAP_LINEAR: texture->desc.MiscFlags = D3D11_RESOURCE_MISC_GENERATE_MIPS; /* fallthrough */ case TEXTURE_FILTER_LINEAR: - texture->sampler = d3d11->sampler_linear; + texture->sampler = d3d11->samplers[RARCH_FILTER_LINEAR][RARCH_WRAP_EDGE]; break; case TEXTURE_FILTER_MIPMAP_NEAREST: texture->desc.MiscFlags = D3D11_RESOURCE_MISC_GENERATE_MIPS; /* fallthrough */ case TEXTURE_FILTER_NEAREST: - texture->sampler = d3d11->sampler_nearest; + texture->sampler = d3d11->samplers[RARCH_FILTER_NEAREST][RARCH_WRAP_EDGE]; break; } @@ -1135,7 +1278,7 @@ static uintptr_t d3d11_gfx_load_texture( d3d11_init_texture(d3d11->device, texture); d3d11_update_texture( - d3d11->ctx, image->width, image->height, 0, DXGI_FORMAT_B8G8R8A8_UNORM, image->pixels, + d3d11->context, image->width, image->height, 0, DXGI_FORMAT_B8G8R8A8_UNORM, image->pixels, texture); return (uintptr_t)texture; diff --git a/gfx/drivers/d3d12.c b/gfx/drivers/d3d12.c index f1c48a1ad2..6b5908c28d 100644 --- a/gfx/drivers/d3d12.c +++ b/gfx/drivers/d3d12.c @@ -13,27 +13,39 @@ * If not, see . */ +#define CINTERFACE + #include +#include #include +#include #include "../video_driver.h" +#include "../font_driver.h" #include "../common/win32_common.h" #include "../common/dxgi_common.h" #include "../common/d3d12_common.h" #include "../common/d3dcompiler_common.h" +#include "../../menu/menu_driver.h" #include "../../driver.h" #include "../../verbosity.h" #include "../../configuration.h" +#include "wiiu/wiiu_dbg.h" + static void d3d12_set_filtering(void* data, unsigned index, bool smooth) { + int i; d3d12_video_t* d3d12 = (d3d12_video_t*)data; - if (smooth) - d3d12->frame.sampler = d3d12->sampler_linear; - else - d3d12->frame.sampler = d3d12->sampler_nearest; + for (i = 0; i < RARCH_WRAP_MAX; i++) + { + if (smooth) + d3d12->samplers[RARCH_FILTER_UNSPEC][i] = d3d12->samplers[RARCH_FILTER_LINEAR][i]; + else + d3d12->samplers[RARCH_FILTER_UNSPEC][i] = d3d12->samplers[RARCH_FILTER_NEAREST][i]; + } } static void d3d12_gfx_set_rotation(void* data, unsigned rotation) @@ -43,7 +55,7 @@ static void d3d12_gfx_set_rotation(void* data, unsigned rotation) D3D12_RANGE read_range = { 0, 0 }; d3d12_video_t* d3d12 = (d3d12_video_t*)data; - if(!d3d12) + if (!d3d12) return; d3d12->frame.rotation = rotation; @@ -62,10 +74,10 @@ static void d3d12_update_viewport(void* data, bool force_full) video_driver_update_viewport(&d3d12->vp, force_full, d3d12->keep_aspect); - d3d12->frame.viewport.TopLeftX = (float)d3d12->vp.x; - d3d12->frame.viewport.TopLeftY = (float)d3d12->vp.y; - d3d12->frame.viewport.Width = (float)d3d12->vp.width; - d3d12->frame.viewport.Height = (float)d3d12->vp.height; + d3d12->frame.viewport.TopLeftX = d3d12->vp.x; + d3d12->frame.viewport.TopLeftY = d3d12->vp.y; + d3d12->frame.viewport.Width = d3d12->vp.width; + d3d12->frame.viewport.Height = d3d12->vp.height; d3d12->frame.viewport.MaxDepth = 0.0f; d3d12->frame.viewport.MaxDepth = 1.0f; @@ -75,15 +87,615 @@ static void d3d12_update_viewport(void* data, bool force_full) d3d12->frame.scissorRect.right = d3d12->vp.x + d3d12->vp.width; d3d12->frame.scissorRect.bottom = d3d12->vp.y + d3d12->vp.height; + if (d3d12->shader_preset && (d3d12->frame.output_size.x != d3d12->vp.width || + d3d12->frame.output_size.y != d3d12->vp.height)) + d3d12->resize_render_targets = true; + + d3d12->frame.output_size.x = d3d12->vp.width; + d3d12->frame.output_size.y = d3d12->vp.height; + d3d12->frame.output_size.z = 1.0f / d3d12->vp.width; + d3d12->frame.output_size.w = 1.0f / d3d12->vp.height; + d3d12->resize_viewport = false; } +static void d3d12_free_shader_preset(d3d12_video_t* d3d12) +{ + unsigned i; + if (!d3d12->shader_preset) + return; + + for (i = 0; i < d3d12->shader_preset->passes; i++) + { + unsigned j; + + free(d3d12->shader_preset->pass[i].source.string.vertex); + free(d3d12->shader_preset->pass[i].source.string.fragment); + free(d3d12->pass[i].semantics.textures); + d3d12_release_texture(&d3d12->pass[i].rt); + d3d12_release_texture(&d3d12->pass[i].feedback); + + for (j = 0; j < SLANG_CBUFFER_MAX; j++) + { + free(d3d12->pass[i].semantics.cbuffers[j].uniforms); + Release(d3d12->pass[i].buffers[j]); + } + + Release(d3d12->pass[i].pipe); + } + + memset(d3d12->pass, 0, sizeof(d3d12->pass)); + + /* only free the history textures here */ + for (i = 1; i <= d3d12->shader_preset->history_size; i++) + d3d12_release_texture(&d3d12->frame.texture[i]); + + memset( + &d3d12->frame.texture[1], 0, + sizeof(d3d12->frame.texture[1]) * d3d12->shader_preset->history_size); + + for (i = 0; i < d3d12->shader_preset->luts; i++) + d3d12_release_texture(&d3d12->luts[i]); + + memset(d3d12->luts, 0, sizeof(d3d12->luts)); + + free(d3d12->shader_preset); + d3d12->shader_preset = NULL; + d3d12->init_history = false; + d3d12->resize_render_targets = false; +} + +static bool d3d12_gfx_set_shader(void* data, enum rarch_shader_type type, const char* path) +{ +#if defined(HAVE_SLANG) && defined(HAVE_SPIRV_CROSS) + unsigned i; + d3d12_texture_t* source; + d3d12_video_t* d3d12 = (d3d12_video_t*)data; + + if (!d3d12) + return false; + + d3d12_free_shader_preset(d3d12); + + if (!path) + return true; + + if (type != RARCH_SHADER_SLANG) + { + RARCH_WARN("Only .slang or .slangp shaders are supported. Falling back to stock.\n"); + return false; + } + + config_file_t* conf = config_file_new(path); + + if (!conf) + return false; + + d3d12->shader_preset = (struct video_shader*)calloc(1, sizeof(*d3d12->shader_preset)); + + if (!video_shader_read_conf_cgp(conf, d3d12->shader_preset)) + goto error; + + video_shader_resolve_relative(d3d12->shader_preset, path); + + source = &d3d12->frame.texture[0]; + for (i = 0; i < d3d12->shader_preset->passes; source = &d3d12->pass[i++].rt) + { + unsigned j; + /* clang-format off */ + semantics_map_t semantics_map = { + { + /* Original */ + { &d3d12->frame.texture[0], 0, + &d3d12->frame.texture[0].size_data, 0, + &d3d12->pass[i].sampler, 0 }, + + /* Source */ + { source, 0, + &source->size_data, 0, + &d3d12->pass[i].sampler, 0 }, + + /* OriginalHistory */ + { &d3d12->frame.texture[0], sizeof(*d3d12->frame.texture), + &d3d12->frame.texture[0].size_data, sizeof(*d3d12->frame.texture), + &d3d12->pass[i].sampler, 0 }, + + /* PassOutput */ + { &d3d12->pass[0].rt, sizeof(*d3d12->pass), + &d3d12->pass[0].rt.size_data, sizeof(*d3d12->pass), + &d3d12->pass[i].sampler, 0 }, + + /* PassFeedback */ + { &d3d12->pass[0].feedback, sizeof(*d3d12->pass), + &d3d12->pass[0].feedback.size_data, sizeof(*d3d12->pass), + &d3d12->pass[i].sampler, 0 }, + + /* User */ + { &d3d12->luts[0], sizeof(*d3d12->luts), + &d3d12->luts[0].size_data, sizeof(*d3d12->luts), + &d3d12->luts[0].sampler, sizeof(*d3d12->luts) }, + }, + { + &d3d12->mvp, /* MVP */ + &d3d12->pass[i].rt.size_data, /* OutputSize */ + &d3d12->frame.output_size, /* FinalViewportSize */ + &d3d12->pass[i].frame_count, /* FrameCount */ + } + }; + /* clang-format on */ + + if (!slang_process( + d3d12->shader_preset, i, RARCH_SHADER_HLSL, 50, &semantics_map, + &d3d12->pass[i].semantics)) + goto error; + + { + D3DBlob vs_code = NULL; + D3DBlob ps_code = NULL; + D3D12_GRAPHICS_PIPELINE_STATE_DESC desc = { d3d12->desc.sl_rootSignature }; + + static const D3D12_INPUT_ELEMENT_DESC inputElementDesc[] = { + { "TEXCOORD", 0, DXGI_FORMAT_R32G32_FLOAT, 0, offsetof(d3d12_vertex_t, position), + D3D12_INPUT_CLASSIFICATION_PER_VERTEX_DATA, 0 }, + { "TEXCOORD", 1, DXGI_FORMAT_R32G32_FLOAT, 0, offsetof(d3d12_vertex_t, texcoord), + D3D12_INPUT_CLASSIFICATION_PER_VERTEX_DATA, 0 }, + }; +#ifdef DEBUG + bool save_hlsl = true; +#else + bool save_hlsl = false; +#endif + static const char vs_ext[] = ".vs.hlsl"; + static const char ps_ext[] = ".ps.hlsl"; + char vs_path[PATH_MAX_LENGTH]; + char ps_path[PATH_MAX_LENGTH]; + const char* slang_path = d3d12->shader_preset->pass[i].source.path; + const char* vs_src = d3d12->shader_preset->pass[i].source.string.vertex; + const char* ps_src = d3d12->shader_preset->pass[i].source.string.fragment; + int base_len = strlen(slang_path) - strlen(".slang"); + + if (base_len <= 0) + base_len = strlen(slang_path); + + strncpy(vs_path, slang_path, base_len); + strncpy(ps_path, slang_path, base_len); + strncpy(vs_path + base_len, vs_ext, sizeof(vs_ext)); + strncpy(ps_path + base_len, ps_ext, sizeof(ps_ext)); + + if (!d3d_compile(vs_src, 0, vs_path, "main", "vs_5_0", &vs_code)) + save_hlsl = true; + if (!d3d_compile(ps_src, 0, ps_path, "main", "ps_5_0", &ps_code)) + save_hlsl = true; + + desc.BlendState.RenderTarget[0] = d3d12_blend_enable_desc; + desc.RTVFormats[0] = glslang_format_to_dxgi(d3d12->pass[i].semantics.format); + desc.PrimitiveTopologyType = D3D12_PRIMITIVE_TOPOLOGY_TYPE_TRIANGLE; + desc.InputLayout.pInputElementDescs = inputElementDesc; + desc.InputLayout.NumElements = countof(inputElementDesc); + + if (!d3d12_init_pipeline( + d3d12->device, vs_code, ps_code, NULL, &desc, &d3d12->pass[i].pipe)) + save_hlsl = true; + + if (save_hlsl) + { + FILE* fp = fopen(vs_path, "w"); + fwrite(vs_src, 1, strlen(vs_src), fp); + fclose(fp); + + fp = fopen(ps_path, "w"); + fwrite(ps_src, 1, strlen(ps_src), fp); + fclose(fp); + } + + free(d3d12->shader_preset->pass[i].source.string.vertex); + free(d3d12->shader_preset->pass[i].source.string.fragment); + + d3d12->shader_preset->pass[i].source.string.vertex = NULL; + d3d12->shader_preset->pass[i].source.string.fragment = NULL; + + Release(vs_code); + Release(ps_code); + + if (!d3d12->pass[i].pipe) + goto error; + + d3d12->pass[i].rt.rt_view.ptr = + d3d12->desc.rtv_heap.cpu.ptr + + (countof(d3d12->chain.renderTargets) + i) * d3d12->desc.rtv_heap.stride; + + d3d12->pass[i].textures.ptr = + d3d12->desc.srv_heap.gpu.ptr + i * SLANG_NUM_SEMANTICS * d3d12->desc.srv_heap.stride; + d3d12->pass[i].samplers.ptr = d3d12->desc.sampler_heap.gpu.ptr + + i * SLANG_NUM_SEMANTICS * d3d12->desc.sampler_heap.stride; + } + + for (j = 0; j < SLANG_CBUFFER_MAX; j++) + { + if (!d3d12->pass[i].semantics.cbuffers[j].size) + continue; + + d3d12->pass[i].buffer_view[j].SizeInBytes = d3d12->pass[i].semantics.cbuffers[j].size; + d3d12->pass[i].buffer_view[j].BufferLocation = d3d12_create_buffer( + d3d12->device, d3d12->pass[i].buffer_view[j].SizeInBytes, + &d3d12->pass[i].buffers[j]); + } + } + + for (i = 0; i < d3d12->shader_preset->luts; i++) + { + struct texture_image image = { 0 }; + image.supports_rgba = true; + + if (!image_texture_load(&image, d3d12->shader_preset->lut[i].path)) + goto error; + + d3d12->luts[i].desc.Width = image.width; + d3d12->luts[i].desc.Height = image.height; + d3d12->luts[i].desc.Format = DXGI_FORMAT_R8G8B8A8_UNORM; + d3d12->luts[i].srv_heap = &d3d12->desc.srv_heap; + + if (d3d12->shader_preset->lut[i].mipmap) + d3d12->luts[i].desc.MipLevels = UINT16_MAX; + + d3d12_init_texture(d3d12->device, &d3d12->luts[i]); + + d3d12_update_texture( + image.width, image.height, 0, DXGI_FORMAT_R8G8B8A8_UNORM, image.pixels, + &d3d12->luts[i]); + + image_texture_free(&image); + + d3d12->luts[i].sampler = + d3d12->samplers[d3d12->shader_preset->lut[i].filter][d3d12->shader_preset->lut[i].wrap]; + } + + video_shader_resolve_current_parameters(conf, d3d12->shader_preset); + config_file_free(conf); + + d3d12->resize_render_targets = true; + d3d12->init_history = true; + + return true; + +error: + d3d12_free_shader_preset(d3d12); +#endif + return false; +} + +static bool d3d12_gfx_init_pipelines(d3d12_video_t* d3d12) +{ + D3DBlob vs_code = NULL; + D3DBlob ps_code = NULL; + D3DBlob gs_code = NULL; + D3DBlob cs_code = NULL; + D3D12_GRAPHICS_PIPELINE_STATE_DESC desc = { d3d12->desc.rootSignature }; + + desc.BlendState.RenderTarget[0] = d3d12_blend_enable_desc; + desc.RTVFormats[0] = DXGI_FORMAT_R8G8B8A8_UNORM; + + { + static const char shader[] = +#include "../drivers/d3d_shaders/opaque_sm5.hlsl.h" + ; + + static const D3D12_INPUT_ELEMENT_DESC inputElementDesc[] = { + { "POSITION", 0, DXGI_FORMAT_R32G32_FLOAT, 0, offsetof(d3d12_vertex_t, position), + D3D12_INPUT_CLASSIFICATION_PER_VERTEX_DATA, 0 }, + { "TEXCOORD", 0, DXGI_FORMAT_R32G32_FLOAT, 0, offsetof(d3d12_vertex_t, texcoord), + D3D12_INPUT_CLASSIFICATION_PER_VERTEX_DATA, 0 }, + { "COLOR", 0, DXGI_FORMAT_R32G32B32A32_FLOAT, 0, offsetof(d3d12_vertex_t, color), + D3D12_INPUT_CLASSIFICATION_PER_VERTEX_DATA, 0 }, + }; + + if (!d3d_compile(shader, sizeof(shader), NULL, "VSMain", "vs_5_0", &vs_code)) + goto error; + if (!d3d_compile(shader, sizeof(shader), NULL, "PSMain", "ps_5_0", &ps_code)) + goto error; + + desc.PrimitiveTopologyType = D3D12_PRIMITIVE_TOPOLOGY_TYPE_TRIANGLE; + desc.InputLayout.pInputElementDescs = inputElementDesc; + desc.InputLayout.NumElements = countof(inputElementDesc); + + if (!d3d12_init_pipeline( + d3d12->device, vs_code, ps_code, NULL, &desc, + &d3d12->pipes[VIDEO_SHADER_STOCK_BLEND])) + goto error; + + Release(vs_code); + Release(ps_code); + vs_code = NULL; + ps_code = NULL; + } + { + static const char shader[] = +#include "d3d_shaders/sprite_sm4.hlsl.h" + ; + + D3D12_INPUT_ELEMENT_DESC inputElementDesc[] = { + { "POSITION", 0, DXGI_FORMAT_R32G32B32A32_FLOAT, 0, offsetof(d3d12_sprite_t, pos), + D3D12_INPUT_CLASSIFICATION_PER_VERTEX_DATA, 0 }, + { "TEXCOORD", 0, DXGI_FORMAT_R32G32B32A32_FLOAT, 0, offsetof(d3d12_sprite_t, coords), + D3D12_INPUT_CLASSIFICATION_PER_VERTEX_DATA, 0 }, + { "COLOR", 0, DXGI_FORMAT_R8G8B8A8_UNORM, 0, offsetof(d3d12_sprite_t, colors[0]), + D3D12_INPUT_CLASSIFICATION_PER_VERTEX_DATA, 0 }, + { "COLOR", 1, DXGI_FORMAT_R8G8B8A8_UNORM, 0, offsetof(d3d12_sprite_t, colors[1]), + D3D12_INPUT_CLASSIFICATION_PER_VERTEX_DATA, 0 }, + { "COLOR", 2, DXGI_FORMAT_R8G8B8A8_UNORM, 0, offsetof(d3d12_sprite_t, colors[2]), + D3D12_INPUT_CLASSIFICATION_PER_VERTEX_DATA, 0 }, + { "COLOR", 3, DXGI_FORMAT_R8G8B8A8_UNORM, 0, offsetof(d3d12_sprite_t, colors[3]), + D3D12_INPUT_CLASSIFICATION_PER_VERTEX_DATA, 0 }, + { "PARAMS", 0, DXGI_FORMAT_R32G32_FLOAT, 0, offsetof(d3d12_sprite_t, params), + D3D12_INPUT_CLASSIFICATION_PER_VERTEX_DATA, 0 }, + }; + + if (!d3d_compile(shader, sizeof(shader), NULL, "VSMain", "vs_5_0", &vs_code)) + goto error; + if (!d3d_compile(shader, sizeof(shader), NULL, "PSMain", "ps_5_0", &ps_code)) + goto error; + if (!d3d_compile(shader, sizeof(shader), NULL, "GSMain", "gs_5_0", &gs_code)) + goto error; + + desc.BlendState.RenderTarget[0].BlendEnable = false; + desc.PrimitiveTopologyType = D3D12_PRIMITIVE_TOPOLOGY_TYPE_POINT; + desc.InputLayout.pInputElementDescs = inputElementDesc; + desc.InputLayout.NumElements = countof(inputElementDesc); + + if (!d3d12_init_pipeline( + d3d12->device, vs_code, ps_code, gs_code, &desc, &d3d12->sprites.pipe_noblend)) + goto error; + + desc.BlendState.RenderTarget[0].BlendEnable = true; + if (!d3d12_init_pipeline( + d3d12->device, vs_code, ps_code, gs_code, &desc, &d3d12->sprites.pipe_blend)) + goto error; + + Release(ps_code); + ps_code = NULL; + + if (!d3d_compile(shader, sizeof(shader), NULL, "PSMainA8", "ps_5_0", &ps_code)) + goto error; + + if (!d3d12_init_pipeline( + d3d12->device, vs_code, ps_code, gs_code, &desc, &d3d12->sprites.pipe_font)) + goto error; + + Release(vs_code); + Release(ps_code); + Release(gs_code); + vs_code = NULL; + ps_code = NULL; + gs_code = NULL; + } + + { + static const char simple_snow[] = +#include "d3d_shaders/simple_snow_sm4.hlsl.h" + ; + static const char snow[] = +#include "d3d_shaders/snow_sm4.hlsl.h" + ; + static const char bokeh[] = +#include "d3d_shaders/bokeh_sm4.hlsl.h" + ; + static const char snowflake[] = +#include "d3d_shaders/snowflake_sm4.hlsl.h" + ; + + D3D12_INPUT_ELEMENT_DESC inputElementDesc[] = { + { "POSITION", 0, DXGI_FORMAT_R32G32_FLOAT, 0, offsetof(d3d12_vertex_t, position), + D3D12_INPUT_CLASSIFICATION_PER_VERTEX_DATA, 0 }, + { "TEXCOORD", 0, DXGI_FORMAT_R32G32_FLOAT, 0, offsetof(d3d12_vertex_t, texcoord), + D3D12_INPUT_CLASSIFICATION_PER_VERTEX_DATA, 0 }, + }; + + desc.PrimitiveTopologyType = D3D12_PRIMITIVE_TOPOLOGY_TYPE_TRIANGLE; + desc.InputLayout.pInputElementDescs = inputElementDesc; + desc.InputLayout.NumElements = countof(inputElementDesc); + + if (!d3d_compile(simple_snow, sizeof(simple_snow), NULL, "VSMain", "vs_5_0", &vs_code)) + goto error; + if (!d3d_compile(simple_snow, sizeof(simple_snow), NULL, "PSMain", "ps_5_0", &ps_code)) + goto error; + + if (!d3d12_init_pipeline( + d3d12->device, vs_code, ps_code, NULL, &desc, &d3d12->pipes[VIDEO_SHADER_MENU_3])) + goto error; + + Release(vs_code); + Release(ps_code); + vs_code = NULL; + ps_code = NULL; + + if (!d3d_compile(snow, sizeof(snow), NULL, "VSMain", "vs_5_0", &vs_code)) + goto error; + if (!d3d_compile(snow, sizeof(snow), NULL, "PSMain", "ps_5_0", &ps_code)) + goto error; + + if (!d3d12_init_pipeline( + d3d12->device, vs_code, ps_code, NULL, &desc, &d3d12->pipes[VIDEO_SHADER_MENU_4])) + goto error; + + Release(vs_code); + Release(ps_code); + vs_code = NULL; + ps_code = NULL; + + if (!d3d_compile(bokeh, sizeof(bokeh), NULL, "VSMain", "vs_5_0", &vs_code)) + goto error; + if (!d3d_compile(bokeh, sizeof(bokeh), NULL, "PSMain", "ps_5_0", &ps_code)) + goto error; + + if (!d3d12_init_pipeline( + d3d12->device, vs_code, ps_code, NULL, &desc, &d3d12->pipes[VIDEO_SHADER_MENU_5])) + goto error; + + Release(vs_code); + Release(ps_code); + vs_code = NULL; + ps_code = NULL; + + if (!d3d_compile(snowflake, sizeof(snowflake), NULL, "VSMain", "vs_5_0", &vs_code)) + goto error; + if (!d3d_compile(snowflake, sizeof(snowflake), NULL, "PSMain", "ps_5_0", &ps_code)) + goto error; + + if (!d3d12_init_pipeline( + d3d12->device, vs_code, ps_code, NULL, &desc, &d3d12->pipes[VIDEO_SHADER_MENU_6])) + goto error; + + Release(vs_code); + Release(ps_code); + vs_code = NULL; + ps_code = NULL; + } + + { + static const char ribbon[] = +#include "d3d_shaders/ribbon_sm4.hlsl.h" + ; + static const char ribbon_simple[] = +#include "d3d_shaders/ribbon_simple_sm4.hlsl.h" + ; + + D3D12_INPUT_ELEMENT_DESC inputElementDesc[] = { + { "POSITION", 0, DXGI_FORMAT_R32G32_FLOAT, 0, 0, + D3D12_INPUT_CLASSIFICATION_PER_VERTEX_DATA, 0 }, + }; + + desc.BlendState.RenderTarget[0].SrcBlend = D3D12_BLEND_ONE; + desc.BlendState.RenderTarget[0].DestBlend = D3D12_BLEND_ONE; + desc.PrimitiveTopologyType = D3D12_PRIMITIVE_TOPOLOGY_TYPE_TRIANGLE; + desc.InputLayout.pInputElementDescs = inputElementDesc; + desc.InputLayout.NumElements = countof(inputElementDesc); + + if (!d3d_compile(ribbon, sizeof(ribbon), NULL, "VSMain", "vs_5_0", &vs_code)) + goto error; + if (!d3d_compile(ribbon, sizeof(ribbon), NULL, "PSMain", "ps_5_0", &ps_code)) + goto error; + + if (!d3d12_init_pipeline( + d3d12->device, vs_code, ps_code, NULL, &desc, &d3d12->pipes[VIDEO_SHADER_MENU])) + goto error; + + Release(vs_code); + Release(ps_code); + vs_code = NULL; + ps_code = NULL; + + if (!d3d_compile(ribbon_simple, sizeof(ribbon_simple), NULL, "VSMain", "vs_5_0", &vs_code)) + goto error; + if (!d3d_compile(ribbon_simple, sizeof(ribbon_simple), NULL, "PSMain", "ps_5_0", &ps_code)) + goto error; + + if (!d3d12_init_pipeline( + d3d12->device, vs_code, ps_code, NULL, &desc, &d3d12->pipes[VIDEO_SHADER_MENU_2])) + goto error; + + Release(vs_code); + Release(ps_code); + vs_code = NULL; + ps_code = NULL; + } + + { + static const char shader[] = +#include "d3d_shaders/mimpapgen_sm5.h" + ; + D3D12_COMPUTE_PIPELINE_STATE_DESC desc = { d3d12->desc.cs_rootSignature }; + if (!d3d_compile(shader, sizeof(shader), NULL, "CSMain", "cs_5_0", &cs_code)) + goto error; + + desc.CS.pShaderBytecode = D3DGetBufferPointer(cs_code); + desc.CS.BytecodeLength = D3DGetBufferSize(cs_code); + if (!D3D12CreateComputePipelineState(d3d12->device, &desc, &d3d12->mipmapgen_pipe)) + + Release(cs_code); + cs_code = NULL; + } + + return true; + +error: + Release(vs_code); + Release(ps_code); + Release(gs_code); + Release(cs_code); + return false; +} + +static void d3d12_gfx_free(void* data) +{ + unsigned i; + d3d12_video_t* d3d12 = (d3d12_video_t*)data; + + if (!d3d12) + return; + + d3d12_free_shader_preset(d3d12); + + font_driver_free_osd(); + + Release(d3d12->sprites.vbo); + Release(d3d12->menu_pipeline_vbo); + + Release(d3d12->frame.ubo); + Release(d3d12->frame.vbo); + Release(d3d12->frame.texture[0].handle); + Release(d3d12->frame.texture[0].upload_buffer); + Release(d3d12->menu.vbo); + Release(d3d12->menu.texture.handle); + Release(d3d12->menu.texture.upload_buffer); + + free(d3d12->desc.sampler_heap.map); + free(d3d12->desc.srv_heap.map); + free(d3d12->desc.rtv_heap.map); + Release(d3d12->desc.sampler_heap.handle); + Release(d3d12->desc.srv_heap.handle); + Release(d3d12->desc.rtv_heap.handle); + + Release(d3d12->desc.cs_rootSignature); + Release(d3d12->desc.sl_rootSignature); + Release(d3d12->desc.rootSignature); + + Release(d3d12->ubo); + + for (i = 0; i < GFX_MAX_SHADERS; i++) + Release(d3d12->pipes[i]); + + Release(d3d12->mipmapgen_pipe); + Release(d3d12->sprites.pipe_blend); + Release(d3d12->sprites.pipe_noblend); + Release(d3d12->sprites.pipe_font); + + Release(d3d12->queue.fence); + Release(d3d12->chain.renderTargets[0]); + Release(d3d12->chain.renderTargets[1]); + Release(d3d12->chain.handle); + + Release(d3d12->queue.cmd); + Release(d3d12->queue.allocator); + Release(d3d12->queue.handle); + + Release(d3d12->factory); + Release(d3d12->device); + Release(d3d12->adapter); + + win32_monitor_from_window(); + win32_destroy_window(); + + free(d3d12); +} + static void* d3d12_gfx_init(const video_info_t* video, const input_driver_t** input, void** input_data) { - WNDCLASSEX wndclass = { 0 }; - settings_t* settings = config_get_ptr(); - d3d12_video_t* d3d12 = (d3d12_video_t*)calloc(1, sizeof(*d3d12)); + WNDCLASSEX wndclass = { 0 }; + MONITORINFOEX current_mon; + HMONITOR hm_to_use; + settings_t* settings = config_get_ptr(); + d3d12_video_t* d3d12 = (d3d12_video_t*)calloc(1, sizeof(*d3d12)); if (!d3d12) return NULL; @@ -93,7 +705,17 @@ d3d12_gfx_init(const video_info_t* video, const input_driver_t** input, void** i wndclass.lpfnWndProc = WndProcD3D; win32_window_init(&wndclass, true, NULL); - if (!win32_set_video_mode(d3d12, video->width, video->height, video->fullscreen)) + win32_monitor_info(¤t_mon, &hm_to_use, &d3d12->cur_mon_id); + + d3d12->vp.full_width = video->width; + d3d12->vp.full_height = video->height; + + if (!d3d12->vp.full_width) + d3d12->vp.full_width = current_mon.rcMonitor.right - current_mon.rcMonitor.left; + if (!d3d12->vp.full_height) + d3d12->vp.full_height = current_mon.rcMonitor.bottom - current_mon.rcMonitor.top; + + if (!win32_set_video_mode(d3d12, d3d12->vp.full_width, d3d12->vp.full_height, video->fullscreen)) { RARCH_ERR("[D3D12]: win32_set_video_mode failed.\n"); goto error; @@ -107,36 +729,41 @@ d3d12_gfx_init(const video_info_t* video, const input_driver_t** input, void** i if (!d3d12_init_descriptors(d3d12)) goto error; - if (!d3d12_init_pipeline(d3d12)) + if (!d3d12_gfx_init_pipelines(d3d12)) goto error; if (!d3d12_init_queue(d3d12)) goto error; - if (!d3d12_init_swapchain(d3d12, video->width, video->height, main_window.hwnd)) + if (!d3d12_init_swapchain(d3d12, d3d12->vp.full_width, d3d12->vp.full_height, main_window.hwnd)) goto error; + d3d12_init_samplers(d3d12); + d3d12_set_filtering(d3d12, 0, video->smooth); + d3d12_create_fullscreen_quad_vbo(d3d12->device, &d3d12->frame.vbo_view, &d3d12->frame.vbo); d3d12_create_fullscreen_quad_vbo(d3d12->device, &d3d12->menu.vbo_view, &d3d12->menu.vbo); - d3d12_set_filtering(d3d12, 0, video->smooth); + d3d12->sprites.capacity = 4096; + d3d12->sprites.vbo_view.SizeInBytes = sizeof(d3d12_sprite_t) * d3d12->sprites.capacity; + d3d12->sprites.vbo_view.StrideInBytes = sizeof(d3d12_sprite_t); + d3d12->sprites.vbo_view.BufferLocation = d3d12_create_buffer( + d3d12->device, d3d12->sprites.vbo_view.SizeInBytes, &d3d12->sprites.vbo); - d3d12->keep_aspect = video->force_aspect; - d3d12->chain.vsync = video->vsync; - d3d12->format = video->rgb32 ? DXGI_FORMAT_B8G8R8X8_UNORM : DXGI_FORMAT_B5G6R5_UNORM; - d3d12->frame.texture.desc.Format = - d3d12_get_closest_match_texture2D(d3d12->device, d3d12->format); - - d3d12->ubo_view.SizeInBytes = sizeof(math_matrix_4x4); + d3d12->ubo_view.SizeInBytes = sizeof(d3d12_uniform_t); d3d12->ubo_view.BufferLocation = d3d12_create_buffer(d3d12->device, d3d12->ubo_view.SizeInBytes, &d3d12->ubo); - d3d12->frame.ubo_view.SizeInBytes = sizeof(math_matrix_4x4); + d3d12->frame.ubo_view.SizeInBytes = sizeof(d3d12_uniform_t); d3d12->frame.ubo_view.BufferLocation = d3d12_create_buffer(d3d12->device, d3d12->frame.ubo_view.SizeInBytes, &d3d12->frame.ubo); matrix_4x4_ortho(d3d12->mvp_no_rot, 0.0f, 1.0f, 0.0f, 1.0f, -1.0f, 1.0f); + d3d12->ubo_values.mvp = d3d12->mvp_no_rot; + d3d12->ubo_values.OutputSize.width = d3d12->chain.viewport.Width; + d3d12->ubo_values.OutputSize.height = d3d12->chain.viewport.Height; + { math_matrix_4x4* mvp; D3D12_RANGE read_range = { 0, 0 }; @@ -146,18 +773,160 @@ d3d12_gfx_init(const video_info_t* video, const input_driver_t** input, void** i } d3d12_gfx_set_rotation(d3d12, 0); - d3d12->vp.full_width = video->width; - d3d12->vp.full_height = video->height; - d3d12->resize_viewport = true; + video_driver_set_size(&d3d12->vp.full_width, &d3d12->vp.full_height); + d3d12->chain.viewport.Width = d3d12->vp.full_width; + d3d12->chain.viewport.Height = d3d12->vp.full_height; + d3d12->resize_viewport = true; + d3d12->keep_aspect = video->force_aspect; + d3d12->chain.vsync = video->vsync; + d3d12->format = video->rgb32 ? DXGI_FORMAT_B8G8R8X8_UNORM : DXGI_FORMAT_B5G6R5_UNORM; + d3d12->frame.texture[0].desc.Format = d3d12->format; + + font_driver_init_osd(d3d12, false, video->is_threaded, FONT_DRIVER_RENDER_D3D12_API); + + if (settings->bools.video_shader_enable) + { + const char* ext = path_get_extension(settings->paths.path_shader); + + if (ext && !strcmp(ext, "slangp")) + d3d12_gfx_set_shader(d3d12, RARCH_SHADER_SLANG, settings->paths.path_shader); + } return d3d12; error: RARCH_ERR("[D3D12]: failed to init video driver.\n"); - free(d3d12); + d3d12_gfx_free(d3d12); return NULL; } +static void d3d12_init_history(d3d12_video_t* d3d12, unsigned width, unsigned height) +{ + unsigned i; + + /* todo: should we init history to max_width/max_height instead ? + * to prevent out of memory errors happening several frames later + * and to reduce memory fragmentation */ + + assert(d3d12->shader_preset); + for (i = 0; i < d3d12->shader_preset->history_size + 1; i++) + { + d3d12->frame.texture[i].desc.Width = width; + d3d12->frame.texture[i].desc.Height = height; + d3d12->frame.texture[i].desc.Format = d3d12->frame.texture[0].desc.Format; + d3d12->frame.texture[i].desc.MipLevels = d3d12->frame.texture[0].desc.MipLevels; + d3d12->frame.texture[i].srv_heap = &d3d12->desc.srv_heap; + d3d12_init_texture(d3d12->device, &d3d12->frame.texture[i]); + /* todo: clear texture ? */ + } + d3d12->init_history = false; +} +static void d3d12_init_render_targets(d3d12_video_t* d3d12, unsigned width, unsigned height) +{ + unsigned i; + + assert(d3d12->shader_preset); + + for (i = 0; i < d3d12->shader_preset->passes; i++) + { + struct video_shader_pass* pass = &d3d12->shader_preset->pass[i]; + + if (pass->fbo.valid) + { + + switch (pass->fbo.type_x) + { + case RARCH_SCALE_INPUT: + width *= pass->fbo.scale_x; + break; + + case RARCH_SCALE_VIEWPORT: + width = d3d12->vp.width * pass->fbo.scale_x; + break; + + case RARCH_SCALE_ABSOLUTE: + width = pass->fbo.abs_x; + break; + + default: + break; + } + + if (!width) + width = d3d12->vp.width; + + switch (pass->fbo.type_y) + { + case RARCH_SCALE_INPUT: + height *= pass->fbo.scale_y; + break; + + case RARCH_SCALE_VIEWPORT: + height = d3d12->vp.height * pass->fbo.scale_y; + break; + + case RARCH_SCALE_ABSOLUTE: + height = pass->fbo.abs_y; + break; + + default: + break; + } + + if (!height) + height = d3d12->vp.height; + } + else if (i == (d3d12->shader_preset->passes - 1)) + { + width = d3d12->vp.width; + height = d3d12->vp.height; + } + + RARCH_LOG("[d3d12]: Updating framebuffer size %u x %u.\n", width, height); + + if ((i != (d3d12->shader_preset->passes - 1)) || (width != d3d12->vp.width) || + (height != d3d12->vp.height)) + { + d3d12->pass[i].viewport.Width = width; + d3d12->pass[i].viewport.Height = height; + d3d12->pass[i].viewport.MaxDepth = 1.0; + d3d12->pass[i].scissorRect.right = width; + d3d12->pass[i].scissorRect.bottom = height; + d3d12->pass[i].rt.desc.Width = width; + d3d12->pass[i].rt.desc.Height = height; + d3d12->pass[i].rt.desc.Flags = D3D12_RESOURCE_FLAG_ALLOW_RENDER_TARGET; + d3d12->pass[i].rt.srv_heap = &d3d12->desc.srv_heap; + d3d12->pass[i].rt.desc.Format = glslang_format_to_dxgi(d3d12->pass[i].semantics.format); + d3d12_init_texture(d3d12->device, &d3d12->pass[i].rt); + + if (pass->feedback) + { + d3d12->pass[i].feedback.desc = d3d12->pass[i].rt.desc; + d3d12->pass[i].feedback.srv_heap = &d3d12->desc.srv_heap; + d3d12_init_texture(d3d12->device, &d3d12->pass[i].feedback); + /* todo: do we need to clear it to black here ? */ + } + } + else + { + d3d12->pass[i].rt.size_data.x = width; + d3d12->pass[i].rt.size_data.y = height; + d3d12->pass[i].rt.size_data.z = 1.0f / width; + d3d12->pass[i].rt.size_data.w = 1.0f / height; + } + + d3d12->pass[i].sampler = d3d12->samplers[pass->filter][pass->wrap]; + } + + d3d12->resize_render_targets = false; + +#if 0 +error: + d3d12_free_shader_preset(d3d12); + return false; +#endif +} + static bool d3d12_gfx_frame( void* data, const void* frame, @@ -168,7 +937,9 @@ static bool d3d12_gfx_frame( const char* msg, video_frame_info_t* video_info) { - d3d12_video_t* d3d12 = (d3d12_video_t*)data; + unsigned i; + d3d12_texture_t* texture = NULL; + d3d12_video_t* d3d12 = (d3d12_video_t*)data; if (d3d12->resize_chain) { @@ -177,7 +948,7 @@ static bool d3d12_gfx_frame( for (i = 0; i < countof(d3d12->chain.renderTargets); i++) Release(d3d12->chain.renderTargets[i]); - DXGIResizeBuffers(d3d12->chain.handle, 0, 0, 0, 0, 0); + DXGIResizeBuffers(d3d12->chain.handle, 0, 0, 0, DXGI_FORMAT_UNKNOWN, 0); for (i = 0; i < countof(d3d12->chain.renderTargets); i++) { @@ -187,21 +958,233 @@ static bool d3d12_gfx_frame( } d3d12->chain.frame_index = DXGIGetCurrentBackBufferIndex(d3d12->chain.handle); - d3d12->resize_chain = false; - d3d12->resize_viewport = true; + + d3d12->chain.viewport.Width = video_info->width; + d3d12->chain.viewport.Height = video_info->height; + d3d12->chain.scissorRect.right = video_info->width; + d3d12->chain.scissorRect.bottom = video_info->height; + d3d12->resize_chain = false; + d3d12->resize_viewport = true; + + d3d12->ubo_values.OutputSize.width = d3d12->chain.viewport.Width; + d3d12->ubo_values.OutputSize.height = d3d12->chain.viewport.Height; + + video_driver_set_size(&video_info->width, &video_info->height); } PERF_START(); D3D12ResetCommandAllocator(d3d12->queue.allocator); - D3D12ResetGraphicsCommandList(d3d12->queue.cmd, d3d12->queue.allocator, d3d12->pipe.handle); - D3D12SetGraphicsRootSignature(d3d12->queue.cmd, d3d12->pipe.rootSignature); + D3D12ResetGraphicsCommandList( + d3d12->queue.cmd, d3d12->queue.allocator, d3d12->pipes[VIDEO_SHADER_STOCK_BLEND]); + { - D3D12DescriptorHeap desc_heaps[] = { d3d12->pipe.srv_heap.handle, - d3d12->pipe.sampler_heap.handle }; + D3D12DescriptorHeap desc_heaps[] = { d3d12->desc.srv_heap.handle, + d3d12->desc.sampler_heap.handle }; D3D12SetDescriptorHeaps(d3d12->queue.cmd, countof(desc_heaps), desc_heaps); } +#if 0 /* custom viewport doesn't call apply_state_changes, so we can't rely on this for now */ + if (d3d12->resize_viewport) +#endif + d3d12_update_viewport(d3d12, false); + + D3D12IASetPrimitiveTopology(d3d12->queue.cmd, D3D_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP); + + if (data && width && height) + { + if (d3d12->shader_preset) + { + if (d3d12->frame.texture[0].desc.Width != width || + d3d12->frame.texture[0].desc.Height != height) + d3d12->resize_render_targets = true; + + if (d3d12->resize_render_targets) + { + /* release all render targets first to avoid memory fragmentation */ + for (i = 0; i < d3d12->shader_preset->passes; i++) + d3d12_release_texture(&d3d12->pass[i].rt); + } + + if (d3d12->shader_preset->history_size) + { + if (d3d12->init_history) + d3d12_init_history(d3d12, width, height); + else + { + int k; + /* todo: what about frame-duping ? + * maybe clone d3d12_texture_t with AddRef */ + d3d12_texture_t tmp = d3d12->frame.texture[d3d12->shader_preset->history_size]; + for (k = d3d12->shader_preset->history_size; k > 0; k--) + d3d12->frame.texture[k] = d3d12->frame.texture[k - 1]; + d3d12->frame.texture[0] = tmp; + } + } + } + + /* either no history, or we moved a texture of a different size in the front slot */ + if (d3d12->frame.texture[0].desc.Width != width || + d3d12->frame.texture[0].desc.Height != height) + { + d3d12->frame.texture[0].desc.Width = width; + d3d12->frame.texture[0].desc.Height = height; + d3d12->frame.texture[0].srv_heap = &d3d12->desc.srv_heap; + d3d12_init_texture(d3d12->device, &d3d12->frame.texture[0]); + } + + if (d3d12->resize_render_targets) + d3d12_init_render_targets(d3d12, width, height); + + d3d12_update_texture(width, height, pitch, d3d12->format, frame, &d3d12->frame.texture[0]); + + d3d12_upload_texture(d3d12->queue.cmd, &d3d12->frame.texture[0]); + } + D3D12IASetVertexBuffers(d3d12->queue.cmd, 0, 1, &d3d12->frame.vbo_view); + + texture = d3d12->frame.texture; + + if (d3d12->shader_preset) + { + D3D12SetGraphicsRootSignature(d3d12->queue.cmd, d3d12->desc.sl_rootSignature); + + for (i = 0; i < d3d12->shader_preset->passes; i++) + { + if (d3d12->shader_preset->pass[i].feedback) + { + d3d12_texture_t tmp = d3d12->pass[i].feedback; + d3d12->pass[i].feedback = d3d12->pass[i].rt; + d3d12->pass[i].rt = tmp; + } + } + + for (i = 0; i < d3d12->shader_preset->passes; i++) + { + unsigned j; + + D3D12SetPipelineState(d3d12->queue.cmd, d3d12->pass[i].pipe); + + if (d3d12->shader_preset->pass[i].frame_count_mod) + d3d12->pass[i].frame_count = + frame_count % d3d12->shader_preset->pass[i].frame_count_mod; + else + d3d12->pass[i].frame_count = frame_count; + + for (j = 0; j < SLANG_CBUFFER_MAX; j++) + { + cbuffer_sem_t* buffer_sem = &d3d12->pass[i].semantics.cbuffers[j]; + + if (buffer_sem->stage_mask && buffer_sem->uniforms) + { + D3D12_RANGE range = { 0, 0 }; + uint8_t* mapped_data = NULL; + uniform_sem_t* uniform = buffer_sem->uniforms; + + D3D12Map(d3d12->pass[i].buffers[j], 0, &range, (void**)&mapped_data); + while (uniform->size) + { + if (uniform->data) + memcpy(mapped_data + uniform->offset, uniform->data, uniform->size); + uniform++; + } + D3D12Unmap(d3d12->pass[i].buffers[j], 0, NULL); + + D3D12SetGraphicsRootConstantBufferView( + d3d12->queue.cmd, j == SLANG_CBUFFER_UBO ? ROOT_ID_UBO : ROOT_ID_PC, + d3d12->pass[i].buffer_view[j].BufferLocation); + } + } +#if 0 + D3D12OMSetRenderTargets(d3d12->queue.cmd, 1, NULL, FALSE, NULL); +#endif + + { + texture_sem_t* texture_sem = d3d12->pass[i].semantics.textures; + while (texture_sem->stage_mask) + { + { + D3D12_CPU_DESCRIPTOR_HANDLE handle = { + d3d12->pass[i].textures.ptr - d3d12->desc.srv_heap.gpu.ptr + + d3d12->desc.srv_heap.cpu.ptr + + texture_sem->binding * d3d12->desc.srv_heap.stride + }; + d3d12_texture_t* tex = texture_sem->texture_data; + D3D12_SHADER_RESOURCE_VIEW_DESC desc = { tex->desc.Format }; + + desc.Shader4ComponentMapping = D3D12_DEFAULT_SHADER_4_COMPONENT_MAPPING; + desc.ViewDimension = D3D12_SRV_DIMENSION_TEXTURE2D; + desc.Texture2D.MipLevels = tex->desc.MipLevels; + + D3D12CreateShaderResourceView(d3d12->device, tex->handle, &desc, handle); + } + + { + D3D12_CPU_DESCRIPTOR_HANDLE handle = { + d3d12->pass[i].samplers.ptr - d3d12->desc.sampler_heap.gpu.ptr + + d3d12->desc.sampler_heap.cpu.ptr + + texture_sem->binding * d3d12->desc.sampler_heap.stride + }; + D3D12_SAMPLER_DESC desc = { D3D12_FILTER_MIN_MAG_MIP_POINT }; + desc.MaxAnisotropy = 1; + desc.ComparisonFunc = D3D12_COMPARISON_FUNC_NEVER; + desc.MinLOD = -D3D12_FLOAT32_MAX; + desc.MaxLOD = D3D12_FLOAT32_MAX; + desc.AddressU = D3D12_TEXTURE_ADDRESS_MODE_BORDER; + desc.AddressV = desc.AddressU; + desc.AddressW = desc.AddressU; + desc.Filter = D3D12_FILTER_MIN_MAG_MIP_LINEAR; + + D3D12CreateSampler(d3d12->device, &desc, handle); + } + + texture_sem++; + } + + D3D12SetGraphicsRootDescriptorTable( + d3d12->queue.cmd, ROOT_ID_TEXTURE_T, d3d12->pass[i].textures); + D3D12SetGraphicsRootDescriptorTable( + d3d12->queue.cmd, ROOT_ID_SAMPLER_T, d3d12->pass[i].samplers); + } + + if (d3d12->pass[i].rt.handle) + { + d3d12_resource_transition( + d3d12->queue.cmd, d3d12->pass[i].rt.handle, + D3D12_RESOURCE_STATE_PIXEL_SHADER_RESOURCE, D3D12_RESOURCE_STATE_RENDER_TARGET); + + D3D12OMSetRenderTargets(d3d12->queue.cmd, 1, &d3d12->pass[i].rt.rt_view, FALSE, NULL); +#if 0 + D3D12ClearRenderTargetView( + d3d12->queue.cmd, d3d12->pass[i].rt.rt_view, d3d12->chain.clearcolor, 0, NULL); +#endif + D3D12RSSetViewports(d3d12->queue.cmd, 1, &d3d12->pass[i].viewport); + D3D12RSSetScissorRects(d3d12->queue.cmd, 1, &d3d12->pass[i].scissorRect); + + D3D12DrawInstanced(d3d12->queue.cmd, 4, 1, 0, 0); + + d3d12_resource_transition( + d3d12->queue.cmd, d3d12->pass[i].rt.handle, D3D12_RESOURCE_STATE_RENDER_TARGET, + D3D12_RESOURCE_STATE_PIXEL_SHADER_RESOURCE); + texture = &d3d12->pass[i].rt; + } + else + { + texture = NULL; + break; + } + } + } + + if (texture) + { + D3D12SetPipelineState(d3d12->queue.cmd, d3d12->pipes[VIDEO_SHADER_STOCK_BLEND]); + D3D12SetGraphicsRootSignature(d3d12->queue.cmd, d3d12->desc.rootSignature); + d3d12_set_texture(d3d12->queue.cmd, &d3d12->frame.texture[0]); + d3d12_set_sampler(d3d12->queue.cmd, d3d12->samplers[RARCH_FILTER_UNSPEC][RARCH_WRAP_DEFAULT]); + D3D12SetGraphicsRootConstantBufferView( + d3d12->queue.cmd, ROOT_ID_UBO, d3d12->frame.ubo_view.BufferLocation); + } + d3d12_resource_transition( d3d12->queue.cmd, d3d12->chain.renderTargets[d3d12->chain.frame_index], D3D12_RESOURCE_STATE_PRESENT, D3D12_RESOURCE_STATE_RENDER_TARGET); @@ -212,43 +1195,21 @@ static bool d3d12_gfx_frame( d3d12->queue.cmd, d3d12->chain.desc_handles[d3d12->chain.frame_index], d3d12->chain.clearcolor, 0, NULL); - D3D12IASetPrimitiveTopology(d3d12->queue.cmd, D3D_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP); - if (data && width && height) - { - if (d3d12->frame.texture.desc.Width != width || d3d12->frame.texture.desc.Height != height) - { - d3d12->frame.texture.desc.Width = width; - d3d12->frame.texture.desc.Height = height; - d3d12_init_texture( - d3d12->device, &d3d12->pipe.srv_heap, SRV_HEAP_SLOT_FRAME_TEXTURE, - &d3d12->frame.texture); - } - d3d12_update_texture(width, height, pitch, d3d12->format, frame, &d3d12->frame.texture); - - d3d12_upload_texture(d3d12->queue.cmd, &d3d12->frame.texture); - } -#if 0 /* custom viewport doesn't call apply_state_changes, so we can't rely on this for now */ - if (d3d12->resize_viewport) -#endif - d3d12_update_viewport(d3d12, false); - D3D12RSSetViewports(d3d12->queue.cmd, 1, &d3d12->frame.viewport); D3D12RSSetScissorRects(d3d12->queue.cmd, 1, &d3d12->frame.scissorRect); - D3D12SetGraphicsRootConstantBufferView( - d3d12->queue.cmd, ROOT_INDEX_UBO, d3d12->frame.ubo_view.BufferLocation); - d3d12_set_texture(d3d12->queue.cmd, &d3d12->frame.texture); - d3d12_set_sampler(d3d12->queue.cmd, d3d12->frame.sampler); - D3D12IASetVertexBuffers(d3d12->queue.cmd, 0, 1, &d3d12->frame.vbo_view); D3D12DrawInstanced(d3d12->queue.cmd, 4, 1, 0, 0); + D3D12SetPipelineState(d3d12->queue.cmd, d3d12->pipes[VIDEO_SHADER_STOCK_BLEND]); + D3D12SetGraphicsRootSignature(d3d12->queue.cmd, d3d12->desc.rootSignature); + if (d3d12->menu.enabled && d3d12->menu.texture.handle) { if (d3d12->menu.texture.dirty) d3d12_upload_texture(d3d12->queue.cmd, &d3d12->menu.texture); D3D12SetGraphicsRootConstantBufferView( - d3d12->queue.cmd, ROOT_INDEX_UBO, d3d12->ubo_view.BufferLocation); + d3d12->queue.cmd, ROOT_ID_UBO, d3d12->ubo_view.BufferLocation); if (d3d12->menu.fullscreen) { @@ -256,17 +1217,35 @@ static bool d3d12_gfx_frame( D3D12RSSetScissorRects(d3d12->queue.cmd, 1, &d3d12->chain.scissorRect); } - d3d12_set_texture(d3d12->queue.cmd, &d3d12->menu.texture); - d3d12_set_sampler(d3d12->queue.cmd, d3d12->menu.sampler); + d3d12_set_texture_and_sampler(d3d12->queue.cmd, &d3d12->menu.texture); D3D12IASetVertexBuffers(d3d12->queue.cmd, 0, 1, &d3d12->menu.vbo_view); D3D12DrawInstanced(d3d12->queue.cmd, 4, 1, 0, 0); } + D3D12RSSetViewports(d3d12->queue.cmd, 1, &d3d12->chain.viewport); + D3D12RSSetScissorRects(d3d12->queue.cmd, 1, &d3d12->chain.scissorRect); + + d3d12->sprites.pipe = d3d12->sprites.pipe_noblend; + D3D12SetPipelineState(d3d12->queue.cmd, d3d12->sprites.pipe); + D3D12IASetPrimitiveTopology(d3d12->queue.cmd, D3D_PRIMITIVE_TOPOLOGY_POINTLIST); + D3D12IASetVertexBuffers(d3d12->queue.cmd, 0, 1, &d3d12->sprites.vbo_view); + + d3d12->sprites.enabled = true; +#if 1 + if (d3d12->menu.enabled) + menu_driver_frame(video_info); +#endif + if (msg && *msg) + { + font_driver_render_msg(video_info, NULL, msg, NULL); + dxgi_update_title(video_info); + } + d3d12->sprites.enabled = false; + d3d12_resource_transition( d3d12->queue.cmd, d3d12->chain.renderTargets[d3d12->chain.frame_index], D3D12_RESOURCE_STATE_RENDER_TARGET, D3D12_RESOURCE_STATE_PRESENT); D3D12CloseGraphicsCommandList(d3d12->queue.cmd); - D3D12ExecuteGraphicsCommandLists(d3d12->queue.handle, 1, &d3d12->queue.cmd); #if 1 @@ -330,51 +1309,14 @@ static bool d3d12_gfx_has_windowed(void* data) return true; } -static void d3d12_gfx_free(void* data) +static struct video_shader* d3d12_gfx_get_current_shader(void* data) { d3d12_video_t* d3d12 = (d3d12_video_t*)data; - Release(d3d12->frame.ubo); - Release(d3d12->frame.vbo); - Release(d3d12->frame.texture.handle); - Release(d3d12->frame.texture.upload_buffer); - Release(d3d12->menu.vbo); - Release(d3d12->menu.texture.handle); - Release(d3d12->menu.texture.upload_buffer); + if (!d3d12) + return NULL; - Release(d3d12->ubo); - Release(d3d12->pipe.sampler_heap.handle); - Release(d3d12->pipe.srv_heap.handle); - Release(d3d12->pipe.rtv_heap.handle); - Release(d3d12->pipe.rootSignature); - Release(d3d12->pipe.handle); - - Release(d3d12->queue.fence); - Release(d3d12->chain.renderTargets[0]); - Release(d3d12->chain.renderTargets[1]); - Release(d3d12->chain.handle); - - Release(d3d12->queue.cmd); - Release(d3d12->queue.allocator); - Release(d3d12->queue.handle); - - Release(d3d12->factory); - Release(d3d12->device); - Release(d3d12->adapter); - - win32_monitor_from_window(); - win32_destroy_window(); - - free(d3d12); -} - -static bool d3d12_gfx_set_shader(void* data, enum rarch_shader_type type, const char* path) -{ - (void)data; - (void)type; - (void)path; - - return false; + return d3d12->shader_preset; } static void d3d12_gfx_viewport_info(void* data, struct video_viewport* vp) @@ -395,17 +1337,18 @@ static bool d3d12_gfx_read_viewport(void* data, uint8_t* buffer, bool is_idle) static void d3d12_set_menu_texture_frame( void* data, const void* frame, bool rgb32, unsigned width, unsigned height, float alpha) { - d3d12_video_t* d3d12 = (d3d12_video_t*)data; - int pitch = width * (rgb32 ? sizeof(uint32_t) : sizeof(uint16_t)); - DXGI_FORMAT format = rgb32 ? DXGI_FORMAT_B8G8R8A8_UNORM : DXGI_FORMAT_EX_A4R4G4B4_UNORM; + d3d12_video_t* d3d12 = (d3d12_video_t*)data; + int pitch = width * (rgb32 ? sizeof(uint32_t) : sizeof(uint16_t)); + DXGI_FORMAT format = + rgb32 ? DXGI_FORMAT_B8G8R8A8_UNORM : (DXGI_FORMAT)DXGI_FORMAT_EX_A4R4G4B4_UNORM; if (d3d12->menu.texture.desc.Width != width || d3d12->menu.texture.desc.Height != height) { d3d12->menu.texture.desc.Width = width; d3d12->menu.texture.desc.Height = height; - d3d12->menu.texture.desc.Format = d3d12_get_closest_match_texture2D(d3d12->device, format); - d3d12_init_texture( - d3d12->device, &d3d12->pipe.srv_heap, SRV_HEAP_SLOT_MENU_TEXTURE, &d3d12->menu.texture); + d3d12->menu.texture.desc.Format = format; + d3d12->menu.texture.srv_heap = &d3d12->desc.srv_heap; + d3d12_init_texture(d3d12->device, &d3d12->menu.texture); } d3d12_update_texture(width, height, pitch, format, frame, &d3d12->menu.texture); @@ -423,8 +1366,10 @@ static void d3d12_set_menu_texture_frame( v[3].color[3] = alpha; D3D12Unmap(d3d12->menu.vbo, 0, NULL); } - d3d12->menu.sampler = config_get_ptr()->bools.menu_linear_filter ? d3d12->sampler_linear - : d3d12->sampler_nearest; + + d3d12->menu.texture.sampler = config_get_ptr()->bools.menu_linear_filter + ? d3d12->samplers[RARCH_FILTER_LINEAR][RARCH_WRAP_DEFAULT] + : d3d12->samplers[RARCH_FILTER_NEAREST][RARCH_WRAP_DEFAULT]; } static void d3d12_set_menu_texture_enable(void* data, bool state, bool full_screen) { @@ -453,11 +1398,77 @@ static void d3d12_gfx_apply_state_changes(void* data) d3d12->resize_viewport = true; } +static void d3d12_gfx_set_osd_msg( + void* data, video_frame_info_t* video_info, const char* msg, const void* params, void* font) +{ + d3d12_video_t* d3d12 = (d3d12_video_t*)data; + + if (d3d12) + { + if (d3d12->sprites.enabled) + font_driver_render_msg(video_info, font, msg, params); + else + printf("OSD msg: %s\n", msg); + } +} + +static uintptr_t d3d12_gfx_load_texture( + void* video_data, void* data, bool threaded, enum texture_filter_type filter_type) +{ + d3d12_texture_t* texture = NULL; + d3d12_video_t* d3d12 = (d3d12_video_t*)video_data; + struct texture_image* image = (struct texture_image*)data; + + if (!d3d12) + return 0; + + texture = (d3d12_texture_t*)calloc(1, sizeof(*texture)); + + if (!texture) + return 0; + + switch (filter_type) + { + case TEXTURE_FILTER_MIPMAP_LINEAR: + texture->desc.MipLevels = UINT16_MAX; + case TEXTURE_FILTER_LINEAR: + texture->sampler = d3d12->samplers[RARCH_FILTER_LINEAR][RARCH_WRAP_EDGE]; + break; + case TEXTURE_FILTER_MIPMAP_NEAREST: + texture->desc.MipLevels = UINT16_MAX; + case TEXTURE_FILTER_NEAREST: + texture->sampler = d3d12->samplers[RARCH_FILTER_NEAREST][RARCH_WRAP_EDGE]; + break; + } + + texture->desc.Width = image->width; + texture->desc.Height = image->height; + texture->desc.Format = DXGI_FORMAT_B8G8R8A8_UNORM; + texture->srv_heap = &d3d12->desc.srv_heap; + + d3d12_init_texture(d3d12->device, texture); + + d3d12_update_texture( + image->width, image->height, 0, DXGI_FORMAT_B8G8R8A8_UNORM, image->pixels, texture); + + return (uintptr_t)texture; +} +static void d3d12_gfx_unload_texture(void* data, uintptr_t handle) +{ + d3d12_texture_t* texture = (d3d12_texture_t*)handle; + + if (!texture) + return; + + d3d12_release_texture(texture); + free(texture); +} + static const video_poke_interface_t d3d12_poke_interface = { NULL, /* set_coords */ NULL, /* set_mvp */ - NULL, /* load_texture */ - NULL, /* unload_texture */ + d3d12_gfx_load_texture, + d3d12_gfx_unload_texture, NULL, /* set_video_mode */ d3d12_set_filtering, NULL, /* get_video_output_size */ @@ -469,10 +1480,10 @@ static const video_poke_interface_t d3d12_poke_interface = { d3d12_gfx_apply_state_changes, d3d12_set_menu_texture_frame, d3d12_set_menu_texture_enable, - NULL, /* set_osd_msg */ + d3d12_gfx_set_osd_msg, NULL, /* show_mouse */ NULL, /* grab_mouse_toggle */ - NULL, /* get_current_shader */ + d3d12_gfx_get_current_shader, NULL, /* get_current_software_framebuffer */ NULL, /* get_hw_render_interface */ }; diff --git a/gfx/drivers/d3d8.c b/gfx/drivers/d3d8.c index 7b97ac019e..5577878ca4 100644 --- a/gfx/drivers/d3d8.c +++ b/gfx/drivers/d3d8.c @@ -1647,14 +1647,15 @@ static void d3d8_set_menu_texture_enable(void *data, d3d->menu->fullscreen = full_screen; } -static void d3d8_video_texture_load_d3d(d3d_video_t *d3d, - struct texture_image *ti, - enum texture_filter_type filter_type, +static void d3d8_video_texture_load_d3d( + struct d3d9_texture_info *info, uintptr_t *id) { D3DLOCKED_RECT d3dlr; - unsigned usage = 0; - LPDIRECT3DTEXTURE8 tex = (LPDIRECT3DTEXTURE8)d3d_texture_new(d3d->dev, NULL, + unsigned usage = 0; + d3d_video_t *d3d = (d3d_video_t*)info->userdata; + struct texture_image *ti = (struct texture_image*)info->data; + LPDIRECT3DTEXTURE8 tex = (LPDIRECT3DTEXTURE8)d3d_texture_new(d3d->dev, NULL, ti->width, ti->height, 0, usage, d3d_get_argb8888_format(), D3DPOOL_MANAGED, 0, 0, 0, @@ -1685,8 +1686,10 @@ static void d3d8_video_texture_load_d3d(d3d_video_t *d3d, static int d3d8_video_texture_load_wrap_d3d(void *data) { uintptr_t id = 0; - d3d8_video_texture_load_d3d((d3d_video_t*)video_driver_get_ptr(true), - (struct texture_image*)data, TEXTURE_FILTER_LINEAR, &id); + struct d3d8_texture_info *info = (struct d3d8_texture_info*)data; + if (!info) + return 0; + d3d8_video_texture_load_d3d(info, &id); return id; } @@ -1694,15 +1697,17 @@ static uintptr_t d3d8_load_texture(void *video_data, void *data, bool threaded, enum texture_filter_type filter_type) { uintptr_t id = 0; + struct d3d8_texture_info info; + + info.userdata = video_data; + info.data = data; + info.type = filter_type; if (threaded) - { - custom_command_method_t func = d3d8_video_texture_load_wrap_d3d; - return video_thread_texture_load(data, func); - } + return video_thread_texture_load(&info, + d3d8_video_texture_load_wrap_d3d); - d3d8_video_texture_load_d3d((d3d_video_t*)video_driver_get_ptr(false), - (struct texture_image*)data, filter_type, &id); + d3d8_video_texture_load_d3d(&info, &id); return id; } diff --git a/gfx/drivers/d3d9.c b/gfx/drivers/d3d9.c index 8a0c81cf83..51bd2fda4d 100644 --- a/gfx/drivers/d3d9.c +++ b/gfx/drivers/d3d9.c @@ -56,6 +56,7 @@ #include "../../core.h" #include "../../verbosity.h" +#include "../../retroarch.h" static LPDIRECT3D9 g_pD3D9; @@ -331,11 +332,7 @@ static void d3d9_set_mvp(void *data, const void *mat_data) { d3d_video_t *d3d = (d3d_video_t*)data; - - if ( d3d && - d3d->renderchain_driver && - d3d->renderchain_driver->set_mvp) - d3d->renderchain_driver->set_mvp(d3d, d3d->renderchain_data, shader_data, mat_data); + d3d_set_vertex_shader_constantf(d3d->dev, 0, (const float*)mat_data, 4); } static void d3d9_overlay_render(d3d_video_t *d3d, @@ -1081,7 +1078,7 @@ static bool d3d9_init_internal(d3d_video_t *d3d, if (settings->bools.video_shader_enable) { enum rarch_shader_type type = - video_shader_parse_type(settings->paths.path_shader, + video_shader_parse_type(retroarch_get_shader_preset(), RARCH_SHADER_NONE); switch (type) @@ -1089,8 +1086,8 @@ static bool d3d9_init_internal(d3d_video_t *d3d, case RARCH_SHADER_CG: if (!string_is_empty(d3d->shader_path)) free(d3d->shader_path); - if (!string_is_empty(settings->paths.path_shader)) - d3d->shader_path = strdup(settings->paths.path_shader); + if (!string_is_empty(retroarch_get_shader_preset())) + d3d->shader_path = strdup(retroarch_get_shader_preset()); break; default: break; @@ -1645,18 +1642,29 @@ static void d3d9_set_menu_texture_enable(void *data, d3d->menu->fullscreen = full_screen; } -static void d3d9_video_texture_load_d3d(d3d_video_t *d3d, - struct texture_image *ti, - enum texture_filter_type filter_type, +struct d3d9_texture_info +{ + void *userdata; + void *data; + enum texture_filter_type type; +}; + +static void d3d9_video_texture_load_d3d( + struct d3d9_texture_info *info, uintptr_t *id) { D3DLOCKED_RECT d3dlr; - LPDIRECT3DTEXTURE9 tex = NULL; - unsigned usage = 0; - bool want_mipmap = false; + LPDIRECT3DTEXTURE9 tex = NULL; + unsigned usage = 0; + bool want_mipmap = false; + d3d_video_t *d3d = (d3d_video_t*)info->userdata; + struct texture_image *ti = (struct texture_image*)info->data; - if((filter_type == TEXTURE_FILTER_MIPMAP_LINEAR) || - (filter_type == TEXTURE_FILTER_MIPMAP_NEAREST)) + if (!ti) + return; + + if((info->type == TEXTURE_FILTER_MIPMAP_LINEAR) || + (info->type == TEXTURE_FILTER_MIPMAP_NEAREST)) want_mipmap = true; tex = (LPDIRECT3DTEXTURE9)d3d_texture_new(d3d->dev, NULL, @@ -1687,19 +1695,13 @@ static void d3d9_video_texture_load_d3d(d3d_video_t *d3d, *id = (uintptr_t)tex; } -static int d3d9_video_texture_load_wrap_d3d_mipmap(void *data) -{ - uintptr_t id = 0; - d3d9_video_texture_load_d3d((d3d_video_t*)video_driver_get_ptr(true), - (struct texture_image*)data, TEXTURE_FILTER_MIPMAP_LINEAR, &id); - return id; -} - static int d3d9_video_texture_load_wrap_d3d(void *data) { uintptr_t id = 0; - d3d9_video_texture_load_d3d((d3d_video_t*)video_driver_get_ptr(true), - (struct texture_image*)data, TEXTURE_FILTER_LINEAR, &id); + struct d3d9_texture_info *info = (struct d3d9_texture_info*)data; + if (!info) + return 0; + d3d9_video_texture_load_d3d(info, &id); return id; } @@ -1707,27 +1709,17 @@ static uintptr_t d3d9_load_texture(void *video_data, void *data, bool threaded, enum texture_filter_type filter_type) { uintptr_t id = 0; + struct d3d9_texture_info info; + + info.userdata = video_data; + info.data = data; + info.type = filter_type; if (threaded) - { - custom_command_method_t func = d3d9_video_texture_load_wrap_d3d; + return video_thread_texture_load(&info, + d3d9_video_texture_load_wrap_d3d); - switch (filter_type) - { - case TEXTURE_FILTER_MIPMAP_LINEAR: - case TEXTURE_FILTER_MIPMAP_NEAREST: - func = d3d9_video_texture_load_wrap_d3d_mipmap; - break; - default: - func = d3d9_video_texture_load_wrap_d3d; - break; - } - - return video_thread_texture_load(data, func); - } - - d3d9_video_texture_load_d3d((d3d_video_t*)video_driver_get_ptr(false), - (struct texture_image*)data, filter_type, &id); + d3d9_video_texture_load_d3d(&info, &id); return id; } diff --git a/gfx/drivers/d3d_shaders/bokeh_sm4.hlsl.h b/gfx/drivers/d3d_shaders/bokeh_sm4.hlsl.h index b0a66b9b35..5b79f63040 100644 --- a/gfx/drivers/d3d_shaders/bokeh_sm4.hlsl.h +++ b/gfx/drivers/d3d_shaders/bokeh_sm4.hlsl.h @@ -1,5 +1,5 @@ -#define SRC(src) #src +#define SRC(...) #__VA_ARGS__ SRC( struct UBO { diff --git a/gfx/drivers/d3d_shaders/mimpapgen_sm5.h b/gfx/drivers/d3d_shaders/mimpapgen_sm5.h new file mode 100644 index 0000000000..35632e9981 --- /dev/null +++ b/gfx/drivers/d3d_shaders/mimpapgen_sm5.h @@ -0,0 +1,49 @@ +/* RetroArch - A frontend for libretro. + * Copyright (C) 2014-2018 - Ali Bouhlel + * + * RetroArch is free software: you can redistribute it and/or modify it under the terms + * of the GNU General Public License as published by the Free Software Found- + * ation, either version 3 of the License, or (at your option) any later version. + * + * RetroArch is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR + * PURPOSE. See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with RetroArch. + * If not, see . + */ + +#define SRC(...) #__VA_ARGS__ +SRC( + + Texture2D t0; + RWTexture2D u0; + sampler s0; + + cbuffer CBr + { + uint src_level; + float2 texel_size; + } + + static float w[4]= {0.090845, 0.409155, 0.409155, 0.090845}; + [numthreads(8, 8, 1)] + void CSMain(uint3 DTid : SV_DispatchThreadID) + { + int i; + int j; + float4 c = 0.0f; + for (i = 0; i < 4; i++) + for (j = 0; j < 4; j++) + { + float4 c0 = t0.SampleLevel(s0, texel_size * (DTid.xy + 0.5f * float2(i - 0.5f,j - 0.5f)), src_level); + c0.rgb *= c0.a; + c += w[i] * w[j] * c0; + } + c.rgb /= c.a; + + u0[DTid.xy] = c; + return; + + } +) diff --git a/gfx/drivers/d3d_shaders/opaque_sm5.hlsl.h b/gfx/drivers/d3d_shaders/opaque_sm5.hlsl.h index 8822347900..a8a01d0fb7 100644 --- a/gfx/drivers/d3d_shaders/opaque_sm5.hlsl.h +++ b/gfx/drivers/d3d_shaders/opaque_sm5.hlsl.h @@ -1,5 +1,5 @@ -#define SRC(src) #src +#define SRC(...) #__VA_ARGS__ SRC( struct UBO { diff --git a/gfx/drivers/d3d_shaders/ribbon_simple_sm4.hlsl.h b/gfx/drivers/d3d_shaders/ribbon_simple_sm4.hlsl.h index 22b1f11d36..fe5347f82e 100644 --- a/gfx/drivers/d3d_shaders/ribbon_simple_sm4.hlsl.h +++ b/gfx/drivers/d3d_shaders/ribbon_simple_sm4.hlsl.h @@ -1,5 +1,5 @@ -#define SRC(src) #src +#define SRC(...) #__VA_ARGS__ SRC( struct UBO diff --git a/gfx/drivers/d3d_shaders/ribbon_sm4.hlsl.h b/gfx/drivers/d3d_shaders/ribbon_sm4.hlsl.h index f50f725d2e..e0cbc223de 100644 --- a/gfx/drivers/d3d_shaders/ribbon_sm4.hlsl.h +++ b/gfx/drivers/d3d_shaders/ribbon_sm4.hlsl.h @@ -1,5 +1,5 @@ -#define SRC(src) #src +#define SRC(...) #__VA_ARGS__ SRC( struct PSInput diff --git a/gfx/drivers/d3d_shaders/simple_snow_sm4.hlsl.h b/gfx/drivers/d3d_shaders/simple_snow_sm4.hlsl.h index c26eaedf15..ba919266fd 100644 --- a/gfx/drivers/d3d_shaders/simple_snow_sm4.hlsl.h +++ b/gfx/drivers/d3d_shaders/simple_snow_sm4.hlsl.h @@ -1,5 +1,5 @@ -#define SRC(src) #src +#define SRC(...) #__VA_ARGS__ SRC( struct UBO { diff --git a/gfx/drivers/d3d_shaders/snow_sm4.hlsl.h b/gfx/drivers/d3d_shaders/snow_sm4.hlsl.h index 3b53bbf978..fd42e1425d 100644 --- a/gfx/drivers/d3d_shaders/snow_sm4.hlsl.h +++ b/gfx/drivers/d3d_shaders/snow_sm4.hlsl.h @@ -1,5 +1,5 @@ -#define SRC(src) #src +#define SRC(...) #__VA_ARGS__ SRC( struct UBO { diff --git a/gfx/drivers/d3d_shaders/snowflake_sm4.hlsl.h b/gfx/drivers/d3d_shaders/snowflake_sm4.hlsl.h index 899dfd642c..c02908e442 100644 --- a/gfx/drivers/d3d_shaders/snowflake_sm4.hlsl.h +++ b/gfx/drivers/d3d_shaders/snowflake_sm4.hlsl.h @@ -1,5 +1,5 @@ -#define SRC(src) #src +#define SRC(...) #__VA_ARGS__ SRC( struct UBO { diff --git a/gfx/drivers/d3d_shaders/sprite_sm4.hlsl.h b/gfx/drivers/d3d_shaders/sprite_sm4.hlsl.h index 7330bbf507..1a5feefbe7 100644 --- a/gfx/drivers/d3d_shaders/sprite_sm4.hlsl.h +++ b/gfx/drivers/d3d_shaders/sprite_sm4.hlsl.h @@ -1,5 +1,5 @@ -#define SRC(src) #src +#define SRC(...) #__VA_ARGS__ SRC( struct VSInput diff --git a/gfx/drivers/gl.c b/gfx/drivers/gl.c index 48a813a675..a1d521ae01 100644 --- a/gfx/drivers/gl.c +++ b/gfx/drivers/gl.c @@ -379,11 +379,17 @@ static bool gl_shader_init(gl_t *gl, const gfx_ctx_driver_t *ctx_driver, { video_shader_ctx_init_t init_data; settings_t *settings = config_get_ptr(); - const char *shader_path = (settings->bools.video_shader_enable - && *settings->paths.path_shader) ? settings->paths.path_shader : NULL; - enum rarch_shader_type type = video_shader_parse_type(shader_path, + const char *shader_path = retroarch_get_shader_preset(); + enum rarch_shader_type type; + + if (shader_path) + { + type = video_shader_parse_type(shader_path, gl->core_context_in_use ? RARCH_SHADER_GLSL : DEFAULT_SHADER_TYPE); + } + else + type = DEFAULT_SHADER_TYPE; switch (type) { diff --git a/gfx/drivers/gx2_gfx.c b/gfx/drivers/gx2_gfx.c index 79e3320104..61e3c2408d 100644 --- a/gfx/drivers/gx2_gfx.c +++ b/gfx/drivers/gx2_gfx.c @@ -23,6 +23,7 @@ #include "../../driver.h" #include "../../configuration.h" #include "../../verbosity.h" +#include "../../retroarch.h" #ifdef HAVE_CONFIG_H #include "../../config.h" @@ -446,7 +447,7 @@ static void *wiiu_gfx_init(const video_info_t *video, if(settings->bools.video_shader_enable) { - const char* ext = path_get_extension(settings->paths.path_shader); + const char* ext = retroarch_get_shader_preset(); if(ext && !strncmp(ext, "slang", 5)) wiiu_gfx_set_shader(wiiu, RARCH_SHADER_SLANG, settings->paths.path_shader); diff --git a/gfx/drivers/vulkan.c b/gfx/drivers/vulkan.c index afb5d0db8e..5b2de52fa6 100644 --- a/gfx/drivers/vulkan.c +++ b/gfx/drivers/vulkan.c @@ -810,8 +810,7 @@ static bool vulkan_init_filter_chain_preset(vk_t *vk, const char *shader_path) static bool vulkan_init_filter_chain(vk_t *vk) { settings_t *settings = config_get_ptr(); - const char *shader_path = (settings->bools.video_shader_enable && *settings->paths.path_shader) ? - settings->paths.path_shader : NULL; + const char *shader_path = retroarch_get_shader_preset(); enum rarch_shader_type type = video_shader_parse_type(shader_path, RARCH_SHADER_NONE); @@ -1290,8 +1289,9 @@ static bool vulkan_alive(void *data) static bool vulkan_suppress_screensaver(void *data, bool enable) { - (void)data; bool enabled = enable; + (void)data; + return video_context_driver_suppress_screensaver(&enabled); } diff --git a/gfx/drivers_context/x_ctx.c b/gfx/drivers_context/x_ctx.c index a5276d2ba7..48b6a057ae 100644 --- a/gfx/drivers_context/x_ctx.c +++ b/gfx/drivers_context/x_ctx.c @@ -113,6 +113,16 @@ static enum gfx_ctx_api x_api = GFX_CTX_NONE; static gfx_ctx_x_data_t *current_context_data = NULL; +typedef struct Hints +{ + unsigned long flags; + unsigned long functions; + unsigned long decorations; + long inputMode; + unsigned long status; +} Hints; + +/* We use long because X11 wants 32-bit pixels for 32-bit systems and 64 for 64... */ const unsigned long retroarch_icon_data[] = { 16, 16, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, @@ -623,7 +633,6 @@ static bool gfx_ctx_x_set_video_mode(void *data, int (*old_handler)(Display*, XErrorEvent*) = NULL; gfx_ctx_x_data_t *x = (gfx_ctx_x_data_t*)data; Atom net_wm_icon = XInternAtom(g_x11_dpy, "_NET_WM_ICON", False); - Atom net_wm_opacity = XInternAtom(g_x11_dpy, "_NET_WM_WINDOW_OPACITY", False); Atom cardinal = XInternAtom(g_x11_dpy, "CARDINAL", False); settings_t *settings = config_get_ptr(); unsigned opacity = settings->uints.video_window_opacity * ((unsigned)-1 / 100.0); @@ -717,7 +726,23 @@ static bool gfx_ctx_x_set_video_mode(void *data, XChangeProperty(g_x11_dpy, g_x11_win, net_wm_icon, cardinal, 32, PropModeReplace, (const unsigned char*)retroarch_icon_data, sizeof(retroarch_icon_data) / sizeof(*retroarch_icon_data)); if (opacity < (unsigned)-1) + { + Atom net_wm_opacity = XInternAtom(g_x11_dpy, "_NET_WM_WINDOW_OPACITY", False); XChangeProperty(g_x11_dpy, g_x11_win, net_wm_opacity, cardinal, 32, PropModeReplace, (const unsigned char*)&opacity, 1); + } + + if (!settings->bools.video_window_show_decorations) + { + /* We could have just set _NET_WM_WINDOW_TYPE_DOCK instead, but that removes the window from any taskbar/panel, + * so we are forced to use the old motif hints method. */ + Hints hints; + Atom property = XInternAtom(g_x11_dpy, "_MOTIF_WM_HINTS", False); + + hints.flags = 2; + hints.decorations = 0; + + XChangeProperty(g_x11_dpy, g_x11_win, property, property, 32, PropModeReplace, (const unsigned char*)&hints, 5); + } switch (x_api) { diff --git a/gfx/drivers_font/d3d11_font.c b/gfx/drivers_font/d3d11_font.c index 4560b53593..7b75949259 100644 --- a/gfx/drivers_font/d3d11_font.c +++ b/gfx/drivers_font/d3d11_font.c @@ -13,6 +13,8 @@ * If not, see . */ +#define CINTERFACE + #include #include #include @@ -51,13 +53,13 @@ d3d11_font_init_font(void* data, const char* font_path, float font_size, bool is } font->atlas = font->font_driver->get_atlas(font->font_data); - font->texture.sampler = d3d11->sampler_linear; + font->texture.sampler = d3d11->samplers[RARCH_FILTER_LINEAR][RARCH_WRAP_BORDER]; font->texture.desc.Width = font->atlas->width; font->texture.desc.Height = font->atlas->height; font->texture.desc.Format = DXGI_FORMAT_A8_UNORM; d3d11_init_texture(d3d11->device, &font->texture); d3d11_update_texture( - d3d11->ctx, font->atlas->width, font->atlas->height, font->atlas->width, + d3d11->context, font->atlas->width, font->atlas->height, font->atlas->width, DXGI_FORMAT_A8_UNORM, font->atlas->buffer, &font->texture); font->atlas->dirty = false; @@ -151,7 +153,7 @@ static void d3d11_font_render_line( break; } - D3D11MapBuffer(d3d11->ctx, d3d11->sprites.vbo, 0, D3D11_MAP_WRITE_NO_OVERWRITE, 0, &mapped_vbo); + D3D11MapBuffer(d3d11->context, d3d11->sprites.vbo, 0, D3D11_MAP_WRITE_NO_OVERWRITE, 0, &mapped_vbo); v = (d3d11_sprite_t*)mapped_vbo.pData + d3d11->sprites.offset; for (i = 0; i < msg_len; i++) @@ -197,7 +199,7 @@ static void d3d11_font_render_line( } count = v - ((d3d11_sprite_t*)mapped_vbo.pData + d3d11->sprites.offset); - D3D11UnmapBuffer(d3d11->ctx, d3d11->sprites.vbo, 0); + D3D11UnmapBuffer(d3d11->context, d3d11->sprites.vbo, 0); if (!count) return; @@ -205,17 +207,17 @@ static void d3d11_font_render_line( if (font->atlas->dirty) { d3d11_update_texture( - d3d11->ctx, font->atlas->width, font->atlas->height, font->atlas->width, + d3d11->context, font->atlas->width, font->atlas->height, font->atlas->width, DXGI_FORMAT_A8_UNORM, font->atlas->buffer, &font->texture); font->atlas->dirty = false; } - d3d11_set_texture_and_sampler(d3d11->ctx, 0, &font->texture); - D3D11SetBlendState(d3d11->ctx, d3d11->blend_enable, NULL, D3D11_DEFAULT_SAMPLE_MASK); + d3d11_set_texture_and_sampler(d3d11->context, 0, &font->texture); + D3D11SetBlendState(d3d11->context, d3d11->blend_enable, NULL, D3D11_DEFAULT_SAMPLE_MASK); - D3D11SetPShader(d3d11->ctx, d3d11->sprites.shader_font.ps, NULL, 0); - D3D11Draw(d3d11->ctx, count, d3d11->sprites.offset); - D3D11SetPShader(d3d11->ctx, d3d11->sprites.shader.ps, NULL, 0); + D3D11SetPShader(d3d11->context, d3d11->sprites.shader_font.ps, NULL, 0); + D3D11Draw(d3d11->context, count, d3d11->sprites.offset); + D3D11SetPShader(d3d11->context, d3d11->sprites.shader.ps, NULL, 0); d3d11->sprites.offset += count; } @@ -244,7 +246,7 @@ static void d3d11_font_render_message( return; } - line_height = scale / font->font_driver->get_line_height(font->font_data); + line_height = font->font_driver->get_line_height(font->font_data) * scale / video_info->height; for (;;) { diff --git a/gfx/drivers_font/d3d12_font.c b/gfx/drivers_font/d3d12_font.c new file mode 100644 index 0000000000..ec884bf63c --- /dev/null +++ b/gfx/drivers_font/d3d12_font.c @@ -0,0 +1,374 @@ +/* RetroArch - A frontend for libretro. + * Copyright (C) 2014-2018 - Ali Bouhlel + * + * RetroArch is free software: you can redistribute it and/or modify it under the terms + * of the GNU General Public License as published by the Free Software Found- + * ation, either version 3 of the License, or (at your option) any later version. + * + * RetroArch is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR + * PURPOSE. See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with RetroArch. + * If not, see . + */ + +#define CINTERFACE + +#include +#include +#include +#include +#include + +#include "../font_driver.h" +#include "../video_driver.h" +#include "../common/d3d12_common.h" + +#include "../../verbosity.h" + +typedef struct +{ + d3d12_texture_t texture; + const font_renderer_driver_t* font_driver; + void* font_data; + struct font_atlas* atlas; +} d3d12_font_t; + +static void* +d3d12_font_init_font(void* data, const char* font_path, float font_size, bool is_threaded) +{ + d3d12_video_t* d3d12 = (d3d12_video_t*)data; + d3d12_font_t* font = (d3d12_font_t*)calloc(1, sizeof(*font)); + + if (!font) + return NULL; + + if (!font_renderer_create_default( + (const void**)&font->font_driver, &font->font_data, font_path, font_size)) + { + RARCH_WARN("Couldn't initialize font renderer.\n"); + free(font); + return NULL; + } + + font->atlas = font->font_driver->get_atlas(font->font_data); + font->texture.sampler = d3d12->samplers[RARCH_FILTER_LINEAR][RARCH_WRAP_BORDER]; + font->texture.desc.Width = font->atlas->width; + font->texture.desc.Height = font->atlas->height; + font->texture.desc.Format = DXGI_FORMAT_A8_UNORM; + font->texture.srv_heap = &d3d12->desc.srv_heap; + d3d12_init_texture(d3d12->device, &font->texture); + d3d12_update_texture( + font->atlas->width, font->atlas->height, font->atlas->width, DXGI_FORMAT_A8_UNORM, + font->atlas->buffer, &font->texture); + font->atlas->dirty = false; + + return font; +} + +static void d3d12_font_free_font(void* data, bool is_threaded) +{ + d3d12_font_t* font = (d3d12_font_t*)data; + + if (!font) + return; + + if (font->font_driver && font->font_data && font->font_driver->free) + font->font_driver->free(font->font_data); + + d3d12_release_texture(&font->texture); + + free(font); +} + +static int d3d12_font_get_message_width(void* data, const char* msg, unsigned msg_len, float scale) +{ + d3d12_font_t* font = (d3d12_font_t*)data; + + unsigned i; + int delta_x = 0; + + if (!font) + return 0; + + for (i = 0; i < msg_len; i++) + { + const struct font_glyph* glyph; + const char* msg_tmp = &msg[i]; + unsigned code = utf8_walk(&msg_tmp); + unsigned skip = msg_tmp - &msg[i]; + + if (skip > 1) + i += skip - 1; + + glyph = font->font_driver->get_glyph(font->font_data, code); + + if (!glyph) /* Do something smarter here ... */ + glyph = font->font_driver->get_glyph(font->font_data, '?'); + + if (!glyph) + continue; + + delta_x += glyph->advance_x; + } + + return delta_x * scale; +} + +static void d3d12_font_render_line( + video_frame_info_t* video_info, + d3d12_font_t* font, + const char* msg, + unsigned msg_len, + float scale, + const unsigned int color, + float pos_x, + float pos_y, + unsigned text_align) +{ + unsigned i, count; + void* mapped_vbo; + d3d12_sprite_t* v; + d3d12_sprite_t* vbo_start; + d3d12_video_t* d3d12 = (d3d12_video_t*)video_driver_get_ptr(false); + unsigned width = video_info->width; + unsigned height = video_info->height; + int x = roundf(pos_x * width); + int y = roundf((1.0 - pos_y) * height); + D3D12_RANGE range = { 0, 0 }; + + if (!d3d12->sprites.enabled || msg_len > (unsigned)d3d12->sprites.capacity) + return; + + if (d3d12->sprites.offset + msg_len > (unsigned)d3d12->sprites.capacity) + d3d12->sprites.offset = 0; + + switch (text_align) + { + case TEXT_ALIGN_RIGHT: + x -= d3d12_font_get_message_width(font, msg, msg_len, scale); + break; + + case TEXT_ALIGN_CENTER: + x -= d3d12_font_get_message_width(font, msg, msg_len, scale) / 2; + break; + } + + D3D12Map(d3d12->sprites.vbo, 0, &range, (void**)&vbo_start); + + v = vbo_start + d3d12->sprites.offset; + range.Begin = (uintptr_t)v - (uintptr_t)vbo_start; + + for (i = 0; i < msg_len; i++) + { + const struct font_glyph* glyph; + const char* msg_tmp = &msg[i]; + unsigned code = utf8_walk(&msg_tmp); + unsigned skip = msg_tmp - &msg[i]; + + if (skip > 1) + i += skip - 1; + + glyph = font->font_driver->get_glyph(font->font_data, code); + + if (!glyph) /* Do something smarter here ... */ + glyph = font->font_driver->get_glyph(font->font_data, '?'); + + if (!glyph) + continue; + + v->pos.x = (x + glyph->draw_offset_x) * scale / (float)d3d12->chain.viewport.Width; + v->pos.y = (y + glyph->draw_offset_y) * scale / (float)d3d12->chain.viewport.Height; + v->pos.w = glyph->width * scale / (float)d3d12->chain.viewport.Width; + v->pos.h = glyph->height * scale / (float)d3d12->chain.viewport.Height; + + v->coords.u = glyph->atlas_offset_x / (float)font->texture.desc.Width; + v->coords.v = glyph->atlas_offset_y / (float)font->texture.desc.Height; + v->coords.w = glyph->width / (float)font->texture.desc.Width; + v->coords.h = glyph->height / (float)font->texture.desc.Height; + + v->params.scaling = 1; + v->params.rotation = 0; + + v->colors[0] = color; + v->colors[1] = color; + v->colors[2] = color; + v->colors[3] = color; + + v++; + + x += glyph->advance_x * scale; + y += glyph->advance_y * scale; + } + + range.End = (uintptr_t)v - (uintptr_t)vbo_start; + D3D12Unmap(d3d12->sprites.vbo, 0, &range); + + count = v - vbo_start - d3d12->sprites.offset; + + if (!count) + return; + + if (font->atlas->dirty) + { + d3d12_update_texture( + font->atlas->width, font->atlas->height, font->atlas->width, DXGI_FORMAT_A8_UNORM, + font->atlas->buffer, &font->texture); + font->atlas->dirty = false; + } + + if(font->texture.dirty) + d3d12_upload_texture(d3d12->queue.cmd, &font->texture); + + D3D12SetPipelineState(d3d12->queue.cmd, d3d12->sprites.pipe_font); + d3d12_set_texture_and_sampler(d3d12->queue.cmd, &font->texture); + D3D12DrawInstanced(d3d12->queue.cmd, count, 1, d3d12->sprites.offset, 0); + + D3D12SetPipelineState(d3d12->queue.cmd, d3d12->sprites.pipe); + + d3d12->sprites.offset += count; +} + +static void d3d12_font_render_message( + video_frame_info_t* video_info, + d3d12_font_t* font, + const char* msg, + float scale, + const unsigned int color, + float pos_x, + float pos_y, + unsigned text_align) +{ + int lines = 0; + float line_height; + + if (!msg || !*msg) + return; + + /* If the font height is not supported just draw as usual */ + if (!font->font_driver->get_line_height) + { + d3d12_font_render_line( + video_info, font, msg, strlen(msg), scale, color, pos_x, pos_y, text_align); + return; + } + + line_height = font->font_driver->get_line_height(font->font_data) * scale / video_info->height; + + for (;;) + { + const char* delim = strchr(msg, '\n'); + + /* Draw the line */ + if (delim) + { + unsigned msg_len = delim - msg; + d3d12_font_render_line( + video_info, font, msg, msg_len, scale, color, pos_x, + pos_y - (float)lines * line_height, text_align); + msg += msg_len + 1; + lines++; + } + else + { + unsigned msg_len = strlen(msg); + d3d12_font_render_line( + video_info, font, msg, msg_len, scale, color, pos_x, + pos_y - (float)lines * line_height, text_align); + break; + } + } +} + +static void d3d12_font_render_msg( + video_frame_info_t* video_info, void* data, const char* msg, const void* userdata) +{ + float x, y, scale, drop_mod, drop_alpha; + int drop_x, drop_y; + enum text_alignment text_align; + unsigned color, color_dark, r, g, b, alpha, r_dark, g_dark, b_dark, alpha_dark; + d3d12_font_t* font = (d3d12_font_t*)data; + const struct font_params* params = (const struct font_params*)userdata; + unsigned width = video_info->width; + unsigned height = video_info->height; + + if (!font || !msg || !*msg) + return; + + if (params) + { + x = params->x; + y = params->y; + scale = params->scale; + text_align = params->text_align; + drop_x = params->drop_x; + drop_y = params->drop_y; + drop_mod = params->drop_mod; + drop_alpha = params->drop_alpha; + r = FONT_COLOR_GET_RED(params->color); + g = FONT_COLOR_GET_GREEN(params->color); + b = FONT_COLOR_GET_BLUE(params->color); + alpha = FONT_COLOR_GET_ALPHA(params->color); + color = DXGI_COLOR_RGBA(r, g, b, alpha); + } + else + { + x = video_info->font_msg_pos_x; + y = video_info->font_msg_pos_y; + scale = 1.0f; + text_align = TEXT_ALIGN_LEFT; + + r = (video_info->font_msg_color_r * 255); + g = (video_info->font_msg_color_g * 255); + b = (video_info->font_msg_color_b * 255); + alpha = 255; + color = DXGI_COLOR_RGBA(r, g, b, alpha); + + drop_x = -2; + drop_y = -2; + drop_mod = 0.3f; + drop_alpha = 1.0f; + } + + if (drop_x || drop_y) + { + r_dark = r * drop_mod; + g_dark = g * drop_mod; + b_dark = b * drop_mod; + alpha_dark = alpha * drop_alpha; + color_dark = DXGI_COLOR_RGBA(r_dark, g_dark, b_dark, alpha_dark); + + d3d12_font_render_message( + video_info, font, msg, scale, color_dark, x + scale * drop_x / width, + y + scale * drop_y / height, text_align); + } + + d3d12_font_render_message(video_info, font, msg, scale, color, x, y, text_align); +} + +static const struct font_glyph* d3d12_font_get_glyph(void* data, uint32_t code) +{ + d3d12_font_t* font = (d3d12_font_t*)data; + + if (!font || !font->font_driver) + return NULL; + + if (!font->font_driver->ident) + return NULL; + + return font->font_driver->get_glyph((void*)font->font_driver, code); +} + +static void d3d12_font_bind_block(void* data, void* userdata) { (void)data; } + +font_renderer_t d3d12_font = { + d3d12_font_init_font, + d3d12_font_free_font, + d3d12_font_render_msg, + "d3d12font", + d3d12_font_get_glyph, + d3d12_font_bind_block, + NULL, /* flush */ + d3d12_font_get_message_width, +}; diff --git a/gfx/drivers_font/d3d_w32_font.c b/gfx/drivers_font/d3d_w32_font.c index 643b24a7a9..9088f26849 100644 --- a/gfx/drivers_font/d3d_w32_font.c +++ b/gfx/drivers_font/d3d_w32_font.c @@ -16,6 +16,8 @@ #include +#include + #ifdef HAVE_CONFIG_H #include "../../config.h" #endif @@ -54,22 +56,25 @@ static void *d3dfonts_w32_init_font(void *video_data, bool is_threaded) { TEXTMETRICA metrics; - settings_t *settings = config_get_ptr(); - d3dx_font_desc_t desc = { - (int)(font_size), 0, 400, 0, - false, DEFAULT_CHARSET, - OUT_TT_PRECIS, - CLIP_DEFAULT_PRECIS, - DEFAULT_PITCH, -#ifdef UNICODE - _T(L"Verdana") -#else - _T("Verdana") -#endif - }; + d3dx_font_desc_t desc; d3dfonts_t *d3dfonts = (d3dfonts_t*)calloc(1, sizeof(*d3dfonts)); if (!d3dfonts) - return NULL; + return NULL; + + desc.Height = (int)font_size; + desc.Width = 0; + desc.Weight = 400; + desc.MipLevels = 0; + desc.Italic = FALSE; + desc.CharSet = DEFAULT_CHARSET; + desc.OutputPrecision = OUT_TT_PRECIS; + desc.Quality = CLIP_DEFAULT_PRECIS; + desc.PitchAndFamily = DEFAULT_PITCH; +#ifdef UNICODE + strlcpy(desc.FaceName, T(L"Verdana"), sizeof(desc.FaceName)); +#else + strlcpy(desc.FaceName, _T("Verdana"), sizeof(desc.FaceName)); +#endif d3dfonts->font_size = font_size * 1.2; /* to match the other font drivers */ d3dfonts->d3d = (d3d_video_t*)video_data; @@ -130,7 +135,6 @@ static void d3dfonts_w32_render_msg(video_frame_info_t *video_info, RECT rect, rect_shifted; RECT *p_rect_shifted = NULL; RECT *p_rect = NULL; - settings_t *settings = config_get_ptr(); const struct font_params *params = (const struct font_params*)userdata; d3dfonts_t *d3dfonts = (d3dfonts_t*)data; unsigned width = video_info->width; diff --git a/gfx/drivers_renderchain/d3d9_cg_renderchain.c b/gfx/drivers_renderchain/d3d9_cg_renderchain.c index eb1d9569d7..1a5a9199d2 100644 --- a/gfx/drivers_renderchain/d3d9_cg_renderchain.c +++ b/gfx/drivers_renderchain/d3d9_cg_renderchain.c @@ -284,8 +284,6 @@ static void d3d9_cg_renderchain_set_shader_params( set_cg_param(pass->vPrg, "IN.frame_count", frame_cnt); } - - #define DECL_FVF_TEXCOORD(stream, offset, index) \ { (WORD)(stream), (WORD)(offset * sizeof(float)), D3DDECLTYPE_FLOAT2, D3DDECLMETHOD_DEFAULT, \ D3DDECLUSAGE_TEXCOORD, (BYTE)(index) } @@ -1147,7 +1145,7 @@ static bool d3d9_cg_renderchain_add_lut(void *data, D3D_DEFAULT_NONPOW2, 0, 0, - D3DFMT_FROM_FILE, + ((D3DFORMAT)-3), /* D3DFMT_FROM_FILE */ D3DPOOL_MANAGED, smooth ? D3D_FILTER_LINEAR : D3D_FILTER_POINT, 0, @@ -1225,20 +1223,6 @@ static void d3d9_cg_renderchain_calc_and_set_shader_mvp( d3d9_cg_renderchain_set_shader_mvp(chain, vPrg, &matrix); } -static void d3d9_cg_renderchain_set_mvp( - void *data, - void *chain_data, - void *shader_data, - const void *mat_data) -{ - d3d_video_t *d3d = (d3d_video_t*)data; - - if (!d3d) - return; - - d3d_set_vertex_shader_constantf(d3d->dev, 0, (const float*)mat_data, 4); -} - static void cg_d3d9_renderchain_set_vertices( cg_renderchain_t *chain, struct Pass *pass, @@ -1336,13 +1320,6 @@ static void cg_d3d9_renderchain_set_vertices( } } -static void cg_d3d9_renderchain_set_viewport( - cg_renderchain_t *chain, - D3DVIEWPORT9 *vp) -{ - d3d_set_viewports(chain->dev, vp); -} - static void cg_d3d9_renderchain_blit_to_texture( cg_renderchain_t *chain, const void *frame, @@ -1553,8 +1530,7 @@ static bool d3d9_cg_renderchain_render( viewport.Width = out_width; viewport.Height = out_height; - if (chain) - cg_d3d9_renderchain_set_viewport(chain, &viewport); + d3d_set_viewports(chain->dev, &viewport); cg_d3d9_renderchain_set_vertices(chain, from_pass, current_width, current_height, @@ -1579,8 +1555,7 @@ static bool d3d9_cg_renderchain_render( &out_width, &out_height, current_width, current_height, chain->final_viewport); - if (chain) - cg_d3d9_renderchain_set_viewport(chain, chain->final_viewport); + d3d_set_viewports(chain->dev, chain->final_viewport); cg_d3d9_renderchain_set_vertices(chain, last_pass, current_width, current_height, @@ -1725,7 +1700,6 @@ static void d3d9_cg_renderchain_viewport_info( } d3d_renderchain_driver_t cg_d3d9_renderchain = { - d3d9_cg_renderchain_set_mvp, d3d9_cg_renderchain_free, d3d9_cg_renderchain_new, d3d9_cg_renderchain_init, diff --git a/gfx/drivers_renderchain/d3d9_hlsl_renderchain.c b/gfx/drivers_renderchain/d3d9_hlsl_renderchain.c index 4d8b433960..7fd431999f 100644 --- a/gfx/drivers_renderchain/d3d9_hlsl_renderchain.c +++ b/gfx/drivers_renderchain/d3d9_hlsl_renderchain.c @@ -43,23 +43,6 @@ typedef struct hlsl_d3d9_renderchain LPDIRECT3DVERTEXDECLARATION9 vertex_decl; } hlsl_d3d9_renderchain_t; -/* TODO/FIXME - this forward declaration should not be necesary */ -void hlsl_set_proj_matrix(void *data, void *matrix_data); - -static void hlsl_d3d9_renderchain_set_mvp( - void *data, - void *chain_data, - void *shader_data, - const void *mat_data) -{ - d3d_video_t *d3d = (d3d_video_t*)data; - - if(shader_data) - hlsl_set_proj_matrix(shader_data, (void*)mat_data); - else - hlsl_set_proj_matrix((void*)&d3d->shader, (void*)mat_data); -} - static void hlsl_d3d9_renderchain_clear(void *data) { hlsl_d3d9_renderchain_t *chain = (hlsl_d3d9_renderchain_t*)data; @@ -190,11 +173,6 @@ static void hlsl_d3d9_renderchain_set_vertices( d3d_vertex_buffer_unlock(chain->vertex_buf); } - /* TODO/FIXME - last parameter is mat_data, should be set to - something other than NULL */ - hlsl_d3d9_renderchain_set_mvp(d3d, chain, &d3d->shader, - NULL); - shader_info.data = d3d; shader_info.idx = pass; shader_info.set_active = true; @@ -225,8 +203,6 @@ static void hlsl_d3d9_renderchain_blit_to_texture( D3DLOCKED_RECT d3dlr; hlsl_d3d9_renderchain_t *chain = (hlsl_d3d9_renderchain_t*)data; - d3d_frame_postprocess(chain); - if (chain->last_width != width || chain->last_height != height) { d3d_lock_rectangle(chain->tex, @@ -296,7 +272,7 @@ static bool hlsl_d3d9_renderchain_init_shader(void *data, init.shader_type = RARCH_SHADER_HLSL; init.data = data; - init.path = settings->paths.path_shader; + init.path = retroarch_get_shader_preset(); init.shader = &hlsl_backend; RARCH_LOG("D3D]: Using HLSL shader backend.\n"); @@ -390,10 +366,6 @@ static bool hlsl_d3d9_renderchain_render(void *data, const void *frame, for (i = 0; i < 4; i++) d3d_set_stream_source(chain->dev, i, chain->vertex_buf, 0, sizeof(Vertex)); d3d_draw_primitive(chain->dev, D3DPT_TRIANGLESTRIP, 0, 2); - /* TODO/FIXME - last parameter is mat_data - should be something - other than NULL */ - hlsl_d3d9_renderchain_set_mvp(d3d, - chain, &d3d->shader, NULL); return true; } @@ -455,7 +427,6 @@ static void hlsl_d3d9_renderchain_viewport_info( } d3d_renderchain_driver_t hlsl_d3d9_renderchain = { - hlsl_d3d9_renderchain_set_mvp, hlsl_d3d9_renderchain_free, hlsl_d3d9_renderchain_new, hlsl_d3d9_renderchain_init, diff --git a/gfx/drivers_renderchain/null_renderchain.c b/gfx/drivers_renderchain/null_renderchain.c index 3455ce9b30..6da4458bc2 100644 --- a/gfx/drivers_renderchain/null_renderchain.c +++ b/gfx/drivers_renderchain/null_renderchain.c @@ -119,7 +119,6 @@ static void null_renderchain_convert_geometry( } d3d_renderchain_driver_t null_d3d_renderchain = { - NULL, null_renderchain_free, null_renderchain_new, null_renderchain_init, diff --git a/gfx/drivers_shader/glslang_util.cpp b/gfx/drivers_shader/glslang_util.cpp index 3094fb00ae..abae49db0f 100644 --- a/gfx/drivers_shader/glslang_util.cpp +++ b/gfx/drivers_shader/glslang_util.cpp @@ -30,7 +30,7 @@ #endif #include "glslang_util.h" -#ifdef HAVE_VULKAN +#if defined(HAVE_GLSLANG) && !defined(HAVE_GRIFFIN) #include "glslang.hpp" #endif #include "../../verbosity.h" diff --git a/gfx/drivers_shader/glslang_util.h b/gfx/drivers_shader/glslang_util.h index 366009e2b0..006fadc490 100644 --- a/gfx/drivers_shader/glslang_util.h +++ b/gfx/drivers_shader/glslang_util.h @@ -88,7 +88,12 @@ struct glslang_meta { std::vector parameters; std::string name; - glslang_format rt_format = SLANG_FORMAT_UNKNOWN; + glslang_format rt_format; + + glslang_meta() + { + rt_format = SLANG_FORMAT_UNKNOWN; + } }; struct glslang_output diff --git a/gfx/drivers_shader/shader_vulkan.cpp b/gfx/drivers_shader/shader_vulkan.cpp index d7d86258e9..de864eaf61 100644 --- a/gfx/drivers_shader/shader_vulkan.cpp +++ b/gfx/drivers_shader/shader_vulkan.cpp @@ -864,7 +864,7 @@ bool vulkan_filter_chain::init_feedback() } template -static bool set_unique_map(unordered_map &m, const string &name, const P &p) +static bool vk_shader_set_unique_map(unordered_map &m, const string &name, const P &p) { auto itr = m.find(name); if (itr != end(m)) @@ -892,19 +892,19 @@ bool vulkan_filter_chain::init_alias() unsigned i = &pass - passes.data(); - if (!set_unique_map(common.texture_semantic_map, name, + if (!vk_shader_set_unique_map(common.texture_semantic_map, name, slang_texture_semantic_map{ SLANG_TEXTURE_SEMANTIC_PASS_OUTPUT, i })) return false; - if (!set_unique_map(common.texture_semantic_uniform_map, name + "Size", + if (!vk_shader_set_unique_map(common.texture_semantic_uniform_map, name + "Size", slang_texture_semantic_map{ SLANG_TEXTURE_SEMANTIC_PASS_OUTPUT, i })) return false; - if (!set_unique_map(common.texture_semantic_map, name + "Feedback", + if (!vk_shader_set_unique_map(common.texture_semantic_map, name + "Feedback", slang_texture_semantic_map{ SLANG_TEXTURE_SEMANTIC_PASS_FEEDBACK, i })) return false; - if (!set_unique_map(common.texture_semantic_uniform_map, name + "FeedbackSize", + if (!vk_shader_set_unique_map(common.texture_semantic_uniform_map, name + "FeedbackSize", slang_texture_semantic_map{ SLANG_TEXTURE_SEMANTIC_PASS_FEEDBACK, i })) return false; } @@ -912,11 +912,11 @@ bool vulkan_filter_chain::init_alias() for (auto &lut : common.luts) { unsigned i = &lut - common.luts.data(); - if (!set_unique_map(common.texture_semantic_map, lut->get_id(), + if (!vk_shader_set_unique_map(common.texture_semantic_map, lut->get_id(), slang_texture_semantic_map{ SLANG_TEXTURE_SEMANTIC_USER, i })) return false; - if (!set_unique_map(common.texture_semantic_uniform_map, lut->get_id() + "Size", + if (!vk_shader_set_unique_map(common.texture_semantic_uniform_map, lut->get_id() + "Size", slang_texture_semantic_map{ SLANG_TEXTURE_SEMANTIC_USER, i })) return false; } @@ -1757,7 +1757,7 @@ bool Pass::build() for (auto ¶m : parameters) { - if (!set_unique_map(semantic_map, param.id, + if (!vk_shader_set_unique_map(semantic_map, param.id, slang_semantic_map{ SLANG_SEMANTIC_FLOAT_PARAMETER, j })) return false; j++; diff --git a/gfx/drivers_shader/slang_process.cpp b/gfx/drivers_shader/slang_process.cpp index b1f017eaff..72aab9285e 100644 --- a/gfx/drivers_shader/slang_process.cpp +++ b/gfx/drivers_shader/slang_process.cpp @@ -4,13 +4,16 @@ #include #include -#include "verbosity.h" #include "glslang_util.h" #include "slang_preprocess.h" #include "slang_reflection.h" #include "slang_process.h" +#include "../../verbosity.h" + +#ifdef HAVE_SPIRV_CROSS using namespace spirv_cross; +#endif using namespace std; template @@ -88,33 +91,39 @@ static bool slang_process_reflection( const ShaderResources& ps_resources, video_shader* shader_info, unsigned pass_number, - const semantics_map_t* semantics_map, + const semantics_map_t* map, pass_semantics_t* out) { unordered_map texture_semantic_map; unordered_map texture_semantic_uniform_map; - string name = shader_info->pass[pass_number].alias; + for (unsigned i = 0; i <= pass_number; i++) + { + if (!*shader_info->pass[i].alias) + continue; - if (!set_unique_map( - texture_semantic_map, name, - slang_texture_semantic_map{ SLANG_TEXTURE_SEMANTIC_PASS_OUTPUT, pass_number })) - return false; + string name = shader_info->pass[i].alias; - if (!set_unique_map( - texture_semantic_uniform_map, name + "Size", - slang_texture_semantic_map{ SLANG_TEXTURE_SEMANTIC_PASS_OUTPUT, pass_number })) - return false; + if (!set_unique_map( + texture_semantic_map, name, + slang_texture_semantic_map{ SLANG_TEXTURE_SEMANTIC_PASS_OUTPUT, i })) + return false; - if (!set_unique_map( - texture_semantic_map, name + "Feedback", - slang_texture_semantic_map{ SLANG_TEXTURE_SEMANTIC_PASS_FEEDBACK, pass_number })) - return false; + if (!set_unique_map( + texture_semantic_uniform_map, name + "Size", + slang_texture_semantic_map{ SLANG_TEXTURE_SEMANTIC_PASS_OUTPUT, i })) + return false; - if (!set_unique_map( - texture_semantic_uniform_map, name + "FeedbackSize", - slang_texture_semantic_map{ SLANG_TEXTURE_SEMANTIC_PASS_FEEDBACK, pass_number })) - return false; + if (!set_unique_map( + texture_semantic_map, name + "Feedback", + slang_texture_semantic_map{ SLANG_TEXTURE_SEMANTIC_PASS_FEEDBACK, i })) + return false; + + if (!set_unique_map( + texture_semantic_uniform_map, name + "FeedbackSize", + slang_texture_semantic_map{ SLANG_TEXTURE_SEMANTIC_PASS_FEEDBACK, i })) + return false; + } for (unsigned i = 0; i < shader_info->luts; i++) { @@ -130,12 +139,13 @@ static bool slang_process_reflection( } unordered_map uniform_semantic_map; + for (unsigned i = 0; i < shader_info->num_parameters; i++) { - if (!set_unique_map( - uniform_semantic_map, shader_info->parameters[i].id, - { SLANG_SEMANTIC_FLOAT_PARAMETER, i })) - return false; + if (!set_unique_map( + uniform_semantic_map, shader_info->parameters[i].id, + slang_semantic_map{ SLANG_SEMANTIC_FLOAT_PARAMETER, i })) + return false; } slang_reflection sl_reflection; @@ -161,17 +171,15 @@ static bool slang_process_reflection( vector uniforms[SLANG_CBUFFER_MAX]; vector textures; - uniform_map_t* uniform_map = semantics_map->uniform_map; - while (uniform_map->data) + for (int semantic = 0; semantic < SLANG_NUM_BASE_SEMANTICS; semantic++) { - slang_semantic_meta& src = sl_reflection.semantics[uniform_map->semantic]; - + slang_semantic_meta& src = sl_reflection.semantics[semantic]; if (src.push_constant || src.uniform) { - uniform_sem_t uniform = { uniform_map->data, uniform_map->id, + uniform_sem_t uniform = { map->uniforms[semantic], src.num_components * (unsigned)sizeof(float) }; - string uniform_id = get_semantic_name(sl_reflection, uniform_map->semantic, 0); + string uniform_id = get_semantic_name(sl_reflection, (slang_semantic)semantic, 0); strncpy(uniform.id, uniform_id.c_str(), sizeof(uniform.id)); if (src.push_constant) @@ -185,8 +193,6 @@ static bool slang_process_reflection( uniforms[SLANG_CBUFFER_UBO].push_back(uniform); } } - - uniform_map++; } for (int i = 0; i < sl_reflection.semantic_float_parameters.size(); i++) @@ -195,8 +201,7 @@ static bool slang_process_reflection( if (src.push_constant || src.uniform) { - uniform_sem_t uniform = { &shader_info->parameters[i].current, - "shader_info->parameter[i].current", sizeof(float) }; + uniform_sem_t uniform = { &shader_info->parameters[i].current, sizeof(float) }; string uniform_id = get_semantic_name(sl_reflection, SLANG_SEMANTIC_FLOAT_PARAMETER, i); strncpy(uniform.id, uniform_id.c_str(), sizeof(uniform.id)); @@ -214,35 +219,43 @@ static bool slang_process_reflection( } } - texture_map_t* texture_map = semantics_map->texture_map; - - while (texture_map->texture_data) + for (int semantic = 0; semantic < SLANG_NUM_TEXTURE_SEMANTICS; semantic++) { - if (texture_map->index < sl_reflection.semantic_textures[texture_map->semantic].size()) + for (int index = 0; index < sl_reflection.semantic_textures[semantic].size(); index++) { - slang_texture_semantic_meta& src = - sl_reflection.semantic_textures[texture_map->semantic][texture_map->index]; + slang_texture_semantic_meta& src = sl_reflection.semantic_textures[semantic][index]; if (src.stage_mask) { - texture_sem_t texture = { texture_map->texture_data, texture_map->texture_id, - texture_map->sampler_data, texture_map->sampler_id }; - texture.stage_mask = src.stage_mask; - texture.binding = src.binding; - string id = get_semantic_name(sl_reflection, texture_map->semantic, texture_map->index); + texture_sem_t texture = { + (void*)((uintptr_t)map->textures[semantic].image + index * map->textures[semantic].image_stride), + (void*)((uintptr_t)map->textures[semantic].sampler + index * map->textures[semantic].sampler_stride), + }; + texture.stage_mask = src.stage_mask; + texture.binding = src.binding; + string id = get_semantic_name(sl_reflection, (slang_texture_semantic)semantic, index); strncpy(texture.id, id.c_str(), sizeof(texture.id)); textures.push_back(texture); + + if (semantic == SLANG_TEXTURE_SEMANTIC_PASS_FEEDBACK) + shader_info->pass[index].feedback = true; + + if (semantic == SLANG_TEXTURE_SEMANTIC_ORIGINAL_HISTORY && + shader_info->history_size < index) + shader_info->history_size = index; } if (src.push_constant || src.uniform) { - uniform_sem_t uniform = { texture_map->size_data, texture_map->size_id, - 4 * sizeof(float) }; + uniform_sem_t uniform = { + (void*)((uintptr_t)map->textures[semantic].size + index * map->textures[semantic].size_stride), + 4 * sizeof(float) + }; string uniform_id = - get_size_semantic_name(sl_reflection, texture_map->semantic, texture_map->index); + get_size_semantic_name(sl_reflection, (slang_texture_semantic)semantic, index); strncpy(uniform.id, uniform_id.c_str(), sizeof(uniform.id)); @@ -258,8 +271,6 @@ static bool slang_process_reflection( } } } - - texture_map++; } out->texture_count = textures.size(); @@ -305,6 +316,9 @@ bool slang_process( if (!slang_preprocess_parse_parameters(output.meta, shader_info)) return false; + if (!*pass.alias && !output.meta.name.empty()) + strncpy(pass.alias, output.meta.name.c_str(), sizeof(pass.alias) - 1); + out->format = output.meta.rt_format; if (out->format == SLANG_FORMAT_UNKNOWN) @@ -341,6 +355,18 @@ bool slang_process( vs_resources = vs_compiler->get_shader_resources(); ps_resources = ps_compiler->get_shader_resources(); + if (!vs_resources.uniform_buffers.empty()) + vs_compiler->set_decoration(vs_resources.uniform_buffers[0].id, spv::DecorationBinding, 0); + if (!ps_resources.uniform_buffers.empty()) + ps_compiler->set_decoration(ps_resources.uniform_buffers[0].id, spv::DecorationBinding, 0); + + if (!vs_resources.push_constant_buffers.empty()) + vs_compiler->set_decoration( + vs_resources.push_constant_buffers[0].id, spv::DecorationBinding, 1); + if (!ps_resources.push_constant_buffers.empty()) + ps_compiler->set_decoration( + ps_resources.push_constant_buffers[0].id, spv::DecorationBinding, 1); + if (dst_type == RARCH_SHADER_HLSL || dst_type == RARCH_SHADER_CG) { CompilerHLSL::Options options; @@ -350,27 +376,28 @@ bool slang_process( vs->set_options(options); ps->set_options(options); - std::vector vs_attrib_remap; - /* not exactly a vertex attribute but this remaps * float2 FragCoord :TEXCOORD# to float4 FragCoord : SV_POSITION */ std::vector ps_attrib_remap; + + VariableTypeRemapCallback ps_var_remap_cb = + [&](const SPIRType& type, const std::string& var_name, std::string& name_of_type) { + if (var_name == "FragCoord") + { + name_of_type = "float4"; + } + }; for (Resource& resource : ps_resources.stage_inputs) { if (ps->get_name(resource.id) == "FragCoord") { uint32_t location = ps->get_decoration(resource.id, spv::DecorationLocation); ps_attrib_remap.push_back({ location, "SV_Position" }); + ps->set_variable_type_remap_callback(ps_var_remap_cb); } } - VariableTypeRemapCallback ps_var_remap_cb = - [](const SPIRType& type, const std::string& var_name, std::string& name_of_type) { - if (var_name == "FragCoord") - name_of_type = "float4"; - }; - ps->set_variable_type_remap_callback(ps_var_remap_cb); - vs_code = vs->compile(vs_attrib_remap); + vs_code = vs->compile(); ps_code = ps->compile(ps_attrib_remap); } else if (shader_info->type == RARCH_SHADER_GLSL) diff --git a/gfx/drivers_shader/slang_process.h b/gfx/drivers_shader/slang_process.h index f6ec33a908..c93bcf7e55 100644 --- a/gfx/drivers_shader/slang_process.h +++ b/gfx/drivers_shader/slang_process.h @@ -26,45 +26,29 @@ typedef struct { - enum slang_semantic semantic; - void* data; - const char* id; -} uniform_map_t; + void* ptr; + size_t stride; +} data_map_t; typedef struct { - enum slang_texture_semantic semantic; - int index; - void* texture_data; - const char* texture_id; - void* sampler_data; - const char* sampler_id; - void* size_data; - const char* size_id; + void* image; + size_t image_stride; + void* size; + size_t size_stride; + void* sampler; + size_t sampler_stride; } texture_map_t; -#define SL_UNIFORM_MAP(sem, data) \ - { \ - sem, &data, #data \ - } - -#define SL_TEXTURE_MAP_ARRAY(sem, index, tex, sampl, size) \ - { \ - sem, index, &tex, #tex, &sampl, #sampl, &size, #size \ - } - -#define SL_TEXTURE_MAP(sem, tex, sampl, size) SL_TEXTURE_MAP_ARRAY(sem, 0, tex, sampl, size) - typedef struct { - texture_map_t* texture_map; - uniform_map_t* uniform_map; + texture_map_t textures[SLANG_NUM_TEXTURE_SEMANTICS]; + void* uniforms[SLANG_NUM_BASE_SEMANTICS]; } semantics_map_t; typedef struct { void* data; - const char* data_id; unsigned size; unsigned offset; char id[64]; @@ -73,9 +57,7 @@ typedef struct typedef struct { void* texture_data; - const char* texture_id; void* sampler_data; - const char* sampler_id; unsigned stage_mask; unsigned binding; char id[64]; diff --git a/gfx/drivers_shader/slang_reflection.h b/gfx/drivers_shader/slang_reflection.h index 40e96f37a5..0d013c37a6 100644 --- a/gfx/drivers_shader/slang_reflection.h +++ b/gfx/drivers_shader/slang_reflection.h @@ -62,7 +62,9 @@ enum slang_semantic // vec4, viewport size of final pass SLANG_SEMANTIC_FINAL_VIEWPORT = 2, // uint, frame count with modulo - SLANG_SEMANTIC_FRAME_COUNT = 3, + SLANG_SEMANTIC_FRAME_COUNT = 3, + SLANG_NUM_BASE_SEMANTICS, + // float, user defined parameter, arrayed SLANG_SEMANTIC_FLOAT_PARAMETER = 4, @@ -91,7 +93,7 @@ enum slang_constant_buffer #include #include #include -#include "spirv_cross.hpp" +#include struct slang_texture_semantic_meta { diff --git a/gfx/font_driver.c b/gfx/font_driver.c index fd54e019fa..9133ed2844 100644 --- a/gfx/font_driver.c +++ b/gfx/font_driver.c @@ -309,6 +309,37 @@ static bool d3d11_font_init_first( } #endif +#ifdef HAVE_D3D12 +static const font_renderer_t *d3d12_font_backends[] = { + &d3d12_font, + NULL, +}; + +static bool d3d12_font_init_first( + const void **font_driver, void **font_handle, + void *video_data, const char *font_path, + float font_size, bool is_threaded) +{ + unsigned i; + + for (i = 0; d3d12_font_backends[i]; i++) + { + void *data = d3d12_font_backends[i]->init(video_data, + font_path, font_size, + is_threaded); + + if (!data) + continue; + + *font_driver = d3d12_font_backends[i]; + *font_handle = data; + return true; + } + + return false; +} +#endif + #ifdef HAVE_VITA2D static const font_renderer_t *vita2d_font_backends[] = { &vita2d_vita_font @@ -430,6 +461,11 @@ static bool font_init_first( return d3d11_font_init_first(font_driver, font_handle, video_data, font_path, font_size, is_threaded); #endif +#ifdef HAVE_D3D12 + case FONT_DRIVER_RENDER_D3D12_API: + return d3d12_font_init_first(font_driver, font_handle, + video_data, font_path, font_size, is_threaded); +#endif #ifdef HAVE_VITA2D case FONT_DRIVER_RENDER_VITA2D: return vita2d_font_init_first(font_driver, font_handle, @@ -470,14 +506,255 @@ static bool font_init_first( return false; } +#ifdef HAVE_LANGEXTRA + +/* ACII: 0xxxxxxx (c & 0x80) == 0x00 + * other start: 11xxxxxx (c & 0xC0) == 0xC0 + * other cont: 10xxxxxx (c & 0xC0) == 0x80 + * Neutral : + * 0020 - 002F : 001xxxxx (c & 0xE0) == 0x20 + * Arabic: + * 0600 - 07FF : 11011xxx (c & 0xF8) == 0xD8 (2 bytes) + * 0800 - 08FF : 11100000 101000xx c == 0xE0 && (c1 & 0xAC) == 0xA0 (3 bytes) */ + +/* clang-format off */ +#define IS_ASCII(p) ((*(p)&0x80) == 0x00) +#define IS_MBSTART(p) ((*(p)&0xC0) == 0xC0) +#define IS_MBCONT(p) ((*(p)&0xC0) == 0x80) +#define IS_DIR_NEUTRAL(p) ((*(p)&0xE0) == 0x20) +#define IS_ARABIC0(p) ((*(p)&0xF8) == 0xD8) +#define IS_ARABIC1(p) ((*(p) == 0xE0) && ((*((p) + 1) & 0xAC) == 0xA0)) +#define IS_ARABIC(p) (IS_ARABIC0(p) || IS_ARABIC1(p)) +#define IS_RTL(p) IS_ARABIC(p) + +/* 0x0620 to 0x064F */ +static const unsigned arabic_shape_map[0x50 - 0x20][0x4] = { + { 0 }, /* 0x0620 */ + { 0xFE80 }, + { 0xFE81, 0xFE82 }, + { 0xFE83, 0xFE84 }, + { 0xFE85, 0xFE86 }, + { 0xFE87, 0xFE88 }, + { 0xFE89, 0xFE8A, 0xFE8B, 0xFE8C }, + { 0xFE8D, 0xFE8E }, + + { 0xFE8F, 0xFE90, 0xFE91, 0xFE92 }, + { 0xFE93, 0xFE94 }, + { 0xFE95, 0xFE96, 0xFE97, 0xFE98 }, + { 0xFE99, 0xFE9A, 0xFE9B, 0xFE9C }, + { 0xFE9D, 0xFE9E, 0xFE9F, 0xFEA0 }, + { 0xFEA1, 0xFEA2, 0xFEA3, 0xFEA4 }, + { 0xFEA5, 0xFEA6, 0xFEA7, 0xFEA8 }, + { 0xFEA9, 0xFEAA }, + + { 0xFEAB, 0xFEAC }, /* 0x0630 */ + { 0xFEAD, 0xFEAE }, + { 0xFEAF, 0xFEB0 }, + { 0xFEB1, 0xFEB2, 0xFEB3, 0xFEB4 }, + { 0xFEB5, 0xFEB6, 0xFEB7, 0xFEB8 }, + { 0xFEB9, 0xFEBA, 0xFEBB, 0xFEBC }, + { 0xFEBD, 0xFEBE, 0xFEBF, 0xFEC0 }, + { 0xFEC1, 0xFEC2, 0xFEC3, 0xFEC4 }, + { 0xFEC5, 0xFEC6, 0xFEC7, 0xFEC8 }, + + { 0xFEC9, 0xFECA, 0xFECB, 0xFECC }, + { 0xFECD, 0xFECE, 0xFECF, 0xFED0 }, + { 0 }, + { 0 }, + { 0 }, + { 0 }, + { 0 }, + { 0 }, + + { 0xFED1, 0xFED2, 0xFED3, 0xFED4 }, /* 0x0640 */ + { 0xFED5, 0xFED6, 0xFED7, 0xFED8 }, + { 0xFED9, 0xFEDA, 0xFEDB, 0xFEDC }, + { 0xFEDD, 0xFEDE, 0xFEDF, 0xFEE0 }, + { 0xFEE1, 0xFEE2, 0xFEE3, 0xFEE4 }, + { 0xFEE5, 0xFEE6, 0xFEE7, 0xFEE8 }, + { 0xFEE9, 0xFEEA, 0xFEEB, 0xFEEC }, + { 0xFEED, 0xFEEE }, + + { 0xFEEF, 0xFEF0, 0xFBE8, 0xFBE9 }, + { 0xFEF1, 0xFEF2, 0xFEF3, 0xFEF4 }, +}; +/* clang-format on */ + +static INLINE unsigned font_get_replacement(const char* src, const char* start) +{ + if ((*src & 0xFC) == 0xD8) /* 0x0600 to 0x06FF */ + { + int lookup; + unsigned result; + bool prev_connected = false; + bool next_connected = false; + unsigned char id = (src[0] << 6) | (src[1] & 0x3F); + const char* prev1 = src - 2; + const char* prev2 = src - 4; + + if (id < 0x21 || id > 0x4A) + return 0; + + if(prev2 < start) + { + prev2 = NULL; + if(prev1 < start) + prev1 = NULL; + } + + if (prev1 && (*prev1 & 0xFC) == 0xD8) + { + unsigned char prev1_id = 0; + + if (prev1) + prev1_id = (prev1[0] << 6) | (prev1[1] & 0x3F); + + if (prev1_id == 0x44) + { + unsigned char prev2_id = 0; + + if (prev2) + prev2_id = (prev2[0] << 6) | (prev2[1] & 0x3F); + + if (prev2_id > 0x20 || prev2_id < 0x50) + prev_connected = !!arabic_shape_map[prev2_id - 0x20][2]; + + switch (id) + { + case 0x22: + return 0xFEF5 + prev_connected; + case 0x23: + return 0xFEF7 + prev_connected; + case 0x25: + return 0xFEF9 + prev_connected; + case 0x27: + return 0xFEFB + prev_connected; + } + } + if (prev1_id > 0x20 || prev1_id < 0x50) + prev_connected = !!arabic_shape_map[prev1_id - 0x20][2]; + } + + if ((src[2] & 0xFC) == 0xD8) + { + unsigned char next_id = (src[2] << 6) | (src[3] & 0x3F); + + if (next_id > 0x20 || next_id < 0x50) + next_connected = true; + } + + result = arabic_shape_map[id - 0x20][prev_connected | (next_connected << 1)]; + + if (result) + return result; + + return arabic_shape_map[id - 0x20][prev_connected]; + } + + return 0; +} + +static char* font_driver_reshape_msg(const char* msg) +{ + /* worst case transformations are 2 bytes to 4 bytes */ + char* buffer = (char*)malloc((strlen(msg) * 2) + 1); + const char* src = msg; + char* dst = buffer; + bool reverse = false; + + while (*src || reverse) + { + if (reverse) + { + src--; + while (IS_MBCONT(src)) + src--; + + if (IS_RTL(src) || IS_DIR_NEUTRAL(src)) + { + unsigned replacement = font_get_replacement(src, msg); + if (replacement) + { + if (replacement < 0x80) + *dst++ = replacement; + else if (replacement < 0x8000) + { + *dst++ = 0xC0 | (replacement >> 6); + *dst++ = 0x80 | (replacement & 0x3F); + } + else if (replacement < 0x10000) + { + /* merged glyphs */ + if ((replacement >= 0xFEF5) && (replacement <= 0xFEFC)) + src -= 2; + + *dst++ = 0xE0 | (replacement >> 12); + *dst++ = 0x80 | ((replacement >> 6) & 0x3F); + *dst++ = 0x80 | (replacement & 0x3F); + } + else + { + *dst++ = 0xF0 | (replacement >> 18); + *dst++ = 0x80 | ((replacement >> 12) & 0x3F); + *dst++ = 0x80 | ((replacement >> 6) & 0x3F); + *dst++ = 0x80 | (replacement & 0x3F); + } + + continue; + } + + *dst++ = *src++; + while (IS_MBCONT(src)) + *dst++ = *src++; + src--; + + while (IS_MBCONT(src)) + src--; + } + else + { + reverse = false; + src++; + while (IS_MBCONT(src) || IS_RTL(src) || IS_DIR_NEUTRAL(src)) + src++; + } + } + else + { + if (IS_RTL(src)) + { + reverse = true; + while (IS_MBCONT(src) || IS_RTL(src) || IS_DIR_NEUTRAL(src)) + src++; + } + else + *dst++ = *src++; + } + } + + *dst = '\0'; + + return buffer; +} +#endif + void font_driver_render_msg( video_frame_info_t *video_info, void *font_data, const char *msg, const void *params) { font_data_t *font = (font_data_t*)(font_data ? font_data : video_font_driver); - if (font && font->renderer && font->renderer->render_msg) + + if (msg && *msg && font && font->renderer && font->renderer->render_msg) + { +#ifdef HAVE_LANGEXTRA + char* new_msg = font_driver_reshape_msg(msg); + font->renderer->render_msg(video_info, font->renderer_data, new_msg, params); + free(new_msg); +#else font->renderer->render_msg(video_info, font->renderer_data, msg, params); +#endif + } } void font_driver_bind_block(void *font_data, void *block) diff --git a/gfx/font_driver.h b/gfx/font_driver.h index 2cfa3fe7ae..2ae4030710 100644 --- a/gfx/font_driver.h +++ b/gfx/font_driver.h @@ -32,6 +32,7 @@ enum font_driver_render_api FONT_DRIVER_RENDER_OPENGL_API, FONT_DRIVER_RENDER_DIRECT3D_API, FONT_DRIVER_RENDER_D3D11_API, + FONT_DRIVER_RENDER_D3D12_API, FONT_DRIVER_RENDER_VITA2D, FONT_DRIVER_RENDER_CTR, FONT_DRIVER_RENDER_WIIU, @@ -186,6 +187,7 @@ extern font_renderer_t ctr_font; extern font_renderer_t wiiu_font; extern font_renderer_t vulkan_raster_font; extern font_renderer_t d3d11_font; +extern font_renderer_t d3d12_font; extern font_renderer_t caca_font; extern font_renderer_t gdi_font; extern font_renderer_t vga_font; diff --git a/gfx/include/Cg/cgD3D9.h b/gfx/include/Cg/cgD3D9.h index 59b61b83e5..646a2cf6fd 100644 --- a/gfx/include/Cg/cgD3D9.h +++ b/gfx/include/Cg/cgD3D9.h @@ -59,7 +59,11 @@ #include "cg.h" #include +#if 0 +#ifdef HAVE_D3DX #include "../d3d9/d3dx9.h" +#endif +#endif #include /* Set up for either Win32 import/export/lib. */ @@ -86,11 +90,11 @@ enum cgD3D9Errors cgD3D9DebugTrace = 1001 }; -/*--------------------------------------------------------------------------- -// HRESULTs specific to cgD3D9. When the CGerror is set to cgD3D9Failed -// cgD3D9GetLastError will return an HRESULT that could be one these. -// Use cgD3D9TranslateHRESULT() to translate these errors into strings. ----------------------------------------------------------------------------*/ +/* + * HRESULTs specific to cgD3D9. When the CGerror is set to cgD3D9Failed + * cgD3D9GetLastError will return an HRESULT that could be one these. + * Use cgD3D9TranslateHRESULT() to translate these errors into strings. +*/ static const HRESULT CGD3D9ERR_NOTLOADED = MAKE_HRESULT(1, 0x877, 1); static const HRESULT CGD3D9ERR_NODEVICE = MAKE_HRESULT(1, 0x877, 2); @@ -102,9 +106,9 @@ static const HRESULT CGD3D9ERR_NOTUNIFORM = MAKE_HRESULT(1, 0x877, 7); static const HRESULT CGD3D9ERR_NOTMATRIX = MAKE_HRESULT(1, 0x877, 8); static const HRESULT CGD3D9ERR_INVALIDPARAM = MAKE_HRESULT(1, 0x877, 9); -/*--------------------------------------------------------------------------- -// Other error return values ----------------------------------------------------------------------------*/ +/* + * Other error return values +*/ static const DWORD CGD3D9_INVALID_USAGE = 0xFF; diff --git a/gfx/include/d3d8/d3dx8core.h b/gfx/include/d3d8/d3dx8core.h index 5620f645e7..7542f28924 100644 --- a/gfx/include/d3d8/d3dx8core.h +++ b/gfx/include/d3d8/d3dx8core.h @@ -1,11 +1,10 @@ -/////////////////////////////////////////////////////////////////////////// -// -// Copyright (C) Microsoft Corporation. All Rights Reserved. -// -// File: d3dx8core.h -// Content: D3DX core types and functions -// -/////////////////////////////////////////////////////////////////////////// +/* + * + * Copyright (C) Microsoft Corporation. All Rights Reserved. + * + * File: d3dx8core.h + * Content: D3DX core types and functions + */ #include "d3dx8.h" @@ -14,22 +13,22 @@ -/////////////////////////////////////////////////////////////////////////// -// ID3DXBuffer: -// ------------ -// The buffer object is used by D3DX to return arbitrary size data. -// -// GetBufferPointer - -// Returns a pointer to the beginning of the buffer. -// -// GetBufferSize - -// Returns the size of the buffer, in bytes. -/////////////////////////////////////////////////////////////////////////// +/* + * ID3DXBuffer: + * ------------ + * The buffer object is used by D3DX to return arbitrary size data. + * + * GetBufferPointer - + * Returns a pointer to the beginning of the buffer. + * + * GetBufferSize - + * Returns the size of the buffer, in bytes. + */ typedef interface ID3DXBuffer ID3DXBuffer; typedef interface ID3DXBuffer *LPD3DXBUFFER; -// {932E6A7E-C68E-45dd-A7BF-53D19C86DB1F} +/* {932E6A7E-C68E-45dd-A7BF-53D19C86DB1F} */ DEFINE_GUID(IID_ID3DXBuffer, 0x932e6a7e, 0xc68e, 0x45dd, 0xa7, 0xbf, 0x53, 0xd1, 0x9c, 0x86, 0xdb, 0x1f); @@ -38,48 +37,45 @@ DEFINE_GUID(IID_ID3DXBuffer, DECLARE_INTERFACE_(ID3DXBuffer, IUnknown) { - // IUnknown + /* IUnknown */ STDMETHOD(QueryInterface)(THIS_ REFIID iid, LPVOID *ppv) PURE; STDMETHOD_(ULONG, AddRef)(THIS) PURE; STDMETHOD_(ULONG, Release)(THIS) PURE; - // ID3DXBuffer + /* ID3DXBuffer */ STDMETHOD_(LPVOID, GetBufferPointer)(THIS) PURE; STDMETHOD_(DWORD, GetBufferSize)(THIS) PURE; }; - - -/////////////////////////////////////////////////////////////////////////// -// ID3DXFont: -// ---------- -// Font objects contain the textures and resources needed to render -// a specific font on a specific device. -// -// Begin - -// Prepartes device for drawing text. This is optional.. if DrawText -// is called outside of Begin/End, it will call Begin and End for you. -// -// DrawText - -// Draws formatted text on a D3D device. Some parameters are -// surprisingly similar to those of GDI's DrawText function. See GDI -// documentation for a detailed description of these parameters. -// -// End - -// Restores device state to how it was when Begin was called. -// -// OnLostDevice, OnResetDevice - -// Call OnLostDevice() on this object before calling Reset() on the -// device, so that this object can release any stateblocks and video -// memory resources. After Reset(), the call OnResetDevice(). -// -/////////////////////////////////////////////////////////////////////////// +/* + * ID3DXFont: + * ---------- + * Font objects contain the textures and resources needed to render + * a specific font on a specific device. + * + * Begin - + * Prepartes device for drawing text. This is optional.. if DrawText + * is called outside of Begin/End, it will call Begin and End for you. + * + * DrawText - + * Draws formatted text on a D3D device. Some parameters are + * surprisingly similar to those of GDI's DrawText function. See GDI + * documentation for a detailed description of these parameters. + * + * End - + * Restores device state to how it was when Begin was called. + * + * OnLostDevice, OnResetDevice - + * Call OnLostDevice() on this object before calling Reset() on the + * device, so that this object can release any stateblocks and video + * memory resources. After Reset(), the call OnResetDevice(). + * + */ typedef interface ID3DXFont ID3DXFont; typedef interface ID3DXFont *LPD3DXFONT; - -// {89FAD6A5-024D-49af-8FE7-F51123B85E25} +/* {89FAD6A5-024D-49af-8FE7-F51123B85E25} */ DEFINE_GUID( IID_ID3DXFont, 0x89fad6a5, 0x24d, 0x49af, 0x8f, 0xe7, 0xf5, 0x11, 0x23, 0xb8, 0x5e, 0x25); @@ -89,12 +85,12 @@ DEFINE_GUID( IID_ID3DXFont, DECLARE_INTERFACE_(ID3DXFont, IUnknown) { - // IUnknown + /* IUnknown */ STDMETHOD(QueryInterface)(THIS_ REFIID iid, LPVOID *ppv) PURE; STDMETHOD_(ULONG, AddRef)(THIS) PURE; STDMETHOD_(ULONG, Release)(THIS) PURE; - // ID3DXFont + /* ID3DXFont */ STDMETHOD(GetDevice)(THIS_ LPDIRECT3DDEVICE8* ppDevice) PURE; STDMETHOD(GetLogFont)(THIS_ LOGFONT* pLogFont) PURE; @@ -118,7 +114,7 @@ DECLARE_INTERFACE_(ID3DXFont, IUnknown) #ifdef __cplusplus extern "C" { -#endif //__cplusplus +#endif /* __cplusplus */ HRESULT WINAPI D3DXCreateFont( @@ -137,33 +133,33 @@ HRESULT WINAPI } #endif /* __cplusplus */ -/////////////////////////////////////////////////////////////////////////// -// ID3DXSprite: -// ------------ -// This object intends to provide an easy way to drawing sprites using D3D. -// -// Begin - -// Prepares device for drawing sprites -// -// Draw, DrawAffine, DrawTransform - -// Draws a sprite in screen-space. Before transformation, the sprite is -// the size of SrcRect, with its top-left corner at the origin (0,0). -// The color and alpha channels are modulated by Color. -// -// End - -// Restores device state to how it was when Begin was called. -// -// OnLostDevice, OnResetDevice - -// Call OnLostDevice() on this object before calling Reset() on the -// device, so that this object can release any stateblocks and video -// memory resources. After Reset(), the call OnResetDevice(). -/////////////////////////////////////////////////////////////////////////// +/* + * ID3DXSprite: + * ------------ + * This object intends to provide an easy way to drawing sprites using D3D. + * + * Begin - + * Prepares device for drawing sprites + * + * Draw, DrawAffine, DrawTransform - + * Draws a sprite in screen-space. Before transformation, the sprite is + * the size of SrcRect, with its top-left corner at the origin (0,0). + * The color and alpha channels are modulated by Color. + * + * End - + * Restores device state to how it was when Begin was called. + * + * OnLostDevice, OnResetDevice - + * Call OnLostDevice() on this object before calling Reset() on the + * device, so that this object can release any stateblocks and video + * memory resources. After Reset(), the call OnResetDevice(). + */ typedef interface ID3DXSprite ID3DXSprite; typedef interface ID3DXSprite *LPD3DXSPRITE; -// {13D69D15-F9B0-4e0f-B39E-C91EB33F6CE7} +/* {13D69D15-F9B0-4e0f-B39E-C91EB33F6CE7} */ DEFINE_GUID( IID_ID3DXSprite, 0x13d69d15, 0xf9b0, 0x4e0f, 0xb3, 0x9e, 0xc9, 0x1e, 0xb3, 0x3f, 0x6c, 0xe7); @@ -173,12 +169,12 @@ DEFINE_GUID( IID_ID3DXSprite, DECLARE_INTERFACE_(ID3DXSprite, IUnknown) { - // IUnknown + /* IUnknown */ STDMETHOD(QueryInterface)(THIS_ REFIID iid, LPVOID *ppv) PURE; STDMETHOD_(ULONG, AddRef)(THIS) PURE; STDMETHOD_(ULONG, Release)(THIS) PURE; - // ID3DXSprite + /* ID3DXSprite */ STDMETHOD(GetDevice)(THIS_ LPDIRECT3DDEVICE8* ppDevice) PURE; STDMETHOD(Begin)(THIS) PURE; @@ -201,7 +197,7 @@ DECLARE_INTERFACE_(ID3DXSprite, IUnknown) #ifdef __cplusplus extern "C" { -#endif //__cplusplus +#endif /* __cplusplus */ HRESULT WINAPI @@ -211,28 +207,28 @@ HRESULT WINAPI #ifdef __cplusplus } -#endif //__cplusplus +#endif /* __cplusplus */ -/////////////////////////////////////////////////////////////////////////// -// ID3DXRenderToSurface: -// --------------------- -// This object abstracts rendering to surfaces. These surfaces do not -// necessarily need to be render targets. If they are not, a compatible -// render target is used, and the result copied into surface at end scene. -// -// BeginScene, EndScene - -// Call BeginScene() and EndScene() at the beginning and ending of your -// scene. These calls will setup and restore render targets, viewports, -// etc.. -// -// OnLostDevice, OnResetDevice - -// Call OnLostDevice() on this object before calling Reset() on the -// device, so that this object can release any stateblocks and video -// memory resources. After Reset(), the call OnResetDevice(). -/////////////////////////////////////////////////////////////////////////// +/* + * ID3DXRenderToSurface: + * --------------------- + * This object abstracts rendering to surfaces. These surfaces do not + * necessarily need to be render targets. If they are not, a compatible + * render target is used, and the result copied into surface at end scene. + * + * BeginScene, EndScene - + * Call BeginScene() and EndScene() at the beginning and ending of your + * scene. These calls will setup and restore render targets, viewports, + * etc.. + * + * OnLostDevice, OnResetDevice - + * Call OnLostDevice() on this object before calling Reset() on the + * device, so that this object can release any stateblocks and video + * memory resources. After Reset(), the call OnResetDevice(). + */ typedef struct _D3DXRTS_DESC { @@ -248,23 +244,21 @@ typedef struct _D3DXRTS_DESC typedef interface ID3DXRenderToSurface ID3DXRenderToSurface; typedef interface ID3DXRenderToSurface *LPD3DXRENDERTOSURFACE; - -// {82DF5B90-E34E-496e-AC1C-62117A6A5913} +/* {82DF5B90-E34E-496e-AC1C-62117A6A5913} */ DEFINE_GUID( IID_ID3DXRenderToSurface, 0x82df5b90, 0xe34e, 0x496e, 0xac, 0x1c, 0x62, 0x11, 0x7a, 0x6a, 0x59, 0x13); - #undef INTERFACE #define INTERFACE ID3DXRenderToSurface DECLARE_INTERFACE_(ID3DXRenderToSurface, IUnknown) { - // IUnknown + /* IUnknown */ STDMETHOD(QueryInterface)(THIS_ REFIID iid, LPVOID *ppv) PURE; STDMETHOD_(ULONG, AddRef)(THIS) PURE; STDMETHOD_(ULONG, Release)(THIS) PURE; - // ID3DXRenderToSurface + /* ID3DXRenderToSurface */ STDMETHOD(GetDevice)(THIS_ LPDIRECT3DDEVICE8* ppDevice) PURE; STDMETHOD(GetDesc)(THIS_ D3DXRTS_DESC* pDesc) PURE; @@ -278,7 +272,7 @@ DECLARE_INTERFACE_(ID3DXRenderToSurface, IUnknown) #ifdef __cplusplus extern "C" { -#endif //__cplusplus +#endif /* __cplusplus */ HRESULT WINAPI D3DXCreateRenderToSurface( @@ -292,37 +286,37 @@ HRESULT WINAPI #ifdef __cplusplus } -#endif //__cplusplus +#endif /* __cplusplus */ -/////////////////////////////////////////////////////////////////////////// -// ID3DXRenderToEnvMap: -// -------------------- -// This object abstracts rendering to environment maps. These surfaces -// do not necessarily need to be render targets. If they are not, a -// compatible render target is used, and the result copied into the -// environment map at end scene. -// -// BeginCube, BeginSphere, BeginHemisphere, BeginParabolic - -// This function initiates the rendering of the environment map. As -// parameters, you pass the textures in which will get filled in with -// the resulting environment map. -// -// Face - -// Call this function to initiate the drawing of each face. For each -// environment map, you will call this six times.. once for each face -// in D3DCUBEMAP_FACES. -// -// End - -// This will restore all render targets, and if needed compose all the -// rendered faces into the environment map surfaces. -// -// OnLostDevice, OnResetDevice - -// Call OnLostDevice() on this object before calling Reset() on the -// device, so that this object can release any stateblocks and video -// memory resources. After Reset(), the call OnResetDevice(). -/////////////////////////////////////////////////////////////////////////// +/* + * ID3DXRenderToEnvMap: + * -------------------- + * This object abstracts rendering to environment maps. These surfaces + * do not necessarily need to be render targets. If they are not, a + * compatible render target is used, and the result copied into the + * environment map at end scene. + * + * BeginCube, BeginSphere, BeginHemisphere, BeginParabolic - + * This function initiates the rendering of the environment map. As + * parameters, you pass the textures in which will get filled in with + * the resulting environment map. + * + * Face - + * Call this function to initiate the drawing of each face. For each + * environment map, you will call this six times.. once for each face + * in D3DCUBEMAP_FACES. + * + * End - + * This will restore all render targets, and if needed compose all the + * rendered faces into the environment map surfaces. + * + * OnLostDevice, OnResetDevice - + * Call OnLostDevice() on this object before calling Reset() on the + * device, so that this object can release any stateblocks and video + * memory resources. After Reset(), the call OnResetDevice(). + */ typedef struct _D3DXRTE_DESC { @@ -336,7 +330,7 @@ typedef struct _D3DXRTE_DESC typedef interface ID3DXRenderToEnvMap ID3DXRenderToEnvMap; typedef interface ID3DXRenderToEnvMap *LPD3DXRenderToEnvMap; -// {4E42C623-9451-44b7-8C86-ABCCDE5D52C8} +/* {4E42C623-9451-44b7-8C86-ABCCDE5D52C8} */ DEFINE_GUID( IID_ID3DXRenderToEnvMap, 0x4e42c623, 0x9451, 0x44b7, 0x8c, 0x86, 0xab, 0xcc, 0xde, 0x5d, 0x52, 0xc8); @@ -346,12 +340,12 @@ DEFINE_GUID( IID_ID3DXRenderToEnvMap, DECLARE_INTERFACE_(ID3DXRenderToEnvMap, IUnknown) { - // IUnknown + /* IUnknown */ STDMETHOD(QueryInterface)(THIS_ REFIID iid, LPVOID *ppv) PURE; STDMETHOD_(ULONG, AddRef)(THIS) PURE; STDMETHOD_(ULONG, Release)(THIS) PURE; - // ID3DXRenderToEnvMap + /* ID3DXRenderToEnvMap */ STDMETHOD(GetDevice)(THIS_ LPDIRECT3DDEVICE8* ppDevice) PURE; STDMETHOD(GetDesc)(THIS_ D3DXRTE_DESC* pDesc) PURE; @@ -379,7 +373,7 @@ DECLARE_INTERFACE_(ID3DXRenderToEnvMap, IUnknown) #ifdef __cplusplus extern "C" { -#endif //__cplusplus +#endif /* __cplusplus */ HRESULT WINAPI D3DXCreateRenderToEnvMap( @@ -392,26 +386,26 @@ HRESULT WINAPI #ifdef __cplusplus } -#endif //__cplusplus +#endif /* __cplusplus */ -/////////////////////////////////////////////////////////////////////////// -// Shader assemblers: -/////////////////////////////////////////////////////////////////////////// +/* + * Shader assemblers: + */ -//------------------------------------------------------------------------- -// D3DXASM flags: -// -------------- -// -// D3DXASM_DEBUG -// Generate debug info. -// -// D3DXASM_SKIPVALIDATION -// Do not validate the generated code against known capabilities and -// constraints. This option is only recommended when assembling shaders -// you KNOW will work. (ie. have assembled before without this option.) -//------------------------------------------------------------------------- +/* + * D3DXASM flags: + * -------------- + * + * D3DXASM_DEBUG + * Generate debug info. + * + * D3DXASM_SKIPVALIDATION + * Do not validate the generated code against known capabilities and + * constraints. This option is only recommended when assembling shaders + * you KNOW will work. (ie. have assembled before without this option.) + */ #define D3DXASM_DEBUG (1 << 0) #define D3DXASM_SKIPVALIDATION (1 << 1) @@ -419,34 +413,34 @@ HRESULT WINAPI #ifdef __cplusplus extern "C" { -#endif //__cplusplus +#endif /* __cplusplus */ -//------------------------------------------------------------------------- -// D3DXAssembleShader: -// ------------------- -// Assembles an ascii description of a vertex or pixel shader into -// binary form. -// -// Parameters: -// pSrcFile -// Source file name -// hSrcModule -// Module handle. if NULL, current module will be used. -// pSrcResource -// Resource name in module -// pSrcData -// Pointer to source code -// SrcDataLen -// Size of source code, in bytes -// Flags -// D3DXASM_xxx flags -// ppConstants -// Returns an ID3DXBuffer object containing constant declarations. -// ppCompiledShader -// Returns an ID3DXBuffer object containing the object code. -// ppCompilationErrors -// Returns an ID3DXBuffer object containing ascii error messages -//------------------------------------------------------------------------- +/* + * D3DXAssembleShader: + * ------------------- + * Assembles an ascii description of a vertex or pixel shader into + * binary form. + * + * Parameters: + * pSrcFile + * Source file name + * hSrcModule + * Module handle. if NULL, current module will be used. + * pSrcResource + * Resource name in module + * pSrcData + * Pointer to source code + * SrcDataLen + * Size of source code, in bytes + * Flags + * D3DXASM_xxx flags + * ppConstants + * Returns an ID3DXBuffer object containing constant declarations. + * ppCompiledShader + * Returns an ID3DXBuffer object containing the object code. + * ppCompilationErrors + * Returns an ID3DXBuffer object containing ascii error messages + */ HRESULT WINAPI D3DXAssembleShaderFromFileA( @@ -506,33 +500,33 @@ HRESULT WINAPI #ifdef __cplusplus } -#endif //__cplusplus +#endif /* __cplusplus */ -/////////////////////////////////////////////////////////////////////////// -// Misc APIs: -/////////////////////////////////////////////////////////////////////////// +/* + * Misc APIs: + */ #ifdef __cplusplus extern "C" { -#endif //__cplusplus +#endif /* __cplusplus */ -//------------------------------------------------------------------------- -// D3DXGetErrorString: -// ------------------ -// Returns the error string for given an hresult. Interprets all D3DX and -// D3D hresults. -// -// Parameters: -// hr -// The error code to be deciphered. -// pBuffer -// Pointer to the buffer to be filled in. -// BufferLen -// Count of characters in buffer. Any error message longer than this -// length will be truncated to fit. -//------------------------------------------------------------------------- +/* + * D3DXGetErrorString: + * ------------------ + * Returns the error string for given an hresult. Interprets all D3DX and + * D3D hresults. + * + * Parameters: + * hr + * The error code to be deciphered. + * pBuffer + * Pointer to the buffer to be filled in. + * BufferLen + * Count of characters in buffer. Any error message longer than this + * length will be truncated to fit. + */ HRESULT WINAPI D3DXGetErrorStringA( HRESULT hr, @@ -555,6 +549,6 @@ HRESULT WINAPI #ifdef __cplusplus } -#endif //__cplusplus +#endif /* __cplusplus */ -#endif //__D3DX8CORE_H__ +#endif /* __D3DX8CORE_H__ */ diff --git a/gfx/include/d3d8/d3dx8effect.h b/gfx/include/d3d8/d3dx8effect.h index 8444935877..45b4fc8be9 100644 --- a/gfx/include/d3d8/d3dx8effect.h +++ b/gfx/include/d3d8/d3dx8effect.h @@ -1,11 +1,10 @@ -/////////////////////////////////////////////////////////////////////////// -// -// Copyright (C) Microsoft Corporation. All Rights Reserved. -// -// File: d3dx8effect.h -// Content: D3DX effect types and functions -// -/////////////////////////////////////////////////////////////////////////// +/* + * + * Copyright (C) Microsoft Corporation. All Rights Reserved. + * + * File: d3dx8effect.h + * Content: D3DX effect types and functions + */ #include "d3dx8.h" @@ -67,14 +66,14 @@ typedef struct _D3DXPASS_DESC -////////////////////////////////////////////////////////////////////////////// -// ID3DXEffect /////////////////////////////////////////////////////////////// -////////////////////////////////////////////////////////////////////////////// +/* + * ID3DXEffect + */ typedef interface ID3DXEffect ID3DXEffect; typedef interface ID3DXEffect *LPD3DXEFFECT; -// {648B1CEB-8D4E-4d66-B6FA-E44969E82E89} +/* {648B1CEB-8D4E-4d66-B6FA-E44969E82E89} */ DEFINE_GUID( IID_ID3DXEffect, 0x648b1ceb, 0x8d4e, 0x4d66, 0xb6, 0xfa, 0xe4, 0x49, 0x69, 0xe8, 0x2e, 0x89); @@ -84,12 +83,12 @@ DEFINE_GUID( IID_ID3DXEffect, DECLARE_INTERFACE_(ID3DXEffect, IUnknown) { - // IUnknown + /* IUnknown */ STDMETHOD(QueryInterface)(THIS_ REFIID iid, LPVOID *ppv) PURE; STDMETHOD_(ULONG, AddRef)(THIS) PURE; STDMETHOD_(ULONG, Release)(THIS) PURE; - // ID3DXEffect + /* ID3DXEffect */ STDMETHOD(GetDevice)(THIS_ LPDIRECT3DDEVICE8* ppDevice) PURE; STDMETHOD(GetDesc)(THIS_ D3DXEFFECT_DESC* pDesc) PURE; STDMETHOD(GetParameterDesc)(THIS_ LPCSTR pParameter, D3DXPARAMETER_DESC* pDesc) PURE; @@ -130,41 +129,41 @@ DECLARE_INTERFACE_(ID3DXEffect, IUnknown) -////////////////////////////////////////////////////////////////////////////// -// APIs ////////////////////////////////////////////////////////////////////// -////////////////////////////////////////////////////////////////////////////// +/* + * APIs + */ #ifdef __cplusplus extern "C" { -#endif //__cplusplus +#endif /* __cplusplus */ -//---------------------------------------------------------------------------- -// D3DXCreateEffect: -// ----------------- -// Creates an effect from an ascii or binaray effect description. -// -// Parameters: -// pDevice -// Pointer of the device on which to create the effect -// pSrcFile -// Name of the file containing the effect description -// hSrcModule -// Module handle. if NULL, current module will be used. -// pSrcResource -// Resource name in module -// pSrcData -// Pointer to effect description -// SrcDataSize -// Size of the effect description in bytes -// ppEffect -// Returns a buffer containing created effect. -// ppCompilationErrors -// Returns a buffer containing any error messages which occurred during -// compile. Or NULL if you do not care about the error messages. -// -//---------------------------------------------------------------------------- +/* + * D3DXCreateEffect: + * ----------------- + * Creates an effect from an ascii or binaray effect description. + * + * Parameters: + * pDevice + * Pointer of the device on which to create the effect + * pSrcFile + * Name of the file containing the effect description + * hSrcModule + * Module handle. if NULL, current module will be used. + * pSrcResource + * Resource name in module + * pSrcData + * Pointer to effect description + * SrcDataSize + * Size of the effect description in bytes + * ppEffect + * Returns a buffer containing created effect. + * ppCompilationErrors + * Returns a buffer containing any error messages which occurred during + * compile. Or NULL if you do not care about the error messages. + * + */ HRESULT WINAPI D3DXCreateEffectFromFileA( @@ -221,6 +220,6 @@ HRESULT WINAPI #ifdef __cplusplus } -#endif //__cplusplus +#endif /* __cplusplus */ -#endif //__D3DX8EFFECT_H__ +#endif /* __D3DX8EFFECT_H__ */ diff --git a/gfx/include/d3d8/d3dx8math.h b/gfx/include/d3d8/d3dx8math.h index a1a68fd6b6..c126258db3 100644 --- a/gfx/include/d3d8/d3dx8math.h +++ b/gfx/include/d3d8/d3dx8math.h @@ -1,11 +1,11 @@ -////////////////////////////////////////////////////////////////////////////// -// -// Copyright (C) Microsoft Corporation. All Rights Reserved. -// -// File: d3dx8math.h -// Content: D3DX math types and functions -// -////////////////////////////////////////////////////////////////////////////// +/* + * + * Copyright (C) Microsoft Corporation. All Rights Reserved. + * + * File: d3dx8math.h + * Content: D3DX math types and functions + * + */ #include "d3dx8.h" @@ -15,11 +15,11 @@ #include #pragma warning(disable:4201) /* anonymous unions warning */ -//=========================================================================== -// -// General purpose utilities -// -//=========================================================================== +/* + * + * General purpose utilities + * + */ #define D3DX_PI ((FLOAT) 3.141592654f) #define D3DX_1BYPI ((FLOAT) 0.318309886f) @@ -28,15 +28,15 @@ -//=========================================================================== -// -// Vectors -// -//=========================================================================== +/* + * + * Vectors + * + */ -//-------------------------- -// 2D Vector -//-------------------------- +/* + * 2D Vector + */ typedef struct D3DXVECTOR2 { #ifdef __cplusplus @@ -45,21 +45,21 @@ public: D3DXVECTOR2( CONST FLOAT * ); 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; @@ -72,14 +72,14 @@ public: public: -#endif //__cplusplus +#endif /* __cplusplus */ FLOAT x, y; } D3DXVECTOR2, *LPD3DXVECTOR2; -//-------------------------- -// 3D Vector -//-------------------------- +/* + * 3D Vector + */ #ifdef __cplusplus typedef struct D3DXVECTOR3 : public D3DVECTOR { @@ -89,21 +89,21 @@ public: D3DXVECTOR3( CONST D3DVECTOR& ); 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; @@ -116,14 +116,14 @@ public: } D3DXVECTOR3, *LPD3DXVECTOR3; -#else //!__cplusplus +#else /* !__cplusplus */ typedef struct _D3DVECTOR D3DXVECTOR3, *LPD3DXVECTOR3; -#endif //!__cplusplus +#endif /* !__cplusplus */ -//-------------------------- -// 4D Vector -//-------------------------- +/* + * 4D Vector + */ typedef struct D3DXVECTOR4 { #ifdef __cplusplus @@ -132,21 +132,21 @@ public: D3DXVECTOR4( CONST FLOAT* ); 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; @@ -158,16 +158,16 @@ public: BOOL operator != ( CONST D3DXVECTOR4& ) const; public: -#endif //__cplusplus +#endif /* __cplusplus */ FLOAT x, y, z, w; } D3DXVECTOR4, *LPD3DXVECTOR4; -//=========================================================================== -// -// Matrices -// -//=========================================================================== +/* + * + * Matrices + * + */ #ifdef __cplusplus typedef struct D3DXMATRIX : public D3DMATRIX { @@ -181,26 +181,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; @@ -214,27 +214,27 @@ 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 { @@ -273,8 +273,8 @@ typedef struct _D3DXMATRIXA16 : public D3DXMATRIX return p; }; - // This is NOT a virtual operator. If you cast - // to D3DXMATRIX, do not delete using that + /* This is NOT a virtual operator. If you cast + * to D3DXMATRIX, do not delete using that */ void operator delete(void* p) { if(p) @@ -285,8 +285,8 @@ typedef struct _D3DXMATRIXA16 : public D3DXMATRIX } }; - // This is NOT a virtual operator. If you cast - // to D3DXMATRIX, do not delete using that + /* This is NOT a virtual operator. If you cast + * to D3DXMATRIX, do not delete using that */ void operator delete[](void* p) { if(p) @@ -304,25 +304,25 @@ typedef struct _D3DXMATRIXA16 : public D3DXMATRIX }; } _D3DXMATRIXA16; -#else //!__cplusplus +#else /* !__cplusplus */ typedef D3DXMATRIX _D3DXMATRIXA16; -#endif //!__cplusplus +#endif /* !__cplusplus */ -#if _MSC_VER >= 1300 // VC7 +#if _MSC_VER >= 1300 /* VC7 */ #define _ALIGN_16 __declspec(align(16)) #else -#define _ALIGN_16 // Earlier compiler may not understand this, do nothing. +#define _ALIGN_16 /* Earlier compiler may not understand this, do nothing. */ #endif #define D3DXMATRIXA16 _ALIGN_16 _D3DXMATRIXA16 typedef D3DXMATRIXA16 *LPD3DXMATRIXA16; -//=========================================================================== -// -// Quaternions -// -//=========================================================================== +/* + * + * Quaternions + * + */ typedef struct D3DXQUATERNION { #ifdef __cplusplus @@ -331,22 +331,22 @@ public: D3DXQUATERNION( CONST FLOAT * ); D3DXQUATERNION( FLOAT x, FLOAT y, FLOAT z, FLOAT w ); - // casting + /* casting */ operator FLOAT* (); operator CONST FLOAT* () const; - // assignment operators + /* assignment operators */ D3DXQUATERNION& operator += ( CONST D3DXQUATERNION& ); D3DXQUATERNION& operator -= ( CONST D3DXQUATERNION& ); D3DXQUATERNION& operator *= ( CONST D3DXQUATERNION& ); D3DXQUATERNION& operator *= ( FLOAT ); D3DXQUATERNION& operator /= ( FLOAT ); - // unary operators + /* unary operators */ D3DXQUATERNION operator + () const; D3DXQUATERNION operator - () const; - // binary operators + /* binary operators */ D3DXQUATERNION operator + ( CONST D3DXQUATERNION& ) const; D3DXQUATERNION operator - ( CONST D3DXQUATERNION& ) const; D3DXQUATERNION operator * ( CONST D3DXQUATERNION& ) const; @@ -358,16 +358,16 @@ public: BOOL operator == ( CONST D3DXQUATERNION& ) const; BOOL operator != ( CONST D3DXQUATERNION& ) const; -#endif //__cplusplus +#endif /*__cplusplus */ FLOAT x, y, z, w; } D3DXQUATERNION, *LPD3DXQUATERNION; -//=========================================================================== -// -// Planes -// -//=========================================================================== +/* + * + * Planes + * + */ typedef struct D3DXPLANE { #ifdef __cplusplus @@ -376,28 +376,28 @@ public: D3DXPLANE( CONST FLOAT* ); D3DXPLANE( FLOAT a, FLOAT b, FLOAT c, FLOAT d ); - // casting + /* casting */ operator FLOAT* (); operator CONST FLOAT* () const; - // unary operators + /* unary operators */ D3DXPLANE operator + () const; D3DXPLANE operator - () const; - // binary operators + /* binary operators */ BOOL operator == ( CONST D3DXPLANE& ) const; BOOL operator != ( CONST D3DXPLANE& ) const; -#endif //__cplusplus +#endif /* __cplusplus */ FLOAT a, b, c, d; } D3DXPLANE, *LPD3DXPLANE; -//=========================================================================== -// -// Colors -// -//=========================================================================== +/* + * + * Colors + * + */ typedef struct D3DXCOLOR { @@ -409,7 +409,7 @@ public: D3DXCOLOR( CONST D3DCOLORVALUE& ); D3DXCOLOR( FLOAT r, FLOAT g, FLOAT b, FLOAT a ); - // casting + /* casting */ operator DWORD () const; operator FLOAT* (); @@ -421,17 +421,17 @@ public: operator D3DCOLORVALUE& (); operator CONST D3DCOLORVALUE& () const; - // assignment operators + /* assignment operators */ D3DXCOLOR& operator += ( CONST D3DXCOLOR& ); D3DXCOLOR& operator -= ( CONST D3DXCOLOR& ); D3DXCOLOR& operator *= ( FLOAT ); D3DXCOLOR& operator /= ( FLOAT ); - // unary operators + /* unary operators */ D3DXCOLOR operator + () const; D3DXCOLOR operator - () const; - // binary operators + /* binary operators */ D3DXCOLOR operator + ( CONST D3DXCOLOR& ) const; D3DXCOLOR operator - ( CONST D3DXCOLOR& ) const; D3DXCOLOR operator * ( FLOAT ) const; @@ -442,29 +442,29 @@ public: BOOL operator == ( CONST D3DXCOLOR& ) const; BOOL operator != ( CONST D3DXCOLOR& ) const; -#endif //__cplusplus +#endif /* __cplusplus */ FLOAT r, g, b, a; } D3DXCOLOR, *LPD3DXCOLOR; -//=========================================================================== -// -// D3DX math functions: -// -// NOTE: -// * All these functions can take the same object as in and out parameters. -// -// * Out parameters are typically also returned as return values, so that -// the output of one function may be used as a parameter to another. -// -//=========================================================================== +/* + * + * D3DX math functions: + * + * NOTE: + * * All these functions can take the same object as in and out parameters. + * + * * Out parameters are typically also returned as return values, so that + * the output of one function may be used as a parameter to another. + * + */ -//-------------------------- -// 2D Vector -//-------------------------- +/* + * 2D Vector + */ -// inline +/* inline */ FLOAT D3DXVec2Length ( CONST D3DXVECTOR2 *pV ); @@ -475,7 +475,7 @@ FLOAT D3DXVec2LengthSq FLOAT D3DXVec2Dot ( CONST D3DXVECTOR2 *pV1, CONST D3DXVECTOR2 *pV2 ); -// Z component of ((x1,y1,0) cross (x2,y2,0)) +/* Z component of ((x1,y1,0) cross (x2,y2,0)) */ FLOAT D3DXVec2CCW ( CONST D3DXVECTOR2 *pV1, CONST D3DXVECTOR2 *pV2 ); @@ -485,23 +485,23 @@ D3DXVECTOR2* D3DXVec2Add D3DXVECTOR2* D3DXVec2Subtract ( D3DXVECTOR2 *pOut, CONST D3DXVECTOR2 *pV1, CONST D3DXVECTOR2 *pV2 ); -// Minimize each component. x = min(x1, x2), y = min(y1, y2) +/* Minimize each component. x = min(x1, x2), y = min(y1, y2) */ D3DXVECTOR2* D3DXVec2Minimize ( D3DXVECTOR2 *pOut, CONST D3DXVECTOR2 *pV1, CONST D3DXVECTOR2 *pV2 ); -// Maximize each component. x = max(x1, x2), y = max(y1, y2) +/* Maximize each component. x = max(x1, x2), y = max(y1, y2) */ D3DXVECTOR2* D3DXVec2Maximize ( D3DXVECTOR2 *pOut, CONST D3DXVECTOR2 *pV1, CONST D3DXVECTOR2 *pV2 ); D3DXVECTOR2* D3DXVec2Scale ( D3DXVECTOR2 *pOut, CONST D3DXVECTOR2 *pV, FLOAT s ); -// Linear interpolation. V1 + s(V2-V1) +/* Linear interpolation. V1 + s(V2-V1) */ D3DXVECTOR2* D3DXVec2Lerp ( D3DXVECTOR2 *pOut, CONST D3DXVECTOR2 *pV1, CONST D3DXVECTOR2 *pV2, FLOAT s ); -// non-inline +/* non-inline */ #ifdef __cplusplus extern "C" { #endif @@ -509,31 +509,31 @@ extern "C" { D3DXVECTOR2* WINAPI D3DXVec2Normalize ( D3DXVECTOR2 *pOut, CONST D3DXVECTOR2 *pV ); -// Hermite interpolation between position V1, tangent T1 (when s == 0) -// and position V2, tangent T2 (when s == 1). +/* Hermite interpolation between position V1, tangent T1 (when s == 0) + * and position V2, tangent T2 (when s == 1). */ D3DXVECTOR2* WINAPI D3DXVec2Hermite ( D3DXVECTOR2 *pOut, CONST D3DXVECTOR2 *pV1, CONST D3DXVECTOR2 *pT1, CONST D3DXVECTOR2 *pV2, CONST D3DXVECTOR2 *pT2, FLOAT s ); -// CatmullRom interpolation between V1 (when s == 0) and V2 (when s == 1) +/* CatmullRom interpolation between V1 (when s == 0) and V2 (when s == 1) */ D3DXVECTOR2* WINAPI D3DXVec2CatmullRom ( D3DXVECTOR2 *pOut, CONST D3DXVECTOR2 *pV0, CONST D3DXVECTOR2 *pV1, CONST D3DXVECTOR2 *pV2, CONST D3DXVECTOR2 *pV3, FLOAT s ); -// Barycentric coordinates. V1 + f(V2-V1) + g(V3-V1) +/* Barycentric coordinates. V1 + f(V2-V1) + g(V3-V1) */ D3DXVECTOR2* WINAPI D3DXVec2BaryCentric ( D3DXVECTOR2 *pOut, CONST D3DXVECTOR2 *pV1, CONST D3DXVECTOR2 *pV2, CONST D3DXVECTOR2 *pV3, FLOAT f, FLOAT g); -// Transform (x, y, 0, 1) by matrix. +/* Transform (x, y, 0, 1) by matrix. */ D3DXVECTOR4* WINAPI D3DXVec2Transform ( D3DXVECTOR4 *pOut, CONST D3DXVECTOR2 *pV, CONST D3DXMATRIX *pM ); -// Transform (x, y, 0, 1) by matrix, project result back into w=1. +/* Transform (x, y, 0, 1) by matrix, project result back into w=1. */ D3DXVECTOR2* WINAPI D3DXVec2TransformCoord ( D3DXVECTOR2 *pOut, CONST D3DXVECTOR2 *pV, CONST D3DXMATRIX *pM ); -// Transform (x, y, 0, 0) by matrix. +/* Transform (x, y, 0, 0) by matrix. */ D3DXVECTOR2* WINAPI D3DXVec2TransformNormal ( D3DXVECTOR2 *pOut, CONST D3DXVECTOR2 *pV, CONST D3DXMATRIX *pM ); @@ -541,12 +541,11 @@ D3DXVECTOR2* WINAPI D3DXVec2TransformNormal } #endif +/* + * 3D Vector + */ -//-------------------------- -// 3D Vector -//-------------------------- - -// inline +/* inline */ FLOAT D3DXVec3Length ( CONST D3DXVECTOR3 *pV ); @@ -566,23 +565,23 @@ D3DXVECTOR3* D3DXVec3Add D3DXVECTOR3* D3DXVec3Subtract ( D3DXVECTOR3 *pOut, CONST D3DXVECTOR3 *pV1, CONST D3DXVECTOR3 *pV2 ); -// Minimize each component. x = min(x1, x2), y = min(y1, y2), ... +/* Minimize each component. x = min(x1, x2), y = min(y1, y2), ... */ D3DXVECTOR3* D3DXVec3Minimize ( D3DXVECTOR3 *pOut, CONST D3DXVECTOR3 *pV1, CONST D3DXVECTOR3 *pV2 ); -// Maximize each component. x = max(x1, x2), y = max(y1, y2), ... +/* Maximize each component. x = max(x1, x2), y = max(y1, y2), ... */ D3DXVECTOR3* D3DXVec3Maximize ( D3DXVECTOR3 *pOut, CONST D3DXVECTOR3 *pV1, CONST D3DXVECTOR3 *pV2 ); D3DXVECTOR3* D3DXVec3Scale ( D3DXVECTOR3 *pOut, CONST D3DXVECTOR3 *pV, FLOAT s); -// Linear interpolation. V1 + s(V2-V1) +/* Linear interpolation. V1 + s(V2-V1) */ D3DXVECTOR3* D3DXVec3Lerp ( D3DXVECTOR3 *pOut, CONST D3DXVECTOR3 *pV1, CONST D3DXVECTOR3 *pV2, FLOAT s ); -// non-inline +/* non-inline */ #ifdef __cplusplus extern "C" { #endif @@ -590,42 +589,42 @@ extern "C" { D3DXVECTOR3* WINAPI D3DXVec3Normalize ( D3DXVECTOR3 *pOut, CONST D3DXVECTOR3 *pV ); -// Hermite interpolation between position V1, tangent T1 (when s == 0) -// and position V2, tangent T2 (when s == 1). +/* Hermite interpolation between position V1, tangent T1 (when s == 0) + * and position V2, tangent T2 (when s == 1). */ D3DXVECTOR3* WINAPI D3DXVec3Hermite ( D3DXVECTOR3 *pOut, CONST D3DXVECTOR3 *pV1, CONST D3DXVECTOR3 *pT1, CONST D3DXVECTOR3 *pV2, CONST D3DXVECTOR3 *pT2, FLOAT s ); -// CatmullRom interpolation between V1 (when s == 0) and V2 (when s == 1) +/* CatmullRom interpolation between V1 (when s == 0) and V2 (when s == 1) */ D3DXVECTOR3* WINAPI D3DXVec3CatmullRom ( D3DXVECTOR3 *pOut, CONST D3DXVECTOR3 *pV0, CONST D3DXVECTOR3 *pV1, CONST D3DXVECTOR3 *pV2, CONST D3DXVECTOR3 *pV3, FLOAT s ); -// Barycentric coordinates. V1 + f(V2-V1) + g(V3-V1) +/* Barycentric coordinates. V1 + f(V2-V1) + g(V3-V1) */ D3DXVECTOR3* WINAPI D3DXVec3BaryCentric ( D3DXVECTOR3 *pOut, CONST D3DXVECTOR3 *pV1, CONST D3DXVECTOR3 *pV2, CONST D3DXVECTOR3 *pV3, FLOAT f, FLOAT g); -// Transform (x, y, z, 1) by matrix. +/* Transform (x, y, z, 1) by matrix. */ D3DXVECTOR4* WINAPI D3DXVec3Transform ( D3DXVECTOR4 *pOut, CONST D3DXVECTOR3 *pV, CONST D3DXMATRIX *pM ); -// Transform (x, y, z, 1) by matrix, project result back into w=1. +/* Transform (x, y, z, 1) by matrix, project result back into w=1. */ D3DXVECTOR3* WINAPI D3DXVec3TransformCoord ( D3DXVECTOR3 *pOut, CONST D3DXVECTOR3 *pV, CONST D3DXMATRIX *pM ); -// Transform (x, y, z, 0) by matrix. If you transforming a normal by a -// non-affine matrix, the matrix you pass to this function should be the -// transpose of the inverse of the matrix you would use to transform a coord. +/* Transform (x, y, z, 0) by matrix. If you transforming a normal by a + * non-affine matrix, the matrix you pass to this function should be the + * transpose of the inverse of the matrix you would use to transform a coord. */ D3DXVECTOR3* WINAPI D3DXVec3TransformNormal ( D3DXVECTOR3 *pOut, CONST D3DXVECTOR3 *pV, CONST D3DXMATRIX *pM ); -// Project vector from object space into screen space +/* Project vector from object space into screen space */ D3DXVECTOR3* WINAPI D3DXVec3Project ( D3DXVECTOR3 *pOut, CONST D3DXVECTOR3 *pV, CONST D3DVIEWPORT8 *pViewport, CONST D3DXMATRIX *pProjection, CONST D3DXMATRIX *pView, CONST D3DXMATRIX *pWorld); -// Project vector from screen space into object space +/* Project vector from screen space into object space */ D3DXVECTOR3* WINAPI D3DXVec3Unproject ( D3DXVECTOR3 *pOut, CONST D3DXVECTOR3 *pV, CONST D3DVIEWPORT8 *pViewport, CONST D3DXMATRIX *pProjection, CONST D3DXMATRIX *pView, CONST D3DXMATRIX *pWorld); @@ -634,13 +633,11 @@ D3DXVECTOR3* WINAPI D3DXVec3Unproject } #endif +/* + * 4D Vector + */ - -//-------------------------- -// 4D Vector -//-------------------------- - -// inline +/* inline */ FLOAT D3DXVec4Length ( CONST D3DXVECTOR4 *pV ); @@ -657,28 +654,28 @@ D3DXVECTOR4* D3DXVec4Add D3DXVECTOR4* D3DXVec4Subtract ( D3DXVECTOR4 *pOut, CONST D3DXVECTOR4 *pV1, CONST D3DXVECTOR4 *pV2); -// Minimize each component. x = min(x1, x2), y = min(y1, y2), ... +/* Minimize each component. x = min(x1, x2), y = min(y1, y2), ... */ D3DXVECTOR4* D3DXVec4Minimize ( D3DXVECTOR4 *pOut, CONST D3DXVECTOR4 *pV1, CONST D3DXVECTOR4 *pV2); -// Maximize each component. x = max(x1, x2), y = max(y1, y2), ... +/* Maximize each component. x = max(x1, x2), y = max(y1, y2), ... */ D3DXVECTOR4* D3DXVec4Maximize ( D3DXVECTOR4 *pOut, CONST D3DXVECTOR4 *pV1, CONST D3DXVECTOR4 *pV2); D3DXVECTOR4* D3DXVec4Scale ( D3DXVECTOR4 *pOut, CONST D3DXVECTOR4 *pV, FLOAT s); -// Linear interpolation. V1 + s(V2-V1) +/* Linear interpolation. V1 + s(V2-V1) */ D3DXVECTOR4* D3DXVec4Lerp ( D3DXVECTOR4 *pOut, CONST D3DXVECTOR4 *pV1, CONST D3DXVECTOR4 *pV2, FLOAT s ); -// non-inline +/* non-inline */ #ifdef __cplusplus extern "C" { #endif -// Cross-product in 4 dimensions. +/* Cross-product in 4 dimensions. */ D3DXVECTOR4* WINAPI D3DXVec4Cross ( D3DXVECTOR4 *pOut, CONST D3DXVECTOR4 *pV1, CONST D3DXVECTOR4 *pV2, CONST D3DXVECTOR4 *pV3); @@ -686,23 +683,23 @@ D3DXVECTOR4* WINAPI D3DXVec4Cross D3DXVECTOR4* WINAPI D3DXVec4Normalize ( D3DXVECTOR4 *pOut, CONST D3DXVECTOR4 *pV ); -// Hermite interpolation between position V1, tangent T1 (when s == 0) -// and position V2, tangent T2 (when s == 1). +/* Hermite interpolation between position V1, tangent T1 (when s == 0) + * and position V2, tangent T2 (when s == 1). */ D3DXVECTOR4* WINAPI D3DXVec4Hermite ( D3DXVECTOR4 *pOut, CONST D3DXVECTOR4 *pV1, CONST D3DXVECTOR4 *pT1, CONST D3DXVECTOR4 *pV2, CONST D3DXVECTOR4 *pT2, FLOAT s ); -// CatmullRom interpolation between V1 (when s == 0) and V2 (when s == 1) +/* CatmullRom interpolation between V1 (when s == 0) and V2 (when s == 1) */ D3DXVECTOR4* WINAPI D3DXVec4CatmullRom ( D3DXVECTOR4 *pOut, CONST D3DXVECTOR4 *pV0, CONST D3DXVECTOR4 *pV1, CONST D3DXVECTOR4 *pV2, CONST D3DXVECTOR4 *pV3, FLOAT s ); -// Barycentric coordinates. V1 + f(V2-V1) + g(V3-V1) +/* Barycentric coordinates. V1 + f(V2-V1) + g(V3-V1) */ D3DXVECTOR4* WINAPI D3DXVec4BaryCentric ( D3DXVECTOR4 *pOut, CONST D3DXVECTOR4 *pV1, CONST D3DXVECTOR4 *pV2, CONST D3DXVECTOR4 *pV3, FLOAT f, FLOAT g); -// Transform vector by matrix. +/* Transform vector by matrix. */ D3DXVECTOR4* WINAPI D3DXVec4Transform ( D3DXVECTOR4 *pOut, CONST D3DXVECTOR4 *pV, CONST D3DXMATRIX *pM ); @@ -711,11 +708,11 @@ D3DXVECTOR4* WINAPI D3DXVec4Transform #endif -//-------------------------- -// 4D Matrix -//-------------------------- +/* + * 4D Matrix + */ -// inline +/* inline */ D3DXMATRIX* D3DXMatrixIdentity ( D3DXMATRIX *pOut ); @@ -724,7 +721,7 @@ BOOL D3DXMatrixIsIdentity ( CONST D3DXMATRIX *pM ); -// non-inline +/* non-inline */ #ifdef __cplusplus extern "C" { #endif @@ -735,130 +732,130 @@ FLOAT WINAPI D3DXMatrixfDeterminant D3DXMATRIX* WINAPI D3DXMatrixTranspose ( D3DXMATRIX *pOut, CONST D3DXMATRIX *pM ); -// Matrix multiplication. The result represents the transformation M2 -// followed by the transformation M1. (Out = M1 * M2) +/* Matrix multiplication. The result represents the transformation M2 + * followed by the transformation M1. (Out = M1 * M2) */ D3DXMATRIX* WINAPI D3DXMatrixMultiply ( D3DXMATRIX *pOut, CONST D3DXMATRIX *pM1, CONST D3DXMATRIX *pM2 ); -// Matrix multiplication, followed by a transpose. (Out = T(M1 * M2)) +/* Matrix multiplication, followed by a transpose. (Out = T(M1 * M2)) */ D3DXMATRIX* WINAPI D3DXMatrixMultiplyTranspose ( D3DXMATRIX *pOut, CONST D3DXMATRIX *pM1, CONST D3DXMATRIX *pM2 ); -// Calculate inverse of matrix. Inversion my fail, in which case NULL will -// be returned. The determinant of pM is also returned it pfDeterminant -// is non-NULL. +/* Calculate inverse of matrix. Inversion my fail, in which case NULL will + * be returned. The determinant of pM is also returned it pfDeterminant + * is non-NULL. */ D3DXMATRIX* WINAPI D3DXMatrixInverse ( D3DXMATRIX *pOut, FLOAT *pDeterminant, CONST D3DXMATRIX *pM ); -// Build a matrix which scales by (sx, sy, sz) +/* Build a matrix which scales by (sx, sy, sz) */ D3DXMATRIX* WINAPI D3DXMatrixScaling ( D3DXMATRIX *pOut, FLOAT sx, FLOAT sy, FLOAT sz ); -// Build a matrix which translates by (x, y, z) +/* Build a matrix which translates by (x, y, z) */ D3DXMATRIX* WINAPI D3DXMatrixTranslation ( D3DXMATRIX *pOut, FLOAT x, FLOAT y, FLOAT z ); -// Build a matrix which rotates around the X axis +/* Build a matrix which rotates around the X axis */ D3DXMATRIX* WINAPI D3DXMatrixRotationX ( D3DXMATRIX *pOut, FLOAT Angle ); -// Build a matrix which rotates around the Y axis +/* Build a matrix which rotates around the Y axis */ D3DXMATRIX* WINAPI D3DXMatrixRotationY ( D3DXMATRIX *pOut, FLOAT Angle ); -// Build a matrix which rotates around the Z axis +/* Build a matrix which rotates around the Z axis */ D3DXMATRIX* WINAPI D3DXMatrixRotationZ ( D3DXMATRIX *pOut, FLOAT Angle ); -// Build a matrix which rotates around an arbitrary axis +/* Build a matrix which rotates around an arbitrary axis */ D3DXMATRIX* WINAPI D3DXMatrixRotationAxis ( D3DXMATRIX *pOut, CONST D3DXVECTOR3 *pV, FLOAT Angle ); -// Build a matrix from a quaternion +/* Build a matrix from a quaternion */ D3DXMATRIX* WINAPI D3DXMatrixRotationQuaternion ( D3DXMATRIX *pOut, CONST D3DXQUATERNION *pQ); -// Yaw around the Y axis, a pitch around the X axis, -// and a roll around the Z axis. +/* Yaw around the Y axis, a pitch around the X axis, + * and a roll around the Z axis. */ D3DXMATRIX* WINAPI D3DXMatrixRotationYawPitchRoll ( D3DXMATRIX *pOut, FLOAT Yaw, FLOAT Pitch, FLOAT Roll ); -// Build transformation matrix. NULL arguments are treated as identity. -// Mout = Msc-1 * Msr-1 * Ms * Msr * Msc * Mrc-1 * Mr * Mrc * Mt +/* Build transformation matrix. NULL arguments are treated as identity. + * Mout = Msc-1 * Msr-1 * Ms * Msr * Msc * Mrc-1 * Mr * Mrc * Mt */ D3DXMATRIX* WINAPI D3DXMatrixTransformation ( D3DXMATRIX *pOut, CONST D3DXVECTOR3 *pScalingCenter, CONST D3DXQUATERNION *pScalingRotation, CONST D3DXVECTOR3 *pScaling, CONST D3DXVECTOR3 *pRotationCenter, CONST D3DXQUATERNION *pRotation, CONST D3DXVECTOR3 *pTranslation); -// Build affine transformation matrix. NULL arguments are treated as identity. -// Mout = Ms * Mrc-1 * Mr * Mrc * Mt +/* Build affine transformation matrix. NULL arguments are treated as identity. + * Mout = Ms * Mrc-1 * Mr * Mrc * Mt */ D3DXMATRIX* WINAPI D3DXMatrixAffineTransformation ( D3DXMATRIX *pOut, FLOAT Scaling, CONST D3DXVECTOR3 *pRotationCenter, CONST D3DXQUATERNION *pRotation, CONST D3DXVECTOR3 *pTranslation); -// Build a lookat matrix. (right-handed) +/* Build a lookat matrix. (right-handed) */ D3DXMATRIX* WINAPI D3DXMatrixLookAtRH ( D3DXMATRIX *pOut, CONST D3DXVECTOR3 *pEye, CONST D3DXVECTOR3 *pAt, CONST D3DXVECTOR3 *pUp ); -// Build a lookat matrix. (left-handed) +/* Build a lookat matrix. (left-handed) */ D3DXMATRIX* WINAPI D3DXMatrixLookAtLH ( D3DXMATRIX *pOut, CONST D3DXVECTOR3 *pEye, CONST D3DXVECTOR3 *pAt, CONST D3DXVECTOR3 *pUp ); -// Build a perspective projection matrix. (right-handed) +/* Build a perspective projection matrix. (right-handed) */ D3DXMATRIX* WINAPI D3DXMatrixPerspectiveRH ( D3DXMATRIX *pOut, FLOAT w, FLOAT h, FLOAT zn, FLOAT zf ); -// Build a perspective projection matrix. (left-handed) +/* Build a perspective projection matrix. (left-handed) */ D3DXMATRIX* WINAPI D3DXMatrixPerspectiveLH ( D3DXMATRIX *pOut, FLOAT w, FLOAT h, FLOAT zn, FLOAT zf ); -// Build a perspective projection matrix. (right-handed) +/* Build a perspective projection matrix. (right-handed) */ D3DXMATRIX* WINAPI D3DXMatrixPerspectiveFovRH ( D3DXMATRIX *pOut, FLOAT fovy, FLOAT Aspect, FLOAT zn, FLOAT zf ); -// Build a perspective projection matrix. (left-handed) +/* Build a perspective projection matrix. (left-handed) */ D3DXMATRIX* WINAPI D3DXMatrixPerspectiveFovLH ( D3DXMATRIX *pOut, FLOAT fovy, FLOAT Aspect, FLOAT zn, FLOAT zf ); -// Build a perspective projection matrix. (right-handed) +/* Build a perspective projection matrix. (right-handed) */ D3DXMATRIX* WINAPI D3DXMatrixPerspectiveOffCenterRH ( D3DXMATRIX *pOut, FLOAT l, FLOAT r, FLOAT b, FLOAT t, FLOAT zn, FLOAT zf ); -// Build a perspective projection matrix. (left-handed) +/* Build a perspective projection matrix. (left-handed) */ D3DXMATRIX* WINAPI D3DXMatrixPerspectiveOffCenterLH ( D3DXMATRIX *pOut, FLOAT l, FLOAT r, FLOAT b, FLOAT t, FLOAT zn, FLOAT zf ); -// Build an ortho projection matrix. (right-handed) +/* Build an ortho projection matrix. (right-handed) */ D3DXMATRIX* WINAPI D3DXMatrixOrthoRH ( D3DXMATRIX *pOut, FLOAT w, FLOAT h, FLOAT zn, FLOAT zf ); -// Build an ortho projection matrix. (left-handed) +/* Build an ortho projection matrix. (left-handed) */ D3DXMATRIX* WINAPI D3DXMatrixOrthoLH ( D3DXMATRIX *pOut, FLOAT w, FLOAT h, FLOAT zn, FLOAT zf ); -// Build an ortho projection matrix. (right-handed) +/* Build an ortho projection matrix. (right-handed) */ D3DXMATRIX* WINAPI D3DXMatrixOrthoOffCenterRH ( D3DXMATRIX *pOut, FLOAT l, FLOAT r, FLOAT b, FLOAT t, FLOAT zn, FLOAT zf ); -// Build an ortho projection matrix. (left-handed) +/* Build an ortho projection matrix. (left-handed) */ D3DXMATRIX* WINAPI D3DXMatrixOrthoOffCenterLH ( D3DXMATRIX *pOut, FLOAT l, FLOAT r, FLOAT b, FLOAT t, FLOAT zn, FLOAT zf ); -// Build a matrix which flattens geometry into a plane, as if casting -// a shadow from a light. +/* Build a matrix which flattens geometry into a plane, as if casting + * a shadow from a light. */ D3DXMATRIX* WINAPI D3DXMatrixShadow ( D3DXMATRIX *pOut, CONST D3DXVECTOR4 *pLight, CONST D3DXPLANE *pPlane ); -// Build a matrix which reflects the coordinate system about a plane +/* Build a matrix which reflects the coordinate system about a plane */ D3DXMATRIX* WINAPI D3DXMatrixReflect ( D3DXMATRIX *pOut, CONST D3DXPLANE *pPlane ); @@ -867,58 +864,58 @@ D3DXMATRIX* WINAPI D3DXMatrixReflect #endif -//-------------------------- -// Quaternion -//-------------------------- +/* + * 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 ); BOOL D3DXQuaternionIsIdentity ( CONST D3DXQUATERNION *pQ ); -// (-x, -y, -z, w) +/* (-x, -y, -z, w) */ D3DXQUATERNION* D3DXQuaternionConjugate ( D3DXQUATERNION *pOut, CONST D3DXQUATERNION *pQ ); -// non-inline +/* non-inline */ #ifdef __cplusplus extern "C" { #endif -// Compute a quaternin's axis and angle of rotation. Expects unit quaternions. +/* Compute a quaternin's axis and angle of rotation. Expects unit quaternions. */ void WINAPI D3DXQuaternionToAxisAngle ( CONST D3DXQUATERNION *pQ, D3DXVECTOR3 *pAxis, FLOAT *pAngle ); -// Build a quaternion from a rotation matrix. +/* Build a quaternion from a rotation matrix. */ D3DXQUATERNION* WINAPI D3DXQuaternionRotationMatrix ( D3DXQUATERNION *pOut, CONST D3DXMATRIX *pM); -// Rotation about arbitrary axis. +/* Rotation about arbitrary axis. */ D3DXQUATERNION* WINAPI D3DXQuaternionRotationAxis ( D3DXQUATERNION *pOut, CONST D3DXVECTOR3 *pV, FLOAT Angle ); -// Yaw around the Y axis, a pitch around the X axis, -// and a roll around the Z axis. +/* Yaw around the Y axis, a pitch around the X axis, + * and a roll around the Z axis. */ D3DXQUATERNION* WINAPI D3DXQuaternionRotationYawPitchRoll ( D3DXQUATERNION *pOut, FLOAT Yaw, FLOAT Pitch, FLOAT Roll ); -// Quaternion multiplication. The result represents the rotation Q2 -// followed by the rotation Q1. (Out = Q2 * Q1) +/* Quaternion multiplication. The result represents the rotation Q2 + * followed by the rotation Q1. (Out = Q2 * Q1) */ D3DXQUATERNION* WINAPI D3DXQuaternionMultiply ( D3DXQUATERNION *pOut, CONST D3DXQUATERNION *pQ1, CONST D3DXQUATERNION *pQ2 ); @@ -926,43 +923,43 @@ D3DXQUATERNION* WINAPI D3DXQuaternionMultiply D3DXQUATERNION* WINAPI D3DXQuaternionNormalize ( D3DXQUATERNION *pOut, CONST D3DXQUATERNION *pQ ); -// Conjugate and re-norm +/* Conjugate and re-norm */ D3DXQUATERNION* WINAPI D3DXQuaternionInverse ( D3DXQUATERNION *pOut, CONST D3DXQUATERNION *pQ ); -// Expects unit quaternions. -// if q = (cos(theta), sin(theta) * v); ln(q) = (0, theta * v) +/* Expects unit quaternions. + * if q = (cos(theta), sin(theta) * v); ln(q) = (0, theta * v) */ D3DXQUATERNION* WINAPI D3DXQuaternionLn ( D3DXQUATERNION *pOut, CONST D3DXQUATERNION *pQ ); -// Expects pure quaternions. (w == 0) w is ignored in calculation. -// if q = (0, theta * v); exp(q) = (cos(theta), sin(theta) * v) +/* Expects pure quaternions. (w == 0) w is ignored in calculation. + * if q = (0, theta * v); exp(q) = (cos(theta), sin(theta) * v) */ D3DXQUATERNION* WINAPI D3DXQuaternionExp ( D3DXQUATERNION *pOut, CONST D3DXQUATERNION *pQ ); -// Spherical linear interpolation between Q1 (t == 0) and Q2 (t == 1). -// Expects unit quaternions. +/* Spherical linear interpolation between Q1 (t == 0) and Q2 (t == 1). + * Expects unit quaternions. */ D3DXQUATERNION* WINAPI D3DXQuaternionSlerp ( D3DXQUATERNION *pOut, CONST D3DXQUATERNION *pQ1, CONST D3DXQUATERNION *pQ2, FLOAT t ); -// Spherical quadrangle interpolation. -// Slerp(Slerp(Q1, C, t), Slerp(A, B, t), 2t(1-t)) +/* Spherical quadrangle interpolation. + * Slerp(Slerp(Q1, C, t), Slerp(A, B, t), 2t(1-t)) */ D3DXQUATERNION* WINAPI D3DXQuaternionSquad ( D3DXQUATERNION *pOut, CONST D3DXQUATERNION *pQ1, CONST D3DXQUATERNION *pA, CONST D3DXQUATERNION *pB, CONST D3DXQUATERNION *pC, FLOAT t ); -// Setup control points for spherical quadrangle interpolation -// from Q1 to Q2. The control points are chosen in such a way -// to ensure the continuity of tangents with adjacent segments. +/* Setup control points for spherical quadrangle interpolation + * from Q1 to Q2. The control points are chosen in such a way + * to ensure the continuity of tangents with adjacent segments. */ void WINAPI D3DXQuaternionSquadSetup ( D3DXQUATERNION *pAOut, D3DXQUATERNION *pBOut, D3DXQUATERNION *pCOut, CONST D3DXQUATERNION *pQ0, CONST D3DXQUATERNION *pQ1, CONST D3DXQUATERNION *pQ2, CONST D3DXQUATERNION *pQ3 ); -// Barycentric interpolation. -// Slerp(Slerp(Q1, Q2, f+g), Slerp(Q1, Q3, f+g), g/(f+g)) +/* Barycentric interpolation. + * Slerp(Slerp(Q1, Q2, f+g), Slerp(Q1, Q3, f+g), g/(f+g)) */ D3DXQUATERNION* WINAPI D3DXQuaternionBaryCentric ( D3DXQUATERNION *pOut, CONST D3DXQUATERNION *pQ1, CONST D3DXQUATERNION *pQ2, CONST D3DXQUATERNION *pQ3, @@ -973,50 +970,50 @@ D3DXQUATERNION* WINAPI D3DXQuaternionBaryCentric #endif -//-------------------------- -// Plane -//-------------------------- +/* + * Plane + */ -// inline +/* inline */ -// ax + by + cz + dw +/* ax + by + cz + dw */ FLOAT D3DXPlaneDot ( CONST D3DXPLANE *pP, CONST D3DXVECTOR4 *pV); -// ax + by + cz + d +/* ax + by + cz + d */ FLOAT D3DXPlaneDotCoord ( CONST D3DXPLANE *pP, CONST D3DXVECTOR3 *pV); -// ax + by + cz +/* ax + by + cz */ FLOAT D3DXPlaneDotNormal ( CONST D3DXPLANE *pP, CONST D3DXVECTOR3 *pV); -// non-inline +/* non-inline */ #ifdef __cplusplus extern "C" { #endif -// Normalize plane (so that |a,b,c| == 1) +/* Normalize plane (so that |a,b,c| == 1) */ D3DXPLANE* WINAPI D3DXPlaneNormalize ( D3DXPLANE *pOut, CONST D3DXPLANE *pP); -// Find the intersection between a plane and a line. If the line is -// parallel to the plane, NULL is returned. +/* Find the intersection between a plane and a line. If the line is + * parallel to the plane, NULL is returned. */ D3DXVECTOR3* WINAPI D3DXPlaneIntersectLine ( D3DXVECTOR3 *pOut, CONST D3DXPLANE *pP, CONST D3DXVECTOR3 *pV1, CONST D3DXVECTOR3 *pV2); -// Construct a plane from a point and a normal +/* Construct a plane from a point and a normal */ D3DXPLANE* WINAPI D3DXPlaneFromPointNormal ( D3DXPLANE *pOut, CONST D3DXVECTOR3 *pPoint, CONST D3DXVECTOR3 *pNormal); -// Construct a plane from 3 points +/* Construct a plane from 3 points */ D3DXPLANE* WINAPI D3DXPlaneFromPoints ( D3DXPLANE *pOut, CONST D3DXVECTOR3 *pV1, CONST D3DXVECTOR3 *pV2, CONST D3DXVECTOR3 *pV3); -// Transform a plane by a matrix. The vector (a,b,c) must be normal. -// M should be the inverse transpose of the transformation desired. +/* Transform a plane by a matrix. The vector (a,b,c) must be normal. + * M should be the inverse transpose of the transformation desired. */ D3DXPLANE* WINAPI D3DXPlaneTransform ( D3DXPLANE *pOut, CONST D3DXPLANE *pP, CONST D3DXMATRIX *pM ); @@ -1025,13 +1022,13 @@ D3DXPLANE* WINAPI D3DXPlaneTransform #endif -//-------------------------- -// Color -//-------------------------- +/* + * Color + */ -// inline +/* inline */ -// (1-r, 1-g, 1-b, a) +/* (1-r, 1-g, 1-b, a) */ D3DXCOLOR* D3DXColorNegative (D3DXCOLOR *pOut, CONST D3DXCOLOR *pC); @@ -1044,25 +1041,25 @@ D3DXCOLOR* D3DXColorSubtract D3DXCOLOR* D3DXColorScale (D3DXCOLOR *pOut, CONST D3DXCOLOR *pC, FLOAT s); -// (r1*r2, g1*g2, b1*b2, a1*a2) +/* (r1*r2, g1*g2, b1*b2, a1*a2) */ D3DXCOLOR* D3DXColorModulate (D3DXCOLOR *pOut, CONST D3DXCOLOR *pC1, CONST D3DXCOLOR *pC2); -// Linear interpolation of r,g,b, and a. C1 + s(C2-C1) +/* Linear interpolation of r,g,b, and a. C1 + s(C2-C1) */ D3DXCOLOR* D3DXColorLerp (D3DXCOLOR *pOut, CONST D3DXCOLOR *pC1, CONST D3DXCOLOR *pC2, FLOAT s); -// non-inline +/* non-inline */ #ifdef __cplusplus extern "C" { #endif -// Interpolate r,g,b between desaturated color and color. -// DesaturatedColor + s(Color - DesaturatedColor) +/* Interpolate r,g,b between desaturated color and color. + * DesaturatedColor + s(Color - DesaturatedColor) */ D3DXCOLOR* WINAPI D3DXColorAdjustSaturation (D3DXCOLOR *pOut, CONST D3DXCOLOR *pC, FLOAT s); -// Interpolate r,g,b between 50% grey and color. Grey + s(Color - Grey) +/* Interpolate r,g,b between 50% grey and color. Grey + s(Color - Grey) */ D3DXCOLOR* WINAPI D3DXColorAdjustContrast (D3DXCOLOR *pOut, CONST D3DXCOLOR *pC, FLOAT c); @@ -1070,19 +1067,16 @@ D3DXCOLOR* WINAPI D3DXColorAdjustContrast } #endif - - - -//-------------------------- -// Misc -//-------------------------- +/* + * Misc + */ #ifdef __cplusplus extern "C" { #endif -// Calculate Fresnel term given the cosine of theta (likely obtained by -// taking the dot of two normals), and the refraction index of the material. +/* Calculate Fresnel term given the cosine of theta (likely obtained by + * taking the dot of two normals), and the refraction index of the material. */ FLOAT WINAPI D3DXFresnelTerm (FLOAT CosTheta, FLOAT RefractionIndex); @@ -1090,18 +1084,16 @@ FLOAT WINAPI D3DXFresnelTerm } #endif - - -//=========================================================================== -// -// Matrix Stack -// -//=========================================================================== +/* + * + * Matrix Stack + * + */ typedef interface ID3DXMatrixStack ID3DXMatrixStack; typedef interface ID3DXMatrixStack *LPD3DXMATRIXSTACK; -// {E3357330-CC5E-11d2-A434-00A0C90629A8} +/* {E3357330-CC5E-11d2-A434-00A0C90629A8} */ DEFINE_GUID( IID_ID3DXMatrixStack, 0xe3357330, 0xcc5e, 0x11d2, 0xa4, 0x34, 0x0, 0xa0, 0xc9, 0x6, 0x29, 0xa8); @@ -1111,82 +1103,78 @@ DEFINE_GUID( IID_ID3DXMatrixStack, DECLARE_INTERFACE_(ID3DXMatrixStack, IUnknown) { - // - // IUnknown methods - // + /* IUnknown methods */ STDMETHOD(QueryInterface)(THIS_ REFIID riid, LPVOID * ppvObj) PURE; STDMETHOD_(ULONG,AddRef)(THIS) PURE; STDMETHOD_(ULONG,Release)(THIS) PURE; - // - // ID3DXMatrixStack methods - // + /* ID3DXMatrixStack methods */ - // Pops the top of the stack, returns the current top - // *after* popping the top. + /* Pops the top of the stack, returns the current top + * *after* popping the top. */ STDMETHOD(Pop)(THIS) PURE; - // Pushes the stack by one, duplicating the current matrix. + /* Pushes the stack by one, duplicating the current matrix. */ STDMETHOD(Push)(THIS) PURE; - // Loads identity in the current matrix. + /* Loads identity in the current matrix. */ STDMETHOD(LoadIdentity)(THIS) PURE; - // Loads the given matrix into the current matrix + /* Loads the given matrix into the current matrix */ STDMETHOD(LoadMatrix)(THIS_ CONST D3DXMATRIX* pM ) PURE; - // Right-Multiplies the given matrix to the current matrix. - // (transformation is about the current world origin) + /* Right-Multiplies the given matrix to the current matrix. + * (transformation is about the current world origin) */ STDMETHOD(MultMatrix)(THIS_ CONST D3DXMATRIX* pM ) PURE; - // Left-Multiplies the given matrix to the current matrix - // (transformation is about the local origin of the object) + /* Left-Multiplies the given matrix to the current matrix + * (transformation is about the local origin of the object) */ STDMETHOD(MultMatrixLocal)(THIS_ CONST D3DXMATRIX* pM ) PURE; - // Right multiply the current matrix with the computed rotation - // matrix, counterclockwise about the given axis with the given angle. - // (rotation is about the current world origin) + /* Right multiply the current matrix with the computed rotation + * matrix, counterclockwise about the given axis with the given angle. + * (rotation is about the current world origin) */ STDMETHOD(RotateAxis) (THIS_ CONST D3DXVECTOR3* pV, FLOAT Angle) PURE; - // Left multiply the current matrix with the computed rotation - // matrix, counterclockwise about the given axis with the given angle. - // (rotation is about the local origin of the object) + /* Left multiply the current matrix with the computed rotation + * matrix, counterclockwise about the given axis with the given angle. + * (rotation is about the local origin of the object) */ STDMETHOD(RotateAxisLocal) (THIS_ CONST D3DXVECTOR3* pV, FLOAT Angle) PURE; - // Right multiply the current matrix with the computed rotation - // matrix. All angles are counterclockwise. (rotation is about the - // current world origin) + /* Right multiply the current matrix with the computed rotation + * matrix. All angles are counterclockwise. (rotation is about the + * current world origin) - // The rotation is composed of a yaw around the Y axis, a pitch around - // the X axis, and a roll around the Z axis. + * The rotation is composed of a yaw around the Y axis, a pitch around + * the X axis, and a roll around the Z axis. */ STDMETHOD(RotateYawPitchRoll) (THIS_ FLOAT Yaw, FLOAT Pitch, FLOAT Roll) PURE; - // Left multiply the current matrix with the computed rotation - // matrix. All angles are counterclockwise. (rotation is about the - // local origin of the object) + /* Left multiply the current matrix with the computed rotation + * matrix. All angles are counterclockwise. (rotation is about the + * local origin of the object) - // The rotation is composed of a yaw around the Y axis, a pitch around - // the X axis, and a roll around the Z axis. + * The rotation is composed of a yaw around the Y axis, a pitch around + * the X axis, and a roll around the Z axis. */ STDMETHOD(RotateYawPitchRollLocal) (THIS_ FLOAT Yaw, FLOAT Pitch, FLOAT Roll) PURE; - // Right multiply the current matrix with the computed scale - // matrix. (transformation is about the current world origin) + /* Right multiply the current matrix with the computed scale + * matrix. (transformation is about the current world origin) */ STDMETHOD(Scale)(THIS_ FLOAT x, FLOAT y, FLOAT z) PURE; - // Left multiply the current matrix with the computed scale - // matrix. (transformation is about the local origin of the object) + /* Left multiply the current matrix with the computed scale + * matrix. (transformation is about the local origin of the object) */ STDMETHOD(ScaleLocal)(THIS_ FLOAT x, FLOAT y, FLOAT z) PURE; - // Right multiply the current matrix with the computed translation - // matrix. (transformation is about the current world origin) + /* Right multiply the current matrix with the computed translation + * matrix. (transformation is about the current world origin) */ STDMETHOD(Translate)(THIS_ FLOAT x, FLOAT y, FLOAT z ) PURE; - // Left multiply the current matrix with the computed translation - // matrix. (transformation is about the local origin of the object) + /* Left multiply the current matrix with the computed translation + * matrix. (transformation is about the local origin of the object) */ STDMETHOD(TranslateLocal)(THIS_ FLOAT x, FLOAT y, FLOAT z) PURE; /* Obtain the current matrix at the top of the stack */ diff --git a/gfx/include/d3d8/d3dx8math.inl b/gfx/include/d3d8/d3dx8math.inl index 00f2eabdd9..ca94a797ba 100644 --- a/gfx/include/d3d8/d3dx8math.inl +++ b/gfx/include/d3d8/d3dx8math.inl @@ -1,27 +1,26 @@ -////////////////////////////////////////////////////////////////////////////// -// -// Copyright (C) 1998 Microsoft Corporation. All Rights Reserved. -// -// File: d3dx8math.inl -// Content: D3DX math inline functions -// -////////////////////////////////////////////////////////////////////////////// +/* + * + * Copyright (C) 1998 Microsoft Corporation. All Rights Reserved. + * + * File: d3dx8math.inl + * Content: D3DX math inline functions + * + */ #ifndef __D3DX8MATH_INL__ #define __D3DX8MATH_INL__ - -//=========================================================================== -// -// Inline Class Methods -// -//=========================================================================== +/* + * + * Inline Class Methods + * + */ #ifdef __cplusplus -//-------------------------- -// 2D Vector -//-------------------------- +/* + * 2D Vector + */ D3DXINLINE D3DXVECTOR2::D3DXVECTOR2( CONST FLOAT *pf ) @@ -42,7 +41,7 @@ D3DXVECTOR2::D3DXVECTOR2( FLOAT fx, FLOAT fy ) y = fy; } -// casting +/* casting */ D3DXINLINE D3DXVECTOR2::operator FLOAT* () { @@ -55,7 +54,7 @@ D3DXVECTOR2::operator CONST FLOAT* () const return (CONST FLOAT *) &x; } -// assignment operators +/* assignment operators */ D3DXINLINE D3DXVECTOR2& D3DXVECTOR2::operator += ( CONST D3DXVECTOR2& v ) { @@ -89,7 +88,7 @@ D3DXVECTOR2::operator /= ( FLOAT f ) return *this; } -// unary operators +/* unary operators */ D3DXINLINE D3DXVECTOR2 D3DXVECTOR2::operator + () const { @@ -102,7 +101,7 @@ D3DXVECTOR2::operator - () const return D3DXVECTOR2(-x, -y); } -// binary operators +/* binary operators */ D3DXINLINE D3DXVECTOR2 D3DXVECTOR2::operator + ( CONST D3DXVECTOR2& v ) const { @@ -150,9 +149,9 @@ D3DXVECTOR2::operator != ( CONST D3DXVECTOR2& v ) const -//-------------------------- -// 3D Vector -//-------------------------- +/* + * 3D Vector + */ D3DXINLINE D3DXVECTOR3::D3DXVECTOR3( CONST FLOAT *pf ) { @@ -183,7 +182,7 @@ D3DXVECTOR3::D3DXVECTOR3( FLOAT fx, FLOAT fy, FLOAT fz ) } -// casting +/* casting */ D3DXINLINE D3DXVECTOR3::operator FLOAT* () { @@ -197,7 +196,7 @@ D3DXVECTOR3::operator CONST FLOAT* () const } -// assignment operators +/* assignment operators */ D3DXINLINE D3DXVECTOR3& D3DXVECTOR3::operator += ( CONST D3DXVECTOR3& v ) { @@ -235,8 +234,7 @@ D3DXVECTOR3::operator /= ( FLOAT f ) return *this; } - -// unary operators +/* unary operators */ D3DXINLINE D3DXVECTOR3 D3DXVECTOR3::operator + () const { @@ -249,8 +247,7 @@ D3DXVECTOR3::operator - () const return D3DXVECTOR3(-x, -y, -z); } - -// binary operators +/* binary operators */ D3DXINLINE D3DXVECTOR3 D3DXVECTOR3::operator + ( CONST D3DXVECTOR3& v ) const { @@ -296,11 +293,9 @@ D3DXVECTOR3::operator != ( CONST D3DXVECTOR3& v ) const return x != v.x || y != v.y || z != v.z; } - - -//-------------------------- -// 4D Vector -//-------------------------- +/* + * 4D Vector + */ D3DXINLINE D3DXVECTOR4::D3DXVECTOR4( CONST FLOAT *pf ) { @@ -324,8 +319,7 @@ D3DXVECTOR4::D3DXVECTOR4( FLOAT fx, FLOAT fy, FLOAT fz, FLOAT fw ) w = fw; } - -// casting +/* casting */ D3DXINLINE D3DXVECTOR4::operator FLOAT* () { @@ -339,7 +333,7 @@ D3DXVECTOR4::operator CONST FLOAT* () const } -// assignment operators +/* assignment operators */ D3DXINLINE D3DXVECTOR4& D3DXVECTOR4::operator += ( CONST D3DXVECTOR4& v ) { @@ -381,8 +375,7 @@ D3DXVECTOR4::operator /= ( FLOAT f ) return *this; } - -// unary operators +/* unary operators */ D3DXINLINE D3DXVECTOR4 D3DXVECTOR4::operator + () const { @@ -396,7 +389,7 @@ D3DXVECTOR4::operator - () const } -// binary operators +/* binary operators */ D3DXINLINE D3DXVECTOR4 D3DXVECTOR4::operator + ( CONST D3DXVECTOR4& v ) const { @@ -443,9 +436,9 @@ D3DXVECTOR4::operator != ( CONST D3DXVECTOR4& v ) const } -//-------------------------- -// Matrix -//-------------------------- +/* + * Matrix + */ D3DXINLINE D3DXMATRIX::D3DXMATRIX( CONST FLOAT* pf ) { @@ -475,9 +468,7 @@ D3DXMATRIX::D3DXMATRIX( FLOAT f11, FLOAT f12, FLOAT f13, FLOAT f14, _41 = f41; _42 = f42; _43 = f43; _44 = f44; } - - -// access grants +/* access grants */ D3DXINLINE FLOAT& D3DXMATRIX::operator () ( UINT iRow, UINT iCol ) { @@ -491,7 +482,7 @@ D3DXMATRIX::operator () ( UINT iRow, UINT iCol ) const } -// casting operators +/* casting operators */ D3DXINLINE D3DXMATRIX::operator FLOAT* () { @@ -505,7 +496,7 @@ D3DXMATRIX::operator CONST FLOAT* () const } -// assignment operators +/* assignment operators */ D3DXINLINE D3DXMATRIX& D3DXMATRIX::operator *= ( CONST D3DXMATRIX& mat ) { @@ -554,8 +545,7 @@ D3DXMATRIX::operator /= ( FLOAT f ) return *this; } - -// unary operators +/* unary operators */ D3DXINLINE D3DXMATRIX D3DXMATRIX::operator + () const { @@ -571,8 +561,7 @@ D3DXMATRIX::operator - () const -_41, -_42, -_43, -_44); } - -// binary operators +/* binary operators */ D3DXINLINE D3DXMATRIX D3DXMATRIX::operator * ( CONST D3DXMATRIX& mat ) const { @@ -643,9 +632,9 @@ D3DXMATRIX::operator != ( CONST D3DXMATRIX& mat ) const -//-------------------------- -// Quaternion -//-------------------------- +/* + * Quaternion + */ D3DXINLINE D3DXQUATERNION::D3DXQUATERNION( CONST FLOAT* pf ) @@ -671,7 +660,7 @@ D3DXQUATERNION::D3DXQUATERNION( FLOAT fx, FLOAT fy, FLOAT fz, FLOAT fw ) } -// casting +/* casting */ D3DXINLINE D3DXQUATERNION::operator FLOAT* () { @@ -685,7 +674,7 @@ D3DXQUATERNION::operator CONST FLOAT* () const } -// assignment operators +/* assignment operators */ D3DXINLINE D3DXQUATERNION& D3DXQUATERNION::operator += ( CONST D3DXQUATERNION& q ) { @@ -735,7 +724,7 @@ D3DXQUATERNION::operator /= ( FLOAT f ) } -// unary operators +/* unary operators */ D3DXINLINE D3DXQUATERNION D3DXQUATERNION::operator + () const { @@ -749,7 +738,7 @@ D3DXQUATERNION::operator - () const } -// binary operators +/* binary operators */ D3DXINLINE D3DXQUATERNION D3DXQUATERNION::operator + ( CONST D3DXQUATERNION& q ) const { @@ -805,9 +794,9 @@ D3DXQUATERNION::operator != ( CONST D3DXQUATERNION& q ) const -//-------------------------- -// Plane -//-------------------------- +/* + * Plane + */ D3DXINLINE D3DXPLANE::D3DXPLANE( CONST FLOAT* pf ) @@ -832,8 +821,7 @@ D3DXPLANE::D3DXPLANE( FLOAT fa, FLOAT fb, FLOAT fc, FLOAT fd ) d = fd; } - -// casting +/* casting */ D3DXINLINE D3DXPLANE::operator FLOAT* () { @@ -847,7 +835,7 @@ D3DXPLANE::operator CONST FLOAT* () const } -// unary operators +/* unary operators */ D3DXINLINE D3DXPLANE D3DXPLANE::operator + () const { @@ -860,8 +848,7 @@ D3DXPLANE::operator - () const return D3DXPLANE(-a, -b, -c, -d); } - -// binary operators +/* binary operators */ D3DXINLINE BOOL D3DXPLANE::operator == ( CONST D3DXPLANE& p ) const { @@ -874,12 +861,9 @@ D3DXPLANE::operator != ( CONST D3DXPLANE& p ) const return a != p.a || b != p.b || c != p.c || d != p.d; } - - - -//-------------------------- -// Color -//-------------------------- +/* + * Color + */ D3DXINLINE D3DXCOLOR::D3DXCOLOR( DWORD dw ) @@ -923,8 +907,7 @@ D3DXCOLOR::D3DXCOLOR( FLOAT fr, FLOAT fg, FLOAT fb, FLOAT fa ) a = fa; } - -// casting +/* casting */ D3DXINLINE D3DXCOLOR::operator DWORD () const { @@ -975,8 +958,7 @@ D3DXCOLOR::operator CONST D3DCOLORVALUE& () const return *((CONST D3DCOLORVALUE *) &r); } - -// assignment operators +/* assignment operators */ D3DXINLINE D3DXCOLOR& D3DXCOLOR::operator += ( CONST D3DXCOLOR& c ) { @@ -1018,8 +1000,7 @@ D3DXCOLOR::operator /= ( FLOAT f ) return *this; } - -// unary operators +/* unary operators */ D3DXINLINE D3DXCOLOR D3DXCOLOR::operator + () const { @@ -1033,7 +1014,7 @@ D3DXCOLOR::operator - () const } -// binary operators +/* binary operators */ D3DXINLINE D3DXCOLOR D3DXCOLOR::operator + ( CONST D3DXCOLOR& c ) const { @@ -1080,20 +1061,18 @@ D3DXCOLOR::operator != ( CONST D3DXCOLOR& c ) const } -#endif //__cplusplus +#endif /* __cplusplus */ + +/* + * + * Inline functions + * + */ - -//=========================================================================== -// -// Inline functions -// -//=========================================================================== - - -//-------------------------- -// 2D Vector -//-------------------------- +/* + * 2D Vector + */ D3DXINLINE FLOAT D3DXVec2Length ( CONST D3DXVECTOR2 *pV ) @@ -1223,9 +1202,9 @@ D3DXINLINE D3DXVECTOR2* D3DXVec2Lerp } -//-------------------------- -// 3D Vector -//-------------------------- +/* + * 3D Vector + */ D3DXINLINE FLOAT D3DXVec3Length ( CONST D3DXVECTOR3 *pV ) @@ -1368,9 +1347,9 @@ D3DXINLINE D3DXVECTOR3* D3DXVec3Lerp } -//-------------------------- -// 4D Vector -//-------------------------- +/* + * 4D Vector + */ D3DXINLINE FLOAT D3DXVec4Length ( CONST D3DXVECTOR4 *pV ) @@ -1501,9 +1480,9 @@ D3DXINLINE D3DXVECTOR4* D3DXVec4Lerp } -//-------------------------- -// 4D Matrix -//-------------------------- +/* + * 4D Matrix + */ D3DXINLINE D3DXMATRIX* D3DXMatrixIdentity ( D3DXMATRIX *pOut ) @@ -1538,9 +1517,9 @@ D3DXINLINE BOOL D3DXMatrixIsIdentity } -//-------------------------- -// Quaternion -//-------------------------- +/* + * Quaternion + */ D3DXINLINE FLOAT D3DXQuaternionLength ( CONST D3DXQUATERNION *pQ ) @@ -1621,9 +1600,9 @@ D3DXINLINE D3DXQUATERNION* D3DXQuaternionConjugate } -//-------------------------- -// Plane -//-------------------------- +/* + * Plane + */ D3DXINLINE FLOAT D3DXPlaneDot ( CONST D3DXPLANE *pP, CONST D3DXVECTOR4 *pV) @@ -1659,9 +1638,9 @@ D3DXINLINE FLOAT D3DXPlaneDotNormal } -//-------------------------- -// Color -//-------------------------- +/* + * Color + */ D3DXINLINE D3DXCOLOR* D3DXColorNegative (D3DXCOLOR *pOut, CONST D3DXCOLOR *pC) @@ -1754,4 +1733,4 @@ D3DXINLINE D3DXCOLOR* D3DXColorLerp } -#endif // __D3DX8MATH_INL__ +#endif /* __D3DX8MATH_INL__ */ diff --git a/gfx/include/d3d8/d3dx8mesh.h b/gfx/include/d3d8/d3dx8mesh.h index f17d92c8bd..41e623cabf 100644 --- a/gfx/include/d3d8/d3dx8mesh.h +++ b/gfx/include/d3d8/d3dx8mesh.h @@ -1,76 +1,74 @@ -////////////////////////////////////////////////////////////////////////////// -// -// Copyright (C) Microsoft Corporation. All Rights Reserved. -// -// File: d3dx8mesh.h -// Content: D3DX mesh types and functions -// -////////////////////////////////////////////////////////////////////////////// +/* + * + * Copyright (C) Microsoft Corporation. All Rights Reserved. + * + * File: d3dx8mesh.h + * Content: D3DX mesh types and functions + */ #include "d3dx8.h" #ifndef __D3DX8MESH_H__ #define __D3DX8MESH_H__ -#include "dxfile.h" // defines LPDIRECTXFILEDATA +#include "dxfile.h" /* defines LPDIRECTXFILEDATA */ -// {2A835771-BF4D-43f4-8E14-82A809F17D8A} +/* {2A835771-BF4D-43f4-8E14-82A809F17D8A} */ DEFINE_GUID(IID_ID3DXBaseMesh, 0x2a835771, 0xbf4d, 0x43f4, 0x8e, 0x14, 0x82, 0xa8, 0x9, 0xf1, 0x7d, 0x8a); -// {CCAE5C3B-4DD1-4d0f-997E-4684CA64557F} +/* {CCAE5C3B-4DD1-4d0f-997E-4684CA64557F} */ DEFINE_GUID(IID_ID3DXMesh, 0xccae5c3b, 0x4dd1, 0x4d0f, 0x99, 0x7e, 0x46, 0x84, 0xca, 0x64, 0x55, 0x7f); -// {19FBE386-C282-4659-97BD-CB869B084A6C} +/* {19FBE386-C282-4659-97BD-CB869B084A6C} */ DEFINE_GUID(IID_ID3DXPMesh, 0x19fbe386, 0xc282, 0x4659, 0x97, 0xbd, 0xcb, 0x86, 0x9b, 0x8, 0x4a, 0x6c); -// {4E3CA05C-D4FF-4d11-8A02-16459E08F6F4} +/* {4E3CA05C-D4FF-4d11-8A02-16459E08F6F4} */ DEFINE_GUID(IID_ID3DXSPMesh, 0x4e3ca05c, 0xd4ff, 0x4d11, 0x8a, 0x2, 0x16, 0x45, 0x9e, 0x8, 0xf6, 0xf4); -// {8DB06ECC-EBFC-408a-9404-3074B4773515} +/* {8DB06ECC-EBFC-408a-9404-3074B4773515} */ DEFINE_GUID(IID_ID3DXSkinMesh, 0x8db06ecc, 0xebfc, 0x408a, 0x94, 0x4, 0x30, 0x74, 0xb4, 0x77, 0x35, 0x15); -// Mesh options - lower 3 bytes only, upper byte used by _D3DXMESHOPT option flags +/* Mesh options - lower 3 bytes only, upper byte used by _D3DXMESHOPT option flags */ enum _D3DXMESH { - D3DXMESH_32BIT = 0x001, // If set, then use 32 bit indices, if not set use 16 bit indices. - D3DXMESH_DONOTCLIP = 0x002, // Use D3DUSAGE_DONOTCLIP for VB & IB. - D3DXMESH_POINTS = 0x004, // Use D3DUSAGE_POINTS for VB & IB. - D3DXMESH_RTPATCHES = 0x008, // Use D3DUSAGE_RTPATCHES for VB & IB. - D3DXMESH_NPATCHES = 0x4000,// Use D3DUSAGE_NPATCHES for VB & IB. - D3DXMESH_VB_SYSTEMMEM = 0x010, // Use D3DPOOL_SYSTEMMEM for VB. Overrides D3DXMESH_MANAGEDVERTEXBUFFER - D3DXMESH_VB_MANAGED = 0x020, // Use D3DPOOL_MANAGED for VB. - D3DXMESH_VB_WRITEONLY = 0x040, // Use D3DUSAGE_WRITEONLY for VB. - D3DXMESH_VB_DYNAMIC = 0x080, // Use D3DUSAGE_DYNAMIC for VB. - D3DXMESH_VB_SOFTWAREPROCESSING = 0x8000, // Use D3DUSAGE_SOFTWAREPROCESSING for VB. - D3DXMESH_IB_SYSTEMMEM = 0x100, // Use D3DPOOL_SYSTEMMEM for IB. Overrides D3DXMESH_MANAGEDINDEXBUFFER - D3DXMESH_IB_MANAGED = 0x200, // Use D3DPOOL_MANAGED for IB. - D3DXMESH_IB_WRITEONLY = 0x400, // Use D3DUSAGE_WRITEONLY for IB. - D3DXMESH_IB_DYNAMIC = 0x800, // Use D3DUSAGE_DYNAMIC for IB. - D3DXMESH_IB_SOFTWAREPROCESSING= 0x10000, // Use D3DUSAGE_SOFTWAREPROCESSING for IB. + D3DXMESH_32BIT = 0x001, /* If set, then use 32 bit indices, if not set use 16 bit indices. */ + D3DXMESH_DONOTCLIP = 0x002, /* Use D3DUSAGE_DONOTCLIP for VB & IB. */ + D3DXMESH_POINTS = 0x004, /* Use D3DUSAGE_POINTS for VB & IB. */ + D3DXMESH_RTPATCHES = 0x008, /* Use D3DUSAGE_RTPATCHES for VB & IB. */ + D3DXMESH_NPATCHES = 0x4000,/* Use D3DUSAGE_NPATCHES for VB & IB. */ + D3DXMESH_VB_SYSTEMMEM = 0x010, /* Use D3DPOOL_SYSTEMMEM for VB. Overrides D3DXMESH_MANAGEDVERTEXBUFFER */ + D3DXMESH_VB_MANAGED = 0x020, /* Use D3DPOOL_MANAGED for VB. */ + D3DXMESH_VB_WRITEONLY = 0x040, /* Use D3DUSAGE_WRITEONLY for VB. */ + D3DXMESH_VB_DYNAMIC = 0x080, /* Use D3DUSAGE_DYNAMIC for VB. */ + D3DXMESH_VB_SOFTWAREPROCESSING = 0x8000, /* Use D3DUSAGE_SOFTWAREPROCESSING for VB. */ + D3DXMESH_IB_SYSTEMMEM = 0x100, /* Use D3DPOOL_SYSTEMMEM for IB. Overrides D3DXMESH_MANAGEDINDEXBUFFER */ + D3DXMESH_IB_MANAGED = 0x200, /* Use D3DPOOL_MANAGED for IB. */ + D3DXMESH_IB_WRITEONLY = 0x400, /* Use D3DUSAGE_WRITEONLY for IB. */ + D3DXMESH_IB_DYNAMIC = 0x800, /* Use D3DUSAGE_DYNAMIC for IB. */ + D3DXMESH_IB_SOFTWAREPROCESSING= 0x10000, /* Use D3DUSAGE_SOFTWAREPROCESSING for IB. */ - D3DXMESH_VB_SHARE = 0x1000, // Valid for Clone* calls only, forces cloned mesh/pmesh to share vertex buffer + D3DXMESH_VB_SHARE = 0x1000, /* Valid for Clone* calls only, forces cloned mesh/pmesh to share vertex buffer */ - D3DXMESH_USEHWONLY = 0x2000, // Valid for ID3DXSkinMesh::ConvertToBlendedMesh + D3DXMESH_USEHWONLY = 0x2000, /* Valid for ID3DXSkinMesh::ConvertToBlendedMesh */ - // Helper options - D3DXMESH_SYSTEMMEM = 0x110, // D3DXMESH_VB_SYSTEMMEM | D3DXMESH_IB_SYSTEMMEM - D3DXMESH_MANAGED = 0x220, // D3DXMESH_VB_MANAGED | D3DXMESH_IB_MANAGED - D3DXMESH_WRITEONLY = 0x440, // D3DXMESH_VB_WRITEONLY | D3DXMESH_IB_WRITEONLY - D3DXMESH_DYNAMIC = 0x880, // D3DXMESH_VB_DYNAMIC | D3DXMESH_IB_DYNAMIC - D3DXMESH_SOFTWAREPROCESSING = 0x18000, // D3DXMESH_VB_SOFTWAREPROCESSING | D3DXMESH_IB_SOFTWAREPROCESSING + /* Helper options */ + D3DXMESH_SYSTEMMEM = 0x110, /* D3DXMESH_VB_SYSTEMMEM | D3DXMESH_IB_SYSTEMMEM */ + D3DXMESH_MANAGED = 0x220, /* D3DXMESH_VB_MANAGED | D3DXMESH_IB_MANAGED */ + D3DXMESH_WRITEONLY = 0x440, /* D3DXMESH_VB_WRITEONLY | D3DXMESH_IB_WRITEONLY */ + D3DXMESH_DYNAMIC = 0x880, /* D3DXMESH_VB_DYNAMIC | D3DXMESH_IB_DYNAMIC */ + D3DXMESH_SOFTWAREPROCESSING = 0x18000 /* D3DXMESH_VB_SOFTWAREPROCESSING | D3DXMESH_IB_SOFTWAREPROCESSING */ }; -// option field values for specifying min value in D3DXGeneratePMesh and D3DXSimplifyMesh +/* option field values for specifying min value in D3DXGeneratePMesh and D3DXSimplifyMesh */ enum _D3DXMESHSIMP { D3DXMESHSIMP_VERTEX = 0x1, - D3DXMESHSIMP_FACE = 0x2, - + D3DXMESHSIMP_FACE = 0x2 }; enum _MAX_FVF_DECL_SIZE @@ -97,7 +95,7 @@ typedef D3DXATTRIBUTERANGE* LPD3DXATTRIBUTERANGE; #ifdef __cplusplus extern "C" { -#endif //__cplusplus +#endif /* __cplusplus */ struct D3DXMATERIAL { D3DMATERIAL8 MatD3D; @@ -106,7 +104,7 @@ struct D3DXMATERIAL typedef struct D3DXMATERIAL *LPD3DXMATERIAL; #ifdef __cplusplus } -#endif //__cplusplus +#endif /* __cplusplus */ typedef struct _D3DXATTRIBUTEWEIGHTS { @@ -122,14 +120,14 @@ typedef D3DXATTRIBUTEWEIGHTS* LPD3DXATTRIBUTEWEIGHTS; enum _D3DXWELDEPSILONSFLAGS { - D3DXWELDEPSILONS_WELDALL = 0x1, // weld all vertices marked by adjacency as being overlapping + D3DXWELDEPSILONS_WELDALL = 0x1, /* weld all vertices marked by adjacency as being overlapping */ - D3DXWELDEPSILONS_WELDPARTIALMATCHES = 0x2, // if a given vertex component is within epsilon, modify partial matched - // vertices so that both components identical AND if all components "equal" - // remove one of the vertices - D3DXWELDEPSILONS_DONOTREMOVEVERTICES = 0x4, // instructs weld to only allow modifications to vertices and not removal - // ONLY valid if D3DXWELDEPSILONS_WELDPARTIALMATCHES is set - // useful to modify vertices to be equal, but not allow vertices to be removed + D3DXWELDEPSILONS_WELDPARTIALMATCHES = 0x2, /* if a given vertex component is within epsilon, modify partial matched + * vertices so that both components identical AND if all components "equal" + * remove one of the vertices */ + D3DXWELDEPSILONS_DONOTREMOVEVERTICES = 0x4 /* instructs weld to only allow modifications to vertices and not removal + * ONLY valid if D3DXWELDEPSILONS_WELDPARTIALMATCHES is set + * useful to modify vertices to be equal, but not allow vertices to be removed */ }; typedef struct _D3DXWELDEPSILONS @@ -148,12 +146,12 @@ typedef D3DXWELDEPSILONS* LPD3DXWELDEPSILONS; DECLARE_INTERFACE_(ID3DXBaseMesh, IUnknown) { - // IUnknown + /* IUnknown */ STDMETHOD(QueryInterface)(THIS_ REFIID iid, LPVOID *ppv) PURE; STDMETHOD_(ULONG, AddRef)(THIS) PURE; STDMETHOD_(ULONG, Release)(THIS) PURE; - // ID3DXBaseMesh + /* ID3DXBaseMesh */ STDMETHOD(DrawSubset)(THIS_ DWORD AttribId) PURE; STDMETHOD_(DWORD, GetNumFaces)(THIS) PURE; STDMETHOD_(DWORD, GetNumVertices)(THIS) PURE; @@ -185,12 +183,12 @@ DECLARE_INTERFACE_(ID3DXBaseMesh, IUnknown) DECLARE_INTERFACE_(ID3DXMesh, ID3DXBaseMesh) { - // IUnknown + /* IUnknown */ STDMETHOD(QueryInterface)(THIS_ REFIID iid, LPVOID *ppv) PURE; STDMETHOD_(ULONG, AddRef)(THIS) PURE; STDMETHOD_(ULONG, Release)(THIS) PURE; - // ID3DXBaseMesh + /* ID3DXBaseMesh */ STDMETHOD(DrawSubset)(THIS_ DWORD AttribId) PURE; STDMETHOD_(DWORD, GetNumFaces)(THIS) PURE; STDMETHOD_(DWORD, GetNumVertices)(THIS) PURE; @@ -215,7 +213,7 @@ DECLARE_INTERFACE_(ID3DXMesh, ID3DXBaseMesh) STDMETHOD(ConvertAdjacencyToPointReps)(THIS_ CONST DWORD* pAdjacency, DWORD* pPRep) PURE; STDMETHOD(GenerateAdjacency)(THIS_ FLOAT Epsilon, DWORD* pAdjacency) PURE; - // ID3DXMesh + /* ID3DXMesh */ STDMETHOD(LockAttributeBuffer)(THIS_ DWORD Flags, DWORD** ppData) PURE; STDMETHOD(UnlockAttributeBuffer)(THIS) PURE; STDMETHOD(Optimize)(THIS_ DWORD Flags, CONST DWORD* pAdjacencyIn, DWORD* pAdjacencyOut, @@ -232,12 +230,12 @@ DECLARE_INTERFACE_(ID3DXMesh, ID3DXBaseMesh) DECLARE_INTERFACE_(ID3DXPMesh, ID3DXBaseMesh) { - // IUnknown + /* IUnknown */ STDMETHOD(QueryInterface)(THIS_ REFIID iid, LPVOID *ppv) PURE; STDMETHOD_(ULONG, AddRef)(THIS) PURE; STDMETHOD_(ULONG, Release)(THIS) PURE; - // ID3DXBaseMesh + /* ID3DXBaseMesh */ STDMETHOD(DrawSubset)(THIS_ DWORD AttribId) PURE; STDMETHOD_(DWORD, GetNumFaces)(THIS) PURE; STDMETHOD_(DWORD, GetNumVertices)(THIS) PURE; @@ -262,7 +260,7 @@ DECLARE_INTERFACE_(ID3DXPMesh, ID3DXBaseMesh) STDMETHOD(ConvertAdjacencyToPointReps)(THIS_ CONST DWORD* pAdjacency, DWORD* pPRep) PURE; STDMETHOD(GenerateAdjacency)(THIS_ FLOAT Epsilon, DWORD* pAdjacency) PURE; - // ID3DXPMesh + /* ID3DXPMesh */ STDMETHOD(ClonePMeshFVF)(THIS_ DWORD Options, DWORD FVF, LPDIRECT3DDEVICE8 pD3D, LPD3DXPMESH* ppCloneMesh) PURE; STDMETHOD(ClonePMesh)(THIS_ DWORD Options, @@ -292,12 +290,12 @@ DECLARE_INTERFACE_(ID3DXPMesh, ID3DXBaseMesh) DECLARE_INTERFACE_(ID3DXSPMesh, IUnknown) { - // IUnknown + /* IUnknown */ STDMETHOD(QueryInterface)(THIS_ REFIID iid, LPVOID *ppv) PURE; STDMETHOD_(ULONG, AddRef)(THIS) PURE; STDMETHOD_(ULONG, Release)(THIS) PURE; - // ID3DXSPMesh + /* ID3DXSPMesh */ STDMETHOD_(DWORD, GetNumFaces)(THIS) PURE; STDMETHOD_(DWORD, GetNumVertices)(THIS) PURE; STDMETHOD_(DWORD, GetFVF)(THIS) PURE; @@ -323,18 +321,18 @@ DECLARE_INTERFACE_(ID3DXSPMesh, IUnknown) #define UNUSED16 (0xffff) #define UNUSED32 (0xffffffff) -// ID3DXMesh::Optimize options - upper byte only, lower 3 bytes used from _D3DXMESH option flags +/* ID3DXMesh::Optimize options - upper byte only, lower 3 bytes used from _D3DXMESH option flags */ enum _D3DXMESHOPT { D3DXMESHOPT_COMPACT = 0x01000000, D3DXMESHOPT_ATTRSORT = 0x02000000, D3DXMESHOPT_VERTEXCACHE = 0x04000000, D3DXMESHOPT_STRIPREORDER = 0x08000000, - D3DXMESHOPT_IGNOREVERTS = 0x10000000, // optimize faces only, don't touch vertices - D3DXMESHOPT_SHAREVB = 0x1000, // same as D3DXMESH_VB_SHARE + D3DXMESHOPT_IGNOREVERTS = 0x10000000, /* optimize faces only, don't touch vertices */ + D3DXMESHOPT_SHAREVB = 0x1000 /* same as D3DXMESH_VB_SHARE */ }; -// Subset of the mesh that has the same attribute and bone combination. -// This subset can be rendered in a single draw call +/* Subset of the mesh that has the same attribute and bone combination. + * This subset can be rendered in a single draw call */ typedef struct _D3DXBONECOMBINATION { DWORD AttribId; @@ -351,12 +349,12 @@ typedef struct _D3DXBONECOMBINATION DECLARE_INTERFACE_(ID3DXSkinMesh, IUnknown) { - // IUnknown + /* IUnknown */ STDMETHOD(QueryInterface)(THIS_ REFIID iid, LPVOID *ppv) PURE; STDMETHOD_(ULONG, AddRef)(THIS) PURE; STDMETHOD_(ULONG, Release)(THIS) PURE; - // ID3DXMesh + /* ID3DXMesh */ STDMETHOD_(DWORD, GetNumFaces)(THIS) PURE; STDMETHOD_(DWORD, GetNumVertices)(THIS) PURE; STDMETHOD_(DWORD, GetFVF)(THIS) PURE; @@ -371,7 +369,7 @@ DECLARE_INTERFACE_(ID3DXSkinMesh, IUnknown) STDMETHOD(UnlockIndexBuffer)(THIS) PURE; STDMETHOD(LockAttributeBuffer)(THIS_ DWORD flags, DWORD** ppData) PURE; STDMETHOD(UnlockAttributeBuffer)(THIS) PURE; - // ID3DXSkinMesh + /* ID3DXSkinMesh */ STDMETHOD_(DWORD, GetNumBones)(THIS) PURE; STDMETHOD(GetOriginalMesh)(THIS_ LPD3DXMESH* ppMesh) PURE; STDMETHOD(SetBoneInfluence)(THIS_ DWORD bone, DWORD numInfluences, CONST DWORD* vertices, CONST FLOAT* weights) PURE; @@ -411,7 +409,7 @@ DECLARE_INTERFACE_(ID3DXSkinMesh, IUnknown) #ifdef __cplusplus extern "C" { -#endif //__cplusplus +#endif /* __cplusplus */ HRESULT WINAPI D3DXCreateMesh( @@ -439,7 +437,7 @@ HRESULT WINAPI CONST FLOAT *pVertexWeights, LPD3DXSPMESH* ppSMesh); -// clean a mesh up for simplification, try to make manifold +/* clean a mesh up for simplification, try to make manifold */ HRESULT WINAPI D3DXCleanMesh( LPD3DXMESH pMeshIn, @@ -606,7 +604,7 @@ HRESULT WINAPI LPD3DXMESH pMeshIn, CONST DWORD* pAdjacencyIn, FLOAT NumSegs, - BOOL QuadraticInterpNormals, // if false use linear intrep for normals, if true use quadratic + BOOL QuadraticInterpNormals, /* if false use linear intrep for normals, if true use quadratic */ LPD3DXMESH *ppMeshOut, LPD3DXBUFFER *ppAdjacencyOut); @@ -634,10 +632,10 @@ HRESULT WINAPI typedef struct _D3DXINTERSECTINFO { - DWORD FaceIndex; // index of face intersected - FLOAT U; // Barycentric Hit Coordinates - FLOAT V; // Barycentric Hit Coordinates - FLOAT Dist; // Ray-Intersection Parameter Distance + DWORD FaceIndex; /* index of face intersected */ + FLOAT U; /* Barycentric Hit Coordinates */ + FLOAT V; /* Barycentric Hit Coordinates */ + FLOAT Dist; /* Ray-Intersection Parameter Distance */ } D3DXINTERSECTINFO, *LPD3DXINTERSECTINFO; @@ -646,13 +644,13 @@ HRESULT WINAPI LPD3DXBASEMESH pMesh, CONST D3DXVECTOR3 *pRayPos, CONST D3DXVECTOR3 *pRayDir, - BOOL *pHit, // True if any faces were intersected - DWORD *pFaceIndex, // index of closest face intersected - FLOAT *pU, // Barycentric Hit Coordinates - FLOAT *pV, // Barycentric Hit Coordinates - FLOAT *pDist, // Ray-Intersection Parameter Distance - LPD3DXBUFFER *ppAllHits, // Array of D3DXINTERSECTINFOs for all hits (not just closest) - DWORD *pCountOfHits); // Number of entries in AllHits array + BOOL *pHit, /* True if any faces were intersected */ + DWORD *pFaceIndex, /* index of closest face intersected */ + FLOAT *pU, /* Barycentric Hit Coordinates */ + FLOAT *pV, /* Barycentric Hit Coordinates */ + FLOAT *pDist, /* Ray-Intersection Parameter Distance */ + LPD3DXBUFFER *ppAllHits, /* Array of D3DXINTERSECTINFOs for all hits (not just closest) */ + DWORD *pCountOfHits); /* Number of entries in AllHits array */ HRESULT WINAPI D3DXIntersectSubset( @@ -660,13 +658,13 @@ HRESULT WINAPI DWORD AttribId, CONST D3DXVECTOR3 *pRayPos, CONST D3DXVECTOR3 *pRayDir, - BOOL *pHit, // True if any faces were intersected - DWORD *pFaceIndex, // index of closest face intersected - FLOAT *pU, // Barycentric Hit Coordinates - FLOAT *pV, // Barycentric Hit Coordinates - FLOAT *pDist, // Ray-Intersection Parameter Distance - LPD3DXBUFFER *ppAllHits, // Array of D3DXINTERSECTINFOs for all hits (not just closest) - DWORD *pCountOfHits); // Number of entries in AllHits array + BOOL *pHit, /* True if any faces were intersected */ + DWORD *pFaceIndex, /* index of closest face intersected */ + FLOAT *pU, /* Barycentric Hit Coordinates */ + FLOAT *pV, /* Barycentric Hit Coordinates */ + FLOAT *pDist, /* Ray-Intersection Parameter Distance */ + LPD3DXBUFFER *ppAllHits, /* Array of D3DXINTERSECTINFOs for all hits (not just closest) */ + DWORD *pCountOfHits); /* Number of entries in AllHits array */ HRESULT WINAPI D3DXSplitMesh @@ -684,14 +682,14 @@ HRESULT WINAPI D3DXSplitMesh BOOL D3DXIntersectTri ( - CONST D3DXVECTOR3 *p0, // Triangle vertex 0 position - CONST D3DXVECTOR3 *p1, // Triangle vertex 1 position - CONST D3DXVECTOR3 *p2, // Triangle vertex 2 position - CONST D3DXVECTOR3 *pRayPos, // Ray origin - CONST D3DXVECTOR3 *pRayDir, // Ray direction - FLOAT *pU, // Barycentric Hit Coordinates - FLOAT *pV, // Barycentric Hit Coordinates - FLOAT *pDist); // Ray-Intersection Parameter Distance + CONST D3DXVECTOR3 *p0, /* Triangle vertex 0 position */ + CONST D3DXVECTOR3 *p1, /* Triangle vertex 1 position */ + CONST D3DXVECTOR3 *p2, /* Triangle vertex 2 position */ + CONST D3DXVECTOR3 *pRayPos, /* Ray origin */ + CONST D3DXVECTOR3 *pRayDir, /* Ray direction */ + FLOAT *pU, /* Barycentric Hit Coordinates */ + FLOAT *pV, /* Barycentric Hit Coordinates */ + FLOAT *pDist); /* Ray-Intersection Parameter Distance */ BOOL WINAPI D3DXSphereBoundProbe( @@ -753,8 +751,8 @@ D3DXConvertMeshSubsetToStrips #ifdef __cplusplus } -#endif //__cplusplus +#endif /* __cplusplus */ -#endif //__D3DX8MESH_H__ +#endif /* __D3DX8MESH_H__ */ diff --git a/gfx/include/d3d8/d3dx8shape.h b/gfx/include/d3d8/d3dx8shape.h index e874d6479f..c8b982dc8c 100644 --- a/gfx/include/d3d8/d3dx8shape.h +++ b/gfx/include/d3d8/d3dx8shape.h @@ -1,40 +1,40 @@ -/////////////////////////////////////////////////////////////////////////// -// -// Copyright (C) Microsoft Corporation. All Rights Reserved. -// -// File: d3dx8shapes.h -// Content: D3DX simple shapes -// -/////////////////////////////////////////////////////////////////////////// +/* + * + * Copyright (C) Microsoft Corporation. All Rights Reserved. + * + * File: d3dx8shapes.h + * Content: D3DX simple shapes + * + */ #include "d3dx8.h" #ifndef __D3DX8SHAPES_H__ #define __D3DX8SHAPES_H__ -/////////////////////////////////////////////////////////////////////////// -// Functions: -/////////////////////////////////////////////////////////////////////////// +/* + * Functions: + */ #ifdef __cplusplus extern "C" { -#endif //__cplusplus +#endif /* __cplusplus */ - -//------------------------------------------------------------------------- -// D3DXCreatePolygon: -// ------------------ -// Creates a mesh containing an n-sided polygon. The polygon is centered -// at the origin. -// -// Parameters: -// -// pDevice The D3D device with which the mesh is going to be used. -// Length Length of each side. -// Sides Number of sides the polygon has. (Must be >= 3) -// ppMesh The mesh object which will be created -// ppAdjacency Returns a buffer containing adjacency info. Can be NULL. -//------------------------------------------------------------------------- +/* + * D3DXCreatePolygon: + * ------------------ + * Creates a mesh containing an n-sided polygon. The polygon is centered + * at the origin. + * + * Parameters: + * + * pDevice The D3D device with which the mesh is going to be used. + * Length Length of each side. + * Sides Number of sides the polygon has. (Must be >= 3) + * ppMesh The mesh object which will be created + * ppAdjacency Returns a buffer containing adjacency info. Can be NULL. + *------------------------------------------------------------------------- + */ HRESULT WINAPI D3DXCreatePolygon( LPDIRECT3DDEVICE8 pDevice, @@ -44,21 +44,21 @@ HRESULT WINAPI LPD3DXBUFFER* ppAdjacency); -//------------------------------------------------------------------------- -// D3DXCreateBox: -// -------------- -// Creates a mesh containing an axis-aligned box. The box is centered at -// the origin. -// -// Parameters: -// -// pDevice The D3D device with which the mesh is going to be used. -// Width Width of box (along X-axis) -// Height Height of box (along Y-axis) -// Depth Depth of box (along Z-axis) -// ppMesh The mesh object which will be created -// ppAdjacency Returns a buffer containing adjacency info. Can be NULL. -//------------------------------------------------------------------------- +/* + * D3DXCreateBox: + * -------------- + * Creates a mesh containing an axis-aligned box. The box is centered at + * the origin. + * + * Parameters: + * + * pDevice The D3D device with which the mesh is going to be used. + * Width Width of box (along X-axis) + * Height Height of box (along Y-axis) + * Depth Depth of box (along Z-axis) + * ppMesh The mesh object which will be created + * ppAdjacency Returns a buffer containing adjacency info. Can be NULL. + */ HRESULT WINAPI D3DXCreateBox( LPDIRECT3DDEVICE8 pDevice, @@ -69,23 +69,24 @@ HRESULT WINAPI LPD3DXBUFFER* ppAdjacency); -//------------------------------------------------------------------------- -// D3DXCreateCylinder: -// ------------------- -// Creates a mesh containing a cylinder. The generated cylinder is -// centered at the origin, and its axis is aligned with the Z-axis. -// -// Parameters: -// -// pDevice The D3D device with which the mesh is going to be used. -// Radius1 Radius at -Z end (should be >= 0.0f) -// Radius2 Radius at +Z end (should be >= 0.0f) -// Length Length of cylinder (along Z-axis) -// Slices Number of slices about the main axis -// Stacks Number of stacks along the main axis -// ppMesh The mesh object which will be created -// ppAdjacency Returns a buffer containing adjacency info. Can be NULL. -//------------------------------------------------------------------------- +/* + * D3DXCreateCylinder: + * ------------------- + * Creates a mesh containing a cylinder. The generated cylinder is + * centered at the origin, and its axis is aligned with the Z-axis. + * + * Parameters: + * + * pDevice The D3D device with which the mesh is going to be used. + * Radius1 Radius at -Z end (should be >= 0.0f) + * Radius2 Radius at +Z end (should be >= 0.0f) + * Length Length of cylinder (along Z-axis) + * Slices Number of slices about the main axis + * Stacks Number of stacks along the main axis + * ppMesh The mesh object which will be created + * ppAdjacency Returns a buffer containing adjacency info. Can be NULL. + *------------------------------------------------------------------------- + */ HRESULT WINAPI D3DXCreateCylinder( LPDIRECT3DDEVICE8 pDevice, @@ -98,21 +99,22 @@ HRESULT WINAPI LPD3DXBUFFER* ppAdjacency); -//------------------------------------------------------------------------- -// D3DXCreateSphere: -// ----------------- -// Creates a mesh containing a sphere. The sphere is centered at the -// origin. -// -// Parameters: -// -// pDevice The D3D device with which the mesh is going to be used. -// Radius Radius of the sphere (should be >= 0.0f) -// Slices Number of slices about the main axis -// Stacks Number of stacks along the main axis -// ppMesh The mesh object which will be created -// ppAdjacency Returns a buffer containing adjacency info. Can be NULL. -//------------------------------------------------------------------------- +/*------------------------------------------------------------------------- + * D3DXCreateSphere: + * ----------------- + * Creates a mesh containing a sphere. The sphere is centered at the + * origin. + * + * Parameters: + * + * pDevice The D3D device with which the mesh is going to be used. + * Radius Radius of the sphere (should be >= 0.0f) + * Slices Number of slices about the main axis + * Stacks Number of stacks along the main axis + * ppMesh The mesh object which will be created + * ppAdjacency Returns a buffer containing adjacency info. Can be NULL. + *------------------------------------------------------------------------- + */ HRESULT WINAPI D3DXCreateSphere( LPDIRECT3DDEVICE8 pDevice, @@ -123,22 +125,23 @@ HRESULT WINAPI LPD3DXBUFFER* ppAdjacency); -//------------------------------------------------------------------------- -// D3DXCreateTorus: -// ---------------- -// Creates a mesh containing a torus. The generated torus is centered at -// the origin, and its axis is aligned with the Z-axis. -// -// Parameters: -// -// pDevice The D3D device with which the mesh is going to be used. -// InnerRadius Inner radius of the torus (should be >= 0.0f) -// OuterRadius Outer radius of the torue (should be >= 0.0f) -// Sides Number of sides in a cross-section (must be >= 3) -// Rings Number of rings making up the torus (must be >= 3) -// ppMesh The mesh object which will be created -// ppAdjacency Returns a buffer containing adjacency info. Can be NULL. -//------------------------------------------------------------------------- +/*------------------------------------------------------------------------- + * D3DXCreateTorus: + * ---------------- + * Creates a mesh containing a torus. The generated torus is centered at + * the origin, and its axis is aligned with the Z-axis. + * + * Parameters: + * + * pDevice The D3D device with which the mesh is going to be used. + * InnerRadius Inner radius of the torus (should be >= 0.0f) + * OuterRadius Outer radius of the torue (should be >= 0.0f) + * Sides Number of sides in a cross-section (must be >= 3) + * Rings Number of rings making up the torus (must be >= 3) + * ppMesh The mesh object which will be created + * ppAdjacency Returns a buffer containing adjacency info. Can be NULL. + *------------------------------------------------------------------------- + */ HRESULT WINAPI D3DXCreateTorus( LPDIRECT3DDEVICE8 pDevice, @@ -150,17 +153,18 @@ HRESULT WINAPI LPD3DXBUFFER* ppAdjacency); -//------------------------------------------------------------------------- -// D3DXCreateTeapot: -// ----------------- -// Creates a mesh containing a teapot. -// -// Parameters: -// -// pDevice The D3D device with which the mesh is going to be used. -// ppMesh The mesh object which will be created -// ppAdjacency Returns a buffer containing adjacency info. Can be NULL. -//------------------------------------------------------------------------- +/*------------------------------------------------------------------------- + * D3DXCreateTeapot: + * ----------------- + * Creates a mesh containing a teapot. + * + * Parameters: + * + * pDevice The D3D device with which the mesh is going to be used. + * ppMesh The mesh object which will be created + * ppAdjacency Returns a buffer containing adjacency info. Can be NULL. + *------------------------------------------------------------------------- + */ HRESULT WINAPI D3DXCreateTeapot( LPDIRECT3DDEVICE8 pDevice, @@ -168,22 +172,23 @@ HRESULT WINAPI LPD3DXBUFFER* ppAdjacency); -//------------------------------------------------------------------------- -// D3DXCreateText: -// --------------- -// Creates a mesh containing the specified text using the font associated -// with the device context. -// -// Parameters: -// -// pDevice The D3D device with which the mesh is going to be used. -// hDC Device context, with desired font selected -// pText Text to generate -// Deviation Maximum chordal deviation from true font outlines -// Extrusion Amount to extrude text in -Z direction -// ppMesh The mesh object which will be created -// pGlyphMetrics Address of buffer to receive glyph metric data (or NULL) -//------------------------------------------------------------------------- +/*------------------------------------------------------------------------- + * D3DXCreateText: + * --------------- + * Creates a mesh containing the specified text using the font associated + * with the device context. + * + * Parameters: + * + * pDevice The D3D device with which the mesh is going to be used. + * hDC Device context, with desired font selected + * pText Text to generate + * Deviation Maximum chordal deviation from true font outlines + * Extrusion Amount to extrude text in -Z direction + * ppMesh The mesh object which will be created + * pGlyphMetrics Address of buffer to receive glyph metric data (or NULL) + *------------------------------------------------------------------------- + */ HRESULT WINAPI D3DXCreateTextA( LPDIRECT3DDEVICE8 pDevice, @@ -215,6 +220,6 @@ HRESULT WINAPI #ifdef __cplusplus } -#endif //__cplusplus +#endif /* __cplusplus */ -#endif //__D3DX8SHAPES_H__ +#endif /* __D3DX8SHAPES_H__ */ diff --git a/gfx/include/d3d8/d3dx8tex.h b/gfx/include/d3d8/d3dx8tex.h index cb30a7cf37..0a2526996f 100644 --- a/gfx/include/d3d8/d3dx8tex.h +++ b/gfx/include/d3d8/d3dx8tex.h @@ -1,60 +1,58 @@ -////////////////////////////////////////////////////////////////////////////// -// -// Copyright (C) Microsoft Corporation. All Rights Reserved. -// -// File: d3dx8tex.h -// Content: D3DX texturing APIs -// -////////////////////////////////////////////////////////////////////////////// +/* + * + * Copyright (C) Microsoft Corporation. All Rights Reserved. + * + * File: d3dx8tex.h + * Content: D3DX texturing APIs + */ #include "d3dx8.h" #ifndef __D3DX8TEX_H__ #define __D3DX8TEX_H__ - -//---------------------------------------------------------------------------- -// D3DX_FILTER flags: -// ------------------ -// -// A valid filter must contain one of these values: -// -// D3DX_FILTER_NONE -// No scaling or filtering will take place. Pixels outside the bounds -// of the source image are assumed to be transparent black. -// D3DX_FILTER_POINT -// Each destination pixel is computed by sampling the nearest pixel -// from the source image. -// D3DX_FILTER_LINEAR -// Each destination pixel is computed by linearly interpolating between -// the nearest pixels in the source image. This filter works best -// when the scale on each axis is less than 2. -// D3DX_FILTER_TRIANGLE -// Every pixel in the source image contributes equally to the -// destination image. This is the slowest of all the filters. -// D3DX_FILTER_BOX -// Each pixel is computed by averaging a 2x2(x2) box pixels from -// the source image. Only works when the dimensions of the -// destination are half those of the source. (as with mip maps) -// -// And can be OR'd with any of these optional flags: -// -// D3DX_FILTER_MIRROR_U -// Indicates that pixels off the edge of the texture on the U-axis -// should be mirrored, not wraped. -// D3DX_FILTER_MIRROR_V -// Indicates that pixels off the edge of the texture on the V-axis -// should be mirrored, not wraped. -// D3DX_FILTER_MIRROR_W -// Indicates that pixels off the edge of the texture on the W-axis -// should be mirrored, not wraped. -// D3DX_FILTER_MIRROR -// Same as specifying D3DX_FILTER_MIRROR_U | D3DX_FILTER_MIRROR_V | -// D3DX_FILTER_MIRROR_V -// D3DX_FILTER_DITHER -// Dithers the resulting image. -// -//---------------------------------------------------------------------------- +/* + * D3DX_FILTER flags: + * ------------------ + * + * A valid filter must contain one of these values: + * + * D3DX_FILTER_NONE + * No scaling or filtering will take place. Pixels outside the bounds + * of the source image are assumed to be transparent black. + * D3DX_FILTER_POINT + * Each destination pixel is computed by sampling the nearest pixel + * from the source image. + * D3DX_FILTER_LINEAR + * Each destination pixel is computed by linearly interpolating between + * the nearest pixels in the source image. This filter works best + * when the scale on each axis is less than 2. + * D3DX_FILTER_TRIANGLE + * Every pixel in the source image contributes equally to the + * destination image. This is the slowest of all the filters. + * D3DX_FILTER_BOX + * Each pixel is computed by averaging a 2x2(x2) box pixels from + * the source image. Only works when the dimensions of the + * destination are half those of the source. (as with mip maps) + * + * And can be OR'd with any of these optional flags: + * + * D3DX_FILTER_MIRROR_U + * Indicates that pixels off the edge of the texture on the U-axis + * should be mirrored, not wraped. + * D3DX_FILTER_MIRROR_V + * Indicates that pixels off the edge of the texture on the V-axis + * should be mirrored, not wraped. + * D3DX_FILTER_MIRROR_W + * Indicates that pixels off the edge of the texture on the W-axis + * should be mirrored, not wraped. + * D3DX_FILTER_MIRROR + * Same as specifying D3DX_FILTER_MIRROR_U | D3DX_FILTER_MIRROR_V | + * D3DX_FILTER_MIRROR_V + * D3DX_FILTER_DITHER + * Dithers the resulting image. + * + */ #define D3DX_FILTER_NONE (1 << 0) #define D3DX_FILTER_POINT (2 << 0) @@ -68,31 +66,28 @@ #define D3DX_FILTER_MIRROR (7 << 16) #define D3DX_FILTER_DITHER (8 << 16) - -//---------------------------------------------------------------------------- -// D3DX_NORMALMAP flags: -// --------------------- -// These flags are used to control how D3DXComputeNormalMap generates normal -// maps. Any number of these flags may be OR'd together in any combination. -// -// D3DX_NORMALMAP_MIRROR_U -// Indicates that pixels off the edge of the texture on the U-axis -// should be mirrored, not wraped. -// D3DX_NORMALMAP_MIRROR_V -// Indicates that pixels off the edge of the texture on the V-axis -// should be mirrored, not wraped. -// D3DX_NORMALMAP_MIRROR -// Same as specifying D3DX_NORMALMAP_MIRROR_U | D3DX_NORMALMAP_MIRROR_V -// D3DX_NORMALMAP_INVERTSIGN -// Inverts the direction of each normal -// D3DX_NORMALMAP_COMPUTE_OCCLUSION -// Compute the per pixel Occlusion term and encodes it into the alpha. -// An Alpha of 1 means that the pixel is not obscured in anyway, and -// an alpha of 0 would mean that the pixel is completly obscured. -// -//---------------------------------------------------------------------------- - -//---------------------------------------------------------------------------- +/* + * D3DX_NORMALMAP flags: + * --------------------- + * These flags are used to control how D3DXComputeNormalMap generates normal + * maps. Any number of these flags may be OR'd together in any combination. + * + * D3DX_NORMALMAP_MIRROR_U + * Indicates that pixels off the edge of the texture on the U-axis + * should be mirrored, not wraped. + * D3DX_NORMALMAP_MIRROR_V + * Indicates that pixels off the edge of the texture on the V-axis + * should be mirrored, not wraped. + * D3DX_NORMALMAP_MIRROR + * Same as specifying D3DX_NORMALMAP_MIRROR_U | D3DX_NORMALMAP_MIRROR_V + * D3DX_NORMALMAP_INVERTSIGN + * Inverts the direction of each normal + * D3DX_NORMALMAP_COMPUTE_OCCLUSION + * Compute the per pixel Occlusion term and encodes it into the alpha. + * An Alpha of 1 means that the pixel is not obscured in anyway, and + * an alpha of 0 would mean that the pixel is completly obscured. + * + */ #define D3DX_NORMALMAP_MIRROR_U (1 << 16) #define D3DX_NORMALMAP_MIRROR_V (2 << 16) @@ -100,28 +95,25 @@ #define D3DX_NORMALMAP_INVERTSIGN (8 << 16) #define D3DX_NORMALMAP_COMPUTE_OCCLUSION (16 << 16) - - - -//---------------------------------------------------------------------------- -// D3DX_CHANNEL flags: -// ------------------- -// These flags are used by functions which operate on or more channels -// in a texture. -// -// D3DX_CHANNEL_RED -// Indicates the red channel should be used -// D3DX_CHANNEL_BLUE -// Indicates the blue channel should be used -// D3DX_CHANNEL_GREEN -// Indicates the green channel should be used -// D3DX_CHANNEL_ALPHA -// Indicates the alpha channel should be used -// D3DX_CHANNEL_LUMINANCE -// Indicates the luminaces of the red green and blue channels should be -// used. -// -//---------------------------------------------------------------------------- +/* + * D3DX_CHANNEL flags: + * ------------------- + * These flags are used by functions which operate on or more channels + * in a texture. + * + * D3DX_CHANNEL_RED + * Indicates the red channel should be used + * D3DX_CHANNEL_BLUE + * Indicates the blue channel should be used + * D3DX_CHANNEL_GREEN + * Indicates the green channel should be used + * D3DX_CHANNEL_ALPHA + * Indicates the alpha channel should be used + * D3DX_CHANNEL_LUMINANCE + * Indicates the luminaces of the red green and blue channels should be + * used. + * + */ #define D3DX_CHANNEL_RED (1 << 0) #define D3DX_CHANNEL_BLUE (1 << 1) @@ -132,12 +124,12 @@ -//---------------------------------------------------------------------------- -// D3DXIMAGE_FILEFORMAT: -// --------------------- -// This enum is used to describe supported image file formats. -// -//---------------------------------------------------------------------------- +/* + * D3DXIMAGE_FILEFORMAT: + * --------------------- + * This enum is used to describe supported image file formats. + * + */ typedef enum _D3DXIMAGE_FILEFORMAT { @@ -153,54 +145,52 @@ typedef enum _D3DXIMAGE_FILEFORMAT } D3DXIMAGE_FILEFORMAT; -//---------------------------------------------------------------------------- -// LPD3DXFILL2D and LPD3DXFILL3D: -// ------------------------------ -// Function types used by the texture fill functions. -// -// Parameters: -// pOut -// Pointer to a vector which the function uses to return its result. -// X,Y,Z,W will be mapped to R,G,B,A respectivly. -// pTexCoord -// Pointer to a vector containing the coordinates of the texel currently -// being evaluated. Textures and VolumeTexture texcoord components -// range from 0 to 1. CubeTexture texcoord component range from -1 to 1. -// pTexelSize -// Pointer to a vector containing the dimensions of the current texel. -// pData -// Pointer to user data. -// -//---------------------------------------------------------------------------- +/* + * LPD3DXFILL2D and LPD3DXFILL3D: + * ------------------------------ + * Function types used by the texture fill functions. + * + * Parameters: + * pOut + * Pointer to a vector which the function uses to return its result. + * X,Y,Z,W will be mapped to R,G,B,A respectivly. + * pTexCoord + * Pointer to a vector containing the coordinates of the texel currently + * being evaluated. Textures and VolumeTexture texcoord components + * range from 0 to 1. CubeTexture texcoord component range from -1 to 1. + * pTexelSize + * Pointer to a vector containing the dimensions of the current texel. + * pData + * Pointer to user data. + * + */ typedef VOID (*LPD3DXFILL2D)(D3DXVECTOR4 *pOut, D3DXVECTOR2 *pTexCoord, D3DXVECTOR2 *pTexelSize, LPVOID pData); typedef VOID (*LPD3DXFILL3D)(D3DXVECTOR4 *pOut, D3DXVECTOR3 *pTexCoord, D3DXVECTOR3 *pTexelSize, LPVOID pData); - - -//---------------------------------------------------------------------------- -// D3DXIMAGE_INFO: -// --------------- -// This structure is used to return a rough description of what the -// the original contents of an image file looked like. -// -// Width -// Width of original image in pixels -// Height -// Height of original image in pixels -// Depth -// Depth of original image in pixels -// MipLevels -// Number of mip levels in original image -// Format -// D3D format which most closely describes the data in original image -// ResourceType -// D3DRESOURCETYPE representing the type of texture stored in the file. -// D3DRTYPE_TEXTURE, D3DRTYPE_VOLUMETEXTURE, or D3DRTYPE_CUBETEXTURE. -// ImageFileFormat -// D3DXIMAGE_FILEFORMAT representing the format of the image file. -// -//---------------------------------------------------------------------------- +/* + * D3DXIMAGE_INFO: + * --------------- + * This structure is used to return a rough description of what the + * the original contents of an image file looked like. + * + * Width + * Width of original image in pixels + * Height + * Height of original image in pixels + * Depth + * Depth of original image in pixels + * MipLevels + * Number of mip levels in original image + * Format + * D3D format which most closely describes the data in original image + * ResourceType + * D3DRESOURCETYPE representing the type of texture stored in the file. + * D3DRTYPE_TEXTURE, D3DRTYPE_VOLUMETEXTURE, or D3DRTYPE_CUBETEXTURE. + * ImageFileFormat + * D3DXIMAGE_FILEFORMAT representing the format of the image file. + * + */ typedef struct _D3DXIMAGE_INFO { @@ -214,42 +204,36 @@ typedef struct _D3DXIMAGE_INFO } D3DXIMAGE_INFO; - - - - #ifdef __cplusplus extern "C" { -#endif //__cplusplus +#endif /* __cplusplus */ +/* + * Image File APIs + */ - -////////////////////////////////////////////////////////////////////////////// -// Image File APIs /////////////////////////////////////////////////////////// -////////////////////////////////////////////////////////////////////////////// -; -//---------------------------------------------------------------------------- -// GetImageInfoFromFile/Resource: -// ------------------------------ -// Fills in a D3DXIMAGE_INFO struct with information about an image file. -// -// Parameters: -// pSrcFile -// File name of the source image. -// pSrcModule -// Module where resource is located, or NULL for module associated -// with image the os used to create the current process. -// pSrcResource -// Resource name -// pSrcData -// Pointer to file in memory. -// SrcDataSize -// Size in bytes of file in memory. -// pSrcInfo -// Pointer to a D3DXIMAGE_INFO structure to be filled in with the -// description of the data in the source image file. -// -//---------------------------------------------------------------------------- +/* + * GetImageInfoFromFile/Resource: + * ------------------------------ + * Fills in a D3DXIMAGE_INFO struct with information about an image file. + * + * Parameters: + * pSrcFile + * File name of the source image. + * pSrcModule + * Module where resource is located, or NULL for module associated + * with image the os used to create the current process. + * pSrcResource + * Resource name + * pSrcData + * Pointer to file in memory. + * SrcDataSize + * Size in bytes of file in memory. + * pSrcInfo + * Pointer to a D3DXIMAGE_INFO structure to be filled in with the + * description of the data in the source image file. + * + */ HRESULT WINAPI D3DXGetImageInfoFromFileA( @@ -293,51 +277,48 @@ HRESULT WINAPI UINT SrcDataSize, D3DXIMAGE_INFO* pSrcInfo); +/* + * Load/Save Surface APIs + */ - - -////////////////////////////////////////////////////////////////////////////// -// Load/Save Surface APIs //////////////////////////////////////////////////// -////////////////////////////////////////////////////////////////////////////// - -//---------------------------------------------------------------------------- -// D3DXLoadSurfaceFromFile/Resource: -// --------------------------------- -// Load surface from a file or resource -// -// Parameters: -// pDestSurface -// Destination surface, which will receive the image. -// pDestPalette -// Destination palette of 256 colors, or NULL -// pDestRect -// Destination rectangle, or NULL for entire surface -// pSrcFile -// File name of the source image. -// pSrcModule -// Module where resource is located, or NULL for module associated -// with image the os used to create the current process. -// pSrcResource -// Resource name -// pSrcData -// Pointer to file in memory. -// SrcDataSize -// Size in bytes of file in memory. -// pSrcRect -// Source rectangle, or NULL for entire image -// Filter -// D3DX_FILTER flags controlling how the image is filtered. -// Or D3DX_DEFAULT for D3DX_FILTER_TRIANGLE. -// ColorKey -// Color to replace with transparent black, or 0 to disable colorkey. -// This is always a 32-bit ARGB color, independent of the source image -// format. Alpha is significant, and should usually be set to FF for -// opaque colorkeys. (ex. Opaque black == 0xff000000) -// pSrcInfo -// Pointer to a D3DXIMAGE_INFO structure to be filled in with the -// description of the data in the source image file, or NULL. -// -//---------------------------------------------------------------------------- +/* + * D3DXLoadSurfaceFromFile/Resource: + * --------------------------------- + * Load surface from a file or resource + * + * Parameters: + * pDestSurface + * Destination surface, which will receive the image. + * pDestPalette + * Destination palette of 256 colors, or NULL + * pDestRect + * Destination rectangle, or NULL for entire surface + * pSrcFile + * File name of the source image. + * pSrcModule + * Module where resource is located, or NULL for module associated + * with image the os used to create the current process. + * pSrcResource + * Resource name + * pSrcData + * Pointer to file in memory. + * SrcDataSize + * Size in bytes of file in memory. + * pSrcRect + * Source rectangle, or NULL for entire image + * Filter + * D3DX_FILTER flags controlling how the image is filtered. + * Or D3DX_DEFAULT for D3DX_FILTER_TRIANGLE. + * ColorKey + * Color to replace with transparent black, or 0 to disable colorkey. + * This is always a 32-bit ARGB color, independent of the source image + * format. Alpha is significant, and should usually be set to FF for + * opaque colorkeys. (ex. Opaque black == 0xff000000) + * pSrcInfo + * Pointer to a D3DXIMAGE_INFO structure to be filled in with the + * description of the data in the source image file, or NULL. + * + */ HRESULT WINAPI D3DXLoadSurfaceFromFileA( @@ -414,36 +395,34 @@ HRESULT WINAPI D3DCOLOR ColorKey, D3DXIMAGE_INFO* pSrcInfo); - - -//---------------------------------------------------------------------------- -// D3DXLoadSurfaceFromSurface: -// --------------------------- -// Load surface from another surface (with color conversion) -// -// Parameters: -// pDestSurface -// Destination surface, which will receive the image. -// pDestPalette -// Destination palette of 256 colors, or NULL -// pDestRect -// Destination rectangle, or NULL for entire surface -// pSrcSurface -// Source surface -// pSrcPalette -// Source palette of 256 colors, or NULL -// pSrcRect -// Source rectangle, or NULL for entire surface -// Filter -// D3DX_FILTER flags controlling how the image is filtered. -// Or D3DX_DEFAULT for D3DX_FILTER_TRIANGLE. -// ColorKey -// Color to replace with transparent black, or 0 to disable colorkey. -// This is always a 32-bit ARGB color, independent of the source image -// format. Alpha is significant, and should usually be set to FF for -// opaque colorkeys. (ex. Opaque black == 0xff000000) -// -//---------------------------------------------------------------------------- +/* + * D3DXLoadSurfaceFromSurface: + * --------------------------- + * Load surface from another surface (with color conversion) + * + * Parameters: + * pDestSurface + * Destination surface, which will receive the image. + * pDestPalette + * Destination palette of 256 colors, or NULL + * pDestRect + * Destination rectangle, or NULL for entire surface + * pSrcSurface + * Source surface + * pSrcPalette + * Source palette of 256 colors, or NULL + * pSrcRect + * Source rectangle, or NULL for entire surface + * Filter + * D3DX_FILTER flags controlling how the image is filtered. + * Or D3DX_DEFAULT for D3DX_FILTER_TRIANGLE. + * ColorKey + * Color to replace with transparent black, or 0 to disable colorkey. + * This is always a 32-bit ARGB color, independent of the source image + * format. Alpha is significant, and should usually be set to FF for + * opaque colorkeys. (ex. Opaque black == 0xff000000) + * + */ HRESULT WINAPI D3DXLoadSurfaceFromSurface( @@ -456,40 +435,39 @@ HRESULT WINAPI DWORD Filter, D3DCOLOR ColorKey); - -//---------------------------------------------------------------------------- -// D3DXLoadSurfaceFromMemory: -// -------------------------- -// Load surface from memory. -// -// Parameters: -// pDestSurface -// Destination surface, which will receive the image. -// pDestPalette -// Destination palette of 256 colors, or NULL -// pDestRect -// Destination rectangle, or NULL for entire surface -// pSrcMemory -// Pointer to the top-left corner of the source image in memory -// SrcFormat -// Pixel format of the source image. -// SrcPitch -// Pitch of source image, in bytes. For DXT formats, this number -// should represent the width of one row of cells, in bytes. -// pSrcPalette -// Source palette of 256 colors, or NULL -// pSrcRect -// Source rectangle. -// Filter -// D3DX_FILTER flags controlling how the image is filtered. -// Or D3DX_DEFAULT for D3DX_FILTER_TRIANGLE. -// ColorKey -// Color to replace with transparent black, or 0 to disable colorkey. -// This is always a 32-bit ARGB color, independent of the source image -// format. Alpha is significant, and should usually be set to FF for -// opaque colorkeys. (ex. Opaque black == 0xff000000) -// -//---------------------------------------------------------------------------- +/* + * D3DXLoadSurfaceFromMemory: + * -------------------------- + * Load surface from memory. + * + * Parameters: + * pDestSurface + * Destination surface, which will receive the image. + * pDestPalette + * Destination palette of 256 colors, or NULL + * pDestRect + * Destination rectangle, or NULL for entire surface + * pSrcMemory + * Pointer to the top-left corner of the source image in memory + * SrcFormat + * Pixel format of the source image. + * SrcPitch + * Pitch of source image, in bytes. For DXT formats, this number + * should represent the width of one row of cells, in bytes. + * pSrcPalette + * Source palette of 256 colors, or NULL + * pSrcRect + * Source rectangle. + * Filter + * D3DX_FILTER flags controlling how the image is filtered. + * Or D3DX_DEFAULT for D3DX_FILTER_TRIANGLE. + * ColorKey + * Color to replace with transparent black, or 0 to disable colorkey. + * This is always a 32-bit ARGB color, independent of the source image + * format. Alpha is significant, and should usually be set to FF for + * opaque colorkeys. (ex. Opaque black == 0xff000000) + * + */ HRESULT WINAPI D3DXLoadSurfaceFromMemory( @@ -505,24 +483,24 @@ HRESULT WINAPI D3DCOLOR ColorKey); -//---------------------------------------------------------------------------- -// D3DXSaveSurfaceToFile: -// ---------------------- -// Save a surface to a image file. -// -// Parameters: -// pDestFile -// File name of the destination file -// DestFormat -// D3DXIMAGE_FILEFORMAT specifying file format to use when saving. -// pSrcSurface -// Source surface, containing the image to be saved -// pSrcPalette -// Source palette of 256 colors, or NULL -// pSrcRect -// Source rectangle, or NULL for the entire image -// -//---------------------------------------------------------------------------- +/* + * D3DXSaveSurfaceToFile: + * ---------------------- + * Save a surface to a image file. + * + * Parameters: + * pDestFile + * File name of the destination file + * DestFormat + * D3DXIMAGE_FILEFORMAT specifying file format to use when saving. + * pSrcSurface + * Source surface, containing the image to be saved + * pSrcPalette + * Source palette of 256 colors, or NULL + * pSrcRect + * Source rectangle, or NULL for the entire image + * + */ HRESULT WINAPI D3DXSaveSurfaceToFileA( @@ -546,51 +524,48 @@ HRESULT WINAPI #define D3DXSaveSurfaceToFile D3DXSaveSurfaceToFileA #endif +/* + * Load/Save Volume APIs + */ - - -////////////////////////////////////////////////////////////////////////////// -// Load/Save Volume APIs ///////////////////////////////////////////////////// -////////////////////////////////////////////////////////////////////////////// - -//---------------------------------------------------------------------------- -// D3DXLoadVolumeFromFile/Resource: -// -------------------------------- -// Load volume from a file or resource -// -// Parameters: -// pDestVolume -// Destination volume, which will receive the image. -// pDestPalette -// Destination palette of 256 colors, or NULL -// pDestBox -// Destination box, or NULL for entire volume -// pSrcFile -// File name of the source image. -// pSrcModule -// Module where resource is located, or NULL for module associated -// with image the os used to create the current process. -// pSrcResource -// Resource name -// pSrcData -// Pointer to file in memory. -// SrcDataSize -// Size in bytes of file in memory. -// pSrcBox -// Source box, or NULL for entire image -// Filter -// D3DX_FILTER flags controlling how the image is filtered. -// Or D3DX_DEFAULT for D3DX_FILTER_TRIANGLE. -// ColorKey -// Color to replace with transparent black, or 0 to disable colorkey. -// This is always a 32-bit ARGB color, independent of the source image -// format. Alpha is significant, and should usually be set to FF for -// opaque colorkeys. (ex. Opaque black == 0xff000000) -// pSrcInfo -// Pointer to a D3DXIMAGE_INFO structure to be filled in with the -// description of the data in the source image file, or NULL. -// -//---------------------------------------------------------------------------- +/* + * D3DXLoadVolumeFromFile/Resource: + * -------------------------------- + * Load volume from a file or resource + * + * Parameters: + * pDestVolume + * Destination volume, which will receive the image. + * pDestPalette + * Destination palette of 256 colors, or NULL + * pDestBox + * Destination box, or NULL for entire volume + * pSrcFile + * File name of the source image. + * pSrcModule + * Module where resource is located, or NULL for module associated + * with image the os used to create the current process. + * pSrcResource + * Resource name + * pSrcData + * Pointer to file in memory. + * SrcDataSize + * Size in bytes of file in memory. + * pSrcBox + * Source box, or NULL for entire image + * Filter + * D3DX_FILTER flags controlling how the image is filtered. + * Or D3DX_DEFAULT for D3DX_FILTER_TRIANGLE. + * ColorKey + * Color to replace with transparent black, or 0 to disable colorkey. + * This is always a 32-bit ARGB color, independent of the source image + * format. Alpha is significant, and should usually be set to FF for + * opaque colorkeys. (ex. Opaque black == 0xff000000) + * pSrcInfo + * Pointer to a D3DXIMAGE_INFO structure to be filled in with the + * description of the data in the source image file, or NULL. + * + */ HRESULT WINAPI D3DXLoadVolumeFromFileA( @@ -665,36 +640,34 @@ HRESULT WINAPI D3DCOLOR ColorKey, D3DXIMAGE_INFO* pSrcInfo); - - -//---------------------------------------------------------------------------- -// D3DXLoadVolumeFromVolume: -// ------------------------- -// Load volume from another volume (with color conversion) -// -// Parameters: -// pDestVolume -// Destination volume, which will receive the image. -// pDestPalette -// Destination palette of 256 colors, or NULL -// pDestBox -// Destination box, or NULL for entire volume -// pSrcVolume -// Source volume -// pSrcPalette -// Source palette of 256 colors, or NULL -// pSrcBox -// Source box, or NULL for entire volume -// Filter -// D3DX_FILTER flags controlling how the image is filtered. -// Or D3DX_DEFAULT for D3DX_FILTER_TRIANGLE. -// ColorKey -// Color to replace with transparent black, or 0 to disable colorkey. -// This is always a 32-bit ARGB color, independent of the source image -// format. Alpha is significant, and should usually be set to FF for -// opaque colorkeys. (ex. Opaque black == 0xff000000) -// -//---------------------------------------------------------------------------- +/* + * D3DXLoadVolumeFromVolume: + * ------------------------- + * Load volume from another volume (with color conversion) + * + * Parameters: + * pDestVolume + * Destination volume, which will receive the image. + * pDestPalette + * Destination palette of 256 colors, or NULL + * pDestBox + * Destination box, or NULL for entire volume + * pSrcVolume + * Source volume + * pSrcPalette + * Source palette of 256 colors, or NULL + * pSrcBox + * Source box, or NULL for entire volume + * Filter + * D3DX_FILTER flags controlling how the image is filtered. + * Or D3DX_DEFAULT for D3DX_FILTER_TRIANGLE. + * ColorKey + * Color to replace with transparent black, or 0 to disable colorkey. + * This is always a 32-bit ARGB color, independent of the source image + * format. Alpha is significant, and should usually be set to FF for + * opaque colorkeys. (ex. Opaque black == 0xff000000) + * + */ HRESULT WINAPI D3DXLoadVolumeFromVolume( @@ -707,44 +680,42 @@ HRESULT WINAPI DWORD Filter, D3DCOLOR ColorKey); - - -//---------------------------------------------------------------------------- -// D3DXLoadVolumeFromMemory: -// ------------------------- -// Load volume from memory. -// -// Parameters: -// pDestVolume -// Destination volume, which will receive the image. -// pDestPalette -// Destination palette of 256 colors, or NULL -// pDestBox -// Destination box, or NULL for entire volume -// pSrcMemory -// Pointer to the top-left corner of the source volume in memory -// SrcFormat -// Pixel format of the source volume. -// SrcRowPitch -// Pitch of source image, in bytes. For DXT formats, this number -// should represent the size of one row of cells, in bytes. -// SrcSlicePitch -// Pitch of source image, in bytes. For DXT formats, this number -// should represent the size of one slice of cells, in bytes. -// pSrcPalette -// Source palette of 256 colors, or NULL -// pSrcBox -// Source box. -// Filter -// D3DX_FILTER flags controlling how the image is filtered. -// Or D3DX_DEFAULT for D3DX_FILTER_TRIANGLE. -// ColorKey -// Color to replace with transparent black, or 0 to disable colorkey. -// This is always a 32-bit ARGB color, independent of the source image -// format. Alpha is significant, and should usually be set to FF for -// opaque colorkeys. (ex. Opaque black == 0xff000000) -// -//---------------------------------------------------------------------------- +/* + * D3DXLoadVolumeFromMemory: + * ------------------------- + * Load volume from memory. + * + * Parameters: + * pDestVolume + * Destination volume, which will receive the image. + * pDestPalette + * Destination palette of 256 colors, or NULL + * pDestBox + * Destination box, or NULL for entire volume + * pSrcMemory + * Pointer to the top-left corner of the source volume in memory + * SrcFormat + * Pixel format of the source volume. + * SrcRowPitch + * Pitch of source image, in bytes. For DXT formats, this number + * should represent the size of one row of cells, in bytes. + * SrcSlicePitch + * Pitch of source image, in bytes. For DXT formats, this number + * should represent the size of one slice of cells, in bytes. + * pSrcPalette + * Source palette of 256 colors, or NULL + * pSrcBox + * Source box. + * Filter + * D3DX_FILTER flags controlling how the image is filtered. + * Or D3DX_DEFAULT for D3DX_FILTER_TRIANGLE. + * ColorKey + * Color to replace with transparent black, or 0 to disable colorkey. + * This is always a 32-bit ARGB color, independent of the source image + * format. Alpha is significant, and should usually be set to FF for + * opaque colorkeys. (ex. Opaque black == 0xff000000) + * + */ HRESULT WINAPI D3DXLoadVolumeFromMemory( @@ -760,26 +731,24 @@ HRESULT WINAPI DWORD Filter, D3DCOLOR ColorKey); - - -//---------------------------------------------------------------------------- -// D3DXSaveVolumeToFile: -// --------------------- -// Save a volume to a image file. -// -// Parameters: -// pDestFile -// File name of the destination file -// DestFormat -// D3DXIMAGE_FILEFORMAT specifying file format to use when saving. -// pSrcVolume -// Source volume, containing the image to be saved -// pSrcPalette -// Source palette of 256 colors, or NULL -// pSrcBox -// Source box, or NULL for the entire volume -// -//---------------------------------------------------------------------------- +/* + * D3DXSaveVolumeToFile: + * --------------------- + * Save a volume to a image file. + * + * Parameters: + * pDestFile + * File name of the destination file + * DestFormat + * D3DXIMAGE_FILEFORMAT specifying file format to use when saving. + * pSrcVolume + * Source volume, containing the image to be saved + * pSrcPalette + * Source palette of 256 colors, or NULL + * pSrcBox + * Source box, or NULL for the entire volume + * + */ HRESULT WINAPI D3DXSaveVolumeToFileA( @@ -803,35 +772,32 @@ HRESULT WINAPI #define D3DXSaveVolumeToFile D3DXSaveVolumeToFileA #endif +/* + * Create/Save Texture APIs + */ - - -////////////////////////////////////////////////////////////////////////////// -// Create/Save Texture APIs ////////////////////////////////////////////////// -////////////////////////////////////////////////////////////////////////////// - -//---------------------------------------------------------------------------- -// D3DXCheckTextureRequirements: -// ----------------------------- -// Checks texture creation parameters. If parameters are invalid, this -// function returns corrected parameters. -// -// Parameters: -// -// pDevice -// The D3D device to be used -// pWidth, pHeight, pDepth, pSize -// Desired size in pixels, or NULL. Returns corrected size. -// pNumMipLevels -// Number of desired mipmap levels, or NULL. Returns corrected number. -// Usage -// Texture usage flags -// pFormat -// Desired pixel format, or NULL. Returns corrected format. -// Pool -// Memory pool to be used to create texture -// -//---------------------------------------------------------------------------- +/* + * D3DXCheckTextureRequirements: + * ----------------------------- + * Checks texture creation parameters. If parameters are invalid, this + * function returns corrected parameters. + * + * Parameters: + * + * pDevice + * The D3D device to be used + * pWidth, pHeight, pDepth, pSize + * Desired size in pixels, or NULL. Returns corrected size. + * pNumMipLevels + * Number of desired mipmap levels, or NULL. Returns corrected number. + * Usage + * Texture usage flags + * pFormat + * Desired pixel format, or NULL. Returns corrected format. + * Pool + * Memory pool to be used to create texture + * + */ HRESULT WINAPI D3DXCheckTextureRequirements( @@ -864,30 +830,30 @@ HRESULT WINAPI D3DPOOL Pool); -//---------------------------------------------------------------------------- -// D3DXCreateTexture: -// ------------------ -// Create an empty texture -// -// Parameters: -// -// pDevice -// The D3D device with which the texture is going to be used. -// Width, Height, Depth, Size -// size in pixels; these must be non-zero -// MipLevels -// number of mip levels desired; if zero or D3DX_DEFAULT, a complete -// mipmap chain will be created. -// Usage -// Texture usage flags -// Format -// Pixel format. -// Pool -// Memory pool to be used to create texture -// ppTexture, ppCubeTexture, ppVolumeTexture -// The texture object that will be created -// -//---------------------------------------------------------------------------- +/* + * D3DXCreateTexture: + * ------------------ + * Create an empty texture + * + * Parameters: + * + * pDevice + * The D3D device with which the texture is going to be used. + * Width, Height, Depth, Size + * size in pixels; these must be non-zero + * MipLevels + * number of mip levels desired; if zero or D3DX_DEFAULT, a complete + * mipmap chain will be created. + * Usage + * Texture usage flags + * Format + * Pixel format. + * Pool + * Memory pool to be used to create texture + * ppTexture, ppCubeTexture, ppVolumeTexture + * The texture object that will be created + * + */ HRESULT WINAPI D3DXCreateTexture( @@ -922,63 +888,60 @@ HRESULT WINAPI D3DPOOL Pool, LPDIRECT3DVOLUMETEXTURE8* ppVolumeTexture); +/* + * D3DXCreateTextureFromFile/Resource: + * ----------------------------------- + * Create a texture object from a file or resource. + * + * Parameters: + * + * pDevice + * The D3D device with which the texture is going to be used. + * pSrcFile + * File name. + * hSrcModule + * Module handle. if NULL, current module will be used. + * pSrcResource + * Resource name in module + * pvSrcData + * Pointer to file in memory. + * SrcDataSize + * Size in bytes of file in memory. + * Width, Height, Depth, Size + * Size in pixels; if zero or D3DX_DEFAULT, the size will be taken + * from the file. + * MipLevels + * Number of mip levels; if zero or D3DX_DEFAULT, a complete mipmap + * chain will be created. + * Usage + * Texture usage flags + * Format + * Desired pixel format. If D3DFMT_UNKNOWN, the format will be + * taken from the file. + * Pool + * Memory pool to be used to create texture + * Filter + * D3DX_FILTER flags controlling how the image is filtered. + * Or D3DX_DEFAULT for D3DX_FILTER_TRIANGLE. + * MipFilter + * D3DX_FILTER flags controlling how each miplevel is filtered. + * Or D3DX_DEFAULT for D3DX_FILTER_BOX, + * ColorKey + * Color to replace with transparent black, or 0 to disable colorkey. + * This is always a 32-bit ARGB color, independent of the source image + * format. Alpha is significant, and should usually be set to FF for + * opaque colorkeys. (ex. Opaque black == 0xff000000) + * pSrcInfo + * Pointer to a D3DXIMAGE_INFO structure to be filled in with the + * description of the data in the source image file, or NULL. + * pPalette + * 256 color palette to be filled in, or NULL + * ppTexture, ppCubeTexture, ppVolumeTexture + * The texture object that will be created + * + */ - -//---------------------------------------------------------------------------- -// D3DXCreateTextureFromFile/Resource: -// ----------------------------------- -// Create a texture object from a file or resource. -// -// Parameters: -// -// pDevice -// The D3D device with which the texture is going to be used. -// pSrcFile -// File name. -// hSrcModule -// Module handle. if NULL, current module will be used. -// pSrcResource -// Resource name in module -// pvSrcData -// Pointer to file in memory. -// SrcDataSize -// Size in bytes of file in memory. -// Width, Height, Depth, Size -// Size in pixels; if zero or D3DX_DEFAULT, the size will be taken -// from the file. -// MipLevels -// Number of mip levels; if zero or D3DX_DEFAULT, a complete mipmap -// chain will be created. -// Usage -// Texture usage flags -// Format -// Desired pixel format. If D3DFMT_UNKNOWN, the format will be -// taken from the file. -// Pool -// Memory pool to be used to create texture -// Filter -// D3DX_FILTER flags controlling how the image is filtered. -// Or D3DX_DEFAULT for D3DX_FILTER_TRIANGLE. -// MipFilter -// D3DX_FILTER flags controlling how each miplevel is filtered. -// Or D3DX_DEFAULT for D3DX_FILTER_BOX, -// ColorKey -// Color to replace with transparent black, or 0 to disable colorkey. -// This is always a 32-bit ARGB color, independent of the source image -// format. Alpha is significant, and should usually be set to FF for -// opaque colorkeys. (ex. Opaque black == 0xff000000) -// pSrcInfo -// Pointer to a D3DXIMAGE_INFO structure to be filled in with the -// description of the data in the source image file, or NULL. -// pPalette -// 256 color palette to be filled in, or NULL -// ppTexture, ppCubeTexture, ppVolumeTexture -// The texture object that will be created -// -//---------------------------------------------------------------------------- - - -// FromFile +/* FromFile */ HRESULT WINAPI D3DXCreateTextureFromFileA( @@ -1036,8 +999,7 @@ HRESULT WINAPI #define D3DXCreateVolumeTextureFromFile D3DXCreateVolumeTextureFromFileA #endif - -// FromResource +/* FromResource */ HRESULT WINAPI D3DXCreateTextureFromResourceA( @@ -1101,8 +1063,7 @@ HRESULT WINAPI #define D3DXCreateVolumeTextureFromResource D3DXCreateVolumeTextureFromResourceA #endif - -// FromFileEx +/* FromFileEx */ HRESULT WINAPI D3DXCreateTextureFromFileExA( @@ -1226,8 +1187,7 @@ HRESULT WINAPI #define D3DXCreateVolumeTextureFromFileEx D3DXCreateVolumeTextureFromFileExA #endif - -// FromResourceEx +/* FromResourceEx */ HRESULT WINAPI D3DXCreateTextureFromResourceExA( @@ -1357,8 +1317,7 @@ HRESULT WINAPI #define D3DXCreateVolumeTextureFromResourceEx D3DXCreateVolumeTextureFromResourceExA #endif - -// FromFileInMemory +/* FromFileInMemory */ HRESULT WINAPI D3DXCreateTextureFromFileInMemory( @@ -1382,7 +1341,7 @@ HRESULT WINAPI LPDIRECT3DVOLUMETEXTURE8* ppVolumeTexture); -// FromFileInMemoryEx +/* FromFileInMemoryEx */ HRESULT WINAPI D3DXCreateTextureFromFileInMemoryEx( @@ -1438,25 +1397,22 @@ HRESULT WINAPI PALETTEENTRY* pPalette, LPDIRECT3DVOLUMETEXTURE8* ppVolumeTexture); - - -//---------------------------------------------------------------------------- -// D3DXSaveTextureToFile: -// ---------------------- -// Save a texture to a file. -// -// Parameters: -// pDestFile -// File name of the destination file -// DestFormat -// D3DXIMAGE_FILEFORMAT specifying file format to use when saving. -// pSrcTexture -// Source texture, containing the image to be saved -// pSrcPalette -// Source palette of 256 colors, or NULL -// -//---------------------------------------------------------------------------- - +/* + * D3DXSaveTextureToFile: + * ---------------------- + * Save a texture to a file. + * + * Parameters: + * pDestFile + * File name of the destination file + * DestFormat + * D3DXIMAGE_FILEFORMAT specifying file format to use when saving. + * pSrcTexture + * Source texture, containing the image to be saved + * pSrcPalette + * Source palette of 256 colors, or NULL + * + */ HRESULT WINAPI D3DXSaveTextureToFileA( @@ -1478,30 +1434,27 @@ HRESULT WINAPI #define D3DXSaveTextureToFile D3DXSaveTextureToFileA #endif +/* + * Misc Texture APIs + */ - - -////////////////////////////////////////////////////////////////////////////// -// Misc Texture APIs ///////////////////////////////////////////////////////// -////////////////////////////////////////////////////////////////////////////// - -//---------------------------------------------------------------------------- -// D3DXFilterTexture: -// ------------------ -// Filters mipmaps levels of a texture. -// -// Parameters: -// pBaseTexture -// The texture object to be filtered -// pPalette -// 256 color palette to be used, or NULL for non-palettized formats -// SrcLevel -// The level whose image is used to generate the subsequent levels. -// Filter -// D3DX_FILTER flags controlling how each miplevel is filtered. -// Or D3DX_DEFAULT for D3DX_FILTER_BOX, -// -//---------------------------------------------------------------------------- +/* + * D3DXFilterTexture: + * ------------------ + * Filters mipmaps levels of a texture. + * + * Parameters: + * pBaseTexture + * The texture object to be filtered + * pPalette + * 256 color palette to be used, or NULL for non-palettized formats + * SrcLevel + * The level whose image is used to generate the subsequent levels. + * Filter + * D3DX_FILTER flags controlling how each miplevel is filtered. + * Or D3DX_DEFAULT for D3DX_FILTER_BOX, + * + */ HRESULT WINAPI D3DXFilterTexture( @@ -1513,24 +1466,22 @@ HRESULT WINAPI #define D3DXFilterCubeTexture D3DXFilterTexture #define D3DXFilterVolumeTexture D3DXFilterTexture - - -//---------------------------------------------------------------------------- -// D3DXFillTexture: -// ---------------- -// Uses a user provided function to fill each texel of each mip level of a -// given texture. -// -// Paramters: -// pTexture, pCubeTexture, pVolumeTexture -// Pointer to the texture to be filled. -// pFunction -// Pointer to user provided evalutor function which will be used to -// compute the value of each texel. -// pData -// Pointer to an arbitrary block of user defined data. This pointer -// will be passed to the function provided in pFunction -//----------------------------------------------------------------------------- +/* + * D3DXFillTexture: + * ---------------- + * Uses a user provided function to fill each texel of each mip level of a + * given texture. + * + * Paramters: + * pTexture, pCubeTexture, pVolumeTexture + * Pointer to the texture to be filled. + * pFunction + * Pointer to user provided evalutor function which will be used to + * compute the value of each texel. + * pData + * Pointer to an arbitrary block of user defined data. This pointer + * will be passed to the function provided in pFunction + */ HRESULT WINAPI D3DXFillTexture( @@ -1550,28 +1501,26 @@ HRESULT WINAPI LPD3DXFILL3D pFunction, LPVOID pData); - - -//---------------------------------------------------------------------------- -// D3DXComputeNormalMap: -// --------------------- -// Converts a height map into a normal map. The (x,y,z) components of each -// normal are mapped to the (r,g,b) channels of the output texture. -// -// Parameters -// pTexture -// Pointer to the destination texture -// pSrcTexture -// Pointer to the source heightmap texture -// pSrcPalette -// Source palette of 256 colors, or NULL -// Flags -// D3DX_NORMALMAP flags -// Channel -// D3DX_CHANNEL specifying source of height information -// Amplitude -// The constant value which the height information is multiplied by. -//--------------------------------------------------------------------------- +/* + * D3DXComputeNormalMap: + * --------------------- + * Converts a height map into a normal map. The (x,y,z) components of each + * normal are mapped to the (r,g,b) channels of the output texture. + * + * Parameters + * pTexture + * Pointer to the destination texture + * pSrcTexture + * Pointer to the source heightmap texture + * pSrcPalette + * Source palette of 256 colors, or NULL + * Flags + * D3DX_NORMALMAP flags + * Channel + * D3DX_CHANNEL specifying source of height information + * Amplitude + * The constant value which the height information is multiplied by. + */ HRESULT WINAPI D3DXComputeNormalMap( @@ -1587,6 +1536,6 @@ HRESULT WINAPI #ifdef __cplusplus } -#endif //__cplusplus +#endif /* __cplusplus */ -#endif //__D3DX8TEX_H__ +#endif /* __D3DX8TEX_H__ */ diff --git a/gfx/include/d3d9/d3dx9core.h b/gfx/include/d3d9/d3dx9core.h index 1c0b755cdf..92ac586356 100644 --- a/gfx/include/d3d9/d3dx9core.h +++ b/gfx/include/d3d9/d3dx9core.h @@ -194,7 +194,7 @@ DECLARE_INTERFACE_(ID3DXFont, IUnknown) STDMETHOD(OnLostDevice)(THIS) PURE; STDMETHOD(OnResetDevice)(THIS) PURE; -#ifdef __cplusplus +#if defined(__cplusplus) && !defined(CINTERFACE) #ifdef UNICODE HRESULT GetDesc(D3DXFONT_DESCW *pDesc) { return GetDescW(pDesc); } HRESULT PreloadText(LPCWSTR pString, INT Count) { return PreloadTextW(pString, Count); } diff --git a/gfx/include/d3d9/d3dx9effect.h b/gfx/include/d3d9/d3dx9effect.h index 3947c7a91b..0d68aa8637 100644 --- a/gfx/include/d3d9/d3dx9effect.h +++ b/gfx/include/d3d9/d3dx9effect.h @@ -1,12 +1,12 @@ -////////////////////////////////////////////////////////////////////////////// -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// -// File: d3dx9effect.h -// Content: D3DX effect types and Shaders -// -////////////////////////////////////////////////////////////////////////////// +/* + * + * Copyright (c) Microsoft Corporation. All rights reserved. + * + * File: d3dx9effect.h + * Content: D3DX effect types and Shaders + * + */ #include "d3dx9.h" @@ -24,90 +24,89 @@ #define D3DX_PARAMETER_LITERAL (1 << 1) #define D3DX_PARAMETER_ANNOTATION (1 << 2) -//---------------------------------------------------------------------------- -// D3DXEFFECT_DESC: -//---------------------------------------------------------------------------- +/* + * D3DXEFFECT_DESC: + */ typedef struct _D3DXEFFECT_DESC { - LPCSTR Creator; // Creator string - UINT Parameters; // Number of parameters - UINT Techniques; // Number of techniques - UINT Functions; // Number of function entrypoints + LPCSTR Creator; /* Creator string */ + UINT Parameters; /* Number of parameters */ + UINT Techniques; /* Number of techniques */ + UINT Functions; /* Number of function entrypoints */ } D3DXEFFECT_DESC; -//---------------------------------------------------------------------------- -// D3DXPARAMETER_DESC: -//---------------------------------------------------------------------------- +/* + * D3DXPARAMETER_DESC: + */ typedef struct _D3DXPARAMETER_DESC { - LPCSTR Name; // Parameter name - LPCSTR Semantic; // Parameter semantic - D3DXPARAMETER_CLASS Class; // Class - D3DXPARAMETER_TYPE Type; // Component type - UINT Rows; // Number of rows - UINT Columns; // Number of columns - UINT Elements; // Number of array elements - UINT Annotations; // Number of annotations - UINT StructMembers; // Number of structure member sub-parameters - DWORD Flags; // D3DX_PARAMETER_* flags - UINT Bytes; // Parameter size, in bytes + LPCSTR Name; /* Parameter name */ + LPCSTR Semantic; /* Parameter semantic */ + D3DXPARAMETER_CLASS Class; /* Class */ + D3DXPARAMETER_TYPE Type; /* Component type */ + UINT Rows; /* Number of rows */ + UINT Columns; /* Number of columns */ + UINT Elements; /* Number of array elements */ + UINT Annotations; /* Number of annotations */ + UINT StructMembers; /* Number of structure member sub-parameters */ + DWORD Flags; /* D3DX_PARAMETER_* flags */ + UINT Bytes; /* Parameter size, in bytes */ } D3DXPARAMETER_DESC; -//---------------------------------------------------------------------------- -// D3DXTECHNIQUE_DESC: -//---------------------------------------------------------------------------- +/* + * D3DXTECHNIQUE_DESC: + */ typedef struct _D3DXTECHNIQUE_DESC { - LPCSTR Name; // Technique name - UINT Passes; // Number of passes - UINT Annotations; // Number of annotations + LPCSTR Name; /* Technique name */ + UINT Passes; /* Number of passes */ + UINT Annotations; /* Number of annotations */ } D3DXTECHNIQUE_DESC; -//---------------------------------------------------------------------------- -// D3DXPASS_DESC: -//---------------------------------------------------------------------------- +/* + * D3DXPASS_DESC: + */ typedef struct _D3DXPASS_DESC { - LPCSTR Name; // Pass name - UINT Annotations; // Number of annotations + LPCSTR Name; /* Pass name */ + UINT Annotations; /* Number of annotations */ - CONST DWORD *pVertexShaderFunction; // Vertex shader function - CONST DWORD *pPixelShaderFunction; // Pixel shader function + CONST DWORD *pVertexShaderFunction; /* Vertex shader function */ + CONST DWORD *pPixelShaderFunction; /* Pixel shader function */ } D3DXPASS_DESC; -//---------------------------------------------------------------------------- -// D3DXFUNCTION_DESC: -//---------------------------------------------------------------------------- +/* + * D3DXFUNCTION_DESC: + */ typedef struct _D3DXFUNCTION_DESC { - LPCSTR Name; // Function name - UINT Annotations; // Number of annotations + LPCSTR Name; /* Function name */ + UINT Annotations; /* Number of annotations */ } D3DXFUNCTION_DESC; - -////////////////////////////////////////////////////////////////////////////// -// ID3DXEffectPool /////////////////////////////////////////////////////////// -////////////////////////////////////////////////////////////////////////////// +/* + * ID3DXEffectPool +*/ typedef interface ID3DXEffectPool ID3DXEffectPool; typedef interface ID3DXEffectPool *LPD3DXEFFECTPOOL; -// {9537AB04-3250-412e-8213-FCD2F8677933} +/* {9537AB04-3250-412e-8213-FCD2F8677933} */ DEFINE_GUID(IID_ID3DXEffectPool, 0x9537ab04, 0x3250, 0x412e, 0x82, 0x13, 0xfc, 0xd2, 0xf8, 0x67, 0x79, 0x33); @@ -117,23 +116,23 @@ DEFINE_GUID(IID_ID3DXEffectPool, DECLARE_INTERFACE_(ID3DXEffectPool, IUnknown) { - // IUnknown + /* IUnknown */ STDMETHOD(QueryInterface)(THIS_ REFIID iid, LPVOID *ppv) PURE; STDMETHOD_(ULONG, AddRef)(THIS) PURE; STDMETHOD_(ULONG, Release)(THIS) PURE; - // No public methods + /* No public methods */ }; -////////////////////////////////////////////////////////////////////////////// -// ID3DXBaseEffect /////////////////////////////////////////////////////////// -////////////////////////////////////////////////////////////////////////////// +/* + * ID3DXBaseEffect +*/ typedef interface ID3DXBaseEffect ID3DXBaseEffect; typedef interface ID3DXBaseEffect *LPD3DXBASEEFFECT; -// {017C18AC-103F-4417-8C51-6BF6EF1E56BE} +/* {017C18AC-103F-4417-8C51-6BF6EF1E56BE} */ DEFINE_GUID(IID_ID3DXBaseEffect, 0x17c18ac, 0x103f, 0x4417, 0x8c, 0x51, 0x6b, 0xf6, 0xef, 0x1e, 0x56, 0xbe); @@ -143,19 +142,19 @@ DEFINE_GUID(IID_ID3DXBaseEffect, DECLARE_INTERFACE_(ID3DXBaseEffect, IUnknown) { - // IUnknown + /* IUnknown */ STDMETHOD(QueryInterface)(THIS_ REFIID iid, LPVOID *ppv) PURE; STDMETHOD_(ULONG, AddRef)(THIS) PURE; STDMETHOD_(ULONG, Release)(THIS) PURE; - // Descs + /* Descs */ STDMETHOD(GetDesc)(THIS_ D3DXEFFECT_DESC* pDesc) PURE; STDMETHOD(GetParameterDesc)(THIS_ D3DXHANDLE hParameter, D3DXPARAMETER_DESC* pDesc) PURE; STDMETHOD(GetTechniqueDesc)(THIS_ D3DXHANDLE hTechnique, D3DXTECHNIQUE_DESC* pDesc) PURE; STDMETHOD(GetPassDesc)(THIS_ D3DXHANDLE hPass, D3DXPASS_DESC* pDesc) PURE; STDMETHOD(GetFunctionDesc)(THIS_ D3DXHANDLE hShader, D3DXFUNCTION_DESC* pDesc) PURE; - // Handle operations + /* Handle operations */ STDMETHOD_(D3DXHANDLE, GetParameter)(THIS_ D3DXHANDLE hParameter, UINT Index) PURE; STDMETHOD_(D3DXHANDLE, GetParameterByName)(THIS_ D3DXHANDLE hParameter, LPCSTR pName) PURE; STDMETHOD_(D3DXHANDLE, GetParameterBySemantic)(THIS_ D3DXHANDLE hParameter, LPCSTR pSemantic) PURE; @@ -169,7 +168,7 @@ DECLARE_INTERFACE_(ID3DXBaseEffect, IUnknown) STDMETHOD_(D3DXHANDLE, GetAnnotation)(THIS_ D3DXHANDLE hObject, UINT Index) PURE; STDMETHOD_(D3DXHANDLE, GetAnnotationByName)(THIS_ D3DXHANDLE hObject, LPCSTR pName) PURE; - // Get/Set Parameters + /* Get/Set Parameters */ STDMETHOD(SetValue)(THIS_ D3DXHANDLE hParameter, LPCVOID pData, UINT Bytes) PURE; STDMETHOD(GetValue)(THIS_ D3DXHANDLE hParameter, LPVOID pData, UINT Bytes) PURE; STDMETHOD(SetBool)(THIS_ D3DXHANDLE hParameter, BOOL b) PURE; @@ -207,24 +206,25 @@ DECLARE_INTERFACE_(ID3DXBaseEffect, IUnknown) STDMETHOD(GetPixelShader)(THIS_ D3DXHANDLE hParameter, LPDIRECT3DPIXELSHADER9 *ppPShader) PURE; STDMETHOD(GetVertexShader)(THIS_ D3DXHANDLE hParameter, LPDIRECT3DVERTEXSHADER9 *ppVShader) PURE; - //Set Range of an Array to pass to device - //Useful for sending only a subrange of an array down to the device + /* Set Range of an Array to pass to device + * Useful for sending only a subrange of an + * array down to the device + */ STDMETHOD(SetArrayRange)(THIS_ D3DXHANDLE hParameter, UINT uStart, UINT uEnd) PURE; }; - -//---------------------------------------------------------------------------- -// ID3DXEffectStateManager: -// ------------------------ -// This is a user implemented interface that can be used to manage device -// state changes made by an Effect. -//---------------------------------------------------------------------------- +/* + * ID3DXEffectStateManager: + * ------------------------ + * This is a user implemented interface that can be used to manage device + * state changes made by an Effect. + */ typedef interface ID3DXEffectStateManager ID3DXEffectStateManager; typedef interface ID3DXEffectStateManager *LPD3DXEFFECTSTATEMANAGER; -// {79AAB587-6DBC-4fa7-82DE-37FA1781C5CE} +/* {79AAB587-6DBC-4fa7-82DE-37FA1781C5CE} */ DEFINE_GUID(IID_ID3DXEffectStateManager, 0x79aab587, 0x6dbc, 0x4fa7, 0x82, 0xde, 0x37, 0xfa, 0x17, 0x81, 0xc5, 0xce); @@ -233,19 +233,20 @@ DEFINE_GUID(IID_ID3DXEffectStateManager, DECLARE_INTERFACE_(ID3DXEffectStateManager, IUnknown) { - // The user must correctly implement QueryInterface, AddRef, and Release. + /* The user must correctly implement QueryInterface, AddRef, and Release. */ - // IUnknown + /* IUnknown */ STDMETHOD(QueryInterface)(THIS_ REFIID iid, LPVOID *ppv) PURE; STDMETHOD_(ULONG, AddRef)(THIS) PURE; STDMETHOD_(ULONG, Release)(THIS) PURE; - // The following methods are called by the Effect when it wants to make - // the corresponding device call. Note that: - // 1. Users manage the state and are therefore responsible for making the - // the corresponding device calls themselves inside their callbacks. - // 2. Effects pay attention to the return values of the callbacks, and so - // users must pay attention to what they return in their callbacks. + /* The following methods are called by the Effect when it wants to make + * the corresponding device call. Note that: + * 1. Users manage the state and are therefore responsible for making the + * the corresponding device calls themselves inside their callbacks. + * 2. Effects pay attention to the return values of the callbacks, and so + * users must pay attention to what they return in their callbacks. + */ STDMETHOD(SetTransform)(THIS_ D3DTRANSFORMSTATETYPE State, CONST D3DMATRIX *pMatrix) PURE; STDMETHOD(SetMaterial)(THIS_ CONST D3DMATERIAL9 *pMaterial) PURE; @@ -268,14 +269,14 @@ DECLARE_INTERFACE_(ID3DXEffectStateManager, IUnknown) }; -////////////////////////////////////////////////////////////////////////////// -// ID3DXEffect /////////////////////////////////////////////////////////////// -////////////////////////////////////////////////////////////////////////////// +/* + * ID3DXEffect + */ typedef interface ID3DXEffect ID3DXEffect; typedef interface ID3DXEffect *LPD3DXEFFECT; -// {F6CEB4B3-4E4C-40dd-B883-8D8DE5EA0CD5} +/* {F6CEB4B3-4E4C-40dd-B883-8D8DE5EA0CD5} */ DEFINE_GUID(IID_ID3DXEffect, 0xf6ceb4b3, 0x4e4c, 0x40dd, 0xb8, 0x83, 0x8d, 0x8d, 0xe5, 0xea, 0xc, 0xd5); @@ -284,19 +285,19 @@ DEFINE_GUID(IID_ID3DXEffect, DECLARE_INTERFACE_(ID3DXEffect, ID3DXBaseEffect) { - // ID3DXBaseEffect + /* ID3DXBaseEffect */ STDMETHOD(QueryInterface)(THIS_ REFIID iid, LPVOID *ppv) PURE; STDMETHOD_(ULONG, AddRef)(THIS) PURE; STDMETHOD_(ULONG, Release)(THIS) PURE; - // Descs + /* Descs */ STDMETHOD(GetDesc)(THIS_ D3DXEFFECT_DESC* pDesc) PURE; STDMETHOD(GetParameterDesc)(THIS_ D3DXHANDLE hParameter, D3DXPARAMETER_DESC* pDesc) PURE; STDMETHOD(GetTechniqueDesc)(THIS_ D3DXHANDLE hTechnique, D3DXTECHNIQUE_DESC* pDesc) PURE; STDMETHOD(GetPassDesc)(THIS_ D3DXHANDLE hPass, D3DXPASS_DESC* pDesc) PURE; STDMETHOD(GetFunctionDesc)(THIS_ D3DXHANDLE hShader, D3DXFUNCTION_DESC* pDesc) PURE; - // Handle operations + /* Handle operations */ STDMETHOD_(D3DXHANDLE, GetParameter)(THIS_ D3DXHANDLE hParameter, UINT Index) PURE; STDMETHOD_(D3DXHANDLE, GetParameterByName)(THIS_ D3DXHANDLE hParameter, LPCSTR pName) PURE; STDMETHOD_(D3DXHANDLE, GetParameterBySemantic)(THIS_ D3DXHANDLE hParameter, LPCSTR pSemantic) PURE; @@ -310,7 +311,7 @@ DECLARE_INTERFACE_(ID3DXEffect, ID3DXBaseEffect) STDMETHOD_(D3DXHANDLE, GetAnnotation)(THIS_ D3DXHANDLE hObject, UINT Index) PURE; STDMETHOD_(D3DXHANDLE, GetAnnotationByName)(THIS_ D3DXHANDLE hObject, LPCSTR pName) PURE; - // Get/Set Parameters + /* Get/Set Parameters */ STDMETHOD(SetValue)(THIS_ D3DXHANDLE hParameter, LPCVOID pData, UINT Bytes) PURE; STDMETHOD(GetValue)(THIS_ D3DXHANDLE hParameter, LPVOID pData, UINT Bytes) PURE; STDMETHOD(SetBool)(THIS_ D3DXHANDLE hParameter, BOOL b) PURE; @@ -348,65 +349,65 @@ DECLARE_INTERFACE_(ID3DXEffect, ID3DXBaseEffect) STDMETHOD(GetPixelShader)(THIS_ D3DXHANDLE hParameter, LPDIRECT3DPIXELSHADER9 *ppPShader) PURE; STDMETHOD(GetVertexShader)(THIS_ D3DXHANDLE hParameter, LPDIRECT3DVERTEXSHADER9 *ppVShader) PURE; - //Set Range of an Array to pass to device - //Usefull for sending only a subrange of an array down to the device + /* Set Range of an Array to pass to device + * Useful for sending only a subrange of an array down to the device + */ STDMETHOD(SetArrayRange)(THIS_ D3DXHANDLE hParameter, UINT uStart, UINT uEnd) PURE; - // ID3DXBaseEffect + /* ID3DXBaseEffect */ - - // Pool + /* Pool */ STDMETHOD(GetPool)(THIS_ LPD3DXEFFECTPOOL* ppPool) PURE; - // Selecting and setting a technique + /* Selecting and setting a technique */ STDMETHOD(SetTechnique)(THIS_ D3DXHANDLE hTechnique) PURE; STDMETHOD_(D3DXHANDLE, GetCurrentTechnique)(THIS) PURE; STDMETHOD(ValidateTechnique)(THIS_ D3DXHANDLE hTechnique) PURE; STDMETHOD(FindNextValidTechnique)(THIS_ D3DXHANDLE hTechnique, D3DXHANDLE *pTechnique) PURE; STDMETHOD_(BOOL, IsParameterUsed)(THIS_ D3DXHANDLE hParameter, D3DXHANDLE hTechnique) PURE; - // Using current technique - // Begin starts active technique - // BeginPass begins a pass - // CommitChanges updates changes to any set calls in the pass. This should be called before - // any DrawPrimitive call to d3d - // EndPass ends a pass - // End ends active technique + /* Using current technique + * Begin starts active technique + * BeginPass begins a pass + * CommitChanges updates changes to any set calls in the pass. This should be called before + * any DrawPrimitive call to d3d + * EndPass ends a pass + * End ends active technique + */ STDMETHOD(Begin)(THIS_ UINT *pPasses, DWORD Flags) PURE; STDMETHOD(BeginPass)(THIS_ UINT Pass) PURE; STDMETHOD(CommitChanges)(THIS) PURE; STDMETHOD(EndPass)(THIS) PURE; STDMETHOD(End)(THIS) PURE; - // Managing D3D Device + /* Managing D3D Device */ STDMETHOD(GetDevice)(THIS_ LPDIRECT3DDEVICE9* ppDevice) PURE; STDMETHOD(OnLostDevice)(THIS) PURE; STDMETHOD(OnResetDevice)(THIS) PURE; - // Logging device calls + /* Logging device calls */ STDMETHOD(SetStateManager)(THIS_ LPD3DXEFFECTSTATEMANAGER pManager) PURE; STDMETHOD(GetStateManager)(THIS_ LPD3DXEFFECTSTATEMANAGER *ppManager) PURE; - // Parameter blocks + /* Parameter blocks */ STDMETHOD(BeginParameterBlock)(THIS) PURE; STDMETHOD_(D3DXHANDLE, EndParameterBlock)(THIS) PURE; STDMETHOD(ApplyParameterBlock)(THIS_ D3DXHANDLE hParameterBlock) PURE; STDMETHOD(DeleteParameterBlock)(THIS_ D3DXHANDLE hParameterBlock) PURE; - // Cloning + /* Cloning */ STDMETHOD(CloneEffect)(THIS_ LPDIRECT3DDEVICE9 pDevice, LPD3DXEFFECT* ppEffect) PURE; - // Fast path for setting variables directly in ID3DXEffect + /* Fast path for setting variables directly in ID3DXEffect */ STDMETHOD(SetRawValue)(THIS_ D3DXHANDLE hParameter, LPCVOID pData, UINT ByteOffset, UINT Bytes) PURE; }; -////////////////////////////////////////////////////////////////////////////// -// ID3DXEffectCompiler /////////////////////////////////////////////////////// -////////////////////////////////////////////////////////////////////////////// - +/* + * ID3DXEffectCompiler + */ typedef interface ID3DXEffectCompiler ID3DXEffectCompiler; typedef interface ID3DXEffectCompiler *LPD3DXEFFECTCOMPILER; -// {51B8A949-1A31-47e6-BEA0-4B30DB53F1E0} +/* {51B8A949-1A31-47e6-BEA0-4B30DB53F1E0} */ DEFINE_GUID(IID_ID3DXEffectCompiler, 0x51b8a949, 0x1a31, 0x47e6, 0xbe, 0xa0, 0x4b, 0x30, 0xdb, 0x53, 0xf1, 0xe0); @@ -416,19 +417,19 @@ DEFINE_GUID(IID_ID3DXEffectCompiler, DECLARE_INTERFACE_(ID3DXEffectCompiler, ID3DXBaseEffect) { - // ID3DXBaseEffect + /* ID3DXBaseEffect */ STDMETHOD(QueryInterface)(THIS_ REFIID iid, LPVOID *ppv) PURE; STDMETHOD_(ULONG, AddRef)(THIS) PURE; STDMETHOD_(ULONG, Release)(THIS) PURE; - // Descs + /* Descs */ STDMETHOD(GetDesc)(THIS_ D3DXEFFECT_DESC* pDesc) PURE; STDMETHOD(GetParameterDesc)(THIS_ D3DXHANDLE hParameter, D3DXPARAMETER_DESC* pDesc) PURE; STDMETHOD(GetTechniqueDesc)(THIS_ D3DXHANDLE hTechnique, D3DXTECHNIQUE_DESC* pDesc) PURE; STDMETHOD(GetPassDesc)(THIS_ D3DXHANDLE hPass, D3DXPASS_DESC* pDesc) PURE; STDMETHOD(GetFunctionDesc)(THIS_ D3DXHANDLE hShader, D3DXFUNCTION_DESC* pDesc) PURE; - // Handle operations + /* Handle operations */ STDMETHOD_(D3DXHANDLE, GetParameter)(THIS_ D3DXHANDLE hParameter, UINT Index) PURE; STDMETHOD_(D3DXHANDLE, GetParameterByName)(THIS_ D3DXHANDLE hParameter, LPCSTR pName) PURE; STDMETHOD_(D3DXHANDLE, GetParameterBySemantic)(THIS_ D3DXHANDLE hParameter, LPCSTR pSemantic) PURE; @@ -442,7 +443,7 @@ DECLARE_INTERFACE_(ID3DXEffectCompiler, ID3DXBaseEffect) STDMETHOD_(D3DXHANDLE, GetAnnotation)(THIS_ D3DXHANDLE hObject, UINT Index) PURE; STDMETHOD_(D3DXHANDLE, GetAnnotationByName)(THIS_ D3DXHANDLE hObject, LPCSTR pName) PURE; - // Get/Set Parameters + /* Get/Set Parameters */ STDMETHOD(SetValue)(THIS_ D3DXHANDLE hParameter, LPCVOID pData, UINT Bytes) PURE; STDMETHOD(GetValue)(THIS_ D3DXHANDLE hParameter, LPVOID pData, UINT Bytes) PURE; STDMETHOD(SetBool)(THIS_ D3DXHANDLE hParameter, BOOL b) PURE; @@ -480,16 +481,16 @@ DECLARE_INTERFACE_(ID3DXEffectCompiler, ID3DXBaseEffect) STDMETHOD(GetPixelShader)(THIS_ D3DXHANDLE hParameter, LPDIRECT3DPIXELSHADER9 *ppPShader) PURE; STDMETHOD(GetVertexShader)(THIS_ D3DXHANDLE hParameter, LPDIRECT3DVERTEXSHADER9 *ppVShader) PURE; - //Set Range of an Array to pass to device - //Usefull for sending only a subrange of an array down to the device + /* Set Range of an Array to pass to device + * Useful for sending only a subrange of an array down to the device */ STDMETHOD(SetArrayRange)(THIS_ D3DXHANDLE hParameter, UINT uStart, UINT uEnd) PURE; - // ID3DXBaseEffect - // Parameter sharing, specialization, and information + /* ID3DXBaseEffect + * Parameter sharing, specialization, and information */ STDMETHOD(SetLiteral)(THIS_ D3DXHANDLE hParameter, BOOL Literal) PURE; STDMETHOD(GetLiteral)(THIS_ D3DXHANDLE hParameter, BOOL *pLiteral) PURE; - // Compilation + /* Compilation */ STDMETHOD(CompileEffect)(THIS_ DWORD Flags, LPD3DXBUFFER* ppEffect, LPD3DXBUFFER* ppErrorMsgs) PURE; @@ -498,9 +499,9 @@ DECLARE_INTERFACE_(ID3DXEffectCompiler, ID3DXBaseEffect) }; -////////////////////////////////////////////////////////////////////////////// -// APIs ////////////////////////////////////////////////////////////////////// -////////////////////////////////////////////////////////////////////////////// +/* + * APIs + */ #ifdef __cplusplus extern "C" { @@ -729,6 +730,6 @@ HRESULT WINAPI #ifdef __cplusplus } -#endif //__cplusplus +#endif /* __cplusplus */ -#endif //__D3DX9EFFECT_H__ +#endif /* __D3DX9EFFECT_H__ */ diff --git a/gfx/include/d3d9/d3dx9math.h b/gfx/include/d3d9/d3dx9math.h index f861629e0d..914d9536f0 100644 --- a/gfx/include/d3d9/d3dx9math.h +++ b/gfx/include/d3d9/d3dx9math.h @@ -1,11 +1,10 @@ -////////////////////////////////////////////////////////////////////////////// -// -// Copyright (C) Microsoft Corporation. All Rights Reserved. -// -// File: d3dx9math.h -// Content: D3DX math types and functions -// -////////////////////////////////////////////////////////////////////////////// +/* + * + * Copyright (C) Microsoft Corporation. All Rights Reserved. + * + * File: d3dx9math.h + * Content: D3DX math types and functions + */ #include "d3dx9.h" @@ -17,36 +16,33 @@ #pragma warning(push) #endif -//=========================================================================== -// -// General purpose utilities -// -//=========================================================================== +/* + * + * General purpose utilities + * + */ #define D3DX_PI ((FLOAT) 3.141592654f) #define D3DX_1BYPI ((FLOAT) 0.318309886f) #define D3DXToRadian( degree ) ((degree) * (D3DX_PI / 180.0f)) #define D3DXToDegree( radian ) ((radian) * (180.0f / D3DX_PI)) +/* + * + * 16 bit floating point numbers + */ - -//=========================================================================== -// -// 16 bit floating point numbers -// -//=========================================================================== - -#define D3DX_16F_DIG 3 // # of decimal digits of precision -#define D3DX_16F_EPSILON 4.8875809e-4f // smallest such that 1.0 + epsilon != 1.0 -#define D3DX_16F_MANT_DIG 11 // # of bits in mantissa -#define D3DX_16F_MAX 6.550400e+004 // max value -#define D3DX_16F_MAX_10_EXP 4 // max decimal exponent -#define D3DX_16F_MAX_EXP 15 // max binary exponent -#define D3DX_16F_MIN 6.1035156e-5f // min positive value -#define D3DX_16F_MIN_10_EXP (-4) // min decimal exponent -#define D3DX_16F_MIN_EXP (-14) // min binary exponent -#define D3DX_16F_RADIX 2 // exponent radix -#define D3DX_16F_ROUNDS 1 // addition rounding: near +#define D3DX_16F_DIG 3 /* # of decimal digits of precision */ +#define D3DX_16F_EPSILON 4.8875809e-4f /* smallest such that 1.0 + epsilon != 1.0 */ +#define D3DX_16F_MANT_DIG 11 /* # of bits in mantissa */ +#define D3DX_16F_MAX 6.550400e+004 /* max value */ +#define D3DX_16F_MAX_10_EXP 4 /* max decimal exponent */ +#define D3DX_16F_MAX_EXP 15 /* max binary exponent */ +#define D3DX_16F_MIN 6.1035156e-5f /* min positive value */ +#define D3DX_16F_MIN_10_EXP (-4) /* min decimal exponent */ +#define D3DX_16F_MIN_EXP (-14) /* min binary exponent */ +#define D3DX_16F_RADIX 2 /* exponent radix */ +#define D3DX_16F_ROUNDS 1 /* addition rounding: near */ typedef struct D3DXFLOAT16 @@ -79,9 +75,9 @@ protected: */ -//-------------------------- -// 2D Vector -//-------------------------- +/* + * 2D Vector + */ typedef struct D3DXVECTOR2 { #ifdef __cplusplus @@ -122,11 +118,9 @@ public: FLOAT x, y; } D3DXVECTOR2, *LPD3DXVECTOR2; - - -//-------------------------- -// 2D Vector (16 bit) -//-------------------------- +/* + * 2D Vector (16 bit) + */ typedef struct D3DXVECTOR2_16F { @@ -410,11 +404,11 @@ typedef D3DXMATRIX _D3DXMATRIXA16; typedef D3DX_ALIGN16 _D3DXMATRIXA16 D3DXMATRIXA16, *LPD3DXMATRIXA16; -//=========================================================================== -// -// Quaternions -// -//=========================================================================== +/* + * + * Quaternions + */ + typedef struct D3DXQUATERNION { #ifdef __cplusplus @@ -424,22 +418,22 @@ public: D3DXQUATERNION( CONST D3DXFLOAT16 * ); D3DXQUATERNION( FLOAT x, FLOAT y, FLOAT z, FLOAT w ); - // casting + /* casting */ operator FLOAT* (); operator CONST FLOAT* () const; - // assignment operators + /* assignment operators */ D3DXQUATERNION& operator += ( CONST D3DXQUATERNION& ); D3DXQUATERNION& operator -= ( CONST D3DXQUATERNION& ); D3DXQUATERNION& operator *= ( CONST D3DXQUATERNION& ); D3DXQUATERNION& operator *= ( FLOAT ); D3DXQUATERNION& operator /= ( FLOAT ); - // unary operators + /* unary operators */ D3DXQUATERNION operator + () const; D3DXQUATERNION operator - () const; - // binary operators + /* binary operators */ D3DXQUATERNION operator + ( CONST D3DXQUATERNION& ) const; D3DXQUATERNION operator - ( CONST D3DXQUATERNION& ) const; D3DXQUATERNION operator * ( CONST D3DXQUATERNION& ) const; @@ -451,16 +445,14 @@ public: BOOL operator == ( CONST D3DXQUATERNION& ) const; BOOL operator != ( CONST D3DXQUATERNION& ) const; -#endif //__cplusplus +#endif /* __cplusplus */ FLOAT x, y, z, w; } D3DXQUATERNION, *LPD3DXQUATERNION; - -//=========================================================================== -// -// Planes -// -//=========================================================================== +/* + * + * Planes + */ typedef struct D3DXPLANE { #ifdef __cplusplus @@ -470,19 +462,19 @@ public: D3DXPLANE( CONST D3DXFLOAT16* ); D3DXPLANE( FLOAT a, FLOAT b, FLOAT c, FLOAT d ); - // casting + /* casting */ operator FLOAT* (); operator CONST FLOAT* () const; - // assignment operators + /* assignment operators */ D3DXPLANE& operator *= ( FLOAT ); D3DXPLANE& operator /= ( FLOAT ); - // unary operators + /* unary operators */ D3DXPLANE operator + () const; D3DXPLANE operator - () const; - // binary operators + /* binary operators */ D3DXPLANE operator * ( FLOAT ) const; D3DXPLANE operator / ( FLOAT ) const; @@ -491,16 +483,16 @@ public: BOOL operator == ( CONST D3DXPLANE& ) const; BOOL operator != ( CONST D3DXPLANE& ) const; -#endif //__cplusplus +#endif /*__cplusplus */ FLOAT a, b, c, d; } D3DXPLANE, *LPD3DXPLANE; -//=========================================================================== -// -// Colors -// -//=========================================================================== +/* + * + * Colors + * + */ typedef struct D3DXCOLOR { @@ -513,7 +505,7 @@ public: D3DXCOLOR( CONST D3DCOLORVALUE& ); D3DXCOLOR( FLOAT r, FLOAT g, FLOAT b, FLOAT a ); - // casting + /* casting */ operator DWORD () const; operator FLOAT* (); @@ -525,17 +517,17 @@ public: operator D3DCOLORVALUE& (); operator CONST D3DCOLORVALUE& () const; - // assignment operators + /* assignment operators */ D3DXCOLOR& operator += ( CONST D3DXCOLOR& ); D3DXCOLOR& operator -= ( CONST D3DXCOLOR& ); D3DXCOLOR& operator *= ( FLOAT ); D3DXCOLOR& operator /= ( FLOAT ); - // unary operators + /* unary operators */ D3DXCOLOR operator + () const; D3DXCOLOR operator - () const; - // binary operators + /* binary operators */ D3DXCOLOR operator + ( CONST D3DXCOLOR& ) const; D3DXCOLOR operator - ( CONST D3DXCOLOR& ) const; D3DXCOLOR operator * ( FLOAT ) const; @@ -546,38 +538,35 @@ public: BOOL operator == ( CONST D3DXCOLOR& ) const; BOOL operator != ( CONST D3DXCOLOR& ) const; -#endif //__cplusplus +#endif /* __cplusplus */ FLOAT r, g, b, a; } D3DXCOLOR, *LPD3DXCOLOR; +/* + * + * D3DX math functions: + * + * NOTE: + * * All these functions can take the same object as in and out parameters. + * + * * Out parameters are typically also returned as return values, so that + * the output of one function may be used as a parameter to another. + */ +/* + * Float16 + */ -//=========================================================================== -// -// D3DX math functions: -// -// NOTE: -// * All these functions can take the same object as in and out parameters. -// -// * Out parameters are typically also returned as return values, so that -// the output of one function may be used as a parameter to another. -// -//=========================================================================== - -//-------------------------- -// Float16 -//-------------------------- - -// non-inline +/* non-inline */ #ifdef __cplusplus extern "C" { #endif -// Converts an array 32-bit floats to 16-bit floats +/* Converts an array 32-bit floats to 16-bit floats */ D3DXFLOAT16* WINAPI D3DXFloat32To16Array ( D3DXFLOAT16 *pOut, CONST FLOAT *pIn, UINT n ); -// Converts an array 16-bit floats to 32-bit floats +/* Converts an array 16-bit floats to 32-bit floats */ FLOAT* WINAPI D3DXFloat16To32Array ( FLOAT *pOut, CONST D3DXFLOAT16 *pIn, UINT n ); @@ -585,12 +574,11 @@ FLOAT* WINAPI D3DXFloat16To32Array } #endif +/* + * 2D Vector + */ -//-------------------------- -// 2D Vector -//-------------------------- - -// inline +/* inline */ FLOAT D3DXVec2Length ( CONST D3DXVECTOR2 *pV ); @@ -601,7 +589,7 @@ FLOAT D3DXVec2LengthSq FLOAT D3DXVec2Dot ( CONST D3DXVECTOR2 *pV1, CONST D3DXVECTOR2 *pV2 ); -// Z component of ((x1,y1,0) cross (x2,y2,0)) +/* Z component of ((x1,y1,0) cross (x2,y2,0)) */ FLOAT D3DXVec2CCW ( CONST D3DXVECTOR2 *pV1, CONST D3DXVECTOR2 *pV2 ); @@ -611,23 +599,23 @@ D3DXVECTOR2* D3DXVec2Add D3DXVECTOR2* D3DXVec2Subtract ( D3DXVECTOR2 *pOut, CONST D3DXVECTOR2 *pV1, CONST D3DXVECTOR2 *pV2 ); -// Minimize each component. x = min(x1, x2), y = min(y1, y2) +/* Minimize each component. x = min(x1, x2), y = min(y1, y2) */ D3DXVECTOR2* D3DXVec2Minimize ( D3DXVECTOR2 *pOut, CONST D3DXVECTOR2 *pV1, CONST D3DXVECTOR2 *pV2 ); -// Maximize each component. x = max(x1, x2), y = max(y1, y2) +/* Maximize each component. x = max(x1, x2), y = max(y1, y2) */ D3DXVECTOR2* D3DXVec2Maximize ( D3DXVECTOR2 *pOut, CONST D3DXVECTOR2 *pV1, CONST D3DXVECTOR2 *pV2 ); D3DXVECTOR2* D3DXVec2Scale ( D3DXVECTOR2 *pOut, CONST D3DXVECTOR2 *pV, FLOAT s ); -// Linear interpolation. V1 + s(V2-V1) +/* Linear interpolation. V1 + s(V2-V1) */ D3DXVECTOR2* D3DXVec2Lerp ( D3DXVECTOR2 *pOut, CONST D3DXVECTOR2 *pV1, CONST D3DXVECTOR2 *pV2, FLOAT s ); -// non-inline +/* non-inline */ #ifdef __cplusplus extern "C" { #endif @@ -635,43 +623,43 @@ extern "C" { D3DXVECTOR2* WINAPI D3DXVec2Normalize ( D3DXVECTOR2 *pOut, CONST D3DXVECTOR2 *pV ); -// Hermite interpolation between position V1, tangent T1 (when s == 0) -// and position V2, tangent T2 (when s == 1). +/* Hermite interpolation between position V1, tangent T1 (when s == 0) + * and position V2, tangent T2 (when s == 1). */ D3DXVECTOR2* WINAPI D3DXVec2Hermite ( D3DXVECTOR2 *pOut, CONST D3DXVECTOR2 *pV1, CONST D3DXVECTOR2 *pT1, CONST D3DXVECTOR2 *pV2, CONST D3DXVECTOR2 *pT2, FLOAT s ); -// CatmullRom interpolation between V1 (when s == 0) and V2 (when s == 1) +/* CatmullRom interpolation between V1 (when s == 0) and V2 (when s == 1) */ D3DXVECTOR2* WINAPI D3DXVec2CatmullRom ( D3DXVECTOR2 *pOut, CONST D3DXVECTOR2 *pV0, CONST D3DXVECTOR2 *pV1, CONST D3DXVECTOR2 *pV2, CONST D3DXVECTOR2 *pV3, FLOAT s ); -// Barycentric coordinates. V1 + f(V2-V1) + g(V3-V1) +/* Barycentric coordinates. V1 + f(V2-V1) + g(V3-V1) */ D3DXVECTOR2* WINAPI D3DXVec2BaryCentric ( D3DXVECTOR2 *pOut, CONST D3DXVECTOR2 *pV1, CONST D3DXVECTOR2 *pV2, CONST D3DXVECTOR2 *pV3, FLOAT f, FLOAT g); -// Transform (x, y, 0, 1) by matrix. +/* Transform (x, y, 0, 1) by matrix. */ D3DXVECTOR4* WINAPI D3DXVec2Transform ( D3DXVECTOR4 *pOut, CONST D3DXVECTOR2 *pV, CONST D3DXMATRIX *pM ); -// Transform (x, y, 0, 1) by matrix, project result back into w=1. +/* Transform (x, y, 0, 1) by matrix, project result back into w=1. */ D3DXVECTOR2* WINAPI D3DXVec2TransformCoord ( D3DXVECTOR2 *pOut, CONST D3DXVECTOR2 *pV, CONST D3DXMATRIX *pM ); -// Transform (x, y, 0, 0) by matrix. +/* Transform (x, y, 0, 0) by matrix. */ D3DXVECTOR2* WINAPI D3DXVec2TransformNormal ( D3DXVECTOR2 *pOut, CONST D3DXVECTOR2 *pV, CONST D3DXMATRIX *pM ); -// Transform Array (x, y, 0, 1) by matrix. +/* Transform Array (x, y, 0, 1) by matrix. */ D3DXVECTOR4* WINAPI D3DXVec2TransformArray ( D3DXVECTOR4 *pOut, UINT OutStride, CONST D3DXVECTOR2 *pV, UINT VStride, CONST D3DXMATRIX *pM, UINT n); -// Transform Array (x, y, 0, 1) by matrix, project result back into w=1. +/* Transform Array (x, y, 0, 1) by matrix, project result back into w=1. */ D3DXVECTOR2* WINAPI D3DXVec2TransformCoordArray ( D3DXVECTOR2 *pOut, UINT OutStride, CONST D3DXVECTOR2 *pV, UINT VStride, CONST D3DXMATRIX *pM, UINT n ); -// Transform Array (x, y, 0, 0) by matrix. +/* Transform Array (x, y, 0, 0) by matrix. */ D3DXVECTOR2* WINAPI D3DXVec2TransformNormalArray ( D3DXVECTOR2 *pOut, UINT OutStride, CONST D3DXVECTOR2 *pV, UINT VStride, CONST D3DXMATRIX *pM, UINT n ); @@ -681,12 +669,11 @@ D3DXVECTOR2* WINAPI D3DXVec2TransformNormalArray } #endif +/* + * 3D Vector + */ -//-------------------------- -// 3D Vector -//-------------------------- - -// inline +/* inline */ FLOAT D3DXVec3Length ( CONST D3DXVECTOR3 *pV ); @@ -706,23 +693,23 @@ D3DXVECTOR3* D3DXVec3Add D3DXVECTOR3* D3DXVec3Subtract ( D3DXVECTOR3 *pOut, CONST D3DXVECTOR3 *pV1, CONST D3DXVECTOR3 *pV2 ); -// Minimize each component. x = min(x1, x2), y = min(y1, y2), ... +/* Minimize each component. x = min(x1, x2), y = min(y1, y2), ... */ D3DXVECTOR3* D3DXVec3Minimize ( D3DXVECTOR3 *pOut, CONST D3DXVECTOR3 *pV1, CONST D3DXVECTOR3 *pV2 ); -// Maximize each component. x = max(x1, x2), y = max(y1, y2), ... +/* Maximize each component. x = max(x1, x2), y = max(y1, y2), ... */ D3DXVECTOR3* D3DXVec3Maximize ( D3DXVECTOR3 *pOut, CONST D3DXVECTOR3 *pV1, CONST D3DXVECTOR3 *pV2 ); D3DXVECTOR3* D3DXVec3Scale ( D3DXVECTOR3 *pOut, CONST D3DXVECTOR3 *pV, FLOAT s); -// Linear interpolation. V1 + s(V2-V1) +/* Linear interpolation. V1 + s(V2-V1) */ D3DXVECTOR3* D3DXVec3Lerp ( D3DXVECTOR3 *pOut, CONST D3DXVECTOR3 *pV1, CONST D3DXVECTOR3 *pV2, FLOAT s ); -// non-inline +/* non-inline */ #ifdef __cplusplus extern "C" { #endif @@ -730,67 +717,69 @@ extern "C" { D3DXVECTOR3* WINAPI D3DXVec3Normalize ( D3DXVECTOR3 *pOut, CONST D3DXVECTOR3 *pV ); -// Hermite interpolation between position V1, tangent T1 (when s == 0) -// and position V2, tangent T2 (when s == 1). +/* Hermite interpolation between position V1, tangent T1 (when s == 0) + * and position V2, tangent T2 (when s == 1). */ D3DXVECTOR3* WINAPI D3DXVec3Hermite ( D3DXVECTOR3 *pOut, CONST D3DXVECTOR3 *pV1, CONST D3DXVECTOR3 *pT1, CONST D3DXVECTOR3 *pV2, CONST D3DXVECTOR3 *pT2, FLOAT s ); -// CatmullRom interpolation between V1 (when s == 0) and V2 (when s == 1) +/* CatmullRom interpolation between V1 (when s == 0) and V2 (when s == 1) */ D3DXVECTOR3* WINAPI D3DXVec3CatmullRom ( D3DXVECTOR3 *pOut, CONST D3DXVECTOR3 *pV0, CONST D3DXVECTOR3 *pV1, CONST D3DXVECTOR3 *pV2, CONST D3DXVECTOR3 *pV3, FLOAT s ); -// Barycentric coordinates. V1 + f(V2-V1) + g(V3-V1) +/* Barycentric coordinates. V1 + f(V2-V1) + g(V3-V1) */ D3DXVECTOR3* WINAPI D3DXVec3BaryCentric ( D3DXVECTOR3 *pOut, CONST D3DXVECTOR3 *pV1, CONST D3DXVECTOR3 *pV2, CONST D3DXVECTOR3 *pV3, FLOAT f, FLOAT g); -// Transform (x, y, z, 1) by matrix. +/* Transform (x, y, z, 1) by matrix. */ D3DXVECTOR4* WINAPI D3DXVec3Transform ( D3DXVECTOR4 *pOut, CONST D3DXVECTOR3 *pV, CONST D3DXMATRIX *pM ); -// Transform (x, y, z, 1) by matrix, project result back into w=1. +/* Transform (x, y, z, 1) by matrix, project result back into w=1. */ D3DXVECTOR3* WINAPI D3DXVec3TransformCoord ( D3DXVECTOR3 *pOut, CONST D3DXVECTOR3 *pV, CONST D3DXMATRIX *pM ); -// Transform (x, y, z, 0) by matrix. If you transforming a normal by a -// non-affine matrix, the matrix you pass to this function should be the -// transpose of the inverse of the matrix you would use to transform a coord. +/* Transform (x, y, z, 0) by matrix. If you transforming a normal by a + * non-affine matrix, the matrix you pass to this function should be the + * transpose of the inverse of the matrix you would use to transform a coord. + */ D3DXVECTOR3* WINAPI D3DXVec3TransformNormal ( D3DXVECTOR3 *pOut, CONST D3DXVECTOR3 *pV, CONST D3DXMATRIX *pM ); -// Transform Array (x, y, z, 1) by matrix. +/* Transform Array (x, y, z, 1) by matrix. */ D3DXVECTOR4* WINAPI D3DXVec3TransformArray ( D3DXVECTOR4 *pOut, UINT OutStride, CONST D3DXVECTOR3 *pV, UINT VStride, CONST D3DXMATRIX *pM, UINT n ); -// Transform Array (x, y, z, 1) by matrix, project result back into w=1. +/* Transform Array (x, y, z, 1) by matrix, project result back into w=1. */ D3DXVECTOR3* WINAPI D3DXVec3TransformCoordArray ( D3DXVECTOR3 *pOut, UINT OutStride, CONST D3DXVECTOR3 *pV, UINT VStride, CONST D3DXMATRIX *pM, UINT n ); -// Transform (x, y, z, 0) by matrix. If you transforming a normal by a -// non-affine matrix, the matrix you pass to this function should be the -// transpose of the inverse of the matrix you would use to transform a coord. +/* Transform (x, y, z, 0) by matrix. If you transforming a normal by a + * non-affine matrix, the matrix you pass to this function should be the + * transpose of the inverse of the matrix you would use to transform a coord. + */ D3DXVECTOR3* WINAPI D3DXVec3TransformNormalArray ( D3DXVECTOR3 *pOut, UINT OutStride, CONST D3DXVECTOR3 *pV, UINT VStride, CONST D3DXMATRIX *pM, UINT n ); -// Project vector from object space into screen space +/* Project vector from object space into screen space */ D3DXVECTOR3* WINAPI D3DXVec3Project ( D3DXVECTOR3 *pOut, CONST D3DXVECTOR3 *pV, CONST D3DVIEWPORT9 *pViewport, CONST D3DXMATRIX *pProjection, CONST D3DXMATRIX *pView, CONST D3DXMATRIX *pWorld); -// Project vector from screen space into object space +/* Project vector from screen space into object space */ D3DXVECTOR3* WINAPI D3DXVec3Unproject ( D3DXVECTOR3 *pOut, CONST D3DXVECTOR3 *pV, CONST D3DVIEWPORT9 *pViewport, CONST D3DXMATRIX *pProjection, CONST D3DXMATRIX *pView, CONST D3DXMATRIX *pWorld); -// Project vector Array from object space into screen space +/* Project vector Array from object space into screen space */ D3DXVECTOR3* WINAPI D3DXVec3ProjectArray ( D3DXVECTOR3 *pOut, UINT OutStride,CONST D3DXVECTOR3 *pV, UINT VStride,CONST D3DVIEWPORT9 *pViewport, CONST D3DXMATRIX *pProjection, CONST D3DXMATRIX *pView, CONST D3DXMATRIX *pWorld, UINT n); -// Project vector Array from screen space into object space +/* Project vector Array from screen space into object space */ D3DXVECTOR3* WINAPI D3DXVec3UnprojectArray ( D3DXVECTOR3 *pOut, UINT OutStride, CONST D3DXVECTOR3 *pV, UINT VStride, CONST D3DVIEWPORT9 *pViewport, CONST D3DXMATRIX *pProjection, CONST D3DXMATRIX *pView, CONST D3DXMATRIX *pWorld, UINT n); @@ -800,13 +789,11 @@ D3DXVECTOR3* WINAPI D3DXVec3UnprojectArray } #endif +/* + * 4D Vector + */ - -//-------------------------- -// 4D Vector -//-------------------------- - -// inline +/* inline */ FLOAT D3DXVec4Length ( CONST D3DXVECTOR4 *pV ); @@ -823,28 +810,28 @@ D3DXVECTOR4* D3DXVec4Add D3DXVECTOR4* D3DXVec4Subtract ( D3DXVECTOR4 *pOut, CONST D3DXVECTOR4 *pV1, CONST D3DXVECTOR4 *pV2); -// Minimize each component. x = min(x1, x2), y = min(y1, y2), ... +/* Minimize each component. x = min(x1, x2), y = min(y1, y2), ... */ D3DXVECTOR4* D3DXVec4Minimize ( D3DXVECTOR4 *pOut, CONST D3DXVECTOR4 *pV1, CONST D3DXVECTOR4 *pV2); -// Maximize each component. x = max(x1, x2), y = max(y1, y2), ... +/* Maximize each component. x = max(x1, x2), y = max(y1, y2), ... */ D3DXVECTOR4* D3DXVec4Maximize ( D3DXVECTOR4 *pOut, CONST D3DXVECTOR4 *pV1, CONST D3DXVECTOR4 *pV2); D3DXVECTOR4* D3DXVec4Scale ( D3DXVECTOR4 *pOut, CONST D3DXVECTOR4 *pV, FLOAT s); -// Linear interpolation. V1 + s(V2-V1) +/* Linear interpolation. V1 + s(V2-V1) */ D3DXVECTOR4* D3DXVec4Lerp ( D3DXVECTOR4 *pOut, CONST D3DXVECTOR4 *pV1, CONST D3DXVECTOR4 *pV2, FLOAT s ); -// non-inline +/* non-inline */ #ifdef __cplusplus extern "C" { #endif -// Cross-product in 4 dimensions. +/* Cross-product in 4 dimensions. */ D3DXVECTOR4* WINAPI D3DXVec4Cross ( D3DXVECTOR4 *pOut, CONST D3DXVECTOR4 *pV1, CONST D3DXVECTOR4 *pV2, CONST D3DXVECTOR4 *pV3); @@ -852,27 +839,27 @@ D3DXVECTOR4* WINAPI D3DXVec4Cross D3DXVECTOR4* WINAPI D3DXVec4Normalize ( D3DXVECTOR4 *pOut, CONST D3DXVECTOR4 *pV ); -// Hermite interpolation between position V1, tangent T1 (when s == 0) -// and position V2, tangent T2 (when s == 1). +/* Hermite interpolation between position V1, tangent T1 (when s == 0) + * and position V2, tangent T2 (when s == 1). */ D3DXVECTOR4* WINAPI D3DXVec4Hermite ( D3DXVECTOR4 *pOut, CONST D3DXVECTOR4 *pV1, CONST D3DXVECTOR4 *pT1, CONST D3DXVECTOR4 *pV2, CONST D3DXVECTOR4 *pT2, FLOAT s ); -// CatmullRom interpolation between V1 (when s == 0) and V2 (when s == 1) +/* CatmullRom interpolation between V1 (when s == 0) and V2 (when s == 1) */ D3DXVECTOR4* WINAPI D3DXVec4CatmullRom ( D3DXVECTOR4 *pOut, CONST D3DXVECTOR4 *pV0, CONST D3DXVECTOR4 *pV1, CONST D3DXVECTOR4 *pV2, CONST D3DXVECTOR4 *pV3, FLOAT s ); -// Barycentric coordinates. V1 + f(V2-V1) + g(V3-V1) +/* Barycentric coordinates. V1 + f(V2-V1) + g(V3-V1) */ D3DXVECTOR4* WINAPI D3DXVec4BaryCentric ( D3DXVECTOR4 *pOut, CONST D3DXVECTOR4 *pV1, CONST D3DXVECTOR4 *pV2, CONST D3DXVECTOR4 *pV3, FLOAT f, FLOAT g); -// Transform vector by matrix. +/* Transform vector by matrix. */ D3DXVECTOR4* WINAPI D3DXVec4Transform ( D3DXVECTOR4 *pOut, CONST D3DXVECTOR4 *pV, CONST D3DXMATRIX *pM ); -// Transform vector array by matrix. +/* Transform vector array by matrix. */ D3DXVECTOR4* WINAPI D3DXVec4TransformArray ( D3DXVECTOR4 *pOut, UINT OutStride, CONST D3DXVECTOR4 *pV, UINT VStride, CONST D3DXMATRIX *pM, UINT n ); @@ -881,11 +868,11 @@ D3DXVECTOR4* WINAPI D3DXVec4TransformArray #endif -//-------------------------- -// 4D Matrix -//-------------------------- +/* + * 4D Matrix + */ -// inline +/* inline */ D3DXMATRIX* D3DXMatrixIdentity ( D3DXMATRIX *pOut ); @@ -909,143 +896,143 @@ HRESULT WINAPI D3DXMatrixDecompose D3DXMATRIX* WINAPI D3DXMatrixTranspose ( D3DXMATRIX *pOut, CONST D3DXMATRIX *pM ); -// Matrix multiplication. The result represents the transformation M2 -// followed by the transformation M1. (Out = M1 * M2) +/* Matrix multiplication. The result represents the transformation M2 + * followed by the transformation M1. (Out = M1 * M2) */ D3DXMATRIX* WINAPI D3DXMatrixMultiply ( D3DXMATRIX *pOut, CONST D3DXMATRIX *pM1, CONST D3DXMATRIX *pM2 ); -// Matrix multiplication, followed by a transpose. (Out = T(M1 * M2)) +/* Matrix multiplication, followed by a transpose. (Out = T(M1 * M2)) */ D3DXMATRIX* WINAPI D3DXMatrixMultiplyTranspose ( D3DXMATRIX *pOut, CONST D3DXMATRIX *pM1, CONST D3DXMATRIX *pM2 ); -// Calculate inverse of matrix. Inversion my fail, in which case NULL will -// be returned. The determinant of pM is also returned it pfDeterminant -// is non-NULL. +/* Calculate inverse of matrix. Inversion my fail, in which case NULL will + * be returned. The determinant of pM is also returned it pfDeterminant + * is non-NULL. */ D3DXMATRIX* WINAPI D3DXMatrixInverse ( D3DXMATRIX *pOut, FLOAT *pDeterminant, CONST D3DXMATRIX *pM ); -// Build a matrix which scales by (sx, sy, sz) +/* Build a matrix which scales by (sx, sy, sz) */ D3DXMATRIX* WINAPI D3DXMatrixScaling ( D3DXMATRIX *pOut, FLOAT sx, FLOAT sy, FLOAT sz ); -// Build a matrix which translates by (x, y, z) +/* Build a matrix which translates by (x, y, z) */ D3DXMATRIX* WINAPI D3DXMatrixTranslation ( D3DXMATRIX *pOut, FLOAT x, FLOAT y, FLOAT z ); -// Build a matrix which rotates around the X axis +/* Build a matrix which rotates around the X axis */ D3DXMATRIX* WINAPI D3DXMatrixRotationX ( D3DXMATRIX *pOut, FLOAT Angle ); -// Build a matrix which rotates around the Y axis +/* Build a matrix which rotates around the Y axis */ D3DXMATRIX* WINAPI D3DXMatrixRotationY ( D3DXMATRIX *pOut, FLOAT Angle ); -// Build a matrix which rotates around the Z axis +/* Build a matrix which rotates around the Z axis */ D3DXMATRIX* WINAPI D3DXMatrixRotationZ ( D3DXMATRIX *pOut, FLOAT Angle ); -// Build a matrix which rotates around an arbitrary axis +/* Build a matrix which rotates around an arbitrary axis */ D3DXMATRIX* WINAPI D3DXMatrixRotationAxis ( D3DXMATRIX *pOut, CONST D3DXVECTOR3 *pV, FLOAT Angle ); -// Build a matrix from a quaternion +/* Build a matrix from a quaternion */ D3DXMATRIX* WINAPI D3DXMatrixRotationQuaternion ( D3DXMATRIX *pOut, CONST D3DXQUATERNION *pQ); -// Yaw around the Y axis, a pitch around the X axis, -// and a roll around the Z axis. +/* Yaw around the Y axis, a pitch around the X axis, + * and a roll around the Z axis. */ D3DXMATRIX* WINAPI D3DXMatrixRotationYawPitchRoll ( D3DXMATRIX *pOut, FLOAT Yaw, FLOAT Pitch, FLOAT Roll ); -// Build transformation matrix. NULL arguments are treated as identity. -// Mout = Msc-1 * Msr-1 * Ms * Msr * Msc * Mrc-1 * Mr * Mrc * Mt +/* Build transformation matrix. NULL arguments are treated as identity. + * Mout = Msc-1 * Msr-1 * Ms * Msr * Msc * Mrc-1 * Mr * Mrc * Mt */ D3DXMATRIX* WINAPI D3DXMatrixTransformation ( D3DXMATRIX *pOut, CONST D3DXVECTOR3 *pScalingCenter, CONST D3DXQUATERNION *pScalingRotation, CONST D3DXVECTOR3 *pScaling, CONST D3DXVECTOR3 *pRotationCenter, CONST D3DXQUATERNION *pRotation, CONST D3DXVECTOR3 *pTranslation); -// Build 2D transformation matrix in XY plane. NULL arguments are treated as identity. -// Mout = Msc-1 * Msr-1 * Ms * Msr * Msc * Mrc-1 * Mr * Mrc * Mt +/* Build 2D transformation matrix in XY plane. NULL arguments are treated as identity. + * Mout = Msc-1 * Msr-1 * Ms * Msr * Msc * Mrc-1 * Mr * Mrc * Mt */ D3DXMATRIX* WINAPI D3DXMatrixTransformation2D ( D3DXMATRIX *pOut, CONST D3DXVECTOR2* pScalingCenter, FLOAT ScalingRotation, CONST D3DXVECTOR2* pScaling, CONST D3DXVECTOR2* pRotationCenter, FLOAT Rotation, CONST D3DXVECTOR2* pTranslation); -// Build affine transformation matrix. NULL arguments are treated as identity. -// Mout = Ms * Mrc-1 * Mr * Mrc * Mt +/* Build affine transformation matrix. NULL arguments are treated as identity. + * Mout = Ms * Mrc-1 * Mr * Mrc * Mt */ D3DXMATRIX* WINAPI D3DXMatrixAffineTransformation ( D3DXMATRIX *pOut, FLOAT Scaling, CONST D3DXVECTOR3 *pRotationCenter, CONST D3DXQUATERNION *pRotation, CONST D3DXVECTOR3 *pTranslation); -// Build 2D affine transformation matrix in XY plane. NULL arguments are treated as identity. -// Mout = Ms * Mrc-1 * Mr * Mrc * Mt +/* Build 2D affine transformation matrix in XY plane. NULL arguments are treated as identity. + * Mout = Ms * Mrc-1 * Mr * Mrc * Mt */ D3DXMATRIX* WINAPI D3DXMatrixAffineTransformation2D ( D3DXMATRIX *pOut, FLOAT Scaling, CONST D3DXVECTOR2* pRotationCenter, FLOAT Rotation, CONST D3DXVECTOR2* pTranslation); -// Build a lookat matrix. (right-handed) +/* Build a lookat matrix. (right-handed) */ D3DXMATRIX* WINAPI D3DXMatrixLookAtRH ( D3DXMATRIX *pOut, CONST D3DXVECTOR3 *pEye, CONST D3DXVECTOR3 *pAt, CONST D3DXVECTOR3 *pUp ); -// Build a lookat matrix. (left-handed) +/* Build a lookat matrix. (left-handed) */ D3DXMATRIX* WINAPI D3DXMatrixLookAtLH ( D3DXMATRIX *pOut, CONST D3DXVECTOR3 *pEye, CONST D3DXVECTOR3 *pAt, CONST D3DXVECTOR3 *pUp ); -// Build a perspective projection matrix. (right-handed) +/* Build a perspective projection matrix. (right-handed) */ D3DXMATRIX* WINAPI D3DXMatrixPerspectiveRH ( D3DXMATRIX *pOut, FLOAT w, FLOAT h, FLOAT zn, FLOAT zf ); -// Build a perspective projection matrix. (left-handed) +/* Build a perspective projection matrix. (left-handed) */ D3DXMATRIX* WINAPI D3DXMatrixPerspectiveLH ( D3DXMATRIX *pOut, FLOAT w, FLOAT h, FLOAT zn, FLOAT zf ); -// Build a perspective projection matrix. (right-handed) +/* Build a perspective projection matrix. (right-handed) */ D3DXMATRIX* WINAPI D3DXMatrixPerspectiveFovRH ( D3DXMATRIX *pOut, FLOAT fovy, FLOAT Aspect, FLOAT zn, FLOAT zf ); -// Build a perspective projection matrix. (left-handed) +/* Build a perspective projection matrix. (left-handed) */ D3DXMATRIX* WINAPI D3DXMatrixPerspectiveFovLH ( D3DXMATRIX *pOut, FLOAT fovy, FLOAT Aspect, FLOAT zn, FLOAT zf ); -// Build a perspective projection matrix. (right-handed) +/* Build a perspective projection matrix. (right-handed) */ D3DXMATRIX* WINAPI D3DXMatrixPerspectiveOffCenterRH ( D3DXMATRIX *pOut, FLOAT l, FLOAT r, FLOAT b, FLOAT t, FLOAT zn, FLOAT zf ); -// Build a perspective projection matrix. (left-handed) +/* Build a perspective projection matrix. (left-handed) */ D3DXMATRIX* WINAPI D3DXMatrixPerspectiveOffCenterLH ( D3DXMATRIX *pOut, FLOAT l, FLOAT r, FLOAT b, FLOAT t, FLOAT zn, FLOAT zf ); -// Build an ortho projection matrix. (right-handed) +/* Build an ortho projection matrix. (right-handed) */ D3DXMATRIX* WINAPI D3DXMatrixOrthoRH ( D3DXMATRIX *pOut, FLOAT w, FLOAT h, FLOAT zn, FLOAT zf ); -// Build an ortho projection matrix. (left-handed) +/* Build an ortho projection matrix. (left-handed) */ D3DXMATRIX* WINAPI D3DXMatrixOrthoLH ( D3DXMATRIX *pOut, FLOAT w, FLOAT h, FLOAT zn, FLOAT zf ); -// Build an ortho projection matrix. (right-handed) +/* Build an ortho projection matrix. (right-handed) */ D3DXMATRIX* WINAPI D3DXMatrixOrthoOffCenterRH ( D3DXMATRIX *pOut, FLOAT l, FLOAT r, FLOAT b, FLOAT t, FLOAT zn, FLOAT zf ); -// Build an ortho projection matrix. (left-handed) +/* Build an ortho projection matrix. (left-handed) */ D3DXMATRIX* WINAPI D3DXMatrixOrthoOffCenterLH ( D3DXMATRIX *pOut, FLOAT l, FLOAT r, FLOAT b, FLOAT t, FLOAT zn, FLOAT zf ); -// Build a matrix which flattens geometry into a plane, as if casting -// a shadow from a light. +/* Build a matrix which flattens geometry into a plane, as if casting + * a shadow from a light. */ D3DXMATRIX* WINAPI D3DXMatrixShadow ( D3DXMATRIX *pOut, CONST D3DXVECTOR4 *pLight, CONST D3DXPLANE *pPlane ); -// Build a matrix which reflects the coordinate system about a plane +/* Build a matrix which reflects the coordinate system about a plane */ D3DXMATRIX* WINAPI D3DXMatrixReflect ( D3DXMATRIX *pOut, CONST D3DXPLANE *pPlane ); @@ -1053,10 +1040,9 @@ D3DXMATRIX* WINAPI D3DXMatrixReflect } #endif - -//-------------------------- -// Quaternion -//-------------------------- +/* + * Quaternion + */ /* inline */ @@ -1077,35 +1063,34 @@ D3DXQUATERNION* D3DXQuaternionIdentity BOOL D3DXQuaternionIsIdentity ( CONST D3DXQUATERNION *pQ ); -// (-x, -y, -z, w) +/* (-x, -y, -z, w) */ D3DXQUATERNION* D3DXQuaternionConjugate ( D3DXQUATERNION *pOut, CONST D3DXQUATERNION *pQ ); - -// non-inline +/* non-inline */ #ifdef __cplusplus extern "C" { #endif -// Compute a quaternin's axis and angle of rotation. Expects unit quaternions. +/* Compute a quaternin's axis and angle of rotation. Expects unit quaternions. */ void WINAPI D3DXQuaternionToAxisAngle ( CONST D3DXQUATERNION *pQ, D3DXVECTOR3 *pAxis, FLOAT *pAngle ); -// Build a quaternion from a rotation matrix. +/* Build a quaternion from a rotation matrix. */ D3DXQUATERNION* WINAPI D3DXQuaternionRotationMatrix ( D3DXQUATERNION *pOut, CONST D3DXMATRIX *pM); -// Rotation about arbitrary axis. +/* Rotation about arbitrary axis. */ D3DXQUATERNION* WINAPI D3DXQuaternionRotationAxis ( D3DXQUATERNION *pOut, CONST D3DXVECTOR3 *pV, FLOAT Angle ); -// Yaw around the Y axis, a pitch around the X axis, -// and a roll around the Z axis. +/* Yaw around the Y axis, a pitch around the X axis, + * and a roll around the Z axis. */ D3DXQUATERNION* WINAPI D3DXQuaternionRotationYawPitchRoll ( D3DXQUATERNION *pOut, FLOAT Yaw, FLOAT Pitch, FLOAT Roll ); -// Quaternion multiplication. The result represents the rotation Q2 -// followed by the rotation Q1. (Out = Q2 * Q1) +/* Quaternion multiplication. The result represents the rotation Q2 + * followed by the rotation Q1. (Out = Q2 * Q1) */ D3DXQUATERNION* WINAPI D3DXQuaternionMultiply ( D3DXQUATERNION *pOut, CONST D3DXQUATERNION *pQ1, CONST D3DXQUATERNION *pQ2 ); @@ -1113,43 +1098,43 @@ D3DXQUATERNION* WINAPI D3DXQuaternionMultiply D3DXQUATERNION* WINAPI D3DXQuaternionNormalize ( D3DXQUATERNION *pOut, CONST D3DXQUATERNION *pQ ); -// Conjugate and re-norm +/* Conjugate and re-norm */ D3DXQUATERNION* WINAPI D3DXQuaternionInverse ( D3DXQUATERNION *pOut, CONST D3DXQUATERNION *pQ ); -// Expects unit quaternions. -// if q = (cos(theta), sin(theta) * v); ln(q) = (0, theta * v) +/* Expects unit quaternions. + * if q = (cos(theta), sin(theta) * v); ln(q) = (0, theta * v) */ D3DXQUATERNION* WINAPI D3DXQuaternionLn ( D3DXQUATERNION *pOut, CONST D3DXQUATERNION *pQ ); -// Expects pure quaternions. (w == 0) w is ignored in calculation. -// if q = (0, theta * v); exp(q) = (cos(theta), sin(theta) * v) +/* Expects pure quaternions. (w == 0) w is ignored in calculation. + * if q = (0, theta * v); exp(q) = (cos(theta), sin(theta) * v) */ D3DXQUATERNION* WINAPI D3DXQuaternionExp ( D3DXQUATERNION *pOut, CONST D3DXQUATERNION *pQ ); -// Spherical linear interpolation between Q1 (t == 0) and Q2 (t == 1). -// Expects unit quaternions. +/* Spherical linear interpolation between Q1 (t == 0) and Q2 (t == 1). + * Expects unit quaternions. */ D3DXQUATERNION* WINAPI D3DXQuaternionSlerp ( D3DXQUATERNION *pOut, CONST D3DXQUATERNION *pQ1, CONST D3DXQUATERNION *pQ2, FLOAT t ); -// Spherical quadrangle interpolation. -// Slerp(Slerp(Q1, C, t), Slerp(A, B, t), 2t(1-t)) +/* Spherical quadrangle interpolation. + * Slerp(Slerp(Q1, C, t), Slerp(A, B, t), 2t(1-t)) */ D3DXQUATERNION* WINAPI D3DXQuaternionSquad ( D3DXQUATERNION *pOut, CONST D3DXQUATERNION *pQ1, CONST D3DXQUATERNION *pA, CONST D3DXQUATERNION *pB, CONST D3DXQUATERNION *pC, FLOAT t ); -// Setup control points for spherical quadrangle interpolation -// from Q1 to Q2. The control points are chosen in such a way -// to ensure the continuity of tangents with adjacent segments. +/* Setup control points for spherical quadrangle interpolation + * from Q1 to Q2. The control points are chosen in such a way + * to ensure the continuity of tangents with adjacent segments. */ void WINAPI D3DXQuaternionSquadSetup ( D3DXQUATERNION *pAOut, D3DXQUATERNION *pBOut, D3DXQUATERNION *pCOut, CONST D3DXQUATERNION *pQ0, CONST D3DXQUATERNION *pQ1, CONST D3DXQUATERNION *pQ2, CONST D3DXQUATERNION *pQ3 ); -// Barycentric interpolation. -// Slerp(Slerp(Q1, Q2, f+g), Slerp(Q1, Q3, f+g), g/(f+g)) +/* Barycentric interpolation. + * Slerp(Slerp(Q1, Q2, f+g), Slerp(Q1, Q3, f+g), g/(f+g)) */ D3DXQUATERNION* WINAPI D3DXQuaternionBaryCentric ( D3DXQUATERNION *pOut, CONST D3DXQUATERNION *pQ1, CONST D3DXQUATERNION *pQ2, CONST D3DXQUATERNION *pQ3, @@ -1160,58 +1145,58 @@ D3DXQUATERNION* WINAPI D3DXQuaternionBaryCentric #endif -//-------------------------- -// Plane -//-------------------------- +/* + * Plane +*/ -// inline +/* inline */ -// ax + by + cz + dw +/* ax + by + cz + dw */ FLOAT D3DXPlaneDot ( CONST D3DXPLANE *pP, CONST D3DXVECTOR4 *pV); -// ax + by + cz + d +/* ax + by + cz + d */ FLOAT D3DXPlaneDotCoord ( CONST D3DXPLANE *pP, CONST D3DXVECTOR3 *pV); -// ax + by + cz +/* ax + by + cz */ FLOAT D3DXPlaneDotNormal ( CONST D3DXPLANE *pP, CONST D3DXVECTOR3 *pV); D3DXPLANE* D3DXPlaneScale (D3DXPLANE *pOut, CONST D3DXPLANE *pP, FLOAT s); -// non-inline +/* non-inline */ #ifdef __cplusplus extern "C" { #endif -// Normalize plane (so that |a,b,c| == 1) +/* Normalize plane (so that |a,b,c| == 1) */ D3DXPLANE* WINAPI D3DXPlaneNormalize ( D3DXPLANE *pOut, CONST D3DXPLANE *pP); -// Find the intersection between a plane and a line. If the line is -// parallel to the plane, NULL is returned. +/* Find the intersection between a plane and a line. If the line is + * parallel to the plane, NULL is returned. */ D3DXVECTOR3* WINAPI D3DXPlaneIntersectLine ( D3DXVECTOR3 *pOut, CONST D3DXPLANE *pP, CONST D3DXVECTOR3 *pV1, CONST D3DXVECTOR3 *pV2); -// Construct a plane from a point and a normal +/* Construct a plane from a point and a normal */ D3DXPLANE* WINAPI D3DXPlaneFromPointNormal ( D3DXPLANE *pOut, CONST D3DXVECTOR3 *pPoint, CONST D3DXVECTOR3 *pNormal); -// Construct a plane from 3 points +/* Construct a plane from 3 points */ D3DXPLANE* WINAPI D3DXPlaneFromPoints ( D3DXPLANE *pOut, CONST D3DXVECTOR3 *pV1, CONST D3DXVECTOR3 *pV2, CONST D3DXVECTOR3 *pV3); -// Transform a plane by a matrix. The vector (a,b,c) must be normal. -// M should be the inverse transpose of the transformation desired. +/* Transform a plane by a matrix. The vector (a,b,c) must be normal. + * M should be the inverse transpose of the transformation desired. */ D3DXPLANE* WINAPI D3DXPlaneTransform ( D3DXPLANE *pOut, CONST D3DXPLANE *pP, CONST D3DXMATRIX *pM ); -// Transform an array of planes by a matrix. The vectors (a,b,c) must be normal. -// M should be the inverse transpose of the transformation desired. +/* Transform an array of planes by a matrix. The vectors (a,b,c) must be normal. + * M should be the inverse transpose of the transformation desired. */ D3DXPLANE* WINAPI D3DXPlaneTransformArray ( D3DXPLANE *pOut, UINT OutStride, CONST D3DXPLANE *pP, UINT PStride, CONST D3DXMATRIX *pM, UINT n ); @@ -1219,14 +1204,13 @@ D3DXPLANE* WINAPI D3DXPlaneTransformArray } #endif +/* + * Color + */ -//-------------------------- -// Color -//-------------------------- +/* inline */ -// inline - -// (1-r, 1-g, 1-b, a) +/* (1-r, 1-g, 1-b, a) */ D3DXCOLOR* D3DXColorNegative (D3DXCOLOR *pOut, CONST D3DXCOLOR *pC); @@ -1239,25 +1223,25 @@ D3DXCOLOR* D3DXColorSubtract D3DXCOLOR* D3DXColorScale (D3DXCOLOR *pOut, CONST D3DXCOLOR *pC, FLOAT s); -// (r1*r2, g1*g2, b1*b2, a1*a2) +/* (r1*r2, g1*g2, b1*b2, a1*a2) */ D3DXCOLOR* D3DXColorModulate (D3DXCOLOR *pOut, CONST D3DXCOLOR *pC1, CONST D3DXCOLOR *pC2); -// Linear interpolation of r,g,b, and a. C1 + s(C2-C1) +/* Linear interpolation of r,g,b, and a. C1 + s(C2-C1) */ D3DXCOLOR* D3DXColorLerp (D3DXCOLOR *pOut, CONST D3DXCOLOR *pC1, CONST D3DXCOLOR *pC2, FLOAT s); -// non-inline +/* non-inline */ #ifdef __cplusplus extern "C" { #endif -// Interpolate r,g,b between desaturated color and color. -// DesaturatedColor + s(Color - DesaturatedColor) +/* Interpolate r,g,b between desaturated color and color. + * DesaturatedColor + s(Color - DesaturatedColor) */ D3DXCOLOR* WINAPI D3DXColorAdjustSaturation (D3DXCOLOR *pOut, CONST D3DXCOLOR *pC, FLOAT s); -// Interpolate r,g,b between 50% grey and color. Grey + s(Color - Grey) +/* Interpolate r,g,b between 50% grey and color. Grey + s(Color - Grey) */ D3DXCOLOR* WINAPI D3DXColorAdjustContrast (D3DXCOLOR *pOut, CONST D3DXCOLOR *pC, FLOAT c); @@ -1265,16 +1249,16 @@ D3DXCOLOR* WINAPI D3DXColorAdjustContrast } #endif -//-------------------------- -// Misc -//-------------------------- +/* + * Misc +*/ #ifdef __cplusplus extern "C" { #endif -// Calculate Fresnel term given the cosine of theta (likely obtained by -// taking the dot of two normals), and the refraction index of the material. +/* Calculate Fresnel term given the cosine of theta (likely obtained by + * taking the dot of two normals), and the refraction index of the material. */ FLOAT WINAPI D3DXFresnelTerm (FLOAT CosTheta, FLOAT RefractionIndex); @@ -1282,16 +1266,15 @@ FLOAT WINAPI D3DXFresnelTerm } #endif -//=========================================================================== -// -// Matrix Stack -// -//=========================================================================== +/* + * + * Matrix Stack + */ typedef interface ID3DXMatrixStack ID3DXMatrixStack; typedef interface ID3DXMatrixStack *LPD3DXMATRIXSTACK; -// {C7885BA7-F990-4fe7-922D-8515E477DD85} +/* {C7885BA7-F990-4fe7-922D-8515E477DD85} */ DEFINE_GUID(IID_ID3DXMatrixStack, 0xc7885ba7, 0xf990, 0x4fe7, 0x92, 0x2d, 0x85, 0x15, 0xe4, 0x77, 0xdd, 0x85); @@ -1301,85 +1284,83 @@ DEFINE_GUID(IID_ID3DXMatrixStack, DECLARE_INTERFACE_(ID3DXMatrixStack, IUnknown) { - // - // IUnknown methods - // + /* IUnknown methods */ STDMETHOD(QueryInterface)(THIS_ REFIID riid, LPVOID * ppvObj) PURE; STDMETHOD_(ULONG,AddRef)(THIS) PURE; STDMETHOD_(ULONG,Release)(THIS) PURE; - // - // ID3DXMatrixStack methods - // + /* ID3DXMatrixStack methods */ - // Pops the top of the stack, returns the current top - // *after* popping the top. + /* Pops the top of the stack, returns the current top + * *after* popping the top. */ STDMETHOD(Pop)(THIS) PURE; - // Pushes the stack by one, duplicating the current matrix. + /* Pushes the stack by one, duplicating the current matrix. */ STDMETHOD(Push)(THIS) PURE; - // Loads identity in the current matrix. + /* Loads identity in the current matrix. */ STDMETHOD(LoadIdentity)(THIS) PURE; - // Loads the given matrix into the current matrix + /* Loads the given matrix into the current matrix */ STDMETHOD(LoadMatrix)(THIS_ CONST D3DXMATRIX* pM ) PURE; - // Right-Multiplies the given matrix to the current matrix. - // (transformation is about the current world origin) + /* Right-Multiplies the given matrix to the current matrix. + * (transformation is about the current world origin) */ STDMETHOD(MultMatrix)(THIS_ CONST D3DXMATRIX* pM ) PURE; - // Left-Multiplies the given matrix to the current matrix - // (transformation is about the local origin of the object) + /* Left-Multiplies the given matrix to the current matrix + * (transformation is about the local origin of the object) */ STDMETHOD(MultMatrixLocal)(THIS_ CONST D3DXMATRIX* pM ) PURE; - // Right multiply the current matrix with the computed rotation - // matrix, counterclockwise about the given axis with the given angle. - // (rotation is about the current world origin) + /* Right multiply the current matrix with the computed rotation + * matrix, counterclockwise about the given axis with the given angle. + * (rotation is about the current world origin) */ STDMETHOD(RotateAxis) (THIS_ CONST D3DXVECTOR3* pV, FLOAT Angle) PURE; - // Left multiply the current matrix with the computed rotation - // matrix, counterclockwise about the given axis with the given angle. - // (rotation is about the local origin of the object) + /* Left multiply the current matrix with the computed rotation + * matrix, counterclockwise about the given axis with the given angle. + * (rotation is about the local origin of the object) */ STDMETHOD(RotateAxisLocal) (THIS_ CONST D3DXVECTOR3* pV, FLOAT Angle) PURE; - // Right multiply the current matrix with the computed rotation - // matrix. All angles are counterclockwise. (rotation is about the - // current world origin) + /* Right multiply the current matrix with the computed rotation + * matrix. All angles are counterclockwise. (rotation is about the + * current world origin) - // The rotation is composed of a yaw around the Y axis, a pitch around - // the X axis, and a roll around the Z axis. + * The rotation is composed of a yaw around the Y axis, a pitch around + * the X axis, and a roll around the Z axis. + */ STDMETHOD(RotateYawPitchRoll) (THIS_ FLOAT Yaw, FLOAT Pitch, FLOAT Roll) PURE; - // Left multiply the current matrix with the computed rotation - // matrix. All angles are counterclockwise. (rotation is about the - // local origin of the object) + /* Left multiply the current matrix with the computed rotation + * matrix. All angles are counterclockwise. (rotation is about the + * local origin of the object) - // The rotation is composed of a yaw around the Y axis, a pitch around - // the X axis, and a roll around the Z axis. + * The rotation is composed of a yaw around the Y axis, a pitch around + * the X axis, and a roll around the Z axis. + */ STDMETHOD(RotateYawPitchRollLocal) (THIS_ FLOAT Yaw, FLOAT Pitch, FLOAT Roll) PURE; - // Right multiply the current matrix with the computed scale - // matrix. (transformation is about the current world origin) + /* Right multiply the current matrix with the computed scale + * matrix. (transformation is about the current world origin) */ STDMETHOD(Scale)(THIS_ FLOAT x, FLOAT y, FLOAT z) PURE; - // Left multiply the current matrix with the computed scale - // matrix. (transformation is about the local origin of the object) + /* Left multiply the current matrix with the computed scale + * matrix. (transformation is about the local origin of the object) */ STDMETHOD(ScaleLocal)(THIS_ FLOAT x, FLOAT y, FLOAT z) PURE; - // Right multiply the current matrix with the computed translation - // matrix. (transformation is about the current world origin) + /* Right multiply the current matrix with the computed translation + * matrix. (transformation is about the current world origin) */ STDMETHOD(Translate)(THIS_ FLOAT x, FLOAT y, FLOAT z ) PURE; - // Left multiply the current matrix with the computed translation - // matrix. (transformation is about the local origin of the object) + /* Left multiply the current matrix with the computed translation + * matrix. (transformation is about the local origin of the object) */ STDMETHOD(TranslateLocal)(THIS_ FLOAT x, FLOAT y, FLOAT z) PURE; - // Obtain the current matrix at the top of the stack + /* Obtain the current matrix at the top of the stack */ STDMETHOD_(D3DXMATRIX*, GetTop)(THIS) PURE; }; @@ -1396,30 +1377,27 @@ HRESULT WINAPI } #endif -//=========================================================================== -// -// Spherical Harmonic Runtime Routines -// -// NOTE: -// * Most of these functions can take the same object as in and out parameters. -// The exceptions are the rotation functions. -// -// * Out parameters are typically also returned as return values, so that -// the output of one function may be used as a parameter to another. -// -//============================================================================ +/* + * + * Spherical Harmonic Runtime Routines + * + * NOTE: + * * Most of these functions can take the same object as in and out parameters. + * The exceptions are the rotation functions. + * + * * Out parameters are typically also returned as return values, so that + * the output of one function may be used as a parameter to another. + */ - -// non-inline +/* non-inline */ #ifdef __cplusplus extern "C" { #endif -//============================================================================ -// -// Basic Spherical Harmonic math routines -// -//============================================================================ +/* + * + * Basic Spherical Harmonic math routines + */ #define D3DXSH_MINORDER 2 #define D3DXSH_MAXORDER 6 @@ -1448,12 +1426,10 @@ FLOAT* WINAPI D3DXSHMultiply4( FLOAT *pOut, CONST FLOAT *pF, CONST FLOAT *pG); FLOAT* WINAPI D3DXSHMultiply5( FLOAT *pOut, CONST FLOAT *pF, CONST FLOAT *pG); FLOAT* WINAPI D3DXSHMultiply6( FLOAT *pOut, CONST FLOAT *pF, CONST FLOAT *pG); - -//============================================================================ -// -// Basic Spherical Harmonic lighting routines -// -//============================================================================ +/* + * + * Basic Spherical Harmonic lighting routines + */ HRESULT WINAPI D3DXSHEvalDirectionalLight ( UINT Order, CONST D3DXVECTOR3 *pDir, @@ -1474,31 +1450,29 @@ HRESULT WINAPI D3DXSHEvalHemisphereLight ( UINT Order, CONST D3DXVECTOR3 *pDir, D3DXCOLOR Top, D3DXCOLOR Bottom, FLOAT *pROut, FLOAT *pGOut, FLOAT *pBOut ); -//============================================================================ -// -// Basic Spherical Harmonic projection routines -// -//============================================================================ +/* + * + * Basic Spherical Harmonic projection routines + */ -//============================================================================ -// -// D3DXSHProjectCubeMap: -// -------------------- -// Projects a function represented on a cube map into spherical harmonics. -// -// Parameters: -// Order -// Order of the SH evaluation, generates Order^2 coefs, degree is Order-1 -// pCubeMap -// CubeMap that is going to be projected into spherical harmonics -// pROut -// Output SH vector for Red. -// pGOut -// Output SH vector for Green -// pBOut -// Output SH vector for Blue -// -//============================================================================ +/* + * + * D3DXSHProjectCubeMap: + * -------------------- + * Projects a function represented on a cube map into spherical harmonics. + * + * Parameters: + * Order + * Order of the SH evaluation, generates Order^2 coefs, degree is Order-1 + * pCubeMap + * CubeMap that is going to be projected into spherical harmonics + * pROut + * Output SH vector for Red. + * pGOut + * Output SH vector for Green + * pBOut + * Output SH vector for Blue + */ HRESULT WINAPI D3DXSHProjectCubeMap ( UINT uOrder, LPDIRECT3DCUBETEXTURE9 pCubeMap, diff --git a/gfx/include/d3d9/d3dx9math.inl b/gfx/include/d3d9/d3dx9math.inl index 1d747453da..08a408fc7c 100644 --- a/gfx/include/d3d9/d3dx9math.inl +++ b/gfx/include/d3d9/d3dx9math.inl @@ -1,26 +1,24 @@ -////////////////////////////////////////////////////////////////////////////// -// -// Copyright (C) Microsoft Corporation. All Rights Reserved. -// -// File: d3dx9math.inl -// Content: D3DX math inline functions -// -////////////////////////////////////////////////////////////////////////////// +/* + * + * Copyright (C) Microsoft Corporation. All Rights Reserved. + * + * File: d3dx9math.inl + * Content: D3DX math inline functions + */ #ifndef __D3DX9MATH_INL__ #define __D3DX9MATH_INL__ -//=========================================================================== -// -// Inline Class Methods -// -//=========================================================================== +/* + * + * Inline Class Methods + */ #ifdef __cplusplus -//-------------------------- -// Float16 -//-------------------------- +/* + * Float16 + */ D3DXINLINE D3DXFLOAT16::D3DXFLOAT16( FLOAT f ) @@ -34,7 +32,7 @@ D3DXFLOAT16::D3DXFLOAT16( CONST D3DXFLOAT16& f ) value = f.value; } -// casting +/* casting */ D3DXINLINE D3DXFLOAT16::operator FLOAT () { @@ -43,7 +41,7 @@ D3DXFLOAT16::operator FLOAT () return f; } -// binary operators +/* binary operators */ D3DXINLINE BOOL D3DXFLOAT16::operator == ( CONST D3DXFLOAT16& f ) const { @@ -57,9 +55,9 @@ D3DXFLOAT16::operator != ( CONST D3DXFLOAT16& f ) const } -//-------------------------- -// 2D Vector -//-------------------------- +/* + * 2D Vector + */ D3DXINLINE D3DXVECTOR2::D3DXVECTOR2( CONST FLOAT *pf ) @@ -81,8 +79,7 @@ D3DXVECTOR2::D3DXVECTOR2( FLOAT fx, FLOAT fy ) y = fy; } - -// casting +/* casting */ D3DXINLINE D3DXVECTOR2::operator FLOAT* () { @@ -95,8 +92,7 @@ D3DXVECTOR2::operator CONST FLOAT* () const return (CONST FLOAT *) &x; } - -// assignment operators +/* assignment operators */ D3DXINLINE D3DXVECTOR2& D3DXVECTOR2::operator += ( CONST D3DXVECTOR2& v ) { @@ -130,8 +126,7 @@ D3DXVECTOR2::operator /= ( FLOAT f ) return *this; } - -// unary operators +/* unary operators */ D3DXINLINE D3DXVECTOR2 D3DXVECTOR2::operator + () const { @@ -144,8 +139,7 @@ D3DXVECTOR2::operator - () const return D3DXVECTOR2(-x, -y); } - -// binary operators +/* binary operators */ D3DXINLINE D3DXVECTOR2 D3DXVECTOR2::operator + ( CONST D3DXVECTOR2& v ) const { @@ -189,11 +183,9 @@ D3DXVECTOR2::operator != ( CONST D3DXVECTOR2& v ) const return x != v.x || y != v.y; } - - -//-------------------------- -// 2D Vector (16 bit) -//-------------------------- +/* + * 2D Vector (16 bit) + */ D3DXINLINE D3DXVECTOR2_16F::D3DXVECTOR2_16F( CONST FLOAT *pf ) @@ -214,8 +206,7 @@ D3DXVECTOR2_16F::D3DXVECTOR2_16F( CONST D3DXFLOAT16 &fx, CONST D3DXFLOAT16 &fy ) y = fy; } - -// casting +/* casting */ D3DXINLINE D3DXVECTOR2_16F::operator D3DXFLOAT16* () { @@ -228,8 +219,7 @@ D3DXVECTOR2_16F::operator CONST D3DXFLOAT16* () const return (CONST D3DXFLOAT16*) &x; } - -// binary operators +/* binary operators */ D3DXINLINE BOOL D3DXVECTOR2_16F::operator == ( CONST D3DXVECTOR2_16F &v ) const { @@ -243,9 +233,9 @@ D3DXVECTOR2_16F::operator != ( CONST D3DXVECTOR2_16F &v ) const } -//-------------------------- -// 3D Vector -//-------------------------- +/* + * 3D Vector + */ D3DXINLINE D3DXVECTOR3::D3DXVECTOR3( CONST FLOAT *pf ) { @@ -276,8 +266,7 @@ D3DXVECTOR3::D3DXVECTOR3( FLOAT fx, FLOAT fy, FLOAT fz ) z = fz; } - -// casting +/* casting */ D3DXINLINE D3DXVECTOR3::operator FLOAT* () { @@ -290,8 +279,7 @@ D3DXVECTOR3::operator CONST FLOAT* () const return (CONST FLOAT *) &x; } - -// assignment operators +/* assignment operators */ D3DXINLINE D3DXVECTOR3& D3DXVECTOR3::operator += ( CONST D3DXVECTOR3& v ) { @@ -329,8 +317,7 @@ D3DXVECTOR3::operator /= ( FLOAT f ) return *this; } - -// unary operators +/* unary operators */ D3DXINLINE D3DXVECTOR3 D3DXVECTOR3::operator + () const { @@ -343,8 +330,7 @@ D3DXVECTOR3::operator - () const return D3DXVECTOR3(-x, -y, -z); } - -// binary operators +/* binary operators */ D3DXINLINE D3DXVECTOR3 D3DXVECTOR3::operator + ( CONST D3DXVECTOR3& v ) const { @@ -390,11 +376,9 @@ D3DXVECTOR3::operator != ( CONST D3DXVECTOR3& v ) const return x != v.x || y != v.y || z != v.z; } - - -//-------------------------- -// 3D Vector (16 bit) -//-------------------------- +/* + * 3D Vector (16 bit) + */ D3DXINLINE D3DXVECTOR3_16F::D3DXVECTOR3_16F( CONST FLOAT *pf ) @@ -425,8 +409,7 @@ D3DXVECTOR3_16F::D3DXVECTOR3_16F( CONST D3DXFLOAT16 &fx, CONST D3DXFLOAT16 &fy, z = fz; } - -// casting +/* casting */ D3DXINLINE D3DXVECTOR3_16F::operator D3DXFLOAT16* () { @@ -439,8 +422,7 @@ D3DXVECTOR3_16F::operator CONST D3DXFLOAT16* () const return (CONST D3DXFLOAT16*) &x; } - -// binary operators +/* binary operators */ D3DXINLINE BOOL D3DXVECTOR3_16F::operator == ( CONST D3DXVECTOR3_16F &v ) const { @@ -456,9 +438,9 @@ D3DXVECTOR3_16F::operator != ( CONST D3DXVECTOR3_16F &v ) const } -//-------------------------- -// 4D Vector -//-------------------------- +/* + * 4D Vector + */ D3DXINLINE D3DXVECTOR4::D3DXVECTOR4( CONST FLOAT *pf ) { @@ -492,8 +474,7 @@ D3DXVECTOR4::D3DXVECTOR4( FLOAT fx, FLOAT fy, FLOAT fz, FLOAT fw ) w = fw; } - -// casting +/* casting */ D3DXINLINE D3DXVECTOR4::operator FLOAT* () { @@ -506,8 +487,7 @@ D3DXVECTOR4::operator CONST FLOAT* () const return (CONST FLOAT *) &x; } - -// assignment operators +/* assignment operators */ D3DXINLINE D3DXVECTOR4& D3DXVECTOR4::operator += ( CONST D3DXVECTOR4& v ) { @@ -549,8 +529,7 @@ D3DXVECTOR4::operator /= ( FLOAT f ) return *this; } - -// unary operators +/* unary operators */ D3DXINLINE D3DXVECTOR4 D3DXVECTOR4::operator + () const { @@ -563,8 +542,7 @@ D3DXVECTOR4::operator - () const return D3DXVECTOR4(-x, -y, -z, -w); } - -// binary operators +/* binary operators */ D3DXINLINE D3DXVECTOR4 D3DXVECTOR4::operator + ( CONST D3DXVECTOR4& v ) const { @@ -609,11 +587,9 @@ D3DXVECTOR4::operator != ( CONST D3DXVECTOR4& v ) const return x != v.x || y != v.y || z != v.z || w != v.w; } - - -//-------------------------- -// 4D Vector (16 bit) -//-------------------------- +/* + * 4D Vector (16 bit) + */ D3DXINLINE D3DXVECTOR4_16F::D3DXVECTOR4_16F( CONST FLOAT *pf ) @@ -646,8 +622,7 @@ D3DXVECTOR4_16F::D3DXVECTOR4_16F( CONST D3DXFLOAT16 &fx, CONST D3DXFLOAT16 &fy, w = fw; } - -// casting +/* casting */ D3DXINLINE D3DXVECTOR4_16F::operator D3DXFLOAT16* () { @@ -660,8 +635,7 @@ D3DXVECTOR4_16F::operator CONST D3DXFLOAT16* () const return (CONST D3DXFLOAT16*) &x; } - -// binary operators +/* binary operators */ D3DXINLINE BOOL D3DXVECTOR4_16F::operator == ( CONST D3DXVECTOR4_16F &v ) const { @@ -677,9 +651,9 @@ D3DXVECTOR4_16F::operator != ( CONST D3DXVECTOR4_16F &v ) const } -//-------------------------- -// Matrix -//-------------------------- +/* + * Matrix + */ D3DXINLINE D3DXMATRIX::D3DXMATRIX( CONST FLOAT* pf ) { @@ -710,9 +684,7 @@ D3DXMATRIX::D3DXMATRIX( FLOAT f11, FLOAT f12, FLOAT f13, FLOAT f14, _41 = f41; _42 = f42; _43 = f43; _44 = f44; } - - -// access grants +/* access grants */ D3DXINLINE FLOAT& D3DXMATRIX::operator () ( UINT iRow, UINT iCol ) { @@ -725,8 +697,7 @@ D3DXMATRIX::operator () ( UINT iRow, UINT iCol ) const return m[iRow][iCol]; } - -// casting operators +/* casting operators */ D3DXINLINE D3DXMATRIX::operator FLOAT* () { @@ -739,8 +710,7 @@ D3DXMATRIX::operator CONST FLOAT* () const return (CONST FLOAT *) &_11; } - -// assignment operators +/* assignment operators */ D3DXINLINE D3DXMATRIX& D3DXMATRIX::operator *= ( CONST D3DXMATRIX& mat ) { @@ -789,8 +759,7 @@ D3DXMATRIX::operator /= ( FLOAT f ) return *this; } - -// unary operators +/* unary operators */ D3DXINLINE D3DXMATRIX D3DXMATRIX::operator + () const { @@ -806,8 +775,7 @@ D3DXMATRIX::operator - () const -_41, -_42, -_43, -_44); } - -// binary operators +/* binary operators */ D3DXINLINE D3DXMATRIX D3DXMATRIX::operator * ( CONST D3DXMATRIX& mat ) const { @@ -876,11 +844,9 @@ D3DXMATRIX::operator != ( CONST D3DXMATRIX& mat ) const return 0 != memcmp(this, &mat, sizeof(D3DXMATRIX)); } - - -//-------------------------- -// Aligned Matrices -//-------------------------- +/* + * Aligned Matrices + */ D3DXINLINE _D3DXMATRIXA16::_D3DXMATRIXA16( CONST FLOAT* f ) : @@ -975,10 +941,9 @@ _D3DXMATRIXA16::operator=(CONST D3DXMATRIX& rhs) return *this; } - -//-------------------------- -// Quaternion -//-------------------------- +/* + * Quaternion + */ D3DXINLINE D3DXQUATERNION::D3DXQUATERNION( CONST FLOAT* pf ) @@ -1004,8 +969,7 @@ D3DXQUATERNION::D3DXQUATERNION( FLOAT fx, FLOAT fy, FLOAT fz, FLOAT fw ) w = fw; } - -// casting +/* casting */ D3DXINLINE D3DXQUATERNION::operator FLOAT* () { @@ -1018,8 +982,7 @@ D3DXQUATERNION::operator CONST FLOAT* () const return (CONST FLOAT *) &x; } - -// assignment operators +/* assignment operators */ D3DXINLINE D3DXQUATERNION& D3DXQUATERNION::operator += ( CONST D3DXQUATERNION& q ) { @@ -1068,8 +1031,7 @@ D3DXQUATERNION::operator /= ( FLOAT f ) return *this; } - -// unary operators +/* unary operators */ D3DXINLINE D3DXQUATERNION D3DXQUATERNION::operator + () const { @@ -1082,8 +1044,7 @@ D3DXQUATERNION::operator - () const return D3DXQUATERNION(-x, -y, -z, -w); } - -// binary operators +/* binary operators */ D3DXINLINE D3DXQUATERNION D3DXQUATERNION::operator + ( CONST D3DXQUATERNION& q ) const { @@ -1137,11 +1098,9 @@ D3DXQUATERNION::operator != ( CONST D3DXQUATERNION& q ) const return x != q.x || y != q.y || z != q.z || w != q.w; } - - -//-------------------------- -// Plane -//-------------------------- +/* + * Plane + */ D3DXINLINE D3DXPLANE::D3DXPLANE( CONST FLOAT* pf ) @@ -1167,8 +1126,7 @@ D3DXPLANE::D3DXPLANE( FLOAT fa, FLOAT fb, FLOAT fc, FLOAT fd ) d = fd; } - -// casting +/* casting */ D3DXINLINE D3DXPLANE::operator FLOAT* () { @@ -1181,8 +1139,7 @@ D3DXPLANE::operator CONST FLOAT* () const return (CONST FLOAT *) &a; } - -// assignment operators +/* assignment operators */ D3DXINLINE D3DXPLANE& D3DXPLANE::operator *= ( FLOAT f ) { @@ -1204,8 +1161,7 @@ D3DXPLANE::operator /= ( FLOAT f ) return *this; } - -// unary operators +/* unary operators */ D3DXINLINE D3DXPLANE D3DXPLANE::operator + () const { @@ -1218,8 +1174,7 @@ D3DXPLANE::operator - () const return D3DXPLANE(-a, -b, -c, -d); } - -// binary operators +/* binary operators */ D3DXINLINE D3DXPLANE D3DXPLANE::operator * ( FLOAT f ) const { @@ -1251,12 +1206,9 @@ D3DXPLANE::operator != ( CONST D3DXPLANE& p ) const return a != p.a || b != p.b || c != p.c || d != p.d; } - - - -//-------------------------- -// Color -//-------------------------- +/* + * Color + */ D3DXINLINE D3DXCOLOR::D3DXCOLOR( DWORD dw ) @@ -1301,8 +1253,7 @@ D3DXCOLOR::D3DXCOLOR( FLOAT fr, FLOAT fg, FLOAT fb, FLOAT fa ) a = fa; } - -// casting +/* casting */ D3DXINLINE D3DXCOLOR::operator DWORD () const { @@ -1353,8 +1304,7 @@ D3DXCOLOR::operator CONST D3DCOLORVALUE& () const return *((CONST D3DCOLORVALUE *) &r); } - -// assignment operators +/* assignment operators */ D3DXINLINE D3DXCOLOR& D3DXCOLOR::operator += ( CONST D3DXCOLOR& c ) { @@ -1396,8 +1346,7 @@ D3DXCOLOR::operator /= ( FLOAT f ) return *this; } - -// unary operators +/* unary operators */ D3DXINLINE D3DXCOLOR D3DXCOLOR::operator + () const { @@ -1410,8 +1359,7 @@ D3DXCOLOR::operator - () const return D3DXCOLOR(-r, -g, -b, -a); } - -// binary operators +/* binary operators */ D3DXINLINE D3DXCOLOR D3DXCOLOR::operator + ( CONST D3DXCOLOR& c ) const { @@ -1458,20 +1406,17 @@ D3DXCOLOR::operator != ( CONST D3DXCOLOR& c ) const } -#endif //__cplusplus +#endif /*__cplusplus */ + +/* + * + * Inline functions + */ - -//=========================================================================== -// -// Inline functions -// -//=========================================================================== - - -//-------------------------- -// 2D Vector -//-------------------------- +/* + * 2D Vector + */ D3DXINLINE FLOAT D3DXVec2Length ( CONST D3DXVECTOR2 *pV ) @@ -1550,10 +1495,9 @@ D3DXINLINE D3DXVECTOR2* D3DXVec2Lerp return pOut; } - -//-------------------------- -// 3D Vector -//-------------------------- +/* + * 3D Vector + */ D3DXINLINE FLOAT D3DXVec3Length ( CONST D3DXVECTOR3 *pV ) @@ -1646,9 +1590,9 @@ D3DXINLINE D3DXVECTOR3* D3DXVec3Lerp } -//-------------------------- -// 4D Vector -//-------------------------- +/* + * 4D Vector + */ D3DXINLINE FLOAT D3DXVec4Length ( CONST D3DXVECTOR4 *pV ) @@ -1734,9 +1678,9 @@ D3DXINLINE D3DXVECTOR4* D3DXVec4Lerp } -//-------------------------- -// 4D Matrix -//-------------------------- +/* + * 4D Matrix + */ D3DXINLINE D3DXMATRIX* D3DXMatrixIdentity ( D3DXMATRIX *pOut ) @@ -1761,9 +1705,9 @@ D3DXINLINE BOOL D3DXMatrixIsIdentity } -//-------------------------- -// Quaternion -//-------------------------- +/* + * Quaternion + */ D3DXINLINE FLOAT D3DXQuaternionLength ( CONST D3DXQUATERNION *pQ ) @@ -1813,10 +1757,9 @@ D3DXINLINE D3DXQUATERNION* D3DXQuaternionConjugate return pOut; } - -//-------------------------- -// Plane -//-------------------------- +/* + * Plane + */ D3DXINLINE FLOAT D3DXPlaneDot ( CONST D3DXPLANE *pP, CONST D3DXVECTOR4 *pV) @@ -1847,9 +1790,9 @@ D3DXINLINE D3DXPLANE* D3DXPlaneScale } -//-------------------------- -// Color -//-------------------------- +/* + * Color + */ D3DXINLINE D3DXCOLOR* D3DXColorNegative (D3DXCOLOR *pOut, CONST D3DXCOLOR *pC) @@ -1912,4 +1855,4 @@ D3DXINLINE D3DXCOLOR* D3DXColorLerp } -#endif // __D3DX9MATH_INL__ +#endif /* __D3DX9MATH_INL__ */ diff --git a/gfx/include/d3d9/d3dx9mesh.h b/gfx/include/d3d9/d3dx9mesh.h index 68a4c77d5c..3d15c50542 100644 --- a/gfx/include/d3d9/d3dx9mesh.h +++ b/gfx/include/d3d9/d3dx9mesh.h @@ -16,71 +16,72 @@ DEFINE_GUID(IID_ID3DXBaseMesh, 0x7ed943dd, 0x52e8, 0x40b5, 0xa8, 0xd8, 0x76, 0x68, 0x5c, 0x40, 0x63, 0x30); -// {4020E5C2-1403-4929-883F-E2E849FAC195} +/* {4020E5C2-1403-4929-883F-E2E849FAC195} */ DEFINE_GUID(IID_ID3DXMesh, 0x4020e5c2, 0x1403, 0x4929, 0x88, 0x3f, 0xe2, 0xe8, 0x49, 0xfa, 0xc1, 0x95); -// {8875769A-D579-4088-AAEB-534D1AD84E96} +/* {8875769A-D579-4088-AAEB-534D1AD84E96} */ DEFINE_GUID(IID_ID3DXPMesh, 0x8875769a, 0xd579, 0x4088, 0xaa, 0xeb, 0x53, 0x4d, 0x1a, 0xd8, 0x4e, 0x96); -// {667EA4C7-F1CD-4386-B523-7C0290B83CC5} +/* {667EA4C7-F1CD-4386-B523-7C0290B83CC5} */ DEFINE_GUID(IID_ID3DXSPMesh, 0x667ea4c7, 0xf1cd, 0x4386, 0xb5, 0x23, 0x7c, 0x2, 0x90, 0xb8, 0x3c, 0xc5); -// {11EAA540-F9A6-4d49-AE6A-E19221F70CC4} +/* {11EAA540-F9A6-4d49-AE6A-E19221F70CC4} */ DEFINE_GUID(IID_ID3DXSkinInfo, 0x11eaa540, 0xf9a6, 0x4d49, 0xae, 0x6a, 0xe1, 0x92, 0x21, 0xf7, 0xc, 0xc4); -// {3CE6CC22-DBF2-44f4-894D-F9C34A337139} +/* {3CE6CC22-DBF2-44f4-894D-F9C34A337139} */ DEFINE_GUID(IID_ID3DXPatchMesh, 0x3ce6cc22, 0xdbf2, 0x44f4, 0x89, 0x4d, 0xf9, 0xc3, 0x4a, 0x33, 0x71, 0x39); -//patch mesh can be quads or tris -typedef enum _D3DXPATCHMESHTYPE { +/* patch mesh can be quads or tris */ +typedef enum _D3DXPATCHMESHTYPE +{ D3DXPATCHMESH_RECT = 0x001, D3DXPATCHMESH_TRI = 0x002, D3DXPATCHMESH_NPATCH = 0x003, - D3DXPATCHMESH_FORCE_DWORD = 0x7fffffff, /* force 32-bit size enum */ + D3DXPATCHMESH_FORCE_DWORD = 0x7fffffff /* force 32-bit size enum */ } D3DXPATCHMESHTYPE; -// Mesh options - lower 3 bytes only, upper byte used by _D3DXMESHOPT option flags +/* Mesh options - lower 3 bytes only, upper byte used by _D3DXMESHOPT option flags */ enum _D3DXMESH { - D3DXMESH_32BIT = 0x001, // If set, then use 32 bit indices, if not set use 16 bit indices. - D3DXMESH_DONOTCLIP = 0x002, // Use D3DUSAGE_DONOTCLIP for VB & IB. - D3DXMESH_POINTS = 0x004, // Use D3DUSAGE_POINTS for VB & IB. - D3DXMESH_RTPATCHES = 0x008, // Use D3DUSAGE_RTPATCHES for VB & IB. - D3DXMESH_NPATCHES = 0x4000,// Use D3DUSAGE_NPATCHES for VB & IB. - D3DXMESH_VB_SYSTEMMEM = 0x010, // Use D3DPOOL_SYSTEMMEM for VB. Overrides D3DXMESH_MANAGEDVERTEXBUFFER - D3DXMESH_VB_MANAGED = 0x020, // Use D3DPOOL_MANAGED for VB. - D3DXMESH_VB_WRITEONLY = 0x040, // Use D3DUSAGE_WRITEONLY for VB. - D3DXMESH_VB_DYNAMIC = 0x080, // Use D3DUSAGE_DYNAMIC for VB. - D3DXMESH_VB_SOFTWAREPROCESSING = 0x8000, // Use D3DUSAGE_SOFTWAREPROCESSING for VB. - D3DXMESH_IB_SYSTEMMEM = 0x100, // Use D3DPOOL_SYSTEMMEM for IB. Overrides D3DXMESH_MANAGEDINDEXBUFFER - D3DXMESH_IB_MANAGED = 0x200, // Use D3DPOOL_MANAGED for IB. - D3DXMESH_IB_WRITEONLY = 0x400, // Use D3DUSAGE_WRITEONLY for IB. - D3DXMESH_IB_DYNAMIC = 0x800, // Use D3DUSAGE_DYNAMIC for IB. - D3DXMESH_IB_SOFTWAREPROCESSING= 0x10000, // Use D3DUSAGE_SOFTWAREPROCESSING for IB. + D3DXMESH_32BIT = 0x001, /* If set, then use 32 bit indices, if not set use 16 bit indices. */ + D3DXMESH_DONOTCLIP = 0x002, /* Use D3DUSAGE_DONOTCLIP for VB & IB. */ + D3DXMESH_POINTS = 0x004, /* Use D3DUSAGE_POINTS for VB & IB. */ + D3DXMESH_RTPATCHES = 0x008, /* Use D3DUSAGE_RTPATCHES for VB & IB. */ + D3DXMESH_NPATCHES = 0x4000,/* Use D3DUSAGE_NPATCHES for VB & IB. */ + D3DXMESH_VB_SYSTEMMEM = 0x010, /* Use D3DPOOL_SYSTEMMEM for VB. Overrides D3DXMESH_MANAGEDVERTEXBUFFER */ + D3DXMESH_VB_MANAGED = 0x020, /* Use D3DPOOL_MANAGED for VB. */ + D3DXMESH_VB_WRITEONLY = 0x040, /* Use D3DUSAGE_WRITEONLY for VB. */ + D3DXMESH_VB_DYNAMIC = 0x080, /* Use D3DUSAGE_DYNAMIC for VB. */ + D3DXMESH_VB_SOFTWAREPROCESSING = 0x8000, /* Use D3DUSAGE_SOFTWAREPROCESSING for VB. */ + D3DXMESH_IB_SYSTEMMEM = 0x100, /* Use D3DPOOL_SYSTEMMEM for IB. Overrides D3DXMESH_MANAGEDINDEXBUFFER */ + D3DXMESH_IB_MANAGED = 0x200, /* Use D3DPOOL_MANAGED for IB. */ + D3DXMESH_IB_WRITEONLY = 0x400, /* Use D3DUSAGE_WRITEONLY for IB. */ + D3DXMESH_IB_DYNAMIC = 0x800, /* Use D3DUSAGE_DYNAMIC for IB. */ + D3DXMESH_IB_SOFTWAREPROCESSING= 0x10000, /* Use D3DUSAGE_SOFTWAREPROCESSING for IB. */ - D3DXMESH_VB_SHARE = 0x1000, // Valid for Clone* calls only, forces cloned mesh/pmesh to share vertex buffer + D3DXMESH_VB_SHARE = 0x1000, /* Valid for Clone* calls only, forces cloned mesh/pmesh to share vertex buffer */ - D3DXMESH_USEHWONLY = 0x2000, // Valid for ID3DXSkinInfo::ConvertToBlendedMesh - - // Helper options - D3DXMESH_SYSTEMMEM = 0x110, // D3DXMESH_VB_SYSTEMMEM | D3DXMESH_IB_SYSTEMMEM - D3DXMESH_MANAGED = 0x220, // D3DXMESH_VB_MANAGED | D3DXMESH_IB_MANAGED - D3DXMESH_WRITEONLY = 0x440, // D3DXMESH_VB_WRITEONLY | D3DXMESH_IB_WRITEONLY - D3DXMESH_DYNAMIC = 0x880, // D3DXMESH_VB_DYNAMIC | D3DXMESH_IB_DYNAMIC - D3DXMESH_SOFTWAREPROCESSING = 0x18000 // D3DXMESH_VB_SOFTWAREPROCESSING | D3DXMESH_IB_SOFTWAREPROCESSING + D3DXMESH_USEHWONLY = 0x2000, /* Valid for ID3DXSkinInfo::ConvertToBlendedMesh */ + /* Helper options */ + D3DXMESH_SYSTEMMEM = 0x110, /* D3DXMESH_VB_SYSTEMMEM | D3DXMESH_IB_SYSTEMMEM */ + D3DXMESH_MANAGED = 0x220, /* D3DXMESH_VB_MANAGED | D3DXMESH_IB_MANAGED */ + D3DXMESH_WRITEONLY = 0x440, /* D3DXMESH_VB_WRITEONLY | D3DXMESH_IB_WRITEONLY */ + D3DXMESH_DYNAMIC = 0x880, /* D3DXMESH_VB_DYNAMIC | D3DXMESH_IB_DYNAMIC */ + D3DXMESH_SOFTWAREPROCESSING = 0x18000 /* D3DXMESH_VB_SOFTWAREPROCESSING | D3DXMESH_IB_SOFTWAREPROCESSING */ }; -//patch mesh options +/* patch mesh options */ enum _D3DXPATCHMESH { - D3DXPATCHMESH_DEFAULT = 000, + D3DXPATCHMESH_DEFAULT = 000 }; -// option field values for specifying min value in D3DXGeneratePMesh and D3DXSimplifyMesh + +/* option field values for specifying min value in D3DXGeneratePMesh and D3DXSimplifyMesh */ enum _D3DXMESHSIMP { D3DXMESHSIMP_VERTEX = 0x1, @@ -91,15 +92,15 @@ typedef enum _D3DXCLEANTYPE { D3DXCLEAN_BACKFACING = 0x00000001, D3DXCLEAN_BOWTIES = 0x00000002, - // Helper options - D3DXCLEAN_SKINNING = D3DXCLEAN_BACKFACING, // Bowtie cleaning modifies geometry and breaks skinning + /* Helper options */ + D3DXCLEAN_SKINNING = D3DXCLEAN_BACKFACING, /* Bowtie cleaning modifies geometry and breaks skinning */ D3DXCLEAN_OPTIMIZATION = D3DXCLEAN_BACKFACING, D3DXCLEAN_SIMPLIFICATION= D3DXCLEAN_BACKFACING | D3DXCLEAN_BOWTIES } D3DXCLEANTYPE; enum _MAX_FVF_DECL_SIZE { - MAX_FVF_DECL_SIZE = MAXD3DDECLLENGTH + 1 // +1 for END + MAX_FVF_DECL_SIZE = MAXD3DDECLLENGTH + 1 /* +1 for END */ }; typedef enum _D3DXTANGENT @@ -118,9 +119,10 @@ typedef enum _D3DXTANGENT D3DXTANGENT_GENERATE_IN_PLACE = 0x0400 } D3DXTANGENT; -// D3DXIMT_WRAP_U means the texture wraps in the U direction -// D3DXIMT_WRAP_V means the texture wraps in the V direction -// D3DXIMT_WRAP_UV means the texture wraps in both directions +/* D3DXIMT_WRAP_U means the texture wraps in the U direction + * D3DXIMT_WRAP_V means the texture wraps in the V direction + * D3DXIMT_WRAP_UV means the texture wraps in both directions + */ typedef enum _D3DXIMT { D3DXIMT_WRAP_U = 0x01, @@ -128,10 +130,11 @@ typedef enum _D3DXIMT D3DXIMT_WRAP_UV = 0x03 } D3DXIMT; -// These options are only valid for UVAtlasCreate and UVAtlasPartition, we may add more for UVAtlasPack if necessary -// D3DXUVATLAS_DEFAULT - Meshes with more than 25k faces go through fast, meshes with fewer than 25k faces go through quality -// D3DXUVATLAS_GEODESIC_FAST - Uses approximations to improve charting speed at the cost of added stretch or more charts. -// D3DXUVATLAS_GEODESIC_QUALITY - Provides better quality charts, but requires more time and memory than fast. +/* These options are only valid for UVAtlasCreate and UVAtlasPartition, we may add more for UVAtlasPack if necessary + * D3DXUVATLAS_DEFAULT - Meshes with more than 25k faces go through fast, meshes with fewer than 25k faces go through quality + * D3DXUVATLAS_GEODESIC_FAST - Uses approximations to improve charting speed at the cost of added stretch or more charts. + * D3DXUVATLAS_GEODESIC_QUALITY - Provides better quality charts, but requires more time and memory than fast. + */ typedef enum _D3DXUVATLAS { D3DXUVATLAS_DEFAULT = 0x00, @@ -169,9 +172,9 @@ typedef D3DXMATERIAL *LPD3DXMATERIAL; typedef enum _D3DXEFFECTDEFAULTTYPE { - D3DXEDT_STRING = 0x1, // pValue points to a null terminated ASCII string - D3DXEDT_FLOATS = 0x2, // pValue points to an array of floats - number of floats is NumBytes / sizeof(float) - D3DXEDT_DWORD = 0x3, // pValue points to a DWORD + D3DXEDT_STRING = 0x1, /* pValue points to a null terminated ASCII string */ + D3DXEDT_FLOATS = 0x2, /* pValue points to an array of floats - number of floats is NumBytes / sizeof(float) */ + D3DXEDT_DWORD = 0x3, /* pValue points to a DWORD */ D3DXEDT_FORCEDWORD = 0x7fffffff } D3DXEFFECTDEFAULTTYPE; @@ -179,9 +182,9 @@ typedef enum _D3DXEFFECTDEFAULTTYPE typedef struct _D3DXEFFECTDEFAULT { LPSTR pParamName; - D3DXEFFECTDEFAULTTYPE Type; // type of the data pointed to by pValue - DWORD NumBytes; // size in bytes of the data pointed to by pValue - LPVOID pValue; // data for the default of the effect + D3DXEFFECTDEFAULTTYPE Type; /* type of the data pointed to by pValue */ + DWORD NumBytes; /* size in bytes of the data pointed to by pValue */ + LPVOID pValue; /* data for the default of the effect */ } D3DXEFFECTDEFAULT, *LPD3DXEFFECTDEFAULT; typedef struct _D3DXEFFECTINSTANCE @@ -205,25 +208,29 @@ typedef struct _D3DXATTRIBUTEWEIGHTS enum _D3DXWELDEPSILONSFLAGS { - D3DXWELDEPSILONS_WELDALL = 0x1, // weld all vertices marked by adjacency as being overlapping + D3DXWELDEPSILONS_WELDALL = 0x1, /* weld all vertices marked by adjacency as being overlapping */ - D3DXWELDEPSILONS_WELDPARTIALMATCHES = 0x2, // if a given vertex component is within epsilon, modify partial matched - // vertices so that both components identical AND if all components "equal" - // remove one of the vertices - D3DXWELDEPSILONS_DONOTREMOVEVERTICES = 0x4, // instructs weld to only allow modifications to vertices and not removal - // ONLY valid if D3DXWELDEPSILONS_WELDPARTIALMATCHES is set - // useful to modify vertices to be equal, but not allow vertices to be removed + D3DXWELDEPSILONS_WELDPARTIALMATCHES = 0x2, /* if a given vertex component is within epsilon, modify partial matched + * vertices so that both components identical AND if all components "equal" + * remove one of the vertices + */ + D3DXWELDEPSILONS_DONOTREMOVEVERTICES = 0x4, /* instructs weld to only allow modifications to vertices and not removal + * ONLY valid if D3DXWELDEPSILONS_WELDPARTIALMATCHES is set + * useful to modify vertices to be equal, but not allow vertices to be removed + */ - D3DXWELDEPSILONS_DONOTSPLIT = 0x8 // instructs weld to specify the D3DXMESHOPT_DONOTSPLIT flag when doing an Optimize(ATTR_SORT) - // if this flag is not set, all vertices that are in separate attribute groups - // will remain split and not welded. Setting this flag can slow down software vertex processing + D3DXWELDEPSILONS_DONOTSPLIT = 0x8 /* instructs weld to specify the D3DXMESHOPT_DONOTSPLIT flag when doing an Optimize(ATTR_SORT) + * if this flag is not set, all vertices that are in separate attribute groups + * will remain split and not welded. Setting this flag can slow down software vertex processing + */ }; typedef struct _D3DXWELDEPSILONS { - FLOAT Position; // NOTE: This does NOT replace the epsilon in GenerateAdjacency - // in general, it should be the same value or greater than the one passed to GeneratedAdjacency + FLOAT Position; /* NOTE: This does NOT replace the epsilon in GenerateAdjacency + * in general, it should be the same value or greater than the one passed to GeneratedAdjacency + */ FLOAT BlendWeights; FLOAT Normal; FLOAT PSize; @@ -243,12 +250,12 @@ typedef D3DXWELDEPSILONS* LPD3DXWELDEPSILONS; DECLARE_INTERFACE_(ID3DXBaseMesh, IUnknown) { - // IUnknown + /* IUnknown */ STDMETHOD(QueryInterface)(THIS_ REFIID iid, LPVOID *ppv) PURE; STDMETHOD_(ULONG, AddRef)(THIS) PURE; STDMETHOD_(ULONG, Release)(THIS) PURE; - // ID3DXBaseMesh + /* ID3DXBaseMesh */ STDMETHOD(DrawSubset)(THIS_ DWORD AttribId) PURE; STDMETHOD_(DWORD, GetNumFaces)(THIS) PURE; STDMETHOD_(DWORD, GetNumVertices)(THIS) PURE; @@ -283,12 +290,12 @@ DECLARE_INTERFACE_(ID3DXBaseMesh, IUnknown) DECLARE_INTERFACE_(ID3DXMesh, ID3DXBaseMesh) { - // IUnknown + /* IUnknown */ STDMETHOD(QueryInterface)(THIS_ REFIID iid, LPVOID *ppv) PURE; STDMETHOD_(ULONG, AddRef)(THIS) PURE; STDMETHOD_(ULONG, Release)(THIS) PURE; - // ID3DXBaseMesh + /* ID3DXBaseMesh */ STDMETHOD(DrawSubset)(THIS_ DWORD AttribId) PURE; STDMETHOD_(DWORD, GetNumFaces)(THIS) PURE; STDMETHOD_(DWORD, GetNumVertices)(THIS) PURE; @@ -316,7 +323,7 @@ DECLARE_INTERFACE_(ID3DXMesh, ID3DXBaseMesh) STDMETHOD(UpdateSemantics)(THIS_ D3DVERTEXELEMENT9 Declaration[MAX_FVF_DECL_SIZE]) PURE; - // ID3DXMesh + /* ID3DXMesh */ STDMETHOD(LockAttributeBuffer)(THIS_ DWORD Flags, DWORD** ppData) PURE; STDMETHOD(UnlockAttributeBuffer)(THIS) PURE; STDMETHOD(Optimize)(THIS_ DWORD Flags, CONST DWORD* pAdjacencyIn, DWORD* pAdjacencyOut, @@ -333,12 +340,12 @@ DECLARE_INTERFACE_(ID3DXMesh, ID3DXBaseMesh) DECLARE_INTERFACE_(ID3DXPMesh, ID3DXBaseMesh) { - // IUnknown + /* IUnknown */ STDMETHOD(QueryInterface)(THIS_ REFIID iid, LPVOID *ppv) PURE; STDMETHOD_(ULONG, AddRef)(THIS) PURE; STDMETHOD_(ULONG, Release)(THIS) PURE; - // ID3DXBaseMesh + /* ID3DXBaseMesh */ STDMETHOD(DrawSubset)(THIS_ DWORD AttribId) PURE; STDMETHOD_(DWORD, GetNumFaces)(THIS) PURE; STDMETHOD_(DWORD, GetNumVertices)(THIS) PURE; @@ -366,7 +373,7 @@ DECLARE_INTERFACE_(ID3DXPMesh, ID3DXBaseMesh) STDMETHOD(UpdateSemantics)(THIS_ D3DVERTEXELEMENT9 Declaration[MAX_FVF_DECL_SIZE]) PURE; - // ID3DXPMesh + /* ID3DXPMesh */ STDMETHOD(ClonePMeshFVF)(THIS_ DWORD Options, DWORD FVF, LPDIRECT3DDEVICE9 pD3DDevice, LPD3DXPMESH* ppCloneMesh) PURE; STDMETHOD(ClonePMesh)(THIS_ DWORD Options, @@ -389,8 +396,8 @@ DECLARE_INTERFACE_(ID3DXPMesh, ID3DXBaseMesh) STDMETHOD(GetAdjacency)(THIS_ DWORD* pAdjacency) PURE; - // Used to generate the immediate "ancestor" for each vertex when it is removed by a vsplit. Allows generation of geomorphs - // Vertex buffer must be equal to or greater than the maximum number of vertices in the pmesh + /* Used to generate the immediate "ancestor" for each vertex when it is removed by a vsplit. Allows generation of geomorphs + * Vertex buffer must be equal to or greater than the maximum number of vertices in the pmesh */ STDMETHOD(GenerateVertexHistory)(THIS_ DWORD* pVertexHistory) PURE; }; @@ -400,12 +407,12 @@ DECLARE_INTERFACE_(ID3DXPMesh, ID3DXBaseMesh) DECLARE_INTERFACE_(ID3DXSPMesh, IUnknown) { - // IUnknown + /* IUnknown */ STDMETHOD(QueryInterface)(THIS_ REFIID iid, LPVOID *ppv) PURE; STDMETHOD_(ULONG, AddRef)(THIS) PURE; STDMETHOD_(ULONG, Release)(THIS) PURE; - // ID3DXSPMesh + /* ID3DXSPMesh */ STDMETHOD_(DWORD, GetNumFaces)(THIS) PURE; STDMETHOD_(DWORD, GetNumVertices)(THIS) PURE; STDMETHOD_(DWORD, GetFVF)(THIS) PURE; @@ -431,22 +438,23 @@ DECLARE_INTERFACE_(ID3DXSPMesh, IUnknown) #define UNUSED16 (0xffff) #define UNUSED32 (0xffffffff) -// ID3DXMesh::Optimize options - upper byte only, lower 3 bytes used from _D3DXMESH option flags -enum _D3DXMESHOPT { - D3DXMESHOPT_COMPACT = 0x01000000, - D3DXMESHOPT_ATTRSORT = 0x02000000, - D3DXMESHOPT_VERTEXCACHE = 0x04000000, - D3DXMESHOPT_STRIPREORDER = 0x08000000, - D3DXMESHOPT_IGNOREVERTS = 0x10000000, // optimize faces only, don't touch vertices - D3DXMESHOPT_DONOTSPLIT = 0x20000000, // do not split vertices shared between attribute groups when attribute sorting - D3DXMESHOPT_DEVICEINDEPENDENT = 0x00400000 // Only affects VCache. uses a static known good cache size for all cards +/* ID3DXMesh::Optimize options - upper byte only, lower 3 bytes used from _D3DXMESH option flags */ +enum _D3DXMESHOPT +{ + D3DXMESHOPT_COMPACT = 0x01000000, + D3DXMESHOPT_ATTRSORT = 0x02000000, + D3DXMESHOPT_VERTEXCACHE = 0x04000000, + D3DXMESHOPT_STRIPREORDER = 0x08000000, + D3DXMESHOPT_IGNOREVERTS = 0x10000000, /* optimize faces only, don't touch vertices */ + D3DXMESHOPT_DONOTSPLIT = 0x20000000, /* do not split vertices shared between attribute groups when attribute sorting */ + D3DXMESHOPT_DEVICEINDEPENDENT = 0x00400000 /* Only affects VCache. uses a static known good cache size for all cards */ - // D3DXMESHOPT_SHAREVB has been removed, please use D3DXMESH_VB_SHARE instead + /* D3DXMESHOPT_SHAREVB has been removed, please use D3DXMESH_VB_SHARE instead */ }; -// Subset of the mesh that has the same attribute and bone combination. -// This subset can be rendered in a single draw call +/* Subset of the mesh that has the same attribute and bone combination. + * This subset can be rendered in a single draw call */ typedef struct _D3DXBONECOMBINATION { DWORD AttribId; @@ -457,13 +465,14 @@ typedef struct _D3DXBONECOMBINATION DWORD* BoneId; } D3DXBONECOMBINATION, *LPD3DXBONECOMBINATION; -// The following types of patch combinations are supported: -// Patch type Basis Degree -// Rect Bezier 2,3,5 -// Rect B-Spline 2,3,5 -// Rect Catmull-Rom 3 -// Tri Bezier 2,3,5 -// N-Patch N/A 3 +/* The following types of patch combinations are supported: + * Patch type Basis Degree + * Rect Bezier 2,3,5 + * Rect B-Spline 2,3,5 + * Rect Catmull-Rom 3 + * Tri Bezier 2,3,5 + * N-Patch N/A 3 + */ typedef struct _D3DXPATCHINFO { @@ -477,14 +486,14 @@ typedef struct _D3DXPATCHINFO DECLARE_INTERFACE_(ID3DXPatchMesh, IUnknown) { - // IUnknown + /* IUnknown */ STDMETHOD(QueryInterface)(THIS_ REFIID iid, LPVOID *ppv) PURE; STDMETHOD_(ULONG, AddRef)(THIS) PURE; STDMETHOD_(ULONG, Release)(THIS) PURE; - // ID3DXPatchMesh + /* ID3DXPatchMesh */ - // Return creation parameters + /* Return creation parameters */ STDMETHOD_(DWORD, GetNumPatches)(THIS) PURE; STDMETHOD_(DWORD, GetNumVertices)(THIS) PURE; STDMETHOD(GetDeclaration)(THIS_ D3DVERTEXELEMENT9 Declaration[MAX_FVF_DECL_SIZE]) PURE; @@ -493,7 +502,7 @@ DECLARE_INTERFACE_(ID3DXPatchMesh, IUnknown) STDMETHOD(GetDevice)(THIS_ LPDIRECT3DDEVICE9 *ppDevice) PURE; STDMETHOD(GetPatchInfo)(THIS_ LPD3DXPATCHINFO PatchInfo) PURE; - // Control mesh access + /* Control mesh access */ STDMETHOD(GetVertexBuffer)(THIS_ LPDIRECT3DVERTEXBUFFER9* ppVB) PURE; STDMETHOD(GetIndexBuffer)(THIS_ LPDIRECT3DINDEXBUFFER9* ppIB) PURE; STDMETHOD(LockVertexBuffer)(THIS_ DWORD flags, LPVOID *ppData) PURE; @@ -503,31 +512,35 @@ DECLARE_INTERFACE_(ID3DXPatchMesh, IUnknown) STDMETHOD(LockAttributeBuffer)(THIS_ DWORD flags, DWORD** ppData) PURE; STDMETHOD(UnlockAttributeBuffer)(THIS) PURE; - // This function returns the size of the tessellated mesh given a tessellation level. - // This assumes uniform tessellation. For adaptive tessellation the Adaptive parameter must - // be set to TRUE and TessellationLevel should be the max tessellation. - // This will result in the max mesh size necessary for adaptive tessellation. + /* This function returns the size of the tessellated mesh given a tessellation level. + * This assumes uniform tessellation. For adaptive tessellation the Adaptive parameter must + * be set to TRUE and TessellationLevel should be the max tessellation. + * This will result in the max mesh size necessary for adaptive tessellation. + */ STDMETHOD(GetTessSize)(THIS_ FLOAT fTessLevel,DWORD Adaptive, DWORD *NumTriangles,DWORD *NumVertices) PURE; - //GenerateAdjacency determines which patches are adjacent with provided tolerance - //this information is used internally to optimize tessellation + /*GenerateAdjacency determines which patches are adjacent with provided tolerance + *this information is used internally to optimize tessellation */ STDMETHOD(GenerateAdjacency)(THIS_ FLOAT Tolerance) PURE; - //CloneMesh Creates a new patchmesh with the specified decl, and converts the vertex buffer - //to the new decl. Entries in the new decl which are new are set to 0. If the current mesh - //has adjacency, the new mesh will also have adjacency + /*CloneMesh Creates a new patchmesh with the specified decl, and converts the vertex buffer + *to the new decl. Entries in the new decl which are new are set to 0. If the current mesh + *has adjacency, the new mesh will also have adjacency + */ STDMETHOD(CloneMesh)(THIS_ DWORD Options, CONST D3DVERTEXELEMENT9 *pDecl, LPD3DXPATCHMESH *pMesh) PURE; - // Optimizes the patchmesh for efficient tessellation. This function is designed - // to perform one time optimization for patch meshes that need to be tessellated - // repeatedly by calling the Tessellate() method. The optimization performed is - // independent of the actual tessellation level used. - // Currently Flags is unused. - // If vertices are changed, Optimize must be called again + /* Optimizes the patchmesh for efficient tessellation. This function is designed + * to perform one time optimization for patch meshes that need to be tessellated + * repeatedly by calling the Tessellate() method. The optimization performed is + * independent of the actual tessellation level used. + * Currently Flags is unused. + * If vertices are changed, Optimize must be called again + */ STDMETHOD(Optimize)(THIS_ DWORD flags) PURE; - //gets and sets displacement parameters - //displacement maps can only be 2D textures MIP-MAPPING is ignored for non adapative tessellation + /*gets and sets displacement parameters + *displacement maps can only be 2D textures MIP-MAPPING is ignored for non adapative tessellation + */ STDMETHOD(SetDisplaceParam)(THIS_ LPDIRECT3DBASETEXTURE9 Texture, D3DTEXTUREFILTERTYPE MinFilter, D3DTEXTUREFILTERTYPE MagFilter, @@ -542,16 +555,18 @@ DECLARE_INTERFACE_(ID3DXPatchMesh, IUnknown) D3DTEXTUREADDRESS *Wrap, DWORD *dwLODBias) PURE; - // Performs the uniform tessellation based on the tessellation level. - // This function will perform more efficiently if the patch mesh has been optimized using the Optimize() call. + /* Performs the uniform tessellation based on the tessellation level. + * This function will perform more efficiently if the patch mesh has been optimized using the Optimize() call. + */ STDMETHOD(Tessellate)(THIS_ FLOAT fTessLevel,LPD3DXMESH pMesh) PURE; - // Performs adaptive tessellation based on the Z based adaptive tessellation criterion. - // pTrans specifies a 4D vector that is dotted with the vertices to get the per vertex - // adaptive tessellation amount. Each edge is tessellated to the average of the criterion - // at the 2 vertices it connects. - // MaxTessLevel specifies the upper limit for adaptive tesselation. - // This function will perform more efficiently if the patch mesh has been optimized using the Optimize() call. + /* Performs adaptive tessellation based on the Z based adaptive tessellation criterion. + * pTrans specifies a 4D vector that is dotted with the vertices to get the per vertex + * adaptive tessellation amount. Each edge is tessellated to the average of the criterion + * at the 2 vertices it connects. + * MaxTessLevel specifies the upper limit for adaptive tesselation. + * This function will perform more efficiently if the patch mesh has been optimized using the Optimize() call. + */ STDMETHOD(TessellateAdaptive)(THIS_ CONST D3DXVECTOR4 *pTrans, DWORD dwMaxTessLevel, @@ -565,12 +580,12 @@ DECLARE_INTERFACE_(ID3DXPatchMesh, IUnknown) DECLARE_INTERFACE_(ID3DXSkinInfo, IUnknown) { - // IUnknown + /* IUnknown */ STDMETHOD(QueryInterface)(THIS_ REFIID iid, LPVOID *ppv) PURE; STDMETHOD_(ULONG, AddRef)(THIS) PURE; STDMETHOD_(ULONG, Release)(THIS) PURE; - // Specify the which vertices do each bones influence and by how much + /* Specify the which vertices do each bones influence and by how much */ STDMETHOD(SetBoneInfluence)(THIS_ DWORD bone, DWORD numInfluences, CONST DWORD* vertices, CONST FLOAT* weights) PURE; STDMETHOD(SetBoneVertexInfluence)(THIS_ DWORD boneNum, DWORD influenceNum, float weight) PURE; STDMETHOD_(DWORD, GetNumBoneInfluences)(THIS_ DWORD bone) PURE; @@ -580,44 +595,44 @@ DECLARE_INTERFACE_(ID3DXSkinInfo, IUnknown) STDMETHOD_(DWORD, GetNumBones)(THIS) PURE; STDMETHOD(FindBoneVertexInfluenceIndex)(THIS_ DWORD boneNum, DWORD vertexNum, DWORD *pInfluenceIndex) PURE; - // This gets the max face influences based on a triangle mesh with the specified index buffer + /* This gets the max face influences based on a triangle mesh with the specified index buffer */ STDMETHOD(GetMaxFaceInfluences)(THIS_ LPDIRECT3DINDEXBUFFER9 pIB, DWORD NumFaces, DWORD* maxFaceInfluences) PURE; - // Set min bone influence. Bone influences that are smaller than this are ignored + /* Set min bone influence. Bone influences that are smaller than this are ignored */ STDMETHOD(SetMinBoneInfluence)(THIS_ FLOAT MinInfl) PURE; - // Get min bone influence. + /* Get min bone influence. */ STDMETHOD_(FLOAT, GetMinBoneInfluence)(THIS) PURE; - // Bone names are returned by D3DXLoadSkinMeshFromXof. They are not used by any other method of this object - STDMETHOD(SetBoneName)(THIS_ DWORD Bone, LPCSTR pName) PURE; // pName is copied to an internal string buffer - STDMETHOD_(LPCSTR, GetBoneName)(THIS_ DWORD Bone) PURE; // A pointer to an internal string buffer is returned. Do not free this. + /* Bone names are returned by D3DXLoadSkinMeshFromXof. They are not used by any other method of this object */ + STDMETHOD(SetBoneName)(THIS_ DWORD Bone, LPCSTR pName) PURE; /* pName is copied to an internal string buffer */ + STDMETHOD_(LPCSTR, GetBoneName)(THIS_ DWORD Bone) PURE; /* A pointer to an internal string buffer is returned. Do not free this. */ - // Bone offset matrices are returned by D3DXLoadSkinMeshFromXof. They are not used by any other method of this object - STDMETHOD(SetBoneOffsetMatrix)(THIS_ DWORD Bone, CONST D3DXMATRIX *pBoneTransform) PURE; // pBoneTransform is copied to an internal buffer - STDMETHOD_(LPD3DXMATRIX, GetBoneOffsetMatrix)(THIS_ DWORD Bone) PURE; // A pointer to an internal matrix is returned. Do not free this. + /* Bone offset matrices are returned by D3DXLoadSkinMeshFromXof. They are not used by any other method of this object */ + STDMETHOD(SetBoneOffsetMatrix)(THIS_ DWORD Bone, CONST D3DXMATRIX *pBoneTransform) PURE; /* pBoneTransform is copied to an internal buffer */ + STDMETHOD_(LPD3DXMATRIX, GetBoneOffsetMatrix)(THIS_ DWORD Bone) PURE; /* A pointer to an internal matrix is returned. Do not free this. */ - // Clone a skin info object + /* Clone a skin info object */ STDMETHOD(Clone)(THIS_ LPD3DXSKININFO* ppSkinInfo) PURE; - // Update bone influence information to match vertices after they are reordered. This should be called - // if the target vertex buffer has been reordered externally. + /* Update bone influence information to match vertices after they are reordered. This should be called + * if the target vertex buffer has been reordered externally. */ STDMETHOD(Remap)(THIS_ DWORD NumVertices, DWORD* pVertexRemap) PURE; - // These methods enable the modification of the vertex layout of the vertices that will be skinned + /* These methods enable the modification of the vertex layout of the vertices that will be skinned */ STDMETHOD(SetFVF)(THIS_ DWORD FVF) PURE; STDMETHOD(SetDeclaration)(THIS_ CONST D3DVERTEXELEMENT9 *pDeclaration) PURE; STDMETHOD_(DWORD, GetFVF)(THIS) PURE; STDMETHOD(GetDeclaration)(THIS_ D3DVERTEXELEMENT9 Declaration[MAX_FVF_DECL_SIZE]) PURE; - // Apply SW skinning based on current pose matrices to the target vertices. + /* Apply SW skinning based on current pose matrices to the target vertices. */ STDMETHOD(UpdateSkinnedMesh)(THIS_ CONST D3DXMATRIX* pBoneTransforms, CONST D3DXMATRIX* pBoneInvTransposeTransforms, LPCVOID pVerticesSrc, PVOID pVerticesDst) PURE; - // Takes a mesh and returns a new mesh with per vertex blend weights and a bone combination - // table that describes which bones affect which subsets of the mesh + /* Takes a mesh and returns a new mesh with per vertex blend weights and a bone combination + * table that describes which bones affect which subsets of the mesh */ STDMETHOD(ConvertToBlendedMesh)(THIS_ LPD3DXMESH pMesh, DWORD Options, @@ -630,8 +645,8 @@ DECLARE_INTERFACE_(ID3DXSkinInfo, IUnknown) LPD3DXBUFFER* ppBoneCombinationTable, LPD3DXMESH* ppMesh) PURE; - // Takes a mesh and returns a new mesh with per vertex blend weights and indices - // and a bone combination table that describes which bones palettes affect which subsets of the mesh + /* Takes a mesh and returns a new mesh with per vertex blend weights and indices + * and a bone combination table that describes which bones palettes affect which subsets of the mesh */ STDMETHOD(ConvertToIndexedBlendedMesh)(THIS_ LPD3DXMESH pMesh, DWORD Options, @@ -648,8 +663,7 @@ DECLARE_INTERFACE_(ID3DXSkinInfo, IUnknown) #ifdef __cplusplus extern "C" { -#endif //__cplusplus - +#endif /* __cplusplus */ HRESULT WINAPI D3DXCreateMesh( @@ -677,7 +691,7 @@ HRESULT WINAPI CONST FLOAT *pVertexWeights, LPD3DXSPMESH* ppSMesh); -// clean a mesh up for simplification, try to make manifold +/* clean a mesh up for simplification, try to make manifold */ HRESULT WINAPI D3DXCleanMesh( D3DXCLEANTYPE CleanType, @@ -715,17 +729,17 @@ HRESULT WINAPI HRESULT WINAPI D3DXComputeBoundingSphere( - CONST D3DXVECTOR3 *pFirstPosition, // pointer to first position + CONST D3DXVECTOR3 *pFirstPosition, /* pointer to first position */ DWORD NumVertices, - DWORD dwStride, // count in bytes to subsequent position vectors + DWORD dwStride, /* count in bytes to subsequent position vectors */ D3DXVECTOR3 *pCenter, FLOAT *pRadius); HRESULT WINAPI D3DXComputeBoundingBox( - CONST D3DXVECTOR3 *pFirstPosition, // pointer to first position + CONST D3DXVECTOR3 *pFirstPosition, /* pointer to first position */ DWORD NumVertices, - DWORD dwStride, // count in bytes to subsequent position vectors + DWORD dwStride, /* count in bytes to subsequent position vectors */ D3DXVECTOR3 *pMin, D3DXVECTOR3 *pMax); @@ -832,8 +846,8 @@ HRESULT WINAPI DWORD* pNumMaterials, LPD3DXPMESH *ppPMesh); -// Creates a skin info object based on the number of vertices, number of bones, and a declaration describing the vertex layout of the target vertices -// The bone names and initial bone transforms are not filled in the skin info object by this method. +/* Creates a skin info object based on the number of vertices, number of bones, and a declaration describing the vertex layout of the target vertices + * The bone names and initial bone transforms are not filled in the skin info object by this method. */ HRESULT WINAPI D3DXCreateSkinInfo( DWORD NumVertices, @@ -841,8 +855,8 @@ HRESULT WINAPI DWORD NumBones, LPD3DXSKININFO* ppSkinInfo); -// Creates a skin info object based on the number of vertices, number of bones, and a FVF describing the vertex layout of the target vertices -// The bone names and initial bone transforms are not filled in the skin info object by this method. +/* Creates a skin info object based on the number of vertices, number of bones, and a FVF describing the vertex layout of the target vertices + * The bone names and initial bone transforms are not filled in the skin info object by this method. */ HRESULT WINAPI D3DXCreateSkinInfoFVF( DWORD NumVertices, @@ -854,7 +868,7 @@ HRESULT WINAPI } extern "C" { -#endif //__cplusplus +#endif /* __cplusplus */ HRESULT WINAPI D3DXLoadMeshFromXof( @@ -867,8 +881,8 @@ HRESULT WINAPI DWORD *pNumMaterials, LPD3DXMESH *ppMesh); -// This similar to D3DXLoadMeshFromXof, except also returns skinning info if present in the file -// If skinning info is not present, ppSkinInfo will be NULL +/* This similar to D3DXLoadMeshFromXof, except also returns skinning info if present in the file + * If skinning info is not present, ppSkinInfo will be NULL */ HRESULT WINAPI D3DXLoadSkinMeshFromXof( LPD3DXFILEDATA pxofMesh, @@ -882,11 +896,12 @@ HRESULT WINAPI LPD3DXMESH* ppMesh); -// The inverse of D3DXConvertTo{Indexed}BlendedMesh() functions. It figures out the skinning info from -// the mesh and the bone combination table and populates a skin info object with that data. The bone -// names and initial bone transforms are not filled in the skin info object by this method. This works -// with either a non-indexed or indexed blended mesh. It examines the FVF or declarator of the mesh to -// determine what type it is. +/* The inverse of D3DXConvertTo{Indexed}BlendedMesh() functions. It figures out the skinning info from + * the mesh and the bone combination table and populates a skin info object with that data. The bone + * names and initial bone transforms are not filled in the skin info object by this method. This works + * with either a non-indexed or indexed blended mesh. It examines the FVF or declarator of the mesh to + * determine what type it is. + */ HRESULT WINAPI D3DXCreateSkinInfoFromBlendedMesh( LPD3DXBASEMESH pMesh, @@ -899,24 +914,26 @@ HRESULT WINAPI LPD3DXMESH pMeshIn, CONST DWORD* pAdjacencyIn, FLOAT NumSegs, - BOOL QuadraticInterpNormals, // if false use linear intrep for normals, if true use quadratic + BOOL QuadraticInterpNormals, /* if false use linear intrep for normals, if true use quadratic */ LPD3DXMESH *ppMeshOut, LPD3DXBUFFER *ppAdjacencyOut); -//generates implied outputdecl from input decl -//the decl generated from this should be used to generate the output decl for -//the tessellator subroutines. +/* generates implied outputdecl from input decl + * the decl generated from this should be used to generate the output decl for + * the tessellator subroutines. + */ HRESULT WINAPI D3DXGenerateOutputDecl( D3DVERTEXELEMENT9 *pOutput, CONST D3DVERTEXELEMENT9 *pInput); -//loads patches from an XFileData -//since an X file can have up to 6 different patch meshes in it, -//returns them in an array - pNumPatches will contain the number of -//meshes in the actual file. +/* loads patches from an XFileData + * since an X file can have up to 6 different patch meshes in it, + * returns them in an array - pNumPatches will contain the number of + * meshes in the actual file. + */ HRESULT WINAPI D3DXLoadPatchMeshFromXof( LPD3DXFILEDATA pXofObjMesh, @@ -927,23 +944,23 @@ HRESULT WINAPI PDWORD pNumMaterials, LPD3DXPATCHMESH *ppMesh); -//computes the size a single rect patch. +/* computes the size a single rect patch. */ HRESULT WINAPI D3DXRectPatchSize( - CONST FLOAT *pfNumSegs, //segments for each edge (4) - DWORD *pdwTriangles, //output number of triangles - DWORD *pdwVertices); //output number of vertices + CONST FLOAT *pfNumSegs, /* segments for each edge (4) */ + DWORD *pdwTriangles, /* output number of triangles */ + DWORD *pdwVertices); /* output number of vertices */ -//computes the size of a single triangle patch +/* computes the size of a single triangle patch */ HRESULT WINAPI D3DXTriPatchSize( - CONST FLOAT *pfNumSegs, //segments for each edge (3) - DWORD *pdwTriangles, //output number of triangles - DWORD *pdwVertices); //output number of vertices + CONST FLOAT *pfNumSegs, /* segments for each edge (3) */ + DWORD *pdwTriangles, /* output number of triangles */ + DWORD *pdwVertices); /* output number of vertices */ -//tessellates a patch into a created mesh -//similar to D3D RT patch +/*tessellates a patch into a created mesh + *similar to D3D RT patch */ HRESULT WINAPI D3DXTessellateRectPatch( LPDIRECT3DVERTEXBUFFER9 pVB, @@ -961,29 +978,26 @@ HRESULT WINAPI CONST D3DTRIPATCH_INFO *pTriPatchInfo, LPD3DXMESH pMesh); - - -//creates an NPatch PatchMesh from a D3DXMESH +/*creates an NPatch PatchMesh from a D3DXMESH */ HRESULT WINAPI D3DXCreateNPatchMesh( LPD3DXMESH pMeshSysMem, LPD3DXPATCHMESH *pPatchMesh); - -//creates a patch mesh +/*creates a patch mesh */ HRESULT WINAPI D3DXCreatePatchMesh( - CONST D3DXPATCHINFO *pInfo, //patch type - DWORD dwNumPatches, //number of patches - DWORD dwNumVertices, //number of control vertices - DWORD dwOptions, //options - CONST D3DVERTEXELEMENT9 *pDecl, //format of control vertices + CONST D3DXPATCHINFO *pInfo, /* patch type */ + DWORD dwNumPatches, /* number of patches */ + DWORD dwNumVertices, /* number of control vertices */ + DWORD dwOptions, /* options */ + CONST D3DVERTEXELEMENT9 *pDecl, /* format of control vertices */ LPDIRECT3DDEVICE9 pD3DDevice, LPD3DXPATCHMESH *pPatchMesh); -//returns the number of degenerates in a patch mesh - -//text output put in string. +/*returns the number of degenerates in a patch mesh - + *text output put in string. */ HRESULT WINAPI D3DXValidPatchMesh(LPD3DXPATCHMESH pMesh, DWORD *dwcDegenerateVertices, @@ -1021,10 +1035,10 @@ HRESULT WINAPI typedef struct _D3DXINTERSECTINFO { - DWORD FaceIndex; // index of face intersected - FLOAT U; // Barycentric Hit Coordinates - FLOAT V; // Barycentric Hit Coordinates - FLOAT Dist; // Ray-Intersection Parameter Distance + DWORD FaceIndex; /* index of face intersected */ + FLOAT U; /* Barycentric Hit Coordinates */ + FLOAT V; /* Barycentric Hit Coordinates */ + FLOAT Dist; /* Ray-Intersection Parameter Distance */ } D3DXINTERSECTINFO, *LPD3DXINTERSECTINFO; @@ -1033,13 +1047,13 @@ HRESULT WINAPI LPD3DXBASEMESH pMesh, CONST D3DXVECTOR3 *pRayPos, CONST D3DXVECTOR3 *pRayDir, - BOOL *pHit, // True if any faces were intersected - DWORD *pFaceIndex, // index of closest face intersected - FLOAT *pU, // Barycentric Hit Coordinates - FLOAT *pV, // Barycentric Hit Coordinates - FLOAT *pDist, // Ray-Intersection Parameter Distance - LPD3DXBUFFER *ppAllHits, // Array of D3DXINTERSECTINFOs for all hits (not just closest) - DWORD *pCountOfHits); // Number of entries in AllHits array + BOOL *pHit, /* True if any faces were intersected */ + DWORD *pFaceIndex, /* index of closest face intersected */ + FLOAT *pU, /* Barycentric Hit Coordinates */ + FLOAT *pV, /* Barycentric Hit Coordinates */ + FLOAT *pDist, /* Ray-Intersection Parameter Distance */ + LPD3DXBUFFER *ppAllHits, /* Array of D3DXINTERSECTINFOs for all hits (not just closest) */ + DWORD *pCountOfHits); /* Number of entries in AllHits array */ HRESULT WINAPI D3DXIntersectSubset( @@ -1047,13 +1061,13 @@ HRESULT WINAPI DWORD AttribId, CONST D3DXVECTOR3 *pRayPos, CONST D3DXVECTOR3 *pRayDir, - BOOL *pHit, // True if any faces were intersected - DWORD *pFaceIndex, // index of closest face intersected - FLOAT *pU, // Barycentric Hit Coordinates - FLOAT *pV, // Barycentric Hit Coordinates - FLOAT *pDist, // Ray-Intersection Parameter Distance - LPD3DXBUFFER *ppAllHits, // Array of D3DXINTERSECTINFOs for all hits (not just closest) - DWORD *pCountOfHits); // Number of entries in AllHits array + BOOL *pHit, /* True if any faces were intersected */ + DWORD *pFaceIndex, /* index of closest face intersected */ + FLOAT *pU, /* Barycentric Hit Coordinates */ + FLOAT *pV, /* Barycentric Hit Coordinates */ + FLOAT *pDist, /* Ray-Intersection Parameter Distance */ + LPD3DXBUFFER *ppAllHits, /* Array of D3DXINTERSECTINFOs for all hits (not just closest) */ + DWORD *pCountOfHits); /* Number of entries in AllHits array */ HRESULT WINAPI D3DXSplitMesh @@ -1071,14 +1085,14 @@ HRESULT WINAPI D3DXSplitMesh BOOL WINAPI D3DXIntersectTri ( - CONST D3DXVECTOR3 *p0, // Triangle vertex 0 position - CONST D3DXVECTOR3 *p1, // Triangle vertex 1 position - CONST D3DXVECTOR3 *p2, // Triangle vertex 2 position - CONST D3DXVECTOR3 *pRayPos, // Ray origin - CONST D3DXVECTOR3 *pRayDir, // Ray direction - FLOAT *pU, // Barycentric Hit Coordinates - FLOAT *pV, // Barycentric Hit Coordinates - FLOAT *pDist); // Ray-Intersection Parameter Distance + CONST D3DXVECTOR3 *p0, /* Triangle vertex 0 position */ + CONST D3DXVECTOR3 *p1, /* Triangle vertex 1 position */ + CONST D3DXVECTOR3 *p2, /* Triangle vertex 2 position */ + CONST D3DXVECTOR3 *pRayPos, /* Ray origin */ + CONST D3DXVECTOR3 *pRayDir, /* Ray direction */ + FLOAT *pU, /* Barycentric Hit Coordinates */ + FLOAT *pV, /* Barycentric Hit Coordinates */ + FLOAT *pDist); /* Ray-Intersection Parameter Distance */ BOOL WINAPI D3DXSphereBoundProbe( @@ -1116,21 +1130,22 @@ HRESULT WINAPI D3DXComputeTangentFrameEx(ID3DXMesh *pMesh, ID3DXBuffer **ppVertexMapping); -//D3DXComputeTangent -// -//Computes the Tangent vectors for the TexStage texture coordinates -//and places the results in the TANGENT[TangentIndex] specified in the meshes' DECL -//puts the binorm in BINORM[BinormIndex] also specified in the decl. -// -//If neither the binorm or the tangnet are in the meshes declaration, -//the function will fail. -// -//If a tangent or Binorm field is in the Decl, but the user does not -//wish D3DXComputeTangent to replace them, then D3DX_DEFAULT specified -//in the TangentIndex or BinormIndex will cause it to ignore the specified -//semantic. -// -//Wrap should be specified if the texture coordinates wrap. +/*D3DXComputeTangent + * + *Computes the Tangent vectors for the TexStage texture coordinates + *and places the results in the TANGENT[TangentIndex] specified in the meshes' DECL + *puts the binorm in BINORM[BinormIndex] also specified in the decl. + * + *If neither the binorm or the tangnet are in the meshes declaration, + *the function will fail. + * + *If a tangent or Binorm field is in the Decl, but the user does not + *wish D3DXComputeTangent to replace them, then D3DX_DEFAULT specified + *in the TangentIndex or BinormIndex will cause it to ignore the specified + *semantic. + * + *Wrap should be specified if the texture coordinates wrap. + */ HRESULT WINAPI D3DXComputeTangent(LPD3DXMESH Mesh, DWORD TexStage, @@ -1139,90 +1154,92 @@ HRESULT WINAPI D3DXComputeTangent(LPD3DXMESH Mesh, DWORD Wrap, CONST DWORD *pAdjacency); -//============================================================================ -// -// UVAtlas apis -// -//============================================================================ +/* + * + * UVAtlas apis + * + */ typedef HRESULT (WINAPI *LPD3DXUVATLASCB)(FLOAT fPercentDone, LPVOID lpUserContext); -// This function creates atlases for meshes. There are two modes of operation, -// either based on the number of charts, or the maximum allowed stretch. If the -// maximum allowed stretch is 0, then each triangle will likely be in its own -// chart. +/* This function creates atlases for meshes. There are two modes of operation, + * either based on the number of charts, or the maximum allowed stretch. If the + * maximum allowed stretch is 0, then each triangle will likely be in its own + * chart. + */ -// -// The parameters are as follows: -// pMesh - Input mesh to calculate an atlas for. This must have a position -// channel and at least a 2-d texture channel. -// uMaxChartNumber - The maximum number of charts required for the atlas. -// If this is 0, it will be parameterized based solely on -// stretch. -// fMaxStretch - The maximum amount of stretch, if 0, no stretching is allowed, -// if 1, then any amount of stretching is allowed. -// uWidth - The width of the texture the atlas will be used on. -// uHeight - The height of the texture the atlas will be used on. -// fGutter - The minimum distance, in texels between two charts on the atlas. -// this gets scaled by the width, so if fGutter is 2.5, and it is -// used on a 512x512 texture, then the minimum distance will be -// 2.5 / 512 in u-v space. -// dwTextureIndex - Specifies which texture coordinate to write to in the -// output mesh (which is cloned from the input mesh). Useful -// if your vertex has multiple texture coordinates. -// pdwAdjacency - a pointer to an array with 3 DWORDs per face, indicating -// which triangles are adjacent to each other. -// pdwFalseEdgeAdjacency - a pointer to an array with 3 DWORDS per face, indicating -// at each face, whether an edge is a false edge or not (using -// the same ordering as the adjacency data structure). If this -// is NULL, then it is assumed that there are no false edges. If -// not NULL, then a non-false edge is indicated by -1 and a false -// edge is indicated by any other value (it is not required, but -// it may be useful for the caller to use the original adjacency -// value). This allows you to parameterize a mesh of quads, and -// the edges down the middle of each quad will not be cut when -// parameterizing the mesh. -// pfIMTArray - a pointer to an array with 3 FLOATs per face, describing the -// integrated metric tensor for that face. This lets you control -// the way this triangle may be stretched in the atlas. The IMT -// passed in will be 3 floats (a,b,c) and specify a symmetric -// matrix (a b) that, given a vector (s,t), specifies the -// (b c) -// distance between a vector v1 and a vector v2 = v1 + (s,t) as -// sqrt((s, t) * M * (s, t)^T). -// In other words, this lets one specify the magnitude of the -// stretch in an arbitrary direction in u-v space. For example -// if a = b = c = 1, then this scales the vector (1,1) by 2, and -// the vector (1,-1) by 0. Note that this is multiplying the edge -// length by the square of the matrix, so if you want the face to -// stretch to twice its -// size with no shearing, the IMT value should be (2, 0, 2), which -// is just the identity matrix times 2. -// Note that this assumes you have an orientation for the triangle -// in some 2-D space. For D3DXUVAtlas, this space is created by -// letting S be the direction from the first to the second -// vertex, and T be the cross product between the normal and S. -// -// pStatusCallback - Since the atlas creation process can be very CPU intensive, -// this allows the programmer to specify a function to be called -// periodically, similarly to how it is done in the PRT simulation -// engine. -// fCallbackFrequency - This lets you specify how often the callback will be -// called. A decent default should be 0.0001f. -// pUserContext - a void pointer to be passed back to the callback function -// dwOptions - A combination of flags in the D3DXUVATLAS enum -// ppMeshOut - A pointer to a location to store a pointer for the newly created -// mesh. -// ppFacePartitioning - A pointer to a location to store a pointer for an array, -// one DWORD per face, giving the final partitioning -// created by the atlasing algorithm. -// ppVertexRemapArray - A pointer to a location to store a pointer for an array, -// one DWORD per vertex, giving the vertex it was copied -// from, if any vertices needed to be split. -// pfMaxStretchOut - A location to store the maximum stretch resulting from the -// atlasing algorithm. -// puNumChartsOut - A location to store the number of charts created, or if the -// maximum number of charts was too low, this gives the minimum -// number of charts needed to create an atlas. +/* + * The parameters are as follows: + * pMesh - Input mesh to calculate an atlas for. This must have a position + * channel and at least a 2-d texture channel. + * uMaxChartNumber - The maximum number of charts required for the atlas. + * If this is 0, it will be parameterized based solely on + * stretch. + * fMaxStretch - The maximum amount of stretch, if 0, no stretching is allowed, + * if 1, then any amount of stretching is allowed. + * uWidth - The width of the texture the atlas will be used on. + * uHeight - The height of the texture the atlas will be used on. + * fGutter - The minimum distance, in texels between two charts on the atlas. + * this gets scaled by the width, so if fGutter is 2.5, and it is + * used on a 512x512 texture, then the minimum distance will be + * 2.5 / 512 in u-v space. + * dwTextureIndex - Specifies which texture coordinate to write to in the + * output mesh (which is cloned from the input mesh). Useful + * if your vertex has multiple texture coordinates. + * pdwAdjacency - a pointer to an array with 3 DWORDs per face, indicating + * which triangles are adjacent to each other. + * pdwFalseEdgeAdjacency - a pointer to an array with 3 DWORDS per face, indicating + * at each face, whether an edge is a false edge or not (using + * the same ordering as the adjacency data structure). If this + * is NULL, then it is assumed that there are no false edges. If + * not NULL, then a non-false edge is indicated by -1 and a false + * edge is indicated by any other value (it is not required, but + * it may be useful for the caller to use the original adjacency + * value). This allows you to parameterize a mesh of quads, and + * the edges down the middle of each quad will not be cut when + * parameterizing the mesh. + * pfIMTArray - a pointer to an array with 3 FLOATs per face, describing the + * integrated metric tensor for that face. This lets you control + * the way this triangle may be stretched in the atlas. The IMT + * passed in will be 3 floats (a,b,c) and specify a symmetric + * matrix (a b) that, given a vector (s,t), specifies the + * (b c) + * distance between a vector v1 and a vector v2 = v1 + (s,t) as + * sqrt((s, t) * M * (s, t)^T). + * In other words, this lets one specify the magnitude of the + * stretch in an arbitrary direction in u-v space. For example + * if a = b = c = 1, then this scales the vector (1,1) by 2, and + * the vector (1,-1) by 0. Note that this is multiplying the edge + * length by the square of the matrix, so if you want the face to + * stretch to twice its + * size with no shearing, the IMT value should be (2, 0, 2), which + * is just the identity matrix times 2. + * Note that this assumes you have an orientation for the triangle + * in some 2-D space. For D3DXUVAtlas, this space is created by + * letting S be the direction from the first to the second + * vertex, and T be the cross product between the normal and S. + * + * pStatusCallback - Since the atlas creation process can be very CPU intensive, + * this allows the programmer to specify a function to be called + * periodically, similarly to how it is done in the PRT simulation + * engine. + * fCallbackFrequency - This lets you specify how often the callback will be + * called. A decent default should be 0.0001f. + * pUserContext - a void pointer to be passed back to the callback function + * dwOptions - A combination of flags in the D3DXUVATLAS enum + * ppMeshOut - A pointer to a location to store a pointer for the newly created + * mesh. + * ppFacePartitioning - A pointer to a location to store a pointer for an array, + * one DWORD per face, giving the final partitioning + * created by the atlasing algorithm. + * ppVertexRemapArray - A pointer to a location to store a pointer for an array, + * one DWORD per vertex, giving the vertex it was copied + * from, if any vertices needed to be split. + * pfMaxStretchOut - A location to store the maximum stretch resulting from the + * atlasing algorithm. + * puNumChartsOut - A location to store the number of charts created, or if the + * maximum number of charts was too low, this gives the minimum + * number of charts needed to create an atlas. + */ HRESULT WINAPI D3DXUVAtlasCreate(LPD3DXMESH pMesh, UINT uMaxChartNumber, @@ -1244,33 +1261,32 @@ HRESULT WINAPI D3DXUVAtlasCreate(LPD3DXMESH pMesh, FLOAT *pfMaxStretchOut, UINT *puNumChartsOut); -// This has the same exact arguments as Create, except that it does not perform the -// final packing step. This method allows one to get a partitioning out, and possibly -// modify it before sending it to be repacked. Note that if you change the -// partitioning, you'll also need to calculate new texture coordinates for any faces -// that have switched charts. -// -// The partition result adjacency output parameter is meant to be passed to the -// UVAtlasPack function, this adjacency cuts edges that are between adjacent -// charts, and also can include cuts inside of a chart in order to make it -// equivalent to a disc. For example: -// -// _______ -// | ___ | -// | |_| | -// |_____| -// -// In order to make this equivalent to a disc, we would need to add a cut, and it -// Would end up looking like: -// _______ -// | ___ | -// | |_|_| -// |_____| -// -// The resulting partition adjacency parameter cannot be NULL, because it is -// required for the packing step. - - +/* This has the same exact arguments as Create, except that it does not perform the + * final packing step. This method allows one to get a partitioning out, and possibly + * modify it before sending it to be repacked. Note that if you change the + * partitioning, you'll also need to calculate new texture coordinates for any faces + * that have switched charts. + * + * The partition result adjacency output parameter is meant to be passed to the + * UVAtlasPack function, this adjacency cuts edges that are between adjacent + * charts, and also can include cuts inside of a chart in order to make it + * equivalent to a disc. For example: + * + * _______ + * | ___ | + * | |_| | + * |_____| + * + * In order to make this equivalent to a disc, we would need to add a cut, and it + * Would end up looking like: + * _______ + * | ___ | + * | |_|_| + * |_____| + * + * The resulting partition adjacency parameter cannot be NULL, because it is + * required for the packing step. + */ HRESULT WINAPI D3DXUVAtlasPartition(LPD3DXMESH pMesh, UINT uMaxChartNumber, @@ -1290,12 +1306,13 @@ HRESULT WINAPI D3DXUVAtlasPartition(LPD3DXMESH pMesh, FLOAT *pfMaxStretchOut, UINT *puNumChartsOut); -// This takes the face partitioning result from Partition and packs it into an -// atlas of the given size. pdwPartitionResultAdjacency should be derived from -// the adjacency returned from the partition step. This value cannot be NULL -// because Pack needs to know where charts were cut in the partition step in -// order to find the edges of each chart. -// The options parameter is currently reserved. +/* This takes the face partitioning result from Partition and packs it into an + * atlas of the given size. pdwPartitionResultAdjacency should be derived from + * the adjacency returned from the partition step. This value cannot be NULL + * because Pack needs to know where charts were cut in the partition step in + * order to find the edges of each chart. + * The options parameter is currently reserved. + */ HRESULT WINAPI D3DXUVAtlasPack(ID3DXMesh *pMesh, UINT uWidth, UINT uHeight, @@ -1309,27 +1326,28 @@ HRESULT WINAPI D3DXUVAtlasPack(ID3DXMesh *pMesh, LPD3DXBUFFER pFacePartitioning); -//============================================================================ -// -// IMT Calculation apis -// -// These functions all compute the Integrated Metric Tensor for use in the -// UVAtlas API. They all calculate the IMT with respect to the canonical -// triangle, where the coordinate system is set up so that the u axis goes -// from vertex 0 to 1 and the v axis is N x u. So, for example, the second -// vertex's canonical uv coordinates are (d,0) where d is the distance between -// vertices 0 and 1. This way the IMT does not depend on the parameterization -// of the mesh, and if the signal over the surface doesn't change, then -// the IMT doesn't need to be recalculated. -//============================================================================ +/* + * + * IMT Calculation apis + * + * These functions all compute the Integrated Metric Tensor for use in the + * UVAtlas API. They all calculate the IMT with respect to the canonical + * triangle, where the coordinate system is set up so that the u axis goes + * from vertex 0 to 1 and the v axis is N x u. So, for example, the second + * vertex's canonical uv coordinates are (d,0) where d is the distance between + * vertices 0 and 1. This way the IMT does not depend on the parameterization + * of the mesh, and if the signal over the surface doesn't change, then + * the IMT doesn't need to be recalculated. + *============================================================================ -// This callback is used by D3DXComputeIMTFromSignal. -// -// uv - The texture coordinate for the vertex. -// uPrimitiveID - Face ID of the triangle on which to compute the signal. -// uSignalDimension - The number of floats to store in pfSignalOut. -// pUserData - The pUserData pointer passed in to ComputeIMTFromSignal. -// pfSignalOut - A pointer to where to store the signal data. + * This callback is used by D3DXComputeIMTFromSignal. + * + * uv - The texture coordinate for the vertex. + * uPrimitiveID - Face ID of the triangle on which to compute the signal. + * uSignalDimension - The number of floats to store in pfSignalOut. + * pUserData - The pUserData pointer passed in to ComputeIMTFromSignal. + * pfSignalOut - A pointer to where to store the signal data. + */ typedef HRESULT (WINAPI* LPD3DXIMTSIGNALCALLBACK) (CONST D3DXVECTOR2 *uv, UINT uPrimitiveID, @@ -1337,72 +1355,75 @@ typedef HRESULT (WINAPI* LPD3DXIMTSIGNALCALLBACK) VOID *pUserData, FLOAT *pfSignalOut); -// This function is used to calculate the IMT from per vertex data. It sets -// up a linear system over the triangle, solves for the jacobian J, then -// constructs the IMT from that (J^TJ). -// This function allows you to calculate the IMT based off of any value in a -// mesh (color, normal, etc) by specifying the correct stride of the array. -// The IMT computed will cause areas of the mesh that have similar values to -// take up less space in the texture. -// -// pMesh - The mesh to calculate the IMT for. -// pVertexSignal - A float array of size uSignalStride * v, where v is the -// number of vertices in the mesh. -// uSignalDimension - How many floats per vertex to use in calculating the IMT. -// uSignalStride - The number of bytes per vertex in the array. This must be -// a multiple of sizeof(float) -// ppIMTData - Where to store the buffer holding the IMT data +/* This function is used to calculate the IMT from per vertex data. It sets + * up a linear system over the triangle, solves for the jacobian J, then + * constructs the IMT from that (J^TJ). + * This function allows you to calculate the IMT based off of any value in a + * mesh (color, normal, etc) by specifying the correct stride of the array. + * The IMT computed will cause areas of the mesh that have similar values to + * take up less space in the texture. + * + * pMesh - The mesh to calculate the IMT for. + * pVertexSignal - A float array of size uSignalStride * v, where v is the + * number of vertices in the mesh. + * uSignalDimension - How many floats per vertex to use in calculating the IMT. + * uSignalStride - The number of bytes per vertex in the array. This must be + * a multiple of sizeof(float) + * ppIMTData - Where to store the buffer holding the IMT data + */ HRESULT WINAPI D3DXComputeIMTFromPerVertexSignal ( LPD3DXMESH pMesh, - CONST FLOAT *pfVertexSignal, // uSignalDimension floats per vertex + CONST FLOAT *pfVertexSignal, /* uSignalDimension floats per vertex */ UINT uSignalDimension, - UINT uSignalStride, // stride of signal in bytes - DWORD dwOptions, // reserved for future use + UINT uSignalStride, /* stride of signal in bytes */ + DWORD dwOptions, /* reserved for future use */ LPD3DXUVATLASCB pStatusCallback, LPVOID pUserContext, LPD3DXBUFFER *ppIMTData); -// This function is used to calculate the IMT from data that varies over the -// surface of the mesh (generally at a higher frequency than vertex data). -// This function requires the mesh to already be parameterized (so it already -// has texture coordinates). It allows the user to define a signal arbitrarily -// over the surface of the mesh. -// -// pMesh - The mesh to calculate the IMT for. -// dwTextureIndex - This describes which set of texture coordinates in the -// mesh to use. -// uSignalDimension - How many components there are in the signal. -// fMaxUVDistance - The subdivision will continue until the distance between -// all vertices is at most fMaxUVDistance. -// dwOptions - reserved for future use -// pSignalCallback - The callback to use to get the signal. -// pUserData - A pointer that will be passed in to the callback. -// ppIMTData - Where to store the buffer holding the IMT data +/* This function is used to calculate the IMT from data that varies over the + * surface of the mesh (generally at a higher frequency than vertex data). + * This function requires the mesh to already be parameterized (so it already + * has texture coordinates). It allows the user to define a signal arbitrarily + * over the surface of the mesh. + * + * pMesh - The mesh to calculate the IMT for. + * dwTextureIndex - This describes which set of texture coordinates in the + * mesh to use. + * uSignalDimension - How many components there are in the signal. + * fMaxUVDistance - The subdivision will continue until the distance between + * all vertices is at most fMaxUVDistance. + * dwOptions - reserved for future use + * pSignalCallback - The callback to use to get the signal. + * pUserData - A pointer that will be passed in to the callback. + * ppIMTData - Where to store the buffer holding the IMT data + */ HRESULT WINAPI D3DXComputeIMTFromSignal( LPD3DXMESH pMesh, DWORD dwTextureIndex, UINT uSignalDimension, FLOAT fMaxUVDistance, - DWORD dwOptions, // reserved for future use + DWORD dwOptions, /* reserved for future use */ LPD3DXIMTSIGNALCALLBACK pSignalCallback, VOID *pUserData, LPD3DXUVATLASCB pStatusCallback, LPVOID pUserContext, LPD3DXBUFFER *ppIMTData); -// This function is used to calculate the IMT from texture data. Given a texture -// that maps over the surface of the mesh, the algorithm computes the IMT for -// each face. This will cause large areas that are very similar to take up less -// room when parameterized with UVAtlas. The texture is assumed to be -// interpolated over the mesh bilinearly. -// -// pMesh - The mesh to calculate the IMT for. -// pTexture - The texture to load data from. -// dwTextureIndex - This describes which set of texture coordinates in the -// mesh to use. -// dwOptions - Combination of one or more D3DXIMT flags. -// ppIMTData - Where to store the buffer holding the IMT data +/* This function is used to calculate the IMT from texture data. Given a texture + * that maps over the surface of the mesh, the algorithm computes the IMT for + * each face. This will cause large areas that are very similar to take up less + * room when parameterized with UVAtlas. The texture is assumed to be + * interpolated over the mesh bilinearly. + * + * pMesh - The mesh to calculate the IMT for. + * pTexture - The texture to load data from. + * dwTextureIndex - This describes which set of texture coordinates in the + * mesh to use. + * dwOptions - Combination of one or more D3DXIMT flags. + * ppIMTData - Where to store the buffer holding the IMT data + */ HRESULT WINAPI D3DXComputeIMTFromTexture ( LPD3DXMESH pMesh, LPDIRECT3DTEXTURE9 pTexture, @@ -1412,21 +1433,22 @@ HRESULT WINAPI D3DXComputeIMTFromTexture ( LPVOID pUserContext, LPD3DXBUFFER *ppIMTData); -// This function is very similar to ComputeIMTFromTexture, but it uses a -// float array to pass in the data, and it can calculate higher dimensional -// values than 4. -// -// pMesh - The mesh to calculate the IMT for. -// dwTextureIndex - This describes which set of texture coordinates in the -// mesh to use. -// pfFloatArray - a pointer to a float array of size -// uWidth*uHeight*uComponents -// uWidth - The width of the texture -// uHeight - The height of the texture -// uSignalDimension - The number of floats per texel in the signal -// uComponents - The number of floats in each texel -// dwOptions - Combination of one or more D3DXIMT flags -// ppIMTData - Where to store the buffer holding the IMT data +/* This function is very similar to ComputeIMTFromTexture, but it uses a + * float array to pass in the data, and it can calculate higher dimensional + * values than 4. + * + * pMesh - The mesh to calculate the IMT for. + * dwTextureIndex - This describes which set of texture coordinates in the + * mesh to use. + * pfFloatArray - a pointer to a float array of size + * uWidth*uHeight*uComponents + * uWidth - The width of the texture + * uHeight - The height of the texture + * uSignalDimension - The number of floats per texel in the signal + * uComponents - The number of floats in each texel + * dwOptions - Combination of one or more D3DXIMT flags + * ppIMTData - Where to store the buffer holding the IMT data + */ HRESULT WINAPI D3DXComputeIMTFromPerTexelSignal( LPD3DXMESH pMesh, DWORD dwTextureIndex, @@ -1459,29 +1481,29 @@ HRESULT WINAPI DWORD *pNumStrips); -//============================================================================ -// -// D3DXOptimizeFaces: -// -------------------- -// Generate a face remapping for a triangle list that more effectively utilizes -// vertex caches. This optimization is identical to the one provided -// by ID3DXMesh::Optimize with the hardware independent option enabled. -// -// Parameters: -// pbIndices -// Triangle list indices to use for generating a vertex ordering -// NumFaces -// Number of faces in the triangle list -// NumVertices -// Number of vertices referenced by the triangle list -// b32BitIndices -// TRUE if indices are 32 bit, FALSE if indices are 16 bit -// pFaceRemap -// Destination buffer to store face ordering -// The number stored for a given element is where in the new ordering -// the face will have come from. See ID3DXMesh::Optimize for more info. -// -//============================================================================ +/* + * + * D3DXOptimizeFaces: + * -------------------- + * Generate a face remapping for a triangle list that more effectively utilizes + * vertex caches. This optimization is identical to the one provided + * by ID3DXMesh::Optimize with the hardware independent option enabled. + * + * Parameters: + * pbIndices + * Triangle list indices to use for generating a vertex ordering + * NumFaces + * Number of faces in the triangle list + * NumVertices + * Number of vertices referenced by the triangle list + * b32BitIndices + * TRUE if indices are 32 bit, FALSE if indices are 16 bit + * pFaceRemap + * Destination buffer to store face ordering + * The number stored for a given element is where in the new ordering + * the face will have come from. See ID3DXMesh::Optimize for more info. + * + */ HRESULT WINAPI D3DXOptimizeFaces( LPCVOID pbIndices, @@ -1490,29 +1512,29 @@ HRESULT WINAPI BOOL b32BitIndices, DWORD* pFaceRemap); -//============================================================================ -// -// D3DXOptimizeVertices: -// -------------------- -// Generate a vertex remapping to optimize for in order use of vertices for -// a given set of indices. This is commonly used after applying the face -// remap generated by D3DXOptimizeFaces -// -// Parameters: -// pbIndices -// Triangle list indices to use for generating a vertex ordering -// NumFaces -// Number of faces in the triangle list -// NumVertices -// Number of vertices referenced by the triangle list -// b32BitIndices -// TRUE if indices are 32 bit, FALSE if indices are 16 bit -// pVertexRemap -// Destination buffer to store vertex ordering -// The number stored for a given element is where in the new ordering -// the vertex will have come from. See ID3DXMesh::Optimize for more info. -// -//============================================================================ +/* + * + * D3DXOptimizeVertices: + * -------------------- + * Generate a vertex remapping to optimize for in order use of vertices for + * a given set of indices. This is commonly used after applying the face + * remap generated by D3DXOptimizeFaces + * + * Parameters: + * pbIndices + * Triangle list indices to use for generating a vertex ordering + * NumFaces + * Number of faces in the triangle list + * NumVertices + * Number of vertices referenced by the triangle list + * b32BitIndices + * TRUE if indices are 32 bit, FALSE if indices are 16 bit + * pVertexRemap + * Destination buffer to store vertex ordering + * The number stored for a given element is where in the new ordering + * the vertex will have come from. See ID3DXMesh::Optimize for more info. + * + */ HRESULT WINAPI D3DXOptimizeVertices( LPCVOID pbIndices, @@ -1523,15 +1545,15 @@ HRESULT WINAPI #ifdef __cplusplus } -#endif //__cplusplus +#endif /* __cplusplus */ -//=========================================================================== -// -// Data structures for Spherical Harmonic Precomputation -// -// -//============================================================================ +/* + * + * Data structures for Spherical Harmonic Precomputation + * + * + */ typedef enum _D3DXSHCOMPRESSQUALITYTYPE { D3DXSHCQUAL_FASTLOWQUALITY = 1, @@ -1550,72 +1572,76 @@ typedef enum _D3DXSHGPUSIMOPT { D3DXSHGPUSIMOPT_FORCE_DWORD = 0x7fffffff } D3DXSHGPUSIMOPT; -// for all properties that are colors the luminance is computed -// if the simulator is run with a single channel using the following -// formula: R * 0.2125 + G * 0.7154 + B * 0.0721 +/* for all properties that are colors the luminance is computed + * if the simulator is run with a single channel using the following + * formula: R * 0.2125 + G * 0.7154 + B * 0.0721 + */ typedef struct _D3DXSHMATERIAL { - D3DCOLORVALUE Diffuse; // Diffuse albedo of the surface. (Ignored if object is a Mirror) - BOOL bMirror; // Must be set to FALSE. bMirror == TRUE not currently supported - BOOL bSubSurf; // true if the object does subsurface scattering - can't do this and be a mirror + D3DCOLORVALUE Diffuse; /* Diffuse albedo of the surface. (Ignored if object is a Mirror) */ + BOOL bMirror; /* Must be set to FALSE. bMirror == TRUE not currently supported */ + BOOL bSubSurf; /* true if the object does subsurface scattering - can't do this and be a mirror */ - // subsurface scattering parameters + /* subsurface scattering parameters */ FLOAT RelativeIndexOfRefraction; D3DCOLORVALUE Absorption; D3DCOLORVALUE ReducedScattering; } D3DXSHMATERIAL; -// allocated in D3DXSHPRTCompSplitMeshSC -// vertices are duplicated into multiple super clusters but -// only have a valid status in one super cluster (fill in the rest) +/* allocated in D3DXSHPRTCompSplitMeshSC + * vertices are duplicated into multiple super clusters but + * only have a valid status in one super cluster (fill in the rest) + */ typedef struct _D3DXSHPRTSPLITMESHVERTDATA { - UINT uVertRemap; // vertex in original mesh this corresponds to - UINT uSubCluster; // cluster index relative to super cluster - UCHAR ucVertStatus; // 1 if vertex has valid data, 0 if it is "fill" + UINT uVertRemap; /* vertex in original mesh this corresponds to */ + UINT uSubCluster; /* cluster index relative to super cluster */ + UCHAR ucVertStatus; /* 1 if vertex has valid data, 0 if it is "fill" */ } D3DXSHPRTSPLITMESHVERTDATA; -// used in D3DXSHPRTCompSplitMeshSC -// information for each super cluster that maps into face/vert arrays +/* used in D3DXSHPRTCompSplitMeshSC + * information for each super cluster that maps into face/vert arrays + */ typedef struct _D3DXSHPRTSPLITMESHCLUSTERDATA { - UINT uVertStart; // initial index into remapped vertex array - UINT uVertLength; // number of vertices in this super cluster + UINT uVertStart; /* initial index into remapped vertex array */ + UINT uVertLength; /* number of vertices in this super cluster */ - UINT uFaceStart; // initial index into face array - UINT uFaceLength; // number of faces in this super cluster + UINT uFaceStart; /* initial index into face array */ + UINT uFaceLength; /* number of faces in this super cluster */ - UINT uClusterStart; // initial index into cluster array - UINT uClusterLength; // number of clusters in this super cluster + UINT uClusterStart; /* initial index into cluster array */ + UINT uClusterLength; /* number of clusters in this super cluster */ } D3DXSHPRTSPLITMESHCLUSTERDATA; -// call back function for simulator -// return S_OK to keep running the simulator - anything else represents -// failure and the simulator will abort. +/* call back function for simulator + * return S_OK to keep running the simulator - anything else represents + * failure and the simulator will abort. + */ typedef HRESULT (WINAPI *LPD3DXSHPRTSIMCB)(float fPercentDone, LPVOID lpUserContext); -// interfaces for PRT buffers/simulator +/* interfaces for PRT buffers/simulator */ -// GUIDs -// {F1827E47-00A8-49cd-908C-9D11955F8728} +/* GUIDs + * {F1827E47-00A8-49cd-908C-9D11955F8728} */ DEFINE_GUID(IID_ID3DXPRTBuffer, 0xf1827e47, 0xa8, 0x49cd, 0x90, 0x8c, 0x9d, 0x11, 0x95, 0x5f, 0x87, 0x28); -// {A758D465-FE8D-45ad-9CF0-D01E56266A07} +/* {A758D465-FE8D-45ad-9CF0-D01E56266A07} */ DEFINE_GUID(IID_ID3DXPRTCompBuffer, 0xa758d465, 0xfe8d, 0x45ad, 0x9c, 0xf0, 0xd0, 0x1e, 0x56, 0x26, 0x6a, 0x7); -// {838F01EC-9729-4527-AADB-DF70ADE7FEA9} +/* {838F01EC-9729-4527-AADB-DF70ADE7FEA9} */ DEFINE_GUID(IID_ID3DXTextureGutterHelper, 0x838f01ec, 0x9729, 0x4527, 0xaa, 0xdb, 0xdf, 0x70, 0xad, 0xe7, 0xfe, 0xa9); -// {683A4278-CD5F-4d24-90AD-C4E1B6855D53} +/* {683A4278-CD5F-4d24-90AD-C4E1B6855D53} */ DEFINE_GUID(IID_ID3DXPRTEngine, 0x683a4278, 0xcd5f, 0x4d24, 0x90, 0xad, 0xc4, 0xe1, 0xb6, 0x85, 0x5d, 0x53); -// interface defenitions +/* interface defenitions */ typedef interface ID3DXTextureGutterHelper ID3DXTextureGutterHelper; typedef interface ID3DXPRTBuffer ID3DXPRTBuffer; @@ -1623,18 +1649,19 @@ typedef interface ID3DXPRTBuffer ID3DXPRTBuffer; #undef INTERFACE #define INTERFACE ID3DXPRTBuffer -// Buffer interface - contains "NumSamples" samples -// each sample in memory is stored as NumCoeffs scalars per channel (1 or 3) -// Same interface is used for both Vertex and Pixel PRT buffers +/* Buffer interface - contains "NumSamples" samples + * each sample in memory is stored as NumCoeffs scalars per channel (1 or 3) + * Same interface is used for both Vertex and Pixel PRT buffers + */ DECLARE_INTERFACE_(ID3DXPRTBuffer, IUnknown) { - // IUnknown + /* IUnknown */ STDMETHOD(QueryInterface)(THIS_ REFIID iid, LPVOID *ppv) PURE; STDMETHOD_(ULONG, AddRef)(THIS) PURE; STDMETHOD_(ULONG, Release)(THIS) PURE; - // ID3DXPRTBuffer + /* ID3DXPRTBuffer */ STDMETHOD_(UINT, GetNumSamples)(THIS) PURE; STDMETHOD_(UINT, GetNumCoeffs)(THIS) PURE; STDMETHOD_(UINT, GetNumChannels)(THIS) PURE; @@ -1643,37 +1670,42 @@ DECLARE_INTERFACE_(ID3DXPRTBuffer, IUnknown) STDMETHOD_(UINT, GetWidth)(THIS) PURE; STDMETHOD_(UINT, GetHeight)(THIS) PURE; - // changes the number of samples allocated in the buffer + /* changes the number of samples allocated in the buffer */ STDMETHOD(Resize)(THIS_ UINT NewSize) PURE; - // ppData will point to the memory location where sample Start begins - // pointer is valid for at least NumSamples samples + /* ppData will point to the memory location where sample Start begins + * pointer is valid for at least NumSamples samples + */ STDMETHOD(LockBuffer)(THIS_ UINT Start, UINT NumSamples, FLOAT **ppData) PURE; STDMETHOD(UnlockBuffer)(THIS) PURE; - // every scalar in buffer is multiplied by Scale + /* every scalar in buffer is multiplied by Scale */ STDMETHOD(ScaleBuffer)(THIS_ FLOAT Scale) PURE; - // every scalar contains the sum of this and pBuffers values - // pBuffer must have the same storage class/dimensions + /* every scalar contains the sum of this and pBuffers values + * pBuffer must have the same storage class/dimensions + */ STDMETHOD(AddBuffer)(THIS_ LPD3DXPRTBUFFER pBuffer) PURE; - // GutterHelper (described below) will fill in the gutter - // regions of a texture by interpolating "internal" values + /* GutterHelper (described below) will fill in the gutter + * regions of a texture by interpolating "internal" values + */ STDMETHOD(AttachGH)(THIS_ LPD3DXTEXTUREGUTTERHELPER) PURE; STDMETHOD(ReleaseGH)(THIS) PURE; - // Evaluates attached gutter helper on the contents of this buffer + /* Evaluates attached gutter helper on the contents of this buffer */ STDMETHOD(EvalGH)(THIS) PURE; - // extracts a given channel into texture pTexture - // NumCoefficients starting from StartCoefficient are copied + /* extracts a given channel into texture pTexture + * NumCoefficients starting from StartCoefficient are copied + */ STDMETHOD(ExtractTexture)(THIS_ UINT Channel, UINT StartCoefficient, UINT NumCoefficients, LPDIRECT3DTEXTURE9 pTexture) PURE; - // extracts NumCoefficients coefficients into mesh - only applicable on single channel - // buffers, otherwise just lockbuffer and copy data. With SHPRT data NumCoefficients - // should be Order^2 + /* extracts NumCoefficients coefficients into mesh - only applicable on single channel + * buffers, otherwise just lockbuffer and copy data. With SHPRT data NumCoefficients + * should be Order^2 + */ STDMETHOD(ExtractToMesh)(THIS_ UINT NumCoefficients, D3DDECLUSAGE Usage, UINT UsageIndexStart, LPD3DXMESH pScene) PURE; @@ -1685,18 +1717,18 @@ typedef interface ID3DXPRTCompBuffer *LPD3DXPRTCOMPBUFFER; #undef INTERFACE #define INTERFACE ID3DXPRTCompBuffer -// compressed buffers stored a compressed version of a PRTBuffer +/* compressed buffers stored a compressed version of a PRTBuffer */ DECLARE_INTERFACE_(ID3DXPRTCompBuffer, IUnknown) { - // IUnknown + /* IUnknown */ STDMETHOD(QueryInterface)(THIS_ REFIID iid, LPVOID *ppv) PURE; STDMETHOD_(ULONG, AddRef)(THIS) PURE; STDMETHOD_(ULONG, Release)(THIS) PURE; - // ID3DPRTCompBuffer + /* ID3DPRTCompBuffer */ - // NumCoeffs and NumChannels are properties of input buffer + /* NumCoeffs and NumChannels are properties of input buffer */ STDMETHOD_(UINT, GetNumSamples)(THIS) PURE; STDMETHOD_(UINT, GetNumCoeffs)(THIS) PURE; STDMETHOD_(UINT, GetNumChannels)(THIS) PURE; @@ -1705,33 +1737,38 @@ DECLARE_INTERFACE_(ID3DXPRTCompBuffer, IUnknown) STDMETHOD_(UINT, GetWidth)(THIS) PURE; STDMETHOD_(UINT, GetHeight)(THIS) PURE; - // number of clusters, and PCA vectors per-cluster + /* number of clusters, and PCA vectors per-cluster */ STDMETHOD_(UINT, GetNumClusters)(THIS) PURE; STDMETHOD_(UINT, GetNumPCA)(THIS) PURE; - // normalizes PCA weights so that they are between [-1,1] - // basis vectors are modified to reflect this + /* normalizes PCA weights so that they are between [-1,1] + * basis vectors are modified to reflect this + */ STDMETHOD(NormalizeData)(THIS) PURE; - // copies basis vectors for cluster "Cluster" into pClusterBasis - // (NumPCA+1)*NumCoeffs*NumChannels floats + /* copies basis vectors for cluster "Cluster" into pClusterBasis + * (NumPCA+1)*NumCoeffs*NumChannels floats + */ STDMETHOD(ExtractBasis)(THIS_ UINT Cluster, FLOAT *pClusterBasis) PURE; - // UINT per sample - which cluster it belongs to + /* UINT per sample - which cluster it belongs to */ STDMETHOD(ExtractClusterIDs)(THIS_ UINT *pClusterIDs) PURE; - // copies NumExtract PCA projection coefficients starting at StartPCA - // into pPCACoefficients - NumSamples*NumExtract floats copied + /* copies NumExtract PCA projection coefficients starting at StartPCA + * into pPCACoefficients - NumSamples*NumExtract floats copied + */ STDMETHOD(ExtractPCA)(THIS_ UINT StartPCA, UINT NumExtract, FLOAT *pPCACoefficients) PURE; - // copies NumPCA projection coefficients starting at StartPCA - // into pTexture - should be able to cope with signed formats + /* copies NumPCA projection coefficients starting at StartPCA + * into pTexture - should be able to cope with signed formats + */ STDMETHOD(ExtractTexture)(THIS_ UINT StartPCA, UINT NumpPCA, LPDIRECT3DTEXTURE9 pTexture) PURE; - // copies NumPCA projection coefficients into mesh pScene - // Usage is D3DDECLUSAGE where coefficients are to be stored - // UsageIndexStart is starting index + /* copies NumPCA projection coefficients into mesh pScene + * Usage is D3DDECLUSAGE where coefficients are to be stored + * UsageIndexStart is starting index + */ STDMETHOD(ExtractToMesh)(THIS_ UINT NumPCA, D3DDECLUSAGE Usage, UINT UsageIndexStart, LPD3DXMESH pScene) PURE; }; @@ -1740,123 +1777,137 @@ DECLARE_INTERFACE_(ID3DXPRTCompBuffer, IUnknown) #undef INTERFACE #define INTERFACE ID3DXTextureGutterHelper -// ID3DXTextureGutterHelper will build and manage -// "gutter" regions in a texture - this will allow for -// bi-linear interpolation to not have artifacts when rendering -// It generates a map (in texture space) where each texel -// is in one of 3 states: -// 0 Invalid - not used at all -// 1 Inside triangle -// 2 Gutter texel -// 4 represents a gutter texel that will be computed during PRT -// For each Inside/Gutter texel it stores the face it -// belongs to and barycentric coordinates for the 1st two -// vertices of that face. Gutter vertices are assigned to -// the closest edge in texture space. -// -// When used with PRT this requires a unique parameterization -// of the model - every texel must correspond to a single point -// on the surface of the model and vice versa +/* ID3DXTextureGutterHelper will build and manage + * "gutter" regions in a texture - this will allow for + * bi-linear interpolation to not have artifacts when rendering + * It generates a map (in texture space) where each texel + * is in one of 3 states: + * 0 Invalid - not used at all + * 1 Inside triangle + * 2 Gutter texel + * 4 represents a gutter texel that will be computed during PRT + * For each Inside/Gutter texel it stores the face it + * belongs to and barycentric coordinates for the 1st two + * vertices of that face. Gutter vertices are assigned to + * the closest edge in texture space. + * + * When used with PRT this requires a unique parameterization + * of the model - every texel must correspond to a single point + * on the surface of the model and vice versa + */ DECLARE_INTERFACE_(ID3DXTextureGutterHelper, IUnknown) { - // IUnknown + /* IUnknown */ STDMETHOD(QueryInterface)(THIS_ REFIID iid, LPVOID *ppv) PURE; STDMETHOD_(ULONG, AddRef)(THIS) PURE; STDMETHOD_(ULONG, Release)(THIS) PURE; - // ID3DXTextureGutterHelper + /* ID3DXTextureGutterHelper */ - // dimensions of texture this is bound too + /* dimensions of texture this is bound too */ STDMETHOD_(UINT, GetWidth)(THIS) PURE; STDMETHOD_(UINT, GetHeight)(THIS) PURE; - // Applying gutters recomputes all of the gutter texels of class "2" - // based on texels of class "1" or "4" + /* Applying gutters recomputes all of the gutter texels of class "2" + * based on texels of class "1" or "4" + */ - // Applies gutters to a raw float buffer - each texel is NumCoeffs floats - // Width and Height must match GutterHelper + /* Applies gutters to a raw float buffer - each texel is NumCoeffs floats + * Width and Height must match GutterHelper + */ STDMETHOD(ApplyGuttersFloat)(THIS_ FLOAT *pDataIn, UINT NumCoeffs, UINT Width, UINT Height); - // Applies gutters to pTexture - // Dimensions must match GutterHelper + /* Applies gutters to pTexture + * Dimensions must match GutterHelper + */ STDMETHOD(ApplyGuttersTex)(THIS_ LPDIRECT3DTEXTURE9 pTexture); - // Applies gutters to a D3DXPRTBuffer - // Dimensions must match GutterHelper + /* Applies gutters to a D3DXPRTBuffer + * Dimensions must match GutterHelper + */ STDMETHOD(ApplyGuttersPRT)(THIS_ LPD3DXPRTBUFFER pBuffer); - // Resamples a texture from a mesh onto this gutterhelpers - // parameterization. It is assumed that the UV coordinates - // for this gutter helper are in TEXTURE 0 (usage/usage index) - // and the texture coordinates should all be within [0,1] for - // both sets. - // - // pTextureIn - texture represented using parameterization in pMeshIn - // pMeshIn - Mesh with texture coordinates that represent pTextureIn - // pTextureOut texture coordinates are assumed to be in - // TEXTURE 0 - // Usage - field in DECL for pMeshIn that stores texture coordinates - // for pTextureIn - // UsageIndex - which index for Usage above for pTextureIn - // pTextureOut- Resampled texture - // - // Usage would generally be D3DDECLUSAGE_TEXCOORD and UsageIndex other than zero + /* Resamples a texture from a mesh onto this gutterhelpers + * parameterization. It is assumed that the UV coordinates + * for this gutter helper are in TEXTURE 0 (usage/usage index) + * and the texture coordinates should all be within [0,1] for + * both sets. + * + * pTextureIn - texture represented using parameterization in pMeshIn + * pMeshIn - Mesh with texture coordinates that represent pTextureIn + * pTextureOut texture coordinates are assumed to be in + * TEXTURE 0 + * Usage - field in DECL for pMeshIn that stores texture coordinates + * for pTextureIn + * UsageIndex - which index for Usage above for pTextureIn + * pTextureOut- Resampled texture + * + * Usage would generally be D3DDECLUSAGE_TEXCOORD and UsageIndex other than zero + */ STDMETHOD(ResampleTex)(THIS_ LPDIRECT3DTEXTURE9 pTextureIn, LPD3DXMESH pMeshIn, D3DDECLUSAGE Usage, UINT UsageIndex, LPDIRECT3DTEXTURE9 pTextureOut); - // the routines below provide access to the data structures - // used by the Apply functions + /* the routines below provide access to the data structures + * used by the Apply functions - // face map is a UINT per texel that represents the - // face of the mesh that texel belongs too - - // only valid if same texel is valid in pGutterData - // pFaceData must be allocated by the user + * face map is a UINT per texel that represents the + * face of the mesh that texel belongs too - + * only valid if same texel is valid in pGutterData + * pFaceData must be allocated by the user + */ STDMETHOD(GetFaceMap)(THIS_ UINT *pFaceData) PURE; - // BaryMap is a D3DXVECTOR2 per texel - // the 1st two barycentric coordinates for the corresponding - // face (3rd weight is always 1-sum of first two) - // only valid if same texel is valid in pGutterData - // pBaryData must be allocated by the user + /* BaryMap is a D3DXVECTOR2 per texel + * the 1st two barycentric coordinates for the corresponding + * face (3rd weight is always 1-sum of first two) + * only valid if same texel is valid in pGutterData + * pBaryData must be allocated by the user + */ STDMETHOD(GetBaryMap)(THIS_ D3DXVECTOR2 *pBaryData) PURE; - // TexelMap is a D3DXVECTOR2 per texel that - // stores the location in pixel coordinates where the - // corresponding texel is mapped - // pTexelData must be allocated by the user + /* TexelMap is a D3DXVECTOR2 per texel that + * stores the location in pixel coordinates where the + * corresponding texel is mapped + * pTexelData must be allocated by the user + */ STDMETHOD(GetTexelMap)(THIS_ D3DXVECTOR2 *pTexelData) PURE; - // GutterMap is a BYTE per texel - // 0/1/2 for Invalid/Internal/Gutter texels - // 4 represents a gutter texel that will be computed - // during PRT - // pGutterData must be allocated by the user + /* GutterMap is a BYTE per texel + * 0/1/2 for Invalid/Internal/Gutter texels + * 4 represents a gutter texel that will be computed + * during PRT + * pGutterData must be allocated by the user + */ STDMETHOD(GetGutterMap)(THIS_ BYTE *pGutterData) PURE; - // face map is a UINT per texel that represents the - // face of the mesh that texel belongs too - - // only valid if same texel is valid in pGutterData + /* face map is a UINT per texel that represents the + * face of the mesh that texel belongs too - + * only valid if same texel is valid in pGutterData + */ STDMETHOD(SetFaceMap)(THIS_ UINT *pFaceData) PURE; - // BaryMap is a D3DXVECTOR2 per texel - // the 1st two barycentric coordinates for the corresponding - // face (3rd weight is always 1-sum of first two) - // only valid if same texel is valid in pGutterData + /* BaryMap is a D3DXVECTOR2 per texel + * the 1st two barycentric coordinates for the corresponding + * face (3rd weight is always 1-sum of first two) + * only valid if same texel is valid in pGutterData + */ STDMETHOD(SetBaryMap)(THIS_ D3DXVECTOR2 *pBaryData) PURE; - // TexelMap is a D3DXVECTOR2 per texel that - // stores the location in pixel coordinates where the - // corresponding texel is mapped + /* TexelMap is a D3DXVECTOR2 per texel that + * stores the location in pixel coordinates where the + * corresponding texel is mapped + */ STDMETHOD(SetTexelMap)(THIS_ D3DXVECTOR2 *pTexelData) PURE; - // GutterMap is a BYTE per texel - // 0/1/2 for Invalid/Internal/Gutter texels - // 4 represents a gutter texel that will be computed - // during PRT + /* GutterMap is a BYTE per texel + * 0/1/2 for Invalid/Internal/Gutter texels + * 4 represents a gutter texel that will be computed + * during PRT + */ STDMETHOD(SetGutterMap)(THIS_ BYTE *pGutterData) PURE; }; @@ -1867,191 +1918,205 @@ typedef interface ID3DXPRTEngine *LPD3DXPRTENGINE; #undef INTERFACE #define INTERFACE ID3DXPRTEngine -// ID3DXPRTEngine is used to compute a PRT simulation -// Use the following steps to compute PRT for SH -// (1) create an interface (which includes a scene) -// (2) call SetSamplingInfo -// (3) [optional] Set MeshMaterials/albedo's (required if doing bounces) -// (4) call ComputeDirectLightingSH -// (5) [optional] call ComputeBounce -// repeat step 5 for as many bounces as wanted. -// if you want to model subsurface scattering you -// need to call ComputeSS after direct lighting and -// each bounce. -// If you want to bake the albedo into the PRT signal, you -// must call MutliplyAlbedo, otherwise the user has to multiply -// the albedo themselves. Not multiplying the albedo allows you -// to model albedo variation at a finer scale then illumination, and -// can result in better compression results. -// Luminance values are computed from RGB values using the following -// formula: R * 0.2125 + G * 0.7154 + B * 0.0721 +/* ID3DXPRTEngine is used to compute a PRT simulation + * Use the following steps to compute PRT for SH + * (1) create an interface (which includes a scene) + * (2) call SetSamplingInfo + * (3) [optional] Set MeshMaterials/albedo's (required if doing bounces) + * (4) call ComputeDirectLightingSH + * (5) [optional] call ComputeBounce + * repeat step 5 for as many bounces as wanted. + * if you want to model subsurface scattering you + * need to call ComputeSS after direct lighting and + * each bounce. + * If you want to bake the albedo into the PRT signal, you + * must call MutliplyAlbedo, otherwise the user has to multiply + * the albedo themselves. Not multiplying the albedo allows you + * to model albedo variation at a finer scale then illumination, and + * can result in better compression results. + * Luminance values are computed from RGB values using the following + * formula: R * 0.2125 + G * 0.7154 + B * 0.0721 + */ DECLARE_INTERFACE_(ID3DXPRTEngine, IUnknown) { - // IUnknown + /* IUnknown */ STDMETHOD(QueryInterface)(THIS_ REFIID iid, LPVOID *ppv) PURE; STDMETHOD_(ULONG, AddRef)(THIS) PURE; STDMETHOD_(ULONG, Release)(THIS) PURE; - // ID3DXPRTEngine + /* ID3DXPRTEngine - // This sets a material per attribute in the scene mesh and it is - // the only way to specify subsurface scattering parameters. if - // bSetAlbedo is FALSE, NumChannels must match the current - // configuration of the PRTEngine. If you intend to change - // NumChannels (through some other SetAlbedo function) it must - // happen before SetMeshMaterials is called. - // - // NumChannels 1 implies "grayscale" materials, set this to 3 to enable - // color bleeding effects - // bSetAlbedo sets albedo from material if TRUE - which clobbers per texel/vertex - // albedo that might have been set before. FALSE won't clobber. - // fLengthScale is used for subsurface scattering - scene is mapped into a 1mm unit cube - // and scaled by this amount + * This sets a material per attribute in the scene mesh and it is + * the only way to specify subsurface scattering parameters. if + * bSetAlbedo is FALSE, NumChannels must match the current + * configuration of the PRTEngine. If you intend to change + * NumChannels (through some other SetAlbedo function) it must + * happen before SetMeshMaterials is called. + * + * NumChannels 1 implies "grayscale" materials, set this to 3 to enable + * color bleeding effects + * bSetAlbedo sets albedo from material if TRUE - which clobbers per texel/vertex + * albedo that might have been set before. FALSE won't clobber. + * fLengthScale is used for subsurface scattering - scene is mapped into a 1mm unit cube + * and scaled by this amount + */ STDMETHOD(SetMeshMaterials)(THIS_ CONST D3DXSHMATERIAL **ppMaterials, UINT NumMeshes, UINT NumChannels, BOOL bSetAlbedo, FLOAT fLengthScale) PURE; - // setting albedo per-vertex or per-texel over rides the albedos stored per mesh - // but it does not over ride any other settings + /* setting albedo per-vertex or per-texel over rides the albedos stored per mesh + * but it does not over ride any other settings - // sets an albedo to be used per vertex - the albedo is represented as a float - // pDataIn input pointer (pointint to albedo of 1st sample) - // NumChannels 1 implies "grayscale" materials, set this to 3 to enable - // color bleeding effects - // Stride - stride in bytes to get to next samples albedo + * sets an albedo to be used per vertex - the albedo is represented as a float + * pDataIn input pointer (pointint to albedo of 1st sample) + * NumChannels 1 implies "grayscale" materials, set this to 3 to enable + * color bleeding effects + * Stride - stride in bytes to get to next samples albedo + */ STDMETHOD(SetPerVertexAlbedo)(THIS_ CONST VOID *pDataIn, UINT NumChannels, UINT Stride) PURE; - // represents the albedo per-texel instead of per-vertex (even if per-vertex PRT is used) - // pAlbedoTexture - texture that stores the albedo (dimension arbitrary) - // NumChannels 1 implies "grayscale" materials, set this to 3 to enable - // color bleeding effects - // pGH - optional gutter helper, otherwise one is constructed in computation routines and - // destroyed (if not attached to buffers) + /* represents the albedo per-texel instead of per-vertex (even if per-vertex PRT is used) + * pAlbedoTexture - texture that stores the albedo (dimension arbitrary) + * NumChannels 1 implies "grayscale" materials, set this to 3 to enable + * color bleeding effects + * pGH - optional gutter helper, otherwise one is constructed in computation routines and + * destroyed (if not attached to buffers) + */ STDMETHOD(SetPerTexelAlbedo)(THIS_ LPDIRECT3DTEXTURE9 pAlbedoTexture, UINT NumChannels, LPD3DXTEXTUREGUTTERHELPER pGH) PURE; - // gets the per-vertex albedo + /* gets the per-vertex albedo */ STDMETHOD(GetVertexAlbedo)(THIS_ D3DXCOLOR *pVertColors, UINT NumVerts) PURE; - // If pixel PRT is being computed normals default to ones that are interpolated - // from the vertex normals. This specifies a texture that stores an object - // space normal map instead (must use a texture format that can represent signed values) - // pNormalTexture - normal map, must be same dimensions as PRTBuffers, signed + /* If pixel PRT is being computed normals default to ones that are interpolated + * from the vertex normals. This specifies a texture that stores an object + * space normal map instead (must use a texture format that can represent signed values) + * pNormalTexture - normal map, must be same dimensions as PRTBuffers, signed + */ STDMETHOD(SetPerTexelNormal)(THIS_ LPDIRECT3DTEXTURE9 pNormalTexture) PURE; - // Copies per-vertex albedo from mesh - // pMesh - mesh that represents the scene. It must have the same - // properties as the mesh used to create the PRTEngine - // Usage - D3DDECLUSAGE to extract albedos from - // NumChannels 1 implies "grayscale" materials, set this to 3 to enable - // color bleeding effects + /* Copies per-vertex albedo from mesh + * pMesh - mesh that represents the scene. It must have the same + * properties as the mesh used to create the PRTEngine + * Usage - D3DDECLUSAGE to extract albedos from + * NumChannels 1 implies "grayscale" materials, set this to 3 to enable + * color bleeding effects + */ STDMETHOD(ExtractPerVertexAlbedo)(THIS_ LPD3DXMESH pMesh, D3DDECLUSAGE Usage, UINT NumChannels) PURE; - // Resamples the input buffer into the output buffer - // can be used to move between per-vertex and per-texel buffers. This can also be used - // to convert single channel buffers to 3-channel buffers and vice-versa. + /* Resamples the input buffer into the output buffer + * can be used to move between per-vertex and per-texel buffers. This can also be used + * to convert single channel buffers to 3-channel buffers and vice-versa. + */ STDMETHOD(ResampleBuffer)(THIS_ LPD3DXPRTBUFFER pBufferIn, LPD3DXPRTBUFFER pBufferOut) PURE; - // Returns the scene mesh - including modifications from adaptive spatial sampling - // The returned mesh only has positions, normals and texture coordinates (if defined) - // pD3DDevice - d3d device that will be used to allocate the mesh - // pFaceRemap - each face has a pointer back to the face on the original mesh that it comes from - // if the face hasn't been subdivided this will be an identity mapping - // pVertRemap - each vertex contains 3 vertices that this is a linear combination of - // pVertWeights - weights for each of above indices (sum to 1.0f) - // ppMesh - mesh that will be allocated and filled + /* Returns the scene mesh - including modifications from adaptive spatial sampling + * The returned mesh only has positions, normals and texture coordinates (if defined) + * pD3DDevice - d3d device that will be used to allocate the mesh + * pFaceRemap - each face has a pointer back to the face on the original mesh that it comes from + * if the face hasn't been subdivided this will be an identity mapping + * pVertRemap - each vertex contains 3 vertices that this is a linear combination of + * pVertWeights - weights for each of above indices (sum to 1.0f) + * ppMesh - mesh that will be allocated and filled + */ STDMETHOD(GetAdaptedMesh)(THIS_ LPDIRECT3DDEVICE9 pD3DDevice,UINT *pFaceRemap, UINT *pVertRemap, FLOAT *pfVertWeights, LPD3DXMESH *ppMesh) PURE; - // Number of vertices currently allocated (includes new vertices from adaptive sampling) + /* Number of vertices currently allocated (includes new vertices from adaptive sampling) */ STDMETHOD_(UINT, GetNumVerts)(THIS) PURE; - // Number of faces currently allocated (includes new faces) + /* Number of faces currently allocated (includes new faces) */ STDMETHOD_(UINT, GetNumFaces)(THIS) PURE; - // Sets the Minimum/Maximum intersection distances, this can be used to control - // maximum distance that objects can shadow/reflect light, and help with "bad" - // art that might have near features that you don't want to shadow. This does not - // apply for GPU simulations. - // fMin - minimum intersection distance, must be positive and less than fMax - // fMax - maximum intersection distance, if 0.0f use the previous value, otherwise - // must be strictly greater than fMin + /* Sets the Minimum/Maximum intersection distances, this can be used to control + * maximum distance that objects can shadow/reflect light, and help with "bad" + * art that might have near features that you don't want to shadow. This does not + * apply for GPU simulations. + * fMin - minimum intersection distance, must be positive and less than fMax + * fMax - maximum intersection distance, if 0.0f use the previous value, otherwise + * must be strictly greater than fMin + */ STDMETHOD(SetMinMaxIntersection)(THIS_ FLOAT fMin, FLOAT fMax) PURE; - // This will subdivide faces on a mesh so that adaptively simulations can - // use a more conservative threshold (it won't miss features.) - // MinEdgeLength - minimum edge length that will be generated, if 0.0f a - // reasonable default will be used - // MaxSubdiv - maximum level of subdivision, if 0 is specified a default - // value will be used (5) + /* This will subdivide faces on a mesh so that adaptively simulations can + * use a more conservative threshold (it won't miss features.) + * MinEdgeLength - minimum edge length that will be generated, if 0.0f a + * reasonable default will be used + * MaxSubdiv - maximum level of subdivision, if 0 is specified a default + * value will be used (5) + */ STDMETHOD(RobustMeshRefine)(THIS_ FLOAT MinEdgeLength, UINT MaxSubdiv) PURE; - // This sets to sampling information used by the simulator. Adaptive sampling - // parameters are currently ignored. - // NumRays - number of rays to shoot per sample - // UseSphere - if TRUE uses spherical samples, otherwise samples over - // the hemisphere. Should only be used with GPU and Vol computations - // UseCosine - if TRUE uses a cosine weighting - not used for Vol computations - // or if only the visiblity function is desired - // Adaptive - if TRUE adaptive sampling (angular) is used - // AdaptiveThresh - threshold used to terminate adaptive angular sampling - // ignored if adaptive sampling is not set + /* This sets to sampling information used by the simulator. Adaptive sampling + * parameters are currently ignored. + * NumRays - number of rays to shoot per sample + * UseSphere - if TRUE uses spherical samples, otherwise samples over + * the hemisphere. Should only be used with GPU and Vol computations + * UseCosine - if TRUE uses a cosine weighting - not used for Vol computations + * or if only the visiblity function is desired + * Adaptive - if TRUE adaptive sampling (angular) is used + * AdaptiveThresh - threshold used to terminate adaptive angular sampling + * ignored if adaptive sampling is not set + */ STDMETHOD(SetSamplingInfo)(THIS_ UINT NumRays, BOOL UseSphere, BOOL UseCosine, BOOL Adaptive, FLOAT AdaptiveThresh) PURE; - // Methods that compute the direct lighting contribution for objects - // always represente light using spherical harmonics (SH) - // the albedo is not multiplied by the signal - it just integrates - // incoming light. If NumChannels is not 1 the vector is replicated - // - // SHOrder - order of SH to use - // pDataOut - PRT buffer that is generated. Can be single channel + /* Methods that compute the direct lighting contribution for objects + * always represente light using spherical harmonics (SH) + * the albedo is not multiplied by the signal - it just integrates + * incoming light. If NumChannels is not 1 the vector is replicated + * + * SHOrder - order of SH to use + * pDataOut - PRT buffer that is generated. Can be single channel + */ STDMETHOD(ComputeDirectLightingSH)(THIS_ UINT SHOrder, LPD3DXPRTBUFFER pDataOut) PURE; - // Adaptive variant of above function. This will refine the mesh - // generating new vertices/faces to approximate the PRT signal - // more faithfully. - // SHOrder - order of SH to use - // AdaptiveThresh - threshold for adaptive subdivision (in PRT vector error) - // if value is less then 1e-6f, 1e-6f is specified - // MinEdgeLength - minimum edge length that will be generated - // if value is too small a fairly conservative model dependent value - // is used - // MaxSubdiv - maximum subdivision level, if 0 is specified it - // will default to 4 - // pDataOut - PRT buffer that is generated. Can be single channel. + /* Adaptive variant of above function. This will refine the mesh + * generating new vertices/faces to approximate the PRT signal + * more faithfully. + * SHOrder - order of SH to use + * AdaptiveThresh - threshold for adaptive subdivision (in PRT vector error) + * if value is less then 1e-6f, 1e-6f is specified + * MinEdgeLength - minimum edge length that will be generated + * if value is too small a fairly conservative model dependent value + * is used + * MaxSubdiv - maximum subdivision level, if 0 is specified it + * will default to 4 + * pDataOut - PRT buffer that is generated. Can be single channel. + */ STDMETHOD(ComputeDirectLightingSHAdaptive)(THIS_ UINT SHOrder, FLOAT AdaptiveThresh, FLOAT MinEdgeLength, UINT MaxSubdiv, LPD3DXPRTBUFFER pDataOut) PURE; - // Function that computes the direct lighting contribution for objects - // light is always represented using spherical harmonics (SH) - // This is done on the GPU and is much faster then using the CPU. - // The albedo is not multiplied by the signal - it just integrates - // incoming light. If NumChannels is not 1 the vector is replicated. - // ZBias/ZAngleBias are akin to parameters used with shadow zbuffers. - // A reasonable default for both values is 0.005, but the user should - // experiment (ZAngleBias can be zero, ZBias should not be.) - // Callbacks should not use the Direct3D9Device the simulator is using. - // SetSamplingInfo must be called with TRUE for UseSphere and - // FALSE for UseCosine before this method is called. - // - // pD3DDevice - device used to run GPU simulator - must support PS2.0 - // and FP render targets - // Flags - parameters for the GPU simulator, combination of one or more - // D3DXSHGPUSIMOPT flags. Only one SHADOWRES setting should be set and - // the defaults is 512 - // SHOrder - order of SH to use - // ZBias - bias in normal direction (for depth test) - // ZAngleBias - scaled by one minus cosine of angle with light (offset in depth) - // pDataOut - PRT buffer that is filled in. Can be single channel + /* Function that computes the direct lighting contribution for objects + * light is always represented using spherical harmonics (SH) + * This is done on the GPU and is much faster then using the CPU. + * The albedo is not multiplied by the signal - it just integrates + * incoming light. If NumChannels is not 1 the vector is replicated. + * ZBias/ZAngleBias are akin to parameters used with shadow zbuffers. + * A reasonable default for both values is 0.005, but the user should + * experiment (ZAngleBias can be zero, ZBias should not be.) + * Callbacks should not use the Direct3D9Device the simulator is using. + * SetSamplingInfo must be called with TRUE for UseSphere and + * FALSE for UseCosine before this method is called. + * + * pD3DDevice - device used to run GPU simulator - must support PS2.0 + * and FP render targets + * Flags - parameters for the GPU simulator, combination of one or more + * D3DXSHGPUSIMOPT flags. Only one SHADOWRES setting should be set and + * the defaults is 512 + * SHOrder - order of SH to use + * ZBias - bias in normal direction (for depth test) + * ZAngleBias - scaled by one minus cosine of angle with light (offset in depth) + * pDataOut - PRT buffer that is filled in. Can be single channel + */ STDMETHOD(ComputeDirectLightingSHGPU)(THIS_ LPDIRECT3DDEVICE9 pD3DDevice, UINT Flags, UINT SHOrder, @@ -2060,57 +2125,61 @@ DECLARE_INTERFACE_(ID3DXPRTEngine, IUnknown) LPD3DXPRTBUFFER pDataOut) PURE; - // Functions that computes subsurface scattering (using material properties) - // Albedo is not multiplied by result. This only works for per-vertex data - // use ResampleBuffer to move per-vertex data into a texture and back. - // - // pDataIn - input data (previous bounce) - // pDataOut - result of subsurface scattering simulation - // pDataTotal - [optional] results can be summed into this buffer + /* Functions that computes subsurface scattering (using material properties) + * Albedo is not multiplied by result. This only works for per-vertex data + * use ResampleBuffer to move per-vertex data into a texture and back. + * + * pDataIn - input data (previous bounce) + * pDataOut - result of subsurface scattering simulation + * pDataTotal - [optional] results can be summed into this buffer + */ STDMETHOD(ComputeSS)(THIS_ LPD3DXPRTBUFFER pDataIn, LPD3DXPRTBUFFER pDataOut, LPD3DXPRTBUFFER pDataTotal) PURE; - // Adaptive version of ComputeSS. - // - // pDataIn - input data (previous bounce) - // AdaptiveThresh - threshold for adaptive subdivision (in PRT vector error) - // if value is less then 1e-6f, 1e-6f is specified - // MinEdgeLength - minimum edge length that will be generated - // if value is too small a fairly conservative model dependent value - // is used - // MaxSubdiv - maximum subdivision level, if 0 is specified it - // will default to 4 - // pDataOut - result of subsurface scattering simulation - // pDataTotal - [optional] results can be summed into this buffer + /* Adaptive version of ComputeSS. + * + * pDataIn - input data (previous bounce) + * AdaptiveThresh - threshold for adaptive subdivision (in PRT vector error) + * if value is less then 1e-6f, 1e-6f is specified + * MinEdgeLength - minimum edge length that will be generated + * if value is too small a fairly conservative model dependent value + * is used + * MaxSubdiv - maximum subdivision level, if 0 is specified it + * will default to 4 + * pDataOut - result of subsurface scattering simulation + * pDataTotal - [optional] results can be summed into this buffer + */ STDMETHOD(ComputeSSAdaptive)(THIS_ LPD3DXPRTBUFFER pDataIn, FLOAT AdaptiveThresh, FLOAT MinEdgeLength, UINT MaxSubdiv, LPD3DXPRTBUFFER pDataOut, LPD3DXPRTBUFFER pDataTotal) PURE; - // computes a single bounce of inter-reflected light - // works for SH based PRT or generic lighting - // Albedo is not multiplied by result - // - // pDataIn - previous bounces data - // pDataOut - PRT buffer that is generated - // pDataTotal - [optional] can be used to keep a running sum + /* computes a single bounce of inter-reflected light + * works for SH based PRT or generic lighting + * Albedo is not multiplied by result + * + * pDataIn - previous bounces data + * pDataOut - PRT buffer that is generated + * pDataTotal - [optional] can be used to keep a running sum + */ STDMETHOD(ComputeBounce)(THIS_ LPD3DXPRTBUFFER pDataIn, LPD3DXPRTBUFFER pDataOut, LPD3DXPRTBUFFER pDataTotal) PURE; - // Adaptive version of above function. - // - // pDataIn - previous bounces data, can be single channel - // AdaptiveThresh - threshold for adaptive subdivision (in PRT vector error) - // if value is less then 1e-6f, 1e-6f is specified - // MinEdgeLength - minimum edge length that will be generated - // if value is too small a fairly conservative model dependent value - // is used - // MaxSubdiv - maximum subdivision level, if 0 is specified it - // will default to 4 - // pDataOut - PRT buffer that is generated - // pDataTotal - [optional] can be used to keep a running sum + /* Adaptive version of above function. + * + * pDataIn - previous bounces data, can be single channel + * AdaptiveThresh - threshold for adaptive subdivision (in PRT vector error) + * if value is less then 1e-6f, 1e-6f is specified + * MinEdgeLength - minimum edge length that will be generated + * if value is too small a fairly conservative model dependent value + * is used + * MaxSubdiv - maximum subdivision level, if 0 is specified it + * will default to 4 + * pDataOut - PRT buffer that is generated + * pDataTotal - [optional] can be used to keep a running sum + */ STDMETHOD(ComputeBounceAdaptive)(THIS_ LPD3DXPRTBUFFER pDataIn, FLOAT AdaptiveThresh, FLOAT MinEdgeLength, @@ -2118,65 +2187,68 @@ DECLARE_INTERFACE_(ID3DXPRTEngine, IUnknown) LPD3DXPRTBUFFER pDataOut, LPD3DXPRTBUFFER pDataTotal) PURE; - // Computes projection of distant SH radiance into a local SH radiance - // function. This models how direct lighting is attenuated by the - // scene and is a form of "neighborhood transfer." The result is - // a linear operator (matrix) at every sample point, if you multiply - // this matrix by the distant SH lighting coefficients you get an - // approximation of the local incident radiance function from - // direct lighting. These resulting lighting coefficients can - // than be projected into another basis or used with any rendering - // technique that uses spherical harmonics as input. - // SetSamplingInfo must be called with TRUE for UseSphere and - // FALSE for UseCosine before this method is called. - // Generates SHOrderIn*SHOrderIn*SHOrderOut*SHOrderOut scalars - // per channel at each sample location. - // - // SHOrderIn - Order of the SH representation of distant lighting - // SHOrderOut - Order of the SH representation of local lighting - // NumVolSamples - Number of sample locations - // pSampleLocs - position of sample locations - // pDataOut - PRT Buffer that will store output results + /* Computes projection of distant SH radiance into a local SH radiance + * function. This models how direct lighting is attenuated by the + * scene and is a form of "neighborhood transfer." The result is + * a linear operator (matrix) at every sample point, if you multiply + * this matrix by the distant SH lighting coefficients you get an + * approximation of the local incident radiance function from + * direct lighting. These resulting lighting coefficients can + * than be projected into another basis or used with any rendering + * technique that uses spherical harmonics as input. + * SetSamplingInfo must be called with TRUE for UseSphere and + * FALSE for UseCosine before this method is called. + * Generates SHOrderIn*SHOrderIn*SHOrderOut*SHOrderOut scalars + * per channel at each sample location. + * + * SHOrderIn - Order of the SH representation of distant lighting + * SHOrderOut - Order of the SH representation of local lighting + * NumVolSamples - Number of sample locations + * pSampleLocs - position of sample locations + * pDataOut - PRT Buffer that will store output results + */ STDMETHOD(ComputeVolumeSamplesDirectSH)(THIS_ UINT SHOrderIn, UINT SHOrderOut, UINT NumVolSamples, CONST D3DXVECTOR3 *pSampleLocs, LPD3DXPRTBUFFER pDataOut) PURE; - // At each sample location computes a linear operator (matrix) that maps - // the representation of source radiance (NumCoeffs in pSurfDataIn) - // into a local incident radiance function approximated with spherical - // harmonics. For example if a light map data is specified in pSurfDataIn - // the result is an SH representation of the flow of light at each sample - // point. If PRT data for an outdoor scene is used, each sample point - // contains a matrix that models how distant lighting bounces of the objects - // in the scene and arrives at the given sample point. Combined with - // ComputeVolumeSamplesDirectSH this gives the complete representation for - // how light arrives at each sample point parameterized by distant lighting. - // SetSamplingInfo must be called with TRUE for UseSphere and - // FALSE for UseCosine before this method is called. - // Generates pSurfDataIn->NumCoeffs()*SHOrder*SHOrder scalars - // per channel at each sample location. - // - // pSurfDataIn - previous bounce data - // SHOrder - order of SH to generate projection with - // NumVolSamples - Number of sample locations - // pSampleLocs - position of sample locations - // pDataOut - PRT Buffer that will store output results + /* At each sample location computes a linear operator (matrix) that maps + * the representation of source radiance (NumCoeffs in pSurfDataIn) + * into a local incident radiance function approximated with spherical + * harmonics. For example if a light map data is specified in pSurfDataIn + * the result is an SH representation of the flow of light at each sample + * point. If PRT data for an outdoor scene is used, each sample point + * contains a matrix that models how distant lighting bounces of the objects + * in the scene and arrives at the given sample point. Combined with + * ComputeVolumeSamplesDirectSH this gives the complete representation for + * how light arrives at each sample point parameterized by distant lighting. + * SetSamplingInfo must be called with TRUE for UseSphere and + * FALSE for UseCosine before this method is called. + * Generates pSurfDataIn->NumCoeffs()*SHOrder*SHOrder scalars + * per channel at each sample location. + * + * pSurfDataIn - previous bounce data + * SHOrder - order of SH to generate projection with + * NumVolSamples - Number of sample locations + * pSampleLocs - position of sample locations + * pDataOut - PRT Buffer that will store output results + */ STDMETHOD(ComputeVolumeSamples)(THIS_ LPD3DXPRTBUFFER pSurfDataIn, UINT SHOrder, UINT NumVolSamples, CONST D3DXVECTOR3 *pSampleLocs, LPD3DXPRTBUFFER pDataOut) PURE; - // Computes direct lighting (SH) for a point not on the mesh - // with a given normal - cannot use texture buffers. - // - // SHOrder - order of SH to use - // NumSamples - number of sample locations - // pSampleLocs - position for each sample - // pSampleNorms - normal for each sample - // pDataOut - PRT Buffer that will store output results + /* Computes direct lighting (SH) for a point not on the mesh + * with a given normal - cannot use texture buffers. + * + * SHOrder - order of SH to use + * NumSamples - number of sample locations + * pSampleLocs - position for each sample + * pSampleNorms - normal for each sample + * pDataOut - PRT Buffer that will store output results + */ STDMETHOD(ComputeSurfSamplesDirectSH)(THIS_ UINT SHOrder, UINT NumSamples, CONST D3DXVECTOR3 *pSampleLocs, @@ -2184,15 +2256,16 @@ DECLARE_INTERFACE_(ID3DXPRTEngine, IUnknown) LPD3DXPRTBUFFER pDataOut) PURE; - // given the solution for PRT or light maps, computes transfer vector at arbitrary - // position/normal pairs in space - // - // pSurfDataIn - input data - // NumSamples - number of sample locations - // pSampleLocs - position for each sample - // pSampleNorms - normal for each sample - // pDataOut - PRT Buffer that will store output results - // pDataTotal - optional buffer to sum results into - can be NULL + /* given the solution for PRT or light maps, computes transfer vector at arbitrary + * position/normal pairs in space + * + * pSurfDataIn - input data + * NumSamples - number of sample locations + * pSampleLocs - position for each sample + * pSampleNorms - normal for each sample + * pDataOut - PRT Buffer that will store output results + * pDataTotal - optional buffer to sum results into - can be NULL + */ STDMETHOD(ComputeSurfSamplesBounce)(THIS_ LPD3DXPRTBUFFER pSurfDataIn, UINT NumSamples, CONST D3DXVECTOR3 *pSampleLocs, @@ -2200,112 +2273,120 @@ DECLARE_INTERFACE_(ID3DXPRTEngine, IUnknown) LPD3DXPRTBUFFER pDataOut, LPD3DXPRTBUFFER pDataTotal) PURE; - // Frees temporary data structures that can be created for subsurface scattering - // this data is freed when the PRTComputeEngine is freed and is lazily created + /* Frees temporary data structures that can be created for subsurface scattering + * this data is freed when the PRTComputeEngine is freed and is lazily created + */ STDMETHOD(FreeSSData)(THIS) PURE; - // Frees temporary data structures that can be created for bounce simulations - // this data is freed when the PRTComputeEngine is freed and is lazily created + /* Frees temporary data structures that can be created for bounce simulations + * this data is freed when the PRTComputeEngine is freed and is lazily created + */ STDMETHOD(FreeBounceData)(THIS) PURE; - // This computes the Local Deformable PRT (LDPRT) coefficients relative to the - // per sample normals that minimize error in a least squares sense with respect - // to the input PRT data set. These coefficients can be used with skinned/transformed - // normals to model global effects with dynamic objects. Shading normals can - // optionally be solved for - these normals (along with the LDPRT coefficients) can - // more accurately represent the PRT signal. The coefficients are for zonal - // harmonics oriented in the normal/shading normal direction. - // - // pDataIn - SH PRT dataset that is input - // SHOrder - Order of SH to compute conv coefficients for - // pNormOut - Optional array of vectors (passed in) that will be filled with - // "shading normals", LDPRT coefficients are optimized for - // these normals. This array must be the same size as the number of - // samples in pDataIn - // pDataOut - Output buffer (SHOrder zonal harmonic coefficients per channel per sample) + /* This computes the Local Deformable PRT (LDPRT) coefficients relative to the + * per sample normals that minimize error in a least squares sense with respect + * to the input PRT data set. These coefficients can be used with skinned/transformed + * normals to model global effects with dynamic objects. Shading normals can + * optionally be solved for - these normals (along with the LDPRT coefficients) can + * more accurately represent the PRT signal. The coefficients are for zonal + * harmonics oriented in the normal/shading normal direction. + * + * pDataIn - SH PRT dataset that is input + * SHOrder - Order of SH to compute conv coefficients for + * pNormOut - Optional array of vectors (passed in) that will be filled with + * "shading normals", LDPRT coefficients are optimized for + * these normals. This array must be the same size as the number of + * samples in pDataIn + * pDataOut - Output buffer (SHOrder zonal harmonic coefficients per channel per sample) + */ STDMETHOD(ComputeLDPRTCoeffs)(THIS_ LPD3DXPRTBUFFER pDataIn, UINT SHOrder, D3DXVECTOR3 *pNormOut, LPD3DXPRTBUFFER pDataOut) PURE; - // scales all the samples associated with a given sub mesh - // can be useful when using subsurface scattering - // fScale - value to scale each vector in submesh by + /* scales all the samples associated with a given sub mesh + * can be useful when using subsurface scattering + * fScale - value to scale each vector in submesh by + */ STDMETHOD(ScaleMeshChunk)(THIS_ UINT uMeshChunk, FLOAT fScale, LPD3DXPRTBUFFER pDataOut) PURE; - // mutliplies each PRT vector by the albedo - can be used if you want to have the albedo - // burned into the dataset, often better not to do this. If this is not done the user - // must mutliply the albedo themselves when rendering - just multiply the albedo times - // the result of the PRT dot product. - // If pDataOut is a texture simulation result and there is an albedo texture it - // must be represented at the same resolution as the simulation buffer. You can use - // LoadSurfaceFromSurface and set a new albedo texture if this is an issue - but must - // be careful about how the gutters are handled. - // - // pDataOut - dataset that will get albedo pushed into it + /* mutliplies each PRT vector by the albedo - can be used if you want to have the albedo + * burned into the dataset, often better not to do this. If this is not done the user + * must mutliply the albedo themselves when rendering - just multiply the albedo times + * the result of the PRT dot product. + * If pDataOut is a texture simulation result and there is an albedo texture it + * must be represented at the same resolution as the simulation buffer. You can use + * LoadSurfaceFromSurface and set a new albedo texture if this is an issue - but must + * be careful about how the gutters are handled. + * + * pDataOut - dataset that will get albedo pushed into it + */ STDMETHOD(MultiplyAlbedo)(THIS_ LPD3DXPRTBUFFER pDataOut) PURE; - // Sets a pointer to an optional call back function that reports back to the - // user percentage done and gives them the option of quitting - // pCB - pointer to call back function, return S_OK for the simulation - // to continue - // Frequency - 1/Frequency is roughly the number of times the call back - // will be invoked - // lpUserContext - will be passed back to the users call back + /* Sets a pointer to an optional call back function that reports back to the + * user percentage done and gives them the option of quitting + * pCB - pointer to call back function, return S_OK for the simulation + * to continue + * Frequency - 1/Frequency is roughly the number of times the call back + * will be invoked + * lpUserContext - will be passed back to the users call back + */ STDMETHOD(SetCallBack)(THIS_ LPD3DXSHPRTSIMCB pCB, FLOAT Frequency, LPVOID lpUserContext) PURE; - // Returns TRUE if the ray intersects the mesh, FALSE if it does not. This function - // takes into account settings from SetMinMaxIntersection. If the closest intersection - // is not needed this function is more efficient compared to the ClosestRayIntersection - // method. - // pRayPos - origin of ray - // pRayDir - normalized ray direction (normalization required for SetMinMax to be meaningful) + /* Returns TRUE if the ray intersects the mesh, FALSE if it does not. This function + * takes into account settings from SetMinMaxIntersection. If the closest intersection + * is not needed this function is more efficient compared to the ClosestRayIntersection + * method. + * pRayPos - origin of ray + * pRayDir - normalized ray direction (normalization required for SetMinMax to be meaningful) + */ STDMETHOD_(BOOL, ShadowRayIntersects)(THIS_ CONST D3DXVECTOR3 *pRayPos, CONST D3DXVECTOR3 *pRayDir) PURE; - // Returns TRUE if the ray intersects the mesh, FALSE if it does not. If there is an - // intersection the closest face that was intersected and its first two barycentric coordinates - // are returned. This function takes into account settings from SetMinMaxIntersection. - // This is a slower function compared to ShadowRayIntersects and should only be used where - // needed. The third vertices barycentric coordinates will be 1 - pU - pV. - // pRayPos - origin of ray - // pRayDir - normalized ray direction (normalization required for SetMinMax to be meaningful) - // pFaceIndex - Closest face that intersects. This index is based on stacking the pBlockerMesh - // faces before the faces from pMesh - // pU - Barycentric coordinate for vertex 0 - // pV - Barycentric coordinate for vertex 1 - // pDist - Distance along ray where the intersection occured + /* Returns TRUE if the ray intersects the mesh, FALSE if it does not. If there is an + * intersection the closest face that was intersected and its first two barycentric coordinates + * are returned. This function takes into account settings from SetMinMaxIntersection. + * This is a slower function compared to ShadowRayIntersects and should only be used where + * needed. The third vertices barycentric coordinates will be 1 - pU - pV. + * pRayPos - origin of ray + * pRayDir - normalized ray direction (normalization required for SetMinMax to be meaningful) + * pFaceIndex - Closest face that intersects. This index is based on stacking the pBlockerMesh + * faces before the faces from pMesh + * pU - Barycentric coordinate for vertex 0 + * pV - Barycentric coordinate for vertex 1 + * pDist - Distance along ray where the intersection occured + */ STDMETHOD_(BOOL, ClosestRayIntersects)(THIS_ CONST D3DXVECTOR3 *pRayPos, CONST D3DXVECTOR3 *pRayDir, DWORD *pFaceIndex, FLOAT *pU, FLOAT *pV, FLOAT *pDist) PURE; }; -// API functions for creating interfaces +/* API functions for creating interfaces */ #ifdef __cplusplus extern "C" { -#endif //__cplusplus +#endif /* __cplusplus */ -//============================================================================ -// -// D3DXCreatePRTBuffer: -// -------------------- -// Generates a PRT Buffer that can be compressed or filled by a simulator -// This function should be used to create per-vertex or volume buffers. -// When buffers are created all values are initialized to zero. -// -// Parameters: -// NumSamples -// Number of sample locations represented -// NumCoeffs -// Number of coefficients per sample location (order^2 for SH) -// NumChannels -// Number of color channels to represent (1 or 3) -// ppBuffer -// Buffer that will be allocated -// -//============================================================================ +/* + * + * D3DXCreatePRTBuffer: + * -------------------- + * Generates a PRT Buffer that can be compressed or filled by a simulator + * This function should be used to create per-vertex or volume buffers. + * When buffers are created all values are initialized to zero. + * + * Parameters: + * NumSamples + * Number of sample locations represented + * NumCoeffs + * Number of coefficients per sample location (order^2 for SH) + * NumChannels + * Number of color channels to represent (1 or 3) + * ppBuffer + * Buffer that will be allocated + * + */ HRESULT WINAPI D3DXCreatePRTBuffer( @@ -2314,27 +2395,27 @@ HRESULT WINAPI UINT NumChannels, LPD3DXPRTBUFFER* ppBuffer); -//============================================================================ -// -// D3DXCreatePRTBufferTex: -// -------------------- -// Generates a PRT Buffer that can be compressed or filled by a simulator -// This function should be used to create per-pixel buffers. -// When buffers are created all values are initialized to zero. -// -// Parameters: -// Width -// Width of texture -// Height -// Height of texture -// NumCoeffs -// Number of coefficients per sample location (order^2 for SH) -// NumChannels -// Number of color channels to represent (1 or 3) -// ppBuffer -// Buffer that will be allocated -// -//============================================================================ +/* + * + * D3DXCreatePRTBufferTex: + * -------------------- + * Generates a PRT Buffer that can be compressed or filled by a simulator + * This function should be used to create per-pixel buffers. + * When buffers are created all values are initialized to zero. + * + * Parameters: + * Width + * Width of texture + * Height + * Height of texture + * NumCoeffs + * Number of coefficients per sample location (order^2 for SH) + * NumChannels + * Number of color channels to represent (1 or 3) + * ppBuffer + * Buffer that will be allocated + * + */ HRESULT WINAPI D3DXCreatePRTBufferTex( @@ -2344,19 +2425,19 @@ HRESULT WINAPI UINT NumChannels, LPD3DXPRTBUFFER* ppBuffer); -//============================================================================ -// -// D3DXLoadPRTBufferFromFile: -// -------------------- -// Loads a PRT buffer that has been saved to disk. -// -// Parameters: -// pFilename -// Name of the file to load -// ppBuffer -// Buffer that will be allocated -// -//============================================================================ +/* + * + * D3DXLoadPRTBufferFromFile: + * -------------------- + * Loads a PRT buffer that has been saved to disk. + * + * Parameters: + * pFilename + * Name of the file to load + * ppBuffer + * Buffer that will be allocated + * + */ HRESULT WINAPI D3DXLoadPRTBufferFromFileA( @@ -2375,19 +2456,19 @@ HRESULT WINAPI #endif -//============================================================================ -// -// D3DXSavePRTBufferToFile: -// -------------------- -// Saves a PRTBuffer to disk. -// -// Parameters: -// pFilename -// Name of the file to save -// pBuffer -// Buffer that will be saved -// -//============================================================================ +/* + * + * D3DXSavePRTBufferToFile: + * -------------------- + * Saves a PRTBuffer to disk. + * + * Parameters: + * pFilename + * Name of the file to save + * pBuffer + * Buffer that will be saved + * + */ HRESULT WINAPI D3DXSavePRTBufferToFileA( @@ -2406,19 +2487,19 @@ HRESULT WINAPI #endif -//============================================================================ -// -// D3DXLoadPRTCompBufferFromFile: -// -------------------- -// Loads a PRTComp buffer that has been saved to disk. -// -// Parameters: -// pFilename -// Name of the file to load -// ppBuffer -// Buffer that will be allocated -// -//============================================================================ +/* + * + * D3DXLoadPRTCompBufferFromFile: + * -------------------- + * Loads a PRTComp buffer that has been saved to disk. + * + * Parameters: + * pFilename + * Name of the file to load + * ppBuffer + * Buffer that will be allocated + * + */ HRESULT WINAPI D3DXLoadPRTCompBufferFromFileA( @@ -2436,19 +2517,19 @@ HRESULT WINAPI #define D3DXLoadPRTCompBufferFromFile D3DXLoadPRTCompBufferFromFileA #endif -//============================================================================ -// -// D3DXSavePRTCompBufferToFile: -// -------------------- -// Saves a PRTCompBuffer to disk. -// -// Parameters: -// pFilename -// Name of the file to save -// pBuffer -// Buffer that will be saved -// -//============================================================================ +/* + * + * D3DXSavePRTCompBufferToFile: + * -------------------- + * Saves a PRTCompBuffer to disk. + * + * Parameters: + * pFilename + * Name of the file to save + * pBuffer + * Buffer that will be saved + * + */ HRESULT WINAPI D3DXSavePRTCompBufferToFileA( @@ -2466,30 +2547,30 @@ HRESULT WINAPI #define D3DXSavePRTCompBufferToFile D3DXSavePRTCompBufferToFileA #endif -//============================================================================ -// -// D3DXCreatePRTCompBuffer: -// -------------------- -// Compresses a PRT buffer (vertex or texel) -// -// Parameters: -// D3DXSHCOMPRESSQUALITYTYPE -// Quality of compression - low is faster (computes PCA per voronoi cluster) -// high is slower but better quality (clusters based on distance to affine subspace) -// NumClusters -// Number of clusters to compute -// NumPCA -// Number of basis vectors to compute -// pCB -// Optional Callback function -// lpUserContext -// Optional user context -// pBufferIn -// Buffer that will be compressed -// ppBufferOut -// Compressed buffer that will be created -// -//============================================================================ +/* + * + * D3DXCreatePRTCompBuffer: + * -------------------- + * Compresses a PRT buffer (vertex or texel) + * + * Parameters: + * D3DXSHCOMPRESSQUALITYTYPE + * Quality of compression - low is faster (computes PCA per voronoi cluster) + * high is slower but better quality (clusters based on distance to affine subspace) + * NumClusters + * Number of clusters to compute + * NumPCA + * Number of basis vectors to compute + * pCB + * Optional Callback function + * lpUserContext + * Optional user context + * pBufferIn + * Buffer that will be compressed + * ppBufferOut + * Compressed buffer that will be created + * + */ HRESULT WINAPI @@ -2503,27 +2584,28 @@ HRESULT WINAPI LPD3DXPRTCOMPBUFFER *ppBufferOut ); -//============================================================================ -// -// D3DXCreateTextureGutterHelper: -// -------------------- -// Generates a "GutterHelper" for a given set of meshes and texture -// resolution -// -// Parameters: -// Width -// Width of texture -// Height -// Height of texture -// pMesh -// Mesh that represents the scene -// GutterSize -// Number of texels to over rasterize in texture space -// this should be at least 1.0 -// ppBuffer -// GutterHelper that will be created -// -//============================================================================ +/* + * + * D3DXCreateTextureGutterHelper: + * -------------------- + * Generates a "GutterHelper" for a given set of meshes and texture + * resolution + * + * Parameters: + * Width + * Width of texture + * Height + * Height of texture + * pMesh + * Mesh that represents the scene + * GutterSize + * Number of texels to over rasterize in texture space + * this should be at least 1.0 + * ppBuffer + * GutterHelper that will be created + * + * + */ HRESULT WINAPI @@ -2535,28 +2617,28 @@ HRESULT WINAPI LPD3DXTEXTUREGUTTERHELPER* ppBuffer); -//============================================================================ -// -// D3DXCreatePRTEngine: -// -------------------- -// Computes a PRTEngine which can efficiently generate PRT simulations -// of a scene -// -// Parameters: -// pMesh -// Mesh that represents the scene - must have an AttributeTable -// where vertices are in a unique attribute. -// pAdjacency -// Optional adjacency information -// ExtractUVs -// Set this to true if textures are going to be used for albedos -// or to store PRT vectors -// pBlockerMesh -// Optional mesh that just blocks the scene -// ppEngine -// PRTEngine that will be created -// -//============================================================================ +/* + * + * D3DXCreatePRTEngine: + * -------------------- + * Computes a PRTEngine which can efficiently generate PRT simulations + * of a scene + * + * Parameters: + * pMesh + * Mesh that represents the scene - must have an AttributeTable + * where vertices are in a unique attribute. + * pAdjacency + * Optional adjacency information + * ExtractUVs + * Set this to true if textures are going to be used for albedos + * or to store PRT vectors + * pBlockerMesh + * Optional mesh that just blocks the scene + * ppEngine + * PRTEngine that will be created + * + */ HRESULT WINAPI @@ -2567,38 +2649,38 @@ HRESULT WINAPI LPD3DXMESH pBlockerMesh, LPD3DXPRTENGINE* ppEngine); -//============================================================================ -// -// D3DXConcatenateMeshes: -// -------------------- -// Concatenates a group of meshes into one common mesh. This can optionaly transform -// each sub mesh or its texture coordinates. If no DECL is given it will -// generate a union of all of the DECL's of the sub meshes, promoting channels -// and types if neccesary. It will create an AttributeTable if possible, one can -// call OptimizeMesh with attribute sort and compacting enabled to ensure this. -// -// Parameters: -// ppMeshes -// Array of pointers to meshes that can store PRT vectors -// NumMeshes -// Number of meshes -// Options -// Passed through to D3DXCreateMesh -// pGeomXForms -// [optional] Each sub mesh is transformed by the corresponding -// matrix if this array is supplied -// pTextureXForms -// [optional] UV coordinates for each sub mesh are transformed -// by corresponding matrix if supplied -// pDecl -// [optional] Only information in this DECL is used when merging -// data -// pD3DDevice -// D3D device that is used to create the new mesh -// ppMeshOut -// Mesh that will be created -// -//============================================================================ +/* + * + * D3DXConcatenateMeshes: + * -------------------- + * Concatenates a group of meshes into one common mesh. This can optionaly transform + * each sub mesh or its texture coordinates. If no DECL is given it will + * generate a union of all of the DECL's of the sub meshes, promoting channels + * and types if neccesary. It will create an AttributeTable if possible, one can + * call OptimizeMesh with attribute sort and compacting enabled to ensure this. + * + * Parameters: + * ppMeshes + * Array of pointers to meshes that can store PRT vectors + * NumMeshes + * Number of meshes + * Options + * Passed through to D3DXCreateMesh + * pGeomXForms + * [optional] Each sub mesh is transformed by the corresponding + * matrix if this array is supplied + * pTextureXForms + * [optional] UV coordinates for each sub mesh are transformed + * by corresponding matrix if supplied + * pDecl + * [optional] Only information in this DECL is used when merging + * data + * pD3DDevice + * D3D device that is used to create the new mesh + * ppMeshOut + * Mesh that will be created + * + */ HRESULT WINAPI @@ -2612,31 +2694,31 @@ HRESULT WINAPI LPDIRECT3DDEVICE9 pD3DDevice, LPD3DXMESH *ppMeshOut); -//============================================================================ -// -// D3DXSHPRTCompSuperCluster: -// -------------------------- -// Used with compressed results of D3DXSHPRTSimulation. -// Generates "super clusters" - groups of clusters that can be drawn in -// the same draw call. A greedy algorithm that minimizes overdraw is used -// to group the clusters. -// -// Parameters: -// pClusterIDs -// NumVerts cluster ID's (extracted from a compressed buffer) -// pScene -// Mesh that represents composite scene passed to the simulator -// MaxNumClusters -// Maximum number of clusters allocated per super cluster -// NumClusters -// Number of clusters computed in the simulator -// pSuperClusterIDs -// Array of length NumClusters, contains index of super cluster -// that corresponding cluster was assigned to -// pNumSuperClusters -// Returns the number of super clusters allocated -// -//============================================================================ +/* + * + * D3DXSHPRTCompSuperCluster: + * -------------------------- + * Used with compressed results of D3DXSHPRTSimulation. + * Generates "super clusters" - groups of clusters that can be drawn in + * the same draw call. A greedy algorithm that minimizes overdraw is used + * to group the clusters. + * + * Parameters: + * pClusterIDs + * NumVerts cluster ID's (extracted from a compressed buffer) + * pScene + * Mesh that represents composite scene passed to the simulator + * MaxNumClusters + * Maximum number of clusters allocated per super cluster + * NumClusters + * Number of clusters computed in the simulator + * pSuperClusterIDs + * Array of length NumClusters, contains index of super cluster + * that corresponding cluster was assigned to + * pNumSuperClusters + * Returns the number of super clusters allocated + * + */ HRESULT WINAPI D3DXSHPRTCompSuperCluster( @@ -2647,60 +2729,60 @@ HRESULT WINAPI UINT *pSuperClusterIDs, UINT *pNumSuperClusters); -//============================================================================ -// -// D3DXSHPRTCompSplitMeshSC: -// ------------------------- -// Used with compressed results of the vertex version of the PRT simulator. -// After D3DXSHRTCompSuperCluster has been called this function can be used -// to split the mesh into a group of faces/vertices per super cluster. -// Each super cluster contains all of the faces that contain any vertex -// classified in one of its clusters. All of the vertices connected to this -// set of faces are also included with the returned array ppVertStatus -// indicating whether or not the vertex belongs to the supercluster. -// -// Parameters: -// pClusterIDs -// NumVerts cluster ID's (extracted from a compressed buffer) -// NumVertices -// Number of vertices in original mesh -// NumClusters -// Number of clusters (input parameter to compression) -// pSuperClusterIDs -// Array of size NumClusters that will contain super cluster ID's (from -// D3DXSHCompSuerCluster) -// NumSuperClusters -// Number of superclusters allocated in D3DXSHCompSuerCluster -// pInputIB -// Raw index buffer for mesh - format depends on bInputIBIs32Bit -// InputIBIs32Bit -// Indicates whether the input index buffer is 32-bit (otherwise 16-bit -// is assumed) -// NumFaces -// Number of faces in the original mesh (pInputIB is 3 times this length) -// ppIBData -// LPD3DXBUFFER holds raw index buffer that will contain the resulting split faces. -// Format determined by bIBIs32Bit. Allocated by function -// pIBDataLength -// Length of ppIBData, assigned in function -// OutputIBIs32Bit -// Indicates whether the output index buffer is to be 32-bit (otherwise -// 16-bit is assumed) -// ppFaceRemap -// LPD3DXBUFFER mapping of each face in ppIBData to original faces. Length is -// *pIBDataLength/3. Optional paramter, allocated in function -// ppVertData -// LPD3DXBUFFER contains new vertex data structure. Size of pVertDataLength -// pVertDataLength -// Number of new vertices in split mesh. Assigned in function -// pSCClusterList -// Array of length NumClusters which pSCData indexes into (Cluster* fields) -// for each SC, contains clusters sorted by super cluster -// pSCData -// Structure per super cluster - contains indices into ppIBData, -// pSCClusterList and ppVertData -// -//============================================================================ +/* + * + * D3DXSHPRTCompSplitMeshSC: + * ------------------------- + * Used with compressed results of the vertex version of the PRT simulator. + * After D3DXSHRTCompSuperCluster has been called this function can be used + * to split the mesh into a group of faces/vertices per super cluster. + * Each super cluster contains all of the faces that contain any vertex + * classified in one of its clusters. All of the vertices connected to this + * set of faces are also included with the returned array ppVertStatus + * indicating whether or not the vertex belongs to the supercluster. + * + * Parameters: + * pClusterIDs + * NumVerts cluster ID's (extracted from a compressed buffer) + * NumVertices + * Number of vertices in original mesh + * NumClusters + * Number of clusters (input parameter to compression) + * pSuperClusterIDs + * Array of size NumClusters that will contain super cluster ID's (from + * D3DXSHCompSuerCluster) + * NumSuperClusters + * Number of superclusters allocated in D3DXSHCompSuerCluster + * pInputIB + * Raw index buffer for mesh - format depends on bInputIBIs32Bit + * InputIBIs32Bit + * Indicates whether the input index buffer is 32-bit (otherwise 16-bit + * is assumed) + * NumFaces + * Number of faces in the original mesh (pInputIB is 3 times this length) + * ppIBData + * LPD3DXBUFFER holds raw index buffer that will contain the resulting split faces. + * Format determined by bIBIs32Bit. Allocated by function + * pIBDataLength + * Length of ppIBData, assigned in function + * OutputIBIs32Bit + * Indicates whether the output index buffer is to be 32-bit (otherwise + * 16-bit is assumed) + * ppFaceRemap + * LPD3DXBUFFER mapping of each face in ppIBData to original faces. Length is + * *pIBDataLength/3. Optional paramter, allocated in function + * ppVertData + * LPD3DXBUFFER contains new vertex data structure. Size of pVertDataLength + * pVertDataLength + * Number of new vertices in split mesh. Assigned in function + * pSCClusterList + * Array of length NumClusters which pSCData indexes into (Cluster* fields) + * for each SC, contains clusters sorted by super cluster + * pSCData + * Structure per super cluster - contains indices into ppIBData, + * pSCClusterList and ppVertData + * + */ HRESULT WINAPI D3DXSHPRTCompSplitMeshSC( @@ -2724,100 +2806,99 @@ HRESULT WINAPI #ifdef __cplusplus } -#endif //__cplusplus +#endif /* __cplusplus */ -////////////////////////////////////////////////////////////////////////////// -// -// Definitions of .X file templates used by mesh load/save functions -// that are not RM standard -// -////////////////////////////////////////////////////////////////////////////// +/* + * + * Definitions of .X file templates used by mesh load/save functions + * that are not RM standard + */ -// {3CF169CE-FF7C-44ab-93C0-F78F62D172E2} +/* {3CF169CE-FF7C-44ab-93C0-F78F62D172E2} */ DEFINE_GUID(DXFILEOBJ_XSkinMeshHeader, 0x3cf169ce, 0xff7c, 0x44ab, 0x93, 0xc0, 0xf7, 0x8f, 0x62, 0xd1, 0x72, 0xe2); -// {B8D65549-D7C9-4995-89CF-53A9A8B031E3} +/* {B8D65549-D7C9-4995-89CF-53A9A8B031E3} */ DEFINE_GUID(DXFILEOBJ_VertexDuplicationIndices, 0xb8d65549, 0xd7c9, 0x4995, 0x89, 0xcf, 0x53, 0xa9, 0xa8, 0xb0, 0x31, 0xe3); -// {A64C844A-E282-4756-8B80-250CDE04398C} +/* {A64C844A-E282-4756-8B80-250CDE04398C} */ DEFINE_GUID(DXFILEOBJ_FaceAdjacency, 0xa64c844a, 0xe282, 0x4756, 0x8b, 0x80, 0x25, 0xc, 0xde, 0x4, 0x39, 0x8c); -// {6F0D123B-BAD2-4167-A0D0-80224F25FABB} +/* {6F0D123B-BAD2-4167-A0D0-80224F25FABB} */ DEFINE_GUID(DXFILEOBJ_SkinWeights, 0x6f0d123b, 0xbad2, 0x4167, 0xa0, 0xd0, 0x80, 0x22, 0x4f, 0x25, 0xfa, 0xbb); -// {A3EB5D44-FC22-429d-9AFB-3221CB9719A6} +/* {A3EB5D44-FC22-429d-9AFB-3221CB9719A6} */ DEFINE_GUID(DXFILEOBJ_Patch, 0xa3eb5d44, 0xfc22, 0x429d, 0x9a, 0xfb, 0x32, 0x21, 0xcb, 0x97, 0x19, 0xa6); -// {D02C95CC-EDBA-4305-9B5D-1820D7704BBF} +/* {D02C95CC-EDBA-4305-9B5D-1820D7704BBF} */ DEFINE_GUID(DXFILEOBJ_PatchMesh, 0xd02c95cc, 0xedba, 0x4305, 0x9b, 0x5d, 0x18, 0x20, 0xd7, 0x70, 0x4b, 0xbf); -// {B9EC94E1-B9A6-4251-BA18-94893F02C0EA} +/* {B9EC94E1-B9A6-4251-BA18-94893F02C0EA} */ DEFINE_GUID(DXFILEOBJ_PatchMesh9, 0xb9ec94e1, 0xb9a6, 0x4251, 0xba, 0x18, 0x94, 0x89, 0x3f, 0x2, 0xc0, 0xea); -// {B6C3E656-EC8B-4b92-9B62-681659522947} +/* {B6C3E656-EC8B-4b92-9B62-681659522947} */ DEFINE_GUID(DXFILEOBJ_PMInfo, 0xb6c3e656, 0xec8b, 0x4b92, 0x9b, 0x62, 0x68, 0x16, 0x59, 0x52, 0x29, 0x47); -// {917E0427-C61E-4a14-9C64-AFE65F9E9844} +/* {917E0427-C61E-4a14-9C64-AFE65F9E9844} */ DEFINE_GUID(DXFILEOBJ_PMAttributeRange, 0x917e0427, 0xc61e, 0x4a14, 0x9c, 0x64, 0xaf, 0xe6, 0x5f, 0x9e, 0x98, 0x44); -// {574CCC14-F0B3-4333-822D-93E8A8A08E4C} +/* {574CCC14-F0B3-4333-822D-93E8A8A08E4C} */ DEFINE_GUID(DXFILEOBJ_PMVSplitRecord, 0x574ccc14, 0xf0b3, 0x4333, 0x82, 0x2d, 0x93, 0xe8, 0xa8, 0xa0, 0x8e, 0x4c); -// {B6E70A0E-8EF9-4e83-94AD-ECC8B0C04897} +/* {B6E70A0E-8EF9-4e83-94AD-ECC8B0C04897} */ DEFINE_GUID(DXFILEOBJ_FVFData, 0xb6e70a0e, 0x8ef9, 0x4e83, 0x94, 0xad, 0xec, 0xc8, 0xb0, 0xc0, 0x48, 0x97); -// {F752461C-1E23-48f6-B9F8-8350850F336F} +/* {F752461C-1E23-48f6-B9F8-8350850F336F} */ DEFINE_GUID(DXFILEOBJ_VertexElement, 0xf752461c, 0x1e23, 0x48f6, 0xb9, 0xf8, 0x83, 0x50, 0x85, 0xf, 0x33, 0x6f); -// {BF22E553-292C-4781-9FEA-62BD554BDD93} +/* {BF22E553-292C-4781-9FEA-62BD554BDD93} */ DEFINE_GUID(DXFILEOBJ_DeclData, 0xbf22e553, 0x292c, 0x4781, 0x9f, 0xea, 0x62, 0xbd, 0x55, 0x4b, 0xdd, 0x93); -// {F1CFE2B3-0DE3-4e28-AFA1-155A750A282D} +/* {F1CFE2B3-0DE3-4e28-AFA1-155A750A282D} */ DEFINE_GUID(DXFILEOBJ_EffectFloats, 0xf1cfe2b3, 0xde3, 0x4e28, 0xaf, 0xa1, 0x15, 0x5a, 0x75, 0xa, 0x28, 0x2d); -// {D55B097E-BDB6-4c52-B03D-6051C89D0E42} +/* {D55B097E-BDB6-4c52-B03D-6051C89D0E42} */ DEFINE_GUID(DXFILEOBJ_EffectString, 0xd55b097e, 0xbdb6, 0x4c52, 0xb0, 0x3d, 0x60, 0x51, 0xc8, 0x9d, 0xe, 0x42); -// {622C0ED0-956E-4da9-908A-2AF94F3CE716} +/* {622C0ED0-956E-4da9-908A-2AF94F3CE716} */ DEFINE_GUID(DXFILEOBJ_EffectDWord, 0x622c0ed0, 0x956e, 0x4da9, 0x90, 0x8a, 0x2a, 0xf9, 0x4f, 0x3c, 0xe7, 0x16); -// {3014B9A0-62F5-478c-9B86-E4AC9F4E418B} +/* {3014B9A0-62F5-478c-9B86-E4AC9F4E418B} */ DEFINE_GUID(DXFILEOBJ_EffectParamFloats, 0x3014b9a0, 0x62f5, 0x478c, 0x9b, 0x86, 0xe4, 0xac, 0x9f, 0x4e, 0x41, 0x8b); -// {1DBC4C88-94C1-46ee-9076-2C28818C9481} +/* {1DBC4C88-94C1-46ee-9076-2C28818C9481} */ DEFINE_GUID(DXFILEOBJ_EffectParamString, 0x1dbc4c88, 0x94c1, 0x46ee, 0x90, 0x76, 0x2c, 0x28, 0x81, 0x8c, 0x94, 0x81); -// {E13963BC-AE51-4c5d-B00F-CFA3A9D97CE5} +/* {E13963BC-AE51-4c5d-B00F-CFA3A9D97CE5} */ DEFINE_GUID(DXFILEOBJ_EffectParamDWord, 0xe13963bc, 0xae51, 0x4c5d, 0xb0, 0xf, 0xcf, 0xa3, 0xa9, 0xd9, 0x7c, 0xe5); -// {E331F7E4-0559-4cc2-8E99-1CEC1657928F} +/* {E331F7E4-0559-4cc2-8E99-1CEC1657928F} */ DEFINE_GUID(DXFILEOBJ_EffectInstance, 0xe331f7e4, 0x559, 0x4cc2, 0x8e, 0x99, 0x1c, 0xec, 0x16, 0x57, 0x92, 0x8f); -// {9E415A43-7BA6-4a73-8743-B73D47E88476} +/* {9E415A43-7BA6-4a73-8743-B73D47E88476} */ DEFINE_GUID(DXFILEOBJ_AnimTicksPerSecond, 0x9e415a43, 0x7ba6, 0x4a73, 0x87, 0x43, 0xb7, 0x3d, 0x47, 0xe8, 0x84, 0x76); -// {7F9B00B3-F125-4890-876E-1CFFBF697C4D} +/* {7F9B00B3-F125-4890-876E-1CFFBF697C4D} */ DEFINE_GUID(DXFILEOBJ_CompressedAnimationSet, 0x7f9b00b3, 0xf125, 0x4890, 0x87, 0x6e, 0x1c, 0x42, 0xbf, 0x69, 0x7c, 0x4d); diff --git a/gfx/include/d3d9/d3dx9xof.h b/gfx/include/d3d9/d3dx9xof.h index b581e0c858..1e0a249e37 100644 --- a/gfx/include/d3d9/d3dx9xof.h +++ b/gfx/include/d3d9/d3dx9xof.h @@ -34,59 +34,59 @@ typedef DWORD D3DXF_FILELOADOPTIONS; #define D3DXF_FILELOAD_FROMRESOURCE 0x02L #define D3DXF_FILELOAD_FROMMEMORY 0x03L -//---------------------------------------------------------------------------- -// D3DXF_FILELOADRESOURCE: -//---------------------------------------------------------------------------- +/* + * D3DXF_FILELOADRESOURCE: +*/ typedef struct _D3DXF_FILELOADRESOURCE { - HMODULE hModule; // Desc - LPCSTR lpName; // Desc - LPCSTR lpType; // Desc + HMODULE hModule; /* Desc */ + LPCSTR lpName; /* Desc */ + LPCSTR lpType; /* Desc */ } D3DXF_FILELOADRESOURCE; -//---------------------------------------------------------------------------- -// D3DXF_FILELOADMEMORY: -//---------------------------------------------------------------------------- +/* + * D3DXF_FILELOADMEMORY: + */ typedef struct _D3DXF_FILELOADMEMORY { - LPCVOID lpMemory; // Desc - SIZE_T dSize; // Desc + LPCVOID lpMemory; /* Desc */ + SIZE_T dSize; /* Desc */ } D3DXF_FILELOADMEMORY; #if defined( _WIN32 ) && !defined( _NO_COM ) -// {cef08cf9-7b4f-4429-9624-2a690a933201} +/* {cef08cf9-7b4f-4429-9624-2a690a933201} */ DEFINE_GUID( IID_ID3DXFile, 0xcef08cf9, 0x7b4f, 0x4429, 0x96, 0x24, 0x2a, 0x69, 0x0a, 0x93, 0x32, 0x01 ); -// {cef08cfa-7b4f-4429-9624-2a690a933201} +/* {cef08cfa-7b4f-4429-9624-2a690a933201} */ DEFINE_GUID( IID_ID3DXFileSaveObject, 0xcef08cfa, 0x7b4f, 0x4429, 0x96, 0x24, 0x2a, 0x69, 0x0a, 0x93, 0x32, 0x01 ); -// {cef08cfb-7b4f-4429-9624-2a690a933201} +/* {cef08cfb-7b4f-4429-9624-2a690a933201} */ DEFINE_GUID( IID_ID3DXFileSaveData, 0xcef08cfb, 0x7b4f, 0x4429, 0x96, 0x24, 0x2a, 0x69, 0x0a, 0x93, 0x32, 0x01 ); -// {cef08cfc-7b4f-4429-9624-2a690a933201} +/* {cef08cfc-7b4f-4429-9624-2a690a933201} */ DEFINE_GUID( IID_ID3DXFileEnumObject, 0xcef08cfc, 0x7b4f, 0x4429, 0x96, 0x24, 0x2a, 0x69, 0x0a, 0x93, 0x32, 0x01 ); -// {cef08cfd-7b4f-4429-9624-2a690a933201} +/* {cef08cfd-7b4f-4429-9624-2a690a933201} */ DEFINE_GUID( IID_ID3DXFileData, 0xcef08cfd, 0x7b4f, 0x4429, 0x96, 0x24, 0x2a, 0x69, 0x0a, 0x93, 0x32, 0x01 ); -#endif // defined( _WIN32 ) && !defined( _NO_COM ) +#endif /* defined( _WIN32 ) && !defined( _NO_COM ) */ #if defined( __cplusplus ) #if !defined( DECLSPEC_UUID ) #if _MSC_VER >= 1100 #define DECLSPEC_UUID( x ) __declspec( uuid( x ) ) -#else // !( _MSC_VER >= 1100 ) +#else /* !( _MSC_VER >= 1100 ) */ #define DECLSPEC_UUID( x ) -#endif // !( _MSC_VER >= 1100 ) -#endif // !defined( DECLSPEC_UUID ) +#endif /* !( _MSC_VER >= 1100 ) */ +#endif /* !defined( DECLSPEC_UUID ) */ interface DECLSPEC_UUID( "cef08cf9-7b4f-4429-9624-2a690a933201" ) ID3DXFile; @@ -110,8 +110,8 @@ _COM_SMARTPTR_TYPEDEF( ID3DXFileEnumObject, __uuidof( ID3DXFileEnumObject ) ); _COM_SMARTPTR_TYPEDEF( ID3DXFileData, __uuidof( ID3DXFileData ) ); -#endif // defined( _COM_SMARTPTR_TYPEDEF ) -#endif // defined( __cplusplus ) +#endif /* defined( _COM_SMARTPTR_TYPEDEF ) */ +#endif /* defined( __cplusplus ) */ typedef interface ID3DXFile ID3DXFile; typedef interface ID3DXFileSaveObject ID3DXFileSaveObject; @@ -119,9 +119,9 @@ typedef interface ID3DXFileSaveData ID3DXFileSaveData; typedef interface ID3DXFileEnumObject ID3DXFileEnumObject; typedef interface ID3DXFileData ID3DXFileData; -////////////////////////////////////////////////////////////////////////////// -// ID3DXFile ///////////////////////////////////////////////////////////////// -////////////////////////////////////////////////////////////////////////////// +/* + * ID3DXFile + */ #undef INTERFACE #define INTERFACE ID3DXFile @@ -140,9 +140,9 @@ DECLARE_INTERFACE_( ID3DXFile, IUnknown ) STDMETHOD( RegisterEnumTemplates )( THIS_ ID3DXFileEnumObject* ) PURE; }; -////////////////////////////////////////////////////////////////////////////// -// ID3DXFileSaveObject /////////////////////////////////////////////////////// -////////////////////////////////////////////////////////////////////////////// +/* + * ID3DXFileSaveObject + */ #undef INTERFACE #define INTERFACE ID3DXFileSaveObject @@ -159,9 +159,9 @@ DECLARE_INTERFACE_( ID3DXFileSaveObject, IUnknown ) STDMETHOD( Save )( THIS ) PURE; }; -////////////////////////////////////////////////////////////////////////////// -// ID3DXFileSaveData ///////////////////////////////////////////////////////// -////////////////////////////////////////////////////////////////////////////// +/* + * ID3DXFileSaveData + */ #undef INTERFACE #define INTERFACE ID3DXFileSaveData @@ -181,9 +181,9 @@ DECLARE_INTERFACE_( ID3DXFileSaveData, IUnknown ) STDMETHOD( AddDataReference )( THIS_ LPCSTR, CONST GUID* ) PURE; }; -////////////////////////////////////////////////////////////////////////////// -// ID3DXFileEnumObject /////////////////////////////////////////////////////// -////////////////////////////////////////////////////////////////////////////// +/* + * ID3DXFileEnumObject + */ #undef INTERFACE #define INTERFACE ID3DXFileEnumObject @@ -201,9 +201,9 @@ DECLARE_INTERFACE_( ID3DXFileEnumObject, IUnknown ) STDMETHOD( GetDataObjectByName )( THIS_ LPCSTR, ID3DXFileData** ) PURE; }; -////////////////////////////////////////////////////////////////////////////// -// ID3DXFileData ///////////////////////////////////////////////////////////// -////////////////////////////////////////////////////////////////////////////// +/* + * ID3DXFileData + */ #undef INTERFACE #define INTERFACE ID3DXFileData diff --git a/gfx/video_display_server.c b/gfx/video_display_server.c index 94c249190f..55baa165a2 100644 --- a/gfx/video_display_server.c +++ b/gfx/video_display_server.c @@ -74,3 +74,10 @@ bool video_display_server_set_window_progress(int progress, bool finished) return current_display_server->set_window_progress(current_display_server_data, progress, finished); return false; } + +bool video_display_server_set_window_decorations(bool on) +{ + if (current_display_server && current_display_server->set_window_decorations) + return current_display_server->set_window_decorations(current_display_server_data, on); + return false; +} diff --git a/gfx/video_display_server.h b/gfx/video_display_server.h index 3a193aec2d..4f93a55e15 100644 --- a/gfx/video_display_server.h +++ b/gfx/video_display_server.h @@ -29,6 +29,7 @@ typedef struct video_display_server void (*destroy)(void *data); bool (*set_window_opacity)(void *data, unsigned opacity); bool (*set_window_progress)(void *data, int progress, bool finished); + bool (*set_window_decorations)(void *data, bool on); const char *ident; } video_display_server_t; @@ -36,6 +37,7 @@ void* video_display_server_init(void); void video_display_server_destroy(void); bool video_display_server_set_window_opacity(unsigned opacity); bool video_display_server_set_window_progress(int progress, bool finished); +bool video_display_server_set_window_decorations(bool on); extern const video_display_server_t dispserv_win32; extern const video_display_server_t dispserv_x11; diff --git a/gfx/video_driver.c b/gfx/video_driver.c index 3b9a5a3e75..f7ec30896e 100644 --- a/gfx/video_driver.c +++ b/gfx/video_driver.c @@ -31,6 +31,8 @@ #include #include +#include "../menu/menu_shader.h" + #ifdef HAVE_CONFIG_H #include "../config.h" #endif @@ -597,8 +599,12 @@ static void video_context_driver_reset(void) { const char *video_driver = video_driver_get_ident(); - if(string_is_equal(video_driver, "d3d11")) + if(string_is_equal(video_driver, "d3d10")) + current_video_context_api = GFX_CTX_DIRECT3D10_API; + else if(string_is_equal(video_driver, "d3d11")) current_video_context_api = GFX_CTX_DIRECT3D11_API; + else if(string_is_equal(video_driver, "d3d12")) + current_video_context_api = GFX_CTX_DIRECT3D12_API; else if(string_is_equal(video_driver, "gx2")) current_video_context_api = GFX_CTX_GX2_API; } @@ -672,9 +678,11 @@ retro_proc_address_t video_driver_get_proc_address(const char *sym) bool video_driver_set_shader(enum rarch_shader_type type, const char *path) { + bool ret = false; if (current_video->set_shader) - return current_video->set_shader(video_driver_data, type, path); - return false; + ret = current_video->set_shader(video_driver_data, type, path); + + return ret; } static void video_driver_filter_free(void) @@ -1303,26 +1311,31 @@ bool video_monitor_fps_statistics(double *refresh_rate, double *deviation, unsigned *sample_points) { unsigned i; - retro_time_t accum = 0, avg, accum_var = 0; - unsigned samples = MIN(MEASURE_FRAME_TIME_SAMPLES_COUNT, - (unsigned)video_driver_frame_time_count); + retro_time_t accum = 0; + retro_time_t avg = 0; + retro_time_t accum_var = 0; + unsigned samples = 0; + #ifdef HAVE_THREADS if (video_driver_is_threaded()) return false; #endif + samples = MIN(MEASURE_FRAME_TIME_SAMPLES_COUNT, + (unsigned)video_driver_frame_time_count); + if (samples < 2) return false; /* Measure statistics on frame time (microsecs), *not* FPS. */ for (i = 0; i < samples; i++) + { accum += video_driver_frame_time_samples[i]; - #if 0 - for (i = 0; i < samples; i++) RARCH_LOG("[Video]: Interval #%u: %d usec / frame.\n", i, (int)frame_time_samples[i]); #endif + } avg = accum / samples; @@ -1330,7 +1343,7 @@ bool video_monitor_fps_statistics(double *refresh_rate, for (i = 0; i < samples; i++) { retro_time_t diff = video_driver_frame_time_samples[i] - avg; - accum_var += diff * diff; + accum_var += diff * diff; } *deviation = sqrt((double)accum_var / (samples - 1)) / avg; diff --git a/gfx/video_driver.h b/gfx/video_driver.h index c134c48d77..564225e141 100644 --- a/gfx/video_driver.h +++ b/gfx/video_driver.h @@ -43,7 +43,7 @@ #define RARCH_SCALE_BASE 256 -#if defined(HAVE_CG) || defined(HAVE_HLSL) || defined(HAVE_GLSL) || defined(HAVE_SLANG) || defined(HAVE_D3D11) +#if defined(HAVE_CG) || defined(HAVE_HLSL) || defined(HAVE_GLSL) || defined(HAVE_SLANG) #ifndef HAVE_SHADER_MANAGER #define HAVE_SHADER_MANAGER #endif @@ -97,11 +97,13 @@ enum gfx_ctx_api GFX_CTX_OPENGL_ES_API, GFX_CTX_DIRECT3D8_API, GFX_CTX_DIRECT3D9_API, + GFX_CTX_DIRECT3D10_API, GFX_CTX_DIRECT3D11_API, + GFX_CTX_DIRECT3D12_API, GFX_CTX_OPENVG_API, GFX_CTX_VULKAN_API, GFX_CTX_GDI_API, - GFX_CTX_GX2_API, + GFX_CTX_GX2_API }; enum display_metric_types @@ -800,10 +802,6 @@ typedef struct video_driver typedef struct d3d_renderchain_driver { - void (*set_mvp)(void *data, - void *chain_data, - void *shader_data, - const void *mat_data); void (*chain_free)(void *data); void *(*chain_new)(void); bool (*init)(void *data, diff --git a/gfx/video_shader_parse.c b/gfx/video_shader_parse.c index 92daf520ae..348c3d1c61 100644 --- a/gfx/video_shader_parse.c +++ b/gfx/video_shader_parse.c @@ -35,7 +35,7 @@ #include "../frontend/frontend_driver.h" #include "video_shader_parse.h" -#ifdef HAVE_SLANG +#if defined(HAVE_SLANG) && defined(HAVE_SPIRV_CROSS) #include "drivers_shader/slang_preprocess.h" #endif @@ -144,7 +144,7 @@ static bool video_shader_parse_pass(config_file_t *conf, char frame_count_mod[64]; size_t path_size = PATH_MAX_LENGTH * sizeof(char); char *tmp_str = (char*)malloc(PATH_MAX_LENGTH * sizeof(char)); - char *tmp_path = (char*)malloc(PATH_MAX_LENGTH * sizeof(char)); + char *tmp_path = NULL; struct gfx_fbo_scale *scale = NULL; bool tmp_bool = false; float fattr = 0.0f; @@ -165,6 +165,7 @@ static bool video_shader_parse_pass(config_file_t *conf, goto error; } + tmp_path = (char*)malloc(PATH_MAX_LENGTH * sizeof(char)); strlcpy(tmp_path, tmp_str, path_size); path_resolve_realpath(tmp_path, path_size); @@ -172,6 +173,7 @@ static bool video_shader_parse_pass(config_file_t *conf, strlcpy(pass->source.path, tmp_str, sizeof(pass->source.path)); else strlcpy(pass->source.path, tmp_path, sizeof(pass->source.path)); + free(tmp_path); /* Smooth */ snprintf(filter_name_buf, sizeof(filter_name_buf), "filter_linear%u", i); @@ -329,12 +331,10 @@ static bool video_shader_parse_pass(config_file_t *conf, } free(tmp_str); - free(tmp_path); return true; error: free(tmp_str); - free(tmp_path); return false; } @@ -354,14 +354,12 @@ static bool video_shader_parse_textures(config_file_t *conf, const char *id = NULL; char *save = NULL; char *textures = (char*)malloc(1024 * sizeof(char)); - char *tmp_path = (char*)malloc(PATH_MAX_LENGTH * sizeof(char)); - textures[0] = '\0'; + textures[0] = '\0'; if (!config_get_array(conf, "textures", textures, 1024 * sizeof(char))) { free(textures); - free(tmp_path); return true; } @@ -375,6 +373,7 @@ static bool video_shader_parse_textures(config_file_t *conf, char id_mipmap[64]; bool mipmap = false; bool smooth = false; + char *tmp_path = NULL; id_filter[0] = id_wrap[0] = wrap_mode[0] = id_mipmap[0] = '\0'; @@ -382,9 +381,12 @@ static bool video_shader_parse_textures(config_file_t *conf, sizeof(shader->lut[shader->luts].path))) { RARCH_ERR("Cannot find path to texture \"%s\" ...\n", id); - goto error; + free(textures); + return false; } + tmp_path = (char*)malloc(PATH_MAX_LENGTH * sizeof(char)); + tmp_path[0] = '\0'; strlcpy(tmp_path, shader->lut[shader->luts].path, path_size); path_resolve_realpath(tmp_path, path_size); @@ -394,6 +396,7 @@ static bool video_shader_parse_textures(config_file_t *conf, strlcpy(shader->lut[shader->luts].path, tmp_path, sizeof(shader->lut[shader->luts].path)); } + free(tmp_path); strlcpy(shader->lut[shader->luts].id, id, sizeof(shader->lut[shader->luts].id)); @@ -417,13 +420,7 @@ static bool video_shader_parse_textures(config_file_t *conf, } free(textures); - free(tmp_path); return true; - -error: - free(textures); - free(tmp_path); - return false; } /** @@ -464,17 +461,15 @@ bool video_shader_resolve_current_parameters(config_file_t *conf, struct video_shader *shader) { size_t param_size = 4096 * sizeof(char); - char *parameters = (char*)malloc(4096 * sizeof(char)); const char *id = NULL; + char *parameters = NULL; char *save = NULL; if (!conf) - { - free(parameters); return false; - } - parameters[0] = '\0'; + parameters = (char*)malloc(4096 * sizeof(char)); + parameters[0] = '\0'; /* Read in parameters which override the defaults. */ if (!config_get_array(conf, "parameters", @@ -529,25 +524,19 @@ bool video_shader_resolve_parameters(config_file_t *conf, { intfstream_t *file = NULL; size_t line_size = 4096 * sizeof(char); - char *line = (char*)malloc(4096 * sizeof(char)); + char *line = NULL; const char *path = shader->pass[i].source.path; if (string_is_empty(path)) - { - free(line); continue; - } -#ifdef HAVE_SLANG +#if defined(HAVE_SLANG) && defined(HAVE_SPIRV_CROSS) /* First try to use the more robust slang implementation to support #includes. */ /* FIXME: The check for slang can be removed if it's sufficiently tested for * GLSL/Cg as well, it should be the same implementation. */ if (string_is_equal(path_get_extension(path), "slang") && slang_preprocess_parse_parameters(shader->pass[i].source.path, shader)) - { - free(line); continue; - } /* If that doesn't work, fallback to the old path. * Ideally, we'd get rid of this path sooner or later. */ @@ -557,11 +546,9 @@ bool video_shader_resolve_parameters(config_file_t *conf, RETRO_VFS_FILE_ACCESS_HINT_NONE); if (!file) - { - free(line); continue; - } + line = (char*)malloc(4096 * sizeof(char)); line[0] = '\0'; while (shader->num_parameters < ARRAY_SIZE(shader->parameters) @@ -614,18 +601,17 @@ static bool video_shader_parse_imports(config_file_t *conf, struct video_shader *shader) { size_t path_size = PATH_MAX_LENGTH * sizeof(char); - char *imports = (char*)malloc(1024 * sizeof(char)); - char *tmp_str = (char*)malloc(PATH_MAX_LENGTH * sizeof(char)); const char *id = NULL; char *save = NULL; + char *tmp_str = NULL; + char *imports = (char*)malloc(1024 * sizeof(char)); - imports[0] = tmp_str[0] = '\0'; + imports[0] = '\0'; if (!config_get_array(conf, "imports", imports, 1024 * sizeof(char))) { free(imports); - free(tmp_str); return true; } @@ -730,18 +716,19 @@ static bool video_shader_parse_imports(config_file_t *conf, var->equal = equal; } + tmp_str = (char*)malloc(PATH_MAX_LENGTH * sizeof(char)); + tmp_str[0] = '\0'; if (config_get_path(conf, "import_script", tmp_str, path_size)) strlcpy(shader->script_path, tmp_str, sizeof(shader->script_path)); config_get_array(conf, "import_script_class", shader->script_class, sizeof(shader->script_class)); + free(tmp_str); free(imports); - free(tmp_str); return true; error: free(imports); - free(tmp_str); return false; } @@ -1175,6 +1162,7 @@ enum rarch_shader_type video_shader_parse_type(const char *path, return shader_type; break; case GFX_CTX_DIRECT3D11_API: + case GFX_CTX_DIRECT3D12_API: case GFX_CTX_VULKAN_API: case GFX_CTX_GX2_API: if (shader_type == RARCH_SHADER_SLANG) diff --git a/gfx/video_shader_parse.h b/gfx/video_shader_parse.h index fcffeb428b..988b5eed7d 100644 --- a/gfx/video_shader_parse.h +++ b/gfx/video_shader_parse.h @@ -42,6 +42,11 @@ RETRO_BEGIN_DECLS #define GFX_MAX_PARAMETERS 128 #endif +#ifndef GFX_MAX_FRAME_HISTORY +#define GFX_MAX_FRAME_HISTORY 128 +#endif + + enum rarch_shader_type { RARCH_SHADER_NONE = 0, @@ -62,7 +67,8 @@ enum { RARCH_FILTER_UNSPEC = 0, RARCH_FILTER_LINEAR, - RARCH_FILTER_NEAREST + RARCH_FILTER_NEAREST, + RARCH_FILTER_MAX }; enum gfx_wrap_type @@ -118,6 +124,7 @@ struct video_shader_pass bool mipmap; unsigned filter; unsigned frame_count_mod; + bool feedback; }; struct video_shader_lut @@ -149,6 +156,7 @@ struct video_shader /* If < 0, no feedback pass is used. Otherwise, * the FBO after pass #N is passed a texture to next frame. */ int feedback_pass; + int history_size; struct video_shader_pass pass[GFX_MAX_SHADERS]; diff --git a/griffin/griffin.c b/griffin/griffin.c index 7243b2fbcc..602764cf15 100644 --- a/griffin/griffin.c +++ b/griffin/griffin.c @@ -14,6 +14,7 @@ * If not, see . */ +#define CINTERFACE #define HAVE_IBXM 1 #if defined(HAVE_CG) || defined(HAVE_HLSL) || defined(HAVE_GLSL) @@ -516,6 +517,10 @@ FONTS #include "../gfx/drivers_font/d3d11_font.c" #endif +#if defined(HAVE_D3D12) +#include "../gfx/drivers_font/d3d12_font.c" +#endif + /*============================================================ INPUT ============================================================ */ @@ -994,6 +999,7 @@ RETROARCH #include "../intl/msg_hash_vn.c" #include "../intl/msg_hash_chs.c" #include "../intl/msg_hash_cht.c" +#include "../intl/msg_hash_ar.c" #endif #include "../intl/msg_hash_us.c" @@ -1166,6 +1172,10 @@ MENU #include "../menu/drivers_display/menu_display_d3d11.c" #endif +#if defined(HAVE_D3D12) +#include "../menu/drivers_display/menu_display_d3d12.c" +#endif + #ifdef HAVE_OPENGL #include "../menu/drivers_display/menu_display_gl.c" #endif diff --git a/griffin/griffin_cpp.cpp b/griffin/griffin_cpp.cpp index e7df644b0b..9d5ccf3702 100644 --- a/griffin/griffin_cpp.cpp +++ b/griffin/griffin_cpp.cpp @@ -26,72 +26,6 @@ #include #endif -#ifdef WANT_GLSLANG -#ifdef HAVE_VULKAN -#include "../deps/glslang/glslang.cpp" -#if 0 -#include "../deps/glslang/glslang_tab.cpp" -#endif -#include "../deps/glslang/glslang/SPIRV/disassemble.cpp" -#include "../deps/glslang/glslang/SPIRV/doc.cpp" -#include "../deps/glslang/glslang/SPIRV/GlslangToSpv.cpp" -#include "../deps/glslang/glslang/SPIRV/InReadableOrder.cpp" -#include "../deps/glslang/glslang/SPIRV/Logger.cpp" -#include "../deps/glslang/glslang/SPIRV/SpvBuilder.cpp" -#include "../deps/glslang/glslang/SPIRV/SPVRemapper.cpp" - -#include "../deps/glslang/glslang/glslang/GenericCodeGen/CodeGen.cpp" -#include "../deps/glslang/glslang/glslang/GenericCodeGen/Link.cpp" - -#include "../deps/glslang/glslang/OGLCompilersDLL/InitializeDll.cpp" - -#include "../deps/glslang/glslang/glslang/MachineIndependent/Constant.cpp" -#include "../deps/glslang/glslang/glslang/MachineIndependent/glslang_tab.cpp" -#include "../deps/glslang/glslang/glslang/MachineIndependent/InfoSink.cpp" -#include "../deps/glslang/glslang/glslang/MachineIndependent/Initialize.cpp" -#include "../deps/glslang/glslang/glslang/MachineIndependent/Intermediate.cpp" -#include "../deps/glslang/glslang/glslang/MachineIndependent/intermOut.cpp" -#include "../deps/glslang/glslang/glslang/MachineIndependent/IntermTraverse.cpp" -#include "../deps/glslang/glslang/glslang/MachineIndependent/iomapper.cpp" -#include "../deps/glslang/glslang/glslang/MachineIndependent/limits.cpp" -#include "../deps/glslang/glslang/glslang/MachineIndependent/linkValidate.cpp" -#include "../deps/glslang/glslang/glslang/MachineIndependent/parseConst.cpp" -#include "../deps/glslang/glslang/glslang/MachineIndependent/ParseContextBase.cpp" -#include "../deps/glslang/glslang/glslang/MachineIndependent/ParseHelper.cpp" -#include "../deps/glslang/glslang/glslang/MachineIndependent/PoolAlloc.cpp" -#include "../deps/glslang/glslang/glslang/MachineIndependent/propagateNoContraction.cpp" -#include "../deps/glslang/glslang/glslang/MachineIndependent/reflection.cpp" -#include "../deps/glslang/glslang/glslang/MachineIndependent/RemoveTree.cpp" -#include "../deps/glslang/glslang/glslang/MachineIndependent/Scan.cpp" -#include "../deps/glslang/glslang/glslang/MachineIndependent/ShaderLang.cpp" -#include "../deps/glslang/glslang/glslang/MachineIndependent/SymbolTable.cpp" -#include "../deps/glslang/glslang/glslang/MachineIndependent/Versions.cpp" - -#include "../deps/glslang/glslang/glslang/MachineIndependent/preprocessor/Pp.cpp" -#include "../deps/glslang/glslang/glslang/MachineIndependent/preprocessor/PpAtom.cpp" -#include "../deps/glslang/glslang/glslang/MachineIndependent/preprocessor/PpContext.cpp" -#include "../deps/glslang/glslang/glslang/MachineIndependent/preprocessor/PpMemory.cpp" -#include "../deps/glslang/glslang/glslang/MachineIndependent/preprocessor/PpScanner.cpp" -#include "../deps/glslang/glslang/glslang/MachineIndependent/preprocessor/PpSymbols.cpp" -#include "../deps/glslang/glslang/glslang/MachineIndependent/preprocessor/PpTokens.cpp" - -#include "../deps/glslang/glslang/hlsl/hlslAttributes.cpp" -#include "../deps/glslang/glslang/hlsl/hlslGrammar.cpp" -#include "../deps/glslang/glslang/hlsl/hlslOpMap.cpp" -#include "../deps/glslang/glslang/hlsl/hlslParseables.cpp" -#include "../deps/glslang/glslang/hlsl/hlslParseHelper.cpp" -#include "../deps/glslang/glslang/hlsl/hlslScanContext.cpp" -#include "../deps/glslang/glslang/hlsl/hlslTokenStream.cpp" -#ifdef _WIN32 -#include "../deps/glslang/glslang/glslang/OSDependent/Windows/ossource.cpp" -#endif - -#if defined(__linux__) && !defined(ANDROID) -#include "../deps/glslang/glslang/glslang/OSDependent/Unix/ossource.cpp" -#endif -#endif -#endif - /*============================================================ MENU ============================================================ */ @@ -120,11 +54,20 @@ VIDEO DRIVER ============================================================ */ #ifdef HAVE_VULKAN #include "../gfx/drivers_shader/shader_vulkan.cpp" -#include "../gfx/drivers_shader/glslang_util.cpp" -#include "../gfx/drivers_shader/slang_reflection.cpp" -#include "../gfx/drivers_shader/slang_preprocess.cpp" +#endif + +#ifdef HAVE_SPIRV_CROSS #include "../deps/SPIRV-Cross/spirv_cross.cpp" #include "../deps/SPIRV-Cross/spirv_cfg.cpp" +#include "../deps/SPIRV-Cross/spirv_glsl.cpp" +#include "../deps/SPIRV-Cross/spirv_hlsl.cpp" +#include "../deps/SPIRV-Cross/spirv_msl.cpp" +#ifdef HAVE_SLANG +#include "../gfx/drivers_shader/glslang_util.cpp" +#include "../gfx/drivers_shader/slang_preprocess.cpp" +#include "../gfx/drivers_shader/slang_process.cpp" +#include "../gfx/drivers_shader/slang_reflection.cpp" +#endif #endif /*============================================================ @@ -133,3 +76,13 @@ FONTS #if defined(_XBOX360) #include "../gfx/drivers_font/xdk360_fonts.cpp" #endif + +#ifdef WANT_GLSLANG +#ifdef _WIN32 +#include "../deps/glslang/glslang/glslang/OSDependent/Windows/ossource.cpp" +#endif + +#if defined(__linux__) +#include "../deps/glslang/glslang/glslang/OSDependent/Unix/ossource.cpp" +#endif +#endif diff --git a/griffin/griffin_glslang.cpp b/griffin/griffin_glslang.cpp new file mode 100644 index 0000000000..44c33866d6 --- /dev/null +++ b/griffin/griffin_glslang.cpp @@ -0,0 +1,61 @@ + +#ifdef WANT_GLSLANG +#ifdef _MSC_VER +#include +#ifdef strtoull +#undef strtoull +#endif +#endif + +#include "../deps/glslang/glslang.cpp" +#include "../deps/glslang/glslang/SPIRV/disassemble.cpp" +#include "../deps/glslang/glslang/SPIRV/doc.cpp" +#include "../deps/glslang/glslang/SPIRV/GlslangToSpv.cpp" +#include "../deps/glslang/glslang/SPIRV/InReadableOrder.cpp" +#include "../deps/glslang/glslang/SPIRV/Logger.cpp" +#include "../deps/glslang/glslang/SPIRV/SpvBuilder.cpp" +#include "../deps/glslang/glslang/SPIRV/SPVRemapper.cpp" + +#include "../deps/glslang/glslang/glslang/GenericCodeGen/CodeGen.cpp" +#include "../deps/glslang/glslang/glslang/GenericCodeGen/Link.cpp" + +#include "../deps/glslang/glslang/OGLCompilersDLL/InitializeDll.cpp" + +#include "../deps/glslang/glslang/glslang/MachineIndependent/Constant.cpp" +#include "../deps/glslang/glslang/glslang/MachineIndependent/glslang_tab.cpp" +#include "../deps/glslang/glslang/glslang/MachineIndependent/InfoSink.cpp" +#include "../deps/glslang/glslang/glslang/MachineIndependent/Initialize.cpp" +#include "../deps/glslang/glslang/glslang/MachineIndependent/Intermediate.cpp" +#include "../deps/glslang/glslang/glslang/MachineIndependent/intermOut.cpp" +#include "../deps/glslang/glslang/glslang/MachineIndependent/IntermTraverse.cpp" +#include "../deps/glslang/glslang/glslang/MachineIndependent/iomapper.cpp" +#include "../deps/glslang/glslang/glslang/MachineIndependent/limits.cpp" +#include "../deps/glslang/glslang/glslang/MachineIndependent/linkValidate.cpp" +#include "../deps/glslang/glslang/glslang/MachineIndependent/parseConst.cpp" +#include "../deps/glslang/glslang/glslang/MachineIndependent/ParseContextBase.cpp" +#include "../deps/glslang/glslang/glslang/MachineIndependent/ParseHelper.cpp" +#include "../deps/glslang/glslang/glslang/MachineIndependent/PoolAlloc.cpp" +#include "../deps/glslang/glslang/glslang/MachineIndependent/propagateNoContraction.cpp" +#include "../deps/glslang/glslang/glslang/MachineIndependent/reflection.cpp" +#include "../deps/glslang/glslang/glslang/MachineIndependent/RemoveTree.cpp" +#include "../deps/glslang/glslang/glslang/MachineIndependent/Scan.cpp" +#include "../deps/glslang/glslang/glslang/MachineIndependent/ShaderLang.cpp" +#include "../deps/glslang/glslang/glslang/MachineIndependent/SymbolTable.cpp" +#include "../deps/glslang/glslang/glslang/MachineIndependent/Versions.cpp" + +#include "../deps/glslang/glslang/glslang/MachineIndependent/preprocessor/Pp.cpp" +#include "../deps/glslang/glslang/glslang/MachineIndependent/preprocessor/PpAtom.cpp" +#include "../deps/glslang/glslang/glslang/MachineIndependent/preprocessor/PpContext.cpp" +#include "../deps/glslang/glslang/glslang/MachineIndependent/preprocessor/PpMemory.cpp" +#include "../deps/glslang/glslang/glslang/MachineIndependent/preprocessor/PpScanner.cpp" +#include "../deps/glslang/glslang/glslang/MachineIndependent/preprocessor/PpSymbols.cpp" +#include "../deps/glslang/glslang/glslang/MachineIndependent/preprocessor/PpTokens.cpp" + +#include "../deps/glslang/glslang/hlsl/hlslAttributes.cpp" +#include "../deps/glslang/glslang/hlsl/hlslGrammar.cpp" +#include "../deps/glslang/glslang/hlsl/hlslOpMap.cpp" +#include "../deps/glslang/glslang/hlsl/hlslParseables.cpp" +#include "../deps/glslang/glslang/hlsl/hlslParseHelper.cpp" +#include "../deps/glslang/glslang/hlsl/hlslScanContext.cpp" +#include "../deps/glslang/glslang/hlsl/hlslTokenStream.cpp" +#endif diff --git a/input/drivers/udev_input.c b/input/drivers/udev_input.c index bcdacb60a6..b7de9b7253 100644 --- a/input/drivers/udev_input.c +++ b/input/drivers/udev_input.c @@ -776,6 +776,8 @@ static int16_t udev_lightgun_aiming_state(udev_input_t *udev, unsigned port, uns int16_t res_screen_x = 0; int16_t res_screen_y = 0; + udev_input_mouse_t *mouse = udev_get_mouse(udev, port); + vp.x = 0; vp.y = 0; vp.width = 0; @@ -783,8 +785,6 @@ static int16_t udev_lightgun_aiming_state(udev_input_t *udev, unsigned port, uns vp.full_width = 0; vp.full_height = 0; - udev_input_mouse_t *mouse = udev_get_mouse(udev, port); - if (!mouse) return 0; diff --git a/intl/msg_hash_ar.c b/intl/msg_hash_ar.c new file mode 100644 index 0000000000..ab9d5ba34a --- /dev/null +++ b/intl/msg_hash_ar.c @@ -0,0 +1,2079 @@ +/* RetroArch - A frontend for libretro. + * Copyright (C) 2011-2017 - Daniel De Matteis + * Copyright (C) 2016-2017 - Brad Parker + * + * RetroArch is free software: you can redistribute it and/or modify it under the terms + * of the GNU General Public License as published by the Free Software Found- + * ation, either version 3 of the License, or (at your option) any later version. + * + * RetroArch is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR + * PURPOSE. See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with RetroArch. + * If not, see . + */ + +#include +#include +#include + +#include +#include + +#include "../msg_hash.h" +#include "../configuration.h" +#include "../verbosity.h" + +#if defined(_MSC_VER) && !defined(_XBOX) +/* https://support.microsoft.com/en-us/kb/980263 */ +#pragma execution_character_set("utf-8") +#pragma warning(disable: 4566) +#endif + +int menu_hash_get_help_ar_enum(enum msg_hash_enums msg, char *s, size_t len) +{ + settings_t *settings = config_get_ptr(); + + if (msg == MENU_ENUM_LABEL_CONNECT_NETPLAY_ROOM) + { + snprintf(s, len, + "TODO/FIXME - Fill in message here." + ); + return 0; + } + if (msg <= MENU_ENUM_LABEL_INPUT_HOTKEY_BIND_END && + msg >= MENU_ENUM_LABEL_INPUT_HOTKEY_BIND_BEGIN) + { + unsigned idx = msg - MENU_ENUM_LABEL_INPUT_HOTKEY_BIND_BEGIN; + + switch (idx) + { + case RARCH_FAST_FORWARD_KEY: + snprintf(s, len, + "Toggles between fast-forwarding and \n" + "normal speed." + ); + break; + case RARCH_FAST_FORWARD_HOLD_KEY: + snprintf(s, len, + "Hold for fast-forward. \n" + " \n" + "Releasing button disables fast-forward." + ); + break; + case RARCH_PAUSE_TOGGLE: + snprintf(s, len, + "Toggle between paused and non-paused state."); + break; + case RARCH_FRAMEADVANCE: + snprintf(s, len, + "Frame advance when content is paused."); + break; + case RARCH_SHADER_NEXT: + snprintf(s, len, + "Applies next shader in directory."); + break; + case RARCH_SHADER_PREV: + snprintf(s, len, + "Applies previous shader in directory."); + break; + case RARCH_CHEAT_INDEX_PLUS: + case RARCH_CHEAT_INDEX_MINUS: + case RARCH_CHEAT_TOGGLE: + snprintf(s, len, + "Cheats."); + break; + case RARCH_RESET: + snprintf(s, len, + "Reset the content."); + break; + case RARCH_SCREENSHOT: + snprintf(s, len, + "Take screenshot."); + break; + case RARCH_MUTE: + snprintf(s, len, + "Mute/unmute audio."); + break; + case RARCH_OSK: + snprintf(s, len, + "Toggles onscreen keyboard."); + break; + case RARCH_NETPLAY_GAME_WATCH: + snprintf(s, len, + "Netplay toggle play/spectate mode."); + break; + case RARCH_SLOWMOTION: + snprintf(s, len, + "Hold for slowmotion."); + break; + case RARCH_ENABLE_HOTKEY: + snprintf(s, len, + "Enable other hotkeys. \n" + " \n" + "If this hotkey is bound to either\n" + "a keyboard, joybutton or joyaxis, \n" + "all other hotkeys will be enabled only \n" + "if this one is held at the same time. \n" + " \n" + "Alternatively, all hotkeys for keyboard \n" + "could be disabled by the user."); + break; + case RARCH_VOLUME_UP: + snprintf(s, len, + "Increases audio volume."); + break; + case RARCH_VOLUME_DOWN: + snprintf(s, len, + "Decreases audio volume."); + break; + case RARCH_OVERLAY_NEXT: + snprintf(s, len, + "Switches to next overlay. Wraps around."); + break; + case RARCH_DISK_EJECT_TOGGLE: + snprintf(s, len, + "Toggles eject for disks. \n" + " \n" + "Used for multiple-disk content. "); + break; + case RARCH_DISK_NEXT: + case RARCH_DISK_PREV: + snprintf(s, len, + "Cycles through disk images. Use after ejecting. \n" + " \n" + "Complete by toggling eject again."); + break; + case RARCH_GRAB_MOUSE_TOGGLE: + snprintf(s, len, + "Toggles mouse grab. \n" + " \n" + "When mouse is grabbed, RetroArch hides the \n" + "mouse, and keeps the mouse pointer inside \n" + "the window to allow relative mouse input to \n" + "work better."); + break; + case RARCH_GAME_FOCUS_TOGGLE: + snprintf(s, len, + "Toggles game focus.\n" + " \n" + "When a game has focus, RetroArch will both disable \n" + "hotkeys and keep/warp the mouse pointer inside the window."); + break; + case RARCH_MENU_TOGGLE: + snprintf(s, len, "Toggles menu."); + break; + case RARCH_LOAD_STATE_KEY: + snprintf(s, len, + "Loads state."); + break; + case RARCH_FULLSCREEN_TOGGLE_KEY: + snprintf(s, len, + "Toggles fullscreen."); + break; + case RARCH_QUIT_KEY: + snprintf(s, len, + "Key to exit RetroArch cleanly. \n" + " \n" + "Killing it in any hard way (SIGKILL, etc.) will \n" + "terminate RetroArch without saving RAM, etc." +#ifdef __unix__ + "\nOn Unix-likes, SIGINT/SIGTERM allows a clean \n" + "deinitialization." +#endif + ""); + break; + case RARCH_STATE_SLOT_PLUS: + case RARCH_STATE_SLOT_MINUS: + snprintf(s, len, + "State slots. \n" + " \n" + "With slot set to 0, save state name is \n" + "*.state (or whatever defined on commandline). \n" + " \n" + "When slot is not 0, path will be , \n" + "where is slot number."); + break; + case RARCH_SAVE_STATE_KEY: + snprintf(s, len, + "Saves state."); + break; + case RARCH_REWIND: + snprintf(s, len, + "Hold button down to rewind. \n" + " \n" + "Rewinding must be enabled."); + break; + case RARCH_MOVIE_RECORD_TOGGLE: + snprintf(s, len, + "Toggle between recording and not."); + break; + default: + if (string_is_empty(s)) + strlcpy(s, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_NO_INFORMATION_AVAILABLE), len); + break; + } + + return 0; + } + + switch (msg) + { + case MENU_ENUM_LABEL_ACCOUNTS_RETRO_ACHIEVEMENTS: + snprintf(s, len, "Login details for your \n" + "Retro Achievements account. \n" + " \n" + "Visit retroachievements.org and sign up \n" + "for a free account. \n" + " \n" + "After you are done registering, you need \n" + "to input the username and password into \n" + "RetroArch."); + break; + case MENU_ENUM_LABEL_CHEEVOS_USERNAME: + snprintf(s, len, "Username for your Retro Achievements account."); + break; + case MENU_ENUM_LABEL_CHEEVOS_PASSWORD: + snprintf(s, len, "Password for your Retro Achievements account."); + break; + case MENU_ENUM_LABEL_USER_LANGUAGE: + snprintf(s, len, "Localizes the menu and all onscreen messages \n" + "according to the language you have selected \n" + "here. \n" + " \n" + "Requires a restart for the changes \n" + "to take effect. \n" + " \n" + "Note: not all languages might be currently \n" + "implemented. \n" + " \n" + "In case a language is not implemented, \n" + "we fallback to English."); + break; + case MENU_ENUM_LABEL_VIDEO_FONT_PATH: + snprintf(s, len, "Change the font that is used \n" + "for the Onscreen Display text."); + break; + case MENU_ENUM_LABEL_GAME_SPECIFIC_OPTIONS: + snprintf(s, len, "Automatically load content-specific core options."); + break; + case MENU_ENUM_LABEL_AUTO_OVERRIDES_ENABLE: + snprintf(s, len, "Automatically load override configurations."); + break; + case MENU_ENUM_LABEL_AUTO_REMAPS_ENABLE: + snprintf(s, len, "Automatically load input remapping files."); + break; + case MENU_ENUM_LABEL_SORT_SAVESTATES_ENABLE: + snprintf(s, len, "Sort save states in folders \n" + "named after the libretro core used."); + break; + case MENU_ENUM_LABEL_SORT_SAVEFILES_ENABLE: + snprintf(s, len, "Sort save files in folders \n" + "named after the libretro core used."); + break; + case MENU_ENUM_LABEL_RESUME_CONTENT: + snprintf(s, len, "Exits from the menu and returns back \n" + "to the content."); + break; + case MENU_ENUM_LABEL_RESTART_CONTENT: + snprintf(s, len, "Restarts the content from the beginning."); + break; + case MENU_ENUM_LABEL_CLOSE_CONTENT: + snprintf(s, len, "Closes the content and unloads it from \n" + "memory."); + break; + case MENU_ENUM_LABEL_UNDO_LOAD_STATE: + snprintf(s, len, "If a state was loaded, content will \n" + "go back to the state prior to loading."); + break; + case MENU_ENUM_LABEL_UNDO_SAVE_STATE: + snprintf(s, len, "If a state was overwritten, it will \n" + "roll back to the previous save state."); + break; + case MENU_ENUM_LABEL_TAKE_SCREENSHOT: + snprintf(s, len, "Create a screenshot. \n" + " \n" + "The screenshot will be stored inside the \n" + "Screenshot Directory."); + break; + case MENU_ENUM_LABEL_ADD_TO_FAVORITES: + snprintf(s, len, "Add the entry to your Favorites."); + break; + case MENU_ENUM_LABEL_RUN: + snprintf(s, len, "Start the content."); + break; + case MENU_ENUM_LABEL_INFORMATION: + snprintf(s, len, "Show additional metadata information \n" + "about the content."); + break; + case MENU_ENUM_LABEL_FILE_BROWSER_CONFIG: + snprintf(s, len, "Configuration file."); + break; + case MENU_ENUM_LABEL_FILE_BROWSER_COMPRESSED_ARCHIVE: + snprintf(s, len, "Compressed archive file."); + break; + case MENU_ENUM_LABEL_FILE_BROWSER_RECORD_CONFIG: + snprintf(s, len, "Recording configuration file."); + break; + case MENU_ENUM_LABEL_FILE_BROWSER_CURSOR: + snprintf(s, len, "Database cursor file."); + break; + case MENU_ENUM_LABEL_FILE_CONFIG: + snprintf(s, len, "Configuration file."); + break; + case MENU_ENUM_LABEL_SCAN_THIS_DIRECTORY: + snprintf(s, len, + "Select this to scan the current directory \n" + "for content."); + break; + case MENU_ENUM_LABEL_USE_THIS_DIRECTORY: + snprintf(s, len, + "Select this to set this as the directory."); + break; + case MENU_ENUM_LABEL_CONTENT_DATABASE_DIRECTORY: + snprintf(s, len, + "Content Database Directory. \n" + " \n" + "Path to content database \n" + "directory."); + break; + case MENU_ENUM_LABEL_THUMBNAILS_DIRECTORY: + snprintf(s, len, + "Thumbnails Directory. \n" + " \n" + "To store thumbnail files."); + break; + case MENU_ENUM_LABEL_LIBRETRO_INFO_PATH: + snprintf(s, len, + "Core Info Directory. \n" + " \n" + "A directory for where to search \n" + "for libretro core information."); + break; + case MENU_ENUM_LABEL_PLAYLIST_DIRECTORY: + snprintf(s, len, + "Playlist Directory. \n" + " \n" + "Save all playlist files to this \n" + "directory."); + break; + case MENU_ENUM_LABEL_DUMMY_ON_CORE_SHUTDOWN: + snprintf(s, len, + "Some cores might have \n" + "a shutdown feature. \n" + " \n" + "If this option is left disabled, \n" + "selecting the shutdown procedure \n" + "would trigger RetroArch being shut \n" + "down. \n" + " \n" + "Enabling this option will load a \n" + "dummy core instead so that we remain \n" + "inside the menu and RetroArch won't \n" + "shutdown."); + break; + case MENU_ENUM_LABEL_CHECK_FOR_MISSING_FIRMWARE: + snprintf(s, len, + "Some cores might need \n" + "firmware or bios files. \n" + " \n" + "If this option is disabled, \n" + "it will try to load even if such \n" + "firmware is missing. \n"); + break; + case MENU_ENUM_LABEL_PARENT_DIRECTORY: + snprintf(s, len, + "Go back to the parent directory."); + break; + case MENU_ENUM_LABEL_FILE_BROWSER_SHADER_PRESET: + snprintf(s, len, + "Shader preset file."); + break; + case MENU_ENUM_LABEL_FILE_BROWSER_SHADER: + snprintf(s, len, + "Shader file."); + break; + case MENU_ENUM_LABEL_FILE_BROWSER_REMAP: + snprintf(s, len, + "Remap controls file."); + break; + case MENU_ENUM_LABEL_FILE_BROWSER_CHEAT: + snprintf(s, len, + "Cheat file."); + break; + case MENU_ENUM_LABEL_FILE_BROWSER_OVERLAY: + snprintf(s, len, + "Overlay file."); + break; + case MENU_ENUM_LABEL_FILE_BROWSER_RDB: + snprintf(s, len, + "Database file."); + break; + case MENU_ENUM_LABEL_FILE_BROWSER_FONT: + snprintf(s, len, + "TrueType font file."); + break; + case MENU_ENUM_LABEL_FILE_BROWSER_PLAIN_FILE: + snprintf(s, len, + "Plain file."); + break; + case MENU_ENUM_LABEL_FILE_BROWSER_MOVIE_OPEN: + snprintf(s, len, + "Video. \n" + " \n" + "Select it to open this file with the \n" + "video player."); + break; + case MENU_ENUM_LABEL_FILE_BROWSER_MUSIC_OPEN: + snprintf(s, len, + "Music. \n" + " \n" + "Select it to open this file with the \n" + "music player."); + break; + case MENU_ENUM_LABEL_FILE_BROWSER_IMAGE: + snprintf(s, len, + "Image file."); + break; + case MENU_ENUM_LABEL_FILE_BROWSER_IMAGE_OPEN_WITH_VIEWER: + snprintf(s, len, + "Image. \n" + " \n" + "Select it to open this file with the \n" + "image viewer."); + break; + case MENU_ENUM_LABEL_FILE_BROWSER_CORE_SELECT_FROM_COLLECTION: + snprintf(s, len, + "Libretro core. \n" + " \n" + "Selecting this will associate this core \n" + "to the game."); + break; + case MENU_ENUM_LABEL_FILE_BROWSER_CORE: + snprintf(s, len, + "Libretro core. \n" + " \n" + "Select this file to have RetroArch load this core."); + break; + case MENU_ENUM_LABEL_FILE_BROWSER_DIRECTORY: + snprintf(s, len, + "Directory. \n" + " \n" + "Select it to open this directory."); + break; + case MENU_ENUM_LABEL_CACHE_DIRECTORY: + snprintf(s, len, + "Cache Directory. \n" + " \n" + "Content decompressed by RetroArch will be \n" + "temporarily extracted to this directory."); + break; + case MENU_ENUM_LABEL_HISTORY_LIST_ENABLE: + snprintf(s, len, + "If enabled, every content loaded \n" + "in RetroArch will be automatically \n" + "added to the recent history list."); + break; + case MENU_ENUM_LABEL_RGUI_BROWSER_DIRECTORY: + snprintf(s, len, + "File Browser Directory. \n" + " \n" + "Sets start directory for menu file browser."); + break; + case MENU_ENUM_LABEL_INPUT_POLL_TYPE_BEHAVIOR: + snprintf(s, len, + "Influence how input polling is done inside \n" + "RetroArch. \n" + " \n" + "Early - Input polling is performed before \n" + "the frame is processed. \n" + "Normal - Input polling is performed when \n" + "polling is requested. \n" + "Late - Input polling is performed on \n" + "first input state request per frame.\n" + " \n" + "Setting it to 'Early' or 'Late' can result \n" + "in less latency, \n" + "depending on your configuration.\n\n" + "Will be ignored when using netplay." + ); + break; + case MENU_ENUM_LABEL_INPUT_DESCRIPTOR_HIDE_UNBOUND: + snprintf(s, len, + "Hide input descriptors that were not set \n" + "by the core."); + break; + case MENU_ENUM_LABEL_VIDEO_REFRESH_RATE: + snprintf(s, len, + "Video refresh rate of your monitor. \n" + "Used to calculate a suitable audio input rate."); + break; + case MENU_ENUM_LABEL_VIDEO_FORCE_SRGB_DISABLE: + snprintf(s, len, + "Forcibly disable sRGB FBO support. Some Intel \n" + "OpenGL drivers on Windows have video problems \n" + "with sRGB FBO support enabled."); + break; + case MENU_ENUM_LABEL_AUDIO_ENABLE: + snprintf(s, len, + "Enable audio output."); + break; + case MENU_ENUM_LABEL_AUDIO_SYNC: + snprintf(s, len, + "Synchronize audio (recommended)."); + break; + case MENU_ENUM_LABEL_AUDIO_LATENCY: + snprintf(s, len, + "Desired audio latency in milliseconds. \n" + "Might not be honored if the audio driver \n" + "can't provide given latency."); + break; + case MENU_ENUM_LABEL_VIDEO_ALLOW_ROTATE: + snprintf(s, len, + "Allow cores to set rotation. If false, \n" + "rotation requests are honored, but ignored.\n\n" + "Used for setups where one manually rotates \n" + "the monitor."); + break; + case MENU_ENUM_LABEL_INPUT_DESCRIPTOR_LABEL_SHOW: + snprintf(s, len, + "Show the input descriptors set by the core \n" + "instead of the default ones."); + break; + case MENU_ENUM_LABEL_CONTENT_HISTORY_SIZE: + snprintf(s, len, + "Number of entries that will be kept in \n" + "content history playlist."); + break; + case MENU_ENUM_LABEL_VIDEO_WINDOWED_FULLSCREEN: + snprintf(s, len, + "To use windowed mode or not when going \n" + "fullscreen."); + break; + case MENU_ENUM_LABEL_VIDEO_FONT_SIZE: + snprintf(s, len, + "Font size for on-screen messages."); + break; + case MENU_ENUM_LABEL_SAVESTATE_AUTO_INDEX: + snprintf(s, len, + "Automatically increment slot index on each save, \n" + "generating multiple savestate files. \n" + "When the content is loaded, state slot will be \n" + "set to the highest existing value (last savestate)."); + break; + case MENU_ENUM_LABEL_FPS_SHOW: + snprintf(s, len, + "Enables displaying the current frames \n" + "per second."); + break; + case MENU_ENUM_LABEL_VIDEO_FONT_ENABLE: + snprintf(s, len, + "Show and/or hide onscreen messages."); + break; + case MENU_ENUM_LABEL_VIDEO_MESSAGE_POS_X: + case MENU_ENUM_LABEL_VIDEO_MESSAGE_POS_Y: + snprintf(s, len, + "Offset for where messages will be placed \n" + "onscreen. Values are in range [0.0, 1.0]."); + break; + case MENU_ENUM_LABEL_INPUT_OVERLAY_ENABLE: + snprintf(s, len, + "Enable or disable the current overlay."); + break; + case MENU_ENUM_LABEL_INPUT_OVERLAY_HIDE_IN_MENU: + snprintf(s, len, + "Hide the current overlay from appearing \n" + "inside the menu."); + break; + case MENU_ENUM_LABEL_INPUT_OVERLAY_SHOW_PHYSICAL_INPUTS: + snprintf(s, len, + "Show keyboard/controller button presses on \n" + "the onscreen overlay."); + break; + case MENU_ENUM_LABEL_INPUT_OVERLAY_SHOW_PHYSICAL_INPUTS_PORT: + snprintf(s, len, + "Select the port to listen for controller input \n" + "to display on the onscreen overlay."); + break; + case MENU_ENUM_LABEL_OVERLAY_PRESET: + snprintf(s, len, + "Path to input overlay."); + break; + case MENU_ENUM_LABEL_OVERLAY_OPACITY: + snprintf(s, len, + "Overlay opacity."); + break; + case MENU_ENUM_LABEL_INPUT_BIND_TIMEOUT: + snprintf(s, len, + "Input bind timer timeout (in seconds). \n" + "Amount of seconds to wait until proceeding \n" + "to the next bind."); + break; + case MENU_ENUM_LABEL_OVERLAY_SCALE: + snprintf(s, len, + "Overlay scale."); + break; + case MENU_ENUM_LABEL_AUDIO_OUTPUT_RATE: + snprintf(s, len, + "Audio output samplerate."); + break; + case MENU_ENUM_LABEL_VIDEO_SHARED_CONTEXT: + snprintf(s, len, + "Set to true if hardware-rendered cores \n" + "should get their private context. \n" + "Avoids having to assume hardware state changes \n" + "inbetween frames." + ); + break; + case MENU_ENUM_LABEL_CORE_LIST: + snprintf(s, len, + "Load Core. \n" + " \n" + "Browse for a libretro core \n" + "implementation. Where the browser \n" + "starts depends on your Core Directory \n" + "path. If blank, it will start in root. \n" + " \n" + "If Core Directory is a directory, the menu \n" + "will use that as top folder. If Core \n" + "Directory is a full path, it will start \n" + "in the folder where the file is."); + break; + case MENU_ENUM_LABEL_VALUE_MENU_ENUM_CONTROLS_PROLOG: + snprintf(s, len, + "You can use the following controls below \n" + "on either your gamepad or keyboard in order\n" + "to control the menu: \n" + " \n" + ); + break; + case MENU_ENUM_LABEL_WELCOME_TO_RETROARCH: + snprintf(s, len, + "Welcome to RetroArch\n" + ); + break; + case MENU_ENUM_LABEL_VALUE_HELP_AUDIO_VIDEO_TROUBLESHOOTING_DESC: { + /* Work around C89 limitations */ + char u[501]; + const char *t = + "RetroArch relies on an unique form of\n" + "audio/video synchronization where it needs to be\n" + "calibrated against the refresh rate of your\n" + "display for best performance results.\n" + " \n" + "If you experience any audio crackling or video\n" + "tearing, usually it means that you need to\n" + "calibrate the settings. Some choices below:\n" + " \n"; + snprintf(u, sizeof(u), /* can't inline this due to the printf arguments */ + "a) Go to '%s' -> '%s', and enable\n" + "'Threaded Video'. Refresh rate will not matter\n" + "in this mode, framerate will be higher,\n" + "but video might be less smooth.\n" + "b) Go to '%s' -> '%s', and look at\n" + "'%s'. Let it run for\n" + "2048 frames, then press 'OK'.", + msg_hash_to_str(MENU_ENUM_LABEL_VALUE_SETTINGS), + msg_hash_to_str(MENU_ENUM_LABEL_VALUE_VIDEO_SETTINGS), + msg_hash_to_str(MENU_ENUM_LABEL_VALUE_SETTINGS), + msg_hash_to_str(MENU_ENUM_LABEL_VALUE_VIDEO_SETTINGS), + msg_hash_to_str(MENU_ENUM_LABEL_VALUE_VIDEO_REFRESH_RATE_AUTO)); + strlcpy(s, t, len); + strlcat(s, u, len); + } + break; + case MENU_ENUM_LABEL_VALUE_HELP_SCANNING_CONTENT_DESC: + snprintf(s, len, + "To scan for content, go to '%s' and\n" + "select either '%s' or %s'.\n" + " \n" + "Files will be compared to database entries.\n" + "If there is a match, it will add an entry\n" + "to a collection.\n" + " \n" + "You can then easily access this content by\n" + "going to '%s' ->\n" + "'%s'\n" + "instead of having to go through the\n" + "filebrowser everytime.\n" + " \n" + "NOTE: Content for some cores might still not be\n" + "scannable.", + msg_hash_to_str(MENU_ENUM_LABEL_VALUE_ADD_CONTENT_LIST), + msg_hash_to_str(MENU_ENUM_LABEL_VALUE_SCAN_DIRECTORY), + msg_hash_to_str(MENU_ENUM_LABEL_VALUE_SCAN_FILE), + msg_hash_to_str(MENU_ENUM_LABEL_VALUE_LOAD_CONTENT_LIST), + msg_hash_to_str(MENU_ENUM_LABEL_VALUE_CONTENT_COLLECTION_LIST) + ); + break; + case MENU_ENUM_LABEL_VALUE_EXTRACTING_PLEASE_WAIT: + snprintf(s, len, + "Welcome to RetroArch\n" + "\n" + "Extracting assets, please wait.\n" + "This might take a while...\n" + ); + break; + case MENU_ENUM_LABEL_INPUT_DRIVER: + { + const char *lbl = settings ? settings->arrays.input_driver : NULL; + + if (string_is_equal(lbl, msg_hash_to_str(MENU_ENUM_LABEL_INPUT_DRIVER_UDEV))) + snprintf(s, len, + "udev Input driver. \n" + " \n" + "It uses the recent evdev joypad API \n" + "for joystick support. It supports \n" + "hotplugging and force feedback. \n" + " \n" + "The driver reads evdev events for keyboard \n" + "support. It also supports keyboard callback, \n" + "mice and touchpads. \n" + " \n" + "By default in most distros, /dev/input nodes \n" + "are root-only (mode 600). You can set up a udev \n" + "rule which makes these accessible to non-root." + ); + else if (string_is_equal(lbl, msg_hash_to_str(MENU_ENUM_LABEL_INPUT_DRIVER_LINUXRAW))) + snprintf(s, len, + "linuxraw Input driver. \n" + " \n" + "This driver requires an active TTY. Keyboard \n" + "events are read directly from the TTY which \n" + "makes it simpler, but not as flexible as udev. \n" "Mice, etc, are not supported at all. \n" + " \n" + "This driver uses the older joystick API \n" + "(/dev/input/js*)."); + else + snprintf(s, len, + "Input driver.\n" + " \n" + "Depending on video driver, it might \n" + "force a different input driver."); + } + break; + case MENU_ENUM_LABEL_LOAD_CONTENT_LIST: + snprintf(s, len, + "Load Content. \n" + "Browse for content. \n" + " \n" + "To load content, you need a \n" + "'Core' to use, and a content file. \n" + " \n" + "To control where the menu starts \n" + "to browse for content, set \n" + "'File Browser Directory'. \n" + "If not set, it will start in root. \n" + " \n" + "The browser will filter out \n" + "extensions for the last core set \n" + "in 'Load Core', and use that core \n" + "when content is loaded." + ); + break; + case MENU_ENUM_LABEL_LOAD_CONTENT_HISTORY: + snprintf(s, len, + "Loading content from history. \n" + " \n" + "As content is loaded, content and libretro \n" + "core combinations are saved to history. \n" + " \n" + "The history is saved to a file in the same \n" + "directory as the RetroArch config file. If \n" + "no config file was loaded in startup, history \n" + "will not be saved or loaded, and will not exist \n" + "in the main menu." + ); + break; + case MENU_ENUM_LABEL_VIDEO_DRIVER: + snprintf(s, len, + "Current Video driver."); + + if (string_is_equal(settings->arrays.video_driver, "gl")) + { + snprintf(s, len, + "OpenGL Video driver. \n" + " \n" + "This driver allows libretro GL cores to \n" + "be used in addition to software-rendered \n" + "core implementations.\n" + " \n" + "Performance for software-rendered and \n" + "libretro GL core implementations is \n" + "dependent on your graphics card's \n" + "underlying GL driver)."); + } + else if (string_is_equal(settings->arrays.video_driver, "sdl2")) + { + snprintf(s, len, + "SDL 2 Video driver.\n" + " \n" + "This is an SDL 2 software-rendered video \n" + "driver.\n" + " \n" + "Performance for software-rendered libretro \n" + "core implementations is dependent \n" + "on your platform SDL implementation."); + } + else if (string_is_equal(settings->arrays.video_driver, "sdl1")) + { + snprintf(s, len, + "SDL Video driver.\n" + " \n" + "This is an SDL 1.2 software-rendered video \n" + "driver.\n" + " \n" + "Performance is considered to be suboptimal. \n" + "Consider using it only as a last resort."); + } + else if (string_is_equal(settings->arrays.video_driver, "d3d")) + { + snprintf(s, len, + "Direct3D Video driver. \n" + " \n" + "Performance for software-rendered cores \n" + "is dependent on your graphic card's \n" + "underlying D3D driver)."); + } + else if (string_is_equal(settings->arrays.video_driver, "exynos")) + { + snprintf(s, len, + "Exynos-G2D Video Driver. \n" + " \n" + "This is a low-level Exynos video driver. \n" + "Uses the G2D block in Samsung Exynos SoC \n" + "for blit operations. \n" + " \n" + "Performance for software rendered cores \n" + "should be optimal."); + } + else if (string_is_equal(settings->arrays.video_driver, "drm")) + { + snprintf(s, len, + "Plain DRM Video Driver. \n" + " \n" + "This is a low-level video driver using. \n" + "libdrm for hardware scaling using \n" + "GPU overlays."); + } + else if (string_is_equal(settings->arrays.video_driver, "sunxi")) + { + snprintf(s, len, + "Sunxi-G2D Video Driver. \n" + " \n" + "This is a low-level Sunxi video driver. \n" + "Uses the G2D block in Allwinner SoCs."); + } + break; + case MENU_ENUM_LABEL_AUDIO_DSP_PLUGIN: + snprintf(s, len, + "Audio DSP plugin.\n" + " Processes audio before it's sent to \n" + "the driver." + ); + break; + case MENU_ENUM_LABEL_AUDIO_RESAMPLER_DRIVER: + { + const char *lbl = settings ? settings->arrays.audio_resampler : NULL; + + if (string_is_equal(lbl, msg_hash_to_str(MENU_ENUM_LABEL_AUDIO_RESAMPLER_DRIVER_SINC))) + strlcpy(s, + "Windowed SINC implementation.", len); + else if (string_is_equal(lbl, msg_hash_to_str(MENU_ENUM_LABEL_AUDIO_RESAMPLER_DRIVER_CC))) + strlcpy(s, + "Convoluted Cosine implementation.", len); + else if (string_is_empty(s)) + strlcpy(s, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_NO_INFORMATION_AVAILABLE), len); + } + break; + case MENU_ENUM_LABEL_VIDEO_SHADER_PRESET: + snprintf(s, len, + "Load Shader Preset. \n" + " \n" + " Load a shader preset directly. \n" + "The menu shader menu is updated accordingly. \n" + " \n" + "If the CGP uses scaling methods which are not \n" + "simple, (i.e. source scaling, same scaling \n" + "factor for X/Y), the scaling factor displayed \n" + "in the menu might not be correct." + ); + break; + case MENU_ENUM_LABEL_VIDEO_SHADER_SCALE_PASS: + snprintf(s, len, + "Scale for this pass. \n" + " \n" + "The scale factor accumulates, i.e. 2x \n" + "for first pass and 2x for second pass \n" + "will give you a 4x total scale. \n" + " \n" + "If there is a scale factor for last \n" + "pass, the result is stretched to \n" + "screen with the filter specified in \n" + "'Default Filter'. \n" + " \n" + "If 'Don't Care' is set, either 1x \n" + "scale or stretch to fullscreen will \n" + "be used depending if it's not the last \n" + "pass or not." + ); + break; + case MENU_ENUM_LABEL_VIDEO_SHADER_NUM_PASSES: + snprintf(s, len, + "Shader Passes. \n" + " \n" + "RetroArch allows you to mix and match various \n" + "shaders with arbitrary shader passes, with \n" + "custom hardware filters and scale factors. \n" + " \n" + "This option specifies the number of shader \n" + "passes to use. If you set this to 0, and use \n" + "Apply Shader Changes, you use a 'blank' shader. \n" + " \n" + "The Default Filter option will affect the \n" + "stretching filter."); + break; + case MENU_ENUM_LABEL_VIDEO_SHADER_PARAMETERS: + snprintf(s, len, + "Shader Parameters. \n" + " \n" + "Modifies current shader directly. Will not be \n" + "saved to CGP/GLSLP preset file."); + break; + case MENU_ENUM_LABEL_VIDEO_SHADER_PRESET_PARAMETERS: + snprintf(s, len, + "Shader Preset Parameters. \n" + " \n" + "Modifies shader preset currently in menu." + ); + break; + case MENU_ENUM_LABEL_VIDEO_SHADER_PASS: + snprintf(s, len, + "Path to shader. \n" + " \n" + "All shaders must be of the same \n" + "type (i.e. CG, GLSL or HLSL). \n" + " \n" + "Set Shader Directory to set where \n" + "the browser starts to look for \n" + "shaders." + ); + break; + case MENU_ENUM_LABEL_CONFIGURATION_SETTINGS: + snprintf(s, len, + "Determines how configuration files \n" + "are loaded and prioritized."); + break; + case MENU_ENUM_LABEL_CONFIG_SAVE_ON_EXIT: + snprintf(s, len, + "Saves config to disk on exit.\n" + "Useful for menu as settings can be\n" + "modified. Overwrites the config.\n" + " \n" + "#include's and comments are not \n" + "preserved. \n" + " \n" + "By design, the config file is \n" + "considered immutable as it is \n" + "likely maintained by the user, \n" + "and should not be overwritten \n" + "behind the user's back." +#if defined(RARCH_CONSOLE) || defined(RARCH_MOBILE) + "\nThis is not not the case on \n" + "consoles however, where \n" + "looking at the config file \n" + "manually isn't really an option." +#endif + ); + break; + case MENU_ENUM_LABEL_CONFIRM_ON_EXIT: + snprintf(s, len, "Are you sure you want to quit?"); + break; + case MENU_ENUM_LABEL_SHOW_HIDDEN_FILES: + snprintf(s, len, "Show hidden files\n" + "and folders."); + break; + case MENU_ENUM_LABEL_VIDEO_SHADER_FILTER_PASS: + snprintf(s, len, + "Hardware filter for this pass. \n" + " \n" + "If 'Don't Care' is set, 'Default \n" + "Filter' will be used." + ); + break; + case MENU_ENUM_LABEL_AUTOSAVE_INTERVAL: + snprintf(s, len, + "Autosaves the non-volatile SRAM \n" + "at a regular interval.\n" + " \n" + "This is disabled by default unless set \n" + "otherwise. The interval is measured in \n" + "seconds. \n" + " \n" + "A value of 0 disables autosave."); + break; + case MENU_ENUM_LABEL_INPUT_BIND_DEVICE_TYPE: + snprintf(s, len, + "Input Device Type. \n" + " \n" + "Picks which device type to use. This is \n" + "relevant for the libretro core itself." + ); + break; + case MENU_ENUM_LABEL_LIBRETRO_LOG_LEVEL: + snprintf(s, len, + "Sets log level for libretro cores \n" + "(GET_LOG_INTERFACE). \n" + " \n" + " If a log level issued by a libretro \n" + " core is below libretro_log level, it \n" + " is ignored.\n" + " \n" + " DEBUG logs are always ignored unless \n" + " verbose mode is activated (--verbose).\n" + " \n" + " DEBUG = 0\n" + " INFO = 1\n" + " WARN = 2\n" + " ERROR = 3" + ); + break; + case MENU_ENUM_LABEL_STATE_SLOT_INCREASE: + case MENU_ENUM_LABEL_STATE_SLOT_DECREASE: + snprintf(s, len, + "State slots.\n" + " \n" + " With slot set to 0, save state name is *.state \n" + " (or whatever defined on commandline).\n" + "When slot is != 0, path will be (path)(d), \n" + "where (d) is slot number."); + break; + case MENU_ENUM_LABEL_SHADER_APPLY_CHANGES: + snprintf(s, len, + "Apply Shader Changes. \n" + " \n" + "After changing shader settings, use this to \n" + "apply changes. \n" + " \n" + "Changing shader settings is a somewhat \n" + "expensive operation so it has to be \n" + "done explicitly. \n" + " \n" + "When you apply shaders, the menu shader \n" + "settings are saved to a temporary file (either \n" + "menu.cgp or menu.glslp) and loaded. The file \n" + "persists after RetroArch exits. The file is \n" + "saved to Shader Directory." + ); + break; + case MENU_ENUM_LABEL_SHADER_WATCH_FOR_CHANGES: + snprintf(s, len, + "Watch shader files for new changes. \n" + " \n" + "After saving changes to a shader on disk, \n" + "it will automatically be recompiled \n" + "and applied to the running content." + ); + break; + case MENU_ENUM_LABEL_MENU_TOGGLE: + snprintf(s, len, + "Toggles menu."); + break; + case MENU_ENUM_LABEL_GRAB_MOUSE_TOGGLE: + snprintf(s, len, + "Toggles mouse grab.\n" + " \n" + "When mouse is grabbed, RetroArch hides the \n" + "mouse, and keeps the mouse pointer inside \n" + "the window to allow relative mouse input to \n" + "work better."); + break; + case MENU_ENUM_LABEL_GAME_FOCUS_TOGGLE: + snprintf(s, len, + "Toggles game focus.\n" + " \n" + "When a game has focus, RetroArch will both disable \n" + "hotkeys and keep/warp the mouse pointer inside the window."); + break; + case MENU_ENUM_LABEL_DISK_NEXT: + snprintf(s, len, + "Cycles through disk images. Use after \n" + "ejecting. \n" + " \n" + " Complete by toggling eject again."); + break; + case MENU_ENUM_LABEL_VIDEO_FILTER: +#ifdef HAVE_FILTERS_BUILTIN + snprintf(s, len, + "CPU-based video filter."); +#else + snprintf(s, len, + "CPU-based video filter.\n" + " \n" + "Path to a dynamic library."); +#endif + break; + case MENU_ENUM_LABEL_AUDIO_DEVICE: + snprintf(s, len, + "Override the default audio device \n" + "the audio driver uses.\n" + "This is driver dependent. E.g.\n" +#ifdef HAVE_ALSA + " \n" + "ALSA wants a PCM device." +#endif +#ifdef HAVE_OSS + " \n" + "OSS wants a path (e.g. /dev/dsp)." +#endif +#ifdef HAVE_JACK + " \n" + "JACK wants portnames (e.g. system:playback1\n" + ",system:playback_2)." +#endif +#ifdef HAVE_RSOUND + " \n" + "RSound wants an IP address to an RSound \n" + "server." +#endif + ); + break; + case MENU_ENUM_LABEL_DISK_EJECT_TOGGLE: + snprintf(s, len, + "Toggles eject for disks.\n" + " \n" + "Used for multiple-disk content."); + break; + case MENU_ENUM_LABEL_ENABLE_HOTKEY: + snprintf(s, len, + "Enable other hotkeys.\n" + " \n" + " If this hotkey is bound to either keyboard, \n" + "joybutton or joyaxis, all other hotkeys will \n" + "be disabled unless this hotkey is also held \n" + "at the same time. \n" + " \n" + "This is useful for RETRO_KEYBOARD centric \n" + "implementations which query a large area of \n" + "the keyboard, where it is not desirable that \n" + "hotkeys get in the way."); + break; + case MENU_ENUM_LABEL_REWIND_ENABLE: + snprintf(s, len, + "Enable rewinding.\n" + " \n" + "This will take a performance hit, \n" + "so it is disabled by default."); + break; + case MENU_ENUM_LABEL_LIBRETRO_DIR_PATH: + snprintf(s, len, + "Core Directory. \n" + " \n" + "A directory for where to search for \n" + "libretro core implementations."); + break; + case MENU_ENUM_LABEL_VIDEO_REFRESH_RATE_AUTO: + snprintf(s, len, + "Refresh Rate Auto.\n" + " \n" + "The accurate refresh rate of our monitor (Hz).\n" + "This is used to calculate audio input rate with \n" + "the formula: \n" + " \n" + "audio_input_rate = game input rate * display \n" + "refresh rate / game refresh rate\n" + " \n" + "If the implementation does not report any \n" + "values, NTSC defaults will be assumed for \n" + "compatibility.\n" + " \n" + "This value should stay close to 60Hz to avoid \n" + "large pitch changes. If your monitor does \n" + "not run at 60Hz, or something close to it, \n" + "disable VSync, and leave this at its default."); + break; + case MENU_ENUM_LABEL_VIDEO_ROTATION: + snprintf(s, len, + "Forces a certain rotation \n" + "of the screen.\n" + " \n" + "The rotation is added to rotations which\n" + "the libretro core sets (see Video Allow\n" + "Rotate)."); + break; + case MENU_ENUM_LABEL_VIDEO_SCALE: + snprintf(s, len, + "Fullscreen resolution.\n" + " \n" + "Resolution of 0 uses the \n" + "resolution of the environment.\n"); + break; + case MENU_ENUM_LABEL_FASTFORWARD_RATIO: + snprintf(s, len, + "Fastforward ratio." + " \n" + "The maximum rate at which content will\n" + "be run when using fast forward.\n" + " \n" + " (E.g. 5.0 for 60 fps content => 300 fps \n" + "cap).\n" + " \n" + "RetroArch will go to sleep to ensure that \n" + "the maximum rate will not be exceeded.\n" + "Do not rely on this cap to be perfectly \n" + "accurate."); + break; + case MENU_ENUM_LABEL_VIDEO_MONITOR_INDEX: + snprintf(s, len, + "Which monitor to prefer.\n" + " \n" + "0 (default) means no particular monitor \n" + "is preferred, 1 and up (1 being first \n" + "monitor), suggests RetroArch to use that \n" + "particular monitor."); + break; + case MENU_ENUM_LABEL_VIDEO_CROP_OVERSCAN: + snprintf(s, len, + "Forces cropping of overscanned \n" + "frames.\n" + " \n" + "Exact behavior of this option is \n" + "core-implementation specific."); + break; + case MENU_ENUM_LABEL_VIDEO_SCALE_INTEGER: + snprintf(s, len, + "Only scales video in integer \n" + "steps.\n" + " \n" + "The base size depends on system-reported \n" + "geometry and aspect ratio.\n" + " \n" + "If Force Aspect is not set, X/Y will be \n" + "integer scaled independently."); + break; + case MENU_ENUM_LABEL_AUDIO_VOLUME: + snprintf(s, len, + "Audio volume, expressed in dB.\n" + " \n" + " 0 dB is normal volume. No gain will be applied.\n" + "Gain can be controlled in runtime with Input\n" + "Volume Up / Input Volume Down."); + break; + case MENU_ENUM_LABEL_AUDIO_RATE_CONTROL_DELTA: + snprintf(s, len, + "Audio rate control.\n" + " \n" + "Setting this to 0 disables rate control.\n" + "Any other value controls audio rate control \n" + "delta.\n" + " \n" + "Defines how much input rate can be adjusted \n" + "dynamically.\n" + " \n" + " Input rate is defined as: \n" + " input rate * (1.0 +/- (rate control delta))"); + break; + case MENU_ENUM_LABEL_AUDIO_MAX_TIMING_SKEW: + snprintf(s, len, + "Maximum audio timing skew.\n" + " \n" + "Defines the maximum change in input rate.\n" + "You may want to increase this to enable\n" + "very large changes in timing, for example\n" + "running PAL cores on NTSC displays, at the\n" + "cost of inaccurate audio pitch.\n" + " \n" + " Input rate is defined as: \n" + " input rate * (1.0 +/- (max timing skew))"); + break; + case MENU_ENUM_LABEL_OVERLAY_NEXT: + snprintf(s, len, + "Toggles to next overlay.\n" + " \n" + "Wraps around."); + break; + case MENU_ENUM_LABEL_LOG_VERBOSITY: + snprintf(s, len, + "Enable or disable verbosity level \n" + "of frontend."); + break; + case MENU_ENUM_LABEL_VOLUME_UP: + snprintf(s, len, + "Increases audio volume."); + break; + case MENU_ENUM_LABEL_VOLUME_DOWN: + snprintf(s, len, + "Decreases audio volume."); + break; + case MENU_ENUM_LABEL_VIDEO_DISABLE_COMPOSITION: + snprintf(s, len, + "Forcibly disable composition.\n" + "Only valid on Windows Vista/7 for now."); + break; + case MENU_ENUM_LABEL_PERFCNT_ENABLE: + snprintf(s, len, + "Enable or disable frontend \n" + "performance counters."); + break; + case MENU_ENUM_LABEL_SYSTEM_DIRECTORY: + snprintf(s, len, + "System Directory. \n" + " \n" + "Sets the 'system' directory.\n" + "Cores can query for this\n" + "directory to load BIOSes, \n" + "system-specific configs, etc."); + break; + case MENU_ENUM_LABEL_SAVESTATE_AUTO_SAVE: + case MENU_ENUM_LABEL_SAVESTATE_AUTO_LOAD: + snprintf(s, len, + "Automatically saves a savestate at the \n" + "end of RetroArch's lifetime.\n" + " \n" + "RetroArch will automatically load any savestate\n" + "with this path on startup if 'Auto Load State\n" + "is enabled."); + break; + case MENU_ENUM_LABEL_VIDEO_THREADED: + snprintf(s, len, + "Use threaded video driver.\n" + " \n" + "Using this might improve performance at the \n" + "possible cost of latency and more video \n" + "stuttering."); + break; + case MENU_ENUM_LABEL_VIDEO_VSYNC: + snprintf(s, len, + "Video V-Sync.\n"); + break; + case MENU_ENUM_LABEL_VIDEO_HARD_SYNC: + snprintf(s, len, + "Attempts to hard-synchronize \n" + "CPU and GPU.\n" + " \n" + "Can reduce latency at the cost of \n" + "performance."); + break; + case MENU_ENUM_LABEL_REWIND_GRANULARITY: + snprintf(s, len, + "Rewind granularity.\n" + " \n" + " When rewinding defined number of \n" + "frames, you can rewind several frames \n" + "at a time, increasing the rewinding \n" + "speed."); + break; + case MENU_ENUM_LABEL_SCREENSHOT: + snprintf(s, len, + "Take screenshot."); + break; + case MENU_ENUM_LABEL_VIDEO_FRAME_DELAY: + snprintf(s, len, + "Sets how many milliseconds to delay\n" + "after VSync before running the core.\n" + "\n" + "Can reduce latency at the cost of\n" + "higher risk of stuttering.\n" + " \n" + "Maximum is 15."); + break; + case MENU_ENUM_LABEL_VIDEO_HARD_SYNC_FRAMES: + snprintf(s, len, + "Sets how many frames CPU can \n" + "run ahead of GPU when using 'GPU \n" + "Hard Sync'.\n" + " \n" + "Maximum is 3.\n" + " \n" + " 0: Syncs to GPU immediately.\n" + " 1: Syncs to previous frame.\n" + " 2: Etc ..."); + break; + case MENU_ENUM_LABEL_VIDEO_BLACK_FRAME_INSERTION: + snprintf(s, len, + "Inserts a black frame inbetween \n" + "frames.\n" + " \n" + "Useful for 120 Hz monitors who want to \n" + "play 60 Hz material with eliminated \n" + "ghosting.\n" + " \n" + "Video refresh rate should still be \n" + "configured as if it is a 60 Hz monitor \n" + "(divide refresh rate by 2)."); + break; + case MENU_ENUM_LABEL_RGUI_SHOW_START_SCREEN: + snprintf(s, len, + "Show startup screen in menu.\n" + "Is automatically set to false when seen\n" + "for the first time.\n" + " \n" + "This is only updated in config if\n" + "'Save Configuration on Exit' is enabled.\n"); + break; + case MENU_ENUM_LABEL_VIDEO_FULLSCREEN: + snprintf(s, len, "Toggles fullscreen."); + break; + case MENU_ENUM_LABEL_BLOCK_SRAM_OVERWRITE: + snprintf(s, len, + "Block SRAM from being overwritten \n" + "when loading save states.\n" + " \n" + "Might potentially lead to buggy games."); + break; + case MENU_ENUM_LABEL_PAUSE_NONACTIVE: + snprintf(s, len, + "Pause gameplay when window focus \n" + "is lost."); + break; + case MENU_ENUM_LABEL_VIDEO_GPU_SCREENSHOT: + snprintf(s, len, + "Screenshots output of GPU shaded \n" + "material if available."); + break; + case MENU_ENUM_LABEL_SCREENSHOT_DIRECTORY: + snprintf(s, len, + "Screenshot Directory. \n" + " \n" + "Directory to dump screenshots to." + ); + break; + case MENU_ENUM_LABEL_VIDEO_SWAP_INTERVAL: + snprintf(s, len, + "VSync Swap Interval.\n" + " \n" + "Uses a custom swap interval for VSync. Set this \n" + "to effectively halve monitor refresh rate."); + break; + case MENU_ENUM_LABEL_SAVEFILE_DIRECTORY: + snprintf(s, len, + "Savefile Directory. \n" + " \n" + "Save all save files (*.srm) to this \n" + "directory. This includes related files like \n" + ".bsv, .rt, .psrm, etc...\n" + " \n" + "This will be overridden by explicit command line\n" + "options."); + break; + case MENU_ENUM_LABEL_SAVESTATE_DIRECTORY: + snprintf(s, len, + "Savestate Directory. \n" + " \n" + "Save all save states (*.state) to this \n" + "directory.\n" + " \n" + "This will be overridden by explicit command line\n" + "options."); + break; + case MENU_ENUM_LABEL_ASSETS_DIRECTORY: + snprintf(s, len, + "Assets Directory. \n" + " \n" + " This location is queried by default when \n" + "menu interfaces try to look for loadable \n" + "assets, etc."); + break; + case MENU_ENUM_LABEL_DYNAMIC_WALLPAPERS_DIRECTORY: + snprintf(s, len, + "Dynamic Wallpapers Directory. \n" + " \n" + " The place to store backgrounds that will \n" + "be loaded dynamically by the menu depending \n" + "on context."); + break; + case MENU_ENUM_LABEL_SLOWMOTION_RATIO: + snprintf(s, len, + "Slowmotion ratio." + " \n" + "When slowmotion, content will slow\n" + "down by factor."); + break; + case MENU_ENUM_LABEL_INPUT_AXIS_THRESHOLD: + snprintf(s, len, + "Defines axis threshold.\n" + " \n" + "How far an axis must be tilted to result\n" + "in a button press.\n" + " Possible values are [0.0, 1.0]."); + break; + case MENU_ENUM_LABEL_INPUT_TURBO_PERIOD: + snprintf(s, len, + "Turbo period.\n" + " \n" + "Describes the period of which turbo-enabled\n" + "buttons toggle.\n" + " \n" + "Numbers are described in frames." + ); + break; + case MENU_ENUM_LABEL_INPUT_DUTY_CYCLE: + snprintf(s, len, + "Duty cycle.\n" + " \n" + "Describes how long the period of a turbo-enabled\n" + "should be.\n" + " \n" + "Numbers are described in frames." + ); + break; + case MENU_ENUM_LABEL_INPUT_TOUCH_ENABLE: + snprintf(s, len, "Enable touch support."); + break; + case MENU_ENUM_LABEL_INPUT_PREFER_FRONT_TOUCH: + snprintf(s, len, "Use front instead of back touch."); + break; + case MENU_ENUM_LABEL_MOUSE_ENABLE: + snprintf(s, len, "Enable mouse input inside the menu."); + break; + case MENU_ENUM_LABEL_POINTER_ENABLE: + snprintf(s, len, "Enable touch input inside the menu."); + break; + case MENU_ENUM_LABEL_MENU_WALLPAPER: + snprintf(s, len, "Path to an image to set as the background."); + break; + case MENU_ENUM_LABEL_NAVIGATION_WRAPAROUND: + snprintf(s, len, + "Wrap-around to beginning and/or end \n" + "if boundary of list is reached \n" + "horizontally and/or vertically."); + break; + case MENU_ENUM_LABEL_PAUSE_LIBRETRO: + snprintf(s, len, + "If disabled, the game will keep \n" + "running in the background when we are in the \n" + "menu."); + break; + case MENU_ENUM_LABEL_SUSPEND_SCREENSAVER_ENABLE: + snprintf(s, len, + "Suspends the screensaver. Is a hint that \n" + "does not necessarily have to be \n" + "honored by the video driver."); + break; + case MENU_ENUM_LABEL_NETPLAY_MODE: + snprintf(s, len, + "Netplay client mode for the current user. \n" + "Will be 'Server' mode if disabled."); + break; + case MENU_ENUM_LABEL_NETPLAY_DELAY_FRAMES: + snprintf(s, len, + "The amount of delay frames to use for netplay. \n" + " \n" + "Increasing this value will increase \n" + "performance, but introduce more latency."); + break; + case MENU_ENUM_LABEL_NETPLAY_PUBLIC_ANNOUNCE: + snprintf(s, len, + "Whether to announce netplay games publicly. \n" + " \n" + "If set to false, clients must manually connect \n" + "rather than using the public lobby."); + break; + case MENU_ENUM_LABEL_NETPLAY_START_AS_SPECTATOR: + snprintf(s, len, + "Whether to start netplay in spectator mode. \n" + " \n" + "If set to true, netplay will be in spectator mode \n" + "on start. It's always possible to change mode \n" + "later."); + break; + case MENU_ENUM_LABEL_NETPLAY_ALLOW_SLAVES: + snprintf(s, len, + "Whether to allow connections in slave mode. \n" + " \n" + "Slave-mode clients require very little processing \n" + "power on either side, but will suffer \n" + "significantly from network latency."); + break; + case MENU_ENUM_LABEL_NETPLAY_REQUIRE_SLAVES: + snprintf(s, len, + "Whether to disallow connections not in slave mode. \n" + " \n" + "Not recommended except for very fast networks \n" + "with very weak machines. \n"); + break; + case MENU_ENUM_LABEL_NETPLAY_STATELESS_MODE: + snprintf(s, len, + "Whether to run netplay in a mode not requiring\n" + "save states. \n" + " \n" + "If set to true, a very fast network is required,\n" + "but no rewinding is performed, so there will be\n" + "no netplay jitter.\n"); + break; + case MENU_ENUM_LABEL_NETPLAY_CHECK_FRAMES: + snprintf(s, len, + "The frequency in frames with which netplay \n" + "will verify that the host and client are in \n" + "sync. \n" + " \n" + "With most cores, this value will have no \n" + "visible effect and can be ignored. With \n" + "nondeterminstic cores, this value determines \n" + "how often the netplay peers will be brought \n" + "into sync. With buggy cores, setting this \n" + "to any non-zero value will cause severe \n" + "performance issues. Set to zero to perform \n" + "no checks. This value is only used on the \n" + "netplay host. \n"); + break; + case MENU_ENUM_LABEL_NETPLAY_INPUT_LATENCY_FRAMES_MIN: + snprintf(s, len, + "The number of frames of input latency for \n" + "netplay to use to hide network latency. \n" + " \n" + "When in netplay, this option delays local \n" + "input, so that the frame being run is \n" + "closer to the frames being received from \n" + "the network. This reduces jitter and makes \n" + "netplay less CPU-intensive, but at the \n" + "price of noticeable input lag. \n"); + break; + case MENU_ENUM_LABEL_NETPLAY_INPUT_LATENCY_FRAMES_RANGE: + snprintf(s, len, + "The range of frames of input latency that \n" + "may be used by netplay to hide network \n" + "latency. \n" + "\n" + "If set, netplay will adjust the number of \n" + "frames of input latency dynamically to \n" + "balance CPU time, input latency and \n" + "network latency. This reduces jitter and \n" + "makes netplay less CPU-intensive, but at \n" + "the price of unpredictable input lag. \n"); + break; + case MENU_ENUM_LABEL_NETPLAY_NAT_TRAVERSAL: + snprintf(s, len, + "When hosting, attempt to listen for\n" + "connections from the public internet, using\n" + "UPnP or similar technologies to escape LANs. \n"); + break; + case MENU_ENUM_LABEL_NETPLAY_USE_MITM_SERVER: + snprintf(s, len, + "When hosting a netplay session, relay connection through a \n" + "man-in-the-middle server \n" + "to get around firewalls or NAT/UPnP issues. \n"); + break; + case MENU_ENUM_LABEL_NETPLAY_MITM_SERVER: + snprintf(s, len, + "Specifies the man-in-the-middle server \n" + "to use for netplay. A server that is \n" + "located closer to you may have less latency. \n"); + break; + case MENU_ENUM_LABEL_VIDEO_MAX_SWAPCHAIN_IMAGES: + snprintf(s, len, + "Maximum amount of swapchain images. This \n" + "can tell the video driver to use a specific \n" + "video buffering mode. \n" + " \n" + "Single buffering - 1\n" + "Double buffering - 2\n" + "Triple buffering - 3\n" + " \n" + "Setting the right buffering mode can have \n" + "a big impact on latency."); + break; + case MENU_ENUM_LABEL_VIDEO_SMOOTH: + snprintf(s, len, + "Smoothens picture with bilinear filtering. \n" + "Should be disabled if using shaders."); + break; + case MENU_ENUM_LABEL_TIMEDATE_ENABLE: + snprintf(s, len, + "Shows current date and/or time inside menu."); + break; + case MENU_ENUM_LABEL_BATTERY_LEVEL_ENABLE: + snprintf(s, len, + "Shows current battery level inside menu."); + break; + case MENU_ENUM_LABEL_CORE_ENABLE: + snprintf(s, len, + "Shows current core inside menu."); + break; + case MENU_ENUM_LABEL_NETPLAY_ENABLE_HOST: + snprintf(s, len, + "Enables Netplay in host (server) mode."); + break; + case MENU_ENUM_LABEL_NETPLAY_ENABLE_CLIENT: + snprintf(s, len, + "Enables Netplay in client mode."); + break; + case MENU_ENUM_LABEL_NETPLAY_DISCONNECT: + snprintf(s, len, + "Disconnects an active Netplay connection."); + break; + case MENU_ENUM_LABEL_NETPLAY_LAN_SCAN_SETTINGS: + snprintf(s, len, + "Search for and connect to netplay hosts on the local network."); + break; + case MENU_ENUM_LABEL_NETPLAY_SETTINGS: + snprintf(s, len, + "Setting related to Netplay."); + break; + case MENU_ENUM_LABEL_DYNAMIC_WALLPAPER: + snprintf(s, len, + "Dynamically load a new background \n" + "depending on context."); + break; + case MENU_ENUM_LABEL_CORE_UPDATER_BUILDBOT_URL: + snprintf(s, len, + "URL to core updater directory on the \n" + "Libretro buildbot."); + break; + case MENU_ENUM_LABEL_BUILDBOT_ASSETS_URL: + snprintf(s, len, + "URL to assets updater directory on the \n" + "Libretro buildbot."); + break; + case MENU_ENUM_LABEL_INPUT_REMAP_BINDS_ENABLE: + snprintf(s, len, + "if enabled, overrides the input binds \n" + "with the remapped binds set for the \n" + "current core."); + break; + case MENU_ENUM_LABEL_OVERLAY_DIRECTORY: + snprintf(s, len, + "Overlay Directory. \n" + " \n" + "Defines a directory where overlays are \n" + "kept for easy access."); + break; + case MENU_ENUM_LABEL_INPUT_MAX_USERS: + snprintf(s, len, + "Maximum amount of users supported by \n" + "RetroArch."); + break; + case MENU_ENUM_LABEL_CORE_UPDATER_AUTO_EXTRACT_ARCHIVE: + snprintf(s, len, + "After downloading, automatically extract \n" + "archives that the downloads are contained \n" + "inside."); + break; + case MENU_ENUM_LABEL_NAVIGATION_BROWSER_FILTER_SUPPORTED_EXTENSIONS_ENABLE: + snprintf(s, len, + "Filter files being shown by \n" + "supported extensions."); + break; + case MENU_ENUM_LABEL_NETPLAY_NICKNAME: + snprintf(s, len, + "The username of the person running RetroArch. \n" + "This will be used for playing online games."); + break; + case MENU_ENUM_LABEL_NETPLAY_TCP_UDP_PORT: + snprintf(s, len, + "The port of the host IP address. \n" + "Can be either a TCP or UDP port."); + break; + case MENU_ENUM_LABEL_NETPLAY_SPECTATOR_MODE_ENABLE: + snprintf(s, len, + "Enable or disable spectator mode for \n" + "the user during netplay."); + break; + case MENU_ENUM_LABEL_NETPLAY_IP_ADDRESS: + snprintf(s, len, + "The address of the host to connect to."); + break; + case MENU_ENUM_LABEL_NETPLAY_PASSWORD: + snprintf(s, len, + "The password for connecting to the netplay \n" + "host. Used only in host mode."); + break; + case MENU_ENUM_LABEL_NETPLAY_SPECTATE_PASSWORD: + snprintf(s, len, + "The password for connecting to the netplay \n" + "host with only spectator privileges. Used \n" + "only in host mode."); + break; + case MENU_ENUM_LABEL_STDIN_CMD_ENABLE: + snprintf(s, len, + "Enable stdin command interface."); + break; + case MENU_ENUM_LABEL_UI_COMPANION_START_ON_BOOT: + snprintf(s, len, + "Start User Interface companion driver \n" + "on boot (if available)."); + break; + case MENU_ENUM_LABEL_MENU_DRIVER: + snprintf(s, len, "Menu driver to use."); + break; + case MENU_ENUM_LABEL_INPUT_MENU_ENUM_TOGGLE_GAMEPAD_COMBO: + snprintf(s, len, + "Gamepad button combination to toggle menu. \n" + " \n" + "0 - None \n" + "1 - Press L + R + Y + D-Pad Down \n" + "simultaneously. \n" + "2 - Press L3 + R3 simultaneously. \n" + "3 - Press Start + Select simultaneously."); + break; + case MENU_ENUM_LABEL_INPUT_ALL_USERS_CONTROL_MENU: + snprintf(s, len, "Allows any user to control the menu. \n" + " \n" + "When disabled, only user 1 can control the menu."); + break; + case MENU_ENUM_LABEL_INPUT_AUTODETECT_ENABLE: + snprintf(s, len, + "Enable input auto-detection.\n" + " \n" + "Will attempt to auto-configure \n" + "joypads, Plug-and-Play style."); + break; + case MENU_ENUM_LABEL_CAMERA_ALLOW: + snprintf(s, len, + "Allow or disallow camera access by \n" + "cores."); + break; + case MENU_ENUM_LABEL_LOCATION_ALLOW: + snprintf(s, len, + "Allow or disallow location services \n" + "access by cores."); + break; + case MENU_ENUM_LABEL_TURBO: + snprintf(s, len, + "Turbo enable.\n" + " \n" + "Holding the turbo while pressing another \n" + "button will let the button enter a turbo \n" + "mode where the button state is modulated \n" + "with a periodic signal. \n" + " \n" + "The modulation stops when the button \n" + "itself (not turbo button) is released."); + break; + case MENU_ENUM_LABEL_OSK_ENABLE: + snprintf(s, len, + "Enable/disable on-screen keyboard."); + break; + case MENU_ENUM_LABEL_AUDIO_MUTE: + snprintf(s, len, + "Mute/unmute audio."); + break; + case MENU_ENUM_LABEL_REWIND: + snprintf(s, len, + "Hold button down to rewind.\n" + " \n" + "Rewind must be enabled."); + break; + case MENU_ENUM_LABEL_EXIT_EMULATOR: + snprintf(s, len, + "Key to exit RetroArch cleanly." +#if !defined(RARCH_MOBILE) && !defined(RARCH_CONSOLE) + "\nKilling it in any hard way (SIGKILL, \n" + "etc) will terminate without saving\n" + "RAM, etc. On Unix-likes,\n" + "SIGINT/SIGTERM allows\n" + "a clean deinitialization." +#endif + ); + break; + case MENU_ENUM_LABEL_LOAD_STATE: + snprintf(s, len, + "Loads state."); + break; + case MENU_ENUM_LABEL_SAVE_STATE: + snprintf(s, len, + "Saves state."); + break; + case MENU_ENUM_LABEL_NETPLAY_GAME_WATCH: + snprintf(s, len, + "Netplay toggle play/spectate mode."); + break; + case MENU_ENUM_LABEL_CHEAT_INDEX_PLUS: + snprintf(s, len, + "Increment cheat index.\n"); + break; + case MENU_ENUM_LABEL_CHEAT_INDEX_MINUS: + snprintf(s, len, + "Decrement cheat index.\n"); + break; + case MENU_ENUM_LABEL_SHADER_PREV: + snprintf(s, len, + "Applies previous shader in directory."); + break; + case MENU_ENUM_LABEL_SHADER_NEXT: + snprintf(s, len, + "Applies next shader in directory."); + break; + case MENU_ENUM_LABEL_RESET: + snprintf(s, len, + "Reset the content.\n"); + break; + case MENU_ENUM_LABEL_PAUSE_TOGGLE: + snprintf(s, len, + "Toggle between paused and non-paused state."); + break; + case MENU_ENUM_LABEL_CHEAT_TOGGLE: + snprintf(s, len, + "Toggle cheat index.\n"); + break; + case MENU_ENUM_LABEL_HOLD_FAST_FORWARD: + snprintf(s, len, + "Hold for fast-forward. Releasing button \n" + "disables fast-forward."); + break; + case MENU_ENUM_LABEL_SLOWMOTION: + snprintf(s, len, + "Hold for slowmotion."); + break; + case MENU_ENUM_LABEL_FRAME_ADVANCE: + snprintf(s, len, + "Frame advance when content is paused."); + break; + case MENU_ENUM_LABEL_MOVIE_RECORD_TOGGLE: + snprintf(s, len, + "Toggle between recording and not."); + break; + case MENU_ENUM_LABEL_L_X_PLUS: + case MENU_ENUM_LABEL_L_X_MINUS: + case MENU_ENUM_LABEL_L_Y_PLUS: + case MENU_ENUM_LABEL_L_Y_MINUS: + case MENU_ENUM_LABEL_R_X_PLUS: + case MENU_ENUM_LABEL_R_X_MINUS: + case MENU_ENUM_LABEL_R_Y_PLUS: + case MENU_ENUM_LABEL_R_Y_MINUS: + snprintf(s, len, + "Axis for analog stick (DualShock-esque).\n" + " \n" + "Bound as usual, however, if a real analog \n" + "axis is bound, it can be read as a true analog.\n" + " \n" + "Positive X axis is right. \n" + "Positive Y axis is down."); + break; + case MENU_ENUM_LABEL_VALUE_WHAT_IS_A_CORE_DESC: + snprintf(s, len, + "RetroArch by itself does nothing. \n" + " \n" + "To make it do things, you need to \n" + "load a program into it. \n" + "\n" + "We call such a program 'Libretro core', \n" + "or 'core' in short. \n" + " \n" + "To load a core, select one from\n" + "'Load Core'.\n" + " \n" +#ifdef HAVE_NETWORKING + "You can obtain cores in several ways: \n" + "* Download them by going to\n" + "'%s' -> '%s'.\n" + "* Manually move them over to\n" + "'%s'.", + msg_hash_to_str(MENU_ENUM_LABEL_VALUE_ONLINE_UPDATER), + msg_hash_to_str(MENU_ENUM_LABEL_VALUE_CORE_UPDATER_LIST), + msg_hash_to_str(MENU_ENUM_LABEL_VALUE_LIBRETRO_DIR_PATH) +#else + "You can obtain cores by\n" + "manually moving them over to\n" + "'%s'.", + msg_hash_to_str(MENU_ENUM_LABEL_VALUE_LIBRETRO_DIR_PATH) +#endif + ); + break; + case MENU_ENUM_LABEL_VALUE_HELP_CHANGE_VIRTUAL_GAMEPAD_DESC: + snprintf(s, len, + "You can change the virtual gamepad overlay\n" + "by going to '%s' -> '%s'." + " \n" + "From there you can change the overlay,\n" + "change the size and opacity of the buttons, etc.\n" + " \n" + "NOTE: By default, virtual gamepad overlays are\n" + "hidden when in the menu.\n" + "If you'd like to change this behavior,\n" + "you can set '%s' to false.", + msg_hash_to_str(MENU_ENUM_LABEL_VALUE_SETTINGS), + msg_hash_to_str(MENU_ENUM_LABEL_VALUE_OVERLAY_SETTINGS), + msg_hash_to_str(MENU_ENUM_LABEL_VALUE_INPUT_OVERLAY_HIDE_IN_MENU) + ); + break; + case MENU_ENUM_LABEL_VALUE_VIDEO_MESSAGE_BGCOLOR_ENABLE: + snprintf(s, len, + "Enables a background color for the OSD."); + break; + case MENU_ENUM_LABEL_VALUE_VIDEO_MESSAGE_BGCOLOR_RED: + snprintf(s, len, + "Sets the red value of the OSD background color. Valid values are between 0 and 255."); + break; + case MENU_ENUM_LABEL_VALUE_VIDEO_MESSAGE_BGCOLOR_GREEN: + snprintf(s, len, + "Sets the green value of the OSD background color. Valid values are between 0 and 255."); + break; + case MENU_ENUM_LABEL_VALUE_VIDEO_MESSAGE_BGCOLOR_BLUE: + snprintf(s, len, + "Sets the blue value of the OSD background color. Valid values are between 0 and 255."); + break; + case MENU_ENUM_LABEL_VALUE_VIDEO_MESSAGE_BGCOLOR_OPACITY: + snprintf(s, len, + "Sets the opacity of the OSD background color. Valid values are between 0.0 and 1.0."); + break; + case MENU_ENUM_LABEL_VALUE_VIDEO_MESSAGE_COLOR_RED: + snprintf(s, len, + "Sets the red value of the OSD text color. Valid values are between 0 and 255."); + break; + case MENU_ENUM_LABEL_VALUE_VIDEO_MESSAGE_COLOR_GREEN: + snprintf(s, len, + "Sets the green value of the OSD text color. Valid values are between 0 and 255."); + break; + case MENU_ENUM_LABEL_VALUE_VIDEO_MESSAGE_COLOR_BLUE: + snprintf(s, len, + "Sets the blue value of the OSD text color. Valid values are between 0 and 255."); + break; + default: + if (string_is_empty(s)) + strlcpy(s, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_NO_INFORMATION_AVAILABLE), len); + return -1; + } + + return 0; +} + +#ifdef HAVE_MENU +static const char *menu_hash_to_str_ar_label_enum(enum msg_hash_enums msg) +{ + if (msg <= MENU_ENUM_LABEL_INPUT_HOTKEY_BIND_END && + msg >= MENU_ENUM_LABEL_INPUT_HOTKEY_BIND_BEGIN) + { + static char hotkey_lbl[128] = {0}; + unsigned idx = msg - MENU_ENUM_LABEL_INPUT_HOTKEY_BIND_BEGIN; + snprintf(hotkey_lbl, sizeof(hotkey_lbl), "input_hotkey_binds_%d", idx); + return hotkey_lbl; + } + + switch (msg) + { +#include "msg_hash_lbl.h" + default: +#if 0 + RARCH_LOG("Unimplemented: [%d]\n", msg); +#endif + break; + } + + return "null"; +} +#endif + +const char *msg_hash_to_str_ar(enum msg_hash_enums msg) { +#ifdef HAVE_MENU + const char *ret = menu_hash_to_str_ar_label_enum(msg); + + if (ret && !string_is_equal(ret, "null")) + return ret; +#endif + + switch (msg) { +#include "msg_hash_ar.h" + default: +#if 0 + RARCH_LOG("Unimplemented: [%d]\n", msg); + { + RARCH_LOG("[%d] : %s\n", msg - 1, msg_hash_to_str(((enum msg_hash_enums)(msg - 1)))); + } +#endif + break; + } + + return "null"; +} diff --git a/intl/msg_hash_ar.h b/intl/msg_hash_ar.h new file mode 100644 index 0000000000..dd11b87f83 --- /dev/null +++ b/intl/msg_hash_ar.h @@ -0,0 +1,3417 @@ +MSG_HASH( + MSG_COMPILER, + "Compiler" + ) +MSG_HASH( + MSG_UNKNOWN_COMPILER, + "Unknown compiler" + ) +MSG_HASH( + MSG_DEVICE_DISCONNECTED_FROM_PORT, + "Device disconnected from port" + ) +MSG_HASH( + MSG_UNKNOWN_NETPLAY_COMMAND_RECEIVED, + "Unknown netplay command received" + ) +MSG_HASH( + MSG_FILE_ALREADY_EXISTS_SAVING_TO_BACKUP_BUFFER, + "File already exists. Saving to backup buffer" + ) +MSG_HASH( + MSG_GOT_CONNECTION_FROM, + "Got connection from: \"%s\"" + ) +MSG_HASH( + MSG_GOT_CONNECTION_FROM_NAME, + "Got connection from: \"%s (%s)\"" + ) +MSG_HASH( + MSG_PUBLIC_ADDRESS, + "Public address" + ) +MSG_HASH( + MSG_NO_ARGUMENTS_SUPPLIED_AND_NO_MENU_BUILTIN, + "No arguments supplied and no menu builtin, displaying help..." + ) +MSG_HASH( + MSG_SETTING_DISK_IN_TRAY, + "Setting disk in tray" + ) +MSG_HASH( + MSG_WAITING_FOR_CLIENT, + "Waiting for client ..." + ) +MSG_HASH( + MSG_NETPLAY_YOU_HAVE_LEFT_THE_GAME, + "You have left the game" + ) +MSG_HASH( + MSG_NETPLAY_YOU_HAVE_JOINED_AS_PLAYER_N, + "You have joined as player %u" + ) +MSG_HASH( + MSG_NETPLAY_YOU_HAVE_JOINED_WITH_INPUT_DEVICES_S, + "You have joined with input devices %.*s" + ) +MSG_HASH( + MSG_NETPLAY_PLAYER_S_LEFT, + "Player %.*s has left the game" + ) +MSG_HASH( + MSG_NETPLAY_S_HAS_JOINED_AS_PLAYER_N, + "%2$.*1$s has joined as player %3$u" + ) +MSG_HASH( + MSG_NETPLAY_S_HAS_JOINED_WITH_INPUT_DEVICES_S, + "%2$.*1$s has joined with input devices %4$.*3$s" + ) +MSG_HASH( + MSG_NETPLAY_NOT_RETROARCH, + "A netplay connection attempt failed because the peer is not running RetroArch, or is running an old version of RetroArch." + ) +MSG_HASH( + MSG_NETPLAY_OUT_OF_DATE, + "The netplay peer is running an old version of RetroArch. Cannot connect." + ) +MSG_HASH( + MSG_NETPLAY_DIFFERENT_VERSIONS, + "WARNING: A netplay peer is running a different version of RetroArch. If problems occur, use the same version." + ) +MSG_HASH( + MSG_NETPLAY_DIFFERENT_CORES, + "A netplay peer is running a different core. Cannot connect." + ) +MSG_HASH( + MSG_NETPLAY_DIFFERENT_CORE_VERSIONS, + "WARNING: A netlpay peer is running a different version of the core. If problems occur, use the same version." + ) +MSG_HASH( + MSG_NETPLAY_ENDIAN_DEPENDENT, + "This core does not support inter-architecture netplay between these systems" + ) +MSG_HASH( + MSG_NETPLAY_PLATFORM_DEPENDENT, + "This core does not support inter-architecture netplay" + ) +MSG_HASH( + MSG_NETPLAY_ENTER_PASSWORD, + "Enter netplay server password:" + ) +MSG_HASH( + MSG_NETPLAY_INCORRECT_PASSWORD, + "Incorrect password" + ) +MSG_HASH( + MSG_NETPLAY_SERVER_NAMED_HANGUP, + "\"%s\" has disconnected" + ) +MSG_HASH( + MSG_NETPLAY_SERVER_HANGUP, + "A netplay client has disconnected" + ) +MSG_HASH( + MSG_NETPLAY_CLIENT_HANGUP, + "Netplay disconnected" + ) +MSG_HASH( + MSG_NETPLAY_CANNOT_PLAY_UNPRIVILEGED, + "You do not have permission to play" + ) +MSG_HASH( + MSG_NETPLAY_CANNOT_PLAY_NO_SLOTS, + "There are no free player slots" + ) +MSG_HASH( + MSG_NETPLAY_CANNOT_PLAY_NOT_AVAILABLE, + "The input devices requested are not available" + ) +MSG_HASH( + MSG_NETPLAY_CANNOT_PLAY, + "Cannot switch to play mode" + ) +MSG_HASH( + MSG_NETPLAY_PEER_PAUSED, + "Netplay peer \"%s\" paused" + ) +MSG_HASH( + MSG_NETPLAY_CHANGED_NICK, + "Your nickname changed to \"%s\"" + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_VIDEO_SHARED_CONTEXT, + "Give hardware-rendered cores their own private context. Avoids having to assume hardware state changes inbetween frames." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_MENU_SETTINGS, + "Adjusts menu screen appearance settings." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_VIDEO_HARD_SYNC, + "Hard-synchronize the CPU and GPU. Reduces latency at the cost of performance." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_VIDEO_THREADED, + "Improves performance at the cost of latency and more video stuttering. Use only if you cannot obtain full speed otherwise." + ) +MSG_HASH( + MSG_AUDIO_VOLUME, + "Audio volume" + ) +MSG_HASH( + MSG_AUTODETECT, + "Autodetect" + ) +MSG_HASH( + MSG_AUTOLOADING_SAVESTATE_FROM, + "Auto-loading savestate from" + ) +MSG_HASH( + MSG_CAPABILITIES, + "Capabilities" + ) +MSG_HASH( + MSG_CONNECTING_TO_NETPLAY_HOST, + "Connecting to netplay host" + ) +MSG_HASH( + MSG_CONNECTING_TO_PORT, + "Connecting to port" + ) +MSG_HASH( + MSG_CONNECTION_SLOT, + "Connection slot" + ) +MSG_HASH( + MSG_SORRY_UNIMPLEMENTED_CORES_DONT_DEMAND_CONTENT_NETPLAY, + "Sorry, unimplemented: cores that don't demand content cannot participate in netplay." + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_ACCOUNTS_CHEEVOS_PASSWORD, + "Password" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_ACCOUNTS_CHEEVOS_SETTINGS, + "Accounts Cheevos" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_ACCOUNTS_CHEEVOS_USERNAME, + "Username" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_ACCOUNTS_LIST, + "Accounts" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_ACCOUNTS_LIST_END, + "Accounts List Endpoint" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_ACCOUNTS_RETRO_ACHIEVEMENTS, + "RetroAchievements" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_ACHIEVEMENT_LIST, + "Achievement List" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_ACHIEVEMENT_LIST_HARDCORE, + "Achievement List (Hardcore)" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_ADD_CONTENT_LIST, + "Scan Content" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_CONFIGURATIONS_LIST, + "ملفات التكوين" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_ADD_TAB, + "Import content" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_NETPLAY_TAB, + "Netplay Rooms" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_ASK_ARCHIVE, + "Ask" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_ASSETS_DIRECTORY, + "Assets" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_AUDIO_BLOCK_FRAMES, + "Block Frames" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_AUDIO_DEVICE, + "Audio Device" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_AUDIO_DRIVER, + "نظام تشغيل الصوت" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_AUDIO_DSP_PLUGIN, + "Audio DSP Plugin" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_AUDIO_ENABLE, + "Audio Enable" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_AUDIO_FILTER_DIR, + "Audio Filter" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_TURBO_DEADZONE_LIST, + "Turbo/Deadzone" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_AUDIO_LATENCY, + "Audio Latency (ms)" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_AUDIO_MAX_TIMING_SKEW, + "Audio Maximum Timing Skew" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_AUDIO_MUTE, + "Audio Mute" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_AUDIO_OUTPUT_RATE, + "Audio Output Rate (Hz)" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_AUDIO_RATE_CONTROL_DELTA, + "Dynamic Audio Rate Control" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_AUDIO_RESAMPLER_DRIVER, + "Audio Resampler Driver" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_AUDIO_SETTINGS, + "الصوت" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_AUDIO_SYNC, + "Audio Sync" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_AUDIO_VOLUME, + "Audio Volume Level (dB)" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_AUDIO_WASAPI_EXCLUSIVE_MODE, + "WASAPI Exclusive Mode" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_AUDIO_WASAPI_FLOAT_FORMAT, + "WASAPI Float Format" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_AUDIO_WASAPI_SH_BUFFER_LENGTH, + "WASAPI Shared Buffer Length" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_AUTOSAVE_INTERVAL, + "SaveRAM Autosave Interval" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_AUTO_OVERRIDES_ENABLE, + "Load Override Files Automatically" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_AUTO_REMAPS_ENABLE, + "Load Remap Files Automatically" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_AUTO_SHADERS_ENABLE, + "Load Shader Presets Automatically" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_BASIC_MENU_CONTROLS_BACK, + "Back" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_BASIC_MENU_CONTROLS_CONFIRM, + "Confirm" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_BASIC_MENU_CONTROLS_INFO, + "Info" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_BASIC_MENU_CONTROLS_QUIT, + "Quit" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_BASIC_MENU_CONTROLS_SCROLL_DOWN, + "Scroll Down" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_BASIC_MENU_CONTROLS_SCROLL_UP, + "Scroll Up" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_BASIC_MENU_CONTROLS_START, + "Start" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_BASIC_MENU_CONTROLS_TOGGLE_KEYBOARD, + "Toggle Keyboard" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_BASIC_MENU_CONTROLS_TOGGLE_MENU, + "Toggle Menu" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_BASIC_MENU_ENUM_CONTROLS, + "Basic menu controls" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_BASIC_MENU_ENUM_CONTROLS_CONFIRM, + "Confirm/OK" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_BASIC_MENU_ENUM_CONTROLS_INFO, + "Info" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_BASIC_MENU_ENUM_CONTROLS_QUIT, + "Quit" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_BASIC_MENU_ENUM_CONTROLS_SCROLL_UP, + "Scroll Up" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_BASIC_MENU_ENUM_CONTROLS_START, + "Defaults" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_BASIC_MENU_ENUM_CONTROLS_TOGGLE_KEYBOARD, + "Toggle Keyboard" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_BASIC_MENU_ENUM_CONTROLS_TOGGLE_MENU, + "Toggle Menu" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_BLOCK_SRAM_OVERWRITE, + "Don't overwrite SaveRAM on loading savestate" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_BLUETOOTH_ENABLE, + "Bluetooth Enable" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_BUILDBOT_ASSETS_URL, + "Buildbot Assets URL" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_CACHE_DIRECTORY, + "Cache" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_CAMERA_ALLOW, + "Allow Camera" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_CAMERA_DRIVER, + "نظام تشغيل الكاميرا" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_CHEAT, + "Cheat" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_CHEAT_APPLY_CHANGES, + "Apply Changes" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_CHEAT_DATABASE_PATH, + "Cheat File" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_CHEAT_FILE, + "Cheat File" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_CHEAT_FILE_LOAD, + "Load Cheat File" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_CHEAT_FILE_SAVE_AS, + "Save Cheat File As" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_CHEAT_NUM_PASSES, + "Cheat Passes" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_CHEEVOS_DESCRIPTION, + "Description" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_CHEEVOS_HARDCORE_MODE_ENABLE, + "Achievements Hardcore Mode" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_CHEEVOS_LEADERBOARDS_ENABLE, + "Leaderboards" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_CHEEVOS_BADGES_ENABLE, + "Achievement Badges" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_CHEEVOS_LOCKED_ACHIEVEMENTS, + "Locked Achievements:" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_CHEEVOS_LOCKED_ENTRY, + "Locked" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_CHEEVOS_SETTINGS, + "RetroAchievements" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_CHEEVOS_TEST_UNOFFICIAL, + "Test Unofficial Achievements" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_CHEEVOS_UNLOCKED_ACHIEVEMENTS, + "Unlocked Achievements:" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_CHEEVOS_UNLOCKED_ENTRY, + "Unlocked" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_CHEEVOS_UNLOCKED_ENTRY_HARDCORE, + "Hardcore" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_CHEEVOS_VERBOSE_ENABLE, + "Achievements Verbose Mode" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_CLOSE_CONTENT, + "Close Content" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_CONFIG, + "Config" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_CONFIGURATIONS, + "تحميل ملف التكوين" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_CONFIGURATION_SETTINGS, + "ملفات التكوين" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_CONFIG_SAVE_ON_EXIT, + "Save Configuration on Exit" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_CONTENT_COLLECTION_LIST, + "Collections" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_CONTENT_DATABASE_DIRECTORY, + "Database" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_CONTENT_DIR, + "Content" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_CONTENT_HISTORY_SIZE, + "History List Size") +MSG_HASH(MENU_ENUM_LABEL_VALUE_PLAYLIST_ENTRY_REMOVE, + "Allow to remove entries") +MSG_HASH(MENU_ENUM_LABEL_VALUE_CONTENT_SETTINGS, + "القائمة السريعة") +MSG_HASH(MENU_ENUM_LABEL_VALUE_CORE_ASSETS_DIR, + "Downloads") +MSG_HASH(MENU_ENUM_LABEL_VALUE_CORE_ASSETS_DIRECTORY, + "Downloads") +MSG_HASH(MENU_ENUM_LABEL_VALUE_CORE_CHEAT_OPTIONS, + "Cheats") +MSG_HASH(MENU_ENUM_LABEL_VALUE_CORE_COUNTERS, + "Core Counters") +MSG_HASH(MENU_ENUM_LABEL_VALUE_CORE_ENABLE, + "Show core name") +MSG_HASH(MENU_ENUM_LABEL_VALUE_CORE_INFORMATION, + "Core Information") +MSG_HASH(MENU_ENUM_LABEL_VALUE_CORE_INFO_AUTHORS, + "Authors") +MSG_HASH(MENU_ENUM_LABEL_VALUE_CORE_INFO_CATEGORIES, + "Categories") +MSG_HASH(MENU_ENUM_LABEL_VALUE_CORE_INFO_CORE_LABEL, + "Core label") +MSG_HASH(MENU_ENUM_LABEL_VALUE_CORE_INFO_CORE_NAME, + "Core name") +MSG_HASH(MENU_ENUM_LABEL_VALUE_CORE_INFO_FIRMWARE, + "Firmware(s)") +MSG_HASH(MENU_ENUM_LABEL_VALUE_CORE_INFO_LICENSES, + "License(s)") +MSG_HASH(MENU_ENUM_LABEL_VALUE_CORE_INFO_PERMISSIONS, + "Permissions") +MSG_HASH(MENU_ENUM_LABEL_VALUE_CORE_INFO_SUPPORTED_EXTENSIONS, + "Supported extensions") +MSG_HASH(MENU_ENUM_LABEL_VALUE_CORE_INFO_SYSTEM_MANUFACTURER, + "System manufacturer") +MSG_HASH(MENU_ENUM_LABEL_VALUE_CORE_INFO_SYSTEM_NAME, + "System name") +MSG_HASH(MENU_ENUM_LABEL_VALUE_CORE_INPUT_REMAPPING_OPTIONS, + "Controls") +MSG_HASH(MENU_ENUM_LABEL_VALUE_CORE_LIST, + "تحميل الكور") +MSG_HASH(MENU_ENUM_LABEL_VALUE_CORE_OPTIONS, + "Options") +MSG_HASH(MENU_ENUM_LABEL_VALUE_CORE_SETTINGS, + "Core") +MSG_HASH(MENU_ENUM_LABEL_VALUE_CORE_SET_SUPPORTS_NO_CONTENT_ENABLE, + "Start a Core Automatically") +MSG_HASH(MENU_ENUM_LABEL_VALUE_CORE_UPDATER_AUTO_EXTRACT_ARCHIVE, + "Automatically extract downloaded archive") +MSG_HASH(MENU_ENUM_LABEL_VALUE_CORE_UPDATER_BUILDBOT_URL, + "Buildbot Cores URL") +MSG_HASH(MENU_ENUM_LABEL_VALUE_CORE_UPDATER_LIST, + "Core Updater") +MSG_HASH(MENU_ENUM_LABEL_VALUE_CORE_UPDATER_SETTINGS, + "Updater") +MSG_HASH(MENU_ENUM_LABEL_VALUE_CPU_ARCHITECTURE, + "CPU Architecture:") +MSG_HASH(MENU_ENUM_LABEL_VALUE_CPU_CORES, + "CPU Cores:") +MSG_HASH(MENU_ENUM_LABEL_VALUE_CURSOR_DIRECTORY, + "Cursor") +MSG_HASH(MENU_ENUM_LABEL_VALUE_CURSOR_MANAGER, + "Cursor Manager") +MSG_HASH(MENU_ENUM_LABEL_VALUE_CUSTOM_RATIO, + "Custom Ratio") +MSG_HASH(MENU_ENUM_LABEL_VALUE_DATABASE_MANAGER, + "Database Manager") +MSG_HASH(MENU_ENUM_LABEL_VALUE_DATABASE_SELECTION, + "Database Selection") +MSG_HASH(MENU_ENUM_LABEL_VALUE_DELETE_ENTRY, + "Remove") +MSG_HASH(MENU_ENUM_LABEL_VALUE_FAVORITES, + "Start directory") +MSG_HASH(MENU_ENUM_LABEL_VALUE_DIRECTORY_CONTENT, + "") +MSG_HASH(MENU_ENUM_LABEL_VALUE_DIRECTORY_DEFAULT, + "") +MSG_HASH(MENU_ENUM_LABEL_VALUE_DIRECTORY_NONE, + "") +MSG_HASH(MENU_ENUM_LABEL_VALUE_DIRECTORY_NOT_FOUND, + "Directory not found.") +MSG_HASH(MENU_ENUM_LABEL_VALUE_DIRECTORY_SETTINGS, + "الدلائل") +MSG_HASH(MENU_ENUM_LABEL_VALUE_DISK_CYCLE_TRAY_STATUS, + "Disk Cycle Tray Status") +MSG_HASH(MENU_ENUM_LABEL_VALUE_DISK_IMAGE_APPEND, + "Disk Image Append") +MSG_HASH(MENU_ENUM_LABEL_VALUE_DISK_INDEX, + "Disk Index") +MSG_HASH(MENU_ENUM_LABEL_VALUE_DISK_OPTIONS, + "Disk Control") +MSG_HASH(MENU_ENUM_LABEL_VALUE_DONT_CARE, + "Don't care") +MSG_HASH(MENU_ENUM_LABEL_VALUE_DOWNLOADED_FILE_DETECT_CORE_LIST, + "Downloads") +MSG_HASH(MENU_ENUM_LABEL_VALUE_DOWNLOAD_CORE, + "Download Core...") +MSG_HASH(MENU_ENUM_LABEL_VALUE_DOWNLOAD_CORE_CONTENT, + "Content Downloader") +MSG_HASH(MENU_ENUM_LABEL_VALUE_DPI_OVERRIDE_ENABLE, + "DPI Override Enable") +MSG_HASH(MENU_ENUM_LABEL_VALUE_DPI_OVERRIDE_VALUE, + "DPI Override") +MSG_HASH(MENU_ENUM_LABEL_VALUE_DRIVER_SETTINGS, + "أنظمة التشغيل") +MSG_HASH(MENU_ENUM_LABEL_VALUE_DUMMY_ON_CORE_SHUTDOWN, + "Load Dummy on Core Shutdown") +MSG_HASH(MENU_ENUM_LABEL_VALUE_CHECK_FOR_MISSING_FIRMWARE, + "Check for Missing Firmware Before Loading") +MSG_HASH(MENU_ENUM_LABEL_VALUE_DYNAMIC_WALLPAPER, + "Dynamic Background") +MSG_HASH(MENU_ENUM_LABEL_VALUE_DYNAMIC_WALLPAPERS_DIRECTORY, + "Dynamic Backgrounds") +MSG_HASH(MENU_ENUM_LABEL_VALUE_CHEEVOS_ENABLE, + "Enable Achievements") +MSG_HASH(MENU_ENUM_LABEL_VALUE_ENTRY_HOVER_COLOR, + "Menu entry hover color") +MSG_HASH(MENU_ENUM_LABEL_VALUE_ENTRY_NORMAL_COLOR, + "Menu entry normal color") +MSG_HASH(MENU_ENUM_LABEL_VALUE_FALSE, + "False") +MSG_HASH(MENU_ENUM_LABEL_VALUE_FASTFORWARD_RATIO, + "Maximum Run Speed") +MSG_HASH(MENU_ENUM_LABEL_VALUE_FAVORITES_TAB, + "Favorites") +MSG_HASH(MENU_ENUM_LABEL_VALUE_FPS_SHOW, + "Display Framerate") +MSG_HASH(MENU_ENUM_LABEL_VALUE_FRAME_THROTTLE_ENABLE, + "Limit Maximum Run Speed") +MSG_HASH(MENU_ENUM_LABEL_VALUE_FRAME_THROTTLE_SETTINGS, + "Frame Throttle") +MSG_HASH(MENU_ENUM_LABEL_VALUE_FRONTEND_COUNTERS, + "Frontend Counters") +MSG_HASH(MENU_ENUM_LABEL_VALUE_GAME_SPECIFIC_OPTIONS, + "Load Content-Specific Core Options Automatically") +MSG_HASH(MENU_ENUM_LABEL_VALUE_GAME_SPECIFIC_OPTIONS_CREATE, + "Create game-options file") +MSG_HASH(MENU_ENUM_LABEL_VALUE_GAME_SPECIFIC_OPTIONS_IN_USE, + "Game-options file") +MSG_HASH(MENU_ENUM_LABEL_VALUE_HELP, + "مساعدة") +MSG_HASH(MENU_ENUM_LABEL_VALUE_HELP_AUDIO_VIDEO_TROUBLESHOOTING, + "Audio/Video Troubleshooting") +MSG_HASH(MENU_ENUM_LABEL_VALUE_HELP_CHANGE_VIRTUAL_GAMEPAD, + "Changing Virtual Gamepad Overlay") +MSG_HASH(MENU_ENUM_LABEL_VALUE_HELP_CONTROLS, + "Basic Menu Controls") +MSG_HASH(MENU_ENUM_LABEL_VALUE_HELP_LIST, + "مساعدة") +MSG_HASH(MENU_ENUM_LABEL_VALUE_HELP_LOADING_CONTENT, + "Loading Content") +MSG_HASH(MENU_ENUM_LABEL_VALUE_HELP_SCANNING_CONTENT, + "Scanning For Content") +MSG_HASH(MENU_ENUM_LABEL_VALUE_HELP_WHAT_IS_A_CORE, + "What Is A Core?") +MSG_HASH(MENU_ENUM_LABEL_VALUE_HISTORY_LIST_ENABLE, + "History List Enable") +MSG_HASH(MENU_ENUM_LABEL_VALUE_HISTORY_TAB, + "History") +MSG_HASH(MENU_ENUM_LABEL_VALUE_HORIZONTAL_MENU, + "Horizontal Menu") +MSG_HASH(MENU_ENUM_LABEL_VALUE_IMAGES_TAB, + "Image") +MSG_HASH(MENU_ENUM_LABEL_VALUE_INFORMATION, + "معلومات") +MSG_HASH(MENU_ENUM_LABEL_VALUE_INFORMATION_LIST, + "معلومات") +MSG_HASH(MENU_ENUM_LABEL_VALUE_INPUT_ADC_TYPE, + "Analog To Digital Type") +MSG_HASH(MENU_ENUM_LABEL_VALUE_INPUT_ALL_USERS_CONTROL_MENU, + "All Users Control Menu") +MSG_HASH(MENU_ENUM_LABEL_VALUE_INPUT_ANALOG_LEFT_X, + "Left Analog X") +MSG_HASH(MENU_ENUM_LABEL_VALUE_INPUT_ANALOG_LEFT_X_MINUS, + "Left analog X- (left)") +MSG_HASH(MENU_ENUM_LABEL_VALUE_INPUT_ANALOG_LEFT_X_PLUS, + "Left analog X+ (right)") +MSG_HASH(MENU_ENUM_LABEL_VALUE_INPUT_ANALOG_LEFT_Y, + "Left Analog Y") +MSG_HASH(MENU_ENUM_LABEL_VALUE_INPUT_ANALOG_LEFT_Y_MINUS, + "Left analog Y- (up)") +MSG_HASH(MENU_ENUM_LABEL_VALUE_INPUT_ANALOG_LEFT_Y_PLUS, + "Left analog Y+ (down)") +MSG_HASH(MENU_ENUM_LABEL_VALUE_INPUT_ANALOG_RIGHT_X, + "Right Analog X") +MSG_HASH(MENU_ENUM_LABEL_VALUE_INPUT_ANALOG_RIGHT_X_MINUS, + "Right analog X- (left)") +MSG_HASH(MENU_ENUM_LABEL_VALUE_INPUT_ANALOG_RIGHT_X_PLUS, + "Right analog X+ (right)") +MSG_HASH(MENU_ENUM_LABEL_VALUE_INPUT_ANALOG_RIGHT_Y, + "Right Analog Y") +MSG_HASH(MENU_ENUM_LABEL_VALUE_INPUT_ANALOG_RIGHT_Y_MINUS, + "Right analog Y- (up)") +MSG_HASH(MENU_ENUM_LABEL_VALUE_INPUT_ANALOG_RIGHT_Y_PLUS, + "Right analog Y+ (down)") +MSG_HASH(MENU_ENUM_LABEL_VALUE_INPUT_LIGHTGUN_TRIGGER, + "Gun Trigger") +MSG_HASH(MENU_ENUM_LABEL_VALUE_INPUT_LIGHTGUN_RELOAD, + "Gun Reload") +MSG_HASH(MENU_ENUM_LABEL_VALUE_INPUT_LIGHTGUN_AUX_A, + "Gun Aux A") +MSG_HASH(MENU_ENUM_LABEL_VALUE_INPUT_LIGHTGUN_AUX_B, + "Gun Aux B") +MSG_HASH(MENU_ENUM_LABEL_VALUE_INPUT_LIGHTGUN_AUX_C, + "Gun Aux C") +MSG_HASH(MENU_ENUM_LABEL_VALUE_INPUT_LIGHTGUN_START, + "Gun Start") +MSG_HASH(MENU_ENUM_LABEL_VALUE_INPUT_LIGHTGUN_SELECT, + "Gun Select") +MSG_HASH(MENU_ENUM_LABEL_VALUE_INPUT_LIGHTGUN_DPAD_UP, + "Gun D-pad Up") +MSG_HASH(MENU_ENUM_LABEL_VALUE_INPUT_LIGHTGUN_DPAD_DOWN, + "Gun D-pad Down") +MSG_HASH(MENU_ENUM_LABEL_VALUE_INPUT_LIGHTGUN_DPAD_LEFT, + "Gun D-pad Left") +MSG_HASH(MENU_ENUM_LABEL_VALUE_INPUT_LIGHTGUN_DPAD_RIGHT, + "Gun D-pad Right") +MSG_HASH(MENU_ENUM_LABEL_VALUE_INPUT_AUTODETECT_ENABLE, + "Autoconfig Enable") +MSG_HASH(MENU_ENUM_LABEL_VALUE_INPUT_AXIS_THRESHOLD, + "Analog Stick Deadzone") +MSG_HASH(MENU_ENUM_LABEL_VALUE_MENU_INPUT_SWAP_OK_CANCEL, + "Menu Swap OK & Cancel Buttons") +MSG_HASH(MENU_ENUM_LABEL_VALUE_INPUT_BIND_ALL, + "Bind All") +MSG_HASH(MENU_ENUM_LABEL_VALUE_INPUT_BIND_DEFAULT_ALL, + "Bind Default All") +MSG_HASH(MENU_ENUM_LABEL_VALUE_INPUT_BIND_TIMEOUT, + "Bind Timeout") +MSG_HASH(MENU_ENUM_LABEL_VALUE_INPUT_DESCRIPTOR_HIDE_UNBOUND, + "Hide Unbound Core Input Descriptors") +MSG_HASH(MENU_ENUM_LABEL_VALUE_INPUT_DESCRIPTOR_LABEL_SHOW, + "Display Input Descriptor Labels") +MSG_HASH(MENU_ENUM_LABEL_VALUE_INPUT_DEVICE_INDEX, + "Device Index") +MSG_HASH(MENU_ENUM_LABEL_VALUE_INPUT_DEVICE_TYPE, + "Device Type") +MSG_HASH(MENU_ENUM_LABEL_VALUE_INPUT_MOUSE_INDEX, + "Mouse Index") +MSG_HASH(MENU_ENUM_LABEL_VALUE_INPUT_DRIVER, + "نظام تشغيل أجهزة الادخال") +MSG_HASH(MENU_ENUM_LABEL_VALUE_INPUT_DUTY_CYCLE, + "Duty Cycle") +MSG_HASH(MENU_ENUM_LABEL_VALUE_INPUT_HOTKEY_BINDS, + "Input Hotkey Binds") +MSG_HASH(MENU_ENUM_LABEL_VALUE_INPUT_ICADE_ENABLE, + "Keyboard Gamepad Mapping Enable") +MSG_HASH(MENU_ENUM_LABEL_VALUE_INPUT_JOYPAD_A, + "A button (right)") +MSG_HASH(MENU_ENUM_LABEL_VALUE_INPUT_JOYPAD_B, + "B button (down)") +MSG_HASH(MENU_ENUM_LABEL_VALUE_INPUT_JOYPAD_DOWN, + "Down D-pad") +MSG_HASH(MENU_ENUM_LABEL_VALUE_INPUT_JOYPAD_L2, + "L2 button (trigger)") +MSG_HASH(MENU_ENUM_LABEL_VALUE_INPUT_JOYPAD_L3, + "L3 button (thumb)") +MSG_HASH(MENU_ENUM_LABEL_VALUE_INPUT_JOYPAD_L, + "L button (shoulder)") +MSG_HASH(MENU_ENUM_LABEL_VALUE_INPUT_JOYPAD_LEFT, + "Left D-pad") +MSG_HASH(MENU_ENUM_LABEL_VALUE_INPUT_JOYPAD_R2, + "R2 button (trigger)") +MSG_HASH(MENU_ENUM_LABEL_VALUE_INPUT_JOYPAD_R3, + "R3 button (thumb)") +MSG_HASH(MENU_ENUM_LABEL_VALUE_INPUT_JOYPAD_R, + "R button (shoulder)") +MSG_HASH(MENU_ENUM_LABEL_VALUE_INPUT_JOYPAD_RIGHT, + "Right D-pad") +MSG_HASH(MENU_ENUM_LABEL_VALUE_INPUT_JOYPAD_SELECT, + "Select button") +MSG_HASH(MENU_ENUM_LABEL_VALUE_INPUT_JOYPAD_START, + "Start button") +MSG_HASH(MENU_ENUM_LABEL_VALUE_INPUT_JOYPAD_UP, + "Up D-pad") +MSG_HASH(MENU_ENUM_LABEL_VALUE_INPUT_JOYPAD_X, + "X button (top)") +MSG_HASH(MENU_ENUM_LABEL_VALUE_INPUT_JOYPAD_Y, + "Y button (left)") +MSG_HASH(MENU_ENUM_LABEL_VALUE_INPUT_KEY, + "(Key: %s)") +MSG_HASH(MENU_ENUM_LABEL_VALUE_INPUT_MOUSE_LEFT, + "Mouse 1") +MSG_HASH(MENU_ENUM_LABEL_VALUE_INPUT_MOUSE_RIGHT, + "Mouse 2") +MSG_HASH(MENU_ENUM_LABEL_VALUE_INPUT_MOUSE_MIDDLE, + "Mouse 3") +MSG_HASH(MENU_ENUM_LABEL_VALUE_INPUT_MOUSE_BUTTON4, + "Mouse 4") +MSG_HASH(MENU_ENUM_LABEL_VALUE_INPUT_MOUSE_BUTTON5, + "Mouse 5") +MSG_HASH(MENU_ENUM_LABEL_VALUE_INPUT_MOUSE_WHEEL_UP, + "Wheel Up") +MSG_HASH(MENU_ENUM_LABEL_VALUE_INPUT_MOUSE_WHEEL_DOWN, + "Wheel Down") +MSG_HASH(MENU_ENUM_LABEL_VALUE_INPUT_MOUSE_HORIZ_WHEEL_UP, + "Wheel Left") +MSG_HASH(MENU_ENUM_LABEL_VALUE_INPUT_MOUSE_HORIZ_WHEEL_DOWN, + "Wheel Right") +MSG_HASH(MENU_ENUM_LABEL_VALUE_INPUT_KEYBOARD_GAMEPAD_MAPPING_TYPE, + "Keyboard Gamepad Mapping Type") +MSG_HASH(MENU_ENUM_LABEL_VALUE_INPUT_MAX_USERS, + "Max Users") +MSG_HASH(MENU_ENUM_LABEL_VALUE_INPUT_MENU_ENUM_TOGGLE_GAMEPAD_COMBO, + "Menu Toggle Gamepad Combo") +MSG_HASH(MENU_ENUM_LABEL_VALUE_INPUT_META_CHEAT_INDEX_MINUS, + "Cheat index -") +MSG_HASH(MENU_ENUM_LABEL_VALUE_INPUT_META_CHEAT_INDEX_PLUS, + "Cheat index +") +MSG_HASH(MENU_ENUM_LABEL_VALUE_INPUT_META_CHEAT_TOGGLE, + "Cheat toggle") +MSG_HASH(MENU_ENUM_LABEL_VALUE_INPUT_META_DISK_EJECT_TOGGLE, + "Disk eject toggle") +MSG_HASH(MENU_ENUM_LABEL_VALUE_INPUT_META_DISK_NEXT, + "Disk next") +MSG_HASH(MENU_ENUM_LABEL_VALUE_INPUT_META_DISK_PREV, + "Disk prev") +MSG_HASH(MENU_ENUM_LABEL_VALUE_INPUT_META_ENABLE_HOTKEY, + "Enable hotkeys") +MSG_HASH(MENU_ENUM_LABEL_VALUE_INPUT_META_FAST_FORWARD_HOLD_KEY, + "Fast forward hold") +MSG_HASH(MENU_ENUM_LABEL_VALUE_INPUT_META_FAST_FORWARD_KEY, + "Fast forward toggle") +MSG_HASH(MENU_ENUM_LABEL_VALUE_INPUT_META_FRAMEADVANCE, + "Frameadvance") +MSG_HASH(MENU_ENUM_LABEL_VALUE_INPUT_META_FULLSCREEN_TOGGLE_KEY, + "Fullscreen toggle") +MSG_HASH(MENU_ENUM_LABEL_VALUE_INPUT_META_GRAB_MOUSE_TOGGLE, + "Grab mouse toggle") +MSG_HASH(MENU_ENUM_LABEL_VALUE_INPUT_META_GAME_FOCUS_TOGGLE, + "Game focus toggle") +MSG_HASH(MENU_ENUM_LABEL_VALUE_INPUT_META_LOAD_STATE_KEY, + "Load state") +MSG_HASH(MENU_ENUM_LABEL_VALUE_INPUT_META_MENU_TOGGLE, + "Menu toggle") +MSG_HASH(MENU_ENUM_LABEL_VALUE_INPUT_META_MOVIE_RECORD_TOGGLE, + "Movie record toggle") +MSG_HASH(MENU_ENUM_LABEL_VALUE_INPUT_META_MUTE, + "Audio mute toggle") +MSG_HASH(MENU_ENUM_LABEL_VALUE_INPUT_META_NETPLAY_GAME_WATCH, + "Netplay toggle play/spectate mode") +MSG_HASH(MENU_ENUM_LABEL_VALUE_INPUT_META_OSK, + "On-screen keyboard toggle") +MSG_HASH(MENU_ENUM_LABEL_VALUE_INPUT_META_OVERLAY_NEXT, + "Overlay next") +MSG_HASH(MENU_ENUM_LABEL_VALUE_INPUT_META_PAUSE_TOGGLE, + "Pause toggle") +MSG_HASH(MENU_ENUM_LABEL_VALUE_INPUT_META_QUIT_KEY, + "Quit RetroArch") +MSG_HASH(MENU_ENUM_LABEL_VALUE_INPUT_META_RESET, + "Reset game") +MSG_HASH(MENU_ENUM_LABEL_VALUE_INPUT_META_REWIND, + "Rewind") +MSG_HASH(MENU_ENUM_LABEL_VALUE_INPUT_META_SAVE_STATE_KEY, + "Save state") +MSG_HASH(MENU_ENUM_LABEL_VALUE_INPUT_META_SCREENSHOT, + "Take screenshot") +MSG_HASH(MENU_ENUM_LABEL_VALUE_INPUT_META_SHADER_NEXT, + "Next shader") +MSG_HASH(MENU_ENUM_LABEL_VALUE_INPUT_META_SHADER_PREV, + "Previous shader") +MSG_HASH(MENU_ENUM_LABEL_VALUE_INPUT_META_SLOWMOTION, + "Slow motion") +MSG_HASH(MENU_ENUM_LABEL_VALUE_INPUT_META_STATE_SLOT_MINUS, + "Savestate slot -") +MSG_HASH(MENU_ENUM_LABEL_VALUE_INPUT_META_STATE_SLOT_PLUS, + "Savestate slot +") +MSG_HASH(MENU_ENUM_LABEL_VALUE_INPUT_META_VOLUME_DOWN, + "Volume -") +MSG_HASH(MENU_ENUM_LABEL_VALUE_INPUT_META_VOLUME_UP, + "Volume +") +MSG_HASH(MENU_ENUM_LABEL_VALUE_INPUT_OVERLAY_ENABLE, + "Display Overlay") +MSG_HASH(MENU_ENUM_LABEL_VALUE_INPUT_OVERLAY_HIDE_IN_MENU, + "Hide Overlay In Menu") +MSG_HASH(MENU_ENUM_LABEL_VALUE_INPUT_OVERLAY_SHOW_PHYSICAL_INPUTS, + "Show Inputs On Overlay") +MSG_HASH(MENU_ENUM_LABEL_VALUE_INPUT_OVERLAY_SHOW_PHYSICAL_INPUTS_PORT, + "Show Inputs Listen Port") +MSG_HASH(MENU_ENUM_LABEL_VALUE_INPUT_POLL_TYPE_BEHAVIOR, + "Poll Type Behavior") +MSG_HASH(MENU_ENUM_LABEL_VALUE_INPUT_POLL_TYPE_BEHAVIOR_EARLY, + "Early") +MSG_HASH(MENU_ENUM_LABEL_VALUE_INPUT_POLL_TYPE_BEHAVIOR_LATE, + "Late") +MSG_HASH(MENU_ENUM_LABEL_VALUE_INPUT_POLL_TYPE_BEHAVIOR_NORMAL, + "Normal") +MSG_HASH(MENU_ENUM_LABEL_VALUE_INPUT_PREFER_FRONT_TOUCH, + "Prefer Front Touch") +MSG_HASH(MENU_ENUM_LABEL_VALUE_INPUT_REMAPPING_DIRECTORY, + "Input Remapping") +MSG_HASH(MENU_ENUM_LABEL_VALUE_INPUT_REMAP_BINDS_ENABLE, + "Remap Binds Enable") +MSG_HASH(MENU_ENUM_LABEL_VALUE_INPUT_SAVE_AUTOCONFIG, + "Save Autoconfig") +MSG_HASH(MENU_ENUM_LABEL_VALUE_INPUT_SETTINGS, + "أجهزة الادخال") +MSG_HASH(MENU_ENUM_LABEL_VALUE_INPUT_SMALL_KEYBOARD_ENABLE, + "Small Keyboard Enable") +MSG_HASH(MENU_ENUM_LABEL_VALUE_INPUT_TOUCH_ENABLE, + "Touch Enable") +MSG_HASH(MENU_ENUM_LABEL_VALUE_INPUT_TURBO_ENABLE, + "Turbo enable") +MSG_HASH(MENU_ENUM_LABEL_VALUE_INPUT_TURBO_PERIOD, + "Turbo Period") +MSG_HASH(MENU_ENUM_LABEL_VALUE_INPUT_USER_BINDS, + "Input User %u Binds") +MSG_HASH(MENU_ENUM_LABEL_VALUE_INTERNAL_STORAGE_STATUS, + "Internal storage status") +MSG_HASH(MENU_ENUM_LABEL_VALUE_JOYPAD_AUTOCONFIG_DIR, + "Input Autoconfig") +MSG_HASH(MENU_ENUM_LABEL_VALUE_JOYPAD_DRIVER, + "نظام تشغيل الجوي باد") +MSG_HASH(MENU_ENUM_LABEL_VALUE_LAKKA_SERVICES, + "Services") +MSG_HASH(MENU_ENUM_LABEL_VALUE_LANG_CHINESE_SIMPLIFIED, + "Chinese (Simplified)") +MSG_HASH(MENU_ENUM_LABEL_VALUE_LANG_CHINESE_TRADITIONAL, + "Chinese (Traditional)") +MSG_HASH(MENU_ENUM_LABEL_VALUE_LANG_DUTCH, + "Dutch") +MSG_HASH(MENU_ENUM_LABEL_VALUE_LANG_ENGLISH, + "English") +MSG_HASH(MENU_ENUM_LABEL_VALUE_LANG_ESPERANTO, + "Esperanto") +MSG_HASH(MENU_ENUM_LABEL_VALUE_LANG_FRENCH, + "French") +MSG_HASH(MENU_ENUM_LABEL_VALUE_LANG_GERMAN, + "German") +MSG_HASH(MENU_ENUM_LABEL_VALUE_LANG_ITALIAN, + "Italian") +MSG_HASH(MENU_ENUM_LABEL_VALUE_LANG_JAPANESE, + "Japanese") +MSG_HASH(MENU_ENUM_LABEL_VALUE_LANG_KOREAN, + "Korean") +MSG_HASH(MENU_ENUM_LABEL_VALUE_LANG_POLISH, + "Polish") +MSG_HASH(MENU_ENUM_LABEL_VALUE_LANG_PORTUGUESE_BRAZIL, + "Portuguese (Brazil)") +MSG_HASH(MENU_ENUM_LABEL_VALUE_LANG_PORTUGUESE_PORTUGAL, + "Portuguese (Portugal)") +MSG_HASH(MENU_ENUM_LABEL_VALUE_LANG_RUSSIAN, + "Russian") +MSG_HASH(MENU_ENUM_LABEL_VALUE_LANG_SPANISH, + "Spanish") +MSG_HASH(MENU_ENUM_LABEL_VALUE_LANG_VIETNAMESE, + "Vietnamese") +MSG_HASH(MENU_ENUM_LABEL_VALUE_LANG_ARABIC, + "عربى") +MSG_HASH(MENU_ENUM_LABEL_VALUE_LEFT_ANALOG, + "Left Analog") +MSG_HASH(MENU_ENUM_LABEL_VALUE_LIBRETRO_DIR_PATH, + "Core") +MSG_HASH(MENU_ENUM_LABEL_VALUE_LIBRETRO_INFO_PATH, + "Core Info") +MSG_HASH(MENU_ENUM_LABEL_VALUE_LIBRETRO_LOG_LEVEL, + "Core Logging Level") +MSG_HASH(MENU_ENUM_LABEL_VALUE_LINEAR, + "Linear") +MSG_HASH(MENU_ENUM_LABEL_VALUE_LOAD_ARCHIVE, + "Load Archive") +MSG_HASH(MENU_ENUM_LABEL_VALUE_LOAD_CONTENT_HISTORY, + "Load Recent") +MSG_HASH(MENU_ENUM_LABEL_VALUE_LOAD_CONTENT_LIST, + "تحميل المحتوى") +MSG_HASH(MENU_ENUM_LABEL_VALUE_LOAD_STATE, + "Load State") +MSG_HASH(MENU_ENUM_LABEL_VALUE_LOCATION_ALLOW, + "Allow Location") +MSG_HASH(MENU_ENUM_LABEL_VALUE_LOCATION_DRIVER, + "Location Driver") +MSG_HASH(MENU_ENUM_LABEL_VALUE_LOGGING_SETTINGS, + "Logging") +MSG_HASH(MENU_ENUM_LABEL_VALUE_LOG_VERBOSITY, + "Logging Verbosity") +MSG_HASH(MENU_ENUM_LABEL_VALUE_MAIN_MENU, + "القائمة الرئيسية") +MSG_HASH(MENU_ENUM_LABEL_VALUE_MANAGEMENT, + "Database Settings") +MSG_HASH(MENU_ENUM_LABEL_VALUE_MATERIALUI_MENU_COLOR_THEME, + "Menu Color Theme") +MSG_HASH(MENU_ENUM_LABEL_VALUE_MATERIALUI_MENU_COLOR_THEME_BLUE, + "Blue") +MSG_HASH(MENU_ENUM_LABEL_VALUE_MATERIALUI_MENU_COLOR_THEME_BLUE_GREY, + "Blue Grey") +MSG_HASH(MENU_ENUM_LABEL_VALUE_MATERIALUI_MENU_COLOR_THEME_DARK_BLUE, + "Dark Blue") +MSG_HASH(MENU_ENUM_LABEL_VALUE_MATERIALUI_MENU_COLOR_THEME_GREEN, + "Green") +MSG_HASH(MENU_ENUM_LABEL_VALUE_MATERIALUI_MENU_COLOR_THEME_NVIDIA_SHIELD, + "Shield") +MSG_HASH(MENU_ENUM_LABEL_VALUE_MATERIALUI_MENU_COLOR_THEME_RED, + "Red") +MSG_HASH(MENU_ENUM_LABEL_VALUE_MATERIALUI_MENU_COLOR_THEME_YELLOW, + "Yellow") +MSG_HASH(MENU_ENUM_LABEL_VALUE_MATERIALUI_MENU_FOOTER_OPACITY, + "Footer Opacity") +MSG_HASH(MENU_ENUM_LABEL_VALUE_MATERIALUI_MENU_HEADER_OPACITY, + "Header Opacity") +MSG_HASH(MENU_ENUM_LABEL_VALUE_MENU_DRIVER, + "نظام تشغيل القائمة") +MSG_HASH(MENU_ENUM_LABEL_VALUE_MENU_ENUM_THROTTLE_FRAMERATE, + "Throttle Menu Framerate") +MSG_HASH(MENU_ENUM_LABEL_VALUE_MENU_FILE_BROWSER_SETTINGS, + "Settings") +MSG_HASH(MENU_ENUM_LABEL_VALUE_MENU_LINEAR_FILTER, + "Menu Linear Filter") +MSG_HASH(MENU_ENUM_LABEL_VALUE_MENU_HORIZONTAL_ANIMATION, + "Horizontal Animation") +MSG_HASH(MENU_ENUM_LABEL_VALUE_MENU_SETTINGS, + "Appearance") +MSG_HASH(MENU_ENUM_LABEL_VALUE_MENU_WALLPAPER, + "Background") +MSG_HASH(MENU_ENUM_LABEL_VALUE_MENU_WALLPAPER_OPACITY, + "Background opacity") +MSG_HASH(MENU_ENUM_LABEL_VALUE_MISSING, + "Missing") +MSG_HASH(MENU_ENUM_LABEL_VALUE_MORE, + "...") +MSG_HASH(MENU_ENUM_LABEL_VALUE_MOUSE_ENABLE, + "Mouse Support") +MSG_HASH(MENU_ENUM_LABEL_VALUE_MULTIMEDIA_SETTINGS, + "Multimedia") +MSG_HASH(MENU_ENUM_LABEL_VALUE_MUSIC_TAB, + "Music") +MSG_HASH(MENU_ENUM_LABEL_VALUE_NAVIGATION_BROWSER_FILTER_SUPPORTED_EXTENSIONS_ENABLE, + "Filter unknown extensions") +MSG_HASH(MENU_ENUM_LABEL_VALUE_NAVIGATION_WRAPAROUND, + "Navigation Wrap-Around") +MSG_HASH(MENU_ENUM_LABEL_VALUE_NEAREST, + "Nearest") +MSG_HASH(MENU_ENUM_LABEL_VALUE_NETPLAY, + "Netplay") +MSG_HASH(MENU_ENUM_LABEL_VALUE_NETPLAY_ALLOW_SLAVES, + "Allow Slave-Mode Clients") +MSG_HASH(MENU_ENUM_LABEL_VALUE_NETPLAY_CHECK_FRAMES, + "Netplay Check Frames") +MSG_HASH(MENU_ENUM_LABEL_VALUE_NETPLAY_INPUT_LATENCY_FRAMES_MIN, + "Input Latency Frames") +MSG_HASH(MENU_ENUM_LABEL_VALUE_NETPLAY_INPUT_LATENCY_FRAMES_RANGE, + "Input Latency Frames Range") +MSG_HASH(MENU_ENUM_LABEL_VALUE_NETPLAY_DELAY_FRAMES, + "Netplay Delay Frames") +MSG_HASH(MENU_ENUM_LABEL_VALUE_NETPLAY_DISCONNECT, + "Disconnect from netplay host") +MSG_HASH(MENU_ENUM_LABEL_VALUE_NETPLAY_ENABLE, + "Netplay Enable") +MSG_HASH(MENU_ENUM_LABEL_VALUE_NETPLAY_ENABLE_CLIENT, + "Connect to netplay host") +MSG_HASH(MENU_ENUM_LABEL_VALUE_NETPLAY_ENABLE_HOST, + "Start netplay host") +MSG_HASH(MENU_ENUM_LABEL_VALUE_NETPLAY_DISABLE_HOST, + "Stop netplay host") +MSG_HASH(MENU_ENUM_LABEL_VALUE_NETPLAY_IP_ADDRESS, + "Server Address") +MSG_HASH(MENU_ENUM_LABEL_VALUE_NETPLAY_LAN_SCAN_SETTINGS, + "Scan local network") +MSG_HASH(MENU_ENUM_LABEL_VALUE_NETPLAY_MODE, + "Netplay Client Enable") +MSG_HASH(MENU_ENUM_LABEL_VALUE_NETPLAY_NICKNAME, + "Username") +MSG_HASH(MENU_ENUM_LABEL_VALUE_NETPLAY_PASSWORD, + "Server Password") +MSG_HASH(MENU_ENUM_LABEL_VALUE_NETPLAY_PUBLIC_ANNOUNCE, + "Publicly Announce Netplay") +MSG_HASH(MENU_ENUM_LABEL_VALUE_NETPLAY_REQUEST_DEVICE_I, + "Request Device %u") +MSG_HASH(MENU_ENUM_LABEL_VALUE_NETPLAY_REQUIRE_SLAVES, + "Disallow Non-Slave-Mode Clients") +MSG_HASH(MENU_ENUM_LABEL_VALUE_NETPLAY_SETTINGS, + "Netplay settings") +MSG_HASH(MENU_ENUM_LABEL_VALUE_NETPLAY_SHARE_ANALOG, + "Analog Input Sharing") +MSG_HASH(MENU_ENUM_LABEL_VALUE_NETPLAY_SHARE_ANALOG_MAX, + "Max") +MSG_HASH(MENU_ENUM_LABEL_VALUE_NETPLAY_SHARE_ANALOG_AVERAGE, + "Average") +MSG_HASH(MENU_ENUM_LABEL_VALUE_NETPLAY_SHARE_DIGITAL, + "Digital Input Sharing") +MSG_HASH(MENU_ENUM_LABEL_VALUE_NETPLAY_SHARE_DIGITAL_OR, + "Share") +MSG_HASH(MENU_ENUM_LABEL_VALUE_NETPLAY_SHARE_DIGITAL_XOR, + "Grapple") +MSG_HASH(MENU_ENUM_LABEL_VALUE_NETPLAY_SHARE_DIGITAL_VOTE, + "Vote") +MSG_HASH(MENU_ENUM_LABEL_VALUE_NETPLAY_SHARE_NONE, + "None") +MSG_HASH(MENU_ENUM_LABEL_VALUE_NETPLAY_SHARE_NO_PREFERENCE, + "No preference") +MSG_HASH(MENU_ENUM_LABEL_VALUE_NETPLAY_START_AS_SPECTATOR, + "Netplay Spectator Mode") +MSG_HASH(MENU_ENUM_LABEL_VALUE_NETPLAY_STATELESS_MODE, + "Netplay Stateless Mode") +MSG_HASH(MENU_ENUM_LABEL_VALUE_NETPLAY_SPECTATE_PASSWORD, + "Server Spectate-Only Password") +MSG_HASH(MENU_ENUM_LABEL_VALUE_NETPLAY_SPECTATOR_MODE_ENABLE, + "Netplay Spectator Enable") +MSG_HASH(MENU_ENUM_LABEL_VALUE_NETPLAY_TCP_UDP_PORT, + "Netplay TCP Port") +MSG_HASH(MENU_ENUM_LABEL_VALUE_NETPLAY_NAT_TRAVERSAL, + "Netplay NAT Traversal") +MSG_HASH(MENU_ENUM_LABEL_VALUE_NETWORK_CMD_ENABLE, + "Network Commands") +MSG_HASH(MENU_ENUM_LABEL_VALUE_NETWORK_CMD_PORT, + "Network Command Port") +MSG_HASH(MENU_ENUM_LABEL_VALUE_NETWORK_INFORMATION, + "Network Information") +MSG_HASH(MENU_ENUM_LABEL_VALUE_NETWORK_REMOTE_ENABLE, + "Network Gamepad") +MSG_HASH(MENU_ENUM_LABEL_VALUE_NETWORK_REMOTE_PORT, + "Network Remote Base Port") +MSG_HASH(MENU_ENUM_LABEL_VALUE_NETWORK_SETTINGS, + "الشبكة") +MSG_HASH(MENU_ENUM_LABEL_VALUE_NO, + "No") +MSG_HASH(MENU_ENUM_LABEL_VALUE_NONE, + "None") +MSG_HASH(MENU_ENUM_LABEL_VALUE_NOT_AVAILABLE, + "N/A") +MSG_HASH(MENU_ENUM_LABEL_VALUE_NO_ACHIEVEMENTS_TO_DISPLAY, + "No achievements to display.") +MSG_HASH(MENU_ENUM_LABEL_VALUE_NO_CORE, + "No Core") +MSG_HASH(MENU_ENUM_LABEL_VALUE_NO_CORES_AVAILABLE, + "No cores available.") +MSG_HASH(MENU_ENUM_LABEL_VALUE_NO_CORE_INFORMATION_AVAILABLE, + "No core information available.") +MSG_HASH(MENU_ENUM_LABEL_VALUE_NO_CORE_OPTIONS_AVAILABLE, + "No core options available.") +MSG_HASH(MENU_ENUM_LABEL_VALUE_NO_ENTRIES_TO_DISPLAY, + "No entries to display.") +MSG_HASH(MENU_ENUM_LABEL_VALUE_NO_HISTORY_AVAILABLE, + "No history available.") +MSG_HASH(MENU_ENUM_LABEL_VALUE_NO_INFORMATION_AVAILABLE, + "No information is available.") +MSG_HASH(MENU_ENUM_LABEL_VALUE_NO_ITEMS, + "No items.") +MSG_HASH(MENU_ENUM_LABEL_VALUE_NO_NETPLAY_HOSTS_FOUND, + "No netplay hosts found.") +MSG_HASH(MENU_ENUM_LABEL_VALUE_NO_NETWORKS_FOUND, + "No networks found.") +MSG_HASH(MENU_ENUM_LABEL_VALUE_NO_PERFORMANCE_COUNTERS, + "No performance counters.") +MSG_HASH(MENU_ENUM_LABEL_VALUE_NO_PLAYLISTS, + "No playlists.") +MSG_HASH(MENU_ENUM_LABEL_VALUE_NO_PLAYLIST_ENTRIES_AVAILABLE, + "No playlist entries available.") +MSG_HASH(MENU_ENUM_LABEL_VALUE_NO_SETTINGS_FOUND, + "No settings found.") +MSG_HASH(MENU_ENUM_LABEL_VALUE_NO_SHADER_PARAMETERS, + "No shader parameters.") +MSG_HASH(MENU_ENUM_LABEL_VALUE_OFF, + "OFF") +MSG_HASH(MENU_ENUM_LABEL_VALUE_ON, + "ON") +MSG_HASH(MENU_ENUM_LABEL_VALUE_ONLINE, + "Online") +MSG_HASH(MENU_ENUM_LABEL_VALUE_ONLINE_UPDATER, + "التحديث عبر الانترنت") +MSG_HASH(MENU_ENUM_LABEL_VALUE_ONSCREEN_DISPLAY_SETTINGS, + "العرض على الشاشة") +MSG_HASH(MENU_ENUM_LABEL_VALUE_ONSCREEN_OVERLAY_SETTINGS, + "Onscreen Overlay") +MSG_HASH(MENU_ENUM_LABEL_VALUE_ONSCREEN_NOTIFICATIONS_SETTINGS, + "Onscreen Notifications") +MSG_HASH(MENU_ENUM_LABEL_VALUE_OPEN_ARCHIVE, + "Browse Archive") +MSG_HASH(MENU_ENUM_LABEL_VALUE_OPTIONAL, + "Optional") +MSG_HASH(MENU_ENUM_LABEL_VALUE_OVERLAY, + "Overlay") +MSG_HASH(MENU_ENUM_LABEL_VALUE_OVERLAY_AUTOLOAD_PREFERRED, + "Autoload Preferred Overlay") +MSG_HASH(MENU_ENUM_LABEL_VALUE_OVERLAY_DIRECTORY, + "Overlay") +MSG_HASH(MENU_ENUM_LABEL_VALUE_OVERLAY_OPACITY, + "Overlay Opacity") +MSG_HASH(MENU_ENUM_LABEL_VALUE_OVERLAY_PRESET, + "Overlay Preset") +MSG_HASH(MENU_ENUM_LABEL_VALUE_OVERLAY_SCALE, + "Overlay Scale") +MSG_HASH(MENU_ENUM_LABEL_VALUE_OVERLAY_SETTINGS, + "Onscreen Overlay") +MSG_HASH(MENU_ENUM_LABEL_VALUE_PAL60_ENABLE, + "Use PAL60 Mode") +MSG_HASH(MENU_ENUM_LABEL_VALUE_PARENT_DIRECTORY, + "Parent directory") +MSG_HASH(MENU_ENUM_LABEL_VALUE_PAUSE_LIBRETRO, + "Pause when menu activated") +MSG_HASH(MENU_ENUM_LABEL_VALUE_PAUSE_NONACTIVE, + "Don't run in background") +MSG_HASH(MENU_ENUM_LABEL_VALUE_PERFCNT_ENABLE, + "Performance Counters") +MSG_HASH(MENU_ENUM_LABEL_VALUE_PLAYLISTS_TAB, + "قوائم التشغيل") +MSG_HASH(MENU_ENUM_LABEL_VALUE_PLAYLIST_DIRECTORY, + "قائمة التشغيل") +MSG_HASH(MENU_ENUM_LABEL_VALUE_PLAYLIST_SETTINGS, + "قوائم التشغيل") +MSG_HASH(MENU_ENUM_LABEL_VALUE_POINTER_ENABLE, + "Touch Support") +MSG_HASH(MENU_ENUM_LABEL_VALUE_PORT, + "Port") +MSG_HASH(MENU_ENUM_LABEL_VALUE_PRESENT, + "Present") +MSG_HASH(MENU_ENUM_LABEL_VALUE_PRIVACY_SETTINGS, + "خصوصية") +MSG_HASH(MENU_ENUM_LABEL_VALUE_QUIT_RETROARCH, + "إنهاء البرنامج") +MSG_HASH(MENU_ENUM_LABEL_VALUE_RDB_ENTRY_ANALOG, + "Analog supported") +MSG_HASH(MENU_ENUM_LABEL_VALUE_RDB_ENTRY_BBFC_RATING, + "BBFC Rating") +MSG_HASH(MENU_ENUM_LABEL_VALUE_RDB_ENTRY_CERO_RATING, + "CERO Rating") +MSG_HASH(MENU_ENUM_LABEL_VALUE_RDB_ENTRY_COOP, + "Co-op supported") +MSG_HASH(MENU_ENUM_LABEL_VALUE_RDB_ENTRY_CRC32, + "CRC32") +MSG_HASH(MENU_ENUM_LABEL_VALUE_RDB_ENTRY_DESCRIPTION, + "Description") +MSG_HASH(MENU_ENUM_LABEL_VALUE_RDB_ENTRY_DEVELOPER, + "Developer") +MSG_HASH(MENU_ENUM_LABEL_VALUE_RDB_ENTRY_EDGE_MAGAZINE_ISSUE, + "Edge Magazine Issue") +MSG_HASH(MENU_ENUM_LABEL_VALUE_RDB_ENTRY_EDGE_MAGAZINE_RATING, + "Edge Magazine Rating") +MSG_HASH(MENU_ENUM_LABEL_VALUE_RDB_ENTRY_EDGE_MAGAZINE_REVIEW, + "Edge Magazine Review") +MSG_HASH(MENU_ENUM_LABEL_VALUE_RDB_ENTRY_ELSPA_RATING, + "ELSPA Rating") +MSG_HASH(MENU_ENUM_LABEL_VALUE_RDB_ENTRY_ENHANCEMENT_HW, + "Enhancement Hardware") +MSG_HASH(MENU_ENUM_LABEL_VALUE_RDB_ENTRY_ESRB_RATING, + "ESRB Rating") +MSG_HASH(MENU_ENUM_LABEL_VALUE_RDB_ENTRY_FAMITSU_MAGAZINE_RATING, + "Famitsu Magazine Rating") +MSG_HASH(MENU_ENUM_LABEL_VALUE_RDB_ENTRY_FRANCHISE, + "Franchise") +MSG_HASH(MENU_ENUM_LABEL_VALUE_RDB_ENTRY_GENRE, + "Genre") +MSG_HASH(MENU_ENUM_LABEL_VALUE_RDB_ENTRY_MD5, + "MD5") +MSG_HASH(MENU_ENUM_LABEL_VALUE_RDB_ENTRY_NAME, + "Name") +MSG_HASH(MENU_ENUM_LABEL_VALUE_RDB_ENTRY_ORIGIN, + "Origin") +MSG_HASH(MENU_ENUM_LABEL_VALUE_RDB_ENTRY_PEGI_RATING, + "PEGI Rating") +MSG_HASH(MENU_ENUM_LABEL_VALUE_RDB_ENTRY_PUBLISHER, + "Publisher") +MSG_HASH(MENU_ENUM_LABEL_VALUE_RDB_ENTRY_RELEASE_MONTH, + "Releasedate Month") +MSG_HASH(MENU_ENUM_LABEL_VALUE_RDB_ENTRY_RELEASE_YEAR, + "Releasedate Year") +MSG_HASH(MENU_ENUM_LABEL_VALUE_RDB_ENTRY_RUMBLE, + "Rumble supported") +MSG_HASH(MENU_ENUM_LABEL_VALUE_RDB_ENTRY_SERIAL, + "Serial") +MSG_HASH(MENU_ENUM_LABEL_VALUE_RDB_ENTRY_SHA1, + "SHA1") +MSG_HASH(MENU_ENUM_LABEL_VALUE_RDB_ENTRY_START_CONTENT, + "Start Content") +MSG_HASH(MENU_ENUM_LABEL_VALUE_RDB_ENTRY_TGDB_RATING, + "TGDB Rating") +MSG_HASH(MENU_ENUM_LABEL_VALUE_REBOOT, + "Reboot") +MSG_HASH(MENU_ENUM_LABEL_VALUE_RECORDING_CONFIG_DIRECTORY, + "Recording Config") +MSG_HASH(MENU_ENUM_LABEL_VALUE_RECORDING_OUTPUT_DIRECTORY, + "Recording Output") +MSG_HASH(MENU_ENUM_LABEL_VALUE_RECORDING_SETTINGS, + "Recording") +MSG_HASH(MENU_ENUM_LABEL_VALUE_RECORD_CONFIG, + "Load Recording Config...") +MSG_HASH(MENU_ENUM_LABEL_VALUE_RECORD_DRIVER, + "نظام تشغيل التسجيل") +MSG_HASH(MENU_ENUM_LABEL_VALUE_RECORD_ENABLE, + "Enable Recording") +MSG_HASH(MENU_ENUM_LABEL_VALUE_RECORD_PATH, + "Save Output Recording as...") +MSG_HASH(MENU_ENUM_LABEL_VALUE_RECORD_USE_OUTPUT_DIRECTORY, + "Save Recordings in Output Dir") +MSG_HASH(MENU_ENUM_LABEL_VALUE_REMAP_FILE, + "Remap File") +MSG_HASH(MENU_ENUM_LABEL_VALUE_REMAP_FILE_LOAD, + "Load Remap File") +MSG_HASH(MENU_ENUM_LABEL_VALUE_REMAP_FILE_SAVE_CORE, + "Save Core Remap File") +MSG_HASH(MENU_ENUM_LABEL_VALUE_REMAP_FILE_SAVE_GAME, + "Save Game Remap File") +MSG_HASH(MENU_ENUM_LABEL_VALUE_REMAP_FILE_REMOVE_CORE, + "Delete Core Remap File") +MSG_HASH(MENU_ENUM_LABEL_VALUE_REMAP_FILE_REMOVE_GAME, + "Delete Game Remap File") +MSG_HASH(MENU_ENUM_LABEL_VALUE_REQUIRED, + "Required") +MSG_HASH(MENU_ENUM_LABEL_VALUE_RESTART_CONTENT, + "Restart") +MSG_HASH(MENU_ENUM_LABEL_VALUE_RESTART_RETROARCH, + "Restart RetroArch") +MSG_HASH(MENU_ENUM_LABEL_VALUE_RESUME, + "Resume") +MSG_HASH(MENU_ENUM_LABEL_VALUE_RESUME_CONTENT, + "Resume") +MSG_HASH(MENU_ENUM_LABEL_VALUE_RETROKEYBOARD, + "RetroKeyboard") +MSG_HASH(MENU_ENUM_LABEL_VALUE_RETROPAD, + "RetroPad") +MSG_HASH(MENU_ENUM_LABEL_VALUE_RETROPAD_WITH_ANALOG, + "RetroPad w/ Analog") +MSG_HASH(MENU_ENUM_LABEL_VALUE_RETRO_ACHIEVEMENTS_SETTINGS, + "الإنجازات") +MSG_HASH(MENU_ENUM_LABEL_VALUE_REWIND_ENABLE, + "Rewind Enable") +MSG_HASH(MENU_ENUM_LABEL_VALUE_REWIND_GRANULARITY, + "Rewind Granularity") +MSG_HASH(MENU_ENUM_LABEL_VALUE_REWIND_SETTINGS, + "Rewind") +MSG_HASH(MENU_ENUM_LABEL_VALUE_RGUI_BROWSER_DIRECTORY, + "File Browser") +MSG_HASH(MENU_ENUM_LABEL_VALUE_RGUI_CONFIG_DIRECTORY, + "Config") +MSG_HASH(MENU_ENUM_LABEL_VALUE_RGUI_SHOW_START_SCREEN, + "Display Start Screen") +MSG_HASH(MENU_ENUM_LABEL_VALUE_RIGHT_ANALOG, + "Right Analog") +MSG_HASH(MENU_ENUM_LABEL_VALUE_ADD_TO_FAVORITES, + "Add to Favorites") +MSG_HASH(MENU_ENUM_LABEL_VALUE_ADD_TO_FAVORITES_PLAYLIST, + "Add to Favorites") +MSG_HASH(MENU_ENUM_LABEL_VALUE_RUN, + "Run") +MSG_HASH(MENU_ENUM_LABEL_VALUE_RUN_MUSIC, + "Run") +MSG_HASH(MENU_ENUM_LABEL_VALUE_SAMBA_ENABLE, + "SAMBA Enable") +MSG_HASH(MENU_ENUM_LABEL_VALUE_SAVEFILE_DIRECTORY, + "Savefile") +MSG_HASH(MENU_ENUM_LABEL_VALUE_SAVESTATE_AUTO_INDEX, + "Save State Auto Index") +MSG_HASH(MENU_ENUM_LABEL_VALUE_SAVESTATE_AUTO_LOAD, + "Auto Load State") +MSG_HASH(MENU_ENUM_LABEL_VALUE_SAVESTATE_AUTO_SAVE, + "Auto Save State") +MSG_HASH(MENU_ENUM_LABEL_VALUE_SAVESTATE_DIRECTORY, + "Savestate") +MSG_HASH(MENU_ENUM_LABEL_VALUE_SAVESTATE_THUMBNAIL_ENABLE, + "Savestate Thumbnails") +MSG_HASH(MENU_ENUM_LABEL_VALUE_SAVE_CURRENT_CONFIG, + "Save Current Configuration") +MSG_HASH(MENU_ENUM_LABEL_VALUE_SAVE_CURRENT_CONFIG_OVERRIDE_CORE, + "Save Core Overrides") +MSG_HASH(MENU_ENUM_LABEL_VALUE_SAVE_CURRENT_CONFIG_OVERRIDE_GAME, + "Save Game Overrides") +MSG_HASH(MENU_ENUM_LABEL_VALUE_SAVE_NEW_CONFIG, + "Save New Configuration") +MSG_HASH(MENU_ENUM_LABEL_VALUE_SAVE_STATE, + "Save State") +MSG_HASH(MENU_ENUM_LABEL_VALUE_SAVING_SETTINGS, + "الحفظ") +MSG_HASH(MENU_ENUM_LABEL_VALUE_SCAN_DIRECTORY, + "Scan Directory") +MSG_HASH(MENU_ENUM_LABEL_VALUE_SCAN_FILE, + "Scan File") +MSG_HASH(MENU_ENUM_LABEL_VALUE_SCAN_THIS_DIRECTORY, + "") +MSG_HASH(MENU_ENUM_LABEL_VALUE_SCREENSHOT_DIRECTORY, + "Screenshot") +MSG_HASH(MENU_ENUM_LABEL_VALUE_SCREEN_RESOLUTION, + "Screen Resolution") +MSG_HASH(MENU_ENUM_LABEL_VALUE_SEARCH, + "Search") +MSG_HASH(MENU_ENUM_LABEL_VALUE_SECONDS, + "seconds") +MSG_HASH(MENU_ENUM_LABEL_VALUE_SETTINGS, + "Settings") +MSG_HASH(MENU_ENUM_LABEL_VALUE_SETTINGS_TAB, + "Settings") +MSG_HASH(MENU_ENUM_LABEL_VALUE_SHADER, + "Shader") +MSG_HASH(MENU_ENUM_LABEL_VALUE_SHADER_APPLY_CHANGES, + "Apply Changes") +MSG_HASH(MENU_ENUM_LABEL_VALUE_SHADER_OPTIONS, + "Shaders") +MSG_HASH(MENU_ENUM_LABEL_VALUE_SHADER_PIPELINE_RIBBON, + "Ribbon") +MSG_HASH(MENU_ENUM_LABEL_VALUE_SHADER_PIPELINE_RIBBON_SIMPLIFIED, + "Ribbon (simplified)") +MSG_HASH(MENU_ENUM_LABEL_VALUE_SHADER_PIPELINE_SIMPLE_SNOW, + "Simple Snow") +MSG_HASH(MENU_ENUM_LABEL_VALUE_SHADER_PIPELINE_SNOW, + "Snow") +MSG_HASH(MENU_ENUM_LABEL_VALUE_SHOW_ADVANCED_SETTINGS, + "Show Advanced Settings") +MSG_HASH(MENU_ENUM_LABEL_VALUE_SHOW_HIDDEN_FILES, + "Show Hidden Files and Folders") +MSG_HASH(MENU_ENUM_LABEL_VALUE_SHUTDOWN, + "Shutdown") +MSG_HASH(MENU_ENUM_LABEL_VALUE_SLOWMOTION_RATIO, + "Slow-Motion Ratio") +MSG_HASH(MENU_ENUM_LABEL_VALUE_SORT_SAVEFILES_ENABLE, + "Sort Saves In Folders") +MSG_HASH(MENU_ENUM_LABEL_VALUE_SORT_SAVESTATES_ENABLE, + "Sort Savestates In Folders") +MSG_HASH(MENU_ENUM_LABEL_VALUE_SAVESTATES_IN_CONTENT_DIR_ENABLE, + "Write Savestates to Content Dir") +MSG_HASH(MENU_ENUM_LABEL_VALUE_SAVEFILES_IN_CONTENT_DIR_ENABLE, + "Write Saves to Content Dir") +MSG_HASH(MENU_ENUM_LABEL_VALUE_SYSTEMFILES_IN_CONTENT_DIR_ENABLE, + "System Files are in Content Dir") +MSG_HASH(MENU_ENUM_LABEL_VALUE_SCREENSHOTS_IN_CONTENT_DIR_ENABLE, + "Write Screenshots to Content Dir") +MSG_HASH(MENU_ENUM_LABEL_VALUE_SSH_ENABLE, + "SSH Enable") +MSG_HASH(MENU_ENUM_LABEL_VALUE_START_CORE, + "Start Core") +MSG_HASH(MENU_ENUM_LABEL_VALUE_START_NET_RETROPAD, + "Start Remote RetroPad") +MSG_HASH(MENU_ENUM_LABEL_VALUE_START_VIDEO_PROCESSOR, + "Start Video Processor") +MSG_HASH(MENU_ENUM_LABEL_VALUE_STATE_SLOT, + "State Slot") +MSG_HASH(MENU_ENUM_LABEL_VALUE_STATUS, + "Status") +MSG_HASH(MENU_ENUM_LABEL_VALUE_STDIN_CMD_ENABLE, + "stdin Commands") +MSG_HASH(MENU_ENUM_LABEL_VALUE_SUPPORTED_CORES, + "Suggested cores") +MSG_HASH(MENU_ENUM_LABEL_VALUE_SUSPEND_SCREENSAVER_ENABLE, + "Suspend Screensaver") +MSG_HASH(MENU_ENUM_LABEL_VALUE_SYSTEM_BGM_ENABLE, + "System BGM Enable") +MSG_HASH(MENU_ENUM_LABEL_VALUE_SYSTEM_DIRECTORY, + "System/BIOS") +MSG_HASH(MENU_ENUM_LABEL_VALUE_SYSTEM_INFORMATION, + "System Information") +MSG_HASH(MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_7ZIP_SUPPORT, + "7zip support") +MSG_HASH(MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_ALSA_SUPPORT, + "ALSA support") +MSG_HASH(MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_BUILD_DATE, + "Build date") +MSG_HASH(MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_CG_SUPPORT, + "Cg support") +MSG_HASH(MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_COCOA_SUPPORT, + "Cocoa support") +MSG_HASH(MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_COMMAND_IFACE_SUPPORT, + "Command interface support") +MSG_HASH(MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_CORETEXT_SUPPORT, + "CoreText support") +MSG_HASH(MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_CPU_FEATURES, + "CPU Features") +MSG_HASH(MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_DISPLAY_METRIC_DPI, + "Display metric DPI") +MSG_HASH(MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_DISPLAY_METRIC_MM_HEIGHT, + "Display metric height (mm)") +MSG_HASH(MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_DISPLAY_METRIC_MM_WIDTH, + "Display metric width (mm)") +MSG_HASH(MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_DSOUND_SUPPORT, + "DirectSound support") +MSG_HASH(MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_WASAPI_SUPPORT, + "WASAPI support") +MSG_HASH(MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_DYLIB_SUPPORT, + "Dynamic library support") +MSG_HASH(MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_DYNAMIC_SUPPORT, + "Dynamic run-time loading of libretro library") +MSG_HASH(MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_EGL_SUPPORT, + "EGL support") +MSG_HASH(MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_FBO_SUPPORT, + "OpenGL/Direct3D render-to-texture (multi-pass shaders) support") +MSG_HASH(MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_FFMPEG_SUPPORT, + "FFmpeg support") +MSG_HASH(MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_FREETYPE_SUPPORT, + "FreeType support") +MSG_HASH(MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_FRONTEND_IDENTIFIER, + "Frontend identifier") +MSG_HASH(MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_FRONTEND_NAME, + "Frontend name") +MSG_HASH(MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_FRONTEND_OS, + "Frontend OS") +MSG_HASH(MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_GIT_VERSION, + "Git version") +MSG_HASH(MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_GLSL_SUPPORT, + "GLSL support") +MSG_HASH(MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_HLSL_SUPPORT, + "HLSL support") +MSG_HASH(MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_JACK_SUPPORT, + "JACK support") +MSG_HASH(MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_KMS_SUPPORT, + "KMS/EGL support") +MSG_HASH(MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_LAKKA_VERSION, + "Lakka Version") +MSG_HASH(MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_LIBRETRODB_SUPPORT, + "LibretroDB support") +MSG_HASH(MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_LIBUSB_SUPPORT, + "Libusb support") +MSG_HASH(MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_LIBXML2_SUPPORT, + "libxml2 XML parsing support") +MSG_HASH(MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_NETPLAY_SUPPORT, + "Netplay (peer-to-peer) support") +MSG_HASH(MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_NETWORK_COMMAND_IFACE_SUPPORT, + "Network Command interface support") +MSG_HASH(MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_NETWORK_REMOTE_SUPPORT, + "Network Gamepad support") +MSG_HASH(MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_OPENAL_SUPPORT, + "OpenAL support") +MSG_HASH(MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_OPENGLES_SUPPORT, + "OpenGL ES support") +MSG_HASH(MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_OPENGL_SUPPORT, + "OpenGL support") +MSG_HASH(MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_OPENSL_SUPPORT, + "OpenSL support") +MSG_HASH(MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_OPENVG_SUPPORT, + "OpenVG support") +MSG_HASH(MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_OSS_SUPPORT, + "OSS support") +MSG_HASH(MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_OVERLAY_SUPPORT, + "Overlay support") +MSG_HASH(MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_POWER_SOURCE, + "Power source") +MSG_HASH(MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_POWER_SOURCE_CHARGED, + "Charged") +MSG_HASH(MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_POWER_SOURCE_CHARGING, + "Charging") +MSG_HASH(MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_POWER_SOURCE_DISCHARGING, + "Discharging") +MSG_HASH(MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_POWER_SOURCE_NO_SOURCE, + "No source") +MSG_HASH(MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_PULSEAUDIO_SUPPORT, + "PulseAudio support") +MSG_HASH(MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_PYTHON_SUPPORT, + "Python (script support in shaders) support") +MSG_HASH(MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_RBMP_SUPPORT, + "BMP support (RBMP)") +MSG_HASH(MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_RETRORATING_LEVEL, + "RetroRating level") +MSG_HASH(MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_RJPEG_SUPPORT, + "JPEG support (RJPEG)") +MSG_HASH(MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_ROARAUDIO_SUPPORT, + "RoarAudio support") +MSG_HASH(MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_RPNG_SUPPORT, + "PNG support (RPNG)") +MSG_HASH(MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_RSOUND_SUPPORT, + "RSound support") +MSG_HASH(MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_RTGA_SUPPORT, + "TGA support (RTGA)") +MSG_HASH(MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_SDL2_SUPPORT, + "SDL2 support") +MSG_HASH(MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_SDL_IMAGE_SUPPORT, + "SDL image support") +MSG_HASH(MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_SDL_SUPPORT, + "SDL1.2 support") +MSG_HASH(MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_SLANG_SUPPORT, + "Slang support") +MSG_HASH(MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_THREADING_SUPPORT, + "Threading support") +MSG_HASH(MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_UDEV_SUPPORT, + "Udev support") +MSG_HASH(MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_V4L2_SUPPORT, + "Video4Linux2 support") +MSG_HASH(MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_VIDEO_CONTEXT_DRIVER, + "Video context driver") +MSG_HASH(MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_VULKAN_SUPPORT, + "Vulkan support") +MSG_HASH(MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_WAYLAND_SUPPORT, + "Wayland support") +MSG_HASH(MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_X11_SUPPORT, + "X11 support") +MSG_HASH(MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_XAUDIO2_SUPPORT, + "XAudio2 support") +MSG_HASH(MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_XVIDEO_SUPPORT, + "XVideo support") +MSG_HASH(MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_ZLIB_SUPPORT, + "Zlib support") +MSG_HASH(MENU_ENUM_LABEL_VALUE_TAKE_SCREENSHOT, + "Take Screenshot") +MSG_HASH(MENU_ENUM_LABEL_VALUE_THREADED_DATA_RUNLOOP_ENABLE, + "Threaded tasks") +MSG_HASH(MENU_ENUM_LABEL_VALUE_THUMBNAILS, + "Thumbnails") +MSG_HASH(MENU_ENUM_LABEL_VALUE_THUMBNAILS_DIRECTORY, + "Thumbnails") +MSG_HASH(MENU_ENUM_LABEL_VALUE_THUMBNAILS_UPDATER_LIST, + "Thumbnails Updater") +MSG_HASH(MENU_ENUM_LABEL_VALUE_THUMBNAIL_MODE_BOXARTS, + "Boxarts") +MSG_HASH(MENU_ENUM_LABEL_VALUE_THUMBNAIL_MODE_SCREENSHOTS, + "Screenshots") +MSG_HASH(MENU_ENUM_LABEL_VALUE_THUMBNAIL_MODE_TITLE_SCREENS, + "Title Screens") +MSG_HASH(MENU_ENUM_LABEL_VALUE_TIMEDATE_ENABLE, + "Show date / time") +MSG_HASH(MENU_ENUM_LABEL_VALUE_TITLE_COLOR, + "Menu title color") +MSG_HASH(MENU_ENUM_LABEL_VALUE_TRUE, + "True") +MSG_HASH(MENU_ENUM_LABEL_VALUE_UI_COMPANION_ENABLE, + "UI Companion Enable") +MSG_HASH(MENU_ENUM_LABEL_VALUE_UI_COMPANION_START_ON_BOOT, + "UI Companion Start On Boot") +MSG_HASH(MENU_ENUM_LABEL_VALUE_UI_MENUBAR_ENABLE, + "Menubar") +MSG_HASH(MENU_ENUM_LABEL_VALUE_UNABLE_TO_READ_COMPRESSED_FILE, + "Unable to read compressed file.") +MSG_HASH(MENU_ENUM_LABEL_VALUE_UNDO_LOAD_STATE, + "Undo Load State") +MSG_HASH(MENU_ENUM_LABEL_VALUE_UNDO_SAVE_STATE, + "Undo Save State") +MSG_HASH(MENU_ENUM_LABEL_VALUE_UNKNOWN, + "Unknown") +MSG_HASH(MENU_ENUM_LABEL_VALUE_UPDATER_SETTINGS, + "Updater") +MSG_HASH(MENU_ENUM_LABEL_VALUE_UPDATE_ASSETS, + "Update Assets") +MSG_HASH(MENU_ENUM_LABEL_VALUE_UPDATE_AUTOCONFIG_PROFILES, + "Update Joypad Profiles") +MSG_HASH(MENU_ENUM_LABEL_VALUE_UPDATE_CG_SHADERS, + "Update Cg Shaders") +MSG_HASH(MENU_ENUM_LABEL_VALUE_UPDATE_CHEATS, + "Update Cheats") +MSG_HASH(MENU_ENUM_LABEL_VALUE_UPDATE_CORE_INFO_FILES, + "Update Core Info Files") +MSG_HASH(MENU_ENUM_LABEL_VALUE_UPDATE_DATABASES, + "Update Databases") +MSG_HASH(MENU_ENUM_LABEL_VALUE_UPDATE_GLSL_SHADERS, + "Update GLSL Shaders") +MSG_HASH(MENU_ENUM_LABEL_VALUE_UPDATE_LAKKA, + "Update Lakka") +MSG_HASH(MENU_ENUM_LABEL_VALUE_UPDATE_OVERLAYS, + "Update Overlays") +MSG_HASH(MENU_ENUM_LABEL_VALUE_UPDATE_SLANG_SHADERS, + "Update Slang Shaders") +MSG_HASH(MENU_ENUM_LABEL_VALUE_USER, + "المستخدم") +MSG_HASH(MENU_ENUM_LABEL_VALUE_KEYBOARD, + "Kbd") +MSG_HASH(MENU_ENUM_LABEL_VALUE_USER_INTERFACE_SETTINGS, + "واجهة المستخدم") +MSG_HASH(MENU_ENUM_LABEL_VALUE_USER_LANGUAGE, + "Language") +MSG_HASH(MENU_ENUM_LABEL_VALUE_USER_SETTINGS, + "المستخدم") +MSG_HASH(MENU_ENUM_LABEL_VALUE_USE_BUILTIN_IMAGE_VIEWER, + "Use Builtin Image Viewer") +MSG_HASH(MENU_ENUM_LABEL_VALUE_USE_BUILTIN_PLAYER, + "Use Builtin Media Player") +MSG_HASH(MENU_ENUM_LABEL_VALUE_USE_THIS_DIRECTORY, + "") +MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_ALLOW_ROTATE, + "Allow rotation") +MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_ASPECT_RATIO, + "Config Aspect Ratio") +MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_ASPECT_RATIO_AUTO, + "Auto Aspect Ratio") +MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_ASPECT_RATIO_INDEX, + "Aspect Ratio") +MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_BLACK_FRAME_INSERTION, + "Black Frame Insertion") +MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_CROP_OVERSCAN, + "Crop Overscan (Reload)") +MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_DISABLE_COMPOSITION, + "Disable Desktop Composition") +MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_DRIVER, + "نظام تشغيل الفيديو") +MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_FILTER, + "Video Filter") +MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_FILTER_DIR, + "Video Filter") +MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_FILTER_FLICKER, + "Flicker filter") +MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_FONT_ENABLE, + "Enable Onscreen Notifications") +MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_FONT_PATH, + "Notification Font") +MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_FONT_SIZE, + "Notification Size") +MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_FORCE_ASPECT, + "Force aspect ratio") +MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_FORCE_SRGB_DISABLE, + "Force-disable sRGB FBO") +MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_FRAME_DELAY, + "Frame Delay") +MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_FULLSCREEN, + "Start in Fullscreen Mode") +MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_GAMMA, + "Video Gamma") +MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_GPU_RECORD, + "Use GPU Recording") +MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_GPU_SCREENSHOT, + "GPU Screenshot Enable") +MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_HARD_SYNC, + "Hard GPU Sync") +MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_HARD_SYNC_FRAMES, + "Hard GPU Sync Frames") +MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_MAX_SWAPCHAIN_IMAGES, + "Max swapchain images") +MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_MESSAGE_POS_X, + "Notification X Position") +MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_MESSAGE_POS_Y, + "Notification Y Position") +MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_MONITOR_INDEX, + "Monitor Index") +MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_POST_FILTER_RECORD, + "Use Post Filter Recording") +MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_REFRESH_RATE, + "Vertical Refresh Rate") +MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_REFRESH_RATE_AUTO, + "Estimated Screen Framerate") +MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_ROTATION, + "Rotation") +MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_SCALE, + "Windowed Scale") +MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_SCALE_INTEGER, + "Integer Scale") +MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_SETTINGS, + "الفيديو") +MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_SHADER_DIR, + "Video Shader") +MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_SHADER_NUM_PASSES, + "Shader Passes") +MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_SHADER_PARAMETERS, + "Preview Shader Parameters") +MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_SHADER_PRESET, + "Load Shader Preset") +MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_SHADER_PRESET_PARAMETERS, + "Menu Shader Parameters") +MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_SHADER_PRESET_SAVE_AS, + "Save Shader Preset As") +MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_SHADER_PRESET_SAVE_CORE, + "Save Core Preset") +MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_SHADER_PRESET_SAVE_GAME, + "Save Game Preset") +MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_SHARED_CONTEXT, + "Enable Hardware Shared Context") +MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_SMOOTH, + "Bilinear Filtering") +MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_SOFT_FILTER, + "Soft Filter Enable") +MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_SWAP_INTERVAL, + "Vertical Sync (Vsync) Swap Interval") +MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_TAB, + "Video") +MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_THREADED, + "Threaded Video") +MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_VFILTER, + "Deflicker") +MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_VIEWPORT_CUSTOM_HEIGHT, + "Custom Aspect Ratio Height") +MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_VIEWPORT_CUSTOM_WIDTH, + "Custom Aspect Ratio Width") +MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_VIEWPORT_CUSTOM_X, + "Custom Aspect Ratio X Pos.") +MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_VIEWPORT_CUSTOM_Y, + "Custom Aspect Ratio Y Pos.") +MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_VI_WIDTH, + "Set VI Screen Width") +MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_VSYNC, + "Vertical Sync (Vsync)") +MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_WINDOWED_FULLSCREEN, + "Windowed Fullscreen Mode") +MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_WINDOW_WIDTH, + "Window Width") +MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_WINDOW_HEIGHT, + "Window Height") +MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_FULLSCREEN_X, + "Fullscreen Width") +MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_FULLSCREEN_Y, + "Fullscreen Height") +MSG_HASH(MENU_ENUM_LABEL_VALUE_WIFI_DRIVER, + "نظام تشغيل الواي-فاي") +MSG_HASH(MENU_ENUM_LABEL_VALUE_WIFI_SETTINGS, + "Wi-Fi") +MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_ALPHA_FACTOR, + "Menu Alpha Factor") +MSG_HASH(MENU_ENUM_LABEL_VALUE_MENU_FONT_COLOR_RED, + "Menu Font Red Color") +MSG_HASH(MENU_ENUM_LABEL_VALUE_MENU_FONT_COLOR_GREEN, + "Menu Font Green Color") +MSG_HASH(MENU_ENUM_LABEL_VALUE_MENU_FONT_COLOR_BLUE, + "Menu Font Blue Color") +MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_FONT, + "Menu Font") +MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_ICON_THEME_CUSTOM, + "Custom") +MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_ICON_THEME_FLATUI, + "FlatUI") +MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_ICON_THEME_MONOCHROME, + "Monochrome") +MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_ICON_THEME_MONOCHROME_INVERTED, + "Monochrome Inverted") +MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_ICON_THEME_SYSTEMATIC, + "Systematic") +MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_ICON_THEME_NEOACTIVE, + "NeoActive") +MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_ICON_THEME_PIXEL, + "Pixel") +MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_ICON_THEME_RETROACTIVE, + "RetroActive") +MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_ICON_THEME_RETROSYSTEM, + "Retrosystem") +MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_ICON_THEME_DOTART, + "Dot-Art") +MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_MENU_COLOR_THEME, + "Menu Color Theme") +MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_MENU_COLOR_THEME_APPLE_GREEN, + "Apple Green") +MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_MENU_COLOR_THEME_DARK, + "Dark") +MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_MENU_COLOR_THEME_LIGHT, + "Light") +MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_MENU_COLOR_THEME_DARK_PURPLE, + "Dark Purple") +MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_MENU_COLOR_THEME_ELECTRIC_BLUE, + "Electric Blue") +MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_MENU_COLOR_THEME_GOLDEN, + "Golden") +MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_MENU_COLOR_THEME_LEGACY_RED, + "Legacy Red") +MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_MENU_COLOR_THEME_MIDNIGHT_BLUE, + "Midnight Blue") +MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_MENU_COLOR_THEME_PLAIN, + "Plain") +MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_MENU_COLOR_THEME_UNDERSEA, + "Undersea") +MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_MENU_COLOR_THEME_VOLCANIC_RED, + "Volcanic Red") +MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_RIBBON_ENABLE, + "Menu Shader Pipeline") +MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_SCALE_FACTOR, + "Menu Scale Factor") +MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_SHADOWS_ENABLE, + "Icon Shadows Enable") +MSG_HASH(MENU_ENUM_LABEL_VALUE_CONTENT_SHOW_HISTORY, + "Show History Tab") +MSG_HASH(MENU_ENUM_LABEL_VALUE_CONTENT_SHOW_ADD, + "Show Import content Tab") +MSG_HASH(MENU_ENUM_LABEL_VALUE_CONTENT_SHOW_FAVORITES, + "Show Favorites Tab") +MSG_HASH(MENU_ENUM_LABEL_VALUE_CONTENT_SHOW_IMAGES, + "Show Image Tab") +MSG_HASH(MENU_ENUM_LABEL_VALUE_CONTENT_SHOW_MUSIC, + "Show Music Tab") +MSG_HASH(MENU_ENUM_LABEL_VALUE_CONTENT_SHOW_SETTINGS, + "Show Settings Tab") +MSG_HASH(MENU_ENUM_LABEL_VALUE_CONTENT_SHOW_VIDEO, + "Show Video Tab") +MSG_HASH(MENU_ENUM_LABEL_VALUE_CONTENT_SHOW_NETPLAY, + "Show Netplay Tab") +MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_THEME, + "Menu Icon Theme") +MSG_HASH(MENU_ENUM_LABEL_VALUE_YES, + "Yes") +MSG_HASH(MENU_ENUM_LABEL_VIDEO_SHADER_PRESET_TWO, + "Shader Preset") +MSG_HASH(MENU_ENUM_SUBLABEL_CHEEVOS_ENABLE, + "Enable or disable achievements. For more information, visit http://retroachievements.org") +MSG_HASH(MENU_ENUM_SUBLABEL_CHEEVOS_TEST_UNOFFICIAL, + "Enable or disable unofficial achievements and/or beta features for testing purposes.") +MSG_HASH(MENU_ENUM_SUBLABEL_CHEEVOS_HARDCORE_MODE_ENABLE, + "Enable or disable savestates, cheats, rewind, fast-forward, pause, and slow-motion for all games.") +MSG_HASH(MENU_ENUM_SUBLABEL_CHEEVOS_LEADERBOARDS_ENABLE, + "Enable or disable in-game leaderboards. Has no effect if Hardcore Mode is disabled.") +MSG_HASH(MENU_ENUM_SUBLABEL_CHEEVOS_BADGES_ENABLE, + "Enable or disable badge display in Achievement List.") +MSG_HASH(MENU_ENUM_SUBLABEL_CHEEVOS_VERBOSE_ENABLE, + "Enable or disable OSD verbosity for achievements.") +MSG_HASH(MENU_ENUM_SUBLABEL_DRIVER_SETTINGS, + "تغيير أنظمة التشغيل المستخدمة من قبل البرنامج.") +MSG_HASH(MENU_ENUM_SUBLABEL_RETRO_ACHIEVEMENTS_SETTINGS, + "Change achievement settings.") +MSG_HASH(MENU_ENUM_SUBLABEL_CORE_SETTINGS, + "Change core settings.") +MSG_HASH(MENU_ENUM_SUBLABEL_RECORDING_SETTINGS, + "Change recording settings.") +MSG_HASH(MENU_ENUM_SUBLABEL_ONSCREEN_DISPLAY_SETTINGS, + "Change display overlay and keyboard overlay, and onscreen notification settings.") +MSG_HASH(MENU_ENUM_SUBLABEL_FRAME_THROTTLE_SETTINGS, + "Change rewind, fast-forward, and slow-motion settings.") +MSG_HASH(MENU_ENUM_SUBLABEL_SAVING_SETTINGS, + "Change saving settings.") +MSG_HASH(MENU_ENUM_SUBLABEL_LOGGING_SETTINGS, + "Change logging settings.") +MSG_HASH(MENU_ENUM_SUBLABEL_USER_INTERFACE_SETTINGS, + "Change user interface settings.") +MSG_HASH(MENU_ENUM_SUBLABEL_USER_SETTINGS, + "Change account, username, and language settings.") +MSG_HASH(MENU_ENUM_SUBLABEL_PRIVACY_SETTINGS, + "Change your privacy settings.") +MSG_HASH(MENU_ENUM_SUBLABEL_DIRECTORY_SETTINGS, + "Change default directories where files are located.") +MSG_HASH(MENU_ENUM_SUBLABEL_PLAYLIST_SETTINGS, + "Change playlist settings.") +MSG_HASH(MENU_ENUM_SUBLABEL_NETWORK_SETTINGS, + "Configure server and network settings.") +MSG_HASH(MENU_ENUM_SUBLABEL_ADD_CONTENT_LIST, + "Scan content and add to the database.") +MSG_HASH(MENU_ENUM_SUBLABEL_AUDIO_SETTINGS, + "Change audio output settings.") +MSG_HASH(MENU_ENUM_SUBLABEL_BLUETOOTH_ENABLE, + "Enable or disable bluetooth.") +MSG_HASH(MENU_ENUM_SUBLABEL_CONFIG_SAVE_ON_EXIT, + "Saves changes to the configuration file on exit.") +MSG_HASH(MENU_ENUM_SUBLABEL_CONFIGURATION_SETTINGS, + "Change default settings for configuration files.") +MSG_HASH(MENU_ENUM_SUBLABEL_CONFIGURATIONS_LIST, + "Manage and create configuration files.") +MSG_HASH(MENU_ENUM_SUBLABEL_CPU_CORES, + "Amount of cores that the CPU has.") +MSG_HASH(MENU_ENUM_SUBLABEL_FPS_SHOW, + "Displays the current framerate per second onscreen.") +MSG_HASH(MENU_ENUM_SUBLABEL_INPUT_HOTKEY_BINDS, + "Configure hotkey settings.") +MSG_HASH(MENU_ENUM_SUBLABEL_INPUT_MENU_ENUM_TOGGLE_GAMEPAD_COMBO, + "Gamepad button combination to toggle menu.") +MSG_HASH(MENU_ENUM_SUBLABEL_INPUT_SETTINGS, + "Change joypad, keyboard, and mouse settings.") +MSG_HASH(MENU_ENUM_SUBLABEL_INPUT_USER_BINDS, + "Configure controls for this user.") +MSG_HASH(MENU_ENUM_SUBLABEL_LOG_VERBOSITY, + "Enable or disable logging to the terminal.") +MSG_HASH(MENU_ENUM_SUBLABEL_NETPLAY, + "Join or host a netplay session.") +MSG_HASH(MENU_ENUM_SUBLABEL_NETPLAY_LAN_SCAN_SETTINGS, + "Search for and connect to netplay hosts on the local network.") +MSG_HASH(MENU_ENUM_SUBLABEL_INFORMATION_LIST_LIST, + "Display system information.") +MSG_HASH(MENU_ENUM_SUBLABEL_ONLINE_UPDATER, + "Download add-ons, components, and content for RetroArch.") +MSG_HASH(MENU_ENUM_SUBLABEL_SAMBA_ENABLE, + "Enable or disable network sharing of your folders.") +MSG_HASH(MENU_ENUM_SUBLABEL_SERVICES_SETTINGS, + "Manage operating system level services.") +MSG_HASH(MENU_ENUM_SUBLABEL_SHOW_HIDDEN_FILES, + "Show hidden files/directories inside the file browser.") +MSG_HASH(MENU_ENUM_SUBLABEL_SSH_ENABLE, + "Enable or disable remote command line access.") +MSG_HASH(MENU_ENUM_SUBLABEL_SUSPEND_SCREENSAVER_ENABLE, + "Prevents your system's screensaver from becoming active.") +MSG_HASH(MENU_ENUM_SUBLABEL_VIDEO_WINDOW_SCALE, + "Sets the window size relative to the core viewport size. Alternatively, you can set a window width and height below for a fixed window size.") +MSG_HASH(MENU_ENUM_SUBLABEL_USER_LANGUAGE, + "Sets the language of the interface.") +MSG_HASH(MENU_ENUM_SUBLABEL_VIDEO_BLACK_FRAME_INSERTION, + "Inserts a black frame inbetween frames. Useful for users with 120Hz screens who want to play 60Hz content to eliminate ghosting.") +MSG_HASH(MENU_ENUM_SUBLABEL_VIDEO_FRAME_DELAY, + "Reduces latency at the cost of a higher risk of video stuttering. Adds a delay after V-Sync (in ms).") +MSG_HASH(MENU_ENUM_SUBLABEL_VIDEO_HARD_SYNC_FRAMES, + "Sets how many frames the CPU can run ahead of the GPU when using 'Hard GPU Sync'.") +MSG_HASH(MENU_ENUM_SUBLABEL_VIDEO_MAX_SWAPCHAIN_IMAGES, + "Tells the video driver to explicitly use a specified buffering mode.") +MSG_HASH(MENU_ENUM_SUBLABEL_VIDEO_MONITOR_INDEX, + "Selects which display screen to use.") +MSG_HASH(MENU_ENUM_SUBLABEL_VIDEO_REFRESH_RATE_AUTO, + "The accurate estimated refresh rate of the screen in Hz.") +MSG_HASH(MENU_ENUM_SUBLABEL_VIDEO_SETTINGS, + "Change video output settings.") +MSG_HASH(MENU_ENUM_SUBLABEL_WIFI_SETTINGS, + "Scans for wireless networks and establishes connection.") +MSG_HASH(MENU_ENUM_SUBLABEL_HELP_LIST, + "Learn more about how the program works.") +MSG_HASH(MSG_ADDED_TO_FAVORITES, + "Added to favorites") +MSG_HASH(MSG_APPENDED_DISK, + "Appended disk") +MSG_HASH(MSG_APPLICATION_DIR, + "Application Dir") +MSG_HASH(MSG_APPLYING_CHEAT, + "Applying cheat changes.") +MSG_HASH(MSG_APPLYING_SHADER, + "Applying shader") +MSG_HASH(MSG_AUDIO_MUTED, + "Audio muted.") +MSG_HASH(MSG_AUDIO_UNMUTED, + "Audio unmuted.") +MSG_HASH(MSG_AUTOCONFIG_FILE_ERROR_SAVING, + "Error saving autoconf file.") +MSG_HASH(MSG_AUTOCONFIG_FILE_SAVED_SUCCESSFULLY, + "Autoconfig file saved successfully.") +MSG_HASH(MSG_AUTOSAVE_FAILED, + "Could not initialize autosave.") +MSG_HASH(MSG_AUTO_SAVE_STATE_TO, + "Auto save state to") +MSG_HASH(MSG_BLOCKING_SRAM_OVERWRITE, + "Blocking SRAM Overwrite") +MSG_HASH(MSG_BRINGING_UP_COMMAND_INTERFACE_ON_PORT, + "Bringing up command interface on port") +MSG_HASH(MSG_BYTES, + "bytes") +MSG_HASH(MSG_CANNOT_INFER_NEW_CONFIG_PATH, + "Cannot infer new config path. Use current time.") +MSG_HASH(MSG_CHEEVOS_HARDCORE_MODE_ENABLE, + "Hardcore Mode Enabled, savestate & rewind were disabled.") +MSG_HASH(MSG_COMPARING_WITH_KNOWN_MAGIC_NUMBERS, + "Comparing with known magic numbers...") +MSG_HASH(MSG_COMPILED_AGAINST_API, + "Compiled against API") +MSG_HASH(MSG_CONFIG_DIRECTORY_NOT_SET, + "Config directory not set. Cannot save new config.") +MSG_HASH(MSG_CONNECTED_TO, + "Connected to") +MSG_HASH(MSG_CONTENT_CRC32S_DIFFER, + "Content CRC32s differ. Cannot use different games.") +MSG_HASH(MSG_CONTENT_LOADING_SKIPPED_IMPLEMENTATION_WILL_DO_IT, + "Content loading skipped. Implementation will load it on its own.") +MSG_HASH(MSG_CORE_DOES_NOT_SUPPORT_SAVESTATES, + "Core does not support save states.") +MSG_HASH(MSG_CORE_OPTIONS_FILE_CREATED_SUCCESSFULLY, + "Core options file created successfully.") +MSG_HASH(MSG_COULD_NOT_FIND_ANY_NEXT_DRIVER, + "Could not find any next driver") +MSG_HASH(MSG_COULD_NOT_FIND_COMPATIBLE_SYSTEM, + "Could not find compatible system.") +MSG_HASH(MSG_COULD_NOT_FIND_VALID_DATA_TRACK, + "Could not find valid data track") +MSG_HASH(MSG_COULD_NOT_OPEN_DATA_TRACK, + "could not open data track") +MSG_HASH(MSG_COULD_NOT_READ_CONTENT_FILE, + "Could not read content file") +MSG_HASH(MSG_COULD_NOT_READ_MOVIE_HEADER, + "Could not read movie header.") +MSG_HASH(MSG_COULD_NOT_READ_STATE_FROM_MOVIE, + "Could not read state from movie.") +MSG_HASH(MSG_CRC32_CHECKSUM_MISMATCH, + "CRC32 checksum mismatch between content file and saved content checksum in replay file header. Replay highly likely to desync on playback.") +MSG_HASH(MSG_CUSTOM_TIMING_GIVEN, + "Custom timing given") +MSG_HASH(MSG_DECOMPRESSION_ALREADY_IN_PROGRESS, + "Decompression already in progress.") +MSG_HASH(MSG_DECOMPRESSION_FAILED, + "Decompression failed.") +MSG_HASH(MSG_DETECTED_VIEWPORT_OF, + "Detected viewport of") +MSG_HASH(MSG_DID_NOT_FIND_A_VALID_CONTENT_PATCH, + "Did not find a valid content patch.") +MSG_HASH(MSG_DISCONNECT_DEVICE_FROM_A_VALID_PORT, + "Disconnect device from a valid port.") +MSG_HASH(MSG_DISK_CLOSED, + "Closed") +MSG_HASH(MSG_DISK_EJECTED, + "Ejected") +MSG_HASH(MSG_DOWNLOADING, + "Downloading") +MSG_HASH(MSG_DOWNLOAD_FAILED, + "Download failed") +MSG_HASH(MSG_ERROR, + "Error") +MSG_HASH(MSG_ERROR_LIBRETRO_CORE_REQUIRES_CONTENT, + "Libretro core requires content, but nothing was provided.") +MSG_HASH(MSG_ERROR_LIBRETRO_CORE_REQUIRES_SPECIAL_CONTENT, + "Libretro core requires special content, but none were provided.") +MSG_HASH(MSG_ERROR_PARSING_ARGUMENTS, + "Error parsing arguments.") +MSG_HASH(MSG_ERROR_SAVING_CORE_OPTIONS_FILE, + "Error saving core options file.") +MSG_HASH(MSG_ERROR_SAVING_REMAP_FILE, + "Error saving remap file.") +MSG_HASH(MSG_ERROR_REMOVING_REMAP_FILE, + "Error removing remap file.") +MSG_HASH(MSG_ERROR_SAVING_SHADER_PRESET, + "Error saving shader preset.") +MSG_HASH(MSG_EXTERNAL_APPLICATION_DIR, + "External Application Dir") +MSG_HASH(MSG_EXTRACTING, + "Extracting") +MSG_HASH(MSG_EXTRACTING_FILE, + "Extracting file") +MSG_HASH(MSG_FAILED_SAVING_CONFIG_TO, + "Failed saving config to") +MSG_HASH(MSG_FAILED_TO, + "Failed to") +MSG_HASH(MSG_FAILED_TO_ACCEPT_INCOMING_SPECTATOR, + "Failed to accept incoming spectator.") +MSG_HASH(MSG_FAILED_TO_ALLOCATE_MEMORY_FOR_PATCHED_CONTENT, + "Failed to allocate memory for patched content...") +MSG_HASH(MSG_FAILED_TO_APPLY_SHADER, + "Failed to apply shader.") +MSG_HASH(MSG_FAILED_TO_BIND_SOCKET, + "Failed to bind socket.") +MSG_HASH(MSG_FAILED_TO_CREATE_THE_DIRECTORY, + "Failed to create the directory.") +MSG_HASH(MSG_FAILED_TO_EXTRACT_CONTENT_FROM_COMPRESSED_FILE, + "Failed to extract content from compressed file") +MSG_HASH(MSG_FAILED_TO_GET_NICKNAME_FROM_CLIENT, + "Failed to get nickname from client.") +MSG_HASH(MSG_FAILED_TO_LOAD, + "Failed to load") +MSG_HASH(MSG_FAILED_TO_LOAD_CONTENT, + "Failed to load content") +MSG_HASH(MSG_FAILED_TO_LOAD_MOVIE_FILE, + "Failed to load movie file") +MSG_HASH(MSG_FAILED_TO_LOAD_OVERLAY, + "Failed to load overlay.") +MSG_HASH(MSG_FAILED_TO_LOAD_STATE, + "Failed to load state from") +MSG_HASH(MSG_FAILED_TO_OPEN_LIBRETRO_CORE, + "Failed to open libretro core") +MSG_HASH(MSG_FAILED_TO_PATCH, + "Failed to patch") +MSG_HASH(MSG_FAILED_TO_RECEIVE_HEADER_FROM_CLIENT, + "Failed to receive header from client.") +MSG_HASH(MSG_FAILED_TO_RECEIVE_NICKNAME, + "Failed to receive nickname.") +MSG_HASH(MSG_FAILED_TO_RECEIVE_NICKNAME_FROM_HOST, + "Failed to receive nickname from host.") +MSG_HASH(MSG_FAILED_TO_RECEIVE_NICKNAME_SIZE_FROM_HOST, + "Failed to receive nickname size from host.") +MSG_HASH(MSG_FAILED_TO_RECEIVE_SRAM_DATA_FROM_HOST, + "Failed to receive SRAM data from host.") +MSG_HASH(MSG_FAILED_TO_REMOVE_DISK_FROM_TRAY, + "Failed to remove disk from tray.") +MSG_HASH(MSG_FAILED_TO_REMOVE_TEMPORARY_FILE, + "Failed to remove temporary file") +MSG_HASH(MSG_FAILED_TO_SAVE_SRAM, + "Failed to save SRAM") +MSG_HASH(MSG_FAILED_TO_SAVE_STATE_TO, + "Failed to save state to") +MSG_HASH(MSG_FAILED_TO_SEND_NICKNAME, + "Failed to send nickname.") +MSG_HASH(MSG_FAILED_TO_SEND_NICKNAME_SIZE, + "Failed to send nickname size.") +MSG_HASH(MSG_FAILED_TO_SEND_NICKNAME_TO_CLIENT, + "Failed to send nickname to client.") +MSG_HASH(MSG_FAILED_TO_SEND_NICKNAME_TO_HOST, + "Failed to send nickname to host.") +MSG_HASH(MSG_FAILED_TO_SEND_SRAM_DATA_TO_CLIENT, + "Failed to send SRAM data to client.") +MSG_HASH(MSG_FAILED_TO_START_AUDIO_DRIVER, + "Failed to start audio driver. Will continue without audio.") +MSG_HASH(MSG_FAILED_TO_START_MOVIE_RECORD, + "Failed to start movie record.") +MSG_HASH(MSG_FAILED_TO_START_RECORDING, + "Failed to start recording.") +MSG_HASH(MSG_FAILED_TO_TAKE_SCREENSHOT, + "Failed to take screenshot.") +MSG_HASH(MSG_FAILED_TO_UNDO_LOAD_STATE, + "Failed to undo load state.") +MSG_HASH(MSG_FAILED_TO_UNDO_SAVE_STATE, + "Failed to undo save state.") +MSG_HASH(MSG_FAILED_TO_UNMUTE_AUDIO, + "Failed to unmute audio.") +MSG_HASH(MSG_FATAL_ERROR_RECEIVED_IN, + "Fatal error received in") +MSG_HASH(MSG_FILE_NOT_FOUND, + "File not found") +MSG_HASH(MSG_FOUND_AUTO_SAVESTATE_IN, + "Found auto savestate in") +MSG_HASH(MSG_FOUND_DISK_LABEL, + "Found disk label") +MSG_HASH(MSG_FOUND_FIRST_DATA_TRACK_ON_FILE, + "Found first data track on file") +MSG_HASH(MSG_FOUND_LAST_STATE_SLOT, + "Found last state slot") +MSG_HASH(MSG_FOUND_SHADER, + "Found shader") +MSG_HASH(MSG_FRAMES, + "Frames") +MSG_HASH(MSG_GAME_SPECIFIC_CORE_OPTIONS_FOUND_AT, + "Per-Game Options: game-specific core options found at") +MSG_HASH(MSG_GOT_INVALID_DISK_INDEX, + "Got invalid disk index.") +MSG_HASH(MSG_GRAB_MOUSE_STATE, + "Grab mouse state") +MSG_HASH(MSG_GAME_FOCUS_ON, + "Game focus on") +MSG_HASH(MSG_GAME_FOCUS_OFF, + "Game focus off") +MSG_HASH(MSG_HW_RENDERED_MUST_USE_POSTSHADED_RECORDING, + "Libretro core is hardware rendered. Must use post-shaded recording as well.") +MSG_HASH(MSG_INFLATED_CHECKSUM_DID_NOT_MATCH_CRC32, + "Inflated checksum did not match CRC32.") +MSG_HASH(MSG_INPUT_CHEAT, + "Input Cheat") +MSG_HASH(MSG_INPUT_CHEAT_FILENAME, + "Input Cheat Filename") +MSG_HASH(MSG_INPUT_PRESET_FILENAME, + "Input Preset Filename") +MSG_HASH(MSG_INPUT_RENAME_ENTRY, + "Rename Title") +MSG_HASH(MSG_INTERFACE, + "Interface") +MSG_HASH(MSG_INTERNAL_STORAGE, + "Internal Storage") +MSG_HASH(MSG_REMOVABLE_STORAGE, + "Removable Storage") +MSG_HASH(MSG_INVALID_NICKNAME_SIZE, + "Invalid nickname size.") +MSG_HASH(MSG_IN_BYTES, + "in bytes") +MSG_HASH(MSG_IN_GIGABYTES, + "in gigabytes") +MSG_HASH(MSG_IN_MEGABYTES, + "in megabytes") +MSG_HASH(MSG_LIBRETRO_ABI_BREAK, + "is compiled against a different version of libretro than this libretro implementation.") +MSG_HASH(MSG_LIBRETRO_FRONTEND, + "Frontend for libretro") +MSG_HASH(MSG_LOADED_STATE_FROM_SLOT, + "Loaded state from slot #%d.") +MSG_HASH(MSG_LOADED_STATE_FROM_SLOT_AUTO, + "Loaded state from slot #-1 (auto).") +MSG_HASH(MSG_LOADING, + "Loading") +MSG_HASH(MSG_FIRMWARE, + "One or more firmware files are missing") +MSG_HASH(MSG_LOADING_CONTENT_FILE, + "Loading content file") +MSG_HASH(MSG_LOADING_HISTORY_FILE, + "Loading history file") +MSG_HASH(MSG_LOADING_STATE, + "Loading state") +MSG_HASH(MSG_MEMORY, + "Memory") +MSG_HASH(MSG_MOVIE_FILE_IS_NOT_A_VALID_BSV1_FILE, + "Movie file is not a valid BSV1 file.") +MSG_HASH(MSG_MOVIE_FORMAT_DIFFERENT_SERIALIZER_VERSION, + "Movie format seems to have a different serializer version. Will most likely fail.") +MSG_HASH(MSG_MOVIE_PLAYBACK_ENDED, + "Movie playback ended.") +MSG_HASH(MSG_MOVIE_RECORD_STOPPED, + "Stopping movie record.") +MSG_HASH(MSG_NETPLAY_FAILED, + "Failed to initialize netplay.") +MSG_HASH(MSG_NO_CONTENT_STARTING_DUMMY_CORE, + "No content, starting dummy core.") +MSG_HASH(MSG_NO_SAVE_STATE_HAS_BEEN_OVERWRITTEN_YET, + "No save state has been overwritten yet.") +MSG_HASH(MSG_NO_STATE_HAS_BEEN_LOADED_YET, + "No state has been loaded yet.") +MSG_HASH(MSG_OVERRIDES_ERROR_SAVING, + "Error saving overrides.") +MSG_HASH(MSG_OVERRIDES_SAVED_SUCCESSFULLY, + "Overrides saved successfully.") +MSG_HASH(MSG_PAUSED, + "Paused.") +MSG_HASH(MSG_PROGRAM, + "رتروارش") +MSG_HASH(MSG_READING_FIRST_DATA_TRACK, + "Reading first data track...") +MSG_HASH(MSG_RECEIVED, + "received") +MSG_HASH(MSG_RECORDING_TERMINATED_DUE_TO_RESIZE, + "Recording terminated due to resize.") +MSG_HASH(MSG_RECORDING_TO, + "Recording to") +MSG_HASH(MSG_REDIRECTING_CHEATFILE_TO, + "Redirecting cheat file to") +MSG_HASH(MSG_REDIRECTING_SAVEFILE_TO, + "Redirecting save file to") +MSG_HASH(MSG_REDIRECTING_SAVESTATE_TO, + "Redirecting savestate to") +MSG_HASH(MSG_REMAP_FILE_SAVED_SUCCESSFULLY, + "Remap file saved successfully.") +MSG_HASH(MSG_REMAP_FILE_REMOVED_SUCCESSFULLY, + "Remap file removed successfully.") +MSG_HASH(MSG_REMOVED_DISK_FROM_TRAY, + "Removed disk from tray.") +MSG_HASH(MSG_REMOVING_TEMPORARY_CONTENT_FILE, + "Removing temporary content file") +MSG_HASH(MSG_RESET, + "Reset") +MSG_HASH(MSG_RESTARTING_RECORDING_DUE_TO_DRIVER_REINIT, + "Restarting recording due to driver reinit.") +MSG_HASH(MSG_RESTORED_OLD_SAVE_STATE, + "Restored old save state.") +MSG_HASH(MSG_RESTORING_DEFAULT_SHADER_PRESET_TO, + "Shaders: restoring default shader preset to") +MSG_HASH(MSG_REVERTING_SAVEFILE_DIRECTORY_TO, + "Reverting savefile directory to") +MSG_HASH(MSG_REVERTING_SAVESTATE_DIRECTORY_TO, + "Reverting savestate directory to") +MSG_HASH(MSG_REWINDING, + "Rewinding.") +MSG_HASH(MSG_REWIND_INIT, + "Initializing rewind buffer with size") +MSG_HASH(MSG_REWIND_INIT_FAILED, + "Failed to initialize rewind buffer. Rewinding will be disabled.") +MSG_HASH(MSG_REWIND_INIT_FAILED_THREADED_AUDIO, + "Implementation uses threaded audio. Cannot use rewind.") +MSG_HASH(MSG_REWIND_REACHED_END, + "Reached end of rewind buffer.") +MSG_HASH(MSG_SAVED_NEW_CONFIG_TO, + "Saved new config to") +MSG_HASH(MSG_SAVED_STATE_TO_SLOT, + "Saved state to slot #%d.") +MSG_HASH(MSG_SAVED_STATE_TO_SLOT_AUTO, + "Saved state to slot #-1 (auto).") +MSG_HASH(MSG_SAVED_SUCCESSFULLY_TO, + "Saved successfully to") +MSG_HASH(MSG_SAVING_RAM_TYPE, + "Saving RAM type") +MSG_HASH(MSG_SAVING_STATE, + "Saving state") +MSG_HASH(MSG_SCANNING, + "Scanning") +MSG_HASH(MSG_SCANNING_OF_DIRECTORY_FINISHED, + "Scanning of directory finished") +MSG_HASH(MSG_SENDING_COMMAND, + "Sending command") +MSG_HASH(MSG_SEVERAL_PATCHES_ARE_EXPLICITLY_DEFINED, + "Several patches are explicitly defined, ignoring all...") +MSG_HASH(MSG_SHADER, + "Shader") +MSG_HASH(MSG_SHADER_PRESET_SAVED_SUCCESSFULLY, + "Shader preset saved successfully.") +MSG_HASH(MSG_SKIPPING_SRAM_LOAD, + "Skipping SRAM load.") +MSG_HASH(MSG_SLOW_MOTION, + "Slow motion.") +MSG_HASH(MSG_FAST_FORWARD, + "Fast forward.") +MSG_HASH(MSG_SLOW_MOTION_REWIND, + "Slow motion rewind.") +MSG_HASH(MSG_SRAM_WILL_NOT_BE_SAVED, + "SRAM will not be saved.") +MSG_HASH(MSG_STARTING_MOVIE_PLAYBACK, + "Starting movie playback.") +MSG_HASH(MSG_STARTING_MOVIE_RECORD_TO, + "Starting movie record to") +MSG_HASH(MSG_STATE_SIZE, + "State size") +MSG_HASH(MSG_STATE_SLOT, + "State slot") +MSG_HASH(MSG_TAKING_SCREENSHOT, + "Taking screenshot.") +MSG_HASH(MSG_TO, + "to") +MSG_HASH(MSG_UNDID_LOAD_STATE, + "Undid load state.") +MSG_HASH(MSG_UNDOING_SAVE_STATE, + "Undoing save state") +MSG_HASH(MSG_UNKNOWN, + "Unknown") +MSG_HASH(MSG_UNPAUSED, + "Unpaused.") +MSG_HASH(MSG_UNRECOGNIZED_COMMAND, + "Unrecognized command") +MSG_HASH(MSG_USING_CORE_NAME_FOR_NEW_CONFIG, + "Using core name for new config.") +MSG_HASH(MSG_USING_LIBRETRO_DUMMY_CORE_RECORDING_SKIPPED, + "Using libretro dummy core. Skipping recording.") +MSG_HASH(MSG_VALUE_CONNECT_DEVICE_FROM_A_VALID_PORT, + "Connect device from a valid port.") +MSG_HASH(MSG_VALUE_DISCONNECTING_DEVICE_FROM_PORT, + "Disconnecting device from port") +MSG_HASH(MSG_VALUE_REBOOTING, + "Rebooting...") +MSG_HASH(MSG_VALUE_SHUTTING_DOWN, + "Shutting down...") +MSG_HASH(MSG_VERSION_OF_LIBRETRO_API, + "Version of libretro API") +MSG_HASH(MSG_VIEWPORT_SIZE_CALCULATION_FAILED, + "Viewport size calculation failed! Will continue using raw data. This will probably not work right ...") +MSG_HASH(MSG_VIRTUAL_DISK_TRAY, + "virtual disk tray.") +MSG_HASH(MENU_ENUM_SUBLABEL_AUDIO_LATENCY, + "Desired audio latency in milliseconds. Might not be honored if the audio driver can't provide given latency.") +MSG_HASH(MENU_ENUM_SUBLABEL_AUDIO_MUTE, + "Mute/unmute audio.") +MSG_HASH( + MENU_ENUM_SUBLABEL_AUDIO_RATE_CONTROL_DELTA, + "Helps smooth out imperfections in timing when synchronizing audio and video. Be aware that if disabled, proper synchronization is nearly impossible to obtain." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_CAMERA_ALLOW, + "Allow or disallow camera access by cores." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_LOCATION_ALLOW, + "Allow or disallow location services access by cores." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_INPUT_MAX_USERS, + "Maximum amount of users supported by RetroArch." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_INPUT_POLL_TYPE_BEHAVIOR, + "Influence how input polling is done inside RetroArch. Setting it to 'Early' or 'Late' can result in less latency, depending on your configuration." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_INPUT_ALL_USERS_CONTROL_MENU, + "Allows any user to control the menu. If disabled, only User 1 can control the menu." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_AUDIO_VOLUME, + "Audio volume (in dB). 0 dB is normal volume, and no gain is applied." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_AUDIO_WASAPI_EXCLUSIVE_MODE, + "Allow the WASAPI driver to take exclusive control of the audio device. If disabled, it will use shared mode instead." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_AUDIO_WASAPI_FLOAT_FORMAT, + "Use float format for the WASAPI driver, if supported by your audio device." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_AUDIO_WASAPI_SH_BUFFER_LENGTH, + "The intermediate buffer length (in frames) when using the WASAPI driver in shared mode." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_AUDIO_SYNC, + "Synchronize audio. Recommended." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_INPUT_AXIS_THRESHOLD, + "How far an axis must be tilted to result in a button press." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_INPUT_BIND_TIMEOUT, + "Amount of seconds to wait until proceeding to the next bind." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_INPUT_TURBO_PERIOD, + "Describes the period when turbo-enabled buttons are toggled. Numbers are described in frames." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_INPUT_DUTY_CYCLE, + "Describes how long the period of a turbo-enabled button should be. Numbers are described in frames." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_VIDEO_VSYNC, + "Synchronizes the output video of the graphics card to the refresh rate of the screen. Recommended." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_VIDEO_ALLOW_ROTATE, + "Allow cores to set rotation. When disabled, rotation requests are ignored. Useful for setups where one manually rotates the screen." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_DUMMY_ON_CORE_SHUTDOWN, + "Some cores might have a shutdown feature. If enabled, it will prevent the core from shutting RetroArch down. Instead, it loads a dummy core." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_CHECK_FOR_MISSING_FIRMWARE, + "Check if all the required firmware is present before attempting to load content." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_VIDEO_REFRESH_RATE, + "Vertical refresh rate of your screen. Used to calculate a suitable audio input rate. NOTE: This will be ignored if 'Threaded Video' is enabled." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_AUDIO_ENABLE, + "Enable audio output." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_AUDIO_MAX_TIMING_SKEW, + "The maximum change in audio input rate. Increasing this enables very large changes in timing at the cost of an inaccurate audio pitch (e.g., running PAL cores on NTSC displays)." + ) +MSG_HASH( + MSG_FAILED, + "failed" + ) +MSG_HASH( + MSG_SUCCEEDED, + "succeeded" + ) +MSG_HASH( + MSG_DEVICE_NOT_CONFIGURED, + "not configured" + ) +MSG_HASH( + MSG_DEVICE_NOT_CONFIGURED_FALLBACK, + "not configured, using fallback" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_DATABASE_CURSOR_LIST, + "Database Cursor List" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_DATABASE_CURSOR_LIST_ENTRY_DEVELOPER, + "Database - Filter : Developer" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_DATABASE_CURSOR_LIST_ENTRY_PUBLISHER, + "Database - Filter : Publisher" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_DISABLED, + "Disabled" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_ENABLED, + "Enabled" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_CONTENT_HISTORY_PATH, + "Content History Path" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_DATABASE_CURSOR_LIST_ENTRY_ORIGIN, + "Database - Filter : Origin") +MSG_HASH(MENU_ENUM_LABEL_VALUE_DATABASE_CURSOR_LIST_ENTRY_FRANCHISE, + "Database - Filter : Franchise") +MSG_HASH(MENU_ENUM_LABEL_VALUE_DATABASE_CURSOR_LIST_ENTRY_ESRB_RATING, + "Database - Filter : ESRB Rating") +MSG_HASH(MENU_ENUM_LABEL_VALUE_DATABASE_CURSOR_LIST_ENTRY_ELSPA_RATING, + "Database - Filter : ELSPA Rating") +MSG_HASH(MENU_ENUM_LABEL_VALUE_DATABASE_CURSOR_LIST_ENTRY_PEGI_RATING, + "Database - Filter : PEGI Rating") +MSG_HASH(MENU_ENUM_LABEL_VALUE_DATABASE_CURSOR_LIST_ENTRY_CERO_RATING, + "Database - Filter : CERO Rating") +MSG_HASH(MENU_ENUM_LABEL_VALUE_DATABASE_CURSOR_LIST_ENTRY_BBFC_RATING, + "Database - Filter : BBFC Rating") +MSG_HASH(MENU_ENUM_LABEL_VALUE_DATABASE_CURSOR_LIST_ENTRY_MAX_USERS, + "Database - Filter : Max Users") +MSG_HASH(MENU_ENUM_LABEL_VALUE_DATABASE_CURSOR_LIST_ENTRY_RELEASEDATE_BY_MONTH, + "Database - Filter : Releasedate By Month") +MSG_HASH(MENU_ENUM_LABEL_VALUE_DATABASE_CURSOR_LIST_ENTRY_RELEASEDATE_BY_YEAR, + "Database - Filter : Releasedate By Year") +MSG_HASH(MENU_ENUM_LABEL_VALUE_DATABASE_CURSOR_LIST_ENTRY_EDGE_MAGAZINE_ISSUE, + "Database - Filter : Edge Magazine Issue") +MSG_HASH(MENU_ENUM_LABEL_VALUE_DATABASE_CURSOR_LIST_ENTRY_EDGE_MAGAZINE_RATING, + "Database - Filter : Edge Magazine Rating") +MSG_HASH(MENU_ENUM_LABEL_VALUE_DATABASE_CURSOR_LIST_ENTRY_DATABASE_INFO, + "Database Info") +MSG_HASH(MSG_WIFI_SCAN_COMPLETE, + "Wi-Fi scan complete.") +MSG_HASH(MSG_SCANNING_WIRELESS_NETWORKS, + "Scanning wireless networks...") +MSG_HASH(MSG_NETPLAY_LAN_SCAN_COMPLETE, + "Netplay scan complete.") +MSG_HASH(MSG_NETPLAY_LAN_SCANNING, + "Scanning for netplay hosts...") +MSG_HASH(MENU_ENUM_SUBLABEL_PAUSE_NONACTIVE, + "Pause gameplay when RetroArch is not the active window.") +MSG_HASH(MENU_ENUM_SUBLABEL_VIDEO_DISABLE_COMPOSITION, + "Enable or disable composition (Windows only).") +MSG_HASH(MENU_ENUM_SUBLABEL_HISTORY_LIST_ENABLE, + "Enable or disable recent playlist for games, images, music, and videos.") +MSG_HASH(MENU_ENUM_SUBLABEL_CONTENT_HISTORY_SIZE, + "Limit the number of entries in recent playlist for games, images, music, and videos.") +MSG_HASH(MENU_ENUM_LABEL_VALUE_INPUT_UNIFIED_MENU_CONTROLS, + "Unified Menu Controls") +MSG_HASH(MENU_ENUM_SUBLABEL_INPUT_UNIFIED_MENU_CONTROLS, + "Use the same controls for both the menu and the game. Applies to the keyboard.") +MSG_HASH(MENU_ENUM_SUBLABEL_VIDEO_FONT_ENABLE, + "Show onscreen messages.") +MSG_HASH(MENU_ENUM_LABEL_VALUE_NETWORK_USER_REMOTE_ENABLE, + "User %d Remote Enable") +MSG_HASH(MENU_ENUM_LABEL_VALUE_BATTERY_LEVEL_ENABLE, + "Show battery level") +MSG_HASH(MENU_ENUM_LABEL_VALUE_SELECT_FILE, + "Select File") +MSG_HASH(MENU_ENUM_LABEL_VALUE_SELECT_FROM_COLLECTION, + "Select From Collection") +MSG_HASH(MENU_ENUM_LABEL_VALUE_FILTER, + "Filter") +MSG_HASH(MENU_ENUM_LABEL_VALUE_SCALE, + "Scale") +MSG_HASH(MENU_ENUM_LABEL_VALUE_NETPLAY_START_WHEN_LOADED, + "Netplay will start when content is loaded.") +MSG_HASH(MENU_ENUM_LABEL_VALUE_NETPLAY_LOAD_CONTENT_MANUALLY, + "Couldn't find a suitable core or content file, load manually.") +MSG_HASH( + MENU_ENUM_LABEL_VALUE_BROWSE_URL_LIST, + "Browse URL" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_BROWSE_URL, + "URL Path" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_BROWSE_START, + "Start" + ) +MSG_HASH(MENU_ENUM_LABEL_VALUE_SHADER_PIPELINE_BOKEH, + "Bokeh") +MSG_HASH(MENU_ENUM_LABEL_VALUE_SHADER_PIPELINE_SNOWFLAKE, + "Snowflake") +MSG_HASH(MENU_ENUM_LABEL_VALUE_NETPLAY_REFRESH_ROOMS, + "Refresh Room List") +MSG_HASH(MENU_ENUM_LABEL_VALUE_NETPLAY_ROOM_NICKNAME, + "Nickname: %s") +MSG_HASH(MENU_ENUM_LABEL_VALUE_NETPLAY_ROOM_NICKNAME_LAN, + "Nickname (lan): %s") +MSG_HASH(MENU_ENUM_LABEL_VALUE_NETPLAY_COMPAT_CONTENT_FOUND, + "Compatible content found") +MSG_HASH(MENU_ENUM_SUBLABEL_VIDEO_CROP_OVERSCAN, + "Cuts off a few pixels around the edges of the image customarily left blank by developers which sometimes also contain garbage pixels.") +MSG_HASH(MENU_ENUM_SUBLABEL_VIDEO_SMOOTH, + "Adds a slight blur to the image to take the edge off of the hard pixel edges. This option has very little impact on performance.") +MSG_HASH(MENU_ENUM_SUBLABEL_VIDEO_FILTER, + "Apply a CPU-powered video filter. NOTE: Might come at a high performance cost. Some video filters might only work for cores that use 32bit or 16bit color.") +MSG_HASH(MENU_ENUM_SUBLABEL_CHEEVOS_USERNAME, + "Input the username of your RetroAchievements account.") +MSG_HASH(MENU_ENUM_SUBLABEL_CHEEVOS_PASSWORD, + "Input the password of your RetroAchievements account.") +MSG_HASH(MENU_ENUM_SUBLABEL_NETPLAY_NICKNAME, + "Input your user name here. This will be used for netplay sessions, among other things.") +MSG_HASH(MENU_ENUM_SUBLABEL_VIDEO_POST_FILTER_RECORD, + "Capture the image after filters (but not shaders) are applied. Your video will look as fancy as what you see on your screen.") +MSG_HASH(MENU_ENUM_SUBLABEL_CORE_LIST, + "Select which core to use.") +MSG_HASH(MENU_ENUM_SUBLABEL_LOAD_CONTENT_LIST, + "Select which content to start.") +MSG_HASH(MENU_ENUM_SUBLABEL_NETWORK_INFORMATION, + "Show network interface(s) and associated IP addresses.") +MSG_HASH(MENU_ENUM_SUBLABEL_SYSTEM_INFORMATION, + "Show information specific to the device.") +MSG_HASH(MENU_ENUM_SUBLABEL_QUIT_RETROARCH, + "Quit the program.") +MSG_HASH(MENU_ENUM_SUBLABEL_VIDEO_WINDOW_WIDTH, + "Set the custom width size for the display window. Leaving it at 0 will attempt to scale the window as large as possible.") +MSG_HASH(MENU_ENUM_SUBLABEL_VIDEO_WINDOW_HEIGHT, + "Set the custom height size for the display window. Leaving it at 0 will attempt to scale the window as large as possible.") +MSG_HASH(MENU_ENUM_SUBLABEL_VIDEO_FULLSCREEN_X, + "Set the custom width size for the non-windowed fullscreen mode. Leaving it at 0 will use the desktop resolution.") +MSG_HASH(MENU_ENUM_SUBLABEL_VIDEO_FULLSCREEN_Y, + "Set the custom height size for the non-windowed fullscreen mode. Leaving it at 0 will use the desktop resolution") +MSG_HASH(MENU_ENUM_SUBLABEL_VIDEO_MESSAGE_POS_X, + "Specify custom X axis position for onscreen text.") +MSG_HASH(MENU_ENUM_SUBLABEL_VIDEO_MESSAGE_POS_Y, + "Specify custom Y axis position for onscreen text.") +MSG_HASH(MENU_ENUM_SUBLABEL_VIDEO_FONT_SIZE, + "Specify the font size in points.") +MSG_HASH(MENU_ENUM_SUBLABEL_INPUT_OVERLAY_HIDE_IN_MENU, + "Hide the overlay while inside the menu, and show it again when exiting the menu.") +MSG_HASH(MENU_ENUM_SUBLABEL_INPUT_OVERLAY_SHOW_PHYSICAL_INPUTS, + "Show keyboard/controller inputs on the onscreen overlay.") +MSG_HASH(MENU_ENUM_SUBLABEL_INPUT_OVERLAY_SHOW_PHYSICAL_INPUTS_PORT, + "Select the port for the overlay to listen to if Show Inputs On Overlay is enabled.") +MSG_HASH( + MENU_ENUM_SUBLABEL_CONTENT_COLLECTION_LIST, + "Scanned content will appear here." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_VIDEO_SCALE_INTEGER, + "Only scales video in integer steps. The base size depends on system-reported geometry and aspect ratio. If 'Force Aspect' is not set, X/Y will be integer scaled independently." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_VIDEO_GPU_SCREENSHOT, + "Screenshots output of GPU shaded material if available." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_VIDEO_ROTATION, + "Forces a certain rotation of the screen. The rotation is added to rotations which the core sets." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_VIDEO_FORCE_SRGB_DISABLE, + "Forcibly disable sRGB FBO support. Some Intel OpenGL drivers on Windows have video problems with sRGB FBO support if this is enabled. Enabling this can work around it." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_VIDEO_FULLSCREEN, + "Start in fullscreen. Can be changed at runtime. Can be overriden by a command line switch" + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_VIDEO_WINDOWED_FULLSCREEN, + "If fullscreen, prefer using a windowed fullscreen mode." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_VIDEO_GPU_RECORD, + "Records output of GPU shaded material if available." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_SAVESTATE_AUTO_INDEX, + "When making a savestate, save state index is automatically increased before it is saved. When loading content, the index will be set to the highest existing index." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_BLOCK_SRAM_OVERWRITE, + "Block Save RAM from being overwritten when loading save states. Might potentially lead to buggy games." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_FASTFORWARD_RATIO, + "The maximum rate at which content will be run when using fast forward (e.g., 5.0x for 60 fps content = 300 fps cap). If set to 0.0x, fastforward ratio is unlimited (no FPS cap)." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_SLOWMOTION_RATIO, + "When in slow motion, content will slow down by the factor specified/set." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_REWIND_ENABLE, + "Enable rewinding. This will take a performance hit when playing." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_REWIND_GRANULARITY, + "When rewinding a defined number of frames, you can rewind several frames at a time, increasing the rewind speed." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_LIBRETRO_LOG_LEVEL, + "Sets log level for cores. If a log level issued by a core is below this value, it is ignored." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_PERFCNT_ENABLE, + "Enable performance counters for RetroArch (and cores)." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_SAVESTATE_AUTO_SAVE, + "Automatically makes a savestate at the end of RetroArch's runtime. RetroArch will automatically load this savestate if 'Auto Load State' is enabled." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_SAVESTATE_AUTO_LOAD, + "Automatically load the auto save state on startup." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_SAVESTATE_THUMBNAIL_ENABLE, + "Show thumbnails of save states inside the menu." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_AUTOSAVE_INTERVAL, + "Autosaves the non-volatile Save RAM at a regular interval. This is disabled by default unless set otherwise. The interval is measured in seconds. A value of 0 disables autosave." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_INPUT_REMAP_BINDS_ENABLE, + "If enabled, overrides the input binds with the remapped binds set for the current core." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_INPUT_AUTODETECT_ENABLE, + "Enable input auto-detection. Will attempt to autoconfigure joypads, Plug-and-Play style." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_MENU_INPUT_SWAP_OK_CANCEL, + "Swap buttons for OK/Cancel. Disabled is the Japanese button orientation, enabled is the western orientation." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_PAUSE_LIBRETRO, + "If disabled, the content will keep running in the background when RetroArch's menu is toggled." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_VIDEO_DRIVER, + "Video driver to use." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_AUDIO_DRIVER, + "Audio driver to use." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_INPUT_DRIVER, + "Input driver to use. Depending on the video driver, it might force a different input driver." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_JOYPAD_DRIVER, + "Joypad driver to use." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_AUDIO_RESAMPLER_DRIVER, + "Audio resampler driver to use." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_CAMERA_DRIVER, + "Camera driver to use." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_LOCATION_DRIVER, + "Location driver to use." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_MENU_DRIVER, + "Menu driver to use." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_RECORD_DRIVER, + "Record driver to use." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_WIFI_DRIVER, + "WiFi driver to use." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_NAVIGATION_BROWSER_FILTER_SUPPORTED_EXTENSIONS_ENABLE, + "Filter files being shown in filebrowser by supported extensions." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_MENU_WALLPAPER, + "Select an image to set as menu wallpaper." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_DYNAMIC_WALLPAPER, + "Dynamically load a new wallpaper depending on context." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_AUDIO_DEVICE, + "Override the default audio device the audio driver uses. This is driver dependent." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_AUDIO_DSP_PLUGIN, + "Audio DSP plugin that processes audio before it's sent to the driver." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_AUDIO_OUTPUT_RATE, + "Audio output sample rate." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_OVERLAY_OPACITY, + "Opacity of all UI elements of the overlay." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_OVERLAY_SCALE, + "Scale of all UI elements of the overlay." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_INPUT_OVERLAY_ENABLE, + "Enable the overlay." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_OVERLAY_PRESET, + "Select an overlay from the file browser." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_NETPLAY_IP_ADDRESS, + "The address of the host to connect to." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_NETPLAY_TCP_UDP_PORT, + "The port of the host IP address. Can be either a TCP or UDP port." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_NETPLAY_PASSWORD, + "The password for connecting to the netplay host. Used only in host mode." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_NETPLAY_PUBLIC_ANNOUNCE, + "Whether to announce netplay games publicly. If unset, clients must manually connect rather than using the public lobby." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_NETPLAY_SPECTATE_PASSWORD, + "The password for connecting to the netplay host with only spectator privileges. Used only in host mode." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_NETPLAY_START_AS_SPECTATOR, + "Whether to start netplay in spectator mode." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_NETPLAY_ALLOW_SLAVES, + "Whether to allow connections in slave mode. Slave-mode clients require very little processing power on either side, but will suffer significantly from network latency." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_NETPLAY_REQUIRE_SLAVES, + "Whether to disallow connections not in slave mode. Not recommended except for very fast networks with very weak machines." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_NETPLAY_STATELESS_MODE, + "Whether to run netplay in a mode not requiring save states. If set to true, a very fast network is required, but no rewinding is performed, so there will be no netplay jitter." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_NETPLAY_CHECK_FRAMES, + "The frequency in frames with which netplay will verify that the host and client are in sync." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_NETPLAY_NAT_TRAVERSAL, + "When hosting, attempt to listen for connections from the public Internet, using UPnP or similar technologies to escape LANs." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_STDIN_CMD_ENABLE, + "Enable stdin command interface." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_MOUSE_ENABLE, + "Enable mouse controls inside the menu." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_POINTER_ENABLE, + "Enable touch controls inside the menu." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_THUMBNAILS, + "Type of thumbnail to display." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_TIMEDATE_ENABLE, + "Shows current date and/or time inside the menu." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_BATTERY_LEVEL_ENABLE, + "Shows current battery level inside the menu." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_NAVIGATION_WRAPAROUND, + "Wrap-around to beginning and/or end if boundary of list is reached horizontally or vertically." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_NETPLAY_ENABLE_HOST, + "Enables netplay in host (server) mode." + ) +MSG_HASH(MENU_ENUM_SUBLABEL_NETPLAY_ENABLE_CLIENT, + "Enables netplay in client mode.") +MSG_HASH(MENU_ENUM_SUBLABEL_NETPLAY_DISCONNECT, + "Disconnects an active Netplay connection.") +MSG_HASH(MENU_ENUM_SUBLABEL_SCAN_DIRECTORY, + "Scans a directory for compatible files and add them to the collection.") +MSG_HASH(MENU_ENUM_SUBLABEL_SCAN_FILE, + "Scans a compatible file and add it to the collection.") +MSG_HASH(MENU_ENUM_SUBLABEL_VIDEO_SWAP_INTERVAL, + "Uses a custom swap interval for Vsync. Set this to effectively halve monitor refresh rate." + ) +MSG_HASH(MENU_ENUM_SUBLABEL_SORT_SAVEFILES_ENABLE, + "Sort save files in folders named after the core used." + ) +MSG_HASH(MENU_ENUM_SUBLABEL_SORT_SAVESTATES_ENABLE, + "Sort save states in folders named after the core used." + ) +MSG_HASH(MENU_ENUM_SUBLABEL_NETPLAY_REQUEST_DEVICE_I, + "Request to play with the given input device.") +MSG_HASH(MENU_ENUM_SUBLABEL_CORE_UPDATER_BUILDBOT_URL, + "URL to core updater directory on the Libretro buildbot.") +MSG_HASH(MENU_ENUM_SUBLABEL_BUILDBOT_ASSETS_URL, + "URL to assets updater directory on the Libretro buildbot.") +MSG_HASH(MENU_ENUM_SUBLABEL_CORE_UPDATER_AUTO_EXTRACT_ARCHIVE, + "After downloading, automatically extract files contained in the downloaded archives." + ) +MSG_HASH(MENU_ENUM_SUBLABEL_NETPLAY_REFRESH_ROOMS, + "Scan for new rooms.") +MSG_HASH(MENU_ENUM_SUBLABEL_DELETE_ENTRY, + "Remove this entry from the collection.") +MSG_HASH(MENU_ENUM_SUBLABEL_INFORMATION, + "View more information about the content.") +MSG_HASH(MENU_ENUM_SUBLABEL_ADD_TO_FAVORITES, + "Add the entry to your favorites.") +MSG_HASH(MENU_ENUM_SUBLABEL_ADD_TO_FAVORITES_PLAYLIST, + "Add the entry to your favorites.") +MSG_HASH(MENU_ENUM_SUBLABEL_RUN, + "Start the content.") +MSG_HASH(MENU_ENUM_SUBLABEL_MENU_FILE_BROWSER_SETTINGS, + "Adjusts filebrowser settings.") +MSG_HASH( + MENU_ENUM_SUBLABEL_AUTO_REMAPS_ENABLE, + "Enable customized controls by default at startup." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_AUTO_OVERRIDES_ENABLE, + "Enable customized configuration by default at startup." + ) +MSG_HASH(MENU_ENUM_SUBLABEL_GAME_SPECIFIC_OPTIONS, + "Enable customized core options by default at startup.") +MSG_HASH(MENU_ENUM_SUBLABEL_CORE_ENABLE, + "Shows current core name inside menu.") +MSG_HASH(MENU_ENUM_SUBLABEL_DATABASE_MANAGER, + "View databases.") +MSG_HASH(MENU_ENUM_SUBLABEL_CURSOR_MANAGER, + "View previous searches.") +MSG_HASH(MENU_ENUM_SUBLABEL_TAKE_SCREENSHOT, + "Captures an image of the screen.") +MSG_HASH( + MENU_ENUM_SUBLABEL_CLOSE_CONTENT, + "Closes the current content. Any unsaved changes might be lost." + ) +MSG_HASH(MENU_ENUM_SUBLABEL_LOAD_STATE, + "Load a saved state from the currently selected slot.") +MSG_HASH(MENU_ENUM_SUBLABEL_SAVE_STATE, + "Save a state to the currently selected slot.") +MSG_HASH(MENU_ENUM_SUBLABEL_RESUME, + "Resume the currently running content and leave the Quick Menu.") +MSG_HASH(MENU_ENUM_SUBLABEL_RESUME_CONTENT, + "Resume the currently running content and leave the Quick Menu.") +MSG_HASH(MENU_ENUM_SUBLABEL_STATE_SLOT, + "Changes the currently selected state slot.") +MSG_HASH(MENU_ENUM_SUBLABEL_UNDO_LOAD_STATE, + "If a state was loaded, content will go back to the state prior to loading.") +MSG_HASH(MENU_ENUM_SUBLABEL_UNDO_SAVE_STATE, + "If a state was overwritten, it will roll back to the previous save state.") +MSG_HASH( + MENU_ENUM_SUBLABEL_ACCOUNTS_RETRO_ACHIEVEMENTS, + "RetroAchievements service. For more information, visit http://retroachievements.org" + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_ACCOUNTS_LIST, + "Manages currently configured accounts." + ) +MSG_HASH(MENU_ENUM_SUBLABEL_INPUT_META_REWIND, + "Manages rewind settings.") +MSG_HASH(MENU_ENUM_SUBLABEL_RESTART_CONTENT, + "Restarts the content from the beginning.") +MSG_HASH(MENU_ENUM_SUBLABEL_SAVE_CURRENT_CONFIG_OVERRIDE_CORE, + "Saves an override configuration file which will apply for all content loaded with this core. Will take precedence over the main configuration.") +MSG_HASH(MENU_ENUM_SUBLABEL_SAVE_CURRENT_CONFIG_OVERRIDE_GAME, + "Saves an override configuration file which will apply for the current content only. Will take precedence over the main configuration.") +MSG_HASH(MENU_ENUM_SUBLABEL_CORE_CHEAT_OPTIONS, + "Set up cheat codes.") +MSG_HASH(MENU_ENUM_SUBLABEL_SHADER_OPTIONS, + "Set up shaders to visually augment the image.") +MSG_HASH(MENU_ENUM_SUBLABEL_CORE_INPUT_REMAPPING_OPTIONS, + "Change the controls for the currently running content.") +MSG_HASH(MENU_ENUM_SUBLABEL_CORE_OPTIONS, + "Change the options for the currently running content.") +MSG_HASH(MENU_ENUM_SUBLABEL_SHOW_ADVANCED_SETTINGS, + "Show advanced settings for power users (hidden by default).") +MSG_HASH(MENU_ENUM_SUBLABEL_THREADED_DATA_RUNLOOP_ENABLE, + "Perform tasks on a separate thread.") +MSG_HASH(MENU_ENUM_SUBLABEL_PLAYLIST_ENTRY_REMOVE, + "Allow the user to remove entries from collections.") +MSG_HASH(MENU_ENUM_SUBLABEL_SYSTEM_DIRECTORY, + "Sets the System directory. Cores can query for this directory to load BIOSes, system-specific configs, etc.") +MSG_HASH(MENU_ENUM_SUBLABEL_RGUI_BROWSER_DIRECTORY, + "Sets start directory for the filebrowser.") +MSG_HASH( + MENU_ENUM_SUBLABEL_CONTENT_DIR, + "Usually set by developers who bundle libretro/RetroArch apps to point to assets." + ) +MSG_HASH(MENU_ENUM_SUBLABEL_DYNAMIC_WALLPAPERS_DIRECTORY, + "Directory to store wallpapers dynamically loaded by the menu depending on context.") +MSG_HASH(MENU_ENUM_SUBLABEL_THUMBNAILS_DIRECTORY, + "Supplementary thumbnails (boxarts/misc. images, etc.) are stored here." + ) +MSG_HASH(MENU_ENUM_SUBLABEL_RGUI_CONFIG_DIRECTORY, + "Sets start directory for menu configuration browser.") +MSG_HASH(MENU_ENUM_SUBLABEL_NETPLAY_INPUT_LATENCY_FRAMES_MIN, + "The number of frames of input latency for netplay to use to hide network latency. Reduces jitter and makes netplay less CPU-intensive, at the expense of noticeable input lag.") +MSG_HASH(MENU_ENUM_SUBLABEL_NETPLAY_INPUT_LATENCY_FRAMES_RANGE, + "The range of frames of input latency that may be used to hide network latency. Reduces jitter and makes netplay less CPU-intensive, at the expense of unpredictable input lag.") +MSG_HASH(MENU_ENUM_SUBLABEL_DISK_CYCLE_TRAY_STATUS, + "Cycle the current disk. If the disk is inserted, it will eject the disk. If the disk has not been inserted, it will be inserted. ") +MSG_HASH(MENU_ENUM_SUBLABEL_DISK_INDEX, + "Change the disk index.") +MSG_HASH(MENU_ENUM_SUBLABEL_DISK_OPTIONS, + "Disk image management.") +MSG_HASH(MENU_ENUM_SUBLABEL_DISK_IMAGE_APPEND, + "Select a disk image to insert.") +MSG_HASH(MENU_ENUM_SUBLABEL_MENU_ENUM_THROTTLE_FRAMERATE, + "Makes sure the framerate is capped while inside the menu.") +MSG_HASH(MENU_ENUM_SUBLABEL_XMB_THEME, + "Select a different theme for the icon. Changes will take effect after you restart the program.") +MSG_HASH(MENU_ENUM_SUBLABEL_XMB_SHADOWS_ENABLE, + "Enable drop shadows for all icons. This will have a minor performance hit.") +MSG_HASH(MENU_ENUM_SUBLABEL_MATERIALUI_MENU_COLOR_THEME, + "Select a different background color gradient theme.") +MSG_HASH(MENU_ENUM_SUBLABEL_MENU_WALLPAPER_OPACITY, + "Modify the opacity of the background wallpaper.") +MSG_HASH(MENU_ENUM_SUBLABEL_XMB_MENU_COLOR_THEME, + "Select a different background color gradient theme.") +MSG_HASH(MENU_ENUM_SUBLABEL_XMB_RIBBON_ENABLE, + "Select an animated background effect. Can be GPU-intensive depending on the effect. If performance is unsatisfactory, either turn this off or revert to a simpler effect.") +MSG_HASH(MENU_ENUM_SUBLABEL_XMB_FONT, + "Select a different main font to be used by the menu.") +MSG_HASH(MENU_ENUM_SUBLABEL_CONTENT_SHOW_FAVORITES, + "Show the favorites tab inside the main menu.") +MSG_HASH(MENU_ENUM_SUBLABEL_CONTENT_SHOW_IMAGES, + "Show the image tab inside the main menu.") +MSG_HASH(MENU_ENUM_SUBLABEL_CONTENT_SHOW_MUSIC, + "Show the music tab inside the main menu.") +MSG_HASH(MENU_ENUM_SUBLABEL_CONTENT_SHOW_VIDEO, + "Show the video tab inside the main menu.") +MSG_HASH(MENU_ENUM_SUBLABEL_CONTENT_SHOW_NETPLAY, + "Show the netplay tab inside the main menu.") +MSG_HASH(MENU_ENUM_SUBLABEL_CONTENT_SHOW_SETTINGS, + "Show the settings tab inside the main menu.") +MSG_HASH(MENU_ENUM_SUBLABEL_CONTENT_SHOW_HISTORY, + "Show the recent history tab inside the main menu.") +MSG_HASH(MENU_ENUM_SUBLABEL_CONTENT_SHOW_ADD, + "Show the import content tab inside the main menu.") +MSG_HASH(MENU_ENUM_SUBLABEL_RGUI_SHOW_START_SCREEN, + "Show startup screen in menu. This is automatically set to false after the program starts for the first time.") +MSG_HASH(MENU_ENUM_SUBLABEL_MATERIALUI_MENU_HEADER_OPACITY, + "Modify the opacity of the header graphic.") +MSG_HASH(MENU_ENUM_SUBLABEL_MATERIALUI_MENU_FOOTER_OPACITY, + "Modify the opacity of the footer graphic.") +MSG_HASH(MENU_ENUM_SUBLABEL_DPI_OVERRIDE_ENABLE, + "The menu normally scales itself dynamically. If you want to set a specific scaling size instead, enable this.") +MSG_HASH(MENU_ENUM_SUBLABEL_DPI_OVERRIDE_VALUE, + "Set the custom scaling size here. NOTE: You have to enable 'DPI Override' for this scaling size to take effect.") +MSG_HASH(MENU_ENUM_SUBLABEL_CORE_ASSETS_DIRECTORY, + "Save all downloaded files to this directory.") +MSG_HASH(MENU_ENUM_SUBLABEL_INPUT_REMAPPING_DIRECTORY, + "Save all remapped controls to this directory.") +MSG_HASH(MENU_ENUM_SUBLABEL_LIBRETRO_DIR_PATH, + "Directory where the program searches for content/cores.") +MSG_HASH(MENU_ENUM_SUBLABEL_LIBRETRO_INFO_PATH, + "Application/core information files are stored here.") +MSG_HASH(MENU_ENUM_SUBLABEL_JOYPAD_AUTOCONFIG_DIR, + "If a joypad is plugged in, that joypad will be autoconfigured if a config file corresponding to it is present inside this directory.") +MSG_HASH(MENU_ENUM_SUBLABEL_PLAYLIST_DIRECTORY, + "Save all collections to this directory.") +MSG_HASH( + MENU_ENUM_SUBLABEL_CACHE_DIRECTORY, + "If set to a directory, content which is temporarily extracted (e.g. from archives) will be extracted to this directory." + ) +MSG_HASH(MENU_ENUM_SUBLABEL_CURSOR_DIRECTORY, + "Saved queries are stored to this directory.") +MSG_HASH( + MENU_ENUM_SUBLABEL_CONTENT_DATABASE_DIRECTORY, + "Databases are stored to this directory." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_ASSETS_DIRECTORY, + "This location is queried by default when menu interfaces try to look for loadable assets, etc." + ) +MSG_HASH(MENU_ENUM_SUBLABEL_SAVEFILE_DIRECTORY, + "Save all save files to this directory. If not set, will try to save inside the content file's working directory.") +MSG_HASH(MENU_ENUM_SUBLABEL_SAVESTATE_DIRECTORY, + "Save all save states to this directory. If not set, will try to save inside the content file's working directory.") +MSG_HASH(MENU_ENUM_SUBLABEL_SCREENSHOT_DIRECTORY, + "Directory to dump screenshots to.") +MSG_HASH(MENU_ENUM_SUBLABEL_OVERLAY_DIRECTORY, + "Defines a directory where overlays are kept for easy access.") +MSG_HASH( + MENU_ENUM_SUBLABEL_CHEAT_DATABASE_PATH, + "Cheat files are kept here." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_AUDIO_FILTER_DIR, + "Directory where audio DSP filter files are kept." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_VIDEO_FILTER_DIR, + "Directory where CPU-based video filter files are kept." + ) +MSG_HASH(MENU_ENUM_SUBLABEL_VIDEO_SHADER_DIR, + "Defines a directory where GPU-based video shader files are kept for easy access.") +MSG_HASH(MENU_ENUM_SUBLABEL_RECORDING_OUTPUT_DIRECTORY, + "Recordings will be dumped to this directory.") +MSG_HASH(MENU_ENUM_SUBLABEL_RECORDING_CONFIG_DIRECTORY, + "Recording configurations will be kept here.") +MSG_HASH(MENU_ENUM_SUBLABEL_VIDEO_FONT_PATH, + "Select a different font for onscreen notifications.") +MSG_HASH(MENU_ENUM_SUBLABEL_SHADER_APPLY_CHANGES, + "Changes to the shader configuration will take effect immediately. Use this if you changed the amount of shader passes, filtering, FBO scale, etc.") +MSG_HASH( + MENU_ENUM_SUBLABEL_VIDEO_SHADER_NUM_PASSES, + "Increase or decrease the amount of shader pipeline passes. You can bind a separate shader to each pipeline pass and configure its scale and filtering." + ) +MSG_HASH(MENU_ENUM_SUBLABEL_VIDEO_SHADER_PRESET, + "Load a shader preset. The shader pipeline will be automatically set-up.") +MSG_HASH(MENU_ENUM_SUBLABEL_VIDEO_SHADER_PRESET_SAVE_AS, + "Save the current shader settings as a new shader preset.") +MSG_HASH(MENU_ENUM_SUBLABEL_VIDEO_SHADER_PRESET_SAVE_CORE, + "Save the current shader settings as the default settings for this application/core.") +MSG_HASH(MENU_ENUM_SUBLABEL_VIDEO_SHADER_PRESET_SAVE_GAME, + "Save the current shader settings as the default settings for the content.") +MSG_HASH(MENU_ENUM_SUBLABEL_VIDEO_SHADER_PARAMETERS, + "Modifies the current shader directly. Changes will not be saved to the preset file.") +MSG_HASH(MENU_ENUM_SUBLABEL_VIDEO_SHADER_PRESET_PARAMETERS, + "Modifies the shader preset itself currently used in the menu.") +MSG_HASH( + MENU_ENUM_SUBLABEL_CHEAT_NUM_PASSES, + "Increase or decrease the amount of cheats." + ) +MSG_HASH(MENU_ENUM_SUBLABEL_CHEAT_APPLY_CHANGES, + "Cheat changes will take effect immediately.") +MSG_HASH( + MENU_ENUM_SUBLABEL_CHEAT_FILE_LOAD, + "Load a cheat file." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_CHEAT_FILE_SAVE_AS, + "Save current cheats as a save file." + ) +MSG_HASH(MENU_ENUM_SUBLABEL_CONTENT_SETTINGS, + "Quickly access all relevant in-game settings.") +MSG_HASH(MENU_ENUM_SUBLABEL_CORE_INFORMATION, + "View information pertaining to the application/core.") +MSG_HASH(MENU_ENUM_SUBLABEL_VIDEO_ASPECT_RATIO, + "Floating point value for video aspect ratio (width / height), used if the Aspect Ratio is set to 'Config'.") +MSG_HASH(MENU_ENUM_SUBLABEL_VIDEO_VIEWPORT_CUSTOM_HEIGHT, + "Custom viewport height that is used if the Aspect Ratio is set to 'Custom'.") +MSG_HASH(MENU_ENUM_SUBLABEL_VIDEO_VIEWPORT_CUSTOM_WIDTH, + "Custom viewport width that is used if the Aspect Ratio is set to 'Custom'.") +MSG_HASH(MENU_ENUM_SUBLABEL_VIDEO_VIEWPORT_CUSTOM_X, + "Custom viewport offset used for defining the X-axis position of the viewport. These are ignored if 'Integer Scale' is enabled. It will be automatically centered then.") +MSG_HASH(MENU_ENUM_SUBLABEL_VIDEO_VIEWPORT_CUSTOM_Y, + "Custom viewport offset used for defining the Y-axis position of the viewport. These are ignored if 'Integer Scale' is enabled. It will be automatically centered then.") +MSG_HASH(MENU_ENUM_LABEL_VALUE_NETPLAY_USE_MITM_SERVER, + "Use Relay Server") +MSG_HASH(MENU_ENUM_SUBLABEL_NETPLAY_USE_MITM_SERVER, + "Forward netplay connections through a man-in-the-middle server. Useful if the host is behind a firewall or has NAT/UPnP problems.") +MSG_HASH(MENU_ENUM_LABEL_VALUE_NETPLAY_MITM_SERVER, + "Relay Server Location") +MSG_HASH(MENU_ENUM_SUBLABEL_NETPLAY_MITM_SERVER, + "Choose a specific relay server to use. Geographically closer locations tend to have lower latency.") +MSG_HASH(MENU_ENUM_LABEL_VALUE_ADD_TO_MIXER, + "Add to mixer") +MSG_HASH(MENU_ENUM_LABEL_VALUE_ADD_TO_MIXER_AND_COLLECTION, + "Add to mixer") +MSG_HASH(MENU_ENUM_LABEL_VALUE_FILTER_BY_CURRENT_CORE, + "Filter by current core") +MSG_HASH( + MSG_AUDIO_MIXER_VOLUME, + "Global audio mixer volume" + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_AUDIO_MIXER_VOLUME, + "Global audio mixer volume (in dB). 0 dB is normal volume, and no gain is applied." + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_AUDIO_MIXER_VOLUME, + "Audio Mixer Volume Level (dB)" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_AUDIO_MIXER_MUTE, + "Audio Mixer Mute" + ) +MSG_HASH(MENU_ENUM_SUBLABEL_AUDIO_MIXER_MUTE, + "Mute/unmute mixer audio.") +MSG_HASH(MENU_ENUM_LABEL_VALUE_MENU_SHOW_ONLINE_UPDATER, + "Show Online Updater") +MSG_HASH(MENU_ENUM_SUBLABEL_MENU_SHOW_ONLINE_UPDATER, + "Show/hide the 'Online Updater' option.") +MSG_HASH(MENU_ENUM_LABEL_VALUE_MENU_VIEWS_SETTINGS, + "Views") +MSG_HASH( + MENU_ENUM_SUBLABEL_MENU_VIEWS_SETTINGS, + "Show or hide elements on the menu screen." + ) +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(MSG_PREPARING_FOR_CONTENT_SCAN, + "Preparing for content scan...") +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_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, + "Favorites") +MSG_HASH(MENU_ENUM_SUBLABEL_GOTO_FAVORITES, + "Content which you have added to 'Favorites' will appear here.") +MSG_HASH(MENU_ENUM_LABEL_VALUE_GOTO_MUSIC, + "Music") +MSG_HASH(MENU_ENUM_SUBLABEL_GOTO_MUSIC, + "Music which has been previously played will appear here.") +MSG_HASH(MENU_ENUM_LABEL_VALUE_GOTO_IMAGES, + "Image") +MSG_HASH(MENU_ENUM_SUBLABEL_GOTO_IMAGES, + "Images which have been previously viewed will appear here.") +MSG_HASH(MENU_ENUM_LABEL_VALUE_GOTO_VIDEO, + "Video") +MSG_HASH(MENU_ENUM_SUBLABEL_GOTO_VIDEO, + "Videos which have been previously played will appear here.") +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_CONTENT_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_CONTENT_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") +MSG_HASH(MENU_ENUM_LABEL_VALUE_MENU_SHOW_LOAD_CORE, + "Show Load Core") +MSG_HASH(MENU_ENUM_SUBLABEL_MENU_SHOW_LOAD_CORE, + "Show/hide the 'Load Core' option.") +MSG_HASH(MENU_ENUM_LABEL_VALUE_MENU_SHOW_LOAD_CONTENT, + "Show Load Content") +MSG_HASH(MENU_ENUM_SUBLABEL_MENU_SHOW_LOAD_CONTENT, + "Show/hide the 'Load Content' option.") +MSG_HASH(MENU_ENUM_LABEL_VALUE_MENU_SHOW_INFORMATION, + "Show Information") +MSG_HASH(MENU_ENUM_SUBLABEL_MENU_SHOW_INFORMATION, + "Show/hide the 'Information' option.") +MSG_HASH(MENU_ENUM_LABEL_VALUE_MENU_SHOW_CONFIGURATIONS, + "Show Configurations") +MSG_HASH(MENU_ENUM_SUBLABEL_MENU_SHOW_CONFIGURATIONS, + "Show/hide the 'Configurations' option.") +MSG_HASH(MENU_ENUM_LABEL_VALUE_MENU_SHOW_HELP, + "Show Help") +MSG_HASH(MENU_ENUM_SUBLABEL_MENU_SHOW_HELP, + "Show/hide the 'Help' option.") +MSG_HASH(MENU_ENUM_LABEL_VALUE_MENU_SHOW_QUIT_RETROARCH, + "Show Quit RetroArch") +MSG_HASH(MENU_ENUM_SUBLABEL_MENU_SHOW_QUIT_RETROARCH, + "Show/hide the 'Quit RetroArch' option.") +MSG_HASH(MENU_ENUM_LABEL_VALUE_MENU_SHOW_REBOOT, + "Show Reboot") +MSG_HASH(MENU_ENUM_SUBLABEL_MENU_SHOW_REBOOT, + "Show/hide the 'Reboot' option.") +MSG_HASH(MENU_ENUM_LABEL_VALUE_QUICK_MENU_VIEWS_SETTINGS, + "القائمة السريعة") +MSG_HASH(MENU_ENUM_SUBLABEL_QUICK_MENU_VIEWS_SETTINGS, + "Show or hide elements on the Quick Menu screen.") +MSG_HASH(MENU_ENUM_LABEL_VALUE_QUICK_MENU_SHOW_TAKE_SCREENSHOT, + "Show Take Screenshot") +MSG_HASH(MENU_ENUM_SUBLABEL_QUICK_MENU_SHOW_TAKE_SCREENSHOT, + "Show/hide the 'Take Screenshot' option.") +MSG_HASH(MENU_ENUM_LABEL_VALUE_QUICK_MENU_SHOW_SAVE_LOAD_STATE, + "Show Save/Load State") +MSG_HASH(MENU_ENUM_SUBLABEL_QUICK_MENU_SHOW_SAVE_LOAD_STATE, + "Show/hide the options for saving/loading state.") +MSG_HASH(MENU_ENUM_LABEL_VALUE_QUICK_MENU_SHOW_UNDO_SAVE_LOAD_STATE, + "Show Undo Save/Load State") +MSG_HASH(MENU_ENUM_SUBLABEL_QUICK_MENU_SHOW_UNDO_SAVE_LOAD_STATE, + "Show/hide the options for undoing save/load state.") +MSG_HASH(MENU_ENUM_LABEL_VALUE_QUICK_MENU_SHOW_ADD_TO_FAVORITES, + "Show Add to Favorites") +MSG_HASH(MENU_ENUM_SUBLABEL_QUICK_MENU_SHOW_ADD_TO_FAVORITES, + "Show/hide the 'Add to Favorites' option.") +MSG_HASH(MENU_ENUM_LABEL_VALUE_QUICK_MENU_SHOW_OPTIONS, + "Show Options") +MSG_HASH(MENU_ENUM_SUBLABEL_QUICK_MENU_SHOW_OPTIONS, + "Show/hide the 'Options' option.") +MSG_HASH(MENU_ENUM_LABEL_VALUE_QUICK_MENU_SHOW_CONTROLS, + "Show Controls") +MSG_HASH(MENU_ENUM_SUBLABEL_QUICK_MENU_SHOW_CONTROLS, + "Show/hide the 'Controls' option.") +MSG_HASH(MENU_ENUM_LABEL_VALUE_QUICK_MENU_SHOW_CHEATS, + "Show Cheats") +MSG_HASH(MENU_ENUM_SUBLABEL_QUICK_MENU_SHOW_CHEATS, + "Show/hide the 'Cheats' option.") +MSG_HASH(MENU_ENUM_LABEL_VALUE_QUICK_MENU_SHOW_SHADERS, + "Show Shaders") +MSG_HASH(MENU_ENUM_SUBLABEL_QUICK_MENU_SHOW_SHADERS, + "Show/hide the 'Shaders' option.") +MSG_HASH(MENU_ENUM_LABEL_VALUE_QUICK_MENU_SHOW_SAVE_CORE_OVERRIDES, + "Show Save Core Overrides") +MSG_HASH(MENU_ENUM_SUBLABEL_QUICK_MENU_SHOW_SAVE_CORE_OVERRIDES, + "Show/hide the 'Save Core Overrides' option.") +MSG_HASH(MENU_ENUM_LABEL_VALUE_QUICK_MENU_SHOW_SAVE_GAME_OVERRIDES, + "Show Save Game Overrides") +MSG_HASH(MENU_ENUM_SUBLABEL_QUICK_MENU_SHOW_SAVE_GAME_OVERRIDES, + "Show/hide the 'Save Game Overrides' option.") +MSG_HASH(MENU_ENUM_LABEL_VALUE_QUICK_MENU_SHOW_INFORMATION, + "Show Information") +MSG_HASH(MENU_ENUM_SUBLABEL_QUICK_MENU_SHOW_INFORMATION, + "Show/hide the 'Information' option.") +MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_MESSAGE_BGCOLOR_ENABLE, + "Notification Background Enable") +MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_MESSAGE_BGCOLOR_RED, + "Notification Background Red Color") +MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_MESSAGE_BGCOLOR_GREEN, + "Notification Background Green Color") +MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_MESSAGE_BGCOLOR_BLUE, + "Notification Background Blue Color") +MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_MESSAGE_BGCOLOR_OPACITY, + "Notification Background Opacity") +MSG_HASH(MENU_ENUM_LABEL_VALUE_MENU_DISABLE_KIOSK_MODE, + "Disable Kiosk Mode") +MSG_HASH(MENU_ENUM_SUBLABEL_MENU_DISABLE_KIOSK_MODE, + "Disables kiosk mode. A restart is required for the change to take full effect.") +MSG_HASH(MENU_ENUM_LABEL_VALUE_MENU_ENABLE_KIOSK_MODE, + "Enable Kiosk Mode") +MSG_HASH(MENU_ENUM_SUBLABEL_MENU_ENABLE_KIOSK_MODE, + "Protects the setup by hiding all configuration related settings.") +MSG_HASH(MENU_ENUM_LABEL_VALUE_MENU_KIOSK_MODE_PASSWORD, + "Set Password For Disabling Kiosk Mode") +MSG_HASH(MENU_ENUM_SUBLABEL_MENU_KIOSK_MODE_PASSWORD, + "Supplying a password when enabling kiosk mode makes it possible to later disable it from the menu, by going to the Main Menu, selecting Disable Kiosk Mode and entering the password.") +MSG_HASH(MSG_INPUT_KIOSK_MODE_PASSWORD, + "Enter Password") +MSG_HASH(MSG_INPUT_KIOSK_MODE_PASSWORD_OK, + "Password correct.") +MSG_HASH(MSG_INPUT_KIOSK_MODE_PASSWORD_NOK, + "Password incorrect.") +MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_MESSAGE_COLOR_RED, + "Notification Red Color") +MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_MESSAGE_COLOR_GREEN, + "Notification Green Color") +MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_MESSAGE_COLOR_BLUE, + "Notification Blue Color") +MSG_HASH(MENU_ENUM_LABEL_VALUE_FRAMECOUNT_SHOW, + "Show frame count on FPS display") +MSG_HASH(MSG_CONFIG_OVERRIDE_LOADED, + "Configuration override loaded.") +MSG_HASH(MSG_GAME_REMAP_FILE_LOADED, + "Game remap file loaded.") +MSG_HASH(MSG_CORE_REMAP_FILE_LOADED, + "Core remap file loaded.") +MSG_HASH(MENU_ENUM_LABEL_VALUE_AUTOMATICALLY_ADD_CONTENT_TO_PLAYLIST, + "Automatically add content to playlist") +MSG_HASH(MENU_ENUM_SUBLABEL_AUTOMATICALLY_ADD_CONTENT_TO_PLAYLIST, + "Automatically scans loaded content so they appear inside playlists.") +MSG_HASH(MSG_SCANNING_OF_FILE_FINISHED, + "Scanning of file finished") +MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_WINDOW_OPACITY, + "Window Opacity") +MSG_HASH(MENU_ENUM_LABEL_VALUE_AUDIO_RESAMPLER_QUALITY, + "Audio Resampler Quality") +MSG_HASH(MENU_ENUM_SUBLABEL_AUDIO_RESAMPLER_QUALITY, + "Lower this value to favor performance/lower latency over audio quality, increase if you want better audio quality at the expense of performance/lower latency.") +MSG_HASH(MENU_ENUM_LABEL_VALUE_SHADER_WATCH_FOR_CHANGES, + "Watch shader files for changes") +MSG_HASH(MENU_ENUM_SUBLABEL_SHADER_WATCH_FOR_CHANGES, + "Auto-apply changes made to shader files on disk.") diff --git a/intl/msg_hash_chs.c b/intl/msg_hash_chs.c index 7831fbcc7d..91ba1d0d3a 100644 --- a/intl/msg_hash_chs.c +++ b/intl/msg_hash_chs.c @@ -32,7 +32,6 @@ int menu_hash_get_help_chs_enum(enum msg_hash_enums msg, char *s, size_t len) { - uint32_t driver_hash = 0; settings_t *settings = config_get_ptr(); if (msg <= MENU_ENUM_LABEL_INPUT_HOTKEY_BIND_END && @@ -673,12 +672,10 @@ int menu_hash_get_help_chs_enum(enum msg_hash_enums msg, char *s, size_t len) ); break; case MENU_ENUM_LABEL_INPUT_DRIVER: - if (settings) - driver_hash = msg_hash_calculate(settings->arrays.input_driver); - - switch (driver_hash) { - case MENU_LABEL_INPUT_DRIVER_UDEV: + const char *lbl = settings ? settings->arrays.input_driver : NULL; + + if (string_is_equal(lbl, msg_hash_to_str(MENU_ENUM_LABEL_INPUT_DRIVER_UDEV))) snprintf(s, len, "udev Input driver. \n" " \n" @@ -697,8 +694,7 @@ int menu_hash_get_help_chs_enum(enum msg_hash_enums msg, char *s, size_t len) "are root-only (mode 600). You can set up a udev \n" "rule which makes these accessible to non-root." ); - break; - case MENU_LABEL_INPUT_DRIVER_LINUXRAW: + else if (string_is_equal(lbl, msg_hash_to_str(MENU_ENUM_LABEL_INPUT_DRIVER_LINUXRAW))) snprintf(s, len, "linuxraw Input driver. \n" " \n" @@ -708,14 +704,12 @@ int menu_hash_get_help_chs_enum(enum msg_hash_enums msg, char *s, size_t len) " \n" "This driver uses the older joystick API \n" "(/dev/input/js*)."); - break; - default: + else snprintf(s, len, "Input driver.\n" " \n" "Depending on video driver, it might \n" "force a different input driver."); - break; } break; case MENU_ENUM_LABEL_LOAD_CONTENT_LIST: @@ -837,23 +831,17 @@ int menu_hash_get_help_chs_enum(enum msg_hash_enums msg, char *s, size_t len) ); break; case MENU_ENUM_LABEL_AUDIO_RESAMPLER_DRIVER: - if (settings) - driver_hash = msg_hash_calculate(settings->arrays.audio_resampler); - - switch (driver_hash) { - case MENU_LABEL_AUDIO_RESAMPLER_DRIVER_SINC: - snprintf(s, len, - "Windowed SINC implementation."); - break; - case MENU_LABEL_AUDIO_RESAMPLER_DRIVER_CC: - snprintf(s, len, - "Convoluted Cosine implementation."); - break; - default: - if (string_is_empty(s)) - strlcpy(s, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_NO_INFORMATION_AVAILABLE), len); - break; + const char *lbl = settings ? settings->arrays.audio_resampler : NULL; + + if (string_is_equal(lbl, msg_hash_to_str(MENU_ENUM_LABEL_AUDIO_RESAMPLER_DRIVER_SINC))) + strlcpy(s, + "Windowed SINC implementation.", len); + else if (string_is_equal(lbl, msg_hash_to_str(MENU_ENUM_LABEL_AUDIO_RESAMPLER_DRIVER_CC))) + strlcpy(s, + "Convoluted Cosine implementation.", len); + else if (string_is_empty(s)) + strlcpy(s, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_NO_INFORMATION_AVAILABLE), len); } break; case MENU_ENUM_LABEL_VIDEO_SHADER_PRESET: diff --git a/intl/msg_hash_chs.h b/intl/msg_hash_chs.h index e6a0cdf061..7e72e839ce 100644 --- a/intl/msg_hash_chs.h +++ b/intl/msg_hash_chs.h @@ -922,6 +922,8 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_LANG_SPANISH, "西班牙语") MSG_HASH(MENU_ENUM_LABEL_VALUE_LANG_VIETNAMESE, "越南语") +MSG_HASH(MENU_ENUM_LABEL_VALUE_LANG_ARABIC, + "Arabic") MSG_HASH(MENU_ENUM_LABEL_VALUE_LEFT_ANALOG, "左侧摇杆") MSG_HASH(MENU_ENUM_LABEL_VALUE_LIBRETRO_DIR_PATH, diff --git a/intl/msg_hash_cht.c b/intl/msg_hash_cht.c index ba696a59a2..36c7d0d5b2 100644 --- a/intl/msg_hash_cht.c +++ b/intl/msg_hash_cht.c @@ -32,7 +32,6 @@ int menu_hash_get_help_cht_enum(enum msg_hash_enums msg, char *s, size_t len) { - uint32_t driver_hash = 0; settings_t *settings = config_get_ptr(); if (msg <= MENU_ENUM_LABEL_INPUT_HOTKEY_BIND_END && @@ -670,12 +669,10 @@ int menu_hash_get_help_cht_enum(enum msg_hash_enums msg, char *s, size_t len) ); break; case MENU_ENUM_LABEL_INPUT_DRIVER: - if (settings) - driver_hash = msg_hash_calculate(settings->arrays.input_driver); - - switch (driver_hash) { - case MENU_LABEL_INPUT_DRIVER_UDEV: + const char *lbl = settings ? settings->arrays.input_driver : NULL; + + if (string_is_equal(lbl, msg_hash_to_str(MENU_ENUM_LABEL_INPUT_DRIVER_UDEV))) snprintf(s, len, "udev Input driver. \n" " \n" @@ -694,8 +691,7 @@ int menu_hash_get_help_cht_enum(enum msg_hash_enums msg, char *s, size_t len) "are root-only (mode 600). You can set up a udev \n" "rule which makes these accessible to non-root." ); - break; - case MENU_LABEL_INPUT_DRIVER_LINUXRAW: + else if (string_is_equal(lbl, msg_hash_to_str(MENU_ENUM_LABEL_INPUT_DRIVER_LINUXRAW))) snprintf(s, len, "linuxraw Input driver. \n" " \n" @@ -705,14 +701,12 @@ int menu_hash_get_help_cht_enum(enum msg_hash_enums msg, char *s, size_t len) " \n" "This driver uses the older joystick API \n" "(/dev/input/js*)."); - break; - default: + else snprintf(s, len, "Input driver.\n" " \n" "Depending on video driver, it might \n" "force a different input driver."); - break; } break; case MENU_ENUM_LABEL_LOAD_CONTENT_LIST: @@ -834,23 +828,17 @@ int menu_hash_get_help_cht_enum(enum msg_hash_enums msg, char *s, size_t len) ); break; case MENU_ENUM_LABEL_AUDIO_RESAMPLER_DRIVER: - if (settings) - driver_hash = msg_hash_calculate(settings->arrays.audio_resampler); - - switch (driver_hash) { - case MENU_LABEL_AUDIO_RESAMPLER_DRIVER_SINC: - snprintf(s, len, - "Windowed SINC implementation."); - break; - case MENU_LABEL_AUDIO_RESAMPLER_DRIVER_CC: - snprintf(s, len, - "Convoluted Cosine implementation."); - break; - default: - if (string_is_empty(s)) - strlcpy(s, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_NO_INFORMATION_AVAILABLE), len); - break; + const char *lbl = settings ? settings->arrays.audio_resampler : NULL; + + if (string_is_equal(lbl, msg_hash_to_str(MENU_ENUM_LABEL_AUDIO_RESAMPLER_DRIVER_SINC))) + strlcpy(s, + "Windowed SINC implementation.", len); + else if (string_is_equal(lbl, msg_hash_to_str(MENU_ENUM_LABEL_AUDIO_RESAMPLER_DRIVER_CC))) + strlcpy(s, + "Convoluted Cosine implementation.", len); + else if (string_is_empty(s)) + strlcpy(s, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_NO_INFORMATION_AVAILABLE), len); } break; case MENU_ENUM_LABEL_VIDEO_SHADER_PRESET: diff --git a/intl/msg_hash_cht.h b/intl/msg_hash_cht.h index 2644f450a8..adfb03691a 100644 --- a/intl/msg_hash_cht.h +++ b/intl/msg_hash_cht.h @@ -922,6 +922,8 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_LANG_SPANISH, "西班牙語") MSG_HASH(MENU_ENUM_LABEL_VALUE_LANG_VIETNAMESE, "越南語") +MSG_HASH(MENU_ENUM_LABEL_VALUE_LANG_ARABIC, + "Arabic") MSG_HASH(MENU_ENUM_LABEL_VALUE_LEFT_ANALOG, "左側搖桿") MSG_HASH(MENU_ENUM_LABEL_VALUE_LIBRETRO_DIR_PATH, @@ -1640,8 +1642,6 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_SHADER_PARAMETERS, "預覽Shader參數") MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_SHADER_PRESET, "戴入Shader預設") -MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_SHADER_PRESET_PARAMETERS, - "選單Shader參數") MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_SHADER_PRESET_SAVE_AS, "儲存Shader預設為") MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_SHADER_PRESET_SAVE_CORE, diff --git a/intl/msg_hash_de.c b/intl/msg_hash_de.c index ececc198a5..559709b335 100644 --- a/intl/msg_hash_de.c +++ b/intl/msg_hash_de.c @@ -28,7 +28,6 @@ int menu_hash_get_help_de_enum(enum msg_hash_enums msg, char *s, size_t len) { - uint32_t driver_hash = 0; settings_t *settings = config_get_ptr(); if (msg <= MENU_ENUM_LABEL_INPUT_HOTKEY_BIND_END && @@ -702,12 +701,10 @@ int menu_hash_get_help_de_enum(enum msg_hash_enums msg, char *s, size_t len) ); break; case MENU_ENUM_LABEL_INPUT_DRIVER: - if (settings) - driver_hash = msg_hash_calculate(settings->arrays.input_driver); - - switch (driver_hash) { - case MENU_LABEL_INPUT_DRIVER_UDEV: + const char *lbl = settings ? settings->arrays.input_driver : NULL; + + if (string_is_equal(lbl, msg_hash_to_str(MENU_ENUM_LABEL_INPUT_DRIVER_UDEV))) snprintf(s, len, "udev-Eingabetreiber. \n" " \n" @@ -725,8 +722,7 @@ int menu_hash_get_help_de_enum(enum msg_hash_enums msg, char *s, size_t len) "Regel erstellen, die auch den Zugriff für andere \n" "Benutzer erlaubt." ); - break; - case MENU_LABEL_INPUT_DRIVER_LINUXRAW: + else if (string_is_equal(lbl, msg_hash_to_str(MENU_ENUM_LABEL_INPUT_DRIVER_LINUXRAW))) snprintf(s, len, "linuxraw-Eingabetreiber. \n" " \n" @@ -737,14 +733,12 @@ int menu_hash_get_help_de_enum(enum msg_hash_enums msg, char *s, size_t len) " \n" "Dieser Treiber verwendet die alte Joystick-API \n" "(/dev/input/js*)."); - break; - default: - snprintf(s, len, - "Eingabetreiber.\n" - " \n" - "Abhängig vom Grafiktreiber kann ein anderer Eingabe- \n" - "treiber erzwungen werden."); - break; + else + snprintf(s, len, + "Eingabetreiber.\n" + " \n" + "Abhängig vom Grafiktreiber kann ein anderer Eingabe- \n" + "treiber erzwungen werden."); } break; case MENU_ENUM_LABEL_LOAD_CONTENT_LIST: @@ -866,23 +860,17 @@ int menu_hash_get_help_de_enum(enum msg_hash_enums msg, char *s, size_t len) ); break; case MENU_ENUM_LABEL_AUDIO_RESAMPLER_DRIVER: - if (settings) - driver_hash = msg_hash_calculate(settings->arrays.audio_resampler); - - switch (driver_hash) { - case MENU_LABEL_AUDIO_RESAMPLER_DRIVER_SINC: - snprintf(s, len, - "Windowed-SINC-Implementierung."); - break; - case MENU_LABEL_AUDIO_RESAMPLER_DRIVER_CC: - snprintf(s, len, - "Convoluted-Kosinus-Implementierung."); - break; - default: - if (string_is_empty(s)) - strlcpy(s, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_NO_INFORMATION_AVAILABLE), len); - break; + const char *lbl = settings ? settings->arrays.audio_resampler : NULL; + + if (string_is_equal(lbl, msg_hash_to_str(MENU_ENUM_LABEL_AUDIO_RESAMPLER_DRIVER_SINC))) + strlcpy(s, + "Windowed-SINC-Implementierung.", len); + else if (string_is_equal(lbl, msg_hash_to_str(MENU_ENUM_LABEL_AUDIO_RESAMPLER_DRIVER_CC))) + strlcpy(s, + "Convoluted-Kosinus-Implementierung.", len); + else if (string_is_empty(s)) + strlcpy(s, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_NO_INFORMATION_AVAILABLE), len); } break; case MENU_ENUM_LABEL_VIDEO_SHADER_PRESET: diff --git a/intl/msg_hash_de.h b/intl/msg_hash_de.h index 3140125ee4..2b56dae6ff 100644 --- a/intl/msg_hash_de.h +++ b/intl/msg_hash_de.h @@ -48,7 +48,7 @@ MSG_HASH( ) MSG_HASH( MSG_NETPLAY_YOU_HAVE_JOINED_AS_PLAYER_N, - "Du bist als Spieler %d beigetreten" + "Du bist als Spieler %u beigetreten" ) MSG_HASH( MSG_NETPLAY_ENDIAN_DEPENDENT, @@ -931,6 +931,8 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_LANG_SPANISH, "Spanisch") MSG_HASH(MENU_ENUM_LABEL_VALUE_LANG_VIETNAMESE, "Vietnamesisch") +MSG_HASH(MENU_ENUM_LABEL_VALUE_LANG_ARABIC, + "Arabisch") MSG_HASH(MENU_ENUM_LABEL_VALUE_LEFT_ANALOG, "Linker Analogstick") MSG_HASH(MENU_ENUM_LABEL_VALUE_LIBRETRO_DIR_PATH, @@ -1687,8 +1689,6 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_SHADER_PARAMETERS, "Vorschau der Shader-Parameter") MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_SHADER_PRESET, "Shader-Voreinstellung laden") -MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_SHADER_PRESET_PARAMETERS, - "Shader-Parameter anpassen") MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_SHADER_PRESET_SAVE_AS, "Shader-Voreinstellung speichern unter...") MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_SHADER_PRESET_SAVE_CORE, diff --git a/intl/msg_hash_eo.h b/intl/msg_hash_eo.h index 4052dcfe41..af30b6281d 100644 --- a/intl/msg_hash_eo.h +++ b/intl/msg_hash_eo.h @@ -836,6 +836,8 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_LANG_SPANISH, "Spanish") MSG_HASH(MENU_ENUM_LABEL_VALUE_LANG_VIETNAMESE, "Vietnamese") +MSG_HASH(MENU_ENUM_LABEL_VALUE_LANG_ARABIC, + "Arabic") MSG_HASH(MENU_ENUM_LABEL_VALUE_LEFT_ANALOG, "Left Analog") MSG_HASH(MENU_ENUM_LABEL_VALUE_LIBRETRO_DIR_PATH, @@ -1540,8 +1542,6 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_SHADER_PARAMETERS, "Preview Shader Parameters") MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_SHADER_PRESET, "Load Shader Preset") -MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_SHADER_PRESET_PARAMETERS, - "Menu Shader Parameters") MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_SHADER_PRESET_SAVE_AS, "Save Shader Preset As") MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_SHADER_PRESET_SAVE_CORE, diff --git a/intl/msg_hash_es.c b/intl/msg_hash_es.c index 3d97751946..00bf838c73 100644 --- a/intl/msg_hash_es.c +++ b/intl/msg_hash_es.c @@ -30,7 +30,6 @@ int menu_hash_get_help_es_enum(enum msg_hash_enums msg, char *s, size_t len) { - uint32_t driver_hash = 0; settings_t *settings = config_get_ptr(); switch (msg) @@ -129,43 +128,41 @@ int menu_hash_get_help_es_enum(enum msg_hash_enums msg, char *s, size_t len) strlcpy(s, "Extrayendo, espera, por favor...\n", len); break; case MENU_ENUM_LABEL_INPUT_DRIVER: - if (settings) - driver_hash = msg_hash_calculate(settings->arrays.input_driver); - - switch (driver_hash) { - case MENU_LABEL_INPUT_DRIVER_UDEV: - { - /* Work around C89 limitations */ - char u[501]; - char t[501]; + const char *lbl = settings ? settings->arrays.input_driver : NULL; - strlcpy(t, - "Controlador de entrada udev. \n" - " \n" - "Utiliza la API evdev más reciente \n" - "para dar compatibilidad con mandos. \n" - "Permite hotplug (conexión en caliente) \n" - "y force feedback (fuerza de respuesta). \n", - sizeof(t)); - strlcpy(u, - " \n" - "El controlador lee los eventos evdev para \n" - "dar compatibilidad con teclados. También \n" - "es compatible con callbacks de teclado, \n" - "ratones y pantallas táctiles. \n" - " \n" - "La mayoría de las distros tienen los nodos \n" - "/dev/input en modo solo root (modo 600). \n" - "Puedes configurar una regla udev que los haga \n" - "accesibles a otros usuarios.", sizeof(u) - ); + if (string_is_equal(lbl, msg_hash_to_str( + MENU_ENUM_LABEL_INPUT_DRIVER_UDEV))) + { + /* Work around C89 limitations */ + char u[501]; + char t[501]; - strlcpy(s, t, len); - strlcat(s, u, len); - } - break; - case MENU_LABEL_INPUT_DRIVER_LINUXRAW: + strlcpy(t, + "Controlador de entrada udev. \n" + " \n" + "Utiliza la API evdev más reciente \n" + "para dar compatibilidad con mandos. \n" + "Permite hotplug (conexión en caliente) \n" + "y force feedback (fuerza de respuesta). \n", + sizeof(t)); + strlcpy(u, + " \n" + "El controlador lee los eventos evdev para \n" + "dar compatibilidad con teclados. También \n" + "es compatible con callbacks de teclado, \n" + "ratones y pantallas táctiles. \n" + " \n" + "La mayoría de las distros tienen los nodos \n" + "/dev/input en modo solo root (modo 600). \n" + "Puedes configurar una regla udev que los haga \n" + "accesibles a otros usuarios.", sizeof(u) + ); + + strlcpy(s, t, len); + strlcat(s, u, len); + } + else if (string_is_equal(lbl, msg_hash_to_str(MENU_ENUM_LABEL_INPUT_DRIVER_LINUXRAW))) snprintf(s, len, "Controlador de entrada linuxraw. \n" " \n" @@ -177,15 +174,13 @@ int menu_hash_get_help_es_enum(enum msg_hash_enums msg, char *s, size_t len) " \n" "Este controlador utiliza la antigua API de mandos \n" "(/dev/input/js*)."); - break; - default: + else snprintf(s, len, "Controlador de entrada.\n" " \n" "El controlador de vídeo podría forzar \n" "el uso de un controlador de entrada \n" "distinto."); - break; } break; case MENU_ENUM_LABEL_LOAD_CONTENT_LIST: @@ -320,19 +315,15 @@ int menu_hash_get_help_es_enum(enum msg_hash_enums msg, char *s, size_t len) ); break; case MENU_ENUM_LABEL_AUDIO_RESAMPLER_DRIVER: - if (settings) - driver_hash = msg_hash_calculate(settings->arrays.audio_resampler); - - switch (driver_hash) { - case MENU_LABEL_AUDIO_RESAMPLER_DRIVER_SINC: - snprintf(s, len, - "Implementación windowed SINC."); - break; - case MENU_LABEL_AUDIO_RESAMPLER_DRIVER_CC: - snprintf(s, len, - "Implementación de cosenos complejos."); - break; + const char *lbl = settings ? settings->arrays.audio_resampler : NULL; + + if (string_is_equal(lbl, msg_hash_to_str(MENU_ENUM_LABEL_AUDIO_RESAMPLER_DRIVER_SINC))) + strlcpy(s, + "Implementación windowed SINC.", len); + else if (string_is_equal(lbl, msg_hash_to_str(MENU_ENUM_LABEL_AUDIO_RESAMPLER_DRIVER_CC))) + strlcpy(s, + "Implementación de cosenos complejos.", len); } break; case MENU_ENUM_LABEL_VIDEO_SHADER_PRESET: diff --git a/intl/msg_hash_es.h b/intl/msg_hash_es.h index 49bd2f839e..21b08740f3 100644 --- a/intl/msg_hash_es.h +++ b/intl/msg_hash_es.h @@ -48,7 +48,43 @@ MSG_HASH( ) MSG_HASH( MSG_NETPLAY_YOU_HAVE_JOINED_AS_PLAYER_N, - "Unido como jugador %d" + "Unido como jugador %u" + ) +MSG_HASH( + MSG_NETPLAY_YOU_HAVE_JOINED_WITH_INPUT_DEVICES_S, + "Se ha unido con el dispositivo de entrada %.*s" + ) +MSG_HASH( + MSG_NETPLAY_PLAYER_S_LEFT, + "Jugador %.*s dejó el juego" + ) +MSG_HASH( + MSG_NETPLAY_S_HAS_JOINED_AS_PLAYER_N, + "%2$.*1$s se ha unido como jugador %3$u" + ) +MSG_HASH( + MSG_NETPLAY_S_HAS_JOINED_WITH_INPUT_DEVICES_S, + "%2$.*1$s se ha unido con los dispositivos de entrada %4$.*3$s" + ) +MSG_HASH( + MSG_NETPLAY_NOT_RETROARCH, + "Una conexión de netplay falló, probablemente no este usando RetroArch o esté usando una versión antigua de RetroArch" + ) +MSG_HASH( + MSG_NETPLAY_OUT_OF_DATE, + "El par de netplay esta usando una versión antigua de RetroArch. No se puede conectar" + ) +MSG_HASH( + MSG_NETPLAY_DIFFERENT_VERSIONS, + "ADVERTENCIA: Un par de netplay esta usando una versión diferente de Retroarch. Si ocurren problemas, use la misma versión" + ) +MSG_HASH( + MSG_NETPLAY_DIFFERENT_CORES, + "Un par de netplay esta usando una versión diferente del núcleo. No se puede conectar" + ) +MSG_HASH( + MSG_NETPLAY_DIFFERENT_CORE_VERSIONS, + "ADVERTENCIA: Un par de netplay está ejecutando una versión diferente del núcleo. Si ocurren problemas, use la misma versión" ) MSG_HASH( MSG_NETPLAY_ENDIAN_DEPENDENT, @@ -86,6 +122,10 @@ MSG_HASH( MSG_NETPLAY_CANNOT_PLAY_NO_SLOTS, "No hay lugar disponible" ) +MSG_HASH( + MSG_NETPLAY_CANNOT_PLAY_NOT_AVAILABLE, + "El dispositivo de entrada pedido no esta disponible" + ) MSG_HASH( MSG_NETPLAY_CANNOT_PLAY, "No se puede cambiar al modo juego" @@ -1390,9 +1430,13 @@ MSG_HASH( MENU_ENUM_LABEL_VALUE_LANG_VIETNAMESE, "Vietnamita" ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_LANG_ARABIC, + "Árabe" + ) MSG_HASH( MENU_ENUM_LABEL_VALUE_LEFT_ANALOG, - "Analogico izquierdo" + "Analógico izquierdo" ) MSG_HASH( MENU_ENUM_LABEL_VALUE_LIBRETRO_DIR_PATH, @@ -1622,6 +1666,9 @@ MSG_HASH( MENU_ENUM_LABEL_VALUE_NETPLAY_PUBLIC_ANNOUNCE, "Anunciar juego en red públicamente" ) +MSG_HASH(MENU_ENUM_LABEL_VALUE_NETPLAY_REQUEST_DEVICE_I, + "Pedir dispositivo %u" + ) MSG_HASH( MENU_ENUM_LABEL_VALUE_NETPLAY_REQUIRE_SLAVES, "Desactivar clientes sin modo esclavo" @@ -1630,6 +1677,42 @@ MSG_HASH( MENU_ENUM_LABEL_VALUE_NETPLAY_SETTINGS, "Configurar juego en red" ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_NETPLAY_SHARE_ANALOG, + "Comparir entrada analoga" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_NETPLAY_SHARE_ANALOG_MAX, + "Max" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_NETPLAY_SHARE_ANALOG_AVERAGE, + "Promedio" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_NETPLAY_SHARE_DIGITAL, + "Compartir entrada digital" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_NETPLAY_SHARE_DIGITAL_OR, + "Compartir" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_NETPLAY_SHARE_DIGITAL_XOR, + "Grapple" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_NETPLAY_SHARE_DIGITAL_VOTE, + "Votar" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_NETPLAY_SHARE_NONE, + "Nada" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_NETPLAY_SHARE_NO_PREFERENCE, + "Sin preferencia" + ) MSG_HASH( MENU_ENUM_LABEL_VALUE_NETPLAY_START_AS_SPECTATOR, "Juego en red: modo espectador" @@ -2902,10 +2985,6 @@ MSG_HASH( MENU_ENUM_LABEL_VALUE_VIDEO_SHADER_PRESET, "Cargar preset de shaders" ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_VIDEO_SHADER_PRESET_PARAMETERS, - "Parámetros de shaders del menú" - ) MSG_HASH( MENU_ENUM_LABEL_VALUE_VIDEO_SHADER_PRESET_SAVE_AS, "Guardar preset de shaders como.." @@ -4830,6 +4909,10 @@ MSG_HASH( MENU_ENUM_SUBLABEL_SORT_SAVESTATES_ENABLE, "Ordenar guardados rápidos en carpetas nombradas por núcleo" ) +MSG_HASH( + MENU_ENUM_SUBLABEL_NETPLAY_REQUEST_DEVICE_I, + "Pedir jugar con el dispositivo de entrada dado" + ) MSG_HASH( MENU_ENUM_SUBLABEL_CORE_UPDATER_BUILDBOT_URL, "URL de la carpeta del actualizador de núcleos en el buildbot Libretro" @@ -5282,6 +5365,14 @@ MSG_HASH( MENU_ENUM_SUBLABEL_NETPLAY_USE_MITM_SERVER, "Enviar conexiones de juego en red a través de otro servidor (man-in-the-middle). Útil si el servidor está detrás de un firewall o tiene problemas NAT/UPnP" ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_NETPLAY_MITM_SERVER, + "Ubicación del servidor relé" + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_NETPLAY_MITM_SERVER, + "Elegir un servidor relé especifico. Las ubicaciones geográficamente cercanas tienden a tener menor latencia" + ) MSG_HASH( MENU_ENUM_LABEL_VALUE_ADD_TO_MIXER, "Agregar al mezclador" @@ -5701,4 +5792,12 @@ MSG_HASH( MSG_HASH( MENU_ENUM_SUBLABEL_AUDIO_RESAMPLER_QUALITY, "Valores mas bajos favorecen el rendimiento y bajan la latencia a costa de la calidad, incrementar el valor aumentará la calidad a costa del rendimiento y latencia" - ) \ No newline at end of file + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_SHADER_WATCH_FOR_CHANGES, + "Vigilar cambios en los shader" + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_SHADER_WATCH_FOR_CHANGES, + "Auto-aplica los cambios hechos a los archivos shader del disco" + ) diff --git a/intl/msg_hash_fr.h b/intl/msg_hash_fr.h index 96ac3c3425..1f8e3a900c 100644 --- a/intl/msg_hash_fr.h +++ b/intl/msg_hash_fr.h @@ -48,7 +48,7 @@ MSG_HASH( ) MSG_HASH( MSG_NETPLAY_YOU_HAVE_JOINED_AS_PLAYER_N, - "Vous avez rejoint le jeu en tant que joueur %d" + "Vous avez rejoint le jeu en tant que joueur %u" ) MSG_HASH( MSG_NETPLAY_ENDIAN_DEPENDENT, @@ -921,6 +921,8 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_LANG_SPANISH, "Espagnol") MSG_HASH(MENU_ENUM_LABEL_VALUE_LANG_VIETNAMESE, "Vietnamien") +MSG_HASH(MENU_ENUM_LABEL_VALUE_LANG_ARABIC, + "Arabe") MSG_HASH(MENU_ENUM_LABEL_VALUE_LEFT_ANALOG, "Analogique gauche") MSG_HASH(MENU_ENUM_LABEL_VALUE_LIBRETRO_DIR_PATH, @@ -1657,8 +1659,6 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_SHADER_PARAMETERS, "Prévisualiser les paramètres") MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_SHADER_PRESET, "Charger un pré-réglage de shader") -MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_SHADER_PRESET_PARAMETERS, - "Charger un pré-réglage de shader") MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_SHADER_PRESET_SAVE_AS, "Enregistrer le pré-réglage sous") MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_SHADER_PRESET_SAVE_CORE, diff --git a/intl/msg_hash_it.c b/intl/msg_hash_it.c index d8dc11aa19..8fd5c4a755 100644 --- a/intl/msg_hash_it.c +++ b/intl/msg_hash_it.c @@ -25,7 +25,6 @@ int menu_hash_get_help_it_enum(enum msg_hash_enums msg, char *s, size_t len) { - uint32_t driver_hash = 0; settings_t *settings = config_get_ptr(); switch (msg) @@ -122,37 +121,34 @@ int menu_hash_get_help_it_enum(enum msg_hash_enums msg, char *s, size_t len) strlcpy(s, "Estraendo, per favore attendi...\n", len); break; case MENU_ENUM_LABEL_INPUT_DRIVER: - if (settings) - driver_hash = msg_hash_calculate(settings->arrays.input_driver); - - switch (driver_hash) { - case MENU_LABEL_INPUT_DRIVER_UDEV: - { - /* Work around C89 limitations */ - const char * t = - "udev Input driver. \n" - " \n" - "Questo driver può caricare senza X. \n" - " \n" - "Usa la recente evdev joypad API \n" - "per il supporto del joystick. Supporta \n" - "hotplugging e force feedback (se \n" - "supportato dal dispositivo). \n" - " \n"; - const char * u = - "Il driver legge gli eventi evdev per il supporto \n" - "della tastiera. Supporta anche la callback della tastiera, \n" - "mouse e touchpads. \n" - " \n" - "Come predefinito nella maggior parte delle distribuzioni, i nodi /dev/input \n" - "sono only-root (modalità 600). Puoi settare una regola udev \n" - "che fa queste accessibili ai non-root."; - strlcpy(s, t, len); - strlcat(s, u, len); - } - break; - case MENU_LABEL_INPUT_DRIVER_LINUXRAW: + const char *lbl = settings ? settings->arrays.input_driver : NULL; + + if (string_is_equal(lbl, msg_hash_to_str(MENU_ENUM_LABEL_INPUT_DRIVER_UDEV))) + { + /* Work around C89 limitations */ + const char * t = + "udev Input driver. \n" + " \n" + "Questo driver può caricare senza X. \n" + " \n" + "Usa la recente evdev joypad API \n" + "per il supporto del joystick. Supporta \n" + "hotplugging e force feedback (se \n" + "supportato dal dispositivo). \n" + " \n"; + const char * u = + "Il driver legge gli eventi evdev per il supporto \n" + "della tastiera. Supporta anche la callback della tastiera, \n" + "mouse e touchpads. \n" + " \n" + "Come predefinito nella maggior parte delle distribuzioni, i nodi /dev/input \n" + "sono only-root (modalità 600). Puoi settare una regola udev \n" + "che fa queste accessibili ai non-root."; + strlcpy(s, t, len); + strlcat(s, u, len); + } + else if (string_is_equal(lbl, msg_hash_to_str(MENU_ENUM_LABEL_INPUT_DRIVER_LINUXRAW))) snprintf(s, len, "linuxraw Input driver. \n" " \n" @@ -162,14 +158,12 @@ int menu_hash_get_help_it_enum(enum msg_hash_enums msg, char *s, size_t len) " \n" "Questo driver usa la più vecchia API per il joystick \n" "(/dev/input/js*)."); - break; - default: + else snprintf(s, len, "Driver input.\n" " \n" "Dipende dal driver video, potrebbe \n" "forzare un differente driver input."); - break; } break; case MENU_ENUM_LABEL_LOAD_CONTENT_LIST: @@ -284,19 +278,15 @@ int menu_hash_get_help_it_enum(enum msg_hash_enums msg, char *s, size_t len) ); break; case MENU_ENUM_LABEL_AUDIO_RESAMPLER_DRIVER: - if (settings) - driver_hash = msg_hash_calculate(settings->arrays.audio_resampler); - - switch (driver_hash) { - case MENU_LABEL_AUDIO_RESAMPLER_DRIVER_SINC: - snprintf(s, len, - "Implementazione SINC in modalità finestra."); - break; - case MENU_LABEL_AUDIO_RESAMPLER_DRIVER_CC: - snprintf(s, len, - "Implementazione coseno complesso."); - break; + const char *lbl = settings ? settings->arrays.audio_resampler : NULL; + + if (string_is_equal(lbl, msg_hash_to_str(MENU_ENUM_LABEL_AUDIO_RESAMPLER_DRIVER_SINC))) + strlcpy(s, + "Implementazione SINC in modalità finestra.", len); + else if (string_is_equal(lbl, msg_hash_to_str(MENU_ENUM_LABEL_AUDIO_RESAMPLER_DRIVER_CC))) + strlcpy(s, + "Implementazione coseno complesso.", len); } break; case MENU_ENUM_LABEL_VIDEO_SHADER_PRESET: diff --git a/intl/msg_hash_it.h b/intl/msg_hash_it.h index f3ee9a8317..acf23b6715 100644 --- a/intl/msg_hash_it.h +++ b/intl/msg_hash_it.h @@ -48,7 +48,7 @@ MSG_HASH( ) MSG_HASH( MSG_NETPLAY_YOU_HAVE_JOINED_AS_PLAYER_N, - "Sei entrato come giocatore %d" + "Sei entrato come giocatore %u" ) MSG_HASH( MSG_NETPLAY_ENDIAN_DEPENDENT, @@ -931,6 +931,8 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_LANG_SPANISH, "Spagnolo") MSG_HASH(MENU_ENUM_LABEL_VALUE_LANG_VIETNAMESE, "Vietnamese") +MSG_HASH(MENU_ENUM_LABEL_VALUE_LANG_ARABIC, + "Arabic") MSG_HASH(MENU_ENUM_LABEL_VALUE_LEFT_ANALOG, "Analogico sinistro") MSG_HASH(MENU_ENUM_LABEL_VALUE_LIBRETRO_DIR_PATH, @@ -1685,8 +1687,6 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_SHADER_PARAMETERS, "Anteprima dei parametri Shader") MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_SHADER_PRESET, "Carica Shader Preset") -MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_SHADER_PRESET_PARAMETERS, - "Parametri Shader del menu") MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_SHADER_PRESET_SAVE_AS, "Salvare Preset Shader come") MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_SHADER_PRESET_SAVE_CORE, diff --git a/intl/msg_hash_ja.c b/intl/msg_hash_ja.c index fcef9422c0..31e93307aa 100644 --- a/intl/msg_hash_ja.c +++ b/intl/msg_hash_ja.c @@ -33,7 +33,6 @@ int menu_hash_get_help_jp_enum(enum msg_hash_enums msg, char *s, size_t len) { - uint32_t driver_hash = 0; settings_t *settings = config_get_ptr(); if (msg <= MENU_ENUM_LABEL_INPUT_HOTKEY_BIND_END && @@ -695,12 +694,10 @@ int menu_hash_get_help_jp_enum(enum msg_hash_enums msg, char *s, size_t len) ); break; case MENU_ENUM_LABEL_INPUT_DRIVER: - if (settings) - driver_hash = msg_hash_calculate(settings->arrays.input_driver); - - switch (driver_hash) { - case MENU_LABEL_INPUT_DRIVER_UDEV: + const char *lbl = settings ? settings->arrays.input_driver : NULL; + + if (string_is_equal(lbl, msg_hash_to_str(MENU_ENUM_LABEL_INPUT_DRIVER_UDEV))) snprintf(s, len, "udev Input driver. \n" " \n" @@ -719,8 +716,7 @@ int menu_hash_get_help_jp_enum(enum msg_hash_enums msg, char *s, size_t len) "are root-only (mode 600). You can set up a udev \n" "rule which makes these accessible to non-root." ); - break; - case MENU_LABEL_INPUT_DRIVER_LINUXRAW: + else if (string_is_equal(lbl, msg_hash_to_str(MENU_ENUM_LABEL_INPUT_DRIVER_LINUXRAW))) snprintf(s, len, "linuxraw Input driver. \n" " \n" @@ -730,14 +726,12 @@ int menu_hash_get_help_jp_enum(enum msg_hash_enums msg, char *s, size_t len) " \n" "This driver uses the older joystick API \n" "(/dev/input/js*)."); - break; - default: + else snprintf(s, len, "Input driver.\n" " \n" "Depending on video driver, it might \n" "force a different input driver."); - break; } break; case MENU_ENUM_LABEL_LOAD_CONTENT_LIST: @@ -861,23 +855,17 @@ int menu_hash_get_help_jp_enum(enum msg_hash_enums msg, char *s, size_t len) ); break; case MENU_ENUM_LABEL_AUDIO_RESAMPLER_DRIVER: - if (settings) - driver_hash = msg_hash_calculate(settings->arrays.audio_resampler); - - switch (driver_hash) { - case MENU_LABEL_AUDIO_RESAMPLER_DRIVER_SINC: - snprintf(s, len, - "Windowed SINC implementation."); - break; - case MENU_LABEL_AUDIO_RESAMPLER_DRIVER_CC: - snprintf(s, len, - "Convoluted Cosine implementation."); - break; - default: - if (string_is_empty(s)) - strlcpy(s, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_NO_INFORMATION_AVAILABLE), len); - break; + const char *lbl = settings ? settings->arrays.audio_resampler : NULL; + + if (string_is_equal(lbl, msg_hash_to_str(MENU_ENUM_LABEL_AUDIO_RESAMPLER_DRIVER_SINC))) + strlcpy(s, + "Windowed SINC implementation.", len); + else if (string_is_equal(lbl, msg_hash_to_str(MENU_ENUM_LABEL_AUDIO_RESAMPLER_DRIVER_CC))) + strlcpy(s, + "Convoluted Cosine implementation.", len); + else if (string_is_empty(s)) + strlcpy(s, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_NO_INFORMATION_AVAILABLE), len); } break; case MENU_ENUM_LABEL_VIDEO_SHADER_PRESET: diff --git a/intl/msg_hash_ja.h b/intl/msg_hash_ja.h index 0fce42a8db..bd87a61a92 100644 --- a/intl/msg_hash_ja.h +++ b/intl/msg_hash_ja.h @@ -53,7 +53,43 @@ MSG_HASH( ) MSG_HASH( MSG_NETPLAY_YOU_HAVE_JOINED_AS_PLAYER_N, - "「プレイヤー%d」で接続しました" + "「プレイヤー%u」で接続しました" + ) +MSG_HASH( + MSG_NETPLAY_YOU_HAVE_JOINED_WITH_INPUT_DEVICES_S, + "入力デバイス「%.*s」で接続しました" + ) +MSG_HASH( + MSG_NETPLAY_PLAYER_S_LEFT, + "プレヤー「%.*s」が退出しました" + ) +MSG_HASH( + MSG_NETPLAY_S_HAS_JOINED_AS_PLAYER_N, + "「%2$.*1$s」がプレヤー「%3$u」で接続しました" + ) +MSG_HASH( + MSG_NETPLAY_S_HAS_JOINED_WITH_INPUT_DEVICES_S, + "「%2$.*1$s」が入力デバイス「%4$.*3$s」で接続しました" + ) +MSG_HASH( + MSG_NETPLAY_NOT_RETROARCH, + "相手の接続が失敗しました。古いRetroArchバージョンを使っているかもしれません。" + ) +MSG_HASH( + MSG_NETPLAY_OUT_OF_DATE, + "相手のRetroArchバージョンは古いから接続できません。" + ) +MSG_HASH( + MSG_NETPLAY_DIFFERENT_VERSIONS, + "警告:相手が違うRetroArchバージョンを使っています。問題があれば同じバージョンを使って下さい。" + ) +MSG_HASH( + MSG_NETPLAY_DIFFERENT_CORES, + "相手が違うコアを使っています。接続できません。" + ) +MSG_HASH( + MSG_NETPLAY_DIFFERENT_CORE_VERSIONS, + "警告:相手が違うコアのバージョンを使っています。問題があれば同じバージョンを使って下さい。" ) MSG_HASH( MSG_NETPLAY_ENDIAN_DEPENDENT, @@ -91,6 +127,10 @@ MSG_HASH( MSG_NETPLAY_CANNOT_PLAY_NO_SLOTS, "空きプレイヤースロットはありません" ) +MSG_HASH( + MSG_NETPLAY_CANNOT_PLAY_NOT_AVAILABLE, + "選択した入力デバイスが使えません。" + ) MSG_HASH( MSG_NETPLAY_CANNOT_PLAY, "プレイモードを切り替えに出来ませんでした" @@ -258,7 +298,7 @@ MSG_HASH( ) MSG_HASH( MENU_ENUM_LABEL_VALUE_AUDIO_RESAMPLER_DRIVER, - "オーディをリサンプルのドライバ" + "オーディオリサンプラーのドライバ" ) MSG_HASH( MENU_ENUM_LABEL_VALUE_AUDIO_SETTINGS, @@ -961,6 +1001,8 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_LANG_SPANISH, "スペイン語") MSG_HASH(MENU_ENUM_LABEL_VALUE_LANG_VIETNAMESE, "ベトナム語") +MSG_HASH(MENU_ENUM_LABEL_VALUE_LANG_ARABIC, + "アラビア語") MSG_HASH(MENU_ENUM_LABEL_VALUE_LEFT_ANALOG, "左のアナログ") MSG_HASH(MENU_ENUM_LABEL_VALUE_LIBRETRO_DIR_PATH, @@ -1022,7 +1064,7 @@ 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, "メニューの壁紙") MSG_HASH(MENU_ENUM_LABEL_VALUE_MENU_WALLPAPER_OPACITY, @@ -1711,8 +1753,6 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_SHADER_PARAMETERS, "シェーダーパラメータのプレビュー") MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_SHADER_PRESET, "シェーダーのプリセットをロード") -MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_SHADER_PRESET_PARAMETERS, - "メニューのシェーダーパラメータ") MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_SHADER_PRESET_SAVE_AS, "シェーダーのプリセットを名前を付けて保存") MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_SHADER_PRESET_SAVE_CORE, @@ -1762,11 +1802,11 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_WIFI_SETTINGS, MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_ALPHA_FACTOR, "メニューの透明性") MSG_HASH(MENU_ENUM_LABEL_VALUE_MENU_FONT_COLOR_RED, - "Menu Font Red Color") + "メニューフォントの赤色値") MSG_HASH(MENU_ENUM_LABEL_VALUE_MENU_FONT_COLOR_GREEN, - "Menu Font Green Color") + "メニューフォントの緑色値") MSG_HASH(MENU_ENUM_LABEL_VALUE_MENU_FONT_COLOR_BLUE, - "Menu Font Blue Color") + "メニューフォントの青色値") MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_FONT, "メニューのフォント") MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_ICON_THEME_CUSTOM, @@ -2686,7 +2726,7 @@ MSG_HASH( ) MSG_HASH( MENU_ENUM_SUBLABEL_AUDIO_RESAMPLER_DRIVER, - "使用するオーディオリサンプルドライバ" + "使用するオーディオリサンプラーのドライバ" ) MSG_HASH( MENU_ENUM_SUBLABEL_CAMERA_DRIVER, @@ -3041,6 +3081,8 @@ MSG_HASH( ) MSG_HASH(MENU_ENUM_LABEL_VALUE_NETPLAY_USE_MITM_SERVER, "MITMサーバーを使用") +MSG_HASH(MENU_ENUM_LABEL_VALUE_NETPLAY_MITM_SERVER, + "MITMサーバーの設置場所") MSG_HASH(MENU_ENUM_SUBLABEL_NETPLAY_USE_MITM_SERVER, "中間者のサーバーにネットプレイ接続を転送する。ファイアウォールやNAT/UPnPが問題の時に便利。") MSG_HASH(MENU_ENUM_LABEL_VALUE_ADD_TO_MIXER, @@ -3264,8 +3306,10 @@ MSG_HASH(MSG_SCANNING_OF_FILE_FINISHED, MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_WINDOW_OPACITY, "ウィンドウの不透明性") MSG_HASH(MENU_ENUM_LABEL_VALUE_AUDIO_RESAMPLER_QUALITY, - "Audio Resampler Quality") + "オーディオリサンプラーの音質") MSG_HASH(MENU_ENUM_SUBLABEL_AUDIO_RESAMPLER_QUALITY, "Lower this value to favor performance/lower latency over audio quality, increase if you want better audio quality at the expense of performance/lower latency.") MSG_HASH(MENU_ENUM_LABEL_VALUE_SHADER_WATCH_FOR_CHANGES, "シェーダーファイルの変更を監視") +MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_WINDOW_SHOW_DECORATIONS, + "ウィンドウ枠を表示") diff --git a/intl/msg_hash_ko.c b/intl/msg_hash_ko.c index eda672f460..faa82fb500 100644 --- a/intl/msg_hash_ko.c +++ b/intl/msg_hash_ko.c @@ -31,8 +31,8 @@ #pragma warning(disable: 4566) #endif -int menu_hash_get_help_ko_enum(enum msg_hash_enums msg, char *s, size_t len) { - uint32_t driver_hash = 0; +int menu_hash_get_help_ko_enum(enum msg_hash_enums msg, char *s, size_t len) +{ settings_t *settings = config_get_ptr(); if (msg <= MENU_ENUM_LABEL_INPUT_HOTKEY_BIND_END && @@ -694,45 +694,41 @@ int menu_hash_get_help_ko_enum(enum msg_hash_enums msg, char *s, size_t len) { ); break; case MENU_ENUM_LABEL_INPUT_DRIVER: - if (settings) - driver_hash = msg_hash_calculate(settings->arrays.input_driver); + { + const char *lbl = settings ? settings->arrays.input_driver : NULL; - switch (driver_hash) { - case MENU_LABEL_INPUT_DRIVER_UDEV: - snprintf(s, len, - "udev Input driver. \n" - " \n" - "It uses the recent evdev joypad API \n" - "for joystick support. It supports \n" - "hotplugging and force feedback. \n" - " \n" - "The driver reads evdev events for keyboard \n" - "support. It also supports keyboard callback, \n" - "mice and touchpads. \n" - " \n" - "By default in most distros, /dev/input nodes \n" - "are root-only (mode 600). You can set up a udev \n" - "rule which makes these accessible to non-root." - ); - break; - case MENU_LABEL_INPUT_DRIVER_LINUXRAW: - snprintf(s, len, - "linuxraw Input driver. \n" - " \n" - "This driver requires an active TTY. Keyboard \n" - "events are read directly from the TTY which \n" - "makes it simpler, but not as flexible as udev. \n" "Mice, etc, are not supported at all. \n" - " \n" - "This driver uses the older joystick API \n" - "(/dev/input/js*)."); - break; - default: - snprintf(s, len, - "Input driver.\n" - " \n" - "Depending on video driver, it might \n" - "force a different input driver."); - break; + if (string_is_equal(lbl, msg_hash_to_str(MENU_ENUM_LABEL_INPUT_DRIVER_UDEV))) + snprintf(s, len, + "udev Input driver. \n" + " \n" + "It uses the recent evdev joypad API \n" + "for joystick support. It supports \n" + "hotplugging and force feedback. \n" + " \n" + "The driver reads evdev events for keyboard \n" + "support. It also supports keyboard callback, \n" + "mice and touchpads. \n" + " \n" + "By default in most distros, /dev/input nodes \n" + "are root-only (mode 600). You can set up a udev \n" + "rule which makes these accessible to non-root." + ); + else if (string_is_equal(lbl, msg_hash_to_str(MENU_ENUM_LABEL_INPUT_DRIVER_LINUXRAW))) + snprintf(s, len, + "linuxraw Input driver. \n" + " \n" + "This driver requires an active TTY. Keyboard \n" + "events are read directly from the TTY which \n" + "makes it simpler, but not as flexible as udev. \n" "Mice, etc, are not supported at all. \n" + " \n" + "This driver uses the older joystick API \n" + "(/dev/input/js*)."); + else + snprintf(s, len, + "Input driver.\n" + " \n" + "Depending on video driver, it might \n" + "force a different input driver."); } break; case MENU_ENUM_LABEL_LOAD_CONTENT_LIST: @@ -855,22 +851,17 @@ int menu_hash_get_help_ko_enum(enum msg_hash_enums msg, char *s, size_t len) { ); break; case MENU_ENUM_LABEL_AUDIO_RESAMPLER_DRIVER: - if (settings) - driver_hash = msg_hash_calculate(settings->arrays.audio_resampler); + { + const char *lbl = settings ? settings->arrays.audio_resampler : NULL; - switch (driver_hash) { - case MENU_LABEL_AUDIO_RESAMPLER_DRIVER_SINC: - snprintf(s, len, - "Windowed SINC implementation."); - break; - case MENU_LABEL_AUDIO_RESAMPLER_DRIVER_CC: - snprintf(s, len, - "Convoluted Cosine implementation."); - break; - default: - if (string_is_empty(s)) - strlcpy(s, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_NO_INFORMATION_AVAILABLE), len); - break; + if (string_is_equal(lbl, msg_hash_to_str(MENU_ENUM_LABEL_AUDIO_RESAMPLER_DRIVER_SINC))) + strlcpy(s, + "Windowed SINC implementation.", len); + else if (string_is_equal(lbl, msg_hash_to_str(MENU_ENUM_LABEL_AUDIO_RESAMPLER_DRIVER_CC))) + strlcpy(s, + "Convoluted Cosine implementation.", len); + else if (string_is_empty(s)) + strlcpy(s, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_NO_INFORMATION_AVAILABLE), len); } break; case MENU_ENUM_LABEL_VIDEO_SHADER_PRESET: diff --git a/intl/msg_hash_ko.h b/intl/msg_hash_ko.h index 26db263322..9d68ad1035 100644 --- a/intl/msg_hash_ko.h +++ b/intl/msg_hash_ko.h @@ -48,7 +48,7 @@ MSG_HASH( ) MSG_HASH( MSG_NETPLAY_YOU_HAVE_JOINED_AS_PLAYER_N, - "Y%d 플레이어로 입장했습니다" + "Y%u 플레이어로 입장했습니다" ) MSG_HASH( MSG_NETPLAY_ENDIAN_DEPENDENT, @@ -907,6 +907,8 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_LANG_SPANISH, "스페인어") MSG_HASH(MENU_ENUM_LABEL_VALUE_LANG_VIETNAMESE, "베트남어") +MSG_HASH(MENU_ENUM_LABEL_VALUE_LANG_ARABIC, + "Arabic") MSG_HASH(MENU_ENUM_LABEL_VALUE_LEFT_ANALOG, "좌 아날로그") MSG_HASH(MENU_ENUM_LABEL_VALUE_LIBRETRO_DIR_PATH, @@ -1637,8 +1639,6 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_SHADER_PARAMETERS, "쉐이더 매개변수 미리보기") MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_SHADER_PRESET, "쉐이더 프리셋 불러오기") -MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_SHADER_PRESET_PARAMETERS, - "메뉴 쉐이더 매개변수") MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_SHADER_PRESET_SAVE_AS, "쉐이더 프리셋 다른 이름으로 저장") MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_SHADER_PRESET_SAVE_CORE, diff --git a/intl/msg_hash_lbl.h b/intl/msg_hash_lbl.h index dcd7b57f17..f895fd074e 100644 --- a/intl/msg_hash_lbl.h +++ b/intl/msg_hash_lbl.h @@ -235,6 +235,8 @@ MSG_HASH(MENU_ENUM_LABEL_DATABASE_MANAGER, "database_manager") MSG_HASH(MENU_ENUM_LABEL_DATABASE_MANAGER_LIST, "database_manager_list") +MSG_HASH(MENU_ENUM_LABEL_DEFERRED_CONFIGURATIONS_LIST, + "deferred_configurations_list") MSG_HASH(MENU_ENUM_LABEL_DEFERRED_PLAYLIST_LIST, "deferred_playlist_list") MSG_HASH(MENU_ENUM_LABEL_DEFERRED_FAVORITES_LIST, @@ -433,6 +435,8 @@ MSG_HASH(MENU_ENUM_LABEL_GAME_SPECIFIC_OPTIONS_IN_USE, "game_specific_options_in_use") MSG_HASH(MENU_ENUM_LABEL_HELP, "help") +MSG_HASH(MENU_ENUM_LABEL_HELP_CHEEVOS_DESCRIPTION, + "help_cheevos_description") MSG_HASH(MENU_ENUM_LABEL_HELP_AUDIO_VIDEO_TROUBLESHOOTING, "help_audio_video_troubleshooting") MSG_HASH(MENU_ENUM_LABEL_HELP_CHANGE_VIRTUAL_GAMEPAD, @@ -783,6 +787,36 @@ MSG_HASH(MENU_ENUM_LABEL_RDB_ENTRY_CRC32, "rdb_entry_crc32") MSG_HASH(MENU_ENUM_LABEL_RDB_ENTRY_DESCRIPTION, "rdb_entry_description") +MSG_HASH(MENU_ENUM_LABEL_DEFERRED_CURSOR_MANAGER_LIST_RDB_ENTRY_DEVELOPER, + "deferred_cursor_manager_list_rdb_entry_developer") +MSG_HASH(MENU_ENUM_LABEL_DEFERRED_CURSOR_MANAGER_LIST_RDB_ENTRY_PUBLISHER, + "deferred_cursor_manager_list_rdb_entry_publisher") +MSG_HASH(MENU_ENUM_LABEL_DEFERRED_CURSOR_MANAGER_LIST_RDB_ENTRY_ORIGIN, + "deferred_cursor_manager_list_rdb_entry_origin") +MSG_HASH(MENU_ENUM_LABEL_DEFERRED_CURSOR_MANAGER_LIST_RDB_ENTRY_FRANCHISE, + "deferred_cursor_manager_list_rdb_entry_franchise") +MSG_HASH(MENU_ENUM_LABEL_DEFERRED_CURSOR_MANAGER_LIST_RDB_ENTRY_EDGE_MAGAZINE_RATING, + "deferred_cursor_manager_list_rdb_entry_edge_magazine_rating") +MSG_HASH(MENU_ENUM_LABEL_DEFERRED_CURSOR_MANAGER_LIST_RDB_ENTRY_EDGE_MAGAZINE_ISSUE, + "deferred_cursor_manager_list_rdb_entry_edge_magazine_issue") +MSG_HASH(MENU_ENUM_LABEL_DEFERRED_CURSOR_MANAGER_LIST_RDB_ENTRY_FAMITSU_MAGAZINE_RATING, + "deferred_cursor_manager_list_rdb_entry_famitsu_magazine_rating") +MSG_HASH(MENU_ENUM_LABEL_DEFERRED_CURSOR_MANAGER_LIST_RDB_ENTRY_ENHANCEMENT_HW, + "deferred_cursor_manager_list_rdb_entry_enhancement_hw") +MSG_HASH(MENU_ENUM_LABEL_DEFERRED_CURSOR_MANAGER_LIST_RDB_ENTRY_RELEASEMONTH, + "deferred_cursor_manager_list_rdb_entry_releasemonth") +MSG_HASH(MENU_ENUM_LABEL_DEFERRED_CURSOR_MANAGER_LIST_RDB_ENTRY_RELEASEYEAR, + "deferred_cursor_manager_list_rdb_entry_releaseyear") +MSG_HASH(MENU_ENUM_LABEL_DEFERRED_CURSOR_MANAGER_LIST_RDB_ENTRY_ESRB_RATING, + "deferred_cursor_manager_list_rdb_entry_esrb_rating") +MSG_HASH(MENU_ENUM_LABEL_DEFERRED_CURSOR_MANAGER_LIST_RDB_ENTRY_PEGI_RATING, + "deferred_cursor_manager_list_rdb_entry_pegi_rating") +MSG_HASH(MENU_ENUM_LABEL_DEFERRED_CURSOR_MANAGER_LIST_RDB_ENTRY_CERO_RATING, + "deferred_cursor_manager_list_rdb_entry_cero_rating") +MSG_HASH(MENU_ENUM_LABEL_DEFERRED_CURSOR_MANAGER_LIST_RDB_ENTRY_BBFC_RATING, + "deferred_cursor_manager_list_rdb_entry_bbfc_rating") +MSG_HASH(MENU_ENUM_LABEL_DEFERRED_CURSOR_MANAGER_LIST_RDB_ENTRY_MAX_USERS, + "deferred_cursor_manager_list_rdb_entry_max_users") MSG_HASH(MENU_ENUM_LABEL_RDB_ENTRY_DEVELOPER, "rdb_entry_developer") MSG_HASH(MENU_ENUM_LABEL_RDB_ENTRY_EDGE_MAGAZINE_ISSUE, @@ -1295,6 +1329,8 @@ MSG_HASH(MENU_ENUM_LABEL_SHADER_PIPELINE_BOKEH, "shader_pipeline_bokeh") MSG_HASH(MENU_ENUM_LABEL_NETPLAY_USE_MITM_SERVER, "netplay_use_mitm_server") +MSG_HASH(MENU_ENUM_LABEL_NETPLAY_MITM_SERVER, + "netplay_mitm_server") MSG_HASH(MENU_ENUM_LABEL_ADD_TO_MIXER, "audio_add_to_mixer") MSG_HASH(MENU_ENUM_LABEL_ADD_TO_MIXER_AND_COLLECTION, @@ -1393,3 +1429,13 @@ MSG_HASH(MENU_ENUM_LABEL_VIDEO_WINDOW_OPACITY, "video_window_opacity") MSG_HASH(MENU_ENUM_LABEL_AUDIO_RESAMPLER_QUALITY, "audio_resampler_quality") +MSG_HASH(MENU_ENUM_LABEL_AUDIO_RESAMPLER_DRIVER_SINC, + "sinc") +MSG_HASH(MENU_ENUM_LABEL_AUDIO_RESAMPLER_DRIVER_CC, + "cc") +MSG_HASH(MENU_ENUM_LABEL_INPUT_DRIVER_UDEV, + "udev") +MSG_HASH(MENU_ENUM_LABEL_INPUT_DRIVER_LINUXRAW, + "linuxraw") +MSG_HASH(MENU_ENUM_LABEL_VIDEO_WINDOW_SHOW_DECORATIONS, + "video_window_show_decorations") diff --git a/intl/msg_hash_nl.h b/intl/msg_hash_nl.h index d5729cb759..cb37aff900 100644 --- a/intl/msg_hash_nl.h +++ b/intl/msg_hash_nl.h @@ -836,6 +836,8 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_LANG_SPANISH, "Spaans") MSG_HASH(MENU_ENUM_LABEL_VALUE_LANG_VIETNAMESE, "Vietnamees") +MSG_HASH(MENU_ENUM_LABEL_VALUE_LANG_ARABIC, + "Arabic") MSG_HASH(MENU_ENUM_LABEL_VALUE_LEFT_ANALOG, "Linkse Analoog Stick") MSG_HASH(MENU_ENUM_LABEL_VALUE_LIBRETRO_DIR_PATH, @@ -1538,8 +1540,6 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_SHADER_PARAMETERS, "Voorbeeldweergave Shader Parameters") MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_SHADER_PRESET, "Load Shader Preset") -MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_SHADER_PRESET_PARAMETERS, - "Menu Shader Parameters") MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_SHADER_PRESET_SAVE_AS, "Shader Preset Opslaan Als") MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_SHADER_PRESET_SAVE_CORE, diff --git a/intl/msg_hash_pl.h b/intl/msg_hash_pl.h index 8a64d8cc08..908bc87ca0 100644 --- a/intl/msg_hash_pl.h +++ b/intl/msg_hash_pl.h @@ -48,7 +48,7 @@ MSG_HASH( ) MSG_HASH( MSG_NETPLAY_YOU_HAVE_JOINED_AS_PLAYER_N, - "Dołączyłeś jako gracz %d" + "Dołączyłeś jako gracz %u" ) MSG_HASH( MSG_NETPLAY_ENDIAN_DEPENDENT, @@ -943,6 +943,8 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_LANG_SPANISH, "Spanish") MSG_HASH(MENU_ENUM_LABEL_VALUE_LANG_VIETNAMESE, "wietnamski") +MSG_HASH(MENU_ENUM_LABEL_VALUE_LANG_ARABIC, + "Arabic") MSG_HASH(MENU_ENUM_LABEL_VALUE_LEFT_ANALOG, "Lewy analogowy") MSG_HASH(MENU_ENUM_LABEL_VALUE_LIBRETRO_DIR_PATH, @@ -1699,8 +1701,6 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_SHADER_PARAMETERS, "Podgląd parametrów modułu cieniującego") MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_SHADER_PRESET, "Załaduj ustawienia Shader") -MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_SHADER_PRESET_PARAMETERS, - "Parametry menu Shadera") MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_SHADER_PRESET_SAVE_AS, "Zapisz ustawienie Shadera jako") MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_SHADER_PRESET_SAVE_CORE, diff --git a/intl/msg_hash_pt_br.c b/intl/msg_hash_pt_br.c index 5b0d02eaa1..cd955d0e7c 100644 --- a/intl/msg_hash_pt_br.c +++ b/intl/msg_hash_pt_br.c @@ -26,7 +26,6 @@ #include "../verbosity.h" int menu_hash_get_help_pt_br_enum(enum msg_hash_enums msg, char *s, size_t len) { - uint32_t driver_hash = 0; settings_t *settings = config_get_ptr(); if (msg == MENU_ENUM_LABEL_CONNECT_NETPLAY_ROOM) @@ -733,49 +732,45 @@ int menu_hash_get_help_pt_br_enum(enum msg_hash_enums msg, char *s, size_t len) ); break; case MENU_ENUM_LABEL_INPUT_DRIVER: - if (settings) - driver_hash = msg_hash_calculate(settings->arrays.input_driver); + { + const char *lbl = settings ? settings->arrays.input_driver : NULL; - switch (driver_hash) { - case MENU_LABEL_INPUT_DRIVER_UDEV: - snprintf(s, len, - "Driver de entrada udev. \n" - " \n" - "Utiliza a recente API evdev joypad \n" - "para suporte a Joystick. Suporta \n" - "hotplugging e force feedback. \n" - " \n" - "O driver lê eventos evdev para suporte \n" - "a teclado. Tambêm suporta keyboard callback, \n" - "Mouses e Touchpads. \n" - " \n" - "Por padrão na maioria das distros, \n" - "nodes /dev/input são somente root (mode 600). \n" - "Você pode criar uma regra udev para torná-los \n" - "acessíveis para não root." - ); - break; - case MENU_LABEL_INPUT_DRIVER_LINUXRAW: - snprintf(s, len, - "Driver de entrada linuxraw. \n" - " \n" - "Este driver requer um TTY ativo. Eventos de \n" - "teclado são lidos diretamente do TTY o que \n" - "o torna simples, mas não tão flexível, \n" - "quanto udev. \n" - "Mouses, etc, não são suportados de nenhum \n" - "modo. \n" - " \n" - "Este driver utiliza a antiga API de Joystick \n" - "(/dev/input/js*)."); - break; - default: - snprintf(s, len, - "Driver de entrada.\n" - " \n" - "Dependendo do driver de vídeo, pode \n" - "forçar um driver de entrada diferente."); - break; + if (string_is_equal(lbl, msg_hash_to_str(MENU_ENUM_LABEL_INPUT_DRIVER_UDEV))) + snprintf(s, len, + "Driver de entrada udev. \n" + " \n" + "Utiliza a recente API evdev joypad \n" + "para suporte a Joystick. Suporta \n" + "hotplugging e force feedback. \n" + " \n" + "O driver lê eventos evdev para suporte \n" + "a teclado. Tambêm suporta keyboard callback, \n" + "Mouses e Touchpads. \n" + " \n" + "Por padrão na maioria das distros, \n" + "nodes /dev/input são somente root (mode 600). \n" + "Você pode criar uma regra udev para torná-los \n" + "acessíveis para não root." + ); + else if (string_is_equal(lbl, msg_hash_to_str(MENU_ENUM_LABEL_INPUT_DRIVER_LINUXRAW))) + snprintf(s, len, + "Driver de entrada linuxraw. \n" + " \n" + "Este driver requer um TTY ativo. Eventos de \n" + "teclado são lidos diretamente do TTY o que \n" + "o torna simples, mas não tão flexível, \n" + "quanto udev. \n" + "Mouses, etc, não são suportados de nenhum \n" + "modo. \n" + " \n" + "Este driver utiliza a antiga API de Joystick \n" + "(/dev/input/js*)."); + else + snprintf(s, len, + "Driver de entrada.\n" + " \n" + "Dependendo do driver de vídeo, pode \n" + "forçar um driver de entrada diferente."); } break; case MENU_ENUM_LABEL_LOAD_CONTENT_LIST: @@ -902,22 +897,17 @@ int menu_hash_get_help_pt_br_enum(enum msg_hash_enums msg, char *s, size_t len) ); break; case MENU_ENUM_LABEL_AUDIO_RESAMPLER_DRIVER: - if (settings) - driver_hash = msg_hash_calculate(settings->arrays.audio_resampler); + { + const char *lbl = settings ? settings->arrays.audio_resampler : NULL; - switch (driver_hash) { - case MENU_LABEL_AUDIO_RESAMPLER_DRIVER_SINC: - snprintf(s, len, - "Implementação SINC windowed."); - break; - case MENU_LABEL_AUDIO_RESAMPLER_DRIVER_CC: - snprintf(s, len, - "Implementação Convoluted Cosine."); - break; - default: - if (string_is_empty(s)) - strlcpy(s, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_NO_INFORMATION_AVAILABLE), len); - break; + if (string_is_equal(lbl, msg_hash_to_str(MENU_ENUM_LABEL_AUDIO_RESAMPLER_DRIVER_SINC))) + strlcpy(s, + "Implementação SINC windowed.", len); + else if (string_is_equal(lbl, msg_hash_to_str(MENU_ENUM_LABEL_AUDIO_RESAMPLER_DRIVER_CC))) + strlcpy(s, + "Implementação Convoluted Cosine.", len); + else if (string_is_empty(s)) + strlcpy(s, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_NO_INFORMATION_AVAILABLE), len); } break; case MENU_ENUM_LABEL_VIDEO_SHADER_PRESET: diff --git a/intl/msg_hash_pt_br.h b/intl/msg_hash_pt_br.h index a37db1a1e6..bf2548cc42 100644 --- a/intl/msg_hash_pt_br.h +++ b/intl/msg_hash_pt_br.h @@ -35,7 +35,7 @@ MSG_HASH(MSG_NETPLAY_YOU_HAVE_LEFT_THE_GAME, "Você deixou o jogo" ) MSG_HASH(MSG_NETPLAY_YOU_HAVE_JOINED_AS_PLAYER_N, - "Você se juntou como jogador %d" + "Você se juntou como jogador %u" ) MSG_HASH(MSG_NETPLAY_ENDIAN_DEPENDENT, "Este núcleo não suporta Netplay inter-arquitetura entre estes sistemas" @@ -1013,6 +1013,10 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_LANG_SPANISH, MSG_HASH(MENU_ENUM_LABEL_VALUE_LANG_VIETNAMESE, "Vietnamita" ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_LANG_ARABIC, + "Arabic" + ) MSG_HASH(MENU_ENUM_LABEL_VALUE_LEFT_ANALOG, "Analógico Esquerdo" ) @@ -2144,9 +2148,6 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_SHADER_PARAMETERS, MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_SHADER_PRESET, "Carregar Predefinição de Shader" ) -MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_SHADER_PRESET_PARAMETERS, - "Menu de Parâmetros de Shader" - ) MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_SHADER_PRESET_SAVE_AS, "Salvar Predefinição de Shader Como" ) diff --git a/intl/msg_hash_ru.h b/intl/msg_hash_ru.h index cc391e57ef..efbdd6db76 100644 --- a/intl/msg_hash_ru.h +++ b/intl/msg_hash_ru.h @@ -53,7 +53,7 @@ MSG_HASH( ) MSG_HASH( MSG_NETPLAY_YOU_HAVE_JOINED_AS_PLAYER_N, - "Вы присоединились под именем %d" + "Вы присоединились под именем %u" ) MSG_HASH( MSG_NETPLAY_ENDIAN_DEPENDENT, @@ -930,6 +930,8 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_LANG_SPANISH, "Испанский") MSG_HASH(MENU_ENUM_LABEL_VALUE_LANG_VIETNAMESE, "Вьетнамский") +MSG_HASH(MENU_ENUM_LABEL_VALUE_LANG_ARABIC, + "Arabic") MSG_HASH(MENU_ENUM_LABEL_VALUE_LEFT_ANALOG, "Левый аналоговый стик") MSG_HASH(MENU_ENUM_LABEL_VALUE_LIBRETRO_DIR_PATH, @@ -1666,8 +1668,6 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_SHADER_PARAMETERS, "Предварительный просмотр параметров шейдера") MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_SHADER_PRESET, "Загрузить предварительную настройку шейдера") -MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_SHADER_PRESET_PARAMETERS, - "Параметры меню шейдера") MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_SHADER_PRESET_SAVE_AS, "Сохранить предустановку шейдера как") MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_SHADER_PRESET_SAVE_CORE, diff --git a/intl/msg_hash_us.c b/intl/msg_hash_us.c index f28500cecd..86de76a8cd 100644 --- a/intl/msg_hash_us.c +++ b/intl/msg_hash_us.c @@ -27,7 +27,6 @@ int menu_hash_get_help_us_enum(enum msg_hash_enums msg, char *s, size_t len) { - uint32_t driver_hash = 0; settings_t *settings = config_get_ptr(); if (msg == MENU_ENUM_LABEL_CONNECT_NETPLAY_ROOM) @@ -711,45 +710,42 @@ int menu_hash_get_help_us_enum(enum msg_hash_enums msg, char *s, size_t len) ); break; case MENU_ENUM_LABEL_INPUT_DRIVER: - if (settings) - driver_hash = msg_hash_calculate(settings->arrays.input_driver); + { + const char *lbl = settings ? settings->arrays.input_driver : NULL; - switch (driver_hash) { - case MENU_LABEL_INPUT_DRIVER_UDEV: - snprintf(s, len, - "udev Input driver. \n" - " \n" - "It uses the recent evdev joypad API \n" - "for joystick support. It supports \n" - "hotplugging and force feedback. \n" - " \n" - "The driver reads evdev events for keyboard \n" - "support. It also supports keyboard callback, \n" - "mice and touchpads. \n" - " \n" - "By default in most distros, /dev/input nodes \n" - "are root-only (mode 600). You can set up a udev \n" - "rule which makes these accessible to non-root." - ); - break; - case MENU_LABEL_INPUT_DRIVER_LINUXRAW: - snprintf(s, len, - "linuxraw Input driver. \n" - " \n" - "This driver requires an active TTY. Keyboard \n" - "events are read directly from the TTY which \n" - "makes it simpler, but not as flexible as udev. \n" "Mice, etc, are not supported at all. \n" - " \n" - "This driver uses the older joystick API \n" - "(/dev/input/js*)."); - break; - default: - snprintf(s, len, - "Input driver.\n" - " \n" - "Depending on video driver, it might \n" - "force a different input driver."); - break; + if (string_is_equal(lbl, msg_hash_to_str(MENU_ENUM_LABEL_INPUT_DRIVER_UDEV))) + snprintf(s, len, + "udev Input driver. \n" + " \n" + "It uses the recent evdev joypad API \n" + "for joystick support. It supports \n" + "hotplugging and force feedback. \n" + " \n" + "The driver reads evdev events for keyboard \n" + "support. It also supports keyboard callback, \n" + "mice and touchpads. \n" + " \n" + "By default in most distros, /dev/input nodes \n" + "are root-only (mode 600). You can set up a udev \n" + "rule which makes these accessible to non-root." + ); + else if (string_is_equal(lbl, + msg_hash_to_str(MENU_ENUM_LABEL_INPUT_DRIVER_LINUXRAW))) + snprintf(s, len, + "linuxraw Input driver. \n" + " \n" + "This driver requires an active TTY. Keyboard \n" + "events are read directly from the TTY which \n" + "makes it simpler, but not as flexible as udev. \n" "Mice, etc, are not supported at all. \n" + " \n" + "This driver uses the older joystick API \n" + "(/dev/input/js*)."); + else + snprintf(s, len, + "Input driver.\n" + " \n" + "Depending on video driver, it might \n" + "force a different input driver."); } break; case MENU_ENUM_LABEL_LOAD_CONTENT_LIST: @@ -873,22 +869,19 @@ int menu_hash_get_help_us_enum(enum msg_hash_enums msg, char *s, size_t len) ); break; case MENU_ENUM_LABEL_AUDIO_RESAMPLER_DRIVER: - if (settings) - driver_hash = msg_hash_calculate(settings->arrays.audio_resampler); + { + const char *lbl = settings ? settings->arrays.audio_resampler : NULL; - switch (driver_hash) { - case MENU_LABEL_AUDIO_RESAMPLER_DRIVER_SINC: - snprintf(s, len, - "Windowed SINC implementation."); - break; - case MENU_LABEL_AUDIO_RESAMPLER_DRIVER_CC: - snprintf(s, len, - "Convoluted Cosine implementation."); - break; - default: - if (string_is_empty(s)) - strlcpy(s, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_NO_INFORMATION_AVAILABLE), len); - break; + if (string_is_equal(lbl, msg_hash_to_str( + MENU_ENUM_LABEL_AUDIO_RESAMPLER_DRIVER_SINC))) + strlcpy(s, + "Windowed SINC implementation.", len); + else if (string_is_equal(lbl, msg_hash_to_str( + MENU_ENUM_LABEL_AUDIO_RESAMPLER_DRIVER_CC))) + strlcpy(s, + "Convoluted Cosine implementation.", len); + else if (string_is_empty(s)) + strlcpy(s, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_NO_INFORMATION_AVAILABLE), len); } break; case MENU_ENUM_LABEL_VIDEO_SHADER_PRESET: @@ -1655,9 +1648,15 @@ int menu_hash_get_help_us_enum(enum msg_hash_enums msg, char *s, size_t len) break; case MENU_ENUM_LABEL_NETPLAY_USE_MITM_SERVER: snprintf(s, len, - "When hosting, relay connection through a\n" - "man-in-the-middle server\n" - "to get around firewalls or NAT/UPnP issues.\n"); + "When hosting a netplay session, relay connection through a \n" + "man-in-the-middle server \n" + "to get around firewalls or NAT/UPnP issues. \n"); + break; + case MENU_ENUM_LABEL_NETPLAY_MITM_SERVER: + snprintf(s, len, + "Specifies the man-in-the-middle server \n" + "to use for netplay. A server that is \n" + "located closer to you may have less latency. \n"); break; case MENU_ENUM_LABEL_VIDEO_MAX_SWAPCHAIN_IMAGES: snprintf(s, len, diff --git a/intl/msg_hash_us.h b/intl/msg_hash_us.h index fddbe1b808..857121be1f 100644 --- a/intl/msg_hash_us.h +++ b/intl/msg_hash_us.h @@ -84,7 +84,7 @@ MSG_HASH( ) MSG_HASH( MSG_NETPLAY_DIFFERENT_CORE_VERSIONS, - "WARNING: A netlpay peer is running a different version of the core. If problems occur, use the same version." + "WARNING: A netplay peer is running a different version of the core. If problems occur, use the same version." ) MSG_HASH( MSG_NETPLAY_ENDIAN_DEPENDENT, @@ -1756,15 +1756,15 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_SHADER_DIR, MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_SHADER_NUM_PASSES, "Shader Passes") MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_SHADER_PARAMETERS, - "Preview Shader Parameters") + "Shader Parameters") MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_SHADER_PRESET, "Load Shader Preset") -MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_SHADER_PRESET_PARAMETERS, - "Menu Shader Parameters") MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_SHADER_PRESET_SAVE_AS, "Save Shader Preset As") MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_SHADER_PRESET_SAVE_CORE, "Save Core Preset") +MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_SHADER_PRESET_SAVE_PARENT, + "Save Content Directory Preset") MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_SHADER_PRESET_SAVE_GAME, "Save Game Preset") MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_SHARED_CONTEXT, @@ -2676,7 +2676,7 @@ MSG_HASH( ) MSG_HASH( MENU_ENUM_SUBLABEL_VIDEO_FULLSCREEN, - "Start in fullscreen. Can be changed at runtime. Can be overriden by a command line switch" + "Start in fullscreen. Can be changed at runtime. Can be overridden by a command line switch" ) MSG_HASH( MENU_ENUM_SUBLABEL_VIDEO_WINDOWED_FULLSCREEN, @@ -3147,6 +3147,8 @@ MSG_HASH(MENU_ENUM_SUBLABEL_VIDEO_SHADER_PRESET_SAVE_AS, "Save the current shader settings as a new shader preset.") MSG_HASH(MENU_ENUM_SUBLABEL_VIDEO_SHADER_PRESET_SAVE_CORE, "Save the current shader settings as the default settings for this application/core.") +MSG_HASH(MENU_ENUM_SUBLABEL_VIDEO_SHADER_PRESET_SAVE_PARENT, + "Save the current shader settings as the default settings for all files in the current content directory.") MSG_HASH(MENU_ENUM_SUBLABEL_VIDEO_SHADER_PRESET_SAVE_GAME, "Save the current shader settings as the default settings for the content.") MSG_HASH(MENU_ENUM_SUBLABEL_VIDEO_SHADER_PARAMETERS, @@ -3185,6 +3187,10 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_NETPLAY_USE_MITM_SERVER, "Use Relay Server") MSG_HASH(MENU_ENUM_SUBLABEL_NETPLAY_USE_MITM_SERVER, "Forward netplay connections through a man-in-the-middle server. Useful if the host is behind a firewall or has NAT/UPnP problems.") +MSG_HASH(MENU_ENUM_LABEL_VALUE_NETPLAY_MITM_SERVER, + "Relay Server Location") +MSG_HASH(MENU_ENUM_SUBLABEL_NETPLAY_MITM_SERVER, + "Choose a specific relay server to use. Geographically closer locations tend to have lower latency.") MSG_HASH(MENU_ENUM_LABEL_VALUE_ADD_TO_MIXER, "Add to mixer") MSG_HASH(MENU_ENUM_LABEL_VALUE_ADD_TO_MIXER_AND_COLLECTION, @@ -3409,3 +3415,5 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_SHADER_WATCH_FOR_CHANGES, "Watch shader files for changes") MSG_HASH(MENU_ENUM_SUBLABEL_SHADER_WATCH_FOR_CHANGES, "Auto-apply changes made to shader files on disk.") +MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_WINDOW_SHOW_DECORATIONS, + "Show Window Decorations") diff --git a/intl/msg_hash_vn.c b/intl/msg_hash_vn.c index e7f6e46416..110a4c26e4 100644 --- a/intl/msg_hash_vn.c +++ b/intl/msg_hash_vn.c @@ -32,7 +32,6 @@ int menu_hash_get_help_vn_enum(enum msg_hash_enums msg, char *s, size_t len) { - uint32_t driver_hash = 0; settings_t *settings = config_get_ptr(); if (msg <= MENU_ENUM_LABEL_INPUT_HOTKEY_BIND_END && @@ -695,33 +694,30 @@ int menu_hash_get_help_vn_enum(enum msg_hash_enums msg, char *s, size_t len) ); break; case MENU_ENUM_LABEL_INPUT_DRIVER: - if (settings) - driver_hash = msg_hash_calculate(settings->arrays.input_driver); - - switch (driver_hash) { - case MENU_LABEL_INPUT_DRIVER_UDEV: - snprintf(s, len, - "udev Input driver. \n" - " \n" - "This driver can run without X. \n" - " \n" - "It uses the recent evdev joypad API \n" - "for joystick support. It supports \n" - "hotplugging and force feedback (if \n" - "supported by device). \n" - " \n" - "The driver reads evdev events for keyboard \n" - "support. It also supports keyboard callback, \n" - "mice and touchpads. \n" - " \n" - "By default in most distros, /dev/input nodes \n" - "are root-only (mode 600). You can set up a udev \n" - "rule which makes these accessible to non-root." - ); - break; - case MENU_LABEL_INPUT_DRIVER_LINUXRAW: - snprintf(s, len, + const char *lbl = settings ? settings->arrays.input_driver : NULL; + + if (string_is_equal(lbl, msg_hash_to_str(MENU_ENUM_LABEL_INPUT_DRIVER_UDEV))) + snprintf(s, len, + "udev Input driver. \n" + " \n" + "This driver can run without X. \n" + " \n" + "It uses the recent evdev joypad API \n" + "for joystick support. It supports \n" + "hotplugging and force feedback (if \n" + "supported by device). \n" + " \n" + "The driver reads evdev events for keyboard \n" + "support. It also supports keyboard callback, \n" + "mice and touchpads. \n" + " \n" + "By default in most distros, /dev/input nodes \n" + "are root-only (mode 600). You can set up a udev \n" + "rule which makes these accessible to non-root." + ); + else if (string_is_equal(lbl, msg_hash_to_str(MENU_ENUM_LABEL_INPUT_DRIVER_LINUXRAW))) + strlcpy(s, "linuxraw Input driver. \n" " \n" "This driver requires an active TTY. Keyboard \n" @@ -729,15 +725,13 @@ int menu_hash_get_help_vn_enum(enum msg_hash_enums msg, char *s, size_t len) "makes it simpler, but not as flexible as udev. \n" "Mice, etc, are not supported at all. \n" " \n" "This driver uses the older joystick API \n" - "(/dev/input/js*)."); - break; - default: - snprintf(s, len, + "(/dev/input/js*).", len); + else + strlcpy(s, "Input driver.\n" " \n" "Depending on video driver, it might \n" - "force a different input driver."); - break; + "force a different input driver.", len); } break; case MENU_ENUM_LABEL_LOAD_CONTENT_LIST: @@ -861,23 +855,17 @@ int menu_hash_get_help_vn_enum(enum msg_hash_enums msg, char *s, size_t len) ); break; case MENU_ENUM_LABEL_AUDIO_RESAMPLER_DRIVER: - if (settings) - driver_hash = msg_hash_calculate(settings->arrays.audio_resampler); - - switch (driver_hash) { - case MENU_LABEL_AUDIO_RESAMPLER_DRIVER_SINC: - snprintf(s, len, - "Windowed SINC implementation."); - break; - case MENU_LABEL_AUDIO_RESAMPLER_DRIVER_CC: - snprintf(s, len, - "Convoluted Cosine implementation."); - break; - default: - if (string_is_empty(s)) - strlcpy(s, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_NO_INFORMATION_AVAILABLE), len); - break; + const char *lbl = settings ? settings->arrays.audio_resampler : NULL; + + if (string_is_equal(lbl, msg_hash_to_str(MENU_ENUM_LABEL_AUDIO_RESAMPLER_DRIVER_SINC))) + strlcpy(s, + "Windowed SINC implementation.", len); + else if (string_is_equal(lbl, msg_hash_to_str(MENU_ENUM_LABEL_AUDIO_RESAMPLER_DRIVER_CC))) + strlcpy(s, + "Convoluted Cosine implementation.", len); + else if (string_is_empty(s)) + strlcpy(s, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_NO_INFORMATION_AVAILABLE), len); } break; case MENU_ENUM_LABEL_VIDEO_SHADER_PRESET: diff --git a/intl/msg_hash_vn.h b/intl/msg_hash_vn.h index 77a36a6753..9aaea79f67 100644 --- a/intl/msg_hash_vn.h +++ b/intl/msg_hash_vn.h @@ -48,7 +48,7 @@ MSG_HASH( ) MSG_HASH( MSG_NETPLAY_YOU_HAVE_JOINED_AS_PLAYER_N, - "You have joined as player %d" + "You have joined as player %u" ) MSG_HASH( MSG_NETPLAY_ENDIAN_DEPENDENT, @@ -919,6 +919,8 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_LANG_SPANISH, "Tiếng Tây Ban Nha") MSG_HASH(MENU_ENUM_LABEL_VALUE_LANG_VIETNAMESE, "Tiếng Việt") +MSG_HASH(MENU_ENUM_LABEL_VALUE_LANG_ARABIC, + "Arabic") MSG_HASH(MENU_ENUM_LABEL_VALUE_LEFT_ANALOG, "Left Analog") MSG_HASH(MENU_ENUM_LABEL_VALUE_LIBRETRO_DIR_PATH, @@ -1651,8 +1653,6 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_SHADER_PARAMETERS, "Preview Shader Parameters") MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_SHADER_PRESET, "Tải Shader Preset") -MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_SHADER_PRESET_PARAMETERS, - "Menu Shader Parameters") MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_SHADER_PRESET_SAVE_AS, "Save Shader Preset As") MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_SHADER_PRESET_SAVE_CORE, diff --git a/libretro-common/file/file_path.c b/libretro-common/file/file_path.c index 4e2374004c..4ba3670262 100644 --- a/libretro-common/file/file_path.c +++ b/libretro-common/file/file_path.c @@ -602,20 +602,30 @@ void fill_pathname_basedir_noext(char *out_dir, * * Copies only the parent directory name of @in_dir into @out_dir. * The two buffers must not overlap. Removes trailing '/'. + * Returns true on success, false if a slash was not found in the path. **/ -void fill_pathname_parent_dir_name(char *out_dir, +bool fill_pathname_parent_dir_name(char *out_dir, const char *in_dir, size_t size) { char *temp = strdup(in_dir); char *last = find_last_slash(temp); + bool ret = false; *last = '\0'; - in_dir = find_last_slash(temp) + 1; + in_dir = find_last_slash(temp); - strlcpy(out_dir, in_dir, size); + if (in_dir && in_dir + 1) + { + strlcpy(out_dir, in_dir + 1, size); + ret = true; + } + else + ret = false; free(temp); + + return ret; } /** diff --git a/libretro-common/file/retro_dirent.c b/libretro-common/file/retro_dirent.c index 0b716e6e56..9c53504732 100644 --- a/libretro-common/file/retro_dirent.c +++ b/libretro-common/file/retro_dirent.c @@ -30,6 +30,7 @@ #include #include #include +#include #if defined(_WIN32) # ifdef _MSC_VER @@ -122,6 +123,7 @@ struct RDIR *retro_opendir(const char *name) snprintf(path_buf, sizeof(path_buf), "%s*", name); else snprintf(path_buf, sizeof(path_buf), "%s\\*", name); + #if defined(LEGACY_WIN32) path_local = utf8_to_local_string_alloc(path_buf); rdir->directory = FindFirstFile(path_local, &rdir->entry); @@ -135,19 +137,24 @@ struct RDIR *retro_opendir(const char *name) if (path_wide) free(path_wide); #endif + #elif defined(VITA) || defined(PSP) rdir->directory = sceIoDopen(name); #elif defined(_3DS) - rdir->directory = (name && *name)? opendir(name) : NULL; + rdir->directory = !string_is_empty(name) ? opendir(name) : NULL; rdir->entry = NULL; #elif defined(__CELLOS_LV2__) - rdir->error = cellFsOpendir(name, &rdir->directory); + rdir->error = cellFsOpendir(name, &rdir->directory); #else rdir->directory = opendir(name); rdir->entry = NULL; #endif - return rdir; + if (rdir->directory) + return rdir; + + free(rdir); + return NULL; } bool retro_dirent_error(struct RDIR *rdir) @@ -208,6 +215,7 @@ const char *retro_dirent_get_name(struct RDIR *rdir) #elif defined(VITA) || defined(PSP) || defined(__CELLOS_LV2__) return rdir->entry.d_name; #else + return rdir->entry->d_name; #endif } diff --git a/libretro-common/formats/png/rpng_encode.c b/libretro-common/formats/png/rpng_encode.c index cd483e39dd..92e25e16f4 100644 --- a/libretro-common/formats/png/rpng_encode.c +++ b/libretro-common/formats/png/rpng_encode.c @@ -354,7 +354,8 @@ static bool rpng_save_image(const char *path, GOTO_END_ERROR(); end: - filestream_close(file); + if (file) + filestream_close(file); free(encode_buf); free(deflate_buf); free(rgba_line); diff --git a/libretro-common/include/file/file_path.h b/libretro-common/include/file/file_path.h index 8d54de7c69..85f190c6ad 100644 --- a/libretro-common/include/file/file_path.h +++ b/libretro-common/include/file/file_path.h @@ -298,8 +298,9 @@ void fill_pathname_basedir_noext(char *out_dir, * * Copies only the parent directory name of @in_dir into @out_dir. * The two buffers must not overlap. Removes trailing '/'. + * Returns true on success, false if a slash was not found in the path. **/ -void fill_pathname_parent_dir_name(char *out_dir, +bool fill_pathname_parent_dir_name(char *out_dir, const char *in_dir, size_t size); /** diff --git a/libretro-common/include/libretro.h b/libretro-common/include/libretro.h index 9c923db2ef..e15403d8b6 100644 --- a/libretro-common/include/libretro.h +++ b/libretro-common/include/libretro.h @@ -270,6 +270,7 @@ enum retro_language RETRO_LANGUAGE_ESPERANTO = 13, RETRO_LANGUAGE_POLISH = 14, RETRO_LANGUAGE_VIETNAMESE = 15, + RETRO_LANGUAGE_ARABIC = 16, RETRO_LANGUAGE_LAST, /* Ensure sizeof(enum) == sizeof(int) */ diff --git a/libretro-common/net/net_http.c b/libretro-common/net/net_http.c index be1b90b91b..fb40d89b7d 100644 --- a/libretro-common/net/net_http.c +++ b/libretro-common/net/net_http.c @@ -398,9 +398,9 @@ struct http_t *net_http_new(struct http_connection_t *conn) post_len = strlen(conn->postdatacopy); #ifdef _WIN32 - len = snprintf(NULL, 0, "%"PRIuPTR, post_len); + len = snprintf(NULL, 0, "%" PRIuPTR, post_len); len_str = (char*)malloc(len + 1); - snprintf(len_str, len + 1, "%"PRIuPTR, post_len); + snprintf(len_str, len + 1, "%" PRIuPTR, post_len); #else len = snprintf(NULL, 0, "%llu", (long long unsigned)post_len); len_str = (char*)malloc(len + 1); diff --git a/libretro-common/samples/utils/Makefile b/libretro-common/samples/utils/Makefile index ec251f2e9f..b9c785ee55 100644 --- a/libretro-common/samples/utils/Makefile +++ b/libretro-common/samples/utils/Makefile @@ -2,7 +2,7 @@ compiler := gcc extra_flags := use_neon := 0 release := release -DYLIB := +EXE_EXT := ifeq ($(platform),) platform = unix @@ -21,7 +21,7 @@ else ifneq ($(findstring win,$(shell uname -a)),) endif endif -ifeq ($(platform),gcc) +ifeq ($(compiler),gcc) extra_rules_gcc := $(shell $(compiler) -dumpmachine) endif @@ -42,17 +42,14 @@ ifeq (debug,$(build)) extra_flags += -O0 -g endif -ldflags := -shared -Wl,--version-script=link.T +ldflags := +EXE_EXT := ifeq ($(platform), unix) -DYLIB = else ifeq ($(platform), osx) compiler := $(CC) -DYLIB = -ldflags := -dynamiclib else -extra_flags += -static-libgcc -static-libstdc++ -DYLIB = exe +EXE_EXT = .exe endif LIBRETRO_COMM_DIR := ../.. @@ -60,8 +57,8 @@ CORE_DIR := $(LIBRETRO_COMM_DIR)/utils CC := $(compiler) CXX := $(subst CC,++,$(compiler)) -flags := -fPIC $(extra_flags) -I$(LIBRETRO_COMM_DIR)/include -asflags := -fPIC $(extra_flags) +flags := -I$(LIBRETRO_COMM_DIR)/include +asflags := $(extra_flags) LDFLAGS := flags += -std=c99 -DMD5_BUILD_UTILITY -DSHA1_BUILD_UTILITY @@ -77,17 +74,18 @@ OBJS += $(CORE_DIR)/djb2.o \ $(CORE_DIR)/sha1.o \ $(CORE_DIR)/sha1_main.o \ $(CORE_DIR)/crc32.o -UTILS += djb2$(DYLIB) md5$(DYLIB) sha1$(DYLIB) crc32$(DYLIB) -all: djb2$(DYLIB) md5$(DYLIB) sha1$(DYLIB) crc32$(DYLIB) +UTILS := djb2$(EXE_EXT) md5$(EXE_EXT) sha1$(EXE_EXT) crc32$(EXE_EXT) -djb2$(DYLIB): $(CORE_DIR)/djb2.o +all: $(UTILS) -md5$(DYLIB): $(CORE_DIR)/md5.o +djb2$(EXE_EXT): $(CORE_DIR)/djb2.o -sha1$(DYLIB): $(CORE_DIR)/sha1.o +md5$(EXE_EXT): $(CORE_DIR)/md5.o -crc32$(DYLIB): $(CORE_DIR)/crc32.o $(CORE_DIR)/../encodings/encoding_crc32.o +sha1$(EXE_EXT): $(CORE_DIR)/sha1.o $(CORE_DIR)/sha1_main.o + +crc32$(EXE_EXT): $(CORE_DIR)/crc32.o $(CORE_DIR)/../encodings/encoding_crc32.o %.o: %.S $(CC) -c -o $@ $(asflags) $(LDFLAGS) $(ASMFLAGS) $< @@ -95,12 +93,12 @@ crc32$(DYLIB): $(CORE_DIR)/crc32.o $(CORE_DIR)/../encodings/encoding_crc32.o %.o: %.c $(CC) -c -o $@ $(flags) $< -%.$(DYLIB): %.o +$(UTILS): $(CC) -o $@ $(ldflags) $(flags) $^ clean: - rm -f *.o - rm -f djb2$(DYLIB) md5$(DYLIB) sha1$(DYLIB) crc32$(DYLIB) + rm -f $(CORE_DIR)/*.o + rm -f $(UTILS) strip: - strip -s *.$(DYLIB) + strip -s $(UTILS) diff --git a/libretro-common/streams/file_stream.c b/libretro-common/streams/file_stream.c index 38efa2d7c5..cc062f4169 100644 --- a/libretro-common/streams/file_stream.c +++ b/libretro-common/streams/file_stream.c @@ -31,6 +31,7 @@ #endif #include +#define VFS_FRONTEND #include static const int64_t vfs_error_return_value = -1; diff --git a/libretro-common/utils/sha1_main.c b/libretro-common/utils/sha1_main.c index c49c6c4eee..1eb0c8ec54 100644 --- a/libretro-common/utils/sha1_main.c +++ b/libretro-common/utils/sha1_main.c @@ -51,9 +51,23 @@ void usage(void); * Comments: * */ +typedef struct SHA1Context +{ + unsigned Message_Digest[5]; /* Message Digest (output) */ + + unsigned Length_Low; /* Message length in bits */ + unsigned Length_High; /* Message length in bits */ + + unsigned char Message_Block[64]; /* 512-bit message blocks */ + int Message_Block_Index; /* Index into message block array */ + + int Computed; /* Is the digest computed? */ + int Corrupted; /* Is the message digest corruped? */ +} SHA1Context; + int main(int argc, char *argv[]) { - SHA1Context sha; /* SHA-1 context */ + struct SHA1Context sha; /* SHA-1 context */ FILE *fp; /* File pointer for reading files*/ char c; /* Character read from file */ int i; /* Counter */ diff --git a/libretro-common/vfs/vfs_implementation.c b/libretro-common/vfs/vfs_implementation.c index ba962840ed..948e9a337b 100644 --- a/libretro-common/vfs/vfs_implementation.c +++ b/libretro-common/vfs/vfs_implementation.c @@ -75,6 +75,12 @@ #endif +#if defined(_WIN32) && !defined(_XBOX) +#if !defined(_MSC_VER) || (defined(_MSC_VER) && _MSC_VER >= 1400) +#define ATLEAST_VC2005 +#endif +#endif + #ifdef RARCH_INTERNAL #ifndef VFS_FRONTEND #define VFS_FRONTEND @@ -251,12 +257,9 @@ libretro_vfs_implementation_file *retro_vfs_file_open_impl(const char *path, uns if ((stream->hints & RFILE_HINT_UNBUFFERED) == 0) { - if (!mode_str) - goto error; + FILE *fp = fopen_utf8(path, mode_str); - stream->fp = fopen_utf8(path, mode_str); - - if (!stream->fp) + if (!fp) goto error; /* Regarding setvbuf: @@ -269,6 +272,7 @@ libretro_vfs_implementation_file *retro_vfs_file_open_impl(const char *path, uns * Since C89 does not support specifying a null buffer with a non-zero size, we create and track our own buffer for it. */ /* TODO: this is only useful for a few platforms, find which and add ifdef */ + stream->fp = fp; stream->buf = (char*)calloc(1, 0x4000); setvbuf(stream->fp, stream->buf, _IOFBF, 0x4000); } @@ -375,7 +379,12 @@ int64_t retro_vfs_file_tell_impl(libretro_vfs_implementation_file *stream) return -1; if ((stream->hints & RFILE_HINT_UNBUFFERED) == 0) +/* VC2005 and up have a special 64-bit ftell */ +#ifdef ATLEAST_VC2005 + return _ftelli64(stream->fp); +#else return ftell(stream->fp); +#endif #ifdef HAVE_MMAP /* Need to check stream->mapped because this function diff --git a/list_special.c b/list_special.c index 733318b329..145994c645 100644 --- a/list_special.c +++ b/list_special.c @@ -57,37 +57,30 @@ struct string_list *dir_list_new_special(const char *input_dir, { char ext_shaders[255]; char ext_name[255]; - const char *dir = NULL; const char *exts = NULL; - bool include_dirs = false; bool recursive = false; settings_t *settings = config_get_ptr(); - ext_shaders[0] = ext_name[0] = '\0'; - - (void)input_dir; - switch (type) { case DIR_LIST_AUTOCONFIG: - dir = input_dir; exts = filter; break; case DIR_LIST_CORES: - dir = input_dir; + { + ext_name[0] = '\0'; - if (!frontend_driver_get_core_extension(ext_name, sizeof(ext_name))) - return NULL; + if (!frontend_driver_get_core_extension(ext_name, sizeof(ext_name))) + return NULL; - exts = ext_name; + exts = ext_name; + } break; case DIR_LIST_CORE_INFO: { core_info_list_t *list = NULL; core_info_get_list(&list); - dir = input_dir; - if (list) exts = list->all_ext; } @@ -97,8 +90,6 @@ struct string_list *dir_list_new_special(const char *input_dir, core_info_list_t *list = NULL; core_info_get_list(&list); - dir = input_dir; - if (list) exts = list->all_ext; recursive = true; @@ -113,12 +104,13 @@ struct string_list *dir_list_new_special(const char *input_dir, if (!str_list) return NULL; + + ext_shaders[0] = '\0'; #if defined(HAVE_CG) || defined(HAVE_GLSL) || defined(HAVE_VULKAN) attr.i = 0; #endif - dir = input_dir; #ifdef HAVE_CG string_list_append(str_list, "cg", attr); string_list_append(str_list, "cgp", attr); @@ -137,15 +129,12 @@ struct string_list *dir_list_new_special(const char *input_dir, } break; case DIR_LIST_COLLECTIONS: - dir = input_dir; exts = "lpl"; break; case DIR_LIST_DATABASES: - dir = input_dir; exts = "rdb"; break; case DIR_LIST_PLAIN: - dir = input_dir; exts = filter; break; case DIR_LIST_NONE: @@ -153,7 +142,7 @@ struct string_list *dir_list_new_special(const char *input_dir, return NULL; } - return dir_list_new(dir, exts, include_dirs, settings->bools.show_hidden_files, + return dir_list_new(input_dir, exts, false, settings->bools.show_hidden_files, type == DIR_LIST_CORE_INFO, recursive); } diff --git a/menu/cbs/menu_cbs_get_value.c b/menu/cbs/menu_cbs_get_value.c index d9d05ce54d..2b65b0979e 100644 --- a/menu/cbs/menu_cbs_get_value.c +++ b/menu/cbs/menu_cbs_get_value.c @@ -309,6 +309,38 @@ static void menu_action_setting_disp_set_label_pipeline( } +#ifdef HAVE_NETWORKING +static void menu_action_setting_disp_set_label_netplay_mitm_server( + file_list_t* list, + unsigned *w, unsigned type, unsigned i, + const char *label, + char *s, size_t len, + const char *entry_label, + const char *path, + char *s2, size_t len2) +{ + unsigned j; + settings_t *settings = config_get_ptr(); + + *s = '\0'; + *w = 19; + strlcpy(s2, path, len2); + + if (!settings) + return; + + if (string_is_empty(settings->arrays.netplay_mitm_server)) + return; + + for (j = 0; j < ARRAY_SIZE(netplay_mitm_server_list); j++) + { + if (string_is_equal(settings->arrays.netplay_mitm_server, + netplay_mitm_server_list[j].name)) + strlcpy(s, netplay_mitm_server_list[j].description, len); + } +} +#endif + static void menu_action_setting_disp_set_label_shader_watch_for_changes( file_list_t* list, unsigned *w, unsigned type, unsigned i, @@ -1820,7 +1852,7 @@ static void menu_action_setting_disp_set_label_netplay_share_analog(file_list_t* } strlcpy(s, src, len); } -#endif // HAVE_NETWORKING +#endif static int menu_cbs_init_bind_get_string_representation_compare_label( menu_file_list_cbs_t *cbs) @@ -1938,7 +1970,7 @@ static int menu_cbs_init_bind_get_string_representation_compare_label( BIND_ACTION_GET_VALUE(cbs, menu_action_setting_disp_set_label_netplay_share_analog); break; -#endif // HAVE_NETWORKING +#endif case MENU_ENUM_LABEL_CONTENT_COLLECTION_LIST: case MENU_ENUM_LABEL_LOAD_CONTENT_HISTORY: case MENU_ENUM_LABEL_DOWNLOADED_FILE_DETECT_CORE_LIST: @@ -2170,27 +2202,6 @@ int menu_cbs_init_bind_get_string_representation(menu_file_list_cbs_t *cbs, RARCH_LOG("MENU_SETTINGS_LAST: %d\n", MENU_SETTINGS_LAST); #endif - if (cbs->setting) - { - switch (setting_get_type(cbs->setting)) - { - case ST_BOOL: - BIND_ACTION_GET_VALUE(cbs, - menu_action_setting_disp_set_label_setting_bool); - return 0; - case ST_STRING: - BIND_ACTION_GET_VALUE(cbs, - menu_action_setting_disp_set_label_setting_string); - return 0; - case ST_PATH: - BIND_ACTION_GET_VALUE(cbs, - menu_action_setting_disp_set_label_setting_path); - return 0; - default: - break; - } - } - if (cbs->enum_idx != MSG_UNKNOWN) { switch (cbs->enum_idx) @@ -2220,6 +2231,33 @@ int menu_cbs_init_bind_get_string_representation(menu_file_list_cbs_t *cbs, BIND_ACTION_GET_VALUE(cbs, menu_action_setting_disp_set_label_achievement_information); return 0; + case MENU_ENUM_LABEL_NETPLAY_MITM_SERVER: +#ifdef HAVE_NETWORKING + BIND_ACTION_GET_VALUE(cbs, + menu_action_setting_disp_set_label_netplay_mitm_server); +#endif + return 0; + default: + break; + } + } + + if (cbs->setting) + { + switch (setting_get_type(cbs->setting)) + { + case ST_BOOL: + BIND_ACTION_GET_VALUE(cbs, + menu_action_setting_disp_set_label_setting_bool); + return 0; + case ST_STRING: + BIND_ACTION_GET_VALUE(cbs, + menu_action_setting_disp_set_label_setting_string); + return 0; + case ST_PATH: + BIND_ACTION_GET_VALUE(cbs, + menu_action_setting_disp_set_label_setting_path); + return 0; default: break; } diff --git a/menu/cbs/menu_cbs_left.c b/menu/cbs/menu_cbs_left.c index 8faa386e2b..28e534e5ef 100644 --- a/menu/cbs/menu_cbs_left.c +++ b/menu/cbs/menu_cbs_left.c @@ -37,6 +37,7 @@ #include "../../managers/cheat_manager.h" #include "../../file_path_special.h" #include "../../retroarch.h" +#include "../../network/netplay/netplay.h" #ifndef BIND_ACTION_LEFT #define BIND_ACTION_LEFT(cbs, name) \ @@ -59,33 +60,25 @@ static int generic_shader_action_parameter_left( return 0; } -static int shader_action_parameter_left(unsigned type, const char *label, - bool wraparound) +static int shader_action_parameter_left(unsigned type, const char *label, bool wraparound) { video_shader_ctx_t shader_info; struct video_shader_parameter *param = NULL; video_shader_driver_get_current_shader(&shader_info); - param = &shader_info.data->parameters[type - - MENU_SETTINGS_SHADER_PARAMETER_0]; + param = &shader_info.data->parameters[type - MENU_SETTINGS_SHADER_PARAMETER_0]; if (!param) - return 0; - return generic_shader_action_parameter_left(param, - type, label, wraparound); + return menu_cbs_exit(); + generic_shader_action_parameter_left(param, type, label, wraparound); + + param = menu_shader_manager_get_parameters( + type - MENU_SETTINGS_SHADER_PARAMETER_0); + if (!param) + return menu_cbs_exit(); + return generic_shader_action_parameter_left(param, type, label, wraparound); } -static int shader_action_parameter_preset_left(unsigned type, - const char *label, - bool wraparound) -{ - struct video_shader_parameter *param = menu_shader_manager_get_parameters( - type - MENU_SETTINGS_SHADER_PRESET_PARAMETER_0); - if (!param) - return 0; - return generic_shader_action_parameter_left(param, - type, label, wraparound); -} #endif static int action_left_cheat(unsigned type, const char *label, @@ -324,6 +317,44 @@ static int action_left_shader_num_passes(unsigned type, const char *label, return 0; } +static int action_left_netplay_mitm_server(unsigned type, const char *label, + bool wraparound) +{ + settings_t *settings = config_get_ptr(); + int i; + bool found = false; + int list_len = ARRAY_SIZE(netplay_mitm_server_list); + + for (i = 0; i < list_len; i++) + { + /* find the currently selected server in the list */ + if (string_is_equal(settings->arrays.netplay_mitm_server, netplay_mitm_server_list[i].name)) + { + /* move to the previous one in the list, wrap around if necessary */ + if (i - 1 >= 0) + { + found = true; + strlcpy(settings->arrays.netplay_mitm_server, netplay_mitm_server_list[i - 1].name, sizeof(settings->arrays.netplay_mitm_server)); + break; + } + else if (wraparound) + { + found = true; + strlcpy(settings->arrays.netplay_mitm_server, netplay_mitm_server_list[list_len - 1].name, sizeof(settings->arrays.netplay_mitm_server)); + break; + } + } + } + + if (!found) + { + /* current entry was invalid, go back to the end */ + strlcpy(settings->arrays.netplay_mitm_server, netplay_mitm_server_list[list_len - 1].name, sizeof(settings->arrays.netplay_mitm_server)); + } + + return 0; +} + static int action_left_shader_watch_for_changes(unsigned type, const char *label, bool wraparound) { @@ -490,6 +521,9 @@ static int menu_cbs_init_bind_left_compare_label(menu_file_list_cbs_t *cbs, case MENU_ENUM_LABEL_VIDEO_SHADER_DEFAULT_FILTER: BIND_ACTION_LEFT(cbs, action_left_shader_filter_default); break; + case MENU_ENUM_LABEL_NETPLAY_MITM_SERVER: + BIND_ACTION_LEFT(cbs, action_left_netplay_mitm_server); + break; case MENU_ENUM_LABEL_SHADER_WATCH_FOR_CHANGES: BIND_ACTION_LEFT(cbs, action_left_shader_watch_for_changes); break; @@ -575,7 +609,7 @@ static int menu_cbs_init_bind_left_compare_type(menu_file_list_cbs_t *cbs, else if (type >= MENU_SETTINGS_SHADER_PRESET_PARAMETER_0 && type <= MENU_SETTINGS_SHADER_PRESET_PARAMETER_LAST) { - BIND_ACTION_LEFT(cbs, shader_action_parameter_preset_left); + BIND_ACTION_LEFT(cbs, shader_action_parameter_left); } #endif else if (type >= MENU_SETTINGS_INPUT_DESC_BEGIN diff --git a/menu/cbs/menu_cbs_ok.c b/menu/cbs/menu_cbs_ok.c index 45141fc0af..b574aaa93f 100644 --- a/menu/cbs/menu_cbs_ok.c +++ b/menu/cbs/menu_cbs_ok.c @@ -437,7 +437,6 @@ int generic_action_ok_displaylist_push(const char *path, break; case ACTION_OK_DL_DISK_IMAGE_APPEND_LIST: filebrowser_clear_type(); - filebrowser_set_type(FILEBROWSER_APPEND_IMAGE); info.type = type; info.directory_ptr = idx; info_path = settings->paths.directory_menu_content; @@ -1865,7 +1864,8 @@ default_action_dialog_start(action_ok_rename_entry, enum { ACTION_OK_SHADER_PRESET_SAVE_CORE = 0, - ACTION_OK_SHADER_PRESET_SAVE_GAME + ACTION_OK_SHADER_PRESET_SAVE_GAME, + ACTION_OK_SHADER_PRESET_SAVE_PARENT }; static int generic_action_ok_shader_preset_save(const char *path, @@ -1912,6 +1912,12 @@ static int generic_action_ok_shader_preset_save(const char *path, fill_pathname_join(file, directory, game_name, sizeof(file)); } break; + case ACTION_OK_SHADER_PRESET_SAVE_PARENT: + { + fill_pathname_parent_dir_name(tmp, path_get(RARCH_PATH_BASENAME), sizeof(tmp)); + fill_pathname_join(file, directory, tmp, sizeof(file)); + } + break; } if(menu_shader_manager_save_preset(file, false, true)) @@ -1940,7 +1946,12 @@ static int action_ok_shader_preset_save_game(const char *path, idx, entry_idx, ACTION_OK_SHADER_PRESET_SAVE_GAME); } - +static int action_ok_shader_preset_save_parent(const char *path, + const char *label, unsigned type, size_t idx, size_t entry_idx) +{ + return generic_action_ok_shader_preset_save(path, label, type, + idx, entry_idx, ACTION_OK_SHADER_PRESET_SAVE_PARENT); +} static int generic_action_ok_remap_file_operation(const char *path, const char *label, unsigned type, size_t idx, size_t entry_idx, @@ -3461,17 +3472,10 @@ static int action_ok_load_archive_detect_core(const char *path, menu_handle_t *menu = NULL; const char *menu_path = NULL; const char *content_path = NULL; - size_t path_size = PATH_MAX_LENGTH * sizeof(char); - char *new_core_path = (char*) - malloc(PATH_MAX_LENGTH * sizeof(char)); - - new_core_path[0] = '\0'; + char *new_core_path = NULL; if (!menu_driver_ctl(RARCH_MENU_CTL_DRIVER_DATA_GET, &menu)) - { - free(new_core_path); return menu_cbs_exit(); - } menu_path = menu->scratch2_buf; content_path = menu->scratch_buf; @@ -3485,8 +3489,12 @@ static int action_ok_load_archive_detect_core(const char *path, def_info.s = menu->deferred_path; def_info.len = sizeof(menu->deferred_path); + new_core_path = (char*) + malloc(PATH_MAX_LENGTH * sizeof(char)); + new_core_path[0] = '\0'; + if (menu_content_find_first_core(&def_info, false, - new_core_path, path_size)) + new_core_path, PATH_MAX_LENGTH * sizeof(char))) ret = -1; fill_pathname_join(detect_content_path, menu_path, content_path, @@ -3503,17 +3511,15 @@ static int action_ok_load_archive_detect_core(const char *path, content_info.args = NULL; content_info.environ_get = NULL; + ret = 0; + if (!task_push_load_content_with_new_core_from_menu( new_core_path, def_info.s, &content_info, CORE_TYPE_PLAIN, NULL, NULL)) - { - free(new_core_path); - return -1; - } + ret = -1; } - ret = 0; break; case 0: idx = menu_navigation_get_selection(); @@ -3577,9 +3583,8 @@ static int action_ok_netplay_enable_host(const char *path, const char *label, unsigned type, size_t idx, size_t entry_idx) { #ifdef HAVE_NETWORKING - bool contentless = false; - bool is_inited = false; - + bool contentless = false; + bool is_inited = false; file_list_t *list = menu_entries_get_selection_buf_ptr(0); content_get_status(&contentless, &is_inited); @@ -4053,6 +4058,9 @@ static int menu_cbs_init_bind_ok_compare_label(menu_file_list_cbs_t *cbs, case MENU_ENUM_LABEL_VIDEO_SHADER_PRESET_SAVE_CORE: BIND_ACTION_OK(cbs, action_ok_shader_preset_save_core); break; + case MENU_ENUM_LABEL_VIDEO_SHADER_PRESET_SAVE_PARENT: + BIND_ACTION_OK(cbs, action_ok_shader_preset_save_parent); + break; case MENU_ENUM_LABEL_CHEAT_FILE_SAVE_AS: BIND_ACTION_OK(cbs, action_ok_cheat_file_save_as); break; @@ -4511,15 +4519,13 @@ static int menu_cbs_init_bind_ok_compare_type(menu_file_list_cbs_t *cbs, } else #endif - if (filebrowser_get_type() == FILEBROWSER_APPEND_IMAGE) - { - BIND_ACTION_OK(cbs, action_ok_disk_image_append); - } - else { BIND_ACTION_OK(cbs, action_ok_file_load_with_detect_core); } break; + case MENU_ENUM_LABEL_DISK_IMAGE_APPEND: + BIND_ACTION_OK(cbs, action_ok_disk_image_append); + break; default: BIND_ACTION_OK(cbs, action_ok_file_load); break; @@ -4539,15 +4545,13 @@ static int menu_cbs_init_bind_ok_compare_type(menu_file_list_cbs_t *cbs, } else #endif - if (filebrowser_get_type() == FILEBROWSER_APPEND_IMAGE) - { - BIND_ACTION_OK(cbs, action_ok_disk_image_append); - } - else { BIND_ACTION_OK(cbs, action_ok_file_load_with_detect_core); } break; + case MENU_LABEL_DISK_IMAGE_APPEND: + BIND_ACTION_OK(cbs, action_ok_disk_image_append); + break; default: BIND_ACTION_OK(cbs, action_ok_file_load); break; diff --git a/menu/cbs/menu_cbs_right.c b/menu/cbs/menu_cbs_right.c index 2f4fe0efcc..48e8eed6e6 100644 --- a/menu/cbs/menu_cbs_right.c +++ b/menu/cbs/menu_cbs_right.c @@ -39,6 +39,7 @@ #include "../../retroarch.h" #include "../../verbosity.h" #include "../../ui/ui_companion_driver.h" +#include "../../network/netplay/netplay.h" #ifndef BIND_ACTION_RIGHT #define BIND_ACTION_RIGHT(cbs, name) \ @@ -70,16 +71,12 @@ int shader_action_parameter_right(unsigned type, const char *label, bool wraparo video_shader_driver_get_current_shader(&shader_info); param = &shader_info.data->parameters[type - MENU_SETTINGS_SHADER_PARAMETER_0]; + if (!param) return menu_cbs_exit(); - return generic_shader_action_parameter_right(param, type, label, wraparound); -} - -int shader_action_parameter_preset_right(unsigned type, const char *label, - bool wraparound) -{ - struct video_shader_parameter *param = menu_shader_manager_get_parameters( - type - MENU_SETTINGS_SHADER_PRESET_PARAMETER_0); + generic_shader_action_parameter_right(param, type, label, wraparound); + param = menu_shader_manager_get_parameters( + type - MENU_SETTINGS_SHADER_PARAMETER_0); if (!param) return menu_cbs_exit(); return generic_shader_action_parameter_right(param, type, label, wraparound); @@ -327,6 +324,44 @@ static int action_right_shader_num_passes(unsigned type, const char *label, return 0; } +static int action_right_netplay_mitm_server(unsigned type, const char *label, + bool wraparound) +{ + settings_t *settings = config_get_ptr(); + unsigned i; + bool found = false; + unsigned list_len = ARRAY_SIZE(netplay_mitm_server_list); + + for (i = 0; i < list_len; i++) + { + /* find the currently selected server in the list */ + if (string_is_equal(settings->arrays.netplay_mitm_server, netplay_mitm_server_list[i].name)) + { + /* move to the next one in the list, wrap around if necessary */ + if (i + 1 < list_len) + { + found = true; + strlcpy(settings->arrays.netplay_mitm_server, netplay_mitm_server_list[i + 1].name, sizeof(settings->arrays.netplay_mitm_server)); + break; + } + else if (wraparound) + { + found = true; + strlcpy(settings->arrays.netplay_mitm_server, netplay_mitm_server_list[0].name, sizeof(settings->arrays.netplay_mitm_server)); + break; + } + } + } + + if (!found) + { + /* current entry was invalid, go back to the start */ + strlcpy(settings->arrays.netplay_mitm_server, netplay_mitm_server_list[0].name, sizeof(settings->arrays.netplay_mitm_server)); + } + + return 0; +} + static int action_right_shader_watch_for_changes(unsigned type, const char *label, bool wraparound) { @@ -442,7 +477,7 @@ static int menu_cbs_init_bind_right_compare_type(menu_file_list_cbs_t *cbs, else if (type >= MENU_SETTINGS_SHADER_PRESET_PARAMETER_0 && type <= MENU_SETTINGS_SHADER_PRESET_PARAMETER_LAST) { - BIND_ACTION_RIGHT(cbs, shader_action_parameter_preset_right); + BIND_ACTION_RIGHT(cbs, shader_action_parameter_right); } #endif else if (type >= MENU_SETTINGS_INPUT_DESC_BEGIN @@ -600,6 +635,9 @@ static int menu_cbs_init_bind_right_compare_label(menu_file_list_cbs_t *cbs, case MENU_ENUM_LABEL_VIDEO_SHADER_DEFAULT_FILTER: BIND_ACTION_RIGHT(cbs, action_right_shader_filter_default); break; + case MENU_ENUM_LABEL_NETPLAY_MITM_SERVER: + BIND_ACTION_RIGHT(cbs, action_right_netplay_mitm_server); + break; case MENU_ENUM_LABEL_SHADER_WATCH_FOR_CHANGES: BIND_ACTION_RIGHT(cbs, action_right_shader_watch_for_changes); break; diff --git a/menu/cbs/menu_cbs_select.c b/menu/cbs/menu_cbs_select.c index 195a5e05bb..df21786a9e 100644 --- a/menu/cbs/menu_cbs_select.c +++ b/menu/cbs/menu_cbs_select.c @@ -132,7 +132,7 @@ static int shader_action_parameter_select(const char *path, const char *label, u static int shader_action_parameter_preset_select(const char *path, const char *label, unsigned type, size_t idx) { - return shader_action_parameter_preset_right(type, label, true); + return shader_action_parameter_right(type, label, true); } #endif diff --git a/menu/cbs/menu_cbs_start.c b/menu/cbs/menu_cbs_start.c index 377c84294e..df3c74ae4a 100644 --- a/menu/cbs/menu_cbs_start.c +++ b/menu/cbs/menu_cbs_start.c @@ -16,6 +16,7 @@ #include #include #include +#include #ifdef HAVE_CONFIG_H #include "../../config.h" @@ -121,6 +122,7 @@ static int action_start_shader_action_parameter(unsigned type, const char *label #ifdef HAVE_SHADER_MANAGER video_shader_ctx_t shader_info; struct video_shader_parameter *param = NULL; + unsigned parameter = type - MENU_SETTINGS_SHADER_PARAMETER_0; video_shader_driver_get_current_shader(&shader_info); @@ -128,18 +130,12 @@ static int action_start_shader_action_parameter(unsigned type, const char *label return 0; param = &shader_info.data->parameters - [type - MENU_SETTINGS_SHADER_PARAMETER_0]; + [parameter]; param->current = param->initial; param->current = MIN(MAX(param->minimum, param->current), param->maximum); #endif - return 0; -} - -static int action_start_shader_action_preset_parameter(unsigned type, const char *label) -{ - unsigned parameter = type - MENU_SETTINGS_SHADER_PRESET_PARAMETER_0; return menu_shader_manager_clear_parameter(parameter); } @@ -168,6 +164,13 @@ static int action_start_shader_filter_pass(unsigned type, const char *label) return menu_shader_manager_clear_pass_filter(pass); } +static int action_start_netplay_mitm_server(unsigned type, const char *label) +{ + settings_t *settings = config_get_ptr(); + strlcpy(settings->arrays.netplay_mitm_server, netplay_mitm_server, sizeof(settings->arrays.netplay_mitm_server)); + return 0; +} + static int action_start_shader_watch_for_changes(unsigned type, const char *label) { settings_t *settings = config_get_ptr(); @@ -299,6 +302,10 @@ static int menu_cbs_init_bind_start_compare_label(menu_file_list_cbs_t *cbs) break; case MENU_ENUM_LABEL_SCREEN_RESOLUTION: BIND_ACTION_START(cbs, action_start_video_resolution); + break; + case MENU_ENUM_LABEL_NETPLAY_MITM_SERVER: + BIND_ACTION_START(cbs, action_start_netplay_mitm_server); + break; default: return -1; } @@ -318,7 +325,7 @@ static int menu_cbs_init_bind_start_compare_type(menu_file_list_cbs_t *cbs, else if (type >= MENU_SETTINGS_SHADER_PRESET_PARAMETER_0 && type <= MENU_SETTINGS_SHADER_PRESET_PARAMETER_LAST) { - BIND_ACTION_START(cbs, action_start_shader_action_preset_parameter); + BIND_ACTION_START(cbs, action_start_shader_action_parameter); } else if (type >= MENU_SETTINGS_LIBRETRO_PERF_COUNTERS_BEGIN && type <= MENU_SETTINGS_LIBRETRO_PERF_COUNTERS_END) diff --git a/menu/cbs/menu_cbs_sublabel.c b/menu/cbs/menu_cbs_sublabel.c index 003aacea12..4210b08fe9 100644 --- a/menu/cbs/menu_cbs_sublabel.c +++ b/menu/cbs/menu_cbs_sublabel.c @@ -358,6 +358,7 @@ default_sublabel_macro(action_bind_sublabel_shader_num_passes, default_sublabel_macro(action_bind_sublabel_shader_preset, MENU_ENUM_SUBLABEL_VIDEO_SHADER_PRESET) default_sublabel_macro(action_bind_sublabel_shader_preset_save_as, MENU_ENUM_SUBLABEL_VIDEO_SHADER_PRESET_SAVE_AS) default_sublabel_macro(action_bind_sublabel_shader_preset_save_core, MENU_ENUM_SUBLABEL_VIDEO_SHADER_PRESET_SAVE_CORE) +default_sublabel_macro(action_bind_sublabel_shader_preset_save_parent, MENU_ENUM_SUBLABEL_VIDEO_SHADER_PRESET_SAVE_PARENT) default_sublabel_macro(action_bind_sublabel_shader_preset_save_game, MENU_ENUM_SUBLABEL_VIDEO_SHADER_PRESET_SAVE_GAME) default_sublabel_macro(action_bind_sublabel_shader_parameters, MENU_ENUM_SUBLABEL_VIDEO_SHADER_PARAMETERS) default_sublabel_macro(action_bind_sublabel_shader_preset_parameters, MENU_ENUM_SUBLABEL_VIDEO_SHADER_PRESET_PARAMETERS) @@ -373,6 +374,7 @@ default_sublabel_macro(action_bind_sublabel_video_viewport_custom_width, default_sublabel_macro(action_bind_sublabel_video_viewport_custom_x, MENU_ENUM_SUBLABEL_VIDEO_VIEWPORT_CUSTOM_X) default_sublabel_macro(action_bind_sublabel_video_viewport_custom_y, MENU_ENUM_SUBLABEL_VIDEO_VIEWPORT_CUSTOM_Y) default_sublabel_macro(action_bind_sublabel_netplay_use_mitm_server, MENU_ENUM_SUBLABEL_NETPLAY_USE_MITM_SERVER) +default_sublabel_macro(action_bind_sublabel_netplay_mitm_server, MENU_ENUM_SUBLABEL_NETPLAY_MITM_SERVER) default_sublabel_macro(action_bind_sublabel_core_delete, MENU_ENUM_SUBLABEL_CORE_DELETE) static int action_bind_sublabel_cheevos_entry( @@ -504,6 +506,9 @@ int menu_cbs_init_bind_sublabel(menu_file_list_cbs_t *cbs, case MENU_ENUM_LABEL_VIDEO_SHADER_PRESET_SAVE_CORE: BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_shader_preset_save_core); break; + case MENU_ENUM_LABEL_VIDEO_SHADER_PRESET_SAVE_PARENT: + BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_shader_preset_save_parent); + break; case MENU_ENUM_LABEL_VIDEO_SHADER_PRESET_SAVE_GAME: BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_shader_preset_save_game); break; @@ -1472,6 +1477,9 @@ int menu_cbs_init_bind_sublabel(menu_file_list_cbs_t *cbs, case MENU_ENUM_LABEL_NETPLAY_USE_MITM_SERVER: BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_netplay_use_mitm_server); break; + case MENU_ENUM_LABEL_NETPLAY_MITM_SERVER: + BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_netplay_mitm_server); + break; case MENU_ENUM_LABEL_CORE_DELETE: BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_core_delete); default: diff --git a/menu/drivers/materialui.c b/menu/drivers/materialui.c index 2ddcd1b746..125c343daf 100644 --- a/menu/drivers/materialui.c +++ b/menu/drivers/materialui.c @@ -585,12 +585,15 @@ static void mui_render_messagebox(mui_handle_t *mui, int x, y, line_height, longest = 0, longest_width = 0; unsigned width = video_info->width; unsigned height = video_info->height; - struct string_list *list = (struct string_list*) + struct string_list *list = NULL; + + if (!mui || !mui->font) + goto end; + + list = (struct string_list*) string_split(message, "\n"); - if (!list) - return; - if (list->elems == 0) + if (!list || list->elems == 0) goto end; line_height = mui->font->size * 1.2; @@ -610,16 +613,18 @@ static void mui_render_messagebox(mui_handle_t *mui, if (len > longest) { longest = len; - longest_width = font_driver_get_message_width(mui->font, msg, strlen(msg), 1); + longest_width = font_driver_get_message_width( + mui->font, msg, strlen(msg), 1); } } menu_display_set_alpha(body_bg_color, 1.0); - menu_display_draw_quad( x - longest_width/2.0 - mui->margin*2.0, - y - line_height/2.0 - mui->margin*2.0, - longest_width + mui->margin*4.0, - line_height * list->size + mui->margin*4.0, + menu_display_draw_quad( + x - longest_width / 2.0 - mui->margin * 2.0, + y - line_height / 2.0 - mui->margin * 2.0, + longest_width + mui->margin * 4.0, + line_height * list->size + mui->margin * 4.0, width, height, &body_bg_color[0]); @@ -629,7 +634,8 @@ static void mui_render_messagebox(mui_handle_t *mui, { const char *msg = list->elems[i].data; if (msg) - menu_display_draw_text(mui->font, msg, + menu_display_draw_text( + mui->font, msg, x - longest_width/2.0, y + i * line_height + mui->font->size / 3, width, height, font_color, TEXT_ALIGN_LEFT, 1.0f, false, 0); @@ -642,7 +648,8 @@ static void mui_render_messagebox(mui_handle_t *mui, menu_event_get_osk_grid(), menu_event_get_osk_ptr()); end: - string_list_free(list); + if (list) + string_list_free(list); } /* Used for the sublabels */ @@ -660,13 +667,16 @@ static unsigned mui_count_lines(const char *str) static void mui_compute_entries_box(mui_handle_t* mui, int width) { unsigned i; - size_t usable_width = width - (mui->margin * 2); - file_list_t *list = menu_entries_get_selection_buf_ptr(0); - float sum = 0; - size_t entries_end = menu_entries_get_size(); - float scale_factor = menu_display_get_dpi(); + size_t usable_width = width - (mui->margin * 2); + file_list_t *list = menu_entries_get_selection_buf_ptr(0); + float sum = 0; + size_t entries_end = menu_entries_get_size(); + float scale_factor = menu_display_get_dpi(); uintptr_t texture_switch2 = 0; + if (!mui->font) + return; + for (i = 0; i < entries_end; i++) { menu_entry_t entry; @@ -930,7 +940,8 @@ static void mui_render_label_value(mui_handle_t *mui, mui_node_t *node, word_wrap(sublabel_str, sublabel_str, (int)((usable_width - icon_margin) / mui->glyph_width2), false); - menu_display_draw_text(mui->font2, sublabel_str, + if (mui->font) + menu_display_draw_text(mui->font2, sublabel_str, mui->margin + (texture_switch2 ? mui->icon_size : 0), y + (scale_factor / 4) + mui->font->size, width, height, sublabel_color, TEXT_ALIGN_LEFT, 1.0f, false, 0); @@ -1597,7 +1608,8 @@ static void mui_frame(void *data, video_frame_info_t *video_info) strlcpy(title_buf, title_buf_msg_tmp, sizeof(title_buf)); } - menu_display_draw_text(mui->font, title_buf, + if (mui->font) + menu_display_draw_text(mui->font, title_buf, title_margin, header_height / 2 + mui->font->size / 3, width, height, font_header_color, TEXT_ALIGN_LEFT, 1.0f, false, 0); diff --git a/menu/drivers/xmb.c b/menu/drivers/xmb.c index b72640d26d..a3829eb651 100755 --- a/menu/drivers/xmb.c +++ b/menu/drivers/xmb.c @@ -878,7 +878,7 @@ static void xmb_render_messagebox_internal( struct string_list *list = !string_is_empty(message) ? string_split(message, "\n") : NULL; - if (!list || !xmb) + if (!list || !xmb || !xmb->font) { if (list) string_list_free(list); @@ -1065,7 +1065,7 @@ static void xmb_update_thumbnail_path(void *data, unsigned i) sizeof(new_path)); end: - if (!string_is_empty(new_path)) + if (xmb && !string_is_empty(new_path)) xmb->thumbnail_file_path = strdup(new_path); menu_entry_free(&entry); } @@ -2936,7 +2936,19 @@ static void xmb_frame(void *data, video_frame_info_t *video_info) strlcpy(title_truncated, xmb->title_name, sizeof(title_truncated)); if (selection > 1) - title_truncated[25] = '\0'; + { + /* skip 25 utf8 multi-byte chars */ + char* end = title_truncated; + + for(i = 0; i < 25 && *end; i++) + { + end++; + while((*end & 0xC0) == 0x80) + end++; + } + + *end = '\0'; + } /* Title text */ xmb_draw_text(menu_disp_info, xmb, diff --git a/menu/drivers/zarch.c b/menu/drivers/zarch.c index fd06e5600c..191d93946c 100644 --- a/menu/drivers/zarch.c +++ b/menu/drivers/zarch.c @@ -729,7 +729,9 @@ static int zarch_zui_render_lay_root_downloads( static int zarch_zui_render_lay_root(video_frame_info_t *video_info, zui_t *zui) { +#ifdef ZARCH_DEBUG char item[PATH_MAX_LENGTH]; +#endif static struct zui_tabbed tabbed = {~0U}; zarch_zui_tabbed_begin(zui, &tabbed, 0, 0); @@ -1140,7 +1142,7 @@ static bool zarch_menu_init_list(void *data) file_list_t *menu_stack = menu_entries_get_menu_stack_ptr(0); file_list_t *selection_buf = menu_entries_get_selection_buf_ptr(0); - menu_displaylist_info_free(&info); + menu_displaylist_info_init(&info); info.label = strdup( msg_hash_to_str(MENU_ENUM_LABEL_HISTORY_TAB)); diff --git a/menu/drivers_display/menu_display_d3d.c b/menu/drivers_display/menu_display_d3d.c index 1522782824..536e56d048 100644 --- a/menu/drivers_display/menu_display_d3d.c +++ b/menu/drivers_display/menu_display_d3d.c @@ -169,10 +169,10 @@ static void menu_display_d3d_draw(void *data) pv[i].z = 0.5f; pv[i].u = *tex_coord++; pv[i].v = *tex_coord++; -#ifdef _XBOX1 +#ifdef HAVE_D3D8 { D3DSURFACE_DESC desc; - if (d3d_texture_get_level_desc(draw->texture, 0, &desc)) + if (d3d_texture_get_level_desc((void*)draw->texture, 0, &desc)) { pv[i].u *= desc.Width; pv[i].v *= desc.Height; diff --git a/menu/drivers_display/menu_display_d3d11.c b/menu/drivers_display/menu_display_d3d11.c index 15318c4ee9..de84203aab 100644 --- a/menu/drivers_display/menu_display_d3d11.c +++ b/menu/drivers_display/menu_display_d3d11.c @@ -13,6 +13,8 @@ * If not, see . */ +#define CINTERFACE + #include #ifdef HAVE_CONFIG_H @@ -35,19 +37,20 @@ static void* menu_display_d3d11_get_default_mvp(void) { return NULL; } static void menu_display_d3d11_blend_begin(void) { d3d11_video_t* d3d11 = (d3d11_video_t*)video_driver_get_ptr(false); - D3D11SetBlendState(d3d11->ctx, d3d11->blend_enable, NULL, D3D11_DEFAULT_SAMPLE_MASK); + D3D11SetBlendState(d3d11->context, d3d11->blend_enable, NULL, D3D11_DEFAULT_SAMPLE_MASK); } static void menu_display_d3d11_blend_end(void) { d3d11_video_t* d3d11 = (d3d11_video_t*)video_driver_get_ptr(false); - D3D11SetBlendState(d3d11->ctx, d3d11->blend_disable, NULL, D3D11_DEFAULT_SAMPLE_MASK); + D3D11SetBlendState(d3d11->context, d3d11->blend_disable, NULL, D3D11_DEFAULT_SAMPLE_MASK); } static void menu_display_d3d11_viewport(void* data) {} static void menu_display_d3d11_draw(void* data) { + int vertex_count; d3d11_video_t* d3d11 = (d3d11_video_t*)video_driver_get_ptr(false); menu_display_ctx_draw_t* draw = (menu_display_ctx_draw_t*)data; @@ -62,64 +65,108 @@ static void menu_display_d3d11_draw(void* data) case VIDEO_SHADER_MENU_4: case VIDEO_SHADER_MENU_5: case VIDEO_SHADER_MENU_6: - d3d11_set_shader(d3d11->ctx, &d3d11->shaders[draw->pipeline.id]); - D3D11Draw(d3d11->ctx, draw->coords->vertices, 0); + d3d11_set_shader(d3d11->context, &d3d11->shaders[draw->pipeline.id]); + D3D11Draw(d3d11->context, draw->coords->vertices, 0); - D3D11SetBlendState(d3d11->ctx, d3d11->blend_enable, NULL, D3D11_DEFAULT_SAMPLE_MASK); - d3d11_set_shader(d3d11->ctx, &d3d11->sprites.shader); - D3D11SetVertexBuffer(d3d11->ctx, 0, d3d11->sprites.vbo, sizeof(d3d11_sprite_t), 0); - D3D11SetPrimitiveTopology(d3d11->ctx, D3D11_PRIMITIVE_TOPOLOGY_POINTLIST); + D3D11SetBlendState(d3d11->context, d3d11->blend_enable, NULL, D3D11_DEFAULT_SAMPLE_MASK); + d3d11_set_shader(d3d11->context, &d3d11->sprites.shader); + D3D11SetVertexBuffer(d3d11->context, 0, d3d11->sprites.vbo, sizeof(d3d11_sprite_t), 0); + D3D11SetPrimitiveTopology(d3d11->context, D3D11_PRIMITIVE_TOPOLOGY_POINTLIST); return; } - if (!d3d11->sprites.enabled) + if (draw->coords->vertex && draw->coords->tex_coord && draw->coords->color) + vertex_count = draw->coords->vertices; + else + vertex_count = 1; + + if (!d3d11->sprites.enabled || vertex_count > d3d11->sprites.capacity) return; - if (d3d11->sprites.offset + 1 > d3d11->sprites.capacity) + if (d3d11->sprites.offset + vertex_count > d3d11->sprites.capacity) d3d11->sprites.offset = 0; { D3D11_MAPPED_SUBRESOURCE mapped_vbo; + d3d11_sprite_t* sprite = NULL; + D3D11MapBuffer( - d3d11->ctx, d3d11->sprites.vbo, 0, D3D11_MAP_WRITE_NO_OVERWRITE, 0, &mapped_vbo); - d3d11_sprite_t* v = (d3d11_sprite_t*)mapped_vbo.pData + d3d11->sprites.offset; + d3d11->context, d3d11->sprites.vbo, 0, D3D11_MAP_WRITE_NO_OVERWRITE, 0, &mapped_vbo); - v->pos.x = draw->x / (float)d3d11->viewport.Width; - v->pos.y = (d3d11->viewport.Height - draw->y - draw->height) / (float)d3d11->viewport.Height; - v->pos.w = draw->width / (float)d3d11->viewport.Width; - v->pos.h = draw->height / (float)d3d11->viewport.Height; + sprite = (d3d11_sprite_t*)mapped_vbo.pData + d3d11->sprites.offset; - v->coords.u = 0.0f; - v->coords.v = 0.0f; - v->coords.w = 1.0f; - v->coords.h = 1.0f; + if (vertex_count == 1) + { + sprite->pos.x = draw->x / (float)d3d11->viewport.Width; + sprite->pos.y = + (d3d11->viewport.Height - draw->y - draw->height) / (float)d3d11->viewport.Height; + sprite->pos.w = draw->width / (float)d3d11->viewport.Width; + sprite->pos.h = draw->height / (float)d3d11->viewport.Height; - if (draw->scale_factor) - v->params.scaling = draw->scale_factor; + sprite->coords.u = 0.0f; + sprite->coords.v = 0.0f; + sprite->coords.w = 1.0f; + sprite->coords.h = 1.0f; + + if (draw->scale_factor) + sprite->params.scaling = draw->scale_factor; + else + sprite->params.scaling = 1.0f; + + sprite->params.rotation = draw->rotation; + + sprite->colors[3] = DXGI_COLOR_RGBA( + 0xFF * draw->coords->color[0], 0xFF * draw->coords->color[1], + 0xFF * draw->coords->color[2], 0xFF * draw->coords->color[3]); + sprite->colors[2] = DXGI_COLOR_RGBA( + 0xFF * draw->coords->color[4], 0xFF * draw->coords->color[5], + 0xFF * draw->coords->color[6], 0xFF * draw->coords->color[7]); + sprite->colors[1] = DXGI_COLOR_RGBA( + 0xFF * draw->coords->color[8], 0xFF * draw->coords->color[9], + 0xFF * draw->coords->color[10], 0xFF * draw->coords->color[11]); + sprite->colors[0] = DXGI_COLOR_RGBA( + 0xFF * draw->coords->color[12], 0xFF * draw->coords->color[13], + 0xFF * draw->coords->color[14], 0xFF * draw->coords->color[15]); + } else - v->params.scaling = 1.0f; + { + int i; + const float* vertex = draw->coords->vertex; + const float* tex_coord = draw->coords->tex_coord; + const float* color = draw->coords->color; - v->params.rotation = draw->rotation; + for (i = 0; i < vertex_count; i++) + { + d3d11_vertex_t* v = (d3d11_vertex_t*)sprite; + v->position[0] = *vertex++; + v->position[1] = *vertex++; + v->texcoord[0] = *tex_coord++; + v->texcoord[1] = *tex_coord++; + v->color[0] = *color++; + v->color[1] = *color++; + v->color[2] = *color++; + v->color[3] = *color++; - v->colors[3] = DXGI_COLOR_RGBA( - 0xFF * draw->coords->color[0], 0xFF * draw->coords->color[1], - 0xFF * draw->coords->color[2], 0xFF * draw->coords->color[3]); - v->colors[2] = DXGI_COLOR_RGBA( - 0xFF * draw->coords->color[4], 0xFF * draw->coords->color[5], - 0xFF * draw->coords->color[6], 0xFF * draw->coords->color[7]); - v->colors[1] = DXGI_COLOR_RGBA( - 0xFF * draw->coords->color[8], 0xFF * draw->coords->color[9], - 0xFF * draw->coords->color[10], 0xFF * draw->coords->color[11]); - v->colors[0] = DXGI_COLOR_RGBA( - 0xFF * draw->coords->color[12], 0xFF * draw->coords->color[13], - 0xFF * draw->coords->color[14], 0xFF * draw->coords->color[15]); + sprite++; + } - D3D11UnmapBuffer(d3d11->ctx, d3d11->sprites.vbo, 0); + d3d11_set_shader(d3d11->context, &d3d11->shaders[VIDEO_SHADER_STOCK_BLEND]); + D3D11SetPrimitiveTopology(d3d11->context, D3D11_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP); + } + + D3D11UnmapBuffer(d3d11->context, d3d11->sprites.vbo, 0); + } + + d3d11_set_texture_and_sampler(d3d11->context, 0, (d3d11_texture_t*)draw->texture); + D3D11Draw(d3d11->context, vertex_count, d3d11->sprites.offset); + d3d11->sprites.offset += vertex_count; + + if (vertex_count > 1) + { + d3d11_set_shader(d3d11->context, &d3d11->sprites.shader); + D3D11SetPrimitiveTopology(d3d11->context, D3D11_PRIMITIVE_TOPOLOGY_POINTLIST); } - d3d11_set_texture_and_sampler(d3d11->ctx, 0, (d3d11_texture_t*)draw->texture); - D3D11Draw(d3d11->ctx, 1, d3d11->sprites.offset); - d3d11->sprites.offset++; return; } @@ -128,8 +175,6 @@ static void menu_display_d3d11_draw_pipeline(void* data) menu_display_ctx_draw_t* draw = (menu_display_ctx_draw_t*)data; d3d11_video_t* d3d11 = (d3d11_video_t*)video_driver_get_ptr(false); - video_coord_array_t* ca = NULL; - if (!d3d11 || !draw) return; @@ -138,21 +183,21 @@ static void menu_display_d3d11_draw_pipeline(void* data) case VIDEO_SHADER_MENU: case VIDEO_SHADER_MENU_2: { - ca = menu_display_get_coords_array(); + video_coord_array_t* ca = menu_display_get_coords_array(); if (!d3d11->menu_pipeline_vbo) { - D3D11_BUFFER_DESC desc = { - .Usage = D3D11_USAGE_IMMUTABLE, - .ByteWidth = ca->coords.vertices * 2 * sizeof(float), - .BindFlags = D3D11_BIND_VERTEX_BUFFER, - }; + D3D11_BUFFER_DESC desc = { 0 }; + desc.Usage = D3D11_USAGE_IMMUTABLE; + desc.ByteWidth = ca->coords.vertices * 2 * sizeof(float); + desc.BindFlags = D3D11_BIND_VERTEX_BUFFER; + D3D11_SUBRESOURCE_DATA vertexData = { ca->coords.vertex }; D3D11CreateBuffer(d3d11->device, &desc, &vertexData, &d3d11->menu_pipeline_vbo); } - D3D11SetVertexBuffer(d3d11->ctx, 0, d3d11->menu_pipeline_vbo, 2 * sizeof(float), 0); + D3D11SetVertexBuffer(d3d11->context, 0, d3d11->menu_pipeline_vbo, 2 * sizeof(float), 0); draw->coords->vertices = ca->coords.vertices; - D3D11SetBlendState(d3d11->ctx, d3d11->blend_pipeline, NULL, D3D11_DEFAULT_SAMPLE_MASK); + D3D11SetBlendState(d3d11->context, d3d11->blend_pipeline, NULL, D3D11_DEFAULT_SAMPLE_MASK); break; } @@ -160,21 +205,22 @@ static void menu_display_d3d11_draw_pipeline(void* data) case VIDEO_SHADER_MENU_4: case VIDEO_SHADER_MENU_5: case VIDEO_SHADER_MENU_6: - D3D11SetVertexBuffer(d3d11->ctx, 0, d3d11->frame.vbo, sizeof(d3d11_vertex_t), 0); + D3D11SetVertexBuffer(d3d11->context, 0, d3d11->frame.vbo, sizeof(d3d11_vertex_t), 0); draw->coords->vertices = 4; break; default: return; } - D3D11SetPrimitiveTopology(d3d11->ctx, D3D11_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP); + D3D11SetPrimitiveTopology(d3d11->context, D3D11_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP); d3d11->ubo_values.time += 0.01f; + { D3D11_MAPPED_SUBRESOURCE mapped_ubo; - D3D11MapBuffer(d3d11->ctx, d3d11->ubo, 0, D3D11_MAP_WRITE_DISCARD, 0, &mapped_ubo); + D3D11MapBuffer(d3d11->context, d3d11->ubo, 0, D3D11_MAP_WRITE_DISCARD, 0, &mapped_ubo); *(d3d11_uniform_t*)mapped_ubo.pData = d3d11->ubo_values; - D3D11UnmapBuffer(d3d11->ctx, d3d11->ubo, 0); + D3D11UnmapBuffer(d3d11->context, d3d11->ubo, 0); } } @@ -187,7 +233,7 @@ static void menu_display_d3d11_clear_color(menu_display_ctx_clearcolor_t* clearc if (!d3d11 || !clearcolor) return; - D3D11ClearRenderTargetView(d3d11->ctx, d3d11->renderTargetView, (float*)clearcolor); + D3D11ClearRenderTargetView(d3d11->context, d3d11->renderTargetView, (float*)clearcolor); } static bool menu_display_d3d11_font_init_first( @@ -197,12 +243,12 @@ static bool menu_display_d3d11_font_init_first( float font_size, bool is_threaded) { - font_data_t** handle = (font_data_t**)font_handle; - font_data_t *new_handle = font_driver_init_first( - video_data, font_path, font_size, true, is_threaded, FONT_DRIVER_RENDER_D3D11_API); + font_data_t** handle = (font_data_t**)font_handle; + font_data_t* new_handle = font_driver_init_first( + video_data, font_path, font_size, true, is_threaded, FONT_DRIVER_RENDER_D3D11_API); if (!new_handle) - return false; - *handle = new_handle; + return false; + *handle = new_handle; return true; } diff --git a/menu/drivers_display/menu_display_d3d12.c b/menu/drivers_display/menu_display_d3d12.c new file mode 100644 index 0000000000..2702dc02bd --- /dev/null +++ b/menu/drivers_display/menu_display_d3d12.c @@ -0,0 +1,292 @@ +/* RetroArch - A frontend for libretro. + * Copyright (C) 2014-2018 - Ali Bouhlel + * + * RetroArch is free software: you can redistribute it and/or modify it under the terms + * of the GNU General Public License as published by the Free Software Found- + * ation, either version 3 of the License, or (at your option) any later version. + * + * RetroArch is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR + * PURPOSE. See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with RetroArch. + * If not, see . + */ + +#define CINTERFACE + +#include + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "../menu_driver.h" + +#include "../../retroarch.h" +#include "../../gfx/font_driver.h" +#include "../../gfx/video_driver.h" +#include "../../gfx/common/d3d12_common.h" + +static const float* menu_display_d3d12_get_default_vertices(void) { return NULL; } + +static const float* menu_display_d3d12_get_default_tex_coords(void) { return NULL; } + +static void* menu_display_d3d12_get_default_mvp(void) { return NULL; } + +static void menu_display_d3d12_blend_begin(void) +{ + d3d12_video_t* d3d12 = (d3d12_video_t*)video_driver_get_ptr(false); + + d3d12->sprites.pipe = d3d12->sprites.pipe_blend; + D3D12SetPipelineState(d3d12->queue.cmd, d3d12->sprites.pipe); +} + +static void menu_display_d3d12_blend_end(void) +{ + d3d12_video_t* d3d12 = (d3d12_video_t*)video_driver_get_ptr(false); + + d3d12->sprites.pipe = d3d12->sprites.pipe_noblend; + D3D12SetPipelineState(d3d12->queue.cmd, d3d12->sprites.pipe); +} + +static void menu_display_d3d12_viewport(void* data) {} + +static void menu_display_d3d12_draw(void* data) +{ + int vertex_count; + d3d12_video_t* d3d12 = (d3d12_video_t*)video_driver_get_ptr(false); + menu_display_ctx_draw_t* draw = (menu_display_ctx_draw_t*)data; + + if (!d3d12 || !draw || !draw->texture) + return; + + switch (draw->pipeline.id) + { + case VIDEO_SHADER_MENU: + case VIDEO_SHADER_MENU_2: + case VIDEO_SHADER_MENU_3: + case VIDEO_SHADER_MENU_4: + case VIDEO_SHADER_MENU_5: + case VIDEO_SHADER_MENU_6: + D3D12SetPipelineState(d3d12->queue.cmd, d3d12->pipes[draw->pipeline.id]); + D3D12DrawInstanced(d3d12->queue.cmd, draw->coords->vertices, 1, 0, 0); + D3D12SetPipelineState(d3d12->queue.cmd, d3d12->sprites.pipe); + D3D12IASetPrimitiveTopology(d3d12->queue.cmd, D3D_PRIMITIVE_TOPOLOGY_POINTLIST); + D3D12IASetVertexBuffers(d3d12->queue.cmd, 0, 1, &d3d12->sprites.vbo_view); + return; + } + + if (draw->coords->vertex && draw->coords->tex_coord && draw->coords->color) + vertex_count = draw->coords->vertices; + else + vertex_count = 1; + + if (!d3d12->sprites.enabled || vertex_count > d3d12->sprites.capacity) + return; + + if (d3d12->sprites.offset + vertex_count > d3d12->sprites.capacity) + d3d12->sprites.offset = 0; + + { + d3d12_sprite_t* sprite; + D3D12_RANGE range = { 0, 0 }; + D3D12Map(d3d12->sprites.vbo, 0, &range, (void**)&sprite); + sprite += d3d12->sprites.offset; + + if (vertex_count == 1) + { + + sprite->pos.x = draw->x / (float)d3d12->chain.viewport.Width; + sprite->pos.y = (d3d12->chain.viewport.Height - draw->y - draw->height) / + (float)d3d12->chain.viewport.Height; + sprite->pos.w = draw->width / (float)d3d12->chain.viewport.Width; + sprite->pos.h = draw->height / (float)d3d12->chain.viewport.Height; + + sprite->coords.u = 0.0f; + sprite->coords.v = 0.0f; + sprite->coords.w = 1.0f; + sprite->coords.h = 1.0f; + + if (draw->scale_factor) + sprite->params.scaling = draw->scale_factor; + else + sprite->params.scaling = 1.0f; + + sprite->params.rotation = draw->rotation; + + sprite->colors[3] = DXGI_COLOR_RGBA( + 0xFF * draw->coords->color[0], 0xFF * draw->coords->color[1], + 0xFF * draw->coords->color[2], 0xFF * draw->coords->color[3]); + sprite->colors[2] = DXGI_COLOR_RGBA( + 0xFF * draw->coords->color[4], 0xFF * draw->coords->color[5], + 0xFF * draw->coords->color[6], 0xFF * draw->coords->color[7]); + sprite->colors[1] = DXGI_COLOR_RGBA( + 0xFF * draw->coords->color[8], 0xFF * draw->coords->color[9], + 0xFF * draw->coords->color[10], 0xFF * draw->coords->color[11]); + sprite->colors[0] = DXGI_COLOR_RGBA( + 0xFF * draw->coords->color[12], 0xFF * draw->coords->color[13], + 0xFF * draw->coords->color[14], 0xFF * draw->coords->color[15]); + } + else + { + int i; + const float* vertex = draw->coords->vertex; + const float* tex_coord = draw->coords->tex_coord; + const float* color = draw->coords->color; + + for (i = 0; i < vertex_count; i++) + { + d3d12_vertex_t* v = (d3d12_vertex_t*)sprite; + v->position[0] = *vertex++; + v->position[1] = *vertex++; + v->texcoord[0] = *tex_coord++; + v->texcoord[1] = *tex_coord++; + v->color[0] = *color++; + v->color[1] = *color++; + v->color[2] = *color++; + v->color[3] = *color++; + + sprite++; + } + D3D12SetPipelineState(d3d12->queue.cmd, d3d12->pipes[VIDEO_SHADER_STOCK_BLEND]); + D3D12IASetPrimitiveTopology(d3d12->queue.cmd, D3D_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP); + } + + range.Begin = d3d12->sprites.offset * sizeof(*sprite); + range.End = (d3d12->sprites.offset + vertex_count) * sizeof(*sprite); + D3D12Unmap(d3d12->sprites.vbo, 0, &range); + } + + { + d3d12_texture_t* texture = (d3d12_texture_t*)draw->texture; + if (texture->dirty) + { + d3d12_upload_texture(d3d12->queue.cmd, texture); + + if (vertex_count > 1) + D3D12SetPipelineState(d3d12->queue.cmd, d3d12->pipes[VIDEO_SHADER_STOCK_BLEND]); + else + D3D12SetPipelineState(d3d12->queue.cmd, d3d12->sprites.pipe); + } + d3d12_set_texture_and_sampler(d3d12->queue.cmd, texture); + } + + D3D12DrawInstanced(d3d12->queue.cmd, vertex_count, 1, d3d12->sprites.offset, 0); + d3d12->sprites.offset += vertex_count; + + if (vertex_count > 1) + { + D3D12SetPipelineState(d3d12->queue.cmd, d3d12->sprites.pipe); + D3D12IASetPrimitiveTopology(d3d12->queue.cmd, D3D_PRIMITIVE_TOPOLOGY_POINTLIST); + } + + return; +} + +static void menu_display_d3d12_draw_pipeline(void* data) +{ + menu_display_ctx_draw_t* draw = (menu_display_ctx_draw_t*)data; + d3d12_video_t* d3d12 = (d3d12_video_t*)video_driver_get_ptr(false); + + if (!d3d12 || !draw) + return; + + switch (draw->pipeline.id) + { + case VIDEO_SHADER_MENU: + case VIDEO_SHADER_MENU_2: + { + video_coord_array_t* ca = menu_display_get_coords_array(); + + if (!d3d12->menu_pipeline_vbo) + { + void* vertex_data_begin; + D3D12_RANGE read_range = { 0, 0 }; + + d3d12->menu_pipeline_vbo_view.StrideInBytes = 2 * sizeof(float); + d3d12->menu_pipeline_vbo_view.SizeInBytes = + ca->coords.vertices * d3d12->menu_pipeline_vbo_view.StrideInBytes; + d3d12->menu_pipeline_vbo_view.BufferLocation = d3d12_create_buffer( + d3d12->device, d3d12->menu_pipeline_vbo_view.SizeInBytes, + &d3d12->menu_pipeline_vbo); + + D3D12Map(d3d12->menu_pipeline_vbo, 0, &read_range, &vertex_data_begin); + memcpy(vertex_data_begin, ca->coords.vertex, d3d12->menu_pipeline_vbo_view.SizeInBytes); + D3D12Unmap(d3d12->menu_pipeline_vbo, 0, NULL); + } + D3D12IASetVertexBuffers(d3d12->queue.cmd, 0, 1, &d3d12->menu_pipeline_vbo_view); + draw->coords->vertices = ca->coords.vertices; + break; + } + + case VIDEO_SHADER_MENU_3: + case VIDEO_SHADER_MENU_4: + case VIDEO_SHADER_MENU_5: + case VIDEO_SHADER_MENU_6: + D3D12IASetVertexBuffers(d3d12->queue.cmd, 0, 1, &d3d12->frame.vbo_view); + draw->coords->vertices = 4; + break; + default: + return; + } + D3D12IASetPrimitiveTopology(d3d12->queue.cmd, D3D_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP); + + d3d12->ubo_values.time += 0.01f; + + { + D3D12_RANGE read_range = { 0, 0 }; + d3d12_uniform_t* mapped_ubo; + D3D12Map(d3d12->ubo, 0, &read_range, (void**)&mapped_ubo); + *mapped_ubo = d3d12->ubo_values; + D3D12Unmap(d3d12->ubo, 0, NULL); + } + D3D12SetGraphicsRootConstantBufferView( + d3d12->queue.cmd, ROOT_ID_UBO, d3d12->ubo_view.BufferLocation); +} + +static void menu_display_d3d12_restore_clear_color(void) {} + +static void menu_display_d3d12_clear_color(menu_display_ctx_clearcolor_t* clearcolor) +{ + d3d12_video_t* d3d12 = (d3d12_video_t*)video_driver_get_ptr(false); + + if (!d3d12 || !clearcolor) + return; + + D3D12ClearRenderTargetView( + d3d12->queue.cmd, d3d12->chain.desc_handles[d3d12->chain.frame_index], (float*)clearcolor, + 0, NULL); +} + +static bool menu_display_d3d12_font_init_first( + void** font_handle, + void* video_data, + const char* font_path, + float font_size, + bool is_threaded) +{ + font_data_t** handle = (font_data_t**)font_handle; + font_data_t* new_handle = font_driver_init_first( + video_data, font_path, font_size, true, is_threaded, FONT_DRIVER_RENDER_D3D12_API); + if (!new_handle) + return false; + *handle = new_handle; + return true; +} + +menu_display_ctx_driver_t menu_display_ctx_d3d12 = { + menu_display_d3d12_draw, + menu_display_d3d12_draw_pipeline, + menu_display_d3d12_viewport, + menu_display_d3d12_blend_begin, + menu_display_d3d12_blend_end, + menu_display_d3d12_restore_clear_color, + menu_display_d3d12_clear_color, + menu_display_d3d12_get_default_mvp, + menu_display_d3d12_get_default_vertices, + menu_display_d3d12_get_default_tex_coords, + menu_display_d3d12_font_init_first, + MENU_VIDEO_DRIVER_DIRECT3D12, + "menu_display_d3d12", +}; diff --git a/menu/menu_cbs.h b/menu/menu_cbs.h index a73aee774e..a0949104ba 100644 --- a/menu/menu_cbs.h +++ b/menu/menu_cbs.h @@ -141,9 +141,6 @@ int action_refresh_default(file_list_t *list, file_list_t *menu_list); int shader_action_parameter_right(unsigned type, const char *label, bool wraparound); -int shader_action_parameter_preset_right(unsigned type, const char *label, - bool wraparound); - int generic_action_ok_displaylist_push(const char *path, const char *new_path, const char *label, unsigned type, size_t idx, size_t entry_idx, unsigned action_type); diff --git a/menu/menu_displaylist.c b/menu/menu_displaylist.c index faa141220a..6750719740 100644 --- a/menu/menu_displaylist.c +++ b/menu/menu_displaylist.c @@ -1390,12 +1390,17 @@ static int menu_displaylist_parse_shader_options(menu_displaylist_info_t *info) MENU_SETTING_ACTION, 0, 0); menu_entries_append_enum(info->list, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_VIDEO_SHADER_PRESET_SAVE_CORE), - msg_hash_to_str(MENU_ENUM_LABEL_VIDEO_SHADER_PRESET_SAVE_AS), + msg_hash_to_str(MENU_ENUM_LABEL_VIDEO_SHADER_PRESET_SAVE_CORE), MENU_ENUM_LABEL_VIDEO_SHADER_PRESET_SAVE_CORE, MENU_SETTING_ACTION, 0, 0); + menu_entries_append_enum(info->list, + msg_hash_to_str(MENU_ENUM_LABEL_VALUE_VIDEO_SHADER_PRESET_SAVE_PARENT), + msg_hash_to_str(MENU_ENUM_LABEL_VIDEO_SHADER_PRESET_SAVE_PARENT), + MENU_ENUM_LABEL_VIDEO_SHADER_PRESET_SAVE_PARENT, + MENU_SETTING_ACTION, 0, 0); menu_entries_append_enum(info->list, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_VIDEO_SHADER_PRESET_SAVE_GAME), - msg_hash_to_str(MENU_ENUM_LABEL_VIDEO_SHADER_PRESET_SAVE_AS), + msg_hash_to_str(MENU_ENUM_LABEL_VIDEO_SHADER_PRESET_SAVE_GAME), MENU_ENUM_LABEL_VIDEO_SHADER_PRESET_SAVE_GAME, MENU_SETTING_ACTION, 0, 0); menu_entries_append_enum(info->list, @@ -1403,11 +1408,6 @@ static int menu_displaylist_parse_shader_options(menu_displaylist_info_t *info) msg_hash_to_str(MENU_ENUM_LABEL_VIDEO_SHADER_PARAMETERS), MENU_ENUM_LABEL_VIDEO_SHADER_PARAMETERS, MENU_SETTING_ACTION, 0, 0); - menu_entries_append_enum(info->list, - msg_hash_to_str(MENU_ENUM_LABEL_VALUE_VIDEO_SHADER_PRESET_PARAMETERS), - msg_hash_to_str(MENU_ENUM_LABEL_VIDEO_SHADER_PRESET_PARAMETERS), - MENU_ENUM_LABEL_VIDEO_SHADER_PRESET_PARAMETERS, - MENU_SETTING_ACTION, 0, 0); menu_entries_append_enum(info->list, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_VIDEO_SHADER_NUM_PASSES), msg_hash_to_str(MENU_ENUM_LABEL_VIDEO_SHADER_NUM_PASSES), @@ -1453,20 +1453,17 @@ static int create_string_list_rdb_entry_string( file_list_t *list) { union string_list_elem_attr attr; - size_t path_size = PATH_MAX_LENGTH * sizeof(char); - char *tmp = (char*)malloc(PATH_MAX_LENGTH * sizeof(char)); + char *tmp = NULL; char *output_label = NULL; int str_len = 0; struct string_list *str_list = string_list_new(); if (!str_list) - { - free(tmp); return -1; - } - attr.i = 0; - tmp[0] = '\0'; + attr.i = 0; + tmp = (char*)malloc(PATH_MAX_LENGTH * sizeof(char)); + tmp[0] = '\0'; str_len += strlen(label) + 1; string_list_append(str_list, label, attr); @@ -1490,7 +1487,7 @@ static int create_string_list_rdb_entry_string( fill_pathname_join_concat_noext(tmp, desc, ": ", actual_string, - path_size); + PATH_MAX_LENGTH * sizeof(char)); menu_entries_append_enum(list, tmp, output_label, enum_idx, 0, 0, 0); @@ -1511,8 +1508,8 @@ static int create_string_list_rdb_entry_int( { union string_list_elem_attr attr; size_t path_size = PATH_MAX_LENGTH * sizeof(char); - char *tmp = (char*)malloc(PATH_MAX_LENGTH * sizeof(char)); - char *str = (char*)malloc(PATH_MAX_LENGTH * sizeof(char)); + char *tmp = NULL; + char *str = NULL; char *output_label = NULL; int str_len = 0; struct string_list *str_list = string_list_new(); @@ -1520,7 +1517,9 @@ static int create_string_list_rdb_entry_int( if (!str_list) goto error; - attr.i = 0; + attr.i = 0; + tmp = (char*)malloc(PATH_MAX_LENGTH * sizeof(char)); + str = (char*)malloc(PATH_MAX_LENGTH * sizeof(char)); tmp[0] = str[0] = '\0'; str_len += strlen(label) + 1; @@ -5498,6 +5497,10 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, void *data) MENU_ENUM_LABEL_NETPLAY_USE_MITM_SERVER, PARSE_ONLY_BOOL, false) != -1) count++; + if (menu_displaylist_parse_settings_enum(menu, info, + MENU_ENUM_LABEL_NETPLAY_MITM_SERVER, + PARSE_ONLY_STRING, false) != -1) + count++; if (menu_displaylist_parse_settings_enum(menu, info, MENU_ENUM_LABEL_NETPLAY_IP_ADDRESS, PARSE_ONLY_STRING, false) != -1) @@ -5826,6 +5829,9 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, void *data) menu_displaylist_parse_settings_enum(menu, info, MENU_ENUM_LABEL_VIDEO_WINDOW_OPACITY, PARSE_ONLY_UINT, false); + menu_displaylist_parse_settings_enum(menu, info, + MENU_ENUM_LABEL_VIDEO_WINDOW_SHOW_DECORATIONS, + PARSE_ONLY_BOOL, false); menu_displaylist_parse_settings_enum(menu, info, MENU_ENUM_LABEL_VIDEO_SCALE_INTEGER, PARSE_ONLY_BOOL, false); diff --git a/menu/menu_driver.c b/menu/menu_driver.c index 787252526e..9675d2ecc5 100644 --- a/menu/menu_driver.c +++ b/menu/menu_driver.c @@ -93,6 +93,9 @@ static menu_display_ctx_driver_t *menu_display_ctx_drivers[] = { #ifdef HAVE_D3D11 &menu_display_ctx_d3d11, #endif +#ifdef HAVE_D3D12 + &menu_display_ctx_d3d12, +#endif #ifdef HAVE_OPENGL &menu_display_ctx_gl, #endif @@ -229,6 +232,10 @@ static bool menu_display_check_compatibility( if (string_is_equal(video_driver, "d3d11")) return true; break; + case MENU_VIDEO_DRIVER_DIRECT3D12: + if (string_is_equal(video_driver, "d3d12")) + return true; + break; case MENU_VIDEO_DRIVER_VITA2D: if (string_is_equal(video_driver, "vita2d")) return true; diff --git a/menu/menu_driver.h b/menu/menu_driver.h index 83e78d91cb..0eb30e254a 100644 --- a/menu/menu_driver.h +++ b/menu/menu_driver.h @@ -280,6 +280,7 @@ enum menu_display_driver_type MENU_VIDEO_DRIVER_VULKAN, MENU_VIDEO_DRIVER_DIRECT3D, MENU_VIDEO_DRIVER_DIRECT3D11, + MENU_VIDEO_DRIVER_DIRECT3D12, MENU_VIDEO_DRIVER_VITA2D, MENU_VIDEO_DRIVER_CTR, MENU_VIDEO_DRIVER_WIIU, @@ -736,6 +737,7 @@ extern menu_display_ctx_driver_t menu_display_ctx_gl; extern menu_display_ctx_driver_t menu_display_ctx_vulkan; extern menu_display_ctx_driver_t menu_display_ctx_d3d; extern menu_display_ctx_driver_t menu_display_ctx_d3d11; +extern menu_display_ctx_driver_t menu_display_ctx_d3d12; extern menu_display_ctx_driver_t menu_display_ctx_vita2d; extern menu_display_ctx_driver_t menu_display_ctx_ctr; extern menu_display_ctx_driver_t menu_display_ctx_wiiu; diff --git a/menu/menu_setting.c b/menu/menu_setting.c index 9e1b4e4463..aefbbbb9b6 100644 --- a/menu/menu_setting.c +++ b/menu/menu_setting.c @@ -575,6 +575,14 @@ static void setting_get_string_representation_uint_autosave_interval(void *data, } #endif +#if defined(HAVE_NETWORKING) +static void setting_get_string_representation_netplay_mitm_server(void *data, + char *s, size_t len) +{ + +} +#endif + #ifdef HAVE_LANGEXTRA static void setting_get_string_representation_uint_user_language(void *data, char *s, size_t len) @@ -597,6 +605,7 @@ static void setting_get_string_representation_uint_user_language(void *data, modes[RETRO_LANGUAGE_ESPERANTO] = msg_hash_to_str(MENU_ENUM_LABEL_VALUE_LANG_ESPERANTO); modes[RETRO_LANGUAGE_POLISH] = msg_hash_to_str(MENU_ENUM_LABEL_VALUE_LANG_POLISH); modes[RETRO_LANGUAGE_VIETNAMESE] = msg_hash_to_str(MENU_ENUM_LABEL_VALUE_LANG_VIETNAMESE); + modes[RETRO_LANGUAGE_ARABIC] = msg_hash_to_str(MENU_ENUM_LABEL_VALUE_LANG_ARABIC); strlcpy(s, modes[*msg_hash_get_uint(MSG_HASH_USER_LANGUAGE)], len); } @@ -1465,7 +1474,8 @@ setting_get_string_representation_st_float_video_refresh_rate_auto( if (!setting) return; - if (video_monitor_fps_statistics(&video_refresh_rate, &deviation, &sample_points)) + if (video_monitor_fps_statistics(&video_refresh_rate, + &deviation, &sample_points)) { snprintf(s, len, "%.3f Hz (%.1f%% dev, %u samples)", video_refresh_rate, 100.0 * deviation, sample_points); @@ -1844,6 +1854,9 @@ void general_write_handler(void *data) case MENU_ENUM_LABEL_VIDEO_WINDOW_OPACITY: video_display_server_set_window_opacity(settings->uints.video_window_opacity); break; + case MENU_ENUM_LABEL_VIDEO_WINDOW_SHOW_DECORATIONS: + video_display_server_set_window_decorations(settings->bools.video_window_show_decorations); + break; default: break; } @@ -3653,6 +3666,22 @@ static bool setting_append_list( settings_data_list_current_add_flags(list, list_info, SD_FLAG_LAKKA_ADVANCED); } + CONFIG_BOOL( + list, list_info, + &settings->bools.video_window_show_decorations, + MENU_ENUM_LABEL_VIDEO_WINDOW_SHOW_DECORATIONS, + MENU_ENUM_LABEL_VALUE_VIDEO_WINDOW_SHOW_DECORATIONS, + window_decorations, + MENU_ENUM_LABEL_VALUE_OFF, + MENU_ENUM_LABEL_VALUE_ON, + &group_info, + &subgroup_info, + parent_group, + general_write_handler, + general_read_handler, + SD_FLAG_NONE); + menu_settings_list_current_add_cmd(list, list_info, CMD_EVENT_REINIT); + CONFIG_BOOL( list, list_info, &settings->bools.video_scale_integer, @@ -6718,6 +6747,21 @@ static bool setting_append_list( general_read_handler, SD_FLAG_NONE); + CONFIG_STRING( + list, list_info, + settings->arrays.netplay_mitm_server, + sizeof(settings->arrays.netplay_mitm_server), + MENU_ENUM_LABEL_NETPLAY_MITM_SERVER, + MENU_ENUM_LABEL_VALUE_NETPLAY_MITM_SERVER, + netplay_mitm_server, + &group_info, + &subgroup_info, + parent_group, + general_write_handler, + general_read_handler); + (*list)[list_info->index - 1].get_string_representation = + &setting_get_string_representation_netplay_mitm_server; + CONFIG_STRING( list, list_info, settings->paths.netplay_server, diff --git a/menu/menu_shader.c b/menu/menu_shader.c index 2f3982c345..8d9ef1d7fd 100644 --- a/menu/menu_shader.c +++ b/menu/menu_shader.c @@ -30,6 +30,7 @@ #include "../file_path_special.h" #include "../configuration.h" #include "../paths.h" +#include "../retroarch.h" #include "../verbosity.h" #ifdef HAVE_SHADER_MANAGER @@ -120,26 +121,9 @@ unsigned menu_shader_manager_get_amount_passes(void) { return 0; } void menu_shader_manager_free(void) { } #endif -/** - * menu_shader_manager_init: - * - * Initializes shader manager. - **/ -bool menu_shader_manager_init(void) +void menu_shader_manager_init_paths(void) { -#ifdef HAVE_SHADER_MANAGER - settings_t *settings = config_get_ptr(); const char *config_path = path_get(RARCH_PATH_CONFIG); - const char *path_shader = settings->paths.path_shader; - - menu_shader_manager_free(); - - menu_driver_shader = (struct video_shader*) - calloc(1, sizeof(struct video_shader)); - - if (!menu_driver_shader) - return false; - /* In a multi-config setting, we can't have * conflicts on menu.cgp/menu.glslp. */ if (config_path) @@ -165,6 +149,28 @@ bool menu_shader_manager_init(void) strlcpy(default_slangp, "menu.slangp", sizeof(default_slangp)); } +} + +/** + * menu_shader_manager_init: + * + * Initializes shader manager. + **/ +bool menu_shader_manager_init(void) +{ +#ifdef HAVE_SHADER_MANAGER + settings_t *settings = config_get_ptr(); + const char *path_shader = retroarch_get_shader_preset(); + + menu_shader_manager_free(); + + menu_driver_shader = (struct video_shader*) + calloc(1, sizeof(struct video_shader)); + + if (!menu_driver_shader || !path_shader) + return false; + + menu_shader_manager_init_paths(); switch (msg_hash_to_file_type(msg_hash_calculate( path_get_extension(path_shader)))) @@ -248,7 +254,7 @@ bool menu_shader_manager_init(void) * * Sets shader preset. **/ -void menu_shader_manager_set_preset(void *data, +bool menu_shader_manager_set_preset(void *data, unsigned type, const char *preset_path) { #ifdef HAVE_SHADER_MANAGER @@ -260,7 +266,7 @@ void menu_shader_manager_set_preset(void *data, if (!video_driver_set_shader((enum rarch_shader_type)type, preset_path)) { configuration_set_bool(settings, settings->bools.video_shader_enable, false); - return; + return false; } /* Makes sure that we use Menu Preset shader on driver reinit. @@ -271,7 +277,7 @@ void menu_shader_manager_set_preset(void *data, configuration_set_bool(settings, settings->bools.video_shader_enable, true); if (!preset_path || !shader) - return; + return false; /* Load stored Preset into menu on success. * Used when a preset is directly loaded. @@ -280,7 +286,7 @@ void menu_shader_manager_set_preset(void *data, conf = config_file_new(preset_path); if (!conf) - return; + return false; RARCH_LOG("Setting Menu shader: %s.\n", preset_path); @@ -292,6 +298,8 @@ void menu_shader_manager_set_preset(void *data, config_file_free(conf); menu_entries_ctl(MENU_ENTRIES_CTL_SET_REFRESH, &refresh); + + return true; #endif } @@ -318,6 +326,7 @@ bool menu_shader_manager_save_preset( buffer[0] = config_directory[0] = '\0'; preset_path[0] = '\0'; + menu_shader_manager_init_paths(); if (!shader) return false; diff --git a/menu/menu_shader.h b/menu/menu_shader.h index 460b65fdea..92a3345dd5 100644 --- a/menu/menu_shader.h +++ b/menu/menu_shader.h @@ -48,7 +48,7 @@ bool menu_shader_manager_init(void); * * Sets shader preset. **/ -void menu_shader_manager_set_preset( +bool menu_shader_manager_set_preset( void *data, unsigned type, const char *preset_path); /** diff --git a/menu/widgets/menu_filebrowser.h b/menu/widgets/menu_filebrowser.h index 93dac91e75..b5656549dc 100644 --- a/menu/widgets/menu_filebrowser.h +++ b/menu/widgets/menu_filebrowser.h @@ -28,7 +28,6 @@ enum filebrowser_enums { FILEBROWSER_NONE = 0, FILEBROWSER_SELECT_DIR, - FILEBROWSER_APPEND_IMAGE, FILEBROWSER_SCAN_DIR, FILEBROWSER_SCAN_FILE, FILEBROWSER_SELECT_FILE, diff --git a/msg_hash.c b/msg_hash.c index 1ce3f6bc33..37a871b222 100644 --- a/msg_hash.c +++ b/msg_hash.c @@ -78,6 +78,9 @@ int menu_hash_get_help_enum(enum msg_hash_enums msg, char *s, size_t len) case RETRO_LANGUAGE_CHINESE_TRADITIONAL: ret = menu_hash_get_help_cht_enum(msg, s, len); break; + case RETRO_LANGUAGE_ARABIC: + ret = menu_hash_get_help_ar_enum(msg, s, len); + break; default: break; } @@ -141,6 +144,9 @@ const char *msg_hash_to_str(enum msg_hash_enums msg) case RETRO_LANGUAGE_CHINESE_TRADITIONAL: ret = msg_hash_to_str_cht(msg); break; + case RETRO_LANGUAGE_ARABIC: + ret = msg_hash_to_str_ar(msg); + break; default: break; } diff --git a/msg_hash.h b/msg_hash.h index 21bdc4ceac..2caddc1745 100644 --- a/msg_hash.h +++ b/msg_hash.h @@ -908,6 +908,7 @@ enum msg_hash_enums MENU_LABEL(HELP_LOADING_CONTENT), MENU_LABEL(HELP_LIST), MENU_LABEL(HELP_CONTROLS), + MENU_LABEL(HELP_CHEEVOS_DESCRIPTION), MENU_ENUM_LABEL_VALUE_EXTRACTING_PLEASE_WAIT, @@ -916,6 +917,7 @@ enum msg_hash_enums MENU_LABEL(BROWSE_URL), MENU_LABEL(BROWSE_START), /* Deferred */ + MENU_ENUM_LABEL_DEFERRED_CONFIGURATIONS_LIST, MENU_ENUM_LABEL_DEFERRED_FAVORITES_LIST, MENU_ENUM_LABEL_DEFERRED_PLAYLIST_LIST, MENU_ENUM_LABEL_DEFERRED_IMAGES_LIST, @@ -1512,6 +1514,7 @@ enum msg_hash_enums MENU_LABEL(VIDEO_SHADER_PRESET_SAVE_AS), MENU_LABEL(VIDEO_SHADER_PRESET_SAVE_CORE), MENU_LABEL(VIDEO_SHADER_PRESET_SAVE_GAME), + MENU_LABEL(VIDEO_SHADER_PRESET_SAVE_PARENT), MENU_LABEL(USER_LANGUAGE), MENU_LABEL(NETPLAY_NICKNAME), MENU_LABEL(VIDEO_VI_WIDTH), @@ -1658,6 +1661,7 @@ enum msg_hash_enums MENU_ENUM_LABEL_VALUE_LANG_ESPERANTO, MENU_ENUM_LABEL_VALUE_LANG_POLISH, MENU_ENUM_LABEL_VALUE_LANG_VIETNAMESE, + MENU_ENUM_LABEL_VALUE_LANG_ARABIC, MENU_ENUM_LABEL_VALUE_NONE, MENU_ENUM_LABEL_VALUE_NO_INFORMATION_AVAILABLE, @@ -1729,11 +1733,12 @@ enum msg_hash_enums MENU_ENUM_LABEL_VALUE_NETPLAY_COMPAT_CONTENT_FOUND, MENU_LABEL(NETPLAY_USE_MITM_SERVER), + MENU_LABEL(NETPLAY_MITM_SERVER), + MENU_LABEL(VIDEO_WINDOW_SHOW_DECORATIONS), MSG_LAST }; - /* Callback strings */ #define CB_CORE_UPDATER_DOWNLOAD 0x7412da7dU @@ -2013,6 +2018,9 @@ int menu_hash_get_help_cht_enum(enum msg_hash_enums msg, char *s, size_t len); const char *msg_hash_to_str_us(enum msg_hash_enums msg); int menu_hash_get_help_us_enum(enum msg_hash_enums msg, char *s, size_t len); +const char *msg_hash_to_str_ar(enum msg_hash_enums msg); +int menu_hash_get_help_ar_enum(enum msg_hash_enums msg, char *s, size_t len); + int menu_hash_get_help_enum(enum msg_hash_enums msg, char *s, size_t len); enum msg_file_type msg_hash_to_file_type(uint32_t hash); diff --git a/network/netplay/netplay.h b/network/netplay/netplay.h index 712f66dc27..535eb2ebe5 100644 --- a/network/netplay/netplay.h +++ b/network/netplay/netplay.h @@ -29,6 +29,16 @@ typedef struct netplay netplay_t; +typedef struct mitm_server { + const char *name; + const char *description; +} mitm_server_t; + +static const mitm_server_t netplay_mitm_server_list[] = { + { "nyc", "New York City, USA" }, + { "madrid", "Madrid, Spain" }, +}; + enum rarch_netplay_ctl_state { RARCH_NETPLAY_CTL_NONE = 0, diff --git a/network/netplay/netplay_delta.c b/network/netplay/netplay_delta.c index edfd225427..d6b7efe58b 100644 --- a/network/netplay/netplay_delta.c +++ b/network/netplay/netplay_delta.c @@ -152,7 +152,7 @@ netplay_input_state_t netplay_input_state_for(netplay_input_state_t *list, return NULL; /* Couldn't find a slot, allocate a fresh one */ - ret = calloc(1, sizeof(struct netplay_input_state) + (size-1) * sizeof(uint32_t)); + ret = (netplay_input_state_t)calloc(1, sizeof(struct netplay_input_state) + (size-1) * sizeof(uint32_t)); if (!ret) return NULL; *list = ret; diff --git a/network/netplay/netplay_frontend.c b/network/netplay/netplay_frontend.c index 9515fec3c3..cd1aaf0994 100644 --- a/network/netplay/netplay_frontend.c +++ b/network/netplay/netplay_frontend.c @@ -778,10 +778,11 @@ static void netplay_announce(void) buf[0] = '\0'; snprintf(buf, sizeof(buf), "username=%s&core_name=%s&core_version=%s&" - "game_name=%s&game_crc=%08X&port=%d" + "game_name=%s&game_crc=%08X&port=%d&mitm_server=%s" "&has_password=%d&has_spectate_password=%d&force_mitm=%d&retroarch_version=%s&frontend=%s", username, corename, coreversion, gamename, content_crc, settings->uints.netplay_port, + settings->arrays.netplay_mitm_server, *settings->paths.netplay_password ? 1 : 0, *settings->paths.netplay_spectate_password ? 1 : 0, settings->bools.netplay_use_mitm_server, diff --git a/network/netplay/netplay_sync.c b/network/netplay/netplay_sync.c index da8bcfc1bd..aff2359cf8 100644 --- a/network/netplay/netplay_sync.c +++ b/network/netplay/netplay_sync.c @@ -426,8 +426,8 @@ bool netplay_resolve_input(netplay_t *netplay, size_t sim_ptr, bool resim) { /* Merge them */ /* Most devices have all the digital parts in the first word. */ - static const uint32_t digital_common[3] = {-1, 0, 0}; - static const uint32_t digital_keyboard[5] = {-1, -1, -1, -1, -1}; + static const uint32_t digital_common[3] = {~0u, 0u, 0u}; + static const uint32_t digital_keyboard[5] = {~0u, ~0u, ~0u, ~0u, ~0u}; const uint32_t *digital; if (dtype == RETRO_DEVICE_KEYBOARD) digital = digital_keyboard; diff --git a/paths.c b/paths.c index cad1e47187..ab20de391c 100644 --- a/paths.c +++ b/paths.c @@ -143,7 +143,7 @@ void path_set_redirect(void) } } - /* Set savefile directory if empty based on content directory */ + /* Set savefile directory if empty to content directory */ if (string_is_empty(new_savefile_dir) || settings->bools.savefiles_in_content_dir) { strlcpy(new_savefile_dir, path_main_basename, @@ -319,6 +319,7 @@ static bool path_init_subsystem(void) { union string_list_elem_attr attr; char ext[32]; + char savename[PATH_MAX_LENGTH]; size_t path_size = PATH_MAX_LENGTH * sizeof(char); char *path = (char*)malloc( PATH_MAX_LENGTH * sizeof(char)); @@ -329,19 +330,21 @@ static bool path_init_subsystem(void) path[0] = ext[0] = '\0'; snprintf(ext, sizeof(ext), ".%s", mem->extension); + strlcpy(savename, subsystem_fullpaths->elems[i].data, sizeof(savename)); + path_remove_extension(savename); - if (path_is_directory(dir_get(RARCH_DIR_SAVEFILE))) + if (path_is_directory(dir_get(RARCH_DIR_CURRENT_SAVEFILE))) { /* Use SRAM dir */ /* Redirect content fullpath to save directory. */ - strlcpy(path, dir_get(RARCH_DIR_SAVEFILE), path_size); + strlcpy(path, dir_get(RARCH_DIR_CURRENT_SAVEFILE), path_size); fill_pathname_dir(path, - subsystem_fullpaths->elems[i].data, ext, + savename, ext, path_size); } else { - fill_pathname(path, subsystem_fullpaths->elems[i].data, + fill_pathname(path, savename, ext, path_size); } diff --git a/pkg/android/phoenix/jni/Android.mk b/pkg/android/phoenix/jni/Android.mk index 06a600f6c2..866b0f5158 100644 --- a/pkg/android/phoenix/jni/Android.mk +++ b/pkg/android/phoenix/jni/Android.mk @@ -71,7 +71,7 @@ DEFINES += -DRARCH_MOBILE -DHAVE_GRIFFIN -DHAVE_STB_VORBIS -DHAVE_LANGEXTRA -DAN DEFINES += -DWANT_IFADDRS ifeq ($(HAVE_VULKAN),1) -DEFINES += -DHAVE_VULKAN +DEFINES += -DHAVE_VULKAN -DHAVE_SLANG -DHAVE_SPIRV_CROSS -DWANT_GLSLANG endif DEFINES += -DHAVE_7ZIP DEFINES += -DHAVE_CHEEVOS @@ -108,57 +108,10 @@ LOCAL_CPPFLAGS += -I$(LOCAL_PATH)/$(DEPS_DIR)/glslang \ -I$(LOCAL_PATH)/$(DEPS_DIR)/glslang/glslang/glslang/Public \ -I$(LOCAL_PATH)/$(DEPS_DIR)/glslang/glslang/glslang/MachineIndependent \ -I$(LOCAL_PATH)/$(DEPS_DIR)/glslang/glslang/SPIRV \ - -I$(LOCAL_PATH)/$(DEPS_DIR)/spir2cross \ -I$(LOCAL_PATH)/$(DEPS_DIR)/SPIRV-Cross LOCAL_CFLAGS += -Wno-sign-compare -Wno-unused-variable -Wno-parentheses -LOCAL_SRC_FILES += $(DEPS_DIR)/glslang/glslang.cpp \ - $(DEPS_DIR)/glslang/glslang/SPIRV/SpvBuilder.cpp \ - $(DEPS_DIR)/glslang/glslang/SPIRV/Logger.cpp \ - $(DEPS_DIR)/glslang/glslang/SPIRV/SPVRemapper.cpp \ - $(DEPS_DIR)/glslang/glslang/SPIRV/InReadableOrder.cpp \ - $(DEPS_DIR)/glslang/glslang/SPIRV/doc.cpp \ - $(DEPS_DIR)/glslang/glslang/SPIRV/GlslangToSpv.cpp \ - $(DEPS_DIR)/glslang/glslang/SPIRV/disassemble.cpp \ - $(DEPS_DIR)/glslang/glslang/OGLCompilersDLL/InitializeDll.cpp \ - $(DEPS_DIR)/glslang/glslang/glslang/GenericCodeGen/Link.cpp \ - $(DEPS_DIR)/glslang/glslang/glslang/GenericCodeGen/CodeGen.cpp \ - $(DEPS_DIR)/glslang/glslang/hlsl/hlslAttributes.cpp \ - $(DEPS_DIR)/glslang/glslang/hlsl/hlslGrammar.cpp \ - $(DEPS_DIR)/glslang/glslang/hlsl/hlslOpMap.cpp \ - $(DEPS_DIR)/glslang/glslang/hlsl/hlslTokenStream.cpp \ - $(DEPS_DIR)/glslang/glslang/hlsl/hlslScanContext.cpp \ - $(DEPS_DIR)/glslang/glslang/hlsl/hlslParseHelper.cpp \ - $(DEPS_DIR)/glslang/glslang/hlsl/hlslParseables.cpp \ - $(DEPS_DIR)/glslang/glslang/glslang/MachineIndependent/Intermediate.cpp \ - $(DEPS_DIR)/glslang/glslang/glslang/MachineIndependent/propagateNoContraction.cpp \ - $(DEPS_DIR)/glslang/glslang/glslang/MachineIndependent/glslang_tab.cpp \ - $(DEPS_DIR)/glslang/glslang/glslang/MachineIndependent/Versions.cpp \ - $(DEPS_DIR)/glslang/glslang/glslang/MachineIndependent/RemoveTree.cpp \ - $(DEPS_DIR)/glslang/glslang/glslang/MachineIndependent/limits.cpp \ - $(DEPS_DIR)/glslang/glslang/glslang/MachineIndependent/intermOut.cpp \ - $(DEPS_DIR)/glslang/glslang/glslang/MachineIndependent/Initialize.cpp \ - $(DEPS_DIR)/glslang/glslang/glslang/MachineIndependent/SymbolTable.cpp \ - $(DEPS_DIR)/glslang/glslang/glslang/MachineIndependent/parseConst.cpp \ - $(DEPS_DIR)/glslang/glslang/glslang/MachineIndependent/ParseContextBase.cpp \ - $(DEPS_DIR)/glslang/glslang/glslang/MachineIndependent/ParseHelper.cpp \ - $(DEPS_DIR)/glslang/glslang/glslang/MachineIndependent/ShaderLang.cpp \ - $(DEPS_DIR)/glslang/glslang/glslang/MachineIndependent/IntermTraverse.cpp \ - $(DEPS_DIR)/glslang/glslang/glslang/MachineIndependent/iomapper.cpp \ - $(DEPS_DIR)/glslang/glslang/glslang/MachineIndependent/InfoSink.cpp \ - $(DEPS_DIR)/glslang/glslang/glslang/MachineIndependent/Constant.cpp \ - $(DEPS_DIR)/glslang/glslang/glslang/MachineIndependent/Scan.cpp \ - $(DEPS_DIR)/glslang/glslang/glslang/MachineIndependent/reflection.cpp \ - $(DEPS_DIR)/glslang/glslang/glslang/MachineIndependent/linkValidate.cpp \ - $(DEPS_DIR)/glslang/glslang/glslang/MachineIndependent/PoolAlloc.cpp \ - $(DEPS_DIR)/glslang/glslang/glslang/MachineIndependent/preprocessor/PpAtom.cpp \ - $(DEPS_DIR)/glslang/glslang/glslang/MachineIndependent/preprocessor/PpContext.cpp \ - $(DEPS_DIR)/glslang/glslang/glslang/MachineIndependent/preprocessor/PpMemory.cpp \ - $(DEPS_DIR)/glslang/glslang/glslang/MachineIndependent/preprocessor/PpTokens.cpp \ - $(DEPS_DIR)/glslang/glslang/glslang/MachineIndependent/preprocessor/PpScanner.cpp \ - $(DEPS_DIR)/glslang/glslang/glslang/MachineIndependent/preprocessor/PpSymbols.cpp \ - $(DEPS_DIR)/glslang/glslang/glslang/MachineIndependent/preprocessor/Pp.cpp \ - $(DEPS_DIR)/glslang/glslang/glslang/OSDependent/Unix/ossource.cpp +LOCAL_SRC_FILES += $(RARCH_DIR)/griffin/griffin_glslang.cpp endif LOCAL_LDLIBS += -lOpenSLES -lz diff --git a/pkg/emscripten/README.md b/pkg/emscripten/README.md index 7fd125a155..db403bb029 100644 --- a/pkg/emscripten/README.md +++ b/pkg/emscripten/README.md @@ -4,48 +4,16 @@ Most of the magic happens on the browser so nothing really on that regard I you want a self hosted version you need -- A web server, nginx/apache will do, unzip a nightly here: +- A web server, nginx/apache will do, download a build here: https://buildbot.libretro.com/nightly/emscripten/ -- Move the template files from the embed folder to the top level dir, - the other templates are for specific sites -- A SSL certificate if you want to integrate with dropbox -- A dropbox application, you can't use ours on a self hosted version +- Extract the build somewher ein your web-server + - Grab the asset bundle: + https://buildbot.libretro.com/assets/frontend/bundle.zip +- Unzip it in the same dir you extracted the rest, inside **/assets/frontend/bundle** +- Create an **assets/cores** dir, you can put game data in that dir so it's available under **downloads** +- chmod +x the indexer script +- run the indexer script (you need coffeescript) like this: ./indexer ./assets/frontend > ./assets/frontend/.index-xhr +- run the indexer script (you need coffeescript) like this: ./indexer ./assets/cores > ./assets/cores/.index-xhr -If you want assets for XMB, shaders, overlays you need to do the following: -- Grab the asset bundle: - https://bot.libretro.com/assets/frontend/bundle.zip -- Unzip it somewhere in your web server -- Generate an index of the folder with this script, save it inside the folder you want to serve - https://github.com/jvilk/BrowserFS/blob/master/tools/XHRIndexer.coffee -- Add the mount in the setupFileSystem function, look for the xfs blocks and - unconmment them and tweak them accordingly +That should be it, you can add more cores to the list by editing index.html -If you want to add your game directory so it serves content to your users you -need to do the following: -- Add the dir to your web server -- Generate an index with this script, save it inside the folder you want to serve - https://github.com/jvilk/BrowserFS/blob/master/tools/XHRIndexer.coffee -- Add a new mount in the setupFileSystem function, look for the xfs blocks and - unconmment them and tweak them accordingly - -```javascript - /* create an XmlHttpRequest filesystem for the bundled data */ - /* --> uncomment this if you want builtin assets for XMB, overlays, etc.*/ - var xfs1 = new BrowserFS.FileSystem.XmlHttpRequest - ("--your-assets-index-file-name--", "--your-index-url--"); - - /* create an XmlHttpRequest filesystem for content */ - /* --> uncomment this if you want to serve content.*/ - var xfs2 = new BrowserFS.FileSystem.XmlHttpRequest - ("--your-content-index-file-name--", "--your-index-url--"); - - - // lots and lots of code - // and then - - /* - mfs.mount('/home/web_user/retroarch/bundle', xfs1); - mfs.mount('/home/web_user/retroarch/userdata/content/', xfs2); - */ -} -``` \ No newline at end of file diff --git a/pkg/emscripten/libretro/browserfs.min.js b/pkg/emscripten/libretro/browserfs.min.js new file mode 100644 index 0000000000..181710b74a --- /dev/null +++ b/pkg/emscripten/libretro/browserfs.min.js @@ -0,0 +1,10 @@ +!function(a){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=a();else if("function"==typeof define&&define.amd)define([],a);else{var b;b="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,b.BrowserFS=a()}}(function(){var a;return function a(b,c,d){function e(g,h){if(!c[g]){if(!b[g]){var i="function"==typeof require&&require;if(!h&&i)return i(g,!0);if(f)return f(g,!0);var j=new Error("Cannot find module '"+g+"'");throw j.code="MODULE_NOT_FOUND",j}var k=c[g]={exports:{}};b[g][0].call(k.exports,function(a){var c=b[g][1][a];return e(c?c:a)},k,k.exports,a,b,c,d)}return c[g].exports}for(var f="function"==typeof require&&require,g=0;g-1&&a%1==0&&a<=Bb}function q(a){return null!=a&&p(Ab(a))&&!f(a)}function r(){}function s(a){return function(){if(null!==a){var b=a;a=null,b.apply(this,arguments)}}}function t(a){return Cb&&a[Cb]&&a[Cb]()}function u(a){return Db(Object(a))}function v(a,b){return null!=a&&(Fb.call(a,b)||"object"==typeof a&&b in a&&null===u(a))}function w(a){return Gb(Object(a))}function x(a,b){for(var c=-1,d=Array(a);++c-1&&a%1==0&&a0&&(c=b.apply(this,arguments)),a<=1&&(b=void 0),c}}function O(a){return N(2,a)}function P(a,b,c){function d(a){a?c(a):++f===g&&c(null)}c=O(c||r);var e=0,f=0,g=a.length;for(0===g&&c(null);e1?e(n,d):e(d)}}function i(){for(var a,b=0;u.length;)a=u.pop(),b++,V(j(a),function(a){0===--v[a]&&u.push(a)});if(b!==m)throw new Error("async.auto cannot execute tasks due to a recursive dependency")}function j(b){var c=[];return X(a,function(a,d){Mb(a)&&Z(a,b,0)>=0&&c.push(d)}),c}"function"==typeof b&&(c=b,b=null),c=s(c||r);var k=E(a),m=k.length;if(!m)return c(null);b||(b=m);var n={},o=0,p=!1,q={},t=[],u=[],v={};X(a,function(b,c){if(!Mb(b))return d(c,[b]),void u.push(c);var e=b.slice(0,b.length-1),g=e.length;return 0===g?(d(c,b),void u.push(c)):(v[c]=g,void V(e,function(h){if(!a[h])throw new Error("async.auto task `"+c+"` has a non-existent dependency in "+e.join(", "));f(h,function(){g--,0===g&&d(c,b)})}))}),i(),e()}function _(a,b){for(var c=-1,d=a?a.length:0,e=Array(d);++ce?0:e+b),c=c>e?e:c,c<0&&(c+=e),e=b>c?0:c-b>>>0,b>>>=0;for(var f=Array(e);++d=d?a:da(a,b,c)}function fa(a,b){for(var c=a.length;c--&&Z(b,a[c],0)>-1;);return c}function ga(a,b){for(var c=-1,d=a.length;++c-1;);return c}function ha(a){return a.match(zc)}function ia(a){return null==a?"":ca(a)}function ja(a,b,c){if(a=ia(a),a&&(c||void 0===b))return a.replace(Ac,"");if(!a||!(b=ca(b)))return a;var d=ha(a),e=ha(b),f=ga(d,e),g=fa(d,e)+1;return ea(d,f,g).join("")}function ka(a){return a=a.toString().replace(Ec,""),a=a.match(Bc)[2].replace(" ",""),a=a?a.split(Cc):[],a=a.map(function(a){return ja(a.replace(Dc,""))})}function la(a,b){var c={};X(a,function(a,b){function d(b,c){var d=_(e,function(a){return b[a]});d.push(c),a.apply(null,d)}var e;if(Mb(a))e=aa(a),a=e.pop(),c[b]=e.concat(e.length>0?d:a);else if(1===a.length)c[b]=a;else{if(e=ka(a),0===a.length&&0===e.length)throw new Error("autoInject task functions require explicit parameters.");e.pop(),c[b]=e.concat(d)}}),$(c,b)}function ma(a){setTimeout(a,0)}function na(a){return l(function(b,c){a(function(){b.apply(null,c)})})}function oa(){this.head=this.tail=null,this.length=0}function pa(a,b){a.length=1,a.head=a.tail=b}function qa(a,b,c){function d(a,b,c){if(null!=c&&"function"!=typeof c)throw new Error("task callback must be a function");return h.started=!0,Mb(a)||(a=[a]),0===a.length&&h.idle()?Hc(function(){h.drain()}):(V(a,function(a){var d={data:a,callback:c||r};b?h._tasks.unshift(d):h._tasks.push(d)}),void Hc(h.process))}function e(a){return l(function(b){f-=1,V(a,function(a){V(g,function(b,c){if(b===a)return g.splice(c,1),!1}),a.callback.apply(a,b),null!=b[0]&&h.error(b[0],a.data)}),f<=h.concurrency-h.buffer&&h.unsaturated(),h.idle()&&h.drain(),h.process()})}if(null==b)b=1;else if(0===b)throw new Error("Concurrency must not be zero");var f=0,g=[],h={_tasks:new oa,concurrency:b,payload:c,saturated:r,unsaturated:r,buffer:b/4,empty:r,drain:r,error:r,started:!1,paused:!1,push:function(a,b){d(a,!1,b)},kill:function(){h.drain=r,h._tasks.empty()},unshift:function(a,b){d(a,!0,b)},process:function(){for(;!h.paused&&f3?(g=g||r,a(d,e,i,h)):(g=f,g=g||r,f=e,a(d,i,h))}}function xa(a,b){return b}function ya(a){return l(function(b,c){b.apply(null,c.concat([l(function(b,c){"object"==typeof console&&(b?console.error&&console.error(b):console[a]&&V(c,function(b){console[a](b)}))})]))})}function za(a,b,c){function d(b,d){return b?c(b):d?void a(e):c(null)}c=J(c||r);var e=l(function(a,e){return a?c(a):(e.push(d),void b.apply(this,e))});d(null,!0)}function Aa(a,b,c){c=J(c||r);var d=l(function(e,f){return e?c(e):b.apply(this,f)?a(d):void c.apply(null,[null].concat(f))});a(d)}function Ba(a,b,c){Aa(a,function(){return!b.apply(this,arguments)},c)}function Ca(a,b,c){function d(b){return b?c(b):void a(e)}function e(a,e){return a?c(a):e?void b(d):c(null)}c=J(c||r),a(e)}function Da(a){return function(b,c,d){return a(b,d)}}function Ea(a,b,c){Q(a,Da(b),c)}function Fa(a,b,c,d){K(b)(a,Da(c),d)}function Ga(a){return m(function(b,c){var d=!0;b.push(function(){var a=arguments;d?Hc(function(){c.apply(null,a)}):c.apply(null,a)}),a.apply(this,b),d=!1})}function Ha(a){return!a}function Ia(a,b,c,d){d=s(d||r);var e=[];a(b,function(a,b,d){c(a,function(c,f){c?d(c):(f&&e.push({index:b,value:a}),d())})},function(a){a?d(a):d(null,_(e.sort(function(a,b){return a.index-b.index}),o("value")))})}function Ja(a,b){function c(a){return a?d(a):void e(c)}var d=J(b||r),e=Ga(a);c()}function Ka(a,b,c,d){d=s(d||r);var e={};L(a,b,function(a,b,d){c(a,b,function(a,c){return a?d(a):(e[b]=c,void d())})},function(a){d(a,e)})}function La(a,b){return b in a}function Ma(a,b){var c=Object.create(null),d=Object.create(null);b=b||va;var e=m(function(e,f){var g=b.apply(null,e);La(c,g)?Hc(function(){f.apply(null,c[g])}):La(d,g)?d[g].push(f):(d[g]=[f],a.apply(null,e.concat([l(function(a){c[g]=a;var b=d[g];delete d[g];for(var e=0,f=b.length;e=e.priority;)e=e.next;V(a,function(a){var f={data:a,priority:b,callback:d};e?c._tasks.insertBefore(e,f):c._tasks.push(f)}),Hc(c.process)},delete c.unshift,c}function Sa(a,b){return b=s(b||r),Mb(a)?a.length?void V(a,function(a){a(b)}):b():b(new TypeError("First argument to race must be an array of functions"))}function Ta(a,b,c,d){var e=cd.call(a).reverse();sa(e,b,c,d)}function Ua(a){return m(function(b,c){return b.push(l(function(a,b){if(a)c(null,{error:a});else{var d=null;1===b.length?d=b[0]:b.length>1&&(d=b),c(null,{value:d})}})),a.apply(this,b)})}function Va(a,b,c,d){Ia(a,b,function(a,b){c(a,function(a,c){a?b(a):b(null,!c)})},d)}function Wa(a){var b;return Mb(a)?b=_(a,Ua):(b={},X(a,function(a,c){b[c]=Ua.call(this,a)})),b}function Xa(a){return function(){return a}}function Ya(a,b,c){function d(a,b){if("object"==typeof b)a.times=+b.times||f,a.intervalFunc="function"==typeof b.interval?b.interval:Xa(+b.interval||g);else{if("number"!=typeof b&&"string"!=typeof b)throw new Error("Invalid arguments for async.retry");a.times=+b||f}}function e(){b(function(a){a&&i++d?1:0}Vb(a,function(a,c){b(a,function(b,d){return b?c(b):void c(null,{value:a,criteria:d})})},function(a,b){return a?c(a):void c(null,_(b.sort(d),o("value")))})}function ab(a,b,c){function d(){h||(f.apply(null,arguments),clearTimeout(g))}function e(){var b=a.name||"anonymous",d=new Error('Callback function "'+b+'" timed out.');d.code="ETIMEDOUT",c&&(d.info=c),h=!0,f(d)}var f,g,h=!1;return m(function(c,h){f=h,g=setTimeout(e,b),a.apply(null,c.concat(d))})}function bb(a,b,c,d){for(var e=-1,f=kd(jd((b-a)/(c||1)),0),g=Array(f);f--;)g[d?f:++e]=a,a+=c;return g}function cb(a,b,c,d){Xb(bb(0,a,1),b,c,d)}function db(a,b,c,d){3===arguments.length&&(d=c,c=b,b=Mb(a)?[]:{}),d=s(d||r),Q(a,function(a,d,e){c(b,a,d,e)},function(a){d(a,b)})}function eb(a){return function(){return(a.unmemoized||a).apply(null,arguments)}}function fb(a,b,c){if(c=J(c||r),!a())return c(null);var d=l(function(e,f){return e?c(e):a()?b(d):void c.apply(null,[null].concat(f))});b(d)}function gb(a,b,c){fb(function(){return!a.apply(this,arguments)},b,c)}function hb(a,b){function c(e){if(d===a.length)return b.apply(null,[null].concat(e));var f=J(l(function(a,d){return a?b.apply(null,[a].concat(d)):void c(d)}));e.push(f);var g=a[d++];g.apply(null,e)}if(b=s(b||r),!Mb(a))return b(new Error("First argument to waterfall must be an array of functions"));if(!a.length)return b();var d=0;c([])}var ib,jb="[object Function]",kb="[object GeneratorFunction]",lb=Object.prototype,mb=lb.toString,nb="[object Symbol]",ob=Object.prototype,pb=ob.toString,qb=NaN,rb=/^\s+|\s+$/g,sb=/^[-+]0x[0-9a-f]+$/i,tb=/^0b[01]+$/i,ub=/^0o[0-7]+$/i,vb=parseInt,wb=1/0,xb=1.7976931348623157e308,yb="Expected a function",zb=Math.max,Ab=o("length"),Bb=9007199254740991,Cb="function"==typeof Symbol&&Symbol.iterator,Db=Object.getPrototypeOf,Eb=Object.prototype,Fb=Eb.hasOwnProperty,Gb=Object.keys,Hb="[object Arguments]",Ib=Object.prototype,Jb=Ib.hasOwnProperty,Kb=Ib.toString,Lb=Ib.propertyIsEnumerable,Mb=Array.isArray,Nb="[object String]",Ob=Object.prototype,Pb=Ob.toString,Qb=9007199254740991,Rb=/^(?:0|[1-9]\d*)$/,Sb=Object.prototype,Tb="Expected a function",Ub=M(L,1/0),Vb=R(S),Wb=n(Vb),Xb=T(S),Yb=M(Xb,1),Zb=n(Yb),$b=l(function(a,b){return l(function(c){return a.apply(null,b.concat(c))})}),_b=W(),ac=ba("object"==typeof e&&e),bc=ba("object"==typeof self&&self),cc=ba("object"==typeof this&&this),dc=ac||bc||cc||Function("return this")(),ec=dc.Symbol,fc=1/0,gc=ec?ec.prototype:void 0,hc=gc?gc.toString:void 0,ic="\\ud800-\\udfff",jc="\\u0300-\\u036f\\ufe20-\\ufe23",kc="\\u20d0-\\u20f0",lc="\\ufe0e\\ufe0f",mc="["+ic+"]",nc="["+jc+kc+"]",oc="\\ud83c[\\udffb-\\udfff]",pc="(?:"+nc+"|"+oc+")",qc="[^"+ic+"]",rc="(?:\\ud83c[\\udde6-\\uddff]){2}",sc="[\\ud800-\\udbff][\\udc00-\\udfff]",tc="\\u200d",uc=pc+"?",vc="["+lc+"]?",wc="(?:"+tc+"(?:"+[qc,rc,sc].join("|")+")"+vc+uc+")*",xc=vc+uc+wc,yc="(?:"+[qc+nc+"?",nc,rc,sc,mc].join("|")+")",zc=RegExp(oc+"(?="+oc+")|"+yc+xc,"g"),Ac=/^\s+|\s+$/g,Bc=/^(function)?\s*[^\(]*\(\s*([^\)]*)\)/m,Cc=/,/,Dc=/(=.+)?(\s*)$/,Ec=/((\/\/.*$)|(\/\*[\s\S]*?\*\/))/gm,Fc="function"==typeof setImmediate&&setImmediate,Gc="object"==typeof b&&"function"==typeof b.nextTick;ib=Fc?setImmediate:Gc?b.nextTick:ma;var Hc=na(ib);oa.prototype.removeLink=function(a){return a.prev?a.prev.next=a.next:this.head=a.next,a.next?a.next.prev=a.prev:this.tail=a.prev,a.prev=a.next=null,this.length-=1,a},oa.prototype.empty=oa,oa.prototype.insertAfter=function(a,b){b.prev=a,b.next=a.next,a.next?a.next.prev=b:this.tail=b,a.next=b,this.length+=1},oa.prototype.insertBefore=function(a,b){b.prev=a.prev,b.next=a,a.prev?a.prev.next=b:this.head=b,a.prev=b,this.length+=1},oa.prototype.unshift=function(a){this.head?this.insertBefore(this.head,a):pa(this,a)},oa.prototype.push=function(a){this.tail?this.insertAfter(this.tail,a):pa(this,a)},oa.prototype.shift=function(){return this.head&&this.removeLink(this.head)},oa.prototype.pop=function(){return this.tail&&this.removeLink(this.tail)};var Ic,Jc=M(L,1),Kc=l(function(a){return l(function(b){var c=this,d=b[b.length-1];"function"==typeof d?b.pop():d=r,sa(a,b,function(a,b,d){b.apply(c,a.concat([l(function(a,b){d(a,b)})]))},function(a,b){d.apply(c,[a].concat(b))})})}),Lc=l(function(a){return Kc.apply(null,a.reverse())}),Mc=R(ta),Nc=ua(ta),Oc=l(function(a){var b=[null].concat(a);return m(function(a,c){return c.apply(this,b)})}),Pc=wa(Q,va,xa),Qc=wa(L,va,xa),Rc=wa(Jc,va,xa),Sc=ya("dir"),Tc=M(Fa,1),Uc=wa(Q,Ha,Ha),Vc=wa(L,Ha,Ha),Wc=M(Vc,1),Xc=R(Ia),Yc=T(Ia),Zc=M(Yc,1),$c=ya("log"),_c=M(Ka,1/0),ad=M(Ka,1);Ic=Gc?b.nextTick:Fc?setImmediate:ma;var bd=na(Ic),cd=Array.prototype.slice,dd=R(Va),ed=T(Va),fd=M(ed,1),gd=wa(Q,Boolean,va),hd=wa(L,Boolean,va),id=M(hd,1),jd=Math.ceil,kd=Math.max,ld=M(cb,1/0),md=M(cb,1),nd={applyEach:Wb,applyEachSeries:Zb,apply:$b,asyncify:U,auto:$,autoInject:la,cargo:ra,compose:Lc,concat:Mc,concatSeries:Nc,constant:Oc,detect:Pc,detectLimit:Qc,detectSeries:Rc,dir:Sc,doDuring:za,doUntil:Ba,doWhilst:Aa,during:Ca,each:Ea,eachLimit:Fa,eachOf:Q,eachOfLimit:L,eachOfSeries:Jc,eachSeries:Tc,ensureAsync:Ga,every:Uc,everyLimit:Vc,everySeries:Wc,filter:Xc,filterLimit:Yc,filterSeries:Zc,forever:Ja,log:$c,map:Vb,mapLimit:Xb,mapSeries:Yb,mapValues:_c,mapValuesLimit:Ka,mapValuesSeries:ad,memoize:Ma,nextTick:bd,parallel:Oa,parallelLimit:Pa,priorityQueue:Ra,queue:Qa,race:Sa,reduce:sa,reduceRight:Ta,reflect:Ua,reflectAll:Wa,reject:dd,rejectLimit:ed,rejectSeries:fd,retry:Ya,retryable:Za,seq:Kc,series:$a,setImmediate:Hc,some:gd,someLimit:hd,someSeries:id,sortBy:_a,timeout:ab,times:ld,timesLimit:cb,timesSeries:md,transform:db,unmemoize:eb,until:gb,waterfall:hb,whilst:fb,all:Uc,any:gd,forEach:Ea,forEachSeries:Tc,forEachLimit:Fa,forEachOf:Q,forEachOfSeries:Jc,forEachOfLimit:L,inject:sa,foldl:sa,foldr:Ta,select:Xc,selectLimit:Yc,selectSeries:Zc,wrapSync:U};a.default=nd,a.applyEach=Wb,a.applyEachSeries=Zb,a.apply=$b,a.asyncify=U,a.auto=$,a.autoInject=la,a.cargo=ra,a.compose=Lc,a.concat=Mc,a.concatSeries=Nc,a.constant=Oc,a.detect=Pc,a.detectLimit=Qc,a.detectSeries=Rc,a.dir=Sc,a.doDuring=za,a.doUntil=Ba,a.doWhilst=Aa,a.during=Ca,a.each=Ea,a.eachLimit=Fa,a.eachOf=Q,a.eachOfLimit=L,a.eachOfSeries=Jc,a.eachSeries=Tc,a.ensureAsync=Ga,a.every=Uc,a.everyLimit=Vc,a.everySeries=Wc,a.filter=Xc,a.filterLimit=Yc,a.filterSeries=Zc,a.forever=Ja,a.log=$c,a.map=Vb,a.mapLimit=Xb,a.mapSeries=Yb,a.mapValues=_c,a.mapValuesLimit=Ka,a.mapValuesSeries=ad,a.memoize=Ma,a.nextTick=bd,a.parallel=Oa,a.parallelLimit=Pa,a.priorityQueue=Ra,a.queue=Qa,a.race=Sa,a.reduce=sa,a.reduceRight=Ta,a.reflect=Ua,a.reflectAll=Wa,a.reject=dd,a.rejectLimit=ed,a.rejectSeries=fd,a.retry=Ya,a.retryable=Za,a.seq=Kc,a.series=$a,a.setImmediate=Hc,a.some=gd,a.someLimit=hd,a.someSeries=id,a.sortBy=_a,a.timeout=ab,a.times=ld,a.timesLimit=cb,a.timesSeries=md,a.transform=db,a.unmemoize=eb,a.until=gb,a.waterfall=hb,a.whilst=fb,a.all=Uc,a.allLimit=Vc,a.allSeries=Wc,a.any=gd,a.anyLimit=hd,a.anySeries=id,a.find=Pc,a.findLimit=Qc,a.findSeries=Rc,a.forEach=Ea,a.forEachSeries=Tc,a.forEachLimit=Fa,a.forEachOf=Q,a.forEachOfSeries=Jc,a.forEachOfLimit=L,a.inject=sa,a.foldl=sa,a.foldr=Ta,a.select=Xc,a.selectLimit=Yc,a.selectSeries=Zc,a.wrapSync=U})}).call(this,b("bfs-process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"bfs-process":11}],2:[function(a,b,c){"use strict";function d(a,b,c,d,e,f){if(b>e||ba.length)throw new RangeError("index out of range")}function e(a,b,c,d){if(c+d>a.length)throw new RangeError("index out of range")}function f(a,b,c){if(a+b>c)throw new RangeError("index out of range")}var g=this&&this.__extends||function(a,b){function c(){this.constructor=a}for(var d in b)b.hasOwnProperty(d)&&(a[d]=b[d]);a.prototype=null===b?Object.create(b):(c.prototype=b.prototype,new c)},h=a("./buffer_core"),i=a("./buffer_core_array"),j=a("./buffer_core_arraybuffer"),k=a("./buffer_core_imagedata"),l=a("./string_util"),m=a("./util"),n=[j,k,i],o=function(){var a,b;for(a=0;a>>0)throw new RangeError("Buffer size must be a uint32.");this.length=b,this.data=new o(b)}else if(m.isArrayBufferView(b))this.data=new j(b),this.length=b.byteLength;else if(m.isArrayBuffer(b))this.data=new j(b),this.length=b.byteLength;else if(b instanceof a){var i=b;this.data=new o(b.length),this.length=b.length,i.copy(this)}else if(Array.isArray(b)||null!=b&&"object"==typeof b&&"number"==typeof b[0]){for(this.data=new o(b.length),e=0;ethis.length||c<0)throw new RangeError("Invalid offset.");var f=l.FindUtil(e);return d=d+c>this.length?this.length-c:d,c+=this.offset,f.str2byte(b,0===c&&d===this.length?this:new a(this.data,c,d+c))},a.prototype.toString=function(b,c,d){if(void 0===b&&(b="utf8"),void 0===c&&(c=0),void 0===d&&(d=this.length),!(c<=d))throw new Error("Invalid start/end positions: "+c+" - "+d);if(c===d)return"";d>this.length&&(d=this.length);var e=l.FindUtil(b);return e.byte2str(0===c&&d===this.length?this:new a(this.data,c+this.offset,d+this.offset))},a.prototype.toJSON=function(){for(var a=this.length,b=new Array(a),c=0;cd?" ... ":"")+">"},a.prototype.toArrayBuffer=function(){var b=this.getBufferCore();if(b instanceof j){var c=b.getDataView(),d=c.buffer;return 0===this.offset&&0===c.byteOffset&&c.byteLength===d.byteLength&&this.length===c.byteLength?d:d.slice(this.offset+c.byteOffset,this.length)}var d=new ArrayBuffer(this.length),e=new a(d);return this.copy(e,0,0,this.length),d},a.prototype.toUint8Array=function(){var b=this.getBufferCore();if(b instanceof j){var c=b.getDataView(),d=c.buffer,e=this.offset+c.byteOffset,f=this.length;return new Uint8Array(d).subarray(e,e+f)}var d=new ArrayBuffer(this.length),g=new a(d);return this.copy(g,0,0,this.length),new Uint8Array(d)},a.prototype.indexOf=function(b,c){void 0===c&&(c=0);var d;if("string"==typeof b)d=new a(b,"utf8");else if(a.isBuffer(b))d=b;else{if("number"!=typeof b)throw new TypeError("indexOf only operates on strings, buffers, and numbers.");d=new a([b])}c>2147483647?c=2147483647:c<-2147483648&&(c=-2147483648),c>>=0,c<0&&(c=this.length+c,c<0&&(c=0));var e=0,f=d.length,g=this.length;if(0===f)return-1;for(;e=this.length||c>b.length)return 0;var f=Math.min(e-d,b.length-c,this.length-d);if(b instanceof a&&this.data instanceof j){var g=b.getBufferCore();if(g instanceof j)return this.data.copyTo(g,c+b.offset,d+this.offset,d+f+this.offset)}for(var h=0;h>=0,c>>=0,b<0&&(b+=this.length,b<0&&(b=0)),c<0&&(c+=this.length,c<0&&(c=0)),c>this.length&&(c=this.length),b>c&&(b=c),b<0||c<0||b>this.length||c>this.length)throw new Error("Invalid slice indices.");return new a(this.data,b+this.offset,c+this.offset)},a.prototype.sliceCopy=function(b,c){if(void 0===b&&(b=0),void 0===c&&(c=this.length),b<0&&(b+=this.length,b<0&&(b=0)),c<0&&(c+=this.length,c<0&&(c=0)),c>this.length&&(c=this.length),b>c&&(b=c),b<0||c<0||b>=this.length||c>this.length)throw new Error("Invalid slice indices.");return new a(this.data.copy(b+this.offset,c+this.offset))},a.prototype.fill=function(b,c,d){void 0===c&&(c=0),void 0===d&&(d=this.length);if(c>>=0,d>>=0,c<0||d>this.length)throw new RangeError("out of range index");if(d<=c)return this;if("string"!=typeof b)b>>>=0;else if(1===b.length){var e=b.charCodeAt(0);e<256&&(b=e)}if("number"==typeof b)c+=this.offset,d+=this.offset,this.data.fill(b,c,d);else if(b.length>0){for(var f=a.byteLength(b,"utf8"),g=d-f;c>>=0,b>>>=0,c||f(a,b,this.length),a+=this.offset;var d=0;switch(b){case 1:return this.data.readUInt8(a);case 2:return this.data.readUInt16LE(a);case 3:return this.data.readUInt8(a)|this.data.readUInt16LE(a+1)<<8;case 4:return this.data.readUInt32LE(a);case 6:d+=131072*(this.data.readUInt8(a+5)<<23);case 5:return d+=512*(this.data.readUInt8(a+4)<<23),d+this.data.readUInt32LE(a);default:throw new Error("Invalid byteLength: "+b)}},a.prototype.readUIntBE=function(a,b,c){void 0===c&&(c=!1),a>>>=0,b>>>=0,c||f(a,b,this.length),a+=this.offset;var d=0;switch(b){case 1:return this.data.readUInt8(a);case 2:return this.data.readUInt16BE(a);case 3:return this.data.readUInt8(a+2)|this.data.readUInt16BE(a)<<8;case 4:return this.data.readUInt32BE(a);case 6:d+=131072*(this.data.readUInt8(a)<<23),a++;case 5:return d+=512*(this.data.readUInt8(a)<<23),d+this.data.readUInt32BE(a+1);default:throw new Error("Invalid byteLength: "+b)}},a.prototype.readIntLE=function(a,b,c){switch(void 0===c&&(c=!1),a>>>=0,b>>>=0,c||f(a,b,this.length),a+=this.offset,b){case 1:return this.data.readInt8(a);case 2:return this.data.readInt16LE(a);case 3:return this.data.readUInt8(a)|this.data.readInt16LE(a+1)<<8;case 4:return this.data.readInt32LE(a);case 6:return 131072*(this.data.readInt8(a+5)<<23)+this.readUIntLE(a-this.offset,5,c);case 5:return 512*(this.data.readInt8(a+4)<<23)+this.data.readUInt32LE(a);default:throw new Error("Invalid byteLength: "+b)}},a.prototype.readIntBE=function(a,b,c){switch(void 0===c&&(c=!1),a>>>=0,b>>>=0,c||f(a,b,this.length),a+=this.offset,b){case 1:return this.data.readInt8(a);case 2:return this.data.readInt16BE(a);case 3:return this.data.readUInt8(a+2)|this.data.readInt16BE(a)<<8;case 4:return this.data.readInt32BE(a);case 6:return 131072*(this.data.readInt8(a)<<23)+this.readUIntBE(a-this.offset+1,5,c);case 5:return 512*(this.data.readInt8(a)<<23)+this.data.readUInt32BE(a+1);default:throw new Error("Invalid byteLength: "+b)}},a.prototype.readUInt8=function(a,b){return void 0===b&&(b=!1),a>>>=0,b||f(a,1,this.length),a+=this.offset,this.data.readUInt8(a)},a.prototype.readUInt16LE=function(a,b){return void 0===b&&(b=!1),a>>>=0,b||f(a,2,this.length),a+=this.offset,this.data.readUInt16LE(a)},a.prototype.readUInt16BE=function(a,b){return void 0===b&&(b=!1),a>>>=0,b||f(a,2,this.length),a+=this.offset,this.data.readUInt16BE(a)},a.prototype.readUInt32LE=function(a,b){return void 0===b&&(b=!1),a>>>=0,b||f(a,4,this.length),a+=this.offset,this.data.readUInt32LE(a)},a.prototype.readUInt32BE=function(a,b){return void 0===b&&(b=!1),a>>>=0,b||f(a,4,this.length),a+=this.offset,this.data.readUInt32BE(a)},a.prototype.readInt8=function(a,b){return void 0===b&&(b=!1),a>>>=0,b||f(a,1,this.length),a+=this.offset,this.data.readInt8(a)},a.prototype.readInt16LE=function(a,b){return void 0===b&&(b=!1),a>>>=0,b||f(a,2,this.length),a+=this.offset,this.data.readInt16LE(a)},a.prototype.readInt16BE=function(a,b){return void 0===b&&(b=!1),a>>>=0,b||f(a,2,this.length),a+=this.offset,this.data.readInt16BE(a)},a.prototype.readInt32LE=function(a,b){return void 0===b&&(b=!1),a>>>=0,b||f(a,4,this.length),a+=this.offset,this.data.readInt32LE(a)},a.prototype.readInt32BE=function(a,b){return void 0===b&&(b=!1),a>>>=0,b||f(a,4,this.length),a+=this.offset,this.data.readInt32BE(a)},a.prototype.readFloatLE=function(a,b){return void 0===b&&(b=!1),a>>>=0, +b||f(a,4,this.length),a+=this.offset,this.data.readFloatLE(a)},a.prototype.readFloatBE=function(a,b){return void 0===b&&(b=!1),a>>>=0,b||f(a,4,this.length),a+=this.offset,this.data.readFloatBE(a)},a.prototype.readDoubleLE=function(a,b){return void 0===b&&(b=!1),a>>>=0,b||f(a,8,this.length),a+=this.offset,this.data.readDoubleLE(a)},a.prototype.readDoubleBE=function(a,b){return void 0===b&&(b=!1),a>>>=0,b||f(a,8,this.length),a+=this.offset,this.data.readDoubleBE(a)},a.prototype.writeUIntLE=function(a,b,c,e){void 0===e&&(e=!1),b>>>=0,e||d(this,a,b,c,r[c],0);var f=b+c;switch(b+=this.offset,c){case 1:this.data.writeUInt8(b,a);break;case 2:this.data.writeUInt16LE(b,a);break;case 3:this.data.writeUInt8(b,255&a),this.data.writeUInt16LE(b+1,a>>8);break;case 4:this.data.writeUInt32LE(b,a);break;case 6:this.data.writeUInt8(b,255&a),a=Math.floor(a/256),b++;case 5:this.data.writeUInt8(b,255&a),a=Math.floor(a/256),this.data.writeUInt32LE(b+1,a);break;default:throw new Error("Invalid byteLength: "+c)}return f},a.prototype.writeUIntBE=function(a,b,c,e){void 0===e&&(e=!1),b>>>=0,e||d(this,a,b,c,r[c],0);var f=b+c;switch(b+=this.offset,c){case 1:this.data.writeUInt8(b,a);break;case 2:this.data.writeUInt16BE(b,a);break;case 3:this.data.writeUInt8(b+2,255&a),this.data.writeUInt16BE(b,a>>8);break;case 4:this.data.writeUInt32BE(b,a);break;case 6:this.data.writeUInt8(b+5,255&a),a=Math.floor(a/256);case 5:this.data.writeUInt8(b+4,255&a),a=Math.floor(a/256),this.data.writeUInt32BE(b,a);break;default:throw new Error("Invalid byteLength: "+c)}return f},a.prototype.writeIntLE=function(a,b,c,e){void 0===e&&(e=!1),b>>>=0,e||d(this,a,b,c,p[c],q[c]);var f=b+c;switch(b+=this.offset,c){case 1:this.data.writeInt8(b,a);break;case 2:this.data.writeInt16LE(b,a);break;case 3:this.data.writeUInt8(b,255&a),this.data.writeInt16LE(b+1,a>>8);break;case 4:this.data.writeInt32LE(b,a);break;case 6:this.data.writeUInt8(b,255&a),a=Math.floor(a/256),b++;case 5:this.data.writeUInt8(b,255&a),a=Math.floor(a/256),this.data.writeInt32LE(b+1,a);break;default:throw new Error("Invalid byteLength: "+c)}return f},a.prototype.writeIntBE=function(a,b,c,e){void 0===e&&(e=!1),b>>>=0,e||d(this,a,b,c,p[c],q[c]);var f=b+c;switch(b+=this.offset,c){case 1:this.data.writeInt8(b,a);break;case 2:this.data.writeInt16BE(b,a);break;case 3:this.data.writeUInt8(b+2,255&a),this.data.writeInt16BE(b,a>>8);break;case 4:this.data.writeInt32BE(b,a);break;case 6:this.data.writeUInt8(b+5,255&a),a=Math.floor(a/256);case 5:this.data.writeUInt8(b+4,255&a),a=Math.floor(a/256),this.data.writeInt32BE(b,a);break;default:throw new Error("Invalid byteLength: "+c)}return f},a.prototype.writeUInt8=function(a,b,c){return void 0===c&&(c=!1),b>>>=0,c||d(this,a,b,1,255,0),this.data.writeUInt8(b+this.offset,a),b+1},a.prototype.writeUInt16LE=function(a,b,c){return void 0===c&&(c=!1),b>>>=0,c||d(this,a,b,2,65535,0),this.data.writeUInt16LE(b+this.offset,a),b+2},a.prototype.writeUInt16BE=function(a,b,c){return void 0===c&&(c=!1),b>>>=0,c||d(this,a,b,2,65535,0),this.data.writeUInt16BE(b+this.offset,a),b+2},a.prototype.writeUInt32LE=function(a,b,c){return void 0===c&&(c=!1),b>>>=0,c||d(this,a,b,4,4294967295,0),this.data.writeUInt32LE(b+this.offset,a),b+4},a.prototype.writeUInt32BE=function(a,b,c){return void 0===c&&(c=!1),b>>>=0,c||d(this,a,b,4,4294967295,0),this.data.writeUInt32BE(b+this.offset,a),b+4},a.prototype.writeInt8=function(a,b,c){return void 0===c&&(c=!1),b>>>=0,c||d(this,a,b,1,127,-128),this.data.writeInt8(b+this.offset,a),b+1},a.prototype.writeInt16LE=function(a,b,c){return void 0===c&&(c=!1),b>>>=0,c||d(this,a,b,2,32767,-32768),this.data.writeInt16LE(b+this.offset,a),b+2},a.prototype.writeInt16BE=function(a,b,c){return void 0===c&&(c=!1),b>>>=0,c||d(this,a,b,2,32767,-32768),this.data.writeInt16BE(b+this.offset,a),b+2},a.prototype.writeInt32LE=function(a,b,c){return void 0===c&&(c=!1),b>>>=0,c||d(this,a,b,4,2147483647,-2147483648),this.data.writeInt32LE(b+this.offset,a),b+4},a.prototype.writeInt32BE=function(a,b,c){return void 0===c&&(c=!1),b>>>=0,c||d(this,a,b,4,2147483647,-2147483648),this.data.writeInt32BE(b+this.offset,a),b+4},a.prototype.writeFloatLE=function(a,b,c){return void 0===c&&(c=!1),b>>>=0,c||e(this,a,b,4),this.data.writeFloatLE(b+this.offset,a),b+4},a.prototype.writeFloatBE=function(a,b,c){return void 0===c&&(c=!1),b>>>=0,c||e(this,a,b,4),this.data.writeFloatBE(b+this.offset,a),b+4},a.prototype.writeDoubleLE=function(a,b,c){return void 0===c&&(c=!1),b>>>=0,c||e(this,a,b,8),this.data.writeDoubleLE(b+this.offset,a),b+8},a.prototype.writeDoubleBE=function(a,b,c){return void 0===c&&(c=!1),b>>>=0,c||e(this,a,b,8),this.data.writeDoubleBE(b+this.offset,a),b+8},a.isEncoding=function(a){try{l.FindUtil(a)}catch(a){return!1}return!0},a.compare=function(a,b){if(a===b)return 0;var c,d,e,f=a.length,g=b.length,h=Math.min(f,g);for(c=0;ce?1:-1;return f===g?0:f>g?1:-1},a.isBuffer=function(b){return b instanceof a},a.byteLength=function(a,b){void 0===b&&(b="utf8");var c;try{c=l.FindUtil(b)}catch(a){c=l.FindUtil("utf8")}return"string"!=typeof a&&(a=""+a),c.byteLength(a)},a.concat=function(b,c){var d;if(0===b.length||0===c)return new a(0);if(void 0===c){c=0;for(var e=0;e>>24)},a.prototype.writeInt16LE=function(a,b){this.writeUInt8(a,255&b),this.writeUInt8(a+1,b>>>8&255|(2147483648&b)>>>24)},a.prototype.writeInt16BE=function(a,b){this.writeUInt8(a+1,255&b),this.writeUInt8(a,b>>>8&255|(2147483648&b)>>>24)},a.prototype.writeInt32LE=function(a,b){this.writeUInt8(a,255&b),this.writeUInt8(a+1,b>>>8&255),this.writeUInt8(a+2,b>>>16&255),this.writeUInt8(a+3,b>>>24&255)},a.prototype.writeInt32BE=function(a,b){this.writeUInt8(a+3,255&b),this.writeUInt8(a+2,b>>>8&255),this.writeUInt8(a+1,b>>>16&255),this.writeUInt8(a,b>>>24&255)},a.prototype.writeUInt8=function(a,b){throw new Error("BufferCore implementations should implement writeUInt8.")},a.prototype.writeUInt16LE=function(a,b){this.writeUInt8(a,255&b),this.writeUInt8(a+1,b>>8&255)},a.prototype.writeUInt16BE=function(a,b){this.writeUInt8(a+1,255&b),this.writeUInt8(a,b>>8&255)},a.prototype.writeUInt32LE=function(a,b){this.writeInt32LE(a,0|b)},a.prototype.writeUInt32BE=function(a,b){this.writeInt32BE(a,0|b)},a.prototype.writeFloatLE=function(a,b){this.writeInt32LE(a,this.float2intbits(b))},a.prototype.writeFloatBE=function(a,b){this.writeInt32BE(a,this.float2intbits(b))},a.prototype.writeDoubleLE=function(a,b){var c=this.double2longbits(b);this.writeInt32LE(a,c[0]),this.writeInt32LE(a+4,c[1])},a.prototype.writeDoubleBE=function(a,b){var c=this.double2longbits(b);this.writeInt32BE(a+4,c[0]),this.writeInt32BE(a,c[1])},a.prototype.readInt8=function(a){var b=this.readUInt8(a);return 128&b?4294967168|b:b},a.prototype.readInt16LE=function(a){var b=this.readUInt16LE(a);return 32768&b?4294934528|b:b},a.prototype.readInt16BE=function(a){var b=this.readUInt16BE(a);return 32768&b?4294934528|b:b},a.prototype.readInt32LE=function(a){return 0|this.readUInt32LE(a)},a.prototype.readInt32BE=function(a){return 0|this.readUInt32BE(a)},a.prototype.readUInt8=function(a){throw new Error("BufferCore implementations should implement readUInt8.")},a.prototype.readUInt16LE=function(a){return this.readUInt8(a+1)<<8|this.readUInt8(a)},a.prototype.readUInt16BE=function(a){return this.readUInt8(a)<<8|this.readUInt8(a+1)},a.prototype.readUInt32LE=function(a){return(this.readUInt8(a+3)<<24|this.readUInt8(a+2)<<16|this.readUInt8(a+1)<<8|this.readUInt8(a))>>>0},a.prototype.readUInt32BE=function(a){return(this.readUInt8(a)<<24|this.readUInt8(a+1)<<16|this.readUInt8(a+2)<<8|this.readUInt8(a+3))>>>0},a.prototype.readFloatLE=function(a){return this.intbits2float(this.readInt32LE(a))},a.prototype.readFloatBE=function(a){return this.intbits2float(this.readInt32BE(a))},a.prototype.readDoubleLE=function(a){return this.longbits2double(this.readInt32LE(a+4),this.readInt32LE(a))},a.prototype.readDoubleBE=function(a){return this.longbits2double(this.readInt32BE(a),this.readInt32BE(a+4))},a.prototype.copy=function(a,b){throw new Error("BufferCore implementations should implement copy.")},a.prototype.fill=function(a,b,c){for(var d=b;d=1.401298464324817e-45?(b=0,c=Math.round(a/Math.pow(2,-126)*Math.pow(2,23)),d<<31|b<<23|c):(b=Math.floor(Math.log(a)/Math.LN2),c=Math.round((a/Math.pow(2,b)-1)*Math.pow(2,23)),d<<31|b+127<<23|c))},a.prototype.double2longbits=function(a){var b,c,d,e;return 0===a?[0,0]:a===Number.POSITIVE_INFINITY?[0,2146435072]:a===Number.NEGATIVE_INFINITY?[0,-1048576]:isNaN(a)?[0,2146959360]:(e=a<0?1<<31:0,a=Math.abs(a),a<=2.225073858507201e-308&&a>=5e-324?(b=0,d=a/Math.pow(2,-1022)*Math.pow(2,52)):(b=Math.floor(Math.log(a)/Math.LN2),a>>31,h=(2139095040&a)>>>23,i=8388607&a;return b=0===h?Math.pow(-1,c)*i*Math.pow(2,-149):Math.pow(-1,c)*(1+i*Math.pow(2,-23))*Math.pow(2,h-127),(bd)&&(b=NaN),b},a.prototype.longbits2double=function(a,b){var c=(2147483648&a)>>>31,d=(2146435072&a)>>>20,e=(1048575&a)*Math.pow(2,32)+b;return 0===d&&0===e?0:2047===d?0===e?1===c?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY:NaN:0===d?Math.pow(-1,c)*e*Math.pow(2,-1074):Math.pow(-1,c)*(1+e*Math.pow(2,-52))*Math.pow(2,d-1023)},a}();c.BufferCoreCommon=i},{}],4:[function(a,b,c){"use strict";var d=this&&this.__extends||function(a,b){function c(){this.constructor=a}for(var d in b)b.hasOwnProperty(d)&&(a[d]=b[d]);a.prototype=null===b?Object.create(b):(c.prototype=b.prototype,new c)},e=a("./buffer_core"),f=[4294967040,4294902015,4278255615,16777215],g=function(a){function b(b){a.call(this),this.length=b,this.buff=new Array(Math.ceil(b/4));for(var c=this.buff.length,d=0;d>2,d=3&a;this.buff[c]=this.buff[c]&f[d],this.buff[c]=this.buff[c]|b<<(d<<3)},b.prototype.readUInt8=function(a){var b=a>>2,c=3&a;return this.buff[b]>>(c<<3)&255},b.prototype.copy=function(a,c){for(var d=new b(c-a),e=a;ec.length?c.length:b.length,e=0;e127){var g=a.extendedChars.indexOf(b.charAt(e));g>-1&&(f=g+128)}c.writeUInt8(f,e)}return d},a.byte2str=function(b){for(var c=new Array(b.length),d=0;d127?c[d]=a.extendedChars[e-128]:c[d]=String.fromCharCode(e)}return c.join("")},a.byteLength=function(a){return a.length},a.extendedChars=["Ç","ü","é","â","ä","à","å","ç","ê","ë","è","ï","î","ì","Ä","Å","É","æ","Æ","ô","ö","ò","û","ù","ÿ","Ö","Ü","ø","£","Ø","×","ƒ","á","í","ó","ú","ñ","Ñ","ª","º","¿","®","¬","½","¼","¡","«","»","_","_","_","¦","¦","Á","Â","À","©","¦","¦","+","+","¢","¥","+","+","-","-","+","-","+","ã","Ã","+","+","-","-","¦","-","+","¤","ð","Ð","Ê","Ë","È","i","Í","Î","Ï","+","+","_","_","¦","Ì","_","Ó","ß","Ô","Ò","õ","Õ","µ","þ","Þ","Ú","Û","Ù","ý","Ý","¯","´","­","±","_","¾","¶","§","÷","¸","°","¨","·","¹","³","²","_"," "],a}();c.__esModule=!0,c.default=d},{}],8:[function(a,b,c){"use strict";function d(a){var b,c=a.length,d=(c-1>>13)+1,e=new Array(d);for(b=0;b=c||d>=f)break;var h=a.charCodeAt(d);if(56320<=h&&h<=57343){var i=(1023&g|1024)<<10|1023&h;b.writeUInt8(i>>18|240,e++),b.writeUInt8(i>>12&63|128,e++),b.writeUInt8(i>>6&63|128,e++),b.writeUInt8(63&i|128,e++),d++}else b.writeUInt8(239,e++),b.writeUInt8(191,e++),b.writeUInt8(189,e++)}else if(56320<=g&&g<=57343)b.writeUInt8(239,e++),b.writeUInt8(191,e++),b.writeUInt8(189,e++);else if(g<128)b.writeUInt8(g,e++);else if(g<2048){if(e+1>=c)break;b.writeUInt8(g>>6|192,e++),b.writeUInt8(63&g|128,e++)}else if(g<65536){if(e+2>=c)break;b.writeUInt8(g>>12|224,e++),b.writeUInt8(g>>6&63|128,e++),b.writeUInt8(63&g|128,e++)}}return e},a.byte2str=function(a){for(var b=[],c=0;c>4)|55296),b.push((15&f)<<6|63&a.readUInt8(c++)|56320)}}}return d(b)},a.byteLength=function(a){for(var b=a.length,c=a.length-1;c>=0;c--){var d=a.charCodeAt(c);d>127&&d<=2047?b++:d>2047&&d<=65535&&(b+=2),d>=56320&&d<=57343&&c--}return b},a}();c.UTF8=h;var i=function(){function a(){}return a.str2byte=function(a,b){for(var c=a.length>b.length?b.length:a.length,d=0;db.length?b.length:a.length,d=0;d>2,i=(3&e)<<4|f>>4,j=(15&f)<<2|g>>6,k=63&g;isNaN(f)?j=k=64:isNaN(g)&&(k=64),c=c+a.num2b64[h]+a.num2b64[i]+a.num2b64[j]+a.num2b64[k]}return c},a.str2byte=function(b,c){var d=c.length,e="",f=0;b=b.replace(/[^A-Za-z0-9\+\/\=\-\_]/g,"");for(var g=0;f>4,m=(15&i)<<4|j>>2,n=(3&j)<<6|k;if(c.writeUInt8(l,g++),g===d)break;if(64!==j&&(e+=c.writeUInt8(m,g++)),g===d)break;if(64!==k&&(e+=c.writeUInt8(n,g++)),g===d)break}return g},a.byteLength=function(a){return Math.floor(6*a.replace(/[^A-Za-z0-9\+\/\-\_]/g,"").length/8)},a.b64chars=["A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","0","1","2","3","4","5","6","7","8","9","+","/","="],a.num2b64=function(){for(var b=new Array(a.b64chars.length),c=0;cb.length&&(c=b.length%2===1?(b.length-1)/2:b.length/2);for(var d=0;d>1;c>b.length&&(c=b.length);for(var d=0;d>4;c[d++]=this.num2hex[g],c[d++]=this.num2hex[f]}return c.join("")},a.byteLength=function(a){return a.length>>1},a.HEXCHARS="0123456789abcdef",a.num2hex=function(){for(var b=new Array(a.HEXCHARS.length),c=0;cc.length&&(d=c.length);var e=0,f=0,g=f+d,h=b.charCodeAt(e++);0!==h&&(c.writeUInt8(255&h,0),f=1);for(var i=f;i>8,i),g-i>=2&&c.writeUInt16BE(j,i)}return d},a.byte2str=function(a){var b=a.length;if(0===b)return"";var c,e=(b>>1)+1,f=new Array(e),g=0;for(1===(1&b)?f[0]=256|a.readUInt8(g++):f[0]=0,c=1;cb.length?b.length:a.length,d=0;d0&&".."!==e[0])?e.pop():e.push(g))}if(!c&&e.length<2)switch(e.length){case 1:""===e[0]&&e.unshift(".");break;default:e.push(".")}return a=e.join(b.sep),c&&a.charAt(0)!==b.sep&&(a=b.sep+a),a},b.join=function(){for(var a=[],c=0;c1&&h.charAt(h.length-1)===b.sep)return h.substr(0,h.length-1);if(h.charAt(0)!==b.sep){"."!==h.charAt(0)||1!==h.length&&h.charAt(1)!==b.sep||(h=1===h.length?"":h.substr(2));var i=a.cwd();h=""!==h?this.normalize(i+("/"!==i?b.sep:"")+h):i}return h},b.relative=function(a,c){var d;a=b.resolve(a),c=b.resolve(c);var e=a.split(b.sep),f=c.split(b.sep);f.shift(),e.shift();var g=0,h=[];for(d=0;de.length&&(g=e.length);var j="";for(d=0;d1&&j.charAt(j.length-1)===b.sep&&(j=j.substr(0,j.length-1)),j},b.dirname=function(a){a=b._removeDuplicateSeps(a);var c=a.charAt(0)===b.sep,d=a.split(b.sep);return""===d.pop()&&d.length>0&&d.pop(),d.length>1||1===d.length&&!c?d.join(b.sep):c?b.sep:"."},b.basename=function(a,c){if(void 0===c&&(c=""),""===a)return a;a=b.normalize(a);var d=a.split(b.sep),e=d[d.length-1];if(""===e&&d.length>1)return d[d.length-2];if(c.length>0){var f=e.substr(e.length-c.length);if(f===c)return e.substr(0,e.length-c.length)}return e},b.extname=function(a){a=b.normalize(a);var c=a.split(b.sep);if(a=c.pop(),""===a&&c.length>0&&(a=c.pop()),".."===a)return"";var d=a.lastIndexOf(".");return d===-1||0===d?"":a.substr(d)},b.isAbsolute=function(a){return a.length>0&&a.charAt(0)===b.sep},b._makeLong=function(a){return a},b.parse=function(a){var b=c(a);return{root:b[0],dir:b[0]+b[1].slice(0,-1),base:b[2],ext:b[3],name:b[2].slice(0,b[2].length-b[3].length)}},b.format=function(a){if(null===a||"object"!=typeof a)throw new TypeError("Parameter 'pathObject' must be an object, not "+typeof a);var c=a.root||"";if("string"!=typeof c)throw new TypeError("'pathObject.root' must be a string or undefined, not "+typeof a.root);var d=a.dir?a.dir+b.sep:"",e=a.base||"";return d+e},b._removeDuplicateSeps=function(a){return a=a.replace(this._replaceRegex,this.sep)},b.sep="/",b._replaceRegex=new RegExp("//+","g"),b.delimiter=":",b.posix=b,b.win32=b,b}();b.exports=e}).call(this,a("bfs-process"))},{"bfs-process":11}],11:[function(a,b,c){"use strict";function d(a){g[a]||("function"==typeof f[a]?g[a]=function(){return f[a].apply(f,arguments)}:g[a]=f[a])}var e=a("./process"),f=new e,g={};for(var h in f)d(h);g.initializeTTYs=function(){null===f.stdin&&(f.initializeTTYs(),g.stdin=f.stdin,g.stdout=f.stdout,g.stderr=f.stderr)},f.nextTick(function(){g.initializeTTYs()}),b.exports=g},{"./process":12}],12:[function(a,b,c){(function(c){"use strict";var d=this&&this.__extends||function(a,b){function c(){this.constructor=a}for(var d in b)b.hasOwnProperty(d)&&(a[d]=b[d]);a.prototype=null===b?Object.create(b):(c.prototype=b.prototype,new c)},e=a("events"),f=null,g=function(){function a(a,b){this.fun=a,this.array=b}return a.prototype.run=function(){this.fun.apply(null,this.array)},a}(),h=function(){function a(){this._queue=[],this._draining=!1,this._currentQueue=null,this._queueIndex=-1}return a.prototype.push=function(a){var b=this;1!==this._queue.push(a)||this._draining||setTimeout(function(){return b._drainQueue()},0)},a.prototype._cleanUpNextTick=function(){this._draining=!1,this._currentQueue&&this._currentQueue.length?this._queue=this._currentQueue.concat(this._queue):this._queueIndex=-1,this._queue.length&&this._drainQueue()},a.prototype._drainQueue=function(){var a=this;if(!this._draining){var b=setTimeout(function(){return a._cleanUpNextTick()});this._draining=!0;for(var c=this._queue.length;c;){for(this._currentQueue=this._queue,this._queue=[];++this._queueIndex0&&(this._waitingForWrites=this.push(this._bufferedWrites.shift()),this._waitingForWrites););},b}(e.Duplex);b.exports=f}).call(this,a("bfs-buffer").Buffer)},{"bfs-buffer":2,stream:34}],14:[function(a,b,c){},{}],15:[function(a,b,c){(function(b){"use strict";var d=a("buffer"),e=d.Buffer,f=d.SlowBuffer,g=d.kMaxLength||2147483647;c.alloc=function(a,b,c){if("function"==typeof e.alloc)return e.alloc(a,b,c);if("number"==typeof c)throw new TypeError("encoding must not be number");if("number"!=typeof a)throw new TypeError("size must be a number");if(a>g)throw new RangeError("size is too large");var d=c,f=b;void 0===f&&(d=void 0,f=0);var h=new e(a);if("string"==typeof f)for(var i=new e(f,d),j=i.length,k=-1;++kg)throw new RangeError("size is too large");return new e(a)},c.from=function(a,c,d){if("function"==typeof e.from&&(!b.Uint8Array||Uint8Array.from!==e.from))return e.from(a,c,d);if("number"==typeof a)throw new TypeError('"value" argument must not be a number');if("string"==typeof a)return new e(a,c);if("undefined"!=typeof ArrayBuffer&&a instanceof ArrayBuffer){var f=c;if(1===arguments.length)return new e(a);"undefined"==typeof f&&(f=0);var g=d;if("undefined"==typeof g&&(g=a.byteLength-f),f>=a.byteLength)throw new RangeError("'offset' is out of bounds");if(g>a.byteLength-f)throw new RangeError("'length' is out of bounds");return new e(a.slice(f,f+g))}if(e.isBuffer(a)){var h=new e(a.length);return a.copy(h,0,0,a.length),h}if(a){if(Array.isArray(a)||"undefined"!=typeof ArrayBuffer&&a.buffer instanceof ArrayBuffer||"length"in a)return new e(a);if("Buffer"===a.type&&Array.isArray(a.data))return new e(a.data)}throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")},c.allocUnsafeSlow=function(a){if("function"==typeof e.allocUnsafeSlow)return e.allocUnsafeSlow(a);if("number"!=typeof a)throw new TypeError("size must be a number");if(a>=g)throw new RangeError("size is too large");return new f(a)}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{buffer:2}],16:[function(a,b,c){(function(a){function b(a){return Array.isArray?Array.isArray(a):"[object Array]"===q(a)}function d(a){return"boolean"==typeof a}function e(a){return null===a}function f(a){return null==a}function g(a){return"number"==typeof a}function h(a){return"string"==typeof a}function i(a){return"symbol"==typeof a}function j(a){return void 0===a}function k(a){return"[object RegExp]"===q(a)}function l(a){return"object"==typeof a&&null!==a}function m(a){return"[object Date]"===q(a)}function n(a){return"[object Error]"===q(a)||a instanceof Error}function o(a){return"function"==typeof a}function p(a){return null===a||"boolean"==typeof a||"number"==typeof a||"string"==typeof a||"symbol"==typeof a||"undefined"==typeof a}function q(a){return Object.prototype.toString.call(a)}c.isArray=b,c.isBoolean=d,c.isNull=e,c.isNullOrUndefined=f,c.isNumber=g,c.isString=h,c.isSymbol=i,c.isUndefined=j,c.isRegExp=k,c.isObject=l,c.isDate=m,c.isError=n,c.isFunction=o,c.isPrimitive=p,c.isBuffer=a.isBuffer}).call(this,{isBuffer:a("../../is-buffer/index.js")})},{"../../is-buffer/index.js":19}],17:[function(a,b,c){function d(){this._events=this._events||{},this._maxListeners=this._maxListeners||void 0}function e(a){return"function"==typeof a}function f(a){return"number"==typeof a}function g(a){return"object"==typeof a&&null!==a}function h(a){return void 0===a}b.exports=d,d.EventEmitter=d,d.prototype._events=void 0,d.prototype._maxListeners=void 0,d.defaultMaxListeners=10,d.prototype.setMaxListeners=function(a){if(!f(a)||a<0||isNaN(a))throw TypeError("n must be a positive number");return this._maxListeners=a,this},d.prototype.emit=function(a){var b,c,d,f,i,j;if(this._events||(this._events={}),"error"===a&&(!this._events.error||g(this._events.error)&&!this._events.error.length)){if(b=arguments[1],b instanceof Error)throw b;var k=new Error('Uncaught, unspecified "error" event. ('+b+")");throw k.context=b,k}if(c=this._events[a],h(c))return!1;if(e(c))switch(arguments.length){case 1:c.call(this);break;case 2:c.call(this,arguments[1]);break;case 3:c.call(this,arguments[1],arguments[2]);break;default:f=Array.prototype.slice.call(arguments,1),c.apply(this,f)}else if(g(c))for(f=Array.prototype.slice.call(arguments,1),j=c.slice(),d=j.length,i=0;i0&&this._events[a].length>c&&(this._events[a].warned=!0,console.error("(node) warning: possible EventEmitter memory leak detected. %d listeners added. Use emitter.setMaxListeners() to increase limit.",this._events[a].length),"function"==typeof console.trace&&console.trace())),this},d.prototype.on=d.prototype.addListener,d.prototype.once=function(a,b){function c(){this.removeListener(a,c),d||(d=!0,b.apply(this,arguments))}if(!e(b))throw TypeError("listener must be a function");var d=!1;return c.listener=b,this.on(a,c),this},d.prototype.removeListener=function(a,b){var c,d,f,h;if(!e(b))throw TypeError("listener must be a function");if(!this._events||!this._events[a])return this;if(c=this._events[a],f=c.length,d=-1,c===b||e(c.listener)&&c.listener===b)delete this._events[a],this._events.removeListener&&this.emit("removeListener",a,b);else if(g(c)){for(h=f;h-- >0;)if(c[h]===b||c[h].listener&&c[h].listener===b){d=h;break}if(d<0)return this;1===c.length?(c.length=0,delete this._events[a]):c.splice(d,1),this._events.removeListener&&this.emit("removeListener",a,b)}return this},d.prototype.removeAllListeners=function(a){var b,c;if(!this._events)return this;if(!this._events.removeListener)return 0===arguments.length?this._events={}:this._events[a]&&delete this._events[a],this;if(0===arguments.length){for(b in this._events)"removeListener"!==b&&this.removeAllListeners(b);return this.removeAllListeners("removeListener"),this._events={},this}if(c=this._events[a],e(c))this.removeListener(a,c);else if(c)for(;c.length;)this.removeListener(a,c[c.length-1]);return delete this._events[a],this},d.prototype.listeners=function(a){var b;return b=this._events&&this._events[a]?e(this._events[a])?[this._events[a]]:this._events[a].slice():[]},d.prototype.listenerCount=function(a){if(this._events){var b=this._events[a];if(e(b))return 1;if(b)return b.length}return 0},d.listenerCount=function(a,b){return a.listenerCount(b)}},{}],18:[function(a,b,c){"function"==typeof Object.create?b.exports=function(a,b){a.super_=b,a.prototype=Object.create(b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}})}:b.exports=function(a,b){a.super_=b;var c=function(){};c.prototype=b.prototype,a.prototype=new c,a.prototype.constructor=a}},{}],19:[function(a,b,c){function d(a){return!!a.constructor&&"function"==typeof a.constructor.isBuffer&&a.constructor.isBuffer(a)}function e(a){return"function"==typeof a.readFloatLE&&"function"==typeof a.slice&&d(a.slice(0,0))}b.exports=function(a){return null!=a&&(d(a)||e(a)||!!a._isBuffer)}},{}],20:[function(b,c,d){(function(e){!function(b){if("object"==typeof d&&"undefined"!=typeof c)c.exports=b();else if("function"==typeof a&&a.amd)a([],b);else{var f;f="undefined"!=typeof window?window:"undefined"!=typeof e?e:"undefined"!=typeof self?self:this,f.pako=b()}}(function(){return function a(c,d,e){function f(h,i){if(!d[h]){if(!c[h]){var j="function"==typeof b&&b;if(!i&&j)return j(h,!0);if(g)return g(h,!0);var k=new Error("Cannot find module '"+h+"'");throw k.code="MODULE_NOT_FOUND",k}var l=d[h]={exports:{}};c[h][0].call(l.exports,function(a){var b=c[h][1][a];return f(b?b:a)},l,l.exports,a,c,d,e)}return d[h].exports}for(var g="function"==typeof b&&b,h=0;h=252?6:i>=248?5:i>=240?4:i>=224?3:i>=192?2:1;h[254]=h[254]=1,c.string2buf=function(a){var b,c,d,f,g,h=a.length,i=0;for(f=0;f>>6,b[g++]=128|63&c):c<65536?(b[g++]=224|c>>>12,b[g++]=128|c>>>6&63,b[g++]=128|63&c):(b[g++]=240|c>>>18,b[g++]=128|c>>>12&63,b[g++]=128|c>>>6&63,b[g++]=128|63&c);return b},c.buf2binstring=function(a){return d(a,a.length)},c.binstring2buf=function(a){for(var b=new e.Buf8(a.length),c=0,d=b.length;c4)j[e++]=65533,c+=g-1;else{for(f&=2===g?31:3===g?15:7;g>1&&c1?j[e++]=65533:f<65536?j[e++]=f:(f-=65536,j[e++]=55296|f>>10&1023,j[e++]=56320|1023&f)}return d(j,e)},c.utf8border=function(a,b){var c;for(b=b||a.length,b>a.length&&(b=a.length),c=b-1;c>=0&&128===(192&a[c]);)c--;return c<0?b:0===c?b:c+h[a[c]]>b?c:b}},{"./common":1}],3:[function(a,b,c){"use strict";function d(a,b,c,d){for(var e=65535&a|0,f=a>>>16&65535|0,g=0;0!==c;){g=c>2e3?2e3:c,c-=g;do e=e+b[d++]|0,f=f+e|0;while(--g);e%=65521,f%=65521}return e|f<<16|0}b.exports=d},{}],4:[function(a,b,c){"use strict";b.exports={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8}},{}],5:[function(a,b,c){"use strict";function d(){for(var a,b=[],c=0;c<256;c++){a=c;for(var d=0;d<8;d++)a=1&a?3988292384^a>>>1:a>>>1;b[c]=a}return b}function e(a,b,c,d){var e=f,g=d+c;a^=-1;for(var h=d;h>>8^e[255&(a^b[h])];return a^-1}var f=d();b.exports=e},{}],6:[function(a,b,c){"use strict";function d(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1}b.exports=d},{}],7:[function(a,b,c){"use strict";var d=30,e=12;b.exports=function(a,b){var c,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,A,B,C;c=a.state,f=a.next_in,B=a.input,g=f+(a.avail_in-5),h=a.next_out,C=a.output,i=h-(b-a.avail_out),j=h+(a.avail_out-257),k=c.dmax,l=c.wsize,m=c.whave,n=c.wnext,o=c.window,p=c.hold,q=c.bits,r=c.lencode,s=c.distcode,t=(1<>>24,p>>>=w,q-=w,w=v>>>16&255,0===w)C[h++]=65535&v;else{if(!(16&w)){if(0===(64&w)){v=r[(65535&v)+(p&(1<>>=w,q-=w),q<15&&(p+=B[f++]<>>24,p>>>=w,q-=w,w=v>>>16&255,!(16&w)){if(0===(64&w)){v=s[(65535&v)+(p&(1<k){a.msg="invalid distance too far back",c.mode=d;break a}if(p>>>=w,q-=w,w=h-i,y>w){if(w=y-w,w>m&&c.sane){a.msg="invalid distance too far back",c.mode=d;break a}if(z=0,A=o,0===n){if(z+=l-w,w2;)C[h++]=A[z++],C[h++]=A[z++],C[h++]=A[z++],x-=3;x&&(C[h++]=A[z++],x>1&&(C[h++]=A[z++]))}else{z=h-y;do C[h++]=C[z++],C[h++]=C[z++],C[h++]=C[z++],x-=3;while(x>2);x&&(C[h++]=C[z++],x>1&&(C[h++]=C[z++]))}break}}break}}while(f>3,f-=x,q-=x<<3,p&=(1<>>24&255)+(a>>>8&65280)+((65280&a)<<8)+((255&a)<<24)}function e(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new s.Buf16(320),this.work=new s.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function f(a){var b;return a&&a.state?(b=a.state,a.total_in=a.total_out=b.total=0,a.msg="",b.wrap&&(a.adler=1&b.wrap),b.mode=L,b.last=0,b.havedict=0,b.dmax=32768,b.head=null,b.hold=0,b.bits=0,b.lencode=b.lendyn=new s.Buf32(pa),b.distcode=b.distdyn=new s.Buf32(qa),b.sane=1,b.back=-1,D):G}function g(a){var b;return a&&a.state?(b=a.state,b.wsize=0,b.whave=0,b.wnext=0,f(a)):G}function h(a,b){var c,d;return a&&a.state?(d=a.state,b<0?(c=0,b=-b):(c=(b>>4)+1,b<48&&(b&=15)),b&&(b<8||b>15)?G:(null!==d.window&&d.wbits!==b&&(d.window=null),d.wrap=c,d.wbits=b,g(a))):G}function i(a,b){var c,d;return a?(d=new e,a.state=d,d.window=null,c=h(a,b),c!==D&&(a.state=null),c):G}function j(a){return i(a,sa)}function k(a){if(ta){var b;for(q=new s.Buf32(512),r=new s.Buf32(32),b=0;b<144;)a.lens[b++]=8;for(;b<256;)a.lens[b++]=9;for(;b<280;)a.lens[b++]=7;for(;b<288;)a.lens[b++]=8;for(w(y,a.lens,0,288,q,0,a.work,{bits:9}),b=0;b<32;)a.lens[b++]=5;w(z,a.lens,0,32,r,0,a.work,{bits:5}),ta=!1}a.lencode=q,a.lenbits=9,a.distcode=r,a.distbits=5}function l(a,b,c,d){var e,f=a.state;return null===f.window&&(f.wsize=1<=f.wsize?(s.arraySet(f.window,b,c-f.wsize,f.wsize,0),f.wnext=0,f.whave=f.wsize):(e=f.wsize-f.wnext,e>d&&(e=d),s.arraySet(f.window,b,c-d,e,f.wnext),d-=e,d?(s.arraySet(f.window,b,c-d,d,0),f.wnext=d,f.whave=f.wsize):(f.wnext+=e,f.wnext===f.wsize&&(f.wnext=0),f.whave>>8&255,c.check=u(c.check,Ba,2,0),m=0,n=0,c.mode=M;break}if(c.flags=0,c.head&&(c.head.done=!1),!(1&c.wrap)||(((255&m)<<8)+(m>>8))%31){a.msg="incorrect header check",c.mode=ma;break}if((15&m)!==K){a.msg="unknown compression method",c.mode=ma;break}if(m>>>=4,n-=4,wa=(15&m)+8,0===c.wbits)c.wbits=wa;else if(wa>c.wbits){a.msg="invalid window size",c.mode=ma;break}c.dmax=1<>8&1),512&c.flags&&(Ba[0]=255&m,Ba[1]=m>>>8&255,c.check=u(c.check,Ba,2,0)),m=0,n=0,c.mode=N;case N:for(;n<32;){if(0===i)break a;i--,m+=e[g++]<>>8&255,Ba[2]=m>>>16&255,Ba[3]=m>>>24&255,c.check=u(c.check,Ba,4,0)),m=0,n=0,c.mode=O;case O:for(;n<16;){if(0===i)break a;i--,m+=e[g++]<>8),512&c.flags&&(Ba[0]=255&m,Ba[1]=m>>>8&255,c.check=u(c.check,Ba,2,0)),m=0,n=0,c.mode=P;case P:if(1024&c.flags){for(;n<16;){if(0===i)break a;i--,m+=e[g++]<>>8&255,c.check=u(c.check,Ba,2,0)),m=0,n=0}else c.head&&(c.head.extra=null);c.mode=Q;case Q:if(1024&c.flags&&(q=c.length,q>i&&(q=i),q&&(c.head&&(wa=c.head.extra_len-c.length,c.head.extra||(c.head.extra=new Array(c.head.extra_len)),s.arraySet(c.head.extra,e,g,q,wa)),512&c.flags&&(c.check=u(c.check,e,q,g)),i-=q,g+=q,c.length-=q),c.length))break a;c.length=0,c.mode=R;case R:if(2048&c.flags){if(0===i)break a;q=0;do wa=e[g+q++],c.head&&wa&&c.length<65536&&(c.head.name+=String.fromCharCode(wa));while(wa&&q>9&1,c.head.done=!0),a.adler=c.check=0,c.mode=W;break;case U:for(;n<32;){if(0===i)break a;i--,m+=e[g++]<>>=7&n,n-=7&n,c.mode=ja;break}for(;n<3;){if(0===i)break a;i--,m+=e[g++]<>>=1,n-=1,3&m){case 0:c.mode=Y;break;case 1:if(k(c),c.mode=ca,b===C){m>>>=2,n-=2;break a}break;case 2:c.mode=_;break;case 3:a.msg="invalid block type",c.mode=ma}m>>>=2,n-=2;break;case Y:for(m>>>=7&n,n-=7&n;n<32;){if(0===i)break a;i--,m+=e[g++]<>>16^65535)){a.msg="invalid stored block lengths",c.mode=ma;break}if(c.length=65535&m,m=0,n=0,c.mode=Z,b===C)break a;case Z:c.mode=$;case $:if(q=c.length){if(q>i&&(q=i),q>j&&(q=j),0===q)break a;s.arraySet(f,e,g,q,h),i-=q,g+=q,j-=q,h+=q,c.length-=q;break}c.mode=W;break;case _:for(;n<14;){if(0===i)break a;i--,m+=e[g++]<>>=5,n-=5,c.ndist=(31&m)+1,m>>>=5,n-=5,c.ncode=(15&m)+4,m>>>=4,n-=4,c.nlen>286||c.ndist>30){a.msg="too many length or distance symbols",c.mode=ma;break}c.have=0,c.mode=aa;case aa:for(;c.have>>=3,n-=3}for(;c.have<19;)c.lens[Ca[c.have++]]=0;if(c.lencode=c.lendyn,c.lenbits=7,ya={bits:c.lenbits},xa=w(x,c.lens,0,19,c.lencode,0,c.work,ya),c.lenbits=ya.bits,xa){a.msg="invalid code lengths set",c.mode=ma;break}c.have=0,c.mode=ba;case ba:for(;c.have>>24,ra=Aa>>>16&255,sa=65535&Aa,!(qa<=n);){if(0===i)break a;i--,m+=e[g++]<>>=qa,n-=qa,c.lens[c.have++]=sa;else{if(16===sa){for(za=qa+2;n>>=qa,n-=qa,0===c.have){a.msg="invalid bit length repeat",c.mode=ma;break}wa=c.lens[c.have-1],q=3+(3&m),m>>>=2,n-=2}else if(17===sa){for(za=qa+3;n>>=qa,n-=qa,wa=0,q=3+(7&m),m>>>=3,n-=3}else{for(za=qa+7;n>>=qa,n-=qa,wa=0,q=11+(127&m),m>>>=7,n-=7}if(c.have+q>c.nlen+c.ndist){a.msg="invalid bit length repeat",c.mode=ma;break}for(;q--;)c.lens[c.have++]=wa}}if(c.mode===ma)break;if(0===c.lens[256]){a.msg="invalid code -- missing end-of-block",c.mode=ma;break}if(c.lenbits=9,ya={bits:c.lenbits},xa=w(y,c.lens,0,c.nlen,c.lencode,0,c.work,ya),c.lenbits=ya.bits,xa){a.msg="invalid literal/lengths set",c.mode=ma;break}if(c.distbits=6,c.distcode=c.distdyn,ya={bits:c.distbits},xa=w(z,c.lens,c.nlen,c.ndist,c.distcode,0,c.work,ya),c.distbits=ya.bits,xa){a.msg="invalid distances set",c.mode=ma;break}if(c.mode=ca,b===C)break a;case ca:c.mode=da;case da:if(i>=6&&j>=258){a.next_out=h,a.avail_out=j,a.next_in=g,a.avail_in=i,c.hold=m,c.bits=n,v(a,p),h=a.next_out,f=a.output,j=a.avail_out,g=a.next_in,e=a.input,i=a.avail_in,m=c.hold,n=c.bits,c.mode===W&&(c.back=-1);break}for(c.back=0;Aa=c.lencode[m&(1<>>24,ra=Aa>>>16&255,sa=65535&Aa,!(qa<=n);){if(0===i)break a;i--,m+=e[g++]<>ta)],qa=Aa>>>24,ra=Aa>>>16&255,sa=65535&Aa,!(ta+qa<=n);){if(0===i)break a;i--,m+=e[g++]<>>=ta,n-=ta,c.back+=ta}if(m>>>=qa,n-=qa,c.back+=qa,c.length=sa,0===ra){c.mode=ia;break}if(32&ra){c.back=-1,c.mode=W;break}if(64&ra){a.msg="invalid literal/length code",c.mode=ma;break}c.extra=15&ra,c.mode=ea;case ea:if(c.extra){for(za=c.extra;n>>=c.extra,n-=c.extra,c.back+=c.extra}c.was=c.length,c.mode=fa;case fa:for(;Aa=c.distcode[m&(1<>>24,ra=Aa>>>16&255,sa=65535&Aa,!(qa<=n);){if(0===i)break a;i--,m+=e[g++]<>ta)],qa=Aa>>>24,ra=Aa>>>16&255,sa=65535&Aa,!(ta+qa<=n);){if(0===i)break a;i--,m+=e[g++]<>>=ta,n-=ta,c.back+=ta}if(m>>>=qa,n-=qa,c.back+=qa,64&ra){a.msg="invalid distance code",c.mode=ma;break}c.offset=sa,c.extra=15&ra,c.mode=ga;case ga:if(c.extra){for(za=c.extra;n>>=c.extra,n-=c.extra,c.back+=c.extra}if(c.offset>c.dmax){a.msg="invalid distance too far back",c.mode=ma;break}c.mode=ha;case ha:if(0===j)break a;if(q=p-j,c.offset>q){if(q=c.offset-q,q>c.whave&&c.sane){a.msg="invalid distance too far back",c.mode=ma;break}q>c.wnext?(q-=c.wnext,r=c.wsize-q):r=c.wnext-q,q>c.length&&(q=c.length),pa=c.window}else pa=f,r=h-c.offset,q=c.length;q>j&&(q=j),j-=q,c.length-=q;do f[h++]=pa[r++];while(--q);0===c.length&&(c.mode=da);break;case ia:if(0===j)break a;f[h++]=c.length,j--,c.mode=da;break;case ja:if(c.wrap){for(;n<32;){if(0===i)break a;i--,m|=e[g++]<=1&&0===P[G];G--);if(H>G&&(H=G),0===G)return p[q++]=20971520,p[q++]=20971520,s.bits=1,0;for(F=1;F0&&(a===h||1!==G))return-1;for(Q[1]=0,D=1;Df||a===j&&L>g)return 1;for(var T=0;;){T++,z=D-J,r[E]y?(A=R[S+r[E]],B=N[O+r[E]]):(A=96,B=0),t=1<>J)+u]=z<<24|A<<16|B|0;while(0!==u);for(t=1<>=1;if(0!==t?(M&=t-1,M+=t):M=0,E++,0===--P[D]){if(D===G)break;D=b[c+r[E]]}if(D>H&&(M&w)!==v){for(0===J&&(J=H),x+=F,I=D-J,K=1<f||a===j&&L>g)return 1;v=M&w,p[v]=H<<24|I<<16|x-q|0}}return 0!==M&&(p[x+M]=D-J<<24|64<<16|0),s.bits=H,0}},{"../utils/common":1}],10:[function(a,b,c){"use strict";b.exports={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"}},{}],11:[function(a,b,c){"use strict";function d(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}b.exports=d},{}],"/lib/inflate.js":[function(a,b,c){"use strict";function d(a){if(!(this instanceof d))return new d(a);this.options=h.assign({chunkSize:16384,windowBits:0,to:""},a||{});var b=this.options;b.raw&&b.windowBits>=0&&b.windowBits<16&&(b.windowBits=-b.windowBits,0===b.windowBits&&(b.windowBits=-15)),!(b.windowBits>=0&&b.windowBits<16)||a&&a.windowBits||(b.windowBits+=32),b.windowBits>15&&b.windowBits<48&&0===(15&b.windowBits)&&(b.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new l,this.strm.avail_out=0;var c=g.inflateInit2(this.strm,b.windowBits);if(c!==j.Z_OK)throw new Error(k[c]);this.header=new m,g.inflateGetHeader(this.strm,this.header)}function e(a,b){var c=new d(b);if(c.push(a,!0),c.err)throw c.msg;return c.result}function f(a,b){return b=b||{},b.raw=!0,e(a,b)}var g=a("./zlib/inflate"),h=a("./utils/common"),i=a("./utils/strings"),j=a("./zlib/constants"),k=a("./zlib/messages"),l=a("./zlib/zstream"),m=a("./zlib/gzheader"),n=Object.prototype.toString;d.prototype.push=function(a,b){var c,d,e,f,k,l,m=this.strm,o=this.options.chunkSize,p=this.options.dictionary,q=!1;if(this.ended)return!1;d=b===~~b?b:b===!0?j.Z_FINISH:j.Z_NO_FLUSH,"string"==typeof a?m.input=i.binstring2buf(a):"[object ArrayBuffer]"===n.call(a)?m.input=new Uint8Array(a):m.input=a,m.next_in=0,m.avail_in=m.input.length;do{if(0===m.avail_out&&(m.output=new h.Buf8(o),m.next_out=0,m.avail_out=o),c=g.inflate(m,j.Z_NO_FLUSH),c===j.Z_NEED_DICT&&p&&(l="string"==typeof p?i.string2buf(p):"[object ArrayBuffer]"===n.call(p)?new Uint8Array(p):p,c=g.inflateSetDictionary(this.strm,l)),c===j.Z_BUF_ERROR&&q===!0&&(c=j.Z_OK,q=!1),c!==j.Z_STREAM_END&&c!==j.Z_OK)return this.onEnd(c),this.ended=!0,!1;m.next_out&&(0!==m.avail_out&&c!==j.Z_STREAM_END&&(0!==m.avail_in||d!==j.Z_FINISH&&d!==j.Z_SYNC_FLUSH)||("string"===this.options.to?(e=i.utf8border(m.output,m.next_out),f=m.next_out-e,k=i.buf2string(m.output,e),m.next_out=f,m.avail_out=o-f,f&&h.arraySet(m.output,m.output,e,f,0),this.onData(k)):this.onData(h.shrinkBuf(m.output,m.next_out)))),0===m.avail_in&&0===m.avail_out&&(q=!0)}while((m.avail_in>0||0===m.avail_out)&&c!==j.Z_STREAM_END);return c===j.Z_STREAM_END&&(d=j.Z_FINISH),d===j.Z_FINISH?(c=g.inflateEnd(this.strm),this.onEnd(c),this.ended=!0,c===j.Z_OK):d!==j.Z_SYNC_FLUSH||(this.onEnd(j.Z_OK),m.avail_out=0,!0)},d.prototype.onData=function(a){this.chunks.push(a)},d.prototype.onEnd=function(a){a===j.Z_OK&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=h.flattenChunks(this.chunks)),this.chunks=[],this.err=a,this.msg=this.strm.msg},c.Inflate=d,c.inflate=e,c.inflateRaw=f,c.ungzip=e},{"./utils/common":1,"./utils/strings":2,"./zlib/constants":4,"./zlib/gzheader":6,"./zlib/inflate":8,"./zlib/messages":10,"./zlib/zstream":11}]},{},[])("/lib/inflate.js")})}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],21:[function(a,b,c){(function(a){"use strict";function c(b,c,d,e){if("function"!=typeof b)throw new TypeError('"callback" argument must be a function');var f,g,h=arguments.length;switch(h){case 0:case 1:return a.nextTick(b);case 2:return a.nextTick(function(){b.call(null,c)});case 3:return a.nextTick(function(){b.call(null,c,d)});case 4:return a.nextTick(function(){b.call(null,c,d,e)});default: +for(f=new Array(h-1),g=0;g0)if(b.ended&&!e){var g=new Error("stream.push() after EOF");a.emit("error",g)}else if(b.endEmitted&&e){var i=new Error("stream.unshift() after end event");a.emit("error",i)}else{var j;!b.decoder||e||d||(c=b.decoder.write(c),j=!b.objectMode&&0===c.length),e||(b.reading=!1),j||(b.flowing&&0===b.length&&!b.sync?(a.emit("data",c),a.read(0)):(b.length+=b.objectMode?1:c.length,e?b.buffer.unshift(c):b.buffer.push(c),b.needReadable&&m(a))),o(a,b)}else e||(b.reading=!1);return h(b)}function h(a){return!a.ended&&(a.needReadable||a.length=P?a=P:(a--,a|=a>>>1,a|=a>>>2,a|=a>>>4,a|=a>>>8,a|=a>>>16,a++),a}function j(a,b){return a<=0||0===b.length&&b.ended?0:b.objectMode?1:a!==a?b.flowing&&b.length?b.buffer.head.data.length:b.length:(a>b.highWaterMark&&(b.highWaterMark=i(a)),a<=b.length?a:b.ended?b.length:(b.needReadable=!0,0))}function k(a,b){var c=null;return H.isBuffer(b)||"string"==typeof b||null===b||void 0===b||a.objectMode||(c=new TypeError("Invalid non-string/buffer chunk")),c}function l(a,b){if(!b.ended){if(b.decoder){var c=b.decoder.end();c&&c.length&&(b.buffer.push(c),b.length+=b.objectMode?1:c.length)}b.ended=!0,m(a)}}function m(a){var b=a._readableState;b.needReadable=!1,b.emittedReadable||(L("emitReadable",b.flowing),b.emittedReadable=!0,b.sync?D(n,a):n(a))}function n(a){L("emit readable"),a.emit("readable"),u(a)}function o(a,b){b.readingMore||(b.readingMore=!0,D(p,a,b))}function p(a,b){for(var c=b.length;!b.reading&&!b.flowing&&!b.ended&&b.length=b.length?(c=b.decoder?b.buffer.join(""):1===b.buffer.length?b.buffer.head.data:b.buffer.concat(b.length),b.buffer.clear()):c=w(a,b.buffer,b.decoder),c}function w(a,b,c){var d;return af.length?f.length:a;if(e+=g===f.length?f:f.slice(0,a),a-=g,0===a){g===f.length?(++d,c.next?b.head=c.next:b.head=b.tail=null):(b.head=c,c.data=f.slice(g));break}++d}return b.length-=d,e}function y(a,b){var c=I.allocUnsafe(a),d=b.head,e=1;for(d.data.copy(c),a-=d.data.length;d=d.next;){var f=d.data,g=a>f.length?f.length:a;if(f.copy(c,c.length-a,0,g),a-=g,0===a){g===f.length?(++e,d.next?b.head=d.next:b.head=b.tail=null):(b.head=d,d.data=f.slice(g));break}++e}return b.length-=e,c}function z(a){var b=a._readableState;if(b.length>0)throw new Error('"endReadable()" called on non-empty stream');b.endEmitted||(b.ended=!0,D(A,b,a))}function A(a,b){a.endEmitted||0!==a.length||(a.endEmitted=!0,b.readable=!1,b.emit("end"))}function B(a,b){for(var c=0,d=a.length;c=b.highWaterMark||b.ended))return L("read: emitReadable",b.length,b.ended),0===b.length&&b.ended?z(this):m(this),null;if(a=j(a,b),0===a&&b.ended)return 0===b.length&&z(this),null;var d=b.needReadable;L("need readable",d),(0===b.length||b.length-a0?v(a,b):null,null===e?(b.needReadable=!0,a=0):b.length-=a,0===b.length&&(b.ended||(b.needReadable=!0),c!==a&&b.ended&&z(this)),null!==e&&this.emit("data",e),e},f.prototype._read=function(a){this.emit("error",new Error("not implemented"))},f.prototype.pipe=function(a,b){function e(a){L("onunpipe"),a===m&&g()}function f(){L("onend"),a.end()}function g(){L("cleanup"),a.removeListener("close",j),a.removeListener("finish",k),a.removeListener("drain",r),a.removeListener("error",i),a.removeListener("unpipe",e),m.removeListener("end",f),m.removeListener("end",g),m.removeListener("data",h),s=!0,!n.awaitDrain||a._writableState&&!a._writableState.needDrain||r()}function h(b){L("ondata"),t=!1;var c=a.write(b);!1!==c||t||((1===n.pipesCount&&n.pipes===a||n.pipesCount>1&&C(n.pipes,a)!==-1)&&!s&&(L("false write response, pause",m._readableState.awaitDrain),m._readableState.awaitDrain++,t=!0),m.pause())}function i(b){L("onerror",b),l(),a.removeListener("error",i),0===G(a,"error")&&a.emit("error",b)}function j(){a.removeListener("finish",k),l()}function k(){L("onfinish"),a.removeListener("close",j),l()}function l(){L("unpipe"),m.unpipe(a)}var m=this,n=this._readableState;switch(n.pipesCount){case 0:n.pipes=a;break;case 1:n.pipes=[n.pipes,a];break;default:n.pipes.push(a)}n.pipesCount+=1,L("pipe count=%d opts=%j",n.pipesCount,b);var o=(!b||b.end!==!1)&&a!==c.stdout&&a!==c.stderr,p=o?f:g;n.endEmitted?D(p):m.once("end",p),a.on("unpipe",e);var r=q(m);a.on("drain",r);var s=!1,t=!1;return m.on("data",h),d(a,"error",i),a.once("close",j),a.once("finish",k),a.emit("pipe",m),n.flowing||(L("pipe resume"),m.resume()),a},f.prototype.unpipe=function(a){var b=this._readableState;if(0===b.pipesCount)return this;if(1===b.pipesCount)return a&&a!==b.pipes?this:(a||(a=b.pipes),b.pipes=null,b.pipesCount=0,b.flowing=!1,a&&a.emit("unpipe",this),this);if(!a){var c=b.pipes,d=b.pipesCount;b.pipes=null,b.pipesCount=0,b.flowing=!1;for(var e=0;e-1?setImmediate:x;g.WritableState=f;var z=a("core-util-is");z.inherits=a("inherits");var A,B={deprecate:a("util-deprecate")};!function(){try{A=a("stream")}catch(a){}finally{A||(A=a("events").EventEmitter)}}();var C=a("buffer").Buffer,D=a("buffer-shims");z.inherits(g,A);var E;f.prototype.getBuffer=function(){for(var a=this.bufferedRequest,b=[];a;)b.push(a),a=a.next;return b},function(){try{Object.defineProperty(f.prototype,"buffer",{get:B.deprecate(function(){return this.getBuffer()},"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.")})}catch(a){}}();var E;g.prototype.pipe=function(){this.emit("error",new Error("Cannot pipe, not readable"))},g.prototype.write=function(a,b,c){var e=this._writableState,f=!1;return"function"==typeof b&&(c=b,b=null),C.isBuffer(a)?b="buffer":b||(b=e.defaultEncoding),"function"!=typeof c&&(c=d),e.ended?h(this,c):i(this,e,a,c)&&(e.pendingcb++,f=k(this,e,a,b,c)),f},g.prototype.cork=function(){var a=this._writableState;a.corked++},g.prototype.uncork=function(){var a=this._writableState;a.corked&&(a.corked--,a.writing||a.corked||a.finished||a.bufferProcessing||!a.bufferedRequest||r(this,a))},g.prototype.setDefaultEncoding=function(a){if("string"==typeof a&&(a=a.toLowerCase()),!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((a+"").toLowerCase())>-1))throw new TypeError("Unknown encoding: "+a);return this._writableState.defaultEncoding=a,this},g.prototype._write=function(a,b,c){c(new Error("not implemented"))},g.prototype._writev=null,g.prototype.end=function(a,b,c){var d=this._writableState;"function"==typeof a?(c=a,a=null,b=null):"function"==typeof b&&(c=b,b=null),null!==a&&void 0!==a&&this.write(a,b),d.corked&&(d.corked=1,this.uncork()),d.ending||d.finished||v(this,d,c)}}).call(this,a("bfs-process"))},{"./_stream_duplex":23,"bfs-process":11,buffer:2,"buffer-shims":15,"core-util-is":16,events:17,inherits:18,"process-nextick-args":21,"util-deprecate":36}],28:[function(a,b,c){"use strict";function d(){this.head=null,this.tail=null,this.length=0}var e=(a("buffer").Buffer,a("buffer-shims"));b.exports=d,d.prototype.push=function(a){var b={data:a,next:null};this.length>0?this.tail.next=b:this.head=b,this.tail=b,++this.length},d.prototype.unshift=function(a){var b={data:a,next:this.head};0===this.length&&(this.tail=b),this.head=b,++this.length},d.prototype.shift=function(){if(0!==this.length){var a=this.head.data;return 1===this.length?this.head=this.tail=null:this.head=this.head.next,--this.length,a}},d.prototype.clear=function(){this.head=this.tail=null,this.length=0},d.prototype.join=function(a){if(0===this.length)return"";for(var b=this.head,c=""+b.data;b=b.next;)c+=a+b.data;return c},d.prototype.concat=function(a){if(0===this.length)return e.alloc(0);if(1===this.length)return this.head.data;for(var b=e.allocUnsafe(a>>>0),c=this.head,d=0;c;)c.data.copy(b,d),d+=c.data.length,c=c.next;return b}},{buffer:2,"buffer-shims":15}],29:[function(a,b,c){var d={}.toString;b.exports=Array.isArray||function(a){return"[object Array]"==d.call(a)}},{}],30:[function(a,b,c){b.exports=a("./lib/_stream_passthrough.js")},{"./lib/_stream_passthrough.js":24}],31:[function(a,b,c){(function(d){var e=function(){try{return a("stream")}catch(a){}}();c=b.exports=a("./lib/_stream_readable.js"),c.Stream=e||c,c.Readable=c,c.Writable=a("./lib/_stream_writable.js"),c.Duplex=a("./lib/_stream_duplex.js"),c.Transform=a("./lib/_stream_transform.js"),c.PassThrough=a("./lib/_stream_passthrough.js"),!d.browser&&"disable"===d.env.READABLE_STREAM&&e&&(b.exports=e)}).call(this,a("bfs-process"))},{"./lib/_stream_duplex.js":23,"./lib/_stream_passthrough.js":24,"./lib/_stream_readable.js":25,"./lib/_stream_transform.js":26,"./lib/_stream_writable.js":27,"bfs-process":11}],32:[function(a,b,c){b.exports=a("./lib/_stream_transform.js")},{"./lib/_stream_transform.js":26}],33:[function(a,b,c){b.exports=a("./lib/_stream_writable.js")},{"./lib/_stream_writable.js":27}],34:[function(a,b,c){function d(){e.call(this)}b.exports=d;var e=a("events").EventEmitter,f=a("inherits");f(d,e),d.Readable=a("readable-stream/readable.js"),d.Writable=a("readable-stream/writable.js"),d.Duplex=a("readable-stream/duplex.js"),d.Transform=a("readable-stream/transform.js"),d.PassThrough=a("readable-stream/passthrough.js"),d.Stream=d,d.prototype.pipe=function(a,b){function c(b){a.writable&&!1===a.write(b)&&j.pause&&j.pause()}function d(){j.readable&&j.resume&&j.resume()}function f(){k||(k=!0,a.end())}function g(){k||(k=!0,"function"==typeof a.destroy&&a.destroy())}function h(a){if(i(),0===e.listenerCount(this,"error"))throw a}function i(){j.removeListener("data",c),a.removeListener("drain",d),j.removeListener("end",f),j.removeListener("close",g),j.removeListener("error",h),a.removeListener("error",h),j.removeListener("end",i),j.removeListener("close",i),a.removeListener("close",i)}var j=this;j.on("data",c),a.on("drain",d),a._isStdio||b&&b.end===!1||(j.on("end",f),j.on("close",g));var k=!1;return j.on("error",h),a.on("error",h),j.on("end",i),j.on("close",i),a.on("close",i),a.emit("pipe",j),a}},{events:17,inherits:18,"readable-stream/duplex.js":22,"readable-stream/passthrough.js":30,"readable-stream/readable.js":31,"readable-stream/transform.js":32,"readable-stream/writable.js":33}],35:[function(a,b,c){function d(a){if(a&&!i(a))throw new Error("Unknown encoding: "+a)}function e(a){return a.toString(this.encoding)}function f(a){this.charReceived=a.length%2,this.charLength=this.charReceived?2:0}function g(a){this.charReceived=a.length%3,this.charLength=this.charReceived?3:0}var h=a("buffer").Buffer,i=h.isEncoding||function(a){switch(a&&a.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}},j=c.StringDecoder=function(a){switch(this.encoding=(a||"utf8").toLowerCase().replace(/[-_]/,""),d(a),this.encoding){case"utf8":this.surrogateSize=3;break;case"ucs2":case"utf16le":this.surrogateSize=2,this.detectIncompleteChar=f;break;case"base64":this.surrogateSize=3,this.detectIncompleteChar=g;break;default:return void(this.write=e)}this.charBuffer=new h(6),this.charReceived=0,this.charLength=0};j.prototype.write=function(a){for(var b="";this.charLength;){var c=a.length>=this.charLength-this.charReceived?this.charLength-this.charReceived:a.length;if(a.copy(this.charBuffer,this.charReceived,0,c),this.charReceived+=c,this.charReceived=55296&&d<=56319)){if(this.charReceived=this.charLength=0,0===a.length)return b;break}this.charLength+=this.surrogateSize,b=""}this.detectIncompleteChar(a);var e=a.length;this.charLength&&(a.copy(this.charBuffer,0,a.length-this.charReceived,e),e-=this.charReceived),b+=a.toString(this.encoding,0,e);var e=b.length-1,d=b.charCodeAt(e);if(d>=55296&&d<=56319){var f=this.surrogateSize;return this.charLength+=f,this.charReceived+=f,this.charBuffer.copy(this.charBuffer,f,0,f),a.copy(this.charBuffer,0,0,f),b.substring(0,e)}return b},j.prototype.detectIncompleteChar=function(a){for(var b=a.length>=3?3:a.length;b>0;b--){var c=a[a.length-b];if(1==b&&c>>5==6){this.charLength=2;break}if(b<=2&&c>>4==14){this.charLength=3;break}if(b<=3&&c>>3==30){this.charLength=4;break}}this.charReceived=b},j.prototype.end=function(a){var b="";if(a&&a.length&&(b=this.write(a)),this.charReceived){var c=this.charReceived,d=this.charBuffer,e=this.encoding;b+=d.slice(0,c).toString(e)}return b}},{buffer:2}],36:[function(a,b,c){(function(a){function c(a,b){function c(){if(!e){if(d("throwDeprecation"))throw new Error(b);d("traceDeprecation")?console.trace(b):console.warn(b),e=!0}return a.apply(this,arguments)}if(d("noDeprecation"))return a;var e=!1;return c}function d(b){try{if(!a.localStorage)return!1}catch(a){return!1}var c=a.localStorage[b];return null!=c&&"true"===String(c).toLowerCase()}b.exports=c}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],37:[function(a,b,c){"use strict";var d=this&&this.__extends||function(a,b){function c(){this.constructor=a}for(var d in b)b.hasOwnProperty(d)&&(a[d]=b[d]);a.prototype=null===b?Object.create(b):(c.prototype=b.prototype,new c)},e=a("../core/file_system"),f=a("../core/api_error"),g=a("../core/file_flag"),h=a("../generic/preload_file"),i=a("path"),j=function(a){function b(b,c,d,e,f){a.call(this,b,c,d,e,f)}return d(b,a),b.prototype.syncSync=function(){this.isDirty()&&(this._fs._syncSync(this),this.resetDirty())},b.prototype.closeSync=function(){this.syncSync()},b}(h.PreloadFile),k=function(a){function b(b,c){if(a.call(this),this._queue=[],this._queueRunning=!1,this._isInitialized=!1,this._initializeCallbacks=[],this._sync=b,this._async=c,!b.supportsSynch())throw new Error("The first argument to AsyncMirror needs to be a synchronous file system.")}return d(b,a),b.prototype.getName=function(){return"AsyncMirror"},b.isAvailable=function(){return!0},b.prototype._syncSync=function(a){this._sync.writeFileSync(a.getPath(),a.getBuffer(),null,g.FileFlag.getFileFlag("w"),a.getStats().mode),this.enqueueOp({apiMethod:"writeFile",arguments:[a.getPath(),a.getBuffer(),null,a.getFlag(),a.getStats().mode]})},b.prototype.initialize=function(a){var b=this,c=this._initializeCallbacks,d=function(a){b._isInitialized=!a,b._initializeCallbacks=[],c.forEach(function(b){return b(a)})};if(this._isInitialized)a();else if(1===c.push(a)){var e=function(a,c,d){"/"!==a&&b._sync.mkdirSync(a,c),b._async.readdir(a,function(b,c){function e(b){b?d(b):f0){var d=b._queue.shift(),e=d.arguments;e.push(c),b._async[d.apiMethod].apply(b._async,e)}else b._queueRunning=!1};c()}},b.prototype.renameSync=function(a,b){this.checkInitialized(),this._sync.renameSync(a,b),this.enqueueOp({apiMethod:"rename",arguments:[a,b]})},b.prototype.statSync=function(a,b){return this.checkInitialized(),this._sync.statSync(a,b)},b.prototype.openSync=function(a,b,c){this.checkInitialized();var d=this._sync.openSync(a,b,c);return d.closeSync(),new j(this,a,b,this._sync.statSync(a,!1),this._sync.readFileSync(a,null,g.FileFlag.getFileFlag("r")))},b.prototype.unlinkSync=function(a){this.checkInitialized(),this._sync.unlinkSync(a),this.enqueueOp({apiMethod:"unlink",arguments:[a]})},b.prototype.rmdirSync=function(a){this.checkInitialized(),this._sync.rmdirSync(a),this.enqueueOp({apiMethod:"rmdir",arguments:[a]})},b.prototype.mkdirSync=function(a,b){this.checkInitialized(),this._sync.mkdirSync(a,b),this.enqueueOp({apiMethod:"mkdir",arguments:[a,b]})},b.prototype.readdirSync=function(a){return this.checkInitialized(),this._sync.readdirSync(a)},b.prototype.existsSync=function(a){return this.checkInitialized(),this._sync.existsSync(a)},b.prototype.chmodSync=function(a,b,c){this.checkInitialized(),this._sync.chmodSync(a,b,c),this.enqueueOp({apiMethod:"chmod",arguments:[a,b,c]})},b.prototype.chownSync=function(a,b,c,d){this.checkInitialized(),this._sync.chownSync(a,b,c,d),this.enqueueOp({apiMethod:"chown",arguments:[a,b,c,d]})},b.prototype.utimesSync=function(a,b,c){this.checkInitialized(),this._sync.utimesSync(a,b,c),this.enqueueOp({apiMethod:"utimes",arguments:[a,b,c]})},b}(e.SynchronousFileSystem);c.__esModule=!0,c.default=k},{"../core/api_error":52,"../core/file_flag":56,"../core/file_system":57,"../generic/preload_file":68,path:10}],38:[function(a,b,c){(function(b){"use strict";function d(){null===p&&(p={},p[Dropbox.ApiError.NETWORK_ERROR]=l.ErrorCode.EIO,p[Dropbox.ApiError.INVALID_PARAM]=l.ErrorCode.EINVAL,p[Dropbox.ApiError.INVALID_TOKEN]=l.ErrorCode.EPERM,p[Dropbox.ApiError.OAUTH_ERROR]=l.ErrorCode.EPERM,p[Dropbox.ApiError.NOT_FOUND]=l.ErrorCode.ENOENT,p[Dropbox.ApiError.INVALID_METHOD]=l.ErrorCode.EINVAL,p[Dropbox.ApiError.NOT_ACCEPTABLE]=l.ErrorCode.EINVAL,p[Dropbox.ApiError.CONFLICT]=l.ErrorCode.EINVAL,p[Dropbox.ApiError.RATE_LIMITED]=l.ErrorCode.EBUSY,p[Dropbox.ApiError.SERVER_ERROR]=l.ErrorCode.EBUSY,p[Dropbox.ApiError.OVER_QUOTA]=l.ErrorCode.ENOSPC)}function e(a){return a&&a.stat.isFile}function f(a){return a&&a.stat.isFolder}function g(a){return null===a||void 0===a||"object"==typeof a&&"number"==typeof a.byteLength}var h=this&&this.__extends||function(a,b){function c(){this.constructor=a}for(var d in b)b.hasOwnProperty(d)&&(a[d]=b[d]);a.prototype=null===b?Object.create(b):(c.prototype=b.prototype,new c)},i=a("../generic/preload_file"),j=a("../core/file_system"),k=a("../core/node_fs_stats"),l=a("../core/api_error"),m=a("async"),n=a("path"),o=a("../core/util"),p=null,q=function(){function a(a){this._cache={},this._client=a}return a.prototype.getCachedInfo=function(a){return this._cache[a.toLowerCase()]},a.prototype.putCachedInfo=function(a,b){this._cache[a.toLowerCase()]=b},a.prototype.deleteCachedInfo=function(a){delete this._cache[a.toLowerCase()]},a.prototype.getCachedDirInfo=function(a){var b=this.getCachedInfo(a);return f(b)?b:null},a.prototype.getCachedFileInfo=function(a){var b=this.getCachedInfo(a);return e(b)?b:null},a.prototype.updateCachedDirInfo=function(a,b,c){void 0===c&&(c=null);var d=this.getCachedInfo(a);null===b.contentHash||void 0!==d&&d.stat.contentHash===b.contentHash||this.putCachedInfo(a,{stat:b,contents:c})},a.prototype.updateCachedFileInfo=function(a,b,c){ +void 0===c&&(c=null);var d=this.getCachedInfo(a);null===b.versionTag||void 0!==d&&d.stat.versionTag===b.versionTag||this.putCachedInfo(a,{stat:b,contents:c})},a.prototype.updateCachedInfo=function(a,b,c){void 0===c&&(c=null),b.isFile&&g(c)?this.updateCachedFileInfo(a,b,c):b.isFolder&&Array.isArray(c)&&this.updateCachedDirInfo(a,b,c)},a.prototype.readdir=function(a,b){var c=this,d=this.getCachedDirInfo(a);this._wrap(function(b){null!==d&&d.contents?c._client.readdir(a,{contentHash:d.stat.contentHash},b):c._client.readdir(a,b)},function(e,f,g,h){e?e.status===Dropbox.ApiError.NO_CONTENT&&null!==d?b(null,d.contents.slice(0)):b(e):(c.updateCachedDirInfo(a,g,f.slice(0)),h.forEach(function(b){c.updateCachedInfo(n.join(a,b.name),b)}),b(null,f))})},a.prototype.remove=function(a,b){var c=this;this._wrap(function(b){c._client.remove(a,b)},function(d,e){d||c.updateCachedInfo(a,e),b(d)})},a.prototype.move=function(a,b,c){var d=this;this._wrap(function(c){d._client.move(a,b,c)},function(e,f){e||(d.deleteCachedInfo(a),d.updateCachedInfo(b,f)),c(e)})},a.prototype.stat=function(a,b){var c=this;this._wrap(function(b){c._client.stat(a,b)},function(d,e){d||c.updateCachedInfo(a,e),b(d,e)})},a.prototype.readFile=function(a,b){var c=this,d=this.getCachedFileInfo(a);null!==d&&null!==d.contents?this.stat(a,function(e,f){e?b(e):f.contentHash===d.stat.contentHash?b(e,d.contents.slice(0),d.stat):c.readFile(a,b)}):this._wrap(function(b){c._client.readFile(a,{arrayBuffer:!0},b)},function(d,e,f){d||c.updateCachedInfo(a,f,e.slice(0)),b(d,e,f)})},a.prototype.writeFile=function(a,b,c){var d=this;this._wrap(function(c){d._client.writeFile(a,b,c)},function(e,f){e||d.updateCachedInfo(a,f,b.slice(0)),c(e,f)})},a.prototype.mkdir=function(a,b){var c=this;this._wrap(function(b){c._client.mkdir(a,b)},function(d,e){d||c.updateCachedInfo(a,e,[]),b(d)})},a.prototype._wrap=function(a,b){var c=0,d=function(e){var f=2;if(e&&3>++c)switch(e.status){case Dropbox.ApiError.SERVER_ERROR:case Dropbox.ApiError.NETWORK_ERROR:case Dropbox.ApiError.RATE_LIMITED:setTimeout(function(){a(d)},1e3*f);break;default:b.apply(null,arguments)}else b.apply(null,arguments)};a(d)},a}(),r=function(a){function b(b,c,d,e,f){a.call(this,b,c,d,e,f)}return h(b,a),b.prototype.sync=function(a){var b=this;if(this.isDirty()){var c=this.getBuffer(),d=o.buffer2ArrayBuffer(c);this._fs._writeFileStrict(this.getPath(),d,function(c){c||b.resetDirty(),a(c)})}else a()},b.prototype.close=function(a){this.sync(a)},b}(i.PreloadFile);c.DropboxFile=r;var s=function(a){function c(b){a.call(this),this._client=new q(b),d()}return h(c,a),c.prototype.getName=function(){return"Dropbox"},c.isAvailable=function(){return"undefined"!=typeof Dropbox},c.prototype.isReadOnly=function(){return!1},c.prototype.supportsSymlinks=function(){return!1},c.prototype.supportsProps=function(){return!1},c.prototype.supportsSynch=function(){return!1},c.prototype.empty=function(a){var b=this;this._client.readdir("/",function(c,d){if(c)a(b.convert(c,"/"));else{var e=function(a,c){var d=n.join("/",a);b._client.remove(d,function(a){c(a?b.convert(a,d):null)})},f=function(b){b?a(b):a()};m.each(d,e,f)}})},c.prototype.rename=function(a,b,c){var d=this;this._client.move(a,b,function(e){e?d._client.stat(b,function(f,g){if(f||g.isFolder){var h=e.response.error.indexOf(a)>-1?a:b;c(d.convert(e,h))}else d._client.remove(b,function(e){e?c(d.convert(e,b)):d.rename(a,b,c)})}):c()})},c.prototype.stat=function(a,b,c){var d=this;this._client.stat(a,function(b,e){if(b)c(d.convert(b,a));else{if(null==e||!e.isRemoved){var f=new k.default(d._statType(e),e.size);return c(null,f)}c(l.ApiError.FileError(l.ErrorCode.ENOENT,a))}})},c.prototype.open=function(a,c,d,e){var f=this;this._client.readFile(a,function(d,g,h){if(!d){var i;i=null===g?new b(0):o.arrayBuffer2Buffer(g);var j=f._makeFile(a,c,h,i);return e(null,j)}if(c.isReadable())e(f.convert(d,a));else switch(d.status){case Dropbox.ApiError.NOT_FOUND:var k=new ArrayBuffer(0);return f._writeFileStrict(a,k,function(b,d){if(b)e(b);else{var g=f._makeFile(a,c,d,o.arrayBuffer2Buffer(k));e(null,g)}});default:return e(f.convert(d,a))}})},c.prototype._writeFileStrict=function(a,b,c){var d=this,e=n.dirname(a);this.stat(e,!1,function(f,g){f?c(l.ApiError.FileError(l.ErrorCode.ENOENT,e)):d._client.writeFile(a,b,function(b,e){b?c(d.convert(b,a)):c(null,e)})})},c.prototype._statType=function(a){return a.isFile?k.FileType.FILE:k.FileType.DIRECTORY},c.prototype._makeFile=function(a,b,c,d){var e=this._statType(c),f=new k.default(e,c.size);return new r(this,a,b,f,d)},c.prototype._remove=function(a,b,c){var d=this;this._client.stat(a,function(e,f){e?b(d.convert(e,a)):f.isFile&&!c?b(l.ApiError.FileError(l.ErrorCode.ENOTDIR,a)):!f.isFile&&c?b(l.ApiError.FileError(l.ErrorCode.EISDIR,a)):d._client.remove(a,function(c){b(c?d.convert(c,a):null)})})},c.prototype.unlink=function(a,b){this._remove(a,b,!0)},c.prototype.rmdir=function(a,b){this._remove(a,b,!1)},c.prototype.mkdir=function(a,b,c){var d=this,e=n.dirname(a);this._client.stat(e,function(b,f){b?c(d.convert(b,e)):d._client.mkdir(a,function(b){c(b?l.ApiError.FileError(l.ErrorCode.EEXIST,a):null)})})},c.prototype.readdir=function(a,b){var c=this;this._client.readdir(a,function(a,d){return a?b(c.convert(a)):b(null,d)})},c.prototype.convert=function(a,b){void 0===b&&(b=null);var c=p[a.status];return void 0===c&&(c=l.ErrorCode.EIO),null==b?new l.ApiError(c):l.ApiError.FileError(c,b)},c}(j.BaseFileSystem);c.__esModule=!0,c.default=s}).call(this,a("bfs-buffer").Buffer)},{"../core/api_error":52,"../core/file_system":57,"../core/node_fs_stats":60,"../core/util":61,"../generic/preload_file":68,async:1,"bfs-buffer":2,path:10}],39:[function(a,b,c){(function(b){"use strict";function d(a,b){void 0===b&&(b="");for(var c=a.errno,d=a.node,e=[];d&&(e.unshift(d.name),d!==d.parent);)d=d.parent;return new j.ApiError(c,j.ErrorStrings[c],e.length>0?"/"+e.join("/"):b)}var e=this&&this.__extends||function(a,b){function c(){this.constructor=a}for(var d in b)b.hasOwnProperty(d)&&(a[d]=b[d]);a.prototype=null===b?Object.create(b):(c.prototype=b.prototype,new c)},f=a("../core/file_system"),g=a("../core/node_fs_stats"),h=a("../core/file"),i=a("../core/util"),j=a("../core/api_error"),k=function(a){function b(b,c,d,e,f){a.call(this),this._fs=b,this._FS=c,this._path=d,this._flag=e,this._stream=f}return e(b,a),b.prototype.getPos=function(){},b.prototype.close=function(a){var b=null;try{this.closeSync()}catch(a){b=a}finally{a(b)}},b.prototype.closeSync=function(){try{this._FS.close(this._stream)}catch(a){throw d(a,this._path)}},b.prototype.stat=function(a){try{a(null,this.statSync())}catch(b){a(b)}},b.prototype.statSync=function(){try{return this._fs.statSync(this._path,!1)}catch(a){throw d(a,this._path)}},b.prototype.truncate=function(a,b){var c=null;try{this.truncateSync(a)}catch(a){c=a}finally{b(c)}},b.prototype.truncateSync=function(a){try{this._FS.ftruncate(this._stream.fd,a)}catch(a){throw d(a,this._path)}},b.prototype.write=function(a,b,c,d,e){try{e(null,this.writeSync(a,b,c,d),a)}catch(a){e(a)}},b.prototype.writeSync=function(a,b,c,e){try{var f=i.buffer2Uint8array(a);return null===e&&(e=void 0),this._FS.write(this._stream,f,b,c,e)}catch(a){throw d(a,this._path)}},b.prototype.read=function(a,b,c,d,e){try{e(null,this.readSync(a,b,c,d),a)}catch(a){e(a)}},b.prototype.readSync=function(a,b,c,e){try{var f=i.buffer2Uint8array(a);return null===e&&(e=void 0),this._FS.read(this._stream,f,b,c,e)}catch(a){throw d(a,this._path)}},b.prototype.sync=function(a){a()},b.prototype.syncSync=function(){},b.prototype.chown=function(a,b,c){var d=null;try{this.chownSync(a,b)}catch(a){d=a}finally{c(d)}},b.prototype.chownSync=function(a,b){try{this._FS.fchown(this._stream.fd,a,b)}catch(a){throw d(a,this._path)}},b.prototype.chmod=function(a,b){var c=null;try{this.chmodSync(a)}catch(a){c=a}finally{b(c)}},b.prototype.chmodSync=function(a){try{this._FS.fchmod(this._stream.fd,a)}catch(a){throw d(a,this._path)}},b.prototype.utimes=function(a,b,c){var d=null;try{this.utimesSync(a,b)}catch(a){d=a}finally{c(d)}},b.prototype.utimesSync=function(a,b){this._fs.utimesSync(this._path,a,b)},b}(h.BaseFile);c.EmscriptenFile=k;var l=function(a){function c(b){a.call(this),this._FS=b}return e(c,a),c.isAvailable=function(){return!0},c.prototype.getName=function(){return this._FS.DB_NAME()},c.prototype.isReadOnly=function(){return!1},c.prototype.supportsLinks=function(){return!0},c.prototype.supportsProps=function(){return!0},c.prototype.supportsSynch=function(){return!0},c.prototype.renameSync=function(a,b){try{this._FS.rename(a,b)}catch(c){throw c.errno===j.ErrorCode.ENOENT?d(c,this.existsSync(a)?b:a):d(c)}},c.prototype.statSync=function(a,b){try{var c=b?this._FS.lstat(a):this._FS.stat(a),e=this.modeToFileType(c.mode);return new g.default(e,c.size,c.mode,c.atime,c.mtime,c.ctime)}catch(b){throw d(b,a)}},c.prototype.modeToFileType=function(a){return this._FS.isDir(a)?g.FileType.DIRECTORY:this._FS.isFile(a)?g.FileType.FILE:this._FS.isLink(a)?g.FileType.SYMLINK:void 0},c.prototype._tryStats=function(a){try{return this.statSync(a,!1)}catch(a){return null}},c.prototype.openSync=function(a,b,c){try{var e=this._FS.open(a,b.getFlagString(),c);if(this._FS.isDir(e.node.mode))throw this._FS.close(e),j.ApiError.EISDIR(a);return new k(this,this._FS,a,b,e)}catch(b){throw d(b,a)}},c.prototype.unlinkSync=function(a){try{this._FS.unlink(a)}catch(b){throw d(b,a)}},c.prototype.rmdirSync=function(a){try{this._FS.rmdir(a)}catch(b){throw d(b,a)}},c.prototype.mkdirSync=function(a,b){try{this._FS.mkdir(a,b)}catch(b){throw d(b,a)}},c.prototype.readdirSync=function(a){try{return this._FS.readdir(a).filter(function(a){return"."!==a&&".."!==a})}catch(b){throw d(b,a)}},c.prototype.truncateSync=function(a,b){try{this._FS.truncate(a,b)}catch(b){throw d(b,a)}},c.prototype.readFileSync=function(a,b,c){try{var e=this._FS.readFile(a,{flags:c.getFlagString()}),f=i.uint8Array2Buffer(e);return b?f.toString(b):f}catch(b){throw d(b,a)}},c.prototype.writeFileSync=function(a,c,e,f,g){try{e&&(c=new b(c,e));var h=i.buffer2Uint8array(c);this._FS.writeFile(a,h,{flags:f.getFlagString(),encoding:"binary"}),this._FS.chmod(a,g)}catch(b){throw d(b,a)}},c.prototype.chmodSync=function(a,b,c){try{b?this._FS.lchmod(a,c):this._FS.chmod(a,c)}catch(b){throw d(b,a)}},c.prototype.chownSync=function(a,b,c,e){try{b?this._FS.lchown(a,c,e):this._FS.chown(a,c,e)}catch(b){throw d(b,a)}},c.prototype.symlinkSync=function(a,b,c){try{this._FS.symlink(a,b)}catch(a){throw d(a)}},c.prototype.readlinkSync=function(a){try{return this._FS.readlink(a)}catch(b){throw d(b,a)}},c.prototype.utimesSync=function(a,b,c){try{this._FS.utime(a,b.getTime(),c.getTime())}catch(b){throw d(b,a)}},c}(f.SynchronousFileSystem);c.__esModule=!0,c.default=l}).call(this,a("bfs-buffer").Buffer)},{"../core/api_error":52,"../core/file":55,"../core/file_system":57,"../core/node_fs_stats":60,"../core/util":61,"bfs-buffer":2}],40:[function(a,b,c){"use strict";function d(a,b){if(null!==b&&"object"==typeof b){var c=b,d=c.path;d&&(d="/"+i.relative(a,d),c.message=c.message.replace(c.path,d),c.path=d)}return b}function e(a,b){return"function"==typeof b?function(c){arguments.length>0&&(arguments[0]=d(a,c)),b.apply(null,arguments)}:b}function f(a,b,c){return"Sync"!==a.slice(a.length-4)?function(){return arguments.length>0&&(b&&(arguments[0]=i.join(this._folder,arguments[0])),c&&(arguments[1]=i.join(this._folder,arguments[1])),arguments[arguments.length-1]=e(this._folder,arguments[arguments.length-1])),this._wrapped[a].apply(this._wrapped,arguments)}:function(){try{return b&&(arguments[0]=i.join(this._folder,arguments[0])),c&&(arguments[1]=i.join(this._folder,arguments[1])),this._wrapped[a].apply(this._wrapped,arguments)}catch(a){throw d(this._folder,a)}}}var g=this&&this.__extends||function(a,b){function c(){this.constructor=a}for(var d in b)b.hasOwnProperty(d)&&(a[d]=b[d]);a.prototype=null===b?Object.create(b):(c.prototype=b.prototype,new c)},h=a("../core/file_system"),i=a("path"),j=a("../core/api_error"),k=function(a){function b(b,c){a.call(this),this._folder=b,this._wrapped=c}return g(b,a),b.prototype.initialize=function(a){var b=this;this._wrapped.exists(this._folder,function(c){c?a():b._wrapped.isReadOnly()?a(j.ApiError.ENOENT(b._folder)):b._wrapped.mkdir(b._folder,511,a)})},b.prototype.getName=function(){return this._wrapped.getName()},b.prototype.isReadOnly=function(){return this._wrapped.isReadOnly()},b.prototype.supportsProps=function(){return this._wrapped.supportsProps()},b.prototype.supportsSynch=function(){return this._wrapped.supportsSynch()},b.prototype.supportsLinks=function(){return!1},b.isAvailable=function(){return!0},b}(h.BaseFileSystem);c.__esModule=!0,c.default=k,["diskSpace","stat","statSync","open","openSync","unlink","unlinkSync","rmdir","rmdirSync","mkdir","mkdirSync","readdir","readdirSync","exists","existsSync","realpath","realpathSync","truncate","truncateSync","readFile","readFileSync","writeFile","writeFileSync","appendFile","appendFileSync","chmod","chmodSync","chown","chownSync","utimes","utimesSync","readlink","readlinkSync"].forEach(function(a){k.prototype[a]=f(a,!0,!1)}),["rename","renameSync","link","linkSync","symlink","symlinkSync"].forEach(function(a){k.prototype[a]=f(a,!0,!0)})},{"../core/api_error":52,"../core/file_system":57,path:10}],41:[function(a,b,c){"use strict";function d(a){return a.isDirectory}function e(a,b,c,d){if("undefined"!=typeof navigator.webkitPersistentStorage)switch(a){case n.PERSISTENT:navigator.webkitPersistentStorage.requestQuota(b,c,d);break;case n.TEMPORARY:navigator.webkitTemporaryStorage.requestQuota(b,c,d);break;default:d(new TypeError("Invalid storage type: "+a))}else n.webkitStorageInfo.requestQuota(a,b,c,d)}function f(a){return Array.prototype.slice.call(a||[],0)}var g=this&&this.__extends||function(a,b){function c(){this.constructor=a}for(var d in b)b.hasOwnProperty(d)&&(a[d]=b[d]);a.prototype=null===b?Object.create(b):(c.prototype=b.prototype,new c)},h=a("../generic/preload_file"),i=a("../core/file_system"),j=a("../core/api_error"),k=a("../core/file_flag"),l=a("../core/node_fs_stats"),m=a("path"),n=a("../core/global"),o=a("async"),p=a("../core/util"),q=n.webkitRequestFileSystem||n.requestFileSystem||null,r=function(a){function b(b,c,d,e,f){a.call(this,b,c,d,e,f)}return g(b,a),b.prototype.sync=function(a){var b=this;if(this.isDirty()){var c={create:!1},d=this._fs,e=function(c){c.createWriter(function(c){var e=b.getBuffer(),f=new Blob([p.buffer2ArrayBuffer(e)]),g=f.size;c.onwriteend=function(){c.onwriteend=null,c.truncate(g),b.resetDirty(),a()},c.onerror=function(c){a(d.convert(c,b.getPath(),!1))},c.write(f)})},f=function(c){a(d.convert(c,b.getPath(),!1))};d.fs.root.getFile(this.getPath(),c,e,f)}else a()},b.prototype.close=function(a){this.sync(a)},b}(h.PreloadFile);c.HTML5FSFile=r;var s=function(a){function b(b,c){void 0===b&&(b=5),void 0===c&&(c=n.PERSISTENT),a.call(this),this.size=1048576*b,this.type=c}return g(b,a),b.prototype.getName=function(){return"HTML5 FileSystem"},b.isAvailable=function(){return null!=q},b.prototype.isReadOnly=function(){return!1},b.prototype.supportsSymlinks=function(){return!1},b.prototype.supportsProps=function(){return!1},b.prototype.supportsSynch=function(){return!1},b.prototype.convert=function(a,b,c){switch(a.name){case"PathExistsError":return j.ApiError.EEXIST(b);case"QuotaExceededError":return j.ApiError.FileError(j.ErrorCode.ENOSPC,b);case"NotFoundError":return j.ApiError.ENOENT(b);case"SecurityError":return j.ApiError.FileError(j.ErrorCode.EACCES,b);case"InvalidModificationError":return j.ApiError.FileError(j.ErrorCode.EPERM,b);case"TypeMismatchError":return j.ApiError.FileError(c?j.ErrorCode.ENOTDIR:j.ErrorCode.EISDIR,b);case"EncodingError":case"InvalidStateError":case"NoModificationAllowedError":default:return j.ApiError.FileError(j.ErrorCode.EINVAL,b)}},b.prototype.allocate=function(a){var b=this;void 0===a&&(a=function(){});var c=function(c){b.fs=c,a()},d=function(c){a(b.convert(c,"/",!0))};this.type===n.PERSISTENT?e(this.type,this.size,function(a){q(b.type,a,c,d)},d):q(this.type,this.size,c,d)},b.prototype.empty=function(a){var b=this;this._readdir("/",function(c,e){if(c)console.error("Failed to empty FS"),a(c);else{var f=function(b){c?(console.error("Failed to empty FS"),a(c)):a()},g=function(a,c){var e=function(){c()},f=function(d){c(b.convert(d,a.fullPath,!a.isDirectory))};d(a)?a.removeRecursively(e,f):a.remove(e,f)};o.each(e,g,f)}})},b.prototype.rename=function(a,b,c){var d=this,e=2,f=0,g=this.fs.root,h=a,i=function(a){--e<=0&&c(d.convert(a,h,!1))},k=function(e){return 2===++f?c(new j.ApiError(j.ErrorCode.EINVAL,"Something was identified as both a file and a directory. This should never happen.")):a===b?c():(h=m.dirname(b),void g.getDirectory(h,{},function(f){h=m.basename(b),e.moveTo(f,h,function(a){c()},function(f){e.isDirectory?(h=b,d.unlink(b,function(e){e?i(f):d.rename(a,b,c)})):i(f)})},i))};g.getFile(a,{},k,i),g.getDirectory(a,{},k,i)},b.prototype.stat=function(a,b,c){var d=this,e={create:!1},f=function(a){var b=function(a){var b=new l.default(l.FileType.FILE,a.size);c(null,b)};a.file(b,h)},g=function(a){var b=4096,d=new l.default(l.FileType.DIRECTORY,b);c(null,d)},h=function(b){c(d.convert(b,a,!1))},i=function(){d.fs.root.getDirectory(a,e,g,h)};this.fs.root.getFile(a,e,f,i)},b.prototype.open=function(a,b,c,d){var e=this,f=function(c){d("InvalidModificationError"===c.name&&b.isExclusive()?j.ApiError.EEXIST(a):e.convert(c,a,!1))};this.fs.root.getFile(a,{create:b.pathNotExistsAction()===k.ActionType.CREATE_FILE,exclusive:b.isExclusive()},function(c){c.file(function(c){var g=new FileReader;g.onloadend=function(f){var h=e._makeFile(a,b,c,g.result);d(null,h)},g.onerror=function(a){f(g.error)},g.readAsArrayBuffer(c)},f)},f)},b.prototype._statType=function(a){return a.isFile?l.FileType.FILE:l.FileType.DIRECTORY},b.prototype._makeFile=function(a,b,c,d){void 0===d&&(d=new ArrayBuffer(0));var e=new l.default(l.FileType.FILE,c.size),f=p.arrayBuffer2Buffer(d);return new r(this,a,b,e,f)},b.prototype._remove=function(a,b,c){var d=this,e=function(e){var f=function(){b()},g=function(e){b(d.convert(e,a,!c))};e.remove(f,g)},f=function(e){b(d.convert(e,a,!c))},g={create:!1};c?this.fs.root.getFile(a,g,e,f):this.fs.root.getDirectory(a,g,e,f)},b.prototype.unlink=function(a,b){this._remove(a,b,!0)},b.prototype.rmdir=function(a,b){var c=this;this.readdir(a,function(d,e){d?b(d):e.length>0?b(j.ApiError.ENOTEMPTY(a)):c._remove(a,b,!1)})},b.prototype.mkdir=function(a,b,c){var d=this,e={create:!0,exclusive:!0},f=function(a){c()},g=function(b){c(d.convert(b,a,!0))};this.fs.root.getDirectory(a,e,f,g)},b.prototype._readdir=function(a,b){var c=this,d=function(d){b(c.convert(d,a,!0))};this.fs.root.getDirectory(a,{create:!1},function(a){var c=a.createReader(),e=[],g=function(){c.readEntries(function(a){a.length?(e=e.concat(f(a)),g()):b(null,e)},d)};g()},d)},b.prototype.readdir=function(a,b){this._readdir(a,function(a,c){if(a)return b(a);for(var d=[],e=0;e0&&a[0]instanceof h.ApiError&&d.standardizeError(a[0],f.path,e),g.apply(null,a)}}return f.fs[a].apply(f.fs,b)}}var e=this&&this.__extends||function(a,b){function c(){this.constructor=a}for(var d in b)b.hasOwnProperty(d)&&(a[d]=b[d]);a.prototype=null===b?Object.create(b):(c.prototype=b.prototype,new c)},f=a("../core/file_system"),g=a("./InMemory"),h=a("../core/api_error"),i=a("../core/node_fs"),j=a("path"),k=a("../core/util"),l=function(a){function b(){a.call(this),this.mountList=[],this.mntMap={},this.rootFs=new g.default}return e(b,a),b.prototype.mount=function(a,b){if("/"!==a[0]&&(a="/"+a),a=j.resolve(a),this.mntMap[a])throw new h.ApiError(h.ErrorCode.EINVAL,"Mount point "+a+" is already taken.");k.mkdirpSync(a,511,this.rootFs),this.mntMap[a]=b,this.mountList.push(a),this.mountList=this.mountList.sort(function(a,b){return b.length-a.length})},b.prototype.umount=function(a){if("/"!==a[0]&&(a="/"+a),a=j.resolve(a),!this.mntMap[a])throw new h.ApiError(h.ErrorCode.EINVAL,"Mount point "+a+" is already unmounted.");for(delete this.mntMap[a],this.mountList.splice(this.mountList.indexOf(a),1);"/"!==a&&0===this.rootFs.readdirSync(a).length;)this.rootFs.rmdirSync(a),a=j.dirname(a)},b.prototype._getFs=function(a){for(var b=this.mountList,c=b.length,d=0;d1?e.length:0),""===a&&(a="/"),{fs:this.mntMap[e],path:a}}return{fs:this.rootFs,path:a}},b.prototype.getName=function(){return"MountableFileSystem"},b.isAvailable=function(){return!0},b.prototype.diskSpace=function(a,b){b(0,0)},b.prototype.isReadOnly=function(){return!1},b.prototype.supportsLinks=function(){return!1},b.prototype.supportsProps=function(){return!1},b.prototype.supportsSynch=function(){return!0},b.prototype.standardizeError=function(a,b,c){var d;return-1!==(d=a.message.indexOf(b))&&(a.message=a.message.substr(0,d)+c+a.message.substr(d+b.length),a.path=c),a},b.prototype.rename=function(a,b,c){var d=this._getFs(a),e=this._getFs(b);if(d.fs===e.fs){var f=this;return d.fs.rename(d.path,e.path,function(g){g&&f.standardizeError(f.standardizeError(g,d.path,a),e.path,b),c(g)})}return i.readFile(a,function(d,e){return d?c(d):void i.writeFile(b,e,function(b){return b?c(b):void i.unlink(a,c)})})},b.prototype.renameSync=function(a,b){var c=this._getFs(a),d=this._getFs(b);if(c.fs===d.fs)try{return c.fs.renameSync(c.path,d.path)}catch(e){throw this.standardizeError(this.standardizeError(e,c.path,a),d.path,b),e}var e=i.readFileSync(a);return i.writeFileSync(b,e),i.unlinkSync(a)},b.prototype.readdirSync=function(a){var b=this._getFs(a),c=null;if(b.fs!==this.rootFs)try{c=this.rootFs.readdirSync(a)}catch(a){}try{var d=b.fs.readdirSync(b.path);return null===c?d:d.concat(c.filter(function(a){return d.indexOf(a)===-1}))}catch(d){if(null===c)throw this.standardizeError(d,b.path,a);return c}},b.prototype.readdir=function(a,b){var c=this,d=this._getFs(a);d.fs.readdir(d.path,function(e,f){if(d.fs!==c.rootFs)try{var g=c.rootFs.readdirSync(a);f=f?f.concat(g.filter(function(a){return f.indexOf(a)===-1})):g}catch(f){if(e)return b(c.standardizeError(e,d.path,a))}else if(e)return b(c.standardizeError(e,d.path,a));b(null,f)})},b.prototype.rmdirSync=function(a){var b=this._getFs(a);if(this._containsMountPt(a))throw h.ApiError.ENOTEMPTY(a);try{b.fs.rmdirSync(b.path)}catch(c){throw this.standardizeError(c,b.path,a)}},b.prototype._containsMountPt=function(a){for(var b=this.mountList,c=b.length,d=0;d=a.length&&e.slice(0,a.length)===a)return!0}return!1},b.prototype.rmdir=function(a,b){var c=this,d=this._getFs(a);this._containsMountPt(a)?b(h.ApiError.ENOTEMPTY(a)):d.fs.rmdir(d.path,function(e){b(e?c.standardizeError(e,d.path,a):null)})},b}(f.BaseFileSystem);c.__esModule=!0,c.default=l;for(var m=[["exists","unlink","readlink"],["stat","mkdir","realpath","truncate"],["open","readFile","chmod","utimes"],["chown"],["writeFile","appendFile"]],n=0;n0)throw h.ApiError.ENOTEMPTY(b)}this._writable.existsSync(a)?this._writable.renameSync(a,b):this._writable.existsSync(b)||this._writable.mkdirSync(b,f),this._readable.existsSync(a)&&this._readable.readdirSync(a).forEach(function(d){c.renameSync(l.resolve(a,d),l.resolve(b,d))})}else{if(this.existsSync(b)&&this.statSync(b,!1).isDirectory())throw h.ApiError.EISDIR(b);this.writeFileSync(b,this.readFileSync(a,null,e("r")),null,e("w"),d.mode)}a!==b&&this.existsSync(a)&&this.unlinkSync(a)},b.prototype.stat=function(a,b,c){var e=this;this.checkInitAsync(c)&&this._writable.stat(a,b,function(f,g){f&&f.errno===h.ErrorCode.ENOENT?(e._deletedFiles[a]&&c(h.ApiError.ENOENT(a)),e._readable.stat(a,b,function(a,b){b&&(b=b.clone(),b.mode=d(b.mode)),c(a,b)})):c(f,g)})},b.prototype.statSync=function(a,b){this.checkInitialized();try{return this._writable.statSync(a,b)}catch(e){if(this._deletedFiles[a])throw h.ApiError.ENOENT(a);var c=this._readable.statSync(a,b).clone();return c.mode=d(c.mode),c}},b.prototype.open=function(a,b,c,d){var f=this;this.checkInitAsync(d)&&!this.checkPathAsync(a,d)&&this.stat(a,!1,function(g,j){if(j)switch(b.pathExistsAction()){case i.ActionType.TRUNCATE_FILE:return f.createParentDirectoriesAsync(a,function(e){return e?d(e):void f._writable.open(a,b,c,d)});case i.ActionType.NOP:return f._writable.exists(a,function(g){g?f._writable.open(a,b,c,d):(j=j.clone(),j.mode=c,f._readable.readFile(a,null,e("r"),function(c,e){if(c)return d(c);j.size===-1&&(j.size=e.length);var g=new n(f,a,b,j,e);d(null,g)}))});default:return d(h.ApiError.EEXIST(a))}else switch(b.pathNotExistsAction()){case i.ActionType.CREATE_FILE:return f.createParentDirectoriesAsync(a,function(e){return e?d(e):f._writable.open(a,b,c,d)});default:return d(h.ApiError.ENOENT(a))}})},b.prototype.openSync=function(a,b,c){if(this.checkInitialized(),this.checkPath(a),a===m)throw h.ApiError.EPERM("Cannot open deletion log.");if(this.existsSync(a))switch(b.pathExistsAction()){case i.ActionType.TRUNCATE_FILE:return this.createParentDirectories(a),this._writable.openSync(a,b,c);case i.ActionType.NOP:if(this._writable.existsSync(a))return this._writable.openSync(a,b,c);var d=this._readable.readFileSync(a,null,e("r")),f=this._readable.statSync(a,!1).clone();return f.mode=c,new n(this,a,b,f,d);default:throw h.ApiError.EEXIST(a)}else switch(b.pathNotExistsAction()){case i.ActionType.CREATE_FILE:return this.createParentDirectories(a),this._writable.openSync(a,b,c);default:throw h.ApiError.ENOENT(a)}},b.prototype.unlink=function(a,b){var c=this;this.checkInitAsync(b)&&!this.checkPathAsync(a,b)&&this.exists(a,function(d){return d?void c._writable.exists(a,function(d){return d?c._writable.unlink(a,function(d){return d?b(d):void c.exists(a,function(d){d&&c.deletePath(a),b(null)})}):(c.deletePath(a),void b(null))}):b(h.ApiError.ENOENT(a))})},b.prototype.unlinkSync=function(a){if(this.checkInitialized(),this.checkPath(a),!this.existsSync(a))throw h.ApiError.ENOENT(a);this._writable.existsSync(a)&&this._writable.unlinkSync(a),this.existsSync(a)&&this.deletePath(a)},b.prototype.rmdir=function(a,b){var c=this;if(this.checkInitAsync(b)){var d=function(){c.readdir(a,function(d,e){return d?b(d):e.length?b(h.ApiError.ENOTEMPTY(a)):(c.deletePath(a),void b(null))})};this.exists(a,function(e){return e?void c._writable.exists(a,function(e){e?c._writable.rmdir(a,function(e){return e?b(e):void c._readable.exists(a,function(a){a?d():b()})}):d()}):b(h.ApiError.ENOENT(a))})}},b.prototype.rmdirSync=function(a){if(this.checkInitialized(),!this.existsSync(a))throw h.ApiError.ENOENT(a);if(this._writable.existsSync(a)&&this._writable.rmdirSync(a),this.existsSync(a)){if(this.readdirSync(a).length>0)throw h.ApiError.ENOTEMPTY(a);this.deletePath(a)}},b.prototype.mkdir=function(a,b,c){var d=this;this.checkInitAsync(c)&&this.exists(a,function(e){return e?c(h.ApiError.EEXIST(a)):void d.createParentDirectoriesAsync(a,function(e){return e?c(e):void d._writable.mkdir(a,b,c)})})},b.prototype.mkdirSync=function(a,b){if(this.checkInitialized(),this.existsSync(a))throw h.ApiError.EEXIST(a);this.createParentDirectories(a),this._writable.mkdirSync(a,b)},b.prototype.readdir=function(a,b){var c=this;this.checkInitAsync(b)&&this.stat(a,!1,function(d,e){return d?b(d):e.isDirectory()?void c._writable.readdir(a,function(d,e){return d&&"ENOENT"!==d.code?b(d):(!d&&e||(e=[]),void c._readable.readdir(a,function(d,f){!d&&f||(f=[]);var g={},h=e.concat(f.filter(function(b){return!c._deletedFiles[a+"/"+b]})).filter(function(a){var b=!g[a];return g[a]=!0,b});b(null,h)}))}):b(h.ApiError.ENOTDIR(a))})},b.prototype.readdirSync=function(a){var b=this;this.checkInitialized();var c=this.statSync(a,!1);if(!c.isDirectory())throw h.ApiError.ENOTDIR(a);var d=[];try{d=d.concat(this._writable.readdirSync(a))}catch(a){}try{d=d.concat(this._readable.readdirSync(a).filter(function(c){return!b._deletedFiles[a+"/"+c]}))}catch(a){}var e={};return d.filter(function(a){var b=!e[a];return e[a]=!0,b})},b.prototype.exists=function(a,b){var c=this;this.checkInitialized(),this._writable.exists(a,function(d){return d?b(!0):void c._readable.exists(a,function(d){b(d&&c._deletedFiles[a]!==!0)})})},b.prototype.existsSync=function(a){return this.checkInitialized(),this._writable.existsSync(a)||this._readable.existsSync(a)&&this._deletedFiles[a]!==!0},b.prototype.chmod=function(a,b,c,d){var e=this;this.checkInitAsync(d)&&this.operateOnWritableAsync(a,function(f){return f?d(f):void e._writable.chmod(a,b,c,d)})},b.prototype.chmodSync=function(a,b,c){var d=this;this.checkInitialized(),this.operateOnWritable(a,function(){d._writable.chmodSync(a,b,c)})},b.prototype.chown=function(a,b,c,d,e){var f=this;this.checkInitAsync(e)&&this.operateOnWritableAsync(a,function(g){return g?e(g):void f._writable.chown(a,b,c,d,e)})},b.prototype.chownSync=function(a,b,c,d){var e=this;this.checkInitialized(),this.operateOnWritable(a,function(){e._writable.chownSync(a,b,c,d)})},b.prototype.utimes=function(a,b,c,d){var e=this;this.checkInitAsync(d)&&this.operateOnWritableAsync(a,function(f){return f?d(f):void e._writable.utimes(a,b,c,d)})},b.prototype.utimesSync=function(a,b,c){var d=this;this.checkInitialized(),this.operateOnWritable(a,function(){d._writable.utimesSync(a,b,c)})},b.prototype.operateOnWritable=function(a,b){if(!this.existsSync(a))throw h.ApiError.ENOENT(a);this._writable.existsSync(a)||this.copyToWritable(a),b()},b.prototype.operateOnWritableAsync=function(a,b){var c=this;this.exists(a,function(d){return d?void c._writable.exists(a,function(d){return d?void b():c.copyToWritableAsync(a,b)}):b(h.ApiError.ENOENT(a))})},b.prototype.copyToWritable=function(a){var b=this.statSync(a,!1);b.isDirectory()?this._writable.mkdirSync(a,b.mode):this.writeFileSync(a,this._readable.readFileSync(a,null,e("r")),null,e("w"),this.statSync(a,!1).mode)},b.prototype.copyToWritableAsync=function(a,b){var c=this;this.stat(a,!1,function(d,f){return d?b(d):f.isDirectory()?c._writable.mkdir(a,f.mode,b):void c._readable.readFile(a,null,e("r"),function(d,g){return d?b(d):void c.writeFile(a,g,null,e("w"),f.mode,b)})})},b}(g.BaseFileSystem);c.UnlockedOverlayFS=o;var p=function(a){function b(b,c){a.call(this,new o(b,c))}return f(b,a),b.prototype.initialize=function(b){a.prototype.initialize.call(this,b)},b.isAvailable=function(){return o.isAvailable()},b.prototype.getOverlayedFileSystems=function(){return a.prototype.getFSUnlocked.call(this).getOverlayedFileSystems()},b.prototype.unwrap=function(){return a.prototype.getFSUnlocked.call(this)},b}(k.default);c.__esModule=!0,c.default=p},{"../core/api_error":52,"../core/file_flag":56,"../core/file_system":57,"../generic/locked_fs":66,"../generic/preload_file":68,path:10}],47:[function(a,b,c){(function(b){"use strict";function d(a){return{type:r.API_ERROR,errorData:l(a.writeToBuffer())}}function e(a){return u.ApiError.fromBuffer(m(a.errorData))}function f(a){return{type:r.ERROR,name:a.name,message:a.message,stack:a.stack}}function g(a){var b=A[a.name];"function"!=typeof b&&(b=Error);var c=new b(a.message);return c.stack=a.stack,c}function h(a){return{type:r.STATS,statsData:l(a.toBuffer())}}function i(a){return y.default.fromBuffer(m(a.statsData))}function j(a){return{type:r.FILEFLAG,flagStr:a.getFlagString()}}function k(a){return v.FileFlag.getFileFlag(a.flagStr)}function l(a){return w.buffer2ArrayBuffer(a)}function m(a){return w.arrayBuffer2Buffer(a)}function n(a){return{type:r.BUFFER,data:l(a)}}function o(a){return m(a.data)}function p(a){return null!=a&&"object"==typeof a&&a.hasOwnProperty("browserfsMessage")&&a.browserfsMessage}function q(a){return null!=a&&"object"==typeof a&&a.hasOwnProperty("browserfsMessage")&&a.browserfsMessage}var r,s=this&&this.__extends||function(a,b){function c(){this.constructor=a}for(var d in b)b.hasOwnProperty(d)&&(a[d]=b[d]);a.prototype=null===b?Object.create(b):(c.prototype=b.prototype,new c)},t=a("../core/file_system"),u=a("../core/api_error"),v=a("../core/file_flag"),w=a("../core/util"),x=a("../core/file"),y=a("../core/node_fs_stats"),z=a("../generic/preload_file"),A=a("../core/global"),B=a("../core/node_fs");!function(a){a[a.CB=0]="CB",a[a.FD=1]="FD",a[a.API_ERROR=2]="API_ERROR",a[a.STATS=3]="STATS",a[a.PROBE=4]="PROBE",a[a.FILEFLAG=5]="FILEFLAG",a[a.BUFFER=6]="BUFFER",a[a.ERROR=7]="ERROR"}(r||(r={}));var C=function(){function a(){this._callbacks={},this._nextId=0}return a.prototype.toRemoteArg=function(a){var b=this._nextId++;return this._callbacks[b]=a,{type:r.CB,id:b}},a.prototype.toLocalArg=function(a){var b=this._callbacks[a];return delete this._callbacks[a],b},a}(),D=function(){function a(){this._fileDescriptors={},this._nextId=0}return a.prototype.toRemoteArg=function(a,c,d,e){var f,g,h=this._nextId++;this._fileDescriptors[h]=a,a.stat(function(i,j){i?e(i):(g=l(j.toBuffer()),d.isReadable()?a.read(new b(j.size),0,j.size,0,function(a,b,i){a?e(a):(f=l(i),e(null,{type:r.FD,id:h,data:f,stat:g,path:c,flag:d.getFlagString()}))}):e(null,{type:r.FD,id:h,data:new ArrayBuffer(0),stat:g,path:c,flag:d.getFlagString()}))})},a.prototype._applyFdChanges=function(a,b){var c=this._fileDescriptors[a.id],d=m(a.data),e=y.default.fromBuffer(m(a.stat)),f=v.FileFlag.getFileFlag(a.flag);f.isWriteable()?c.write(d,0,d.length,f.isAppendable()?c.getPos():0,function(a){function g(){c.stat(function(a,d){a?b(a):d.mode!==e.mode?c.chmod(e.mode,function(a){b(a,c)}):b(a,c)})}a?b(a):f.isAppendable()?g():c.truncate(d.length,function(){g()})}):b(null,c)},a.prototype.applyFdAPIRequest=function(a,b){var c=this,d=a.args[0];this._applyFdChanges(d,function(e,f){e?b(e):f[a.method](function(e){"close"===a.method&&delete c._fileDescriptors[d.id],b(e)})})},a}(),E=function(a){function b(b,c,d,e,f,g){a.call(this,b,c,d,e,g),this._remoteFdId=f}return s(b,a),b.prototype.getRemoteFdId=function(){return this._remoteFdId},b.prototype.toRemoteArg=function(){return{type:r.FD,id:this._remoteFdId,data:l(this.getBuffer()),stat:l(this.getStats().toBuffer()),path:this.getPath(),flag:this.getFlag().getFlagString()}},b.prototype._syncClose=function(a,b){var c=this;this.isDirty()?this._fs.syncClose(a,this,function(a){a||c.resetDirty(),b(a)}):b()},b.prototype.sync=function(a){this._syncClose("sync",a)},b.prototype.close=function(a){this._syncClose("close",a)},b}(z.PreloadFile),F=function(a){function c(b){var c=this;a.call(this),this._callbackConverter=new C,this._isInitialized=!1,this._isReadOnly=!1,this._supportLinks=!1,this._supportProps=!1,this._outstandingRequests={},this._worker=b,this._worker.addEventListener("message",function(a){var b=a.data;if(q(b)){var d,e=b.args,f=new Array(e.length);for(d=0;d0&&(i=-1,g={browserfsMessage:!0,cbId:j,args:[d(b)]},a.postMessage(g))}var e,g,h=new Array(arguments.length),i=arguments.length;for(e=0;e0&&"/"!==c.charAt(c.length-1)&&(c+="/"),this.prefixUrl=c;var d=null;if("string"==typeof b){if(d=this._requestFileSync(b,"json"),!d)throw new Error("Unable to find listing at URL: ${listingUrlOrObj}")}else d=b;this._index=l.FileIndex.fromListing(d)}return e(b,a),b.prototype.empty=function(){this._index.fileIterator(function(a){a.file_data=null})},b.prototype.getXhrPath=function(a){return"/"===a.charAt(0)&&(a=a.slice(1)),this.prefixUrl+a},b.prototype._requestFileSizeAsync=function(a,b){k.getFileSizeAsync(this.getXhrPath(a),b)},b.prototype._requestFileSizeSync=function(a){return k.getFileSizeSync(this.getXhrPath(a))},b.prototype._requestFileAsync=function(a,b,c){k.asyncDownloadFile(this.getXhrPath(a),b,c)},b.prototype._requestFileSync=function(a,b){return k.syncDownloadFile(this.getXhrPath(a),b)},b.prototype.getName=function(){return"XmlHttpRequest"},b.isAvailable=function(){return"undefined"!=typeof XMLHttpRequest&&null!==XMLHttpRequest},b.prototype.diskSpace=function(a,b){b(0,0)},b.prototype.isReadOnly=function(){return!0},b.prototype.supportsLinks=function(){return!1},b.prototype.supportsProps=function(){return!1},b.prototype.supportsSynch=function(){return!0},b.prototype.preloadFile=function(a,b){var c=this._index.getInode(a);if(!l.isFileInode(c))throw g.ApiError.EISDIR(a);if(null===c)throw g.ApiError.ENOENT(a);var d=c.getData();d.size=b.length,d.file_data=b},b.prototype.stat=function(a,b,c){var d=this._index.getInode(a);if(null===d)return c(g.ApiError.ENOENT(a));var e;l.isFileInode(d)?(e=d.getData(),e.size<0?this._requestFileSizeAsync(a,function(a,b){return a?c(a):(e.size=b,void c(null,e.clone()))}):c(null,e.clone())):l.isDirInode(d)?(e=d.getStats(),c(null,e)):c(g.ApiError.FileError(g.ErrorCode.EINVAL,a))},b.prototype.statSync=function(a,b){var c=this._index.getInode(a);if(null===c)throw g.ApiError.ENOENT(a);var d;if(l.isFileInode(c))d=c.getData(),d.size<0&&(d.size=this._requestFileSizeSync(a));else{if(!l.isDirInode(c))throw g.ApiError.FileError(g.ErrorCode.EINVAL,a);d=c.getStats()}return d},b.prototype.open=function(a,b,c,d){if(b.isWriteable())return d(new g.ApiError(g.ErrorCode.EPERM,a));var e=this,f=this._index.getInode(a);if(null===f)return d(g.ApiError.ENOENT(a));if(!l.isFileInode(f))return d(g.ApiError.EISDIR(a));var i=f.getData();switch(b.pathExistsAction()){case h.ActionType.THROW_EXCEPTION:case h.ActionType.TRUNCATE_FILE:return d(g.ApiError.EEXIST(a));case h.ActionType.NOP:if(null!=i.file_data)return d(null,new j.NoSyncFile(e,a,b,i.clone(),i.file_data));this._requestFileAsync(a,"buffer",function(c,f){return c?d(c):(i.size=f.length,i.file_data=f,d(null,new j.NoSyncFile(e,a,b,i.clone(),f)))});break;default:return d(new g.ApiError(g.ErrorCode.EINVAL,"Invalid FileMode object."))}},b.prototype.openSync=function(a,b,c){if(b.isWriteable())throw new g.ApiError(g.ErrorCode.EPERM,a);var d=this._index.getInode(a);if(null===d)throw g.ApiError.ENOENT(a);if(!l.isFileInode(d))throw g.ApiError.EISDIR(a);var e=d.getData();switch(b.pathExistsAction()){case h.ActionType.THROW_EXCEPTION:case h.ActionType.TRUNCATE_FILE:throw g.ApiError.EEXIST(a);case h.ActionType.NOP:if(null!=e.file_data)return new j.NoSyncFile(this,a,b,e.clone(),e.file_data);var f=this._requestFileSync(a,"buffer");return e.size=f.length,e.file_data=f,new j.NoSyncFile(this,a,b,e.clone(),f);default:throw new g.ApiError(g.ErrorCode.EINVAL,"Invalid FileMode object.")}},b.prototype.readdir=function(a,b){try{b(null,this.readdirSync(a))}catch(a){b(a)}},b.prototype.readdirSync=function(a){var b=this._index.getInode(a);if(null===b)throw g.ApiError.ENOENT(a);if(l.isDirInode(b))return b.getListing();throw g.ApiError.ENOTDIR(a)},b.prototype.readFile=function(a,b,c,e){var f=e;this.open(a,c,420,function(a,c){if(a)return e(a);e=function(a,b){c.close(function(c){return null==a&&(a=c),f(a,b)})};var g=c,h=g.getBuffer();null===b?e(a,i.copyingSlice(h)):d(h,b,e)})},b.prototype.readFileSync=function(a,b,c){var d=this.openSync(a,c,420);try{var e=d,f=e.getBuffer();return null===b?i.copyingSlice(f):f.toString(b)}finally{d.closeSync()}},b}(f.BaseFileSystem);c.__esModule=!0,c.default=m},{"../core/api_error":52,"../core/file_flag":56,"../core/file_system":57,"../core/util":61,"../generic/file_index":63,"../generic/preload_file":68,"../generic/xhr":69}],49:[function(a,b,c){"use strict";function d(a,b){var c=31&b,d=(b>>5&15)-1,e=(b>>9)+1980,f=31&a,g=a>>5&63,h=a>>11;return new Date(e,d,c,h,g,f)}function e(a,b,c,d){return 0===d?"":b?a.toString("utf8",c,c+d):m.default.byte2str(a.slice(c,c+d))}var f=this&&this.__extends||function(a,b){function c(){this.constructor=a}for(var d in b)b.hasOwnProperty(d)&&(a[d]=b[d]);a.prototype=null===b?Object.create(b):(c.prototype=b.prototype,new c)},g=a("../core/api_error"),h=a("../core/node_fs_stats"),i=a("../core/file_system"),j=a("../core/file_flag"),k=a("../generic/preload_file"),l=a("../core/util"),m=a("bfs-buffer/js/extended_ascii"),n=a("pako/dist/pako_inflate.min").inflateRaw,o=a("../generic/file_index");!function(a){a[a.MSDOS=0]="MSDOS",a[a.AMIGA=1]="AMIGA",a[a.OPENVMS=2]="OPENVMS",a[a.UNIX=3]="UNIX",a[a.VM_CMS=4]="VM_CMS",a[a.ATARI_ST=5]="ATARI_ST",a[a.OS2_HPFS=6]="OS2_HPFS",a[a.MAC=7]="MAC",a[a.Z_SYSTEM=8]="Z_SYSTEM",a[a.CP_M=9]="CP_M",a[a.NTFS=10]="NTFS",a[a.MVS=11]="MVS",a[a.VSE=12]="VSE",a[a.ACORN_RISC=13]="ACORN_RISC",a[a.VFAT=14]="VFAT",a[a.ALT_MVS=15]="ALT_MVS",a[a.BEOS=16]="BEOS",a[a.TANDEM=17]="TANDEM",a[a.OS_400=18]="OS_400",a[a.OSX=19]="OSX"}(c.ExternalFileAttributeType||(c.ExternalFileAttributeType={}));c.ExternalFileAttributeType;!function(a){a[a.STORED=0]="STORED",a[a.SHRUNK=1]="SHRUNK",a[a.REDUCED_1=2]="REDUCED_1",a[a.REDUCED_2=3]="REDUCED_2",a[a.REDUCED_3=4]="REDUCED_3",a[a.REDUCED_4=5]="REDUCED_4",a[a.IMPLODE=6]="IMPLODE",a[a.DEFLATE=8]="DEFLATE",a[a.DEFLATE64=9]="DEFLATE64",a[a.TERSE_OLD=10]="TERSE_OLD",a[a.BZIP2=12]="BZIP2",a[a.LZMA=14]="LZMA",a[a.TERSE_NEW=18]="TERSE_NEW",a[a.LZ77=19]="LZ77",a[a.WAVPACK=97]="WAVPACK",a[a.PPMD=98]="PPMD"}(c.CompressionMethod||(c.CompressionMethod={}));var p=c.CompressionMethod,q=function(){function a(a){if(this.data=a,67324752!==a.readUInt32LE(0))throw new g.ApiError(g.ErrorCode.EINVAL,"Invalid Zip file: Local file header has invalid signature: "+this.data.readUInt32LE(0))}return a.prototype.versionNeeded=function(){return this.data.readUInt16LE(4)},a.prototype.flags=function(){return this.data.readUInt16LE(6)},a.prototype.compressionMethod=function(){return this.data.readUInt16LE(8)},a.prototype.lastModFileTime=function(){return d(this.data.readUInt16LE(10),this.data.readUInt16LE(12))},a.prototype.rawLastModFileTime=function(){return this.data.readUInt32LE(10)},a.prototype.crc32=function(){return this.data.readUInt32LE(14)},a.prototype.fileNameLength=function(){return this.data.readUInt16LE(26)},a.prototype.extraFieldLength=function(){return this.data.readUInt16LE(28)},a.prototype.fileName=function(){return e(this.data,this.useUTF8(),30,this.fileNameLength())},a.prototype.extraField=function(){var a=30+this.fileNameLength();return this.data.slice(a,a+this.extraFieldLength())},a.prototype.totalSize=function(){return 30+this.fileNameLength()+this.extraFieldLength()},a.prototype.useUTF8=function(){return 2048===(2048&this.flags())},a}();c.FileHeader=q;var r=function(){function a(a,b,c){this.header=a,this.record=b,this.data=c}return a.prototype.decompress=function(){var a=this.header.compressionMethod();switch(a){case p.DEFLATE:var b=n(l.buffer2Arrayish(this.data.slice(0,this.record.compressedSize())),{chunkSize:this.record.uncompressedSize()});return l.arrayish2Buffer(b);case p.STORED:return l.copyingSlice(this.data,0,this.record.uncompressedSize());default:var c=p[a];throw c=c?c:"Unknown: "+a,new g.ApiError(g.ErrorCode.EINVAL,"Invalid compression method on file '"+this.header.fileName()+"': "+c)}},a.prototype.getHeader=function(){return this.header},a.prototype.getRecord=function(){return this.record},a.prototype.getRawData=function(){return this.data},a}();c.FileData=r;var s=function(){function a(a){this.data=a}return a.prototype.crc32=function(){return this.data.readUInt32LE(0)},a.prototype.compressedSize=function(){return this.data.readUInt32LE(4)},a.prototype.uncompressedSize=function(){return this.data.readUInt32LE(8)},a}();c.DataDescriptor=s;var t=function(){function a(a){if(this.data=a,134630224!==this.data.readUInt32LE(0))throw new g.ApiError(g.ErrorCode.EINVAL,"Invalid archive extra data record signature: "+this.data.readUInt32LE(0))}return a.prototype.length=function(){return this.data.readUInt32LE(4)},a.prototype.extraFieldData=function(){return this.data.slice(8,8+this.length())},a}();c.ArchiveExtraDataRecord=t;var u=function(){function a(a){if(this.data=a,84233040!==this.data.readUInt32LE(0))throw new g.ApiError(g.ErrorCode.EINVAL,"Invalid digital signature signature: "+this.data.readUInt32LE(0))}return a.prototype.size=function(){return this.data.readUInt16LE(4)},a.prototype.signatureData=function(){return this.data.slice(6,6+this.size())},a}();c.DigitalSignature=u;var v=function(){function a(a,b){if(this.zipData=a,this.data=b,33639248!==this.data.readUInt32LE(0))throw new g.ApiError(g.ErrorCode.EINVAL,"Invalid Zip file: Central directory record has invalid signature: "+this.data.readUInt32LE(0));this._filename=this.produceFilename()}return a.prototype.versionMadeBy=function(){return this.data.readUInt16LE(4)},a.prototype.versionNeeded=function(){return this.data.readUInt16LE(6)},a.prototype.flag=function(){return this.data.readUInt16LE(8)},a.prototype.compressionMethod=function(){return this.data.readUInt16LE(10)},a.prototype.lastModFileTime=function(){return d(this.data.readUInt16LE(12),this.data.readUInt16LE(14))},a.prototype.rawLastModFileTime=function(){return this.data.readUInt32LE(12)},a.prototype.crc32=function(){return this.data.readUInt32LE(16)},a.prototype.compressedSize=function(){return this.data.readUInt32LE(20)},a.prototype.uncompressedSize=function(){return this.data.readUInt32LE(24)},a.prototype.fileNameLength=function(){return this.data.readUInt16LE(28)},a.prototype.extraFieldLength=function(){return this.data.readUInt16LE(30)},a.prototype.fileCommentLength=function(){return this.data.readUInt16LE(32)},a.prototype.diskNumberStart=function(){return this.data.readUInt16LE(34)},a.prototype.internalAttributes=function(){return this.data.readUInt16LE(36)},a.prototype.externalAttributes=function(){return this.data.readUInt32LE(38)},a.prototype.headerRelativeOffset=function(){return this.data.readUInt32LE(42)},a.prototype.produceFilename=function(){var a=e(this.data,this.useUTF8(),46,this.fileNameLength());return a.replace(/\\/g,"/")},a.prototype.fileName=function(){return this._filename},a.prototype.rawFileName=function(){return this.data.slice(46,46+this.fileNameLength())},a.prototype.extraField=function(){var a=44+this.fileNameLength();return this.data.slice(a,a+this.extraFieldLength())},a.prototype.fileComment=function(){var a=46+this.fileNameLength()+this.extraFieldLength();return e(this.data,this.useUTF8(),a,this.fileCommentLength())},a.prototype.rawFileComment=function(){var a=46+this.fileNameLength()+this.extraFieldLength(); +return this.data.slice(a,a+this.fileCommentLength())},a.prototype.totalSize=function(){return 46+this.fileNameLength()+this.extraFieldLength()+this.fileCommentLength()},a.prototype.isDirectory=function(){var a=this.fileName();return!!(16&this.externalAttributes())||"/"===a.charAt(a.length-1)},a.prototype.isFile=function(){return!this.isDirectory()},a.prototype.useUTF8=function(){return 2048===(2048&this.flag())},a.prototype.isEncrypted=function(){return 1===(1&this.flag())},a.prototype.getFileData=function(){var a=this.headerRelativeOffset(),b=new q(this.zipData.slice(a));return new r(b,this,this.zipData.slice(a+b.totalSize()))},a.prototype.getData=function(){return this.getFileData().decompress()},a.prototype.getRawData=function(){return this.getFileData().getRawData()},a.prototype.getStats=function(){return new h.default(h.FileType.FILE,this.uncompressedSize(),365,new Date,this.lastModFileTime())},a}();c.CentralDirectory=v;var w=function(){function a(a){if(this.data=a,101010256!==this.data.readUInt32LE(0))throw new g.ApiError(g.ErrorCode.EINVAL,"Invalid Zip file: End of central directory record has invalid signature: "+this.data.readUInt32LE(0))}return a.prototype.diskNumber=function(){return this.data.readUInt16LE(4)},a.prototype.cdDiskNumber=function(){return this.data.readUInt16LE(6)},a.prototype.cdDiskEntryCount=function(){return this.data.readUInt16LE(8)},a.prototype.cdTotalEntryCount=function(){return this.data.readUInt16LE(10)},a.prototype.cdSize=function(){return this.data.readUInt32LE(12)},a.prototype.cdOffset=function(){return this.data.readUInt32LE(16)},a.prototype.cdZipCommentLength=function(){return this.data.readUInt16LE(20)},a.prototype.cdZipComment=function(){return e(this.data,!0,22,this.cdZipCommentLength())},a.prototype.rawCdZipComment=function(){return this.data.slice(22,22+this.cdZipCommentLength())},a}();c.EndOfCentralDirectory=w;var x=function(){function a(a,b,c,d){this.index=a,this.directoryEntries=b,this.eocd=c,this.data=d}return a}();c.ZipTOC=x;var y=function(a){function b(b,c){void 0===c&&(c=""),a.call(this),this.input=b,this.name=c,this._index=new o.FileIndex,this._directoryEntries=[],this._eocd=null,b instanceof x?(this._index=b.index,this._directoryEntries=b.directoryEntries,this._eocd=b.eocd,this.data=b.data):(this.data=b,this.populateIndex())}return f(b,a),b.prototype.getName=function(){return"ZipFS"+(""!==this.name?" "+this.name:"")},b.prototype.getCentralDirectoryEntry=function(a){var b=this._index.getInode(a);if(null===b)throw g.ApiError.ENOENT(a);return o.isFileInode(b)?b.getData():o.isDirInode(b)?b.getData():void 0},b.prototype.getCentralDirectoryEntryAt=function(a){var b=this._directoryEntries[a];if(!b)throw new RangeError("Invalid directory index: "+a+".");return b},b.prototype.getNumberOfCentralDirectoryEntries=function(){return this._directoryEntries.length},b.prototype.getEndOfCentralDirectory=function(){return this._eocd},b.isAvailable=function(){return!0},b.prototype.diskSpace=function(a,b){b(this.data.length,0)},b.prototype.isReadOnly=function(){return!0},b.prototype.supportsLinks=function(){return!1},b.prototype.supportsProps=function(){return!1},b.prototype.supportsSynch=function(){return!0},b.prototype.statSync=function(a,b){var c=this._index.getInode(a);if(null===c)throw g.ApiError.ENOENT(a);var d;if(o.isFileInode(c))d=c.getData().getStats();else{if(!o.isDirInode(c))throw new g.ApiError(g.ErrorCode.EINVAL,"Invalid inode.");d=c.getStats()}return d},b.prototype.openSync=function(a,b,c){if(b.isWriteable())throw new g.ApiError(g.ErrorCode.EPERM,a);var d=this._index.getInode(a);if(!d)throw g.ApiError.ENOENT(a);if(!o.isFileInode(d))throw g.ApiError.EISDIR(a);var e=d.getData(),f=e.getStats();switch(b.pathExistsAction()){case j.ActionType.THROW_EXCEPTION:case j.ActionType.TRUNCATE_FILE:throw g.ApiError.EEXIST(a);case j.ActionType.NOP:return new k.NoSyncFile(this,a,b,f,e.getData());default:throw new g.ApiError(g.ErrorCode.EINVAL,"Invalid FileMode object.")}},b.prototype.readdirSync=function(a){var b=this._index.getInode(a);if(b){if(o.isDirInode(b))return b.getListing();throw g.ApiError.ENOTDIR(a)}throw g.ApiError.ENOENT(a)},b.prototype.readFileSync=function(a,b,c){var d=this.openSync(a,c,420);try{var e=d,f=e.getBuffer();return null===b?l.copyingSlice(f):f.toString(b)}finally{d.closeSync()}},b.getEOCD=function(a){for(var b=22,c=Math.min(b+65535,a.length-1),d=b;d=0)throw new k.ApiError(k.ErrorCode.EINVAL,"Path must be a string without null bytes.");if(""===a)throw new k.ApiError(k.ErrorCode.EINVAL,"Path must not be empty.");return m.resolve(a)}function i(a,b,c,d){switch(typeof a){case"object":return{encoding:"undefined"!=typeof a.encoding?a.encoding:b,flag:"undefined"!=typeof a.flag?a.flag:c,mode:f(a.mode,d)};case"string":return{encoding:a,flag:c,mode:d};default:return{encoding:b,flag:c,mode:d}}}function j(){}var k=a("./api_error"),l=a("./file_flag"),m=a("path"),n=a("./node_fs_stats"),o=a("./global"),p=function(){function a(){this.root=null,this.fdMap={},this.nextFd=100,this.F_OK=0,this.R_OK=4,this.W_OK=2,this.X_OK=1,this._wrapCb=e}return a.prototype.getFdForFile=function(a){var b=this.nextFd++;return this.fdMap[b]=a,b},a.prototype.fd2file=function(a){var b=this.fdMap[a];if(b)return b;throw new k.ApiError(k.ErrorCode.EBADF,"Invalid file descriptor.")},a.prototype.closeFd=function(a){delete this.fdMap[a]},a.prototype.initialize=function(a){if(!a.constructor.isAvailable())throw new k.ApiError(k.ErrorCode.EINVAL,"Tried to instantiate BrowserFS with an unavailable file system.");return this.root=a},a.prototype._toUnixTimestamp=function(a){if("number"==typeof a)return a;if(a instanceof Date)return a.getTime()/1e3;throw new Error("Cannot parse time: "+a)},a.prototype.getRootFS=function(){return this.root?this.root:null},a.prototype.rename=function(a,b,c){void 0===c&&(c=j);var d=e(c,1);try{this.root.rename(h(a),h(b),d)}catch(a){d(a)}},a.prototype.renameSync=function(a,b){this.root.renameSync(h(a),h(b))},a.prototype.exists=function(a,b){void 0===b&&(b=j);var c=e(b,1);try{return this.root.exists(h(a),c)}catch(a){return c(!1)}},a.prototype.existsSync=function(a){try{return this.root.existsSync(h(a))}catch(a){return!1}},a.prototype.stat=function(a,b){void 0===b&&(b=j);var c=e(b,2);try{return this.root.stat(h(a),!1,c)}catch(a){return c(a,null)}},a.prototype.statSync=function(a){return this.root.statSync(h(a),!1)},a.prototype.lstat=function(a,b){void 0===b&&(b=j);var c=e(b,2);try{return this.root.stat(h(a),!0,c)}catch(a){return c(a,null)}},a.prototype.lstatSync=function(a){return this.root.statSync(h(a),!0)},a.prototype.truncate=function(a,b,c){void 0===b&&(b=0),void 0===c&&(c=j);var d=0;"function"==typeof b?c=b:"number"==typeof b&&(d=b);var f=e(c,1);try{if(d<0)throw new k.ApiError(k.ErrorCode.EINVAL);return this.root.truncate(h(a),d,f)}catch(a){return f(a)}},a.prototype.truncateSync=function(a,b){if(void 0===b&&(b=0),b<0)throw new k.ApiError(k.ErrorCode.EINVAL);return this.root.truncateSync(h(a),b)},a.prototype.unlink=function(a,b){void 0===b&&(b=j);var c=e(b,1);try{return this.root.unlink(h(a),c)}catch(a){return c(a)}},a.prototype.unlinkSync=function(a){return this.root.unlinkSync(h(a))},a.prototype.open=function(a,b,c,d){var g=this;void 0===d&&(d=j);var i=f(c,420);d="function"==typeof c?c:d;var k=e(d,2);try{this.root.open(h(a),l.FileFlag.getFileFlag(b),i,function(a,b){b?k(a,g.getFdForFile(b)):k(a)})}catch(a){k(a,null)}},a.prototype.openSync=function(a,b,c){return void 0===c&&(c=420),this.getFdForFile(this.root.openSync(h(a),l.FileFlag.getFileFlag(b),f(c,420)))},a.prototype.readFile=function(a,b,c){void 0===b&&(b={}),void 0===c&&(c=j);var d=i(b,null,"r",null);c="function"==typeof b?b:c;var f=e(c,2);try{var g=l.FileFlag.getFileFlag(d.flag);return g.isReadable()?this.root.readFile(h(a),d.encoding,g,f):f(new k.ApiError(k.ErrorCode.EINVAL,"Flag passed to readFile must allow for reading."))}catch(a){return f(a,null)}},a.prototype.readFileSync=function(a,b){void 0===b&&(b={});var c=i(b,null,"r",null),d=l.FileFlag.getFileFlag(c.flag);if(!d.isReadable())throw new k.ApiError(k.ErrorCode.EINVAL,"Flag passed to readFile must allow for reading.");return this.root.readFileSync(h(a),c.encoding,d)},a.prototype.writeFile=function(a,b,c,d){void 0===c&&(c={}),void 0===d&&(d=j);var f=i(c,"utf8","w",420);d="function"==typeof c?c:d;var g=e(d,1);try{var m=l.FileFlag.getFileFlag(f.flag);return m.isWriteable()?this.root.writeFile(h(a),b,f.encoding,m,f.mode,g):g(new k.ApiError(k.ErrorCode.EINVAL,"Flag passed to writeFile must allow for writing."))}catch(a){return g(a)}},a.prototype.writeFileSync=function(a,b,c){var d=i(c,"utf8","w",420),e=l.FileFlag.getFileFlag(d.flag);if(!e.isWriteable())throw new k.ApiError(k.ErrorCode.EINVAL,"Flag passed to writeFile must allow for writing.");return this.root.writeFileSync(h(a),b,d.encoding,e,d.mode)},a.prototype.appendFile=function(a,b,c,d){void 0===d&&(d=j);var f=i(c,"utf8","a",420);d="function"==typeof c?c:d;var g=e(d,1);try{var m=l.FileFlag.getFileFlag(f.flag);if(!m.isAppendable())return g(new k.ApiError(k.ErrorCode.EINVAL,"Flag passed to appendFile must allow for appending."));this.root.appendFile(h(a),b,f.encoding,m,f.mode,g)}catch(a){g(a)}},a.prototype.appendFileSync=function(a,b,c){var d=i(c,"utf8","a",420),e=l.FileFlag.getFileFlag(d.flag);if(!e.isAppendable())throw new k.ApiError(k.ErrorCode.EINVAL,"Flag passed to appendFile must allow for appending.");return this.root.appendFileSync(h(a),b,d.encoding,e,d.mode)},a.prototype.fstat=function(a,b){void 0===b&&(b=j);var c=e(b,2);try{var d=this.fd2file(a);d.stat(c)}catch(a){c(a)}},a.prototype.fstatSync=function(a){return this.fd2file(a).statSync()},a.prototype.close=function(a,b){var c=this;void 0===b&&(b=j);var d=e(b,1);try{this.fd2file(a).close(function(b){b||c.closeFd(a),d(b)})}catch(a){d(a)}},a.prototype.closeSync=function(a){this.fd2file(a).closeSync(),this.closeFd(a)},a.prototype.ftruncate=function(a,b,c){void 0===c&&(c=j);var d="number"==typeof b?b:0;c="function"==typeof b?b:c;var f=e(c,1);try{var g=this.fd2file(a);if(d<0)throw new k.ApiError(k.ErrorCode.EINVAL);g.truncate(d,f)}catch(a){f(a)}},a.prototype.ftruncateSync=function(a,b){void 0===b&&(b=0);var c=this.fd2file(a);if(b<0)throw new k.ApiError(k.ErrorCode.EINVAL);c.truncateSync(b)},a.prototype.fsync=function(a,b){void 0===b&&(b=j);var c=e(b,1);try{this.fd2file(a).sync(c)}catch(a){c(a)}},a.prototype.fsyncSync=function(a){this.fd2file(a).syncSync()},a.prototype.fdatasync=function(a,b){void 0===b&&(b=j);var c=e(b,1);try{this.fd2file(a).datasync(c)}catch(a){c(a)}},a.prototype.fdatasyncSync=function(a){this.fd2file(a).datasyncSync()},a.prototype.write=function(a,c,d,f,g,h){void 0===h&&(h=j);var i,l,m,n=null;if("string"==typeof c){var o="utf8";switch(typeof d){case"function":h=d;break;case"number":n=d,o="string"==typeof f?f:"utf8",h="function"==typeof g?g:h;break;default:return(h="function"==typeof f?f:"function"==typeof g?g:h)(new k.ApiError(k.ErrorCode.EINVAL,"Invalid arguments."))}i=new b(c,o),l=0,m=i.length}else i=c,l=d,m=f,n="number"==typeof g?g:null,h="function"==typeof g?g:h;var p=e(h,3);try{var q=this.fd2file(a);null==n&&(n=q.getPos()),q.write(i,l,m,n,p)}catch(a){p(a)}},a.prototype.writeSync=function(a,c,d,e,f){var g,h,i,j=0;if("string"==typeof c){i="number"==typeof d?d:null;var k="string"==typeof e?e:"utf8";j=0,g=new b(c,k),h=g.length}else g=c,j=d,h=e,i="number"==typeof f?f:null;var l=this.fd2file(a);return null==i&&(i=l.getPos()),l.writeSync(g,j,h,i)},a.prototype.read=function(a,c,d,f,g,h){void 0===h&&(h=j);var i,k,l,m,n;if("number"==typeof c){l=c,i=d;var o=f;h="function"==typeof g?g:h,k=0,m=new b(l),n=e(function(a,b,c){return a?h(a):void h(a,c.toString(o),b)},3)}else m=c,k=d,l=f,i=g,n=e(h,3);try{var p=this.fd2file(a);null==i&&(i=p.getPos()),p.read(m,k,l,i,n)}catch(a){n(a)}},a.prototype.readSync=function(a,c,d,e,f){var g,h,i,j,k=!1;if("number"==typeof c){i=c,j=d;var l=e;h=0,g=new b(i),k=!0}else g=c,h=d,i=e,j=f;var m=this.fd2file(a);null==j&&(j=m.getPos());var n=m.readSync(g,h,i,j);return k?[g.toString(l),n]:n},a.prototype.fchown=function(a,b,c,d){void 0===d&&(d=j);var f=e(d,1);try{this.fd2file(a).chown(b,c,f)}catch(a){f(a)}},a.prototype.fchownSync=function(a,b,c){this.fd2file(a).chownSync(b,c)},a.prototype.fchmod=function(a,b,c){var d=e(c,1);try{var f="string"==typeof b?parseInt(b,8):b;this.fd2file(a).chmod(f,d)}catch(a){d(a)}},a.prototype.fchmodSync=function(a,b){var c="string"==typeof b?parseInt(b,8):b;this.fd2file(a).chmodSync(c)},a.prototype.futimes=function(a,b,c,d){void 0===d&&(d=j);var f=e(d,1);try{var g=this.fd2file(a);"number"==typeof b&&(b=new Date(1e3*b)),"number"==typeof c&&(c=new Date(1e3*c)),g.utimes(b,c,f)}catch(a){f(a)}},a.prototype.futimesSync=function(a,b,c){this.fd2file(a).utimesSync(g(b),g(c))},a.prototype.rmdir=function(a,b){void 0===b&&(b=j);var c=e(b,1);try{a=h(a),this.root.rmdir(a,c)}catch(a){c(a)}},a.prototype.rmdirSync=function(a){return a=h(a),this.root.rmdirSync(a)},a.prototype.mkdir=function(a,b,c){void 0===c&&(c=j),"function"==typeof b&&(c=b,b=511);var d=e(c,1);try{a=h(a),this.root.mkdir(a,b,d)}catch(a){d(a)}},a.prototype.mkdirSync=function(a,b){this.root.mkdirSync(h(a),f(b,511))},a.prototype.readdir=function(a,b){void 0===b&&(b=j);var c=e(b,2);try{a=h(a),this.root.readdir(a,c)}catch(a){c(a)}},a.prototype.readdirSync=function(a){return a=h(a),this.root.readdirSync(a)},a.prototype.link=function(a,b,c){void 0===c&&(c=j);var d=e(c,1);try{a=h(a),b=h(b),this.root.link(a,b,d)}catch(a){d(a)}},a.prototype.linkSync=function(a,b){return a=h(a),b=h(b),this.root.linkSync(a,b)},a.prototype.symlink=function(a,b,c,d){void 0===d&&(d=j);var f="string"==typeof c?c:"file";d="function"==typeof c?c:d;var g=e(d,1);try{if("file"!==f&&"dir"!==f)return g(new k.ApiError(k.ErrorCode.EINVAL,"Invalid type: "+f));a=h(a),b=h(b),this.root.symlink(a,b,f,g)}catch(a){g(a)}},a.prototype.symlinkSync=function(a,b,c){if(null==c)c="file";else if("file"!==c&&"dir"!==c)throw new k.ApiError(k.ErrorCode.EINVAL,"Invalid type: "+c);return a=h(a),b=h(b),this.root.symlinkSync(a,b,c)},a.prototype.readlink=function(a,b){void 0===b&&(b=j);var c=e(b,2);try{a=h(a),this.root.readlink(a,c)}catch(a){c(a)}},a.prototype.readlinkSync=function(a){return a=h(a),this.root.readlinkSync(a)},a.prototype.chown=function(a,b,c,d){void 0===d&&(d=j);var f=e(d,1);try{a=h(a),this.root.chown(a,!1,b,c,f)}catch(a){f(a)}},a.prototype.chownSync=function(a,b,c){a=h(a),this.root.chownSync(a,!1,b,c)},a.prototype.lchown=function(a,b,c,d){void 0===d&&(d=j);var f=e(d,1);try{a=h(a),this.root.chown(a,!0,b,c,f)}catch(a){f(a)}},a.prototype.lchownSync=function(a,b,c){a=h(a),this.root.chownSync(a,!0,b,c)},a.prototype.chmod=function(a,b,c){void 0===c&&(c=j);var d=e(c,1);try{var g=f(b,-1);if(g<0)throw new k.ApiError(k.ErrorCode.EINVAL,"Invalid mode.");this.root.chmod(h(a),!1,g,d)}catch(a){d(a)}},a.prototype.chmodSync=function(a,b){var c=f(b,-1);if(c<0)throw new k.ApiError(k.ErrorCode.EINVAL,"Invalid mode.");a=h(a),this.root.chmodSync(a,!1,c)},a.prototype.lchmod=function(a,b,c){void 0===c&&(c=j);var d=e(c,1);try{var g=f(b,-1);if(g<0)throw new k.ApiError(k.ErrorCode.EINVAL,"Invalid mode.");this.root.chmod(h(a),!0,g,d)}catch(a){d(a)}},a.prototype.lchmodSync=function(a,b){var c=f(b,-1);if(c<1)throw new k.ApiError(k.ErrorCode.EINVAL,"Invalid mode.");this.root.chmodSync(h(a),!0,c)},a.prototype.utimes=function(a,b,c,d){void 0===d&&(d=j);var f=e(d,1);try{this.root.utimes(h(a),g(b),g(c),f)}catch(a){f(a)}},a.prototype.utimesSync=function(a,b,c){this.root.utimesSync(h(a),g(b),g(c))},a.prototype.realpath=function(a,b,c){void 0===c&&(c=j);var d="object"==typeof b?b:{};c="function"==typeof b?b:j;var f=e(c,2);try{a=h(a),this.root.realpath(a,d,f)}catch(a){f(a)}},a.prototype.realpathSync=function(a,b){return void 0===b&&(b={}),a=h(a),this.root.realpathSync(a,b)},a.prototype.watchFile=function(a,b,c){throw void 0===c&&(c=j),new k.ApiError(k.ErrorCode.ENOTSUP)},a.prototype.unwatchFile=function(a,b){throw void 0===b&&(b=j),new k.ApiError(k.ErrorCode.ENOTSUP)},a.prototype.watch=function(a,b,c){throw void 0===c&&(c=j),new k.ApiError(k.ErrorCode.ENOTSUP)},a.prototype.access=function(a,b,c){throw void 0===c&&(c=j),new k.ApiError(k.ErrorCode.ENOTSUP)},a.prototype.accessSync=function(a,b){throw new k.ApiError(k.ErrorCode.ENOTSUP)},a.prototype.createReadStream=function(a,b){throw new k.ApiError(k.ErrorCode.ENOTSUP)},a.prototype.createWriteStream=function(a,b){throw new k.ApiError(k.ErrorCode.ENOTSUP)},a.Stats=n.default,a}();c.__esModule=!0,c.default=p;new p}).call(this,a("bfs-buffer").Buffer,!0)},{"./api_error":52,"./file_flag":56,"./global":58,"./node_fs_stats":60,"bfs-buffer":2,path:10}],52:[function(a,b,c){(function(a){"use strict";var b=this&&this.__extends||function(a,b){function c(){this.constructor=a}for(var d in b)b.hasOwnProperty(d)&&(a[d]=b[d]);a.prototype=null===b?Object.create(b):(c.prototype=b.prototype,new c)};!function(a){a[a.EPERM=1]="EPERM",a[a.ENOENT=2]="ENOENT",a[a.EIO=5]="EIO",a[a.EBADF=9]="EBADF",a[a.EACCES=13]="EACCES",a[a.EBUSY=16]="EBUSY",a[a.EEXIST=17]="EEXIST",a[a.ENOTDIR=20]="ENOTDIR",a[a.EISDIR=21]="EISDIR",a[a.EINVAL=22]="EINVAL",a[a.EFBIG=27]="EFBIG",a[a.ENOSPC=28]="ENOSPC",a[a.EROFS=30]="EROFS",a[a.ENOTEMPTY=39]="ENOTEMPTY",a[a.ENOTSUP=95]="ENOTSUP"}(c.ErrorCode||(c.ErrorCode={}));var d=c.ErrorCode;c.ErrorStrings={},c.ErrorStrings[d.EPERM]="Operation not permitted.",c.ErrorStrings[d.ENOENT]="No such file or directory.",c.ErrorStrings[d.EIO]="Input/output error.",c.ErrorStrings[d.EBADF]="Bad file descriptor.",c.ErrorStrings[d.EACCES]="Permission denied.",c.ErrorStrings[d.EBUSY]="Resource busy or locked.",c.ErrorStrings[d.EEXIST]="File exists.",c.ErrorStrings[d.ENOTDIR]="File is not a directory.",c.ErrorStrings[d.EISDIR]="File is a directory.",c.ErrorStrings[d.EINVAL]="Invalid argument.",c.ErrorStrings[d.EFBIG]="File is too big.",c.ErrorStrings[d.ENOSPC]="No space left on disk.",c.ErrorStrings[d.EROFS]="Cannot modify a read-only file system.",c.ErrorStrings[d.ENOTEMPTY]="Directory is not empty.",c.ErrorStrings[d.ENOTSUP]="Operation is not supported.";var e=function(e){function f(a,b,f){void 0===b&&(b=c.ErrorStrings[a]),void 0===f&&(f=null),e.call(this,b),this.syscall="",this.errno=a,this.code=d[a],this.path=f,this.stack=(new Error).stack,this.message="Error: "+this.code+": "+b+(this.path?", '"+this.path+"'":"")}return b(f,e),f.prototype.toString=function(){return this.message},f.prototype.toJSON=function(){return{errno:this.errno,code:this.code,path:this.path,stack:this.stack,message:this.message}},f.fromJSON=function(a){var b=new f(0);return b.errno=a.errno,b.code=a.code,b.path=a.path,b.stack=a.stack,b.message=a.message,b},f.prototype.writeToBuffer=function(b,c){void 0===b&&(b=new a(this.bufferSize())),void 0===c&&(c=0);var d=b.write(JSON.stringify(this.toJSON()),c+4);return b.writeUInt32LE(d,c),b},f.fromBuffer=function(a,b){return void 0===b&&(b=0),f.fromJSON(JSON.parse(a.toString("utf8",b+4,b+4+a.readUInt32LE(b))))},f.prototype.bufferSize=function(){return 4+a.byteLength(JSON.stringify(this.toJSON()))},f.FileError=function(a,b){return new f(a,c.ErrorStrings[a],b)},f.ENOENT=function(a){return this.FileError(d.ENOENT,a)},f.EEXIST=function(a){return this.FileError(d.EEXIST,a)},f.EISDIR=function(a){return this.FileError(d.EISDIR,a)},f.ENOTDIR=function(a){return this.FileError(d.ENOTDIR,a)},f.EPERM=function(a){return this.FileError(d.EPERM,a)},f.ENOTEMPTY=function(a){return this.FileError(d.ENOTEMPTY,a)},f}(Error);c.ApiError=e}).call(this,a("bfs-buffer").Buffer)},{"bfs-buffer":2}],53:[function(a,b,c){"use strict";var d=a("../backend/AsyncMirror");c.AsyncMirror=d.default;var e=a("../backend/Dropbox");c.Dropbox=e.default;var f=a("../backend/Emscripten");c.Emscripten=f.default;var g=a("../backend/FolderAdapter");c.FolderAdapter=g.default;var h=a("../backend/HTML5FS");c.HTML5FS=h.default;var i=a("../backend/InMemory");c.InMemory=i.default;var j=a("../backend/IndexedDB");c.IndexedDB=j.default;var k=a("../backend/LocalStorage");c.LocalStorage=k.default;var l=a("../backend/MountableFileSystem");c.MountableFileSystem=l.default;var m=a("../backend/OverlayFS");c.OverlayFS=m.default;var n=a("../backend/WorkerFS");c.WorkerFS=n.default;var o=a("../backend/XmlHttpRequest");c.XmlHttpRequest=o.default;var p=a("../backend/ZipFS");c.ZipFS=p.default},{"../backend/AsyncMirror":37,"../backend/Dropbox":38,"../backend/Emscripten":39,"../backend/FolderAdapter":40,"../backend/HTML5FS":41,"../backend/InMemory":42,"../backend/IndexedDB":43,"../backend/LocalStorage":44,"../backend/MountableFileSystem":45,"../backend/OverlayFS":46,"../backend/WorkerFS":47,"../backend/XmlHttpRequest":48,"../backend/ZipFS":49}],54:[function(a,b,c){(function(b,d){"use strict";function e(a){a.Buffer=d,a.process=b;var c=null!=a.require?a.require:null;a.require=function(a){var b=g(a);return null==b?c.apply(null,Array.prototype.slice.call(arguments,0)):b}}function f(a,b){m[a]=b}function g(a){switch(a){case"fs":return j;case"path":return k;case"buffer":return i;case"process":return b;case"bfs_utils":return n;default:return m[a]}}function h(a){return j.initialize(a)}var i=a("buffer"),j=a("./node_fs"),k=a("path"),l=a("../generic/emscripten_fs");c.EmscriptenFS=l.default;var m=a("./backends");c.FileSystem=m;var n=a("./util");b.initializeTTYs&&b.initializeTTYs(),c.install=e,c.registerFileSystem=f,c.BFSRequire=g,c.initialize=h}).call(this,a("bfs-process"),a("bfs-buffer").Buffer)},{"../generic/emscripten_fs":62,"./backends":53,"./node_fs":59,"./util":61,"bfs-buffer":2,"bfs-process":11,buffer:2,path:10}],55:[function(a,b,c){"use strict";var d=a("./api_error"),e=function(){function a(){}return a.prototype.sync=function(a){a(new d.ApiError(d.ErrorCode.ENOTSUP))},a.prototype.syncSync=function(){throw new d.ApiError(d.ErrorCode.ENOTSUP)},a.prototype.datasync=function(a){this.sync(a)},a.prototype.datasyncSync=function(){return this.syncSync()},a.prototype.chown=function(a,b,c){c(new d.ApiError(d.ErrorCode.ENOTSUP))},a.prototype.chownSync=function(a,b){throw new d.ApiError(d.ErrorCode.ENOTSUP)},a.prototype.chmod=function(a,b){b(new d.ApiError(d.ErrorCode.ENOTSUP))},a.prototype.chmodSync=function(a){throw new d.ApiError(d.ErrorCode.ENOTSUP)},a.prototype.utimes=function(a,b,c){c(new d.ApiError(d.ErrorCode.ENOTSUP))},a.prototype.utimesSync=function(a,b){throw new d.ApiError(d.ErrorCode.ENOTSUP)},a}();c.BaseFile=e},{"./api_error":52}],56:[function(a,b,c){"use strict";var d=a("./api_error");!function(a){a[a.NOP=0]="NOP",a[a.THROW_EXCEPTION=1]="THROW_EXCEPTION",a[a.TRUNCATE_FILE=2]="TRUNCATE_FILE",a[a.CREATE_FILE=3]="CREATE_FILE"}(c.ActionType||(c.ActionType={}));var e=c.ActionType,f=function(){function a(b){if(this.flagStr=b,a.validFlagStrs.indexOf(b)<0)throw new d.ApiError(d.ErrorCode.EINVAL,"Invalid flag: "+b)}return a.getFileFlag=function(b){return a.flagCache.hasOwnProperty(b)?a.flagCache[b]:a.flagCache[b]=new a(b)},a.prototype.getFlagString=function(){return this.flagStr},a.prototype.isReadable=function(){return this.flagStr.indexOf("r")!==-1||this.flagStr.indexOf("+")!==-1},a.prototype.isWriteable=function(){return this.flagStr.indexOf("w")!==-1||this.flagStr.indexOf("a")!==-1||this.flagStr.indexOf("+")!==-1},a.prototype.isTruncating=function(){return this.flagStr.indexOf("w")!==-1},a.prototype.isAppendable=function(){return this.flagStr.indexOf("a")!==-1},a.prototype.isSynchronous=function(){return this.flagStr.indexOf("s")!==-1},a.prototype.isExclusive=function(){return this.flagStr.indexOf("x")!==-1},a.prototype.pathExistsAction=function(){return this.isExclusive()?e.THROW_EXCEPTION:this.isTruncating()?e.TRUNCATE_FILE:e.NOP},a.prototype.pathNotExistsAction=function(){return(this.isWriteable()||this.isAppendable())&&"r+"!==this.flagStr?e.CREATE_FILE:e.THROW_EXCEPTION},a.flagCache={},a.validFlagStrs=["r","r+","rs","rs+","w","wx","w+","wx+","a","ax","a+","ax+"],a}();c.FileFlag=f},{"./api_error":52}],57:[function(a,b,c){(function(b){"use strict";var d=this&&this.__extends||function(a,b){function c(){this.constructor=a}for(var d in b)b.hasOwnProperty(d)&&(a[d]=b[d]);a.prototype=null===b?Object.create(b):(c.prototype=b.prototype,new c)},e=a("./api_error"),f=a("./file_flag"),g=a("path"),h=function(){function a(){}return a.prototype.supportsLinks=function(){return!1},a.prototype.diskSpace=function(a,b){b(0,0)},a.prototype.openFile=function(a,b,c){throw new e.ApiError(e.ErrorCode.ENOTSUP)},a.prototype.createFile=function(a,b,c,d){throw new e.ApiError(e.ErrorCode.ENOTSUP)},a.prototype.open=function(a,b,c,d){var h=this,i=function(i,j){if(i)switch(b.pathNotExistsAction()){case f.ActionType.CREATE_FILE:return h.stat(g.dirname(a),!1,function(f,i){f?d(f):i.isDirectory()?h.createFile(a,b,c,d):d(e.ApiError.ENOTDIR(g.dirname(a)))});case f.ActionType.THROW_EXCEPTION:return d(e.ApiError.ENOENT(a));default:return d(new e.ApiError(e.ErrorCode.EINVAL,"Invalid FileFlag object."))}else{if(j.isDirectory())return d(e.ApiError.EISDIR(a));switch(b.pathExistsAction()){case f.ActionType.THROW_EXCEPTION:return d(e.ApiError.EEXIST(a));case f.ActionType.TRUNCATE_FILE:return h.openFile(a,b,function(a,b){a?d(a):b.truncate(0,function(){b.sync(function(){d(null,b)})})});case f.ActionType.NOP:return h.openFile(a,b,d);default:return d(new e.ApiError(e.ErrorCode.EINVAL,"Invalid FileFlag object."))}}};this.stat(a,!1,i)},a.prototype.rename=function(a,b,c){c(new e.ApiError(e.ErrorCode.ENOTSUP))},a.prototype.renameSync=function(a,b){throw new e.ApiError(e.ErrorCode.ENOTSUP)},a.prototype.stat=function(a,b,c){c(new e.ApiError(e.ErrorCode.ENOTSUP))},a.prototype.statSync=function(a,b){throw new e.ApiError(e.ErrorCode.ENOTSUP)},a.prototype.openFileSync=function(a,b,c){throw new e.ApiError(e.ErrorCode.ENOTSUP)},a.prototype.createFileSync=function(a,b,c){throw new e.ApiError(e.ErrorCode.ENOTSUP)},a.prototype.openSync=function(a,b,c){var d;try{d=this.statSync(a,!1)}catch(d){switch(b.pathNotExistsAction()){case f.ActionType.CREATE_FILE:var h=this.statSync(g.dirname(a),!1);if(!h.isDirectory())throw e.ApiError.ENOTDIR(g.dirname(a));return this.createFileSync(a,b,c);case f.ActionType.THROW_EXCEPTION:throw e.ApiError.ENOENT(a);default:throw new e.ApiError(e.ErrorCode.EINVAL,"Invalid FileFlag object.")}}if(d.isDirectory())throw e.ApiError.EISDIR(a);switch(b.pathExistsAction()){case f.ActionType.THROW_EXCEPTION:throw e.ApiError.EEXIST(a);case f.ActionType.TRUNCATE_FILE:return this.unlinkSync(a),this.createFileSync(a,b,d.mode);case f.ActionType.NOP:return this.openFileSync(a,b,c);default:throw new e.ApiError(e.ErrorCode.EINVAL,"Invalid FileFlag object.")}},a.prototype.unlink=function(a,b){b(new e.ApiError(e.ErrorCode.ENOTSUP))},a.prototype.unlinkSync=function(a){throw new e.ApiError(e.ErrorCode.ENOTSUP)},a.prototype.rmdir=function(a,b){b(new e.ApiError(e.ErrorCode.ENOTSUP))},a.prototype.rmdirSync=function(a){throw new e.ApiError(e.ErrorCode.ENOTSUP)},a.prototype.mkdir=function(a,b,c){c(new e.ApiError(e.ErrorCode.ENOTSUP))},a.prototype.mkdirSync=function(a,b){throw new e.ApiError(e.ErrorCode.ENOTSUP)},a.prototype.readdir=function(a,b){b(new e.ApiError(e.ErrorCode.ENOTSUP))},a.prototype.readdirSync=function(a){throw new e.ApiError(e.ErrorCode.ENOTSUP)},a.prototype.exists=function(a,b){this.stat(a,null,function(a){b(null==a)})},a.prototype.existsSync=function(a){try{return this.statSync(a,!0),!0}catch(a){return!1}},a.prototype.realpath=function(a,b,c){if(this.supportsLinks())for(var d=a.split(g.sep),f=0;fa.length||c>d)throw new TypeError("Invalid slice bounds on buffer of length "+a.length+": ["+c+", "+d+"]");if(0===a.length)return new b(0);if(m){var e=f(a),g=a.readUInt8(0),h=(g+1)%255;return a.writeUInt8(h,0),e[0]===h?(e[0]=g,i(e.slice(c,d))):(a.writeUInt8(g,0),i(e.subarray(c,d)))}var j=new b(d-c);return a.copy(j,0,c,d),j}var l=a("path"),m="undefined"!=typeof ArrayBuffer;c.isIE="undefined"!=typeof navigator&&(null!=/(msie) ([\w.]+)/.exec(navigator.userAgent.toLowerCase())||navigator.userAgent.indexOf("Trident")!==-1),c.isWebWorker="undefined"==typeof window,c.mkdirpSync=d,c.buffer2ArrayBuffer=e,c.buffer2Uint8array=f,c.buffer2Arrayish=g,c.arrayish2Buffer=h,c.uint8Array2Buffer=i,c.arrayBuffer2Buffer=j,"undefined"!=typeof ArrayBuffer&&"undefined"!=typeof Uint8Array&&(Uint8Array.prototype.slice||(Uint8Array.prototype.slice=function(a,b){void 0===a&&(a=0),void 0===b&&(b=this.length);var c=this;return a<0&&(a=this.length+a,a<0&&(a=0)),b<0&&(b=this.length+b,b<0&&(b=0)),b0;){var g,h=e.pop(),k=h[0],l=h[1],m=h[2];for(var n in l){var o=l[n],p=""+k+"/"+n;null!=o?(c._index[p]=g=new j,e.push([p,o,g])):g=new i(new f.default(f.FileType.FILE,-1,365)),null!=m&&(m._ls[n]=g)}}return c},a}();c.FileIndex=h;var i=function(){function a(a){this.data=a}return a.prototype.isFile=function(){return!0},a.prototype.isDir=function(){return!1},a.prototype.getData=function(){return this.data},a.prototype.setData=function(a){this.data=a},a}();c.FileInode=i;var j=function(){function a(a){void 0===a&&(a=null),this.data=a,this._ls={}}return a.prototype.isFile=function(){return!1},a.prototype.isDir=function(){return!0},a.prototype.getData=function(){return this.data},a.prototype.getStats=function(){return new f.default(f.FileType.DIRECTORY,4096,365)},a.prototype.getListing=function(){return Object.keys(this._ls)},a.prototype.getItem=function(a){var b;return null!=(b=this._ls[a])?b:null},a.prototype.addItem=function(a,b){return!(a in this._ls)&&(this._ls[a]=b,!0)},a.prototype.remItem=function(a){var b=this._ls[a];return void 0===b?null:(delete this._ls[a],b)},a}();c.DirInode=j,c.isFileInode=d,c.isDirInode=e},{"../core/node_fs_stats":60,path:10}],64:[function(a,b,c){(function(c){"use strict";var d=a("../core/node_fs_stats"),e=function(){function a(a,b,c,d,e,f){this.id=a,this.size=b,this.mode=c,this.atime=d,this.mtime=e,this.ctime=f}return a.prototype.toStats=function(){return new d.default((61440&this.mode)===d.FileType.DIRECTORY?d.FileType.DIRECTORY:d.FileType.FILE,this.size,this.mode,new Date(this.atime),new Date(this.mtime),new Date(this.ctime))},a.prototype.getSize=function(){return 30+this.id.length},a.prototype.toBuffer=function(a){return void 0===a&&(a=new c(this.getSize())),a.writeUInt32LE(this.size,0),a.writeUInt16LE(this.mode,4),a.writeDoubleLE(this.atime,6),a.writeDoubleLE(this.mtime,14),a.writeDoubleLE(this.ctime,22),a.write(this.id,30,this.id.length,"ascii"),a},a.prototype.update=function(a){var b=!1;this.size!==a.size&&(this.size=a.size,b=!0),this.mode!==a.mode&&(this.mode=a.mode,b=!0);var c=a.atime.getTime();this.atime!==c&&(this.atime=c,b=!0);var d=a.mtime.getTime();this.mtime!==d&&(this.mtime=d,b=!0);var e=a.ctime.getTime();return this.ctime!==e&&(this.ctime=e,b=!0),b},a.fromBuffer=function(b){if(void 0===b)throw new Error("NO");return new a(b.toString("ascii",30),b.readUInt32LE(0),b.readUInt16LE(4),b.readDoubleLE(6),b.readDoubleLE(14),b.readDoubleLE(22))},a.prototype.isFile=function(){return(61440&this.mode)===d.FileType.FILE},a.prototype.isDirectory=function(){return(61440&this.mode)===d.FileType.DIRECTORY},a}();b.exports=e}).call(this,a("bfs-buffer").Buffer)},{"../core/node_fs_stats":60,"bfs-buffer":2}],65:[function(a,b,c){(function(b){"use strict";function d(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(a){var b=16*Math.random()|0,c="x"==a?b:3&b|8;return c.toString(16)})}function e(a,b){return!a||(b(a),!1)}function f(a,b,c){return!a||(b.abort(function(){c(a)}),!1)}var g=this&&this.__extends||function(a,b){function c(){this.constructor=a}for(var d in b)b.hasOwnProperty(d)&&(a[d]=b[d]);a.prototype=null===b?Object.create(b):(c.prototype=b.prototype,new c)},h=a("../core/file_system"),i=a("../core/api_error"),j=a("../core/node_fs_stats"),k=a("path"),l=a("../generic/inode"),m=a("../generic/preload_file"),n="/",o=function(){function a(a){this.store=a,this.originalData={},this.modifiedKeys=[]}return a.prototype.stashOldValue=function(a,b){this.originalData.hasOwnProperty(a)||(this.originalData[a]=b)},a.prototype.markModified=function(a){this.modifiedKeys.indexOf(a)===-1&&(this.modifiedKeys.push(a),this.originalData.hasOwnProperty(a)||(this.originalData[a]=this.store.get(a)))},a.prototype.get=function(a){var b=this.store.get(a);return this.stashOldValue(a,b),b},a.prototype.put=function(a,b,c){return this.markModified(a),this.store.put(a,b,c)},a.prototype.del=function(a){this.markModified(a),this.store.del(a)},a.prototype.commit=function(){},a.prototype.abort=function(){var a,b,c;for(a=0;a0)throw i.ApiError.ENOTEMPTY(a);this.removeEntry(a,!0)},c.prototype.mkdirSync=function(a,c){var d=this.store.beginTransaction("readwrite"),e=new b("{}");this.commitNewFile(d,a,j.FileType.DIRECTORY,c,e)},c.prototype.readdirSync=function(a){var b=this.store.beginTransaction("readonly");return Object.keys(this.getDirListing(b,a,this.findINode(b,a)))},c.prototype._syncSync=function(a,b,c){var d=this.store.beginTransaction("readwrite"),e=this._findINode(d,k.dirname(a),k.basename(a)),f=this.getINode(d,a,e),g=f.update(c);try{d.put(f.id,b,!0),g&&d.put(e,f.toBuffer(),!0)}catch(a){throw d.abort(),a}d.commit()},c}(h.SynchronousFileSystem);c.SyncKeyValueFileSystem=q;var r=function(a){function b(b,c,d,e,f){a.call(this,b,c,d,e,f)}return g(b,a),b.prototype.sync=function(a){var b=this;this.isDirty()?this._fs._sync(this.getPath(),this.getBuffer(),this.getStats(),function(c){c||b.resetDirty(),a(c)}):a()},b.prototype.close=function(a){this.sync(a)},b}(m.PreloadFile);c.AsyncKeyValueFile=r;var s=function(a){function c(){a.apply(this,arguments)}return g(c,a),c.prototype.init=function(a,b){this.store=a,this.makeRootDirectory(b)},c.isAvailable=function(){return!0},c.prototype.getName=function(){return this.store.name()},c.prototype.isReadOnly=function(){return!1},c.prototype.supportsSymlinks=function(){return!1},c.prototype.supportsProps=function(){return!1},c.prototype.supportsSynch=function(){return!1},c.prototype.makeRootDirectory=function(a){var c=this.store.beginTransaction("readwrite");c.get(n,function(e,g){if(e||void 0===g){var h=(new Date).getTime(),i=new l(d(),4096,511|j.FileType.DIRECTORY,h,h,h);c.put(i.id,new b("{}"),!1,function(b){f(b,c,a)&&c.put(n,i.toBuffer(),!1,function(b){b?c.abort(function(){a(b)}):c.commit(a)})})}else c.commit(a)})},c.prototype._findINode=function(a,b,c,d){var f=this,g=function(a,e,f){a?d(a):f[c]?d(null,f[c]):d(i.ApiError.ENOENT(k.resolve(b,c)))};"/"===b?""===c?d(null,n):this.getINode(a,b,n,function(c,h){e(c,d)&&f.getDirListing(a,b,h,function(a,b){g(a,h,b)})}):this.findINodeAndDirListing(a,b,g)},c.prototype.findINode=function(a,b,c){var d=this;this._findINode(a,k.dirname(b),k.basename(b),function(f,g){e(f,c)&&d.getINode(a,b,g,c)})},c.prototype.getINode=function(a,b,c,d){a.get(c,function(a,c){e(a,d)&&(void 0===c?d(i.ApiError.ENOENT(b)):d(null,l.fromBuffer(c)))})},c.prototype.getDirListing=function(a,b,c,d){c.isDirectory()?a.get(c.id,function(a,c){if(e(a,d))try{d(null,JSON.parse(c.toString()))}catch(a){d(i.ApiError.ENOENT(b))}}):d(i.ApiError.ENOTDIR(b))},c.prototype.findINodeAndDirListing=function(a,b,c){var d=this;this.findINode(a,b,function(f,g){e(f,c)&&d.getDirListing(a,b,g,function(a,b){e(a,c)&&c(null,g,b)})})},c.prototype.addNewNode=function(a,b,c){var e,f=0,g=function(){5===++f?c(new i.ApiError(i.ErrorCode.EIO,"Unable to commit data to key-value store.")):(e=d(),a.put(e,b,!1,function(a,b){a||!b?g():c(null,e)}))};g()},c.prototype.commitNewFile=function(a,c,d,e,g,h){var j=this,m=k.dirname(c),n=k.basename(c),o=(new Date).getTime();return"/"===c?h(i.ApiError.EEXIST(c)):void this.findINodeAndDirListing(a,m,function(k,m,p){f(k,a,h)&&(p[n]?a.abort(function(){h(i.ApiError.EEXIST(c))}):j.addNewNode(a,g,function(c,i){if(f(c,a,h)){var k=new l(i,g.length,e|d,o,o,o);j.addNewNode(a,k.toBuffer(),function(c,d){f(c,a,h)&&(p[n]=d,a.put(m.id,new b(JSON.stringify(p)),!0,function(b){f(b,a,h)&&a.commit(function(b){f(b,a,h)&&h(null,k)})}))})}}))})},c.prototype.empty=function(a){var b=this;this.store.clear(function(c){e(c,a)&&b.makeRootDirectory(a)})},c.prototype.rename=function(a,c,d){var e=this,g=this.store.beginTransaction("readwrite"),h=k.dirname(a),j=k.basename(a),l=k.dirname(c),m=k.basename(c),n={},o={},p=!1;if(0===(l+"/").indexOf(a+"/"))return d(new i.ApiError(i.ErrorCode.EBUSY,h));var q=function(){if(!p&&o.hasOwnProperty(h)&&o.hasOwnProperty(l)){var k=o[h],q=n[h],r=o[l],s=n[l];if(k[j]){var t=k[j];delete k[j];var u=function(){r[m]=t,g.put(q.id,new b(JSON.stringify(k)),!0,function(a){f(a,g,d)&&(h===l?g.commit(d):g.put(s.id,new b(JSON.stringify(r)),!0,function(a){f(a,g,d)&&g.commit(d)}))})};r[m]?e.getINode(g,c,r[m],function(a,b){f(a,g,d)&&(b.isFile()?g.del(b.id,function(a){f(a,g,d)&&g.del(r[m],function(a){f(a,g,d)&&u()})}):g.abort(function(a){d(i.ApiError.EPERM(c))}))}):u()}else d(i.ApiError.ENOENT(a))}},r=function(a){e.findINodeAndDirListing(g,a,function(b,c,e){b?p||(p=!0,g.abort(function(){d(b)})):(n[a]=c,o[a]=e,q())})};r(h),h!==l&&r(l)},c.prototype.stat=function(a,b,c){var d=this.store.beginTransaction("readonly");this.findINode(d,a,function(a,b){e(a,c)&&c(null,b.toStats())})},c.prototype.createFile=function(a,c,d,f){var g=this,h=this.store.beginTransaction("readwrite"),i=new b(0);this.commitNewFile(h,a,j.FileType.FILE,d,i,function(b,d){e(b,f)&&f(null,new r(g,a,c,d.toStats(),i))})},c.prototype.openFile=function(a,b,c){var d=this,f=this.store.beginTransaction("readonly");this.findINode(f,a,function(g,h){e(g,c)&&f.get(h.id,function(f,g){e(f,c)&&(void 0===g?c(i.ApiError.ENOENT(a)):c(null,new r(d,a,b,h.toStats(),g)))})})},c.prototype.removeEntry=function(a,c,d){var e=this,g=this.store.beginTransaction("readwrite"),h=k.dirname(a),j=k.basename(a);this.findINodeAndDirListing(g,h,function(h,k,l){if(f(h,g,d))if(l[j]){var m=l[j];delete l[j],e.getINode(g,a,m,function(e,h){f(e,g,d)&&(!c&&h.isDirectory()?g.abort(function(){d(i.ApiError.EISDIR(a))}):c&&!h.isDirectory()?g.abort(function(){d(i.ApiError.ENOTDIR(a))}):g.del(h.id,function(a){f(a,g,d)&&g.del(m,function(a){f(a,g,d)&&g.put(k.id,new b(JSON.stringify(l)),!0,function(a){f(a,g,d)&&g.commit(d)})})}))})}else g.abort(function(){d(i.ApiError.ENOENT(a))})})},c.prototype.unlink=function(a,b){this.removeEntry(a,!1,b)},c.prototype.rmdir=function(a,b){var c=this;this.readdir(a,function(d,e){d?b(d):e.length>0?b(i.ApiError.ENOTEMPTY(a)):c.removeEntry(a,!0,b)})},c.prototype.mkdir=function(a,c,d){var e=this.store.beginTransaction("readwrite"),f=new b("{}");this.commitNewFile(e,a,j.FileType.DIRECTORY,c,f,d)},c.prototype.readdir=function(a,b){var c=this,d=this.store.beginTransaction("readonly");this.findINode(d,a,function(f,g){e(f,b)&&c.getDirListing(d,a,g,function(a,c){e(a,b)&&b(null,Object.keys(c))})})},c.prototype._sync=function(a,b,c,d){var e=this,g=this.store.beginTransaction("readwrite");this._findINode(g,k.dirname(a),k.basename(a),function(h,i){f(h,g,d)&&e.getINode(g,a,i,function(a,e){if(f(a,g,d)){var h=e.update(c);g.put(e.id,b,!0,function(a){f(a,g,d)&&(h?g.put(i,e.toBuffer(),!0,function(a){f(a,g,d)&&g.commit(d)}):g.commit(d))})}})})},c}(h.BaseFileSystem);c.AsyncKeyValueFileSystem=s}).call(this,a("bfs-buffer").Buffer)},{"../core/api_error":52,"../core/file_system":57,"../core/node_fs_stats":60,"../generic/inode":64,"../generic/preload_file":68,"bfs-buffer":2,path:10}],66:[function(a,b,c){"use strict";var d=a("./mutex"),e=function(){function a(a){this._fs=a,this._mu=new d.default}return a.prototype.getName=function(){return"LockedFS<"+this._fs.getName()+">"},a.prototype.getFSUnlocked=function(){return this._fs},a.prototype.initialize=function(a){this._fs.initialize(a)},a.prototype.diskSpace=function(a,b){this._fs.diskSpace(a,b)},a.prototype.isReadOnly=function(){return this._fs.isReadOnly()},a.prototype.supportsLinks=function(){return this._fs.supportsLinks()},a.prototype.supportsProps=function(){return this._fs.supportsProps()},a.prototype.supportsSynch=function(){return this._fs.supportsSynch()},a.prototype.rename=function(a,b,c){var d=this;this._mu.lock(function(){d._fs.rename(a,b,function(a){d._mu.unlock(),c(a)})})},a.prototype.renameSync=function(a,b){if(this._mu.isLocked())throw new Error("invalid sync call");return this._fs.renameSync(a,b)},a.prototype.stat=function(a,b,c){var d=this;this._mu.lock(function(){d._fs.stat(a,b,function(a,b){d._mu.unlock(),c(a,b)})})},a.prototype.statSync=function(a,b){if(this._mu.isLocked())throw new Error("invalid sync call");return this._fs.statSync(a,b)},a.prototype.open=function(a,b,c,d){var e=this;this._mu.lock(function(){e._fs.open(a,b,c,function(a,b){e._mu.unlock(),d(a,b)})})},a.prototype.openSync=function(a,b,c){if(this._mu.isLocked())throw new Error("invalid sync call");return this._fs.openSync(a,b,c)},a.prototype.unlink=function(a,b){var c=this;this._mu.lock(function(){c._fs.unlink(a,function(a){c._mu.unlock(),b(a)})})},a.prototype.unlinkSync=function(a){if(this._mu.isLocked())throw new Error("invalid sync call");return this._fs.unlinkSync(a)},a.prototype.rmdir=function(a,b){var c=this;this._mu.lock(function(){c._fs.rmdir(a,function(a){c._mu.unlock(),b(a)})})},a.prototype.rmdirSync=function(a){if(this._mu.isLocked())throw new Error("invalid sync call");return this._fs.rmdirSync(a)},a.prototype.mkdir=function(a,b,c){var d=this;this._mu.lock(function(){d._fs.mkdir(a,b,function(a){d._mu.unlock(),c(a)})})},a.prototype.mkdirSync=function(a,b){if(this._mu.isLocked())throw new Error("invalid sync call");return this._fs.mkdirSync(a,b)},a.prototype.readdir=function(a,b){var c=this;this._mu.lock(function(){c._fs.readdir(a,function(a,d){c._mu.unlock(),b(a,d)})})},a.prototype.readdirSync=function(a){if(this._mu.isLocked())throw new Error("invalid sync call");return this._fs.readdirSync(a)},a.prototype.exists=function(a,b){var c=this;this._mu.lock(function(){c._fs.exists(a,function(a){c._mu.unlock(),b(a)})})},a.prototype.existsSync=function(a){if(this._mu.isLocked())throw new Error("invalid sync call");return this._fs.existsSync(a)},a.prototype.realpath=function(a,b,c){var d=this;this._mu.lock(function(){d._fs.realpath(a,b,function(a,b){d._mu.unlock(),c(a,b)})})},a.prototype.realpathSync=function(a,b){if(this._mu.isLocked())throw new Error("invalid sync call");return this._fs.realpathSync(a,b)},a.prototype.truncate=function(a,b,c){var d=this;this._mu.lock(function(){d._fs.truncate(a,b,function(a){d._mu.unlock(),c(a)})})},a.prototype.truncateSync=function(a,b){if(this._mu.isLocked())throw new Error("invalid sync call"); +return this._fs.truncateSync(a,b)},a.prototype.readFile=function(a,b,c,d){var e=this;this._mu.lock(function(){e._fs.readFile(a,b,c,function(a,b){e._mu.unlock(),d(a,b)})})},a.prototype.readFileSync=function(a,b,c){if(this._mu.isLocked())throw new Error("invalid sync call");return this._fs.readFileSync(a,b,c)},a.prototype.writeFile=function(a,b,c,d,e,f){var g=this;this._mu.lock(function(){g._fs.writeFile(a,b,c,d,e,function(a){g._mu.unlock(),f(a)})})},a.prototype.writeFileSync=function(a,b,c,d,e){if(this._mu.isLocked())throw new Error("invalid sync call");return this._fs.writeFileSync(a,b,c,d,e)},a.prototype.appendFile=function(a,b,c,d,e,f){var g=this;this._mu.lock(function(){g._fs.appendFile(a,b,c,d,e,function(a){g._mu.unlock(),f(a)})})},a.prototype.appendFileSync=function(a,b,c,d,e){if(this._mu.isLocked())throw new Error("invalid sync call");return this._fs.appendFileSync(a,b,c,d,e)},a.prototype.chmod=function(a,b,c,d){var e=this;this._mu.lock(function(){e._fs.chmod(a,b,c,function(a){e._mu.unlock(),d(a)})})},a.prototype.chmodSync=function(a,b,c){if(this._mu.isLocked())throw new Error("invalid sync call");return this._fs.chmodSync(a,b,c)},a.prototype.chown=function(a,b,c,d,e){var f=this;this._mu.lock(function(){f._fs.chown(a,b,c,d,function(a){f._mu.unlock(),e(a)})})},a.prototype.chownSync=function(a,b,c,d){if(this._mu.isLocked())throw new Error("invalid sync call");return this._fs.chownSync(a,b,c,d)},a.prototype.utimes=function(a,b,c,d){var e=this;this._mu.lock(function(){e._fs.utimes(a,b,c,function(a){e._mu.unlock(),d(a)})})},a.prototype.utimesSync=function(a,b,c){if(this._mu.isLocked())throw new Error("invalid sync call");return this._fs.utimesSync(a,b,c)},a.prototype.link=function(a,b,c){var d=this;this._mu.lock(function(){d._fs.link(a,b,function(a){d._mu.unlock(),c(a)})})},a.prototype.linkSync=function(a,b){if(this._mu.isLocked())throw new Error("invalid sync call");return this._fs.linkSync(a,b)},a.prototype.symlink=function(a,b,c,d){var e=this;this._mu.lock(function(){e._fs.symlink(a,b,c,function(a){e._mu.unlock(),d(a)})})},a.prototype.symlinkSync=function(a,b,c){if(this._mu.isLocked())throw new Error("invalid sync call");return this._fs.symlinkSync(a,b,c)},a.prototype.readlink=function(a,b){var c=this;this._mu.lock(function(){c._fs.readlink(a,function(a,d){c._mu.unlock(),b(a,d)})})},a.prototype.readlinkSync=function(a){if(this._mu.isLocked())throw new Error("invalid sync call");return this._fs.readlinkSync(a)},a}();c.__esModule=!0,c.default=e},{"./mutex":67}],67:[function(a,b,c){"use strict";var d=function(){function a(){this._locked=!1,this._waiters=[]}return a.prototype.lock=function(a){return this._locked?void this._waiters.push(a):(this._locked=!0,void a())},a.prototype.unlock=function(){if(!this._locked)throw new Error("unlock of a non-locked mutex");var a=this._waiters.shift();return a?void setImmediate(a):void(this._locked=!1)},a.prototype.tryLock=function(){return!this._locked&&(this._locked=!0,!0)},a.prototype.isLocked=function(){return this._locked},a}();c.__esModule=!0,c.default=d},{}],68:[function(a,b,c){(function(b){"use strict";var d=this&&this.__extends||function(a,b){function c(){this.constructor=a}for(var d in b)b.hasOwnProperty(d)&&(a[d]=b[d]);a.prototype=null===b?Object.create(b):(c.prototype=b.prototype,new c)},e=a("../core/file"),f=a("../core/api_error"),g=a("../core/node_fs"),h=function(a){function c(c,d,e,f,g){if(a.call(this),this._pos=0,this._dirty=!1,this._fs=c,this._path=d,this._flag=e,this._stat=f,null!=g?this._buffer=g:this._buffer=new b(0),this._stat.size!==this._buffer.length&&this._flag.isReadable())throw new Error("Invalid buffer: Buffer is "+this._buffer.length+" long, yet Stats object specifies that file is "+this._stat.size+" long.")}return d(c,a),c.prototype.isDirty=function(){return this._dirty},c.prototype.resetDirty=function(){this._dirty=!1},c.prototype.getBuffer=function(){return this._buffer},c.prototype.getStats=function(){return this._stat},c.prototype.getFlag=function(){return this._flag},c.prototype.getPath=function(){return this._path},c.prototype.getPos=function(){return this._flag.isAppendable()?this._stat.size:this._pos},c.prototype.advancePos=function(a){return this._pos+=a},c.prototype.setPos=function(a){return this._pos=a},c.prototype.sync=function(a){try{this.syncSync(),a()}catch(b){a(b)}},c.prototype.syncSync=function(){throw new f.ApiError(f.ErrorCode.ENOTSUP)},c.prototype.close=function(a){try{this.closeSync(),a()}catch(b){a(b)}},c.prototype.closeSync=function(){throw new f.ApiError(f.ErrorCode.ENOTSUP)},c.prototype.stat=function(a){try{a(null,this._stat.clone())}catch(b){a(b)}},c.prototype.statSync=function(){return this._stat.clone()},c.prototype.truncate=function(a,b){try{this.truncateSync(a),this._flag.isSynchronous()&&!g.getRootFS().supportsSynch()&&this.sync(b),b()}catch(a){return b(a)}},c.prototype.truncateSync=function(a){if(this._dirty=!0,!this._flag.isWriteable())throw new f.ApiError(f.ErrorCode.EPERM,"File not opened with a writeable mode.");if(this._stat.mtime=new Date,a>this._buffer.length){var c=new b(a-this._buffer.length);return c.fill(0),this.writeSync(c,0,c.length,this._buffer.length),void(this._flag.isSynchronous()&&g.getRootFS().supportsSynch()&&this.syncSync())}this._stat.size=a;var d=new b(a);this._buffer.copy(d,0,0,a),this._buffer=d,this._flag.isSynchronous()&&g.getRootFS().supportsSynch()&&this.syncSync()},c.prototype.write=function(a,b,c,d,e){try{e(null,this.writeSync(a,b,c,d),a)}catch(a){e(a)}},c.prototype.writeSync=function(a,c,d,e){if(this._dirty=!0,null==e&&(e=this.getPos()),!this._flag.isWriteable())throw new f.ApiError(f.ErrorCode.EPERM,"File not opened with a writeable mode.");var g=e+d;if(g>this._stat.size&&(this._stat.size=g,g>this._buffer.length)){var h=new b(g);this._buffer.copy(h),this._buffer=h}var i=a.copy(this._buffer,e,c,c+d);return this._stat.mtime=new Date,this._flag.isSynchronous()?(this.syncSync(),i):(this.setPos(e+i),i)},c.prototype.read=function(a,b,c,d,e){try{e(null,this.readSync(a,b,c,d),a)}catch(a){e(a)}},c.prototype.readSync=function(a,b,c,d){if(!this._flag.isReadable())throw new f.ApiError(f.ErrorCode.EPERM,"File not opened with a readable mode.");null==d&&(d=this.getPos());var e=d+c;e>this._stat.size&&(c=this._stat.size-d);var g=this._buffer.copy(a,b,d,d+c);return this._stat.atime=new Date,this._pos=d+c,g},c.prototype.chmod=function(a,b){try{this.chmodSync(a),b()}catch(a){b(a)}},c.prototype.chmodSync=function(a){if(!this._fs.supportsProps())throw new f.ApiError(f.ErrorCode.ENOTSUP);this._dirty=!0,this._stat.chmod(a),this.syncSync()},c}(e.BaseFile);c.PreloadFile=h;var i=function(a){function b(b,c,d,e,f){a.call(this,b,c,d,e,f)}return d(b,a),b.prototype.sync=function(a){a()},b.prototype.syncSync=function(){},b.prototype.close=function(a){a()},b.prototype.closeSync=function(){},b}(h);c.NoSyncFile=i}).call(this,a("bfs-buffer").Buffer)},{"../core/api_error":52,"../core/file":55,"../core/node_fs":59,"bfs-buffer":2}],69:[function(a,b,c){(function(b){"use strict";function d(a){for(var b=IEBinaryToArray_ByteStr(a),c=IEBinaryToArray_ByteStr_Last(a),d=b.replace(/[\s\S]/g,function(a){var b=a.charCodeAt(0);return String.fromCharCode(255&b,b>>8)})+c,e=new Array(d.length),f=0;f>>0;if("function"!=typeof a)throw new TypeError;for(var d=[],e=arguments.length>=2?arguments[1]:void 0,f=0;f0)){var b=f.shift();return b()}};e.addEventListener?e.addEventListener("message",i,!0):e.attachEvent("onmessage",i)}else if(e.MessageChannel){var j=new e.MessageChannel;j.port1.onmessage=function(a){if(f.length>0)return f.shift()()},e.setImmediate=function(a){f.push(a),j.port2.postMessage("")}}else e.setImmediate=function(a){return setTimeout(a,0)}}if(Array.prototype.indexOf||(Array.prototype.indexOf=function(a,b){if(void 0===b&&(b=0),!this)throw new TypeError;var c=this.length;if(0===c||d>=c)return-1;var d=b;d<0&&(d=c+d);for(var e=d;e>>0;if("function"!=typeof a)throw new TypeError(a+" is not a function");for(b&&(c=b),d=new Array(g),e=0;e\r\n"+k+"\r\n");else{var l=document.createElement("script");l.type="text/vbscript",l.innerHTML=k,document.head.appendChild(l)}}var m=a("./core/browserfs");b.exports=m},{"./core/browserfs":54,"./core/global":58}]},{},[50])(50)}); +//# sourceMappingURL=browserfs.min.js.map \ No newline at end of file diff --git a/pkg/emscripten/libretro/embed.html b/pkg/emscripten/libretro/embed.html index 6124b7a843..fbe346576c 100644 --- a/pkg/emscripten/libretro/embed.html +++ b/pkg/emscripten/libretro/embed.html @@ -31,9 +31,9 @@ FCEUmm Gambatte Genesis Plus GX - Nestopia (NES) - Snes9x 2010 (SNES) - VBA Next (Gameboy Advance) + Nestopia (NES) + Snes9x 2010 (SNES) + VBA Next (Gameboy Advance)