#!/bin/zsh

if [ -z "$1" ];  then
    echo "Usage: $0 <wine-prefix-path> <executable>"
    exit 1
fi

exe_path="cmd.exe"
if [ ! -z "$2" ]; then
    exe_path="$2"
fi

export MTL_HUD_ENABLED="1"
export WINEDLLPATH_PREPEND="@@PREFIX@@/libexec/d3dmetal/wine"
export WINEPREFIX="$1"
exec @@PREFIX@@/libexec/game-porting-toolkit/bin/wine64 "$exe_path" 2>&1 | grep "D3DM"
exit 1
