Split openMSX layout from artifacts and added video recorder.
All checks were successful
Run test asserts / Test-Asserts (push) Successful in -5s

This commit is contained in:
Willem Cazander 2024-06-27 20:14:23 +02:00
parent dd634833ef
commit b4d4fad185
8 changed files with 39 additions and 25 deletions

View file

@ -0,0 +1,28 @@
<?xml version="1.0" ?>
<!DOCTYPE msxconfig SYSTEM 'msxconfig2.dtd'>
<msxconfig>
<info>
<name>Sunrise ATA-IDE Nextor</name>
<manufacturer>Sunrise</manufacturer>
<code />
<release_year>2024</release_year>
<description>ATA-IDE interface with hard disk.</description>
<type>external hard disk</type>
</info>
<devices>
<primary slot="any">
<secondary slot="any">
<SunriseIDE id="Sunrise IDE">
<mem base="0x0000" size="0x10000" />
<rom>
<sha1>dca824d7b0ddf25c6e87a8098e97ab7489725f57</sha1> <!-- SHA1 of Nextor-2.1.1.SunriseIDE.ROM -->
</rom>
<master>
<type>IDEHD</type>
<filename>hd.dsk</filename>
</master>
</SunriseIDE>
</secondary>
</primary>
</devices>
</msxconfig>

View file

@ -0,0 +1,75 @@
# boot_env -- Sets various openMSX settings based from environment variables.
#
# Typically used in automation tools which run openMSX without human interaction.
# Supported environment variables by this script;
#
# RENDERER=SDL
# Override video output from command line.
#
# SCALE_FACTOR=3
# Override video scale factor for SDL renderer.
#
# THROTTLE=off
# Disables msx speed emulation.
#
# SPEED=400
# Sets msx speed to 4x of original but only when throttle is on.
#
# JOYPORTA=mouse
# Inserts mouse in joyporta.
#
# JOYPORTB=mouse
# Inserts mouse in joyportb.
#
# RECORD_SESSION=bin/output.avi
# Enables the session video recorder.
#
if {[info exists ::env(RENDERER)] && ([string trim $::env(RENDERER)] != "")} {
if {[catch {set renderer [string trim $::env(RENDERER)]} err_msg]} {
puts stderr "error: env.RENDERER value $err_msg"
exit 1
}
}
if {[info exists ::env(SCALE_FACTOR)] && ([string trim $::env(SCALE_FACTOR)] != "")} {
if {[catch {set scale_factor [string trim $::env(SCALE_FACTOR)]} err_msg]} {
puts stderr "error: env.SCALE_FACTOR value $err_msg"
exit 1
}
}
if {[info exists ::env(THROTTLE)] && ([string trim $::env(THROTTLE)] != "")} {
if {[catch {set throttle [string trim $::env(THROTTLE)]} err_msg]} {
puts stderr "error: env.THROTTLE value $err_msg"
exit 1
}
}
if {[info exists ::env(SPEED)] && ([string trim $::env(SPEED)] != "")} {
if {[catch {set speed [string trim $::env(SPEED)]} err_msg]} {
puts stderr "error: env.SPEED value $err_msg"
exit 1
}
}
if {[info exists ::env(JOYPORTA)] && ([string trim $::env(JOYPORTA)] != "")} {
if {[catch {plug joyporta [string trim $::env(JOYPORTA)]} err_msg]} {
puts stderr "error: env.JOYPORTA value $err_msg"
exit 1
}
}
if {[info exists ::env(JOYPORTB)] && ([string trim $::env(JOYPORTB)] != "")} {
if {[catch {plug joyportb [string trim $::env(JOYPORTB)]} err_msg]} {
puts stderr "error: env.JOYPORTB value $err_msg"
exit 1
}
}
if {[info exists ::env(RECORD_SESSION)] && ([string trim $::env(RECORD_SESSION)] != "")} {
if {[catch {after time 1 "record start [string trim $::env(RECORD_SESSION)]"} err_msg]} {
puts stderr "error: env.RECORD_SESSION value $err_msg"
exit 1
}
}

View file

