- Options window in three tabs; the auto-pickup settings move to Beute; sliders move with their page; black sides like the save game screen. - Tastenbelegung: every binding settable (click, press key; Esc cancels, Backspace unbinds), "Alle zurücksetzen" as a game button, saved on OK. - Potions bindable (default unbound), named by the game's potion texts; the game's own potion hotkeys are off; bar tooltips show the bound key. - Map (M), overview map (Tab, held) and labels (Alt, held) bindable; the game's own M / Tab / Alt handling is switched off. - Save game key calls the game's save window code instead of a posted key. - Teleportationstrank: fixed text replacement from startup (also the Ausdauertrank items, potion kind 5 as well). Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
60 lines
1.5 KiB
C++
60 lines
1.5 KiB
C++
#include "re/config.h"
|
|
|
|
#include <cstring>
|
|
#include <iterator>
|
|
|
|
#include <windows.h>
|
|
|
|
namespace re {
|
|
namespace {
|
|
|
|
std::wstring g_path;
|
|
|
|
std::wstring Widen(const char* s) {
|
|
return std::wstring(s, s + strlen(s));
|
|
}
|
|
|
|
} // namespace
|
|
|
|
void SetConfigPath(const std::wstring& path) {
|
|
g_path = path;
|
|
}
|
|
|
|
const std::wstring& ConfigPath() {
|
|
return g_path;
|
|
}
|
|
|
|
std::wstring ModuleDirectory() {
|
|
return g_path.substr(0, g_path.find_last_of(L"\\/") + 1);
|
|
}
|
|
|
|
int ConfigInt(const char* section, const char* key, int fallback) {
|
|
if (g_path.empty()) {
|
|
return fallback;
|
|
}
|
|
return static_cast<int>(GetPrivateProfileIntW(Widen(section).c_str(), Widen(key).c_str(), fallback, g_path.c_str()));
|
|
}
|
|
|
|
std::string ConfigString(const char* section, const char* key, const char* fallback) {
|
|
if (g_path.empty()) {
|
|
return fallback;
|
|
}
|
|
wchar_t value[256];
|
|
GetPrivateProfileStringW(Widen(section).c_str(), Widen(key).c_str(), Widen(fallback).c_str(), value,
|
|
static_cast<DWORD>(std::size(value)), g_path.c_str());
|
|
char narrow[256];
|
|
WideCharToMultiByte(CP_UTF8, 0, value, -1, narrow, sizeof(narrow), nullptr, nullptr);
|
|
return narrow;
|
|
}
|
|
|
|
void SetConfigString(const char* section, const char* key, const char* value) {
|
|
if (g_path.empty()) {
|
|
return;
|
|
}
|
|
wchar_t wide[256];
|
|
MultiByteToWideChar(CP_UTF8, 0, value, -1, wide, static_cast<int>(std::size(wide)));
|
|
WritePrivateProfileStringW(Widen(section).c_str(), Widen(key).c_str(), wide, g_path.c_str());
|
|
}
|
|
|
|
} // namespace re
|