smbios automatic chooser

Signed-off-by: Slice <sergey.slice@gmail.com>
This commit is contained in:
Slice 2023-06-17 00:44:39 +03:00
parent 76614b3208
commit 2cb4b24a5d
16 changed files with 302 additions and 409 deletions

View File

@ -2063,7 +2063,7 @@ DEFINE GCC49_ASLCC_FLAGS = DEF(GCC48_ASLCC_FLAGS)
DEFINE GCC5_IA32_CC_FLAGS = DEF(GCC49_IA32_CC_FLAGS) -fno-pic -fno-pie DEFINE GCC5_IA32_CC_FLAGS = DEF(GCC49_IA32_CC_FLAGS) -fno-pic -fno-pie
DEFINE GCC5_X64_CC_FLAGS = DEF(GCC49_X64_CC_FLAGS) DEFINE GCC5_X64_CC_FLAGS = DEF(GCC49_X64_CC_FLAGS)
DEFINE GCC5_IA32_X64_DLINK_COMMON = DEF(GCC49_IA32_X64_DLINK_COMMON) DEFINE GCC5_IA32_X64_DLINK_COMMON = DEF(GCC49_IA32_X64_DLINK_COMMON) -Wl,--no-warn-rwx-segments
DEFINE GCC5_IA32_X64_ASLDLINK_FLAGS = DEF(GCC49_IA32_X64_ASLDLINK_FLAGS) DEFINE GCC5_IA32_X64_ASLDLINK_FLAGS = DEF(GCC49_IA32_X64_ASLDLINK_FLAGS)
DEFINE GCC5_IA32_X64_DLINK_FLAGS = DEF(GCC49_IA32_X64_DLINK_FLAGS) DEFINE GCC5_IA32_X64_DLINK_FLAGS = DEF(GCC49_IA32_X64_DLINK_FLAGS)
DEFINE GCC5_IA32_DLINK2_FLAGS = DEF(GCC49_IA32_DLINK2_FLAGS) -Wno-error DEFINE GCC5_IA32_DLINK2_FLAGS = DEF(GCC49_IA32_DLINK2_FLAGS) -Wno-error
@ -2086,13 +2086,13 @@ DEFINE GCC5_ASLCC_FLAGS = DEF(GCC49_ASLCC_FLAGS) -fno-lto
DEFINE GCC53_IA32_CC_FLAGS = DEF(GCC49_IA32_CC_FLAGS) DEFINE GCC53_IA32_CC_FLAGS = DEF(GCC49_IA32_CC_FLAGS)
DEFINE GCC53_X64_CC_FLAGS = DEF(GCC49_X64_CC_FLAGS) -fno-unwind-tables -Wno-incompatible-ms-struct -Wno-misleading-indentation -mms-bitfields -fno-ms-extensions -ffreestanding -fno-exceptions DEFINE GCC53_X64_CC_FLAGS = DEF(GCC49_X64_CC_FLAGS) -fno-unwind-tables -Wno-incompatible-ms-struct -Wno-misleading-indentation -mms-bitfields -fno-ms-extensions -ffreestanding -fno-exceptions
DEFINE GCC53_IA32_X64_DLINK_COMMON = -nostdlib -Wl,-n,-q,--gc-sections,-z,common-page-size=0x40,--defsym=PECOFF_HEADER_SIZE=0x240,--script=$(EDK_TOOLS_PATH)/Scripts/GccBase.lds DEFINE GCC53_IA32_X64_DLINK_COMMON = -nostdlib -Wl,--no-warn-rwx-segments,--gc-sections,-n,-q,--gc-sections,-z,common-page-size=0x40,--defsym=PECOFF_HEADER_SIZE=0x240,--script=$(EDK_TOOLS_PATH)/Scripts/GccBase.lds
DEFINE GCC53_IA32_X64_ASLDLINK_FLAGS = DEF(GCC53_IA32_X64_DLINK_COMMON),--entry,ReferenceAcpiTable,-u,ReferenceAcpiTable DEFINE GCC53_IA32_X64_ASLDLINK_FLAGS = DEF(GCC53_IA32_X64_DLINK_COMMON),--entry,ReferenceAcpiTable,-u,ReferenceAcpiTable
DEFINE GCC53_IA32_X64_DLINK_FLAGS = DEF(GCC53_IA32_X64_DLINK_COMMON),--entry,$(IMAGE_ENTRY_POINT),-u,$(IMAGE_ENTRY_POINT),-Map,$(DEST_DIR_DEBUG)/$(BASE_NAME).map DEFINE GCC53_IA32_X64_DLINK_FLAGS = DEF(GCC53_IA32_X64_DLINK_COMMON),--entry,$(IMAGE_ENTRY_POINT),-u,$(IMAGE_ENTRY_POINT),-Map,$(DEST_DIR_DEBUG)/$(BASE_NAME).map
DEFINE GCC53_X64_DLINK_FLAGS = DEF(GCC53_IA32_X64_DLINK_FLAGS),-melf_x86_64,--oformat=elf64-x86-64,-pie DEFINE GCC53_X64_DLINK_FLAGS = DEF(GCC53_IA32_X64_DLINK_FLAGS),-melf_x86_64,-znoexecstack,--oformat=elf64-x86-64,-pie
DEFINE GCC53_ASM_FLAGS = DEF(GCC49_ASM_FLAGS) DEFINE GCC53_ASM_FLAGS = DEF(GCC49_ASM_FLAGS)

View File

@ -941,12 +941,12 @@ WriteSections64 (
SymName = (const UINT8 *)"<unknown>"; SymName = (const UINT8 *)"<unknown>";
} }
if ( strcmp((const char *)SymName, "__cxa_pure_virtual") == 0 ) { if ( strcmp((const char *)SymName, "__cxa_pure_virtual") == 0 ) {
static int already_printed_once = 0; // static int already_printed_once = 0;
if ( !already_printed_once ) { // if ( !already_printed_once ) {
printf("FIXME reminder : __cxa_pure_virtual is undefined -> ignored. This is happening since gcc 12.1 for unknown reasons.\n"); // printf("FIXME reminder : __cxa_pure_virtual is undefined -> ignored. This is happening since gcc 12.1 for unknown reasons.\n");
already_printed_once = 1; // already_printed_once = 1;
} // }
continue; continue;
} }
Error (NULL, 0, 3000, "Invalid", Error (NULL, 0, 3000, "Invalid",
"%s: Bad definition for symbol '%s'@%#llx or unsupported symbol type. " "%s: Bad definition for symbol '%s'@%#llx or unsupported symbol type. "

View File

@ -54,6 +54,7 @@
INTN OldChosenTheme; INTN OldChosenTheme;
INTN OldChosenSmbios;
INTN OldChosenConfig; INTN OldChosenConfig;
INTN OldChosenDsdt; INTN OldChosenDsdt;
UINTN OldChosenAudio; UINTN OldChosenAudio;
@ -75,6 +76,7 @@ XStringWArray ThemeNameArray;
XStringWArray ConfigsList; XStringWArray ConfigsList;
XStringWArray DsdtsList; XStringWArray DsdtsList;
XObjArray<HDA_OUTPUTS> AudioList; XObjArray<HDA_OUTPUTS> AudioList;
XStringWArray SmbiosList;
// firmware // firmware
XBool gFirmwareClover = false; XBool gFirmwareClover = false;

View File

@ -2695,63 +2695,35 @@ public:
}; };
//extern XObjArray<RT_VARIABLES> gSettings.RtVariables.BlockRtVariableArray;
extern XObjArray<HDA_OUTPUTS> AudioList; extern XObjArray<HDA_OUTPUTS> AudioList;
extern XStringWArray ThemeNameArray; extern XStringWArray ThemeNameArray;
extern XStringWArray ConfigsList; extern XStringWArray ConfigsList;
extern XStringWArray DsdtsList; extern XStringWArray DsdtsList;
//extern INTN ScrollButtonsHeight; extern XStringWArray SmbiosList;
//extern INTN ScrollBarDecorationsHeight;
//extern INTN ScrollScrollDecorationsHeight;
//extern INTN LayoutBannerOffset;
//extern INTN LayoutButtonOffset;
//extern INTN LayoutTextOffset;
// this should go in a globals, not in settings
extern INTN OldChosenTheme; extern INTN OldChosenTheme;
extern INTN OldChosenConfig; extern INTN OldChosenConfig;
extern INTN OldChosenDsdt; extern INTN OldChosenSmbios;
extern UINTN OldChosenAudio; extern INTN OldChosenDsdt;
extern XBool SavePreBootLog; extern UINTN OldChosenAudio;
extern UINT8 DefaultAudioVolume; extern XBool SavePreBootLog;
extern UINT8 DefaultAudioVolume;
//extern GFX_PROPERTIES gGraphics[];
//extern HDA_PROPERTIES gAudios[];
//extern UINTN NGFX;
//extern UINTN NHDA;
//extern UINT16 gCPUtype;
extern SETTINGS_DATA gSettings; extern SETTINGS_DATA gSettings;
extern XBool gFirmwareClover; extern XBool gFirmwareClover;
extern DRIVERS_FLAGS gDriversFlags; extern DRIVERS_FLAGS gDriversFlags;
extern EFI_EDID_DISCOVERED_PROTOCOL *EdidDiscovered; extern EFI_EDID_DISCOVERED_PROTOCOL *EdidDiscovered;
//extern UINT8 *gEDID; extern UINTN gEvent;
extern UINT16 gBacklightLevel;
extern UINTN gEvent;
extern UINT16 gBacklightLevel;
//extern XBool defDSM;
//extern UINT16 dropDSM;
//extern TagDict* gConfigDict[];
// ACPI/PATCHED/AML // ACPI/PATCHED/AML
extern XObjArray<ACPI_PATCHED_AML> ACPIPatchedAML; extern XObjArray<ACPI_PATCHED_AML> ACPIPatchedAML;
// SysVariables
//extern SYSVARIABLES *SysVariables;
// Hold theme fixed IconFormat / extension // Hold theme fixed IconFormat / extension
extern CHAR16 *IconFormat; extern CHAR16 *IconFormat;
extern XBool ResumeFromCoreStorage;
extern XBool ResumeFromCoreStorage;
//extern XBool gRemapSmBiosIsRequire; // syscl: pass argument for Dell SMBIOS here
extern EMU_VARIABLE_CONTROL_PROTOCOL *gEmuVariableControl; extern EMU_VARIABLE_CONTROL_PROTOCOL *gEmuVariableControl;

View File

