src/physfs_platforms.h
author Martin Ahrnbom <m.ahrnbom@outlook.com>
Sun, 29 Mar 2015 07:03:30 +0200
changeset 1356 8de68968fcd0
parent 1337 3b2e649c044c
child 1358 d09554806efb
permissions -rw-r--r--
Added support for WinRT 8.1 Universal Apps. 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.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
818
e36f23f49042 Now compiles everything whether we need it or not, removing whole files with
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
     1
#ifndef _INCL_PHYSFS_PLATFORMS
e36f23f49042 Now compiles everything whether we need it or not, removing whole files with
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
     2
#define _INCL_PHYSFS_PLATFORMS
e36f23f49042 Now compiles everything whether we need it or not, removing whole files with
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
     3
e36f23f49042 Now compiles everything whether we need it or not, removing whole files with
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
     4
#ifndef __PHYSICSFS_INTERNAL__
e36f23f49042 Now compiles everything whether we need it or not, removing whole files with
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
     5
#error Do not include this header from your applications.
e36f23f49042 Now compiles everything whether we need it or not, removing whole files with
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
     6
#endif
e36f23f49042 Now compiles everything whether we need it or not, removing whole files with
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
     7
e36f23f49042 Now compiles everything whether we need it or not, removing whole files with
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
     8
/*
e36f23f49042 Now compiles everything whether we need it or not, removing whole files with
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
     9
 * These only define the platforms to determine which files in the platforms
e36f23f49042 Now compiles everything whether we need it or not, removing whole files with
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    10
 *  directory should be compiled. For example, technically BeOS can be called
e36f23f49042 Now compiles everything whether we need it or not, removing whole files with
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    11
 *  a "unix" system, but since it doesn't use unix.c, we don't define
e36f23f49042 Now compiles everything whether we need it or not, removing whole files with
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    12
 *  PHYSFS_PLATFORM_UNIX on that system.
e36f23f49042 Now compiles everything whether we need it or not, removing whole files with
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    13
 */
e36f23f49042 Now compiles everything whether we need it or not, removing whole files with
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    14
947
b0c91495af9b Haiku support.
Ryan C. Gordon <icculus@icculus.org>
parents: 942
diff changeset
    15
#if (defined __HAIKU__)
1235
2ed0567fe413 Make physfs_platforms.h define with a 1, so "#if X" works.
Ryan C. Gordon <icculus@icculus.org>
parents: 1233
diff changeset
    16
#  define PHYSFS_PLATFORM_HAIKU 1
2ed0567fe413 Make physfs_platforms.h define with a 1, so "#if X" works.
Ryan C. Gordon <icculus@icculus.org>
parents: 1233
diff changeset
    17
#  define PHYSFS_PLATFORM_BEOS 1
2ed0567fe413 Make physfs_platforms.h define with a 1, so "#if X" works.
Ryan C. Gordon <icculus@icculus.org>
parents: 1233
diff changeset
    18
#  define PHYSFS_PLATFORM_POSIX 1
947
b0c91495af9b Haiku support.
Ryan C. Gordon <icculus@icculus.org>
parents: 942
diff changeset
    19
#elif ((defined __BEOS__) || (defined __beos__))
1235
2ed0567fe413 Make physfs_platforms.h define with a 1, so "#if X" works.
Ryan C. Gordon <icculus@icculus.org>
parents: 1233
diff changeset
    20
#  define PHYSFS_PLATFORM_BEOS 1
2ed0567fe413 Make physfs_platforms.h define with a 1, so "#if X" works.
Ryan C. Gordon <icculus@icculus.org>
parents: 1233
diff changeset
    21
#  define PHYSFS_PLATFORM_POSIX 1
818
e36f23f49042 Now compiles everything whether we need it or not, removing whole files with
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    22
#elif (defined _WIN32_WCE) || (defined _WIN64_WCE)
1196
54a1dfb1e6f7 Removed PocketPC support. It was old and crusty and targeted a dead platform.
Ryan C. Gordon <icculus@icculus.org>
parents: 1011
diff changeset
    23
#  error PocketPC support was dropped from PhysicsFS 2.1. Sorry.
1356
8de68968fcd0 Added support for WinRT 8.1 Universal Apps.
Martin Ahrnbom <m.ahrnbom@outlook.com>
parents: 1337
diff changeset
    24
#elif ((defined WINAPI_FAMILY) && WINAPI_FAMILY == WINAPI_FAMILY_APP)
8de68968fcd0 Added support for WinRT 8.1 Universal Apps.
Martin Ahrnbom <m.ahrnbom@outlook.com>
parents: 1337
diff changeset
    25
#	define PHYSFS_PLATFORM_WINRT 1
8de68968fcd0 Added support for WinRT 8.1 Universal Apps.
Martin Ahrnbom <m.ahrnbom@outlook.com>
parents: 1337
diff changeset
    26
