mirror of
https://github.com/CloverHackyColor/CloverBootloader.git
synced 2024-11-23 11:35:19 +01:00
Add XStringArray::remove and removeIC tests. Create var for "quiet" and
"splash".
This commit is contained in:
parent
1279ce374d
commit
a2b23b391f
@ -447,7 +447,7 @@ VOID LOADER_ENTRY::AppleIntelCPUPMPatch(UINT8 *Driver, UINT32 DriverSize, CHAR8
|
||||
SEGMENT *textSeg = (SEGMENT *)&Driver[textName];
|
||||
Start = textSeg->fileoff;
|
||||
Size = textSeg->filesize;
|
||||
DBG("found __text [%d,%d]\n",Start, Size);
|
||||
DBG("found __text [%llu,%llu]\n",Start, Size);
|
||||
if (Start > DriverSize) Start = 0;
|
||||
if (Size > DriverSize) {
|
||||
Size = DriverSize;
|
||||
|
@ -155,6 +155,37 @@ int XStringArray_tests()
|
||||
array1.AddID(L"other2"_XSW);
|
||||
if ( array1.size() != 4 ) return 53;
|
||||
}
|
||||
{
|
||||
XStringArray array;
|
||||
array.Add(L"word1");
|
||||
array.Add(L"other2");
|
||||
array.Add(L"3333");
|
||||
array.Add(L"4th_item");
|
||||
|
||||
array.remove("WOrd1"_XS8);
|
||||
if ( !array.contains("word1"_XS8) ) return 22;
|
||||
array.remove("word1"_XS8);
|
||||
if ( array.contains("word1"_XS8) ) return 22;
|
||||
array.removeIC("oTHEr2"_XS8);
|
||||
if ( array.contains("other2"_XS8) ) return 22;
|
||||
array.removeIC("4th_ITEM"_XS8);
|
||||
if ( array.contains("4th_item"_XS8) ) return 22;
|
||||
XString8 c = array.ConcatAll();
|
||||
// printf("c=%s\n", c.c_str());
|
||||
}
|
||||
{
|
||||
XStringArray array;
|
||||
array.Add(L"splash");
|
||||
array.Add(L"quiet");
|
||||
|
||||
array.remove("splash"_XS8);
|
||||
if ( array.contains("splash"_XS8) ) return 22;
|
||||
array.removeIC("quiet"_XS8);
|
||||
if ( array.contains("quiet"_XS8) ) return 22;
|
||||
if ( array.size() != 0 ) return 22;
|
||||
XString8 c = array.ConcatAll();
|
||||
// printf("c=%s\n", c.c_str());
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
@ -792,6 +792,9 @@ STATIC VOID AddDefaultMenu(IN LOADER_ENTRY *Entry)
|
||||
BOOLEAN KernelIs64BitOnly;
|
||||
UINT64 os_version = AsciiOSVersionToUint64(Entry->OSVersion);
|
||||
|
||||
constexpr LString8 quietLitteral = "quiet";
|
||||
constexpr LString8 splashLitteral = "splash";
|
||||
|
||||
if (Entry == NULL) {
|
||||
return;
|
||||
}
|
||||
@ -924,8 +927,8 @@ STATIC VOID AddDefaultMenu(IN LOADER_ENTRY *Entry)
|
||||
}
|
||||
|
||||
} else if (Entry->LoaderType == OSTYPE_LINEFI) {
|
||||
BOOLEAN Quiet = Entry->LoadOptions.contains("quiet");
|
||||
BOOLEAN WithSplash = Entry->LoadOptions.contains("splash");
|
||||
BOOLEAN Quiet = Entry->LoadOptions.contains(quietLitteral);
|
||||
BOOLEAN WithSplash = Entry->LoadOptions.contains(splashLitteral);
|
||||
|
||||
// default entry
|
||||
SubEntry = Entry->getPartiallyDuplicatedEntry();
|
||||
@ -938,10 +941,10 @@ STATIC VOID AddDefaultMenu(IN LOADER_ENTRY *Entry)
|
||||
if (SubEntry) {
|
||||
if (Quiet) {
|
||||
SubEntry->Title.SWPrintf("%ls verbose", Entry->Title.s());
|
||||
SubEntry->LoadOptions.removeIC("quiet"_XS8);
|
||||
SubEntry->LoadOptions.removeIC(quietLitteral);
|
||||
} else {
|
||||
SubEntry->Title.SWPrintf("%ls quiet", Entry->Title.s());
|
||||
SubEntry->LoadOptions.AddID("quiet"_XS8);
|
||||
SubEntry->LoadOptions.AddID(quietLitteral);
|
||||
}
|
||||
}
|
||||
SubScreen->AddMenuEntry(SubEntry, true);
|
||||
@ -949,10 +952,10 @@ STATIC VOID AddDefaultMenu(IN LOADER_ENTRY *Entry)
|
||||
if (SubEntry) {
|
||||
if (WithSplash) {
|
||||
SubEntry->Title.SWPrintf("%ls without splash", Entry->Title.s());
|
||||
SubEntry->LoadOptions.removeIC("splash"_XS8);
|
||||
SubEntry->LoadOptions.removeIC(splashLitteral);
|
||||
} else {
|
||||
SubEntry->Title.SWPrintf("%ls with splash", Entry->Title.s());
|
||||
SubEntry->LoadOptions.AddID("splash"_XS8);
|
||||
SubEntry->LoadOptions.AddID(splashLitteral);
|
||||
}
|
||||
}
|
||||
SubScreen->AddMenuEntry(SubEntry, true);
|
||||
@ -961,22 +964,22 @@ STATIC VOID AddDefaultMenu(IN LOADER_ENTRY *Entry)
|
||||
if (WithSplash) {
|
||||
if (Quiet) {
|
||||
SubEntry->Title.SWPrintf("%ls verbose without splash", Entry->Title.s());
|
||||
SubEntry->LoadOptions.removeIC("splash"_XS8);
|
||||
SubEntry->LoadOptions.removeIC("quiet"_XS8);
|
||||
SubEntry->LoadOptions.removeIC(splashLitteral);
|
||||
SubEntry->LoadOptions.removeIC(quietLitteral);
|
||||
} else {
|
||||
SubEntry->Title.SWPrintf("%ls quiet without splash", Entry->Title.s());
|
||||
SubEntry->LoadOptions.removeIC("splash"_XS8);
|
||||
SubEntry->LoadOptions.Add("quiet"_XS8);
|
||||
SubEntry->LoadOptions.removeIC(splashLitteral);
|
||||
SubEntry->LoadOptions.Add(quietLitteral);
|
||||
}
|
||||
} else if (Quiet) {
|
||||
// TempOptions.RemoveIC("quiet"_XS8);
|
||||
// TempOptions.RemoveIC(quietLitteral);
|
||||
SubEntry->Title.SWPrintf("%ls verbose with splash", Entry->Title.s());
|
||||
SubEntry->LoadOptions.AddID("splash"_XS8);
|
||||
SubEntry->LoadOptions.AddID(splashLitteral);
|
||||
// FreePool(TempOptions);
|
||||
} else {
|
||||
SubEntry->Title.SWPrintf("%ls quiet with splash", Entry->Title.s());
|
||||
SubEntry->LoadOptions.AddID("quiet"_XS8);
|
||||
SubEntry->LoadOptions.AddID("splash"_XS8);
|
||||
SubEntry->LoadOptions.AddID(quietLitteral);
|
||||
SubEntry->LoadOptions.AddID(splashLitteral);
|
||||
}
|
||||
}
|
||||
SubScreen->AddMenuEntry(SubEntry, true);
|
||||
|
@ -84,7 +84,7 @@ void XCinema::AddFilm(FILM* NewFilm)
|
||||
static XImage NullImage;
|
||||
const XImage& FILM::GetImage(INTN Index) const
|
||||
{
|
||||
DBG("ask for frame #%lld from total of %lld\n", Index, Frames.size());
|
||||
DBG("ask for frame #%lld from total of %zu\n", Index, Frames.size());
|
||||
for (size_t i = 0; i < Frames.size(); ++i) {
|
||||
if (Frames[i].getIndex() == Index) {
|
||||
DBG("...found\n");
|
||||
|
Loading…
Reference in New Issue
Block a user