xboxscene.org forums

Author Topic: Helpful Mame Compliling Hints  (Read 277 times)

ressurectionx

  • Archived User
  • Hero Member
  • *
  • Posts: 2778
Helpful Mame Compliling Hints
« on: March 16, 2008, 05:33:00 PM »

HELPFUL MAME COMPILING HINTS Tutorials and Notes - See Below For Where To Ask Questions

Hopefully they can be of use to anybody else who is interested in compiling on MAME now or in the future.

I thought this was as good a place as any to put my notes.  Maybe you'd like to add your own too?  This thread will be for any tutorials or interesting notes that I or anyone else would like to add to about compiling a MAME build.  This thread will NOT be for discussing them though.  Discussion of any notes or tutorials in this thread can go here:  

QUESTIONS & DISCUSSION OF MAME COMPILE NOTES & TUTORIALS:  http://forums.xbox-s...howtopic=644758

This thread will NOT be about setting up XDK on your XBox or PC either.  It is expected in here that you've already done this and that your XBox Neighborhood works right.  The thread for discussion and questions about installing XDK and setting up the XDK correctly is here:

Compiling My First XBE:  http://forums.xbox-s...howtopic=643743

When writing something here, keep it clean looking.  There won't be any specific rules about how your notes or tutorials should look, but make them easy to read and understand.

Please respect the thread rules and keep the thread clean from questions or comments that can go in the other threads(s).  I don't claim this will ever be a full tutorial about MAME code/coding on the XBox, but we have an opportunity here to make a collection of some interesting notes helpful hints for anyone trying to do this in the future.

Thanks, and I hope you get a lot of use out of it,
~Rx
Logged

ressurectionx

  • Archived User
  • Hero Member
  • *
  • Posts: 2778
Helpful Mame Compliling Hints
« Reply #1 on: March 16, 2008, 05:49:00 PM »

CHANGING ROM NAMES IN THE GUI*:

When looking deeper into the ".c" files located in the Source\Drivers of your MAME project, you might notice that a lot of the files match the names of the zipfiles for your MAME roms.

Ex:  
1942.c
1943.c
1945kii.c

If you double click on one, and really look at the code, you might be suprised at how much of it you can kind of figure out what it means.  (I have very little, to no coding experience).  It's not exactly in English, but you will see some things that you recognize.  

The one thing I did see right away though on my first look was that at the bottom of the ".c" file there is a section of lines where the first word is "GAME" on each line.  At the end of each line, you might notice that in "quotes" there is the actual game name of the rom in your MAME GUI.  

Ex (For Pac-Man):
QUOTE
GAME( 1980, puckman,  0,        pacman,   pacman,   0,        ROT90,  "Namco", "PuckMan (Japan set 1)" )
GAME( 1980, puckmana, puckman,  pacman,   pacman,   0,        ROT90,  "Namco", "PuckMan (Japan set 2)" )
GAME( 1980, pacman,   puckman,  pacman,   pacman,   0,        ROT90,  "[Namco] (Midway license)", "Pac-Man (Midway)" )
GAME( 1981, puckmod,  puckman,  pacman,   pacman,   0,        ROT90,  "Namco", "PuckMan (harder?)" )
GAME( 1981, pacmod,   puckman,  pacman,   pacman,   0,        ROT90,  "[Namco] (Midway license)", "Pac-Man (Midway, harder)" )
GAME( 1981, hangly,   puckman,  pacman,   pacman,   0,        ROT90,  "hack", "Hangly-Man (set 1)" )
GAME( 1981, hangly2,  puckman,  pacman,   pacman,   0,        ROT90,  "hack", "Hangly-Man (set 2)" )
GAME( 1981, hangly3,  puckman,  pacman,   pacman,   0,        ROT90,  "hack", "Hangly-Man (set 3)" )


It's my belief that if you were to edit these names to what you want , like removing "(Japan set 1)" from it, that when you compiled it your XBE will display the edited name.  

*I believe I've already figured out how to do this, but since I haven't yet been able to compile a complete successful build of MAME, I cannot test it yet.
Logged

ressurectionx

  • Archived User
  • Hero Member
  • *
  • Posts: 2778
Helpful Mame Compliling Hints
« Reply #2 on: March 16, 2008, 07:28:00 PM »

MISSING PROJECTS IN EXISTING SOURCE CODE:

The particular version of MAME that I acquired is not available to the public.  Upon opening it in the Development Environment, I would get 3 separate errors telling me that these projects failed to open:

C:\MAMEdOX\MAMEoXLauncher\MAMEoXLauncher.vcproj
C:\MAMEdOX\libsmb++\libsmb.vcproj
C:\MAMEdOX\SharedResources\SharedResources.vcproj

When looking at the source in explorer, neither of those 3 directories even existed at all.  I only had two directories in C:\MAMEdOX.   They were:

C:\MAMEdOX\MAME\MAME.vcproj
C:\MAMEdOX\MAMEoX\MAMEoX.vcproj

So, for whatever reason, the provider of the source had removed these directories before releasing the source.  At this point, I do not know enough to know if I can just replace them without problems, but what I can verify is that if you add the three missing directories from "MAMEdOX_1.1_080305_src" at the usual places, the Solution will open without giving errors stating that the projects don't open.  