#	define PHYSFS_NO_CDROM_SUPPORT 1
8de68968fcd0 Added support for WinRT 8.1 Universal Apps.
Martin Ahrnbom <m.ahrnbom@outlook.com>
parents: 1337
diff changeset
    27
#   define PHYSFS_PLATFORM_WINDOWS 1;
818
e36f23f49042 Now compiles everything whether we need it or not, removing whole files with
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    28
#elif (((defined _WIN32) || (defined _WIN64)) && (!defined __CYGWIN__))
1235
2ed0567fe413 Make physfs_platforms.h define with a 1, so "#if X" works.
Ryan C. Gordon <icculus@icculus.org>
parents: 1233
diff changeset
    29
#  define PHYSFS_PLATFORM_WINDOWS 1
818
e36f23f49042 Now compiles everything whether we need it or not, removing whole files with
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    30
#elif (defined OS2)
1197
65f35dc8f84c Removed OS/2 support.
Ryan C. Gordon <icculus@icculus.org>
parents: 1196
diff changeset
    31
#  error OS/2 support was dropped from PhysicsFS 2.1. Sorry.
818
e36f23f49042 Now compiles everything whether we need it or not, removing whole files with
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    32
#elif ((defined __MACH__) && (defined __APPLE__))
954
7f59a79739ba Fixed comment typo.
Ryan C. Gordon <icculus@icculus.org>
parents: 947
diff changeset
    33
/* To check if iphone or not, we need to include this file */
1291
854cdfefdf12 For iOS, build the Mac OS X platform code, not the generic Unix code.
Ryan C. Gordon <icculus@icculus.org>
parents: 1235
diff changeset
    34
#  include <TargetConditionals.h>
854cdfefdf12 For iOS, build the Mac OS X platform code, not the generic Unix code.
Ryan C. Gordon <icculus@icculus.org>
parents: 1235
diff changeset
    35
#  if ((TARGET_IPHONE_SIMULATOR) || (TARGET_OS_IPHONE))
854cdfefdf12 For iOS, build the Mac OS X platform code, not the generic Unix code.
Ryan C. Gordon <icculus@icculus.org>
parents: 1235
diff changeset
    36
#     define PHYSFS_NO_CDROM_SUPPORT 1
942
e7bed87e50ce iPhone support patch (thanks, Christian!)
Ryan C. Gordon <icculus@icculus.org>
parents: 847
diff changeset
    37
#  endif
1291
854cdfefdf12 For iOS, build the Mac OS X platform code, not the generic Unix code.
Ryan C. Gordon <icculus@icculus.org>
parents: 1235
diff changeset
    38
#  define PHYSFS_PLATFORM_MACOSX 1
854cdfefdf12 For iOS, build the Mac OS X platform code, not the generic Unix code.
Ryan C. Gordon <icculus@icculus.org>
parents: 1235
diff changeset
    39
#  define PHYSFS_PLATFORM_POSIX 1
818
e36f23f49042 Now compiles everything whether we need it or not, removing whole files with
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    40
#elif defined(macintosh)
825
b26da6cdcebb Dropped classic Mac OS support. Mac OS X remains supported, though.
Ryan C. Gordon <icculus@icculus.org>
parents: 818
diff changeset
    41
#  error Classic Mac OS support was dropped from PhysicsFS 2.0. Move to OS X.
1313
8f95fc8eea0c Turn off CD-ROM support on Android.
Ryan C. Gordon <icculus@icculus.org>
parents: 1295
diff changeset
    42
#elif defined(ANDROID)
8f95fc8eea0c Turn off CD-ROM support on Android.
Ryan C. Gordon <icculus@icculus.org>
parents: 1295
diff changeset
    43
#  define PHYSFS_PLATFORM_LINUX 1
8f95fc8eea0c Turn off CD-ROM support on Android.
Ryan C. Gordon <icculus@icculus.org>
parents: 1295
diff changeset
    44
#  define PHYSFS_PLATFORM_UNIX 1
8f95fc8eea0c Turn off CD-ROM support on Android.
Ryan C. Gordon <icculus@icculus.org>
parents: 1295
diff changeset
    45
#  define PHYSFS_PLATFORM_POSIX 1
8f95fc8eea0c Turn off CD-ROM support on Android.
Ryan C. Gordon <icculus@icculus.org>
parents: 1295
diff changeset
    46
#  define PHYSFS_NO_CDROM_SUPPORT 1
1233
53a01072f272 Added Linux and Solaris tests.
Ryan C. Gordon <icculus@icculus.org>
parents: 1197
diff changeset
    47
#elif defined(__linux)
1235
2ed0567fe413 Make physfs_platforms.h define with a 1, so "#if X" works.
Ryan C. Gordon <icculus@icculus.org>
parents: 1233
diff changeset
    48
