Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions src/engine/mods/ModManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@ void DetectOutdatedDependencies();
void SortModsByDependencies();

std::vector<std::tuple<ModMetadata, std::shared_ptr<Ship::Archive>>> Mods = {};
const std::string main_path = Ship::Context::GetPathRelativeToAppDirectory("mk64.o2r");
const std::string assets_path = Ship::Context::LocateFileAcrossAppDirs("spaghetti.o2r");

void InitModsSystem() {
CheckMK64O2RExists();
Expand Down Expand Up @@ -65,6 +63,9 @@ void GenerateAssetsMods() {
}

std::vector<std::string> ListMods() {
const std::string main_path = Ship::Context::GetPathRelativeToAppDirectory(game_asset_file);
const std::string assets_path = Ship::Context::LocateFileAcrossAppDirs(engine_asset_file);

std::vector<std::string> archiveFiles;
if (std::filesystem::exists(main_path)) {
archiveFiles.push_back(main_path);
Expand Down Expand Up @@ -202,6 +203,8 @@ void AddCoreDependencies() {
}

void CheckMK64O2RExists() {
const std::string main_path = Ship::Context::GetPathRelativeToAppDirectory(game_asset_file);

if (!std::filesystem::exists(main_path)) {
GenerateAssetsMods();
}
Expand Down
2 changes: 1 addition & 1 deletion src/port/Engine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ GameEngine::GameEngine() {
{ BTN_DDOWN, "DDown" },
});
auto controlDeck = std::make_shared<LUS::ControlDeck>(std::vector<CONTROLLERBUTTONS_T>(), defaultMappings, buttonNames);
const std::string assets_path = Ship::Context::LocateFileAcrossAppDirs("spaghetti.o2r");
const std::string assets_path = Ship::Context::LocateFileAcrossAppDirs(engine_asset_file);
this->context->InitResourceManager({assets_path}, {}, 3); // without this line InitWindow fails in Gui::Init()
this->context->InitConsole(); // without this line the GuiWindow constructor fails in ConsoleWindow::InitElement()

Expand Down
13 changes: 8 additions & 5 deletions src/port/Engine.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,17 @@

#include "port/audio/HMAS.h"

static const char game_asset_file[] = "mk64.o2r";
static const char engine_asset_file[] = "spaghetti.o2r";

#define LOAD_ASSET(path) \
(path == NULL ? NULL \
: (GameEngine_OTRSigCheck((const char*) path) ? ResourceGetDataByName((const char*) path) : path))
#define LOAD_ASSET_RAW(path) ResourceGetDataByName((const char*) path)
#ifdef __cplusplus
#include <vector>
#include <SDL2/SDL.h>
#define LOAD_ASSET_RAW(path) ResourceGetDataByName((const char*) path)

#ifdef __cplusplus
#include <vector>
#include <SDL2/SDL.h>
#include <fast/Fast3dWindow.h>
#include <fast/interpreter.h>
#include "ship/Context.h"
Expand Down
Loading