Kaynağa Gözat

Merge pull request #69 from bmx-ng/task/physfs-update-0424

Update physfs to 3.x.x.31209b7
Brucey 1 yıl önce
ebeveyn
işleme
f05aa45b8e

+ 3 - 0
physfs.mod/physfs.bmx

@@ -11,6 +11,7 @@ Import "-lbe -lroot"
 Import "physfs/src/*.h"
 Import "physfs/src/physfs.c"
 Import "physfs/src/physfs_archiver_7z.c"
+Import "physfs/src/physfs_archiver_csm.c"
 Import "physfs/src/physfs_archiver_dir.c"
 Import "physfs/src/physfs_archiver_grp.c"
 Import "physfs/src/physfs_archiver_hog.c"
@@ -24,7 +25,9 @@ Import "physfs/src/physfs_archiver_wad.c"
 Import "physfs/src/physfs_archiver_zip.c"
 Import "physfs/src/physfs_byteorder.c"
 Import "physfs/src/physfs_platform_android.c"
+Import "physfs/src/physfs_platform_ogc.c"
 Import "physfs/src/physfs_platform_os2.c"
+Import "physfs/src/physfs_platform_playdate.c"
 Import "physfs/src/physfs_platform_posix.c"
 Import "physfs/src/physfs_platform_qnx.c"
 Import "physfs/src/physfs_platform_unix.c"

+ 0 - 2
physfs.mod/physfs/.gitignore

@@ -1,2 +0,0 @@
-cmake-build
-

+ 27 - 28
physfs.mod/physfs/CMakeLists.txt

@@ -11,7 +11,7 @@
 
 set(PHYSFS_VERSION 3.3.0)
 
-cmake_minimum_required(VERSION 3.0)
+cmake_minimum_required(VERSION 3.5)
 
 project(PhysicsFS VERSION ${PHYSFS_VERSION} LANGUAGES C )
 
@@ -23,7 +23,9 @@ set(PHYSFS_SOVERSION 1)
 set(PHYSFS_M_SRCS)
 set(PHYSFS_CPP_SRCS)
 
-# I hate that they define "WIN32" ... we're about to move to Win64...I hope!
+if(WIN32)
+    list(APPEND OPTIONAL_LIBRARY_LIBS advapi32 shell32)
+endif()
 
 if(APPLE)
     set(OTHER_LDFLAGS ${OTHER_LDFLAGS} "-framework IOKit -framework Foundation")
@@ -32,8 +34,6 @@ endif()
 
 if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_C_COMPILER_ID MATCHES "Clang")
     add_compile_options(-Wall)
-    # Don't use -rpath.
-    set(CMAKE_SKIP_RPATH ON CACHE BOOL "Skip RPATH" FORCE)
 endif()
 
 if(CMAKE_C_COMPILER_ID STREQUAL "SunPro")
@@ -61,7 +61,7 @@ endif()
 if(UNIX AND NOT WIN32 AND NOT APPLE)  # (MingW and such might be UNIX _and_ WINDOWS!)
     find_library(PTHREAD_LIBRARY pthread)
     if(PTHREAD_LIBRARY)
-        set(OPTIONAL_LIBRARY_LIBS ${OPTIONAL_LIBRARY_LIBS} ${PTHREAD_LIBRARY})
+        list(APPEND OPTIONAL_LIBRARY_LIBS ${PTHREAD_LIBRARY})
     endif()
 endif()
 
