forked from InLiothixi/stabledecompile
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
58 lines (47 loc) · 1.45 KB
/
main.cpp
File metadata and controls
58 lines (47 loc) · 1.45 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#include "LawnApp.h"
#include "Resources.h"
#include "Sexy.TodLib/TodStringFile.h"
#include "GameConstants.h"
using namespace Sexy;
bool (*gAppCloseRequest)(); //[0x69E6A0]
bool (*gAppHasUsedCheatKeys)(); //[0x69E6A4]
SexyString (*gGetCurrentLevelName)();
//0x44E8F0
#include <shlwapi.h>
std::string GetExeDirectory() {
char exePath[MAX_PATH];
GetModuleFileNameA(NULL, exePath, MAX_PATH);
PathRemoveFileSpecA(exePath);
return std::string(exePath);
}
int WINAPI WinMain(_In_ HINSTANCE hInstance, _In_opt_ HINSTANCE hPrevInstance, _In_ LPSTR lpCmdLine, _In_ int nCmdShow)
{
gHInstance = hInstance;
#if defined(_SHOW_OUTPUT_CONSOLE)
AllocConsole();
FILE* dummy;
freopen_s(&dummy, "CONIN$", "r", stdin);
freopen_s(&dummy, "CONOUT$", "w", stdout);
freopen_s(&dummy, "CONOUT$", "w", stderr);
#endif
TodStringListSetColors(gLawnStringFormats, gLawnStringFormatCount);
gGetCurrentLevelName = LawnGetCurrentLevelName;
gAppCloseRequest = LawnGetCloseRequest;
gAppHasUsedCheatKeys = LawnHasUsedCheatKeys;
gLawnApp = new LawnApp();
std::string exeDir = GetExeDirectory();
if (Sexy::FileExists(exeDir + "\\properties\\resources.xml")) {
gLawnApp->mChangeDirTo = exeDir;
}
else {
gLawnApp->mChangeDirTo = (!Sexy::FileExists(_S("properties\\resources.xml")) &&
Sexy::FileExists(_S("..\\properties\\resources.xml"))) ?
_S("..") : _S(".");
}
gLawnApp->Init();
gLawnApp->Start();
gLawnApp->Shutdown();
if (gLawnApp)
delete gLawnApp;
return 0;
};