From 790fedbdc6ab50e182c87c3b94abc8df26c36e6b Mon Sep 17 00:00:00 2001 From: Sergey Isakov Date: Thu, 9 Apr 2020 09:04:21 +0300 Subject: [PATCH] initial support for cinema Signed-off-by: Sergey Isakov --- Xcode/Clover/Clover.xcodeproj/project.pbxproj | 6 ++ rEFIt_UEFI/libeg/XCinema.cpp | 9 +++ rEFIt_UEFI/libeg/XCinema.h | 75 +++++++++++++++++++ rEFIt_UEFI/libeg/XTheme.cpp | 2 +- 4 files changed, 91 insertions(+), 1 deletion(-) create mode 100644 rEFIt_UEFI/libeg/XCinema.cpp create mode 100644 rEFIt_UEFI/libeg/XCinema.h diff --git a/Xcode/Clover/Clover.xcodeproj/project.pbxproj b/Xcode/Clover/Clover.xcodeproj/project.pbxproj index cf59b1d9f..2e9f04f7e 100644 --- a/Xcode/Clover/Clover.xcodeproj/project.pbxproj +++ b/Xcode/Clover/Clover.xcodeproj/project.pbxproj @@ -1547,6 +1547,7 @@ A5AAFD6F237F13B4009CD413 /* DumpDynPcd.c in Sources */ = {isa = PBXBuildFile; fileRef = A5AAFB06237F13B3009CD413 /* DumpDynPcd.c */; }; A5AAFD70237F13B4009CD413 /* VariableInfo.c in Sources */ = {isa = PBXBuildFile; fileRef = A5AAFB0B237F13B3009CD413 /* VariableInfo.c */; }; A5AAFD71237F13B4009CD413 /* SmiHandlerProfileInfo.c in Sources */ = {isa = PBXBuildFile; fileRef = A5AAFB10237F13B3009CD413 /* SmiHandlerProfileInfo.c */; }; + A5C219B7243ED7AA00036F7B /* XCinema.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A5C219B5243ED7AA00036F7B /* XCinema.cpp */; }; A5D12C22243A0B6500DFA98A /* LoadOptions_test.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A5D12C20243A0B6400DFA98A /* LoadOptions_test.cpp */; }; A5D12C2C243A0B7900DFA98A /* poolprint-test.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A5D12C23243A0B7500DFA98A /* poolprint-test.cpp */; }; A5D12C2D243A0B7900DFA98A /* printlib-test.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A5D12C26243A0B7700DFA98A /* printlib-test.cpp */; }; @@ -5954,6 +5955,8 @@ A5AAFFFD237F13BE009CD413 /* SwitchStack.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SwitchStack.c; sourceTree = ""; }; A5AAFFFE237F13BE009CD413 /* SetJumpLongJump.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SetJumpLongJump.c; sourceTree = ""; }; A5AAFFFF237F13BE009CD413 /* SpeculationBarrier.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SpeculationBarrier.c; sourceTree = ""; }; + A5C219B5243ED7AA00036F7B /* XCinema.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = XCinema.cpp; sourceTree = ""; }; + A5C219B8243ED7EA00036F7B /* XCinema.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = XCinema.h; sourceTree = ""; }; A5D12C1C243A0B0B00DFA98A /* bootscreen.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = bootscreen.h; sourceTree = ""; }; A5D12C1D243A0B1B00DFA98A /* common.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = common.h; sourceTree = ""; }; A5D12C1E243A0B2700DFA98A /* loader.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = loader.h; sourceTree = ""; }; @@ -6205,6 +6208,8 @@ A5D12C36243A0C2300DFA98A /* VectorGraphics.h */, A571C28B240574D900B6A2C5 /* XImage.cpp */, A571C28C240574D900B6A2C5 /* XImage.h */, + A5C219B5243ED7AA00036F7B /* XCinema.cpp */, + A5C219B8243ED7EA00036F7B /* XCinema.h */, A570FB0B240D626C0057F26D /* XPointer.cpp */, A570FB0C240D626D0057F26D /* XPointer.h */, A57CF7B9241A8A12006DE51E /* XTheme.cpp */, @@ -16566,6 +16571,7 @@ A5AAFD46237F13B4009CD413 /* GuidedSectionExtraction.c in Sources */, A5AA04F1237F13C1009CD413 /* ReadDr6.nasm in Sources */, A5AAFBA7237F13B3009CD413 /* regtrav.c in Sources */, + A5C219B7243ED7AA00036F7B /* XCinema.cpp in Sources */, A5AA0613237F13C2009CD413 /* SynchronizationMsc.c in Sources */, A5AA051D237F13C1009CD413 /* WriteDr0.nasm in Sources */, A5AA074E237F13C3009CD413 /* IsZeroBuffer.nasm in Sources */, diff --git a/rEFIt_UEFI/libeg/XCinema.cpp b/rEFIt_UEFI/libeg/XCinema.cpp new file mode 100644 index 000000000..ba300ac5d --- /dev/null +++ b/rEFIt_UEFI/libeg/XCinema.cpp @@ -0,0 +1,9 @@ +// +// XCinema.cpp +// Clover +// +// Created by Sergey Isakov on 09/04/2020. +// Copyright © 2020 Slice. All rights reserved. +// + +#include "XCinema.h" diff --git a/rEFIt_UEFI/libeg/XCinema.h b/rEFIt_UEFI/libeg/XCinema.h new file mode 100644 index 000000000..e5438ffc3 --- /dev/null +++ b/rEFIt_UEFI/libeg/XCinema.h @@ -0,0 +1,75 @@ +// +// XCinema.hpp +// Clover +// +// Created by Sergey Isakov on 09/04/2020. +// Copyright © 2020 Slice. All rights reserved. +// + +#ifndef XCinema_h +#define XCinema_h + +extern "C" { +#include +} +#include "../cpp_foundation/XToolsCommon.h" +#include "../cpp_foundation/XArray.h" +#include "../cpp_foundation/XStringW.h" +#include "../libeg/libeg.h" +#include "XImage.h" + +typedef struct FRAME { + INTN Index; + XImage Image; +} FRAME; + +class FILM +{ +protected: + INTN Id; //enumeration value but keep it to be int for extensibility + INTN FrameTime; //usually 50, 100, 200 ms + XString Path; //user defined name for folder and files Path/Path_002.png etc + XArray Frames; + INTN Count; // it is not Frames.size(), it is last index + +public: + FILM(); + FILM(INTN Id); + ~FILM(); + + const XImage& GetImage(INTN Index); + void AddImage(const XImage& Image, INTN Index); + size_t Size() { return Frames.size(); } + INTN LastFrame() { return Count; } + void GetFilm(const XStringW& Path); //read from Theme + +}; + +//initially it was supposed to be one anime per one REFIT_SCREEN +// but this leads to large delays switching screens to initialize Film sequence again and again +// otherwise anime depends on theme and should be a member or XTheme +// then it should contain Screen->ID for each film +// but for next future we want to have other animated images except screen->titleimage +// so let it be frames arrays each with own purpose (Id) +// XTheme contains Cinema +// Each Screen contains a pointer to FILM. And moreover titleFilm, or BackgroundFilm or even entryFilm +// Next problem is a timeout between frames. +// A theme contains images with indexes 1,2,5,6 for one Id. +// This Id contains fixed timeout between frames +class XCinema +{ + protected: + XArray Cinema; + + + public: + XCinema(); + ~XCinema(); + + FILM* GetFilm(INTN Id); + void AddFilm(const FILM& NewFilm, INTN Id); + + +}; + +#endif /* XCinema_h */ diff --git a/rEFIt_UEFI/libeg/XTheme.cpp b/rEFIt_UEFI/libeg/XTheme.cpp index e044727a7..8d6999f17 100644 --- a/rEFIt_UEFI/libeg/XTheme.cpp +++ b/rEFIt_UEFI/libeg/XTheme.cpp @@ -379,7 +379,7 @@ const XImage& XTheme::LoadOSIcon(const XString& Full) // DBG(" first=%s\n", First.c_str()); if (!ReturnImage->isEmpty()) return *ReturnImage; //else search second name - Second = "os_"_XS + Full.SubString(Comma+1, Size - Comma - 1); + Second = "os_"_XS + Full.SubString(Comma + 1, Size - Comma - 1); //moreover names can be triple L"chrome,grub,linux" UINTN SecondComma = Second.IdxOf(','); if (Comma == MAX_XSIZE) {