Driar run scenario for the NES

http://driar.se/

Ref #52
This commit is contained in:
Emery Hemingway
2016-12-01 12:48:20 +01:00
committed by Norman Feske
parent 695a411f19
commit 8f8b71248d

200
run/driar.run Normal file
View File

@@ -0,0 +1,200 @@
# setting environment variable FORCE_QEMU permits running netperf in qemu
set force_qemu [info exists ::env(FORCE_QEMU)]
if {[expr [have_include "power_on/qemu"] && !$force_qemu]} {
puts "\Game emulation on Qemu is not recommended.\n"
exit
}
#
# Check used commands
#
set wget [check_installed wget]
set unzip [check_installed unzip]
set build_components {
core init
app/retro_frontend
drivers/framebuffer
drivers/input
drivers/timer
libretro/fceumm
server/fb_upscale
server/input_remap
}
source ${genode_dir}/repos/base/run/platform_drv.inc
# override default platform driver policy
proc platform_drv_policy {} {
return {
<policy label_prefix="ps2_drv"> <device name="PS2"/> </policy>
<policy label_prefix="usb_drv"> <pci class="USB"/> </policy>
<policy label_prefix="fb_drv"> <pci class="VGA"/> </policy>}
}
append_platform_drv_build_components
build $build_components
create_boot_directory
#
# Generate config
#
append config {
<config verbose="yes">
<parent-provides>
<service name="CPU"/>
<service name="IO_MEM"/>
<service name="IO_PORT"/>
<service name="IRQ"/>
<service name="LOG"/>
<service name="PD"/>
<service name="RAM"/>
<service name="RM"/>
<service name="ROM"/>
</parent-provides>
<default-route>
<any-service> <parent/> <any-child/> </any-service>
</default-route>}
append_if [have_spec sdl] config {
<start name="fb_sdl">
<resource name="RAM" quantum="4M"/>
<provides>
<service name="Input"/>
<service name="Framebuffer"/>
</provides>
<config width="640" height="480"/>
</start>
<alias name="input_drv" child="fb_sdl"/>
<alias name="fb_drv" child="fb_sdl"/>}
append_platform_drv_config
append_if [have_spec vesa] config {
<start name="fb_drv">
<resource name="RAM" quantum="4M"/>
<provides><service name="Framebuffer"/></provides>
<config buffered="yes"> </config>
<config width="300" height="200"/>
</start>}
append_if [have_spec pl11x] config {
<start name="fb_drv">
<resource name="RAM" quantum="2M"/>
<provides><service name="Framebuffer"/></provides>
</start>}
append_if [have_spec ps2] config {
<start name="ps2_drv">
<resource name="RAM" quantum="1M"/>
<provides><service name="Input"/></provides>
</start>
<alias name="input_drv" child="ps2_drv"/>}
append config {
<start name="timer">
<resource name="RAM" quantum="1M"/>
<provides><service name="Timer"/></provides>
</start>
<start name="fb_upscale">
<resource name="RAM" quantum="4M"/>
<provides> <service name="Framebuffer"/> </provides>
<route>
<service name="Framebuffer">
<child name="fb_drv"/> </service>
<any-service> <parent/> <any-child/> </any-service>
</route>
</start>
<start name="input_remap">
<resource name="RAM" quantum="2M"/>
<provides> <service name="Input"/> </provides>
<config>
<map from="KEY_A" to="BTN_A"/>
<map from="KEY_S" to="BTN_B"/>
<map from="KEY_LEFTCTRL" to="BTN_A"/>
<map from="KEY_LEFTALT" to="BTN_B"/>
<map from="KEY_ENTER" to="BTN_START"/>
<map from="KEY_RIGHTSHIFT" to="BTN_SELECT"/>
<map from="KEY_LEFT" to="BTN_LEFT"/>
<map from="KEY_RIGHT" to="BTN_RIGHT"/>
<map from="KEY_UP" to="BTN_FORWARD"/>
<map from="KEY_DOWN" to="BTN_BACK"/>
</config>
<route>
<service name="Input">
<child name="input_drv"/> </service>
<any-service> <parent/> <any-child/> </any-service>
</route>
</start>
<start name="retro_frontend">
<resource name="RAM" quantum="64M"/>
<config core="fceumm_libretro.lib.so">
<game rom="Driar.nes"/>
<libc stdout="/log" stderr="/log">
<vfs>
<log/>
<!--<rom name="disksys.rom"/>-->
</vfs>
</libc>
</config>
<route>
<service name="Framebuffer">
<child name="fb_upscale"/> </service>
<service name="Input">
<child name="input_remap"/> </service>
<any-service> <parent/> <any-child/> </any-service>
</route>
</start>
</config>}
install_config $config
#
# Download and extract a test ROM
#
if {![file exist bin/driar.zip]} {
set zip_url "http://driar.se/driar/driar.zip"
catch { exec $wget $zip_url -O bin/driar.zip }
}
if {![file exist bin/Driar.nes]} {
catch { exec $unzip -o bin/driar.zip -d bin }
}
# generic modules
set boot_modules {
core init ld.lib.so
fb_upscale
input_remap
libc.lib.so
libm.lib.so
retro_frontend
stdcxx.lib.so
fceumm_libretro.lib.so
timer
zlib.lib.so
Driar.nes
}
# platform-specific modules
lappend_if [have_spec linux] boot_modules fb_sdl
lappend_if [have_spec vesa] boot_modules fb_drv
lappend_if [have_spec ps2] boot_modules ps2_drv
lappend_if [have_spec pl11x] boot_modules fb_drv
append_platform_drv_boot_modules
build_boot_image $boot_modules
append qemu_args " -m 256 -soundhw es1370 "
puts "\n################\n"
set txt [open "bin/Driar.txt" r]
puts [read $txt]
close $txt
puts "\n################\n"
run_genode_until forever