xboxscene.org forums

OG Xbox Forums => Software Forums => Development => Topic started by: ressurectionx on March 16, 2008, 06:08:00 PM

Title: Questions & Discussion Of Mame Compile Notes & Tutorials
Post by: ressurectionx on March 16, 2008, 06:08:00 PM
Questions & Discussion of MAME Compile Notes & Tutorials

Here is the place for any discussion for any notes or tutorials posted on the Helpful MAME Compliling Hints thread.  You can find that thread here:  

HELPFUL MAME COMPILING HINTS:  http://forums.xbox-scene.com/index.php?showtopic=644759

(Please keep questions and comments in this thread and do not clutter up the hints thread with questions.)   (IMG:style_emoticons/default/cool.gif)

This thread can also be used to discuss or ask any questions about compiling on MAME that aren't brought up in any notes or tutorials.  Even questions about compiling in general are welcome.  They may not directly relate to MAME, but it might help answer more questions about compiling basics that can help with MAME porting.

I'm not an expert... I'm just a complete novice, but I'm figuring new things out every time I sit down with it.  There are others out there that know a lot more than I do and perhaps they will have something to add.  Maybe we can help answer each other's questions.

I encourage us all with an interest in porting MAME to work together and teach each other how to do this.

This post has been edited by ressurectionx: Mar 17 2008, 01:12 AM
Title: Questions & Discussion Of Mame Compile Notes & Tutorials
Post by: ressurectionx on March 17, 2008, 11:04:00 AM
Anybody know anything about editing options in MAME?  

The source I have has the "Sort by Category" function removed.  It's impossible to see if my catver.ini file is working properly since I can't display category on any of the games.
Title: Questions & Discussion Of Mame Compile Notes & Tutorials
Post by: ressurectionx on March 17, 2008, 11:19:00 AM
QUOTE
//---------------------------------------------------------------------
//   DrawROMListPage
//---------------------------------------------------------------------
void COptionsScreen::DrawROMListPage( void )
{
  static WCHAR *sortMode[] = {  L"By name",
                                L"By ROM status",
                                L"By manufacturer",
                                L"By year",
                                L"By parent ROM",
                                L"By number of players",
                                L"By favorite status",
                                L"By number of times played",
                                L"By genre" };

  static WCHAR *displayMode[] = { L"Verbose list",
                                  L"Simple list",
                                  L"Detailed single item" };


I need to find out where this was changed in the source.  It must be somwhere in MAME or MAMEox instead of MAMEoXLauncher, which makes sense to me now because I got the MAMEoXLauncher files from MAMEdOX_1.1_080305_src .   Big brainfart there.  I'll probably find it first, but if anybody knows where this might have been changed, I'd appreciate the input.
Title: Questions & Discussion Of Mame Compile Notes & Tutorials
Post by: ressurectionx on March 25, 2008, 02:51:00 PM
QUOTE
'default.xbe': Loaded 'c:\builds\mamedox ver3 source\mameox\release\MAMEoXLauncher.exe', Symbols loaded.
'default.xbe': Loaded 'xboxkrnl.exe', No symbols loaded.
'default.xbe': Loaded 'xbdm.dll', No symbols loaded.
'default.xbe': Loaded 'vx.dxt', No symbols loaded.
'default.xbe': Loaded 'X_RTEnvS.dll', Symbol information corrupt.
'default.xbe': Loaded 'X_cgbe.dll', Symbol information corrupt.
'default.xbe': Loaded 'X_cgrfin.dll', Symbol information corrupt.
'default.xbe': Loaded 'vt_cgrf.dxt', Symbol information corrupt.
'default.xbe': Loaded 'vtunetbs.dxt', No symbols loaded.
'default.xbe': Loaded 'XB_CM_.dxt', No symbols loaded.


If anyone can confirm this or similar output on debug start, or if it's supposed to be fixed and you might know how, that would be great.
Title: Questions & Discussion Of Mame Compile Notes & Tutorials
Post by: ressurectionx on March 25, 2008, 05:08:00 PM
QUOTE
------ Build started: Project: SharedResources, Configuration: Release Xbox ------
Project up-to-date
------ Build started: Project: libsmb, Configuration: Release Xbox ------
Project up-to-date
------ Build started: Project: MAME, Configuration: Release Xbox ------
Compiling...
williams.c
wardner.c
Creating library...

Build log was saved at "file://c:\Builds\MAMEdOX ver3 Source\Mame\release_obj\BuildLog.htm"
MAME - 0 error(s), 0 warning(s)
------ Build started: Project: MAMEoXLauncher, Configuration: Release Xbox ------
Project up-to-date
------ Build started: Project: MAMEoX, Configuration: Release Xbox ------
Linking...
Generating code


In that example, I had just altered code in both williams.c and wardner.c and wanted to test them out.  It just kind of hangs there for about 10 minutes while it's working.  Does it take that long for anyone else using Mame?  With Debugging on, shouldn't I be able to see the changes without having to rebuild and wait again?  I thought that was the point.
Title: Questions & Discussion Of Mame Compile Notes & Tutorials
Post by: ressurectionx on March 27, 2008, 08:46:00 PM
QUOTE
From ekszbox:   The sound chip frequency for cps1.c driver is not right in arcades, it has been corrected in newer versions of mame:


Great to know.  Thanks man.  I'll mess around with making that change on Sunday when I get off work.

QUOTE
By the way you might want to tag your changes i.e. // Rx
That way you can easily track them down with a search later on.


That is an awesome suggestion.   Right now, I've been using a word document to document all of my changes in detail.  (As I keep working though, the detail probably won't be nearly as extensive.  It's pretty much what I've been posting in the other thread).  I might not abandon that documentation, but having the ability to do a Find for the changes I've made in the source is really cool.



