mirror of
https://github.com/ScrelliCopter/VGM-Tools
synced 2025-02-21 04:09:25 +11:00
Compare commits
5 Commits
1969f7ae9a
...
v0.2.0
| Author | SHA1 | Date | |
|---|---|---|---|
| 6d60ea91c0 | |||
| 6164533c1a | |||
| 7c5a577fba | |||
| 7e0740d03a | |||
| c1a5003a82 |
5
neotools/.gitignore
vendored
5
neotools/.gitignore
vendored
@@ -4,3 +4,8 @@
|
||||
*.log
|
||||
*.pcm
|
||||
*.wav
|
||||
|
||||
*.o
|
||||
adpcm
|
||||
adpcmb
|
||||
neoadpcmextract
|
||||
|
||||
@@ -1,32 +1,46 @@
|
||||
Neo-Geo VGM tools
|
||||
-----------------
|
||||
=================
|
||||
|
||||
A hodge-podge of tools for working on NG VGM files,
|
||||
these files are provided in the hope that they may be useful to someone.
|
||||
|
||||
Makefiles have currently not been tested but shouldn't be hard to get working.
|
||||
Windows binaries are available under the Releases tab.
|
||||
|
||||
Included tools (sources included).
|
||||
- **adpcm.exe**:
|
||||
- **adpcm**:
|
||||
ADPCM Type-A to WAV converter.
|
||||
- **adpcmb.exe**:
|
||||
- **adpcmb**:
|
||||
ADPCM Type-B encoding tool that also does decoding to WAV.
|
||||
- **neoadpcmextract.exe**:
|
||||
- **neoadpcmextract**:
|
||||
Scans a .vgm and dumps all ADPCM type A&B data to raw .pcm files.
|
||||
- **autoextract.bat**:
|
||||
Convenience batch script that uses the above tools to dump all samples to WAVs.
|
||||
- **autoextract**:
|
||||
Convenience shell/batch script that uses the above tools to dump all samples to WAVs.
|
||||
|
||||
Building
|
||||
--------
|
||||
Linux:
|
||||
```shell script
|
||||
make -f adpcm.Makefile
|
||||
make -f adpcmb.Makefile
|
||||
make -f neoadpcmextract.Makefile
|
||||
```
|
||||
|
||||
Windows:
|
||||
- The updated Makefiles haven't been tested on Windows yet.
|
||||
- Working Windows binaries are available from the [Releases](https://github.com/ScrelliCopter/VGM-Tools/releases) tab.
|
||||
|
||||
How to use
|
||||
----------
|
||||
Copy your .vgz into this directory, drag it onto autoextract.bat,
|
||||
the script will create a directory of the same name and dump all the converted samples there.
|
||||
Linux:
|
||||
- Run `./autoextract.sh` from this directory with a path to your .vgm or .vgz,
|
||||
a directory for the song will be created containing wav samples.
|
||||
|
||||
Windows:
|
||||
- You will need gzip.exe (provided with the aforementioned release).
|
||||
- Copy your .vgm or .vgz into this directory, drag it onto autoextract.bat,
|
||||
the script will create a directory of the same name and dump all the converted samples there.
|
||||
|
||||
That's all there is to it.
|
||||
|
||||
TODO
|
||||
----
|
||||
|
||||
- Replace the batch script with something less shite (and actually cross-platform).
|
||||
- Write a makefile for neoadpcmextract.
|
||||
- Make this stuff build on Linux.
|
||||
- Unify all tools into one & obsolete the crappy glue scripts.
|
||||
|
||||
@@ -1,70 +1,34 @@
|
||||
# Standard makefile to use as a base for DJGPP projects
|
||||
# Standard makefile to use as a base for DJGPP projects (not anymore lol)
|
||||
# By MARTINEZ Fabrice aka SNK of SUPREMACY
|
||||
|
||||
# Programs to use during make
|
||||
AR = ar
|
||||
CC = gcc
|
||||
LD = gcc
|
||||
ASM = nasm
|
||||
PACKER = upx
|
||||
LD := $(CC)
|
||||
|
||||
# Flags for debugging
|
||||
#DEBUG=1
|
||||
#SYMBOLS=1
|
||||
TARGET := adpcm
|
||||
SOURCE := adpcm.c
|
||||
|
||||
# Flags for compilation
|
||||
ASMFLAGS = -f coff
|
||||
ifdef SYMBOLS
|
||||
CFLAGS = -o -mpentium -Wall -Werror -g
|
||||
LDFLAGS = -s
|
||||
else
|
||||
CFLAGS = -fomit-frame-pointer -O3 -mpentium -Werror -Wall \
|
||||
CFLAGS := -fomit-frame-pointer -O3 -Werror -Wall \
|
||||
-W -Wno-sign-compare -Wno-unused \
|
||||
-Wpointer-arith -Wbad-function-cast -Wcast-align -Waggregate-return \
|
||||
-pedantic \
|
||||
-Wshadow \
|
||||
-Wstrict-prototypes
|
||||
LDFLAGS =
|
||||
endif
|
||||
CDEFS =
|
||||
ASMDEFS =
|
||||
LDFLAGS := -lm
|
||||
|
||||
# Object files
|
||||
MAINOBJS =
|
||||
|
||||
# Library files
|
||||
MAINLIBS = obj/adpcm.a
|
||||
OBJECT := $(SOURCE:%.c=%.o)
|
||||
|
||||
# Make rules
|
||||
all: adpcm.exe
|
||||
all: $(TARGET)
|
||||
|
||||
adpcm.exe: $(MAINOBJS) $(MAINLIBS)
|
||||
$(LD) $(LDFLAGS) $(MAINOBJS) $(MAINLIBS) -o $@
|
||||
$(TARGET): $(OBJECT)
|
||||
$(LD) $(CFLAGS) $(LDFLAGS) $^ -o $@
|
||||
|
||||
src/%.asm:
|
||||
|
||||
obj/%.o: src/%.c
|
||||
$(CC) $(CDEFS) $(CFLAGS) -c $< -o $@
|
||||
|
||||
obj/%.oa: src/%.asm
|
||||
$(ASM) -o $@ $(ASMFLAGS) $(ASMDEFS) $<
|
||||
|
||||
obj/%.a:
|
||||
$(AR) cr $@ $^
|
||||
%.o: %.c
|
||||
$(CC) $(CFLAGS) -c $< -o $@
|
||||
|
||||
# Rules to manage files
|
||||
pack: adpcm.exe
|
||||
$(PACKER) adpcm.exe
|
||||
|
||||
mkdir:
|
||||
md obj
|
||||
|
||||
.PHONY: clean
|
||||
clean:
|
||||
del obj\*.o
|
||||
del obj\*.a
|
||||
del obj\*.oa
|
||||
del *.exe
|
||||
|
||||
# Rules to make libraries
|
||||
obj/adpcm.a: obj/adpcm.o
|
||||
# obj/decode.oa \
|
||||
rm -f $(TARGET) $(OBJECT)
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
#include <process.h>
|
||||
#include <stdio.h>
|
||||
#include <mem.h>
|
||||
#include <stdlib.h>
|
||||
#include <math.h>
|
||||
#include <io.h>
|
||||
|
||||
#define BUFFER_SIZE 1024*256
|
||||
#define ADPCMA_VOLUME_RATE 1
|
||||
@@ -70,8 +68,11 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
|
||||
adpcm_init();
|
||||
|
||||
Filelen = filelength(fileno(Fp1));
|
||||
|
||||
fseek(Fp1, 0, SEEK_END);
|
||||
Filelen = ftell(Fp1);
|
||||
fseek(Fp1, 0, SEEK_SET);
|
||||
|
||||
*((unsigned int*)(&RiffWave[4])) = Filelen*4 + 0x2C;
|
||||
*((unsigned int*)(&RiffWave[0x28])) = Filelen*4;
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@ CFLAGS = -O3
|
||||
SRC = .
|
||||
OBJ = .
|
||||
|
||||
OUT_OBJ = $(OBJ)/adpcmb.exe
|
||||
OUT_OBJ = $(OBJ)/adpcmb
|
||||
|
||||
all: $(OUT_OBJ)
|
||||
|
||||
|
||||
@@ -1,19 +1,19 @@
|
||||
if ["%~x1"]==[".vgz"] goto vgztopcm else goto vgmtopcm
|
||||
|
||||
:vgmtopcm
|
||||
neoadpcmextract.exe %1
|
||||
goto pcmtowav
|
||||
|
||||
:vgztopcm
|
||||
copy /y %1 temp.vgm.gz
|
||||
gzip.exe -d temp.vgm.gz
|
||||
neoadpcmextract.exe temp.vgm
|
||||
del temp.vgm
|
||||
goto pcmtowav
|
||||
|
||||
:pcmtowav
|
||||
for /r %%v in (smpa_*.pcm) do adpcm.exe "%%v" "%%v.wav"
|
||||
for /r %%v in (smpb_*.pcm) do adpcmb.exe -d "%%v" "%%v.wav"
|
||||
del "*.pcm"
|
||||
mkdir "%~n1"
|
||||
if ["%~x1"]==[".vgz"] goto vgztopcm else goto vgmtopcm
|
||||
|
||||
:vgmtopcm
|
||||
neoadpcmextract.exe %1
|
||||
goto pcmtowav
|
||||
|
||||
:vgztopcm
|
||||
copy /y %1 temp.vgm.gz
|
||||
gzip.exe -d temp.vgm.gz
|
||||
neoadpcmextract.exe temp.vgm
|
||||
del temp.vgm
|
||||
goto pcmtowav
|
||||
|
||||
:pcmtowav
|
||||
for /r %%v in (smpa_*.pcm) do adpcm.exe "%%v" "%%v.wav"
|
||||
for /r %%v in (smpb_*.pcm) do adpcmb.exe -d "%%v" "%%v.wav"
|
||||
del "*.pcm"
|
||||
mkdir "%~n1"
|
||||
move "*.wav" "%~n1"
|
||||
19
neotools/autoextract.sh
Executable file
19
neotools/autoextract.sh
Executable file
@@ -0,0 +1,19 @@
|
||||
#!/bin/sh
|
||||
|
||||
FILE="$1"
|
||||
NAME="$(basename "$FILE")"
|
||||
WAVDIR="${NAME%%.*}"
|
||||
|
||||
if [ "${NAME##*.}" = "vgz" ]; then
|
||||
cp "$FILE" "temp.vgm.gz"
|
||||
gzip -d "temp.vgm.gz"
|
||||
FILE="temp.vgm"
|
||||
fi
|
||||
|
||||
./neoadpcmextract "$FILE"
|
||||
mkdir -p "$WAVDIR"
|
||||
for I in smpa_*.pcm; do ./adpcm "$I" "$WAVDIR/${I%%.*}.wav"; done
|
||||
for I in smpb_*.pcm; do ./adpcmb -d "$I" "$WAVDIR/${I%%.*}.wav"; done
|
||||
find . -type f -name "*.pcm" -exec rm -f {} \;
|
||||
|
||||
[ "$FILE" = "temp.vgm" ] && rm -f "temp.vgm"
|
||||
12
neotools/neoadpcmextract.Makefile
Normal file
12
neotools/neoadpcmextract.Makefile
Normal file
@@ -0,0 +1,12 @@
|
||||
TARGET := neoadpcmextract
|
||||
SOURCE := neoadpcmextract.cpp
|
||||
CXXFLAGS := -O2 -pipe -Wall -Wextra
|
||||
|
||||
all: $(TARGET)
|
||||
|
||||
$(TARGET): $(SOURCE)
|
||||
$(CXX) $(CXXFLAGS) $< -o $@
|
||||
|
||||
.PHONY: clean
|
||||
clean:
|
||||
rm -f $(TARGET)
|
||||
Reference in New Issue
Block a user