Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
MorphOS/CybergraphX overlay modulo fix for E-UAE
Index: ami-win.c
===================================================================
--- ami-win.c (revision 161)
+++ ami-win.c (working copy)
@@ -147,7 +147,6 @@
#ifdef USE_CGX_OVERLAY
int use_overlay = 0;
-UWORD * vlayer_baseaddress = NULL;
APTR VLHandle = NULL;
BOOL attached=FALSE;
BOOL Bilinear=TRUE;
@@ -581,8 +580,9 @@
static void flush_block_cgx_overlay (struct vidbuf_description *gfxinfo, int first_line, int last_line)
{
int x,y;
- unsigned short * dst = NULL;
- unsigned short * ptr;
+ unsigned char * dst = NULL;
+ unsigned char * ptr;
+ int modulo;
unsigned long dstcolor;
unsigned short srccolor;
unsigned short color1, color2, color3, color4;
@@ -594,15 +594,16 @@
*/
- dst = (unsigned short * ) LockAddress();
+ dst = LockAddress();
if (!dst)
return;
if (last_line < 511)
last_line ++;
- dst += first_line*gfxinfo->width;
+ modulo = GetVLayerAttr(VLHandle, VOA_Modulo);
+ dst += first_line*modulo;
for (y=first_line; y<last_line; y++)
{
@@ -623,10 +624,10 @@
color4=swapw(srccolor);
*((unsigned long long *) ptr) = (((unsigned long long)color1)<<48) | (((unsigned long long)color2)<<32) | (((unsigned long long)color3)<<16) | (color4);
- ptr+=4;
+ ptr+=8;
}
- dst+= gfxinfo->width;
+ dst+=modulo;
}
UnlockAddress();
@@ -655,21 +656,23 @@
else
{
int x,y;
- unsigned short *dst = LockAddress();
+ int modulo;
+ unsigned char * dst = LockAddress();
unsigned short * ptr;
if (dst)
{
+ modulo = GetVLayerAttr(VLHandle, VOA_Modulo);
for (y=0; y<gfxinfo->height; y++)
{
- ptr = dst;
+ ptr = (unsigned short *)dst;
for (x=0; x<gfxinfo->width; x++)
{
*ptr++ = 0;
}
- dst+= gfxinfo->width;
+ dst+= modulo;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.