GP32 How Atari Vector Graphic Games Were Added To Mame.


thegrimreaper

Certified Guru
Joined
Jun 11, 2005
Messages
137
Location
Leeds, North England
Website
Visit site
To help Franxis get some more developers helping him, I’m creating a guide on how Atari Vector Graphic games were added to his 1.2.2 source code. Hopefully some developers will see this and be inspired to help increase the list of games supported by Mame.

Firstly I’d like to point out that I’m a hopelessly bad C developer. I mostly work with C# and sometimes MFC, so writing C is a bit like going back to the dark ages for me.

After getting the development environment setup (many thanks to Oankali’s guide, without which Star Wars etc. still wouldn’t be available in Mame). I downloaded the MSDOS 0.34 Mame source code from the official site http://www.mame.net/zips/mame034s.zip and started to compare the differences from Franxis’ source code. After poking around a bit this is what I did:



Find the sections referring to “starwars” in the MSDOS 0.34 makefile and copy into makefile_atari, copying across the file referred to in the makefile.

Compiling at this point gives you loads of errors, carefully go through these and correct them. Once you've got it compiling, almost everything is done. I've just done this on 1.2.2. source and this is most of what I did:

1. Find all calls to errorlog() and remove that code
2. Find all C++ style // comments and replace them with C style /* … */ style comments
3. Add missing files and makefile references for vidhrdw\vector.o. Perform steps 1 & 2 on the new files.
4. Remove calls to osd_mark_dirty and osd_mark_vector_dirty. Not required.
5. Remove Artwork Functions from bottom of vector.c/h and removed include “artwork.h”. This helps to save memory.
6. Add a GP32 version of osinline.h to src\gp32, helped by a very quick reply from LDChen http://www.gp32x.de/board/index.php?showtopic=19560
7. Find the GameDriver sections for each of the new games in the src\drivers directory. Then replace the xxxxx_hiload, xxxxx_hisave sections with 0, 0 and remove those function implementations. Maybe someone would like to re-add the Hi-score functionality? I think this was removed to stops lots of SMC write operations.
8. Add missing files and makefile references for obj/machine/mathbox.o. Perform steps 1 & 2 on the new files
9. Remove typedefs in mathbox.h
10. Add missing files and makefile references for obj/vidhrdw/avgdvg.o. Perform steps 1 & 2 on the new files
11. Remove Artwork function calls artwork_load(), artwork_free(), vector_vh_update_artwork(), vector_vh_update_backdrop() & backdrop_refresh() from src\vidhrdw\avgdvg.c to save memory, as in step 5.
12. Remove Artwork function calls png_read_artwork() from src\vidhrdw\llander.c to save memory, as in step 5.



The code should now compile, but there are a couple of other things that need to be done to get it to run properly:

1. Find all calls to malloc and replace with gm_zi_malloc
2. Find all calls to free and replace with gm_free
3. Fix some null pointer problems (only caused by Vector Stuff). Find the MachineDriver sections for each of the new games in the src\drivers directory. Then replace gfxdecodeinfo with 0 and delete the functions gfxdecodeinfo and fakelayout referred to in this change.
4. Improve the display by finding the MachineDriver sections and changing the screen size to 320, 240. This is done by changing the code below /* video hardware */ from e.g. 400, 300, { 0, 480, 0, 440 }, to 320, 240, { 0, 480, 0, 440 }.
5. Improve the response of any analogue input devices by tweaking the INPUT_PORTS_START settings. Find the PORT_ANALOG/ PORT_ANALOGX sections and alter the joystick sensitivity by changing parameter 4. This should be the parameter after the joystick type, which should be something like IPT_xxxxxx.


Now all that needs to be done is inform the menu system about the availability of the new games that have been added. This is done by bringing through the relevant sections from the 0.34 MSDOS version of src\driver.c and putting them in the files driver_all.c and driver_atari.c in Franxis’ source code. This will mean adding sections like

/* Atari vector games */
extern struct GameDriver asteroid_driver;
extern struct GameDriver asteroi1_driver;

and later in the file

/* Atari vector games */
&asteroid_driver, /* © 1979 */
&asteroi1_driver, /* no copyright notice */
 
Last edited by a moderator:
This is a great insight into how this is done, and its definately got me interested, thanks for taking the time to explain it.
 
I was just doing a few additional updates to Mame and noticed I'd missed off a couple of items from this guide (I'm still using this guide to make sure I don't miss anything)

It should have read...

1. Find all calls to malloc and replace with gm_zi_malloc
2. Find all calls to free and replace with gm_free
2a. Find all calls to memset and replace with gm_memset
2b. Find all calls to memcpy and replace with gm_memcpy
 
Back
Top