设为首页收藏本站官方微博

建议 【Directx9游戏汉化 #9】来世(nextlife) 字幕显示函数

[复制链接]
查看: 384|回复: 0
打印 上一主题 下一主题

[建议] 【Directx9游戏汉化 #9】来世(nextlife) 字幕显示函数

跳转到指定楼层
楼主
发表于 2023-8-27 13:22 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

【Directx9游戏汉化 #9】来世(nextlife) 字幕显示函数

本帖最后由 shane007 于 2023-8-27 13:23 编辑
4 C; C+ o4 Z- G# r6 n. z: l9 c
# h% M5 L9 ?  |本游戏采用了CEGUI,该组件能采用directx和opengl。
$ L$ n0 Y" E+ e2 F& {5 A经过我的小方块测试,游戏屏幕显示了小方块,因此确认是directx9的游戏。
7 s' V3 U& b# F- U游戏自带一个EngineSetup.exe程序,设置为窗口模式后就能用cheatengine调式。! H' m3 x2 v6 K& P7 [( w0 ?
(由于游戏窗口较大,我将游戏屏幕和cheatengine分别显示到2个显示器上即可。)& d; B$ {) A) O; b4 n
' E, c& m" h/ v3 @' X) N

5 r+ a: ^2 a, R4 K1 D, `在游戏中找一个字幕,在以下地方断下。
0 f7 a* w+ S" }1 u7 A6 H. Y/ `! ^$ j由于该游戏基本都是显示在屏幕固定位置(上或者下,居中),
  ^# H" ?$ _3 {; e0 ]因此暂时认为此处就是游戏的字幕函数,该函数被20处左右地方调用。