@@ -80,9 +80,11 @@ set(PHYSFS_SRCS
     src/physfs_platform_posix.c
     src/physfs_platform_unix.c
     src/physfs_platform_windows.c
+    src/physfs_platform_ogc.c
     src/physfs_platform_os2.c
     src/physfs_platform_qnx.c
     src/physfs_platform_android.c
+    src/physfs_platform_playdate.c
     src/physfs_archiver_dir.c
     src/physfs_archiver_unpacked.c
     src/physfs_archiver_grp.c
@@ -91,6 +93,7 @@ set(PHYSFS_SRCS
     src/physfs_archiver_mvl.c
     src/physfs_archiver_qpak.c
     src/physfs_archiver_wad.c
+    src/physfs_archiver_csm.c
     src/physfs_archiver_zip.c
     src/physfs_archiver_slb.c
     src/physfs_archiver_iso9660.c
@@ -124,6 +127,11 @@ if(NOT PHYSFS_ARCHIVE_WAD)
     add_definitions(-DPHYSFS_SUPPORTS_WAD=0)
 endif()
 
+option(PHYSFS_ARCHIVE_CSM "Enable Chasm: The Rift CSM.BIN support" TRUE)
+if(NOT PHYSFS_ARCHIVE_CSM)
+    add_definitions(-DPHYSFS_SUPPORTS_CSM=0)
+endif()
+
 option(PHYSFS_ARCHIVE_HOG "Enable Descent I/II HOG support" TRUE)
 if(NOT PHYSFS_ARCHIVE_HOG)
     add_definitions(-DPHYSFS_SUPPORTS_HOG=0)
@@ -178,7 +186,7 @@ if(PHYSFS_BUILD_STATIC)
     endif()
     target_include_directories(physfs-static PUBLIC "$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/src>")
     target_link_libraries(physfs-static PRIVATE ${OPTIONAL_LIBRARY_LIBS} ${OTHER_LDFLAGS})
-    set(PHYSFS_LIB_TARGET physfs-static)
+    set(PHYSFS_LIB_TARGET PhysFS::PhysFS-static)
     list(APPEND PHYSFS_INSTALL_TARGETS "physfs-static")
 endif()
 
@@ -191,14 +199,14 @@ if(PHYSFS_BUILD_SHARED)
     set_target_properties(physfs PROPERTIES SOVERSION ${PHYSFS_SOVERSION})
     set_target_properties(physfs PROPERTIES EXPORT_NAME PhysFS)
     if(WINRT)
-		set_target_properties(physfs PROPERTIES VS_WINRT_COMPONENT True)
+		set_target_properties(physfs PROPERTIES VS_WINRT_COMPONENT TRUE)
     endif()
     if(OS2) # OS/2 does not support a DLL name longer than 8 characters.
         set_target_properties(physfs PROPERTIES OUTPUT_NAME "physfs")
     endif()
     target_include_directories(physfs PUBLIC "$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/src>")
     target_link_libraries(physfs PRIVATE ${OPTIONAL_LIBRARY_LIBS} ${OTHER_LDFLAGS})
-    set(PHYSFS_LIB_TARGET physfs)
+    set(PHYSFS_LIB_TARGET PhysFS::PhysFS)
     list(APPEND PHYSFS_INSTALL_TARGETS "physfs")
 endif()
 
@@ -206,32 +214,22 @@ if(NOT PHYSFS_BUILD_SHARED AND NOT PHYSFS_BUILD_STATIC)
     message(FATAL "Both shared and static libraries are disabled!")
 endif()
 
-# CMake FAQ says I need this...
-if(PHYSFS_BUILD_SHARED AND PHYSFS_BUILD_STATIC AND NOT WIN32)
-    set_target_properties(physfs PROPERTIES CLEAN_DIRECT_OUTPUT 1)
-    set_target_properties(physfs-static PROPERTIES CLEAN_DIRECT_OUTPUT 1)
-endif()
-
 option(PHYSFS_BUILD_TEST "Build stdio test program." TRUE)
 mark_as_advanced(PHYSFS_BUILD_TEST)
 if(PHYSFS_BUILD_TEST)
+    add_executable(test_physfs test/test_physfs.c)
+    target_link_libraries(test_physfs PRIVATE ${PHYSFS_LIB_TARGET} ${OTHER_LDFLAGS})
+
     find_path(READLINE_H readline/readline.h)
     find_path(HISTORY_H readline/history.h)
-    if(READLINE_H AND HISTORY_H)
-        find_library(CURSES_LIBRARY NAMES curses ncurses)
-        if(CURSES_LIBRARY)
-            set(CMAKE_REQUIRED_LIBRARIES ${CURSES_LIBRARY})
-            find_library(READLINE_LIBRARY readline)
-            if(READLINE_LIBRARY)
-                set(HAVE_SYSTEM_READLINE TRUE)
-                list(APPEND TEST_PHYSFS_LIBS ${READLINE_LIBRARY} ${CURSES_LIBRARY})
-                include_directories(SYSTEM ${READLINE_H} ${HISTORY_H})
-                add_definitions(-DPHYSFS_HAVE_READLINE=1)
-            endif()
-        endif()
+    find_library(READLINE_LIBRARY readline)
+    find_package(Curses)
+    if(READLINE_H AND HISTORY_H AND READLINE_LIBRARY AND CURSES_FOUND)
+        set(HAVE_SYSTEM_READLINE TRUE)
+        target_link_libraries(test_physfs PRIVATE ${READLINE_LIBRARY} ${CURSES_LIBRARIES})
+        target_include_directories(test_physfs SYSTEM PRIVATE ${READLINE_H} ${HISTORY_H})
+        target_compile_definitions(test_physfs PRIVATE PHYSFS_HAVE_READLINE=1)
     endif()
-    add_executable(test_physfs test/test_physfs.c)
-    target_link_libraries(test_physfs PRIVATE ${PHYSFS_LIB_TARGET} ${TEST_PHYSFS_LIBS} ${OTHER_LDFLAGS})
     list(APPEND PHYSFS_INSTALL_TARGETS test_physfs)
 endif()
 
@@ -328,6 +326,7 @@ message_bool_option("ZIP support" PHYSFS_ARCHIVE_ZIP)
 message_bool_option("7zip support" PHYSFS_ARCHIVE_7Z)
 message_bool_option("GRP support" PHYSFS_ARCHIVE_GRP)
 message_bool_option("WAD support" PHYSFS_ARCHIVE_WAD)
+message_bool_option("CSM support" PHYSFS_ARCHIVE_CSM)
 message_bool_option("HOG support" PHYSFS_ARCHIVE_HOG)
 message_bool_option("MVL support" PHYSFS_ARCHIVE_MVL)
 message_bool_option("QPAK support" PHYSFS_ARCHIVE_QPAK)

+ 219 - 6
physfs.mod/physfs/extras/casefolding.txt

@@ -1,10 +1,11 @@
-# CaseFolding-8.0.0.txt
-# Date: 2015-01-13, 18:16:36 GMT [MD]
+# CaseFolding-15.1.0.txt
+# Date: 2023-05-12, 21:53:10 GMT
+# © 2023 Unicode®, Inc.
+# Unicode and the Unicode Logo are registered trademarks of Unicode, Inc. in the U.S. and other countries.
+# For terms of use, see https://www.unicode.org/terms_of_use.html
 #
 # Unicode Character Database
-# Copyright (c) 1991-2015 Unicode, Inc.
-# For terms of use, see http://www.unicode.org/terms_of_use.html
-# For documentation, see http://www.unicode.org/reports/tr44/
+#   For documentation, see https://www.unicode.org/reports/tr44/
 #
 # Case Folding Properties
 #
@@ -23,7 +24,7 @@
 #
 # NOTE: case folding does not preserve normalization formats!
 #
-# For information on case folding, including how to have case folding 
+# For information on case folding, including how to have case folding
 # preserve normalization formats, see Section 3.13 Default Case Algorithms in
 # The Unicode Standard.
 #
@@ -593,6 +594,61 @@
 13FB; C; 13F3; # CHEROKEE SMALL LETTER YU
 13FC; C; 13F4; # CHEROKEE SMALL LETTER YV
 13FD; C; 13F5; # CHEROKEE SMALL LETTER MV
+1C80; C; 0432; # CYRILLIC SMALL LETTER ROUNDED VE
+1C81; C; 0434; # CYRILLIC SMALL LETTER LONG-LEGGED DE
+1C82; C; 043E; # CYRILLIC SMALL LETTER NARROW O
+1C83; C; 0441; # CYRILLIC SMALL LETTER WIDE ES
+1C84; C; 0442; # CYRILLIC SMALL LETTER TALL TE
+1C85; C; 0442; # CYRILLIC SMALL LETTER THREE-LEGGED TE
+1C86; C; 044A; # CYRILLIC SMALL LETTER TALL HARD SIGN
+1C87; C; 0463; # CYRILLIC SMALL LETTER TALL YAT
+1C88; C; A64B; # CYRILLIC SMALL LETTER UNBLENDED UK
+1C90; C; 10D0; # GEORGIAN MTAVRULI CAPITAL LETTER AN
+1C91; C; 10D1; # GEORGIAN MTAVRULI CAPITAL LETTER BAN
+1C92; C; 10D2; # GEORGIAN MTAVRULI CAPITAL LETTER GAN
+1C93; C; 10D3; # GEORGIAN MTAVRULI CAPITAL LETTER DON
+1C94; C; 10D4; # GEORGIAN MTAVRULI CAPITAL LETTER EN
+1C95; C; 10D5; # GEORGIAN MTAVRULI CAPITAL LETTER VIN
+1C96; C; 10D6; # GEORGIAN MTAVRULI CAPITAL LETTER ZEN
+1C97; C; 10D7; # GEORGIAN MTAVRULI CAPITAL LETTER TAN
+1C98; C; 10D8; # GEORGIAN MTAVRULI CAPITAL LETTER IN
+1C99; C; 10D9; # GEORGIAN MTAVRULI CAPITAL LETTER KAN
+1C9A; C; 10DA; # GEORGIAN MTAVRULI CAPITAL LETTER LAS
+1C9B; C; 10DB; # GEORGIAN MTAVRULI CAPITAL LETTER MAN
+1C9C; C; 10DC; # GEORGIAN MTAVRULI CAPITAL LETTER NAR
+1C9D; C; 10DD; # GEORGIAN MTAVRULI CAPITAL LETTER ON
+1C9E; C; 10DE; # GEORGIAN MTAVRULI CAPITAL LETTER PAR
+1C9F; C; 10DF; # GEORGIAN MTAVRULI CAPITAL LETTER ZHAR
+1CA0; C; 10E0; # GEORGIAN MTAVRULI CAPITAL LETTER RAE
+1CA1; C; 10E1; # GEORGIAN MTAVRULI CAPITAL LETTER SAN
+1CA2; C; 10E2; # GEORGIAN MTAVRULI CAPITAL LETTER TAR
+1CA3; C; 10E3; # GEORGIAN MTAVRULI CAPITAL LETTER UN
+1CA4; C; 10E4; # GEORGIAN MTAVRULI CAPITAL LETTER PHAR
+1CA5; C; 10E5; # GEORGIAN MTAVRULI CAPITAL LETTER KHAR
+1CA6; C; 10E6; # GEORGIAN MTAVRULI CAPITAL LETTER GHAN
+1CA7; C; 10E7; # GEORGIAN MTAVRULI CAPITAL LETTER QAR
+1CA8; C; 10E8; # GEORGIAN MTAVRULI CAPITAL LETTER SHIN
+1CA9; C; 10E9; # GEORGIAN MTAVRULI CAPITAL LETTER CHIN
+1CAA; C; 10EA; # GEORGIAN MTAVRULI CAPITAL LETTER CAN
+1CAB; C; 10EB; # GEORGIAN MTAVRULI CAPITAL LETTER JIL
+1CAC; C; 10EC; # GEORGIAN MTAVRULI CAPITAL LETTER CIL
+1CAD; C; 10ED; # GEORGIAN MTAVRULI CAPITAL LETTER CHAR
+1CAE; C; 10EE; # GEORGIAN MTAVRULI CAPITAL LETTER XAN
+1CAF; C; 10EF; # GEORGIAN MTAVRULI CAPITAL LETTER JHAN
+1CB0; C; 10F0; # GEORGIAN MTAVRULI CAPITAL LETTER HAE
+1CB1; C; 10F1; # GEORGIAN MTAVRULI CAPITAL LETTER HE
+1CB2; C; 10F2; # GEORGIAN MTAVRULI CAPITAL LETTER HIE
+1CB3; C; 10F3; # GEORGIAN MTAVRULI CAPITAL LETTER WE
+1CB4; C; 10F4; # GEORGIAN MTAVRULI CAPITAL LETTER HAR
+1CB5; C; 10F5; # GEORGIAN MTAVRULI CAPITAL LETTER HOE
+1CB6; C; 10F6; # GEORGIAN MTAVRULI CAPITAL LETTER FI
+1CB7; C; 10F7; # GEORGIAN MTAVRULI CAPITAL LETTER YN
+1CB8; C; 10F8; # GEORGIAN MTAVRULI CAPITAL LETTER ELIFI
+1CB9; C; 10F9; # GEORGIAN MTAVRULI CAPITAL LETTER TURNED GAN
+1CBA; C; 10FA; # GEORGIAN MTAVRULI CAPITAL LETTER AIN
+1CBD; C; 10FD; # GEORGIAN MTAVRULI CAPITAL LETTER AEN
+1CBE; C; 10FE; # GEORGIAN MTAVRULI CAPITAL LETTER HARD SIGN
+1CBF; C; 10FF; # GEORGIAN MTAVRULI CAPITAL LETTER LABIAL SIGN
 1E00; C; 1E01; # LATIN CAPITAL LETTER A WITH RING BELOW
 1E02; C; 1E03; # LATIN CAPITAL LETTER B WITH DOT ABOVE
 1E04; C; 1E05; # LATIN CAPITAL LETTER B WITH DOT BELOW
@@ -873,6 +929,7 @@
 1FCC; S; 1FC3; # GREEK CAPITAL LETTER ETA WITH PROSGEGRAMMENI
 1FD2; F; 03B9 0308 0300; # GREEK SMALL LETTER IOTA WITH DIALYTIKA AND VARIA
 1FD3; F; 03B9 0308 0301; # GREEK SMALL LETTER IOTA WITH DIALYTIKA AND OXIA
+1FD3; S; 0390; # GREEK SMALL LETTER IOTA WITH DIALYTIKA AND OXIA
 1FD6; F; 03B9 0342; # GREEK SMALL LETTER IOTA WITH PERISPOMENI
 1FD7; F; 03B9 0308 0342; # GREEK SMALL LETTER IOTA WITH DIALYTIKA AND PERISPOMENI
 1FD8; C; 1FD0; # GREEK CAPITAL LETTER IOTA WITH VRACHY
@@ -881,6 +938,7 @@
 1FDB; C; 1F77; # GREEK CAPITAL LETTER IOTA WITH OXIA
 1FE2; F; 03C5 0308 0300; # GREEK SMALL LETTER UPSILON WITH DIALYTIKA AND VARIA
 1FE3; F; 03C5 0308 0301; # GREEK SMALL LETTER UPSILON WITH DIALYTIKA AND OXIA
+1FE3; S; 03B0; # GREEK SMALL LETTER UPSILON WITH DIALYTIKA AND OXIA
 1FE4; F; 03C1 0313; # GREEK SMALL LETTER RHO WITH PSILI
 1FE6; F; 03C5 0342; # GREEK SMALL LETTER UPSILON WITH PERISPOMENI
 1FE7; F; 03C5 0308 0342; # GREEK SMALL LETTER UPSILON WITH DIALYTIKA AND PERISPOMENI
@@ -994,6 +1052,7 @@
 2C2C; C; 2C5C; # GLAGOLITIC CAPITAL LETTER SHTAPIC
 2C2D; C; 2C5D; # GLAGOLITIC CAPITAL LETTER TROKUTASTI A
 2C2E; C; 2C5E; # GLAGOLITIC CAPITAL LETTER LATINATE MYSLITE
+2C2F; C; 2C5F; # GLAGOLITIC CAPITAL LETTER CAUDATE CHRIVI
 2C60; C; 2C61; # LATIN CAPITAL LETTER L WITH DOUBLE BAR
 2C62; C; 026B; # LATIN CAPITAL LETTER L WITH MIDDLE TILDE
 2C63; C; 1D7D; # LATIN CAPITAL LETTER P WITH STROKE
@@ -1163,12 +1222,28 @@ A7AA; C; 0266; # LATIN CAPITAL LETTER H WITH HOOK
 A7AB; C; 025C; # LATIN CAPITAL LETTER REVERSED OPEN E
 A7AC; C; 0261; # LATIN CAPITAL LETTER SCRIPT G
 A7AD; C; 026C; # LATIN CAPITAL LETTER L WITH BELT
+A7AE; C; 026A; # LATIN CAPITAL LETTER SMALL CAPITAL I
 A7B0; C; 029E; # LATIN CAPITAL LETTER TURNED K
 A7B1; C; 0287; # LATIN CAPITAL LETTER TURNED T
 A7B2; C; 029D; # LATIN CAPITAL LETTER J WITH CROSSED-TAIL
 A7B3; C; AB53; # LATIN CAPITAL LETTER CHI
 A7B4; C; A7B5; # LATIN CAPITAL LETTER BETA
 A7B6; C; A7B7; # LATIN CAPITAL LETTER OMEGA
+A7B8; C; A7B9; # LATIN CAPITAL LETTER U WITH STROKE
+A7BA; C; A7BB; # LATIN CAPITAL LETTER GLOTTAL A
+A7BC; C; A7BD; # LATIN CAPITAL LETTER GLOTTAL I
+A7BE; C; A7BF; # LATIN CAPITAL LETTER GLOTTAL U
+A7C0; C; A7C1; # LATIN CAPITAL LETTER OLD POLISH O
+A7C2; C; A7C3; # LATIN CAPITAL LETTER ANGLICANA W
+A7C4; C; A794; # LATIN CAPITAL LETTER C WITH PALATAL HOOK
+A7C5; C; 0282; # LATIN CAPITAL LETTER S WITH HOOK
+A7C6; C; 1D8E; # LATIN CAPITAL LETTER Z WITH PALATAL HOOK
+A7C7; C; A7C8; # LATIN CAPITAL LETTER D WITH SHORT STROKE OVERLAY
+A7C9; C; A7CA; # LATIN CAPITAL LETTER S WITH SHORT STROKE OVERLAY
+A7D0; C; A7D1; # LATIN CAPITAL LETTER CLOSED INSULAR G
+A7D6; C; A7D7; # LATIN CAPITAL LETTER MIDDLE SCOTS S
+A7D8; C; A7D9; # LATIN CAPITAL LETTER SIGMOID S
+A7F5; C; A7F6; # LATIN CAPITAL LETTER REVERSED HALF H
 AB70; C; 13A0; # CHEROKEE SMALL LETTER A
 AB71; C; 13A1; # CHEROKEE SMALL LETTER E
 AB72; C; 13A2; # CHEROKEE SMALL LETTER I
@@ -1255,6 +1330,7 @@ FB02; F; 0066 006C; # LATIN SMALL LIGATURE FL
 FB03; F; 0066 0066 0069; # LATIN SMALL LIGATURE FFI
 FB04; F; 0066 0066 006C; # LATIN SMALL LIGATURE FFL
 FB05; F; 0073 0074; # LATIN SMALL LIGATURE LONG S T
+FB05; S; FB06; # LATIN SMALL LIGATURE LONG S T
 FB06; F; 0073 0074; # LATIN SMALL LIGATURE ST
 FB13; F; 0574 0576; # ARMENIAN SMALL LIGATURE MEN NOW
 FB14; F; 0574 0565; # ARMENIAN SMALL LIGATURE MEN ECH
@@ -1327,6 +1403,77 @@ FF3A; C; FF5A; # FULLWIDTH LATIN CAPITAL LETTER Z
 10425; C; 1044D; # DESERET CAPITAL LETTER ENG
 10426; C; 1044E; # DESERET CAPITAL LETTER OI
 10427; C; 1044F; # DESERET CAPITAL LETTER EW
+104B0; C; 104D8; # OSAGE CAPITAL LETTER A
+104B1; C; 104D9; # OSAGE CAPITAL LETTER AI
+104B2; C; 104DA; # OSAGE CAPITAL LETTER AIN
+104B3; C; 104DB; # OSAGE CAPITAL LETTER AH
+104B4; C; 104DC; # OSAGE CAPITAL LETTER BRA
+104B5; C; 104DD; # OSAGE CAPITAL LETTER CHA
+104B6; C; 104DE; # OSAGE CAPITAL LETTER EHCHA
+104B7; C; 104DF; # OSAGE CAPITAL LETTER E
+104B8; C; 104E0; # OSAGE CAPITAL LETTER EIN
+104B9; C; 104E1; # OSAGE CAPITAL LETTER HA
+104BA; C; 104E2; # OSAGE CAPITAL LETTER HYA
+104BB; C; 104E3; # OSAGE CAPITAL LETTER I
+104BC; C; 104E4; # OSAGE CAPITAL LETTER KA
+104BD; C; 104E5; # OSAGE CAPITAL LETTER EHKA
+104BE; C; 104E6; # OSAGE CAPITAL LETTER KYA
+104BF; C; 104E7; # OSAGE CAPITAL LETTER LA
+104C0; C; 104E8; # OSAGE CAPITAL LETTER MA
+104C1; C; 104E9; # OSAGE CAPITAL LETTER NA
+104C2; C; 104EA; # OSAGE CAPITAL LETTER O
+104C3; C; 104EB; # OSAGE CAPITAL LETTER OIN
+104C4; C; 104EC; # OSAGE CAPITAL LETTER PA
+104C5; C; 104ED; # OSAGE CAPITAL LETTER EHPA
+104C6; C; 104EE; # OSAGE CAPITAL LETTER SA
+104C7; C; 104EF; # OSAGE CAPITAL LETTER SHA
+104C8; C; 104F0; # OSAGE CAPITAL LETTER TA
+104C9; C; 104F1; # OSAGE CAPITAL LETTER EHTA
+104CA; C; 104F2; # OSAGE CAPITAL LETTER TSA
+104CB; C; 104F3; # OSAGE CAPITAL LETTER EHTSA
+104CC; C; 104F4; # OSAGE CAPITAL LETTER TSHA
+104CD; C; 104F5; # OSAGE CAPITAL LETTER DHA
+104CE; C; 104F6; # OSAGE CAPITAL LETTER U
+104CF; C; 104F7; # OSAGE CAPITAL LETTER WA
+104D0; C; 104F8; # OSAGE CAPITAL LETTER KHA
+104D1; C; 104F9; # OSAGE CAPITAL LETTER GHA
+104D2; C; 104FA; # OSAGE CAPITAL LETTER ZA
+104D3; C; 104FB; # OSAGE CAPITAL LETTER ZHA
+10570; C; 10597; # VITHKUQI CAPITAL LETTER A
+10571; C; 10598; # VITHKUQI CAPITAL LETTER BBE
+10572; C; 10599; # VITHKUQI CAPITAL LETTER BE
+10573; C; 1059A; # VITHKUQI CAPITAL LETTER CE
+10574; C; 1059B; # VITHKUQI CAPITAL LETTER CHE
+10575; C; 1059C; # VITHKUQI CAPITAL LETTER DE
+10576; C; 1059D; # VITHKUQI CAPITAL LETTER DHE
+10577; C; 1059E; # VITHKUQI CAPITAL LETTER EI
+10578; C; 1059F; # VITHKUQI CAPITAL LETTER E
+10579; C; 105A0; # VITHKUQI CAPITAL LETTER FE
+1057A; C; 105A1; # VITHKUQI CAPITAL LETTER GA
+1057C; C; 105A3; # VITHKUQI CAPITAL LETTER HA
+1057D; C; 105A4; # VITHKUQI CAPITAL LETTER HHA
+1057E; C; 105A5; # VITHKUQI CAPITAL LETTER I
+1057F; C; 105A6; # VITHKUQI CAPITAL LETTER IJE
+10580; C; 105A7; # VITHKUQI CAPITAL LETTER JE
+10581; C; 105A8; # VITHKUQI CAPITAL LETTER KA
+10582; C; 105A9; # VITHKUQI CAPITAL LETTER LA
+10583; C; 105AA; # VITHKUQI CAPITAL LETTER LLA
+10584; C; 105AB; # VITHKUQI CAPITAL LETTER ME
+10585; C; 105AC; # VITHKUQI CAPITAL LETTER NE
+10586; C; 105AD; # VITHKUQI CAPITAL LETTER NJE
+10587; C; 105AE; # VITHKUQI CAPITAL LETTER O
+10588; C; 105AF; # VITHKUQI CAPITAL LETTER PE
+10589; C; 105B0; # VITHKUQI CAPITAL LETTER QA
+1058A; C; 105B1; # VITHKUQI CAPITAL LETTER RE
+1058C; C; 105B3; # VITHKUQI CAPITAL LETTER SE
+1058D; C; 105B4; # VITHKUQI CAPITAL LETTER SHE
+1058E; C; 105B5; # VITHKUQI CAPITAL LETTER TE
+1058F; C; 105B6; # VITHKUQI CAPITAL LETTER THE
+10590; C; 105B7; # VITHKUQI CAPITAL LETTER U
+10591; C; 105B8; # VITHKUQI CAPITAL LETTER VE
+10592; C; 105B9; # VITHKUQI CAPITAL LETTER XE
+10594; C; 105BB; # VITHKUQI CAPITAL LETTER Y
+10595; C; 105BC; # VITHKUQI CAPITAL LETTER ZE
 10C80; C; 10CC0; # OLD HUNGARIAN CAPITAL LETTER A
 10C81; C; 10CC1; # OLD HUNGARIAN CAPITAL LETTER AA
 10C82; C; 10CC2; # OLD HUNGARIAN CAPITAL LETTER EB
@@ -1410,5 +1557,71 @@ FF3A; C; FF5A; # FULLWIDTH LATIN CAPITAL LETTER Z
 118BD; C; 118DD; # WARANG CITI CAPITAL LETTER SSUU
 118BE; C; 118DE; # WARANG CITI CAPITAL LETTER SII
 118BF; C; 118DF; # WARANG CITI CAPITAL LETTER VIYO
+16E40; C; 16E60; # MEDEFAIDRIN CAPITAL LETTER M
+16E41; C; 16E61; # MEDEFAIDRIN CAPITAL LETTER S
+16E42; C; 16E62; # MEDEFAIDRIN CAPITAL LETTER V
+16E43; C; 16E63; # MEDEFAIDRIN CAPITAL LETTER W
+16E44; C; 16E64; # MEDEFAIDRIN CAPITAL LETTER ATIU
+16E45; C; 16E65; # MEDEFAIDRIN CAPITAL LETTER Z
+16E46; C; 16E66; # MEDEFAIDRIN CAPITAL LETTER KP
+16E47; C; 16E67; # MEDEFAIDRIN CAPITAL LETTER P
+16E48; C; 16E68; # MEDEFAIDRIN CAPITAL LETTER T
+16E49; C; 16E69; # MEDEFAIDRIN CAPITAL LETTER G
+16E4A; C; 16E6A; # MEDEFAIDRIN CAPITAL LETTER F
+16E4B; C; 16E6B; # MEDEFAIDRIN CAPITAL LETTER I
+16E4C; C; 16E6C; # MEDEFAIDRIN CAPITAL LETTER K
+16E4D; C; 16E6D; # MEDEFAIDRIN CAPITAL LETTER A
+16E4E; C; 16E6E; # MEDEFAIDRIN CAPITAL LETTER J
+16E4F; C; 16E6F; # MEDEFAIDRIN CAPITAL LETTER E
+16E50; C; 16E70; # MEDEFAIDRIN CAPITAL LETTER B
+16E51; C; 16E71; # MEDEFAIDRIN CAPITAL LETTER C
+16E52; C; 16E72; # MEDEFAIDRIN CAPITAL LETTER U
+16E53; C; 16E73; # MEDEFAIDRIN CAPITAL LETTER YU
+16E54; C; 16E74; # MEDEFAIDRIN CAPITAL LETTER L
+16E55; C; 16E75; # MEDEFAIDRIN CAPITAL LETTER Q
+16E56; C; 16E76; # MEDEFAIDRIN CAPITAL LETTER HP
+16E57; C; 16E77; # MEDEFAIDRIN CAPITAL LETTER NY
+16E58; C; 16E78; # MEDEFAIDRIN CAPITAL LETTER X
+16E59; C; 16E79; # MEDEFAIDRIN CAPITAL LETTER D
+16E5A; C; 16E7A; # MEDEFAIDRIN CAPITAL LETTER OE
+16E5B; C; 16E7B; # MEDEFAIDRIN CAPITAL LETTER N
+16E5C; C; 16E7C; # MEDEFAIDRIN CAPITAL LETTER R
+16E5D; C; 16E7D; # MEDEFAIDRIN CAPITAL LETTER O
+16E5E; C; 16E7E; # MEDEFAIDRIN CAPITAL LETTER AI
+16E5F; C; 16E7F; # MEDEFAIDRIN CAPITAL LETTER Y
+1E900; C; 1E922; # ADLAM CAPITAL LETTER ALIF
+1E901; C; 1E923; # ADLAM CAPITAL LETTER DAALI
+1E902; C; 1E924; # ADLAM CAPITAL LETTER LAAM
+1E903; C; 1E925; # ADLAM CAPITAL LETTER MIIM
+1E904; C; 1E926; # ADLAM CAPITAL LETTER BA
+1E905; C; 1E927; # ADLAM CAPITAL LETTER SINNYIIYHE
+1E906; C; 1E928; # ADLAM CAPITAL LETTER PE
+1E907; C; 1E929; # ADLAM CAPITAL LETTER BHE
+1E908; C; 1E92A; # ADLAM CAPITAL LETTER RA
+1E909; C; 1E92B; # ADLAM CAPITAL LETTER E
+1E90A; C; 1E92C; # ADLAM CAPITAL LETTER FA
+1E90B; C; 1E92D; # ADLAM CAPITAL LETTER I
+1E90C; C; 1E92E; # ADLAM CAPITAL LETTER O
+1E90D; C; 1E92F; # ADLAM CAPITAL LETTER DHA
+1E90E; C; 1E930; # ADLAM CAPITAL LETTER YHE
+1E90F; C; 1E931; # ADLAM CAPITAL LETTER WAW
+1E910; C; 1E932; # ADLAM CAPITAL LETTER NUN
+1E911; C; 1E933; # ADLAM CAPITAL LETTER KAF
+1E912; C; 1E934; # ADLAM CAPITAL LETTER YA
+1E913; C; 1E935; # ADLAM CAPITAL LETTER U
+1E914; C; 1E936; # ADLAM CAPITAL LETTER JIIM
+1E915; C; 1E937; # ADLAM CAPITAL LETTER CHI
+1E916; C; 1E938; # ADLAM CAPITAL LETTER HA
+1E917; C; 1E939; # ADLAM CAPITAL LETTER QAAF
+1E918; C; 1E93A; # ADLAM CAPITAL LETTER GA
+1E919; C; 1E93B; # ADLAM CAPITAL LETTER NYA
+1E91A; C; 1E93C; # ADLAM CAPITAL LETTER TU
+1E91B; C; 1E93D; # ADLAM CAPITAL LETTER NHA
+1E91C; C; 1E93E; # ADLAM CAPITAL LETTER VA
+1E91D; C; 1E93F; # ADLAM CAPITAL LETTER KHA
+1E91E; C; 1E940; # ADLAM CAPITAL LETTER GBE
+1E91F; C; 1E941; # ADLAM CAPITAL LETTER ZAL
+1E920; C; 1E942; # ADLAM CAPITAL LETTER KPO
+1E921; C; 1E943; # ADLAM CAPITAL LETTER SHA
 #
 # EOF

+ 12 - 0
physfs.mod/physfs/extras/makecasefoldhashtable.pl

@@ -8,6 +8,8 @@ my $HASHBUCKETS1_32 = 16;
 my $HASHBUCKETS2_16 = 16;
 my $HASHBUCKETS3_16 = 4;
 
+my $mem_used = 0;
+
 print <<__EOF__;
 /*
  * This file is part of PhysicsFS (https://icculus.org/physfs/)
@@ -143,18 +145,22 @@ while (<FH>) {
             my $hashed = (($hexxed ^ ($hexxed >> 8)) & ($HASHBUCKETS1_32-1));
             #print("// hexxed '$hexxed'  hashed1 '$hashed'\n");
             $foldPairs1_32[$hashed] .= "    { 0x$code, 0x$map1 },\n";
+            $mem_used += 8;
         } elsif (not defined($map2)) {
             my $hashed = (($hexxed ^ ($hexxed >> 8)) & ($HASHBUCKETS1_16-1));
             #print("// hexxed '$hexxed'  hashed1 '$hashed'\n");
             $foldPairs1_16[$hashed] .= "    { 0x$code, 0x$map1 },\n";
+            $mem_used += 4;
         } elsif (not defined($map3)) {
             my $hashed = (($hexxed ^ ($hexxed >> 8)) & ($HASHBUCKETS2_16-1));
             #print("// hexxed '$hexxed'  hashed2 '$hashed'\n");
             $foldPairs2_16[$hashed] .= "    { 0x$code, 0x$map1, 0x$map2 },\n";
+            $mem_used += 6;
         } else {
             my $hashed = (($hexxed ^ ($hexxed >> 8)) & ($HASHBUCKETS3_16-1));
             #print("// hexxed '$hexxed'  hashed3 '$hashed'\n");
             $foldPairs3_16[$hashed] .= "    { 0x$code, 0x$map1, 0x$map2, 0x$map3 },\n";
+            $mem_used += 8;
         }
     }
 }
@@ -212,6 +218,7 @@ for (my $i = 0; $i < $HASHBUCKETS1_16; $i++) {
         my $sym = "case_fold1_16_${num}";
         print("    { $sym, __PHYSFS_ARRAYLEN($sym) },\n");
     }
+    $mem_used += 12;
 }
 print("};\n\n");
 
@@ -228,6 +235,7 @@ for (my $i = 0; $i < $HASHBUCKETS1_32; $i++) {
         my $sym = "case_fold1_32_${num}";
         print("    { $sym, __PHYSFS_ARRAYLEN($sym) },\n");
     }
+    $mem_used += 12;
 }
 print("};\n\n");
 
@@ -244,6 +252,7 @@ for (my $i = 0; $i < $HASHBUCKETS2_16; $i++) {
         my $sym = "case_fold2_16_${num}";
         print("    { $sym, __PHYSFS_ARRAYLEN($sym) },\n");
     }
+    $mem_used += 12;
 }
 print("};\n\n");
 
@@ -259,6 +268,7 @@ for (my $i = 0; $i < $HASHBUCKETS3_16; $i++) {
         my $sym = "case_fold3_16_${num}";
         print("    { $sym, __PHYSFS_ARRAYLEN($sym) },\n");
     }
+    $mem_used += 12;
 }
 print("};\n\n");
 
@@ -270,6 +280,8 @@ print <<__EOF__;
 
 __EOF__
 
+print STDERR "Memory required for case-folding hashtable: $mem_used bytes\n";
+
 exit 0;
 
 # end of makecashfoldhashtable.pl ...

+ 2 - 0
physfs.mod/physfs/extras/physfsrwops.c

@@ -21,6 +21,8 @@
  *  This file was written by Ryan C. Gordon. ([email protected]).
  */
 
+/* This works with SDL1 and SDL2. For SDL3, use physfssdl3.c */
+
 #include <stdio.h>  /* used for SEEK_SET, SEEK_CUR, SEEK_END ... */
 #include "physfsrwops.h"
 

+ 2 - 0
physfs.mod/physfs/extras/physfsrwops.h

@@ -21,6 +21,8 @@
  *  This file was written by Ryan C. Gordon. ([email protected]).
  */
 
+/* This works with SDL1 and SDL2. For SDL3, use physfssdl3.h */
+
 #ifndef _INCLUDE_PHYSFSRWOPS_H_
 #define _INCLUDE_PHYSFSRWOPS_H_
 

+ 298 - 0
physfs.mod/physfs/extras/physfssdl3.c

@@ -0,0 +1,298 @@
+/*
+ * This code provides a glue layer between PhysicsFS and Simple Directmedia
+ *  Layer 3's (SDL3) SDL_IOStream and SDL_Storage i/o abstractions.
+ *
+ * License: this code is public domain. I make no warranty that it is useful,
+ *  correct, harmless, or environmentally safe.
+ *
+ * This particular file may be used however you like, including copying it
+ *  verbatim into a closed-source project, exploiting it commercially, and
+ *  removing any trace of my name from the source (although I hope you won't
+ *  do that). I welcome enhancements and corrections to this file, but I do
+ *  not require you to send me patches if you make changes. This code has
+ *  NO WARRANTY.
+ *
+ * Unless otherwise stated, the rest of PhysicsFS falls under the zlib license.
+ *  Please see LICENSE.txt in the root of the source tree.
+ *
+ * SDL3 is zlib-licensed, like PhysicsFS. You can get SDL at
+ *  https://www.libsdl.org/
+ *
+ *  This file was written by Ryan C. Gordon. ([email protected]).
+ */
+
+/* This works with SDL3. For SDL1 and SDL2, use physfsrwops.h */
+
+#include "physfssdl3.h"
+
+/* SDL_IOStream -> PhysicsFS bridge ... */
+
+static Sint64 SDLCALL physfsiostream_size(void *userdata)
+{
+    return (Sint64) PHYSFS_fileLength((PHYSFS_File *) userdata);
+}
+
+static Sint64 SDLCALL physfsiostream_seek(void *userdata, Sint64 offset, int whence)
+{
+    PHYSFS_File *handle = (PHYSFS_File *) userdata;
+    PHYSFS_sint64 pos = 0;
+
+    if (whence == SDL_IO_SEEK_SET) {
+        pos = (PHYSFS_sint64) offset;
+    } else if (whence == SDL_IO_SEEK_CUR) {
+        const PHYSFS_sint64 current = PHYSFS_tell(handle);
+        if (current == -1) {
+            return SDL_SetError("Can't find position in file: %s", PHYSFS_getErrorByCode(PHYSFS_getLastErrorCode()));
+        }
+
+        if (offset == 0) {  /* this is a "tell" call. We're done. */
+            return (Sint64) current;
+        }
+
+        pos = current + ((PHYSFS_sint64) offset);
+    } else if (whence == SDL_IO_SEEK_END) {
+        const PHYSFS_sint64 len = PHYSFS_fileLength(handle);
+        if (len == -1) {
+            return SDL_SetError("Can't find end of file: %s", PHYSFS_getErrorByCode(PHYSFS_getLastErrorCode()));
+        }
+
+        pos = len + ((PHYSFS_sint64) offset);
+    } else {
+        return SDL_SetError("Invalid 'whence' parameter.");
+    }
+
+    if ( pos < 0 ) {
+        return SDL_SetError("Attempt to seek past start of file.");
+    }
+    
+    if (!PHYSFS_seek(handle, (PHYSFS_uint64) pos)) {
+        return SDL_SetError("PhysicsFS error: %s", PHYSFS_getErrorByCode(PHYSFS_getLastErrorCode()));
+    }
+
+    return (Sint64) pos;
+}
+
+static size_t SDLCALL physfsiostream_read(void *userdata, void *ptr, size_t size, SDL_IOStatus *status)
+{
+    PHYSFS_File *handle = (PHYSFS_File *) userdata;
+    const PHYSFS_uint64 readlen = (PHYSFS_uint64) size;
+    const PHYSFS_sint64 rc = PHYSFS_readBytes(handle, ptr, readlen);
+    if (rc != ((PHYSFS_sint64) readlen)) {
+        if (!PHYSFS_eof(handle)) {  /* not EOF? Must be an error. */
+            /* Setting an SDL error makes SDL take care of `status` for you. */
+            SDL_SetError("PhysicsFS error: %s", PHYSFS_getErrorByCode(PHYSFS_getLastErrorCode()));
+            return 0;
+        }
+    }
+    return (size_t) rc;
+}
+
+static size_t SDLCALL physfsiostream_write(void *userdata, const void *ptr, size_t size, SDL_IOStatus *status)
+{
+    PHYSFS_File *handle = (PHYSFS_File *) userdata;
+    const PHYSFS_uint64 writelen = (PHYSFS_uint64) size;
+    const PHYSFS_sint64 rc = PHYSFS_writeBytes(handle, ptr, writelen);
+    if (rc != ((PHYSFS_sint64) writelen)) {
+        /* Setting an SDL error makes SDL take care of `status` for you. */
+        SDL_SetError("PhysicsFS error: %s", PHYSFS_getErrorByCode(PHYSFS_getLastErrorCode()));
+    }
+    return (size_t) rc;
+}
+
+static int SDLCALL physfsiostream_close(void *userdata)
+{
+    if (!PHYSFS_close((PHYSFS_File *) userdata)) {
+        return SDL_SetError("PhysicsFS error: %s", PHYSFS_getErrorByCode(PHYSFS_getLastErrorCode()));
+    }
+    return 0;
+}
+
+static SDL_IOStream *create_iostream(PHYSFS_File *handle)
+{
+    SDL_IOStream *retval = NULL;
+    if (handle == NULL) {
+        SDL_SetError("PhysicsFS error: %s", PHYSFS_getErrorByCode(PHYSFS_getLastErrorCode()));
+    } else {
+        SDL_IOStreamInterface iface;
+        iface.size  = physfsiostream_size;
+        iface.seek  = physfsiostream_seek;
+        iface.read  = physfsiostream_read;
+        iface.write = physfsiostream_write;
+        iface.close = physfsiostream_close;
+        retval = SDL_OpenIO(&iface, handle);
+    }
+
+    return retval;
+}
+
+SDL_IOStream *PHYSFSSDL3_makeIOStream(PHYSFS_File *handle)
+{
+    SDL_IOStream *retval = NULL;
+    if (handle == NULL) {
+        SDL_SetError("NULL pointer passed to PHYSFSSDL3_makeRWops().");
+    } else {
+        retval = create_iostream(handle);
+    }
+    return retval;
+}
+
+SDL_IOStream *PHYSFSSDL3_openRead(const char *fname)
+{
+    return create_iostream(PHYSFS_openRead(fname));
+}
+
+SDL_IOStream *PHYSFSSDL3_openWrite(const char *fname)
+{
+    return create_iostream(PHYSFS_openWrite(fname));
+}
+
+SDL_IOStream *PHYSFSSDL3_openAppend(const char *fname)
+{
+    return create_iostream(PHYSFS_openAppend(fname));
+}
+
+
+/* SDL_Storage -> PhysicsFS bridge ... */
+
+static int SDLCALL physfssdl3storage_close(void *userdata)
+{
+    return 0;  /* this doesn't do anything, we didn't allocate anything specific to this object. */
+}
+
+static SDL_bool SDLCALL physfssdl3storage_ready(void *userdata)
+{
+    return SDL_TRUE;
+}
+
+/* this is a really obnoxious symbol name... */
+typedef struct physfssdl3storage_enumerate_callback_data
+{
+    SDL_EnumerateDirectoryCallback sdlcallback;
+    void *sdluserdata;
+} physfssdl3storage_enumerate_callback_data;
+
+static PHYSFS_EnumerateCallbackResult physfssdl3storage_enumerate_callback(void *userdata, const char *origdir, const char *fname)
+{
+    const physfssdl3storage_enumerate_callback_data *data = (physfssdl3storage_enumerate_callback_data *) userdata;
+    const int rc = data->sdlcallback(data->sdluserdata, origdir, fname);
+    if (rc < 0) {
+        return PHYSFS_ENUM_ERROR;
+    } else if (rc == 0) {
+        return PHYSFS_ENUM_STOP;
+    }
+    return PHYSFS_ENUM_OK;
+}
+
+static int SDLCALL physfssdl3storage_enumerate(void *userdata, const char *path, SDL_EnumerateDirectoryCallback callback, void *callback_userdata)
+{
+    physfssdl3storage_enumerate_callback_data data;
+    data.sdlcallback = callback;
+    data.sdluserdata = callback_userdata;
+    return PHYSFS_enumerate(path, physfssdl3storage_enumerate_callback, &data) ? 0 : -1;
+}
+
+static int SDLCALL physfssdl3storage_info(void *userdata, const char *path, SDL_PathInfo *info)
+{
+    PHYSFS_Stat statbuf;
+    if (!PHYSFS_stat(path, &statbuf)) {
+        return SDL_SetError("%s", PHYSFS_getErrorByCode(PHYSFS_getLastErrorCode()));
+    }
+
+    if (info) {
+        switch (statbuf.filetype) {
+            case PHYSFS_FILETYPE_REGULAR: info->type = SDL_PATHTYPE_FILE; break;
+            case PHYSFS_FILETYPE_DIRECTORY: info->type = SDL_PATHTYPE_DIRECTORY; break;
+            default: info->type = SDL_PATHTYPE_OTHER; break;
+        }
+
+        info->size = (Uint64) statbuf.filesize;
+        info->create_time = (SDL_Time) ((statbuf.createtime < 0) ? 0 : SDL_SECONDS_TO_NS(statbuf.createtime));
+        info->modify_time = (SDL_Time) ((statbuf.modtime < 0) ? 0 : SDL_SECONDS_TO_NS(statbuf.modtime));
+        info->access_time = (SDL_Time) ((statbuf.accesstime < 0) ? 0 : SDL_SECONDS_TO_NS(statbuf.accesstime));
+    }
+
+    return 0;
+}
+
+static int SDLCALL physfssdl3storage_read_file(void *userdata, const char *path, void *destination, Uint64 length)
+{
+    PHYSFS_file *f = PHYSFS_openRead(path);
+    PHYSFS_sint64 br;
+
+    if (!f) {
+        return SDL_SetError("%s", PHYSFS_getErrorByCode(PHYSFS_getLastErrorCode()));
+    }
+
+    br = PHYSFS_readBytes(f, destination, length);
+    PHYSFS_close(f);
+
+    if (br != (Sint64) length) {
+        return SDL_SetError("%s", PHYSFS_getErrorByCode(PHYSFS_getLastErrorCode()));
+    }
+    return 0;
+}
+
+
+static int SDLCALL physfssdl3storage_write_file(void *userdata, const char *path, const void *source, Uint64 length)
+{
+    PHYSFS_file *f = PHYSFS_openWrite(path);
+    PHYSFS_sint64 bw;
+
+    if (!f) {
+        return SDL_SetError("%s", PHYSFS_getErrorByCode(PHYSFS_getLastErrorCode()));
+    }
+
+    bw = PHYSFS_writeBytes(f, source, length);
+    PHYSFS_close(f);
+
+    if (bw != (Sint64) length) {
+        return SDL_SetError("%s", PHYSFS_getErrorByCode(PHYSFS_getLastErrorCode()));
+    }
+    return 0;
+}
+
+static int SDLCALL physfssdl3storage_mkdir(void *userdata, const char *path)
+{
+    if (!PHYSFS_mkdir(path)) {
+        return SDL_SetError("%s", PHYSFS_getErrorByCode(PHYSFS_getLastErrorCode()));
+    }
+    return 0;
+
+}
+
+static int SDLCALL physfssdl3storage_remove(void *userdata, const char *path)
+{
+    if (!PHYSFS_delete(path)) {
+        return SDL_SetError("%s", PHYSFS_getErrorByCode(PHYSFS_getLastErrorCode()));
+    }
+    return 0;
+}
+
+static int SDLCALL physfssdl3storage_rename(void *userdata, const char *oldpath, const char *newpath)
+{
+    return SDL_Unsupported();  /* no rename operation in PhysicsFS. */
+}
+
+static Uint64 SDLCALL physfssdl3storage_space_remaining(void *userdata)
+{
+    return SDL_MAX_UINT64;  /* we don't track this in PhysicsFS. */
+}
+
+SDL_Storage *PHYSFSSDL3_makeStorage(void)
+{
+    SDL_StorageInterface iface;
+    iface.close = physfssdl3storage_close;
+    iface.ready = physfssdl3storage_ready;
+    iface.enumerate = physfssdl3storage_enumerate;
+    iface.info = physfssdl3storage_info;
+    iface.read_file = physfssdl3storage_read_file;
+    iface.write_file = physfssdl3storage_write_file;
+    iface.mkdir = physfssdl3storage_mkdir;
+    iface.remove = physfssdl3storage_remove;
+    iface.rename = physfssdl3storage_rename;
+    iface.space_remaining = physfssdl3storage_space_remaining;
+    return SDL_OpenStorage(&iface, NULL);
+}
+
+/* end of physfssdl3.c ... */
+

+ 106 - 0
physfs.mod/physfs/extras/physfssdl3.h

@@ -0,0 +1,106 @@
+/*
+ * This code provides a glue layer between PhysicsFS and Simple Directmedia
+ *  Layer 3's (SDL3) SDL_IOStream and SDL_Storage i/o abstractions.
+ *
+ * License: this code is public domain. I make no warranty that it is useful,
+ *  correct, harmless, or environmentally safe.
+ *
+ * This particular file may be used however you like, including copying it
+ *  verbatim into a closed-source project, exploiting it commercially, and
+ *  removing any trace of my name from the source (although I hope you won't
+ *  do that). I welcome enhancements and corrections to this file, but I do
+ *  not require you to send me patches if you make changes. This code has
+ *  NO WARRANTY.
+ *
+ * Unless otherwise stated, the rest of PhysicsFS falls under the zlib license.
+ *  Please see LICENSE.txt in the root of the source tree.
+ *
+ * SDL3 is zlib-licensed, like PhysicsFS. You can get SDL at
+ *  https://www.libsdl.org/
+ *
+ *  This file was written by Ryan C. Gordon. ([email protected]).
+ */
+
+/* This works with SDL3. For SDL1 and SDL2, use physfsrwops.h */
+
+#ifndef _INCLUDE_PHYSFSSDL3_H_
+#define _INCLUDE_PHYSFSSDL3_H_
+
+#include "physfs.h"
+#include <SDL3/SDL.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* You can either just get SDL_IOStreams directly from a PhysicsFS path,
+   or make an SDL_Storage that bridges to the PhysicsFS VFS. */
+
+
+/**
+ * Open a platform-independent filename for reading, and make it accessible
+ *  via an SDL_IOStream. The file will be closed in PhysicsFS when the
+ *  RWops is closed. PhysicsFS should be configured to your liking before
+ *  opening files through this method.
+ *
+ *   @param filename File to open in platform-independent notation.
+ *  @return A valid SDL_IOStream on success, NULL on error. Specifics
+ *           of the error can be gleaned from SDL_GetError().
+ */
+PHYSFS_DECL SDL_IOStream *PHYSFSSDL3_openRead(const char *fname);
+
+/**
+ * Open a platform-independent filename for writing, and make it accessible
+ *  via an SDL_IOStream. The file will be closed in PhysicsFS when the
+ *  RWops is closed. PhysicsFS should be configured to your liking before
+ *  opening files through this method.
+ *
+ *   @param filename File to open in platform-independent notation.
+ *  @return A valid SDL_IOStream on success, NULL on error. Specifics
+ *           of the error can be gleaned from SDL_GetError().
+ */
+PHYSFS_DECL SDL_IOStream *PHYSFSSDL3_openWrite(const char *fname);
+
+/**
+ * Open a platform-independent filename for appending, and make it accessible
+ *  via an SDL_IOStream. The file will be closed in PhysicsFS when the
+ *  RWops is closed. PhysicsFS should be configured to your liking before
+ *  opening files through this method.
+ *
+ *   @param filename File to open in platform-independent notation.
+ *  @return A valid SDL_IOStream on success, NULL on error. Specifics
+ *           of the error can be gleaned from SDL_GetError().
+ */
+PHYSFS_DECL SDL_IOStream *PHYSFSSDL3_openAppend(const char *fname);
+
+/**
+ * Make a SDL_IOStream from an existing PhysicsFS file handle. You should
+ *  dispose of any references to the handle after successful creation of
+ *  the RWops. The actual PhysicsFS handle will be destroyed when the
+ *  RWops is closed.
+ *
+ *   @param handle a valid PhysicsFS file handle.
+ *  @return A valid SDL_IOStream on success, NULL on error. Specifics
+ *           of the error can be gleaned from SDL_GetError().
+ */
+PHYSFS_DECL SDL_IOStream *PHYSFSSDL3_makeIOStream(PHYSFS_File *handle);
+
+/**
+ * Expose the PhysicsFS VFS through an SDL_Storage interface.
+ * This just makes the global interpolated file tree available
+ * through SDL3's interface. You can still manipulate it outside
+ * of SDL_Storage by calling PhysicsFS APIs directly.
+ *
+ *  @return A valid SDL_Storage on success, NULL on error. Specifics
+ *           of the error can be gleaned from SDL_GetError().
+ */
+PHYSFS_DECL SDL_Storage *PHYSFSSDL3_makeStorage(void);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* include-once blocker */
+
+/* end of physfssdl3.h ... */
+

+ 1 - 0
physfs.mod/physfs/src/Makefile.os2

@@ -25,6 +25,7 @@ SRCS = physfs.c                   &
        physfs_archiver_zip.c      &
        physfs_archiver_slb.c      &
        physfs_archiver_iso9660.c  &
+       physfs_archiver_csm.c      &
        physfs_archiver_vdf.c
 
 

+ 9 - 3
physfs.mod/physfs/src/physfs.c

@@ -318,7 +318,7 @@ static PHYSFS_Io *memoryIo_duplicate(PHYSFS_Io *io)
         BAIL(PHYSFS_ERR_OUT_OF_MEMORY, NULL);
     } /* if */
 
-    __PHYSFS_ATOMIC_INCR(&info->refcount);
+    (void) __PHYSFS_ATOMIC_INCR(&info->refcount);
 
     memset(newinfo, '\0', sizeof (*info));
     newinfo->buf = info->buf;
@@ -1188,6 +1188,9 @@ static int initStaticArchivers(void)
     #if PHYSFS_SUPPORTS_WAD
         REGISTER_STATIC_ARCHIVER(WAD);
     #endif
+    #if PHYSFS_SUPPORTS_CSM
+        REGISTER_STATIC_ARCHIVER(CSM);
+    #endif
     #if PHYSFS_SUPPORTS_SLB
         REGISTER_STATIC_ARCHIVER(SLB);
     #endif
@@ -1216,7 +1219,7 @@ int PHYSFS_init(const char *argv0)
 
     if ((allocator.Init != NULL) && (!allocator.Init())) return 0;
 
-    if (!__PHYSFS_platformInit())
+    if (!__PHYSFS_platformInit(argv0))
     {
         if (allocator.Deinit != NULL) allocator.Deinit();
         return 0;
@@ -3245,6 +3248,7 @@ const PHYSFS_Allocator *PHYSFS_getAllocator(void)
 } /* PHYSFS_getAllocator */
 
 
+#ifndef PHYSFS_NO_CRUNTIME_MALLOC
 static void *mallocAllocatorMalloc(PHYSFS_uint64 s)
 {
     if (!__PHYSFS_ui64FitsAddressSpace(s))
@@ -3268,16 +3272,18 @@ static void mallocAllocatorFree(void *ptr)
     #undef free
     free(ptr);
 } /* mallocAllocatorFree */
-
+#endif
 
 static void setDefaultAllocator(void)
 {
     assert(!externalAllocator);
     allocator.Init = NULL;
     allocator.Deinit = NULL;
+    #ifndef PHYSFS_NO_CRUNTIME_MALLOC
     allocator.Malloc = mallocAllocatorMalloc;
     allocator.Realloc = mallocAllocatorRealloc;
     allocator.Free = mallocAllocatorFree;
+    #endif
 } /* setDefaultAllocator */
 
 

+ 6 - 0
physfs.mod/physfs/src/physfs.h

@@ -148,6 +148,7 @@
  *   - .HOG (Descent I/II/III HOG file archives)
  *   - .MVL (Descent II movielib archives)
  *   - .WAD (DOOM engine archives)
+ *   - .BIN (Chasm: The Rift engine archives)
  *   - .VDF (Gothic I/II engine archives)
  *   - .SLB (Independence War archives)
  *
@@ -523,6 +524,11 @@ typedef struct PHYSFS_AndroidInit
  *          succeed, but PHYSFS_getBaseDir() and PHYSFS_getPrefDir() will be
  *          incorrect.
  *
+ * \warning On Playdate, argv0 should be a non-NULL pointer to a PlaydateAPI
+ *          struct. PhysicsFS uses this object for system-level access and
+ *          will hold it until PHYSFS_deinit is called.
+ *          If you pass a NULL here, PhysicsFS will crash.
+ *
  *   \param argv0 the argv[0] string passed to your program's mainline.
  *          This may be NULL on most platforms (such as ones without a
  *          standard main() function), but you should always try to pass

+ 123 - 0
physfs.mod/physfs/src/physfs_archiver_csm.c

@@ -0,0 +1,123 @@
+/*
+ * CSM support routines for PhysicsFS.
+ *
+ * This driver handles Chasm: The Rift engine archives ("CSM.BINs"). 
+ * This format (but not this driver) was developed by Action Forms Ltd.
+ * and published by Megamedia for use with the Chasm: The Rift engine.
+ * The specs of the format are from http://github.com/Panzerschrek/Chasm-Reverse
+ * The format of the archive: (from the specs)
+ *
+ *  A CSM file has three parts:
+ *  (1) a 6 byte header
+ *  (2) a TOC that contains the names, offsets, and
+ *      sizes of all the entries in the CSM.BIN
+ *
+ *  The header consists of three four-byte parts:
+ *    (a) an ASCII string which must be "CSid"
+ *    (b) a uint16 which is the number of TOC entries in the CSM.BIN
+ *
+ *  The TOC has one -byte entry for every lump. Each entry consists
+ *  of three parts:
+ *
+ *    (a) a uint8, the length of the filename
+ *    (b) an 12-byte ASCII string, the name of the entry, padded with zeros.
+ *    (c) a uint32, the size of the entry in bytes
+ *    (d) a uint32, the file offset to the start of the entry
+ * 
+ *
+ *
+ * Please see the file LICENSE.txt in the source's root directory.
+ *
+ * This file written by Jon Daniel, based on the WAD archiver by
+ *  Travis Wells.
+ */
+
+#define __PHYSICSFS_INTERNAL__
+#include "physfs_internal.h"
+
+#if PHYSFS_SUPPORTS_CSM
+
+static int csmLoadEntries(PHYSFS_Io *io, const PHYSFS_uint16 count, void *arc)
+{
+    PHYSFS_uint16 i;
+    for (i = 0; i < count; i++)
+    {
+    	PHYSFS_uint8 fn_len;
+	char name[12];
+        PHYSFS_uint32 size;
+        PHYSFS_uint32 pos;
+
+        BAIL_IF_ERRPASS(!__PHYSFS_readAll(io, &fn_len, 1), 0);
+        BAIL_IF_ERRPASS(!__PHYSFS_readAll(io, name, 12), 0);
+        BAIL_IF_ERRPASS(!__PHYSFS_readAll(io, &size, 4), 0);
+        BAIL_IF_ERRPASS(!__PHYSFS_readAll(io, &pos, 4), 0);
+
+	if(fn_len > 12) fn_len = 12;
+        name[fn_len] = '\0'; /* name might not be null-terminated in file. */
+        size = PHYSFS_swapULE32(size);
+        pos = PHYSFS_swapULE32(pos);
+        BAIL_IF_ERRPASS(!UNPK_addEntry(arc, name, 0, -1, -1, pos, size), 0);
+    } /* for */
+
+    return 1;
+} /* csmLoadEntries */
+
+
+static void *CSM_openArchive(PHYSFS_Io *io, const char *name,
+                             int forWriting, int *claimed)
+{
+    PHYSFS_uint8 buf[4];
+    PHYSFS_uint16 count;
+    void *unpkarc;
+
+    assert(io != NULL);  /* shouldn't ever happen. */
+
+    BAIL_IF(forWriting, PHYSFS_ERR_READ_ONLY, NULL);
+    BAIL_IF_ERRPASS(!__PHYSFS_readAll(io, buf, sizeof (buf)), NULL);
+    if (memcmp(buf, "CSid", 4) != 0)
+        BAIL(PHYSFS_ERR_UNSUPPORTED, NULL);
+
+    *claimed = 1;
+
+    BAIL_IF_ERRPASS(!__PHYSFS_readAll(io, &count, sizeof (count)), NULL);
+    count = PHYSFS_swapULE16(count);
+
+
+    unpkarc = UNPK_openArchive(io, 0, 1);
+    BAIL_IF_ERRPASS(!unpkarc, NULL);
+
+    if (!csmLoadEntries(io, count, unpkarc))
+    {
+        UNPK_abandonArchive(unpkarc);
+        return NULL;
+    } /* if */
+
+    return unpkarc;
+} /* CSM_openArchive */
+
+
+const PHYSFS_Archiver __PHYSFS_Archiver_CSM =
+{
+    CURRENT_PHYSFS_ARCHIVER_API_VERSION,
+    {
+        "BIN",
+        "Chasm: The Rift engine format",
+	"Jon Daniel <[email protected]>",
+        "http://www.github.com/Panzerschrek/Chasm-Reverse",
+        0,  /* supportsSymlinks */
+    },
+    CSM_openArchive,
+    UNPK_enumerate,
+    UNPK_openRead,
+    UNPK_openWrite,
+    UNPK_openAppend,
+    UNPK_remove,
+    UNPK_mkdir,
+    UNPK_stat,
+    UNPK_closeArchive
+};
+
+#endif  /* defined PHYSFS_SUPPORTS_CSM */
+
+/* end of physfs_archiver_CSM.c ... */
+

Dosya farkı çok büyük olduğundan ihmal edildi
+ 252 - 66
physfs.mod/physfs/src/physfs_casefolding.h


+ 15 - 4
physfs.mod/physfs/src/physfs_internal.h

@@ -38,7 +38,7 @@
 #include <malloc.h>
 #endif
 
-#if defined(PHYSFS_PLATFORM_SOLARIS) || defined(PHYSFS_PLATFORM_LINUX)
+#if defined(PHYSFS_PLATFORM_SOLARIS) || defined(PHYSFS_PLATFORM_LINUX) || defined(PHYSFS_PLATFORM_OGC)
 #include <alloca.h>
 #endif
 
@@ -88,6 +88,7 @@ extern const PHYSFS_Archiver __PHYSFS_Archiver_QPAK;
 extern const PHYSFS_Archiver __PHYSFS_Archiver_HOG;
 extern const PHYSFS_Archiver __PHYSFS_Archiver_MVL;
 extern const PHYSFS_Archiver __PHYSFS_Archiver_WAD;
+extern const PHYSFS_Archiver __PHYSFS_Archiver_CSM;
 extern const PHYSFS_Archiver __PHYSFS_Archiver_SLB;
 extern const PHYSFS_Archiver __PHYSFS_Archiver_ISO9660;
 extern const PHYSFS_Archiver __PHYSFS_Archiver_VDF;
@@ -110,7 +111,9 @@ const void *__PHYSFS_winrtCalcPrefDir(void);
 
 /* atomic operations. */
 /* increment/decrement operations return the final incremented/decremented value. */
-#if defined(_MSC_VER) && (_MSC_VER >= 1500)
+#ifdef PHYSFS_PLATFORM_PLAYDATE
+#define PHYSFS_NEED_ATOMIC_OP_FALLBACK 1
+#elif defined(_MSC_VER) && (_MSC_VER >= 1500)
 #include <intrin.h>
 __PHYSFS_COMPILE_TIME_ASSERT(LongEqualsInt, sizeof (int) == sizeof (long));
 #define __PHYSFS_ATOMIC_INCR(ptrval) _InterlockedIncrement((long*)(ptrval))
@@ -129,6 +132,9 @@ extern __inline int _xadd_watcom(volatile int *a, int v);
 #define __PHYSFS_ATOMIC_DECR(ptrval) (_xadd_watcom(ptrval, -1)-1)
 #else
 #define PHYSFS_NEED_ATOMIC_OP_FALLBACK 1
+#endif
+
+#ifdef PHYSFS_NEED_ATOMIC_OP_FALLBACK
 int __PHYSFS_ATOMIC_INCR(int *ptrval);
 int __PHYSFS_ATOMIC_DECR(int *ptrval);
 #endif
@@ -200,6 +206,9 @@ void __PHYSFS_smallFree(void *ptr);
 #ifndef PHYSFS_SUPPORTS_WAD
 #define PHYSFS_SUPPORTS_WAD PHYSFS_SUPPORTS_DEFAULT
 #endif
+#ifndef PHYSFS_SUPPORTS_CSM
+#define PHYSFS_SUPPORTS_CSM PHYSFS_SUPPORTS_DEFAULT
+#endif
 #ifndef PHYSFS_SUPPORTS_QPAK
 #define PHYSFS_SUPPORTS_QPAK PHYSFS_SUPPORTS_DEFAULT
 #endif
@@ -462,12 +471,14 @@ void __PHYSFS_DirTreeDeinit(__PHYSFS_DirTree *dt);
 
 /*
  * Initialize the platform. This is called when PHYSFS_init() is called from
- *  the application.
+ *  the application. argv[0] (or whatever the app is passing) is
+ *  supplied here, since some platforms need it immediately, but this same
+ *  pointer is also passed to __PHYSFS_platformCalcBaseDir a little later.
  *
  * Return zero if there was a catastrophic failure (which prevents you from
  *  functioning at all), and non-zero otherwise.
  */
-int __PHYSFS_platformInit(void);
+int __PHYSFS_platformInit(const char *argv0);
 
 
 /*

+ 1 - 1
physfs.mod/physfs/src/physfs_platform_android.c

@@ -18,7 +18,7 @@
 static char *prefpath = NULL;
 
 
-int __PHYSFS_platformInit(void)
+int __PHYSFS_platformInit(const char *argv0)
 {
     return 1;  /* always succeed. */
 } /* __PHYSFS_platformInit */

