Browse Source

Format debug related code

pull/25/head
Anders Jenbo 8 years ago
parent
commit
fcc4e19287
  1. 657
      Source/appfat.cpp
  2. 2
      Source/appfat.h
  3. 308
      Source/debug.cpp
  4. 265
      Source/error.cpp
  5. 4
      Source/fault.h
  6. 339
      Source/logging.cpp
  7. 6
      Source/logging.h
  8. 2
      types.h

657
Source/appfat.cpp

@ -6,243 +6,241 @@
float appfat_cpp_init_value; float appfat_cpp_init_value;
char sz_error_buf[256]; char sz_error_buf[256];
int terminating; // weak int terminating; // weak
int cleanup_thread_id; // weak int cleanup_thread_id; // weak
char empty_string; char empty_string;
// appfat_cpp_init initializes the C++ runtime of appfat.cpp. // appfat_cpp_init initializes the C++ runtime of appfat.cpp.
struct appfat_cpp_init { struct appfat_cpp_init {
appfat_cpp_init() { appfat_cpp_init()
appfat_cpp_init_value = INFINITY; {
} appfat_cpp_init_value = INFINITY;
}
} appfat_cpp_init; } appfat_cpp_init;
// delete overloads the delete operator. // delete overloads the delete operator.
void operator delete(void *ptr) { void operator delete(void *ptr)
if (ptr != NULL) { {
SMemFree(ptr, "delete", -1, 0); if (ptr != NULL) {
} SMemFree(ptr, "delete", -1, 0);
}
} }
char *__fastcall GetErrorStr(int error_code) char *__fastcall GetErrorStr(int error_code)
{ {
int v1; // edi int v1; // edi
unsigned int v2; // eax unsigned int v2; // eax
signed int v4; // eax signed int v4; // eax
char *i; // ecx char *i; // ecx
v1 = error_code; v1 = error_code;
v2 = ((unsigned int)error_code >> 16) & 0x1FFF; v2 = ((unsigned int)error_code >> 16) & 0x1FFF;
if ( v2 == 0x0878 ) if (v2 == 0x0878) {
{ TraceErrorDS(error_code, sz_error_buf, 256);
TraceErrorDS(error_code, sz_error_buf, 256); } else if (v2 == 0x0876) {
} TraceErrorDD(error_code, sz_error_buf, 256);
else if ( v2 == 0x0876 ) } else {
{ if (!SErrGetErrorStr(error_code, sz_error_buf, 256) && !FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM, NULL, v1, 0x400u, sz_error_buf, 0x100u, NULL))
TraceErrorDD(error_code, sz_error_buf, 256); wsprintf(sz_error_buf, "unknown error 0x%08x", v1);
} }
else v4 = strlen(sz_error_buf);
{ for (i = &sz_error_buf[v4 - 1]; v4 > 0; *i = 0) {
if ( !SErrGetErrorStr(error_code, sz_error_buf, 256) && !FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM, NULL, v1, 0x400u, sz_error_buf, 0x100u, NULL) ) --v4;
wsprintf(sz_error_buf, "unknown error 0x%08x", v1); --i;
} if (*i != '\r' && *i != '\n')
v4 = strlen(sz_error_buf); break;
for ( i = &sz_error_buf[v4-1]; v4 > 0; *i = 0 ) }
{ return sz_error_buf;
--v4;
--i;
if ( *i != '\r' && *i != '\n' )
break;
}
return sz_error_buf;
} }
#define CASE_ERROR(v, errName) case errName: v = #errName; break; #define CASE_ERROR(v, errName) \
case errName: \
v = #errName; \
break;
void __fastcall TraceErrorDD(int error_code, char *error_buf, int error_buf_len) void __fastcall TraceErrorDD(int error_code, char *error_buf, int error_buf_len)
{ {
const char *v3; // eax const char *v3; // eax
char v4[20]; // [esp+0h] [ebp-14h] char v4[20]; // [esp+0h] [ebp-14h]
switch (error_code) { switch (error_code) {
CASE_ERROR(v3, DDERR_CANTPAGEUNLOCK); CASE_ERROR(v3, DDERR_CANTPAGEUNLOCK);
CASE_ERROR(v3, DDERR_NOTPAGELOCKED); CASE_ERROR(v3, DDERR_NOTPAGELOCKED);
CASE_ERROR(v3, DD_OK); CASE_ERROR(v3, DD_OK);
CASE_ERROR(v3, DDERR_CANTPAGELOCK); CASE_ERROR(v3, DDERR_CANTPAGELOCK);
CASE_ERROR(v3, DDERR_BLTFASTCANTCLIP); CASE_ERROR(v3, DDERR_BLTFASTCANTCLIP);
CASE_ERROR(v3, DDERR_NOBLTHW); CASE_ERROR(v3, DDERR_NOBLTHW);
CASE_ERROR(v3, DDERR_NODDROPSHW); CASE_ERROR(v3, DDERR_NODDROPSHW);
CASE_ERROR(v3, DDERR_OVERLAYNOTVISIBLE); CASE_ERROR(v3, DDERR_OVERLAYNOTVISIBLE);
CASE_ERROR(v3, DDERR_NOOVERLAYDEST); CASE_ERROR(v3, DDERR_NOOVERLAYDEST);
CASE_ERROR(v3, DDERR_INVALIDPOSITION); CASE_ERROR(v3, DDERR_INVALIDPOSITION);
CASE_ERROR(v3, DDERR_NOTAOVERLAYSURFACE); CASE_ERROR(v3, DDERR_NOTAOVERLAYSURFACE);
CASE_ERROR(v3, DDERR_EXCLUSIVEMODEALREADYSET); CASE_ERROR(v3, DDERR_EXCLUSIVEMODEALREADYSET);
CASE_ERROR(v3, DDERR_NOTFLIPPABLE); CASE_ERROR(v3, DDERR_NOTFLIPPABLE);
CASE_ERROR(v3, DDERR_CANTDUPLICATE); CASE_ERROR(v3, DDERR_CANTDUPLICATE);
CASE_ERROR(v3, DDERR_NOTLOCKED); CASE_ERROR(v3, DDERR_NOTLOCKED);
CASE_ERROR(v3, DDERR_CANTCREATEDC); CASE_ERROR(v3, DDERR_CANTCREATEDC);
CASE_ERROR(v3, DDERR_NODC); CASE_ERROR(v3, DDERR_NODC);
CASE_ERROR(v3, DDERR_WRONGMODE); CASE_ERROR(v3, DDERR_WRONGMODE);
CASE_ERROR(v3, DDERR_IMPLICITLYCREATED); CASE_ERROR(v3, DDERR_IMPLICITLYCREATED);
CASE_ERROR(v3, DDERR_NOTPALETTIZED); CASE_ERROR(v3, DDERR_NOTPALETTIZED);
CASE_ERROR(v3, DDERR_NOMIPMAPHW); CASE_ERROR(v3, DDERR_NOMIPMAPHW);
CASE_ERROR(v3, DDERR_INVALIDSURFACETYPE); CASE_ERROR(v3, DDERR_INVALIDSURFACETYPE);
CASE_ERROR(v3, DDERR_DCALREADYCREATED); CASE_ERROR(v3, DDERR_DCALREADYCREATED);
CASE_ERROR(v3, DDERR_NOPALETTEHW); CASE_ERROR(v3, DDERR_NOPALETTEHW);
CASE_ERROR(v3, DDERR_DIRECTDRAWALREADYCREATED); CASE_ERROR(v3, DDERR_DIRECTDRAWALREADYCREATED);
CASE_ERROR(v3, DDERR_NODIRECTDRAWHW); CASE_ERROR(v3, DDERR_NODIRECTDRAWHW);
CASE_ERROR(v3, DDERR_PRIMARYSURFACEALREADYEXISTS); CASE_ERROR(v3, DDERR_PRIMARYSURFACEALREADYEXISTS);
CASE_ERROR(v3, DDERR_NOEMULATION); CASE_ERROR(v3, DDERR_NOEMULATION);
CASE_ERROR(v3, DDERR_REGIONTOOSMALL); CASE_ERROR(v3, DDERR_REGIONTOOSMALL);
CASE_ERROR(v3, DDERR_CLIPPERISUSINGHWND); CASE_ERROR(v3, DDERR_CLIPPERISUSINGHWND);
CASE_ERROR(v3, DDERR_NOCLIPPERATTACHED); CASE_ERROR(v3, DDERR_NOCLIPPERATTACHED);
CASE_ERROR(v3, DDERR_NOHWND); CASE_ERROR(v3, DDERR_NOHWND);
CASE_ERROR(v3, DDERR_HWNDSUBCLASSED); CASE_ERROR(v3, DDERR_HWNDSUBCLASSED);
CASE_ERROR(v3, DDERR_HWNDALREADYSET); CASE_ERROR(v3, DDERR_HWNDALREADYSET);
CASE_ERROR(v3, DDERR_NOPALETTEATTACHED); CASE_ERROR(v3, DDERR_NOPALETTEATTACHED);
CASE_ERROR(v3, DDERR_INVALIDDIRECTDRAWGUID); CASE_ERROR(v3, DDERR_INVALIDDIRECTDRAWGUID);
CASE_ERROR(v3, DDERR_UNSUPPORTEDFORMAT); CASE_ERROR(v3, DDERR_UNSUPPORTEDFORMAT);
CASE_ERROR(v3, DDERR_UNSUPPORTEDMASK); CASE_ERROR(v3, DDERR_UNSUPPORTEDMASK);
CASE_ERROR(v3, DDERR_VERTICALBLANKINPROGRESS); CASE_ERROR(v3, DDERR_VERTICALBLANKINPROGRESS);
CASE_ERROR(v3, DDERR_WASSTILLDRAWING); CASE_ERROR(v3, DDERR_WASSTILLDRAWING);
CASE_ERROR(v3, DDERR_XALIGN); CASE_ERROR(v3, DDERR_XALIGN);
CASE_ERROR(v3, DDERR_TOOBIGWIDTH); CASE_ERROR(v3, DDERR_TOOBIGWIDTH);
CASE_ERROR(v3, DDERR_CANTLOCKSURFACE); CASE_ERROR(v3, DDERR_CANTLOCKSURFACE);
CASE_ERROR(v3, DDERR_SURFACEISOBSCURED); CASE_ERROR(v3, DDERR_SURFACEISOBSCURED);
CASE_ERROR(v3, DDERR_SURFACELOST); CASE_ERROR(v3, DDERR_SURFACELOST);
CASE_ERROR(v3, DDERR_SURFACENOTATTACHED); CASE_ERROR(v3, DDERR_SURFACENOTATTACHED);
CASE_ERROR(v3, DDERR_TOOBIGHEIGHT); CASE_ERROR(v3, DDERR_TOOBIGHEIGHT);
CASE_ERROR(v3, DDERR_TOOBIGSIZE); CASE_ERROR(v3, DDERR_TOOBIGSIZE);
CASE_ERROR(v3, DDERR_SURFACEBUSY); CASE_ERROR(v3, DDERR_SURFACEBUSY);
CASE_ERROR(v3, DDERR_OVERLAYCOLORKEYONLYONEACTIVE); CASE_ERROR(v3, DDERR_OVERLAYCOLORKEYONLYONEACTIVE);
CASE_ERROR(v3, DDERR_PALETTEBUSY); CASE_ERROR(v3, DDERR_PALETTEBUSY);
CASE_ERROR(v3, DDERR_COLORKEYNOTSET); CASE_ERROR(v3, DDERR_COLORKEYNOTSET);
CASE_ERROR(v3, DDERR_SURFACEALREADYATTACHED); CASE_ERROR(v3, DDERR_SURFACEALREADYATTACHED);
CASE_ERROR(v3, DDERR_SURFACEALREADYDEPENDENT); CASE_ERROR(v3, DDERR_SURFACEALREADYDEPENDENT);
CASE_ERROR(v3, DDERR_OVERLAYCANTCLIP); CASE_ERROR(v3, DDERR_OVERLAYCANTCLIP);
CASE_ERROR(v3, DDERR_NOVSYNCHW); CASE_ERROR(v3, DDERR_NOVSYNCHW);
CASE_ERROR(v3, DDERR_NOZBUFFERHW); CASE_ERROR(v3, DDERR_NOZBUFFERHW);
CASE_ERROR(v3, DDERR_NOZOVERLAYHW); CASE_ERROR(v3, DDERR_NOZOVERLAYHW);
CASE_ERROR(v3, DDERR_OUTOFCAPS); CASE_ERROR(v3, DDERR_OUTOFCAPS);
CASE_ERROR(v3, DDERR_OUTOFVIDEOMEMORY); CASE_ERROR(v3, DDERR_OUTOFVIDEOMEMORY);
CASE_ERROR(v3, DDERR_NOTEXTUREHW); CASE_ERROR(v3, DDERR_NOTEXTUREHW);
CASE_ERROR(v3, DDERR_NOROTATIONHW); CASE_ERROR(v3, DDERR_NOROTATIONHW);
CASE_ERROR(v3, DDERR_NOSTRETCHHW); CASE_ERROR(v3, DDERR_NOSTRETCHHW);
CASE_ERROR(v3, DDERR_NOT4BITCOLOR); CASE_ERROR(v3, DDERR_NOT4BITCOLOR);
CASE_ERROR(v3, DDERR_NOT4BITCOLORINDEX); CASE_ERROR(v3, DDERR_NOT4BITCOLORINDEX);
CASE_ERROR(v3, DDERR_NOT8BITCOLOR); CASE_ERROR(v3, DDERR_NOT8BITCOLOR);
CASE_ERROR(v3, DDERR_NORASTEROPHW); CASE_ERROR(v3, DDERR_NORASTEROPHW);
CASE_ERROR(v3, DDERR_NOEXCLUSIVEMODE); CASE_ERROR(v3, DDERR_NOEXCLUSIVEMODE);
CASE_ERROR(v3, DDERR_NOFLIPHW); CASE_ERROR(v3, DDERR_NOFLIPHW);
CASE_ERROR(v3, DDERR_NOGDI); CASE_ERROR(v3, DDERR_NOGDI);
CASE_ERROR(v3, DDERR_NOMIRRORHW); CASE_ERROR(v3, DDERR_NOMIRRORHW);
CASE_ERROR(v3, DDERR_NOTFOUND); CASE_ERROR(v3, DDERR_NOTFOUND);
CASE_ERROR(v3, DDERR_NOOVERLAYHW); CASE_ERROR(v3, DDERR_NOOVERLAYHW);
CASE_ERROR(v3, DDERR_NOCOLORKEYHW); CASE_ERROR(v3, DDERR_NOCOLORKEYHW);
CASE_ERROR(v3, DDERR_NOALPHAHW); CASE_ERROR(v3, DDERR_NOALPHAHW);
CASE_ERROR(v3, DDERR_NOCLIPLIST); CASE_ERROR(v3, DDERR_NOCLIPLIST);
CASE_ERROR(v3, DDERR_NOCOLORCONVHW); CASE_ERROR(v3, DDERR_NOCOLORCONVHW);
CASE_ERROR(v3, DDERR_NOCOOPERATIVELEVELSET); CASE_ERROR(v3, DDERR_NOCOOPERATIVELEVELSET);
CASE_ERROR(v3, DDERR_NOCOLORKEY); CASE_ERROR(v3, DDERR_NOCOLORKEY);
CASE_ERROR(v3, DDERR_NO3D); CASE_ERROR(v3, DDERR_NO3D);
CASE_ERROR(v3, DDERR_INVALIDMODE); CASE_ERROR(v3, DDERR_INVALIDMODE);
CASE_ERROR(v3, DDERR_INVALIDOBJECT); CASE_ERROR(v3, DDERR_INVALIDOBJECT);
CASE_ERROR(v3, DDERR_INVALIDPIXELFORMAT); CASE_ERROR(v3, DDERR_INVALIDPIXELFORMAT);
CASE_ERROR(v3, DDERR_INVALIDRECT); CASE_ERROR(v3, DDERR_INVALIDRECT);
CASE_ERROR(v3, DDERR_LOCKEDSURFACES); CASE_ERROR(v3, DDERR_LOCKEDSURFACES);
CASE_ERROR(v3, DDERR_INVALIDCLIPLIST); CASE_ERROR(v3, DDERR_INVALIDCLIPLIST);
CASE_ERROR(v3, DDERR_CURRENTLYNOTAVAIL); CASE_ERROR(v3, DDERR_CURRENTLYNOTAVAIL);
CASE_ERROR(v3, DDERR_EXCEPTION); CASE_ERROR(v3, DDERR_EXCEPTION);
CASE_ERROR(v3, DDERR_HEIGHTALIGN); CASE_ERROR(v3, DDERR_HEIGHTALIGN);
CASE_ERROR(v3, DDERR_INCOMPATIBLEPRIMARY); CASE_ERROR(v3, DDERR_INCOMPATIBLEPRIMARY);
CASE_ERROR(v3, DDERR_INVALIDCAPS); CASE_ERROR(v3, DDERR_INVALIDCAPS);
CASE_ERROR(v3, DDERR_CANNOTDETACHSURFACE); CASE_ERROR(v3, DDERR_CANNOTDETACHSURFACE);
CASE_ERROR(v3, DDERR_UNSUPPORTED); CASE_ERROR(v3, DDERR_UNSUPPORTED);
CASE_ERROR(v3, DDERR_GENERIC); CASE_ERROR(v3, DDERR_GENERIC);
CASE_ERROR(v3, DDERR_OUTOFMEMORY); CASE_ERROR(v3, DDERR_OUTOFMEMORY);
CASE_ERROR(v3, DDERR_INVALIDPARAMS); CASE_ERROR(v3, DDERR_INVALIDPARAMS);
CASE_ERROR(v3, DDERR_ALREADYINITIALIZED); CASE_ERROR(v3, DDERR_ALREADYINITIALIZED);
CASE_ERROR(v3, DDERR_CANNOTATTACHSURFACE); CASE_ERROR(v3, DDERR_CANNOTATTACHSURFACE);
default: default:
strcpy(v4, "DDERR unknown 0x%x"); strcpy(v4, "DDERR unknown 0x%x");
sprintf(error_buf, v4, error_code); sprintf(error_buf, v4, error_code);
return; return;
} }
strncpy(error_buf, v3, error_buf_len); strncpy(error_buf, v3, error_buf_len);
} }
void __fastcall TraceErrorDS(int error_code, char *error_buf, int error_buf_len) void __fastcall TraceErrorDS(int error_code, char *error_buf, int error_buf_len)
{ {
const char *v3; // eax const char *v3; // eax
char v4[20]; // [esp+0h] [ebp-14h] char v4[20]; // [esp+0h] [ebp-14h]
switch (error_code) { switch (error_code) {
CASE_ERROR(v3, DSERR_PRIOLEVELNEEDED); CASE_ERROR(v3, DSERR_PRIOLEVELNEEDED);
CASE_ERROR(v3, DSERR_BADFORMAT); CASE_ERROR(v3, DSERR_BADFORMAT);
CASE_ERROR(v3, DSERR_NODRIVER); CASE_ERROR(v3, DSERR_NODRIVER);
CASE_ERROR(v3, DSERR_ALREADYINITIALIZED); CASE_ERROR(v3, DSERR_ALREADYINITIALIZED);
CASE_ERROR(v3, DSERR_BUFFERLOST); CASE_ERROR(v3, DSERR_BUFFERLOST);
CASE_ERROR(v3, DS_OK); CASE_ERROR(v3, DS_OK);
CASE_ERROR(v3, DSERR_INVALIDCALL); CASE_ERROR(v3, DSERR_INVALIDCALL);
CASE_ERROR(v3, E_NOINTERFACE); CASE_ERROR(v3, E_NOINTERFACE);
CASE_ERROR(v3, DSERR_NOAGGREGATION); CASE_ERROR(v3, DSERR_NOAGGREGATION);
CASE_ERROR(v3, DSERR_OUTOFMEMORY); CASE_ERROR(v3, DSERR_OUTOFMEMORY);
CASE_ERROR(v3, DSERR_INVALIDPARAM); CASE_ERROR(v3, DSERR_INVALIDPARAM);
CASE_ERROR(v3, DSERR_ALLOCATED); CASE_ERROR(v3, DSERR_ALLOCATED);
CASE_ERROR(v3, DSERR_CONTROLUNAVAIL); CASE_ERROR(v3, DSERR_CONTROLUNAVAIL);
default: default:
strcpy(v4, "DSERR unknown 0x%x"); strcpy(v4, "DSERR unknown 0x%x");
sprintf(error_buf, v4, error_code); sprintf(error_buf, v4, error_code);
return; return;
} }
strncpy(error_buf, v3, error_buf_len); strncpy(error_buf, v3, error_buf_len);
} }
char *__cdecl TraceLastError() char *__cdecl TraceLastError()
{ {
int v0; // eax int v0; // eax
v0 = GetLastError(); v0 = GetLastError();
return GetErrorStr(v0); return GetErrorStr(v0);
} }
void TermMsg(char *pszFmt, ...) void TermMsg(char *pszFmt, ...)
{ {
va_list arglist; // [esp+8h] [ebp+8h] va_list arglist; // [esp+8h] [ebp+8h]
va_start(arglist, pszFmt); va_start(arglist, pszFmt);
FreeDlg(); FreeDlg();
if ( pszFmt ) if (pszFmt)
MsgBox(pszFmt, arglist); MsgBox(pszFmt, arglist);
va_end(arglist); va_end(arglist);
init_cleanup(0); init_cleanup(0);
exit(1); exit(1);
} }
void __fastcall MsgBox(char *pszFmt, va_list va) void __fastcall MsgBox(char *pszFmt, va_list va)
{ {
char Text[256]; // [esp+0h] [ebp-100h] char Text[256]; // [esp+0h] [ebp-100h]
wvsprintf(Text, pszFmt, va); wvsprintf(Text, pszFmt, va);
if ( ghMainWnd ) if (ghMainWnd)
SetWindowPos(ghMainWnd, HWND_NOTOPMOST, 0, 0, 0, 0, SWP_NOACTIVATE|SWP_NOMOVE|SWP_NOSIZE); SetWindowPos(ghMainWnd, HWND_NOTOPMOST, 0, 0, 0, 0, SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOSIZE);
MessageBox(ghMainWnd, Text, "ERROR", MB_TASKMODAL|MB_ICONHAND); MessageBox(ghMainWnd, Text, "ERROR", MB_TASKMODAL | MB_ICONHAND);
} }
void __cdecl FreeDlg() void __cdecl FreeDlg()
{ {
if ( terminating && cleanup_thread_id != GetCurrentThreadId() ) if (terminating && cleanup_thread_id != GetCurrentThreadId())
Sleep(20000u); Sleep(20000u);
terminating = 1; terminating = 1;
cleanup_thread_id = GetCurrentThreadId(); cleanup_thread_id = GetCurrentThreadId();
dx_cleanup(); dx_cleanup();
if ( (unsigned char)gbMaxPlayers > 1u ) if ((unsigned char)gbMaxPlayers > 1u) {
{ if (SNetLeaveGame(3))
if ( SNetLeaveGame(3) ) Sleep(2000u);
Sleep(2000u); }
} SNetDestroy();
SNetDestroy(); ShowCursor(1);
ShowCursor(1);
} }
// 4B7A34: using guessed type int terminating; // 4B7A34: using guessed type int terminating;
// 4B7A38: using guessed type int cleanup_thread_id; // 4B7A38: using guessed type int cleanup_thread_id;
@ -250,187 +248,178 @@ void __cdecl FreeDlg()
void DrawDlg(char *pszFmt, ...) void DrawDlg(char *pszFmt, ...)
{ {
char text[256]; // [esp+0h] [ebp-100h] char text[256]; // [esp+0h] [ebp-100h]
va_list arglist; // [esp+10Ch] [ebp+Ch] va_list arglist; // [esp+10Ch] [ebp+Ch]
va_start(arglist, pszFmt); va_start(arglist, pszFmt);
wvsprintf(text, pszFmt, arglist); wvsprintf(text, pszFmt, arglist);
va_end(arglist); va_end(arglist);
SDrawMessageBox(text, "Diablo", MB_TASKMODAL|MB_ICONEXCLAMATION); SDrawMessageBox(text, "Diablo", MB_TASKMODAL | MB_ICONEXCLAMATION);
} }
void __fastcall DDErrMsg(int error_code, int log_line_nr, char *log_file_path) void __fastcall DDErrMsg(int error_code, int log_line_nr, char *log_file_path)
{ {
int v3; // esi int v3; // esi
char *v4; // eax char *v4; // eax
v3 = log_line_nr; v3 = log_line_nr;
if ( error_code ) if (error_code) {
{ v4 = GetErrorStr(error_code);
v4 = GetErrorStr(error_code); TermMsg("Direct draw error (%s:%d)\n%s", log_file_path, v3, v4);
TermMsg("Direct draw error (%s:%d)\n%s", log_file_path, v3, v4); }
}
} }
void __fastcall DSErrMsg(int error_code, int log_line_nr, char *log_file_path) void __fastcall DSErrMsg(int error_code, int log_line_nr, char *log_file_path)
{ {
int v3; // esi int v3; // esi
char *v4; // eax char *v4; // eax
v3 = log_line_nr; v3 = log_line_nr;
if ( error_code ) if (error_code) {
{ v4 = GetErrorStr(error_code);
v4 = GetErrorStr(error_code); TermMsg("Direct sound error (%s:%d)\n%s", log_file_path, v3, v4);
TermMsg("Direct sound error (%s:%d)\n%s", log_file_path, v3, v4); }
}
} }
void __fastcall center_window(HWND hDlg) void __fastcall center_window(HWND hDlg)
{ {
LONG v1; // esi LONG v1; // esi
LONG v2; // edi LONG v2; // edi
int v3; // ebx int v3; // ebx
char *v4; // eax char *v4; // eax
struct tagRECT Rect; // [esp+Ch] [ebp-1Ch] struct tagRECT Rect; // [esp+Ch] [ebp-1Ch]
int v6; // [esp+1Ch] [ebp-Ch] int v6; // [esp+1Ch] [ebp-Ch]
HDC hdc; // [esp+20h] [ebp-8h] HDC hdc; // [esp+20h] [ebp-8h]
HWND hWnd; // [esp+24h] [ebp-4h] HWND hWnd; // [esp+24h] [ebp-4h]
hWnd = hDlg; hWnd = hDlg;
GetWindowRect(hDlg, &Rect); GetWindowRect(hDlg, &Rect);
v1 = Rect.right - Rect.left; v1 = Rect.right - Rect.left;
v2 = Rect.bottom - Rect.top; v2 = Rect.bottom - Rect.top;
hdc = GetDC(hWnd); hdc = GetDC(hWnd);
v6 = GetDeviceCaps(hdc, HORZRES); v6 = GetDeviceCaps(hdc, HORZRES);
v3 = GetDeviceCaps(hdc, VERTRES); v3 = GetDeviceCaps(hdc, VERTRES);
ReleaseDC(hWnd, hdc); ReleaseDC(hWnd, hdc);
if ( !SetWindowPos(hWnd, HWND_TOP, (v6 - v1) / 2, (v3 - v2) / 2, 0, 0, SWP_NOZORDER|SWP_NOSIZE) ) if (!SetWindowPos(hWnd, HWND_TOP, (v6 - v1) / 2, (v3 - v2) / 2, 0, 0, SWP_NOZORDER | SWP_NOSIZE)) {
{ v4 = TraceLastError();
v4 = TraceLastError(); TermMsg("center_window: %s", v4);
TermMsg("center_window: %s", v4); }
}
} }
void __fastcall ErrDlg(int template_id, int error_code, char *log_file_path, int log_line_nr) void __fastcall ErrDlg(int template_id, int error_code, char *log_file_path, int log_line_nr)
{ {
int v4; // ebx int v4; // ebx
int v5; // edi int v5; // edi
char *v6; // esi char *v6; // esi
char *v7; // eax char *v7; // eax
char *v8; // eax char *v8; // eax
LPARAM dwInitParam[128]; // [esp+Ch] [ebp-200h] LPARAM dwInitParam[128]; // [esp+Ch] [ebp-200h]
v4 = error_code; v4 = error_code;
v5 = template_id; v5 = template_id;
FreeDlg(); FreeDlg();
v6 = log_file_path; v6 = log_file_path;
v7 = strrchr(log_file_path, '\\'); v7 = strrchr(log_file_path, '\\');
if ( v7 ) if (v7)
v6 = v7 + 1; v6 = v7 + 1;
v8 = GetErrorStr(v4); v8 = GetErrorStr(v4);
wsprintf((LPSTR)dwInitParam, "%s\nat: %s line %d", v8, v6, log_line_nr); wsprintf((LPSTR)dwInitParam, "%s\nat: %s line %d", v8, v6, log_line_nr);
if ( DialogBoxParam(ghInst, MAKEINTRESOURCE(v5), ghMainWnd, (DLGPROC)FuncDlg, (LPARAM)dwInitParam) == -1 ) if (DialogBoxParam(ghInst, MAKEINTRESOURCE(v5), ghMainWnd, (DLGPROC)FuncDlg, (LPARAM)dwInitParam) == -1)
TermMsg("ErrDlg: %d", v5); TermMsg("ErrDlg: %d", v5);
TermMsg(0); TermMsg(0);
} }
BOOL __stdcall FuncDlg(HWND hDlg, UINT uMsg, WPARAM wParam, char *text) BOOL __stdcall FuncDlg(HWND hDlg, UINT uMsg, WPARAM wParam, char *text)
{ {
if ( uMsg == WM_INITDIALOG ) if (uMsg == WM_INITDIALOG) {
{ TextDlg(hDlg, text);
TextDlg(hDlg, text); } else {
} if (uMsg != WM_COMMAND)
else return 0;
{ if ((_WORD)wParam == 1) {
if ( uMsg != WM_COMMAND ) EndDialog(hDlg, 1);
return 0; } else if ((_WORD)wParam == 2) {
if ( (_WORD)wParam == 1 ) EndDialog(hDlg, 0);
{ }
EndDialog(hDlg, 1); }
} return 1;
else if ( (_WORD)wParam == 2 )
{
EndDialog(hDlg, 0);
}
}
return 1;
} }
void __fastcall TextDlg(HWND hDlg, char *text) void __fastcall TextDlg(HWND hDlg, char *text)
{ {
char *v2; // esi char *v2; // esi
HWND v3; // edi HWND v3; // edi
v2 = text; v2 = text;
v3 = hDlg; v3 = hDlg;
center_window(hDlg); center_window(hDlg);
if ( v2 ) if (v2)
SetDlgItemText(v3, 1000, v2); SetDlgItemText(v3, 1000, v2);
} }
void __fastcall ErrOkDlg(int template_id, int error_code, char *log_file_path, int log_line_nr) void __fastcall ErrOkDlg(int template_id, int error_code, char *log_file_path, int log_line_nr)
{ {
char *v4; // esi char *v4; // esi
int v5; // edi int v5; // edi
unsigned short v6; // bx unsigned short v6; // bx
char *v7; // eax char *v7; // eax
char *v8; // eax char *v8; // eax
LPARAM dwInitParam[128]; // [esp+Ch] [ebp-200h] LPARAM dwInitParam[128]; // [esp+Ch] [ebp-200h]
v4 = log_file_path; v4 = log_file_path;
v5 = error_code; v5 = error_code;
v6 = template_id; v6 = template_id;
v7 = strrchr(log_file_path, '\\'); v7 = strrchr(log_file_path, '\\');
if ( v7 ) if (v7)
v4 = v7 + 1; v4 = v7 + 1;
v8 = GetErrorStr(v5); v8 = GetErrorStr(v5);
wsprintf((LPSTR)dwInitParam, "%s\nat: %s line %d", v8, v4, log_line_nr); wsprintf((LPSTR)dwInitParam, "%s\nat: %s line %d", v8, v4, log_line_nr);
DialogBoxParam(ghInst, MAKEINTRESOURCE(v6), ghMainWnd, (DLGPROC)FuncDlg, (LPARAM)dwInitParam); DialogBoxParam(ghInst, MAKEINTRESOURCE(v6), ghMainWnd, (DLGPROC)FuncDlg, (LPARAM)dwInitParam);
} }
void __fastcall FileErrDlg(const char *error) void __fastcall FileErrDlg(const char *error)
{ {
const char *v1; // esi const char *v1; // esi
v1 = error; v1 = error;
FreeDlg(); FreeDlg();
if ( !v1 ) if (!v1)
v1 = &empty_string; v1 = &empty_string;
if ( DialogBoxParam(ghInst, MAKEINTRESOURCE(IDD_DIALOG3), ghMainWnd, (DLGPROC)FuncDlg, (LPARAM)v1) == -1 ) if (DialogBoxParam(ghInst, MAKEINTRESOURCE(IDD_DIALOG3), ghMainWnd, (DLGPROC)FuncDlg, (LPARAM)v1) == -1)
TermMsg("FileErrDlg"); TermMsg("FileErrDlg");
TermMsg(0); TermMsg(0);
} }
void __fastcall DiskFreeDlg(char *error) void __fastcall DiskFreeDlg(char *error)
{ {
char *v1; // esi char *v1; // esi
v1 = error; v1 = error;
FreeDlg(); FreeDlg();
if ( DialogBoxParam(ghInst, MAKEINTRESOURCE(IDD_DIALOG7), ghMainWnd, (DLGPROC)FuncDlg, (LPARAM)v1) == -1 ) if (DialogBoxParam(ghInst, MAKEINTRESOURCE(IDD_DIALOG7), ghMainWnd, (DLGPROC)FuncDlg, (LPARAM)v1) == -1)
TermMsg("DiskFreeDlg"); TermMsg("DiskFreeDlg");
TermMsg(0); TermMsg(0);
} }
BOOL __cdecl InsertCDDlg() BOOL __cdecl InsertCDDlg()
{ {
int v0; // edi int v0; // edi
ShowCursor(1); ShowCursor(1);
v0 = DialogBoxParam(ghInst, MAKEINTRESOURCE(IDD_DIALOG9), ghMainWnd, (DLGPROC)FuncDlg, (LPARAM)&empty_string); v0 = DialogBoxParam(ghInst, MAKEINTRESOURCE(IDD_DIALOG9), ghMainWnd, (DLGPROC)FuncDlg, (LPARAM)&empty_string);
if ( v0 == -1 ) if (v0 == -1)
TermMsg("InsertCDDlg"); TermMsg("InsertCDDlg");
ShowCursor(0); ShowCursor(0);
return v0 == 1; return v0 == 1;
} }
void __fastcall DirErrorDlg(char *error) void __fastcall DirErrorDlg(char *error)
{ {
char *v1; // esi char *v1; // esi
v1 = error; v1 = error;
FreeDlg(); FreeDlg();
if ( DialogBoxParam(ghInst, MAKEINTRESOURCE(IDD_DIALOG11), ghMainWnd, (DLGPROC)FuncDlg, (LPARAM)v1) == -1 ) if (DialogBoxParam(ghInst, MAKEINTRESOURCE(IDD_DIALOG11), ghMainWnd, (DLGPROC)FuncDlg, (LPARAM)v1) == -1)
TermMsg("DirErrorDlg"); TermMsg("DirErrorDlg");
TermMsg(0); TermMsg(0);
} }

