-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDreamLoader.cpp
More file actions
82 lines (63 loc) · 2.16 KB
/
DreamLoader.cpp
File metadata and controls
82 lines (63 loc) · 2.16 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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
#include "stdafx.h"
#include "DreamLoader.h"
#include "CommandLine.h"
#include "LicenceLoader.h"
#include "ClientDownloader.h"
bool DreamLoader::Init() {
Console::Init();
Console::Log(L"================================================");
Console::Log(L"== DreamLoader v2.0.0");
Console::Log(L"== Provided by yamiM0NSTER");
Console::Log(L"================================================");
if(!Utils::directoryExists(L"DreamVR")) {
Console::R(L"Failed to find DreamVR directory, Dream Client will not be loaded.");
Sleep(3000);
::ShowWindow(::GetConsoleWindow(), SW_HIDE);
return false;
}
if(!Utils::directoryExists(L"DreamVR\\Preferences")) {
Console::Log(L"Failed to find DreamVR\\Preferences directory, client will not be loaded");
Sleep(3000);
::ShowWindow(::GetConsoleWindow(), SW_HIDE);
return false;
}
if(CommandLine::_noHost) {
Console::Log(L"No host flag active.");
}
bool shouldContinue = DreamUtils::LoadLocalClient();
if(!shouldContinue)
return false;
GetClient();
LoadDownloadedClient();
return true;
}
void DreamLoader::GetClient() {
LicenceLoader::Initialize();
string checksum = Sha1::from_file(".\\GameAssembly.dll");
wstringstream ss;
ss << checksum.c_str();
Console::A(L"GameAssembly checksum:");
Console::A(ss.str());
ClientDownloader::Download();
if(ClientDownloader::_clientData == nullptr) {
Console::Y(L"Game will start without Dream Client");
Sleep(3000);
}
}
void DreamLoader::LoadDownloadedClient() {
if(ClientDownloader::_clientData == nullptr) {
return;
}
wstringstream ss;
ss << L"Client size:" << ClientDownloader::_clientSize;
Console::A(ss.str());
DreamUtils::DecryptClient(ClientDownloader::_clientData, ClientDownloader::_clientSize);
HMEMORYMODULE handle = MemoryLoadLibrary(ClientDownloader::_clientData, ClientDownloader::_clientSize);
if(handle == nullptr) {
Console::Log(L"Downloaded client handle == NULL.");
Console::Y(L"Game will start without Dream Client");
Sleep(3000);
return;
}
Console::Log(L"Downloaded client loaded.");
}