Skip to content

Commit

Permalink
refactor: wip xmake work
Browse files Browse the repository at this point in the history
  • Loading branch information
shad0wshayd3 committed Nov 21, 2024
1 parent 34fa686 commit 472fb62
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 163 deletions.
2 changes: 1 addition & 1 deletion src/Forms/Forms.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class Forms
"BWA_bOverrideTakingRadDamage_DO",
RE::ENUM_FORM_ID::kGLOB);

DEBUG("Injected DefaultObjects"sv);
F4SE::log::debug("Injected DefaultObjects"sv);
}

// members
Expand Down
133 changes: 1 addition & 132 deletions src/PCH.h
Original file line number Diff line number Diff line change
@@ -1,137 +1,6 @@
#pragma once
#pragma once

// c
#include <cassert>
#include <cctype>
#include <cerrno>
#include <cfenv>
#include <cfloat>
#include <cinttypes>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdint>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <cuchar>
#include <cwchar>
#include <cwctype>

// cxx
#include <algorithm>
#include <any>
#include <array>
#include <atomic>
#include <barrier>
#include <bit>
#include <bitset>
#include <charconv>
#include <chrono>
#include <compare>
#include <complex>
#include <concepts>
#include <condition_variable>
#include <deque>
#include <exception>
#include <execution>
#include <filesystem>
#include <format>
#include <forward_list>
#include <fstream>
#include <functional>
#include <future>
#include <initializer_list>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <latch>
#include <limits>
#include <locale>
#include <map>
#include <memory>
#include <memory_resource>
#include <mutex>
#include <new>
#include <numbers>
#include <numeric>
#include <optional>
#include <ostream>
#include <queue>
#include <random>
#include <ranges>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <semaphore>
#include <set>
#include <shared_mutex>
#include <source_location>
#include <span>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <string_view>
#include <syncstream>
#include <system_error>
#include <thread>
#include <tuple>
#include <type_traits>
#include <typeindex>
#include <typeinfo>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <valarray>
#include <variant>
#include <vector>
#include <version>

// Clib
#include "F4SE/F4SE.h"
#include "RE/Fallout.h"

// winnt
#include <ShlObj_core.h>

#undef min
#undef max
#undef GetForm

using namespace std::literals;

#define DLLEXPORT extern "C" [[maybe_unused]] __declspec(dllexport)

// Plugin
#include "Plugin.h"

// DKUtil
#include "DKUtil/Hook.hpp"
#include "DKUtil/Logger.hpp"

// F4SEPlugin_Version
DLLEXPORT constinit auto F4SEPlugin_Version = []() noexcept
{
F4SE::PluginVersionData data{};

data.PluginVersion(Plugin::Version);
data.PluginName(Plugin::NAME);
data.AuthorName(Plugin::AUTHOR);
data.UsesAddressLibrary(true);
data.UsesSigScanning(false);
data.IsLayoutDependent(true);
data.HasNoStructUse(false);
data.CompatibleVersions({ F4SE::RUNTIME_LATEST });

return data;
}();
2 changes: 1 addition & 1 deletion src/Scripts/Papyrus/BakaWaitAnywhere.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ namespace WaitAnywhere

if (!PlayerCharacter || !ProcessLists || !SynchedAnimManager)
{
WARN("WaitAnywhere::CanPassTime: Failed to GetSingleton."sv);
F4SE::log::warn("WaitAnywhere::CanPassTime: Failed to GetSingleton."sv);
RE::SendHUDMessage::ShowHUDMessage(
sNoWaitDefault->GetString().data(),
"UIMenuCancel",
Expand Down
33 changes: 4 additions & 29 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,8 @@

namespace
{
void MessageHandler(F4SE::MessagingInterface::Message* a_msg)
void MessageCallback(F4SE::MessagingInterface::Message* a_msg)
{
if (!a_msg)
{
return;
}

switch (a_msg->type)
{
case F4SE::MessagingInterface::kPostLoad:
Expand All @@ -23,32 +18,12 @@ namespace
}
}

DLLEXPORT bool F4SEAPI F4SEPlugin_Load(const F4SE::LoadInterface* a_F4SE)
F4SEPluginLoad(const F4SE::LoadInterface* a_F4SE)
{
#ifndef NDEBUG
MessageBoxA(NULL, "Loaded. You can now attach the debugger or continue execution.", Plugin::NAME.data(), NULL);
#endif

F4SE::Init(a_F4SE);

DKUtil::Logger::Init(Plugin::NAME, std::to_string(Plugin::Version));
INFO("{} v{} loaded."sv, Plugin::NAME, Plugin::Version);

const auto messaging = F4SE::GetMessagingInterface();
if (!messaging || !messaging->RegisterListener(MessageHandler))
{
FATAL("Failed to register messaging handler, marking as incompatible."sv);
return false;
}

const auto papyrus = F4SE::GetPapyrusInterface();
if (!papyrus || !papyrus->Register(Papyrus::RegisterFunctions))
{
FATAL("Failed to register Papyrus functions, marking as incompatible."sv);
return false;
}

INFO("Plugin loaded successfully."sv);
F4SE::GetMessagingInterface()->RegisterListener(MessageCallback);
F4SE::GetPapyrusInterface()->Register(Papyrus::RegisterFunctions);

return true;
}

0 comments on commit 472fb62

Please sign in to comment.