Other than that, I've got two things on my plate now.  The first is properly mapping Pyros/Wardner.  I did a successful switch already to make A jump and X fire (like how Teenage Mutant Ninja Turtles I is).  I'd like to make that the standard for all games as it's by far the most comfortable in my mind.  Plus on games like Robocop II, A will be jump and then X can shoot left while B shoots right, so even in abnormal cases like RCII, the standard will not change.  

The problem with Pyros came when I tested two players.  The way that it's set up now, the player one controller controls both players so you have to keep giving the controller to the other person when you die.  (I have not tried this in the last official build of Arcades, so I don't know if the official build had this problem).  Trying to change this, I've only been successful in two different outcomes:

1)  I get a romcheck failure right where the title screen would show up.
2)  I get it mapped so the first and second player controllers control both the first and second player. Making the unsuspecting player walk right into a lava pit would be funny the first time, but I'd imagine that it would get old pretty quick.  

I don't have the code for it in front of me now at work, but I can say that it's set up kind of weird compared to other games I've looked at.  On The Simpsons, there is a seperate section for each of the 4 players controls.  (I really like the way Simpsons is mapped and remapping all games would be a breeze if they followed that logic)  On Pyros though, it looks like the mapping only gets one section and it's called for twice by whichever player is currently active.  This doesn't seem to be working right though.  I think when I get back to it on Sunday, I will take a look at the controller mapping for Rolling Thunder and see if it's similar since it's a 2 player alternating game as well (Maybe Rolling Thunder has the same problem in 2 player mode).  Maybe all the alternating games are written that way, instead of having 4 separate instances like The Simpsons which is 2 or 4 players simultaneous.


The second and much more important thing I'm trying to get a handle on, and I assume you already know the answer to at this point, shouldn't I be able to quickly test out any small changes in code with the debug feature without having to rebuild the entire project?  I kinda thought that was the point.  Right now every time it seems I need to recompile the build and it takes about 13 minutes for the entire process before I can test the small changes I made.  

All I've been able to do with Debug pretty much is attach the debug to the .xbe or reset the .xbe from my computer and have debug running along side it when it restarts.  As soon as I start a game or try to compile I loose the debug on my PC and have to reattach when I've exited the game or the compile is done.  So bottom line is, I really don't have a clue what debug does.  All of my work so far has been just making changes in the driver.c files and then compiling them and sending the entire build over to the XBox.

I'd love it if I was able to test changes I've made several seconds after I've made them instead of only being able to make changes on average of 4 times per hour.  I think everything is set up right now.  There may just be a function that I'm not aware of that will get the job done for me.

Thanks in advance if ya know the answer to that one ekszbox.
~Rx
Title: Questions & Discussion Of Mame Compile Notes & Tutorials
Post by: ressurectionx on March 28, 2008, 07:59:00 PM
QUOTE
The purpose of debugging is the fact that you can insert breakpoints in your sources. When the code reaches a breakpoint, it will stop it's execution. At that moment, you can examine the contents of variables in the code and alter them. You can resume the execution afterwards.


This is interesting.  At this point, I don't know enough about what I'm doing to realize just how valuable this feature may or may not be to me for my purposes.  I'm assuming you've coded before since you seem to know quite a bit about it.  Any great benefits you can think of off the fly that might sway me to research this feature more extensively and add those skills to my aresenal?  

QUOTE
There is no way of changing some of the sources and seeing the result in the code execution immediatly. The altered sources need to be recompiled.  Mame is a pretty huge emulator (as it emulates a lot of platforms), so it's normal it takes a while to compile.


Damn.... lol.  That would have been perfect.  It seriously takes 12 to 15 minutes every time I make a change and want to test it out.  Maybe it's time to upgrade to a new computer.  Mine is relatively fast, but it's not even a dual core processor.  In the mean time, I'll just have to make sure that when I'm working on a difficult little bugger like Pyros, I will make quick and easy changes to 10 or 20 other games at the same time so that 12-15 minutes downtime isn't completely wasted if the code change I put in didn't fix the problem.

