39 lines
1.1 KiB
C++
39 lines
1.1 KiB
C++
// resource_helper.hpp
|
|
// Helper functions for resource loading (bridge to pack system)
|
|
|
|
#pragma once
|
|
|
|
#include <cstdint>
|
|
#include <string>
|
|
#include <vector>
|
|
|
|
namespace Resource::Helper {
|
|
|
|
// Initialize the resource system
|
|
// pack_file: Path to resources.pack
|
|
// enable_fallback: Allow loading from filesystem if pack not available
|
|
auto initializeResourceSystem(const std::string& pack_file = "resources.pack",
|
|
bool enable_fallback = true) -> bool;
|
|
|
|
// Shutdown the resource system
|
|
void shutdownResourceSystem();
|
|
|
|
// Load a file (tries pack first, then filesystem if fallback enabled)
|
|
auto loadFile(const std::string& filepath) -> std::vector<uint8_t>;
|
|
|
|
// Check if a file exists
|
|
auto fileExists(const std::string& filepath) -> bool;
|
|
|
|
// Convert an asset path to a pack path
|
|
// Example: "data/music/title.ogg" -> "music/title.ogg"
|
|
auto getPackPath(const std::string& asset_path) -> std::string;
|
|
|
|
// Check if a file should use the resource pack
|
|
// Returns false for config/ files (always from filesystem)
|
|
auto shouldUseResourcePack(const std::string& filepath) -> bool;
|
|
|
|
// Check if pack is loaded
|
|
auto isPackLoaded() -> bool;
|
|
|
|
} // namespace Resource::Helper
|