Skip to content

Commit

Permalink
The WoW console will now be disabled by default, but may be opened wi…
Browse files Browse the repository at this point in the history
…th a configuration setting which is given in the example configuration file
  • Loading branch information
namreeb committed Jun 18, 2018
1 parent 5cf4e6b commit df6e129
Show file tree
Hide file tree
Showing 6 changed files with 43 additions and 4 deletions.
3 changes: 3 additions & 0 deletions example_config.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@
<!--- Hostname or IP address to use. This is accomplished by replacing value of the realmList console variable after all other loading is finished. -->
<AuthServer Host="logon.lightshope.org" />

<!--- Optionally enable the WoW console. To not enable the console, either remove this or set the value to "0". -->
<Console Value="1" />

<!--- Optional setting to override the DirectX field of view parameter. If you don't know what this is, do not use it. -->
<Fov Value="3.14159" />

Expand Down
31 changes: 31 additions & 0 deletions wowreeb/Config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,7 @@ void Config::Reload()
ins.OurDll = _ourDll;
ins.OurMethod = "Load";
ZeroMemory(&ins.SHA256, sizeof(ins.SHA256));
ins.Console = false;
ins.Fov = 0.f;

for (auto r = n->first_attribute(); !!r; r = r->next_attribute())
Expand Down Expand Up @@ -202,6 +203,30 @@ void Config::Reload()
}
}
}
else if (cname == "Console")
{
std::string consoleValue;

for (auto r = c->first_attribute(); !!r; r = r->next_attribute())
{
const std::string rname(r->name());

if (rname == "Value")
{
consoleValue = std::string(r->value());

std::transform(consoleValue.begin(), consoleValue.end(), consoleValue.begin(), ::toupper);
}
else
{
std::stringstream str;
str << "Unexpected " << cname << " attribute \"" << rname << "\"";
throw std::runtime_error(str.str().c_str());
}
}

ins.Console = consoleValue == "1" || consoleValue == "TRUE";
}
else if (cname == "Fov")
{
for (auto r = c->first_attribute(); !!r; r = r->next_attribute())
Expand Down Expand Up @@ -294,6 +319,12 @@ void Config::Reload()

std::transform(configValue.begin(), configValue.end(), configValue.begin(), ::toupper);
}
else
{
std::stringstream str;
str << "Unexpected " << name << " attribute \"" << name << "\"";
throw std::runtime_error(str.str().c_str());
}
}

if (configName == "ClearWDB")
Expand Down
2 changes: 2 additions & 0 deletions wowreeb/Config.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ class Config

std::string AuthServer;

bool Console;

float Fov;

fs::path OurDll;
Expand Down
7 changes: 5 additions & 2 deletions wowreeb/Injector.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -97,11 +97,14 @@ void EjectionPoll(hadesmem::Process process, HMODULE dll, PVOID remoteBuffer, si
unsigned int Inject(
const fs::path &exe,
const fs::path &ourDll, const std::string &ourMethod,
const std::string &authServer, float fov,
const std::string &authServer, bool console, float fov,
const fs::path &nativeDll, const std::string &nativeMethod,
const fs::path &clrDll, const std::wstring &clrTypeName, const std::wstring &clrMethodName)
{
const std::vector<std::wstring> createArgs { L"-console" };
std::vector<std::wstring> createArgs;

if (console)
createArgs.emplace_back(L"-console");

try
{
Expand Down
2 changes: 1 addition & 1 deletion wowreeb/Injector.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,6 @@ namespace fs = std::experimental::filesystem;
unsigned int Inject(
const fs::path &exe,
const fs::path &ourDll, const std::string &ourMethod,
const std::string &authServer, float fov,
const std::string &authServer, bool console, float fov,
const fs::path &nativeDll, const std::string &nativeMethod,
const fs::path &clrDll, const std::wstring &clrTypeName, const std::wstring &clrMethodName);
2 changes: 1 addition & 1 deletion wowreeb/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ void Launch(const Config::ConfigEntry &entry, bool clearWDB, bool verifyChecksum
{
::Inject(entry.Path,
entry.OurDll, entry.OurMethod,
entry.AuthServer, entry.Fov,
entry.AuthServer, entry.Console, entry.Fov,
entry.NativeDll, entry.NativeMethod,
entry.CLRDll, make_wstring(entry.CLRTypeName), make_wstring(entry.CLRMethodName));
return;
Expand Down

0 comments on commit df6e129

Please sign in to comment.