Example #1
0
void do_step(unsigned int times)
{
    state.halted = 0;
    lc3_run(state, times);
    memory->Update();
    registers->Update();
}
Example #2
0
void do_prev(unsigned int times)
{
    for (unsigned int i = 0; i < times; i++)
        lc3_prev_line(state);
    memory->Update();
    registers->Update();
}
Example #3
0
void do_run(void)
{
    state.halted = 0;
    lc3_run(state);
    memory->Update();
    registers->Update();
}
Example #4
0
void do_finish(void)
{
    state.halted = 0;
    lc3_finish(state);
    memory->Update();
    registers->Update();
}
Example #5
0
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int cmdShow)
{
    gui.reset(new GUI::GuiWrapper());
    simulation.reset(new Simulation());

    runSimulation = 
        InitialiseWindow(&hInstance) && 
        InitialiseDirectX() &&  
        simulation->CreateSimulation(hInstance, hWnd, d3ddev) &&
        InitialiseGUI();

    while(runSimulation && gui->Update())
    {
        simulation->Update();
        simulation->Render();
    }

    d3ddev->Release();
    d3d->Release();
    backBuffer->Release();

    #ifdef _DEBUG
    OutputDebugString("Exiting Simulation\n");
    #endif
}
Example #6
0
void do_next(unsigned int times)
{
    state.halted = 0;
    for (unsigned int i = 0; i < times; i++)
        lc3_next_line(state);
    memory->Update();
    registers->Update();
}
Example #7
0
	Yggdrasil::ConstantBuffer* ConstantBuffer() noexcept
	{
		if (dirty || !constantBuffer)
		{
			MaterialStandardConstants constants{
				(Vec4)colour,
				{ textures[0] ? 1u : 0u, textures[3] ? 1u : 0u },
				{ textures[1] ? 1u : 0u, textures[4] ? 1u : 0u },
				{ textures[2] ? 1u : 0u, textures[5] ? 1u : 0u },
				unlit ? 1u : 0u,
				specularPower,
				Vec3{ emissive.Red(), emissive.Green(), emissive.Blue() } * emissive.Alpha()
			};

			try
			{
				if (!constantBuffer)
					constantBuffer.reset(new Yggdrasil::ConstantBuffer(*constantBufferArray.get()));
				constantBuffer->Update(constants, nullptr);
				dirty = false;
			}
			catch (const std::exception& e)
			{
				YGG_ERROR(YL("Material::ConstantBuffer: ") << Coerce(e.what()));
			}
		}
		assert(!YGG_DEBUG_BAD_POINTER(constantBuffer.get()));
		return constantBuffer.get();
	}	
Example #8
0
		void Apply(D3DTexture2D* tex, D3DSampler* smp) override {
			psFont->Apply();
			tex->Apply(Shaders::ShaderFlag::Pixel, 0);
			smp->Apply(Shaders::ShaderFlag::Pixel, 0);
			cbColor->Update(&color);
			cbColor->Apply(Shaders::ShaderFlag::Pixel, 0);
		}
