Build Your Own Arcade Controls Forum
Main => Software Forum => Topic started by: Stormrider on October 18, 2009, 07:39:53 am
-
Any expert on mame source code can tell me if it's possible to modify a key to call a function which is not configurable from the tab menus?
If we take a look at ui.c we can see this:
/* if the on-screen display isn't up and the user has toggled it, turn it on */
if ((machine->debug_flags & DEBUG_FLAG_ENABLED) == 0 && ui_input_pressed(machine, IPT_UI_ON_SCREEN_DISPLAY))
return ui_set_handler(ui_slider_ui_handler, 1);
If I replace the last line with other lines I found in that file I can change the behaviour of the ~ key, for instance to show the save game dialogue, exit the emulator, etc. However, I have not been able to change it to show the overclock slider, and I've tried hundreds of combinations.
This, for instance, doesn't work, and nothing similar:
return ui_set_handler(slider_overclock, 1);
Maybe I should try this tweak in any other file? input.c, for instance?
-
I'm just a BASIC High level know some only programming, but maybe you can try:
"This, for instance, doesn't work, and nothing similar:"
return ui_set_handler(slider_overclock, 1);
to
return ui_set_handler(slider_set_overclock, 1);
or maybe you haved already.
-
Thanx a lot for the reply. I'll try that as soon as I arrive home. For me, reading C is more or less like reading a text in Chinese. The comments and some words in English help a little. The rest is just a matter of guessing and trying. I wonder where I can learn the basics. That would help.
-
I'm sorry to say that it didn't work (error compiling ui.c).
-
I'll tell you how I've managed to change the ~ key (of the button you have configured) from the master volume (useless function that I never use) to the overclock slider. After some days trying without success, I've just found a very simple solution.
In ui.c change, under the section called
/*-------------------------------------------------
slider_init - initialize the list of slider
controls
-------------------------------------------------*/
move this
/* add CPU overclocking (cheat only) */
if (options_get_bool(mame_options(), OPTION_CHEAT))
{
for (device = machine->firstcpu; device != NULL; device = cpu_next(device))
{
void *param = (void *)device;
astring_printf(string, "Overclock CPU %s", device->tag);
*tailptr = slider_alloc(machine, astring_c(string), 1, 1000, 2000, 50, slider_overclock, param);
tailptr = &(*tailptr)->next;
}
}
before
/* add overall volume */
*tailptr = slider_alloc(machine, "Master Volume", -32, 0, 0, 1, slider_volume, NULL);
tailptr = &(*tailptr)->next;
So, moving the overclock slider to the first position in ui.c means that it appears in the first position of the slider controls, and the ~ key simply calls the first slider.