forked from tiltedphoques/TiltedEvolution
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.cpp
67 lines (52 loc) · 2.19 KB
/
main.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
#include <TiltedOnlineApp.h>
#include <TiltedOnlinePCH.h>
#include <Commctrl.h>
#include <Windows.h>
#include <base/dialogues/win/TaskDialog.h>
std::unique_ptr<TiltedOnlineApp> g_appInstance{nullptr};
extern HICON g_SharedWindowIcon;
static void ShowAddressLibraryError(const wchar_t* apGamePath)
{
#if TP_SKYRIM64
auto errorDetail = fmt::format(L"Looking for it here: {}\\Data\\SKSE\\Plugins", apGamePath);
Base::TaskDialog dia(g_SharedWindowIcon, L"Error", L"Failed to load Skyrim Address Library", L"Make sure to use the All in one (Anniversary Edition) even if you don't have the Anniversary Edition upgrade", errorDetail.c_str());
#elif TP_FALLOUT4
auto errorDetail = fmt::format(L"Looking for it here: {}\\Data\\F4SE\\Plugins", apGamePath);
Base::TaskDialog dia(g_SharedWindowIcon, L"Error", L"Failed to load Fallout 4 Address Library", L"", errorDetail.c_str());
#endif
dia.AppendButton(0xBEED, L"Visit troubleshooting page on wiki.tiltedphoques.com");
dia.AppendButton(0xBEEF, L"Visit Address Library modpage on nexusmods.com");
const int result = dia.Show();
if (result == 0xBEEF)
{
#if TP_SKYRIM64
ShellExecuteW(nullptr, L"open", LR"(https://www.nexusmods.com/skyrimspecialedition/mods/32444?tab=files)", nullptr, nullptr, SW_SHOWNORMAL);
#elif TP_FALLOUT4
ShellExecuteW(nullptr, L"open", LR"(https://www.nexusmods.com/fallout4/mods/47327)", nullptr, nullptr, SW_SHOWNORMAL);
#endif
}
else if (result == 0xBEED)
{
ShellExecuteW(nullptr, L"open", LR"(https://wiki.tiltedphoques.com/tilted-online/guides/troubleshooting/address-library-error)", nullptr, nullptr, SW_SHOWNORMAL);
}
exit(4);
}
void RunTiltedInit(const std::filesystem::path& acGamePath, const String& aExeVersion)
{
#if TP_SKYRIM64
if (!VersionDb::Get().Load(acGamePath, aExeVersion))
#else
if (!VersionDb::Get().LoadFallout4(acGamePath))
#endif
{
ShowAddressLibraryError(acGamePath.c_str());
}
// VersionDb::Get().DumpToTextFile(R"(S:\Work\Tilted\fallout\_addresslib.txt)");
g_appInstance = std::make_unique<TiltedOnlineApp>();
TiltedOnlineApp::InstallHooks2();
TP_HOOK_COMMIT;
}
void RunTiltedApp()
{
g_appInstance->BeginMain();
}