mirror of
https://github.com/mamedev/mame.git
synced 2024-11-16 07:48:32 +01:00
web: Fix web options reading from ini, improved load/save state UI [Firehawke]
This commit is contained in:
parent
9197a7adaf
commit
6e06426096
5 changed files with 167 additions and 8 deletions
|
@ -202,7 +202,7 @@ const options_entry emu_options::s_option_entries[] =
|
|||
{ OPTION_AUTOBOOT_DELAY, "2", OPTION_INTEGER, "timer delay in sec to trigger command execution on autoboot" },
|
||||
{ OPTION_AUTOBOOT_SCRIPT ";script", NULL, OPTION_STRING, "lua script to execute after machine boot" },
|
||||
{ OPTION_HTTP, "0", OPTION_BOOLEAN, "enable local http server" },
|
||||
{ OPTION_HTTP_PORT, "8080", OPTION_INTEGER, "http server listener port" },
|
||||
{ OPTION_HTTP_PORT, "8080", OPTION_STRING, "http server listener port" },
|
||||
{ OPTION_HTTP_PATH, "web", OPTION_STRING, "path to web files" },
|
||||
{ NULL }
|
||||
};
|
||||
|
|
|
@ -148,6 +148,14 @@ int mame_execute(emu_options &options, osd_interface &osd)
|
|||
bool exit_pending = false;
|
||||
int error = MAMERR_NONE;
|
||||
|
||||
// We need to preprocess the config files once to determine the web server's configuration
|
||||
if (options.read_config())
|
||||
{
|
||||
options.revert(OPTION_PRIORITY_INI);
|
||||
astring errors;
|
||||
options.parse_standard_inis(errors);
|
||||
}
|
||||
|
||||
web_engine web(options);
|
||||
|
||||
while (error == MAMERR_NONE && !exit_pending)
|
||||
|
|
|
@ -44,6 +44,7 @@
|
|||
#include "web/mongoose.h"
|
||||
#include "web/json/json.h"
|
||||
|
||||
|
||||
//**************************************************************************
|
||||
// WEB ENGINE
|
||||
//**************************************************************************
|
||||
|
@ -318,7 +319,6 @@ int web_engine::begin_request_handler(struct mg_connection *conn)
|
|||
return 0;
|
||||
}
|
||||
|
||||
|
||||
void *web_engine::websocket_keepalive()
|
||||
{
|
||||
while(!m_exiting_core)
|
||||
|
|
|
@ -1,6 +1,138 @@
|
|||
<a href="javascript:executeCommands('togglepause');" data-role="button">Toggle Pause</a>
|
||||
<a href="javascript:executeCommands('softreset');" data-role="button">Soft reset</a>
|
||||
<a href="javascript:executeCommands('hardreset');" data-role="button">Hard reset</a>
|
||||
<a href="javascript:loadContent('savestate');" data-transition="fade" data-role="button">Save State</a>
|
||||
<a href="javascript:loadContent('loadstate');" data-transition="fade" data-role="button">Load State</a>
|
||||
<a href="javascript:executeCommands('exit');" data-role="button">Exit</a>
|
||||
<a href="confirmsoftreset.html" data-rel="dialog" data-role="button">Soft reset</a>
|
||||
<a href="confirmhardreset.html" data-rel="dialog" data-role="button">Hard reset</a>
|
||||
<a href="#savestatepanel" data-transition="fade" data-role="button">Save State</a>
|
||||
<a href="#loadstatepanel" data-transition="fade" data-role="button">Load State</a>
|
||||
<a href="confirmexit.html" data-rel="dialog" data-role="button">Exit</a>
|
||||
|
||||
<div data-role="panel" id="savestatepanel" data-position="left" data-display="overlay" data-theme="a">
|
||||
<h3>Select position to save to</h3>
|
||||
|
||||
<!-- Yes, it's a little ugly. I could redo this more cleanly with a little javascript, but not right now. -->
|
||||
<div data-role="controlgroup" data-type="horizontal">
|
||||
<a href="" data-rel="close" data-role="button">Cancel</a>
|
||||
<a href="javascript:executeCommands('savestate&val=auto');" data-role="button">Autosave Slot</a>
|
||||
</div>
|
||||
<div data-role="controlgroup" data-type="horizontal">
|
||||
<a href="javascript:executeCommands('savestate&val=0');" data-role="button">0</a>
|
||||
<a href="javascript:executeCommands('savestate&val=1');" data-role="button">1</a>
|
||||
<a href="javascript:executeCommands('savestate&val=2');" data-role="button">2</a>
|
||||
<a href="javascript:executeCommands('savestate&val=3');" data-role="button">3</a>
|
||||
</div>
|
||||
<div data-role="controlgroup" data-type="horizontal">
|
||||
<a href="javascript:executeCommands('savestate&val=4');" data-role="button">4</a>
|
||||
<a href="javascript:executeCommands('savestate&val=5');" data-role="button">5</a>
|
||||
<a href="javascript:executeCommands('savestate&val=6');" data-role="button">6</a>
|
||||
<a href="javascript:executeCommands('savestate&val=7');" data-role="button">7</a>
|
||||
</div>
|
||||
<div data-role="controlgroup" data-type="horizontal">
|
||||
<a href="javascript:executeCommands('savestate&val=8');" data-role="button">8</a>
|
||||
<a href="javascript:executeCommands('savestate&val=9');" data-role="button">9</a>
|
||||
<a href="javascript:executeCommands('savestate&val=a');" data-role="button">A</a>
|
||||
<a href="javascript:executeCommands('savestate&val=b');" data-role="button">B</a>
|
||||
</div>
|
||||
<div data-role="controlgroup" data-type="horizontal">
|
||||
<a href="javascript:executeCommands('savestate&val=c');" data-role="button">C</a>
|
||||
<a href="javascript:executeCommands('savestate&val=d');" data-role="button">D</a>
|
||||
<a href="javascript:executeCommands('savestate&val=e');" data-role="button">E</a>
|
||||
<a href="javascript:executeCommands('savestate&val=f');" data-role="button">F</a>
|
||||
</div>
|
||||
<div data-role="controlgroup" data-type="horizontal">
|
||||
<a href="javascript:executeCommands('savestate&val=g');" data-role="button">G</a>
|
||||
<a href="javascript:executeCommands('savestate&val=h');" data-role="button">H</a>
|
||||
<a href="javascript:executeCommands('savestate&val=i');" data-role="button">I</a>
|
||||
<a href="javascript:executeCommands('savestate&val=j');" data-role="button">J</a>
|
||||
</div>
|
||||
<div data-role="controlgroup" data-type="horizontal">
|
||||
<a href="javascript:executeCommands('savestate&val=k');" data-role="button">K</a>
|
||||
<a href="javascript:executeCommands('savestate&val=l');" data-role="button">L</a>
|
||||
<a href="javascript:executeCommands('savestate&val=m');" data-role="button">M</a>
|
||||
<a href="javascript:executeCommands('savestate&val=n');" data-role="button">N</a>
|
||||
</div>
|
||||
<div data-role="controlgroup" data-type="horizontal">
|
||||
<a href="javascript:executeCommands('savestate&val=o');" data-role="button">O</a>
|
||||
<a href="javascript:executeCommands('savestate&val=p');" data-role="button">P</a>
|
||||
<a href="javascript:executeCommands('savestate&val=q');" data-role="button">Q</a>
|
||||
<a href="javascript:executeCommands('savestate&val=r');" data-role="button">R</a>
|
||||
</div>
|
||||
<div data-role="controlgroup" data-type="horizontal">
|
||||
<a href="javascript:executeCommands('savestate&val=s');" data-role="button">S</a>
|
||||
<a href="javascript:executeCommands('savestate&val=t');" data-role="button">T</a>
|
||||
<a href="javascript:executeCommands('savestate&val=u');" data-role="button">U</a>
|
||||
<a href="javascript:executeCommands('savestate&val=v');" data-role="button">V</a>
|
||||
</div>
|
||||
<div data-role="controlgroup" data-type="horizontal">
|
||||
<a href="javascript:executeCommands('savestate&val=w');" data-role="button">W</a>
|
||||
<a href="javascript:executeCommands('savestate&val=x');" data-role="button">X</a>
|
||||
<a href="javascript:executeCommands('savestate&val=y');" data-role="button">Y</a>
|
||||
<a href="javascript:executeCommands('savestate&val=z');" data-role="button">Z</a>
|
||||
</div>
|
||||
<!-- This is here to prevent webkit from trying to put the last row of states under the bottom menu on small screens like phone-->
|
||||
<br><br><br><br><br>
|
||||
</div>
|
||||
|
||||
<div data-role="panel" id="loadstatepanel" data-position="left" data-display="overlay" data-theme="a">
|
||||
<h3>Select position to load from</h3>
|
||||
|
||||
<!-- Yes, it's a little ugly. I could redo this more cleanly with a little javascript, but not right now. -->
|
||||
<div data-role="controlgroup" data-type="horizontal">
|
||||
<a href="" data-rel="close" data-role="button">Cancel</a>
|
||||
<a href="javascript:executeCommands('loadstate&val=auto');" data-role="button">Autoload Slot</a>
|
||||
</div>
|
||||
<div data-role="controlgroup" data-type="horizontal">
|
||||
<a href="javascript:executeCommands('loadstate&val=0');" data-role="button">0</a>
|
||||
<a href="javascript:executeCommands('loadstate&val=1');" data-role="button">1</a>
|
||||
<a href="javascript:executeCommands('loadstate&val=2');" data-role="button">2</a>
|
||||
<a href="javascript:executeCommands('loadstate&val=3');" data-role="button">3</a>
|
||||
</div>
|
||||
<div data-role="controlgroup" data-type="horizontal">
|
||||
<a href="javascript:executeCommands('loadstate&val=4');" data-role="button">4</a>
|
||||
<a href="javascript:executeCommands('loadstate&val=5');" data-role="button">5</a>
|
||||
<a href="javascript:executeCommands('loadstate&val=6');" data-role="button">6</a>
|
||||
<a href="javascript:executeCommands('loadstate&val=7');" data-role="button">7</a>
|
||||
</div>
|
||||
<div data-role="controlgroup" data-type="horizontal">
|
||||
<a href="javascript:executeCommands('loadstate&val=8');" data-role="button">8</a>
|
||||
<a href="javascript:executeCommands('loadstate&val=9');" data-role="button">9</a>
|
||||
<a href="javascript:executeCommands('loadstate&val=a');" data-role="button">A</a>
|
||||
<a href="javascript:executeCommands('loadstate&val=b');" data-role="button">B</a>
|
||||
</div>
|
||||
<div data-role="controlgroup" data-type="horizontal">
|
||||
<a href="javascript:executeCommands('loadstate&val=c');" data-role="button">C</a>
|
||||
<a href="javascript:executeCommands('loadstate&val=d');" data-role="button">D</a>
|
||||
<a href="javascript:executeCommands('loadstate&val=e');" data-role="button">E</a>
|
||||
<a href="javascript:executeCommands('loadstate&val=f');" data-role="button">F</a>
|
||||
</div>
|
||||
<div data-role="controlgroup" data-type="horizontal">
|
||||
<a href="javascript:executeCommands('loadstate&val=g');" data-role="button">G</a>
|
||||
<a href="javascript:executeCommands('loadstate&val=h');" data-role="button">H</a>
|
||||
<a href="javascript:executeCommands('loadstate&val=i');" data-role="button">I</a>
|
||||
<a href="javascript:executeCommands('loadstate&val=j');" data-role="button">J</a>
|
||||
</div>
|
||||
<div data-role="controlgroup" data-type="horizontal">
|
||||
<a href="javascript:executeCommands('loadstate&val=k');" data-role="button">K</a>
|
||||
<a href="javascript:executeCommands('loadstate&val=l');" data-role="button">L</a>
|
||||
<a href="javascript:executeCommands('loadstate&val=m');" data-role="button">M</a>
|
||||
<a href="javascript:executeCommands('loadstate&val=n');" data-role="button">N</a>
|
||||
</div>
|
||||
<div data-role="controlgroup" data-type="horizontal">
|
||||
<a href="javascript:executeCommands('loadstate&val=o');" data-role="button">O</a>
|
||||
<a href="javascript:executeCommands('loadstate&val=p');" data-role="button">P</a>
|
||||
<a href="javascript:executeCommands('loadstate&val=q');" data-role="button">Q</a>
|
||||
<a href="javascript:executeCommands('loadstate&val=r');" data-role="button">R</a>
|
||||
</div>
|
||||
<div data-role="controlgroup" data-type="horizontal">
|
||||
<a href="javascript:executeCommands('loadstate&val=s');" data-role="button">S</a>
|
||||
<a href="javascript:executeCommands('loadstate&val=t');" data-role="button">T</a>
|
||||
<a href="javascript:executeCommands('loadstate&val=u');" data-role="button">U</a>
|
||||
<a href="javascript:executeCommands('loadstate&val=v');" data-role="button">V</a>
|
||||
</div>
|
||||
<div data-role="controlgroup" data-type="horizontal">
|
||||
<a href="javascript:executeCommands('loadstate&val=w');" data-role="button">W</a>
|
||||
<a href="javascript:executeCommands('loadstate&val=x');" data-role="button">X</a>
|
||||
<a href="javascript:executeCommands('loadstate&val=y');" data-role="button">Y</a>
|
||||
<a href="javascript:executeCommands('loadstate&val=z');" data-role="button">Z</a>
|
||||
</div>
|
||||
<!-- This is here to prevent webkit from trying to put the last row of states under the bottom menu on small screens like phone-->
|
||||
<br><br><br><br><br>
|
||||
</div>
|
||||
|
|
|
@ -25,13 +25,14 @@
|
|||
{
|
||||
document.getElementById('main').innerHTML = '<center><img src="/screenshot.png"/></center>';
|
||||
}
|
||||
|
||||
|
||||
function loadContent(htmlName)
|
||||
{
|
||||
$("#main").load(htmlName+'.html', function () {
|
||||
$(this).trigger('create');
|
||||
});
|
||||
}
|
||||
|
||||
function executeCommands(command)
|
||||
{
|
||||
$.ajax({
|
||||
|
@ -44,6 +45,24 @@
|
|||
});
|
||||
}
|
||||
|
||||
function executeHardReset()
|
||||
{
|
||||
executeCommands("hardreset");
|
||||
$('.ui-dialog').dialog('close');
|
||||
}
|
||||
|
||||
function executeSoftReset()
|
||||
{
|
||||
executeCommands("softreset");
|
||||
$('.ui-dialog').dialog('close');
|
||||
}
|
||||
|
||||
function executeExit()
|
||||
{
|
||||
executeCommands("exit");
|
||||
$('.ui-dialog').dialog('close');
|
||||
}
|
||||
|
||||
function executeSlider()
|
||||
{
|
||||
$.ajax({
|
||||
|
|
Loading…
Reference in a new issue