Exemple #1
0
void dleague_vh_screenrefresh(struct osd_bitmap *bitmap,int full_refresh)
{
	TC0080VCO_tilemap_update();

#ifdef MAME_DEBUG
	taitoh_log_vram();
#endif

	palette_init_used_colors();
	mark_sprite_colors();
	palette_recalc();

	fillbitmap(bitmap, palette_transparent_pen, &Machine -> visible_area);

#ifdef MAME_DEBUG
	if ( !keyboard_pressed(KEYCODE_A) )
		TC0080VCO_tilemap_draw(bitmap,0,TILEMAP_IGNORE_TRANSPARENCY,0);
	if ( !keyboard_pressed(KEYCODE_S) )
		dleague_draw_sprites(bitmap,0);
	if ( !keyboard_pressed(KEYCODE_D) )
		TC0080VCO_tilemap_draw(bitmap,1,0,0);
	if ( !keyboard_pressed(KEYCODE_F) )
		dleague_draw_sprites(bitmap,1);
#else
	TC0080VCO_tilemap_draw(bitmap,0,TILEMAP_IGNORE_TRANSPARENCY,0);
	dleague_draw_sprites  (bitmap,0);
	TC0080VCO_tilemap_draw(bitmap,1,0,0);
	dleague_draw_sprites  (bitmap,1);
#endif

	TC0080VCO_tilemap_draw(bitmap,2,0,0);
}
Exemple #2
0
void cps1_debug_tiles(struct osd_bitmap *bitmap)
{

    if (keyboard_pressed(KEYCODE_1))
    {
       cps2_debug=1;
       cps2_start=0;
       cps2_width=48;
    }
    if (keyboard_pressed(KEYCODE_2))
    {
       cps2_debug=2;
       cps2_start=0;
       cps2_width=24;
    }
    if (keyboard_pressed(KEYCODE_3))
    {
       cps2_debug=3;
       cps2_start=0;
       cps2_width=12;
    }


    if (cps2_debug)
    {
        cps1_debug_tiles_f(bitmap, cps2_debug, cps2_width);
    }
}
Exemple #3
0
static void sprite_callback(int *code,int *color,int *priority_mask)
{
#if 0
    if (keyboard_pressed(KEYCODE_Q) && (*color & 0x80)) *color = rand();
    if (keyboard_pressed(KEYCODE_W) && (*color & 0x40)) *color = rand();
    if (keyboard_pressed(KEYCODE_E) && (*color & 0x20)) *color = rand();
    if (keyboard_pressed(KEYCODE_R) && (*color & 0x10)) *color = rand();
#endif
    *priority_mask = (*color & 0x10) ? 0 : 0x02;
    *color = sprite_colorbase + (*color & 0x0f);
}
void BaseElement::on_tick() {
	if (!parent->isSolid()) {
		if (keyboard_pressed(SDLK_LEFT)) {
			parent->setX(parent->getX() - 2);
			return;
		}
		if (keyboard_pressed(SDLK_RIGHT)) {
			parent->setX(parent->getX() + 2);
			return;
		}
	}
}
Exemple #5
0
static int display_rom_load_results(struct rom_load_data *romdata)
{
	int region;

	/* final status display */
	osd_display_loading_rom_message(NULL, romdata);

	/* only display if we have warnings or errors */
	if (romdata->warnings || romdata->errors)
	{
		extern int bailing;

		/* display either an error message or a warning message */
		if (romdata->errors)
		{
			strcat(romdata->errorbuf, "ERROR: required files are missing, the game cannot be run.\n");
			bailing = 1;
		}
		else
			strcat(romdata->errorbuf, "WARNING: the game might not run correctly.\n");

		/* display the result */
		printf("%s", romdata->errorbuf);

		/* if we're not getting out of here, wait for a keypress */
		if (!options.gui_host && !bailing)
		{
#if 0
			int k;

			/* loop until we get one */
			printf ("Press any key to continue\n");
			do
			{
				k = code_read_async();
			}
			while (k == CODE_NONE || k == KEYCODE_LCONTROL);
#endif

			/* bail on a control + C */
			if (keyboard_pressed(KEYCODE_LCONTROL) && keyboard_pressed(KEYCODE_C))
				return 1;
		}
	}

	/* clean up any regions */
	if (romdata->errors)
		for (region = 0; region < MAX_MEMORY_REGIONS; region++)
			free_memory_region(region);

	/* return true if we had any errors */
	return (romdata->errors != 0);
}
Exemple #6
0
/* return non-zero to abort loading */
int osd_display_loading_rom_message (const char *name, int current, int total)
{
	if( name )
		printf ("loading %-12s\n", name);
	else
		printf ("             \n");
	fflush (stdout);

	if( keyboard_pressed (KEYCODE_LCONTROL) && keyboard_pressed (KEYCODE_C) )
		return 1;

	return 0;
}
Exemple #7
0
static INTERRUPT_GEN( fromanc2_interrupt )
{
	static int fromanc2_playerside_old = -1;
	static int key_F1_old = 0;

	if (keyboard_pressed(KEYCODE_F1)) {
		if (key_F1_old != 1) {
			key_F1_old = 1;
			fromanc2_playerside ^= 1;
		}
	} else key_F1_old = 0;

	if (fromanc2_playerside_old != fromanc2_playerside) {
		fromanc2_playerside_old = fromanc2_playerside;

		usrintf_showmessage("PLAYER-%01X SIDE", fromanc2_playerside + 1);

		if (!fromanc2_playerside) {
			mixer_set_stereo_volume(3, 75, 75);	// 1P (LEFT)
			mixer_set_stereo_volume(4,  0,  0);	// 2P (RIGHT)
		}
		else {
			mixer_set_stereo_volume(3,  0,  0);	// 1P (LEFT)
			mixer_set_stereo_volume(4, 75, 75);	// 2P (RIGHT)
		}

		fromanc2_set_dispvram_w(fromanc2_playerside);
	}

	cpu_set_irq_line(0, 1, HOLD_LINE);
}
/* invoked by main tree code to update bitmap into screen */
void ph_window_update_display (struct mame_bitmap *bitmap)
{
   PhRegion_t region_info;	

//	fprintf(stderr,"Calling update display\n");

// TODO:  Not sure just yet what this is for...if it's only x related we can probably
//	  toss it.   
   (*ph_window_update_display_func) (bitmap);

   if (use_mouse &&
       keyboard_pressed (KEYCODE_LALT) &&
       keyboard_pressed_memory (KEYCODE_PGDN))
   {
      if (ph_grab_mouse)
      {
         region_info.cursor_type = 0;
	 region_info.rid = PtWidgetRid(P_mainWindow);
	 ph_grab_mouse = FALSE;
      }
      else
      {
	 region_info.cursor_type = Ph_CURSOR_NONE;
	 region_info.rid = PtWidgetRid(P_mainWindow);      
	 ph_grab_mouse = TRUE;
      }

      PhRegionChange (Ph_REGION_CURSOR, 0, &region_info, NULL, NULL);
   }

   PgFlush();         /* flush buffer to server */
}
Exemple #9
0
void cps1_debug_tiles_f(struct osd_bitmap *bitmap, int layer, int width)
{
    int maxy=width/2;
    int x,y;
	int n=cps2_start;

	/* Blank screen */
    fillbitmap(bitmap, palette_transparent_pen, NULL);

    for (y=0; y<maxy; y++)
    {
        for (x=0;x<width;x++)
        {
            switch (layer)
            {
                case 1:
                    cps1_draw_scroll1(bitmap, n, 0, 0, 0, 32+x*8, 32+y*8, 0xffff);
                    break;
                case 2:
                    cps1_draw_tile16(bitmap, Machine->gfx[2], n, 0, 0, 0, 32+x*16, 32+y*16, 0xffff);
                    break;
                case 3:
                    cps1_draw_tile32(bitmap, Machine->gfx[3], n, 0, 0, 0, 32+x*32, 32+y*32, 0xffff);
                    break;
            }
            n++;
        }
     }

     if (keyboard_pressed(KEYCODE_PGDN))
     {
        cps2_start+=width*maxy;
     }
     if (keyboard_pressed(KEYCODE_PGUP))
     {
        cps2_start-=width*maxy;
     }
     if (cps2_start < 0)
     {
		cps2_start=0;
     }
}
Exemple #10
0
int readroms(void)
{
	int region;
	const struct RomModule *romp;
	int warning = 0;
	int fatalerror = 0;
	int total_roms,current_rom;
	char buf[4096] = "";


	total_roms = current_rom = 0;
	romp = Machine->gamedrv->rom;

	if (!romp) return 0;

	while (romp->name || romp->offset || romp->length)
	{
		if (romp->name && romp->name != (char *)-1)
			total_roms++;

		romp++;
	}


	romp = Machine->gamedrv->rom;

	for (region = 0;region < MAX_MEMORY_REGIONS;region++)
		Machine->memory_region[region] = 0;

	region = 0;

	while (romp->name || romp->offset || romp->length)
	{
		unsigned int region_size;
		const char *name;

		/* Mish:  An 'optional' rom region, only loaded if sound emulation is turned on */
		if (Machine->sample_rate==0 && (romp->crc & REGIONFLAG_SOUNDONLY)) {
			logerror("readroms():  Ignoring rom region %d\n",region);
			Machine->memory_region_type[region] = romp->crc;
			region++;

			romp++;
			while (romp->name || romp->length)
				romp++;

			continue;
		}

		if (romp->name || romp->length)
		{
			printf("Error in RomModule definition: expecting ROM_REGION\n");
			goto getout;
		}

		region_size = romp->offset;
		if ((Machine->memory_region[region] = (unsigned char *) malloc(region_size)) == 0)
		{
			printf("readroms():  Unable to allocate %d bytes of RAM\n",region_size);
			goto getout;
		}
		Machine->memory_region_length[region] = region_size;
		Machine->memory_region_type[region] = romp->crc;

		/* some games (i.e. Pleiades) want the memory clear on startup */
		if (region_size <= 0x400000)	/* don't clear large regions which will be filled anyway */
			memset(Machine->memory_region[region],0,region_size);

		romp++;

		while (romp->length)
		{
			void *f;
			int expchecksum = romp->crc;
			int	explength = 0;


			if (romp->name == 0)
			{
				printf("Error in RomModule definition: ROM_CONTINUE not preceded by ROM_LOAD\n");
				goto getout;
			}
			else if (romp->name == (char *)-1)
			{
				printf("Error in RomModule definition: ROM_RELOAD not preceded by ROM_LOAD\n");
				goto getout;
			}

			name = romp->name;

			/* update status display */
			if (osd_display_loading_rom_message(name,++current_rom,total_roms) != 0)
               goto getout;

			{
				const struct GameDriver *drv;

				drv = Machine->gamedrv;
				do
				{
					f = osd_fopen(drv->name,name,OSD_FILETYPE_ROM,0);
					drv = drv->clone_of;
				} while (f == 0 && drv);

				if (f == 0)
				{
					/* NS981003: support for "load by CRC" */
					char crc[9];

					sprintf(crc,"%08x",romp->crc);
					drv = Machine->gamedrv;
					do
					{
						f = osd_fopen(drv->name,crc,OSD_FILETYPE_ROM,0);
						drv = drv->clone_of;
					} while (f == 0 && drv);
				}
			}

			if (f)
			{
				do
				{
					unsigned char *c;
					unsigned int i;
					int length = romp->length & ~ROMFLAG_MASK;


					if (romp->name == (char *)-1)
						osd_fseek(f,0,SEEK_SET);	/* ROM_RELOAD */
					else
						explength += length;

					if (romp->offset + length > region_size ||
						(!(romp->length & ROMFLAG_NIBBLE) && (romp->length & ROMFLAG_ALTERNATE)
								&& (romp->offset&~1) + 2*length > region_size))
					{
						printf("Error in RomModule definition: %s out of memory region space\n",name);
						osd_fclose(f);
						goto getout;
					}

					if (romp->length & ROMFLAG_NIBBLE)
					{
						unsigned char *temp;


						temp = (unsigned char *) malloc(length);

						if (!temp)
						{
							printf("Out of memory reading ROM %s\n",name);
							osd_fclose(f);
							goto getout;
						}

						if (osd_fread(f,temp,length) != length)
						{
							printf("Unable to read ROM %s\n",name);
						}

						/* ROM_LOAD_NIB_LOW and ROM_LOAD_NIB_HIGH */
						c = Machine->memory_region[region] + romp->offset;
						if (romp->length & ROMFLAG_ALTERNATE)
						{
							/* Load into the high nibble */
							for (i = 0;i < length;i ++)
							{
								c[i] = (c[i] & 0x0f) | ((temp[i] & 0x0f) << 4);
							}
						}
						else
						{
							/* Load into the low nibble */
							for (i = 0;i < length;i ++)
							{
								c[i] = (c[i] & 0xf0) | (temp[i] & 0x0f);
							}
						}

						free(temp);
					}
					else if (romp->length & ROMFLAG_ALTERNATE)
					{
						/* ROM_LOAD_EVEN and ROM_LOAD_ODD */
						/* copy the ROM data */
					#ifdef LSB_FIRST
						c = Machine->memory_region[region] + (romp->offset ^ 1);
					#else
						c = Machine->memory_region[region] + romp->offset;
					#endif

						if (osd_fread_scatter(f,c,length,2) != length)
						{
							printf("Unable to read ROM %s\n",name);
						}
					}
					else if (romp->length & ROMFLAG_QUAD) {
						static int which_quad=0; /* This is multi session friendly, as we only care about the modulus */
						unsigned char *temp;
						int base=0;

						temp = (unsigned char *) malloc(length);	/* Need to load rom to temporary space */
						osd_fread(f,temp,length);

						/* Copy quad to region */
						c = Machine->memory_region[region] + romp->offset;

					#ifdef LSB_FIRST
						switch (which_quad%4) {
							case 0: base=1; break;
							case 1: base=0; break;
							case 2: base=3; break;
							case 3: base=2; break;
						}
					#else
						switch (which_quad%4) {
							case 0: base=0; break;
							case 1: base=1; break;
							case 2: base=2; break;
							case 3: base=3; break;
						}
					#endif

						for (i=base; i< length*4; i += 4)
							c[i]=temp[i/4];

						which_quad++;
						free(temp);
					}
					else
					{
						int wide = romp->length & ROMFLAG_WIDE;
					#ifdef LSB_FIRST
						int swap = (romp->length & ROMFLAG_SWAP) ^ ROMFLAG_SWAP;
					#else
						int swap = romp->length & ROMFLAG_SWAP;
					#endif

						osd_fread(f,Machine->memory_region[region] + romp->offset,length);

						/* apply swappage */
						c = Machine->memory_region[region] + romp->offset;
						if (wide && swap)
						{
							for (i = 0; i < length; i += 2)
							{
								int temp = c[i];
								c[i] = c[i+1];
								c[i+1] = temp;
							}
						}
					}

					romp++;
				} while (romp->length && (romp->name == 0 || romp->name == (char *)-1));

				if (explength != osd_fsize (f))
				{
					sprintf (&buf[strlen(buf)], "%-12s WRONG LENGTH (expected: %08x found: %08x)\n",
							name,explength,osd_fsize(f));
					warning = 1;
				}

				if (expchecksum != osd_fcrc (f))
				{
					warning = 1;
					if (expchecksum == 0)
						sprintf(&buf[strlen(buf)],"%-12s NO GOOD DUMP KNOWN\n",name);
					else if (expchecksum == BADCRC(osd_fcrc(f)))
						sprintf(&buf[strlen(buf)],"%-12s ROM NEEDS REDUMP\n",name);
					else
						sprintf(&buf[strlen(buf)], "%-12s WRONG CRC (expected: %08x found: %08x)\n",
								name,expchecksum,osd_fcrc(f));
				}

				osd_fclose(f);
			}
			else if (romp->length & ROMFLAG_OPTIONAL)
			{
				sprintf (&buf[strlen(buf)], "OPTIONAL %-12s NOT FOUND\n",name);
				romp ++;
			}
			else
			{
				/* allow for a NO GOOD DUMP KNOWN rom to be missing */
				if (expchecksum == 0)
				{
					sprintf (&buf[strlen(buf)], "%-12s NOT FOUND (NO GOOD DUMP KNOWN)\n",name);
					warning = 1;
				}
				else
				{
					sprintf (&buf[strlen(buf)], "%-12s NOT FOUND\n",name);
					fatalerror = 1;
				}

				do
				{
					if (fatalerror == 0)
					{
						int i;

						/* fill space with random data */
						if (romp->length & ROMFLAG_ALTERNATE)
						{
							unsigned char *c;

							/* ROM_LOAD_EVEN and ROM_LOAD_ODD */
						#ifdef LSB_FIRST
							c = Machine->memory_region[region] + (romp->offset ^ 1);
						#else
							c = Machine->memory_region[region] + romp->offset;
						#endif

							for (i = 0;i < (romp->length & ~ROMFLAG_MASK);i++)
								c[2*i] = rand();
						}
						else
						{
							for (i = 0;i < (romp->length & ~ROMFLAG_MASK);i++)
								Machine->memory_region[region][romp->offset + i] = rand();
						}
					}
					romp++;
				} while (romp->length && (romp->name == 0 || romp->name == (char *)-1));
			}
		}

		region++;
	}

	/* final status display */
	osd_display_loading_rom_message(0,current_rom,total_roms);

	if (warning || fatalerror)
	{
		extern int bailing;

		if (fatalerror)
		{
			strcat (buf, "ERROR: required files are missing, the game cannot be run.\n");
			bailing = 1;
		}
		else
			strcat (buf, "WARNING: the game might not run correctly.\n");
		printf ("%s", buf);

		if (!options.gui_host && !bailing)
		{
			printf ("Press any key to continue\n");
			keyboard_read_sync();
			if (keyboard_pressed(KEYCODE_LCONTROL) && keyboard_pressed(KEYCODE_C))
				return 1;
		}
	}

	if (fatalerror) return 1;
	else return 0;


getout:
	/* final status display */
	osd_display_loading_rom_message(0,current_rom,total_roms);

	for (region = 0;region < MAX_MEMORY_REGIONS;region++)
	{
		free(Machine->memory_region[region]);
		Machine->memory_region[region] = 0;
	}

	return 1;
}
Exemple #11
0
static void debug(void)
{
	int new_show_colors;
	
	new_show_colors = (keyboard_pressed(KEYCODE_LSHIFT)) ? 1 : keyboard_pressed(KEYCODE_RSHIFT) ? 2 : 0;
	if (new_show_colors != show_colors)
	{
		show_colors = new_show_colors;
		memset(atarigen_pf_dirty, 0xff, atarigen_playfieldram_size / 2);
		memset(atarigen_pf2_dirty, 0xff, atarigen_playfieldram_size / 2);
	}

	special_pen = -1;
	if (keyboard_pressed(KEYCODE_Q)) special_pen = 0;
	if (keyboard_pressed(KEYCODE_W)) special_pen = 1;
	if (keyboard_pressed(KEYCODE_E)) special_pen = 2;
	if (keyboard_pressed(KEYCODE_R)) special_pen = 3;
	if (keyboard_pressed(KEYCODE_T)) special_pen = 4;
	if (keyboard_pressed(KEYCODE_Y)) special_pen = 5;
	if (keyboard_pressed(KEYCODE_U)) special_pen = 6;
	if (keyboard_pressed(KEYCODE_I)) special_pen = 7;

	if (keyboard_pressed(KEYCODE_A)) special_pen = 8;
	if (keyboard_pressed(KEYCODE_S)) special_pen = 9;
	if (keyboard_pressed(KEYCODE_D)) special_pen = 10;
	if (keyboard_pressed(KEYCODE_F)) special_pen = 11;
	if (keyboard_pressed(KEYCODE_G)) special_pen = 12;
	if (keyboard_pressed(KEYCODE_H)) special_pen = 13;
	if (keyboard_pressed(KEYCODE_J)) special_pen = 14;
	if (keyboard_pressed(KEYCODE_K)) special_pen = 15;
	
	if (keyboard_pressed(KEYCODE_9))
	{
		static int count;
		char name[50];
		FILE *f;
		int i;

		while (keyboard_pressed(KEYCODE_9)) { }

		sprintf(name, "Dump %d", ++count);
		f = fopen(name, "wt");

		fprintf(f, "\n\nAlpha Palette:\n");
		for (i = 0x000; i < 0x100; i++)
		{
			fprintf(f, "%04X ", READ_WORD(&paletteram[i*2]));
			if ((i & 15) == 15) fprintf(f, "\n");
		}

		fprintf(f, "\n\nMotion Object Palette:\n");
		for (i = 0x100; i < 0x200; i++)
		{
			fprintf(f, "%04X ", READ_WORD(&paletteram[i*2]));
			if ((i & 15) == 15) fprintf(f, "\n");
		}

		fprintf(f, "\n\nPlayfield Palette:\n");
		for (i = 0x200; i < 0x400; i++)
		{
			fprintf(f, "%04X ", READ_WORD(&paletteram[i*2]));
			if ((i & 15) == 15) fprintf(f, "\n");
		}

		fprintf(f, "\n\nMotion Object Config:\n");
		for (i = 0x00; i < 0x40; i++)
		{
			fprintf(f, "%04X ", READ_WORD(&atarigen_playfieldram[0xf00 + i*2]));
			if ((i & 15) == 15) fprintf(f, "\n");
		}

		fprintf(f, "\n\nMotion Object SLIPs:\n");
		for (i = 0x00; i < 0x40; i++)
		{
			fprintf(f, "%04X ", READ_WORD(&atarigen_playfieldram[0xf80 + i*2]));
			if ((i & 15) == 15) fprintf(f, "\n");
		}

		fprintf(f, "\n\nMotion Objects\n");
		for (i = 0; i < 0x400; i++)
		{
			UINT16 *data = (UINT16 *)&atarigen_spriteram[i*8];
			int code = data[1] & 0x7fff;
			int hsize = ((data[3] >> 4) & 7) + 1;
			int vsize = (data[3] & 7) + 1;
			int xpos = (data[2] >> 7);
			int ypos = (data[3] >> 7) - vsize * 8;
			int color = data[2] & 15;
			int hflip = data[3] & 0x0008;
			fprintf(f, "   Object %03X: L=%03X P=%04X C=%X X=%03X Y=%03X W=%d H=%d F=%d LEFT=(%04X %04X %04X %04X)\n",
					i, data[0] & 0x3ff, code, color, xpos & 0x1ff, ypos & 0x1ff, hsize, vsize, hflip,
					data[0] & 0xfc00, data[1] & 0x0000, data[2] & 0x0070, data[3] & 0x0000);
		}

		fprintf(f, "\n\nPlayfield 1 dump\n");
		for (i = 0; i < atarigen_playfieldram_size / 2; i++)
		{
			fprintf(f, "%X%04X ", READ_WORD(&atarigen_playfieldram_color[i*2]) & 0xff, READ_WORD(&atarigen_playfieldram[i*2]));
			if ((i & 63) == 63) fprintf(f, "\n");
		}

		fprintf(f, "\n\nPlayfield 2 dump\n");
		for (i = 0; i < atarigen_playfield2ram_size / 2; i++)
		{
			fprintf(f, "%X%04X ", (READ_WORD(&atarigen_playfieldram_color[i*2]) >> 8) & 0xff, READ_WORD(&atarigen_playfield2ram[i*2]));
			if ((i & 63) == 63) fprintf(f, "\n");
		}

		fprintf(f, "\n\nAlpha dump\n");
		for (i = 0; i < atarigen_alpharam_size / 2; i++)
		{
			fprintf(f, "%04X ", READ_WORD(&atarigen_alpharam[i*2]));
			if ((i & 63) == 63) fprintf(f, "\n");
		}

		fclose(f);
	}
}