本帖最后由 shane007 于 2023-9-4 18:48 编辑 ) |: Q3 |( p+ j% J" g
! f+ Q, `: h4 J
这是个opengl引擎的游戏,对opengl的初始化是在scream.exe里边完成的。
/ L4 v$ S. S3 I$ }. l, V0 r对于opengl的游戏我们主要关注glGenLists和glCallList这2个函数
/ h7 A3 ~) c3 s) p& c" X) N' Z. _( j$ N5 y2 l
6 ?3 ?$ X1 g- a! I& D3 M# {7 N
glGenLists的调用有4处,前3处参数为1,应该不是。/ _6 S8 u8 v. `% L! {
一下是第四处代码,这里应该就是生成字体的地方。
( V a1 @' J5 z" g+ L6 ~5 J从代码里可以看出,字体材质长宽各是16各字符,共256个字符,此处要修改。( K: c4 K7 K- d2 C- v3 U! F
- int sub_40BEB0()
5 S# \" F9 I. a+ d2 { R5 D! _9 ^ - {% a. S7 K$ g( J7 j7 h ]" P
- signed int v0; // ebx- P) ?1 c$ p [9 V
- int v1; // ecx
' ^+ s- Z7 G& W" S3 s% e/ c9 n5 N - float v2; // ST18_44 u& {3 [1 w! u5 Z
- float v3; // ST1C_4/ I/ L" \- a9 |* }! D4 K( u! P
- float v4; // ST20_48 d/ I5 W. U9 i3 m$ g. s- d' g) e1 ]2 E
- float v5; // ST24_41 v- j; B6 w3 \) p; c
- int result; // eax
4 @, e, R" L1 V+ _& Z1 J - 9 E W# E( u- |$ s: I% w
- v0 = 0;9 _* `; |% X& s9 P
- dword_4DF5130 = glGenLists(272);1 U0 |: { o% T/ ]8 n
- do
; N5 c* `% i6 D8 h" { - {
3 w( H8 M+ @3 z2 T5 l - v2 = (double)(v0 % -16) * flt_483450;
2 ?# f! z0 y: O% Q8 z* h6 A1 b - v3 = (double)(v0 / 16) * flt_483450;
9 Q4 n# }, h! \ - glNewList(v1, v0 % 16, v0 + dword_4DF5130, 4864);- O* Q# g! n! l$ W7 S
- glBegin(7);
1 t# A# a0 J+ X" n - glTexCoord2f(LODWORD(v2), LODWORD(v3)); z5 d; J% m2 b, d, F; e
- glVertex2i(0, 0);3 _/ ~2 X, T a' `% ]/ G- m1 ~
- v4 = v2 + flt_483450;
8 r6 _8 i# n" | - glTexCoord2f(LODWORD(v4), LODWORD(v3));
+ p9 l! h ^- S9 E - glVertex2i(16, 0);
, N& t1 _" R0 X5 P1 t - v5 = v3 + flt_483454;
6 M ]$ M! `- X" H# k0 J9 M - glTexCoord2f(LODWORD(v4), LODWORD(v5));' R8 X7 o5 U' Z0 d3 M* L9 j
- glVertex2i(16, 16);
7 {. H( m+ J9 v' q* U" L - glTexCoord2f(LODWORD(v2), LODWORD(v5));, O! @0 I% U6 t
- glVertex2i(0, 16); r+ u) x, o# h4 H
- glEnd();
& z% v8 S7 o2 j; O+ E - ++v0;3 s# Y) Q, }: z2 q. r
- glTranslated(0, 1076101120, 0, 0, 0, 0);; g! g( a" D' s& B
- result = glEndList();
8 {, p7 y) n5 R - }' N2 r; C8 |2 _7 Y
- while ( v0 < 272 );
0 ?7 N% ]5 g9 [5 k& u9 W - return result;
" N, Z0 o2 u7 n0 P0 i2 X6 @- ~5 _ - }
复制代码
9 Z* A& [9 N% S; U3 K/ z9 W7 h, N
对glCallList的调用只有以下一处,4 T1 z6 q1 `3 f; q
这是显示单个字符还是字符串的方法,待以后再确认。
! m0 e# \+ `: B1 ^7 v+ u( o. R# u glCallLists(strlen(&v7), 5121, &v7);
6 d8 s; T7 c; S2 L* O5121为0x1401 ,即 GL_UNSIGNED_BYTE ,是单字节。2 p. _, A* C( s6 [
6 a r/ `- m" H" u0 L% {- W
- #define GL_BYTE 0x1400, @% M/ d1 b6 ?2 X
- #define GL_UNSIGNED_BYTE 0x14019 O2 O' j1 b0 B5 b2 R& U
- #define GL_SHORT 0x1402
; g) v' I% l$ F% @) X - #define GL_UNSIGNED_SHORT 0x1403
% u3 E& v e0 C8 _8 I, {3 i5 N - #define GL_INT 0x1404" B Z% R1 O/ |. v
- #define GL_UNSIGNED_INT 0x1405( f8 f2 g# u' [$ D q; y+ q4 X
- #define GL_FLOAT 0x1406( f% M( p4 s" ?. I* [) o
- #define GL_2_BYTES 0x1407
& L8 P3 Q# b2 Z& O+ ~ - #define GL_3_BYTES 0x14083 O2 A0 z! z1 }- i+ y, g$ r
- #define GL_4_BYTES 0x1409
! ^% ^6 C- G' B+ W0 Q - #define GL_DOUBLE 0x140A
复制代码 : S' N: n0 U1 w9 }
+ i Y/ s$ Z: M+ c0 |# A- 5 O' C; Z) g0 `
- int __cdecl sub_40BFD0(signed int a1, int a2, int a3, int a4, char a5)
. K# x7 v" x. H7 _0 M' F7 w - { `7 `+ Z6 Z0 r' Z6 I8 ]2 A
- int v5; // ecx3 ?) Z; t' S% G4 N
- int result; // eax
3 f' C; q" P* a - char v7; // [esp+18h] [ebp-118h]
- ^. Z$ b( P0 Q2 E5 M- S - char *v8; // [esp+118h] [ebp-18h]
}9 U( y7 y$ o# c - int v9; // [esp+11Ch] [ebp-14h]( F* U) X: {9 I* J/ f; H
- int v10; // [esp+128h] [ebp-8h]8 \3 a. b. K0 c/ ~" g# j. y
- ( j& u7 `) H5 Z$ T9 U+ Q* b
- v10 = v5;: u i1 x8 [$ F
- if ( a4 )
% O+ K) N( L% ~# n1 H1 ~ - {
; U( ^0 m% D7 u; g; X6 G! m - v8 = &a5;
$ x" P# c" }8 N+ }9 w6 h - sub_41BA00(v5, a4);
# }5 ?( X; m( B/ B7 k - v8 = 0;) A% i# i' e7 H+ G: i* b3 K
- glBlendFunc(770, 771);# E; o0 j- w* K
- glBindTexture(3553, dword_4DF3BC4[8 * a3]);+ y% }0 x Y2 F7 ?! r2 M/ c
- glPushMatrix();% w: {! F! [: m9 I }# S1 C
- glLoadIdentity();0 v) B% M; i5 L' Q9 ^
- v9 = a1;
' V5 Q+ V/ }& z2 D - glTranslated(7 x5 y. r+ n$ k/ j' y; y
- COERCE_UNSIGNED_INT64((double)a1),
0 s: Y4 Z: k' {" D4 J1 C6 J/ s - COERCE_UNSIGNED_INT64((double)a1) >> 32,! P9 y3 R, d/ Y. [" I7 G" U
- COERCE_UNSIGNED_INT64((double)(dword_4DF8B68 - a2)),8 u7 w; r: d7 _
- COERCE_UNSIGNED_INT64((double)(dword_4DF8B68 - a2)) >> 32,: `' g2 N! A: J4 \: L& U# W
- 0,
% h, A0 Z" V; x - 0);& p1 N" D8 b6 G: d0 ~: U, Y
- glPushAttrib(0x20000);: g# n8 T1 J& i: g8 G9 D& _- X
- glListBase(dword_4DF5130 + 16);
9 \6 g$ a0 Y9 w" w" O& X - glCallLists(strlen(&v7), 5121, &v7);5 M' g. X P) O' V+ T; ^
- glPopAttrib();7 ~9 T7 [: i6 X* E, `
- result = glPopMatrix();
8 e+ g8 C/ s7 V - }4 W2 O3 D" E% v' h
- return result;( g( A" h7 z- u( x9 v
- }
# {) Y/ g1 @5 X, ^: d9 |6 r6 B
复制代码 4 v* B" z1 M7 a+ V
! y' Y& D% Y) d& x) R
8 @: c7 d: u$ Y9 I |