Skip to content

Commit

Permalink
Merge pull request MediaArea#153 from robUx4/games
Browse files Browse the repository at this point in the history
Fix building when targeting Windows Games SDK
  • Loading branch information
JeromeMartinez authored Jan 18, 2024
2 parents 1250d32 + b770ce9 commit af78a29
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 8 deletions.
5 changes: 5 additions & 0 deletions Source/ZenLib/Conf.h
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,11 @@
#define WINDOWS_UWP
#endif
#endif
#if defined(WINAPI_FAMILY) && (WINAPI_FAMILY==WINAPI_FAMILY_GAMES)
#ifndef WINDOWS_GAMES
#define WINDOWS_GAMES
#endif
#endif
#endif

//---------------------------------------------------------------------------
Expand Down
14 changes: 9 additions & 5 deletions Source/ZenLib/FileName.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -190,11 +190,15 @@ Ztring FileName::TempFileName_Create(const Ztring &Prefix)
if (!GetTempPath(MAX_PATH, Path))
return Ztring(); //Problem while getting a temp path

Char FileName[MAX_PATH+1];
if (!GetTempFileName(Path, Prefix.c_str(), 0, FileName))
return Ztring(); //Problem while getting a file name

return Ztring(FileName);
#ifndef WINDOWS_GAMES
Char FileName[MAX_PATH+1];
if (!GetTempFileName(Path, Prefix.c_str(), 0, FileName))
return Ztring(); //Problem while getting a file name

return Ztring(FileName);
#else // #ifdef WINDOWS_GAMES
return __T("D:\\xxx.txt");
#endif // #ifdef WINDOWS_GAMES
#else
return __T("C:\\xxx.txt");
#endif
Expand Down
4 changes: 2 additions & 2 deletions Source/ZenLib/OS_Utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ void Shell_Execute(const Ztring &ToExecute)
{
#ifdef ZENLIB_USEWX
#else //ZENLIB_USEWX
#if defined(WINDOWS) && !defined(WINDOWS_UWP)
#if defined(WINDOWS) && !defined(WINDOWS_UWP) && !defined(WINDOWS_GAMES)
ShellExecute(NULL, __T("open"), ToExecute.c_str(), NULL, NULL, 0);
#else
//Not supported
Expand All @@ -252,7 +252,7 @@ void Shell_Execute(const Ztring &ToExecute)

Ztring Directory_Select_Caption;

#if defined(WINDOWS) && !defined(WINDOWS_UWP)
#if defined(WINDOWS) && !defined(WINDOWS_UWP) && !defined(WINDOWS_GAMES)
#ifdef UNICODE
char InitDirA[MAX_PATH];
wchar_t InitDir [MAX_PATH];
Expand Down
4 changes: 3 additions & 1 deletion Source/ZenLib/Ztring.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,9 @@
#ifdef WINDOWS
#undef __TEXT
#include <windows.h>
#include <tchar.h>
#ifndef WINDOWS_GAMES
#include <tchar.h>
#endif
#endif
#endif //ZENLIB_USEWX
#ifdef __MINGW32__
Expand Down

0 comments on commit af78a29

Please sign in to comment.