Main Restorations Software Audio/Jukebox/MP3 Everything Else Buy/Sell/Trade
Project Announcements Monitor/Video GroovyMAME Merit/JVL Touchscreen Meet Up Retail Vendors
Driving & Racing Woodworking Software Support Forums Consoles Project Arcade Reviews
Automated Projects Artwork Frontend Support Forums Pinball Forum Discussion Old Boards
Raspberry Pi & Dev Board controls.dat Linux Miscellaneous Arcade Wiki Discussion Old Archives
Lightguns Arcade1Up Try the site in https mode Site News

Unread posts | New Replies | Recent posts | Rules | Chatroom | Wiki | File Repository | RSS | Submit news

  

Author Topic: Assign a key to a non-configurable option  (Read 1788 times)

0 Members and 1 Guest are viewing this topic.

Stormrider

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 318
  • Last login:September 28, 2014, 11:01:54 am
Assign a key to a non-configurable option
« 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?

Thenasty

  • Trade Count: (+17)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 4420
  • Last login:July 24, 2025, 06:20:12 pm
    • Thenasty's Arcademania Horizontal/Vertical monitor setup.
Re: Assign a key to a non-configurable option
« Reply #1 on: October 19, 2009, 08:11:23 am »
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.
Thenasty's Arcademania Horizontal/Vertical setup.
http://forum.arcadecontrols.com/index.php?topic=26696.0

Free VGA Breakout Cable
http://forum.arcadecontrols.com/index.php?topic=38228.0

Ultimate All in One Coin Mech write up (Make your own)
http://forum.arcadecontrols.com/index.php?topic=19200.0

Stormrider

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 318
  • Last login:September 28, 2014, 11:01:54 am
Re: Assign a key to a non-configurable option
« Reply #2 on: October 19, 2009, 09:04:34 am »
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.

Stormrider

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 318
  • Last login:September 28, 2014, 11:01:54 am
Re: Assign a key to a non-configurable option
« Reply #3 on: October 20, 2009, 04:20:58 am »
I'm sorry to say that it didn't work (error compiling ui.c).

Stormrider

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 318
  • Last login:September 28, 2014, 11:01:54 am
Re: Assign a key to a non-configurable option
« Reply #4 on: October 22, 2009, 06:01:28 pm »
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.