set GameDir=
if not defined GameDir for /f "tokens=2*" %%a in (
 'REG QUERY HKLM\SOFTWARE\Wow6432Node\LucasArts\KotOR2\ /v Path 2^>NUL ^| findstr Path'
  ) do set GameDir=%%~b

cd %GameDir%

xcopy "Hard As Hell\Source\Planets\Includes\*.nss" "Hard As Hell\tslpatchdata\" /Y

xcopy "Hard As Hell\Source\AI & Bean\*.nss" "Hard As Hell\tslpatchdata\" /Y

xcopy "Hard As Hell\Source\Grenades\*.nss" "Hard As Hell\tslpatchdata\" /Y

xcopy "Hard As Hell\Source\Misc\*.nss" "Hard As Hell\tslpatchdata\" /Y

xcopy "Hard As Hell\Source\Planets\*.nss" "Hard As Hell\tslpatchdata\" /Y

xcopy "Hard As Hell\Source\Powers\*.nss" "Hard As Hell\tslpatchdata\" /Y

xcopy "Hard As Hell\Source\Treasure\*.nss" "Hard As Hell\tslpatchdata\" /Y

xcopy "Hard As Hell\Source\nwscript.nss" "Hard As Hell\tslpatchdata\"  /Y

attrib -r Override\*.* 

attrib -r modules\*.* 

attrib -r lips\*.* 

attrib -r TexturePacks\swpc_tex_gui.erf 

attrib -r streamvoice\702\Vash\702VASH008.wav 

attrib -r dialog.tlk

attrib -r "Hard As Hell\*.*"

mkdir "Hard As Hell\Backup\Override\"

mkdir "Hard As Hell\Backup\Modules\"

mkdir "Hard As Hell\Backup\lips\"

mkdir "Hard As Hell\Backup\TexturePacks\"

mkdir "Hard As Hell\Backup\Dialog_tlk\"

mkdir "Hard As Hell\Backup\Voice\"

xcopy override\*.* "Hard As Hell\Backup\Override\" /Y

xcopy modules\*.* "Hard As Hell\Backup\Modules\" /Y

xcopy lips\*.* "Hard As Hell\Backup\lips\" /Y

xcopy TexturePacks\swpc_tex_gui.erf "Hard As Hell\Backup\TexturePacks\" /Y

xcopy dialog.tlk "Hard As Hell\Backup\Dialog_tlk\" /Y

xcopy streamvoice\702\Vash\702VASH008.wav "Hard As Hell\Backup\Voice\" /Y

"Hard As Hell\Hard As Hell.exe"

"E:\program files\7-zip\7z" a "%GameDir%\Hard As Hell\Source\Powers\installer_proccessed.zip" "%GameDir%\Hard As Hell\tslpatchdata\debug\jd_constants.nss"
