-
Notifications
You must be signed in to change notification settings - Fork 0
/
Fiesta.cpp
71 lines (49 loc) · 1.72 KB
/
Fiesta.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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
#include <windows.h>
#include <iostream>
#include "Fiesta.h"
FiestaSettings* Fiesta::Settings = new FiestaSettings();
FiestaProcess* Fiesta::Process = new FiestaProcess();
extern ExtraMenuTextures* extraMenuTextures = new ExtraMenuTextures();
extern CustomClasses* customClasses = new CustomClasses();
DWORD WINAPI Fiesta::Install(LPVOID lpParameter)
{
Process->Initialize();
Settings->SetDllInstance(static_cast<HMODULE>(lpParameter));
char iniPath[MAX_PATH] = { 0 };
sprintf_s(iniPath, "%sFiesta.ini", Process->GetDirectory());
int loadSettingsError = Settings->LoadSettings(iniPath);
switch (loadSettingsError)
{
case LoadSettings_File_Not_Found:
MessageBox(nullptr, "Could not find the file \"Fiesta.ini\"", "Fiesta", MB_ICONERROR);
// TODO: Leigh said to pause the process before we do anything- ASK HIM HOW
//Process->ResumeAllThreads();
return 0;
break;
}
bool hasInitializedAllHooks = true;
hasInitializedAllHooks &= extraMenuTextures->Initialize(Process);
hasInitializedAllHooks &= customClasses->Initialize(Process);
if (!hasInitializedAllHooks)
{
MessageBox(nullptr, "Failed to initialize all hooks", "Fiesta", MB_ICONERROR);
return 0;
}
int patchError = Process->PatchCode();
if (patchError > 0)
{
char patchErrorMessage[256];
sprintf_s(patchErrorMessage, 256, "There was an error patching Fiesta. Error Code %d", patchError);
MessageBox(NULL, patchErrorMessage, "Fiesta", MB_ICONERROR);
return 0;
}
bool hookError = Process->InstallDetours();
if (hookError)
{
char hookErrorMessage[256];
sprintf_s(hookErrorMessage, 256, "There was an error modifying Fiesta. Error Code %d", hookError);
MessageBox(NULL, hookErrorMessage, "Fiesta", MB_ICONERROR);
return 0;
}
return 0;
}