Jump to content

All my products and services are free. All my costs are met by donations I receive from my users. If you enjoy using any of my products, please donate to support me. My bare hosting costs are currently not met so please consider donating by either clicking this text or the Patreon link on the right.

Patreon

Stoping CPWizard Opening When Saving/Loading Games In Mame/GameEX


Recommended Posts

Posted

Hi,Is there a way of stopping CPwizard opening when i use the save/load function in mame.

And making it just open when i use the Pause button.

I assume that saving/loading makes mame pause,hence the reason it opens.

Any ideas?

Cheers

Posted

Disable the control panel viewer in GameEx. I don't think this will disable it all together, but I haven't tried it. If it does turn it off, I suggest you add a feature request to make it do what you are suggesting.

Posted
Disable the control panel viewer in GameEx. I don't think this will disable it all together, but I haven't tried it. If it does turn it off, I suggest you add a feature request to make it do what you are suggesting.

Naa it's not this which is causing it. It's very much like the problem you were trying to fix by patching Mame. When you save state in Mame it pauses and thus shows the CPWizard.

I need to make another patch so it will only show when pause is invoked by the user during game only. There seems to be several ways Mame goes into pause mode besides pressing the pause key. Save state and showing the config menu are two examples. Although for me showing the config menu doesn't pause Mame :huh:

Posted
Naa it's not this which is causing it. It's very much like the problem you were trying to fix by patching Mame. When you save state in Mame it pauses and thus shows the CPWizard.

I need to make another patch so it will only show when pause is invoked by the user during game only. There seems to be several ways Mame goes into pause mode besides pressing the pause key. Save state and showing the config menu are two examples. Although for me showing the config menu doesn't pause Mame :huh:

Cheers for the posts lads.

If this could be fixed then that would be great,Im the same Headkaze, When i press tab/config menu it doesn't pause mame?

Posted
Cheers for the posts lads.

If this could be fixed then that would be great,Im the same Headkaze, When i press tab/config menu it doesn't pause mame?

In the mame config (tab) make sure the key to pause isnt assigned to the same key used for pause.

eg

Pause mame= P and Save game key

Save game= save game key

That may help

Posted
In the mame config (tab) make sure the key to pause isnt assigned to the same key used for pause.

eg

Pause mame= P and Save game key

Save game= save game key

That may help

Just checked,and there assigned to different keys.So that doesn't seem to be the problem.

Posted

Now I feel embarrassed! I checked my config last night and somehow TAB got added to the list of buttons that pause MAME :ph34r:

Once I removed it, CPWizard doesn't pop up when I display the config menu. Now the only problem is that when the CPWizard is exited, it minimizes MAME. I wonder if this is caused by the way it tries to give control back? Out of curiosity, do you have it set up to restore the process that was active prior to displaying the controls, or do you have it try to restore "MAME" in the process list? I've noticed that I have 2 processes running when I hit alt-tab. One says "MAME: 005" and the other says "c:\emu\MAME\mame.exe" (for example). The latter won't allow you to select it and restore it's process. Is it possible that you are restoring the first process in the list that has MAME in the title? If so, then that's probably why things aren't working.

In my case, I'm using the MAME_Loader script. I want to switch back to a custom compile of vanilla MAME at some point (when I figure out the rotary stuff). I really should try running vanilla MAME to test this out, but I highly suspect CPWizard is trying to restore the wrong thread. I suppose the easiest thing to do to make it work would be to search for the base exe name plus a colon ("mame:", "mameui:", "mame32:", "mamea", etc). I don't know that's what the other processes are labeled as yet, so don't quote me on it...

EDIT: maybe the regex = ^(mame|MAME).*:.+

Posted

hehe That was really confusing me before about the config pausing Mame! Glad you got it sorted.

As for the Mame thing I do infact search for "MAME:" in the titlebar in fact I get the ROM name from the titlebar also. So I definately have the correct window.

Okay bkenobi here is a new CPWizard.exe to try with extra logging. Make sure you turn on verbose logging in the Options then post your CPWizard.log file when you're done.

CPWizard.zip

Posted

WOW, that was fast!!! I'm pretty stacked up today, but I will take a look next chance I get. I assume the steps are:

1) Launch MAME

2) Hit pause

3) Exit CPWizard (this should cause the error minimizing MAME)

