Add widescreen.si to web port (#666)

* Add widescreen.si to web port

* Move logic
This commit is contained in:
Christian Semmler 2025-08-10 19:41:42 -07:00 committed by GitHub
parent 4f7a19d9e4
commit 6a8aaaabe2
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 28 additions and 9 deletions

View File

@ -1,6 +1,7 @@
#include "filesystem.h"
#include "events.h"
#include "extensions/siloader.h"
#include "extensions/textureloader.h"
#include "legogamestate.h"
#include "misc.h"
@ -107,6 +108,14 @@ void Emscripten_SetupFilesystem()
Emscripten_SendExtensionProgress("HD Textures", (++i * 100) / sizeOfArray(g_textures));
}
}
if (Extensions::SiLoader::enabled) {
wasmfs_create_directory("/LEGO/extra", 0644, fetchfs);
for (const auto& file : Extensions::SiLoader::files) {
registerFile(file.c_str());
}
}
#endif
if (GameState()->GetSavePath() && *GameState()->GetSavePath() && !Emscripten_OPFSDisabled()) {

View File

@ -973,6 +973,8 @@ MxResult IsleApp::SetupWindow()
return FAILURE;
}
Lego()->LoadSiLoader();
DetectGameVersion();
GameState()->SerializePlayersInfo(LegoStorage::c_read);
GameState()->SerializeScoreHistory(LegoStorage::c_read);

View File

@ -208,6 +208,7 @@ class LegoOmni : public MxOmni {
void SetVersion10(MxBool p_version10) { m_version10 = p_version10; }
MxBool IsVersion10() { return m_version10; }
LEGO1_EXPORT void LoadSiLoader();
// SYNTHETIC: LEGO1 0x10058b30
// SYNTHETIC: BETA10 0x1008f8d0

View File

@ -354,9 +354,6 @@ MxResult LegoOmni::Create(MxOmniCreateParam& p_param)
else {
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Failed to create MxTransitionManager");
}
Extension<SiLoader>::Call(Load);
done:
return result;
// LINE: BETA10 0x1008e35d
@ -728,3 +725,8 @@ void LegoOmni::Resume()
MxOmni::Resume();
SetAppCursor(e_cursorArrow);
}
void LegoOmni::LoadSiLoader()
{
Extension<SiLoader>::Call(Load);
}

View File

@ -19,10 +19,10 @@ class SiLoader {
static bool RemoveWith(StreamObject p_object, LegoWorld* world);
static std::map<std::string, std::string> options;
static std::vector<std::string> files;
static bool enabled;
private:
static std::vector<std::string> files;
static std::vector<std::pair<StreamObject, StreamObject>> startWith;
static std::vector<std::pair<StreamObject, StreamObject>> removeWith;

View File

@ -10,24 +10,29 @@
using namespace Extensions;
std::map<std::string, std::string> SiLoader::options;
std::vector<std::string> SiLoader::files;
std::vector<std::pair<SiLoader::StreamObject, SiLoader::StreamObject>> SiLoader::startWith;
std::vector<std::pair<SiLoader::StreamObject, SiLoader::StreamObject>> SiLoader::removeWith;
bool SiLoader::enabled = false;
void SiLoader::Initialize()
{
}
bool SiLoader::Load()
{
char* files = SDL_strdup(options["si loader:files"].c_str());
char* saveptr;
for (char* file = SDL_strtok_r(files, ",\n", &saveptr); file; file = SDL_strtok_r(NULL, ",\n", &saveptr)) {
LoadFile(file);
SiLoader::files.emplace_back(file);
}
SDL_free(files);
}
bool SiLoader::Load()
{
for (const auto& file : files) {
LoadFile(file.c_str());
}
return true;
}