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 b157158 commit 53b7bb9
Show file tree
Hide file tree
Showing 16 changed files with 117 additions and 277 deletions.
26 changes: 12 additions & 14 deletions src/Config/Config.h
Original file line number Diff line number Diff line change
@@ -1,22 +1,20 @@
#pragma once

class Config
namespace Config
{
public:
class Patches
namespace Patches
{
public:
inline static DKUtil::Alias::Boolean bEnableLoadingEditorIDs{ "bEnableLoadingEditorIDs", "Patches" };
inline static DKUtil::Alias::Boolean bEnableEDIDConflictCheck{ "bEnableEDIDConflictCheck", "Patches" };
inline static DKUtil::Alias::String sBetaCommentFileName{ "sBetaCommentFileName", "Patches" };
};
static REX::INI::Bool bEnableLoadingEditorIDs{ "bEnableLoadingEditorIDs", "Patches", true };
static REX::INI::Bool bEnableEDIDConflictCheck{ "bEnableEDIDConflictCheck", "Patches", false };
static REX::INI::Str sBetaCommentFileName{ "sBetaCommentFileName", "Patches", "BetaComment.txt"s };
}

static void Load()
{
static auto Config = COMPILE_PROXY("BakaFramework.ini");
Config.Bind(Patches::bEnableLoadingEditorIDs, true);
Config.Bind(Patches::bEnableEDIDConflictCheck, false);
Config.Bind(Patches::sBetaCommentFileName, "BetaComment.txt");
Config.Load();
const auto ini = REX::INI::SettingStore::GetSingleton();
ini->Init(
"Data/F4SE/plugins/BakaFramework.ini",
"Data/F4SE/plugins/BakaFrameworkCustom.ini");
ini->Load();
}
};
}
2 changes: 1 addition & 1 deletion src/Events/Events.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ namespace Events
{
void Register()
{
DEBUG("Registering Event Handlers."sv);
F4SE::log::debug("Registering Event Handlers."sv);

RE::CurrentRadiationSourceCount::GetEventSource()->RegisterSink(Handlers::CurrentRadiationSourceCountHandler::GetSingleton());
RE::PipboyLightEvent::GetEventSource()->RegisterSink(Handlers::PipboyLightEventHandler::GetSingleton());
Expand Down
8 changes: 4 additions & 4 deletions src/Forms/Forms.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

namespace Forms
{
RE::BGSDefaultObject* InventoryWeight_DO{ nullptr };
RE::BGSDefaultObject* PipboyLightActive_DO{ nullptr };
RE::BGSDefaultObject* RadiationSourceCount_DO{ nullptr };
static RE::BGSDefaultObject* InventoryWeight_DO{ nullptr };
static RE::BGSDefaultObject* PipboyLightActive_DO{ nullptr };
static RE::BGSDefaultObject* RadiationSourceCount_DO{ nullptr };

void Install()
{
Expand All @@ -23,6 +23,6 @@ namespace Forms
"RadiationSourceCount_DO",
RE::ENUM_FORM_ID::kAVIF);

DEBUG("Injected DefaultObjects."sv);
F4SE::log::debug("Injected DefaultObjects."sv);
}
};
8 changes: 5 additions & 3 deletions src/Misc/Patches/LoadEditorIDs.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#pragma once

#include "Config/Config.h"

namespace Patches
{
class LoadEditorIDs
Expand Down Expand Up @@ -42,12 +44,12 @@ namespace Patches
const RE::BSAutoWriteLock locker{ lock.get() };
if (map)
{
if (*Config::Patches::bEnableEDIDConflictCheck)
if (Config::Patches::bEnableEDIDConflictCheck.GetValue())
{
auto iter = map->find(a_editorID);
if (iter != map->end())
{
WARN(
F4SE::log::warn(
"EditorID Conflict: {:08X} and {:08X} are both {:s}"sv,
iter->second->GetFormID(),
a_this->GetFormID(),
Expand Down Expand Up @@ -222,7 +224,7 @@ namespace Patches
InstallHook<RE::BGSLensFlare>();
InstallHook<RE::BGSGodRays>();

DEBUG("Installed Patch: LoadEditorIDs"sv);
F4SE::log::debug("Installed Patch: LoadEditorIDs"sv);
}
};
}
140 changes: 1 addition & 139 deletions src/PCH.h
Original file line number Diff line number Diff line change
@@ -1,145 +1,7 @@
#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 GetComputerName
#undef GetForm
#include "REX/REX/INI.h"

using namespace std::literals;

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

// Plugin
#include "Plugin.h"

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

// Config
#include "Config/Config.h"

// Extras
#include <fmt/chrono.h>

// 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;
}();
Loading

0 comments on commit 53b7bb9

Please sign in to comment.