Customizable Fast Loader speed

This commit is contained in:
nastys
2020-01-21 14:11:00 +01:00
parent eb8142c81c
commit 4d6e2fa5e2
3 changed files with 15 additions and 1 deletions
@@ -252,6 +252,8 @@ ConfigOptionBase* componentsArray[] = {
new BooleanOption(L"fast_loader", COMPONENTS_SECTION, COMPONENTS_FILE, L"Fast Loader", L"Skip or speed up unnecessary loading steps.", false, true),
new NumericOption(L"fast_loader_speed", COMPONENTS_SECTION, COMPONENTS_FILE, L"Fast Loader Speed", L"Set this to 4 or less when playing online.\nDefault: 39", 39, 2, 1024),
new BooleanOption(L"camera_controller", COMPONENTS_SECTION, COMPONENTS_FILE, L"Camera Controller", L"Enables freecam (toggled using F3).\nWASD to move, SPACE/CTRL for up/down, Q/R to rotate, R/F for zoom.\nHolding SHIFT/ALT changes control speed.", false, true),
new BooleanOption(L"scale_component", COMPONENTS_SECTION, COMPONENTS_FILE, L"Scale Component", L"Scales the graphics output framebuffer to fill the screen/window.", false, true),
@@ -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;