2020-04-04 14:27:02 +02:00
# ifndef __SETTINGS_H__
# define __SETTINGS_H__
2021-02-06 18:16:46 +01:00
# include <Efi.h>
2021-04-28 20:30:34 +02:00
# include "../gui/menu_items/menu_items.h" // TODO: break that dependency
2021-03-22 13:40:01 +01:00
# include "../include/OSFlags.h"
# include "../include/OSTypes.h"
2021-03-23 20:59:30 +01:00
# include "../include/Languages.h"
2020-08-25 17:35:19 +02:00
# include "../Platform/plist/plist.h"
2020-11-18 22:49:02 +01:00
# include "../Platform/guid.h"
2020-11-12 22:25:56 +01:00
# include "MacOsVersion.h"
2021-02-06 18:16:46 +01:00
# include "KERNEL_AND_KEXT_PATCHES.h"
# include "../libeg/XIcon.h"
2021-03-19 16:35:01 +01:00
# include "../cpp_lib/undefinable.h"
2021-03-20 15:29:34 +01:00
# include "../entry_scan/loader.h" // for KERNEL_SCAN_xxx constants
2021-04-28 20:30:34 +02:00
//#include "../Platform/smbios.h"
2021-04-11 07:18:52 +02:00
# include "../Platform/platformdata.h"
2021-04-28 20:30:34 +02:00
# include "../Settings/ConfigPlist/ConfigPlistClass.h"
# include "../Platform/guid.h"
# include "../Platform/SettingsUtils.h"
# include "../Platform/hda.h"
# include "../Settings/ConfigManager.h"
2021-02-06 18:16:46 +01:00
# define CLOVER_SIGN SIGNATURE_32('C','l','v','r')
2020-04-16 09:48:13 +02:00
//// SysVariables
//typedef struct SYSVARIABLES SYSVARIABLES;
//struct SYSVARIABLES
//{
// SYSVARIABLES *Next;
// CHAR16 *Key;
// INPUT_ITEM MenuItem;
//};
2021-02-06 18:16:46 +01:00
extern CONST CHAR8 * AudioOutputNames [ ] ;
2021-09-28 15:54:31 +02:00
extern XBool gFirmwareClover ;
2021-02-06 18:16:46 +01:00
2021-04-01 10:06:53 +02:00
2020-08-31 09:07:36 +02:00
class HDA_OUTPUTS
{
public :
XStringW Name ;
2021-04-28 20:30:34 +02:00
UINT8 Index ;
2021-02-06 18:16:46 +01:00
EFI_HANDLE Handle = NULL ;
EFI_AUDIO_IO_PROTOCOL_DEVICE Device = EfiAudioIoDeviceOther ;
2020-08-31 09:07:36 +02:00
2021-02-06 18:16:46 +01:00
HDA_OUTPUTS ( ) : Name ( ) , Index ( 0 ) { }
2020-08-31 09:07:36 +02:00
HDA_OUTPUTS ( const HDA_OUTPUTS & other ) = delete ; // Can be defined if needed
const HDA_OUTPUTS & operator = ( const HDA_OUTPUTS & ) = delete ; // Can be defined if needed
~ HDA_OUTPUTS ( ) { }
} ;
2020-04-16 09:15:26 +02:00
typedef struct {
HRDW_MANUFACTERER Vendor ;
UINT8 Ports ;
UINT16 DeviceID ;
UINT16 Family ;
//UINT16 Width;
//UINT16 Height;
CHAR8 Model [ 64 ] ;
CHAR8 Config [ 64 ] ;
2021-09-28 15:54:31 +02:00
XBool LoadVBios ;
//XBool PatchVBios;
2020-04-16 09:15:26 +02:00
UINTN Segment ;
UINTN Bus ;
UINTN Device ;
UINTN Function ;
EFI_HANDLE Handle ;
UINT8 * Mmio ;
UINT32 Connectors ;
2021-09-28 15:54:31 +02:00
XBool ConnChanged ;
2020-04-16 09:15:26 +02:00
} GFX_PROPERTIES ;
typedef struct {
HRDW_MANUFACTERER Vendor ;
UINT16 controller_vendor_id ;
UINT16 controller_device_id ;
CHAR16 * controller_name ;
// -- Codec Info -- //
2021-04-28 20:30:34 +02:00
// UINT16 codec_vendor_id;
// UINT16 codec_device_id;
// UINT8 codec_revision_id;
// UINT8 codec_stepping_id;
// UINT8 codec_maj_rev;
// UINT8 codec_min_rev;
// UINT8 codec_num_function_groups;
// CHAR16 *codec_name;
2020-04-16 09:15:26 +02:00
} HDA_PROPERTIES ;
2021-04-05 10:57:55 +02:00
class ACPI_NAME
{
public :
2021-10-27 19:37:54 +02:00
XString8 Name = XString8 ( ) ;
2021-04-05 14:00:17 +02:00
2021-04-28 20:30:34 +02:00
# if __cplusplus > 201703L
2021-09-28 15:54:31 +02:00
XBool operator = = ( const ACPI_NAME & ) const = default ;
2021-04-28 20:30:34 +02:00
# endif
2021-09-28 15:54:31 +02:00
XBool isEqual ( const ACPI_NAME & other ) const
2021-04-11 07:18:52 +02:00
{
if ( ! ( Name = = other . Name ) ) return false ;
return true ;
}
2021-10-27 19:37:54 +02:00
// void takeValueFrom(const ACPI_NAME& other)
// {
// Name = other.Name;
// }
2021-04-11 07:18:52 +02:00
2021-04-05 10:57:55 +02:00
XString8Array getSplittedName ( ) const {
XString8Array splittedName = Split < XString8Array > ( Name , " . " ) ;
for ( size_t idx = 0 ; idx < splittedName . size ( ) ; + + idx ) {
XString8 & name = splittedName [ idx ] ;
while ( name . length ( ) > 4 ) name . deleteCharsAtPos ( name . length ( ) - 1 ) ;
while ( name . length ( ) < 4 ) name . strcat ( ' _ ' ) ;
}
for ( size_t idx = 1 ; idx < splittedName . size ( ) ; + + idx ) {
splittedName . insertReferenceAtPos ( splittedName . ExtractFromPos ( idx ) , 0 , true ) ; // A swap method in XObjARray would be slightly better to avoid memcpy in XObjArray when an object is removed.
}
return splittedName ;
}
} ;
class ACPI_RENAME_DEVICE
{
public :
2021-04-05 14:00:17 +02:00
ACPI_NAME acpiName = ACPI_NAME ( ) ;
2021-04-05 10:57:55 +02:00
XString8 renameTo = XString8 ( ) ;
2021-04-05 14:00:17 +02:00
2021-04-28 20:30:34 +02:00
# if __cplusplus > 201703L
2021-09-28 15:54:31 +02:00
XBool operator = = ( const ACPI_RENAME_DEVICE & ) const = default ;
2021-04-28 20:30:34 +02:00
# endif
2021-09-28 15:54:31 +02:00
XBool isEqual ( const ACPI_RENAME_DEVICE & other ) const
2021-04-11 07:18:52 +02:00
{
if ( ! acpiName . isEqual ( other . acpiName ) ) return false ;
if ( ! ( renameTo = = other . renameTo ) ) return false ;
return true ;
}
2021-10-27 19:37:54 +02:00
void takeValueFrom ( const XmlAddKey < XmlKey , XmlString8 > & other )
2021-04-28 20:30:34 +02:00
{
2021-10-27 19:37:54 +02:00
acpiName . Name = other . key ( ) ;
renameTo = other . value ( ) ;
2021-04-28 20:30:34 +02:00
}
2021-04-11 07:18:52 +02:00
2021-04-05 10:57:55 +02:00
XString8 getRenameTo ( ) const {
if ( renameTo . length ( ) = = 4 ) return renameTo ;
XString8 newName = renameTo ;
while ( newName . length ( ) > 4 ) newName . deleteCharsAtPos ( newName . length ( ) - 1 ) ;
while ( newName . length ( ) < 4 ) newName . strcat ( ' _ ' ) ;
return newName ;
}
2020-04-16 09:15:26 +02:00
} ;
2020-08-09 17:55:30 +02:00
class ACPI_DROP_TABLE
2020-04-16 09:15:26 +02:00
{
2020-08-09 17:55:30 +02:00
public :
2020-04-16 09:15:26 +02:00
ACPI_DROP_TABLE * Next ;
2021-09-25 12:11:54 +02:00
union {
UINT32 Signature = 0 ;
char SignatureAs4Chars [ 4 ] ;
} ;
2020-04-16 09:15:26 +02:00
UINT32 Length ;
UINT64 TableId ;
2021-02-06 18:16:46 +01:00
INPUT_ITEM MenuItem = INPUT_ITEM ( ) ;
2021-09-28 15:54:31 +02:00
XBool OtherOS ;
2020-08-09 17:55:30 +02:00
2021-09-28 10:28:45 +02:00
ACPI_DROP_TABLE ( ) : Next ( 0 ) , Signature ( 0 ) , Length ( 0 ) , TableId ( 0 ) , OtherOS ( false ) { }
2020-08-09 17:55:30 +02:00
ACPI_DROP_TABLE ( const ACPI_DROP_TABLE & other ) = delete ; // Can be defined if needed
const ACPI_DROP_TABLE & operator = ( const ACPI_DROP_TABLE & ) = delete ; // Can be defined if needed
~ ACPI_DROP_TABLE ( ) { }
2020-04-16 09:15:26 +02:00
} ;
2021-03-23 09:32:57 +01:00
class CUSTOM_LOADER_SUBENTRY_SETTINGS ;
class CUSTOM_LOADER_SUBENTRY ;
2021-03-22 13:40:01 +01:00
class CUSTOM_LOADER_SUBENTRY_SETTINGS
2020-08-15 22:39:25 +02:00
{
public :
2021-09-28 15:54:31 +02:00
XBool Disabled = false ;
2021-03-27 19:53:30 +01:00
public : // temporary, must be protected:
// member defined with _ prefix should not be accessed from outside. I left them public for now for CompareCustomEntries()
undefinable_XString8 _Arguments = undefinable_XString8 ( ) ;
XString8 _AddArguments = XString8 ( ) ;
2021-03-22 13:40:01 +01:00
2021-03-27 19:53:30 +01:00
undefinable_XString8 _FullTitle = undefinable_XString8 ( ) ;
undefinable_XString8 _Title = undefinable_XString8 ( ) ;
2021-03-22 13:40:01 +01:00
2021-03-27 19:53:30 +01:00
undefinable_bool _NoCaches = undefinable_bool ( ) ;
2021-04-11 07:18:52 +02:00
2021-04-28 20:30:34 +02:00
# if __cplusplus > 201703L
2021-09-28 15:54:31 +02:00
XBool operator = = ( const CUSTOM_LOADER_SUBENTRY_SETTINGS & ) const = default ;
2021-04-28 20:30:34 +02:00
# endif
2021-09-28 15:54:31 +02:00
XBool isEqual ( const CUSTOM_LOADER_SUBENTRY_SETTINGS & other ) const
2021-04-11 07:18:52 +02:00
{
if ( ! ( Disabled = = other . Disabled ) ) return false ;
if ( ! ( _Arguments = = other . _Arguments ) ) return false ;
if ( ! ( _AddArguments = = other . _AddArguments ) ) return false ;
if ( ! ( _FullTitle = = other . _FullTitle ) ) return false ;
if ( ! ( _Title = = other . _Title ) ) return false ;
if ( ! ( _NoCaches = = other . _NoCaches ) ) return false ;
return true ;
}
2021-10-27 19:37:54 +02:00
void takeValueFrom ( const ConfigPlistClass : : GUI_Class : : GUI_Custom_Class : : GUI_Custom_SubEntry_Class & other )
2021-04-28 20:30:34 +02:00
{
2021-10-27 19:37:54 +02:00
Disabled = other . dgetDisabled ( ) ;
_Arguments = other . dget_Arguments ( ) ;
_AddArguments = other . dget_AddArguments ( ) ;
_FullTitle = other . dget_FullTitle ( ) ;
_Title = other . dget_Title ( ) ;
_NoCaches = other . dget_NoCaches ( ) ;
2021-04-28 20:30:34 +02:00
}
2021-03-23 09:32:57 +01:00
2021-03-22 13:40:01 +01:00
} ;
class CUSTOM_LOADER_ENTRY ;
class CUSTOM_LOADER_SUBENTRY
{
public :
const CUSTOM_LOADER_ENTRY & parent ;
const CUSTOM_LOADER_SUBENTRY_SETTINGS & settings = CUSTOM_LOADER_SUBENTRY_SETTINGS ( ) ;
CUSTOM_LOADER_SUBENTRY ( const CUSTOM_LOADER_ENTRY & _customLoaderEntry , const CUSTOM_LOADER_SUBENTRY_SETTINGS & _settings ) : parent ( _customLoaderEntry ) , settings ( _settings ) { }
XString8Array getLoadOptions ( ) const ;
2021-09-28 15:54:31 +02:00
UINT8 getFlags ( XBool NoCachesDefault ) const ;
2021-03-22 13:40:01 +01:00
const XString8 & getTitle ( ) const ;
const XString8 & getFullTitle ( ) const ;
} ;
2021-03-23 09:32:57 +01:00
class CUSTOM_LOADER_ENTRY_SETTINGS ;
extern const XString8 defaultInstallTitle ;
extern const XString8 defaultRecoveryTitle ;
extern const XStringW defaultRecoveryImagePath ;
extern const XStringW defaultRecoveryDriveImagePath ;
2021-04-28 20:30:34 +02:00
/*
* Wrapper class to bring some syntaxic sugar : initialisation at construction , assignment , = = operator , etc .
*/
2021-04-11 07:18:52 +02:00
class EFI_GRAPHICS_OUTPUT_BLT_PIXELClass : public EFI_GRAPHICS_OUTPUT_BLT_PIXEL
{
public :
2021-10-27 19:37:54 +02:00
EFI_GRAPHICS_OUTPUT_BLT_PIXELClass ( ) { Blue = 0 ; Green = 0 ; Red = 0 ; Reserved = 0 ; }
2021-04-11 07:18:52 +02:00
2021-04-28 20:30:34 +02:00
EFI_GRAPHICS_OUTPUT_BLT_PIXELClass ( const EFI_GRAPHICS_OUTPUT_BLT_PIXEL & other ) { Blue = other . Blue ; Green = other . Green ; Red = other . Red ; Reserved = other . Reserved ; }
2021-10-27 19:37:54 +02:00
XBool operator = = ( const EFI_GRAPHICS_OUTPUT_BLT_PIXELClass & other ) const {
if ( ! ( Blue = = other . Blue ) ) return false ;
if ( ! ( Green = = other . Green ) ) return false ;
if ( ! ( Red = = other . Red ) ) return false ;
if ( ! ( Reserved = = other . Reserved ) ) return false ;
return true ;
}
2021-04-11 07:18:52 +02:00
} ;
2021-03-22 13:40:01 +01:00
class CUSTOM_LOADER_ENTRY_SETTINGS
{
public :
2021-09-28 15:54:31 +02:00
XBool Disabled = false ;
2021-03-22 13:40:01 +01:00
XBuffer < UINT8 > ImageData = XBuffer < UINT8 > ( ) ;
XBuffer < UINT8 > DriveImageData = XBuffer < UINT8 > ( ) ;
XStringW Volume = XStringW ( ) ;
XStringW Path = XStringW ( ) ;
undefinable_XString8 Arguments = undefinable_XString8 ( ) ;
XString8 AddArguments = XString8 ( ) ;
XString8 FullTitle = XStringW ( ) ;
XStringW Settings = XStringW ( ) ; // path of a config.plist that'll be read at the beginning of startloader
2021-05-08 11:34:17 +02:00
char32_t Hotkey = 0 ;
2021-09-28 15:54:31 +02:00
XBool CommonSettings = false ;
2021-03-22 13:40:01 +01:00
// UINT8 Flags = 0;
2021-09-28 15:54:31 +02:00
XBool Hidden = false ;
XBool AlwaysHidden = false ;
2021-03-19 21:32:42 +01:00
UINT8 Type = 0 ;
UINT8 VolumeType = 0 ;
2021-03-20 15:29:34 +01:00
UINT8 KernelScan = KERNEL_SCAN_ALL ;
XString8 CustomLogoAsXString8 = XString8 ( ) ;
XBuffer < UINT8 > CustomLogoAsData = XBuffer < UINT8 > ( ) ;
2021-04-11 07:18:52 +02:00
EFI_GRAPHICS_OUTPUT_BLT_PIXELClass BootBgColor = EFI_GRAPHICS_OUTPUT_BLT_PIXELClass ( ) ;
2021-03-20 15:29:34 +01:00
INT8 InjectKexts = - 1 ;
2021-03-22 13:40:01 +01:00
undefinable_bool NoCaches = undefinable_bool ( ) ;
2021-04-28 20:30:34 +02:00
XObjArrayWithTakeValueFromXmlArray < CUSTOM_LOADER_SUBENTRY_SETTINGS , ConfigPlistClass : : GUI_Class : : GUI_Custom_Class : : GUI_Custom_SubEntry_Class >
SubEntriesSettings = XObjArrayWithTakeValueFromXmlArray < CUSTOM_LOADER_SUBENTRY_SETTINGS , ConfigPlistClass : : GUI_Class : : GUI_Custom_Class : : GUI_Custom_SubEntry_Class > ( ) ;
2021-03-27 19:53:30 +01:00
public : // temporary, must be protected:
XStringW m_DriveImagePath = XStringW ( ) ;
XString8 m_Title = XStringW ( ) ;
UINT8 CustomLogoTypeSettings = 0 ;
XStringW m_ImagePath = XStringW ( ) ;
2021-03-22 13:40:01 +01:00
2021-09-28 15:54:31 +02:00
XBool ForceTextMode = false ; // 2021-04-22
2021-04-28 20:30:34 +02:00
2021-03-27 19:53:30 +01:00
public :
2021-04-11 07:18:52 +02:00
2021-04-28 20:30:34 +02:00
# if __cplusplus > 201703L
2021-09-28 15:54:31 +02:00
XBool operator = = ( const CUSTOM_LOADER_ENTRY_SETTINGS & ) const = default ;
2021-04-28 20:30:34 +02:00
# endif
2021-09-28 15:54:31 +02:00
XBool isEqual ( const CUSTOM_LOADER_ENTRY_SETTINGS & other ) const
2021-04-11 07:18:52 +02:00
{
if ( ! ( Disabled = = other . Disabled ) ) return false ;
if ( ! ( ImageData = = other . ImageData ) ) return false ;
if ( ! ( DriveImageData = = other . DriveImageData ) ) return false ;
if ( ! ( Volume = = other . Volume ) ) return false ;
if ( ! ( Path = = other . Path ) ) return false ;
if ( ! ( Arguments = = other . Arguments ) ) return false ;
if ( ! ( AddArguments = = other . AddArguments ) ) return false ;
if ( ! ( FullTitle = = other . FullTitle ) ) return false ;
if ( ! ( Settings = = other . Settings ) ) return false ;
if ( ! ( Hotkey = = other . Hotkey ) ) return false ;
if ( ! ( CommonSettings = = other . CommonSettings ) ) return false ;
if ( ! ( Hidden = = other . Hidden ) ) return false ;
if ( ! ( AlwaysHidden = = other . AlwaysHidden ) ) return false ;
if ( ! ( Type = = other . Type ) ) return false ;
if ( ! ( VolumeType = = other . VolumeType ) ) return false ;
if ( ! ( KernelScan = = other . KernelScan ) ) return false ;
if ( ! ( CustomLogoAsXString8 = = other . CustomLogoAsXString8 ) ) return false ;
if ( ! ( CustomLogoAsData = = other . CustomLogoAsData ) ) return false ;
if ( memcmp ( & BootBgColor , & other . BootBgColor , sizeof ( BootBgColor ) ) ! = 0 ) return false ;
if ( ! ( InjectKexts = = other . InjectKexts ) ) return false ;
if ( ! ( NoCaches = = other . NoCaches ) ) return false ;
if ( ! SubEntriesSettings . isEqual ( other . SubEntriesSettings ) ) return false ;
if ( ! ( m_DriveImagePath = = other . m_DriveImagePath ) ) return false ;
if ( ! ( m_Title = = other . m_Title ) ) return false ;
if ( ! ( CustomLogoTypeSettings = = other . CustomLogoTypeSettings ) ) return false ;
if ( ! ( m_ImagePath = = other . m_ImagePath ) ) return false ;
2021-04-28 20:30:34 +02:00
if ( ! ( ForceTextMode = = other . ForceTextMode ) ) return false ;
2021-04-11 07:18:52 +02:00
return true ;
}
2021-10-27 19:37:54 +02:00
void takeValueFrom ( const ConfigPlistClass : : GUI_Class : : GUI_Custom_Class : : GUI_Custom_Entry_Class & other )
2021-04-28 20:30:34 +02:00
{
2021-10-27 19:37:54 +02:00
Disabled = other . dgetDisabled ( ) ;
ImageData = other . dgetImageData ( ) ;
DriveImageData = other . dgetDriveImageData ( ) ;
Volume = other . dgetVolume ( ) ;
Path = other . dgetPath ( ) ;
Arguments = other . dgetArguments ( ) ;
AddArguments = other . dgetAddArguments ( ) ;
FullTitle = other . dgetFullTitle ( ) ;
Settings = other . dgetSettings ( ) ;
Hotkey = other . dgetHotkey ( ) ;
CommonSettings = other . dgetCommonSettings ( ) ;
Hidden = other . dgetHidden ( ) ;
AlwaysHidden = other . dgetAlwaysHidden ( ) ;
Type = other . dgetType ( ) ;
VolumeType = other . dgetVolumeType ( ) ;
KernelScan = other . dgetKernelScan ( ) ;
CustomLogoAsXString8 = other . dgetCustomLogoAsXString8 ( ) ;
CustomLogoAsData = other . dgetCustomLogoAsData ( ) ;
BootBgColor = other . dgetBootBgColor ( ) ;
InjectKexts = other . dgetInjectKexts ( ) ;
NoCaches = other . dgetNoCaches ( ) ;
SubEntriesSettings . takeValueFrom ( other . SubEntries ) ;
m_DriveImagePath = other . dgetm_DriveImagePath ( ) ;
m_Title = other . dgetm_Title ( ) ;
CustomLogoTypeSettings = other . dgetCustomLogoTypeSettings ( ) ;
m_ImagePath = other . dgetm_ImagePath ( ) ;
ForceTextMode = other . dgetForceTextMode ( ) ;
2021-04-28 20:30:34 +02:00
}
2021-04-11 07:18:52 +02:00
2021-03-23 09:32:57 +01:00
const XString8 & dgetTitle ( ) const {
if ( m_Title . notEmpty ( ) ) return m_Title ;
if ( OSTYPE_IS_OSX_RECOVERY ( Type ) ) {
return defaultRecoveryTitle ;
} else if ( OSTYPE_IS_OSX_INSTALLER ( Type ) ) {
return defaultInstallTitle ;
}
return NullXString8 ;
}
const XStringW & dgetImagePath ( ) const {
if ( m_ImagePath . notEmpty ( ) ) return m_ImagePath ;
if ( ImageData . notEmpty ( ) ) return NullXStringW ;
if ( OSTYPE_IS_OSX_RECOVERY ( Type ) ) return defaultRecoveryImagePath ;
return NullXStringW ;
}
const XStringW & dgetDriveImagePath ( ) const {
if ( m_DriveImagePath . notEmpty ( ) ) return m_DriveImagePath ;
if ( DriveImageData . notEmpty ( ) ) return NullXStringW ;
if ( OSTYPE_IS_OSX_RECOVERY ( Type ) ) return defaultRecoveryDriveImagePath ;
return NullXStringW ;
}
2020-04-16 09:15:26 +02:00
} ;
2021-03-22 13:40:01 +01:00
class CUSTOM_LOADER_ENTRY
{
public :
const CUSTOM_LOADER_ENTRY_SETTINGS & settings = CUSTOM_LOADER_ENTRY_SETTINGS ( ) ;
XObjArray < CUSTOM_LOADER_SUBENTRY > SubEntries = XObjArray < CUSTOM_LOADER_SUBENTRY > ( ) ;
2021-03-23 09:32:57 +01:00
XIcon Image = XIcon ( ) ;
XIcon DriveImage = XIcon ( ) ;
XImage CustomLogoImage = XImage ( ) ; // Todo : remove from settings.
UINT8 CustomLogoType = 0 ;
KERNEL_AND_KEXT_PATCHES KernelAndKextPatches = KERNEL_AND_KEXT_PATCHES ( ) ;
CUSTOM_LOADER_ENTRY ( const CUSTOM_LOADER_ENTRY_SETTINGS & _settings ) ;
2021-03-22 13:40:01 +01:00
XString8Array getLoadOptions ( ) const ;
2021-03-23 09:32:57 +01:00
2021-09-28 15:54:31 +02:00
UINT8 getFlags ( XBool NoCachesDefault ) const {
2021-03-22 13:40:01 +01:00
UINT8 Flags = 0 ;
if ( settings . Arguments . isDefined ( ) ) Flags = OSFLAG_SET ( Flags , OSFLAG_NODEFAULTARGS ) ;
if ( settings . AlwaysHidden ) Flags = OSFLAG_SET ( Flags , OSFLAG_DISABLED ) ;
if ( settings . Type = = OSTYPE_LIN ) Flags = OSFLAG_SET ( Flags , OSFLAG_NODEFAULTARGS ) ;
if ( OSTYPE_IS_OSX ( settings . Type ) | | OSTYPE_IS_OSX_RECOVERY ( settings . Type ) | | OSTYPE_IS_OSX_INSTALLER ( settings . Type ) ) {
Flags = OSFLAG_UNSET ( Flags , OSFLAG_NOCACHES ) ;
}
if ( settings . NoCaches . isDefined ( ) ) {
if ( settings . NoCaches ) Flags = OSFLAG_SET ( Flags , OSFLAG_NOCACHES ) ;
} else {
if ( NoCachesDefault ) {
Flags = OSFLAG_SET ( Flags , OSFLAG_NOCACHES ) ;
}
}
if ( SubEntries . notEmpty ( ) ) Flags = OSFLAG_SET ( Flags , OSFLAG_NODEFAULTMENU ) ;
return Flags ;
}
} ;
2021-03-23 20:59:30 +01:00
class CUSTOM_LEGACY_ENTRY_SETTINGS
2020-08-09 17:55:30 +02:00
{
public :
2021-09-28 15:54:31 +02:00
XBool Disabled = false ;
2021-03-19 21:32:42 +01:00
XStringW ImagePath = XStringW ( ) ;
2021-03-23 20:59:30 +01:00
XBuffer < UINT8 > ImageData = XBuffer < UINT8 > ( ) ;
2021-03-19 21:32:42 +01:00
XStringW DriveImagePath = XStringW ( ) ;
2021-03-23 20:59:30 +01:00
XBuffer < UINT8 > DriveImageData = XBuffer < UINT8 > ( ) ;
2021-03-19 21:32:42 +01:00
XStringW Volume = XStringW ( ) ;
XStringW FullTitle = XStringW ( ) ;
XStringW Title = XStringW ( ) ;
2021-05-08 11:34:17 +02:00
char32_t Hotkey = 0 ;
2021-03-23 20:59:30 +01:00
// UINT8 Flags = 0;
2021-09-28 15:54:31 +02:00
XBool Hidden = false ;
XBool AlwaysHidden = false ;
2021-03-19 21:32:42 +01:00
UINT8 Type = 0 ;
UINT8 VolumeType = 0 ;
2021-04-28 20:30:34 +02:00
# if __cplusplus > 201703L
2021-09-28 15:54:31 +02:00
XBool operator = = ( const CUSTOM_LEGACY_ENTRY_SETTINGS & ) const = default ;
2021-04-28 20:30:34 +02:00
# endif
2021-09-28 15:54:31 +02:00
XBool isEqual ( const CUSTOM_LEGACY_ENTRY_SETTINGS & other ) const
2021-04-11 07:18:52 +02:00
{
if ( ! ( Disabled = = other . Disabled ) ) return false ;
if ( ! ( ImagePath = = other . ImagePath ) ) return false ;
if ( ! ( ImageData = = other . ImageData ) ) return false ;
if ( ! ( DriveImagePath = = other . DriveImagePath ) ) return false ;
if ( ! ( DriveImageData = = other . DriveImageData ) ) return false ;
if ( ! ( Volume = = other . Volume ) ) return false ;
if ( ! ( FullTitle = = other . FullTitle ) ) return false ;
if ( ! ( Title = = other . Title ) ) return false ;
if ( ! ( Hotkey = = other . Hotkey ) ) return false ;
if ( ! ( Hidden = = other . Hidden ) ) return false ;
if ( ! ( AlwaysHidden = = other . AlwaysHidden ) ) return false ;
if ( ! ( Type = = other . Type ) ) return false ;
if ( ! ( VolumeType = = other . VolumeType ) ) return false ;
return true ;
}
2021-10-27 19:37:54 +02:00
void takeValueFrom ( const ConfigPlistClass : : GUI_Class : : GUI_Custom_Class : : GUI_Custom_Legacy_Class & other )
2021-04-28 20:30:34 +02:00
{
2021-10-27 19:37:54 +02:00
Disabled = other . dgetDisabled ( ) ;
ImagePath = other . dgetImagePath ( ) ;
ImageData = other . dgetImageData ( ) ;
DriveImagePath = other . dgetDriveImagePath ( ) ;
DriveImageData = other . dgetDriveImageData ( ) ;
Volume = other . dgetVolume ( ) ;
FullTitle = other . dgetFullTitle ( ) ;
Title = other . dgetTitle ( ) ;
Hotkey = other . dgetHotkey ( ) ;
Hidden = other . dgetHidden ( ) ;
AlwaysHidden = other . dgetAlwaysHidden ( ) ;
Type = other . dgetType ( ) ;
VolumeType = other . dgetVolumeType ( ) ;
2021-04-28 20:30:34 +02:00
}
2021-03-23 20:59:30 +01:00
} ;
2021-03-19 21:32:42 +01:00
2021-03-23 20:59:30 +01:00
class CUSTOM_LEGACY_ENTRY
{
public :
const CUSTOM_LEGACY_ENTRY_SETTINGS & settings = CUSTOM_LEGACY_ENTRY_SETTINGS ( ) ;
XIcon Image = XIcon ( ) ;
XIcon DriveImage = XIcon ( ) ;
2021-03-23 22:23:44 +01:00
CUSTOM_LEGACY_ENTRY ( const CUSTOM_LEGACY_ENTRY_SETTINGS & _settings , const EFI_FILE & ThemeDir ) : settings ( _settings )
2021-03-23 20:59:30 +01:00
{
if ( settings . ImagePath . notEmpty ( ) ) {
Image . LoadXImage ( & ThemeDir , settings . ImagePath ) ;
} else if ( settings . ImageData . notEmpty ( ) ) {
if ( ! EFI_ERROR ( Image . Image . FromPNG ( settings . ImageData . data ( ) , settings . ImageData . size ( ) ) ) ) {
Image . setFilled ( ) ;
}
}
if ( settings . DriveImagePath . notEmpty ( ) ) {
DriveImage . LoadXImage ( & ThemeDir , settings . DriveImagePath ) ;
} else if ( settings . DriveImageData . notEmpty ( ) ) {
if ( ! EFI_ERROR ( DriveImage . Image . FromPNG ( settings . DriveImageData . data ( ) , settings . DriveImageData . size ( ) ) ) ) {
DriveImage . setFilled ( ) ;
}
}
}
UINT8 getFlags ( ) const {
UINT8 Flags = 0 ;
if ( settings . Disabled | | settings . AlwaysHidden ) Flags = OSFLAG_SET ( Flags , OSFLAG_DISABLED ) ;
return Flags ;
}
2020-04-16 09:15:26 +02:00
} ;
2021-03-23 20:59:30 +01:00
class CUSTOM_TOOL_ENTRY_SETTINGS
2020-08-09 17:55:30 +02:00
{
public :
2021-09-28 15:54:31 +02:00
XBool Disabled = false ;
2021-03-19 21:32:42 +01:00
XStringW ImagePath = XStringW ( ) ;
2021-03-23 20:59:30 +01:00
XBuffer < UINT8 > ImageData = XBuffer < UINT8 > ( ) ;
2021-03-19 21:32:42 +01:00
XStringW Volume = XStringW ( ) ;
XStringW Path = XStringW ( ) ;
2021-03-23 20:59:30 +01:00
// XString8Array LoadOptions = XString8Array();
XString8 Arguments = XString8 ( ) ;
2021-03-19 21:32:42 +01:00
XStringW FullTitle = XStringW ( ) ;
XStringW Title = XStringW ( ) ;
2021-05-08 11:34:17 +02:00
char32_t Hotkey = 0 ;
2021-03-23 20:59:30 +01:00
// UINT8 Flags = 0;
2021-09-28 15:54:31 +02:00
XBool Hidden = false ;
XBool AlwaysHidden = false ;
2021-03-19 21:32:42 +01:00
UINT8 VolumeType = 0 ;
2021-04-11 07:18:52 +02:00
2021-04-28 20:30:34 +02:00
# if __cplusplus > 201703L
2021-09-28 15:54:31 +02:00
XBool operator = = ( const CUSTOM_TOOL_ENTRY_SETTINGS & ) const = default ;
2021-04-28 20:30:34 +02:00
# endif
2021-09-28 15:54:31 +02:00
XBool isEqual ( const CUSTOM_TOOL_ENTRY_SETTINGS & other ) const
2021-04-11 07:18:52 +02:00
{
if ( ! ( Disabled = = other . Disabled ) ) return false ;
if ( ! ( ImagePath = = other . ImagePath ) ) return false ;
if ( ! ( ImageData = = other . ImageData ) ) return false ;
if ( ! ( Volume = = other . Volume ) ) return false ;
if ( ! ( Path = = other . Path ) ) return false ;
if ( ! ( Arguments = = other . Arguments ) ) return false ;
if ( ! ( FullTitle = = other . FullTitle ) ) return false ;
if ( ! ( Title = = other . Title ) ) return false ;
if ( ! ( Hotkey = = other . Hotkey ) ) return false ;
if ( ! ( Hidden = = other . Hidden ) ) return false ;
if ( ! ( AlwaysHidden = = other . AlwaysHidden ) ) return false ;
if ( ! ( VolumeType = = other . VolumeType ) ) return false ;
return true ;
}
2021-10-27 19:37:54 +02:00
void takeValueFrom ( const ConfigPlistClass : : GUI_Class : : GUI_Custom_Class : : GUI_Custom_Tool_Class & other )
2021-04-28 20:30:34 +02:00
{
2021-10-27 19:37:54 +02:00
Disabled = other . dgetDisabled ( ) ;
ImagePath = other . dgetImagePath ( ) ;
ImageData = other . dgetImageData ( ) ;
Volume = other . dgetVolume ( ) ;
Path = other . dgetPath ( ) ;
Arguments = other . dgetArguments ( ) ;
FullTitle = other . dgetFullTitle ( ) ;
Title = other . dgetTitle ( ) ;
Hotkey = other . dgetHotkey ( ) ;
Hidden = other . dgetHidden ( ) ;
AlwaysHidden = other . dgetAlwaysHidden ( ) ;
VolumeType = other . dgetVolumeType ( ) ;
2021-04-28 20:30:34 +02:00
}
2021-03-19 21:32:42 +01:00
2021-03-23 20:59:30 +01:00
} ;
class CUSTOM_TOOL_ENTRY
{
public :
XIcon Image = XIcon ( ) ;
const CUSTOM_TOOL_ENTRY_SETTINGS & settings = CUSTOM_TOOL_ENTRY_SETTINGS ( ) ;
2021-03-23 22:23:44 +01:00
CUSTOM_TOOL_ENTRY ( const CUSTOM_TOOL_ENTRY_SETTINGS & _settings , const EFI_FILE & ThemeDir ) : settings ( _settings )
2021-03-23 20:59:30 +01:00
{
if ( settings . ImagePath . notEmpty ( ) ) {
Image . LoadXImage ( & ThemeDir , settings . ImagePath ) ;
} else if ( settings . ImageData . notEmpty ( ) ) {
if ( ! EFI_ERROR ( Image . Image . FromPNG ( settings . ImageData . data ( ) , settings . ImageData . size ( ) ) ) ) {
Image . setFilled ( ) ;
}
}
}
UINT8 getFlags ( ) const {
UINT8 Flags = 0 ;
if ( settings . Disabled | | settings . AlwaysHidden ) Flags = OSFLAG_SET ( Flags , OSFLAG_DISABLED ) ;
return Flags ;
}
XString8Array getLoadOptions ( ) const {
return Split < XString8Array > ( settings . Arguments , " " ) ;
}
2020-04-16 09:15:26 +02:00
} ;
2021-04-01 10:06:53 +02:00
/*
* From config . plist ,
* / Devices / Properties will construct a XObjArray < DEV_PROPERTY > , stored in ArbProperties
* / Devices / Arbitrary / CustomProperties will construct a XObjArray < DEV_PROPERTY > , stored in ArbProperties
*/
// 2021-04 Jief : this is the old structure. Kept here for be able to compare old and new code.
2020-08-09 17:55:30 +02:00
class DEV_PROPERTY
{
public :
2021-04-01 10:06:53 +02:00
UINT32 Device = 0 ;
EFI_DEVICE_PATH_PROTOCOL * DevicePath = NULL ;
CHAR8 * Key = 0 ;
UINT8 * Value = 0 ;
UINTN ValueLen = 0 ;
DEV_PROPERTY * Next = 0 ; //next device or next property
DEV_PROPERTY * Child = 0 ; // property list of the device
CHAR8 * Label = 0 ;
INPUT_ITEM MenuItem = INPUT_ITEM ( ) ;
TAG_TYPE ValueType = kTagTypeNone ;
DEV_PROPERTY ( ) { }
2020-08-09 17:55:30 +02:00
// Not sure if default are valid. Delete them. If needed, proper ones can be created
2021-04-01 10:06:53 +02:00
DEV_PROPERTY ( const DEV_PROPERTY & ) { panic ( " nope " ) ; }
DEV_PROPERTY & operator = ( const DEV_PROPERTY & ) = delete ;
2021-03-29 10:50:02 +02:00
} ;
2020-04-16 09:15:26 +02:00
2021-03-26 10:43:15 +01:00
/**
Set of Search & replace bytes for VideoBiosPatchBytes ( ) .
this is supposed to be a replacement of VBIOS_PATCH_BYTES , but that would need VbiosPatchLibrary to be update to C + + . Quite easy , but need cpp_fundation to become a library . TODO
* */
class VBIOS_PATCH {
public :
XBuffer < uint8_t > Find = XBuffer < uint8_t > ( ) ;
XBuffer < uint8_t > Replace = XBuffer < uint8_t > ( ) ;
2021-04-11 07:18:52 +02:00
2021-04-28 20:30:34 +02:00
# if __cplusplus > 201703L
2021-10-27 19:37:54 +02:00
XBool operator = = ( const VBIOS_PATCH & ) const = default ;
2021-04-28 20:30:34 +02:00
# endif
2021-09-28 15:54:31 +02:00
XBool isEqual ( const VBIOS_PATCH & other ) const
2021-04-11 07:18:52 +02:00
{
if ( ! ( Find = = other . Find ) ) return false ;
if ( ! ( Replace = = other . Replace ) ) return false ;
return true ;
}
2021-10-27 19:37:54 +02:00
void takeValueFrom ( const ConfigPlistClass : : Graphics_Class : : Graphics_PatchVBiosBytes_Class & other )
2021-04-28 20:30:34 +02:00
{
2021-10-27 19:37:54 +02:00
Find = other . dgetFind ( ) ;
Replace = other . dgetReplace ( ) ;
2021-04-28 20:30:34 +02:00
}
2021-03-26 10:43:15 +01:00
} ;
2021-04-28 20:30:34 +02:00
class PatchVBiosBytesNewClass : public XObjArrayWithTakeValueFromXmlArray < VBIOS_PATCH , ConfigPlistClass : : Graphics_Class : : Graphics_PatchVBiosBytes_Class >
2021-03-26 10:43:15 +01:00
{
mutable XArray < VBIOS_PATCH_BYTES > VBIOS_PATCH_BYTES_array = XArray < VBIOS_PATCH_BYTES > ( ) ;
public :
2021-04-11 07:18:52 +02:00
2021-04-28 20:30:34 +02:00
# if __cplusplus > 201703L
2021-10-27 19:37:54 +02:00
XBool operator = = ( const PatchVBiosBytesNewClass & other ) const { return XObjArray < VBIOS_PATCH > : : operator = = ( other ) ; }
2021-04-28 20:30:34 +02:00
# endif
2021-04-11 07:18:52 +02:00
2021-03-26 10:43:15 +01:00
// Temporary bridge to old struct.
2021-04-11 07:18:52 +02:00
const VBIOS_PATCH_BYTES * getVBIOS_PATCH_BYTES ( ) const {
2021-03-26 10:43:15 +01:00
VBIOS_PATCH_BYTES_array . setSize ( size ( ) ) ;
for ( size_t idx = 0 ; idx < size ( ) ; + + idx ) {
2021-05-08 11:34:17 +02:00
VBIOS_PATCH_BYTES_array [ idx ] . Find = ElementAt ( idx ) . Find . vdata ( ) ;
VBIOS_PATCH_BYTES_array [ idx ] . Replace = ElementAt ( idx ) . Replace . vdata ( ) ;
2021-03-26 10:43:15 +01:00
VBIOS_PATCH_BYTES_array [ idx ] . NumberOfBytes = ElementAt ( idx ) . Replace . size ( ) ;
}
return VBIOS_PATCH_BYTES_array ;
}
size_t getVBIOS_PATCH_BYTES_count ( ) const {
return size ( ) ;
}
2021-04-11 07:18:52 +02:00
2021-09-28 15:54:31 +02:00
XBool isEqual ( const PatchVBiosBytesNewClass & other ) const
2021-04-11 07:18:52 +02:00
{
2021-10-27 19:37:54 +02:00
return XObjArray < VBIOS_PATCH > : : isEqual ( other ) ;
// getVBIOS_PATCH_BYTES();
2021-04-11 07:18:52 +02:00
// if ( VBIOS_PATCH_BYTES_array.size() != other.VBIOS_PATCH_BYTES_array.size() ) return false;
// for ( size_t idx = 0 ; idx < VBIOS_PATCH_BYTES_array.size() ; ++idx ) {
// if ( VBIOS_PATCH_BYTES_array[idx].NumberOfBytes != other[idx].Find.size() ) return false;
// if ( memcmp(VBIOS_PATCH_BYTES_array[idx].Find, other.VBIOS_PATCH_BYTES_array[idx].Find, VBIOS_PATCH_BYTES_array[idx].NumberOfBytes) != 0 ) return false;
// if ( memcmp(VBIOS_PATCH_BYTES_array[idx].Replace, other.VBIOS_PATCH_BYTES_array[idx].Replace, VBIOS_PATCH_BYTES_array[idx].NumberOfBytes) != 0 ) return false;
// }
// return true;
}
2021-10-27 19:37:54 +02:00
// void takeValueFrom(const PatchVBiosBytesNewClass& other)
2021-04-28 20:30:34 +02:00
// {
// }
2021-04-11 07:18:52 +02:00
2021-03-26 10:43:15 +01:00
} ;
2021-03-25 15:32:56 +01:00
class SETTINGS_DATA ;
2021-03-27 19:53:30 +01:00
class ConfigPlistClass ;
2021-03-25 15:32:56 +01:00
class TagDict ;
2021-09-28 15:54:31 +02:00
//XBool CompareOldNewSettings(const SETTINGS_DATA& , const ConfigPlistClass& );
2021-04-28 20:30:34 +02:00
//EFI_STATUS GetUserSettings(const TagDict* CfgDict, SETTINGS_DATA& gSettings);
2021-03-25 15:32:56 +01:00
2020-08-11 14:43:53 +02:00
class SETTINGS_DATA {
public :
2021-02-02 10:02:21 +01:00
class BootClass {
public :
INTN Timeout = - 1 ;
2021-09-28 15:54:31 +02:00
XBool SkipHibernateTimeout = false ;
XBool DisableCloverHotkeys = false ;
2021-02-02 10:02:21 +01:00
XString8 BootArgs = XString8 ( ) ;
2021-09-28 15:54:31 +02:00
XBool NeverDoRecovery = false ;
XBool LastBootedVolume = false ;
2021-02-02 10:02:21 +01:00
XStringW DefaultVolume = XStringW ( ) ;
XStringW DefaultLoader = XStringW ( ) ;
2021-09-28 15:54:31 +02:00
XBool DebugLog = false ;
XBool FastBoot = false ;
XBool NoEarlyProgress = false ;
XBool NeverHibernate = false ;
XBool StrictHibernate = false ;
XBool RtcHibernateAware = false ;
XBool HibernationFixup = false ;
XBool SignatureFixup = false ;
INT8 SecureSetting = 0 ; // 0 == false, 1 == true, -1 == undefined
2021-03-27 19:53:30 +01:00
//UINT8 SecureBoot = 0;
//UINT8 SecureBootSetupMode = 0;
2021-02-02 10:02:21 +01:00
UINT8 SecureBootPolicy = 0 ;
// Secure boot white/black list
2021-02-11 12:41:59 +01:00
XStringWArray SecureBootWhiteList = XStringWArray ( ) ;
XStringWArray SecureBootBlackList = XStringWArray ( ) ;
2021-02-02 10:02:21 +01:00
INT8 XMPDetection = 0 ;
// LegacyBoot
XStringW LegacyBoot = XStringW ( ) ;
UINT16 LegacyBiosDefaultEntry = 0 ;
2021-03-20 15:29:34 +01:00
UINT8 CustomLogoType = 0 ;
2021-03-15 10:02:34 +01:00
XString8 CustomLogoAsXString8 = XString8 ( ) ;
XBuffer < UINT8 > CustomLogoAsData = XBuffer < UINT8 > ( ) ;
2021-04-11 07:18:52 +02:00
2021-04-28 20:30:34 +02:00
# if __cplusplus > 201703L
2021-10-27 19:37:54 +02:00
XBool operator = = ( const BootClass & ) const = default ;
2021-04-28 20:30:34 +02:00
# endif
2021-09-28 15:54:31 +02:00
XBool isEqual ( const BootClass & other ) const
2021-04-11 07:18:52 +02:00
{
if ( ! ( Timeout = = other . Timeout ) ) return false ;
if ( ! ( SkipHibernateTimeout = = other . SkipHibernateTimeout ) ) return false ;
if ( ! ( DisableCloverHotkeys = = other . DisableCloverHotkeys ) ) return false ;
if ( ! ( BootArgs = = other . BootArgs ) ) return false ;
if ( ! ( NeverDoRecovery = = other . NeverDoRecovery ) ) return false ;
if ( ! ( LastBootedVolume = = other . LastBootedVolume ) ) return false ;
if ( ! ( DefaultVolume = = other . DefaultVolume ) ) return false ;
if ( ! ( DefaultLoader = = other . DefaultLoader ) ) return false ;
if ( ! ( DebugLog = = other . DebugLog ) ) return false ;
if ( ! ( FastBoot = = other . FastBoot ) ) return false ;
if ( ! ( NoEarlyProgress = = other . NoEarlyProgress ) ) return false ;
if ( ! ( NeverHibernate = = other . NeverHibernate ) ) return false ;
if ( ! ( StrictHibernate = = other . StrictHibernate ) ) return false ;
if ( ! ( RtcHibernateAware = = other . RtcHibernateAware ) ) return false ;
if ( ! ( HibernationFixup = = other . HibernationFixup ) ) return false ;
if ( ! ( SignatureFixup = = other . SignatureFixup ) ) return false ;
if ( ! ( SecureSetting = = other . SecureSetting ) ) return false ;
if ( ! ( SecureBootPolicy = = other . SecureBootPolicy ) ) return false ;
if ( ! ( SecureBootWhiteList = = other . SecureBootWhiteList ) ) return false ;
if ( ! ( SecureBootBlackList = = other . SecureBootBlackList ) ) return false ;
if ( ! ( XMPDetection = = other . XMPDetection ) ) return false ;
if ( ! ( LegacyBoot = = other . LegacyBoot ) ) return false ;
if ( ! ( LegacyBiosDefaultEntry = = other . LegacyBiosDefaultEntry ) ) return false ;
if ( ! ( CustomLogoType = = other . CustomLogoType ) ) return false ;
if ( ! ( CustomLogoAsXString8 = = other . CustomLogoAsXString8 ) ) return false ;
if ( ! ( CustomLogoAsData = = other . CustomLogoAsData ) ) return false ;
return true ;
}
2021-10-27 19:37:54 +02:00
void takeValueFrom ( const ConfigPlistClass : : Boot_Class & other )
2021-04-28 20:30:34 +02:00
{
2021-10-27 19:37:54 +02:00
Timeout = other . dgetTimeout ( ) ;
SkipHibernateTimeout = other . dgetSkipHibernateTimeout ( ) ;
DisableCloverHotkeys = other . dgetDisableCloverHotkeys ( ) ;
BootArgs = other . dgetBootArgs ( ) ;
NeverDoRecovery = other . dgetNeverDoRecovery ( ) ;
LastBootedVolume = other . dgetLastBootedVolume ( ) ;
DefaultVolume = other . dgetDefaultVolume ( ) ;
DefaultLoader = other . dgetDefaultLoader ( ) ;
DebugLog = other . dgetDebugLog ( ) ;
FastBoot = other . dgetFastBoot ( ) ;
NoEarlyProgress = other . dgetNoEarlyProgress ( ) ;
NeverHibernate = other . dgetNeverHibernate ( ) ;
StrictHibernate = other . dgetStrictHibernate ( ) ;
RtcHibernateAware = other . dgetRtcHibernateAware ( ) ;
HibernationFixup = other . dgetHibernationFixup ( ) ;
SignatureFixup = other . dgetSignatureFixup ( ) ;
SecureSetting = other . dgetSecureSetting ( ) ;
SecureBootPolicy = other . dgetSecureBootPolicy ( ) ;
SecureBootWhiteList = other . dgetSecureBootWhiteList ( ) ;
SecureBootBlackList = other . dgetSecureBootBlackList ( ) ;
XMPDetection = other . dgetXMPDetection ( ) ;
LegacyBoot = other . dgetLegacyBoot ( gFirmwareClover ) ;
LegacyBiosDefaultEntry = other . dgetLegacyBiosDefaultEntry ( ) ;
CustomLogoType = other . dgetCustomLogoType ( ) ;
CustomLogoAsXString8 = other . dgetCustomLogoAsXString8 ( ) ;
CustomLogoAsData = other . dgetCustomLogoAsData ( ) ;
2021-04-28 20:30:34 +02:00
}
2021-03-27 19:53:30 +01:00
} ;
2021-02-11 12:41:59 +01:00
class ACPIClass
{
public :
class ACPIDropTablesClass
{
public :
2021-09-25 12:11:54 +02:00
union {
UINT32 Signature = 0 ;
char SignatureAs4Chars [ 4 ] ;
} ;
2021-02-11 12:41:59 +01:00
UINT64 TableId = 0 ;
UINT32 TabLength = 0 ;
2021-09-28 15:54:31 +02:00
XBool OtherOS = false ;
2021-04-11 07:18:52 +02:00
2021-04-28 20:30:34 +02:00
# if __cplusplus > 201703L
2021-09-28 15:54:31 +02:00
XBool operator = = ( const ACPIDropTablesClass & ) const = default ;
2021-04-28 20:30:34 +02:00
# endif
2021-09-28 15:54:31 +02:00
XBool isEqual ( const ACPIDropTablesClass & other ) const
2021-04-11 07:18:52 +02:00
{
if ( ! ( Signature = = other . Signature ) ) return false ;
if ( ! ( TableId = = other . TableId ) ) return false ;
if ( ! ( TabLength = = other . TabLength ) ) return false ;
if ( ! ( OtherOS = = other . OtherOS ) ) return false ;
return true ;
}
2021-10-27 19:37:54 +02:00
void takeValueFrom ( const ConfigPlistClass : : ACPI_Class : : ACPI_DropTables_Class & other )
2021-04-28 20:30:34 +02:00
{
2021-10-27 19:37:54 +02:00
Signature = other . dgetSignature ( ) ;
TableId = other . dgetTableId ( ) ;
TabLength = other . dgetTabLength ( ) ;
OtherOS = other . dgetOtherOS ( ) ;
2021-04-28 20:30:34 +02:00
}
2021-02-11 12:41:59 +01:00
} ;
class DSDTClass
{
public :
2021-03-27 19:53:30 +01:00
class DSDT_Patch
{
public :
2021-09-28 15:54:31 +02:00
XBool Disabled = XBool ( ) ;
2021-03-27 19:53:30 +01:00
XString8 PatchDsdtLabel = XString8 ( ) ;
XBuffer < UINT8 > PatchDsdtFind = XBuffer < UINT8 > ( ) ;
XBuffer < UINT8 > PatchDsdtReplace = XBuffer < UINT8 > ( ) ;
XBuffer < UINT8 > PatchDsdtTgt = XBuffer < UINT8 > ( ) ;
2021-04-05 10:57:55 +02:00
INPUT_ITEM PatchDsdtMenuItem = INPUT_ITEM ( ) ; // Not read from config.plist. Should be moved out.
2021-04-11 07:18:52 +02:00
2021-04-28 20:30:34 +02:00
# if __cplusplus > 201703L
2021-09-28 15:54:31 +02:00
XBool operator = = ( const DSDT_Patch & ) const = default ;
2021-04-28 20:30:34 +02:00
# endif
2021-09-28 15:54:31 +02:00
XBool isEqual ( const DSDT_Patch & other ) const
2021-04-11 07:18:52 +02:00
{
if ( ! ( Disabled = = other . Disabled ) ) return false ;
if ( ! ( PatchDsdtLabel = = other . PatchDsdtLabel ) ) return false ;
if ( ! ( PatchDsdtFind = = other . PatchDsdtFind ) ) return false ;
if ( ! ( PatchDsdtReplace = = other . PatchDsdtReplace ) ) return false ;
if ( ! ( PatchDsdtTgt = = other . PatchDsdtTgt ) ) return false ;
if ( ! ( PatchDsdtMenuItem = = other . PatchDsdtMenuItem ) ) return false ;
return true ;
}
2021-10-27 19:37:54 +02:00
void takeValueFrom ( const ConfigPlistClass : : ACPI_Class : : DSDT_Class : : ACPI_DSDT_Patch_Class & other )
2021-04-28 20:30:34 +02:00
{
2021-10-27 19:37:54 +02:00
Disabled = other . dgetDisabled ( ) ;
PatchDsdtLabel = other . dgetPatchDsdtLabel ( ) ;
PatchDsdtFind = other . dgetPatchDsdtFind ( ) ;
PatchDsdtReplace = other . dgetPatchDsdtReplace ( ) ;
PatchDsdtTgt = other . dgetPatchDsdtTgt ( ) ;
PatchDsdtMenuItem . BValue = ! other . dgetDisabled ( ) ;
2021-04-28 20:30:34 +02:00
}
2021-03-27 19:53:30 +01:00
} ;
2021-02-11 12:41:59 +01:00
XStringW DsdtName = XStringW ( ) ;
2021-09-28 15:54:31 +02:00
XBool DebugDSDT = false ;
XBool Rtc8Allowed = false ;
2021-02-11 12:41:59 +01:00
UINT8 PNLF_UID = 0 ;
UINT32 FixDsdt = 0 ;
2021-09-28 15:54:31 +02:00
XBool ReuseFFFF = false ;
XBool SuspendOverride = false ;
2021-04-28 20:30:34 +02:00
XObjArrayWithTakeValueFromXmlArray < DSDT_Patch , ConfigPlistClass : : ACPI_Class : : DSDT_Class : : ACPI_DSDT_Patch_Class >
DSDTPatchArray = XObjArrayWithTakeValueFromXmlArray < DSDT_Patch , ConfigPlistClass : : ACPI_Class : : DSDT_Class : : ACPI_DSDT_Patch_Class > ( ) ;
2021-04-11 07:18:52 +02:00
2021-04-28 20:30:34 +02:00
# if __cplusplus > 201703L
2021-09-28 15:54:31 +02:00
XBool operator = = ( const DSDTClass & ) const = default ;
2021-04-28 20:30:34 +02:00
# endif
2021-09-28 15:54:31 +02:00
XBool isEqual ( const DSDTClass & other ) const
2021-04-11 07:18:52 +02:00
{
if ( ! ( DsdtName = = other . DsdtName ) ) return false ;
if ( ! ( DebugDSDT = = other . DebugDSDT ) ) return false ;
if ( ! ( Rtc8Allowed = = other . Rtc8Allowed ) ) return false ;
if ( ! ( PNLF_UID = = other . PNLF_UID ) ) return false ;
if ( ! ( FixDsdt = = other . FixDsdt ) ) return false ;
if ( ! ( ReuseFFFF = = other . ReuseFFFF ) ) return false ;
if ( ! ( SuspendOverride = = other . SuspendOverride ) ) return false ;
if ( ! DSDTPatchArray . isEqual ( other . DSDTPatchArray ) ) return false ;
return true ;
}
2021-10-27 19:37:54 +02:00
void takeValueFrom ( const ConfigPlistClass : : ACPI_Class : : DSDT_Class & other )
2021-04-28 20:30:34 +02:00
{
2021-10-27 19:37:54 +02:00
DsdtName = other . dgetDsdtName ( ) ;
DebugDSDT = other . dgetDebugDSDT ( ) ;
Rtc8Allowed = other . dgetRtc8Allowed ( ) ;
PNLF_UID = other . dgetPNLF_UID ( ) ;
FixDsdt = other . dgetFixDsdt ( ) ;
ReuseFFFF = other . dgetReuseFFFF ( ) ;
SuspendOverride = other . dgetSuspendOverride ( ) ;
DSDTPatchArray . takeValueFrom ( other . Patches ) ;
2021-04-28 20:30:34 +02:00
}
2021-03-27 19:53:30 +01:00
} ;
2021-02-11 12:41:59 +01:00
class SSDTClass
{
public :
class GenerateClass
{
public :
2021-09-28 15:54:31 +02:00
XBool GeneratePStates = false ;
XBool GenerateCStates = false ;
XBool GenerateAPSN = false ;
XBool GenerateAPLF = false ;
XBool GeneratePluginType = false ;
2021-04-11 07:18:52 +02:00
2021-04-28 20:30:34 +02:00
# if __cplusplus > 201703L
2021-09-28 15:54:31 +02:00
XBool operator = = ( const GenerateClass & ) const = default ;
2021-04-28 20:30:34 +02:00
# endif
2021-09-28 15:54:31 +02:00
XBool isEqual ( const GenerateClass & other ) const
2021-04-11 07:18:52 +02:00
{
if ( ! ( GeneratePStates = = other . GeneratePStates ) ) return false ;
if ( ! ( GenerateCStates = = other . GenerateCStates ) ) return false ;
if ( ! ( GenerateAPSN = = other . GenerateAPSN ) ) return false ;
if ( ! ( GenerateAPLF = = other . GenerateAPLF ) ) return false ;
if ( ! ( GeneratePluginType = = other . GeneratePluginType ) ) return false ;
return true ;
}
2021-10-27 19:37:54 +02:00
void takeValueFrom ( const ConfigPlistClass : : ACPI_Class : : SSDT_Class : : XmlUnionGenerate & other )
2021-04-28 20:30:34 +02:00
{
2021-10-27 19:37:54 +02:00
GeneratePStates = other . dgetGeneratePStates ( ) ;
GenerateCStates = other . dgetGenerateCStates ( ) ;
GenerateAPSN = other . dgetGenerateAPSN ( ) ;
GenerateAPLF = other . dgetGenerateAPLF ( ) ;
GeneratePluginType = other . dgetGeneratePluginType ( ) ;
2021-04-28 20:30:34 +02:00
}
2021-03-27 19:53:30 +01:00
} ;
2021-09-28 15:54:31 +02:00
XBool DropSSDTSetting = false ;
XBool NoOemTableId = false ;
XBool NoDynamicExtract = false ;
XBool EnableISS = false ;
XBool EnableC7 = false ;
XBool _EnableC6 = false ;
XBool _EnableC4 = false ;
XBool _EnableC2 = false ;
2021-03-19 16:35:01 +01:00
UINT16 _C3Latency = 0 ;
2021-02-11 12:41:59 +01:00
UINT8 PLimitDict = 0 ;
UINT8 UnderVoltStep = 0 ;
2021-09-28 15:54:31 +02:00
XBool DoubleFirstState = false ;
2021-02-11 12:41:59 +01:00
UINT8 MinMultiplier = 0 ;
UINT8 MaxMultiplier = 0 ;
UINT8 PluginType = 0 ;
2021-03-27 19:53:30 +01:00
GenerateClass Generate = GenerateClass ( ) ;
2021-04-11 07:18:52 +02:00
2021-04-28 20:30:34 +02:00
# if __cplusplus > 201703L
2021-09-28 15:54:31 +02:00
XBool operator = = ( const SSDTClass & ) const = default ;
2021-04-28 20:30:34 +02:00
# endif
2021-09-28 15:54:31 +02:00
XBool isEqual ( const SSDTClass & other ) const
2021-04-11 07:18:52 +02:00
{
if ( ! ( DropSSDTSetting = = other . DropSSDTSetting ) ) return false ;
if ( ! ( NoOemTableId = = other . NoOemTableId ) ) return false ;
if ( ! ( NoDynamicExtract = = other . NoDynamicExtract ) ) return false ;
if ( ! ( EnableISS = = other . EnableISS ) ) return false ;
if ( ! ( EnableC7 = = other . EnableC7 ) ) return false ;
if ( ! ( _EnableC6 = = other . _EnableC6 ) ) return false ;
if ( ! ( _EnableC4 = = other . _EnableC4 ) ) return false ;
if ( ! ( _EnableC2 = = other . _EnableC2 ) ) return false ;
if ( ! ( _C3Latency = = other . _C3Latency ) ) return false ;
if ( ! ( PLimitDict = = other . PLimitDict ) ) return false ;
if ( ! ( UnderVoltStep = = other . UnderVoltStep ) ) return false ;
if ( ! ( DoubleFirstState = = other . DoubleFirstState ) ) return false ;
if ( ! ( MinMultiplier = = other . MinMultiplier ) ) return false ;
if ( ! ( MaxMultiplier = = other . MaxMultiplier ) ) return false ;
if ( ! ( PluginType = = other . PluginType ) ) return false ;
if ( ! Generate . isEqual ( other . Generate ) ) return false ;
return true ;
}
2021-10-27 19:37:54 +02:00
void takeValueFrom ( const ConfigPlistClass : : ACPI_Class : : SSDT_Class & other )
2021-04-28 20:30:34 +02:00
{
2021-10-27 19:37:54 +02:00
DropSSDTSetting = other . dgetDropSSDTSetting ( ) ;
NoOemTableId = other . dgetNoOemTableId ( ) ;
NoDynamicExtract = other . dgetNoDynamicExtract ( ) ;
EnableISS = other . dgetEnableISS ( ) ;
EnableC7 = other . dgetEnableC7 ( ) ;
_EnableC6 = other . dget_EnableC6 ( ) ;
_EnableC4 = other . dget_EnableC4 ( ) ;
_EnableC2 = other . dget_EnableC2 ( ) ;
_C3Latency = other . dget_C3Latency ( ) ;
PLimitDict = other . dgetPLimitDict ( ) ;
UnderVoltStep = other . dgetUnderVoltStep ( ) ;
DoubleFirstState = other . dgetDoubleFirstState ( ) ;
MinMultiplier = other . dgetMinMultiplier ( ) ;
MaxMultiplier = other . dgetMaxMultiplier ( ) ;
PluginType = other . dgetPluginType ( ) ;
Generate . takeValueFrom ( other . Generate ) ;
2021-04-28 20:30:34 +02:00
}
2021-03-27 19:53:30 +01:00
} ;
UINT64 ResetAddr = 0 ;
UINT8 ResetVal = 0 ;
2021-09-28 15:54:31 +02:00
XBool SlpSmiEnable = false ;
XBool FixHeaders = false ;
XBool FixMCFG = false ;
XBool NoASPM = false ;
XBool smartUPS = false ;
XBool PatchNMI = false ;
XBool AutoMerge = false ;
2021-03-27 19:53:30 +01:00
XStringWArray DisabledAML = XStringWArray ( ) ;
XString8Array SortedACPI = XString8Array ( ) ;
2021-04-28 20:30:34 +02:00
// XObjArray<ACPI_RENAME_DEVICE> DeviceRename = XObjArray<ACPI_RENAME_DEVICE>();
// XObjArrayWithTakeValueFrom<ACPI_RENAME_DEVICE, ConfigPlistClass::ACPI_Class::ACPI_RenamesDevices_Class>
// DeviceRename = XObjArrayWithTakeValueFrom<ACPI_RENAME_DEVICE, ConfigPlistClass::ACPI_Class::ACPI_RenamesDevices_Class>();
class DeviceRename_Array : public XObjArray < ACPI_RENAME_DEVICE > {
public :
2021-10-27 19:37:54 +02:00
void takeValueFrom ( const ConfigPlistClass : : ACPI_Class : : ACPI_RenamesDevices_Class & other )
2021-04-28 20:30:34 +02:00
{
size_t idx ;
2021-10-27 19:37:54 +02:00
for ( idx = 0 ; idx < other . size ( ) ; + + idx ) {
if ( idx < size ( ) ) ElementAt ( idx ) . takeValueFrom ( other . getAtIndex ( idx ) ) ;
2021-04-28 20:30:34 +02:00
else {
2021-05-05 19:10:10 +02:00
ACPI_RENAME_DEVICE * s = new ACPI_RENAME_DEVICE ;
2021-10-27 19:37:54 +02:00
s - > takeValueFrom ( other . getAtIndex ( idx ) ) ;
2021-04-28 20:30:34 +02:00
AddReference ( s , true ) ;
}
}
while ( idx < size ( ) ) RemoveAtIndex ( idx ) ;
}
} DeviceRename = DeviceRename_Array ( ) ;
XObjArrayWithTakeValueFromXmlArray < ACPIDropTablesClass , ConfigPlistClass : : ACPI_Class : : ACPI_DropTables_Class >
ACPIDropTablesArray = XObjArrayWithTakeValueFromXmlArray < ACPIDropTablesClass , ConfigPlistClass : : ACPI_Class : : ACPI_DropTables_Class > ( ) ;
2021-03-27 19:53:30 +01:00
DSDTClass DSDT = DSDTClass ( ) ;
SSDTClass SSDT = SSDTClass ( ) ;
2021-04-11 07:18:52 +02:00
2021-04-28 20:30:34 +02:00
# if __cplusplus > 201703L
2021-09-28 15:54:31 +02:00
XBool operator = = ( const ACPIClass & ) const = default ;
2021-04-28 20:30:34 +02:00
# endif
2021-09-28 15:54:31 +02:00
XBool isEqual ( const ACPIClass & other ) const
2021-04-11 07:18:52 +02:00
{
if ( ! ( ResetAddr = = other . ResetAddr ) ) return false ;
if ( ! ( ResetVal = = other . ResetVal ) ) return false ;
if ( ! ( SlpSmiEnable = = other . SlpSmiEnable ) ) return false ;
if ( ! ( FixHeaders = = other . FixHeaders ) ) return false ;
if ( ! ( FixMCFG = = other . FixMCFG ) ) return false ;
if ( ! ( NoASPM = = other . NoASPM ) ) return false ;
if ( ! ( smartUPS = = other . smartUPS ) ) return false ;
if ( ! ( PatchNMI = = other . PatchNMI ) ) return false ;
if ( ! ( AutoMerge = = other . AutoMerge ) ) return false ;
if ( ! ( DisabledAML = = other . DisabledAML ) ) return false ;
if ( ! ( SortedACPI = = other . SortedACPI ) ) return false ;
if ( ! DeviceRename . isEqual ( other . DeviceRename ) ) return false ;
if ( ! ACPIDropTablesArray . isEqual ( other . ACPIDropTablesArray ) ) return false ;
if ( ! DSDT . isEqual ( other . DSDT ) ) return false ;
if ( ! SSDT . isEqual ( other . SSDT ) ) return false ;
return true ;
}
2021-10-27 19:37:54 +02:00
void takeValueFrom ( const ConfigPlistClass : : ACPI_Class & other )
2021-04-28 20:30:34 +02:00
{
2021-10-27 19:37:54 +02:00
ResetAddr = other . dgetResetAddr ( ) ;
ResetVal = other . dgetResetVal ( ) ;
SlpSmiEnable = other . dgetSlpSmiEnable ( ) ;
FixHeaders = other . dgetFixHeaders ( ) | | other . DSDT . Fixes . dgetFixHeaders ( ) ;
FixMCFG = other . dgetFixMCFG ( ) ;
NoASPM = other . dgetNoASPM ( ) ;
smartUPS = other . dgetsmartUPS ( ) ;
PatchNMI = other . dgetPatchNMI ( ) ;
AutoMerge = other . dgetAutoMerge ( ) ;
DisabledAML = other . dgetDisabledAML ( ) ;
SortedACPI = other . dgetSortedACPI ( ) ;
DeviceRename . takeValueFrom ( other . RenameDevices ) ;
ACPIDropTablesArray . takeValueFrom ( other . ACPIDropTablesArray ) ;
DSDT . takeValueFrom ( other . DSDT ) ;
SSDT . takeValueFrom ( other . SSDT ) ;
2021-04-28 20:30:34 +02:00
}
2021-03-27 19:53:30 +01:00
} ;
2021-02-02 10:02:21 +01:00
class GUIClass {
public :
2021-03-19 21:32:42 +01:00
class MouseClass {
public :
2021-04-11 07:18:52 +02:00
INTN PointerSpeed = 0 ;
2021-09-28 15:54:31 +02:00
XBool PointerEnabled = false ;
2021-04-11 07:18:52 +02:00
UINT64 DoubleClickTime = 0 ;
2021-09-28 15:54:31 +02:00
XBool PointerMirror = false ;
2021-04-11 07:18:52 +02:00
2021-04-28 20:30:34 +02:00
# if __cplusplus > 201703L
2021-09-28 15:54:31 +02:00
XBool operator = = ( const MouseClass & ) const = default ;
2021-04-28 20:30:34 +02:00
# endif
2021-09-28 15:54:31 +02:00
XBool isEqual ( const MouseClass & other ) const
2021-04-11 07:18:52 +02:00
{
if ( ! ( PointerSpeed = = other . PointerSpeed ) ) return false ;
if ( ! ( PointerEnabled = = other . PointerEnabled ) ) return false ;
if ( ! ( DoubleClickTime = = other . DoubleClickTime ) ) return false ;
if ( ! ( PointerMirror = = other . PointerMirror ) ) return false ;
return true ;
}
2021-10-27 19:37:54 +02:00
void takeValueFrom ( const ConfigPlistClass : : GUI_Class : : GUI_Mouse_Class & other )
2021-04-28 20:30:34 +02:00
{
2021-10-27 19:37:54 +02:00
PointerSpeed = other . dgetPointerSpeed ( ) ;
PointerEnabled = other . dgetPointerEnabled ( ) ;
DoubleClickTime = other . dgetDoubleClickTime ( ) ;
PointerMirror = other . dgetPointerMirror ( ) ;
2021-04-28 20:30:34 +02:00
}
2021-03-27 19:53:30 +01:00
} ;
2021-03-19 21:32:42 +01:00
class ScanClass {
public :
2021-09-28 15:54:31 +02:00
XBool DisableEntryScan = false ;
XBool DisableToolScan = false ;
2021-03-23 20:59:30 +01:00
UINT8 KernelScan = 0 ;
2021-09-28 15:54:31 +02:00
XBool LinuxScan = false ;
XBool LegacyFirst = false ;
XBool NoLegacy = false ;
2021-04-11 07:18:52 +02:00
2021-04-28 20:30:34 +02:00
# if __cplusplus > 201703L
2021-09-28 15:54:31 +02:00
XBool operator = = ( const ScanClass & ) const = default ;
2021-04-28 20:30:34 +02:00
# endif
2021-09-28 15:54:31 +02:00
XBool isEqual ( const ScanClass & other ) const
2021-04-11 07:18:52 +02:00
{
if ( ! ( DisableEntryScan = = other . DisableEntryScan ) ) return false ;
if ( ! ( DisableToolScan = = other . DisableToolScan ) ) return false ;
if ( ! ( KernelScan = = other . KernelScan ) ) return false ;
if ( ! ( LinuxScan = = other . LinuxScan ) ) return false ;
if ( ! ( LegacyFirst = = other . LegacyFirst ) ) return false ;
if ( ! ( NoLegacy = = other . NoLegacy ) ) return false ;
return true ;
}
2021-10-27 19:37:54 +02:00
void takeValueFrom ( const ConfigPlistClass : : GUI_Class : : GUI_Scan_Class & other )
2021-04-28 20:30:34 +02:00
{
2021-10-27 19:37:54 +02:00
DisableEntryScan = other . dgetDisableEntryScan ( ) ;
DisableToolScan = other . dgetDisableToolScan ( ) ;
KernelScan = other . dgetKernelScan ( ) ;
LinuxScan = other . dgetLinuxScan ( ) ;
LegacyFirst = other . dgetLegacyFirst ( ) ;
NoLegacy = other . dgetNoLegacy ( ) ;
2021-04-28 20:30:34 +02:00
}
2021-03-27 19:53:30 +01:00
} ;
2021-04-11 12:53:21 +02:00
INT32 Timezone = 0xFF ;
2021-03-27 19:53:30 +01:00
XStringW Theme = XStringW ( ) ;
2021-09-28 15:54:31 +02:00
//XBool DarkEmbedded = 0;
2021-03-27 19:53:30 +01:00
XString8 EmbeddedThemeType = XString8 ( ) ;
2021-09-28 15:54:31 +02:00
XBool PlayAsync = false ;
XBool CustomIcons = false ;
XBool TextOnly = false ;
XBool ShowOptimus = false ;
2021-03-27 19:53:30 +01:00
XStringW ScreenResolution = XStringW ( ) ;
2021-09-28 15:54:31 +02:00
XBool ProvideConsoleGop = false ;
2021-03-27 19:53:30 +01:00
INTN ConsoleMode = 0 ;
2021-04-05 10:57:55 +02:00
XString8 Language = XString8 ( ) ;
2021-04-03 16:42:49 +02:00
LanguageCode languageCode = english ;
2021-09-28 15:54:31 +02:00
XBool KbdPrevLang = false ;
2021-03-27 19:53:30 +01:00
XString8Array HVHideStrings = XString8Array ( ) ;
2021-04-11 07:18:52 +02:00
ScanClass Scan = ScanClass ( ) ;
MouseClass Mouse = MouseClass ( ) ;
2021-04-28 20:30:34 +02:00
XObjArrayWithTakeValueFromXmlArray < CUSTOM_LOADER_ENTRY_SETTINGS , ConfigPlistClass : : GUI_Class : : GUI_Custom_Class : : GUI_Custom_Entry_Class >
CustomEntriesSettings = XObjArrayWithTakeValueFromXmlArray < CUSTOM_LOADER_ENTRY_SETTINGS , ConfigPlistClass : : GUI_Class : : GUI_Custom_Class : : GUI_Custom_Entry_Class > ( ) ;
XObjArrayWithTakeValueFromXmlArray < CUSTOM_LEGACY_ENTRY_SETTINGS , ConfigPlistClass : : GUI_Class : : GUI_Custom_Class : : GUI_Custom_Legacy_Class >
CustomLegacySettings = XObjArrayWithTakeValueFromXmlArray < CUSTOM_LEGACY_ENTRY_SETTINGS , ConfigPlistClass : : GUI_Class : : GUI_Custom_Class : : GUI_Custom_Legacy_Class > ( ) ;
2021-10-27 19:37:54 +02:00
XObjArrayWithTakeValueFromXmlArray < CUSTOM_TOOL_ENTRY_SETTINGS , ConfigPlistClass : : GUI_Class : : GUI_Custom_Class : : GUI_Custom_Tool_Class >
CustomToolSettings = XObjArrayWithTakeValueFromXmlArray < CUSTOM_TOOL_ENTRY_SETTINGS , ConfigPlistClass : : GUI_Class : : GUI_Custom_Class : : GUI_Custom_Tool_Class > ( ) ;
2021-03-23 20:59:30 +01:00
2021-09-28 15:54:31 +02:00
XBool getDarkEmbedded ( XBool isDaylight ) const ;
2021-04-11 07:18:52 +02:00
2021-04-28 20:30:34 +02:00
# if __cplusplus > 201703L
2021-09-28 15:54:31 +02:00
XBool operator = = ( const GUIClass & ) const = default ;
2021-04-28 20:30:34 +02:00
# endif
2021-09-28 15:54:31 +02:00
XBool isEqual ( const GUIClass & other ) const
2021-04-11 07:18:52 +02:00
{
if ( ! ( Timezone = = other . Timezone ) ) return false ;
if ( ! ( Theme = = other . Theme ) ) return false ;
if ( ! ( EmbeddedThemeType = = other . EmbeddedThemeType ) ) return false ;
if ( ! ( PlayAsync = = other . PlayAsync ) ) return false ;
if ( ! ( CustomIcons = = other . CustomIcons ) ) return false ;
if ( ! ( TextOnly = = other . TextOnly ) ) return false ;
if ( ! ( ShowOptimus = = other . ShowOptimus ) ) return false ;
if ( ! ( ScreenResolution = = other . ScreenResolution ) ) return false ;
if ( ! ( ProvideConsoleGop = = other . ProvideConsoleGop ) ) return false ;
if ( ! ( ConsoleMode = = other . ConsoleMode ) ) return false ;
if ( ! ( Language = = other . Language ) ) return false ;
if ( ! ( languageCode = = other . languageCode ) ) return false ;
if ( ! ( KbdPrevLang = = other . KbdPrevLang ) ) return false ;
if ( ! ( HVHideStrings = = other . HVHideStrings ) ) return false ;
if ( ! Scan . isEqual ( other . Scan ) ) return false ;
if ( ! Mouse . isEqual ( other . Mouse ) ) return false ;
if ( ! CustomEntriesSettings . isEqual ( other . CustomEntriesSettings ) ) return false ;
if ( ! CustomLegacySettings . isEqual ( other . CustomLegacySettings ) ) return false ;
if ( ! CustomToolSettings . isEqual ( other . CustomToolSettings ) ) return false ;
return true ;
}
2021-10-27 19:37:54 +02:00
void takeValueFrom ( const ConfigPlistClass : : GUI_Class & other )
2021-04-28 20:30:34 +02:00
{
2021-10-27 19:37:54 +02:00
Timezone = other . dgetTimezone ( ) ;
Theme = other . dgetTheme ( ) ;
EmbeddedThemeType = other . dgetEmbeddedThemeType ( ) ;
PlayAsync = other . dgetPlayAsync ( ) ;
CustomIcons = other . dgetCustomIcons ( ) ;
TextOnly = other . dgetTextOnly ( ) ;
ShowOptimus = other . dgetShowOptimus ( ) ;
ScreenResolution = other . dgetScreenResolution ( ) ;
ProvideConsoleGop = other . dgetProvideConsoleGop ( ) ;
ConsoleMode = other . dgetConsoleMode ( ) ;
Language = other . dgetLanguage ( ) ;
languageCode = other . dgetlanguageCode ( ) ;
KbdPrevLang = other . dgetKbdPrevLang ( ) ;
HVHideStrings = other . dgetHVHideStrings ( ) ;
Scan . takeValueFrom ( other . Scan ) ;
Mouse . takeValueFrom ( other . Mouse ) ;
CustomEntriesSettings . takeValueFrom ( other . Custom . Entries ) ;
CustomLegacySettings . takeValueFrom ( other . Custom . Legacy ) ;
CustomToolSettings . takeValueFrom ( other . Custom . Tool ) ;
2021-04-28 20:30:34 +02:00
}
2021-03-19 21:32:42 +01:00
2021-03-27 19:53:30 +01:00
} ;
2021-02-02 10:02:21 +01:00
2021-03-19 16:35:01 +01:00
class CPUClass {
public :
UINT16 QPI = 0 ;
UINT32 CpuFreqMHz = 0 ;
UINT16 CpuType = 0 ;
2021-09-28 15:54:31 +02:00
XBool QEMU = false ;
XBool UseARTFreq = false ;
2021-03-19 16:35:01 +01:00
UINT32 BusSpeed = 0 ; //in kHz
2021-09-28 15:54:31 +02:00
XBool UserChange = false ;
2021-03-19 16:35:01 +01:00
UINT8 SavingMode = 0 ;
2021-09-28 15:54:31 +02:00
XBool HWPEnable = false ;
2021-03-19 16:35:01 +01:00
undefinable_uint32 HWPValue = undefinable_uint32 ( ) ;
UINT8 TDP = 0 ;
2021-09-28 15:54:31 +02:00
XBool TurboDisabled = false ;
2021-03-19 16:35:01 +01:00
undefinable_bool _EnableC6 = undefinable_bool ( ) ;
undefinable_bool _EnableC4 = undefinable_bool ( ) ;
undefinable_bool _EnableC2 = undefinable_bool ( ) ;
2021-04-11 07:18:52 +02:00
2021-04-28 20:30:34 +02:00
# if __cplusplus > 201703L
2021-10-27 19:37:54 +02:00
XBool operator = = ( const CPUClass & ) const = default ;
2021-04-28 20:30:34 +02:00
# endif
2021-09-28 15:54:31 +02:00
XBool isEqual ( const CPUClass & other ) const
2021-04-11 07:18:52 +02:00
{
if ( ! ( QPI = = other . QPI ) ) return false ;
if ( ! ( CpuFreqMHz = = other . CpuFreqMHz ) ) return false ;
if ( ! ( CpuType = = other . CpuType ) ) return false ;
if ( ! ( QEMU = = other . QEMU ) ) return false ;
if ( ! ( UseARTFreq = = other . UseARTFreq ) ) return false ;
if ( ! ( BusSpeed = = other . BusSpeed ) ) return false ;
if ( ! ( UserChange = = other . UserChange ) ) return false ;
if ( ! ( SavingMode = = other . SavingMode ) ) return false ;
if ( ! ( HWPEnable = = other . HWPEnable ) ) return false ;
if ( ! ( HWPValue = = other . HWPValue ) ) return false ;
if ( ! ( TDP = = other . TDP ) ) return false ;
if ( ! ( TurboDisabled = = other . TurboDisabled ) ) return false ;
if ( ! ( _EnableC6 = = other . _EnableC6 ) ) return false ;
if ( ! ( _EnableC4 = = other . _EnableC4 ) ) return false ;
if ( ! ( _EnableC2 = = other . _EnableC2 ) ) return false ;
return true ;
}
2021-10-27 19:37:54 +02:00
void takeValueFrom ( const ConfigPlistClass : : CPU_Class & other )
2021-04-28 20:30:34 +02:00
{
2021-10-27 19:37:54 +02:00
QPI = other . dgetQPI ( ) ;
CpuFreqMHz = other . dgetCpuFreqMHz ( ) ;
CpuType = other . dgetCpuType ( ) ;
QEMU = other . dgetQEMU ( ) ;
UseARTFreq = other . dgetUseARTFreq ( ) ;
BusSpeed = other . dgetBusSpeed ( ) ;
UserChange = other . dgetUserChange ( ) ;
SavingMode = other . dgetSavingMode ( ) ;
HWPEnable = other . dgetHWPEnable ( ) ;
HWPValue = other . dgetHWPValue ( ) ;
TDP = other . dgetTDP ( ) ;
TurboDisabled = other . dgetTurboDisabled ( ) ;
_EnableC6 = other . dget_EnableC6 ( ) ;
_EnableC4 = other . dget_EnableC4 ( ) ;
_EnableC2 = other . dget_EnableC2 ( ) ;
2021-04-28 20:30:34 +02:00
}
2021-03-27 19:53:30 +01:00
} ;
2021-03-19 16:35:01 +01:00
2021-03-25 15:32:56 +01:00
class SystemParametersClass {
public :
2021-09-28 15:54:31 +02:00
XBool WithKexts = true ;
XBool WithKextsIfNoFakeSMC = false ;
XBool NoCaches = false ;
2021-03-25 15:32:56 +01:00
uint16_t BacklightLevel = 0xFFFF ;
2021-09-28 15:54:31 +02:00
XBool BacklightLevelConfig = false ;
2021-03-25 15:32:56 +01:00
XString8 CustomUuid = XString8 ( ) ;
2021-03-27 19:53:30 +01:00
public : // temporary, must be protected:
UINT8 _InjectSystemID = 2 ; // 0=false, 1=true, other value = default.
2021-03-25 15:32:56 +01:00
public :
2021-09-28 15:54:31 +02:00
XBool NvidiaWeb = false ;
2021-10-27 19:37:54 +02:00
2021-04-28 20:30:34 +02:00
# if __cplusplus > 201703L
2021-09-28 15:54:31 +02:00
XBool operator = = ( const SystemParametersClass & ) const = default ;
2021-04-28 20:30:34 +02:00
# endif
2021-09-28 15:54:31 +02:00
XBool isEqual ( const SystemParametersClass & other ) const
2021-04-11 07:18:52 +02:00
{
if ( ! ( WithKexts = = other . WithKexts ) ) return false ;
if ( ! ( WithKextsIfNoFakeSMC = = other . WithKextsIfNoFakeSMC ) ) return false ;
if ( ! ( NoCaches = = other . NoCaches ) ) return false ;
if ( ! ( BacklightLevel = = other . BacklightLevel ) ) return false ;
if ( ! ( BacklightLevelConfig = = other . BacklightLevelConfig ) ) return false ;
if ( ! ( CustomUuid = = other . CustomUuid ) ) return false ;
if ( ! ( _InjectSystemID = = other . _InjectSystemID ) ) return false ;
if ( ! ( NvidiaWeb = = other . NvidiaWeb ) ) return false ;
return true ;
}
2021-10-27 19:37:54 +02:00
void takeValueFrom ( const ConfigPlistClass : : SystemParameters_Class & other )
2021-04-28 20:30:34 +02:00
{
2021-10-27 19:37:54 +02:00
WithKexts = other . dgetWithKexts ( ) ;
WithKextsIfNoFakeSMC = other . dgetWithKextsIfNoFakeSMC ( ) ;
NoCaches = other . dgetNoCaches ( ) ;
BacklightLevel = other . dgetBacklightLevel ( ) ;
BacklightLevelConfig = other . dgetBacklightLevelConfig ( ) ;
CustomUuid = other . dgetCustomUuid ( ) ;
_InjectSystemID = other . dget_InjectSystemID ( ) ;
NvidiaWeb = other . dgetNvidiaWeb ( ) ;
2021-04-28 20:30:34 +02:00
}
2021-03-27 19:53:30 +01:00
} ;
2021-03-26 10:43:15 +01:00
class GraphicsClass {
public :
class EDIDClass {
public :
2021-09-28 15:54:31 +02:00
XBool InjectEDID = XBool ( ) ;
2021-03-26 10:43:15 +01:00
XBuffer < UINT8 > CustomEDID = XBuffer < UINT8 > ( ) ;
UINT16 VendorEDID = UINT16 ( ) ;
UINT16 ProductEDID = UINT16 ( ) ;
UINT16 EdidFixHorizontalSyncPulseWidth = UINT16 ( ) ;
UINT8 EdidFixVideoInputSignal = UINT8 ( ) ;
2021-04-11 07:18:52 +02:00
2021-04-28 20:30:34 +02:00
# if __cplusplus > 201703L
2021-09-28 15:54:31 +02:00
XBool operator = = ( const EDIDClass & ) const = default ;
2021-04-28 20:30:34 +02:00
# endif
2021-09-28 15:54:31 +02:00
XBool isEqual ( const EDIDClass & other ) const
2021-04-11 07:18:52 +02:00
{
if ( ! ( InjectEDID = = other . InjectEDID ) ) return false ;
if ( ! ( CustomEDID = = other . CustomEDID ) ) return false ;
if ( ! ( VendorEDID = = other . VendorEDID ) ) return false ;
if ( ! ( ProductEDID = = other . ProductEDID ) ) return false ;
if ( ! ( EdidFixHorizontalSyncPulseWidth = = other . EdidFixHorizontalSyncPulseWidth ) ) return false ;
if ( ! ( EdidFixVideoInputSignal = = other . EdidFixVideoInputSignal ) ) return false ;
return true ;
}
2021-10-27 19:37:54 +02:00
void takeValueFrom ( const ConfigPlistClass : : Graphics_Class : : Graphics_EDID_Class & other )
2021-04-28 20:30:34 +02:00
{
2021-10-27 19:37:54 +02:00
InjectEDID = other . dgetInjectEDID ( ) ;
CustomEDID = other . dgetCustomEDID ( ) ;
VendorEDID = other . dgetVendorEDID ( ) ;
ProductEDID = other . dgetProductEDID ( ) ;
EdidFixHorizontalSyncPulseWidth = other . dgetEdidFixHorizontalSyncPulseWidth ( ) ;
EdidFixVideoInputSignal = other . dgetEdidFixVideoInputSignal ( ) ;
2021-04-28 20:30:34 +02:00
}
2021-03-27 19:53:30 +01:00
} ;
2021-03-26 10:43:15 +01:00
class InjectAsDictClass {
public :
2021-09-28 15:54:31 +02:00
XBool GraphicsInjector = XBool ( ) ;
XBool InjectIntel = XBool ( ) ;
XBool InjectATI = XBool ( ) ;
XBool InjectNVidia = XBool ( ) ;
2021-04-11 07:18:52 +02:00
2021-04-28 20:30:34 +02:00
# if __cplusplus > 201703L
2021-09-28 15:54:31 +02:00
XBool operator = = ( const InjectAsDictClass & ) const = default ;
2021-04-28 20:30:34 +02:00
# endif
2021-09-28 15:54:31 +02:00
XBool isEqual ( const InjectAsDictClass & other ) const
2021-04-11 07:18:52 +02:00
{
if ( ! ( GraphicsInjector = = other . GraphicsInjector ) ) return false ;
if ( ! ( InjectIntel = = other . InjectIntel ) ) return false ;
if ( ! ( InjectATI = = other . InjectATI ) ) return false ;
if ( ! ( InjectNVidia = = other . InjectNVidia ) ) return false ;
return true ;
}
2021-10-27 19:37:54 +02:00
void takeValueFrom ( const ConfigPlistClass : : Graphics_Class : : XmlInjectUnion & other )
2021-04-28 20:30:34 +02:00
{
2021-10-27 19:37:54 +02:00
GraphicsInjector = other . dgetGraphicsInjector ( ) ;
InjectIntel = other . dgetInjectIntel ( ) ;
InjectATI = other . dgetInjectATI ( ) ;
InjectNVidia = other . dgetInjectNVidia ( ) ;
2021-04-28 20:30:34 +02:00
}
2021-03-27 19:53:30 +01:00
} ;
class GRAPHIC_CARD {
public :
UINT32 Signature = 0 ;
XString8 Model = XString8 ( ) ;
UINT32 Id = 0 ;
UINT32 SubId = 0 ;
UINT64 VideoRam = 0 ;
UINTN VideoPorts = 0 ;
2021-09-28 15:54:31 +02:00
XBool LoadVBios = false ;
2021-04-11 07:18:52 +02:00
2021-04-28 20:30:34 +02:00
# if __cplusplus > 201703L
2021-09-28 15:54:31 +02:00
XBool operator = = ( const GRAPHIC_CARD & ) const = default ;
2021-04-28 20:30:34 +02:00
# endif
2021-09-28 15:54:31 +02:00
XBool isEqual ( const GRAPHIC_CARD & other ) const
2021-04-11 07:18:52 +02:00
{
if ( ! ( Signature = = other . Signature ) ) return false ;
if ( ! ( Model = = other . Model ) ) return false ;
if ( ! ( Id = = other . Id ) ) return false ;
if ( ! ( SubId = = other . SubId ) ) return false ;
if ( ! ( VideoRam = = other . VideoRam ) ) return false ;
if ( ! ( VideoPorts = = other . VideoPorts ) ) return false ;
if ( ! ( LoadVBios = = other . LoadVBios ) ) return false ;
return true ;
}
2021-10-27 19:37:54 +02:00
void takeValueFrom ( const ConfigPlistClass : : Graphics_Class : : Graphics_ATI_NVIDIA_Class & other )
2021-04-28 20:30:34 +02:00
{
2021-10-27 19:37:54 +02:00
Signature = other . dgetSignature ( ) ;
Model = other . dgetModel ( ) ;
Id = other . dgetId ( ) ;
SubId = other . dgetSubId ( ) ;
VideoRam = other . dgetVideoRam ( ) ;
VideoPorts = other . dgetVideoPorts ( ) ;
LoadVBios = other . dgetLoadVBios ( ) ;
2021-04-28 20:30:34 +02:00
}
2021-03-27 19:53:30 +01:00
} ;
2021-09-28 15:54:31 +02:00
XBool PatchVBios = XBool ( ) ;
2021-03-27 19:53:30 +01:00
PatchVBiosBytesNewClass PatchVBiosBytes = PatchVBiosBytesNewClass ( ) ;
2021-03-28 22:13:43 +02:00
// undefinable_bool InjectAsBool = undefinable_bool();
2021-09-28 15:54:31 +02:00
XBool RadeonDeInit = XBool ( ) ;
XBool LoadVBios = XBool ( ) ;
UINT64 VRAM = XBool ( ) ;
2021-03-26 10:43:15 +01:00
UINT32 RefCLK = UINT32 ( ) ;
XStringW FBName = XStringW ( ) ;
UINT16 VideoPorts = UINT16 ( ) ;
2021-09-28 15:54:31 +02:00
XBool NvidiaGeneric = XBool ( ) ;
XBool NvidiaNoEFI = XBool ( ) ;
XBool NvidiaSingle = XBool ( ) ;
2021-04-11 07:18:52 +02:00
XArray < UINT8 > Dcfg = XArray < UINT8 > ( ) ;
XArray < UINT8 > NVCAP = XArray < UINT8 > ( ) ;
2021-03-26 10:43:15 +01:00
INT8 BootDisplay = INT8 ( ) ;
UINT32 DualLink = UINT32 ( ) ;
2021-04-12 14:11:01 +02:00
UINT32 _IgPlatform = UINT32 ( ) ; //could also be snb-platform-id
2021-03-27 19:53:30 +01:00
EDIDClass EDID = EDIDClass ( ) ;
InjectAsDictClass InjectAsDict = InjectAsDictClass ( ) ;
2021-04-28 20:30:34 +02:00
XObjArrayWithTakeValueFromXmlArray < GRAPHIC_CARD , ConfigPlistClass : : Graphics_Class : : Graphics_ATI_NVIDIA_Class > ATICardList = XObjArrayWithTakeValueFromXmlArray < GRAPHIC_CARD , ConfigPlistClass : : Graphics_Class : : Graphics_ATI_NVIDIA_Class > ( ) ;
XObjArrayWithTakeValueFromXmlArray < GRAPHIC_CARD , ConfigPlistClass : : Graphics_Class : : Graphics_ATI_NVIDIA_Class > NVIDIACardList = XObjArrayWithTakeValueFromXmlArray < GRAPHIC_CARD , ConfigPlistClass : : Graphics_Class : : Graphics_ATI_NVIDIA_Class > ( ) ;
2021-03-26 10:43:15 +01:00
2021-04-11 07:18:52 +02:00
GraphicsClass ( ) {
Dcfg . setSize ( 8 ) ;
memset ( Dcfg . data ( ) , 0 , 8 ) ;
NVCAP . setSize ( 20 ) ;
memset ( NVCAP . data ( ) , 0 , 20 ) ;
}
2021-03-26 10:43:15 +01:00
2021-04-28 20:30:34 +02:00
# if __cplusplus > 201703L
2021-09-28 15:54:31 +02:00
XBool operator = = ( const GraphicsClass & ) const = default ;
2021-04-28 20:30:34 +02:00
# endif
2021-09-28 15:54:31 +02:00
XBool isEqual ( const GraphicsClass & other ) const
2021-04-11 07:18:52 +02:00
{
if ( ! ( PatchVBios = = other . PatchVBios ) ) return false ;
if ( ! PatchVBiosBytes . isEqual ( other . PatchVBiosBytes ) ) return false ;
if ( ! ( RadeonDeInit = = other . RadeonDeInit ) ) return false ;
if ( ! ( LoadVBios = = other . LoadVBios ) ) return false ;
if ( ! ( VRAM = = other . VRAM ) ) return false ;
if ( ! ( RefCLK = = other . RefCLK ) ) return false ;
if ( ! ( FBName = = other . FBName ) ) return false ;
if ( ! ( VideoPorts = = other . VideoPorts ) ) return false ;
if ( ! ( NvidiaGeneric = = other . NvidiaGeneric ) ) return false ;
if ( ! ( NvidiaNoEFI = = other . NvidiaNoEFI ) ) return false ;
if ( ! ( NvidiaSingle = = other . NvidiaSingle ) ) return false ;
if ( ! ( Dcfg = = other . Dcfg ) ) return false ;
if ( ! ( NVCAP = = other . NVCAP ) ) return false ;
if ( ! ( BootDisplay = = other . BootDisplay ) ) return false ;
if ( ! ( DualLink = = other . DualLink ) ) return false ;
2021-04-12 14:11:01 +02:00
if ( ! ( _IgPlatform = = other . _IgPlatform ) ) return false ;
2021-04-11 07:18:52 +02:00
if ( ! EDID . isEqual ( other . EDID ) ) return false ;
if ( ! InjectAsDict . isEqual ( other . InjectAsDict ) ) return false ;
if ( ! ATICardList . isEqual ( other . ATICardList ) ) return false ;
if ( ! NVIDIACardList . isEqual ( other . NVIDIACardList ) ) return false ;
return true ;
}
2021-10-27 19:37:54 +02:00
void takeValueFrom ( const ConfigPlistClass : : Graphics_Class & other )
2021-04-28 20:30:34 +02:00
{
2021-10-27 19:37:54 +02:00
PatchVBios = other . dgetPatchVBios ( ) ;
PatchVBiosBytes . takeValueFrom ( other . PatchVBiosBytesArray ) ;
RadeonDeInit = other . dgetRadeonDeInit ( ) ;
LoadVBios = other . dgetLoadVBios ( ) ;
VRAM = other . dgetVRAM ( ) ;
RefCLK = other . dgetRefCLK ( ) ;
FBName = other . dgetFBName ( ) ;
VideoPorts = other . dgetVideoPorts ( ) ;
NvidiaGeneric = other . dgetNvidiaGeneric ( ) ;
NvidiaNoEFI = other . dgetNvidiaNoEFI ( ) ;
NvidiaSingle = other . dgetNvidiaSingle ( ) ;
Dcfg = other . dgetDcfg ( ) ;
NVCAP = other . dgetNVCAP ( ) ;
BootDisplay = other . dgetBootDisplay ( ) ;
DualLink = other . dgetDualLink ( ) ;
_IgPlatform = other . dget_IgPlatform ( ) ;
EDID . takeValueFrom ( other . EDID ) ;
InjectAsDict . takeValueFrom ( other . Inject ) ;
ATICardList . takeValueFrom ( other . ATI ) ;
NVIDIACardList . takeValueFrom ( other . NVIDIA ) ;
2021-04-28 20:30:34 +02:00
}
2021-04-11 07:18:52 +02:00
2021-09-28 15:54:31 +02:00
//XBool getGraphicsInjector() const { return InjectAsBool.isDefined() ? InjectAsBool.value() : InjectAsDict.GraphicsInjector; }
//XBool InjectIntel() const { return InjectAsBool.isDefined() ? InjectAsBool.value() : InjectAsDict.InjectIntel; }
//XBool InjectATI() const { return InjectAsBool.isDefined() ? InjectAsBool.value() : InjectAsDict.InjectATI; }
//XBool InjectNVidia() const { return InjectAsBool.isDefined() ? InjectAsBool.value() : InjectAsDict.InjectNVidia; }
2021-03-26 10:43:15 +01:00
2021-03-27 19:53:30 +01:00
} ;
2021-03-26 10:43:15 +01:00
class DevicesClass {
public :
class AudioClass {
public :
2021-09-28 15:54:31 +02:00
XBool ResetHDA = XBool ( ) ;
XBool HDAInjection = XBool ( ) ;
2021-03-29 10:50:02 +02:00
INT32 HDALayoutId = INT32 ( ) ;
2021-09-28 15:54:31 +02:00
XBool AFGLowPowerState = XBool ( ) ;
2021-04-11 07:18:52 +02:00
2021-04-28 20:30:34 +02:00
# if __cplusplus > 201703L
2021-09-28 15:54:31 +02:00
XBool operator = = ( const AudioClass & ) const = default ;
2021-04-28 20:30:34 +02:00
# endif
2021-09-28 15:54:31 +02:00
XBool isEqual ( const AudioClass & other ) const
2021-04-11 07:18:52 +02:00
{
if ( ! ( ResetHDA = = other . ResetHDA ) ) return false ;
if ( ! ( HDAInjection = = other . HDAInjection ) ) return false ;
if ( ! ( HDALayoutId = = other . HDALayoutId ) ) return false ;
if ( ! ( AFGLowPowerState = = other . AFGLowPowerState ) ) return false ;
return true ;
}
2021-10-27 19:37:54 +02:00
void takeValueFrom ( const ConfigPlistClass : : DevicesClass : : Devices_Audio_Class & other )
2021-04-28 20:30:34 +02:00
{
2021-10-27 19:37:54 +02:00
ResetHDA = other . dgetResetHDA ( ) ;
HDAInjection = other . dgetHDAInjection ( ) ;
HDALayoutId = other . dgetHDALayoutId ( ) ;
AFGLowPowerState = other . dgetAFGLowPowerState ( ) ;
2021-04-28 20:30:34 +02:00
}
2021-03-29 10:50:02 +02:00
} ;
class USBClass {
public :
2021-09-28 15:54:31 +02:00
XBool USBInjection = XBool ( ) ;
XBool USBFixOwnership = XBool ( ) ;
XBool InjectClockID = XBool ( ) ;
XBool HighCurrent = XBool ( ) ;
XBool NameEH00 = XBool ( ) ;
XBool NameXH00 = XBool ( ) ; // is it used?
2021-04-11 07:18:52 +02:00
2021-04-28 20:30:34 +02:00
# if __cplusplus > 201703L
2021-09-28 15:54:31 +02:00
XBool operator = = ( const USBClass & ) const = default ;
2021-04-28 20:30:34 +02:00
# endif
2021-09-28 15:54:31 +02:00
XBool isEqual ( const USBClass & other ) const
2021-04-11 07:18:52 +02:00
{
if ( ! ( USBInjection = = other . USBInjection ) ) return false ;
if ( ! ( USBFixOwnership = = other . USBFixOwnership ) ) return false ;
if ( ! ( InjectClockID = = other . InjectClockID ) ) return false ;
if ( ! ( HighCurrent = = other . HighCurrent ) ) return false ;
if ( ! ( NameEH00 = = other . NameEH00 ) ) return false ;
if ( ! ( NameXH00 = = other . NameXH00 ) ) return false ;
return true ;
}
2021-10-27 19:37:54 +02:00
void takeValueFrom ( const ConfigPlistClass : : DevicesClass : : Devices_USB_Class & other )
2021-04-28 20:30:34 +02:00
{
2021-10-27 19:37:54 +02:00
USBInjection = other . dgetUSBInjection ( ) ;
USBFixOwnership = other . dgetUSBFixOwnership ( ) ;
InjectClockID = other . dgetInjectClockID ( ) ;
HighCurrent = other . dgetHighCurrent ( ) ;
NameEH00 = other . dgetNameEH00 ( ) ;
//NameXH00 = other.dgetNameXH00();
2021-04-28 20:30:34 +02:00
}
2021-03-29 10:50:02 +02:00
} ;
2021-04-01 10:06:53 +02:00
class AddPropertyClass
{
public :
uint32_t Device = 0 ;
XString8 Key = XString8 ( ) ;
XBuffer < uint8_t > Value = XBuffer < uint8_t > ( ) ;
TAG_TYPE ValueType = kTagTypeNone ;
INPUT_ITEM MenuItem = INPUT_ITEM ( ) ;
2021-04-28 20:30:34 +02:00
// XString8 DevicePathAsString = XString8();
// XString8 Label = XString8();
2021-04-11 07:18:52 +02:00
2021-04-16 11:55:51 +02:00
AddPropertyClass ( ) { }
2021-04-28 20:30:34 +02:00
# if __cplusplus > 201703L
2021-09-28 15:54:31 +02:00
XBool operator = = ( const AddPropertyClass & ) const = default ;
2021-04-28 20:30:34 +02:00
# endif
2021-09-28 15:54:31 +02:00
XBool isEqual ( const AddPropertyClass & other ) const
2021-04-11 07:18:52 +02:00
{
if ( ! ( Device = = other . Device ) ) return false ;
if ( ! ( Key = = other . Key ) ) return false ;
if ( ! ( Value = = other . Value ) ) return false ;
if ( ! ( ValueType = = other . ValueType ) ) return false ;
if ( ! ( MenuItem = = other . MenuItem ) ) return false ;
2021-04-28 20:30:34 +02:00
// if ( !(DevicePathAsString == other.DevicePathAsString) ) return false;
// if ( !(Label == other.Label) ) return false;
2021-04-11 07:18:52 +02:00
return true ;
}
2021-10-27 19:37:54 +02:00
void takeValueFrom ( const ConfigPlistClass : : DevicesClass : : Devices_AddProperties_Dict_Class & other )
2021-04-28 20:30:34 +02:00
{
2021-10-27 19:37:54 +02:00
Device = other . dgetDevice ( ) ;
Key = other . dgetKey ( ) ;
Value = other . dgetValue ( ) ;
ValueType = other . dgetValueType ( ) ;
MenuItem . BValue = ! other . dgetDisabled ( ) ;
// DevicePathAsString = other.dgetDevicePathAsString();
// Label = other.dgetLabel();
2021-04-28 20:30:34 +02:00
}
2021-04-01 10:06:53 +02:00
} ;
// This is shared by PropertiesClass and ArbitraryClass
class SimplePropertyClass
{
public :
XString8 Key = XString8 ( ) ;
XBuffer < uint8_t > Value = XBuffer < uint8_t > ( ) ;
TAG_TYPE ValueType = kTagTypeNone ; // only used in CreateMenuProps()
INPUT_ITEM MenuItem = INPUT_ITEM ( ) ; // Will get the Disabled value
2021-04-11 07:18:52 +02:00
2021-04-16 11:55:51 +02:00
SimplePropertyClass ( ) { }
2021-04-28 20:30:34 +02:00
# if __cplusplus > 201703L
2021-09-28 15:54:31 +02:00
XBool operator = = ( const SimplePropertyClass & ) const = default ;
2021-04-28 20:30:34 +02:00
# endif
2021-09-28 15:54:31 +02:00
XBool isEqual ( const SimplePropertyClass & other ) const
2021-04-11 07:18:52 +02:00
{
if ( ! ( Key = = other . Key ) ) return false ;
if ( ! ( Value = = other . Value ) ) return false ;
if ( ! ( ValueType = = other . ValueType ) ) return false ;
if ( ! ( MenuItem = = other . MenuItem ) ) return false ;
return true ;
}
2021-10-27 19:37:54 +02:00
void takeValueFrom ( const ConfigPlistClass : : DevicesClass : : SimplePropertyClass_Class & other )
2021-04-28 20:30:34 +02:00
{
2021-10-27 19:37:54 +02:00
Key = other . dgetKey ( ) ;
Value = other . dgetValue ( ) ;
ValueType = other . dgetValueType ( ) ;
MenuItem . BValue = ! other . dgetDisabled ( ) ;
2021-04-28 20:30:34 +02:00
}
2021-10-27 19:37:54 +02:00
void takeValueFrom ( const ConfigPlistClass : : DevicesClass : : PropertiesUnion : : Property & other )
2021-04-28 20:30:34 +02:00
{
2021-10-27 19:37:54 +02:00
Key = other . dgetKey ( ) ;
Value = other . dgetValue ( ) ;
ValueType = other . dgetValueType ( ) ;
MenuItem . BValue = other . dgetBValue ( ) ;
2021-04-28 20:30:34 +02:00
}
2021-04-01 10:06:53 +02:00
} ;
// Property don't have Device. Before it was always Device = 0 to differentiate from Arbitrary properties.
2021-03-29 10:50:02 +02:00
class PropertiesClass {
public :
2021-04-01 10:06:53 +02:00
class PropertyClass
{
public :
2021-09-28 15:54:31 +02:00
XBool Enabled = true ;
2021-04-01 10:06:53 +02:00
XStringW DevicePathAsString = XStringW ( ) ;
// XString8 Label = XString8(); // Label is the same as DevicePathAsString, so it's not needed.
2021-04-28 20:30:34 +02:00
XObjArrayWithTakeValueFromXmlRepeatingDict < SimplePropertyClass , ConfigPlistClass : : DevicesClass : : PropertiesUnion : : Property > propertiesArray = XObjArrayWithTakeValueFromXmlRepeatingDict < SimplePropertyClass , ConfigPlistClass : : DevicesClass : : PropertiesUnion : : Property > ( ) ;
2021-04-01 10:06:53 +02:00
2021-04-16 11:55:51 +02:00
PropertyClass ( ) { }
2021-04-28 20:30:34 +02:00
# if !defined(DONT_DEFINE_GLOBALS)
2021-04-01 10:06:53 +02:00
EFI_DEVICE_PATH_PROTOCOL * getDevicePath ( ) const
{
EFI_DEVICE_PATH_PROTOCOL * DevicePath ;
2021-04-28 20:30:34 +02:00
if ( DevicePathAsString . isEqualIC ( " PrimaryGPU " ) & & gConf . GfxPropertiesArray . size ( ) > 0 ) {
DevicePath = DevicePathFromHandle ( gConf . GfxPropertiesArray [ 0 ] . Handle ) ; // first gpu
} else if ( DevicePathAsString . isEqualIC ( " SecondaryGPU " ) & & gConf . GfxPropertiesArray . size ( ) > 1 ) {
DevicePath = DevicePathFromHandle ( gConf . GfxPropertiesArray [ 1 ] . Handle ) ; // second gpu
2021-04-01 10:06:53 +02:00
} else {
DevicePath = ConvertTextToDevicePath ( DevicePathAsString . wc_str ( ) ) ; //TODO
}
return DevicePath ;
}
2021-04-28 20:30:34 +02:00
# endif
# if __cplusplus > 201703L
2021-09-28 15:54:31 +02:00
XBool operator = = ( const PropertyClass & ) const = default ;
2021-04-28 20:30:34 +02:00
# endif
2021-09-28 15:54:31 +02:00
XBool isEqual ( const PropertyClass & other ) const
2021-04-11 07:18:52 +02:00
{
if ( ! ( Enabled = = other . Enabled ) ) return false ;
if ( ! ( DevicePathAsString = = other . DevicePathAsString ) ) return false ;
// if ( !(Label == other.Label) ) return false;
if ( ! propertiesArray . isEqual ( other . propertiesArray ) ) return false ;
return true ;
}
2021-10-27 19:37:54 +02:00
void takeValueFrom ( const ConfigPlistClass : : DevicesClass : : PropertiesUnion : : Properties4DeviceClass & other )
2021-04-28 20:30:34 +02:00
{
2021-10-27 19:37:54 +02:00
Enabled = other . dgetEnabled ( ) ;
DevicePathAsString = other . dgetDevicePathAsString ( ) ;
// Label = other.dgetLabel();
propertiesArray . takeValueFrom ( other ) ;
2021-04-28 20:30:34 +02:00
}
2021-04-01 10:06:53 +02:00
} ;
XString8 propertiesAsString = XString8 ( ) ;
2021-04-28 20:30:34 +02:00
XObjArrayWithTakeValueFromXmlRepeatingDict < PropertyClass , ConfigPlistClass : : DevicesClass : : PropertiesUnion : : Properties4DeviceClass > PropertyArray = XObjArrayWithTakeValueFromXmlRepeatingDict < PropertyClass , ConfigPlistClass : : DevicesClass : : PropertiesUnion : : Properties4DeviceClass > ( ) ;
2021-04-11 07:18:52 +02:00
2021-04-28 20:30:34 +02:00
# if __cplusplus > 201703L
2021-09-28 15:54:31 +02:00
XBool operator = = ( const PropertiesClass & ) const = default ;
2021-04-28 20:30:34 +02:00
# endif
2021-09-28 15:54:31 +02:00
XBool isEqual ( const PropertiesClass & other ) const
2021-04-11 07:18:52 +02:00
{
if ( ! ( propertiesAsString = = other . propertiesAsString ) ) return false ;
if ( ! PropertyArray . isEqual ( other . PropertyArray ) ) return false ;
return true ;
}
2021-10-27 19:37:54 +02:00
void takeValueFrom ( const ConfigPlistClass : : DevicesClass : : PropertiesUnion & other )
2021-04-28 20:30:34 +02:00
{
2021-10-27 19:37:54 +02:00
propertiesAsString = other . dgetpropertiesAsString ( ) ;
PropertyArray . takeValueFrom ( other . PropertiesAsDict ) ;
2021-04-28 20:30:34 +02:00
}
2021-04-01 10:06:53 +02:00
} ;
class ArbitraryPropertyClass {
public :
uint32_t Device = 0 ;
XString8 Label = XString8 ( ) ;
2021-04-28 20:30:34 +02:00
XObjArrayWithTakeValueFromXmlArray < SimplePropertyClass , ConfigPlistClass : : DevicesClass : : SimplePropertyClass_Class > CustomPropertyArray = XObjArrayWithTakeValueFromXmlArray < SimplePropertyClass , ConfigPlistClass : : DevicesClass : : SimplePropertyClass_Class > ( ) ;
2021-04-11 07:18:52 +02:00
2021-04-16 11:55:51 +02:00
ArbitraryPropertyClass ( ) { }
2021-04-28 20:30:34 +02:00
# if __cplusplus > 201703L
2021-09-28 15:54:31 +02:00
XBool operator = = ( const ArbitraryPropertyClass & ) const = default ;
2021-04-28 20:30:34 +02:00
# endif
2021-09-28 15:54:31 +02:00
XBool isEqual ( const ArbitraryPropertyClass & other ) const
2021-04-11 07:18:52 +02:00
{
if ( ! ( Device = = other . Device ) ) return false ;
if ( ! ( Label = = other . Label ) ) return false ;
if ( ! CustomPropertyArray . isEqual ( other . CustomPropertyArray ) ) return false ;
return true ;
}
2021-10-27 19:37:54 +02:00
void takeValueFrom ( const ConfigPlistClass : : DevicesClass : : Devices_Arbitrary_Class & other )
2021-04-28 20:30:34 +02:00
{
2021-10-27 19:37:54 +02:00
Device = other . dgetDevice ( ) ;
Label = other . dgetLabel ( ) ;
CustomPropertyArray . takeValueFrom ( other . CustomProperties ) ;
2021-04-28 20:30:34 +02:00
}
2021-03-29 10:50:02 +02:00
} ;
class FakeIDClass {
public :
//PCI devices
UINT32 FakeATI = UINT32 ( ) ; //97
UINT32 FakeNVidia = UINT32 ( ) ;
UINT32 FakeIntel = UINT32 ( ) ;
UINT32 FakeLAN = UINT32 ( ) ; //100
UINT32 FakeWIFI = UINT32 ( ) ;
UINT32 FakeSATA = UINT32 ( ) ;
UINT32 FakeXHCI = UINT32 ( ) ; //103
UINT32 FakeIMEI = UINT32 ( ) ; //106
2021-04-11 07:18:52 +02:00
2021-04-28 20:30:34 +02:00
# if __cplusplus > 201703L
2021-09-28 15:54:31 +02:00
XBool operator = = ( const FakeIDClass & ) const = default ;
2021-04-28 20:30:34 +02:00
# endif
2021-09-28 15:54:31 +02:00
XBool isEqual ( const FakeIDClass & other ) const
2021-04-11 07:18:52 +02:00
{
if ( ! ( FakeATI = = other . FakeATI ) ) return false ;
if ( ! ( FakeNVidia = = other . FakeNVidia ) ) return false ;
if ( ! ( FakeIntel = = other . FakeIntel ) ) return false ;
if ( ! ( FakeLAN = = other . FakeLAN ) ) return false ;
if ( ! ( FakeWIFI = = other . FakeWIFI ) ) return false ;
if ( ! ( FakeSATA = = other . FakeSATA ) ) return false ;
if ( ! ( FakeXHCI = = other . FakeXHCI ) ) return false ;
if ( ! ( FakeIMEI = = other . FakeIMEI ) ) return false ;
return true ;
}
2021-10-27 19:37:54 +02:00
void takeValueFrom ( const ConfigPlistClass : : DevicesClass : : Devices_FakeID_Class & other )
2021-04-28 20:30:34 +02:00
{
2021-10-27 19:37:54 +02:00
FakeATI = other . dgetFakeATI ( ) ;
FakeNVidia = other . dgetFakeNVidia ( ) ;
FakeIntel = other . dgetFakeIntel ( ) ;
FakeLAN = other . dgetFakeLAN ( ) ;
FakeWIFI = other . dgetFakeWIFI ( ) ;
FakeSATA = other . dgetFakeSATA ( ) ;
FakeXHCI = other . dgetFakeXHCI ( ) ;
FakeIMEI = other . dgetFakeIMEI ( ) ;
2021-04-28 20:30:34 +02:00
}
2021-03-29 10:50:02 +02:00
} ;
2021-09-28 15:54:31 +02:00
XBool StringInjector = XBool ( ) ;
XBool IntelMaxBacklight = XBool ( ) ;
XBool IntelBacklight = XBool ( ) ;
2021-03-29 10:50:02 +02:00
UINT32 IntelMaxValue = UINT32 ( ) ;
2021-09-28 15:54:31 +02:00
XBool LANInjection = XBool ( ) ;
XBool HDMIInjection = XBool ( ) ;
XBool NoDefaultProperties = XBool ( ) ;
XBool UseIntelHDMI = XBool ( ) ;
XBool ForceHPET = XBool ( ) ;
2021-03-29 10:50:02 +02:00
UINT32 DisableFunctions = UINT32 ( ) ;
XString8 AirportBridgeDeviceName = XString8 ( ) ;
AudioClass Audio = AudioClass ( ) ;
USBClass USB = USBClass ( ) ;
FakeIDClass FakeID = FakeIDClass ( ) ;
2021-04-28 20:30:34 +02:00
XObjArrayWithTakeValueFromXmlArray < AddPropertyClass , ConfigPlistClass : : DevicesClass : : Devices_AddProperties_Dict_Class > AddPropertyArray = XObjArrayWithTakeValueFromXmlArray < AddPropertyClass , ConfigPlistClass : : DevicesClass : : Devices_AddProperties_Dict_Class > ( ) ;
2021-04-01 10:06:53 +02:00
PropertiesClass Properties = PropertiesClass ( ) ;
2021-04-28 20:30:34 +02:00
XObjArrayWithTakeValueFromXmlArray < ArbitraryPropertyClass , ConfigPlistClass : : DevicesClass : : Devices_Arbitrary_Class > ArbitraryArray = XObjArrayWithTakeValueFromXmlArray < ArbitraryPropertyClass , ConfigPlistClass : : DevicesClass : : Devices_Arbitrary_Class > ( ) ;
2021-03-26 10:43:15 +01:00
2021-04-11 07:18:52 +02:00
2021-04-28 20:30:34 +02:00
# if __cplusplus > 201703L
2021-10-27 19:37:54 +02:00
XBool operator = = ( const DevicesClass & ) const = default ;
2021-04-28 20:30:34 +02:00
# endif
2021-09-28 15:54:31 +02:00
XBool isEqual ( const DevicesClass & other ) const
2021-04-11 07:18:52 +02:00
{
if ( ! ( StringInjector = = other . StringInjector ) ) return false ;
if ( ! ( IntelMaxBacklight = = other . IntelMaxBacklight ) ) return false ;
if ( ! ( IntelBacklight = = other . IntelBacklight ) ) return false ;
if ( ! ( IntelMaxValue = = other . IntelMaxValue ) ) return false ;
if ( ! ( LANInjection = = other . LANInjection ) ) return false ;
if ( ! ( HDMIInjection = = other . HDMIInjection ) ) return false ;
if ( ! ( NoDefaultProperties = = other . NoDefaultProperties ) ) return false ;
if ( ! ( UseIntelHDMI = = other . UseIntelHDMI ) ) return false ;
if ( ! ( ForceHPET = = other . ForceHPET ) ) return false ;
if ( ! ( DisableFunctions = = other . DisableFunctions ) ) return false ;
if ( ! ( AirportBridgeDeviceName = = other . AirportBridgeDeviceName ) ) return false ;
if ( ! Audio . isEqual ( other . Audio ) ) return false ;
if ( ! USB . isEqual ( other . USB ) ) return false ;
if ( ! FakeID . isEqual ( other . FakeID ) ) return false ;
if ( ! AddPropertyArray . isEqual ( other . AddPropertyArray ) ) return false ;
if ( ! Properties . isEqual ( other . Properties ) ) return false ;
if ( ! ArbitraryArray . isEqual ( other . ArbitraryArray ) ) return false ;
return true ;
}
2021-10-27 19:37:54 +02:00
void takeValueFrom ( const ConfigPlistClass : : DevicesClass & other )
2021-04-28 20:30:34 +02:00
{
2021-10-27 19:37:54 +02:00
StringInjector = other . dgetStringInjector ( ) ;
IntelMaxBacklight = other . dgetIntelMaxBacklight ( ) ;
IntelBacklight = other . dgetIntelBacklight ( ) ;
IntelMaxValue = other . dgetIntelMaxValue ( ) ;
LANInjection = other . dgetLANInjection ( ) ;
HDMIInjection = other . dgetHDMIInjection ( ) ;
NoDefaultProperties = other . dgetNoDefaultProperties ( ) ;
UseIntelHDMI = other . dgetUseIntelHDMI ( ) ;
ForceHPET = other . dgetForceHPET ( ) ;
DisableFunctions = other . dgetDisableFunctions ( ) ;
AirportBridgeDeviceName = other . dgetAirportBridgeDeviceName ( ) ;
Audio . takeValueFrom ( other . Audio ) ;
USB . takeValueFrom ( other . USB ) ;
FakeID . takeValueFrom ( other . FakeID ) ;
AddPropertyArray . takeValueFrom ( other . AddProperties ) ;
Properties . takeValueFrom ( other . Properties ) ;
ArbitraryArray . takeValueFrom ( other . Arbitrary ) ;
2021-04-28 20:30:34 +02:00
}
2021-04-01 10:06:53 +02:00
// 2021-04 : Following is temporary to compare with old way of storing properties.
// Let's keep it few months until I am sure the refactoring isomorphic
private :
DEV_PROPERTY * ArbProperties = 0 ; // the old version.
public :
void FillDevicePropertiesOld ( SETTINGS_DATA & gSettings , const TagDict * DevicesDict ) ;
2021-09-28 15:54:31 +02:00
XBool compareDevProperty ( const XString8 & label , const DEV_PROPERTY & oldProp , const DEV_PROPERTY & newProp ) const
2021-04-01 10:06:53 +02:00
{
2021-04-05 14:00:17 +02:00
if ( newProp . Device ! = oldProp . Device )
2021-04-01 10:06:53 +02:00
{
2021-04-05 14:00:17 +02:00
printf ( " %s.Device != \n " , label . c_str ( ) ) ;
2021-04-01 10:06:53 +02:00
return false ;
}
2021-04-05 14:00:17 +02:00
if ( newProp . Key | | oldProp . Key ) {
if ( ! newProp . Key | | ! oldProp . Key ) {
printf ( " %s.Key != \n " , label . c_str ( ) ) ;
2021-04-01 10:06:53 +02:00
return false ;
}
# ifdef JIEF_DEBUG
2021-04-05 14:00:17 +02:00
if ( strcmp ( oldProp . Key , " 10 " ) = = 0 ) {
2021-04-01 10:06:53 +02:00
printf ( " %s " , " " ) ;
}
# endif
2021-04-05 14:00:17 +02:00
if ( strcmp ( newProp . Key , oldProp . Key ) ! = 0 )
2021-04-01 10:06:53 +02:00
{
2021-04-05 14:00:17 +02:00
printf ( " %s.Key != \n " , label . c_str ( ) ) ;
2021-04-01 10:06:53 +02:00
return false ;
}
}
2021-04-05 14:00:17 +02:00
if ( newProp . ValueLen ! = oldProp . ValueLen )
2021-04-01 10:06:53 +02:00
{
2021-04-05 14:00:17 +02:00
printf ( " %s.Value.ValueLen %lld != %lld \n " , label . c_str ( ) , oldProp . ValueLen , newProp . ValueLen ) ;
2021-04-01 10:06:53 +02:00
return false ;
} else
{
2021-04-05 14:00:17 +02:00
if ( newProp . ValueLen > 0 ) {
if ( memcmp ( newProp . Value , oldProp . Value , oldProp . ValueLen ) ! = 0 )
2021-04-01 10:06:53 +02:00
{
2021-04-05 14:00:17 +02:00
printf ( " %s.Value != \n " , label . c_str ( ) ) ;
2021-04-01 10:06:53 +02:00
return false ;
}
}
}
2021-04-05 14:00:17 +02:00
if ( newProp . ValueType ! = oldProp . ValueType )
2021-04-01 10:06:53 +02:00
{
2021-04-05 14:00:17 +02:00
printf ( " %s.ValueType != \n " , label . c_str ( ) ) ;
2021-04-01 10:06:53 +02:00
return false ;
}
2021-04-05 14:00:17 +02:00
if ( newProp . Label | | oldProp . Label ) {
if ( ! newProp . Label | | ! oldProp . Label ) {
printf ( " %s.Label != \n " , label . c_str ( ) ) ;
2021-04-01 10:06:53 +02:00
return false ;
}
2021-04-05 14:00:17 +02:00
if ( strcmp ( newProp . Label , oldProp . Label ) ! = 0 )
2021-04-01 10:06:53 +02:00
{
2021-04-05 14:00:17 +02:00
printf ( " %s.Label != : old:%s new:%s \n " , label . c_str ( ) , oldProp . Label , newProp . Label ) ;
2021-04-01 10:06:53 +02:00
return false ;
}
}
2021-04-05 14:00:17 +02:00
if ( newProp . MenuItem . BValue ! = oldProp . MenuItem . BValue )
2021-04-01 10:06:53 +02:00
{
2021-04-05 14:00:17 +02:00
printf ( " %s.MenuItem.BValue != \n " , label . c_str ( ) ) ;
2021-04-01 10:06:53 +02:00
return false ;
}
2021-04-05 14:00:17 +02:00
DEV_PROPERTY * oldChild = oldProp . Child ;
DEV_PROPERTY * newChild = newProp . Child ;
2021-04-01 10:06:53 +02:00
size_t jdx = 0 ;
while ( oldChild & & newChild )
{
compareDevProperty ( S8Printf ( " %s.child[%zu] " , label . c_str ( ) , jdx ) , * oldChild , * newChild ) ;
oldChild = oldChild - > Next ;
newChild = newChild - > Next ;
jdx + + ;
}
if ( oldChild ! = newChild )
{
printf ( " %s.Child count \n " , label . c_str ( ) ) ;
return false ;
}
return true ;
}
2021-09-28 15:54:31 +02:00
XBool compareOldAndCompatibleArb ( )
2021-04-01 10:06:53 +02:00
{
2021-04-03 16:42:49 +02:00
// {
// size_t oldArbIdx = 0;
// const DEV_PROPERTY* arb = ArbProperties;
// while ( arb ) {
// printf("ArbProperties[%zu].Key = %s\n", oldArbIdx++, arb->Key);
// arb = arb->Next;
// }
// }
2021-04-01 10:06:53 +02:00
const XObjArray < DEV_PROPERTY > compatibleArbProperties = getCompatibleArbProperty ( ) ;
size_t oldArbIdx = 0 ;
for ( size_t idx = 0 ; idx < compatibleArbProperties . size ( ) ; + + idx )
{
if ( ArbProperties = = NULL ) {
printf ( " ArbProperties.size < compatibleArbProperties.size() " ) ;
return false ;
}
if ( ! compareDevProperty ( S8Printf ( " ArbProperties[%zu] " , idx ) , * ArbProperties , compatibleArbProperties [ idx ] ) ) {
return false ;
}
+ + oldArbIdx ;
ArbProperties = ArbProperties - > Next ;
}
if ( ArbProperties ! = NULL ) {
printf ( " ArbProperties.size > compatibleArbProperties.size() " ) ;
return false ;
}
return true ;
}
public :
XObjArray < DEV_PROPERTY > getCompatibleArbProperty ( ) const
{
XObjArray < DEV_PROPERTY > arb ;
for ( size_t idx = ArbitraryArray . size ( ) ; idx - - > 0 ; ) {
const ArbitraryPropertyClass & newArb = ArbitraryArray [ idx ] ;
for ( size_t jdx = newArb . CustomPropertyArray . size ( ) ; jdx - - > 0 ; ) {
const SimplePropertyClass & newArbProp = newArb . CustomPropertyArray [ jdx ] ;
2021-05-05 19:10:10 +02:00
DEV_PROPERTY * newProp = new DEV_PROPERTY ;
2021-04-01 10:06:53 +02:00
newProp - > Device = newArb . Device ;
newProp - > Key = const_cast < char * > ( newArbProp . Key . c_str ( ) ) ; // const_cast !!! So ugly. It is just because it's temporary. If ArbProperties is modified after this, a lot a memory problem will happen. I could have done some strdup, but that way I don't use memory and don't have to free it.
newProp - > Value = const_cast < unsigned char * > ( newArbProp . Value . data ( ) ) ;
newProp - > ValueLen = newArbProp . Value . size ( ) ;
newProp - > ValueType = newArbProp . ValueType ;
newProp - > MenuItem . BValue = newArbProp . MenuItem . BValue ;
newProp - > Label = const_cast < char * > ( newArb . Label . c_str ( ) ) ;
arb . AddReference ( newProp , true ) ;
// printf("Add prop key=%s label=%s at index %zu\n", newProp->Key.c_str(), newProp->Label.c_str(), arb.size()-1);
}
}
// Non arb : device = 0
for ( size_t idx = Properties . PropertyArray . size ( ) ; idx - - > 0 ; ) {
const PropertiesClass : : PropertyClass & Prop = Properties . PropertyArray [ idx ] ;
2021-05-05 19:10:10 +02:00
DEV_PROPERTY * newProp = new DEV_PROPERTY ;
2021-04-01 10:06:53 +02:00
newProp - > Device = 0 ;
newProp - > Key = 0 ;
if ( Prop . Enabled ) newProp - > Label = XString8 ( Prop . DevicePathAsString ) . forgetDataWithoutFreeing ( ) ;
else newProp - > Label = S8Printf ( " !%ls " , Prop . DevicePathAsString . wc_str ( ) ) . forgetDataWithoutFreeing ( ) ;
newProp - > Child = NULL ;
for ( size_t jdx = Properties . PropertyArray [ idx ] . propertiesArray . size ( ) ; jdx - - > 0 ; ) {
const SimplePropertyClass & SubProp = Prop . propertiesArray [ jdx ] ;
2021-05-05 19:10:10 +02:00
DEV_PROPERTY * newSubProp = new DEV_PROPERTY ;
2021-04-01 10:06:53 +02:00
newSubProp - > Device = 0 ;
newSubProp - > Key = const_cast < char * > ( SubProp . Key . c_str ( ) ) ;
2021-04-05 14:00:17 +02:00
// newSubProp->Key = NULL;
2021-04-01 10:06:53 +02:00
newSubProp - > Value = const_cast < unsigned char * > ( SubProp . Value . data ( ) ) ;
newSubProp - > ValueLen = SubProp . Value . size ( ) ;
newSubProp - > ValueType = SubProp . ValueType ;
2021-04-05 14:00:17 +02:00
newSubProp - > MenuItem . BValue = true ;
2021-04-01 10:06:53 +02:00
if ( newProp - > Child ) {
DEV_PROPERTY * childs ;
for ( childs = newProp - > Child ; childs - > Next ; childs = childs - > Next ) ;
childs - > Next = newSubProp ;
} else {
newProp - > Child = newSubProp ;
}
}
arb . AddReference ( newProp , true ) ;
2021-04-05 14:00:17 +02:00
// MsgLog("Add prop %s at index %zu\n", newProp->Label, arb.size()-1);
2021-04-01 10:06:53 +02:00
}
return arb ;
} ;
2021-03-27 19:53:30 +01:00
} ;
2021-03-26 10:43:15 +01:00
2021-03-25 15:32:56 +01:00
class QuirksClass {
public :
2021-03-28 22:13:43 +02:00
class MMIOWhiteList
{
public :
UINTN address = 0 ;
XString8 comment = XString8 ( ) ;
2021-09-28 15:54:31 +02:00
XBool enabled = false ;
2021-04-11 07:18:52 +02:00
2021-10-27 19:37:54 +02:00
# if __cplusplus > 201703L
2021-09-28 15:54:31 +02:00
XBool operator = = ( const MMIOWhiteList & ) const = default ;
2021-10-27 19:37:54 +02:00
# endif
2021-09-28 15:54:31 +02:00
XBool isEqual ( const MMIOWhiteList & other ) const
2021-04-11 07:18:52 +02:00
{
if ( ! ( address = = other . address ) ) return false ;
if ( ! ( comment = = other . comment ) ) return false ;
if ( ! ( enabled = = other . enabled ) ) return false ;
return true ;
}
2021-10-27 19:37:54 +02:00
void takeValueFrom ( const ConfigPlistClass : : Quirks_Class : : Quirks_MmioWhitelist_Class & other )
2021-04-28 20:30:34 +02:00
{
2021-10-27 19:37:54 +02:00
address = other . dgetaddress ( ) ;
comment = other . dgetcomment ( ) ;
enabled = other . dgetenabled ( ) ;
2021-04-28 20:30:34 +02:00
}
2021-04-11 07:18:52 +02:00
} ;
class OcKernelQuirksClass
{
public :
2021-09-28 15:54:31 +02:00
// XBool AppleCpuPmCfgLock = false;
// XBool AppleXcpmCfgLock = false;
XBool AppleXcpmExtraMsrs = false ;
XBool AppleXcpmForceBoost = false ;
// XBool CustomSmbiosGuid = false;
XBool DisableIoMapper = false ;
XBool DisableLinkeditJettison = false ;
// XBool DisableRtcChecksum = false;
XBool DummyPowerManagement = false ;
XBool ExtendBTFeatureFlags = false ;
XBool ExternalDiskIcons = false ;
XBool IncreasePciBarSize = false ;
// XBool LapicKernelPanic = false;
// XBool PanicNoKextDump = false;
XBool PowerTimeoutKernelPanic = false ;
XBool ThirdPartyDrives = false ;
XBool XhciPortLimit = false ;
2021-04-11 07:18:52 +02:00
2021-04-28 20:30:34 +02:00
# if __cplusplus > 201703L
2021-09-28 15:54:31 +02:00
XBool operator = = ( const OcKernelQuirksClass & ) const = default ;
2021-04-28 20:30:34 +02:00
# endif
2021-09-28 15:54:31 +02:00
XBool isEqual ( const OcKernelQuirksClass & other ) const
2021-04-28 20:30:34 +02:00
{
if ( ! ( AppleXcpmExtraMsrs = = other . AppleXcpmExtraMsrs ) ) return false ;
if ( ! ( AppleXcpmForceBoost = = other . AppleXcpmForceBoost ) ) return false ;
if ( ! ( DisableIoMapper = = other . DisableIoMapper ) ) return false ;
if ( ! ( DisableLinkeditJettison = = other . DisableLinkeditJettison ) ) return false ;
if ( ! ( DummyPowerManagement = = other . DummyPowerManagement ) ) return false ;
2021-09-25 10:51:37 +02:00
if ( ! ( ExtendBTFeatureFlags = = other . ExtendBTFeatureFlags ) ) return false ;
2021-04-28 20:30:34 +02:00
if ( ! ( ExternalDiskIcons = = other . ExternalDiskIcons ) ) return false ;
if ( ! ( IncreasePciBarSize = = other . IncreasePciBarSize ) ) return false ;
if ( ! ( PowerTimeoutKernelPanic = = other . PowerTimeoutKernelPanic ) ) return false ;
if ( ! ( ThirdPartyDrives = = other . ThirdPartyDrives ) ) return false ;
if ( ! ( XhciPortLimit = = other . XhciPortLimit ) ) return false ;
return true ;
}
2021-10-27 19:37:54 +02:00
void takeValueFrom ( const ConfigPlistClass : : Quirks_Class : : OcKernelQuirks_Class & other )
2021-04-28 20:30:34 +02:00
{
2021-10-27 19:37:54 +02:00
AppleXcpmExtraMsrs = other . dgetAppleXcpmExtraMsrs ( ) ;
AppleXcpmForceBoost = other . dgetAppleXcpmForceBoost ( ) ;
DisableIoMapper = other . dgetDisableIoMapper ( ) ;
DisableLinkeditJettison = other . dgetDisableLinkeditJettison ( ) ;
DummyPowerManagement = other . dgetDummyPowerManagement ( ) ;
ExtendBTFeatureFlags = other . dgetExtendBTFeatureFlags ( ) ;
ExternalDiskIcons = other . dgetExternalDiskIcons ( ) ;
IncreasePciBarSize = other . dgetIncreasePciBarSize ( ) ;
PowerTimeoutKernelPanic = other . dgetPowerTimeoutKernelPanic ( ) ;
ThirdPartyDrives = other . dgetThirdPartyDrives ( ) ;
XhciPortLimit = other . dgetXhciPortLimit ( ) ;
2021-04-28 20:30:34 +02:00
}
2021-03-28 22:13:43 +02:00
} ;
2021-04-11 07:18:52 +02:00
class OcBooterQuirksClass
{
public :
2021-09-28 15:54:31 +02:00
XBool AvoidRuntimeDefrag = false ;
XBool DevirtualiseMmio = false ;
XBool DisableSingleUser = false ;
XBool DisableVariableWrite = false ;
XBool DiscardHibernateMap = false ;
XBool EnableSafeModeSlide = false ;
XBool EnableWriteUnprotector = false ;
XBool ForceExitBootServices = false ;
XBool ProtectMemoryRegions = false ;
XBool ProtectSecureBoot = false ;
XBool ProtectUefiServices = false ;
XBool ProvideCustomSlide = false ;
2021-04-11 07:18:52 +02:00
uint8_t ProvideMaxSlide = false ;
2021-09-28 15:54:31 +02:00
XBool RebuildAppleMemoryMap = false ;
XBool SetupVirtualMap = false ;
XBool SignalAppleOS = false ;
XBool SyncRuntimePermissions = false ;
2021-04-11 07:18:52 +02:00
2021-04-28 20:30:34 +02:00
# if __cplusplus > 201703L
2021-09-28 15:54:31 +02:00
XBool operator = = ( const OcBooterQuirksClass & ) const = default ;
2021-04-28 20:30:34 +02:00
# endif
2021-09-28 15:54:31 +02:00
XBool isEqual ( const OcBooterQuirksClass & other ) const
2021-04-11 07:18:52 +02:00
{
if ( ! ( AvoidRuntimeDefrag = = other . AvoidRuntimeDefrag ) ) return false ;
if ( ! ( DevirtualiseMmio = = other . DevirtualiseMmio ) ) return false ;
if ( ! ( DisableSingleUser = = other . DisableSingleUser ) ) return false ;
if ( ! ( DisableVariableWrite = = other . DisableVariableWrite ) ) return false ;
if ( ! ( DiscardHibernateMap = = other . DiscardHibernateMap ) ) return false ;
if ( ! ( EnableSafeModeSlide = = other . EnableSafeModeSlide ) ) return false ;
if ( ! ( EnableWriteUnprotector = = other . EnableWriteUnprotector ) ) return false ;
if ( ! ( ForceExitBootServices = = other . ForceExitBootServices ) ) return false ;
if ( ! ( ProtectSecureBoot = = other . ProtectSecureBoot ) ) return false ;
if ( ! ( ProtectUefiServices = = other . ProtectUefiServices ) ) return false ;
if ( ! ( ProtectUefiServices = = other . ProtectUefiServices ) ) return false ;
if ( ! ( ProvideCustomSlide = = other . ProvideCustomSlide ) ) return false ;
if ( ! ( ProvideMaxSlide = = other . ProvideMaxSlide ) ) return false ;
if ( ! ( RebuildAppleMemoryMap = = other . RebuildAppleMemoryMap ) ) return false ;
if ( ! ( SetupVirtualMap = = other . SetupVirtualMap ) ) return false ;
if ( ! ( SignalAppleOS = = other . SignalAppleOS ) ) return false ;
if ( ! ( SyncRuntimePermissions = = other . SyncRuntimePermissions ) ) return false ;
return true ;
}
2021-10-27 19:37:54 +02:00
void takeValueFrom ( const ConfigPlistClass : : Quirks_Class : : OcBooterQuirks_Class & other )
2021-04-28 20:30:34 +02:00
{
2021-10-27 19:37:54 +02:00
AvoidRuntimeDefrag = other . dgetAvoidRuntimeDefrag ( ) ;
DevirtualiseMmio = other . dgetDevirtualiseMmio ( ) ;
DisableSingleUser = other . dgetDisableSingleUser ( ) ;
DisableVariableWrite = other . dgetDisableVariableWrite ( ) ;
DiscardHibernateMap = other . dgetDiscardHibernateMap ( ) ;
EnableSafeModeSlide = other . dgetEnableSafeModeSlide ( ) ;
EnableWriteUnprotector = other . dgetEnableWriteUnprotector ( ) ;
ForceExitBootServices = other . dgetForceExitBootServices ( ) ;
ProtectSecureBoot = other . dgetProtectSecureBoot ( ) ;
ProtectUefiServices = other . dgetProtectUefiServices ( ) ;
ProtectUefiServices = other . dgetProtectUefiServices ( ) ;
ProvideCustomSlide = other . dgetProvideCustomSlide ( ) ;
ProvideMaxSlide = other . dgetProvideMaxSlide ( ) ;
RebuildAppleMemoryMap = other . dgetRebuildAppleMemoryMap ( ) ;
SetupVirtualMap = other . dgetSetupVirtualMap ( ) ;
SignalAppleOS = other . dgetSignalAppleOS ( ) ;
SyncRuntimePermissions = other . dgetSyncRuntimePermissions ( ) ;
2021-04-28 20:30:34 +02:00
}
2021-04-11 07:18:52 +02:00
} ;
2021-09-28 15:54:31 +02:00
XBool FuzzyMatch = XBool ( ) ;
2021-03-29 10:50:02 +02:00
XString8 OcKernelCache = XString8 ( ) ;
2021-03-28 22:13:43 +02:00
// UINTN MaxSlide;
2021-04-11 07:18:52 +02:00
OcKernelQuirksClass OcKernelQuirks = OcKernelQuirksClass ( ) ;
OcBooterQuirksClass OcBooterQuirks = OcBooterQuirksClass ( ) ;
2021-04-28 20:30:34 +02:00
XObjArrayWithTakeValueFromXmlArray < MMIOWhiteList , ConfigPlistClass : : Quirks_Class : : Quirks_MmioWhitelist_Class > mmioWhiteListArray = XObjArrayWithTakeValueFromXmlArray < MMIOWhiteList , ConfigPlistClass : : Quirks_Class : : Quirks_MmioWhitelist_Class > ( ) ;
2021-03-29 10:50:02 +02:00
UINT32 QuirksMask = 0 ;
2021-04-11 07:18:52 +02:00
2021-04-28 20:30:34 +02:00
# if __cplusplus > 201703L
2021-09-28 15:54:31 +02:00
XBool operator = = ( const QuirksClass & ) const = default ;
2021-04-28 20:30:34 +02:00
# endif
2021-09-28 15:54:31 +02:00
XBool isEqual ( const QuirksClass & other ) const
2021-04-11 07:18:52 +02:00
{
if ( ! ( FuzzyMatch = = other . FuzzyMatch ) ) return false ;
if ( ! ( OcKernelCache = = other . OcKernelCache ) ) return false ;
if ( ! ( OcKernelQuirks . isEqual ( other . OcKernelQuirks ) ) ) return false ;
if ( ! ( OcBooterQuirks . isEqual ( other . OcBooterQuirks ) ) ) return false ;
if ( ! mmioWhiteListArray . isEqual ( other . mmioWhiteListArray ) ) return false ;
if ( ! ( QuirksMask = = other . QuirksMask ) ) return false ;
return true ;
}
2021-10-27 19:37:54 +02:00
void takeValueFrom ( const ConfigPlistClass : : Quirks_Class & other )
2021-04-28 20:30:34 +02:00
{
2021-10-27 19:37:54 +02:00
FuzzyMatch = other . dgetFuzzyMatch ( ) ;
OcKernelCache = other . dgetOcKernelCache ( ) ;
OcKernelQuirks . takeValueFrom ( other . OcKernelQuirks ) ;
OcBooterQuirks . takeValueFrom ( other . OcBooterQuirks ) ;
mmioWhiteListArray . takeValueFrom ( other . MmioWhitelist ) ;
QuirksMask = other . dgetQuirksMask ( ) ;
2021-04-28 20:30:34 +02:00
}
2021-04-11 07:18:52 +02:00
} ;
2021-03-28 22:13:43 +02:00
2021-03-26 10:43:15 +01:00
class RtVariablesClass {
public :
2021-03-27 19:53:30 +01:00
class RT_VARIABLES
{
public :
2021-09-28 15:54:31 +02:00
XBool Disabled = XBool ( ) ;
2021-03-27 19:53:30 +01:00
XString8 Comment = XStringW ( ) ;
XStringW Name = XStringW ( ) ;
2021-04-28 20:30:34 +02:00
EFI_GUIDClass Guid = EFI_GUIDClass ( ) ;
# if __cplusplus > 201703L
2021-09-28 15:54:31 +02:00
XBool operator = = ( const RT_VARIABLES & ) const = default ;
2021-04-28 20:30:34 +02:00
# endif
2021-09-28 15:54:31 +02:00
XBool isEqual ( const RT_VARIABLES & other ) const
2021-04-11 07:18:52 +02:00
{
if ( ! ( Disabled = = other . Disabled ) ) return false ;
if ( ! ( Comment = = other . Comment ) ) return false ;
if ( ! ( Name = = other . Name ) ) return false ;
if ( memcmp ( & Guid , & other . Guid , sizeof ( Guid ) ) ! = 0 ) return false ;
return true ;
}
2021-10-27 19:37:54 +02:00
void takeValueFrom ( const ConfigPlistClass : : RtVariables_Class : : Devices_RtVariables_Block & other )
2021-04-28 20:30:34 +02:00
{
2021-10-27 19:37:54 +02:00
Disabled = other . dgetDisabled ( ) ;
Comment = other . dgetComment ( ) ;
Name = other . dgetName ( ) ;
Guid = other . dgetGuid ( ) ;
2021-04-28 20:30:34 +02:00
}
2021-03-27 19:53:30 +01:00
} ;
XString8 RtROMAsString = XString8 ( ) ;
XBuffer < UINT8 > RtROMAsData = XBuffer < UINT8 > ( ) ;
XString8 RtMLBSetting = XString8 ( ) ;
UINT32 CsrActiveConfig = UINT32 ( ) ;
UINT16 BooterConfig = UINT16 ( ) ;
XString8 BooterCfgStr = XString8 ( ) ;
2021-10-08 21:49:07 +02:00
XString8 HWTarget = XString8 ( ) ;
2021-10-27 19:37:54 +02:00
XObjArrayWithTakeValueFromXmlArray < RT_VARIABLES , ConfigPlistClass : : RtVariables_Class : : Devices_RtVariables_Block > BlockRtVariableArray = XObjArrayWithTakeValueFromXmlArray < RT_VARIABLES , ConfigPlistClass : : RtVariables_Class : : Devices_RtVariables_Block > ( ) ;
2021-03-27 19:53:30 +01:00
2021-09-28 15:54:31 +02:00
XBool GetLegacyLanAddress ( ) const {
2021-04-11 07:18:52 +02:00
return RtROMAsString . isEqualIC ( " UseMacAddr0 " ) | | RtROMAsString . isEqualIC ( " UseMacAddr1 " ) ;
2021-03-27 19:53:30 +01:00
}
2021-04-11 07:18:52 +02:00
2021-04-28 20:30:34 +02:00
# if __cplusplus > 201703L
2021-10-27 19:37:54 +02:00
XBool operator = = ( const RtVariablesClass & ) const = default ;
2021-04-28 20:30:34 +02:00
# endif
2021-09-28 15:54:31 +02:00
XBool isEqual ( const RtVariablesClass & other ) const
2021-04-11 07:18:52 +02:00
{
if ( ! ( RtROMAsString = = other . RtROMAsString ) ) return false ;
if ( ! ( RtROMAsData = = other . RtROMAsData ) ) return false ;
if ( ! ( RtMLBSetting = = other . RtMLBSetting ) ) return false ;
if ( ! ( CsrActiveConfig = = other . CsrActiveConfig ) ) return false ;
if ( ! ( BooterConfig = = other . BooterConfig ) ) return false ;
if ( ! ( BooterCfgStr = = other . BooterCfgStr ) ) return false ;
2021-10-08 21:49:07 +02:00
if ( ! ( HWTarget = = other . HWTarget ) ) return false ;
2021-04-11 07:18:52 +02:00
if ( ! BlockRtVariableArray . isEqual ( other . BlockRtVariableArray ) ) return false ;
return true ;
}
2021-10-27 19:37:54 +02:00
void takeValueFrom ( const ConfigPlistClass : : RtVariables_Class & other )
2021-04-28 20:30:34 +02:00
{
2021-10-27 19:37:54 +02:00
RtROMAsString = other . dgetRtROMAsString ( ) ;
RtROMAsData = other . dgetRtROMAsData ( ) ;
RtMLBSetting = other . dgetRtMLBSetting ( ) ;
CsrActiveConfig = other . dgetCsrActiveConfig ( ) ;
BooterConfig = other . dgetBooterConfig ( ) ;
BooterCfgStr = other . dgetBooterCfgStr ( ) ;
BlockRtVariableArray . takeValueFrom ( other . Block ) ;
HWTarget = other . dgetHWTarget ( ) ;
2021-04-28 20:30:34 +02:00
}
2021-03-26 10:43:15 +01:00
2021-03-27 19:53:30 +01:00
} ;
2021-03-26 10:43:15 +01:00
2021-04-03 16:42:49 +02:00
class SmbiosClass {
public :
2021-03-26 10:43:15 +01:00
2021-04-28 20:30:34 +02:00
class SlotDeviceClass
{
public :
static const SlotDeviceClass NullSlotDevice ;
public :
uint8_t SmbiosIndex = 0xff ;
UINT8 SlotID = UINT8 ( ) ;
MISC_SLOT_TYPE SlotType = MISC_SLOT_TYPE ( ) ;
XString8 SlotName = XString8 ( ) ;
SlotDeviceClass ( ) { }
# if __cplusplus > 201703L
2021-09-28 15:54:31 +02:00
XBool operator = = ( const SLOT_DEVICE & ) const = default ;
2021-04-28 20:30:34 +02:00
# endif
2021-09-28 15:54:31 +02:00
XBool isEqual ( const SlotDeviceClass & other ) const
2021-04-28 20:30:34 +02:00
{
if ( ! ( SmbiosIndex = = other . SmbiosIndex ) ) return false ;
if ( ! ( SlotID = = other . SlotID ) ) return false ;
if ( ! ( SlotType = = other . SlotType ) ) return false ;
if ( ! ( SlotName = = other . SlotName ) ) return false ;
return true ;
}
2021-10-27 19:37:54 +02:00
void takeValueFrom ( const SmbiosPlistClass : : SmbiosDictClass : : SlotDeviceDictClass & other )
2021-04-28 20:30:34 +02:00
{
2021-10-27 19:37:54 +02:00
SmbiosIndex = other . dgetDeviceN ( ) ;
SlotID = other . dgetSlotID ( ) ;
SlotType = other . dgetSlotType ( ) ;
SlotName = other . dgetSlotName ( ) ;
2021-04-28 20:30:34 +02:00
}
} ;
class SlotDeviceArrayClass : public XObjArrayWithTakeValueFromXmlArray < SlotDeviceClass , SmbiosPlistClass : : SmbiosDictClass : : SlotDeviceDictClass >
{
public :
2021-09-28 15:54:31 +02:00
XBool doesSlotForIndexExist ( uint8_t idx2Look4 ) const {
2021-04-28 20:30:34 +02:00
for ( size_t idx = 0 ; idx < size ( ) ; + + idx ) {
if ( ElementAt ( idx ) . SmbiosIndex = = idx2Look4 ) return true ;
}
return false ;
}
const SlotDeviceClass & getSlotForIndex ( uint8_t idx2Look4 ) const {
for ( size_t idx = 0 ; idx < size ( ) ; + + idx ) {
if ( ElementAt ( idx ) . SmbiosIndex = = idx2Look4 ) return ElementAt ( idx ) ;
}
log_technical_bug ( " %s : no idx==%hhd " , __PRETTY_FUNCTION__ , idx2Look4 ) ;
return SlotDeviceClass : : NullSlotDevice ;
2021-05-06 08:23:07 +02:00
}
const SlotDeviceClass & getSlotForIndexOrNull ( uint8_t idx2Look4 ) const {
for ( size_t idx = 0 ; idx < size ( ) ; + + idx ) {
if ( ElementAt ( idx ) . SmbiosIndex = = idx2Look4 ) return ElementAt ( idx ) ;
}
return SlotDeviceClass : : NullSlotDevice ;
2021-04-11 07:18:52 +02:00
}
2021-04-28 20:30:34 +02:00
} ;
class RamSlotInfo {
public :
2021-10-02 19:44:16 +02:00
UINT64 SlotIndex = UINT64 ( ) ;
2021-04-28 20:30:34 +02:00
UINT32 ModuleSize = UINT32 ( ) ;
UINT32 Frequency = UINT32 ( ) ;
XString8 Vendor = XString8 ( ) ;
XString8 PartNo = XString8 ( ) ;
XString8 SerialNo = XString8 ( ) ;
UINT8 Type = UINT8 ( ) ;
RamSlotInfo ( ) { }
# if __cplusplus > 201703L
2021-09-28 15:54:31 +02:00
XBool operator = = ( const RamSlotInfo & ) const = default ;
2021-04-28 20:30:34 +02:00
# endif
2021-09-28 15:54:31 +02:00
XBool isEqual ( const RamSlotInfo & other ) const
2021-04-28 20:30:34 +02:00
{
2021-10-02 19:44:16 +02:00
if ( ! ( SlotIndex = = other . SlotIndex ) ) return false ;
2021-04-28 20:30:34 +02:00
if ( ! ( ModuleSize = = other . ModuleSize ) ) return false ;
if ( ! ( Frequency = = other . Frequency ) ) return false ;
if ( ! ( Vendor = = other . Vendor ) ) return false ;
if ( ! ( PartNo = = other . PartNo ) ) return false ;
if ( ! ( SerialNo = = other . SerialNo ) ) return false ;
if ( ! ( Type = = other . Type ) ) return false ;
return true ;
2021-04-11 07:18:52 +02:00
}
2021-09-28 15:54:31 +02:00
XBool takeValueFrom ( const SmbiosPlistClass : : SmbiosDictClass : : MemoryDictClass : : ModuleDictClass & other )
2021-04-11 07:18:52 +02:00
{
2021-10-02 19:44:16 +02:00
SlotIndex = other . dgetSlotIndex ( ) ;
2021-04-28 20:30:34 +02:00
ModuleSize = other . dgetModuleSize ( ) ;
Frequency = other . dgetFrequency ( ) ;
Vendor = other . dgetVendor ( ) ;
PartNo = other . dgetPartNo ( ) ;
SerialNo = other . dgetSerialNo ( ) ;
Type = other . dgetType ( ) ;
2021-04-11 07:18:52 +02:00
return true ;
}
2021-04-28 20:30:34 +02:00
} ;
class RamSlotInfoArrayClass {
public :
2021-10-02 19:44:16 +02:00
UINT8 SlotCount = UINT8 ( ) ;
2021-04-28 20:30:34 +02:00
UINT8 UserChannels = UINT8 ( ) ;
XObjArrayWithTakeValueFromXmlArray < RamSlotInfo , SmbiosPlistClass : : SmbiosDictClass : : MemoryDictClass : : ModuleDictClass > User = XObjArrayWithTakeValueFromXmlArray < RamSlotInfo , SmbiosPlistClass : : SmbiosDictClass : : MemoryDictClass : : ModuleDictClass > ( ) ;
RamSlotInfoArrayClass ( ) { }
2021-03-25 15:32:56 +01:00
2021-04-28 20:30:34 +02:00
# if __cplusplus > 201703L
2021-09-28 15:54:31 +02:00
XBool operator = = ( const RamSlotInfoArrayClass & ) const = default ;
2021-04-28 20:30:34 +02:00
# endif
2021-09-28 15:54:31 +02:00
XBool isEqual ( const RamSlotInfoArrayClass & other ) const
2021-04-28 20:30:34 +02:00
{
2021-10-02 19:44:16 +02:00
if ( ! ( SlotCount = = other . SlotCount ) ) return false ;
2021-04-28 20:30:34 +02:00
if ( ! ( UserChannels = = other . UserChannels ) ) return false ;
if ( ! ( User . isEqual ( other . User ) ) ) return false ;
return true ;
}
2021-10-27 19:37:54 +02:00
void takeValueFrom ( const SmbiosPlistClass : : SmbiosDictClass : : MemoryDictClass & other )
2021-04-28 20:30:34 +02:00
{
2021-10-27 19:37:54 +02:00
SlotCount = other . dgetSlotCount ( ) ;
UserChannels = other . dgetUserChannels ( ) ;
User . takeValueFrom ( other . Modules ) ;
2021-04-28 20:30:34 +02:00
}
} ;
// SMBIOS TYPE0
2021-04-05 10:57:55 +02:00
XString8 BiosVendor = XString8 ( ) ;
2021-04-28 20:30:34 +02:00
XString8 BiosVersion = XString8 ( ) ;
XString8 EfiVersion = XString8 ( ) ;
XString8 BiosReleaseDate = XString8 ( ) ;
// SMBIOS TYPE1
2021-04-05 10:57:55 +02:00
XString8 ManufactureName = XString8 ( ) ;
XString8 ProductName = XString8 ( ) ;
2021-04-28 20:30:34 +02:00
XString8 SystemVersion = XString8 ( ) ;
2021-04-05 10:57:55 +02:00
XString8 SerialNr = XString8 ( ) ;
XString8 SmUUID = XString8 ( ) ;
XString8 FamilyName = XString8 ( ) ;
2021-04-28 20:30:34 +02:00
// SMBIOS TYPE2
2021-04-05 10:57:55 +02:00
XString8 BoardManufactureName = XString8 ( ) ;
XString8 BoardSerialNumber = XString8 ( ) ;
XString8 BoardNumber = XString8 ( ) ; //Board-ID
XString8 LocationInChassis = XString8 ( ) ;
XString8 BoardVersion = XString8 ( ) ;
UINT8 BoardType = UINT8 ( ) ;
2021-04-28 20:30:34 +02:00
// SMBIOS TYPE3
2021-09-28 15:54:31 +02:00
XBool Mobile = XBool ( ) ;
2021-04-05 10:57:55 +02:00
UINT8 ChassisType = UINT8 ( ) ;
XString8 ChassisManufacturer = XString8 ( ) ;
XString8 ChassisAssetTag = XString8 ( ) ;
2021-04-28 20:30:34 +02:00
// SMBIOS TYPE4
// SMBIOS TYPE17
2021-04-05 10:57:55 +02:00
UINT16 SmbiosVersion = UINT16 ( ) ;
INT8 Attribute = INT8 ( ) ;
2021-04-03 16:42:49 +02:00
// These were set but never used.
// XString8 MemoryManufacturer;
// XString8 MemorySerialNumber;
// XString8 MemoryPartNumber;
// XString8 MemorySpeed;
2021-04-28 20:30:34 +02:00
// SMBIOS TYPE131
// SMBIOS TYPE132
2021-09-28 15:54:31 +02:00
XBool TrustSMBIOS = false ;
XBool InjectMemoryTables = XBool ( ) ; // same as Memory.SlotCounts
2021-04-28 20:30:34 +02:00
// SMBIOS TYPE133
2021-04-05 10:57:55 +02:00
UINT64 gPlatformFeature = UINT64 ( ) ;
2021-04-28 20:30:34 +02:00
// PatchTableType11
2021-09-28 15:54:31 +02:00
XBool NoRomInfo = XBool ( ) ;
2020-04-16 09:15:26 +02:00
2021-04-28 20:30:34 +02:00
UINT32 FirmwareFeatures = UINT32 ( ) ;
UINT32 FirmwareFeaturesMask = UINT32 ( ) ;
2021-09-25 13:33:16 +02:00
UINT64 ExtendedFirmwareFeatures = UINT64 ( ) ;
UINT64 ExtendedFirmwareFeaturesMask = UINT64 ( ) ;
2021-04-28 20:30:34 +02:00
RamSlotInfoArrayClass RamSlotInfoArray = RamSlotInfoArrayClass ( ) ;
SlotDeviceArrayClass SlotDevices = SlotDeviceArrayClass ( ) ;
2021-04-11 07:18:52 +02:00
2021-04-28 20:30:34 +02:00
SmbiosClass ( ) { }
2021-04-11 07:18:52 +02:00
2021-04-28 20:30:34 +02:00
# if __cplusplus > 201703L
2021-09-28 15:54:31 +02:00
XBool operator = = ( const SmbiosClass & ) const = default ;
2021-04-28 20:30:34 +02:00
# endif
2021-09-28 15:54:31 +02:00
XBool isEqual ( const SmbiosClass & other ) const
2021-04-11 07:18:52 +02:00
{
// SMBIOS TYPE0
if ( ! ( BiosVendor = = other . BiosVendor ) ) return false ;
2021-04-28 20:30:34 +02:00
if ( ! ( BiosVersion = = other . BiosVersion ) ) return false ;
if ( ! ( EfiVersion = = other . EfiVersion ) ) return false ;
if ( ! ( BiosReleaseDate = = other . BiosReleaseDate ) ) return false ;
2021-04-11 07:18:52 +02:00
// SMBIOS TYPE1
if ( ! ( ManufactureName = = other . ManufactureName ) ) return false ;
if ( ! ( ProductName = = other . ProductName ) ) return false ;
2021-04-28 20:30:34 +02:00
if ( ! ( SystemVersion = = other . SystemVersion ) ) return false ;
2021-04-11 07:18:52 +02:00
if ( ! ( SerialNr = = other . SerialNr ) ) return false ;
if ( ! ( SmUUID = = other . SmUUID ) ) return false ;
if ( ! ( FamilyName = = other . FamilyName ) ) return false ;
// SMBIOS TYPE2
if ( ! ( BoardManufactureName = = other . BoardManufactureName ) ) return false ;
if ( ! ( BoardSerialNumber = = other . BoardSerialNumber ) ) return false ;
if ( ! ( BoardNumber = = other . BoardNumber ) ) return false ;
if ( ! ( LocationInChassis = = other . LocationInChassis ) ) return false ;
if ( ! ( BoardVersion = = other . BoardVersion ) ) return false ;
if ( ! ( BoardType = = other . BoardType ) ) return false ;
// SMBIOS TYPE3
if ( ! ( Mobile = = other . Mobile ) ) return false ;
if ( ! ( ChassisType = = other . ChassisType ) ) return false ;
if ( ! ( ChassisManufacturer = = other . ChassisManufacturer ) ) return false ;
if ( ! ( ChassisAssetTag = = other . ChassisAssetTag ) ) return false ;
// SMBIOS TYPE17
if ( ! ( SmbiosVersion = = other . SmbiosVersion ) ) return false ;
if ( ! ( Attribute = = other . Attribute ) ) return false ;
// SMBIOS TYPE132
if ( ! ( TrustSMBIOS = = other . TrustSMBIOS ) ) return false ;
if ( ! ( InjectMemoryTables = = other . InjectMemoryTables ) ) return false ;
// SMBIOS TYPE133
if ( ! ( gPlatformFeature = = other . gPlatformFeature ) ) return false ;
// PatchTableType11
if ( ! ( NoRomInfo = = other . NoRomInfo ) ) return false ;
2021-04-28 20:30:34 +02:00
if ( ! ( FirmwareFeatures = = other . FirmwareFeatures ) ) return false ;
if ( ! ( FirmwareFeaturesMask = = other . FirmwareFeaturesMask ) ) return false ;
2021-09-25 13:33:16 +02:00
if ( ! ( ExtendedFirmwareFeatures = = other . ExtendedFirmwareFeatures ) ) return false ;
if ( ! ( ExtendedFirmwareFeaturesMask = = other . ExtendedFirmwareFeaturesMask ) ) return false ;
2021-04-28 20:30:34 +02:00
if ( ! RamSlotInfoArray . isEqual ( other . RamSlotInfoArray ) ) return false ;
2021-04-11 07:18:52 +02:00
if ( ! SlotDevices . isEqual ( other . SlotDevices ) ) return false ;
// if ( memcmp(RPlt, other.RPlt, sizeof(RPlt)) != 0 ) return false;
// if ( memcmp(RBr, other.RBr, sizeof(RBr)) != 0 ) return false;
// if ( memcmp(EPCI, other.EPCI, sizeof(EPCI)) != 0 ) return false;
// if ( memcmp(REV, other.REV, sizeof(REV)) != 0 ) return false;
return true ;
}
2021-10-27 19:37:54 +02:00
void takeValueFrom ( const SmbiosPlistClass : : SmbiosDictClass & other )
2021-04-28 20:30:34 +02:00
{
// SMBIOS TYPE0
2021-10-27 19:37:54 +02:00
BiosVendor = other . dgetBiosVendor ( ) ;
BiosVersion = other . dgetBiosVersion ( ) ;
EfiVersion = other . dgetEfiVersion ( ) ;
BiosReleaseDate = other . dgetBiosReleaseDate ( ) ;
2021-04-28 20:30:34 +02:00
// SMBIOS TYPE1
2021-10-27 19:37:54 +02:00
ManufactureName = other . dgetManufactureName ( ) ;
ProductName = other . dgetProductName ( ) ;
SystemVersion = other . dgetSystemVersion ( ) ;
SerialNr = other . dgetSerialNr ( ) ;
SmUUID = other . dgetSmUUID ( ) ;
FamilyName = other . dgetFamilyName ( ) ;
2021-04-28 20:30:34 +02:00
// SMBIOS TYPE2
2021-10-27 19:37:54 +02:00
BoardManufactureName = other . dgetBoardManufactureName ( ) ;
BoardSerialNumber = other . dgetBoardSerialNumber ( ) ;
BoardNumber = other . dgetBoardNumber ( ) ;
LocationInChassis = other . dgetLocationInChassis ( ) ;
BoardVersion = other . dgetBoardVersion ( ) ;
BoardType = other . dgetBoardType ( ) ;
2021-04-28 20:30:34 +02:00
// SMBIOS TYPE3
2021-10-27 19:37:54 +02:00
Mobile = other . dgetMobile ( ) ;
ChassisType = other . dgetChassisType ( ) ;
ChassisManufacturer = other . dgetChassisManufacturer ( ) ;
ChassisAssetTag = other . dgetChassisAssetTag ( ) ;
2021-04-28 20:30:34 +02:00
// SMBIOS TYPE17
2021-10-27 19:37:54 +02:00
SmbiosVersion = other . dgetSmbiosVersion ( ) ;
Attribute = other . dgetAttribute ( ) ;
2021-04-28 20:30:34 +02:00
// SMBIOS TYPE132
2021-10-27 19:37:54 +02:00
TrustSMBIOS = other . dgetTrustSMBIOS ( ) ;
InjectMemoryTables = other . dgetInjectMemoryTables ( ) ;
2021-04-28 20:30:34 +02:00
// SMBIOS TYPE133
2021-10-27 19:37:54 +02:00
gPlatformFeature = other . dgetgPlatformFeature ( ) ;
2021-04-28 20:30:34 +02:00
// PatchTableType11
2021-10-27 19:37:54 +02:00
NoRomInfo = other . dgetNoRomInfo ( ) ;
2021-09-25 13:33:16 +02:00
//SMBIOS TYPE128
2021-10-27 19:37:54 +02:00
FirmwareFeatures = other . dgetFirmwareFeatures ( ) ;
FirmwareFeaturesMask = other . dgetFirmwareFeaturesMask ( ) ;
ExtendedFirmwareFeatures = other . dgetExtendedFirmwareFeatures ( ) ;
ExtendedFirmwareFeaturesMask = other . dgetExtendedFirmwareFeaturesMask ( ) ;
RamSlotInfoArray . takeValueFrom ( other . Memory ) ;
SlotDevices . takeValueFrom ( other . Slots ) ;
2021-04-28 20:30:34 +02:00
}
2020-04-16 09:15:26 +02:00
2021-04-03 16:42:49 +02:00
} ;
class BootGraphicsClass {
public :
2021-04-11 07:18:52 +02:00
UINT32 DefaultBackgroundColor = 0 ;
UINT32 UIScale = 0 ;
UINT32 EFILoginHiDPI = 0 ;
// UINT8 flagstate[32] = {0};
uint32_t _flagstate = uint32_t ( ) ;
BootGraphicsClass ( ) {
2021-10-27 19:37:54 +02:00
// flagstate.memset(0, 32);
2021-04-11 07:18:52 +02:00
}
2021-04-28 20:30:34 +02:00
# if __cplusplus > 201703L
2021-09-28 15:54:31 +02:00
XBool operator = = ( const BootGraphicsClass & ) const = default ;
2021-04-28 20:30:34 +02:00
# endif
2021-09-28 15:54:31 +02:00
XBool isEqual ( const BootGraphicsClass & other ) const
2021-04-11 07:18:52 +02:00
{
if ( ! ( DefaultBackgroundColor = = other . DefaultBackgroundColor ) ) return false ;
if ( ! ( UIScale = = other . UIScale ) ) return false ;
if ( ! ( EFILoginHiDPI = = other . EFILoginHiDPI ) ) return false ;
if ( _flagstate ! = other . _flagstate ) return false ;
return true ;
}
2021-10-27 19:37:54 +02:00
void takeValueFrom ( const ConfigPlistClass : : BootGraphics_Class & other )
2021-04-28 20:30:34 +02:00
{
2021-10-27 19:37:54 +02:00
DefaultBackgroundColor = other . dgetDefaultBackgroundColor ( ) ;
UIScale = other . dgetUIScale ( ) ;
EFILoginHiDPI = other . dgetEFILoginHiDPI ( ) ;
_flagstate = other . dget_flagstate ( ) ;
2021-04-28 20:30:34 +02:00
}
2021-04-03 16:42:49 +02:00
} ;
2020-04-16 09:15:26 +02:00
2021-04-03 16:42:49 +02:00
BootClass Boot = BootClass ( ) ;
ACPIClass ACPI = ACPIClass ( ) ;
GUIClass GUI = GUIClass ( ) ;
CPUClass CPU = CPUClass ( ) ;
SystemParametersClass SystemParameters = SystemParametersClass ( ) ;
KERNEL_AND_KEXT_PATCHES KernelAndKextPatches = KERNEL_AND_KEXT_PATCHES ( ) ;
GraphicsClass Graphics = GraphicsClass ( ) ;
XStringWArray DisabledDriverArray = XStringWArray ( ) ;
QuirksClass Quirks = QuirksClass ( ) ;
RtVariablesClass RtVariables = RtVariablesClass ( ) ;
DevicesClass Devices = DevicesClass ( ) ;
SmbiosClass Smbios = SmbiosClass ( ) ;
BootGraphicsClass BootGraphics = BootGraphicsClass ( ) ;
2020-04-16 09:15:26 +02:00
2020-09-29 14:15:11 +02:00
2021-04-03 16:42:49 +02:00
//other
// UINT16 DropOEM_DSM; // not used anymore.
2021-09-28 15:54:31 +02:00
// XBool LpcTune; // never set to true.
2020-08-11 14:43:53 +02:00
2021-04-03 16:42:49 +02:00
SETTINGS_DATA ( ) { }
2021-04-11 07:18:52 +02:00
// SETTINGS_DATA(const SETTINGS_DATA& other) = delete; // Can be defined if needed
// const SETTINGS_DATA& operator = ( const SETTINGS_DATA & ) = delete; // Can be defined if needed
2021-04-28 20:30:34 +02:00
# if __cplusplus > 201703L
2021-09-28 15:54:31 +02:00
XBool operator = = ( const SETTINGS_DATA & ) const = default ;
2021-04-28 20:30:34 +02:00
# endif
2021-09-28 15:54:31 +02:00
XBool isEqual ( const SETTINGS_DATA & other ) const
2021-04-11 07:18:52 +02:00
{
if ( ! Boot . isEqual ( other . Boot ) ) return false ;
if ( ! ACPI . isEqual ( other . ACPI ) ) return false ;
if ( ! GUI . isEqual ( other . GUI ) ) return false ;
if ( ! CPU . isEqual ( other . CPU ) ) return false ;
if ( ! SystemParameters . isEqual ( other . SystemParameters ) ) return false ;
if ( ! KernelAndKextPatches . isEqual ( other . KernelAndKextPatches ) ) return false ;
if ( ! Graphics . isEqual ( other . Graphics ) ) return false ;
if ( ! ( DisabledDriverArray = = other . DisabledDriverArray ) ) return false ;
if ( ! Quirks . isEqual ( other . Quirks ) ) return false ;
if ( ! RtVariables . isEqual ( other . RtVariables ) ) return false ;
if ( ! Devices . isEqual ( other . Devices ) ) return false ;
if ( ! Smbios . isEqual ( other . Smbios ) ) return false ;
if ( ! BootGraphics . isEqual ( other . BootGraphics ) ) return false ;
return true ;
}
2020-08-13 14:07:40 +02:00
2021-10-27 19:37:54 +02:00
void takeValueFrom ( const ConfigPlistClass & other )
2021-04-28 20:30:34 +02:00
{
2021-10-27 19:37:54 +02:00
Boot . takeValueFrom ( other . Boot ) ;
ACPI . takeValueFrom ( other . ACPI ) ;
GUI . takeValueFrom ( other . GUI ) ;
CPU . takeValueFrom ( other . CPU ) ;
SystemParameters . takeValueFrom ( other . SystemParameters ) ;
KernelAndKextPatches . takeValueFrom ( other . KernelAndKextPatches ) ;
Graphics . takeValueFrom ( other . Graphics ) ;
DisabledDriverArray = other . dgetDisabledDriverArray ( ) ;
Quirks . takeValueFrom ( other . Quirks ) ;
RtVariables . takeValueFrom ( other . RtVariables ) ;
Devices . takeValueFrom ( other . Devices ) ;
Smbios . takeValueFrom ( other . getSMBIOS ( ) ) ;
BootGraphics . takeValueFrom ( other . BootGraphics ) ;
2021-04-28 20:30:34 +02:00
}
2020-08-11 14:43:53 +02:00
~ SETTINGS_DATA ( ) { }
2020-09-23 15:47:47 +02:00
const XString8 & getUUID ( ) ;
2021-04-28 20:30:34 +02:00
const XString8 & getUUID ( EFI_GUIDClass * efiGuid ) ;
2020-11-18 22:49:02 +01:00
// If CustomUuid is defined, return false by default
// If SmUUID is defined, return true by default.
2021-09-28 15:54:31 +02:00
XBool ShouldInjectSystemID ( ) {
2021-03-28 11:12:43 +02:00
if ( SystemParameters . CustomUuid . notEmpty ( ) & & SystemParameters . CustomUuid ! = nullGuidAsString ) {
2021-03-27 19:53:30 +01:00
if ( SystemParameters . _InjectSystemID = = 2 ) return false ;
2021-09-28 15:54:31 +02:00
else return SystemParameters . _InjectSystemID ! = 0 ;
2020-09-23 15:47:47 +02:00
}
2021-04-03 16:42:49 +02:00
if ( Smbios . SmUUID . isEmpty ( ) | | Smbios . SmUUID = = nullGuidAsString ) return false ;
2021-03-27 19:53:30 +01:00
if ( SystemParameters . _InjectSystemID = = 2 ) return true ;
2021-09-28 15:54:31 +02:00
return SystemParameters . _InjectSystemID ! = 0 ;
2020-09-23 15:47:47 +02:00
}
2021-03-27 19:53:30 +01:00
2021-09-28 15:54:31 +02:00
XBool getEnableC6 ( ) const {
2021-03-27 19:53:30 +01:00
if ( CPU . _EnableC6 . isDefined ( ) ) return CPU . _EnableC6 . value ( ) ;
return ACPI . SSDT . _EnableC6 ;
}
2021-09-28 15:54:31 +02:00
XBool getEnableC4 ( ) const {
2021-03-27 19:53:30 +01:00
if ( CPU . _EnableC4 . isDefined ( ) ) return CPU . _EnableC4 . value ( ) ;
return ACPI . SSDT . _EnableC4 ;
}
2021-09-28 15:54:31 +02:00
XBool getEnableC2 ( ) const {
2021-03-27 19:53:30 +01:00
if ( CPU . _EnableC2 . isDefined ( ) ) return CPU . _EnableC2 . value ( ) ;
return ACPI . SSDT . _EnableC2 ;
}
2020-08-11 14:43:53 +02:00
} ;
2020-04-16 09:15:26 +02:00
2020-08-15 15:47:56 +02:00
//#pragma GCC diagnostic ignored "-Wpadded"
2020-08-13 14:07:40 +02:00
2020-04-16 09:15:26 +02:00
typedef struct _DRIVERS_FLAGS {
BOOLEAN EmuVariableLoaded ;
BOOLEAN VideoLoaded ;
BOOLEAN PartitionLoaded ;
BOOLEAN MemFixLoaded ;
BOOLEAN AptioFixLoaded ;
BOOLEAN AptioFix2Loaded ;
BOOLEAN AptioFix3Loaded ;
BOOLEAN AptioMemFixLoaded ;
BOOLEAN HFSLoaded ;
BOOLEAN APFSLoaded ;
} DRIVERS_FLAGS ;
// ACPI/PATCHED/AML
2020-08-09 17:55:30 +02:00
class ACPI_PATCHED_AML
2020-04-16 09:15:26 +02:00
{
2020-08-09 17:55:30 +02:00
public :
2021-03-23 20:59:30 +01:00
XString8 FileName = XString8 ( ) ;
INPUT_ITEM MenuItem = INPUT_ITEM ( ) ;
2020-08-09 17:55:30 +02:00
2021-03-23 20:59:30 +01:00
ACPI_PATCHED_AML ( ) { } ;
2020-08-09 17:55:30 +02:00
ACPI_PATCHED_AML ( const ACPI_PATCHED_AML & other ) = delete ; // Can be defined if needed
const ACPI_PATCHED_AML & operator = ( const ACPI_PATCHED_AML & ) = delete ; // Can be defined if needed
~ ACPI_PATCHED_AML ( ) { }
2020-04-16 09:15:26 +02:00
} ;
// syscl - Side load kext
2020-08-09 17:55:30 +02:00
class SIDELOAD_KEXT
{
public :
2020-09-16 01:01:53 +02:00
XObjArray < SIDELOAD_KEXT > PlugInList ;
2021-02-11 12:41:59 +01:00
XStringW FileName = XStringW ( ) ;
XStringW KextDirNameUnderOEMPath = XStringW ( ) ;
XStringW Version = XStringW ( ) ;
2021-02-06 18:16:46 +01:00
INPUT_ITEM MenuItem = INPUT_ITEM ( ) ;
2020-08-09 17:55:30 +02:00
2021-02-11 12:41:59 +01:00
SIDELOAD_KEXT ( ) : PlugInList ( ) { } ;
2020-08-09 17:55:30 +02:00
SIDELOAD_KEXT ( const SIDELOAD_KEXT & other ) = delete ; // Can be defined if needed
const SIDELOAD_KEXT & operator = ( const SIDELOAD_KEXT & ) = delete ; // Can be defined if needed
2020-09-16 01:01:53 +02:00
~ SIDELOAD_KEXT ( ) { }
2020-04-16 09:15:26 +02:00
} ;
2020-08-31 08:22:21 +02:00
2021-03-26 10:43:15 +01:00
//extern XObjArray<RT_VARIABLES> gSettings.RtVariables.BlockRtVariableArray;
2020-08-31 09:07:36 +02:00
extern XObjArray < HDA_OUTPUTS > AudioList ;
2020-04-04 14:27:02 +02:00
2020-08-31 09:22:11 +02:00
extern XStringWArray ThemeNameArray ;
2021-09-27 09:05:11 +02:00
extern XStringWArray ConfigsList ;
2021-09-27 09:18:52 +02:00
extern XStringWArray DsdtsList ;
2020-05-26 19:12:54 +02:00
//extern INTN ScrollButtonsHeight;
//extern INTN ScrollBarDecorationsHeight;
//extern INTN ScrollScrollDecorationsHeight;
//extern INTN LayoutBannerOffset;
//extern INTN LayoutButtonOffset;
//extern INTN LayoutTextOffset;
2020-04-04 14:27:02 +02:00
// this should go in a globals, not in settings
extern INTN OldChosenTheme ;
extern INTN OldChosenConfig ;
extern INTN OldChosenDsdt ;
extern UINTN OldChosenAudio ;
2021-09-28 15:54:31 +02:00
extern XBool SavePreBootLog ;
2020-04-04 14:27:02 +02:00
extern UINT8 DefaultAudioVolume ;
2020-02-29 08:30:21 +01:00
2021-04-28 20:30:34 +02:00
//extern GFX_PROPERTIES gGraphics[];
//extern HDA_PROPERTIES gAudios[];
//extern UINTN NGFX;
//extern UINTN NHDA;
2020-04-16 09:15:26 +02:00
//extern UINT16 gCPUtype;
extern SETTINGS_DATA gSettings ;
2021-09-28 15:54:31 +02:00
extern XBool gFirmwareClover ;
2020-04-16 09:15:26 +02:00
extern DRIVERS_FLAGS gDriversFlags ;
extern EFI_EDID_DISCOVERED_PROTOCOL * EdidDiscovered ;
//extern UINT8 *gEDID;
extern UINTN gEvent ;
extern UINT16 gBacklightLevel ;
2021-09-28 15:54:31 +02:00
//extern XBool defDSM;
2020-05-11 08:30:45 +02:00
//extern UINT16 dropDSM;
2020-04-16 09:15:26 +02:00
2021-04-28 20:30:34 +02:00
//extern TagDict* gConfigDict[];
2020-04-16 09:15:26 +02:00
// ACPI/PATCHED/AML
2021-03-23 20:59:30 +01:00
extern XObjArray < ACPI_PATCHED_AML > ACPIPatchedAML ;
2020-04-16 09:15:26 +02:00
// SysVariables
//extern SYSVARIABLES *SysVariables;
// Hold theme fixed IconFormat / extension
extern CHAR16 * IconFormat ;
2020-04-16 13:19:37 +02:00
2020-04-16 09:15:26 +02:00
2021-09-28 15:54:31 +02:00
extern XBool ResumeFromCoreStorage ;
//extern XBool gRemapSmBiosIsRequire; // syscl: pass argument for Dell SMBIOS here
2020-04-16 09:15:26 +02:00
extern EMU_VARIABLE_CONTROL_PROTOCOL * gEmuVariableControl ;
2020-04-26 11:39:41 +02:00
//
// config module
//
2020-08-09 17:55:30 +02:00
class REFIT_CONFIG
{
public :
2021-03-22 13:40:01 +01:00
UINTN DisableFlags = 0 ; //to disable some volume types (optical, firewire etc)
2021-09-28 15:54:31 +02:00
XBool Quiet = true ;
XBool SpecialBootMode = false ; // content of nvram var "aptiofixflag"
2020-08-09 17:55:30 +02:00
2021-09-28 10:28:45 +02:00
XBool gBootChanged = false ;
XBool gThemeChanged = false ;
XBool NeedPMfix = false ;
2021-02-11 12:41:59 +01:00
ACPI_DROP_TABLE * ACPIDropTables = NULL ;
2021-02-06 18:16:46 +01:00
2021-03-20 15:29:34 +01:00
UINT8 CustomLogoType = 0 ; // this will be initialized with gSettings.Boot.CustomBoot and set back to CUSTOM_BOOT_DISABLED if CustomLogo could not be loaded or decoded (see afterGetUserSettings)
2021-03-15 10:02:34 +01:00
XImage * CustomLogo = 0 ;
2021-02-06 18:16:46 +01:00
2021-09-28 15:54:31 +02:00
XBool DropSSDT = false ; // init with gSettings.Boot.DropSSDTSetting. Put back to false if one table is dropped (see afterGetUserSettings)
2021-03-15 10:02:34 +01:00
UINT8 SecureBoot = 0 ;
UINT8 SecureBootSetupMode = 0 ;
2021-02-06 18:16:46 +01:00
2021-09-28 15:54:31 +02:00
XBool SetTable132 = false ;
XBool HWP = false ;
2021-03-19 16:35:01 +01:00
2021-09-28 15:54:31 +02:00
XBool EnableC6 = false ;
XBool EnableC4 = false ;
XBool EnableC2 = false ;
uint16_t C3Latency = 0 ;
2021-03-19 14:04:19 +01:00
2021-03-22 13:40:01 +01:00
XObjArray < CUSTOM_LOADER_ENTRY > CustomEntries = XObjArray < CUSTOM_LOADER_ENTRY > ( ) ;
2021-03-23 20:59:30 +01:00
XObjArray < CUSTOM_LEGACY_ENTRY > CustomLegacyEntries = XObjArray < CUSTOM_LEGACY_ENTRY > ( ) ;
XObjArray < CUSTOM_TOOL_ENTRY > CustomToolsEntries = XObjArray < CUSTOM_TOOL_ENTRY > ( ) ;
INTN Codepage = 0xC0 ;
INTN CodepageSize = 0xC0 ;
2021-03-22 13:40:01 +01:00
2021-09-28 15:54:31 +02:00
XBool KPKernelPm = XBool ( ) ;
XBool KPAppleIntelCPUPM = XBool ( ) ;
2021-03-25 15:32:56 +01:00
2021-03-26 10:43:15 +01:00
XBuffer < UINT8 > RtROM = XBuffer < UINT8 > ( ) ;
XString8 RtMLB = XString8 ( ) ;
2021-09-28 15:54:31 +02:00
XBool Turbo = true ;
2021-03-22 13:40:01 +01:00
2021-09-28 15:54:31 +02:00
XString8 OEMProductFromSmbios = XString8 ( ) ;
XString8 OEMVendorFromSmbios = XString8 ( ) ;
XString8 OEMBoardFromSmbios = XString8 ( ) ;
UINT8 EnabledCores = 0 ;
2021-04-03 16:42:49 +02:00
// XStringW ConfigName; // Set but never used
2021-09-28 15:54:31 +02:00
UINT32 OptionsBits = 0 ;
UINT32 FlagsBits = 0 ;
2021-04-03 16:42:49 +02:00
2021-04-05 10:57:55 +02:00
XStringW BlockKexts = XStringW ( ) ;
2021-04-03 16:42:49 +02:00
// KernelAndKextPatches
2021-09-28 15:54:31 +02:00
XBool KextPatchesAllowed = true ;
XBool KernelPatchesAllowed = true ; //From GUI: Only for user patches, not internal Clover
2021-04-11 07:18:52 +02:00
UINT8 flagstate [ 32 ] = { 0 } ;
2021-10-19 19:57:27 +02:00
MacModel CurrentModel = MaxMacModel ;
2021-04-11 07:18:52 +02:00
2021-04-12 14:11:01 +02:00
UINT32 IgPlatform = UINT32 ( ) ; //could also be snb-platform-id
2021-04-03 16:42:49 +02:00
2021-03-22 13:40:01 +01:00
REFIT_CONFIG ( ) { } ;
2020-09-27 13:52:38 +02:00
REFIT_CONFIG ( const REFIT_CONFIG & other ) = delete ; // Can be defined if needed
2020-08-09 17:55:30 +02:00
const REFIT_CONFIG & operator = ( const REFIT_CONFIG & ) = delete ; // Can be defined if needed
~ REFIT_CONFIG ( ) { }
2021-09-28 15:54:31 +02:00
XBool isFastBoot ( ) { return SpecialBootMode | | gSettings . Boot . FastBoot ; }
2021-02-02 10:02:21 +01:00
2020-08-09 17:55:30 +02:00
} ;
2020-04-26 11:39:41 +02:00
extern REFIT_CONFIG GlobalConfig ;
2020-04-16 09:15:26 +02:00
2020-02-29 08:30:21 +01:00
EFI_STATUS
SetFSInjection (
IN LOADER_ENTRY * Entry
) ;
2020-10-03 19:02:31 +02:00
void
2020-02-29 08:30:21 +01:00
SetDevices (
LOADER_ENTRY * Entry
) ;
//
// check if this entry corresponds to Boot# variable and then set BootCurrent
//
2020-10-03 19:02:31 +02:00
void
2020-03-10 10:45:17 +01:00
SetBootCurrent ( REFIT_MENU_ITEM_BOOTNUM * LoadedEntry ) ;
2020-02-29 08:30:21 +01:00
2020-04-04 14:27:02 +02:00
2020-04-16 09:15:26 +02:00
2021-04-28 20:30:34 +02:00
//void
//GetDevices(void);
2020-04-16 09:15:26 +02:00
2021-04-28 20:30:34 +02:00
void afterGetUserSettings ( SETTINGS_DATA & gSettings ) ;
2020-04-16 09:15:26 +02:00
2020-08-09 17:55:30 +02:00
XStringW
2021-09-28 10:28:45 +02:00
GetOtherKextsDir ( XBool On ) ;
2020-04-16 09:15:26 +02:00
2020-11-12 22:25:56 +01:00
XStringW GetOSVersionKextsDir ( const MacOsVersion & OSVersion ) ;
2020-04-16 09:15:26 +02:00
EFI_STATUS
InjectKextsFromDir (
EFI_STATUS Status ,
CHAR16 * SrcDir
) ;
EFI_STATUS
2021-04-28 20:30:34 +02:00
ApplySettings ( void ) ;
2020-04-04 14:27:02 +02:00
2020-08-25 17:35:19 +02:00
2020-04-04 14:27:02 +02:00
# endif