コード例 #1
0
void cTrackManiaHack::NoRestrictions(void)
{
	static CCodeChange NoRes;
	static CCodeChange NoPw;
	BYTE FIX[] = {0xE9, 0x8C, 0x01, 0x00, 0x00, 0x90};
	BYTE FIX2[] = {0xE9, 0x10, 0x02, 0x00, 0x00, 0x90};
	NoRes.Initialize(this, GetAddress("NoRestrictions"), FIX, 6);
	NoPw.Initialize(this, GetAddress("NoTrackPassword"), FIX2, 6);

	if (!NoRes.IsEnabled())
	{
		int iOffset = 0x18C; BYTE *pOffset = (BYTE*)&iOffset;
		ReadAddress(GetAddress("NoRestrictions")+2, &iOffset, 4); iOffset++;
		for (int i = 0; i < 4; i++) FIX[i+1] = pOffset[i]; NoRes.SetNewCode(FIX);

		int iOffset2 = 0x210; BYTE *pOffset2 = (BYTE*)&iOffset2;
		ReadAddress(GetAddress("NoTrackPassword")+2, &iOffset2, 4); iOffset2++;
		for (int i = 0; i < 4; i++) FIX2[i+1] = pOffset2[i]; NoPw.SetNewCode(FIX2);

		NoRes.Enable();
		NoPw.Enable();
		SoundUpdate(SOUND_ON);
	}
	else
	{
		NoRes.Disable();
		NoPw.Disable();
		SoundUpdate(SOUND_OFF);
	}
}
コード例 #2
0
ファイル: TM2Hack.cpp プロジェクト: copymark/TM-Trainer
void CTM2Hack::UnlockTracks(void)
{
	static CNop VisualFix;
	VisualFix.Initialize(this, GetAddress("TUVis"), 2);

	static CNop RankingFix;
	RankingFix.Initialize(this, GetAddress("TURanking"), 6);

	static CNop RealFix;
	RealFix.Initialize(this, GetAddress("TUStart"), 2);

	if (!VisualFix.IsEnabled())
	{
		VisualFix.Enable();
		RankingFix.Enable();
		RealFix.Enable();
		SoundUpdate(SOUND_ON);
	}
	else
	{
		VisualFix.Disable();
		RankingFix.Disable();
		RealFix.Disable();
		SoundUpdate(SOUND_OFF);
	}
}
コード例 #3
0
void cTrackManiaHack::MeterHack(void)
{
	static CNop MeterChangeFix;
	static CNop MeterChangeFix2;
	MeterChangeFix.Initialize(this, GetAddress("MeterHack1"), 6);
	MeterChangeFix2.Initialize(this, GetAddress("MeterHack2"), 6);
	if (!MeterChangeFix.IsEnabled())
	{
		/*
		Anschalten
		*/
		MeterChangeFix.Enable(); MeterChangeFix2.Enable();
		int iMeter = 99999999;
		DWORD dwOffsets[] = {0x454, 0x268};
		DWORD dwAddress = ReadPointer(GetAddress("BaseP1"), dwOffsets, sizeof(dwOffsets));
		WriteAddress(dwAddress, &iMeter, sizeof(iMeter));
		SoundUpdate(SOUND_ON);
	}
	else
	{
		/*
		Ausschalten - Daten wiederherstellen
		*/
		MeterChangeFix.Disable(); MeterChangeFix2.Disable();
		SoundUpdate(SOUND_OFF);
	}
}
コード例 #4
0
ファイル: TM2Hack.cpp プロジェクト: copymark/TM-Trainer
void CTM2Hack::NoGrasDrive(void)
{
	BYTE INJECT[] = {
		0x66, 0x8B, 0x47, 0x0C,				// mov ax, [edi+0c] -- eigentlicher wert in cx
		0x66, 0x3D, GROUND_ID::GRAS, 0x00,	// cmp ax, 0002 -- ist spieler auf gras?
		0x0F, 0x84, 0x0A, 0x00, 0x00, 0x00, // je #fix# -- wenn ja -> fix it
		0x66, 0x3D, GROUND_ID::DIRT, 0x00,	// cmp ax, 0006 -- ist spieler auf dirt?
		0x0F, 0x85, 0x04, 0x00, 0x00, 0x00,	// jne #orig# -- wenn nein dann nichts ändern ansonsten eine zeile weiter
		0x66, 0xB8, GROUND_ID::STREET, 0x00,// mov ax, 0010 -- FIX: 10 = straße
		0x66, 0x89, 0x46, 0x78,				// mov [esi+78], ax -- fertigen wert in var schreiben
		0xE9, 0x00, 0x00, 0x00, 0x00,		// jmp #back#
	};

	static CCodeInjection NoGrasDirtInject;
	NoGrasDirtInject.Initialize(this, GetAddress("NoGrasDirt"), INJECT, sizeof(INJECT), 8);
	if (!NoGrasDirtInject.IsEnabled())
	{
		NoGrasDirtInject.Enable();
		SoundUpdate(SOUND_ON);
	}
	else
	{
		NoGrasDirtInject.Disable();
		SoundUpdate(SOUND_OFF);
	}
}
コード例 #5
0
void cTrackManiaHack::CheckpointHack(void)
{
	static CCodeChange CPFix1;
	static CNop CPFix2;

	BYTE FIX1[] = {0xE9, 0x3A, 0x01, 0x00, 0x00, 0x90};

	CPFix1.Initialize(this, GetAddress("CheckpointFix1"), FIX1, 6);
	CPFix2.Initialize(this, GetAddress("CheckpointFix2"), 11);

	if (!CPFix1.IsEnabled())
	{
		/*
		Anschalten
		*/
		int iOffset = 0x13A; BYTE *pOffset = (BYTE*)&iOffset;
		ReadAddress(GetAddress("CheckpointFix1")+2, &iOffset, 4); iOffset++;
		for (int i = 0; i < 4; i++) FIX1[i+1] = pOffset[i]; CPFix1.SetNewCode(FIX1);
		CPFix1.Enable();
		CPFix2.Enable();
		SoundUpdate(SOUND_ON);
	}
	else
	{
		/*
		Ausschalten - Daten wiederherstellen
		*/
		CPFix1.Disable();
		CPFix2.Disable();
		SoundUpdate(SOUND_OFF);
	}
}
コード例 #6
0
void cTrackManiaHack::SwitchNoGravity(void)
{
	m_bNoGravityEnabled = !m_bNoGravityEnabled;
	if (m_bNoGravityEnabled)
		SoundUpdate(SOUND_ON);
	else
		SoundUpdate(SOUND_OFF);
}
コード例 #7
0
ファイル: TM2Hack.cpp プロジェクト: copymark/TM-Trainer
void CTM2Hack::SwitchNoGravityStatus(void)
{
	m_bNoGravityEnabled = !m_bNoGravityEnabled;
	if (m_bNoGravityEnabled)
		SoundUpdate(SOUND_ON);
	else
		SoundUpdate(SOUND_OFF);
}
コード例 #8
0
ファイル: TM2Hack.cpp プロジェクト: copymark/TM-Trainer
void CTM2Hack::NoFreeDrive(void)
{
	static CNop Fix;
	Fix.Initialize(this, GetAddress("NoFreeDrive"), 10);

	if (!Fix.IsEnabled())
	{
		Fix.Enable();
		SoundUpdate(SOUND_ON);
	}
	else
	{
		Fix.Disable();
		SoundUpdate(SOUND_OFF);
	}
}
コード例 #9
0
ファイル: TM2Hack.cpp プロジェクト: copymark/TM-Trainer
void CTM2Hack::NoPlatformCounterIncrease(void)
{
	static CNop Fix;
	Fix.Initialize(this, GetAddress("NoPlatCount"), 1);

	if (!Fix.IsEnabled())
	{
		Fix.Enable();
		SoundUpdate(SOUND_ON);
	}
	else
	{
		Fix.Disable();
		SoundUpdate(SOUND_OFF);
	}
}
コード例 #10
0
ファイル: TM2Hack.cpp プロジェクト: copymark/TM-Trainer
void CTM2Hack::UnlockNadeos(void)
{
	static CCodeChange Fix;
	BYTE FIX1[] = {0xEB};
	Fix.Initialize(this, GetAddress("NadeoUnlock"), FIX1, sizeof(FIX1));

	if (!Fix.IsEnabled())
	{
		Fix.Enable();
		SoundUpdate(SOUND_ON);
	}
	else
	{
		Fix.Disable();
		SoundUpdate(SOUND_OFF);
	}
}
コード例 #11
0
ファイル: TM2Hack.cpp プロジェクト: copymark/TM-Trainer
void CTM2Hack::NoGravity(bool playSound)
{
	static CNop Fix;
	Fix.Initialize(this, GetAddress("NoGravity"), 5);

	if (!Fix.IsEnabled())
	{
		Fix.Enable();
		if (playSound)
			SoundUpdate(SOUND_ON);
	}
	else
	{
		Fix.Disable();
		if (playSound)
			SoundUpdate(SOUND_OFF);
	}
}
コード例 #12
0
ファイル: FORM.C プロジェクト: LesInk/Test
T_void FormGenericControlUpdate(T_void)
{
    DebugRoutine("FormGenericControlUpdate");

    GraphicUpdateAllGraphics();
    MouseUpdateEvents();
    KeyboardUpdateEvents();
    SoundUpdate();

    DebugEnd();
}
コード例 #13
0
void cTrackManiaHack::DisableTriesCounter(void)
{
	static CNop TCFix;
	TCFix.Initialize(this, GetAddress("PlatformTriesCounter"), 7);
	if (!TCFix.IsEnabled())
	{
		/*
		Anschalten
		*/
		TCFix.Enable();
		SoundUpdate(SOUND_ON);
	}
	else
	{
		/*
		Ausschalten - Daten wiederherstellen
		*/
		TCFix.Disable();
		SoundUpdate(SOUND_OFF);
	}
}
コード例 #14
0
ファイル: TM2Hack.cpp プロジェクト: copymark/TM-Trainer
void CTM2Hack::SpeedHandlingHack(float newValue)
{
	unsigned __int32 standartValue = 0x40666666; // 3.599999905;
	DWORD dwOld;
	DWORD shhack_address = GetAddress("SHHack");
	VirtualProtectEx(this->m_hGameHandle, (LPVOID)shhack_address, 4, PAGE_EXECUTE_READWRITE, &dwOld);
	static bool bEnabled = false;
	if (!bEnabled)
	{
		WriteAddress(shhack_address, &newValue, sizeof(newValue));
		SoundUpdate(SOUND_ON);
	}
	else
	{
		WriteAddress(shhack_address, &standartValue, sizeof(standartValue));
		SoundUpdate(SOUND_OFF);
	}
	bEnabled = !bEnabled;
	DWORD temp;
	VirtualProtectEx(this->m_hGameHandle, (LPVOID)shhack_address, 4, dwOld, &temp);
}
コード例 #15
0
void cTrackManiaHack::UnlockAllTracks(void)
{
	static CNop VisualUnlock;
	static CNop TrackUnlock;

	VisualUnlock.Initialize(this, GetAddress("UnlockTrackPictures"), 2);
	TrackUnlock.Initialize(this, GetAddress("UnlockAllTracks"), 2);

	if (!TrackUnlock.IsEnabled())
	{
		VisualUnlock.Enable();
		TrackUnlock.Enable();
		SoundUpdate(SOUND_ON);
	}
	else 
	{
		VisualUnlock.Disable();
		TrackUnlock.Disable();
		SoundUpdate(SOUND_OFF);
	}
}
コード例 #16
0
void cTrackManiaHack::DisableWallFriction(void)
{
	static CNop WFFix;
	WFFix.Initialize(this, GetAddress("DisableWallFriction"), 6);
	if (!WFFix.IsEnabled())
	{
		/*
		Anschalten
		*/
		WFFix.Enable();
		SoundUpdate(SOUND_ON);
	}
	else
	{
		/*
		Ausschalten - Daten wiederherstellen
		*/
		WFFix.Disable();
		SoundUpdate(SOUND_OFF);
	}
}
コード例 #17
0
void cTrackManiaHack::DisableFreeDrive(void)
{
	static CNop FDFix;
	FDFix.Initialize(this, GetAddress("DisableFreeDrive"), 10);
	if (!FDFix.IsEnabled())
	{
		/*
		Anschalten
		*/
		FDFix.Enable();
		SoundUpdate(SOUND_ON);
	}
	else
	{
		/*
		Ausschalten - Daten wiederherstellen
		*/
		FDFix.Disable();
		SoundUpdate(SOUND_OFF);
	}
}
コード例 #18
0
void cTrackManiaHack::EnableNadeoGhosts(void)
{
	static CCodeChange Fix1;
	BYTE newCode[] = {0xEB};
	Fix1.Initialize(this, GetAddress("NadeoGhosts"), newCode, 1);
	if (!Fix1.IsEnabled())
	{
		/*
		Enable
		*/
		Fix1.Enable();
		SoundUpdate(SOUND_ON);
	}
	else
	{
		/*
		Disable
		*/
		Fix1.Disable();
		SoundUpdate(SOUND_OFF);
	}
}
コード例 #19
0
ファイル: TM2Hack.cpp プロジェクト: copymark/TM-Trainer
void CTM2Hack::MeterHack(void)
{
	static CCodeInjection Fix;

	BYTE newcode[] = {
		0xC7, 0x83, 0x14, 0x03, 0x00, 0x00, 0xFF, 0xE0, 0xF5, 0x05, //mov [ebx+314], 05F5E0FF
		0xE9, 0x00, 0x00, 0x00, 0x00 // jmp (back)
	};

	Fix.Initialize(this, GetAddress("MeterHack"), newcode, sizeof(newcode), 6);
						

	if (!Fix.IsEnabled())
	{
		Fix.Enable();
		SoundUpdate(SOUND_ON);
	}
	else
	{
		Fix.Disable();
		SoundUpdate(SOUND_OFF);
	}
}
コード例 #20
0
void cTrackManiaHack::BoostHack(void)
{
	BYTE INJECTCODE[] = {	0x81, 0x64, 0x24, 0x20, 0xFF, 0xFF, 0xFF, 0x7F,	// and [esp+*8+20],7FFFFFFF
							0xD8, 0x4C, 0x24, 0x20,							// fmul dword ptr [esp+20]
							0x8B, 0x00,										// mov eax,[eax]
							0xE9, 0x8E, 0x2D, 0x0A, 0x00};					// jmp (back)

	static CCodeInjection BoostInject;
	BoostInject.Initialize(this, GetAddress("BoostHack"), INJECTCODE, sizeof(INJECTCODE), 6);

	if (!m_bBoostEnabled)
	{
		BoostInject.Enable();
		SoundUpdate(SOUND_ON);
		m_bBoostEnabled = true;
	}
	else
	{
		BoostInject.Disable();
		SoundUpdate(SOUND_OFF);
		m_bBoostEnabled = false;
	}
}
コード例 #21
0
void cTrackManiaHack::NoGrasDrive(void)
{
	BYTE INJECT[] = {	0x66, 0x3D, 0x02, 0x00,						// cmp ax,0002
						0x74, 0x06,									// je (fix)
						0x66, 0x3D, 0x06, 0x00,						// cmp ax,0006
						0x75, 0x04,									// jne (orignal)
						0x66, 0xB8, 0x10, 0x00,						// mov ax, 10 (fix)
						0x66, 0x89, 0x86, 0x28, 0x01, 0x00, 0x00,	// mov [esi+00000128],ax (original)
						0xE9, 0x00, 0x00, 0x00, 0x00};				// jmp 009DA50C

	static CCodeInjection NoGrasDirtInject;
	NoGrasDirtInject.Initialize(this, GetAddress("NoGrasDirt"), INJECT, sizeof(INJECT), 7);
	if (!NoGrasDirtInject.IsEnabled())
	{
		NoGrasDirtInject.Enable();
		SoundUpdate(SOUND_ON);
	}
	else
	{
		NoGrasDirtInject.Disable();
		SoundUpdate(SOUND_OFF);
	}
}
コード例 #22
0
//=========================================================
//=========================================================
void CWeaponGravityGun::PrimaryAttack( void )
{
	if ( !m_active )
	{
		SendWeaponAnim( ACT_VM_PRIMARYATTACK );
		EffectCreate();
		SoundCreate();
	}
	else
	{
		EffectUpdate();
		SoundUpdate();
	}
}
コード例 #23
0
void cTrackManiaHack::TimeFreeze(int iTimeSec, int iTimeCentiSec)
{
	BYTE bInjectCode[33] =	{	0x52,									// push edx
								0x8B, 0x96, 0xAC, 0x02, 0x00, 0x00,		// mov edx, [esi+2AC]
								0x81, 0xC2, 0x0A, 0x00, 0x00, 0x00,		// add edx, A
								0x39, 0x95, 0x74, 0x02, 0x00, 0x00,		// cmp [ebp+274], edx
								0x5A,									// pop edx
								0x73, 0x06,								// jae #nächste Zeile überspringen#
								0x89, 0x8D, 0x74, 0x02, 0x00, 0x00,		// mov [ebp+274], ecx #ORIGINAL#
								0xE9, 0xFF, 0xFF, 0xFF, 0xFF			// jmp #back#
							};
	static CCodeInjection TFreezeInject;
	TFreezeInject.Initialize(this, GetAddress("TimeNormalChange"), bInjectCode, sizeof(bInjectCode), 6);
	static CNop TFCPFix;
	TFCPFix.Initialize(this, GetAddress("TimeCheckpointChange"), 6);

	if (!TFreezeInject.IsEnabled())
	{
		TFCPFix.Enable();
		TFreezeInject.Enable();

		int iTimeStop = iTimeSec * 1000 + iTimeCentiSec * 10;
		if (iTimeStop <= 0)
		{
			iTimeStop = 10;
		}
		WriteAddress(TFreezeInject.GetBaseAddress() + 9, &iTimeStop, sizeof(iTimeStop)); // Stopzeit einschreiben

		SoundUpdate(SOUND_ON);
	}
	else
	{
		TFCPFix.Disable();
		TFreezeInject.Disable();
		SoundUpdate(SOUND_OFF);
	}
}
コード例 #24
0
ファイル: TM2Hack.cpp プロジェクト: copymark/TM-Trainer
void CTM2Hack::TimeFreeze(int iTimeSec, int iTimeCentiSec)
{
	static CCodeInjection TimeChangeFix;
	BYTE bInjectCode[] = {
		0x81, 0xFA, 0xFF, 0xFF, 0xFF, 0xFF,			// cmp edx, FFFFFFFF
		0x73, 0x02,									// jae #overjump next line#
		0x89, 0x10,									// mov [eax], edx (original code)
		0x8B, 0x86, 0x20, 0x02, 0x00, 0x00,			// mov eax, [esi+220] (original code)
		0xE9, 0xC9, 0x65, 0x8D, 0xFD				// jmp #back#
	};
	TimeChangeFix.Initialize(this, GetAddress("TimeFreezeChange"), bInjectCode, sizeof(bInjectCode), 8);

	static CCodeChange FinishFix;
	BYTE JMPSHORT[] = {0xEB};
	FinishFix.Initialize(this, GetAddress("TimeFreezeFinishFix"), JMPSHORT, sizeof(JMPSHORT));

	if (!TimeChangeFix.IsEnabled())
	{
		TimeChangeFix.Enable();
		FinishFix.Enable();

		int iTimeStop = iTimeSec * 1000 + iTimeCentiSec * 10 + 10;
		if (iTimeStop <= 10)
		{
			iTimeStop = 20;
		}
		WriteAddress(TimeChangeFix.GetBaseAddress() + 2, &iTimeStop, sizeof(iTimeStop)); // Stopzeit einschreiben

		SoundUpdate(SOUND_ON);
	}
	else
	{
		TimeChangeFix.Disable();
		FinishFix.Disable();
		SoundUpdate(SOUND_OFF);
	}
}
コード例 #25
0
ファイル: TM2Hack.cpp プロジェクト: copymark/TM-Trainer
void CTM2Hack::CheckpointHack(void)
{
	static CCodeChange Fix1;
	static CCodeChange Fix2;

	BYTE FIX1[] = {0xE9, 0x19, 0x01, 0x00, 0x00, 0x90};
	Fix1.Initialize(this, GetAddress("CPFix1"), FIX1, sizeof(FIX1));

	BYTE FIX2[] = { 0xEB, 0x2E };
	Fix2.Initialize(this, GetAddress("CPFix2"), FIX2, sizeof(FIX2));

	if (!Fix1.IsEnabled())
	{
		Fix1.Enable();
		Fix2.Enable();
		SoundUpdate(SOUND_ON);
	}
	else
	{
		Fix1.Disable();
		Fix2.Disable();
		SoundUpdate(SOUND_OFF);
	}
}
コード例 #26
0
ファイル: psgfm.cpp プロジェクト: eighttails/PC6001VX
void OPN6::PreWriteReg( void )
{
	SoundUpdate( 0 );
}
コード例 #27
0
ファイル: psgfm.cpp プロジェクト: eighttails/PC6001VX
////////////////////////////////////////////////////////////////
// レジスタ変更前のストリーム更新
//
// 引数:	なし
// 返値:	なし
////////////////////////////////////////////////////////////////
void PSG6::PreWriteReg( void )
{
	SoundUpdate( 0 );
}
コード例 #28
0
ファイル: main.c プロジェクト: DavisDev/MasterBoyRebulild
int main(int argc, char *argp[]){
	// Init More Stuff...
	
	// Initialize Osl
	oslInit(3); // Based on Onelua xD
	
	// Init Crls Functions..
	sceCtrlSetSamplingCycle(0);
	sceCtrlSetSamplingMode(PSP_CTRL_MODE_ANALOG);
	
	// Init Configs Stuff.
	InitConfig();
	memcpy(menuConfigDefault, &menuConfig, sizeof(menuConfig)); //Sauvegarde pour plus tard
	
	// Init Stuff GU "Video"
	oslInitGfx(OSL_PF_8888, 1);// OSL_PF_5650 Aqui estaba esto.. Cambiado a 8888	
	oslInitConsole();
	oslStartDrawing();
	VideoGuScreenClear();// Check If really its vital
	/* Añadido
	oslIntraFontInit(INTRAFONT_CACHE_ALL | INTRAFONT_STRING_UTF8);
	OSL_FONT * oneFont = oslLoadFontFile("flash0:/font/jpn0.pgf");
	oslIntraFontSetStyle(oneFont, 0.7, RGB(255,255,255), RGBA(0,0,0,0), INTRAFONT_ALIGN_LEFT);
	oslSetFont(oneFont);
	*/
	//Main screen: in VRAM for speed
	Screen.scrBuffer = oslGetUncachedPtr(oslVramMgrAllocBlock(SCR_BUFFER_SIZE));
	Screen.pal = oslGetUncachedPtr(oslVramMgrAllocBlock(256*2));
	//Sub screen: in RAM for mem sparing
	ScreenTemp.scrBuffer = oslGetUncachedPtr(malloc(SCR_BUFFER_SIZE));
	ScreenTemp.pal = NULL;
	bitmap.data   = (unsigned char*)Screen.scrBuffer;
	/* Term of stuff gu */
	
	// Init More Vars..
	u32 nFrame, nDrawnFrames, skip=0, framerate;
	int nbRenderedFramesPerSec, nbVirtualFramesPerSec = 0, lastVCount = 0;
	int frameskip = 0;

	memset(&bitmap, 0, sizeof(bitmap_t));
	bitmap.width  = 256;
	bitmap.height = 192;
	bitmap.depth  = menuConfig.video.renderDepth;
	bitmap.pitch  = 256 * menuConfig.video.renderDepth / 8;

	menuConfig.file.filename[0] = '\0';

	sms.save = 1;

	// Display the menu to load up the ROM
	//	displayMenu();
	menuIsInGame = 0;

	//menuPlusShowMenu();
	MenuPlusAction(MA_LOADROM, "ms0:/Poke_Oro.gbc");

	//Bidouille pour détecter les choses qui ont changé
	MenuOptionsConfigure(-1);
	MenuOptionsConfigure(0);

	VideoGuScreenClear();

	//Système
	SmsInit();
	nFrame = nDrawnFrames = 0;
	menuConfig.video.turbo = menuConfig.video.pause = 0;
	nbRenderedFramesPerSec = 0;
	gblFramerate = gblVirtualFramerate = 0;
	menuUpdateRender = 0;

	//Système
	if (gblMachineType == EM_SMS)
		system_poweron();

	while(1){ // Principal Cycle
		//Pal support
		if (menuConfig.video.country == 1)
			framerate = 50;
		else
			framerate = 60;
		oslSetFramerate(framerate);

		if (menuUpdateRender)
			nDrawnFrames = 0, menuUpdateRender = 0;

		if (gblMachineType == EM_SMS)
			ControlsUpdate();
		else if (gblMachineType == EM_GBC){
			gbe_refresh();
			gbe_updatePad();
		}

		if (osl_quit)
			break;

		//Framerate
		if (menuConfig.video.cpuTime == 2){
			int vcount = osl_vblCount;
			if (!skip)
				nbRenderedFramesPerSec++;
			nbVirtualFramesPerSec++;
			if (vcount / framerate > lastVCount / framerate)			{
				gblFramerate = nbRenderedFramesPerSec;
				gblVirtualFramerate = nbVirtualFramesPerSec;
				nbRenderedFramesPerSec = 0;
				nbVirtualFramesPerSec = 0;
			}
			lastVCount = vcount;
		}

		if (!menuConfig.video.pause){
			if (gblMachineType == EM_SMS){
				system_frame(skip);
				if (menuConfig.sound.turboSound /*== 2*/ || !menuConfig.video.turbo){
					//On peut commencer à jouer le son: tout est initialisé (sinon il faut attendre)
					soundPause = 0;
					if (!menuConfig.sound.perfectSynchro){
						SoundUpdate();
					}
				}
			}
			else if (gblMachineType == EM_GBC){
				//Run one GB frame
				gb_doFrame(skip);
				soundPause = 0;
				if (menuConfig.sound.turboSound /*== 2*/ || !menuConfig.video.turbo)		{
					soundPause = 0;
					if (!menuConfig.sound.perfectSynchro)			{
						snd_render_orig(snd.output, snd.sample_count);
						SoundUpdate();
					}
				}
			}
		}

		if (!skip && menuConfig.video.syncMode == 0){
			//if (gblMachineType == EM_SMS)
			VideoGuUpdate(nDrawnFrames, menuConfig.video.render);
			frameReady = 1;
			nDrawnFrames++;
		}
		oslDrawString(10,10,"Mod By Davis");
		//vsyncAdd = 0;
		//redo:
		if (menuConfig.video.turbo){
			if (!skip){
				oslEndDrawing();
				oslSwapBuffers();
			}
			skip = nFrame % (menuConfig.video.turboSkip + 1);
		}
		else{
			int vsync = 4 /*+ vsyncAdd*/;
			if (menuConfig.video.vsync == 2)
				vsync |= 1;
			/*else if (menuConfig.video.vsync == 1)
				vsync |= 8;*/

			/*if (autoFskip && !skip)
				tmp = oslMeanBenchmarkTestEx(OSL_BENCH_END, 0);*/

			skip = oslSyncFrameEx(oslMinMax(frameskip+1, menuConfig.video.frameskip, menuConfig.video.frameskipMax), menuConfig.video.frameskipMax, vsync);

			/*if (autoFskip && !skip)		{
				//Store the CPU usage (in percent)
				cpuTime = tmp * 6 / 1000;
				oslBenchmarkTest(OSL_BENCH_START);
			}*/
		}

		/*if (autoFskip){
			if (!skip){
				cpuTime = oslMeanBenchmarkTestEx(OSL_BENCH_GET_LAST, 0) * 6 / 1000;
				oslMeanBenchmarkTestEx(OSL_BENCH_START, 0);
				targetFrameskip = skippedFrames;
				skippedFrames = 0;
			}
			else{
				skippedFrames++;
			}
		}*/
		if (!skip && menuConfig.video.syncMode == 1)			{
			//if (gblMachineType == EM_SMS)
			VideoGuUpdate(nDrawnFrames, menuConfig.video.render);
			frameReady = 1;
			nDrawnFrames++;
		}

		nFrame++;
		//Pal
		/*if (menuConfig.video.country == 1 && nFrame % 6 == 0)		{
			if (!skip)
				vsyncAdd = 16;
			goto redo;
		}*/
		//In game, menu not currently shown - WARNING: DONT MOVE THIS, THE MESSAGEBOX CODE RELIES ON menuIsInGame == 2 TO KNOW IF THE GAME IS CURRENTLY RUNNING (or menuIsInGame == 1 = menu is shown)
		menuIsInGame = 2;

		if (menuDisplaySpecialMessage)
			MenuSpecialMessageDisplay();
	} // End Of While
	SmsTerm();
	//SmsEmulate();
	// End Emulate
	SaveMyPlacesFile();
	sceKernelExitGame();

    return 0;
}
コード例 #29
0
ファイル: FORM.C プロジェクト: LesInk/Test
T_void FormGenericControl(E_Boolean *exitflag)
{
    static T_word32 delta = 0, lastupdate = 0;
    T_keyboardEventHandler keyhandl;
    T_mouseEventHandler mousehandl;
    T_bitmap *p_bitmap;
    T_resource r_bitmap;
    T_bitmap *p_oldBitmap;
    T_word16 hotX, hotY;

    DebugRoutine("FormGenericControl");

    lastupdate = TickerGet();
    *exitflag = FALSE;

    /** Initialize the mouse. **/
    MouseGetBitmap(&hotX, &hotY, &p_oldBitmap);
    p_bitmap = (T_bitmap *)PictureLock("UI/MOUSE/DEFAULT", &r_bitmap);
    DebugCheck(p_bitmap != NULL);
    MouseSetDefaultBitmap(0, 0, p_bitmap);
    MouseUseDefaultBitmap();

    /* show the mouse and set the keyboard/mouse event handlers */
    keyhandl = KeyboardGetEventHandler();
    mousehandl = MouseGetEventHandler();
    /* flush the keyboard */
    KeyboardDebounce();
    MouseSetEventHandler(FormHandleMouse);
    KeyboardSetEventHandler(FormHandleKey);
//    MouseShow();

    do {
        delta = TickerGet();
        /* update color every 4 ticks */
        if ((delta - lastupdate) > 0) {
            lastupdate = delta;
            ColorUpdate(delta - lastupdate);
        }

        /* update events */
        GraphicUpdateAllGraphics();
//        MouseHide();
        MouseUpdateEvents();
        KeyboardUpdateEvents();
        SoundUpdate();
//        MouseShow();
//        delay (20);
    } while (*exitflag == FALSE
            && KeyboardGetScanCode(KEY_SCAN_CODE_ESC) == FALSE);

    /* clean up */
//    MouseHide();
    FormCleanUp();
    MouseSetEventHandler(mousehandl);
    KeyboardSetEventHandler(keyhandl);
    KeyboardDebounce();

    /** free up the mouse pointer resource. **/
    ResourceUnlock(r_bitmap);
    ResourceUnfind(r_bitmap);

    /* Turn off the mouse */
    MouseSetDefaultBitmap(hotX, hotY, p_oldBitmap);
    MouseUseDefaultBitmap();

    DebugEnd();
}