Example #9
0
void LitWavesApp::UpdateWaves(const GameTimer& gt)
{
	// Every quarter second, generate a random wave.
	static float t_base = 0.0f;
	if((mTimer.TotalTime() - t_base) >= 0.25f)
	{
		t_base += 0.25f;

		int i = MathHelper::Rand(4, mWaves->RowCount() - 5);
		int j = MathHelper::Rand(4, mWaves->ColumnCount() - 5);

		float r = MathHelper::RandF(0.2f, 0.5f);

		mWaves->Disturb(i, j, r);
	}

	// Update the wave simulation.
	mWaves->Update(gt.DeltaTime());

	// Update the wave vertex buffer with the new solution.
	auto currWavesVB = mCurrFrameResource->WavesVB.get();
	for(int i = 0; i < mWaves->VertexCount(); ++i)
	{
		Vertex v;

		v.Pos = mWaves->Position(i);
		v.Normal = mWaves->Normal(i);

		currWavesVB->CopyData(i, v);
	}

	// Set the dynamic VB of the wave renderitem to the current frame VB.
	mWavesRitem->Geo->VertexBufferGPU = currWavesVB->Resource();
}
/**
* Just the current frame in the display.
*/
void Engine::DrawFrame()
{
    float fFPS;
    if( monitor_.Update( fFPS ) )
    {
        UpdateFPS( fFPS );
    }
    //renderer_.Update( monitor_.GetCurrentTime() );

    static Timer Timer;
    static double PrevTime = Timer.GetElapsedTime();
    auto CurrTime = Timer.GetElapsedTime();
    auto ElapsedTime = CurrTime - PrevTime;
    PrevTime = CurrTime;
    sample_->Update(CurrTime, ElapsedTime);

    //renderer_.Render();
    sample_->Render();

    // Draw tweak bars
    TwDraw();

    // Swap
    pSwapChain_->Present();
    //if( EGL_SUCCESS != pRenderDevice_->Present() )
    //{
    //    UnloadResources();
    //    LoadResources();
    //}
}
Example #11
0
void do_delete(unsigned short address)
{
    lc3_remove_blackbox(state, address);
    lc3_remove_break(state, address);
    lc3_remove_watch(state, false, address);
    memory->Update();
}
Example #12
0
void do_delete(const std::string& symbol)
{
    lc3_remove_blackbox(state, symbol);
    lc3_remove_break(state, symbol);
    lc3_remove_watch(state, symbol);
    memory->Update();
}
void Psp2Audio::Update() {	
	if (BGM != NULL && BGM->tick > 0){
		int t = DisplayUi->GetTicks();
		audio_decoder->Update(t - BGM->tick);
		BGM->tick = t;
	}
}
Example #14
0
void DriveTransfer::TransferFile(QString sourcePath, QString relativeFilePath, QString targetPath, int64_t& checksum)
{
    QFile source(sourcePath + "/" + relativeFilePath);

    _subTaskDescription = "Copying " + relativeFilePath.toStdString();

    // TODO: Ensure trailing slash to remove need of appending it in multiple places
    if (QFile::exists(targetPath + relativeFilePath))
    {
        QFile::remove(targetPath + "/" + relativeFilePath);
    }

    QFile target(targetPath + "/" + relativeFilePath);

    OC_LOG_INFO("From: " + source.fileName().toStdString() + " To: " + target.fileName().toStdString());
    source.open(QIODevice::ReadOnly);
    target.open(QIODevice::WriteOnly);

    if (source.error() || target.error())
    {
        OC_LOG_ERROR("DriveTransfer failed.");
        return;
    }

    int TRANSFER_BLOCK_SIZE = 1024 * 1024; // 1MB

    float progressBlock = source.size() / 100.0f;
    int totalRead = 0;
    int progress = 0;

    const std::unique_ptr<IHashGenerator> hashGenerator(new xxHashAdapter());
    hashGenerator->Initialize();

    // TODO: Error handling
    char* buffer = new char[TRANSFER_BLOCK_SIZE];
    while (!source.atEnd())
    {
        qint64 readSize = source.read(buffer, TRANSFER_BLOCK_SIZE);
        target.write(buffer, readSize);

        hashGenerator->Update(buffer, readSize);

        totalRead += readSize;

         //progress = totalRead / progressBlock;

        if (totalRead > progressBlock * progress)
        {
            progress += totalRead / progressBlock;

            ProgressChanged(progress);
        }
    }

    checksum = hashGenerator->Retrieve();
}
Example #15
0
// static
std::unique_ptr<CPDF_CrossRefTable> CPDF_CrossRefTable::MergeUp(
    std::unique_ptr<CPDF_CrossRefTable> current,
    std::unique_ptr<CPDF_CrossRefTable> top) {
  if (!current)
    return top;

  if (!top)
    return current;

  current->Update(std::move(top));
  return current;
}
Example #16
0
void do_loadover(const std::string& filename)
{
    try
    {
        lc3_assemble(state, filename);
    }
    catch (LC3AssembleException e)
    {
        fprintf(stderr, "[ERROR] %s failed to assemble. %s\n", filename.c_str(), e.what().c_str());
        return;
    }
    current_filename = filename;
    memory->Update();
}
Example #17
0
void do_set(unsigned char reg, short value)
{
    if (reg <= 7)
        state.regs[reg] = value;
    if (reg == 8)
        state.pc = value;
    if (reg == 9)
    {
        state.n = value < 0;
        state.z = value == 0;
        state.p = value > 0;
    }
    registers->Update();
}
Example #18
0
void do_reloadover(void)
{
    if (current_filename.empty())
        return;
    try
    {
        lc3_assemble(state, current_filename);
    }
    catch (LC3AssembleException e)
    {
        fprintf(stderr, "[ERROR] %s failed to assemble. %s\n", current_filename.c_str(), e.what().c_str());
        return;
    }
    memory->Update();
}
Example #19
0
SPELUNKBOT_API double Update(double botSelector, double botXPos, double botYPos)
{
	if (!bot)
	{
		CreateBot(botSelector);
	}
	else
	{
		// Use Update to select a bot to run
		bot->Reset();
		bot->UpdateBotPosition(botXPos, botYPos);
		bot->Update();
	}

	return 1;
}
Example #20
0
void WavesCSApp::UpdateWavesGPU(const GameTimer& gt)
{
	// Every quarter second, generate a random wave.
	static float t_base = 0.0f;
	if((mTimer.TotalTime() - t_base) >= 0.25f)
	{
		t_base += 0.25f;

		int i = MathHelper::Rand(4, mWaves->RowCount() - 5);
		int j = MathHelper::Rand(4, mWaves->ColumnCount() - 5);

		float r = MathHelper::RandF(1.0f, 2.0f);

		mWaves->Disturb(mCommandList.Get(), mWavesRootSignature.Get(), mPSOs["wavesDisturb"].Get(), i, j, r);
	}

	// Update the wave simulation.
	mWaves->Update(gt, mCommandList.Get(), mWavesRootSignature.Get(), mPSOs["wavesUpdate"].Get());
}
Example #21
0
		void Update()
		{
			if(!g_ui_package_present)
			{
				return;
			}

			if(g_screen_display_manager->ScreenActive())
			{
				g_control_input.Update();
			}

			// Update the UI according to the game's current state
			bool in_menu =				Yelo::Input::IsInMenu();
			bool in_chat =				Yelo::Input::IsInChat();
			bool is_loading =			GameState::GameGlobals()->map_loading_in_progress;
			bool is_main_menu_cache =	Yelo::Cache::CacheFileGlobals()->cache_header.cache_type == Enums::_shared_cache_type_main_menu;

			_enum game_state = Flags::_osui_game_state_in_game;
			if(is_loading)
			{
				game_state = Flags::_osui_game_state_loading;
			}
			// Pause menu if the cache isn't a main menu but we are in a menu
			else if(!is_main_menu_cache && in_menu)
			{
				game_state = Flags::_osui_game_state_pause_menu;
			}
			// In game if the cache isn't a main menu and we aren't in a menu
			else if(!is_main_menu_cache && !in_menu)
			{
				game_state = Flags::_osui_game_state_in_game;
			}
			// In the main menu if the cache is a main menu and we are in a menu
			else if(is_main_menu_cache && in_menu)
			{
				game_state = Flags::_osui_game_state_main_menu;
			}
			g_screen_display_manager->SetGameState((Flags::osui_game_state)game_state);
			g_screen_display_manager->Update();
		}