@ -487,7 +487,7 @@ EFI_STATUS LoadPlist(const XStringW& ConfName, C* plist)
// XStringW ConfigPlistPath; // XStringW ConfigPlistPath;
// XStringW ConfigOemPath; // XStringW ConfigOemPath;
// DbgHeader("LoadUserSettings"); DbgHeader("LoadUserSettings");
// load config // load config
if ( ConfName.isEmpty() /*|| Dict == NULL*/ ) { if ( ConfName.isEmpty() /*|| Dict == NULL*/ ) {
@ -542,7 +542,7 @@ EFI_STATUS LoadPlist(const XStringW& ConfName, C* plist)
DebugLog(1, "Use CloverConfigPlistValidator"); DebugLog(1, "Use CloverConfigPlistValidator");
if ( plist->getSMBIOS().dgetModel() < MaxMacModel ) { if ( plist->getSMBIOS().dgetModel() < MaxMacModel ) {
if ( xmlLiteParser.productNameNeeded ) DebugLog(1, " (with --productname=%s)", MachineModelName[plist->getSMBIOS().dgetModel()].c_str()); if ( xmlLiteParser.productNameNeeded ) DebugLog(1, " (with --productname=%s)", MachineModelName[plist->getSMBIOS().dgetModel()].c_str());
}else{ } else {
// This is NOT supposed to happen, since CLover set a default mac model // This is NOT supposed to happen, since CLover set a default mac model
// If a default mac model is not set, a crash would probably happen earlier, but who knows // If a default mac model is not set, a crash would probably happen earlier, but who knows
if ( xmlLiteParser.productNameNeeded ) DebugLog(1, "(with --productname=?)"); if ( xmlLiteParser.productNameNeeded ) DebugLog(1, "(with --productname=?)");
@ -552,6 +552,8 @@ EFI_STATUS LoadPlist(const XStringW& ConfName, C* plist)
if ( !parsingOk ) { if ( !parsingOk ) {
DebugLog(1, "Parsing error while parsing '%ls'.\n", configPlistPath.wc_str()); DebugLog(1, "Parsing error while parsing '%ls'.\n", configPlistPath.wc_str());
Status = EFI_LOAD_ERROR; Status = EFI_LOAD_ERROR;
} else {
} }
if ( !parsingOk || xmlLiteParser.getXmlParserMessageArray().size() - xmlLiteParser.getXmlParserInfoMessageCount() > 0 ) gBS->Stall(3000000); // 3 seconds delay if ( !parsingOk || xmlLiteParser.getXmlParserMessageArray().size() - xmlLiteParser.getXmlParserInfoMessageCount() > 0 ) gBS->Stall(3000000); // 3 seconds delay
@ -588,19 +590,27 @@ EFI_STATUS ConfigManager::LoadSMBIOSPlist(const XStringW& ConfName)
return Status; return Status;
} }
void ConfigManager::ReloadSmbios(XStringW& str)
{
size_t N = SmbiosList.size();
if (OldChosenSmbios == 0) {
for (size_t i=1; i<N; i++) {
if (SmbiosList[i].contains(str)) {
OldChosenSmbios = i;
break;
}
}
}
FillSmbiosWithDefaultValue(GlobalConfig.CurrentModel, configPlist.getSMBIOS());
DBG("SMBIOS reloaded with model %s\n", gSettings.Smbios.ProductName.c_str());
}
void ConfigManager::FillSmbiosWithDefaultValue(MacModel Model, const SmbiosPlistClass::SmbiosDictClass& smbiosDictClass) void ConfigManager::FillSmbiosWithDefaultValue(MacModel Model, const SmbiosPlistClass::SmbiosDictClass& smbiosDictClass)
{ {
if ( smbiosDictClass.getBiosVersion().isDefined() ) gSettings.Smbios.BiosVersion = smbiosDictClass.getBiosVersion().value(); if ( smbiosDictClass.getBiosVersion().isDefined() ) gSettings.Smbios.BiosVersion = smbiosDictClass.getBiosVersion().value();
if ( smbiosDictClass.getBiosReleaseDate().isDefined() ) gSettings.Smbios.BiosReleaseDate = smbiosDictClass.getBiosReleaseDate().value(); if ( smbiosDictClass.getBiosReleaseDate().isDefined() ) gSettings.Smbios.BiosReleaseDate = smbiosDictClass.getBiosReleaseDate().value();
if ( smbiosDictClass.getEfiVersion().isDefined() ) gSettings.Smbios.EfiVersion = smbiosDictClass.getEfiVersion().value(); if ( smbiosDictClass.getEfiVersion().isDefined() ) gSettings.Smbios.EfiVersion = smbiosDictClass.getEfiVersion().value();
if ( smbiosDictClass.getBiosVendor().isDefined() ) gSettings.Smbios.BiosVendor = smbiosDictClass.getBiosVendor().value(); if ( smbiosDictClass.getBiosVendor().isDefined() ) gSettings.Smbios.BiosVendor = smbiosDictClass.getBiosVendor().value();
if ( smbiosDictClass.getManufacturer().isDefined() ) gSettings.Smbios.ManufactureName = smbiosDictClass.getManufacturer().value(); if ( smbiosDictClass.getManufacturer().isDefined() ) gSettings.Smbios.ManufactureName = smbiosDictClass.getManufacturer().value();
if ( smbiosDictClass.getProductName().isDefined() ) gSettings.Smbios.ProductName = smbiosDictClass.getProductName().value(); if ( smbiosDictClass.getProductName().isDefined() ) gSettings.Smbios.ProductName = smbiosDictClass.getProductName().value();
@ -858,12 +868,38 @@ EFI_STATUS ConfigManager::LoadConfig(const XStringW& ConfName)
LoadSMBIOSPlist(L"smbios"_XSW); // we don't need Status. If not loaded correctly, smbiosPlist is !defined and will be ignored by AssignOldNewSettings() LoadSMBIOSPlist(L"smbios"_XSW); // we don't need Status. If not loaded correctly, smbiosPlist is !defined and will be ignored by AssignOldNewSettings()
// get list of smbioses
XStringW h = L"auto"_XSW;
SmbiosList.AddReference(h.forgetDataWithoutFreeing(), true);
size_t N = sizeof(configPlist.m_fields)/sizeof(configPlist.m_fields[0]);
DBG("create SMBIOS list, found %lu dicts\n", N);
for (size_t i=0; i<N; i++) {
if (configPlist.m_fields[i].xmlAbstractType.isDefined()) {
XStringW h1;
h1.takeValueFrom(configPlist.m_fields[i].m_name);
DBG("... %ls\n", h1.wc_str());
if (h1.contains("SMBIOS")) {
SmbiosList.AddReference(h1.forgetDataWithoutFreeing(), true);
}
}
}
// DBG("made entries SMBIOS:\n");
// for (size_t i=0; i<SmbiosList.size(); i++) {
// DBG("--- %ls\n", SmbiosList[i].wc_str());
// }
if ( smbiosPlist.getSMBIOS().isDefined() && smbiosPlist.getSMBIOS().getProductName().isDefined() ) { if ( smbiosPlist.getSMBIOS().isDefined() && smbiosPlist.getSMBIOS().getProductName().isDefined() ) {
GlobalConfig.CurrentModel = smbiosPlist.SMBIOS.dgetModel(); GlobalConfig.CurrentModel = smbiosPlist.SMBIOS.dgetModel();
DBG("get model from smbios.plist\n");
} else if ( configPlist.getSMBIOS().isDefined() && configPlist.getSMBIOS().getProductName().isDefined() ) { } else if ( configPlist.getSMBIOS().isDefined() && configPlist.getSMBIOS().getProductName().isDefined() ) {
GlobalConfig.CurrentModel = configPlist.getSMBIOS().dgetModel(); GlobalConfig.CurrentModel = configPlist.getSMBIOS().dgetModel();
DBG("get model from config.plist\n");
} else { } else {
GlobalConfig.CurrentModel = GetDefaultModel(); GlobalConfig.CurrentModel = GetDefaultModel();
DBG("get default model\n");
} }
if ( !EFI_ERROR(Status) ) { if ( !EFI_ERROR(Status) ) {
@ -955,6 +991,13 @@ void ConfigManager::GetUEFIMacAddress()
} }
} }
//EFI_STATUS ConfigManager::ReLoadSmbios(XStringW& tmpStr) //TODO
//{
// DBG("SMBIOS reloaded from %ls\n", tmpStr.wc_str());
// return EFI_SUCCESS;
//}
EFI_STATUS ConfigManager::ReLoadConfig(const XStringW& ConfName) EFI_STATUS ConfigManager::ReLoadConfig(const XStringW& ConfName)
{ {
/* I'm pretty sure, one day, there will be other things to do than just LoadConfig */ /* I'm pretty sure, one day, there will be other things to do than just LoadConfig */

View File

@ -165,6 +165,7 @@ public:
ConfigManager& operator= (ConfigManager &&other) = delete; ConfigManager& operator= (ConfigManager &&other) = delete;
void FillSmbiosWithDefaultValue(MacModel Model, const SmbiosPlistClass::SmbiosDictClass& smbiosDictClass); void FillSmbiosWithDefaultValue(MacModel Model, const SmbiosPlistClass::SmbiosDictClass& smbiosDictClass);
void ReloadSmbios(XStringW& str);
/* /*
* Look for {ConfName}.plist and smbios.plist and load them, "transfer" the settings into gSettings and call afterGetUserSettings() * Look for {ConfName}.plist and smbios.plist and load them, "transfer" the settings into gSettings and call afterGetUserSettings()
@ -173,6 +174,7 @@ public:
* 2021-04 : not really tested yet. * 2021-04 : not really tested yet.
*/ */
EFI_STATUS ReLoadConfig(const XStringW& ConfName); EFI_STATUS ReLoadConfig(const XStringW& ConfName);
// EFI_STATUS ReLoadSmbios(XStringW& tmpStr);
/* /*
* Populate SlotDeviceArray, GfxPropertiesArray, HdaPropertiesArray, LanCardArray * Populate SlotDeviceArray, GfxPropertiesArray, HdaPropertiesArray, LanCardArray

View File

@ -72,15 +72,26 @@ public:
DevicesClass Devices = DevicesClass(); DevicesClass Devices = DevicesClass();
XmlStringWArray DisableDrivers = XmlStringWArray(); XmlStringWArray DisableDrivers = XmlStringWArray();
GUI_Class GUI = GUI_Class(); GUI_Class GUI = GUI_Class();
Graphics_Class Graphics; // Cannot do this : = Graphics_Class(*this); because of a MSVC bug. Compilation failed at ssignment of m_fields because all member become const. Graphics_Class Graphics; // Cannot do this : = Graphics_Class(*this); because of a MSVC bug. Compilation failed at assignment of m_fields because all member become const.
KernelAndKextPatches_Class KernelAndKextPatches = KernelAndKextPatches_Class(); KernelAndKextPatches_Class KernelAndKextPatches = KernelAndKextPatches_Class();
SmbiosPlistClass::SmbiosDictClass SMBIOS = SmbiosPlistClass::SmbiosDictClass(); // use the same dict as for standalone smbios plist SmbiosPlistClass::SmbiosDictClass SMBIOS = SmbiosPlistClass::SmbiosDictClass(); // use the same dict as for standalone smbios plist
SmbiosPlistClass::SmbiosDictClass SMBIOS_lion = SmbiosPlistClass::SmbiosDictClass();
SmbiosPlistClass::SmbiosDictClass SMBIOS_mav = SmbiosPlistClass::SmbiosDictClass();
SmbiosPlistClass::SmbiosDictClass SMBIOS_cap = SmbiosPlistClass::SmbiosDictClass();
SmbiosPlistClass::SmbiosDictClass SMBIOS_hsierra = SmbiosPlistClass::SmbiosDictClass();
SmbiosPlistClass::SmbiosDictClass SMBIOS_moja = SmbiosPlistClass::SmbiosDictClass();
SmbiosPlistClass::SmbiosDictClass SMBIOS_cata = SmbiosPlistClass::SmbiosDictClass();
SmbiosPlistClass::SmbiosDictClass SMBIOS_bigsur = SmbiosPlistClass::SmbiosDictClass();
SmbiosPlistClass::SmbiosDictClass SMBIOS_monterey = SmbiosPlistClass::SmbiosDictClass();
SmbiosPlistClass::SmbiosDictClass SMBIOS_ventura = SmbiosPlistClass::SmbiosDictClass();
SmbiosPlistClass::SmbiosDictClass SMBIOS_sonoma = SmbiosPlistClass::SmbiosDictClass();
// SmbiosPlistClass::SmbiosDictClass SMBIOS_lion = SmbiosPlistClass::SmbiosDictClass();
public: public:
SystemParameters_Class SystemParameters = SystemParameters_Class(); SystemParameters_Class SystemParameters = SystemParameters_Class();
RtVariables_Class RtVariables = RtVariables_Class(); RtVariables_Class RtVariables = RtVariables_Class();
Quirks_Class Quirks = Quirks_Class(); Quirks_Class Quirks = Quirks_Class();
XmlDictField m_fields[13] = { XmlDictField m_fields[23] = {
{"ACPI", ACPI}, {"ACPI", ACPI},
{"Boot", Boot}, {"Boot", Boot},
{"BootGraphics", BootGraphics}, {"BootGraphics", BootGraphics},
@ -91,6 +102,16 @@ public:
{"Graphics", Graphics}, {"Graphics", Graphics},
{"KernelAndKextPatches", KernelAndKextPatches}, {"KernelAndKextPatches", KernelAndKextPatches},
{"SMBIOS", SMBIOS}, {"SMBIOS", SMBIOS},
{"SMBIOS_lion", SMBIOS_lion},
{"SMBIOS_mav", SMBIOS_mav},
{"SMBIOS_cap", SMBIOS_cap},
{"SMBIOS_hsierra", SMBIOS_hsierra},
{"SMBIOS_moja", SMBIOS_moja},
{"SMBIOS_cata", SMBIOS_cata},
{"SMBIOS_bigsur", SMBIOS_bigsur},
{"SMBIOS_monterey", SMBIOS_monterey},
{"SMBIOS_ventura", SMBIOS_ventura},
{"SMBIOS_sonoma", SMBIOS_sonoma},
{"SystemParameters", SystemParameters}, {"SystemParameters", SystemParameters},
{"RtVariables", RtVariables}, {"RtVariables", RtVariables},
{"Quirks", Quirks}, {"Quirks", Quirks},
@ -123,8 +144,16 @@ public:
} }
const decltype(DisableDrivers)::ValueType& dgetDisabledDriverArray() const { return DisableDrivers.isDefined() ? DisableDrivers.value() : DisableDrivers.nullValue; }; const decltype(DisableDrivers)::ValueType& dgetDisabledDriverArray() const { return DisableDrivers.isDefined() ? DisableDrivers.value() : DisableDrivers.nullValue; };
const decltype(SMBIOS)& getSMBIOS() const { return SMBIOS; }; const decltype(SMBIOS)& getSMBIOS() const {
for (size_t i=0; i<sizeof(m_fields)/sizeof(m_fields[0]); i++) {
XStringW h;
h.takeValueFrom(m_fields[i].m_name);
if (SmbiosList.size() > 0 && SmbiosList[OldChosenSmbios] == h) {
return static_cast<SmbiosPlistClass::SmbiosDictClass&>(m_fields[i].xmlAbstractType);
}
}
return SMBIOS;
};
}; };
#endif /* _CONFIGPLISTCLASS_H_ */ #endif /* _CONFIGPLISTCLASS_H_ */

View File

@ -42,6 +42,17 @@
#include "ConfigPlistAbstract.h" #include "ConfigPlistAbstract.h"
extern XStringWArray ThemeNameArray;
extern XStringWArray ConfigsList;
extern XStringWArray DsdtsList;
extern XStringWArray SmbiosList;
extern INTN OldChosenTheme;
extern INTN OldChosenConfig;
extern INTN OldChosenSmbios;
class SmbiosPlistClass : public ConfigPlistAbstractClass class SmbiosPlistClass : public ConfigPlistAbstractClass
{ {
@ -191,8 +202,6 @@ public:
}; };
XmlUInt8 SlotCount = XmlUInt8(); XmlUInt8 SlotCount = XmlUInt8();
XmlUInt8 Channels = XmlUInt8(); XmlUInt8 Channels = XmlUInt8();
ModuleArrayClass Modules = ModuleArrayClass(); ModuleArrayClass Modules = ModuleArrayClass();
@ -234,23 +243,6 @@ public:
decltype(SlotCount)::ValueType dgetSlotCount() const { return SlotCount.isDefined() ? SlotCount.value() : 0; }; decltype(SlotCount)::ValueType dgetSlotCount() const { return SlotCount.isDefined() ? SlotCount.value() : 0; };
const decltype(Channels)::ValueType& dgetUserChannels() const { return Channels.isDefined() ? Channels.value() : Channels.nullValue; }; const decltype(Channels)::ValueType& dgetUserChannels() const { return Channels.isDefined() ? Channels.value() : Channels.nullValue; };
// decltype(SlotCount)::ValueType dgetSlotMax() const {
// if ( !isDefined() || !Modules.isDefined() || Modules.size() == 0 ) return 0;
// uint8_t max = 0;
// for ( size_t idx = 0 ; idx < Modules.size() ; ++idx ) {
// if ( Modules[idx].dgetModuleSize() > 0 ) {
// if ( Modules[idx].dgetSlotIndex() > UINT8_MAX ) {
// log_technical_bug("Modules[idx].dgetSlotNo() > UINT8_MAX");
// }else{
// if ( Modules[idx].dgetSlotIndex() > max ) max = (uint8_t)Modules[idx].dgetSlotIndex(); // safe cast Modules[idx].dgetSlotNo() is <= UINT8_MAX
// }
// }
// }
// return max+1;
// };
//
// decltype(SlotCount)::ValueType dgetSlotCounts() const { return dgetSlotCountSetting() > dgetSlotMax() ? dgetSlotCountSetting() : dgetSlotMax(); };
}; };
class SlotDeviceDictClass : public XmlDict class SlotDeviceDictClass : public XmlDict
@ -770,9 +762,29 @@ public:
}; };
SmbiosDictClass SMBIOS = SmbiosDictClass(); SmbiosDictClass SMBIOS = SmbiosDictClass();
SmbiosDictClass SMBIOS_lion = SmbiosDictClass();
SmbiosDictClass SMBIOS_mav = SmbiosDictClass();
SmbiosDictClass SMBIOS_cap = SmbiosDictClass();
SmbiosDictClass SMBIOS_hsierra = SmbiosDictClass();
SmbiosDictClass SMBIOS_moja = SmbiosDictClass();
SmbiosDictClass SMBIOS_cata = SmbiosDictClass();
SmbiosDictClass SMBIOS_bigsur = SmbiosDictClass();
SmbiosDictClass SMBIOS_monterey = SmbiosDictClass();
SmbiosDictClass SMBIOS_ventura = SmbiosDictClass();
SmbiosDictClass SMBIOS_sonoma = SmbiosDictClass();
XmlDictField m_fields[1] = { XmlDictField m_fields[11] = {
{"SMBIOS", SMBIOS}, {"SMBIOS", SMBIOS},
{"SMBIOS_lion", SMBIOS_lion},
{"SMBIOS_mav", SMBIOS_mav},
{"SMBIOS_cap", SMBIOS_cap},
{"SMBIOS_hsierra", SMBIOS_hsierra},
{"SMBIOS_moja", SMBIOS_moja},
{"SMBIOS_cata", SMBIOS_cata},
{"SMBIOS_bigsur", SMBIOS_bigsur},
{"SMBIOS_monterey", SMBIOS_monterey},
{"SMBIOS_ventura", SMBIOS_ventura},
{"SMBIOS_sonoma", SMBIOS_sonoma},
}; };
public: public:
@ -781,13 +793,19 @@ public:
public: public:
SmbiosPlistClass() {}; SmbiosPlistClass() {};
const decltype(SMBIOS)& getSMBIOS() const { return SMBIOS; }; const decltype(SMBIOS)& getSMBIOS() const {
for (size_t i=0; i<sizeof(m_fields)/sizeof(m_fields[0]); i++) {
XStringW h;
h.takeValueFrom(m_fields[i].m_name);
if (SmbiosList.size() > 0 && SmbiosList[OldChosenSmbios] == h) {
return static_cast<SmbiosDictClass&>(m_fields[i].xmlAbstractType);
}
}
return SMBIOS;
};
}; };
//extern const ConfigPlist& configPlist;
//extern const ConfigPlist& getConfigPlist();
#endif /* _SMBIOSPLISTCLASS_H_ */ #endif /* _SMBIOSPLISTCLASS_H_ */

