F4MP/Client/main.cpp

39 lines
1.1 KiB
C++
Raw Normal View History

#include <windows.h>
#include "../Base/Logger.h"
2026-01-06 19:58:58 +01:00
// Forzamos que estas funciones sean visibles para F4SE
extern "C" {
// 1. Identificaci<63>n del plugin
__declspec(dllexport) bool F4SEPlugin_Query(const void* f4se, void* info) {
Logger::Log("F4MP: Query recibido.");
return true;
}
2026-01-06 19:58:58 +01:00
// 2. Carga del plugin
__declspec(dllexport) bool F4SEPlugin_Load(const void* f4se) {
Logger::Log("F4MP: Cargando hilos...");
// Creamos el hilo usando una funci<63>n b<>sica de Windows
CreateThread(NULL, 0, [](LPVOID) -> DWORD {
Logger::Log("F4MP: Hilo principal en ejecucion.");
while (true) {
if (GetAsyncKeyState(VK_END) & 0x8000) break;
Sleep(100);
}
Logger::Log("F4MP: Hilo cerrado.");
return 0;
}, NULL, 0, NULL);
2026-01-06 19:58:58 +01:00
return true;
}
}
2026-01-06 19:58:58 +01:00
// Punto de entrada de la DLL
BOOL APIENTRY DllMain(HMODULE hModule, DWORD ul_reason_for_call, LPVOID lpReserved) {
if (ul_reason_for_call == DLL_PROCESS_ATTACH) {
DisableThreadLibraryCalls(hModule);
}
return TRUE;
}