@ -0,0 +1,130 @@
# boot_hdd -- Create import/export disk images to local folder.
#
# Typically used in automation tools which run openMSX without human interaction.
# This script is basicly is a bit more generic and safe way to run the following code;
#
# diskmanipulator create disk.img 32m 32m 32m 32m
# hda disk.img
# diskmanipulator import hda1 ./disk-in/
# after quit {diskmanipulator export hda1 ./disk-out/}
#
# Supported environment variables by this script;
#
# BOOT_HDD_SIZE=30m
# Sets the size of the created partitions, defaults to 15m for dos1.
#
# BOOT_HDD_IMAGE=bin/myapp/dsk.img
# Defaults to ./hdd.dsk
#
# BOOT_HDD_PATH=bin/myapp/dsk
# provides the default values for BOOT_HDD_PATH_IMPORT and BOOT_HDD_PATH_EXPORT
#
# BOOT_HDD_PATH_IMPORT=bin/myapp/dsk
# When set enables the import of all files into the first disk partition.
#
# BOOT_HDD_PATH_EXPORT=bin/myapp/dsk-result
# When set enables the export of all files back to the filesystem
#
# BOOT_HDD_EXPORT_PARTITION=2
# When set override the export from 'first' to 'given' partition number.
#
# BOOT_HDD_EXPORT_DIR=myout
# By default export does chdir to root of msx partition override to custom export directory.
#
# BOOT_HDD_PARTITIONS=2
# The number of partitions created in the disk image, defaults to 1.
#
# per default create msxdos1 compatible partition size.
set boot_hdd_size 15m
set boot_hdd_image hdd.dsk
set boot_hdd_path_import 0
set boot_hdd_path_export 0
set boot_hdd_export_partition 0
set boot_hdd_export_dir \\
set boot_hdd_partitions 1
# Parse env settings
if {[info exists ::env(BOOT_HDD_SIZE)] && ([string trim $::env(BOOT_HDD_SIZE)] != "")} {
set boot_hdd_size [string trim $::env(BOOT_HDD_SIZE)]
}
if {[info exists ::env(BOOT_HDD_IMAGE)] && ([string trim $::env(BOOT_HDD_IMAGE)] != "")} {
set boot_hdd_image [string trim $::env(BOOT_HDD_IMAGE)]
}
if {[info exists ::env(BOOT_HDD_PATH)] && ([string trim $::env(BOOT_HDD_PATH)] != "")} {
set boot_hdd_path_import [string trim $::env(BOOT_HDD_PATH)]
set boot_hdd_path_export [string trim $::env(BOOT_HDD_PATH)]
}
if {[info exists ::env(BOOT_HDD_PATH_IMPORT)] && ([string trim $::env(BOOT_HDD_PATH_IMPORT)] != "")} {
set boot_hdd_path_import [string trim $::env(BOOT_HDD_PATH_IMPORT)]
}
if {[info exists ::env(BOOT_HDD_PATH_EXPORT)] && ([string trim $::env(BOOT_HDD_PATH_EXPORT)] != "")} {
set boot_hdd_path_export [string trim $::env(BOOT_HDD_PATH_EXPORT)]
}
if {[info exists ::env(BOOT_HDD_EXPORT_PARTITION)] && ([string trim $::env(BOOT_HDD_EXPORT_PARTITION)] != "")} {
set boot_hdd_export_partition [string trim $::env(BOOT_HDD_EXPORT_PARTITION)]
}
if {[info exists ::env(BOOT_HDD_EXPORT_DIR)] && ([string trim $::env(BOOT_HDD_EXPORT_DIR)] != "")} {
set boot_hdd_export_dir [string trim $::env(BOOT_HDD_EXPORT_DIR)]
}
if {[info exists ::env(BOOT_HDD_PARTITIONS)] && ([string trim $::env(BOOT_HDD_PARTITIONS)] != "")} {
set boot_hdd_partitions [string trim $::env(BOOT_HDD_PARTITIONS)]
if {$boot_hdd_partitions == 0 || $boot_hdd_partitions > 4} {
puts stderr "error: Invalid env.BOOT_HDD_PARTITIONS value 1-4 allowed: $boot_hdd_partitions"
exit 1
}
}
if {$boot_hdd_path_import != 0} {
set boot_hdd_disk_partition "hda"
if {$boot_hdd_partitions == 1} {
if {[catch {diskmanipulator create $boot_hdd_image $boot_hdd_size} err_msg]} {
puts stderr "error: create1 $err_msg"
exit 1
}
}
if {$boot_hdd_partitions > 1} {
set boot_hdd_disk_partition "hda1"
if {$boot_hdd_partitions == 2} {
if {[catch {diskmanipulator create $boot_hdd_image $boot_hdd_size $boot_hdd_size} err_msg]} {
puts stderr "error: create2 $err_msg"
exit 1
}
}
if {$boot_hdd_partitions == 3} {
if {[catch {diskmanipulator create $boot_hdd_image $boot_hdd_size $boot_hdd_size $boot_hdd_size} err_msg]} {
puts stderr "error: create3 $err_msg"
exit 1
}
}
if {$boot_hdd_partitions == 4} {
if {[catch {diskmanipulator create $boot_hdd_image $boot_hdd_size $boot_hdd_size $boot_hdd_size $boot_hdd_size} err_msg]} {
puts stderr "error: create4 $err_msg"
exit 1
}
}
}
if {[catch {hda $boot_hdd_image} err_msg]} {
puts stderr "error: hda $err_msg"
exit 1
}
if {[catch {diskmanipulator import $boot_hdd_disk_partition $boot_hdd_path_import} err_msg]} {
puts stderr "error: import $err_msg"
exit 1
}
if {$boot_hdd_path_export != 0} {
if {$boot_hdd_export_partition != 0} {
set boot_hdd_disk_partition "hda$boot_hdd_export_partition"
}
after quit {
if {[catch {diskmanipulator chdir $boot_hdd_disk_partition $boot_hdd_export_dir} err_msg]} {
puts stderr "error: chdir $err_msg"
exit 1
}
if {[catch {diskmanipulator export $boot_hdd_disk_partition $boot_hdd_path_export} err_msg]} {
puts stderr "error: export $err_msg"
exit 1
}
}
}
}

