mirror of https://github.com/AxioDL/metaforce.git
UWP support
This commit is contained in:
parent
1dd26f6241
commit
559096feeb
|
@ -1,3 +1,4 @@
|
||||||
|
if(NOT WINDOWS_STORE)
|
||||||
add_executable(hecl main.cpp
|
add_executable(hecl main.cpp
|
||||||
ToolBase.hpp
|
ToolBase.hpp
|
||||||
ToolPackage.hpp
|
ToolPackage.hpp
|
||||||
|
@ -27,3 +28,4 @@ target_link_libraries(hecl
|
||||||
hecl-common hecl-blender-addon athena-core nod
|
hecl-common hecl-blender-addon athena-core nod
|
||||||
logvisor athena-libyaml ${PNG_LIB} squish xxhash zeus boo
|
logvisor athena-libyaml ${PNG_LIB} squish xxhash zeus boo
|
||||||
${ZLIB_LIBRARIES} ${LZO_LIB} ${PLAT_LIBS} ${BOO_SYS_LIBS})
|
${ZLIB_LIBRARIES} ${LZO_LIB} ${PLAT_LIBS} ${BOO_SYS_LIBS})
|
||||||
|
endif()
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
Subproject commit cf3baad9050e63e6bb8432305faf76fbb2cf9de9
|
Subproject commit da9699a7e29d2f7627e450f3d182e63a5140151d
|
|
@ -1 +1 @@
|
||||||
Subproject commit 598bce028b6caa8547c8380d45d7a7b71ae9facc
|
Subproject commit f228f236613792a7f7471610bf9e102d885dbae6
|
|
@ -164,11 +164,15 @@ int RecursiveMakeDir(const SystemChar* dir);
|
||||||
|
|
||||||
static inline const SystemChar* GetEnv(const SystemChar* name)
|
static inline const SystemChar* GetEnv(const SystemChar* name)
|
||||||
{
|
{
|
||||||
|
#if WINDOWS_STORE
|
||||||
|
return nullptr;
|
||||||
|
#else
|
||||||
#if HECL_UCS2
|
#if HECL_UCS2
|
||||||
return _wgetenv(name);
|
return _wgetenv(name);
|
||||||
#else
|
#else
|
||||||
return getenv(name);
|
return getenv(name);
|
||||||
#endif
|
#endif
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline SystemChar* Getcwd(SystemChar* buf, int maxlen)
|
static inline SystemChar* Getcwd(SystemChar* buf, int maxlen)
|
||||||
|
@ -230,7 +234,9 @@ static inline bool IsAbsolute(SystemStringView path)
|
||||||
|
|
||||||
const SystemChar* GetTmpDir();
|
const SystemChar* GetTmpDir();
|
||||||
|
|
||||||
|
#if !WINDOWS_STORE
|
||||||
int RunProcess(const SystemChar* path, const SystemChar* const args[]);
|
int RunProcess(const SystemChar* path, const SystemChar* const args[]);
|
||||||
|
#endif
|
||||||
|
|
||||||
enum class FileLockType
|
enum class FileLockType
|
||||||
{
|
{
|
||||||
|
@ -441,7 +447,7 @@ static inline bool PathRelative(const SystemChar* path)
|
||||||
{
|
{
|
||||||
if (!path || !path[0])
|
if (!path || !path[0])
|
||||||
return false;
|
return false;
|
||||||
#if _WIN32
|
#if _WIN32 && !WINDOWS_STORE
|
||||||
return PathIsRelative(path);
|
return PathIsRelative(path);
|
||||||
#else
|
#else
|
||||||
return path[0] != '/';
|
return path[0] != '/';
|
||||||
|
@ -452,9 +458,11 @@ static inline int ConsoleWidth()
|
||||||
{
|
{
|
||||||
int retval = 80;
|
int retval = 80;
|
||||||
#if _WIN32
|
#if _WIN32
|
||||||
|
#if !WINDOWS_STORE
|
||||||
CONSOLE_SCREEN_BUFFER_INFO info;
|
CONSOLE_SCREEN_BUFFER_INFO info;
|
||||||
GetConsoleScreenBufferInfo(GetStdHandle(STD_OUTPUT_HANDLE), &info);
|
GetConsoleScreenBufferInfo(GetStdHandle(STD_OUTPUT_HANDLE), &info);
|
||||||
retval = info.dwSize.X;
|
retval = info.dwSize.X;
|
||||||
|
#endif
|
||||||
#else
|
#else
|
||||||
struct winsize w;
|
struct winsize w;
|
||||||
if (ioctl(STDOUT_FILENO, TIOCGWINSZ, &w) != -1)
|
if (ioctl(STDOUT_FILENO, TIOCGWINSZ, &w) != -1)
|
||||||
|
|
|
@ -4,11 +4,13 @@ endif()
|
||||||
if(APPLE)
|
if(APPLE)
|
||||||
set(PLAT_SRCS Metal.cpp)
|
set(PLAT_SRCS Metal.cpp)
|
||||||
endif()
|
endif()
|
||||||
|
if(NOT WINDOWS_STORE)
|
||||||
|
list(APPEND PLAT_SRCS GLSL.cpp)
|
||||||
|
endif()
|
||||||
|
|
||||||
set(BACKEND_SOURCES
|
set(BACKEND_SOURCES
|
||||||
GX.cpp
|
GX.cpp
|
||||||
ProgrammableCommon.cpp
|
ProgrammableCommon.cpp
|
||||||
GLSL.cpp
|
|
||||||
${PLAT_SRCS})
|
${PLAT_SRCS})
|
||||||
|
|
||||||
hecl_add_list(Backend BACKEND_SOURCES)
|
hecl_add_list(Backend BACKEND_SOURCES)
|
||||||
|
|
|
@ -245,6 +245,7 @@ static bool RegFileExists(const hecl::SystemChar* path)
|
||||||
|
|
||||||
BlenderConnection::BlenderConnection(int verbosityLevel)
|
BlenderConnection::BlenderConnection(int verbosityLevel)
|
||||||
{
|
{
|
||||||
|
#if !WINDOWS_STORE
|
||||||
BlenderLog.report(logvisor::Info, "Establishing BlenderConnection...");
|
BlenderLog.report(logvisor::Info, "Establishing BlenderConnection...");
|
||||||
|
|
||||||
/* Put hecl_blendershell.py in temp dir */
|
/* Put hecl_blendershell.py in temp dir */
|
||||||
|
@ -552,6 +553,9 @@ BlenderConnection::BlenderConnection(int verbosityLevel)
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
BlenderLog.report(logvisor::Fatal, "BlenderConnection not available on UWP");
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
BlenderConnection::~BlenderConnection()
|
BlenderConnection::~BlenderConnection()
|
||||||
|
|
|
@ -4,6 +4,10 @@
|
||||||
#include <ShlObj.h>
|
#include <ShlObj.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if WINDOWS_STORE
|
||||||
|
using namespace Windows::Storage;
|
||||||
|
#endif
|
||||||
|
|
||||||
namespace hecl
|
namespace hecl
|
||||||
{
|
{
|
||||||
namespace Runtime
|
namespace Runtime
|
||||||
|
@ -14,12 +18,16 @@ FileStoreManager::FileStoreManager(SystemStringView domain)
|
||||||
: m_domain(domain)
|
: m_domain(domain)
|
||||||
{
|
{
|
||||||
#if _WIN32
|
#if _WIN32
|
||||||
|
#if !WINDOWS_STORE
|
||||||
WCHAR home[MAX_PATH];
|
WCHAR home[MAX_PATH];
|
||||||
if (!SUCCEEDED(SHGetFolderPathW(NULL, CSIDL_PROFILE, NULL, 0, home)))
|
if (!SUCCEEDED(SHGetFolderPathW(NULL, CSIDL_PROFILE, NULL, 0, home)))
|
||||||
Log.report(logvisor::Fatal, _S("unable to locate profile for file store"));
|
Log.report(logvisor::Fatal, _S("unable to locate profile for file store"));
|
||||||
|
|
||||||
SystemString path(home);
|
SystemString path(home);
|
||||||
|
#else
|
||||||
|
StorageFolder^ cacheFolder = ApplicationData::Current->LocalCacheFolder;
|
||||||
|
SystemString path(cacheFolder->Path->Data());
|
||||||
|
#endif
|
||||||
path += _S("/.heclrun");
|
path += _S("/.heclrun");
|
||||||
|
|
||||||
hecl::MakeDir(path.c_str());
|
hecl::MakeDir(path.c_str());
|
||||||
|
|
|
@ -12,7 +12,9 @@ namespace hecl
|
||||||
{
|
{
|
||||||
namespace Runtime
|
namespace Runtime
|
||||||
{
|
{
|
||||||
|
#if BOO_HAS_GL
|
||||||
IShaderBackendFactory* _NewGLSLBackendFactory();
|
IShaderBackendFactory* _NewGLSLBackendFactory();
|
||||||
|
#endif
|
||||||
#if _WIN32
|
#if _WIN32
|
||||||
IShaderBackendFactory* _NewHLSLBackendFactory();
|
IShaderBackendFactory* _NewHLSLBackendFactory();
|
||||||
#endif
|
#endif
|
||||||
|
@ -129,9 +131,11 @@ ShaderCacheManager::ShaderCacheManager(const FileStoreManager& storeMgr,
|
||||||
|
|
||||||
switch (plat)
|
switch (plat)
|
||||||
{
|
{
|
||||||
|
#if BOO_HAS_GL
|
||||||
case boo::IGraphicsDataFactory::Platform::OpenGL:
|
case boo::IGraphicsDataFactory::Platform::OpenGL:
|
||||||
m_factory.reset(_NewGLSLBackendFactory());
|
m_factory.reset(_NewGLSLBackendFactory());
|
||||||
break;
|
break;
|
||||||
|
#endif
|
||||||
#if _WIN32
|
#if _WIN32
|
||||||
case boo::IGraphicsDataFactory::Platform::D3D11:
|
case boo::IGraphicsDataFactory::Platform::D3D11:
|
||||||
case boo::IGraphicsDataFactory::Platform::D3D12:
|
case boo::IGraphicsDataFactory::Platform::D3D12:
|
||||||
|
|
|
@ -20,6 +20,7 @@ hecl::SystemString FindCommonSteamApp(const hecl::SystemChar* name)
|
||||||
hecl::Sstat theStat;
|
hecl::Sstat theStat;
|
||||||
|
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
|
#if !WINDOWS_STORE
|
||||||
HKEY hkey;
|
HKEY hkey;
|
||||||
hecl::SystemChar _steamInstallDir[MAX_PATH] = {0};
|
hecl::SystemChar _steamInstallDir[MAX_PATH] = {0};
|
||||||
if (RegOpenKeyEx(HKEY_LOCAL_MACHINE, _S("Software\\Valve\\Steam"),
|
if (RegOpenKeyEx(HKEY_LOCAL_MACHINE, _S("Software\\Valve\\Steam"),
|
||||||
|
@ -38,6 +39,9 @@ hecl::SystemString FindCommonSteamApp(const hecl::SystemChar* name)
|
||||||
|
|
||||||
if (steamInstallDir.empty())
|
if (steamInstallDir.empty())
|
||||||
return {};
|
return {};
|
||||||
|
#else
|
||||||
|
return {};
|
||||||
|
#endif
|
||||||
|
|
||||||
#elif defined(__APPLE__)
|
#elif defined(__APPLE__)
|
||||||
steamInstallDir = getenv("HOME");
|
steamInstallDir = getenv("HOME");
|
||||||
|
|
|
@ -511,6 +511,7 @@ std::vector<std::pair<hecl::SystemString, std::string>> GetSystemLocations()
|
||||||
{
|
{
|
||||||
std::vector<std::pair<hecl::SystemString, std::string>> ret;
|
std::vector<std::pair<hecl::SystemString, std::string>> ret;
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
|
#if !WINDOWS_STORE
|
||||||
/* Add the drive names to the listing (as queried by blender) */
|
/* Add the drive names to the listing (as queried by blender) */
|
||||||
{
|
{
|
||||||
wchar_t wline[FILE_MAXDIR];
|
wchar_t wline[FILE_MAXDIR];
|
||||||
|
@ -561,6 +562,7 @@ std::vector<std::pair<hecl::SystemString, std::string>> GetSystemLocations()
|
||||||
SanitizePath(wpath);
|
SanitizePath(wpath);
|
||||||
ret.push_back(NameFromPath(wpath));
|
ret.push_back(NameFromPath(wpath));
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
#else
|
#else
|
||||||
#ifdef __APPLE__
|
#ifdef __APPLE__
|
||||||
{
|
{
|
||||||
|
@ -754,9 +756,13 @@ int RecursiveMakeDir(const SystemChar* dir) {
|
||||||
const SystemChar* GetTmpDir()
|
const SystemChar* GetTmpDir()
|
||||||
{
|
{
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
|
#if WINDOWS_STORE
|
||||||
|
wchar_t* TMPDIR = nullptr;
|
||||||
|
#else
|
||||||
wchar_t* TMPDIR = _wgetenv(L"TEMP");
|
wchar_t* TMPDIR = _wgetenv(L"TEMP");
|
||||||
if (!TMPDIR)
|
if (!TMPDIR)
|
||||||
TMPDIR = (wchar_t*)L"\\Temp";
|
TMPDIR = (wchar_t*)L"\\Temp";
|
||||||
|
#endif
|
||||||
#else
|
#else
|
||||||
char* TMPDIR = getenv("TMPDIR");
|
char* TMPDIR = getenv("TMPDIR");
|
||||||
if (!TMPDIR)
|
if (!TMPDIR)
|
||||||
|
@ -765,6 +771,7 @@ const SystemChar* GetTmpDir()
|
||||||
return TMPDIR;
|
return TMPDIR;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if !WINDOWS_STORE
|
||||||
int RunProcess(const SystemChar* path, const SystemChar* const args[])
|
int RunProcess(const SystemChar* path, const SystemChar* const args[])
|
||||||
{
|
{
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
|
@ -894,5 +901,6 @@ int RunProcess(const SystemChar* path, const SystemChar* const args[])
|
||||||
return -1;
|
return -1;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -244,6 +244,7 @@ void AthenaExcHandler(athena::error::Level level,
|
||||||
va_end(ap);
|
va_end(ap);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if !WINDOWS_STORE
|
||||||
#if _WIN32
|
#if _WIN32
|
||||||
int wmain(int argc, const boo::SystemChar** argv)
|
int wmain(int argc, const boo::SystemChar** argv)
|
||||||
#else
|
#else
|
||||||
|
@ -259,8 +260,23 @@ int main(int argc, const boo::SystemChar** argv)
|
||||||
printf("IM DYING!!\n");
|
printf("IM DYING!!\n");
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
using namespace Windows::ApplicationModel::Core;
|
||||||
|
|
||||||
#if _WIN32
|
[Platform::MTAThread]
|
||||||
|
int WINAPIV main(Platform::Array<Platform::String^>^ 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 APIENTRY wWinMain(HINSTANCE hInstance, HINSTANCE, LPWSTR lpCmdLine, int)
|
||||||
{
|
{
|
||||||
int argc = 0;
|
int argc = 0;
|
||||||
|
|
Loading…
Reference in New Issue