diff --git a/Makefile b/Makefile index 2d20becc7..cc0e2c077 100644 --- a/Makefile +++ b/Makefile @@ -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 diff --git a/changelog.txt b/changelog.txt index 80b2949a2..f8e5c2354 100644 --- a/changelog.txt +++ b/changelog.txt @@ -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. diff --git a/src/Font.h b/src/Font.h index 065026556..4311006c6 100644 --- a/src/Font.h +++ b/src/Font.h @@ -1,9 +1,9 @@ - #ifndef _FONT_H_ #define _FONT_H_ #include -#include +#include "platform.h" +#include GLHEADER #include #include FT_FREETYPE_H diff --git a/src/Renderer_draw_gl.cpp b/src/Renderer_draw_gl.cpp index de1012383..6b76c6017 100644 --- a/src/Renderer_draw_gl.cpp +++ b/src/Renderer_draw_gl.cpp @@ -1,5 +1,6 @@ #include "Renderer.h" -#include +#include "platform.h" +#include GLHEADER #include #include "Font.h" #include @@ -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); } diff --git a/src/SystemData.cpp b/src/SystemData.cpp index ef2d64caf..ae5014f6d 100644 --- a/src/SystemData.cpp +++ b/src/SystemData.cpp @@ -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); } } } diff --git a/src/XMLReader.cpp b/src/XMLReader.cpp index 48694d21b..4e1874dc7 100644 --- a/src/XMLReader.cpp +++ b/src/XMLReader.cpp @@ -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++; } diff --git a/src/components/GuiImage.h b/src/components/GuiImage.h index e9c4cfd09..6c55a9f32 100644 --- a/src/components/GuiImage.h +++ b/src/components/GuiImage.h @@ -4,7 +4,8 @@ #include "../GuiComponent.h" #include #include -#include +#include "../platform.h" +#include GLHEADER class GuiImage : public GuiComponent { diff --git a/src/main.cpp b/src/main.cpp index e58425824..a340cfbe0 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -7,7 +7,13 @@ #include #include "components/GuiInputConfig.h" #include -#include + +#include "platform.h" + +#ifdef _RPI_ + #include +#endif + #include //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; }