Permalink
Browse files

Initial Checkin of all vault programs

  • Loading branch information...
SubDrag committed Sep 14, 2018
1 parent e733bcb commit 4b9b1c0503405f16d8689d7c12efd8e20309b24e
Showing 533 changed files with 392,822 additions and 0 deletions.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.

Large diffs are not rendered by default.

Oops, something went wrong.
Binary file not shown.
@@ -0,0 +1,118 @@
// BY ZOINKITY
#include "StdAfx.h"
#include "BOFSDecoder.h"
CBOFSDecoder::CBOFSDecoder(void)
{
}
CBOFSDecoder::~CBOFSDecoder(void)
{
}
int CBOFSDecoder::_flags(unsigned char* inputBuffer, int& inputPosition, unsigned char& flags, int& flagLeft)
{
if (flagLeft == 0)
{
flagLeft = 8;
flags = inputBuffer[inputPosition++];
}
int value = ((flags&0x80)>0);
flags<<=1;
flagLeft--;
return value;
}
unsigned long CBOFSDecoder::helper(unsigned char* inputBuffer, int& inputPosition, unsigned char& flags, int& flagLeft, int num)
{
//"""Returns a value equal to the next num bits in stream.
//itr should point to the self._flags() method above."""
unsigned long v=0;
for (int i = 0; i < num; i++)
{
v <<=1;
bool flagRet = _flags(inputBuffer, inputPosition, flags, flagLeft);;
v|=flagRet;
}
return v;
}
int CBOFSDecoder::dec(unsigned char* inputBuffer, int compressedSize, int dec_s, unsigned char* output)
{
int inputPosition = 0;
int outputPosition = 0;
unsigned char tbl[0xA] = {0x20, 0x65, 0x74, 0x6F, 0x61, 0x72, 0x6E, 0x69, 0x73, 0x68};
unsigned char flags = 0;
int flagsLeft = 0;
//# init variables
unsigned long cnt = 0;
unsigned long reg = 0;
while (true)
{
if (outputPosition>=dec_s)
break;
unsigned long v = helper(inputBuffer, inputPosition, flags, flagsLeft, 1);
cnt+=1;
reg<<=1;
reg|=v;
if (v != 0)
{
//# bit set
if (cnt<7)
continue;
else if (cnt>7)
break;
output[outputPosition++] = tbl[9];
cnt = 0;
reg = 0;
}
else
{
unsigned long base = 0;
//# bit not set
if ((cnt == 2) || (cnt == 3))
base = 0;
else if ((cnt == 4) || (cnt == 5))
base = 3;
if ((cnt == 6) || (cnt == 7))
base= 6;
else if (cnt > 7)
break;
if (cnt==1)
{
//# if cnt==1 write a byte to file
v = helper(inputBuffer, inputPosition, flags, flagsLeft, 8);
output[outputPosition++] = (v & 0xFF);
}
else
{
//# otherwise, grab a value out of table
if (!(cnt&1))
{
v = helper(inputBuffer, inputPosition, flags, flagsLeft, 1);
reg<<=1;
reg|=v;
}
reg&=3;
reg+=base;
v = tbl[reg];
output[outputPosition++] = (v & 0xFF);
}
cnt = 0;
reg = 0;
}
}
return outputPosition;
}
@@ -0,0 +1,16 @@
// BY ZOINKITY
#pragma once
class CBOFSDecoder
{
public:
CBOFSDecoder(void);
~CBOFSDecoder(void);
int _flags(unsigned char* inputBuffer, int& inputPosition, unsigned char& flags, int& flagLeft);
unsigned long helper(unsigned char* inputBuffer, int& inputPosition, unsigned char& flags, int& flagLeft, int num);
int dec(unsigned char* inputBuffer, int compressedSize, int dec_s, unsigned char* output);
unsigned long bitRegister;
int numBitsInRegister;
};
@@ -0,0 +1,138 @@
#include "StdAfx.h"
#include "BlitzDecoder.h"
CBlitzDecoder::CBlitzDecoder(void)
{
}
CBlitzDecoder::~CBlitzDecoder(void)
{
}
unsigned long CBlitzDecoder::counter(unsigned char*& input, unsigned char cmd, unsigned char mask, int& compressedSize)
{
unsigned long count = cmd & mask;
if (count==0)
{
cmd = *input++;
compressedSize++;
while (cmd==0)
{
count+=0xFF;
cmd = *input++;
compressedSize++;
}
count += (cmd + mask);
}
return count;
}
int CBlitzDecoder::dec(unsigned char* input, unsigned char* output, int& compressedSize)
{
unsigned char* head = output;
int uncompressedSize = 0;
compressedSize = 0;
int skip = 0;
unsigned char cmd = *input++;
compressedSize++;
if (cmd>17)
{
for (int x = 0; x < (cmd-17); x++)
{
*output++ = *input++;
uncompressedSize++;
compressedSize++;
}
}
else
skip = 1;
while (true)
{
cmd = *input++;
compressedSize++;
if (skip==0)
{
// if didn't copy yet, test if you should
if (cmd<16)
{
int count = counter(input, cmd, 15, compressedSize);
for (int x = 0; x < (count+3); x++)
{
*output++ = *input++;
compressedSize++;
uncompressedSize++;
}
cmd = *input++;
compressedSize++;
}
else
{
skip = 1;
}
}
// index from end of file back
int back = (uncompressedSize - 1);
int count = 0;
// handle each bit identifier
if (cmd & 0xC0)
{
back -= ((cmd&0x1C)>>2) + ((*input++)<<3);
compressedSize++;
count = ((cmd&0xE0)>>5) - 1;
}
else if (cmd & 0x20)
{
count = counter(input, cmd, 31, compressedSize);
cmd = *input++;
compressedSize++;
back -= ((*input++)<<6) + (cmd>>2);
compressedSize++;
}
else if (cmd & 0x10)
{
back -= ((cmd&8)<<11);
count = counter(input, cmd, 7, compressedSize);
cmd = *input++;
compressedSize++;
back -= ((*input++)<<6) + (cmd>>2);
compressedSize++;
// if no backtracking, you've hit the end!
if ((back + 1)==uncompressedSize)
break;
back-=0x3FFF;
}
else
{
back -= (((*input++)<<2) + (cmd>>2));
compressedSize++;
// slightly different if you copied
if (skip==0)
{
back -= 0x800;
count = 1;
}
}
// copy count+2 bytes from referenced point
for (int x = 0; x < (count+2); x++)
{
if ((back < 0) || (back >= uncompressedSize))
return 0;
unsigned char val = head[back+x];
*output++ = val;
uncompressedSize++;
}
// directly copy any hanging entry
skip = (cmd&3);
for (int x = 0; x < skip; x++)
{
*output++ = *input++;
compressedSize++;
uncompressedSize++;
}
}
return uncompressedSize;
}
@@ -0,0 +1,12 @@
#pragma once
class CBlitzDecoder
{
public:
CBlitzDecoder(void);
~CBlitzDecoder(void);
unsigned long counter(unsigned char*& input, unsigned char cmd, unsigned char mask, int& compressedSize);
int dec(unsigned char* input, unsigned char* output, int& compressedSize);
};
@@ -0,0 +1,84 @@
#include "StdAfx.h"
#include "BoltDecoder.h"
CBoltDecoder::CBoltDecoder(void)
{
}
CBoltDecoder::~CBoltDecoder(void)
{
}
int CBoltDecoder::dec(unsigned char* input, unsigned char* output, int& compressedSize, int decompressedSize)
{
int inputPosition = 0;
int outputPosition = 0;
unsigned long l = 0;
signed long b = 0;
unsigned long cnt = 0;
//# This catches the stream when decompressedSize isn't provided
try
{
while (true)
{
if ((decompressedSize > 0) && (outputPosition >= decompressedSize))
break;
unsigned long cmd = input[inputPosition++];
if (cmd<0x80)
{
//# (cmd&0xF) NOR (b<<4)
b<<=4;
b|= (cmd&0xF);
b = outputPosition + (~b);
l<<=3;
l|= (cmd>>4);
l+=cnt;
for (int i = 0; i < (l+2); i++)
{
unsigned char v = output[b+i];
output[outputPosition++] = v;
}
l = 0;
b = 0;
cnt = 0;
continue;
}
else if (cmd<0x90)
{
l<<=4;
l+= (cmd&0xF);
for (int i = 0; i < (l+1); i++)
{
output[outputPosition++] = input[inputPosition++];
}
l = 0;
cnt = 0;
continue;
}
else if (cmd<0xA0)
{
l = cmd&3;
cmd>>=2;
b = cmd&3;
}
else if (cmd<0xC0)
{
l<<=5;
l|= (cmd&0x1F);
}
else
{
b<<=6;
b|= (cmd&0x3F);
}
cnt+=1;
}
}
catch (...)
{
}
return outputPosition;
}
@@ -0,0 +1,11 @@
// By Zoinkity
#pragma once
class CBoltDecoder
{
public:
CBoltDecoder(void);
~CBoltDecoder(void);
int dec(unsigned char* input, unsigned char* output, int& compressedSize, int decompressedSize);
};
Oops, something went wrong.

0 comments on commit 4b9b1c0

Please sign in to comment.