Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,9 @@ Mod Config UI is a mod for `Company of Heroes Relaunch` built on top of `CoHModS

1. Install the `CoHModSDK` loader in your game directory
2. Copy `ModConfigUI.dll` into the `mods` folder
3. Add `ModConfigUI.dll` to `CoHModSDKLoader.ini`
4. Start the game
3. Copy `data\modconfigui` into `ModSDK\data\modconfigui`
4. Add `ModConfigUI.dll` to `CoHModSDKLoader.ini`
5. Start the game

## 🛠️ Building

Expand Down
8 changes: 4 additions & 4 deletions res/resource.rc
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,8 @@ LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
//

VS_VERSION_INFO VERSIONINFO
FILEVERSION 0,2,0,0
PRODUCTVERSION 0,2,0,0
FILEVERSION 0,2,1,0
PRODUCTVERSION 0,2,1,0
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS 0x1L
Expand All @@ -79,12 +79,12 @@ BEGIN
BEGIN
VALUE "CompanyName", "Tosox"
VALUE "FileDescription", "Adds an ingame menu for mod settings configuration"
VALUE "FileVersion", "0.2.0"
VALUE "FileVersion", "0.2.1"
VALUE "InternalName", "ModConfigUI"
VALUE "LegalCopyright", "Copyright © 2026"
VALUE "OriginalFilename", "ModConfigUI.dll"
VALUE "ProductName", "ModConfigUI"
VALUE "ProductVersion", "0.2.0"
VALUE "ProductVersion", "0.2.1"
END
END
BLOCK "VarFileInfo"
Expand Down
2 changes: 1 addition & 1 deletion src/ModConfigUI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
namespace {
constexpr char kModId[] = "de.tosox.modconfigui";
constexpr char kModName[] = "Mod Config UI";
constexpr char kModVersion[] = "0.1.0";
constexpr char kModVersion[] = "0.2.1";
constexpr char kModAuthor[] = "Tosox";
constexpr char kTestCategory[] = "UI Test";

Expand Down
24 changes: 10 additions & 14 deletions src/UiInterop.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
#include <cmath>
#include <cstddef>
#include <cstdint>
#include <filesystem>
#include <string>
#include <string_view>

Expand All @@ -31,8 +32,7 @@ namespace ConfigUi::Frontend {
constexpr int kStreamModeRead = 1;
constexpr char kFileOverrideAlias[] = "DATA";
constexpr char kFileOverrideSubPath[] = "";
constexpr wchar_t kScreenFileRelativeDir[] = L"mods\\cohmodconfigui_data\\";
constexpr char kScreenFileName[] = "cohmodconfigui";
constexpr char kScreenDataRelativeDir[] = "data\\modconfigui\\";

using FilePathHDCreateFn = void* (__stdcall*)(const wchar_t* path, int streamMode);
using FilePathAddAliasFn = bool(__stdcall*)(const char* alias, const char* subPath, long priority, void* source);
Expand All @@ -49,7 +49,7 @@ namespace ConfigUi::Frontend {
constexpr char kCheckButtonWidgetTypeName[] = "CheckButton";
constexpr char kTextLabelWidgetTypeName[] = "TextLabel";
constexpr char kScrollBarWidgetTypeName[] = "ScrollBar";
constexpr char kScreenName[] = "cohmodconfigui";
constexpr char kScreenName[] = "modconfigui";
constexpr char kTemplateScreenName[] = "prompt_performance_test";
constexpr char kTemplatePanelWidgetName[] = "perfGrp";
constexpr char kTemplateLabelWidgetName[] = "minimumResults";
Expand Down Expand Up @@ -1496,21 +1496,17 @@ namespace ConfigUi::Frontend {
return false;
}

// Build absolute path to our data directory next to the game executable.
wchar_t gameDir[MAX_PATH] = {};
const DWORD len = GetModuleFileNameW(nullptr, gameDir, MAX_PATH);
if ((len == 0u) || (len >= MAX_PATH)) {
LogError("Mod Config UI could not determine the game directory.");
const CoHModSDKRuntimeInfoV1* runtimeInfo = ModSDK::Runtime::GetInfo();
if ((runtimeInfo == nullptr) || (runtimeInfo->loaderDirectory == nullptr) || (*runtimeInfo->loaderDirectory == '\0')) {
LogError("Mod Config UI could not determine the SDK directory.");
return false;
}

// Strip executable name to get directory.
wchar_t* lastSlash = wcsrchr(gameDir, L'\\');
if (lastSlash != nullptr) {
*(lastSlash + 1) = L'\0';
std::filesystem::path dataPath = std::filesystem::path(runtimeInfo->loaderDirectory) / kScreenDataRelativeDir;
std::wstring dataDir = dataPath.wstring();
if (!dataDir.empty() && (dataDir.back() != L'\\') && (dataDir.back() != L'/')) {
dataDir.push_back(L'\\');
}

std::wstring dataDir = std::wstring(gameDir) + kScreenFileRelativeDir;
{
std::string narrowDir(dataDir.size(), '\0');
for (size_t i = 0; i < dataDir.size(); ++i) narrowDir[i] = static_cast<char>(dataDir[i]);
Expand Down
Loading