* (html5) - Tweaked the build parms, runs much faster now on Chrome, it was sort of laggy before

* (html5) Can now pass in a url to "auto-download" and play a dmod. Example: http://www.rtsoft.com/web/dink?dmod=rtsoft.com/web/srchmili.dmod
- in theory, you can now do dink.exe -game http://www.rtsoft.com/web/dink?dmod=rtsoft.com/web/srchmili.dmod from windows as well and it should download

git-svn-id: svn://rtsoft.com/rtsvn/projects/RTDink@1610 353e56fe-9613-0410-8469-b96ad8e6f29c
This commit is contained in:
seth 2018-05-17 10:43:16 +00:00
parent 8e575535ed
commit 880e0ec2f3
6 changed files with 45 additions and 7 deletions

View file

@ -154,7 +154,7 @@
loader.querySelector(".loadingtext").innerHTML = "Loading stuff...";
var cur = parseInt(m[2])*100;
var progressMax = parseInt(m[4])*100;
console.log('cur: ' + cur+' max: '+progressMax) ;
//console.log('cur: ' + cur+' max: '+progressMax) ;
Module.progress.style.transform = `scaleX(${cur/progressMax})`;
} else
{

View file

@ -154,7 +154,7 @@
loader.querySelector(".loadingtext").innerHTML = "Loading stuff...";
var cur = parseInt(m[2])*100;
var progressMax = parseInt(m[4])*100;
console.log('cur: ' + cur+' max: '+progressMax) ;
//console.log('cur: ' + cur+' max: '+progressMax) ;
Module.progress.style.transform = `scaleX(${cur/progressMax})`;
} else
{

View file

@ -151,7 +151,7 @@
loader.querySelector(".loadingtext").innerHTML = "Loading stuff...";
var cur = parseInt(m[2])*100;
var progressMax = parseInt(m[4])*100;
console.log('cur: ' + cur+' max: '+progressMax) ;
//console.log('cur: ' + cur+' max: '+progressMax) ;
Module.progress.style.transform = `scaleX(${cur/progressMax})`;
} else
{

View file

@ -115,7 +115,7 @@ REM **************************************** END SOURCE
:unused so far: -s USE_GLFW=3 -s NO_EXIT_RUNTIME=1 -s FORCE_ALIGNED_MEMORY=1 -s EMTERPRETIFY=1 -s EMTERPRETIFY_ASYNC=1 -DRT_EMTERPRETER_ENABLED
:To skip font loading so it needs no resource files or zlib, add -DC_NO_ZLIB
SET CUSTOM_FLAGS= -DHAS_SOCKLEN_T -DBOOST_ALL_NO_LIB -DPLATFORM_HTML5 -DRT_USE_SDL_AUDIO -DRT_JPG_SUPPORT -DC_GL_MODE -s LEGACY_GL_EMULATION=1 -DPLATFORM_HTML5 -s TOTAL_MEMORY=16MB -Wno-c++11-compat-deprecated-writable-strings -Wno-shift-negative-value -s ALLOW_MEMORY_GROWTH=1
SET CUSTOM_FLAGS= -DHAS_SOCKLEN_T -DBOOST_ALL_NO_LIB -DPLATFORM_HTML5 -DRT_USE_SDL_AUDIO -DRT_JPG_SUPPORT -DC_GL_MODE -s LEGACY_GL_EMULATION=1 -DPLATFORM_HTML5 -s TOTAL_MEMORY=16MB -s ALLOW_MEMORY_GROWTH=1 -Wno-c++11-compat-deprecated-writable-strings --ignore-dynamic-linking --memory-init-file 0 -Wno-switch
:unused: -s FULL_ES2=1 --emrun
@ -129,7 +129,7 @@ SET FINAL_EXTENSION=html
IF %DEBUG% EQU 0 (
echo Compiling in release mode
SET CUSTOM_FLAGS=%CUSTOM_FLAGS% -O2 -DNDEBUG -s EMTERPRETIFY=1 -s EMTERPRETIFY_ASYNC=1 -DRT_EMTERPRETER_ENABLED -s WASM=1
SET CUSTOM_FLAGS=%CUSTOM_FLAGS% -O2 -DNDEBUG
) else (
echo Compiling in debug mode
SET CUSTOM_FLAGS=%CUSTOM_FLAGS% -D_DEBUG -s GL_UNSAFE_OPTS=0 -s WARN_ON_UNDEFINED_SYMBOLS=1 -s EXCEPTION_DEBUG=1 -s DEMANGLE_SUPPORT=1 -s ALIASING_FUNCTION_POINTERS=0 -s SAFE_HEAP=1 --emrun
@ -153,7 +153,7 @@ call emcc %CUSTOM_FLAGS% %INCLUDE_DIRS% ^
call emcc %CUSTOM_FLAGS% %INCLUDE_DIRS% ^
%APP_SRC% %SRC% %COMPONENT_SRC% temp.bc ^
--preload-file ../bin/interface@interface/ --preload-file ../bin/audio@audio/ --preload-file ../bin/dink_html5@dink/ --js-library %SHARED%\html5\SharedJSLIB.js -o %APP_NAME%.%FINAL_EXTENSION%
--preload-file ../bin/interface@interface/ --preload-file ../bin/audio@audio/ --preload-file ../bin/dink_html5_uncompressed@dink/ --js-library %SHARED%\html5\SharedJSLIB.js -o %APP_NAME%.%FINAL_EXTENSION%
REM Make sure the file compiled ok
if not exist %APP_NAME%.js beeper.exe /p

View file

@ -24,6 +24,7 @@
#ifdef PLATFORM_HTML5
#include "html5/HTML5Utils.h"
#include "html5/SharedJSLIB.h"
#endif
#ifdef WINAPI
@ -357,6 +358,31 @@ bool App::Init()
LogMsg("Initializing Dink HD %s", GetVersionString().c_str());
//add fake parms
#ifdef PLATFORM_HTML5
string crap = JLIB_GetURL();
int n = crap.find_last_of('?');
if (n == string::npos)
{
//I thought maybe this would be useful later to use # instead of ? to prevent caching? Dunno, doesn't hurt to add though
n = crap.find_last_of('#');
}
if (n != string::npos)
{
//we should fake add whatever this command is
string final = crap.substr(n + 1, crap.length() - n);
GetBaseApp()->AddCommandLineParm(final);
}
#endif
//string crap = "http://www.rtsoft.com/web/dink/?-game http://www.rtsoft.com/web/srchmili.dmod";
vector<string> parm = GetBaseApp()->GetCommandLineParms();
string parms;

View file

@ -233,7 +233,7 @@ string GetNextDMODToInstall(bool &bIsCommandLineInstall, const bool bDeleteComma
bIsCommandLineInstall = false;
//if (!GetApp()->CanDownloadDMODS()) return ""; //ignore it
if (IsDesktop())
if (IsDesktop() || GetEmulatedPlatformID() == PLATFORM_ID_HTML5)
{
vector<string> parms = GetApp()->GetCommandLineParms();
@ -284,6 +284,18 @@ void MainOnStartLoading(VariantList *pVList)
string fName = GetNextDMODToInstall(bIsCommandLineInstall, true);
if (IsInString(fName, "http:") || IsInString(fName, "https:")
||
(GetEmulatedPlatformID() == PLATFORM_ID_HTML5 && IsInString(fName, ".dmod"))
)
{
//we should download and install this
StringReplace("-game ", "", fName);
StringReplace("dmod=", "", fName);
DMODInstallMenuCreate(pBG->GetParent(), fName, GetDMODRootPath(), "", true, fName);
return;
}
if (!fName.empty())
{
DMODInstallMenuCreate(pBG->GetParent(), "", GetDMODRootPath(), GetSavePath()+fName, false, "", !bIsCommandLineInstall);