Skip to content

Commit

Permalink
MacSerial, Codecs.plist, pic.ids update
Browse files Browse the repository at this point in the history
  • Loading branch information
benbaker76 committed Dec 11, 2021
1 parent 279644d commit b9f9afc
Show file tree
Hide file tree
Showing 9 changed files with 820 additions and 685 deletions.
14 changes: 10 additions & 4 deletions Hackintool.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@
E2D20D4D223184DF00BAC721 /* Clover in Resources */ = {isa = PBXBuildFile; fileRef = E2D20D4C223184DF00BAC721 /* Clover */; };
E2DDD8AA2306DE640017F6D7 /* macserial.c in Sources */ = {isa = PBXBuildFile; fileRef = E2DDD8A62306DE640017F6D7 /* macserial.c */; };
E2DDD8AE2307E3800017F6D7 /* efidevp.c in Sources */ = {isa = PBXBuildFile; fileRef = E2DDD8AC2307E37F0017F6D7 /* efidevp.c */; };
E2E97BE9276522AB00A7BEBE /* UserPseudoRandom.c in Sources */ = {isa = PBXBuildFile; fileRef = E2E97BE7276522AB00A7BEBE /* UserPseudoRandom.c */; };
E2ED92F8221349FE00279FEA /* AudioDevice.m in Sources */ = {isa = PBXBuildFile; fileRef = E2ED92F7221349FE00279FEA /* AudioDevice.m */; };
E2F6B2C522E3FE2B00BEF274 /* IORegTools.m in Sources */ = {isa = PBXBuildFile; fileRef = E2F6B2C422E3FE2B00BEF274 /* IORegTools.m */; };
E2FB8637210EAB1000D6F0E4 /* FBUtilities.m in Sources */ = {isa = PBXBuildFile; fileRef = E2FB8635210EAB1000D6F0E4 /* FBUtilities.m */; };
Expand Down Expand Up @@ -186,6 +187,8 @@
E2E7D7F2220811AC0062D06D /* uk */ = {isa = PBXFileReference; fileEncoding = 10; lastKnownFileType = text.plist.strings; name = uk; path = uk.lproj/Localizable.strings; sourceTree = "<group>"; };
E2E7D7F62208124A0062D06D /* de */ = {isa = PBXFileReference; fileEncoding = 10; lastKnownFileType = text.plist.strings; name = de; path = de.lproj/Localizable.strings; sourceTree = "<group>"; };
E2E9476F2204A9F5005348C0 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/MainMenu.xib; sourceTree = "<group>"; };
E2E97BE7276522AB00A7BEBE /* UserPseudoRandom.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = UserPseudoRandom.c; sourceTree = "<group>"; };
E2E97BE8276522AB00A7BEBE /* UserPseudoRandom.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UserPseudoRandom.h; sourceTree = "<group>"; };
E2EA734A22845CDB0095E56C /* zh-Hans */ = {isa = PBXFileReference; lastKnownFileType = text.rtf; name = "zh-Hans"; path = "zh-Hans.lproj/Credits.rtf"; sourceTree = "<group>"; };
E2ED92F6221349F000279FEA /* AudioDevice.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AudioDevice.h; sourceTree = "<group>"; };
E2ED92F7221349FE00279FEA /* AudioDevice.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AudioDevice.m; sourceTree = "<group>"; };
Expand Down Expand Up @@ -351,6 +354,8 @@
E2DDD8A52306DE640017F6D7 /* MacSerial */ = {
isa = PBXGroup;
children = (
E2E97BE7276522AB00A7BEBE /* UserPseudoRandom.c */,
E2E97BE8276522AB00A7BEBE /* UserPseudoRandom.h */,
E2DDD8A62306DE640017F6D7 /* macserial.c */,
E2DDD8A72306DE640017F6D7 /* macserial.h */,
E2DDD8A82306DE640017F6D7 /* modelinfo.h */,
Expand Down Expand Up @@ -559,6 +564,7 @@
E2489DEE211AE5AD00A48C84 /* NSTabViewImage.m in Sources */,
E2520BA5226CE3B00077A0FC /* PCIMonitor.m in Sources */,
E277608E21EBD90D00EA6E44 /* FixEDID.m in Sources */,
E2E97BE9276522AB00A7BEBE /* UserPseudoRandom.c in Sources */,
E2DDD8AA2306DE640017F6D7 /* macserial.c in Sources */,
E200EE7A21FBD4600082D799 /* NVRAMXmlParser.m in Sources */,
E22AB5392278FC4500A46C8D /* OpenCore.m in Sources */,
Expand Down Expand Up @@ -715,7 +721,7 @@
CODE_SIGN_INJECT_BASE_ENTITLEMENTS = NO;
CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES;
CURRENT_PROJECT_VERSION = 0376;
CURRENT_PROJECT_VERSION = 0377;
DEVELOPMENT_TEAM = 5LGHPJM9ZR;
ENABLE_HARDENED_RUNTIME = YES;
ENABLE_STRICT_OBJC_MSGSEND = NO;
Expand All @@ -730,7 +736,7 @@
INFOPLIST_FILE = "Hackintool/Hackintool-Info.plist";
LD_RUNPATH_SEARCH_PATHS = "@loader_path/../Frameworks @executable_path/../Frameworks";
MACOSX_DEPLOYMENT_TARGET = 10.9;
MARKETING_VERSION = 3.7.6;
MARKETING_VERSION = 3.7.7;
PRODUCT_BUNDLE_IDENTIFIER = com.Headsoft.Hackintool;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
Expand All @@ -751,7 +757,7 @@
CODE_SIGN_INJECT_BASE_ENTITLEMENTS = NO;
CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES;
CURRENT_PROJECT_VERSION = 0376;
CURRENT_PROJECT_VERSION = 0377;
DEVELOPMENT_TEAM = 5LGHPJM9ZR;
ENABLE_HARDENED_RUNTIME = YES;
ENABLE_STRICT_OBJC_MSGSEND = NO;
Expand All @@ -766,7 +772,7 @@
INFOPLIST_FILE = "Hackintool/Hackintool-Info.plist";
LD_RUNPATH_SEARCH_PATHS = "@loader_path/../Frameworks @executable_path/../Frameworks";
MACOSX_DEPLOYMENT_TARGET = 10.9;
MARKETING_VERSION = 3.7.6;
MARKETING_VERSION = 3.7.7;
PRODUCT_BUNDLE_IDENTIFIER = com.Headsoft.Hackintool;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
Expand Down
Binary file not shown.
71 changes: 71 additions & 0 deletions MacSerial/UserPseudoRandom.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
/** @file
Copyright (c) 2020, vit9696. All rights reserved.
SPDX-License-Identifier: BSD-3-Clause
**/

#include <stdint.h>
#include <stdio.h>
#include <time.h>

#ifdef __GNUC__
uint32_t arc4random(void) __attribute__((weak));
uint32_t arc4random_uniform(uint32_t upper_bound) __attribute__((weak));
#endif

// Taken from https://en.wikipedia.org/wiki/Xorshift#Example_implementation
// I am not positive what is better to use here (especially on Windows).
// Fortunately we only need something only looking random.
uint32_t pseudo_random(void) {
#if defined(__GNUC__) && !defined(__EMSCRIPTEN__)
if (arc4random)
return arc4random();
#endif

static uint32_t state;

if (!state) {
fprintf(stderr, "Warning: arc4random is not available!\n");
state = (uint32_t)time(NULL);
}

uint32_t x = state;
x ^= x << 13;
x ^= x >> 17;
x ^= x << 5;
state = x;
return x;
}

// Taken from https://opensource.apple.com/source/Libc/Libc-1082.50.1/gen/FreeBSD/arc4random.c
// Mac OS X 10.6.8 and earlier do not have arc4random_uniform, so we implement one.
uint32_t pseudo_random_between(uint32_t from, uint32_t to) {
uint32_t upper_bound = to + 1 - from;

#if defined(__GNUC__) && !defined(__EMSCRIPTEN__)
// Prefer native implementation if available.
if (arc4random_uniform)
return from + arc4random_uniform(upper_bound);
#endif

uint32_t r, min;

if (upper_bound < 2)
return from;

#if (ULONG_MAX > 0xffffffffUL)
min = 0x100000000UL % upper_bound;
#else
if (upper_bound > 0x80000000)
min = 1 + ~upper_bound;
else
min = ((0xffffffff - (upper_bound * 2)) + 1) % upper_bound;
#endif

for (;;) {
r = pseudo_random();
if (r >= min)
break;
}

return from + r % upper_bound;
}
14 changes: 14 additions & 0 deletions MacSerial/UserPseudoRandom.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
/** @file
Copyright (c) 2020, vit9696. All rights reserved.
SPDX-License-Identifier: BSD-3-Clause
**/

#ifndef OC_USER_PSEUDO_RANDOM_H
#define OC_USER_PSEUDO_RANDOM_H

#include <stdint.h>

uint32_t pseudo_random(void);
uint32_t pseudo_random_between(uint32_t from, uint32_t to);

#endif // OC_USER_PSEUDO_RANDOM_H
Loading

0 comments on commit b9f9afc

Please sign in to comment.