Build Your Own Arcade Controls Forum

Main => Software Forum => Topic started by: electricd on January 25, 2006, 09:46:24 am

Title: Question on editing Mame.C....
Post by: electricd on January 25, 2006, 09:46:24 am
Hello,

I usually edit my Mame.c file to remove the nags by changing the "if" statements to "if(1)".  What I really want to do is make it so I can have an option in mame.ini to turn each nag on and off.  I know there is an option for "skip_gameinfo" in version 103, but it looks like the "skip_disclaimer" has been removed?  Anyway, I would love to have 3 options in mame.ini, 1. skip_gameinfo, 2. skip_warnings, and 3. skip_disclaimer.  Is there an easy way to get Mame to like these settings?  The lines in question in Mame.c are:

   /* if we didn't find a settings file, show the disclaimer */
   if (settingsloaded || options.skip_disclaimer || ui_display_copyright(artwork_get_ui_bitmap()) == 0)
   {
      /* show info about incorrect behaviour (wrong colors etc.) */
      if (options.skip_warnings || ui_display_game_warnings(artwork_get_ui_bitmap()) == 0)
      {
         /* show info about the game */
         if (options.skip_gameinfo || ui_display_game_info(artwork_get_ui_bitmap()) == 0)

Thanks so much in advance!!
Title: Re: Question on editing Mame.C....
Post by: electricd on January 25, 2006, 10:02:24 am
Looks like Alank2 used to implement the skip_warnings, but i downloaded his latest .103 edits, and its not in there anymore.  From one of his old posts:

-[no]skip_warnings / -[no]sw (default disabled) will skip game warnings.
This is useful for skipping warnings like "The video emulation isn't 100%
accurate.", but keep in mind that it will also skip more serious warnings
such as "This game doesn't work properly.".  It might be best to enable this
option for specific games that you want to skip the warnings on instead of
enabling it globally.

Alank2, can you help a brotha out?
Title: Re: Question on editing Mame.C....
Post by: JoyMonkey on January 25, 2006, 11:02:54 am
   /* if we didn't find a settings file, show the disclaimer */
   if (settingsloaded || options.skip_disclaimer || ui_display_copyright(artwork_get_ui_bitmap()) == 0)
   {
      /* show info about incorrect behaviour (wrong colors etc.) */
      if (options.skip_warnings || ui_display_game_warnings(artwork_get_ui_bitmap()) == 0)
      {
         /* show info about the game */
         if (options.skip_gameinfo || ui_display_game_info(artwork_get_ui_bitmap()) == 0)

Probably won't help, but did you try replacing 'settingsloaded' with 'options.skip_disclaimer' ?
Title: Re: Question on editing Mame.C....
Post by: electricd on January 25, 2006, 11:13:06 am
No i didn't try it...im not really a C guy...more of a VB guy.

 if (settingsloaded || options.skip_disclaimer || ui_display_copyright(artwork_get_ui_bitmap()) == 0)

I understand this to read if settingsloaded = FALSE AND option.skip_disclaimer = FALSE then ui_display_copyright.  Is this accurate?
Title: Re: Question on editing Mame.C....
Post by: Farmboy90 on January 25, 2006, 11:15:10 am
Well from a very quick poke in the code I would think you need to add a couple of entries to the options array in config.c (under mame\src\windows).  Here is a snippet with the interesting line highlighted.

   /* misc */
   { "Mame CORE misc options", NULL, rc_seperator, NULL, NULL, 0, 0, NULL, NULL },
   { "artwork", "art", rc_bool, &use_artwork, "1", 0, 0, NULL, "use additional " GAMENOUN " artwork (sets default for specific options below)" },
   { "use_backdrops", "backdrop", rc_bool, &use_backdrops, "1", 0, 0, NULL, "use backdrop artwork" },
   { "use_overlays", "overlay", rc_bool, &use_overlays, "1", 0, 0, NULL, "use overlay artwork" },
   { "use_bezels", "bezel", rc_bool, &use_bezels, "1", 0, 0, NULL, "use bezel artwork" },
   { "artwork_crop", "artcrop", rc_bool, &options.artwork_crop, "0", 0, 0, NULL, "crop artwork to " GAMENOUN " screen only" },
   { "artwork_resolution", "artres", rc_int, &options.artwork_res, "0", 0, 0, NULL, "artwork resolution (0 for auto)" },
   { "cheat", "c", rc_bool, &options.cheat, "0", 0, 0, NULL, "enable/disable cheat subsystem" },
   { "debug", "d", rc_bool, &options.mame_debug, "0", 0, 0, NULL, "enable/disable debugger (only if available)" },
   { "debugscript", NULL, rc_string, &debugscript, NULL, 0, 0, NULL, "script for debugger (only if available)" },
   { "playback", "pb", rc_string, &playbackname, NULL, 0, 0, NULL, "playback an input file" },
   { "record", "rec", rc_string, &recordname, NULL, 0, 0, NULL, "record an input file" },
   { "log", NULL, rc_bool, &errorlog, "0", 0, 0, init_errorlog, "generate error.log" },
   { "oslog", NULL, rc_bool, &erroroslog, "0", 0, 0, NULL, "output error log to debugger" },
   { "skip_gameinfo", NULL, rc_bool, &options.skip_gameinfo, "0", 0, 0, NULL, "skip displaying the " GAMENOUN " info screen" },
   { "bios", NULL, rc_string, &options.bios, "default", 0, 14, NULL, "change system bios" },
   { "state", NULL, rc_string, &statename, NULL, 0, 0, NULL, "state to load" },
   { "autosave", NULL, rc_bool, &options.auto_save, "0", 0, 0, NULL, "enable automatic restore at startup and save at exit" },


In mame.c the variables are still declared and available:

struct _global_options
...
...
   int    skip_disclaimer;   /* 1 to skip the disclaimer screen at startup */
   int    skip_gameinfo;      /* 1 to skip the game info screen at startup */
   int    skip_warnings;      /* 1 to skip the warnings screen at startup */
...
...

So you don't need to add the variables.  You should just add new rows to the struct up above similar to the highlighted line.  Recompile and test.

Let me know if it works.  :)

Title: Re: Question on editing Mame.C....
Post by: Farmboy90 on January 25, 2006, 11:18:26 am
No i didn't try it...im not really a C guy...more of a VB guy.

 if (settingsloaded || options.skip_disclaimer || ui_display_copyright(artwork_get_ui_bitmap()) == 0)

I understand this to read if settingsloaded = FALSE AND option.skip_disclaimer = FALSE then ui_display_copyright.  Is this accurate?

It is not accurate.  That line is saying that if you loaded the settings for this game (implying you played this game before and the message was already displayed) the message will not be displayed.  If settings were not loaded (first time playing this game) then check if the skip_discalimer flag is set.  If that is set then the copyright won't be displayed either.  If it is not set, then the copyright will be displayed.

Semantically it says:
if settingsloaded = TRUE OR options.skip_disclaimer = TRUE OR ui_display_copyright(...) returns 0 THEN...

It is actually coded in kind of a funny way.  A more straightforward way to do it would be to move the ui_display_copyright call to be the first line inside the if statment, and then check the two other flags against 0 instead of 1 like they are now.

Title: Re: Question on editing Mame.C....
Post by: electricd on January 25, 2006, 11:21:13 am
Ahh...ok then then that makes perfect sense...and since the skip_disclaimer is not available by default, it is always false, hence if the settings are not loaded it will fail the second test and show the copyright.....thanks!  I am going to try out your method and see how it works!
Title: Re: Question on editing Mame.C....
Post by: Farmboy90 on January 25, 2006, 11:24:53 am
Yeah try adding two lines like this:

  { "skip_warnings", NULL, rc_bool, &options.skip_warnings, "0", 0, 0, NULL, "skip displaying the " GAMENOUN " warnings screen" },
  { "skip_disclaimer", NULL, rc_bool, &options.skip_discalimer, "0", 0, 0, NULL, "skip displaying the " GAMENOUN " disclaimer screen" },
Title: Re: Question on editing Mame.C....
Post by: electricd on January 25, 2006, 11:30:23 am
compiling....
Title: Re: Question on editing Mame.C....
Post by: electricd on January 25, 2006, 11:39:03 am
Ok keep in mind i am new at editing and troubleshooting C code.  Here is the error I get on compile:

src/windows/config.c:228: error: structure has no member named `skip_discalimer'

src/windows/config.c:228: error: initializer element is not constant
src/windows/config.c:228: error: (near initialization for `opts[47].dest')
src/windows/config.c:228: error: initializer element is not constant
src/windows/config.c:228: error: (near initialization for `opts[47]')
src/windows/config.c:229: error: initializer element is not constant
src/windows/config.c:229: error: (near initialization for `opts[48]')
src/windows/config.c:230: error: initializer element is not constant
src/windows/config.c:230: error: (near initialization for `opts[49]')
src/windows/config.c:231: error: initializer element is not constant
src/windows/config.c:231: error: (near initialization for `opts[50]')
src/windows/config.c:234: error: initializer element is not constant
src/windows/config.c:234: error: (near initialization for `opts[51]')
src/windows/config.c:235: error: initializer element is not constant
src/windows/config.c:235: error: (near initialization for `opts[52]')
src/windows/config.c:236: error: initializer element is not constant
src/windows/config.c:236: error: (near initialization for `opts[53]')
src/windows/config.c:237: error: initializer element is not constant
src/windows/config.c:237: error: (near initialization for `opts[54]')
src/windows/config.c:238: error: initializer element is not constant
src/windows/config.c:238: error: (near initialization for `opts[55]')
src/windows/config.c:239: error: initializer element is not constant
src/windows/config.c:239: error: (near initialization for `opts[56]')
src/windows/config.c:240: error: initializer element is not constant
src/windows/config.c:240: error: (near initialization for `opts[57]')
make: *** [obj/mame/windows/config.o] Error 1

Sounds like maybe I need to define the new options somewhere??
Title: Re: Question on editing Mame.C....
Post by: electricd on January 25, 2006, 11:40:39 am
Oops...letter transposed it looks like...trying again :)
Title: Re: Question on editing Mame.C....
Post by: Farmboy90 on January 25, 2006, 11:54:30 am
Oops...letter transposed it looks like...trying again :)

Sorry, I can't spell.  :)  That is why they make compilers.   ;D
Title: Re: Question on editing Mame.C....
Post by: electricd on January 25, 2006, 01:08:47 pm
Finished compiling and it works great!  Thanks for the help all.  Now I can set the options I want in my mame.ini! 
Title: Re: Question on editing Mame.C....
Post by: Farmboy90 on January 25, 2006, 01:10:57 pm
Finished compiling and it works great!  Thanks for the help all.  Now I can set the options I want in my mame.ini! 

Sweet!  I was thinking of doing that myself.  Never got around to it.  Glad to hear it works though.  :)