2007-7-14) Updated! No more using AgthAttach!

I spend for a week in reversing SchoolDays(SD) engine to attach AGTH.

Wow. I made it! Now I came to know how to handle Win32 Hooking and DLL Injection technique more than before.. :-)

In first time, I tried to make loader which attach to SD by itself but it failed; it was extremely slow and difficult to hook functions at dynamic DLL for me. So I tried alternative way, which is passing parameters to AGTH and let AGTH attach to SD.

Following pictures are the result I got:

사용자 삽입 이미지


As you see, hooked text was translated into Korean, not English. But I think you may get insight how to use this way to translate into English or other language... I'm using japanese-korean translation engine called "EzTransXP" and its invoker "CliphookerEX!". If you want to use other translator like Japanese-English translator(I can't remember its name. Atlas or something?), please google it yourself. Actually, I don't know how to handle those translators.

Anyway, you have to prepare following requirements to hook with AGTH :


#. Requirements

- SchoolDays Original DVD
- SchoolDays 1.11 patch (Necessary!)
- CliphookerEX! v3.0.57 [http://lolitype.net]
- AGTH v2006.11 [http://agthook.googlepages.com]
- JapanTextReviser v0.1 [you'll find it in this blog]
- Translation engine installed like ezTransXP



#. How to setup

0. You need to install translation engine like ezTransXP in order to translate the hooked text. It depends on your own.. Try googling, or whatever. Please remember that the ezTransXP can only translate japanese<>korean.

1. Install SchoolDays first. Download and patch with Schooldays v1.11 patch at the Overflow website. If you don't patch, you'll never hook the program.

2. Download and install CliphookerEX!(CHE).

3. Download and install AGTH. I recommend install it at the same folder as CliphookerEX! installed before.

4. Download and install AgthAttach v0.1 and JapanTextReviser v0.3 at my blog. Extract it at the same folder as I told above.



#. Setting environment and run the program


1. Run SchoolDays.(SD.exe). Proceed to the title menu.

사용자 삽입 이미지


2. Run CHE. At the first time, CHE will ask in which process you want to attach AGTH. Select "SD.exe" and type "/HW-20@30270:FILMEngine.gem:" in the Additional option box. Press "Attach" to run.

사용자 삽입 이미지

사용자 삽입 이미지


2. Check "Clipboard Monitoring", "Translation" option in the menu and change charset to "SHIFT-JIS" in Advanced setting menu.


3. After you pressed "Attach" button, you may see AGTH as shown in the following. Select approapriate [UserHookW] which seems captured japanese text best-showing.

사용자 삽입 이미지

사용자 삽입 이미지




4. Run JTR v0.1. If you check "Delayed paste" at the dialog, you can sync the subtitle and hooked strings. Minimize JTR for your convenience.

사용자 삽입 이미지


5. Now enjoy SchoolDays! You'll see hooked text are automatically translated as shown in the following.




#. Troubleshooting

1. You will see the texts are hooked "one step prior" all the times because SD engine uses double-buffering feature. You can fix it by activating JTR's "Delayed Paste" function.

2. You'll see popup message about memory access violation when you close SD. The reason is that hooking in dynamically loaded DLL is very unstable. I don't know how to fix the problem but I think it might be Okay.

3. Lastly, please, please don't ask me like "Where can I download SD?".
크리에이티브 커먼즈 라이선스
Creative Commons License
Posted by reversed
2007-7-14) 엔트리 수정했습니다. 최신 버전의 Agth에서 돌아가도록 수정했어요. :-)
2007-7-17) 엔트리 다시 한 번 수정했습니다. SD.exe에 붙이라는 말을 빼먹었네요.

Schooldays(이하 SD) 엔진 해석하고 AGTH 붙이는 방법 연구하느라 거의 일주일 넘게 붙잡혀 있었던 것 같습니다.

덕분에 Win32 Hooking과 DLL Injection과 같은 기술들을 예전보다 좀 더 잘 다루게 되었네요.. 하핫.

SD에 자체적으로 붙는 Loader를 만들려다가 무수한 실패 끝에 결국 포기하고(게다가 너무 느리더군요), AGTH로 인자를 넘기는 방식으로 바꾸었습니다.

성공 결과는 아래와 같습니다.

사용자 삽입 이미지



이를 위해서는 아래와 같은 준비물들이 필요합니다. 전반적으로 필요한 툴들이 지저분할 정도로(..) 많습니다.


#. 준비물