This may only be something that I need to know, given the unorthodox way I got this source, but it is still interesting and is a small lesson in how Projects work to make up a solution.
Logged

ressurectionx

  • Archived User
  • Hero Member
  • *
  • Posts: 2778
Helpful Mame Compliling Hints
« Reply #3 on: March 25, 2008, 02:43:00 PM »

POSSIBLE FIX IF YOU'RE GETTING THE
"NO SYMBOLIC INFORMATION" ERROR ON DEBUG START:

(Worked for me!)
Well I don't know if it's ready to debug yet, but I made it another step.  I just couldn't get the debug to start without an error because I was getting the following error in a pop-up box:

QUOTE
No Symbolic Information:

'devenv.exe' does not contain debugging information.  (No symbols loaded.) Click OK to debug anyway.

So.... with an error like that, which I thought was suprisingly specific for an M$ notification to the lay person, I went on a quest to find the missing symbols and and return them to their proper place so I could unlock the secrets of the XBox Debug Console.  It didn't matter what I did though.  Failure upon failure became mine to endure for weeks on end which left me with little hope that the secrets of the XBox Debug Console would ever be within my grasp.  I tried, helplessly, to add the "symbols" directories from both MS Visual Basic and MS Xbox SDK folders to the project.  I struggled in vain, messing around with the debug and retail configuration settings.  Then when all else failed, I basically just randomly pushed a lot of buttons I was pretty sure that I wasn't supposed to press.  Sorrow overcame me but my OCD wouldn't let go of the impulse not to quit.  Two powerful emotions ravaging me and pitting me against myself was starting to drive me mad!  Surely something must give before I allow this quest to consume me?

When I was perched high upon the top of the hill peering down over the cliff of insanity, some faint glimmer was caught in the corner of my eye.  It was only there a second but I know I saw it.  Chasing that rabbit down for what seemed like weeks (it was) I finally pounced on it, like Mario trying to mug a rabbit in the Mushroom Kingdom.  This one didn't have a star though... just a url from the Google search engine.  So I clicked on it and.....

"Oh... really?  That's it?  It can't be that simple...  Yep... Yes it is!  It is that simple!  Seems like it's working fine now!  No..  No XBox Debug Console.... I don't feel like celebrating at all right now.  No...  I'm pissed off at you now Debug Box.  This quest is BULLSHIT!  *expletive* YOU, XBox!  Go eat a *expletive*, I exclaimed as mightily hurled my XBox deep into the abyss which up until 5 seconds ago used to be my big screen TV.

Satisfied at my triumph, both in the success of my endlessly long quest as well as my physical domination of my XBox Debug console, I sat down and began to write about this experience as best I could recollect it.  Besides.... I'm pretty bored now since I'll probably have to wait at least a week for my new XBox to come on ebay, and I can't watch Family Guy on Adult Swim tonight unless I get a new TV.


The riddle was so infuriatingly simple, that not one person, n00b or expert alike, ever had the answer to it.  Wherever I asked.  Even on sites that had nothing to do with emulation.  In spite of all that, it turns out to be a really simple fix fix for what is probably the stupidest and hopefully one of the more common reasons for the error for n00bs.  I'd like to think I'm not the only one anyhow...  

After fixing it, I was actually able to make the XBox reboot from my PC when asked if I wanted to reboot the XBox and debug the current project.   cool.gif

M$ help would have you read this, and then gleefully mock you while you danced like a marionette on a string of wild goose chases, when you asked it what that error meant:

QUOTE
No Symbolic Information Dialog Box
This dialog box appears when you attempt to debug a project that has no symbolic debug information available. This may happen if:

-You attempt to debug a Retail configuration of a project rather than the Debug configuration.
-You've changed the Debug configuration settings in the Property Pages dialog box.
-You are opening an .EXE as a project.

Don't show this dialog again

Disables this dialog box. You can turn it on again by going to the Options dialog box, opening the Debugging Folder, clicking the General category, and selecting Warn if no symbols on launch.

See Also

General, Debugging, Options Dialog Box | Debug Settings and Preparation


Ummmmmmm.... I'm sure they're all good solutions if any of those reasons were the cause of the debug not working.  But why do I think you're making this more complicated than it has to be?

REAL SOLUTION:

Start the .xbe on your XDK Dash before you try to debug from your PC, ya big dummy!!!

It probably sounds real stupid that I did this, I admit, but it's had to have happened to a few other people before.  If this was your problem hopefully you found this post before you threw your XBox through your TV set too.  

For some reason I thought that I had to be in the dashboard and not run any xbe.  I thought part of the the debug startup process was to start the xbe that was being debugged.  I don't know why I thought this, but I just did and it didn't even ever occur to me till I read it somewhere that I should start the .xbe before debugging.   blink.gif    

In other words, this was never even on my radar when looking for a solution.

When I get my new TV and XBox, I have to figure out what to do next.  Kinda wingin' it here, if ya hadn't noticed.
Logged

ressurectionx

  • Archived User
  • Hero Member
  • *
  • Posts: 2778
Helpful Mame Compliling Hints
« Reply #4 on: March 25, 2008, 05:03:00 PM »

Remapping joystick in MAME (PART I):


