mirror of
https://github.com/ScrelliCopter/VGM-Tools
synced 2025-02-21 04:09:25 +11:00
fix some error prone stuff, also I goofed the short circuit... oops
This commit is contained in:
@@ -1,4 +1,5 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
set -e
|
||||||
|
|
||||||
FILE="$1"
|
FILE="$1"
|
||||||
NAME="$(basename "$FILE")"
|
NAME="$(basename "$FILE")"
|
||||||
@@ -6,7 +7,7 @@ WAVDIR="${NAME%%.*}"
|
|||||||
|
|
||||||
if [ "${NAME##*.}" = "vgz" ]; then
|
if [ "${NAME##*.}" = "vgz" ]; then
|
||||||
cp "$FILE" "temp.vgm.gz"
|
cp "$FILE" "temp.vgm.gz"
|
||||||
gzip -d "temp.vgm.gz"
|
gzip -fd "temp.vgm.gz"
|
||||||
FILE="temp.vgm"
|
FILE="temp.vgm"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|||||||
@@ -55,20 +55,19 @@ void DumpBytes(std::string a_path, const std::vector<uint8_t>& a_bytes)
|
|||||||
int main(int argc, char** argv)
|
int main(int argc, char** argv)
|
||||||
{
|
{
|
||||||
if (argc != 2)
|
if (argc != 2)
|
||||||
return -1;
|
return 1;
|
||||||
|
|
||||||
// Open file.
|
// Open file.
|
||||||
FILE* file = fopen(argv[1], "rb");
|
FILE* file = fopen(argv[1], "rb");
|
||||||
if (!file)
|
if (!file)
|
||||||
return -1;
|
return 1;
|
||||||
|
|
||||||
// Search for pcm headers.
|
// Search for pcm headers.
|
||||||
std::vector<uint8_t> smpBytes;
|
std::vector<uint8_t> smpBytes;
|
||||||
int smpaCount = 0, smpbCount = 0;
|
int smpaCount = 0, smpbCount = 0;
|
||||||
while (!feof(file) && !ferror(file))
|
while (!feof(file) && !ferror(file))
|
||||||
{
|
{
|
||||||
if (fgetc(file) != 0x67 &&
|
if (fgetc(file) != 0x67 || fgetc(file) != 0x66)
|
||||||
fgetc(file) != 0x66)
|
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
uint8_t byte = fgetc(file);
|
uint8_t byte = fgetc(file);
|
||||||
|
|||||||
Reference in New Issue
Block a user