Most text seems to be fine now.

This commit is contained in:
starfrost013
2025-03-24 19:56:54 +00:00
parent 94cd84363c
commit 997acb990e
2 changed files with 112 additions and 48 deletions

View File

@@ -63,8 +63,20 @@ void nv3_class_00c_method(uint32_t param, uint32_t method_id, nv3_ramin_context_
nv3->pgraph.win95_gdi_text.point_d.x = (param & 0xFFFF);
nv3->pgraph.win95_gdi_text.point_d.y = ((param >> 16) & 0xFFFF);
nv3->pgraph.win95_gdi_text_current_position.x = (nv3->pgraph.win95_gdi_text.point_d.x + nv3->pgraph.win95_gdi_text.size_in_d.w);
nv3->pgraph.win95_gdi_text_current_position.y = (nv3->pgraph.win95_gdi_text.point_d.y);
/* small case*/
if (nv3->pgraph.win95_gdi_text.size_in_d.w < 0x0010)
{
nv3->pgraph.win95_gdi_text_current_position.x = (nv3->pgraph.win95_gdi_text.point_d.x + nv3->pgraph.win95_gdi_text.size_in_d.w);
nv3->pgraph.win95_gdi_text_current_position.y = (nv3->pgraph.win95_gdi_text.point_d.y);
}
/* large case: draw (7-0) (15-8)*/
else
{
uint16_t large_start = (nv3->pgraph.win95_gdi_text.size_in_d.w >> 1) ;
nv3->pgraph.win95_gdi_text_current_position.x = (nv3->pgraph.win95_gdi_text.point_d.x + large_start);
nv3->pgraph.win95_gdi_text_current_position.y = (nv3->pgraph.win95_gdi_text.point_d.y);
}
break;
default:
/* Type A submission: these are the same things as rectangles */
@@ -110,7 +122,7 @@ void nv3_class_00c_method(uint32_t param, uint32_t method_id, nv3_ramin_context_
nv3->pgraph.win95_gdi_text.clip_d.left, nv3->pgraph.win95_gdi_text.clip_d.right, nv3->pgraph.win95_gdi_text.clip_d.top, nv3->pgraph.win95_gdi_text.clip_d.bottom);
nv3_render_gdi_type_d(grobj, nv3->pgraph.win95_gdi_text.mono_color1_d[index]);
return;
}
nv_log("%s: Invalid or Unimplemented method 0x%04x", nv3_class_names[context.class_id & 0x1F], method_id);

View File

