Retro Uprising
  Home Game Menu Rules and FAQs Forum Community Chat Today's Posts Search Register  
Go Back   Retro Uprising > Other > Programmers Developers Designers

Reply
 
Thread Tools Search this Thread Display Modes
Old 03-19-2014, 10:33 PM   #1
Kong's Avatar
 
Kong

DefWindowProc Pauses MAME on Resize

In MAME if you resize/move the window then the game will pause. This is bad for score mode where we want to be in control of pauses.

This is caused by Windows. It is not in the MAME code but in the code of Windows.

I've googled the problem and some people say creating an additional thread will solve this. I do not know how to try that. I know mame is already multithreaded. Not sure if there is more than one way to do it or what.



The pause is caused by DefWindowProc in window.c.
DefWindowProc is the default windows process that handles all window messages that the program does not handle itself.

What needs to happen is in
case WM_SYSCOMMAND:

Something like this needs to be added

if (cmd == SC_SIZE)
{
//insert custom size code here.
}

if (cmd == SC_MOVE)
{
//insert custom move code here.
}

Can anyone help me with that? I want to override DefWindowProc and handle size and move myself.

If not then I will have to disable move and size in score mode.

Thanks.
My SignatureDisplay Signature Reply With Quote
Old 03-19-2014, 11:36 PM   #2
Seahawk's Avatar
Regular Poster
4,154 posts
Seahawk has earned the ear of the admin. Watch yourself!Seahawk has earned the ear of the admin. Watch yourself!Seahawk has earned the ear of the admin. Watch yourself!Seahawk has earned the ear of the admin. Watch yourself!Seahawk has earned the ear of the admin. Watch yourself!Seahawk has earned the ear of the admin. Watch yourself!Seahawk has earned the ear of the admin. Watch yourself!Seahawk has earned the ear of the admin. Watch yourself!Seahawk has earned the ear of the admin. Watch yourself!Seahawk has earned the ear of the admin. Watch yourself!Seahawk has earned the ear of the admin. Watch yourself!
View Stats
 
Seahawk

Re: DefWindowProc Pauses MAME on Resize

In your mame source, in src/osd/windows/window.c, line 1258 in the latest build on mamedev.org

is the function which handles all the Windows messages for the window.

LRESULT CALLBACK winwindow_video_window_proc(HWND wnd, UINT message, WPARAM wparam, LPARAM lparam)

This is where you'd define your handlers for various windows messages.
I don't see anything in that function regarding SC_SIZE or SC_MOVE, I think you're using the wrong command list, windows messages are prefixed WM, see here.

It is a large function, currently the MAME team has this as part of the handler
Code:
1340          // pause the system when we start a menu or resize
1341          case WM_ENTERSIZEMOVE:
1342              window->resize_state = RESIZE_STATE_RESIZING;
1343          case WM_ENTERMENULOOP:
1344              winwindow_ui_pause_from_window_thread(window->machine(), TRUE);
1345              break;
1346  
1347          // unpause the system when we stop a menu or resize and force a redraw
1348          case WM_EXITSIZEMOVE:
1349              window->resize_state = RESIZE_STATE_PENDING;
1350          case WM_EXITMENULOOP:
1351              winwindow_ui_pause_from_window_thread(window->machine(), FALSE);
1352              InvalidateRect(wnd, NULL, FALSE);
1353              break;
with the size operation defined, so it's not jumping to DefWindowProc in the Windows API.

http://www.mamedev.org/source/src/os.../window.c.html
Reply With Quote
Old 03-19-2014, 11:54 PM   #3
Kong's Avatar
 
Kong

Re: DefWindowProc Pauses MAME on Resize

I am using window.c in mame 152.

SC_MOVE and SC_SIZE were not there until I added them.

Add this to line 1351 inside case WM_SYSCOMMAND:

Code:
            if (cmd == SC_SIZE)
            return 0;
            
            if (cmd == SC_MOVE)
            return 0;
And you will block drag and resize because you are preventing DefWindowProc from running.
My SignatureDisplay Signature Reply With Quote
Old 03-20-2014, 12:06 AM   #4
Seahawk's Avatar
Regular Poster
4,154 posts
Seahawk has earned the ear of the admin. Watch yourself!Seahawk has earned the ear of the admin. Watch yourself!Seahawk has earned the ear of the admin. Watch yourself!Seahawk has earned the ear of the admin. Watch yourself!Seahawk has earned the ear of the admin. Watch yourself!Seahawk has earned the ear of the admin. Watch yourself!Seahawk has earned the ear of the admin. Watch yourself!Seahawk has earned the ear of the admin. Watch yourself!Seahawk has earned the ear of the admin. Watch yourself!Seahawk has earned the ear of the admin. Watch yourself!Seahawk has earned the ear of the admin. Watch yourself!
View Stats
 