Oh well.  At least I know now that I can't do it the way that I thought it was supposed to work.  I won't be wasting any time trying to figure out how to do that now.

Thanks again for your time obcd,
~Rx
Title: Questions & Discussion Of Mame Compile Notes & Tutorials
Post by: ressurectionx on March 29, 2008, 11:03:00 AM
Thanks for the code fixes in the other thread ekszbox.  They rock.  I love being able to pause just by pressing the right joystick down.

I didn't understand what you sent me really when I first looked at it, but when I sat down with the emu and just did searches on the first lines of each of the code changes, I knew exactly what to do.  

Thanks again,
~Rx
Title: Questions & Discussion Of Mame Compile Notes & Tutorials
Post by: ressurectionx on March 29, 2008, 07:57:00 PM
QUOTE
As you are mentioning size, I remembered I made a change to the project when I got it, which took the size of 'MAMEoX.xbe' from 39.2MB down to 34.3MB.

Project -> C/C++ -> Optimization -> Optimization -> Minimize Size (/O1)
Project -> C/C++ -> Optimization -> Favor Size or Speed -> Favor Small Code (/Os)

I have not had time to test the speed difference myself, but apparently the speed can be as just as good by optimizing for smaller size instead of for speed; here is a quote from an expert:

"Yes. /O1 is the better all around choice, because most code isn't
time-critical, and minimizing size helps reduce cache misses and page
faults. In many cases, /O2 doesn't produce code which is significantly
faster than /O1, and ironically, smaller code can actually be faster
due to the memory effects just mentioned."

KM


Hey ekszbox,

Saw this post in the other thread and it sounds interesting (and also makes me think that there may be more benefits to come out of removing unnecessary code from the build other than faster rebuilds).  Now when you say:

Project -> C/C++ -> Optimization -> Optimization -> Minimize Size (/O1)
Project -> C/C++ -> Optimization -> Favor Size or Speed -> Favor Small Code (/Os)


What is this?  Is this a setting I can choose in .NET to automatically optomize some of the code?  Right now, the MAME .xbe I got from the Arcades source comes out to be over 40MB, so to immediately knock it down to 35MB would be great.

Is this something I should have done before I started removing clone code or does that not matter?
Title: Questions & Discussion Of Mame Compile Notes & Tutorials
Post by: ressurectionx on March 30, 2008, 10:42:00 AM
Thanks for the tips ekszbox,

I got a lot of work ahead of me before I get to that, so I'll ask you when I'm done if I can't figure that part out myeslf.  It will probalby cut less code out when I've already removed so much but any little improvement is worth it.  I'll have to verify that I'm in debug mode now.  I believe I am, but I'm still a dumb n00b so I might not know anything yet and be making it harder on myself.  Don't be afraid to pass on knowledge to me if you think of anyting else.  I'll talk to you when I'm on.  I think I'm going to pass out for a while.

Later,
~Rx
Title: Questions & Discussion Of Mame Compile Notes & Tutorials
Post by: ekszbox on March 30, 2008, 05:30:00 PM
Not sure if you noticed the following warning message:

Mame\src\fileio.c(1237): warning C4013: 'vsnprintf' undefined; assuming extern returning int

This can be fixed by adding a line (the one starting with extern) into the fileio.c file, I put it here:

/***************************************************************************
   PROTOTYPES
***************************************************************************/

/* External */
extern int vsnprintf( char *buf, size_t count, const char *fmt, va_list lst );
/* Internal */
static mame_file *generic_fopen(int pathtype, const char *gamename, const char *filename, const char* hash, UINT32 flags);
static const char *get_extension_for_filetype(int filetype);
static int checksum_file(int pathtype, int pathindex, const char *file, UINT8 **p, UINT64 *size, char* hash);


It's just a warning, the program works without this change, but it looks so much better when they are taken care of.


KM

Title: Questions & Discussion Of Mame Compile Notes & Tutorials
Post by: ressurectionx on March 30, 2008, 09:03:00 PM
I didn't notice that message before, but that's only because there were tons of warnings with the first build.  Now I don't get them because it doesn't rebuild sections that I haven't changed.  If it bothers me in the future, I'll use your notes.  Thanks.

And I'd love to do anything to increase build time.  If the precompiled headers works for you, let me know what you did.  

I feel for you if you have a 30 minute build time.  That's rough.  Hopefully when I make these edits it will be a lot faster for you without having to remove code for the good games.  I'll give you what I've got when I take care of it.


It was mentioned that also making the VMM code leaner would be beneficial.  You wouldn't know anything about that, would you?

Later
Title: Questions & Discussion Of Mame Compile Notes & Tutorials
Post by: ressurectionx on March 30, 2008, 10:18:00 PM
Hey ekszbox,