For this example, we will use the game Wardner.  In wardner.c (An easy way to bring it up is to do  a find on the entire project of MAME for "wardner.c" until the document is up and you are inside it).  Find the section that says WARDNER_PLAYER_INPUT


QUOTE
#define  WARDNER_PLAYER_INPUT( player )                               \
   PORT_START             /* Player 1 button 3 skips video RAM tests */    \
   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP    | IPF_8WAY | player ) \
   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN  | IPF_8WAY | player ) \
   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT  | IPF_8WAY | player ) \
   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT | IPF_8WAY | player ) \
   PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_BUTTON1 | player)   /* Fire */       \
   PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_BUTTON2 | player)   /* Jump */    \

   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_BUTTON3 | player)   /* Shot C */       \
   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_BUTTON4 | player)   /* Shot D */


I started with Wardner because I wasn't able to figure out Inferno by itself.  I wanted to compare it to other games.  I know I'm on to something though, because when I deleted the lines that are in bold above and recompiled the build, I could no longer shoot or jump.  I still don't know what the text here means exactly, but I do know that there is a reason that deleting those two lines results in the inability to fire or jump.  I will experiment with it and update, but at least we know a place where keymapping can be altered now.

(SIDE NOTE:  You may just want to do a search on the name of the game without the ".c" after it.  Inferno's drivers aren't in "inferno.c" because there is no "inferno.c".  Inferno's drivers are located in "williams.c".  This happens quite often actually where the game is grouped with other games in one ".c" file.)
Logged

ressurectionx

  • Archived User
  • Hero Member
  • *
  • Posts: 2778
Helpful Mame Compliling Hints
« Reply #5 on: March 25, 2008, 05:54:00 PM »

REMAPPING JOYSTICK IN MAME (PART II):

This is exciting as hell. Finally some real progress. cool.gif

I was able to successfully switch the fire and jump buttons on Wardner (Just as a test, I like how BP had it mapped already) and I was able to make it so the right joystick controls the firing as well as the direction on Inferno.



Here's what I did for Inferno:

Originally, part of the code looked like this:

QUOTE
PORT_START /* IN1 */
PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPF_PLAYER1 | IPT_BUTTON1 )
PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPF_PLAYER2 | IPT_BUTTON1 )
PORT_BIT( 0x3C, IP_ACTIVE_HIGH, IPT_UNUSED )
PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_START1 )
PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_START2 )



I changed it to look like this:

QUOTE
PORT_START /* IN1 */
PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPF_PLAYER1 | IPT_JOYSTICKRIGHT_UP )
PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPF_PLAYER1 | IPT_JOYSTICKRIGHT_LEFT )
PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPF_PLAYER1 | IPT_JOYSTICKRIGHT_RIGHT )
PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPF_PLAYER1 | IPT_JOYSTICKRIGHT_DOWN )
PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPF_PLAYER2 | IPT_BUTTON1 )
PORT_BIT( 0x3C, IP_ACTIVE_HIGH, IPT_UNUSED )
PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_START1 )
PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_START2 )



This changed it so that the line:

QUOTE
PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPF_PLAYER1 | IPT_BUTTON1 )

(which mapped fireing to the "A" button)

Was replaced with the following 4 lines:

QUOTE
PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPF_PLAYER1 | IPT_JOYSTICKRIGHT_UP )
PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPF_PLAYER1 | IPT_JOYSTICKRIGHT_LEFT )
PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPF_PLAYER1 | IPT_JOYSTICKRIGHT_RIGHT )
PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPF_PLAYER1 | IPT_JOYSTICKRIGHT_DOWN )


Now when I change direction in game it also fires that way if I hold the joystick down.

What I take from this also is that "IPT_BUTTON1" is the A-Button in mapping.


For WARDNER, X jumped and A fired.  To reverse this, I did the following....

I took the original code:

QUOTE
#define  WARDNER_PLAYER_INPUT( player )                               \
   PORT_START             /* Player 1 button 3 skips video RAM tests */    \
   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP    | IPF_8WAY | player ) \
   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN  | IPF_8WAY | player ) \
   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT  | IPF_8WAY | player ) \
   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT | IPF_8WAY | player ) \
       PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_BUTTON1 | player) /* Fire */ \
        PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_BUTTON2 | player) /* Jump */ \

        PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_BUTTON3 | player)   /* Shot C */    \
   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_BUTTON4 | player)   /* Shot D */


And I changed it to:

#define  WARDNER_PLAYER_INPUT( player )                               \
   PORT_START             /* Player 1 button 3 skips video RAM tests */    \
   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP    | IPF_8WAY | player ) \
   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN  | IPF_8WAY | player ) \
   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT  | IPF_8WAY | player ) \
   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT | IPF_8WAY | player ) \
       PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_BUTTON1 | player) /* Jump */ \
        PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_BUTTON2 | player) /* Fire */ \

        PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_BUTTON3 | player)   /* Shot C */    \
   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_BUTTON4 | player)   /* Shot D */

So I took the Fire and Jump buttons:

QUOTE
       PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_BUTTON1 | player) /* Fire */ \
        PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_BUTTON2 | player) /* Jump */ \


And flipped them around:

       PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_BUTTON1 | player) /* Jump */ \
        PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_BUTTON2 | player) /* Fire */ \


Now X fires and A jumps.

----------------------------------

I still don't know it all about remapping, as I'm just feeling it out.  I will print up more when I learn it.

