mirror of
https://github.com/geode-sdk/geode.git
synced 2024-11-23 16:07:52 -05:00
Merge 4ce4fd972b
into e5dd2c9c40
This commit is contained in:
commit
cc2459433f
1 changed files with 18 additions and 0 deletions
|
@ -138,11 +138,29 @@ void* mainTrampolineAddr;
|
||||||
#include "gdTimestampMap.hpp"
|
#include "gdTimestampMap.hpp"
|
||||||
unsigned int gdTimestamp = 0;
|
unsigned int gdTimestamp = 0;
|
||||||
|
|
||||||
|
// In case the game is launched from a different directory through command line
|
||||||
|
// this function will set the current working directory to the game's directory
|
||||||
|
// to avoid the game crashing due to not being able to find the resources
|
||||||
|
static void fixCWD() {
|
||||||
|
char cwd[1024];
|
||||||
|
DWORD size = GetModuleFileNameA(NULL, cwd, sizeof(cwd));
|
||||||
|
if (size == sizeof(cwd)) return;
|
||||||
|
for (int i = size - 1; i >= 0; i--) {
|
||||||
|
if (cwd[i] == '\\') {
|
||||||
|
cwd[i] = '\0';
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
SetCurrentDirectoryA(cwd);
|
||||||
|
}
|
||||||
|
|
||||||
int WINAPI gdMainHook(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPWSTR lpCmdLine, int nCmdShow) {
|
int WINAPI gdMainHook(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPWSTR lpCmdLine, int nCmdShow) {
|
||||||
// MessageBoxA(NULL, "Hello from gdMainHook!", "Hi", 0);
|
// MessageBoxA(NULL, "Hello from gdMainHook!", "Hi", 0);
|
||||||
|
|
||||||
updateGeode();
|
updateGeode();
|
||||||
|
|
||||||
|
fixCWD();
|
||||||
|
|
||||||
if (versionToTimestamp(GEODE_STR(GEODE_GD_VERSION)) > gdTimestamp) {
|
if (versionToTimestamp(GEODE_STR(GEODE_GD_VERSION)) > gdTimestamp) {
|
||||||
console::messageBox(
|
console::messageBox(
|
||||||
"Unable to Load Geode!",
|
"Unable to Load Geode!",
|
||||||
|
|
Loading…
Reference in a new issue