Fixed multiple file extensions breaking stuff.

Added Makefile.x86 for building on a desktop (use SDL to acquire an OpenGL rendering context).
This commit is contained in:
Aloshi 2012-09-10 13:10:59 -05:00
parent 5786ecae7c
commit e17499c9b3
8 changed files with 52 additions and 24 deletions

View file

@ -1,7 +1,7 @@
CC=g++
CFLAGS=-c -Wall -I/opt/vc/include -I/opt/vc/include/interface/vcos/pthreads -I/usr/include/freetype2 -I/usr/include/SDL -I/usr/include
CFLAGS=-c -Wall -I/opt/vc/include -I/opt/vc/include/interface/vcos/pthreads -I/usr/include/freetype2 -I/usr/include/SDL -I/usr/include -D_RPI_
LDFLAGS=-L/opt/vc/lib -lbcm_host -lEGL -lGLESv2 -lfreetype -lSDL -lboost_system -lboost_filesystem -lfreeimage
SRCSOURCES=main.cpp Renderer.cpp Renderer_init_rpi.cpp Font.cpp Renderer_draw_gl.cpp GuiComponent.cpp InputManager.cpp SystemData.cpp GameData.cpp FolderData.cpp XMLReader.cpp MathExp.cpp components/GuiGameList.cpp components/GuiInputConfig.cpp components/GuiImage.cpp components/GuiMenu.cpp components/GuiTheme.cpp pugiXML/pugixml.cpp
SRCSOURCES=main.cpp Renderer.cpp Renderer_init.cpp Font.cpp Renderer_draw_gl.cpp GuiComponent.cpp InputManager.cpp SystemData.cpp GameData.cpp FolderData.cpp XMLReader.cpp MathExp.cpp components/GuiGameList.cpp components/GuiInputConfig.cpp components/GuiImage.cpp components/GuiMenu.cpp components/GuiTheme.cpp pugiXML/pugixml.cpp
SOURCES=$(addprefix src/,$(SRCSOURCES))
OBJECTS=$(SOURCES:.cpp=.o)
EXECUTABLE=emulationstation

View file

@ -1,3 +1,7 @@
September 10
-Fixed multiple extensions breaking things.
-Added Makefile.x86 for building on a desktop (acquire OpenGL context through SDL instead of EGL).
September 8
-Added support for multiple filetypes for systems - just separate them with a space.
-Updated example systems config to include example for multiple filetypes and be a little clearer.

View file

@ -1,9 +1,9 @@
#ifndef _FONT_H_
#define _FONT_H_
#include <string>
#include <GLES/gl.h>
#include "platform.h"
#include GLHEADER
#include <ft2build.h>
#include FT_FREETYPE_H

View file

@ -1,5 +1,6 @@
#include "Renderer.h"
#include <GLES/gl.h>
#include "platform.h"
#include GLHEADER
#include <iostream>
#include "Font.h"
#include <boost/filesystem.hpp>
@ -122,8 +123,8 @@ namespace Renderer {
if(!loadedFonts)
loadFonts();
if(x < 0)
std::cout << "drawing at " << x << std::endl;
//if(x < 0)
// std::cout << "drawing at " << x << std::endl;
getFont(font)->drawText(text, x, y, color);
}

View file

@ -122,6 +122,7 @@ void SystemData::populateFolder(FolderData* folder)
std::string extension = filePath.extension().string();
std::string chkExt;
size_t extPos = 0;
do {
//now we loop through every extension in the list
size_t cpos = extPos;
@ -129,7 +130,7 @@ void SystemData::populateFolder(FolderData* folder)
chkExt = mSearchExtension.substr(cpos, ((extPos == std::string::npos) ? mSearchExtension.length() - cpos: extPos - cpos));
//if it matches, add it
if(chkExt == mSearchExtension)
if(chkExt == extension)
{
GameData* newGame = new GameData(this, filePath.string(), filePath.stem().string());
folder->pushFileData(newGame);
@ -139,7 +140,7 @@ void SystemData::populateFolder(FolderData* folder)
extPos++;
}
} while(extPos != std::string::npos && chkExt != "");
} while(extPos != std::string::npos && chkExt != "" && chkExt.find(".") != std::string::npos);
}
}
}

View file

@ -51,6 +51,7 @@ GameData* createGameFromPath(std::string gameAbsPath, SystemData* system)
unsigned int separator = 0;
unsigned int nextSeparator = 0;
unsigned int loops = 0;
while(nextSeparator != std::string::npos)
{
//determine which chunk of the path we're testing right now
@ -81,6 +82,13 @@ GameData* createGameFromPath(std::string gameAbsPath, SystemData* system)
folder->pushFileData(newFolder);
folder = newFolder;
}
if(loops > gamePath.length())
{
std::cerr << "breaking out of loop for path \"" << gamePath << "\"\n";
break;
}
loops++;
}

View file

@ -4,7 +4,8 @@
#include "../GuiComponent.h"
#include <string>
#include <FreeImage.h>
#include <GLES/gl.h>
#include "../platform.h"
#include GLHEADER
class GuiImage : public GuiComponent
{

View file

@ -7,7 +7,13 @@
#include <boost/filesystem.hpp>
#include "components/GuiInputConfig.h"
#include <SDL.h>
#include <bcm_host.h>
#include "platform.h"
#ifdef _RPI_
#include <bcm_host.h>
#endif
#include <sstream>
//these can be set by command-line arguments
@ -59,22 +65,27 @@ int main(int argc, char* argv[])
}
bcm_host_init();
#ifdef _RPI_
bcm_host_init();
#endif
bool running = true;
//ALWAYS INITIALIZE VIDEO. It starts SDL's event system, and without it, input won't work.
if(SDL_Init(SDL_INIT_VIDEO | SDL_INIT_JOYSTICK) != 0)
{
std::cerr << "Error - could not initialize SDL!\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";
return 1;
}
//desktop uses SDL to set up an OpenGL context, and has its own SDL window...so I #ifdefed here.
SDL_Surface* sdlScreen = SDL_SetVideoMode(1, 1, 0, SDL_SWSURFACE);
std::cout << "Fake SDL window is " << sdlScreen->w << "x" << sdlScreen->h << "\n";
//ALWAYS INITIALIZE VIDEO. It starts SDL's event system, and without it, input won't work.
#ifdef _RPI_
if(SDL_Init(SDL_INIT_VIDEO | SDL_INIT_JOYSTICK) != 0)
{
std::cerr << "Error - could not initialize SDL!\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";
return 1;
}
SDL_Surface* sdlScreen = SDL_SetVideoMode(1, 1, 0, SDL_SWSURFACE);
std::cout << "Fake SDL window is " << sdlScreen->w << "x" << sdlScreen->h << "\n";
#endif
bool renderInit = Renderer::init(width, height);
if(!renderInit)
@ -199,7 +210,9 @@ int main(int argc, char* argv[])
SDL_Quit();
bcm_host_deinit();
#ifdef _RPI_
bcm_host_deinit();
#endif
return 0;
}