mirror of
https://github.com/isledecomp/isle-portable.git
synced 2025-08-03 15:47:34 -04:00
(Web port) Add HD textures option (#647)
This commit is contained in:
parent
fd36f07537
commit
7473330e47
@ -1,5 +1,6 @@
|
|||||||
#include "filesystem.h"
|
#include "filesystem.h"
|
||||||
|
|
||||||
|
#include "extensions/textureloader.h"
|
||||||
#include "legogamestate.h"
|
#include "legogamestate.h"
|
||||||
#include "misc.h"
|
#include "misc.h"
|
||||||
#include "mxomni.h"
|
#include "mxomni.h"
|
||||||
@ -13,6 +14,7 @@ static backend_t opfs = nullptr;
|
|||||||
static backend_t fetchfs = nullptr;
|
static backend_t fetchfs = nullptr;
|
||||||
|
|
||||||
extern const char* g_files[46];
|
extern const char* g_files[46];
|
||||||
|
extern const char* g_textures[120];
|
||||||
|
|
||||||
bool Emscripten_OPFSDisabled()
|
bool Emscripten_OPFSDisabled()
|
||||||
{
|
{
|
||||||
@ -41,7 +43,7 @@ bool Emscripten_SetupConfig(const char* p_iniConfig)
|
|||||||
|
|
||||||
void Emscripten_SetupFilesystem()
|
void Emscripten_SetupFilesystem()
|
||||||
{
|
{
|
||||||
fetchfs = wasmfs_create_fetch_backend((MxString(Emscripten_streamHost) + MxString("/LEGO")).GetData(), 512 * 1024);
|
fetchfs = wasmfs_create_fetch_backend((MxString(Emscripten_streamHost) + "/LEGO").GetData(), 512 * 1024);
|
||||||
|
|
||||||
wasmfs_create_directory("/LEGO", 0644, fetchfs);
|
wasmfs_create_directory("/LEGO", 0644, fetchfs);
|
||||||
wasmfs_create_directory("/LEGO/Scripts", 0644, fetchfs);
|
wasmfs_create_directory("/LEGO/Scripts", 0644, fetchfs);
|
||||||
@ -75,6 +77,20 @@ void Emscripten_SetupFilesystem()
|
|||||||
registerFile(file);
|
registerFile(file);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef EXTENSIONS
|
||||||
|
if (Extensions::TextureLoader::enabled) {
|
||||||
|
MxString directory =
|
||||||
|
MxString("/LEGO") + Extensions::TextureLoader::options["texture loader:texture path"].c_str();
|
||||||
|
Extensions::TextureLoader::options["texture loader:texture path"] = directory.GetData();
|
||||||
|
wasmfs_create_directory(directory.GetData(), 0644, fetchfs);
|
||||||
|
|
||||||
|
for (const char* file : g_textures) {
|
||||||
|
MxString path = directory + "/" + file + ".bmp";
|
||||||
|
registerFile(path.GetData());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
if (GameState()->GetSavePath() && *GameState()->GetSavePath() && !Emscripten_OPFSDisabled()) {
|
if (GameState()->GetSavePath() && *GameState()->GetSavePath() && !Emscripten_OPFSDisabled()) {
|
||||||
if (!opfs) {
|
if (!opfs) {
|
||||||
opfs = wasmfs_create_opfs_backend();
|
opfs = wasmfs_create_opfs_backend();
|
||||||
|
@ -46,3 +46,24 @@ const char* g_files[46] = {
|
|||||||
"/LEGO/data/WORLD.WDB",
|
"/LEGO/data/WORLD.WDB",
|
||||||
"/LEGO/data/testinf.dta",
|
"/LEGO/data/testinf.dta",
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const char* g_textures[120] = {
|
||||||
|
"bank01.gif", "beach.gif", "black.gif", "bowtie.gif", "brela_01.gif", "bth1chst.gif", "bth2chst.gif",
|
||||||
|
"capch.gif", "capdb.gif", "capjs.gif", "capmd.gif", "caprc.gif", "cave_24x.gif", "caverocx.gif",
|
||||||
|
"caverokx.gif", "cheker01.gif", "construct.gif", "copchest.gif", "dbfrfn.gif", "doctor.gif", "dogface.gif",
|
||||||
|
"dummy.gif", "e.gif", "flowers.gif", "fruit.gif", "gasroad.gif", "gdface.gif", "g.gif",
|
||||||
|
"grassx.gif", "infochst.gif", "infoface.gif", "jailpad.gif", "jfrnt.gif", "jsfrnt4.gif", "jsfrnt.gif",
|
||||||
|
"jside.gif", "jswnsh5.gif", "jswnsh.gif", "l6.gif", "l.gif", "mamachst.gif", "mamaface.gif",
|
||||||
|
"mamamap.gif", "mech.gif", "medic01.gif", "mitesx.gif", "mustache.gif", "nickchst.gif", "nickface.gif",
|
||||||
|
"nickmap.gif", "nopizza.gif", "norachst.gif", "noraface.gif", "noramap.gif", "nwcurve.gif", "octan01.gif",
|
||||||
|
"octsq01.gif", "o.gif", "papachst.gif", "papaface.gif", "papamap.gif", "pebblesx.gif", "pepperha.gif",
|
||||||
|
"peppizza.gif", "peppmap.gif", "peprchst.gif", "peprface.gif", "pianokys.gif", "pizcurve.gif", "pizza01.gif",
|
||||||
|
"pizza.gif", "polbar01.gif", "polbla01.gif", "polkadot.gif", "polwhi01.gif", "postchst.gif", "post.gif",
|
||||||
|
"rac1chst.gif", "rac2chst.gif", "radar.gif", "raddis01.gif", "rcback.gif", "rc-butn.gif", "rcfrnt5.gif",
|
||||||
|
"rcfrnt6.gif", "rcfrnt7.gif", "rcfrnt.gif", "rcside1.gif", "rcside2.gif", "rcside3.gif", "rctail.gif",
|
||||||
|
"redskul.gif", "relrel01.gif", "road1way.gif", "road3wa2.gif", "road3wa3.gif", "road3way.gif", "road4way.gif",
|
||||||
|
"roadstr8.gif", "rockx.gif", "roofpiz.gif", "sandredx.gif", "se_curve.gif", "shftchst.gif", "shftface2.gif",
|
||||||
|
"shftface.gif", "shldwn02.gif", "skull.gif", "smile.gif", "smileshd.gif", "supr2_01.gif", "tightcrv.gif",
|
||||||
|
"unkchst.gif", "val_02.gif", "vest.gif", "water2x.gif", "w_curve.gif", "wnbars.gif", "woman.gif",
|
||||||
|
"womanshd.gif"
|
||||||
|
};
|
||||||
|
@ -17,7 +17,7 @@ public:
|
|||||||
static bool enabled;
|
static bool enabled;
|
||||||
|
|
||||||
static constexpr std::array<std::pair<std::string_view, std::string_view>, 1> defaults = {
|
static constexpr std::array<std::pair<std::string_view, std::string_view>, 1> defaults = {
|
||||||
{{"texture loader:texture path", "/textures/"}}
|
{{"texture loader:texture path", "/textures"}}
|
||||||
};
|
};
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -99,11 +99,11 @@ SDL_Surface* TextureLoader::FindTexture(const char* p_name)
|
|||||||
{
|
{
|
||||||
SDL_Surface* surface;
|
SDL_Surface* surface;
|
||||||
const char* texturePath = options["texture loader:texture path"].c_str();
|
const char* texturePath = options["texture loader:texture path"].c_str();
|
||||||
MxString path = MxString(MxOmni::GetHD()) + texturePath + p_name + ".bmp";
|
MxString path = MxString(MxOmni::GetHD()) + texturePath + "/" + p_name + ".bmp";
|
||||||
|
|
||||||
path.MapPathToFilesystem();
|
path.MapPathToFilesystem();
|
||||||
if (!(surface = SDL_LoadBMP(path.GetData()))) {
|
if (!(surface = SDL_LoadBMP(path.GetData()))) {
|
||||||
path = MxString(MxOmni::GetCD()) + texturePath + p_name + ".bmp";
|
path = MxString(MxOmni::GetCD()) + texturePath + "/" + p_name + ".bmp";
|
||||||
path.MapPathToFilesystem();
|
path.MapPathToFilesystem();
|
||||||
surface = SDL_LoadBMP(path.GetData());
|
surface = SDL_LoadBMP(path.GetData());
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user