Athena Doesn't Run Correctly


Shikaku posted on Oct 22 2006 at 07:06 PM said:
Athena doesn't seem to run correctly at all visually and audially: visually the colors are distorted, and audially the sound doesn't turn on until you die once, and even then only the music starts playing. This is with the newest version has been persisting.

I've had the same problem with every release... I'm going to try 3.2 tomorrow and see what that does but so far every version has run the game but the colors are all blue and orange-ish and bright. I don't remember the sound having a problem but I don't notice that as much in games.
 
Last edited by a moderator:
Code:
diff -urw mame gp2x 3.3 sources/src/drivers/snk.cpp src/drivers/snk.cpp
--- mame gp2x 3.3 sources/src/drivers/snk.cpp	2006-05-06 18:39:52.000000000 +0900
+++ src/drivers/snk.cpp	2006-11-08 10:40:43.994875000 +0900
@@ -70,6 +70,7 @@
 #define MEM_GFX_BIGSPRITES	7
 #define MEM_SAMPLES			8
 
+extern void aso_vh_convert_color_prom(unsigned char *palette, unsigned short *colortable,const unsigned char *color_prom);
 extern void snk_vh_convert_color_prom(unsigned char *palette, unsigned short *colortable,const unsigned char *color_prom);
 extern void ikari_vh_convert_color_prom(unsigned char *palette, unsigned short *colortable,const unsigned char *color_prom);
 
@@ -86,6 +87,8 @@
 /**************************************************************/
 
 static int hard_flags = 0;
+static int snk_sound_busy_bit = 0;
+static int snk_sound_register = 0;
 
 #define DIAL_NONE		0
 #define DIAL_BOOTLEG	1
@@ -151,6 +154,13 @@
 	return val;
 }
 
+static int snk_sound_register_r(int offset){
+	return snk_sound_register;// | 0x2; /* hack; lets chopper1 play music */
+}
+static void snk_sound_register_w(int offset, int data){
+	snk_sound_register &= (data>>4);
+}
+
 static int shared_ram_r( int offset ){
 	return shared_ram[offset];
 }
