Updating of the game made in MonkeyX on new assembly in CerberusX.

Leonid64

New member
Joined
Jan 11, 2018
Messages
19
Hello.
I apologize for my bad English.
I have a problem and I hope for your help.
There is a game created on MonkeyX and placed in GooglePlay.
For preservation and reading settings and records I used SaveState () and LoadState ()
I have transferred a game to CerberusX. After assembly the application works. But, after updating of the application version collected in MonkeyX on the version collected in CerberusX, data which have been kept in the version collected in MonkeyX aren't read. Whether it is possible to make so that after the updating of the application which is earlier created in MonkeyX on the assemblies created in CerberusX earlier kept data were read.
Thanks.
 

MikeHart

Administrator
Joined
Jun 19, 2017
Messages
3,208
The state name that is used for LoadState and SaveState was changed when we rebranded Monkey X to Cerberus X. To use the same state name like monkey, you need to dig into the android target and change cerberusstate to monkeystate in the targets/android/modules/native/androidgame.java file:

upload_2018-1-11_18-21-21.png
 

Leonid64

New member
Joined
Jan 11, 2018
Messages
19
I have made everything as you have written to me, but hasn't helped. The application couldn't read data the kept version made in MonkeyX. Likely there is a problem somewhere else?
 

MikeHart

Administrator
Joined
Jun 19, 2017
Messages
3,208
Sorry, I made you change something that isn't used anymore. I just saw that it uses the SaveState_V66b and LoadState_V66b.
These were not changed. But my Android knowledge atm isn't so good that I can tell you if your problem can easily be fixed from your side.
I have a feeling it has something to do with _androidGame._activity.getPreferences( 0 ); When I find out more, I will post here.
 

York

New member
Patreon Bronze
Joined
Jul 5, 2017
Messages
24
Today I had the same problem.

getPreference() uses as filename the activity name. In Monkey the main activity was called "MonkeyGame" and now its called "CerberusGame". To load the old state you need to update your LoadState() / SaveState() method.

use:
Code:
SharedPreferences prefs=_activity.getSharedPreferences( "MonkeyGame",0 );
String state=prefs.getString( ".monkeystate","" );

instead of:
Code:
SharedPreferences prefs=_activity.getPreferences( 0 );
String state=prefs.getString( ".cerberusstate","" );
 
Top Bottom