* (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

@ -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);