冒险解谜游戏中文网 ChinaAVG

标题: 【Directx9游戏汉化 #9】来世(nextlife) 字幕显示函数 [打印本页]

作者: shane007    时间: 2023-8-27 13:22
标题: 【Directx9游戏汉化 #9】来世(nextlife) 字幕显示函数
本帖最后由 shane007 于 2023-8-27 13:23 编辑 % Q" [1 _: }- o" h  ^( B/ s
& n7 u+ e7 K( \& o
本游戏采用了CEGUI,该组件能采用directx和opengl。7 X  |& Y/ l" U# f$ _
经过我的小方块测试,游戏屏幕显示了小方块,因此确认是directx9的游戏。- Y6 h- a1 I/ y' ]( W# E
游戏自带一个EngineSetup.exe程序,设置为窗口模式后就能用cheatengine调式。
" l; Q* \( q$ d+ w  C( s(由于游戏窗口较大,我将游戏屏幕和cheatengine分别显示到2个显示器上即可。)2 o) A4 v' T) y/ y( ]- w% O/ F) p
* I* s4 c4 D& a4 ]9 e+ L

  G3 L3 O: w: C在游戏中找一个字幕,在以下地方断下。1 J& G5 g8 e5 F. }+ `
由于该游戏基本都是显示在屏幕固定位置(上或者下,居中),
5 u, n0 x# G" H8 ?* w因此暂时认为此处就是游戏的字幕函数,该函数被20处左右地方调用。
5 J8 F8 L1 P# H0 u$ q4 b
% v' N5 _# J0 t: V" C. @
  1. NextLife.exe+11C5 - 42                    - inc edx8 B$ _! v  A& }( g
  2. 004011C5
复制代码

1 |$ Z) |: ^6 K3 W! V5 D- u/ ?# @8 \% D/ J- p& k
该地方的伪代码
& I, H7 T8 V7 w" e- y/ E6 ^# V
  1. void __thiscall sub_401160(char **this, const char *a2), ~% K, f" p7 U, r
  2. {# ]3 j# N  v, c+ a& J
  3.   char **v2; // esi4 P( y% u& x) Z2 J
  4.   char *v3; // eax
    + n; q* a) G, w6 x
  5.   char *v4; // eax# c5 y# q, d9 b% k

  6. ( M  v- U: f% x1 X. {" {$ a7 \
  7.   v2 = this;8 I$ Q) l2 W8 ^+ W% n+ z
  8.   if ( a2 )' \; V2 t1 `3 v; L
  9.   {5 S# E- c' i  o) Q6 T& [8 {' }& U
  10.     v3 = *this;) e2 p: g7 l0 ^- @
  11.     if ( a2 != *this )
    / [: `! R- R/ D& C% y- l& I+ X
  12.     {; X' h! `6 J8 U1 k  ]
  13.       if ( *a2 ): e9 b# y/ E) e$ W0 g/ L: [" j
  14.       {6 u$ M$ E2 g5 x4 ^% E5 M
  15.         sub_401030(strlen(a2));& E! _7 u2 }8 O* S8 N" W
  16.         strcpy(*v2, a2);
    9 N6 h* S7 j# N' L5 q
  17.       }7 G" b% n8 S- V! u% k
  18.       else4 x4 L9 c2 v$ }) I6 i& Y
  19.       {5 h2 n' J/ D# H2 V: C& w) d9 C
  20.         this[1] = (char *)1;
    9 f9 d% l& f" ]* v7 Y! P
  21.         if ( v3 )2 x: ?& C: i0 ~
  22.           operator delete[](v3);+ g$ r: c9 t: c" v
  23.         v4 = (char *)operator new(6u);
    9 B9 B# J& V- p
  24.         *v2 = v4;- q( O- i4 w. i$ g; k: O/ r: V& _
  25.         *(_DWORD *)v4 = 0;
    . f; ^8 A7 P* R6 U
  26.       }
    / l9 N5 |+ ^2 S2 w$ g
  27.     }
    # t" e$ z  \6 ~4 k, |
  28.   }
    ; v% m: q: L* ]" O
  29. }
