Posts: 1,018
Threads: 60
Joined: Mar 2008
07-21-2009, 10:01 AM
(This post was last modified: 07-21-2009, 12:20 PM by Boop .)
Being, bored + seeing how the NTSD skin(yes I follow the progress, because it is the only mod which is making progress) is getting ruined by non transparent text, I decided to make this
.
Code:
.data
hDC dd ?
.code
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 ;Magic Call #1
mov edi, eax
test edi, edi
jl short loc_4012FC
mov eax, [esp+0Ch+arg_4]
mov ecx, [esp+0Ch]
push ebx
push TRANSPARENT ; mode
push ecx ; HDC
mov hDC, ecx
call ds:SetBkMode
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]
push edx
push esi
call eax ; Magic Call 2
mov eax, edi
pop ebx
loc_4012FC: ; CODE XREF: sub_401290+17j
pop edi
pop esi
ret
draw_text endp
in rarara.asm, add(at the top bit, you should be able to figure it out) :
Code:
include \masm32\include\gdi32.inc
includelib \masm32\lib\gdi32.lib
Now there are two ways of using this. Patching every line of text that you want to be transparent (useful if you want the majority of your text to still have a background) or completely replacing the real function with your one.
#1:
;makes the background of the first line in the credits transparent
invoke CallPatch,004272C2h, addr draw_text
#2:
;i haven't tested this, should make all text transparent
invoke JmpPatch,00401290h, addr draw_text
Enjoy.
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ʟᴇᴇᴘ.
Thanks given by:
Posts: 152
Threads: 5
Joined: Mar 2009
waitttttttttttttt.................
thats awesome
you found how to make text bmps (in the exe) in to pngs (trasparency)
if you can do this getting 2.0 to load pngs shouldn't be tough
Thanks given by:
Posts: 1,018
Threads: 60
Joined: Mar 2008
07-21-2009, 11:49 AM
(This post was last modified: 07-21-2009, 11:49 AM by Boop .)
No...
That is what I'm talking about(the blue background around the letters). Those little things really annoy me
. Nothing to do with bmps, pngs, transparency or anything really.
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ʟᴇᴇᴘ.
Thanks given by:
Posts: 152
Threads: 5
Joined: Mar 2009
i noe
that blue background
its like when lf2 types the letters it's pasting the letters with a blue background together
so you can say they are bmps - a.bmp b.bmp c.bmp d.bmp e.bmp etc
so you like changed it to pngs - a.png b.png c.png d.png e.png etc
so its the same pic but with transparency
(atleast my logic)
i wonder if you can get 2.0 to load pngs (it will help ntsd2 (they needed alpha transparency before))
Thanks given by:
Posts: 1,003
Threads: 3
Joined: Mar 2008
naruto, you have absolutely no clue how that works and are talking random wrong sh*t... that stuff is all we need, thanks alot silva^^
Thanks given by:
Posts: 152
Threads: 5
Joined: Mar 2009
not working for me 0.o
i put the .code part in generic.inc's .code part
and .data part in generic.inc's .data part
and the
ASM-Code:
.data
hDC dd ?
.code
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 ;Magic Call #1
mov edi , eax
test edi , edi
jl short loc_4012FC
mov eax , [ esp + 0Ch + arg_4]
mov ecx , [ esp + 0Ch ]
push ebx
push TRANSPARENT ; mode
push ecx ; HDC
mov hDC, ecx
call ds : SetBkMode
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 ]
push edx
push esi
call eax ; Magic Call 2
mov eax , edi
pop ebx
loc_4012FC: ; CODE XREF: sub_401290+17j
pop edi
pop esi
ret
draw_text endp
and this
include \masm32\include\gdi32.inc
includelib \masm32\lib\gdi32.lib
in rarara. asm top part (they were toghether)
and these
#1:
;makes the background of the first line in the credits transparent
invoke CallPatch,004272C2h, addr draw_text
#2:
;i haven't tested this, should make all text transparent
invoke JmpPatch,00401290h, addr draw_text
tried both not working
Thanks given by:
Posts: 1,018
Threads: 60
Joined: Mar 2008
Works fine for: me, Nave, 1477. What doesn't work? You can't assemble the dll? If so what error do you get.
Doesn't work in game? Are you sure you are using the correct exe?
Kind of hard to help you, when all you say is "its not working"
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ʟᴇᴇᴘ.
Thanks given by:
Posts: 152
Threads: 5
Joined: Mar 2009
07-22-2009, 12:53 PM
(This post was last modified: 07-22-2009, 12:53 PM by naruto hyuuga .)
i used the newest exe to load the dll when i build it doesn't work
am i suppose to modify the "?"
in hDC dd ? because i didn't and its not working
i.e not making background transparent
Thanks given by:
Posts: 1,018
Threads: 60
Joined: Mar 2008
(07-22-2009, 12:53 PM) naruto hyuuga Wrote: i used the newest exe to load the dll when i build it doesn't work
am i suppose to modify the "?"
in hDC dd ? because i didn't and its not working
i.e not making background transparent
rarara.asm:
Code:
; Based on Masm32 Dll Plugin Example for Damnation by Drakken
; Modified for LF2 by Silva
; Contributions by: genevrier
.386
.Model Flat, StdCall
OPTION CASEMAP :NONE
include \masm32\include\windows.inc
include \masm32\include\gdi32.inc
include \masm32\include\masm32.inc
include \masm32\include\user32.inc
include \masm32\include\kernel32.inc
includelib \masm32\lib\masm32.lib
includelib \masm32\lib\user32.lib
includelib \masm32\lib\kernel32.lib
includelib \masm32\lib\gdi32.lib
include rarara.inc
include generic.inc
.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
.elseif reason == DLL_PROCESS_DETACH
push NULL
call PostQuitMessage
.endif
ret
DllEntryPoint endp
DLLStartup proc
; Here you can put the patches you want to use when the dll loads
; Also you should put all your jump patches here
invoke JmpPatch,00401290h, addr draw_text
ret
DLLStartup endp
End DllEntryPoint
generic.inc:
Code:
.data
hDC dd ?
.code
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 ;Magic Call #1
mov edi, eax
test edi, edi
jl short loc_4012FC
mov eax, [esp+0Ch+arg_4]
mov ecx, [esp+0Ch]
push ebx
push TRANSPARENT ; mode
push ecx ; HDC
mov hDC, ecx
call ds:SetBkMode
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]
push edx
push esi
call eax ; Magic Call 2
mov eax, edi
pop ebx
loc_4012FC: ; CODE XREF: sub_401290+17j
pop edi
pop esi
ret
draw_text endp
I've also attached the compiled dll, which I tested with the new exe, and it works perfectly. If you still can't get it to work, just give up.
Attached Files
rarara.rar (Size: 868 bytes / Downloads: 91)
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ʟᴇᴇᴘ.
Thanks given by:
Posts: 1,122
Threads: 17
Joined: Mar 2008
naruto you're supposed to describe your problem (ie what exactly happens/doesn't work).
03:28 [BluePhoenix] sleep is for weakling.
Thanks given by: