Author Topic: How to keep second monitor visible?  (Read 4618 times)

mbalfour

  • Newbie
  • *
  • Posts: 6
    • View Profile
How to keep second monitor visible?
« on: March 11, 2017, 03:26:24 PM »
I've got an arcade cab that has one monitor for the playfield, and one that's dedicated for a marquee.  Using MultiMon.nut, I can get the marquee to show up on the second monitor.  However, as soon as I launch MAME, the marquee disappears.  I've got MAME configured to only use one monitor.  What's causing AttractMode to clear the second monitor when launching an emulator, and how do I stop it? :)

Thanks!

mbalfour

  • Newbie
  • *
  • Posts: 6
    • View Profile
Re: How to keep second monitor visible?
« Reply #1 on: March 12, 2017, 10:28:16 AM »
OK, so looks like Attract Mode doesn't quite support this out-of-the-box yet.  I can see a couple of ways to make it work for my use case, but I don't know what the right general solution is.

Option 1:  Don't block.  In fe_settings.cpp, where it calls run_program(), I could pass block = false.  This keeps Attract Mode from blocking on emulator completion, which means that it's running the full logic loop (including window redraws) while the emulator is running.  This keeps the marquee visible, which is great, but I'm not sure it's a good side-effect to have Attract Mode running.  If nothing else, it's probably bad that you get the FromGame transition callback before you've actually come back from the game.  On the other hand, I can see where it would be powerful to have an in-between answer here where you don't block, but you also don't get the FromGame transition until the emulator process actually ends.  You could use the running logic loop to drive animations, sound, blinking LEDs, or whatever you want.  This option could get a bit tricky though, since the code isn't currently set up to keep track of the spawned process outside of the run_program() function.  I'm also not entirely sure how to keep the exit hotkey working in this situation.  Ideally, this would also be a per-emulator setting, since there are probably some use cases where you *don't* want both running at the same time.

Option 2:  Don't clear.  In fe_window.cpp, in the wait_callback(), I could remove the win->clear() call.  This keeps the windows "frozen" on the last thing they displayed before launching the emulator.  This also keeps the marquee visible while still keeping Attract Mode in the blocked state.  This is the one I'm currently going with, because it's less intrusive and doesn't have any real side effects.  Ideally, this option would get exposed either to the .nut files or as a per-emulator setting as well.  I really like the idea of making Option #1 work is a more pretty fashion though. :(

Thorvald

  • Jr. Member
  • **
  • Posts: 13
    • View Profile
Re: How to keep second monitor visible?
« Reply #2 on: March 12, 2017, 11:25:26 AM »
Interesting you can get Multimon to work, for me I just get errors whenever I try to use any of the fe.monitors functions.

With regards to Marquee, I am doing the same thing but I use Mame to control the second monitor and marquee display.  Works perfect.  My problem is getting attractmode to display the marquee when in the menu system (but it obviously works for you).

For Mame, just edit artwork .lay file for the game you want to play and add Marquee options or create a new one:

Code: [Select]
<mamelayout version="2">
<element name="marq">
<image file="btime.png" />
</element>
<view name="Marquee_Only">
<marquee element="marq">
<bounds x="0" y="0" width="1366" height="384" />
        </marquee>
</view>

</mamelayout>

Don't forget to add the marquee to the artwork file as well (just add to the zip).  Then run mame and bring tab menu up, displays second monitor change to Marquee_Only.

You can add this to your mame.ini so it always does this:

#
# OSD PER-WINDOW VIDEO OPTIONS
#
screen0                   //.DISPLAY1
aspect0                   auto
resolution0               auto
view0                     standard
screen1                   //.DISPLAY2
aspect1                   auto
resolution1               auto
view1                     Marquee
« Last Edit: March 12, 2017, 11:27:26 AM by Thorvald »

Thorvald

  • Jr. Member
  • **
  • Posts: 13
    • View Profile
Re: How to keep second monitor visible?
« Reply #3 on: March 12, 2017, 11:29:24 AM »
I made a simple batch file that I use to drag and drop marquee image files onto for games that don't have one presently and don't have an artwork file either.

I plan to modify this in future to add the ability to check the existing layout file for the xml tag and add if missing but haven't had time yet.

Code: [Select]
@ECHO OFF
rem ensure param isn't blank

ECHO =================================================

rem Check for existing Artwork File
ECHO Checking to see if Artwork file already exists...
if exist e:\mame32\artwork\%~n1.zip (
    rem file exists
    echo Artwork %~n1.zip File Exists, Exiting...
    ECHO.
    pause
    exit /b
) else (
    rem file doesn't exist
    echo Artwork %~n1.zip File does not exist.
)

ECHO.

rem Check for existing png marq File
ECHO Checking to see if Marquee file is available...
if exist E:\mame32\marquees\%~n1.png (
    rem file exists
    echo Marquee %~n1.png File Exists...
) else (
    rem file doesn't exist
    echo Marquee %~n1.png File does not exist, Exiting...
    ECHO.
    pause
    exit /b
)

