mirror of
https://github.com/CloverHackyColor/CloverBootloader.git
synced 2024-11-27 12:15:19 +01:00
Change DsdtsList from statically allocated to XStringWArray.
This commit is contained in:
parent
8134f37bde
commit
c6b08f89ba
@ -90,8 +90,7 @@ EFI_EDID_DISCOVERED_PROTOCOL *EdidDiscovered;
|
||||
|
||||
XStringWArray ThemeNameArray;
|
||||
XStringWArray ConfigsList;
|
||||
UINTN DsdtsNum = 0;
|
||||
CHAR16 *DsdtsList[20];
|
||||
XStringWArray DsdtsList;
|
||||
XObjArray<HDA_OUTPUTS> AudioList;
|
||||
|
||||
// firmware
|
||||
|
@ -2749,8 +2749,7 @@ extern XObjArray<HDA_OUTPUTS> AudioList;
|
||||
|
||||
extern XStringWArray ThemeNameArray;
|
||||
extern XStringWArray ConfigsList;
|
||||
extern CHAR16* DsdtsList[20];
|
||||
extern UINTN DsdtsNum;
|
||||
extern XStringWArray DsdtsList;
|
||||
//extern INTN ScrollButtonsHeight;
|
||||
//extern INTN ScrollBarDecorationsHeight;
|
||||
//extern INTN ScrollScrollDecorationsHeight;
|
||||
|
@ -134,8 +134,6 @@ extern void HelpRefit(void);
|
||||
extern void AboutRefit(void);
|
||||
//extern BOOLEAN BooterPatch(IN UINT8 *BooterData, IN UINT64 BooterSize, LOADER_ENTRY *Entry);
|
||||
|
||||
extern UINTN DsdtsNum;
|
||||
extern CHAR16 *DsdtsList[];
|
||||
extern EFI_AUDIO_IO_PROTOCOL *AudioIo;
|
||||
|
||||
extern EFI_DXE_SERVICES *gDS;
|
||||
@ -791,12 +789,7 @@ void LOADER_ENTRY::StartLoader()
|
||||
|
||||
//Free memory
|
||||
ConfigsList.setEmpty();
|
||||
for (size_t i = 0; i < DsdtsNum; i++) {
|
||||
if (DsdtsList[i]) {
|
||||
FreePool(DsdtsList[i]);
|
||||
DsdtsList[i] = NULL;
|
||||
}
|
||||
}
|
||||
DsdtsList.setEmpty();
|
||||
OptionMenu.FreeMenu();
|
||||
//there is a place to free memory
|
||||
// GuiAnime
|
||||
@ -2472,7 +2465,7 @@ GetListOfConfigs()
|
||||
}
|
||||
size_t NameLen = wcslen(DirEntry->FileName) - 6; //without ".plist"
|
||||
if ( NameLen <= MAX_INTN ) {
|
||||
ConfigsList.AddReference(SWPrintf("%.*ls", (int)NameLen, DirEntry->FileName).forgetDataWithoutFreeing(), true); // this avoid to realloctae and copy memory
|
||||
ConfigsList.AddReference(SWPrintf("%.*ls", (int)NameLen, DirEntry->FileName).forgetDataWithoutFreeing(), true); // this avoid to reallocate and copy memory
|
||||
DBG("- %ls\n", DirEntry->FileName);
|
||||
}else{
|
||||
DBG("- bug!, NameLen > MAX_INTN");
|
||||
@ -2486,16 +2479,8 @@ GetListOfDsdts()
|
||||
{
|
||||
REFIT_DIR_ITER DirIter;
|
||||
EFI_FILE_INFO *DirEntry;
|
||||
INTN NameLen;
|
||||
|
||||
if (DsdtsNum > 0) {
|
||||
for (UINTN i = 0; i < DsdtsNum; i++) {
|
||||
if (DsdtsList[DsdtsNum] != NULL) {
|
||||
FreePool(DsdtsList[DsdtsNum]);
|
||||
}
|
||||
}
|
||||
}
|
||||
DsdtsNum = 0;
|
||||
DsdtsList.setEmpty();
|
||||
OldChosenDsdt = 0xFFFF;
|
||||
|
||||
DirIterOpen(&selfOem.getConfigDir(), L"ACPI\\patched", &DirIter);
|
||||
@ -2505,11 +2490,10 @@ GetListOfDsdts()
|
||||
continue;
|
||||
}
|
||||
if ( gSettings.ACPI.DSDT.DsdtName.isEqualIC(DirEntry->FileName) ) {
|
||||
OldChosenDsdt = DsdtsNum;
|
||||
OldChosenDsdt = DsdtsList.size(); // DirEntry->FileName is not yet inserted into DsdtsList. So its index will be DsdtsList.size()
|
||||
}
|
||||
NameLen = StrLen(DirEntry->FileName); //with ".aml"
|
||||
DsdtsList[DsdtsNum] = (CHAR16*)AllocateCopyPool(NameLen * sizeof(CHAR16) + 2, DirEntry->FileName); // if changing, notice freepool above
|
||||
DsdtsList[DsdtsNum++][NameLen] = L'\0';
|
||||
size_t NameLen = wcslen(DirEntry->FileName); //with ".aml"
|
||||
DsdtsList.AddReference(SWPrintf("%.*ls", (int)NameLen, DirEntry->FileName).forgetDataWithoutFreeing(), true); // this avoid to reallocate and copy memory
|
||||
DBG("- %ls\n", DirEntry->FileName);
|
||||
}
|
||||
DirIterClose(&DirIter);
|
||||
|
@ -1011,7 +1011,7 @@ void ApplyInputs(void)
|
||||
if (OldChosenDsdt == 0xFFFF) {
|
||||
gSettings.ACPI.DSDT.DsdtName = L"BIOS.aml"_XSW;
|
||||
} else {
|
||||
gSettings.ACPI.DSDT.DsdtName.SWPrintf("%ls", DsdtsList[OldChosenDsdt]);
|
||||
gSettings.ACPI.DSDT.DsdtName = DsdtsList[OldChosenDsdt];
|
||||
}
|
||||
}
|
||||
i++; //117
|
||||
@ -2134,7 +2134,7 @@ REFIT_ABSTRACT_MENU_ENTRY* SubMenuDsdts()
|
||||
SubScreen->AddMenuInfoLine_f("Select a DSDT file:");
|
||||
SubScreen->AddMenuItemSwitch(116, "BIOS.aml", FALSE);
|
||||
|
||||
for (i = 0; i < DsdtsNum; i++) {
|
||||
for (i = 0; i < DsdtsList.size(); i++) {
|
||||
InputBootArgs = new REFIT_MENU_SWITCH;
|
||||
InputBootArgs->Title.takeValueFrom(DsdtsList[i]);
|
||||
// InputBootArgs->Tag = TAG_SWITCH_OLD;
|
||||
|
Loading…
Reference in New Issue
Block a user