Initialize nacl_io, removes SDL_NaClMount/Umount It's just easier to use nacl_io's mount/umount directly.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115
diff --git a/README-nacl.txt b/README-nacl.txt
index 0d58f20..d868e91 100644
--- a/README-nacl.txt
+++ b/README-nacl.txt
@@ -60,18 +60,17 @@ script will give you instructions on how to do that with Python).
RWops and nacl_io
================================================================================
-SDL_RWops work transparently with nacl_io. Two functions are provided to control
-mount points:
+SDL_RWops work transparently with nacl_io. Two functions control the mount points:
- int SDL_NaClMount(const char* source, const char* target,
+ int mount(const char* source, const char* target,
const char* filesystemtype,
unsigned long mountflags, const void *data);
- int SDL_NaClUmount(const char *target);
+ int umount(const char *target);
For convenience, SDL will by default mount an httpfs tree at / before calling
the app's main function. Such setting can be overridden by calling:
- SDL_NaClUmount("/");
+ umount("/");
And then mounting a different filesystem at /
@@ -85,6 +84,17 @@ connections are involved.
For more information on how nacl_io and mount points work, see:
https://developer.chrome.com/native-client/devguide/coding/nacl_io
+ https://src.chromium.org/chrome/trunk/src/native_client_sdk/src/libraries/nacl_io/nacl_io.h
+
+To be able to save into the directory "/save/" (like backup of game) :
+
+ mount("", "/save", "html5fs", 0, "type=PERSISTENT");
+
+And add to manifest.json :
+
+ "permissions": [
+ "unlimitedStorage"
+ ]
================================================================================
TODO - Known Issues
diff --git a/build-scripts/naclbuild.sh b/build-scripts/naclbuild.sh
index 5621806..717e717 100755
--- a/build-scripts/naclbuild.sh
+++ b/build-scripts/naclbuild.sh
@@ -1,6 +1,6 @@
#!/bin/bash
if [ -z "$1" ] && [ -z "$NACL_SDK_ROOT" ]; then
- echo "Usage: ./naclbuild ~/nacl/pepper_33"
+ echo "Usage: ./naclbuild ~/nacl/pepper_35"
echo "This will build SDL for Native Client, and testgles2.c as a demo"
echo "You can set env vars CC, AR, LD and RANLIB to override the default PNaCl toolchain used"
echo "You can set env var SOURCES to select a different source file than testgles2.c"
diff --git a/include/SDL_system.h b/include/SDL_system.h
index dcca8f3..78d5b0d 100644
--- a/include/SDL_system.h
+++ b/include/SDL_system.h
@@ -179,23 +179,6 @@ extern DECLSPEC const char * SDLCALL SDL_WinRTGetFSPathUTF8(SDL_WinRT_Path pathT
#endif /* __WINRT__ */
-#ifdef __NACL__
-
-/**
- * \name Mount/umount functions
- *
- * Required for RWOps on Native Client
- */
-/* @{ */
-extern DECLSPEC int SDLCALL SDL_NaClMount(const char* source, const char* target,
- const char* filesystemtype,
- unsigned long mountflags, const void *data);
-
-extern DECLSPEC int SDLCALL SDL_NaClUmount(const char *target);
-
-#endif /* __NACL__ */
-
-
/* Ends C function definitions when using C++ */
#ifdef __cplusplus
}
diff --git a/src/main/nacl/SDL_nacl_main.c b/src/main/nacl/SDL_nacl_main.c
index efa2d37..80dea3b 100644
--- a/src/main/nacl/SDL_nacl_main.c
+++ b/src/main/nacl/SDL_nacl_main.c
@@ -24,11 +24,11 @@
/* Include the SDL main definition header */
#include "SDL_main.h"
-#include "SDL_system.h"
#include "ppapi_simple/ps_main.h"
#include "ppapi_simple/ps_event.h"
#include "ppapi_simple/ps_interface.h"
+#include "nacl_io/nacl_io.h"
extern void NACL_SetScreenResolution(int width, int height, Uint32 format);
@@ -69,8 +69,10 @@ nacl_main(int argc, char *argv[])
* apps can override this by unmounting /
* and remounting with the desired configuration
*/
- SDL_NaClUmount("/");
- SDL_NaClMount(
+ nacl_io_init_ppapi(PSGetInstanceId(), PSGetInterface);
+
+ umount("/");
+ mount(
"", /* source */
"/", /* target */
"httpfs", /* filesystemtype */