예제 #1
0
//Init mainly means allocate
//Reset is called before first run
//Init is called olny once
//When Init is called , cpu interface and all plugins configurations myst be finished
//Plugins/Cpu core must not change after this call is made.
bool Init_DC()
{
	if (dc_inited)
		return true;

	if(settings.dynarec.Enable)
	{
		sh4_cpu=Get_Sh4Recompiler();
		log("Using Recompiler\n");
	}
	else
	{
		sh4_cpu=Get_Sh4Interpreter();
		log("Using Interpreter\n");
	}
	
	if (!plugins_Load())
		return false;

    if (!plugins_Init())
    { 
        //log("Emulation thread : Plugin init failed\n"); 	
        plugins_Term();
        return false;
    }
    
    sh4_cpu->Init();


    mem_Init();
    pvr_Init();
    aica_Init();
    mem_map_defualt();


	dc_inited=true;
	return true;
}
예제 #2
0
void SwitchCpu()
{
	if((settings.dynarec.Enable==0 && sh4_cpu->ResetCache==0) ||
	   (settings.dynarec.Enable!=0 && sh4_cpu->ResetCache!=0)  )
	{
		return;//nothing to do ...
	}
	
	bool bStart=false;

	if (sh4_cpu)
	{
		if (sh4_cpu->IsCpuRunning())
		{
			bStart=true;
			Stop_DC();
		}
		sh4_cpu->Term();
	}
	if(settings.dynarec.Enable)
	{
		sh4_cpu=Get_Sh4Recompiler();
		log("Switched to Recompiler\n");
	}
	else
	{
		sh4_cpu=Get_Sh4Interpreter();
		log("Switched to Interpreter\n");
	}

	sh4_cpu->Init();
	

	if (bStart)
		Start_DC();
}
예제 #3
0
int dc_init(int argc,wchar* argv[])
{
	setbuf(stdin,0);
	setbuf(stdout,0);
	setbuf(stderr,0);
	if (!_vmem_reserve())
	{
		printf("Failed to alloc mem\n");
		return -1;
	}

#if !defined(TARGET_NO_WEBUI)
	webui_thd.Start();
#endif

	if(ParseCommandLine(argc,argv))
	{
		return 69;
	}
	if(!cfgOpen())
	{
		msgboxf("Unable to open config file",MBX_ICONERROR);
		return -4;
	}
	LoadSettings();
#ifndef _ANDROID
	os_CreateWindow();
#endif

	int rv= 0;

#if HOST_OS != OS_DARWIN
    #define DATA_PATH "/data/"
#else
    #define DATA_PATH "/"
#endif
    
	if (settings.bios.UseReios || !LoadRomFiles(GetPath(DATA_PATH)))
	{
		if (!LoadHle(GetPath(DATA_PATH)))
			return -3;
		else
			printf("Did not load bios, using reios\n");
	}

#if FEAT_SHREC != DYNAREC_NONE
	if(settings.dynarec.Enable)
	{
		Get_Sh4Recompiler(&sh4_cpu);
		printf("Using Recompiler\n");
	}
	else
#endif
	{
		Get_Sh4Interpreter(&sh4_cpu);
		printf("Using Interpreter\n");
	}
	
  InitAudio();

	sh4_cpu.Init();
	mem_Init();

	plugins_Init();
	
	mem_map_default();

#ifndef _ANDROID
	mcfg_CreateDevices();
#else
    mcfg_CreateDevices();
#endif

	plugins_Reset(false);
	mem_Reset(false);
	

	sh4_cpu.Reset(false);
	
	return rv;
}
예제 #4
0
int dc_init(int argc,wchar* argv[])
{
	setbuf(stdin,0);
	setbuf(stdout,0);
	setbuf(stderr,0);
	if (!_vmem_reserve())
	{
		printf("Failed to alloc mem\n");
		return -1;
	}

	if(ParseCommandLine(argc,argv))
	{
		return 69;
	}

	if(!cfgOpen())
	{
		msgboxf("Unable to open config file",MBX_ICONERROR);
		return -4;
	}
	LoadSettings();

#ifndef _ANDROID
	os_CreateWindow();
#endif

	int rv= 0;


	if (!LoadRomFiles(GetPath("/data/")))
	{
		return -3;
	}

#if !defined(HOST_NO_REC)
	if(settings.dynarec.Enable)
	{
		Get_Sh4Recompiler(&sh4_cpu);
		printf("Using Recompiler\n");
	}
	else
#endif
	{
		Get_Sh4Interpreter(&sh4_cpu);
		printf("Using Interpreter\n");
	}
	
	  void InitAudio();
  InitAudio();

	sh4_cpu.Init();
	mem_Init();

	plugins_Init();
	
	mem_map_default();

	mcfg_CreateDevices();

	plugins_Reset(false);
	mem_Reset(false);
	

	sh4_cpu.Reset(false);
	
	return rv;
}