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: CPWizard bezel diff for recent MAME  (Read 8091 times)

0 Members and 1 Guest are viewing this topic.

frl

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 25
  • Last login:December 11, 2016, 07:20:35 am
CPWizard bezel diff for recent MAME
« on: December 24, 2011, 08:58:07 am »
Hi all,

I'm trying to compile a custom version of MAME v0.142 to include the original bezel patch provided with CPWizard as this will give me just the solution I need to making my cab easier to use for visitors over the holidays (I can hear the complaints about buttons not doing what they should already ;) )

It looks to be a pretty simple diff but the source code has changed quite a bit since the diff was originally written and my coding skills are nowhere near where they need to be to untangle it.  I've established that the pause code has moved from mame.c to machine.c, and that the names of the render targets have changed, but my (admitedly pretty feeble) efforts to piece it all together have failed.

I'm hoping someone reading this may have already updated the patch for a more recent version, or perhaps could give me a few pointers on where I might be going wrong.  I've pasted the relevant section of my modified machine.c below and the original diff is attached.

The errors I get are "'target_by_index' was not declared in this scope" and the same for the other render targets I've tried to change to match their new names.

Appreciate any help, and Happy Christmas!

Chris

Code: [Select]
void running_machine::pause()
{
        // CP MOD 1 START
render_target *target = target_by_index(0);
// CP MOD 1 END
 
// ignore if nothing has changed
if (m_paused)
return;
m_paused = true;

// CP MOD 2 START
  if (m_paused)
  {
  const char *name = view_by_index(target, 1);
  if(strcmp("Show CP", name) == 0)
  set_view(target, 1);
  }
  else
  {
  const char *name = view_by_index(target, 0);
  if(strcmp("Hide CP", name) == 0)
  set_view(target, 0);
  }
// CP MOD 2 END

// call the callbacks
call_notifiers(MACHINE_NOTIFY_PAUSE);
}

frl

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 25
  • Last login:December 11, 2016, 07:20:35 am
Re: CPWizard bezel diff for recent MAME
« Reply #1 on: December 28, 2011, 12:11:29 pm »
I hate to reply to my own post but I think I'm making progress but could really use a hand on the final couple of bits...

I have, I think got the "target_by_index" line worked out in machine.c in the 0142 source.  The only thing I can't figure is how to reference view_by_index and set_view from machine.c (see below where indicated with '????').  I thought maybe m_curview but didn't have any joy with that.

I would really appreciate any pointers anyone could give me!

Thanks,
Chris


Code: [Select]
void running_machine::pause()
{
// new line from bezel_0121.diff
render_target *target = m_render->target_by_index(0);

// ignore if nothing has changed
if (m_paused)
return;
m_paused = true;

// new stuff from bezel_0121.diff
if(m_paused)
  {
const char *name = ????->view_by_index(target, 1);
  if(strcmp("Show CP", name) == 0)
  ????->set_view(target, 1);
  }
  else
  {
  const char *name = ????->view_by_index(target, 0);
  if(strcmp("Hide CP", name) == 0)
  ????->set_view(target, 0);
  }
// end new stuff from bezel_0121.diff

// call the callbacks
call_notifiers(MACHINE_NOTIFY_PAUSE);
}

frl

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 25
  • Last login:December 11, 2016, 07:20:35 am
Re: CPWizard bezel diff for recent MAME
« Reply #2 on: January 01, 2012, 05:29:33 pm »
Finally got this working (I think) so I thought I'd post the diff here on the off chance any one else could make use of it.  It does pretty much the same thing as headkaze's original bezel patches as far as my ropey coding skills allow and works on .144. 

If you have a CPWizard bezel view configured and named "Show CP", it will show when paused and return to the default view when unpaused.  It will not save the selected view to the game's .cfg file on exit as I had issues with always saving the CP view.  It also doesn't "remember" the view you were on before pausing as headkaze's later patches do as I couldn't figure that out.

Anyway, hope it's of use to someone.

Cheers,
Chris

Triangel7D

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 128
  • Last login:September 10, 2017, 01:06:09 pm
Re: CPWizard bezel diff for recent MAME
« Reply #3 on: April 06, 2012, 06:06:12 pm »
frl,

