@echo off 
echo Running BuildOS
echo (Please press the "play"-button and exit when its "Done.")
TOOLS\BuildOS.exe
TOOLS\all_packages_to_one
del buildpkg.wrn
echo Fixing modules....
TOOLS\G'Reloc.exe -doit -dump
attrib temp\dump\*.dsm +h +s +r
attrib temp\dump\*.dat +h +s -r
attrib temp\dump\*.dll +h +s -r
IF EXIST "temp\dump\*.ico" (attrib temp\dump\*.ico +h +s -r)
IF EXIST "temp\dump\*.mui" (attrib temp\dump\*.mui +h +s -r)

cd temp
move "dump" "./../TOOLS/dump" > nul
cd ..
cd TOOLS

echo Create ImgFS...
BuildImgfs.exe > nul
make_imgfs.exe os.nb.payload -nosplit > nul

echo Create ROM binary...
NBMerge -emu os.nb > nul
copy "os.nb" "./../NewRom.bin" > nul

echo Cleaning up...
rd temp /S /Q
cd TOOLS
rd dump /S /Q
echo Done.