View File

@ -35,9 +35,9 @@ XmlAbstractType& XmlDict::parseValueFromXmlLite(XmlLiteParser* xmlLiteParser, co
size_t nb; size_t nb;
*keyFound = false; *keyFound = false;
getFields(&fields, &nb); getFields(&fields, &nb);
if ( nb == 0 ) { // if ( nb == 0 ) {
panic("Dict '%s' has no field defined", xmlPath.c_str()); // panic("Dict '%s' has no field defined", xmlPath.c_str());
} // }
for ( size_t idx = 0 ; !*keyFound && idx < nb ; idx++ ) for ( size_t idx = 0 ; !*keyFound && idx < nb ; idx++ )
{ {
XmlDictField& xmlDictField = fields[idx]; XmlDictField& xmlDictField = fields[idx];
@ -54,21 +54,7 @@ if ( strcmp(fieldName, "AutoMerge") == 0 ) {
} }
#endif #endif
*keyFound = true; *keyFound = true;
//#ifdef JIEF_DEBUG
// XmlParserPosition pos = xmlLiteParser->getPosition();
//#endif
// if ( xmlAbstractType.isDefined() ) {
// xmlLiteParser->addWarning(generateErrors, S8Printf("Tag '%s:%d' is previously defined. Previous value ignored.", xmlPath.c_str(), keyPos.getLine()));
// xmlAbstractType.reset();
// }
// if ( !xmlAbstractType.parseFromXmlLite(xmlLiteParser, xmlPath, generateErrors) ) {
////#ifdef JIEF_DEBUG
//// xmlAbstractType.reset();
//// xmlLiteParser->restorePosition(pos);
//// xmlAbstractType.parseFromXmlLite(xmlLiteParser, xmlPath, false);
////#endif
// }
if ( xmlAbstractType.isDefined() ) { if ( xmlAbstractType.isDefined() ) {
xmlLiteParser->addWarning(generateErrors, S8Printf("Tag '%s:%d' is previously defined. New value ignored.", xmlPath.c_str(), keyPos.getLine())); xmlLiteParser->addWarning(generateErrors, S8Printf("Tag '%s:%d' is previously defined. New value ignored.", xmlPath.c_str(), keyPos.getLine()));
xmlLiteParser->skipNextTag(false); xmlLiteParser->skipNextTag(false);
@ -110,9 +96,6 @@ size_t* keyValueLengthPtr)
if ( xmlPath.lastChar() == '/' ) xmlSubPath.S8Catf("%.*s", (int)keyValueLength, keyValue); if ( xmlPath.lastChar() == '/' ) xmlSubPath.S8Catf("%.*s", (int)keyValueLength, keyValue);
else xmlSubPath.S8Catf("/%.*s", (int)keyValueLength, keyValue); else xmlSubPath.S8Catf("/%.*s", (int)keyValueLength, keyValue);
//#ifdef JIEF_DEBUG
//XmlParserPosition valuePos = xmlLiteParser->getPosition();
//#endif
XBool keyFound; XBool keyFound;
XmlAbstractType& xmlAbstractType = parseValueFromXmlLite(xmlLiteParser, xmlSubPath, generateErrors, keyPos, keyValue, keyValueLength, &keyFound); XmlAbstractType& xmlAbstractType = parseValueFromXmlLite(xmlLiteParser, xmlSubPath, generateErrors, keyPos, keyValue, keyValueLength, &keyFound);
@ -125,15 +108,6 @@ size_t* keyValueLengthPtr)
xmlLiteParser->skipNextTag(generateErrors); // return value doesn't need to be tested, because skipNextTag() set xmlLiteParser::xmlParsingError to true. xmlLiteParser->skipNextTag(generateErrors); // return value doesn't need to be tested, because skipNextTag() set xmlLiteParser::xmlParsingError to true.
} }
//#ifdef JIEF_DEBUG
// if ( xmlLiteParser->xmlParsingError ) {
// xmlLiteParser->restorePosition(valuePos);
// reset();
// XmlAbstractType& xmlAbstractType2 = parseValueFromXmlLite(xmlLiteParser, xmlSubPath, false, keyPos, keyValue, keyValueLength, &keyFound);
// (void)xmlAbstractType2;
// }
//#endif
return xmlAbstractType; return xmlAbstractType;
} }
@ -144,22 +118,13 @@ XBool XmlDict::parseFromXmlLite(XmlLiteParser* xmlLiteParser, const XString8& xm
RETURN_IF_FALSE ( xmlLiteParser->consumeOpeningTag("dict", generateErrors) ); RETURN_IF_FALSE ( xmlLiteParser->consumeOpeningTag("dict", generateErrors) );
setDefined(); setDefined();
// const char* keyValue;
// size_t keyValueLength;
// XString8 xmlSubPath;
while ( !xmlLiteParser->isEof() && !xmlLiteParser->nextTagIsClosingTag("dict") ) while ( !xmlLiteParser->isEof() && !xmlLiteParser->nextTagIsClosingTag("dict") )
{ {
// RETURN_IF_FALSE( xmlLiteParser->getKeyTagValue(&keyValue, &keyValueLength, &keyPos, true) );
// xmlSubPath = xmlPath;
// xmlSubPath.S8Catf("/%.*s", (int)keyValueLength, keyValue);
// //
#ifdef JIEF_DEBUG #ifdef JIEF_DEBUG
XmlParserPosition valuePos = xmlLiteParser->getPosition(); XmlParserPosition valuePos = xmlLiteParser->getPosition();
(void)valuePos; (void)valuePos;
#endif #endif
// XBool keyFound;
// XmlAbstractType& xmlAbstractType = parseValueFromXmlLite(xmlLiteParser, xmlSubPath, generateErrors, keyPos, keyValue, keyValueLength, &keyFound);
XmlParserPosition keyPos = xmlLiteParser->getPosition(); XmlParserPosition keyPos = xmlLiteParser->getPosition();
@ -169,11 +134,7 @@ XmlParserPosition valuePos = xmlLiteParser->getPosition();
XmlAbstractType& xmlAbstractType = parseKeyAndValueFromXmlLite(xmlLiteParser, xmlPath, generateErrors, &keyValue, &keyValueLength); XmlAbstractType& xmlAbstractType = parseKeyAndValueFromXmlLite(xmlLiteParser, xmlPath, generateErrors, &keyValue, &keyValueLength);
// if ( xmlLiteParser->xmlParsingError ) {
// //return false;
// }
// else
// {
if ( xmlAbstractType.isDefined() ) if ( xmlAbstractType.isDefined() )
{ {
XString8 xmlSubPath = xmlPath.lastChar() == '/' ? S8Printf("%s%.*s", xmlPath.c_str(), (int)keyValueLength, keyValue) : S8Printf("%s/%.*s", xmlPath.c_str(), (int)keyValueLength, keyValue); XString8 xmlSubPath = xmlPath.lastChar() == '/' ? S8Printf("%s%.*s", xmlPath.c_str(), (int)keyValueLength, keyValue) : S8Printf("%s/%.*s", xmlPath.c_str(), (int)keyValueLength, keyValue);
@ -189,10 +150,7 @@ XmlParserPosition valuePos = xmlLiteParser->getPosition();
return false; return false;
} }
} }
// if !xmlAbstractType.isDefined(), it's because a unknown key, or a comment.
// Just try to continue.
} }
// }
} }
RETURN_IF_FALSE ( xmlLiteParser->consumeClosingTag("dict", generateErrors) ); RETURN_IF_FALSE ( xmlLiteParser->consumeClosingTag("dict", generateErrors) );
return true; return true;
@ -200,30 +158,10 @@ XmlParserPosition valuePos = xmlLiteParser->getPosition();
XBool XmlDict::validate(XmlLiteParser* xmlLiteParser, const XString8& xmlPath, const XmlParserPosition& pos, XBool generateErrors) XBool XmlDict::validate(XmlLiteParser* xmlLiteParser, const XString8& xmlPath, const XmlParserPosition& pos, XBool generateErrors)
{ {
(void)xmlLiteParser; // (void)xmlLiteParser;
(void)xmlPath; // (void)xmlPath;
(void)pos; // (void)pos;
(void)generateErrors; // (void)generateErrors;
// XmlDictField* fields;
// size_t nb;
// getFields(&fields, &nb);
// for ( size_t idx = 0 ; idx < nb ; idx++ ) {
// XmlDictField& xmlDictField = fields[idx];
// XmlAbstractType& xmlAbstractType = xmlDictField.xmlAbstractType;
// XString8 subXmlPath = S8Printf("%s/%s", xmlPath.c_str(), xmlDictField.m_name);
//#ifdef JIEF_DEBUG
////if ( subXmlPath == "/ACPI/DSDT/Name"_XS8 ) {
//if ( subXmlPath == "/Boot/Policy"_XS8 ) {
// printf("");
//}
//#endif
// if ( !xmlAbstractType.validate(xmlLiteParser, subXmlPath, pos, generateErrors) ) {
// #ifdef JIEF_DEBUG
//// xmlAbstractType.validate(xmlLiteParser, subXmlPath, pos, false);
// #endif
// return false;
// }
// }
return true; return true;
} }

