冒险解谜游戏中文网 ChinaAVG

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

作者: shane007    时间: 2023-8-27 13:22
标题: 【Directx9游戏汉化 #9】来世(nextlife) 字幕显示函数
本帖最后由 shane007 于 2023-8-27 13:23 编辑 $ _! ^7 O! g2 ~7 l3 g# y% m

3 O. x# {; f! v$ _9 v本游戏采用了CEGUI,该组件能采用directx和opengl。
; O# D1 W4 g! Y! ^经过我的小方块测试,游戏屏幕显示了小方块,因此确认是directx9的游戏。
' q, ^. l' A7 Y0 Y游戏自带一个EngineSetup.exe程序,设置为窗口模式后就能用cheatengine调式。7 a( J+ x7 C: K, \
(由于游戏窗口较大,我将游戏屏幕和cheatengine分别显示到2个显示器上即可。)
" H( b2 H4 D3 a, i4 H+ n7 [2 u1 _) \6 h' }
9 ?$ g+ l- f8 y  k+ w
在游戏中找一个字幕,在以下地方断下。
5 P! D% U) G0 Y3 `由于该游戏基本都是显示在屏幕固定位置(上或者下,居中),
* J- x+ }/ M6 R# f# h. Y3 c因此暂时认为此处就是游戏的字幕函数,该函数被20处左右地方调用。
! b+ j) I0 Z2 C* o2 y- T- h& }( c
  1. NextLife.exe+11C5 - 42                    - inc edx
    & R; k9 m1 \; ]! w5 b: `  Q
  2. 004011C5