@@ -167,7 +177,11 @@
 
 static int cpuA_io_r( int offset ){
 	switch( offset ){
-		case 0x000: return input_port_0_r( 0 );
+		case 0x000: {
+			int value = input_port_0_r( 0 );
+			//if( (snk_sound_register & 0x04) == 0 ) value &= ~snk_sound_busy_bit;
+			return value;
+		}
 		case 0x100: return snk_read_joy( 0 );
 		case 0x200: return snk_read_joy( 1 );
 
@@ -205,6 +219,8 @@
 		break;
 
 		case 0x400:
+		case 0x500:
+		snk_sound_register |= 0x08 | 0x04;
 		io_ram[offset] = snk_soundcommand = data;
 		psychos_voice(data);
 		break;
@@ -1384,8 +1400,8 @@
 };
 
 static struct GfxDecodeInfo athena_gfxdecodeinfo[] = {
-	{ MEM_GFX_CHARS,	  0x0, &char512,			0, 64 },
-	{ MEM_GFX_TILES,	  0x0, &char1024,			0, 64 },
+	{ MEM_GFX_CHARS,	  0x0, &char512,			128*3, 8 },
+	{ MEM_GFX_TILES,	  0x0, &char1024,			128*1, 16 },
 	{ MEM_GFX_SPRITES,	0x0, &sprite1024,			0, 64 },
 	{ -1 }
 };
@@ -1457,7 +1473,7 @@
 
 	tnk3_gfxdecodeinfo,
 	1024,1024,
-	snk_vh_convert_color_prom,
+	aso_vh_convert_color_prom,
 
 	VIDEO_TYPE_RASTER,
 	0,
@@ -1514,7 +1530,7 @@
 
 	tnk3_gfxdecodeinfo,
 	1024,1024,
-	snk_vh_convert_color_prom,
+	aso_vh_convert_color_prom,
 
 	VIDEO_TYPE_RASTER,
 	0,
@@ -1570,7 +1586,7 @@
 
 	athena_gfxdecodeinfo,
 	1024,1024,
-	snk_vh_convert_color_prom,
+	aso_vh_convert_color_prom,
 
		 VIDEO_TYPE_RASTER | VIDEO_SUPPORTS_16BIT, /* overflows static palette! */
 	0,
@@ -1626,7 +1642,7 @@
 
 	athena_gfxdecodeinfo,
 	1024,1024,
-	snk_vh_convert_color_prom,
+	aso_vh_convert_color_prom,
 
 	VIDEO_TYPE_RASTER | VIDEO_SUPPORTS_16BIT,
 	0,
@@ -2109,13 +2125,13 @@
 	ROM_LOAD( "up02_m8.rom",  0x4000, 0x8000, 0xf3c933df )
 
 	ROM_REGION( 0x10000 ) /* 64k for sound code */
-	ROM_LOAD( "up02_g6.rom",  0x0000, 0x4000, 0xe890ce09 )
-	ROM_CONTINUE( 0x00000, 0x4000 )  /* skip 0x4000 bytes */
+	ROM_LOAD( "up02_g6.rom",  0x0000, 0x4000, 0x42dbe029 )
+	//ROM_CONTINUE( 0x00000, 0x4000 )  /* skip 0x4000 bytes */
 	ROM_LOAD( "up02_k6.rom",  0x4000, 0x8000, 0x596f1c8a )
 
 	ROM_REGION( 0xC00 )	/* color proms */
-	ROM_LOAD( "up02_b1.rom",  0x000, 0x400, 0xd25c9099 ) /* red? */
-	ROM_LOAD( "up02_c2.rom",  0x400, 0x400, 0x294279ae ) /* green */
+	ROM_LOAD( "up02_c2.rom",  0x000, 0x400, 0x294279ae ) /* green */
+	ROM_LOAD( "up02_b1.rom",  0x400, 0x400, 0xd25c9099 ) /* red? */
 	ROM_LOAD( "up02_c1.rom",  0x800, 0x400, 0xa4a4e7dc ) /* blue? */
 
 	ROM_REGION_DISPOSE( 0x4000 ) /* characters */
@@ -2416,20 +2432,20 @@
 	ROM_LOAD( "bt_p3.rom",  0x00000, 0x10000, 0x53a82e50 )	/* YM3526 */
 
 	ROM_REGION( 0x1400 ) /* color proms - missing! */
-	ROM_LOAD( "mb7122e.1k",   0x0000, 0x0400, 0x1e8fc4c3 ) /* red */
-	ROM_LOAD( "mb7122e.2l",   0x0400, 0x0400, 0x23ce9707 ) /* green */
-	ROM_LOAD( "mb7122e.1l",   0x0800, 0x0400, 0x26caf985 ) /* blue */
-	ROM_LOAD( "mb7122e.h5",   0x0c00, 0x0400, 0xc20b197b ) /* ? */
-	ROM_LOAD( "mb7122e.h6",   0x1000, 0x0400, 0x5d0c617f ) /* ? */
+	ROM_LOAD( "btj_01r.prm",  0x0000, 0x0400, 0xf4b54d06 ) /* red */
+	ROM_LOAD( "btj_02g.prm",  0x0400, 0x0400, 0xbaac139e ) /* green */
+	ROM_LOAD( "btj_03b.prm",  0x0800, 0x0400, 0x2edf2e0b ) /* blue */
+	ROM_LOAD( "btj_h.prm",	0x0c00, 0x0400, 0xc20b197b ) /* ? */
+	ROM_LOAD( "btj_v.prm",	0x1000, 0x0400, 0x5d0c617f ) /* ? */
 
 	ROM_REGION_DISPOSE( 0x8000 ) /* characters */
 	ROM_LOAD( "bt_p10.rom",  0x0000, 0x8000,  0xd3650211 )
 
 	ROM_REGION_DISPOSE( 0x40000 ) /* background tiles */
-	ROM_LOAD( "bt_p19.rom",  0x00000, 0x10000, 0x8ed759a0 )
-	ROM_LOAD( "bt_p20.rom",  0x10000, 0x10000, 0xab6217b7 )
-	ROM_LOAD( "bt_p21.rom",  0x20000, 0x10000, 0xb7689599 )
-	ROM_LOAD( "bt_p22.rom",  0x30000, 0x10000, 0x8daf7df4 )
+	ROM_LOAD( "bt_p22.rom",  0x00000, 0x10000, 0x8daf7df4 )
+	ROM_LOAD( "bt_p21.rom",  0x10000, 0x10000, 0xb7689599 )
+	ROM_LOAD( "bt_p20.rom",  0x20000, 0x10000, 0xab6217b7 )
+	ROM_LOAD( "bt_p19.rom",  0x30000, 0x10000, 0x8ed759a0 )
 
 	ROM_REGION_DISPOSE( 0x40000 ) /* 16x16 sprites */
 	ROM_LOAD( "bt_p6.rom",  0x00000, 0x8000, 0x8ffdf969 )
@@ -2948,6 +2964,7 @@
 }
 
 static void athena_decode( void ){
+	snk_sound_busy_bit = 0x01;
 	dial_type = DIAL_NONE;
 	hard_flags = 0;
 }



