diff --git a/CubeModLauncher/Process.cpp b/CubeModLauncher/Process.cpp index 3a18f2a..1dd0b57 100644 --- a/CubeModLauncher/Process.cpp +++ b/CubeModLauncher/Process.cpp @@ -26,7 +26,7 @@ bool Process::InjectDLL(string dllName) { } bool Process::Create() { return CreateProcess(NULL, - "Cube.exe", + (char*)path.c_str(), NULL, NULL, true, diff --git a/CubeModLauncher/crc.cpp b/CubeModLauncher/crc.cpp index b69c3b3..48247a3 100644 --- a/CubeModLauncher/crc.cpp +++ b/CubeModLauncher/crc.cpp @@ -57,12 +57,18 @@ unsigned int crc32_buf(const char* buf, unsigned long len) unsigned int crc32_file(const char* fileName){ FILE* file = fopen(fileName, "rb"); + fseek(file, 0, SEEK_END); int fileSize = ftell(file); - char* fileContents = new char[fileSize]; + char* fileContents = new char[fileSize+1]; + + fseek(file, 0, SEEK_SET); fread(fileContents, 1, fileSize, file); fclose(file); + int result = crc32_buf(fileContents, fileSize); + delete[] fileContents; + return result; } diff --git a/CubeModLauncher/main.cpp b/CubeModLauncher/main.cpp index 818c668..ce6fde3 100644 --- a/CubeModLauncher/main.cpp +++ b/CubeModLauncher/main.cpp @@ -6,7 +6,7 @@ #include "crc.h" #define CUBE_VERSION "1.0.0-0" -#define CUBE_CRC 0x00000000 +#define CUBE_CRC 0x6AFF99F7 using namespace std; @@ -38,13 +38,14 @@ int main() } //The callback manager is required. - if ( !FileExists("CallbackManager.dll") ){ + /*if ( !FileExists("CallbackManager.dll") ){ printf("Callback manager not found.\n"); Sleep(1000); return 1; } modDLLs.push_back( std::string("CallbackManager.dll") ); + */ Process process("Cube.exe");