Revert "Add some debugging stuff"

This reverts commit 3adf4175209a873c8294d413678665b7c3f2a006.
This commit is contained in:
momo5502 2022-09-24 15:14:54 +02:00
parent 0a86dfac43
commit dd894951cf
3 changed files with 4 additions and 232 deletions

View File

@ -7,111 +7,23 @@
#include <utils/hook.hpp>
#include "utils/string.hpp"
namespace branding
{
namespace
{
std::map<int, std::string> connectivity_bits = {
{0x10000000, "???"},
{0x01000000, "LiveInventory_IsValid"},
{0x02000000, "LiveStorage_AreDDLsInSync"},
{0x04000000, "LiveInventory_InitialCODPointsChecked"},
{0x08000000, "Marketing_HaveMessages"},
{0x00100000, "LivePublisherVariables_AreVariablesAvailable"},
{0x00200000, "SaveGame_IsDataReady(controllerIndex, MODE_NETWORK_ONLINE)"},
{0x00400000, "LPC_IsLPCReady() || !Dvar_GetBool(live_useLPC)"},
{0x00800000, "LiveAntiCheat_ConsoleDetailsReported"},
{0x00010000, "Live_Qos_Finished"},
{0x00080000, "???"},
{0x00002000, "Live_IsGeoLocationDataRetrieved"},
{0x00000100, "LiveStorage_DoWeHavePlaylists"},
{0x00000200, "LiveStorage_ValidateFFOTD"},
{0x00000010, "LiveStats_Loadouts_Ready(controllerIndex, MODE_NETWORK_ONLINE)"},
{0x00000040, "g_dwNetStatus == 6"},
{0x00000080, "LiveStorage_DoWeHaveFFOTD"},
{0x00000002, "LiveUser_IsUserSignedInToLive"},
{0x00000004, "Live_IsUserSignedInToDemonware"},
{0x00000008, "LiveStats_Core_Ready(controllerIndex, MODE_NETWORK_ONLINE)"},
};
int patch = false;
std::string GetConnectivityInfo()
{
int bits = 0;
game::Live_GetConnectivityInformation(0, &bits, false);
std::string str = utils::string::va("Bits: %X\n", bits);
if (patch)
{
*(uint8_t*)0x143410CE8_g = 1;
*(uint8_t*)0x151843808_g = 1;
*(uint8_t*)0x151641C8A_g = 1;
*(uint32_t*)0x151412FB4_g = 4;
}
int required_mask = 0x1FF923DE;
for (int i = 0; (1 << i) <= 0x10000000; ++i)
{
auto value = 1 << i;
bool set = bits & value;
bool req = required_mask & value;
if (!req) continue;
std::string name = "?";
auto entry = connectivity_bits.find(value);
if (entry != connectivity_bits.end())
{
name = entry->second;
}
str += utils::string::va("%08X - %d - %s\n", value, (int)set, name.data());
}
for (const auto& bit : connectivity_bits)
{
}
return str;
}
std::string GetOtherInfo()
{
std::string info;
info += utils::string::va("s_publisherFastFileInited: %d\n", (uint32_t)*(uint8_t*)0x1518DC384_g);
info += utils::string::va("Dvar_GetBool(qword_151641C00): %d\n", (uint32_t)reinterpret_cast<bool(*)(uint64_t)>(0x1421844C0_g)(*(uint64_t*)0x151641C00_g));
info += utils::string::va("0x143410CE8: %d\n", (uint32_t)*(uint8_t*)0x143410CE8_g);
info += utils::string::va("ffotdValid: %d\n", (uint32_t)*(uint8_t*)0x151843808_g);
info += utils::string::va("ffotdSize: %d\n", (uint32_t)*(uint32_t*)0x1518DC370_g);
info += utils::string::va("Sys_IsDatabaseReady: %d\n", (uint32_t)reinterpret_cast<bool(*)()>(0x1421844C0_g)());
info += utils::string::va("Com_IsRunningUILevel: %d\n", (uint32_t)(reinterpret_cast<bool(*)()>(0x142148DB0_g)()));
info += utils::string::va("array: %d\n", ((int*)0x1453DABC8_g)[1054 * *(DWORD*)0x14342355C_g]);
return info;
}
void draw_branding()
{
constexpr auto x = 4;
constexpr auto y = 0;
constexpr auto scale = 0.45f;
float color[4] = {0.666f, 0.666f, 0.666f, 1.0f};
float color[4] = {0.666f, 0.666f, 0.666f, 0.666f};
auto* font = reinterpret_cast<uint32_t*(*)()>(0x141CAC8E0_g)();
if (!font) return;
std::string str = "BOIII: " VERSION;
//str += "\n\n" + GetConnectivityInfo();
//str += "\n\n" + GetOtherInfo();
game::R_AddCmdDrawText(str.data(), 0x7FFFFFFF, font, static_cast<float>(x),
game::R_AddCmdDrawText("BOIII: " VERSION, 0x7FFFFFFF, font, static_cast<float>(x),
y + static_cast<float>(font[2]) * scale,
scale, scale, 0.0f, color, game::ITEM_TEXTSTYLE_MONOSPACESHADOWED);
scale, scale, 0.0f, color, game::ITEM_TEXTSTYLE_NORMAL);
}
}

View File

@ -21,7 +21,7 @@ namespace console
void print_message(const char* message)
{
#ifndef NDEBUG
OutputDebugStringA(message);
//OutputDebugStringA(message);
#endif
if (started && !terminate_runner)

View File

@ -1,7 +1,6 @@
#include <std_include.hpp>
#include "loader/component_loader.hpp"
#include <utils/io.hpp>
#include <utils/hook.hpp>
#include <utils/thread.hpp>
@ -12,8 +11,6 @@
#include "game/demonware/servers/umbrella_server.hpp"
#include "game/demonware/server_registry.hpp"
#include "resource.hpp"
#define TCP_BLOCKING true
#define UDP_BLOCKING false
@ -439,120 +436,6 @@ namespace demonware
}
}
struct FSCKData
{
bool bSuccess;
bool bInProgress;
bool bFileChecked;
hash_state hstate;
uint32_t fileIndex;
uint32_t filePointer;
byte data[65536];
};
void load_ffotd()
{
OutputDebugStringA("LOADING FASTFILE");
static const auto ffotd = utils::nt::load_resource(DW_FASTFILE);
game::XZoneInfo zone_info{};
zone_info.name = "core_ffotd_tu32_593";
zone_info.allocFlags = 0x2000;
zone_info.freeFlags = 0x40000000;
zone_info.allocSlot = 0;
zone_info.freeSlot = 0;
zone_info.fileBuffer.data = ffotd.data();
zone_info.fileBuffer.dataSize = ffotd.size();
game::DB_LoadXAssets(&zone_info, 1, false, false);
OutputDebugStringA("DONE1 FASTFILE");
reinterpret_cast<void(*)()>(0x141424EB0_g)();
OutputDebugStringA("DONE2 FASTFILE");
*reinterpret_cast<bool*>(0x151843803_g) = true;
OutputDebugStringA("DONE3 FASTFILE");
}
void doLPCStuff()
{
auto& s_fsckData = *(FSCKData*)0x1562CDB00_g;
bool& s_lpcData_lpcBusy = *(bool*)0x1562CDACD_g;
bool& s_lpcData_lpcReady = *(bool*)0x1562CDACC_g;
uint8_t* s_localManifest = (uint8_t*)0x1562DDBE0_g;
std::string data = utils::io::read_file("LPC/.manifest");
if (data.empty())
{
s_lpcData_lpcBusy = false;
printf("LPC BAD :(\n");
return;
}
printf("LPC GOOD :)\n");
memcpy(s_localManifest, data.data(), data.size());
if (!s_fsckData.bInProgress)
{
// LPC_ResetFSCK
memset(&s_fsckData, 0, sizeof(s_fsckData));
s_fsckData.bSuccess = true;
s_fsckData.bInProgress = true;
s_lpcData_lpcBusy = true;
// LPC_TickFSCK
//reinterpret_cast<void(*)()>(0x141F03F00_g)();
//load_ffotd();
// Fuck it
s_fsckData.bSuccess = true;
s_fsckData.bInProgress = false;
s_lpcData_lpcBusy = false;
s_lpcData_lpcReady = true;
}
}
void getShotLang(game::XZoneInfo* zoneInfo, uint32_t zoneCount, bool sync, bool suppressSync)
{
printf("ZOOONEEE: %X %s\n", zoneCount, zoneInfo[0].name);
game::DB_LoadXAssets(zoneInfo, zoneCount, sync, suppressSync);
}
utils::hook::detour start;
utils::hook::detour suc;
utils::hook::detour fai;
void* succ(void* a1, void* a2)
{
printf("LPC SUCCESS\n");
return suc.invoke<void*>(a1, a2);
}
void* failc(void* a1, void* a2)
{
printf("LPC FAIL\n");
return fai.invoke<void*>(a1, a2);
}
void* startc(void* a1, void* a2)
{
printf("LPC START\n");
return start.invoke<void*>(a1, a2);
}
void statusss()
{
OutputDebugStringA("IT CXALLLED");
}
const char* getShotLangReal()
{
return "core_ffotd_tu32_593";
}
class component final : public component_interface
{
public:
@ -599,29 +482,6 @@ namespace demonware
utils::hook::set<uint32_t>(0x141EC4B50_g, 0xC3D08948); // Skip publisher file signature stuff
//utils::hook::set<uint32_t>(0x141EC4B40_g, 0xC301B0); // FFOTD is valid
//utils::hook::set<uint32_t>(0x141EBDF30_g, 0xC301B0); // DDLs available
//utils::hook::set<uint32_t>(0x141E968F0_g, 0xC301B0); // QOL finished
//*(uint8_t*)0x151843808_g = 1; //
//*(uint8_t*)0x151641C8A_g = 1; // DDLs
//*(uint32_t*)0x151412FB4_g = 4; // QOL
//utils::hook::jump(0x141F03A20_g, doLPCStuff);
//utils::hook::call(0x141EC462D_g, getShotLang);
utils::hook::call(0x141EC458C_g, getShotLangReal);
//start.create(0x141EC4400_g, startc);
//suc.create(0x141440B00_g, succ);
//fai.create(0x141440B10_g, failc);
/*utils::hook::jump(0x141EC4487_g, utils::hook::assemble([](utils::hook::assembler& a)
{
a.pushad64();
a.call_aligned(statusss);
a.popad64();
a.mov(qword_ptr(rsp, 0x288 + 0x8), rdi);
a.jmp(0x141EC448F_g);
}));*/
}
void pre_destroy() override