mirror of
https://github.com/izzy2lost/Ghostship.git
synced 2026-06-19 01:17:03 -07:00
Fixed paths to work like on soh
This commit is contained in:
@@ -245,7 +245,7 @@ static u8 *alloc_ia8_text_from_i1(u16 *in, s16 width, s16 height) {
|
||||
}
|
||||
|
||||
void render_generic_char(u8 c) {
|
||||
void **fontLUT = segmented_to_virtual(main_font_lut);
|
||||
char **fontLUT = segmented_to_virtual(main_font_lut);
|
||||
char* packedTexture = fontLUT[c];
|
||||
|
||||
if (packedTexture == NULL) {
|
||||
@@ -254,9 +254,9 @@ void render_generic_char(u8 c) {
|
||||
|
||||
gDPPipeSync(gDisplayListHead++);
|
||||
if(ROM_JP) {
|
||||
gDPSetTextureImage(gDisplayListHead++, G_IM_FMT_IA, G_IM_SIZ_8b, 1, VIRTUAL_TO_PHYSICAL(packedTexture));
|
||||
gDPSetTextureImage(gDisplayListHead++, G_IM_FMT_IA, G_IM_SIZ_8b, 1, (packedTexture));
|
||||
} else {
|
||||
gDPSetTextureImage(gDisplayListHead++, G_IM_FMT_IA, G_IM_SIZ_16b, 1, VIRTUAL_TO_PHYSICAL(packedTexture));
|
||||
gDPSetTextureImage(gDisplayListHead++, G_IM_FMT_IA, G_IM_SIZ_16b, 1, (packedTexture));
|
||||
}
|
||||
|
||||
gSPDisplayList(gDisplayListHead++, dl_ia_text_tex_settings);
|
||||
|
||||
+24
-25
@@ -54,6 +54,7 @@ const float imguiScaleOptionToValue[4] = { 0.75f, 1.0f, 1.5f, 2.0f };
|
||||
const uint32_t defaultImGuiScale = 1;
|
||||
int32_t previousImGuiScaleIndex = -1;
|
||||
float previousImGuiScale = defaultImGuiScale;
|
||||
const std::string appShortName = "warp";
|
||||
|
||||
namespace fs = std::filesystem;
|
||||
|
||||
@@ -68,7 +69,7 @@ bool prevAltAssets = false;
|
||||
GameEngine* GameEngine::Instance;
|
||||
|
||||
GameEngine::GameEngine() : dictionary(nullptr) {
|
||||
this->context = Ship::Context::CreateUninitializedInstance("Ghostship", "sm64", "ghostship.cfg.json");
|
||||
this->context = Ship::Context::CreateUninitializedInstance("Ghostship", appShortName, "ghostship.cfg.json");
|
||||
|
||||
#ifdef __SWITCH__
|
||||
Ship::Switch::Init(Ship::PreInitPhase);
|
||||
@@ -76,7 +77,7 @@ GameEngine::GameEngine() : dictionary(nullptr) {
|
||||
#endif
|
||||
|
||||
std::vector<std::string> archiveFiles;
|
||||
const std::string main_path = Ship::Context::GetPathRelativeToAppDirectory("sm64.o2r");
|
||||
const std::string main_path = Ship::Context::GetAppDirectoryPath(appShortName) + "/sm64.o2r";
|
||||
const std::string assets_path = Ship::Context::LocateFileAcrossAppDirs("ghostship.o2r");
|
||||
|
||||
#ifdef _WIN32
|
||||
@@ -104,22 +105,21 @@ GameEngine::GameEngine() : dictionary(nullptr) {
|
||||
archiveFiles.push_back(assets_path);
|
||||
}
|
||||
|
||||
if (const std::string patches_path = Ship::Context::GetPathRelativeToAppDirectory("mods"); !patches_path.empty()) {
|
||||
if (!std::filesystem::exists(patches_path)) {
|
||||
std::filesystem::create_directories(patches_path);
|
||||
}
|
||||
std::string modsPath = Ship::Context::LocateFileAcrossAppDirs("mods", appShortName);
|
||||
if (!std::filesystem::exists(modsPath)) {
|
||||
std::filesystem::create_directories(modsPath);
|
||||
}
|
||||
|
||||
if (std::filesystem::is_directory(patches_path)) {
|
||||
for (const auto& p : std::filesystem::recursive_directory_iterator(patches_path)) {
|
||||
const auto ext = p.path().extension().string();
|
||||
if (StringHelper::IEquals(ext, ".otr") || StringHelper::IEquals(ext, ".o2r")) {
|
||||
archiveFiles.push_back(p.path().generic_string());
|
||||
}
|
||||
if (std::filesystem::is_directory(modsPath)) {
|
||||
for (const auto& p : std::filesystem::recursive_directory_iterator(modsPath)) {
|
||||
const auto ext = p.path().extension().string();
|
||||
if (StringHelper::IEquals(ext, ".otr") || StringHelper::IEquals(ext, ".o2r")) {
|
||||
archiveFiles.push_back(p.path().generic_string());
|
||||
}
|
||||
|
||||
if (StringHelper::IEquals(ext, ".zip")) {
|
||||
SPDLOG_WARN("Zip files should be only used for development purposes, not for distribution");
|
||||
archiveFiles.push_back(p.path().generic_string());
|
||||
}
|
||||
if (StringHelper::IEquals(ext, ".zip")) {
|
||||
SPDLOG_WARN("Zip files should be only used for development purposes, not for distribution");
|
||||
archiveFiles.push_back(p.path().generic_string());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -154,11 +154,6 @@ GameEngine::GameEngine() : dictionary(nullptr) {
|
||||
auto loader = context->GetResourceManager()->GetResourceLoader();
|
||||
auto blobFactory = std::make_shared<Ship::ResourceFactoryBinaryBlobV0>();
|
||||
|
||||
loader->RegisterResourceFactory(std::make_shared<MK64::ResourceFactoryBinaryTextureV0>(), RESOURCE_FORMAT_BINARY,
|
||||
"Texture", static_cast<uint32_t>(Fast::ResourceType::Texture), 0);
|
||||
loader->RegisterResourceFactory(std::make_shared<MK64::ResourceFactoryBinaryTextureV1>(), RESOURCE_FORMAT_BINARY,
|
||||
"Texture", static_cast<uint32_t>(Fast::ResourceType::Texture), 1);
|
||||
|
||||
loader->RegisterResourceFactory(std::make_shared<SM64::AnimationFactoryV0>(), RESOURCE_FORMAT_BINARY, "Animation",
|
||||
static_cast<uint32_t>(SM64::ResourceType::Anim), 0);
|
||||
loader->RegisterResourceFactory(std::make_shared<SM64::AudioBankFactoryV0>(), RESOURCE_FORMAT_BINARY, "AudioBank",
|
||||
@@ -171,10 +166,10 @@ GameEngine::GameEngine() : dictionary(nullptr) {
|
||||
static_cast<uint32_t>(SM64::ResourceType::SDialog), 0);
|
||||
loader->RegisterResourceFactory(std::make_shared<SM64::DictionaryFactoryV0>(), RESOURCE_FORMAT_BINARY, "Dictionary",
|
||||
static_cast<uint32_t>(SM64::ResourceType::Dictionary), 0);
|
||||
// loader->RegisterResourceFactory(std::make_shared<Fast::ResourceFactoryBinaryTextureV0>(), RESOURCE_FORMAT_BINARY,
|
||||
// "Texture", static_cast<uint32_t>(Fast::ResourceType::Texture), 0);
|
||||
// loader->RegisterResourceFactory(std::make_shared<Fast::ResourceFactoryBinaryTextureV1>(), RESOURCE_FORMAT_BINARY,
|
||||
// "Texture", static_cast<uint32_t>(Fast::ResourceType::Texture), 1);
|
||||
loader->RegisterResourceFactory(std::make_shared<Fast::ResourceFactoryBinaryTextureV0>(), RESOURCE_FORMAT_BINARY,
|
||||
"Texture", static_cast<uint32_t>(Fast::ResourceType::Texture), 0);
|
||||
loader->RegisterResourceFactory(std::make_shared<Fast::ResourceFactoryBinaryTextureV1>(), RESOURCE_FORMAT_BINARY,
|
||||
"Texture", static_cast<uint32_t>(Fast::ResourceType::Texture), 1);
|
||||
loader->RegisterResourceFactory(std::make_shared<Fast::ResourceFactoryBinaryVertexV0>(), RESOURCE_FORMAT_BINARY,
|
||||
"Vertex", static_cast<uint32_t>(Fast::ResourceType::Vertex), 0);
|
||||
loader->RegisterResourceFactory(std::make_shared<Fast::ResourceFactoryBinaryDisplayListV0>(),
|
||||
@@ -574,6 +569,10 @@ void GameEngine::ProcessGfxCommands(Gfx* commands) {
|
||||
last_fps = fps;
|
||||
}
|
||||
|
||||
bool GameEngine::IsAltAssetsEnabled() {
|
||||
return prevAltAssets;
|
||||
}
|
||||
|
||||
extern "C" uint32_t GameEngine_GetInterpolatedFPS() {
|
||||
return GameEngine::GetInterpolationFPS();
|
||||
}
|
||||
|
||||
@@ -65,6 +65,7 @@ class GameEngine {
|
||||
static ImFont *CreateFontWithSize(float size, std::string fontPath);
|
||||
static void ScaleImGui();
|
||||
static void ShowMessage(const char* title, const char* message, SDL_MessageBoxFlags type = SDL_MESSAGEBOX_ERROR);
|
||||
static bool IsAltAssetsEnabled();
|
||||
void LoadDictionary();
|
||||
void LoadPlayerAnims();
|
||||
static uint32_t GetGameVersion();
|
||||
|
||||
Reference in New Issue
Block a user