diff --git a/Base/Logger.h b/Base/Logger.h new file mode 100644 index 0000000..32a20eb --- /dev/null +++ b/Base/Logger.h @@ -0,0 +1,14 @@ +#pragma once +#include +#include +#include + +class Logger { +public: + static void Log(const std::string& message) { + std::ofstream logFile("F4MP.log", std::ios_base::app); + if (logFile.is_open()) { + logFile << "[LOG] " << message << std::endl; + } + } +}; \ No newline at end of file diff --git a/Client/F4MP/.vs/F4MP.slnx/FileContentIndex/9a29383e-7082-4841-845e-cee6cba907a8.vsidx b/Client/F4MP/.vs/F4MP.slnx/FileContentIndex/9a29383e-7082-4841-845e-cee6cba907a8.vsidx new file mode 100644 index 0000000..fd62abf Binary files /dev/null and b/Client/F4MP/.vs/F4MP.slnx/FileContentIndex/9a29383e-7082-4841-845e-cee6cba907a8.vsidx differ diff --git a/Client/F4MP/.vs/F4MP_Client.slnx/v18/.suo b/Client/F4MP/.vs/F4MP_Client.slnx/v18/.suo new file mode 100644 index 0000000..576b1b9 Binary files /dev/null and b/Client/F4MP/.vs/F4MP_Client.slnx/v18/.suo differ diff --git a/Client/F4MP/.vs/F4MP_Client.slnx/v18/Browse.VC.db b/Client/F4MP/.vs/F4MP_Client.slnx/v18/Browse.VC.db new file mode 100644 index 0000000..74e530c Binary files /dev/null and b/Client/F4MP/.vs/F4MP_Client.slnx/v18/Browse.VC.db differ diff --git a/Client/F4MP/.vs/F4MP_Client.slnx/v18/DocumentLayout.backup.json b/Client/F4MP/.vs/F4MP_Client.slnx/v18/DocumentLayout.backup.json new file mode 100644 index 0000000..93aaf3e --- /dev/null +++ b/Client/F4MP/.vs/F4MP_Client.slnx/v18/DocumentLayout.backup.json @@ -0,0 +1,12 @@ +{ + "Version": 1, + "WorkspaceRootPath": "C:\\Users\\Jous\\Documents\\GitHub\\F4MP\\Client\\F4MP\\", + "Documents": [], + "DocumentGroupContainers": [ + { + "Orientation": 0, + "VerticalTabListWidth": 256, + "DocumentGroups": [] + } + ] +} \ No newline at end of file diff --git a/Client/F4MP/.vs/F4MP_Client.slnx/v18/DocumentLayout.json b/Client/F4MP/.vs/F4MP_Client.slnx/v18/DocumentLayout.json new file mode 100644 index 0000000..93aaf3e --- /dev/null +++ b/Client/F4MP/.vs/F4MP_Client.slnx/v18/DocumentLayout.json @@ -0,0 +1,12 @@ +{ + "Version": 1, + "WorkspaceRootPath": "C:\\Users\\Jous\\Documents\\GitHub\\F4MP\\Client\\F4MP\\", + "Documents": [], + "DocumentGroupContainers": [ + { + "Orientation": 0, + "VerticalTabListWidth": 256, + "DocumentGroups": [] + } + ] +} \ No newline at end of file diff --git a/Client/F4MP/.vs/F4MP_Client/v18/Solution.VC.db b/Client/F4MP/.vs/F4MP_Client/v18/Solution.VC.db new file mode 100644 index 0000000..afd51f5 Binary files /dev/null and b/Client/F4MP/.vs/F4MP_Client/v18/Solution.VC.db differ diff --git a/Client/F4MP/F4MP/F4MP.vcxproj b/Client/F4MP/F4MP/F4MP.vcxproj new file mode 100644 index 0000000..7eb1497 --- /dev/null +++ b/Client/F4MP/F4MP/F4MP.vcxproj @@ -0,0 +1,138 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + Debug + x64 + + + Release + x64 + + + + + 18.0 + Win32Proj + {6c0b99e5-5442-44c5-b2b7-11a2f34661e2} + F4MP + 10.0 + + + + Application + true + v145 + Unicode + + + Application + false + v145 + true + Unicode + + + Application + true + v145 + Unicode + + + Application + false + v145 + true + Unicode + + + + + + + + + + + + + + + + + + + + + + + + + Level3 + true + WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + stdcpp20 + + + Console + true + + + + + Level3 + true + true + true + WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + stdcpp20 + + + Console + true + + + + + Level3 + true + _DEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + stdcpp20 + + + Console + true + + + + + Level3 + true + true + true + NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + stdcpp20 + + + Console + true + + + + + + + + diff --git a/Client/F4MP/F4MP/F4MP.vcxproj.filters b/Client/F4MP/F4MP/F4MP.vcxproj.filters new file mode 100644 index 0000000..e98a8c3 --- /dev/null +++ b/Client/F4MP/F4MP/F4MP.vcxproj.filters @@ -0,0 +1,17 @@ + + + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd + + + {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} + rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms + + + \ No newline at end of file diff --git a/Client/F4MP/F4MP/F4MP.vcxproj.user b/Client/F4MP/F4MP/F4MP.vcxproj.user new file mode 100644 index 0000000..88a5509 --- /dev/null +++ b/Client/F4MP/F4MP/F4MP.vcxproj.user @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/Client/F4MP/F4MP_Client.slnx b/Client/F4MP/F4MP_Client.slnx new file mode 100644 index 0000000..35e27fe --- /dev/null +++ b/Client/F4MP/F4MP_Client.slnx @@ -0,0 +1,7 @@ + + + + + + + diff --git a/Client/main.cpp b/Client/main.cpp index 52d6f88..232c80c 100644 --- a/Client/main.cpp +++ b/Client/main.cpp @@ -1 +1,84 @@ -// C¢digo del Cliente (DLL) +#include +#include +#include +#include +#include "../Base/Logger.h" +#include "../Base/Protocol.h" + +// --- UTILIDAD DE ESCANEO DE PATRONES (Para Next-Gen) --- +namespace Scanner { + uintptr_t FindPattern(const char* signature) { + static auto pattern_to_byte = [](const char* pattern) { + auto bytes = std::vector{}; + auto start = const_cast(pattern); + auto end = const_cast(pattern) + strlen(pattern); + for (auto current = start; current < end; ++current) { + if (*current == '?') { + ++current; + if (*current == '?') ++current; + bytes.push_back(-1); + } else { + bytes.push_back(strtoul(current, ¤t, 16)); + } + } + return bytes; + }; + + uintptr_t base = (uintptr_t)GetModuleHandle(NULL); + IMAGE_NT_HEADERS* ntHeaders = (IMAGE_NT_HEADERS*)(base + ((IMAGE_DOS_HEADER*)base)->e_lfanew); + DWORD size = ntHeaders->OptionalHeader.SizeOfImage; + auto patternBytes = pattern_to_byte(signature); + uint8_t* scanBytes = reinterpret_cast(base); + + for (unsigned long i = 0; i < size - patternBytes.size(); ++i) { + bool found = true; + for (unsigned long j = 0; j < patternBytes.size(); ++j) { + if (scanBytes[i + j] != patternBytes[j] && patternBytes[j] != -1) { + found = false; + break; + } + } + if (found) return reinterpret_cast(&scanBytes[i]); + } + return 0; + } +} + +// --- LÓGICA PRINCIPAL --- +void InitializeF4MP() { + Logger::Log("F4MP: Buscando Singleton del Jugador (Next-Gen)..."); + + // Este es un ejemplo de un patrón para encontrar el Player Singleton en Next-Gen + // Nota: El patrón real puede variar según el parche, pero esta es la técnica correcta. + uintptr_t playerAddr = Scanner::FindPattern("48 8B 05 ? ? ? ? 48 8B D1 48 8b 48 08"); + + if (playerAddr) { + Logger::Log("F4MP: Patron encontrado en: " + std::to_string(playerAddr)); + // Aquí seguiría la lógica para calcular el offset relativo (RIP-relative) + } else { + Logger::Log("F4MP: No se pudo encontrar el patron del jugador."); + } +} + +DWORD WINAPI MainThread(LPVOID lpParam) { + Logger::Log("=== F4MP CLIENTE CARGADO ==="); + + InitializeF4MP(); + + // Bucle para mantener la DLL viva. Pulsa FIN para descargarla. + while (!(GetAsyncKeyState(VK_END) & 0x8000)) { + Sleep(500); + } + + Logger::Log("F4MP: Descargando..."); + FreeLibraryAndExitThread((HMODULE)lpParam, 0); + return 0; +} + +BOOL APIENTRY DllMain(HMODULE hModule, DWORD ul_reason_for_call, LPVOID lpReserved) { + if (ul_reason_for_call == DLL_PROCESS_ATTACH) { + DisableThreadLibraryCalls(hModule); + CreateThread(NULL, 0, MainThread, hModule, 0, NULL); + } + return TRUE; +} \ No newline at end of file