Added Blackbox
This commit is contained in:
parent
354d022967
commit
8b85399de5
25
README.md
25
README.md
@ -1,3 +1,4 @@
|
|||||||
|
|
||||||
![code](https://raw.githubusercontent.com/project-bo4/shield-development/master/assets/readme_header.jpg)
|
![code](https://raw.githubusercontent.com/project-bo4/shield-development/master/assets/readme_header.jpg)
|
||||||
|
|
||||||
## SHIELD
|
## SHIELD
|
||||||
@ -9,12 +10,19 @@ As of May11, 2023 we merged 'demonware' branch into 'master'. it includes a buil
|
|||||||
|
|
||||||
|
|
||||||
## INSTRUCTION
|
## INSTRUCTION
|
||||||
-- you should have publisher files required for play online under LPC folder of your game installation. if its not the case then start original game through battlenet launcher once to get those downloaded.
|
|
||||||
|
> you should have publisher files required for playing online under LPC folder of your game directory.
|
||||||
|
> if its not the case then start original game through battlenet launcher once to get those downloaded.
|
||||||
|
|
||||||
1- clone repository with its sub-modules and use generate.bat to make visual studio solution then compile project and copy ``d3d11.dll`` into your bo4 folder.
|
1- clone repository with its sub-modules and use generate.bat to make visual studio solution then compile project and copy ``d3d11.dll`` into your bo4 folder.
|
||||||
|
|
||||||
2- start BlackOps4.exe
|
2- start BlackOps4.exe
|
||||||
|
|
||||||
|
*in case you wanted to revert back to original battlenet servers just delete ``d3d11.dll``. you can put it back later whenever you want to re-install client.*
|
||||||
|
|
||||||
|
|
||||||
|
## SUBMITTING ISSUES
|
||||||
|
github issues section is only for reporting programmatically errors of client. please dont use it for requesting features or seeking help with personal issues such as faulty game data or similar problems. use battlenet's scan and repair feature to fix those problems.
|
||||||
|
|
||||||
|
|
||||||
## NOTES
|
## NOTES
|
||||||
@ -23,3 +31,18 @@ As of May11, 2023 we merged 'demonware' branch into 'master'. it includes a buil
|
|||||||
- There are some 3rd-party project/tools that have influenced and helped the project in particular ways; If you belive there is something originated from you and want to be credited please contact any of our social media accounts.
|
- There are some 3rd-party project/tools that have influenced and helped the project in particular ways; If you belive there is something originated from you and want to be credited please contact any of our social media accounts.
|
||||||
|
|
||||||
- This Project is created purely for educational purposes. its free and open-sourced under gnu license. developers are not responsible or liable for misuse of this product.
|
- This Project is created purely for educational purposes. its free and open-sourced under gnu license. developers are not responsible or liable for misuse of this product.
|
||||||
|
|
||||||
|
|
||||||
|
## Roadmap
|
||||||
|
### CLIENT-SIDE:
|
||||||
|
- [x] Online Battlenet Connection Requirement Removal
|
||||||
|
- [x] Built-in Demonware Server Emulation
|
||||||
|
- [x] BlackBox Crash Reporting Component
|
||||||
|
- [ ] Enable Aim-Assist for Game Controllers
|
||||||
|
- [ ] In-game Interactable Console
|
||||||
|
- [ ] Miscellaneous Features such as 1st person view fov
|
||||||
|
|
||||||
|
### SERVER-SIDE:
|
||||||
|
- [X] Fully Functional Online Server Emulator
|
||||||
|
- [ ] Implement Basic Matchmaking with QOS Logics
|
||||||
|
- [ ] Try to Create Dedicated Server off Public Ship Builds
|
||||||
|
@ -9,7 +9,7 @@
|
|||||||
#include <utils/compression.hpp>
|
#include <utils/compression.hpp>
|
||||||
#include <exception/minidump.hpp>
|
#include <exception/minidump.hpp>
|
||||||
|
|
||||||
namespace exception
|
namespace blackbox
|
||||||
{
|
{
|
||||||
namespace
|
namespace
|
||||||
{
|
{
|
||||||
@ -120,8 +120,101 @@ namespace exception
|
|||||||
return timestamp;
|
return timestamp;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const char* get_exception_string(DWORD exception)
|
||||||
|
{
|
||||||
|
#define EXCEPTION_CASE(CODE) case EXCEPTION_##CODE : return "EXCEPTION_" #CODE
|
||||||
|
switch (exception)
|
||||||
|
{
|
||||||
|
EXCEPTION_CASE(ACCESS_VIOLATION);
|
||||||
|
EXCEPTION_CASE(DATATYPE_MISALIGNMENT);
|
||||||
|
EXCEPTION_CASE(BREAKPOINT);
|
||||||
|
EXCEPTION_CASE(SINGLE_STEP);
|
||||||
|
EXCEPTION_CASE(ARRAY_BOUNDS_EXCEEDED);
|
||||||
|
EXCEPTION_CASE(FLT_DENORMAL_OPERAND);
|
||||||
|
EXCEPTION_CASE(FLT_DIVIDE_BY_ZERO);
|
||||||
|
EXCEPTION_CASE(FLT_INEXACT_RESULT);
|
||||||
|
EXCEPTION_CASE(FLT_INVALID_OPERATION);
|
||||||
|
EXCEPTION_CASE(FLT_OVERFLOW);
|
||||||
|
EXCEPTION_CASE(FLT_STACK_CHECK);
|
||||||
|
EXCEPTION_CASE(FLT_UNDERFLOW);
|
||||||
|
EXCEPTION_CASE(INT_DIVIDE_BY_ZERO);
|
||||||
|
EXCEPTION_CASE(INT_OVERFLOW);
|
||||||
|
EXCEPTION_CASE(PRIV_INSTRUCTION);
|
||||||
|
EXCEPTION_CASE(IN_PAGE_ERROR);
|
||||||
|
EXCEPTION_CASE(ILLEGAL_INSTRUCTION);
|
||||||
|
EXCEPTION_CASE(NONCONTINUABLE_EXCEPTION);
|
||||||
|
EXCEPTION_CASE(STACK_OVERFLOW);
|
||||||
|
EXCEPTION_CASE(INVALID_DISPOSITION);
|
||||||
|
EXCEPTION_CASE(GUARD_PAGE);
|
||||||
|
EXCEPTION_CASE(INVALID_HANDLE);
|
||||||
|
default:
|
||||||
|
return "UNKNOWN";
|
||||||
|
}
|
||||||
|
#undef EXCEPTION_CASE
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string get_memory_registers(const LPEXCEPTION_POINTERS exceptioninfo)
|
||||||
|
{
|
||||||
|
if (IsBadReadPtr(exceptioninfo, sizeof(EXCEPTION_POINTERS)))
|
||||||
|
return "";
|
||||||
|
|
||||||
|
const auto* ctx = exceptioninfo->ContextRecord;
|
||||||
|
|
||||||
|
std::string registers_scroll{};
|
||||||
|
registers_scroll.append("registers:\r\n{\r\n");
|
||||||
|
|
||||||
|
const auto x64register = [®isters_scroll](const char* key, DWORD64 value)
|
||||||
|
{
|
||||||
|
registers_scroll.append(utils::string::va("\t%s = 0x%llX\r\n", key, value));
|
||||||
|
};
|
||||||
|
|
||||||
|
x64register("rax", ctx->Rax);
|
||||||
|
x64register("rbx", ctx->Rbx);
|
||||||
|
x64register("rcx", ctx->Rcx);
|
||||||
|
x64register("rdx", ctx->Rdx);
|
||||||
|
x64register("rsp", ctx->Rsp);
|
||||||
|
x64register("rbp", ctx->Rbp);
|
||||||
|
x64register("rsi", ctx->Rsi);
|
||||||
|
x64register("rdi", ctx->Rdi);
|
||||||
|
x64register("r8", ctx->R8);
|
||||||
|
x64register("r9", ctx->R9);
|
||||||
|
x64register("r10", ctx->R10);
|
||||||
|
x64register("r11", ctx->R11);
|
||||||
|
x64register("r12", ctx->R12);
|
||||||
|
x64register("r13", ctx->R13);
|
||||||
|
x64register("r14", ctx->R14);
|
||||||
|
x64register("r15", ctx->R15);
|
||||||
|
x64register("rip", ctx->Rip);
|
||||||
|
|
||||||
|
registers_scroll.append("}");
|
||||||
|
|
||||||
|
return registers_scroll;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string get_callstack_summary(int trace_max_depth = 18)
|
||||||
|
{
|
||||||
|
std::string callstack_scroll("callstack:\r\n{\r\n");
|
||||||
|
void* stack[32]; if (trace_max_depth > 32) trace_max_depth = 32;
|
||||||
|
uint16_t count = RtlCaptureStackBackTrace(1, trace_max_depth, stack, NULL);
|
||||||
|
|
||||||
|
for (uint16_t i = 0; i < count; i++)
|
||||||
|
{
|
||||||
|
const auto prnt = utils::nt::library::get_by_address(stack[i]);
|
||||||
|
size_t rva = reinterpret_cast<uint64_t>(stack[i]) - reinterpret_cast<uint64_t>(prnt.get_ptr());
|
||||||
|
|
||||||
|
callstack_scroll.append(std::format("\t{}: {:012X}\r\n", prnt.get_name(), rva));
|
||||||
|
}
|
||||||
|
callstack_scroll.append("}");
|
||||||
|
|
||||||
|
return callstack_scroll;
|
||||||
|
}
|
||||||
|
|
||||||
std::string generate_crash_info(const LPEXCEPTION_POINTERS exceptioninfo)
|
std::string generate_crash_info(const LPEXCEPTION_POINTERS exceptioninfo)
|
||||||
{
|
{
|
||||||
|
const auto main_module = utils::nt::library{};
|
||||||
|
const auto& build_info = game::version_string;
|
||||||
|
const auto thread_id = ::GetCurrentThreadId(); // TODO: Find Thread's Name
|
||||||
|
|
||||||
std::string info{};
|
std::string info{};
|
||||||
const auto line = [&info](const std::string& text)
|
const auto line = [&info](const std::string& text)
|
||||||
{
|
{
|
||||||
@ -129,35 +222,38 @@ namespace exception
|
|||||||
info.append("\r\n");
|
info.append("\r\n");
|
||||||
};
|
};
|
||||||
|
|
||||||
line("Project-BO4 Crash Dump");
|
line(build_info + " Crash Report\r\n");
|
||||||
line("");
|
|
||||||
line(game::version_string);
|
|
||||||
//line("Version: "s + VERSION);
|
|
||||||
line("Timestamp: "s + get_timestamp());
|
|
||||||
line(utils::string::va("Exception: 0x%08X", exceptioninfo->ExceptionRecord->ExceptionCode));
|
|
||||||
line(utils::string::va("Address: 0x%llX", exceptioninfo->ExceptionRecord->ExceptionAddress));
|
|
||||||
line(utils::string::va("Base: 0x%llX", get_base()));
|
|
||||||
|
|
||||||
#pragma warning(push)
|
line(utils::string::va("Exception Code: 0x%08X(%s)", exceptioninfo->ExceptionRecord->ExceptionCode,
|
||||||
#pragma warning(disable: 4996)
|
get_exception_string(exceptioninfo->ExceptionRecord->ExceptionCode)));
|
||||||
OSVERSIONINFOEXA version_info;
|
line(utils::string::va("Exception Addr: 0x%llX[%s]", exceptioninfo->ExceptionRecord->ExceptionAddress,
|
||||||
ZeroMemory(&version_info, sizeof(version_info));
|
utils::nt::library::get_by_address(exceptioninfo->ExceptionRecord->ExceptionAddress).get_name().c_str()));
|
||||||
version_info.dwOSVersionInfoSize = sizeof(version_info);
|
line(utils::string::va("Main Module: %s[0x%llX]", main_module.get_name().c_str(), main_module.get_ptr()));
|
||||||
GetVersionExA(reinterpret_cast<LPOSVERSIONINFOA>(&version_info));
|
line(utils::string::va("Thread ID: %d(%s)", GetCurrentThreadId(), is_game_thread() ? "Main Thread" : "Auxiliary Threads"));
|
||||||
#pragma warning(pop)
|
|
||||||
|
|
||||||
line(utils::string::va("OS Version: %u.%u", version_info.dwMajorVersion, version_info.dwMinorVersion));
|
if (exceptioninfo->ExceptionRecord->ExceptionCode == EXCEPTION_ACCESS_VIOLATION)
|
||||||
|
{
|
||||||
|
line(utils::string::va("\r\nExtended Info: Attempted to %s 0x%012X",
|
||||||
|
exceptioninfo->ExceptionRecord->ExceptionInformation[0] == 1 ? "write to" : "read from",
|
||||||
|
exceptioninfo->ExceptionRecord->ExceptionInformation[1]));
|
||||||
|
}
|
||||||
|
|
||||||
|
line("\r\n");
|
||||||
|
line(get_callstack_summary(18));
|
||||||
|
line(get_memory_registers(exceptioninfo));
|
||||||
|
|
||||||
|
line("\r\nTimestamp: "s + get_timestamp());
|
||||||
|
|
||||||
return info;
|
return info;
|
||||||
}
|
}
|
||||||
|
|
||||||
void write_minidump(const LPEXCEPTION_POINTERS exceptioninfo)
|
void write_minidump(const LPEXCEPTION_POINTERS exceptioninfo)
|
||||||
{
|
{
|
||||||
const std::string crash_name = utils::string::va("minidumps/bo4-crash-%s.zip",
|
const std::string crash_name = utils::string::va("minidumps/shield-crash-%s.zip",
|
||||||
get_timestamp().data());
|
get_timestamp().data());
|
||||||
|
|
||||||
utils::compression::zip::archive zip_file{};
|
utils::compression::zip::archive zip_file{};
|
||||||
zip_file.add("crash.dmp", create_minidump(exceptioninfo));
|
zip_file.add("crash.dmp", exception::create_minidump(exceptioninfo));
|
||||||
zip_file.add("info.txt", generate_crash_info(exceptioninfo));
|
zip_file.add("info.txt", generate_crash_info(exceptioninfo));
|
||||||
zip_file.write(crash_name, "Project-bo4 Crash Dump");
|
zip_file.write(crash_name, "Project-bo4 Crash Dump");
|
||||||
}
|
}
|
||||||
@ -210,4 +306,4 @@ namespace exception
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
REGISTER_COMPONENT(exception::component)
|
REGISTER_COMPONENT(blackbox::component)
|
Loading…
Reference in New Issue
Block a user