From c7f971c0be59c20f26ce19578dee8601f2af8903 Mon Sep 17 00:00:00 2001 From: FunkyFr3sh Date: Thu, 29 Sep 2022 13:44:25 +0200 Subject: [PATCH] add some more debug logging --- inc/debug.h | 1 + src/ddsurface.c | 7 ++++++- src/debug.c | 24 +++++++++++++++++++++--- 3 files changed, 28 insertions(+), 4 deletions(-) diff --git a/inc/debug.h b/inc/debug.h index 84a269a..a585da4 100644 --- a/inc/debug.h +++ b/inc/debug.h @@ -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, ...); diff --git a/src/ddsurface.c b/src/ddsurface.c index fd60ea4..9dff430 100644 --- a/src/ddsurface.c +++ b/src/ddsurface.c @@ -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); } } diff --git a/src/debug.c b/src/debug.c index 6b9d12d..cac7a1b 100644 --- a/src/debug.c +++ b/src/debug.c @@ -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;