Next thing I want to figure out is if I wanted to change JOYSTICKRIGHT_UP so that it was the up button on the D-Pad for Inferno, what would I change it to?  I just want to see how the gun direction thing is with the D-Pad.  It works well enough with the right joystick, but you have to be precise with the direction that you fire or it won't shoot.  I was thinking I could put a little play in it if I could use the D-Pad for firing instead.  Maybe not, but I want to know and testing it out is a hell of a lot better way than waiting around hoping somebody will answer me.
Logged

ressurectionx

  • Archived User
  • Hero Member
  • *
  • Posts: 2778
Helpful Mame Compliling Hints
« Reply #6 on: March 26, 2008, 12:36:00 AM »

REMAPPING THE JOYSTICK IN MAME (PART III):

So, in trying to make the gun fire perfectly in Inferno with the diagonals covered as well, I changed it to this, with the commented out sections actually used, but it didn't do much for me.  Sometimes the control wouldn't work (which direction it fired) but overall I think it may have been better otherwise.  If it worked flawlessly I would have kept this code:

QUOTE
INPUT_PORTS_START( inferno )
   PORT_START   /* IN0 (muxed with IN3) */
   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPF_PLAYER1 | IPT_JOYSTICKLEFT_UP )
   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPF_PLAYER1 | IPT_JOYSTICKLEFT_LEFT )
   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPF_PLAYER1 | IPT_JOYSTICKLEFT_RIGHT )
   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPF_PLAYER1 | IPT_JOYSTICKLEFT_DOWN )
//   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPF_PLAYER1 | IPT_JOYSTICKRIGHT_RIGHT | IPT_JOYSTICKRIGHT_UP )
   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPF_PLAYER1 | IPT_JOYSTICKRIGHT_UP )
//   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPF_PLAYER1 | IPT_JOYSTICKRIGHT_UP | IPT_JOYSTICKRIGHT_RIGHT )
//   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPF_PLAYER1 | IPT_JOYSTICKRIGHT_UP | IPT_JOYSTICKRIGHT_LEFT )
   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPF_PLAYER1 | IPT_JOYSTICKRIGHT_LEFT )
//   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPF_PLAYER1 | IPT_JOYSTICKRIGHT_LEFT | IPT_JOYSTICKRIGHT_UP )
//   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPF_PLAYER1 | IPT_JOYSTICKRIGHT_DOWN | IPT_JOYSTICKRIGHT_RIGHT )
   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPF_PLAYER1 | IPT_JOYSTICKRIGHT_RIGHT )
//   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPF_PLAYER1 | IPT_JOYSTICKRIGHT_RIGHT | IPT_JOYSTICKRIGHT_DOWN )
//   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPF_PLAYER1 | IPT_JOYSTICKRIGHT_LEFT | IPT_JOYSTICKRIGHT_DOWN )
   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPF_PLAYER1 | IPT_JOYSTICKRIGHT_DOWN )
//   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPF_PLAYER1 | IPT_JOYSTICKRIGHT_DOWN | IPT_JOYSTICKRIGHT_LEFT )

   PORT_START /* IN1 */
//   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPF_PLAYER1 | IPT_JOYSTICKRIGHT_RIGHT | IPT_JOYSTICKRIGHT_UP )
   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPF_PLAYER1 | IPT_JOYSTICKRIGHT_UP )
//   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPF_PLAYER1 | IPT_JOYSTICKRIGHT_UP | IPT_JOYSTICKRIGHT_RIGHT )
//   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPF_PLAYER1 | IPT_JOYSTICKRIGHT_UP | IPT_JOYSTICKRIGHT_LEFT )
   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPF_PLAYER1 | IPT_JOYSTICKRIGHT_LEFT )
//   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPF_PLAYER1 | IPT_JOYSTICKRIGHT_LEFT | IPT_JOYSTICKRIGHT_UP )
//   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPF_PLAYER1 | IPT_JOYSTICKRIGHT_DOWN | IPT_JOYSTICKRIGHT_RIGHT )
   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPF_PLAYER1 | IPT_JOYSTICKRIGHT_RIGHT )
//   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPF_PLAYER1 | IPT_JOYSTICKRIGHT_RIGHT | IPT_JOYSTICKRIGHT_DOWN )
//   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPF_PLAYER1 | IPT_JOYSTICKRIGHT_LEFT | IPT_JOYSTICKRIGHT_DOWN )
   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPF_PLAYER1 | IPT_JOYSTICKRIGHT_DOWN )
//   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPF_PLAYER1 | IPT_JOYSTICKRIGHT_DOWN | IPT_JOYSTICKRIGHT_LEFT )
   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPF_PLAYER2 | IPT_BUTTON1 )
   PORT_BIT( 0x3C, IP_ACTIVE_HIGH, IPT_UNUSED )
   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_START1 )
   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_START2 )


In the end, because of the fact that you would often misfire with the above settings, I settled for this.  It was the original change I made to the code:

