From 262114ba9945a74985e52253a19ad6dc802f1178 Mon Sep 17 00:00:00 2001 From: emb <> Date: Tue, 3 Feb 2015 21:35:38 -0600 Subject: [PATCH] Fixed menuIndex tween sets (was not picking right xml sibling). --- .../Graphics/Component/ReloadableMedia.cpp | 1 + .../Graphics/Component/ScrollingList.cpp | 2 +- RetroFE/Source/Graphics/PageBuilder.cpp | 2 +- RetroFE/Source/RetroFE.cpp | 40 +++++-------------- RetroFE/Source/RetroFE.h | 4 +- RetroFE/Source/Video/GStreamerVideo.cpp | 4 +- RetroFE/Source/Video/VideoFactory.h | 2 +- 7 files changed, 18 insertions(+), 37 deletions(-) diff --git a/RetroFE/Source/Graphics/Component/ReloadableMedia.cpp b/RetroFE/Source/Graphics/Component/ReloadableMedia.cpp index b1bc67d..35500a2 100644 --- a/RetroFE/Source/Graphics/Component/ReloadableMedia.cpp +++ b/RetroFE/Source/Graphics/Component/ReloadableMedia.cpp @@ -57,6 +57,7 @@ void ReloadableMedia::Update(float dt) // wait for the right moment to reload the image if (ReloadRequested && (HighlightExitComplete || FirstLoad)) { + ReloadTexture(); ReloadRequested = false; FirstLoad = false; diff --git a/RetroFE/Source/Graphics/Component/ScrollingList.cpp b/RetroFE/Source/Graphics/Component/ScrollingList.cpp index e224b6d..ea2248e 100644 --- a/RetroFE/Source/Graphics/Component/ScrollingList.cpp +++ b/RetroFE/Source/Graphics/Component/ScrollingList.cpp @@ -455,7 +455,7 @@ void ScrollingList::Update(float dt) CircularIncrement(spriteIndex, SpriteList); } - if(scrollStopped || scrollChanged) + if(scrollStopped) { ComponentItemBinding *sprite = GetPendingCollectionItemSprite(); Item *item = NULL; diff --git a/RetroFE/Source/Graphics/PageBuilder.cpp b/RetroFE/Source/Graphics/PageBuilder.cpp index b91e55c..320d96a 100644 --- a/RetroFE/Source/Graphics/PageBuilder.cpp +++ b/RetroFE/Source/Graphics/PageBuilder.cpp @@ -473,7 +473,7 @@ TweenSet *PageBuilder::CreateTweenInstance(xml_node<> *componentXml) void PageBuilder::BuildTweenSets(TweenSet *tweens, xml_node<> *componentXml, std::string tagName, std::string tweenName) { - for(componentXml = componentXml->first_node(tagName.c_str()); componentXml; componentXml = componentXml->next_sibling(tweenName.c_str())) + for(componentXml = componentXml->first_node(tagName.c_str()); componentXml; componentXml = componentXml->next_sibling(tagName.c_str())) { xml_attribute<> *indexXml = componentXml->first_attribute("menuIndex"); int index = (indexXml) ? Utils::ConvertInt(indexXml->value()) : -1; diff --git a/RetroFE/Source/RetroFE.cpp b/RetroFE/Source/RetroFE.cpp index 5eb324e..8bd94b2 100644 --- a/RetroFE/Source/RetroFE.cpp +++ b/RetroFE/Source/RetroFE.cpp @@ -75,8 +75,6 @@ int RetroFE::Initialize(void *context) RetroFE *instance = static_cast(context); Logger::Write(Logger::ZONE_INFO, "RetroFE", "Initializing"); - bool videoEnable = true; - int videoLoop = 0; if(!instance->Input.Initialize()) return -1; @@ -96,12 +94,6 @@ int RetroFE::Initialize(void *context) return -1; } - instance->Config.GetProperty("videoEnable", videoEnable); - instance->Config.GetProperty("videoLoop", videoLoop); - - VideoFactory::SetEnabled(videoEnable); - VideoFactory::SetNumLoops(videoLoop); - instance->Initialized = true; return 0; } @@ -188,6 +180,16 @@ void RetroFE::Run() FC.Initialize(); + bool videoEnable = true; + int videoLoop = 0; + Config.GetProperty("videoEnable", videoEnable); + Config.GetProperty("videoLoop", videoLoop); + + VideoFactory::SetEnabled(videoEnable); + VideoFactory::SetNumLoops(videoLoop); + VideoFactory::CreateVideo(); // pre-initialize the gstreamer engine + + InitializeThread = SDL_CreateThread(Initialize, "RetroFEInit", (void *)this); if(!InitializeThread) @@ -442,28 +444,6 @@ RetroFE::RETROFE_STATE RetroFE::ProcessUserInput(Page *page) return state; } -void RetroFE::WaitToInitialize() -{ - Logger::Write(Logger::ZONE_INFO, "RetroFE", "Loading splash screen"); - - PageBuilder pb("splash", Config, &FC); - Page * page = pb.BuildPage(); - - while(!Initialized) - { - SDL_SetRenderDrawColor(SDL::GetRenderer(), 0x0, 0x0, 0x00, 0xFF); - SDL_RenderClear(SDL::GetRenderer()); - - page->Draw(); - SDL_RenderPresent(SDL::GetRenderer()); - } - - int status = 0; - delete page; - SDL_WaitThread(InitializeThread, &status); -} - - Page *RetroFE::LoadPage() { std::string layoutName; diff --git a/RetroFE/Source/RetroFE.h b/RetroFE/Source/RetroFE.h index ae6fbbf..558fa05 100644 --- a/RetroFE/Source/RetroFE.h +++ b/RetroFE/Source/RetroFE.h @@ -22,6 +22,7 @@ #include "Execute/AttractMode.h" #include "Graphics/FontCache.h" #include "Video/IVideo.h" +#include "Video/VideoFactory.h" #include #include #include @@ -42,7 +43,7 @@ public: void LaunchEnter(); void LaunchExit(); private: - bool Initialized; + volatile bool Initialized; SDL_Thread *InitializeThread; static int Initialize(void *context); @@ -60,7 +61,6 @@ private: void Render(); bool Back(bool &exit); void Quit(); - void WaitToInitialize(); Page *LoadPage(); Page *LoadSplashPage(); RETROFE_STATE ProcessUserInput(Page *page); diff --git a/RetroFE/Source/Video/GStreamerVideo.cpp b/RetroFE/Source/Video/GStreamerVideo.cpp index 3886cf7..69145d9 100644 --- a/RetroFE/Source/Video/GStreamerVideo.cpp +++ b/RetroFE/Source/Video/GStreamerVideo.cpp @@ -129,7 +129,7 @@ void GStreamerVideo::ProcessNewBuffer (GstElement *fakesink, GstBuffer *buf, Gst bool GStreamerVideo::Initialize() { - bool retVal = true; + if(Initialized) { return true; } std::string path = Configuration::GetAbsolutePath() + "/Core"; gst_init(NULL, NULL); @@ -141,7 +141,7 @@ bool GStreamerVideo::Initialize() Initialized = true; - return retVal; + return true; } bool GStreamerVideo::DeInitialize() diff --git a/RetroFE/Source/Video/VideoFactory.h b/RetroFE/Source/Video/VideoFactory.h index 8d11094..53eadec 100644 --- a/RetroFE/Source/Video/VideoFactory.h +++ b/RetroFE/Source/Video/VideoFactory.h @@ -20,7 +20,7 @@ class IVideo; class VideoFactory { public: - IVideo *CreateVideo(); + static IVideo *CreateVideo(); static void SetEnabled(bool enabled); static void SetNumLoops(int numLoops);