复制代码
! p- @, y& |. c5 b/ O
4 Z( u; D' D3 H, |. p
该地方的伪代码
9 U5 U  q4 g  |! m  l( B+ K7 v6 L
  1. void __thiscall sub_401160(char **this, const char *a2)* h" t8 x$ G* W* ?. G
  2. {
    # q4 f/ k3 D! ?: O2 \' _1 @
  3.   char **v2; // esi
    " Z: g1 U( R" C4 y- d3 e0 x* ^' i) j
  4.   char *v3; // eax2 y/ W+ V3 K7 O- Q. @- C
  5.   char *v4; // eax
    6 [  o/ ?  y* I

  6. 7 b, M6 L4 W7 y! y5 q& o+ Q
  7.   v2 = this;0 D: V7 h, e% y' Q
  8.   if ( a2 )' r' j$ H' U" m6 y5 R" |3 _4 O
  9.   {
    ! T: A$ ], \7 f) }2 o! X2 D
  10.     v3 = *this;
    4 c$ c+ m+ D# o3 \4 q/ G9 Q' @9 g2 [
  11.     if ( a2 != *this )7 r" l" m, G" @0 j. k, i
  12.     {: @; }7 A& r+ F3 O8 y8 M3 c
  13.       if ( *a2 )
    # F2 t1 P! d+ y% X- c- O
  14.       {  l+ C# B6 @" |
  15.         sub_401030(strlen(a2));
    6 t4 t- C. u7 s+ _( u9 t! }
  16.         strcpy(*v2, a2);
    ! Q' U7 {1 k  R
  17.       }6 @: k0 D5 f% T
  18.       else
    $ l$ E  Y* R5 R! j7 d4 q8 V
  19.       {6 c+ m6 O* N4 v3 Y
  20.         this[1] = (char *)1;7 x$ N5 P0 r+ R( \# Q8 k
  21.         if ( v3 )
    , U+ G( P/ h' q; x
  22.           operator delete[](v3);" O4 m0 M4 P- Y& C2 c. [- B
  23.         v4 = (char *)operator new(6u);; F5 j' D$ I" B* N8 F
  24.         *v2 = v4;
    + c1 A2 s" t  U& s% N
  25.         *(_DWORD *)v4 = 0;
    ! A3 C& A- l0 W( b5 u
  26.       }  ~. e+ {0 B( S1 q2 e
  27.     }5 [; P$ Z7 @0 e% m4 u
  28.   }* d- H2 }' y7 y; e. K2 B4 I
  29. }
复制代码
% r! S* v. I& m- q$ n! B
汇编代码
% u% {. x' ?; O; H
  1. .text:004010F0
    # A  S) [/ c4 Y; S) ]
  2. .text:004010F0 ; =============== S U B R O U T I N E =======================================
    ! k8 e0 `/ F, ]* T0 U# R3 O& }
  3. .text:004010F0* Q) o5 |+ s8 j' z8 q  W6 e& I
  4. .text:004010F0
    * s% e! {" g0 I5 v" \
  5. .text:004010F0 sub_4010F0      proc near               ; CODE XREF: _main+139↓p# ^  G* K3 d: o
  6. .text:004010F0                                         ; sub_403240+97E↓p ...
    5 Z( _# ~8 Z  x$ S
  7. .text:004010F00 a# T6 ~) ]% |7 n8 V0 e/ y# ?
  8. .text:004010F0 arg_0           = dword ptr  4
    2 h" A) M& `& `5 k+ e0 P
  9. .text:004010F0
    ! ~# T% E) j8 q, X
  10. .text:004010F0                 mov     eax, [ecx]
    , F( I6 B2 h; P8 `( U6 n( r
  11. .text:004010F2                 test    eax, eax
    2 q# e: C+ N: p+ E
  12. .text:004010F4                 mov     edx, [esp+arg_0], Q$ \& m% G$ [1 g9 m& w: x* _
  13. .text:004010F8                 jz      short loc_401147
    ) ^2 m3 w2 @" Y6 W7 {7 X
  14. .text:004010FA                 test    edx, edx+ ^/ c! f* W8 ]) P
  15. .text:004010FC                 jz      short loc_401147
    4 ]4 ^) Z& ^/ z
  16. .text:004010FE                 mov     cl, [eax]
    9 v  h4 q( d3 f8 v; s9 P% [" [
  17. .text:00401100                 test    cl, cl
    , K/ y! e$ \5 M8 q, {* e8 a
  18. .text:00401102                 jnz     short loc_401116
    5 ^  n, t) u: i# m# D) y9 n  y5 {
  19. .text:00401104                 cmp     byte ptr [edx], 02 N- z. D! J, v, x
  20. .text:00401107                 setz    al7 y& C2 L! [8 Z) \* n9 L
  21. .text:0040110A                 xor     edx, edx
    8 e" d! J& D) Y7 n5 s
  22. .text:0040110C                 test    al, al; a/ u, l+ B+ b  ~  [! S" G
  23. .text:0040110E                 setz    dl
    : C# F/ ~9 K; ~& I) q
  24. .text:00401111                 mov     al, dl
    1 {4 z  u6 T+ L4 R
  25. .text:00401113                 retn    46 t, J* I7 n4 V' \+ S% P
  26. .text:00401116 ; ---------------------------------------------------------------------------* |5 C' O: ?- b3 e& t0 ]
  27. .text:00401116! H' \% t3 h. A; V( _8 ~/ f: f
  28. .text:00401116 loc_401116:                             ; CODE XREF: sub_4010F0+12↑j
    + g  ^1 }: k# A) f- p# M
  29. .text:00401116                 cmp     byte ptr [edx], 0# Q" j) R8 o6 G) y% K; q, ?! U
  30. .text:00401119                 jz      short loc_401147
    & w1 w# Y: ^- J: B( ^# u2 f5 Y
  31. .text:0040111B                 jmp     short loc_4011206 A- e0 v3 H6 E5 X* N0 |, W
  32. .text:0040111B ; ---------------------------------------------------------------------------, r& `+ E/ m! M
  33. .text:0040111D                 align 10h3 h+ F7 H5 U# v' L* Q
  34. .text:00401120
    # r9 f! }8 ]$ h5 Q- z
  35. .text:00401120 loc_401120:                             ; CODE XREF: sub_4010F0+2B↑j( ^1 `& X* [% F! \
  36. .text:00401120                                         ; sub_4010F0+3B↓j
    2 O$ n3 O  J  d/ ^
  37. .text:00401120                 cmp     cl, [edx]
    + g/ \& y3 j, }  ]+ e+ L
  38. .text:00401122                 jnz     short loc_40112D5 c$ x' V+ T6 h+ K
  39. .text:00401124                 mov     cl, [eax+1]) ?5 }( t, A/ }6 f( n& _0 G
  40. .text:00401127                 inc     eax
    & A/ r* @4 _1 T2 I+ E$ Y
  41. .text:00401128                 inc     edx/ w) ]! I$ q5 S5 y
  42. .text:00401129                 test    cl, cl
    7 A8 a( r6 E) P1 S/ N- ?( |1 `/ A
  43. .text:0040112B                 jnz     short loc_401120
    . p. R2 I$ C, r
  44. .text:0040112D
    8 H& I  [9 [5 t/ m3 |# m8 [9 \
  45. .text:0040112D loc_40112D:                             ; CODE XREF: sub_4010F0+32↑j4 V9 N* l1 U$ s# `
  46. .text:0040112D                 movzx   eax, byte ptr [eax]
    1 Z# m- ^- N: P9 T
  47. .text:00401130                 movzx   ecx, byte ptr [edx]8 s1 S4 \9 {. y) C" t& h
  48. .text:00401133                 sub     eax, ecx
    : ]; r: J/ \. j. J
  49. .text:00401135                 neg     eax
    $ |3 Q: O4 V/ u- u  }6 C/ E
  50. .text:00401137                 sbb     al, al
    , Y" }4 S2 P' _- P
  51. .text:00401139                 inc     al
    # O2 {" ^! {6 O4 [" R* k, f" g7 ]
  52. .text:0040113B                 xor     edx, edx
    ) g2 \6 `! [* }: X: p6 i8 V
  53. .text:0040113D                 test    al, al
    $ j; F% s/ `/ z! f5 |7 s
  54. .text:0040113F                 setz    dl
    ! h  n; G+ F" O; M$ w8 E
  55. .text:00401142                 mov     al, dl
    7 _6 k  P9 J9 }. X/ r! N' n4 C/ v8 b* D
  56. .text:00401144                 retn    4
    8 A9 J+ o( b: i
  57. .text:00401147 ; ---------------------------------------------------------------------------, Q! D' A8 q% }6 |/ G7 H
  58. .text:00401147
    8 n5 \& Z3 [& q; x+ T
  59. .text:00401147 loc_401147:                             ; CODE XREF: sub_4010F0+8↑j
    * @" S% L& i, S; X! E' @" d
  60. .text:00401147                                         ; sub_4010F0+C↑j ...
    " S4 p' S! D% z; U7 S2 T
  61. .text:00401147                 xor     al, al
    / j) Y: N* X/ e. k. y9 L# E
  62. .text:00401149                 xor     edx, edx
    9 H  L* [8 B% M5 \  I$ G0 R& m- W
  63. .text:0040114B                 test    al, al
    + d, {* F7 Q1 u5 x
  64. .text:0040114D                 setz    dl
    + c6 C* o0 T9 r" y6 a
  65. .text:00401150                 mov     al, dl
    / o1 `- F( E2 v3 D+ t
  66. .text:00401152                 retn    4
    + f0 _; b, s: R0 R& I* \, @
  67. .text:00401152 sub_4010F0      endp
    ! e: F2 K) n8 y4 {% b. s+ i
  68. .text:00401152
    8 \4 ~; D# _' t0 H
  69. .text:00401152 ; ---------------------------------------------------------------------------
    ( l# G' e3 Z- ~" a( l
  70. .text:00401155                 align 10h
    . \- V* h1 H/ O. R
  71. .text:00401160
    * m+ V8 m# h' W3 n* |
  72. .text:00401160 ; =============== S U B R O U T I N E =======================================
      d# L( C' y, T- x
  73. .text:004011606 I0 i' L# |9 w/ r5 C
  74. .text:00401160
    , z$ e! N( \8 U# n
  75. .text:00401160 sub_401160      proc near               ; CODE XREF: sub_4013D0+15↓p
    % }6 d8 @2 k% a/ t  W
  76. .text:00401160                                         ; sub_4013F0+C↓p ...
    : q! @" M- h% b  N" {. L5 F; P
  77. .text:00401160% ?6 q+ h8 V+ b
  78. .text:00401160 arg_0           = dword ptr  4
    # L! s. \# ~' Q; l, X5 @) g) Y7 X
  79. .text:00401160
    1 M6 n6 r8 G! n
  80. .text:00401160                 push    esi# {3 S+ Q5 L/ \
  81. .text:00401161                 push    edi
    1 T5 G3 X2 N, A; c( m
  82. .text:00401162                 mov     edi, [esp+8+arg_0]7 ]1 _. j: r# U, ^" V/ H$ N
  83. .text:00401166                 test    edi, edi  `$ r7 a: U/ }0 o. c! k: V
  84. .text:00401168                 mov     esi, ecx+ ]8 o# S+ t/ {( N! q. T
  85. .text:0040116A                 jz      short loc_4011CA
      `! Q" L0 l4 D3 i
  86. .text:0040116C                 mov     eax, [esi]
    5 i4 U+ }( F* V& V' E/ e
  87. .text:0040116E                 cmp     edi, eax
    + S$ d# X8 \9 Z) {
  88. .text:00401170                 jz      short loc_4011CA
    # J" J( E: H& e7 [+ X" b
  89. .text:00401172                 cmp     byte ptr [edi], 0
    " Y/ ]  b2 C* O, J: ~8 j. A8 |' ?- g
  90. .text:00401175                 jnz     short loc_4011A2; X" b+ V# B0 r) A0 ]+ `6 ?
  91. .text:00401177                 test    eax, eax
    & ~9 ^5 _+ }; m" g
  92. .text:00401179                 mov     dword ptr [esi+4], 1- K( _7 V5 u3 l& @
  93. .text:00401180                 jz      short loc_40118B) I! b, E1 ^4 ~& u$ M7 s
  94. .text:00401182                 push    eax             ; void *0 ~( K0 p# q# A  p$ T1 y
  95. .text:00401183                 call    ??_V@YAXPAX@Z   ; operator delete[](void *)
    , n% r9 B# ~+ |- F, A$ m
  96. .text:00401188                 add     esp, 4
    8 y6 `" [1 f$ |
  97. .text:0040118B
    * [% e* X* ]7 q" V' x
  98. .text:0040118B loc_40118B:                             ; CODE XREF: sub_401160+20↑j$ m3 j& b' `" h  v$ n4 ~, F0 d
  99. .text:0040118B                 push    6               ; Size9 R" r# x/ B9 s
  100. .text:0040118D                 call    j_??2@YAPAXI@Z  ; operator new(uint)7 m9 n# P. A1 k2 S- k
  101. .text:00401192                 add     esp, 4
    9 @/ |* @, h$ P  t$ V
  102. .text:00401195                 mov     [esi], eax
    7 Q; \+ O0 S7 _) E/ @
  103. .text:00401197                 pop     edi6 J0 N, D4 t) J0 N
  104. .text:00401198                 mov     dword ptr [eax], 0
    " g& h. C8 {1 Y
  105. .text:0040119E                 pop     esi4 F$ Q8 _- O) V/ l; ^3 [
  106. .text:0040119F                 retn    4
    ' j6 h6 a$ V; I, T( M! ]0 F. k; e
  107. .text:004011A2 ; ---------------------------------------------------------------------------6 i; t* p* Y, C
  108. .text:004011A2
    + N" Z" F+ @9 n; ]. P* T$ D
  109. .text:004011A2 loc_4011A2:                             ; CODE XREF: sub_401160+15↑j- l2 X. A0 |6 \! U! U
  110. .text:004011A2                 mov     eax, edi' m6 B( a7 M( l0 ^
  111. .text:004011A4                 lea     edx, [eax+1]* m( h+ J# C' W! g) r$ o
  112. .text:004011A7
    ) Y$ i1 Y3 M1 _# H
  113. .text:004011A7 loc_4011A7:                             ; CODE XREF: sub_401160+4C↓j
    6 J) H3 G& |$ w) s0 l1 C$ `  b
  114. .text:004011A7                 mov     cl, [eax]
    7 L7 V7 a: E4 h: t. _, P
  115. .text:004011A9                 inc     eax
      v, e3 g% Q2 b
  116. .text:004011AA                 test    cl, cl
    % J4 i+ d" @" R( q1 @! m
  117. .text:004011AC                 jnz     short loc_4011A78 r3 ?2 P' E; Y- g  O
  118. .text:004011AE                 sub     eax, edx  S% U2 L; n7 [8 u
  119. .text:004011B0                 push    eax) Y" W" ^+ n+ q. |7 n# P* ?8 @4 ^
  120. .text:004011B1                 mov     ecx, esi' e% w+ ]9 K! M
  121. .text:004011B3                 call    sub_401030: E+ _9 _$ A% V
  122. .text:004011B8                 mov     edx, [esi]# c# D' z' [% ]7 N& J
  123. .text:004011BA                 mov     ecx, edi; l, X, [- d7 u( K2 H
  124. .text:004011BC                 lea     esp, [esp+0]
    7 G: x. v- |' k, W6 F% i4 V
  125. .text:004011C0
    % C4 S3 Q. z0 E8 l+ \- v
  126. .text:004011C0 loc_4011C0:                             ; CODE XREF: sub_401160+68↓j; \. V' s3 z5 _1 V% n: L, M. k
  127. .text:004011C0                 mov     al, [ecx]
    : K# v, d) L4 y
  128. .text:004011C2                 inc     ecx" d6 a, c5 w: d' A7 z* Z
  129. .text:004011C3                 mov     [edx], al: W, E0 m6 z2 U
  130. .text:004011C5                 inc     edx
    3 v) y# K/ \3 W+ D
  131. .text:004011C6                 test    al, al3 n* Z2 P' J" z
  132. .text:004011C8                 jnz     short loc_4011C0
    ; G8 b/ ^1 U+ y, j7 x, T) ^
  133. .text:004011CA2 x0 O- l& Z) }0 w# s, `  e* `7 d2 V
  134. .text:004011CA loc_4011CA:                             ; CODE XREF: sub_401160+A↑j
    & H) F3 M+ P* _7 |  b% W
  135. .text:004011CA                                         ; sub_401160+10↑j' t5 O9 Y! V, ^2 T6 B8 o3 Y3 w
  136. .text:004011CA                 pop     edi
    9 k4 i) @8 H8 J  d! Q- B
  137. .text:004011CB                 pop     esi% J' B1 B' J: _" _9 X# N6 y9 c
  138. .text:004011CC                 retn    4
    " x: Y& X2 c/ n0 o
  139. .text:004011CC sub_401160      endp
    $ K. ~* o, A0 w: O5 c2 s3 h
  140. .text:004011CC  r9 b/ `7 _9 J+ s) L* F' t
  141. .text:004011CC ; ---------------------------------------------------------------------------
复制代码
8 B' ^8 H( k( J. d0 U; S; p

0 m" |) Z- I5 S* P, I  y" d
' G$ ~: t4 A0 ?. r, C  j




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