Question about automated screenshots features

By DrWh0

Paladin (752)

DrWh0's picture

25-07-2018, 19:05

Hi everyone

Sorry if this sound silly but, i have a question regarding commandline:

Is there any command line option to force openmsx to load a rom, take a screenshot after a specific time in seconds and close the emulator after taking that screenshot without user intervention?

My idea is making a batch file to get all the names of a folder, make a list and open openmsx take a screenshot after XX seconds.

I already know that internal command console of openmsx can do automated screenshots and internal operations but It can´t make an automated process taking all the roms in a folder and needs tcl programming

Thanks in advance

Login or register to post comments

By Manuel

Ascended (15457)

Manuel's picture

25-07-2018, 22:21

This is possible with a command line that also includes a small Tcl script.

Make a text file containing the following:

set throttle off
after time 15 { screenshot -guess-name; exit}

Name this file whatever you like, e.g. autoscr.tcl and start up openMSX from your batchfile like this:
openmsx WHATEVERYOURROMFILEIS -script autoscr.tcl
of course, fill in the proper parameter for the ROM file where I put WHATEVERYOURROMFILEIS.

Tweak the script file as you wish: 15 is the time in seconds after starting up after which the screenshot is taken and openMSX exits. With the -guess-name option, I let openMSX make a nice filename for your screenshot. openMSX will still make sound, if you don't like that, add a line at the beginning with set mute true.

Enjoy and let me know if you have questions.

And yes, it is possible to do this from one single Tcl script, but you rather program a batch file (that would be slower, but maybe you don't care about that), that's all your choice Smile

By DrWh0

Paladin (752)

DrWh0's picture

25-07-2018, 23:13

Thank you Manuel

I thought that tcl scripts were more complex that using console commands on a text file (I saw a couple of complex tcl and I thought that it should be easier) and documentation sometimes is a bit confusing regarding to the creation of it.

I will do it in that way

Thanks again Smile

By Manuel

Ascended (15457)

Manuel's picture

26-07-2018, 00:02

The openMSX console is basically a Tcl shell. So everything you write in there is valid Tcl. So a bunch of console commands are also a simple Tcl script.

If there is something specific in the documentation that can be improved, please point me to it and I'll improve it.

By DrWh0

Paladin (752)

DrWh0's picture

27-08-2018, 13:03

Hi Manuel

I forgot to mention you that I made an utility for making those screenshots processing a whole folder of roms with that feature and also others specific tcl script commands:

You can download from:!ldkxSZpY!wwLxfwoygdNBnKwDTzWr9g

But I have three questions in order to improve it:

- Is possible to add an option to run openmsx without showing video?

This is useful for testing multiplayer games (also we are working in a network capable & other turn based automated MSX game project) also for faster/cleaner automated execution of batch processs like my program does

- Also I would like to know if I can do this in a shell script without crashing the current running machine:

cart insert %longpatch%\game.rom

....after screenshoting or running certain commands after xx seconds

cart eject %longpatch%\game.rom

Or I have to power off and power on each time inserting "set power on" and "set power off"

- There is any limit to tcl scripts size and lenght of each line?

Thanks :)

By Manuel

Ascended (15457)

Manuel's picture

03-10-2018, 11:32

I forgot to reply to this:
1. yes, see the other thread about this
2. yes you can. But the cart will not be started until you reset the MSX, of course. Just like real hardware (if you insert the cart cleanly). This is also what happens if you select "Insert ROM" in the OSD menu
3. no that I know. What are you worrying about exactly?

By DrWh0

Paladin (752)

DrWh0's picture

03-10-2018, 23:12

Don´t worry Manuel Smile

Regarding to point 1:

Yes I read about the bug, thanks

Regarding to point 2:

I was thinking about creating a dinamic matrix of data like I create and execute with external script while logging, so I should add something like this:

1 command to remove cartridge
2 command to insert cartridge
3 execute commands of tcl file applied to that file......
4 command to reset machine
5 loop to 1 or something analogue (stop start....)

Regarding to point 3:

Because I have saw complex some tcl scripts on the forum and, in spite of working well with those scripts, I am worried about the possibility of an buffer overflow, so I would like to know if I have to take preventive measures to prevent crashing or erratic behaviour from my program.

I rely on the openmsx engine to process the commands, but like I am using dinamical management in filesystem and memory there is a remote chance of erratic behaviour.

So I can assume that possible limitation could come from TCL limit of 2GB on 32 bits systems due to memory allocator like the original TCL language?

If so I have no worries about it because that condition is absurd so there should be worry with current configuration but if I use internal command set that quantity could be reached on 32 bits systems with large number of files.

Am i correct about it?

By Manuel

Ascended (15457)

Manuel's picture

03-10-2018, 23:56

The scripts are pure Tcl, there are just some links with the openMSX core for built in commands and settings implemented in C++. So all usual limits for Tcl scripts apply. It's not clear at all to me what you are trying to do, but I doubt you'll hit these limits. But maybe you can explain in detail?

By DrWh0

Paladin (752)

DrWh0's picture

05-10-2018, 16:03

Hi Manuel, really is not a big problem Smile

Basically I was a bit worried about a potential issue in real world (and worse of all even not mentioned on my documentation), that could break the software funtionality and cause unexpected damages (I really hate error exceptions on a software and adding extense routines to manage those exceptions).

This tool was designed in order to be able to support long tcl scripts like you do in the conventional way, not only for screenshotting.

The goal of this program for making life easier for:

The developers testing their games, making promotional videos or articles
The collectors of roms
For emulator developers like you in order to test compabilities issues and detect potential errors saving time and effort.

This is my way to help people with their work in spite of having few time and some physical problems that prevents me to stay much time programming.

In the future if I see enough people interested on it I would add extra features like graphical options, checkboxes in order to make easier manage TCL, editing conventional commands, an internal editor, more customization options, etc...

I haven´t published the source code yet until I consider the code deserves of being showed in public Wink