Just wanted to post to say your efforts are appreciated!!! I couldn't get the bezel_0129 patch to compile with MAME and then I found this thread.

One question: I thought that when I pause MAME (without CPWizard running) the control panel should pop up. It does not on my end. Is there a setting I'm missing?

Triangel7D

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 128
  • Last login:September 10, 2017, 01:06:09 pm
Re: CPWizard bezel diff for recent MAME
« Reply #4 on: April 06, 2012, 08:20:01 pm »
Got it to work. Bezels have to be enabled (and enabled globally).

You should share your work with Headkaze so he can post it on the CPWizard site!

frl

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 25
  • Last login:December 11, 2016, 07:20:35 am
Re: CPWizard bezel diff for recent MAME
« Reply #5 on: April 07, 2012, 02:34:07 am »
Thanks Triangel, good to know someone else got use of it :)

headkaze

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 2943
  • Last login:August 14, 2023, 02:00:48 am
  • 0x2b|~0x2b?
Re: CPWizard bezel diff for recent MAME
« Reply #6 on: April 07, 2012, 07:39:41 pm »
Thanks for this frl. I've been meaning to get around to updating the bezel patch but I've been so busy. I'll put this up on the CPWizard website for others to download.  :cheers:

Howard_Casto

  • Idiot Police
  • Trade Count: (+1)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 19400
  • Last login:April 21, 2024, 11:59:54 pm
  • Your Post's Soul is MINE!!! .......Again??
    • The Dragon King
Re: CPWizard bezel diff for recent MAME
« Reply #7 on: April 10, 2012, 12:08:31 pm »
I think we need to just go ahead and submit a bit of source code to mame at this point.  You can already toggle through various art views within mame on the fly and automagically load a specific view on a specific monitor via command line options, so adding a few keys to toggle a specific view or to cycle between views would hardly add any bloat to mame's source.

BillPlowman

  • Trade Count: (0)
  • Jr. Member
  • **
  • Offline Offline
  • Posts: 2
  • Last login:August 09, 2013, 09:39:46 am
Re: CPWizard bezel diff for recent MAME
« Reply #8 on: March 05, 2013, 04:45:01 pm »
I too, would like to offer frl my thanks for this post! If anyone's interested, this patch seems to work fine with MAME .148. Thanks also to Howard and headkaze for developing this stuff in the first place.

If there are any other noobs, like myself, who would like to compile MAME to display the control panel layout when a game is paused, I did the following:

1. Use CPWizard http://headsoft.com.au/index.php?category=cpwizard to create your control panel layout and export the bezel images for MAME. Pretty straightforward - I found everything I needed to know in the CPWizard Help file.

2. Download the "ShowCP.zip" file in this thread.

3. Patch and compile MAME using Mr. Do's guide found here: http://mrdo.mameworld.info/compile.php

Having no idea what I was doing, I followed these instructions to the letter and had no issues compiling MAME .148 64-bit in Windows 7.  :D

Hope it helps!

frl

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 25
  • Last login:December 11, 2016, 07:20:35 am
Re: CPWizard bezel diff for recent MAME
« Reply #9 on: December 23, 2013, 08:28:47 am »
I always seem to end up fiddling with this stuff over Christmas!

I've updated my update of headkaze's original bezel patch so it now pretty much has the same functionality as headkaze's later versions and works on .151 source.  It now remembers the view you were previously on when you unpause, and it also writes the view you're on to the rom's cfg file when you quit so it will be retained on next start.  As before you just need the bezel images and layouts as generated by CPWizard.

A note on something to try and avoid - try not to exit the rom whilst paused as this will clear any view setting from the rom's cfg file and set you back to the default view for that rom.

diff attached..

Cheers,
Chris


headkaze

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 2943
  • Last login:August 14, 2023, 02:00:48 am
  • 0x2b|~0x2b?
Re: CPWizard bezel diff for recent MAME
« Reply #10 on: December 26, 2013, 05:06:13 pm »
I always seem to end up fiddling with this stuff over Christmas!

Happens to me every year  ;D

Thanks again for the patch update. I'll put it on the site as soon as I can  :cheers:

frl

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 25
  • Last login:December 11, 2016, 07:20:35 am
Re: CPWizard bezel diff for recent MAME
« Reply #11 on: June 06, 2014, 05:16:08 pm »
Not quite Christmas yet, but here's an updated bezel patch for .153  :)

