├── .gitignore ├── Injection ├── Hook.h ├── Hook.cpp ├── stdafx.h ├── dllmain.cpp ├── resource.h ├── stdafx.cpp ├── targetver.h ├── Core │ ├── ro │ │ ├── task.h │ │ ├── packet.h │ │ ├── mouse.h │ │ ├── system.h │ │ ├── res.h │ │ ├── ui.h │ │ ├── map.h │ │ └── unit.h │ ├── RoCodeBind.cpp │ ├── FastFont │ │ ├── FastFont.cpp │ │ ├── SFastFont.h │ │ ├── SFastFont.cpp │ │ ├── CacheInfo.h │ │ ├── FastFont.h │ │ └── CacheInfo.cpp │ ├── shared.h │ ├── SearchCode.h │ ├── PerformanceCounter.h │ └── RoCodeBind.h ├── Injection.rc ├── tinyconsole.cpp ├── tinyconsole.h ├── ProxyHelper.h ├── ReadMe.txt ├── ProxyIDirectInput.cpp ├── ProxyIDirectInput.h ├── Injection.vcxproj.filters ├── ProxyIDirectDraw.cpp ├── Injection.vcxproj └── ProxyIDirectDraw.h ├── SimpleROHookCS ├── SimpleROHookCS.ico ├── Properties │ ├── Settings.settings │ ├── AssemblyInfo.cs │ ├── Settings.Designer.cs │ ├── Resources.Designer.cs │ └── Resources.resx ├── app.config ├── app.manifest ├── NPCLogger.Designer.cs ├── ToolStripTrackBar.cs ├── Program.cs ├── SRHAboutBox.cs ├── NPCLogger.cs ├── NPCLogger.resx ├── SimpleROHookCS.csproj ├── SRHSharedData.cs ├── SRHAboutBox.Designer.cs └── MainForm.cs ├── readme.txt └── SimpleROHook.sln /.gitignore: -------------------------------------------------------------------------------- 1 | Release* 2 | ipch 3 | obj 4 | *.aps 5 | *.opensdf 6 | *.sdf 7 | *.suo 8 | -------------------------------------------------------------------------------- /Injection/Hook.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sekishi1259/SimpleROHook/HEAD/Injection/Hook.h -------------------------------------------------------------------------------- /Injection/Hook.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sekishi1259/SimpleROHook/HEAD/Injection/Hook.cpp -------------------------------------------------------------------------------- /Injection/stdafx.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sekishi1259/SimpleROHook/HEAD/Injection/stdafx.h -------------------------------------------------------------------------------- /Injection/dllmain.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sekishi1259/SimpleROHook/HEAD/Injection/dllmain.cpp -------------------------------------------------------------------------------- /Injection/resource.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sekishi1259/SimpleROHook/HEAD/Injection/resource.h -------------------------------------------------------------------------------- /Injection/stdafx.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sekishi1259/SimpleROHook/HEAD/Injection/stdafx.cpp -------------------------------------------------------------------------------- /Injection/targetver.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sekishi1259/SimpleROHook/HEAD/Injection/targetver.h -------------------------------------------------------------------------------- /Injection/Core/ro/task.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sekishi1259/SimpleROHook/HEAD/Injection/Core/ro/task.h -------------------------------------------------------------------------------- /Injection/Injection.rc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sekishi1259/SimpleROHook/HEAD/Injection/Injection.rc -------------------------------------------------------------------------------- /Injection/tinyconsole.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sekishi1259/SimpleROHook/HEAD/Injection/tinyconsole.cpp -------------------------------------------------------------------------------- /Injection/Core/RoCodeBind.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sekishi1259/SimpleROHook/HEAD/Injection/Core/RoCodeBind.cpp -------------------------------------------------------------------------------- /SimpleROHookCS/SimpleROHookCS.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sekishi1259/SimpleROHook/HEAD/SimpleROHookCS/SimpleROHookCS.ico -------------------------------------------------------------------------------- /Injection/Core/FastFont/FastFont.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sekishi1259/SimpleROHook/HEAD/Injection/Core/FastFont/FastFont.cpp -------------------------------------------------------------------------------- /Injection/Core/FastFont/SFastFont.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sekishi1259/SimpleROHook/HEAD/Injection/Core/FastFont/SFastFont.h -------------------------------------------------------------------------------- /Injection/Core/FastFont/SFastFont.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sekishi1259/SimpleROHook/HEAD/Injection/Core/FastFont/SFastFont.cpp -------------------------------------------------------------------------------- /Injection/Core/ro/packet.h: -------------------------------------------------------------------------------- 1 | enum PACKET_HEADER{ 2 | HEADER_ZC_SAY_DIALOG = 0xb4, 3 | HEADER_ZC_MENU_LIST = 0xb7, 4 | }; 5 | 6 | 7 | #pragma pack(push,1) 8 | 9 | #pragma warning(push) 10 | #pragma warning(disable : 4200) 11 | 12 | struct PACKET_CZ_SAY_DIALOG { 13 | WORD PacketType; 14 | WORD PacketLength; 15 | DWORD AID; 16 | BYTE Data[]; 17 | }; 18 | 19 | struct PACKET_CZ_MENU_LIST { 20 | WORD PacketType; 21 | WORD PacketLength; 22 | DWORD AID; 23 | BYTE Data[]; 24 | }; 25 | 26 | #pragma warning(pop) 27 | 28 | #pragma pack(pop) 29 | -------------------------------------------------------------------------------- /Injection/Core/ro/mouse.h: -------------------------------------------------------------------------------- 1 | 2 | enum EBtnState 3 | { 4 | BTN_NONE, 5 | BTN_DOWN, 6 | BTN_PRESSED, 7 | BTN_UP, 8 | BTN_DBLCLK 9 | }; 10 | 11 | class CMouse 12 | { 13 | public: 14 | IDirectInput7* m_lpdi; 15 | IDirectInputDevice7* m_pMouse; 16 | LPVOID m_hevtMouse; 17 | int m_xDelta; 18 | int m_yDelta; 19 | int m_xPos; 20 | int m_yPos; 21 | int m_wheel; 22 | int m_oldBtnState[3]; 23 | EBtnState m_btnState[3]; 24 | int m_dblclkCnt[3]; 25 | DWORD m_dblclkTime; 26 | DWORD m_bSwapButton; 27 | }; 28 | 29 | -------------------------------------------------------------------------------- /Injection/tinyconsole.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | void DebugLogger(const char* format, ...); 4 | void DebugLoggerWithLogWindow(const char* format, ...); 5 | 6 | #define DEBUG_LOGGING_NORMAL(a) DebugLoggerWithLogWindow a 7 | //#define DEBUG_LOGGING_DETAIL(a) DebugLoggerWithLogWindow a 8 | //#define DEBUG_LOGGING_MORE_DETAIL(a) DebugLogger a 9 | 10 | #ifndef DEBUG_LOGGING_NORMAL 11 | #define DEBUG_LOGGING_NORMAL(a) 12 | #endif 13 | #ifndef DEBUG_LOGGING_DETAIL 14 | #define DEBUG_LOGGING_DETAIL(a) 15 | #endif 16 | #ifndef DEBUG_LOGGING_MORE_DETAIL 17 | #define DEBUG_LOGGING_MORE_DETAIL(a) 18 | #endif 19 | 20 | void CreateTinyConsole(void); 21 | void ReleaseTinyConsole(void); 22 | 23 | -------------------------------------------------------------------------------- /Injection/Core/shared.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #define SHAREDMEMORY_OBJECTNAME _T("SimpleROHook1011") 4 | 5 | enum COPYDATAENTRY{ 6 | COPYDATA_NPCLogger = 127 7 | }; 8 | 9 | typedef struct _StSHAREDMEMORY{ 10 | HWND g_hROWindow; 11 | 12 | DWORD executeorder; 13 | 14 | 15 | BOOL write_packetlog; 16 | BOOL freemouse; 17 | int ground_zbias; 18 | int alphalevel; 19 | BOOL m2e; 20 | BOOL bbe; 21 | BOOL deadcell; 22 | BOOL chatscope; 23 | BOOL fix_windowmode_vsyncwait; 24 | BOOL show_framerate; 25 | BOOL objectinformation; 26 | BOOL _44khz_audiomode; 27 | int cpucoolerlevel; 28 | 29 | WCHAR configfilepath[MAX_PATH]; 30 | WCHAR musicfilename[MAX_PATH]; 31 | 32 | }StSHAREDMEMORY; 33 | -------------------------------------------------------------------------------- /SimpleROHookCS/Properties/Settings.settings: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 0, 0, 200, 400 7 | 8 | 9 | Normal 10 | 11 | 12 | True 13 | 14 | 15 | -------------------------------------------------------------------------------- /Injection/Core/FastFont/CacheInfo.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | typedef long s32; 4 | typedef unsigned long u32; 5 | typedef short s16; 6 | typedef unsigned short u16; 7 | typedef char s8; 8 | typedef unsigned char u8; 9 | 10 | #ifndef NULL 11 | #define NULL 0 12 | #endif 13 | 14 | class CacheInfo 15 | { 16 | typedef struct StCacheInfo{ 17 | u32 OriginalKey; 18 | u32 Value; 19 | void *pData; 20 | // 21 | StCacheInfo *pPrev; 22 | StCacheInfo *pNext; 23 | // 24 | StCacheInfo *pPrevHash; 25 | StCacheInfo *pNextHash; 26 | }StCacheInfo; 27 | public: 28 | //CacheInfo(); 29 | CacheInfo(int HashTopTables); 30 | virtual ~CacheInfo(void); 31 | 32 | void ClearCache(void); 33 | void *CreateData(int hashkey,int datasize); 34 | void *GetCacheData(int hashkey); 35 | 36 | int DebugGetHashEntrys(int hashtableno); 37 | 38 | private: 39 | int m_CacheNums; 40 | int m_HashRootTables; 41 | 42 | StCacheInfo m_CacheRoot; 43 | StCacheInfo *m_HashRootTable; 44 | 45 | }; 46 | -------------------------------------------------------------------------------- /readme.txt: -------------------------------------------------------------------------------- 1 | 2 | SimpleROHook 3 | 4 | Simply extend Ragnarok Online. 5 | For example, display font on client screen,it can placed easily in 3D map. 6 | 7 | Copyright (C) 2014 redcat Planetleaf.com Lab. All rights reserved. 8 | 9 | http://lab.planetleaf.com/memory-of-rcx 10 | 11 | 12 | SimpleROHook is free software: you can redistribute it and/or modify 13 | it under the terms of the GNU General Public License as published by 14 | the Free Software Foundation, either version 3 of the License, or 15 | (at your option) any later version. 16 | 17 | This program is distributed in the hope that it will be useful, 18 | but WITHOUT ANY WARRANTY; without even the implied warranty of 19 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 20 | GNU General Public License for more details. 21 | 22 | You should have received a copy of the GNU General Public License 23 | along with this program. If not, see . 24 | 25 | -------------------------------------------------------------------------------- /SimpleROHookCS/app.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 |
6 | 7 | 8 | 9 | 10 | 11 | 0, 0, 200, 400 12 | 13 | 14 | Normal 15 | 16 | 17 | True 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /SimpleROHookCS/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // アセンブリに関する一般情報は以下の属性セットをとおして制御されます。 6 | // アセンブリに関連付けられている情報を変更するには、 7 | // これらの属性値を変更してください。 8 | [assembly: AssemblyTitle("SimpleROHookCS")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("Planetleaf.com Lab.")] 12 | [assembly: AssemblyProduct("SimpleROHookCS")] 13 | [assembly: AssemblyCopyright("Copyright © 2014 redchat Planetleaf.com Lab.")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // ComVisible を false に設定すると、その型はこのアセンブリ内で COM コンポーネントから 18 | // 参照不可能になります。COM からこのアセンブリ内の型にアクセスする場合は、 19 | // その型の ComVisible 属性を true に設定してください。 20 | [assembly: ComVisible(false)] 21 | 22 | // 次の GUID は、このプロジェクトが COM に公開される場合の、typelib の ID です 23 | [assembly: Guid("b7475390-b2fd-4a47-b0d8-7c5004aeae17")] 24 | 25 | // アセンブリのバージョン情報は、以下の 4 つの値で構成されています: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // すべての値を指定するか、下のように '*' を使ってビルドおよびリビジョン番号を 33 | // 既定値にすることができます: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.9")] 36 | [assembly: AssemblyFileVersion("1.0.0.9")] 37 | -------------------------------------------------------------------------------- /Injection/ProxyHelper.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #define PROXY0(name) { DEBUG_LOGGING_MORE_DETAIL((CLASSNAME "::" #name "()")); return m_Instance->name(); } 4 | #define PROXY1(name) { DEBUG_LOGGING_MORE_DETAIL((CLASSNAME "::" #name "()")); return m_Instance->name(p1); } 5 | #define PROXY2(name) { DEBUG_LOGGING_MORE_DETAIL((CLASSNAME "::" #name "()")); return m_Instance->name(p1, p2); } 6 | #define PROXY3(name) { DEBUG_LOGGING_MORE_DETAIL((CLASSNAME "::" #name "()")); return m_Instance->name(p1, p2, p3); } 7 | #define PROXY4(name) { DEBUG_LOGGING_MORE_DETAIL((CLASSNAME "::" #name "()")); return m_Instance->name(p1, p2, p3, p4); } 8 | #define PROXY5(name) { DEBUG_LOGGING_MORE_DETAIL((CLASSNAME "::" #name "()")); return m_Instance->name(p1, p2, p3, p4, p5); } 9 | #define PROXY6(name) { DEBUG_LOGGING_MORE_DETAIL((CLASSNAME "::" #name "()")); return m_Instance->name(p1, p2, p3, p4, p5 ,p6); } 10 | #define PROXY7(name) { DEBUG_LOGGING_MORE_DETAIL((CLASSNAME "::" #name "()")); return m_Instance->name(p1, p2, p3, p4, p5 ,p6 ,p7); } 11 | 12 | #define PROXY_RELEASE \ 13 | { \ 14 | ULONG Count = m_Instance->Release(); \ 15 | DEBUG_LOGGING_MORE_DETAIL((CLASSNAME "::Release() RefCount = %d", Count)); \ 16 | if(Count == 0) \ 17 | delete this; \ 18 | return Count; \ 19 | } 20 | 21 | -------------------------------------------------------------------------------- /Injection/Core/FastFont/FastFont.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include "CacheInfo.h" 5 | 6 | typedef bool (*funcFFDATA2PIC)( VOID* , DWORD ); 7 | 8 | class CFastFont 9 | { 10 | private: 11 | typedef struct StOutlineFontData{ 12 | GLYPHMETRICS GM; 13 | BYTE Image[1]; 14 | }StOutlineFontData; 15 | public: 16 | 17 | CFastFont(); 18 | virtual ~CFastFont(void); 19 | bool CreateFastFont(LOGFONT *lplf, 20 | int OutLineFormat = GGO_BITMAP, 21 | int HashDivideNums = 64); 22 | 23 | void ClearCache(void); 24 | StOutlineFontData *GetFontData(int code,SIZE *size = NULL); 25 | 26 | void BltFontData(int code,int x,int y,SIZE *size); 27 | 28 | int DebugGetHashEntrys(int hashtableno); 29 | 30 | 31 | //typedef int (WINAPI *PFNMESSAGEBOXA)(HWND, PCSTR, PCSTR, UINT); 32 | // typedef bool (*funcFFDATA2PIC)( VOID* , DWORD ); 33 | void SetBltStatus(void *dist,DWORD pitch,DWORD bits,int mode,funcFFDATA2PIC func); 34 | 35 | void GetMaxSize(SIZE *size); 36 | 37 | void test(int mode); 38 | 39 | private: 40 | HDC m_hDC; 41 | HFONT m_hOldFont; 42 | TEXTMETRIC m_TM; 43 | 44 | int m_DefaultBufferSize; 45 | int m_OutLineFormat; 46 | int m_HashDivideNums; 47 | int m_BltAAMode; 48 | HFONT m_hFont; 49 | BYTE *m_pDefaultBuffer; 50 | CacheInfo *m_pCacheInfo; 51 | 52 | funcFFDATA2PIC m_Data2PicFunc; 53 | BYTE *m_DistPtr; 54 | DWORD m_DistPitch; 55 | DWORD m_DistBits; 56 | }; 57 | -------------------------------------------------------------------------------- /Injection/ReadMe.txt: -------------------------------------------------------------------------------- 1 | ======================================================================== 2 | ダイナミック リンク ライブラリ: Injection プロジェクトの概要 3 | ======================================================================== 4 | 5 | この Injection DLL は、AppWizard により作成されました。 6 | 7 | このファイルには、Core 8 | アプリケーションを構成する各ファイルの内容の概要が含まれています。 9 | 10 | 11 | Injection.vcxproj 12 | これは、アプリケーション ウィザードを使用して生成された VC++ 13 | プロジェクトのメイン プロジェクト ファイルです。 14 | ファイルを生成した Visual C++ のバージョンに関する情報と、アプリケーション 15 | ウィザードで選択されたプラットフォーム、 16 | 構成、およびプロジェクト機能に関する情報が含まれています。 17 | 18 | Injection.vcxproj.filters 19 | これは、アプリケーション ウィザードで生成された VC++ プロジェクトのフィルター 20 | ファイルです。 21 | このファイルには、プロジェクト内のファイルとフィルターとの間の関連付けに関する 22 | 情報が含まれています。 この関連付けは、特定のノー 23 | ドで同様の拡張子を持つファイルのグループ化を 24 | 示すために IDE で使用されます (たとえば、".cpp" ファイルは "ソース ファイル" 25 | フィルターに関連付けられています)。 26 | 27 | Injection.cpp 28 | これは、メインの DLL ソース ファイルです。 29 | 30 | ///////////////////////////////////////////////////////////////////////////// 31 | その他の標準ファイル : 32 | 33 | StdAfx.h、StdAfx.cpp 34 | これらのファイルは、Injection.pch 35 | という名前のプリコンパイル済みヘッダー (PCH) ファイルと、StdAfx.obj 36 | という名前のプリコンパイル済みの型ファイルを構築するために使用されます。 37 | 38 | ///////////////////////////////////////////////////////////////////////////// 39 | その他のメモ : 40 | 41 | AppWizard では "TODO:" 42 | コメントを使用して、ユーザーが追加またはカスタマイズする必要のあるソース 43 | コードを示します。 44 | 45 | ///////////////////////////////////////////////////////////////////////////// 46 | -------------------------------------------------------------------------------- /Injection/ProxyIDirectInput.cpp: -------------------------------------------------------------------------------- 1 | #include "tinyconsole.h" 2 | #include "ProxyIDirectInput.h" 3 | 4 | #include "Core/RoCodeBind.h" 5 | 6 | HRESULT CProxyIDirectInput7::Proxy_CreateDevice(THIS_ REFGUID rguid,LPDIRECTINPUTDEVICEA *lpIDD,LPUNKNOWN pUnkOuter) 7 | { 8 | DEBUG_LOGGING_MORE_DETAIL(("IDirectInput7::CreateDevice()\n")); 9 | 10 | void *ret_cProxy; 11 | IDirectInputDevice7* lpDirectInputDevice7; 12 | 13 | HRESULT Result = m_Instance->CreateDevice(rguid, (LPDIRECTINPUTDEVICEA*)&lpDirectInputDevice7,pUnkOuter); 14 | 15 | if ( IsEqualGUID(rguid, GUID_SysMouse) ){ 16 | DEBUG_LOGGING_MORE_DETAIL(("IDirectInput7::Hook_CProxyIDirectInputDevice7 0x%0x ", lpDirectInputDevice7)); 17 | ret_cProxy = (void*)(new CProxyIDirectInputDevice7(lpDirectInputDevice7)); 18 | *lpIDD = (LPDIRECTINPUTDEVICEA)ret_cProxy; 19 | } 20 | 21 | return Result; 22 | } 23 | 24 | HRESULT CProxyIDirectInputDevice7::Proxy_GetDeviceState(THIS_ DWORD cbData,LPVOID lpvData) 25 | { 26 | static DWORD oldtime = 0; 27 | HRESULT Result; 28 | 29 | Result = m_Instance->GetDeviceState(cbData, lpvData); 30 | 31 | if( g_pRoCodeBind ) 32 | g_pRoCodeBind->OneSyncProc(Result, lpvData, g_FreeMouseSw); 33 | 34 | return Result; 35 | } 36 | 37 | HRESULT CProxyIDirectInputDevice7::Proxy_SetCooperativeLevel(HWND hwnd, DWORD dwflags) 38 | { 39 | HRESULT Result; 40 | DEBUG_LOGGING_MORE_DETAIL(("lpDI->SetCooperativeLevel\n")); 41 | 42 | if( g_FreeMouseSw ) 43 | dwflags = DISCL_NONEXCLUSIVE | DISCL_BACKGROUND; 44 | 45 | Result = m_Instance->SetCooperativeLevel(hwnd,dwflags); 46 | 47 | return Result; 48 | } 49 | -------------------------------------------------------------------------------- /SimpleROHookCS/app.manifest: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 47 | 48 | 49 | -------------------------------------------------------------------------------- /SimpleROHookCS/NPCLogger.Designer.cs: -------------------------------------------------------------------------------- 1 | namespace SimpleROHookCS 2 | { 3 | partial class NPCLogger 4 | { 5 | /// 6 | /// Required designer variable. 7 | /// 8 | private System.ComponentModel.IContainer components = null; 9 | 10 | /// 11 | /// Clean up any resources being used. 12 | /// 13 | /// true if managed resources should be disposed; otherwise, false. 14 | protected override void Dispose(bool disposing) 15 | { 16 | if (disposing && (components != null)) 17 | { 18 | components.Dispose(); 19 | } 20 | base.Dispose(disposing); 21 | } 22 | 23 | #region Windows Form Designer generated code 24 | 25 | /// 26 | /// Required method for Designer support - do not modify 27 | /// the contents of this method with the code editor. 28 | /// 29 | private void InitializeComponent() 30 | { 31 | this.richTextBox_LogText = new System.Windows.Forms.RichTextBox(); 32 | this.SuspendLayout(); 33 | // 34 | // richTextBox_LogText 35 | // 36 | this.richTextBox_LogText.AutoWordSelection = true; 37 | this.richTextBox_LogText.Dock = System.Windows.Forms.DockStyle.Fill; 38 | this.richTextBox_LogText.Location = new System.Drawing.Point(0, 0); 39 | this.richTextBox_LogText.Name = "richTextBox_LogText"; 40 | this.richTextBox_LogText.ReadOnly = true; 41 | this.richTextBox_LogText.Size = new System.Drawing.Size(284, 262); 42 | this.richTextBox_LogText.TabIndex = 0; 43 | this.richTextBox_LogText.Text = ""; 44 | // 45 | // NPCLogger 46 | // 47 | this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F); 48 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; 49 | this.ClientSize = new System.Drawing.Size(284, 262); 50 | this.Controls.Add(this.richTextBox_LogText); 51 | this.Name = "NPCLogger"; 52 | this.Text = "NPCLogger"; 53 | this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.Window_FormClosing); 54 | this.ResumeLayout(false); 55 | 56 | } 57 | 58 | #endregion 59 | 60 | private System.Windows.Forms.RichTextBox richTextBox_LogText; 61 | } 62 | } -------------------------------------------------------------------------------- /SimpleROHookCS/Properties/Settings.Designer.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // このコードはツールによって生成されました。 4 | // ランタイム バージョン:4.0.30319.18444 5 | // 6 | // このファイルへの変更は、以下の状況下で不正な動作の原因になったり、 7 | // コードが再生成されるときに損失したりします。 8 | // 9 | //------------------------------------------------------------------------------ 10 | 11 | namespace SimpleROHookCS.Properties { 12 | 13 | 14 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] 15 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "12.0.0.0")] 16 | internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { 17 | 18 | private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); 19 | 20 | public static Settings Default { 21 | get { 22 | return defaultInstance; 23 | } 24 | } 25 | 26 | [global::System.Configuration.UserScopedSettingAttribute()] 27 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] 28 | [global::System.Configuration.DefaultSettingValueAttribute("0, 0, 200, 400")] 29 | public global::System.Drawing.Rectangle LoggerWinBounds { 30 | get { 31 | return ((global::System.Drawing.Rectangle)(this["LoggerWinBounds"])); 32 | } 33 | set { 34 | this["LoggerWinBounds"] = value; 35 | } 36 | } 37 | 38 | [global::System.Configuration.UserScopedSettingAttribute()] 39 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] 40 | [global::System.Configuration.DefaultSettingValueAttribute("Normal")] 41 | public global::System.Windows.Forms.FormWindowState LoggerWinState { 42 | get { 43 | return ((global::System.Windows.Forms.FormWindowState)(this["LoggerWinState"])); 44 | } 45 | set { 46 | this["LoggerWinState"] = value; 47 | } 48 | } 49 | 50 | [global::System.Configuration.UserScopedSettingAttribute()] 51 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] 52 | [global::System.Configuration.DefaultSettingValueAttribute("True")] 53 | public bool LoggerWinVisible { 54 | get { 55 | return ((bool)(this["LoggerWinVisible"])); 56 | } 57 | set { 58 | this["LoggerWinVisible"] = value; 59 | } 60 | } 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /SimpleROHookCS/ToolStripTrackBar.cs: -------------------------------------------------------------------------------- 1 | using System.Windows.Forms; 2 | using System.Windows.Forms.Design; 3 | 4 | 5 | namespace SimpleROHookCS 6 | { 7 | [ToolStripItemDesignerAvailability(ToolStripItemDesignerAvailability.MenuStrip | 8 | ToolStripItemDesignerAvailability.ContextMenuStrip)] 9 | public class ToolStripTrackBar : ToolStripControlHost 10 | { 11 | //private TrackBar trackBar; 12 | 13 | public ToolStripTrackBar() : base(new TrackBar()) { } 14 | 15 | public TrackBar TrackBarControl 16 | { 17 | get 18 | { 19 | return Control as TrackBar; 20 | } 21 | } 22 | 23 | // Add properties, events etc. you want to expose... 24 | public void SetMinMax(int min,int max) 25 | { 26 | TrackBarControl.Minimum = min; 27 | TrackBarControl.Maximum = max; 28 | } 29 | public void SetTickFrequency(int tick) 30 | { 31 | TrackBarControl.TickFrequency = tick; 32 | } 33 | public int Value 34 | { 35 | get { 36 | return TrackBarControl.Value; 37 | } 38 | set { 39 | TrackBarControl.Value = value; 40 | } 41 | } 42 | public void SetChangeValue(int small,int large) 43 | { 44 | TrackBarControl.SmallChange = small; 45 | TrackBarControl.LargeChange = large; 46 | } 47 | 48 | protected override void OnSubscribeControlEvents(Control c) 49 | { 50 | // Call the base so the base events are connected. 51 | base.OnSubscribeControlEvents(c); 52 | // Cast Control to a TrackBar control. 53 | TrackBar trackBarContol = (TrackBar)c; 54 | // Add the event. 55 | trackBarContol.ValueChanged += 56 | new System.EventHandler(OnValueChanged); 57 | } 58 | protected override void OnUnsubscribeControlEvents(Control c) 59 | { 60 | // Call the base method so the basic event are unsubscribed. 61 | base.OnUnsubscribeControlEvents(c); 62 | // Cast the controle to a TrackBar control. 63 | TrackBar trackBarContol = (TrackBar)c; 64 | // Remove the event. 65 | trackBarContol.ValueChanged -= 66 | new System.EventHandler(OnValueChanged); 67 | } 68 | // Declare the TrackBar event. 69 | public event System.EventHandler ValueChanged; 70 | // Raise the TrackBar event. 71 | private void OnValueChanged(object sender,System.EventArgs e) 72 | { 73 | if( ValueChanged != null) 74 | { 75 | ValueChanged(this, e); 76 | } 77 | } 78 | } 79 | } 80 | -------------------------------------------------------------------------------- /SimpleROHookCS/Properties/Resources.Designer.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // このコードはツールによって生成されました。 4 | // ランタイム バージョン:4.0.30319.18444 5 | // 6 | // このファイルへの変更は、以下の状況下で不正な動作の原因になったり、 7 | // コードが再生成されるときに損失したりします。 8 | // 9 | //------------------------------------------------------------------------------ 10 | 11 | namespace SimpleROHookCS.Properties { 12 | using System; 13 | 14 | 15 | /// 16 | /// ローカライズされた文字列などを検索するための、厳密に型指定されたリソース クラスです。 17 | /// 18 | // このクラスは StronglyTypedResourceBuilder クラスが ResGen 19 | // または Visual Studio のようなツールを使用して自動生成されました。 20 | // メンバーを追加または削除するには、.ResX ファイルを編集して、/str オプションと共に 21 | // ResGen を実行し直すか、または VS プロジェクトをビルドし直します。 22 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] 23 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] 24 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] 25 | internal class Resources { 26 | 27 | private static global::System.Resources.ResourceManager resourceMan; 28 | 29 | private static global::System.Globalization.CultureInfo resourceCulture; 30 | 31 | [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] 32 | internal Resources() { 33 | } 34 | 35 | /// 36 | /// このクラスで使用されているキャッシュされた ResourceManager インスタンスを返します。 37 | /// 38 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] 39 | internal static global::System.Resources.ResourceManager ResourceManager { 40 | get { 41 | if (object.ReferenceEquals(resourceMan, null)) { 42 | global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("SimpleROHookCS.Properties.Resources", typeof(Resources).Assembly); 43 | resourceMan = temp; 44 | } 45 | return resourceMan; 46 | } 47 | } 48 | 49 | /// 50 | /// 厳密に型指定されたこのリソース クラスを使用して、すべての検索リソースに対し、 51 | /// 現在のスレッドの CurrentUICulture プロパティをオーバーライドします。 52 | /// 53 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] 54 | internal static global::System.Globalization.CultureInfo Culture { 55 | get { 56 | return resourceCulture; 57 | } 58 | set { 59 | resourceCulture = value; 60 | } 61 | } 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /SimpleROHookCS/Program.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Windows.Forms; 3 | using System.Runtime.InteropServices; 4 | 5 | namespace SimpleROHookCS 6 | { 7 | static class Program 8 | { 9 | /// 10 | /// アプリケーションのメイン エントリ ポイントです。 11 | /// 12 | [DllImport("kernel32.dll", EntryPoint = "LoadLibrary")] 13 | static extern int LoadLibrary( 14 | [MarshalAs(UnmanagedType.LPStr)] string lpLibFileName); 15 | [DllImport("kernel32.dll", EntryPoint = "GetProcAddress")] 16 | static extern IntPtr GetProcAddress(int hModule, 17 | [MarshalAs(UnmanagedType.LPStr)] string lpProcName); 18 | [DllImport("kernel32.dll", EntryPoint = "FreeLibrary")] 19 | static extern bool FreeLibrary(int hModule); 20 | 21 | delegate void HOOKFUNC(); 22 | 23 | [STAThread] 24 | static void Main() 25 | { 26 | using (System.Threading.Mutex mutex = new System.Threading.Mutex(false, Application.ProductName)) 27 | { 28 | if (mutex.WaitOne(0, false)) 29 | { 30 | int hModule = LoadLibrary(@"Injection.dll"); 31 | 32 | if (hModule == 0) 33 | { 34 | MessageBox.Show("error:LoadLibrary failed."); 35 | return; 36 | } 37 | IntPtr intPtrInstall = GetProcAddress(hModule, @"InstallHook"); 38 | IntPtr intPtrRemove = GetProcAddress(hModule, @"RemoveHook"); 39 | 40 | if (intPtrInstall == IntPtr.Zero) 41 | { 42 | MessageBox.Show("error:InstallHook function is not included in Core.dll."); 43 | FreeLibrary(hModule); 44 | return; 45 | } 46 | if (intPtrRemove == IntPtr.Zero) 47 | { 48 | MessageBox.Show("error:intPtrRemove function is not included in Core.dll."); 49 | FreeLibrary(hModule); 50 | return; 51 | } 52 | 53 | HOOKFUNC InstallHook = 54 | (HOOKFUNC)Marshal.GetDelegateForFunctionPointer 55 | (intPtrInstall, typeof(HOOKFUNC)); 56 | HOOKFUNC RemoveHook = 57 | (HOOKFUNC)Marshal.GetDelegateForFunctionPointer 58 | (intPtrRemove, typeof(HOOKFUNC)); 59 | 60 | Application.EnableVisualStyles(); 61 | Application.SetCompatibleTextRenderingDefault(false); 62 | 63 | InstallHook(); 64 | 65 | Application.Run(new MainForm()); 66 | 67 | RemoveHook(); 68 | FreeLibrary(hModule); 69 | } 70 | } 71 | } 72 | } 73 | } 74 | -------------------------------------------------------------------------------- /Injection/Core/SearchCode.h: -------------------------------------------------------------------------------- 1 | class CSearchCode 2 | { 3 | private: 4 | typedef struct StFindMemInfo{ 5 | unsigned char x; 6 | char flag; 7 | }StFindMemInfo; 8 | 9 | enum enCOMPAREMODE{ 10 | enCOMPAREWILDCARD = 0, 11 | enCOMPARENORMAL, 12 | }; 13 | 14 | std::vector m_FindInfo; 15 | std::map m_MakerIndex; 16 | 17 | char ahex2i(char code) 18 | { 19 | if( code >= '0' && code <= '9' ){ 20 | return (code - '0'); 21 | }else 22 | if( code >= 'a' && code <= 'z' ){ 23 | return (code - 'a' + 0x0a ); 24 | }else 25 | if( code >= 'A' && code <= 'Z' ){ 26 | return (code - 'A' + 0x0a ); 27 | } 28 | return -1; 29 | } 30 | 31 | public: 32 | CSearchCode(char *pattern) 33 | { 34 | while( *pattern != 0 ) 35 | { 36 | StFindMemInfo tempInfo; 37 | char h1,h2; 38 | h1 = *pattern++; 39 | h2 = *pattern++; 40 | if(!h2)break; 41 | 42 | if( h1 == '*' ){ 43 | // wildcard 44 | tempInfo.x = 0x00; 45 | tempInfo.flag = enCOMPAREWILDCARD; 46 | m_FindInfo.push_back( tempInfo ); 47 | if( h2 != '*' ) 48 | m_MakerIndex[ h2 ] = m_FindInfo.size() - 1; 49 | }else{ 50 | tempInfo.x = (ahex2i(h1)<<4) | ahex2i(h2); 51 | tempInfo.flag = enCOMPARENORMAL; 52 | m_FindInfo.push_back( tempInfo ); 53 | } 54 | } 55 | } 56 | CSearchCode(int comparemode, char *pattern) 57 | { 58 | StFindMemInfo tempInfo; 59 | tempInfo.flag = enCOMPARENORMAL; 60 | while (*pattern != 0) 61 | { 62 | tempInfo.x = *pattern++; 63 | m_FindInfo.push_back(tempInfo); 64 | } 65 | tempInfo.x = 0; 66 | m_FindInfo.push_back(tempInfo); 67 | } 68 | 69 | ~CSearchCode(){} 70 | 71 | int GetMakerIndex(char code) 72 | { 73 | return m_MakerIndex[ code ]; 74 | } 75 | BOOL PatternMatcher(LPBYTE address) 76 | { 77 | int nums = m_FindInfo.size(); 78 | for(int ii = 0;ii < nums;ii ++) 79 | { 80 | if( m_FindInfo[ii].flag && ( m_FindInfo[ii].x != address[ii] ) ) 81 | return FALSE; 82 | } 83 | return TRUE; 84 | } 85 | LPVOID GetTagAddress(LPBYTE address, char code) 86 | { 87 | return (LPVOID)(address + GetMakerIndex(code)); 88 | } 89 | 90 | DWORD GetImmediateDWORD(LPBYTE address,char code) 91 | { 92 | return *(DWORD*)(address + GetMakerIndex( code )); 93 | } 94 | DWORD Get4BIndexDWORD(LPBYTE address,char code) 95 | { 96 | LPBYTE targetaddress = address + GetMakerIndex( code ); 97 | return (*(DWORD*)targetaddress) + (DWORD)(targetaddress + 4); 98 | } 99 | DWORD GetNearJmpAddress(LPBYTE address,char code) 100 | { 101 | DWORD im_calladdress = *(DWORD*)(address + GetMakerIndex( code )); 102 | // convert to immediate address 103 | im_calladdress += (DWORD)address + GetMakerIndex( code ) + 4; 104 | 105 | return im_calladdress; 106 | } 107 | 108 | BOOL NearJmpAddressMatcher(LPBYTE address,char code,DWORD calladdress) 109 | { 110 | DWORD im_calladdress = *(DWORD*)(address + GetMakerIndex( code )); 111 | // convert to immediate address 112 | im_calladdress += (DWORD)address + GetMakerIndex( code ) + 4; 113 | 114 | if( im_calladdress == calladdress ) 115 | return TRUE; 116 | 117 | return FALSE; 118 | } 119 | 120 | int GetSize(){ return m_FindInfo.size(); } 121 | }; 122 | -------------------------------------------------------------------------------- /SimpleROHookCS/SRHAboutBox.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.ComponentModel; 4 | using System.Drawing; 5 | using System.Linq; 6 | using System.Reflection; 7 | using System.Windows.Forms; 8 | 9 | namespace SimpleROHookCS 10 | { 11 | partial class SRHAboutBox : Form 12 | { 13 | public SRHAboutBox() 14 | { 15 | InitializeComponent(); 16 | this.Text = String.Format("{0} のバージョン情報", AssemblyTitle); 17 | this.labelProductName.Text = AssemblyProduct; 18 | this.labelVersion.Text = String.Format("バージョン {0}", AssemblyVersion); 19 | this.labelCopyright.Text = AssemblyCopyright; 20 | this.labelCompanyName.Text = AssemblyCompany; 21 | this.textBoxDescription.Text = AssemblyDescription; 22 | } 23 | 24 | #region アセンブリ属性アクセサー 25 | 26 | public string AssemblyTitle 27 | { 28 | get 29 | { 30 | object[] attributes = Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(AssemblyTitleAttribute), false); 31 | if (attributes.Length > 0) 32 | { 33 | AssemblyTitleAttribute titleAttribute = (AssemblyTitleAttribute)attributes[0]; 34 | if (titleAttribute.Title != "") 35 | { 36 | return titleAttribute.Title; 37 | } 38 | } 39 | return System.IO.Path.GetFileNameWithoutExtension(Assembly.GetExecutingAssembly().CodeBase); 40 | } 41 | } 42 | 43 | public string AssemblyVersion 44 | { 45 | get 46 | { 47 | return Assembly.GetExecutingAssembly().GetName().Version.ToString(); 48 | } 49 | } 50 | 51 | public string AssemblyDescription 52 | { 53 | get 54 | { 55 | object[] attributes = Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(AssemblyDescriptionAttribute), false); 56 | if (attributes.Length == 0) 57 | { 58 | return ""; 59 | } 60 | return ((AssemblyDescriptionAttribute)attributes[0]).Description; 61 | } 62 | } 63 | 64 | public string AssemblyProduct 65 | { 66 | get 67 | { 68 | object[] attributes = Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(AssemblyProductAttribute), false); 69 | if (attributes.Length == 0) 70 | { 71 | return ""; 72 | } 73 | return ((AssemblyProductAttribute)attributes[0]).Product; 74 | } 75 | } 76 | 77 | public string AssemblyCopyright 78 | { 79 | get 80 | { 81 | object[] attributes = Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(AssemblyCopyrightAttribute), false); 82 | if (attributes.Length == 0) 83 | { 84 | return ""; 85 | } 86 | return ((AssemblyCopyrightAttribute)attributes[0]).Copyright; 87 | } 88 | } 89 | 90 | public string AssemblyCompany 91 | { 92 | get 93 | { 94 | object[] attributes = Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(AssemblyCompanyAttribute), false); 95 | if (attributes.Length == 0) 96 | { 97 | return ""; 98 | } 99 | return ((AssemblyCompanyAttribute)attributes[0]).Company; 100 | } 101 | } 102 | #endregion 103 | } 104 | } 105 | -------------------------------------------------------------------------------- /Injection/Core/PerformanceCounter.h: -------------------------------------------------------------------------------- 1 | class CPerformanceCounter 2 | { 3 | private: 4 | LONGLONG m_OldCounter; 5 | LARGE_INTEGER m_Counter; 6 | double m_dFreq; 7 | 8 | LONGLONG m_OldInstantCounter; 9 | 10 | 11 | double *m_dticklist; 12 | int m_ticklist_index; 13 | int m_ticklist_size; 14 | 15 | int m_FrameCounter; 16 | int m_FrameCount; 17 | int m_SampleTerm; 18 | int m_FrameList[1024]; 19 | int m_MonitorRefreshRate; 20 | double m_FrameRate; 21 | 22 | public: 23 | CPerformanceCounter(int step) : m_OldCounter(0),m_ticklist_index(0),m_FrameCounter(0),m_FrameCount(0),m_SampleTerm(1000),m_MonitorRefreshRate(60),m_FrameRate(0.0f) 24 | { 25 | if( QueryPerformanceCounter( &m_Counter ) != 0){ 26 | m_OldCounter = m_Counter.QuadPart; 27 | LARGE_INTEGER Freq; 28 | QueryPerformanceFrequency( &Freq ); 29 | m_dFreq = (double)Freq.QuadPart; 30 | }else{ 31 | m_OldCounter = (LONGLONG)::timeGetTime(); 32 | } 33 | m_ticklist_size = step; 34 | m_dticklist = new double[m_ticklist_size]; 35 | for(int ii = 0;ii < m_ticklist_size;ii++) 36 | m_dticklist[ ii ] = 0.0; 37 | } 38 | virtual ~CPerformanceCounter() 39 | { 40 | delete[] m_dticklist; 41 | } 42 | void InitInstaltPerformance(void) 43 | { 44 | if( QueryPerformanceCounter( &m_Counter ) != 0){ 45 | m_OldInstantCounter = m_Counter.QuadPart; 46 | }else{ 47 | m_OldInstantCounter = (LONGLONG)::timeGetTime();; 48 | } 49 | } 50 | void SetMonitorRefreshRate(int value) 51 | { 52 | m_MonitorRefreshRate = value; 53 | } 54 | int GetMonitorRefreshRate(void) 55 | { 56 | return m_MonitorRefreshRate; 57 | } 58 | 59 | int GetFrameRate(void) 60 | { 61 | return (int)(m_FrameRate + 0.9); 62 | } 63 | void ModifiFrameRate(void) 64 | { 65 | int Tick = timeGetTime(); 66 | for(int index = m_FrameCount - 1; index >= 0; index --){ 67 | if(m_FrameList[index] + m_SampleTerm <= Tick){ 68 | m_FrameCount = index; 69 | }else{ 70 | break; 71 | } 72 | } 73 | memmove(m_FrameList + 1, m_FrameList, sizeof(m_FrameList[0]) * m_FrameCount); 74 | m_FrameList[0] = Tick; 75 | m_FrameCount ++; 76 | if(m_FrameCount > sizeof(m_FrameList) / sizeof(m_FrameList[0]) - 10){ 77 | m_FrameCount = sizeof(m_FrameList) / sizeof(m_FrameList[0]) - 10; 78 | m_FrameRate = -1.0; 79 | return; 80 | }else{ 81 | int Time = Tick - m_FrameList[m_FrameCount - 1]; 82 | if(Time > 0 && m_FrameCount >= 2){ 83 | m_FrameRate = (double)(m_FrameCount - 1) * (double)m_SampleTerm / (double)Time; 84 | 85 | if(m_FrameRate > (double)m_MonitorRefreshRate) 86 | m_FrameRate = (double)m_MonitorRefreshRate; 87 | }else{ 88 | m_FrameRate = -1.0; 89 | } 90 | } 91 | } 92 | double CalcInstaltPerformance(void) 93 | { 94 | double tick; 95 | if( QueryPerformanceCounter( &m_Counter ) != 0){ 96 | LONGLONG m_temptick = m_Counter.QuadPart; 97 | tick = ((double)(m_temptick - m_OldInstantCounter))*1000 / m_dFreq; 98 | m_OldInstantCounter = m_temptick; 99 | }else{ 100 | LONGLONG m_temptick = (LONGLONG)::timeGetTime(); 101 | tick = (double)(m_temptick - m_OldCounter); 102 | m_OldInstantCounter = m_temptick; 103 | } 104 | return tick; 105 | } 106 | 107 | void SetCounter(double tick) 108 | { 109 | m_dticklist[ m_ticklist_index ] = tick; 110 | m_ticklist_index = (m_ticklist_index+1) % m_ticklist_size; 111 | } 112 | void ModifiCounter(void) 113 | { 114 | if( QueryPerformanceCounter( &m_Counter ) != 0){ 115 | LONGLONG m_temptick = m_Counter.QuadPart; 116 | double tick = ((double)(m_temptick - m_OldCounter))*1000 / m_dFreq; 117 | m_OldCounter = m_temptick; 118 | SetCounter(tick); 119 | }else{ 120 | LONGLONG m_temptick = (LONGLONG)::timeGetTime(); 121 | double tick = (double)(m_temptick - m_OldCounter); 122 | m_OldCounter = m_temptick; 123 | SetCounter(tick); 124 | } 125 | } 126 | double GetTotalTick(void) 127 | { 128 | double tick = 0.0; 129 | for(int ii = 0;ii < m_ticklist_size;ii++) 130 | tick += m_dticklist[ ii ]; 131 | tick /= (double)m_ticklist_size; 132 | return tick; 133 | } 134 | }; 135 | -------------------------------------------------------------------------------- /SimpleROHookCS/NPCLogger.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Drawing; 3 | using System.Runtime.InteropServices; 4 | using System.Security.Permissions; 5 | using System.Windows.Forms; 6 | 7 | namespace SimpleROHookCS 8 | { 9 | public partial class NPCLogger : Form 10 | { 11 | protected override CreateParams CreateParams 12 | { 13 | [SecurityPermission(SecurityAction.Demand, Flags = SecurityPermissionFlag.UnmanagedCode)] 14 | get 15 | { 16 | const int WS_EX_TOOLWINDOW = 0x80; 17 | const int CS_NOCLOSE = 0x0;//0x200; 18 | CreateParams cp = base.CreateParams; 19 | cp.ClassStyle = cp.ClassStyle | CS_NOCLOSE; 20 | cp.ExStyle = WS_EX_TOOLWINDOW; 21 | 22 | return cp; 23 | } 24 | } 25 | 26 | [StructLayout(LayoutKind.Sequential)] 27 | private struct COPYDATASTRUCT 28 | { 29 | public IntPtr dwData; 30 | public int cbData; 31 | public IntPtr lpData; 32 | } 33 | private const int WM_COPYDATA = 0x4A; 34 | 35 | private const int NPCLOGLINE_MAX = 30001; 36 | private int m_textcolor; 37 | 38 | public NPCLogger() 39 | { 40 | InitializeComponent(); 41 | m_textcolor = 0; 42 | } 43 | 44 | private void AppendNPCMessage(string message) 45 | { 46 | int indextop = 0; 47 | 48 | richTextBox_LogText.Enabled = false; 49 | 50 | for (int ii = 0; ii < message.Length; ii++) 51 | { 52 | if (message[ii] == '^') 53 | { 54 | if (indextop != ii) 55 | { 56 | richTextBox_LogText.SelectionColor = Color.FromArgb(m_textcolor); 57 | richTextBox_LogText.AppendText(message.Substring(indextop, ii - indextop)); 58 | } 59 | string colorhex = message.Substring(ii + 1, 6); 60 | m_textcolor = Convert.ToInt32(colorhex, 16); 61 | ii += 7; 62 | indextop = ii; 63 | } 64 | } 65 | richTextBox_LogText.SelectionColor = Color.FromArgb(m_textcolor); 66 | richTextBox_LogText.AppendText(message.Substring(indextop)); 67 | richTextBox_LogText.AppendText(Environment.NewLine); 68 | if (richTextBox_LogText.Lines.Length > NPCLOGLINE_MAX) 69 | { 70 | richTextBox_LogText.ReadOnly = false; 71 | richTextBox_LogText.Select(0, richTextBox_LogText.Lines[0].Length + 1); 72 | richTextBox_LogText.SelectedText = String.Empty; 73 | richTextBox_LogText.ReadOnly = true; 74 | } 75 | 76 | richTextBox_LogText.Enabled = true; 77 | richTextBox_LogText.Focus(); 78 | richTextBox_LogText.ScrollToCaret(); 79 | } 80 | 81 | protected override void WndProc(ref Message m) 82 | { 83 | if (m.Msg == WM_COPYDATA) 84 | { 85 | COPYDATASTRUCT data = new COPYDATASTRUCT(); 86 | data = (COPYDATASTRUCT)Marshal.PtrToStructure(m.LParam, typeof(COPYDATASTRUCT)); 87 | if (data.dwData == (IntPtr)COPYDATAENTRY.COPYDATA_NPCLogger && data.cbData > 0) 88 | { 89 | char[] buffer = new char[data.cbData / 2]; 90 | Marshal.Copy(data.lpData, buffer, 0, data.cbData / 2); 91 | 92 | string npcmessage = new string(buffer); 93 | AppendNPCMessage(npcmessage); 94 | 95 | } 96 | } 97 | base.WndProc(ref m); 98 | } 99 | 100 | private void Window_FormClosing(object sender, FormClosingEventArgs e) 101 | { 102 | if (Visible) 103 | { 104 | e.Cancel = true; 105 | this.Hide(); 106 | } 107 | } 108 | } 109 | } 110 | -------------------------------------------------------------------------------- /SimpleROHook.sln: -------------------------------------------------------------------------------- 1 | 2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 2013 4 | VisualStudioVersion = 12.0.31101.0 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Injection", "Injection\Injection.vcxproj", "{46651709-BCBF-4645-8CE6-11EBA347A529}" 7 | EndProject 8 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SimpleROHookCS", "SimpleROHookCS\SimpleROHookCS.csproj", "{DD2A9D1E-449E-4F85-B3CA-934212878CEA}" 9 | EndProject 10 | Global 11 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 12 | Release-bRO|Mixed Platforms = Release-bRO|Mixed Platforms 13 | Release-bRO|Win32 = Release-bRO|Win32 14 | Release-bRO|x86 = Release-bRO|x86 15 | Release-iRO|Mixed Platforms = Release-iRO|Mixed Platforms 16 | Release-iRO|Win32 = Release-iRO|Win32 17 | Release-iRO|x86 = Release-iRO|x86 18 | Release-jRO|Mixed Platforms = Release-jRO|Mixed Platforms 19 | Release-jRO|Win32 = Release-jRO|Win32 20 | Release-jRO|x86 = Release-jRO|x86 21 | EndGlobalSection 22 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 23 | {46651709-BCBF-4645-8CE6-11EBA347A529}.Release-bRO|Mixed Platforms.ActiveCfg = Release-bRO|Win32 24 | {46651709-BCBF-4645-8CE6-11EBA347A529}.Release-bRO|Mixed Platforms.Build.0 = Release-bRO|Win32 25 | {46651709-BCBF-4645-8CE6-11EBA347A529}.Release-bRO|Win32.ActiveCfg = Release-bRO|Win32 26 | {46651709-BCBF-4645-8CE6-11EBA347A529}.Release-bRO|Win32.Build.0 = Release-bRO|Win32 27 | {46651709-BCBF-4645-8CE6-11EBA347A529}.Release-bRO|x86.ActiveCfg = Release-bRO|Win32 28 | {46651709-BCBF-4645-8CE6-11EBA347A529}.Release-bRO|x86.Build.0 = Release-bRO|Win32 29 | {46651709-BCBF-4645-8CE6-11EBA347A529}.Release-iRO|Mixed Platforms.ActiveCfg = Release-iRO|Win32 30 | {46651709-BCBF-4645-8CE6-11EBA347A529}.Release-iRO|Mixed Platforms.Build.0 = Release-iRO|Win32 31 | {46651709-BCBF-4645-8CE6-11EBA347A529}.Release-iRO|Win32.ActiveCfg = Release-iRO|Win32 32 | {46651709-BCBF-4645-8CE6-11EBA347A529}.Release-iRO|Win32.Build.0 = Release-iRO|Win32 33 | {46651709-BCBF-4645-8CE6-11EBA347A529}.Release-iRO|x86.ActiveCfg = Release-iRO|Win32 34 | {46651709-BCBF-4645-8CE6-11EBA347A529}.Release-iRO|x86.Build.0 = Release-iRO|Win32 35 | {46651709-BCBF-4645-8CE6-11EBA347A529}.Release-jRO|Mixed Platforms.ActiveCfg = Release-jRO|Win32 36 | {46651709-BCBF-4645-8CE6-11EBA347A529}.Release-jRO|Mixed Platforms.Build.0 = Release-jRO|Win32 37 | {46651709-BCBF-4645-8CE6-11EBA347A529}.Release-jRO|Win32.ActiveCfg = Release-jRO|Win32 38 | {46651709-BCBF-4645-8CE6-11EBA347A529}.Release-jRO|Win32.Build.0 = Release-jRO|Win32 39 | {46651709-BCBF-4645-8CE6-11EBA347A529}.Release-jRO|x86.ActiveCfg = Release-jRO|Win32 40 | {46651709-BCBF-4645-8CE6-11EBA347A529}.Release-jRO|x86.Build.0 = Release-jRO|Win32 41 | {DD2A9D1E-449E-4F85-B3CA-934212878CEA}.Release-bRO|Mixed Platforms.ActiveCfg = Release-bRO|x86 42 | {DD2A9D1E-449E-4F85-B3CA-934212878CEA}.Release-bRO|Mixed Platforms.Build.0 = Release-bRO|x86 43 | {DD2A9D1E-449E-4F85-B3CA-934212878CEA}.Release-bRO|Win32.ActiveCfg = Release-jRO|x86 44 | {DD2A9D1E-449E-4F85-B3CA-934212878CEA}.Release-bRO|Win32.Build.0 = Release-jRO|x86 45 | {DD2A9D1E-449E-4F85-B3CA-934212878CEA}.Release-bRO|x86.ActiveCfg = Release-jRO|x86 46 | {DD2A9D1E-449E-4F85-B3CA-934212878CEA}.Release-bRO|x86.Build.0 = Release-jRO|x86 47 | {DD2A9D1E-449E-4F85-B3CA-934212878CEA}.Release-iRO|Mixed Platforms.ActiveCfg = Release-iRO|x86 48 | {DD2A9D1E-449E-4F85-B3CA-934212878CEA}.Release-iRO|Mixed Platforms.Build.0 = Release-iRO|x86 49 | {DD2A9D1E-449E-4F85-B3CA-934212878CEA}.Release-iRO|Win32.ActiveCfg = Release-iRO|x86 50 | {DD2A9D1E-449E-4F85-B3CA-934212878CEA}.Release-iRO|Win32.Build.0 = Release-iRO|x86 51 | {DD2A9D1E-449E-4F85-B3CA-934212878CEA}.Release-iRO|x86.ActiveCfg = Release-iRO|x86 52 | {DD2A9D1E-449E-4F85-B3CA-934212878CEA}.Release-iRO|x86.Build.0 = Release-iRO|x86 53 | {DD2A9D1E-449E-4F85-B3CA-934212878CEA}.Release-jRO|Mixed Platforms.ActiveCfg = Release-jRO|x86 54 | {DD2A9D1E-449E-4F85-B3CA-934212878CEA}.Release-jRO|Mixed Platforms.Build.0 = Release-jRO|x86 55 | {DD2A9D1E-449E-4F85-B3CA-934212878CEA}.Release-jRO|Win32.ActiveCfg = Release-jRO|x86 56 | {DD2A9D1E-449E-4F85-B3CA-934212878CEA}.Release-jRO|Win32.Build.0 = Release-jRO|x86 57 | {DD2A9D1E-449E-4F85-B3CA-934212878CEA}.Release-jRO|x86.ActiveCfg = Release-jRO|x86 58 | {DD2A9D1E-449E-4F85-B3CA-934212878CEA}.Release-jRO|x86.Build.0 = Release-jRO|x86 59 | EndGlobalSection 60 | GlobalSection(SolutionProperties) = preSolution 61 | HideSolutionNode = FALSE 62 | EndGlobalSection 63 | EndGlobal 64 | -------------------------------------------------------------------------------- /Injection/Core/ro/system.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | 4 | struct ACTOR_COLOR { 5 | unsigned char a; 6 | unsigned char r; 7 | unsigned char g; 8 | unsigned char b; 9 | }; 10 | struct COLOR { 11 | union{ 12 | unsigned char b,g,r,a; 13 | unsigned long color; 14 | }; 15 | }; 16 | 17 | struct UVRECT { 18 | float u1; 19 | float v1; 20 | float u2; 21 | float v2; 22 | UVRECT(float _u1, float _v1, float _u2, float _v2) 23 | { 24 | u1 = _u1; 25 | v1 = _v1; 26 | u2 = _u2; 27 | v2 = _v2; 28 | }; 29 | UVRECT() : u1(0),v1(0),u2(0),v2(0) {}; 30 | }; 31 | 32 | struct RENDER_INFO_RECT { 33 | float left; 34 | float top; 35 | float right; 36 | float bottom; 37 | float oow; 38 | void RENDER_INFO_RECT::SetInfo( float fleft, float ftop, float fright, float fbottom, float foow); 39 | void RENDER_INFO_RECT::Update( struct RPSprite& spr); 40 | }; 41 | 42 | struct BOXINFO { 43 | int x; 44 | int y; 45 | int cx; 46 | int cy; 47 | int drawEdge; 48 | int color; 49 | int color2; 50 | }; 51 | 52 | enum ENUM_DRAGTYPE { 53 | DT_NODRAG = 0x0, 54 | DT_FROM_ITEMWND = 0x1, 55 | DT_FROM_EQUIPWND = 0x2, 56 | DT_FROM_ITEMSHOPWND = 0x3, 57 | DT_FROM_ITEMPURCHASEWND = 0x4, 58 | DT_FROM_ITEMSELLWND = 0x5, 59 | DT_FROM_ITEMSTOREWND = 0x6, 60 | DT_FROM_SHORTCUTWND = 0x7, 61 | DT_FROM_SKILLLISTWND = 0x8, 62 | DT_FROM_MERCHANTITEMWND = 0x9, 63 | DT_FROM_MERCHANTSHOPMAKEWND = 0xa, 64 | DT_FROM_MERCHANTMIRRORITEMWND = 0xb, 65 | DT_FROM_MERCHANTITEMSHOPWND = 0xc, 66 | DT_FROM_MERCHANTITEMPURCHASEWND = 0xd, 67 | DT_FROM_METALPROCESSWND = 0xe, 68 | DT_FROM_HOSKILLLISTWND = 0xf, 69 | DT_FROM_MAILWND = 0x10, 70 | DT_FROM_MERSKILLLISTWND = 0x11, 71 | }; 72 | 73 | struct DRAG_INFO { 74 | enum ENUM_DRAGTYPE m_dragType; 75 | int m_dragItemIndex; 76 | int m_dragItemPrice; 77 | int m_dragItemRealPrice; 78 | int m_numDragItem; 79 | int m_slotNum; 80 | int m_dragItemType; 81 | int m_refiningLevel; 82 | unsigned char m_isIdentified; 83 | std::basic_string m_dragSprName; 84 | std::basic_string m_dragItemName; 85 | std::basic_string m_skillName; 86 | int m_skillUseLevel; 87 | int m_slot[4]; 88 | 89 | DRAG_INFO(struct DRAG_INFO&) {}; 90 | DRAG_INFO() {}; 91 | struct DRAG_INFO& operator=(struct DRAG_INFO&) {}; 92 | DRAG_INFO::~DRAG_INFO() {}; 93 | }; 94 | 95 | struct PLAY_WAVE_INFO { 96 | std::basic_string wavName; 97 | unsigned long nAID; 98 | unsigned long term; 99 | unsigned long endTick; 100 | 101 | PLAY_WAVE_INFO(struct PLAY_WAVE_INFO&) {}; 102 | PLAY_WAVE_INFO() {}; 103 | struct PLAY_WAVE_INFO& PLAY_WAVE_INFO::operator=( struct PLAY_WAVE_INFO& __that) {}; 104 | PLAY_WAVE_INFO::~PLAY_WAVE_INFO() {}; 105 | }; 106 | 107 | enum ENUM_SKILL_USE_TYPE { 108 | SUT_NOSKILL = 0x0, 109 | SUT_TO_GROUND = 0x1, 110 | SUT_TO_CHARACTER = 0x2, 111 | SUT_TO_ITEM = 0x3, 112 | SUT_TO_ALL = 0x4, 113 | SUT_TO_SKILL = 0x5, 114 | SUT_TO_SKILLGROUND_WITHTALKBOX = 0x6, 115 | }; 116 | 117 | struct SKILL_USE_INFO { 118 | enum ENUM_SKILL_USE_TYPE m_skillUseType; 119 | int m_skillId; 120 | int m_attackRange; 121 | int m_useLevel; 122 | }; 123 | 124 | struct SHOW_IMAGE_INFO { 125 | int type; 126 | std::basic_string imageName; 127 | 128 | SHOW_IMAGE_INFO(struct SHOW_IMAGE_INFO&) {}; 129 | SHOW_IMAGE_INFO() {}; 130 | struct SHOW_IMAGE_INFO& operator=(struct SHOW_IMAGE_INFO&) {}; 131 | SHOW_IMAGE_INFO::~SHOW_IMAGE_INFO() {}; 132 | }; 133 | 134 | struct POINTER_FUNC { 135 | int excuteType; 136 | void (*pfunc)(); 137 | long startTime; 138 | }; 139 | 140 | class CScheduler { 141 | public: 142 | std::multimap m_scheduleList; 143 | CScheduler(class CScheduler&) {}; 144 | CScheduler::CScheduler() {}; 145 | void CScheduler::OnRun() {}; 146 | unsigned char CScheduler::InsertInList(long excuteTime, int excuteType, void (*pfunc)()) {}; 147 | unsigned char CScheduler::InsertInList(long excuteTime, struct POINTER_FUNC pfunc) {}; 148 | class CScheduler& operator=(class CScheduler&) {}; 149 | 150 | virtual CScheduler::~CScheduler() {}; 151 | }; 152 | 153 | class Exemplar { 154 | public: 155 | Exemplar() {}; 156 | }; 157 | 158 | class CHash { 159 | public: 160 | unsigned long m_HashCode; 161 | char m_String[252]; 162 | }; 163 | 164 | 165 | enum PixelFormat { 166 | PF_A1R5G5B5 = 0x0, 167 | PF_A4R4G4B4 = 0x1, 168 | PF_R5G6B5 = 0x2, 169 | PF_R5G5B5 = 0x3, 170 | PF_A8R8G8B8 = 0x4, 171 | PF_BUMP = 0x5, 172 | PF_LAST = 0x6, 173 | PF_UNSUPPORTED = 0xff, 174 | }; 175 | 176 | enum PROCEEDTYPE { 177 | PT_NOTHING = 0x0, 178 | PT_ATTACK = 0x1, 179 | PT_PICKUPITEM = 0x2, 180 | PT_SKILL = 0x3, 181 | PT_GROUNDSKILL = 0x4, 182 | PT_ATTACK_2 = 0x5, 183 | PT_TOUCH_SKILL = 0x6, 184 | }; 185 | -------------------------------------------------------------------------------- /Injection/ProxyIDirectInput.h: -------------------------------------------------------------------------------- 1 | #include "ProxyHelper.h" 2 | 3 | #define CLASSNAME "IDirectInput7" 4 | class CProxyIDirectInput7 : public IDirectInput7 5 | { 6 | private: 7 | IDirectInput7* m_Instance; 8 | public: 9 | CProxyIDirectInput7(IDirectInput7* ptr) : m_Instance(ptr) {} 10 | 11 | /*** IUnknown methods ***/ 12 | STDMETHOD(QueryInterface)(THIS_ REFIID p1, LPVOID * p2) PROXY2(QueryInterface) 13 | STDMETHOD_(ULONG,AddRef) (THIS) PROXY0(AddRef) 14 | STDMETHOD_(ULONG,Release) (THIS) PROXY_RELEASE 15 | 16 | /*** IDirectInput2A methods ***/ 17 | // 18 | STDMETHOD(CreateDevice)(THIS_ REFGUID rguid,LPDIRECTINPUTDEVICEA *lpIDD,LPUNKNOWN pUnkOuter) 19 | { 20 | return Proxy_CreateDevice(rguid, lpIDD,pUnkOuter); 21 | } 22 | STDMETHOD(EnumDevices)(THIS_ DWORD p1,LPDIENUMDEVICESCALLBACKA p2,LPVOID p3,DWORD p4) PROXY4(EnumDevices) 23 | STDMETHOD(GetDeviceStatus)(THIS_ REFGUID p1) PROXY1(GetDeviceStatus) 24 | STDMETHOD(RunControlPanel)(THIS_ HWND p1,DWORD p2) PROXY2(RunControlPanel) 25 | STDMETHOD(Initialize)(THIS_ HINSTANCE p1,DWORD p2) PROXY2(Initialize) 26 | STDMETHOD(FindDevice)(THIS_ REFGUID p1,LPCSTR p2,LPGUID p3) PROXY3(FindDevice) 27 | 28 | /*** IDirectInput7A methods ***/ 29 | STDMETHOD(CreateDeviceEx)(THIS_ REFGUID p1,REFIID p2,LPVOID *p3,LPUNKNOWN p4) PROXY4(CreateDeviceEx) 30 | 31 | // 32 | // Proxy Functions 33 | // 34 | HRESULT Proxy_CreateDevice(THIS_ REFGUID rguid,LPDIRECTINPUTDEVICEA *lpIDD,LPUNKNOWN pUnkOuter); 35 | }; 36 | #undef CLASSNAME 37 | 38 | #define CLASSNAME "IDirectInputDevice7" 39 | class CProxyIDirectInputDevice7 : public IDirectInputDevice7{ 40 | private: 41 | IDirectInputDevice7* m_Instance; 42 | public: 43 | CProxyIDirectInputDevice7(IDirectInputDevice7* ptr) : m_Instance(ptr) {} 44 | 45 | /*** IUnknown methods ***/ 46 | STDMETHOD(QueryInterface)(THIS_ REFIID p1, LPVOID * p2) PROXY2(QueryInterface) 47 | STDMETHOD_(ULONG,AddRef) (THIS) PROXY0(AddRef) 48 | STDMETHOD_(ULONG,Release) (THIS) PROXY_RELEASE 49 | 50 | /*** IDirectInputDevice2W methods ***/ 51 | STDMETHOD(GetCapabilities)(THIS_ LPDIDEVCAPS p1) PROXY1(GetCapabilities) 52 | STDMETHOD(EnumObjects)(THIS_ LPDIENUMDEVICEOBJECTSCALLBACKA p1,LPVOID p2,DWORD p3) PROXY3(EnumObjects) 53 | STDMETHOD(GetProperty)(THIS_ REFGUID p1,LPDIPROPHEADER p2) PROXY2(GetProperty) 54 | STDMETHOD(SetProperty)(THIS_ REFGUID p1,LPCDIPROPHEADER p2) PROXY2(SetProperty) 55 | STDMETHOD(Acquire)(THIS) PROXY0(Acquire) 56 | STDMETHOD(Unacquire)(THIS) PROXY0(Unacquire) 57 | STDMETHOD(GetDeviceState)(THIS_ DWORD p1,LPVOID p2) 58 | { 59 | return Proxy_GetDeviceState(p1,p2); 60 | } 61 | 62 | STDMETHOD(GetDeviceData)(THIS_ DWORD p1,LPDIDEVICEOBJECTDATA p2,LPDWORD p3,DWORD p4) PROXY4(GetDeviceData) 63 | STDMETHOD(SetDataFormat)(THIS_ LPCDIDATAFORMAT p1) PROXY1(SetDataFormat) 64 | STDMETHOD(SetCooperativeLevel)(THIS_ HWND p1,DWORD p2) 65 | { 66 | return Proxy_SetCooperativeLevel(p1,p2); 67 | } 68 | 69 | STDMETHOD(SetEventNotification)(THIS_ HANDLE p1) PROXY1(SetEventNotification) 70 | 71 | STDMETHOD(GetObjectInfo)(THIS_ LPDIDEVICEOBJECTINSTANCEA p1,DWORD p2,DWORD p3) PROXY3(GetObjectInfo) 72 | STDMETHOD(GetDeviceInfo)(THIS_ LPDIDEVICEINSTANCEA p1) PROXY1(GetDeviceInfo) 73 | STDMETHOD(RunControlPanel)(THIS_ HWND p1,DWORD p2) PROXY2(RunControlPanel) 74 | STDMETHOD(Initialize)(THIS_ HINSTANCE p1,DWORD p2,REFGUID p3) PROXY3(Initialize) 75 | STDMETHOD(CreateEffect)(THIS_ REFGUID p1,LPCDIEFFECT p2,LPDIRECTINPUTEFFECT *p3,LPUNKNOWN p4) PROXY4(CreateEffect) 76 | STDMETHOD(EnumEffects)(THIS_ LPDIENUMEFFECTSCALLBACKA p1,LPVOID p2,DWORD p3) PROXY3(EnumEffects) 77 | STDMETHOD(GetEffectInfo)(THIS_ LPDIEFFECTINFOA p1,REFGUID p2) PROXY2(GetEffectInfo) 78 | STDMETHOD(GetForceFeedbackState)(THIS_ LPDWORD p1) PROXY1(GetForceFeedbackState) 79 | STDMETHOD(SendForceFeedbackCommand)(THIS_ DWORD p1) PROXY1(SendForceFeedbackCommand) 80 | STDMETHOD(EnumCreatedEffectObjects)(THIS_ LPDIENUMCREATEDEFFECTOBJECTSCALLBACK p1,LPVOID p2,DWORD p3) PROXY3(EnumCreatedEffectObjects) 81 | STDMETHOD(Escape)(THIS_ LPDIEFFESCAPE p1) PROXY1(Escape) 82 | STDMETHOD(Poll)(THIS) PROXY0(Poll) 83 | STDMETHOD(SendDeviceData)(THIS_ DWORD p1,LPCDIDEVICEOBJECTDATA p2,LPDWORD p3,DWORD p4) PROXY4(SendDeviceData) 84 | 85 | /*** IDirectInputDevice7W methods ***/ 86 | STDMETHOD(EnumEffectsInFile)(THIS_ LPCSTR p1,LPDIENUMEFFECTSINFILECALLBACK p2,LPVOID p3,DWORD p4) PROXY4(EnumEffectsInFile) 87 | STDMETHOD(WriteEffectToFile)(THIS_ LPCSTR p1,DWORD p2,LPDIFILEEFFECT p3,DWORD p4) PROXY4(WriteEffectToFile) 88 | 89 | 90 | // 91 | // Proxy Functions 92 | // 93 | HRESULT Proxy_GetDeviceState(THIS_ DWORD cbData,LPVOID lpvData); 94 | HRESULT Proxy_SetCooperativeLevel(HWND hwnd, DWORD dwflags); 95 | }; 96 | #undef CLASSNAME 97 | 98 | -------------------------------------------------------------------------------- /Injection/Core/FastFont/CacheInfo.cpp: -------------------------------------------------------------------------------- 1 | #include "CacheInfo.h" 2 | 3 | CacheInfo::CacheInfo(int HashRootTables) 4 | { 5 | 6 | m_HashRootTables = HashRootTables; 7 | m_CacheNums = 0; 8 | 9 | m_CacheRoot.OriginalKey = 0; 10 | m_CacheRoot.Value = 0; 11 | m_CacheRoot.pData = NULL; 12 | m_CacheRoot.pPrev = NULL; 13 | m_CacheRoot.pNext = NULL; 14 | m_CacheRoot.pPrevHash = NULL; 15 | m_CacheRoot.pNextHash = NULL; 16 | 17 | 18 | m_HashRootTable = new StCacheInfo[m_HashRootTables]; 19 | for(int ii = 0; ii < m_HashRootTables;ii++){ 20 | m_HashRootTable[ii].OriginalKey = 0; 21 | m_HashRootTable[ii].Value = 0; 22 | m_HashRootTable[ii].pData = NULL; 23 | m_HashRootTable[ii].pPrev = NULL; 24 | m_HashRootTable[ii].pNext = NULL; 25 | m_HashRootTable[ii].pPrevHash = NULL; 26 | m_HashRootTable[ii].pNextHash = NULL; 27 | } 28 | } 29 | 30 | CacheInfo::~CacheInfo(void) 31 | { 32 | StCacheInfo *pCache = m_CacheRoot.pNext; 33 | 34 | while(pCache) 35 | { 36 | StCacheInfo *pNext = pCache->pNext; 37 | // 38 | delete[] pCache->pData; 39 | delete pCache; 40 | pCache = pNext; 41 | } 42 | m_CacheRoot.pNext = NULL; 43 | delete[] m_HashRootTable; 44 | } 45 | 46 | 47 | void *CacheInfo::CreateData(int hashkey,int datasize) 48 | { 49 | StCacheInfo *pCache; 50 | 51 | if( m_CacheNums >= 256 ) 52 | { 53 | StCacheInfo *pNext = 0; 54 | pCache = m_CacheRoot.pNext; 55 | while(pCache) 56 | { 57 | pNext = pCache->pNext; 58 | // 59 | if( !pNext ){ 60 | // release a disused old cache. 61 | StCacheInfo *pPrev = pCache->pPrev; 62 | if(pPrev)pPrev->pNext = pNext; 63 | // 64 | StCacheInfo *pPrevHash = pCache->pPrevHash; 65 | StCacheInfo *pNextHash = pCache->pNextHash; 66 | 67 | if(pPrevHash)pPrevHash->pNextHash = pNextHash; 68 | if(pNextHash)pNextHash->pPrevHash = pPrevHash; 69 | // 70 | delete[] pCache->pData; 71 | delete pCache; 72 | m_CacheNums--; 73 | // 74 | } 75 | pCache = pNext; 76 | } 77 | } 78 | 79 | pCache = new StCacheInfo; 80 | if(pCache){ 81 | pCache->OriginalKey = hashkey; 82 | pCache->Value = 0; 83 | pCache->pData = new u8[datasize]; 84 | if(pCache->pData){ 85 | // 86 | int hash = hashkey % m_HashRootTables; 87 | // 88 | StCacheInfo *pNext = m_CacheRoot.pNext; 89 | StCacheInfo *pNextHash = m_HashRootTable[hash].pNextHash; 90 | // 91 | m_CacheRoot.pNext = pCache; 92 | m_HashRootTable[hash].pNextHash = pCache; 93 | pCache->pPrev = &m_CacheRoot; 94 | pCache->pNext = pNext; 95 | pCache->pPrevHash = &m_HashRootTable[hash]; 96 | pCache->pNextHash = pNextHash; 97 | 98 | if(pNext) 99 | pNext->pPrev = pCache; 100 | if(pNextHash) 101 | pNextHash->pPrevHash = pCache; 102 | 103 | 104 | m_CacheNums++; 105 | return pCache->pData; 106 | } 107 | delete pCache; 108 | } 109 | return NULL; 110 | } 111 | 112 | void CacheInfo::ClearCache(void) 113 | { 114 | StCacheInfo *pCache = m_CacheRoot.pNext; 115 | 116 | while(pCache) 117 | { 118 | StCacheInfo *pNext = pCache->pNext; 119 | // 120 | delete[] pCache->pData; 121 | delete pCache; 122 | pCache = pNext; 123 | } 124 | m_CacheRoot.pNext = NULL; 125 | 126 | for(int ii = 0; ii < m_HashRootTables;ii++){ 127 | m_HashRootTable[ii].OriginalKey = 0; 128 | m_HashRootTable[ii].Value = 0; 129 | m_HashRootTable[ii].pData = NULL; 130 | m_HashRootTable[ii].pPrev = NULL; 131 | m_HashRootTable[ii].pNext = NULL; 132 | m_HashRootTable[ii].pPrevHash = NULL; 133 | m_HashRootTable[ii].pNextHash = NULL; 134 | } 135 | 136 | m_CacheNums = 0; 137 | } 138 | 139 | void *CacheInfo::GetCacheData(int hashkey) 140 | { 141 | int hash = hashkey % m_HashRootTables; 142 | 143 | StCacheInfo *pCache = m_HashRootTable[hash].pNextHash; 144 | 145 | while(pCache) 146 | { 147 | if( pCache->OriginalKey == hashkey ){ 148 | // move to top a cache used. 149 | StCacheInfo *pPrev = pCache->pPrev; 150 | StCacheInfo *pNext = pCache->pNext; 151 | // 152 | if(pPrev)pPrev->pNext = pNext; 153 | if(pNext)pNext->pPrev = pPrev; 154 | // 155 | pNext = m_CacheRoot.pNext; 156 | pCache->pPrev = &m_CacheRoot; 157 | pCache->pNext = pNext; 158 | m_CacheRoot.pNext = pCache; 159 | if(pNext)pNext->pPrev = pCache; 160 | 161 | return pCache->pData; 162 | } 163 | pCache = pCache->pNextHash; 164 | } 165 | return NULL; 166 | 167 | } 168 | 169 | int CacheInfo::DebugGetHashEntrys(int hashtableno) 170 | { 171 | int hashentrys = 0; 172 | if( hashtableno >= m_HashRootTables)return 0; 173 | 174 | StCacheInfo *pCache = m_HashRootTable[hashtableno].pNextHash; 175 | 176 | while(pCache) 177 | { 178 | hashentrys++; 179 | pCache = pCache->pNextHash; 180 | } 181 | return hashentrys; 182 | } 183 | 184 | -------------------------------------------------------------------------------- /Injection/Core/ro/res.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | class CRes { 4 | public: 5 | virtual ~CRes(){}; 6 | 7 | int m_lockCnt; 8 | unsigned long m_timeStamp; 9 | int m_extIndex; 10 | class CHash m_fName; 11 | }; 12 | 13 | class CSurface { 14 | public: 15 | unsigned long m_w; 16 | unsigned long m_h; 17 | struct IDirectDrawSurface7* m_pddsSurface; 18 | 19 | CSurface(class CSurface&) {}; 20 | CSurface() {}; 21 | CSurface::CSurface( unsigned long w, unsigned long h, struct IDirectDrawSurface7* surface) {}; 22 | CSurface::CSurface( unsigned long w, unsigned long h) {}; 23 | struct IDirectDrawSurface7* GetDDSurface() {}; 24 | unsigned char CSurface::Create( unsigned long w, unsigned long h) {}; 25 | class CSurface& operator=(class CSurface&) {}; 26 | 27 | virtual CSurface::~CSurface() {}; 28 | virtual void CSurface::Update( int x, int y, int width, int height, unsigned long* image, unsigned char blackkey, int lPitch) {}; 29 | virtual void CSurface::ClearSurface( struct tagRECT* rect, unsigned long color) {}; 30 | virtual void CSurface::DrawSurface( int x, int y, int width, int height, unsigned long color) {}; 31 | virtual void CSurface::DrawSurfaceStretch( int x, int y, int width, int height) {}; 32 | }; 33 | 34 | 35 | class CTexture : public CSurface { 36 | public: 37 | static float m_uOffset; 38 | static float m_vOffset; 39 | 40 | enum PixelFormat m_pf; 41 | unsigned char m_blackkey; 42 | unsigned long m_updateWidth; 43 | unsigned long m_updateHeight; 44 | char m_texName[256]; 45 | long m_lockCnt; 46 | unsigned long m_timeStamp; 47 | 48 | static void __cdecl SetUVOffset(float, float) {}; 49 | /* 50 | void CTexture::UpdateSprite( int x, int y, int width, int height, struct SprImg& img, unsigned long* pal); 51 | float GetUAdjust(); 52 | float GetVAdjust(); 53 | enum PixelFormat GetPixelFormat(); 54 | long CTexture::Lock(); 55 | long CTexture::Unlock(); 56 | long GetLockCount(); 57 | void UpdateStamp(); 58 | void SetName(char*); 59 | unsigned char CTexture::CopyTexture( class CTexture* srcTex, int sx, int sy, int sw, int sh, int dx, int dy, int dw, int dh); 60 | */ 61 | CTexture(class CTexture&) {}; 62 | CTexture::CTexture( unsigned long w, unsigned long h, enum PixelFormat pf, struct IDirectDrawSurface7* surface) {}; 63 | CTexture::CTexture( unsigned long w, unsigned long h, enum PixelFormat pf) {}; 64 | /* 65 | unsigned char CTexture::Create( unsigned long w, unsigned long h, enum PixelFormat pf); 66 | unsigned char CTexture::CreateBump( unsigned long w, unsigned long h, struct IDirectDrawSurface7* pSurface); 67 | unsigned char CTexture::CreateBump( unsigned long w, unsigned long h); 68 | void CTexture::SetUVAdjust( unsigned long width, unsigned long height); 69 | void CTexture::UpdateMipmap( struct tagRECT& src); 70 | class CTexture& operator=(class CTexture&); 71 | 72 | virtual void CTexture::Update( int x, int y, int width, int height, unsigned long* image, unsigned char blackkey, int lPitch); 73 | virtual void CTexture::ClearSurface( struct tagRECT* rect, unsigned long color); 74 | virtual void CTexture::DrawSurface( int x, int y, int w, int h, unsigned long color); 75 | virtual void CTexture::DrawSurfaceStretch( int x, int y, int w, int h); 76 | */ 77 | virtual CTexture::~CTexture() {}; 78 | }; 79 | 80 | struct SprImg { 81 | short width; 82 | short height; 83 | short isHalfW; 84 | short isHalfH; 85 | CTexture* tex; 86 | unsigned char* m_8bitImage; 87 | }; 88 | 89 | class CSprRes : public CRes { 90 | public: 91 | unsigned long m_pal[256]; 92 | std::vector m_sprites[2]; 93 | int m_count; 94 | 95 | CSprRes(class CSprRes&) {}; 96 | CSprRes::CSprRes( class Exemplar __formal, char* resid, char* baseDir) {}; 97 | CSprRes::CSprRes() {}; 98 | void Unload() {}; 99 | unsigned char* CSprRes::ZeroCompression(unsigned char* Image, int x, int y, unsigned short& Size) {}; 100 | unsigned char* CSprRes::ZeroDecompression(unsigned char* compressedImage, int width, int height) {}; 101 | unsigned char* CSprRes::HalfImage(unsigned char* Image, int x, int y, int isXHalf, int isYHalf) {}; 102 | class CSprRes& operator=(class CSprRes&) {}; 103 | 104 | virtual class CRes* CSprRes::Clone() {}; 105 | virtual unsigned char CSprRes::Load(char* fName) {}; 106 | virtual void CSprRes::Reset() {}; 107 | virtual CSprRes::~CSprRes() {}; 108 | }; 109 | 110 | struct CSprClip { 111 | int x; 112 | int y; 113 | int sprIndex; 114 | int flags; 115 | unsigned char r; 116 | unsigned char g; 117 | unsigned char b; 118 | unsigned char a; 119 | float zoomx; 120 | float zoomy; 121 | int angle; 122 | int clipType; 123 | }; 124 | struct CMotion { 125 | struct tagRECT range1; 126 | struct tagRECT range2; 127 | std::vector sprClips; 128 | int numClips; 129 | int m_eventId; 130 | std::vector attachInfo; 131 | int attachCnt; 132 | }; 133 | 134 | struct CAction { 135 | std::vector motions; 136 | CAction() {}; 137 | }; 138 | class CActRes : public CRes { 139 | public: 140 | std::vector actions; 141 | int numMaxClipPerMotion; 142 | std::vector> m_events; 143 | std::vector m_delay; 144 | }; -------------------------------------------------------------------------------- /SimpleROHookCS/Properties/Resources.resx: -------------------------------------------------------------------------------- 1 | 2 | 3 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | text/microsoft-resx 107 | 108 | 109 | 2.0 110 | 111 | 112 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 113 | 114 | 115 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 116 | 117 | -------------------------------------------------------------------------------- /SimpleROHookCS/NPCLogger.resx: -------------------------------------------------------------------------------- 1 | 2 | 3 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | text/microsoft-resx 110 | 111 | 112 | 2.0 113 | 114 | 115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 116 | 117 | 118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 119 | 120 | -------------------------------------------------------------------------------- /Injection/Injection.vcxproj.filters: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hpp;hxx;hm;inl;inc;xsd 11 | 12 | 13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} 14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms 15 | 16 | 17 | {6eced7ab-6ea6-4797-9bd1-75743cbd5603} 18 | 19 | 20 | {44cd2f75-ceea-40d0-8c6f-ea139b6568c4} 21 | 22 | 23 | {ec981e33-4e83-44b8-9ddc-d149900f8e0e} 24 | 25 | 26 | {6b16db12-e221-4b04-a0e6-19a40bded639} 27 | 28 | 29 | {2169db81-8e32-4342-a369-a7ac160e5ec2} 30 | 31 | 32 | {f00d55fe-ea5b-4c9e-8271-bf051342f785} 33 | 34 | 35 | {edea7297-3860-4483-b62d-6c54972bea8d} 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | ヘッダー ファイル\Core\ro 44 | 45 | 46 | ヘッダー ファイル\Core\ro 47 | 48 | 49 | ヘッダー ファイル\Core\ro 50 | 51 | 52 | ヘッダー ファイル\Core\ro 53 | 54 | 55 | ヘッダー ファイル\Core\ro 56 | 57 | 58 | ヘッダー ファイル\Core\ro 59 | 60 | 61 | ヘッダー ファイル\Core\ro 62 | 63 | 64 | ヘッダー ファイル\Core\ro 65 | 66 | 67 | ヘッダー ファイル\Core 68 | 69 | 70 | ヘッダー ファイル\Core 71 | 72 | 73 | ヘッダー ファイル\Dll-Injection 74 | 75 | 76 | ヘッダー ファイル\Dll-Injection 77 | 78 | 79 | ヘッダー ファイル\Dll-Injection 80 | 81 | 82 | ヘッダー ファイル\Dll-Injection 83 | 84 | 85 | ヘッダー ファイル\Dll-Injection 86 | 87 | 88 | ヘッダー ファイル\Core\FastFont 89 | 90 | 91 | ヘッダー ファイル\Core\FastFont 92 | 93 | 94 | ヘッダー ファイル\Core\FastFont 95 | 96 | 97 | ヘッダー ファイル\Dll-Injection 98 | 99 | 100 | ヘッダー ファイル\Dll-Injection 101 | 102 | 103 | ヘッダー ファイル\Core 104 | 105 | 106 | ヘッダー ファイル\Core 107 | 108 | 109 | ヘッダー ファイル\Dll-Injection 110 | 111 | 112 | ヘッダー ファイル\Core\ro 113 | 114 | 115 | 116 | 117 | ソース ファイル\Core 118 | 119 | 120 | ソース ファイル\Dll-Injection 121 | 122 | 123 | ソース ファイル\Dll-Injection 124 | 125 | 126 | ソース ファイル\Dll-Injection 127 | 128 | 129 | ソース ファイル\Dll-Injection 130 | 131 | 132 | ソース ファイル\Core\FastFont 133 | 134 | 135 | ソース ファイル\Core\FastFont 136 | 137 | 138 | ソース ファイル\Core\FastFont 139 | 140 | 141 | ソース ファイル\Dll-Injection 142 | 143 | 144 | ソース ファイル\Dll-Injection 145 | 146 | 147 | 148 | 149 | リソース ファイル 150 | 151 | 152 | -------------------------------------------------------------------------------- /Injection/Core/RoCodeBind.h: -------------------------------------------------------------------------------- 1 | /* 2 | This file is part of SimpleROHook. 3 | 4 | SimpleROHook is free software: you can redistribute it and/or modify 5 | it under the terms of the GNU General Public License as published by 6 | the Free Software Foundation, either version 3 of the License, or 7 | (at your option) any later version. 8 | 9 | SimpleROHook is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License 15 | along with SimpleROHook. If not, see . 16 | */ 17 | #pragma once 18 | 19 | #include "shared.h" 20 | 21 | #include "PerformanceCounter.h" 22 | #include "SearchCode.h" 23 | #include "FastFont/SFastFont.h" 24 | 25 | // Required to create a dll for jRO. 26 | //#define JRO_CLIENT_STRUCTURE 27 | // 28 | 29 | #include "ro/system.h" 30 | #include "ro/packet.h" 31 | #include "ro/mouse.h" 32 | #include "ro/unit.h" 33 | #include "ro/res.h" 34 | #include "ro/ui.h" 35 | #include "ro/object.h" 36 | #include "ro/map.h" 37 | #include "ro/task.h" 38 | 39 | #define D3DFVF_CPOLVERTEX (D3DFVF_XYZRHW|D3DFVF_DIFFUSE) 40 | #define D3DCOLOR_ARGB(a,r,g,b) \ 41 | ((D3DCOLOR)((((a)&0xff)<<24)|(((r)&0xff)<<16)|(((g)&0xff)<<8)|((b)&0xff))) 42 | 43 | struct CPOLVERTEX { 44 | FLOAT x, y, z, rhw; // The transformed position for the vertex 45 | DWORD color; // The vertex color 46 | }; 47 | 48 | typedef void (__cdecl *tPlayStream)(const char *streamFileName,int playflag); 49 | 50 | typedef void* (__thiscall *tCFileMgr__GetData)(/*CFileMgr*/void *this_pt, const char *name, unsigned int *size); 51 | 52 | typedef void* (__thiscall *tCFileMgr__GetPak)(/*CFileMgr*/void *this_pt, const char *name, unsigned int *size); 53 | 54 | typedef void* (__cdecl *tCRagConnection__instanceR)(void); 55 | 56 | typedef int (__thiscall *tCRagConnection__GetPacketSize)(/*CRagConnection*/void *this_pt, int packetType); 57 | 58 | 59 | class CRoCodeBind 60 | { 61 | private: 62 | CRenderer** g_renderer; 63 | CModeMgr *g_pmodeMgr; 64 | CMouse* g_mouse; 65 | 66 | void* m_CFileMgr__gfileMgr; 67 | tCFileMgr__GetData m_functionRagexe_CFileMgr__GetData; 68 | tCFileMgr__GetPak m_functionRagexe_CFileMgr__GetPak; 69 | 70 | tPlayStream m_funcRagexe_PlayStream; 71 | 72 | 73 | std::map m_ItemName; 74 | void InitItemNameMap(); 75 | 76 | tCRagConnection__instanceR m_functionRagexe_CRagConnection__instanceR; 77 | tCRagConnection__GetPacketSize m_functionRagexe_CRagConnection__GetPacketSize; 78 | void **m_packetLenMap; 79 | void *m_packetLenMap_InsertTree; 80 | 81 | HWND m_hWnd; 82 | int m_gid; 83 | 84 | #define PACKETQUEUE_BUFFERSIZE 40960 85 | char m_packetqueuebuffer[PACKETQUEUE_BUFFERSIZE]; 86 | unsigned int m_packetqueue_head; 87 | 88 | #define ROPACKET_MAXLEN 0x2000 89 | int m_packetLenMap_table[ROPACKET_MAXLEN]; 90 | int m_packetLenMap_table_index; 91 | 92 | #define MAX_FLLORSKILLTYPE 0x100 93 | DWORD m_M2ESkillColor[MAX_FLLORSKILLTYPE]; 94 | 95 | int m_CMode_subMode; 96 | int m_CMode_old_subMode; 97 | 98 | DWORD _state_zenable; 99 | DWORD _state_zwriteenable; 100 | DWORD _state_zbias; 101 | DWORD _state_fogenable; 102 | DWORD _state_specularenable; 103 | DWORD _state_alphafunc; 104 | DWORD _state_alpharef; 105 | DWORD _state_srcblend; 106 | DWORD _state_destblend; 107 | void BackupRenderState(IDirect3DDevice7* d3ddevice); 108 | void RestoreRenderState(IDirect3DDevice7* d3ddevice); 109 | 110 | void DrawBBE(IDirect3DDevice7* d3ddevice); 111 | void DrawM2E(IDirect3DDevice7* d3ddevice); 112 | 113 | void PacketProc(const char *packetdata); 114 | 115 | typedef void (CRoCodeBind::*tPacketHandler)(const char *packetdata); 116 | std::map m_packethandler; 117 | 118 | void InitPacketHandler(void); 119 | void PacketHandler_Cz_Say_Dialog(const char *packetdata); 120 | void PacketHandler_Cz_Menu_List(const char *packetdata); 121 | 122 | void SendMessageToNPCLogger(const char *src, int size); 123 | 124 | struct p_std_map_packetlen 125 | { 126 | struct p_std_map_packetlen *left, *parent, *right; 127 | DWORD key; 128 | int value; 129 | }; 130 | int GetTreeData(p_std_map_packetlen* node); 131 | 132 | void ProjectVertex(vector3d& src,matrix& vtm,float *x,float *y,float *oow); 133 | void ProjectVertex(vector3d& src,matrix& vtm,tlvertex3d *vert); 134 | void ProjectVertexEx(vector3d& src, vector3d& pointvector, matrix& vtm, float *x, float *y, float *oow); 135 | void ProjectVertexEx(vector3d& src, vector3d& pointvector, matrix& vtm, tlvertex3d *vert); 136 | 137 | void LoadIni(void); 138 | void SearchRagexeMemory(void); 139 | 140 | LPDIRECTDRAWSURFACE7 m_pddsFontTexture; 141 | CSFastFont *m_pSFastFont; 142 | 143 | struct MouseDataStructure 144 | { 145 | int x_axis,y_axis,wheel; 146 | char l_button,r_button,wheel_button,pad; 147 | }; 148 | 149 | void DrawGage(LPDIRECT3DDEVICE7 device, int x, int y, int w, int h, unsigned long value, DWORD color, int alpha, int type); 150 | void DrawHPSPGage(IDirect3DDevice7 *d3ddev, int x, int y, int hp, int sp); 151 | 152 | public: 153 | CRoCodeBind() : 154 | m_hWnd(NULL),m_funcRagexe_PlayStream(NULL), 155 | m_CFileMgr__gfileMgr(NULL), 156 | m_functionRagexe_CFileMgr__GetPak(NULL), 157 | m_packetLenMap_table_index(0),m_packetqueue_head(0), 158 | m_pSFastFont(NULL),m_pddsFontTexture(NULL), 159 | g_renderer(NULL), g_pmodeMgr(NULL), g_mouse(NULL), 160 | m_packetLenMap(NULL), m_packetLenMap_InsertTree(NULL), 161 | m_functionRagexe_CRagConnection__GetPacketSize(NULL), 162 | m_functionRagexe_CRagConnection__instanceR(NULL), 163 | m_CMode_old_subMode(-1), m_CMode_subMode(-1), 164 | m_gid(0) 165 | { 166 | ZeroMemory(m_packetLenMap_table, sizeof(m_packetLenMap_table)); 167 | }; 168 | virtual ~CRoCodeBind(); 169 | 170 | 171 | void Init(IDirect3DDevice7* d3ddevice); 172 | 173 | void DrawSRHDebug(IDirect3DDevice7* d3ddevice); 174 | void DrawOn3DMap(IDirect3DDevice7* d3ddevice); 175 | 176 | int GetPacketLength(int opcode); 177 | void PacketQueueProc(char *buf,int len); 178 | 179 | void InitWindowHandle(HWND hWnd){m_hWnd = hWnd;}; 180 | 181 | const char *GetItemNameByID(int id); 182 | 183 | void *GetPak(const char *name, unsigned int *size); 184 | void ReleasePak(void *handle); 185 | 186 | 187 | void OneSyncProc(HRESULT Result, LPVOID lpvData, BOOL FreeMouse); 188 | void SetMouseCurPos(int x,int y); 189 | }; 190 | 191 | 192 | extern BOOL g_FreeMouseSw; 193 | extern StSHAREDMEMORY *g_pSharedData; 194 | 195 | extern CRoCodeBind* g_pRoCodeBind; 196 | 197 | BOOL OpenSharedMemory(void); 198 | BOOL ReleaseSharedMemory(void); 199 | 200 | 201 | extern CPerformanceCounter g_PerformanceCounter; 202 | 203 | 204 | 205 | -------------------------------------------------------------------------------- /SimpleROHookCS/SimpleROHookCS.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Debug 5 | x86 6 | 8.0.30703 7 | 2.0 8 | {DD2A9D1E-449E-4F85-B3CA-934212878CEA} 9 | WinExe 10 | Properties 11 | SimpleROHookCS 12 | SimpleROHookCS 13 | v4.0 14 | Client 15 | 512 16 | false 17 | publish\ 18 | true 19 | Disk 20 | false 21 | Foreground 22 | 7 23 | Days 24 | false 25 | false 26 | true 27 | 0 28 | 1.0.0.%2a 29 | false 30 | true 31 | 32 | 33 | x86 34 | true 35 | full 36 | false 37 | ..\Debug\ 38 | DEBUG;TRACE 39 | prompt 40 | 4 41 | true 42 | 43 | 44 | x86 45 | pdbonly 46 | true 47 | ..\Release-iRO\ 48 | TRACE 49 | prompt 50 | 4 51 | true 52 | 53 | 54 | SimpleROHookCS.ico 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | app.manifest 63 | 64 | 65 | ..\Release-jRO\ 66 | TRACE 67 | true 68 | true 69 | pdbonly 70 | x86 71 | prompt 72 | MinimumRecommendedRules.ruleset 73 | 74 | 75 | ..\Release-bRO\ 76 | TRACE 77 | true 78 | true 79 | pdbonly 80 | x86 81 | prompt 82 | MinimumRecommendedRules.ruleset 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | Form 103 | 104 | 105 | MainForm.cs 106 | 107 | 108 | Form 109 | 110 | 111 | NPCLogger.cs 112 | 113 | 114 | 115 | 116 | Form 117 | 118 | 119 | SRHAboutBox.cs 120 | 121 | 122 | 123 | Component 124 | 125 | 126 | MainForm.cs 127 | 128 | 129 | NPCLogger.cs 130 | 131 | 132 | ResXFileCodeGenerator 133 | Resources.Designer.cs 134 | Designer 135 | 136 | 137 | True 138 | Resources.resx 139 | True 140 | 141 | 142 | SRHAboutBox.cs 143 | 144 | 145 | 146 | Designer 147 | 148 | 149 | SettingsSingleFileGenerator 150 | Settings.Designer.cs 151 | 152 | 153 | True 154 | Settings.settings 155 | True 156 | 157 | 158 | 159 | 160 | False 161 | Microsoft .NET Framework 4 Client Profile %28x86 および x64%29 162 | true 163 | 164 | 165 | False 166 | .NET Framework 3.5 SP1 Client Profile 167 | false 168 | 169 | 170 | False 171 | .NET Framework 3.5 SP1 172 | false 173 | 174 | 175 | False 176 | Windows インストーラー 3.1 177 | true 178 | 179 | 180 | 181 | 182 | 183 | 184 | 191 | -------------------------------------------------------------------------------- /SimpleROHookCS/SRHSharedData.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | using System.Windows.Forms; 4 | using System.IO.MemoryMappedFiles; 5 | using System.Runtime.InteropServices; 6 | 7 | namespace SimpleROHookCS 8 | { 9 | enum COPYDATAENTRY 10 | { 11 | COPYDATA_NPCLogger = 127 12 | }; 13 | 14 | unsafe class SRHSharedData : IDisposable 15 | { 16 | private const int MAX_PATH = 260; 17 | 18 | [StructLayout(LayoutKind.Sequential)] 19 | unsafe struct StSHAREDMEMORY 20 | { 21 | public int g_hROWindow; 22 | 23 | public int executeorder; 24 | 25 | public int write_packetlog; 26 | public int freemouse; 27 | public int ground_zbias; 28 | public int alphalevel; 29 | public int m2e; 30 | public int bbe; 31 | public int deadcell; 32 | public int chatscope; 33 | public int fix_windowmode_vsyncwait; 34 | public int show_framerate; 35 | public int objectinformation; 36 | public int _44khz_audiomode; 37 | public int cpucoolerlevel; 38 | public fixed char configfilepath[MAX_PATH]; 39 | public fixed char musicfilename[MAX_PATH]; 40 | } 41 | 42 | private MemoryMappedFile m_Mmf = null; 43 | private MemoryMappedViewAccessor m_Accessor = null; 44 | private StSHAREDMEMORY* m_pSharedMemory; 45 | 46 | public SRHSharedData() 47 | { 48 | m_Mmf = MemoryMappedFile.CreateNew(@"SimpleROHook1011", 49 | Marshal.SizeOf(typeof(StSHAREDMEMORY)), 50 | MemoryMappedFileAccess.ReadWrite); 51 | if (m_Mmf == null) 52 | MessageBox.Show("CreateOrOpen MemoryMappedFile Failed."); 53 | m_Accessor = m_Mmf.CreateViewAccessor(); 54 | 55 | byte* p = null; 56 | m_Accessor.SafeMemoryMappedViewHandle.AcquirePointer(ref p); 57 | m_pSharedMemory = (StSHAREDMEMORY*)p; 58 | 59 | write_packetlog = false; 60 | freemouse = false; 61 | ground_zbias = 0; 62 | alphalevel = 0x7f; 63 | m2e = false; 64 | bbe = false; 65 | deadcell = false; 66 | chatscope = false; 67 | fix_windowmode_vsyncwait = false; 68 | show_framerate = false; 69 | objectinformation = false; 70 | _44khz_audiomode = false; 71 | cpucoolerlevel = 0; 72 | configfilepath = ""; 73 | musicfilename = ""; 74 | executeorder = false; 75 | g_hROWindow = 0; 76 | } 77 | public void Dispose() 78 | { 79 | m_Accessor.Dispose(); 80 | m_Mmf.Dispose(); 81 | } 82 | 83 | public bool write_packetlog 84 | { 85 | get 86 | { 87 | return (m_pSharedMemory->write_packetlog == 0) ? false : true; 88 | } 89 | set 90 | { 91 | m_pSharedMemory->write_packetlog = (value == false) ? 0 : 1; 92 | } 93 | } 94 | public bool freemouse 95 | { 96 | get 97 | { 98 | return (m_pSharedMemory->freemouse == 0)? false : true; 99 | } 100 | set 101 | { 102 | m_pSharedMemory->freemouse = (value == false)? 0 : 1; 103 | } 104 | } 105 | public int ground_zbias 106 | { 107 | get 108 | { 109 | return m_pSharedMemory->ground_zbias; 110 | } 111 | set 112 | { 113 | m_pSharedMemory->ground_zbias = value; 114 | } 115 | } 116 | public int alphalevel 117 | { 118 | get 119 | { 120 | return m_pSharedMemory->alphalevel; 121 | } 122 | set 123 | { 124 | m_pSharedMemory->alphalevel = value; 125 | } 126 | } 127 | 128 | public bool m2e 129 | { 130 | get 131 | { 132 | return (m_pSharedMemory->m2e == 0) ? false : true; 133 | } 134 | set 135 | { 136 | m_pSharedMemory->m2e = (value == false) ? 0 : 1; 137 | } 138 | } 139 | 140 | public bool bbe 141 | { 142 | get 143 | { 144 | return (m_pSharedMemory->bbe == 0) ? false : true; 145 | } 146 | set 147 | { 148 | m_pSharedMemory->bbe = (value == false) ? 0 : 1; 149 | } 150 | } 151 | 152 | public bool deadcell 153 | { 154 | get 155 | { 156 | return (m_pSharedMemory->deadcell == 0) ? false : true; 157 | } 158 | set 159 | { 160 | m_pSharedMemory->deadcell = (value == false) ? 0 : 1; 161 | } 162 | } 163 | 164 | public bool chatscope 165 | { 166 | get 167 | { 168 | return (m_pSharedMemory->chatscope == 0) ? false : true; 169 | } 170 | set 171 | { 172 | m_pSharedMemory->chatscope = (value == false) ? 0 : 1; 173 | } 174 | } 175 | 176 | public bool fix_windowmode_vsyncwait 177 | { 178 | get 179 | { 180 | return (m_pSharedMemory->fix_windowmode_vsyncwait == 0) ? false : true; 181 | } 182 | set 183 | { 184 | m_pSharedMemory->fix_windowmode_vsyncwait = (value == false) ? 0 : 1; 185 | } 186 | } 187 | public bool show_framerate 188 | { 189 | get 190 | { 191 | return (m_pSharedMemory->show_framerate == 0) ? false : true; 192 | } 193 | set 194 | { 195 | m_pSharedMemory->show_framerate = (value == false) ? 0 : 1; 196 | } 197 | } 198 | public bool objectinformation 199 | { 200 | get 201 | { 202 | return (m_pSharedMemory->objectinformation == 0) ? false : true; 203 | } 204 | set 205 | { 206 | m_pSharedMemory->objectinformation = (value == false) ? 0 : 1; 207 | } 208 | } 209 | public bool _44khz_audiomode 210 | { 211 | get 212 | { 213 | return (m_pSharedMemory->_44khz_audiomode == 0) ? false : true; 214 | } 215 | set 216 | { 217 | m_pSharedMemory->_44khz_audiomode = (value == false) ? 0 : 1; 218 | } 219 | } 220 | public int cpucoolerlevel 221 | { 222 | get 223 | { 224 | return m_pSharedMemory->cpucoolerlevel; 225 | } 226 | set 227 | { 228 | m_pSharedMemory->cpucoolerlevel = value; 229 | } 230 | } 231 | 232 | public bool executeorder 233 | { 234 | get 235 | { 236 | return (m_pSharedMemory->executeorder == 0)? false : true; 237 | } 238 | set 239 | { 240 | m_pSharedMemory->executeorder = (value == false)? 0 : 1; 241 | } 242 | } 243 | public int g_hROWindow 244 | { 245 | get 246 | { 247 | return m_pSharedMemory->g_hROWindow; 248 | } 249 | set 250 | { 251 | m_pSharedMemory->g_hROWindow = value; 252 | } 253 | } 254 | 255 | public string configfilepath 256 | { 257 | get 258 | { 259 | string result = new string(m_pSharedMemory->configfilepath); 260 | return result; 261 | } 262 | set 263 | { 264 | char[] cstr = value.ToCharArray(); 265 | Marshal.Copy(cstr, 0, (IntPtr)m_pSharedMemory->configfilepath, cstr.Length); 266 | m_pSharedMemory->configfilepath[cstr.Length] = '\0'; 267 | } 268 | } 269 | public string musicfilename 270 | { 271 | get 272 | { 273 | string result = new string(m_pSharedMemory->musicfilename); 274 | return result; 275 | } 276 | set 277 | { 278 | char[] cstr = value.ToCharArray(); 279 | Marshal.Copy(cstr, 0, (IntPtr)m_pSharedMemory->musicfilename, cstr.Length); 280 | m_pSharedMemory->musicfilename[cstr.Length] = '\0'; 281 | } 282 | } 283 | } 284 | } 285 | -------------------------------------------------------------------------------- /Injection/Core/ro/ui.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | class UIWindow { 4 | public: 5 | class UIWindow* m_parent; 6 | std::list m_children; // class std::list > m_children; 7 | int m_x; 8 | int m_y; 9 | int m_w; 10 | int m_h; 11 | int m_isDirty; 12 | void *m_dc; //CDC* m_dc; 13 | int m_id; 14 | int m_state; 15 | int m_stateCnt; 16 | int m_show; 17 | unsigned long m_trans; 18 | unsigned long m_transTarget; 19 | unsigned long m_transTime; 20 | 21 | UIWindow(class UIWindow&) {}; 22 | UIWindow::UIWindow() {}; 23 | /* 24 | void UIWindow::Create( int cx, int cy); 25 | void UIWindow::Destroy(); 26 | void UIWindow::AddChild( class UIWindow* window); 27 | void UIWindow::RemoveChild( class UIWindow* window); 28 | void UIWindow::RemoveAllChildren(); 29 | void UIWindow::ClearAllChildrenState(); 30 | void UIWindow::InvalidateChildren(); 31 | void UIWindow::SetId int id); 32 | int GetId(); 33 | int UIWindow::IsFamily( class UIWindow* window); 34 | class UIWindow* UIWindow::HitTest( int x, int y); 35 | void UIWindow::DoDraw( int blitToParent); 36 | unsigned char UIWindow::IsChildOf( class UIWindow* win); 37 | class UIWindow* UIWindow::GetNextSiblingOf( class UIWindow* wnd); 38 | class UIWindow* UIWindow::GetPrevSiblingOf( class UIWindow* wnd); 39 | class UIWindow* UIWindow::GetAncestor(); 40 | void UIWindow::GetGlobalCoor( int& x, int& y); 41 | int IsShow(); 42 | int GetX(); 43 | int GetY(); 44 | int GetHeight(); 45 | int GetWidth(); 46 | void UIWindow::DrawBitmap( int x, int y, class CBitmapRes* bitmap, unsigned char drawOnlyNoTrans); 47 | void UIWindow::TextOutA( int x, int y, char* text, int textLen, int fontType, int fontHeight, unsigned long colorRef); 48 | void UIWindow::TextOutWithRightAlign( int x, int y, char* text, int textLen, int fontType, int fontHeight, unsigned long colorRef); 49 | void UIWindow::TextOutWithDecoration( int x, int y, char* text, int textLen, unsigned long* colorRef, int fontType, int fontHeight); 50 | void UIWindow::TextOutWithShadow( int x, int y, char* text, int textLen, unsigned long colorText, unsigned long colorShadow, int fontType, int fontHeight); 51 | void UIWindow::TextOutWithOutline( int x, int y, char* text, int textLen, unsigned long colorText, unsigned long colorOutline, int fontType, int fontHeight, unsigned char bold); 52 | void UIWindow::TextOutWithDecoOutline( int x, int y, char* text, int textLen, unsigned long* colorText, unsigned long colorOutline, int fontType, int fontHeight, unsigned char bold); 53 | void UIWindow::TextOutVertical( int x, int y, char* text, int textLen, int fontType, int fontHeight, unsigned long colorRef); 54 | void UIWindow::TextOutWithOutlineVertical( int x, int y, char* text, int textLen, unsigned long colorText, unsigned long colorOutline, int fontType, int fontHeight, unsigned char bold); 55 | void UIWindow::TextOutWithTwoColors( int x, int y, char* text, unsigned long colorRef, unsigned long colorRef2, int textLen, int fontType, int fontHeight); 56 | int UIWindow::GetTextWidth( char* text, int textLen, int fontType, int fontHeight, unsigned char bold); 57 | int UIWindow::GetTextHeight( char* text, int textLen, int fontType, int fontHeight, unsigned char bold); 58 | int UIWindow::GetTextHeightVertical( char* text, int textLen, int fontType, int fontHeight, unsigned char bold); 59 | int UIWindow::GetColorTextWidth( char* text, int textLen, int fontType, int fontHeight, unsigned char bold); 60 | char* UIWindow::PolishText( char* text, int drawWidth, int fontType, int fontHeight, unsigned char bold); 61 | char* UIWindow::PolishText2( char* text, int maxNumCharLine); 62 | void UIWindow::PolishText3( char* text, class std::vector,std::allocator >,std::allocator,std::allocator > > >& strings, class std::vector >& enters, int width); 63 | void UIWindow::PolishText4( char* text, class std::vector,std::allocator >,std::allocator,std::allocator > > >& strings, int width); 64 | void UIWindow::ClearDC( unsigned long color); 65 | void UIWindow::ClearDCRect( unsigned long color, struct tagRECT& rect); 66 | void UIWindow::DrawBox( int x, int y, int cx, int cy, unsigned long color); 67 | void UIWindow::DrawBorderLine( int x, int y, int w, int h, unsigned long color); 68 | void UIWindow::DrawTriangleDC( int x1, int y1, int x2, int y2, int x3, int y3, unsigned long color); 69 | char* UIWindow::InterpretColor( char* color_text, unsigned long* colorRef); 70 | char* UIWindow::FindColorMark( char* text, char* text_end); 71 | class UIWindow& operator=(class UIWindow&); 72 | // void __local_vftable_ctor_closure(); 73 | */ 74 | virtual UIWindow::~UIWindow() {}; 75 | /* 76 | virtual void UIWindow::Invalidate(); 77 | virtual void UIWindow::InvalidateWallPaper(); 78 | virtual void UIWindow::Resize( int cx, int cy); 79 | virtual unsigned char UIWindow::IsFrameWnd(); 80 | virtual unsigned char UIWindow::IsUpdateNeed(); 81 | virtual void UIWindow::Move( int x, int y); 82 | virtual unsigned char UIWindow::CanGetFocus(); 83 | virtual unsigned char UIWindow::GetTransBoxInfo( struct BOXINFO* __formal); 84 | virtual unsigned char UIWindow::IsTransmitMouseInput(); 85 | virtual unsigned char UIWindow::ShouldDoHitTest(); 86 | virtual void UIWindow::DragAndDrop( int x, int y, struct DRAG_INFO* dragInfo); 87 | virtual void UIWindow::StoreInfo(); 88 | virtual void UIWindow::SaveOriginalPos(); 89 | virtual void UIWindow::MoveDelta( int deltaDragX, int deltaDragY); 90 | virtual unsigned long UIWindow::GetColor(); 91 | virtual void UIWindow::SetShow( int visible); 92 | virtual void UIWindow::OnCreate( int cx, int cy); 93 | virtual void UIWindow::OnDestroy(); 94 | virtual void UIWindow::OnProcess(); 95 | virtual void UIWindow::OnDraw(); 96 | virtual void UIWindow::OnDraw2(); 97 | virtual void UIWindow::OnRun(); 98 | virtual void UIWindow::OnSize( int cx, int cy); 99 | virtual void UIWindow::OnBeginEdit(); 100 | virtual void UIWindow::OnFinishEdit(); 101 | virtual void UIWindow::OnLBtnDown( int x, int y); 102 | virtual void UIWindow::OnLBtnDblClk( int x, int y); 103 | virtual void UIWindow::OnMouseMove( int x, int y); 104 | virtual void UIWindow::OnMouseHover( int x, int y); 105 | virtual void UIWindow::OnMouseShape( int x, int y); 106 | virtual void UIWindow::OnLBtnUp( int x, int y); 107 | virtual void UIWindow::OnRBtnDown( int x, int y); 108 | virtual void UIWindow::OnRBtnUp( int x, int y); 109 | virtual void UIWindow::OnRBtnDblClk( int x, int y); 110 | virtual void UIWindow::OnWheel( int wheel); 111 | virtual void UIWindow::RefreshSnap(); 112 | virtual int UIWindow::SendMsg( class UIWindow* sender, int message, int val1, int val2, int val3, int val4); 113 | virtual unsigned char UIWindow::GetTransBoxInfo2( struct BOXINFO* __formal); 114 | virtual void UIWindow::DrawBoxScreen2(); 115 | //virtual void* __vecDelDtor(unsigned int); 116 | */ 117 | }; 118 | 119 | class UIBalloonText : public UIWindow { 120 | public: 121 | unsigned char m_isBold; 122 | int m_fontSize; 123 | std::vector< std::basic_string > m_strings; 124 | // class std::vector,std::allocator >,std::allocator,std::allocator > > > m_strings; 125 | unsigned long m_fontColor; 126 | unsigned long m_bgColor; 127 | unsigned char m_isBack; 128 | short m_charfont; 129 | 130 | UIBalloonText(class UIBalloonText&) {}; 131 | UIBalloonText::UIBalloonText() {}; 132 | void UIBalloonText::SetText( char* msg, int maxNumCharLine) {}; 133 | void UIBalloonText::AddText( char* msg) {}; 134 | void SetFntColor(unsigned long, unsigned long) {}; 135 | void UIBalloonText::SetFntSize( int fontSize) {}; 136 | void SetBackTrans(unsigned char) {}; 137 | void SetCharFont(short) {}; 138 | void UIBalloonText::AdjustSizeByText() {}; 139 | class UIBalloonText& operator=(class UIBalloonText&) {}; 140 | 141 | virtual UIBalloonText::~UIBalloonText() {}; 142 | virtual void UIBalloonText::OnProcess() {}; 143 | virtual void UIBalloonText::OnDraw() {}; 144 | virtual unsigned char UIBalloonText::ShouldDoHitTest() {}; 145 | }; 146 | 147 | class UITransBalloonText : public UIBalloonText { 148 | public: 149 | struct BOXINFO m_transBoxInfo; 150 | 151 | UITransBalloonText(class UITransBalloonText&) {}; 152 | UITransBalloonText::UITransBalloonText() {}; 153 | void UITransBalloonText::SetTransBoxColor( unsigned long transboxColor) {}; 154 | class UITransBalloonText& operator=(class UITransBalloonText&) {}; 155 | 156 | virtual UITransBalloonText::~UITransBalloonText() {}; 157 | virtual void UITransBalloonText::OnDraw() {}; 158 | virtual unsigned char UITransBalloonText::GetTransBoxInfo( struct BOXINFO* boxInfo) {}; 159 | virtual void UITransBalloonText::OnCreate( int cx, int cy) {}; 160 | virtual void UITransBalloonText::Move( int x, int y) {}; 161 | virtual void UITransBalloonText::Resize( int cx, int cy) {}; 162 | }; 163 | 164 | -------------------------------------------------------------------------------- /Injection/ProxyIDirectDraw.cpp: -------------------------------------------------------------------------------- 1 | #include "tinyconsole.h" 2 | #include "ProxyIDirectDraw.h" 3 | 4 | #include "Core/RoCodeBind.h" 5 | 6 | 7 | CProxyIDirectDraw7* CProxyIDirectDraw7::lpthis; 8 | 9 | CProxyIDirectDraw7::CProxyIDirectDraw7(IDirectDraw7* ptr):m_Instance(ptr), CooperativeLevel(0), PrimarySurfaceFlag(0), TargetSurface(NULL) 10 | { 11 | g_pRoCodeBind = new CRoCodeBind(); 12 | DEBUG_LOGGING_MORE_DETAIL(("IDirectDraw7::Create")); 13 | } 14 | 15 | CProxyIDirectDraw7::~CProxyIDirectDraw7() 16 | { 17 | DEBUG_LOGGING_MORE_DETAIL(("IDirectDraw7::Releace")); 18 | } 19 | 20 | ULONG CProxyIDirectDraw7::Proxy_Release(void) 21 | { 22 | ULONG Count; 23 | 24 | if( g_pRoCodeBind )delete g_pRoCodeBind; 25 | Count = m_Instance->Release(); 26 | DEBUG_LOGGING_MORE_DETAIL(("CProxyIDirectDraw7::Release() RefCount = %d", Count)); 27 | delete this; 28 | 29 | return Count; 30 | } 31 | 32 | HRESULT CProxyIDirectDraw7::Proxy_RestoreAllSurfaces(void) 33 | { 34 | return m_Instance->RestoreAllSurfaces(); 35 | } 36 | 37 | 38 | HRESULT CProxyIDirectDraw7::Proxy_QueryInterface(THIS_ REFIID riid, LPVOID FAR * ppvObj) 39 | { 40 | DEBUG_LOGGING_MORE_DETAIL(("CProxyIDirectDraw7::QueryInterface()")); 41 | 42 | if( IsEqualGUID(riid, IID_IDirect3D7) ){ 43 | DEBUG_LOGGING_MORE_DETAIL(("CProxyIDirectDraw7::IDirect3D7 create")); 44 | HRESULT temp_ret = m_Instance->QueryInterface(riid, ppvObj); 45 | if(temp_ret == S_OK){ 46 | void *ret_cProxy; 47 | //LPVOID FAR * ppvObj_proxy; 48 | ret_cProxy = new CProxyIDirect3D7( (IDirect3D7*) *ppvObj); 49 | *ppvObj = ret_cProxy; 50 | 51 | return S_OK; 52 | }else{ 53 | return temp_ret; 54 | } 55 | } 56 | 57 | return m_Instance->QueryInterface(riid, ppvObj); 58 | } 59 | 60 | HRESULT CProxyIDirectDraw7::Proxy_CreateSurface(LPDDSURFACEDESC2 SurfaceDesc, 61 | LPDIRECTDRAWSURFACE7 FAR * CreatedSurface, IUnknown FAR * pUnkOuter) 62 | { 63 | DDSURFACEDESC2 OrgSurfaceDesc2 = *SurfaceDesc; 64 | 65 | DEBUG_LOGGING_MORE_DETAIL(("IDirectDraw7::CreateSurface() Desc.dwFlags = 0x%x", SurfaceDesc->dwFlags)); 66 | DEBUG_LOGGING_MORE_DETAIL(("DDSD_BACKBUFFERCOUNT = %x", DDSD_BACKBUFFERCOUNT)); 67 | HRESULT Result = m_Instance->CreateSurface(SurfaceDesc, CreatedSurface, pUnkOuter); 68 | if(FAILED(Result)) 69 | return Result; 70 | 71 | if(SurfaceDesc->dwFlags & DDSD_CAPS){ 72 | DDSCAPS2* Caps = &SurfaceDesc->ddsCaps; 73 | DEBUG_LOGGING_MORE_DETAIL((" Desc.ddsCaps.dwCaps = 0x%x", Caps->dwCaps)); 74 | if(Caps->dwCaps == DDSCAPS_BACKBUFFER){ 75 | DEBUG_LOGGING_MORE_DETAIL(("BackBuffer Surface")); 76 | } 77 | DEBUG_LOGGING_MORE_DETAIL(("%0x W %d H %d", *CreatedSurface, 78 | SurfaceDesc->dwWidth, 79 | SurfaceDesc->dwHeight 80 | )); 81 | if( Caps->dwCaps & DDSCAPS_PRIMARYSURFACE ){ 82 | *CreatedSurface = new CProxyIDirectDrawSurface7(*CreatedSurface); 83 | DEBUG_LOGGING_MORE_DETAIL(("Primary Surface = %0x", CreatedSurface)); 84 | PrimarySurfaceFlag = 1; 85 | }else 86 | if(Caps->dwCaps & DDSCAPS_3DDEVICE){ 87 | if(CooperativeLevel & DDSCL_FULLSCREEN && !PrimarySurfaceFlag){ 88 | DEBUG_LOGGING_MORE_DETAIL(("Hook the 3D Device Rendering Surface.")); 89 | DEBUG_LOGGING_MORE_DETAIL((" FullScreen Mode")); 90 | *CreatedSurface = new CProxyIDirectDrawSurface7(*CreatedSurface); 91 | 92 | //SetScreenSize( (int)SurfaceDesc->dwWidth , (int)SurfaceDesc->dwHeight ); 93 | 94 | }else{ 95 | DEBUG_LOGGING_MORE_DETAIL(("Hook the 3D Device Rendering Surface.")); 96 | DEBUG_LOGGING_MORE_DETAIL((" Window Mode")); 97 | TargetSurface = *CreatedSurface; 98 | 99 | //SetScreenSize( (int)SurfaceDesc->dwWidth , (int)SurfaceDesc->dwHeight ); 100 | } 101 | }else{ 102 | if(CooperativeLevel & DDSCL_FULLSCREEN){ 103 | if(Caps->dwCaps & DDSCAPS_BACKBUFFER){ 104 | DEBUG_LOGGING_MORE_DETAIL(("Hook Rendering Surface without 3D Device.")); 105 | DEBUG_LOGGING_MORE_DETAIL((" FullScreen Mode")); 106 | *CreatedSurface = new CProxyIDirectDrawSurface7(*CreatedSurface); 107 | } 108 | }else{ 109 | if(Caps->dwCaps & DDSCAPS_BACKBUFFER){ 110 | DEBUG_LOGGING_MORE_DETAIL(("Hook Rendering Surface without 3D Device.")); 111 | DEBUG_LOGGING_MORE_DETAIL((" Window Mode")); 112 | } 113 | } 114 | } 115 | } 116 | 117 | // 118 | return Result; 119 | 120 | } 121 | HRESULT CProxyIDirectDraw7::Proxy_GetDisplayMode(LPDDSURFACEDESC2 Desc) 122 | { 123 | DEBUG_LOGGING_MORE_DETAIL(("IDirectDraw7::GetDisplayMode()")); 124 | HRESULT Result = m_Instance->GetDisplayMode(Desc); 125 | if(FAILED(Result)) 126 | return Result; 127 | 128 | DWORD RefreshRate = Desc->dwRefreshRate; 129 | DEBUG_LOGGING_MORE_DETAIL((" RefreshRate = %d", Desc->dwRefreshRate)); 130 | if( RefreshRate == 0){ 131 | DEBUG_LOGGING_MORE_DETAIL((" RefreshRate = %d >> dummyset 100", Desc->dwRefreshRate)); 132 | RefreshRate = 100; 133 | } 134 | 135 | g_PerformanceCounter.SetMonitorRefreshRate( (int)RefreshRate ); 136 | 137 | return Result; 138 | } 139 | 140 | HRESULT CProxyIDirectDraw7::Proxy_SetCooperativeLevel(HWND hWnd, DWORD dwFlags) 141 | { 142 | DEBUG_LOGGING_MORE_DETAIL(("IDirectDraw7::SetCooperativeLevel() dwFlags = 0x%x", dwFlags)); 143 | if( g_pSharedData ){ 144 | g_pSharedData->g_hROWindow = hWnd; 145 | } 146 | if( g_pRoCodeBind )g_pRoCodeBind->InitWindowHandle(hWnd); 147 | 148 | DDSURFACEDESC2 dummy; 149 | dummy.dwSize = sizeof(DDSURFACEDESC2); 150 | Proxy_GetDisplayMode(&dummy); 151 | CooperativeLevel = dwFlags; 152 | return m_Instance->SetCooperativeLevel(hWnd, dwFlags); 153 | } 154 | 155 | HRESULT CProxyIDirectDraw7::Proxy_SetDisplayMode(DWORD p1, DWORD p2, DWORD p3, DWORD p4, DWORD p5) 156 | { 157 | DEBUG_LOGGING_MORE_DETAIL(("IDirectDraw7::SetDisplayMode()")); 158 | HRESULT Result = m_Instance->SetDisplayMode(p1, p2, p3, p4, p5); 159 | if(FAILED(Result)) 160 | return Result; 161 | 162 | DEBUG_LOGGING_MORE_DETAIL((" %d %d %d %d %d", p1, p2, p3, p4, p5)); 163 | 164 | DDSURFACEDESC2 Desc; 165 | ::ZeroMemory(&Desc, sizeof(Desc)); 166 | Desc.dwSize = sizeof(Desc); 167 | m_Instance->GetDisplayMode(&Desc); 168 | DEBUG_LOGGING_MORE_DETAIL((" RefreshRate = %d", Desc.dwRefreshRate)); 169 | DWORD RefreshRate = Desc.dwRefreshRate; 170 | if( RefreshRate == 0){ 171 | DEBUG_LOGGING_MORE_DETAIL((" RefreshRate = %d >> dummyset 100", Desc.dwRefreshRate)); 172 | RefreshRate = 100; 173 | } 174 | 175 | g_PerformanceCounter.SetMonitorRefreshRate( (int)RefreshRate ); 176 | 177 | return Result; 178 | } 179 | 180 | HRESULT CProxyIDirectDraw7::Proxy_WaitForVerticalBlank(DWORD dwFlags, HANDLE hEvent) 181 | { 182 | static double VSyncWaitTick = 0.0; 183 | 184 | // DEBUG_LOGGING_MORE_DETAIL(("IDirectDraw7::WaitForVerticalBlank() dwFlags = 0x%x hEvent = 0x%x", dwFlags, hEvent)); 185 | HRESULT result; 186 | 187 | g_PerformanceCounter.ModifiCounter(); 188 | if((CooperativeLevel & DDSCL_FULLSCREEN) == 0){ 189 | if( g_pSharedData && g_pSharedData->fix_windowmode_vsyncwait ){ 190 | Sleep( (DWORD)(( VSyncWaitTick * 950) / 1000) ); 191 | g_PerformanceCounter.InitInstaltPerformance(); 192 | result = m_Instance->WaitForVerticalBlank(dwFlags, hEvent); 193 | VSyncWaitTick = g_PerformanceCounter.CalcInstaltPerformance(); 194 | //result = m_Instance->WaitForVerticalBlank(dwFlags, hEvent); 195 | result = DD_OK; 196 | }else{ 197 | result = m_Instance->WaitForVerticalBlank(dwFlags, hEvent); 198 | } 199 | }else{ 200 | result = m_Instance->WaitForVerticalBlank(dwFlags, hEvent); 201 | } 202 | 203 | return result; 204 | } 205 | 206 | 207 | HRESULT CProxyIDirect3D7::Proxy_CreateDevice( REFCLSID rclsid,LPDIRECTDRAWSURFACE7 lpDDS,LPDIRECT3DDEVICE7 * lplpD3DDevice) 208 | { 209 | DEBUG_LOGGING_MORE_DETAIL(("CProxyIDirect3D7::CreateDevice2()")); 210 | HRESULT temp_ret = m_Instance->CreateDevice(rclsid,lpDDS,lplpD3DDevice); 211 | 212 | if(temp_ret == D3D_OK ){ 213 | void *ret_cProxy; 214 | ret_cProxy = new CProxyIDirect3DDevice7( (IDirect3DDevice7*) *lplpD3DDevice,lpDDS); 215 | *lplpD3DDevice = (LPDIRECT3DDEVICE7)ret_cProxy; 216 | return D3D_OK ; 217 | } 218 | return temp_ret; 219 | } 220 | 221 | void CProxyIDirect3DDevice7::Proxy_Release(void) 222 | { 223 | } 224 | 225 | HRESULT CProxyIDirect3DDevice7::Proxy_SetRenderState(THIS_ D3DRENDERSTATETYPE dwRenderStateType,DWORD dwRenderState) 226 | { 227 | //DEBUG_LOGGING_MORE_DETAIL(("CProxyIDirect3D7::Proxy_SetRenderState() type:%08X val:%08X",dwRenderStateType,dwRenderState)); 228 | if( dwRenderStateType == D3DRENDERSTATE_ZENABLE && dwRenderState == 0 ){ 229 | // 230 | // UI is drawn after the Zbuffer is disabled. 231 | // 232 | if( g_pRoCodeBind ) 233 | g_pRoCodeBind->DrawOn3DMap( m_Instance ); 234 | } 235 | return m_Instance->SetRenderState(dwRenderStateType,dwRenderState); 236 | } 237 | 238 | HRESULT CProxyIDirect3DDevice7::Proxy_BeginScene(void) 239 | { 240 | HRESULT result; 241 | if( m_firstonce ){ 242 | m_firstonce = false; 243 | if( g_pRoCodeBind )g_pRoCodeBind->Init( m_Instance ); 244 | } 245 | m_frameonce = TRUE; 246 | //DEBUG_LOGGING_MORE_DETAIL(("CProxyIDirect3D7::Proxy_BeginScene()")); 247 | 248 | result = m_Instance->BeginScene(); 249 | 250 | return result; 251 | } 252 | 253 | HRESULT CProxyIDirect3DDevice7::Proxy_EndScene(void) 254 | { 255 | g_PerformanceCounter.ModifiFrameRate(); 256 | if( g_pRoCodeBind ) 257 | g_pRoCodeBind->DrawSRHDebug( m_Instance ); 258 | 259 | return m_Instance->EndScene(); 260 | } 261 | 262 | -------------------------------------------------------------------------------- /Injection/Core/ro/map.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | struct CLightmap { 4 | unsigned char brightObj[3]; 5 | CTexture* surface; 6 | struct texCoor coor[4]; 7 | struct COLOR intensity[4]; 8 | }; 9 | 10 | 11 | struct CAttrCell { 12 | float h1; 13 | float h2; 14 | float h3; 15 | float h4; 16 | int flag; 17 | }; 18 | 19 | 20 | class C3dAttr : public CRes { 21 | public: 22 | int m_width; 23 | int m_height; 24 | int m_zoom; 25 | 26 | std::vector m_cells; 27 | 28 | C3dAttr(class C3dAttr&) {}; 29 | C3dAttr::C3dAttr(class Exemplar __formal, char* resid, char* baseDir) {}; 30 | C3dAttr::C3dAttr() {}; 31 | void Create(int w, int h) 32 | { 33 | m_cells.reserve( w * h ); 34 | } 35 | float C3dAttr::GetHeight( float x, float z) {}; 36 | 37 | int C3dAttr::GetAttr( float x, float z){ 38 | long cx,cy; 39 | ConvertToCellCoor(x,z,cx,cy); 40 | return m_cells[ cx + cy * m_width ].flag; 41 | }; 42 | 43 | struct CAttrCell* GetCell(int Cellx, int Celly) 44 | { 45 | return &m_cells[ Cellx + Celly * m_width ]; 46 | }; 47 | float C3dAttr::RayTest( struct ray3d& ray, int x, int y) {}; 48 | 49 | void C3dAttr::SetCellInfo( int Type, int Cellx, int Celly) 50 | { 51 | m_cells[ Cellx + Celly * m_width ].flag = Type; 52 | }; 53 | 54 | void C3dAttr::GetWorldPos( float attrX, float attrY, struct vector2d& pos) 55 | { 56 | pos.x = ((attrX - m_width / 2) * (float)m_zoom) + 2.5f; 57 | pos.y = ((attrY - m_height / 2) * (float)m_zoom) + 2.5f; 58 | }; 59 | void ConvertToCellCoor(float x, float z, long& cx, long& cy) 60 | { 61 | cx = (long)( x / m_zoom + m_width /2 ); 62 | cy = (long)( z / m_zoom + m_height /2 ); 63 | }; 64 | void C3dAttr::GetHeightMinMax( struct tagRECT& area, float& topHeight, float& bottomHeight) {}; 65 | class C3dAttr& operator=(class C3dAttr&) {}; 66 | 67 | virtual class CRes* C3dAttr::Clone() {}; 68 | virtual unsigned char C3dAttr::Load( char* fName) {}; 69 | virtual void C3dAttr::Reset() {}; 70 | virtual C3dAttr::~C3dAttr() {}; 71 | }; 72 | 73 | 74 | class CLightmapMgr { 75 | public: 76 | std::vector m_lightmaps; 77 | std::vector m_lmSurfaces; 78 | int m_numLightmaps; 79 | int m_numLmSurfaces; 80 | 81 | CLightmapMgr(class CLightmapMgr&) {}; 82 | CLightmapMgr::CLightmapMgr() {}; 83 | CLightmapMgr::~CLightmapMgr() {}; 84 | void CLightmapMgr::Create( class CGndRes* gnd) {}; 85 | void CLightmapMgr::Reset() {}; 86 | class CLightmapMgr& operator=(class CLightmapMgr&) {}; 87 | }; 88 | 89 | class C3dGround { 90 | public: 91 | class C3dAttr* m_attr; 92 | int m_width; 93 | int m_height; 94 | float m_zoom; 95 | CLightmapMgr m_lightmapMgr; 96 | int m_numSurfaces; 97 | float m_waterLevel; 98 | int m_texAnimCycle; 99 | int m_wavePitch; 100 | int m_waveSpeed; 101 | int m_waterSet; 102 | float m_waveHeight; 103 | CTexture* m_waterTex; 104 | CTexture* m_pBumpMap; 105 | int m_waterCnt; 106 | int m_waterOffset; 107 | int m_isNewVer; 108 | 109 | virtual ~C3dGround() {}; 110 | }; 111 | 112 | 113 | class C3dNode { 114 | struct ColorInfo { 115 | unsigned long color[3]; 116 | struct COLOR argb[3]; 117 | struct vector2d uv[3]; 118 | ColorInfo() {}; 119 | }; 120 | class C3dActor* m_master; 121 | void* m_mesh; //class C3dMesh* m_mesh; 122 | char m_name[128]; 123 | int m_numTexture; 124 | std::vector m_texture; 125 | float m_opacity; 126 | C3dNode* m_parent; 127 | std::list m_child; 128 | struct matrix m_ltm; 129 | C3dPosAnim m_posAnim; 130 | C3dRotAnim m_rotAnim; 131 | class C3dScaleAnim m_scaleAnim; 132 | class std::vector m_colorInfo; 133 | class std::vector m_destVertCol; 134 | int m_isAlphaForPlayer; 135 | struct C3dAABB m_aabb; 136 | 137 | virtual ~C3dNode() {}; 138 | }; 139 | 140 | 141 | class C3dActor { 142 | class C3dNode* m_node; 143 | char m_name[128]; 144 | struct vector3d m_pos; 145 | struct vector3d m_rot; 146 | struct vector3d m_scale; 147 | int m_shadeType; 148 | int m_curMotion; 149 | int m_animType; 150 | int m_animLen; 151 | float m_animSpeed; 152 | struct matrix m_wtm; 153 | struct matrix m_iwtm; 154 | struct vector3d m_posOffset; 155 | int m_isMatrixNeedUpdate; 156 | int m_isBbNeedUpdate; 157 | struct C3dOBB m_oBoundingBox; 158 | struct C3dAABB m_aaBoundingBox; 159 | int m_renderSignature; 160 | int m_isHideCheck; 161 | unsigned char m_isHalfAlpha; 162 | unsigned char m_fadeAlphaCnt; 163 | std::list m_volumeBoxList; 164 | int m_blockType; 165 | 166 | virtual ~C3dActor() {}; 167 | }; 168 | 169 | struct SceneGraphNode { 170 | struct SceneGraphNode* m_parent; 171 | struct SceneGraphNode* m_child[4]; 172 | struct C3dAABB m_aabb; 173 | struct vector3d m_center; 174 | struct vector3d m_halfSize; 175 | int m_needUpdate; 176 | std::vector m_actorList; 177 | C3dGround* m_ground; 178 | struct tagRECT m_groundArea; 179 | C3dAttr* m_attr; 180 | struct tagRECT m_attrArea; 181 | 182 | SceneGraphNode(struct SceneGraphNode&) {}; 183 | SceneGraphNode::SceneGraphNode() {}; 184 | SceneGraphNode::~SceneGraphNode() {}; 185 | void SceneGraphNode::Build( int level) {}; 186 | void SceneGraphNode::InsertObject( class C3dAttr* attr, int level) {}; 187 | void SceneGraphNode::InsertObject( class C3dGround* ground, int level) {}; 188 | void SceneGraphNode::InsertObject( class C3dActor* actor, int level) {}; 189 | void SceneGraphNode::RemoveObject( class C3dActor* actor, int level) {}; 190 | void SceneGraphNode::UpdateVolume( int level) {}; 191 | void SceneGraphNode::UpdateVolumeAfter( int level) {}; 192 | std::vector* SceneGraphNode::GetActorList( float x, float z, int level) {}; 193 | void SceneGraphNode::InsertObjectAfter( class C3dActor* actor, int level) {}; 194 | void SceneGraphNode::CopySceneGraph( int Level, struct SceneGraphNode* graph) {}; 195 | void SceneGraphNode::LoadSceneGraph( class CFile* fp, int Level) {}; 196 | struct SceneGraphNode& operator=(struct SceneGraphNode&) {}; 197 | }; 198 | 199 | class CViewFrustum { 200 | public: 201 | std::list m_cubeletListTotal; 202 | std::list m_cubeletListPartial; 203 | struct plane3d m_planes[6]; 204 | struct vector3d m_planeNormals[6]; 205 | 206 | CViewFrustum(class CViewFrustum&); 207 | CViewFrustum::CViewFrustum(); 208 | void CViewFrustum::Free(); 209 | void CViewFrustum::Build( float hratio, float vratio, struct matrix& viewMatrix, struct SceneGraphNode* rootNode); 210 | void CViewFrustum::CullSceneNode( struct SceneGraphNode* node, int level, unsigned char isTotallyInside); 211 | int CViewFrustum::CheckAABBIntersect( struct SceneGraphNode* node); 212 | int CViewFrustum::CheckOBBIntersect( struct C3dOBB& bb); 213 | class CViewFrustum& operator=(class CViewFrustum&); 214 | CViewFrustum::~CViewFrustum(); 215 | }; 216 | 217 | class CView { 218 | public: 219 | float m_sideQuake; 220 | float m_frontQuake; 221 | float m_latitudeQuake; 222 | unsigned char m_isFPSmode; 223 | int m_isQuake; 224 | unsigned long m_quakeStartTick; 225 | unsigned long m_QuakeTime; 226 | struct ViewInfo3d m_cur; 227 | struct ViewInfo3d m_dest; 228 | struct ViewInfo3d m_backupCur; 229 | struct ViewInfo3d m_backupDest; 230 | struct vector3d m_from; 231 | struct vector3d m_up; 232 | struct matrix m_viewMatrix; 233 | struct matrix m_invViewMatrix; 234 | class CViewFrustum m_viewFrustum; 235 | class CWorld* m_world; 236 | void* m_skyBox;//class CSkyBoxEllipse* m_skyBox; 237 | 238 | CView(class CView&) {}; 239 | CView::CView() {}; 240 | float GetCurLongitude() {}; 241 | float GetCurLatitude() {}; 242 | float GetCurDistance() {}; 243 | float GetDestLongitude() {}; 244 | float GetDestLatitude() {}; 245 | float GetDestDistance() {}; 246 | struct vector3d GetCurAt() {}; 247 | struct vector3d GetFrom() {}; 248 | struct matrix GetViewMatrix() {}; 249 | void SetDestLongitude(float) {}; 250 | void SetDestDistance(float) {}; 251 | void SetDestLatitude(float) {}; 252 | void SetDestAt(float, float, float) {}; 253 | void SetCurLongitude(float) {}; 254 | void SetCurDistance(float) {}; 255 | void SetCurLatitude(float) {}; 256 | void SetCurAt(float, float, float) {}; 257 | void AdjustDestLongitude(float) {}; 258 | void HoldAt() {}; 259 | void ResetLongitude(float) {}; 260 | void ResetLatitude(float) {}; 261 | void ResetDistance(float) {}; 262 | void ResetAt(float, float, float) {}; 263 | void PushCamera() {}; 264 | void PopCamera() {}; 265 | void CView::AddLongitude( float deltaLongitude) {}; 266 | void CView::AddLatitude( float deltaLatitude) {}; 267 | void CView::AddDistance( float deltaDistance) {}; 268 | void CView::SetQuake( int isQuake, int Type, float sideQuake, float frontQuake, float latitudeQuake) {}; 269 | void CView::SetQuakeInfo( float sideQuake, float frontQuake, float latitudeQuake) {}; 270 | void CView::GetEeyeVector( struct vector3d* eyeVector) {}; 271 | struct vector3d* GetEeyeFromVector() {}; 272 | unsigned char IsFPSmode() {}; 273 | void CView::InterpolateViewInfo() {}; 274 | void CView::ProcessQuake() {}; 275 | void CView::BuildViewMatrix() {}; 276 | class CView& operator=(class CView&) {}; 277 | 278 | virtual CView::~CView() {}; 279 | virtual void CView::OnEnterFrame() {}; 280 | virtual void CView::OnExitFrame() {}; 281 | virtual void CView::OnRender() {}; 282 | virtual void CView::OnCalcViewInfo() {}; 283 | }; 284 | 285 | class CWorld { 286 | public: 287 | class CMode* m_curMode; 288 | std::list m_gameObjectList; 289 | std::list m_actorList; 290 | std::list m_itemList; 291 | std::list m_skillList; 292 | C3dGround* m_ground; 293 | CPlayer* m_player; 294 | C3dAttr* m_attr; 295 | std::vector m_bgObjList; 296 | long m_bgObjCount; 297 | long m_bgObjThread; 298 | int m_isPKZone; 299 | int m_isSiegeMode; 300 | int m_isBattleFieldMode; 301 | int m_isEventPVPMode; 302 | struct SceneGraphNode m_rootNode; 303 | struct SceneGraphNode* m_Calculated; 304 | 305 | virtual ~CWorld() {}; 306 | }; 307 | 308 | -------------------------------------------------------------------------------- /Injection/Core/ro/unit.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | struct texCoor { 4 | float u; 5 | float v; 6 | void Set(float _u, float _v) { u=_u;v=_v; }; 7 | }; 8 | 9 | struct ColorCellPos { 10 | int x; 11 | int y; 12 | unsigned long color; 13 | }; 14 | 15 | struct ColorCellPos2 { 16 | int x; 17 | int y; 18 | int type; 19 | unsigned long color; 20 | unsigned long startTime; 21 | }; 22 | 23 | struct CAttachPointInfo { 24 | int x; 25 | int y; 26 | int m_attr; 27 | }; 28 | 29 | struct ChatRoomInfo { 30 | std::basic_string title; 31 | std::basic_string pass; 32 | int roomType; 33 | int numPeople; 34 | int maxNumPeople; 35 | int roomId; 36 | 37 | ChatRoomInfo(struct ChatRoomInfo&) {}; 38 | ChatRoomInfo() {}; 39 | struct ChatRoomInfo& operator=(struct ChatRoomInfo&) {}; 40 | ChatRoomInfo::~ChatRoomInfo() {}; 41 | }; 42 | 43 | struct NamePair { 44 | std::basic_string cName; 45 | std::basic_string pName; 46 | std::basic_string gName; 47 | std::basic_string rName; 48 | 49 | void Clear() {}; 50 | unsigned char IsEmpty() {}; 51 | NamePair::NamePair( struct NamePair& __that) {}; 52 | NamePair::NamePair() {}; 53 | struct NamePair& operator=(struct NamePair&) {}; 54 | NamePair::~NamePair() {}; 55 | }; 56 | 57 | 58 | struct vector2d { 59 | float x; 60 | float y; 61 | 62 | vector2d(float, float){}; 63 | vector2d() : x(.0f),y(.0f) {}; 64 | void Set(float, float){}; 65 | void Normalize() {}; 66 | }; 67 | 68 | 69 | 70 | struct vector3d { 71 | float x; 72 | float y; 73 | float z; 74 | 75 | vector3d::vector3d(float nx, float ny, float nz) : x(nx),y(ny),z(nz) {}; 76 | vector3d::vector3d() : x(.0f),y(.0f),z(.0f) {}; 77 | void Set(float nx, float ny, float nz) { x=nx;y=ny;z=nz; }; 78 | 79 | void MatrixMult(struct vector3d&, struct matrix&); 80 | 81 | void CrossProduct(struct vector3d& u, struct vector3d& v) 82 | { 83 | x = u.y * v.z - u.z * v.y; 84 | y = u.z * v.x - u.x * v.z; 85 | z = u.x * v.y - u.y * v.x; 86 | }; 87 | void Normalize() 88 | { 89 | float v = Magnitude(); 90 | x /= v; 91 | y /= v; 92 | z /= v; 93 | }; 94 | float Magnitude() 95 | { 96 | return pow( x*x + y*y + z*z , 0.5f ); 97 | //return sqrl( x*x + y*y + z*z ); 98 | }; 99 | float Angle(struct vector3d&) {}; 100 | float DotProduct(struct vector3d& v) 101 | { 102 | return (x * v.x + y * v.y + z * v.z); 103 | }; 104 | void vector3d::MATRIX_TO_VECTOR(struct matrix& dir) {}; 105 | 106 | struct vector3d& vector3d::operator=(struct vector3d& rhs) 107 | { 108 | this->x = rhs.x; 109 | this->y = rhs.y; 110 | this->z = rhs.z; 111 | return *this; 112 | }; 113 | struct vector3d& operator+=(struct vector3d& v) 114 | { 115 | this->x += v.x; 116 | this->y += v.y; 117 | this->z += v.z; 118 | return *this; 119 | }; 120 | struct vector3d& operator-=(struct vector3d& v) 121 | { 122 | this->x -= v.x; 123 | this->y -= v.y; 124 | this->z -= v.z; 125 | return *this; 126 | }; 127 | struct vector3d& operator*=(float& v) 128 | { 129 | this->x *= v; 130 | this->y *= v; 131 | this->z *= v; 132 | return *this; 133 | }; 134 | struct vector3d operator*(float& v) { 135 | this->x *= v; 136 | this->y *= v; 137 | this->z *= v; 138 | return *this; 139 | }; 140 | }; 141 | 142 | struct matrix { 143 | float v11; 144 | float v12; 145 | float v13; 146 | float v21; 147 | float v22; 148 | float v23; 149 | float v31; 150 | float v32; 151 | float v33; 152 | float v41; 153 | float v42; 154 | float v43; 155 | 156 | void SetRow1(float, float, float) {}; 157 | void SetRow2(float, float, float) {}; 158 | void SetRow3(float, float, float) {}; 159 | void SetRow4(float, float, float) {}; 160 | void MakeIdentity() {}; 161 | void matrix::MakeInverse( struct matrix& src) {}; 162 | void MakeTranslate(struct vector3d&) {}; 163 | void matrix::MakeTranslate( float x, float y, float z) {}; 164 | void matrix::MakeXRotation( float angle) {}; 165 | void matrix::MakeYRotation( float angle) {}; 166 | void matrix::MakeZRotation( float angle) {}; 167 | void matrix::MakeScale( float x, float y, float z) {}; 168 | void matrix::AppendTranslate( struct vector3d& v) {}; 169 | void matrix::AppendXRotation( float angle) {}; 170 | void matrix::AppendYRotation( float angle) {}; 171 | void matrix::AppendZRotation( float angle) {}; 172 | void matrix::AppendScale( float x, float y, float z) {}; 173 | void matrix::PrependTranslate( struct vector3d& v) {}; 174 | void PrependScale(float*) {}; 175 | void matrix::PrependScale( float x, float y, float z) {}; 176 | void matrix::MakeTransform( struct rotKeyframe& ani) {}; 177 | void matrix::MakeTransform( float* rotaxis, float rotangle) {}; 178 | void matrix::MakeTransform( struct vector3d& pos, float* rotaxis, float rotangle) {}; 179 | void matrix::MakeView( struct vector3d& from, struct vector3d& at, struct vector3d& world_up) {}; 180 | void matrix::MultMatrix( struct matrix& a, struct matrix& b) {}; 181 | int matrix::IsIdentity() { return 0;}; 182 | void matrix::VECTOR_TO_VIEW( struct vector3d& base, struct vector3d& point, struct vector3d& up, struct vector3d& right) {}; 183 | void matrix::VIEW_MATRIX( struct vector3d& base, struct vector3d& point, int roll) {}; 184 | void matrix::VECTOR_TO_REV_VIEW( struct vector3d& base, struct vector3d& point, struct vector3d& up, struct vector3d& right) {}; 185 | void matrix::REV_VIEW_MATRIX( struct vector3d& base, struct vector3d& point, int roll) {}; 186 | void matrix::VECTOR_TO_MATRIX( struct vector3d& view_dir) {}; 187 | void matrix::NORMALIZE_SCALE( struct matrix& sour) {}; 188 | void matrix::REVERSE_MATRIX( struct matrix& sour) {}; 189 | void matrix::UPVECTOR_TO_MATRIX( struct vector3d up) {}; 190 | }; 191 | 192 | struct plane3d { 193 | float x; 194 | float y; 195 | float z; 196 | float w; 197 | plane3d(float, float, float, float) {}; 198 | plane3d() {}; 199 | void Set(float, float, float, float) {}; 200 | void MatrixMult(struct matrix&, struct plane3d&) {}; 201 | }; 202 | 203 | struct tlvertex3d { 204 | float x; 205 | float y; 206 | float z; 207 | float oow; 208 | union { 209 | unsigned long color; 210 | struct COLOR argb; 211 | }; 212 | unsigned long specular; 213 | union { 214 | struct { 215 | float tu; 216 | float tv; 217 | }; 218 | struct texCoor coord; 219 | }; 220 | 221 | tlvertex3d(float, float, float, float, unsigned long, unsigned long, float, float) {}; 222 | tlvertex3d::tlvertex3d() {}; 223 | }; 224 | 225 | struct ViewInfo3d { 226 | struct vector3d at; 227 | float latitude; 228 | float longitude; 229 | float distance; 230 | 231 | ViewInfo3d() {}; 232 | struct ViewInfo3d& operator=(struct ViewInfo3d&) {}; 233 | }; 234 | 235 | struct CellPos { 236 | int x; 237 | int y; 238 | }; 239 | 240 | struct C3dAABB { 241 | struct vector3d min; 242 | struct vector3d max; 243 | 244 | C3dAABB() {}; 245 | struct C3dAABB& operator=(struct C3dAABB&) {}; 246 | }; 247 | 248 | struct C3dOBB { 249 | struct vector3d halfSize; 250 | struct vector3d center; 251 | struct vector3d u; 252 | struct vector3d v; 253 | struct vector3d w; 254 | struct vector3d vertices[8]; 255 | 256 | C3dOBB() {}; 257 | struct C3dOBB& operator=(struct C3dOBB&) {}; 258 | }; 259 | 260 | struct CVolumeBox { 261 | struct vector3d m_size; 262 | struct vector3d m_pos; 263 | struct vector3d m_rot; 264 | struct vector3d m_worldVert[8]; 265 | struct matrix m_vtm; 266 | struct matrix m_ivtm; 267 | int flag; 268 | 269 | CVolumeBox() {}; 270 | struct CVolumeBox& operator=(struct CVolumeBox&) {}; 271 | }; 272 | 273 | 274 | struct posKeyframe { 275 | int frame; 276 | float px; 277 | float py; 278 | float pz; 279 | 280 | posKeyframe(int, float, float, float) {}; 281 | posKeyframe() {}; 282 | void posKeyframe::Slerp( float t, struct posKeyframe& start, struct posKeyframe& end) {}; 283 | }; 284 | 285 | struct scaleKeyframe { 286 | int frame; 287 | float sx; 288 | float sy; 289 | float sz; 290 | float qx; 291 | float qy; 292 | float qz; 293 | float qw; 294 | 295 | scaleKeyframe(int, float, float, float, float, float, float, float) {}; 296 | scaleKeyframe() {}; 297 | void scaleKeyframe::Slerp( float t, struct scaleKeyframe& start, struct scaleKeyframe& end, int spin) {}; 298 | }; 299 | 300 | struct rotKeyframe { 301 | int frame; 302 | float qx; 303 | float qy; 304 | float qz; 305 | float qw; 306 | 307 | rotKeyframe(int, float, float, float, float) {}; 308 | rotKeyframe() {}; 309 | void rotKeyframe::Slerp( float t, struct rotKeyframe& start, struct rotKeyframe& end, int spin) {}; 310 | }; 311 | 312 | class C3dPosAnim { 313 | std::vector m_animdata; 314 | }; 315 | class C3dScaleAnim { 316 | std::vector m_animdata; 317 | }; 318 | class C3dRotAnim { 319 | std::vector m_animdata; 320 | }; 321 | 322 | struct TeiEffect { 323 | char life; 324 | short alphaB; 325 | short alphaT; 326 | short full_display_angle; 327 | float max_height; 328 | int process; 329 | short RotStart; 330 | float height[21]; 331 | char flag1[21]; 332 | short rise_angle; 333 | float distance; 334 | struct vector3d vecB_now; 335 | struct vector3d vecT_now; 336 | struct vector3d vecB_pre; 337 | struct vector3d vecT_pre; 338 | 339 | TeiEffect() {}; 340 | struct TeiEffect& operator=(struct TeiEffect&) {}; 341 | }; 342 | 343 | struct PrimSegment { 344 | struct vector3d pos; 345 | struct vector3d segPos[4]; 346 | float radius; 347 | float size; 348 | float longitude; 349 | struct matrix mat; 350 | int red; 351 | int green; 352 | int blue; 353 | float alpha; 354 | unsigned long argb; 355 | 356 | PrimSegment() {}; 357 | struct PrimSegment& operator=(struct PrimSegment&) {}; 358 | }; 359 | 360 | 361 | struct PathCell { 362 | int x; 363 | int y; 364 | int dir; 365 | unsigned long time; 366 | }; 367 | 368 | class CPathInfo { 369 | public: 370 | std::vector m_pathData; 371 | int m_startCell; 372 | float m_startPointX; 373 | float m_startPointY; 374 | 375 | CPathInfo() {}; 376 | }; 377 | 378 | struct _MSG2AI { 379 | int command; 380 | int x; 381 | int y; 382 | int skillLevel; 383 | int skillID; 384 | unsigned long targetID; 385 | 386 | _MSG2AI::_MSG2AI() { Init(); }; 387 | void Init() {}; 388 | }; 389 | -------------------------------------------------------------------------------- /SimpleROHookCS/SRHAboutBox.Designer.cs: -------------------------------------------------------------------------------- 1 | namespace SimpleROHookCS 2 | { 3 | partial class SRHAboutBox 4 | { 5 | /// 6 | /// 必要なデザイナー変数です。 7 | /// 8 | private System.ComponentModel.IContainer components = null; 9 | 10 | /// 11 | /// 使用中のリソースをすべてクリーンアップします。 12 | /// 13 | protected override void Dispose(bool disposing) 14 | { 15 | if (disposing && (components != null)) 16 | { 17 | components.Dispose(); 18 | } 19 | base.Dispose(disposing); 20 | } 21 | 22 | #region Windows フォーム デザイナーで生成されたコード 23 | 24 | /// 25 | /// デザイナー サポートに必要なメソッドです。このメソッドの内容を 26 | /// コード エディターで変更しないでください。 27 | /// 28 | private void InitializeComponent() 29 | { 30 | System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(SRHAboutBox)); 31 | this.tableLayoutPanel = new System.Windows.Forms.TableLayoutPanel(); 32 | this.logoPictureBox = new System.Windows.Forms.PictureBox(); 33 | this.labelProductName = new System.Windows.Forms.Label(); 34 | this.labelVersion = new System.Windows.Forms.Label(); 35 | this.labelCopyright = new System.Windows.Forms.Label(); 36 | this.labelCompanyName = new System.Windows.Forms.Label(); 37 | this.textBoxDescription = new System.Windows.Forms.TextBox(); 38 | this.okButton = new System.Windows.Forms.Button(); 39 | this.tableLayoutPanel.SuspendLayout(); 40 | ((System.ComponentModel.ISupportInitialize)(this.logoPictureBox)).BeginInit(); 41 | this.SuspendLayout(); 42 | // 43 | // tableLayoutPanel 44 | // 45 | this.tableLayoutPanel.ColumnCount = 2; 46 | this.tableLayoutPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 33F)); 47 | this.tableLayoutPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 67F)); 48 | this.tableLayoutPanel.Controls.Add(this.logoPictureBox, 0, 0); 49 | this.tableLayoutPanel.Controls.Add(this.labelProductName, 1, 0); 50 | this.tableLayoutPanel.Controls.Add(this.labelVersion, 1, 1); 51 | this.tableLayoutPanel.Controls.Add(this.labelCopyright, 1, 2); 52 | this.tableLayoutPanel.Controls.Add(this.labelCompanyName, 1, 3); 53 | this.tableLayoutPanel.Controls.Add(this.textBoxDescription, 1, 4); 54 | this.tableLayoutPanel.Controls.Add(this.okButton, 1, 5); 55 | this.tableLayoutPanel.Dock = System.Windows.Forms.DockStyle.Fill; 56 | this.tableLayoutPanel.Location = new System.Drawing.Point(9, 8); 57 | this.tableLayoutPanel.Name = "tableLayoutPanel"; 58 | this.tableLayoutPanel.RowCount = 6; 59 | this.tableLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 10F)); 60 | this.tableLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 10F)); 61 | this.tableLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 10F)); 62 | this.tableLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 10F)); 63 | this.tableLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 50F)); 64 | this.tableLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 10F)); 65 | this.tableLayoutPanel.Size = new System.Drawing.Size(417, 245); 66 | this.tableLayoutPanel.TabIndex = 0; 67 | // 68 | // logoPictureBox 69 | // 70 | this.logoPictureBox.Dock = System.Windows.Forms.DockStyle.Fill; 71 | this.logoPictureBox.Image = ((System.Drawing.Image)(resources.GetObject("logoPictureBox.Image"))); 72 | this.logoPictureBox.Location = new System.Drawing.Point(3, 3); 73 | this.logoPictureBox.Name = "logoPictureBox"; 74 | this.tableLayoutPanel.SetRowSpan(this.logoPictureBox, 6); 75 | this.logoPictureBox.Size = new System.Drawing.Size(131, 239); 76 | this.logoPictureBox.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage; 77 | this.logoPictureBox.TabIndex = 12; 78 | this.logoPictureBox.TabStop = false; 79 | // 80 | // labelProductName 81 | // 82 | this.labelProductName.Dock = System.Windows.Forms.DockStyle.Fill; 83 | this.labelProductName.Location = new System.Drawing.Point(143, 0); 84 | this.labelProductName.Margin = new System.Windows.Forms.Padding(6, 0, 3, 0); 85 | this.labelProductName.MaximumSize = new System.Drawing.Size(0, 16); 86 | this.labelProductName.Name = "labelProductName"; 87 | this.labelProductName.Size = new System.Drawing.Size(271, 16); 88 | this.labelProductName.TabIndex = 19; 89 | this.labelProductName.Text = "製品名"; 90 | this.labelProductName.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; 91 | // 92 | // labelVersion 93 | // 94 | this.labelVersion.Dock = System.Windows.Forms.DockStyle.Fill; 95 | this.labelVersion.Location = new System.Drawing.Point(143, 24); 96 | this.labelVersion.Margin = new System.Windows.Forms.Padding(6, 0, 3, 0); 97 | this.labelVersion.MaximumSize = new System.Drawing.Size(0, 16); 98 | this.labelVersion.Name = "labelVersion"; 99 | this.labelVersion.Size = new System.Drawing.Size(271, 16); 100 | this.labelVersion.TabIndex = 0; 101 | this.labelVersion.Text = "バージョン"; 102 | this.labelVersion.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; 103 | // 104 | // labelCopyright 105 | // 106 | this.labelCopyright.Dock = System.Windows.Forms.DockStyle.Fill; 107 | this.labelCopyright.Location = new System.Drawing.Point(143, 48); 108 | this.labelCopyright.Margin = new System.Windows.Forms.Padding(6, 0, 3, 0); 109 | this.labelCopyright.MaximumSize = new System.Drawing.Size(0, 16); 110 | this.labelCopyright.Name = "labelCopyright"; 111 | this.labelCopyright.Size = new System.Drawing.Size(271, 16); 112 | this.labelCopyright.TabIndex = 21; 113 | this.labelCopyright.Text = "著作権"; 114 | this.labelCopyright.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; 115 | // 116 | // labelCompanyName 117 | // 118 | this.labelCompanyName.Dock = System.Windows.Forms.DockStyle.Fill; 119 | this.labelCompanyName.Location = new System.Drawing.Point(143, 72); 120 | this.labelCompanyName.Margin = new System.Windows.Forms.Padding(6, 0, 3, 0); 121 | this.labelCompanyName.MaximumSize = new System.Drawing.Size(0, 16); 122 | this.labelCompanyName.Name = "labelCompanyName"; 123 | this.labelCompanyName.Size = new System.Drawing.Size(271, 16); 124 | this.labelCompanyName.TabIndex = 22; 125 | this.labelCompanyName.Text = "会社名"; 126 | this.labelCompanyName.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; 127 | // 128 | // textBoxDescription 129 | // 130 | this.textBoxDescription.Dock = System.Windows.Forms.DockStyle.Fill; 131 | this.textBoxDescription.Location = new System.Drawing.Point(143, 99); 132 | this.textBoxDescription.Margin = new System.Windows.Forms.Padding(6, 3, 3, 3); 133 | this.textBoxDescription.Multiline = true; 134 | this.textBoxDescription.Name = "textBoxDescription"; 135 | this.textBoxDescription.ReadOnly = true; 136 | this.textBoxDescription.ScrollBars = System.Windows.Forms.ScrollBars.Both; 137 | this.textBoxDescription.Size = new System.Drawing.Size(271, 116); 138 | this.textBoxDescription.TabIndex = 23; 139 | this.textBoxDescription.TabStop = false; 140 | this.textBoxDescription.Text = "説明"; 141 | // 142 | // okButton 143 | // 144 | this.okButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); 145 | this.okButton.DialogResult = System.Windows.Forms.DialogResult.Cancel; 146 | this.okButton.Location = new System.Drawing.Point(339, 221); 147 | this.okButton.Name = "okButton"; 148 | this.okButton.Size = new System.Drawing.Size(75, 21); 149 | this.okButton.TabIndex = 24; 150 | this.okButton.Text = "&OK"; 151 | // 152 | // SRHAboutBox 153 | // 154 | this.AcceptButton = this.okButton; 155 | this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F); 156 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; 157 | this.ClientSize = new System.Drawing.Size(435, 261); 158 | this.Controls.Add(this.tableLayoutPanel); 159 | this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog; 160 | this.MaximizeBox = false; 161 | this.MinimizeBox = false; 162 | this.Name = "SRHAboutBox"; 163 | this.Padding = new System.Windows.Forms.Padding(9, 8, 9, 8); 164 | this.ShowIcon = false; 165 | this.ShowInTaskbar = false; 166 | this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; 167 | this.Text = "SRHAboutBox"; 168 | this.tableLayoutPanel.ResumeLayout(false); 169 | this.tableLayoutPanel.PerformLayout(); 170 | ((System.ComponentModel.ISupportInitialize)(this.logoPictureBox)).EndInit(); 171 | this.ResumeLayout(false); 172 | 173 | } 174 | 175 | #endregion 176 | 177 | private System.Windows.Forms.TableLayoutPanel tableLayoutPanel; 178 | private System.Windows.Forms.PictureBox logoPictureBox; 179 | private System.Windows.Forms.Label labelProductName; 180 | private System.Windows.Forms.Label labelVersion; 181 | private System.Windows.Forms.Label labelCopyright; 182 | private System.Windows.Forms.Label labelCompanyName; 183 | private System.Windows.Forms.TextBox textBoxDescription; 184 | private System.Windows.Forms.Button okButton; 185 | } 186 | } 187 | -------------------------------------------------------------------------------- /Injection/Injection.vcxproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Debug 6 | Win32 7 | 8 | 9 | Release-bRO 10 | Win32 11 | 12 | 13 | Release-jRO 14 | Win32 15 | 16 | 17 | Release-iRO 18 | Win32 19 | 20 | 21 | 22 | {46651709-BCBF-4645-8CE6-11EBA347A529} 23 | Win32Proj 24 | Injection 25 | Injection 26 | 27 | 28 | 29 | DynamicLibrary 30 | true 31 | MultiByte 32 | Static 33 | 34 | 35 | DynamicLibrary 36 | false 37 | true 38 | MultiByte 39 | v100 40 | 41 | 42 | DynamicLibrary 43 | false 44 | true 45 | MultiByte 46 | v100 47 | 48 | 49 | DynamicLibrary 50 | false 51 | true 52 | MultiByte 53 | v100 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | true 73 | ./;$(DXSDK_AUG07_DIR)Include;$(IncludePath) 74 | $(DXSDK_AUG07_DIR)Lib\x86;$(LibraryPath) 75 | 76 | 77 | false 78 | ./;$(DXSDK_AUG07_DIR)Include;$(IncludePath) 79 | $(DXSDK_AUG07_DIR)Lib\x86;$(LibraryPath) 80 | 81 | 82 | false 83 | ./;$(DXSDK_AUG07_DIR)Include;$(IncludePath) 84 | $(DXSDK_AUG07_DIR)Lib\x86;$(LibraryPath) 85 | 86 | 87 | false 88 | ./;$(DXSDK_AUG07_DIR)Include;$(IncludePath) 89 | $(DXSDK_AUG07_DIR)Lib\x86;$(LibraryPath) 90 | 91 | 92 | 93 | Use 94 | Level3 95 | Disabled 96 | WIN32;_DEBUG;_WINDOWS;_USRDLL;INJECTION_EXPORTS;%(PreprocessorDefinitions) 97 | stdafx.h;%(ForcedIncludeFiles) 98 | 99 | 100 | Windows 101 | true 102 | %(AdditionalDependencies) 103 | 104 | 105 | 106 | 107 | Level3 108 | Use 109 | MaxSpeed 110 | true 111 | true 112 | WIN32;NDEBUG;_WINDOWS;_USRDLL;INJECTION_EXPORTS;USE_WS2_32DLLINJECTION;%(PreprocessorDefinitions) 113 | stdafx.h;%(ForcedIncludeFiles) 114 | 115 | 116 | Windows 117 | true 118 | true 119 | true 120 | %(AdditionalDependencies) 121 | 122 | 123 | 124 | 125 | 126 | 127 | Level3 128 | Use 129 | MaxSpeed 130 | true 131 | true 132 | WIN32;NDEBUG;_WINDOWS;_USRDLL;INJECTION_EXPORTS;BRO_CLIENT_STRUCTURE;USE_GAMEOBJ_COUNTER;%(PreprocessorDefinitions) 133 | stdafx.h;%(ForcedIncludeFiles) 134 | 135 | 136 | Windows 137 | true 138 | true 139 | true 140 | %(AdditionalDependencies) 141 | 142 | 143 | 144 | 145 | 146 | 147 | Level3 148 | Use 149 | MaxSpeed 150 | true 151 | true 152 | WIN32;NDEBUG;_WINDOWS;_USRDLL;INJECTION_EXPORTS;JRO_CLIENT_STRUCTURE;USE_GAMEOBJ_COUNTER;%(PreprocessorDefinitions) 153 | stdafx.h;%(ForcedIncludeFiles) 154 | 155 | 156 | Windows 157 | true 158 | true 159 | true 160 | %(AdditionalDependencies) 161 | 162 | 163 | 164 | 165 | 166 | 167 | 168 | 169 | 170 | 171 | 172 | 173 | 174 | 175 | 176 | 177 | 178 | 179 | 180 | 181 | 182 | 183 | 184 | 185 | 186 | 187 | 188 | 189 | 190 | 191 | 192 | 193 | 194 | 195 | 196 | 197 | 198 | false 199 | 200 | 201 | false 202 | false 203 | false 204 | 205 | 206 | 207 | 208 | 209 | 210 | 211 | 212 | 213 | 214 | 215 | 216 | 217 | Create 218 | Create 219 | Create 220 | Create 221 | 222 | 223 | 224 | 225 | 226 | 227 | 228 | 229 | 230 | -------------------------------------------------------------------------------- /Injection/ProxyIDirectDraw.h: -------------------------------------------------------------------------------- 1 | #include "ProxyHelper.h" 2 | 3 | #define CLASSNAME "IDirectDraw7" 4 | class CProxyIDirectDraw7 : public IDirectDraw7{ 5 | private: 6 | IDirectDraw7* m_Instance; 7 | DWORD CooperativeLevel; 8 | DWORD PrimarySurfaceFlag; 9 | IDirectDrawSurface7* TargetSurface; 10 | public: 11 | static CProxyIDirectDraw7* lpthis; 12 | 13 | CProxyIDirectDraw7(IDirectDraw7* ptr); 14 | ~CProxyIDirectDraw7(); 15 | 16 | static CProxyIDirectDraw7* getLPProxyIDirectDraw7(void){return lpthis;}; 17 | void setThis(CProxyIDirectDraw7* _lpthis){lpthis = _lpthis;}; 18 | 19 | /*** IUnknown methods ***/ 20 | STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID FAR * ppvObj) 21 | { 22 | return Proxy_QueryInterface(riid, ppvObj); 23 | } 24 | STDMETHOD_(ULONG,AddRef) (THIS) PROXY0(AddRef) 25 | STDMETHOD_(ULONG,Release) (THIS) 26 | { 27 | return Proxy_Release(); 28 | } 29 | 30 | /*** IDirectDraw methods ***/ 31 | STDMETHOD(Compact)(THIS) PROXY0(Compact) 32 | STDMETHOD(CreateClipper)(THIS_ DWORD p1, LPDIRECTDRAWCLIPPER FAR* p2, IUnknown FAR * p3) PROXY3(CreateClipper) 33 | STDMETHOD(CreatePalette)(THIS_ DWORD p1, LPPALETTEENTRY p2, LPDIRECTDRAWPALETTE FAR* p3, IUnknown FAR * p4) PROXY4(CreatePalette) 34 | STDMETHOD(CreateSurface)(THIS_ LPDDSURFACEDESC2 p1, LPDIRECTDRAWSURFACE7 FAR * p2, IUnknown FAR * p3) 35 | { 36 | return Proxy_CreateSurface(p1, p2, p3); 37 | } 38 | STDMETHOD(DuplicateSurface)( THIS_ LPDIRECTDRAWSURFACE7 p1, LPDIRECTDRAWSURFACE7 FAR * p2) PROXY2(DuplicateSurface) 39 | STDMETHOD(EnumDisplayModes)( THIS_ DWORD p1, LPDDSURFACEDESC2 p2, LPVOID p3, LPDDENUMMODESCALLBACK2 p4) PROXY4(EnumDisplayModes) 40 | STDMETHOD(EnumSurfaces)(THIS_ DWORD p1, LPDDSURFACEDESC2 p2, LPVOID p3, LPDDENUMSURFACESCALLBACK7 p4) PROXY4(EnumSurfaces) 41 | STDMETHOD(FlipToGDISurface)(THIS) PROXY0(FlipToGDISurface) 42 | STDMETHOD(GetCaps)( THIS_ LPDDCAPS p1, LPDDCAPS p2) PROXY2(GetCaps) 43 | STDMETHOD(GetDisplayMode)( THIS_ LPDDSURFACEDESC2 p1) 44 | { 45 | return Proxy_GetDisplayMode(p1); 46 | } 47 | STDMETHOD(GetFourCCCodes)(THIS_ LPDWORD p1, LPDWORD p2) PROXY2(GetFourCCCodes) 48 | STDMETHOD(GetGDISurface)(THIS_ LPDIRECTDRAWSURFACE7 FAR * p1) PROXY1(GetGDISurface) 49 | STDMETHOD(GetMonitorFrequency)(THIS_ LPDWORD p1) PROXY1(GetMonitorFrequency) 50 | STDMETHOD(GetScanLine)(THIS_ LPDWORD p1) PROXY1(GetScanLine) 51 | STDMETHOD(GetVerticalBlankStatus)(THIS_ LPBOOL p1) PROXY1(GetVerticalBlankStatus) 52 | STDMETHOD(Initialize)(THIS_ GUID FAR * p1) PROXY1(Initialize) 53 | STDMETHOD(RestoreDisplayMode)(THIS) PROXY0(RestoreDisplayMode) 54 | STDMETHOD(SetCooperativeLevel)(THIS_ HWND p1, DWORD p2) 55 | { 56 | return Proxy_SetCooperativeLevel(p1, p2); 57 | } 58 | STDMETHOD(SetDisplayMode)(THIS_ DWORD p1, DWORD p2, DWORD p3, DWORD p4, DWORD p5) { return Proxy_SetDisplayMode(p1, p2, p3, p4, p5); } 59 | STDMETHOD(WaitForVerticalBlank)(THIS_ DWORD p1, HANDLE p2) 60 | { 61 | return Proxy_WaitForVerticalBlank(p1, p2); 62 | } 63 | 64 | /*** Added in the v2 interface ***/ 65 | STDMETHOD(GetAvailableVidMem)(THIS_ LPDDSCAPS2 p1, LPDWORD p2, LPDWORD p3) PROXY3(GetAvailableVidMem) 66 | /*** Added in the V4 Interface ***/ 67 | STDMETHOD(GetSurfaceFromDC) (THIS_ HDC p1, LPDIRECTDRAWSURFACE7 * p2) PROXY2(GetSurfaceFromDC) 68 | STDMETHOD(RestoreAllSurfaces)(THIS) 69 | { 70 | return Proxy_RestoreAllSurfaces(); 71 | } 72 | STDMETHOD(TestCooperativeLevel)(THIS) PROXY0(TestCooperativeLevel) 73 | STDMETHOD(GetDeviceIdentifier)(THIS_ LPDDDEVICEIDENTIFIER2 p1, DWORD p2) PROXY2(GetDeviceIdentifier) 74 | /*** Added in the V7 Interface ***/ 75 | STDMETHOD(StartModeTest)(THIS_ LPSIZE p1, DWORD p2, DWORD p3) PROXY3(StartModeTest) 76 | STDMETHOD(EvaluateMode)(THIS_ DWORD p1, DWORD * p2) PROXY2(EvaluateMode) 77 | 78 | 79 | // 80 | // Proxy Functions 81 | // 82 | ULONG Proxy_Release(void); 83 | HRESULT Proxy_CreateSurface(LPDDSURFACEDESC2 p1, LPDIRECTDRAWSURFACE7 FAR * p2, IUnknown FAR * p3); 84 | HRESULT Proxy_GetDisplayMode(LPDDSURFACEDESC2 p1); 85 | HRESULT Proxy_SetCooperativeLevel(HWND p1, DWORD p2); 86 | HRESULT Proxy_SetDisplayMode(DWORD p1, DWORD p2, DWORD p3, DWORD p4, DWORD p5); 87 | HRESULT Proxy_WaitForVerticalBlank(DWORD dwFlags, HANDLE hEvent); 88 | HRESULT Proxy_QueryInterface(THIS_ REFIID riid, LPVOID FAR * ppvObj); 89 | HRESULT Proxy_RestoreAllSurfaces(void); 90 | }; 91 | #undef CLASSNAME 92 | 93 | 94 | #define CLASSNAME "IDirectDrawSurface7" 95 | class CProxyIDirectDrawSurface7 : public IDirectDrawSurface7{ 96 | private: 97 | IDirectDrawSurface7* m_Instance; 98 | public: 99 | CProxyIDirectDrawSurface7(IDirectDrawSurface7* ptr) : m_Instance(ptr) {} 100 | 101 | /*** IUnknown methods ***/ 102 | STDMETHOD(QueryInterface) (THIS_ REFIID p1, LPVOID FAR * p2) PROXY2(QueryInterface) 103 | 104 | STDMETHOD_(ULONG,AddRef) (THIS) PROXY0(AddRef) 105 | STDMETHOD_(ULONG,Release) (THIS) PROXY_RELEASE 106 | 107 | /*** IDirectDrawSurface methods ***/ 108 | STDMETHOD(AddAttachedSurface)(THIS_ LPDIRECTDRAWSURFACE7 p1) PROXY1(AddAttachedSurface) 109 | STDMETHOD(AddOverlayDirtyRect)(THIS_ LPRECT p1) PROXY1(AddOverlayDirtyRect) 110 | 111 | STDMETHOD(Blt)(THIS_ LPRECT p1, LPDIRECTDRAWSURFACE7 p2, LPRECT p3, DWORD p4, LPDDBLTFX p5) PROXY5(Blt) 112 | STDMETHOD(BltBatch)(THIS_ LPDDBLTBATCH p1, DWORD p2, DWORD p3) PROXY3(BltBatch) 113 | STDMETHOD(BltFast)(THIS_ DWORD p1, DWORD p2, LPDIRECTDRAWSURFACE7 p3, LPRECT p4, DWORD p5) PROXY5(BltFast) 114 | 115 | STDMETHOD(DeleteAttachedSurface)(THIS_ DWORD p1, LPDIRECTDRAWSURFACE7 p2) PROXY2(DeleteAttachedSurface) 116 | STDMETHOD(EnumAttachedSurfaces)(THIS_ LPVOID p1, LPDDENUMSURFACESCALLBACK7 p2) PROXY2(EnumAttachedSurfaces) 117 | STDMETHOD(EnumOverlayZOrders)(THIS_ DWORD p1, LPVOID p2, LPDDENUMSURFACESCALLBACK7 p3) PROXY3(EnumOverlayZOrders) 118 | STDMETHOD(Flip)(THIS_ LPDIRECTDRAWSURFACE7 p1, DWORD p2) PROXY2(Flip) 119 | STDMETHOD(GetAttachedSurface)(THIS_ LPDDSCAPS2 p1, LPDIRECTDRAWSURFACE7 FAR * p2) PROXY2(GetAttachedSurface) 120 | STDMETHOD(GetBltStatus)(THIS_ DWORD p1) PROXY1(GetBltStatus) 121 | STDMETHOD(GetCaps)(THIS_ LPDDSCAPS2 p1) PROXY1(GetCaps) 122 | STDMETHOD(GetClipper)(THIS_ LPDIRECTDRAWCLIPPER FAR* p1) PROXY1(GetClipper) 123 | STDMETHOD(GetColorKey)(THIS_ DWORD p1, LPDDCOLORKEY p2) PROXY2(GetColorKey) 124 | STDMETHOD(GetDC)(THIS_ HDC FAR * p1) PROXY1(GetDC) 125 | 126 | STDMETHOD(GetFlipStatus)(THIS_ DWORD p1) PROXY1(GetFlipStatus) 127 | 128 | STDMETHOD(GetOverlayPosition)(THIS_ LPLONG p1, LPLONG p2) PROXY2(GetOverlayPosition) 129 | STDMETHOD(GetPalette)(THIS_ LPDIRECTDRAWPALETTE FAR* p1) PROXY1(GetPalette) 130 | STDMETHOD(GetPixelFormat)(THIS_ LPDDPIXELFORMAT p1) PROXY1(GetPixelFormat) 131 | STDMETHOD(GetSurfaceDesc)(THIS_ LPDDSURFACEDESC2 p1) PROXY1(GetSurfaceDesc) 132 | STDMETHOD(Initialize)(THIS_ LPDIRECTDRAW p1, LPDDSURFACEDESC2 p2) PROXY2(Initialize) 133 | STDMETHOD(IsLost)(THIS) PROXY0(IsLost) 134 | STDMETHOD(Lock)(THIS_ LPRECT p1, LPDDSURFACEDESC2 p2, DWORD p3, HANDLE p4) PROXY4(Lock) 135 | STDMETHOD(ReleaseDC)(THIS_ HDC p1) PROXY1(ReleaseDC) 136 | STDMETHOD(Restore)(THIS) PROXY0(Restore) 137 | STDMETHOD(SetClipper)(THIS_ LPDIRECTDRAWCLIPPER p1) PROXY1(SetClipper) 138 | STDMETHOD(SetColorKey)(THIS_ DWORD p1, LPDDCOLORKEY p2) PROXY2(SetColorKey) 139 | STDMETHOD(SetOverlayPosition)(THIS_ LONG p1, LONG p2) PROXY2(SetOverlayPosition) 140 | STDMETHOD(SetPalette)(THIS_ LPDIRECTDRAWPALETTE p1) PROXY1(SetPalette) 141 | STDMETHOD(Unlock)(THIS_ LPRECT p1) PROXY1(Unlock) 142 | STDMETHOD(UpdateOverlay)(THIS_ LPRECT p1, LPDIRECTDRAWSURFACE7 p2, LPRECT p3, DWORD p4, LPDDOVERLAYFX p5) PROXY5(UpdateOverlay) 143 | STDMETHOD(UpdateOverlayDisplay)(THIS_ DWORD p1) PROXY1(UpdateOverlayDisplay) 144 | STDMETHOD(UpdateOverlayZOrder)(THIS_ DWORD p1, LPDIRECTDRAWSURFACE7 p2) PROXY2(UpdateOverlayZOrder) 145 | /*** Added in the v2 interface ***/ 146 | STDMETHOD(GetDDInterface)(THIS_ LPVOID FAR * p1) PROXY1(GetDDInterface) 147 | STDMETHOD(PageLock)(THIS_ DWORD p1) PROXY1(PageLock) 148 | STDMETHOD(PageUnlock)(THIS_ DWORD p1) PROXY1(PageUnlock) 149 | /*** Added in the v3 interface ***/ 150 | STDMETHOD(SetSurfaceDesc)(THIS_ LPDDSURFACEDESC2 p1, DWORD p2) PROXY2(SetSurfaceDesc) 151 | /*** Added in the v4 interface ***/ 152 | STDMETHOD(SetPrivateData)(THIS_ REFGUID p1, LPVOID p2, DWORD p3, DWORD p4) PROXY4(SetPrivateData) 153 | STDMETHOD(GetPrivateData)(THIS_ REFGUID p1, LPVOID p2, LPDWORD p3) PROXY3(GetPrivateData) 154 | STDMETHOD(FreePrivateData)(THIS_ REFGUID p1) PROXY1(FreePrivateData) 155 | STDMETHOD(GetUniquenessValue)(THIS_ LPDWORD p1) PROXY1(GetUniquenessValue) 156 | STDMETHOD(ChangeUniquenessValue)(THIS) PROXY0(ChangeUniquenessValue) 157 | /*** Moved Texture7 methods here ***/ 158 | STDMETHOD(SetPriority)(THIS_ DWORD p1) PROXY1(SetPriority) 159 | STDMETHOD(GetPriority)(THIS_ LPDWORD p1) PROXY1(GetPriority) 160 | STDMETHOD(SetLOD)(THIS_ DWORD p1) PROXY1(SetLOD) 161 | STDMETHOD(GetLOD)(THIS_ LPDWORD p1) PROXY1(GetLOD) 162 | }; 163 | #undef CLASSNAME 164 | 165 | 166 | 167 | // D3DDev HOOK 168 | #define CLASSNAME "IDirect3DDevice7" 169 | class CProxyIDirect3DDevice7 : public IDirect3DDevice7{ 170 | private: 171 | IDirect3DDevice7* m_Instance; 172 | IDirectDrawSurface7* TargetSurface; 173 | 174 | BOOL m_firstonce; 175 | BOOL m_frameonce; 176 | public: 177 | 178 | CProxyIDirect3DDevice7(IDirect3DDevice7* ptr,IDirectDrawSurface7* psf) : m_Instance(ptr), TargetSurface(psf), m_firstonce(true) {} 179 | 180 | /*** IUnknown methods ***/ 181 | STDMETHOD(QueryInterface)(THIS_ REFIID p1, LPVOID * p2) PROXY2(QueryInterface) 182 | STDMETHOD_(ULONG,AddRef) (THIS) PROXY0(AddRef) 183 | STDMETHOD_(ULONG,Release) (THIS)// PROXY_RELEASE 184 | { 185 | Proxy_Release(); 186 | ULONG Count = m_Instance->Release(); 187 | DEBUG_LOGGING_MORE_DETAIL((CLASSNAME "::Release() RefCount = %d", Count)); 188 | if(Count == 0) 189 | delete this; 190 | return Count; 191 | } 192 | void Proxy_Release(void); 193 | 194 | /*** IDirect3DDevice7 methods ***/ 195 | STDMETHOD(GetCaps)(THIS_ LPD3DDEVICEDESC7 p1) PROXY1(GetCaps) 196 | STDMETHOD(EnumTextureFormats)(THIS_ LPD3DENUMPIXELFORMATSCALLBACK p1,LPVOID p2) PROXY2(EnumTextureFormats) 197 | 198 | // STDMETHOD(BeginScene)(THIS) PROXY0(BeginScene) 199 | STDMETHOD(BeginScene)(THIS) { return Proxy_BeginScene(); }; 200 | 201 | // STDMETHOD(EndScene)(THIS) PROXY0(EndScene) 202 | STDMETHOD(EndScene)(THIS) { return Proxy_EndScene(); }; 203 | 204 | STDMETHOD(GetDirect3D)(THIS_ LPDIRECT3D7* p1) PROXY1(GetDirect3D) 205 | STDMETHOD(SetRenderTarget)(THIS_ LPDIRECTDRAWSURFACE7 p1,DWORD p2) PROXY2(SetRenderTarget) 206 | STDMETHOD(GetRenderTarget)(THIS_ LPDIRECTDRAWSURFACE7 *p1) PROXY1(GetRenderTarget) 207 | STDMETHOD(Clear)(THIS_ DWORD p1,LPD3DRECT p2,DWORD p3,D3DCOLOR p4,D3DVALUE p5,DWORD p6) PROXY6(Clear) 208 | STDMETHOD(SetTransform)(THIS_ D3DTRANSFORMSTATETYPE p1,LPD3DMATRIX p2) PROXY2(SetTransform) 209 | STDMETHOD(GetTransform)(THIS_ D3DTRANSFORMSTATETYPE p1,LPD3DMATRIX p2) PROXY2(GetTransform) 210 | STDMETHOD(SetViewport)(THIS_ LPD3DVIEWPORT7 p1) PROXY1(SetViewport) 211 | 212 | STDMETHOD(MultiplyTransform)(THIS_ D3DTRANSFORMSTATETYPE p1,LPD3DMATRIX p2) PROXY2(MultiplyTransform) 213 | STDMETHOD(GetViewport)(THIS_ LPD3DVIEWPORT7 p1) PROXY1(GetViewport) 214 | STDMETHOD(SetMaterial)(THIS_ LPD3DMATERIAL7 p1) PROXY1(SetMaterial) 215 | STDMETHOD(GetMaterial)(THIS_ LPD3DMATERIAL7 p1) PROXY1(GetMaterial) 216 | STDMETHOD(SetLight)(THIS_ DWORD p1,LPD3DLIGHT7 p2) PROXY2(SetLight) 217 | STDMETHOD(GetLight)(THIS_ DWORD p1,LPD3DLIGHT7 p2) PROXY2(GetLight) 218 | 219 | //STDMETHOD(SetRenderState)(THIS_ D3DRENDERSTATETYPE p1,DWORD p2) PROXY2(SetRenderState) 220 | STDMETHOD(SetRenderState)(THIS_ D3DRENDERSTATETYPE p1,DWORD p2) {return Proxy_SetRenderState(p1,p2);} 221 | 222 | STDMETHOD(GetRenderState)(THIS_ D3DRENDERSTATETYPE p1,LPDWORD p2) PROXY2(GetRenderState) 223 | STDMETHOD(BeginStateBlock)(THIS) PROXY0(BeginStateBlock) 224 | STDMETHOD(EndStateBlock)(THIS_ LPDWORD p1) PROXY1(EndStateBlock) 225 | STDMETHOD(PreLoad)(THIS_ LPDIRECTDRAWSURFACE7 p1) PROXY1(PreLoad) 226 | STDMETHOD(DrawPrimitive)(THIS_ D3DPRIMITIVETYPE p1,DWORD p2,LPVOID p3,DWORD p4,DWORD p5) PROXY5(DrawPrimitive) 227 | // 228 | STDMETHOD(DrawIndexedPrimitive)(THIS_ D3DPRIMITIVETYPE p1,DWORD p2,LPVOID p3,DWORD p4,LPWORD p5,DWORD p6,DWORD p7) PROXY7(DrawIndexedPrimitive) 229 | STDMETHOD(SetClipStatus)(THIS_ LPD3DCLIPSTATUS p1) PROXY1(SetClipStatus) 230 | STDMETHOD(GetClipStatus)(THIS_ LPD3DCLIPSTATUS p1) PROXY1(GetClipStatus) 231 | STDMETHOD(DrawPrimitiveStrided)(THIS_ D3DPRIMITIVETYPE p1,DWORD p2,LPD3DDRAWPRIMITIVESTRIDEDDATA p3,DWORD p4,DWORD p5) PROXY5(DrawPrimitiveStrided) 232 | STDMETHOD(DrawIndexedPrimitiveStrided)(THIS_ D3DPRIMITIVETYPE p1,DWORD p2,LPD3DDRAWPRIMITIVESTRIDEDDATA p3,DWORD p4,LPWORD p5,DWORD p6,DWORD p7) PROXY7(DrawIndexedPrimitiveStrided) 233 | STDMETHOD(DrawPrimitiveVB)(THIS_ D3DPRIMITIVETYPE p1,LPDIRECT3DVERTEXBUFFER7 p2,DWORD p3,DWORD p4,DWORD p5) PROXY5(DrawPrimitiveVB) 234 | STDMETHOD(DrawIndexedPrimitiveVB)(THIS_ D3DPRIMITIVETYPE p1,LPDIRECT3DVERTEXBUFFER7 p2,DWORD p3,DWORD p4,LPWORD p5,DWORD p6,DWORD p7) PROXY7(DrawIndexedPrimitiveVB) 235 | STDMETHOD(ComputeSphereVisibility)(THIS_ LPD3DVECTOR p1,LPD3DVALUE p2,DWORD p3,DWORD p4,LPDWORD p5) PROXY5(ComputeSphereVisibility) 236 | STDMETHOD(GetTexture)(THIS_ DWORD p1,LPDIRECTDRAWSURFACE7 *p2) PROXY2(GetTexture) 237 | STDMETHOD(SetTexture)(THIS_ DWORD p1,LPDIRECTDRAWSURFACE7 p2) PROXY2(SetTexture) 238 | STDMETHOD(GetTextureStageState)(THIS_ DWORD p1,D3DTEXTURESTAGESTATETYPE p2,LPDWORD p3) PROXY3(GetTextureStageState) 239 | STDMETHOD(SetTextureStageState)(THIS_ DWORD p1,D3DTEXTURESTAGESTATETYPE p2,DWORD p3) PROXY3(SetTextureStageState) 240 | STDMETHOD(ValidateDevice)(THIS_ LPDWORD p1) PROXY1(ValidateDevice) 241 | STDMETHOD(ApplyStateBlock)(THIS_ DWORD p1) PROXY1(ApplyStateBlock) 242 | STDMETHOD(CaptureStateBlock)(THIS_ DWORD p1) PROXY1(CaptureStateBlock) 243 | STDMETHOD(DeleteStateBlock)(THIS_ DWORD p1) PROXY1(DeleteStateBlock) 244 | STDMETHOD(CreateStateBlock)(THIS_ D3DSTATEBLOCKTYPE p1,LPDWORD p2) PROXY2(CreateStateBlock) 245 | STDMETHOD(Load)(THIS_ LPDIRECTDRAWSURFACE7 p1,LPPOINT p2,LPDIRECTDRAWSURFACE7 p3,LPRECT p4,DWORD p5) PROXY5(Load) 246 | STDMETHOD(LightEnable)(THIS_ DWORD p1,BOOL p2) PROXY2(LightEnable) 247 | STDMETHOD(GetLightEnable)(THIS_ DWORD p1,BOOL* p2) PROXY2(GetLightEnable) 248 | STDMETHOD(SetClipPlane)(THIS_ DWORD p1,D3DVALUE* p2) PROXY2(SetClipPlane) 249 | STDMETHOD(GetClipPlane)(THIS_ DWORD p1,D3DVALUE* p2) PROXY2(GetClipPlane) 250 | STDMETHOD(GetInfo)(THIS_ DWORD p1,LPVOID p2,DWORD p3) PROXY3(GetInfo) 251 | 252 | 253 | // 254 | // Proxy Functions 255 | // 256 | HRESULT Proxy_SetRenderState(THIS_ D3DRENDERSTATETYPE dwRenderStateType,DWORD dwRenderState); 257 | HRESULT Proxy_BeginScene(void); 258 | HRESULT Proxy_EndScene(void); 259 | }; 260 | #undef CLASSNAME 261 | 262 | 263 | // D3D HOOK 264 | #define CLASSNAME "IDirect3D7" 265 | class CProxyIDirect3D7 : public IDirect3D7{ 266 | private: 267 | IDirect3D7* m_Instance; 268 | public: 269 | CProxyIDirect3D7(IDirect3D7* ptr) : m_Instance(ptr) {} 270 | 271 | /*** IUnknown methods ***/ 272 | STDMETHOD(QueryInterface)(THIS_ REFIID p1, LPVOID * p2) PROXY2(QueryInterface) 273 | STDMETHOD_(ULONG,AddRef) (THIS) PROXY0(AddRef) 274 | STDMETHOD_(ULONG,Release) (THIS) PROXY_RELEASE 275 | 276 | /*** IDirect3D7 methods ***/ 277 | STDMETHOD(EnumDevices)(THIS_ LPD3DENUMDEVICESCALLBACK7 p1,LPVOID p2) PROXY2(EnumDevices) 278 | //STDMETHOD(CreateDevice)(THIS_ REFCLSID p1,LPDIRECTDRAWSURFACE7 p2,LPDIRECT3DDEVICE7* p3) PROXY3(CreateDevice) 279 | STDMETHOD(CreateDevice)(THIS_ REFCLSID p1,LPDIRECTDRAWSURFACE7 p2,LPDIRECT3DDEVICE7* p3) 280 | { 281 | return Proxy_CreateDevice(p1,p2,p3); 282 | }; 283 | STDMETHOD(CreateVertexBuffer)(THIS_ LPD3DVERTEXBUFFERDESC p1,LPDIRECT3DVERTEXBUFFER7* p2,DWORD p3) PROXY3(CreateVertexBuffer) 284 | STDMETHOD(EnumZBufferFormats)(THIS_ REFCLSID p1,LPD3DENUMPIXELFORMATSCALLBACK p2,LPVOID p3) PROXY3(EnumZBufferFormats) 285 | STDMETHOD(EvictManagedTextures)(THIS) PROXY0(EvictManagedTextures) 286 | 287 | 288 | HRESULT Proxy_CreateDevice( REFCLSID rclsid,LPDIRECTDRAWSURFACE7 lpDDS,LPDIRECT3DDEVICE7 * lplpD3DDevice); 289 | }; 290 | #undef CLASSNAME 291 | -------------------------------------------------------------------------------- /SimpleROHookCS/MainForm.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.IO; 3 | using System.Xml; 4 | using System.Xml.Serialization; 5 | using System.ComponentModel; 6 | using System.Windows.Forms; 7 | using System.Security.Permissions; 8 | 9 | 10 | namespace SimpleROHookCS 11 | { 12 | 13 | public partial class MainForm : Form,IDisposable 14 | { 15 | private SRHSharedData m_SharedData = null; 16 | private NPCLogger m_npcLogger; 17 | 18 | protected override CreateParams CreateParams 19 | { 20 | [SecurityPermission(SecurityAction.Demand, 21 | Flags = SecurityPermissionFlag.UnmanagedCode)] 22 | get 23 | { 24 | const int WS_EX_TOOLWINDOW = 0x80; 25 | const long WS_POPUP = 0x80000000L; 26 | const int WS_VISIBLE = 0x10000000; 27 | const int WS_SYSMENU = 0x80000; 28 | const int WS_MAXIMIZEBOX = 0x10000; 29 | 30 | CreateParams cp = base.CreateParams; 31 | cp.ExStyle = WS_EX_TOOLWINDOW; 32 | cp.Style = unchecked((int)WS_POPUP) | 33 | WS_VISIBLE | WS_SYSMENU | WS_MAXIMIZEBOX; 34 | 35 | cp.Width = 0; 36 | cp.Height = 0; 37 | 38 | return cp; 39 | } 40 | } 41 | 42 | public MainForm() 43 | { 44 | InitializeComponent(); 45 | m_SharedData = new SRHSharedData(); 46 | } 47 | 48 | public new void Dispose() 49 | { 50 | m_SharedData.Dispose(); 51 | Dispose(true); 52 | } 53 | 54 | private void exitToolStripMenuItem_Click(object sender, EventArgs e) 55 | { 56 | TaskTray_notifyIcon.Visible = false; 57 | Application.Exit(); 58 | } 59 | 60 | private void playMusicOnClientStreamPlayerToolStripMenuItem_Click(object sender, EventArgs e) 61 | { 62 | string musicfilename = m_SharedData.musicfilename; 63 | var openFileDialog = new OpenFileDialog(); 64 | openFileDialog.Title = "Ragnarok Online BGM"; 65 | openFileDialog.InitialDirectory = musicfilename; 66 | openFileDialog.CheckFileExists = true; 67 | openFileDialog.Multiselect = false; 68 | openFileDialog.FileName = musicfilename; 69 | openFileDialog.Filter = "mp3 file|*.mp3|wave file|*.wav"; 70 | openFileDialog.ShowReadOnly = false; 71 | if (openFileDialog.ShowDialog() == DialogResult.OK) 72 | { 73 | m_SharedData.musicfilename = openFileDialog.FileName; 74 | m_SharedData.executeorder = true; 75 | } 76 | } 77 | 78 | private void UpdateCheckMenu() 79 | { 80 | playMusicOnClientStreamPlayerToolStripMenuItem.Enabled 81 | = (m_SharedData.g_hROWindow == 0)? false : true; 82 | packetLogToolStripMenuItem.Checked 83 | = m_SharedData.write_packetlog; 84 | freeMouseToolStripMenuItem.Checked 85 | = m_SharedData.freemouse; 86 | 87 | ground_zbias_ToolStripTrackBar.Value 88 | = m_SharedData.ground_zbias; 89 | Set_ZBiasValue_groundZBiasToolStripMenuItem(m_SharedData.ground_zbias); 90 | 91 | alphaLeveltoolStripTrackBar.Value 92 | = m_SharedData.alphalevel; 93 | Set_AlphaLevelValue_alphaLeveltoolStripMenuItem(m_SharedData.alphalevel); 94 | 95 | showM2EToolStripMenuItem.Checked 96 | = m_SharedData.m2e; 97 | showBBEtoolStripMenuItem.Checked 98 | = m_SharedData.bbe; 99 | showDeadCelltoolStripMenuItem.Checked 100 | = m_SharedData.deadcell; 101 | showChatScopetoolStripMenuItem.Checked 102 | = m_SharedData.chatscope; 103 | 104 | CPUCooler_toolStripTrackBar.Value = 105 | m_SharedData.cpucoolerlevel; 106 | Set_CPUCoolerText_toolStripMenuItem(m_SharedData.cpucoolerlevel); 107 | 108 | fixWindowModeVsyncWaitToolStripMenuItem.Checked 109 | = m_SharedData.fix_windowmode_vsyncwait; 110 | showFpsToolStripMenuItem.Checked 111 | = m_SharedData.show_framerate; 112 | showObjectInformationToolStripMenuItem.Checked 113 | = m_SharedData.objectinformation; 114 | kHzAudioModeonBootToolStripMenuItem.Checked 115 | = m_SharedData._44khz_audiomode; 116 | 117 | nPCLoggerToolStripMenuItem.Checked = m_npcLogger.Visible; 118 | } 119 | 120 | 121 | private void kHzAudioModeonBootToolStripMenuItem_Click(object sender, EventArgs e) 122 | { 123 | var tsm = (ToolStripMenuItem)sender; 124 | m_SharedData._44khz_audiomode = tsm.Checked; 125 | } 126 | 127 | private void packetLogToolStripMenuItem_Click(object sender, EventArgs e) 128 | { 129 | var tsm = (ToolStripMenuItem)sender; 130 | m_SharedData.write_packetlog = tsm.Checked; 131 | } 132 | 133 | private void freeMouseToolStripMenuItem_Click(object sender, EventArgs e) 134 | { 135 | var tsm = (ToolStripMenuItem)sender; 136 | m_SharedData.freemouse = tsm.Checked; 137 | } 138 | 139 | private void showBBEtoolStripMenuItem_Click(object sender, EventArgs e) 140 | { 141 | var tsm = (ToolStripMenuItem)sender; 142 | m_SharedData.bbe = tsm.Checked; 143 | } 144 | private void showDeadCelltoolStripMenuItem_Click(object sender, EventArgs e) 145 | { 146 | var tsm = (ToolStripMenuItem)sender; 147 | m_SharedData.deadcell = tsm.Checked; 148 | } 149 | private void showChatScopetoolStripMenuItem_Click(object sender, EventArgs e) 150 | { 151 | var tsm = (ToolStripMenuItem)sender; 152 | m_SharedData.chatscope = tsm.Checked; 153 | } 154 | private void showM2EToolStripMenuItem_Click(object sender, EventArgs e) 155 | { 156 | var tsm = (ToolStripMenuItem)sender; 157 | m_SharedData.m2e = tsm.Checked; 158 | } 159 | 160 | private void showFpsToolStripMenuItem_Click(object sender, EventArgs e) 161 | { 162 | var tsm = (ToolStripMenuItem)sender; 163 | m_SharedData.show_framerate = tsm.Checked; 164 | } 165 | 166 | private void showObjectInformationToolStripMenuItem_Click(object sender, EventArgs e) 167 | { 168 | var tsm = (ToolStripMenuItem)sender; 169 | m_SharedData.objectinformation = tsm.Checked; 170 | } 171 | 172 | private void fixWindowModeVsyncWaitToolStripMenuItem_Click(object sender, EventArgs e) 173 | { 174 | var tsm = (ToolStripMenuItem)sender; 175 | m_SharedData.fix_windowmode_vsyncwait = tsm.Checked; 176 | } 177 | 178 | private void aboutSimpleROHookToolStripMenuItem_Click(object sender, EventArgs e) 179 | { 180 | var aboutbox = new SRHAboutBox(); 181 | aboutbox.ShowDialog(); 182 | } 183 | 184 | private void TaskTray_contextMenuStrip_Opening(object sender, CancelEventArgs e) 185 | { 186 | UpdateCheckMenu(); 187 | } 188 | 189 | private void ground_zbias_ToolStripTrackBar_Update(object sender, EventArgs e) 190 | { 191 | ToolStripTrackBar tsTrackbar = (ToolStripTrackBar)sender; 192 | m_SharedData.ground_zbias = tsTrackbar.Value; 193 | 194 | Set_ZBiasValue_groundZBiasToolStripMenuItem(m_SharedData.ground_zbias); 195 | } 196 | private void Set_ZBiasValue_groundZBiasToolStripMenuItem(int value) 197 | { 198 | groundZBiasToolStripMenuItem.Text = 199 | String.Format("Ground Z Bias {0}", value); 200 | } 201 | 202 | private void CPUCooler_toolStripTrackBar_Update(object sender, EventArgs e) 203 | { 204 | ToolStripTrackBar tsTrackbar = (ToolStripTrackBar)sender; 205 | m_SharedData.cpucoolerlevel = tsTrackbar.Value; 206 | 207 | Set_CPUCoolerText_toolStripMenuItem(m_SharedData.cpucoolerlevel); 208 | } 209 | private void Set_CPUCoolerText_toolStripMenuItem(int value) 210 | { 211 | if (value==0) 212 | { 213 | CPUCoolerText_toolStripMenuItem.Text = "CPU Cooler OFF"; 214 | } 215 | else 216 | { 217 | CPUCoolerText_toolStripMenuItem.Text = 218 | String.Format("CPU Cooler Level {0}", value); 219 | } 220 | } 221 | 222 | private void alphaLeveltoolStripTrackBar_Update(object sender, EventArgs e) 223 | { 224 | ToolStripTrackBar tsTrackbar = (ToolStripTrackBar)sender; 225 | m_SharedData.alphalevel = tsTrackbar.Value; 226 | 227 | Set_AlphaLevelValue_alphaLeveltoolStripMenuItem(m_SharedData.alphalevel); 228 | } 229 | private void Set_AlphaLevelValue_alphaLeveltoolStripMenuItem(int value) 230 | { 231 | alphaLeveltoolStripMenuItem.Text = 232 | String.Format("Alpha Level {0}", value); 233 | } 234 | 235 | private void InitTaskTrayMenu() 236 | { 237 | ground_zbias_ToolStripTrackBar.SetMinMax(0, 16); 238 | ground_zbias_ToolStripTrackBar.SetTickFrequency(1); 239 | ground_zbias_ToolStripTrackBar.SetChangeValue(1, 4); 240 | 241 | alphaLeveltoolStripTrackBar.SetMinMax(0, 255); 242 | alphaLeveltoolStripTrackBar.SetTickFrequency(4); 243 | alphaLeveltoolStripTrackBar.SetChangeValue(1, 16); 244 | 245 | CPUCooler_toolStripTrackBar.SetMinMax(0, 3); 246 | CPUCooler_toolStripTrackBar.SetTickFrequency(1); 247 | CPUCooler_toolStripTrackBar.SetChangeValue(1, 4); 248 | } 249 | 250 | private void Window_Load(object sender, EventArgs e) 251 | { 252 | InitTaskTrayMenu(); 253 | 254 | string curentdirstr = System.IO.Directory.GetCurrentDirectory() + "\\config.ini"; 255 | m_SharedData.configfilepath = curentdirstr; 256 | if (!File.Exists("config.ini")) 257 | { 258 | using( StreamWriter w = new StreamWriter(@"config.ini") ) 259 | { 260 | w.WriteLine("[M2E]"); 261 | w.WriteLine("; MiniMiniEffect Color Setting"); 262 | w.WriteLine("; 0xAARRGGBB"); 263 | w.WriteLine("; AA:alpha 00-FF (00:0%---7F:50%---FF:100%)"); 264 | w.WriteLine("; RR:red 00-FF (0-255)"); 265 | w.WriteLine("; GG:green 00-FF (0-255)"); 266 | w.WriteLine("; BB:blue 00-FF (0-255)"); 267 | w.WriteLine("; "); 268 | w.WriteLine(";SW"); 269 | w.WriteLine("Skill007E=0x7F008888"); 270 | w.WriteLine(";FW"); 271 | w.WriteLine("Skill007F=0x7F880000"); 272 | w.WriteLine(";"); 273 | w.WriteLine(";warp portal"); 274 | w.WriteLine("Skill0080=0x7FFFFFFF"); 275 | w.WriteLine("Skill0081=0x7FFFFFFF"); 276 | w.WriteLine(";b.s. sacramentl"); 277 | w.WriteLine("Skill0082=0x7F888888"); 278 | w.WriteLine(";sanctuary"); 279 | w.WriteLine("Skill0083=0x7F00FFFF"); 280 | w.WriteLine(";ME"); 281 | w.WriteLine("Skill0084=0x7F00FFFF"); 282 | w.WriteLine(";pneuma"); 283 | w.WriteLine("Skill0085=0x7F00FFFF"); 284 | w.WriteLine(";SG LOV etc."); 285 | w.WriteLine("Skill0086=0x7F880088"); 286 | w.WriteLine(";FP"); 287 | w.WriteLine("Skill0087=0x7F888800"); 288 | w.WriteLine("Skill0088=0x7F888800"); 289 | w.WriteLine(";"); 290 | w.WriteLine("Skill0089=0x7F888888"); 291 | w.WriteLine("Skill008A=0x7F888888"); 292 | w.WriteLine("Skill008B=0x7F888888"); 293 | w.WriteLine("Skill008C=0x7F888888"); 294 | w.WriteLine(";IW"); 295 | w.WriteLine("Skill008D=0x7F880088"); 296 | w.WriteLine(";QM"); 297 | w.WriteLine("Skill008E=0x7F448844"); 298 | w.WriteLine(";"); 299 | w.WriteLine("Skill008F=0x7F888888"); 300 | w.WriteLine(";"); 301 | for (int ii = 0x90; ii < 0x100; ii++) 302 | { 303 | w.WriteLine("Skill{0}=0x7F888888", ii.ToString("X4")); 304 | } 305 | } 306 | } 307 | 308 | if (File.Exists("config.xml")) 309 | { 310 | #region Load Config XML 311 | using (XmlReader reader = XmlReader.Create("config.xml")) 312 | { 313 | var configration = new Config(); 314 | var serializer = new XmlSerializer(typeof(Config)); 315 | 316 | configration = (Config)serializer.Deserialize(reader); 317 | 318 | m_SharedData.write_packetlog 319 | = configration.write_packetlog; 320 | m_SharedData.freemouse 321 | = configration.freemouse; 322 | m_SharedData.ground_zbias 323 | = configration.ground_zbias; 324 | m_SharedData.alphalevel 325 | = configration.alphalevel; 326 | m_SharedData.m2e 327 | = configration.m2e; 328 | m_SharedData.bbe 329 | = configration.bbe; 330 | m_SharedData.deadcell 331 | = configration.deadcell; 332 | m_SharedData.chatscope 333 | = configration.chatscope; 334 | m_SharedData.fix_windowmode_vsyncwait 335 | = configration.fix_windowmode_vsyncwait; 336 | m_SharedData.show_framerate 337 | = configration.show_framerate; 338 | m_SharedData.objectinformation 339 | = configration.objectinformation; 340 | m_SharedData._44khz_audiomode 341 | = configration._44khz_audiomode; 342 | m_SharedData.cpucoolerlevel 343 | = configration.cpucoolerlevel; 344 | } 345 | #endregion 346 | } 347 | 348 | m_npcLogger = new NPCLogger(); 349 | m_npcLogger.StartPosition = FormStartPosition.Manual; 350 | m_npcLogger.Bounds = Properties.Settings.Default.LoggerWinBounds; 351 | m_npcLogger.WindowState = Properties.Settings.Default.LoggerWinState; 352 | 353 | if ( Properties.Settings.Default.LoggerWinVisible) 354 | m_npcLogger.Show(); 355 | 356 | } 357 | 358 | private void Window_FormClosing(object sender, FormClosingEventArgs e) 359 | { 360 | if (m_npcLogger.WindowState == FormWindowState.Normal ) 361 | Properties.Settings.Default.LoggerWinBounds = m_npcLogger.Bounds; 362 | else 363 | Properties.Settings.Default.LoggerWinBounds = m_npcLogger.RestoreBounds; 364 | Properties.Settings.Default.LoggerWinState = m_npcLogger.WindowState; 365 | 366 | Properties.Settings.Default.LoggerWinVisible = m_npcLogger.Visible; 367 | 368 | Properties.Settings.Default.Save(); 369 | 370 | m_npcLogger.Hide(); 371 | 372 | #region Save Config XML 373 | using (XmlTextWriter writer = new XmlTextWriter("config.xml", System.Text.Encoding.UTF8)) 374 | { 375 | var configration = new Config(); 376 | var serializer = new XmlSerializer(typeof(Config)); 377 | 378 | configration.write_packetlog 379 | = m_SharedData.write_packetlog; 380 | configration.freemouse 381 | = m_SharedData.freemouse; 382 | configration.ground_zbias 383 | = m_SharedData.ground_zbias; 384 | configration.alphalevel 385 | = m_SharedData.alphalevel; 386 | configration.m2e 387 | = m_SharedData.m2e; 388 | configration.bbe 389 | = m_SharedData.bbe; 390 | configration.deadcell 391 | = m_SharedData.deadcell; 392 | configration.chatscope 393 | = m_SharedData.chatscope; 394 | configration.fix_windowmode_vsyncwait 395 | = m_SharedData.fix_windowmode_vsyncwait; 396 | configration.show_framerate 397 | = m_SharedData.show_framerate; 398 | configration.objectinformation 399 | = m_SharedData.objectinformation; 400 | configration._44khz_audiomode 401 | = m_SharedData._44khz_audiomode; 402 | configration.cpucoolerlevel 403 | = m_SharedData.cpucoolerlevel; 404 | 405 | writer.Formatting = Formatting.Indented; 406 | serializer.Serialize(writer, configration); 407 | } 408 | #endregion 409 | 410 | 411 | } 412 | 413 | private void nPCLoggerToolStripMenuItem_Click(object sender, EventArgs e) 414 | { 415 | if (m_npcLogger.Visible) 416 | m_npcLogger.Hide(); 417 | else 418 | m_npcLogger.Show(); 419 | 420 | } 421 | 422 | private void notifyIcon_MouseClick(object sender, MouseEventArgs e) 423 | { 424 | if (e.Button == MouseButtons.Left) 425 | { 426 | m_npcLogger.TopMost = true; 427 | m_npcLogger.TopMost = false; 428 | } 429 | } 430 | 431 | } 432 | 433 | public class Config 434 | { 435 | public Config() 436 | { 437 | write_packetlog = false; 438 | freemouse = false; 439 | ground_zbias = 0; 440 | alphalevel = 0; 441 | m2e = true; 442 | bbe = true; 443 | deadcell = true; 444 | chatscope = true; 445 | fix_windowmode_vsyncwait = true; 446 | show_framerate = true; 447 | objectinformation = false; 448 | _44khz_audiomode = false; 449 | cpucoolerlevel = 0; 450 | } 451 | 452 | public bool write_packetlog { get; set; } 453 | public bool freemouse { get; set; } 454 | public int ground_zbias { get; set; } 455 | public int alphalevel { get; set; } 456 | public bool m2e { get; set; } 457 | public bool bbe { get; set; } 458 | public bool deadcell { get; set; } 459 | public bool chatscope { get; set; } 460 | public bool fix_windowmode_vsyncwait { get; set; } 461 | public bool show_framerate { get; set; } 462 | public bool objectinformation { get; set; } 463 | public bool _44khz_audiomode { get; set; } 464 | public int cpucoolerlevel { get; set; } 465 | 466 | // without serialize 467 | [System.Xml.Serialization.XmlIgnoreAttribute] 468 | public string configfilepath { get; set; } 469 | [System.Xml.Serialization.XmlIgnoreAttribute] 470 | public string musicfilename { get; set; } 471 | [System.Xml.Serialization.XmlIgnoreAttribute] 472 | public bool executeorder { get; set; } 473 | } 474 | 475 | } 476 | --------------------------------------------------------------------------------