Example #22
0
void UpdateApp()
{
    gCamera.ProcessInertia();

    LARGE_INTEGER currFrameTicks;
    CHECK_WIN32(QueryPerformanceCounter(&currFrameTicks));

    UINT64 deltaTicks = currFrameTicks.QuadPart - gLastFrameTicks;
    gAccumulatedFrameTicks += deltaTicks;

    const UINT64 kMillisecondsPerUpdate = 1000 / kUpdateFrequency;
    const UINT64 kTicksPerMillisecond = gPerformanceFrequency / 1000;
    const UINT64 kTicksPerUpdate = kMillisecondsPerUpdate * kTicksPerMillisecond;
    
    while (gAccumulatedFrameTicks >= kTicksPerUpdate)
    {
        gpRenderer->Update(kMillisecondsPerUpdate);
        gAccumulatedFrameTicks -= kTicksPerUpdate;
    }

    gLastFrameTicks = currFrameTicks.QuadPart;
}
Example #23
0
void do_rewind(void)
{
    lc3_rewind(state);
    memory->Update();
    registers->Update();
}
Example #24
0
void do_tempbreak(const std::string& symbol)
{
    lc3_add_break(state, symbol, "", "1", 1);
    memory->Update();
}
Example #25
0
void do_tempbreak(unsigned short address)
{
    lc3_add_break(state, address, "", "1", 1);
    memory->Update();
}
Example #26
0
void do_break(unsigned short address, const std::string& name, const std::string& condition, int times)
{
    lc3_add_break(state, address, name, condition, times);
    memory->Update();
}
//--------------------------------------------------------------------------------------
// Render a frame
//--------------------------------------------------------------------------------------
void Render()
{
    // Update our time
    static float t = 0.0f;
    static float dt = 0.f;
    if( g_driverType == D3D_DRIVER_TYPE_REFERENCE )
    {
        t += ( float )XM_PI * 0.0125f;
    }
    else
    {
        static uint64_t dwTimeStart = 0;
        static uint64_t dwTimeLast = 0;
        uint64_t dwTimeCur = GetTickCount64();
        if( dwTimeStart == 0 )
            dwTimeStart = dwTimeCur;
        t = ( dwTimeCur - dwTimeStart ) / 1000.0f;
        dt = ( dwTimeCur - dwTimeLast ) / 1000.0f;
        dwTimeLast = dwTimeCur;
    }

    // Rotate cube around the origin
    g_World = XMMatrixRotationY( t );

#ifdef DXTK_AUDIO

    g_audioTimerAcc -= dt;
    if ( g_audioTimerAcc < 0 )
    {
        g_audioTimerAcc = 4.f;

        g_waveBank->Play( g_audioEvent++ );

        if ( g_audioEvent >= 11 )
            g_audioEvent = 0;
    }

    if ( !g_audEngine->Update() )
    {
        // Error cases are handled by the message loop
    }

#endif // DXTK_AUDIO
    //
    // Clear the back buffer
    //
    g_pImmediateContext->ClearRenderTargetView( g_pRenderTargetView, Colors::MidnightBlue );

    //
    // Clear the depth buffer to 1.0 (max depth)
    //
    g_pImmediateContext->ClearDepthStencilView( g_pDepthStencilView, D3D11_CLEAR_DEPTH, 1.0f, 0 );

    // Draw procedurally generated dynamic grid
    //const XMVECTORF32 xaxis = { 20.f, 0.f, 0.f };
    //const XMVECTORF32 yaxis = { 0.f, 0.f, 20.f };
    //DrawGrid( *g_Batch, xaxis, yaxis, g_XMZero, 20, 20, Colors::Gray );


    // Draw 3D object
	XMMATRIX localForShape1 = XMMatrixMultiply(g_World, XMMatrixTranslation(2.f, 0.f, 0.f));
	g_Shape->Draw(localForShape1, g_View, g_Projection, Colors::White, g_pTextureRV1);

	

	localForShape1 = XMMatrixMultiply(g_World, XMMatrixTranslation(-2.f, 0.f, 0.f));
	g_Shape2->Draw(localForShape1, g_View, g_Projection, Colors::White, g_pTextureRV2);

	XMVECTOR qid = XMQuaternionIdentity();
	const XMVECTORF32 scale = { 0.20f, 0.20f, 0.20f };
	const XMVECTORF32 translate = { 0.f, -6.f, 30.f };
	XMVECTOR rotate = XMQuaternionRotationRollPitchYaw(0, XM_PI / 2.f, 0);
	localForShape1 = XMMatrixMultiply(g_World, XMMatrixTransformation(g_XMZero, qid, scale, g_XMZero, rotate, translate));
	g_Model->Draw(g_pImmediateContext, *g_States, localForShape1, g_View, g_Projection);

    // Present our back buffer to our front buffer
    g_pSwapChain->Present( 0, 0 );
}
Example #28
0
void do_watch(unsigned char reg, const std::string& condition, const std::string& name, int times)
{
    lc3_add_watch(state, true, reg, condition, name, times);
    registers->Update();
}
Example #29
0
void do_watch(const std::string& symbol, const std::string& condition, const std::string& name, int times)
{
    lc3_add_watch(state, symbol, condition, name, times);
    memory->Update();
}
Example #30
0
void do_break(const std::string& symbol, const std::string& name, const std::string& condition, int times)
{
    lc3_add_break(state, symbol, name, condition, times);
    memory->Update();
}