Skip to content

Commit

Permalink
Removed #MOJO_USE_MONKEYSTATE flag
Browse files Browse the repository at this point in the history
  • Loading branch information
MikeHart66 committed Mar 26, 2022
1 parent 46c5f76 commit ac33316
Show file tree
Hide file tree
Showing 13 changed files with 29 additions and 95 deletions.
11 changes: 6 additions & 5 deletions VERSIONS.TXT
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
***** v2022-03-14 *****
***** v2022-03-25 *****

FIX: [STDCPP] Added missing #MOJO_USE_MONKEYSTATE=false entry in config.cxs file of the target. (Author: MikeHart)
FIX: [TRANS] Adding content to Preprocessors vars used the wrong delimiter. (Author: Phil7)
MOD: [TRANSCC] Removed AGK Targets. They will become cutsom targets at one point. (Author: MikeHart)
MOD: [TRANSCC] Removed the following depreciated builders. PSM, XNA, FLASH, ANDROID_NDK, WINRT. (Author: MikeHart)
FIX: [CSERVER] Fixed xml mime type. (Author: MikeHart)
MOD: [TRANSCC] Depreciated AGK Targets. They will become cutsom targets at one point. (Author: MikeHart)
MOD: [TRANSCC] Depreciated the following depreciated builders. PSM, XNA, FLASH, ANDROID_NDK, WINRT. (Author: MikeHart)
MOD: [BRL.XML] Added Method GetElements:List<XmlElement>() to retrieve all root elements. (Author: MikeHart)
MOD: [example] Modified the brl.ReadXml example to show how to parse a XML struture. (Author: MikeHart)
MOD: [CERBERUSX] REMOVED #MOJO_USE_MONKEYSTATE=false Flag due to legal reasons. (Author: MikeHart)


KNOWN ISSUES:
Expand Down Expand Up @@ -50,7 +51,7 @@ NEW: [brl.xml] Added a XML module. (Author: MikeHart)
NEW: [brl.vec2d] Added a 2d vector module. (Author: MikeHart)
NEW: [mojo2] Added DrawList.DrawRoundedRect:Void(x:Float, y:Float, width:Float, height:Float, radius:Float=10, material:Material=Null). (Author: MikeHart)
NEW: [brl.events] Added an event handling module. (Author: MikeHart)
NEW: [mojo] Added #MOJO_USE_MONKEYSTATE=False to be able to switch to use old monkeystate.
NEW: [mojo] Added #MOJO_USE_MONKEYSTATE=False to be able to switch to use old monkeystate.


***** v2021-05-16 *****
Expand Down
2 changes: 0 additions & 2 deletions docs/cerberusdoc/Programming/App config settings.cerberusdoc
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,6 @@ The following app config settings are currently supported:

'Mojo settings, defaults shown
'
#MOJO_USE_MONKEYSTATE=False 'Set to True to use monkeystate instead of cerberusstate
'to save app data
#MOJO_AUTO_SUSPEND_ENABLED=True 'Set to True to cause app to suspend when desktop window loses focus.
#MOJO_HICOLOR_TEXTURES=True
#MOJO_IMAGE_FILTERING_ENABLED=True
Expand Down
33 changes: 8 additions & 25 deletions modules/brl/native/gametarget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -188,37 +188,20 @@ void BBGame::GetDate( Array<int> date ){
}

