Exemple #1
0
jint
Java_org_yabause_android_YabauseRunnable_init( JNIEnv* env, jobject obj, jobject yab )
{
    yabauseinit_struct yinit;
    int res;
    void * padbits;
    
    if( initEGLFunc() == -1 ) return -1;

    yabause = (*env)->NewGlobalRef(env, yab);

    memset(&yinit, 0, sizeof(yabauseinit_struct));

    yinit.m68kcoretype = M68KCORE_C68K;
    yinit.percoretype = PERCORE_DUMMY;
#ifdef SH2_DYNAREC
    yinit.sh2coretype = 2;
#else
    yinit.sh2coretype = SH2CORE_DEFAULT;
#endif
    yinit.vidcoretype = VIDCORE_SOFT;
#ifdef HAVE_OPENSL
    yinit.sndcoretype = SNDCORE_OPENSL;
#else
    yinit.sndcoretype = SNDCORE_AUDIOTRACK;
#endif
    yinit.cdcoretype = CDCORE_ISO;
    yinit.carttype = GetCartridgeType();
    yinit.regionid = 0;
    yinit.biospath = GetBiosPath();
    yinit.cdpath = GetGamePath();
    yinit.buppath = GetMemoryPath();
    yinit.mpegpath = mpegpath;
    yinit.cartpath = GetCartridgePath();
    yinit.videoformattype = VIDEOFORMATTYPE_NTSC;
    yinit.frameskip = 0;
    yinit.skip_load = 0;

    res = YabauseInit(&yinit);

    OSDChangeCore(OSDCORE_SOFT);

    PerPortReset();
    padbits = PerPadAdd(&PORTDATA1);
    PerSetKey(PERPAD_UP, PERPAD_UP, padbits);
    PerSetKey(PERPAD_RIGHT, PERPAD_RIGHT, padbits);
    PerSetKey(PERPAD_DOWN, PERPAD_DOWN, padbits);
    PerSetKey(PERPAD_LEFT, PERPAD_LEFT, padbits);
    PerSetKey(PERPAD_START, PERPAD_START, padbits);
    PerSetKey(PERPAD_A, PERPAD_A, padbits);
    PerSetKey(PERPAD_B, PERPAD_B, padbits);
    PerSetKey(PERPAD_C, PERPAD_C, padbits);
    PerSetKey(PERPAD_X, PERPAD_X, padbits);
    PerSetKey(PERPAD_Y, PERPAD_Y, padbits);
    PerSetKey(PERPAD_Z, PERPAD_Z, padbits);

    ScspSetFrameAccurate(1);

    return res;
}
Exemple #2
0
extern "C" __declspec(dllexport) int libyabause_init
(
	CDInterface *_CD,
	const char *biosfn,
	int usegl,
	int carttype,
	int quickload,
	int clocksync,
	int clockbase
)
{
	usinggl = usegl;

	if (usegl)
	{
		//headless cores should not create GL contexts, but use the one from the invoking frontend 
		#ifndef HEADLESS
		if(!StartGLContext())
			return 0;
		#endif
		if(!LoadExtensions())
			return 0;
	}

	FECD.DeInit = _CD->DeInit;
	FECD.GetStatus = _CD->GetStatus;
	FECD.Init = _CD->Init;
	FECD.ReadAheadFAD = _CD->ReadAheadFAD;
	FECD.ReadSectorFAD = _CD->ReadSectorFAD;
	FECD.ReadTOC = _CD->ReadTOC;

	// only overwrite a few SNDDummy functions
	memcpy(&FESND, &SNDDummy, sizeof(FESND));
	FESND.id = 2;
	FESND.Name = "FESND";
	FESND.GetAudioSpace = FESNDGetAudioSpace;
	FESND.UpdateAudio = FESNDUpdateAudio;

	yabauseinit_struct yinit;
	memset(&yinit, 0, sizeof(yabauseinit_struct));
	yinit.percoretype = PERCORE_DUMMY;
	yinit.sh2coretype = SH2CORE_INTERPRETER;
	if (usegl)
		yinit.vidcoretype = VIDCORE_OGL;
	else
		yinit.vidcoretype = VIDCORE_SOFT;	
	yinit.sndcoretype = 2; //SNDCORE_DUMMY;
	yinit.cdcoretype = 2; // CDCORE_ISO; //CDCORE_DUMMY;
	yinit.m68kcoretype = M68KCORE_C68K;
	yinit.cartpath = CART_NONE;
	yinit.regionid = REGION_AUTODETECT;
	yinit.biospath = biosfn;
	yinit.cdpath = "Saturnus"; //NULL;
	yinit.buppath = NULL;
	yinit.mpegpath = NULL;
	yinit.carttype = carttype;
	yinit.netlinksetting = NULL;
	yinit.videoformattype = VIDEOFORMATTYPE_NTSC;
	yabsys.usequickload = quickload;
	yinit.usethreads = 0;
	yinit.frameskip = 0;
	yinit.clocksync = clocksync;
	yinit.basetime = clockbase; // same format as return from time(); 0 to use time()

	if (usegl && !vdp2hookfcn)
	{
		// hook vdp2setresolution
		vdp2hookfcn = VIDOGL.Vdp2SetResolution;
		VIDOGL.Vdp2SetResolution = vdp2newhook;
	}

	if (YabauseInit(&yinit) != 0)
		return 0;
	
	SpeedThrottleDisable();
	DisableAutoFrameSkip();
	ScspSetFrameAccurate(1);

	OSDChangeCore(OSDCORE_DUMMY);

	ctrl1 = PerPadAdd(&PORTDATA1);
	ctrl2 = PerPadAdd(&PORTDATA2);

	return 1;
}