- SchoolDays 정품 DVD
- SchoolDays 1.11 패치 (필수!)
- CliphookerEX! 최신버전 [http://lolitype.net]
- AGTH 최신버전 [http://agthook.googlepages.com]
- JapanTextReviser v0.1 [이 블로그에 있음]
- ezTransXP [재주껏 구하세요]


#. 사전 준비 작업

0. ezTransXP 를 설치한다. 재주껏 구하시기 바라고, 설치한 다음에 프로그램을 적어도 한 번은 실행해야 번역 엔진이 돌아갑니다..

1. SchoolDays 를 설치하고, 1.11 패치를 다운받아 설치한다. 패치 하지 않으면 "절대" 후킹되지 않으니 반드시 패치를 할 것.

2. 이 때 SchoolDays 설치 중 설치 디렉토리를 물어보는데, 게임 실행시 폴더 명에 한글이 들어가 있으면 실행이 안 되므로 설치 폴더 이름자에 한글이 안 들어가도록 c:\Games\Schooldays 등과 같이 바꾸어 주어야 한다.

2. CliphookerEX!를 설치한다. 원하는 디렉토리에 자유롭게 설치할 것.

3. AGTH를 다운받아 설치한다. 가급적 CliphookerEx가 설치된 디렉토리에 같이 넣어둔다.

4. JapanTextReviser v0.1을 다운받아 설치한다. 역시 실행 파일만 덜렁 압축해 놓았으니 CliphookerEx가 설치된 디렉토리에 같이 넣어두는 편이 좋다.




#. 실행 및 설정 방법

1. SchoolDays를 실행한다. 타이틀 메뉴까지 진행한다.

사용자 삽입 이미지


2. CliphookerEx! 를 실행한다. AGTH Helper를 물어보는 아래 창이 뜨는데, 먼저 Agth path에서 아까 Agth가 설치된 디렉토리를 "Browse.." 버튼을 눌러 찍어준다. 그리고 "SD.exe"를 골라서 선택하고 "Additional Option"에 "/HW-20@30270:FILMEngine.gem:"를 아래와 같이 입력한다. 그리고 "Attach"를 누르면 된다.

사용자 삽입 이미지


3. 아래와 같이 나와야 ezTransXP 번역 엔진과 제대로 연결된 것이다.

사용자 삽입 이미지

4. 요건 해도 되고 안 해도 되는데, 번역창이 뜬 다음에 옵션에서 "Clipboard Monitoring", "Translation" 을 체크하고, 아래와 같이 Advanced Setting에서 Charset을 "SHIFT-JIS"로 바꾼다.

사용자 삽입 이미지


5. JapanTextReviser v0.1을 실행한다. 옵션에서 "Delayed paste" 기능을 켜 두면 한 박자 늦게 CliphookerEX로 복사되므로 게임 진행이 한결 편하다. 이 프로그램은 최소화시켜 놓도록 하자.

사용자 삽입 이미지


6. 이제 실제로 게임을 진행하면서 스쿨 데이즈 자체 옵션에서 "자막 출력"을 ON으로 놔둬야 한다.(아마 Caption이었나, Subtitle이었나 그럴겁니다.) 게임 지운지 오래되어서 스샷이 없는데, 크게 어렵지 않게 찾을 수 있을 것이다.

7. 그러면 대사가 화면에 뜨기 시작할텐데, 이제 실제로 후킹되는 UserHookW를 찾아야 한다. AGTH 창의 처음 모습은 아래와 비슷한 형태일 것이다.

사용자 삽입 이미지

8. 드롭 다운 리스트를 내려서 일본어 대사가 잘 보이는 UserHookW를 찾는다.

사용자 삽입 이미지

사용자 삽입 이미지


9. 이제 완료되었다. 게임을 진행하면 대사가 후킹되어 들어가는 것을 확인할 수 있을 것이다.




#. 문제점 및 해결방법

1. SD 엔진에서 더블 버퍼링을 사용하기 때문에 자막이 "한 박자" 빨리 나옵니다. JapanTextReviser v0.1의 "Delayed Paste" 기능을 사용하면 이를 해결할 수 있습니다. 해당 기능을 체크하면 한 박자 늦게 번역기로 들어갑니다.

2. 번역의 질을 향상시키기 위해서는 EztransXP에 DSH 최신 버전을 설치하시기를 권합니다. [여기] 에서 관련 정보를 얻을 수 있습니다. 제 개인적인 생각에 사람이 직접 하는 한글 번역을 약 90% 정도의 완성도라 치면, ezTransXP는 약 65% 정도, 여기에 DSH를 설치하면 약 75% 정도를 기대할 수 있다고 생각합니다.

3. 게임을 어디서 다운받아요? 등과 같은 개념없는 질문은 삼가해 주시기 부탁드립니다. ezTransXP도 마찬가지입니다.




#. 잡설

OllyDbg에서는 SD가 툭하면 죽어버리는 바람에 (게다가 죽기만 하는게 아니라 디스플레이 드라이버를 날려버리더군요.. 15년전에 보던 CGA 해상도 화면의 컴퓨터을 보면서 어찌나 황당했던지..) 결국에는 IDA를 배워 삽질 끝에 함수를 알아냈습니다.

그런데 후킹점이 동적 DLL에 위치하고 있더군요.. 처음에는 Loader를 만들려고 했다가 동적 DLL에 브레이크 걸어주는 내공이 부족해서 포기, 그 다음에는 DLL자체를 수정해서 IPC로 값을 빼올려다가 실패, 결국에는 이렇게 AGTH와 궁합을 맞추는 쪽으로 가게 되었네요. 역시 시스템 프로그래밍은 쉽지 않은듯 합니다.


크리에이티브 커먼즈 라이선스
Creative Commons License
Posted by reversed

[Eng] AgthAttach v0.1

2007/02/22 12:29
AgthAttach.exe is a program helps AGTH to hook dynamically loaded DLL. In most case, you don't need this program. But when a hooked function exists in dynamically loaded DLL, it is hard to determine the hooking address because it is allocated at the run-time. Thus, you need to use DLL's base address to and relative address to the base address. AgthAttach automates this tedious calculation.

사용자 삽입 이미지


First, you have to execute program to be hooked. Second, run AgthAttach to select process and DLL in that process. Finally, input AGTH H option which is relative address to the base address of the hooked DLL and press "Attach" button. It is Okay to close AgthAttach after AGTH attached.

AgthAttach may be used other various programs, not only in SchoolDays.

I used open source of "Remotedll" to develop this program.


크리에이티브 커먼즈 라이선스
Creative Commons License
Posted by reversed

[Kor] AgthAttach v0.1

2007/02/22 12:28
AgthAttach.exe는 AGTH에서 동적 DLL을 후킹할 수 있도록 도와주는 프로그램입니다. 대부분의 경우에는 이 프로그램을 사용할 필요가 없습니다. 하지만 SchoolDays와 같이 후킹 지점이 실행 프로그램이 아닌 동적 DLL에 있는 경우, DLL의 위치는 프로그램을 실행할 때 마다 달라지게 됩니다. 따라서 DLL의 베이스 주소를 가져와 더하는 방법으로 후킹 지점을 결정하여야 하는데, 이를 도와주는 툴이 바로 AgthAttach.exe 입니다.

사용자 삽입 이미지


후킹할 프로그램을 먼저 실행하고 그 다음에 AgthAttach를 실행한 다음 프로세스를 선택하고 그 다음에 해당 프로세스 내의 동적 DLL 목록 중에서 후킹할 지점이 들어있는 DLL을 골라주시면 됩니다.

그 다음에 Attach 버튼을 누르면 AGTH가 해당 process에 attach 됩니다. 일단 AGTH가 실행되면 AgthAttach는 언제든 종료시켜도 괜찮습니다.

AgthAttach는 SchoolDays 외에도 다른 여러 프로그램에 응용될 수 있을 것으로 보입니다.

AgthAttach는 Remotedll의 공개된 소스를 이용하여 개발하였습니다.

크리에이티브 커먼즈 라이선스
Creative Commons License
Posted by reversed
JapanTextReviser(JTR) is a program which helps keep monitoring clipboard to revise or do delay-paste japanese text.

Arrange text function is useful when you want to arrange "shifed" hooked text. It is very effective for the japanese games hooked badly like Ayakashi, Ayakashi H.

Also, Delayed paste function is quite useful when the hooked game uses double-buffering so that the text are hooked in one step prior. If you activate this function, the hooked text will be copied to the clipboard in one step later.

Please be aware of that when you use CliphookerEX with JTR, RUN CliphookerEx! FIRST AND JTR LATER. If you don't do that, clipboard chain should be messed up.

크리에이티브 커먼즈 라이선스
Creative Commons License
Posted by reversed
JapanTextReviser(이하 JTR)는 클립보드를 모니터링 하고 있다가 텍스트가 들어오면 교정 혹은 지연 붙여넣기 등과 같은 기능을 수행하는 프로그램입니다.

교정 기능(Arrange text)은 후킹되기는 하지만 순서가 엉망이 되어서 마침표가 중간에 들어가 버린 문장을 제대로교정해 주는 기능으로, Ayakashi나 Ayakashi H와 같이 후킹상태가 불량한 게임들에 적용시키면 좋은 효과를 볼 수 있습니다.

JTR에는 지연된 붙여넣기(Delayed paste)와 같은 기능이 있는데, 이는 SchoolDays와 같이 더블 버퍼링을 사용하기에 한 박자 빨리 텍스트가 후킹되는 게임들을 위한 기능입니다. 활성화시키면 한 박자 늦게 CliphookerEX로 붙여넣습니다.

참, CliphookerEX와 연동하여 사용할 때에는 반드시 CliphookerEX를 먼저 실행하고 그 다음에 JTR을 실행하도록 하세요.

크리에이티브 커먼즈 라이선스
Creative Commons License
Posted by reversed

BLOG main image
reverse engineering on games, programs, ... by reversed

Announcement

Category

분류 전체보기 (6)
Reversing (6)

Recent Trackback

Total : 68,880
Today : 9 Yesterday : 8