2
Source/appfat.h

@ -3,7 +3,7 @@
#define __APPFAT_H__ #define __APPFAT_H__
extern char sz_error_buf[256]; extern char sz_error_buf[256];
extern int terminating; // weak extern int terminating; // weak
extern int cleanup_thread_id; // weak extern int cleanup_thread_id; // weak
extern char empty_string; extern char empty_string;

308
Source/debug.cpp

@ -22,218 +22,206 @@ void __cdecl FreeDebugGFX()
void __cdecl CheckDungeonClear() void __cdecl CheckDungeonClear()
{ {
int i; int i;
int j; int j;
for(i = 0; i < MAXDUNX; i++) for (i = 0; i < MAXDUNX; i++) {
{ for (j = 0; j < MAXDUNY; j++) {
for(j = 0; j < MAXDUNY; j++) if (dMonster[i][j])
{ TermMsg("Monsters not cleared");
if ( dMonster[i][j] ) if (dPlayer[i][j])
TermMsg("Monsters not cleared"); TermMsg("Players not cleared");
if ( dPlayer[i][j] )
TermMsg("Players not cleared"); dMonsDbg[currlevel][i][j] = dFlags[i][j] & DFLAG_VISIBLE;
dFlagDbg[currlevel][i][j] = dFlags[i][j] & DFLAG_POPULATED;
dMonsDbg[currlevel][i][j] = dFlags[i][j] & DFLAG_VISIBLE; }
dFlagDbg[currlevel][i][j] = dFlags[i][j] & DFLAG_POPULATED; }
}
}
} }
#ifdef _DEBUG #ifdef _DEBUG
void __cdecl GiveGoldCheat() void __cdecl GiveGoldCheat()
{ {
int i; // esi int i; // esi
int ni; // ebp int ni; // ebp
for(i = 0; i < 40; i++) for (i = 0; i < 40; i++) {
{ if (!plr[myplr].InvGrid[i]) {
if ( !plr[myplr].InvGrid[i] ) ni = plr[myplr]._pNumInv++;
{ SetPlrHandItem(&plr[myplr].InvList[ni], IDI_GOLD);
ni = plr[myplr]._pNumInv++; GetPlrHandSeed(&plr[myplr].InvList[ni]);
SetPlrHandItem(&plr[myplr].InvList[ni], IDI_GOLD); plr[myplr].InvList[ni]._ivalue = 5000;
GetPlrHandSeed(&plr[myplr].InvList[ni]); plr[myplr].InvList[ni]._iCurs = 6;
plr[myplr].InvList[ni]._ivalue = 5000; plr[myplr]._pGold += 5000;
plr[myplr].InvList[ni]._iCurs = 6; plr[myplr].InvGrid[i] = plr[myplr]._pNumInv;
plr[myplr]._pGold += 5000; }
plr[myplr].InvGrid[i] = plr[myplr]._pNumInv; }
}
}
} }
void __cdecl StoresCheat() void __cdecl StoresCheat()
{ {
int i; // eax int i; // eax
numpremium = 0; numpremium = 0;
for(i = 0; i < 6; i++) for (i = 0; i < 6; i++)
premiumitem[i]._itype = -1; premiumitem[i]._itype = -1;
SpawnPremium(30); SpawnPremium(30);
for(i = 0; i < 20; i++) for (i = 0; i < 20; i++)
witchitem[i]._itype = -1; witchitem[i]._itype = -1;
SpawnWitch(30); SpawnWitch(30);
} }
void __cdecl TakeGoldCheat() void __cdecl TakeGoldCheat()
{ {
int i; // esi int i; // esi
char ig; // cl char ig; // cl
for(i = 0; i < 40; i++) for (i = 0; i < 40; i++) {
{ ig = plr[myplr].InvGrid[i];
ig = plr[myplr].InvGrid[i]; if (ig > 0 && plr[myplr].InvList[ig - 1]._itype == ITYPE_GOLD)
if ( ig > 0 && plr[myplr].InvList[ig - 1]._itype == ITYPE_GOLD ) RemoveInvItem(myplr, ig - 1);
RemoveInvItem(myplr, ig - 1); }
}
for (i = 0; i < MAXBELTITEMS; i++) {
for(i = 0; i < MAXBELTITEMS; i++) if (plr[myplr].SpdList[i]._itype == ITYPE_GOLD)
{ plr[myplr].SpdList[i]._itype = -1;
if ( plr[myplr].SpdList[i]._itype == ITYPE_GOLD ) }
plr[myplr].SpdList[i]._itype = -1;
} plr[myplr]._pGold = 0;
plr[myplr]._pGold = 0;
} }
void __cdecl MaxSpellsCheat() void __cdecl MaxSpellsCheat()
{ {
for(int i = 1; i < MAX_SPELLS; i++) { for (int i = 1; i < MAX_SPELLS; i++) {
if ( spelldata[i].sBookLvl != -1 ) { if (spelldata[i].sBookLvl != -1) {
plr[myplr]._pMemSpells |= (__int64)1 << (i - 1); plr[myplr]._pMemSpells |= (__int64)1 << (i - 1);
plr[myplr]._pSplLvl[i] = 10; plr[myplr]._pSplLvl[i] = 10;
} }
} }
} }
void __fastcall SetSpellLevelCheat(char spl, int spllvl) void __fastcall SetSpellLevelCheat(char spl, int spllvl)
{ {
plr[myplr]._pMemSpells |= (__int64)1 << (spl - 1); plr[myplr]._pMemSpells |= (__int64)1 << (spl - 1);
plr[myplr]._pSplLvl[spl] = spllvl; plr[myplr]._pSplLvl[spl] = spllvl;
} }
void __cdecl SetAllSpellsCheat() void __cdecl SetAllSpellsCheat()
{ {
SetSpellLevelCheat(SPL_FIREBOLT, 8); SetSpellLevelCheat(SPL_FIREBOLT, 8);
SetSpellLevelCheat(SPL_CBOLT, 11); SetSpellLevelCheat(SPL_CBOLT, 11);
SetSpellLevelCheat(SPL_HBOLT, 10); SetSpellLevelCheat(SPL_HBOLT, 10);
SetSpellLevelCheat(SPL_HEAL, 7); SetSpellLevelCheat(SPL_HEAL, 7);
SetSpellLevelCheat(SPL_HEALOTHER, 5); SetSpellLevelCheat(SPL_HEALOTHER, 5);
SetSpellLevelCheat(SPL_LIGHTNING, 9); SetSpellLevelCheat(SPL_LIGHTNING, 9);
SetSpellLevelCheat(SPL_FIREWALL, 5); SetSpellLevelCheat(SPL_FIREWALL, 5);
SetSpellLevelCheat(SPL_TELEKINESIS, 3); SetSpellLevelCheat(SPL_TELEKINESIS, 3);
SetSpellLevelCheat(SPL_TOWN, 3); SetSpellLevelCheat(SPL_TOWN, 3);
SetSpellLevelCheat(SPL_FLASH, 3); SetSpellLevelCheat(SPL_FLASH, 3);
SetSpellLevelCheat(SPL_RNDTELEPORT, 2); SetSpellLevelCheat(SPL_RNDTELEPORT, 2);
SetSpellLevelCheat(SPL_MANASHIELD, 2); SetSpellLevelCheat(SPL_MANASHIELD, 2);
SetSpellLevelCheat(SPL_WAVE, 4); SetSpellLevelCheat(SPL_WAVE, 4);
SetSpellLevelCheat(SPL_FIREBALL, 3); SetSpellLevelCheat(SPL_FIREBALL, 3);
SetSpellLevelCheat(SPL_STONE, 1); SetSpellLevelCheat(SPL_STONE, 1);
SetSpellLevelCheat(SPL_CHAIN, 1); SetSpellLevelCheat(SPL_CHAIN, 1);
SetSpellLevelCheat(SPL_GUARDIAN, 4); SetSpellLevelCheat(SPL_GUARDIAN, 4);
SetSpellLevelCheat(SPL_ELEMENT, 3); SetSpellLevelCheat(SPL_ELEMENT, 3);
SetSpellLevelCheat(SPL_NOVA, 1); SetSpellLevelCheat(SPL_NOVA, 1);
SetSpellLevelCheat(SPL_GOLEM, 2); SetSpellLevelCheat(SPL_GOLEM, 2);
SetSpellLevelCheat(SPL_FLARE, 1); SetSpellLevelCheat(SPL_FLARE, 1);
SetSpellLevelCheat(SPL_BONESPIRIT, 1); SetSpellLevelCheat(SPL_BONESPIRIT, 1);
} }
void __fastcall PrintDebugPlayer(bool bNextPlayer) void __fastcall PrintDebugPlayer(bool bNextPlayer)
{ {
char dstr[128]; // [esp+Ch] [ebp-80h] char dstr[128]; // [esp+Ch] [ebp-80h]
if ( bNextPlayer ) if (bNextPlayer)
dbgplr = ((_BYTE)dbgplr + 1) & 3; dbgplr = ((_BYTE)dbgplr + 1) & 3;
sprintf(dstr, "Plr %i : Active = %i", dbgplr, plr[dbgplr].plractive); sprintf(dstr, "Plr %i : Active = %i", dbgplr, plr[dbgplr].plractive);
NetSendCmdString(1 << myplr, dstr); NetSendCmdString(1 << myplr, dstr);
if ( plr[dbgplr].plractive ) if (plr[dbgplr].plractive) {
{ sprintf(dstr, " Plr %i is %s", dbgplr, plr[dbgplr]._pName);
sprintf(dstr, " Plr %i is %s", dbgplr, plr[dbgplr]._pName); NetSendCmdString(1 << myplr, dstr);
NetSendCmdString(1 << myplr, dstr); sprintf(dstr, " Lvl = %i : Change = %i", plr[dbgplr].plrlevel, plr[dbgplr]._pLvlChanging);
sprintf(dstr, " Lvl = %i : Change = %i", plr[dbgplr].plrlevel, plr[dbgplr]._pLvlChanging); NetSendCmdString(1 << myplr, dstr);
NetSendCmdString(1 << myplr, dstr); sprintf(dstr, " x = %i, y = %i : tx = %i, ty = %i", plr[dbgplr].WorldX, plr[dbgplr].WorldY, plr[dbgplr]._ptargx, plr[dbgplr]._ptargy);
sprintf(dstr, " x = %i, y = %i : tx = %i, ty = %i", plr[dbgplr].WorldX, plr[dbgplr].WorldY, plr[dbgplr]._ptargx, plr[dbgplr]._ptargy); NetSendCmdString(1 << myplr, dstr);
NetSendCmdString(1 << myplr, dstr); sprintf(dstr, " mode = %i : daction = %i : walk[0] = %i", plr[dbgplr]._pmode, plr[dbgplr].destAction, plr[dbgplr].walkpath[0]);
sprintf(dstr, " mode = %i : daction = %i : walk[0] = %i", plr[dbgplr]._pmode, plr[dbgplr].destAction, plr[dbgplr].walkpath[0]); NetSendCmdString(1 << myplr, dstr);
NetSendCmdString(1 << myplr, dstr); sprintf(dstr, " inv = %i : hp = %i", plr[dbgplr]._pInvincible, plr[dbgplr]._pHitPoints);
sprintf(dstr, " inv = %i : hp = %i", plr[dbgplr]._pInvincible, plr[dbgplr]._pHitPoints); NetSendCmdString(1 << myplr, dstr);
NetSendCmdString(1 << myplr, dstr); }
}
} }
void __cdecl PrintDebugQuest() void __cdecl PrintDebugQuest()
{ {
char dstr[128]; // [esp+0h] [ebp-80h] char dstr[128]; // [esp+0h] [ebp-80h]
sprintf(dstr, "Quest %i : Active = %i, Var1 = %i", dbgqst, quests[dbgqst]._qactive, quests[dbgqst]._qvar1); sprintf(dstr, "Quest %i : Active = %i, Var1 = %i", dbgqst, quests[dbgqst]._qactive, quests[dbgqst]._qvar1);
NetSendCmdString(1 << myplr, dstr); NetSendCmdString(1 << myplr, dstr);
if ( ++dbgqst == MAXQUESTS ) if (++dbgqst == MAXQUESTS)
dbgqst = 0; dbgqst = 0;
} }
void __fastcall PrintDebugMonster(int m) void __fastcall PrintDebugMonster(int m)
{ {
bool bActive; // ecx bool bActive; // ecx
int i; // eax int i; // eax
char dstr[128]; // [esp+Ch] [ebp-80h] char dstr[128]; // [esp+Ch] [ebp-80h]
sprintf(dstr, "Monster %i = %s", m, monster[m].mName); sprintf(dstr, "Monster %i = %s", m, monster[m].mName);
NetSendCmdString(1 << myplr, dstr); NetSendCmdString(1 << myplr, dstr);
sprintf(dstr, "X = %i, Y = %i", monster[m]._mx, monster[m]._my); sprintf(dstr, "X = %i, Y = %i", monster[m]._mx, monster[m]._my);
NetSendCmdString(1 << myplr, dstr); NetSendCmdString(1 << myplr, dstr);
sprintf(dstr, "Enemy = %i, HP = %i", monster[m]._menemy, monster[m]._mhitpoints); sprintf(dstr, "Enemy = %i, HP = %i", monster[m]._menemy, monster[m]._mhitpoints);
NetSendCmdString(1 << myplr, dstr); NetSendCmdString(1 << myplr, dstr);
sprintf(dstr, "Mode = %i, Var1 = %i", monster[m]._mmode, monster[m]._mVar1); sprintf(dstr, "Mode = %i, Var1 = %i", monster[m]._mmode, monster[m]._mVar1);
NetSendCmdString(1 << myplr, dstr); NetSendCmdString(1 << myplr, dstr);
bActive = 0; bActive = 0;
for(i = 0; i < nummonsters; i++) for (i = 0; i < nummonsters; i++) {
{ if (monstactive[i] == m)
if ( monstactive[i] == m ) bActive = 1;
bActive = 1; }
}
sprintf(dstr, "Active List = %i, Squelch = %i", bActive, monster[m]._msquelch);
sprintf(dstr, "Active List = %i, Squelch = %i", bActive, monster[m]._msquelch); NetSendCmdString(1 << myplr, dstr);
NetSendCmdString(1 << myplr, dstr);
} }
void __cdecl GetDebugMonster() void __cdecl GetDebugMonster()
{ {
int v0; // ecx int v0; // ecx
int v1; // eax int v1; // eax
v0 = pcursmonst; v0 = pcursmonst;
if ( pcursmonst == -1 ) if (pcursmonst == -1) {
{ v1 = dMonster[cursmx][cursmy];
v1 = dMonster[cursmx][cursmy]; if (v1) {
if ( v1 ) v0 = v1 - 1;
{ if (v1 <= 0)
v0 = v1 - 1; v0 = -1 - v1;
if ( v1 <= 0 ) } else {
v0 = -1 - v1; v0 = dbgmon;
} }
else }
{ PrintDebugMonster(v0);
v0 = dbgmon;
}
}
PrintDebugMonster(v0);
} }
void __cdecl NextDebugMonster() void __cdecl NextDebugMonster()
{ {
char dstr[128]; // [esp+0h] [ebp-80h] char dstr[128]; // [esp+0h] [ebp-80h]
if ( dbgmon++ == MAXMONSTERS ) if (dbgmon++ == MAXMONSTERS)
dbgmon = 0; dbgmon = 0;
sprintf(dstr, "Current debug monster = %i", dbgmon); sprintf(dstr, "Current debug monster = %i", dbgmon);
NetSendCmdString(1 << myplr, dstr); NetSendCmdString(1 << myplr, dstr);
} }
#endif #endif

