diff --git a/FindMedia.h b/FindMedia.h index 8cf6346..5f7fedb 100644 --- a/FindMedia.h +++ b/FindMedia.h @@ -10,17 +10,17 @@ #pragma once -#if defined(WINAPI_FAMILY) && (WINAPI_FAMILY != WINAPI_FAMILY_DESKTOP_APP) -#error This header only works with Windows desktop apps -#endif - -#include -#include +#include +#include +#include namespace DX { - inline void FindMediaFile(_Out_writes_(cchDest) wchar_t* strDestPath, _In_ int cchDest, _In_z_ const wchar_t* strFilename) + inline void FindMediaFile( + _Out_writes_(cchDest) wchar_t* strDestPath, + _In_ int cchDest, + _In_z_ const wchar_t* strFilename) { bool bFound = false; @@ -31,7 +31,7 @@ namespace DX wchar_t strExePath[MAX_PATH] = {}; wchar_t strExeName[MAX_PATH] = {}; wchar_t* strLastSlash = nullptr; - GetModuleFileName(nullptr, strExePath, MAX_PATH); + std::ignore = GetModuleFileNameW(nullptr, strExePath, MAX_PATH); strExePath[MAX_PATH - 1] = 0; strLastSlash = wcsrchr(strExePath, TEXT('\\')); if (strLastSlash) @@ -48,7 +48,7 @@ namespace DX } wcscpy_s(strDestPath, cchDest, strFilename); - if (GetFileAttributes(strDestPath) != 0xFFFFFFFF) + if (GetFileAttributesW(strDestPath) != 0xFFFFFFFF) return; // Search all parent directories starting at .\ and using strFilename as the leaf name @@ -60,14 +60,14 @@ namespace DX wchar_t strSearch[MAX_PATH] = {}; wchar_t* strFilePart = nullptr; - GetFullPathName(strExePath, MAX_PATH, strFullPath, &strFilePart); + std::ignore = GetFullPathNameW(strExePath, MAX_PATH, strFullPath, &strFilePart); if (!strFilePart) - throw std::exception("FindMediaFile"); + throw std::runtime_error("FindMediaFile"); while (strFilePart && *strFilePart != '\0') { swprintf_s(strFullFileName, MAX_PATH, L"%ls\\%ls", strFullPath, strLeafName); - if (GetFileAttributes(strFullFileName) != 0xFFFFFFFF) + if (GetFileAttributesW(strFullFileName) != 0xFFFFFFFF) { wcscpy_s(strDestPath, cchDest, strFullFileName); bFound = true; @@ -75,7 +75,7 @@ namespace DX } swprintf_s(strFullFileName, MAX_PATH, L"%ls\\%ls\\%ls", strFullPath, strExeName, strLeafName); - if (GetFileAttributes(strFullFileName) != 0xFFFFFFFF) + if (GetFileAttributesW(strFullFileName) != 0xFFFFFFFF) { wcscpy_s(strDestPath, cchDest, strFullFileName); bFound = true; @@ -83,14 +83,14 @@ namespace DX } swprintf_s(strSearch, MAX_PATH, L"%ls\\..", strFullPath); - GetFullPathName(strSearch, MAX_PATH, strFullPath, &strFilePart); + std::ignore = GetFullPathNameW(strSearch, MAX_PATH, strFullPath, &strFilePart); } if (bFound) return; - // On failure, return the file as the path but also return an error code - wcscpy_s(strDestPath, cchDest, strFilename); + // On failure, return the file as the path but also throw an error + wcscpy_s(strDestPath, size_t(cchDest), strFilename); - throw std::exception("File not found"); + throw std::runtime_error("File not found"); } } \ No newline at end of file diff --git a/HISTORY.md b/HISTORY.md index 6fe1221..e210e98 100644 --- a/HISTORY.md +++ b/HISTORY.md @@ -4,6 +4,10 @@ Release available for download on [GitHub](https://github.com/walbourn/directxtk ## Release History +### November 5, 2022 +* Updated for October 2022 release of DirectX Tool Kit +* Added lighting vs. unlit toggle + ### March 22, 2022 * Updated for March 2022 release of DirectX Tool Kit * Converted Desktop project to VS 2019 diff --git a/README.md b/README.md index bd019a1..8d2bc1e 100644 --- a/README.md +++ b/README.md @@ -4,11 +4,11 @@ Copyright (c) Microsoft Corporation. -**March 22, 2022** +**November 5, 2022** The DirectX Tool Kit Model Viewer is an interactive test application for validating ``.SDKMESH``, ``.VBO``, and ``.CMO`` files rendered using the DirectX Tool Kit. -This code is designed to build with Visual Studio 2017 ([15.9](https://walbourn.github.io/vs-2017-15-9-update/)) or VS 2019 (16.4 or later). +This code is designed to build with Visual Studio 2017 ([15.9](https://walbourn.github.io/vs-2017-15-9-update/)) or VS 2019 (16.11). ## Notices