4) Upload the log

Do you just need one instance, or do you want multiple games doing the same thing? It's easy enough to do more than one, but it would probably make the log really ugly to review.

Posted
WOW, that was fast!!! I'm pretty stacked up today, but I will take a look next chance I get. I assume the steps are:

1) Launch MAME

2) Hit pause

3) Exit CPWizard (this should cause the error minimizing MAME)

4) Upload the log

Do you just need one instance, or do you want multiple games doing the same thing? It's easy enough to do more than one, but it would probably make the log really ugly to review.

Yep just do the one game like that it should be enough to help us figure out where the problem lies. I'm really wondering why it's not going to foreground I even use a method I wrote called ForceForegroundWindow which is supposed to do everything in Win32 API's power to force a window to foreground.

public bool ForceForegroundWindow(IntPtr hWnd)
{
IntPtr hWndForeground = Win32.GetForegroundWindow();

if (hWnd == hWndForeground)
return true;

bool ret = false;
int threadID1 = Win32.GetWindowThreadProcessId(hWndForeground, 0);
int threadID2 = Win32.GetWindowThreadProcessId(hWnd, 0);

if (Win32.AttachThreadInput(threadID1, threadID2, 1))
{
ret = Win32.BringWindowToTop(hWnd);
ret = Win32.SetForegroundWindow(hWnd);
Win32.AttachThreadInput(threadID1, threadID2, 0);
ret = (Win32.GetForegroundWindow() == hWnd);

if (!ret)
{
int timeout = 0; int dummy = 0;
Win32.SystemParametersInfo(Win32.SPI_GETFOREGROUNDLOCKTIMEOUT, 0, ref timeout, 0);
Win32.SystemParametersInfo(Win32.SPI_SETFOREGROUNDLOCKTIMEOUT, 0, ref dummy, Win32.SPIF_SENDCHANGE);
Win32.BringWindowToTop(hWnd); // IE 5.5 related hack
Win32.SetForegroundWindow(hWnd);
Win32.SystemParametersInfo(Win32.SPI_SETFOREGROUNDLOCKTIMEOUT, 0, ref timeout, Win32.SPIF_SENDCHANGE);
}
}
else
{
ret = Win32.BringWindowToTop(hWnd);
ret = Win32.SetForegroundWindow(hWnd);
}

if (Win32.IsIconic(hWnd))
Win32.ShowWindow(hWnd, (int) Win32.WindowShowStyle.Restore);
else
Win32.ShowWindow(hWnd, (int) Win32.WindowShowStyle.Show);

ret = (Win32.GetForegroundWindow() == hWnd);

if (!ret)
Win32.SwitchToThisWindow(hWnd, true);

return ret;
}

Posted

I ran CPWizard with this test exe and here's the results. In both cases, MAME ended up minimized.

3 files:

1) CPWizard (GameEx).txt: Run via GameEx then paused (GameEx launched a game in demo mode prior to running 005)

2) CPWizard (NoGameEx).txt: Run via command line (launched CPWizard, minimizing it, launched "mame 005", paused)

3) CPWizard.ini.txt: My CPWizard.ini file. I do not have overlays turned on if that matters.

CPWizard.ini.txt

CPWizard__GameEx_.txt

CPWizard__NoGameEx_.txt

Posted
I ran CPWizard with this test exe and here's the results. In both cases, MAME ended up minimized.

3 files:

1) CPWizard (GameEx).txt: Run via GameEx then paused (GameEx launched a game in demo mode prior to running 005)

2) CPWizard (NoGameEx).txt: Run via command line (launched CPWizard, minimizing it, launched "mame 005", paused)

3) CPWizard.ini.txt: My CPWizard.ini file. I do not have overlays turned on if that matters.

You have overlays turned on, look in your CPWizard.ini file, it has

UseOverlay=True

Turn off overlays. I see where I've confused you, there is another option called "Allow Overlays" which should turn off overlays globally but it mustn't be doing that. That is where the bug is so I'll fix that for next release.

For now go into Options->Mame and take the tick off "Use Overlay".

Posted

Yup, that fixed it! I manually changed the ini to set UseOverlay=False and it works great now! Thanks for the thorough help B)

Guest
This topic is now closed to further replies.
×
×
  • Create New...