Skip to content

Commit

Permalink
Remove debugging code
Browse files Browse the repository at this point in the history
  • Loading branch information
louist103 committed Feb 22, 2024
1 parent 6f73066 commit 46ec75c
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 30 deletions.
17 changes: 4 additions & 13 deletions extern/ZAPDUtils/Utils/DiskFile.h
Original file line number Diff line number Diff line change
Expand Up @@ -81,19 +81,10 @@ class DiskFile

static void WriteAllText(const fs::path& filePath, const std::string& text)
{
try {
std::filesystem::create_directories(filePath.parent_path().string());
} catch (std::filesystem::filesystem_error const& ex) {
std::cout << "what(): " << ex.what() << '\n'
<< "path1(): " << ex.path1() << '\n'
<< "path2(): " << ex.path2() << '\n'
<< "code().value(): " << ex.code().value() << '\n'
<< "code().message(): " << ex.code().message() << '\n'
<< "code().category(): " << ex.code().category().name() << '\n';
}
std::ofstream file(filePath, std::ios::out);


if (!std::filesystem::exists(filePath.parent_path())) {
std::filesystem::create_directories(filePath.parent_path());
}
std::ofstream file(filePath, std::ios::out);
file.write(text.c_str(), text.size());
}
};
8 changes: 0 additions & 8 deletions src/debug/CrashHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,6 @@ void CrashHandler::PrintCommon() {

#if defined(__linux__) && !defined(__ANDROID__)
void CrashHandler::PrintRegisters(ucontext_t* ctx) {
#if 0
char regbuffer[30];
AppendLine("Registers:");
#if defined(__x86_64__)
Expand Down Expand Up @@ -136,7 +135,6 @@ void CrashHandler::PrintRegisters(ucontext_t* ctx) {
snprintf(regbuffer, std::size(regbuffer), "EFL: 0x%08lX", ctx->uc_mcontext.gregs[REG_EFL]);
AppendLine(regbuffer);
#endif
#endif
}

static void ErrorHandler(int sig, siginfo_t* sigInfo, void* data) {
Expand Down Expand Up @@ -217,7 +215,6 @@ static void ShutdownHandler(int sig, siginfo_t* sigInfo, void* data) {
void CrashHandler::PrintRegisters(CONTEXT* ctx) {
AppendLine("Registers: ");
char regBuff[25];
#if 0
#if defined(_M_AMD64)
sprintf_s(regBuff, std::size(regBuff), "RAX: 0x%016llX", ctx->Rax);
AppendLine(regBuff);
Expand Down Expand Up @@ -297,11 +294,9 @@ void CrashHandler::PrintRegisters(CONTEXT* ctx) {
sprintf_s(regBuff, std::size(regBuff), "EIP: 0x%08lX", ctx->Eip);
AppendLine(regBuff);
#endif
#endif
}

void CrashHandler::PrintStack(CONTEXT* ctx) {
#if 0
BOOL result;
HANDLE process;
HANDLE thread;
Expand Down Expand Up @@ -392,7 +387,6 @@ void CrashHandler::PrintStack(CONTEXT* ctx) {
PrintCommon();
LUS::Context::GetInstance()->GetLogger()->flush();
spdlog::shutdown();
#endif
}

extern "C" LONG WINAPI seh_filter(PEXCEPTION_POINTERS ex) {
Expand All @@ -415,7 +409,6 @@ extern "C" LONG WINAPI seh_filter(PEXCEPTION_POINTERS ex) {
#endif

CrashHandler::CrashHandler() {
#if 0
mOutBuffer = new char[gMaxBufferSize];
#if defined(__linux__) && !defined(__ANDROID__)
struct sigaction action;
Expand All @@ -438,7 +431,6 @@ CrashHandler::CrashHandler() {
#elif defined(_WIN32)
SetUnhandledExceptionFilter(seh_filter);
#endif
#endif
}

CrashHandler::CrashHandler(CrashHandlerCallback callback) {
Expand Down
10 changes: 1 addition & 9 deletions src/resource/ResourceManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,6 @@ bool ResourceManager::DidLoadSuccessfully() {
}

std::shared_ptr<File> ResourceManager::LoadFileProcess(const std::string& filePath) {
if (filePath == "objects/gameplay_keep/gPlayerAnim_link_normal_wait_free") {
int bp = 5;
}
auto file = mArchive->LoadFile(filePath, true);

if (file != nullptr) {
Expand All @@ -74,9 +71,6 @@ std::shared_ptr<File> ResourceManager::LoadFileProcess(const std::string& filePa

std::shared_ptr<IResource> ResourceManager::LoadResourceProcess(const std::string& filePath, bool loadExact) {
// Check for and remove the OTR signature
if (filePath == "misc/link_animation/gPlayerAnim_link_normal_wait_free_Data") {
int bp = 5;
}
if (OtrSignatureCheck(filePath.c_str())) {
const auto newFilePath = filePath.substr(7);
return LoadResourceProcess(newFilePath);
Expand Down Expand Up @@ -170,9 +164,6 @@ std::shared_ptr<File> ResourceManager::LoadFile(const std::string& filePath) {

std::shared_future<std::shared_ptr<IResource>> ResourceManager::LoadResourceAsync(const std::string& filePath,
bool loadExact, bool priority) {
if (filePath == "misc/link_animation/gPlayerAnim_link_normal_wait_free_Data") {
int bp = 5;
}
// Check for and remove the OTR signature
if (OtrSignatureCheck(filePath.c_str())) {
auto newFilePath = filePath.substr(7);
Expand All @@ -197,6 +188,7 @@ std::shared_future<std::shared_ptr<IResource>> ResourceManager::LoadResourceAsyn
}

std::shared_ptr<IResource> ResourceManager::LoadResource(const std::string& filePath, bool loadExact) {
// BENTODO why doesn't this work?
auto resource = LoadResourceProcess(filePath, true); // LoadResourceAsync(filePath, loadExact, true).get();
if (resource == nullptr) {
SPDLOG_ERROR("Failed to load resource file at path {}", filePath);
Expand Down

0 comments on commit 46ec75c

Please sign in to comment.