mirror of
https://github.com/HarbourMasters/Shipwright.git
synced 2024-11-14 13:35:07 -05:00
219804cbe4
* Initial controller hud ui * Reverted fbdemo changes * Moved config to json and implemented controller config * fix build on linux, gitignore new config file * fix build * Fix compilation and file directory paths * Call save on cvar save * Fixed cvar loading and added deck slots to the config * Changed control deck port 0 to use a physical device by default * Added gyro and rumble & fixed loading errors * Save config on toggle menubar * fix linux build * Fixed drift calculation * Controller config now saves when pressing F1 * Removed ExitGame hook from ImGuiImpl * Moved mappings to a map * Added GetKeyName * untranslate scancodes * Fixed hud layout on keyboard device * Fixed keyboard read on hud * Fixed crash when reloading controllers * Removed ConfigFile and changed file extension * Changed Dummy to Disconnected and fixed filters * Removed function leftover * Changed ControllerHud to InputEditor Co-authored-by: briaguya <briaguya@alice> Co-authored-by: David Chavez <david@dcvz.io>
55 lines
1.5 KiB
C++
55 lines
1.5 KiB
C++
#ifndef GLOBAL_CTX_2
|
|
#define GLOBAL_CTX_2
|
|
|
|
#pragma once
|
|
|
|
#ifdef __cplusplus
|
|
#include <filesystem>
|
|
#include <memory>
|
|
#include <fstream>
|
|
#include "spdlog/spdlog.h"
|
|
#include "Lib/Mercury/Mercury.h"
|
|
|
|
namespace Ship {
|
|
class ResourceMgr;
|
|
class Window;
|
|
|
|
class GlobalCtx2 {
|
|
public:
|
|
static std::shared_ptr<GlobalCtx2> GetInstance();
|
|
static std::shared_ptr<GlobalCtx2> CreateInstance(const std::string& Name);
|
|
|
|
std::string GetName() { return Name; }
|
|
std::shared_ptr<Window> GetWindow() { return Win; }
|
|
std::shared_ptr<ResourceMgr> GetResourceManager() { return ResMan; }
|
|
std::shared_ptr<spdlog::logger> GetLogger() { return Logger; }
|
|
std::shared_ptr<Mercury> GetConfig() { return Config; }
|
|
|
|
static std::string GetAppDirectoryPath();
|
|
static std::string GetPathRelativeToAppDirectory(const char* path);
|
|
|
|
void WriteSaveFile(const std::filesystem::path& savePath, uintptr_t addr, void* dramAddr, size_t size);
|
|
void ReadSaveFile(std::filesystem::path savePath, uintptr_t addr, void* dramAddr, size_t size);
|
|
|
|
GlobalCtx2(std::string Name);
|
|
~GlobalCtx2();
|
|
|
|
protected:
|
|
void InitWindow();
|
|
void InitLogging();
|
|
|
|
private:
|
|
static std::weak_ptr <GlobalCtx2> Context;
|
|
std::shared_ptr<spdlog::logger> Logger;
|
|
std::shared_ptr<Window> Win;
|
|
std::shared_ptr<Mercury> Config; // Config needs to be after the Window because we call the Window during it's destructor.
|
|
std::shared_ptr<ResourceMgr> ResMan;
|
|
std::string Name;
|
|
std::string MainPath;
|
|
std::string PatchesPath;
|
|
};
|
|
}
|
|
#endif
|
|
|
|
#endif
|