QUOTE
INPUT_PORTS_START( inferno )
   PORT_START   /* IN0 (muxed with IN3) */
   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPF_PLAYER1 | IPT_JOYSTICKLEFT_UP )
   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPF_PLAYER1 | IPT_JOYSTICKLEFT_LEFT )
   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPF_PLAYER1 | IPT_JOYSTICKLEFT_RIGHT )
   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPF_PLAYER1 | IPT_JOYSTICKLEFT_DOWN )
   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPF_PLAYER1 | IPT_JOYSTICKRIGHT_UP )
   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPF_PLAYER1 | IPT_JOYSTICKRIGHT_LEFT )
   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPF_PLAYER1 | IPT_JOYSTICKRIGHT_RIGHT )
   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPF_PLAYER1 | IPT_JOYSTICKRIGHT_DOWN )

   PORT_START /* IN1 */
   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPF_PLAYER1 | IPT_JOYSTICKRIGHT_UP )
   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPF_PLAYER1 | IPT_JOYSTICKRIGHT_LEFT )
   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPF_PLAYER1 | IPT_JOYSTICKRIGHT_RIGHT )
   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPF_PLAYER1 | IPT_JOYSTICKRIGHT_DOWN )

   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPF_PLAYER2 | IPT_BUTTON1 )
   PORT_BIT( 0x3C, IP_ACTIVE_HIGH, IPT_UNUSED )
   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_START1 )
   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_START2 )


The lines highlighted in blue above are the ones that replaced the single green line in the original code below:

QUOTE
PORT_START /* IN1 */
PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPF_PLAYER1 | IPT_BUTTON1 )
PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPF_PLAYER2 | IPT_BUTTON1 )
PORT_BIT( 0x3C, IP_ACTIVE_HIGH, IPT_UNUSED )
PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_START1 )
PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_START2 )


This code change makes it so that whenever you press UP, DOWN, LEFT, or RIGHT, it will not only face that direction, but it will fire that direction in a turbo fashion.  You used to have to hold down the A button on top of both analog joysticks which is very uncomfortable unless you're a freak with three hands.

It's funny, because Inferno is the first game I chose to remap and it is probably one of the more difficult roms to remap perfectly.  It works fine enough with this setting, but I wanted to make the game respond perfectly to the analog joysticks commands.  It's very close, but it's not perfect.  Those of you who kind of understand what the code above is saying now might realize that I was trying to fill in the diagonal directions while firing.  I'm not saying this isn't still possible to map perfectly, but I'm out of ideas myself at this point, so I retreated to the next best thing.  

I think this game is great, and I look forward to releasing a build that has it complete and working.  It totally works this way and will just take a little patience to play the joystick like you own it and this game will be very enjoyable for you.

From the Wardner example in Part II above though, you can see how easy it is to switch two of the X Y A B buttons around.  It will probably look different on the game that you'd like to remap, but the general principal should be the same and you should be able to figure it out for yourself.


My next task will be how to get MAME to look for a certain version of a rom.  There are a lot of US roms that I'd like to put in place of World roms, but the debug gives me errors that the required roms are missing.  When I get that figured out, I can control which versions of the roms will work with the emu.  It would be great if every single version of every game worked, but that would dramatically impact the size of the .xbe and in turn lower the amount of free ram.  That's why these roms won't work for me in this soruce, but would with a 128 PLUS! build.  They were removed to conserve ram.  (At least, that's all my theory at this point.  I don't have an expert around who will tell me yes or now).
Logged

ressurectionx

  • Archived User
  • Hero Member
  • *
  • Posts: 2778
Helpful Mame Compliling Hints
« Reply #7 on: March 26, 2008, 04:43:00 AM »

HOW TO MAKE MAME RECOGNIZE A CERTAIN VERSION OF A ROM:

QUOTE
My next task will be how to get MAME to look for a certain version of a rom.  There are a lot of US roms that I'd like to put in place of World roms, but the debug gives me errors that the required roms are missing.  When I get that figured out, I can control which versions of the roms will work with the emu.  It would be great if every single version of every game worked, but that would dramatically impact the size of the .xbe and in turn lower the amount of free ram.  That's why these roms won't work for me in this soruce, but would with a 128 PLUS! build.  They were removed to conserve ram.  (At least, that's all my theory at this point.  I don't have an expert around who will tell me yes or now).


I was wrong in my memory conserving theory above.  The drivers for the parent version of the game have all of the drivers for supported clones and they weren't removed.  Truth be told, I don't know why certain versions of roms weren't working.  I knew things were really messed up though when I tried loading Sinistar and it was telling me that I was missing roms that were from another game entirely (it slips my mind now which one).  I knew something was wrong then, so I deleted "Drivers.list" and "Roms.list" (and any other file in TDATA\4d414d46\SYSTEM) leaving only MAMEox.ini.  Then when I restarted MAME, it redumped information from the compile and all of the roms work without a problem now no matter which version.

Sometimes the problems don't make sense but the fixes are easy enough.
Logged

ressurectionx

  • Archived User
  • Hero Member
  • *
  • Posts: 2778
Helpful Mame Compliling Hints
« Reply #8 on: March 26, 2008, 05:06:00 AM »

CHANGING ROM NAMES IN THE GUI (CONFIRMED):

I was right in the post above on how to change the romname displayed in the GUI on the source level.  The romnames are always at the bottom of their accompinying drivers.  Here's what I did tonight to change Teenage Mutant Ninja Turtles - Turtles in Time (Both 2 and 4 players)

Changed:

