set build_components {
	app/uhexen2
	lib/vfs/lwip
	server/nic_loopback
}

set app_config {
	<start name="nic_loopback" priority="-1">
		<resource name="RAM" quantum="1M"/>
		<provides> <service name="Nic"/> </provides>
	</start>
	<start name="uhexen2" caps="256">
		<resource name="RAM" quantum="128M"/>
		<config>
			<sdl_audio_volume value="100"/>
			<libc stdout="/dev/log" stderr="/dev/log" socket="/socket"/>
			<vfs>
				<dir name="dev"> <log/> </dir>
				<dir name="socket">
					<lwip ip_addr="127.0.0.1" netmask="255.0.0.0" gateway="0.0.0.0"/> </dir>
				<tar name="hexen2demo_data.tar" />
			</vfs>
		</config>
	</start>}

if {![file exists bin/hexen2demo_data.tar]} {
	set hexen2demo_dir "hexen2demo_nov1997"
	set hexen2demo_tgz "hexen2demo_nov1997-linux-i586.tgz"
	set hexen2demo_url "http://downloads.sourceforge.net/project/uhexen2/Hexen2Demo-Nov.1997/$hexen2demo_tgz"

	if {![file exists bin/hexen2demo_nov1997-linux-i586.tgz]} {
		puts ""
		puts "Please download Hexen 2 demo data from '$hexen2demo_url'."
		puts "Place the archive in './bin' and run this script again."
		puts ""
		exit 1
	}

	exec tar xzf bin/$hexen2demo_tgz -C bin $hexen2demo_dir/data1
	exec echo showfps 1 >> bin/$hexen2demo_dir/data1/autoexec.cfg

	exec tar cf  bin/hexen2demo_data.tar -C bin/$hexen2demo_dir data1
	exec rm -rf  bin/$hexen2demo_dir
}

#
# Boot modules
#

# generic modules
append boot_modules {
	libc.lib.so vfs.lib.so libm.lib.so
	sdl.lib.so sdl_mixer.lib.so
	uhexen2 hexen2demo_data.tar
	vfs_lwip.lib.so
	nic_loopback
}

source ${genode_dir}/repos/world/run/nitpicker_app.inc
