1
0
mirror of https://github.com/FunkyFr3sh/cnc-ddraw.git synced 2025-03-15 06:04:49 +01:00

add some more debug logging

This commit is contained in:
FunkyFr3sh 2022-09-29 13:44:25 +02:00
parent 606a7460ee
commit c7f971c0be
3 changed files with 28 additions and 4 deletions

View File

@ -8,6 +8,7 @@ int dbg_exception_handler(EXCEPTION_POINTERS* exception);
void dbg_counter_start();
double dbg_counter_stop();
void dbg_debug_string(const char* format, ...);
void dbg_print_rect(char* info, LPRECT rect);
void dbg_draw_frame_info_start();
void dbg_draw_frame_info_end();
int dbg_printf(const char* fmt, ...);

View File

@ -73,7 +73,7 @@ HRESULT dds_Blt(
/* stretch or clip? */
BOOL is_stretch_blt = src_w != dst_w || src_h != dst_h;
/* keep this commented out until tested and confirmed working
/* keep this commented out until tested and confirmed working
if (This->clipper && src_surface && !(dwFlags & DDBLT_NO_CLIP) && src_w > 0 && src_h > 0 && dst_w > 0 && dst_h > 0)
{
DWORD size = 0;
@ -100,6 +100,11 @@ HRESULT dds_Blt(
src_c_rect.right -= (LONG)((dst_rect.right - dst_c_rect[i].right) * scale_w);
src_c_rect.bottom -= (LONG)((dst_rect.bottom - dst_c_rect[i].bottom) * scale_h);
dbg_print_rect("src_rect ", &src_rect);
dbg_print_rect("src_c_rect ", &src_c_rect);
dbg_print_rect("dst_rect ", &dst_rect);
dbg_print_rect("dst_c_rect[i]", &dst_c_rect[i]);
dds_Blt(This, &dst_c_rect[i], src_surface, &src_c_rect, dwFlags | DDBLT_NO_CLIP, lpDDBltFx);
}
}

View File

@ -48,7 +48,7 @@ int dbg_exception_handler(EXCEPTION_POINTERS* exception)
if (exception && exception->ExceptionRecord)
{
dbg_printf(
TRACE(
"Exception at %p (%08X)\n",
exception->ExceptionRecord->ExceptionAddress,
exception->ExceptionRecord->ExceptionCode);
@ -83,13 +83,13 @@ void dbg_init()
DWORD build_size = sizeof(build);
RegQueryValueExA(hkey, "BuildLab", NULL, NULL, (PVOID)&build, &build_size);
dbg_printf("%s (%s)\n", name, build);
TRACE("%s (%s)\n", name, build);
const char* (CDECL * wine_get_version)() =
(void*)GetProcAddress(GetModuleHandleA("ntdll.dll"), "wine_get_version");
if (wine_get_version)
dbg_printf("Wine version = %s\n", wine_get_version());
TRACE("Wine version = %s\n", wine_get_version());
}
}
}
@ -158,6 +158,24 @@ int dbg_printf(const char* fmt, ...)
return ret;
}
void dbg_print_rect(char* info, LPRECT rect)
{
#ifdef _DEBUG_X
if (rect)
{
TRACE(
" %s: l=%d, t=%d, r=%d, b=%d (%dx%d)\n",
info,
rect->left,
rect->top,
rect->right,
rect->bottom,
rect->right - rect->left,
rect->bottom - rect->top);
}
#endif
}
void dbg_draw_frame_info_start()
{
static DWORD tick_fps = 0;