@echo off
echo SounDWorX MiDPLAY update script
echo.

if '%1' == '' goto HELP

echo checking directory...

if not exist %1\mp.exe goto FAILED

echo removing all old RAW-files and TMP-files in %1%

if exist %1\m1024.raw del %1\m1024.raw >NUL:
if exist %1\m800.raw del %1\m800.raw >NUL:
if exist %1\m640.raw del %1\m640.raw >NUL:
if exist %1\m360.raw del %1\m360.raw >NUL:
if exist %1\h1024.raw del %1\h1024.raw >NUL:
if exist %1\h800.raw del %1\h800.raw >NUL:
if exist %1\h640.raw del %1\h640.raw >NUL:
if exist %1\h360.raw del %1\h360.raw >NUL:
if exist %1\1024arch.tmp del %1\1024arch.tmp >NUL:
if exist %1\800arch.tmp del %1\800arch.tmp >NUL:
if exist %1\640arch.tmp del %1\640arch.tmp >NUL:

echo checking for application settings...
if exist %1\mp.ini goto INIUP
echo not found.

goto GOON

:INIUP
echo your MP.INI will now be renamed to MP.OLD.
echo you may have to edit the new MP.INI to keep your old configuration settings !
if exist %1\mp.old del %1\mp.old >NUL:
ren %1\mp.ini %1\mp.old >NUL:

:GOON
echo copying distribution files...
copy *.* %1 /s >NUL:

echo.
echo SounDWorX MiDPLAY is now updated.
echo have phun !
rm update.bat
goto END

:FAILED
echo MiDPLAY not found in destination directory, no update needed !

goto END

:HELP
echo To run this script you need to have an installed MiDPLAY in any
echo directory and a fresh, unpacked, new MiDPLAY in another directory.
echo.
echo give the old MiDPLAY-directory as the first parameter !
echo e.g.: update e:\sound\mp
goto END

:END
echo on