I figured a few things out, but haven't been able to fix the problem with control yet.

1)  The reason that only one controller plays all in game action on alternating classics is because they only had one controller and you moved out of the way when you died to let your friend play.  2nd player Coin and Start work on the second joystick because there was a separate button for 2 player start.

2)  Cocktail tables had two controllers, so the way the code is written you can go into the UI settings and change to cocktail mode and the 2nd player controller will work like it's supposed to.

3) Cocktail tables also flip the screen action so the other player can see, so even though the control works like it should now, everything is upside down.

This is what I'd like to do now.

1) Inhibit the screen from flipping whenever cocktail mode is set.  

2)  Make cocktail mode default for games that used it.  (I'd rather change one setting than have to make changes in every game driver).

Think this can be done?  Any ideas?
Title: Questions & Discussion Of Mame Compile Notes & Tutorials
Post by: ressurectionx on March 31, 2008, 06:34:00 PM
QUOTE(ekszbox @ Mar 31 2008, 05:41 PM) View Post

file: xbox_Direct3DRenderer.cpp
search for: g_createParams.orientation & ORIENTATION_SWAP_XY
Not sure what you mean.

KM


Thanks ekszbox,

I'm looking in the xbox_Direct3DRenderer.cpp and I see what you're talking about.  That's a lot of code that's over my head though.  Do you have any idea what I would have to alter to get it to never flip the screen in cocktail mode?

What I meant was, any of the old games like Pac-Man, Pyros, 1942, etc. that alternate players only use two joysticks if you have it on cocktail mode.  I want these games to autostart in cocktail mode so they play right without having to go into the UI settings to change it.

~Rx
Title: Questions & Discussion Of Mame Compile Notes & Tutorials
Post by: ressurectionx on March 31, 2008, 08:02:00 PM
I've tried commenting out some code with the "g_createParams.orientation & ORIENTATION_SWAP_XY" but this has just resulted in making a black screen while I play games.  I'm wondering exactly where the code is to tell it to flip the screen for the 2nd player if you're using cocktail mode.  

That call might not even be in xbox_Direct3DRenderer.cpp (My guess is that it isn't)

Probably best if I don't remove the code that tells MAME how to flip, but if I instead removed whatever code calls xbox_Direct3DRenderer.cpp to do the flip.

OR

If I knew exactly what part did the flip, maybe I could alter it so that even though it believes that it is flipping the screen, the code is rewritten to draw it to the screen right side up when the flip event takes place.

Still working on it,
~Rx
Title: Questions & Discussion Of Mame Compile Notes & Tutorials
Post by: ressurectionx on March 31, 2008, 10:24:00 PM
Man.... I think I really hosed something up messing with that code.  I still can't get any graphics to show up.  

I replaced the edited file with the original from the backup source, rebuilt and dumped a new version of MAME and it's still a black screen.  

Title: Questions & Discussion Of Mame Compile Notes & Tutorials
Post by: ressurectionx on March 31, 2008, 11:28:00 PM
Fixed it... had to clean and rebuild the entire solution.  Whoops..... unsure.gif

Think I won't be messing around with those again for a while unless somebody knows exactly how to make this fix.
Title: Questions & Discussion Of Mame Compile Notes & Tutorials
Post by: ressurectionx on April 01, 2008, 12:31:00 PM
The game didn't actually crap out.  None of them showed anything on the screen, but there were noises, like you could hear when I inserted a coin.  Whatever I removed, it was critical to the Direct Draw.   Not sure what it was....

Maybe I'll see what happens if I just comment out the code you tried.

Any idea how to make two player alternating games startup automatically in cocktail mode?




Some good news on my front.... I fixed some games, one of them was in particular a real bitch.  I'll post the fixes in the other thread when I get a chance, but the games are:

Analog tweak, fixes (These games play 1000 times better when set at the right levels:
720
Arcade Classics - You're not going to believe the difference in code here. This one didn't work right at all before I got to it.  I can't believe I ever figured this one out.
Ataxx
Bad Lands
Championship Sprint
Inferno
Super Sprint

Still working on "Hydra" but I don't really have a clue what to do with that one.

And I also changed a bunch of games to jump with the A button and attack with the X.  That's going to be my standard for all games.  There was also another game that was 3 players and the 2nd and 3rd coin insert buttons were mixed up so I fixed that too.  Can't remember which one that was now though.

Other fixes were making the names look nice in the GUI on a source level and deleting clone code.

Have only gone up through about half the letter B in the driver.c files.   This is going to take forever.

Later,
~Rx
Title: Questions & Discussion Of Mame Compile Notes & Tutorials
Post by: ekszbox on April 02, 2008, 12:08:00 PM
Actually cleaner would be if you tackle the root i.e. trace these variables: flip_screen_x flip_screen_y in the src file i mentioned, and see where they lead.
Title: Questions & Discussion Of Mame Compile Notes & Tutorials
Post by: ressurectionx on April 02, 2008, 11:13:00 PM
Thanks for the tips in the other thread ekszbox.  I really like the one about the folders, because when I was testing my build and I had Arcades and MAMEdox on there, it was really hosing everything up.  Eventually I was running my build with the MAMEdox 1.1. GUI instead of Arcades.  I don't have any clue how that happened, but it was pissing me off and I'm sure it had something to do with the save data.  This should avoid any problems in the future and also allow somebody to have this emu and Arcades/CoinOPS on their box at the same time without conflicts when the build is complete.

Two things....

1)  Sorry.  I think I confused you with all my talking about the cocktail.  I don't want any games to be flipped, ever.  This build is not in mind for anybody who is going to use a cocktail table.  Since we're using a TV screen/upright arcade there should be no screen flipping period.  

What I wanted to happen by default though is that all games start in Cocktail mode instead of Upright under the UI options for Cabinet.  After screen flipping is completely disabled, with most of the 2 player alternating games the control would still go from the first player controler to the second player controller when you died, but the screen would stay right side up.  

Unfortunately, this fix won't work on all games though.  I've tried Cocktail mode on Black Tiger and the screen didn't flip and the controller didn't switch.  It will work on a lot of the older games like Pacman and Galaga however.  It might be possible to get it to work on Black Tiger if I put the code IPF_COCKTAIL in the input code.  I don't know, I just thought of it now.

This will not negatively impact games which do not require cocktail to flip control to the second input, such as TMNT, The Simpsons, Street Fighter II, etc.  They will work the same in cocktail or upright mode (at least the ones that I've tested so far.

So to wrap up, what I'm looking to do:
a) Permanantly disable screen flipping.
B) Autostart all games in Cocktail mode instead of Upright.



2)  So far I've eliminated 2MB of code from the drivers section and I've gotten through the letter C.  This may not do much to make performance better in games, but do you think there's a chance that with all the free memory that there might be more games to make playable that were running out of memory before?  Some games that are 80MB are out of the question already, but there might be quite a few who were just on the verge of running but just ran shy of available memory.

