diff options
author | 2023-01-05 15:32:40 +0100 | |
---|---|---|
committer | 2023-01-05 09:32:40 -0500 | |
commit | 812e6094f47bb8d1da5a6b421aa4c724cf2035c0 (patch) | |
tree | 0f5bab2fe9393d1f629e9bf63e76cecca74ec0c9 /3rdparty/bgfx/examples/common/entry/dialog.cpp | |
parent | 4a1b41854bba8fc2567906b88bab8ca81e75d187 (diff) |
Update BGFX, BX and BIMG (#10789)
* Update to bgfx a93a714632b79b5ddbf5c86ac323fa9b76ed3433
Co-authored-by: Бранимир Караџић <branimirkaradzic@gmail.com>
Diffstat (limited to '3rdparty/bgfx/examples/common/entry/dialog.cpp')
-rw-r--r-- | 3rdparty/bgfx/examples/common/entry/dialog.cpp | 27 |
1 files changed, 18 insertions, 9 deletions
diff --git a/3rdparty/bgfx/examples/common/entry/dialog.cpp b/3rdparty/bgfx/examples/common/entry/dialog.cpp index 4041e23d17a..8c1bf9731e7 100644 --- a/3rdparty/bgfx/examples/common/entry/dialog.cpp +++ b/3rdparty/bgfx/examples/common/entry/dialog.cpp @@ -1,6 +1,6 @@ /* - * Copyright 2010-2021 Branimir Karadzic. All rights reserved. - * License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause + * Copyright 2010-2022 Branimir Karadzic. All rights reserved. + * License: https://github.com/bkaradzic/bgfx/blob/master/LICENSE */ #include <bx/allocator.h> @@ -42,6 +42,7 @@ struct OPENFILENAMEA }; extern "C" bool __stdcall GetOpenFileNameA(OPENFILENAMEA* _ofn); +extern "C" bool __stdcall GetSaveFileNameA(OPENFILENAMEA * _ofn); extern "C" void* __stdcall GetModuleHandleA(const char* _moduleName); extern "C" uint32_t __stdcall GetModuleFileNameA(void* _module, char* _outFilePath, uint32_t _size); extern "C" void* __stdcall ShellExecuteA(void* _hwnd, void* _operation, void* _file, void* _parameters, void* _directory, int32_t _showCmd); @@ -104,6 +105,17 @@ private: char m_ch; }; +#if BX_PLATFORM_WINDOWS +extern "C" typedef bool(__stdcall* OPENFILENAMEFUNCTION)(OPENFILENAMEA* _ofn); +static const struct { OPENFILENAMEFUNCTION m_function; uint32_t m_flags; } +s_getFileNameA[] = +{ + { GetOpenFileNameA, /* OFN_EXPLORER */ 0x00080000 | /* OFN_DONTADDTORECENT */ 0x02000000 | /* OFN_FILEMUSTEXIST */ 0x00001000 }, + { GetSaveFileNameA, /* OFN_EXPLORER */ 0x00080000 | /* OFN_DONTADDTORECENT */ 0x02000000 }, +}; +BX_STATIC_ASSERT(BX_COUNTOF(s_getFileNameA) == FileSelectionDialogType::Count); +#endif + #if !BX_PLATFORM_OSX bool openFileSelectionDialog( bx::FilePath& _inOutFilePath @@ -156,7 +168,8 @@ bool openFileSelectionDialog( } } #elif BX_PLATFORM_WINDOWS - BX_UNUSED(_type); + if (_type < 0 || _type >= BX_COUNTOF(s_getFileNameA)) + return false; char out[bx::kMaxFilePath] = { '\0' }; @@ -166,11 +179,7 @@ bool openFileSelectionDialog( ofn.initialDir = _inOutFilePath.getCPtr(); ofn.file = out; ofn.maxFile = sizeof(out); - ofn.flags = 0 - | /* OFN_EXPLORER */ 0x00080000 - | /* OFN_FILEMUSTEXIST */ 0x00001000 - | /* OFN_DONTADDTORECENT */ 0x02000000 - ; + ofn.flags = s_getFileNameA[_type].m_flags; char tmp[4096]; bx::StaticMemoryBlockWriter writer(tmp, sizeof(tmp) ); @@ -220,7 +229,7 @@ bool openFileSelectionDialog( bx::write(&writer, '\0', &err); if (err.isOk() - && GetOpenFileNameA(&ofn) ) + && s_getFileNameA[_type].m_function(&ofn)) { _inOutFilePath.set(ofn.file); return true; |