Customizable Fast Loader speed

This commit is contained in:
nastys
2020-01-21 14:11:00 +01:00
parent effea1c6e3
commit ddb71dcdea
3 changed files with 15 additions and 1 deletions
@@ -1,6 +1,8 @@
#include "FastLoader.h"
#include "../FileSystem/ConfigFile.h"
#include "../Constants.h"
#include <stdio.h>
#include "../framework.h"
namespace TLAC::Components
{
@@ -19,6 +21,14 @@ namespace TLAC::Components
void FastLoader::Initialize(ComponentsManager*)
{
TLAC::FileSystem::ConfigFile componentsConfig(TLAC::framework::GetModuleDirectory(), COMPONENTS_CONFIG_FILE_NAME);
bool success = componentsConfig.OpenRead();
if (success)
{
int speed = componentsConfig.GetIntegerValue("fast_loader_speed");
if (speed >= 2 && speed <= 1024) updatesPerFrame = speed;
}
printf("[Fast Loader] Speed: %d\n", updatesPerFrame);
}
void FastLoader::Update()
@@ -1,6 +1,7 @@
#pragma once
#include "EmulatorComponent.h"
#include "GameState.h"
#include <string>
namespace TLAC::Components
{
@@ -17,7 +18,8 @@ namespace TLAC::Components
virtual void UpdateInput() override;
private:
const int updatesPerFrame = 39;
const std::string COMPONENTS_CONFIG_FILE_NAME = "components.ini";
int updatesPerFrame = 39;
GameState currentGameState;
GameState previousGameState;