/ `/ c/ X' @  D
! w- }5 z& E# A/ i% `& t  P
  1. NextLife.exe+11C5 - 42                    - inc edx
    & z6 {" q: V6 ?, P
  2. 004011C5
复制代码
9 B& y8 b- k6 E0 t* I
% |1 F/ m# k! I  ]/ ]+ _
该地方的伪代码
/ x: D' B- N% O1 r. G* T; {1 p
  1. void __thiscall sub_401160(char **this, const char *a2)
    , U. M6 Z$ l: \5 ]
  2. {2 J* J. H, m( ]/ J6 d
  3.   char **v2; // esi: p8 q" e* {9 l' m
  4.   char *v3; // eax
    4 n9 J  V8 A) c" I: Q! Y( u+ c3 n
  5.   char *v4; // eax
    + z/ `. V. y+ l  a& d5 f: j
  6. 8 t, ]' F5 b9 R
  7.   v2 = this;& X4 `, v2 I( B, U' t% W9 `
  8.   if ( a2 )
    , t9 F2 u! j. ?& r2 O: F+ g
  9.   {
    % ]1 Y7 G; E+ M6 S9 G  K+ ], A2 n! E
  10.     v3 = *this;! _& f, X/ _/ M3 h  a
  11.     if ( a2 != *this )" P1 K7 n4 x" r, v4 z
  12.     {7 t; W  z4 T1 w& C) z+ n
  13.       if ( *a2 )
    ( E: S/ l& J/ K6 D3 t7 l+ O  M
  14.       {+ e7 p4 F  S7 I$ Z+ z
  15.         sub_401030(strlen(a2));' f  M) X5 q0 Z+ G+ Z* X- L
  16.         strcpy(*v2, a2);
    - }4 {: ^, ^: [
  17.       }9 c5 o6 y/ D, q3 ^( y( Z
  18.       else
    & R' Y. |" V/ D0 w$ `) f
  19.       {; L) ?% J5 X" u: D4 ~; w/ q
  20.         this[1] = (char *)1;
    - D5 \& N' Z, R! @5 J
  21.         if ( v3 )' z; P% |! c) }2 }* Q% g  W& i" w
  22.           operator delete[](v3);
    $ v3 w: V' U2 i2 C
  23.         v4 = (char *)operator new(6u);
    4 j) [  W0 I* a
  24.         *v2 = v4;
    3 [' _' H% v* z  l% f
  25.         *(_DWORD *)v4 = 0;
    6 X- t3 l( B( Q
  26.       }
    # }' f' L4 r% a* @, `( G( E
  27.     }( L8 A% {; S, N! Y( _, |( k* u
  28.   }
    3 j8 a" O$ A# F3 S) G, T9 ~
  29. }
复制代码

/ `* L$ u* ?) h汇编代码
  ~( z: v" J/ W! k3 w
  1. .text:004010F0
    6 r, J0 N6 L6 U3 v
  2. .text:004010F0 ; =============== S U B R O U T I N E =======================================
    3 [3 L+ u% ]& \, _# x6 r
  3. .text:004010F0; i+ w8 D6 m. W0 z5 m: ~9 z( J
  4. .text:004010F0
    / v) s* [1 c2 w1 x; z( h  ]3 e
  5. .text:004010F0 sub_4010F0      proc near               ; CODE XREF: _main+139↓p; n5 w6 z: a( F5 k) D
  6. .text:004010F0                                         ; sub_403240+97E↓p ...) W3 R/ O: M# m1 e* B
  7. .text:004010F0
    + W  f6 @7 _0 W0 r! H" i1 \4 C
  8. .text:004010F0 arg_0           = dword ptr  4( G$ g5 Z' _0 b# C6 y# u8 W  L! A8 R
  9. .text:004010F04 u: s1 i, L9 d/ U
  10. .text:004010F0                 mov     eax, [ecx]
    7 ]$ `  N6 U0 L8 @
  11. .text:004010F2                 test    eax, eax
    5 K6 I/ v% d4 l9 W2 |" P
  12. .text:004010F4                 mov     edx, [esp+arg_0]
    , Q  I% n3 \1 E0 E
  13. .text:004010F8                 jz      short loc_401147
    2 w; V  M" w3 X' X$ o+ D9 Y2 A
  14. .text:004010FA                 test    edx, edx
    + \5 }) }# g3 v: K
  15. .text:004010FC                 jz      short loc_401147
    - J: k5 D& X& e( D2 @
  16. .text:004010FE                 mov     cl, [eax]
    5 ^5 V5 e- ~7 S- [' v7 |; x
  17. .text:00401100                 test    cl, cl. J+ J2 m+ l- T5 J5 k1 e
  18. .text:00401102                 jnz     short loc_401116
    3 n3 o4 v5 {' f
  19. .text:00401104                 cmp     byte ptr [edx], 0
    * N" u( q3 ^8 D
  20. .text:00401107                 setz    al; \2 z5 m' k) s0 U: e. N
  21. .text:0040110A                 xor     edx, edx0 r: e! }1 c* F4 y
  22. .text:0040110C                 test    al, al) _* \8 S4 D0 {8 }& q* ?
  23. .text:0040110E                 setz    dl0 H. t& X9 D( p, L, B! M. k3 _7 q8 K
  24. .text:00401111                 mov     al, dl
    ; ^7 r: X7 q" u+ N6 q
  25. .text:00401113                 retn    4% k+ e- \2 b2 R  T' N5 e
  26. .text:00401116 ; ---------------------------------------------------------------------------
    3 o0 W' [( M3 Y( o5 g3 M
  27. .text:00401116! ~+ `4 P2 L7 h( V& f, B) N1 B
  28. .text:00401116 loc_401116:                             ; CODE XREF: sub_4010F0+12↑j
    1 D0 W3 d( Q6 ]
  29. .text:00401116                 cmp     byte ptr [edx], 09 l4 E9 t  `4 J3 z$ b
  30. .text:00401119                 jz      short loc_401147
    ; v6 r. \+ x8 T
  31. .text:0040111B                 jmp     short loc_401120
    2 P1 F: h6 E! Y$ C! n
  32. .text:0040111B ; ---------------------------------------------------------------------------6 ?8 _, f- l& ?; t( y
  33. .text:0040111D                 align 10h* M: C2 o( q% K8 l# o6 W* U- f
  34. .text:00401120
    + Z4 W* m8 r) ?1 B- M8 W: T
  35. .text:00401120 loc_401120:                             ; CODE XREF: sub_4010F0+2B↑j7 \; ]" o/ N$ b1 Z/ }
  36. .text:00401120                                         ; sub_4010F0+3B↓j, q3 r4 f+ X- w0 p; ?
  37. .text:00401120                 cmp     cl, [edx]
    5 D; Q( V/ M8 L, Q7 D" ~% S
  38. .text:00401122                 jnz     short loc_40112D
    $ k; q  q& M  k, A* ?, J8 L
  39. .text:00401124                 mov     cl, [eax+1]% _! [( g: O  x/ b
  40. .text:00401127                 inc     eax/ L/ B) F+ m+ l8 h
  41. .text:00401128                 inc     edx
    6 d& o  L. L' Y- E  O$ k
  42. .text:00401129                 test    cl, cl& W: k' X4 l" j3 ]4 ~6 }
  43. .text:0040112B                 jnz     short loc_401120
    & n7 m" |9 W; B  s5 A* {
  44. .text:0040112D
    - r$ V! Y! v9 [5 ^' `9 E; a
  45. .text:0040112D loc_40112D:                             ; CODE XREF: sub_4010F0+32↑j
    # L8 o5 |  p7 h2 H
  46. .text:0040112D                 movzx   eax, byte ptr [eax]& w7 W8 Y( ^5 f# }
  47. .text:00401130                 movzx   ecx, byte ptr [edx]
    $ V+ W+ S- o& V
  48. .text:00401133                 sub     eax, ecx
    4 i; o) X( G" d
  49. .text:00401135                 neg     eax5 V0 W8 ]0 `. K" O9 Y+ p6 e  z1 O% B
  50. .text:00401137                 sbb     al, al
    9 h, A$ o0 m: s* o2 K
  51. .text:00401139                 inc     al
    3 F+ J! Z% o$ @$ Z4 }+ ?
  52. .text:0040113B                 xor     edx, edx
    4 u. F& N, e! u( {, ?
  53. .text:0040113D                 test    al, al
    2 q, K- {- {) }2 _) b
  54. .text:0040113F                 setz    dl+ ~  Y! f6 Q, S
  55. .text:00401142                 mov     al, dl% c8 e: y+ Q+ R8 Q1 y
  56. .text:00401144                 retn    4
    6 r# c6 h' J6 C* c
  57. .text:00401147 ; ---------------------------------------------------------------------------  y9 X- l6 l0 @$ R
  58. .text:00401147$ g% B9 I# K+ F8 C  f0 l+ Z5 x% z
  59. .text:00401147 loc_401147:                             ; CODE XREF: sub_4010F0+8↑j
    & e/ @4 M3 J- ?  g8 P. M4 v
  60. .text:00401147                                         ; sub_4010F0+C↑j ...
    - j) p  b0 o6 V# c% J
  61. .text:00401147                 xor     al, al
    . G" l+ b$ I" g( a$ ]
  62. .text:00401149                 xor     edx, edx
    9 y$ h+ z: _, b" h8 g) t0 P- w1 S2 i
  63. .text:0040114B                 test    al, al3 G' [( S& f; z3 M) b
  64. .text:0040114D                 setz    dl! J% R! _" k# l4 L' p
  65. .text:00401150                 mov     al, dl
    7 p$ L- `! y- D+ f7 ]3 Z5 G1 G
  66. .text:00401152                 retn    4/ w( l0 R0 |* x
  67. .text:00401152 sub_4010F0      endp! Y2 x0 b7 _) K: y
  68. .text:004011523 B9 o; r6 K; [
  69. .text:00401152 ; ---------------------------------------------------------------------------5 v% p* V# J  r$ B
  70. .text:00401155                 align 10h
    ( [0 a1 A9 W- ?* G/ e$ P
  71. .text:00401160
    # O2 r2 t+ \) v3 u# E0 z9 x1 i
  72. .text:00401160 ; =============== S U B R O U T I N E =======================================0 }" L$ _3 b3 Z3 ^2 J3 q; ]
  73. .text:00401160; V& P! ?: r. ]1 e6 `
  74. .text:00401160
    , I+ W# l* y, R3 L* \+ Y
  75. .text:00401160 sub_401160      proc near               ; CODE XREF: sub_4013D0+15↓p
    1 T0 P* u6 V) C0 u
  76. .text:00401160                                         ; sub_4013F0+C↓p ...4 G( S% D4 N" g$ \* o' u9 P
  77. .text:00401160' {9 [* \' ]* `( U1 ^8 Y
  78. .text:00401160 arg_0           = dword ptr  4, A+ x* r8 U6 f0 l+ C: y
  79. .text:00401160
    " |) U- R5 Z1 ~7 E( ?- e) ^
  80. .text:00401160                 push    esi
    2 g) A. I8 g2 _3 v1 `* p
  81. .text:00401161                 push    edi8 I" j. J; J+ F6 V; x) Q8 N9 R
  82. .text:00401162                 mov     edi, [esp+8+arg_0]  q* m6 I6 h$ E( a  H- D
  83. .text:00401166                 test    edi, edi, @! }1 k( e" n3 L, [
  84. .text:00401168                 mov     esi, ecx
    ; E' T' q, |, j; O) E) }
  85. .text:0040116A                 jz      short loc_4011CA
    ' U0 g& ~% v) Z' z. a
  86. .text:0040116C                 mov     eax, [esi]
    " U! R2 e$ b' v( k
  87. .text:0040116E                 cmp     edi, eax6 b6 k  s! P) A/ R2 Q4 g3 ~4 s
  88. .text:00401170                 jz      short loc_4011CA
    5 l  E5 ^$ F* w
  89. .text:00401172                 cmp     byte ptr [edi], 0$ A! t* [4 s, D( k/ `
  90. .text:00401175                 jnz     short loc_4011A2
    $ W; [6 D  L5 s7 t
  91. .text:00401177                 test    eax, eax
    * v  g$ r. u( @8 `* j8 e/ C
  92. .text:00401179                 mov     dword ptr [esi+4], 1, _% o& Q- {0 ]' d' e4 e+ \8 a9 ^# E
  93. .text:00401180                 jz      short loc_40118B0 M1 B( X5 S* S% Z  z) n
  94. .text:00401182                 push    eax             ; void *0 v% N" c# d* P2 \  C3 A2 i8 m
  95. .text:00401183                 call    ??_V@YAXPAX@Z   ; operator delete[](void *)9 S4 p: @6 a0 _) h7 c; ^: _( u/ K
  96. .text:00401188                 add     esp, 4$ x9 S( H; U5 q" m+ `6 H# T
  97. .text:0040118B" M! T. L, g5 W# w" W. m
  98. .text:0040118B loc_40118B:                             ; CODE XREF: sub_401160+20↑j- m# E4 |+ T. w8 M
  99. .text:0040118B                 push    6               ; Size
    ' ]; j: a4 v* E7 I; _/ ]
  100. .text:0040118D                 call    j_??2@YAPAXI@Z  ; operator new(uint)
    ! c+ Z) F6 `' |5 I
  101. .text:00401192                 add     esp, 4# h/ f0 F2 Q% ?9 c
  102. .text:00401195                 mov     [esi], eax" @/ l- s' e5 U9 t' K& D# t, U
  103. .text:00401197                 pop     edi. m. a& {: \( k* M
  104. .text:00401198                 mov     dword ptr [eax], 0
    . i0 c- t% A( H! d6 K% j4 q' |0 w
  105. .text:0040119E                 pop     esi5 i/ ?# ^. c# R6 f
  106. .text:0040119F                 retn    4
    & `- @0 e3 i* W/ K6 `" t" T+ p
  107. .text:004011A2 ; ---------------------------------------------------------------------------5 K4 b/ `2 W9 h9 l+ R( d# ?7 J. p
  108. .text:004011A28 U# O: _( B0 w  D3 y1 J
  109. .text:004011A2 loc_4011A2:                             ; CODE XREF: sub_401160+15↑j
    + ~+ S4 r9 d& A* t4 D9 X. z' c# F
  110. .text:004011A2                 mov     eax, edi
    & c( ~3 G8 T% f; h5 J2 O
  111. .text:004011A4                 lea     edx, [eax+1]
    + \3 o5 l1 m0 g! @
  112. .text:004011A7
    - v+ Y0 m0 @7 F8 Y; f
  113. .text:004011A7 loc_4011A7:                             ; CODE XREF: sub_401160+4C↓j5 e( O' K" [9 u1 V
  114. .text:004011A7                 mov     cl, [eax]
    ; A+ s& f3 D6 b% k  [2 s$ V
  115. .text:004011A9                 inc     eax5 T0 A2 N2 [* r* x2 x. ], X, ]: G
  116. .text:004011AA                 test    cl, cl" o3 I& i" A8 c; U: W
  117. .text:004011AC                 jnz     short loc_4011A7
    / w4 r! w/ Z% `
  118. .text:004011AE                 sub     eax, edx, m5 i: [) k+ k( f/ P5 u+ A
  119. .text:004011B0                 push    eax
    7 K% n3 w4 ^. d$ ^0 x3 W& U" N9 S) u
  120. .text:004011B1                 mov     ecx, esi
    ! U. E& d7 `( q2 t* F+ q
  121. .text:004011B3                 call    sub_401030
    $ l9 N& R: I3 A0 m/ h
  122. .text:004011B8                 mov     edx, [esi]
    * H# z8 @( S5 E: |+ U, u# A% e" K
  123. .text:004011BA                 mov     ecx, edi
    * d$ U. M8 R2 k3 L/ ^: ?
  124. .text:004011BC                 lea     esp, [esp+0]/ d! d! d$ M5 x' r5 Q. d
  125. .text:004011C0* G2 i# s: }' n
  126. .text:004011C0 loc_4011C0:                             ; CODE XREF: sub_401160+68↓j
    * u$ b% P' e  ?: p1 r( L
  127. .text:004011C0                 mov     al, [ecx]
    7 X  h* g/ w% K7 M' p" j8 u
  128. .text:004011C2                 inc     ecx0 E' L& n4 T+ ?/ M4 o2 p
  129. .text:004011C3                 mov     [edx], al
    , |8 V* X# @3 k" j' |
  130. .text:004011C5                 inc     edx
    8 J2 Z% F" Z) O0 D% L; X6 J5 H4 g
  131. .text:004011C6                 test    al, al1 C) B0 s, S, \
  132. .text:004011C8                 jnz     short loc_4011C0( Z! Z) _% n, n- V0 S
  133. .text:004011CA' h9 d5 G$ A( C6 W
  134. .text:004011CA loc_4011CA:                             ; CODE XREF: sub_401160+A↑j& g8 w9 i/ a0 w. t1 S7 A/ G
  135. .text:004011CA                                         ; sub_401160+10↑j* S6 x1 t  n1 V! I' x3 K
  136. .text:004011CA                 pop     edi
    - @2 t% U2 M3 h6 ^
  137. .text:004011CB                 pop     esi
    4 i' u2 x7 ^6 H0 E
  138. .text:004011CC                 retn    4* [, a. G/ \# e, B7 G+ U1 m
  139. .text:004011CC sub_401160      endp/ l  [8 C7 _/ w: a( x
  140. .text:004011CC; E7 e1 q1 X! V1 ^
  141. .text:004011CC ; ---------------------------------------------------------------------------
复制代码

4 z$ i) V/ m# j. i  f. W8 u/ y4 z' Y3 d" J7 y
) Z' h1 I0 h  ?9 r. Q+ j
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享分享 很美好很美好 很差劲很差劲
回复

使用道具 举报

高级模式
B Color Image Link Quote Code Smilies

本版积分规则

冒险解谜游戏中文网 ChinaAVG

官方微博官方微信号小黑屋 微信玩家群  

(C) ChinaAVG 2004 - 2019 All Right Reserved. Powered by Discuz! X3.2
辽ICP备11008827号 | 桂公网安备 45010702000051号

冒险,与你同在。 冒险解谜游戏中文网ChinaAVG诞生于2004年9月9日,是全球华人共同的冒险解谜类游戏家园。我们致力于提供各类冒险游戏资讯供大家学习交流。本站所有资源均不用于商业用途。

快速回复 返回顶部 返回列表