static int DuoInit()
{
	int nRet=0;
	unsigned char *pqs=NULL;
	Cps=1;
	Cps1Qs=1;
	slamPro=1;
	nCpsRomLen= 4*0x080000;
	nCpsCodeLen=0; // not encrypted
	nCpsGfxLen= 12*0x080000;
	nCpsZRomLen= 2*0x020000;
	nCpsQSamLen= 8*0x080000;
	nRet=CpsInit();
	if (nRet!=0)
	{
		return 1;
	}

	// Load program roms
	nRet=BurnLoadRom(CpsRom+0x000001,0,2);
	if (nRet!=0)
	{
		return 1;
	}
	nRet=BurnLoadRom(CpsRom+0x000000,1,2);
	if (nRet!=0)
	{
		return 1;
	}
	nRet=BurnLoadRom(CpsRom+0x040001,2,2);
	if (nRet!=0)
	{
		return 1;
	}
	nRet=BurnLoadRom(CpsRom+0x040000,3,2);
	if (nRet!=0)
	{
		return 1;
	}
	nRet=BurnLoadRom(CpsRom+0x080001,4,2);
	if (nRet!=0)
	{
		return 1;
	}
	nRet=BurnLoadRom(CpsRom+0x080000,5,2);
	if (nRet!=0)
	{
		return 1;
	}
	nRet=BurnLoadRom(CpsRom+0x0c0001,6,2);
	if (nRet!=0)
	{
		return 1;
	}
	nRet=BurnLoadRom(CpsRom+0x0c0000,7,2);
	if (nRet!=0)
	{
		return 1;
	}
	nRet=BurnLoadRom(CpsRom+0x100000,8,1);
	if (nRet!=0)
	{
		return 1;    // Already byteswapped
	}
	nRet=BurnLoadRom(CpsRom+0x180000,9,1);
	if (nRet!=0)
	{
		return 1;    // Already byteswapped
	}

	// Set dip switches
	SETUP_DIPSW_3(Cpi01A,Cpi01C,Cpi01E,0x00,0x00,0x00);

	// Load graphics roms
	CpsLoadTiles(CpsGfx         , 10);
	CpsLoadTiles(CpsGfx+0x200000, 14);
	CpsLoadTiles(CpsGfx+0x400000, 18);

	nCpsLcReg=0x6a; // Layer control register is at 0x6a
	CpsLayEn[1]=0x04;
	CpsLayEn[2]=0x08;
	CpsLayEn[3]=0x10;

	// Protection enable code by KEV
	CpsMProt[0]=0x00;
	CpsMProt[1]=0x00;
	CpsMProt[2]=0x00;
	CpsMProt[3]=0x00;

	// Start of Board ID improvments by KEV. 0x5e,0x0c02
	CpsBID[0]=0x5e;
	CpsBID[1]=0x0c;
	CpsBID[2]=0x02;
	//end

	MaskAddr[0]=0x6c;
	MaskAddr[1]=0x6e;
	MaskAddr[2]=0x70;
	MaskAddr[3]=0x72;

	nRet=BurnLoadRom(CpsZRom,22,1);
	slammast_decode();
	nRet=BurnLoadRom(CpsEncZRom,22,1);

	pqs=(unsigned char *)CpsQSam;
	nRet=BurnLoadRom(pqs         ,23,1);
	nRet=BurnLoadRom(pqs+0x080000,24,1);
	nRet=BurnLoadRom(pqs+0x100000,25,1);
	nRet=BurnLoadRom(pqs+0x180000,26,1);
	nRet=BurnLoadRom(pqs+0x200000,27,1);
	nRet=BurnLoadRom(pqs+0x280000,28,1);
	nRet=BurnLoadRom(pqs+0x300000,29,1);
	nRet=BurnLoadRom(pqs+0x380000,30,1);
	


	ConstructDIPSWList();

	nRet=CpsRunInit();
	if (nRet!=0)
	{
		return 1;
	}
	// Ready to go
	return 0;
}
Example #2
0
static int DrvInit()
{
  int nRet=0; unsigned char *pqs=NULL;
  Cps=1; Cps1Qs=1;
  nCpsRomLen= 4*0x080000;
  nCpsCodeLen=0; // not encrypted
  nCpsGfxLen= 12*0x080000;
  nCpsZRomLen= 2*0x020000;
  nCpsQSamLen= 8*0x080000;
  nRet=CpsInit(); if (nRet!=0) return 1;

  // Load program roms
  nRet=BurnLoadRom(CpsRom+0x000000,0,1); if (nRet!=0) return 1; // Already byteswapped
  nRet=BurnLoadRom(CpsRom+0x080001,1,2); if (nRet!=0) return 1;
  nRet=BurnLoadRom(CpsRom+0x080000,2,2); if (nRet!=0) return 1;
  nRet=BurnLoadRom(CpsRom+0x0c0001,3,2); if (nRet!=0) return 1;
  nRet=BurnLoadRom(CpsRom+0x0c0000,4,2); if (nRet!=0) return 1;
  nRet=BurnLoadRom(CpsRom+0x100000,5,1); if (nRet!=0) return 1; // Already byteswapped
  nRet=BurnLoadRom(CpsRom+0x180000,6,1); if (nRet!=0) return 1; // Already byteswapped

// Load graphics roms
  CpsLoadTiles(CpsGfx         , 7);
  CpsLoadTiles(CpsGfx+0x200000, 11);
  CpsLoadTiles(CpsGfx+0x400000, 15);

  nCpsLcReg=0x56; // Layer control register is at 0x56
  CpsLayEn[1]=0x04;
  CpsLayEn[2]=0x08;
  CpsLayEn[3]=0x10;

  // Protection enable code by KEV
  CpsMProt[0]=0x00;
  CpsMProt[1]=0x00;
  CpsMProt[2]=0x00;
  CpsMProt[3]=0x00;

  // Start of Board ID improvments by KEV. 0x6e,0x0c01
  CpsBID[0]=0x6e;
  CpsBID[1]=0x0c;
  CpsBID[2]=0x01;
  //end

  MaskAddr[0]=0x40;
  MaskAddr[1]=0x42;
  MaskAddr[2]=0x68;
  MaskAddr[3]=0x6a;

  nRet=BurnLoadRom(CpsZRom,19,1);
  slammast_decode();
  nRet=BurnLoadRom(CpsEncZRom,19,1);

  pqs=(unsigned char *)CpsQSam;
  nRet=BurnLoadRom(pqs         ,20,1);
  nRet=BurnLoadRom(pqs+0x080000,21,1);
  nRet=BurnLoadRom(pqs+0x100000,22,1);
  nRet=BurnLoadRom(pqs+0x180000,23,1);
  nRet=BurnLoadRom(pqs+0x200000,24,1);
  nRet=BurnLoadRom(pqs+0x280000,25,1);
  nRet=BurnLoadRom(pqs+0x300000,26,1);
  nRet=BurnLoadRom(pqs+0x380000,27,1);


  nRet=CpsRunInit(); if (nRet!=0) return 1;
  // Ready to go
  return 0;
}
Example #3
0
int memory_init(void)
{
	int i, res;

	memory_region_cpu1   = NULL;
	memory_region_cpu2   = NULL;
	memory_region_gfx1   = NULL;
	memory_region_sound1 = NULL;
	memory_region_user1  = NULL;
	memory_region_user2  = NULL;

	memory_length_cpu1   = 0;
	memory_length_cpu2   = 0;
	memory_length_gfx1   = 0;
	memory_length_sound1 = 0;
	memory_length_user1  = 0;
	memory_length_user2  = 0;

	pad_wait_clear();
	video_clear_screen();
	msg_screen_init(WP_LOGO, ICON_SYSTEM, TEXT(LOAD_ROM));

	msg_printf(TEXT(CHECKING_ROM_INFO));

	if ((res = load_rom_info(game_name)) != 0)
	{
		switch (res)
		{
		case 1: msg_printf(TEXT(THIS_GAME_NOT_SUPPORTED)); break;
		case 2: msg_printf(TEXT(ROM_NOT_FOUND)); break;
		case 3: msg_printf(TEXT(ROMINFO_NOT_FOUND)); break;
		}
		msg_printf(TEXT(PRESS_ANY_BUTTON2));
		pad_wait_press(PAD_WAIT_INFINITY);
		Loop = LOOP_BROWSER;
		return 0;
	}

	i = 0;
	driver = NULL;
	while (CPS1_driver[i].name)
	{
		if (!strcmp(game_name, CPS1_driver[i].name))
		{
			driver = &CPS1_driver[i];
			break;
		}
		i++;
	}
	if (!driver)
	{
		msg_printf(TEXT(DRIVER_FOR_x_NOT_FOUND), game_name);
		msg_printf(TEXT(PRESS_ANY_BUTTON2));
		pad_wait_press(PAD_WAIT_INFINITY);
		Loop = LOOP_BROWSER;
		return 0;
	}

	if (parent_name[0])
		msg_printf(TEXT(ROMSET_x_PARENT_x), game_name, parent_name);
	else
		msg_printf(TEXT(ROMSET_x), game_name);

	load_gamecfg(game_name);
#ifdef ADHOC
	if (adhoc_enable)
	{
		/* AdHoc通信時は一部オプションで固定の設定を使用 */
		cps_raster_enable    = 1;
		psp_cpuclock         = PSPCLOCK_333;
		option_vsync         = 0;
		option_autoframeskip = 0;
		option_frameskip     = 0;
		option_showfps       = 0;
		option_speedlimit    = 1;
		option_sound_enable  = 1;
		option_samplerate    = 0;
	}
	else
#endif
	{
#ifdef COMMAND_LIST
		if (parent_name[0])
			load_commandlist(game_name, parent_name);
		else
			load_commandlist(game_name, NULL);
#endif
	}

	set_cpu_clock(psp_cpuclock);

	if (load_rom_cpu1() == 0) return 0;
	if (load_rom_cpu2() == 0) return 0;
	if (load_rom_gfx1() == 0) return 0;
	if (load_rom_sound1() == 0) return 0;
	if (load_rom_user1() == 0) return 0;

	static_ram1 = (UINT8 *)cps1_ram - 0xff0000;
	static_ram2 = (UINT8 *)cps1_gfxram - 0x900000;

	qsound_sharedram1 = &memory_region_cpu2[0xc000];
	qsound_sharedram2 = &memory_region_cpu2[0xf000];

	memset(cps1_ram, 0, sizeof(cps1_ram));
	memset(cps1_gfxram, 0, sizeof(cps1_gfxram));
	memset(cps1_output, 0, sizeof(cps1_output));

	if (machine_driver_type == MACHINE_qsound)
	{
		machine_sound_type = SOUND_QSOUND;
		z80_read_memory_8 = cps1_qsound_readmem;
		z80_write_memory_8 = cps1_qsound_writemem;
		memory_length_user2 = 0x8000;

		if ((memory_region_user2 = (UINT8 *)memalign(MEM_ALIGN, 0x8000)) == NULL)
		{
			fatalerror(TEXT(COULD_NOT_ALLOCATE_MEMORY_0x8000BYTE));
			return 0;
		}
		memset(memory_region_user2, 0, 0x8000);
	}
	else if (machine_driver_type == MACHINE_wofhfh)
	{
		machine_sound_type = SOUND_YM2151_CPS1;
		z80_read_memory_8 = cps1_sound_readmem;
		z80_write_memory_8 = cps1_sound_writemem;

		memory_region_user2 = memory_region_cpu2;
	}
	else
	{
		machine_sound_type = SOUND_YM2151_CPS1;
#if !RELEASE
		if (machine_init_type == INIT_kodb)
		{
			z80_read_memory_8 = cps1_kodb_readmem;
			z80_write_memory_8 = cps1_kodb_writemem;
		}
		else
#endif
		{
			z80_read_memory_8 = cps1_sound_readmem;
			z80_write_memory_8 = cps1_sound_writemem;
		}
		memory_region_user2 = memory_region_cpu2;
	}

	switch (machine_init_type)
	{
	case INIT_wof:      wof_decode();      break;
	case INIT_dino:     dino_decode();     break;
	case INIT_punisher: punisher_decode(); break;
	case INIT_slammast: slammast_decode(); break;
	case INIT_pang3:    pang3_decode();    break;
#if !RELEASE
	case INIT_kodb:     kodb_init();       break;
	case INIT_sf2m13:   sf2m13_init();     break;
	case INIT_wofh:     wofh_init();       break;
	case INIT_wof3js:   wof3js_init();     break;
	case INIT_wof3sj:   wof3sj_init();     break;
	case INIT_wofsjb:   wofsjb_init();     break;
	case INIT_dinoh:    dino_decode();     break;
	case INIT_dinob:    dinob_init();      break;
	case INIT_dinohunt: dinohunt_init();   break;
	case INIT_sf2m3:    sf2m3_init();      break;
	case INIT_wofb:     wofb_init();       break;
	case INIT_wofch3p:  wofch3p_init();    break;
#endif
	}

	return 1;
}