#!/bin/sh
# This should replaced by storing the correct PID before 
# launching an emulator and signaling only this one.

RUN_ENV_VAR=$(fw_printenv -n assembly_tests 2>/dev/null)
if [ "x${RUN_ENV_VAR}" == "x1" ]; then
	# First this one
	killall -s USR1 assembly_tests > /dev/null 2>&1

	# Then this one
	killall -s USR1 funkey_prod_screens > /dev/null 2>&1
fi

# Send signal to all PCSX first (time critical)
killall -s USR1 pcsx > /dev/null 2>&1

# Send signal to all other emulators
killall -s USR1 gpsp psnes sdlgnuboy PicoDrive mednafen fceux > /dev/null 2>&1

# Send signal to launchers
killall -s USR1 retrofe gmenu2x > /dev/null 2>&1

exit 0
