Author Topic: proc-GenericLauncher -- frontend for launching PinMAME and pyprocgame  (Read 8699 times)

tomlogic

  • Wizard
  • *****
  • Posts: 113
    • View Profile
    • PinMAME for P-ROC/Linux
Re: proc-GenericLauncher -- frontend for launching PinMAME and pyprocgame
« Reply #15 on: February 03, 2015, 01:42:56 AM »

So you're saying I should update the launcher to set 'enable=True' if the machine type is 'sys11'?


Actually there isn't a sys11 machine type, with the interface board it appears to the P-ROC as a WPC machine, so there was no real benefit in adding a new type.  I took a closer look at the launcher code.  What it's missing is a call to get the flippers working first time in.  After a game has been run and quit and the launcher wakes up again, it looks like the call to restart_proc would enable the flippers as required.  It's just missing that initial enable.

OK, then how about this:

Code: [Select]
    def reset(self):
        # Reset the entire game framework
        super(Game, self).reset()

        # Add the basic modes to the mode queue
        self.modes.add(self.loader)

        # Make sure flippers are off, especially for user initiated resets.
        self.enable_flippers(self.coils.has_key('flipperEnable'))

I want to make sure we only enable the flippers if absolutely necessary.

-Tom

Snux

  • Wizard
  • *****
  • Posts: 779
  • Mark Sunnucks
    • View Profile
Re: proc-GenericLauncher -- frontend for launching PinMAME and pyprocgame
« Reply #16 on: February 03, 2015, 02:52:07 AM »
That would work, don't know why I didn't do that when I changed mine (especially as the same logic is being used in restart_proc()).  Must have been late :)

The only other thing which might need a little tweak is catching the flipper activations.  Instead of using

sw_flipperLwL_active

maybe use

sw_flipperLwL_active_for_5ms

On my machine and some of the other earlier Sys11 machines, the flipper switch on the matrix is physically mounted on the EOS stack on the flipper mech (which is why we have to enable the flippers in the first place).  I guess my flipper switches are a little "bouncy" as I'm seeing the launcher flick through 2 options when I press the button once.  This evening I'll have a little try and see if 5ms is enough to remove the effect of the bounce.  If so, I guess 5ms won't be noticeable to folks with "normal" flippers.

thanks Tom!
F14 Tomcat - Second Sortie

Snux

  • Wizard
  • *****
  • Posts: 779
  • Mark Sunnucks
    • View Profile
Re: proc-GenericLauncher -- frontend for launching PinMAME and pyprocgame
« Reply #17 on: February 03, 2015, 03:03:02 AM »
Downloaded a hex plugin for Notepad++ and got the info in about 30 seconds :)

F14 Tomcat - Second Sortie

tomlogic

  • Wizard
  • *****
  • Posts: 113
    • View Profile
    • PinMAME for P-ROC/Linux
Re: proc-GenericLauncher -- frontend for launching PinMAME and pyprocgame
« Reply #18 on: February 03, 2015, 11:51:17 AM »
Maybe the easiest solution is to just always enable the flippers with this code in "class Game":

Code: [Select]
    def enable_flippers(self,enable):
        """ enables flippers on pre-fliptronics machines by checking for the
            presence of a coil with name flipperEnable which is mapped to the
            flipper enable relay (G08)
        """
        if self.coils.has_key('flipperEnable'):
            enable = True
        super(game.BasicGame, self).enable_flippers(enable)

Now regardless of what's passed to the function, it will always enable flippers on the pre-Fliptronics games.

-Tom

Snux

  • Wizard
  • *****
  • Posts: 779
  • Mark Sunnucks
    • View Profile
Re: proc-GenericLauncher -- frontend for launching PinMAME and pyprocgame
« Reply #19 on: February 03, 2015, 12:05:15 PM »
Whichever you think is cleaner I guess.  With pre-fliptronic, the flippers should always be enabled when the launcher is running so wherever it slots in nicest.

Now back to looking at pinmame diffs  ::)
F14 Tomcat - Second Sortie

Steven

  • Wizard
  • *****
  • Posts: 467
    • View Profile
