ObsidianDragon - DragonX ImGui Wallet

Full-node GUI wallet for DragonX cryptocurrency.
Built with Dear ImGui, SDL3, and OpenGL3/DX11.

Features:
- Send/receive shielded and transparent transactions
- Autoshield with merged transaction display
- Built-in CPU mining (xmrig)
- Peer management and network monitoring
- Wallet encryption with PIN lock
- QR code generation for receive addresses
- Transaction history with pagination
- Console for direct RPC commands
- Cross-platform (Linux, Windows)
This commit is contained in:
2026-02-26 02:31:52 -06:00
commit 3aee55b49c
306 changed files with 177789 additions and 0 deletions

135
src/util/platform.h Normal file
View File

@@ -0,0 +1,135 @@
// DragonX Wallet - ImGui Edition
// Copyright 2024-2026 The Hush Developers
// Released under the GPLv3
#pragma once
#include <string>
#include <cstdint>
namespace dragonx {
namespace util {
/**
* @brief Platform-specific utilities
*/
class Platform {
public:
/**
* @brief Open a URL in the default browser
* @param url The URL to open
* @return true if successful
*/
static bool openUrl(const std::string& url);
/**
* @brief Open a folder in the system file manager
* @param path Path to the folder
* @param createIfMissing Create the folder if it doesn't exist
* @return true if successful
*/
static bool openFolder(const std::string& path, bool createIfMissing = true);
/**
* @brief Get the size of a file in bytes
* @param path Path to the file
* @return File size in bytes, or 0 if file doesn't exist
*/
static uint64_t getFileSize(const std::string& path);
/**
* @brief Format a file size as human-readable string
* @param bytes Size in bytes
* @return Formatted string (e.g., "5.23 MB")
*/
static std::string formatFileSize(uint64_t bytes);
/**
* @brief Get the user's home directory
* @return Home directory path
*/
static std::string getHomeDir();
/**
* @brief Get the DragonX data directory
* @return Path like ~/.hush/DRAGONX/ or %APPDATA%\Hush\DRAGONX\
*/
static std::string getDragonXDataDir();
/**
* @brief Get the wallet data directory (alias for getDragonXDataDir)
* @return Path like ~/.hush/DRAGONX/ or %APPDATA%\Hush\DRAGONX\
*/
static std::string getDataDir();
/**
* @brief Get the config directory for storing wallet exports/backups
* @return Path like ~/.config/ObsidianDragon/ or %APPDATA%\ObsidianDragon\
*/
static std::string getConfigDir();
/**
* @brief Delete a file
* @param path Path to the file
* @return true if successful or file didn't exist
*/
static bool deleteFile(const std::string& path);
/**
* @brief Get the directory containing the executable
* @return Path to executable's directory
*/
static std::string getExecutableDirectory();
/**
* @brief Get the ObsidianDragon config directory
* @return Path like ~/.config/ObsidianDragon/ or %APPDATA%\ObsidianDragon\
*/
static std::string getObsidianDragonDir();
/**
* @brief Create ObsidianDragon folder structure and template files on first run
*
* Creates:
* ObsidianDragon/
* ObsidianDragon/themes/
* ObsidianDragon/themes/my_theme.toml (template)
*
* Only writes template files if they don't already exist.
*/
static void ensureObsidianDragonSetup();
/**
* @brief Get total system RAM in megabytes
* @return Total physical RAM in MB, or 0 on failure
*/
static double getTotalSystemRAM_MB();
/**
* @brief Get currently used system RAM in megabytes
* @return Used physical RAM in MB (total - available), or 0 on failure
*/
static double getUsedSystemRAM_MB();
/**
* @brief Get this process's own RSS (resident set size) in megabytes
* @return Self process RSS in MB, or 0 on failure
*/
static double getSelfMemoryUsageMB();
/**
* @brief Get total RSS of all hushd daemon processes in megabytes
* Scans for any running hushd process by name, regardless of how it was launched.
* @return Combined daemon RSS in MB, or 0 if no daemon found
*/
static double getDaemonMemoryUsageMB();
};
/**
* @brief Get the directory containing the executable (free function)
* @return Path to executable's directory
*/
std::string getExecutableDirectory();
} // namespace util
} // namespace dragonx