Skip to content

Commit

Permalink
Allow ini connfiguration
Browse files Browse the repository at this point in the history
  • Loading branch information
averne committed Oct 19, 2021
1 parent c9f4ffe commit 7abb4f6
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 13 deletions.
6 changes: 3 additions & 3 deletions SpaceCadetPinball/options.cpp
Expand Up @@ -61,17 +61,17 @@ void options::init()
Options.Key = Options.KeyDft;

Options.Sounds = get_int("Sounds", true);
Options.Music = get_int("Music", false);
Options.Music = get_int("Music", true);
Options.FullScreen = get_int("FullScreen", false);
Options.Players = get_int("Players", 1);
#ifndef __SWITCH__

Options.Key.LeftFlipper = get_int("Left Flipper key", Options.Key.LeftFlipper);
Options.Key.RightFlipper = get_int("Right Flipper key", Options.Key.RightFlipper);
Options.Key.Plunger = get_int("Plunger key", Options.Key.Plunger);
Options.Key.LeftTableBump = get_int("Left Table Bump key", Options.Key.LeftTableBump);
Options.Key.RightTableBump = get_int("Right Table Bump key", Options.Key.RightTableBump);
Options.Key.BottomTableBump = get_int("Bottom Table Bump key", Options.Key.BottomTableBump);
#endif

Options.UniformScaling = get_int("Uniform scaling", true);
ImGui::GetIO().FontGlobalScale = get_float("UI Scale", 1.0f);
Options.Resolution = get_int("Screen Resolution", -1);
Expand Down
2 changes: 1 addition & 1 deletion SpaceCadetPinball/pb.cpp
Expand Up @@ -39,7 +39,7 @@ int pb::init()
{
float projMat[12], zMin = 0, zScaler = 0;

auto dataFilePath = pinball::make_path_name(winmain::DatFileName);
auto dataFilePath = winmain::DatFileName;
record_table = partman::load_records(dataFilePath.c_str(), FullTiltMode);

auto useBmpFont = 0;
Expand Down
14 changes: 5 additions & 9 deletions SpaceCadetPinball/winmain.cpp
Expand Up @@ -67,11 +67,9 @@ int winmain::WinMain(LPCSTR lpCmdLine)
#endif

pinball::quickFlag = strstr(lpCmdLine, "-quick") != nullptr;
DatFileName = options::get_string("Pinball Data", pinball::get_rc_string(168, 0));

/*Check for full tilt .dat file and switch to it automatically*/
auto cadetFilePath = pinball::make_path_name("CADET.DAT");
auto cadetDat = fopen(cadetFilePath.c_str(), "r");
auto cadetDat = fopen("CADET.DAT", "r");
if (cadetDat)
{
fclose(cadetDat);
Expand Down Expand Up @@ -141,16 +139,14 @@ int winmain::WinMain(LPCSTR lpCmdLine)
// ImGui_ImplSDL2_Init is private, we are not actually using ImGui OpenGl backend
ImGui_ImplSDL2_InitForOpenGL(window, nullptr);

#ifndef __SWITCH__
auto prefPath = SDL_GetPrefPath(nullptr, "SpaceCadetPinball");
auto iniPath = std::string(prefPath) + "imgui_pb.ini";
io.IniFilename = iniPath.c_str();
SDL_free(prefPath);
#endif
io.IniFilename = "imgui_pb.ini";

// PB init from message handler
{
options::init();

DatFileName = options::get_string("Pinball Data", "romfs:/PINBALL.DAT");

if (!Sound::Init(Options.SoundChannels, Options.Sounds))
Options.Sounds = false;

Expand Down

0 comments on commit 7abb4f6

Please sign in to comment.