+ 1 - 1
physfs.mod/physfs/src/physfs_platform_apple.m

@@ -16,7 +16,7 @@
 
 #include "physfs_internal.h"
 
-int __PHYSFS_platformInit(void)
+int __PHYSFS_platformInit(const char *argv0)
 {
     return 1;  /* success. */
 } /* __PHYSFS_platformInit */

+ 1 - 1
physfs.mod/physfs/src/physfs_platform_haiku.cpp

@@ -26,7 +26,7 @@
 
 #include "physfs_internal.h"
 
-int __PHYSFS_platformInit(void)
+int __PHYSFS_platformInit(const char *argv0)
 {
     return 1;  /* always succeed. */
 } /* __PHYSFS_platformInit */

+ 437 - 0
physfs.mod/physfs/src/physfs_platform_ogc.c

@@ -0,0 +1,437 @@
+/*
+ * Wii/GameCube support routines for PhysicsFS.
+ *
+ * Please see the file LICENSE.txt in the source's root directory.
+ *
+ *  This file written by Ryan C. Gordon.
+ */
+
+#define __PHYSICSFS_INTERNAL__
+#include "physfs_platforms.h"
+
+#ifdef PHYSFS_PLATFORM_OGC
+
+#include <unistd.h>
+#include <ctype.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <dirent.h>
+#include <errno.h>
+#include <fcntl.h>
+#include <stdlib.h>
+#include <sys/param.h>
+#include <time.h>
+#include <limits.h>
+
+
+#include <ogc/lwp.h>
+#include <ogc/mutex.h>
+#include <ogc/system.h>
+
+#include "physfs_internal.h"
+
+
+static PHYSFS_ErrorCode errcodeFromErrnoError(const int err)
+{
+    switch (err)
+    {
+        case 0: return PHYSFS_ERR_OK;
+        case EACCES: return PHYSFS_ERR_PERMISSION;
+        case EPERM: return PHYSFS_ERR_PERMISSION;
+        case EDQUOT: return PHYSFS_ERR_NO_SPACE;
+        case EIO: return PHYSFS_ERR_IO;
+        case ELOOP: return PHYSFS_ERR_SYMLINK_LOOP;
+        case EMLINK: return PHYSFS_ERR_NO_SPACE;
+        case ENAMETOOLONG: return PHYSFS_ERR_BAD_FILENAME;
+        case ENOENT: return PHYSFS_ERR_NOT_FOUND;
+        case ENOSPC: return PHYSFS_ERR_NO_SPACE;
+        case ENOTDIR: return PHYSFS_ERR_NOT_FOUND;
+        case EISDIR: return PHYSFS_ERR_NOT_A_FILE;
+        case EROFS: return PHYSFS_ERR_READ_ONLY;
+        case ETXTBSY: return PHYSFS_ERR_BUSY;
+        case EBUSY: return PHYSFS_ERR_BUSY;
+        case ENOMEM: return PHYSFS_ERR_OUT_OF_MEMORY;
+        case ENOTEMPTY: return PHYSFS_ERR_DIR_NOT_EMPTY;
+        default: return PHYSFS_ERR_OS_ERROR;
+    } /* switch */
+} /* errcodeFromErrnoError */
+
+
+static inline PHYSFS_ErrorCode errcodeFromErrno(void)
+{
+    return errcodeFromErrnoError(errno);
+} /* errcodeFromErrno */
+
+
+static inline char *buildSubdirPath(const char *subdir, size_t subdir_length)
+{
+    const char *baseDir;
+    char *retval;
+    size_t length;
+
+    baseDir = PHYSFS_getBaseDir();
+    length = strlen(baseDir);
+
+    retval = allocator.Malloc(length + subdir_length);
+    BAIL_IF(!retval, PHYSFS_ERR_OUT_OF_MEMORY, NULL);
+    strcpy(retval, baseDir);
+    strcpy(retval + length, subdir);
+
+    return retval;
+}
+
+char *__PHYSFS_platformCalcUserDir(void)
+{
+    static const char subdir[] = "userdata/";
+
+    /* We don't have users on the Wii/GameCube. Just create a userdata folder
+     * in the application's directory. */
+    return buildSubdirPath(subdir, sizeof(subdir));
+} /* __PHYSFS_platformCalcUserDir */
+
+
+PHYSFS_EnumerateCallbackResult __PHYSFS_platformEnumerate(const char *dirname,
+                               PHYSFS_EnumerateCallback callback,
+                               const char *origdir, void *callbackdata)
+{
+    DIR *dir;
+    struct dirent *ent;
+    PHYSFS_EnumerateCallbackResult retval = PHYSFS_ENUM_OK;
+
+    dir = opendir(dirname);
+    BAIL_IF(dir == NULL, errcodeFromErrno(), PHYSFS_ENUM_ERROR);
+
+    while ((retval == PHYSFS_ENUM_OK) && ((ent = readdir(dir)) != NULL))
+    {
+        const char *name = ent->d_name;
+        if (name[0] == '.')  /* ignore "." and ".." */
+        {
+            if ((name[1] == '\0') || ((name[1] == '.') && (name[2] == '\0')))
+                continue;
+        } /* if */
+
+        retval = callback(callbackdata, origdir, name);
+        if (retval == PHYSFS_ENUM_ERROR)
+            PHYSFS_setErrorCode(PHYSFS_ERR_APP_CALLBACK);
+    } /* while */
+
+    closedir(dir);
+
+    return retval;
+} /* __PHYSFS_platformEnumerate */
+
+
+int __PHYSFS_platformMkDir(const char *path)
+{
+    const int rc = mkdir(path, S_IRWXU);
+    BAIL_IF(rc == -1, errcodeFromErrno(), 0);
+    return 1;
+} /* __PHYSFS_platformMkDir */
+
+
+#if !defined(O_CLOEXEC) && defined(FD_CLOEXEC)
+static inline void set_CLOEXEC(int fildes)
+{
+    int flags = fcntl(fildes, F_GETFD);
+    if (flags != -1) {
+        fcntl(fildes, F_SETFD, flags | FD_CLOEXEC);
+    }
+}
+#endif
+
+static void *doOpen(const char *filename, int mode)
+{
+    const int appending = (mode & O_APPEND);
+    int fd;
+    int *retval;
+
+    errno = 0;
+
+    /* O_APPEND doesn't actually behave as we'd like. */
+    mode &= ~O_APPEND;
+
+#ifdef O_CLOEXEC
+    /* Add O_CLOEXEC if defined */
+    mode |= O_CLOEXEC;
+#endif
+
+    do {
+        fd = open(filename, mode, S_IRUSR | S_IWUSR);
+    } while ((fd < 0) && (errno == EINTR));
+    BAIL_IF(fd < 0, errcodeFromErrno(), NULL);
+
+#if !defined(O_CLOEXEC) && defined(FD_CLOEXEC)
+    set_CLOEXEC(fd);
+#endif
+
+    if (appending)
+    {
+        if (lseek(fd, 0, SEEK_END) < 0)
+        {
+            const int err = errno;
+            close(fd);
+            BAIL(errcodeFromErrnoError(err), NULL);
+        } /* if */
+    } /* if */
+
+    retval = (int *) allocator.Malloc(sizeof (int));
+    if (!retval)
+    {
+        close(fd);
+        BAIL(PHYSFS_ERR_OUT_OF_MEMORY, NULL);
+    } /* if */
+
+    *retval = fd;
+    return ((void *) retval);
+} /* doOpen */
+
+
+void *__PHYSFS_platformOpenRead(const char *filename)
+{
+    return doOpen(filename, O_RDONLY);
+} /* __PHYSFS_platformOpenRead */
+
+
+void *__PHYSFS_platformOpenWrite(const char *filename)
+{
+    return doOpen(filename, O_WRONLY | O_CREAT | O_TRUNC);
+} /* __PHYSFS_platformOpenWrite */
+
+
+void *__PHYSFS_platformOpenAppend(const char *filename)
+{
+    return doOpen(filename, O_WRONLY | O_CREAT | O_APPEND);
+} /* __PHYSFS_platformOpenAppend */
+
+
+PHYSFS_sint64 __PHYSFS_platformRead(void *opaque, void *buffer,
+                                    PHYSFS_uint64 len)
+{
+    const int fd = *((int *) opaque);
+    ssize_t rc = 0;
+
+    if (!__PHYSFS_ui64FitsAddressSpace(len))
+        BAIL(PHYSFS_ERR_INVALID_ARGUMENT, -1);
+
+    do {
+        rc = read(fd, buffer, (size_t) len);
+    } while ((rc == -1) && (errno == EINTR));
+    BAIL_IF(rc == -1, errcodeFromErrno(), -1);
+    assert(rc >= 0);
+    assert(rc <= len);
+    return (PHYSFS_sint64) rc;
+} /* __PHYSFS_platformRead */
+
+
+PHYSFS_sint64 __PHYSFS_platformWrite(void *opaque, const void *buffer,
+                                     PHYSFS_uint64 len)
+{
+    const int fd = *((int *) opaque);
+    ssize_t rc = 0;
+
+    if (!__PHYSFS_ui64FitsAddressSpace(len))
+        BAIL(PHYSFS_ERR_INVALID_ARGUMENT, -1);
+
+    do {
+        rc = write(fd, (void *) buffer, (size_t) len);
+    } while ((rc == -1) && (errno == EINTR));
+    BAIL_IF(rc == -1, errcodeFromErrno(), rc);
+    assert(rc >= 0);
+    assert(rc <= len);
+    return (PHYSFS_sint64) rc;
+} /* __PHYSFS_platformWrite */
+
+
+int __PHYSFS_platformSeek(void *opaque, PHYSFS_uint64 pos)
+{
+    const int fd = *((int *) opaque);
+    const off_t rc = lseek(fd, (off_t) pos, SEEK_SET);
+    BAIL_IF(rc == -1, errcodeFromErrno(), 0);
+    return 1;
+} /* __PHYSFS_platformSeek */
+
+
+PHYSFS_sint64 __PHYSFS_platformTell(void *opaque)
+{
+    const int fd = *((int *) opaque);
+    PHYSFS_sint64 retval;
+    retval = (PHYSFS_sint64) lseek(fd, 0, SEEK_CUR);
+    BAIL_IF(retval == -1, errcodeFromErrno(), -1);
+    return retval;
+} /* __PHYSFS_platformTell */
+
+
+PHYSFS_sint64 __PHYSFS_platformFileLength(void *opaque)
+{
+    const int fd = *((int *) opaque);
+    struct stat statbuf;
+    BAIL_IF(fstat(fd, &statbuf) == -1, errcodeFromErrno(), -1);
+    return ((PHYSFS_sint64) statbuf.st_size);
+} /* __PHYSFS_platformFileLength */
+
+
+int __PHYSFS_platformFlush(void *opaque)
+{
+    const int fd = *((int *) opaque);
+    int rc = -1;
+    if ((fcntl(fd, F_GETFL) & O_ACCMODE) != O_RDONLY) {
+        do {
+            rc = fsync(fd);
+        } while ((rc == -1) && (errno == EINTR));
+        BAIL_IF(rc == -1, errcodeFromErrno(), 0);
+    }
+    return 1;
+} /* __PHYSFS_platformFlush */
+
+
+void __PHYSFS_platformClose(void *opaque)
+{
+    const int fd = *((int *) opaque);
+    int rc = -1;
+    do {
+        rc = close(fd);  /* we don't check this. You should have used flush! */
+    } while ((rc == -1) && (errno == EINTR));
+    allocator.Free(opaque);
+} /* __PHYSFS_platformClose */
+
+
+int __PHYSFS_platformDelete(const char *path)
+{
+    BAIL_IF(remove(path) == -1, errcodeFromErrno(), 0);
+    return 1;
+} /* __PHYSFS_platformDelete */
+
+
+int __PHYSFS_platformStat(const char *fname, PHYSFS_Stat *st, const int follow)
+{
+    struct stat statbuf;
+    const int rc = follow ? stat(fname, &statbuf) : lstat(fname, &statbuf);
+    BAIL_IF(rc == -1, errcodeFromErrno(), 0);
+
+    if (S_ISREG(statbuf.st_mode))
+    {
+        st->filetype = PHYSFS_FILETYPE_REGULAR;
+        st->filesize = statbuf.st_size;
+    } /* if */
+
+    else if(S_ISDIR(statbuf.st_mode))
+    {
+        st->filetype = PHYSFS_FILETYPE_DIRECTORY;
+        st->filesize = 0;
+    } /* else if */
+
+    else if(S_ISLNK(statbuf.st_mode))
+    {
+        st->filetype = PHYSFS_FILETYPE_SYMLINK;
+        st->filesize = 0;
+    } /* else if */
+
+    else
+    {
+        st->filetype = PHYSFS_FILETYPE_OTHER;
+        st->filesize = statbuf.st_size;
+    } /* else */
+
+    st->modtime = statbuf.st_mtime;
+    st->createtime = statbuf.st_ctime;
+    st->accesstime = statbuf.st_atime;
+
+    st->readonly = (access(fname, W_OK) == -1);
+    return 1;
+} /* __PHYSFS_platformStat */
+
+
+void *__PHYSFS_platformGetThreadID(void)
+{
+    return (void *) LWP_GetSelf();
+} /* __PHYSFS_platformGetThreadID */
+
+
+void *__PHYSFS_platformCreateMutex(void)
+{
+    mutex_t m;
+    LWP_MutexInit(&m, true);
+    return (void *) m;
+} /* __PHYSFS_platformCreateMutex */
+
+
+void __PHYSFS_platformDestroyMutex(void *mutex)
+{
+    mutex_t m = (mutex_t) mutex;
+
+    LWP_MutexDestroy(m);
+} /* __PHYSFS_platformDestroyMutex */
+
+
+int __PHYSFS_platformGrabMutex(void *mutex)
+{
+    mutex_t m = (mutex_t) mutex;
+    return LWP_MutexLock(m) == 0 ? 1 : 0;
+} /* __PHYSFS_platformGrabMutex */
+
+
+void __PHYSFS_platformReleaseMutex(void *mutex)
+{
+    mutex_t m = (mutex_t) mutex;
+    LWP_MutexUnlock(m);
+} /* __PHYSFS_platformReleaseMutex */
+
+
+
+int __PHYSFS_platformInit(const char *argv0)
+{
+    return 1;  /* always succeed. */
+} /* __PHYSFS_platformInit */
+
+
+void __PHYSFS_platformDeinit(void)
+{
+    /* no-op */
+} /* __PHYSFS_platformDeinit */
+
+
+void __PHYSFS_platformDetectAvailableCDs(PHYSFS_StringCallback cb, void *data)
+{
+} /* __PHYSFS_platformDetectAvailableCDs */
+
+
+char *__PHYSFS_platformCalcBaseDir(const char *argv0)
+{
+    char *retval;
+    const size_t bufsize = 128;
+
+    retval = allocator.Malloc(bufsize);
+    BAIL_IF(!retval, PHYSFS_ERR_OUT_OF_MEMORY, NULL);
+
+    if (getcwd(retval, bufsize - 1))
+    {
+        /* Make sure the path is slash-terminated */
+        size_t length = strlen(retval);
+        if (length > 0 && retval[length - 1] != '/')
+        {
+            retval[length++] = '/';
+            retval[length] = '\0';
+        }
+    }
+    else
+    {
+        strcpy(retval, "/");
+    }
+
+    return retval;
+} /* __PHYSFS_platformCalcBaseDir */
+
+
+char *__PHYSFS_platformCalcPrefDir(const char *org, const char *app)
+{
+    static const char subdir[] = "data/";
+
+    return buildSubdirPath(subdir, sizeof(subdir));
+} /* __PHYSFS_platformCalcPrefDir */
+
+/* end of physfs_platform_unix.c ... */
+
+#endif  /* PHYSFS_PLATFORM_OGC */
+
+/* end of physfs_platform_ogc.c ... */
+