I have already noticed a small decrease in time between builds as well.



~Rx
Title: Questions & Discussion Of Mame Compile Notes & Tutorials
Post by: ressurectionx on April 03, 2008, 07:32:00 AM
I made a mistake.  Cocktail mode does work for Black Tiger.  And the IPF_COCKTAIL was already included in the imports.  I forgot you have to restart the rom.  I'm assuming that's why it works now with no effort on my part.

Once we figure out how to disable flipping and autostart games in cocktail mode, we will be able to use two controllers for all the 2 player alternating games.
Title: Questions & Discussion Of Mame Compile Notes & Tutorials
Post by: ressurectionx on April 07, 2008, 08:11:00 AM
Hey ekszbox,

It took me about 3 or 4 hours of playing around with it, and I managed to disable screenflipping.  Thanks for the tips.... that sure wasn't easy, but I figured out a bit about C++ structure, so future tinkering will be that much easier.

Awesome....  now the 2 player alternating games work perfect once you manually switch them to cocktail mode.  

Did you have any ideas about making cocktail mode default?  



BTW... I have gotten through the letter L in re-coding.  I've changed my mind about a few things though, so I will have to do some backtracking, particularly through the letters A to C.  I think I'm going to leave the US rom, and also the parent rom if it isn't the US rom.  This will give the end result a little leeway if people would rather play the parent than the US rom.  (Plus editing out the parent is a real pain anyways.)

So far my build is 4MB smaller than it was with no impact on the good roms.

Talk to you later,
~Rx

EDIT:  Too early to celebrate.  This change has left some roms with a black screen... Only Blades of Steel so far, but I'm willing to bet that more are effected if I tried them out.   Hmmmm... Wonder what caused that.
Title: Questions & Discussion Of Mame Compile Notes & Tutorials
Post by: ressurectionx on April 07, 2008, 10:47:00 PM
Alright... I got the blank screen thing fixed now.... no worries.

It's the weirdest thing. Here I was celebrating that the flip screen thing works, but it doesn't really.  Here's where we're at:

Black Tiger plays 2 player alternating perfect.  (No screen flip)

2/3/4 player simultaneous games seem to work fine with cocktail mode on, but more testing will need to be done.

Berzerk and Pyros still flip the screen upside down as if I haven't changed any code.

1942 is the wierdest.  Screen itself doesn't flip over, just the action.  You still take off from the aircraft carrier and the carrier goes from the top of the screen to the bottom, but your plane is at the top of the screen and the enemies come from the bottom of the screen (as if the action did flip over for cocktail mode).  Kinda weird watching your plane fly backwards and shoot towards the bottom of the screen.

So, I think I just got lucky and the first game I chose worked perfect with the settings I have now.  I've messed around with it here and there and haven't managed to do anything else but make games get black screens.  

