mirror of
https://github.com/RetroDECK/ES-DE.git
synced 2025-01-30 03:55:40 +00:00
Fixed a crash bug with launch commands missing %ROM%.
Added relative path operator (".") support for gamelist.xml, in both game paths and image paths.
This commit is contained in:
parent
b225d0c9c8
commit
7e6498df60
|
@ -1,3 +1,7 @@
|
||||||
|
September 23
|
||||||
|
-Fixed crash when "%ROM%" isn't present in a launch command. Not sure why you'd ever do this on purpose, but hey.
|
||||||
|
-Added relative path operator ("./") support for gamelist.xml, for both game paths and image paths.
|
||||||
|
|
||||||
September 16
|
September 16
|
||||||
-Fixed a bug with skipping over unicode characters. [X] will be displayed if the character is not standard ASCII (characters 32 to 127).
|
-Fixed a bug with skipping over unicode characters. [X] will be displayed if the character is not standard ASCII (characters 32 to 127).
|
||||||
|
|
||||||
|
|
|
@ -31,7 +31,7 @@ namespace Renderer
|
||||||
SDL_GL_SetAttribute(SDL_GL_BLUE_SIZE, 8);
|
SDL_GL_SetAttribute(SDL_GL_BLUE_SIZE, 8);
|
||||||
SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, 16);
|
SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, 16);
|
||||||
SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1);
|
SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1);
|
||||||
sdlScreen = SDL_SetVideoMode(display_width, display_height, 16, SDL_OPENGL); //SDL_FULLSCREEN
|
sdlScreen = SDL_SetVideoMode(display_width, display_height, 16, SDL_OPENGL | SDL_FULLSCREEN);
|
||||||
|
|
||||||
if(sdlScreen == NULL)
|
if(sdlScreen == NULL)
|
||||||
{
|
{
|
||||||
|
|
|
@ -61,7 +61,10 @@ std::string strreplace(std::string& str, std::string replace, std::string with)
|
||||||
{
|
{
|
||||||
size_t pos = str.find(replace);
|
size_t pos = str.find(replace);
|
||||||
|
|
||||||
return str.replace(pos, replace.length(), with.c_str(), with.length());
|
if(pos != std::string::npos)
|
||||||
|
return str.replace(pos, replace.length(), with.c_str(), with.length());
|
||||||
|
else
|
||||||
|
return str;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SystemData::launchGame(GameData* game)
|
void SystemData::launchGame(GameData* game)
|
||||||
|
@ -196,13 +199,15 @@ void SystemData::loadConfig()
|
||||||
if(varName == "NAME")
|
if(varName == "NAME")
|
||||||
sysName = varValue;
|
sysName = varValue;
|
||||||
else if(varName == "PATH")
|
else if(varName == "PATH")
|
||||||
sysPath = varValue;
|
{
|
||||||
else if(varName == "EXTENSION")
|
if(varValue[varValue.length() - 1] == '/')
|
||||||
|
sysPath = varValue.substr(0, varValue.length() - 1);
|
||||||
|
else
|
||||||
|
sysPath = varValue;
|
||||||
|
}else if(varName == "EXTENSION")
|
||||||
sysExtension = varValue;
|
sysExtension = varValue;
|
||||||
else if(varName == "COMMAND")
|
else if(varName == "COMMAND")
|
||||||
sysCommand = varValue;
|
sysCommand = varValue;
|
||||||
//else
|
|
||||||
// std::cout << "Warning reading config file - unknown variable name \"" << varName << "\", ignoring.\n";
|
|
||||||
|
|
||||||
//we have all our variables - create the system object
|
//we have all our variables - create the system object
|
||||||
if(!sysName.empty() && !sysPath.empty() &&!sysExtension.empty() && !sysCommand.empty())
|
if(!sysName.empty() && !sysPath.empty() &&!sysExtension.empty() && !sysCommand.empty())
|
||||||
|
|
|
@ -5,7 +5,6 @@
|
||||||
#include <boost/filesystem.hpp>
|
#include <boost/filesystem.hpp>
|
||||||
|
|
||||||
//this is obviously an incredibly inefficient way to go about searching
|
//this is obviously an incredibly inefficient way to go about searching
|
||||||
//some day I may change this to use hash tables or something
|
|
||||||
//but I don't think it'll matter too much with the size of most collections
|
//but I don't think it'll matter too much with the size of most collections
|
||||||
GameData* searchFolderByPath(FolderData* folder, std::string const& path)
|
GameData* searchFolderByPath(FolderData* folder, std::string const& path)
|
||||||
{
|
{
|
||||||
|
@ -138,6 +137,13 @@ void parseGamelist(SystemData* system)
|
||||||
|
|
||||||
std::string path = pathNode.text().get();
|
std::string path = pathNode.text().get();
|
||||||
|
|
||||||
|
//expand "."
|
||||||
|
if(path[0] == '.')
|
||||||
|
{
|
||||||
|
path.erase(0, 1);
|
||||||
|
path.insert(0, system->getRootFolder()->getPath());
|
||||||
|
}
|
||||||
|
|
||||||
if(boost::filesystem::exists(path))
|
if(boost::filesystem::exists(path))
|
||||||
{
|
{
|
||||||
GameData* game = searchFolderByPath(system->getRootFolder(), path);
|
GameData* game = searchFolderByPath(system->getRootFolder(), path);
|
||||||
|
@ -153,8 +159,17 @@ void parseGamelist(SystemData* system)
|
||||||
if(gameNode.child("desc"))
|
if(gameNode.child("desc"))
|
||||||
newDesc = gameNode.child("desc").text().get();
|
newDesc = gameNode.child("desc").text().get();
|
||||||
if(gameNode.child("image"))
|
if(gameNode.child("image"))
|
||||||
|
{
|
||||||
newImage = gameNode.child("image").text().get();
|
newImage = gameNode.child("image").text().get();
|
||||||
|
|
||||||
|
//expand "."
|
||||||
|
if(newImage[0] == '.')
|
||||||
|
{
|
||||||
|
newImage.erase(0, 1);
|
||||||
|
newImage.insert(0, system->getRootFolder()->getPath());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
game->set(newName, newDesc, newImage);
|
game->set(newName, newDesc, newImage);
|
||||||
|
|
||||||
}else{
|
}else{
|
||||||
|
|
|
@ -72,6 +72,7 @@ int main(int argc, char* argv[])
|
||||||
bool running = true;
|
bool running = true;
|
||||||
|
|
||||||
//desktop uses SDL to set up an OpenGL context, and has its own SDL window...so I #ifdefed here.
|
//desktop uses SDL to set up an OpenGL context, and has its own SDL window...so I #ifdefed here.
|
||||||
|
//this should be moved to the RPi init/deinit file
|
||||||
|
|
||||||
//ALWAYS INITIALIZE VIDEO. It starts SDL's event system, and without it, input won't work.
|
//ALWAYS INITIALIZE VIDEO. It starts SDL's event system, and without it, input won't work.
|
||||||
#ifdef _RPI_
|
#ifdef _RPI_
|
||||||
|
@ -79,12 +80,16 @@ int main(int argc, char* argv[])
|
||||||
{
|
{
|
||||||
std::cerr << "Error - could not initialize SDL!\n";
|
std::cerr << "Error - could not initialize SDL!\n";
|
||||||
std::cerr << " " << SDL_GetError() << "\n";
|
std::cerr << " " << SDL_GetError() << "\n";
|
||||||
std::cerr << "Are you in the 'video' and 'input' groups? Are you running with X closed? Is your firmware up to date?\n";
|
std::cerr << "Are you in the 'video' and 'input' groups? Are you running with X closed? Is your firmware up to date? Are you using at least the 192/64 memory split?\n";
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
SDL_Surface* sdlScreen = SDL_SetVideoMode(1, 1, 0, SDL_SWSURFACE);
|
SDL_Surface* sdlScreen = SDL_SetVideoMode(1, 1, 0, SDL_SWSURFACE);
|
||||||
std::cout << "Fake SDL window is " << sdlScreen->w << "x" << sdlScreen->h << "\n";
|
if(sdlScreen == NULL)
|
||||||
|
{
|
||||||
|
std::cerr << "Error initializing SDL screen!\n";
|
||||||
|
running = false;
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
bool renderInit = Renderer::init(width, height);
|
bool renderInit = Renderer::init(width, height);
|
||||||
|
|
Loading…
Reference in a new issue