冒险解谜游戏中文网 ChinaAVG

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

作者: shane007    时间: 2023-8-27 13:22
标题: 【Directx9游戏汉化 #9】来世(nextlife) 字幕显示函数
本帖最后由 shane007 于 2023-8-27 13:23 编辑
) k7 w7 \, r3 x3 A/ C& Q
- p7 D6 r& \2 ~0 \' _本游戏采用了CEGUI,该组件能采用directx和opengl。
( a0 U/ [+ t9 X9 W1 a/ e1 D经过我的小方块测试,游戏屏幕显示了小方块,因此确认是directx9的游戏。4 t9 V8 ~$ n3 T2 n
游戏自带一个EngineSetup.exe程序,设置为窗口模式后就能用cheatengine调式。
  f$ D  W1 J6 M) O- S* j(由于游戏窗口较大,我将游戏屏幕和cheatengine分别显示到2个显示器上即可。)
0 ~* X) M: y  Q: m3 N# I7 d' x! }# N

9 Y1 I. N0 A) Y) q3 C' i* Y在游戏中找一个字幕,在以下地方断下。. y- g  B  |( P8 t# q5 d/ y
由于该游戏基本都是显示在屏幕固定位置(上或者下,居中),
0 x, J. y) N# q! j0 B因此暂时认为此处就是游戏的字幕函数,该函数被20处左右地方调用。
& e9 \) F; ~1 ^& I' `$ T* M! P6 g
+ h  K; O  t/ D4 n! ~1 B
  1. NextLife.exe+11C5 - 42                    - inc edx
    : u- j. V) B3 e1 r7 h* r: _' W
  2. 004011C5
复制代码