Cheers,
Chris

headkaze

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 2943
  • Last login:August 14, 2023, 02:00:48 am
  • 0x2b|~0x2b?
Re: CPWizard bezel diff for recent MAME
« Reply #12 on: June 07, 2014, 01:50:29 am »
Not quite Christmas yet, but here's an updated bezel patch for .153  :)

Thanks again frl, you da man! :cheers:

PS Added it to the website

frl

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 25
  • Last login:December 11, 2016, 07:20:35 am
Re: CPWizard bezel diff for recent MAME
« Reply #13 on: June 07, 2014, 03:31:06 am »
No worries at all headkaze, I'm glad to be able to give some small thing back!

FreddieD

  • Trade Count: (0)
  • Jr. Member
  • **
  • Offline Offline
  • Posts: 3
  • Last login:April 26, 2022, 09:52:07 pm
Re: CPWizard bezel diff for recent MAME
« Reply #14 on: June 14, 2014, 10:36:16 am »
Thank you guys so much, this is just what I was looking for!  A few quick notes for anybody googling this.  There are a few little bits that I think others find trivially simple, but took me a little bit to figure out.

- When running MAME 0.153, don't apply patches cumulatively (i.e. bezel_0144, then ShowCP0151, then ShowCP153), just apply patch bezel_1044 then ShowCP153.  Applying all three will cause a linkage error when you try to compile.
- After building all of the bezels in CPWizard, place them in your MAME's artwork directory.  I had never worked with bezel artwork before so it took some google searches to figure this one out.

I had a question for you guys.  Based on the pictures on the Bezel Update section of the CPWizard home page, there looks to be a menu that pops up when your game is paused.  It has different menu options than the dedicated CPWizard application (Hide CP, Show CP, etc).  Can anybody tell me how this is accessed?  Right now when I hit the pause key, the control panel picture shows up but I can't get this menu to pop up.

Thanks again!

frl

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 25
  • Last login:December 11, 2016, 07:20:35 am
Re: CPWizard bezel diff for recent MAME
« Reply #15 on: June 14, 2014, 10:55:53 am »
Hey FreddieD,

You're right about not applying the patches cumulatively.  In fact you shouldn't need bezel_0144 at all, you should be able to go straight from vanilla 0153 source to ShowCP153.

I think I know the menu that you're seeing.  It's just the standard "Video Options" menu that you can get to from the main in-game menu.  Nothing fancy, just press tab and select it :)  If the patch is working, when you pause you should see whatever layout you have named "Show CP".  You can use the Video Options menu to select that manually to test the actual layout works before testing the patch by pausing.

Enjoy!
Chris

maffewl

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 115
  • Last login:June 05, 2020, 03:11:44 pm
Re: CPWizard bezel diff for recent MAME
« Reply #16 on: June 14, 2014, 12:05:47 pm »
Hey guys... there must be something I'm totally not getting.  I applied the hi score diff patch, then the ShowCP 153 patch, and compiled in MAME Compiler 64.  Then I exported the bezels through CP Wizard and placed them into my MAME artwork folder (which btw, is there any way to export only the bezels of the games you have and not ones you don't?  Just a side question).  And I see when I go to the Video Options menu in MAME that Control Panels are Enabled, but still no control panel at pause.  Is there some toggle or configuration that I'm missing?

frl

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 25
  • Last login:December 11, 2016, 07:20:35 am
Re: CPWizard bezel diff for recent MAME
« Reply #17 on: June 14, 2014, 12:15:33 pm »
Hi Maffewl,

First thing I'd do is figure out whether you have a problem with the layouts showing up at all, or if you have a problem with the pause patch activating them.

Try hitting tab in game and select Video Options.  You should have an option for "Show CP" like the screen shots on headkaze's site here http://www.headsoft.com.au/index.php?category=cpwizard (scroll down a bit to the screens of 1942).  If you select Show CP and hit enter, you should get whatever you designed in CPWizard on screen - a bit like in the second screenshot.  Note those screen shots are quite old, if you're using v153 they look a bit different, but you'll get the gist of it.

Oh, you also need to have Bezels enabled on that same Video Options screen otherwise you won't get anything.

