Launch a game/saveslot instantly at app start

Subforum for discussion and help with ScummVM's Android port

Moderator: ScummVM Team

Post Reply
Chuke01
Posts: 3
Joined: Sat Oct 05, 2013 11:24 pm

Launch a game/saveslot instantly at app start

Post by Chuke01 »

Hello, it's posible to do that? Load a game or a save slot instantly after the app starts. Maybe with the .scummvmrcm file.
User avatar
md5
ScummVM Developer
Posts: 2250
Joined: Thu Nov 03, 2005 9:31 pm
Location: Athens, Greece

Post by md5 »

Check the README file:
--save-slot/-x:

This switch may be used to load a savegame directly from the command line.

Usage: --save-slot[SLOT] or -x[SLOT], where [SLOT] is the save slot number.
Chuke01
Posts: 3
Joined: Sat Oct 05, 2013 11:24 pm

Post by Chuke01 »

md5 wrote:Check the README file:
--save-slot/-x:

This switch may be used to load a savegame directly from the command line.

Usage: --save-slot[SLOT] or -x[SLOT], where [SLOT] is the save slot number.
This is for the android version? Where I had to put this commands lines?
User avatar
md5
ScummVM Developer
Posts: 2250
Joined: Thu Nov 03, 2005 9:31 pm
Location: Athens, Greece

Post by md5 »

Oh sorry, it was late when I wrote that. Not sure if you can modify the command line parameters in Android somehow but... can't you just load the saved game you want from the launcher?
Chuke01
Posts: 3
Joined: Sat Oct 05, 2013 11:24 pm

Post by Chuke01 »

Yes, It's the normal way, I can do it from launcher without problem. But I wanna do this other way, at app start, for a fast acces to the game in my phone. Because I only play one game at once.
digitall
ScummVM Developer
Posts: 1172
Joined: Thu Aug 02, 2012 1:40 pm

Post by digitall »

Just checked over the code. The tl;dr simple answer is NO.

The longer answer is not at the moment, but it might be a good feature to think about... Really, we should ensure all the command line options are mirrored by options in the GUI and entries in the configuration file, as this makes "command line less" builds such as most Smartphones much easier to deal with... It also makes life easier for debug as the "-d <n>" debug level flag can't be enabled/changed in the GUI or debug console currently which can be a pain during debugging.

The configuration options are dealt with by our Configuration Manager singleton class which deals with merging and resolving the default configuration, the configuration options from the config file and those passed on the command line...

The command line options are parsed by the code in scummvm/base/commandLine.cpp, specifically the function Base::parseCommandLine(settings, argc, argv) which is called from the main function found in scummvm/base/main.cpp ie. extern "C" int scummvm_main(int argc, const char * const argv[])) ...
digitall
ScummVM Developer
Posts: 1172
Joined: Thu Aug 02, 2012 1:40 pm

Post by digitall »

Now for the Android port, the main function is called from within scummvm/backends/platform/android/jni.cpp in the function jint JNI::main(JNIEnv *env, jobject self, jobjectArray args) which passes the command line arguments in a jobjectArray... This is a Java Native Interface i.e. call to native C/C++ code... in this case, our main application.

The actual java code for the Android application which calls this JNI can be found in scummvm/backends/platform/android/org/scummvm/scummvm ... specifically the main function of the application is the run() method of the Runnable ScummVM java class. This calls the main JNI method with the _args variable of this class... which also has a setter on the object called setArgs(String).

However, I can find no indication that Android has any way of passing command line arguments to a application.. so _args will always be "" currently.

If you compile yourself, you could change this at compile time..
User avatar
LordHoto
ScummVM Developer
Posts: 1029
Joined: Sun Oct 30, 2005 3:58 pm
Location: Germany

Post by LordHoto »

digitall wrote:Really, we should ensure all the command line options are mirrored by options in the GUI and entries in the configuration file, as this makes "command line less" builds such as most Smartphones much easier to deal with...
Actually, all our command line options are "mirrored" by configuration file entries. For example, you should be able to set they key "debuglevel" to the debug level you want to use. Furthermore, you should be able to set "save_slot" to the save slot number you want to load on start up and then (as long as the engine supports loading from launcher) it will load that game on start up.
digitall
ScummVM Developer
Posts: 1172
Joined: Thu Aug 02, 2012 1:40 pm

Post by digitall »

Lordhoto: Ah yes... You are correct.

I have tested and both "debuglevel=10" and "save_slot=1" work if setup by editing the scummvmrc configuration file externally...

However, I can't see that it is possible to do what Chuke01 wanted to do this way as I can't work out a way of invoking a specific engine at startup, bypassing the GUI.

I have tried "gameid=<name>" but that does not work...

Any ideas if this is possible?
User avatar
LordHoto
ScummVM Developer
Posts: 1029
Joined: Sun Oct 30, 2005 3:58 pm
Location: Germany

Post by LordHoto »

digitall wrote:Lordhoto: Ah yes... You are correct.

I have tested and both "debuglevel=10" and "save_slot=1" work if setup by editing the scummvmrc configuration file externally...

However, I can't see that it is possible to do what Chuke01 wanted to do this way as I can't work out a way of invoking a specific engine at startup, bypassing the GUI.

I have tried "gameid=<name>" but that does not work...

Any ideas if this is possible?
No, that's not possible.
Post Reply