( r  m: O+ l+ y4 h3 D! z: t& g) a
+ d9 L  G- M1 R该地方的伪代码/ _( H$ P1 D3 [9 j% g
  1. void __thiscall sub_401160(char **this, const char *a2)
    $ |  ^* G  O9 `* [
  2. {
    ; q4 h6 g& u% H5 I% o8 x
  3.   char **v2; // esi# ]) C% U# v7 N7 u: _
  4.   char *v3; // eax
    ! b( @2 w2 m- s! C+ P
  5.   char *v4; // eax; ^" j6 K) Y. b$ _$ U1 U

  6. : G( Z. j9 p7 ]0 k
  7.   v2 = this;" @  U  D3 I% H
  8.   if ( a2 )
    . D7 f% x1 i9 E, R7 _
  9.   {
      ]; v6 ?$ _8 r
  10.     v3 = *this;
    3 o! r) Y  q- }% c
  11.     if ( a2 != *this )0 M# K: L* L* P: W: B& w1 F
  12.     {
    5 k2 j# H! z- D# w7 o5 Q* z
  13.       if ( *a2 )% `* H- |8 r5 w- g* M: h) z
  14.       {
    7 Z& s9 L) E# J
  15.         sub_401030(strlen(a2));
    4 v6 s; n( l: n6 Z! }! ~. g
  16.         strcpy(*v2, a2);3 d6 f( f5 G5 \( m" y
  17.       }
    5 T* I" U' w; ^6 W5 w6 ~
  18.       else8 t) [, k% v- |! D8 z2 }
  19.       {
    / }# W, S5 B* m
  20.         this[1] = (char *)1;
    & O4 V9 |: B1 p. m# @
  21.         if ( v3 )
    # P3 ^( Z( k8 j8 e/ S) }
  22.           operator delete[](v3);" p2 g* X# {5 x2 D( n! u
  23.         v4 = (char *)operator new(6u);
    9 ^* `- R' e5 t0 x; U4 G$ R7 s* w
  24.         *v2 = v4;
    1 `, J( [6 a  K1 `6 b2 J5 C% \, @
  25.         *(_DWORD *)v4 = 0;
    0 l' c8 |9 G0 G& v
  26.       }
    0 e# i  ?3 m  Y# f! r3 i
  27.     }
    # ?% W6 p7 F+ W0 E# m, y
  28.   }
    ; c) Q! c( h+ f  Z6 ?4 r8 M) n' R
  29. }
复制代码
$ G6 {7 W8 P7 I; j+ P7 r8 Y
汇编代码
$ w+ P( r) J2 D
  1. .text:004010F0
    ' Q8 f8 m: L  c  c3 _# q6 L
  2. .text:004010F0 ; =============== S U B R O U T I N E =======================================7 G9 w/ `5 F" Z
  3. .text:004010F0" Q! H' o  |, i" G
  4. .text:004010F04 t2 }9 I, p7 w. M# ?3 E) I
  5. .text:004010F0 sub_4010F0      proc near               ; CODE XREF: _main+139↓p
    5 L$ ?' @+ E4 J% b  R+ k( S" h
  6. .text:004010F0                                         ; sub_403240+97E↓p ...( [0 l1 M8 P' F; N  ]& O1 n
  7. .text:004010F00 T* ~: ^8 o$ k6 ?4 @7 w$ w* t/ l
  8. .text:004010F0 arg_0           = dword ptr  4
    / I3 i% H9 N7 @! I
  9. .text:004010F0' k2 A, p: u1 R! b
  10. .text:004010F0                 mov     eax, [ecx]
    ' `  @) ]4 E2 _+ B; _8 O
  11. .text:004010F2                 test    eax, eax
    * v2 B. }1 m8 E
  12. .text:004010F4                 mov     edx, [esp+arg_0]4 u( ^# j! c: W
  13. .text:004010F8                 jz      short loc_401147- i, a4 k9 O: r" G! R# G9 O% s6 B
  14. .text:004010FA                 test    edx, edx" P. {2 v/ c6 i/ o$ |: ]' V
  15. .text:004010FC                 jz      short loc_4011472 i) O) {/ C2 `/ a7 R4 X$ G& @
  16. .text:004010FE                 mov     cl, [eax]2 S9 A0 L: o& r9 V+ s. _
  17. .text:00401100                 test    cl, cl+ S0 S; l$ B4 |( j1 j
  18. .text:00401102                 jnz     short loc_401116
    , }$ D0 g) i3 C1 _. J
  19. .text:00401104                 cmp     byte ptr [edx], 07 Q* S7 X: G- N) D' ~- v
  20. .text:00401107                 setz    al
    - M. X! t3 _( J' o7 w
  21. .text:0040110A                 xor     edx, edx4 U& _; M0 M  l9 I1 N, |' }
  22. .text:0040110C                 test    al, al. }) E9 |3 q. Z' O3 M# _
  23. .text:0040110E                 setz    dl
    * B/ w' d" F. z( g8 ^
  24. .text:00401111                 mov     al, dl% x1 d. ]/ H- i6 g7 p5 T/ F
  25. .text:00401113                 retn    4
    ! n) j5 t. H! V* B
  26. .text:00401116 ; ---------------------------------------------------------------------------
    # B- m! R  f9 S* Q# W. _: [6 l
  27. .text:00401116
    & u- w. x& L! f0 U; a' ]" s
  28. .text:00401116 loc_401116:                             ; CODE XREF: sub_4010F0+12↑j
    3 N1 O# [( E* ]3 M' {
  29. .text:00401116                 cmp     byte ptr [edx], 0) u& z* ~) j) U+ }5 I' }. i
  30. .text:00401119                 jz      short loc_401147
    / v9 \: D) e  ~; N
  31. .text:0040111B                 jmp     short loc_401120! c: ^1 B; ]/ O) F& {/ y
  32. .text:0040111B ; ---------------------------------------------------------------------------
    4 N  w/ F" g1 M# {
  33. .text:0040111D                 align 10h
    0 A% t+ z. E: L9 i! f6 i
  34. .text:00401120
    % H6 h- k, m0 o
  35. .text:00401120 loc_401120:                             ; CODE XREF: sub_4010F0+2B↑j/ W  b# a+ x, k) o3 c5 ?
  36. .text:00401120                                         ; sub_4010F0+3B↓j6 b3 r' \2 T* e0 d) d  I2 O/ w: `
  37. .text:00401120                 cmp     cl, [edx]5 \. m: V# ~- r2 \. A
  38. .text:00401122                 jnz     short loc_40112D
    3 N% l( f2 G7 U/ F' t- J
  39. .text:00401124                 mov     cl, [eax+1]
    4 p4 W2 I- k' i! K+ j
  40. .text:00401127                 inc     eax  F3 Q' Z7 u5 o, A
  41. .text:00401128                 inc     edx9 |$ I3 w/ @& T/ ~9 S* t
  42. .text:00401129                 test    cl, cl$ X; O- B" s- [( o* m
  43. .text:0040112B                 jnz     short loc_401120
    ! Q8 f4 {3 O5 X' n" r, N
  44. .text:0040112D
    3 u. Y% E/ X: N& o: H: _7 S
  45. .text:0040112D loc_40112D:                             ; CODE XREF: sub_4010F0+32↑j; e; ^$ C# f* P5 B6 ^5 B
  46. .text:0040112D                 movzx   eax, byte ptr [eax]
    8 ]) [4 {; W1 s9 P4 b" ^; D4 G
  47. .text:00401130                 movzx   ecx, byte ptr [edx]/ `. ~. M# x( t) r& [# j: w
  48. .text:00401133                 sub     eax, ecx  Q  f& l( b) ~  R- q
  49. .text:00401135                 neg     eax
    ) ]! _/ l+ W7 r2 ~
  50. .text:00401137                 sbb     al, al
    3 _. A$ ?( d  P6 o" G0 G
  51. .text:00401139                 inc     al/ P: c$ }& J4 U8 a
  52. .text:0040113B                 xor     edx, edx
    0 }2 x6 w$ n+ [- e
  53. .text:0040113D                 test    al, al/ H1 x) q' M7 [# ^( a  }
  54. .text:0040113F                 setz    dl& u  o" r, Q' {& F
  55. .text:00401142                 mov     al, dl
    7 \( z/ i- T: q/ e! i
  56. .text:00401144                 retn    4
    ( [- B, \; O: t5 {
  57. .text:00401147 ; ---------------------------------------------------------------------------. w- ]3 B, Q; V6 l( f, s
  58. .text:00401147
    * l- `$ r" F9 k0 f. d" j) N9 P' Z
  59. .text:00401147 loc_401147:                             ; CODE XREF: sub_4010F0+8↑j) z2 E% H. o& t+ O! N, X
  60. .text:00401147                                         ; sub_4010F0+C↑j ...
    % ^" M5 Y. D- x! v, I
  61. .text:00401147                 xor     al, al* u4 m' J% N' L, j
  62. .text:00401149                 xor     edx, edx
    $ }# \7 K% K; }5 E, [$ Q9 G# {
  63. .text:0040114B                 test    al, al6 G8 H$ S9 Z6 [3 g, p" ~$ l( J6 M
  64. .text:0040114D                 setz    dl
    6 t  T1 ^( N' f6 ~# j
  65. .text:00401150                 mov     al, dl/ p# y% \# w2 {; U9 t3 T
  66. .text:00401152                 retn    4$ j& h  p$ g8 X7 h
  67. .text:00401152 sub_4010F0      endp
    # N8 D$ _7 i5 E
  68. .text:00401152$ v- M6 E; y+ M9 K6 y# |/ y
  69. .text:00401152 ; ---------------------------------------------------------------------------! E* b3 n  }9 @. y+ z( A
  70. .text:00401155                 align 10h9 {5 N: Y% n' @- \7 Q
  71. .text:00401160
    6 D6 R* [; h' @  w6 C, J
  72. .text:00401160 ; =============== S U B R O U T I N E =======================================
    . _0 U3 S1 B& L' G2 h$ Z
  73. .text:004011607 g  a" ^$ T# |* |. g8 N7 w
  74. .text:00401160
    5 @1 a1 @0 u+ P
  75. .text:00401160 sub_401160      proc near               ; CODE XREF: sub_4013D0+15↓p
    * z; Z; z4 @- E1 t
  76. .text:00401160                                         ; sub_4013F0+C↓p ...8 |/ W3 B* H4 s$ o+ }  a0 b$ {1 @
  77. .text:004011606 s* X2 {! R* w
  78. .text:00401160 arg_0           = dword ptr  4
    + I) B& M( J$ W) R+ I6 j
  79. .text:00401160' f. T% G( d2 [, E
  80. .text:00401160                 push    esi
    + W+ E  u4 E0 ?
  81. .text:00401161                 push    edi
    & u' S1 J* j. f, X4 Y: q- Q. |
  82. .text:00401162                 mov     edi, [esp+8+arg_0]3 T. C( O, `  Q1 d. H
  83. .text:00401166                 test    edi, edi
    & Z0 {" \( f: ~+ C
  84. .text:00401168                 mov     esi, ecx' D$ |0 ~6 W2 e  J0 ^0 X
  85. .text:0040116A                 jz      short loc_4011CA$ ^! |- @" }3 K% \5 |' }- i4 E+ k
  86. .text:0040116C                 mov     eax, [esi]# I! p! Y2 t4 o0 H# M" B$ r) H) S5 \
  87. .text:0040116E                 cmp     edi, eax. j/ y/ Z5 g( c' {
  88. .text:00401170                 jz      short loc_4011CA
    1 ?* t8 \* l2 w0 J2 @
  89. .text:00401172                 cmp     byte ptr [edi], 0
    4 ~: D+ ?+ E: b
  90. .text:00401175                 jnz     short loc_4011A2: }9 b  ~% @$ s. s
  91. .text:00401177                 test    eax, eax9 A5 k/ P. F& A1 l$ O1 r
  92. .text:00401179                 mov     dword ptr [esi+4], 10 |7 i5 t4 y- f4 i+ f! T
  93. .text:00401180                 jz      short loc_40118B
    7 C# ^7 w$ Q1 X9 `! x3 t
  94. .text:00401182                 push    eax             ; void *
    % o8 C+ a8 b6 l: t6 v' _) b6 H
  95. .text:00401183                 call    ??_V@YAXPAX@Z   ; operator delete[](void *)
    * Z, L8 x, k- x  u, w
  96. .text:00401188                 add     esp, 43 f% [) [: l7 B) }$ u
  97. .text:0040118B
    1 Z, G: J5 \0 S0 V3 u9 T9 ]6 o
  98. .text:0040118B loc_40118B:                             ; CODE XREF: sub_401160+20↑j
    0 m, S- ^9 D* C, N$ }/ h& [! f5 c+ c+ _- ?
  99. .text:0040118B                 push    6               ; Size
    % m+ w$ A( x4 {6 v  Q/ Q3 \. I
  100. .text:0040118D                 call    j_??2@YAPAXI@Z  ; operator new(uint)
    8 Q. ?) ^, n9 N7 p% L
  101. .text:00401192                 add     esp, 4
    # \- N9 B3 E& n" ^0 a
  102. .text:00401195                 mov     [esi], eax: G2 Q# Z* X/ C
  103. .text:00401197                 pop     edi8 H% B0 z! E$ o( D* T$ h
  104. .text:00401198                 mov     dword ptr [eax], 0
    6 V$ @, `: w9 m& P" f4 c& s# b
  105. .text:0040119E                 pop     esi
    - a) l* o7 r- _- |6 O
  106. .text:0040119F                 retn    4
    " T% D9 W" l) R$ c4 M- X/ [
  107. .text:004011A2 ; ---------------------------------------------------------------------------2 U1 N( u/ e; b% T7 t! B
  108. .text:004011A25 _1 s' W% ?) Z/ w, f
  109. .text:004011A2 loc_4011A2:                             ; CODE XREF: sub_401160+15↑j, X0 m( k8 G: }5 q$ \# N9 M
  110. .text:004011A2                 mov     eax, edi
    ) x9 Q( ^  a* T/ l( @$ K
  111. .text:004011A4                 lea     edx, [eax+1]  Q$ Y5 D7 x' b9 c: M$ y
  112. .text:004011A7
    5 z+ F: t: H+ Q/ m* a% h
  113. .text:004011A7 loc_4011A7:                             ; CODE XREF: sub_401160+4C↓j4 I4 b2 L1 e* D, q
  114. .text:004011A7                 mov     cl, [eax]
    : w. [6 W% Z( P7 {1 P) g
  115. .text:004011A9                 inc     eax
    9 j3 `& S, d* S% `% I" H
  116. .text:004011AA                 test    cl, cl
    . m) A0 A6 z% y% F! P9 _' W7 s
  117. .text:004011AC                 jnz     short loc_4011A7# \  \# u$ |* \  f; V
  118. .text:004011AE                 sub     eax, edx
    * F: e+ o4 A7 ?+ f
  119. .text:004011B0                 push    eax
    7 L4 n) P) f6 U& e9 H7 b
  120. .text:004011B1                 mov     ecx, esi7 O, y* `3 v  J" {$ {- ~$ {
  121. .text:004011B3                 call    sub_401030  a7 U/ ^4 [1 C, _% h6 p
  122. .text:004011B8                 mov     edx, [esi]
    ) q. t% g. q, _8 \( X
  123. .text:004011BA                 mov     ecx, edi
    4 w0 o3 p, B/ R4 T! S( P1 h
  124. .text:004011BC                 lea     esp, [esp+0]
    1 D! m* \$ K0 Y/ U9 o% K( @
  125. .text:004011C0+ s# `) P/ p: a
  126. .text:004011C0 loc_4011C0:                             ; CODE XREF: sub_401160+68↓j
    $ I" I; r9 X  g5 @! f% c; l2 D
  127. .text:004011C0                 mov     al, [ecx]
    ! s7 o5 O1 M% J$ W! w3 A
  128. .text:004011C2                 inc     ecx5 }! F% Y6 x' {
  129. .text:004011C3                 mov     [edx], al
    : G+ F( }7 S8 {; F& V. v) Z
  130. .text:004011C5                 inc     edx
    1 U% C5 A3 l1 @* T: u, A
  131. .text:004011C6                 test    al, al  o8 n+ m- M+ ?) _) T  C7 b
  132. .text:004011C8                 jnz     short loc_4011C06 I, K; x) n( s  e# [
  133. .text:004011CA
    9 l" J" x! I* }% ?9 B8 i
  134. .text:004011CA loc_4011CA:                             ; CODE XREF: sub_401160+A↑j
    , l& U( s7 p7 _% V
  135. .text:004011CA                                         ; sub_401160+10↑j
    ; o: C2 o, p  ]
  136. .text:004011CA                 pop     edi6 m# Q% p  B. A0 M, |; h# \- W
  137. .text:004011CB                 pop     esi
    + k, x1 n8 m" A9 v& F( _" D3 n
  138. .text:004011CC                 retn    4
    + n9 [, h6 [, {+ u- Z
  139. .text:004011CC sub_401160      endp
    $ l5 H/ H' U& X
  140. .text:004011CC
    6 c  B6 }( s, D9 J  q4 F  O
  141. .text:004011CC ; ---------------------------------------------------------------------------
复制代码

9 @* v" m) m9 w  X8 {* ]5 i
: O% q$ h' e5 V0 L, m: `6 u/ [" h, f* @# k





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