Cheers,
Chris

maffewl

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 115
  • Last login:June 05, 2020, 03:11:44 pm
Re: CPWizard bezel diff for recent MAME
« Reply #18 on: June 14, 2014, 12:23:47 pm »
Chris, thanks for the quick response!  I think I figured out what the problem was, I had the exported layouts in a folder called "ShowCP" within the MAME artwork folder.  I copied one of the games from there and pasted it directly into the MAME artwork folder, i.e., no subfolder, and it seemed to work great!

So I guess my other question is a concern now, is there a way to only export the layouts of the games I have?

Thanks for your help!

frl

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 25
  • Last login:December 11, 2016, 07:20:35 am
Re: CPWizard bezel diff for recent MAME
« Reply #19 on: June 14, 2014, 01:11:25 pm »
Yeah the zips need to go in the root of the artwork folder, that will do it :)

I'm sure I remember an option in CPWizard to control what you export and what you don't, I can't for the life of me remember where it is or exactly how it works though - sorry!

Glad you got it all up and running!

maffewl

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 115
  • Last login:June 05, 2020, 03:11:44 pm
Re: CPWizard bezel diff for recent MAME
« Reply #20 on: June 14, 2014, 01:26:18 pm »
Thanks for the reply... I'll keep tinkering with everything to see what I can figure out.

Thanks so much to you and headkaze!   :cheers:

frl

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 25
  • Last login:December 11, 2016, 07:20:35 am
Re: CPWizard bezel diff for recent MAME
« Reply #21 on: June 14, 2014, 04:31:51 pm »
I remember how I dealt with this now - I wrote a little batch script to copy only the required bezels into my artwork folder. 

There's probably a much better way to do this but you're welcome to try it if you want, it's basically just a bit of script wrapped around gawk and rsync.  You still need to export bezels for the entire romset from CPWizard, but you do that to a temporary folder then use this to copy only the bezels you need into your actual artwork folder.  As it uses rsync it will only copy files that have changed, so although it takes a while the first time, it's much quicker for subsequent runs.

Just make sure you edit the .cmd file and substitute the folders to suit your setup....

https://www.dropbox.com/s/9jdaik30olx9lkm/SyncBezelswithCPWizard.rar

In case anyone wonders why I strip off the .zip extension in the script only to put it back on again, I originally wrote this to do the same 'file name match' job for video snaps, which have a different extension to the rom itself, I just couldn't be bothered to rewrite the thing properly for zip to zip filenames :)

Cheers,
Chris

frl

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 25
  • Last login:December 11, 2016, 07:20:35 am
Re: CPWizard bezel diff for recent MAME
« Reply #22 on: November 02, 2014, 05:26:18 pm »
The ShowCP patch for .153 seems to compile fine against .155, but because I'm a pedant and I was updating another patch for .155, here's an updated one for .155.  No functionality changes, this is just an updated diff to target the correct line numbers in .155 source.

Cheers,
Chris

Skinnysloth

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 33
  • Last login:May 08, 2016, 08:38:26 pm
Re: CPWizard bezel diff for recent MAME
« Reply #23 on: November 02, 2014, 06:51:20 pm »
The ShowCP patch for .153 seems to compile fine against .155, but because I'm a pedant and I was updating another patch for .155, here's an updated one for .155.  No functionality changes, this is just an updated diff to target the correct line numbers in .155 source.

Cheers,
Chris

Thanks for keeping this alive.

retango

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 15
  • Last login:September 22, 2022, 04:54:30 pm
  • I want to build my own arcade controls!
Re: CPWizard bezel diff for recent MAME
« Reply #24 on: November 16, 2014, 09:37:57 pm »
Thanks!

dragon_sa

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 18
  • Last login:April 15, 2024, 02:04:04 am
  • I want to build my own arcade controls!
Re: CPWizard bezel diff for recent MAME
« Reply #25 on: April 26, 2016, 10:29:50 pm »
Sorry to bring up an old thread but is there any chance of a version for 172?

I managed to work out which files it changed to.. but I have no idea whats going on in the code...any help would be appreciated :)

frl

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 25
  • Last login:December 11, 2016, 07:20:35 am
Re: CPWizard bezel diff for recent MAME
« Reply #26 on: April 27, 2016, 01:51:19 am »
I'll take a look - might be a few days or even a week before I have a chance but I'll definitely have a look.