View file

@ -0,0 +1,77 @@
# fail_after -- exits openMSX after timeout.
#
# Typically used in combination with the MSX-DOS 'omsxctl.com' utility.
#
# Adds two environment variables and two commands to openMSX;
#
# 'fail_after timeout [timeunit] [fail_id] [fail_code]'
# Schedules an openMSX exit after the timeout.
# This can be canceled by requesting a timeout of 0 or new timeout.
# The timeunit can be selected between (msx)'time' and (host)'realtime'.
# The fail_id can be used to differentiate between multiple fail_after commands.
# The failure exit code can be given too.
#
# 'fail_after_exit [fail_id] [fail_code]'
# Exits openMSX with an failure exit code and if the FAIL_AFTER_PATH is
# set it also creates a screenshot named from the failure id.
#
# Supported environment variables by this script;
#
# FAIL_AFTER_PATH=.
# Enabled automatic screenshots saving in case of failures in the supplied path.
#
# FAIL_AFTER_BOOT=30
# Enables the boot watchdog timer which will exit openMSX after the timeout(in seconds).
# To cancel this timer give an `fail_after 0` or any new fail_after command.
#
proc fail_after_exit {{fail_id "fail_after_exit"} {fail_code 2}} {
global fail_after_path
if {$fail_after_path != 0} {
if {[catch {screenshot $fail_after_path/$fail_id.png} err_msg]} {
puts stderr "warning: $err_msg"
}
# maybe later add; if {is_text_mode} { [get_screen] ?> $fail_after_path/$fail_id.scr }
}
puts stderr "error: Failure request from $fail_id"
exit $fail_code
}
proc fail_after { timeout {time_unit "time"} {fail_id "fail_after"} {fail_code 2}} {
global fail_after_prev_timer
global fail_after_prev_id
set msg ""
if {$fail_after_prev_timer != 0} {
after cancel $fail_after_prev_timer
set msg "$fail_after_prev_id: Stopped attempt."
}
set fail_after_prev_id $fail_id
if {$time_unit != "time"} {
set time_unit "realtime"
}
if {$timeout != 0} {
if {[catch {set fail_after_prev_timer [after $time_unit $timeout "fail_after_exit $fail_id $fail_code"]} err_msg]} {
puts stderr "error: $err_msg"
fail_after_exit fail_after_timer_error 1
}
set msg "$msg\n$fail_id: Automatic failure in $timeout $time_unit seconds."
} else {
set fail_after_prev_timer 0
}
return $msg
}
# Globals
set fail_after_prev_timer 0
set fail_after_prev_id 0
set fail_after_path 0
# Parse screenshot path env setting
if {[info exists ::env(FAIL_AFTER_PATH)] && ([string trim $::env(FAIL_AFTER_PATH)] != "")} {
set fail_after_path [string trim $::env(FAIL_AFTER_PATH)]
}
# Enables boot watch dog timer when FAIL_AFTER_BOOT env has a value. (124 see `man timeout`)
if {[info exists ::env(FAIL_AFTER_BOOT)] && ([string trim $::env(FAIL_AFTER_BOOT)] != "")} {
fail_after [string trim $::env(FAIL_AFTER_BOOT)] realtime failed_boot 124
}

View file

@ -0,0 +1,8 @@
<!DOCTYPE settings SYSTEM 'settings.dtd'>
<settings>
<settings>
<setting id="save_settings_on_exit">false</setting>
<setting id="sound_driver">null</setting>
</settings>
<bindings/>
</settings>