Thread Rating:
  • 1 Vote(s) - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[Source Code] Post Processing
#20
Meh, I guess this was kinda pointless. There aren't really any programmers on lfe/in the lf2 scene. I really don't enjoy coding those effects, and I don't even want to think about touching that code.

Anyway, here is the stuff you need to use the dll from rarara.dll :


rarara.asm:
Code:
.data
DllName db "effects.dll",0 ;dll name
Func db "draw",0 ; name of the drawing function


.data?
DllHandle dd ?
FuncHandle dd ?

.code

DllEntryPoint proc hInstDLL:DWORD, reason:DWORD, unused:DWORD


    mov eax,reason
    .if eax == DLL_PROCESS_ATTACH                                            ; Called when our dll loaded
        call DLLStartup                                                        ; Memory patches and jmp patches
        
        invoke LoadLibraryA, addr DllName
        mov DllHandle, eax
        
        invoke GetProcAddress, DllHandle, addr Func
        mov FuncHandle,eax
        
        .elseif reason == DLL_PROCESS_DETACH
        push NULL
        call PostQuitMessage

    .endif
    ret

DllEntryPoint endp

DLLStartup proc    

    invoke JmpPatch, 004229D4h, addr Draw_Shit    

    ret

DLLStartup endp

patches.inc:
Code:
.data
ds_r        dd 0041A79Ch
ds_c        dd 0043F100h

draw_r        dd 004229d9h

text db "silva",0

.data?
hDC        dd ?

.code


Draw_Shit proc
    
    pushad
    MOV EAX,DWORD PTR DS:[455608h]
    PUSH 510
    PUSH 100
    PUSH 0FFFFh
    PUSH 0
    PUSH offset text                   ;  ASCII "1670"
    PUSH EAX
    CALL draw_text
    ADD ESP,18h
    popad
    
    MOV EAX,DWORD PTR DS:[450B84h]


    JMP [draw_r]

Draw_Shit endp


draw_text proc
    
    
    var_4           = dword ptr -4
lpString        = dword ptr  4
arg_4           = dword ptr  8
arg_8           = dword ptr  0Ch
arg_C           = dword ptr  10h

                push    esi
                mov     esi, [esp+4+lpString]
                mov     eax, [esi]
                mov     edx, [eax+44h]
                push    edi
                lea     ecx, [esp+8+lpString]
                push    ecx
                push    esi
                call    edx
                mov     edi, eax
                test    edi, edi
                jl      short loc_4012FC
                mov     eax, [esp+0Ch+arg_4]
                mov     ecx, [esp+0Ch]
                push    ebx
                push    eax             ; COLORREF
                push    ecx             ; HDC
                mov        hDC, ecx
                call    ds:SetBkColor
                mov     edx, [esp+10h+arg_8]
                mov     eax, [esp+10h]
                push    edx             ; COLORREF
                push    eax             ; HDC
                call    ds:SetTextColor
                mov     ebx, [esp+10h+lpString]
                push    ebx             ; lpString
                call    ds:lstrlenA
                mov     ecx, [esp+24h]
                mov     edx, [esp+10h+arg_C]
                push    eax             ; int
                mov     eax, [esp+14h]
                push    ebx             ; LPCSTR
                push    ecx             ; int
                push    edx             ; int
                push    eax             ; HDC
                call    ds:TextOutA
                mov     edx, [esp+10h]
                mov     ecx, [esi]
                mov     eax, [ecx+68h]
                
                cmp dword ptr ds:[458428h],0 ;check if cheat is enabled
                je no_draw
                push eax
                mov eax,hDC
                push eax
                mov eax, [FuncHandle]
                call eax
                pop eax
no_draw:                
                push    edx
                push    esi
                call    eax
                mov     eax, edi
                pop     ebx
                

loc_4012FC:                             ; CODE XREF: sub_401290+17j
                pop     edi
                pop     esi

    
    ret

draw_text endp

Enjoy...