QUOTE
AMEX(1991, tmnt2,    0,        tmnt2,    ssridr4p, gfx,      ROT0,  "Konami", "Teenage Mutant Ninja Turtles - Turtles in Time (US 4 Players ver. UAA)", GAME_UNEMULATED_PROTECTION )      // ver. UAA
GAMEX(1991, tmnt22p,  tmnt2,    tmnt2,    ssriders, gfx,      ROT0,  "Konami", "Teenage Mutant Ninja Turtles - Turtles in Time (US 2 Players ver. UDA)", GAME_UNEMULATED_PROTECTION )      // ver. UDA


To:  

QUOTE
GAMEX(1991, tmnt2,    0,        tmnt2,    ssridr4p, gfx,      ROT0,  "Konami", "Teenage Mutant Ninja Turtles - Turtles in Time (4 Players)", GAME_UNEMULATED_PROTECTION )      // ver. UAA
GAMEX(1991, tmnt22p,  tmnt2,    tmnt2,    ssriders, gfx,      ROT0,  "Konami", "Teenage Mutant Ninja Turtles - Turtles in Time (2 Players)", GAME_UNEMULATED_PROTECTION )      // ver. UDA


The final step to get the changes to show up in your GUI (THIS IS IMPORTANT), is to delete "Drivers.list" and "Roms.list" (and any other file in TDATA\4d414d46\SYSTEM) leaving only MAMEox.ini. Then when you restart MAME, it will redump information from the compile and all of the romname changes you've made will be displayed.

So now instead of reading:
"Teenage Mutant Ninja Turtles - Turtles in Time (US 2 Players ver. UDA)"
"Teenage Mutant Ninja Turtles - Turtles in Time (US 4 Players ver. UAA)"


They look like this in the GUI:
"Teenage Mutant Ninja Turtles - Turtles in Time (2 Players)"
"Teenage Mutant Ninja Turtles - Turtles in Time (4 Players)"

Much better, don't you think?



Now I've been told by BP that this is not how he did either of these changes in Arcades, though he won't tell me how he did.  He says this works perfectly well this way though, just that I will be out of sync with Arcades.  I'm not concerned about that, I'm just hoping that this way of doing the fixes (which I feel are the cleanest way of doing them) doesn't come back to bite me in the ass.  I don't think it will be a problem at all though, because I can't see any part of MAME calling on the game title, and I doubt that keymapping changes can screw anything up as far as options or playability goes.

Here's hoping happy.gif
Logged

ressurectionx

  • Archived User
  • Hero Member
  • *
  • Posts: 2778
Helpful Mame Compliling Hints
« Reply #9 on: March 27, 2008, 08:54:00 AM »

"It's just me against the world." ~ Tupac Shakur

"If I could just get a piece of lemon, it'd be great" ~ Rip Torn
Logged

ressurectionx

  • Archived User
  • Hero Member
  • *
  • Posts: 2778
Helpful Mame Compliling Hints
« Reply #10 on: March 29, 2008, 11:00:00 AM »

REMOVING USELESS CODE (PART I):

I wanted to try something new.... at least I think it's new, because in the source I have it still hasn't been done.  As I learn a bit more about how this code works every time I'm looking at it, I had the idea to try something.  I thought I might be able to trim the fat.  It takes anywhere from 10 to 13 minutes to make a new build of MAME every time and this might make it take just a little less when it's done.  Plus the code will be a lot cleaner.  Let me show you an example of what I've tested and found doesn't effect the working parent at all and can potentially cut out a ton of code that is useless.

In this example, we will use Championship Sprint:

QUOTE
Found in Atarisy2.c

GAME( 1986, csprint,  0,        sprint,   csprint,  csprint,  ROT0,   "Atari Games", "Championship Sprint (rev 3)" )
GAME( 1986, csprint2, csprint,  sprint,   csprint,  csprint,  ROT0,   "Atari Games", "Championship Sprint (rev 2)" )
GAME( 1986, csprint1, csprint,  sprint,   csprint,  csprint,  ROT0,   "Atari Games", "Championship Sprint (rev 1)" )
GAME( 1986, csprintg, csprint,  sprint,   csprint,  csprint,  ROT0,   "Atari Games", "Championship Sprint (German, rev 2)" )
GAME( 1986, cspring1, csprint,  sprint,   csprint,  csprint,  ROT0,   "Atari Games", "Championship Sprint (German, rev 1)" )
GAME( 1986, csprintf, csprint,  sprint,   csprint,  csprint,  ROT0,   "Atari Games", "Championship Sprint (French)" )
GAME( 1986, csprints, csprint,  sprint,   csprint,  csprint,  ROT0,   "Atari Games", "Championship Sprint (Spanish, rev 2)" )
GAME( 1986, csprins1, csprint,  sprint,   csprint,  csprint,  ROT0,   "Atari Games", "Championship Sprint (Spanish, rev 1)" )


First, I would cut (rev 3) from the name of it to make it look good in the GUI.  But more importantly, except for the highlighted line, the rest of this code is completely unnesessary.  Cut it.....

But that isn't all you have to do.  This act alone will give you compile errors.  

Now we get rid of every other instance of the clones in the code.   First I did a search on csprint2

QUOTE
Also found in driver Atarisy2.c (This is where it tells MAME which roms to load up for the game):

