diff --git a/rEFIt_UEFI/Platform/Settings.cpp b/rEFIt_UEFI/Platform/Settings.cpp index c79f25503..4d0611f0d 100644 --- a/rEFIt_UEFI/Platform/Settings.cpp +++ b/rEFIt_UEFI/Platform/Settings.cpp @@ -861,11 +861,11 @@ CUSTOM_LOADER_ENTRY DuplicateEntry->Options = Entry->Options; - if (Entry->FullTitle != NULL) { + if (Entry->FullTitle.notEmpty()) { DuplicateEntry->FullTitle = Entry->FullTitle; } - if (Entry->Title != NULL) { + if (Entry->Title.notEmpty()) { DuplicateEntry->Title = Entry->Title; } diff --git a/rEFIt_UEFI/cpp_foundation/XStringW.h b/rEFIt_UEFI/cpp_foundation/XStringW.h index cb34b82d2..51d975bc8 100755 --- a/rEFIt_UEFI/cpp_foundation/XStringW.h +++ b/rEFIt_UEFI/cpp_foundation/XStringW.h @@ -178,28 +178,28 @@ public: // == operator friend bool operator == (const XStringW& s1, const XStringW& s2) { return s1.Compare(s2._data(0)) == 0; } - friend bool operator == (const XStringW& s1, const wchar_t* s2 ) { return s1.Compare(s2) == 0; } - friend bool operator == (const wchar_t* s1, const XStringW& s2) { return s2.Compare(s1) == 0; } +// friend bool operator == (const XStringW& s1, const wchar_t* s2 ) { return s1.Compare(s2) == 0; } +// friend bool operator == (const wchar_t* s1, const XStringW& s2) { return s2.Compare(s1) == 0; } friend bool operator != (const XStringW& s1, const XStringW& s2) { return s1.Compare(s2._data(0)) != 0; } - friend bool operator != (const XStringW& s1, const wchar_t* s2 ) { return s1.Compare(s2) != 0; } - friend bool operator != (const wchar_t* s1, const XStringW& s2) { return s2.Compare(s1) != 0; } +// friend bool operator != (const XStringW& s1, const wchar_t* s2 ) { return s1.Compare(s2) != 0; } +// friend bool operator != (const wchar_t* s1, const XStringW& s2) { return s2.Compare(s1) != 0; } friend bool operator < (const XStringW& s1, const XStringW& s2) { return s1.Compare(s2._data(0)) < 0; } - friend bool operator < (const XStringW& s1, const wchar_t* s2 ) { return s1.Compare(s2) < 0; } - friend bool operator < (const wchar_t* s1, const XStringW& s2) { return s2.Compare(s1) > 0; } +// friend bool operator < (const XStringW& s1, const wchar_t* s2 ) { return s1.Compare(s2) < 0; } +// friend bool operator < (const wchar_t* s1, const XStringW& s2) { return s2.Compare(s1) > 0; } friend bool operator > (const XStringW& s1, const XStringW& s2) { return s1.Compare(s2._data(0)) > 0; } - friend bool operator > (const XStringW& s1, const wchar_t* s2 ) { return s1.Compare(s2) > 0; } - friend bool operator > (const wchar_t* s1, const XStringW& s2) { return s2.Compare(s1) < 0; } +// friend bool operator > (const XStringW& s1, const wchar_t* s2 ) { return s1.Compare(s2) > 0; } +// friend bool operator > (const wchar_t* s1, const XStringW& s2) { return s2.Compare(s1) < 0; } friend bool operator <= (const XStringW& s1, const XStringW& s2) { return s1.Compare(s2._data(0)) <= 0; } - friend bool operator <= (const XStringW& s1, const wchar_t* s2 ) { return s1.Compare(s2) <= 0; } - friend bool operator <= (const wchar_t* s1, const XStringW& s2) { return s2.Compare(s1) >= 0; } +// friend bool operator <= (const XStringW& s1, const wchar_t* s2 ) { return s1.Compare(s2) <= 0; } +// friend bool operator <= (const wchar_t* s1, const XStringW& s2) { return s2.Compare(s1) >= 0; } friend bool operator >= (const XStringW& s1, const XStringW& s2) { return s1.Compare(s2._data(0)) >= 0; } - friend bool operator >= (const XStringW& s1, const wchar_t* s2 ) { return s1.Compare(s2) >= 0; } - friend bool operator >= (const wchar_t* s1, const XStringW& s2) { return s2.Compare(s1) <= 0; } +// friend bool operator >= (const XStringW& s1, const wchar_t* s2 ) { return s1.Compare(s2) >= 0; } +// friend bool operator >= (const wchar_t* s1, const XStringW& s2) { return s2.Compare(s1) <= 0; } static wchar_t to_lower(wchar_t ch) { if (ch <= L'Z') diff --git a/rEFIt_UEFI/cpp_unit_test/XStringWArray_test.cpp b/rEFIt_UEFI/cpp_unit_test/XStringWArray_test.cpp index f7b2c3c84..d153f6f61 100644 --- a/rEFIt_UEFI/cpp_unit_test/XStringWArray_test.cpp +++ b/rEFIt_UEFI/cpp_unit_test/XStringWArray_test.cpp @@ -10,16 +10,16 @@ int XStringWArray_tests() #endif XStringWArray array1; - + if ( !array1.IsNull() ) return 1; - + array1.Add(L"1"_XSW); if ( array1.IsNull() ) return 2; array1.Add(L"2"_XSW); - if ( array1[0] != L"1" ) return 3; - if ( array1[1] != L"2" ) return 4; - + if ( array1[0] != L"1"_XSW ) return 3; + if ( array1[1] != L"2"_XSW ) return 4; + if ( !array1.Contains(L"2"_XSW) ) return 5; // Test == and != @@ -27,15 +27,15 @@ int XStringWArray_tests() XStringWArray array1bis; array1bis.Add(L"1"_XSW); array1bis.Add(L"2"_XSW); - + if ( !(array1 == array1bis) ) return 10; if ( array1 != array1bis ) return 11; } - + // Test concat and Split { XStringW c = array1.ConcatAll(L", "_XSW, L"^"_XSW, L"$"_XSW); - if ( c != L"^1, 2$" ) return 1; + if ( c != L"^1, 2$"_XSW ) return 1; // Split doesn't handle prefix and suffix yet. c = array1.ConcatAll(L", "_XSW); @@ -48,13 +48,13 @@ int XStringWArray_tests() array2.Add(L"2"_XSW); array2.Add(L"1"_XSW); - if ( array2[0] != L"2" ) return 30; - if ( array2[1] != L"1" ) return 31; + if ( array2[0] != L"2"_XSW ) return 30; + if ( array2[1] != L"1"_XSW ) return 31; if ( array1 == array2 ) return 40; // Array != because order is different if ( !array1.Same(array2) ) return 41; // Arrays are the same - + array1.AddNoNull(L"3"_XSW); if ( array1.size() != 3 ) return 50; array1.AddNoNull(L""_XSW); diff --git a/rEFIt_UEFI/cpp_unit_test/XStringW_test.cpp b/rEFIt_UEFI/cpp_unit_test/XStringW_test.cpp index 77cf97eac..7fb0f3bdf 100755 --- a/rEFIt_UEFI/cpp_unit_test/XStringW_test.cpp +++ b/rEFIt_UEFI/cpp_unit_test/XStringW_test.cpp @@ -17,8 +17,8 @@ int XStringW_tests() // DebugLog(2, "XStringW_tests -> Enter\n"); #endif - if ( global_str3 != L"global_str3" ) return 1; - if ( global_str4 != L"global_str4" ) return 2; + if ( global_str3 != L"global_str3"_XSW ) return 1; + if ( global_str4 != L"global_str4"_XSW ) return 2; // Check default ctor { @@ -46,9 +46,9 @@ int XStringW_tests() str.takeValueFrom(""); if (str.size() != 0) return 110; str.takeValueFrom("1"); - if ( str != L"1" ) return 111; + if ( str != L"1"_XSW ) return 111; str.StrCat(L"2"); - if ( str != L"12" ) return 112; + if ( str != L"12"_XSW ) return 112; } #endif @@ -86,13 +86,13 @@ int XStringW_tests() XStringW str2; if ( !str2.isEmpty() ) return 10; str2.StrnCpy(str.data(), 2); - if ( str2 != L"12" ) return 11; + if ( str2 != L"12"_XSW ) return 11; str2.StrnCat(L"345", 2); - if ( str2 != L"1234" ) return 12; + if ( str2 != L"1234"_XSW ) return 12; str2.Insert(1, str); - if ( str2 != L"112234" ) return 13; + if ( str2 != L"112234"_XSW ) return 13; str2 += L"6"; - if ( str2 != L"1122346" ) return 14; + if ( str2 != L"1122346"_XSW ) return 14; } //wchar_t c2 = L'Ň'; @@ -100,9 +100,9 @@ int XStringW_tests() //const char* s1 = "𐌾"; XStringW str2; str2.SWPrintf("%c", 'a'); // signle UTF8 ascii char - if ( str2 != L"a" ) return 20; + if ( str2 != L"a"_XSW ) return 20; str2.takeValueFrom(L"ab"); // UTF16(32) string containing ascii char - if ( str2 != L"ab" ) return 21; + if ( str2 != L"ab"_XSW ) return 21; #ifdef _MSC_VER // IMPORTANT : you can't pass a litteral char in a vararg function with Visual Studio (Microsoft strikes again :-). // At least, you got a warning C4066 @@ -123,7 +123,7 @@ int XStringW_tests() if (str2 != s) return 23; #else str2.SWPrintf("%lc", L'Ň'); // signe UTF16(32) char. (2 bytes in total if UTF16) - if ( str2 != L"Ň" ) return 22; + if ( str2 != L"Ň"_XSW ) return 22; str2.takeValueFrom(""); if (str2.size() != 0) return 221; #ifdef XSTRINGW_HAS_CTOR_LITTERAL @@ -148,9 +148,9 @@ int XStringW_tests() // "𐌾" in UTF16 is 2 char : 0xd800, 0xdf3e str2.takeValueFrom(L"𐌾"); // this is a UTF8 string 4 bytes long - if ( str2 != L"𐌾" ) return 31; + if ( str2 != L"𐌾"_XSW ) return 31; str2.takeValueFrom(L"𐌾"); // this is a UTF16 or UTF32 string (depending of -fshort-wchar) - if ( str2 != L"𐌾" ) return 32; + if ( str2 != L"𐌾"_XSW ) return 32; #ifdef XSTRINGW_HAS_CTOR_LITTERAL { @@ -180,7 +180,7 @@ int XStringW_tests() #ifndef _MSC_VER wchar_t* s = XStringW().takeValueFrom("aa").forgetDataWithoutFreeing(); - if ( s != L"aa"_XSW ) return 102; + if ( memcmp(s, L"aa", sizeof(L"aa")*sizeof(wchar_t) ) == 0 ) return 102; // sizeof(L"aa") include null terminator #endif // XStringW CommonName(L"EFI\\CLOVER\\misc\\screenshot"); // for (UINTN Index = 0; Index < 20; Index++) { diff --git a/rEFIt_UEFI/entry_scan/loader.cpp b/rEFIt_UEFI/entry_scan/loader.cpp index b25dce223..37a4ea2ed 100644 --- a/rEFIt_UEFI/entry_scan/loader.cpp +++ b/rEFIt_UEFI/entry_scan/loader.cpp @@ -2011,7 +2011,7 @@ STATIC VOID AddCustomEntry(IN UINTN CustomIndex, // REFIT_MENU_SCREEN *SubScreen = (__typeof__(SubScreen))AllocateZeroPool(sizeof(REFIT_MENU_SCREEN)); REFIT_MENU_SCREEN *SubScreen = new REFIT_MENU_SCREEN; if (SubScreen) { - SubScreen->Title.SWPrintf("Boot Options for %ls on %ls", (Custom->Title != NULL) ? Custom->Title.wc_str() : CustomPath, Entry->VolName); + SubScreen->Title.SWPrintf("Boot Options for %ls on %ls", (Custom->Title.notEmpty()) ? Custom->Title.wc_str() : CustomPath, Entry->VolName); SubScreen->TitleImage = Entry->Image; SubScreen->ID = Custom->Type + 20; SubScreen->GetAnime(); diff --git a/rEFIt_UEFI/gui/REFIT_MENU_SCREEN.cpp b/rEFIt_UEFI/gui/REFIT_MENU_SCREEN.cpp index ca11f2ec8..69fb638f9 100644 --- a/rEFIt_UEFI/gui/REFIT_MENU_SCREEN.cpp +++ b/rEFIt_UEFI/gui/REFIT_MENU_SCREEN.cpp @@ -1592,11 +1592,11 @@ VOID REFIT_MENU_SCREEN::GraphicsMenuStyle(IN UINTN Function, IN CONST CHAR16 *Pa TitleImage.Draw(FilmXPos, FilmYPos); // update FilmPlace only if not set by InitAnime - if (FilmPlace.Width == 0 || FilmPlace.Height == 0) { - FilmPlace.XPos = FilmXPos; - FilmPlace.YPos = FilmYPos; - FilmPlace.Width = TitleImage.GetWidth(); - FilmPlace.Height = TitleImage.GetHeight(); + if (FilmC->FilmPlace.Width == 0 || FilmC->FilmPlace.Height == 0) { + FilmC->FilmPlace.XPos = FilmXPos; + FilmC->FilmPlace.YPos = FilmYPos; + FilmC->FilmPlace.Width = TitleImage.GetWidth(); + FilmC->FilmPlace.Height = TitleImage.GetHeight(); } } @@ -2170,8 +2170,8 @@ VOID REFIT_MENU_SCREEN::MainMenuVerticalStyle(IN UINTN Function, IN CONST CHAR16 } // Update FilmPlace only if not set by InitAnime - if (FilmPlace.Width == 0 || FilmPlace.Height == 0) { - FilmPlace = ThemeX.BannerPlace; + if (FilmC->FilmPlace.Width == 0 || FilmC->FilmPlace.Height == 0) { + FilmC->FilmPlace = ThemeX.BannerPlace; } ThemeX.InitBar(); //not sure @@ -2343,9 +2343,9 @@ VOID REFIT_MENU_SCREEN::MainMenuStyle(IN UINTN Function, IN CONST CHAR16 *ParamT // ThemeX.InitSelection(); //not needed to do here // Update FilmPlace only if not set by InitAnime - if (FilmPlace.Width == 0 || FilmPlace.Height == 0) { + if (FilmC->FilmPlace.Width == 0 || FilmC->FilmPlace.Height == 0) { // CopyMem(&FilmPlace, &BannerPlace, sizeof(BannerPlace)); - FilmPlace = ThemeX.BannerPlace; + FilmC->FilmPlace = ThemeX.BannerPlace; } //DBG("main menu inited\n"); @@ -2569,7 +2569,7 @@ UINTN REFIT_MENU_SCREEN::RunMainMenu(IN INTN DefaultSelection, OUT REFIT_ABSTRAC while (!MenuExit) { GetAnime(); - DBG("AnimeRun=%d\n", AnimeRun?1:0); + DBG("AnimeRun=%d\n", FilmC->AnimeRun?1:0); MenuExit = RunGenericMenu(MainStyle, &DefaultEntryIndex, &MainChosenEntry); TimeoutSeconds = 0; diff --git a/rEFIt_UEFI/gui/REFIT_MENU_SCREEN.h b/rEFIt_UEFI/gui/REFIT_MENU_SCREEN.h index d8f5ff3a2..5fb6bc2f6 100644 --- a/rEFIt_UEFI/gui/REFIT_MENU_SCREEN.h +++ b/rEFIt_UEFI/gui/REFIT_MENU_SCREEN.h @@ -85,14 +85,14 @@ public: EG_RECT OldTextBufferRect; XImage OldTextBufferImage; BOOLEAN isBootScreen; - BOOLEAN AnimeRun; //BOOLEAN Once; //same for xcinema - UINT64 LastDraw; - INTN CurrentFrame; + // BOOLEAN AnimeRun; + // UINT64 LastDraw; + // INTN CurrentFrame; // INTN Frames; //there are FilmC properties // UINTN FrameTime; //ms - EG_RECT FilmPlace; + // EG_RECT FilmPlace; FILM *FilmC; //XImage FilmPlaceImage; @@ -120,26 +120,26 @@ public: REFIT_MENU_SCREEN() - : ID(0), Title(), TitleImage(), - TimeoutSeconds(0), TimeoutText(), ThemeName(), - OldTextBufferRect(), OldTextBufferImage(), isBootScreen(false), - AnimeRun(0), LastDraw(0), CurrentFrame(0), + : ID(0), Title(), TitleImage(), + TimeoutSeconds(0), TimeoutText(), ThemeName(), + OldTextBufferRect(), OldTextBufferImage(), isBootScreen(false), + /*AnimeRun(0), LastDraw(0), CurrentFrame(0),*/ FilmC(), mAction(ActionNone), mItemID(0)//, mPointer(NULL) //, StyleFunc(&REFIT_MENU_SCREEN::TextMenuStyle) - {}; + {}; REFIT_MENU_SCREEN(UINTN ID, XStringW TTitle, XStringW TTimeoutText) : ID(ID), Title(TTitle), TitleImage(), TimeoutSeconds(0), TimeoutText(TTimeoutText), ThemeName(), OldTextBufferRect(), OldTextBufferImage(), isBootScreen(false), - AnimeRun(0), LastDraw(0), CurrentFrame(0), + /*AnimeRun(0), LastDraw(0), CurrentFrame(0),*/ FilmC(), mAction(ActionNone), mItemID(0)//, mPointer(NULL) //, StyleFunc(&REFIT_MENU_SCREEN::TextMenuStyle) {}; //TODO exclude CHAR16 REFIT_MENU_SCREEN(UINTN ID, CONST CHAR16* TitleC, CONST CHAR16* TimeoutTextC) : ID(ID), Title(), TitleImage(), - TimeoutSeconds(0), TimeoutText(), ThemeName(), AnimeRun(0), - LastDraw(0), CurrentFrame(0), + TimeoutSeconds(0), TimeoutText(), ThemeName(), + /*AnimeRun(0), LastDraw(0), CurrentFrame(0),*/ FilmC(), mAction(ActionNone), mItemID(0)//, mPointer(NULL) //, StyleFunc(&REFIT_MENU_SCREEN::TextMenuStyle) { @@ -151,7 +151,7 @@ public: : ID(ID), Title(TTitle), TitleImage(), TimeoutSeconds(0), TimeoutText(TTimeoutText), ThemeName(), OldTextBufferRect(), OldTextBufferImage(), isBootScreen(false), - AnimeRun(0), LastDraw(0), CurrentFrame(0), + /*AnimeRun(0), LastDraw(0), CurrentFrame(0),*/ FilmC(), mAction(ActionNone), mItemID(0)//, mPointer(NULL) //, StyleFunc(&REFIT_MENU_SCREEN::TextMenuStyle) { diff --git a/rEFIt_UEFI/libeg/XCinema.cpp b/rEFIt_UEFI/libeg/XCinema.cpp index 2d22bd1ad..2b4dd291f 100644 --- a/rEFIt_UEFI/libeg/XCinema.cpp +++ b/rEFIt_UEFI/libeg/XCinema.cpp @@ -31,14 +31,14 @@ VOID REFIT_MENU_SCREEN::UpdateFilm() { - if (FilmC == nullptr || !AnimeRun) { -// DBG("no anime -> run=%d\n", AnimeRun?1:0); + if (FilmC == nullptr || !FilmC->AnimeRun) { +// DBG("no anime -> run=%d\n", FilmC->AnimeRun?1:0); return; } // here we propose each screen has own link to a Film INT64 Now = AsmReadTsc(); - if (LastDraw == 0) { + if (FilmC->LastDraw == 0) { DBG("=== Update Film ===\n"); DBG("FilmX=%lld\n", FilmC->FilmX); 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 if (!Frame.isEmpty()) { @@ -58,9 +58,9 @@ VOID REFIT_MENU_SCREEN::UpdateFilm() } FilmC->Advance(); //next frame no matter if previous was not found 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) diff --git a/rEFIt_UEFI/libeg/XCinema.h b/rEFIt_UEFI/libeg/XCinema.h index 816dd0bc7..04e582a6d 100644 --- a/rEFIt_UEFI/libeg/XCinema.h +++ b/rEFIt_UEFI/libeg/XCinema.h @@ -27,7 +27,7 @@ protected: INTN Id; //ScreenID, enumeration value but keep it to be int for extensibility public: //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 FrameTime; //usually 50, 100, 200 ms INTN FilmX, FilmY; //relative @@ -35,19 +35,22 @@ public: INTN ScreenEdgeVertical; INTN NudgeX, NudgeY; XStringW Path; //user defined name for folder and files Path/Path_002.png etc + BOOLEAN AnimeRun; + UINT64 LastDraw; protected: XObjArray 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 CurrentFrame; // must be unique for each film + 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 public: EG_RECT FilmPlace; // Screen has several Films each in own place public: - FILM() {} - FILM(INTN Id) : Id(Id), RunOnce(false), NumFrames(0) - {} + FILM() : AnimeRun(0), LastDraw(0), CurrentFrame(0) + {} + FILM(INTN Id) : Id(Id), RunOnce(FALSE), NumFrames(0), AnimeRun(0), LastDraw(0), CurrentFrame(0) + {} ~FILM() {} INTN GetIndex() { return Id; } diff --git a/rEFIt_UEFI/libeg/XTheme.cpp b/rEFIt_UEFI/libeg/XTheme.cpp index fa4ef531c..27d5f5d7a 100644 --- a/rEFIt_UEFI/libeg/XTheme.cpp +++ b/rEFIt_UEFI/libeg/XTheme.cpp @@ -370,11 +370,11 @@ const XImage& XTheme::GetIconAlt(INTN Id, INTN Alt) //if not found then take emb if (IdFound >= 0 && !Icons[IdFound].Image.isEmpty()) { // icon not empty, return it if (!Daylight && !Icons[IdFound].ImageNight.isEmpty()) { - DBG("got night icon %lld name{%s}\n", Id, IconsNames[Id]); + DBG("got night icon %lld name{%s}\n", Id, IconsNames[IdFound]); return Icons[IdFound].ImageNight; } //if daylight or night icon absent - DBG("got day icon %lld name{%s}\n", Id, IconsNames[Id]); + DBG("got day icon %lld name{%s}\n", Id, IconsNames[IdFound]); return Icons[IdFound].Image; } return NullIcon; //such Id is not found in the database diff --git a/rEFIt_UEFI/refit/screen.cpp b/rEFIt_UEFI/refit/screen.cpp index e86586d0f..74decfee2 100644 --- a/rEFIt_UEFI/refit/screen.cpp +++ b/rEFIt_UEFI/refit/screen.cpp @@ -414,7 +414,7 @@ void REFIT_MENU_SCREEN::GetAnime() FilmC = ThemeX.Cinema.GetFilm(ID); // DBG("ScreenID=%lld Film found=%d\n", ID, (FilmC != nullptr)?1:0); if (FilmC != nullptr) { - AnimeRun = true; + FilmC->AnimeRun = true; } } @@ -425,7 +425,7 @@ VOID REFIT_MENU_SCREEN::InitAnime() } if (FilmC == nullptr) { DBG("Screen %lld inited without anime\n", ID); - AnimeRun = FALSE; + FilmC->AnimeRun = FALSE; return; } // DBG("=== Debug Film ===\n"); @@ -461,21 +461,15 @@ VOID REFIT_MENU_SCREEN::InitAnime() FilmC->FilmPlace = ThemeX.BannerPlace; if (CWidth > 0 && CHeight > 0) { // Retained for legacy themes without new anim placement options. - FilmC->FilmPlace.XPos += (FilmC->FilmPlace.Width - CWidth) / 2; - if (FilmC->FilmPlace.XPos < 0) { - FilmPlace.XPos = 0; - } - FilmC->FilmPlace.YPos += (FilmC->FilmPlace.Height - CHeight) / 2; - if (FilmC->FilmPlace.YPos < 0) { - FilmPlace.YPos = 0; - } + FilmC->FilmPlace.XPos = ((INTN)FilmC->FilmPlace.XPos * 2 > CWidth - (INTN)FilmC->FilmPlace.Width ) ? (UINTN)((INTN)FilmC->FilmPlace.XPos + ((INTN)FilmC->FilmPlace.Width - CWidth ) / 2) : 0; + FilmC->FilmPlace.YPos = ((INTN)FilmC->FilmPlace.YPos * 2 > CHeight - (INTN)FilmC->FilmPlace.Height) ? (UINTN)((INTN)FilmC->FilmPlace.YPos + ((INTN)FilmC->FilmPlace.Height - CHeight) / 2) : 0; } } if (FilmC->NumFrames != 0) { DBG(" Anime seems OK, init it\n"); - AnimeRun = TRUE; + FilmC->AnimeRun = TRUE; FilmC->Reset(); - LastDraw = 0; + FilmC->LastDraw = 0; } }