Re: proc-GenericLauncher -- frontend for launching PinMAME and pyprocgame
« Reply #20 on: February 15, 2015, 05:50:27 PM »
Hmmm.... couldn't get it to work on my laptop that I only once used before for running my pinball-software at first, and kept having the database locking error and didn't understand.... until.... 'hey, did I do the python setup develop' at my laptop?'

 >:(

Well... it works well now, it's a great 'tool'/piece of code.
I had to adjust some code manually to get the flipperrelais working, though I think having the flipperEnable in my config file should do that automaticaly elsewhere in the code...... well, for now I just added some 'self.(game).coils.flipperEnable.enable()' and now it works after resetting too.

Right now PinMame doesn't activate the flippers when a game is started and the DMD goes 'black': strange, but maybe my pinmamep.exe I got from an old email from Mark is too old? The one I know works I don't have at hand right now.... well, let's get a night sleep and then I'll check again.

Thank you guys for the launcher code!

tomlogic

  • Wizard
  • *****
  • Posts: 113
    • View Profile
    • PinMAME for P-ROC/Linux
Re: proc-GenericLauncher -- frontend for launching PinMAME and pyprocgame
« Reply #21 on: February 16, 2015, 03:07:45 AM »
I had to adjust some code manually to get the flipperrelais working, though I think having the flipperEnable in my config file should do that automaticaly elsewhere in the code...... well, for now I just added some 'self.(game).coils.flipperEnable.enable()' and now it works after resetting too.

Steven,

Which version of the launcher were you using?  Does it include my commit from February 4th related to enabling the flippers?

Maybe I've misunderstood the code in pypinproc and pyprocgame, but it appears to enable the flipper coils if Machine Type is set to 'wpcAlphanumeric'.  Is that actually not used?  If so, I need to update the enable_flippers() method in proc-GenericLauncher to enable the coil as well.  I'm thinking that it probably needs to look like this:

Code: [Select]
        if self.coils.has_key('flipperEnable'):
            enable = True
            self.coils.flipperEnable.pulse(0)
        super(game.BasicGame, self).enable_flippers(enable)

I don't understand why the code uses "pulse(0)" instead of "enable()".  Perhaps Mark can explain that oneā€¦

Steven

  • Wizard
  • *****
  • Posts: 467
    • View Profile
Re: proc-GenericLauncher -- frontend for launching PinMAME and pyprocgame
« Reply #22 on: February 16, 2015, 04:16:56 AM »
I did download the latest version of the launcher yesterday. Could be that my procgame is old though.
I didn't have machine type set to wpcAlphanumeric, so maybe there's the problem?
I thought this piece of code already would 'fix' the flippers on for sys11:

Code: [Select]
   
def enable_flippers(self,enable):
        """ enables flippers on pre-fliptronics machines by checking for the
            presence of a coil with name flipperEnable which is mapped to the
            flipper enable relay (G08)
        """
        if self.coils.has_key('flipperEnable'):
            enable = True
        super(game.BasicGame, self).enable_flippers(enable)

pulse(0) or 'enable()' do the same things as far as I know (I used 'enable()').
I will try if adding the machinetype makes a difference.

MOcean

  • P3 Developers
  • *
  • Posts: 822
  • Michael Ocean
    • View Profile
Re: proc-GenericLauncher -- frontend for launching PinMAME and pyprocgame
« Reply #23 on: February 16, 2015, 06:51:25 AM »
WPCAlphanumeric breaks dmd support and makes a few other changes in the init sequence (possibly related to the aux bus? it's been a little while since I looked). Changing machine types shouldn't be done lightly.

In my more recent games, my game class defines it's own enable flippers function that calls both enable_flippers and enable_flippers_alphanumeric of the super class.

Steven

  • Wizard
  • *****
  • Posts: 467
    • View Profile
Re: proc-GenericLauncher -- frontend for launching PinMAME and pyprocgame
« Reply #24 on: February 16, 2015, 07:05:40 AM »
WPCAlphanumeric breaks dmd support and makes a few other changes in the init sequence

So I probably shouldn't change it to wpcAlphanumeric (for I have a DMD instead of Jims Alphanumeric-pcb in my Road Kings)??

MOcean

  • P3 Developers
  • *
  • Posts: 822
  • Michael Ocean
    • View Profile
Re: proc-GenericLauncher -- frontend for launching PinMAME and pyprocgame
« Reply #25 on: February 16, 2015, 07:43:13 AM »

So I probably shouldn't change it to wpcAlphanumeric (for I have a DMD instead of Jims Alphanumeric-pcb in my Road Kings)??

I wouldn't. When I did the physical dmd bypass code (for the vga-only variant) I recall seeing that WPCAlphanumeric was the only machine type that branched to not enabling the physical dmd... I want to say that's in procgame/game/basicgame.py.

tomlogic

  • Wizard
  • *****
  • Posts: 113
    • View Profile
    • PinMAME for P-ROC/Linux
Re: proc-GenericLauncher -- frontend for launching PinMAME and pyprocgame
« Reply #26 on: February 16, 2015, 02:05:21 PM »
Stephen,

The only necessary change should be to add "self.coils.flipperEnable.pulse(0)" after the "enable = True" line in GameLauncher.py.  I incorrectly assumed that pyprocgame would automatically handle that.

I've pushed that change out to my GitHub repo.

-Tom

Snux

  • Wizard
  • *****
  • Posts: 779
  • Mark Sunnucks
    • View Profile
Re: proc-GenericLauncher -- frontend for launching PinMAME and pyprocgame
« Reply #27 on: February 16, 2015, 02:28:25 PM »
I use machine type of WPC in my F14.  In terms of the flipper enable, this is working for me..

Code: [Select]
    def restart_proc(self):
        self.game.proc = self.game.create_pinproc()
        self.game.proc.reset(1)
        self.game.load_config(self.game.yamlpath)
        # On Sys11 games (with flipperEnable coil), we need to enable the
        # flippers to detect button presses via the coil EOS switches.
        self.game.enable_flippers(self.game.coils.has_key('flipperEnable'))
        self.game.dmd.frame_handlers.append(self.game.proc.dmd_draw)
        self.game.dmd.frame_handlers.append(self.game.set_last_frame)
 
and

Code: [Select]
def enable_flippers(self,enable):
        """ enables flippers on pre-fliptronics machines by checking for the
            presence of a coil with name flipperEnable which is mapped to the
            flipper enable relay (G08)
        """
        #super(game.BasicGame, self).enable_flippers(enable)
        if self.coils.has_key('flipperEnable'):
            if enable:
                self.coils.flipperEnable.enable()
            else:
                self.coils.flipperEnable.disable()

    def reset(self):
        # Reset the entire game framework
        super(Game, self).reset()

        # Add the basic modes to the mode queue
        self.modes.add(self.loader)

        # Make sure flippers are off, especially for user initiated resets.
        self.game.enable_flippers(self.game.coils.has_key('flipperEnable'))

The above isn't the complete version of Tom's commit, it's from when we were trying out some things.  I should repull the latest and check it works when I get time.

Stephen - I can send you my complete source and YAML if you are interested.
F14 Tomcat - Second Sortie

Mark Jarzewiak

  • Wizard
  • *****
  • Posts: 244
  • Mark Jarzewiak
    • View Profile
Re: proc-GenericLauncher -- frontend for launching PinMAME and pyprocgame
« Reply #28 on: February 16, 2015, 03:06:29 PM »
I use machine type of WPC in my F14.  In terms of the flipper enable, this is working for me..

Code: [Select]
    def restart_proc(self):
        self.game.proc = self.game.create_pinproc()
        self.game.proc.reset(1)
        self.game.load_config(self.game.yamlpath)
        # On Sys11 games (with flipperEnable coil), we need to enable the
        # flippers to detect button presses via the coil EOS switches.
        self.game.enable_flippers(self.game.coils.has_key('flipperEnable'))
        self.game.dmd.frame_handlers.append(self.game.proc.dmd_draw)
        self.game.dmd.frame_handlers.append(self.game.set_last_frame)
 
and

Code: [Select]
def enable_flippers(self,enable):
        """ enables flippers on pre-fliptronics machines by checking for the
            presence of a coil with name flipperEnable which is mapped to the
            flipper enable relay (G08)
        """
        #super(game.BasicGame, self).enable_flippers(enable)
        if self.coils.has_key('flipperEnable'):
            if enable:
                self.coils.flipperEnable.enable()
            else:
                self.coils.flipperEnable.disable()

    def reset(self):
        # Reset the entire game framework
        super(Game, self).reset()

        # Add the basic modes to the mode queue
        self.modes.add(self.loader)

        # Make sure flippers are off, especially for user initiated resets.
        self.game.enable_flippers(self.game.coils.has_key('flipperEnable'))

The above isn't the complete version of Tom's commit, it's from when we were trying out some things.  I should repull the latest and check it works when I get time.

Stephen - I can send you my complete source and YAML if you are interested.

This might actually help me except for the one thing being that I will be keeping alphanumeric displays in Bad Cats.  I'm going to make a P-ROC mount, hopefully today, and try to get it running this week.

Steven

  • Wizard
  • *****
  • Posts: 467
    • View Profile
Re: proc-GenericLauncher -- frontend for launching PinMAME and pyprocgame
« Reply #29 on: February 18, 2015, 04:57:16 AM »
- The launcher is working fine, though mine can be coded 'cleaner' (I'll look at the updated gamelauncher soon).
- When I got to the pc that I had Pinmamep running on before, I saw that I'd forgotten about the '-alpha_on_dmd' in the
extra_args: '-alpha_on_dmd -window -skip_disclaimer -skip_gameinfo'. Emulating is working great now too!

Thanks for all the responses, and thanks for this great piece of code!


Next week I'll try running my custom software on VP... I'm sure I'll post some questions about that too ;)