Jump to content

Cube animation overdraw


r0ger

Recommended Posts

Hi guys,

i've ripped some another rotating cube animation from one of FFF's cracks, and im actually struggling creating DC's for the black background without the cube overdrawing on the background.

spacer.png

i have even tried to clean that up with SetBkMode (TRANSPARENT) on the dword_40B7B8 variable,and still no use even with PatBlt.

if someone is interested i will send the crack file (unpacked) + its idb file from IDA pro.

thanks a bunch!

 

Edited by r0ger
attachment removed - problem fixed,now releasing the final version of the animation to be released for public
Link to comment
Teddy Rogers

You are probably not erasing/ clearing the background before drawing new lines. Try using InvalidateRect(hWnd, NULL, TRUE)...

Ted.

Link to comment
Posted (edited)

I've inserted InvalidateRect function on the loc_404EDF routine in StartAddress procedure and indeed it does clear the bg before draws new lines but the thing is it keeps flickering even the rest of the windows i have opened (not only the bones.exe. :E)

and i have also inserted a new tagRECT function for the bones window with GetClientRect, (offset r3kt) but still the same..

Edited by r0ger
Link to comment
Teddy Rogers

Check you are passing the correct window handle for "hWnd". If you are passing NULL it will invalidate all windows...

Ted.

Link to comment
Posted (edited)
11 minutes ago, Teddy Rogers said:

Check you are passing the correct window handle for "hWnd". If you are passing NULL it will invalidate all windows...

Ted.

i did that. still flickers on all windows even if i set the window handle to null or hWnd.

normally, the main hDC variable for the cube is dword_40B67C. and the "hdcSrc" for the clean bg for the cube is dword_40B7B8. so unfortunately still don't know how should i implement a new black background in it.

so on FFF's release, the dword_40B7B8 variable is when the bitmap file is initiated after CreateCompatibleDC in IDA pro, and then RocketSpawn applied it with SelectObject on the hdcSrc variable.:

spacer.png

but it's actually in the sub_404F44 procedure where the two texts "FFF (c) 2004" and "RocketSpawn" scrolling from the cube to the top, but i excluded that procedure as long as i wanted to make a 400x200 aboutbox with a credits roll procedure in it ( i mean to have the cube on the left and the credits roll on the right).

Edited by r0ger
Link to comment
Teddy Rogers

If it is still flickering it is because the window handle isn't correct and you are passing NULL. If you are copying "hWnd" in your code check it isn't named something different like "Win", "Win_hWnd", etc.

You could try using UpdateWindow(hWnd), that will force a WM_PAINT and, depending on the code, force the background to be erased on BeginPaint...

Ted.

  • Like 1
Link to comment
hypotalik

redrawing the dialog with UpdateWindow wouldn't make it laggy/flickering? especially that this api is redrawing the whole UI and if you have a 'fast' timer it would make it worst?
especially like if you would try to move the window or something? sound a lot of cpu consumtion to redraw every 'x' miliseconds to keep with the effect, InvalidateRect seem more appropriate for this stuff, but i'm not a gdi guy, nor looked at the code, just reading the msdn.

Edited by hypotalik
  • Like 1
Link to comment
Posted (edited)

also tested it on Windows 7 vm with the Windows classic theme and seems to draw perfectly but with very less flicker. idk why is that flickering on windows 10...

btw just googled somewhere and found a GDI base for creating aboutboxes and i will see what i can do to implement it on that one. 

spacer.png

Edited by r0ger
Link to comment
fearless

Cant download your attachments, always seem to get picked up by windows defender. Even with setting exclusions.

Link to comment
Posted (edited)
16 hours ago, fearless said:

Cant download your attachments, always seem to get picked up by windows defender. Even with setting exclusions.

removed the exe files so u can have a look at the project this time.

 

Edited by r0ger
  • Like 1
Link to comment
Posted (edited)

spacer.png

solved the problem actually. 

on the cube animation procedures, i had to set the dc variable to hBackDC (not hMainDC) to insert it properly in the background because on rysowanie procedure on DoGfx, the cube flickered because the jmp function actually refreshes the lines every 0.10 seconds with Sleep function.

now the cube animation doesn't flicker anymore and it works perfectly,thankx all of u for suggestions :)

Edited by r0ger
  • Thanks 1
Link to comment
Posted (edited)

okay,this time i hardly get the text scroller working without making the cube (or itself) flickering so when i insert the txt scroller the cube flickers more , so does the scroller and it also paints white over the bg.....if anyone wants to help me with that , please DM me.

 

Edited by r0ger
Link to comment
Teddy Rogers

Are you drawing directly to the windows device context?

If you are it would be better to complete all your drawing operations off screen using a memory device context (bitmap) then when finished blit it to the window...

Ted.

  • Like 1
Link to comment
Posted (edited)

- attachment removed - made the cube working again for the STATIC control atm.

 

Edited by r0ger
Link to comment

spacer.png

day 9000 of the cube effect - finally got the cube right and without flickering (not rly, but very very less now but it's acceptable) !

the solution was to create a device context for the static control i've inserted (GetDlgItem,xWnd,10), then create the bitmap for the cube, and then apply it with SelectObject. like i did almost the same thing with the RotatingDotz animation from TSRh.

reason for line overdrawing was that i forgot to insert the GetClientRect function on the ebp variable which was saved for the black rectangle for the cube - in the analysis of the FFF crack in IDA pro, ebp global value was moved to the stru_40B680 rectangle variable which i had to get all the dimensions with GetClientRect.

at the moment i have made it only for when i want to insert this cube in the main keygen form. i will be testing it as well for the aboutbox and see if this one works along with the vertical scroller.

  • Like 1
Link to comment
fearless
SiNnN proc near
    fsin
    fnstsw  ax
    sahf
    jp      short loc_402670
    retn

loc_402670:
    fstp    st
    fldz
SiNnN endp ; no ret or retn here
; it likely to fall through to the r0und proc instead if jump_if_parity is followed. 
; r0und has a retn so it wont go any further

r0und proc near

var_8           = qword ptr -8

    sub     esp, 8
    fistp   [esp+8+var_8]
    wait
    pop     eax
    pop     edx
    retn
r0und endp

SiNnN doesnt have a retn if jump if parity is followed. Just wanted to check if this was intentional or something that was omitted by mistake?

 

Edited by fearless
typo
  • Like 1
Link to comment
9 minutes ago, fearless said:
SiNnN proc near
    fsin
    fnstsw  ax
    sahf
    jp      short loc_402670
    retn

loc_402670:
    fstp    st
    fldz
SiNnN endp ; no ret or retn here
; it likely to fall through to the r0und proc instead of jump_if_parity is followed. 
; r0und has a retn so it wont go any further

r0und proc near

var_8           = qword ptr -8

    sub     esp, 8
    fistp   [esp+8+var_8]
    wait
    pop     eax
    pop     edx
    retn
r0und endp

SiNnN doesnt have a retn if jump if parity is followed. Just wanted to check if this was intentional or something that was omitted by mistake?

 

yeah i probably deleted it by mistake perhaps when messing around with this snippet. 😛

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...