View File

@ -215,7 +215,6 @@ void ScanLegacy(void)
for (VolumeIndex = 0; VolumeIndex < Volumes.size(); VolumeIndex++) { for (VolumeIndex = 0; VolumeIndex < Volumes.size(); VolumeIndex++) {
Volume = &Volumes[VolumeIndex]; Volume = &Volumes[VolumeIndex];
// DBG("test VI=%d\n", VolumeIndex);
if ((Volume->BootType != BOOTING_BY_PBR) && if ((Volume->BootType != BOOTING_BY_PBR) &&
(Volume->BootType != BOOTING_BY_MBR) && (Volume->BootType != BOOTING_BY_MBR) &&
(Volume->BootType != BOOTING_BY_CD)) { (Volume->BootType != BOOTING_BY_CD)) {
@ -223,21 +222,6 @@ void ScanLegacy(void)
continue; continue;
} }
// DBG("%2d: '%ls' (%ls)", VolumeIndex, Volume->VolName, Volume->LegacyOS->IconName);
#if 0 // REFIT_DEBUG > 0
DBG(" %d %ls\n %d %d %ls %d %ls\n",
VolumeIndex, FileDevicePathToStr(Volume->DevicePath),
Volume->DiskKind, Volume->MbrPartitionIndex,
Volume->IsAppleLegacy ? L"AL" : L"--", Volume->HasBootCode,
Volume->VolName ? Volume->VolName : L"(no name)");
#endif
// skip volume if its kind is configured as disabled
/* if ((Volume->DiskKind == DISK_KIND_OPTICAL && (GlobalConfig.DisableFlags & VOLTYPE_OPTICAL)) ||
(Volume->DiskKind == DISK_KIND_EXTERNAL && (GlobalConfig.DisableFlags & VOLTYPE_EXTERNAL)) ||
(Volume->DiskKind == DISK_KIND_INTERNAL && (GlobalConfig.DisableFlags & VOLTYPE_INTERNAL)) ||
(Volume->DiskKind == DISK_KIND_FIREWIRE && (GlobalConfig.DisableFlags & VOLTYPE_FIREWIRE))) */
if (((1ull<<Volume->DiskKind) & GlobalConfig.DisableFlags) != 0) if (((1ull<<Volume->DiskKind) & GlobalConfig.DisableFlags) != 0)
{ {
// DBG(" hidden\n"); // DBG(" hidden\n");
@ -251,11 +235,8 @@ void ScanLegacy(void)
HideIfOthersFound = true; HideIfOthersFound = true;
} else if (Volume->HasBootCode) { } else if (Volume->HasBootCode) {
ShowVolume = true; ShowVolume = true;
// DBG("Volume %d will be shown BlockIo=%X WholeIo=%X\n",
// VolumeIndex, Volume->BlockIO, Volume->WholeDiskBlockIO);
if ((Volume->WholeDiskBlockIO == 0) && if ((Volume->WholeDiskBlockIO == 0) &&
Volume->BlockIOOffset == 0 /* && Volume->BlockIOOffset == 0 )
Volume->OSName == NULL */)
// this is a whole disk (MBR) entry; hide if we have entries for partitions // this is a whole disk (MBR) entry; hide if we have entries for partitions
HideIfOthersFound = true; HideIfOthersFound = true;
// DBG("Hide it!\n"); // DBG("Hide it!\n");

View File

@ -839,7 +839,7 @@ GetOSIconName (const MacOsVersion& OSVersion)
if (OSVersion.isEmpty()) { if (OSVersion.isEmpty()) {
OSIconName = L"mac"_XSW; OSIconName = L"mac"_XSW;
} else if (OSVersion.elementAt(0) == 14 ){ } else if (OSVersion.elementAt(0) == 14 ){
// Ventura // Sonoma
OSIconName = L"sonoma,mac"_XSW; OSIconName = L"sonoma,mac"_XSW;
} else if (OSVersion.elementAt(0) == 13 ){ } else if (OSVersion.elementAt(0) == 13 ){
// Ventura // Ventura
@ -918,7 +918,6 @@ STATIC LOADER_ENTRY *CreateLoaderEntry(IN CONST XStringW& LoaderPath,
EFI_DEVICE_PATH *LoaderDevicePath; EFI_DEVICE_PATH *LoaderDevicePath;
XStringW LoaderDevicePathString; XStringW LoaderDevicePathString;
XStringW FilePathAsString; XStringW FilePathAsString;
// CONST CHAR16 *OSIconName = NULL;
CHAR16 ShortcutLetter; CHAR16 ShortcutLetter;
LOADER_ENTRY *Entry; LOADER_ENTRY *Entry;
CONST CHAR8 *indent = " "; CONST CHAR8 *indent = " ";
@ -944,8 +943,7 @@ STATIC LOADER_ENTRY *CreateLoaderEntry(IN CONST XStringW& LoaderPath,
DBG("%sskipped because path `%ls` is self path!\n", indent, LoaderDevicePathString.wc_str()); DBG("%sskipped because path `%ls` is self path!\n", indent, LoaderDevicePathString.wc_str());
return NULL; return NULL;
} }
// DBG("OSType =%d\n", OSType);
// DBG("prepare the menu entry\n");
// prepare the menu entry // prepare the menu entry
Entry = new LOADER_ENTRY; Entry = new LOADER_ENTRY;
@ -1081,23 +1079,11 @@ if ( Entry->APFSTargetUUID.Data1 == 0x99999999 ) {
case OSTYPE_OSX: case OSTYPE_OSX:
case OSTYPE_RECOVERY: case OSTYPE_RECOVERY:
case OSTYPE_OSX_INSTALLER: case OSTYPE_OSX_INSTALLER:
OSIconName = GetOSIconName(Entry->macOSVersion);// Sothor - Get OSIcon name using OSVersion OSIconName = GetOSIconName(Entry->macOSVersion);
// apianti - force custom logo even when verbose
/* this is not needed, as this flag is also being unset when booting if -v is present (LoadOptions may change until then)
if ( Entry->LoadOptions.containsIC("-v") ) {
// OSX is not booting verbose, so we can set console to graphics mode
Entry->Flags = OSFLAG_UNSET(Entry->Flags, OSFLAG_USEGRAPHICS);
}
*/
if (OSType == OSTYPE_OSX && IsOsxHibernated(Entry)) { if (OSType == OSTYPE_OSX && IsOsxHibernated(Entry)) {
Entry->Flags = OSFLAG_SET(Entry->Flags, OSFLAG_HIBERNATED); Entry->Flags = OSFLAG_SET(Entry->Flags, OSFLAG_HIBERNATED);
DBG("%s =>set entry as hibernated\n", indent); DBG("%s =>set entry as hibernated\n", indent);
} }
//always unset checkFakeSmc for installer
if (OSType == OSTYPE_OSX_INSTALLER){
// Entry->Flags = OSFLAG_UNSET(Entry->Flags, OSFLAG_CHECKFAKESMC);
// Entry->Flags = OSFLAG_SET(Entry->Flags, OSFLAG_WITHKEXTS);
}
ShortcutLetter = 'M'; ShortcutLetter = 'M';
if ( Entry->DisplayedVolName.isEmpty() ) { if ( Entry->DisplayedVolName.isEmpty() ) {
// else no sense to override it with dubious name // else no sense to override it with dubious name
@ -1136,6 +1122,8 @@ if ( Entry->APFSTargetUUID.Data1 == 0x99999999 ) {
break; break;
} }
//DBG("OSIconName=%ls \n", OSIconName); //DBG("OSIconName=%ls \n", OSIconName);
Entry->OSName = OSIconName.subString(0, OSIconName.indexOf(',')); //TODO
// SmbiosList.AddReference(OSName.forgetDataWithoutFreeing(), true);
Entry->Title = FullTitle; Entry->Title = FullTitle;
if (Entry->Title.isEmpty() && Volume->VolLabel.notEmpty()) { if (Entry->Title.isEmpty() && Volume->VolLabel.notEmpty()) {
if (Volume->VolLabel[0] == L'#') { if (Volume->VolLabel[0] == L'#') {
@ -1222,9 +1210,6 @@ if ( Entry->APFSTargetUUID.Data1 == 0x99999999 ) {
} }
} }
Entry->BootBgColor = BootBgColor; Entry->BootBgColor = BootBgColor;
// Entry->KernelAndKextPatches = ((Patches == NULL) ? (KERNEL_AND_KEXT_PATCHES *)(((UINTN)&gSettings) + OFFSET_OF(SETTINGS_DATA, KernelAndKextPatches)) : Patches);
// CopyKernelAndKextPatches(&Entry->KernelAndKextPatches, Patches == NULL ? &gSettings.KernelAndKextPatches : Patches);
Entry->KernelAndKextPatches = Patches == NULL ? gSettings.KernelAndKextPatches : *Patches; Entry->KernelAndKextPatches = Patches == NULL ? gSettings.KernelAndKextPatches : *Patches;
#ifdef DUMP_KERNEL_KEXT_PATCHES #ifdef DUMP_KERNEL_KEXT_PATCHES
@ -1236,16 +1221,11 @@ if ( Entry->APFSTargetUUID.Data1 == 0x99999999 ) {
void LOADER_ENTRY::AddDefaultMenu() void LOADER_ENTRY::AddDefaultMenu()
{ {
XStringW FileName; XStringW FileName;
// CHAR16* TempOptions; LOADER_ENTRY *SubEntry;
// CHAR16 DiagsFileName[256]; UINT64 VolumeSize;
LOADER_ENTRY *SubEntry;
// REFIT_MENU_SCREEN *SubScreen;
// REFIT_VOLUME *Volume;
UINT64 VolumeSize;
EFI_GUID Guid; EFI_GUID Guid;
XBool KernelIs64BitOnly; XBool KernelIs64BitOnly;
// UINT64 os_version = AsciiOSVersionToUint64(OSVersion);
constexpr LString8 quietLitteral = "quiet"_XS8; constexpr LString8 quietLitteral = "quiet"_XS8;
constexpr LString8 splashLitteral = "splash"_XS8; constexpr LString8 splashLitteral = "splash"_XS8;
@ -1303,19 +1283,6 @@ void LOADER_ENTRY::AddDefaultMenu()
SubEntry = getPartiallyDuplicatedEntry(); SubEntry = getPartiallyDuplicatedEntry();
SubEntry->Title.SWPrintf("Boot %s with selected options", macOS); SubEntry->Title.SWPrintf("Boot %s with selected options", macOS);
SubScreen->AddMenuEntry(SubEntry, true); SubScreen->AddMenuEntry(SubEntry, true);
#if 0
SubEntry = getPartiallyDuplicatedEntry();
SubEntry->Title.SWPrintf("Boot %s with injected kexts", macOS);
SubEntry->Flags = OSFLAG_UNSET(SubEntry->Flags, OSFLAG_CHECKFAKESMC);
SubEntry->Flags = OSFLAG_SET(SubEntry->Flags, OSFLAG_WITHKEXTS);
SubScreen->AddMenuEntry(SubEntry, true);
SubEntry = getPartiallyDuplicatedEntry();
SubEntry->Title.SWPrintf("Boot %s without injected kexts", macOS);
SubEntry->Flags = OSFLAG_UNSET(SubEntry->Flags, OSFLAG_CHECKFAKESMC);
SubEntry->Flags = OSFLAG_UNSET(SubEntry->Flags, OSFLAG_WITHKEXTS);
SubScreen->AddMenuEntry(SubEntry, true);
#endif
SubScreen->AddMenuEntry(SubMenuKextInjectMgmt(), true); SubScreen->AddMenuEntry(SubMenuKextInjectMgmt(), true);
SubScreen->AddMenuInfo_f("=== boot-args ==="); SubScreen->AddMenuInfo_f("=== boot-args ===");
if (!KernelIs64BitOnly) { if (!KernelIs64BitOnly) {
@ -1337,15 +1304,9 @@ void LOADER_ENTRY::AddDefaultMenu()
SubScreen->AddMenuCheck("Use Nvidia WEB drivers (nvda_drv=1)", OPT_NVWEBON, 68); SubScreen->AddMenuCheck("Use Nvidia WEB drivers (nvda_drv=1)", OPT_NVWEBON, 68);
SubScreen->AddMenuCheck("Disable PowerNap (darkwake=0)", OPT_POWERNAPOFF, 68); SubScreen->AddMenuCheck("Disable PowerNap (darkwake=0)", OPT_POWERNAPOFF, 68);
SubScreen->AddMenuCheck("Use XNU CPUPM (-xcpm)", OPT_XCPM, 68); SubScreen->AddMenuCheck("Use XNU CPUPM (-xcpm)", OPT_XCPM, 68);
// SubScreen->AddMenuCheck("Disable Intel Idle Mode (-gux_no_idle)", OPT_GNOIDLE, 68);
// SubScreen->AddMenuCheck("Sleep Uses Shutdown (-gux_nosleep)", OPT_GNOSLEEP, 68);
// SubScreen->AddMenuCheck("Force No Msi Int (-gux_nomsi)", OPT_GNOMSI, 68);
// SubScreen->AddMenuCheck("EHC manage USB2 ports (-gux_defer_usb2)", OPT_EHCUSB, 68);
SubScreen->AddMenuCheck("Keep symbols on panic (keepsyms=1)", OPT_KEEPSYMS, 68); SubScreen->AddMenuCheck("Keep symbols on panic (keepsyms=1)", OPT_KEEPSYMS, 68);
SubScreen->AddMenuCheck("Don't reboot on panic (debug=0x100)", OPT_DEBUG, 68); SubScreen->AddMenuCheck("Don't reboot on panic (debug=0x100)", OPT_DEBUG, 68);
SubScreen->AddMenuCheck("Debug kexts (kextlog=0xffff)", OPT_KEXTLOG, 68); SubScreen->AddMenuCheck("Debug kexts (kextlog=0xffff)", OPT_KEXTLOG, 68);
// SubScreen->AddMenuCheck("Disable AppleALC (-alcoff)", OPT_APPLEALC, 68);
// SubScreen->AddMenuCheck("Disable Shiki (-shikioff)", OPT_SHIKI, 68);
if (gSettings.RtVariables.CsrActiveConfig == 0) { if (gSettings.RtVariables.CsrActiveConfig == 0) {
SubScreen->AddMenuCheck("No SIP", OSFLAG_NOSIP, 69); SubScreen->AddMenuCheck("No SIP", OSFLAG_NOSIP, 69);
@ -1438,9 +1399,6 @@ void LOADER_ENTRY::AddDefaultMenu()
SubEntry->Title.SWPrintf("Run %ls", FileName.wc_str()); SubEntry->Title.SWPrintf("Run %ls", FileName.wc_str());
SubScreen->AddMenuEntry(SubEntry, true); SubScreen->AddMenuEntry(SubEntry, true);
} }
// SubScreen->AddMenuEntry(&MenuEntryReturn, false); //one-way ticket to avoid confusion
// DBG(" Added '%ls': OSType='%d', OSVersion='%s'\n",Title,LoaderType,OSVersion);
} }
LOADER_ENTRY* AddLoaderEntry(IN CONST XStringW& LoaderPath, IN CONST XString8Array& LoaderOptions, LOADER_ENTRY* AddLoaderEntry(IN CONST XStringW& LoaderPath, IN CONST XString8Array& LoaderOptions,
@ -1459,32 +1417,13 @@ LOADER_ENTRY* AddLoaderEntry(IN CONST XStringW& LoaderPath, IN CONST XString8Arr
DBG(" skipped because entry is disabled\n"); DBG(" skipped because entry is disabled\n");
return NULL; return NULL;
} }
// if (!gSettings.ShowHiddenEntries && OSFLAG_ISSET(Flags, OSFLAG_HIDDEN)) {
// DBG(" skipped because entry is hidden\n");
// return NULL;
// }
//don't add hided entries
// if (!gSettings.ShowHiddenEntries) {
// for (HVi = 0; HVi < gSettings.HVCount; HVi++) {
// if ( LoaderPath.containsIC(gSettings.GUI.HVHideStrings[HVi]) ) {
// DBG(" hiding entry: %ls\n", LoaderPath.s());
// return NULL;
// }
// }
// }
Entry = CreateLoaderEntry(LoaderPath, LoaderOptions, FullTitle, LoaderTitle, Volume, Image, NULL, OSType, Flags, 0, MenuBackgroundPixel, CUSTOM_BOOT_DISABLED, NullXImage, NULL, false); Entry = CreateLoaderEntry(LoaderPath, LoaderOptions, FullTitle, LoaderTitle, Volume, Image, NULL, OSType, Flags, 0, MenuBackgroundPixel, CUSTOM_BOOT_DISABLED, NullXImage, NULL, false);
if (Entry != NULL) { if (Entry != NULL) {
if ((Entry->LoaderType == OSTYPE_OSX) || if ((Entry->LoaderType == OSTYPE_OSX) ||
(Entry->LoaderType == OSTYPE_OSX_INSTALLER ) || (Entry->LoaderType == OSTYPE_OSX_INSTALLER ) ||
(Entry->LoaderType == OSTYPE_RECOVERY)) { (Entry->LoaderType == OSTYPE_RECOVERY)) {
// if (gSettings.WithKexts) {
// Entry->Flags = OSFLAG_SET(Entry->Flags, OSFLAG_WITHKEXTS);
// }
// if (gSettings.WithKextsIfNoFakeSMC) {
// Entry->Flags = OSFLAG_SET(Entry->Flags, OSFLAG_CHECKFAKESMC);
// Entry->Flags = OSFLAG_SET(Entry->Flags, OSFLAG_WITHKEXTS);
// }
if (gSettings.SystemParameters.NoCaches) { if (gSettings.SystemParameters.NoCaches) {
Entry->Flags = OSFLAG_SET(Entry->Flags, OSFLAG_NOCACHES); Entry->Flags = OSFLAG_SET(Entry->Flags, OSFLAG_NOCACHES);
} }
@ -1501,7 +1440,6 @@ LOADER_ENTRY* AddLoaderEntry(IN CONST XStringW& LoaderPath, IN CONST XString8Arr
} }
} }
//TODO there is a problem that Entry->Flags is unique while InputItems are global ;( //TODO there is a problem that Entry->Flags is unique while InputItems are global ;(
// InputItems[69].IValue = Entry->Flags;
Entry->AddDefaultMenu(); Entry->AddDefaultMenu();
DBG(" Menu entry added at index %zd\n", MainMenu.Entries.sizeIncludingHidden()); DBG(" Menu entry added at index %zd\n", MainMenu.Entries.sizeIncludingHidden());
MainMenu.AddMenuEntry(Entry, true); MainMenu.AddMenuEntry(Entry, true);
@ -1745,9 +1683,6 @@ STATIC void LinuxScan(REFIT_VOLUME *Volume, UINT8 KernelScan, UINT8 Type, XStrin
void AddPRSEntry(REFIT_VOLUME *Volume) void AddPRSEntry(REFIT_VOLUME *Volume)
{ {
INTN WhatBoot = 0; INTN WhatBoot = 0;
//CONST INTN Paper = 1;
//CONST INTN Rock = 2;
//CONST INTN Scissor = 4;
WhatBoot |= FileExists(Volume->RootDir, RockBoot)?Rock:0; WhatBoot |= FileExists(Volume->RootDir, RockBoot)?Rock:0;
WhatBoot |= FileExists(Volume->RootDir, PaperBoot)?Paper:0; WhatBoot |= FileExists(Volume->RootDir, PaperBoot)?Paper:0;
@ -1782,10 +1717,10 @@ XString8 GetAuthRootDmg(const EFI_FILE& dir, const XStringW& path)
XStringW plist = SWPrintf("%ls\\com.apple.Boot.plist", path.wc_str()); XStringW plist = SWPrintf("%ls\\com.apple.Boot.plist", path.wc_str());
if ( !FileExists(dir, plist) ) return NullXString8; if ( !FileExists(dir, plist) ) return NullXString8;
CHAR8* PlistBuffer = NULL; CHAR8* PlistBuffer = NULL;
UINTN PlistLen; UINTN PlistLen;
TagDict* Dict = NULL; TagDict* Dict = NULL;
const TagStruct* Prop = NULL; const TagStruct* Prop = NULL;
EFI_STATUS Status = egLoadFile(&dir, plist.wc_str(), (UINT8 **)&PlistBuffer, &PlistLen); EFI_STATUS Status = egLoadFile(&dir, plist.wc_str(), (UINT8 **)&PlistBuffer, &PlistLen);
if (!EFI_ERROR(Status) && PlistBuffer != NULL && ParseXML(PlistBuffer, &Dict, 0) == EFI_SUCCESS) if (!EFI_ERROR(Status) && PlistBuffer != NULL && ParseXML(PlistBuffer, &Dict, 0) == EFI_SUCCESS)
@ -1878,8 +1813,8 @@ void ScanLoader(void)
DBG("\n"); DBG("\n");
if ( Volume->ApfsContainerUUID.notNull() ) DBG(" ApfsContainerUUID=%s\n", Volume->ApfsContainerUUID.toXString8().c_str()); if ( Volume->ApfsContainerUUID.notNull() ) {DBG(" ApfsContainerUUID=%s\n", Volume->ApfsContainerUUID.toXString8().c_str());}
if ( Volume->ApfsFileSystemUUID.notNull() ) DBG(" ApfsFileSystemUUID=%s\n", Volume->ApfsFileSystemUUID.toXString8().c_str()); if ( Volume->ApfsFileSystemUUID.notNull() ) {DBG(" ApfsFileSystemUUID=%s\n", Volume->ApfsFileSystemUUID.toXString8().c_str());}
// check for Mac OS X Install Data // check for Mac OS X Install Data
@ -2177,8 +2112,6 @@ void ScanLoader(void)
} }
} }
typedef struct EntryIdx { typedef struct EntryIdx {
size_t idx; size_t idx;
REFIT_ABSTRACT_MENU_ENTRY* entry; REFIT_ABSTRACT_MENU_ENTRY* entry;

View File

@ -497,14 +497,6 @@ UINTN REFIT_MENU_SCREEN::InputDialog()
#endif #endif
// if ((Item->ItemType != BoolValue) &&
// (Item->ItemType != RadioSwitch) &&
// (Item->ItemType != CheckBit)) {
// // Grow Item->SValue to SVALUE_MAX_SIZE if we want to edit a text field
// Item->SValue.dataSized(SVALUE_MAX_SIZE);
// }
// Buffer = Item->SValue;
BackupShift = Item->LineShift; BackupShift = Item->LineShift;
BackupPos = Pos; BackupPos = Pos;
@ -516,6 +508,8 @@ UINTN REFIT_MENU_SCREEN::InputDialog()
} else if (Item->ItemType == RadioSwitch) { } else if (Item->ItemType == RadioSwitch) {
if (Item->IValue == 3) { if (Item->IValue == 3) {
OldChosenTheme = Pos? Pos - 1: 0xFFFF; OldChosenTheme = Pos? Pos - 1: 0xFFFF;
} else if (Item->IValue == 65) {
OldChosenSmbios = Pos;
} else if (Item->IValue == 90) { } else if (Item->IValue == 90) {
OldChosenConfig = Pos; OldChosenConfig = Pos;
} else if (Item->IValue == 116) { } else if (Item->IValue == 116) {
@ -1084,10 +1078,10 @@ void REFIT_MENU_SCREEN::TextMenuStyle(IN UINTN Function, IN CONST CHAR16 *ParamT
for (i = 0; i <= ScrollState.MaxIndex; i++) { for (i = 0; i <= ScrollState.MaxIndex; i++) {
ItemWidth = Entries[i].Title.length(); ItemWidth = Entries[i].Title.length();
if (TextMenuWidth < ItemWidth) { if (TextMenuWidth < ItemWidth) {
TextMenuWidth = ItemWidth; TextMenuWidth = ItemWidth;
}
} }
}
if (TextMenuWidth > ConWidth - 6) { if (TextMenuWidth > ConWidth - 6) {
TextMenuWidth = ConWidth - 6; TextMenuWidth = ConWidth - 6;
@ -1095,6 +1089,8 @@ void REFIT_MENU_SCREEN::TextMenuStyle(IN UINTN Function, IN CONST CHAR16 *ParamT
if (Entries[0].getREFIT_MENU_SWITCH() && Entries[0].getREFIT_MENU_SWITCH()->Item->IValue == 90) { if (Entries[0].getREFIT_MENU_SWITCH() && Entries[0].getREFIT_MENU_SWITCH()->Item->IValue == 90) {
j = OldChosenConfig; j = OldChosenConfig;
} else if (Entries[0].getREFIT_MENU_SWITCH() && Entries[0].getREFIT_MENU_SWITCH()->Item->IValue == 65) {
j = OldChosenSmbios;
} else if (Entries[0].getREFIT_MENU_SWITCH() && Entries[0].getREFIT_MENU_SWITCH()->Item->IValue == 116) { } else if (Entries[0].getREFIT_MENU_SWITCH() && Entries[0].getREFIT_MENU_SWITCH()->Item->IValue == 116) {
j = OldChosenDsdt; j = OldChosenDsdt;
} else if (Entries[0].getREFIT_MENU_SWITCH() && Entries[0].getREFIT_MENU_SWITCH()->Item->IValue == 119) { } else if (Entries[0].getREFIT_MENU_SWITCH() && Entries[0].getREFIT_MENU_SWITCH()->Item->IValue == 119) {
@ -1158,6 +1154,8 @@ void REFIT_MENU_SCREEN::TextMenuStyle(IN UINTN Function, IN CONST CHAR16 *ParamT
// update chosen config // update chosen config
if (entry.getREFIT_MENU_SWITCH()->Item->IValue == 90) { if (entry.getREFIT_MENU_SWITCH()->Item->IValue == 90) {
OldChosenItem = OldChosenConfig; OldChosenItem = OldChosenConfig;
} else if (entry.getREFIT_MENU_SWITCH()->Item->IValue == 65) {
OldChosenItem = OldChosenSmbios;
} else if (entry.getREFIT_MENU_SWITCH()->Item->IValue == 116) { } else if (entry.getREFIT_MENU_SWITCH()->Item->IValue == 116) {
OldChosenItem = OldChosenDsdt; OldChosenItem = OldChosenDsdt;
} else if (entry.getREFIT_MENU_SWITCH()->Item->IValue == 119) { } else if (entry.getREFIT_MENU_SWITCH()->Item->IValue == 119) {
@ -1218,6 +1216,8 @@ void REFIT_MENU_SCREEN::TextMenuStyle(IN UINTN Function, IN CONST CHAR16 *ParamT
if (entry.getREFIT_MENU_SWITCH()->Item->IValue == 90) { if (entry.getREFIT_MENU_SWITCH()->Item->IValue == 90) {
OldChosenItem = OldChosenConfig; OldChosenItem = OldChosenConfig;
} else if (entry.getREFIT_MENU_SWITCH()->Item->IValue == 65) {
OldChosenItem = OldChosenSmbios;
} else if (entry.getREFIT_MENU_SWITCH()->Item->IValue == 116) { } else if (entry.getREFIT_MENU_SWITCH()->Item->IValue == 116) {
OldChosenItem = OldChosenDsdt; OldChosenItem = OldChosenDsdt;
} else if (entry.getREFIT_MENU_SWITCH()->Item->IValue == 119) { } else if (entry.getREFIT_MENU_SWITCH()->Item->IValue == 119) {
@ -1254,6 +1254,8 @@ void REFIT_MENU_SCREEN::TextMenuStyle(IN UINTN Function, IN CONST CHAR16 *ParamT
if (entry.getREFIT_MENU_SWITCH()->Item->IValue == 90) { if (entry.getREFIT_MENU_SWITCH()->Item->IValue == 90) {
OldChosenItem = OldChosenConfig; OldChosenItem = OldChosenConfig;
} else if (entry.getREFIT_MENU_SWITCH()->Item->IValue == 65) {
OldChosenItem = OldChosenSmbios;
} else if (entry.getREFIT_MENU_SWITCH()->Item->IValue == 116) { } else if (entry.getREFIT_MENU_SWITCH()->Item->IValue == 116) {
OldChosenItem = OldChosenDsdt; OldChosenItem = OldChosenDsdt;
} else if (entry.getREFIT_MENU_SWITCH()->Item->IValue == 119) { } else if (entry.getREFIT_MENU_SWITCH()->Item->IValue == 119) {
@ -1562,6 +1564,8 @@ void REFIT_MENU_SCREEN::GraphicsMenuStyle(IN UINTN Function, IN CONST CHAR16 *Pa
if (entry.getREFIT_MENU_SWITCH()) { if (entry.getREFIT_MENU_SWITCH()) {
if (entry.getREFIT_MENU_SWITCH()->Item->IValue == 3) { if (entry.getREFIT_MENU_SWITCH()->Item->IValue == 3) {
Chosen = (OldChosenTheme == 0xFFFF) ? 0: (OldChosenTheme + 1); Chosen = (OldChosenTheme == 0xFFFF) ? 0: (OldChosenTheme + 1);
} else if (entry.getREFIT_MENU_SWITCH()->Item->IValue == 65) {
Chosen = OldChosenSmbios;
} else if (entry.getREFIT_MENU_SWITCH()->Item->IValue == 90) { } else if (entry.getREFIT_MENU_SWITCH()->Item->IValue == 90) {
Chosen = OldChosenConfig; Chosen = OldChosenConfig;
} else if (entry.getREFIT_MENU_SWITCH()->Item->IValue == 116) { } else if (entry.getREFIT_MENU_SWITCH()->Item->IValue == 116) {
@ -1696,6 +1700,8 @@ void REFIT_MENU_SCREEN::GraphicsMenuStyle(IN UINTN Function, IN CONST CHAR16 *Pa
if (Entry->getREFIT_MENU_SWITCH()->Item->IValue == 3) { if (Entry->getREFIT_MENU_SWITCH()->Item->IValue == 3) {
//OldChosenItem = OldChosenTheme; //OldChosenItem = OldChosenTheme;
OldChosenItem = (OldChosenTheme == 0xFFFF) ? 0: (OldChosenTheme + 1); OldChosenItem = (OldChosenTheme == 0xFFFF) ? 0: (OldChosenTheme + 1);
} else if (Entry->getREFIT_MENU_SWITCH()->Item->IValue == 65) {
OldChosenItem = OldChosenSmbios;
} else if (Entry->getREFIT_MENU_SWITCH()->Item->IValue == 90) { } else if (Entry->getREFIT_MENU_SWITCH()->Item->IValue == 90) {
OldChosenItem = OldChosenConfig; OldChosenItem = OldChosenConfig;
} else if (Entry->getREFIT_MENU_SWITCH()->Item->IValue == 116) { } else if (Entry->getREFIT_MENU_SWITCH()->Item->IValue == 116) {
@ -1760,6 +1766,8 @@ void REFIT_MENU_SCREEN::GraphicsMenuStyle(IN UINTN Function, IN CONST CHAR16 *Pa
} else if (EntryL->getREFIT_MENU_SWITCH()) { //radio buttons 0,1 } else if (EntryL->getREFIT_MENU_SWITCH()) { //radio buttons 0,1
if (EntryL->getREFIT_MENU_SWITCH()->Item->IValue == 3) { if (EntryL->getREFIT_MENU_SWITCH()->Item->IValue == 3) {
OldChosenItem = (OldChosenTheme == 0xFFFF) ? 0: OldChosenTheme + 1; OldChosenItem = (OldChosenTheme == 0xFFFF) ? 0: OldChosenTheme + 1;
} else if (EntryL->getREFIT_MENU_SWITCH()->Item->IValue == 65) {
OldChosenItem = OldChosenSmbios;
} else if (EntryL->getREFIT_MENU_SWITCH()->Item->IValue == 90) { } else if (EntryL->getREFIT_MENU_SWITCH()->Item->IValue == 90) {
OldChosenItem = OldChosenConfig; OldChosenItem = OldChosenConfig;
} else if (EntryL->getREFIT_MENU_SWITCH()->Item->IValue == 116) { } else if (EntryL->getREFIT_MENU_SWITCH()->Item->IValue == 116) {
@ -1791,6 +1799,8 @@ void REFIT_MENU_SCREEN::GraphicsMenuStyle(IN UINTN Function, IN CONST CHAR16 *Pa
if ( EntryC->getREFIT_MENU_SWITCH() ) { if ( EntryC->getREFIT_MENU_SWITCH() ) {
if (EntryC->getREFIT_MENU_SWITCH()->Item->IValue == 3) { if (EntryC->getREFIT_MENU_SWITCH()->Item->IValue == 3) {
OldChosenItem = (OldChosenTheme == 0xFFFF) ? 0: OldChosenTheme + 1; OldChosenItem = (OldChosenTheme == 0xFFFF) ? 0: OldChosenTheme + 1;
} else if (EntryC->getREFIT_MENU_SWITCH()->Item->IValue == 65) {
OldChosenItem = OldChosenSmbios;
} else if (EntryC->getREFIT_MENU_SWITCH()->Item->IValue == 90) { } else if (EntryC->getREFIT_MENU_SWITCH()->Item->IValue == 90) {
OldChosenItem = OldChosenConfig; OldChosenItem = OldChosenConfig;
} else if (EntryC->getREFIT_MENU_SWITCH()->Item->IValue == 116) { } else if (EntryC->getREFIT_MENU_SWITCH()->Item->IValue == 116) {

View File

@ -355,6 +355,7 @@ class REFIT_ABSTRACT_MENU_ENTRY
EFI_GUID APFSTargetUUID; EFI_GUID APFSTargetUUID;
XStringW DisplayedVolName; XStringW DisplayedVolName;
XStringW OSName;
EFI_DEVICE_PATH *DevicePath; EFI_DEVICE_PATH *DevicePath;
UINT16 Flags; UINT16 Flags;
UINT8 LoaderType; UINT8 LoaderType;

View File

@ -147,38 +147,39 @@ typedef enum {
#define SVALUE_MAX_SIZE 512 #define SVALUE_MAX_SIZE 512
#define SCREEN_UNKNOWN 0 #define SCREEN_UNKNOWN 0
#define SCREEN_MAIN 1 #define SCREEN_MAIN 1
#define SCREEN_ABOUT 2 #define SCREEN_ABOUT 2
#define SCREEN_HELP 3 #define SCREEN_HELP 3
#define SCREEN_OPTIONS 4 #define SCREEN_OPTIONS 4
#define SCREEN_GRAPHICS 5 #define SCREEN_GRAPHICS 5
#define SCREEN_CPU 6 #define SCREEN_CPU 6
#define SCREEN_BINARIES 7 #define SCREEN_BINARIES 7
#define SCREEN_DSDT 8 #define SCREEN_DSDT 8
#define SCREEN_BOOT 9 #define SCREEN_BOOT 9
#define SCREEN_SMBIOS 10 #define SCREEN_SMBIOS 10
#define SCREEN_TABLES 11 #define SCREEN_TABLES 11
#define SCREEN_RC_SCRIPTS 12 #define SCREEN_RC_SCRIPTS 12
#define SCREEN_USB 13 #define SCREEN_USB 13
#define SCREEN_THEME 14 #define SCREEN_THEME 14
#define SCREEN_SYSVARS 15 #define SCREEN_SYSVARS 15
#define SCREEN_CSR 16 #define SCREEN_CSR 16
#define SCREEN_BLC 17 #define SCREEN_CHOOSE_SMBIOS 17
#define SCREEN_DSM 18 #define SCREEN_DSM 18
#define SCREEN_ACPI 19 #define SCREEN_ACPI 19
#define SCREEN_GUI 20 #define SCREEN_GUI 20
#define SCREEN_SYSTEM 21 #define SCREEN_SYSTEM 21
#define SCREEN_AUDIO 22 #define SCREEN_AUDIO 22
#define SCREEN_KEXTS 23 #define SCREEN_KEXTS 23
#define SCREEN_KERNELS 24 #define SCREEN_KERNELS 24
#define SCREEN_DSDT_PATCHES 25 #define SCREEN_DSDT_PATCHES 25
#define SCREEN_DEVICES 26 #define SCREEN_DEVICES 26
#define SCREEN_BOOTER 27 #define SCREEN_BOOTER 27
#define SCREEN_KEXT_INJECT 28 #define SCREEN_KEXT_INJECT 28
#define SCREEN_KEXTS_MAN 29 #define SCREEN_KEXTS_MAN 29
#define SCREEN_AUDIOPORTS 30 #define SCREEN_AUDIOPORTS 30
#define SCREEN_QUIRKS 31 #define SCREEN_QUIRKS 31
#define MAX_ANIME 41 #define MAX_ANIME 41

View File

@ -794,6 +794,8 @@ void LOADER_ENTRY::StartLoader()
//Free memory //Free memory
ConfigsList.setEmpty(); ConfigsList.setEmpty();
DsdtsList.setEmpty(); DsdtsList.setEmpty();
// SmbiosList.setEmpty();
OptionMenu.FreeMenu(); OptionMenu.FreeMenu();
//there is a place to free memory //there is a place to free memory
// GuiAnime // GuiAnime
@ -812,10 +814,6 @@ void LOADER_ENTRY::StartLoader()
fontChain = nextChain; fontChain = nextChain;
} }
fontsDB = NULL; fontsDB = NULL;
// nsvg__deleteParser(mainParser); //temporary disabled
//destruct_globals_objects(NULL); //we can't destruct our globals here. We need, for example, Volumes.
//DumpKernelAndKextPatches(KernelAndKextPatches);
if ( OSTYPE_IS_OSX(LoaderType) || OSTYPE_IS_OSX_RECOVERY(LoaderType) || OSTYPE_IS_OSX_INSTALLER(LoaderType) ) { if ( OSTYPE_IS_OSX(LoaderType) || OSTYPE_IS_OSX_RECOVERY(LoaderType) || OSTYPE_IS_OSX_INSTALLER(LoaderType) ) {
@ -845,8 +843,6 @@ void LOADER_ENTRY::StartLoader()
DBG("Beginning OC\n"); DBG("Beginning OC\n");
// UINT64 CPUFrequencyFromART;
// InternalCalculateARTFrequencyIntel(&CPUFrequencyFromART, NULL, 1);
EFI_LOADED_IMAGE* OcLoadedImage; EFI_LOADED_IMAGE* OcLoadedImage;
Status = gBS->HandleProtocol(gImageHandle, &gEfiLoadedImageProtocolGuid, (VOID **) &OcLoadedImage); Status = gBS->HandleProtocol(gImageHandle, &gEfiLoadedImageProtocolGuid, (VOID **) &OcLoadedImage);
@ -1522,6 +1518,7 @@ void LOADER_ENTRY::StartLoader()
// first patchACPI and find PCIROOT and RTC // first patchACPI and find PCIROOT and RTC
// but before ACPI patch we need smbios patch // but before ACPI patch we need smbios patch
CheckEmptyFB(); CheckEmptyFB();
gConf.ReloadSmbios(OSName);
SmbiosFillPatchingValues(GlobalConfig.SetTable132, GlobalConfig.EnabledCores, g_SmbiosDiscoveredSettings.RamSlotCount, gConf.SlotDeviceArray, gSettings, gCPUStructure, &g_SmbiosInjectedSettings); SmbiosFillPatchingValues(GlobalConfig.SetTable132, GlobalConfig.EnabledCores, g_SmbiosDiscoveredSettings.RamSlotCount, gConf.SlotDeviceArray, gSettings, gCPUStructure, &g_SmbiosInjectedSettings);
PatchSmbios(g_SmbiosInjectedSettings); PatchSmbios(g_SmbiosInjectedSettings);
// DBG("PatchACPI\n"); // DBG("PatchACPI\n");
@ -2596,17 +2593,17 @@ GetListOfConfigs()
if (DirEntry->FileName[0] == L'.') { if (DirEntry->FileName[0] == L'.') {
continue; continue;
} }
if (StriCmp(DirEntry->FileName, L"config.plist") == 0) { if (StriCmp(DirEntry->FileName, L"config.plist") == 0) {
OldChosenConfig = ConfigsList.size(); // DirEntry->FileName is not yet inserted into ConfigsList. So its index will be ConfigsList.size() OldChosenConfig = ConfigsList.size(); // DirEntry->FileName is not yet inserted into ConfigsList. So its index will be ConfigsList.size()
}
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 reallocate and copy memory
DBG("- %ls\n", DirEntry->FileName);
}else{
DBG("- bug!, NameLen > MAX_INTN");
}
} }
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 reallocate and copy memory
DBG("- %ls\n", DirEntry->FileName);
}else{
DBG("- bug!, NameLen > MAX_INTN");
}
}
DirIterClose(&DirIter); DirIterClose(&DirIter);
} }
@ -2985,6 +2982,8 @@ RefitMain (IN EFI_HANDLE ImageHandle,
if (!GlobalConfig.isFastBoot()) { if (!GlobalConfig.isFastBoot()) {
GetListOfThemes(); GetListOfThemes();
GetListOfConfigs(); GetListOfConfigs();
// SmbiosList.setEmpty();
// SmbiosList.AddReference(new XStringW(L"auto"_XSW), true);
} }
// ThemeX.FillByEmbedded(); //init XTheme before EarlyUserSettings // ThemeX.FillByEmbedded(); //init XTheme before EarlyUserSettings
{ {
@ -3243,6 +3242,11 @@ RefitMain (IN EFI_HANDLE ImageHandle,
DefaultEntry = NULL; DefaultEntry = NULL;
} }
// DBG("found entries SMBIOS:\n");
// for (size_t i=0; i<SmbiosList.size(); i++) {
// DBG("%ls\n", SmbiosList[i].wc_str());
// }
MainLoopRunning = true; MainLoopRunning = true;
if (DefaultEntry && (GlobalConfig.isFastBoot() || if (DefaultEntry && (GlobalConfig.isFastBoot() ||
(gSettings.Boot.SkipHibernateTimeout && (gSettings.Boot.SkipHibernateTimeout &&

View File

@ -99,7 +99,7 @@ REFIT_MENU_SCREEN OptionMenu(4, L"Options"_XSW, L""_XSW);
XBool gResetSMC = false; XBool gResetSMC = false;
extern APPLE_SMC_IO_PROTOCOL *gAppleSmc; extern APPLE_SMC_IO_PROTOCOL *gAppleSmc;
extern ConfigManager gConf;
void FillInputs(XBool New) void FillInputs(XBool New)
{ {
@ -272,9 +272,11 @@ void FillInputs(XBool New)
InputItems[InputItemsCount++].BValue = gSettings.KernelAndKextPatches.KPDebug; InputItems[InputItemsCount++].BValue = gSettings.KernelAndKextPatches.KPDebug;
// SMBIOS chooser
InputItems[InputItemsCount].ItemType = RadioSwitch; //CheckBit; //65
InputItems[InputItemsCount++].IValue = 65; //gSettings.RtVariables.BooterConfig;
// CSR - aka System Integrity Protection configuration // CSR - aka System Integrity Protection configuration
InputItems[InputItemsCount].ItemType = CheckBit; //65
InputItems[InputItemsCount++].IValue = gSettings.RtVariables.BooterConfig;
InputItems[InputItemsCount].ItemType = CheckBit; //66 InputItems[InputItemsCount].ItemType = CheckBit; //66
InputItems[InputItemsCount++].IValue = gSettings.RtVariables.CsrActiveConfig; InputItems[InputItemsCount++].IValue = gSettings.RtVariables.CsrActiveConfig;
@ -709,11 +711,18 @@ void ApplyInputs(void)
// GlobalConfig.gBootChanged = true; // GlobalConfig.gBootChanged = true;
} }
// CSR i++; //65
i = 65;
if (InputItems[i].Valid) { if (InputItems[i].Valid) {
gSettings.RtVariables.BooterConfig = InputItems[i].IValue & 0x7F; XStringW& tmpStr = SmbiosList[OldChosenSmbios];
gConf.ReloadSmbios(tmpStr);
// gConf.FillSmbiosWithDefaultValue(GlobalConfig.CurrentModel, configPlist.getSMBIOS());
DBG("chosen SMBIOS of %ls\n", tmpStr.wc_str());
GlobalConfig.gBootChanged = true;
FillInputs(false);
NeedSave = false;
} }
// CSR
i++; //66 i++; //66
if (InputItems[i].Valid) { if (InputItems[i].Valid) {
gSettings.RtVariables.CsrActiveConfig = InputItems[i].IValue; gSettings.RtVariables.CsrActiveConfig = InputItems[i].IValue;
@ -1577,8 +1586,8 @@ void ModifyTitles(REFIT_ABSTRACT_MENU_ENTRY *ChosenEntry)
if (gSettings.RtVariables.CsrActiveConfig != 0 && gSettings.RtVariables.BooterConfig == 0) { if (gSettings.RtVariables.CsrActiveConfig != 0 && gSettings.RtVariables.BooterConfig == 0) {
gSettings.RtVariables.BooterConfig = 0x28; gSettings.RtVariables.BooterConfig = 0x28;
} }
} else if (ChosenEntry->SubScreen->ID == SCREEN_BLC) { // } else if (ChosenEntry->SubScreen->ID == SCREEN_BLC) {
ChosenEntry->Title.SWPrintf("boot_args->flags [0x%04hx]->", gSettings.RtVariables.BooterConfig); // ChosenEntry->Title.SWPrintf("boot_args->flags [0x%04hx]->", gSettings.RtVariables.BooterConfig);
} }
} }
@ -1667,10 +1676,6 @@ REFIT_ABSTRACT_MENU_ENTRY *SubMenuGraphics()
// ErmaC: Audio submenu // ErmaC: Audio submenu
REFIT_ABSTRACT_MENU_ENTRY *SubMenuAudio() REFIT_ABSTRACT_MENU_ENTRY *SubMenuAudio()
{ {
UINTN i;
// init
REFIT_MENU_ITEM_OPTIONS *Entry; REFIT_MENU_ITEM_OPTIONS *Entry;
REFIT_MENU_SCREEN *SubScreen; REFIT_MENU_SCREEN *SubScreen;
@ -1680,7 +1685,7 @@ REFIT_ABSTRACT_MENU_ENTRY *SubMenuAudio()
// submenu description // submenu description
SubScreen->AddMenuInfoLine_f("Choose options to tune the HDA devices"); SubScreen->AddMenuInfoLine_f("Choose options to tune the HDA devices");
SubScreen->AddMenuInfoLine_f("Number of Audio Controller%s=%zu", ((gConf.HdaPropertiesArray.size()!=1)?"s":""), gConf.HdaPropertiesArray.size()); SubScreen->AddMenuInfoLine_f("Number of Audio Controller%s=%zu", ((gConf.HdaPropertiesArray.size()!=1)?"s":""), gConf.HdaPropertiesArray.size());
for (i = 0 ; i < gConf.HdaPropertiesArray.size() ; i++) { for (UINTN i = 0 ; i < gConf.HdaPropertiesArray.size() ; i++) {
SubScreen->AddMenuInfoLine_f("%llu) %ls [%04hX][%04hX]", SubScreen->AddMenuInfoLine_f("%llu) %ls [%04hX][%04hX]",
(i+1), (i+1),
gConf.HdaPropertiesArray[i].controller_name, gConf.HdaPropertiesArray[i].controller_name,
@ -2009,7 +2014,7 @@ REFIT_ABSTRACT_MENU_ENTRY* SubMenuSmbios()
REFIT_MENU_ITEM_OPTIONS *Entry; REFIT_MENU_ITEM_OPTIONS *Entry;
REFIT_MENU_SCREEN *SubScreen; REFIT_MENU_SCREEN *SubScreen;
Entry = newREFIT_MENU_ITEM_OPTIONS(&SubScreen, ActionEnter, SCREEN_SMBIOS, "SMBIOS->"_XS8); Entry = newREFIT_MENU_ITEM_OPTIONS(&SubScreen, ActionEnter, SCREEN_SMBIOS, "SMBIOS settings->"_XS8);
SubScreen->AddMenuInfoLine_f("%s", gCPUStructure.BrandString.c_str()); SubScreen->AddMenuInfoLine_f("%s", gCPUStructure.BrandString.c_str());
SubScreen->AddMenuInfoLine_f("%s", GlobalConfig.OEMProductFromSmbios.c_str()); SubScreen->AddMenuInfoLine_f("%s", GlobalConfig.OEMProductFromSmbios.c_str());
@ -2036,6 +2041,32 @@ REFIT_ABSTRACT_MENU_ENTRY* SubMenuSmbios()
return Entry; return Entry;
} }
REFIT_ABSTRACT_MENU_ENTRY* SubMenuChooseSmbios()
{
REFIT_MENU_ITEM_OPTIONS *Entry;
REFIT_MENU_SCREEN *SubScreen;
REFIT_MENU_SWITCH *InputBootArgs;
Entry = newREFIT_MENU_ITEM_OPTIONS(&SubScreen, ActionEnter, SCREEN_CHOOSE_SMBIOS, "SMBIOS->"_XS8);
SubScreen->AddMenuInfoLine_f("Select SMBIOS:");
for (UINTN i = 0; i < SmbiosList.size(); i++) {
InputBootArgs = new REFIT_MENU_SWITCH;
InputBootArgs->Title = SmbiosList[i];
InputBootArgs->Row = i;
InputBootArgs->Item = &InputItems[65];
InputBootArgs->AtClick = ActionEnter;
InputBootArgs->AtRightClick = ActionDetails;
SubScreen->AddMenuEntry(InputBootArgs, true);
}
SubScreen->AddMenuEntry(SubMenuSmbios(), true);
SubScreen->AddMenuEntry(&MenuEntryReturn, false);
return Entry;
}
REFIT_ABSTRACT_MENU_ENTRY* SubMenuDsdtFix() REFIT_ABSTRACT_MENU_ENTRY* SubMenuDsdtFix()
{ {
REFIT_MENU_ITEM_OPTIONS *Entry; //, *SubEntry; REFIT_MENU_ITEM_OPTIONS *Entry; //, *SubEntry;
@ -2213,40 +2244,7 @@ void CreateMenuProps(REFIT_MENU_SCREEN* SubScreen, SETTINGS_DATA::DevicesClass::
break; break;
} }
} }
/*
void CreateMenuAddProp(REFIT_MENU_SCREEN* SubScreen, SETTINGS_DATA::DevicesClass::AddPropertyClass* Prop)
{
REFIT_INPUT_DIALOG *InputBootArgs;
InputBootArgs = new REFIT_INPUT_DIALOG;
InputBootArgs->Title.SWPrintf(" key: %s", Prop->Key.c_str());
InputBootArgs->Row = 0xFFFF; //cursor
InputBootArgs->Item = &Prop->MenuItem;
InputBootArgs->AtClick = ActionEnter;
InputBootArgs->AtRightClick = ActionDetails;
SubScreen->AddMenuEntry(InputBootArgs, true);
switch (Prop->ValueType) {
case kTagTypeInteger:
SubScreen->AddMenuInfo_f(" value: 0x%08llx", *(UINT64*)Prop->Value.data());
break;
case kTagTypeString:
SubScreen->AddMenuInfo_f(" value: %90s", Prop->Value.data());
break;
case kTagTypeFalse:
SubScreen->AddMenuInfo_f((" value: false"));
break;
case kTagTypeTrue:
SubScreen->AddMenuInfo_f((" value: true"));
break;
case kTagTypeFloat:
SubScreen->AddMenuInfo_f(" value: %f", *(float*)Prop->Value.data());
break;
default: //type data, print first 24 bytes
SubScreen->AddMenuInfo_f(" value[%zu]: %24s", Prop->Value.size(), Bytes2HexStr((UINT8*)Prop->Value.data(), MIN(24, Prop->Value.size())).c_str());
break;
}
}
*/
REFIT_ABSTRACT_MENU_ENTRY* SubMenuProperties() REFIT_ABSTRACT_MENU_ENTRY* SubMenuProperties()
{ {
REFIT_MENU_ITEM_OPTIONS *Entry; REFIT_MENU_ITEM_OPTIONS *Entry;
@ -2269,44 +2267,7 @@ REFIT_ABSTRACT_MENU_ENTRY* SubMenuProperties()
Entry->SubScreen = SubScreen; Entry->SubScreen = SubScreen;
return Entry; return Entry;
} }
/*
REFIT_ABSTRACT_MENU_ENTRY* SubMenuArbProperties()
{
REFIT_MENU_ITEM_OPTIONS *Entry;
REFIT_MENU_SCREEN *SubScreen;
Entry = newREFIT_MENU_ITEM_OPTIONS(&SubScreen, ActionEnter, SCREEN_DEVICES, "Arbitrary properties->"_XS8);
for ( size_t idx = 0 ; idx < gSettings.Devices.ArbitraryArray.size() ; ++idx) {
SETTINGS_DATA::DevicesClass::ArbitraryPropertyClass& Prop = gSettings.Devices.ArbitraryArray[idx];
if ( idx > 0 ) SubScreen->AddMenuInfo_f("------------");
for ( size_t idxChild = 0 ; idxChild < Prop.CustomPropertyArray.size(); ++idxChild) {
SETTINGS_DATA::DevicesClass::SimplePropertyClass& Props = Prop.CustomPropertyArray[idxChild];
SubScreen->AddMenuInfo_f("%s", Prop.Label.c_str());
CreateMenuProps(SubScreen, &Props);
}
}
SubScreen->AddMenuEntry(&MenuEntryReturn, false);
Entry->SubScreen = SubScreen;
return Entry;
}
REFIT_ABSTRACT_MENU_ENTRY* SubMenuAddProperties()
{
REFIT_MENU_ITEM_OPTIONS *Entry;
REFIT_MENU_SCREEN *SubScreen;
Entry = newREFIT_MENU_ITEM_OPTIONS(&SubScreen, ActionEnter, SCREEN_DEVICES, "Add properties->"_XS8);
for ( size_t idx = 0 ; idx < gSettings.Devices.AddPropertyArray.size() ; ++idx) {
SETTINGS_DATA::DevicesClass::AddPropertyClass& Prop = gSettings.Devices.AddPropertyArray[idx];
CreateMenuAddProp(SubScreen, &Prop);
}
SubScreen->AddMenuEntry(&MenuEntryReturn, false);
Entry->SubScreen = SubScreen;
return Entry;
}
*/
REFIT_ABSTRACT_MENU_ENTRY* SubMenuPCI() REFIT_ABSTRACT_MENU_ENTRY* SubMenuPCI()
{ {
REFIT_MENU_ITEM_OPTIONS *Entry; REFIT_MENU_ITEM_OPTIONS *Entry;
@ -2325,8 +2286,6 @@ REFIT_ABSTRACT_MENU_ENTRY* SubMenuPCI()
SubScreen->AddMenuItemInput(100, "FakeID XHCI:", true); SubScreen->AddMenuItemInput(100, "FakeID XHCI:", true);
SubScreen->AddMenuItemInput(103, "FakeID IMEI:", true); SubScreen->AddMenuItemInput(103, "FakeID IMEI:", true);
SubScreen->AddMenuEntry(SubMenuProperties(), true); SubScreen->AddMenuEntry(SubMenuProperties(), true);
// SubScreen->AddMenuEntry(SubMenuArbProperties(), true);
// SubScreen->AddMenuEntry(SubMenuAddProperties(), true);
SubScreen->AddMenuEntry(&MenuEntryReturn, false); SubScreen->AddMenuEntry(&MenuEntryReturn, false);
Entry->SubScreen = SubScreen; Entry->SubScreen = SubScreen;
@ -2374,7 +2333,6 @@ REFIT_ABSTRACT_MENU_ENTRY* SubMenuGUI()
SubScreen->AddMenuItemInput(70, "Pointer Speed:", true); SubScreen->AddMenuItemInput(70, "Pointer Speed:", true);
SubScreen->AddMenuItemInput(72, "Mirror Move", false); SubScreen->AddMenuItemInput(72, "Mirror Move", false);
SubScreen->AddMenuEntry(SubMenuThemes(), true); SubScreen->AddMenuEntry(SubMenuThemes(), true);
SubScreen->AddMenuEntry(&MenuEntryReturn, false); SubScreen->AddMenuEntry(&MenuEntryReturn, false);
@ -2420,7 +2378,7 @@ REFIT_ABSTRACT_MENU_ENTRY* SubMenuCSR()
ModifyTitles(Entry); ModifyTitles(Entry);
return Entry; return Entry;
} }
/*
REFIT_ABSTRACT_MENU_ENTRY* SubMenuBLC() REFIT_ABSTRACT_MENU_ENTRY* SubMenuBLC()
{ {
// init // init
@ -2447,7 +2405,7 @@ REFIT_ABSTRACT_MENU_ENTRY* SubMenuBLC()
ModifyTitles(Entry); ModifyTitles(Entry);
return Entry; return Entry;
} }
*/
REFIT_ABSTRACT_MENU_ENTRY* SubMenuSystem() REFIT_ABSTRACT_MENU_ENTRY* SubMenuSystem()
{ {
// init // init
@ -2466,7 +2424,7 @@ REFIT_ABSTRACT_MENU_ENTRY* SubMenuSystem()
SubScreen->AddMenuItemInput(129, "Reset SMC", false); SubScreen->AddMenuItemInput(129, "Reset SMC", false);
SubScreen->AddMenuEntry(SubMenuCSR(), true); SubScreen->AddMenuEntry(SubMenuCSR(), true);
SubScreen->AddMenuEntry(SubMenuBLC(), true); // SubScreen->AddMenuEntry(SubMenuBLC(), true);
SubScreen->AddMenuEntry(&MenuEntryReturn, false); SubScreen->AddMenuEntry(&MenuEntryReturn, false);
return Entry; return Entry;
@ -2572,7 +2530,8 @@ void OptionsMenu(OUT REFIT_ABSTRACT_MENU_ENTRY **ChosenEntry)
OptionMenu.AddMenuEntry( SubMenuGUI(), true); OptionMenu.AddMenuEntry( SubMenuGUI(), true);
} }
OptionMenu.AddMenuEntry( SubMenuACPI(), true); OptionMenu.AddMenuEntry( SubMenuACPI(), true);
OptionMenu.AddMenuEntry( SubMenuSmbios(), true); OptionMenu.AddMenuEntry( SubMenuChooseSmbios(), true);
// OptionMenu.AddMenuEntry( SubMenuSmbios(), true);
OptionMenu.AddMenuEntry( SubMenuBinaries(), true); OptionMenu.AddMenuEntry( SubMenuBinaries(), true);
OptionMenu.AddMenuEntry( SubMenuQuirks(), true); OptionMenu.AddMenuEntry( SubMenuQuirks(), true);
OptionMenu.AddMenuEntry( SubMenuGraphics(), true); OptionMenu.AddMenuEntry( SubMenuGraphics(), true);