Skip to content

Commit

Permalink
Make debug console more useful.
Browse files Browse the repository at this point in the history
  • Loading branch information
num0005 committed Jul 25, 2018
1 parent c40dd7b commit abebd34
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 14 deletions.
6 changes: 0 additions & 6 deletions H2Codez/H2Sapien/Console.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,16 +46,10 @@ void copy_from_console_history()

bool __stdcall on_console_input(WORD keycode)
{
printf("key : %d\n", keycode);
printf("key (low) : %d\n", LOBYTE(keycode));
printf("key (high) : %d\n", HIBYTE(keycode));

char *console_input = reinterpret_cast<char*>(0xA9F52C);
WORD *cursor_pos = reinterpret_cast<WORD*>(0xa9f636);
HWND *main_hwnd = reinterpret_cast<HWND *>(0x00A68B9C);

printf("console: %s \n", console_input);

switch (keycode) {
case 263: // `
history_view_location = 0;
Expand Down
9 changes: 1 addition & 8 deletions H2Codez/dllmain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

#include "stdafx.h"
#include "Common\DiscordInterface.h"
#include "Util\Debug.h"
#include "Common\H2EKCommon.h"
#include "Util\Debug.h"

#pragma region declarations

Expand All @@ -27,27 +27,20 @@ BOOL APIENTRY DllMain( HMODULE hModule,
LPVOID lpReserved
)
{
pLog.WriteLog("DLLMain called by CRT with %d", ul_reason_for_call);
switch (ul_reason_for_call)
{
case DLL_PROCESS_ATTACH:
pLog.WriteLog("DLL_PROCESS_ATTACH");
if (!conf.getBoolean("patches_enabled", true)) // enable basic stuff so launcher doesn't break
{
H2Toolz::minimal_init();
break;
}

#if _DEBUG
Debug::Start_Console();
#endif
g_hModule = hModule;
if (!H2Toolz::Init())
std::exit(0);
break;

case DLL_PROCESS_DETACH:
pLog.WriteLog("DLL_PROCESS_DETACH");
std::string cmd = GetCommandLineA();
if (!g_process_crashed && game.process_type == H2EK::H2Tool
&& cmd.find("pause_after_run") != string::npos) {
Expand Down
5 changes: 5 additions & 0 deletions H2Codez/h2codez.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
#include "H2Sapien\H2Sapien.h"
#include "Common\H2EKCommon.h"
#include "Common\DiscordInterface.h"
#include "Util\Debug.h"

char app_directory[256];
std::wstring_convert<std::codecvt_utf8<wchar_t>> wstring_to_string;
Expand Down Expand Up @@ -68,6 +69,10 @@ bool H2Toolz::Init()
MessageBoxA(0, "H2toolz loaded into unsupported process, will now exit!", "ERROR!", MB_OK);
return false;
}
#ifndef _DEBUG
if (game.process_type != H2EK::H2Tool && conf.getBoolean("enable_debug_console", false))
#endif
Debug::Start_Console();

DiscordInterface::setAppType(game.process_type);
H2CommonPatches::Init();
Expand Down

0 comments on commit abebd34

Please sign in to comment.