How to save and load? [Android-SDL2]

A project to port LÖVE to Android handhelds
Locked
TheWaffleDimension
Prole
Posts: 14
Joined: Wed Dec 02, 2015 11:14 pm

How to save and load? [Android-SDL2]

Post by TheWaffleDimension » Sat Dec 19, 2015 1:07 am

I need to know how to save and load files using Martin Fellis's android sdl. I know I have to do something with the identity in the config, but I'm not sure what.

User avatar
Kasperelo
Party member
Posts: 343
Joined: Fri Apr 13, 2012 1:47 pm
Location: The Milky Way

Re: How to save and load? [Android-SDL2]

Post by Kasperelo » Wed Dec 30, 2015 12:59 pm

Yeah, I also need to know this, but I can't find it anywhere :huh:
I need to add unlocks and highscore to my game, so I need to be able to write and read files.

bobbyjones
Party member
Posts: 664
Joined: Sat Apr 26, 2014 7:46 pm

Re: How to save and load? [Android-SDL2]

Post by bobbyjones » Wed Dec 30, 2015 2:15 pm

It should be the same as desktop love. Does it not work?

User avatar
Kasperelo
Party member
Posts: 343
Joined: Fri Apr 13, 2012 1:47 pm
Location: The Milky Way

Re: How to save and load? [Android-SDL2]

Post by Kasperelo » Wed Dec 30, 2015 5:48 pm

Where are the files you can edit and read saved?

bobbyjones
Party member
Posts: 664
Joined: Sat Apr 26, 2014 7:46 pm

Re: How to save and load? [Android-SDL2]

Post by bobbyjones » Thu Dec 31, 2015 12:14 am

You can use https://love2d.org/wiki/love.filesystem ... eDirectory to find the save directory. Once you do please post you findings. I can't find on the Android wiki or love wiki where that save directory is. I need to add that to the wiki.

User avatar
Nixola
Inner party member
Posts: 1879
Joined: Tue Dec 06, 2011 7:11 pm
Location: Italy

Re: How to save and load? [Android-SDL2]

Post by Nixola » Thu Dec 31, 2015 12:34 am

On my system it's /data/user/0/org.love2d.android/files/save/? (where "?" is the identity or the name of the folder/.love); I wonder what happens for fused files with a different ID, would the path be the same with a different ID than org.love2d.android?
lf = love.filesystem
ls = love.sound
la = love.audio
lp = love.physics
lt = love.thread
li = love.image
lg = love.graphics

bobbyjones
Party member
Posts: 664
Joined: Sat Apr 26, 2014 7:46 pm

Re: How to save and load? [Android-SDL2]

Post by bobbyjones » Thu Dec 31, 2015 4:03 am

While I can find the save directory it seems the current way files are saved causes the files to be hidden in newer devices. So save functionality will work but you just won't be able to find the files you made.
https://bitbucket.org/MartinFelis/love- ... ether-save

bobbyjones
Party member
Posts: 664
Joined: Sat Apr 26, 2014 7:46 pm

Re: How to save and load? [Android-SDL2]

Post by bobbyjones » Sun Jan 03, 2016 1:39 am

I've made a PR to love which once it is accepted would make it possible for you to save your files externally rather than internally

Locked

Who is online

Users browsing this forum: No registered users and 3 guests