接上,一点点来,先把写屏函数分析完: % M$ v' U8 P$ G' j( _# ^" u( Y
写屏函数: -
- 02A2EA4C |> /8B00 |/mov eax,dword ptr ds:[eax]
- 02A2EA4E |. |0FB70450 ||movzx eax,word ptr ds:[eax+edx*2] ; //取出第edx个字符
- 02A2EA52 |. |8B7C24 14 ||mov edi,dword ptr ss:[esp+14]
- 02A2EA56 |. |8B7F 2C ||mov edi,dword ptr ds:[edi+2C] ; //003E69F0
- 02A2EA59 |. |8D04C0 ||lea eax,dword ptr ds:[eax+eax*8]
- 02A2EA5C |. |8D0487 ||lea eax,dword ptr ds:[edi+eax*4] ; //eax存放的就是字库的地址(实际上是单个字符的坐标)
- 02A2EA5F |. |8B7C24 0C ||mov edi,dword ptr ss:[esp+C] ; //129CE000
- 02A2EA63 |. |8D7C39 14 ||lea edi,dword ptr ds:[ecx+edi+14]
- 02A2EA67 |. |D940 04 ||fld dword ptr ds:[eax+4]
- 02A2EA6A |. |83C2 01 ||add edx,1 ; //多少个需要渲染的字符
- 02A2EA6D |. |D95C24 30 ||fstp dword ptr ss:[esp+30]
- 02A2EA71 |. |D900 ||fld dword ptr ds:[eax]
- 02A2EA73 |. |D91F ||fstp dword ptr ds:[edi]
- 02A2EA75 |. |D94424 30 ||fld dword ptr ss:[esp+30]
- 02A2EA79 |. |D95F 04 ||fstp dword ptr ds:[edi+4]
- 02A2EA7C |. |8B7C24 0C ||mov edi,dword ptr ss:[esp+C]
- 02A2EA80 |. |D940 04 ||fld dword ptr ds:[eax+4]
- 02A2EA83 |. |8D7C39 30 ||lea edi,dword ptr ds:[ecx+edi+30] ; // 14 + X,Y + 14 ==30
- 02A2EA87 |. |D95C24 30 ||fstp dword ptr ss:[esp+30]
- 02A2EA8B |. |D940 08 ||fld dword ptr ds:[eax+8]
- 02A2EA8E |. |D91F ||fstp dword ptr ds:[edi]
- 02A2EA90 |. |D94424 30 ||fld dword ptr ss:[esp+30]
- 02A2EA94 |. |D95F 04 ||fstp dword ptr ds:[edi+4]
- 02A2EA97 |. |8B7C24 0C ||mov edi,dword ptr ss:[esp+C]
- 02A2EA9B |. |D940 0C ||fld dword ptr ds:[eax+C]
- 02A2EA9E |. |8D7C39 4C ||lea edi,dword ptr ds:[ecx+edi+4C]
- 02A2EAA2 |. |D95C24 30 ||fstp dword ptr ss:[esp+30]
- 02A2EAA6 |. |D900 ||fld dword ptr ds:[eax]
- 02A2EAA8 |. |D91F ||fstp dword ptr ds:[edi]
- 02A2EAAA |. |D94424 30 ||fld dword ptr ss:[esp+30]
- 02A2EAAE |. |D95F 04 ||fstp dword ptr ds:[edi+4]
- 02A2EAB1 |. |8B7C24 0C ||mov edi,dword ptr ss:[esp+C]
- 02A2EAB5 |. |D940 0C ||fld dword ptr ds:[eax+C]
- 02A2EAB8 |. |8D7C39 68 ||lea edi,dword ptr ds:[ecx+edi+68]
- 02A2EABC |. |D95C24 30 ||fstp dword ptr ss:[esp+30]
- 02A2EAC0 |. |83C1 70 ||add ecx,70 ; //每70一个顶点结构
- 02A2EAC3 |. |D940 08 ||fld dword ptr ds:[eax+8]
- 02A2EAC6 |. |D91F ||fstp dword ptr ds:[edi]
- 02A2EAC8 |. |D94424 30 ||fld dword ptr ss:[esp+30]
- 02A2EACC |. |D95F 04 ||fstp dword ptr ds:[edi+4]
- 02A2EACF |. |8B46 58 ||mov eax,dword ptr ds:[esi+58]
- 02A2EAD2 |. |03C3 ||add eax,ebx
- 02A2EAD4 |. |3B50 08 ||cmp edx,dword ptr ds:[eax+8]
- 02A2EAD7 |.^\\0F8C 6FFFFFFF |\\jl xcDxShad.02A2EA4C
复制代码
% j# V; g+ ?- B0 ?实际上这里是定义了一个顶点结构,那一串浮点运算就是根据003E69F0处的字符在字库中的坐标信息建来赋值自己定义的顶点结构 + t8 \6 E! Y7 r* F5 |. r
TLVertex vertices[] =
0 J2 }6 A% O/ | {
, r1 S9 m9 r; v( B { 248.6f, 222.2f, 0.5f, 1.0f, 0xffffff00, a, b }, 8 J" Y, w, R4 k: [% w* c/ j6 D
{ 262.6f, 222.2f, 0.5f, 1.0f, 0xffffff00, c, b }, & l' t) K& M$ y
{ 248.6f, 240.2f, 0.5f, 1.0f, 0xffffff00, a, d }, * J* p+ b" Q+ S8 S
{ 262.6f, 240.2f, 0.5f, 1.0f, 0xffffff00, c, d } " z; U& x" Q3 q- ^6 `0 Z6 w
}; //129CE000 指向vertices,0xffffff00表示颜色,这里应该是白色
2 O. P2 h+ P5 `0 ?1 u6 C/ b: ]- s0 N: m
[a,b,c,d] = {0.02929688, 0.5410156, 0.08398438, 0.6113281}; //003E69F0 ) \. S; Z+ w: P& W, {6 s
' K' m2 ^" b3 R/ c: M+ D
PS:“每个字符占1C个字节,最后的四个字节都是一样的,可以认为是结束标志”
0 l0 l1 d) Y8 z, g" f: R其实是每个字符占0x70个字节,每个字符有4个顶点信息,你可以把它想像成那个字符的四个角,0 m/ N3 d: {5 b
每1C个字节就是一个顶点信息,倒数第三个字节表示颜色,他们之间的颜色渐变是由DXD来实现的
& T- J3 }8 [7 e+ u5 U1 M0 G这是一张DDS格式的图片字库 |