Seahawk

Re: DefWindowProc Pauses MAME on Resize

Your post sounds odd, is it a reply to me, or additional information to your OP?

Regardless, because the case is handled, so you won't trigger the default case of DefWindowProc.

I more meant this line that I quoted
winwindow_ui_pause_from_window_thread(window->machine(), TRUE);

is implied through the comment and function name, to stop everything, so maybe set to FALSE instead.

We may not be looking at the same source.
Reply With Quote
Old 03-20-2014, 12:30 AM   #5
Kong's Avatar
 
Kong

Re: DefWindowProc Pauses MAME on Resize

We already tried that in 2011

http://www.retrouprising.com/showthr...t=11269&page=3

My last post was a reply to your post.

I am positive that DefWindowProc is causing the pause.
I think the only two ways to interrupt it are
1. Use multiple threads - I don't really know what this means.
2. Add SC_MOVE and SC_SIZE and add your own custom code to handle those basic windows functions. I don't know how to do that either. But removing DefWindowProc removes the move and size functions.

Can you take look at this please
Win32 Loopless Window Size / Move / Code / [b2f2e2]
My SignatureDisplay Signature Reply With Quote
Old 03-20-2014, 12:37 AM   #6
Seahawk's Avatar
Regular Poster
4,154 posts
Seahawk has earned the ear of the admin. Watch yourself!Seahawk has earned the ear of the admin. Watch yourself!Seahawk has earned the ear of the admin. Watch yourself!Seahawk has earned the ear of the admin. Watch yourself!Seahawk has earned the ear of the admin. Watch yourself!Seahawk has earned the ear of the admin. Watch yourself!Seahawk has earned the ear of the admin. Watch yourself!Seahawk has earned the ear of the admin. Watch yourself!Seahawk has earned the ear of the admin. Watch yourself!Seahawk has earned the ear of the admin. Watch yourself!Seahawk has earned the ear of the admin. Watch yourself!
View Stats
 
Seahawk

Re: DefWindowProc Pauses MAME on Resize

Ha! That's hilarious to fall for the same trap again. I guess I should stick to embedded devices .

I'll look into it.
Reply With Quote
Old 04-06-2014, 11:47 AM   #7
Kong's Avatar
 
Kong

Re: DefWindowProc Pauses MAME on Resize

Hawk any chance to look at the loopless window link?
My SignatureDisplay Signature Reply With Quote
Old 04-07-2014, 05:11 AM   #8
Seahawk's Avatar
Regular Poster
4,154 posts
Seahawk has earned the ear of the admin. Watch yourself!Seahawk has earned the ear of the admin. Watch yourself!Seahawk has earned the ear of the admin. Watch yourself!Seahawk has earned the ear of the admin. Watch yourself!Seahawk has earned the ear of the admin. Watch yourself!Seahawk has earned the ear of the admin. Watch yourself!Seahawk has earned the ear of the admin. Watch yourself!Seahawk has earned the ear of the admin. Watch yourself!Seahawk has earned the ear of the admin. Watch yourself!Seahawk has earned the ear of the admin. Watch yourself!Seahawk has earned the ear of the admin. Watch yourself!
View Stats
 
Seahawk

Re: DefWindowProc Pauses MAME on Resize

I've written a simple Opengl application for it and am working on integrating it. I'm not super familiar with the Windows API (all my code for college classes and job had to be OS neutral) so I'm having to pick this up while I go along.
Reply With Quote
Old 07-27-2014, 03:42 PM   #9
Kong's Avatar
 
Kong

Re: DefWindowProc Pauses MAME on Resize

Hawk any luck?

I have added most of code to 154. About to just disable move and resize in score mode unless someone has a better solution.

---------- Post added at 01:39 PM ---------- Previous post was at 01:38 PM ----------

I think this will fix it but I don't know how to implement it.
Win32 Loopless Window Size / Move / Code / [b2f2e2]

---------- Post added at 03:42 PM ---------- Previous post was at 01:39 PM ----------

FINALLY!!

All pauses can be disabled.

Question should pause be disabled in all score mode games or only in games where it would have a benefit?
My SignatureDisplay Signature Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
C++ and MAME Kong Programmers Developers Designers 10 08-10-2014 01:19 PM
The ultimate RU Mame Cabinet Youchoptrees Chat 5 04-24-2013 12:30 AM
im buildind a mame cabinet Slime Slayer Help 30 08-06-2012 12:24 AM
Can Someone Resize Some Images For Me? TrakMastaTom Help 2 09-09-2010 09:10 AM


All times are GMT -5. The time now is 02:52 AM.

» vBadvanced CMPS