复制代码

" _% d) _0 J! e& x( u汇编代码$ J1 ?5 }: T" r& ^
  1. .text:004010F0; b- n" Y) N) j' @! s
  2. .text:004010F0 ; =============== S U B R O U T I N E =======================================! M0 S! L) |0 h- n
  3. .text:004010F0/ L! s9 `( ^9 o! D/ X4 K) o) @  n
  4. .text:004010F0
    / V! i; v8 Z. O
  5. .text:004010F0 sub_4010F0      proc near               ; CODE XREF: _main+139↓p: n, N9 N: i( `$ r/ ]" v+ y! X( C
  6. .text:004010F0                                         ; sub_403240+97E↓p ...: m6 B0 a/ e2 o7 T
  7. .text:004010F04 X! C( z( U( @% B- c9 z, W% r
  8. .text:004010F0 arg_0           = dword ptr  4' i6 T1 _% n/ o( ~
  9. .text:004010F0! u, Z) ?4 N8 n  D) N3 h1 J' g
  10. .text:004010F0                 mov     eax, [ecx]+ Y# |3 o: {9 C8 M4 H
  11. .text:004010F2                 test    eax, eax
    2 n, [) N& |1 `  j
  12. .text:004010F4                 mov     edx, [esp+arg_0]
    - w5 n: \* }: f
  13. .text:004010F8                 jz      short loc_4011470 f6 R; g$ I- T7 r- N4 m5 A0 X
  14. .text:004010FA                 test    edx, edx
    + u( F! P, @* F) x/ L2 N
  15. .text:004010FC                 jz      short loc_401147+ ^7 l' l3 H; }/ H
  16. .text:004010FE                 mov     cl, [eax]& Y" v3 A! O( C
  17. .text:00401100                 test    cl, cl7 E& I. y% O: E+ e! O1 j+ }
  18. .text:00401102                 jnz     short loc_401116
    & f# S$ \, i1 b9 ?6 E; e
  19. .text:00401104                 cmp     byte ptr [edx], 09 D8 u- b2 ?. @4 p
  20. .text:00401107                 setz    al8 v/ y  M6 w/ D! g/ x7 i2 `/ z+ `
  21. .text:0040110A                 xor     edx, edx
    " ?1 V6 \8 {6 ~- _% Y, H
  22. .text:0040110C                 test    al, al) v( I! f9 H1 m2 f9 U% ~0 J
  23. .text:0040110E                 setz    dl5 h% x- {. W7 b5 D3 x8 }. \- S
  24. .text:00401111                 mov     al, dl( c. _# M2 W. }% i0 s
  25. .text:00401113                 retn    4
      @% l( Y" B* z+ G8 u# ]4 J
  26. .text:00401116 ; ---------------------------------------------------------------------------3 I! z6 ~" ~4 Y* g( W* }' v: C
  27. .text:00401116
    3 R* A, J$ m6 }5 a; x' q% S
  28. .text:00401116 loc_401116:                             ; CODE XREF: sub_4010F0+12↑j
    3 F' G* K5 D, c' K3 m" j/ P. \
  29. .text:00401116                 cmp     byte ptr [edx], 0
    5 l/ @  E, I4 q7 x  M# C, d) O# }" z8 X
  30. .text:00401119                 jz      short loc_401147, R/ V' J  H% B
  31. .text:0040111B                 jmp     short loc_401120
    ! T" U- C2 _& l6 S* u# X3 Y4 x- X
  32. .text:0040111B ; ---------------------------------------------------------------------------" N3 p! Y3 o/ S% ?7 M! f, t
  33. .text:0040111D                 align 10h$ Q+ Y: v, z! }" t% t
  34. .text:00401120
    2 v7 Q# s1 \2 r2 \' x: E
  35. .text:00401120 loc_401120:                             ; CODE XREF: sub_4010F0+2B↑j! v+ x% g% y3 j8 ^( `; C5 `( h
  36. .text:00401120                                         ; sub_4010F0+3B↓j
    2 r' m1 q" l4 T' p! X3 M! O' o- d
  37. .text:00401120                 cmp     cl, [edx]" g- ]) k* g1 |; i
  38. .text:00401122                 jnz     short loc_40112D
    : b0 b7 `' Z$ K' F) K- `8 d# f
  39. .text:00401124                 mov     cl, [eax+1], {% x" M. A; `$ ?& k
  40. .text:00401127                 inc     eax! ?4 z: b; y0 G. F
  41. .text:00401128                 inc     edx
    + f0 `* w$ Q) Y$ U9 u0 L, V9 A
  42. .text:00401129                 test    cl, cl
    6 H* @/ U4 p: j
  43. .text:0040112B                 jnz     short loc_401120( m/ c. B& C) U+ O
  44. .text:0040112D
    + X% B8 P2 o% _/ g; B% z7 b
  45. .text:0040112D loc_40112D:                             ; CODE XREF: sub_4010F0+32↑j2 s( T4 w' ?- t6 K9 x$ H
  46. .text:0040112D                 movzx   eax, byte ptr [eax]& f7 a2 R! G, q& N* N! |# u
  47. .text:00401130                 movzx   ecx, byte ptr [edx]0 h2 x% ]3 X/ l( h% _
  48. .text:00401133                 sub     eax, ecx: _* w4 B, L, i3 A0 v: C: @
  49. .text:00401135                 neg     eax
    . o- @: k: r$ |3 L" J( [
  50. .text:00401137                 sbb     al, al
    * f' V: c6 t' x7 H
  51. .text:00401139                 inc     al
    7 f+ Q( M1 |# x0 U  D4 |$ D
  52. .text:0040113B                 xor     edx, edx
    # i( o# v  W. E+ ]; [' `% q' D1 F
  53. .text:0040113D                 test    al, al. a  m. c: L8 Q$ S/ W' K3 z: s0 O
  54. .text:0040113F                 setz    dl, k, t' c/ W* {, w2 Q
  55. .text:00401142                 mov     al, dl
    / S6 L' L& M% v
  56. .text:00401144                 retn    4
    2 |* w: E! P/ i" x1 p$ N. W
  57. .text:00401147 ; ---------------------------------------------------------------------------/ q' O6 G0 M& D/ l  W
  58. .text:00401147* }& p- ^. m" r/ C
  59. .text:00401147 loc_401147:                             ; CODE XREF: sub_4010F0+8↑j
    ; e! N; ~8 l8 J! X/ n
  60. .text:00401147                                         ; sub_4010F0+C↑j ...+ c/ Q( l) B9 @( o6 i, O
  61. .text:00401147                 xor     al, al
    / h4 A" y0 ~3 |( B* [& f
  62. .text:00401149                 xor     edx, edx
    ' z" W3 i: c! x3 W% J/ P
  63. .text:0040114B                 test    al, al
    ( i  N+ Q5 P, t. q7 y" K' V
  64. .text:0040114D                 setz    dl5 C1 h, G/ I& `6 O0 z
  65. .text:00401150                 mov     al, dl! E  p0 Z" E6 J" y) j: ~/ \/ @; _
  66. .text:00401152                 retn    4
    ' a* Q) n" s+ u
  67. .text:00401152 sub_4010F0      endp
    ' w& n6 W) Z: m  E# I3 o
  68. .text:004011523 Q9 a$ [( b9 g+ P5 @
  69. .text:00401152 ; ---------------------------------------------------------------------------
    3 I7 Q% L8 r* c- f" i: ~# M
  70. .text:00401155                 align 10h* R+ Q1 @" x8 d5 I' Z/ ~6 P5 l
  71. .text:00401160, D' O* |4 ?; N" r: C
  72. .text:00401160 ; =============== S U B R O U T I N E =======================================
    : u- N0 b, z5 }3 [' d  d! f
  73. .text:00401160
    # U8 l) }& k* J' B/ ^) e" Q
  74. .text:00401160
    3 n9 [' |/ q5 W  T8 ?1 W5 Z
  75. .text:00401160 sub_401160      proc near               ; CODE XREF: sub_4013D0+15↓p
    & w% d2 S1 ]& \
  76. .text:00401160                                         ; sub_4013F0+C↓p ...
    2 ~' S  @) H0 }$ T; r0 o
  77. .text:00401160" p* }( i6 X+ G" g
  78. .text:00401160 arg_0           = dword ptr  4
    2 V1 v7 ~/ n9 K8 q6 L
  79. .text:00401160
    3 Z$ u& |6 s) r. o; s
  80. .text:00401160                 push    esi
    & d7 k1 s) V$ e; h/ @( i3 Q9 ?
  81. .text:00401161                 push    edi& s7 l+ r! |4 V( V
  82. .text:00401162                 mov     edi, [esp+8+arg_0]7 W) t: U% Z. p8 [
  83. .text:00401166                 test    edi, edi
    8 ~( K0 b6 `" F, E' \4 |7 z7 |0 `4 l
  84. .text:00401168                 mov     esi, ecx
    % B# Z/ s. D6 a" p# y) L4 W# D
  85. .text:0040116A                 jz      short loc_4011CA
    * S- J. N* T/ q! [" M8 I9 d
  86. .text:0040116C                 mov     eax, [esi]1 q1 t5 D. K( F; `+ X) n
  87. .text:0040116E                 cmp     edi, eax: p  x) X' E7 T/ e. b/ l
  88. .text:00401170                 jz      short loc_4011CA
    5 s$ J2 M- c3 n6 h: Y6 r9 c
  89. .text:00401172                 cmp     byte ptr [edi], 0" ^! Z% o1 U' V. U) C5 g
  90. .text:00401175                 jnz     short loc_4011A23 @" d7 u  C7 U' Z4 o
  91. .text:00401177                 test    eax, eax. k9 P6 a  E! [3 W3 o* ]; G
  92. .text:00401179                 mov     dword ptr [esi+4], 1
      d$ Z% p' E3 c5 V
  93. .text:00401180                 jz      short loc_40118B
    2 {  v, g7 j6 Z5 ]9 `
  94. .text:00401182                 push    eax             ; void *
    0 G# ]3 j3 _6 N# [  f+ m( Q
  95. .text:00401183                 call    ??_V@YAXPAX@Z   ; operator delete[](void *)
    0 y* z$ B! u3 ^( c' V
  96. .text:00401188                 add     esp, 47 i* X3 p- d' s" x8 j' `3 r
  97. .text:0040118B4 V1 b# T+ {+ z3 \& N+ N, V
  98. .text:0040118B loc_40118B:                             ; CODE XREF: sub_401160+20↑j, b0 Y6 r! k: Q: Q  y9 P
  99. .text:0040118B                 push    6               ; Size( Y% w4 x: p- e* }0 C2 U
  100. .text:0040118D                 call    j_??2@YAPAXI@Z  ; operator new(uint)' b% F3 R8 `6 d2 f, z
  101. .text:00401192                 add     esp, 4
    & c+ ~% o; A; q2 n7 \5 ?
  102. .text:00401195                 mov     [esi], eax
    0 T/ m! X5 Z8 V' @, b8 G, V
  103. .text:00401197                 pop     edi6 |8 j; y0 w6 w7 h
  104. .text:00401198                 mov     dword ptr [eax], 01 V9 p) m; ?, i0 ?9 C  I
  105. .text:0040119E                 pop     esi
    8 ^6 y1 t; v: Z  F; c( r& _9 x
  106. .text:0040119F                 retn    4% o7 @2 |3 P; n  P1 A
  107. .text:004011A2 ; ---------------------------------------------------------------------------* S6 {6 k7 j9 p5 a' d: ]0 o% j" _
  108. .text:004011A25 v# `% N) l4 X; c4 ?
  109. .text:004011A2 loc_4011A2:                             ; CODE XREF: sub_401160+15↑j
    ) p# O: ]6 `6 g
  110. .text:004011A2                 mov     eax, edi
    2 q1 [2 b4 {0 Z+ B
  111. .text:004011A4                 lea     edx, [eax+1]
    & g" M! P# h. n6 K: o
  112. .text:004011A7) b! m; I* q" m9 D+ `) e& ?6 j# F& L
  113. .text:004011A7 loc_4011A7:                             ; CODE XREF: sub_401160+4C↓j, h* n- H4 E# o4 c  ]4 w- b
  114. .text:004011A7                 mov     cl, [eax]9 ^( h  o* |) R3 e2 w: }5 L# ?9 v. ?
  115. .text:004011A9                 inc     eax
    + J6 D: S! q& p, n
  116. .text:004011AA                 test    cl, cl
    1 V$ |, j3 z% |5 W" v0 B. K  H. R
  117. .text:004011AC                 jnz     short loc_4011A7
    0 ~' z: b7 O: f2 G6 Z! X7 w: S- z
  118. .text:004011AE                 sub     eax, edx
    / k$ J1 Z, `- h- G) ^
  119. .text:004011B0                 push    eax4 z: T: \& C# Z3 S! J" d
  120. .text:004011B1                 mov     ecx, esi
    # Q7 z3 Z: E+ S9 ?+ j/ C
  121. .text:004011B3                 call    sub_4010307 B7 }* q. w3 m& R- S
  122. .text:004011B8                 mov     edx, [esi]* ]  n# I) B7 [0 Q4 l! F
  123. .text:004011BA                 mov     ecx, edi+ u6 k2 c; U/ o& k/ P
  124. .text:004011BC                 lea     esp, [esp+0]
    ( J' v' `( Q6 S. Y- m
  125. .text:004011C0( A% O) I0 p7 \$ w8 Q( v# Z( C8 a
  126. .text:004011C0 loc_4011C0:                             ; CODE XREF: sub_401160+68↓j
    7 u$ D2 E" X7 ]9 K( s
  127. .text:004011C0                 mov     al, [ecx]' M, B( R5 a9 q* Z6 Z' }
  128. .text:004011C2                 inc     ecx, {# w/ E: N1 @
  129. .text:004011C3                 mov     [edx], al
    6 B4 W- ?, F8 w4 ~
  130. .text:004011C5                 inc     edx
    + k: o  v. s* A+ M
  131. .text:004011C6                 test    al, al
    " `# [$ l/ R2 w* w
  132. .text:004011C8                 jnz     short loc_4011C0# Z( _0 P% |5 }5 D3 h3 c* o. x
  133. .text:004011CA% @' r" D  C( U: t. f! A
  134. .text:004011CA loc_4011CA:                             ; CODE XREF: sub_401160+A↑j
    : l/ U$ F! k* ^$ {/ J
  135. .text:004011CA                                         ; sub_401160+10↑j
    8 X" J: ^) I* @8 }" {" y( I
  136. .text:004011CA                 pop     edi5 R) E' B# C4 V2 ]1 F$ {  X0 k: n9 }
  137. .text:004011CB                 pop     esi7 w8 \! p- b: ^) X* V
  138. .text:004011CC                 retn    42 R% i9 O+ v! [# g+ ~: P
  139. .text:004011CC sub_401160      endp
    / n# x" J% H6 T
  140. .text:004011CC
    8 Q. B. L. A4 b" H2 ?
  141. .text:004011CC ; ---------------------------------------------------------------------------
复制代码

5 ^6 C' y9 Z- [( k9 w- s' w5 j- I; x2 @/ E! C* g- P  n1 T

9 |4 ^4 P5 G) |( u* k




欢迎光临 冒险解谜游戏中文网 ChinaAVG (https://chinaavg.com/) Powered by Discuz! X3.2