RDTSCTimer.cpp in pacman_source_code(v


VIGASOCO (VIdeo GAmes SOurce COde) Windows port (v0.01)...Original Link
    Sponsored links

			
// RDTSCTimer.cpp
//
/////////////////////////////////////////////////////////////////////////////

#include "RDTSCTimer.h"
#define WIN32_LEAN_AND_MEAN
#include <windows.h>

/////////////////////////////////////////////////////////////////////////////
// initialization and cleanup
/////////////////////////////////////////////////////////////////////////////

RDTSCTimer::RDTSCTimer()
{
}

RDTSCTimer::~RDTSCTimer()
{
}

bool RDTSCTimer::init()
{
	// if the CPU doesn't support the RDTSC instruction, init fails
	if (!supportsRDTSC()){
		return false;
	}

	_ticksPerSecond = calcTicksPerSecond();
	return true;
}

void RDTSCTimer::end()
{
}

/////////////////////////////////////////////////////////////////////////////
// timer methods
/////////////////////////////////////////////////////////////////////////////

INT64 RDTSCTimer::getTime()
{
	INT64 result;

	__asm {
		rdtsc
		lea ebx,[result]
		mov [ebx],eax
		mov [ebx+4],edx
	}

	return result;
}

INT64 RDTSCTimer::getTicksPerSecond()
{
	return _ticksPerSe			

			...
			...
			... to be continued.

  This is a preview. To get the complete source file, 
  please click here to download the whole source code package.

			
			


Project Files

    Sponsored links
NameSizeDate
 010.00 B
 Core.vcproj10.88 kB10-08-03 17:26
 FileLoader.cpp2.77 kB10-07-03 18:11
 FileLoader.h1.24 kB10-07-03 18:04
 GameDataEntity.cpp2.44 kB10-07-03 18:11
 GameDataEntity.h2.63 kB10-07-03 18:04
 GameDriver.cpp4.04 kB10-07-03 17:53
 GameDriver.h3.80 kB10-07-03 18:10
 GfxData.cpp2.41 kB10-07-03 17:53
 GfxData.h1.39 kB10-07-03 17:57
 IDrawPlugin.h2.58 kB10-07-03 18:06
 IInputPlugin.h1.20 kB10-07-03 17:57
 ILoader.h1.03 kB10-07-03 17:57
 InputHandler.cpp4.56 kB10-07-03 18:11
 InputHandler.h2.16 kB10-07-03 18:09
 InputPort.cpp1.12 kB10-07-03 17:53
 InputPort.h857.00 B10-07-03 17:57
 IPalette.cpp389.00 B10-07-03 18:11
 IPalette.h775.00 B10-07-03 18:00
 LoadHandler.h1.03 kB10-07-03 17:57
 NormalLoadHandler.cpp1.01 kB10-07-03 18:08
 NormalLoadHandler.h596.00 B10-07-03 18:04
 Operations.cpp529.00 B10-07-03 18:09
 Operations.h514.00 B10-08-03 17:28
 010.00 B
 PacmanDriver.cpp10.67 kB10-07-03 18:11
 PacmanDriver.h2.04 kB10-07-03 18:04
 BlueGhost.cpp2.80 kB10-07-03 18:34
 BlueGhost.h476.00 B10-07-03 18:10
 Character.cpp1.26 kB10-07-03 18:34
 Character.h879.00 B10-07-03 18:29
 CharacterSubstate.h348.00 B09-13-03 16:37
 CoinInsertedState.cpp990.00 B10-07-03 18:39
 CoinInsertedState.h575.00 B10-07-03 18:10
 CoinInsertedSubstates.cpp3.10 kB10-07-03 18:35
 CoinInsertedSubstates.h753.00 B10-07-03 18:33
 CommonCutscene.cpp625.00 B10-07-03 18:35
 CommonCutscene.h400.00 B10-07-03 18:10
 DemoState.cpp2.47 kB10-07-03 18:35
 DemoState.h498.00 B10-07-03 18:10
 DemoSubstates.cpp8.32 kB10-07-03 18:35
 DemoSubstates.h2.46 kB10-07-03 18:33
 Difficulty.cpp6.83 kB10-07-03 18:16
 Difficulty.h1.03 kB10-07-03 17:57
 FirstCutscene.cpp3.71 kB10-07-03 18:39
 FirstCutscene.h1.14 kB10-07-03 18:10
 Game.cpp20.99 kB10-07-03 18:27
 Game.h4.05 kB10-07-03 18:28
 GameSettings.cpp3.23 kB10-07-03 18:29
 GameSettings.h874.00 B09-08-03 00:12
 GameState.h687.00 B09-26-03 23:33
 Ghost.cpp6.34 kB10-07-03 18:33
 Ghost.h1.37 kB10-07-03 18:33
 GhostAction.h516.00 B10-07-03 18:10
 GhostDeadSubstates.cpp1.41 kB10-07-03 18:31
 GhostDeadSubstates.h621.00 B10-07-03 18:25
 GhostMoveAtHomeActions.cpp2.15 kB10-07-03 18:34
 GhostMoveAtHomeActions.h810.00 B10-07-03 18:33
 GhostMoveWhenKilledActions.cpp2.80 kB10-07-03 18:32
 GhostMoveWhenKilledActions.h943.00 B10-07-03 18:33
 InitState.cpp638.00 B10-07-03 18:39
 InitState.h501.00 B10-07-03 18:10
 InitSubstate.cpp729.00 B10-07-03 18:39
 InitSubstate.h349.00 B10-07-03 18:33
 OrangeGhost.cpp2.94 kB10-07-03 18:32
 OrangeGhost.h492.00 B10-07-03 18:10
 Pacman.cpp12.85 kB10-07-03 18:34
 Pacman.h1.28 kB10-07-03 18:33
 PacmanDeadSubstates.cpp3.03 kB10-07-03 18:34
 PacmanDeadSubstates.h1.75 kB10-07-03 18:25
 Path.cpp3.55 kB10-07-03 18:29
 Path.h1.00 kB10-07-03 16:59
 PinkGhost.cpp2.48 kB10-07-03 18:32
 PinkGhost.h477.00 B10-07-03 18:11
 PlayerLevelState.cpp2.79 kB10-07-03 18:27
 PlayerLevelState.h852.00 B10-07-03 17:57
 PlayingState.cpp3.53 kB10-07-03 18:38
 PlayingState.h646.00 B10-07-03 18:33
 PlayingSubstates.cpp9.10 kB10-07-03 18:38
 PlayingSubstates.h1.77 kB10-07-03 18:10
 RedGhost.cpp5.22 kB10-07-03 18:32
 RedGhost.h664.00 B10-07-03 18:11
 ScheduledTask.h346.00 B09-06-03 20:08
 ScheduledTasks.cpp1.16 kB10-07-03 18:30
 ScheduledTasks.h1.32 kB10-07-03 18:30
 Scheduler.cpp2.34 kB10-07-03 18:28
 Scheduler.h1.43 kB10-07-03 18:31
 SecondCutscene.cpp5.19 kB10-07-03 18:37
 SecondCutscene.h1.57 kB10-07-03 18:10
 Task.cpp1.22 kB10-07-03 18:31
 Task.h720.00 B10-07-03 18:31
 ThirdCutscene.cpp3.03 kB10-07-03 18:37
 ThirdCutscene.h1.04 kB10-07-03 18:10
 Video.cpp11.68 kB10-07-03 18:27
 Video.h1.02 kB09-06-03 00:41
 Writer.cpp6.95 kB10-07-03 18:27
 Writer.h834.00 B09-12-03 01:11
 Timer.h782.00 B10-07-03 17:57
 TimingHandler.cpp5.32 kB10-07-03 18:06
 TimingHandler.h2.16 kB10-07-03 18:06
 Types.h1.75 kB09-28-03 10:37
 UncompressedLoader.cpp1.36 kB10-07-03 18:08
 UncompressedLoader.h675.00 B10-07-03 18:04
 010.00 B
 INotificationSuscriber.h589.00 B09-25-03 21:43
 NotificationProvider.cpp1.16 kB09-25-03 21:47
 NotificationProvider.h952.00 B10-07-03 18:00
 Singleton.h1.19 kB09-29-03 22:54
 Vigasoco.cpp6.99 kB10-07-03 18:12
 Vigasoco.h2.59 kB10-07-03 18:10
 010.00 B
 BasicDrawPlugin.cpp7.64 kB10-07-03 18:43
 BasicDrawPlugin.h3.50 kB10-08-03 17:29
 BasicDrawPluginTemplates.cpp2.86 kB09-25-03 17:05
 Bitmap.cpp1.24 kB10-07-03 18:43
 Bitmap.h1.47 kB10-08-03 17:28
 BitmapTemplates.cpp7.09 kB09-20-03 17:20
 DirectDrawFullScreen.cpp5.78 kB10-07-03 18:43
 DirectDrawFullScreen.h1.78 kB10-07-03 18:45
 DirectDrawFullScreen16bpp.cpp5.99 kB10-07-03 18:43
 DirectDrawFullScreen16bpp.h1.47 kB10-07-03 18:42
 DirectDrawFullScreen32bpp.cpp4.54 kB10-07-03 18:51
 DirectDrawFullScreen32bpp.h1.21 kB10-07-03 18:43
 DirectDrawFullScreenTB16bpp.cpp6.54 kB10-07-03 18:51
 DirectDrawFullScreenTB16bpp.h1.53 kB10-07-03 18:42
 DirectDrawFullScreenTB32bpp.cpp5.09 kB10-07-03 18:51
 DirectDrawFullScreenTB32bpp.h1.27 kB10-07-03 18:42
 DirectDrawPlugin.cpp5.05 kB10-07-03 18:51
 DirectDrawPlugin.h1.38 kB10-07-03 18:51
 DirectDrawPlugins.vcproj6.44 kB10-08-03 17:34
 DirectDrawWindow.cpp6.02 kB10-07-03 18:51
 DirectDrawWindow.h1.23 kB10-07-03 18:45
 DirectDrawWindow16bpp.cpp6.34 kB10-07-03 18:51
 DirectDrawWindow16bpp.h1.43 kB10-07-03 18:45
 DirectDrawWindow32bpp.cpp4.76 kB10-07-03 18:51
 DirectDrawWindow32bpp.h1.18 kB10-07-03 18:45
 PluginMain.cpp2.08 kB10-07-03 18:46
 010.00 B
 DirectInputKeyboardPlugin.cpp5.63 kB10-07-03 18:51
 DirectInputKeyboardPlugin.h1.62 kB10-07-03 18:47
 DirectInputKeyboardPlugin.vcproj4.40 kB10-08-03 17:34
 PluginMain.cpp1.35 kB10-07-03 18:48
 leeme.txt2.21 kB10-06-03 21:09
 readme.txt1.88 kB10-06-03 21:12
 VIGASOCO.sln3.53 kB09-29-03 10:25
 010.00 B
 010.00 B
 010.00 B
 PluginHandler.cpp2.47 kB10-07-03 18:51
 PluginHandler.h2.27 kB10-07-03 18:47
 RDTSCTimer.cpp2.08 kB10-07-03 18:51
 RDTSCTimer.h676.00 B10-07-03 18:06
 010.00 B
 VigasocoWin32.cpp8.36 kB10-07-03 18:51
 VigasocoWin32.h2.16 kB10-07-03 18:49
 VigasocoWin32.vcproj4.32 kB10-08-03 17:34
 Win32Palette.cpp1.60 kB10-07-03 18:50
 Win32Palette.h1.48 kB10-07-03 18:05
 Win32Settings.cpp1.51 kB10-07-03 18:47
 Win32Settings.h1.22 kB09-27-03 16:33
 WinMain.cpp5.00 kB10-07-03 19:00
 windows.txt3.11 kB10-06-03 21:14
 windows_es.txt3.69 kB10-07-03 16:20
 010.00 B
 PluginMain.cpp1.35 kB10-07-03 18:51
 ZipLoader.cpp1.81 kB10-07-03 18:51
 ZipLoader.h918.00 B10-08-03 17:28
 ZipLoader.vcproj4.31 kB10-08-03 17:34
...

Related Items

    Sponsored links