SDL_getbasepath

Hi it seems SDL_getBasePath() isn’t implemented on android atm
I found this doc:
https://hg.libsdl.org/SDL/file/8d826bc39a45/src/filesystem/android/SDL_sysfilesystem.c#l46

so I implemented it myself but with this test application I am getting back
this location: /data/data/org.libsdl.app/files/

that doesn’t seem to be the resources directory and even if i add an assets
directory and put my files in there, they are not copied over to that
location.

How can I get the location of the assets directory through SDL on android?

Hi,

as far as I understand the concept, “assets” are read-only files that are
bundled inside the app’s a.pk - i.e. they are not unpacked and thus the
assets do not form a “real” directory.

You can read assets in C via dedicated functions only, they cannot be
accessed via direct file IO. I don’t know whether SDL implements this
"special" Android behaviour for assets. If not, you can take a look at this
header file

#include <android/asset_manager.h>

in the Android NDK on how to open & read asset files.

Regards,

Daniel

---------- P?vodn? zpr?va ----------
Od: Owen Alanzo Hogarth
Komu: sdl at lists.libsdl.org
Datum: 17. 8. 2015 14:05:54
P?edm?t: [SDL] SDL_getbasepath

"

Hi it seems SDL_getBasePath() isn’t implemented on android atm
I found this doc:?https://hg.libsdl.org/SDL/file/8d826bc39a45/src/
filesystem/android/SDL_sysfilesystem.c#l46
(https://hg.libsdl.org/SDL/file/8d826bc39a45/src/filesystem/android/SDL_sysfilesystem.c#l46)

so I implemented it myself but with this test application I am getting back
this location: ?/data/data/org.libsdl.app/files/

that doesn’t seem to be the resources directory and even if i add an assets
directory and put my files in there, they are not copied over to that
location.

How can I get the location of the assets directory through SDL on android?_______________________________________________
SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org"

Thank you, using android

AAssetManager *mgr = AAssetManager_fromJava(env, assetManager);

worked out.On Mon, Aug 17, 2015 at 8:25 PM, hardcoredaniel wrote:

Hi,

as far as I understand the concept, “assets” are read-only files that are
bundled inside the app’s a.pk - i.e. they are not unpacked and thus the
assets do not form a “real” directory.

You can read assets in C via dedicated functions only, they cannot be
accessed via direct file IO. I don’t know whether SDL implements this
"special" Android behaviour for assets. If not, you can take a look at this
header file

#include <android/asset_manager.h>

in the Android NDK on how to open & read asset files.

Regards,

Daniel

---------- P?vodn? zpr?va ----------
Od: Owen Alanzo Hogarth <@Owen_Alanzo_Hogarth>
Komu: sdl at lists.libsdl.org
Datum: 17. 8. 2015 14:05:54
P?edm?t: [SDL] SDL_getbasepath

Hi it seems SDL_getBasePath() isn’t implemented on android atm
I found this doc:
https://hg.libsdl.org/SDL/file/8d826bc39a45/src/filesystem/android/SDL_sysfilesystem.c#l46

so I implemented it myself but with this test application I am getting
back this location: /data/data/org.libsdl.app/files/

that doesn’t seem to be the resources directory and even if i add an
assets directory and put my files in there, they are not copied over to
that location.

How can I get the location of the assets directory through SDL on android?


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

SDL_RW* functions also read from files in asset folder.Em seg, 17 de ago de 2015 ?s 16:46, Owen Alanzo Hogarth escreveu:

Thank you, using android

AAssetManager *mgr = AAssetManager_fromJava(env, assetManager);

worked out.

On Mon, Aug 17, 2015 at 8:25 PM, hardcoredaniel wrote:

Hi,

as far as I understand the concept, “assets” are read-only files that are
bundled inside the app’s a.pk - i.e. they are not unpacked and thus the
assets do not form a “real” directory.

You can read assets in C via dedicated functions only, they cannot be
accessed via direct file IO. I don’t know whether SDL implements this
"special" Android behaviour for assets. If not, you can take a look at this
header file

#include <android/asset_manager.h>

in the Android NDK on how to open & read asset files.

Regards,

Daniel

---------- P?vodn? zpr?va ----------
Od: Owen Alanzo Hogarth
Komu: sdl at lists.libsdl.org
Datum: 17. 8. 2015 14:05:54
P?edm?t: [SDL] SDL_getbasepath

Hi it seems SDL_getBasePath() isn’t implemented on android atm
I found this doc:
https://hg.libsdl.org/SDL/file/8d826bc39a45/src/filesystem/android/SDL_sysfilesystem.c#l46

so I implemented it myself but with this test application I am getting
back this location: /data/data/org.libsdl.app/files/

that doesn’t seem to be the resources directory and even if i add an
assets directory and put my files in there, they are not copied over to
that location.

How can I get the location of the assets directory through SDL on android?


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

@Leonardo

Do you have some sample code that you use with SDL_RW* functions? I would
prefer to keep things inside of SDL_* functions if at all possible.

Best,
OwenOn Tue, Aug 18, 2015 at 3:48 AM, Leonardo Guilherme < leonardo.guilherme at gmail.com> wrote:

SDL_RW* functions also read from files in asset folder.

Em seg, 17 de ago de 2015 ?s 16:46, Owen Alanzo Hogarth < @Owen_Alanzo_Hogarth> escreveu:

Thank you, using android

AAssetManager *mgr = AAssetManager_fromJava(env, assetManager);

worked out.

On Mon, Aug 17, 2015 at 8:25 PM, hardcoredaniel <hardcoredaniel at seznam.cz wrote:

Hi,

as far as I understand the concept, “assets” are read-only files that
are bundled inside the app’s a.pk - i.e. they are not unpacked and thus
the assets do not form a “real” directory.

You can read assets in C via dedicated functions only, they cannot be
accessed via direct file IO. I don’t know whether SDL implements this
"special" Android behaviour for assets. If not, you can take a look at this
header file

#include <android/asset_manager.h>

in the Android NDK on how to open & read asset files.

Regards,

Daniel

---------- P?vodn? zpr?va ----------
Od: Owen Alanzo Hogarth <@Owen_Alanzo_Hogarth>
Komu: sdl at lists.libsdl.org
Datum: 17. 8. 2015 14:05:54
P?edm?t: [SDL] SDL_getbasepath

Hi it seems SDL_getBasePath() isn’t implemented on android atm
I found this doc:
https://hg.libsdl.org/SDL/file/8d826bc39a45/src/filesystem/android/SDL_sysfilesystem.c#l46

so I implemented it myself but with this test application I am getting
back this location: /data/data/org.libsdl.app/files/

that doesn’t seem to be the resources directory and even if i add an
assets directory and put my files in there, they are not copied over to
that location.

How can I get the location of the assets directory through SDL on
android?


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

Well, you’d use SDL_RWFromFile(“file”), and if there’s a file in assets/
folder with that name, it will automagically open. Then you use it almost
as you would with stdio. The wiki page might have more info, but its really
a no brainer. Replace fopen/fclose/fread with SDL_RW* stuff and you’re set.

It is worth noticing that all SDL functions that open files (like
SDL_LoadBMP) use RWops by default, they should just work on android.

Here’s the wiki link: https://wiki.libsdl.org/SDL_RWops

HTH,
Leonardo.Em seg, 17 de ago de 2015 ?s 18:15, Owen Alanzo Hogarth escreveu:

@Leonardo

Do you have some sample code that you use with SDL_RW* functions? I would
prefer to keep things inside of SDL_* functions if at all possible.

Best,
Owen

On Tue, Aug 18, 2015 at 3:48 AM, Leonardo Guilherme < @Leonardo_Guilherme> wrote:

SDL_RW* functions also read from files in asset folder.

Em seg, 17 de ago de 2015 ?s 16:46, Owen Alanzo Hogarth < gurenchan at gmail.com> escreveu:

Thank you, using android

AAssetManager *mgr = AAssetManager_fromJava(env, assetManager);

worked out.

On Mon, Aug 17, 2015 at 8:25 PM, hardcoredaniel < hardcoredaniel at seznam.cz> wrote:

Hi,

as far as I understand the concept, “assets” are read-only files that
are bundled inside the app’s a.pk - i.e. they are not unpacked and
thus the assets do not form a “real” directory.

You can read assets in C via dedicated functions only, they cannot be
accessed via direct file IO. I don’t know whether SDL implements this
"special" Android behaviour for assets. If not, you can take a look at this
header file

#include <android/asset_manager.h>

in the Android NDK on how to open & read asset files.

Regards,

Daniel

---------- P?vodn? zpr?va ----------
Od: Owen Alanzo Hogarth
Komu: sdl at lists.libsdl.org
Datum: 17. 8. 2015 14:05:54
P?edm?t: [SDL] SDL_getbasepath

Hi it seems SDL_getBasePath() isn’t implemented on android atm
I found this doc:
https://hg.libsdl.org/SDL/file/8d826bc39a45/src/filesystem/android/SDL_sysfilesystem.c#l46

so I implemented it myself but with this test application I am getting
back this location: /data/data/org.libsdl.app/files/

that doesn’t seem to be the resources directory and even if i add an
assets directory and put my files in there, they are not copied over to
that location.

How can I get the location of the assets directory through SDL on
android?


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

Also, the satellite libraries (SDL_image, SDL_ttf, etc.) load files via
SDL_RWops, so they work right on Android as well.

Jonny DOn Tue, Aug 18, 2015 at 1:34 AM, Leonardo Guilherme < leonardo.guilherme at gmail.com> wrote:

Well, you’d use SDL_RWFromFile(“file”), and if there’s a file in assets/
folder with that name, it will automagically open. Then you use it almost
as you would with stdio. The wiki page might have more info, but its really
a no brainer. Replace fopen/fclose/fread with SDL_RW* stuff and you’re set.

It is worth noticing that all SDL functions that open files (like
SDL_LoadBMP) use RWops by default, they should just work on android.

Here’s the wiki link: https://wiki.libsdl.org/SDL_RWops

HTH,
Leonardo.

Em seg, 17 de ago de 2015 ?s 18:15, Owen Alanzo Hogarth < gurenchan at gmail.com> escreveu:

@Leonardo

Do you have some sample code that you use with SDL_RW* functions? I would
prefer to keep things inside of SDL_* functions if at all possible.

Best,
Owen

On Tue, Aug 18, 2015 at 3:48 AM, Leonardo Guilherme < leonardo.guilherme at gmail.com> wrote:

SDL_RW* functions also read from files in asset folder.

Em seg, 17 de ago de 2015 ?s 16:46, Owen Alanzo Hogarth < gurenchan at gmail.com> escreveu:

Thank you, using android

AAssetManager *mgr = AAssetManager_fromJava(env, assetManager);

worked out.

On Mon, Aug 17, 2015 at 8:25 PM, hardcoredaniel < hardcoredaniel at seznam.cz> wrote:

Hi,

as far as I understand the concept, “assets” are read-only files that
are bundled inside the app’s a.pk - i.e. they are not unpacked and
thus the assets do not form a “real” directory.

You can read assets in C via dedicated functions only, they cannot be
accessed via direct file IO. I don’t know whether SDL implements this
"special" Android behaviour for assets. If not, you can take a look at this
header file

#include <android/asset_manager.h>

in the Android NDK on how to open & read asset files.

Regards,

Daniel

---------- P?vodn? zpr?va ----------
Od: Owen Alanzo Hogarth
Komu: sdl at lists.libsdl.org
Datum: 17. 8. 2015 14:05:54
P?edm?t: [SDL] SDL_getbasepath

Hi it seems SDL_getBasePath() isn’t implemented on android atm
I found this doc:
https://hg.libsdl.org/SDL/file/8d826bc39a45/src/filesystem/android/SDL_sysfilesystem.c#l46

so I implemented it myself but with this test application I am getting
back this location: /data/data/org.libsdl.app/files/

that doesn’t seem to be the resources directory and even if i add an
assets directory and put my files in there, they are not copied over to
that location.

How can I get the location of the assets directory through SDL on
android?


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org