diff --git a/sandec/Makefile b/sandec/Makefile index c4cbb87..a829109 100644 --- a/sandec/Makefile +++ b/sandec/Makefile @@ -1,7 +1,7 @@ all: sandec sandec: - winegcc -mconsole -mno-cygwin -o sandec sandec.c + winegcc -m32 -mconsole -mno-cygwin -o sandec sandec.c clean: -rm -f sandec sandec.exe.so *~ \#*\# diff --git a/sandec/USAGE b/sandec/USAGE new file mode 100644 index 0000000..fada169 --- /dev/null +++ b/sandec/USAGE @@ -0,0 +1,2 @@ +make +wine ./sandec.exe.so [filename] diff --git a/sandec/convert_all_raw_files.sh b/sandec/convert_all_raw_files.sh new file mode 100755 index 0000000..b5f61af --- /dev/null +++ b/sandec/convert_all_raw_files.sh @@ -0,0 +1,3 @@ +#!/bin/bash + +ls *.raw | xargs -i wine ./sandec.exe.so {} diff --git a/sandec/get_dll.sh b/sandec/get_dll.sh new file mode 100755 index 0000000..a0fc3a4 --- /dev/null +++ b/sandec/get_dll.sh @@ -0,0 +1,23 @@ +#!/bin/bash + +if ! [ -x "$(command -v cabextract)" ]; then + echo "cabextract not found." + exit 1; +fi + +if ! [ -x "$(command -v unshield)" ]; then + echo "unshield not found." + exit 1; +fi + +mkdir work_tmp; +cd work_tmp; +wget http://www.olympusamerica.com/files/oima_cckb/DigitalWavePlayerUpdate214.zip; +unzip DigitalWavePlayerUpdate214.zip; +cd Vista+AMD; +cabextract DWPUP5EN.exe; +cd Disk1; +unshield x data1.cab +cp "_v___O_____DLL_(____________)/san_dec.dll" ../../../; +cd ../../../; +rm -rf work_tmp; diff --git a/sandec/san_dec.dll b/sandec/san_dec.dll new file mode 100644 index 0000000..4b50fe5 Binary files /dev/null and b/sandec/san_dec.dll differ diff --git a/sandec/sandec.c b/sandec/sandec.c index f6d5fea..bcd410b 100644 --- a/sandec/sandec.c +++ b/sandec/sandec.c @@ -2,6 +2,7 @@ #include #include #include +#include typedef int (__cdecl *SAN_DEC)(uint8_t *in, uint8_t *out, int mode, int bit_size); typedef int (__cdecl *SAN_DEC_PULCOD2_INIT)(int a, int b); @@ -80,7 +81,7 @@ Ussage: sandec [filename].raw\n"); HINSTANCE hLibrary = LoadLibrary("san_dec.dll"); if (hLibrary == NULL) - { + { printf("Unable to load san_dec.dll!\n"); return -1; } @@ -112,10 +113,10 @@ Ussage: sandec [filename].raw\n"); int bit_size = 16; int mode = 1; - fd = open(argv[1],O_RDONLY|O_BINARY); + fd = open(argv[1], O_RDONLY|O_BINARY); if(fd<0) { - printf("Unable to open '%s'!\n",argv[1]); + printf("Unable to open '%s' for reading!\n",argv[1]); return -1; } @@ -168,12 +169,16 @@ Ussage: sandec [filename].raw\n"); filename[str_len-4] = '.'; fd2 = open(filename, O_CREAT|O_WRONLY|O_BINARY|O_EXCL); + if(fd2<0) { - printf("Unable to open '%s'!\n", filename); + char cwd[512]; + getcwd(cwd, sizeof(cwd)); + + printf("Unable to open '%s' for writing! Return code %d, cwd %s \n", filename, fd2, cwd); return -1; } - + ret = wave_header(out, 0, freq); ret = write(fd2, out, ret);