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 bbfae33 commit 2457168
Show file tree
Hide file tree
Showing 5 changed files with 44 additions and 147 deletions.
6 changes: 3 additions & 3 deletions src/Menus/LevelUpMenu.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ namespace Menus
RE::UI_MENU_FLAGS::kUsesBlurredBackground,
RE::UI_MENU_FLAGS::kUsesMovementToDirection);
menuHUDMode = "SpecialMode";
depthPriority.set(RE::UI_DEPTH_PRIORITY::kTerminal);
depthPriority = RE::UI_DEPTH_PRIORITY::kTerminal;

const auto ScaleformManager = RE::BSScaleformManager::GetSingleton();
[[maybe_unused]] const auto LoadMovieSuccess =
Expand Down Expand Up @@ -255,8 +255,8 @@ namespace Menus
if (auto PlayerCharacter = RE::PlayerCharacter::GetSingleton())
{
auto level = PlayerCharacter->GetLevel();
HeaderText = IsNewLevel ? fmt::format(fmt::runtime(Translations::Formatting::LevelUpText.data()), level)
: Translations::Formatting::PerkMenu.data();
HeaderText = IsNewLevel ? std::vformat(Translations::Formatting::LevelUpText, std::make_format_args(level))
: Translations::Formatting::PerkMenu;
IsNewLevel = false;

RE::Scaleform::GFx::Value Header[1];
Expand Down
77 changes: 40 additions & 37 deletions src/Menus/PerkManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,44 +28,41 @@ namespace Menus
break;
}

