#!/usr/bin/env bash
#Author: PortWINE
#Origin.exe 
#Rating=?
#####################examples###########################
export PW_DLL_INSTALL="vcrun2012 vcrun2019"               # Install DDL in port prefix (used winetricks) 
export PW_VULKAN_USE=1                       # dxvk, vkd3d or 0 for OpenGL
###WINE_KRON4EK###
export PW_WINE_USE="WINE-7.13-STAGING-AMD64"

check_download_wine_ver_for_origin () {
    if [ ! -d "${PORT_WINE_PATH}/data/dist/${PW_WINE_USE}" ] ; then
        if try_download "https://github.com/Kron4ek/Wine-Builds/releases/download/7.13/wine-7.13-staging-amd64.tar.xz" \
        "${PORT_WINE_PATH}/data/tmp/${PW_WINE_USE}.tar.xz" ; then
            if unpack_tar_xz "${PORT_WINE_PATH}/data/tmp/${PW_WINE_USE}.tar.xz" "${PORT_WINE_PATH}/data/dist/" ; then
                try_remove_file "${PORT_WINE_PATH}/data/tmp/${PW_WINE_USE}.tar.xz"
                UNPACK_STATUS=0
            else
                try_remove_file "${PORT_WINE_PATH}/data/tmp/${PW_WINE_USE}.tar.xz"
                try_remove_dir "${PORT_WINE_PATH}/data/dist/${PW_WINE_USE}"
            fi
        fi
        [[ "${UNPACK_STATUS}" != 0 ]] && exit 1
    fi
}
check_download_wine_ver_for_origin
