From c40b596968a4c14db0ec07199f69be60cbb0609d Mon Sep 17 00:00:00 2001 From: Scott Duensing Date: Tue, 25 Aug 2026 16:44:58 -0500 Subject: [PATCH] Fixes. --- .claude/settings.local.json | 34 +++++++++++++++++++++++++++++++++- README.md | 34 +++++++++++++++++++++++++++++----- win31drv/winddi.h | 14 ++++++++++++++ win31drv/winstub.c | 8 ++++++++ 4 files changed, 84 insertions(+), 6 deletions(-) diff --git a/.claude/settings.local.json b/.claude/settings.local.json index ef524a1..d4723b4 100644 --- a/.claude/settings.local.json +++ b/.claude/settings.local.json @@ -100,7 +100,39 @@ "Bash(msexpand:*)", "Bash(import -window root /tmp/dosbox_video/et4000_demo.png)", "Bash(git lfs:*)", - "Bash(while read f)" + "Bash(while read f)", + "Bash(git add:*)", + "Bash(git commit:*)", + "Bash(git push:*)", + "Bash(import:*)", + "Bash(xdotool search:*)", + "Bash(xargs:*)", + "Bash(scrot:*)", + "Bash(grep:*)", + "Bash(/tmp/dosbox_ttf_test.conf:*)", + "Bash(/tmp/dosbox_vbesvga_test.conf:*)", + "Bash(git reset:*)", + "Bash(/tmp/dosbox_demo8.conf:*)", + "Bash(DISPLAY=:0 python3:*)", + "Bash(flatpak kill:*)", + "WebFetch(domain:gitlab.winehq.org)", + "Bash(wmctrl -l:*)", + "Bash(WID=81788948)", + "Bash(xdotool windowactivate:*)", + "Bash(gnome-screenshot:*)", + "Bash(xdotool key:*)", + "Bash(# Check where DOSBox-X saves screenshots find ~/.var/app/com.dosbox_x.DOSBox-X -name \"\"*.png\"\")", + "Bash(xdpyinfo:*)", + "Bash(DISPLAY=:0 xdotool:*)", + "Bash(DISPLAY=:0 xwd:*)", + "Bash(convert:*)", + "Bash(export:*)", + "WebFetch(domain:rndtrash.github.io)", + "WebFetch(domain:www.compuphase.com)", + "WebFetch(domain:www.cs.odu.edu)", + "WebFetch(domain:eisbox.net)", + "WebFetch(domain:lospec.com)", + "WebFetch(domain:chalier.fr)" ] } } diff --git a/README.md b/README.md index c10e0cb..3ae6183 100644 --- a/README.md +++ b/README.md @@ -93,6 +93,9 @@ uint32_t color = wdrvGetPixel(drv, x, y); Point16T pts[] = {{0, 0}, {100, 100}}; wdrvPolyline(drv, pts, 2, MAKE_RGB(0, 0, 255)); +// Rectangle outline +wdrvRectangle(drv, 10, 10, 100, 50, MAKE_RGB(255, 255, 0)); + // Screen-to-screen blit WdrvBitBltParamsT bp = { .srcX=0, .srcY=0, .dstX=320, .dstY=240, .width=160, .height=120, .rop3=SRCCOPY }; @@ -103,6 +106,26 @@ void *fb = wdrvGetFramebuffer(drv); int32_t pitch = wdrvGetPitch(drv); ``` +### Text Rendering + +```c +// Opaque text: white on blue (built-in 8x16 font) +wdrvExtTextOut(drv, 10, 10, "Hello", 5, + MAKE_RGB(255, 255, 255), MAKE_RGB(0, 0, 170), true, NULL); + +// Load and use a TrueType font +WdrvFontT ttf = wdrvLoadFontTtf("LIBSANS.TTF", 20); +wdrvExtTextOut(drv, 10, 30, "TrueType", 8, + MAKE_RGB(255, 255, 0), MAKE_RGB(0, 0, 0), true, ttf); +wdrvUnloadFont(ttf); + +// Load from Windows .FON file +WdrvFontT fon = wdrvLoadFontFon("COURE.FON", 1); +wdrvExtTextOut(drv, 10, 50, "Courier", 7, + MAKE_RGB(0, 255, 255), MAKE_RGB(0, 0, 0), true, fon); +wdrvUnloadFont(fon); +``` + ### Error Handling All functions return `WDRV_OK` (0) on success or a negative error code. @@ -234,8 +257,8 @@ wait for the graphics engine to become idle between operations. | File | Lines | Description | |---|---|---| -| `windrv.h` | 189 | Public API: initialization, driver loading, drawing, errors | -| `windrv.c` | 3223 | DDI wrappers, GDI object management, interrupt handlers, binary patching | +| `windrv.h` | 250 | Public API: initialization, driver loading, drawing, errors | +| `windrv.c` | 4478 | DDI wrappers, GDI object management, interrupt handlers, binary patching | | `neload.h` | 118 | NE loader API | | `neload.c` | 962 | NE format parser: headers, segments, relocations, exports | | `neformat.h` | 215 | NE/MZ header structures, segment/relocation/entry table formats, DDI ordinals | @@ -243,7 +266,7 @@ wait for the graphics engine to become idle between operations. | `thunk.c` | 1021 | 32/16-bit relay, callback dispatch, DOS memory management | | `winstub.h` | 257 | Stub declarations, KERNEL/GDI/USER/DIBENG ordinal constants | | `winstub.c` | 1400 | ~80 Windows API stub implementations | -| `winddi.h` | 261 | DDI structures: GDIINFO, PDEVICE, DRAWMODE, brushes, pens | +| `winddi.h` | 334 | DDI structures: GDIINFO, PDEVICE, DRAWMODE, brushes, pens, fonts | | `wintypes.h` | 153 | Win16 basic types, far pointers, colors, ROP codes | | `log.h` | 37 | Logging API | | `log.c` | 83 | Log file output | @@ -252,12 +275,14 @@ wait for the graphics engine to become idle between operations. | File | Description | |---|---| -| `demo.c` | Demo program: loads driver, draws rectangles/pixels/lines/blits | +| `demo.c` | Demo program: rectangles, pixels, lines, blits, text, fonts, colors | | `Makefile` | Top-level build: compiles demo, links with libwindrv.a | | `win31drv/Makefile` | Library build: compiles sources into libwindrv.a | | `dosbox-x.conf` | DOSBox-X configuration for S3 Trio64 testing | | `tools/TEST.BAT` | Quick-test batch file for DOSBox-X | | `drivers/*.DRV` | Windows 3.x display driver binaries | +| `fon/*.FON` | Windows 3.x bitmap fonts (.FON containers) | +| `ttf/*.TTF` | TrueType fonts (Liberation family) | | `tools/cwsdpmi.zip` | CWSDPMI DPMI host (extracted during build) | | `tools/lib/libfl.so.2` | Shared library needed by DJGPP binutils | @@ -267,7 +292,6 @@ wait for the graphics engine to become idle between operations. GDIINFO reports 640x480. Drawing works within the 640x480 region. - **ET4000 is software-only**: DOSBox-X does not emulate the ET4000 accelerator engine; all drawing is CPU-rendered by the driver. -- **No text output**: ExtTextOut is not yet wired up. - **Single driver instance**: Only one driver can be loaded at a time. ## License diff --git a/win31drv/winddi.h b/win31drv/winddi.h index 9f5af1e..6a4b263 100644 --- a/win31drv/winddi.h +++ b/win31drv/winddi.h @@ -190,6 +190,20 @@ typedef struct __attribute__((packed)) { int16_t csColor; // Planes * bitsPixel } CursorInfo16T; +// ============================================================================ +// BITMAP - Off-screen bitmap descriptor (passed to CreateBitmap/BitmapBits) +// ============================================================================ + +typedef struct __attribute__((packed)) { + int16_t bmType; // 0 = memory bitmap + int16_t bmWidth; // Width in pixels + int16_t bmHeight; // Height in pixels + int16_t bmWidthBytes; // Bytes per scan line + uint8_t bmPlanes; // Number of color planes + uint8_t bmBitsPixel; // Bits per pixel + uint32_t bmBits; // Far pointer to bits (seg:off as DWORD) +} Bitmap16T; + // ============================================================================ // Enable() style parameter values // ============================================================================ diff --git a/win31drv/winstub.c b/win31drv/winstub.c index da91a6c..deab5d8 100644 --- a/win31drv/winstub.c +++ b/win31drv/winstub.c @@ -1056,6 +1056,14 @@ static uint32_t stubGetPrivateProfileString(uint16_t *p, uint16_t n) result = "on"; } else if (strcasecmp(key, "ELLIPSE-SUPPORT") == 0) { result = "on"; + } else if (strcasecmp(key, "HWPOLYGON-SUPPORT") == 0) { + result = "on"; + } else if (strcasecmp(key, "HWPOLYLINE-SUPPORT") == 0) { + result = "on"; + } else if (strcasecmp(key, "HARDWARE-SCANLINES") == 0) { + result = "on"; + } else if (strcasecmp(key, "HARDWARE-POLYLINES") == 0) { + result = "on"; } else if (strcasecmp(key, "SCACHE") == 0) { result = "on"; } else if (strcasecmp(key, "TEXTRMW") == 0) {