From eff5bc14a657270014a9faa77eb3c4f061171ee7 Mon Sep 17 00:00:00 2001 From: Tony Kuker Date: Wed, 19 Jan 2022 19:59:04 +0000 Subject: [PATCH] Fixed 256 color positioning --- src/raspberrypi/devices/scsi_powerview.cpp | 13 ++++++++++--- src/raspberrypi/devices/scsi_powerview.h | 2 +- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/src/raspberrypi/devices/scsi_powerview.cpp b/src/raspberrypi/devices/scsi_powerview.cpp index 77211697..dca2b3eb 100644 --- a/src/raspberrypi/devices/scsi_powerview.cpp +++ b/src/raspberrypi/devices/scsi_powerview.cpp @@ -687,8 +687,8 @@ bool SCSIPowerView::WriteFrameBuffer(const DWORD *cdb, const BYTE *buf, const DW case(eColors256): // Two Bytes per pixel update_width_px = update_width_x_bytes; - offset_row_px = (uint32_t)((offset) / screen_width_px)/2; - offset_col_px = (uint32_t)(((offset)/2) % screen_width_px); + offset_row_px = (uint32_t)(offset / screen_width_px); + offset_col_px = (uint32_t)(offset % screen_width_px); break; default: update_width_px = 0; @@ -723,7 +723,6 @@ bool SCSIPowerView::WriteFrameBuffer(const DWORD *cdb, const BYTE *buf, const DW } LOGTRACE("Calculate Offset: %u (%08X) Screen width: %u height: %u Update X: %u (%06X) Y: %u (%06X)", offset, offset, screen_width_px, screen_height_px, offset_row_px, offset_row_px, offset_col_px, offset_col_px); - LOGINFO("Update Width px: %d:%d (bytes: %d, %d)", update_width_px, update_height_px, update_width_x_bytes, update_height_y_bytes); if(update_width_px == 0){ // This is some weird error condition. For now, just return. @@ -740,6 +739,14 @@ bool SCSIPowerView::WriteFrameBuffer(const DWORD *cdb, const BYTE *buf, const DW return true; } + + // offset_row_px = (uint32_t)((offset) / screen_width_px)/2; + // offset_col_px = (uint32_t)(((offset)/2) % screen_width_px); + LOGDEBUG("Update Position: %d:%d Offset: %d Screen Width: %d Width px: %d:%d (bytes: %d, %d)", offset_col_px, offset_row_px, offset, screen_width_px, update_width_px, update_height_px, update_width_x_bytes, update_height_y_bytes); + + + + // For each row for (DWORD idx_row_y = 0; idx_row_y < (update_height_px); idx_row_y++){ diff --git a/src/raspberrypi/devices/scsi_powerview.h b/src/raspberrypi/devices/scsi_powerview.h index ff8463bb..af7df9f7 100644 --- a/src/raspberrypi/devices/scsi_powerview.h +++ b/src/raspberrypi/devices/scsi_powerview.h @@ -45,7 +45,7 @@ private: SASIDEV::ctrl_t *ctrl; - enum eColorDepth_t : uint16_t {eColorsNone=0x0001, eColorsBW=0x0002, eColors16=0x0010, eColors256=0x0100}; + enum eColorDepth_t : uint16_t {eColorsNone=0x0000, eColorsBW=0x0001, eColors16=0x0010, eColors256=0x0100}; eColorDepth_t color_depth;