preps for slider work (nw)
This commit is contained in:
parent
a485774811
commit
71e5f10d78
@ -395,6 +395,9 @@ int running_machine::run(bool firstrun)
|
|||||||
nvram_load(*this);
|
nvram_load(*this);
|
||||||
sound().ui_mute(false);
|
sound().ui_mute(false);
|
||||||
|
|
||||||
|
// initialize ui lists
|
||||||
|
ui_initialize(*this);
|
||||||
|
|
||||||
// display the startup screens
|
// display the startup screens
|
||||||
ui_display_startup_screens(*this, firstrun, !settingsloaded);
|
ui_display_startup_screens(*this, firstrun, !settingsloaded);
|
||||||
|
|
||||||
|
13
src/emu/ui.c
13
src/emu/ui.c
@ -304,6 +304,16 @@ static void ui_exit(running_machine &machine)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*-------------------------------------------------
|
||||||
|
ui_initialize - initialize ui lists
|
||||||
|
-------------------------------------------------*/
|
||||||
|
|
||||||
|
void ui_initialize(running_machine &machine)
|
||||||
|
{
|
||||||
|
/* initialize the on-screen display system */
|
||||||
|
slider_list = slider_current = slider_init(machine);
|
||||||
|
}
|
||||||
|
|
||||||
/*-------------------------------------------------
|
/*-------------------------------------------------
|
||||||
ui_display_startup_screens - display the
|
ui_display_startup_screens - display the
|
||||||
various startup screens
|
various startup screens
|
||||||
@ -322,9 +332,6 @@ int ui_display_startup_screens(running_machine &machine, int first_time, int sho
|
|||||||
if (!first_time || (str > 0 && str < 60*5) || &machine.system() == &GAME_NAME(___empty) || (machine.debug_flags & DEBUG_FLAG_ENABLED) != 0)
|
if (!first_time || (str > 0 && str < 60*5) || &machine.system() == &GAME_NAME(___empty) || (machine.debug_flags & DEBUG_FLAG_ENABLED) != 0)
|
||||||
show_gameinfo = show_warnings = show_disclaimer = FALSE;
|
show_gameinfo = show_warnings = show_disclaimer = FALSE;
|
||||||
|
|
||||||
/* initialize the on-screen display system */
|
|
||||||
slider_list = slider_current = slider_init(machine);
|
|
||||||
|
|
||||||
/* loop over states */
|
/* loop over states */
|
||||||
ui_set_handler(handler_ingame, 0);
|
ui_set_handler(handler_ingame, 0);
|
||||||
for (state = 0; state < maxstate && !machine.scheduled_event_pending() && !ui_menu::stack_has_special_main_menu(); state++)
|
for (state = 0; state < maxstate && !machine.scheduled_event_pending() && !ui_menu::stack_has_special_main_menu(); state++)
|
||||||
|
@ -122,6 +122,9 @@ struct slider_state
|
|||||||
/* main init/exit routines */
|
/* main init/exit routines */
|
||||||
int ui_init(running_machine &machine);
|
int ui_init(running_machine &machine);
|
||||||
|
|
||||||
|
/* initialize ui lists */
|
||||||
|
void ui_initialize(running_machine &machine);
|
||||||
|
|
||||||
/* display the startup screens */
|
/* display the startup screens */
|
||||||
int ui_display_startup_screens(running_machine &machine, int first_time, int show_disclaimer);
|
int ui_display_startup_screens(running_machine &machine, int first_time, int show_disclaimer);
|
||||||
|
|
||||||
|
@ -39,6 +39,7 @@
|
|||||||
|
|
||||||
#include "emu.h"
|
#include "emu.h"
|
||||||
#include "emuopts.h"
|
#include "emuopts.h"
|
||||||
|
#include "ui.h"
|
||||||
#include "webengine.h"
|
#include "webengine.h"
|
||||||
#include "web/mongoose.h"
|
#include "web/mongoose.h"
|
||||||
#include "web/json/json.h"
|
#include "web/json/json.h"
|
||||||
@ -75,13 +76,7 @@ static void get_qsvar(const struct mg_request_info *request_info,
|
|||||||
mg_get_var(qs, strlen(qs == NULL ? "" : qs), name, dst, dst_len);
|
mg_get_var(qs, strlen(qs == NULL ? "" : qs), name, dst, dst_len);
|
||||||
}
|
}
|
||||||
|
|
||||||
// This function will be called by mongoose on every new request.
|
int web_engine::json_game_handler(struct mg_connection *conn)
|
||||||
int web_engine::begin_request_handler(struct mg_connection *conn)
|
|
||||||
{
|
|
||||||
const struct mg_request_info *request_info = mg_get_request_info(conn);
|
|
||||||
if (!strncmp(request_info->uri, "/json/",6))
|
|
||||||
{
|
|
||||||
if (!strcmp(request_info->uri, "/json/game"))
|
|
||||||
{
|
{
|
||||||
Json::Value data;
|
Json::Value data;
|
||||||
data["name"] = m_machine->system().name;
|
data["name"] = m_machine->system().name;
|
||||||
@ -107,6 +102,57 @@ int web_engine::begin_request_handler(struct mg_connection *conn)
|
|||||||
// the client, and mongoose should not send client any more data.
|
// the client, and mongoose should not send client any more data.
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int web_engine::json_slider_handler(struct mg_connection *conn)
|
||||||
|
{
|
||||||
|
const slider_state *curslider;
|
||||||
|
astring tempstring;
|
||||||
|
|
||||||
|
/* add all sliders */
|
||||||
|
for (curslider = ui_get_slider_list(); curslider != NULL; curslider = curslider->next)
|
||||||
|
{
|
||||||
|
INT32 curval = (*curslider->update)(machine(), curslider->arg, &tempstring, SLIDER_NOCHANGE);
|
||||||
|
printf("%d\n",curval);
|
||||||
|
/* UINT32 flags = 0;
|
||||||
|
if (curval > curslider->minval)
|
||||||
|
flags |= MENU_FLAG_LEFT_ARROW;
|
||||||
|
if (curval < curslider->maxval)
|
||||||
|
flags |= MENU_FLAG_RIGHT_ARROW;
|
||||||
|
item_append(curslider->description, tempstring, flags, (void *)curslider);
|
||||||
|
|
||||||
|
if (menuless_mode)
|
||||||
|
break;*/
|
||||||
|
}
|
||||||
|
|
||||||
|
/* add all sliders */
|
||||||
|
for (curslider = (slider_state*)machine().osd().get_slider_list(); curslider != NULL; curslider = curslider->next)
|
||||||
|
{
|
||||||
|
INT32 curval = (*curslider->update)(machine(), curslider->arg, &tempstring, SLIDER_NOCHANGE);
|
||||||
|
printf("%d\n",curval);
|
||||||
|
/*UINT32 flags = 0;
|
||||||
|
if (curval > curslider->minval)
|
||||||
|
flags |= MENU_FLAG_LEFT_ARROW;
|
||||||
|
if (curval < curslider->maxval)
|
||||||
|
flags |= MENU_FLAG_RIGHT_ARROW;
|
||||||
|
item_append(curslider->description, tempstring, flags, (void *)curslider);*/
|
||||||
|
}
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
// This function will be called by mongoose on every new request.
|
||||||
|
int web_engine::begin_request_handler(struct mg_connection *conn)
|
||||||
|
{
|
||||||
|
const struct mg_request_info *request_info = mg_get_request_info(conn);
|
||||||
|
if (!strncmp(request_info->uri, "/json/",6))
|
||||||
|
{
|
||||||
|
if (!strcmp(request_info->uri, "/json/game"))
|
||||||
|
{
|
||||||
|
return json_game_handler(conn);
|
||||||
|
}
|
||||||
|
if (!strcmp(request_info->uri, "/json/slider"))
|
||||||
|
{
|
||||||
|
return json_slider_handler(conn);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else if (!strncmp(request_info->uri, "/cmd",4))
|
else if (!strncmp(request_info->uri, "/cmd",4))
|
||||||
{
|
{
|
||||||
|
@ -61,6 +61,12 @@ public:
|
|||||||
int websocket_data_handler(struct mg_connection *conn, int flags, char *data, size_t data_len);
|
int websocket_data_handler(struct mg_connection *conn, int flags, char *data, size_t data_len);
|
||||||
int begin_request_handler(struct mg_connection *conn);
|
int begin_request_handler(struct mg_connection *conn);
|
||||||
void *websocket_keepalive();
|
void *websocket_keepalive();
|
||||||
|
protected:
|
||||||
|
// getters
|
||||||
|
running_machine &machine() const { return *m_machine; }
|
||||||
|
|
||||||
|
int json_game_handler(struct mg_connection *conn);
|
||||||
|
int json_slider_handler(struct mg_connection *conn);
|
||||||
private:
|
private:
|
||||||
// internal state
|
// internal state
|
||||||
emu_options & m_options;
|
emu_options & m_options;
|
||||||
|
Loading…
Reference in New Issue
Block a user