The mod launcher will be an edge case for advanced users if the .fip method moves forward, no checks needed

This commit is contained in:
ChrisMiuchiz 2019-10-15 00:51:43 -04:00
parent 88ce62f934
commit 1c146526cb
1 changed files with 2 additions and 46 deletions

View File

@ -3,13 +3,6 @@
#include <windows.h>
#include <vector>
#include "Process.h"
#include "crc.h"
#define CUBE_VERSION "1.0.0-1"
#define CUBE_PACKED_CRC 0xC7682619
#define CUBE_UNPACKED_CRC 0xBA092543
#define MODLOADER_CRC 0x39D18E98
char* CUBE_EXECUTABLE = "cubeworld.exe";
char* MODLOADER_DLL = "CubeModLoader.dll";
@ -28,13 +21,8 @@ int Bail(int result){
}
int main(int argc, char** argv) {
bool testMode = false;
if (argc >= 2 && !strcmp(argv[1], "test")) {
testMode = true;
printf("Test mode enabled. CRC checks will be bypassed.\n");
if (argc >= 3) {
CUBE_EXECUTABLE = argv[2];
}
if (argc >= 2) {
CUBE_EXECUTABLE = argv[1];
}
//Cube world is obviously required
@ -43,44 +31,12 @@ int main(int argc, char** argv) {
return Bail(1);
}
unsigned int checksum = crc32_file(CUBE_EXECUTABLE);
if (testMode) {
printf("%s CRC: %08X\n", CUBE_EXECUTABLE, checksum);
}
// Check if the game is still packed
if (checksum == CUBE_PACKED_CRC && !testMode) {
printf("Cube World was found, but it is not unpacked.\n"
"Use Steamless to unpack %s.\n", CUBE_EXECUTABLE);
return Bail(1);
}
if (checksum != CUBE_UNPACKED_CRC && !testMode) {
printf("Cube World was found, but it is not version %s.\n"
"(Found CRC %08X, expected %08X)\n"
"Please update your game.\n",
CUBE_VERSION, checksum, CUBE_UNPACKED_CRC);
return Bail(1);
}
//Inject our dll
if ( !FileExists(MODLOADER_DLL) ) {
printf("%s not found.\n", MODLOADER_DLL);
return Bail(1);
}
unsigned int loaderChecksum = crc32_file(MODLOADER_DLL);
if (loaderChecksum != MODLOADER_CRC && !testMode) {
printf("%s is the wrong version (%08X)\n", MODLOADER_DLL, loaderChecksum);
return Bail(1);
}
if (testMode) {
printf("%s CRC: %08X\n", MODLOADER_DLL, loaderChecksum);
}
Process process(CUBE_EXECUTABLE);
//Create game in suspended state