+ 2 - 2
physfs.mod/physfs/src/physfs_platform_os2.c

@@ -292,7 +292,7 @@ static void prepUnicodeSupport(void)
 } /* prepUnicodeSupport */
 
 
-int __PHYSFS_platformInit(void)
+int __PHYSFS_platformInit(const char *argv0)
 {
     prepUnicodeSupport();
     return 1;  /* ready to go! */
@@ -703,7 +703,7 @@ done:
 
 
 /* Convert to a format PhysicsFS can grok... */
-PHYSFS_sint64 os2TimeToUnixTime(const FDATE *date, const FTIME *time)
+static PHYSFS_sint64 os2TimeToUnixTime(const FDATE *date, const FTIME *time)
 {
     struct tm tm;
 

+ 287 - 0
physfs.mod/physfs/src/physfs_platform_playdate.c

@@ -0,0 +1,287 @@
+/*
+ * Playdate support routines for PhysicsFS.
+ *
+ * Please see the file LICENSE.txt in the source's root directory.
+ *
+ *  This file written by Ryan C. Gordon.
+ */
+
+#define __PHYSICSFS_INTERNAL__
+#include "physfs_platforms.h"
+
+#ifdef PHYSFS_PLATFORM_PLAYDATE
+
+#include "pd_api.h"
+
+#include "physfs_internal.h"
+
+static PlaydateAPI *playdate = NULL;
+
+/* Playdate interpolates a separate write dir on top of a read-only
+   base dir, so put the "user" dir somewhere deeper in the tree
+   so they don't overlap, so PhysicsFS can manage this like apps
+   expect. */
+#define WRITABLE_DIRNAME ".$PHYSFSWRITE$"
+
+
+static void *playdateAllocatorMalloc(PHYSFS_uint64 s);
+static void *playdateAllocatorRealloc(void *ptr, PHYSFS_uint64 s);
+static void playdateAllocatorFree(void *ptr);
+
+int __PHYSFS_platformInit(const char *argv0)
+{
+    /* as a cheat, we expect argv0 to be a PlaydateAPI* on Playdate. */
+    playdate = (PlaydateAPI *) argv0;
+
+    allocator.Init = NULL;
+    allocator.Deinit = NULL;
+    allocator.Malloc = playdateAllocatorMalloc;
+    allocator.Realloc = playdateAllocatorRealloc;
+    allocator.Free = playdateAllocatorFree;
+
+    return 1;  /* ready to go! */
+}
+
+void __PHYSFS_platformDeinit(void)
+{
+    playdate = NULL;
+}
+
+void __PHYSFS_platformDetectAvailableCDs(PHYSFS_StringCallback cb, void *data)
+{
+    /* obviously no CD-ROM drives on Playdate */
+}
+
+char *__PHYSFS_platformCalcBaseDir(const char *argv0)
+{
+    return __PHYSFS_strdup("/");
+}
+
+char *__PHYSFS_platformCalcUserDir(void)
+{
+    return __PHYSFS_strdup("/" WRITABLE_DIRNAME "/");
+}
+
+char *__PHYSFS_platformCalcPrefDir(const char *org, const char *app)
+{
+    const size_t slen = strlen(org) + strlen(app) + strlen(WRITABLE_DIRNAME) + 5;
+    char *retval = (char *) allocator.Malloc(slen);
+    BAIL_IF(!retval, PHYSFS_ERR_OUT_OF_MEMORY, NULL);
+    snprintf(retval, slen, "/" WRITABLE_DIRNAME "/%s/%s/", org, app);
+    return retval;
+}
+
+typedef struct listfiles_callback_data
+{
+    PHYSFS_EnumerateCallback callback;
+    const char *origdir;
+    void *callbackdata;
+    PHYSFS_EnumerateCallbackResult retval;
+} listfiles_callback_data;
+
+static void listfiles_callback(const char *path, void *userdata)
+{
+    listfiles_callback_data *data = (listfiles_callback_data *) userdata;
+    if (data->retval == PHYSFS_ENUM_OK) {
+        const char *od = data->origdir;
+        if (path[0] == '.') {  /* ignore "." and ".." */
+            if ((path[1] == '\0') || ((path[1] == '.') && (path[2] == '\0'))) {
+                return;
+            }
+        }
+        if ((*od == '\0') || ((od[0] == '/') && (od[1] == '\0'))) {
+            /* don't list our separated write dir when enumerating. */
+            if (strcmp(path, WRITABLE_DIRNAME) == 0) {
+                return;
+            }
+        }
+
+        data->retval = data->callback(data->callbackdata, data->origdir, path);
+    }
+}
+
+PHYSFS_EnumerateCallbackResult __PHYSFS_platformEnumerate(const char *dirname,
+                               PHYSFS_EnumerateCallback callback,
+                               const char *origdir, void *callbackdata)
+{                                        
+    listfiles_callback_data data;
+    data.callback = callback;
+    data.origdir = origdir;
+    data.callbackdata = callbackdata;
+    data.retval = PHYSFS_ENUM_OK;
+    if (playdate->file->listfiles(dirname, listfiles_callback, &data, 1) == -1) {
+        data.retval = PHYSFS_ENUM_ERROR;
+        PHYSFS_setErrorCode(PHYSFS_ERR_OS_ERROR);
+    } else if (data.retval == PHYSFS_ENUM_ERROR) {
+        PHYSFS_setErrorCode(PHYSFS_ERR_APP_CALLBACK);
+    }
+
+    return data.retval;
+}
+
+int __PHYSFS_platformMkDir(const char *filename)
+{
+    BAIL_IF(playdate->file->mkdir(filename) == -1, PHYSFS_ERR_OS_ERROR, 0);
+    return 1;
+}
+
+void *__PHYSFS_platformOpenRead(const char *filename)
+{
+    SDFile *sdf = playdate->file->open(filename, kFileRead|kFileReadData);
+    BAIL_IF(!sdf, PHYSFS_ERR_OS_ERROR, NULL);
+    return sdf;
+}
+
+void *__PHYSFS_platformOpenWrite(const char *filename)
+{
+    SDFile *sdf = playdate->file->open(filename, kFileWrite);
+    BAIL_IF(!sdf, PHYSFS_ERR_OS_ERROR, NULL);
+    return sdf;
+}
+
+void *__PHYSFS_platformOpenAppend(const char *filename)
+{
+    SDFile *sdf = playdate->file->open(filename, kFileAppend);
+    BAIL_IF(!sdf, PHYSFS_ERR_OS_ERROR, NULL);
+    return sdf;
+}
+
+PHYSFS_sint64 __PHYSFS_platformRead(void *opaque, void *buf, PHYSFS_uint64 len)
+{
+    int rc;
+    BAIL_IF(!__PHYSFS_ui64FitsAddressSpace(len),PHYSFS_ERR_INVALID_ARGUMENT,-1);
+    rc = playdate->file->read((SDFile *) opaque, buf, (unsigned int) len);
+    BAIL_IF(rc == -1, PHYSFS_ERR_OS_ERROR, -1);
+    return (PHYSFS_sint64) rc;
+}
+
+PHYSFS_sint64 __PHYSFS_platformWrite(void *opaque, const void *buf,
+                                     PHYSFS_uint64 len)
+{
+    int rc;
+    BAIL_IF(!__PHYSFS_ui64FitsAddressSpace(len),PHYSFS_ERR_INVALID_ARGUMENT,-1);
+    rc = playdate->file->write((SDFile *) opaque, buf, (unsigned int) len);
+    BAIL_IF(rc == -1, PHYSFS_ERR_OS_ERROR, -1);
+    return (PHYSFS_sint64) rc;
+}
+
+int __PHYSFS_platformSeek(void *opaque, PHYSFS_uint64 pos)
+{
+    const int ipos = (int) pos;
+    int rc;
+
+    /* hooray for 32-bit filesystem limits!  :) */
+    BAIL_IF(((PHYSFS_uint64) ipos) != pos, PHYSFS_ERR_INVALID_ARGUMENT, 0);
+
+    rc = playdate->file->seek((SDFile *) opaque, ipos, SEEK_SET);
+    BAIL_IF(rc == -1, PHYSFS_ERR_OS_ERROR, 0);
+    return 1;
+}
+
+PHYSFS_sint64 __PHYSFS_platformTell(void *opaque)
+{
+    const int pos = playdate->file->tell((SDFile *) opaque);
+    BAIL_IF(pos == -1, PHYSFS_ERR_OS_ERROR, -1);
+    return (PHYSFS_sint64) pos;
+}
+
+PHYSFS_sint64 __PHYSFS_platformFileLength(void *opaque)
+{
+    SDFile *sdf = (SDFile *) opaque;
+    const int pos = playdate->file->tell(sdf);
+    int retval;
+
+    BAIL_IF(pos == -1, PHYSFS_ERR_OS_ERROR, -1);
+    BAIL_IF(playdate->file->seek(sdf, 0, SEEK_END) == -1, PHYSFS_ERR_OS_ERROR, -1);
+    retval = playdate->file->tell(sdf);
+    BAIL_IF(playdate->file->seek(sdf, pos, SEEK_CUR) == -1, PHYSFS_ERR_OS_ERROR, -1);
+    BAIL_IF(retval == -1, PHYSFS_ERR_OS_ERROR, -1);
+    return (PHYSFS_sint64) retval;
+}
+
+int __PHYSFS_platformFlush(void *opaque)
+{
+    BAIL_IF(playdate->file->flush((SDFile *) opaque) == -1, PHYSFS_ERR_OS_ERROR, 0);
+    return 1;
+}
+
+void __PHYSFS_platformClose(void *opaque)
+{
+    playdate->file->close((SDFile *) opaque);  /* ignore errors. You should have flushed! */
+}
+
+int __PHYSFS_platformDelete(const char *path)
+{
+    BAIL_IF(playdate->file->unlink(path, 0) == -1, PHYSFS_ERR_OS_ERROR, 0);
+    return 1;
+}
+
+
+/* Convert to a format PhysicsFS can grok... */
+static PHYSFS_sint64 playdateTimeToUnixTime(FileStat *statbuf)
+{
+    return 10;  /* !!! FIXME: calculate the time in seconds, adjust for leap years and the Unix epoch. */
+}
+
+int __PHYSFS_platformStat(const char *filename, PHYSFS_Stat *st, const int follow)
+{
+    FileStat statbuf;
+    const int rc = playdate->file->stat(filename, &statbuf);
+    BAIL_IF(rc == -1, PHYSFS_ERR_OS_ERROR, 0);
+
+    st->filesize = (PHYSFS_sint64) statbuf.size;
+	st->modtime = st->createtime = playdateTimeToUnixTime(&statbuf);
+	st->accesstime = -1;
+    st->filetype = statbuf.isdir ? PHYSFS_FILETYPE_DIRECTORY : PHYSFS_FILETYPE_REGULAR;
+    st->readonly = (strncmp(filename, "/" WRITABLE_DIRNAME, strlen("/" WRITABLE_DIRNAME)) == 0) ? 1 : 0;
+
+    return 1;
+}
+
+void *__PHYSFS_platformGetThreadID(void)
+{
+    return (void *) (size_t) 0x1;  /* !!! FIXME: does Playdate have threads? */
+}
+
+void *__PHYSFS_platformCreateMutex(void)
+{
+    return (void *) (size_t) 0x1;  /* !!! FIXME: does Playdate have threads? */
+}
+
+void __PHYSFS_platformDestroyMutex(void *mutex)
+{
+}
+
+int __PHYSFS_platformGrabMutex(void *mutex)
+{
+    return 1;
+}
+
+void __PHYSFS_platformReleaseMutex(void *mutex)
+{
+}
+
+
+#undef realloc
+
+static void *playdateAllocatorMalloc(PHYSFS_uint64 s)
+{
+    BAIL_IF(!__PHYSFS_ui64FitsAddressSpace(s), PHYSFS_ERR_OUT_OF_MEMORY, NULL);
+    return playdate->system->realloc(NULL, (size_t) s);
+}
+
+static void *playdateAllocatorRealloc(void *ptr, PHYSFS_uint64 s)
+{
+    BAIL_IF(!__PHYSFS_ui64FitsAddressSpace(s), PHYSFS_ERR_OUT_OF_MEMORY, NULL);
+    return playdate->system->realloc(ptr, (size_t) s);
+}
+
+static void playdateAllocatorFree(void *ptr)
+{
+    playdate->system->realloc(ptr, 0);
+}
+
+
+#endif  /* PHYSFS_PLATFORM_PLAYDATE */
+
+/* end of physfs_platform_playdate.c ... */

+ 1 - 1
physfs.mod/physfs/src/physfs_platform_qnx.c

@@ -20,7 +20,7 @@
 
 #include "physfs_internal.h"
 
-int __PHYSFS_platformInit(void)
+int __PHYSFS_platformInit(const char *argv0)
 {
     return 1;  /* always succeed. */
 } /* __PHYSFS_platformInit */

+ 11 - 7
physfs.mod/physfs/src/physfs_platform_unix.c

@@ -60,7 +60,7 @@
 
 #include "physfs_internal.h"
 
-int __PHYSFS_platformInit(void)
+int __PHYSFS_platformInit(const char *argv0)
 {
     return 1;  /* always succeed. */
 } /* __PHYSFS_platformInit */
@@ -261,12 +261,6 @@ char *__PHYSFS_platformCalcBaseDir(const char *argv0)
         if (sysctl(mib, 4, fullpath, &buflen, NULL, 0) != -1)
             retval = __PHYSFS_strdup(fullpath);
     }
-    #elif defined(PHYSFS_PLATFORM_SOLARIS)
-    {
-        const char *path = getexecname();
-        if ((path != NULL) && (path[0] == '/'))  /* must be absolute path... */
-            retval = __PHYSFS_strdup(path);
-    }
     #endif
 
     /* If there's a Linux-like /proc filesystem, you can get the full path to
@@ -278,6 +272,7 @@ char *__PHYSFS_platformCalcBaseDir(const char *argv0)
         retval = readSymLink("/proc/self/exe");
         if (!retval) retval = readSymLink("/proc/curproc/file");
         if (!retval) retval = readSymLink("/proc/curproc/exe");
+        if (!retval) retval = readSymLink("/proc/self/path/a.out");
         if (retval == NULL)
         {
             /* older kernels don't have /proc/self ... try PID version... */
@@ -289,6 +284,15 @@ char *__PHYSFS_platformCalcBaseDir(const char *argv0)
         } /* if */
     } /* if */
 
