Config: Add "execName" to specify ini and rgssad filenames
This commit is contained in:
		
							parent
							
								
									531441d4e3
								
							
						
					
					
						commit
						7393f7e951
					
				
					 4 changed files with 24 additions and 9 deletions
				
			
		| 
						 | 
				
			
			@ -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…
	
	Add table
		Add a link
		
	
		Reference in a new issue