265
Source/error.cpp

@ -7,118 +7,113 @@ char msgdelay;
char msgflag; char msgflag;
char msgcnt; char msgcnt;
char *MsgStrings[44] = char *MsgStrings[44] = {
{ "",
"", "No automap available in town",
"No automap available in town", "No multiplayer functions in demo",
"No multiplayer functions in demo", "Direct Sound Creation Failed",
"Direct Sound Creation Failed", "Not available in shareware version",
"Not available in shareware version", "Not enough space to save",
"Not enough space to save", "No Pause in town",
"No Pause in town", "Copying to a hard disk is recommended",
"Copying to a hard disk is recommended", "Multiplayer sync problem",
"Multiplayer sync problem", "No pause in multiplayer",
"No pause in multiplayer", "Loading...",
"Loading...", "Saving...",
"Saving...", "Some are weakened as one grows strong",
"Some are weakened as one grows strong", "New strength is forged through destruction",
"New strength is forged through destruction", "Those who defend seldom attack",
"Those who defend seldom attack", "The sword of justice is swift and sharp",
"The sword of justice is swift and sharp", "While the spirit is vigilant the body thrives",
"While the spirit is vigilant the body thrives", "The powers of mana refocused renews",
"The powers of mana refocused renews", "Time cannot diminish the power of steel",
"Time cannot diminish the power of steel", "Magic is not always what it seems to be",
"Magic is not always what it seems to be", "What once was opened now is closed",
"What once was opened now is closed", "Intensity comes at the cost of wisdom",
"Intensity comes at the cost of wisdom", "Arcane power brings destruction",
"Arcane power brings destruction", "That which cannot be held cannot be harmed",
"That which cannot be held cannot be harmed", "Crimson and Azure become as the sun",
"Crimson and Azure become as the sun", "Knowledge and wisdom at the cost of self",
"Knowledge and wisdom at the cost of self", "Drink and be refreshed",
"Drink and be refreshed", "Wherever you go, there you are",
"Wherever you go, there you are", "Energy comes at the cost of wisdom",
"Energy comes at the cost of wisdom", "Riches abound when least expected",
"Riches abound when least expected", "Where avarice fails, patience gains reward",
"Where avarice fails, patience gains reward", "Blessed by a benevolent companion!",
"Blessed by a benevolent companion!", "The hands of men may be guided by fate",
"The hands of men may be guided by fate", "Strength is bolstered by heavenly faith",
"Strength is bolstered by heavenly faith", "The essence of life flows from within",
"The essence of life flows from within", "The way is made clear when viewed from above",
"The way is made clear when viewed from above", "Salvation comes at the cost of wisdom",
"Salvation comes at the cost of wisdom", "Mysteries are revealed in the light of reason",
"Mysteries are revealed in the light of reason", "Those who are last may yet be first",
"Those who are last may yet be first", "Generosity brings its own rewards",
"Generosity brings its own rewards", "You must be at least level 8 to use this.",
"You must be at least level 8 to use this.", "You must be at least level 13 to use this.",
"You must be at least level 13 to use this.", "You must be at least level 17 to use this.",
"You must be at least level 17 to use this.", "Arcane knowledge gained!"
"Arcane knowledge gained!"
}; };
void __fastcall InitDiabloMsg(char e) void __fastcall InitDiabloMsg(char e)
{ {
for ( int i = 0; i < msgcnt; i++ ) { for (int i = 0; i < msgcnt; i++) {
if ( msgtable[i] == e ) if (msgtable[i] == e)
return; return;
} }
msgtable[msgcnt] = e; msgtable[msgcnt] = e;
if ( msgcnt < (BYTE)sizeof(msgtable) ) if (msgcnt < (BYTE)sizeof(msgtable))
msgcnt++; msgcnt++;
msgflag = msgtable[0]; msgflag = msgtable[0];
msgdelay = 70; msgdelay = 70;
} }
void __cdecl ClrDiabloMsg() void __cdecl ClrDiabloMsg()
{ {
for (int i = 0; i < sizeof(msgtable); i++) for (int i = 0; i < sizeof(msgtable); i++)
msgtable[i] = 0; msgtable[i] = 0;
msgflag = 0; msgflag = 0;
msgcnt = 0; msgcnt = 0;
} }
void __cdecl DrawDiabloMsg() void __cdecl DrawDiabloMsg()
{ {
int v0; // esi int v0; // esi
signed int v1; // edi signed int v1; // edi
int v8; // edi int v8; // edi
signed int v9; // ebx signed int v9; // ebx
signed int v10; // eax signed int v10; // eax
signed int v11; // ecx signed int v11; // ecx
int v12; // esi int v12; // esi
signed int v13; // esi signed int v13; // esi
unsigned char v14; // bl unsigned char v14; // bl
bool v15; // zf bool v15; // zf
signed int v16; // [esp+Ch] [ebp-8h] signed int v16; // [esp+Ch] [ebp-8h]
signed int v17; // [esp+Ch] [ebp-8h] signed int v17; // [esp+Ch] [ebp-8h]
signed int screen_x; // [esp+10h] [ebp-4h] signed int screen_x; // [esp+10h] [ebp-4h]
CelDecodeOnly(165, 318, pSTextSlidCels, 1, 12); CelDecodeOnly(165, 318, pSTextSlidCels, 1, 12);
CelDecodeOnly(591, 318, pSTextSlidCels, 4, 12); CelDecodeOnly(591, 318, pSTextSlidCels, 4, 12);
CelDecodeOnly(165, 366, pSTextSlidCels, 2, 12); CelDecodeOnly(165, 366, pSTextSlidCels, 2, 12);
CelDecodeOnly(591, 366, pSTextSlidCels, 3, 12); CelDecodeOnly(591, 366, pSTextSlidCels, 3, 12);
screen_x = 173; screen_x = 173;
v16 = 35; v16 = 35;
do do {
{ CelDecodeOnly(screen_x, 318, pSTextSlidCels, 5, 12);
CelDecodeOnly(screen_x, 318, pSTextSlidCels, 5, 12); CelDecodeOnly(screen_x, 366, pSTextSlidCels, 7, 12);
CelDecodeOnly(screen_x, 366, pSTextSlidCels, 7, 12); screen_x += 12;
screen_x += 12; --v16;
--v16; } while (v16);
} v0 = 330;
while ( v16 ); v1 = 3;
v0 = 330; do {
v1 = 3; CelDecodeOnly(165, v0, pSTextSlidCels, 6, 12);
do CelDecodeOnly(591, v0, pSTextSlidCels, 8, 12);
{ v0 += 12;
CelDecodeOnly(165, v0, pSTextSlidCels, 6, 12); --v1;
CelDecodeOnly(591, v0, pSTextSlidCels, 8, 12); } while (v1);
v0 += 12;
--v1;
}
while ( v1 );
#define TRANS_RECT_X 104 #define TRANS_RECT_X 104
#define TRANS_RECT_Y 150 #define TRANS_RECT_Y 150
@ -126,46 +121,40 @@ void __cdecl DrawDiabloMsg()
#define TRANS_RECT_HEIGHT 54 #define TRANS_RECT_HEIGHT 54
#include "asm_trans_rect.inc" #include "asm_trans_rect.inc"
strcpy(tempstr, MsgStrings[msgflag]); strcpy(tempstr, MsgStrings[msgflag]);
v8 = screen_y_times_768[342] + 165; v8 = screen_y_times_768[342] + 165;
v9 = strlen(tempstr); v9 = strlen(tempstr);
v10 = 0; v10 = 0;
v11 = 0; v11 = 0;
v17 = v9; v17 = v9;
if ( v9 <= 0 ) if (v9 <= 0)
goto LABEL_27; goto LABEL_27;
do do {
{ v12 = (unsigned char)tempstr[v11++];
v12 = (unsigned char)tempstr[v11++]; v10 += fontkern[fontframe[fontidx[v12]]] + 1;
v10 += fontkern[fontframe[fontidx[v12]]] + 1; } while (v11 < v9);
} if (v10 < 442)
while ( v11 < v9 ); LABEL_27:
if ( v10 < 442 ) v8 += (442 - v10) >> 1;
LABEL_27: v13 = 0;
v8 += (442 - v10) >> 1; if (v9 > 0) {
v13 = 0; do {
if ( v9 > 0 ) v14 = fontframe[fontidx[(unsigned char)tempstr[v13]]];
{ if (v14)
do CPrintString(v8, v14, 3);
{ ++v13;
v14 = fontframe[fontidx[(unsigned char)tempstr[v13]]]; v8 += fontkern[v14] + 1;
if ( v14 ) } while (v13 < v17);
CPrintString(v8, v14, 3); }
++v13; v15 = msgdelay == 0;
v8 += fontkern[v14] + 1; if (msgdelay > 0)
} v15 = --msgdelay == 0;
while ( v13 < v17 ); if (v15) {
} v15 = msgcnt-- == 1;
v15 = msgdelay == 0; msgdelay = 70;
if ( msgdelay > 0 ) if (v15)
v15 = --msgdelay == 0; msgflag = 0;
if ( v15 ) else
{ msgflag = msgtable[msgcnt];
v15 = msgcnt-- == 1; }
msgdelay = 70;
if ( v15 )
msgflag = 0;
else
msgflag = msgtable[msgcnt];
}
} }

