diff --git a/.gitignore b/.gitignore
index 44414c8..99043c5 100644
--- a/.gitignore
+++ b/.gitignore
@@ -105,3 +105,7 @@ build/windows/studio/Debug/
build/windows/studio/Debug Pro/
build/windows/studio/Release/
build/windows/studio/Release Pro/
+build/uwp/studio/Debug/
+build/uwp/studio/Debug Pro/
+build/uwp/studio/Release/
+build/uwp/studio/Release Pro/
diff --git a/build/uwp/studio/studio.vcxproj b/build/uwp/studio/studio.vcxproj
new file mode 100644
index 0000000..16f7ed1
--- /dev/null
+++ b/build/uwp/studio/studio.vcxproj
@@ -0,0 +1,247 @@
+
+
+
+
+ Debug
+ ARM
+
+
+ Debug
+ Win32
+
+
+ Debug
+ x64
+
+
+ Release
+ ARM
+
+
+ Release
+ Win32
+
+
+ Release
+ x64
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {978f53db-f959-4cb4-84a7-463af29949be}
+
+
+ {bc1084df-210a-48d6-a077-761d8c16947b}
+
+
+ {53802f21-41da-4ac1-8b62-0dac2ccb8af8}
+
+
+ {9c39acf1-5f52-4a2b-a467-9f2805d6174b}
+
+
+
+ {6a22403a-6cf5-49f2-a012-ec04c9496306}
+ DynamicLibrary
+ studio
+ en-US
+ 14.0
+ true
+ Windows Store
+ 10.0.14393.0
+ 10.0.14393.0
+ 10.0
+
+
+
+ DynamicLibrary
+ true
+ v140
+
+
+ DynamicLibrary
+ true
+ v140
+
+
+ DynamicLibrary
+ true
+ v140
+
+
+ DynamicLibrary
+ false
+ true
+ v140
+
+
+ DynamicLibrary
+ false
+ true
+ v140
+
+
+ DynamicLibrary
+ false
+ true
+ v140
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ false
+ false
+
+
+ false
+ false
+
+
+ false
+ false
+
+
+ false
+ false
+
+
+ false
+ false
+
+
+ false
+ false
+
+
+
+ NotUsing
+ false
+ TIC80_SHARED;_WINDLL;%(PreprocessorDefinitions)
+ ..\include;..\..\..\include;..\..\..\3rd-party\lua-5.3.1\src;..\..\..\3rd-party\giflib-5.1.4\lib;..\..\..\3rd-party\zlib-1.2.8;$(GeneratedFilesDir);$(IntDir);%(AdditionalIncludeDirectories)
+ false
+
+
+ Console
+ false
+ false
+
+
+
+
+ NotUsing
+ false
+ TIC80_SHARED;_WINDLL;%(PreprocessorDefinitions)
+ ..\include;..\..\..\include;..\..\..\3rd-party\lua-5.3.1\src;..\..\..\3rd-party\giflib-5.1.4\lib;..\..\..\3rd-party\zlib-1.2.8;$(GeneratedFilesDir);$(IntDir);%(AdditionalIncludeDirectories)
+ false
+
+
+ Console
+ false
+ false
+
+
+
+
+ NotUsing
+ false
+ TIC80_SHARED;_ARM_WINAPI_PARTITION_DESKTOP_SDK_AVAILABLE=1;%(ClCompile.PreprocessorDefinitions)
+ ..\include;..\..\..\include;..\..\..\3rd-party\lua-5.3.1\src;..\..\..\3rd-party\giflib-5.1.4\lib;..\..\..\3rd-party\zlib-1.2.8;$(GeneratedFilesDir);$(IntDir);%(AdditionalIncludeDirectories)
+ false
+
+
+ Console
+ false
+ false
+
+
+
+
+ NotUsing
+ false
+ TIC80_SHARED;_ARM_WINAPI_PARTITION_DESKTOP_SDK_AVAILABLE=1;%(ClCompile.PreprocessorDefinitions)
+ ..\include;..\..\..\include;..\..\..\3rd-party\lua-5.3.1\src;..\..\..\3rd-party\giflib-5.1.4\lib;..\..\..\3rd-party\zlib-1.2.8;$(GeneratedFilesDir);$(IntDir);%(AdditionalIncludeDirectories)
+ false
+
+
+ Console
+ false
+ false
+
+
+
+
+ NotUsing
+ false
+ TIC80_SHARED;_WINDLL;%(PreprocessorDefinitions)
+ ..\include;..\..\..\include;..\..\..\3rd-party\lua-5.3.1\src;..\..\..\3rd-party\giflib-5.1.4\lib;..\..\..\3rd-party\zlib-1.2.8;$(GeneratedFilesDir);$(IntDir);%(AdditionalIncludeDirectories)
+ false
+
+
+ Console
+ false
+ false
+
+
+
+
+ NotUsing
+ false
+ TIC80_SHARED;_WINDLL;%(PreprocessorDefinitions)
+ ..\include;..\..\..\include;..\..\..\3rd-party\lua-5.3.1\src;..\..\..\3rd-party\giflib-5.1.4\lib;..\..\..\3rd-party\zlib-1.2.8;$(GeneratedFilesDir);$(IntDir);%(AdditionalIncludeDirectories)
+ false
+
+
+ Console
+ false
+ false
+
+
+
+
+
+
\ No newline at end of file
diff --git a/build/uwp/studio/studio.vcxproj.filters b/build/uwp/studio/studio.vcxproj.filters
new file mode 100644
index 0000000..8e69249
--- /dev/null
+++ b/build/uwp/studio/studio.vcxproj.filters
@@ -0,0 +1,73 @@
+
+
+
+
+ {fd391d6f-58f5-4aba-a1f1-41bf34081296}
+
+
+ {cf22f775-8c8b-4047-a23c-fa216fa3b08f}
+
+
+
+
+ src
+
+
+ src
+
+
+ src
+
+
+ src
+
+
+ src
+
+
+ src
+
+
+ src
+
+
+ src
+
+
+ src
+
+
+ src
+
+
+ src
+
+
+ src
+
+
+ src
+
+
+ src
+
+
+ src
+
+
+ src
+
+
+ src
+
+
+ src
+
+
+ src\ext
+
+
+ src\ext
+
+
+
\ No newline at end of file
diff --git a/build/uwp/tic/tic.sln b/build/uwp/tic/tic.sln
index acd7e65..3623212 100644
--- a/build/uwp/tic/tic.sln
+++ b/build/uwp/tic/tic.sln
@@ -17,6 +17,8 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "zlib-uwp", "..\..\..\3rd-pa
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "wren", "..\wren\wren.vcxproj", "{BBB0D01A-B124-416C-BE26-E6993154A555}"
EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "studio", "..\studio\studio.vcxproj", "{6A22403A-6CF5-49F2-A012-EC04C9496306}"
+EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|ARM = Debug|ARM
@@ -117,6 +119,18 @@ Global
{BBB0D01A-B124-416C-BE26-E6993154A555}.Release|x64.Build.0 = Release|x64
{BBB0D01A-B124-416C-BE26-E6993154A555}.Release|x86.ActiveCfg = Release|Win32
{BBB0D01A-B124-416C-BE26-E6993154A555}.Release|x86.Build.0 = Release|Win32
+ {6A22403A-6CF5-49F2-A012-EC04C9496306}.Debug|ARM.ActiveCfg = Debug|ARM
+ {6A22403A-6CF5-49F2-A012-EC04C9496306}.Debug|ARM.Build.0 = Debug|ARM
+ {6A22403A-6CF5-49F2-A012-EC04C9496306}.Debug|x64.ActiveCfg = Debug|x64
+ {6A22403A-6CF5-49F2-A012-EC04C9496306}.Debug|x64.Build.0 = Debug|x64
+ {6A22403A-6CF5-49F2-A012-EC04C9496306}.Debug|x86.ActiveCfg = Debug|Win32
+ {6A22403A-6CF5-49F2-A012-EC04C9496306}.Debug|x86.Build.0 = Debug|Win32
+ {6A22403A-6CF5-49F2-A012-EC04C9496306}.Release|ARM.ActiveCfg = Release|ARM
+ {6A22403A-6CF5-49F2-A012-EC04C9496306}.Release|ARM.Build.0 = Release|ARM
+ {6A22403A-6CF5-49F2-A012-EC04C9496306}.Release|x64.ActiveCfg = Release|x64
+ {6A22403A-6CF5-49F2-A012-EC04C9496306}.Release|x64.Build.0 = Release|x64
+ {6A22403A-6CF5-49F2-A012-EC04C9496306}.Release|x86.ActiveCfg = Release|Win32
+ {6A22403A-6CF5-49F2-A012-EC04C9496306}.Release|x86.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
diff --git a/build/uwp/tic/tic.vcxproj b/build/uwp/tic/tic.vcxproj
index b7ed1be..d6dfff2 100644
--- a/build/uwp/tic/tic.vcxproj
+++ b/build/uwp/tic/tic.vcxproj
@@ -219,17 +219,8 @@
{89e9b32e-a86a-47c3-a948-d2b1622925ce}
-
- {978f53db-f959-4cb4-84a7-463af29949be}
-
-
- {bc1084df-210a-48d6-a077-761d8c16947b}
-
-
- {53802f21-41da-4ac1-8b62-0dac2ccb8af8}
-
-
- {9c39acf1-5f52-4a2b-a467-9f2805d6174b}
+
+ {6a22403a-6cf5-49f2-a012-ec04c9496306}
@@ -244,10 +235,6 @@
-
-
-
-
true
true
@@ -256,23 +243,9 @@
true
true
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
-
diff --git a/build/uwp/tic/tic.vcxproj.filters b/build/uwp/tic/tic.vcxproj.filters
index 6a52f48..6d7316c 100644
--- a/build/uwp/tic/tic.vcxproj.filters
+++ b/build/uwp/tic/tic.vcxproj.filters
@@ -47,72 +47,12 @@
-
- src
-
-
- src
-
-
- src
-
-
- src
-
-
- src
-
-
- src
-
-
- src
-
-
- src
-
-
- src
-
src\ext
-
- src
-
-
- src
-
-
- src
-
-
- src
-
-
- src
-
-
- src\ext
-
-
- src\ext
-
-
- src
-
src
-
- src
-
-
- src
-
-
- src
-
src\ext\net
@@ -123,6 +63,12 @@
src\ext\net
+
+ src
+
+
+ src
+
diff --git a/include/tic80_config.h b/include/tic80_config.h
index 3ffd5b3..3717ef4 100644
--- a/include/tic80_config.h
+++ b/include/tic80_config.h
@@ -22,11 +22,48 @@
#pragma once
-#if (defined(WIN32) || defined(_WIN32) || defined(__MINGW32__))
-# undef __TIC_WINDOWS__
-# define __TIC_WINDOWS__ 1
+#if defined(__APPLE__)
+/* lets us know what version of Mac OS X we're compiling on */
+#include "AvailabilityMacros.h"
+#include "TargetConditionals.h"
+
+ #ifndef TARGET_OS_IPHONE
+ #undef __TIC_MACOSX__
+ #define __TIC_MACOSX__ 1
+ #if MAC_OS_X_VERSION_MIN_REQUIRED < 1060
+ # error SDL for Mac OS X only supports deploying on 10.6 and above.
+ #endif /* MAC_OS_X_VERSION_MIN_REQUIRED < 1060 */
+ #endif /* TARGET_OS_IPHONE */
+
+#endif /* defined(__APPLE__) */
+
+#if defined(WIN32) || defined(_WIN32) || defined(__CYGWIN__) || defined(__MINGW32__)
+/* Try to find out if we're compiling for WinRT or non-WinRT */
+#if defined(_MSC_VER) && defined(__has_include)
+#define HAVE_WINAPIFAMILY_H __has_include()
+/* If _USING_V110_SDK71_ is defined it means we are using the Windows XP toolset. */
+#elif defined(_MSC_VER) && (_MSC_VER >= 1700 && !_USING_V110_SDK71_) /* _MSC_VER == 1700 for Visual Studio 2012 */
+#define HAVE_WINAPIFAMILY_H 1
+#else
+#define HAVE_WINAPIFAMILY_H 0
#endif
+#if HAVE_WINAPIFAMILY_H
+#include
+#define WINAPI_FAMILY_WINRT (!WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP) && WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP))
+#else
+#define WINAPI_FAMILY_WINRT 0
+#endif /* HAVE_WINAPIFAMILY_H */
+
+#if WINAPI_FAMILY_WINRT
+#undef __TIC_WINRT__
+#define __TIC_WINRT__ 1
+#else
+#undef __TIC_WINDOWS__
+#define __TIC_WINDOWS__ 1
+#endif
+#endif
+
#if (defined(linux) || defined(__linux) || defined(__linux__))
# undef __TIC_LINUX__
# define __TIC_LINUX__ 1
@@ -34,7 +71,7 @@
#ifndef TIC80_API
# if defined(TIC80_SHARED)
-# if defined(__TIC_WINDOWS__)
+# if defined(__TIC_WINDOWS__) || defined(__TIC_WINRT__)
# define TIC80_API __declspec(dllexport)
# elif defined(__TIC_LINUX__)
# define TIC80_API __attribute__ ((visibility("default")))
diff --git a/src/fs.c b/src/fs.c
index 9bcbc8b..b0439b1 100644
--- a/src/fs.c
+++ b/src/fs.c
@@ -32,7 +32,7 @@
#include
#include
-#if defined(__WINRT__) || defined(__TIC_WINDOWS__)
+#if defined(__TIC_WINRT__) || defined(__TIC_WINDOWS__)
#include
#include
#else
@@ -104,7 +104,7 @@ bool fsIsInPublicDir(FileSystem* fs)
return isPublic(fs);
}
-#if defined(__TIC_WINDOWS__) || defined(__WINRT__)
+#if defined(__TIC_WINDOWS__) || defined(__TIC_WINRT__)
// #define UTF8ToString(S) (wchar_t *)SDL_iconv_string("UTF-16LE", "UTF-8", (char *)(S), strlen(S)+1)
// #define StringToUTF8(S) SDL_iconv_string("UTF-8", "UTF-16LE", (char *)(S), (wcslen(S)+1)*sizeof(wchar_t))
@@ -334,7 +334,7 @@ void fsEnumFiles(FileSystem* fs, ListCallback callback, void* data)
bool fsDeleteDir(FileSystem* fs, const char* name)
{
-#if defined(__WINRT__) || defined(__TIC_WINDOWS__)
+#if defined(__TIC_WINRT__) || defined(__TIC_WINDOWS__)
const char* path = getFilePath(fs, name);
bool result = tic_rmdir(UTF8ToString(path));
#else
@@ -393,7 +393,7 @@ static void onAddFile(const char* name, const u8* buffer, s32 size, void* data,
fwrite(buffer, 1, size, dest);
fclose(dest);
-#if !defined(__WINRT__) && !defined(__TIC_WINDOWS__)
+#if !defined(__TIC_WINRT__) && !defined(__TIC_WINDOWS__)
if(mode)
chmod(path, mode);
#endif
@@ -443,7 +443,7 @@ static void onGetFile(bool result, void* data)
static u32 fsGetMode(FileSystem* fs, const char* name)
{
-#if defined(__WINRT__) || defined(__TIC_WINDOWS__)
+#if defined(__TIC_WINRT__) || defined(__TIC_WINDOWS__)
return 0;
#else
const char* path = getFilePath(fs, name);
@@ -696,7 +696,7 @@ const char* fsFullname(const char *path)
{
char* result = NULL;
-#if defined(__TIC_WINDOWS__) || defined(__WINRT__)
+#if defined(__TIC_WINDOWS__) || defined(__TIC_WINRT__)
static wchar_t wpath[FILENAME_MAX];
GetFullPathNameW(UTF8ToString(path), sizeof(wpath), wpath, NULL);
@@ -714,7 +714,7 @@ const char* fsBasename(const char *path)
{
char* result = NULL;
-#if defined(__TIC_WINDOWS__) || defined(__WINRT__)
+#if defined(__TIC_WINDOWS__) || defined(__TIC_WINRT__)
#define SEP "\\"
#else
#define SEP "/"