Skip to content

Commit

Permalink
init
Browse files Browse the repository at this point in the history
  • Loading branch information
skeletonmage committed May 9, 2017
0 parents commit 962d64c
Show file tree
Hide file tree
Showing 2 changed files with 67 additions and 0 deletions.
11 changes: 11 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
Put it somewhere in your path and run it like this:

vooblyslpdecode slp_in.slp slp_out.slp

For automation, create a dir called "decoded", and run the following in a CMD:

for %I in (*.slp) do vooblyslpdecode "%I" "decoded\%~nI.slp"

Compiled with:

gcc -s -static -o vooblyslpdecode.exe vooblyslpdecode.c
56 changes: 56 additions & 0 deletions vooblyslpdecode.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
#include <stdio.h>
#include <stdlib.h>

typedef unsigned char uchar;
typedef unsigned int uint;

FILE*
fopen_f(const char *path, const char *mode)
{
FILE *f;

f = fopen(path, mode);

if(f == NULL) {
fprintf(stderr, "error: couldn't open file (create the directory?) %s\n", path);
exit(1);
}

return f;
}

int main(int argc, char *argv[])
{
uchar *fslp;
uint beef1337;
int fsize, i;
FILE *f;

if(argc < 3) {
fprintf(stderr, "usage: vooblyslpdecode slp_in.slp slp_out.slp\n");
return 1;
}

f = fopen_f(argv[1], "rb");
fread(&beef1337, 1, 4, f);

if(beef1337 != 0xBEEF1337) {
fprintf(stderr, "error: not a voobly encoded slp file\n");
return 1;
}

fseek(f, 0, SEEK_END);
fsize = ftell(f) - 4;
fseek(f, 4, SEEK_SET);

fslp = malloc(fsize);
fread(fslp, 1, fsize, f);
fclose(f);

for(i = 0; i < fsize; i++)
fslp[i] = 0x20 * ((fslp[i] - 17) ^ 0x23) | ((uchar)((fslp[i] - 17) ^ 0x23) >> 3);

f = fopen_f(argv[2], "wb");
fwrite(fslp, 1, fsize, f);
fclose(f);
}

0 comments on commit 962d64c

Please sign in to comment.