-
Notifications
You must be signed in to change notification settings - Fork 12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Sandec fix #47
base: master
Are you sure you want to change the base?
Sandec fix #47
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
make | ||
wine ./sandec.exe.so [filename] |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
#!/bin/bash | ||
|
||
ls *.raw | xargs -i wine ./sandec.exe.so {} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Here's a little bash trick for you. TMP=$(mktemp -d)
trap "rm -rf $TMP" EXIT You'll have a temporary directory that won't collide and will automatically get cleaned up. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Cool :) |
||
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; |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,6 +2,7 @@ | |
#include <stdint.h> | ||
#include <stdio.h> | ||
#include <fcntl.h> | ||
#include <unistd.h> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is probably related to a bugfix in the compiler. Some of the calls in here, like |
||
|
||
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) | ||
{ | ||
{ | ||
jchillerup marked this conversation as resolved.
Show resolved
Hide resolved
|
||
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)); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Check the return value of There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Makes sense. |
||
|
||
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); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using
set -euo pipefail
makes bash development a little easier and more robust.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's nice, didn't know about that either