Switch build system to CMake
This commit is contained in:
		
							parent
							
								
									aa1c8171b2
								
							
						
					
					
						commit
						7784f97820
					
				
					 24 changed files with 655 additions and 1084 deletions
				
			
		
							
								
								
									
										4
									
								
								ScrapHacks/.gitignore → .gitignore
									
										
									
									
										vendored
									
									
								
							
							
						
						
									
										4
									
								
								ScrapHacks/.gitignore → .gitignore
									
										
									
									
										vendored
									
									
								
							|  | @ -260,4 +260,6 @@ paket-files/ | ||||||
| __pycache__/ | __pycache__/ | ||||||
| *.pyc | *.pyc | ||||||
| 
 | 
 | ||||||
| ScrapHack/dx8/ | .history | ||||||
|  | 
 | ||||||
|  | ScrapHacks/build/* | ||||||
							
								
								
									
										37
									
								
								NOTES.md
									
										
									
									
									
								
							
							
						
						
									
										37
									
								
								NOTES.md
									
										
									
									
									
								
							|  | @ -46,8 +46,10 @@ | ||||||
| - m3d.ini loader @ 0x5f7000 | - m3d.ini loader @ 0x5f7000 | ||||||
| - SM3 Scene Loader @ 0x650f80 (?) | - SM3 Scene Loader @ 0x650f80 (?) | ||||||
| - M3D Model Loader @ 0x6665a0 (??) | - M3D Model Loader @ 0x6665a0 (??) | ||||||
| - World_Init @ 0x479b20 (???) | - World_Constructor @ 0x479b20 (???) | ||||||
|  | - World_Init @ 0x479b40 | ||||||
| - World_DeInit @ 0x402510 | - World_DeInit @ 0x402510 | ||||||
|  | - Make_World @ 0x479870 | ||||||
| 
 | 
 | ||||||
| # Data Structures | # Data Structures | ||||||
| 
 | 
 | ||||||
|  | @ -56,7 +58,7 @@ | ||||||
| Points to World struct | Points to World struct | ||||||
| 
 | 
 | ||||||
| | Offset | Type                     | Description                            | | | Offset | Type                     | Description                            | | ||||||
| |--------|------------|----------------------------------| | | ------ | ------------------------ | -------------------------------------- | | ||||||
| | 0x0000 | `void**`                 | Virtual Method Table                   | | | 0x0000 | `void**`                 | Virtual Method Table                   | | ||||||
| | 0x0004 | `uint32_t`               | Size of Entity Hashtable               | | | 0x0004 | `uint32_t`               | Size of Entity Hashtable               | | ||||||
| | 0x0008 | `void**`                 | Pointer to Entity Hashtable            | | | 0x0008 | `void**`                 | Pointer to Entity Hashtable            | | ||||||
|  | @ -65,21 +67,21 @@ Points to World struct | ||||||
| | 0x0330 | `float[3]`               | Time (why 3 times?)                    | | | 0x0330 | `float[3]`               | Time (why 3 times?)                    | | ||||||
| | 0x1C6C | `float`                  | Alarm level                            | | | 0x1C6C | `float`                  | Alarm level                            | | ||||||
| | 0x1C68 | `float`                  | Alarm Grow Level                       | | | 0x1C68 | `float`                  | Alarm Grow Level                       | | ||||||
| | 0x2158 | `???`      | Used in `World_Init`             | | | 0x2158 | `float`                  | Used in `World_Init`                   | | ||||||
| | 0x2170 | `???`                    | Used in `World_Init`                   | | | 0x2170 | `???`                    | Used in `World_Init`                   | | ||||||
| | 0x2180 | `???`      | Used in `World_Init`             | | | 0x2180 | `float`                  | Used in `World_Init`                   | | ||||||
| | 0x2188 | `???`      | Used in `World_Init`             | | | 0x2188 | `void*`                  | Used in `World_Init`                   | | ||||||
| | 0x218C | `???`      | Used in `World_Init`             | | | 0x218C | `void*`                  | Used in `World_Init`                   | | ||||||
| | 0x2190 | `???`      | Used in `World_Init`             | | | 0x2190 | `float`                  | Used in `World_Init`                   | | ||||||
| | 0x2198 | `???`      | Used in `World_Init`             | | | 0x2198 | `void*`                  | Used in `World_Init`                   | | ||||||
| | 0x219C | `???`      | Used in `World_Init`             | | | 0x219C | `void*`                  | Used in `World_Init`                   | | ||||||
| | 0x21A0 | `???`      | Used in `World_Init`             | | | 0x21A0 | `void**`                 | Used in `World_Init` (VTable pointer?) | | ||||||
| | 0x21B4 | `???`      | Used in `World_Init`             | | | 0x21B4 | `void**`                 | Used in `World_Init` (VTable pointer?) | | ||||||
| | 0x21C8 | `???`                    | Used in `World_Init`                   | | | 0x21C8 | `???`                    | Used in `World_Init`                   | | ||||||
| | 0x2204 | `???`      | Used in `World_Init`             | | | 0x2204 | `uint32_t` or `uint16_t` | Used in `World_Init`                   | | ||||||
| | 0x2230 | `???`      | Used in `World_Init`             | | | 0x2230 | `float`                  | Used in `World_Init`                   | | ||||||
| | 0x2238 | `???`                    | Used in `World_Init`                   | | | 0x2238 | `???`                    | Used in `World_Init`                   | | ||||||
| | 0x2254 | `???`      | Used in `World_Init`             | | | 0x2254 | `float`                  | Used in `World_Init`                   | | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| ## Entity Hash Table | ## Entity Hash Table | ||||||
|  | @ -89,7 +91,7 @@ Hash-function used: [PJW](https://en.wikipedia.org/wiki/PJW_hash_function) (Same | ||||||
| Entry format: | Entry format: | ||||||
| 
 | 
 | ||||||
| | Offset | Type          | Description                    | | | Offset | Type          | Description                    | | ||||||
| |--------|---------------|--------------------------------| | | ------ | ------------- | ------------------------------ | | ||||||
| | 0x0    | `void*`       | Pointer to data                | | | 0x0    | `void*`       | Pointer to data                | | ||||||
| | 0x4    | `const char*` | key as `char*`                 | | | 0x4    | `const char*` | key as `char*`                 | | ||||||
| | 0x8    | `void*`       | Pointer to next entry in chain | | | 0x8    | `void*`       | Pointer to next entry in chain | | ||||||
|  | @ -97,7 +99,7 @@ Entry format: | ||||||
| Data format: | Data format: | ||||||
| 
 | 
 | ||||||
| | Offset | Type          | Description              | | | Offset | Type          | Description              | | ||||||
| |--------|---------------|--------------------------| | | ------ | ------------- | ------------------------ | | ||||||
| | 0x0    | `void**`      | Virtual Method Table (?) | | | 0x0    | `void**`      | Virtual Method Table (?) | | ||||||
| | 0x4    | `const char*` | name as string           | | | 0x4    | `const char*` | name as string           | | ||||||
| | 0x14   | `void*`       | pointer to self (why?)   | | | 0x14   | `void*`       | pointer to self (why?)   | | ||||||
|  | @ -106,12 +108,13 @@ Data format: | ||||||
| ## Game Window Object (?) Pointer @ `0x7fa380` | ## Game Window Object (?) Pointer @ `0x7fa380` | ||||||
| 
 | 
 | ||||||
| | Offset | Type          | Description          | | | Offset | Type          | Description          | | ||||||
| |--------|---------------|----------------------| | | ------ | ------------- | -------------------- | | ||||||
| | 0x0000 | `void**`      | Virtual Method Table | | | 0x0000 | `void**`      | Virtual Method Table | | ||||||
| | 0x0004 | `const char*` | Some Model Name (?)  | | | 0x0004 | `const char*` | Some Model Name (?)  | | ||||||
| | 0x0008 | `void*`       | Pointer to something | | | 0x0008 | `void*`       | Pointer to something | | ||||||
| | 0x000C | `void*`       | Ditto                | | | 0x000C | `void*`       | Ditto                | | ||||||
| 
 | 
 | ||||||
|  | 
 | ||||||
| # File Formats | # File Formats | ||||||
| 
 | 
 | ||||||
| ## .packed File Format: | ## .packed File Format: | ||||||
|  |  | ||||||
							
								
								
									
										11
									
								
								ScrapHacks/.vscode/settings.json
									
										
									
									
										vendored
									
									
								
							
							
						
						
									
										11
									
								
								ScrapHacks/.vscode/settings.json
									
										
									
									
										vendored
									
									
								
							|  | @ -1,11 +0,0 @@ | ||||||
| { |  | ||||||
|     "spellright.language": [ |  | ||||||
|         "de", |  | ||||||
|         "en" |  | ||||||
|     ], |  | ||||||
|     "spellright.documentTypes": [ |  | ||||||
|         "markdown", |  | ||||||
|         "latex", |  | ||||||
|         "plaintext" |  | ||||||
|     ] |  | ||||||
| } |  | ||||||
							
								
								
									
										19
									
								
								ScrapHacks/CMakeLists.txt
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										19
									
								
								ScrapHacks/CMakeLists.txt
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,19 @@ | ||||||
|  | cmake_minimum_required (VERSION 2.6) | ||||||
|  | project(ScrapHacks) | ||||||
|  | SET(CMAKE_BUILD_TYPE "Release") | ||||||
|  | SET(CMAKE_INSTALL_PREFIX "${CMAKE_BINARY_DIR}") | ||||||
|  | if(WIN32) | ||||||
|  |   if(MSVC) | ||||||
|  |     # ensure we use minimal "windows.h" lib without the crazy min max macros     | ||||||
|  |     SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /D \"WIN32_LEAN_AND_MEAN\"") | ||||||
|  |     SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /D \"NOMINMAX\"") | ||||||
|  |     # disable SAFESEH - to avoid "LNK2026: module unsafe" | ||||||
|  |     SET(CMAKE_CXX_FLAGS           "${CMAKE_CXX_FLAGS} /D \"SAFESEH:NO\"") | ||||||
|  |     SET(CMAKE_EXE_LINKER_FLAGS    "${CMAKE_EXE_LINKER_FLAGS} /SAFESEH:NO") | ||||||
|  |     SET(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} /SAFESEH:NO") | ||||||
|  |     SET(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} /SAFESEH:NO") | ||||||
|  |   endif(MSVC) | ||||||
|  | endif(WIN32) | ||||||
|  | 
 | ||||||
|  | add_subdirectory(Injector) | ||||||
|  | add_subdirectory(ScrapHack) | ||||||
							
								
								
									
										2
									
								
								ScrapHacks/Injector/CMakeLists.txt
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										2
									
								
								ScrapHacks/Injector/CMakeLists.txt
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,2 @@ | ||||||
|  | add_executable(Injector Injector.cpp) | ||||||
|  | install(TARGETS Injector DESTINATION bin) | ||||||
|  | @ -27,6 +27,11 @@ string GetLastErrorAsString() | ||||||
| 	return message; | 	return message; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | void fail(char* msg) { | ||||||
|  | 	cerr << "[!] "<<msg<<": "<<GetLastErrorAsString()<<endl; | ||||||
|  | 	exit(1); | ||||||
|  | } | ||||||
|  | 
 | ||||||
| string fromhex(string input) | string fromhex(string input) | ||||||
| { | { | ||||||
| 	transform(input.begin(), input.end(), input.begin(), ::toupper); | 	transform(input.begin(), input.end(), input.begin(), ::toupper); | ||||||
|  | @ -113,7 +118,6 @@ bool HasModule(int PID, const char *modname) | ||||||
| 
 | 
 | ||||||
| bool ProcRunning(DWORD PID) | bool ProcRunning(DWORD PID) | ||||||
| { | { | ||||||
| 	bool ret = false; |  | ||||||
| 	HANDLE hSnap = CreateToolhelp32Snapshot(TH32CS_SNAPMODULE | TH32CS_SNAPMODULE32, PID); | 	HANDLE hSnap = CreateToolhelp32Snapshot(TH32CS_SNAPMODULE | TH32CS_SNAPMODULE32, PID); | ||||||
| 	if (hSnap == INVALID_HANDLE_VALUE) | 	if (hSnap == INVALID_HANDLE_VALUE) | ||||||
| 	{ | 	{ | ||||||
|  | @ -130,14 +134,12 @@ bool adjustPrivs(HANDLE hProc) | ||||||
| 	TOKEN_PRIVILEGES tkprivs; | 	TOKEN_PRIVILEGES tkprivs; | ||||||
| 	if (!OpenProcessToken(hProc, (TOKEN_ADJUST_PRIVILEGES | TOKEN_QUERY), &hToken)) | 	if (!OpenProcessToken(hProc, (TOKEN_ADJUST_PRIVILEGES | TOKEN_QUERY), &hToken)) | ||||||
| 	{ | 	{ | ||||||
| 		cout << "[!] Could not Open Process Token: " << GetLastErrorAsString() << endl; | 		fail("Could not open process token:"); | ||||||
| 		return 0; |  | ||||||
| 	} | 	} | ||||||
| 	if (!LookupPrivilegeValue(0, SE_DEBUG_NAME, &luid)) | 	if (!LookupPrivilegeValue(0, SE_DEBUG_NAME, &luid)) | ||||||
| 	{ | 	{ | ||||||
| 		CloseHandle(hToken); | 		CloseHandle(hToken); | ||||||
| 		cout << "[!] Error Looking up Privilege Value: " << GetLastErrorAsString() << endl; | 		fail("Error looking up privilege value for SE_DEBUG_NAME"); | ||||||
| 		return 0; |  | ||||||
| 	} | 	} | ||||||
| 	tkprivs.PrivilegeCount = 1; | 	tkprivs.PrivilegeCount = 1; | ||||||
| 	tkprivs.Privileges[0].Luid = luid; | 	tkprivs.Privileges[0].Luid = luid; | ||||||
|  | @ -146,7 +148,7 @@ bool adjustPrivs(HANDLE hProc) | ||||||
| 	CloseHandle(hToken); | 	CloseHandle(hToken); | ||||||
| 	if (!bRet) | 	if (!bRet) | ||||||
| 	{ | 	{ | ||||||
| 		cout << "[!] Could Not Adjust Privileges: " << GetLastErrorAsString() << endl; | 		fail("Could not adjust privileges"); | ||||||
| 	} | 	} | ||||||
| 	return bRet; | 	return bRet; | ||||||
| } | } | ||||||
|  | @ -161,31 +163,32 @@ void InjectDll(DWORD PID) | ||||||
| 	HANDLE hRemThread, hProc; | 	HANDLE hRemThread, hProc; | ||||||
| 	const char *dll_name = DLL_NAME; | 	const char *dll_name = DLL_NAME; | ||||||
| 	char dll_full_path[MAX_PATH]; | 	char dll_full_path[MAX_PATH]; | ||||||
|  | 	char executable_dir[MAX_PATH]; | ||||||
|  | 	GetModuleFileNameA(NULL,executable_dir,MAX_PATH); | ||||||
| 	if (!fexists(dll_name)) | 	if (!fexists(dll_name)) | ||||||
| 	{ | 	{ | ||||||
| 		cout << "[!] DLL not found!" << endl; | 		fail("DLL not found"); | ||||||
| 		return; | 		return; | ||||||
| 	} | 	} | ||||||
| 	cout << "[*] Injecting DLL " << dll_name << " into PID " << PID << endl; | 	cout << "[*] Injecting DLL " << dll_name << " into PID " << PID << endl; | ||||||
| 	cout << "[*] Opening Process Handle" << endl; | 	cout << "[*] Opening process handle" << endl; | ||||||
| 	hProc = OpenProcess(PROCESS_ALL_ACCESS, 0, PID); | 	hProc = OpenProcess(PROCESS_ALL_ACCESS, 0, PID); | ||||||
| 	GetFullPathNameA(dll_name, MAX_PATH, dll_full_path, 0); | 	GetFullPathNameA(dll_name, MAX_PATH, dll_full_path, 0); | ||||||
| 	cout << "[*] Adjusting Privileges of Process" << endl; | 	cout << "[*] Adjusting privileges of process" << endl; | ||||||
| 	adjustPrivs(hProc); | 	adjustPrivs(hProc); | ||||||
| 	if (HasModule(PID, dll_name)) | 	if (HasModule(PID, dll_name)) | ||||||
| 	{ | 	{ | ||||||
| 		cout << "[*] DLL already Loaded" << endl; | 		cout << "[*] DLL already loaded" << endl; | ||||||
| 		CloseHandle(hProc); | 		CloseHandle(hProc); | ||||||
| 		return; | 		return; | ||||||
| 	}; | 	}; | ||||||
| 	if (!fexists(dll_full_path)) | 	if (!fexists(dll_full_path)) | ||||||
| 	{ | 	{ | ||||||
| 		cout << "[!] DLL file not found!" << endl; |  | ||||||
| 		CloseHandle(hProc); | 		CloseHandle(hProc); | ||||||
| 		return; | 		fail("DLL file not found"); | ||||||
| 	} | 	} | ||||||
| 	HINSTANCE hK32 = LoadLibraryA("kernel32"); | 	HINSTANCE hK32 = LoadLibraryA("kernel32"); | ||||||
| 	cout << "[*] Getting Address of LoadLibrary" << endl; | 	cout << "[*] Getting address of LoadLibrary" << endl; | ||||||
| 	LPVOID LoadLibrary_Address = (LPVOID)GetProcAddress(hK32, "LoadLibraryA"); | 	LPVOID LoadLibrary_Address = (LPVOID)GetProcAddress(hK32, "LoadLibraryA"); | ||||||
| 	FreeLibrary(hK32); | 	FreeLibrary(hK32); | ||||||
| 	cout << "[+] LoadLibrary is at " << LoadLibrary_Address << endl; | 	cout << "[+] LoadLibrary is at " << LoadLibrary_Address << endl; | ||||||
|  | @ -193,7 +196,7 @@ void InjectDll(DWORD PID) | ||||||
| 	LPVOID mem = VirtualAllocEx(hProc, NULL, strlen(dll_full_path), MEM_COMMIT | MEM_RESERVE, PAGE_EXECUTE_READWRITE); | 	LPVOID mem = VirtualAllocEx(hProc, NULL, strlen(dll_full_path), MEM_COMMIT | MEM_RESERVE, PAGE_EXECUTE_READWRITE); | ||||||
| 	if (mem == NULL) | 	if (mem == NULL) | ||||||
| 	{ | 	{ | ||||||
| 		cout << "[!] Could not Allocate Memory: " << GetLastErrorAsString() << endl; | 		fail("Could not allocate memory"); | ||||||
| 		return; | 		return; | ||||||
| 	} | 	} | ||||||
| 	cout << "[*] Writing DLL Name to Process Memory at " << mem << endl; | 	cout << "[*] Writing DLL Name to Process Memory at " << mem << endl; | ||||||
|  | @ -228,37 +231,26 @@ int main(int argc, char *argv[]) | ||||||
| 	DWORD PID = 0; | 	DWORD PID = 0; | ||||||
| 	char s_PID[MAX_PATH]; | 	char s_PID[MAX_PATH]; | ||||||
| 	snprintf(s_PID, MAX_PATH, "%d", GetCurrentProcessId()); | 	snprintf(s_PID, MAX_PATH, "%d", GetCurrentProcessId()); | ||||||
| 	SetEnvironmentVariable("Inj_PID", s_PID); | 	SetEnvironmentVariableA("Inj_PID", s_PID); | ||||||
| 	cout << "[*] Injector PID: " << GetCurrentProcessId() << endl; |  | ||||||
| 	if ((argc>1)&&fexists(argv[1])) { | 	if ((argc>1)&&fexists(argv[1])) { | ||||||
|  | 		cout << "[*] Injector PID: " << GetCurrentProcessId() << endl; | ||||||
| 		cout << "[*] Spawning process for \"" << argv[1] << "\"" << endl; | 		cout << "[*] Spawning process for \"" << argv[1] << "\"" << endl; | ||||||
| 		vector<HANDLE> handles = spawn(argv[1]); | 		vector<HANDLE> handles = spawn(argv[1]); | ||||||
| 		if (handles.empty()) { | 		if (handles.empty()) { | ||||||
| 			cout << "[!] Error: " << GetLastErrorAsString() << endl; | 			fail("Failed to spawn process"); | ||||||
| 			return -1; |  | ||||||
| 		} | 		} | ||||||
| 		hProc = handles[0]; | 		hProc = handles[0]; | ||||||
| 		hThread = handles[1]; | 		hThread = handles[1]; | ||||||
| 		PID = GetProcessId(hProc); | 		PID = GetProcessId(hProc); | ||||||
| 		cout << "[+] Got PID: " << PID << endl; |  | ||||||
| 	} else { | 	} else { | ||||||
| 		GetWindowThreadProcessId(FindWindowA("ScrapClass", NULL), &PID); | 		cerr<<"Usage: " << argv[0] << " <Path to Scrap.exe>"<<endl; | ||||||
| 		if (PID == 0) | 		return 1; | ||||||
| 		{ |  | ||||||
| 			cout << "[*] Waiting for Scrapland to Launch..." << endl; |  | ||||||
| 		} |  | ||||||
| 		while (PID == 0) |  | ||||||
| 		{ |  | ||||||
| 			Sleep(100); |  | ||||||
| 			GetWindowThreadProcessId(FindWindowA("ScrapClass", NULL), &PID); |  | ||||||
| 		} |  | ||||||
| 		cout << "[+] Found PID: " << PID << endl; |  | ||||||
| 	} | 	} | ||||||
| 	InjectDll(PID); | 	InjectDll(PID); | ||||||
| 	if (hThread != INVALID_HANDLE_VALUE) { | 	if (hThread != INVALID_HANDLE_VALUE) { | ||||||
| 		while (ResumeThread(hThread)); | 		while (ResumeThread(hThread)); | ||||||
| 	} | 	} | ||||||
| 	SetEnvironmentVariable("Inj_PID", NULL); | 	SetEnvironmentVariableA("Inj_PID", NULL); | ||||||
| 	cout << "[*] Done!" << endl; | 	cout << "[*] Done!" << endl; | ||||||
| 	return 0; | 	return 0; | ||||||
| } | } | ||||||
|  | @ -1,31 +0,0 @@ | ||||||
|  |  | ||||||
| Microsoft Visual Studio Solution File, Format Version 12.00 |  | ||||||
| # Visual Studio 15 |  | ||||||
| VisualStudioVersion = 15.0.27703.2042 |  | ||||||
| MinimumVisualStudioVersion = 10.0.40219.1 |  | ||||||
| Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Injector", "Injector\Injector.vcxproj", "{7C91C225-D95C-4B7A-9251-0CE358BAF556}" |  | ||||||
| EndProject |  | ||||||
| Global |  | ||||||
| 	GlobalSection(SolutionConfigurationPlatforms) = preSolution |  | ||||||
| 		Debug|x64 = Debug|x64 |  | ||||||
| 		Debug|x86 = Debug|x86 |  | ||||||
| 		Release|x64 = Release|x64 |  | ||||||
| 		Release|x86 = Release|x86 |  | ||||||
| 	EndGlobalSection |  | ||||||
| 	GlobalSection(ProjectConfigurationPlatforms) = postSolution |  | ||||||
| 		{7C91C225-D95C-4B7A-9251-0CE358BAF556}.Debug|x64.ActiveCfg = Debug|x64 |  | ||||||
| 		{7C91C225-D95C-4B7A-9251-0CE358BAF556}.Debug|x64.Build.0 = Debug|x64 |  | ||||||
| 		{7C91C225-D95C-4B7A-9251-0CE358BAF556}.Debug|x86.ActiveCfg = Debug|Win32 |  | ||||||
| 		{7C91C225-D95C-4B7A-9251-0CE358BAF556}.Debug|x86.Build.0 = Debug|Win32 |  | ||||||
| 		{7C91C225-D95C-4B7A-9251-0CE358BAF556}.Release|x64.ActiveCfg = Release|x64 |  | ||||||
| 		{7C91C225-D95C-4B7A-9251-0CE358BAF556}.Release|x64.Build.0 = Release|x64 |  | ||||||
| 		{7C91C225-D95C-4B7A-9251-0CE358BAF556}.Release|x86.ActiveCfg = Release|Win32 |  | ||||||
| 		{7C91C225-D95C-4B7A-9251-0CE358BAF556}.Release|x86.Build.0 = Release|Win32 |  | ||||||
| 	EndGlobalSection |  | ||||||
| 	GlobalSection(SolutionProperties) = preSolution |  | ||||||
| 		HideSolutionNode = FALSE |  | ||||||
| 	EndGlobalSection |  | ||||||
| 	GlobalSection(ExtensibilityGlobals) = postSolution |  | ||||||
| 		SolutionGuid = {8AE8D706-DEB4-42C3-AA4F-CEF2EB636A39} |  | ||||||
| 	EndGlobalSection |  | ||||||
| EndGlobal |  | ||||||
|  | @ -1,164 +0,0 @@ | ||||||
| <?xml version="1.0" encoding="utf-8"?> |  | ||||||
| <Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> |  | ||||||
|   <ItemGroup Label="ProjectConfigurations"> |  | ||||||
|     <ProjectConfiguration Include="Debug|Win32"> |  | ||||||
|       <Configuration>Debug</Configuration> |  | ||||||
|       <Platform>Win32</Platform> |  | ||||||
|     </ProjectConfiguration> |  | ||||||
|     <ProjectConfiguration Include="Release|Win32"> |  | ||||||
|       <Configuration>Release</Configuration> |  | ||||||
|       <Platform>Win32</Platform> |  | ||||||
|     </ProjectConfiguration> |  | ||||||
|     <ProjectConfiguration Include="Debug|x64"> |  | ||||||
|       <Configuration>Debug</Configuration> |  | ||||||
|       <Platform>x64</Platform> |  | ||||||
|     </ProjectConfiguration> |  | ||||||
|     <ProjectConfiguration Include="Release|x64"> |  | ||||||
|       <Configuration>Release</Configuration> |  | ||||||
|       <Platform>x64</Platform> |  | ||||||
|     </ProjectConfiguration> |  | ||||||
|   </ItemGroup> |  | ||||||
|   <PropertyGroup Label="Globals"> |  | ||||||
|     <VCProjectVersion>15.0</VCProjectVersion> |  | ||||||
|     <ProjectGuid>{7C91C225-D95C-4B7A-9251-0CE358BAF556}</ProjectGuid> |  | ||||||
|     <Keyword>Win32Proj</Keyword> |  | ||||||
|     <RootNamespace>Injector</RootNamespace> |  | ||||||
|     <WindowsTargetPlatformVersion>10.0.17763.0</WindowsTargetPlatformVersion> |  | ||||||
|   </PropertyGroup> |  | ||||||
|   <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> |  | ||||||
|   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> |  | ||||||
|     <ConfigurationType>Application</ConfigurationType> |  | ||||||
|     <UseDebugLibraries>true</UseDebugLibraries> |  | ||||||
|     <PlatformToolset>v141</PlatformToolset> |  | ||||||
|     <CharacterSet>MultiByte</CharacterSet> |  | ||||||
|   </PropertyGroup> |  | ||||||
|   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> |  | ||||||
|     <ConfigurationType>Application</ConfigurationType> |  | ||||||
|     <UseDebugLibraries>false</UseDebugLibraries> |  | ||||||
|     <PlatformToolset>v141</PlatformToolset> |  | ||||||
|     <WholeProgramOptimization>true</WholeProgramOptimization> |  | ||||||
|     <CharacterSet>MultiByte</CharacterSet> |  | ||||||
|   </PropertyGroup> |  | ||||||
|   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration"> |  | ||||||
|     <ConfigurationType>Application</ConfigurationType> |  | ||||||
|     <UseDebugLibraries>true</UseDebugLibraries> |  | ||||||
|     <PlatformToolset>v141</PlatformToolset> |  | ||||||
|     <CharacterSet>MultiByte</CharacterSet> |  | ||||||
|   </PropertyGroup> |  | ||||||
|   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration"> |  | ||||||
|     <ConfigurationType>Application</ConfigurationType> |  | ||||||
|     <UseDebugLibraries>false</UseDebugLibraries> |  | ||||||
|     <PlatformToolset>v141</PlatformToolset> |  | ||||||
|     <WholeProgramOptimization>true</WholeProgramOptimization> |  | ||||||
|     <CharacterSet>MultiByte</CharacterSet> |  | ||||||
|   </PropertyGroup> |  | ||||||
|   <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> |  | ||||||
|   <ImportGroup Label="ExtensionSettings"> |  | ||||||
|   </ImportGroup> |  | ||||||
|   <ImportGroup Label="Shared"> |  | ||||||
|   </ImportGroup> |  | ||||||
|   <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> |  | ||||||
|     <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> |  | ||||||
|   </ImportGroup> |  | ||||||
|   <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> |  | ||||||
|     <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> |  | ||||||
|   </ImportGroup> |  | ||||||
|   <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> |  | ||||||
|     <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> |  | ||||||
|   </ImportGroup> |  | ||||||
|   <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> |  | ||||||
|     <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> |  | ||||||
|   </ImportGroup> |  | ||||||
|   <PropertyGroup Label="UserMacros" /> |  | ||||||
|   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> |  | ||||||
|     <LinkIncremental>true</LinkIncremental> |  | ||||||
|   </PropertyGroup> |  | ||||||
|   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> |  | ||||||
|     <LinkIncremental>true</LinkIncremental> |  | ||||||
|   </PropertyGroup> |  | ||||||
|   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> |  | ||||||
|     <LinkIncremental>false</LinkIncremental> |  | ||||||
|   </PropertyGroup> |  | ||||||
|   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> |  | ||||||
|     <LinkIncremental>false</LinkIncremental> |  | ||||||
|   </PropertyGroup> |  | ||||||
|   <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> |  | ||||||
|     <ClCompile> |  | ||||||
|       <PrecompiledHeader>Use</PrecompiledHeader> |  | ||||||
|       <WarningLevel>Level3</WarningLevel> |  | ||||||
|       <Optimization>Disabled</Optimization> |  | ||||||
|       <SDLCheck>true</SDLCheck> |  | ||||||
|       <PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS ;WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions> |  | ||||||
|       <ConformanceMode>true</ConformanceMode> |  | ||||||
|     </ClCompile> |  | ||||||
|     <Link> |  | ||||||
|       <SubSystem>Console</SubSystem> |  | ||||||
|       <GenerateDebugInformation>true</GenerateDebugInformation> |  | ||||||
|     </Link> |  | ||||||
|   </ItemDefinitionGroup> |  | ||||||
|   <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> |  | ||||||
|     <ClCompile> |  | ||||||
|       <PrecompiledHeader>Use</PrecompiledHeader> |  | ||||||
|       <WarningLevel>Level3</WarningLevel> |  | ||||||
|       <Optimization>Disabled</Optimization> |  | ||||||
|       <SDLCheck>true</SDLCheck> |  | ||||||
|       <PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions> |  | ||||||
|       <ConformanceMode>true</ConformanceMode> |  | ||||||
|     </ClCompile> |  | ||||||
|     <Link> |  | ||||||
|       <SubSystem>Console</SubSystem> |  | ||||||
|       <GenerateDebugInformation>true</GenerateDebugInformation> |  | ||||||
|     </Link> |  | ||||||
|   </ItemDefinitionGroup> |  | ||||||
|   <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> |  | ||||||
|     <ClCompile> |  | ||||||
|       <PrecompiledHeader>Use</PrecompiledHeader> |  | ||||||
|       <WarningLevel>Level3</WarningLevel> |  | ||||||
|       <Optimization>MaxSpeed</Optimization> |  | ||||||
|       <FunctionLevelLinking>true</FunctionLevelLinking> |  | ||||||
|       <IntrinsicFunctions>true</IntrinsicFunctions> |  | ||||||
|       <SDLCheck>true</SDLCheck> |  | ||||||
|       <PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS ;WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions> |  | ||||||
|       <ConformanceMode>true</ConformanceMode> |  | ||||||
|     </ClCompile> |  | ||||||
|     <Link> |  | ||||||
|       <SubSystem>Console</SubSystem> |  | ||||||
|       <EnableCOMDATFolding>true</EnableCOMDATFolding> |  | ||||||
|       <OptimizeReferences>true</OptimizeReferences> |  | ||||||
|       <GenerateDebugInformation>true</GenerateDebugInformation> |  | ||||||
|     </Link> |  | ||||||
|   </ItemDefinitionGroup> |  | ||||||
|   <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> |  | ||||||
|     <ClCompile> |  | ||||||
|       <PrecompiledHeader>Use</PrecompiledHeader> |  | ||||||
|       <WarningLevel>Level3</WarningLevel> |  | ||||||
|       <Optimization>MaxSpeed</Optimization> |  | ||||||
|       <FunctionLevelLinking>true</FunctionLevelLinking> |  | ||||||
|       <IntrinsicFunctions>true</IntrinsicFunctions> |  | ||||||
|       <SDLCheck>true</SDLCheck> |  | ||||||
|       <PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions> |  | ||||||
|       <ConformanceMode>true</ConformanceMode> |  | ||||||
|     </ClCompile> |  | ||||||
|     <Link> |  | ||||||
|       <SubSystem>Console</SubSystem> |  | ||||||
|       <EnableCOMDATFolding>true</EnableCOMDATFolding> |  | ||||||
|       <OptimizeReferences>true</OptimizeReferences> |  | ||||||
|       <GenerateDebugInformation>true</GenerateDebugInformation> |  | ||||||
|     </Link> |  | ||||||
|   </ItemDefinitionGroup> |  | ||||||
|   <ItemGroup> |  | ||||||
|     <ClInclude Include="stdafx.h" /> |  | ||||||
|     <ClInclude Include="targetver.h" /> |  | ||||||
|   </ItemGroup> |  | ||||||
|   <ItemGroup> |  | ||||||
|     <ClCompile Include="Injector.cpp" /> |  | ||||||
|     <ClCompile Include="stdafx.cpp"> |  | ||||||
|       <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader> |  | ||||||
|       <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Create</PrecompiledHeader> |  | ||||||
|       <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Create</PrecompiledHeader> |  | ||||||
|       <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Create</PrecompiledHeader> |  | ||||||
|     </ClCompile> |  | ||||||
|   </ItemGroup> |  | ||||||
|   <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> |  | ||||||
|   <ImportGroup Label="ExtensionTargets" /> |  | ||||||
| </Project> |  | ||||||
|  | @ -1,33 +0,0 @@ | ||||||
| <?xml version="1.0" encoding="utf-8"?> |  | ||||||
| <Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> |  | ||||||
|   <ItemGroup> |  | ||||||
|     <Filter Include="Quelldateien"> |  | ||||||
|       <UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier> |  | ||||||
|       <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions> |  | ||||||
|     </Filter> |  | ||||||
|     <Filter Include="Headerdateien"> |  | ||||||
|       <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier> |  | ||||||
|       <Extensions>h;hh;hpp;hxx;hm;inl;inc;ipp;xsd</Extensions> |  | ||||||
|     </Filter> |  | ||||||
|     <Filter Include="Ressourcendateien"> |  | ||||||
|       <UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier> |  | ||||||
|       <Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions> |  | ||||||
|     </Filter> |  | ||||||
|   </ItemGroup> |  | ||||||
|   <ItemGroup> |  | ||||||
|     <ClInclude Include="stdafx.h"> |  | ||||||
|       <Filter>Headerdateien</Filter> |  | ||||||
|     </ClInclude> |  | ||||||
|     <ClInclude Include="targetver.h"> |  | ||||||
|       <Filter>Headerdateien</Filter> |  | ||||||
|     </ClInclude> |  | ||||||
|   </ItemGroup> |  | ||||||
|   <ItemGroup> |  | ||||||
|     <ClCompile Include="stdafx.cpp"> |  | ||||||
|       <Filter>Quelldateien</Filter> |  | ||||||
|     </ClCompile> |  | ||||||
|     <ClCompile Include="Injector.cpp"> |  | ||||||
|       <Filter>Quelldateien</Filter> |  | ||||||
|     </ClCompile> |  | ||||||
|   </ItemGroup> |  | ||||||
| </Project> |  | ||||||
|  | @ -1,20 +1,11 @@ | ||||||
|  | Open VS 2017 32-bit command prompt (`vcvars32.bat`) | ||||||
| 
 |  | ||||||
| ## Usage |  | ||||||
| 
 |  | ||||||
| 0. Download `DirectX.8.0a.SDK.zip` from [here](https://archive.org/download/DirectX.8.0a.SDK_includes_libs_only) |  | ||||||
| 1. Extract `DirectX.SDK/8.0/include` and `DirectX.SDK/8.0/lib` to `ScrapHacks/ScrapHack/dx8/include` and `ScrapHacks/ScrapHack/dx8/lib` |  | ||||||
| 2. Add include and library dirs to project |  | ||||||
| 3. Build Project |  | ||||||
| 4. Run Injector `.\Injector.exe <Path to Scrap.exe>` |  | ||||||
| 5. Wait for game to crash |  | ||||||
| 6. Comment out `hook_d3d8()` call in `ScrapHack.cpp:DllPreInit()`  |  | ||||||
| 7. Rebuild and run Injector again |  | ||||||
| 
 | 
 | ||||||
|  | ```batch | ||||||
|  | mkdir build | ||||||
|  | cd build | ||||||
|  | cmake -G "NMake Makefiles" -DCMAKE_BUILD_TYPE="Release" -DCMAKE_INSTALL_PREFIX="" .. | ||||||
|  | cmake --build . | ||||||
|  | cmake --install . | ||||||
| ``` | ``` | ||||||
| [F3 ] Unload ScrapHacks | 
 | ||||||
| [F7 ] Set Money to 0x7fffffff | this will drop the compiled files into `./build/bin` | ||||||
| [F8 ] Dump python modules to console |  | ||||||
| [F10] Enable python tracing |  | ||||||
| [ F ] "Handbrake" (*Will* crash the game after some time!) |  | ||||||
| ``` |  | ||||||
							
								
								
									
										17
									
								
								ScrapHacks/ScrapHack/CMakeLists.txt
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										17
									
								
								ScrapHacks/ScrapHack/CMakeLists.txt
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,17 @@ | ||||||
|  | include(ExternalProject) | ||||||
|  | ExternalProject_Add(DirectX | ||||||
|  |     PREFIX ${CMAKE_CURRENT_BINARY_DIR} | ||||||
|  |     CONFIGURE_COMMAND "" | ||||||
|  |     BUILD_COMMAND "" | ||||||
|  |     INSTALL_COMMAND "" | ||||||
|  |     URL https://archive.org/download/DirectX.8.0a.SDK_includes_libs_only/DirectX.8.0a.SDK.zip | ||||||
|  |     URL_HASH SHA1=39f168336d0df92ff14d62d5e3aef1b9e3191312 | ||||||
|  | ) | ||||||
|  | ExternalProject_Get_Property(DirectX SOURCE_DIR) | ||||||
|  | include_directories(AFTER ${SOURCE_DIR}/8.0/include/) | ||||||
|  | link_directories(AFTER ${SOURCE_DIR}/8.0/lib/) | ||||||
|  | add_compile_definitions(_CRT_SECURE_NO_WARNINGS) | ||||||
|  | add_compile_definitions(POINTER_64=__ptr64) | ||||||
|  | add_library(ScrapHack SHARED ScrapHack.cpp dllmain.cpp) | ||||||
|  | target_link_libraries(ScrapHack d3d8 d3dx8 legacy_stdio_definitions) | ||||||
|  | install(TARGETS ScrapHack DESTINATION bin) | ||||||
|  | @ -13,12 +13,23 @@ D3DCOLOR color = D3DCOLOR_ARGB(255,255, 0, 0); | ||||||
| RECT Rect = { 0,0,0,0 }; | RECT Rect = { 0,0,0,0 }; | ||||||
| D3DRECT panel; | D3DRECT panel; | ||||||
| 
 | 
 | ||||||
|  | size_t size_ht(HashTable<EntityList>* ht); | ||||||
|  | size_t size_ht(HashTable<Entity>* ht); | ||||||
|  | 
 | ||||||
| LPDIRECT3DDEVICE8 Render(LPDIRECT3DDEVICE8 dev) { | LPDIRECT3DDEVICE8 Render(LPDIRECT3DDEVICE8 dev) { | ||||||
| 	if (!overlay) { | 	if (!overlay) { | ||||||
| 		return dev; | 		return dev; | ||||||
| 	} | 	} | ||||||
| 	char text[1024]; | 	char text[4096]; | ||||||
| 	snprintf(text, 1024, "ScrapHack v0.1\nFrame: [%lld]", ++frame); | 	int32_t money = 0; | ||||||
|  | 	size_t num_ents = 0; | ||||||
|  | 	size_t num_ent_lst = 0; | ||||||
|  | 	if (ptr<void>(P_WORLD, 0)!=nullptr) { | ||||||
|  | 		money = ptr<int32_t>(P_WORLD, O_MONEY)[0]; | ||||||
|  | 		num_ents= size_ht(ptr<HashTable<Entity>>(P_WORLD, O_ENTS)); | ||||||
|  | 		num_ent_lst = size_ht(ptr<HashTable<EntityList>>(P_WORLD, O_ENTLISTS)); | ||||||
|  | 	} | ||||||
|  | 	snprintf(text, 4096, "ScrapHack v0.1\nFrame: [%lld]\nMoney: [%d]\nEntities: [%ld]\nEntity Lists: [%ld]", ++frame, money, num_ents,num_ent_lst); | ||||||
| 	if (m_pFont == nullptr) { | 	if (m_pFont == nullptr) { | ||||||
| 		D3DXCreateFont(dev, hFont, &m_pFont); | 		D3DXCreateFont(dev, hFont, &m_pFont); | ||||||
| 		CloseHandle(hFont); | 		CloseHandle(hFont); | ||||||
|  |  | ||||||
|  | @ -1,4 +1,3 @@ | ||||||
| #define WIN32_LEAN_AND_MEAN |  | ||||||
| #include "stdafx.h" | #include "stdafx.h" | ||||||
| #include <string> | #include <string> | ||||||
| #include <sstream> | #include <sstream> | ||||||
|  | @ -11,10 +10,6 @@ | ||||||
| #include <Windows.h> | #include <Windows.h> | ||||||
| #include <TlHelp32.h> | #include <TlHelp32.h> | ||||||
| 
 | 
 | ||||||
| #pragma comment(lib, "d3d8.lib") |  | ||||||
| #pragma comment(lib, "d3dx8.lib") |  | ||||||
| #pragma comment(lib, "legacy_stdio_definitions.lib") |  | ||||||
| 
 |  | ||||||
| using namespace std; | using namespace std; | ||||||
| 
 | 
 | ||||||
| #include "Scrapland.h" | #include "Scrapland.h" | ||||||
|  | @ -34,16 +29,57 @@ HMODULE mod = 0; | ||||||
| void DllUnload(HMODULE); | void DllUnload(HMODULE); | ||||||
| void hook_exit(); | void hook_exit(); | ||||||
| 
 | 
 | ||||||
| size_t dump_ht(HashTable<EntityList>* ht) { | size_t size_ht(HashTable<EntityList> *ht) | ||||||
|  | { | ||||||
|     size_t cnt = 0; |     size_t cnt = 0; | ||||||
| 	for (size_t i = 0; i < ht->size; ++i) { |     for (size_t i = 0; i < ht->size; ++i) | ||||||
|  |     { | ||||||
|         HashTableEntry<EntityList> *ent = ht->chains[i]; |         HashTableEntry<EntityList> *ent = ht->chains[i]; | ||||||
| 		if (ent) { |         if (ent) | ||||||
|  |         { | ||||||
|  |             while (ent) | ||||||
|  |             { | ||||||
|  |                 ++cnt; | ||||||
|  |                 ent = ent->next; | ||||||
|  |             } | ||||||
|  |         } | ||||||
|  |     } | ||||||
|  |     return cnt; | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | size_t size_ht(HashTable<Entity> *ht) | ||||||
|  | { | ||||||
|  |     size_t cnt = 0; | ||||||
|  |     for (size_t i = 0; i < ht->size; ++i) | ||||||
|  |     { | ||||||
|  |         HashTableEntry<Entity> *ent = ht->chains[i]; | ||||||
|  |         if (ent) | ||||||
|  |         { | ||||||
|  |             while (ent) | ||||||
|  |             { | ||||||
|  |                 ++cnt; | ||||||
|  |                 ent = ent->next; | ||||||
|  |             } | ||||||
|  |         } | ||||||
|  |     } | ||||||
|  |     return cnt; | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | size_t dump_ht(HashTable<EntityList> *ht) | ||||||
|  | { | ||||||
|  |     size_t cnt = 0; | ||||||
|  |     for (size_t i = 0; i < ht->size; ++i) | ||||||
|  |     { | ||||||
|  |         HashTableEntry<EntityList> *ent = ht->chains[i]; | ||||||
|  |         if (ent) | ||||||
|  |         { | ||||||
|             cout << i << ": "; |             cout << i << ": "; | ||||||
| 			while (ent) { |             while (ent) | ||||||
|  |             { | ||||||
|                 ++cnt; |                 ++cnt; | ||||||
|                 cout << "[ " << ent->name << ": " << ent->data << "]"; |                 cout << "[ " << ent->name << ": " << ent->data << "]"; | ||||||
| 				if (ent->next) { |                 if (ent->next) | ||||||
|  |                 { | ||||||
|                     cout << " -> "; |                     cout << " -> "; | ||||||
|                 }; |                 }; | ||||||
|                 ent = ent->next; |                 ent = ent->next; | ||||||
|  | @ -55,16 +91,21 @@ size_t dump_ht(HashTable<EntityList>* ht) { | ||||||
|     return cnt; |     return cnt; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| size_t dump_ht(HashTable<Entity>* ht) { | size_t dump_ht(HashTable<Entity> *ht) | ||||||
|  | { | ||||||
|     size_t cnt = 0; |     size_t cnt = 0; | ||||||
| 	for (size_t i = 0; i < ht->size; ++i) { |     for (size_t i = 0; i < ht->size; ++i) | ||||||
|  |     { | ||||||
|         HashTableEntry<Entity> *ent = ht->chains[i]; |         HashTableEntry<Entity> *ent = ht->chains[i]; | ||||||
| 		if (ent) { |         if (ent) | ||||||
|  |         { | ||||||
|             cout << i << ": "; |             cout << i << ": "; | ||||||
| 			while (ent) { |             while (ent) | ||||||
|  |             { | ||||||
|                 ++cnt; |                 ++cnt; | ||||||
|                 cout << "[ " << ent->name << ": " << ent->data << "]"; |                 cout << "[ " << ent->name << ": " << ent->data << "]"; | ||||||
| 				if (ent->next) { |                 if (ent->next) | ||||||
|  |                 { | ||||||
|                     cout << " -> "; |                     cout << " -> "; | ||||||
|                 }; |                 }; | ||||||
|                 ent = ent->next; |                 ent = ent->next; | ||||||
|  | @ -131,7 +172,8 @@ void MainLoop(HMODULE mod) | ||||||
|             } |             } | ||||||
|         } |         } | ||||||
| 
 | 
 | ||||||
| 		if (key_down_norepeat(VK_F9)) { |         if (key_down_norepeat(VK_F9)) | ||||||
|  |         { | ||||||
|             cout << "Entities:" << endl; |             cout << "Entities:" << endl; | ||||||
|             dump_ht(ptr<HashTable<Entity>>(P_WORLD, O_ENTS)); |             dump_ht(ptr<HashTable<Entity>>(P_WORLD, O_ENTS)); | ||||||
|             cout << "Entity Lists:" << endl; |             cout << "Entity Lists:" << endl; | ||||||
|  | @ -152,7 +194,8 @@ void InitConsole() | ||||||
|     SetupConsole(me); |     SetupConsole(me); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| void handle_command(const char* cmd) { | void handle_command(const char *cmd) | ||||||
|  | { | ||||||
|     cout << "CMD: " << cmd << endl; |     cout << "CMD: " << cmd << endl; | ||||||
|     scrap_log(0x00ff00, "HAXX: "); |     scrap_log(0x00ff00, "HAXX: "); | ||||||
|     scrap_log(0x00ff00, cmd); |     scrap_log(0x00ff00, cmd); | ||||||
|  | @ -160,10 +203,12 @@ void handle_command(const char* cmd) { | ||||||
|     return; |     return; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| int hooked_console(const char* cmd) { | int hooked_console(const char *cmd) | ||||||
|  | { | ||||||
|     typedef int(_cdecl * t_func)(const char *); |     typedef int(_cdecl * t_func)(const char *); | ||||||
|     shared_ptr<Hook> hook = Hook::get(hooked_console); |     shared_ptr<Hook> hook = Hook::get(hooked_console); | ||||||
| 	if (cmd[0] == '$') { |     if (cmd[0] == '$') | ||||||
|  |     { | ||||||
|         handle_command(++cmd); |         handle_command(++cmd); | ||||||
|         return 0; |         return 0; | ||||||
|     } |     } | ||||||
|  | @ -171,11 +216,13 @@ int hooked_console(const char* cmd) { | ||||||
|     return ret; |     return ret; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| void hook_console() { | void hook_console() | ||||||
|  | { | ||||||
|     Hook::addr(reinterpret_cast<void *>(P_CON_HANDLER), hooked_console); |     Hook::addr(reinterpret_cast<void *>(P_CON_HANDLER), hooked_console); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| void H_Exit(){ | void H_Exit() | ||||||
|  | { | ||||||
|     typedef void(_cdecl * t_func)(void); |     typedef void(_cdecl * t_func)(void); | ||||||
|     shared_ptr<Hook> hook = Hook::get(H_Exit); |     shared_ptr<Hook> hook = Hook::get(H_Exit); | ||||||
|     DllUnload(mod); |     DllUnload(mod); | ||||||
|  | @ -184,21 +231,27 @@ void H_Exit(){ | ||||||
|     return; |     return; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| void hook_exit() { | void hook_exit() | ||||||
| 	Hook::addr(reinterpret_cast<void*>(0x4010c0), H_Exit); | { | ||||||
|  |     Hook::addr(reinterpret_cast<void *>(P_SCRAP_EXIT), H_Exit); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| DWORD PPID() { | DWORD PPID() | ||||||
|  | { | ||||||
|     DWORD PID = GetCurrentProcessId(); |     DWORD PID = GetCurrentProcessId(); | ||||||
|     HANDLE hSnapShot = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0); |     HANDLE hSnapShot = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0); | ||||||
|     PROCESSENTRY32 procentry; |     PROCESSENTRY32 procentry; | ||||||
| 	if (hSnapShot == INVALID_HANDLE_VALUE) { |     if (hSnapShot == INVALID_HANDLE_VALUE) | ||||||
|  |     { | ||||||
|         cout << GetLastErrorAsString() << endl; |         cout << GetLastErrorAsString() << endl; | ||||||
|         return -1; |         return -1; | ||||||
|     } |     } | ||||||
| 	if (Process32First(hSnapShot, &procentry)) { |     if (Process32First(hSnapShot, &procentry)) | ||||||
| 		do { |     { | ||||||
| 			if (procentry.th32ProcessID == PID) { |         do | ||||||
|  |         { | ||||||
|  |             if (procentry.th32ProcessID == PID) | ||||||
|  |             { | ||||||
|                 CloseHandle(hSnapShot); |                 CloseHandle(hSnapShot); | ||||||
|                 return procentry.th32ParentProcessID; |                 return procentry.th32ParentProcessID; | ||||||
|             } |             } | ||||||
|  | @ -209,24 +262,27 @@ DWORD PPID() { | ||||||
|     return -1; |     return -1; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| void DllPreInit(HMODULE _mod) { | void DllPreInit(HMODULE _mod) | ||||||
|  | { | ||||||
|     char mfn[1024]; |     char mfn[1024]; | ||||||
|     char inj[MAX_PATH]; |     char inj[MAX_PATH]; | ||||||
|     DWORD INJ_PID = 0; |     DWORD INJ_PID = 0; | ||||||
|     InitConsole(); |     InitConsole(); | ||||||
| 	GetModuleFileName(0, mfn, 1024); |     GetModuleFileNameA(0, mfn, 1024); | ||||||
|     Py = get_modules(P_PY_MODS); |     Py = get_modules(P_PY_MODS); | ||||||
|     cout << "[+] ScrapHacks v0.1 Loaded in " << mfn << " (PID: " << std::hex << GetCurrentProcessId() << std::dec << ")" << endl; |     cout << "[+] ScrapHacks v0.1 Loaded in " << mfn << " (PID: " << std::hex << GetCurrentProcessId() << std::dec << ")" << endl; | ||||||
| 	GetEnvironmentVariable("Inj_PID", inj, MAX_PATH); |     GetEnvironmentVariableA("Inj_PID", inj, MAX_PATH); | ||||||
| 	SetEnvironmentVariable("Inj_PID", NULL); |     SetEnvironmentVariableA("Inj_PID", NULL); | ||||||
|     hook_console(); |     hook_console(); | ||||||
| 	sscanf(inj, "%d", &INJ_PID); |     sscanf_s(inj, "%d", &INJ_PID); | ||||||
|     cout << INJ_PID << "," << PPID() << endl; |     cout << INJ_PID << "," << PPID() << endl; | ||||||
| 	if (PPID() == INJ_PID) { |     if (PPID() == INJ_PID) | ||||||
|  |     { | ||||||
|         hook_d3d8(); |         hook_d3d8(); | ||||||
|         overlay = true; |         overlay = true; | ||||||
|     } |     } | ||||||
| 	else { |     else | ||||||
|  |     { | ||||||
|         cout << "[-] No launched by Injector, not hooking DX8" << endl; |         cout << "[-] No launched by Injector, not hooking DX8" << endl; | ||||||
|     } |     } | ||||||
| } | } | ||||||
|  | @ -251,7 +307,8 @@ void DllInit(HMODULE _mod) | ||||||
|     return; |     return; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| void DllUnload(HMODULE _mod) { | void DllUnload(HMODULE _mod) | ||||||
|  | { | ||||||
|     SetConsoleCtrlHandler(NULL, false); |     SetConsoleCtrlHandler(NULL, false); | ||||||
|     unhook_d3d8(); |     unhook_d3d8(); | ||||||
|     Hook::clear(); |     Hook::clear(); | ||||||
|  |  | ||||||
|  | @ -1,178 +0,0 @@ | ||||||
| <?xml version="1.0" encoding="utf-8"?> |  | ||||||
| <Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> |  | ||||||
|   <ItemGroup Label="ProjectConfigurations"> |  | ||||||
|     <ProjectConfiguration Include="Debug|Win32"> |  | ||||||
|       <Configuration>Debug</Configuration> |  | ||||||
|       <Platform>Win32</Platform> |  | ||||||
|     </ProjectConfiguration> |  | ||||||
|     <ProjectConfiguration Include="Release|Win32"> |  | ||||||
|       <Configuration>Release</Configuration> |  | ||||||
|       <Platform>Win32</Platform> |  | ||||||
|     </ProjectConfiguration> |  | ||||||
|     <ProjectConfiguration Include="Debug|x64"> |  | ||||||
|       <Configuration>Debug</Configuration> |  | ||||||
|       <Platform>x64</Platform> |  | ||||||
|     </ProjectConfiguration> |  | ||||||
|     <ProjectConfiguration Include="Release|x64"> |  | ||||||
|       <Configuration>Release</Configuration> |  | ||||||
|       <Platform>x64</Platform> |  | ||||||
|     </ProjectConfiguration> |  | ||||||
|   </ItemGroup> |  | ||||||
|   <PropertyGroup Label="Globals"> |  | ||||||
|     <VCProjectVersion>15.0</VCProjectVersion> |  | ||||||
|     <ProjectGuid>{72CB1B9E-50C7-4010-BEAD-82FACF87A87A}</ProjectGuid> |  | ||||||
|     <Keyword>Win32Proj</Keyword> |  | ||||||
|     <RootNamespace>ScrapHack</RootNamespace> |  | ||||||
|     <WindowsTargetPlatformVersion>10.0.17763.0</WindowsTargetPlatformVersion> |  | ||||||
|   </PropertyGroup> |  | ||||||
|   <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> |  | ||||||
|   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> |  | ||||||
|     <ConfigurationType>DynamicLibrary</ConfigurationType> |  | ||||||
|     <UseDebugLibraries>true</UseDebugLibraries> |  | ||||||
|     <PlatformToolset>v141</PlatformToolset> |  | ||||||
|     <CharacterSet>MultiByte</CharacterSet> |  | ||||||
|   </PropertyGroup> |  | ||||||
|   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> |  | ||||||
|     <ConfigurationType>DynamicLibrary</ConfigurationType> |  | ||||||
|     <UseDebugLibraries>false</UseDebugLibraries> |  | ||||||
|     <PlatformToolset>v141</PlatformToolset> |  | ||||||
|     <WholeProgramOptimization>true</WholeProgramOptimization> |  | ||||||
|     <CharacterSet>MultiByte</CharacterSet> |  | ||||||
|   </PropertyGroup> |  | ||||||
|   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration"> |  | ||||||
|     <ConfigurationType>DynamicLibrary</ConfigurationType> |  | ||||||
|     <UseDebugLibraries>true</UseDebugLibraries> |  | ||||||
|     <PlatformToolset>v141</PlatformToolset> |  | ||||||
|     <CharacterSet>MultiByte</CharacterSet> |  | ||||||
|   </PropertyGroup> |  | ||||||
|   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration"> |  | ||||||
|     <ConfigurationType>DynamicLibrary</ConfigurationType> |  | ||||||
|     <UseDebugLibraries>false</UseDebugLibraries> |  | ||||||
|     <PlatformToolset>v141</PlatformToolset> |  | ||||||
|     <WholeProgramOptimization>true</WholeProgramOptimization> |  | ||||||
|     <CharacterSet>MultiByte</CharacterSet> |  | ||||||
|   </PropertyGroup> |  | ||||||
|   <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> |  | ||||||
|   <ImportGroup Label="ExtensionSettings"> |  | ||||||
|   </ImportGroup> |  | ||||||
|   <ImportGroup Label="Shared"> |  | ||||||
|   </ImportGroup> |  | ||||||
|   <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> |  | ||||||
|     <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> |  | ||||||
|   </ImportGroup> |  | ||||||
|   <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> |  | ||||||
|     <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> |  | ||||||
|   </ImportGroup> |  | ||||||
|   <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> |  | ||||||
|     <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> |  | ||||||
|   </ImportGroup> |  | ||||||
|   <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> |  | ||||||
|     <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> |  | ||||||
|   </ImportGroup> |  | ||||||
|   <PropertyGroup Label="UserMacros" /> |  | ||||||
|   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> |  | ||||||
|     <LinkIncremental>true</LinkIncremental> |  | ||||||
|     <IncludePath>$(VC_IncludePath);$(WindowsSDK_IncludePath);$(ProjectDir)dx8\include;$(SolutionDir)include</IncludePath> |  | ||||||
|     <LibraryPath>$(ProjectDir)dx8\lib;$(SolutionDir)lib;$(LibraryPath)</LibraryPath> |  | ||||||
|   </PropertyGroup> |  | ||||||
|   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> |  | ||||||
|     <LinkIncremental>true</LinkIncremental> |  | ||||||
|   </PropertyGroup> |  | ||||||
|   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> |  | ||||||
|     <LinkIncremental>false</LinkIncremental> |  | ||||||
|     <IncludePath>$(VC_IncludePath);$(WindowsSDK_IncludePath);$(ProjectDir)dx8\include;$(SolutionDir)include</IncludePath> |  | ||||||
|     <LibraryPath>$(ProjectDir)dx8\lib;$(SolutionDir)lib;$(LibraryPath)</LibraryPath> |  | ||||||
|   </PropertyGroup> |  | ||||||
|   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> |  | ||||||
|     <LinkIncremental>false</LinkIncremental> |  | ||||||
|   </PropertyGroup> |  | ||||||
|   <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> |  | ||||||
|     <ClCompile> |  | ||||||
|       <PrecompiledHeader>Use</PrecompiledHeader> |  | ||||||
|       <WarningLevel>Level3</WarningLevel> |  | ||||||
|       <Optimization>Disabled</Optimization> |  | ||||||
|       <SDLCheck>true</SDLCheck> |  | ||||||
|       <PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS ;WIN32;_DEBUG;SCRAPHACK_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions> |  | ||||||
|       <ConformanceMode>true</ConformanceMode> |  | ||||||
|     </ClCompile> |  | ||||||
|     <Link> |  | ||||||
|       <SubSystem>Windows</SubSystem> |  | ||||||
|       <GenerateDebugInformation>true</GenerateDebugInformation> |  | ||||||
|     </Link> |  | ||||||
|   </ItemDefinitionGroup> |  | ||||||
|   <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> |  | ||||||
|     <ClCompile> |  | ||||||
|       <PrecompiledHeader>Use</PrecompiledHeader> |  | ||||||
|       <WarningLevel>Level3</WarningLevel> |  | ||||||
|       <Optimization>Disabled</Optimization> |  | ||||||
|       <SDLCheck>true</SDLCheck> |  | ||||||
|       <PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS;_DEBUG;SCRAPHACK_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions> |  | ||||||
|       <ConformanceMode>true</ConformanceMode> |  | ||||||
|     </ClCompile> |  | ||||||
|     <Link> |  | ||||||
|       <SubSystem>Windows</SubSystem> |  | ||||||
|       <GenerateDebugInformation>true</GenerateDebugInformation> |  | ||||||
|     </Link> |  | ||||||
|   </ItemDefinitionGroup> |  | ||||||
|   <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> |  | ||||||
|     <ClCompile> |  | ||||||
|       <PrecompiledHeader>Use</PrecompiledHeader> |  | ||||||
|       <WarningLevel>Level3</WarningLevel> |  | ||||||
|       <Optimization>MaxSpeed</Optimization> |  | ||||||
|       <FunctionLevelLinking>true</FunctionLevelLinking> |  | ||||||
|       <IntrinsicFunctions>true</IntrinsicFunctions> |  | ||||||
|       <SDLCheck>true</SDLCheck> |  | ||||||
|       <PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS ;WIN32;NDEBUG;SCRAPHACK_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions> |  | ||||||
|       <ConformanceMode>true</ConformanceMode> |  | ||||||
|     </ClCompile> |  | ||||||
|     <Link> |  | ||||||
|       <SubSystem>Windows</SubSystem> |  | ||||||
|       <EnableCOMDATFolding>true</EnableCOMDATFolding> |  | ||||||
|       <OptimizeReferences>true</OptimizeReferences> |  | ||||||
|       <GenerateDebugInformation>true</GenerateDebugInformation> |  | ||||||
|       <AdditionalDependencies>%(AdditionalDependencies)</AdditionalDependencies> |  | ||||||
|       <ImageHasSafeExceptionHandlers>false</ImageHasSafeExceptionHandlers> |  | ||||||
|     </Link> |  | ||||||
|   </ItemDefinitionGroup> |  | ||||||
|   <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> |  | ||||||
|     <ClCompile> |  | ||||||
|       <PrecompiledHeader>Use</PrecompiledHeader> |  | ||||||
|       <WarningLevel>Level3</WarningLevel> |  | ||||||
|       <Optimization>MaxSpeed</Optimization> |  | ||||||
|       <FunctionLevelLinking>true</FunctionLevelLinking> |  | ||||||
|       <IntrinsicFunctions>true</IntrinsicFunctions> |  | ||||||
|       <SDLCheck>true</SDLCheck> |  | ||||||
|       <PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS;NDEBUG;SCRAPHACK_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions> |  | ||||||
|       <ConformanceMode>true</ConformanceMode> |  | ||||||
|     </ClCompile> |  | ||||||
|     <Link> |  | ||||||
|       <SubSystem>Windows</SubSystem> |  | ||||||
|       <EnableCOMDATFolding>true</EnableCOMDATFolding> |  | ||||||
|       <OptimizeReferences>true</OptimizeReferences> |  | ||||||
|       <GenerateDebugInformation>true</GenerateDebugInformation> |  | ||||||
|     </Link> |  | ||||||
|   </ItemDefinitionGroup> |  | ||||||
|   <ItemGroup> |  | ||||||
|     <ClInclude Include="D3D8_Hook.h" /> |  | ||||||
|     <ClInclude Include="VMT_Hook.h" /> |  | ||||||
|     <ClInclude Include="Hook.h" /> |  | ||||||
|     <ClInclude Include="Py_Utils.h" /> |  | ||||||
|     <ClInclude Include="Structures.h" /> |  | ||||||
|     <ClInclude Include="Scrapland.h" /> |  | ||||||
|     <ClInclude Include="stdafx.h" /> |  | ||||||
|     <ClInclude Include="targetver.h" /> |  | ||||||
|     <ClInclude Include="Util.h" /> |  | ||||||
|   </ItemGroup> |  | ||||||
|   <ItemGroup> |  | ||||||
|     <ClCompile Include="dllmain.cpp" /> |  | ||||||
|     <ClCompile Include="ScrapHack.cpp" /> |  | ||||||
|     <ClCompile Include="stdafx.cpp"> |  | ||||||
|       <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader> |  | ||||||
|       <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Create</PrecompiledHeader> |  | ||||||
|       <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Create</PrecompiledHeader> |  | ||||||
|       <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Create</PrecompiledHeader> |  | ||||||
|     </ClCompile> |  | ||||||
|   </ItemGroup> |  | ||||||
|   <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> |  | ||||||
|   <ImportGroup Label="ExtensionTargets" /> |  | ||||||
| </Project> |  | ||||||
|  | @ -1,57 +0,0 @@ | ||||||
| <?xml version="1.0" encoding="utf-8"?> |  | ||||||
| <Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> |  | ||||||
|   <ItemGroup> |  | ||||||
|     <Filter Include="Quelldateien"> |  | ||||||
|       <UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier> |  | ||||||
|       <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions> |  | ||||||
|     </Filter> |  | ||||||
|     <Filter Include="Headerdateien"> |  | ||||||
|       <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier> |  | ||||||
|       <Extensions>h;hh;hpp;hxx;hm;inl;inc;ipp;xsd</Extensions> |  | ||||||
|     </Filter> |  | ||||||
|     <Filter Include="Ressourcendateien"> |  | ||||||
|       <UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier> |  | ||||||
|       <Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions> |  | ||||||
|     </Filter> |  | ||||||
|   </ItemGroup> |  | ||||||
|   <ItemGroup> |  | ||||||
|     <ClInclude Include="stdafx.h"> |  | ||||||
|       <Filter>Headerdateien</Filter> |  | ||||||
|     </ClInclude> |  | ||||||
|     <ClInclude Include="targetver.h"> |  | ||||||
|       <Filter>Headerdateien</Filter> |  | ||||||
|     </ClInclude> |  | ||||||
|     <ClInclude Include="Scrapland.h"> |  | ||||||
|       <Filter>Headerdateien</Filter> |  | ||||||
|     </ClInclude> |  | ||||||
|     <ClInclude Include="Util.h"> |  | ||||||
|       <Filter>Headerdateien</Filter> |  | ||||||
|     </ClInclude> |  | ||||||
|     <ClInclude Include="Structures.h"> |  | ||||||
|       <Filter>Headerdateien</Filter> |  | ||||||
|     </ClInclude> |  | ||||||
|     <ClInclude Include="Py_Utils.h"> |  | ||||||
|       <Filter>Headerdateien</Filter> |  | ||||||
|     </ClInclude> |  | ||||||
|     <ClInclude Include="Hook.h"> |  | ||||||
|       <Filter>Headerdateien</Filter> |  | ||||||
|     </ClInclude> |  | ||||||
|     <ClInclude Include="D3D8_Hook.h"> |  | ||||||
|       <Filter>Headerdateien</Filter> |  | ||||||
|     </ClInclude> |  | ||||||
|     <ClInclude Include="VMT_Hook.h"> |  | ||||||
|       <Filter>Headerdateien</Filter> |  | ||||||
|     </ClInclude> |  | ||||||
|   </ItemGroup> |  | ||||||
|   <ItemGroup> |  | ||||||
|     <ClCompile Include="stdafx.cpp"> |  | ||||||
|       <Filter>Quelldateien</Filter> |  | ||||||
|     </ClCompile> |  | ||||||
|     <ClCompile Include="ScrapHack.cpp"> |  | ||||||
|       <Filter>Quelldateien</Filter> |  | ||||||
|     </ClCompile> |  | ||||||
|     <ClCompile Include="dllmain.cpp"> |  | ||||||
|       <Filter>Quelldateien</Filter> |  | ||||||
|     </ClCompile> |  | ||||||
|   </ItemGroup> |  | ||||||
| </Project> |  | ||||||
|  | @ -13,6 +13,7 @@ | ||||||
| #define P_CON_HANDLER 0x402190 | #define P_CON_HANDLER 0x402190 | ||||||
| #define P_SCRAP_LOG 0x4134C0 | #define P_SCRAP_LOG 0x4134C0 | ||||||
| #define P_SCRAP_EXEC 0x5a8390 | #define P_SCRAP_EXEC 0x5a8390 | ||||||
|  | #define P_SCRAP_EXIT 0x4010c0 | ||||||
| 
 | 
 | ||||||
| //FUNCTION TYPES
 | //FUNCTION TYPES
 | ||||||
| #define T_SCRAP_LOG int(_cdecl*)(unsigned int, const char*) | #define T_SCRAP_LOG int(_cdecl*)(unsigned int, const char*) | ||||||
|  |  | ||||||
|  | @ -134,9 +134,9 @@ T* __ptr(uintptr_t addr) | ||||||
| template<typename T> | template<typename T> | ||||||
| T* __ptr(uintptr_t addr, ptrdiff_t offset) | T* __ptr(uintptr_t addr, ptrdiff_t offset) | ||||||
| { | { | ||||||
| 	cout << "[" << (void*)addr << "] + " << (void*)offset << " = "; | 	//cout << "[" << (void*)addr << "] + " << (void*)offset << " = ";
 | ||||||
| 	addr = reinterpret_cast<uintptr_t*>(addr)[0] + offset; | 	addr = reinterpret_cast<uintptr_t*>(addr)[0] + offset; | ||||||
| 	cout << (void*)addr << endl;; | 	//cout << (void*)addr << endl;;
 | ||||||
| 	auto ret = __ptr<T>(addr); | 	auto ret = __ptr<T>(addr); | ||||||
| 	return ret; | 	return ret; | ||||||
| } | } | ||||||
|  | @ -144,9 +144,9 @@ T* __ptr(uintptr_t addr, ptrdiff_t offset) | ||||||
| 
 | 
 | ||||||
| template<typename T, typename... Offsets> | template<typename T, typename... Offsets> | ||||||
| T* __ptr(uintptr_t addr, ptrdiff_t offset, Offsets... offsets) { | T* __ptr(uintptr_t addr, ptrdiff_t offset, Offsets... offsets) { | ||||||
| 	cout << "[" << (void*)addr << "] + " << (void*)offset << " = "; | 	//cout << "[" << (void*)addr << "] + " << (void*)offset << " = ";
 | ||||||
| 	addr = reinterpret_cast<uintptr_t*>(addr)[0] + offset; | 	addr = reinterpret_cast<uintptr_t*>(addr)[0] + offset; | ||||||
| 	cout << (void*)addr << endl;; | 	//cout << (void*)addr << endl;;
 | ||||||
| 	auto ret = __ptr<T>(addr, offsets...); | 	auto ret = __ptr<T>(addr, offsets...); | ||||||
| 	return ret; | 	return ret; | ||||||
| } | } | ||||||
|  |  | ||||||
|  | @ -4,7 +4,6 @@ void DllInit(HMODULE); | ||||||
| void DllPreInit(HMODULE); | void DllPreInit(HMODULE); | ||||||
| void DllUnload(HMODULE); | void DllUnload(HMODULE); | ||||||
| 
 | 
 | ||||||
| 
 |  | ||||||
| BOOL APIENTRY DllMain(HMODULE hModule, | BOOL APIENTRY DllMain(HMODULE hModule, | ||||||
|                       DWORD ul_reason_for_call, |                       DWORD ul_reason_for_call, | ||||||
|                       LPVOID lpReserved) |                       LPVOID lpReserved) | ||||||
|  |  | ||||||
|  | @ -7,8 +7,6 @@ | ||||||
| 
 | 
 | ||||||
| #include "targetver.h" | #include "targetver.h" | ||||||
| 
 | 
 | ||||||
| #define WIN32_LEAN_AND_MEAN // Selten verwendete Komponenten aus Windows-Headern ausschließen
 |  | ||||||
| // Windows-Headerdateien:
 |  | ||||||
| #include <windows.h> | #include <windows.h> | ||||||
| 
 | 
 | ||||||
| // TODO: Hier auf zusätzliche Header, die das Programm erfordert, verweisen.
 | // TODO: Hier auf zusätzliche Header, die das Programm erfordert, verweisen.
 | ||||||
|  |  | ||||||
|  | @ -1,47 +0,0 @@ | ||||||
|  |  | ||||||
| Microsoft Visual Studio Solution File, Format Version 12.00 |  | ||||||
| # Visual Studio 15 |  | ||||||
| VisualStudioVersion = 15.0.27703.2042 |  | ||||||
| MinimumVisualStudioVersion = 10.0.40219.1 |  | ||||||
| Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ScrapHack", "ScrapHack\ScrapHack.vcxproj", "{72CB1B9E-50C7-4010-BEAD-82FACF87A87A}" |  | ||||||
| EndProject |  | ||||||
| Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Injector", "Injector\Injector\Injector.vcxproj", "{7C91C225-D95C-4B7A-9251-0CE358BAF556}" |  | ||||||
| EndProject |  | ||||||
| Global |  | ||||||
| 	GlobalSection(SolutionConfigurationPlatforms) = preSolution |  | ||||||
| 		Debug|Any CPU = Debug|Any CPU |  | ||||||
| 		Debug|x64 = Debug|x64 |  | ||||||
| 		Debug|x86 = Debug|x86 |  | ||||||
| 		Release|Any CPU = Release|Any CPU |  | ||||||
| 		Release|x64 = Release|x64 |  | ||||||
| 		Release|x86 = Release|x86 |  | ||||||
| 	EndGlobalSection |  | ||||||
| 	GlobalSection(ProjectConfigurationPlatforms) = postSolution |  | ||||||
| 		{72CB1B9E-50C7-4010-BEAD-82FACF87A87A}.Debug|Any CPU.ActiveCfg = Debug|Win32 |  | ||||||
| 		{72CB1B9E-50C7-4010-BEAD-82FACF87A87A}.Debug|x64.ActiveCfg = Debug|x64 |  | ||||||
| 		{72CB1B9E-50C7-4010-BEAD-82FACF87A87A}.Debug|x64.Build.0 = Debug|x64 |  | ||||||
| 		{72CB1B9E-50C7-4010-BEAD-82FACF87A87A}.Debug|x86.ActiveCfg = Debug|Win32 |  | ||||||
| 		{72CB1B9E-50C7-4010-BEAD-82FACF87A87A}.Debug|x86.Build.0 = Debug|Win32 |  | ||||||
| 		{72CB1B9E-50C7-4010-BEAD-82FACF87A87A}.Release|Any CPU.ActiveCfg = Release|Win32 |  | ||||||
| 		{72CB1B9E-50C7-4010-BEAD-82FACF87A87A}.Release|x64.ActiveCfg = Release|x64 |  | ||||||
| 		{72CB1B9E-50C7-4010-BEAD-82FACF87A87A}.Release|x64.Build.0 = Release|x64 |  | ||||||
| 		{72CB1B9E-50C7-4010-BEAD-82FACF87A87A}.Release|x86.ActiveCfg = Release|Win32 |  | ||||||
| 		{72CB1B9E-50C7-4010-BEAD-82FACF87A87A}.Release|x86.Build.0 = Release|Win32 |  | ||||||
| 		{7C91C225-D95C-4B7A-9251-0CE358BAF556}.Debug|Any CPU.ActiveCfg = Debug|Win32 |  | ||||||
| 		{7C91C225-D95C-4B7A-9251-0CE358BAF556}.Debug|x64.ActiveCfg = Debug|x64 |  | ||||||
| 		{7C91C225-D95C-4B7A-9251-0CE358BAF556}.Debug|x64.Build.0 = Debug|x64 |  | ||||||
| 		{7C91C225-D95C-4B7A-9251-0CE358BAF556}.Debug|x86.ActiveCfg = Debug|Win32 |  | ||||||
| 		{7C91C225-D95C-4B7A-9251-0CE358BAF556}.Debug|x86.Build.0 = Debug|Win32 |  | ||||||
| 		{7C91C225-D95C-4B7A-9251-0CE358BAF556}.Release|Any CPU.ActiveCfg = Release|Win32 |  | ||||||
| 		{7C91C225-D95C-4B7A-9251-0CE358BAF556}.Release|x64.ActiveCfg = Release|x64 |  | ||||||
| 		{7C91C225-D95C-4B7A-9251-0CE358BAF556}.Release|x64.Build.0 = Release|x64 |  | ||||||
| 		{7C91C225-D95C-4B7A-9251-0CE358BAF556}.Release|x86.ActiveCfg = Release|Win32 |  | ||||||
| 		{7C91C225-D95C-4B7A-9251-0CE358BAF556}.Release|x86.Build.0 = Release|Win32 |  | ||||||
| 	EndGlobalSection |  | ||||||
| 	GlobalSection(SolutionProperties) = preSolution |  | ||||||
| 		HideSolutionNode = FALSE |  | ||||||
| 	EndGlobalSection |  | ||||||
| 	GlobalSection(ExtensibilityGlobals) = postSolution |  | ||||||
| 		SolutionGuid = {663B3F14-E592-447F-8F03-3210FE04AA89} |  | ||||||
| 	EndGlobalSection |  | ||||||
| EndGlobal |  | ||||||
										
											Binary file not shown.
										
									
								
							| Before Width: | Height: | Size: 807 KiB | 
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue