This repository has been archived by the owner on Sep 19, 2022. It is now read-only.
forked from arves100/ffloader
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Globals.cpp
57 lines (48 loc) · 1.39 KB
/
Globals.cpp
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
/*!
@date 06/02/2022
@author Arves100
@file Globals.cpp
@brief project main singleton and global configuration
*/
#include "StdAfx.h"
#include "Globals.h"
Globals::~Globals()
{
delete TheLoader;
ms_pSingleton = nullptr;
}
Globals::Globals()
{
ms_pSingleton = this;
TheLoader = new Loader();
LoaderUseFullFunctions = false;
GameWindow = nullptr;
GamePID = 0;
GameProcess = nullptr;
GameModule = nullptr;
memset(GameDiskPath, 0, sizeof(GameDiskPath));
BaseAddress = nullptr;
WindowedMode = false;
TheArena = new DPMsgArena(1024 * 1024 * 20); // 20MB
if (!TheLoader || !TheArena)
FATAL("Unable to allocate loader memory");
}
Globals* Globals::ms_pSingleton = nullptr;
void Globals::Fatal(const wchar_t* error, const wchar_t* file, size_t line)
{
std::wstring rsz = L"Unable to initialize the loader!\nPlease check if the installation was correct, and the game was launched with administrator privileges\notherwise, please contact the developers or open an issue.\n\n";
rsz += L"Error: ";
rsz += error;
rsz += L"\n";
#ifdef _DEBUG
rsz += L"File: ";
rsz += file;
rsz += L"\nLine: ";
rsz += std::to_wstring(line);
rsz += L"\n";
#endif
rsz += L"\n";
rsz += L"By pressing OK, the game will now close. (There might be a crash error, don't worry it's normal just ignore it and don't send any report)";
MessageBoxW(GameWindow, rsz.c_str(), L"Loader error", MB_OK | MB_ICONERROR);
CRASH;
}