➕ Add miniz source code
This commit is contained in:
parent
d541b16d39
commit
d390e0affe
8 changed files with 8955 additions and 17 deletions
5
.vscode/settings.json
vendored
Normal file
5
.vscode/settings.json
vendored
Normal file
|
@ -0,0 +1,5 @@
|
|||
{
|
||||
"files.associations": {
|
||||
"filereader.h": "c"
|
||||
}
|
||||
}
|
27
README.md
27
README.md
|
@ -2,6 +2,29 @@ This tool installs a patch, assuming the patch files are already downloaded, and
|
|||
|
||||
# Dependencies
|
||||
|
||||
Miniz
|
||||
## Miniz <[https://github.com/richgel999/miniz](https://github.com/richgel999/miniz)>
|
||||
|
||||
Xdelta3
|
||||
Copyright 2013-2014 RAD Game Tools and Valve Software
|
||||
Copyright 2010-2014 Rich Geldreich and Tenacious Software LLC
|
||||
|
||||
All Rights Reserved.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
|
||||
## Xdelta3
|
||||
|
|
7563
lib/miniz/miniz.c
Normal file
7563
lib/miniz/miniz.c
Normal file
File diff suppressed because it is too large
Load diff
1328
lib/miniz/miniz.h
Normal file
1328
lib/miniz/miniz.h
Normal file
File diff suppressed because it is too large
Load diff
BIN
miniz-2.0.7.zip
Normal file
BIN
miniz-2.0.7.zip
Normal file
Binary file not shown.
26
src/fileReader.c
Normal file
26
src/fileReader.c
Normal file
|
@ -0,0 +1,26 @@
|
|||
//for printf()
|
||||
#include <stdio.h>
|
||||
//for errno
|
||||
#include <errno.h>
|
||||
//for strerror()
|
||||
#include <string.h>
|
||||
|
||||
#include "fileReader.h"
|
||||
|
||||
void initFileReader(unsigned char path[], unsigned long offset, unsigned long length) {
|
||||
//Opens the given file at the given address
|
||||
//Returns a function that will read into memory and return that memory.
|
||||
|
||||
FILE *fileFrom = NULL;
|
||||
char* fileName = path;
|
||||
|
||||
fileFrom = fopen(fileName, "r");
|
||||
if (fileFrom == NULL) {
|
||||
fprintf(stderr, "Could not open file %s for reading: %s\n", fileName, strerror(errno));
|
||||
//error();
|
||||
}
|
||||
}
|
||||
|
||||
unsigned char* readBytes(unsigned long numBytes) {
|
||||
//TODO
|
||||
}
|
5
src/fileReader.h
Normal file
5
src/fileReader.h
Normal file
|
@ -0,0 +1,5 @@
|
|||
#pragma once
|
||||
|
||||
void initFileReader(unsigned char path[], unsigned long offset, unsigned long length);
|
||||
|
||||
unsigned char* readBytes(unsigned long numBytes);
|
18
src/main.c
18
src/main.c
|
@ -7,28 +7,16 @@
|
|||
|
||||
//Import our code
|
||||
#include "decrypt.h"
|
||||
|
||||
void getFileReader(unsigned char path[], unsigned long offset, unsigned long length) {
|
||||
//Opens the given file at the given address
|
||||
//Returns a function that will read into memory and return that memory.
|
||||
|
||||
FILE *fileFrom = NULL;
|
||||
char* fileName = path;
|
||||
|
||||
fileFrom = fopen(fileName, "r");
|
||||
if (fileFrom == NULL) {
|
||||
fprintf(stderr, "Could not open file %s for reading: %s\n", fileName, strerror(errno));
|
||||
//error();
|
||||
}
|
||||
}
|
||||
#include "fileReader.h"
|
||||
|
||||
int main(int argc, unsigned char *argv[]) {
|
||||
printf("Hello World!\n");
|
||||
|
||||
//Initialise file reader
|
||||
getFileReader("1234", 0, 10);
|
||||
initFileReader("1234", 0, 10);
|
||||
|
||||
//Skip header (30 bytes + additional length)
|
||||
readBytes(30);
|
||||
|
||||
//Initialise decryption (pass decryption keys)
|
||||
|
||||
|
|
Loading…
Reference in a new issue