ROM_START( csprint2 )
   ROM_REGION( 0x90000, REGION_CPU1, 0 )   /* 9*64k for T11 code */
   ROM_LOAD16_BYTE( "2126-7l.045",  0x008000, 0x004000, CRC(0ff83de8) SHA1(23f90b8f3ebd3d3bbd7a68aaecae5f45f1b477c0) )
   ROM_LOAD16_BYTE( "1127-7n.045",  0x008001, 0x004000, CRC(e3e37258) SHA1(64f48c1acbb02cc8f6b76232d142382007485fb2) )
   ROM_LOAD16_BYTE( "1125-6f.045",  0x010000, 0x008000, CRC(650623d2) SHA1(036cb441aba64d08f3b50f72cb22fed3b4766341) )
   ROM_LOAD16_BYTE( "1122-6n.045",  0x010001, 0x008000, CRC(ca1b1cbf) SHA1(98674b75a1d38db32ceb24d57f6dba836bdc8566) )
   ROM_LOAD16_BYTE( "1124-6k.045",  0x050000, 0x008000, CRC(47efca1f) SHA1(ab2fb8479c8606d8f180657734d8d320815c5408) )
   ROM_LOAD16_BYTE( "1121-6r.045",  0x050001, 0x008000, CRC(6ca404bb) SHA1(27ceda243410edcff0dc0aa08fb6466d0c6c80c7) )
   ROM_LOAD16_BYTE( "1123-6l.045",  0x070000, 0x008000, CRC(0a4d216a) SHA1(53a4af7673c9dae1f6f2f13dce3c38a31ee12ee2) )
   ROM_LOAD16_BYTE( "1120-6s.045",  0x070001, 0x008000, CRC(103f3fde) SHA1(9a0e82c3294369858b7a6c978143d8145a8df5a2) )

   ROM_REGION( 0x10000, REGION_CPU2, 0 )   /* 64k for 6502 code */
   ROM_LOAD( "1118-2bc.045", 0x008000, 0x004000, CRC(eba41b2f) SHA1(a0d6e9f4609f2587b0fad6845e75653c10bf4249) )
   ROM_LOAD( "1119-2d.045",  0x00c000, 0x004000, CRC(9e49043a) SHA1(ec467fe1cd59c51e43c3acd83d300f5b3309a47a) )

   ROM_REGION( 0x80000, REGION_GFX1, ROMREGION_DISPOSE )
   ROM_LOAD( "1105-6a.045",  0x000000, 0x008000, CRC(3773bfbb) SHA1(beca29d8b9296d723304aab391dd9589a830a150) )
   ROM_LOAD( "1106-6b.045",  0x008000, 0x008000, CRC(13a24886) SHA1(a1ac9ca04a60fdb38c6d81e451e5638bdb537c8f) )
   ROM_LOAD( "1101-7a.045",  0x030000, 0x008000, CRC(5a55f931) SHA1(b2f8e8f3488a9d3840ca9a15fa53896ae4013e0a) )
   ROM_CONTINUE(             0x010000, 0x008000 )
   ROM_LOAD( "1102-7b.045",  0x018000, 0x008000, CRC(37548a60) SHA1(f3395df534cdc75d4e1b2b415ee2cd6683e49204) )
   ROM_LOAD( "1107-6c.045",  0x040000, 0x008000, CRC(e35e354e) SHA1(fa07737eb2ca19bf96ce15d8bbae7513c7dddd3c) )
   ROM_LOAD( "1108-6de.045", 0x048000, 0x008000, CRC(361db8b7) SHA1(fb85e63c6e9122ab3d62eb7d0f5f715d8936910b) )
   ROM_LOAD( "1104-7de.045", 0x070000, 0x008000, CRC(d1f8fe7b) SHA1(2612a397fdebe6062f66d26060c36af4a9ca28dc) )
   ROM_CONTINUE(             0x050000, 0x008000 )
   ROM_LOAD( "1103-7c.045",  0x058000, 0x008000, CRC(8f8c9692) SHA1(57418c5dd3554055e5bce8c2a15f6f6fc3201d99) )

   ROM_REGION( 0x40000, REGION_GFX2, ROMREGION_DISPOSE | ROMREGION_INVERT )
   ROM_LOAD( "1112-6l.045",  0x000000, 0x008000, CRC(f869b0fc) SHA1(d8bf0df492bbe5d228748be0976d8f68254ffb3f) )
   ROM_LOAD( "1111-6k.045",  0x008000, 0x008000, CRC(abcbc114) SHA1(5d11fdfd7ed968949d884f1245571aed052abe46) )
   ROM_LOAD( "1110-6hj.045", 0x010000, 0x008000, CRC(9e91e734) SHA1(d9424a46dec2885fdc1ebe973f7deebfcb6ff19e) )
   ROM_LOAD( "1109-6fh.045", 0x018000, 0x008000, CRC(3a051f36) SHA1(1f74d53e1950447fd79a552d934038c4661124cf) )
   ROM_LOAD( "1116-6rs.045", 0x020000, 0x008000, CRC(b15c1b90) SHA1(a3d517919fe267f30383cff4142dd0d6e1102492) )
   ROM_LOAD( "1115-6pr.045", 0x028000, 0x008000, CRC(1dcdd5aa) SHA1(99eb230597132f04aa7d4d66907a14596f780365) )
   ROM_LOAD( "1114-6n.045",  0x030000, 0x008000, CRC(fb5677d9) SHA1(fa3190af7eaf0ef738fd86a8280c1c0b0556415f) )
   ROM_LOAD( "1113-6m.045",  0x038000, 0x008000, CRC(35e70a8d) SHA1(953bb609143f2660e5e5ca980691b962c1e7a81e) )

   ROM_REGION( 0x4000, REGION_GFX3, ROMREGION_DISPOSE )
   ROM_LOAD( "1117-6t.045",  0x000000, 0x004000, CRC(82da786d) SHA1(929cc4ebac3d4404e1a8b22b80aae975e0c9da85) )
