Beispiel #1
0
Datei: mvs.c Projekt: AMSMM/NJEMU
static void neogeo_exit(void)
{
	SceUID fd;
	char path[MAX_PATH];

	video_set_mode(32);
	video_clear_screen();

	ui_popup_reset();

	video_clear_screen();
	msg_screen_init(WP_LOGO, ICON_SYSTEM, TEXT(EXIT_EMULATION2));

	msg_printf(TEXT(PLEASE_WAIT2));

#ifdef ADHOC
	if (!adhoc_enable)
#endif
	{
		sprintf(path, "%smemcard/%s.bin", launchDir, game_name);
		if ((fd = sceIoOpen(path, PSP_O_WRONLY|PSP_O_CREAT, 0777)) >= 0)
		{
			sceIoWrite(fd, neogeo_memcard, 0x800);
			sceIoClose(fd);
		}

		sprintf(path, "%snvram/%s.nv", launchDir, game_name);
		if ((fd = sceIoOpen(path, PSP_O_WRONLY|PSP_O_CREAT, 0777)) >= 0)
		{
			swab(neogeo_sram16, neogeo_sram16, 0x2000);
			sceIoWrite(fd, neogeo_sram16, 0x2000);
			sceIoClose(fd);
		}


#ifdef COMMAND_LIST
		free_commandlist();
#endif

		if (neogeo_save_sound_flag) option_sound_enable = 1;
		save_gamecfg(game_name);
	}

	msg_printf(TEXT(DONE2));

#ifdef ADHOC
	if (adhoc_enable) adhocTerm();
#endif

	show_exit_screen();
}
Beispiel #2
0
Datei: mvs.c Projekt: AMSMM/NJEMU
void neogeo_main(void)
{
	Loop = LOOP_RESET;

	while (Loop >= LOOP_RESTART)
	{
		Loop = LOOP_EXEC;

		ui_popup_reset();

		fatal_error = 0;

		video_clear_screen();

		if (memory_init())
		{
			if (sound_init())
			{
				if (input_init())
				{
					if (neogeo_init())
					{
						neogeo_run();
					}
					neogeo_exit();
				}
				input_shutdown();
			}
			sound_exit();
		}
		memory_shutdown();
		show_fatal_error();
	}
}
Beispiel #3
0
Datei: mvs.c Projekt: AMSMM/NJEMU
static void neogeo_run(void)
{
	while (Loop >= LOOP_RESET)
	{
		neogeo_reset();

		while (Loop == LOOP_EXEC)
		{
			if (Sleep)
			{
				cache_sleep(1);

				do
				{
					sceKernelDelayThread(5000000);
				} while (Sleep);

				cache_sleep(0);
				autoframeskip_reset();
			}

			apply_cheat();//davex
			
			timer_update_cpu();
			update_screen();
			update_inputport();
		}

		video_clear_screen();
		sound_mute(1);
	}
}
Beispiel #4
0
/*-------------------------------------------------------------------------

	Change the run mode.

	Input:	runmode The new runmode.

---------------------------------------------------------------------------*/
void neogeo_set_runmode ( Uint32 runmode )
{
	if ( ( neogeo_run_mode == NEOGEO_RUN_QUIT ) || ( runmode == neogeo_run_mode ) )
		return;

	/* Leaving trace mode: Unpause emulation */
	if ( neogeo_run_mode == NEOGEO_RUN_TRACE )
	{
		video_clear_screen();
		neogeo_resume_emulation();
	}

	/* Entering trace mode: Pause emulation */
	if ( runmode == NEOGEO_RUN_TRACE )
		neogeo_pause_emulation();

	neogeo_run_mode = runmode;
}
Beispiel #5
0
Datei: mvs.c Projekt: AMSMM/NJEMU
static void neogeo_reset(void)
{
	video_set_mode(16);

	video_clear_screen();

	timer_reset();
	input_reset();

	neogeo_driver_reset();
	neogeo_video_reset();

	sound_reset();
	blit_clear_all_sprite();
	autoframeskip_reset();

	Loop = LOOP_EXEC;
}
Beispiel #6
0
void * initializeKernelBinary() {

	load_kernel_modules();

	clearBSS(&bss, &endOfKernel - &bss);


	video_initialize();
	video_clear_screen();

	video_write_line("[x64BareBones]");

	video_write_string("  text: 0x");
	video_write_hex((uint64_t)&text);
	video_write_nl();

	video_write_string("  rodata: 0x");
	video_write_hex((uint64_t)&rodata);
	video_write_nl();

	video_write_string("  data: 0x");
	video_write_hex((uint64_t)&data);
	video_write_nl();

	video_write_string("  bss: 0x");
	video_write_hex((uint64_t)&bss);
	video_write_nl();

	video_write_line("[Done]");

	screensaver_reset_timer();

	video_write_line("Kernel cargado.");

	return getStackBase();
}
Beispiel #7
0
int main(void) {
    // Initial setup of the I/O ports.
    AD1PCFG = 0xFFFF;               // Default all pins to digital.
    mJTAGPortEnable(0);             // Turn off JTAG.

    // Setup the CPU.
    // System config performance.
    SYSTEMConfigPerformance(CLOCKFREQ);
#if defined(MAXIMITE) || (defined(UBW32) && defined(__DEBUG)) || \
    defined(DUINOMITE)
    // Fix the peripheral bus to the main clock speed.
    mOSCSetPBDIV(OSC_PB_DIV_1);
#endif

    INTEnableSystemMultiVectoredInt();  // Allow vectored interrupts.

    keyboard_init();       // Initialise and startup the keyboard routines.
    video_init();          // Start the video state machine.
    video_clear_screen();  // Clear the video buffer.

    DelayUs(1*1000*1000);
    while (keyboard_inkey() != -1);

    video_display_string("MAXIMITE console\r\n");

    while (1) {
      int ch = input_key();
      video_put_char(ch);
      {
          static char buf[10];
          sprintf(buf, "<%02X>", ch);
          video_display_string(buf);
      }
      if (ch == '\n') video_put_char('\r');
    }
}
Beispiel #8
0
Datei: mvs.c Projekt: AMSMM/NJEMU
static int neogeo_init(void)
{
	SceUID fd;
	char path[MAX_PATH];

#ifdef ADHOC
	if (!adhoc_enable)
#endif
	{
		sprintf(path, "%smemcard/%s.bin", launchDir, game_name);
		if ((fd = sceIoOpen(path, PSP_O_RDONLY, 0777)) >= 0)
		{
			sceIoRead(fd, neogeo_memcard, 0x800);
			sceIoClose(fd);
		}

		sprintf(path, "%snvram/%s.nv", launchDir, game_name);
		if ((fd = sceIoOpen(path, PSP_O_RDONLY, 0777)) >= 0)
		{
			sceIoRead(fd, neogeo_sram16, 0x2000);
			sceIoClose(fd);
			swab(neogeo_sram16, neogeo_sram16, 0x2000);
		}
	}

	neogeo_driver_init();
	neogeo_video_init();

	msg_printf(TEXT(DONE2));
	msg_screen_clear();

	video_clear_screen();

#ifdef ADHOC
	if (adhoc_enable)
	{
		sprintf(adhoc_matching, "%s_%s_%s", PBPNAME_STR, game_name, bios[neogeo_bios]);

		if (adhocInit(adhoc_matching) == 0)
		{
			if ((adhoc_server = adhocSelect()) >= 0)
			{
				video_clear_screen();

				if (adhoc_server)
				{
					option_controller = INPUT_PLAYER1;

					return adhoc_send_state(NULL);
				}
				else
				{
					option_controller = INPUT_PLAYER2;

					return adhoc_recv_state(NULL);
				}
			}
		}

		Loop = LOOP_BROWSER;
		return 0;
	}
#endif

	return 1;
}
Beispiel #9
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;
}