The NEW Build Your Own Arcade Controls

Main => Software Forum => Topic started by: johnye_pt on August 11, 2024, 10:38:41 am

Title: Change MAME source code to show "GAME PAUSED" when pausing game?
Post by: johnye_pt on August 11, 2024, 10:38:41 am
I'm using MAME 0.170 because it's the last version that supports DirectDraw for XP. I've modded my version to include HISCORE.DAT support and to skip game's info/warnings by using this topic's patches (http://forum.arcadecontrols.com/index.php?topic=64298.0), plus I changed #define FORCE_DIRECTINPUT from 0 to 1 so I can use an AutoHotKey script to insert 3 credits by pressing 5 x3 times when the number 6 is pressed, because that's how it worked back in my time ;)

I found this diff (http://forum.arcadecontrols.com/index.php/topic,33233.msg287693.html#msg287693) that adds one key save (avoids requiring to press a key to select a save slot position), but I think I can do that with the AutoHotKey script. The one thing I can't do is add the "GAME PAUSED" text to the code, since the diff is from March 2005 and seems to be based on MAME 0.94 source code, which is completely different from 0.170. For one, it modifies the src\usrintrf.c which doesn't exist in 0.170, but I believe its counterpart is src\emu\ui\ui.cpp. Secondly, it adds the text by using UI_TEXT, which doesn't exist in 0.170.

Could someone help me find out how to add the "GAME PAUSED" message when MAME is paused? 0.170 and current 0.268 code seems similar, so the modifications for 0.268 might be applicable to 0.170.

EDIT: Forgot to mention that the diff was posted 19 years ago and the user hasn't been active in 10 years...
Title: Re: Change MAME source code to show "GAME PAUSED" when pausing game?
Post by: johnye_pt on August 11, 2024, 03:59:26 pm
Ok, instead of editing the 1st post, I'll add a new post with the answer.

After a LOT of trial and error, here is the modification to add the "GAME PAUSED" message. In src\emu\ui\ui.cpp, replace...
Code: [Select]
container->add_rect(0.0f, 0.0f, 1.0f, 1.0f, rgb_t(alpha,0x00,0x00,0x00), PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA));
}
... with...
Code: [Select]
container->add_rect(0.0f, 0.0f, 1.0f, 1.0f, rgb_t(alpha,0x00,0x00,0x00), PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA));
//PATCH - add "GAME PAUSED" message
draw_message_window(container, "GAME PAUSED");
}

And here is the VERY CRUDE modifications for the one-key load/save. In src\emu\ui\ui.cpp, replace...
Code: [Select]
if (state == LOADSAVE_NONE)
return 0;

// okay, we're waiting for a key to select a slot; display a message
... with...
Code: [Select]
if (state == LOADSAVE_NONE)
return 0;

//PATCH - skip user input and jump directly to load/save code
goto PATCH_jump;

// okay, we're waiting for a key to select a slot; display a message

And also replace...
Code: [Select]
if (file == 0)
return state;

// display a popup indicating that the save will proceed
... with...
Code: [Select]
if (file == 0)
return state;

//PATCH - set key pressed to be always "0" and proceed with save/load
PATCH_jump:
file = '0';

// display a popup indicating that the save will proceed

I would make a DIFF but I don't know how to.
Title: Re: Change MAME source code to show "GAME PAUSED" when pausing game?
Post by: abispac on August 12, 2024, 01:18:33 pm
You can also achieve what you looking for with AHK, I'm not sure how to be honest, but back in the days I had an ahk script that would add time to console games everytime you added a coin to make them coin op. And it would display the time on screen, it would also add a sound for the time almost being gone so you could add more coins, the script would also pause the games for a few seconds after the time was gone to give you some more time to add coins, so yeah,its possible with ahk to pause the game and display a message. But unfurtunily, I don't have that script anymore. Ima a look for it to see if I can find it.  I don't promise anything.
Title: Re: Change MAME source code to show "GAME PAUSED" when pausing game?
Post by: johnye_pt on August 14, 2024, 08:19:53 pm
Thanks for the offer. but the pause message is simply to actually see that the game is paused, I don't like that it just darkens the screen, it makes it look like the computer is frozen to some people that don't know better. I'm also interested in including the External DAT support that was added to 0.171 but that's a much bigger endeavor than just adding a new line of code or commenting a few lines.

By the way, here's all the DIFFs I used in my custom build (so far) in case anyone is interested. I figured out how to create DIFFs, I also found a simpler way for the One Key Load/Save patch by commenting the unneeded code with /* */ instead of using the ugly GoTo command.