Main Restorations Software Audio/Jukebox/MP3 Everything Else Buy/Sell/Trade
Project Announcements Monitor/Video GroovyMAME Merit/JVL Touchscreen Meet Up Retail Vendors
Driving & Racing Woodworking Software Support Forums Consoles Project Arcade Reviews
Automated Projects Artwork Frontend Support Forums Pinball Forum Discussion Old Boards
Raspberry Pi & Dev Board controls.dat Linux Miscellaneous Arcade Wiki Discussion Old Archives
Lightguns Arcade1Up Try the site in https mode Site News

Unread posts | New Replies | Recent posts | Rules | Chatroom | Wiki | File Repository | RSS | Submit news

  

Author Topic: Hey, MAME compiling genius-types!  (Read 3185 times)

0 Members and 1 Guest are viewing this topic.

Kremmit

  • - AHOTW -
  • Wiki Contributor
  • Trade Count: (+2)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 3165
  • Last login:June 17, 2025, 04:07:55 pm
  • Who the heck is that?

headkaze

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 2943
  • Last login:August 14, 2023, 02:00:48 am
  • 0x2b|~0x2b?
Re: Hey, MAME compiling genius-types!
« Reply #1 on: January 15, 2006, 02:33:29 pm »
I don't think compiling is so much the problem it's hosting the 40 odd meg file. But compiling is quite easy...

1. Download MinGW
2. Place it C:\MinGW
3. Download official Mame source from here and extract to C:\MinGW\mame32fx
4. You can get the latest patches to update it from 0.103 to 0.103u2 by using "patch -p0 -E <diffname.diff ".
5. Download Mame32FX Source and just overwrite the files extracted to C:\MinGW\mame32fx
6. Change the source code however you like
7. Launch the appropriate batch file "compile P4.bat" for a Pentium 4 optimized build, or "compile I686.bat" for a generic Intel 686 build etc.
8. It will take quite a long time to compile, once it's compiled it will create your exe.. eg. mame32FXp4.exe

Simple as (ahem) that, well it's worth learning because then you can always compile your own build, remove the nag screens etc. I chose the Mame32FX build because thats the one I use. But it should work similar to other builds.

JoyMonkey

  • Voodoo Wiki Master . . .
  • Wiki Master
  • Trade Count: (+5)
  • Full Member
  • *****
  • Offline Offline
  • Posts: 2899
  • Last login:June 16, 2025, 09:16:27 pm
  • Candy is Dandy but Liquor is Quicker
    • JoyMonkey.com
Re: Hey, MAME compiling genius-types!
« Reply #2 on: January 15, 2006, 06:58:28 pm »
You forgot step nine:

9. Use UPX to compress the compiled executable from forty-something megs down to a more manageable size.

markrvp

  • ARGHHHHHHHHHHHHH!!!!!!!!!! True Genius!
  • Wiki Contributor
  • Trade Count: (+4)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 3353
  • Last login:September 14, 2020, 10:19:57 am
  • NFL Expert
Re: Hey, MAME compiling genius-types!
« Reply #3 on: January 16, 2006, 02:18:54 am »
Kremmit:

Did you do this yet?

markrvp

  • ARGHHHHHHHHHHHHH!!!!!!!!!! True Genius!
  • Wiki Contributor
  • Trade Count: (+4)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 3353
  • Last login:September 14, 2020, 10:19:57 am
  • NFL Expert
Re: Hey, MAME compiling genius-types!
« Reply #4 on: January 16, 2006, 12:59:13 pm »
Quote
4. You can get the latest patches to update it from 0.103 to 0.103u2 by using "patch -p0 -E <diffname.diff ".

I am trying to do this so Kremmit and I can make a Z axis change to MAME for beta testing the new Optiwiz.  I don't know how to do the patch.  Could you please give me step by step instructions for how to do this?

I appreciate any help available.  Below is what happened when I thought I was following the instructions.  I'm assuming I actually need an executable called patch.exe?  Where do I get it and where do I put it?  Also where should the .diff file go?
« Last Edit: January 16, 2006, 01:10:00 pm by markrvp »

SirPoonga

  • Puck'em Up
  • Global Moderator
  • Trade Count: (+1)
  • Full Member
  • *****
  • Offline Offline
  • Posts: 8187
  • Last login:Yesterday at 10:19:16 pm
  • The Bears Still Suck!