@@ -46,48 +46,50 @@ void nv3_render_rect(nv3_position_16_t position, nv3_size_16_t size, uint32_t co
}
}
void nv3_render_gdi_type_d(nv3_grobj_t grobj, uint32_t param)
void nv3_render_text_1bpp(bool bit, nv3_grobj_t grobj)
{
// reset when a position is submitted
nv3_position_16_t start_position = nv3->pgraph.win95_gdi_text_current_position;
uint16_t clip_x = nv3->pgraph.win95_gdi_text.point_d.x + nv3->pgraph.win95_gdi_text.size_out_d.w;
uint16_t clip_y = nv3->pgraph.win95_gdi_text.point_d.y + nv3->pgraph.win95_gdi_text.size_out_d.h;
// is this clip or point?
/* they send more data than they need */
if (nv3->pgraph.win95_gdi_text_current_position.y >= clip_y)
bit = false;
uint16_t end_x = nv3->pgraph.win95_gdi_text.point_d.x + nv3->pgraph.win95_gdi_text.size_in_d.w;
uint16_t end_y = nv3->pgraph.win95_gdi_text.point_d.y + nv3->pgraph.win95_gdi_text.size_in_d.h;
/* set up our packed pixels */
uint32_t pixel0 = 0, pixel1 = 0, pixel2 = 0, pixel3 = 0;
/* Go through the bitmap that was sent, bit by bit. */
for (int32_t bit_num = 0; bit_num <= 31; bit_num++)
// if it's a 0 bit we don't need to do anything
if (bit)
{
bool bit = (param >> bit_num) & 0x01;
//bool bit = true; // debug test
// if it's a 0 bit we don't need to do anything
if (bit)
switch (nv3->nvbase.svga.bpp)
{
switch (nv3->nvbase.svga.bpp)
{
case 8:
uint32_t final_color8 = (nv3->pgraph.win95_gdi_text.color1_d & 0xFF); /* do we need to add anything? mul blend perhaps? */
nv3_render_write_pixel(nv3->pgraph.win95_gdi_text_current_position, final_color8, grobj);
break;
case 16:
uint32_t final_color16 = (nv3->pgraph.win95_gdi_text.color1_d & 0xFFFF); /* do we need to add anything? mul blend perhaps? */
nv3_render_write_pixel(nv3->pgraph.win95_gdi_text_current_position, final_color16, grobj);
break;
case 32:
uint32_t final_color32 = (nv3->pgraph.win95_gdi_text.color1_d); /* do we need to add anything? mul blend perhaps? */
nv3_render_write_pixel(nv3->pgraph.win95_gdi_text_current_position, final_color32, grobj);
break;
}
case 8:
uint32_t final_color8 = (nv3->pgraph.win95_gdi_text.color1_d & 0xFF); /* do we need to add anything? mul blend perhaps? */
nv3_render_write_pixel(nv3->pgraph.win95_gdi_text_current_position, final_color8, grobj);
break;
case 16:
uint32_t final_color16 = (nv3->pgraph.win95_gdi_text.color1_d & 0xFFFF); /* do we need to add anything? mul blend perhaps? */
nv3_render_write_pixel(nv3->pgraph.win95_gdi_text_current_position, final_color16, grobj);
break;
case 32:
uint32_t final_color32 = (nv3->pgraph.win95_gdi_text.color1_d); /* do we need to add anything? mul blend perhaps? */
nv3_render_write_pixel(nv3->pgraph.win95_gdi_text_current_position, final_color32, grobj);
break;
}
}
/* increment the position - the bitmap is stored horizontally backward */
nv3->pgraph.win95_gdi_text_current_position.x--;
/* increment the position - the bitmap is stored horizontally backward */
nv3->pgraph.win95_gdi_text_current_position.x--;
if (nv3->pgraph.win95_gdi_text.size_in_d.w < 0x0010)
{
if (nv3->pgraph.win95_gdi_text_current_position.x <= nv3->pgraph.win95_gdi_text.point_d.x)
{
nv3->pgraph.win95_gdi_text_current_position.x = nv3->pgraph.win95_gdi_text.point_d.x + nv3->pgraph.win95_gdi_text.size_in_d.w;
nv3->pgraph.win95_gdi_text_current_position.y++;
}
}
/* dumb hack but it never seems to be any other sizes. draw lines (7-0) and then (15-8) */
else
{
uint16_t midpoint_x = nv3->pgraph.win95_gdi_text.point_d.x + (nv3->pgraph.win95_gdi_text.size_in_d.w << 1);
/* let's hope NV never overflow the y */
if (nv3->pgraph.win95_gdi_text_current_position.x <= nv3->pgraph.win95_gdi_text.point_d.x)
@@ -95,15 +97,65 @@ void nv3_render_gdi_type_d(nv3_grobj_t grobj, uint32_t param)
nv3->pgraph.win95_gdi_text_current_position.x = nv3->pgraph.win95_gdi_text.point_d.x + nv3->pgraph.win95_gdi_text.size_in_d.w;
nv3->pgraph.win95_gdi_text_current_position.y++;
}
/* check if we are in the clipping rectangle */
if (nv3->pgraph.win95_gdi_text_current_position.x < nv3->pgraph.win95_gdi_text.clip_d.left
|| nv3->pgraph.win95_gdi_text_current_position.x > nv3->pgraph.win95_gdi_text.clip_d.right
|| nv3->pgraph.win95_gdi_text_current_position.y < nv3->pgraph.win95_gdi_text.clip_d.top
|| nv3->pgraph.win95_gdi_text_current_position.y > nv3->pgraph.win95_gdi_text.clip_d.bottom)
{
return;
}
}
/* check if we are in the clipping rectangle */
if (nv3->pgraph.win95_gdi_text_current_position.x < nv3->pgraph.win95_gdi_text.clip_d.left
|| nv3->pgraph.win95_gdi_text_current_position.x > nv3->pgraph.win95_gdi_text.clip_d.right
|| nv3->pgraph.win95_gdi_text_current_position.y < nv3->pgraph.win95_gdi_text.clip_d.top
|| nv3->pgraph.win95_gdi_text_current_position.y > nv3->pgraph.win95_gdi_text.clip_d.bottom)
{
return;
}
}
void nv3_render_gdi_type_d(nv3_grobj_t grobj, uint32_t param)
{
// reset when a position is submitted
nv3_position_16_t start_position = nv3->pgraph.win95_gdi_text_current_position;
// is this clip or point?
/* set up our packed pixels */
uint32_t pixel0 = param & 0xFF;
uint32_t pixel1 = (param >> 8) & 0xFF;
uint32_t pixel2 = (param >> 16) & 0xFF;
uint32_t pixel3 = (param >> 24) & 0xFF;
/* small stuff */
/* Go through the bitmap that was sent, bit by bit. */
for (int32_t bit_num = 0; bit_num <= 7; bit_num++)
{
bool bit = (pixel0 >> bit_num) & 0x01;
nv3_render_text_1bpp(bit, grobj);
}
/* Go through the bitmap that was sent, bit by bit. */
for (int32_t bit_num = 0; bit_num <= 7; bit_num++)
{
bool bit = (pixel1 >> bit_num) & 0x01;
nv3_render_text_1bpp(bit, grobj);
}
/* Go through the bitmap that was sent, bit by bit. */
for (int32_t bit_num = 0; bit_num <= 7; bit_num++)
{
bool bit = (pixel2 >> bit_num) & 0x01;
nv3_render_text_1bpp(bit, grobj);
}
/* Go through the bitmap that was sent, bit by bit. */
for (int32_t bit_num = 0; bit_num <= 7; bit_num++)
{
bool bit = (pixel3 >> bit_num) & 0x01;
nv3_render_text_1bpp(bit, grobj);
}
}