Skip to content

Commit

Permalink
Keep track of cursor palette changes in the palettised display driver
Browse files Browse the repository at this point in the history
  • Loading branch information
ccawley2011 committed Jul 31, 2024
1 parent 4307c41 commit adf0025
Show file tree
Hide file tree
Showing 5 changed files with 44 additions and 12 deletions.
5 changes: 5 additions & 0 deletions SDL/fb.c
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,11 @@ static void PDD_Name(Host_SetPaletteEntry)(ARMul_State *state,int i,unsigned int
SDL_SetColors(sdd_surface, &col, i, 1);
}

static void PDD_Name(Host_SetCursorPaletteEntry)(ARMul_State *state,int i,unsigned int phys)
{
/* TODO */
}

static void PDD_Name(Host_SetBorderColour)(ARMul_State *state,unsigned int phys)
{
/* TODO */
Expand Down
5 changes: 5 additions & 0 deletions amiga/DispKbd.c
Original file line number Diff line number Diff line change
Expand Up @@ -459,6 +459,11 @@ static void PDD_Name(Host_SetPaletteEntry)(ARMul_State *state,int i,unsigned int
SetRGB32(&screen->ViewPort,i,r,g,b);
}

static void PDD_Name(Host_SetCursorPaletteEntry)(ARMul_State *state,int i,unsigned int phys)
{
/* TODO */
}

static void PDD_Name(Host_SetBorderColour)(ARMul_State *state,unsigned int phys)
{
/* Set border palette entry */
Expand Down
34 changes: 28 additions & 6 deletions arch/paldisplaydev.c
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,11 @@
- Function that gets called when a palette entry needs updating
- 'phys' is a 13-bit VIDC physical colour
void PDD_Name(Host_SetCursorPaletteEntry)(ARMul_State *state,int i,
uint_fast16_t phys)
- Function that gets called when a cursor palette entry needs updating
- 'phys' is a 13-bit VIDC physical colour
void PDD_Name(Host_SetBorderColour)(ARMul_State *state,uint_fast16_t phys)
- Function that gets called when the border colour needs updating
- 'phys' is a 13-bit VIDC physical colour
Expand Down Expand Up @@ -527,7 +532,7 @@ static void PDD_Name(EventFunc)(ARMul_State *state,CycleCount nowtime)
/* Ensure full palette rebuild on BPP change */
if((DC.VIDC_CR & 0xc) != (NewCR & 0xc))
{
DC.DirtyPalette = 65535;
DC.DirtyPalette = 0xFFFFF;
}

DC.VIDC_CR = NewCR;
Expand Down Expand Up @@ -580,7 +585,7 @@ static void PDD_Name(EventFunc)(ARMul_State *state,CycleCount nowtime)
DC.ForceRefresh = true;
}
DC.ModeChanged = false;
DC.DirtyPalette = -1;
DC.DirtyPalette = 0xFFFFF;
}

/* Update AutoUpdateFlags */
Expand Down Expand Up @@ -636,10 +641,22 @@ static void PDD_Name(EventFunc)(ARMul_State *state,CycleCount nowtime)
}

/* Update host palette */
if(DC.DirtyPalette & 0x10000)
if(DC.DirtyPalette & 0x80000)
{
PDD_Name(Host_SetBorderColour)(state,VIDC.BorderCol);
DC.DirtyPalette -= 0x10000;
DC.DirtyPalette -= 0x80000;
}
if(DC.DirtyPalette & 0x70000)
{
int i;
for(i=0;i<3;i++)
{
if(DC.DirtyPalette & (0x10000<<i))
{
PDD_Name(Host_SetCursorPaletteEntry)(state,i,VIDC.CursorPalette[i]);
}
}
DC.DirtyPalette &= 0xffff;
}
if(DC.DirtyPalette)
{
Expand Down Expand Up @@ -831,7 +848,7 @@ static void PDD_Name(VIDCPutVal)(ARMul_State *state,ARMword address, ARMword dat
if(VIDC.BorderCol != val)
{
VIDC.BorderCol = val;
DC.DirtyPalette |= 0x10000;
DC.DirtyPalette |= 0x80000;
}
break;

Expand All @@ -840,7 +857,12 @@ static void PDD_Name(VIDCPutVal)(ARMul_State *state,ARMword address, ARMword dat
case 0x4c: /* Cursor palette log col 3 */
addr = (addr-0x44)>>2;
dbug_vidc("VIDC cursor log col %d write val=0x%x\n",addr+1,val);
VIDC.CursorPalette[addr] = val & 0x1fff;
val &= 0x1fff;
if(VIDC.CursorPalette[addr] != val)
{
VIDC.CursorPalette[addr] = val;
DC.DirtyPalette |= 0x10000 << addr;
}
break;

case 0x60: /* Stereo image reg 7 */
Expand Down
5 changes: 5 additions & 0 deletions riscos-single/DispKbd.c
Original file line number Diff line number Diff line change
Expand Up @@ -392,6 +392,11 @@ static void PDD_Name(Host_SetPaletteEntry)(ARMul_State *state,int i,unsigned int
FakeBorderPalEntry = -1;
}

static void PDD_Name(Host_SetCursorPaletteEntry)(ARMul_State *state,int i,unsigned int phys)
{
/* TODO */
}

static void PDD_Name(Host_SetBorderColour)(ARMul_State *state,unsigned int phys)
{
char buf[5];
Expand Down
7 changes: 1 addition & 6 deletions win/DispKbd.c
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@ static void PDD_Name(Host_SetCursorPaletteEntry)(ARMul_State *state,int i,unsign
g |= g>>4;
b |= b<<4;

setCursorPaletteColour(i, r, g, b);
setCursorPaletteColour(i + 1, r, g, b);
}

static void PDD_Name(Host_SetBorderColour)(ARMul_State *state,unsigned int phys)
Expand Down Expand Up @@ -395,11 +395,6 @@ static void PDD_Name(RefreshMouse)(ARMul_State *state) {
rMouseWidth = Width;
rMouseHeight = Height;

/* Cursor palette */
for(x=0; x<3; x++) {
PDD_Name(Host_SetCursorPaletteEntry)(state,x+1,VIDC.CursorPalette[x]);
}

offset=0;
memptr=MEMC.Cinit*16;
repeat=0;
Expand Down

0 comments on commit adf0025

Please sign in to comment.