4
Source/fault.h

@ -3,8 +3,8 @@
#define __FAULT_H__ #define __FAULT_H__
struct STACK_FRAME { struct STACK_FRAME {
STACK_FRAME *pNext; STACK_FRAME *pNext;
void *pCallRet; void *pCallRet;
}; };
//int dword_52B9F4; //int dword_52B9F4;

339
Source/logging.cpp

@ -6,225 +6,212 @@ int log_cpp_init_value; // weak
static CRITICAL_SECTION sgMemCrit; static CRITICAL_SECTION sgMemCrit;
CHAR FileName[260]; // idb CHAR FileName[260]; // idb
char log_buffer[388]; char log_buffer[388];
LPCVOID lpAddress; // idb LPCVOID lpAddress; // idb
DWORD nNumberOfBytesToWrite; // idb DWORD nNumberOfBytesToWrite; // idb
const int log_inf = 0x7F800000; // weak const int log_inf = 0x7F800000; // weak
/* data */ /* data */
int log_not_created = 1; // weak int log_not_created = 1; // weak
HANDLE log_file = (HANDLE)0xFFFFFFFF; // idb HANDLE log_file = (HANDLE)0xFFFFFFFF; // idb
struct log_cpp_init_1 struct log_cpp_init_1 {
{ log_cpp_init_1()
log_cpp_init_1() {
{ log_cpp_init_value = log_inf;
log_cpp_init_value = log_inf; }
}
} _log_cpp_init_1; } _log_cpp_init_1;
// 47F070: using guessed type int log_inf; // 47F070: using guessed type int log_inf;
// 646A30: using guessed type int log_cpp_init_value; // 646A30: using guessed type int log_cpp_init_value;
struct log_cpp_init_2 struct log_cpp_init_2 {
{ log_cpp_init_2()
log_cpp_init_2() {
{ log_init_mutex();
log_init_mutex(); j_log_cleanup_mutex();
j_log_cleanup_mutex(); }
}
} _log_cpp_init_2; } _log_cpp_init_2;
void __cdecl log_init_mutex() void __cdecl log_init_mutex()
{ {
InitializeCriticalSection(&sgMemCrit); InitializeCriticalSection(&sgMemCrit);
} }
void __cdecl j_log_cleanup_mutex() void __cdecl j_log_cleanup_mutex()
{ {
atexit(log_cleanup_mutex); atexit(log_cleanup_mutex);
} }
void __cdecl log_cleanup_mutex() void __cdecl log_cleanup_mutex()
{ {
DeleteCriticalSection(&sgMemCrit); DeleteCriticalSection(&sgMemCrit);
} }
void __cdecl log_flush(bool force_close) void __cdecl log_flush(bool force_close)
{ {
void *v1; // eax void *v1; // eax
DWORD NumberOfBytesWritten; // [esp+8h] [ebp-4h] DWORD NumberOfBytesWritten; // [esp+8h] [ebp-4h]
EnterCriticalSection(&sgMemCrit); EnterCriticalSection(&sgMemCrit);
if ( nNumberOfBytesToWrite ) if (nNumberOfBytesToWrite) {
{ if (log_file == (HANDLE)-1) {
if ( log_file == (HANDLE)-1 ) v1 = log_create();
{ log_file = v1;
v1 = log_create(); if (v1 == (void *)-1) {
log_file = v1; nNumberOfBytesToWrite = 0;
if ( v1 == (void *)-1 ) return;
{ }
nNumberOfBytesToWrite = 0; SetFilePointer(v1, 0, NULL, FILE_END);
return; }
} WriteFile(log_file, lpAddress, nNumberOfBytesToWrite, &NumberOfBytesWritten, 0);
SetFilePointer(v1, 0, NULL, FILE_END); nNumberOfBytesToWrite = 0;
} }
WriteFile(log_file, lpAddress, nNumberOfBytesToWrite, &NumberOfBytesWritten, 0); if (force_close && log_file != (HANDLE)-1) {
nNumberOfBytesToWrite = 0; CloseHandle(log_file);
} log_file = (HANDLE)-1;
if ( force_close && log_file != (HANDLE)-1 ) }
{ LeaveCriticalSection(&sgMemCrit);
CloseHandle(log_file);
log_file = (HANDLE)-1;
}
LeaveCriticalSection(&sgMemCrit);
} }
void *__cdecl log_create() void *__cdecl log_create()
{ {
char *v0; // eax char *v0; // eax
void *v1; // ebx void *v1; // ebx
HANDLE v2; // eax HANDLE v2; // eax
char *v3; // edx char *v3; // edx
char Filename[260]; // [esp+Ch] [ebp-15Ch] char Filename[260]; // [esp+Ch] [ebp-15Ch]
VS_FIXEDFILEINFO file_info; // [esp+110h] [ebp-58h] VS_FIXEDFILEINFO file_info; // [esp+110h] [ebp-58h]
char Buffer[32]; // [esp+144h] [ebp-24h] char Buffer[32]; // [esp+144h] [ebp-24h]
DWORD pcbBuffer; // [esp+164h] [ebp-4h] DWORD pcbBuffer; // [esp+164h] [ebp-4h]
if ( log_not_created ) if (log_not_created) {
{ if (GetModuleFileName(0, Filename, 0x104u) && (v0 = strrchr(Filename, '\\')) != 0)
if ( GetModuleFileName(0, Filename, 0x104u) && (v0 = strrchr(Filename, '\\')) != 0 ) v0[1] = 0;
v0[1] = 0; else
else Filename[0] = 0;
Filename[0] = 0; pcbBuffer = 32;
pcbBuffer = 32; if (!GetUserName(Buffer, &pcbBuffer))
if ( !GetUserName(Buffer, &pcbBuffer) ) Buffer[0] = 0;
Buffer[0] = 0; log_get_version(&file_info);
log_get_version(&file_info); _snprintf(
_snprintf( FileName,
FileName, 0x104u,
0x104u, "%s%s%02u%02u%02u.ERR",
"%s%s%02u%02u%02u.ERR", Filename,
Filename, Buffer,
Buffer, _LOWORD(file_info.dwProductVersionMS),
_LOWORD(file_info.dwProductVersionMS), file_info.dwProductVersionLS >> 16,
file_info.dwProductVersionLS >> 16, _LOWORD(file_info.dwProductVersionLS));
_LOWORD(file_info.dwProductVersionLS)); }
} v1 = (void *)-1;
v1 = (void *)-1; for (pcbBuffer = log_not_created == 0; (signed int)pcbBuffer < 2; ++pcbBuffer) {
for ( pcbBuffer = log_not_created == 0; (signed int)pcbBuffer < 2; ++pcbBuffer ) v2 = CreateFile(FileName, GENERIC_WRITE, FILE_SHARE_READ, NULL, OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
{ v1 = v2;
v2 = CreateFile(FileName, GENERIC_WRITE, FILE_SHARE_READ, NULL, OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); if (v2 != (HANDLE)-1) {
v1 = v2; if (GetFileSize(v2, 0) > 0x10000)
if ( v2 != (HANDLE)-1 ) SetEndOfFile(v1);
{ break;
if ( GetFileSize(v2, 0) > 0x10000 ) }
SetEndOfFile(v1); v3 = strrchr(FileName, '\\');
break; if (!v3)
} v3 = FileName;
v3 = strrchr(FileName, '\\'); strcpy(Filename, "c:\\");
if ( !v3 ) memset(&Filename[4], 0, 0x100u);
v3 = FileName; strcat(Filename, v3);
strcpy(Filename, "c:\\"); strcpy(FileName, Filename);
memset(&Filename[4], 0, 0x100u); }
strcat(Filename, v3); log_not_created = 0;
strcpy(FileName, Filename); return v1;
}
log_not_created = 0;
return v1;
} }
// 4947D4: using guessed type int log_not_created; // 4947D4: using guessed type int log_not_created;
void __fastcall log_get_version(VS_FIXEDFILEINFO *file_info) void __fastcall log_get_version(VS_FIXEDFILEINFO *file_info)
{ {
DWORD v1; // eax DWORD v1; // eax
DWORD v2; // esi DWORD v2; // esi
void *v3; // ebx void *v3; // ebx
unsigned int v4; // eax unsigned int v4; // eax
char Filename[260]; // [esp+8h] [ebp-114h] char Filename[260]; // [esp+8h] [ebp-114h]
DWORD dwHandle; // [esp+10Ch] [ebp-10h] DWORD dwHandle; // [esp+10Ch] [ebp-10h]
LPVOID lpBuffer; // [esp+110h] [ebp-Ch] LPVOID lpBuffer; // [esp+110h] [ebp-Ch]
unsigned int puLen; // [esp+114h] [ebp-8h] unsigned int puLen; // [esp+114h] [ebp-8h]
void *v9; // [esp+118h] [ebp-4h] void *v9; // [esp+118h] [ebp-4h]
v9 = file_info; v9 = file_info;
memset(file_info, 0, 0x34u); memset(file_info, 0, 0x34u);
if ( GetModuleFileName(0, Filename, 0x104u) ) if (GetModuleFileName(0, Filename, 0x104u)) {
{ v1 = GetFileVersionInfoSize(Filename, &dwHandle);
v1 = GetFileVersionInfoSize(Filename, &dwHandle); v2 = v1;
v2 = v1; if (v1) {
if ( v1 ) v3 = VirtualAlloc(0, v1, 0x1000u, 4u);
{ if (GetFileVersionInfo(Filename, 0, v2, v3) && VerQueryValue(v3, "\\", &lpBuffer, &puLen)) {
v3 = VirtualAlloc(0, v1, 0x1000u, 4u); v4 = puLen;
if ( GetFileVersionInfo(Filename, 0, v2, v3) && VerQueryValue(v3, "\\", &lpBuffer, &puLen) ) if (puLen >= 0x34)
{ v4 = 52;
v4 = puLen; memcpy(v9, lpBuffer, v4);
if ( puLen >= 0x34 ) }
v4 = 52; VirtualFree(v3, 0, 0x8000u);
memcpy(v9, lpBuffer, v4); }
} }
VirtualFree(v3, 0, 0x8000u);
}
}
} }
void log_printf(const char *pszFmt, ...) void log_printf(const char *pszFmt, ...)
{ {
size_t v1; // edi size_t v1; // edi
char *v2; // eax char *v2; // eax
char v3[512]; // [esp+Ch] [ebp-200h] char v3[512]; // [esp+Ch] [ebp-200h]
va_list va; // [esp+218h] [ebp+Ch] va_list va; // [esp+218h] [ebp+Ch]
va_start(va, pszFmt); va_start(va, pszFmt);
EnterCriticalSection(&sgMemCrit); EnterCriticalSection(&sgMemCrit);
_vsnprintf(v3, 0x200u, pszFmt, va); _vsnprintf(v3, 0x200u, pszFmt, va);
va_end(va); va_end(va);
v3[511] = 0; v3[511] = 0;
v1 = strlen(v3); v1 = strlen(v3);
if ( v1 + nNumberOfBytesToWrite > 0x1000 ) if (v1 + nNumberOfBytesToWrite > 0x1000)
log_flush(0); log_flush(0);
v2 = (char *)lpAddress; v2 = (char *)lpAddress;
if ( lpAddress if (lpAddress
|| (v2 = (char *)VirtualAlloc((LPVOID)lpAddress, 0x1000u, 0x1000u, 4u), || (v2 = (char *)VirtualAlloc((LPVOID)lpAddress, 0x1000u, 0x1000u, 4u),
nNumberOfBytesToWrite = 0, nNumberOfBytesToWrite = 0,
(lpAddress = v2) != 0) ) (lpAddress = v2) != 0)) {
{ memcpy(&v2[nNumberOfBytesToWrite], v3, v1);
memcpy(&v2[nNumberOfBytesToWrite], v3, v1); nNumberOfBytesToWrite += v1;
nNumberOfBytesToWrite += v1; }
} LeaveCriticalSection(&sgMemCrit);
LeaveCriticalSection(&sgMemCrit);
} }
void __cdecl log_dump_computer_info() void __cdecl log_dump_computer_info()
{ {
char Buffer[64]; // [esp+0h] [ebp-88h] char Buffer[64]; // [esp+0h] [ebp-88h]
VS_FIXEDFILEINFO file_info; // [esp+40h] [ebp-48h] VS_FIXEDFILEINFO file_info; // [esp+40h] [ebp-48h]
struct _SYSTEMTIME SystemTime; // [esp+74h] [ebp-14h] struct _SYSTEMTIME SystemTime; // [esp+74h] [ebp-14h]
DWORD pcbBuffer; // [esp+84h] [ebp-4h] DWORD pcbBuffer; // [esp+84h] [ebp-4h]
GetLocalTime(&SystemTime); GetLocalTime(&SystemTime);
pcbBuffer = 64; pcbBuffer = 64;
if ( !GetUserName(Buffer, &pcbBuffer) ) if (!GetUserName(Buffer, &pcbBuffer))
Buffer[0] = 0; Buffer[0] = 0;
log_get_version(&file_info); log_get_version(&file_info);
log_printf( log_printf(
"\r\n" "\r\n"
"------------------------------------------------------\r\n" "------------------------------------------------------\r\n"
"PROGRAM VERSION: %d.%d.%d.%d\r\n" "PROGRAM VERSION: %d.%d.%d.%d\r\n"
"COMPUTER NAME: %s\r\n" "COMPUTER NAME: %s\r\n"
"TIME: %02u/%02u/%02u %02u:%02u:%02u\r\n" "TIME: %02u/%02u/%02u %02u:%02u:%02u\r\n"
"INFO: %s\r\n" "INFO: %s\r\n"
"\r\n", "\r\n",
file_info.dwProductVersionMS >> 16, file_info.dwProductVersionMS >> 16,
_LOWORD(file_info.dwProductVersionMS), _LOWORD(file_info.dwProductVersionMS),
file_info.dwProductVersionLS >> 16, file_info.dwProductVersionLS >> 16,
_LOWORD(file_info.dwProductVersionLS), _LOWORD(file_info.dwProductVersionLS),
Buffer, Buffer,
SystemTime.wMonth, SystemTime.wMonth,
SystemTime.wDay, SystemTime.wDay,
SystemTime.wYear % 100, SystemTime.wYear % 100,
SystemTime.wHour, SystemTime.wHour,
SystemTime.wMinute, SystemTime.wMinute,
SystemTime.wSecond, SystemTime.wSecond,
log_buffer); log_buffer);
} }

6
Source/logging.h

@ -3,9 +3,9 @@
#define __LOGGING_H__ #define __LOGGING_H__
extern int log_cpp_init_value; // weak extern int log_cpp_init_value; // weak
extern CHAR FileName[260]; // idb extern CHAR FileName[260]; // idb
extern char log_buffer[388]; extern char log_buffer[388];
extern LPCVOID lpAddress; // idb extern LPCVOID lpAddress; // idb
extern DWORD nNumberOfBytesToWrite; // idb extern DWORD nNumberOfBytesToWrite; // idb
void __cdecl log_cpp_init_1(); void __cdecl log_cpp_init_1();
@ -26,6 +26,6 @@ extern const int log_inf; // weak
/* data */ /* data */
extern int log_not_created; // weak extern int log_not_created; // weak
extern HANDLE log_file; // idb extern HANDLE log_file; // idb
#endif /* __LOGGING_H__ */ #endif /* __LOGGING_H__ */

2
types.h

@ -40,9 +40,9 @@
#include "enums.h" #include "enums.h"
#include "structs.h" #include "structs.h"
#include "3rdParty/PKWare/pkware.h"
#include "3rdParty/Storm/Source/storm.h" #include "3rdParty/Storm/Source/storm.h"
#include "DiabloUI/diabloui.h" #include "DiabloUI/diabloui.h"
#include "3rdParty/PKWare/pkware.h"
// If defined, use copy protection [Default -> Defined] // If defined, use copy protection [Default -> Defined]
//#define COPYPROT //#define COPYPROT

Loading…
Cancel
Save