• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!

Android Wifi is loading a save file?

SubWolf

Member
Hello,

I'm having a strange problem that I don't have a clue what is causing it...

I have a script to LOAD my game data from a file (let's say the file name is "save.sav"), when the game starts I have an object that checks if the file exists:

if (file_exists(working_directory + "save.sav")) load();

When I'm testing using Windows as target I know the file is in the folder "C:\Users\USERNAME\AppData\Local\GAMENAME"... so I erase it when I do changes on this LOAD script ( or the SAVE on too). And when I start the game again it doesn't find the file, so it initiate the variables normally... until this point everything is working fine.

The real problem is when I'm testing using Android as target (I'm connecting my mobile using USB)... the thing is that when I'm NOT CONNECTED TO WIFI the game starts as it was the first time it was starting and everything works great... but when I'm CONNECTED TO WIFI for some reason it finds the "save.sav" file, the IF statement returns true and it tries to load the file, but as I did some modifications of the LOAD script it returns me an error and the game crashes.

-> I already scanned my entire phone;
-> I used functions like: filename_dir(), filename_drive() and filename_path() to look for the file and I don't find it anywhere on my mobile;
-> I don't think there's really a file on my mobile, if there was it should be loaded when my WIFI is not connected (which not occurs);
-> Again, it only finds the file when my WIFI IS CONNECTED.
 

TailBit

Member
Try display where the working_directory is pointing to when it is/isn't connected?

Does the first read fail? Or does it crash when it handles the unexpected data wrong?

This is a bit strange indeed.

EDIT: could try finding the file with file_find_first instead?
 
Last edited:

SubWolf

Member
First, thanks for the reply.

I tried to display the working_directory but only when connected... I'll try the 2 ways and comment here.

It crashes when handle the unexpected data wrong... 'cause I did some changes on the LOAD script and is trying to load some data that didn't exist on this saved file version.

I'll see the file_find_first to see if there's any difference.
 

SubWolf

Member
So, sorry for taking so long...

Finally tested the "working_directory" thing connected and not connected to WIFI, here what I got...

CONNECTED:
working_directory = assets/
program_directory = /
temp_directory = /data/user/0/com.wolfpack.jewellord/cache/

file_find_first(working_directory + "*.svr", 0) = "ddsrgs.svr"

NOT CONNECTED:
working_directory = assets/
program_directory = /
temp_directory = /data/user/0/com.wolfpack.jewellord/cache/

file_find_first(working_directory + "*.svr", 0) = ""

----------------------------------------
As you can see, either working_directory, program_directory and temp_directory returns the same thing connected or not connected... and I still can't understand WHY it finds the file when it's connected to wifi and it doesn't when it's not connected!
Please... I need help with this... =(
 
Top