mirror of
https://github.com/CloverHackyColor/CloverBootloader.git
synced 2024-12-24 16:27:42 +01:00
Get rid of AsciiSPrint.
This commit is contained in:
parent
5006d33c5d
commit
e734530b9b
@ -30,6 +30,9 @@
|
||||
9A57C25824192D650029A39F /* XUINTN.h in Headers */ = {isa = PBXBuildFile; fileRef = 9A57C25624192D650029A39F /* XUINTN.h */; };
|
||||
9A57C25B24192D710029A39F /* XUINTN_test.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9A57C25924192D710029A39F /* XUINTN_test.cpp */; };
|
||||
9A57C25C24192D710029A39F /* XUINTN_test.h in Headers */ = {isa = PBXBuildFile; fileRef = 9A57C25A24192D710029A39F /* XUINTN_test.h */; };
|
||||
9A637AE82430D927000B9474 /* XTheme.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A5E3262F2428F4EE002240E8 /* XTheme.cpp */; };
|
||||
9A637AE92430D928000B9474 /* XTheme.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A5E3262F2428F4EE002240E8 /* XTheme.cpp */; };
|
||||
9A637AEA2430D928000B9474 /* XTheme.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A5E3262F2428F4EE002240E8 /* XTheme.cpp */; };
|
||||
9A9D3B2224221563006D8CD9 /* printf_lite_test.h in Headers */ = {isa = PBXBuildFile; fileRef = 9A9D3B2024221562006D8CD9 /* printf_lite_test.h */; };
|
||||
9A9D3B2324221563006D8CD9 /* printf_lite-test.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9A9D3B2124221563006D8CD9 /* printf_lite-test.cpp */; };
|
||||
9A9D3B2624221570006D8CD9 /* unicode_conversions.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9A9D3B2424221570006D8CD9 /* unicode_conversions.cpp */; };
|
||||
@ -2149,6 +2152,7 @@
|
||||
9AC7802C24176C04005CDD5C /* ati.cpp in Sources */,
|
||||
9AC7802724176C04005CDD5C /* Net.cpp in Sources */,
|
||||
9AC7801924176C04005CDD5C /* kext_inject.cpp in Sources */,
|
||||
9A637AEA2430D928000B9474 /* XTheme.cpp in Sources */,
|
||||
9AC7803C24176C04005CDD5C /* guid.cpp in Sources */,
|
||||
9AC7806C24176C04005CDD5C /* bootscreen.cpp in Sources */,
|
||||
9A57C25724192D650029A39F /* XUINTN.cpp in Sources */,
|
||||
@ -2382,6 +2386,7 @@
|
||||
9AF41647242CD75C00D2644C /* ati.cpp in Sources */,
|
||||
9AF41648242CD75C00D2644C /* Net.cpp in Sources */,
|
||||
9AF41649242CD75C00D2644C /* kext_inject.cpp in Sources */,
|
||||
9A637AE92430D928000B9474 /* XTheme.cpp in Sources */,
|
||||
9AF4164A242CD75C00D2644C /* guid.cpp in Sources */,
|
||||
9AF4164B242CD75C00D2644C /* bootscreen.cpp in Sources */,
|
||||
9AF4164C242CD75C00D2644C /* XUINTN.cpp in Sources */,
|
||||
@ -2498,6 +2503,7 @@
|
||||
9AF41724242CDA5800D2644C /* ati.cpp in Sources */,
|
||||
9AF41725242CDA5800D2644C /* Net.cpp in Sources */,
|
||||
9AF41726242CDA5800D2644C /* kext_inject.cpp in Sources */,
|
||||
9A637AE82430D927000B9474 /* XTheme.cpp in Sources */,
|
||||
9AF41727242CDA5800D2644C /* guid.cpp in Sources */,
|
||||
9AF41728242CDA5800D2644C /* bootscreen.cpp in Sources */,
|
||||
9AF41729242CDA5800D2644C /* XUINTN.cpp in Sources */,
|
||||
|
@ -1068,7 +1068,7 @@ VOID findCPU(UINT8* dsdt, UINT32 length)
|
||||
if (!acpi_cpu_count) {
|
||||
for (i=0; i < acpi_cpu_max; i++) {
|
||||
acpi_cpu_name[i] = (__typeof_am__(acpi_cpu_name[i]))AllocateZeroPool(5);
|
||||
AsciiSPrint(acpi_cpu_name[i], 5, "CPU%1x", i);
|
||||
snprintf(acpi_cpu_name[i], 5, "CPU%1X", i);
|
||||
acpi_cpu_processor_id[i] = (UINT8)(i & 0x7F);
|
||||
}
|
||||
}
|
||||
@ -2438,11 +2438,11 @@ UINT32 FIXLPCB (UINT8 *dsdt, UINT32 len)
|
||||
pack = aml_add_package(met);
|
||||
aml_add_string(pack, "device-id");
|
||||
aml_add_byte_buffer(pack, dataLPC, 4);
|
||||
AsciiSPrint(NameCard, 32, "pci8086,3a18");
|
||||
snprintf(NameCard, sizeof(NameCard), "pci8086,3a18");
|
||||
aml_add_string(pack, "name");
|
||||
aml_add_string_buffer(pack, (CHAR8 *)&NameCard[0]);
|
||||
aml_add_string_buffer(pack, &NameCard[0]);
|
||||
aml_add_string(pack, "compatible");
|
||||
aml_add_string_buffer(pack, (CHAR8 *)&NameCard[0]);
|
||||
aml_add_string_buffer(pack, &NameCard[0]);
|
||||
|
||||
CustProperties(pack, DEV_LPC);
|
||||
aml_add_local0(met);
|
||||
@ -2961,7 +2961,7 @@ UINT32 FIXNetwork (UINT8 *dsdt, UINT32 len, UINT32 card)
|
||||
if (gSettings.FakeLAN) {
|
||||
FakeID = gSettings.FakeLAN >> 16;
|
||||
FakeVen = gSettings.FakeLAN & 0xFFFF;
|
||||
AsciiSPrint(NameCard, 32, "pci%x,%x\0", FakeVen, FakeID);
|
||||
snprintf(NameCard, 32, "pci%X,%X", FakeVen, FakeID);
|
||||
LowCase(NameCard);
|
||||
Netmodel[card] = get_net_model((FakeVen << 16) + FakeID);
|
||||
}
|
||||
@ -3164,7 +3164,7 @@ UINT32 FIXAirport (UINT8 *dsdt, UINT32 len)
|
||||
if (gSettings.FakeWIFI) {
|
||||
FakeID = gSettings.FakeWIFI >> 16;
|
||||
FakeVen = gSettings.FakeWIFI & 0xFFFF;
|
||||
AsciiSPrint(NameCard, 32, "pci%x,%x\0", FakeVen, FakeID);
|
||||
snprintf(NameCard, 32, "pci%X,%X", FakeVen, FakeID);
|
||||
LowCase(NameCard);
|
||||
}
|
||||
|
||||
@ -4081,18 +4081,18 @@ UINT32 FIXUSB (UINT8 *dsdt, UINT32 len)
|
||||
USBADR[i], USBADR2[i], k, device_name[10]);
|
||||
if (USB30[i]) {
|
||||
if (gSettings.NameXH00) {
|
||||
AsciiSPrint(UsbName[i], 5, "XH%02X", XhciCount++);
|
||||
snprintf(UsbName[i], 5, "XH%02llX", XhciCount++);
|
||||
} else {
|
||||
AsciiSPrint(UsbName[i], 5, "XHC%01X", XhciCount++);
|
||||
snprintf(UsbName[i], 5, "XHC%01llX", XhciCount++);
|
||||
}
|
||||
} else if (USB20[i]) {
|
||||
if (gSettings.NameEH00) {
|
||||
AsciiSPrint(UsbName[i], 5, "EH%02X", EhciCount++);
|
||||
snprintf(UsbName[i], 5, "EH%02llX", EhciCount++);
|
||||
} else {
|
||||
AsciiSPrint(UsbName[i], 5, "EHC%01X", EhciCount++);
|
||||
snprintf(UsbName[i], 5, "EHC%01llX", EhciCount++);
|
||||
}
|
||||
} else {
|
||||
AsciiSPrint(UsbName[i], 5, "USB%d", i);
|
||||
snprintf(UsbName[i], 5, "USB%d", i);
|
||||
}
|
||||
DBG(" %s\n", UsbName[i]);
|
||||
ReplaceName(dsdt + adr1, Size, device_name[10], UsbName[i]);
|
||||
|
@ -1317,9 +1317,9 @@ EFI_STATUS SetStartupDiskVolume (
|
||||
EFI_DEVICE_PATH_PROTOCOL *DevPath;
|
||||
EFI_DEVICE_PATH_PROTOCOL *FileDevPath;
|
||||
EFI_GUID *Guid;
|
||||
CHAR8 *EfiBootDevice;
|
||||
CONST CHAR8 *EfiBootDeviceTmpl;
|
||||
UINTN Size;
|
||||
// CHAR8 *EfiBootDevice;
|
||||
// CONST CHAR8 *EfiBootDeviceTmpl;
|
||||
// UINTN Size;
|
||||
UINT32 Attributes;
|
||||
|
||||
|
||||
@ -1363,25 +1363,37 @@ EFI_STATUS SetStartupDiskVolume (
|
||||
// (probably not needed at all)
|
||||
//
|
||||
if (Guid != NULL) {
|
||||
EfiBootDeviceTmpl =
|
||||
"<array><dict>"
|
||||
// EfiBootDeviceTmpl =
|
||||
// "<array><dict>"
|
||||
// "<key>IOMatch</key>"
|
||||
// "<dict>"
|
||||
// "<key>IOProviderClass</key><string>IOMedia</string>"
|
||||
// "<key>IOPropertyMatch</key>"
|
||||
// "<dict><key>UUID</key><string>%s</string></dict>"
|
||||
// "</dict>"
|
||||
// "</dict></array>";
|
||||
//
|
||||
// Size = AsciiStrLen (EfiBootDeviceTmpl) + 36;
|
||||
// EfiBootDevice = (__typeof__(EfiBootDevice))AllocateZeroPool(AsciiStrLen (EfiBootDeviceTmpl) + 36);
|
||||
// AsciiSPrint (EfiBootDevice, Size, EfiBootDeviceTmpl, strguid(Guid));
|
||||
// Size = AsciiStrLen (EfiBootDevice);
|
||||
// DBG (" * efi-boot-device: %s\n", EfiBootDevice);
|
||||
//
|
||||
// Status = SetNvramVariable (L"efi-boot-device", &gEfiAppleBootGuid, Attributes, Size, EfiBootDevice);
|
||||
// FreePool (EfiBootDevice);
|
||||
|
||||
XString EfiBootDevice;
|
||||
EfiBootDevice.SPrintf(
|
||||
"<array><dict>"
|
||||
"<key>IOMatch</key>"
|
||||
"<dict>"
|
||||
"<key>IOProviderClass</key><string>IOMedia</string>"
|
||||
"<key>IOPropertyMatch</key>"
|
||||
"<dict><key>UUID</key><string>%s</string></dict>"
|
||||
"</dict>"
|
||||
"</dict></array>";
|
||||
|
||||
Size = AsciiStrLen (EfiBootDeviceTmpl) + 36;
|
||||
EfiBootDevice = (__typeof__(EfiBootDevice))AllocateZeroPool(AsciiStrLen (EfiBootDeviceTmpl) + 36);
|
||||
AsciiSPrint (EfiBootDevice, Size, EfiBootDeviceTmpl, strguid(Guid));
|
||||
Size = AsciiStrLen (EfiBootDevice);
|
||||
DBG (" * efi-boot-device: %s\n", EfiBootDevice);
|
||||
|
||||
Status = SetNvramVariable (L"efi-boot-device", &gEfiAppleBootGuid, Attributes, Size, EfiBootDevice);
|
||||
|
||||
FreePool (EfiBootDevice);
|
||||
"</dict></array>", strguid(Guid));
|
||||
DBG (" * efi-boot-device: %s\n", EfiBootDevice.c_str());
|
||||
Status = SetNvramVariable (L"efi-boot-device", &gEfiAppleBootGuid, Attributes, EfiBootDevice.size(), EfiBootDevice.c_str());
|
||||
}
|
||||
|
||||
return Status;
|
||||
|
@ -88,6 +88,8 @@ extern "C" {
|
||||
|
||||
// cpp_foundation objects has to be included before lib.h
|
||||
#ifdef __cplusplus
|
||||
#include "../cpp_foundation/XString.h"
|
||||
#include "../cpp_foundation/XStringW.h"
|
||||
#include "../cpp_foundation/XStringWP.h"
|
||||
#include "../cpp_foundation/XArray.h"
|
||||
#include "../cpp_foundation/XObjArray.h"
|
||||
@ -181,8 +183,7 @@ extern "C" {
|
||||
#define SYSTEM_LOG L"EFI\\CLOVER\\misc\\system.log"
|
||||
#define DEBUG_LOG L"EFI\\CLOVER\\misc\\debug.log"
|
||||
#define PREWAKE_LOG L"EFI\\CLOVER\\misc\\prewake.log"
|
||||
//#define MsgLog(x...) {AsciiSPrint(msgCursor, MSG_LOG_SIZE, x); while(*msgCursor){msgCursor++;}}
|
||||
//#define MsgLog(...) {AsciiSPrint(msgCursor, (MSG_LOG_SIZE-(msgCursor-msgbuf)), __VA_ARGS__); while(*msgCursor){msgCursor++;}}
|
||||
|
||||
#ifndef DEBUG_ALL
|
||||
#define MsgLog(...) DebugLog(1, __VA_ARGS__)
|
||||
#else
|
||||
|
@ -5387,17 +5387,17 @@ ParseSMBIOSSettings(
|
||||
} else if ((i[3] == j[3]) && (i[4] == j[4])) {
|
||||
//DBG ("Found same BiosReleaseDate in clover and config\n");
|
||||
} else {
|
||||
AsciiSPrint (Res1, 9, "%c%c/%c%c/%c%c\n", j[0], j[1], j[3], j[4], j[8], j[9]);
|
||||
snprintf (Res1, 9, "%c%c/%c%c/%c%c\n", j[0], j[1], j[3], j[4], j[8], j[9]);
|
||||
AsciiStrCpyS (gSettings.ReleaseDate, 64, Res1);
|
||||
//DBG ("Using latest BiosReleaseDate from config\n");
|
||||
}
|
||||
} else {
|
||||
AsciiSPrint (Res1, 9, "%c%c/%c%c/%c%c\n", j[0], j[1], j[3], j[4], j[8], j[9]);
|
||||
snprintf (Res1, 9, "%c%c/%c%c/%c%c\n", j[0], j[1], j[3], j[4], j[8], j[9]);
|
||||
AsciiStrCpyS (gSettings.ReleaseDate, 64, Res1);
|
||||
//DBG ("Using latest BiosReleaseDate from config\n");
|
||||
}
|
||||
} else {
|
||||
AsciiSPrint (Res1, 9, "%c%c/%c%c/%c%c\n", j[0], j[1], j[3], j[4], j[8], j[9]);
|
||||
snprintf (Res1, 9, "%c%c/%c%c/%c%c\n", j[0], j[1], j[3], j[4], j[8], j[9]);
|
||||
AsciiStrCpyS (gSettings.ReleaseDate, 64, Res1);
|
||||
//DBG ("Using latest BiosReleaseDate from config\n");
|
||||
}
|
||||
@ -5444,17 +5444,17 @@ ParseSMBIOSSettings(
|
||||
} else if ((i[3] == j[3]) && (i[4] == j[4])) {
|
||||
//DBG ("Found same BiosReleaseDate in clover and config\n");
|
||||
} else {
|
||||
AsciiSPrint (Res2, 11, "%c%c/%c%c/20%c%c\n", j[0], j[1], j[3], j[4], j[6], j[7]);
|
||||
snprintf (Res2, 11, "%c%c/%c%c/20%c%c\n", j[0], j[1], j[3], j[4], j[6], j[7]);
|
||||
AsciiStrCpyS (gSettings.ReleaseDate, 64, Res2);
|
||||
//DBG ("Using latest BiosReleaseDate from config\n");
|
||||
}
|
||||
} else {
|
||||
AsciiSPrint (Res2, 11, "%c%c/%c%c/20%c%c\n", j[0], j[1], j[3], j[4], j[6], j[7]);
|
||||
snprintf (Res2, 11, "%c%c/%c%c/20%c%c\n", j[0], j[1], j[3], j[4], j[6], j[7]);
|
||||
AsciiStrCpyS (gSettings.ReleaseDate, 64, Res2);
|
||||
//DBG ("Using latest BiosReleaseDate from config\n");
|
||||
}
|
||||
} else {
|
||||
AsciiSPrint (Res2, 11, "%c%c/%c%c/20%c%c\n", j[0], j[1], j[3], j[4], j[6], j[7]);
|
||||
snprintf (Res2, 11, "%c%c/%c%c/20%c%c\n", j[0], j[1], j[3], j[4], j[6], j[7]);
|
||||
AsciiStrCpyS (gSettings.ReleaseDate, 64, Res2);
|
||||
//DBG ("Using latest BiosReleaseDate from config\n");
|
||||
}
|
||||
@ -5470,11 +5470,11 @@ ParseSMBIOSSettings(
|
||||
}
|
||||
|
||||
if ((AsciiStrLen(i) == 8)) {
|
||||
AsciiSPrint (Res1, 9, "%c%c/%c%c/%c%c\n", j[3], j[4], j[5], j[6], j[1], j[2]);
|
||||
snprintf (Res1, 9, "%c%c/%c%c/%c%c\n", j[3], j[4], j[5], j[6], j[1], j[2]);
|
||||
AsciiStrCpyS (gSettings.ReleaseDate, 64, Res1);
|
||||
//DBG ("Using the date of used BiosVersion\n");
|
||||
} else if ((AsciiStrLen(i) == 10)) {
|
||||
AsciiSPrint (Res2, 11, "%c%c/%c%c/20%c%c\n", j[3], j[4], j[5], j[6], j[1], j[2]);
|
||||
snprintf (Res2, 11, "%c%c/%c%c/20%c%c\n", j[3], j[4], j[5], j[6], j[1], j[2]);
|
||||
AsciiStrCpyS (gSettings.ReleaseDate, 64, Res2);
|
||||
//DBG ("Using the date of used BiosVersion\n");
|
||||
}
|
||||
@ -5497,11 +5497,11 @@ ParseSMBIOSSettings(
|
||||
}
|
||||
|
||||
if ((AsciiStrLen(i) == 8)) {
|
||||
AsciiSPrint (Res1, 9, "%c%c/%c%c/%c%c\n", j[3], j[4], j[5], j[6], j[1], j[2]);
|
||||
snprintf (Res1, 9, "%c%c/%c%c/%c%c\n", j[3], j[4], j[5], j[6], j[1], j[2]);
|
||||
AsciiStrCpyS (gSettings.ReleaseDate, 64, Res1);
|
||||
//DBG ("BiosReleaseDate: not set, Using the date of used BiosVersion\n");
|
||||
} else if ((AsciiStrLen(i) == 10)) {
|
||||
AsciiSPrint (Res2, 11, "%c%c/%c%c/20%c%c\n", j[3], j[4], j[5], j[6], j[1], j[2]);
|
||||
snprintf (Res2, 11, "%c%c/%c%c/20%c%c\n", j[3], j[4], j[5], j[6], j[1], j[2]);
|
||||
AsciiStrCpyS (gSettings.ReleaseDate, 64, Res2);
|
||||
//DBG ("BiosReleaseDate: not set, Using the date of used BiosVersion\n");
|
||||
}
|
||||
@ -5992,7 +5992,7 @@ GetUserSettings(
|
||||
Dev = hexstrtouint8(&Str[3]);
|
||||
Func = hexstrtouint8(&Str[6]);
|
||||
DeviceAddr = PCIADDR(Bus, Dev, Func);
|
||||
AsciiSPrint(Label, 64, "[%02x:%02x.%02x] ", Bus, Dev, Func);
|
||||
snprintf(Label, 64, "[%02llX:%02llX.%02llX] ", Bus, Dev, Func);
|
||||
DBG(" %s", Label);
|
||||
} else {
|
||||
DBG (" no PciAddr\n");
|
||||
@ -6465,12 +6465,12 @@ GetUserSettings(
|
||||
|
||||
Prop3 = GetProperty (Prop2, "Comment");
|
||||
if (Prop3 != NULL && (Prop3->type == kTagTypeString) && Prop3->string) {
|
||||
AsciiSPrint(DSDTPatchesLabel, 255, "%a", Prop3->string);
|
||||
snprintf(DSDTPatchesLabel, 255, "%s", Prop3->string);
|
||||
} else {
|
||||
AsciiSPrint(DSDTPatchesLabel, 255, " (NoLabel)");
|
||||
snprintf(DSDTPatchesLabel, 255, " (NoLabel)");
|
||||
}
|
||||
gSettings.PatchDsdtLabel[i] = (__typeof_am__(gSettings.PatchDsdtLabel[i]))AllocateZeroPool(256);
|
||||
AsciiSPrint(gSettings.PatchDsdtLabel[i], 255, "%a", DSDTPatchesLabel);
|
||||
snprintf(gSettings.PatchDsdtLabel[i], 255, "%s", DSDTPatchesLabel);
|
||||
DBG(" (%s)", gSettings.PatchDsdtLabel[i]);
|
||||
|
||||
FreePool(DSDTPatchesLabel);
|
||||
@ -7020,9 +7020,9 @@ GetUserSettings(
|
||||
}
|
||||
Prop2 = GetProperty (Prop3, "Name");
|
||||
if (Prop2 && (Prop2->type == kTagTypeString) && Prop2->string) {
|
||||
AsciiSPrint (SlotDevice->SlotName, 31, "%a", Prop2->string);
|
||||
snprintf (SlotDevice->SlotName, 31, "%s", Prop2->string);
|
||||
} else {
|
||||
AsciiSPrint (SlotDevice->SlotName, 31, "PCI Slot %d", DeviceN);
|
||||
snprintf (SlotDevice->SlotName, 31, "PCI Slot %lld", DeviceN);
|
||||
}
|
||||
|
||||
DBG (" - %s\n", SlotDevice->SlotName);
|
||||
@ -7537,49 +7537,49 @@ CHAR8 *GetOSVersion(IN LOADER_ENTRY *Entry)
|
||||
// s = SearchString(targetString, fileLen, "Running OS Build: Mac OS X ", 27);
|
||||
s = AsciiStrStr(targetString, "Running OS Build: Mac OS X ");
|
||||
if (s[31] == ' ') {
|
||||
AsciiSPrint (Res5, 5, "%c%c.%c\n", s[27], s[28], s[30]);
|
||||
snprintf (Res5, 5, "%c%c.%c\n", s[27], s[28], s[30]);
|
||||
OSVersion = (__typeof__(OSVersion))AllocateCopyPool (AsciiStrSize (Res5), Res5);
|
||||
if (s[38] == ')') {
|
||||
AsciiSPrint (Res6, 6, "%c%c%c%c%c\n", s[33], s[34], s[35], s[36], s[37]);
|
||||
snprintf (Res6, 6, "%c%c%c%c%c\n", s[33], s[34], s[35], s[36], s[37]);
|
||||
Entry->BuildVersion = (__typeof__(Entry->BuildVersion))AllocateCopyPool (AsciiStrSize (Res6), Res6);
|
||||
} else if (s[39] == ')') {
|
||||
AsciiSPrint (Res7, 7, "%c%c%c%c%c%c\n", s[33], s[34], s[35], s[36], s[37], s[38]);
|
||||
snprintf (Res7, 7, "%c%c%c%c%c%c\n", s[33], s[34], s[35], s[36], s[37], s[38]);
|
||||
Entry->BuildVersion = (__typeof__(Entry->BuildVersion))AllocateCopyPool (AsciiStrSize (Res7), Res7);
|
||||
}
|
||||
} else if (s[31] == '.') {
|
||||
AsciiSPrint (Res7, 7, "%c%c.%c.%c\n", s[27], s[28], s[30], s[32]);
|
||||
snprintf (Res7, 7, "%c%c.%c.%c\n", s[27], s[28], s[30], s[32]);
|
||||
OSVersion = (__typeof__(OSVersion))AllocateCopyPool (AsciiStrSize (Res7), Res7);
|
||||
if (s[40] == ')') {
|
||||
AsciiSPrint (Res6, 6, "%c%c%c%c%c\n", s[35], s[36], s[37], s[38], s[39]);
|
||||
snprintf (Res6, 6, "%c%c%c%c%c\n", s[35], s[36], s[37], s[38], s[39]);
|
||||
Entry->BuildVersion = (__typeof__(Entry->BuildVersion))AllocateCopyPool (AsciiStrSize (Res6), Res6);
|
||||
} else if (s[41] == ')') {
|
||||
AsciiSPrint (Res7, 7, "%c%c%c%c%c%c\n", s[35], s[36], s[37], s[38], s[39], s[40]);
|
||||
snprintf (Res7, 7, "%c%c%c%c%c%c\n", s[35], s[36], s[37], s[38], s[39], s[40]);
|
||||
Entry->BuildVersion = (__typeof__(Entry->BuildVersion))AllocateCopyPool (AsciiStrSize (Res7), Res7);
|
||||
}
|
||||
} else if (s[32] == ' ') {
|
||||
AsciiSPrint (Res6, 6, "%c%c.%c%c\n", s[27], s[28], s[30], s[31]);
|
||||
snprintf (Res6, 6, "%c%c.%c%c\n", s[27], s[28], s[30], s[31]);
|
||||
OSVersion = (__typeof__(OSVersion))AllocateCopyPool (AsciiStrSize (Res6), Res6);
|
||||
if (s[39] == ')') {
|
||||
AsciiSPrint (Res6, 6, "%c%c%c%c%c\n", s[34], s[35], s[36], s[37], s[38]);
|
||||
snprintf (Res6, 6, "%c%c%c%c%c\n", s[34], s[35], s[36], s[37], s[38]);
|
||||
Entry->BuildVersion = (__typeof__(Entry->BuildVersion))AllocateCopyPool (AsciiStrSize (Res6), Res6);
|
||||
} else if (s[40] == ')') {
|
||||
AsciiSPrint (Res7, 7, "%c%c%c%c%c%c\n", s[34], s[35], s[36], s[37], s[38], s[39]);
|
||||
snprintf (Res7, 7, "%c%c%c%c%c%c\n", s[34], s[35], s[36], s[37], s[38], s[39]);
|
||||
Entry->BuildVersion = (__typeof__(Entry->BuildVersion))AllocateCopyPool (AsciiStrSize (Res7), Res7);
|
||||
} else if (s[41] == ')') {
|
||||
AsciiSPrint (Res8, 8, "%c%c%c%c%c%c%c\n", s[34], s[35], s[36], s[37], s[38], s[39], s[40]);
|
||||
snprintf (Res8, 8, "%c%c%c%c%c%c%c\n", s[34], s[35], s[36], s[37], s[38], s[39], s[40]);
|
||||
Entry->BuildVersion = (__typeof__(Entry->BuildVersion))AllocateCopyPool (AsciiStrSize (Res8), Res8);
|
||||
}
|
||||
} else if (s[32] == '.') {
|
||||
AsciiSPrint (Res8, 8, "%c%c.%c%c.%c\n", s[27], s[28], s[30], s[31], s[33]);
|
||||
snprintf (Res8, 8, "%c%c.%c%c.%c\n", s[27], s[28], s[30], s[31], s[33]);
|
||||
OSVersion = (__typeof__(OSVersion))AllocateCopyPool (AsciiStrSize (Res8), Res8);
|
||||
if (s[41] == ')') {
|
||||
AsciiSPrint (Res6, 6, "%c%c%c%c%c\n", s[36], s[37], s[38], s[39], s[40]);
|
||||
snprintf (Res6, 6, "%c%c%c%c%c\n", s[36], s[37], s[38], s[39], s[40]);
|
||||
Entry->BuildVersion = (__typeof__(Entry->BuildVersion))AllocateCopyPool (AsciiStrSize (Res6), Res6);
|
||||
} else if (s[42] == ')') {
|
||||
AsciiSPrint (Res7, 7, "%c%c%c%c%c%c\n", s[36], s[37], s[38], s[39], s[40], s[41]);
|
||||
snprintf (Res7, 7, "%c%c%c%c%c%c\n", s[36], s[37], s[38], s[39], s[40], s[41]);
|
||||
Entry->BuildVersion = (__typeof__(Entry->BuildVersion))AllocateCopyPool (AsciiStrSize (Res7), Res7);
|
||||
} else if (s[43] == ')') {
|
||||
AsciiSPrint (Res8, 8, "%c%c%c%c%c%c%c\n", s[36], s[37], s[38], s[39], s[40], s[41], s[42]);
|
||||
snprintf (Res8, 8, "%c%c%c%c%c%c%c\n", s[36], s[37], s[38], s[39], s[40], s[41], s[42]);
|
||||
Entry->BuildVersion = (__typeof__(Entry->BuildVersion))AllocateCopyPool (AsciiStrSize (Res8), Res8);
|
||||
}
|
||||
}
|
||||
@ -7909,8 +7909,8 @@ GetDevices ()
|
||||
}
|
||||
} while (radeon_cards[i++].device_id != 0);
|
||||
|
||||
AsciiSPrint (gfx->Model, 64, "%a", info->model_name);
|
||||
AsciiSPrint (gfx->Config, 64, "%a", card_configs[info->cfg_name].name);
|
||||
snprintf (gfx->Model, 64, "%s", info->model_name);
|
||||
snprintf (gfx->Config, 64, "%s", card_configs[info->cfg_name].name);
|
||||
gfx->Ports = card_configs[info->cfg_name].ports;
|
||||
DBG (" - GFX: Model=%s (ATI/AMD)\n", gfx->Model);
|
||||
|
||||
@ -7929,14 +7929,14 @@ GetDevices ()
|
||||
SlotDevice->BusNum = (UINT8)Bus;
|
||||
SlotDevice->DevFuncNum = (UINT8)((Device << 3) | (Function & 0x07));
|
||||
SlotDevice->Valid = TRUE;
|
||||
AsciiSPrint (SlotDevice->SlotName, 31, "PCI Slot 0");
|
||||
snprintf (SlotDevice->SlotName, 31, "PCI Slot 0");
|
||||
SlotDevice->SlotID = 1;
|
||||
SlotDevice->SlotType = SlotTypePciExpressX16;
|
||||
break;
|
||||
|
||||
case 0x8086:
|
||||
gfx->Vendor = Intel;
|
||||
AsciiSPrint (gfx->Model, 64, "%a", get_gma_model (Pci.Hdr.DeviceId));
|
||||
snprintf (gfx->Model, 64, "%s", get_gma_model (Pci.Hdr.DeviceId));
|
||||
DBG (" - GFX: Model=%s (Intel)\n", gfx->Model);
|
||||
gfx->Ports = 1;
|
||||
gfx->Connectors = (1 << NGFX);
|
||||
@ -7979,10 +7979,10 @@ GetDevices ()
|
||||
CardFamily = "NVidia unknown";
|
||||
}
|
||||
|
||||
AsciiSPrint (
|
||||
snprintf (
|
||||
gfx->Model,
|
||||
64,
|
||||
"%a",
|
||||
"%s",
|
||||
get_nvidia_model (((Pci.Hdr.VendorId << 16) | Pci.Hdr.DeviceId),
|
||||
((Pci.Device.SubsystemVendorID << 16) | Pci.Device.SubsystemID),
|
||||
NULL) //NULL: get from generic lists
|
||||
@ -7996,14 +7996,14 @@ GetDevices ()
|
||||
SlotDevice->BusNum = (UINT8)Bus;
|
||||
SlotDevice->DevFuncNum = (UINT8)((Device << 3) | (Function & 0x07));
|
||||
SlotDevice->Valid = TRUE;
|
||||
AsciiSPrint (SlotDevice->SlotName, 31, "PCI Slot 0");
|
||||
snprintf (SlotDevice->SlotName, 31, "PCI Slot 0");
|
||||
SlotDevice->SlotID = 1;
|
||||
SlotDevice->SlotType = SlotTypePciExpressX16;
|
||||
break;
|
||||
|
||||
default:
|
||||
gfx->Vendor = Unknown;
|
||||
AsciiSPrint (gfx->Model, 64, "pci%x,%x", Pci.Hdr.VendorId, Pci.Hdr.DeviceId);
|
||||
snprintf (gfx->Model, 64, "pci%X,%X", Pci.Hdr.VendorId, Pci.Hdr.DeviceId);
|
||||
gfx->Ports = 1;
|
||||
gfx->Connectors = (1 << NGFX);
|
||||
gfx->ConnChanged = FALSE;
|
||||
@ -8021,7 +8021,7 @@ GetDevices ()
|
||||
SlotDevice->BusNum = (UINT8)Bus;
|
||||
SlotDevice->DevFuncNum = (UINT8)((Device << 3) | (Function & 0x07));
|
||||
SlotDevice->Valid = TRUE;
|
||||
AsciiSPrint (SlotDevice->SlotName, 31, "AirPort");
|
||||
snprintf (SlotDevice->SlotName, 31, "AirPort");
|
||||
SlotDevice->SlotID = 0;
|
||||
SlotDevice->SlotType = SlotTypePciExpressX1;
|
||||
DBG(" - WIFI: Vendor=%d", Pci.Hdr.VendorId);
|
||||
@ -8059,7 +8059,7 @@ GetDevices ()
|
||||
SlotDevice->BusNum = (UINT8)Bus;
|
||||
SlotDevice->DevFuncNum = (UINT8)((Device << 3) | (Function & 0x07));
|
||||
SlotDevice->Valid = TRUE;
|
||||
AsciiSPrint (SlotDevice->SlotName, 31, "Ethernet");
|
||||
snprintf (SlotDevice->SlotName, 31, "Ethernet");
|
||||
SlotDevice->SlotID = 2;
|
||||
SlotDevice->SlotType = SlotTypePciExpressX1;
|
||||
gLanVendor[nLanCards] = Pci.Hdr.VendorId;
|
||||
@ -8104,7 +8104,7 @@ GetDevices ()
|
||||
SlotDevice->BusNum = (UINT8)Bus;
|
||||
SlotDevice->DevFuncNum = (UINT8)((Device << 3) | (Function & 0x07));
|
||||
SlotDevice->Valid = TRUE;
|
||||
AsciiSPrint (SlotDevice->SlotName, 31, "FireWire");
|
||||
snprintf (SlotDevice->SlotName, 31, "FireWire");
|
||||
SlotDevice->SlotID = 3;
|
||||
SlotDevice->SlotType = SlotTypePciExpressX4;
|
||||
}
|
||||
@ -8131,7 +8131,7 @@ GetDevices ()
|
||||
SlotDevice->BusNum = (UINT8)Bus;
|
||||
SlotDevice->DevFuncNum = (UINT8)((Device << 3) | (Function & 0x07));
|
||||
SlotDevice->Valid = TRUE;
|
||||
AsciiSPrint (SlotDevice->SlotName, 31, "HDMI port");
|
||||
snprintf (SlotDevice->SlotName, 31, "HDMI port");
|
||||
SlotDevice->SlotID = 5;
|
||||
SlotDevice->SlotType = SlotTypePciExpressX4;
|
||||
}
|
||||
|
@ -339,10 +339,10 @@ SSDT_TABLE *generate_pss_ssdt(UINTN Number)
|
||||
AML_CHUNK* metPCT;
|
||||
AML_CHUNK* root = aml_create_node(NULL);
|
||||
aml_add_buffer(root, (UINT8*)&pss_ssdt_header[0], sizeof(pss_ssdt_header)); // SSDT header
|
||||
AsciiSPrint(name, 31, "%a%4a", acpi_cpu_score, acpi_cpu_name[0]);
|
||||
AsciiSPrint(name1, 31, "%a%4aPSS_", acpi_cpu_score, acpi_cpu_name[0]);
|
||||
AsciiSPrint(name2, 31, "%a%4aPCT_", acpi_cpu_score, acpi_cpu_name[0]);
|
||||
AsciiSPrint(name3, 31, "%a%4a_PPC", acpi_cpu_score, acpi_cpu_name[0]);
|
||||
snprintf(name, 31, "%s%4s", acpi_cpu_score, acpi_cpu_name[0]);
|
||||
snprintf(name1, 31, "%s%4sPSS_", acpi_cpu_score, acpi_cpu_name[0]);
|
||||
snprintf(name2, 31, "%s%4sPCT_", acpi_cpu_score, acpi_cpu_name[0]);
|
||||
snprintf(name3, 31, "%s%4s_PPC", acpi_cpu_score, acpi_cpu_name[0]);
|
||||
|
||||
scop = aml_add_scope(root, name);
|
||||
|
||||
@ -406,7 +406,7 @@ SSDT_TABLE *generate_pss_ssdt(UINTN Number)
|
||||
|
||||
// Add CPUs
|
||||
for (decltype(Number) i = 1; i < Number; i++) {
|
||||
AsciiSPrint(name, 31, "%a%4a", acpi_cpu_score, acpi_cpu_name[i]);
|
||||
snprintf(name, 31, "%s%4s", acpi_cpu_score, acpi_cpu_name[i]);
|
||||
scop = aml_add_scope(root, name);
|
||||
metPSS = aml_add_method(scop, "_PSS", 0);
|
||||
aml_add_return_name(metPSS, name1);
|
||||
@ -488,8 +488,8 @@ SSDT_TABLE *generate_cst_ssdt(EFI_ACPI_2_0_FIXED_ACPI_DESCRIPTION_TABLE* fadt, U
|
||||
|
||||
root = aml_create_node(NULL);
|
||||
aml_add_buffer(root, cst_ssdt_header, sizeof(cst_ssdt_header)); // SSDT header
|
||||
AsciiSPrint(name0, 31, "%a%4a", acpi_cpu_score, acpi_cpu_name[0]);
|
||||
AsciiSPrint(name1, 31, "%a%4aCST_", acpi_cpu_score, acpi_cpu_name[0]);
|
||||
snprintf(name0, 31, "%s%4s", acpi_cpu_score, acpi_cpu_name[0]);
|
||||
snprintf(name1, 31, "%s%4sCST_", acpi_cpu_score, acpi_cpu_name[0]);
|
||||
scop = aml_add_scope(root, name0);
|
||||
name = aml_add_name(scop, "CST_");
|
||||
pack = aml_add_package(name);
|
||||
@ -632,7 +632,7 @@ SSDT_TABLE *generate_cst_ssdt(EFI_ACPI_2_0_FIXED_ACPI_DESCRIPTION_TABLE* fadt, U
|
||||
|
||||
// Aliases
|
||||
for (i = 1; i < Number; i++) {
|
||||
AsciiSPrint(name2, 31, "%a%4a", acpi_cpu_score, acpi_cpu_name[i]);
|
||||
snprintf(name2, 31, "%s%4s", acpi_cpu_score, acpi_cpu_name[i]);
|
||||
|
||||
scop = aml_add_scope(root, name2);
|
||||
met = aml_add_method(scop, "_CST", 0);
|
||||
|
@ -1322,7 +1322,7 @@ BOOLEAN get_name_pci_val(value_t *val, INTN index, BOOLEAN Sier)
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
AsciiSPrint(pciName, 15, "pci1002,%x", gSettings.FakeATI >> 16);
|
||||
snprintf(pciName, 15, "pci1002,%X", gSettings.FakeATI >> 16);
|
||||
LowCase(pciName);
|
||||
val->type = kStr;
|
||||
val->size = 13;
|
||||
@ -1330,7 +1330,6 @@ BOOLEAN get_name_pci_val(value_t *val, INTN index, BOOLEAN Sier)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
CONST CHAR8* NamePolaris = "AMD Radeon %a";
|
||||
BOOLEAN get_model_val(value_t *val, INTN index, BOOLEAN Sier)
|
||||
{
|
||||
CHAR8 *ModelName = (__typeof__(ModelName))AllocateZeroPool(35);
|
||||
@ -1344,25 +1343,25 @@ BOOLEAN get_model_val(value_t *val, INTN index, BOOLEAN Sier)
|
||||
} else {
|
||||
switch (card->pci_dev->revision) {
|
||||
case 0xC4:
|
||||
AsciiSPrint(ModelName, 35, NamePolaris, "Pro 550");
|
||||
snprintf(ModelName, 35, "AMD Radeon %s", "Pro 550");
|
||||
break;
|
||||
case 0xC7:
|
||||
AsciiSPrint(ModelName, 35, NamePolaris, "RX 480");
|
||||
snprintf(ModelName, 35, "AMD Radeon %s", "RX 480");
|
||||
break;
|
||||
case 0xC5:
|
||||
case 0xCF:
|
||||
case 0xD7:
|
||||
case 0xE0:
|
||||
AsciiSPrint(ModelName, 35, NamePolaris, "RX 470");
|
||||
snprintf(ModelName, 35, "AMD Radeon %s", "RX 470");
|
||||
break;
|
||||
case 0xC2:
|
||||
case 0xC6:
|
||||
case 0xEF:
|
||||
AsciiSPrint(ModelName, 35, NamePolaris, "RX 570");
|
||||
snprintf(ModelName, 35, "AMD Radeon %s", "RX 570");
|
||||
break;
|
||||
|
||||
default:
|
||||
AsciiSPrint(ModelName, 35, NamePolaris, "RX 580");
|
||||
snprintf(ModelName, 35, "AMD Radeon %s", "RX 580");
|
||||
break;
|
||||
}
|
||||
val->size = (UINT32)AsciiStrLen(ModelName);
|
||||
@ -2063,13 +2062,13 @@ static BOOLEAN init_card(pci_dt_t *pci_dev)
|
||||
}
|
||||
//
|
||||
name = (__typeof__(name))AllocateZeroPool(24);
|
||||
AsciiSPrint(name, 24, "ATY,%a", card->cfg_name);
|
||||
snprintf(name, 24, "ATY,%s", card->cfg_name);
|
||||
aty_name.type = kStr;
|
||||
aty_name.size = (UINT32)AsciiStrLen(name);
|
||||
aty_name.data = (UINT8 *)name;
|
||||
|
||||
name_parent = (__typeof__(name_parent))AllocateZeroPool(24);
|
||||
AsciiSPrint(name_parent, 24, "ATY,%aParent", card->cfg_name);
|
||||
snprintf(name_parent, 24, "ATY,%sParent", card->cfg_name);
|
||||
aty_nameparent.type = kStr;
|
||||
aty_nameparent.size = (UINT32)AsciiStrLen(name_parent);
|
||||
aty_nameparent.data = (UINT8 *)name_parent;
|
||||
@ -2114,7 +2113,7 @@ BOOLEAN setup_ati_devprop(LOADER_ENTRY *Entry, pci_dt_t *ati_dev)
|
||||
FakeID = gSettings.FakeATI >> 16;
|
||||
devprop_add_value(card->device, "device-id", (UINT8*)&FakeID, 4);
|
||||
devprop_add_value(card->device, "ATY,DeviceID", (UINT8*)&FakeID, 2);
|
||||
AsciiSPrint(compatible, 64, "pci1002,%04x", FakeID);
|
||||
snprintf(compatible, 64, "pci1002,%04X", FakeID);
|
||||
LowCase(compatible);
|
||||
devprop_add_value(card->device, "@0,compatible", (UINT8*)&compatible[0], 12);
|
||||
FakeID = gSettings.FakeATI & 0xFFFF;
|
||||
|
@ -78,7 +78,7 @@ VOID AddCard(CONST CHAR8* Model, UINT32 Id, UINT32 SubId, UINT64 VideoRam, UINTN
|
||||
new_card->VideoRam = VideoRam;
|
||||
new_card->VideoPorts = VideoPorts;
|
||||
new_card->LoadVBios = LoadVBios;
|
||||
AsciiSPrint(new_card->Model, 64, "%a", Model);
|
||||
snprintf(new_card->Model, 64, "%s", Model);
|
||||
InsertTailList (&gCardList, (LIST_ENTRY *)(((UINT8 *)new_card) + OFFSET_OF(CARDLIST, Link)));
|
||||
}
|
||||
}
|
||||
|
@ -285,17 +285,17 @@ CHAR8 *devprop_generate_string(DevPropString *StringBuf)
|
||||
if(!buffer)
|
||||
return NULL;
|
||||
|
||||
AsciiSPrint(buffer, len, "%08x%08x%04x%04x", SwapBytes32(StringBuf->length), StringBuf->WHAT2,
|
||||
snprintf(buffer, len, "%08X%08X%04X%04X", SwapBytes32(StringBuf->length), StringBuf->WHAT2,
|
||||
SwapBytes16(StringBuf->numentries), StringBuf->WHAT3);
|
||||
buffer += 24;
|
||||
|
||||
while(i < StringBuf->numentries) {
|
||||
UINT8 *dataptr = StringBuf->entries[i]->data;
|
||||
AsciiSPrint(buffer, len, "%08x%04x%04x", SwapBytes32(StringBuf->entries[i]->length),
|
||||
snprintf(buffer, len, "%08X%04X%04X", SwapBytes32(StringBuf->entries[i]->length),
|
||||
SwapBytes16(StringBuf->entries[i]->numentries), StringBuf->entries[i]->WHAT2); //FIXME: wrong buffer sizes!
|
||||
|
||||
buffer += 16;
|
||||
AsciiSPrint(buffer, len, "%02x%02x%04x%08x%08x", StringBuf->entries[i]->acpi_dev_path.type,
|
||||
snprintf(buffer, len, "%02X%02X%04X%08X%08X", StringBuf->entries[i]->acpi_dev_path.type,
|
||||
StringBuf->entries[i]->acpi_dev_path.subtype,
|
||||
SwapBytes16(StringBuf->entries[i]->acpi_dev_path.length),
|
||||
SwapBytes32(StringBuf->entries[i]->acpi_dev_path._HID),
|
||||
@ -303,7 +303,7 @@ CHAR8 *devprop_generate_string(DevPropString *StringBuf)
|
||||
|
||||
buffer += 24;
|
||||
for(x = 0; x < StringBuf->entries[i]->num_pci_devpaths; x++) {
|
||||
AsciiSPrint(buffer, len, "%02x%02x%04x%02x%02x", StringBuf->entries[i]->pci_dev_path[x].type,
|
||||
snprintf(buffer, len, "%02X%02X%04X%02X%02X", StringBuf->entries[i]->pci_dev_path[x].type,
|
||||
StringBuf->entries[i]->pci_dev_path[x].subtype,
|
||||
SwapBytes16(StringBuf->entries[i]->pci_dev_path[x].length),
|
||||
StringBuf->entries[i]->pci_dev_path[x].function,
|
||||
@ -311,13 +311,13 @@ CHAR8 *devprop_generate_string(DevPropString *StringBuf)
|
||||
buffer += 12;
|
||||
}
|
||||
|
||||
AsciiSPrint(buffer, len, "%02x%02x%04x", StringBuf->entries[i]->path_end.type,
|
||||
snprintf(buffer, len, "%02X%02X%04X", StringBuf->entries[i]->path_end.type,
|
||||
StringBuf->entries[i]->path_end.subtype,
|
||||
SwapBytes16(StringBuf->entries[i]->path_end.length));
|
||||
|
||||
buffer += 8;
|
||||
for(x = 0; x < (StringBuf->entries[i]->length) - (24 + (6 * StringBuf->entries[i]->num_pci_devpaths)); x++) {
|
||||
AsciiSPrint(buffer, len, "%02x", *dataptr++);
|
||||
snprintf(buffer, len, "%02X", *dataptr++);
|
||||
buffer += 2;
|
||||
}
|
||||
i++;
|
||||
@ -408,7 +408,7 @@ BOOLEAN set_eth_props(pci_dt_t *eth_dev)
|
||||
if (gSettings.FakeLAN) {
|
||||
UINT32 FakeID = gSettings.FakeLAN >> 16;
|
||||
devprop_add_value(device, "device-id", (UINT8*)&FakeID, 4);
|
||||
AsciiSPrint(compatible, 64, "pci%x,%x", (gSettings.FakeLAN & 0xFFFF), FakeID);
|
||||
snprintf(compatible, 64, "pci%X,%X", (gSettings.FakeLAN & 0xFFFF), FakeID);
|
||||
LowCase(compatible);
|
||||
devprop_add_value(device, "compatible", (UINT8*)&compatible[0], 12);
|
||||
FakeID = gSettings.FakeLAN & 0xFFFF;
|
||||
|
@ -843,7 +843,7 @@ EFI_STATUS InjectKexts(/*IN EFI_MEMORY_DESCRIPTOR *Desc*/ IN UINT32 deviceTreeP,
|
||||
mm = (_DeviceTreeBuffer*) (((UINT8*)prop) + sizeof(DeviceTreeNodeProperty));
|
||||
mm->paddr = (UINT32)KextBase;
|
||||
mm->length = KextEntry->kext.length;
|
||||
AsciiSPrint(prop->Name, 31, "Driver-%x", KextBase);
|
||||
snprintf(prop->Name, 31, "Driver-%llX", KextBase);
|
||||
|
||||
drvPtr += sizeof(DeviceTreeNodeProperty) + sizeof(_DeviceTreeBuffer);
|
||||
KextBase = RoundPage(KextBase + KextEntry->kext.length);
|
||||
|
@ -284,15 +284,15 @@ VOID ATIConnectorsPatchInit(LOADER_ENTRY *Entry)
|
||||
//
|
||||
|
||||
// Lion, SnowLeo 10.6.7 2011 MBP
|
||||
AsciiSPrint(ATIKextBundleId[0],
|
||||
snprintf(ATIKextBundleId[0],
|
||||
sizeof(ATIKextBundleId[0]),
|
||||
"com.apple.kext.ATI%sController",
|
||||
"com.apple.kext.ATI%lsController",
|
||||
Entry->KernelAndKextPatches->KPATIConnectorsController
|
||||
);
|
||||
// ML
|
||||
AsciiSPrint(ATIKextBundleId[1],
|
||||
snprintf(ATIKextBundleId[1],
|
||||
sizeof(ATIKextBundleId[1]),
|
||||
"com.apple.kext.AMD%sController",
|
||||
"com.apple.kext.AMD%lsController",
|
||||
Entry->KernelAndKextPatches->KPATIConnectorsController
|
||||
);
|
||||
|
||||
|
@ -2036,7 +2036,7 @@ CONST CHAR8 *get_nvidia_model(UINT32 device_id, UINT32 subsys_id, CARDLIST * nvc
|
||||
//ErmaC added selector for nVidia "old" style in System Profiler
|
||||
if (gSettings.NvidiaGeneric) {
|
||||
DBG("Apply NvidiaGeneric\n");
|
||||
AsciiSPrint(generic_name, 128, "NVIDIA %a", nvidia_card_generic[i].name_model);
|
||||
snprintf(generic_name, 128, "NVIDIA %s", nvidia_card_generic[i].name_model);
|
||||
return &generic_name[0]; // generic_name;
|
||||
}
|
||||
// DBG("Not applied NvidiaGeneric\n");
|
||||
@ -2044,7 +2044,7 @@ CONST CHAR8 *get_nvidia_model(UINT32 device_id, UINT32 subsys_id, CARDLIST * nvc
|
||||
if (subsys_id) {
|
||||
for (j = 0; j < (sizeof(nvidia_card_vendors) / sizeof(nvidia_card_vendors[0])); j++) {
|
||||
if (nvidia_card_vendors[j].device == (subsys_id & 0xffff0000)) {
|
||||
AsciiSPrint(generic_name, 128, "%a %a",
|
||||
snprintf(generic_name, 128, "%s %s",
|
||||
nvidia_card_vendors[j].name_model,
|
||||
nvidia_card_generic[i].name_model);
|
||||
return &generic_name[0]; // generic_name;
|
||||
@ -2073,18 +2073,18 @@ static INT32 devprop_add_nvidia_template(DevPropDevice *device, INTN n_ports)
|
||||
}
|
||||
|
||||
for (pnum = 0; pnum < n_ports; pnum++) {
|
||||
AsciiSPrint(nkey, 24, "@%d,name", pnum);
|
||||
AsciiSPrint(nval, 24, "NVDA,Display-%c", (65+pnum));
|
||||
snprintf(nkey, 24, "@%lld,name", pnum);
|
||||
snprintf(nval, 24, "NVDA,Display-%lld", (65+pnum));
|
||||
//DBG("Nvidia: insert [%s : %s]\n", nkey, nval);
|
||||
devprop_add_value(device, nkey, (UINT8*)nval, 14);
|
||||
|
||||
AsciiSPrint(nkey, 24, "@%d,compatible", pnum);
|
||||
snprintf(nkey, 24, "@%lld,compatible", pnum);
|
||||
devprop_add_value(device, nkey, (UINT8*)"NVDA,NVMac", 10);
|
||||
|
||||
AsciiSPrint(nkey, 24, "@%d,device_type", pnum);
|
||||
snprintf(nkey, 24, "@%lld,device_type", pnum);
|
||||
devprop_add_value(device, nkey, (UINT8*)"display", 7);
|
||||
|
||||
AsciiSPrint(nkey, 24, "@%d,display-cfg", pnum);
|
||||
snprintf(nkey, 24, "@%lld,display-cfg", pnum);
|
||||
if (pnum == 0) {
|
||||
devprop_add_value(device, nkey, (gSettings.Dcfg[0] != 0) ? &gSettings.Dcfg[0] : default_dcfg_0, DCFG0_LEN);
|
||||
} else {
|
||||
@ -2386,7 +2386,7 @@ BOOLEAN setup_nvidia_devprop(pci_dt_t *nvda_dev)
|
||||
}
|
||||
}
|
||||
} else {
|
||||
AsciiSPrint(version_str, sizeof(version_str), "1.0");
|
||||
snprintf(version_str, sizeof(version_str), "1.0");
|
||||
}
|
||||
|
||||
DBG("nVidia %s ", model);
|
||||
@ -2472,7 +2472,7 @@ BOOLEAN setup_nvidia_devprop(pci_dt_t *nvda_dev)
|
||||
if ((devices_number == 1) &&
|
||||
((gSettings.BootDisplay >= 0) && (gSettings.BootDisplay < (INT8)n_ports))) {
|
||||
CHAR8 nkey[24];
|
||||
AsciiSPrint(nkey, 24, "@%d,AAPL,boot-display", gSettings.BootDisplay);
|
||||
snprintf(nkey, 24, "@%d,AAPL,boot-display", gSettings.BootDisplay);
|
||||
devprop_add_value(device, nkey, (UINT8*)&boot_display, 4);
|
||||
DBG("Nvidia: BootDisplay: %d\n", gSettings.BootDisplay);
|
||||
}
|
||||
@ -2508,7 +2508,7 @@ BOOLEAN setup_nvidia_devprop(pci_dt_t *nvda_dev)
|
||||
|
||||
//add HDMI Audio back to nvidia
|
||||
//http://forge.voodooprojects.org/p/chameleon/issues/67/
|
||||
//AsciiSPrint(nkey, 24, "@%d,connector-type", pnum);
|
||||
//snprintf(nkey, 24, "@%d,connector-type", pnum);
|
||||
//devprop_add_value(device, nkey, connector_type_1, 4);
|
||||
//end Nvidia HDMI Audio
|
||||
|
||||
|
@ -610,7 +610,7 @@ VOID SetDMISettingsForModel(MACHINE_TYPES Model, BOOLEAN Redefine)
|
||||
while (*i != '.') {
|
||||
i--;
|
||||
}
|
||||
AsciiSPrint (Res1, 9, "%c%c/%c%c/%c%c\n", i[3], i[4], i[5], i[6], i[1], i[2]);
|
||||
snprintf (Res1, 9, "%c%c/%c%c/%c%c\n", i[3], i[4], i[5], i[6], i[1], i[2]);
|
||||
AsciiStrCpyS (gSettings.ReleaseDate, 64, Res1);
|
||||
break;
|
||||
|
||||
@ -621,7 +621,7 @@ VOID SetDMISettingsForModel(MACHINE_TYPES Model, BOOLEAN Redefine)
|
||||
while (*i != '.') {
|
||||
i--;
|
||||
}
|
||||
AsciiSPrint (Res2, 11, "%c%c/%c%c/20%c%c\n", i[3], i[4], i[5], i[6], i[1], i[2]);
|
||||
snprintf (Res2, 11, "%c%c/%c%c/20%c%c\n", i[3], i[4], i[5], i[6], i[1], i[2]);
|
||||
AsciiStrCpyS (gSettings.ReleaseDate, 64, Res2);
|
||||
break;
|
||||
}
|
||||
|
@ -904,7 +904,7 @@ VOID PatchTableType4()
|
||||
UpdateSmbiosString(newSmbiosTable, &newSmbiosTable.Type4->AssetTag, BrandStr); //like mac
|
||||
// looks to be MicroCode revision
|
||||
if(gCPUStructure.MicroCode > 0){
|
||||
AsciiSPrint(BrandStr, 20, "%X", gCPUStructure.MicroCode);
|
||||
snprintf(BrandStr, 20, "%llX", gCPUStructure.MicroCode);
|
||||
UpdateSmbiosString(newSmbiosTable, &newSmbiosTable.Type4->SerialNumber, BrandStr);
|
||||
}
|
||||
|
||||
@ -1089,7 +1089,7 @@ VOID PatchTableType11()
|
||||
// AsciiStrnCatS(OEMString, MAX_OEM_STRING, gSettings.EfiVersion, iStrLen(gSettings.EfiVersion, 64));
|
||||
AsciiStrCatS(OEMString, MAX_OEM_STRING, "\n Board-ID : ");
|
||||
AsciiStrnCatS(OEMString, MAX_OEM_STRING, gSettings.BoardNumber, iStrLen(gSettings.BoardNumber, 64));
|
||||
AsciiSPrint(TempRev, MAX_OEM_STRING, "\n⌘ Powered by Clover %s\n", gFirmwareRevision);
|
||||
snprintf(TempRev, MAX_OEM_STRING, "\n⌘ Powered by Clover %ls\n", gFirmwareRevision);
|
||||
AsciiStrCatS(OEMString, MAX_OEM_STRING, TempRev);
|
||||
|
||||
UpdateSmbiosString(newSmbiosTable, &newSmbiosTable.Type11->StringCount, OEMString);
|
||||
@ -1338,10 +1338,10 @@ VOID PatchTableType17()
|
||||
newSmbiosTable.Type17->DeviceSet = bank + 1;
|
||||
newSmbiosTable.Type17->MemoryArrayHandle = mHandle16;
|
||||
if (isMacPro) {
|
||||
AsciiSPrint(deviceLocator, 10, "DIMM%d", gRAMCount + 1);
|
||||
snprintf(deviceLocator, 10, "DIMM%d", gRAMCount + 1);
|
||||
} else {
|
||||
AsciiSPrint(deviceLocator, 10, "DIMM%d", bank);
|
||||
AsciiSPrint(bankLocator, 10, "BANK %d", Index % channels);
|
||||
snprintf(deviceLocator, 10, "DIMM%d", bank);
|
||||
snprintf(bankLocator, 10, "BANK %llu", Index % channels);
|
||||
UpdateSmbiosString(newSmbiosTable, &newSmbiosTable.Type17->BankLocator, (CHAR8*)&bankLocator[0]);
|
||||
}
|
||||
UpdateSmbiosString(newSmbiosTable, &newSmbiosTable.Type17->DeviceLocator, (CHAR8*)&deviceLocator[0]);
|
||||
@ -1584,7 +1584,7 @@ VOID PatchTableType17()
|
||||
AsciiStrCpy(vendor, gRAM.SMBIOS[SMBIOSIndex].Vendor);
|
||||
UpdateSmbiosString(newSmbiosTable, &newSmbiosTable.Type17->Manufacturer, vendor);
|
||||
gRAM.SMBIOS[SMBIOSIndex].Vendor = vendor;
|
||||
AsciiSPrint(gSettings.MemoryManufacturer, 64, "%a", gRAM.SMBIOS[SMBIOSIndex].Vendor);
|
||||
snprintf(gSettings.MemoryManufacturer, 64, "%s", gRAM.SMBIOS[SMBIOSIndex].Vendor);
|
||||
} else {
|
||||
// newSmbiosTable.Type17->Manufacturer = 0;
|
||||
CHAR8 unknown[] = "unknown";
|
||||
@ -1592,7 +1592,7 @@ VOID PatchTableType17()
|
||||
}
|
||||
if (iStrLen(gRAM.SMBIOS[SMBIOSIndex].SerialNo, 64) > 0) {
|
||||
UpdateSmbiosString(newSmbiosTable, &newSmbiosTable.Type17->SerialNumber, gRAM.SMBIOS[SMBIOSIndex].SerialNo);
|
||||
AsciiSPrint(gSettings.MemorySerialNumber, 64, "%a", gRAM.SMBIOS[SMBIOSIndex].SerialNo);
|
||||
snprintf(gSettings.MemorySerialNumber, 64, "%s", gRAM.SMBIOS[SMBIOSIndex].SerialNo);
|
||||
} else {
|
||||
// newSmbiosTable.Type17->SerialNumber = 0;
|
||||
CHAR8 unknown[] = "unknown";
|
||||
@ -1600,7 +1600,7 @@ VOID PatchTableType17()
|
||||
}
|
||||
if (iStrLen(gRAM.SMBIOS[SMBIOSIndex].PartNo, 64) > 0) {
|
||||
UpdateSmbiosString(newSmbiosTable, &newSmbiosTable.Type17->PartNumber, gRAM.SMBIOS[SMBIOSIndex].PartNo);
|
||||
AsciiSPrint(gSettings.MemoryPartNumber, 64, "%a", gRAM.SMBIOS[SMBIOSIndex].PartNo);
|
||||
snprintf(gSettings.MemoryPartNumber, 64, "%s", gRAM.SMBIOS[SMBIOSIndex].PartNo);
|
||||
DBG(" partNum=%s\n", gRAM.SMBIOS[SMBIOSIndex].PartNo);
|
||||
} else {
|
||||
// newSmbiosTable.Type17->PartNumber = 0;
|
||||
@ -1628,21 +1628,21 @@ VOID PatchTableType17()
|
||||
AsciiStrCpy(vendor, gRAM.SPD[SPDIndex].Vendor);
|
||||
UpdateSmbiosString(newSmbiosTable, &newSmbiosTable.Type17->Manufacturer, vendor);
|
||||
gRAM.SPD[SPDIndex].Vendor = vendor;
|
||||
AsciiSPrint(gSettings.MemoryManufacturer, 64, "%a", gRAM.SPD[SPDIndex].Vendor);
|
||||
snprintf(gSettings.MemoryManufacturer, 64, "%s", gRAM.SPD[SPDIndex].Vendor);
|
||||
} else {
|
||||
CHAR8 unknown[] = "unknown";
|
||||
UpdateSmbiosString(newSmbiosTable, &newSmbiosTable.Type17->Manufacturer, unknown);
|
||||
}
|
||||
if (iStrLen(gRAM.SPD[SPDIndex].SerialNo, 64) > 0) {
|
||||
UpdateSmbiosString(newSmbiosTable, &newSmbiosTable.Type17->SerialNumber, gRAM.SPD[SPDIndex].SerialNo);
|
||||
AsciiSPrint(gSettings.MemorySerialNumber, 64, "%a", gRAM.SPD[SPDIndex].SerialNo);
|
||||
snprintf(gSettings.MemorySerialNumber, 64, "%s", gRAM.SPD[SPDIndex].SerialNo);
|
||||
} else {
|
||||
CHAR8 unknown[] = "unknown";
|
||||
UpdateSmbiosString(newSmbiosTable, &newSmbiosTable.Type17->SerialNumber, unknown);
|
||||
}
|
||||
if (iStrLen(gRAM.SPD[SPDIndex].PartNo, 64) > 0) {
|
||||
UpdateSmbiosString(newSmbiosTable, &newSmbiosTable.Type17->PartNumber, gRAM.SPD[SPDIndex].PartNo);
|
||||
AsciiSPrint(gSettings.MemoryPartNumber, 64, "%a", gRAM.SPD[SPDIndex].PartNo);
|
||||
snprintf(gSettings.MemoryPartNumber, 64, "%s", gRAM.SPD[SPDIndex].PartNo);
|
||||
} else {
|
||||
CHAR8 unknown[] = "unknown";
|
||||
UpdateSmbiosString(newSmbiosTable, &newSmbiosTable.Type17->PartNumber, unknown);
|
||||
@ -1675,7 +1675,7 @@ VOID PatchTableType17()
|
||||
gRAM.SMBIOS[SMBIOSIndex].Vendor = vendor;
|
||||
}
|
||||
|
||||
AsciiSPrint(gSettings.MemorySpeed, 64, "%d", newSmbiosTable.Type17->Speed);
|
||||
snprintf(gSettings.MemorySpeed, 64, "%d", newSmbiosTable.Type17->Speed);
|
||||
|
||||
// Assume DDR3 unless explicitly set to DDR2/DDR/DDR4
|
||||
if ((newSmbiosTable.Type17->MemoryType != MemoryTypeDdr2) &&
|
||||
@ -1686,11 +1686,12 @@ VOID PatchTableType17()
|
||||
|
||||
//now I want to update deviceLocator and bankLocator
|
||||
if (isMacPro) {
|
||||
AsciiSPrint(deviceLocator, 10, "DIMM%d", gRAMCount + 1);
|
||||
AsciiSPrint(bankLocator, 10, "");
|
||||
snprintf(deviceLocator, 10, "DIMM%d", gRAMCount + 1);
|
||||
// snprintf(bankLocator, 10, "");
|
||||
bankLocator[0] = 0;
|
||||
} else {
|
||||
AsciiSPrint(deviceLocator, 10, "DIMM%d", bank);
|
||||
AsciiSPrint(bankLocator, 10, "BANK %d", Index % channels);
|
||||
snprintf(deviceLocator, 10, "DIMM%d", bank);
|
||||
snprintf(bankLocator, 10, "BANK %llu", Index % channels);
|
||||
}
|
||||
UpdateSmbiosString(newSmbiosTable, &newSmbiosTable.Type17->DeviceLocator, (CHAR8*)&deviceLocator[0]);
|
||||
if (isMacPro) {
|
||||
|
@ -542,12 +542,12 @@ CHAR8* getDDRSerial(UINT8* spd)
|
||||
CHAR8* asciiSerial; //[16];
|
||||
asciiSerial = (__typeof__(asciiSerial))AllocatePool(17);
|
||||
if (spd[SPD_MEMORY_TYPE]==SPD_MEMORY_TYPE_SDRAM_DDR4) { // DDR4
|
||||
AsciiSPrint(asciiSerial, 17, "%2X%2X%2X%2X%2X%2X%2X%2X", SMST(325) /*& 0x7*/, SLST(325), SMST(326), SLST(326), SMST(327), SLST(327), SMST(328), SLST(328));
|
||||
snprintf(asciiSerial, 17, "%2X%2X%2X%2X%2X%2X%2X%2X", SMST(325) /*& 0x7*/, SLST(325), SMST(326), SLST(326), SMST(327), SLST(327), SMST(328), SLST(328));
|
||||
} else if (spd[SPD_MEMORY_TYPE]==SPD_MEMORY_TYPE_SDRAM_DDR3) { // DDR3
|
||||
AsciiSPrint(asciiSerial, 17, "%2X%2X%2X%2X%2X%2X%2X%2X", SMST(122) /*& 0x7*/, SLST(122), SMST(123), SLST(123), SMST(124), SLST(124), SMST(125), SLST(125));
|
||||
snprintf(asciiSerial, 17, "%2X%2X%2X%2X%2X%2X%2X%2X", SMST(122) /*& 0x7*/, SLST(122), SMST(123), SLST(123), SMST(124), SLST(124), SMST(125), SLST(125));
|
||||
} else if (spd[SPD_MEMORY_TYPE]==SPD_MEMORY_TYPE_SDRAM_DDR2 ||
|
||||
spd[SPD_MEMORY_TYPE]==SPD_MEMORY_TYPE_SDRAM_DDR) { // DDR2 or DDR
|
||||
AsciiSPrint(asciiSerial, 17, "%2X%2X%2X%2X%2X%2X%2X%2X", SMST(95) /*& 0x7*/, SLST(95), SMST(96), SLST(96), SMST(97), SLST(97), SMST(98), SLST(98));
|
||||
snprintf(asciiSerial, 17, "%2X%2X%2X%2X%2X%2X%2X%2X", SMST(95) /*& 0x7*/, SLST(95), SMST(96), SLST(96), SMST(97), SLST(97), SMST(98), SLST(98));
|
||||
} else {
|
||||
AsciiStrCpyS(asciiSerial, 17, "0000000000000000");
|
||||
}
|
||||
|
@ -17,16 +17,6 @@
|
||||
|
||||
#include "../../Include/Library/printf_lite.h"
|
||||
|
||||
//#ifndef memcpy
|
||||
//#define memcpy(dest,source,count) CopyMem(dest,(void*)(source),(UINTN)(count))
|
||||
//#endif
|
||||
//#ifndef strlen
|
||||
//#define strlen(str) (xsize)(AsciiStrLen(str))
|
||||
//#endif
|
||||
//#ifndef memmove
|
||||
//#define memmove(dest,source,count) CopyMem(dest,source,(UINTN)(count))
|
||||
//#endif
|
||||
|
||||
xsize XStringGrowByDefault = 2;
|
||||
const XString NullXString;
|
||||
|
||||
|
@ -173,7 +173,7 @@ class XString
|
||||
void Replace(char c1, char c2);
|
||||
XString SubStringReplace(char c1, char c2);
|
||||
|
||||
// int Compare(const char* S) const { return (int)AsciiStrCmp(data(), (S ? S : "")); }// AsciiStrCmp return 0 or !0, not usual strcmp
|
||||
int Compare(const char* S) const { return strcmp(data(), (S ? S : "")); }// AsciiStrCmp return 0 or !0, not usual strcmp
|
||||
#ifdef TODO_skqdjfhksqjhfksjqdf
|
||||
//IC
|
||||
int CompareIC(const char* S) const { return StringCompareIC(data(), (S ? S : "")); }
|
||||
|
@ -85,9 +85,9 @@ DBG("Constructor(const XStringW &aString) : %ls\n", aString.data());
|
||||
//XStringW::XStringW(const char* S)
|
||||
//{
|
||||
//DBG("Constructor(const char* S)\n");
|
||||
// xsize newLen = StrLenInWChar(S, AsciiStrLen(S));
|
||||
// xsize newLen = StrLenInWChar(S, strlen(S));
|
||||
// Init(newLen);
|
||||
// utf8ToWChar(m_data, m_allocatedSize+1, S, AsciiStrLen(S)); // m_size doesn't count the NULL terminator
|
||||
// utf8ToWChar(m_data, m_allocatedSize+1, S, strlen(S)); // m_size doesn't count the NULL terminator
|
||||
// SetLength(newLen);
|
||||
//}
|
||||
wchar_t * XStringW::forgetDataWithoutFreeing()
|
||||
|
@ -1,94 +1,27 @@
|
||||
////*************************************************************************************************
|
||||
////*************************************************************************************************
|
||||
////
|
||||
//// STRING
|
||||
////
|
||||
//// Developed by jief666, from 1997.
|
||||
////
|
||||
////*************************************************************************************************
|
||||
////*************************************************************************************************
|
||||
//*************************************************************************************************
|
||||
//*************************************************************************************************
|
||||
//
|
||||
//#if 0
|
||||
//#define DBG(...) DebugLog(2, __VA_ARGS__)
|
||||
//#else
|
||||
//#define DBG(...)
|
||||
//#endif
|
||||
// STRING
|
||||
//
|
||||
//#include "XToolsCommon.h"
|
||||
//#include "XUINTN.h"
|
||||
// Developed by jief666, from 1997.
|
||||
//
|
||||
////xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
|
||||
//// Constructor
|
||||
////xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
|
||||
//*************************************************************************************************
|
||||
//*************************************************************************************************
|
||||
|
||||
#if 0
|
||||
#define DBG(...) DebugLog(2, __VA_ARGS__)
|
||||
#else
|
||||
#define DBG(...)
|
||||
#endif
|
||||
|
||||
#include "XToolsCommon.h"
|
||||
#include "XUINTN.h"
|
||||
|
||||
//xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
|
||||
// Constructor
|
||||
//xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
|
||||
|
||||
|
||||
//xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
|
||||
//
|
||||
//XStringW::XStringW()
|
||||
//{
|
||||
//DBG("Construteur\n");
|
||||
// Init();
|
||||
//}
|
||||
//
|
||||
//XStringW::XStringW(const XStringW &aString)
|
||||
//{
|
||||
//DBG("Constructor(const XStringW &aString) : %ls\n", aString.data());
|
||||
// Init(aString.length());
|
||||
// StrnCpy(aString.data(), aString.length());
|
||||
//}
|
||||
////
|
||||
////XStringW::XStringW(const wchar_t *S)
|
||||
////{
|
||||
//// if ( !S ) {
|
||||
//// DebugLog(2, "XStringW(const wchar_t *S) called with NULL. Use setEmpty()\n");
|
||||
//// panic();
|
||||
//// }
|
||||
////DBG("Constructor(const wchar_t *S) : %ls, StrLen(S)=%d\n", S, StrLen(S));
|
||||
//// Init(StrLen(S));
|
||||
//// StrCpy(S);
|
||||
////}
|
||||
////
|
||||
////XStringW::XStringW(const wchar_t *S, UINTN count)
|
||||
////{
|
||||
////DBG("Constructor(const wchar_t *S, UINTN count) : %ls, %d\n", S, count);
|
||||
//// Init(count);
|
||||
//// StrnCpy(S, count);
|
||||
////}
|
||||
////
|
||||
////XStringW::XStringW(const wchar_t aChar)
|
||||
////{
|
||||
////DBG("Constructor(const wchar_t aChar)\n");
|
||||
//// Init(1);
|
||||
//// StrnCpy(&aChar, 1);
|
||||
////}
|
||||
////
|
||||
////XStringW::XStringW(const char* S)
|
||||
////{
|
||||
////DBG("Constructor(const char* S)\n");
|
||||
//// xsize newLen = StrLenInWChar(S, AsciiStrLen(S));
|
||||
//// Init(newLen);
|
||||
//// utf8ToWChar(m_data, m_allocatedSize+1, S, AsciiStrLen(S)); // m_size doesn't count the NULL terminator
|
||||
//// SetLength(newLen);
|
||||
////}
|
||||
//
|
||||
//const XStringW& XStringW::takeValueFrom(const wchar_t* S)
|
||||
//{
|
||||
// if ( !S ) {
|
||||
// DebugLog(2, "takeValueFrom(const wchar_t* S) called with NULL. Use setEmpty()\n");
|
||||
// panic();
|
||||
// }
|
||||
// Init(StrLen(S));
|
||||
// StrCpy(S);
|
||||
// return *this;
|
||||
//}
|
||||
//
|
||||
//const XStringW& XStringW::takeValueFrom(const char* S)
|
||||
//{
|
||||
// UINTN asciiStrLen = AsciiStrLen(S);
|
||||
// xsize newLen = StrLenInWChar(S, asciiStrLen);
|
||||
// Init(newLen);
|
||||
// utf8ToWChar(m_data, m_allocatedSize+1, S, asciiStrLen); // m_size doesn't count the NULL terminator
|
||||
// SetLength(newLen);
|
||||
// return *this;
|
||||
//}
|
||||
//
|
||||
////xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
|
||||
////
|
||||
////xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
|
||||
//xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
|
||||
|
@ -47,7 +47,7 @@ void construct_globals_objects()
|
||||
// DBG("SectionHeader->PointerToRawData=%8X\n", SectionHeader->PointerToRawData);
|
||||
// DBG("SectionHeader->SizeOfRawData=%8X\n", SectionHeader->SizeOfRawData);
|
||||
DBG("SectionHeader->VirtualSize=%8X\n", SectionHeader->Misc.VirtualSize);
|
||||
if (AsciiStrCmp((CONST CHAR8*) SectionHeader->Name, ".ctorss") == 0)
|
||||
if (strcmp((CONST CHAR8*) SectionHeader->Name, ".ctorss") == 0)
|
||||
{
|
||||
|
||||
ctor_ptr* currentCtor = (ctor_ptr*) (((UINTN) (SelfLoadedImage->ImageBase)) + SectionHeader->PointerToRawData);
|
||||
@ -114,7 +114,7 @@ void construct_globals_objects()
|
||||
// DBG("SectionHeader->PointerToRawData=%8X\n", SectionHeader->PointerToRawData);
|
||||
// DBG("SectionHeader->SizeOfRawData=%8X\n", SectionHeader->SizeOfRawData);
|
||||
DBG("SectionHeader->VirtualSize=%8X\n", SectionHeader->Misc.VirtualSize);
|
||||
if (AsciiStrCmp((CONST CHAR8*) SectionHeader->Name, ".CRT") == 0)
|
||||
if (strcmp((CONST CHAR8*) SectionHeader->Name, ".CRT") == 0)
|
||||
{
|
||||
|
||||
ctor_ptr* currentCtor = (ctor_ptr*) (((UINTN) (SelfLoadedImage->ImageBase)) + SectionHeader->PointerToRawData);
|
||||
|
@ -33,6 +33,7 @@
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include "../cpp_foundation/XStringW.h"
|
||||
#include "entry_scan.h"
|
||||
#include "../Platform/Settings.h"
|
||||
#include "../Platform/Hibernate.h"
|
||||
@ -796,10 +797,7 @@ STATIC VOID AddDefaultMenu(IN LOADER_ENTRY *Entry)
|
||||
SubScreen->AddMenuInfoLine(FileDevicePathToStr(Entry->DevicePath));
|
||||
Guid = FindGPTPartitionGuidInDevicePath(Volume->DevicePath);
|
||||
if (Guid) {
|
||||
CHAR8 *GuidStr = (__typeof__(GuidStr))AllocateZeroPool(50);
|
||||
AsciiSPrint(GuidStr, 50, "%s", strguid(Guid));
|
||||
SubScreen->AddMenuInfoLine(PoolPrint(L"UUID: %a", GuidStr));
|
||||
FreePool(GuidStr);
|
||||
SubScreen->AddMenuInfoLine(WPrintf("UUID: %s", strguid(Guid)).wc_str());
|
||||
}
|
||||
SubScreen->AddMenuInfoLine(PoolPrint(L"Options: %s", Entry->LoadOptions));
|
||||
// loader-specific submenu entries
|
||||
@ -2014,10 +2012,7 @@ STATIC VOID AddCustomEntry(IN UINTN CustomIndex,
|
||||
SubScreen->AddMenuInfoLine(XStringWP(L"Volume size: ") + WPrintf("%lldMb", VolumeSize));
|
||||
SubScreen->AddMenuInfoLine(FileDevicePathToStr(Entry->DevicePath));
|
||||
if (Guid) {
|
||||
CHAR8 *GuidStr = (__typeof__(GuidStr))AllocateZeroPool(50);
|
||||
AsciiSPrint(GuidStr, 50, "%s", strguid(Guid));
|
||||
SubScreen->AddMenuInfoLine(PoolPrint(L"UUID: %a", GuidStr));
|
||||
FreePool(GuidStr);
|
||||
SubScreen->AddMenuInfoLine(WPrintf("UUID: %s", strguid(Guid)).wc_str());
|
||||
}
|
||||
SubScreen->AddMenuInfoLine(PoolPrint(L"Options: %s", Entry->LoadOptions));
|
||||
DBG("Create sub entries\n");
|
||||
|
@ -714,7 +714,7 @@ EG_IMAGE * LoadSvgFrame(INTN i)
|
||||
CHAR8 FrameName[64];
|
||||
//TODO if extend SVG syntax then we can use dynamic SVG with parameter Frame
|
||||
// for example use variable instead of constant like javascript
|
||||
AsciiSPrint(FrameName, 63, "frame_%d", i+1);
|
||||
snprintf(FrameName, 63, "frame_%lld", i+1);
|
||||
Status = ParseSVGIcon(mainParser, BUILTIN_ICON_ANIME, FrameName, GlobalConfig.Scale, &Frame);
|
||||
if (EFI_ERROR(Status)) {
|
||||
DBG("icon '%s' not loaded, status=%s\n", FrameName, strerror(Status));
|
||||
|
@ -11,6 +11,9 @@ extern "C" {
|
||||
|
||||
#include "XTheme.h"
|
||||
|
||||
#if USE_XTHEME
|
||||
|
||||
|
||||
//temporary
|
||||
extern INTN ScrollWidth;
|
||||
extern INTN ScrollButtonsHeight;
|
||||
@ -687,4 +690,6 @@ void XTheme::InitBar()
|
||||
}
|
||||
}
|
||||
|
||||
#endif // USE_XTHEME
|
||||
|
||||
|
||||
|
@ -53,16 +53,6 @@ extern "C" {
|
||||
#define NSVG_RGBA(r, g, b, a) (((unsigned int)b) | ((unsigned int)g << 8) | ((unsigned int)r << 16) | ((unsigned int)a << 24))
|
||||
|
||||
|
||||
//There are defines for compilation as first step. Must be revised
|
||||
//#define memcpy(dest,source,count) CopyMem(dest,(void*)(source),(UINTN)(count))
|
||||
//#define memset(dest,ch,count) SetMem(dest,(UINTN)(count),(UINT8)(ch))
|
||||
//#define strcmp(a,b) AsciiStrCmp(a,b)
|
||||
//#define strncmp(a,b,n) AsciiStrnCmp(a,b,n)
|
||||
//#define strstr(a,b) AsciiStrStr(a,b)
|
||||
|
||||
//#define strlen(s) AsciiStrLen(s)
|
||||
//#define strncpy(a,b,n) AsciiSPrint(a,n,"%a",b)
|
||||
|
||||
enum NSVGpaintType {
|
||||
NSVG_PAINT_NONE = 0,
|
||||
NSVG_PAINT_COLOR = 1,
|
||||
|
@ -1754,7 +1754,7 @@ VOID DbgHeader(CONST CHAR8 *str)
|
||||
{
|
||||
CHAR8 strLog[50];
|
||||
INTN len;
|
||||
UINTN end = AsciiSPrint(strLog, 50, "=== [ %a ] ", str);
|
||||
UINTN end = snprintf(strLog, 50, "=== [ %s ] ", str);
|
||||
len = 50 - end;
|
||||
|
||||
SetMem(&strLog[end], len , '=');
|
||||
|
@ -373,7 +373,7 @@ VOID FillInputs(BOOLEAN New)
|
||||
InputItems[InputItemsCount++].BValue = gSettings.InjectNVidia;
|
||||
InputItems[InputItemsCount].ItemType = ASString; //22+6i
|
||||
for (j=0; j<8; j++) {
|
||||
AsciiSPrint((CHAR8*)&tmp[2*j], 3, "%02x", gSettings.Dcfg[j]);
|
||||
snprintf((CHAR8*)&tmp[2*j], 3, "%02X", gSettings.Dcfg[j]);
|
||||
}
|
||||
if (New) {
|
||||
InputItems[InputItemsCount].SValue = (__typeof__(InputItems[InputItemsCount].SValue))AllocateZeroPool(40);
|
||||
@ -406,7 +406,7 @@ VOID FillInputs(BOOLEAN New)
|
||||
if (gGraphics[i].Vendor == Nvidia) {
|
||||
InputItems[InputItemsCount].ItemType = ASString; //24+6i
|
||||
for (j=0; j<20; j++) {
|
||||
AsciiSPrint((CHAR8*)&tmp[2*j], 3, "%02x", gSettings.NVCAP[j]);
|
||||
snprintf((CHAR8*)&tmp[2*j], 3, "%02X", gSettings.NVCAP[j]);
|
||||
}
|
||||
if (New) {
|
||||
InputItems[InputItemsCount].SValue = (__typeof__(InputItems[InputItemsCount].SValue))AllocateZeroPool(84);
|
||||
@ -775,7 +775,7 @@ VOID ApplyInputs(VOID)
|
||||
}
|
||||
} while (*(++ch));
|
||||
|
||||
AsciiSPrint(gSettings.BootArgs, 255, "%s ", InputItems[i].SValue);
|
||||
snprintf(gSettings.BootArgs, 255, "%ls ", InputItems[i].SValue);
|
||||
}
|
||||
i++; //1
|
||||
if (InputItems[i].Valid) {
|
||||
@ -877,7 +877,7 @@ VOID ApplyInputs(VOID)
|
||||
for (j = 0; j < NGFX; j++) {
|
||||
i++; //20
|
||||
if (InputItems[i].Valid) {
|
||||
AsciiSPrint(gGraphics[j].Model, 64, "%s", InputItems[i].SValue);
|
||||
snprintf(gGraphics[j].Model, 64, "%ls", InputItems[i].SValue);
|
||||
}
|
||||
i++; //21
|
||||
if (InputItems[i].Valid) {
|
||||
@ -895,7 +895,7 @@ VOID ApplyInputs(VOID)
|
||||
UnicodeSPrint(gSettings.FBName, 32, L"%s", InputItems[i].SValue);
|
||||
} else if (gGraphics[j].Vendor == Nvidia) {
|
||||
ZeroMem(AString, 256);
|
||||
AsciiSPrint(AString, 255, "%s", InputItems[i].SValue);
|
||||
snprintf(AString, 255, "%ls", InputItems[i].SValue);
|
||||
hex2bin(AString, (UINT8*)&gSettings.Dcfg[0], 8);
|
||||
} else if (gGraphics[j].Vendor == Intel) {
|
||||
//ig-platform-id for Ivy+ and snb-platform-id for Sandy
|
||||
@ -918,7 +918,7 @@ VOID ApplyInputs(VOID)
|
||||
if (gGraphics[j].Vendor == Nvidia) {
|
||||
ZeroMem(AString, 256);
|
||||
if (StrLen(InputItems[i].SValue) > 0) {
|
||||
AsciiSPrint(AString, 255, "%s", InputItems[i].SValue);
|
||||
snprintf(AString, 255, "%ls", InputItems[i].SValue);
|
||||
hex2bin(AString, (UINT8*)&gSettings.NVCAP[0], 20);
|
||||
}
|
||||
} else {
|
||||
@ -970,7 +970,7 @@ VOID ApplyInputs(VOID)
|
||||
|
||||
i++; //51
|
||||
if (InputItems[i].Valid) {
|
||||
AsciiSPrint(NonDetected, 64, "%s", InputItems[i].SValue);
|
||||
snprintf(NonDetected, 64, "%ls", InputItems[i].SValue);
|
||||
}
|
||||
|
||||
i++; //52
|
||||
@ -1100,7 +1100,7 @@ VOID ApplyInputs(VOID)
|
||||
|
||||
i++; //78
|
||||
if (InputItems[i].Valid) {
|
||||
AsciiSPrint(gSettings.ProductName, 64, "%s", InputItems[i].SValue);
|
||||
snprintf(gSettings.ProductName, 64, "%ls", InputItems[i].SValue);
|
||||
// let's fill all other fields based on this ProductName
|
||||
// to serve as default
|
||||
Model = GetModelFromString(gSettings.ProductName);
|
||||
@ -1111,19 +1111,19 @@ VOID ApplyInputs(VOID)
|
||||
|
||||
i++; //79
|
||||
if (InputItems[i].Valid) {
|
||||
AsciiSPrint(gSettings.VersionNr, 64, "%s", InputItems[i].SValue);
|
||||
snprintf(gSettings.VersionNr, 64, "%ls", InputItems[i].SValue);
|
||||
}
|
||||
i++; //80
|
||||
if (InputItems[i].Valid) {
|
||||
AsciiSPrint(gSettings.SerialNr, 64, "%s", InputItems[i].SValue);
|
||||
snprintf(gSettings.SerialNr, 64, "%ls", InputItems[i].SValue);
|
||||
}
|
||||
i++; //81
|
||||
if (InputItems[i].Valid) {
|
||||
AsciiSPrint(gSettings.BoardNumber, 64, "%s", InputItems[i].SValue);
|
||||
snprintf(gSettings.BoardNumber, 64, "%ls", InputItems[i].SValue);
|
||||
}
|
||||
i++; //82
|
||||
if (InputItems[i].Valid) {
|
||||
AsciiSPrint(gSettings.BoardSerialNumber, 64, "%s", InputItems[i].SValue);
|
||||
snprintf(gSettings.BoardSerialNumber, 64, "%ls", InputItems[i].SValue);
|
||||
}
|
||||
i++; //83
|
||||
if (InputItems[i].Valid) {
|
||||
@ -1131,7 +1131,7 @@ VOID ApplyInputs(VOID)
|
||||
}
|
||||
i++; //84
|
||||
if (InputItems[i].Valid) {
|
||||
AsciiSPrint(gSettings.BoardVersion, 64, "%s", InputItems[i].SValue);
|
||||
snprintf(gSettings.BoardVersion, 64, "%ls", InputItems[i].SValue);
|
||||
}
|
||||
i++; //85
|
||||
if (InputItems[i].Valid) {
|
||||
@ -1139,11 +1139,11 @@ VOID ApplyInputs(VOID)
|
||||
}
|
||||
i++; //86
|
||||
if (InputItems[i].Valid) {
|
||||
AsciiSPrint(gSettings.RomVersion, 64, "%s", InputItems[i].SValue);
|
||||
snprintf(gSettings.RomVersion, 64, "%ls", InputItems[i].SValue);
|
||||
}
|
||||
i++; //87
|
||||
if (InputItems[i].Valid) {
|
||||
AsciiSPrint(gSettings.ReleaseDate, 64, "%s", InputItems[i].SValue);
|
||||
snprintf(gSettings.ReleaseDate, 64, "%ls", InputItems[i].SValue);
|
||||
}
|
||||
|
||||
i++; //88
|
||||
@ -1299,11 +1299,11 @@ VOID ApplyInputs(VOID)
|
||||
}
|
||||
i++; //117
|
||||
if (InputItems[i].Valid) {
|
||||
AsciiSPrint(gSettings.EfiVersion, 64, "%s", InputItems[i].SValue);
|
||||
snprintf(gSettings.EfiVersion, 64, "%ls", InputItems[i].SValue);
|
||||
}
|
||||
i++; //118
|
||||
if (InputItems[i].Valid) {
|
||||
AsciiSPrint(gSettings.BooterCfgStr, 64, "%s", InputItems[i].SValue);
|
||||
snprintf(gSettings.BooterCfgStr, 64, "%ls", InputItems[i].SValue);
|
||||
}
|
||||
i++; //119
|
||||
if (InputItems[i].Valid) {
|
||||
@ -6843,7 +6843,7 @@ UINTN REFIT_MENU_SCREEN::RunMainMenu(IN INTN DefaultSelection, OUT REFIT_ABSTRAC
|
||||
}
|
||||
if (/*MenuExit == MENU_EXIT_ENTER &&*/ MainChosenEntry->getLOADER_ENTRY()) {
|
||||
if (MainChosenEntry->getLOADER_ENTRY()->LoadOptions) {
|
||||
AsciiSPrint(gSettings.BootArgs, 255, "%s", MainChosenEntry->getLOADER_ENTRY()->LoadOptions);
|
||||
snprintf(gSettings.BootArgs, 255, "%ls", MainChosenEntry->getLOADER_ENTRY()->LoadOptions);
|
||||
} else {
|
||||
ZeroMem(&gSettings.BootArgs, 255);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user