resource.pack
This commit is contained in:
@@ -5,6 +5,8 @@
|
||||
|
||||
#include <iostream> // for basic_ostream, operator<<, cout, endl
|
||||
|
||||
#include "resource_helper.h"
|
||||
|
||||
// Constructor
|
||||
Asset::Asset(std::string executablePath) {
|
||||
this->executablePath = executablePath.substr(0, executablePath.find_last_of("\\/"));
|
||||
@@ -96,14 +98,21 @@ bool Asset::checkFile(std::string path) {
|
||||
bool success = false;
|
||||
std::string result = "ERROR";
|
||||
|
||||
// Comprueba si existe el fichero
|
||||
// Comprueba si existe el fichero (pack o filesystem)
|
||||
const std::string filename = path.substr(path.find_last_of("\\/") + 1);
|
||||
SDL_IOStream *file = SDL_IOFromFile(path.c_str(), "rb");
|
||||
|
||||
if (file != nullptr) {
|
||||
result = "OK";
|
||||
success = true;
|
||||
SDL_CloseIO(file);
|
||||
if (ResourceHelper::shouldUseResourcePack(path)) {
|
||||
auto bytes = ResourceHelper::loadFile(path);
|
||||
if (!bytes.empty()) {
|
||||
result = "OK";
|
||||
success = true;
|
||||
}
|
||||
} else {
|
||||
SDL_IOStream *file = SDL_IOFromFile(path.c_str(), "rb");
|
||||
if (file != nullptr) {
|
||||
result = "OK";
|
||||
success = true;
|
||||
SDL_CloseIO(file);
|
||||
}
|
||||
}
|
||||
|
||||
if (verbose) {
|
||||
|
||||
Reference in New Issue
Block a user