1
0
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:
2019-09-30 17:14:07 +10:00
parent fbf887b534
commit 7c66bbab52
2 changed files with 5 additions and 5 deletions

View File

@@ -1,4 +1,5 @@
#!/bin/sh
set -e
FILE="$1"
NAME="$(basename "$FILE")"
@@ -6,7 +7,7 @@ WAVDIR="${NAME%%.*}"
if [ "${NAME##*.}" = "vgz" ]; then
cp "$FILE" "temp.vgm.gz"
gzip -d "temp.vgm.gz"
gzip -fd "temp.vgm.gz"
FILE="temp.vgm"
fi

View File

@@ -55,20 +55,19 @@ void DumpBytes(std::string a_path, const std::vector<uint8_t>& a_bytes)
int main(int argc, char** argv)
{
if (argc != 2)
return -1;
return 1;
// Open file.
FILE* file = fopen(argv[1], "rb");
if (!file)
return -1;
return 1;
// Search for pcm headers.
std::vector<uint8_t> smpBytes;
int smpaCount = 0, smpbCount = 0;
while (!feof(file) && !ferror(file))
{
if (fgetc(file) != 0x67 &&
fgetc(file) != 0x66)
if (fgetc(file) != 0x67 || fgetc(file) != 0x66)
continue;
uint8_t byte = fgetc(file);