Would you like a copy of what I have now to see for yourself where it is?  Nothing too exciting at this point, but there is about a 4MB reduction in code so far (My builds take about 5 minutes now from when it starts generating code, down from about 7 or 8 minutes).

Let me know,
~Rx
Title: Questions & Discussion Of Mame Compile Notes & Tutorials
Post by: ressurectionx on April 08, 2008, 11:40:00 AM
QUOTE

file: vidhrdw\generic.c
functions: void flip_screen_x_set(int on), void flip_screen_y_set(int on)

I commented out these, which caused flipping to no longer work on cps1 games, if set in ingame options menu:

if (flip_screen_x != on)
{
set_vh_global_attribute(&flip_screen_x,on);
updateflip();
}

if (flip_screen_y != on)
{
set_vh_global_attribute(&flip_screen_y,on);
updateflip();
}


So... I'm going to try to figure out what I did to screw up the screen stretching on games like Contra, but I was wondering if you have any ideas how to disable flipping on games such as Berzerk and Pyros.  Looks like just editing out that code above fixed a bunch of them, but there is something missing still.

Later,
~Rx
Title: Questions & Discussion Of Mame Compile Notes & Tutorials
Post by: ekszbox on April 09, 2008, 03:47:00 PM

[driver.h]:

#define   ROT0   0
#define   ROT90   (ORIENTATION_SWAP_XY|ORIENTATION_FLIP_X)   /* rotate clockwise 90 degrees */
#define   ROT180   (ORIENTATION_FLIP_X|ORIENTATION_FLIP_Y)      /* rotate 180 degrees */
#define   ROT270   (ORIENTATION_SWAP_XY|ORIENTATION_FLIP_Y)   /* rotate counter-clockwise 90 degrees */


[1942.c]

GAME( 1984, 1942,  0,    1942, 1942, 0, ROT270, "Capcom", "1942 (set 1)" )


Maybe an easy fix, would be to change the defines in driver.h: i.e. #define ROT270 0
Don't know if that will mess anything up, but try it out.
The flipping in mameox is seperate to the flipping that's done in mame it seems.

Title: Questions & Discussion Of Mame Compile Notes & Tutorials
Post by: ressurectionx on April 09, 2008, 09:21:00 PM
Hey ekszbox,