int BBGame::SaveState( String state ){
if( CFG_MOJO_USE_MONKEYSTATE ){
if( FILE *f=OpenFile( "./.monkeystate","wb" ) ){
bool ok=state.Save( f );
fclose( f );
return ok ? 0 : -2;
}
}else{
if( FILE *f=OpenFile( "./.cerberusstate","wb" ) ){
bool ok=state.Save( f );
fclose( f );
return ok ? 0 : -2;
}
if( FILE *f=OpenFile( "./.cerberusstate","wb" ) ){
bool ok=state.Save( f );
fclose( f );
return ok ? 0 : -2;
}
return -1;
}

String BBGame::LoadState(){
if( CFG_MOJO_USE_MONKEYSTATE ){
if( FILE *f=OpenFile( "./.monkeystate","rb" ) ){
String str=String::Load( f );
fclose( f );
return str;
}
}else{
if( FILE *f=OpenFile( "./.cerberusstate","rb" ) ){
String str=String::Load( f );
fclose( f );
return str;
}
if( FILE *f=OpenFile( "./.cerberusstate","rb" ) ){
String str=String::Load( f );
fclose( f );
return str;
}

return "";
}

Expand Down
12 changes: 2 additions & 10 deletions modules/brl/native/gametarget.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,20 +98,12 @@ BBGame.prototype.GetDate=function( date ){
}

BBGame.prototype.SaveState=function( state ){
if( CFG_MOJO_USE_MONKEYSTATE=="1" ){
localStorage.setItem( "monkeystate@"+document.URL,state ); //key can't start with dot in Chrome!
}else{
localStorage.setItem( "cerberusstate@"+document.URL,state ); //key can't start with dot in Chrome!
}
localStorage.setItem( "cerberusstate@"+document.URL,state ); //key can't start with dot in Chrome!
return 1;
}

BBGame.prototype.LoadState=function(){
if( CFG_MOJO_USE_MONKEYSTATE=="1" ){
var state=localStorage.getItem( "monkeystate@"+document.URL );
}else{
var state=localStorage.getItem( "cerberusstate@"+document.URL );
}
var state=localStorage.getItem( "cerberusstate@"+document.URL );
if( state ) return state;
return "";
}
Expand Down
1 change: 0 additions & 1 deletion src/transcc/transcc.build/cpptool/config.cxs
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@

#CPP_DOUBLE_PRECISION_FLOATS=true
#MOJO_USE_MONKEYSTATE=False
34 changes: 8 additions & 26 deletions src/transcc/transcc.build/cpptool/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
#define CFG_HOST winnt
#define CFG_LANG cpp
#define CFG_MODPATH
#define CFG_MOJO_USE_MONKEYSTATE 0
#define CFG_RELEASE 1
#define CFG_SAFEMODE 0
#define CFG_TARGET stdcpp
Expand Down Expand Up @@ -1942,37 +1941,20 @@ void BBGame::GetDate( Array<int> date ){
}

int BBGame::SaveState( String state ){
if( CFG_MOJO_USE_MONKEYSTATE ){
if( FILE *f=OpenFile( "./.monkeystate","wb" ) ){
bool ok=state.Save( f );
fclose( f );
return ok ? 0 : -2;
}
}else{
if( FILE *f=OpenFile( "./.cerberusstate","wb" ) ){
bool ok=state.Save( f );
fclose( f );
return ok ? 0 : -2;
}
if( FILE *f=OpenFile( "./.cerberusstate","wb" ) ){
bool ok=state.Save( f );
fclose( f );
return ok ? 0 : -2;
}
return -1;
}

String BBGame::LoadState(){
if( CFG_MOJO_USE_MONKEYSTATE ){
if( FILE *f=OpenFile( "./.monkeystate","rb" ) ){
String str=String::Load( f );
fclose( f );
return str;
}
}else{
if( FILE *f=OpenFile( "./.cerberusstate","rb" ) ){
String str=String::Load( f );
fclose( f );
return str;
}
if( FILE *f=OpenFile( "./.cerberusstate","rb" ) ){
String str=String::Load( f );
fclose( f );
return str;
}

return "";
}

Expand Down
14 changes: 3 additions & 11 deletions targets/android/modules/native/androidgame.java
Original file line number Diff line number Diff line change
Expand Up @@ -419,22 +419,14 @@ public void SetUpdateRate( int hertz ){
public int SaveState( String state ){
SharedPreferences prefs=_activity.getPreferences( 0 );
SharedPreferences.Editor editor=prefs.edit();
if( CerberusConfig.MOJO_USE_MONKEYSTATE.equals( "1" ) ){
editor.putString( ".monkeystate",state );
}else{
editor.putString( ".cerberusstate",state );
}
editor.commit();
editor.putString( ".cerberusstate",state );
editor.commit();
return 1;
}

public String LoadState(){
SharedPreferences prefs=_activity.getPreferences( 0 );
if( CerberusConfig.MOJO_USE_MONKEYSTATE.equals( "1" ) ){
String state=prefs.getString( ".monkeystate","" );
}else{
String state=prefs.getString( ".cerberusstate","" );
}
String state=prefs.getString( ".cerberusstate","" );
if( state.equals( "" ) ) state=prefs.getString( "gxtkAppState","" );
return state;
}
Expand Down
1 change: 0 additions & 1 deletion targets/android/template/config.cxs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
#MOJO_AUTO_SUSPEND_ENABLED=True
#MOJO_HICOLOR_TEXTURES=True
#MOJO_IMAGE_FILTERING_ENABLED=True
#MOJO_USE_MONKEYSTATE=False

#ANDROID_APP_LABEL="Cerberus Game"
#ANDROID_APP_PACKAGE="com.cerberus.cerberusgame"
Expand Down
1 change: 0 additions & 1 deletion targets/cpptool/template/config.cxs
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@

#CPP_DOUBLE_PRECISION_FLOATS=true
#MOJO_USE_MONKEYSTATE=False
1 change: 0 additions & 1 deletion targets/glfw3/template/config.cxs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@

#MOJO_AUTO_SUSPEND_ENABLED=True
#MOJO_IMAGE_FILTERING_ENABLED=True
#MOJO_USE_MONKEYSTATE=False

#TEXT_FILES+="*.txt|*.xml|*.json"
#IMAGE_FILES+="*.png|*.jpg"
Expand Down
1 change: 0 additions & 1 deletion targets/html5/template/config.cxs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
#HTML5_CONSOLE_SHOW=True

#MOJO_AUTO_SUSPEND_ENABLED=True
#MOJO_USE_MONKEYSTATE=False

#OPENGL_GLES20_ENABLED=False

Expand Down
12 changes: 2 additions & 10 deletions targets/ios/modules/native/iosgame.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -178,22 +178,14 @@ int BBIosGame::Millisecs(){
int BBIosGame::SaveState( String state ){
NSString *nsstr=state.ToNSString();
NSUserDefaults *prefs=[NSUserDefaults standardUserDefaults];
if( CFG_MOJO_USE_MONKEYSTATE ){
[prefs setObject:nsstr forKey:@".monkeystate"];
}else{
[prefs setObject:nsstr forKey:@".cerberusstate"];
}
[prefs setObject:nsstr forKey:@".cerberusstate"];
[[NSUserDefaults standardUserDefaults] synchronize];
return 0;
}

String BBIosGame::LoadState(){
NSUserDefaults *prefs=[NSUserDefaults standardUserDefaults];
if( CFG_MOJO_USE_MONKEYSTATE ){
NSString *nsstr=[prefs stringForKey:@".monkeystate"];
}else{
NSString *nsstr=[prefs stringForKey:@".cerberusstate"];
}
NSString *nsstr=[prefs stringForKey:@".cerberusstate"];
if( nsstr ) return String( nsstr );
return "";
}
Expand Down
1 change: 0 additions & 1 deletion targets/ios/template/config.cxs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
#OPENGL_GLES20_ENABLED=False

#MOJO_IMAGE_FILTERING_ENABLED=true
#MOJO_USE_MONKEYSTATE=False

#TEXT_FILES+="*.txt|*.xml|*.json"
#IMAGE_FILES+="*.png|*.jpg"
Expand Down

0 comments on commit ac33316

Please sign in to comment.