├── Screenshots ├── MENU Extra.png ├── Tiny Console.png ├── MENU Debug Info.png ├── Capture Screen 1.png ├── Capture Screen 2.png └── MENU 3D Map Grid.png ├── 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 ├── Injection ├── packages.config ├── stdafx.cpp ├── targetver.h ├── resource.h ├── Core │ ├── ro │ │ ├── packet.h │ │ ├── mouse.h │ │ ├── system.h │ │ ├── res.h │ │ ├── task.h │ │ ├── ui.h │ │ ├── map.h │ │ └── unit.h │ ├── shared.h │ ├── FastFont │ │ ├── CacheInfo.h │ │ ├── FastFont.h │ │ ├── SFastFont.h │ │ ├── CacheInfo.cpp │ │ └── FastFont.cpp │ ├── SearchCode.h │ ├── PerformanceCounter.h │ └── RoCodeBind.h ├── tinyconsole.h ├── Hook.h ├── Hook.cpp ├── stdafx.h ├── ProxyIDirectInput.cpp ├── ProxyHelper.h ├── ReadMe.txt ├── Injection.rc ├── ProxyIDirectInput.h ├── tinyconsole.cpp ├── Injection.vcxproj.filters ├── Injection.vcxproj └── ProxyIDirectDraw.cpp ├── .gitignore ├── .gitattributes ├── .github └── FUNDING.yml ├── SimpleROHook.sln ├── thirdparty.txt └── README.md /Screenshots/MENU Extra.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/X-EcutiOnner/SimpleROHook/HEAD/Screenshots/MENU Extra.png -------------------------------------------------------------------------------- /Screenshots/Tiny Console.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/X-EcutiOnner/SimpleROHook/HEAD/Screenshots/Tiny Console.png -------------------------------------------------------------------------------- /Screenshots/MENU Debug Info.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/X-EcutiOnner/SimpleROHook/HEAD/Screenshots/MENU Debug Info.png -------------------------------------------------------------------------------- /Screenshots/Capture Screen 1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/X-EcutiOnner/SimpleROHook/HEAD/Screenshots/Capture Screen 1.png -------------------------------------------------------------------------------- /Screenshots/Capture Screen 2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/X-EcutiOnner/SimpleROHook/HEAD/Screenshots/Capture Screen 2.png -------------------------------------------------------------------------------- /Screenshots/MENU 3D Map Grid.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/X-EcutiOnner/SimpleROHook/HEAD/Screenshots/MENU 3D Map Grid.png -------------------------------------------------------------------------------- /SimpleROHookCS/SimpleROHookCS.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/X-EcutiOnner/SimpleROHook/HEAD/SimpleROHookCS/SimpleROHookCS.ico -------------------------------------------------------------------------------- /Injection/packages.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /Injection/stdafx.cpp: -------------------------------------------------------------------------------- 1 | // stdafx.cpp: Standard include Core.pch only 2 | // The source file it contains will be a precompiled header. 3 | // stdafx.obj contains precompiled type information. 4 | 5 | #include "stdafx.h" 6 | 7 | // TODO: Required in STDAFX.H, not this file 8 | // See additional headers. 9 | -------------------------------------------------------------------------------- /Injection/targetver.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | // Include SDKDDKVer.h to define the highest level Windows platform available. 4 | 5 | // If you want to build your application for older Windows platforms, include WinSDKVer.h and 6 | // Before including SDKDDKVer.h, set the _WIN32_WINNT macro to indicate the supported platforms. 7 | 8 | #include 9 | -------------------------------------------------------------------------------- /Injection/resource.h: -------------------------------------------------------------------------------- 1 | // {{NO_DEPENDENCIES}} 2 | // Microsoft Visual C++ generated include file. 3 | // Used by Core.rc 4 | 5 | // The following defaults for the new object 6 | // 7 | #ifdef APSTUDIO_INVOKED 8 | #ifndef APSTUDIO_READONLY_SYMBOLS 9 | #define _APS_NEXT_RESOURCE_VALUE 101 10 | #define _APS_NEXT_COMMAND_VALUE 40001 11 | #define _APS_NEXT_CONTROL_VALUE 1001 12 | #define _APS_NEXT_SYMED_VALUE 101 13 | #endif 14 | #endif 15 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | ## Global ## 2 | [Tt]humbs.db 3 | *.7z 4 | *.rar 5 | *.*zip 6 | 7 | ## Injection ## 8 | Injection/versioninfo.h 9 | 10 | ## Nuget Packages ## 11 | packages/ 12 | 13 | ## Visual Studio ## 14 | .vs/ 15 | obj/ 16 | ipch/ 17 | [Bb]in 18 | *[Dd]ebug*/ 19 | *[Rr]elease*/ 20 | *.db 21 | *.obj 22 | *.sdf 23 | *.lib 24 | *.dll 25 | *.exe 26 | *.suo 27 | *.pdb 28 | *.aps 29 | *.ipch 30 | *.user 31 | *.vspscc 32 | *.opendb 33 | *.opensdf 34 | 35 | ## Visual Studio Code ## 36 | .vscode/ 37 | /.vscode 38 | /.vscode/*.json 39 | -------------------------------------------------------------------------------- /Injection/Core/ro/packet.h: -------------------------------------------------------------------------------- 1 | enum PACKET_HEADER 2 | { 3 | HEADER_ZC_SAY_DIALOG = 0xb4, 4 | HEADER_ZC_MENU_LIST = 0xb7, 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 | { 14 | WORD PacketType; 15 | WORD PacketLength; 16 | DWORD AID; 17 | BYTE Data[]; 18 | }; 19 | 20 | struct PACKET_CZ_MENU_LIST 21 | { 22 | WORD PacketType; 23 | WORD PacketLength; 24 | DWORD AID; 25 | BYTE Data[]; 26 | }; 27 | 28 | #pragma warning(pop) 29 | 30 | #pragma pack(pop) 31 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | *.7z filter=lfs diff=lfs merge=lfs -text 2 | *.rar filter=lfs diff=lfs merge=lfs -text 3 | *.*zip filter=lfs diff=lfs merge=lfs -text 4 | 5 | *.db filter=lfs diff=lfs merge=lfs -text 6 | *.dll filter=lfs diff=lfs merge=lfs -text 7 | *.lib filter=lfs diff=lfs merge=lfs -text 8 | *.exe filter=lfs diff=lfs merge=lfs -text 9 | *.inf filter=lfs diff=lfs merge=lfs -text 10 | *.p7s filter=lfs diff=lfs merge=lfs -text 11 | *.nupkg filter=lfs diff=lfs merge=lfs -text 12 | 13 | *.md text eol=crlf 14 | *.ini text eol=crlf 15 | *.lua text eol=crlf 16 | *.lub text eol=crlf 17 | *.txt text eol=crlf 18 | *.html text eol=crlf 19 | *.yml diff text eol=crlf 20 | -------------------------------------------------------------------------------- /Injection/Core/ro/mouse.h: -------------------------------------------------------------------------------- 1 | enum EBtnState 2 | { 3 | BTN_NONE = 0, 4 | BTN_DOWN, 5 | BTN_PRESSED, 6 | BTN_UP, 7 | BTN_DBLCLK 8 | }; 9 | 10 | class CMouse 11 | { 12 | public: 13 | IDirectInput7* m_lpdi; 14 | IDirectInputDevice7* m_pMouse; 15 | LPVOID m_hevtMouse; 16 | int m_xDelta; 17 | int m_yDelta; 18 | int m_xPos; 19 | int m_yPos; 20 | int m_wheel; 21 | int m_oldBtnState[3]; 22 | EBtnState m_btnState[3]; 23 | int m_dblclkCnt[3]; 24 | DWORD m_dblclkTime; 25 | DWORD m_bSwapButton; 26 | }; 27 | -------------------------------------------------------------------------------- /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 | 14 | #ifndef DEBUG_LOGGING_DETAIL 15 | #define DEBUG_LOGGING_DETAIL(a) 16 | #endif 17 | 18 | #ifndef DEBUG_LOGGING_MORE_DETAIL 19 | #define DEBUG_LOGGING_MORE_DETAIL(a) 20 | #endif 21 | 22 | void CreateTinyConsole(void); 23 | void ReleaseTinyConsole(void); 24 | -------------------------------------------------------------------------------- /Injection/Hook.h: -------------------------------------------------------------------------------- 1 | // The following ifdef blocks are a common way to create macros that facilitate export from a DLL. 2 | // All files in this DLL are compiled using the INJECTION_EXPORTS symbol defined on the command line. 3 | // This symbol cannot be defined in projects that use this DLL. 4 | // Other projects whose source file contains this file 5 | // Consider the CORE_API function to be imported from a DLL, 6 | // While this DLL considers the symbols defined in this macro to be exported. 7 | #ifdef INJECTION_EXPORTS 8 | extern HINSTANCE g_hDLL; 9 | #define INJECTION_API extern "C" __declspec(dllexport) 10 | #else 11 | #define INJECTION_API extern "C" __declspec(dllimport) 12 | #endif 13 | 14 | INJECTION_API void InstallHook(); 15 | INJECTION_API void RemoveHook(); 16 | -------------------------------------------------------------------------------- /Injection/Core/shared.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #define SHAREDMEMORY_OBJECTNAME _T("SimpleROHook1011") 4 | 5 | enum COPYDATAENTRY 6 | { 7 | COPYDATA_NPCLogger = 127 8 | }; 9 | 10 | typedef struct _StSHAREDMEMORY 11 | { 12 | HWND g_hROWindow; 13 | 14 | DWORD executeorder; 15 | 16 | BOOL write_packetlog; 17 | BOOL freemouse; 18 | int cast_range; 19 | int ground_zbias; 20 | int alphalevel; 21 | BOOL m2e; 22 | BOOL bbe; 23 | BOOL deadcell; 24 | BOOL chatscope; 25 | BOOL castrange; 26 | BOOL fix_windowmode_vsyncwait; 27 | BOOL show_framerate; 28 | BOOL objectinformation; 29 | BOOL _44khz_audiomode; 30 | int cpucoolerlevel; 31 | BOOL chainload; 32 | 33 | WCHAR configfilepath[MAX_PATH]; 34 | WCHAR musicfilename[MAX_PATH]; 35 | 36 | } StSHAREDMEMORY; 37 | -------------------------------------------------------------------------------- /Injection/Hook.cpp: -------------------------------------------------------------------------------- 1 | // Core.cpp: DLL Defines the function to be exported for the application. 2 | #include "Hook.h" 3 | 4 | HINSTANCE g_hDLL; 5 | 6 | // This segment must be defined as SHARED in the .DEF 7 | #pragma data_seg (".HookShared") 8 | 9 | // Shared instance for all processes. 10 | HHOOK g_hHook = NULL; 11 | #pragma data_seg() 12 | 13 | #pragma comment(linker, "/Section:.HookShared,rws") 14 | 15 | LRESULT CALLBACK HookProc(int nCode, WPARAM wParam, LPARAM lParam) 16 | { 17 | return ::CallNextHookEx(g_hHook, nCode, wParam, lParam); 18 | } 19 | 20 | INJECTION_API void InstallHook() 21 | { 22 | g_hHook = ::SetWindowsHookEx(WH_CBT, HookProc, g_hDLL, 0); 23 | } 24 | 25 | INJECTION_API void RemoveHook() 26 | { 27 | ::UnhookWindowsHookEx(g_hHook); 28 | g_hHook = NULL; 29 | } 30 | -------------------------------------------------------------------------------- /.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | # These are supported funding model platforms 2 | 3 | github: # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2] 4 | patreon: # Replace with a single Patreon username 5 | open_collective: # Replace with a single Open Collective username 6 | ko_fi: xecutionner # Replace with a single Ko-fi username 7 | tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel 8 | community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry 9 | liberapay: # Replace with a single Liberapay username 10 | issuehunt: # Replace with a single IssueHunt username 11 | otechie: # Replace with a single Otechie username 12 | custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2'] 13 | -------------------------------------------------------------------------------- /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 | 16 | -------------------------------------------------------------------------------- /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 | { 18 | u32 OriginalKey; 19 | u32 Value; 20 | 21 | void *pData; 22 | 23 | StCacheInfo *pPrev; 24 | StCacheInfo *pNext; 25 | 26 | StCacheInfo *pPrevHash; 27 | StCacheInfo *pNextHash; 28 | } StCacheInfo; 29 | 30 | public: 31 | // CacheInfo(); 32 | CacheInfo(int HashTopTables); 33 | virtual ~CacheInfo(void); 34 | 35 | void ClearCache(void); 36 | void *CreateData(int hashkey, int datasize); 37 | void *GetCacheData(int hashkey); 38 | 39 | int DebugGetHashEntrys(int hashtableno); 40 | 41 | private: 42 | int m_CacheNums; 43 | int m_HashRootTables; 44 | 45 | StCacheInfo m_CacheRoot; 46 | StCacheInfo *m_HashRootTable; 47 | }; 48 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /Injection/stdafx.h: -------------------------------------------------------------------------------- 1 | // stdafx.h: Include file for standard system include files, or 2 | // write a project-specific include file that is referenced frequently 3 | // and does not change much. 4 | // 5 | 6 | #pragma once 7 | 8 | #include "TargetVer.h" 9 | 10 | #define WIN32_LEAN_AND_MEAN // Exclude unused parts from the Windows header. 11 | 12 | // Windows Header Files: 13 | #include 14 | #include 15 | #include 16 | #include 17 | #include 18 | #include 19 | 20 | #pragma comment(lib, "shlwapi.lib") 21 | #pragma comment(lib, "ddraw.lib") 22 | #pragma comment(lib, "dinput.lib") 23 | #pragma comment(lib, "dxguid.lib") 24 | #pragma comment(lib, "winmm.lib") 25 | 26 | #define DIRECTINPUT_VERSION 0x0700 27 | #include 28 | #include 29 | #include 30 | 31 | // TODO: See here for any additional headers required by your program. 32 | #include 33 | 34 | #include 35 | 36 | #include 37 | #include 38 | #include 39 | #include 40 | 41 | #include 42 | #include 43 | 44 | #include 45 | #include 46 | #include 47 | 48 | #include 49 | 50 | #include "MinHook.h" 51 | -------------------------------------------------------------------------------- /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 | { 13 | GLYPHMETRICS GM; 14 | BYTE Image[1]; 15 | } StOutlineFontData; 16 | 17 | public: 18 | CFastFont(); 19 | virtual ~CFastFont(void); 20 | 21 | bool CreateFastFont(LOGFONT *lplf, int OutLineFormat = GGO_BITMAP, 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 | int DebugGetHashEntrys(int hashtableno); 28 | 29 | // typedef int (WINAPI *PFNMESSAGEBOXA)(HWND, PCSTR, PCSTR, UINT); 30 | // typedef bool (*funcFFDATA2PIC)(VOID*, DWORD); 31 | void SetBltStatus(void *dist,DWORD pitch,DWORD bits,int mode,funcFFDATA2PIC func); 32 | 33 | void GetMaxSize(SIZE *size); 34 | 35 | void test(int mode); 36 | 37 | private: 38 | HDC m_hDC; 39 | HFONT m_hOldFont; 40 | TEXTMETRIC m_TM; 41 | 42 | int m_DefaultBufferSize; 43 | int m_OutLineFormat; 44 | int m_HashDivideNums; 45 | int m_BltAAMode; 46 | 47 | HFONT m_hFont; 48 | BYTE *m_pDefaultBuffer; 49 | CacheInfo *m_pCacheInfo; 50 | 51 | funcFFDATA2PIC m_Data2PicFunc; 52 | BYTE *m_DistPtr; 53 | DWORD m_DistPitch; 54 | DWORD m_DistBits; 55 | }; 56 | -------------------------------------------------------------------------------- /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 | { 17 | DEBUG_LOGGING_MORE_DETAIL(("IDirectInput7::Hook_CProxyIDirectInputDevice7 = 0x%0x", lpDirectInputDevice7)); 18 | ret_cProxy = (void*)(new CProxyIDirectInputDevice7(lpDirectInputDevice7)); 19 | *lpIDD = (LPDIRECTINPUTDEVICEA)ret_cProxy; 20 | } 21 | 22 | return Result; 23 | } 24 | 25 | HRESULT CProxyIDirectInputDevice7::Proxy_GetDeviceState(THIS_ DWORD cbData, LPVOID lpvData) 26 | { 27 | static DWORD oldtime = 0; 28 | HRESULT Result; 29 | 30 | Result = m_Instance->GetDeviceState(cbData, lpvData); 31 | 32 | if (g_pRoCodeBind) 33 | g_pRoCodeBind->OneSyncProc(Result, lpvData, g_FreeMouseSw); 34 | 35 | return Result; 36 | } 37 | 38 | HRESULT CProxyIDirectInputDevice7::Proxy_SetCooperativeLevel(HWND hwnd, DWORD dwflags) 39 | { 40 | HRESULT Result; 41 | DEBUG_LOGGING_MORE_DETAIL(("lpDI->SetCooperativeLevel\n")); 42 | 43 | if (g_FreeMouseSw) 44 | dwflags = DISCL_NONEXCLUSIVE | DISCL_BACKGROUND; 45 | 46 | Result = m_Instance->SetCooperativeLevel(hwnd, dwflags); 47 | 48 | return Result; 49 | } 50 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /SimpleROHookCS/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General information about the assembly is controlled through the following set of attributes. 6 | // To change the information associated with the assembly, 7 | // Change these attribute values. 8 | [assembly: AssemblyTitle("SimpleROHookCS")] 9 | [assembly: AssemblyDescription("SimpleROHook\r\nLast development by @drdxxy\r\nOriginal code by @sekishi1259\r\nSetting up again in 2020-12-05 by @X-EcutiOnner")] 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 | // If ComVisible is set to false, its type will be from the COM component within this assembly. 18 | // It will be unreferenceable. If you want to access the types in this assembly from COM, 19 | // Set the ComVisible attribute for that type to true. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is the ID of typelib when this project is published to COM 23 | [assembly: Guid("b7475390-b2fd-4a47-b0d8-7c5004aeae17")] 24 | 25 | // Assembly version information consists of four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // Specify all values or use '*' as below for build and revision numbers 33 | // Can be the default: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("2.0.2.0")] 36 | [assembly: AssemblyFileVersion("2.0.2.0")] 37 | [assembly: AssemblyInformationalVersion("2.0.2.0 RC1")] 38 | -------------------------------------------------------------------------------- /Injection/ReadMe.txt: -------------------------------------------------------------------------------- 1 | ======================================================================== 2 | Dynamic Link Library: Injection Project Overview 3 | ======================================================================== 4 | 5 | This Injection DLL was created by AppWizard. 6 | 7 | This file contains Core 8 | Contains an overview of the contents of each file that makes up the application. 9 | 10 | 11 | Injection.vcxproj 12 | This is VC ++ generated using the application wizard 13 | The main project file for the project. 14 | Information about the version of Visual C ++ that generated the file and the application 15 | Platform selected by the wizard, 16 | Contains information about the configuration and project features. 17 | 18 | Injection.vcxproj.filters 19 | This is a filter for VC ++ projects generated by the Application Wizard 20 | It is a file. 21 | This file contains the association between the files in the project and the filters. 22 | Contains information. This association is specific no 23 | Group files with similar extensions 24 | Used by the IDE to indicate (for example, a ".cpp" file is a "source file" 25 | Associated with the filter). 26 | 27 | Injection.cpp 28 | This is the main DLL source file. 29 | 30 | ///////////////////////////////////////////////////////////////////////////// 31 | Other standard files: 32 | 33 | StdAfx.h, StdAfx.cpp 34 | These files are Injection.pch 35 | A precompiled header (PCH) file named and StdAfx.obj 36 | Used to build a precompiled type file named. 37 | 38 | ///////////////////////////////////////////////////////////////////////////// 39 | Other notes: 40 | 41 | In AppWizard "TODO:" 42 | Sources that users need to add or customize using comments 43 | Here is the code. 44 | 45 | ///////////////////////////////////////////////////////////////////////////// 46 | -------------------------------------------------------------------------------- /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 | components.Dispose(); 18 | 19 | base.Dispose(disposing); 20 | } 21 | 22 | #region Windows Form Designer generated code 23 | /// 24 | /// Required method for Designer support - do not modify 25 | /// the contents of this method with the code editor. 26 | /// 27 | private void InitializeComponent() 28 | { 29 | this.richTextBox_LogText = new System.Windows.Forms.RichTextBox(); 30 | this.SuspendLayout(); 31 | // 32 | // richTextBox_LogText 33 | // 34 | this.richTextBox_LogText.AutoWordSelection = true; 35 | this.richTextBox_LogText.Dock = System.Windows.Forms.DockStyle.Fill; 36 | this.richTextBox_LogText.Location = new System.Drawing.Point(0, 0); 37 | this.richTextBox_LogText.Name = "richTextBox_LogText"; 38 | this.richTextBox_LogText.ReadOnly = true; 39 | this.richTextBox_LogText.Size = new System.Drawing.Size(284, 262); 40 | this.richTextBox_LogText.TabIndex = 0; 41 | this.richTextBox_LogText.Text = ""; 42 | // 43 | // NPCLogger 44 | // 45 | this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F); 46 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; 47 | this.ClientSize = new System.Drawing.Size(284, 262); 48 | this.Controls.Add(this.richTextBox_LogText); 49 | this.Name = "NPC Logger"; 50 | this.Text = "NPC Logger"; 51 | this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.Window_FormClosing); 52 | this.ResumeLayout(false); 53 | 54 | } 55 | #endregion 56 | 57 | private System.Windows.Forms.RichTextBox richTextBox_LogText; 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /Injection/Core/FastFont/SFastFont.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | // #define D3D_OVERLOADS 6 | 7 | #include 8 | #include 9 | 10 | #include "FastFont.h" 11 | 12 | // d3ddev->DrawPrimitive(D3DPT_TRIANGLESTRIP, D3DFVF_TLVERTEX, vp, 4, 0); 13 | 14 | class CSFastFont 15 | { 16 | private: 17 | // Vertex relationship 18 | // #define SFF_FVF_CUSTOM (D3DFVF_XYZRHW | D3DFVF_DIFFUSE | D3DFVF_TEX1) // Coordinate converted vertices 19 | 20 | // struct SFF_CUSTOMVERTEX 21 | // { 22 | // float x, y, z; // Vertex coordinates 23 | // float rhw; // Arithmetic 24 | // DWORD dwColor; // Vertex color 25 | // float u, v; // Texture coordinates 26 | // }; 27 | 28 | typedef struct StSFontCacheInfo 29 | { 30 | DWORD OriginalKey; 31 | DWORD u, v, w, h; 32 | 33 | StSFontCacheInfo *pPrev; 34 | StSFontCacheInfo *pNext; 35 | 36 | StSFontCacheInfo *pPrevHash; 37 | StSFontCacheInfo *pNextHash; 38 | 39 | StSFontCacheInfo *pNextOrder; 40 | } StSFontCacheInfo; 41 | 42 | public: 43 | CSFastFont(void); 44 | virtual ~CSFastFont(void); 45 | 46 | bool CreateFastFont(LOGFONT *lplf, LPDIRECT3DDEVICE7 pDev, LPDIRECTDRAWSURFACE7 pTex, int imagemode = 0); 47 | 48 | StSFontCacheInfo *GetCacheData(int hashkey); 49 | 50 | bool CreateFontImageOrder(int fontcode, StSFontCacheInfo *pCache); 51 | void Flush(void); 52 | 53 | void DrawChar(int fontcode, int x, int y, DWORD FontColor, SIZE *pSize); 54 | void DrawText(LPSTR str, int x, int y, DWORD FontColor, int Arrange, SIZE *pSize); 55 | 56 | void DrawCharSC(int fontcode, int x, int y, float scx, float scy, DWORD FontColor, SIZE *pSize); 57 | void DrawTextSC(LPSTR str, int x, int y, float scx, float scy, DWORD FontColor, int Arrange, SIZE *pSize); 58 | void GetDrawSize(LPSTR str, float scx, float scy, SIZE *pSize); 59 | 60 | static bool SFontBlt16(void *pData, DWORD alpha); 61 | static bool SFontBlt16Black(void *pData, DWORD alpha); 62 | 63 | private: 64 | #define MAX_SSF_VERTEX (65536 * 6) 65 | 66 | D3DTLVERTEX m_SFF_Vertex[MAX_SSF_VERTEX]; 67 | int m_SSF_Vertex_index; 68 | 69 | CFastFont *m_pFastFont; 70 | int m_HashRootTables; 71 | 72 | StSFontCacheInfo *m_HashRootTable; 73 | StSFontCacheInfo *m_pSFontChacheInfo; 74 | 75 | StSFontCacheInfo *m_pLastSFontChacheInfo; 76 | StSFontCacheInfo *m_pLastSFontChacheInfoFirstUsed; 77 | 78 | StSFontCacheInfo *m_pCreateOrderInfo; 79 | 80 | IDirect3DDevice7 *m_d3ddev; 81 | IDirectDrawSurface7 *m_pTex; 82 | // LPDIRECT3DTEXTURE9 m_pTex; 83 | 84 | int m_ImageMode; 85 | 86 | int m_MaxImageWidth; 87 | int m_MaxImageHeight; 88 | 89 | int m_MaxFontWidth; 90 | int m_MaxFontHeight; 91 | 92 | int m_WidthCount; 93 | int m_HeightCount; 94 | int m_MaxCacheNums; 95 | }; 96 | -------------------------------------------------------------------------------- /SimpleROHookCS/Properties/Settings.Designer.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // Runtime Version:4.0.30319.42000 5 | // 6 | // Changes to this file may cause incorrect behavior and will be lost if 7 | // the code is regenerated. 8 | // 9 | //------------------------------------------------------------------------------ 10 | 11 | namespace SimpleROHookCS.Properties { 12 | 13 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] 14 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "17.3.0.0")] 15 | internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { 16 | 17 | private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); 18 | 19 | public static Settings Default { 20 | get { 21 | return defaultInstance; 22 | } 23 | } 24 | 25 | [global::System.Configuration.UserScopedSettingAttribute()] 26 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] 27 | [global::System.Configuration.DefaultSettingValueAttribute("0, 0, 200, 400")] 28 | public global::System.Drawing.Rectangle LoggerWinBounds { 29 | get { 30 | return ((global::System.Drawing.Rectangle)(this["LoggerWinBounds"])); 31 | } 32 | set { 33 | this["LoggerWinBounds"] = value; 34 | } 35 | } 36 | 37 | [global::System.Configuration.UserScopedSettingAttribute()] 38 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] 39 | [global::System.Configuration.DefaultSettingValueAttribute("Normal")] 40 | public global::System.Windows.Forms.FormWindowState LoggerWinState { 41 | get { 42 | return ((global::System.Windows.Forms.FormWindowState)(this["LoggerWinState"])); 43 | } 44 | set { 45 | this["LoggerWinState"] = value; 46 | } 47 | } 48 | 49 | [global::System.Configuration.UserScopedSettingAttribute()] 50 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] 51 | [global::System.Configuration.DefaultSettingValueAttribute("True")] 52 | public bool LoggerWinVisible { 53 | get { 54 | return ((bool)(this["LoggerWinVisible"])); 55 | } 56 | set { 57 | this["LoggerWinVisible"] = value; 58 | } 59 | } 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /Injection/Injection.rc: -------------------------------------------------------------------------------- 1 | // Microsoft Visual C++ generated resource script. 2 | #include "resource.h" 3 | 4 | ///////////////////////////////////////////////////////////////////////////// 5 | // 6 | // Generated from the TEXTINCLUDE 2 resource. 7 | // 8 | #define APSTUDIO_READONLY_SYMBOLS 9 | // #include "winres.h" 10 | #undef APSTUDIO_READONLY_SYMBOLS 11 | 12 | ///////////////////////////////////////////////////////////////////////////// 13 | #ifdef APSTUDIO_INVOKED 14 | #include "targetver.h" 15 | #endif 16 | 17 | #define APSTUDIO_HIDDEN_SYMBOLS 18 | #include "windows.h" 19 | #undef APSTUDIO_HIDDEN_SYMBOLS 20 | 21 | ///////////////////////////////////////////////////////////////////////////// 22 | // 23 | // Japanese (Japan) Resources 24 | // 25 | #if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_JPN) 26 | LANGUAGE LANG_JAPANESE, SUBLANG_DEFAULT 27 | 28 | ///////////////////////////////////////////////////////////////////////////// 29 | // 30 | // TEXTINCLUDE 31 | // 32 | #ifdef APSTUDIO_INVOKED 33 | 34 | 1 TEXTINCLUDE 35 | BEGIN 36 | "resource.h\0" 37 | END 38 | 39 | 2 TEXTINCLUDE 40 | BEGIN 41 | "#ifdef APSTUDIO_INVOKED\r\n" 42 | "#include ""targetver.h""\r\n" 43 | "#endif\r\n" 44 | "#define APSTUDIO_HIDDEN_SYMBOLS\r\n" 45 | "#include ""windows.h""\r\n" 46 | "#undef APSTUDIO_HIDDEN_SYMBOLS\r\n" 47 | "\0" 48 | END 49 | 50 | 3 TEXTINCLUDE 51 | BEGIN 52 | "\r\n" 53 | "\0" 54 | END 55 | 56 | #endif // APSTUDIO_INVOKED 57 | 58 | ///////////////////////////////////////////////////////////////////////////// 59 | // 60 | // Version Info 61 | // 62 | VS_VERSION_INFO VERSIONINFO 63 | FILEVERSION 1, 0, 0, 8 64 | PRODUCTVERSION 1, 0, 0, 8 65 | FILEFLAGSMASK 0x3fL 66 | 67 | #ifdef _DEBUG 68 | FILEFLAGS 0x1L 69 | #else 70 | FILEFLAGS 0x0L 71 | #endif 72 | 73 | FILEOS 0x40004L 74 | FILETYPE 0x2L 75 | FILESUBTYPE 0x0L 76 | 77 | BEGIN 78 | BLOCK "StringFileInfo" 79 | BEGIN 80 | BLOCK "040904b0" 81 | BEGIN 82 | VALUE "CompanyName", "planetleaf.com Lab" 83 | VALUE "FileDescription", "SimpleROHook Module" 84 | VALUE "FileVersion", "1.0.0.8" 85 | VALUE "InternalName", "Injection.dll" 86 | VALUE "LegalCopyright", "Copyright (C) 2014 redchat / planetleaf.com Lab" 87 | VALUE "OriginalFilename", "Injection.dll" 88 | VALUE "ProductName", "SimpleROHook Module" 89 | VALUE "ProductVersion", "1.0.0.8" 90 | END 91 | END 92 | 93 | BLOCK "VarFileInfo" 94 | BEGIN 95 | VALUE "Translation", 0x409, 1200 96 | END 97 | END 98 | 99 | #endif // Japanese (Japan) Resources 100 | 101 | ///////////////////////////////////////////////////////////////////////////// 102 | // 103 | // Generated from the TEXTINCLUDE 3 resource. 104 | // 105 | #ifndef APSTUDIO_INVOKED 106 | 107 | #endif // Not APSTUDIO_INVOKED 108 | 109 | ///////////////////////////////////////////////////////////////////////////// 110 | -------------------------------------------------------------------------------- /SimpleROHookCS/ToolStripTrackBar.cs: -------------------------------------------------------------------------------- 1 | using System.Windows.Forms; 2 | using System.Windows.Forms.Design; 3 | 4 | namespace SimpleROHookCS 5 | { 6 | [ToolStripItemDesignerAvailability(ToolStripItemDesignerAvailability.MenuStrip | ToolStripItemDesignerAvailability.ContextMenuStrip)] 7 | public class ToolStripTrackBar : ToolStripControlHost 8 | { 9 | // private TrackBar trackBar; 10 | 11 | public ToolStripTrackBar() : base(new TrackBar()) 12 | { 13 | // Empty 14 | } 15 | 16 | public TrackBar TrackBarControl 17 | { 18 | get 19 | { 20 | return Control as TrackBar; 21 | } 22 | } 23 | 24 | // Add properties, events etc. you want to expose... 25 | public void SetMinMax(int min, int max) 26 | { 27 | TrackBarControl.Minimum = min; 28 | TrackBarControl.Maximum = max; 29 | } 30 | 31 | public void SetTickFrequency(int tick) 32 | { 33 | TrackBarControl.TickFrequency = tick; 34 | } 35 | 36 | public int Value 37 | { 38 | get 39 | { 40 | return TrackBarControl.Value; 41 | } 42 | 43 | set 44 | { 45 | TrackBarControl.Value = value; 46 | } 47 | } 48 | 49 | public void SetChangeValue(int small, int large) 50 | { 51 | TrackBarControl.SmallChange = small; 52 | TrackBarControl.LargeChange = large; 53 | } 54 | 55 | protected override void OnSubscribeControlEvents(Control c) 56 | { 57 | // Call the base so the base events are connected. 58 | base.OnSubscribeControlEvents(c); 59 | 60 | // Cast Control to a TrackBar control. 61 | TrackBar trackBarContol = (TrackBar)c; 62 | 63 | // Add the event. 64 | trackBarContol.ValueChanged += new System.EventHandler(OnValueChanged); 65 | } 66 | 67 | protected override void OnUnsubscribeControlEvents(Control c) 68 | { 69 | // Call the base method so the basic event are unsubscribed. 70 | base.OnUnsubscribeControlEvents(c); 71 | 72 | // Cast the controle to a TrackBar control. 73 | TrackBar trackBarContol = (TrackBar)c; 74 | 75 | // Remove the event. 76 | trackBarContol.ValueChanged -= new System.EventHandler(OnValueChanged); 77 | } 78 | 79 | // Declare the TrackBar event. 80 | public event System.EventHandler ValueChanged; 81 | 82 | // Raise the TrackBar event. 83 | private void OnValueChanged(object sender, System.EventArgs e) 84 | { 85 | if (ValueChanged != null) 86 | { 87 | ValueChanged(this, e); 88 | } 89 | } 90 | } 91 | } 92 | -------------------------------------------------------------------------------- /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 | /// This is the main entry point of the application. 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 | 38 | IntPtr intPtrInstall = GetProcAddress(hModule, @"InstallHook"); 39 | IntPtr intPtrRemove = GetProcAddress(hModule, @"RemoveHook"); 40 | 41 | if (intPtrInstall == IntPtr.Zero) 42 | { 43 | MessageBox.Show("error:InstallHook function is not included in Core.dll."); 44 | FreeLibrary(hModule); 45 | return; 46 | } 47 | 48 | if (intPtrRemove == IntPtr.Zero) 49 | { 50 | MessageBox.Show("error:intPtrRemove function is not included in Core.dll."); 51 | FreeLibrary(hModule); 52 | return; 53 | } 54 | 55 | HOOKFUNC InstallHook = 56 | (HOOKFUNC)Marshal.GetDelegateForFunctionPointer 57 | (intPtrInstall, typeof(HOOKFUNC)); 58 | HOOKFUNC RemoveHook = 59 | (HOOKFUNC)Marshal.GetDelegateForFunctionPointer 60 | (intPtrRemove, typeof(HOOKFUNC)); 61 | 62 | Application.EnableVisualStyles(); 63 | Application.SetCompatibleTextRenderingDefault(false); 64 | 65 | InstallHook(); 66 | 67 | Application.Run(new MainForm()); 68 | 69 | RemoveHook(); 70 | FreeLibrary(hModule); 71 | } 72 | } 73 | } 74 | } 75 | } 76 | -------------------------------------------------------------------------------- /SimpleROHookCS/Properties/Resources.Designer.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // Runtime Version:4.0.30319.42000 5 | // 6 | // Changes to this file may cause incorrect behavior and will be lost if 7 | // the code is regenerated. 8 | // 9 | //------------------------------------------------------------------------------ 10 | 11 | namespace SimpleROHookCS.Properties { 12 | using System; 13 | 14 | /// 15 | /// A strongly-typed resource class, for looking up localized strings, etc. 16 | /// 17 | // This class was auto-generated by the StronglyTypedResourceBuilder 18 | // class via a tool like ResGen or Visual Studio. 19 | // To add or remove a member, edit your .ResX file then rerun ResGen 20 | // with the /str option, or rebuild your VS project. 21 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")] 22 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] 23 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] 24 | internal class Resources { 25 | 26 | private static global::System.Resources.ResourceManager resourceMan; 27 | 28 | private static global::System.Globalization.CultureInfo resourceCulture; 29 | 30 | [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] 31 | internal Resources() { 32 | } 33 | 34 | /// 35 | /// Returns the cached ResourceManager instance used by this class. 36 | /// 37 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] 38 | internal static global::System.Resources.ResourceManager ResourceManager { 39 | get { 40 | if (object.ReferenceEquals(resourceMan, null)) { 41 | global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("SimpleROHookCS.Properties.Resources", typeof(Resources).Assembly); 42 | resourceMan = temp; 43 | } 44 | return resourceMan; 45 | } 46 | } 47 | 48 | /// 49 | /// Overrides the current thread's CurrentUICulture property for all 50 | /// resource lookups using this strongly typed resource class. 51 | /// 52 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] 53 | internal static global::System.Globalization.CultureInfo Culture { 54 | get { 55 | return resourceCulture; 56 | } 57 | set { 58 | resourceCulture = value; 59 | } 60 | } 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /SimpleROHook.sln: -------------------------------------------------------------------------------- 1 | 2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 14 4 | VisualStudioVersion = 14.0.25420.1 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 | Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{AEC7405B-1464-4B2E-A903-4ECD118B705F}" 11 | ProjectSection(SolutionItems) = preProject 12 | README.md = README.md 13 | EndProjectSection 14 | EndProject 15 | Global 16 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 17 | Debug|Mixed Platforms = Debug|Mixed Platforms 18 | Debug|Win32 = Debug|Win32 19 | Debug|x86 = Debug|x86 20 | Release|Mixed Platforms = Release|Mixed Platforms 21 | Release|Win32 = Release|Win32 22 | Release|x86 = Release|x86 23 | EndGlobalSection 24 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 25 | {46651709-BCBF-4645-8CE6-11EBA347A529}.Debug|Mixed Platforms.ActiveCfg = Debug|Win32 26 | {46651709-BCBF-4645-8CE6-11EBA347A529}.Debug|Mixed Platforms.Build.0 = Debug|Win32 27 | {46651709-BCBF-4645-8CE6-11EBA347A529}.Debug|Win32.ActiveCfg = Debug|Win32 28 | {46651709-BCBF-4645-8CE6-11EBA347A529}.Debug|Win32.Build.0 = Debug|Win32 29 | {46651709-BCBF-4645-8CE6-11EBA347A529}.Debug|x86.ActiveCfg = Debug|Win32 30 | {46651709-BCBF-4645-8CE6-11EBA347A529}.Debug|x86.Build.0 = Debug|Win32 31 | {46651709-BCBF-4645-8CE6-11EBA347A529}.Release|Mixed Platforms.ActiveCfg = Release|Win32 32 | {46651709-BCBF-4645-8CE6-11EBA347A529}.Release|Mixed Platforms.Build.0 = Release|Win32 33 | {46651709-BCBF-4645-8CE6-11EBA347A529}.Release|Win32.ActiveCfg = Release|Win32 34 | {46651709-BCBF-4645-8CE6-11EBA347A529}.Release|Win32.Build.0 = Release|Win32 35 | {46651709-BCBF-4645-8CE6-11EBA347A529}.Release|x86.ActiveCfg = Release|Win32 36 | {46651709-BCBF-4645-8CE6-11EBA347A529}.Release|x86.Build.0 = Release|Win32 37 | {DD2A9D1E-449E-4F85-B3CA-934212878CEA}.Debug|Mixed Platforms.ActiveCfg = Debug|x86 38 | {DD2A9D1E-449E-4F85-B3CA-934212878CEA}.Debug|Mixed Platforms.Build.0 = Debug|x86 39 | {DD2A9D1E-449E-4F85-B3CA-934212878CEA}.Debug|Win32.ActiveCfg = Debug|x86 40 | {DD2A9D1E-449E-4F85-B3CA-934212878CEA}.Debug|Win32.Build.0 = Debug|x86 41 | {DD2A9D1E-449E-4F85-B3CA-934212878CEA}.Debug|x86.ActiveCfg = Debug|x86 42 | {DD2A9D1E-449E-4F85-B3CA-934212878CEA}.Debug|x86.Build.0 = Debug|x86 43 | {DD2A9D1E-449E-4F85-B3CA-934212878CEA}.Release|Mixed Platforms.ActiveCfg = Release|x86 44 | {DD2A9D1E-449E-4F85-B3CA-934212878CEA}.Release|Mixed Platforms.Build.0 = Release|x86 45 | {DD2A9D1E-449E-4F85-B3CA-934212878CEA}.Release|Win32.ActiveCfg = Release|x86 46 | {DD2A9D1E-449E-4F85-B3CA-934212878CEA}.Release|Win32.Build.0 = Release|x86 47 | {DD2A9D1E-449E-4F85-B3CA-934212878CEA}.Release|x86.ActiveCfg = Release|x86 48 | {DD2A9D1E-449E-4F85-B3CA-934212878CEA}.Release|x86.Build.0 = Release|x86 49 | EndGlobalSection 50 | GlobalSection(SolutionProperties) = preSolution 51 | HideSolutionNode = FALSE 52 | EndGlobalSection 53 | EndGlobal 54 | -------------------------------------------------------------------------------- /Injection/Core/SearchCode.h: -------------------------------------------------------------------------------- 1 | class CSearchCode 2 | { 3 | private: 4 | typedef struct StFindMemInfo 5 | { 6 | unsigned char x; 7 | char flag; 8 | } StFindMemInfo; 9 | 10 | enum enCOMPAREMODE 11 | { 12 | enCOMPAREWILDCARD = 0, 13 | enCOMPARENORMAL = 1, 14 | }; 15 | 16 | std::vector m_FindInfo; 17 | std::map m_MakerIndex; 18 | 19 | char ahex2i(char code) 20 | { 21 | if (code >= '0' && code <= '9') 22 | return (code - '0'); 23 | else if (code >= 'a' && code <= 'z') 24 | return (code - 'a' + 0x0a); 25 | else 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 | 41 | if (!h2) 42 | break; 43 | 44 | if (h1 == '*') 45 | { 46 | // Wildcard 47 | tempInfo.x = 0x00; 48 | tempInfo.flag = enCOMPAREWILDCARD; 49 | m_FindInfo.push_back(tempInfo); 50 | 51 | if (h2 != '*') 52 | m_MakerIndex[h2] = m_FindInfo.size() - 1; 53 | } 54 | else 55 | { 56 | tempInfo.x = (ahex2i(h1) << 4) | ahex2i(h2); 57 | tempInfo.flag = enCOMPARENORMAL; 58 | m_FindInfo.push_back(tempInfo); 59 | } 60 | } 61 | } 62 | 63 | CSearchCode(int comparemode, char *pattern) 64 | { 65 | StFindMemInfo tempInfo; 66 | tempInfo.flag = enCOMPARENORMAL; 67 | 68 | while (*pattern != 0) 69 | { 70 | tempInfo.x = *pattern++; 71 | m_FindInfo.push_back(tempInfo); 72 | } 73 | 74 | tempInfo.x = 0; 75 | m_FindInfo.push_back(tempInfo); 76 | } 77 | 78 | ~CSearchCode() {} 79 | 80 | int GetMakerIndex(char code) 81 | { 82 | return m_MakerIndex[code]; 83 | } 84 | 85 | BOOL PatternMatcher(LPBYTE address) 86 | { 87 | int nums = m_FindInfo.size(); 88 | 89 | for (int ii = 0; ii < nums; ii++) 90 | { 91 | if (m_FindInfo[ii].flag && (m_FindInfo[ii].x != address[ii])) 92 | return FALSE; 93 | } 94 | 95 | return TRUE; 96 | } 97 | 98 | LPVOID GetTagAddress(LPBYTE address, char code) 99 | { 100 | return (LPVOID)(address + GetMakerIndex(code)); 101 | } 102 | 103 | DWORD GetImmediateDWORD(LPBYTE address, char code) 104 | { 105 | return *(DWORD*)(address + GetMakerIndex(code)); 106 | } 107 | 108 | DWORD Get4BIndexDWORD(LPBYTE address, char code) 109 | { 110 | LPBYTE targetaddress = address + GetMakerIndex(code); 111 | return (*(DWORD*)targetaddress) + (DWORD)(targetaddress + 4); 112 | } 113 | 114 | DWORD GetNearJmpAddress(LPBYTE address, char code) 115 | { 116 | DWORD im_calladdress = *(DWORD*)(address + GetMakerIndex(code)); 117 | 118 | // Convert to immediate address 119 | im_calladdress += (DWORD)address + GetMakerIndex(code) + 4; 120 | 121 | return im_calladdress; 122 | } 123 | 124 | BOOL NearJmpAddressMatcher(LPBYTE address, char code, DWORD calladdress) 125 | { 126 | DWORD im_calladdress = *(DWORD*)(address + GetMakerIndex(code)); 127 | 128 | // Convert to immediate address 129 | im_calladdress += (DWORD)address + GetMakerIndex(code) + 4; 130 | 131 | if (im_calladdress == calladdress) 132 | return TRUE; 133 | 134 | return FALSE; 135 | } 136 | 137 | int GetSize() 138 | { 139 | return m_FindInfo.size(); 140 | } 141 | }; 142 | -------------------------------------------------------------------------------- /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("About {0}", AssemblyTitle); 17 | this.labelProductName.Text = AssemblyProduct; 18 | this.labelVersion.Text = String.Format("Version {0}", AssemblyVersion); 19 | this.labelCopyright.Text = AssemblyCopyright; 20 | this.labelCompanyName.Text = AssemblyCompany; 21 | this.textBoxDescription.Text = AssemblyDescription; 22 | } 23 | 24 | #region Assembly attribute accessor 25 | public string AssemblyTitle 26 | { 27 | get 28 | { 29 | object[] attributes = Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(AssemblyTitleAttribute), false); 30 | 31 | if (attributes.Length > 0) 32 | { 33 | AssemblyTitleAttribute titleAttribute = (AssemblyTitleAttribute)attributes[0]; 34 | 35 | if (titleAttribute.Title != "") 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 | 57 | if (attributes.Length == 0) 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 | 70 | if (attributes.Length == 0) 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 | 83 | if (attributes.Length == 0) 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 | 96 | if (attributes.Length == 0) 97 | return ""; 98 | 99 | return ((AssemblyCompanyAttribute)attributes[0]).Company; 100 | } 101 | } 102 | #endregion 103 | 104 | } 105 | } 106 | -------------------------------------------------------------------------------- /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; 18 | 19 | CreateParams cp = base.CreateParams; 20 | cp.ClassStyle = cp.ClassStyle | CS_NOCLOSE; 21 | cp.ExStyle = WS_EX_TOOLWINDOW; 22 | 23 | return cp; 24 | } 25 | } 26 | 27 | [StructLayout(LayoutKind.Sequential)] 28 | private struct COPYDATASTRUCT 29 | { 30 | public IntPtr dwData; 31 | public int cbData; 32 | public IntPtr lpData; 33 | } 34 | 35 | private const int WM_COPYDATA = 0x4A; 36 | private const int NPCLOGLINE_MAX = 30001; 37 | private int m_textcolor; 38 | 39 | public NPCLogger() 40 | { 41 | InitializeComponent(); 42 | m_textcolor = 0; 43 | } 44 | 45 | private void AppendNPCMessage(string message) 46 | { 47 | int indextop = 0; 48 | 49 | richTextBox_LogText.Enabled = false; 50 | 51 | for (int ii = 0; ii < message.Length; ii++) 52 | { 53 | if (message[ii] == '^') 54 | { 55 | if (indextop != ii) 56 | { 57 | richTextBox_LogText.SelectionColor = Color.FromArgb(m_textcolor); 58 | richTextBox_LogText.AppendText(message.Substring(indextop, ii - indextop)); 59 | } 60 | 61 | string colorhex = message.Substring(ii + 1, 6); 62 | m_textcolor = Convert.ToInt32(colorhex, 16); 63 | ii += 7; 64 | indextop = ii; 65 | } 66 | } 67 | 68 | richTextBox_LogText.SelectionColor = Color.FromArgb(m_textcolor); 69 | richTextBox_LogText.AppendText(message.Substring(indextop)); 70 | richTextBox_LogText.AppendText(Environment.NewLine); 71 | 72 | if (richTextBox_LogText.Lines.Length > NPCLOGLINE_MAX) 73 | { 74 | richTextBox_LogText.ReadOnly = false; 75 | richTextBox_LogText.Select(0, richTextBox_LogText.Lines[0].Length + 1); 76 | richTextBox_LogText.SelectedText = String.Empty; 77 | richTextBox_LogText.ReadOnly = true; 78 | } 79 | 80 | richTextBox_LogText.Enabled = true; 81 | richTextBox_LogText.Focus(); 82 | richTextBox_LogText.ScrollToCaret(); 83 | } 84 | 85 | protected override void WndProc(ref Message m) 86 | { 87 | if (m.Msg == WM_COPYDATA) 88 | { 89 | COPYDATASTRUCT data = new COPYDATASTRUCT(); 90 | data = (COPYDATASTRUCT)Marshal.PtrToStructure(m.LParam, typeof(COPYDATASTRUCT)); 91 | 92 | if (data.dwData == (IntPtr)COPYDATAENTRY.COPYDATA_NPCLogger && data.cbData > 0) 93 | { 94 | char[] buffer = new char[data.cbData / 2]; 95 | Marshal.Copy(data.lpData, buffer, 0, data.cbData / 2); 96 | 97 | string npcmessage = new string(buffer); 98 | AppendNPCMessage(npcmessage); 99 | } 100 | } 101 | 102 | base.WndProc(ref m); 103 | } 104 | 105 | private void Window_FormClosing(object sender, FormClosingEventArgs e) 106 | { 107 | if (Visible) 108 | { 109 | e.Cancel = true; 110 | this.Hide(); 111 | } 112 | } 113 | } 114 | } 115 | -------------------------------------------------------------------------------- /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 | double *m_dticklist; 11 | int m_ticklist_index; 12 | int m_ticklist_size; 13 | 14 | int m_FrameCounter; 15 | int m_FrameCount; 16 | int m_SampleTerm; 17 | int m_FrameList[1024]; 18 | int m_MonitorRefreshRate; 19 | double m_FrameRate; 20 | 21 | public: 22 | 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) 23 | { 24 | if (QueryPerformanceCounter(&m_Counter) != 0) 25 | { 26 | m_OldCounter = m_Counter.QuadPart; 27 | LARGE_INTEGER Freq; 28 | QueryPerformanceFrequency(&Freq); 29 | m_dFreq = (double)Freq.QuadPart; 30 | } 31 | else 32 | { 33 | m_OldCounter = (LONGLONG)::timeGetTime(); 34 | } 35 | 36 | m_ticklist_size = step; 37 | m_dticklist = new double[m_ticklist_size]; 38 | 39 | for (int ii = 0; ii < m_ticklist_size; ii++) 40 | m_dticklist[ii] = 0.0; 41 | } 42 | 43 | virtual ~CPerformanceCounter() 44 | { 45 | delete[] m_dticklist; 46 | } 47 | 48 | void InitInstaltPerformance(void) 49 | { 50 | if (QueryPerformanceCounter(&m_Counter) != 0) 51 | m_OldInstantCounter = m_Counter.QuadPart; 52 | else 53 | m_OldInstantCounter = (LONGLONG)::timeGetTime();; 54 | } 55 | 56 | void SetMonitorRefreshRate(int value) 57 | { 58 | m_MonitorRefreshRate = value; 59 | } 60 | 61 | int GetMonitorRefreshRate(void) 62 | { 63 | return m_MonitorRefreshRate; 64 | } 65 | 66 | int GetFrameRate(void) 67 | { 68 | return (int)(m_FrameRate + 0.9); 69 | } 70 | 71 | void ModifiFrameRate(void) 72 | { 73 | int Tick = timeGetTime(); 74 | 75 | for (int index = m_FrameCount - 1; index >= 0; index--) 76 | { 77 | if (m_FrameList[index] + m_SampleTerm <= Tick) 78 | m_FrameCount = index; 79 | else 80 | break; 81 | } 82 | 83 | memmove(m_FrameList + 1, m_FrameList, sizeof(m_FrameList[0]) * m_FrameCount); 84 | m_FrameList[0] = Tick; 85 | m_FrameCount++; 86 | 87 | if (m_FrameCount > sizeof(m_FrameList) / sizeof(m_FrameList[0]) - 10) 88 | { 89 | m_FrameCount = sizeof(m_FrameList) / sizeof(m_FrameList[0]) - 10; 90 | m_FrameRate = -1.0; 91 | 92 | return; 93 | } 94 | else 95 | { 96 | int Time = Tick - m_FrameList[m_FrameCount - 1]; 97 | 98 | if (Time > 0 && m_FrameCount >= 2) 99 | { 100 | m_FrameRate = (double)(m_FrameCount - 1) * (double)m_SampleTerm / (double)Time; 101 | 102 | if (m_FrameRate > (double)m_MonitorRefreshRate) 103 | m_FrameRate = (double)m_MonitorRefreshRate; 104 | } 105 | else 106 | { 107 | m_FrameRate = -1.0; 108 | } 109 | } 110 | } 111 | 112 | double CalcInstaltPerformance(void) 113 | { 114 | double tick; 115 | 116 | if (QueryPerformanceCounter(&m_Counter) != 0) 117 | { 118 | LONGLONG m_temptick = m_Counter.QuadPart; 119 | tick = ((double)(m_temptick - m_OldInstantCounter)) * 1000 / m_dFreq; 120 | m_OldInstantCounter = m_temptick; 121 | } 122 | else 123 | { 124 | LONGLONG m_temptick = (LONGLONG)::timeGetTime(); 125 | tick = (double)(m_temptick - m_OldCounter); 126 | m_OldInstantCounter = m_temptick; 127 | } 128 | 129 | return tick; 130 | } 131 | 132 | void SetCounter(double tick) 133 | { 134 | m_dticklist[m_ticklist_index] = tick; 135 | m_ticklist_index = (m_ticklist_index + 1) % m_ticklist_size; 136 | } 137 | 138 | void ModifiCounter(void) 139 | { 140 | if (QueryPerformanceCounter(&m_Counter) != 0) 141 | { 142 | LONGLONG m_temptick = m_Counter.QuadPart; 143 | double tick = ((double)(m_temptick - m_OldCounter)) * 1000 / m_dFreq; 144 | m_OldCounter = m_temptick; 145 | SetCounter(tick); 146 | } 147 | else 148 | { 149 | LONGLONG m_temptick = (LONGLONG)::timeGetTime(); 150 | double tick = (double)(m_temptick - m_OldCounter); 151 | m_OldCounter = m_temptick; 152 | SetCounter(tick); 153 | } 154 | } 155 | 156 | double GetTotalTick(void) 157 | { 158 | double tick = 0.0; 159 | 160 | for (int ii = 0; ii < m_ticklist_size; ii++) 161 | tick += m_dticklist[ii]; 162 | 163 | tick /= (double)m_ticklist_size; 164 | 165 | return tick; 166 | } 167 | }; 168 | -------------------------------------------------------------------------------- /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 | 9 | public: 10 | CProxyIDirectInput7(IDirectInput7 *ptr) : m_Instance(ptr) {} 11 | 12 | /*** IUnknown methods ***/ 13 | STDMETHOD(QueryInterface)(THIS_ REFIID p1, LPVOID *p2) PROXY2(QueryInterface) 14 | STDMETHOD_(ULONG, AddRef)(THIS) PROXY0(AddRef) 15 | STDMETHOD_(ULONG, Release)(THIS) PROXY_RELEASE 16 | 17 | /*** IDirectInput2A methods ***/ 18 | // 19 | STDMETHOD(CreateDevice)(THIS_ REFGUID rguid, LPDIRECTINPUTDEVICEA *lpIDD, LPUNKNOWN pUnkOuter) 20 | { 21 | return Proxy_CreateDevice(rguid, lpIDD, pUnkOuter); 22 | } 23 | 24 | STDMETHOD(EnumDevices)(THIS_ DWORD p1, LPDIENUMDEVICESCALLBACKA p2, LPVOID p3, DWORD p4) PROXY4(EnumDevices) 25 | STDMETHOD(GetDeviceStatus)(THIS_ REFGUID p1) PROXY1(GetDeviceStatus) 26 | STDMETHOD(RunControlPanel)(THIS_ HWND p1, DWORD p2) PROXY2(RunControlPanel) 27 | STDMETHOD(Initialize)(THIS_ HINSTANCE p1, DWORD p2) PROXY2(Initialize) 28 | STDMETHOD(FindDevice)(THIS_ REFGUID p1, LPCSTR p2, LPGUID p3) PROXY3(FindDevice) 29 | 30 | /*** IDirectInput7A methods ***/ 31 | STDMETHOD(CreateDeviceEx)(THIS_ REFGUID p1, REFIID p2, LPVOID *p3, LPUNKNOWN p4) PROXY4(CreateDeviceEx) 32 | 33 | // 34 | // Proxy Functions 35 | // 36 | HRESULT Proxy_CreateDevice(THIS_ REFGUID rguid, LPDIRECTINPUTDEVICEA *lpIDD, LPUNKNOWN pUnkOuter); 37 | }; 38 | #undef CLASSNAME 39 | 40 | #define CLASSNAME "IDirectInputDevice7" 41 | class CProxyIDirectInputDevice7 : public IDirectInputDevice7 42 | { 43 | private: 44 | IDirectInputDevice7 *m_Instance; 45 | 46 | public: 47 | CProxyIDirectInputDevice7(IDirectInputDevice7 *ptr) : m_Instance(ptr) {} 48 | 49 | /*** IUnknown methods ***/ 50 | STDMETHOD(QueryInterface)(THIS_ REFIID p1, LPVOID *p2) PROXY2(QueryInterface) 51 | STDMETHOD_(ULONG, AddRef)(THIS) PROXY0(AddRef) 52 | STDMETHOD_(ULONG, Release)(THIS) PROXY_RELEASE 53 | 54 | /*** IDirectInputDevice2W methods ***/ 55 | STDMETHOD(GetCapabilities)(THIS_ LPDIDEVCAPS p1) PROXY1(GetCapabilities) 56 | STDMETHOD(EnumObjects)(THIS_ LPDIENUMDEVICEOBJECTSCALLBACKA p1, LPVOID p2, DWORD p3) PROXY3(EnumObjects) 57 | STDMETHOD(GetProperty)(THIS_ REFGUID p1, LPDIPROPHEADER p2) PROXY2(GetProperty) 58 | STDMETHOD(SetProperty)(THIS_ REFGUID p1, LPCDIPROPHEADER p2) PROXY2(SetProperty) 59 | STDMETHOD(Acquire)(THIS) PROXY0(Acquire) 60 | STDMETHOD(Unacquire)(THIS) PROXY0(Unacquire) 61 | STDMETHOD(GetDeviceState)(THIS_ DWORD p1, LPVOID p2) 62 | { 63 | return Proxy_GetDeviceState(p1, p2); 64 | } 65 | 66 | STDMETHOD(GetDeviceData)(THIS_ DWORD p1, LPDIDEVICEOBJECTDATA p2, LPDWORD p3, DWORD p4) PROXY4(GetDeviceData) 67 | STDMETHOD(SetDataFormat)(THIS_ LPCDIDATAFORMAT p1) PROXY1(SetDataFormat) 68 | STDMETHOD(SetCooperativeLevel)(THIS_ HWND p1, DWORD p2) 69 | { 70 | return Proxy_SetCooperativeLevel(p1, p2); 71 | } 72 | 73 | STDMETHOD(SetEventNotification)(THIS_ HANDLE p1) PROXY1(SetEventNotification) 74 | 75 | STDMETHOD(GetObjectInfo)(THIS_ LPDIDEVICEOBJECTINSTANCEA p1, DWORD p2, DWORD p3) PROXY3(GetObjectInfo) 76 | STDMETHOD(GetDeviceInfo)(THIS_ LPDIDEVICEINSTANCEA p1) PROXY1(GetDeviceInfo) 77 | STDMETHOD(RunControlPanel)(THIS_ HWND p1, DWORD p2) PROXY2(RunControlPanel) 78 | STDMETHOD(Initialize)(THIS_ HINSTANCE p1, DWORD p2, REFGUID p3) PROXY3(Initialize) 79 | STDMETHOD(CreateEffect)(THIS_ REFGUID p1, LPCDIEFFECT p2, LPDIRECTINPUTEFFECT *p3, LPUNKNOWN p4) PROXY4(CreateEffect) 80 | STDMETHOD(EnumEffects)(THIS_ LPDIENUMEFFECTSCALLBACKA p1, LPVOID p2, DWORD p3) PROXY3(EnumEffects) 81 | STDMETHOD(GetEffectInfo)(THIS_ LPDIEFFECTINFOA p1, REFGUID p2) PROXY2(GetEffectInfo) 82 | STDMETHOD(GetForceFeedbackState)(THIS_ LPDWORD p1) PROXY1(GetForceFeedbackState) 83 | STDMETHOD(SendForceFeedbackCommand)(THIS_ DWORD p1) PROXY1(SendForceFeedbackCommand) 84 | STDMETHOD(EnumCreatedEffectObjects)(THIS_ LPDIENUMCREATEDEFFECTOBJECTSCALLBACK p1, LPVOID p2, DWORD p3) PROXY3(EnumCreatedEffectObjects) 85 | STDMETHOD(Escape)(THIS_ LPDIEFFESCAPE p1) PROXY1(Escape) 86 | STDMETHOD(Poll)(THIS) PROXY0(Poll) 87 | STDMETHOD(SendDeviceData)(THIS_ DWORD p1, LPCDIDEVICEOBJECTDATA p2, LPDWORD p3, DWORD p4) PROXY4(SendDeviceData) 88 | 89 | /*** IDirectInputDevice7W methods ***/ 90 | STDMETHOD(EnumEffectsInFile)(THIS_ LPCSTR p1, LPDIENUMEFFECTSINFILECALLBACK p2, LPVOID p3, DWORD p4) PROXY4(EnumEffectsInFile) 91 | STDMETHOD(WriteEffectToFile)(THIS_ LPCSTR p1, DWORD p2, LPDIFILEEFFECT p3, DWORD p4) PROXY4(WriteEffectToFile) 92 | 93 | // 94 | // Proxy Functions 95 | // 96 | HRESULT Proxy_GetDeviceState(THIS_ DWORD cbData, LPVOID lpvData); 97 | HRESULT Proxy_SetCooperativeLevel(HWND hwnd, DWORD dwflags); 98 | }; 99 | #undef CLASSNAME 100 | -------------------------------------------------------------------------------- /thirdparty.txt: -------------------------------------------------------------------------------- 1 | ================================================================================ 2 | Portions of this software are Copyright (C) 2009-2017 Tsuda Kageyu. 3 | ================================================================================ 4 | MinHook - The Minimalistic API Hooking Library for x64/x86 5 | Copyright (C) 2009-2017 Tsuda Kageyu. 6 | All rights reserved. 7 | 8 | Redistribution and use in source and binary forms, with or without 9 | modification, are permitted provided that the following conditions 10 | are met: 11 | 12 | 1. Redistributions of source code must retain the above copyright 13 | notice, this list of conditions and the following disclaimer. 14 | 2. Redistributions in binary form must reproduce the above copyright 15 | notice, this list of conditions and the following disclaimer in the 16 | documentation and/or other materials provided with the distribution. 17 | 18 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 20 | TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A 21 | PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER 22 | OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 23 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 24 | PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 25 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 26 | LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 27 | NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 28 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | 30 | ================================================================================ 31 | Portions of this software are Copyright (c) 2008-2009, Vyacheslav Patkov. 32 | ================================================================================ 33 | Hacker Disassembler Engine 32 C 34 | Copyright (c) 2008-2009, Vyacheslav Patkov. 35 | All rights reserved. 36 | 37 | Redistribution and use in source and binary forms, with or without 38 | modification, are permitted provided that the following conditions 39 | are met: 40 | 41 | 1. Redistributions of source code must retain the above copyright 42 | notice, this list of conditions and the following disclaimer. 43 | 2. Redistributions in binary form must reproduce the above copyright 44 | notice, this list of conditions and the following disclaimer in the 45 | documentation and/or other materials provided with the distribution. 46 | 47 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 48 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 49 | TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A 50 | PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR 51 | CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 52 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 53 | PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 54 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 55 | LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 56 | NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 57 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 58 | 59 | ------------------------------------------------------------------------------- 60 | Hacker Disassembler Engine 64 C 61 | Copyright (c) 2008-2009, Vyacheslav Patkov. 62 | All rights reserved. 63 | 64 | Redistribution and use in source and binary forms, with or without 65 | modification, are permitted provided that the following conditions 66 | are met: 67 | 68 | 1. Redistributions of source code must retain the above copyright 69 | notice, this list of conditions and the following disclaimer. 70 | 2. Redistributions in binary form must reproduce the above copyright 71 | notice, this list of conditions and the following disclaimer in the 72 | documentation and/or other materials provided with the distribution. 73 | 74 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 75 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 76 | TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A 77 | PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR 78 | CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 79 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 80 | PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 81 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 82 | LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 83 | NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 84 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 85 | -------------------------------------------------------------------------------- /Injection/Core/FastFont/CacheInfo.cpp: -------------------------------------------------------------------------------- 1 | #include "CacheInfo.h" 2 | 3 | CacheInfo::CacheInfo(int HashRootTables) 4 | { 5 | m_HashRootTables = HashRootTables; 6 | m_CacheNums = 0; 7 | 8 | m_CacheRoot.OriginalKey = 0; 9 | m_CacheRoot.Value = 0; 10 | m_CacheRoot.pData = NULL; 11 | m_CacheRoot.pPrev = NULL; 12 | m_CacheRoot.pNext = NULL; 13 | m_CacheRoot.pPrevHash = NULL; 14 | m_CacheRoot.pNextHash = NULL; 15 | 16 | m_HashRootTable = new StCacheInfo[m_HashRootTables]; 17 | 18 | for (int ii = 0; ii < m_HashRootTables; ii++) 19 | { 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 | 43 | m_CacheRoot.pNext = NULL; 44 | delete[] m_HashRootTable; 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 | 56 | while (pCache) 57 | { 58 | pNext = pCache->pNext; 59 | 60 | if (!pNext) 61 | { 62 | // release a disused old cache. 63 | StCacheInfo *pPrev = pCache->pPrev; 64 | 65 | if (pPrev) 66 | pPrev->pNext = pNext; 67 | 68 | StCacheInfo *pPrevHash = pCache->pPrevHash; 69 | StCacheInfo *pNextHash = pCache->pNextHash; 70 | 71 | if (pPrevHash) 72 | pPrevHash->pNextHash = pNextHash; 73 | 74 | if (pNextHash) 75 | pNextHash->pPrevHash = pPrevHash; 76 | 77 | delete[] pCache->pData; 78 | delete pCache; 79 | m_CacheNums--; 80 | } 81 | 82 | pCache = pNext; 83 | } 84 | } 85 | 86 | pCache = new StCacheInfo; 87 | 88 | if (pCache) 89 | { 90 | pCache->OriginalKey = hashkey; 91 | pCache->Value = 0; 92 | pCache->pData = new u8[datasize]; 93 | 94 | if (pCache->pData) 95 | { 96 | int hash = hashkey % m_HashRootTables; 97 | 98 | StCacheInfo *pNext = m_CacheRoot.pNext; 99 | StCacheInfo *pNextHash = m_HashRootTable[hash].pNextHash; 100 | 101 | m_CacheRoot.pNext = pCache; 102 | m_HashRootTable[hash].pNextHash = pCache; 103 | 104 | pCache->pPrev = &m_CacheRoot; 105 | pCache->pNext = pNext; 106 | pCache->pPrevHash = &m_HashRootTable[hash]; 107 | pCache->pNextHash = pNextHash; 108 | 109 | if (pNext) 110 | pNext->pPrev = pCache; 111 | 112 | if (pNextHash) 113 | pNextHash->pPrevHash = pCache; 114 | 115 | m_CacheNums++; 116 | 117 | return pCache->pData; 118 | } 119 | 120 | delete pCache; 121 | } 122 | 123 | return NULL; 124 | } 125 | 126 | void CacheInfo::ClearCache(void) 127 | { 128 | StCacheInfo *pCache = m_CacheRoot.pNext; 129 | 130 | while (pCache) 131 | { 132 | StCacheInfo *pNext = pCache->pNext; 133 | 134 | delete[] pCache->pData; 135 | delete pCache; 136 | pCache = pNext; 137 | } 138 | 139 | m_CacheRoot.pNext = NULL; 140 | 141 | for (int ii = 0; ii < m_HashRootTables; ii++) 142 | { 143 | m_HashRootTable[ii].OriginalKey = 0; 144 | m_HashRootTable[ii].Value = 0; 145 | m_HashRootTable[ii].pData = NULL; 146 | m_HashRootTable[ii].pPrev = NULL; 147 | m_HashRootTable[ii].pNext = NULL; 148 | m_HashRootTable[ii].pPrevHash = NULL; 149 | m_HashRootTable[ii].pNextHash = NULL; 150 | } 151 | 152 | m_CacheNums = 0; 153 | } 154 | 155 | void *CacheInfo::GetCacheData(int hashkey) 156 | { 157 | int hash = hashkey % m_HashRootTables; 158 | 159 | StCacheInfo *pCache = m_HashRootTable[hash].pNextHash; 160 | 161 | while (pCache) 162 | { 163 | if (pCache->OriginalKey == hashkey) 164 | { 165 | // move to top a cache used. 166 | StCacheInfo *pPrev = pCache->pPrev; 167 | StCacheInfo *pNext = pCache->pNext; 168 | 169 | if (pPrev) 170 | pPrev->pNext = pNext; 171 | 172 | if (pNext) 173 | pNext->pPrev = pPrev; 174 | 175 | pNext = m_CacheRoot.pNext; 176 | 177 | pCache->pPrev = &m_CacheRoot; 178 | pCache->pNext = pNext; 179 | m_CacheRoot.pNext = pCache; 180 | 181 | if (pNext) 182 | pNext->pPrev = pCache; 183 | 184 | return pCache->pData; 185 | } 186 | 187 | pCache = pCache->pNextHash; 188 | } 189 | 190 | return NULL; 191 | } 192 | 193 | int CacheInfo::DebugGetHashEntrys(int hashtableno) 194 | { 195 | int hashentrys = 0; 196 | 197 | if (hashtableno >= m_HashRootTables) 198 | return 0; 199 | 200 | StCacheInfo *pCache = m_HashRootTable[hashtableno].pNextHash; 201 | 202 | while (pCache) 203 | { 204 | hashentrys++; 205 | pCache = pCache->pNextHash; 206 | } 207 | 208 | return hashentrys; 209 | } 210 | -------------------------------------------------------------------------------- /Injection/Core/ro/system.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | struct ACTOR_COLOR 4 | { 5 | unsigned char a; 6 | unsigned char r; 7 | unsigned char g; 8 | unsigned char b; 9 | }; 10 | 11 | struct COLOR 12 | { 13 | union 14 | { 15 | unsigned char b, g, r, a; 16 | unsigned long color; 17 | }; 18 | }; 19 | 20 | struct UVRECT 21 | { 22 | float u1; 23 | float v1; 24 | float u2; 25 | float v2; 26 | 27 | UVRECT(float _u1, float _v1, float _u2, float _v2) 28 | { 29 | u1 = _u1; 30 | v1 = _v1; 31 | u2 = _u2; 32 | v2 = _v2; 33 | }; 34 | 35 | UVRECT() : u1(0), v1(0), u2(0), v2(0) {}; 36 | }; 37 | 38 | struct RENDER_INFO_RECT 39 | { 40 | float left; 41 | float top; 42 | float right; 43 | float bottom; 44 | float oow; 45 | void RENDER_INFO_RECT::SetInfo(float fleft, float ftop, float fright, float fbottom, float foow); 46 | void RENDER_INFO_RECT::Update(struct RPSprite& spr); 47 | }; 48 | 49 | struct BOXINFO 50 | { 51 | int x; 52 | int y; 53 | int cx; 54 | int cy; 55 | int drawEdge; 56 | int color; 57 | int color2; 58 | }; 59 | 60 | enum ENUM_DRAGTYPE 61 | { 62 | DT_NODRAG = 0x0, 63 | DT_FROM_ITEMWND = 0x1, 64 | DT_FROM_EQUIPWND = 0x2, 65 | DT_FROM_ITEMSHOPWND = 0x3, 66 | DT_FROM_ITEMPURCHASEWND = 0x4, 67 | DT_FROM_ITEMSELLWND = 0x5, 68 | DT_FROM_ITEMSTOREWND = 0x6, 69 | DT_FROM_SHORTCUTWND = 0x7, 70 | DT_FROM_SKILLLISTWND = 0x8, 71 | DT_FROM_MERCHANTITEMWND = 0x9, 72 | DT_FROM_MERCHANTSHOPMAKEWND = 0xa, 73 | DT_FROM_MERCHANTMIRRORITEMWND = 0xb, 74 | DT_FROM_MERCHANTITEMSHOPWND = 0xc, 75 | DT_FROM_MERCHANTITEMPURCHASEWND = 0xd, 76 | DT_FROM_METALPROCESSWND = 0xe, 77 | DT_FROM_HOSKILLLISTWND = 0xf, 78 | DT_FROM_MAILWND = 0x10, 79 | DT_FROM_MERSKILLLISTWND = 0x11, 80 | }; 81 | 82 | struct DRAG_INFO 83 | { 84 | enum ENUM_DRAGTYPE m_dragType; 85 | int m_dragItemIndex; 86 | int m_dragItemPrice; 87 | int m_dragItemRealPrice; 88 | int m_numDragItem; 89 | int m_slotNum; 90 | int m_dragItemType; 91 | int m_refiningLevel; 92 | unsigned char m_isIdentified; 93 | std::basic_string m_dragSprName; 94 | std::basic_string m_dragItemName; 95 | std::basic_string m_skillName; 96 | int m_skillUseLevel; 97 | int m_slot[4]; 98 | 99 | DRAG_INFO(struct DRAG_INFO&) {}; 100 | DRAG_INFO() {}; 101 | struct DRAG_INFO& operator = (struct DRAG_INFO&) {}; 102 | DRAG_INFO::~DRAG_INFO() {}; 103 | }; 104 | 105 | struct PLAY_WAVE_INFO 106 | { 107 | std::basic_string wavName; 108 | unsigned long nAID; 109 | unsigned long term; 110 | unsigned long endTick; 111 | 112 | PLAY_WAVE_INFO(struct PLAY_WAVE_INFO&) {}; 113 | PLAY_WAVE_INFO() {}; 114 | struct PLAY_WAVE_INFO& PLAY_WAVE_INFO::operator = (struct PLAY_WAVE_INFO& __that) {}; 115 | PLAY_WAVE_INFO::~PLAY_WAVE_INFO() {}; 116 | }; 117 | 118 | enum ENUM_SKILL_USE_TYPE 119 | { 120 | SUT_NOSKILL = 0x0, 121 | SUT_TO_GROUND = 0x1, 122 | SUT_TO_CHARACTER = 0x2, 123 | SUT_TO_ITEM = 0x3, 124 | SUT_TO_ALL = 0x4, 125 | SUT_TO_SKILL = 0x5, 126 | SUT_TO_SKILLGROUND_WITHTALKBOX = 0x6, 127 | }; 128 | 129 | struct SKILL_USE_INFO 130 | { 131 | enum ENUM_SKILL_USE_TYPE m_skillUseType; 132 | int m_skillId; 133 | int m_attackRange; 134 | int m_useLevel; 135 | }; 136 | 137 | struct SHOW_IMAGE_INFO 138 | { 139 | int type; 140 | std::basic_string imageName; 141 | 142 | SHOW_IMAGE_INFO(struct SHOW_IMAGE_INFO&) {}; 143 | SHOW_IMAGE_INFO() {}; 144 | struct SHOW_IMAGE_INFO& operator = (struct SHOW_IMAGE_INFO&) {}; 145 | SHOW_IMAGE_INFO::~SHOW_IMAGE_INFO() {}; 146 | }; 147 | 148 | struct POINTER_FUNC 149 | { 150 | int excuteType; 151 | void (*pfunc)(); 152 | long startTime; 153 | }; 154 | 155 | class CScheduler 156 | { 157 | public: 158 | std::multimap m_scheduleList; 159 | CScheduler(class CScheduler&) {}; 160 | CScheduler::CScheduler() {}; 161 | void CScheduler::OnRun() {}; 162 | unsigned char CScheduler::InsertInList(long excuteTime, int excuteType, void (*pfunc)()) {}; 163 | unsigned char CScheduler::InsertInList(long excuteTime, struct POINTER_FUNC pfunc) {}; 164 | class CScheduler& operator = (class CScheduler&) {}; 165 | 166 | virtual CScheduler::~CScheduler() {}; 167 | }; 168 | 169 | class Exemplar 170 | { 171 | public: 172 | Exemplar() {}; 173 | }; 174 | 175 | class CHash 176 | { 177 | public: 178 | unsigned long m_HashCode; 179 | char m_String[252]; 180 | }; 181 | 182 | enum PixelFormat 183 | { 184 | PF_A1R5G5B5 = 0x0, 185 | PF_A4R4G4B4 = 0x1, 186 | PF_R5G6B5 = 0x2, 187 | PF_R5G5B5 = 0x3, 188 | PF_A8R8G8B8 = 0x4, 189 | PF_BUMP = 0x5, 190 | PF_LAST = 0x6, 191 | PF_UNSUPPORTED = 0xff, 192 | }; 193 | 194 | enum PROCEEDTYPE 195 | { 196 | PT_NOTHING = 0x0, 197 | PT_ATTACK = 0x1, 198 | PT_PICKUPITEM = 0x2, 199 | PT_SKILL = 0x3, 200 | PT_GROUNDSKILL = 0x4, 201 | PT_ATTACK_2 = 0x5, 202 | PT_TOUCH_SKILL = 0x6, 203 | }; 204 | -------------------------------------------------------------------------------- /Injection/Core/ro/res.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | class CRes 4 | { 5 | public: 6 | virtual ~CRes() {}; 7 | 8 | int m_lockCnt; 9 | unsigned long m_timeStamp; 10 | int m_extIndex; 11 | class CHash m_fName; 12 | }; 13 | 14 | class CSurface 15 | { 16 | public: 17 | unsigned long m_w; 18 | unsigned long m_h; 19 | struct IDirectDrawSurface7* m_pddsSurface; 20 | 21 | CSurface(class CSurface&) {}; 22 | CSurface() {}; 23 | CSurface::CSurface(unsigned long w, unsigned long h, struct IDirectDrawSurface7* surface) {}; 24 | CSurface::CSurface(unsigned long w, unsigned long h) {}; 25 | struct IDirectDrawSurface7* GetDDSurface() {}; 26 | unsigned char CSurface::Create(unsigned long w, unsigned long h) {}; 27 | class CSurface& operator=(class CSurface&) {}; 28 | 29 | virtual CSurface::~CSurface() {}; 30 | virtual void CSurface::Update(int x, int y, int width, int height, unsigned long* image, unsigned char blackkey, int lPitch) {}; 31 | virtual void CSurface::ClearSurface(struct tagRECT* rect, unsigned long color) {}; 32 | virtual void CSurface::DrawSurface(int x, int y, int width, int height, unsigned long color) {}; 33 | virtual void CSurface::DrawSurfaceStretch(int x, int y, int width, int height) {}; 34 | }; 35 | 36 | class CTexture : public CSurface 37 | { 38 | public: 39 | static float m_uOffset; 40 | static float m_vOffset; 41 | 42 | enum PixelFormat m_pf; 43 | unsigned char m_blackkey; 44 | unsigned long m_updateWidth; 45 | unsigned long m_updateHeight; 46 | char m_texName[256]; 47 | long m_lockCnt; 48 | unsigned long m_timeStamp; 49 | 50 | static void __cdecl SetUVOffset(float, float) {}; 51 | 52 | // void CTexture::UpdateSprite(int x, int y, int width, int height, struct SprImg& img, unsigned long* pal); 53 | // float GetUAdjust(); 54 | // float GetVAdjust(); 55 | // enum PixelFormat GetPixelFormat(); 56 | // long CTexture::Lock(); 57 | // long CTexture::Unlock(); 58 | // long GetLockCount(); 59 | // void UpdateStamp(); 60 | // void SetName(char*); 61 | // unsigned char CTexture::CopyTexture(class CTexture* srcTex, int sx, int sy, int sw, int sh, int dx, int dy, int dw, int dh); 62 | 63 | CTexture(class CTexture&) {}; 64 | CTexture::CTexture(unsigned long w, unsigned long h, enum PixelFormat pf, struct IDirectDrawSurface7* surface) {}; 65 | CTexture::CTexture(unsigned long w, unsigned long h, enum PixelFormat pf) {}; 66 | 67 | // unsigned char CTexture::Create(unsigned long w, unsigned long h, enum PixelFormat pf); 68 | // unsigned char CTexture::CreateBump(unsigned long w, unsigned long h, struct IDirectDrawSurface7* pSurface); 69 | // unsigned char CTexture::CreateBump(unsigned long w, unsigned long h); 70 | // void CTexture::SetUVAdjust(unsigned long width, unsigned long height); 71 | // void CTexture::UpdateMipmap(struct tagRECT& src); 72 | // class CTexture& operator=(class CTexture&); 73 | 74 | // virtual void CTexture::Update(int x, int y, int width, int height, unsigned long* image, unsigned char blackkey, int lPitch); 75 | // virtual void CTexture::ClearSurface(struct tagRECT* rect, unsigned long color); 76 | // virtual void CTexture::DrawSurface(int x, int y, int w, int h, unsigned long color); 77 | // virtual void CTexture::DrawSurfaceStretch(int x, int y, int w, int h); 78 | 79 | virtual CTexture::~CTexture() {}; 80 | }; 81 | 82 | struct SprImg 83 | { 84 | short width; 85 | short height; 86 | short isHalfW; 87 | short isHalfH; 88 | CTexture* tex; 89 | unsigned char* m_8bitImage; 90 | }; 91 | 92 | class CSprRes : public CRes 93 | { 94 | public: 95 | unsigned long m_pal[256]; 96 | std::vector m_sprites[2]; 97 | int m_count; 98 | 99 | CSprRes(class CSprRes&) {}; 100 | CSprRes::CSprRes(class Exemplar __formal, char* resid, char* baseDir) {}; 101 | CSprRes::CSprRes() {}; 102 | void Unload() {}; 103 | unsigned char* CSprRes::ZeroCompression(unsigned char* Image, int x, int y, unsigned short& Size) {}; 104 | unsigned char* CSprRes::ZeroDecompression(unsigned char* compressedImage, int width, int height) {}; 105 | unsigned char* CSprRes::HalfImage(unsigned char* Image, int x, int y, int isXHalf, int isYHalf) {}; 106 | class CSprRes& operator=(class CSprRes&) {}; 107 | 108 | virtual class CRes* CSprRes::Clone() {}; 109 | virtual unsigned char CSprRes::Load(char* fName) {}; 110 | virtual void CSprRes::Reset() {}; 111 | virtual CSprRes::~CSprRes() {}; 112 | }; 113 | 114 | struct CSprClip 115 | { 116 | int x; 117 | int y; 118 | int sprIndex; 119 | int flags; 120 | unsigned char r; 121 | unsigned char g; 122 | unsigned char b; 123 | unsigned char a; 124 | float zoomx; 125 | float zoomy; 126 | int angle; 127 | int clipType; 128 | }; 129 | 130 | struct CMotion 131 | { 132 | struct tagRECT range1; 133 | struct tagRECT range2; 134 | std::vector sprClips; 135 | int numClips; 136 | int m_eventId; 137 | std::vector attachInfo; 138 | int attachCnt; 139 | }; 140 | 141 | struct CAction 142 | { 143 | std::vector motions; 144 | CAction() {}; 145 | }; 146 | 147 | class CActRes : public CRes 148 | { 149 | public: 150 | std::vector actions; 151 | int numMaxClipPerMotion; 152 | std::vector> m_events; 153 | std::vector m_delay; 154 | }; 155 | -------------------------------------------------------------------------------- /Injection/tinyconsole.cpp: -------------------------------------------------------------------------------- 1 | HINSTANCE g_hTCInstance; 2 | 3 | #define MAX_LOADSTRING 100 4 | #define IDC_RICHEDIT (101) 5 | 6 | TCHAR strPath[MAX_PATH + 1]; 7 | 8 | HINSTANCE s_hRtLib; 9 | HWND s_hRichEdit = NULL; 10 | HANDLE g_hTinyConsole = NULL; 11 | HANDLE g_hDebugConsole = NULL; 12 | 13 | UINT __stdcall TinyConsole(LPVOID lpArg); 14 | 15 | class CTinylogger 16 | { 17 | private: 18 | std::ofstream ofs; 19 | 20 | public: 21 | CTinylogger() 22 | { 23 | ofs.open("SimpleROHook.log"); 24 | } 25 | 26 | void operator << (char *str) 27 | { 28 | ofs << str; 29 | } 30 | 31 | virtual ~CTinylogger() 32 | { 33 | ofs.close(); 34 | }; 35 | }; 36 | 37 | CTinylogger *s_pTinyLogger = NULL; 38 | 39 | void DebugLogger(const char* format, ...) 40 | { 41 | va_list argptr; 42 | va_start(argptr, format); 43 | 44 | int length = _vscprintf(format, argptr); 45 | char* buf = new char [length + 2]; 46 | 47 | vsprintf_s(buf, length + 2, format, argptr); 48 | strcat_s(buf, length + 2, "\n"); 49 | 50 | if (s_pTinyLogger) 51 | *s_pTinyLogger << buf; 52 | 53 | delete[] buf; 54 | va_end(argptr); 55 | } 56 | 57 | void DebugLoggerWithLogWindow(const char* format, ...) 58 | { 59 | va_list argptr; 60 | va_start(argptr, format); 61 | 62 | int length = _vscprintf(format, argptr); 63 | char* buf = new char [length + 2]; 64 | 65 | vsprintf_s(buf, length + 2, format, argptr); 66 | strcat_s(buf, length + 2, "\n"); 67 | 68 | if (s_pTinyLogger) 69 | *s_pTinyLogger << buf; 70 | 71 | if (s_hRichEdit) 72 | { 73 | int len = ::GetWindowTextLength(s_hRichEdit); 74 | 75 | ::SendMessage(s_hRichEdit, EM_SETSEL, (WPARAM)len, (LPARAM)len); 76 | ::SendMessage(s_hRichEdit, EM_REPLACESEL, 0, (LPARAM)buf); 77 | } 78 | 79 | delete[] buf; 80 | va_end(argptr); 81 | } 82 | 83 | void CreateTinyConsole(void) 84 | { 85 | HINSTANCE hinst = ::GetModuleHandle(NULL); 86 | g_hTinyConsole = ::CreateEvent(NULL, TRUE, TRUE, _T("Tiny Console")); 87 | 88 | if (g_hTinyConsole) 89 | { 90 | ::ResetEvent(g_hTinyConsole); 91 | g_hDebugConsole = (HANDLE)_beginthreadex(NULL, 0, TinyConsole, (LPVOID)(&hinst), CREATE_SUSPENDED, NULL); 92 | ::ResumeThread(g_hDebugConsole); 93 | ::SetEvent(g_hTinyConsole); 94 | ::WaitForSingleObject(g_hTinyConsole, INFINITE); 95 | } 96 | 97 | s_pTinyLogger = new CTinylogger; 98 | } 99 | 100 | void ReleaseTinyConsole(void) 101 | { 102 | if (g_hDebugConsole) 103 | ::CloseHandle(g_hDebugConsole); 104 | 105 | if (g_hTinyConsole) 106 | ::CloseHandle(g_hTinyConsole); 107 | 108 | if (s_pTinyLogger) 109 | delete s_pTinyLogger; 110 | } 111 | 112 | LRESULT CALLBACK TinyConsoleWinProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) 113 | { 114 | switch (message) 115 | { 116 | case WM_CREATE: 117 | { 118 | ::GetSystemDirectory(strPath, MAX_PATH + 1); 119 | wsprintf(strPath, TEXT("%s\\%s"), strPath, _TEXT("RichEd20.dll")); 120 | s_hRtLib = ::LoadLibrary((LPCTSTR)strPath); 121 | s_hRichEdit = ::CreateWindowEx(WS_EX_CLIENTEDGE, _T("RichEdit20A"), _T(""), 122 | WS_CHILD | WS_VISIBLE | WS_BORDER | ES_MULTILINE | WS_HSCROLL | 123 | WS_VSCROLL | ES_AUTOVSCROLL | ES_NOHIDESEL | ES_READONLY, 124 | 0, 80, 200, 200, hWnd, (HMENU)IDC_RICHEDIT, g_hTCInstance, NULL 125 | ); 126 | 127 | DWORD dwLangOptions; 128 | CHARFORMAT cfm; // CHARFORMAT structure 129 | 130 | dwLangOptions = ::SendMessage(s_hRichEdit, EM_GETLANGOPTIONS, 0, 0); 131 | dwLangOptions &= ~IMF_DUALFONT; 132 | ::SendMessage(s_hRichEdit, EM_SETLANGOPTIONS, 0, (LPARAM)dwLangOptions); 133 | 134 | memset(&cfm, 0, sizeof(CHARFORMAT)); 135 | cfm.cbSize = sizeof(CHARFORMAT); 136 | cfm.dwMask = CFM_BOLD | CFM_ITALIC | CFM_UNDERLINE | CFM_STRIKEOUT | CFM_CHARSET | CFM_FACE | CFM_COLOR | CFM_SIZE; 137 | 138 | cfm.yHeight = 10 * 20; 139 | cfm.bCharSet = DEFAULT_CHARSET; 140 | lstrcpy(cfm.szFaceName, _T("Consolas")); 141 | 142 | cfm.crTextColor = RGB(0, 0, 0); 143 | cfm.dwEffects = 0; 144 | 145 | ::SendMessage(s_hRichEdit, EM_SETCHARFORMAT, SCF_SELECTION | SCF_WORD, (LPARAM)&cfm); 146 | ::SendMessage(s_hRichEdit, EM_REPLACESEL, FALSE, (LPARAM)(LPCTSTR)_T("Hook Enable.\n")); 147 | 148 | if (g_hTinyConsole) 149 | ::SetEvent(g_hTinyConsole); 150 | } 151 | break; 152 | 153 | case WM_SIZE: 154 | ::MoveWindow(s_hRichEdit, 0, 0, LOWORD(lParam), HIWORD(lParam), TRUE); 155 | break; 156 | 157 | default: 158 | return ::DefWindowProc(hWnd, message, wParam, lParam); 159 | break; 160 | } 161 | 162 | return 0; 163 | } 164 | 165 | #define TINYCONSOLE_CLASS_NAME _T("#32769") 166 | 167 | UINT __stdcall TinyConsole(LPVOID lpArg) 168 | { 169 | WNDCLASS wc; 170 | HWND hWnd; 171 | MSG msg; 172 | g_hTCInstance = *((HINSTANCE*)lpArg); 173 | 174 | memset(&wc, 0, sizeof(wc)); 175 | 176 | wc.hCursor = ::LoadCursor(NULL, IDC_ARROW); 177 | wc.hIcon = ::LoadIcon(NULL, IDI_WINLOGO); 178 | wc.hInstance = g_hTCInstance; 179 | wc.lpfnWndProc = TinyConsoleWinProc; 180 | wc.lpszClassName = TINYCONSOLE_CLASS_NAME; 181 | 182 | if (!::RegisterClass(&wc)) 183 | return 0; 184 | 185 | hWnd = ::CreateWindow(TINYCONSOLE_CLASS_NAME, _T("Tiny Console"), 186 | WS_OVERLAPPEDWINDOW | WS_VISIBLE, 187 | 0, 0, 580, 480, NULL, NULL, g_hTCInstance, NULL 188 | ); 189 | 190 | while (::GetMessage(&msg, NULL, 0, 0)) 191 | { 192 | ::TranslateMessage(&msg); 193 | ::DispatchMessage(&msg); 194 | } 195 | 196 | _endthreadex(0); 197 | 198 | return 0; 199 | } 200 | -------------------------------------------------------------------------------- /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 | 118 | -------------------------------------------------------------------------------- /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 | 121 | -------------------------------------------------------------------------------- /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 | Header Files\Core\ro 41 | 42 | 43 | Header Files\Core\ro 44 | 45 | 46 | Header Files\Core\ro 47 | 48 | 49 | Header Files\Core\ro 50 | 51 | 52 | Header Files\Core\ro 53 | 54 | 55 | Header Files\Core\ro 56 | 57 | 58 | Header Files\Core\ro 59 | 60 | 61 | Header Files\Core\ro 62 | 63 | 64 | Header Files\Core 65 | 66 | 67 | Header Files\Core 68 | 69 | 70 | Header Files\Dll-Injection 71 | 72 | 73 | Header Files\Dll-Injection 74 | 75 | 76 | Header Files\Dll-Injection 77 | 78 | 79 | Header Files\Dll-Injection 80 | 81 | 82 | Header Files\Dll-Injection 83 | 84 | 85 | Header Files\Core\FastFont 86 | 87 | 88 | Header Files\Core\FastFont 89 | 90 | 91 | Header Files\Core\FastFont 92 | 93 | 94 | Header Files\Dll-Injection 95 | 96 | 97 | Header Files\Dll-Injection 98 | 99 | 100 | Header Files\Core 101 | 102 | 103 | Header Files\Core 104 | 105 | 106 | Header Files\Dll-Injection 107 | 108 | 109 | Header Files\Core\ro 110 | 111 | 112 | 113 | 114 | Source Files\Core 115 | 116 | 117 | Source Files\Dll-Injection 118 | 119 | 120 | Source Files\Dll-Injection 121 | 122 | 123 | Source Files\Dll-Injection 124 | 125 | 126 | Source Files\Dll-Injection 127 | 128 | 129 | Source Files\Core\FastFont 130 | 131 | 132 | Source Files\Core\FastFont 133 | 134 | 135 | Source Files\Core\FastFont 136 | 137 | 138 | Source Files\Dll-Injection 139 | 140 | 141 | Source Files\Dll-Injection 142 | 143 | 144 | 145 | 146 | Resource Files 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 | 18 | #pragma once 19 | 20 | #include "shared.h" 21 | 22 | #include "PerformanceCounter.h" 23 | #include "SearchCode.h" 24 | #include "FastFont/SFastFont.h" 25 | 26 | // Required to create a dll for jRO. 27 | // #define JRO_CLIENT_STRUCTURE 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 | { 45 | FLOAT x, y, z, rhw; // The transformed position for the vertex 46 | DWORD color; // The vertex color 47 | }; 48 | 49 | typedef void (__cdecl *tPlayStream)(const char *streamFileName, int playflag); 50 | typedef void* (__thiscall *tCFileMgr__GetData)(/*CFileMgr*/void *this_pt, const char *name, unsigned int *size); 51 | typedef void* (__thiscall *tCFileMgr__GetPak)(/*CFileMgr*/void *this_pt, const char *name, unsigned int *size); 52 | typedef void* (__cdecl *tCRagConnection__instanceR)(void); 53 | typedef int (__thiscall *tCRagConnection__GetPacketSize)(/*CRagConnection*/void *this_pt, int packetType); 54 | 55 | class CRoCodeBind 56 | { 57 | private: 58 | CRenderer** g_renderer; 59 | CModeMgr* g_pmodeMgr; 60 | CMouse* g_mouse; 61 | 62 | void* m_CFileMgr__gfileMgr; 63 | tCFileMgr__GetData m_functionRagexe_CFileMgr__GetData; 64 | tCFileMgr__GetPak m_functionRagexe_CFileMgr__GetPak; 65 | 66 | tPlayStream m_funcRagexe_PlayStream; 67 | 68 | std::map m_ItemName; 69 | void InitItemNameMap(); 70 | 71 | tCRagConnection__instanceR m_functionRagexe_CRagConnection__instanceR; 72 | tCRagConnection__GetPacketSize m_functionRagexe_CRagConnection__GetPacketSize; 73 | void** m_packetLenMap; 74 | void* m_packetLenMap_InsertTree; 75 | 76 | HWND m_hWnd; 77 | int m_gid; 78 | 79 | #define PACKETQUEUE_BUFFERSIZE 40960 80 | 81 | char m_packetqueuebuffer[PACKETQUEUE_BUFFERSIZE]; 82 | unsigned int m_packetqueue_head; 83 | 84 | #define ROPACKET_MAXLEN 0x2000 85 | 86 | int m_packetLenMap_table[ROPACKET_MAXLEN]; 87 | int m_packetLenMap_table_index; 88 | 89 | #define MAX_GROUNDSKILLTYPE 0x100 90 | 91 | DWORD m_M2ESkillColor[MAX_GROUNDSKILLTYPE]; 92 | 93 | DWORD m_deadcellColor; 94 | DWORD m_chatscopeColor; 95 | DWORD m_castrangeColor; 96 | DWORD m_bbeGutterlineColor; 97 | DWORD m_bbeDemigutterColor; 98 | 99 | int m_CMode_subMode; 100 | int m_CMode_old_subMode; 101 | 102 | DWORD _state_zenable; 103 | DWORD _state_zwriteenable; 104 | DWORD _state_zbias; 105 | DWORD _state_fogenable; 106 | DWORD _state_specularenable; 107 | DWORD _state_alphafunc; 108 | DWORD _state_alpharef; 109 | DWORD _state_srcblend; 110 | DWORD _state_destblend; 111 | 112 | void BackupRenderState(IDirect3DDevice7* d3ddevice); 113 | void RestoreRenderState(IDirect3DDevice7* d3ddevice); 114 | 115 | void DrawBBE(IDirect3DDevice7* d3ddevice); 116 | void DrawM2E(IDirect3DDevice7* d3ddevice); 117 | 118 | void PacketProc(const char *packetdata); 119 | 120 | typedef void (CRoCodeBind::*tPacketHandler)(const char *packetdata); 121 | std::map m_packethandler; 122 | 123 | void InitPacketHandler(void); 124 | void PacketHandler_Cz_Say_Dialog(const char *packetdata); 125 | void PacketHandler_Cz_Menu_List(const char *packetdata); 126 | 127 | void SendMessageToNPCLogger(const char *src, int size); 128 | 129 | struct p_std_map_packetlen 130 | { 131 | struct p_std_map_packetlen *left, *parent, *right; 132 | DWORD key; 133 | int value; 134 | }; 135 | 136 | int GetTreeData(p_std_map_packetlen* node); 137 | 138 | void ProjectVertex(vector3d& src, matrix& vtm, float *x, float *y, float *oow); 139 | void ProjectVertex(vector3d& src, matrix& vtm, tlvertex3d *vert); 140 | void ProjectVertexEx(vector3d& src, vector3d& pointvector, matrix& vtm, float *x, float *y, float *oow); 141 | void ProjectVertexEx(vector3d& src, vector3d& pointvector, matrix& vtm, tlvertex3d *vert); 142 | 143 | void LoadIni(void); 144 | void SearchRagexeMemory(void); 145 | 146 | LPDIRECTDRAWSURFACE7 m_pddsFontTexture; 147 | CSFastFont *m_pSFastFont; 148 | 149 | struct MouseDataStructure 150 | { 151 | int x_axis, y_axis, wheel; 152 | char l_button, r_button, wheel_button, pad; 153 | }; 154 | 155 | void DrawGage(LPDIRECT3DDEVICE7 device, int x, int y, int w, int h, unsigned long value, DWORD color, int alpha, int type); 156 | void DrawHPSPGage(IDirect3DDevice7 *d3ddev, int x, int y, int hp, int sp); 157 | 158 | public: 159 | CRoCodeBind() : 160 | m_hWnd(NULL), 161 | m_funcRagexe_PlayStream(NULL), 162 | m_CFileMgr__gfileMgr(NULL), 163 | m_functionRagexe_CFileMgr__GetPak(NULL), 164 | m_packetLenMap_table_index(0), 165 | m_packetqueue_head(0), 166 | m_pSFastFont(NULL), 167 | m_pddsFontTexture(NULL), 168 | g_renderer(NULL), 169 | g_pmodeMgr(NULL), 170 | g_mouse(NULL), 171 | m_packetLenMap(NULL), 172 | m_packetLenMap_InsertTree(NULL), 173 | m_functionRagexe_CRagConnection__GetPacketSize(NULL), 174 | m_functionRagexe_CRagConnection__instanceR(NULL), 175 | m_CMode_old_subMode(-1), 176 | m_CMode_subMode(-1), 177 | m_gid(0) 178 | { 179 | ZeroMemory(m_packetLenMap_table, sizeof(m_packetLenMap_table)); 180 | }; 181 | 182 | virtual ~CRoCodeBind(); 183 | 184 | void Init(IDirect3DDevice7* d3ddevice); 185 | 186 | void DrawSRHDebug(IDirect3DDevice7* d3ddevice); 187 | void DrawOn3DMap(IDirect3DDevice7* d3ddevice); 188 | 189 | int GetPacketLength(int opcode); 190 | void PacketQueueProc(char *buf, int len); 191 | 192 | void InitWindowHandle(HWND hWnd) 193 | { 194 | m_hWnd = hWnd; 195 | }; 196 | 197 | const char *GetItemNameByID(int id); 198 | 199 | void *GetPak(const char *name, unsigned int *size); 200 | void ReleasePak(void *handle); 201 | 202 | void OneSyncProc(HRESULT Result, LPVOID lpvData, BOOL FreeMouse); 203 | void SetMouseCurPos(int x, int y); 204 | }; 205 | 206 | extern BOOL g_FreeMouseSw; 207 | extern StSHAREDMEMORY *g_pSharedData; 208 | 209 | extern CRoCodeBind* g_pRoCodeBind; 210 | 211 | BOOL OpenSharedMemory(void); 212 | BOOL ReleaseSharedMemory(void); 213 | 214 | extern CPerformanceCounter g_PerformanceCounter; 215 | -------------------------------------------------------------------------------- /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.8 14 | 15 | 16 | 512 17 | false 18 | publish\ 19 | true 20 | Disk 21 | false 22 | Foreground 23 | 7 24 | Days 25 | false 26 | false 27 | true 28 | 0 29 | 1.0.0.%2a 30 | false 31 | true 32 | 33 | 34 | x86 35 | true 36 | full 37 | false 38 | ..\Bin\Debug\ 39 | DEBUG;TRACE 40 | prompt 41 | 4 42 | true 43 | false 44 | 45 | 46 | x86 47 | pdbonly 48 | true 49 | ..\Bin\Release\ 50 | TRACE 51 | prompt 52 | 4 53 | true 54 | false 55 | 56 | 57 | SimpleROHookCS.ico 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | app.manifest 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | Form 86 | 87 | 88 | MainForm.cs 89 | 90 | 91 | Form 92 | 93 | 94 | NPCLogger.cs 95 | 96 | 97 | 98 | 99 | Form 100 | 101 | 102 | SRHAboutBox.cs 103 | 104 | 105 | 106 | Component 107 | 108 | 109 | MainForm.cs 110 | 111 | 112 | NPCLogger.cs 113 | 114 | 115 | ResXFileCodeGenerator 116 | Resources.Designer.cs 117 | Designer 118 | 119 | 120 | True 121 | Resources.resx 122 | True 123 | 124 | 125 | SRHAboutBox.cs 126 | 127 | 128 | 129 | Designer 130 | 131 | 132 | SettingsSingleFileGenerator 133 | Settings.Designer.cs 134 | 135 | 136 | True 137 | Settings.settings 138 | True 139 | 140 | 141 | 142 | 143 | False 144 | Microsoft .NET Framework 4 Client Profile %28x86 および x64%29 145 | true 146 | 147 | 148 | False 149 | .NET Framework 3.5 SP1 Client Profile 150 | false 151 | 152 | 153 | False 154 | .NET Framework 3.5 SP1 155 | false 156 | 157 | 158 | False 159 | Windows Installer 3.1 160 | true 161 | 162 | 163 | 164 | 165 | 166 | 167 | 174 | -------------------------------------------------------------------------------- /Injection/Core/ro/task.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | enum LMS_STATE 4 | { 5 | LSM_WARNING = 0x0, 6 | LSM_LICENCE = 0x1, 7 | LSM_SELECTACCOUNT = 0x2, 8 | LSM_IDENTRY = 0x3, 9 | LSM_WAITRESP_FROM_ACSVR = 0x4, 10 | LSM_WAITRESP_FROM_CHSVR = 0x5, 11 | LSM_SELECTSVR = 0x6, 12 | LSM_SELECTCHAR = 0x7, 13 | LSM_MAKECHAR = 0x8, 14 | LSM_WAITRESP_FROM_CHSVR_SELECTCHAR = 0x9, 15 | LSM_WAITRESP_FROM_CHSVR_MAKECHAR = 0xa, 16 | LSM_WAITRESP_FROM_CHSVR_DELETECHAR = 0xb, 17 | LSM_READY_FOR_ZONESVR = 0xc, 18 | LSM_SELECTACCOUNT2 = 0xd, 19 | LSM_REQ_GAME_GUARD_CHECK = 0xe, 20 | LSM_ACK_GAME_GUARD = 0xf, 21 | LSM_REQ_GAME_GUARD_CHECK2 = 0x10, 22 | LSM_REQ_PTNUM = 0x11, 23 | LSM_REQ_PTACINFO = 0x12, 24 | LSM_SELECTCHAR2 = 0x13, 25 | LSM_LAST = 0x14, 26 | }; 27 | 28 | class CMode 29 | { 30 | public: 31 | int m_subMode; // pointer 32 | int m_subModeCnt; 33 | int m_nextSubMode; // pointer +0x08 34 | int m_fadeInCount; 35 | int m_loopCond; 36 | int m_isConnected; 37 | void* m_helpBalloon; 38 | // UITransBalloonText* m_helpBalloon; // +0x18 39 | unsigned long m_helpBalloonTick; 40 | unsigned long m_mouseAnimStartTick; 41 | int m_isMouseLockOn; 42 | int m_screenShotNow; 43 | struct vector2d m_mouseSnapDiff; // Together until 0xd0 or 0xb4 44 | 45 | #ifdef CMODE_PADDING_24 46 | // Padding used to be 28. At the latest, CGameMode.m_rswName 47 | // was 4 bytes too far for iRO RE:Start 2017-09-20ragexe 48 | // TODO: Figure out if this is *actually* the right field to shorten/remove. 49 | char m_pad1[24]; 50 | #else 51 | char m_pad1[28]; 52 | #endif 53 | 54 | int m_cursorActNum; 55 | int m_cursorMotNum; 56 | 57 | CMode(class CMode&) {}; 58 | CMode::CMode() {}; 59 | void CMode::Initialize() {}; 60 | void PostQuitMsg() {}; 61 | void CMode::ScreenShot() {}; 62 | void CMode::SetCursorAction(int cursorActNum) {}; 63 | void CMode::RunFadeOut(int bDrawLogo) {}; 64 | void CMode::DrawSprite(int x, int y, class CActRes* act, class CSprRes* spr, int actId, int motId, float zoom, float angle, unsigned long color) {}; 65 | void CMode::DrawTexture(struct tagRECT* rect, int angle, float oow, unsigned long argb, class CTexture* tex, struct UVRECT uvRect) {}; 66 | void CMode::DrawBackGround2D(struct tagRECT* rect, int angle, float oow, unsigned long argb, class CTexture* tex, struct UVRECT uvRect) {}; 67 | void CMode::DrawMouseCursor() {}; 68 | void CMode::DrawBattleMode() {}; 69 | void CMode::MakeHelpBalloon(char* helpMsg, int x, int y, unsigned long fntColor) {}; 70 | void CMode::ProcessHelpBalloon() {}; 71 | void CMode::ProcessFadeIn() {}; 72 | void CMode::ProcessKeyBoard() {}; 73 | int GetCursorAction() {}; 74 | int GetCursorMotion() {}; 75 | int GetSubMode() {}; 76 | int GetLoopCond() {}; 77 | void SetNextSubState(int) {}; 78 | void SetSubState(int) {}; 79 | class CMode& operator = (class CMode&) {}; 80 | 81 | virtual CMode::~CMode() {}; 82 | virtual int CMode::OnRun() {}; 83 | virtual void CMode::OnInit(char* modeName) {}; 84 | virtual void CMode::OnExit() {}; 85 | virtual void CMode::OnUpdate() {}; 86 | virtual int CMode::SendMsg(int messageId, int val1, int val2, int val3) {}; 87 | virtual void CMode::OnChangeState(int state) {}; 88 | }; 89 | 90 | class CGameMode : public CMode 91 | { 92 | public: 93 | static unsigned long m_lastLockOnPcGid; 94 | static unsigned long m_dwOldAutoFollowTime; 95 | static unsigned long m_dwOldDisappearTime; 96 | 97 | int m_areaLeft; 98 | int m_areaRight; 99 | int m_areaTop; 100 | int m_areaBottom; 101 | char m_rswName[40]; 102 | char m_minimapBmpName[60]; 103 | CWorld* m_world; // 0xd0 104 | CView* m_view; 105 | CMousePointer* m_mousePointer; 106 | unsigned long m_leftBtnClickTick; 107 | int m_oldMouseX; 108 | int m_oldMouseY; 109 | int m_rBtnClickX; 110 | int m_rBtnClickY; 111 | unsigned long m_lastPcGid; 112 | unsigned long m_lastMonGid; 113 | unsigned long m_lastLockOnMonGid; 114 | int m_isAutoMoveClickOn; 115 | int m_isWaitingWhisperSetting; 116 | int m_isWaitingEnterRoom; 117 | int m_isWaitingAddExchangeItem; 118 | unsigned long m_waitingWearEquipAck; 119 | unsigned long m_waitingTakeoffEquipAck; 120 | int m_isReqUpgradeSkillLevel; 121 | int m_exchangeItemCnt; 122 | int m_isWaitingCancelExchangeItem; 123 | std::basic_string m_refuseWhisperName; 124 | std::basic_string m_streamFileName; 125 | std::basic_string m_lastExchangeCharacterName; 126 | std::map m_actorNameList; 127 | std::map m_actorNameReqTimer; 128 | std::map m_actorNameListByGID; 129 | std::map m_actorNameByGIDReqTimer; 130 | std::map m_guildMemberStatusCache; 131 | std::map m_actorPosList; 132 | std::list m_pickupReqItemNaidList; 133 | std::map m_aidList; 134 | std::map m_partyPosList; 135 | std::map m_guildPosList; 136 | std::map m_compassPosList; 137 | std::vector > m_menuIdList; 138 | std::list m_visibleTrapList; 139 | std::list m_emblemReqGdidQueue; 140 | unsigned long m_lastEmblemReqTick; 141 | unsigned long m_lastNameWaitingListTick; 142 | std::vector m_playWaveList; 143 | std::vector m_KillerList; 144 | std::basic_string m_lastWhisperMenuCharacterName; 145 | std::basic_string m_lastWhisper; 146 | std::basic_string m_lastWhisperName; 147 | int m_noMove; 148 | unsigned long m_noMoveStartTick; 149 | int m_isOnQuest; 150 | int m_isPlayerDead; 151 | int m_canRotateView; 152 | int m_hasViewPoint; 153 | short ViewPointData[9]; 154 | int m_receiveSyneRequestTime; 155 | unsigned long m_syncRequestTime; 156 | unsigned long m_usedCachesUnloadTick; 157 | unsigned long m_reqEmotionTick; 158 | unsigned long m_reqTickChatRoom; 159 | unsigned long m_reqTickMerchantShop; 160 | int m_isReqEmotion; 161 | float m_fixedLongitude; 162 | unsigned long m_lastCouplePacketAid; 163 | unsigned long m_lastCouplePacketGid; 164 | char m_CoupleName[24]; 165 | void* m_nameBalloon; 166 | // class UINameBalloonText* m_nameBalloon; 167 | void* m_targetNameBalloon; 168 | // class UINameBalloonText* m_targetNameBalloon; 169 | void* m_broadcastBalloon; 170 | // class UITransBalloonText* m_broadcastBalloon; 171 | void* m_playerGage; 172 | // class UIPlayerGage* m_playerGage; 173 | void* m_skillNameBalloon; 174 | // class UITransBalloonText* m_skillNameBalloon; 175 | void* m_skillMsgBalloon; 176 | // class UITransBalloonText* m_skillMsgBalloon; 177 | void* m_skillUsedMsgBalloon; 178 | // class UITransBalloonText* m_skillUsedMsgBalloon; 179 | unsigned long m_skillUsedTick; 180 | unsigned long m_broadCastTick; 181 | int m_nameDisplayed; 182 | int m_nameDisplayed2; 183 | int m_waitingUseItemAck; 184 | int m_waitingItemThrowAck; 185 | int m_waitingReqStatusAck; 186 | unsigned long m_nameActorAid; 187 | unsigned long m_lastNaid; 188 | unsigned long m_menuTargetAID; 189 | int m_nameBalloonWidth; 190 | int m_nameBalloonHeight; 191 | int m_dragType; 192 | struct DRAG_INFO m_dragInfo; 193 | struct ChatRoomInfo m_lastChatroomInfo; 194 | struct SKILL_USE_INFO m_skillUseInfo; 195 | struct SHOW_IMAGE_INFO m_showImageInfo; 196 | std::basic_string m_lastChat; 197 | int m_sameChatRepeatCnt; 198 | int m_numNotifyTime; 199 | int m_isCheckGndAlpha; 200 | int m_lastCardItemIndex; 201 | int m_SkillBallonSkillId; 202 | unsigned long m_nameBalloonType; 203 | unsigned long m_showTimeStartTick; 204 | int m_recordChatNum; 205 | std::basic_string m_recordChat[11]; 206 | unsigned long m_recordChatTime[11]; 207 | int m_strikeNum; 208 | unsigned long m_strikeTime[3]; 209 | unsigned long m_doritime[6]; 210 | int m_isCtrlLock; 211 | int m_isUseYgdrasil; 212 | int m_isMakeYgdrasil; 213 | int m_autoSaveChatCnt; 214 | CellPos m_posOfBossMon; 215 | unsigned char m_isBossAlarm; 216 | unsigned char m_onCopyName; 217 | class CScheduler m_scheduler; 218 | unsigned char m_SiyeonStatus[6]; 219 | int m_MouseRollCount; 220 | int m_MouseRollMax; 221 | 222 | virtual ~CGameMode() {}; 223 | }; 224 | 225 | class CModeMgr 226 | { 227 | public: 228 | int m_loopCond; 229 | class CMode* m_curMode; 230 | char m_curModeName[40]; 231 | char m_nextModeName[40]; 232 | int m_curModeType; 233 | int m_nextModeType; 234 | 235 | CModeMgr::CModeMgr() {}; 236 | void CModeMgr::Run(int modeType, char* worldName) {}; 237 | void CModeMgr::Switch(int modeType, char* modeName) {}; 238 | void CModeMgr::Quit() {}; 239 | int GetLoopCond() {}; 240 | CMode* GetCurMode() {}; 241 | CGameMode* CModeMgr::GetGameMode() {}; 242 | void* CModeMgr::GetLoginMode() {}; 243 | // CLoginMode* CModeMgr::GetLoginMode(); 244 | }; 245 | -------------------------------------------------------------------------------- /Injection/Injection.vcxproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Debug 6 | Win32 7 | 8 | 9 | Release 10 | Win32 11 | 12 | 13 | 14 | {46651709-BCBF-4645-8CE6-11EBA347A529} 15 | Win32Proj 16 | Injection 17 | Injection 18 | 19 | 20 | 21 | DynamicLibrary 22 | true 23 | MultiByte 24 | Static 25 | v143 26 | 27 | 28 | DynamicLibrary 29 | false 30 | true 31 | MultiByte 32 | v143 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | true 46 | ./;$(IncludePath);$(DXSDK_AUG07_DIR)Include 47 | $(LibraryPath);$(DXSDK_AUG07_DIR)Lib\x86 48 | $(SolutionDir)Bin\$(Configuration)\ 49 | 50 | 51 | false 52 | ./;$(IncludePath);$(DXSDK_AUG07_DIR)Include 53 | $(LibraryPath);$(DXSDK_AUG07_DIR)Lib\x86 54 | $(SolutionDir)Bin\$(Configuration)\ 55 | 56 | 57 | 58 | Use 59 | Level3 60 | Disabled 61 | WIN32;_DEBUG;_WINDOWS;_USRDLL;INJECTION_EXPORTS;%(PreprocessorDefinitions) 62 | stdafx.h;%(ForcedIncludeFiles) 63 | 64 | 65 | Windows 66 | true 67 | %(AdditionalDependencies) 68 | 69 | 70 | (for /f %%i in ('git describe --always --dirty --tags') do ((echo #define GIT_VERSION ^"%%i^") > "$(ProjectDir)versioninfo.h")) 71 | 72 | 73 | 74 | 75 | Level3 76 | Use 77 | MaxSpeed 78 | true 79 | true 80 | WIN32;NDEBUG;_WINDOWS;_USRDLL;INJECTION_EXPORTS;USE_GAMEOBJ_COUNTER;CMODE_PADDING_24;CGAMEACTOR_PADDING=8;%(PreprocessorDefinitions) 81 | stdafx.h;%(ForcedIncludeFiles) 82 | 83 | 84 | Windows 85 | true 86 | true 87 | true 88 | %(AdditionalDependencies) 89 | 90 | 91 | 92 | 93 | (for /f %%i in ('git describe --always --dirty --tags') do ((echo #define GIT_VERSION ^"%%i^") > "$(ProjectDir)versioninfo.h")) 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | false 127 | 128 | 129 | false 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | Create 140 | Create 141 | 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | 156 | This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. 157 | 158 | 159 | 160 | -------------------------------------------------------------------------------- /Injection/Core/ro/ui.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | class UIWindow 4 | { 5 | public: 6 | class UIWindow* m_parent; 7 | std::list m_children; 8 | // class std::list> m_children; 9 | int m_x; 10 | int m_y; 11 | int m_w; 12 | int m_h; 13 | int m_isDirty; 14 | void *m_dc; 15 | // CDC* m_dc; 16 | int m_id; 17 | int m_state; 18 | int m_stateCnt; 19 | int m_show; 20 | unsigned long m_trans; 21 | unsigned long m_transTarget; 22 | unsigned long m_transTime; 23 | 24 | UIWindow(class UIWindow&) {}; 25 | UIWindow::UIWindow() {}; 26 | 27 | // void UIWindow::Create(int cx, int cy); 28 | // void UIWindow::Destroy(); 29 | // void UIWindow::AddChild(class UIWindow* window); 30 | // void UIWindow::RemoveChild(class UIWindow* window); 31 | // void UIWindow::RemoveAllChildren(); 32 | // void UIWindow::ClearAllChildrenState(); 33 | // void UIWindow::InvalidateChildren(); 34 | // void UIWindow::SetId(int id); 35 | // int GetId(); 36 | // int UIWindow::IsFamily(class UIWindow* window); 37 | // class UIWindow* UIWindow::HitTest(int x, int y); 38 | // void UIWindow::DoDraw(int blitToParent); 39 | // unsigned char UIWindow::IsChildOf(class UIWindow* win); 40 | // class UIWindow* UIWindow::GetNextSiblingOf(class UIWindow* wnd); 41 | // class UIWindow* UIWindow::GetPrevSiblingOf(class UIWindow* wnd); 42 | // class UIWindow* UIWindow::GetAncestor(); 43 | // void UIWindow::GetGlobalCoor(int& x, int& y); 44 | // int IsShow(); 45 | // int GetX(); 46 | // int GetY(); 47 | // int GetHeight(); 48 | // int GetWidth(); 49 | // void UIWindow::DrawBitmap(int x, int y, class CBitmapRes* bitmap, unsigned char drawOnlyNoTrans); 50 | // void UIWindow::TextOutA(int x, int y, char* text, int textLen, int fontType, int fontHeight, unsigned long colorRef); 51 | // void UIWindow::TextOutWithRightAlign(int x, int y, char* text, int textLen, int fontType, int fontHeight, unsigned long colorRef); 52 | // void UIWindow::TextOutWithDecoration(int x, int y, char* text, int textLen, unsigned long* colorRef, int fontType, int fontHeight); 53 | // void UIWindow::TextOutWithShadow(int x, int y, char* text, int textLen, unsigned long colorText, unsigned long colorShadow, int fontType, int fontHeight); 54 | // void UIWindow::TextOutWithOutline(int x, int y, char* text, int textLen, unsigned long colorText, unsigned long colorOutline, int fontType, int fontHeight, unsigned char bold); 55 | // void UIWindow::TextOutWithDecoOutline(int x, int y, char* text, int textLen, unsigned long* colorText, unsigned long colorOutline, int fontType, int fontHeight, unsigned char bold); 56 | // void UIWindow::TextOutVertical(int x, int y, char* text, int textLen, int fontType, int fontHeight, unsigned long colorRef); 57 | // void UIWindow::TextOutWithOutlineVertical(int x, int y, char* text, int textLen, unsigned long colorText, unsigned long colorOutline, int fontType, int fontHeight, unsigned char bold); 58 | // void UIWindow::TextOutWithTwoColors(int x, int y, char* text, unsigned long colorRef, unsigned long colorRef2, int textLen, int fontType, int fontHeight); 59 | // int UIWindow::GetTextWidth(char* text, int textLen, int fontType, int fontHeight, unsigned char bold); 60 | // int UIWindow::GetTextHeight(char* text, int textLen, int fontType, int fontHeight, unsigned char bold); 61 | // int UIWindow::GetTextHeightVertical(char* text, int textLen, int fontType, int fontHeight, unsigned char bold); 62 | // int UIWindow::GetColorTextWidth(char* text, int textLen, int fontType, int fontHeight, unsigned char bold); 63 | // char* UIWindow::PolishText(char* text, int drawWidth, int fontType, int fontHeight, unsigned char bold); 64 | // char* UIWindow::PolishText2(char* text, int maxNumCharLine); 65 | // void UIWindow::PolishText3(char* text, class std::vector, std::allocator>, std::allocator, std::allocator>>>& strings, class std::vector>& enters, int width); 66 | // void UIWindow::PolishText4(char* text, class std::vector, std::allocator>, std::allocator, std::allocator>>>& strings, int width); 67 | // void UIWindow::ClearDC(unsigned long color); 68 | // void UIWindow::ClearDCRect(unsigned long color, struct tagRECT& rect); 69 | // void UIWindow::DrawBox(int x, int y, int cx, int cy, unsigned long color); 70 | // void UIWindow::DrawBorderLine(int x, int y, int w, int h, unsigned long color); 71 | // void UIWindow::DrawTriangleDC(int x1, int y1, int x2, int y2, int x3, int y3, unsigned long color); 72 | // char* UIWindow::InterpretColor(char* color_text, unsigned long* colorRef); 73 | // char* UIWindow::FindColorMark(char* text, char* text_end); 74 | // class UIWindow& operator = (class UIWindow&); 75 | // // void __local_vftable_ctor_closure(); 76 | 77 | virtual UIWindow::~UIWindow() {}; 78 | 79 | // virtual void UIWindow::Invalidate(); 80 | // virtual void UIWindow::InvalidateWallPaper(); 81 | // virtual void UIWindow::Resize(int cx, int cy); 82 | // virtual unsigned char UIWindow::IsFrameWnd(); 83 | // virtual unsigned char UIWindow::IsUpdateNeed(); 84 | // virtual void UIWindow::Move(int x, int y); 85 | // virtual unsigned char UIWindow::CanGetFocus(); 86 | // virtual unsigned char UIWindow::GetTransBoxInfo(struct BOXINFO* __formal); 87 | // virtual unsigned char UIWindow::IsTransmitMouseInput(); 88 | // virtual unsigned char UIWindow::ShouldDoHitTest(); 89 | // virtual void UIWindow::DragAndDrop(int x, int y, struct DRAG_INFO* dragInfo); 90 | // virtual void UIWindow::StoreInfo(); 91 | // virtual void UIWindow::SaveOriginalPos(); 92 | // virtual void UIWindow::MoveDelta(int deltaDragX, int deltaDragY); 93 | // virtual unsigned long UIWindow::GetColor(); 94 | // virtual void UIWindow::SetShow(int visible); 95 | // virtual void UIWindow::OnCreate(int cx, int cy); 96 | // virtual void UIWindow::OnDestroy(); 97 | // virtual void UIWindow::OnProcess(); 98 | // virtual void UIWindow::OnDraw(); 99 | // virtual void UIWindow::OnDraw2(); 100 | // virtual void UIWindow::OnRun(); 101 | // virtual void UIWindow::OnSize(int cx, int cy); 102 | // virtual void UIWindow::OnBeginEdit(); 103 | // virtual void UIWindow::OnFinishEdit(); 104 | // virtual void UIWindow::OnLBtnDown(int x, int y); 105 | // virtual void UIWindow::OnLBtnDblClk(int x, int y); 106 | // virtual void UIWindow::OnMouseMove(int x, int y); 107 | // virtual void UIWindow::OnMouseHover(int x, int y); 108 | // virtual void UIWindow::OnMouseShape(int x, int y); 109 | // virtual void UIWindow::OnLBtnUp(int x, int y); 110 | // virtual void UIWindow::OnRBtnDown(int x, int y); 111 | // virtual void UIWindow::OnRBtnUp(int x, int y); 112 | // virtual void UIWindow::OnRBtnDblClk(int x, int y); 113 | // virtual void UIWindow::OnWheel(int wheel); 114 | // virtual void UIWindow::RefreshSnap(); 115 | // virtual int UIWindow::SendMsg(class UIWindow* sender, int message, int val1, int val2, int val3, int val4); 116 | // virtual unsigned char UIWindow::GetTransBoxInfo2(struct BOXINFO* __formal); 117 | // virtual void UIWindow::DrawBoxScreen2(); 118 | // // virtual void* __vecDelDtor(unsigned int); 119 | }; 120 | 121 | class UIBalloonText : public UIWindow 122 | { 123 | public: 124 | unsigned char m_isBold; 125 | int m_fontSize; 126 | std::vector> m_strings; 127 | // class std::vector, std::allocator>, std::allocator, std::allocator>>> m_strings; 128 | unsigned long m_fontColor; 129 | unsigned long m_bgColor; 130 | unsigned char m_isBack; 131 | short m_charfont; 132 | 133 | UIBalloonText(class UIBalloonText&) {}; 134 | UIBalloonText::UIBalloonText() {}; 135 | void UIBalloonText::SetText(char* msg, int maxNumCharLine) {}; 136 | void UIBalloonText::AddText(char* msg) {}; 137 | void SetFntColor(unsigned long, unsigned long) {}; 138 | void UIBalloonText::SetFntSize(int fontSize) {}; 139 | void SetBackTrans(unsigned char) {}; 140 | void SetCharFont(short) {}; 141 | void UIBalloonText::AdjustSizeByText() {}; 142 | class UIBalloonText& operator = (class UIBalloonText&) {}; 143 | 144 | virtual UIBalloonText::~UIBalloonText() {}; 145 | virtual void UIBalloonText::OnProcess() {}; 146 | virtual void UIBalloonText::OnDraw() {}; 147 | virtual unsigned char UIBalloonText::ShouldDoHitTest() {}; 148 | }; 149 | 150 | class UITransBalloonText : public UIBalloonText 151 | { 152 | public: 153 | struct BOXINFO m_transBoxInfo; 154 | 155 | UITransBalloonText(class UITransBalloonText&) {}; 156 | UITransBalloonText::UITransBalloonText() {}; 157 | void UITransBalloonText::SetTransBoxColor(unsigned long transboxColor) {}; 158 | class UITransBalloonText& operator = (class UITransBalloonText&) {}; 159 | 160 | virtual UITransBalloonText::~UITransBalloonText() {}; 161 | virtual void UITransBalloonText::OnDraw() {}; 162 | virtual unsigned char UITransBalloonText::GetTransBoxInfo(struct BOXINFO* boxInfo) {}; 163 | virtual void UITransBalloonText::OnCreate(int cx, int cy) {}; 164 | virtual void UITransBalloonText::Move(int x, int y) {}; 165 | virtual void UITransBalloonText::Resize(int cx, int cy) {}; 166 | }; 167 | -------------------------------------------------------------------------------- /Injection/Core/FastFont/FastFont.cpp: -------------------------------------------------------------------------------- 1 | #include "FastFont.h" 2 | 3 | CFastFont::CFastFont() 4 | { 5 | m_hFont = NULL; 6 | m_pCacheInfo = NULL; 7 | m_HashDivideNums = 0; 8 | m_pDefaultBuffer = NULL; 9 | m_DefaultBufferSize = 0; 10 | m_OutLineFormat = GGO_BITMAP; 11 | 12 | m_Data2PicFunc = NULL; 13 | m_DistPtr = NULL; 14 | m_DistPitch = 0; 15 | m_DistBits = 0; 16 | m_BltAAMode = 0; 17 | } 18 | 19 | CFastFont::~CFastFont(void) 20 | { 21 | if (m_pDefaultBuffer) 22 | { 23 | delete[] m_pDefaultBuffer; 24 | m_pDefaultBuffer = NULL; 25 | } 26 | 27 | if (m_pCacheInfo) 28 | { 29 | delete m_pCacheInfo; 30 | m_pCacheInfo = NULL; 31 | } 32 | 33 | if (m_hDC) 34 | { 35 | // SelectObject(m_hDC, m_hOldFont); 36 | DeleteDC(m_hDC); 37 | 38 | m_hDC = NULL; 39 | } 40 | 41 | if (m_hFont) 42 | DeleteObject(m_hFont); 43 | } 44 | 45 | void CFastFont::GetMaxSize(SIZE *pSize) 46 | { 47 | pSize->cx = m_TM.tmMaxCharWidth; 48 | pSize->cy = m_TM.tmHeight; 49 | } 50 | 51 | bool CFastFont::CreateFastFont(LOGFONT *lplf, int OutLineFormat, int HashDivideNums) 52 | { 53 | m_HashDivideNums = HashDivideNums; 54 | m_OutLineFormat = OutLineFormat; 55 | 56 | m_hFont = CreateFontIndirect(lplf); 57 | 58 | if (m_hFont) 59 | { 60 | // fix a work buffer. 61 | m_hDC = CreateCompatibleDC(NULL); 62 | 63 | if (!m_hDC) 64 | { 65 | DeleteObject(m_hFont); 66 | return false; 67 | } 68 | 69 | m_hOldFont = (HFONT)SelectObject(m_hDC, m_hFont); 70 | GetTextMetrics(m_hDC, &m_TM); 71 | 72 | m_DefaultBufferSize = m_TM.tmHeight * ((m_TM.tmMaxCharWidth + 3) & 0xfffffffc); // max size 73 | m_pDefaultBuffer = new BYTE[m_DefaultBufferSize]; 74 | 75 | if (!m_pDefaultBuffer) 76 | { 77 | DeleteObject(m_hFont); 78 | 79 | return false; 80 | } 81 | 82 | m_pCacheInfo = new CacheInfo(m_HashDivideNums); 83 | 84 | if (!m_pCacheInfo) 85 | { 86 | delete[] m_pDefaultBuffer; 87 | DeleteObject(m_hFont); 88 | 89 | return false; 90 | } 91 | 92 | return true; 93 | } 94 | 95 | return false; 96 | } 97 | 98 | int CFastFont::DebugGetHashEntrys(int hashtableno) 99 | { 100 | int nums = 0; 101 | 102 | if (m_pCacheInfo) 103 | nums = m_pCacheInfo->DebugGetHashEntrys(hashtableno); 104 | 105 | return nums; 106 | } 107 | 108 | void CFastFont::ClearCache(void) 109 | { 110 | m_pCacheInfo->ClearCache(); 111 | } 112 | 113 | #if 0 114 | void CFastFont::GetStringImage(LPTSTR str) 115 | { 116 | SIZE TSize; 117 | int code; 118 | 119 | TCHAR *c; 120 | c = str; 121 | 122 | while (c[0] != _T('\0')) 123 | { 124 | SIZE tempsize; 125 | 126 | #if _UNICODE 127 | code = (int)*c++; 128 | #else 129 | if (IsDBCSLeadByte(*c)) 130 | { 131 | code = (BYTE)c[0] << 8 | (BYTE)c[1]; 132 | c += 2; 133 | } 134 | else 135 | { 136 | code = *c++; 137 | } 138 | #endif 139 | 140 | m_pFastFont->GetFontData(code, &tempsize); 141 | TSize.cx += tempsize.cx; 142 | TSize.cy = tempsize.cy; 143 | } 144 | 145 | TSize.cx += 2; 146 | TSize.cy += 2; 147 | } 148 | #endif 149 | 150 | CFastFont::StOutlineFontData *CFastFont::GetFontData(int code, SIZE *pSize) 151 | { 152 | StOutlineFontData *pData; 153 | 154 | pData = (StOutlineFontData*)m_pCacheInfo->GetCacheData(code); 155 | 156 | if (!pData) 157 | { 158 | int size; 159 | DWORD imagesize; 160 | CONST MAT2 Mat = {{0, 1}, {0, 0}, {0, 0}, {0, 1}}; 161 | GLYPHMETRICS GM; 162 | 163 | imagesize = GetGlyphOutline(m_hDC, code, m_OutLineFormat, &GM, m_DefaultBufferSize, m_pDefaultBuffer, &Mat); 164 | 165 | if (imagesize == GDI_ERROR) 166 | { 167 | GLYPHMETRICS tempGM; 168 | imagesize = 0; 169 | 170 | if (GetGlyphOutline(m_hDC, code, GGO_METRICS, &tempGM, 0, NULL, &Mat) != GDI_ERROR) 171 | { 172 | GM.gmBlackBoxX = 0; 173 | GM.gmBlackBoxY = 0; 174 | GM.gmCellIncX = tempGM.gmCellIncX; 175 | GM.gmCellIncY = 0; 176 | 177 | GM.gmptGlyphOrigin.x = 0; 178 | GM.gmptGlyphOrigin.y = m_TM.tmAscent; 179 | } 180 | else 181 | { 182 | // error code 183 | GM.gmBlackBoxX = 0; 184 | GM.gmBlackBoxY = 0; 185 | GM.gmCellIncX = (short)m_TM.tmMaxCharWidth; 186 | GM.gmCellIncY = 0; 187 | 188 | GM.gmptGlyphOrigin.x = 0; 189 | GM.gmptGlyphOrigin.y = m_TM.tmAscent; 190 | } 191 | } 192 | 193 | size = sizeof(StOutlineFontData) + (imagesize - 1); 194 | pData = (StOutlineFontData*)m_pCacheInfo->CreateData(code, size); 195 | 196 | if (pData) 197 | { 198 | memcpy(&pData->GM, &GM, sizeof(GLYPHMETRICS)); 199 | 200 | if (imagesize) 201 | memcpy(pData->Image, m_pDefaultBuffer, imagesize); 202 | } 203 | } 204 | 205 | if (pData && pSize) 206 | { 207 | pSize->cx = pData->GM.gmCellIncX; 208 | pSize->cy = m_TM.tmHeight; 209 | } 210 | 211 | return pData; 212 | } 213 | 214 | void CFastFont::SetBltStatus(void *dist, DWORD pitch, DWORD bits, int mode, funcFFDATA2PIC func) 215 | { 216 | m_Data2PicFunc = func; 217 | m_DistPtr = (BYTE*)dist; 218 | m_DistPitch = pitch; 219 | m_DistBits = bits; 220 | m_BltAAMode = mode; 221 | } 222 | 223 | void CFastFont::BltFontData(int code, int x, int y, SIZE *pSize) 224 | { 225 | StOutlineFontData *pData; 226 | 227 | pData = GetFontData(code, pSize); 228 | 229 | if (pData) 230 | { 231 | int iOfs_x = pData->GM.gmptGlyphOrigin.x; 232 | int iOfs_y = m_TM.tmAscent - pData->GM.gmptGlyphOrigin.y; 233 | int iBmp_w = (pData->GM.gmBlackBoxX + 3) & 0xfffffffc; 234 | int iBmp_h = pData->GM.gmBlackBoxY; 235 | 236 | int iUseBYTEparLine = ((iBmp_w + 31) / 32) * 4; 237 | int xx, yy; 238 | 239 | DWORD Alpha; 240 | BYTE *ptr = pData->Image; 241 | int Level = 0; 242 | 243 | switch (m_OutLineFormat) 244 | { 245 | case GGO_BITMAP: 246 | Level = 0; 247 | break; 248 | 249 | case GGO_GRAY2_BITMAP: 250 | Level = 5; 251 | break; 252 | 253 | case GGO_GRAY4_BITMAP: 254 | Level = 17; 255 | break; 256 | 257 | case GGO_GRAY8_BITMAP: 258 | Level = 65; 259 | break; 260 | } 261 | 262 | if (m_BltAAMode) 263 | { 264 | DWORD *AlphaTable = new DWORD[iBmp_w + 1]; 265 | memset(AlphaTable, 0, sizeof(DWORD) * (iBmp_w + 1)); 266 | 267 | for (yy = 0; yy < iBmp_h + 1; yy++) 268 | { 269 | DWORD old_Alpha = 0; 270 | Alpha = 0; 271 | 272 | for (xx = 0; xx < iBmp_w + 1; xx++) 273 | { 274 | old_Alpha = Alpha; 275 | 276 | if (xx == iBmp_w || yy == iBmp_h) 277 | { 278 | Alpha = 0; 279 | } 280 | else 281 | { 282 | if (Level) 283 | { 284 | Alpha = (448 * ptr[xx + iBmp_w * yy]) / (Level - 1); 285 | } 286 | else 287 | { 288 | BYTE Cur = (*((BYTE*)ptr + iUseBYTEparLine * yy + (xx / 8)) >> (7 - xx % 8)) & 0x1; 289 | Alpha = Cur * 448; 290 | } 291 | } 292 | 293 | Alpha = (Alpha + old_Alpha + AlphaTable[xx]) / 3; 294 | 295 | if (Alpha > 255) 296 | Alpha = 255; 297 | 298 | if (Alpha < 64) 299 | Alpha = 0; 300 | 301 | AlphaTable[xx] = Alpha; 302 | 303 | if (m_Data2PicFunc) 304 | m_Data2PicFunc(m_DistPtr + m_DistPitch * (y + yy + iOfs_y) + (m_DistBits / 8) * (x + xx + iOfs_x), Alpha); 305 | } 306 | } 307 | 308 | delete[] AlphaTable; 309 | } 310 | else 311 | { 312 | for (yy = 0; yy < iBmp_h; yy++) 313 | { 314 | for (xx = 0; xx < iBmp_w; xx++) 315 | { 316 | if (Level) 317 | { 318 | Alpha = (255 * ptr[xx + iBmp_w * yy]) / (Level - 1); 319 | } 320 | else 321 | { 322 | BYTE Cur = (*((BYTE*)ptr + iUseBYTEparLine * yy + (xx / 8)) >> (7 - xx % 8)) & 0x1; 323 | Alpha = Cur * 255; 324 | } 325 | 326 | if (m_Data2PicFunc) 327 | m_Data2PicFunc(m_DistPtr + m_DistPitch * (y + yy + iOfs_y) + (m_DistBits / 8) * (x + xx + iOfs_x), Alpha); 328 | } 329 | } 330 | } 331 | } 332 | } 333 | 334 | /* 335 | #include 336 | 337 | void CFastFont::test(int mode) 338 | { 339 | CONST MAT2 Mat = {{0, 1}, {0, 0}, {0, 0}, {0, 1}}; 340 | GLYPHMETRICS GM; 341 | int code; 342 | DWORD imagesize; 343 | code = (int)_T("Ah"); 344 | 345 | switch (mode) 346 | { 347 | case 0: 348 | imagesize = GetGlyphOutline(m_hDC, code, m_OutLineFormat, &GM, 0, NULL, &Mat); 349 | break; 350 | 351 | case 1: 352 | { 353 | // The larger the buffer size, the longer it takes 354 | BYTE g_data[64 * 64]; 355 | GetGlyphOutline(m_hDC, code, m_OutLineFormat, &GM, 64 * 64, g_data, &Mat); 356 | } 357 | break; 358 | 359 | case 2: 360 | { 361 | // Other than getting the buffer size by NULL, the load is high. 362 | BYTE *pdata; 363 | imagesize = GetGlyphOutline(m_hDC, code, m_OutLineFormat, &GM, 0, NULL, &Mat); 364 | pdata = new BYTE[imagesize]; 365 | GetGlyphOutline(m_hDC, code, m_OutLineFormat, &GM, imagesize, pdata, &Mat); 366 | delete[] pdata; 367 | } 368 | break; 369 | 370 | case 3: 371 | { 372 | // If you can grasp the font size to some extent 373 | // Reserve the acquisition buffer in advance, create a buffer after acquisition and copy is the fastest 374 | BYTE g_data[64 * 64]; 375 | BYTE *pdata; 376 | imagesize = GetGlyphOutline(m_hDC, code, m_OutLineFormat, &GM, 64 * 64, g_data, &Mat); 377 | pdata = new BYTE[imagesize]; 378 | memcpy(g_data, pdata, imagesize); 379 | delete[] pdata; 380 | } 381 | break; 382 | 383 | default: 384 | break; 385 | } 386 | } 387 | */ 388 | -------------------------------------------------------------------------------- /Injection/ProxyIDirectDraw.cpp: -------------------------------------------------------------------------------- 1 | #include "tinyconsole.h" 2 | #include "ProxyIDirectDraw.h" 3 | 4 | #include "Core/RoCodeBind.h" 5 | 6 | CProxyIDirectDraw7* CProxyIDirectDraw7::lpthis; 7 | 8 | CProxyIDirectDraw7::CProxyIDirectDraw7(IDirectDraw7 *ptr):m_Instance(ptr), CooperativeLevel(0), PrimarySurfaceFlag(0), TargetSurface(NULL) 9 | { 10 | g_pRoCodeBind = new CRoCodeBind(); 11 | DEBUG_LOGGING_MORE_DETAIL(("IDirectDraw7::Create.")); 12 | } 13 | 14 | CProxyIDirectDraw7::~CProxyIDirectDraw7() 15 | { 16 | DEBUG_LOGGING_MORE_DETAIL(("IDirectDraw7::Release.")); 17 | } 18 | 19 | ULONG CProxyIDirectDraw7::Proxy_Release(void) 20 | { 21 | ULONG Count; 22 | 23 | if (g_pRoCodeBind)delete g_pRoCodeBind; 24 | Count = m_Instance->Release(); 25 | DEBUG_LOGGING_MORE_DETAIL(("CProxyIDirectDraw7::Release(): RefCount = %d", Count)); 26 | delete this; 27 | 28 | return Count; 29 | } 30 | 31 | HRESULT CProxyIDirectDraw7::Proxy_RestoreAllSurfaces(void) 32 | { 33 | return m_Instance->RestoreAllSurfaces(); 34 | } 35 | 36 | HRESULT CProxyIDirectDraw7::Proxy_QueryInterface(THIS_ REFIID riid, LPVOID FAR *ppvObj) 37 | { 38 | DEBUG_LOGGING_MORE_DETAIL(("CProxyIDirectDraw7::QueryInterface()")); 39 | 40 | if (IsEqualGUID(riid, IID_IDirect3D7)) 41 | { 42 | DEBUG_LOGGING_MORE_DETAIL(("CProxyIDirectDraw7::IDirect3D7 Create.")); 43 | HRESULT temp_ret = m_Instance->QueryInterface(riid, ppvObj); 44 | 45 | if (temp_ret == S_OK) 46 | { 47 | void *ret_cProxy; 48 | // LPVOID FAR *ppvObj_proxy; 49 | ret_cProxy = new CProxyIDirect3D7((IDirect3D7*) *ppvObj); 50 | *ppvObj = ret_cProxy; 51 | 52 | return S_OK; 53 | } 54 | else 55 | { 56 | return temp_ret; 57 | } 58 | } 59 | 60 | return m_Instance->QueryInterface(riid, ppvObj); 61 | } 62 | 63 | HRESULT CProxyIDirectDraw7::Proxy_CreateSurface(LPDDSURFACEDESC2 SurfaceDesc, LPDIRECTDRAWSURFACE7 FAR *CreatedSurface, IUnknown FAR *pUnkOuter) 64 | { 65 | DDSURFACEDESC2 OrgSurfaceDesc2 = *SurfaceDesc; 66 | 67 | DEBUG_LOGGING_MORE_DETAIL(("IDirectDraw7::CreateSurface(): Desc.dwFlags = 0x%x", SurfaceDesc->dwFlags)); 68 | DEBUG_LOGGING_MORE_DETAIL(("DDSD_BACKBUFFERCOUNT = %x", DDSD_BACKBUFFERCOUNT)); 69 | HRESULT Result = m_Instance->CreateSurface(SurfaceDesc, CreatedSurface, pUnkOuter); 70 | 71 | if (FAILED(Result)) 72 | return Result; 73 | 74 | if (SurfaceDesc->dwFlags & DDSD_CAPS) 75 | { 76 | DDSCAPS2* Caps = &SurfaceDesc->ddsCaps; 77 | DEBUG_LOGGING_MORE_DETAIL((" Desc.ddsCaps.dwCaps = 0x%x", Caps->dwCaps)); 78 | 79 | if (Caps->dwCaps == DDSCAPS_BACKBUFFER) 80 | { 81 | DEBUG_LOGGING_MORE_DETAIL(("BackBuffer Surface")); 82 | } 83 | 84 | DEBUG_LOGGING_MORE_DETAIL(("%0x | W %d | H %d", *CreatedSurface, SurfaceDesc->dwWidth, SurfaceDesc->dwHeight)); 85 | 86 | if (Caps->dwCaps & DDSCAPS_PRIMARYSURFACE) 87 | { 88 | *CreatedSurface = new CProxyIDirectDrawSurface7(*CreatedSurface); 89 | DEBUG_LOGGING_MORE_DETAIL(("Primary Surface = %0x", CreatedSurface)); 90 | PrimarySurfaceFlag = 1; 91 | } 92 | else if (Caps->dwCaps & DDSCAPS_3DDEVICE) 93 | { 94 | if (CooperativeLevel & DDSCL_FULLSCREEN && !PrimarySurfaceFlag) 95 | { 96 | DEBUG_LOGGING_MORE_DETAIL(("Hook the 3D Device Rendering Surface.")); 97 | DEBUG_LOGGING_MORE_DETAIL((" FullScreen Mode")); 98 | *CreatedSurface = new CProxyIDirectDrawSurface7(*CreatedSurface); 99 | 100 | // SetScreenSize((int)SurfaceDesc->dwWidth, (int)SurfaceDesc->dwHeight); 101 | } 102 | else 103 | { 104 | DEBUG_LOGGING_MORE_DETAIL(("Hook the 3D Device Rendering Surface.")); 105 | DEBUG_LOGGING_MORE_DETAIL((" Window Mode")); 106 | TargetSurface = *CreatedSurface; 107 | 108 | // SetScreenSize((int)SurfaceDesc->dwWidth, (int)SurfaceDesc->dwHeight); 109 | } 110 | } 111 | else 112 | { 113 | if (CooperativeLevel & DDSCL_FULLSCREEN) 114 | { 115 | if (Caps->dwCaps & DDSCAPS_BACKBUFFER) 116 | { 117 | DEBUG_LOGGING_MORE_DETAIL(("Hook Rendering Surface without 3D Device.")); 118 | DEBUG_LOGGING_MORE_DETAIL((" FullScreen Mode")); 119 | *CreatedSurface = new CProxyIDirectDrawSurface7(*CreatedSurface); 120 | } 121 | } 122 | else 123 | { 124 | if (Caps->dwCaps & DDSCAPS_BACKBUFFER) 125 | { 126 | DEBUG_LOGGING_MORE_DETAIL(("Hook Rendering Surface without 3D Device.")); 127 | DEBUG_LOGGING_MORE_DETAIL((" Window Mode")); 128 | } 129 | } 130 | } 131 | } 132 | 133 | return Result; 134 | } 135 | 136 | HRESULT CProxyIDirectDraw7::Proxy_GetDisplayMode(LPDDSURFACEDESC2 Desc) 137 | { 138 | DEBUG_LOGGING_MORE_DETAIL(("IDirectDraw7::GetDisplayMode()")); 139 | HRESULT Result = m_Instance->GetDisplayMode(Desc); 140 | 141 | if (FAILED(Result)) 142 | return Result; 143 | 144 | DWORD RefreshRate = Desc->dwRefreshRate; 145 | DEBUG_LOGGING_MORE_DETAIL((" RefreshRate = %d", Desc->dwRefreshRate)); 146 | 147 | if (RefreshRate == 0) 148 | { 149 | DEBUG_LOGGING_MORE_DETAIL((" RefreshRate = %d >> dummyset 100", Desc->dwRefreshRate)); 150 | RefreshRate = 100; 151 | } 152 | 153 | g_PerformanceCounter.SetMonitorRefreshRate((int)RefreshRate); 154 | 155 | return Result; 156 | } 157 | 158 | HRESULT CProxyIDirectDraw7::Proxy_SetCooperativeLevel(HWND hWnd, DWORD dwFlags) 159 | { 160 | DEBUG_LOGGING_MORE_DETAIL(("IDirectDraw7::SetCooperativeLevel(): dwFlags = 0x%x", dwFlags)); 161 | 162 | if (g_pSharedData) 163 | g_pSharedData->g_hROWindow = hWnd; 164 | 165 | if (g_pRoCodeBind) 166 | g_pRoCodeBind->InitWindowHandle(hWnd); 167 | 168 | DDSURFACEDESC2 dummy; 169 | dummy.dwSize = sizeof(DDSURFACEDESC2); 170 | Proxy_GetDisplayMode(&dummy); 171 | CooperativeLevel = dwFlags; 172 | 173 | return m_Instance->SetCooperativeLevel(hWnd, dwFlags); 174 | } 175 | 176 | HRESULT CProxyIDirectDraw7::Proxy_SetDisplayMode(DWORD p1, DWORD p2, DWORD p3, DWORD p4, DWORD p5) 177 | { 178 | DEBUG_LOGGING_MORE_DETAIL(("IDirectDraw7::SetDisplayMode()")); 179 | HRESULT Result = m_Instance->SetDisplayMode(p1, p2, p3, p4, p5); 180 | 181 | if (FAILED(Result)) 182 | return Result; 183 | 184 | DEBUG_LOGGING_MORE_DETAIL((" %d | %d | %d | %d | %d", p1, p2, p3, p4, p5)); 185 | 186 | DDSURFACEDESC2 Desc; 187 | ::ZeroMemory(&Desc, sizeof(Desc)); 188 | Desc.dwSize = sizeof(Desc); 189 | m_Instance->GetDisplayMode(&Desc); 190 | DEBUG_LOGGING_MORE_DETAIL((" RefreshRate = %d", Desc.dwRefreshRate)); 191 | DWORD RefreshRate = Desc.dwRefreshRate; 192 | 193 | if (RefreshRate == 0) 194 | { 195 | DEBUG_LOGGING_MORE_DETAIL((" RefreshRate = %d >> dummyset 100", Desc.dwRefreshRate)); 196 | RefreshRate = 100; 197 | } 198 | 199 | g_PerformanceCounter.SetMonitorRefreshRate((int)RefreshRate); 200 | 201 | return Result; 202 | } 203 | 204 | HRESULT CProxyIDirectDraw7::Proxy_WaitForVerticalBlank(DWORD dwFlags, HANDLE hEvent) 205 | { 206 | static double VSyncWaitTick = 0.0; 207 | 208 | // DEBUG_LOGGING_MORE_DETAIL(("IDirectDraw7::WaitForVerticalBlank(): dwFlags = 0x%x | hEvent = 0x%x", dwFlags, hEvent)); 209 | HRESULT result; 210 | 211 | g_PerformanceCounter.ModifiCounter(); 212 | 213 | if ((CooperativeLevel & DDSCL_FULLSCREEN) == 0) 214 | { 215 | if (g_pSharedData && g_pSharedData->fix_windowmode_vsyncwait) 216 | { 217 | Sleep((DWORD)((VSyncWaitTick * 950) / 1000)); 218 | g_PerformanceCounter.InitInstaltPerformance(); 219 | result = m_Instance->WaitForVerticalBlank(dwFlags, hEvent); 220 | VSyncWaitTick = g_PerformanceCounter.CalcInstaltPerformance(); 221 | // result = m_Instance->WaitForVerticalBlank(dwFlags, hEvent); 222 | result = DD_OK; 223 | } 224 | else 225 | { 226 | result = m_Instance->WaitForVerticalBlank(dwFlags, hEvent); 227 | } 228 | } 229 | else 230 | { 231 | result = m_Instance->WaitForVerticalBlank(dwFlags, hEvent); 232 | } 233 | 234 | return result; 235 | } 236 | 237 | HRESULT CProxyIDirect3D7::Proxy_CreateDevice(REFCLSID rclsid, LPDIRECTDRAWSURFACE7 lpDDS, LPDIRECT3DDEVICE7 *lplpD3DDevice) 238 | { 239 | DEBUG_LOGGING_MORE_DETAIL(("CProxyIDirect3D7::CreateDevice2()")); 240 | HRESULT temp_ret = m_Instance->CreateDevice(rclsid, lpDDS, lplpD3DDevice); 241 | 242 | if (temp_ret == D3D_OK) 243 | { 244 | void *ret_cProxy; 245 | ret_cProxy = new CProxyIDirect3DDevice7((IDirect3DDevice7*) *lplpD3DDevice, lpDDS); 246 | *lplpD3DDevice = (LPDIRECT3DDEVICE7)ret_cProxy; 247 | 248 | return D3D_OK ; 249 | } 250 | 251 | return temp_ret; 252 | } 253 | 254 | void CProxyIDirect3DDevice7::Proxy_Release(void) 255 | { 256 | // Empty 257 | } 258 | 259 | HRESULT CProxyIDirect3DDevice7::Proxy_SetRenderState(THIS_ D3DRENDERSTATETYPE dwRenderStateType, DWORD dwRenderState) 260 | { 261 | // DEBUG_LOGGING_MORE_DETAIL(("CProxyIDirect3D7::Proxy_SetRenderState(): type = %08X | val = %08X", dwRenderStateType, dwRenderState)); 262 | 263 | if (dwRenderStateType == D3DRENDERSTATE_ZENABLE && dwRenderState == 0) 264 | { 265 | // UI is drawn after the Zbuffer is disabled. 266 | if (g_pRoCodeBind) 267 | g_pRoCodeBind->DrawOn3DMap(m_Instance); 268 | } 269 | 270 | return m_Instance->SetRenderState(dwRenderStateType, dwRenderState); 271 | } 272 | 273 | HRESULT CProxyIDirect3DDevice7::Proxy_BeginScene(void) 274 | { 275 | HRESULT result; 276 | 277 | if (m_firstonce) 278 | { 279 | m_firstonce = false; 280 | 281 | if (g_pRoCodeBind) 282 | g_pRoCodeBind->Init(m_Instance); 283 | } 284 | 285 | m_frameonce = TRUE; 286 | // DEBUG_LOGGING_MORE_DETAIL(("CProxyIDirect3D7::Proxy_BeginScene()")); 287 | 288 | result = m_Instance->BeginScene(); 289 | 290 | return result; 291 | } 292 | 293 | HRESULT CProxyIDirect3DDevice7::Proxy_EndScene(void) 294 | { 295 | g_PerformanceCounter.ModifiFrameRate(); 296 | 297 | if (g_pRoCodeBind) 298 | g_pRoCodeBind->DrawSRHDebug(m_Instance); 299 | 300 | return m_Instance->EndScene(); 301 | } 302 | -------------------------------------------------------------------------------- /Injection/Core/ro/map.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | struct CLightmap 4 | { 5 | unsigned char brightObj[3]; 6 | CTexture* surface; 7 | struct texCoor coor[4]; 8 | struct COLOR intensity[4]; 9 | }; 10 | 11 | struct CAttrCell 12 | { 13 | float h1; 14 | float h2; 15 | float h3; 16 | float h4; 17 | int flag; 18 | }; 19 | 20 | class C3dAttr : public CRes 21 | { 22 | public: 23 | int m_width; 24 | int m_height; 25 | int m_zoom; 26 | 27 | std::vector m_cells; 28 | 29 | C3dAttr(class C3dAttr&) {}; 30 | C3dAttr::C3dAttr(class Exemplar __formal, char* resid, char* baseDir) {}; 31 | C3dAttr::C3dAttr() {}; 32 | 33 | void Create(int w, int h) 34 | { 35 | m_cells.reserve(w * h); 36 | } 37 | 38 | float C3dAttr::GetHeight(float x, float z) {}; 39 | 40 | int C3dAttr::GetAttr(float x, float z) 41 | { 42 | long cx, cy; 43 | ConvertToCellCoor(x, z, cx, cy); 44 | 45 | return m_cells[cx + cy * m_width].flag; 46 | }; 47 | 48 | struct CAttrCell* GetCell(int Cellx, int Celly) 49 | { 50 | return &m_cells[Cellx + Celly * m_width]; 51 | }; 52 | 53 | float C3dAttr::RayTest(struct ray3d& ray, int x, int y) {}; 54 | 55 | void C3dAttr::SetCellInfo(int Type, int Cellx, int Celly) 56 | { 57 | m_cells[Cellx + Celly * m_width].flag = Type; 58 | }; 59 | 60 | void C3dAttr::GetWorldPos(float attrX, float attrY, struct vector2d& pos) 61 | { 62 | pos.x = ((attrX - m_width / 2) * (float)m_zoom) + 2.5f; 63 | pos.y = ((attrY - m_height / 2) * (float)m_zoom) + 2.5f; 64 | }; 65 | 66 | void ConvertToCellCoor(float x, float z, long& cx, long& cy) 67 | { 68 | cx = (long)(x / m_zoom + m_width / 2); 69 | cy = (long)(z / m_zoom + m_height / 2); 70 | }; 71 | 72 | void C3dAttr::GetHeightMinMax(struct tagRECT& area, float& topHeight, float& bottomHeight) {}; 73 | class C3dAttr& operator = (class C3dAttr&) {}; 74 | 75 | virtual class CRes* C3dAttr::Clone() {}; 76 | virtual unsigned char C3dAttr::Load(char* fName) {}; 77 | virtual void C3dAttr::Reset() {}; 78 | virtual C3dAttr::~C3dAttr() {}; 79 | }; 80 | 81 | class CLightmapMgr 82 | { 83 | public: 84 | std::vector m_lightmaps; 85 | std::vector m_lmSurfaces; 86 | int m_numLightmaps; 87 | int m_numLmSurfaces; 88 | 89 | CLightmapMgr(class CLightmapMgr&) {}; 90 | CLightmapMgr::CLightmapMgr() {}; 91 | CLightmapMgr::~CLightmapMgr() {}; 92 | void CLightmapMgr::Create(class CGndRes* gnd) {}; 93 | void CLightmapMgr::Reset() {}; 94 | class CLightmapMgr& operator = (class CLightmapMgr&) {}; 95 | }; 96 | 97 | class C3dGround 98 | { 99 | public: 100 | class C3dAttr* m_attr; 101 | int m_width; 102 | int m_height; 103 | float m_zoom; 104 | CLightmapMgr m_lightmapMgr; 105 | int m_numSurfaces; 106 | float m_waterLevel; 107 | int m_texAnimCycle; 108 | int m_wavePitch; 109 | int m_waveSpeed; 110 | int m_waterSet; 111 | float m_waveHeight; 112 | CTexture* m_waterTex; 113 | CTexture* m_pBumpMap; 114 | int m_waterCnt; 115 | int m_waterOffset; 116 | int m_isNewVer; 117 | 118 | virtual ~C3dGround() {}; 119 | }; 120 | 121 | class C3dNode 122 | { 123 | struct ColorInfo 124 | { 125 | unsigned long color[3]; 126 | struct COLOR argb[3]; 127 | struct vector2d uv[3]; 128 | ColorInfo() {}; 129 | }; 130 | 131 | class C3dActor* m_master; 132 | void* m_mesh; 133 | // class C3dMesh* m_mesh; 134 | char m_name[128]; 135 | int m_numTexture; 136 | std::vector m_texture; 137 | float m_opacity; 138 | C3dNode* m_parent; 139 | std::list m_child; 140 | struct matrix m_ltm; 141 | C3dPosAnim m_posAnim; 142 | C3dRotAnim m_rotAnim; 143 | class C3dScaleAnim m_scaleAnim; 144 | class std::vector m_colorInfo; 145 | class std::vector m_destVertCol; 146 | int m_isAlphaForPlayer; 147 | struct C3dAABB m_aabb; 148 | 149 | virtual ~C3dNode() {}; 150 | }; 151 | 152 | class C3dActor 153 | { 154 | class C3dNode* m_node; 155 | char m_name[128]; 156 | struct vector3d m_pos; 157 | struct vector3d m_rot; 158 | struct vector3d m_scale; 159 | int m_shadeType; 160 | int m_curMotion; 161 | int m_animType; 162 | int m_animLen; 163 | float m_animSpeed; 164 | struct matrix m_wtm; 165 | struct matrix m_iwtm; 166 | struct vector3d m_posOffset; 167 | int m_isMatrixNeedUpdate; 168 | int m_isBbNeedUpdate; 169 | struct C3dOBB m_oBoundingBox; 170 | struct C3dAABB m_aaBoundingBox; 171 | int m_renderSignature; 172 | int m_isHideCheck; 173 | unsigned char m_isHalfAlpha; 174 | unsigned char m_fadeAlphaCnt; 175 | std::list m_volumeBoxList; 176 | int m_blockType; 177 | 178 | virtual ~C3dActor() {}; 179 | }; 180 | 181 | struct SceneGraphNode 182 | { 183 | struct SceneGraphNode* m_parent; 184 | struct SceneGraphNode* m_child[4]; 185 | struct C3dAABB m_aabb; 186 | struct vector3d m_center; 187 | struct vector3d m_halfSize; 188 | int m_needUpdate; 189 | std::vector m_actorList; 190 | C3dGround* m_ground; 191 | struct tagRECT m_groundArea; 192 | C3dAttr* m_attr; 193 | struct tagRECT m_attrArea; 194 | 195 | SceneGraphNode(struct SceneGraphNode&) {}; 196 | SceneGraphNode::SceneGraphNode() {}; 197 | SceneGraphNode::~SceneGraphNode() {}; 198 | void SceneGraphNode::Build(int level) {}; 199 | void SceneGraphNode::InsertObject(class C3dAttr* attr, int level) {}; 200 | void SceneGraphNode::InsertObject(class C3dGround* ground, int level) {}; 201 | void SceneGraphNode::InsertObject(class C3dActor* actor, int level) {}; 202 | void SceneGraphNode::RemoveObject(class C3dActor* actor, int level) {}; 203 | void SceneGraphNode::UpdateVolume(int level) {}; 204 | void SceneGraphNode::UpdateVolumeAfter(int level) {}; 205 | std::vector* SceneGraphNode::GetActorList(float x, float z, int level) {}; 206 | void SceneGraphNode::InsertObjectAfter(class C3dActor* actor, int level) {}; 207 | void SceneGraphNode::CopySceneGraph(int Level, struct SceneGraphNode* graph) {}; 208 | void SceneGraphNode::LoadSceneGraph(class CFile* fp, int Level) {}; 209 | struct SceneGraphNode& operator = (struct SceneGraphNode&) {}; 210 | }; 211 | 212 | class CViewFrustum 213 | { 214 | public: 215 | std::list m_cubeletListTotal; 216 | std::list m_cubeletListPartial; 217 | struct plane3d m_planes[6]; 218 | struct vector3d m_planeNormals[6]; 219 | 220 | CViewFrustum(class CViewFrustum&); 221 | CViewFrustum::CViewFrustum(); 222 | void CViewFrustum::Free(); 223 | void CViewFrustum::Build(float hratio, float vratio, struct matrix& viewMatrix, struct SceneGraphNode* rootNode); 224 | void CViewFrustum::CullSceneNode(struct SceneGraphNode* node, int level, unsigned char isTotallyInside); 225 | int CViewFrustum::CheckAABBIntersect(struct SceneGraphNode* node); 226 | int CViewFrustum::CheckOBBIntersect(struct C3dOBB& bb); 227 | class CViewFrustum& operator = (class CViewFrustum&); 228 | 229 | CViewFrustum::~CViewFrustum(); 230 | }; 231 | 232 | class CView 233 | { 234 | public: 235 | float m_sideQuake; 236 | float m_frontQuake; 237 | float m_latitudeQuake; 238 | unsigned char m_isFPSmode; 239 | int m_isQuake; 240 | unsigned long m_quakeStartTick; 241 | unsigned long m_QuakeTime; 242 | struct ViewInfo3d m_cur; 243 | struct ViewInfo3d m_dest; 244 | struct ViewInfo3d m_backupCur; 245 | struct ViewInfo3d m_backupDest; 246 | struct vector3d m_from; 247 | struct vector3d m_up; 248 | struct matrix m_viewMatrix; 249 | struct matrix m_invViewMatrix; 250 | class CViewFrustum m_viewFrustum; 251 | class CWorld* m_world; 252 | void* m_skyBox; 253 | // class CSkyBoxEllipse* m_skyBox; 254 | 255 | CView(class CView&) {}; 256 | CView::CView() {}; 257 | float GetCurLongitude() {}; 258 | float GetCurLatitude() {}; 259 | float GetCurDistance() {}; 260 | float GetDestLongitude() {}; 261 | float GetDestLatitude() {}; 262 | float GetDestDistance() {}; 263 | struct vector3d GetCurAt() {}; 264 | struct vector3d GetFrom() {}; 265 | struct matrix GetViewMatrix() {}; 266 | void SetDestLongitude(float) {}; 267 | void SetDestDistance(float) {}; 268 | void SetDestLatitude(float) {}; 269 | void SetDestAt(float, float, float) {}; 270 | void SetCurLongitude(float) {}; 271 | void SetCurDistance(float) {}; 272 | void SetCurLatitude(float) {}; 273 | void SetCurAt(float, float, float) {}; 274 | void AdjustDestLongitude(float) {}; 275 | void HoldAt() {}; 276 | void ResetLongitude(float) {}; 277 | void ResetLatitude(float) {}; 278 | void ResetDistance(float) {}; 279 | void ResetAt(float, float, float) {}; 280 | void PushCamera() {}; 281 | void PopCamera() {}; 282 | void CView::AddLongitude(float deltaLongitude) {}; 283 | void CView::AddLatitude(float deltaLatitude) {}; 284 | void CView::AddDistance(float deltaDistance) {}; 285 | void CView::SetQuake(int isQuake, int Type, float sideQuake, float frontQuake, float latitudeQuake) {}; 286 | void CView::SetQuakeInfo(float sideQuake, float frontQuake, float latitudeQuake) {}; 287 | void CView::GetEeyeVector(struct vector3d* eyeVector) {}; 288 | struct vector3d* GetEeyeFromVector() {}; 289 | unsigned char IsFPSmode() {}; 290 | void CView::InterpolateViewInfo() {}; 291 | void CView::ProcessQuake() {}; 292 | void CView::BuildViewMatrix() {}; 293 | class CView& operator = (class CView&) {}; 294 | 295 | virtual CView::~CView() {}; 296 | 297 | virtual void CView::OnEnterFrame() {}; 298 | virtual void CView::OnExitFrame() {}; 299 | virtual void CView::OnRender() {}; 300 | virtual void CView::OnCalcViewInfo() {}; 301 | }; 302 | 303 | class CWorld 304 | { 305 | public: 306 | class CMode* m_curMode; 307 | std::list m_gameObjectList; 308 | std::list m_actorList; 309 | std::list m_itemList; 310 | std::list m_skillList; 311 | C3dGround* m_ground; 312 | CPlayer* m_player; 313 | C3dAttr* m_attr; 314 | std::vector m_bgObjList; 315 | long m_bgObjCount; 316 | long m_bgObjThread; 317 | int m_isPKZone; 318 | int m_isSiegeMode; 319 | int m_isBattleFieldMode; 320 | int m_isEventPVPMode; 321 | struct SceneGraphNode m_rootNode; 322 | struct SceneGraphNode* m_Calculated; 323 | 324 | virtual ~CWorld() {}; 325 | }; 326 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # SimpleROHook 2 | SimpleROHook - Simply Extend Ragnarök Online 3 | 4 | ![License](https://img.shields.io/github/license/X-EcutiOnner/SimpleROHook) 5 | ![Language](https://img.shields.io/badge/language-C-blue) 6 | ![Language](https://img.shields.io/badge/language-C%2B%2B-blue) 7 | ![Language](https://img.shields.io/badge/language-C%23-blue) 8 | ![Contributors](https://img.shields.io/github/contributors/X-EcutiOnner/SimpleROHook.svg) 9 | 10 | Supported kRO Clients 11 | 12 | ![Client](https://img.shields.io/badge/client-Sakray-lightgreen) 13 | ![Client](https://img.shields.io/badge/client-Main-green) 14 | ![Client](https://img.shields.io/badge/client-Main%20Sakray-yellow) 15 | ![Client](https://img.shields.io/badge/client-Zero-orange) 16 | ![Client](https://img.shields.io/badge/client-Zero%20Sakray-red) 17 | 18 | ## Requeriments 19 | - [Visual Studio 2022 (with C++ support)](https://visualstudio.microsoft.com/downloads/) 20 | - [DirectX SDK August 2007](https://archive.org/details/dxsdk_aug2007) 21 | - [.NET Framework 4.8 Developer Pack](https://dotnet.microsoft.com/en-us/download/dotnet-framework/net48) 22 | 23 | **PS. 1** Version of Visual Studio also can pick from 2015 up to 2022 (Recommended 2017) 24 | 25 | **PS. 2** DirectX SDK also works with 2007 and 2010 or later 26 | 27 | ### Development Note 28 | 29 | * This is forked of [SimpleROHook](https://github.com/sekishi1259/SimpleROHook) 30 | * Last development by [@drdxxy](https://github.com/drdaxxy) and original code by [@sekishi1259](https://github.com/sekishi1259) 31 | * Setting up again in 2020-12-05 by [@X-EcutiOnner](https://github.com/X-EcutiOnner) 32 | 33 | - Last tested with 2022-04-06_Ragexe_1648707856 34 | 35 | ------- 36 | 37 | ## Screenshots 38 | - Tiny Console 39 | 40 | ![Tiny Console](Screenshots/Tiny%20Console.png) 41 | 42 | - MENU - Extra 43 | 44 | ![MENU - Extra](Screenshots/MENU%20Extra.png) 45 | 46 | - MENU - Debug Info 47 | 48 | ![MENU - Debug Info](Screenshots/MENU%20Debug%20Info.png) 49 | 50 | - MENU - 3D Map Grid 51 | 52 | ![MENU - 3D Map Grid](Screenshots/MENU%203D%20Map%20Grid.png) 53 | 54 | - Capture Screen 55 | 56 | ![Capture Screen](Screenshots/Capture%20Screen%201.png) 57 | 58 | ![Capture Screen](Screenshots/Capture%20Screen%202.png) 59 | 60 | ------- 61 | 62 | ### Abandoned Note 63 | 64 | **Note:** This fork has been **abandoned** since mid-2018. I currently do not play Ragnarok Online and accessing iRO from where I live is a hassle. **This version will (probably) not work on any current server.** 65 | 66 | **For developers:** *If you have basic Win32 reverse engineering skills*, updating this should not be particularly difficult or time-consuming. If you're thinking about picking up the slack, please don't be discouraged by the lack of activity: the reason you (probably) don't see anybody else doing it isn't that you need to be one of the Chosen Ones to figure this stuff out, just collective lack of interest. 67 | 68 | If you have any questions you can reach me on Discord (@daxxy#3331). I'm still on iROWiki's server although at the time of writing I haven't been active for months and their #addon-support channel mentioned below was closed a long time ago. 69 | 70 | My previous readme follows: 71 | 72 | ------- 73 | 74 | This is **SimpleROHook updated to work with 2018-03-28ragexe from iRO RE:Start**. It *may* also support current (Renewal?) clients from other servers. 75 | 76 | I have only tested the Bowling Bash gutterline and M2E functionality; judging by the logging console, some other stuff is definitely still wrong. 77 | 78 | This fork also updates the project to Visual Studio 2015 (+ runtime). 79 | 80 | Special thanks to [@phaicm](https://github.com/phaicm) for the old default M2E configuration and [@Toxetic](https://github.com/Toxetic) for previously providing trusted binaries and the new default M2E config! 81 | 82 | The best place to **get technical support** and be notified of updates is #addon-support on **[iROWiki's Discord](https://discord.gg/Pe7UrnF)**. 83 | 84 | ### Download/Usage/Installation 85 | 86 | * Install the [Visual C++ 2015 Redistributable](https://www.microsoft.com/en-us/download/details.aspx?id=53587) (32-bit version, `vc_redist.x86.exe`, even with 64-bit Windows) if you don't have it. If SimpleROHook shows you a "LoadLibrary failed" error, it's likely because you didn't do this. 87 | * **Download the latest build** at https://github.com/drdaxxy/SimpleROHook/releases and extract the archive somewhere. 88 | * You need "SimpleROHook.xxxx-xx-xx.zip", not the source code. 89 | * Run SimpleROHookCS.exe 90 | * Only clients started *after* SimpleROHook will be affected. You'll get a logging console for previously started ones, but no actual functionality. 91 | * Right click the SimpleROHook icon in the system tray. 92 | * Uncheck *Window* > *NPC Logger* as it's useless. 93 | * Check *3D Map Grid* > *Show BBE* to show gutterlines. 94 | * The display is a little glitchy on uneven terrain. Adjusting *3D Map Grid* > *Ground Z Bias* can help. 95 | * *3D Map Grid* > *Alpha Level* controls the opacity of the gutterline overlay. 96 | * Feel free to close the console window that pops up when you run a client. 97 | 98 | #### Updating 99 | 100 | * To update, just replace the files in your existing SimpleROHook installation with the files from the new archive. 101 | * **If you want to keep your settings,** do *not* replace `config.ini` or `config.xml`! 102 | 103 | #### Ground skill effect display (M2E) 104 | 105 | * Check *3D Map Grid* > *Show M2E* to mark cells currently affected by ground targeting skills (Storm Gust etc.). 106 | * You can edit `config.ini` to set colors for specific skills. 107 | 108 | #### New: Custom colors for deadcell/chatscope/castrange/gutterlines 109 | 110 | * Since Apr 11, 2018 you can change colors for the other features. 111 | * Edit `config.ini` as with M2E, you'll find a new `[MiscColor]` section at the top. 112 | * If you're updating from a previous version and would like to keep your M2E settings, this is the section you need to add to the top or bottom of the file: 113 | * **Do not** just add it somewhere in the middle, that would break all following M2E skill colors! 114 | 115 | ``` 116 | [MiscColor] 117 | ; Alpha is ignored for these - use the alpha level option in the GUI 118 | Deadcell=0x00FF00FF 119 | Chatscope=0x0000FF00 120 | Castrange=0x007F00FF 121 | Gutterline=0x00FF0000 122 | Demigutter=0x000000FF 123 | ``` 124 | 125 | ### Disclaimers 126 | 127 | I did the minimum work necessary to make Bowling Bash gutterline display work on the client mentioned above, with only a few minutes of testing. If this ends up crashing your client, I'd appreciate a heads up, but don't yell at me if that loses you an MvP or something. 128 | 129 | As of September 24, 2017, iRO's GM team [appears to tolerate gutterline and ground skill target display client edits](https://forums.warpportal.com/index.php?/topic/202141-ro1-in-game-rules-and-guidelines/). Keep in mind they may change their stance at any time and this doesn't necessarily apply to other servers. Whatever you do, use this tool at your own responsibility. 130 | 131 | ### Build instructions (for developers) 132 | 133 | * Install the [August 2007 DirectX SDK](https://www.microsoft.com/en-us/download/details.aspx?id=13287). Other versions **may not work**. 134 | * **Note:** this will overwrite your original `DXSDK_DIR` environment variable. 135 | * If you've had the `June 2010 DirectX SDK` installed before, you'll probably want to set it back. 136 | * Change `Environment Variables` (System variables) path from `DXSDK_DIR` to `DXSDK_AUG07_DIR`. 137 | * Clone this repository. 138 | * Open SimpleROHook.sln in **Visual Studio 2019** and also work in 2017 or 2015 too. 139 | * Install the **MinHook** Nuget packages or compile it libraries. 140 | * Select `Release-iRO/Mixed Platforms` in build configuration. 141 | * Build Solution. 142 | 143 | ### MinHook ReadMe 144 | 145 | This project requires the [MinHook](https://github.com/TsudaKageyu/minhook) libraries by [@TsudaKageyu](https://github.com/TsudaKageyu). 146 | 147 | ``` 148 | Each file name has these tags: 149 | 150 | "x86", "x64": 151 | CPU archtecture 152 | 153 | Choose: 154 | "x86" for Intel 32 bit 155 | "x64" for AMD 64 bit 156 | 157 | "v90", "v100", "v110", "v120", "v140", "v141", "v142", "v143": 158 | Platform toolset (compiler version) 159 | 160 | Choose: 161 | "v90" for "v90_xp" 162 | "v100" for "v100_xp" 163 | "v110" for "v110_xp" 164 | "v120" for "v120_xp" 165 | "v140" for "v140_xp" 166 | "v141" for "v141_xp" 167 | "v142" for "v142_xp" 168 | "v143" for "v143_xp" 169 | 170 | "MT", "MD", "MTd", "MDd": 171 | Runtime Link (Dynamic/Static) and Config (Release/Debug) 172 | Corresponding to "/MT", "/MD", "/MTd" and "/MDd" compiler options respectively. 173 | 174 | Choose: 175 | "/MT" for Multi-threaded 176 | "/MD" for Multi-threaded DLL 177 | "/MTd" for Multi-threaded Debug 178 | "/MDd" for Multi-threaded Debug DLL 179 | ``` 180 | 181 | ### Original README 182 | 183 | ``` 184 | SimpleROHook 185 | 186 | Simply extend Ragnarok Online. 187 | For example, display font on client screen,it can placed easily in 3D map. 188 | 189 | Copyright (C) 2014 redcat Planetleaf.com Lab. All rights reserved. 190 | 191 | http://lab.planetleaf.com/memory-of-rcx 192 | 193 | 194 | SimpleROHook is free software: you can redistribute it and/or modify 195 | it under the terms of the GNU General Public License as published by 196 | the Free Software Foundation, either version 3 of the License, or 197 | (at your option) any later version. 198 | 199 | This program is distributed in the hope that it will be useful, 200 | but WITHOUT ANY WARRANTY; without even the implied warranty of 201 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 202 | GNU General Public License for more details. 203 | 204 | You should have received a copy of the GNU General Public License 205 | along with this program. If not, see . 206 | ``` 207 | -------------------------------------------------------------------------------- /Injection/Core/ro/unit.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | struct texCoor 4 | { 5 | float u; 6 | float v; 7 | void Set(float _u, float _v) { u = _u; v = _v; }; 8 | }; 9 | 10 | struct ColorCellPos 11 | { 12 | int x; 13 | int y; 14 | unsigned long color; 15 | }; 16 | 17 | struct ColorCellPos2 18 | { 19 | int x; 20 | int y; 21 | int type; 22 | unsigned long color; 23 | unsigned long startTime; 24 | }; 25 | 26 | struct CAttachPointInfo 27 | { 28 | int x; 29 | int y; 30 | int m_attr; 31 | }; 32 | 33 | struct ChatRoomInfo 34 | { 35 | std::basic_string title; 36 | std::basic_string pass; 37 | int roomType; 38 | int numPeople; 39 | int maxNumPeople; 40 | int roomId; 41 | 42 | ChatRoomInfo(struct ChatRoomInfo&) {}; 43 | ChatRoomInfo() {}; 44 | struct ChatRoomInfo& operator = (struct ChatRoomInfo&) {}; 45 | ChatRoomInfo::~ChatRoomInfo() {}; 46 | }; 47 | 48 | struct NamePair 49 | { 50 | std::basic_string cName; 51 | std::basic_string pName; 52 | std::basic_string gName; 53 | std::basic_string rName; 54 | 55 | void Clear() {}; 56 | unsigned char IsEmpty() {}; 57 | NamePair::NamePair(struct NamePair& __that) {}; 58 | NamePair::NamePair() {}; 59 | struct NamePair& operator = (struct NamePair&) {}; 60 | NamePair::~NamePair() {}; 61 | }; 62 | 63 | struct vector2d 64 | { 65 | float x; 66 | float y; 67 | 68 | vector2d(float, float) {}; 69 | vector2d() : x(.0f), y(.0f) {}; 70 | void Set(float, float) {}; 71 | void Normalize() {}; 72 | }; 73 | 74 | struct vector3d 75 | { 76 | float x; 77 | float y; 78 | float z; 79 | 80 | vector3d::vector3d(float nx, float ny, float nz) : x(nx), y(ny), z(nz) {}; 81 | vector3d::vector3d() : x(.0f), y(.0f), z(.0f) {}; 82 | void Set(float nx, float ny, float nz) { x = nx; y = ny; z = nz; }; 83 | 84 | void MatrixMult(struct vector3d&, struct matrix&); 85 | 86 | void CrossProduct(struct vector3d& u, struct vector3d& v) 87 | { 88 | x = u.y * v.z - u.z * v.y; 89 | y = u.z * v.x - u.x * v.z; 90 | z = u.x * v.y - u.y * v.x; 91 | }; 92 | 93 | void Normalize() 94 | { 95 | float v = Magnitude(); 96 | x /= v; 97 | y /= v; 98 | z /= v; 99 | }; 100 | 101 | float Magnitude() 102 | { 103 | return pow(x * x + y * y + z * z, 0.5f); 104 | // return sqrl(x * x + y * y + z * z); 105 | }; 106 | 107 | float Angle(struct vector3d&) {}; 108 | 109 | float DotProduct(struct vector3d& v) 110 | { 111 | return (x * v.x + y * v.y + z * v.z); 112 | }; 113 | 114 | void vector3d::MATRIX_TO_VECTOR(struct matrix& dir) {}; 115 | 116 | struct vector3d& vector3d::operator = (struct vector3d& rhs) 117 | { 118 | this->x = rhs.x; 119 | this->y = rhs.y; 120 | this->z = rhs.z; 121 | return *this; 122 | }; 123 | 124 | struct vector3d& operator += (struct vector3d& v) 125 | { 126 | this->x += v.x; 127 | this->y += v.y; 128 | this->z += v.z; 129 | 130 | return *this; 131 | }; 132 | 133 | struct vector3d& operator -= (struct vector3d& v) 134 | { 135 | this->x -= v.x; 136 | this->y -= v.y; 137 | this->z -= v.z; 138 | 139 | return *this; 140 | }; 141 | 142 | struct vector3d& operator *= (float& v) 143 | { 144 | this->x *= v; 145 | this->y *= v; 146 | this->z *= v; 147 | 148 | return *this; 149 | }; 150 | 151 | struct vector3d operator * (float& v) 152 | { 153 | this->x *= v; 154 | this->y *= v; 155 | this->z *= v; 156 | 157 | return *this; 158 | }; 159 | }; 160 | 161 | struct matrix 162 | { 163 | float v11; 164 | float v12; 165 | float v13; 166 | float v21; 167 | float v22; 168 | float v23; 169 | float v31; 170 | float v32; 171 | float v33; 172 | float v41; 173 | float v42; 174 | float v43; 175 | 176 | void SetRow1(float, float, float) {}; 177 | void SetRow2(float, float, float) {}; 178 | void SetRow3(float, float, float) {}; 179 | void SetRow4(float, float, float) {}; 180 | void MakeIdentity() {}; 181 | void matrix::MakeInverse(struct matrix& src) {}; 182 | void MakeTranslate(struct vector3d&) {}; 183 | void matrix::MakeTranslate(float x, float y, float z) {}; 184 | void matrix::MakeXRotation(float angle) {}; 185 | void matrix::MakeYRotation(float angle) {}; 186 | void matrix::MakeZRotation(float angle) {}; 187 | void matrix::MakeScale(float x, float y, float z) {}; 188 | void matrix::AppendTranslate(struct vector3d& v) {}; 189 | void matrix::AppendXRotation(float angle) {}; 190 | void matrix::AppendYRotation(float angle) {}; 191 | void matrix::AppendZRotation(float angle) {}; 192 | void matrix::AppendScale(float x, float y, float z) {}; 193 | void matrix::PrependTranslate(struct vector3d& v) {}; 194 | void PrependScale(float*) {}; 195 | void matrix::PrependScale(float x, float y, float z) {}; 196 | void matrix::MakeTransform(struct rotKeyframe& ani) {}; 197 | void matrix::MakeTransform(float* rotaxis, float rotangle) {}; 198 | void matrix::MakeTransform(struct vector3d& pos, float* rotaxis, float rotangle) {}; 199 | void matrix::MakeView(struct vector3d& from, struct vector3d& at, struct vector3d& world_up) {}; 200 | void matrix::MultMatrix(struct matrix& a, struct matrix& b) {}; 201 | int matrix::IsIdentity() { return 0; }; 202 | void matrix::VECTOR_TO_VIEW(struct vector3d& base, struct vector3d& point, struct vector3d& up, struct vector3d& right) {}; 203 | void matrix::VIEW_MATRIX(struct vector3d& base, struct vector3d& point, int roll) {}; 204 | void matrix::VECTOR_TO_REV_VIEW(struct vector3d& base, struct vector3d& point, struct vector3d& up, struct vector3d& right) {}; 205 | void matrix::REV_VIEW_MATRIX(struct vector3d& base, struct vector3d& point, int roll) {}; 206 | void matrix::VECTOR_TO_MATRIX(struct vector3d& view_dir) {}; 207 | void matrix::NORMALIZE_SCALE(struct matrix& sour) {}; 208 | void matrix::REVERSE_MATRIX(struct matrix& sour) {}; 209 | void matrix::UPVECTOR_TO_MATRIX(struct vector3d up) {}; 210 | }; 211 | 212 | struct plane3d 213 | { 214 | float x; 215 | float y; 216 | float z; 217 | float w; 218 | plane3d(float, float, float, float) {}; 219 | plane3d() {}; 220 | void Set(float, float, float, float) {}; 221 | void MatrixMult(struct matrix&, struct plane3d&) {}; 222 | }; 223 | 224 | struct tlvertex3d 225 | { 226 | float x; 227 | float y; 228 | float z; 229 | float oow; 230 | 231 | union 232 | { 233 | unsigned long color; 234 | struct COLOR argb; 235 | }; 236 | 237 | unsigned long specular; 238 | 239 | union 240 | { 241 | struct 242 | { 243 | float tu; 244 | float tv; 245 | }; 246 | 247 | struct texCoor coord; 248 | }; 249 | 250 | tlvertex3d(float, float, float, float, unsigned long, unsigned long, float, float) {}; 251 | tlvertex3d::tlvertex3d() {}; 252 | }; 253 | 254 | struct ViewInfo3d 255 | { 256 | struct vector3d at; 257 | float latitude; 258 | float longitude; 259 | float distance; 260 | 261 | ViewInfo3d() {}; 262 | struct ViewInfo3d& operator = (struct ViewInfo3d&) {}; 263 | }; 264 | 265 | struct CellPos 266 | { 267 | int x; 268 | int y; 269 | }; 270 | 271 | struct C3dAABB 272 | { 273 | struct vector3d min; 274 | struct vector3d max; 275 | 276 | C3dAABB() {}; 277 | struct C3dAABB& operator = (struct C3dAABB&) {}; 278 | }; 279 | 280 | struct C3dOBB 281 | { 282 | struct vector3d halfSize; 283 | struct vector3d center; 284 | struct vector3d u; 285 | struct vector3d v; 286 | struct vector3d w; 287 | struct vector3d vertices[8]; 288 | 289 | C3dOBB() {}; 290 | struct C3dOBB& operator = (struct C3dOBB&) {}; 291 | }; 292 | 293 | struct CVolumeBox 294 | { 295 | struct vector3d m_size; 296 | struct vector3d m_pos; 297 | struct vector3d m_rot; 298 | struct vector3d m_worldVert[8]; 299 | struct matrix m_vtm; 300 | struct matrix m_ivtm; 301 | int flag; 302 | 303 | CVolumeBox() {}; 304 | struct CVolumeBox& operator = (struct CVolumeBox&) {}; 305 | }; 306 | 307 | struct posKeyframe 308 | { 309 | int frame; 310 | float px; 311 | float py; 312 | float pz; 313 | 314 | posKeyframe(int, float, float, float) {}; 315 | posKeyframe() {}; 316 | void posKeyframe::Slerp(float t, struct posKeyframe& start, struct posKeyframe& end) {}; 317 | }; 318 | 319 | struct scaleKeyframe 320 | { 321 | int frame; 322 | float sx; 323 | float sy; 324 | float sz; 325 | float qx; 326 | float qy; 327 | float qz; 328 | float qw; 329 | 330 | scaleKeyframe(int, float, float, float, float, float, float, float) {}; 331 | scaleKeyframe() {}; 332 | void scaleKeyframe::Slerp(float t, struct scaleKeyframe& start, struct scaleKeyframe& end, int spin) {}; 333 | }; 334 | 335 | struct rotKeyframe 336 | { 337 | int frame; 338 | float qx; 339 | float qy; 340 | float qz; 341 | float qw; 342 | 343 | rotKeyframe(int, float, float, float, float) {}; 344 | rotKeyframe() {}; 345 | void rotKeyframe::Slerp(float t, struct rotKeyframe& start, struct rotKeyframe& end, int spin) {}; 346 | }; 347 | 348 | class C3dPosAnim 349 | { 350 | std::vector m_animdata; 351 | }; 352 | 353 | class C3dScaleAnim 354 | { 355 | std::vector m_animdata; 356 | }; 357 | 358 | class C3dRotAnim 359 | { 360 | std::vector m_animdata; 361 | }; 362 | 363 | struct TeiEffect 364 | { 365 | char life; 366 | short alphaB; 367 | short alphaT; 368 | short full_display_angle; 369 | float max_height; 370 | int process; 371 | short RotStart; 372 | float height[21]; 373 | char flag1[21]; 374 | short rise_angle; 375 | float distance; 376 | struct vector3d vecB_now; 377 | struct vector3d vecT_now; 378 | struct vector3d vecB_pre; 379 | struct vector3d vecT_pre; 380 | 381 | TeiEffect() {}; 382 | struct TeiEffect& operator = (struct TeiEffect&) {}; 383 | }; 384 | 385 | struct PrimSegment 386 | { 387 | struct vector3d pos; 388 | struct vector3d segPos[4]; 389 | float radius; 390 | float size; 391 | float longitude; 392 | struct matrix mat; 393 | int red; 394 | int green; 395 | int blue; 396 | float alpha; 397 | unsigned long argb; 398 | 399 | PrimSegment() {}; 400 | struct PrimSegment& operator = (struct PrimSegment&) {}; 401 | }; 402 | 403 | struct PathCell 404 | { 405 | int x; 406 | int y; 407 | int dir; 408 | unsigned long time; 409 | }; 410 | 411 | class CPathInfo 412 | { 413 | public: 414 | std::vector m_pathData; 415 | int m_startCell; 416 | float m_startPointX; 417 | float m_startPointY; 418 | 419 | CPathInfo() {}; 420 | }; 421 | 422 | struct _MSG2AI 423 | { 424 | int command; 425 | int x; 426 | int y; 427 | int skillLevel; 428 | int skillID; 429 | unsigned long targetID; 430 | 431 | _MSG2AI::_MSG2AI() { Init(); }; 432 | void Init() {}; 433 | }; 434 | -------------------------------------------------------------------------------- /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 cast_range; 28 | public int ground_zbias; 29 | public int alphalevel; 30 | public int m2e; 31 | public int bbe; 32 | public int deadcell; 33 | public int chatscope; 34 | public int castrange; 35 | public int fix_windowmode_vsyncwait; 36 | public int show_framerate; 37 | public int objectinformation; 38 | public int _44khz_audiomode; 39 | public int cpucoolerlevel; 40 | public int chainload; 41 | public fixed char configfilepath[MAX_PATH]; 42 | public fixed char musicfilename[MAX_PATH]; 43 | } 44 | 45 | private MemoryMappedFile m_Mmf = null; 46 | private MemoryMappedViewAccessor m_Accessor = null; 47 | private StSHAREDMEMORY* m_pSharedMemory; 48 | 49 | public SRHSharedData() 50 | { 51 | m_Mmf = MemoryMappedFile.CreateNew(@"SimpleROHook1011", 52 | Marshal.SizeOf(typeof(StSHAREDMEMORY)), 53 | MemoryMappedFileAccess.ReadWrite); 54 | 55 | if (m_Mmf == null) 56 | MessageBox.Show("CreateOrOpen MemoryMappedFile Failed."); 57 | 58 | m_Accessor = m_Mmf.CreateViewAccessor(); 59 | 60 | byte* p = null; 61 | m_Accessor.SafeMemoryMappedViewHandle.AcquirePointer(ref p); 62 | m_pSharedMemory = (StSHAREDMEMORY*)p; 63 | 64 | write_packetlog = false; 65 | freemouse = true; 66 | cast_range = 0x09; 67 | ground_zbias = 0; 68 | alphalevel = 0x7f; 69 | m2e = true; 70 | bbe = false; 71 | deadcell = false; 72 | chatscope = false; 73 | castrange = true; 74 | fix_windowmode_vsyncwait = false; 75 | show_framerate = true; 76 | objectinformation = false; 77 | _44khz_audiomode = false; 78 | cpucoolerlevel = 0; 79 | chainload = true; 80 | configfilepath = ""; 81 | musicfilename = ""; 82 | executeorder = false; 83 | g_hROWindow = 0; 84 | } 85 | 86 | public void Dispose() 87 | { 88 | m_Accessor.Dispose(); 89 | m_Mmf.Dispose(); 90 | } 91 | 92 | public bool write_packetlog 93 | { 94 | get 95 | { 96 | return (m_pSharedMemory->write_packetlog == 0) ? false : true; 97 | } 98 | 99 | set 100 | { 101 | m_pSharedMemory->write_packetlog = (value == false) ? 0 : 1; 102 | } 103 | } 104 | 105 | public bool freemouse 106 | { 107 | get 108 | { 109 | return (m_pSharedMemory->freemouse == 0)? false : true; 110 | } 111 | 112 | set 113 | { 114 | m_pSharedMemory->freemouse = (value == false)? 0 : 1; 115 | } 116 | } 117 | 118 | public int cast_range 119 | { 120 | get 121 | { 122 | return m_pSharedMemory->cast_range; 123 | } 124 | 125 | set 126 | { 127 | m_pSharedMemory->cast_range = value; 128 | } 129 | } 130 | 131 | public int ground_zbias 132 | { 133 | get 134 | { 135 | return m_pSharedMemory->ground_zbias; 136 | } 137 | 138 | set 139 | { 140 | m_pSharedMemory->ground_zbias = value; 141 | } 142 | } 143 | 144 | public int alphalevel 145 | { 146 | get 147 | { 148 | return m_pSharedMemory->alphalevel; 149 | } 150 | 151 | set 152 | { 153 | m_pSharedMemory->alphalevel = value; 154 | } 155 | } 156 | 157 | public bool m2e 158 | { 159 | get 160 | { 161 | return (m_pSharedMemory->m2e == 0) ? false : true; 162 | } 163 | 164 | set 165 | { 166 | m_pSharedMemory->m2e = (value == false) ? 0 : 1; 167 | } 168 | } 169 | 170 | public bool bbe 171 | { 172 | get 173 | { 174 | return (m_pSharedMemory->bbe == 0) ? false : true; 175 | } 176 | 177 | set 178 | { 179 | m_pSharedMemory->bbe = (value == false) ? 0 : 1; 180 | } 181 | } 182 | 183 | public bool deadcell 184 | { 185 | get 186 | { 187 | return (m_pSharedMemory->deadcell == 0) ? false : true; 188 | } 189 | 190 | set 191 | { 192 | m_pSharedMemory->deadcell = (value == false) ? 0 : 1; 193 | } 194 | } 195 | 196 | public bool chatscope 197 | { 198 | get 199 | { 200 | return (m_pSharedMemory->chatscope == 0) ? false : true; 201 | } 202 | 203 | set 204 | { 205 | m_pSharedMemory->chatscope = (value == false) ? 0 : 1; 206 | } 207 | } 208 | 209 | public bool castrange 210 | { 211 | get 212 | { 213 | return (m_pSharedMemory->castrange == 0) ? false : true; 214 | } 215 | 216 | set 217 | { 218 | m_pSharedMemory->castrange = (value == false) ? 0 : 1; 219 | } 220 | } 221 | 222 | public bool fix_windowmode_vsyncwait 223 | { 224 | get 225 | { 226 | return (m_pSharedMemory->fix_windowmode_vsyncwait == 0) ? false : true; 227 | } 228 | 229 | set 230 | { 231 | m_pSharedMemory->fix_windowmode_vsyncwait = (value == false) ? 0 : 1; 232 | } 233 | } 234 | 235 | public bool show_framerate 236 | { 237 | get 238 | { 239 | return (m_pSharedMemory->show_framerate == 0) ? false : true; 240 | } 241 | 242 | set 243 | { 244 | m_pSharedMemory->show_framerate = (value == false) ? 0 : 1; 245 | } 246 | } 247 | 248 | public bool objectinformation 249 | { 250 | get 251 | { 252 | return (m_pSharedMemory->objectinformation == 0) ? false : true; 253 | } 254 | 255 | set 256 | { 257 | m_pSharedMemory->objectinformation = (value == false) ? 0 : 1; 258 | } 259 | } 260 | 261 | public bool _44khz_audiomode 262 | { 263 | get 264 | { 265 | return (m_pSharedMemory->_44khz_audiomode == 0) ? false : true; 266 | } 267 | 268 | set 269 | { 270 | m_pSharedMemory->_44khz_audiomode = (value == false) ? 0 : 1; 271 | } 272 | } 273 | 274 | public int cpucoolerlevel 275 | { 276 | get 277 | { 278 | return m_pSharedMemory->cpucoolerlevel; 279 | } 280 | 281 | set 282 | { 283 | m_pSharedMemory->cpucoolerlevel = value; 284 | } 285 | } 286 | 287 | public bool chainload 288 | { 289 | get 290 | { 291 | return (m_pSharedMemory->chainload == 0) ? false : true; 292 | } 293 | 294 | set 295 | { 296 | m_pSharedMemory->chainload = (value == false) ? 0 : 1; 297 | } 298 | } 299 | 300 | public bool executeorder 301 | { 302 | get 303 | { 304 | return (m_pSharedMemory->executeorder == 0)? false : true; 305 | } 306 | 307 | set 308 | { 309 | m_pSharedMemory->executeorder = (value == false)? 0 : 1; 310 | } 311 | } 312 | 313 | public int g_hROWindow 314 | { 315 | get 316 | { 317 | return m_pSharedMemory->g_hROWindow; 318 | } 319 | 320 | set 321 | { 322 | m_pSharedMemory->g_hROWindow = value; 323 | } 324 | } 325 | 326 | public string configfilepath 327 | { 328 | get 329 | { 330 | string result = new string(m_pSharedMemory->configfilepath); 331 | return result; 332 | } 333 | 334 | set 335 | { 336 | char[] cstr = value.ToCharArray(); 337 | Marshal.Copy(cstr, 0, (IntPtr)m_pSharedMemory->configfilepath, cstr.Length); 338 | m_pSharedMemory->configfilepath[cstr.Length] = '\0'; 339 | } 340 | } 341 | 342 | public string musicfilename 343 | { 344 | get 345 | { 346 | string result = new string(m_pSharedMemory->musicfilename); 347 | return result; 348 | } 349 | 350 | set 351 | { 352 | char[] cstr = value.ToCharArray(); 353 | Marshal.Copy(cstr, 0, (IntPtr)m_pSharedMemory->musicfilename, cstr.Length); 354 | m_pSharedMemory->musicfilename[cstr.Length] = '\0'; 355 | } 356 | } 357 | } 358 | } 359 | -------------------------------------------------------------------------------- /SimpleROHookCS/SRHAboutBox.Designer.cs: -------------------------------------------------------------------------------- 1 | namespace SimpleROHookCS 2 | { 3 | partial class SRHAboutBox 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 | 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 Form Designer generated code 23 | /// 24 | /// Required method for Designer support - do not modify 25 | /// the contents of this method with the code editor. 26 | /// 27 | private void InitializeComponent() 28 | { 29 | System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(SRHAboutBox)); 30 | this.tableLayoutPanel = new System.Windows.Forms.TableLayoutPanel(); 31 | this.logoPictureBox = new System.Windows.Forms.PictureBox(); 32 | this.labelProductName = new System.Windows.Forms.Label(); 33 | this.labelVersion = new System.Windows.Forms.Label(); 34 | this.labelCopyright = new System.Windows.Forms.Label(); 35 | this.labelCompanyName = new System.Windows.Forms.Label(); 36 | this.textBoxDescription = new System.Windows.Forms.TextBox(); 37 | this.okButton = new System.Windows.Forms.Button(); 38 | this.tableLayoutPanel.SuspendLayout(); 39 | ((System.ComponentModel.ISupportInitialize)(this.logoPictureBox)).BeginInit(); 40 | this.SuspendLayout(); 41 | // 42 | // tableLayoutPanel 43 | // 44 | this.tableLayoutPanel.ColumnCount = 2; 45 | this.tableLayoutPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 33F)); 46 | this.tableLayoutPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 67F)); 47 | this.tableLayoutPanel.Controls.Add(this.logoPictureBox, 0, 0); 48 | this.tableLayoutPanel.Controls.Add(this.labelProductName, 1, 0); 49 | this.tableLayoutPanel.Controls.Add(this.labelVersion, 1, 1); 50 | this.tableLayoutPanel.Controls.Add(this.labelCopyright, 1, 2); 51 | this.tableLayoutPanel.Controls.Add(this.labelCompanyName, 1, 3); 52 | this.tableLayoutPanel.Controls.Add(this.textBoxDescription, 1, 4); 53 | this.tableLayoutPanel.Controls.Add(this.okButton, 1, 5); 54 | this.tableLayoutPanel.Dock = System.Windows.Forms.DockStyle.Fill; 55 | this.tableLayoutPanel.Location = new System.Drawing.Point(9, 8); 56 | this.tableLayoutPanel.Name = "tableLayoutPanel"; 57 | this.tableLayoutPanel.RowCount = 6; 58 | this.tableLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 10F)); 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, 50F)); 63 | this.tableLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 10F)); 64 | this.tableLayoutPanel.Size = new System.Drawing.Size(417, 245); 65 | this.tableLayoutPanel.TabIndex = 0; 66 | // 67 | // logoPictureBox 68 | // 69 | this.logoPictureBox.Dock = System.Windows.Forms.DockStyle.Fill; 70 | this.logoPictureBox.Image = ((System.Drawing.Image)(resources.GetObject("logoPictureBox.Image"))); 71 | this.logoPictureBox.Location = new System.Drawing.Point(3, 3); 72 | this.logoPictureBox.Name = "logoPictureBox"; 73 | this.tableLayoutPanel.SetRowSpan(this.logoPictureBox, 6); 74 | this.logoPictureBox.Size = new System.Drawing.Size(131, 239); 75 | this.logoPictureBox.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage; 76 | this.logoPictureBox.TabIndex = 12; 77 | this.logoPictureBox.TabStop = false; 78 | // 79 | // labelProductName 80 | // 81 | this.labelProductName.Dock = System.Windows.Forms.DockStyle.Fill; 82 | this.labelProductName.Location = new System.Drawing.Point(143, 0); 83 | this.labelProductName.Margin = new System.Windows.Forms.Padding(6, 0, 3, 0); 84 | this.labelProductName.MaximumSize = new System.Drawing.Size(0, 16); 85 | this.labelProductName.Name = "labelProductName"; 86 | this.labelProductName.Size = new System.Drawing.Size(271, 16); 87 | this.labelProductName.TabIndex = 19; 88 | this.labelProductName.Text = "Product Name"; 89 | this.labelProductName.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; 90 | // 91 | // labelVersion 92 | // 93 | this.labelVersion.Dock = System.Windows.Forms.DockStyle.Fill; 94 | this.labelVersion.Location = new System.Drawing.Point(143, 24); 95 | this.labelVersion.Margin = new System.Windows.Forms.Padding(6, 0, 3, 0); 96 | this.labelVersion.MaximumSize = new System.Drawing.Size(0, 16); 97 | this.labelVersion.Name = "labelVersion"; 98 | this.labelVersion.Size = new System.Drawing.Size(271, 16); 99 | this.labelVersion.TabIndex = 0; 100 | this.labelVersion.Text = "Version"; 101 | this.labelVersion.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; 102 | // 103 | // labelCopyright 104 | // 105 | this.labelCopyright.Dock = System.Windows.Forms.DockStyle.Fill; 106 | this.labelCopyright.Location = new System.Drawing.Point(143, 48); 107 | this.labelCopyright.Margin = new System.Windows.Forms.Padding(6, 0, 3, 0); 108 | this.labelCopyright.MaximumSize = new System.Drawing.Size(0, 16); 109 | this.labelCopyright.Name = "labelCopyright"; 110 | this.labelCopyright.Size = new System.Drawing.Size(271, 16); 111 | this.labelCopyright.TabIndex = 21; 112 | this.labelCopyright.Text = "Copyright"; 113 | this.labelCopyright.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; 114 | // 115 | // labelCompanyName 116 | // 117 | this.labelCompanyName.Dock = System.Windows.Forms.DockStyle.Fill; 118 | this.labelCompanyName.Location = new System.Drawing.Point(143, 72); 119 | this.labelCompanyName.Margin = new System.Windows.Forms.Padding(6, 0, 3, 0); 120 | this.labelCompanyName.MaximumSize = new System.Drawing.Size(0, 16); 121 | this.labelCompanyName.Name = "labelCompanyName"; 122 | this.labelCompanyName.Size = new System.Drawing.Size(271, 16); 123 | this.labelCompanyName.TabIndex = 22; 124 | this.labelCompanyName.Text = "Company Name"; 125 | this.labelCompanyName.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; 126 | // 127 | // textBoxDescription 128 | // 129 | this.textBoxDescription.Dock = System.Windows.Forms.DockStyle.Fill; 130 | this.textBoxDescription.Location = new System.Drawing.Point(143, 99); 131 | this.textBoxDescription.Margin = new System.Windows.Forms.Padding(6, 3, 3, 3); 132 | this.textBoxDescription.Multiline = true; 133 | this.textBoxDescription.Name = "textBoxDescription"; 134 | this.textBoxDescription.ReadOnly = true; 135 | this.textBoxDescription.ScrollBars = System.Windows.Forms.ScrollBars.Both; 136 | this.textBoxDescription.Size = new System.Drawing.Size(271, 116); 137 | this.textBoxDescription.TabIndex = 23; 138 | this.textBoxDescription.TabStop = false; 139 | this.textBoxDescription.Text = "Description"; 140 | // 141 | // okButton 142 | // 143 | this.okButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); 144 | this.okButton.DialogResult = System.Windows.Forms.DialogResult.Cancel; 145 | this.okButton.Location = new System.Drawing.Point(339, 221); 146 | this.okButton.Name = "okButton"; 147 | this.okButton.Size = new System.Drawing.Size(75, 21); 148 | this.okButton.TabIndex = 24; 149 | this.okButton.Text = "&OK"; 150 | // 151 | // SRHAboutBox 152 | // 153 | this.AcceptButton = this.okButton; 154 | this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F); 155 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; 156 | this.ClientSize = new System.Drawing.Size(435, 261); 157 | this.Controls.Add(this.tableLayoutPanel); 158 | this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog; 159 | this.MaximizeBox = false; 160 | this.MinimizeBox = false; 161 | this.Name = "SRHAboutBox"; 162 | this.Padding = new System.Windows.Forms.Padding(9, 8, 9, 8); 163 | this.ShowIcon = false; 164 | this.ShowInTaskbar = false; 165 | this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; 166 | this.Text = "SRHAboutBox"; 167 | this.tableLayoutPanel.ResumeLayout(false); 168 | this.tableLayoutPanel.PerformLayout(); 169 | ((System.ComponentModel.ISupportInitialize)(this.logoPictureBox)).EndInit(); 170 | this.ResumeLayout(false); 171 | 172 | } 173 | #endregion 174 | 175 | private System.Windows.Forms.TableLayoutPanel tableLayoutPanel; 176 | private System.Windows.Forms.PictureBox logoPictureBox; 177 | private System.Windows.Forms.Label labelProductName; 178 | private System.Windows.Forms.Label labelVersion; 179 | private System.Windows.Forms.Label labelCopyright; 180 | private System.Windows.Forms.Label labelCompanyName; 181 | private System.Windows.Forms.TextBox textBoxDescription; 182 | private System.Windows.Forms.Button okButton; 183 | } 184 | } 185 | --------------------------------------------------------------------------------