Replace printf/fprintf with own print_info() / print_error() using SDL_log
[mercenary-reloaded.git] / src / libvideo / video.c
index 516122b..c48742f 100644 (file)
@@ -19,6 +19,7 @@
 
 #include <stdio.h>
 #include <stdint.h>
+#include "../libsdl/print.h"
 #include "video.h"
 #include "../libcpu/m68kcpu.h"
 
@@ -147,7 +148,7 @@ void emul_video(uint8_t *rgb, uint8_t *memory, uint16_t render_palette[], int wi
        /* get copper list start pointer */
        copperlist = (io[COP1LCH] << 16) | io[COP1LCL];
        if (!copperlist) {
-               fprintf(stderr, "Copper list pointer not initialized, please fix!\n");
+               print_error("Copper list pointer not initialized, please fix!\n");
                return;
        }
 
@@ -161,7 +162,7 @@ void emul_video(uint8_t *rgb, uint8_t *memory, uint16_t render_palette[], int wi
        last_line = 0;
        while (42) {
                if (++count == 100) {
-                       fprintf(stderr, "Copper list does not seem to terminate, please fix!\n");
+                       print_error("Copper list does not seem to terminate, please fix!\n");
                        return;
                }
                c1 = m68k_read_memory_16(copperlist);
@@ -202,7 +203,7 @@ void emul_video(uint8_t *rgb, uint8_t *memory, uint16_t render_palette[], int wi
                        }
                } else {
                        if ((c2 & 1)) {
-                               fprintf(stderr, "We suppport no SKIP command in copper list, please fix!\n");
+                               print_error("We suppport no SKIP command in copper list, please fix!\n");
                                continue;
                        }
                        /* WAIT */
@@ -234,8 +235,10 @@ void emul_video(uint8_t *rgb, uint8_t *memory, uint16_t render_palette[], int wi
                                printf(" %06x", bitplane[i]);
 #endif
                                if (bitplane[i] == 0 || bitplane[i] + width * height / 8 >= 0x80000) {
+#ifdef DEBUG_COPPERLIST
                                        printf("\n");
-                                       fprintf(stderr, "Bitplane %d in copper list not set or out of range, please fix!\n", i);
+#endif
+                                       print_error("Bitplane %d in copper list not set or out of range, please fix!\n", i);
                                        return;
                                }
                                bitmem[i] = memory + bitplane[i];