#  define PHYSFS_PLATFORM_LINUX 1
2ed0567fe413 Make physfs_platforms.h define with a 1, so "#if X" works.
Ryan C. Gordon <icculus@icculus.org>
parents: 1233
diff changeset
    49
#  define PHYSFS_PLATFORM_UNIX 1
2ed0567fe413 Make physfs_platforms.h define with a 1, so "#if X" works.
Ryan C. Gordon <icculus@icculus.org>
parents: 1233
diff changeset
    50
#  define PHYSFS_PLATFORM_POSIX 1
1233
53a01072f272 Added Linux and Solaris tests.
Ryan C. Gordon <icculus@icculus.org>
parents: 1197
diff changeset
    51
#elif defined(__sun) || defined(sun)
1235
2ed0567fe413 Make physfs_platforms.h define with a 1, so "#if X" works.
Ryan C. Gordon <icculus@icculus.org>
parents: 1233
diff changeset
    52
#  define PHYSFS_PLATFORM_SOLARIS 1
2ed0567fe413 Make physfs_platforms.h define with a 1, so "#if X" works.
Ryan C. Gordon <icculus@icculus.org>
parents: 1233
diff changeset
    53
#  define PHYSFS_PLATFORM_UNIX 1
2ed0567fe413 Make physfs_platforms.h define with a 1, so "#if X" works.
Ryan C. Gordon <icculus@icculus.org>
parents: 1233
diff changeset
    54
#  define PHYSFS_PLATFORM_POSIX 1
1337
3b2e649c044c Better basedir detection for various Unix platforms.
Ryan C. Gordon <icculus@icculus.org>
parents: 1313
diff changeset
    55
#elif defined(__FreeBSD__) || defined(__DragonFly__)
3b2e649c044c Better basedir detection for various Unix platforms.
Ryan C. Gordon <icculus@icculus.org>
parents: 1313
diff changeset
    56
#  define PHYSFS_PLATFORM_FREEBSD 1
3b2e649c044c Better basedir detection for various Unix platforms.
Ryan C. Gordon <icculus@icculus.org>
parents: 1313
diff changeset
    57
#  define PHYSFS_PLATFORM_BSD 1
3b2e649c044c Better basedir detection for various Unix platforms.
Ryan C. Gordon <icculus@icculus.org>
parents: 1313
diff changeset
    58
#  define PHYSFS_PLATFORM_UNIX 1
3b2e649c044c Better basedir detection for various Unix platforms.
Ryan C. Gordon <icculus@icculus.org>
parents: 1313
diff changeset
    59
#  define PHYSFS_PLATFORM_POSIX 1
3b2e649c044c Better basedir detection for various Unix platforms.
Ryan C. Gordon <icculus@icculus.org>
parents: 1313
diff changeset
    60
#elif defined(__NetBSD__) || defined(__OpenBSD__) || defined(__bsdi__)
1235
2ed0567fe413 Make physfs_platforms.h define with a 1, so "#if X" works.
Ryan C. Gordon <icculus@icculus.org>
parents: 1233
diff changeset
    61
#  define PHYSFS_PLATFORM_BSD 1
2ed0567fe413 Make physfs_platforms.h define with a 1, so "#if X" works.
Ryan C. Gordon <icculus@icculus.org>
parents: 1233
diff changeset
    62
#  define PHYSFS_PLATFORM_UNIX 1
2ed0567fe413 Make physfs_platforms.h define with a 1, so "#if X" works.
Ryan C. Gordon <icculus@icculus.org>
parents: 1233
diff changeset
    63
#  define PHYSFS_PLATFORM_POSIX 1
1295
02a34500bb1c An attempt to make this more Unix-friendly.
Ryan C. Gordon <icculus@icculus.org>
parents: 1291
diff changeset
    64
#elif defined(unix) || defined(__unix__)
1235
2ed0567fe413 Make physfs_platforms.h define with a 1, so "#if X" works.
Ryan C. Gordon <icculus@icculus.org>
parents: 1233
diff changeset
    65
#  define PHYSFS_PLATFORM_UNIX 1
2ed0567fe413 Make physfs_platforms.h define with a 1, so "#if X" works.
Ryan C. Gordon <icculus@icculus.org>
parents: 1233
diff changeset
    66
#  define PHYSFS_PLATFORM_POSIX 1
818
e36f23f49042 Now compiles everything whether we need it or not, removing whole files with
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    67
#else
e36f23f49042 Now compiles everything whether we need it or not, removing whole files with
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    68
#  error Unknown platform.
e36f23f49042 Now compiles everything whether we need it or not, removing whole files with
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    69
#endif
e36f23f49042 Now compiles everything whether we need it or not, removing whole files with
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    70
e36f23f49042 Now compiles everything whether we need it or not, removing whole files with
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    71
#endif  /* include-once blocker. */
e36f23f49042 Now compiles everything whether we need it or not, removing whole files with
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    72