+    #if defined(PHYSFS_PLATFORM_SOLARIS)
+    if (!retval)  /* try getexecname() if /proc didn't pan out. This may not be an absolute path! */
+    {
+        const char *path = getexecname();
+        if ((path != NULL) && (path[0] == '/'))  /* must be absolute path... */
+            retval = __PHYSFS_strdup(path);
+    } /* if */
+    #endif
+
     if (retval != NULL)  /* chop off filename. */
     {
         char *ptr = strrchr(retval, '/');

+ 2 - 2
physfs.mod/physfs/src/physfs_platform_windows.c

@@ -123,7 +123,7 @@ static inline HANDLE winCreateFileW(const WCHAR *wfname, const DWORD mode,
                                     const DWORD creation)
 {
     const DWORD share = FILE_SHARE_READ | FILE_SHARE_WRITE;
-    #if defined(PHYSFS_PLATFORM_WINRT) || (_WIN32_WINNT >= 0x0602) // Windows 8+
+    #if defined(PHYSFS_PLATFORM_WINRT) // also available if targeting Windows 8+ || (_WIN32_WINNT >= 0x0602) - but do not include this for now, due to common toolchain defaults
     return CreateFile2(wfname, mode, share, creation, NULL);
     #else
     return CreateFileW(wfname, mode, share, NULL, creation,
@@ -613,7 +613,7 @@ done:
 } /* __PHYSFS_platformCalcUserDir */
 
 
-int __PHYSFS_platformInit(void)
+int __PHYSFS_platformInit(const char *argv0)
 {
     return 1;  /* It's all good */
 } /* __PHYSFS_platformInit */

+ 8 - 2
physfs.mod/physfs/src/physfs_platforms.h

@@ -12,7 +12,10 @@
  *  PHYSFS_PLATFORM_UNIX on that system.
  */
 
-#if (defined __HAIKU__)
+#if defined(TARGET_EXTENSION) && (defined(TARGET_PLAYDATE) || defined(TARGET_SIMULATOR))
+#  define PHYSFS_PLATFORM_PLAYDATE 1
+#  define PHYSFS_NO_CRUNTIME_MALLOC 1
+#elif (defined __HAIKU__)
 #  define PHYSFS_PLATFORM_HAIKU 1
 #  define PHYSFS_PLATFORM_POSIX 1
 #elif ((defined __BEOS__) || (defined __beos__))
@@ -45,7 +48,7 @@
  #  define PHYSFS_PLATFORM_ANDROID 1
  #  define PHYSFS_PLATFORM_POSIX 1
  #  define PHYSFS_NO_CDROM_SUPPORT 1
-#elif defined(__linux__)
+#elif defined(__linux)
 #  define PHYSFS_PLATFORM_LINUX 1
 #  define PHYSFS_PLATFORM_UNIX 1
 #  define PHYSFS_PLATFORM_POSIX 1
@@ -72,6 +75,9 @@
 #elif defined(unix) || defined(__unix__)
 #  define PHYSFS_PLATFORM_UNIX 1
 #  define PHYSFS_PLATFORM_POSIX 1
+#elif defined(__wii__) || defined(__gamecube__)
+#  define PHYSFS_PLATFORM_OGC 1
+#  define PHYSFS_NO_CDROM_SUPPORT 1 // TODO
 #else
 #  error Unknown platform.
 #endif

+ 3 - 3
physfs.mod/physfs/src/physfs_unicode.c

@@ -442,10 +442,10 @@ int PHYSFS_caseFold(const PHYSFS_uint32 from, PHYSFS_uint32 *to)
     if (from < 128)  /* low-ASCII, easy! */
     {
         if ((from >= 'A') && (from <= 'Z'))
+        {
             *to = from - ('A' - 'a');
-        else
-            *to = from;
-        return 1;
+            return 1;
+        } /* if */
     } /* if */
 
     else if (from <= 0xFFFF)

+ 89 - 3
physfs.mod/physfs/test/test_physfs.c

@@ -380,6 +380,86 @@ static int cmd_enumerate(char *args)
     return 1;
 } /* cmd_enumerate */
 
+#define STR_BOX_VERTICAL_RIGHT  "\xe2\x94\x9c"
+#define STR_BOX_VERTICAL        "\xe2\x94\x82"
+#define STR_BOX_HORIZONTAL      "\xe2\x94\x80"
+#define STR_BOX_UP_RIGHT        "\xe2\x94\x94"
+#define STR_NBSP                "\xc2\xa0"
+
+#define PREFIX_DIRENTRY         STR_BOX_VERTICAL_RIGHT  STR_BOX_HORIZONTAL  STR_BOX_HORIZONTAL  STR_NBSP
+#define PREFIX_DIRENTRY_LAST    STR_BOX_UP_RIGHT        STR_BOX_HORIZONTAL  STR_BOX_HORIZONTAL  STR_NBSP
+#define PREFIX_RECURSIVE        STR_BOX_VERTICAL        STR_NBSP            STR_NBSP            STR_NBSP
+#define PREFIX_RECURSIVE_LAST   STR_NBSP                STR_NBSP            STR_NBSP            STR_NBSP
+
+static void cmd_tree_recursive(const char *prefix, const char *fullPath, const char *name, unsigned depth, int *total_dir_count, int *total_file_count) {
+    char **rc;
+
+    printf("%s", name);
+    rc = PHYSFS_enumerateFiles(fullPath);
+
+    if (rc == NULL) {
+        printf(" [Failure. reason: %s]\n", PHYSFS_getLastError());
+    }
+    else
+    {
+        int file_count;
+        char **i;
+        printf("\n");
+        for (i = rc, file_count = 0; *i != NULL; i++, file_count++) {
+            char *newFullPath = malloc(strlen(fullPath) + strlen(*i) + 2);
+            char *thisPrefix;
+            strcpy(newFullPath, fullPath);
+            strcat(newFullPath, "/");
+            strcat(newFullPath, *i);
+            if (i[1]) {
+                thisPrefix = PREFIX_DIRENTRY;
+            } else {
+                thisPrefix = PREFIX_DIRENTRY_LAST;
+            }
+            if (PHYSFS_isSymbolicLink(newFullPath)) {
+                printf("%s%s%s [symbolic link]\n", prefix, thisPrefix, *i);
+            } else if (PHYSFS_isDirectory(newFullPath)) {
+                char *newPrefix;
+                *total_dir_count += 1;
+                if (i[1]) {
+                    newPrefix = malloc(strlen(prefix) + strlen(PREFIX_RECURSIVE) + 1);
+                    strcpy(newPrefix, prefix);
+                    strcat(newPrefix, PREFIX_RECURSIVE);
+                } else {
+                    newPrefix = malloc(strlen(prefix) + strlen(PREFIX_RECURSIVE_LAST) + 1);
+                    strcpy(newPrefix, prefix);
+                    strcat(newPrefix, PREFIX_RECURSIVE_LAST);
+                }
+                printf("%s%s", prefix, thisPrefix);
+                cmd_tree_recursive(newPrefix, newFullPath, *i, depth + 1, total_dir_count, total_file_count);
+                free(newPrefix);
+            } else {
+                *total_file_count += 1;
+                printf("%s%s%s\n", prefix, thisPrefix, *i);
+            }
+            free(newFullPath);
+        }
+        PHYSFS_freeList(rc);
+    } /* else */
+} /* cmd_tree_recursive */
+
+
+static int cmd_tree(char *args)
+{
+    int total_dir_count = 0, total_file_count = 0; /* FIXME: should be PHYSFS_uint64 */
+
+    if (*args == '\"')
+    {
+        args++;
+        args[strlen(args) - 1] = '\0';
+    } /* if */
+
+    cmd_tree_recursive("", args, args, 0, &total_dir_count, &total_file_count);
+
+    printf("\n%d directories, %d files\n", total_dir_count, total_file_count);
+    return 1;
+} /* cmd_enumerate */
+
 
 static int cmd_getdirsep(char *args)
 {
@@ -1359,6 +1439,7 @@ static const command_info commands[] =
     { "unmount",        cmd_removearchive,  1, "<archiveLocation>"          },
     { "enumerate",      cmd_enumerate,      1, "<dirToEnumerate>"           },
     { "ls",             cmd_enumerate,      1, "<dirToEnumerate>"           },
+    { "tree",           cmd_tree,           1, "<dirToEnumerate>"           },
     { "getlasterror",   cmd_getlasterror,   0, NULL                         },
     { "getdirsep",      cmd_getdirsep,      0, NULL                         },
     { "getcdromdirs",   cmd_getcdromdirs,   0, NULL                         },
@@ -1566,7 +1647,8 @@ static void open_history_file(void)
 int main(int argc, char **argv)
 {
     char *buf = NULL;
-    int rc = 0;
+    int rc = 1;
+    int i;
 
 #if (defined __MWERKS__)
     extern tSIOUXSettings SIOUXSettings;
@@ -1592,7 +1674,11 @@ int main(int argc, char **argv)
     printf("Enter commands. Enter \"help\" for instructions.\n");
     fflush(stdout);
 
-    do
+    for (i = 1; i < argc && rc; i++) {
+        rc = process_command(argv[i]);
+    }
+
+    while (rc)
     {
 #if (defined PHYSFS_HAVE_READLINE)
         buf = readline("> ");
@@ -1631,7 +1717,7 @@ int main(int argc, char **argv)
         fflush(stdout);
         if (buf != NULL)
             free(buf);
-    } while (rc);
+    }
 
     if (!PHYSFS_deinit())
         printf("PHYSFS_deinit() failed!\n  reason: %s.\n", PHYSFS_getLastError());

Bu fark içinde çok fazla dosya değişikliği olduğu için bazı dosyalar gösterilmiyor