Config: Add "execName" to specify ini and rgssad filenames
This commit is contained in:
parent
531441d4e3
commit
7393f7e951
|
@ -256,6 +256,19 @@
|
|||
# SE.sourceCount=6
|
||||
|
||||
|
||||
# The Windows game executable name minus ".exe". By default
|
||||
# this is "Game", but some developers manually rename it.
|
||||
# mkxp needs this name because both the .ini (game
|
||||
# configuration) and .rgssad (encrypted data archive) must
|
||||
# carry the same name minus their extension, and we cannot
|
||||
# guess the executable's name.
|
||||
# You could just as well rename them both to "Game.ini" and
|
||||
# "Game.rgssad", but specifying the executable name here
|
||||
# is a tiny bit less intrusive.
|
||||
#
|
||||
# execName=Game
|
||||
|
||||
|
||||
# Give a hint on which language the game title as
|
||||
# specified in the Game.ini is, useful if the encoding
|
||||
# is being falsely detected. Relevant only if mkxp was
|
||||
|
|
|
@ -167,6 +167,7 @@ void Config::read(int argc, char *argv[])
|
|||
PO_DESC(dataPathOrg, std::string, "") \
|
||||
PO_DESC(dataPathApp, std::string, "") \
|
||||
PO_DESC(iconPath, std::string, "") \
|
||||
PO_DESC(execName, std::string, "Game") \
|
||||
PO_DESC(titleLanguage, std::string, "") \
|
||||
PO_DESC(midi.soundFont, std::string, "") \
|
||||
PO_DESC(midi.chorus, bool, false) \
|
||||
|
@ -286,7 +287,8 @@ void Config::readGameINI()
|
|||
;
|
||||
|
||||
po::variables_map vm;
|
||||
SDLRWStream iniFile("Game.ini", "r");
|
||||
std::string iniFilename = execName + ".ini";
|
||||
SDLRWStream iniFile(iniFilename.c_str(), "r");
|
||||
|
||||
if (iniFile)
|
||||
{
|
||||
|
@ -297,12 +299,12 @@ void Config::readGameINI()
|
|||
}
|
||||
catch (po::error &error)
|
||||
{
|
||||
Debug() << "Game.ini:" << error.what();
|
||||
Debug() << iniFilename + ":" << error.what();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug() << "FAILED to open Game.ini";
|
||||
Debug() << "FAILED to open" << iniFilename;
|
||||
}
|
||||
|
||||
GUARD_ALL( game.title = vm["Game.Title"].as<std::string>(); );
|
||||
|
|
|
@ -102,6 +102,7 @@ struct Config
|
|||
std::string dataPathApp;
|
||||
|
||||
std::string iconPath;
|
||||
std::string execName;
|
||||
std::string titleLanguage;
|
||||
|
||||
struct
|
||||
|
|
|
@ -46,14 +46,14 @@ SharedState *SharedState::instance = 0;
|
|||
int SharedState::rgssVersion = 0;
|
||||
static GlobalIBO *_globalIBO = 0;
|
||||
|
||||
static const char *defGameArchive()
|
||||
static const char *gameArchExt()
|
||||
{
|
||||
if (rgssVer == 1)
|
||||
return "Game.rgssad";
|
||||
return ".rgssad";
|
||||
else if (rgssVer == 2)
|
||||
return "Game.rgss2a";
|
||||
return ".rgss2a";
|
||||
else if (rgssVer == 3)
|
||||
return "Game.rgss3a";
|
||||
return ".rgss3a";
|
||||
|
||||
assert(!"unreachable");
|
||||
return 0;
|
||||
|
@ -116,8 +116,7 @@ struct SharedStatePrivate
|
|||
if (gl.ReleaseShaderCompiler)
|
||||
gl.ReleaseShaderCompiler();
|
||||
|
||||
// FIXME find out correct archive filename
|
||||
std::string archPath = defGameArchive();
|
||||
std::string archPath = config.execName + gameArchExt();
|
||||
|
||||
/* Check if a game archive exists */
|
||||
FILE *tmp = fopen(archPath.c_str(), "rb");
|
||||
|
|
Loading…
Reference in New Issue