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 ThemeNameArray;
|
||||||
XStringWArray ConfigsList;
|
XStringWArray ConfigsList;
|
||||||
UINTN DsdtsNum = 0;
|
XStringWArray DsdtsList;
|
||||||
CHAR16 *DsdtsList[20];
|
|
||||||
XObjArray<HDA_OUTPUTS> AudioList;
|
XObjArray<HDA_OUTPUTS> AudioList;
|
||||||
|
|
||||||
// firmware
|
// firmware
|
||||||
|
@ -2749,8 +2749,7 @@ extern XObjArray<HDA_OUTPUTS> AudioList;
|
|||||||
|
|
||||||
extern XStringWArray ThemeNameArray;
|
extern XStringWArray ThemeNameArray;
|
||||||
extern XStringWArray ConfigsList;
|
extern XStringWArray ConfigsList;
|
||||||
extern CHAR16* DsdtsList[20];
|
extern XStringWArray DsdtsList;
|
||||||
extern UINTN DsdtsNum;
|
|
||||||
//extern INTN ScrollButtonsHeight;
|
//extern INTN ScrollButtonsHeight;
|
||||||
//extern INTN ScrollBarDecorationsHeight;
|
//extern INTN ScrollBarDecorationsHeight;
|
||||||
//extern INTN ScrollScrollDecorationsHeight;
|
//extern INTN ScrollScrollDecorationsHeight;
|
||||||
|
@ -134,8 +134,6 @@ extern void HelpRefit(void);
|
|||||||
extern void AboutRefit(void);
|
extern void AboutRefit(void);
|
||||||
//extern BOOLEAN BooterPatch(IN UINT8 *BooterData, IN UINT64 BooterSize, LOADER_ENTRY *Entry);
|
//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_AUDIO_IO_PROTOCOL *AudioIo;
|
||||||
|
|
||||||
extern EFI_DXE_SERVICES *gDS;
|
extern EFI_DXE_SERVICES *gDS;
|
||||||
@ -791,12 +789,7 @@ void LOADER_ENTRY::StartLoader()
|
|||||||
|
|
||||||
//Free memory
|
//Free memory
|
||||||
ConfigsList.setEmpty();
|
ConfigsList.setEmpty();
|
||||||
for (size_t i = 0; i < DsdtsNum; i++) {
|
DsdtsList.setEmpty();
|
||||||
if (DsdtsList[i]) {
|
|
||||||
FreePool(DsdtsList[i]);
|
|
||||||
DsdtsList[i] = NULL;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
OptionMenu.FreeMenu();
|
OptionMenu.FreeMenu();
|
||||||
//there is a place to free memory
|
//there is a place to free memory
|
||||||
// GuiAnime
|
// GuiAnime
|
||||||
@ -2472,7 +2465,7 @@ GetListOfConfigs()
|
|||||||
}
|
}
|
||||||
size_t NameLen = wcslen(DirEntry->FileName) - 6; //without ".plist"
|
size_t NameLen = wcslen(DirEntry->FileName) - 6; //without ".plist"
|
||||||
if ( NameLen <= MAX_INTN ) {
|
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);
|
DBG("- %ls\n", DirEntry->FileName);
|
||||||
}else{
|
}else{
|
||||||
DBG("- bug!, NameLen > MAX_INTN");
|
DBG("- bug!, NameLen > MAX_INTN");
|
||||||
@ -2486,16 +2479,8 @@ GetListOfDsdts()
|
|||||||
{
|
{
|
||||||
REFIT_DIR_ITER DirIter;
|
REFIT_DIR_ITER DirIter;
|
||||||
EFI_FILE_INFO *DirEntry;
|
EFI_FILE_INFO *DirEntry;
|
||||||
INTN NameLen;
|
|
||||||
|
|
||||||
if (DsdtsNum > 0) {
|
DsdtsList.setEmpty();
|
||||||
for (UINTN i = 0; i < DsdtsNum; i++) {
|
|
||||||
if (DsdtsList[DsdtsNum] != NULL) {
|
|
||||||
FreePool(DsdtsList[DsdtsNum]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
DsdtsNum = 0;
|
|
||||||
OldChosenDsdt = 0xFFFF;
|
OldChosenDsdt = 0xFFFF;
|
||||||
|
|
||||||
DirIterOpen(&selfOem.getConfigDir(), L"ACPI\\patched", &DirIter);
|
DirIterOpen(&selfOem.getConfigDir(), L"ACPI\\patched", &DirIter);
|
||||||
@ -2505,11 +2490,10 @@ GetListOfDsdts()
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if ( gSettings.ACPI.DSDT.DsdtName.isEqualIC(DirEntry->FileName) ) {
|
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"
|
size_t NameLen = wcslen(DirEntry->FileName); //with ".aml"
|
||||||
DsdtsList[DsdtsNum] = (CHAR16*)AllocateCopyPool(NameLen * sizeof(CHAR16) + 2, DirEntry->FileName); // if changing, notice freepool above
|
DsdtsList.AddReference(SWPrintf("%.*ls", (int)NameLen, DirEntry->FileName).forgetDataWithoutFreeing(), true); // this avoid to reallocate and copy memory
|
||||||
DsdtsList[DsdtsNum++][NameLen] = L'\0';
|
|
||||||
DBG("- %ls\n", DirEntry->FileName);
|
DBG("- %ls\n", DirEntry->FileName);
|
||||||
}
|
}
|
||||||
DirIterClose(&DirIter);
|
DirIterClose(&DirIter);
|
||||||
|
@ -1011,7 +1011,7 @@ void ApplyInputs(void)
|
|||||||
if (OldChosenDsdt == 0xFFFF) {
|
if (OldChosenDsdt == 0xFFFF) {
|
||||||
gSettings.ACPI.DSDT.DsdtName = L"BIOS.aml"_XSW;
|
gSettings.ACPI.DSDT.DsdtName = L"BIOS.aml"_XSW;
|
||||||
} else {
|
} else {
|
||||||
gSettings.ACPI.DSDT.DsdtName.SWPrintf("%ls", DsdtsList[OldChosenDsdt]);
|
gSettings.ACPI.DSDT.DsdtName = DsdtsList[OldChosenDsdt];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
i++; //117
|
i++; //117
|
||||||
@ -2134,7 +2134,7 @@ REFIT_ABSTRACT_MENU_ENTRY* SubMenuDsdts()
|
|||||||
SubScreen->AddMenuInfoLine_f("Select a DSDT file:");
|
SubScreen->AddMenuInfoLine_f("Select a DSDT file:");
|
||||||
SubScreen->AddMenuItemSwitch(116, "BIOS.aml", FALSE);
|
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 = new REFIT_MENU_SWITCH;
|
||||||
InputBootArgs->Title.takeValueFrom(DsdtsList[i]);
|
InputBootArgs->Title.takeValueFrom(DsdtsList[i]);
|
||||||
// InputBootArgs->Tag = TAG_SWITCH_OLD;
|
// InputBootArgs->Tag = TAG_SWITCH_OLD;
|
||||||
|
Loading…
Reference in New Issue
Block a user