ECHO.

rem copy marq file to artwork
echo Coying %~n1.png to artwork directory...
copy E:\mame32\marquees\%~n1.png e:\mame32\artwork

echo Creating %~n1.lay file...
echo ^<mamelayout version="2"^> > e:\mame32\artwork\%~n1.lay
echo ^<element name="marq"^> >> e:\mame32\artwork\%~n1.lay
echo ^<image file="%~n1.png" ^/^> >> e:\mame32\artwork\%~n1.lay
echo ^<^/element^> >> e:\mame32\artwork\%~n1.lay
echo ^<view name="Marquee_Only"^> >> e:\mame32\artwork\%~n1.lay
echo ^<marquee element="marq"^> >> e:\mame32\artwork\%~n1.lay
echo ^<bounds x="0" y="0" width="1366" height="384" ^/^> >> e:\mame32\artwork\%~n1.lay
echo        ^<^/marquee^> >> e:\mame32\artwork\%~n1.lay
echo ^<^/view^> >> e:\mame32\artwork\%~n1.lay
echo ^<^/mamelayout^> >> e:\mame32\artwork\%~n1.lay

rem send both to zip
Echo Creating %~n1.zip file...
C:\Progra~1\7-Zip\7z.exe a e:\mame32\artwork\%~n1.zip e:\mame32\artwork\%~n1.png e:\mame32\artwork\%~n1.lay

rem delete marq and lay
Echo Deleting %~n1.png and %~n1.lay...
del e:\mame32\artwork\%~n1.lay
del e:\mame32\artwork\%~n1.png

Echo Finished.
ECHO.
pause

mbalfour

  • Newbie
  • *
  • Posts: 6
    • View Profile
Re: How to keep second monitor visible?
« Reply #4 on: March 12, 2017, 02:15:08 PM »
I posted the fix for Multimon on another thread - fe_vm.cpp was missing a definition for PresentableParent.  Here's the fix again:

   fe.Bind(_SC("PresentableParent"),
      Class<FePresentableParent, NoConstructor>()
      .Overload<FeImage * (FePresentableParent::*)(const char *, int, int, int, int)>(_SC("add_image"), &FePresentableParent::add_image)
      .Overload<FeImage * (FePresentableParent::*)(const char *, int, int)>(_SC("add_image"), &FePresentableParent::add_image)
      .Overload<FeImage * (FePresentableParent::*)(const char *)>(_SC("add_image"), &FePresentableParent::add_image)
      .Overload<FeImage * (FePresentableParent::*)(const char *, int, int, int, int)>(_SC("add_artwork"), &FePresentableParent::add_artwork)
      .Overload<FeImage * (FePresentableParent::*)(const char *, int, int)>(_SC("add_artwork"), &FePresentableParent::add_artwork)
      .Overload<FeImage * (FePresentableParent::*)(const char *)>(_SC("add_artwork"), &FePresentableParent::add_artwork)
      .Func(_SC("add_clone"), &FePresentableParent::add_clone)
      .Func(_SC("add_text"), &FePresentableParent::add_text)
      .Func(_SC("add_listbox"), &FePresentableParent::add_listbox)
      .Func(_SC("add_surface"), &FePresentableParent::add_surface)
   );

   fe.Bind(_SC("Monitor"),
      DerivedClass <FeMonitor, FePresentableParent, NoConstructor>()
      .Prop(_SC("num"), &FeMonitor::get_num)
      .Prop(_SC("width"), &FeMonitor::get_width)
      .Prop(_SC("height"), &FeMonitor::get_height)
   );




mbalfour

  • Newbie
  • *
  • Posts: 6
    • View Profile
Re: How to keep second monitor visible?
« Reply #5 on: March 12, 2017, 02:18:52 PM »
BTW, thanks for the suggestion on controlling it thru MAME itself. :)  Right now, I'm happy with my "fix" to Attract Mode to keep the monitor from clearing itself, so I don't think I need to go the MAME layout route.  I'd like to get a proper fix into Attract Mode though to make it easy for anyone to do.  I'm running under Windows though, so I've taken a detour to try and get Attract Mode compiling under Visual Studio so I can develop with an actual debugger. :)

Thorvald

  • Jr. Member
  • **
  • Posts: 13
    • View Profile
Re: How to keep second monitor visible?
« Reply #6 on: March 12, 2017, 07:03:56 PM »
Awesome thanks, I hadn't looked at the other thread since I'm not running Windows 10... 7 32bit here.  However wish I did now lol.

Guess I'll have to break out Visual Studio as well to compile the fix unless Raygun or the others incorporate the fix.  Did you have a chance to submit it as a bit report?

If not I can get around to it tomorrow night for you on Github.

Cheers
  Tim