2
0
mirror of https://github.com/AxioDL/metaforce.git synced 2025-12-08 13:04:56 +00:00

UWP support

This commit is contained in:
Jack Andersen
2017-12-05 17:22:31 -10:00
parent 1dd26f6241
commit 559096feeb
11 changed files with 62 additions and 6 deletions

View File

@@ -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()

2
hecl/extern/athena vendored

Submodule hecl/extern/athena updated: cf3baad905...da9699a7e2

2
hecl/extern/boo vendored

Submodule hecl/extern/boo updated: 598bce028b...f228f23661

View File

@@ -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)

View File

@@ -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)

View File

@@ -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()

View File

@@ -4,6 +4,10 @@
#include <ShlObj.h>
#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());

View File

@@ -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:

View File

@@ -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");

View File

@@ -511,6 +511,7 @@ std::vector<std::pair<hecl::SystemString, std::string>> GetSystemLocations()
{
std::vector<std::pair<hecl::SystemString, std::string>> 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<std::pair<hecl::SystemString, std::string>> 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
}

View File

@@ -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<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 argc = 0;