[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[MiNT] libgem16: vs_color



I've spend some time to find out why vs_color isn't working in XaAES.

I think it's not XaAES but it is libgem.

I found that in vs_color.c the variables in the stack overwrite themselves, though I don't know why this happens.

I have a working version now by making the arrays static:


void
vs_color (short handle, short index, short rgb[])
{
  static short vdi_intin[4] = {0,0,0,0};
  static short vdi_control[VDI_CNTRLMAX] = {0};
  short *ptr;

  VDI_PARAMS(vdi_control, vdi_intin, 0L, vdi_dummy, vdi_dummy );

  ptr = vdi_intin;

  *(ptr ++) = index;           /* vdi_intin[0] = index */
if( (long)vdi_params.control & (long)1 ) <- this is true if arrays not static!


Now also pixel-detection works in the original way using vs_color, as well as restore-palette.

Someone will have to find out why the arrays are overwritten (I have placed Cconws-output in vs_color to detect these), I don't understand it.

BTW: The CLOBBERED_REGS-patch by Vincent has no effect, because the inlined code in gem_vdiP.h isn't used.

--
Helmut Karlowski