diff --git a/Makefile b/Makefile index 0aa0c17..26e9e66 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,9 @@ all: - gcc -Iinclude main.c -Llib -lkirk -o decrypt_sp - + gcc -Iinclude main.c -Llib -lkirk -static -O2 -s -o decrypt_sp + strip decrypt_sp + gcc -v + file decrypt_sp + ldd decrypt_sp + clean: - rm decrypt_sp \ No newline at end of file + rm decrypt_sp diff --git a/README.md b/README.md index a70b7d6..427a550 100644 --- a/README.md +++ b/README.md @@ -40,6 +40,8 @@ git clone https://github.com/ProximaV/kirk-engine-full cd kirk-engine-full +git checkout 883f992c02f12639d66be64c42f9771ab5f93691 + make cd .. diff --git a/lib/libkirk-x86.a b/lib/libkirk-x86.a new file mode 100644 index 0000000..0d36ef8 Binary files /dev/null and b/lib/libkirk-x86.a differ diff --git a/lib/libkirk-x86_64.a b/lib/libkirk-x86_64.a new file mode 100644 index 0000000..ccf52ca Binary files /dev/null and b/lib/libkirk-x86_64.a differ diff --git a/lib/libkirk.a_readme.txt b/lib/libkirk.a_readme.txt index f11c4fd..701e05a 100644 --- a/lib/libkirk.a_readme.txt +++ b/lib/libkirk.a_readme.txt @@ -1 +1 @@ -https://github.com/ProximaV/kirk-engine-full \ No newline at end of file +https://github.com/ProximaV/kirk-engine-full/commit/883f992c02f12639d66be64c42f9771ab5f93691 \ No newline at end of file diff --git a/main.c b/main.c index b221f23..70e50eb 100644 --- a/main.c +++ b/main.c @@ -1,14 +1,14 @@ -#include +#include +#include +#include +#include #include #include -#include -#include -#include +#include +#include #include #include -#include -#include -#include +#include "kirk_engine.h" unsigned char buffer[10000000] __attribute__((aligned(64))); @@ -368,7 +368,7 @@ int EncryptFile(char *input, char *output) { int outsize; - memset(buffer,0, sizeof(buffer)); + memset(buffer, 0, sizeof(buffer)); int size = ReadFile(input, buffer+0x150, sizeof(buffer)-0x150); if (size < 0) { @@ -400,17 +400,32 @@ void DecryptDir(char *indir, char *outdir) { dfd = opendir(indir); if (dfd != NULL) { + #ifdef __MINGW32__ + struct dirent *de; + #else struct dirent de, *dep; + #endif - memset(&de, 0, sizeof(struct dirent)); +// memset(&de, 0, sizeof(struct dirent)); + memset(&de, 0, sizeof(de)); + #ifdef __MINGW32__ + while ((de = readdir(dfd)) != NULL) { + sprintf(input, "%s/%s", indir, de->d_name); + sprintf(output, "%s/%s", outdir, de->d_name); + #else while (readdir_r(dfd, &de, &dep) == 0 && dep != NULL) { sprintf(input, "%s/%s", indir, de.d_name); sprintf(output, "%s/%s", outdir, de.d_name); + #endif output[strlen(output)-4] = 0; // remove enc extension + #ifdef __MINGW32__ + if ((de->d_name[0] != '.') && (strcmp(de->d_name, "msid.bin"))) { + #else if ((de.d_name[0] != '.') && (strcmp(de.d_name, "msid.bin"))) { + #endif if (DecryptFile(input, output) != 0) { // } else { @@ -429,15 +444,30 @@ void EncryptDir(char *indir, char *outdir) { dfd = opendir(indir); if (dfd != NULL) { + #ifdef __MINGW32__ + struct dirent *de; + #else struct dirent de, *dep; + #endif - memset(&de, 0, sizeof(struct dirent)); +// memset(&de, 0, sizeof(struct dirent)); + memset(&de, 0, sizeof(de)); + #ifdef __MINGW32__ + while ((de = readdir(dfd)) != NULL) { + sprintf(input, "%s/%s", indir, de->d_name); + sprintf(output, "%s/%s.%s", outdir, de->d_name, "enc"); + #else while (readdir_r(dfd, &de, &dep) == 0 && dep != NULL) { sprintf(input, "%s/%s", indir, de.d_name); sprintf(output, "%s/%s.%s", outdir, de.d_name, "enc"); + #endif + #ifdef __MINGW32__ + if ((de->d_name[0] != '.') && (strcmp(de->d_name, "msid.bin")) && (strcmp(de->d_name, "banner.bin"))) { + #else if ((de.d_name[0] != '.') && (strcmp(de.d_name, "msid.bin")) && (strcmp(de.d_name, "banner.bin"))) { + #endif if (EncryptFile(input, output) != 0) { // } else { @@ -498,8 +528,11 @@ int main(int argc, char **argv) { printf("Error: GetMSID() failed.\n"); return -1; } - + #ifdef __MINGW32__ + mkdir("dec"); + #else mkdir("dec", 0777); + #endif DecryptDir("prx", "dec"); } else if (!strcmp(argv[1], "-e")) { printf("Encrypt mode...\n"); @@ -515,8 +548,11 @@ int main(int argc, char **argv) { printf("Error: GetBanner() failed.\n"); return -1; } - + #ifdef __MINGW32__ + mkdir("enc"); + #else mkdir("enc", 0777); + #endif EncryptDir("dec", "enc"); } else { printf("Error: incorrect mode.\n"); diff --git a/windows.ms32mg32 b/windows.ms32mg32 new file mode 100644 index 0000000..e8656ea --- /dev/null +++ b/windows.ms32mg32 @@ -0,0 +1,16 @@ +exe = decrypt_sp +arc = -x86 +ext = .exe + +all: + gcc -Iinclude main.c -Llib -lkirk$(arc) -static -O2 -s -o $(exe)$(arc)$(ext) + strip $(exe)$(arc)$(ext) + gcc -v 2>&1 | grep Target > $(exe)$(arc).txt + gcc -v 2>&1 | grep "gcc " >> $(exe)$(arc).txt + unix2dos $(exe)$(arc).txt + file $(exe)$(arc)$(ext) + ldd "$(exe)$(arc)$(ext)" + +clean: + rm $(exe)$(arc).txt + rm $(exe)$(arc)$(ext) diff --git a/windows.ms32mg64 b/windows.ms32mg64 new file mode 100644 index 0000000..1f9124f --- /dev/null +++ b/windows.ms32mg64 @@ -0,0 +1,16 @@ +exe = decrypt_sp +arc = -x86_64 +ext = .exe + +all: + gcc -Iinclude main.c -Llib -lkirk$(arc) -static -O2 -s -o $(exe)$(arc)$(ext) + strip $(exe)$(arc)$(ext) + gcc -v 2>&1 | grep Target > $(exe)$(arc).txt + gcc -v 2>&1 | grep "gcc " >> $(exe)$(arc).txt + unix2dos $(exe)$(arc).txt + file $(exe)$(arc)$(ext) + ldd "$(exe)$(arc)$(ext)" + +clean: + rm $(exe)$(arc).txt + rm $(exe)$(arc)$(ext)