I fixed the screen problem on Contra by starting from scratch in the MAMEox/MAMEox launcher code.  I had notes on what I changed that I wanted to keep, so it was no big deal.   I also figured out on accident how to stretch games like Contra to fullscreen (Not sure if I like that though, but it's easy enough to remove if I want to).  

Some more weird news...

I played Bagman after doing the fix above that worked for Black Tiger and 1942 and it keeps the screen from flipping in cocktail on player 2's turn.  The only problem is that they're both upside down.  GRRRRRRRRRR

This is really starting to get on my nerves.  Obviously that's not the place to fix it that I'm looking for.  There has to be a place (I'm assuming in the MAME project) that controls this globally.  I'll give your fix a try when I get some more time and see what happens.



I'm also working on manipulating the GUI now.  Haven't made much progress on that front yet.  All I can do at this point is change the text on the titlebar. (For some reason the GUI that I had from Arcades over  BPs source had the "sort by" categories named incorrectly, so I renamed them (eg. Sort by year actually sorted by category.  For some reason, it only allows me 5 different sort modes.  They are sort by Name, Category, Year, Number of Players, and a 5th sort mode which I can't figure out for the life of me what it is.  (I'm assuming it's either sort by Rom Status or Parent Rom.  I'd like to remove this 5th category and replace it with the ability to sort by Manufacturer.  Those would be the 5 I'd use because I really can't see the use in the other sort categories.  Plus I'm cleaning up the Manufacturer names in the source so sort by Manufacturer will actually be pretty useful.  Ex, changed Data East USA and Data East Corporation all to just Data East.... Changed all Atari's to just Atari, etc.

BP also had something in Arcades that I liked on his GUI.  When you were sorting by category, it actually listed the category in the titlebar.  The way it works now, the only time you can see what category you're sorting by is if you're in simple list view (the one with the screenshots).  I'm sure I have to use one variable or another that points to the category in the catver.ini file and display it in the titlebar, but anything I've tried so far has either led to compile errors or didn't change the titlebar at all.

Oh... and even though my .xbe is down 5MB to just over 35MB now, it doesn't really even free up memory for games like the Xmen vs capcom game.  There has been a slight change, but nothing drastic, and surely nothing that would get a game like this to work without VMM.  Like BP said, figuring out how to manipulate the VMM to autostart on certain games at certain settings will be much more effective.  I'm sure it's an easy fix, but I'm going to have to re-compile a billion times doing trial and error unless I can get BP to give me his source so I can compare the differences.

Take it easy,
~Rx
Title: Questions & Discussion Of Mame Compile Notes & Tutorials
Post by: ressurectionx on April 09, 2008, 11:45:00 PM
QUOTE
 181      PORT_DIPNAME( 0x08, 0x00, DEF_STR( Cabinet ) )      PORT_DIPLOCATION("SWA:5")
  182      PORT_DIPSETTING(    0x00, DEF_STR( Upright ) )
  183      PORT_DIPSETTING(    0x08, DEF_STR( Cocktail ) )


to this:

QUOTE
 181      PORT_DIPNAME( 0x08, 0x08, DEF_STR( Cabinet ) )      PORT_DIPLOCATION("SWA:5")
  182      PORT_DIPSETTING(    0x00, DEF_STR( Upright ) )
  183      PORT_DIPSETTING(    0x08, DEF_STR( Cocktail ) )


I figured that out because of the notes in the wiki on Dipswitch settings

QUOTE
PORT_DIPNAME is used to declare the name of the setting (what it does), which port bits it uses and what the default setting is. It follows the format

PORT_DIPNAME( dip_value, default_position, name )





The only drawback to this is that not every single 2player alternating game has a dipswitch for cabinet.  I've only noticed that for about 2 games so far and they're so old and lame that nobody would play them anyways probably, so it shouldn't be a big deal.  Besides, even if we could globally force it, the fix may not work on those games anyhow because of the lack of dipswitches for cabinet.
Title: Questions & Discussion Of Mame Compile Notes & Tutorials
Post by: ekszbox on February 03, 2020, 09:45:00 AM
In that case you could try flipping the flipped screen in the mameox directx rendering src, so it's upright, i.e.

CODE

if (Machine->orientation != ROT0)
{
  if (Machine->orientation == ROT90){
  // Rotate 90 degrees anticlockwise
  }
  else if (Machine->orientation == ROT180){
  // Rotate 180 degrees
  }
  else if (Machine->orientation == ROT270){
  // Rotate 90 degrees clockwise
  }
}


If you look at the rendering code you will see the parts that deal with flipping, just recycle them into your own re-flipping function.






Title: Questions & Discussion Of Mame Compile Notes & Tutorials
Post by: ressurectionx on April 10, 2008, 09:31:00 PM
If you're saying to do that to fix Bagman's problem, wouldn't it flip Bagman the right way but put all the games already working properly upside down?

Not sure what you mean here ekszbox.
Title: Questions & Discussion Of Mame Compile Notes & Tutorials
Post by: ressurectionx on April 11, 2008, 07:24:00 PM
Oh okay... gotcha.

I'll give it a shot on Sunday and let you know how it goes.  If I get this all working, let me know if you want the source and I'll host it up on rapidshare or something.  I plan on finishing the code purge, namechanges, manufacturer/year cleanup, and setting 2player alternating games to cocktail on default by Wednesday hopefully.  

Thanks again,
~Rx
Title: Questions & Discussion Of Mame Compile Notes & Tutorials
Post by: ressurectionx on April 14, 2008, 03:40:00 AM
QUOTE(ekszbox @ Apr 10 2008, 05:45 PM) View Post

In that case you could try flipping the flipped screen in the mameox directx rendering src, so it's upright, i.e.

CODE

if (Machine->orientation != ROT0)
{
  if (Machine->orientation == ROT90){
  // Rotate 90 degrees anticlockwise
  }
  else if (Machine->orientation == ROT180){
  // Rotate 180 degrees
  }
  else if (Machine->orientation == ROT270){
  // Rotate 90 degrees clockwise
  }
}


If you look at the rendering code you will see the parts that deal with flipping, just recycle them into your own re-flipping function.



I've done searches for that code in all three projects and I don't get any hits.  I see the stuff in driver.h, but I'm wondering which file this is found inside the mameox source.
Title: Questions & Discussion Of Mame Compile Notes & Tutorials
Post by: ressurectionx on April 14, 2008, 04:41:00 AM
QUOTE
GAME(1982, bagman,    0,      bagman, bagman,  0, ROT270, "Valadon Automation", "Bagman" )

TO:
QUOTE
GAME(1982, bagman,    0,      bagman, bagman,  0, ROT90, "Valadon Automation", "Bagman" )


Still haven't figured out why the changes I've made have had no effect on Pyros, 005 and Berzerk yet and why the second player still flips, but I'm starting to get that there is no universal switch like I thought.  With so many people creating drivers, they didn't exactly have a standard they went by.  Knowing that, I'm 99% sure that if I were to just go into generic.h and change the following code, I'd really be hosing up a ton of stuff and be cleaning that up for the next year.

QUOTE

/* monitor parameters to be used with the GAME() macro */
#define   ROT0   0
#define   ROT90   (ORIENTATION_SWAP_XY|ORIENTATION_FLIP_X)   /* rotate clockwise 90 degrees */
#define   ROT180   (ORIENTATION_FLIP_X|ORIENTATION_FLIP_Y)      /* rotate 180 degrees */
#define   ROT270   (ORIENTATION_SWAP_XY|ORIENTATION_FLIP_Y)   /* rotate counter-clockwise 90 degrees */

TO:
QUOTE

/* monitor parameters to be used with the GAME() macro */
#define   ROT0   0
#define   ROT90   0   /* rotate clockwise 90 degrees */
#define   ROT180   0      /* rotate 180 degrees */
#define   ROT270   0   /* rotate counter-clockwise 90 degrees */


(Probably not a good idea...)


Title: Questions & Discussion Of Mame Compile Notes & Tutorials
Post by: ressurectionx on April 15, 2008, 11:04:00 PM
UPDATES:  

I figured out how to control the rom sort method in the GUI. There are 5 "sort by" categories now: Name, Year, Genre, # of Players, and Manufacturer.  The Manufacturer looks nice now because I've cleaned all the Manufacturer names up to match (ex:  Atari and Atari Games are now all labeled as just Atari).

I might want a 6th sort by category, but at this point I haven't figured out what is limiting the selection to only 5 choices.  Either way, only these 5 are much better than having "Parent Rom" and "Rom Status", as they are completely useless when you have a self edited romset.
--------

I've done preliminary cleaning on all letters of the alphabet except for R, S and T (the biggest by far).  So far there has been a 7MB reduction in the final .xbe size because of this and I have experienced no negative effects on included games.  

I am keeping all code for parent roms in the emulator.  If the US roms happens to be a clone, that is being left in the emulator as well.  All US roms are titled without any brackets.  If the clone was (Europe) or (World) or (Japan) then that is thrown in parrenthises at the end of the title.  This way, you can use the parent rom if you like it better than the US rom.

All unreadable foreign roms, mahjong, and most quiz games have been removed.  (Trivial Persuit games are included and fixed so "Green" is A and "Red" is X so it's easy to play).  Some clones that seem to offer something different are also left in the code.  I have left a lot of the games I have marked as not working because I plan on working on them once more before deciding that they are no good.

I will probably be able to remove another 3 to 5MB from the final build.  Build times are quicker as well as dumping MAME and scanning for roms.  No notable improvement in games so far, but there is more free memory stated when loading a game that needs VMM when the VMM is turned off.  Maybe it will get some of the VMM games to run a little better?  We'll see...

Title: Questions & Discussion Of Mame Compile Notes & Tutorials
Post by: ressurectionx on April 17, 2008, 12:42:00 AM
QUOTE
Next thing I will try using precompiled headers on the xbox projects, as this will further improve build time.  If you want the code for this build, give me a shout.


I'd like to know more about these precomiled headers and any progress you've seen with them.

3)  You said:  
QUOTE
Splitting the drivers into let's say 20 DLL's would make a big difference, by the look of things it's not a trivial job, but I think it's possible.


I have a vague understanding of what a dll is, but you seem to know much more about these things than I do.  If you were going to udnertake the task of trying to create these DLLs, what would be your plan of attack?  If you believe there could be signifigant benifits, I might be willing to undertake this project.

Later,
~Rx
Title: Questions & Discussion Of Mame Compile Notes & Tutorials
Post by: ressurectionx on April 25, 2008, 08:53:00 PM
QUOTE
AM_RANGE(0x5003, 0x5003) AM_MIRROR(0xaf38) AM_WRITE(pacman_flipscreen_w)


This code is a little different because I had to pull it from the new build on mamedev.org since I'm not at home now, but you get the idea.

This worked perfect for Mad Alien, but the weirdest thing happens on Mr Do, Pac-Man and all of the other games on those drivers.  It keeps the background from flipping, such as the maze in Pac-Man, but all of the sprites are upside down as if cocktail mode was working like normal for them.  It's the strangest thing to see the ghosts upside down in the maze and when Pac-Man goes down on the left side of the screen the dots are disappearing upwards on the right side of the screen.  Same with Mr Do and all of the other games.

For the life of me I just can't figure out where the writemem code controlling the sprites is.  If I could figure that out, then I would make cocktail mode default for each 2 player alternating game so this is all automatic.  I'm open to any ides you've got.

I'll keep plugging away at it.  Thanks for your help and I'm really looking forward to get a hold of your minimized source so I can get testing done a lot quicker.  

Thanks again,
~Rx

Title: Questions & Discussion Of Mame Compile Notes & Tutorials
Post by: ressurectionx on May 01, 2008, 08:38:00 PM
Hey ekszbox,

I have some personal issues myself that are going to keep me away from this for a while.  Thanks for uploading the source.  I will get it as soon as I get a chance.  I'm really looking forward to see your video and music support.  That sounds real cool.

I hope you get better.  Take care of yourself man.

~Rx