mirror of
https://github.com/Jous99/F4MP.git
synced 2026-01-12 10:40:53 +01:00
crear el dll funcional
This commit is contained in:
parent
265cf6d877
commit
0722cd4191
1 changed files with 28 additions and 31 deletions
|
|
@ -1,39 +1,36 @@
|
||||||
#include <windows.h>
|
#include "f4se/PluginAPI.h"
|
||||||
#include "../Base/Logger.h"
|
#include <shlobj.h>
|
||||||
|
|
||||||
|
// Información del Mod
|
||||||
|
IDebugLog gLog;
|
||||||
|
PluginHandle g_pluginHandle = kPluginHandle_Invalid;
|
||||||
|
F4SEMessagingInterface* g_messaging = NULL;
|
||||||
|
|
||||||
// Forzamos que estas funciones sean visibles para F4SE
|
|
||||||
extern "C" {
|
extern "C" {
|
||||||
// 1. Identificación del plugin
|
// Esta función la llama F4SE al arrancar para ver si el mod es compatible
|
||||||
__declspec(dllexport) bool F4SEPlugin_Query(const void* f4se, void* info) {
|
bool F4SEPlugin_Query(const F4SEInterface* f4se, PluginInfo* info) {
|
||||||
Logger::Log("F4MP: Query recibido.");
|
gLog.OpenRelative(CSIDL_MYDOCUMENTS, "\\My Games\\Fallout4\\F4SE\\F4MP_Project.log");
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
// 2. Carga del plugin
|
// Datos del mod
|
||||||
__declspec(dllexport) bool F4SEPlugin_Load(const void* f4se) {
|
info->infoVersion = PluginInfo::kInfoVersion;
|
||||||
Logger::Log("F4MP: Cargando hilos...");
|
info->name = "F4MP_Project";
|
||||||
|
info->version = 1;
|
||||||
|
|
||||||
// Creamos el hilo usando una función básica de Windows
|
if (f4se->runtimeVersion != RUNTIME_VERSION_1_10_163) {
|
||||||
CreateThread(NULL, 0, [](LPVOID) -> DWORD {
|
_MESSAGE("ERROR: Version de juego no compatible.");
|
||||||
Logger::Log("F4MP: Hilo principal en ejecucion.");
|
return false;
|
||||||
|
}
|
||||||
while (true) {
|
|
||||||
if (GetAsyncKeyState(VK_END) & 0x8000) break;
|
|
||||||
Sleep(100);
|
|
||||||
}
|
|
||||||
|
|
||||||
Logger::Log("F4MP: Hilo cerrado.");
|
|
||||||
return 0;
|
|
||||||
}, NULL, 0, NULL);
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// Punto de entrada de la DLL
|
// Esta función se ejecuta cuando el mod se carga oficialmente
|
||||||
BOOL APIENTRY DllMain(HMODULE hModule, DWORD ul_reason_for_call, LPVOID lpReserved) {
|
bool F4SEPlugin_Load(const F4SEInterface* f4se) {
|
||||||
if (ul_reason_for_call == DLL_PROCESS_ATTACH) {
|
_MESSAGE("F4MP: Protocolo de terminal cargado correctamente.");
|
||||||
DisableThreadLibraryCalls(hModule);
|
|
||||||
|
g_pluginHandle = f4se->GetPluginHandle();
|
||||||
|
|
||||||
|
// Aquí es donde en el futuro "engancharemos" los datos
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
return TRUE;
|
};
|
||||||
}
|
|
||||||
Loading…
Reference in a new issue