Pressing SHIFT+D during a race, causes a abort because PrintScreenFile16 is not implemented.
The patch below implements this function, however the resulting DUMP.BMP only contains purple. This probably has something to do with synchronizing gpu and cpu memory. (BrPixelmapLock/BrPixelmapUnlock causes a segmentation fault)
dump.zip
--- a/src/DETHRACE/common/utility.c
+++ b/src/DETHRACE/common/utility.c
@@ -748,7 +748,62 @@ void PrintScreenFile16(FILE* pF) {
int offset;
tU8* pixel_ptr;
tU16 pixel;
- NOT_IMPLEMENTED();
+
+ bit_map_size = 3 * gBack_screen->width * gBack_screen->height;
+ offset = 0x36;
+
+ // 1. BMP Header
+ // 1. 'BM' Signature
+ WriteU8L(pF, 'B');
+ WriteU8L(pF, 'M');
+ // 2. File size in bytes (header = 0xe bytes; infoHeader = 0x28 bytes; pixelData = xxx)
+ WriteU32L(pF, offset + bit_map_size);
+ // 3. unused
+ WriteU16L(pF, 0);
+ // 4. unused
+ WriteU16L(pF, 0);
+ // 5. pixelData offset (from beginning of file)
+ WriteU32L(pF, offset);
+
+ // 2. Info Header
+ // 1. InfoHeader Size
+ WriteU32L(pF, 0x28);
+ // 2. Width of bitmap in pixels
+ WriteU32L(pF, gBack_screen->width);
+ // 3. Height of bitmap in pixels
+ WriteU32L(pF, gBack_screen->height);
+ // 4. Number of planes
+ WriteU16L(pF, 1);
+ // 5. Bits per pixels / palletization (24 -> 8-bit per B/G/R channel)
+ WriteU16L(pF, 24);
+ // 6. Compression (0 = BI_RGB -> no compression)
+ WriteU32L(pF, 0);
+ // 7. Image Size (0 --> no compression)
+ WriteU32L(pF, 0);
+ // 8. Horizontal Pixels Per Meter
+ WriteU32L(pF, 0);
+ // 9. Vertical Pixels Per Meter
+ WriteU32L(pF, 0);
+ // 10. # Actually used colors
+ WriteU32L(pF, 0);
+ // 11. Number of important colors
+ WriteU32L(pF, 256);
+
+ // 3. Color table not present
+
+ // 4. Pixel Data (=LUT);
+ pixel_ptr = (tU8*)gBack_screen->pixels + gBack_screen->row_bytes * (gBack_screen->height - 1);
+ for (i = 0; i < gBack_screen->height; i++) {
+ for (j = 0; j < gBack_screen->width; j++) {
+ memcpy(&pixel, pixel_ptr, sizeof(pixel));
+ WriteU8L(pF, pixel << 3); // Blue
+ WriteU8L(pF, (pixel >> 3) & 0xf8); // Green
+ WriteU8L(pF, (pixel >> 8) & 0xf8); // Red
+ pixel_ptr += sizeof(pixel);
+ }
+ pixel_ptr -= sizeof(pixel) * gBack_screen->width + gBack_screen->row_bytes;
+ }
+ WriteU16L(pF, 0);
}
// IDA: void __cdecl PrintScreen()
(code from 0x000a35c4 from 3DFX.EXE)
Pressing SHIFT+D during a race, causes a abort because
PrintScreenFile16is not implemented.The patch below implements this function, however the resulting
DUMP.BMPonly contains purple. This probably has something to do with synchronizing gpu and cpu memory. (BrPixelmapLock/BrPixelmapUnlockcauses a segmentation fault)dump.zip
(code from
0x000a35c4from3DFX.EXE)