Includes a really simplistic example of how to trigger the effect. If cheat is enabled, the effect is working. If the cheat is off then nothing happens :p. If you have any specific questions about the source feel free to ask(specific questions, not just "What does all of it do?"). What I'm doing is, copying the draw text function and modifying it to call my dll. This has to be done because it is pretty much impossible to get the hDC without it. It makes a bunch of weird calls to directDraw, which is a COM interface, and is stupid :p. It's probably possible to remove all the irrelevant code from the function, but I decided to leave it:p.
[Image: doty7Xn.gif]

10 ʏᴇᴀʀs sɪɴᴄᴇ ɪʀᴄ ɢᴏᴏᴅ.ɪ ᴡᴀʟᴋ ᴛʜʀᴏᴜɢʜ ᴛʜᴇ ᴇᴍᴘᴛʏ sᴛʀᴇᴇᴛs ᴛʀʏɪɴɢ ᴛᴏ ᴛʜɪɴᴋ ᴏғ sᴏᴍᴇᴛʜɪɴɢ ᴇʟsᴇ ʙᴜᴛ ᴍʏ ᴘᴀᴛʜ ᴀʟᴡᴀʏs ʟᴇᴀᴅs ᴛᴏ ᴛʜᴇ ɪʀᴄ. ɪ sᴛᴀʀᴇ ᴀᴛ ᴛʜᴇ sᴄʀᴇᴇɴ ғᴏʀ ʜᴏᴜʀs ᴀɴᴅ ᴛʀʏ ᴛᴏ sᴜᴍᴍᴏɴ ᴛʜᴇ ɢᴏᴏᴅ ɪʀᴄ. ɪ ᴡᴀᴛᴄʜ ᴏᴛʜᴇʀ ɪʀᴄ ᴄʜᴀɴɴᴇʟs ʙᴜᴛ ɪᴛ ɪs ɴᴏ ɢᴏᴏᴅ. ɪ ᴘᴇsᴛᴇʀ ᴢᴏʀᴛ ᴀɴᴅ ᴛʀʏ ᴛᴏ ʀᴇsɪsᴛ ʜɪs sᴇxɪɴᴇss ʙᴜᴛ ɪᴛ ɪs ᴀʟʟ ᴍᴇᴀɴɪɴɢʟᴇss. ᴛʜᴇ ᴇɴᴅ ɪs ɴᴇᴀʀ.ɪ ᴛʜᴇɴ ᴜsᴜᴀʟʟʏ ʀᴇᴀᴅ sᴏᴍᴇ ᴏʟᴅ ɪʀᴄ ʟᴏɢs ᴀɴᴅ ᴄʀʏ ᴍʏsᴇʟғ ᴛᴏ sʟᴇᴇᴘ.


Reply
Thanks given by:


Messages In This Thread
[Source Code] Post Processing - by Boop - 06-06-2009, 08:56 AM
RE: Post Processing : Testers Needed - by Ramond - 06-06-2009, 09:07 AM
RE: Post Processing : Testers Needed - by Ascor - 06-06-2009, 10:36 AM
RE: Post Processing : Testers Needed - by Boop - 06-06-2009, 12:05 PM
RE: [Source Code] Post Processing - by Boop - 06-07-2009, 09:35 AM
RE: [Source Code] Post Processing - by Zazz1 - 06-09-2009, 06:54 AM
RE: [Source Code] Post Processing - by Boop - 06-09-2009, 04:32 PM
RE: [Source Code] Post Processing - by Zazz1 - 06-10-2009, 05:53 AM
RE: [Source Code] Post Processing - by Reaper - 06-10-2009, 12:35 PM
RE: [Source Code] Post Processing - by Ramond - 06-10-2009, 12:54 PM
RE: [Source Code] Post Processing - by Zazz1 - 06-11-2009, 06:12 AM
RE: [Source Code] Post Processing - by Boop - 06-11-2009, 06:29 AM
RE: [Source Code] Post Processing - by Azriel - 06-11-2009, 11:51 AM
RE: [Source Code] Post Processing - by Boop - 06-12-2009, 12:41 PM
RE: [Source Code] Post Processing - by Boop - 06-20-2009, 11:24 AM
RE: [Source Code] Post Processing - by Zazz1 - 06-22-2009, 06:26 AM
RE: [Source Code] Post Processing - by Boop - 06-23-2009, 02:31 PM



Users browsing this thread: 1 Guest(s)