vgmrips

The forum about vgm files
It is currently 2020-09-22, 13:23:51

All times are UTC + 1 hour [ DST ]




Post new topic Reply to topic  [ 6 posts ] 
Author Message
PostPosted: 2020-04-19, 13:27:53 

Staff Staff
Programmers Programmers
Musicians Musicians
Contributors Contributors
Reverse engineers Reverse engineers
Offline
User avatar

Joined: 2011-12-01, 20:20:07
Posts: 3332
Location: Germany
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


Top
 Profile  
 
 Post subject:
PostPosted: 2020-04-19, 17:23:45 

Contributors Contributors
Offline
User avatar

Joined: 2017-01-12, 13:39:56
Posts: 60
Huge thanks for the vgm_cmp and vgm_sro scripts. Here's another one you can use in Powershell:
Code:
Dir | Rename-Item -NewName { $_.name -replace "_optimized","" }

What it does is removes the "_optimized" suffix after you run your vgms through either of the aforementioned tools. It should be useful when you have a lot of songs you don't wanna rename manually.

_________________
A bearded individual.
https://www.youtube.com/user/sunkhaskasis - my channel which I never update


Top
 Profile  
 
 Post subject:
PostPosted: 2020-04-19, 18:55:37 

Programmers Programmers
Offline

Joined: 2011-11-30, 17:26:44
Posts: 474
Location: Italy
Well, I did make a tool which removes the _suffixes from all the .vg? files in a directory: http://vgmrips.net/forum/viewtopic.php?p=947#p947

(someone with mod powers and FTP access should probably double check the link in my old post and/or edit it, though, since it still points to mdscene)

edit: it has been fixed.

_________________
My webhost decided to shut down most of my webspace without a warning. If you find any broken Digilander link in any of my posts (basically all of them should be), please inform me.


Last edited by Tom on 2020-04-19, 19:17:33, edited 1 time in total.

Top
 Profile  
 
 Post subject:
PostPosted: 2020-04-19, 19:01:53 

Contributors Contributors
Offline
User avatar

Joined: 2017-01-12, 13:39:56
Posts: 60
https://vgmrips.net/programs/tools/vgm_name.rar <- this here is a working link.

_________________
A bearded individual.
https://www.youtube.com/user/sunkhaskasis - my channel which I never update


Top
 Profile  
 
 Post subject:
PostPosted: 2020-04-19, 19:14:58 

Programmers Programmers
Offline

Joined: 2011-11-30, 17:26:44
Posts: 474
Location: Italy
Thanks for checking that, I wasn't sure if all the files got moved to the new server back then, hence why I mentioned FTP, but if things are this simple I'll just edit my old post myself :)

edit: ha, someone already did that, I'm looking at you, ValleyBell :ihih:

_________________
My webhost decided to shut down most of my webspace without a warning. If you find any broken Digilander link in any of my posts (basically all of them should be), please inform me.


Top
 Profile  
 
 Post subject:
PostPosted: 2020-04-19, 20:25:07 

Contributors Contributors
Staff Staff
Reverse engineers Reverse engineers
Offline
User avatar

Joined: 2013-07-17, 23:32:39
Posts: 438
Here are (some of the) scripts I used for "Street Fighter EX2 Plus". Probably the most useful one is "packgen.bat"

sfex2p.bat - logging script. Creates a "debug script", runs MAME automatically and copies the files (with temporary tags) to a new folder. Since it is done by a script, the VGMs will have minimal silence in the beginning and start at the exact time, making trimming easier. Remember to set "vgmwrite" to 1 in mame.ini or modify the script to set this parameter directly.

Of course this doesn't work immediately for each game, there is some manual effort needed to actually write a script that will work for each game. (Usually games on the same hardware using the same sound driver will work with the same script, though)

playlist.bat - Makes a playlist of all vgms. I run this once all tracks have been logged and then run VGMPlay with the "LogSound" setting to create wav files. You can modify this to make playlist for trimmed and optimized vgms later, for example when using vgm_vol

trim.bat - trimming script. I trim files manually using vgm_trim, then copy the parameters to this file, which I keep in case I have to log tracks again (along with original VGMs and creation scripts)

optimize.bat - Optimizes all tracks

unicode.html - Website to convert unicode text to character codes for vgm_tag (and packgen.bat). Also available online here

packgen.bat - my VGM tagging and packaging script. I edit this for every game and just run it, it tags vgms using vgm_tag (files should be named something like 123_trimmed_optimized_optimized.vgm), copies them to a directory with the game's name with a proper name (for instance "01 Title.vgm"). Outputs the song listing (using vgm_stat) to standard output which can then be copied and used when writing the description txt. (Also disregard some of the comments in that file, it's just old junk)


Attachments:
packtools.zip [4.64 KiB]
Downloaded 34 times
Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 6 posts ] 

All times are UTC + 1 hour [ DST ]


Who is online

Users browsing this forum: No registered users and 3 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group
[ Time : 0.287s | 18 Queries | GZIP : On ]