Skip to content

Commit

Permalink
Added support for WinRT 8.1 Universal Apps.
Browse files Browse the repository at this point in the history
Hopefully this will work on Win10 as well... Only time will tell!
Here's what's changed:
1. Added a platform_winrt.cpp file. It's based on platform_windows.c but has some WinRT-specific changes.
2. Changed physfs_platforms.h to define PHYSFS_PLATFORM_WINRT when running on WinRT. PHYSFS_PLATFORM_WINDOWS should also be defined, as WinRT behaves a lot like "normal" Windows and this flag is tested against in multiple parts of the PhysFS source code.
3. Changed platform_windows.c to not be used when PHYSFS_PLATFORM_WINRT is defined.
4. In order to work on Windows ARM devices, I had to change in physfs_internal.h, to include _M_ARM as a flag for running on ARM as "ARM" and "__arm__" aren't defined when running on a Windows ARM device.

What I've tested:
* Setting up a "sane folder configuration"
* Reading and writing files
* Mounting zip files
* Using seek & tell
* Checking file length

All of these work fine. I couldn't get the actual test software to run on WinRT, but it seems like eveyrthing's working. I've tested these things on my Windows 8.1 computer, as well as my Lumia 920 which is currently running Windows 8.1.
  • Loading branch information
ahrnbom committed Mar 29, 2015
1 parent f6a62ec commit 9d55f3f
Show file tree
Hide file tree
Showing 4 changed files with 681 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/physfs_internal.h
Expand Up @@ -134,7 +134,7 @@ void __PHYSFS_smallFree(void *ptr);
#if defined(__i386__) || defined(__ia64__) || \
defined(_M_IX86) || defined(_M_IA64) || defined(_M_X64) || \
(defined(__alpha__) || defined(__alpha)) || \
defined(__arm__) || defined(ARM) || \
defined(__arm__) || defined(ARM) || defined(_M_ARM) || \
(defined(__mips__) && defined(__MIPSEL__)) || \
defined(__SYMBIAN32__) || \
defined(__x86_64__) || \
Expand Down
4 changes: 4 additions & 0 deletions src/physfs_platforms.h
Expand Up @@ -21,6 +21,10 @@
# define PHYSFS_PLATFORM_POSIX 1
#elif (defined _WIN32_WCE) || (defined _WIN64_WCE)
# error PocketPC support was dropped from PhysicsFS 2.1. Sorry.
#elif ((defined WINAPI_FAMILY) && WINAPI_FAMILY == WINAPI_FAMILY_APP)
# define PHYSFS_PLATFORM_WINRT 1
# define PHYSFS_NO_CDROM_SUPPORT 1
# define PHYSFS_PLATFORM_WINDOWS 1;
#elif (((defined _WIN32) || (defined _WIN64)) && (!defined __CYGWIN__))
# define PHYSFS_PLATFORM_WINDOWS 1
#elif (defined OS2)
Expand Down
2 changes: 2 additions & 0 deletions src/platform_windows.c
Expand Up @@ -10,6 +10,7 @@
#include "physfs_platforms.h"

#ifdef PHYSFS_PLATFORM_WINDOWS
#ifndef PHYSFS_PLATFORM_WINRT

/* Forcibly disable UNICODE macro, since we manage this ourselves. */
#ifdef UNICODE
Expand Down Expand Up @@ -928,6 +929,7 @@ int __PHYSFS_platformSetDefaultAllocator(PHYSFS_Allocator *a)
} /* __PHYSFS_platformSetDefaultAllocator */

#endif /* PHYSFS_PLATFORM_WINDOWS */
#endif /* PHYSFS_PLATFORM_WINRT */

/* end of windows.c ... */

Expand Down

0 comments on commit 9d55f3f

Please sign in to comment.