Re: Hey, MAME compiling genius-types!
« Reply #5 on: January 16, 2006, 01:20:26 pm »
http://www.gnu.org/software/patch/patch.html
You need that utility, and put it in yout PATH environment variable (right click my computer/properties/Advanced/Environment Variables/System Variables/Edit Path variable to point to where patch is located.

The dif file needs to be in the mame folder with the source code (but not the src folder).
well, most patches work form that location, some might need to be put in the src folder.

2600

  • Trade Count: (+7)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 1630
  • Last login:June 05, 2017, 10:20:56 am
  • I want my own arcade controls!
Re: Hey, MAME compiling genius-types!
« Reply #6 on: January 16, 2006, 01:27:49 pm »
Hey step back guys, let's stop making it harder for them.  They should be doing the simplest of instructions there is no reason for them to patch up to u2 just to test the mouse. And No reason to use mame32fx instead of the regular build of mame.

Once they learn the basics, then we can move on if they want.

Tiger-Heli

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 5447
  • Last login:January 03, 2018, 02:19:23 pm
  • Ron Howard? . . . er, I mean . . . Run, Coward!!!
    • Tiger-Heli
Re: Hey, MAME compiling genius-types!
« Reply #7 on: January 16, 2006, 03:21:18 pm »
There's also a step-by-step here, but it might be slightly out-of-date.
It's not what you take when you leave this world behind you, it's what you leave behind you when you go. - R. Travis.
When all is said and done, generally much more is SAID than DONE.

markrvp

  • ARGHHHHHHHHHHHHH!!!!!!!!!! True Genius!
  • Wiki Contributor
  • Trade Count: (+4)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 3353
  • Last login:September 14, 2020, 10:19:57 am
  • NFL Expert
Re: Hey, MAME compiling genius-types!
« Reply #8 on: January 16, 2006, 03:29:57 pm »
Tiger, I didn't get the link.

Tiger-Heli

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 5447
  • Last login:January 03, 2018, 02:19:23 pm
  • Ron Howard? . . . er, I mean . . . Run, Coward!!!
    • Tiger-Heli
Re: Hey, MAME compiling genius-types!
« Reply #9 on: January 16, 2006, 03:36:24 pm »
It's not what you take when you leave this world behind you, it's what you leave behind you when you go. - R. Travis.
When all is said and done, generally much more is SAID than DONE.

SirPoonga

  • Puck'em Up
  • Global Moderator
  • Trade Count: (+1)
  • Full Member
  • *****
  • Offline Offline
  • Posts: 8187
  • Last login:Yesterday at 10:19:16 pm
  • The Bears Still Suck!
Re: Hey, MAME compiling genius-types!
« Reply #10 on: January 16, 2006, 03:53:54 pm »
However, that set of instructions is a little out of date.  Do not use the source code and migw downloads from it.
Goto the main download page on mame.net.  Get the source code (of course) and the utilities int he section for the mame version you want to compile.  Assuming 103 you will want the first set links.  Install MingW with the exe then unzip the ming-over file tot he mingw folder.

Once you setup your path to include the mingw bin folder you can put your source code where ever you want.
A good rule of thumb, keep a copy of the original source around incase something goes wrong.

BEFORE adding any patches (diffs) compile mame to make sure it compiles.  This will determine if the problems you encounter are install related or source related.  If you compiled first time after a source code change it would be tougher to determine why an error occured if it occurs.

markrvp

  • ARGHHHHHHHHHHHHH!!!!!!!!!! True Genius!
  • Wiki Contributor
  • Trade Count: (+4)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 3353
  • Last login:September 14, 2020, 10:19:57 am
  • NFL Expert
Re: Hey, MAME compiling genius-types!
« Reply #11 on: January 16, 2006, 06:06:21 pm »
Okay, I'm getting frustrated.  I tried the compile routine posted by HeadKaze and it looks like it's compiling in a DOS box, and when it gets through a new folder called "obj" is created with includes one folder called "mame32FXp4" but an executable is not created.  I've done this twice.


I have tried what SirPoonga suggests without trying to patch anything.  I extracted the MinGW file to a folder in c:\MinGW.  I extracted the "over .92" file on top of MinGW.  I have extracted the MAME .103 source into its own folder and I have extracted the Mame32 source on top of that.  Then I went in and made the change to the source I wanted which was just changing one mouse value from 512 to 4.

Here is where I think I don't have something right:

Quote
Now most people will tell you to set up your path by editing your c:\autoexec.bat file. I have a grudge against this because some people use multiple utilities for different programs and mixing includes and libs and such will make you pull your hair out! I recommend going to your windows/command directory and opening a new text file. In the text file, type "  path=c:\mingw\bin;%path% " with the correct path for your mingw, of course, and save it as mingw.bat. From now on, you will be able to just type "mingw" (without the quotes) at the command prompt from anywhere and your path will be set up. When you close that command prompt and open a new one, your path will be as default.

I'm running Windows XP and there is not a COMMAND folder in the Windows directory.  I was able to create a file called mingw.bat but it is in the c:\mingw folder.  Shouldn't it go somewhere else?  Is it supposed to go in the "mame .103" folder?  I feel very strongly that I don't have a path setup correctly somewhere.  Also, please verify that the text in the mingw.bat file should read exactly:

PATH=C:\MINGW\BIN;%path%


In a DOS prompt I go to      c:\mame .103     where all the source code is.  It is my understanding that I should then type:  mingw

(EDIT:  While I've been typing I did indeed copy the mingw.bat file into the Mame .103 folder where the source is and opened a dos prompt and typed mingw which seemed to do something.  The I typed mingw32-make which started a compile.  However, since I didn't type "mingw32-make WINUI=1 P4=1 SUFFIX=32" will it just be a regular commandline version of MAME?)

Also, after a successful compile, where should I be able to find the  MAME.exe?

Please stay with me.



JoyMonkey

  • Voodoo Wiki Master . . .
  • Wiki Master
  • Trade Count: (+5)
  • Full Member
  • *****
  • Offline Offline
  • Posts: 2899
  • Last login:June 16, 2025, 09:16:27 pm
  • Candy is Dandy but Liquor is Quicker
    • JoyMonkey.com
Re: Hey, MAME compiling genius-types!
« Reply #12 on: January 16, 2006, 06:18:22 pm »
Why are you bringing Mame32 source into it? That might be why you're having difficulties.
I'm compiling Mame 0.103 with the change that u_rebelscum suggested right now. Should be done in about 30 minutes.
I haven't compiled anything above 0.92, but it looks like nothing in MinGW has changed since then, so it should work (hopefully).

markrvp

  • ARGHHHHHHHHHHHHH!!!!!!!!!! True Genius!
  • Wiki Contributor
  • Trade Count: (+4)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 3353
  • Last login:September 14, 2020, 10:19:57 am
  • NFL Expert
Re: Hey, MAME compiling genius-types!
« Reply #13 on: January 16, 2006, 06:22:06 pm »
If it works would you please make it available for download?


So if I had not extracted the Mame32 source on top of the MAME source, would I still use the same mingw.bat file with the path I had set?  Does the mingw.bat file go in the MAME source directory?

Assuming that the MAME source is in its own directory (not in the MinGW directory), what should I type from the dos prompt to activate a successful compilation?
« Last Edit: January 16, 2006, 06:24:32 pm by markrvp »

SirPoonga

  • Puck'em Up
  • Global Moderator
  • Trade Count: (+1)
  • Full Member
  • *****
  • Offline Offline
  • Posts: 8187
  • Last login:Yesterday at 10:19:16 pm
  • The Bears Still Suck!
Re: Hey, MAME compiling genius-types!
« Reply #14 on: January 16, 2006, 06:25:00 pm »
I have tried what SirPoonga suggests without trying to patch anything.  I extracted the MinGW file to a folder in c:\MinGW.  I extracted the "over .92" file on top of MinGW.  I have extracted the MAME .103 source into its own folder and I have extracted the Mame32 source on top of that.  Then I went in and made the change to the source I wanted which was just changing one mouse value from 512 to 4.
You did more than what I suggested.  Just compile mame.  Not mame32 or any variant.  Once you get compiling working then add the other stuff.

Here is where I think I don't have something right:

Quote
PATH=C:\MINGW\BIN;%path%

In a DOS prompt I go to      c:\mame .103     where all the source code is.  It is my understanding that I should then type:  mingw

Path correct, doesn't matter where the bat file is as long as you run the bat file while in a command line.  In the same commandline (as the path just set is temporary and will only work within the current session) type make to compile mame.  Not mingw. 


Basic steps are
Install mingw
Extra mingw-over
Extra mame 103 source code somewhere
create the above bat file, I suggest putting it in the mame source folder as that will be the easiest place to use it.
Open a command prompt and goto the mame source location.
execute the bat file (just type it in and press enter)
type make

Since you got the obj folder that suggests you have something correct, compiling-wise.  But there might be an error which causes the compile to stop.

A brief dumbed down of what compiling does...
A compiler will take your source code, in this case most of it is written in C.  It will first convert the source code to obj files.  These are direct binaries from translating the source code text to instructions the computer understands.  Then, if there are no errors, the linker will link all those obj files into an exe.  Of course there's alot more detail to it than that, but that's the summary of what is happening.

When all is said an done with no errors you should end up with an exe in the mame source folder (note I am not refering to the src folder, I am refering to the base folder with the base makefile).

Also, I suggest getting the command from here power toy
http://www.microsoft.com/windowsxp/downloads/powertoys/xppowertoys.mspx
Then you just right click your source folder, command from here, and you have a command prompt at the right location.

JoyMonkey

  • Voodoo Wiki Master . . .
  • Wiki Master
  • Trade Count: (+5)
  • Full Member
  • *****
  • Offline Offline
  • Posts: 2899
  • Last login:June 16, 2025, 09:16:27 pm
  • Candy is Dandy but Liquor is Quicker
    • JoyMonkey.com
Re: Hey, MAME compiling genius-types!
« Reply #15 on: January 16, 2006, 06:55:57 pm »
Here it is:
http://www.joymonkey.com/modules.php?name=UpDownload&req=viewdownload&cid=6

Please click on the Google Ads!

(I should add that I'm not an OptiWiz beta tester and I don't really know what this source change is supposed to do. oh, and I'm not a compiling genius-type, but I tested this mame.exe with arkanoid and it ran fine.)

And here's the best instructions I could find for compiling Mame, it's short and to the point, has lots of screenshots and works with 0.92 to 0.103 without problems
http://www.mameworld.net/mrdo/compile.html
« Last Edit: January 16, 2006, 07:27:44 pm by JoyMonkey »

markrvp

  • ARGHHHHHHHHHHHHH!!!!!!!!!! True Genius!
  • Wiki Contributor
  • Trade Count: (+4)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 3353
  • Last login:September 14, 2020, 10:19:57 am
  • NFL Expert
Re: Hey, MAME compiling genius-types!
« Reply #16 on: January 16, 2006, 10:39:31 pm »
Thank you very much guys.  The version JoyMonkey compiled worked great and I was also able to successfully compile my own version as well.

I appreciate very much all your assistance here.

SirPoonga

  • Puck'em Up
  • Global Moderator
  • Trade Count: (+1)
  • Full Member
  • *****
  • Offline Offline
  • Posts: 8187
  • Last login:Yesterday at 10:19:16 pm
  • The Bears Still Suck!
Re: Hey, MAME compiling genius-types!
« Reply #17 on: January 17, 2006, 12:05:51 am »
It's really not that hard once you understand it :)

elvis

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 1154
  • Last login:January 13, 2025, 08:48:40 am
  • penguin poker
    • StickFreaks
Re: Hey, MAME compiling genius-types!
« Reply #18 on: January 17, 2006, 03:55:25 am »
You forgot step nine:

9. Use UPX to compress the compiled executable from forty-something megs down to a more manageable size.

I don't do this for two reasons:

1) When sending the file electronically, 7zip or WinRAR will give you equally as good compression

2) When you UPX an executable, the entire executable must be loaded into memory when it is decompressed and If you have an old PC with low memory, this is a problem as UPX'ed MAME takes around 30+ MB of memory just to load the program (before the ROM even loads).  If you don't UPX the executable, MAME will only load it's core and dynamically call on the drivers it needs, reducing memory usage down to roughly 1-2MB for the executable itself.  While this isn't a big deal for folks who play MAME on their home PCs with heaps of RAM, it can make all the difference for those making dedicated cabinets out of low-spec leftover hardware.