diff -urw mame gp2x 3.3 sources/src/vidhrdw/snk.cpp src/vidhrdw/snk.cpp
--- mame gp2x 3.3 sources/src/vidhrdw/snk.cpp	2006-05-06 18:39:54.000000000 +0900
+++ src/vidhrdw/snk.cpp	2006-11-08 10:57:36.838625000 +0900
@@ -98,6 +98,41 @@
 	}
 }
 
+void aso_vh_convert_color_prom(unsigned char *palette, unsigned short *colortable,const unsigned char *color_prom){
+	int i;
+	int num_colors = 1024;
+	/*
+		palette format is RRRG GGBB B??? the three unknown bits are used but
+		I'm not sure how, I'm currently using them as least significant bit but
+		that's most likely wrong.
+	*/
+	for( i=0; i<num_colors; i++ ){
+		int bit0,bit1,bit2,bit3;
+
+		colortable[i] = i;
+
+		bit0 = (color_prom[2*num_colors] >> 2) & 0x01;
+		bit1 = (color_prom[0] >> 1) & 0x01;
+		bit2 = (color_prom[0] >> 2) & 0x01;
+		bit3 = (color_prom[0] >> 3) & 0x01;
+		*palette++ = 0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3;
+
+		bit0 = (color_prom[2*num_colors] >> 1) & 0x01;
+		bit1 = (color_prom[num_colors] >> 2) & 0x01;
+		bit2 = (color_prom[num_colors] >> 3) & 0x01;
+		bit3 = (color_prom[0] >> 0) & 0x01;
+		*palette++ = 0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3;
+
+		bit0 = (color_prom[2*num_colors] >> 0) & 0x01;
+		bit1 = (color_prom[2*num_colors] >> 3) & 0x01;
+		bit2 = (color_prom[num_colors] >> 0) & 0x01;
+		bit3 = (color_prom[num_colors] >> 1) & 0x01;
+		*palette++ = 0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3;
+
+		color_prom++;
+	}
+}
+
 void snk_vh_convert_color_prom(unsigned char *palette, unsigned short *colortable,const unsigned char *color_prom){
 	int i;
 	int num_colors = 1024;
@@ -187,15 +222,15 @@
 		if( tile_number!=dirtybuffer[offs] || attributes != dirtybuffer[offs+1] ){
 			int sy = ((offs/2)%64)*8;
 			int sx = ((offs/2)/64)*8;
-			int color = 0xe;
-			if( (k&0xf)==(attributes&0xf) && osd_key_pressed(OSD_KEY_G) ) color = random()&0xff;
+			int color = (attributes&0xf) ^ 8; //0xe;
+			//if( (k&0xf)==(attributes&0xf) && osd_key_pressed(OSD_KEY_G) ) color = random()&0xff;
 
 			dirtybuffer[offs] = tile_number;
 			dirtybuffer[offs+1] = attributes;
 
 			tile_number += 256*((attributes>>4)&0x3);
 
-			if( attributes&0xc0 ) color = k;
+			//if( attributes&0xc0 ) color = k;
 
 			drawgfx( tmpbitmap,gfx,
 				tile_number,
@@ -262,8 +297,27 @@
 	const struct rectangle *clip = &Machine->drv->visible_area;
 	int color = 0x18;
 	int offs;
-	bank*=256;
 
+	int x,y,sx,sy,tile_number;
+	for(x=0; x<32; x++) for(y=0; y<32; y++)
+	{
+		tile_number = source[(x<<5)+y];
+
+		if(tile_number == 0x20 || tile_number == 0xff) continue;
+
+		if(bank == -1) color = 8;
+		else
+		{
+			color = tile_number >> 5;
+			tile_number |= bank << 8;
+		}
+		sx = (x+2) << 3;
+		sy = (y+1) << 3;
+
+		drawgfx(bitmap,gfx,tile_number,color,0,0,sx,sy,clip,TRANSPARENCY_PEN,15);
+	}
+/*
+	bank*=256;
 	for( offs = 0;offs <0x400; offs++ ){
 		drawgfx( bitmap, gfx,
 			source[offs]+bank,
@@ -273,8 +327,9 @@
 			clip,
 			TRANSPARENCY_PEN,15 );
 	}
+*/
 }
-
+/*
 static void tnk3_draw_status( struct osd_bitmap *bitmap, int bank, unsigned char *source ){
 	const struct rectangle *clip = &Machine->drv->visible_area;
 	int color = 0x18;
@@ -304,6 +359,36 @@
 			clip,TRANSPARENCY_NONE,0);
 	}
 }
+*/
+static void tnk3_draw_status_main( struct osd_bitmap *bitmap, int bank, unsigned char *source, int start )
+{
+	const struct rectangle *clip = &Machine->drv->visible_area;
+	int tile_number, color, sx, sy;
+	int x, y;
+
+	for(x = start; x < start+2; x++) for(y = 0; y < 32; y++)
+	{
+		tile_number = source[(x<<5)+y];
+
+		if(bank == -1) color = 8;
+		else
+		{
+ 			color = tile_number >> 5;
+			tile_number |= (bank << 8);
+		}
+		sx = ((x+34)&0x3f) << 3;
+		sy = (y+1) << 3;
+
+		drawgfx(bitmap,Machine->gfx[GFX_CHARS],tile_number,color,0,0,sx,sy,clip,TRANSPARENCY_NONE,0);
+	}
+}
+
+static void tnk3_draw_status( struct osd_bitmap *bitmap, int bank, unsigned char *source )
+{
+
+	tnk3_draw_status_main(bitmap,bank,source, 0);
+	tnk3_draw_status_main(bitmap,bank,source,30);
+}
 
 void tnk3_draw_sprites( struct osd_bitmap *bitmap, int xscroll, int yscroll ){
 	const unsigned char *source = spriteram;
@@ -321,11 +406,11 @@
 		if( attributes&0x40 ) tile_number += 256;
 		if( attributes&0x20 ) tile_number += 512;
 
-		if( (k&0xf)==color || !osd_key_pressed(OSD_KEY_H) )
+		//if( (k&0xf)==color || !osd_key_pressed(OSD_KEY_H) )
 
 		drawgfx(bitmap,Machine->gfx[GFX_SPRITES],
 			tile_number,
-			k,
+			color,
 			0,0,
 			(256-sx)&0x1ff,sy&0x1ff,
 			&clip,TRANSPARENCY_PEN,7);
@@ -814,6 +899,7 @@
 	}
 
 	{
+		unsigned char sp_attributes = ram[0xcac0];
 		int sp16_y = ram[0xc900]+15;
 		int sp16_x = ram[0xc940]+8;
 		int sp32_y = ram[0xc980]+31;
@@ -826,14 +912,14 @@
 			if( bg_attributes&0x80 ) sp32_x += 256;
 		}
 		else{ /* psychos, bermudet, chopper1... */
-			unsigned char sp_attributes = ram[0xca80];
+			unsigned char spp_attributes = ram[0xca80];
 			if( sp_attributes&0x04 )sp16_y += 256;
 			if( sp_attributes&0x08 )sp32_y += 256;
 			if( sp_attributes&0x10 )sp16_x += 256;
 			if( sp_attributes&0x20 )sp32_x += 256;
 		}
 
-		if( osd_key_pressed(OSD_KEY_F) ){
+		if( sp_attributes & 0xf8 ) { //osd_key_pressed(OSD_KEY_F) ){
 			gwar_draw_sprites_16x16( bitmap, sp16_y, sp16_x );
 			gwar_draw_sprites_32x32( bitmap, sp32_y, sp32_x );
 		}

fix snk driver from MAME 0.103 source.
but, audio bug(no sound before character die once) is exists.
 
Back
Top