dragon_sa

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 18
  • Last login:April 15, 2024, 02:04:04 am
  • I want to build my own arcade controls!
Re: CPWizard bezel diff for recent MAME
« Reply #27 on: April 27, 2016, 02:18:01 am »
It would bring me extreme joy seeing this working....
I was just trying to compile mame155 but im having buildtool issues there..and different ini and dat files lol

headkaze

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 2943
  • Last login:August 14, 2023, 02:00:48 am
  • 0x2b|~0x2b?
Re: CPWizard bezel diff for recent MAME
« Reply #28 on: April 27, 2016, 02:21:59 am »
I'll take a look - might be a few days or even a week before I have a chance but I'll definitely have a look.

Do you think we could do it via MAME's Lua Scripting Engine? We no longer have to do a custom compile for the Hiscore.dat support via the Hiscore Lua script. It would certainly make it a lot easier to maintain.

frl

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 25
  • Last login:December 11, 2016, 07:20:35 am
Re: CPWizard bezel diff for recent MAME
« Reply #29 on: April 27, 2016, 04:00:26 am »
Oh that's interesting... I have not really been keeping up on MAME stuff for a while so had no idea about this.  :)

From a quick glance at that link it looks like you can capture events and draw a HUD which is promising, although it seems to talk about text and boxes rather than images.

I'll do some playing around - even if we can't do it via lua now, at least if we can see what enhancements lua would need in order to do it we can request those enhancements for a future build.

Cheers for the tip headkaze!

dragon_sa

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 18
  • Last login:April 15, 2024, 02:04:04 am
  • I want to build my own arcade controls!
Re: CPWizard bezel diff for recent MAME
« Reply #30 on: May 05, 2016, 07:54:05 pm »
Just wondering if anyone has had a chance to look at this update yet :)

frl

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 25
  • Last login:December 11, 2016, 07:20:35 am
Re: CPWizard bezel diff for recent MAME
« Reply #31 on: May 06, 2016, 03:50:30 pm »
Err... well I downloaded the latest source code and got it building without the patch... then I got distracted into getting Time Crisis working with my Aimtrak  ;D

I'll try and have a look this weekend.

dragon_sa

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 18
  • Last login:April 15, 2024, 02:04:04 am
  • I want to build my own arcade controls!
Re: CPWizard bezel diff for recent MAME
« Reply #32 on: May 17, 2016, 05:54:53 am »
hate to bug you but any luck...:)

frl

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 25
  • Last login:December 11, 2016, 07:20:35 am
Re: CPWizard bezel diff for recent MAME
« Reply #33 on: May 20, 2016, 01:53:48 pm »
Erm....

In all honesty I haven't got to it yet - but this evening is looking like as good a time as any so I will give it a crack!

frl

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 25
  • Last login:December 11, 2016, 07:20:35 am
Re: CPWizard bezel diff for recent MAME
« Reply #34 on: May 20, 2016, 04:09:13 pm »
Here you go...

I haven't tested this extensively but the code that needed to be patched didn't seem massively different from the 0155 code so I'm reasonably confident it will be fine - it certainly was for the couple of roms I tried it on.  If there's any issues let me know.

Cheers,
Chris

edit - forgot to say, I didn't look in detail at the lua scripting, this was just a quick and dirty update of the diff.

dragon_sa

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 18
  • Last login:April 15, 2024, 02:04:04 am
  • I want to build my own arcade controls!
Re: CPWizard bezel diff for recent MAME
« Reply #35 on: May 23, 2016, 07:19:54 pm »
Your just BRILLIANT! thank you very much for the effort  ;D

headkaze

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 2943
  • Last login:August 14, 2023, 02:00:48 am
  • 0x2b|~0x2b?
Re: CPWizard bezel diff for recent MAME
« Reply #36 on: August 27, 2016, 07:29:10 am »
FYI I've created a ShowCP lua plugin for MAME.

frl

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 25
  • Last login:December 11, 2016, 07:20:35 am
Re: CPWizard bezel diff for recent MAME
« Reply #37 on: December 11, 2016, 07:15:23 am »
Nice one headkaze, saves me a job in updating the patch this Christmas!  :cheers: