35 lines
637 B
C++
35 lines
637 B
C++
#include <fxos/load.h>
|
|
#include <iostream>
|
|
|
|
namespace FxOS {
|
|
|
|
/* Load any fxos data file. */
|
|
void load(std::string path)
|
|
{
|
|
Buffer file(path);
|
|
size_t offset;
|
|
int line;
|
|
|
|
// std::cerr << "[fxos] loading resource file '" << path << "'...\n";
|
|
|
|
Header h = load_header(file, offset, line);
|
|
if(h.find("type") == h.end())
|
|
{
|
|
throw std::runtime_error(format("no type in header of '%s'",
|
|
path.c_str()));
|
|
}
|
|
|
|
std::string type = h["type"];
|
|
|
|
if(type == "assembly")
|
|
{
|
|
load_asm(file, offset, line);
|
|
return;
|
|
}
|
|
|
|
throw std::runtime_error(format("unknown file type '%s' in '%s'",
|
|
type.c_str(), path.c_str()));
|
|
}
|
|
|
|
} /* namespace FxOS */
|