diff --git a/src/boost-hash.h b/src/boost-hash.h index 3ce746a..29817c9 100644 --- a/src/boost-hash.h +++ b/src/boost-hash.h @@ -22,8 +22,8 @@ #ifndef BOOSTHASH_H #define BOOSTHASH_H -#include -#include +#include +#include #include @@ -34,7 +34,7 @@ template class BoostHash { private: - typedef boost::unordered_map BoostType; + typedef std::map BoostType; typedef std::pair PairType; BoostType p; @@ -98,7 +98,7 @@ template class BoostSet { private: - typedef boost::unordered_set BoostType; + typedef std::set BoostType; BoostType p; public: diff --git a/src/config.cpp b/src/config.cpp index 85d148d..e4ea80c 100644 --- a/src/config.cpp +++ b/src/config.cpp @@ -21,9 +21,9 @@ #include "config.h" -#include -#include -#include +//#include +//#include +//#include #include @@ -33,7 +33,6 @@ #include "debugwriter.h" #include "util.h" #include "sdl-util.h" -#include "iniconfig.h" #ifdef INI_ENCODING extern "C" { @@ -141,8 +140,8 @@ std::set setFromVec(const std::vector &vec) return std::set(vec.begin(), vec.end()); } -typedef std::vector StringVec; -namespace po = boost::program_options; +//typedef std::vector StringVec; +//namespace po = boost::program_options; #define CONF_FILE "mkxp.conf" @@ -151,6 +150,14 @@ Config::Config() void Config::read(int argc, char *argv[]) { + gameFolder = "game"; + defScreenW = 640; + defScreenH = 480; + enableBlitting = true; + smoothScaling = true; + subImageFix = false; + +#if 0 #define PO_DESC_ALL \ PO_DESC(rgssVersion, int, 0) \ PO_DESC(debugMode, bool, false) \ @@ -267,6 +274,8 @@ void Config::read(int argc, char *argv[]) #undef PO_DESC #undef PO_DESC_ALL +#endif + preloadScripts.insert("win32_wrap.rb"); rgssVersion = clamp(rgssVersion, 0, 3); @@ -299,6 +308,7 @@ static void setupScreenSize(Config &conf) void Config::readGameINI() { + if (!customScript.empty()) { game.title = baseName(customScript); @@ -310,33 +320,29 @@ void Config::readGameINI() return; } +#if 0 + po::options_description podesc; + podesc.add_options() + ("Game.Title", po::value()) + ("Game.Scripts", po::value()) + ; + + po::variables_map vm; +#endif std::string iniFilename = execName + ".ini"; SDLRWStream iniFile(iniFilename.c_str(), "r"); - +#if 0 if (iniFile) { - INIConfiguration ic; - if(ic.load(iniFile.stream())) + try { - GUARD_ALL( game.title = ic.getStringProperty("Game", "Title"); ); - GUARD_ALL( game.scripts = ic.getStringProperty("Game", "Scripts"); ); - - strReplace(game.scripts, '\\', '/'); - - if (game.title.empty()) - { - Debug() << iniFilename + ": Could not find Game.Title property"; - } - - if (game.scripts.empty()) - { - Debug() << iniFilename + ": Could not find Game.Scripts property"; - } + po::store(po::parse_config_file(iniFile.stream(), podesc, true), vm); + po::notify(vm); } - else + catch (po::error &error) { - Debug() << iniFilename + ": Failed to parse ini file"; + Debug() << iniFilename + ":" << error.what(); } } else @@ -344,6 +350,13 @@ void Config::readGameINI() Debug() << "FAILED to open" << iniFilename; } + GUARD_ALL( game.title = vm["Game.Title"].as(); ); + GUARD_ALL( game.scripts = vm["Game.Scripts"].as(); ); +#endif + game.scripts = "Data/Scripts.rxdata"; + + + strReplace(game.scripts, '\\', '/'); #ifdef INI_ENCODING /* Can add more later */ const char *languages[] = diff --git a/src/filesystem.cpp b/src/filesystem.cpp index 70d5065..c6f96fe 100644 --- a/src/filesystem.cpp +++ b/src/filesystem.cpp @@ -38,6 +38,7 @@ #include #include #include +#include #ifdef __APPLE__ #include