During the past years I've written a few batch scripts that I use when doing my pack checking/repackaging work.
There are two ways the scripts work, which are denoted in square brackets:
- [folder] - copy the file into the folder and double-click it
- [drop] - drop a file on the .bat script
Note: You can execute all of that stuff directly in cmd.exe, if you type only one % instead of %%.
The tools used in the scripts are:
The first line of
all of my batch scripts is usually this one:
Code:
set PATH=C:\Users\User\VGMTools
This way I can just copy the script into any folder and it still finds the tools.
VGM editing/packaging[folder] check all VGMs (and remove a trailing 0-character from VGMTool tags), then optimize the VGM header:
Code:
for %%f in (*.vg?) do vgm_ptch -CheckT -MinHeader -MinVer "%%f"
[folder] prepare VGM for v1.70 extra header hex-editing:
Code:
for %%f in (*.vg?) do vgm_ptch -ResizeHead:0xE0 -Check "%%f"
[folder] apply volume gain factor of 2.0 / 200% / +6 db:
Code:
for %%f in (*.vg?) do vgm_ptch -SetVolMod:2.0 -Check "%%f"
[folder] optimize all VGMs with vgm_cmp:
Code:
mkdir cmp
for %%f in (*.vg?) do vgm_cmp "%%f" "cmp\%%f"
[folder] optimize all VGMs with vgm_sro, then vgm_cmp:
Code:
mkdir sro
copy *.vg? sro\*.vg?
for %%f in (*.vg?) do vgm_sro "%%f" "sro\%%f"
cd sro
mkdir cmp
copy *.vg? cmp\*.vg?
for %%f in (*.vg?) do vgm_cmp "%%f" "cmp\%%f"
[folder] decompress all VGZs into VGM:
Code:
ren *.vgz *.vgm.gz
ren *.vgm *.vgm.gz
gzip -d *.vgm.gz
for %%f in (*.vgm.gz) do ren "%%f" "%%~nf"
[folder] compress all VGMs into VGZ:
Code:
ren *.vgz *.vgm
gzip -n9 *.vgm
for %%f in (*.vgm.gz) do ren "%%f" "%%~nf"
ren *.vgm *.vgz
Note: Be careful to not accidentally gzip everything multiple times!
Screenshot handling[folder] optimize all screenshots with PNGOUT (tries 24-bit colour, then 8-bit, then greyscale):
Code:
for %%f in (*.png) do pngout "%%f" /c2 /f0
for %%f in (*.png) do pngout "%%f" /c3 /d0 /f0
for %%f in (*.png) do pngout "%%f" /c0 /d0 /f0
[drop] crop openMSX screenshots to MSX1 resolution 256x192:
Code:
move %1 %1.bak
magick %1.bak -crop 256x192+32+24 %1
[drop] crop openMSX screenshots to MSX2 resolution 256x212:
Code:
move %1 %1.bak
magick %1.bak -crop 256x212+32+14 %1
[drop] scale screenshots by 1x2, i.e. fix aspect ratio for PC-88/98 resolution 640x200:
Code:
move %1 %1.bak
magick %1.bak -sample "100x200%%" %1
[drop] remove scanlines from screenshots, black is on lines 1/3/5/...:
Code:
move %1 %1.bak
magick %1.bak -define sample:offset=25 -sample "100x50%%" -sample "100x200%%" %1
[drop] remove scanlines from screenshots, black is on lines 0/2/4/...:
Code:
move %1 %1.bak
magick %1.bak -define sample:offset=75 -sample "100x50%%" -sample "100x200%%" %1