ROM_END


Delete it all.

Lastly, we would need to delete the original driver call for the game in "driver.h"  Searching the entire project for csprint2 till you find it will work.  It will be the only instance of it left in the project.  It looks like this:

QUOTE
Found in Driver.h:

   DRIVER( csprint2 )   /* 136045         © 1986 */


You can also remove all of that code for csprint1, csprintg, cspring1, csprintf, csprints and csprins1 as well by searching for them and deleting all of the code.  (just make sure you don't delete anything for Working parent csprint).

That may not be a HUGE dent in the overall MAME code, but as you can see, there is potential for trimming quite a bit of the code right from MAME.  This serves two purposes.  

1) Code is a lot cleaner (probably doesn't matter to most other people)
2) If code is smaller, build would have to be smaller and perhaps there would be just a tad more room for memory to get a few more games working.  No one will know the answer to that until it is done (unless they already know the answer and that's why it's never been tried before).  I think this would have to help with size of the emulator though because there are over 5000 games with all of the clones.  You can cut about 3500 of them right out of the code this way.  

Incidentally, after only removing extra useless code for Championship Sprint in Atarisy2.c, the size of the file shrunk to 164kb from 189kb.  I could still remove all the extra code for Paperboy, 720 Degrees, Super Sprint, and APB.  So after doing that, we had a final size of Atarisy2.c was 66.7 kb, wiping out a whopping 122.3kb of useless code.

I don't imagine the ratio will be nearly that great across the board (65% reduction in size), but if we hypothetically said that it was, we would be able to eliminate 18.7 MB of code from the drivers section!!!

It probably won't be that much, but it could be huge.  Maybe the emu only uses code that is currently being used in memory too, so the effect might be nil, but it's a cool concept anyways.  Worst case scenario, it's got many MB less to compile every time I build and it should be much quicker when I get done with that.
Logged

ressurectionx

  • Archived User
  • Hero Member
  • *
  • Posts: 2778
Helpful Mame Compliling Hints
« Reply #11 on: March 31, 2008, 07:29:00 PM »

TONING DOWN A TOUCHY ANALOG STICK OR L&R BUTTON (PART I):

It looks like code is written several ways for analog stick control.  This tut is for use with 720 Degrees from the atarisy2.c driver.  I wanted to ditch the stick altogether, but I think many times it's used by default there is no way to change it.  I was able to for Inferno above because the original code was written in a way that I could change it, but this one has only a single line of controller code.  (There may be a way to change it and make it work, but with 12 minute build time between tinkering, trial and error just isn't much fun.  What I did do though was make the analog stick less responsive and it seems to play much better now.

The original line of code was:

QUOTE
   PORT_START   /* LETA0/1 */
   PORT_ANALOG( 0xffff, 0x0000, IPT_DIAL | IPF_PLAYER1, 30, 10, 0, 0 )


Change it to:


QUOTE
   PORT_START   /* LETA0/1 */
   PORT_ANALOG( 0xffff, 0x0000, IPT_DIAL | IPF_PLAYER1, 18, 6, 0, 0 )


Now this game is much more enjoyable.   You can alter and tweak it even further to your liking.  I don't know exactly what the "30" and "10" represent, but when I changed them to "200" and "50" my guy spun around like he was on crack.  You probably don't want to drop too far below the numbers I've used though because then it starts becoming less responsive than you'd like.

I will post other analog fixes as I figure them out.
Logged

ekszbox

  • Archived User
  • Full Member
  • *
  • Posts: 100
Helpful Mame Compliling Hints
« Reply #12 on: April 02, 2008, 09:18:00 AM »

Changing Save Game ID/Location

Project -> Properties -> Xbox Image -> Certificate - > Title ID -> 0x12345678

Or

Project -> Properties -> Xbox Image -> Command Line - > Additional Options -> /testid:0x12345678

This changes the save folders to: TDATA\12345678 & UDATA\12345678

I've changed the ID in my build to: 4D414D48 as MAMEoX128 Plus! uses 4D414D47 and arcades/MAMEdOX use 4D414D47.
This stops the other versions of mame clashing with this one.
Logged

ekszbox

  • Archived User
  • Full Member
  • *
  • Posts: 100
Helpful Mame Compliling Hints
« Reply #13 on: April 02, 2008, 05:50:00 PM »

Don't get your hopes up regarding optimizing for size, as mame runs the fastest with these settings:
Optimization: Maximize Speed (/O2)
Favor Size or Speed: Favor Fast Code (/Ot) [This one doesn't make much difference]
Actual difference between the two is 20fps or more.
Logged