Implement GDI-B. Rewrite text rendering code for perfect implementation of GDI-C, GDI-D and GDI-E text classes. Fucking hell that took forever....

This commit is contained in:
starfrost013
2025-03-30 23:56:42 +01:00
parent c8e7bfac9e
commit f1a231b6cc
5 changed files with 392 additions and 145 deletions

View File

@@ -165,6 +165,7 @@ typedef enum nv3_pgraph_class_e
/* Type B: Clipped Rectangle */
#define NV3_W95TXT_B_CLIP_TOPLEFT 0x07F4
#define NV3_W95TXT_B_CLIP_BOTTOMRIGHT 0x07F8
#define NV3_W95TXT_B_COLOR 0x07FC
#define NV3_W95TXT_B_CLIP_CLIPRECT_START 0x0800
#define NV3_W95TXT_B_CLIP_CLIPRECT_SIZE 128 // Number of rects
#define NV3_W95TXT_B_CLIP_CLIPRECT_END 0x09FF
@@ -610,20 +611,20 @@ typedef struct nv3_object_class_00C
uint8_t reserved3[0x1F0];
nv3_clip_16_t clip_b;
uint32_t color_b; // Color for Clip B
nv3_clip_16_t rect_clip[64];
nv3_clip_16_t clipped_rect[64];
uint8_t reserved4[0x1E8];
nv3_clip_16_t clip_c;
uint32_t color1_c;
nv3_size_16_t size_c;
nv3_position_16_t point_c;
uint32_t color1_c_bitmap[128];
uint32_t bitmap_c[128];
uint8_t reserved5[0x368];
nv3_clip_16_t clip_d;
uint32_t color1_d;
nv3_size_16_t size_in_d;
nv3_size_16_t size_out_d;
nv3_position_16_t point_d;
uint32_t mono_color1_d[128];
uint32_t bitmap_d[128];
uint8_t reserved6[0x364];
nv3_clip_16_t clip_e;
uint32_t color0_e;
@@ -631,7 +632,7 @@ typedef struct nv3_object_class_00C
nv3_size_16_t size_in_e;
nv3_size_16_t size_out_e;
nv3_position_16_t point_e;
uint32_t mono_color1_e[128];
uint32_t bitmap_e[128];
uint8_t reserved7[0xB7F];
} nv3_win95_text_t;

View File

@@ -31,7 +31,8 @@ uint32_t nv3_render_downconvert_color(nv3_grobj_t grobj, nv3_color_expanded_t co
uint32_t nv3_render_set_pattern_color(nv3_color_expanded_t pattern_colour, bool use_color1);
/* Primitives */
void nv3_render_rect(nv3_position_16_t position, nv3_size_16_t size, uint32_t color, nv3_grobj_t grobj);
void nv3_render_rect(nv3_position_16_t position, nv3_size_16_t size, uint32_t color, nv3_grobj_t grobj); // Render an A (unclipped) GDI rect
void nv3_render_rect_clipped(nv3_clip_16_t clip, uint32_t color, nv3_grobj_t grobj); // Render a B (clipped) GDI rect.
/* Chroma */
bool nv3_render_chroma_test(uint32_t color, nv3_grobj_t grobj);
@@ -41,5 +42,5 @@ void nv3_render_blit_image(uint32_t color, nv3_grobj_t grobj);
void nv3_render_blit_screen2screen(nv3_grobj_t grobj);
/* GDI */
void nv3_render_gdi_type_d(nv3_grobj_t grobj, uint32_t param); /* GDI Type-D: Clipped 1bpp text */
void nv3_render_gdi_type_e(nv3_grobj_t grobj, uint32_t param); /* GDI Type-E: Clipped 1bpp two-colour text */
void nv3_render_gdi_transparent_bitmap(bool clip, uint32_t color, uint32_t bitmap_data, nv3_grobj_t grobj);
void nv3_render_gdi_1bpp_bitmap(uint32_t color0, uint32_t color1, uint32_t bitmap_data, nv3_grobj_t grobj); /* GDI Type-E: Clipped 1bpp colour-expanded bitmap */

View File

@@ -1229,7 +1229,9 @@ typedef struct nv3_pgraph_s
struct nv3_object_class_00A lin;
struct nv3_object_class_00B triangle;
struct nv3_object_class_00C win95_gdi_text;
nv3_position_16_t win95_gdi_text_current_position; /* This is here so we can hold the current state of the image draw */
/* These are here so we can hold the current state of the image draw */
uint32_t win95_gdi_text_bit_count;
nv3_position_16_t win95_gdi_text_current_position;
struct nv3_object_class_00D m2mf;
struct nv3_object_class_00E scaled_image_from_memory;
struct nv3_object_class_010 blit;