Files
tdkpin/original/reconstructed/tests/test_game_assets.c
T
ddidderr c80f5e2136 fix(ui): restore staged loading progress
Correct raw 1000:531e's Pascal-order BitBlt to destination (202,328), height 13, and width (stage-1)*7 from original DAT994. Render stages 2 through 35 over DAT995, add deterministic loading screenshots, and update the C harness and evidence ledger for the corrected 237x13 source.

Test Plan:
- bash original/tools/test_reconstructed_c.sh
- python3 original/tools/audit_reconstruction.py --require-complete
- cargo test --all-targets
- cargo clippy --all-targets --all-features -- -D warnings
- rumdl check original/C_RECONSTRUCTION_FINAL_AUDIT.md tdkpin-rs/CHANGELOG.md tdkpin-rs/RECONSTRUCTION.md tdkpin-rs/README.md
- cargo run --quiet -- --simulate loading --at 0.55 --screenshot /tmp/tdkpin-loading-mid.png
- git diff --check
2026-08-23 19:03:09 +02:00

76 lines
1.8 KiB
C

#include "../tdkpin_game_assets.h"
#include <assert.h>
#include <string.h>
static uint8_t g_stack[0x400];
static unsigned g_step;
static INT16 g_expected_width;
HDC16 CreateCompatibleDC16(HDC16 dc)
{
assert(++g_step == 1 && dc == 0x1111);
return 0x2222;
}
HGDIOBJ16 SelectObject16(HDC16 dc, HGDIOBJ16 object)
{
assert(dc == 0x2222);
if (++g_step == 2) {
assert(object == 0x3333);
return 0x4444;
}
assert(g_step == 4 && object == 0x4444);
return 0x3333;
}
BOOL16 BitBlt16(
HDC16 destination,
INT16 destination_x,
INT16 destination_y,
INT16 width,
INT16 height,
HDC16 source,
INT16 source_x,
INT16 source_y,
uint32_t raster_operation)
{
assert(++g_step == 3);
assert(destination == 0x1111 && source == 0x2222);
assert(destination_x == 202 && destination_y == 328);
assert(width == g_expected_width && height == 13);
assert(source_x == 0 && source_y == 0);
assert(raster_operation == 0x00cc0020);
return 1;
}
BOOL16 DeleteObject16(HGDIOBJ16 object)
{
assert(++g_step == 5 && object == 0x2222);
return 1;
}
static void run_stage(uint8_t stage, INT16 expected_width)
{
memset(g_stack, 0, sizeof(g_stack));
Win16FarPtr frame = win16_make_far_pointer(0x6000, 0x100);
win16_write_u16(frame, 0x0e, 0x1111);
win16_write_u16(frame, 0xfffe, 0x3333);
g_step = 0;
g_expected_width = expected_width;
tdkpin_draw_loading_stage(frame, stage);
assert(g_step == 5);
assert(win16_read_u16(win16_far_add_offset(frame, 0xfff4)) == 0x2222);
assert(win16_read_u16(win16_far_add_offset(frame, 0xfffc)) == 0x4444);
}
int main(void)
{
win16_reset_segment_bindings();
win16_bind_segment(0x6000, g_stack, sizeof(g_stack), true);
run_stage(1, 0);
run_stage(35, 238);
run_stage(0, -7);
return 0;
}