Read the mamegrip.txt file for full details.

This is only necessary to play with the source code.

Starting with MAME 0.36b7 and Allegro WIP 3.9.26, GrIP support is included in 
the standard distibutions (finally :).

Compiling "out-of-the-box" is much better than the acrobatics that were needed
back with MAME 0.35. Still, there are a couple of changes that are useful.
The modified files are in the src directory here, but you may want to apply
the patches by hand (especially for patching future versions).

The analog support in MAME is still limited, and the analog pad on the 
Xterminator will act as a digital control with the standard MAME.
If desired, you can also use the following quick hack to attempt to
use analog controls for the analog device (as in the Xterminator). I
have better code, but I'd rather not bother polishing it off if MAME
team is going to do it also anyway. The other possibility is to 
change the Allegro source to make it detect analog sticks first. I'm
mostly waiting for the official fixes at this point.

In src\msdos\input.c, replace:

void osd_analogjoy_read(int player,int *analog_x, int *analog_y)
{
	*analog_x = *analog_y = 0;

	/* is there an analog joystick at all? */
	if (player+1 > num_joysticks || joystick == JOY_TYPE_NONE)
		return;

	*analog_x = joy[player].stick[0].axis[0].pos;
	*analog_y = joy[player].stick[0].axis[1].pos;
}

with:

void osd_analogjoy_read(int player,int *analog_x, int *analog_y)
{
	int i, stick;
	
	*analog_x = *analog_y = 0;
	
	/* is there an analog joystick at all? */
	if (player+1 > num_joysticks || joystick == JOY_TYPE_NONE)
		return;
	/***rjr*** at least try to find an analog control */
	i = 0;
	for (stick = 0; stick < joy[player].num_sticks; stick++)
	{
		if (joy[player].stick[stick].flags & JOYFLAG_ANALOG)
		{
			i = stick;
			break;
		}
	}
	*analog_x = joy[player].stick[i].axis[0].pos;
	*analog_y = joy[player].stick[i].axis[1].pos;
}

For the really spiffy analog support, you need fancier changes. The altered
files from MAME 0.36b7 are included. These are osdepend.h, usrintrf.c,
msdos/input.c, and msdos/config.c.

info.c, info.h, and msdos/fronthlp.c implement a really hackish workaround to
the new sample problem. Seems to work, though.

The GrIP support in Allegro has removed a few features. The only ones that I
consider important are the option to not unload the GrIP library and the debug
output. On some systems, unloading the library causes the program to crash.
This causes no harm, since the program is exiting anyway, but it is annoying.
The debug output produces a grip.out file that is very helpful if things are
not working right.

Both of these features can be enabled by adding a few source code changes to
the Allegro file src/dos/gripjoy.c.

There are other source code changes in the Allegro subdirectory. These shorten
the axis names of some controllers, make throttles trigger as digital controls,
and fix a couple other bugs.


As for optimization, I use the following flags (and something similar in Allegro):

CFLAGS = -Isrc -Isrc/msdos -Iobj/cpu/m68000 -Isrc/cpu/m68000 \
	-fomit-frame-pointer -O4 -march=pentium \
	-funroll-loops  -fschedule-insns2 \
	-finline-functions -ffast-math -fno-exceptions \
	-mno-ieee-fp -malign-double -malign-loops=4 \
	-Werror -Wall -Wno-sign-compare -Wunused \
	-Wpointer-arith -Wbad-function-cast -Wcast-align -Waggregate-return \
	-pedantic \
	-Wshadow \
	-Wstrict-prototypes

Changing the "-march=pentium" to "-mcpu=pentium" will make it run on any
ix86. You can also make machine-specific compiles with "-march=k6",
"-march=pentiumpro", "-march=i486".
