mirror of https://github.com/AxioDL/metaforce.git
Add imgui settings back using FileStoreManager to get the path
This commit is contained in:
parent
b305454199
commit
fcda2eb261
|
@ -102,6 +102,8 @@ public:
|
||||||
|
|
||||||
void parseCommandLine(const std::vector<std::string>& args);
|
void parseCommandLine(const std::vector<std::string>& args);
|
||||||
|
|
||||||
|
FileStoreManager& fileStoreManager() { return m_store; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool suppressDeveloper();
|
bool suppressDeveloper();
|
||||||
void restoreDeveloper(bool oldDeveloper);
|
void restoreDeveloper(bool oldDeveloper);
|
||||||
|
|
|
@ -17,9 +17,17 @@ using namespace Windows::Storage;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
namespace metaforce {
|
namespace metaforce {
|
||||||
|
namespace {
|
||||||
static logvisor::Module Log("FileStoreManager");
|
static logvisor::Module Log("FileStoreManager");
|
||||||
|
FileStoreManager* g_instance = nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
FileStoreManager::FileStoreManager(std::string_view org, std::string_view domain) : m_org(org), m_domain(domain) {
|
FileStoreManager::FileStoreManager(std::string_view org, std::string_view domain) : m_org(org), m_domain(domain) {
|
||||||
|
if (g_instance == this) {
|
||||||
|
Log.report(logvisor::Fatal, FMT_STRING("Attempting to build another FileStoreManager!!"));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
auto prefPath = SDL_GetPrefPath(org.data(), domain.data());
|
auto prefPath = SDL_GetPrefPath(org.data(), domain.data());
|
||||||
if (prefPath == nullptr) {
|
if (prefPath == nullptr) {
|
||||||
#if _WIN32
|
#if _WIN32
|
||||||
|
@ -64,6 +72,14 @@ FileStoreManager::FileStoreManager(std::string_view org, std::string_view domain
|
||||||
} else {
|
} else {
|
||||||
m_storeRoot = std::string(prefPath);
|
m_storeRoot = std::string(prefPath);
|
||||||
}
|
}
|
||||||
|
g_instance = this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
FileStoreManager* FileStoreManager::instance() {
|
||||||
|
if (g_instance == nullptr) {
|
||||||
|
Log.report(logvisor::Fatal, FMT_STRING("Requested FileStoreManager instance before it's built!"));
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
return g_instance;
|
||||||
|
}
|
||||||
} // namespace hecl::Runtime
|
} // namespace hecl::Runtime
|
||||||
|
|
|
@ -12,6 +12,10 @@ class FileStoreManager {
|
||||||
std::string m_storeRoot;
|
std::string m_storeRoot;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
FileStoreManager(FileStoreManager&) = delete;
|
||||||
|
FileStoreManager(FileStoreManager&&) = delete;
|
||||||
|
void operator=(FileStoreManager&) = delete;
|
||||||
|
void operator=(FileStoreManager&&) = delete;
|
||||||
FileStoreManager(std::string_view org, std::string_view domain);
|
FileStoreManager(std::string_view org, std::string_view domain);
|
||||||
std::string_view getOrg() const { return m_org; }
|
std::string_view getOrg() const { return m_org; }
|
||||||
std::string_view getDomain() const { return m_domain; }
|
std::string_view getDomain() const { return m_domain; }
|
||||||
|
@ -20,5 +24,6 @@ public:
|
||||||
* @return Full path to store e.g /home/foo/.hecl/bar
|
* @return Full path to store e.g /home/foo/.hecl/bar
|
||||||
*/
|
*/
|
||||||
std::string_view getStoreRoot() const { return m_storeRoot; }
|
std::string_view getStoreRoot() const { return m_storeRoot; }
|
||||||
|
static FileStoreManager* instance();
|
||||||
};
|
};
|
||||||
}
|
}
|
|
@ -29,7 +29,7 @@ add_library(aurora STATIC
|
||||||
lib/gfx/colored_quad/shader.cpp
|
lib/gfx/colored_quad/shader.cpp
|
||||||
)
|
)
|
||||||
target_compile_definitions(aurora PRIVATE IMGUI_USER_CONFIG="imconfig_user.h") # IMGUI_USE_WCHAR32
|
target_compile_definitions(aurora PRIVATE IMGUI_USER_CONFIG="imconfig_user.h") # IMGUI_USE_WCHAR32
|
||||||
target_include_directories(aurora PUBLIC include ../Runtime)
|
target_include_directories(aurora PUBLIC include ../ )
|
||||||
target_include_directories(aurora PRIVATE ../imgui ../extern/imgui)
|
target_include_directories(aurora PRIVATE ../imgui ../extern/imgui)
|
||||||
target_include_directories(aurora PRIVATE
|
target_include_directories(aurora PRIVATE
|
||||||
../extern/dawn/src
|
../extern/dawn/src
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <type_traits>
|
#include <type_traits>
|
||||||
|
|
||||||
#include "RetroTypes.hpp"
|
#include "Runtime/RetroTypes.hpp"
|
||||||
|
|
||||||
namespace aurora {
|
namespace aurora {
|
||||||
template <typename T>
|
template <typename T>
|
||||||
|
|
|
@ -16,11 +16,16 @@ using gpu::g_queue;
|
||||||
|
|
||||||
static float g_scale;
|
static float g_scale;
|
||||||
|
|
||||||
|
static std::string g_imguiSettings{};
|
||||||
|
static std::string g_imguiLog{};
|
||||||
void create_context() noexcept {
|
void create_context() noexcept {
|
||||||
IMGUI_CHECKVERSION();
|
IMGUI_CHECKVERSION();
|
||||||
ImGui::CreateContext();
|
ImGui::CreateContext();
|
||||||
ImGuiIO& io = ImGui::GetIO();
|
ImGuiIO& io = ImGui::GetIO();
|
||||||
io.IniFilename = nullptr;
|
g_imguiSettings = std::string(metaforce::FileStoreManager::instance()->getStoreRoot()) + "/imgui.ini";
|
||||||
|
g_imguiLog = std::string(metaforce::FileStoreManager::instance()->getStoreRoot()) + "/imgui.log";
|
||||||
|
io.IniFilename = g_imguiSettings.c_str();
|
||||||
|
io.LogFilename = g_imguiLog.c_str();
|
||||||
}
|
}
|
||||||
|
|
||||||
void initialize(SDL_Window* window) noexcept {
|
void initialize(SDL_Window* window) noexcept {
|
||||||
|
|
Loading…
Reference in New Issue