Hi everyone,
I've been trying to create SC5 files of in-game snapshots to create a cool game selector.
So far the only way I managed to do it is by using an emulator, taking the snapshot in png format, and then converting it with jannone's scrconv.exe.
This method works fine, but I find it a little tedious and has a few problems.
First, it must be an emulator which takes the snapshot at the exact resolution (256x212) otherwise I have to manually crop the relevant part of the snapshot. Second and last, I am noticing some color differences between different emulators (tried BlueMSX, openMSX and MESS so far) and I'm not sure which is more accurate.
So I wanted to ask you guys, how would you accomplish this task? I'm afraid using an emulator can't be avoided. In that case which one would you recommend? Is there any emu which can take a snapshot directly in SC5 format? That would be awesome because I wouldn't have to do the conversion manually.
Ideas, suggestions, anything welcome!
Taking SC5 snapshot of games
In openMSX it would be possible to make a small script that reads out the VRAM data and writes it to a file in the proper format.
Normal screenshots are including borders and all video effects, so it depends also on settings like scaler and stuff like TV-emulation (NTSC filters perhaps? Don't know what blueMSX has) and stuff like that.
Some games feature colour screen splits, e.g. an upper 2/3 for the gaming area, a lower 1/3 for a status bar. Some games even feature a screen mode split *and* a colour split and a scroll split, think Psycho World. You wouldn't be able to make proper vram dumps in .sc5/.ge5 format for all games - at least not from the parts that feature all these splits. That's where regular bitmap dumps work best..
If someone makes such a script for OpenMSX, then this is how I think the output file should be build:
SC5 format:
File offset #0000-#0006:
RAW DATA: #FE,#00,#00,#FF,#7F,#00,#00
File offset #0007-#7406
Bytes from VRAM: offset= ([VDP R#2] AND 96)*1024
File offset: #7407-#7786
Bytes from VRAM: offset= (([VDP R#5] AND 252)+[VDP R#11]*256)*128-512
File offset: #7687-#76A6
Dump of Pallette RAM
File offset: #76A7-#7806
Bytes from VRAM: offset= ([VDP R#2] AND 96)*1024+30368
File offset: #7807-#8006
Bytes from VRAM: offset= [VDP R#6]*2048
Forget the screen splits. It might not work for screen captures for games, but it might proof it self other ways handy tool to have.
NYYRIKKI: you almost wrote the script there!
Yes, but I don't know anything about TCL
Well, it's not very hard... take a look at some other scripts like those in example_tools.tcl... (see http://openmsx.svn.sourceforge.net/viewvc/openmsx/openmsx/tr... )
If you get on IRC, we can chat about it and make it together.
Damn you lazy, no good bastards...
Why do I get to do all the stupid stuff?
Grr... This should do it...
proc SC5capture { } { set out [open "SCREEN.SC5" w] fconfigure $out -translation binary puts -nonewline $out [binary format c* {0xFE 0 0 0xFF 0x7F 0 0}] set bg [expr ([debug read "VDP regs" 2] & 96)*1024] set en [expr $bg + 0x7400] for { set adr $bg} { $adr < $en } { incr adr } { puts -nonewline $out [binary format c [debug read VRAM $adr] ] } set bg [expr (([debug read "VDP regs" 5] & 252)+[debug read "VDP regs" 11]*256)*128-512] set en [expr $bg + 0x280] for { set adr $bg} { $adr < $en } { incr adr } { puts -nonewline $out [binary format c [debug read VRAM $adr] ] } for { set adr 0} { $adr < 32 } { incr adr } { puts -nonewline $out [binary format c [debug read "VDP palette" $adr] ] } set bg [expr ([debug read "VDP regs" 2] & 96)*1024+30368] set en [expr $bg + 0x160] for { set adr $bg} { $adr < $en } { incr adr } { puts -nonewline $out [binary format c [debug read VRAM $adr] ] } set bg [expr [debug read "VDP regs" 6]*2048] set en [expr $bg + 0x800] for { set adr $bg} { $adr < $en } { incr adr } { puts -nonewline $out [binary format c [debug read VRAM $adr] ] } close $out }
Wow, NYYRIKKI, you rock
It works!
Hahahaha... Big LOL here
Nyyrikki doesn't have to do much to entertain his audience
[13:23] Yes, but I don't know anything about TCL
[15:20] Grr... This should do it...
In less than 2 hours from knowing nothing about Tcl to a fully functional script ... openMSX scripting can't be that hard
Just a few simplifications:
proc SC5capture {{filename "SCREEN5.SC5"}} { set out [open $filename w] fconfigure $out -translation binary puts -nonewline $out [binary format c* {0xFE 0 0 0xFF 0x7F 0 0}] set adr [expr ([vdpreg 2] & 96) * 1024] puts -nonewline $out [debug read_block "VRAM" $adr 0x7400] set adr [expr (([vdpreg 5] & 252) + [vdpreg 11] * 256) * 128 - 512] puts -nonewline $out [debug read_block "VRAM" $adr 0x280] puts -nonewline $out [debug read_block "VDP palette" 0 32] set adr [expr ([vdpreg 2] & 96) * 1024 + 30368] puts -nonewline $out [debug read_block "VRAM" $adr 0x160] set adr [expr [vdpreg 6] * 2048] puts -nonewline $out [debug read_block "VRAM" $adr 0x800] close $out }