auto avName = actorValue->GetFullName();
auto compareValue = a_condition->GetComparisonValue();
switch (a_condition->data.condition)
{
case RE::ENUM_COMPARISON_CONDITION::kEqual:
_conditionText = fmt::format(
fmt::runtime(Translations::Formatting::Equal.data()),
actorValue->GetFullName(),
compareValue);
_conditionText = std::vformat(
Translations::Formatting::Equal,
std::make_format_args(avName, compareValue));
break;
case RE::ENUM_COMPARISON_CONDITION::kNotEqual:
_conditionText = fmt::format(
fmt::runtime(Translations::Formatting::NotEqual.data()),
actorValue->GetFullName(),
compareValue);
_conditionText = std::vformat(
Translations::Formatting::NotEqual,
std::make_format_args(avName, compareValue));
break;
case RE::ENUM_COMPARISON_CONDITION::kGreaterThan:
_conditionText = fmt::format(
fmt::runtime(Translations::Formatting::Greater.data()),
actorValue->GetFullName(),
compareValue + 1.0F);
compareValue += 1.0f;
_conditionText = std::vformat(
Translations::Formatting::Greater,
std::make_format_args(avName, compareValue));
break;
case RE::ENUM_COMPARISON_CONDITION::kGreaterThanEqual:
_conditionText = fmt::format(
fmt::runtime(Translations::Formatting::GreaterEqual.data()),
actorValue->GetFullName(),
compareValue);
_conditionText = std::vformat(
Translations::Formatting::GreaterEqual,
std::make_format_args(avName, compareValue));
break;
case RE::ENUM_COMPARISON_CONDITION::kLessThan:
_conditionText = fmt::format(
fmt::runtime(Translations::Formatting::Less.data()),
actorValue->GetFullName(),
compareValue);
_conditionText = std::vformat(
Translations::Formatting::Less,
std::make_format_args(avName, compareValue));
break;
case RE::ENUM_COMPARISON_CONDITION::kLessThanEqual:
_conditionText = fmt::format(
fmt::runtime(Translations::Formatting::LessEqual.data()),
actorValue->GetFullName(),
compareValue + 1.0F);
compareValue += 1.0f;
_conditionText = std::vformat(
Translations::Formatting::LessEqual,
std::make_format_args(avName, compareValue));
break;
default:
_isValid = false;
Expand Down Expand Up @@ -107,11 +104,17 @@ namespace Menus
switch (a_condition->data.condition)
{
case RE::ENUM_COMPARISON_CONDITION::kEqual:
_conditionText = fmt::format(fmt::runtime(Translations::Formatting::HasPerk.data()), perk->GetFullName());
{
auto perkName = perk->GetFullName();
_conditionText = std::vformat(Translations::Formatting::HasPerk, std::make_format_args(perkName));
break;
}
case RE::ENUM_COMPARISON_CONDITION::kNotEqual:
_conditionText = fmt::format(fmt::runtime(Translations::Formatting::NotPerk.data()), perk->GetFullName());
{
auto perkName = perk->GetFullName();
_conditionText = std::vformat(Translations::Formatting::NotPerk, std::make_format_args(perkName));
break;
}
default:
_isValid = false;
break;
Expand Down Expand Up @@ -270,8 +273,8 @@ namespace Menus

auto refrLevel = RE::PlayerCharacter::GetSingleton()->GetLevel();

std::string levelText = fmt::format(fmt::runtime(Translations::Formatting::Level.data()), _perkLevel);
std::string ranksText = fmt::format(fmt::runtime(Translations::Formatting::Ranks.data()), _perk->data.numRanks);
std::string levelText = std::vformat(Translations::Formatting::Level, std::make_format_args(_perkLevel));
std::string ranksText = std::vformat(Translations::Formatting::Ranks, std::make_format_args(_perk->data.numRanks));
if (refrLevel < _perkLevel)
{
levelText = ErrorTag(levelText);
Expand All @@ -285,18 +288,18 @@ namespace Menus
levelText = "--";
}

std::string reqsText = fmt::format(fmt::runtime(Translations::Formatting::Reqs.data()), levelText);
_conditionText = fmt::format(
FMT_STRING("{:s}<br>{:s}<br><br>{:s}"sv),
std::string reqsText = std::vformat(Translations::Formatting::Reqs, std::make_format_args(levelText));
_conditionText = std::format(
"{:s}<br>{:s}<br><br>{:s}"sv,
reqsText,
ranksText,
GetDescription());
}
else
{
std::string reqsText = fmt::format(fmt::runtime(Translations::Formatting::Reqs.data()), levelText);
_conditionText = fmt::format(
FMT_STRING("{:s}, {:s}<br>{:s}<br><br>{:s}"sv),
std::string reqsText = std::vformat(Translations::Formatting::Reqs, std::make_format_args(levelText));
_conditionText = std::format(
"{:s}, {:s}<br>{:s}<br><br>{:s}"sv,
reqsText,
perkConditions.GetConditionText(),
ranksText,
Expand Down Expand Up @@ -383,7 +386,7 @@ namespace Menus
auto IsValidPath = [](const std::string& a_path)
{
RE::BSTSmartPointer<RE::BSResource::Stream> stream{ nullptr };
auto relativePath = fmt::format(FMT_STRING("Interface\\{:s}"sv), a_path);
auto relativePath = std::format("Interface\\{:s}"sv, a_path);
return (RE::BSResource::GetOrCreateStream(relativePath.c_str(), stream) == RE::BSResource::ErrorCode::kNone);
};

Expand All @@ -395,7 +398,7 @@ namespace Menus
continue;
}

auto formattedPath = fmt::format(FMT_STRING("Components\\VaultBoys\\Perks\\PerkClip_{:x}.swf"sv), _perkChain[i]->formID);
auto formattedPath = std::format("Components\\VaultBoys\\Perks\\PerkClip_{:x}.swf"sv, _perkChain[i]->formID);
if (IsValidPath(formattedPath))
{
_perkChain[i].SetPerkIcon(formattedPath);
Expand Down Expand Up @@ -488,7 +491,7 @@ namespace Menus
private:
static std::string ErrorTag(std::string_view a_string)
{
return fmt::format(FMT_STRING("<font color=\'#888888\'>{:s}</font>"sv), a_string);
return std::format("<font color=\'#888888\'>{:s}</font>"sv, a_string);
}

RE::BGSPerk* GetFirstPerkInChain(RE::BGSPerk* a_perk)
Expand Down
37 changes: 0 additions & 37 deletions src/PCH.cpp

This file was deleted.

25 changes: 1 addition & 24 deletions src/PCH.h
Original file line number Diff line number Diff line change
@@ -1,29 +1,6 @@
#pragma once

#define WIN32_LEAN_AND_MEAN
#define NOMINMAX
#pragma once

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

#include <AutoTOML.hpp>
#include <spdlog/sinks/basic_file_sink.h>
#include <xbyak/xbyak.h>

#define DLLEXPORT __declspec(dllexport)

using namespace std::literals;

namespace logger = F4SE::log;

namespace stl
{
using namespace F4SE::stl;

void asm_replace(std::uintptr_t a_from, std::size_t a_size, std::uintptr_t a_to);
}

// clang-format off
#include "Version.h"
#include "Settings.h"
// clang-format on
46 changes: 0 additions & 46 deletions src/Settings.h

This file was deleted.

0 comments on commit 2457168

Please sign in to comment.