diff --git a/hecl/driver/CMakeLists.txt b/hecl/driver/CMakeLists.txt index 0a01bd992..f9ca60b47 100644 --- a/hecl/driver/CMakeLists.txt +++ b/hecl/driver/CMakeLists.txt @@ -1,3 +1,4 @@ +if(NOT WINDOWS_STORE) add_executable(hecl main.cpp ToolBase.hpp ToolPackage.hpp @@ -27,3 +28,4 @@ target_link_libraries(hecl hecl-common hecl-blender-addon athena-core nod logvisor athena-libyaml ${PNG_LIB} squish xxhash zeus boo ${ZLIB_LIBRARIES} ${LZO_LIB} ${PLAT_LIBS} ${BOO_SYS_LIBS}) +endif() diff --git a/hecl/extern/athena b/hecl/extern/athena index cf3baad90..da9699a7e 160000 --- a/hecl/extern/athena +++ b/hecl/extern/athena @@ -1 +1 @@ -Subproject commit cf3baad9050e63e6bb8432305faf76fbb2cf9de9 +Subproject commit da9699a7e29d2f7627e450f3d182e63a5140151d diff --git a/hecl/extern/boo b/hecl/extern/boo index 598bce028..f228f2366 160000 --- a/hecl/extern/boo +++ b/hecl/extern/boo @@ -1 +1 @@ -Subproject commit 598bce028b6caa8547c8380d45d7a7b71ae9facc +Subproject commit f228f236613792a7f7471610bf9e102d885dbae6 diff --git a/hecl/include/hecl/hecl.hpp b/hecl/include/hecl/hecl.hpp index 054a92cd5..2a577d32b 100644 --- a/hecl/include/hecl/hecl.hpp +++ b/hecl/include/hecl/hecl.hpp @@ -164,11 +164,15 @@ int RecursiveMakeDir(const SystemChar* dir); static inline const SystemChar* GetEnv(const SystemChar* name) { +#if WINDOWS_STORE + return nullptr; +#else #if HECL_UCS2 return _wgetenv(name); #else return getenv(name); #endif +#endif } static inline SystemChar* Getcwd(SystemChar* buf, int maxlen) @@ -230,7 +234,9 @@ static inline bool IsAbsolute(SystemStringView path) const SystemChar* GetTmpDir(); +#if !WINDOWS_STORE int RunProcess(const SystemChar* path, const SystemChar* const args[]); +#endif enum class FileLockType { @@ -441,7 +447,7 @@ static inline bool PathRelative(const SystemChar* path) { if (!path || !path[0]) return false; -#if _WIN32 +#if _WIN32 && !WINDOWS_STORE return PathIsRelative(path); #else return path[0] != '/'; @@ -452,9 +458,11 @@ static inline int ConsoleWidth() { int retval = 80; #if _WIN32 +#if !WINDOWS_STORE CONSOLE_SCREEN_BUFFER_INFO info; GetConsoleScreenBufferInfo(GetStdHandle(STD_OUTPUT_HANDLE), &info); retval = info.dwSize.X; +#endif #else struct winsize w; if (ioctl(STDOUT_FILENO, TIOCGWINSZ, &w) != -1) diff --git a/hecl/lib/Backend/CMakeLists.txt b/hecl/lib/Backend/CMakeLists.txt index b89a51ac4..028ec2c04 100644 --- a/hecl/lib/Backend/CMakeLists.txt +++ b/hecl/lib/Backend/CMakeLists.txt @@ -4,11 +4,13 @@ endif() if(APPLE) set(PLAT_SRCS Metal.cpp) endif() +if(NOT WINDOWS_STORE) + list(APPEND PLAT_SRCS GLSL.cpp) +endif() set(BACKEND_SOURCES GX.cpp ProgrammableCommon.cpp - GLSL.cpp ${PLAT_SRCS}) hecl_add_list(Backend BACKEND_SOURCES) diff --git a/hecl/lib/Blender/BlenderConnection.cpp b/hecl/lib/Blender/BlenderConnection.cpp index e144a8dc0..7831706ff 100644 --- a/hecl/lib/Blender/BlenderConnection.cpp +++ b/hecl/lib/Blender/BlenderConnection.cpp @@ -245,6 +245,7 @@ static bool RegFileExists(const hecl::SystemChar* path) BlenderConnection::BlenderConnection(int verbosityLevel) { +#if !WINDOWS_STORE BlenderLog.report(logvisor::Info, "Establishing BlenderConnection..."); /* Put hecl_blendershell.py in temp dir */ @@ -552,6 +553,9 @@ BlenderConnection::BlenderConnection(int verbosityLevel) break; } +#else + BlenderLog.report(logvisor::Fatal, "BlenderConnection not available on UWP"); +#endif } BlenderConnection::~BlenderConnection() diff --git a/hecl/lib/Runtime/FileStoreManager.cpp b/hecl/lib/Runtime/FileStoreManager.cpp index 35c376025..eeab2d8af 100644 --- a/hecl/lib/Runtime/FileStoreManager.cpp +++ b/hecl/lib/Runtime/FileStoreManager.cpp @@ -4,6 +4,10 @@ #include #endif +#if WINDOWS_STORE +using namespace Windows::Storage; +#endif + namespace hecl { namespace Runtime @@ -14,12 +18,16 @@ FileStoreManager::FileStoreManager(SystemStringView domain) : m_domain(domain) { #if _WIN32 +#if !WINDOWS_STORE WCHAR home[MAX_PATH]; if (!SUCCEEDED(SHGetFolderPathW(NULL, CSIDL_PROFILE, NULL, 0, home))) Log.report(logvisor::Fatal, _S("unable to locate profile for file store")); SystemString path(home); - +#else + StorageFolder^ cacheFolder = ApplicationData::Current->LocalCacheFolder; + SystemString path(cacheFolder->Path->Data()); +#endif path += _S("/.heclrun"); hecl::MakeDir(path.c_str()); diff --git a/hecl/lib/Runtime/ShaderCacheManager.cpp b/hecl/lib/Runtime/ShaderCacheManager.cpp index d2ec5a2e6..b5aff33e6 100644 --- a/hecl/lib/Runtime/ShaderCacheManager.cpp +++ b/hecl/lib/Runtime/ShaderCacheManager.cpp @@ -12,7 +12,9 @@ namespace hecl { namespace Runtime { +#if BOO_HAS_GL IShaderBackendFactory* _NewGLSLBackendFactory(); +#endif #if _WIN32 IShaderBackendFactory* _NewHLSLBackendFactory(); #endif @@ -129,9 +131,11 @@ ShaderCacheManager::ShaderCacheManager(const FileStoreManager& storeMgr, switch (plat) { +#if BOO_HAS_GL case boo::IGraphicsDataFactory::Platform::OpenGL: m_factory.reset(_NewGLSLBackendFactory()); break; +#endif #if _WIN32 case boo::IGraphicsDataFactory::Platform::D3D11: case boo::IGraphicsDataFactory::Platform::D3D12: diff --git a/hecl/lib/SteamFinder.cpp b/hecl/lib/SteamFinder.cpp index 0c97ca869..44005e1c6 100644 --- a/hecl/lib/SteamFinder.cpp +++ b/hecl/lib/SteamFinder.cpp @@ -20,6 +20,7 @@ hecl::SystemString FindCommonSteamApp(const hecl::SystemChar* name) hecl::Sstat theStat; #ifdef WIN32 +#if !WINDOWS_STORE HKEY hkey; hecl::SystemChar _steamInstallDir[MAX_PATH] = {0}; if (RegOpenKeyEx(HKEY_LOCAL_MACHINE, _S("Software\\Valve\\Steam"), @@ -38,6 +39,9 @@ hecl::SystemString FindCommonSteamApp(const hecl::SystemChar* name) if (steamInstallDir.empty()) return {}; +#else + return {}; +#endif #elif defined(__APPLE__) steamInstallDir = getenv("HOME"); diff --git a/hecl/lib/hecl.cpp b/hecl/lib/hecl.cpp index 6a2e63724..6b321ffbd 100644 --- a/hecl/lib/hecl.cpp +++ b/hecl/lib/hecl.cpp @@ -511,6 +511,7 @@ std::vector> GetSystemLocations() { std::vector> ret; #ifdef WIN32 +#if !WINDOWS_STORE /* Add the drive names to the listing (as queried by blender) */ { wchar_t wline[FILE_MAXDIR]; @@ -561,6 +562,7 @@ std::vector> GetSystemLocations() SanitizePath(wpath); ret.push_back(NameFromPath(wpath)); } +#endif #else #ifdef __APPLE__ { @@ -754,9 +756,13 @@ int RecursiveMakeDir(const SystemChar* dir) { const SystemChar* GetTmpDir() { #ifdef _WIN32 +#if WINDOWS_STORE + wchar_t* TMPDIR = nullptr; +#else wchar_t* TMPDIR = _wgetenv(L"TEMP"); if (!TMPDIR) TMPDIR = (wchar_t*)L"\\Temp"; +#endif #else char* TMPDIR = getenv("TMPDIR"); if (!TMPDIR) @@ -765,6 +771,7 @@ const SystemChar* GetTmpDir() return TMPDIR; } +#if !WINDOWS_STORE int RunProcess(const SystemChar* path, const SystemChar* const args[]) { #ifdef _WIN32 @@ -894,5 +901,6 @@ int RunProcess(const SystemChar* path, const SystemChar* const args[]) return -1; #endif } +#endif } diff --git a/hecl/test/main.cpp b/hecl/test/main.cpp index cb8a51a3f..7ba252aaf 100644 --- a/hecl/test/main.cpp +++ b/hecl/test/main.cpp @@ -244,6 +244,7 @@ void AthenaExcHandler(athena::error::Level level, va_end(ap); } +#if !WINDOWS_STORE #if _WIN32 int wmain(int argc, const boo::SystemChar** argv) #else @@ -259,8 +260,23 @@ int main(int argc, const boo::SystemChar** argv) printf("IM DYING!!\n"); return ret; } +#else +using namespace Windows::ApplicationModel::Core; -#if _WIN32 +[Platform::MTAThread] +int WINAPIV main(Platform::Array^ params) +{ + logvisor::RegisterStandardExceptions(); + logvisor::RegisterConsoleLogger(); + HECLApplicationCallback appCb; + boo::ViewProvider^ viewProvider = + ref new boo::ViewProvider(appCb, _S("heclTest"), _S("HECL Test"), _S("heclTest"), params, false); + CoreApplication::Run(viewProvider); + return 0; +} +#endif + +#if _WIN32 && !WINDOWS_STORE int APIENTRY wWinMain(HINSTANCE hInstance, HINSTANCE, LPWSTR lpCmdLine, int) { int argc = 0;