mirror of
https://github.com/CloverHackyColor/CloverBootloader.git
synced 2025-02-25 02:32:21 +01:00
Move AnimeRun, LastDraw, CurrentFrame to FILM
This commit is contained in:
parent
22ba40a466
commit
1ec5726f01
@ -2569,7 +2569,7 @@ UINTN REFIT_MENU_SCREEN::RunMainMenu(IN INTN DefaultSelection, OUT REFIT_ABSTRAC
|
|||||||
|
|
||||||
while (!MenuExit) {
|
while (!MenuExit) {
|
||||||
GetAnime();
|
GetAnime();
|
||||||
DBG("AnimeRun=%d\n", AnimeRun?1:0);
|
DBG("AnimeRun=%d\n", FilmC->AnimeRun?1:0);
|
||||||
MenuExit = RunGenericMenu(MainStyle, &DefaultEntryIndex, &MainChosenEntry);
|
MenuExit = RunGenericMenu(MainStyle, &DefaultEntryIndex, &MainChosenEntry);
|
||||||
TimeoutSeconds = 0;
|
TimeoutSeconds = 0;
|
||||||
|
|
||||||
|
@ -85,11 +85,11 @@ public:
|
|||||||
EG_RECT OldTextBufferRect;
|
EG_RECT OldTextBufferRect;
|
||||||
XImage OldTextBufferImage;
|
XImage OldTextBufferImage;
|
||||||
BOOLEAN isBootScreen;
|
BOOLEAN isBootScreen;
|
||||||
BOOLEAN AnimeRun;
|
|
||||||
//BOOLEAN Once;
|
//BOOLEAN Once;
|
||||||
//same for xcinema
|
//same for xcinema
|
||||||
UINT64 LastDraw;
|
// BOOLEAN AnimeRun;
|
||||||
INTN CurrentFrame;
|
// UINT64 LastDraw;
|
||||||
|
// INTN CurrentFrame;
|
||||||
// INTN Frames; //there are FilmC properties
|
// INTN Frames; //there are FilmC properties
|
||||||
// UINTN FrameTime; //ms
|
// UINTN FrameTime; //ms
|
||||||
// EG_RECT FilmPlace;
|
// EG_RECT FilmPlace;
|
||||||
@ -120,26 +120,26 @@ public:
|
|||||||
|
|
||||||
|
|
||||||
REFIT_MENU_SCREEN()
|
REFIT_MENU_SCREEN()
|
||||||
: ID(0), Title(), TitleImage(),
|
: ID(0), Title(), TitleImage(),
|
||||||
TimeoutSeconds(0), TimeoutText(), ThemeName(),
|
TimeoutSeconds(0), TimeoutText(), ThemeName(),
|
||||||
OldTextBufferRect(), OldTextBufferImage(), isBootScreen(false),
|
OldTextBufferRect(), OldTextBufferImage(), isBootScreen(false),
|
||||||
AnimeRun(0), LastDraw(0), CurrentFrame(0),
|
/*AnimeRun(0), LastDraw(0), CurrentFrame(0),*/
|
||||||
FilmC(),
|
FilmC(),
|
||||||
mAction(ActionNone), mItemID(0)//, mPointer(NULL) //, StyleFunc(&REFIT_MENU_SCREEN::TextMenuStyle)
|
mAction(ActionNone), mItemID(0)//, mPointer(NULL) //, StyleFunc(&REFIT_MENU_SCREEN::TextMenuStyle)
|
||||||
{};
|
{};
|
||||||
REFIT_MENU_SCREEN(UINTN ID, XStringW TTitle, XStringW TTimeoutText)
|
REFIT_MENU_SCREEN(UINTN ID, XStringW TTitle, XStringW TTimeoutText)
|
||||||
: ID(ID), Title(TTitle), TitleImage(),
|
: ID(ID), Title(TTitle), TitleImage(),
|
||||||
TimeoutSeconds(0), TimeoutText(TTimeoutText), ThemeName(),
|
TimeoutSeconds(0), TimeoutText(TTimeoutText), ThemeName(),
|
||||||
OldTextBufferRect(), OldTextBufferImage(), isBootScreen(false),
|
OldTextBufferRect(), OldTextBufferImage(), isBootScreen(false),
|
||||||
AnimeRun(0), LastDraw(0), CurrentFrame(0),
|
/*AnimeRun(0), LastDraw(0), CurrentFrame(0),*/
|
||||||
FilmC(),
|
FilmC(),
|
||||||
mAction(ActionNone), mItemID(0)//, mPointer(NULL) //, StyleFunc(&REFIT_MENU_SCREEN::TextMenuStyle)
|
mAction(ActionNone), mItemID(0)//, mPointer(NULL) //, StyleFunc(&REFIT_MENU_SCREEN::TextMenuStyle)
|
||||||
{};
|
{};
|
||||||
//TODO exclude CHAR16
|
//TODO exclude CHAR16
|
||||||
REFIT_MENU_SCREEN(UINTN ID, CONST CHAR16* TitleC, CONST CHAR16* TimeoutTextC)
|
REFIT_MENU_SCREEN(UINTN ID, CONST CHAR16* TitleC, CONST CHAR16* TimeoutTextC)
|
||||||
: ID(ID), Title(), TitleImage(),
|
: ID(ID), Title(), TitleImage(),
|
||||||
TimeoutSeconds(0), TimeoutText(), ThemeName(), AnimeRun(0),
|
TimeoutSeconds(0), TimeoutText(), ThemeName(),
|
||||||
LastDraw(0), CurrentFrame(0),
|
/*AnimeRun(0), LastDraw(0), CurrentFrame(0),*/
|
||||||
FilmC(),
|
FilmC(),
|
||||||
mAction(ActionNone), mItemID(0)//, mPointer(NULL) //, StyleFunc(&REFIT_MENU_SCREEN::TextMenuStyle)
|
mAction(ActionNone), mItemID(0)//, mPointer(NULL) //, StyleFunc(&REFIT_MENU_SCREEN::TextMenuStyle)
|
||||||
{
|
{
|
||||||
@ -151,7 +151,7 @@ public:
|
|||||||
: ID(ID), Title(TTitle), TitleImage(),
|
: ID(ID), Title(TTitle), TitleImage(),
|
||||||
TimeoutSeconds(0), TimeoutText(TTimeoutText), ThemeName(),
|
TimeoutSeconds(0), TimeoutText(TTimeoutText), ThemeName(),
|
||||||
OldTextBufferRect(), OldTextBufferImage(), isBootScreen(false),
|
OldTextBufferRect(), OldTextBufferImage(), isBootScreen(false),
|
||||||
AnimeRun(0), LastDraw(0), CurrentFrame(0),
|
/*AnimeRun(0), LastDraw(0), CurrentFrame(0),*/
|
||||||
FilmC(),
|
FilmC(),
|
||||||
mAction(ActionNone), mItemID(0)//, mPointer(NULL) //, StyleFunc(&REFIT_MENU_SCREEN::TextMenuStyle)
|
mAction(ActionNone), mItemID(0)//, mPointer(NULL) //, StyleFunc(&REFIT_MENU_SCREEN::TextMenuStyle)
|
||||||
{
|
{
|
||||||
|
@ -31,14 +31,14 @@
|
|||||||
|
|
||||||
VOID REFIT_MENU_SCREEN::UpdateFilm()
|
VOID REFIT_MENU_SCREEN::UpdateFilm()
|
||||||
{
|
{
|
||||||
if (FilmC == nullptr || !AnimeRun) {
|
if (FilmC == nullptr || !FilmC->AnimeRun) {
|
||||||
// DBG("no anime -> run=%d\n", AnimeRun?1:0);
|
// DBG("no anime -> run=%d\n", FilmC->AnimeRun?1:0);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// here we propose each screen has own link to a Film
|
// here we propose each screen has own link to a Film
|
||||||
INT64 Now = AsmReadTsc();
|
INT64 Now = AsmReadTsc();
|
||||||
|
|
||||||
if (LastDraw == 0) {
|
if (FilmC->LastDraw == 0) {
|
||||||
DBG("=== Update Film ===\n");
|
DBG("=== Update Film ===\n");
|
||||||
DBG("FilmX=%lld\n", FilmC->FilmX);
|
DBG("FilmX=%lld\n", FilmC->FilmX);
|
||||||
DBG("ID=%lld\n", FilmC->GetIndex());
|
DBG("ID=%lld\n", FilmC->GetIndex());
|
||||||
@ -50,7 +50,7 @@ VOID REFIT_MENU_SCREEN::UpdateFilm()
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (TimeDiff(LastDraw, Now) < (UINTN)FilmC->FrameTime) return;
|
if (TimeDiff(FilmC->LastDraw, Now) < (UINTN)FilmC->FrameTime) return;
|
||||||
|
|
||||||
XImage Frame = FilmC->GetImage(); //take current image
|
XImage Frame = FilmC->GetImage(); //take current image
|
||||||
if (!Frame.isEmpty()) {
|
if (!Frame.isEmpty()) {
|
||||||
@ -58,9 +58,9 @@ VOID REFIT_MENU_SCREEN::UpdateFilm()
|
|||||||
}
|
}
|
||||||
FilmC->Advance(); //next frame no matter if previous was not found
|
FilmC->Advance(); //next frame no matter if previous was not found
|
||||||
if (FilmC->Finished()) { //first loop finished
|
if (FilmC->Finished()) { //first loop finished
|
||||||
AnimeRun = !FilmC->RunOnce; //will stop anime if it set as RunOnce
|
FilmC->AnimeRun = !FilmC->RunOnce; //will stop anime if it set as RunOnce
|
||||||
}
|
}
|
||||||
LastDraw = Now;
|
FilmC->LastDraw = Now;
|
||||||
}
|
}
|
||||||
|
|
||||||
FILM* XCinema::GetFilm(INTN Id)
|
FILM* XCinema::GetFilm(INTN Id)
|
||||||
|
@ -27,7 +27,7 @@ protected:
|
|||||||
INTN Id; //ScreenID, enumeration value but keep it to be int for extensibility
|
INTN Id; //ScreenID, enumeration value but keep it to be int for extensibility
|
||||||
public:
|
public:
|
||||||
//I see no reason to make they protected
|
//I see no reason to make they protected
|
||||||
bool RunOnce;
|
BOOLEAN RunOnce;
|
||||||
INTN NumFrames; //set by user in Theme.plist or in Theme.svg
|
INTN NumFrames; //set by user in Theme.plist or in Theme.svg
|
||||||
INTN FrameTime; //usually 50, 100, 200 ms
|
INTN FrameTime; //usually 50, 100, 200 ms
|
||||||
INTN FilmX, FilmY; //relative
|
INTN FilmX, FilmY; //relative
|
||||||
@ -35,19 +35,22 @@ public:
|
|||||||
INTN ScreenEdgeVertical;
|
INTN ScreenEdgeVertical;
|
||||||
INTN NudgeX, NudgeY;
|
INTN NudgeX, NudgeY;
|
||||||
XStringW Path; //user defined name for folder and files Path/Path_002.png etc
|
XStringW Path; //user defined name for folder and files Path/Path_002.png etc
|
||||||
|
BOOLEAN AnimeRun;
|
||||||
|
UINT64 LastDraw;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
XObjArray<IndexedImage> Frames; //Frames can be not sorted
|
XObjArray<IndexedImage> Frames; //Frames can be not sorted
|
||||||
INTN LastIndex; // it is not Frames.size(), it is last index inclusive, so frames 0,1,2,5,8 be LastIndex = 8
|
INTN LastIndex; // it is not Frames.size(), it is last index inclusive, so frames 0,1,2,5,8 be LastIndex = 8
|
||||||
INTN CurrentFrame; // must be unique for each film
|
INTN CurrentFrame; // must be unique for each film
|
||||||
|
|
||||||
public:
|
public:
|
||||||
EG_RECT FilmPlace; // Screen has several Films each in own place
|
EG_RECT FilmPlace; // Screen has several Films each in own place
|
||||||
|
|
||||||
public:
|
public:
|
||||||
FILM() {}
|
FILM() : AnimeRun(0), LastDraw(0), CurrentFrame(0)
|
||||||
FILM(INTN Id) : Id(Id), RunOnce(false), NumFrames(0)
|
{}
|
||||||
{}
|
FILM(INTN Id) : Id(Id), RunOnce(FALSE), NumFrames(0), AnimeRun(0), LastDraw(0), CurrentFrame(0)
|
||||||
|
{}
|
||||||
~FILM() {}
|
~FILM() {}
|
||||||
|
|
||||||
INTN GetIndex() { return Id; }
|
INTN GetIndex() { return Id; }
|
||||||
|
@ -414,7 +414,7 @@ void REFIT_MENU_SCREEN::GetAnime()
|
|||||||
FilmC = ThemeX.Cinema.GetFilm(ID);
|
FilmC = ThemeX.Cinema.GetFilm(ID);
|
||||||
// DBG("ScreenID=%lld Film found=%d\n", ID, (FilmC != nullptr)?1:0);
|
// DBG("ScreenID=%lld Film found=%d\n", ID, (FilmC != nullptr)?1:0);
|
||||||
if (FilmC != nullptr) {
|
if (FilmC != nullptr) {
|
||||||
AnimeRun = true;
|
FilmC->AnimeRun = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -425,7 +425,7 @@ VOID REFIT_MENU_SCREEN::InitAnime()
|
|||||||
}
|
}
|
||||||
if (FilmC == nullptr) {
|
if (FilmC == nullptr) {
|
||||||
DBG("Screen %lld inited without anime\n", ID);
|
DBG("Screen %lld inited without anime\n", ID);
|
||||||
AnimeRun = FALSE;
|
FilmC->AnimeRun = FALSE;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// DBG("=== Debug Film ===\n");
|
// DBG("=== Debug Film ===\n");
|
||||||
@ -467,9 +467,9 @@ VOID REFIT_MENU_SCREEN::InitAnime()
|
|||||||
}
|
}
|
||||||
if (FilmC->NumFrames != 0) {
|
if (FilmC->NumFrames != 0) {
|
||||||
DBG(" Anime seems OK, init it\n");
|
DBG(" Anime seems OK, init it\n");
|
||||||
AnimeRun = TRUE;
|
FilmC->AnimeRun = TRUE;
|
||||||
FilmC->Reset();
|
FilmC->Reset();
|
||||||
LastDraw = 0;
|
FilmC->LastDraw = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user