From e51058998b495efd72d9e522779f413aab5e0462 Mon Sep 17 00:00:00 2001 From: zsknight <> Date: Wed, 9 May 2001 04:00:47 +0000 Subject: [PATCH] Added main screen clip layer (Illusion of Gaia fix) --- zsnes/src/video/newgfx16.asm | 101 ++++++++++++++++++++++++++++++++++- 1 file changed, 100 insertions(+), 1 deletion(-) diff --git a/zsnes/src/video/newgfx16.asm b/zsnes/src/video/newgfx16.asm index 6d8c036b..2e79a698 100644 --- a/zsnes/src/video/newgfx16.asm +++ b/zsnes/src/video/newgfx16.asm @@ -1355,6 +1355,7 @@ NEWSYM StartDrawNewGfx16b mov byte[WindowRedraw],1 sub dword[endlinet],8 + ; Clear video memory ; mov edi,[vidbuffer] ; xor eax,eax @@ -1771,6 +1772,8 @@ NEWSYM StartDrawNewGfx16b mov dword[mode0ads],40404040h Procbg3pr1b16b 2, drawbg3linepr116b, drawbg3tilepr116b, prdatc, ngmain, 4h .nodobg3mb2 + + call MainScreenClip call ProcessTransparencies .dontdraw xor ebx,ebx @@ -2563,6 +2566,7 @@ NEWSYM drawsprngw16b .main normalwsprng16b sprdrawprawb16bng,sprdrawprbwb16bng + drawsprng16bt: test byte[scadtng+ebx],10h jz near drawsprng16bnt @@ -2740,7 +2744,6 @@ drawsprngw16bmsnthr: xor edi,edi normalwsprng16b sprdrawprawb16bngmsnthr,sprdrawprbwb16bngmsnthr - ProcessTransparencies: cmp byte[NGNoTransp],0 je .yestransp @@ -3413,3 +3416,99 @@ NEWSYM HalfTransB, dd 00001000010000010000100001000001b,000010000100000100001000 NEWSYM HalfTransC, dd 11110111100111101111011110011110b,11110111100111101111011110011110b NEWSYM NGNoTransp, dd 0 NEWSYM NewGfx16AsmEnd + + +MainScreenClip: + mov esi,[vidbuffer] + add esi,16*2+288*2 + mov ebx,1 +.nextline + mov al,byte[scadsng+ebx] + test al,0C0h + jz near .notthisone + push esi + push ebx + and al,0C0h + cmp al,0C0h + jne .notentire + mov ebx,[UnusedBit] + mov ecx,256 + mov edx,256 + jmp .startclipping +.notentire + + mov dword[ngwinen],0 + test byte[winbg1enval+ebx+5*256],0Ah + jz .nowindowing + push eax + push ebx + mov al,[winlogicaval+ebx*2+1] + shr al,2 + and al,03h + mov [nglogicval],al + mov eax,ebx + add ebx,5*256 + call BuildWindow +;ngwintable + pop ebx + pop eax +.nowindowing + + mov ebx,[UnusedBit] + mov edx,256 + cmp dword[ngwinen],0 + jne .windowenabled + cmp al,80h + je near .finclipping + mov ecx,256 + jmp .startclipping +.windowenabled + cmp al,80h + je near .outsideclipping + mov edi,ngwintable + mov ecx,[edi] + add edi,4 + or ecx,ecx + jnz near .startclipping + mov ecx,[edi] + add edi,4 + jmp .noclipping +.outsideclipping + mov edi,ngwintable + mov ecx,[edi] + add edi,4 + or ecx,ecx + jnz .noclipping + mov ecx,[edi] + add edi,4 + jmp .startclipping + +.startclipping + and word[esi],bx + or word[esi+75036*2],bx + add esi,2 + dec edx + jz .finclipping + dec ecx + jnz .startclipping + mov ecx,[edi] + add edi,4 +.noclipping + sub edx,ecx + jz .finclipping + jc .finclipping + add ecx,ecx + add esi,ecx + mov ecx,[edi] + add edi,4 + jmp .startclipping + +.finclipping + pop ebx + pop esi +.notthisone + inc ebx + add esi,288*2 + cmp [resolutn],bx + jne near .nextline + ret