Skip to content

Commit 0e403f1

Browse files
committed
fix max number of cores
1 parent bec2068 commit 0e403f1

File tree

7 files changed

+62
-35
lines changed

7 files changed

+62
-35
lines changed

AMD Power Gadget/Base.lproj/Main.storyboard

Lines changed: 42 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -707,7 +707,7 @@
707707
<scene sceneID="hIz-AP-VOD">
708708
<objects>
709709
<viewController id="XfG-lQ-9wD" customClass="ViewController" customModule="AMD_Power_Gadget" customModuleProvider="target" sceneMemberID="viewController">
710-
<view key="view" id="m2S-Jp-Qdl">
710+
<view key="view" appearanceType="darkAqua" id="m2S-Jp-Qdl">
711711
<rect key="frame" x="0.0" y="0.0" width="410" height="940"/>
712712
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
713713
<subviews>
@@ -721,18 +721,16 @@
721721
<rect key="frame" x="0.0" y="0.0" width="388" height="925"/>
722722
<autoresizingMask key="autoresizingMask"/>
723723
<subviews>
724-
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="YXN-KS-nxl">
725-
<rect key="frame" x="18" y="866" width="298" height="39"/>
726-
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
724+
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="YXN-KS-nxl">
725+
<rect key="frame" x="18" y="867" width="298" height="38"/>
727726
<textFieldCell key="cell" lineBreakMode="clipping" title="AMD Power Gadget" id="kgx-Yz-PbY">
728727
<font key="font" size="27" name="HelveticaNeue-Bold"/>
729728
<color key="textColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
730729
<color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
731730
</textFieldCell>
732731
</textField>
733-
<customView fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="dUS-mw-nYz" customClass="GraphView" customModule="AMD_Power_Gadget" customModuleProvider="target">
734-
<rect key="frame" x="20" y="596" width="368" height="241"/>
735-
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
732+
<customView translatesAutoresizingMaskIntoConstraints="NO" id="dUS-mw-nYz" customClass="GraphView" customModule="AMD_Power_Gadget" customModuleProvider="target">
733+
<rect key="frame" x="20" y="596" width="368" height="242"/>
736734
<subviews>
737735
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="Jld-SV-yGS">
738736
<rect key="frame" x="18" y="202" width="298" height="27"/>
@@ -798,9 +796,8 @@
798796
</userDefinedRuntimeAttribute>
799797
</userDefinedRuntimeAttributes>
800798
</customView>
801-
<customView fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="TFs-yj-lzu" customClass="GraphView" customModule="AMD_Power_Gadget" customModuleProvider="target">
799+
<customView translatesAutoresizingMaskIntoConstraints="NO" id="TFs-yj-lzu" customClass="GraphView" customModule="AMD_Power_Gadget" customModuleProvider="target">
802800
<rect key="frame" x="20" y="336" width="368" height="241"/>
803-
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
804801
<subviews>
805802
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="Qhw-g2-Ry1">
806803
<rect key="frame" x="18" y="202" width="298" height="27"/>
@@ -866,9 +863,8 @@
866863
</userDefinedRuntimeAttribute>
867864
</userDefinedRuntimeAttributes>
868865
</customView>
869-
<customView fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="dVq-Zt-29Y" customClass="GraphView" customModule="AMD_Power_Gadget" customModuleProvider="target">
866+
<customView translatesAutoresizingMaskIntoConstraints="NO" id="dVq-Zt-29Y" customClass="GraphView" customModule="AMD_Power_Gadget" customModuleProvider="target">
870867
<rect key="frame" x="20" y="76" width="368" height="241"/>
871-
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
872868
<subviews>
873869
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="p3e-V6-tG5">
874870
<rect key="frame" x="18" y="202" width="298" height="27"/>
@@ -934,18 +930,20 @@
934930
</userDefinedRuntimeAttribute>
935931
</userDefinedRuntimeAttributes>
936932
</customView>
937-
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="lW7-TH-Jh4">
938-
<rect key="frame" x="18" y="849" width="372" height="21"/>
939-
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
940-
<textFieldCell key="cell" lineBreakMode="clipping" title="AMD Ryzen 9 3900X n-Core Processor" id="dkz-Wd-dhY">
941-
<font key="font" size="16" name="HelveticaNeue-Bold"/>
933+
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="lW7-TH-Jh4">
934+
<rect key="frame" x="18" y="846" width="372" height="29"/>
935+
<constraints>
936+
<constraint firstAttribute="height" constant="29" id="6C3-hR-dsW"/>
937+
<constraint firstAttribute="width" constant="368" id="bUD-fi-qGW"/>
938+
</constraints>
939+
<textFieldCell key="cell" lineBreakMode="truncatingTail" selectable="YES" alignment="left" title="AMD Ryzen 9 3900X n-Core Processor" id="dkz-Wd-dhY">
940+
<font key="font" size="15" name="HelveticaNeue-Bold"/>
942941
<color key="textColor" name="secondaryLabelColor" catalog="System" colorSpace="catalog"/>
943942
<color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
944943
</textFieldCell>
945944
</textField>
946-
<button verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="zyk-cy-OHd">
947-
<rect key="frame" x="143" y="20" width="103" height="21"/>
948-
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
945+
<button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="zyk-cy-OHd">
946+
<rect key="frame" x="155" y="25" width="79" height="16"/>
949947
<buttonCell key="cell" type="bevel" title="trulyspinach" bezelStyle="rounded" alignment="center" imageScaling="proportionallyDown" inset="2" id="Mcz-UE-trr">
950948
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
951949
<font key="font" metaFont="system"/>
@@ -955,16 +953,39 @@
955953
<action selector="buttonPressed:" target="XfG-lQ-9wD" id="64Z-nc-FX5"/>
956954
</connections>
957955
</button>
958-
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="tU5-xZ-Nqc">
956+
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="tU5-xZ-Nqc">
959957
<rect key="frame" x="103" y="43" width="183" height="16"/>
960-
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
961958
<textFieldCell key="cell" lineBreakMode="clipping" title="Designed and Engineered By:" id="j0C-AZ-HUC">
962959
<font key="font" metaFont="system"/>
963960
<color key="textColor" name="secondaryLabelColor" catalog="System" colorSpace="catalog"/>
964961
<color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
965962
</textFieldCell>
966963
</textField>
967964
</subviews>
965+
<constraints>
966+
<constraint firstItem="lW7-TH-Jh4" firstAttribute="trailing" secondItem="dUS-mw-nYz" secondAttribute="trailing" id="2VD-4R-hRQ"/>
967+
<constraint firstItem="zyk-cy-OHd" firstAttribute="top" secondItem="tU5-xZ-Nqc" secondAttribute="bottom" constant="2" id="6tT-DA-1CL"/>
968+
<constraint firstItem="lW7-TH-Jh4" firstAttribute="leading" secondItem="dVq-Zt-29Y" secondAttribute="leading" id="AWt-bz-fnf"/>
969+
<constraint firstItem="dUS-mw-nYz" firstAttribute="top" secondItem="YXN-KS-nxl" secondAttribute="bottom" constant="29" id="Gjz-Jd-Mwt"/>
970+
<constraint firstItem="YXN-KS-nxl" firstAttribute="top" secondItem="TIX-Q5-kis" secondAttribute="top" constant="20" symbolic="YES" id="H5I-vD-bdX"/>
971+
<constraint firstItem="lW7-TH-Jh4" firstAttribute="leading" secondItem="YXN-KS-nxl" secondAttribute="leading" id="H5h-02-vM6"/>
972+
<constraint firstItem="lW7-TH-Jh4" firstAttribute="leading" secondItem="dUS-mw-nYz" secondAttribute="leading" id="KjU-TQ-odV"/>
973+
<constraint firstItem="TFs-yj-lzu" firstAttribute="top" secondItem="TIX-Q5-kis" secondAttribute="top" constant="348" id="QD2-7C-QSt"/>
974+
<constraint firstItem="dVq-Zt-29Y" firstAttribute="top" secondItem="TFs-yj-lzu" secondAttribute="bottom" constant="19" id="THl-Lw-orm"/>
975+
<constraint firstItem="lW7-TH-Jh4" firstAttribute="trailing" secondItem="TFs-yj-lzu" secondAttribute="trailing" id="Wyh-vg-Hhw"/>
976+
<constraint firstItem="lW7-TH-Jh4" firstAttribute="leading" secondItem="TIX-Q5-kis" secondAttribute="leading" constant="20" symbolic="YES" id="Wzp-gX-th1"/>
977+
<constraint firstItem="tU5-xZ-Nqc" firstAttribute="centerX" secondItem="zyk-cy-OHd" secondAttribute="centerX" id="YFk-qA-lD9"/>
978+
<constraint firstItem="tU5-xZ-Nqc" firstAttribute="top" secondItem="dVq-Zt-29Y" secondAttribute="bottom" constant="17" id="Zu6-eZ-KuA"/>
979+
<constraint firstAttribute="bottom" secondItem="dVq-Zt-29Y" secondAttribute="bottom" constant="76" id="ZyT-Zt-PRq"/>
980+
<constraint firstItem="lW7-TH-Jh4" firstAttribute="leading" secondItem="TFs-yj-lzu" secondAttribute="leading" id="efh-Qa-okv"/>
981+
<constraint firstAttribute="trailing" secondItem="YXN-KS-nxl" secondAttribute="trailing" constant="74" id="hqb-jw-Oyu"/>
982+
<constraint firstItem="dUS-mw-nYz" firstAttribute="top" secondItem="lW7-TH-Jh4" secondAttribute="bottom" constant="8" id="ihb-nE-2b9"/>
983+
<constraint firstItem="lW7-TH-Jh4" firstAttribute="trailing" secondItem="dVq-Zt-29Y" secondAttribute="trailing" id="tRv-jb-fPd"/>
984+
<constraint firstItem="tU5-xZ-Nqc" firstAttribute="centerX" secondItem="TIX-Q5-kis" secondAttribute="centerX" id="xEB-Bl-cM3"/>
985+
<constraint firstItem="TFs-yj-lzu" firstAttribute="top" secondItem="dUS-mw-nYz" secondAttribute="bottom" constant="19" id="xWY-Ya-zkB"/>
986+
<constraint firstItem="lW7-TH-Jh4" firstAttribute="top" secondItem="TIX-Q5-kis" secondAttribute="top" constant="50" id="xy4-YI-iUL"/>
987+
<constraint firstItem="dVq-Zt-29Y" firstAttribute="top" secondItem="TIX-Q5-kis" secondAttribute="top" constant="608" id="yg4-w2-cFI"/>
988+
</constraints>
968989
</view>
969990
</subviews>
970991
</clipView>

AMD Power Gadget/GraphView.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ class GraphView: NSView {
4141
let gridDivLines: [Double] = [0, 0.15, 0.25, 0.35, 0.5, 0.6, 0.8, 1]
4242
let maxDataPoints = 30
4343

44-
let dummyData: [Double] = [1,3,3,2, 9, 1, 2 ,3]
44+
let dummyData: [Double] = [1,3,2]
4545
// let dummyData: [Double] = [1,1,1,3,2 ,1]
4646

4747

AMD Power Gadget/Info.plist

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,9 @@
1717
<key>CFBundlePackageType</key>
1818
<string>$(PRODUCT_BUNDLE_PACKAGE_TYPE)</string>
1919
<key>CFBundleShortVersionString</key>
20-
<string>1.0</string>
20+
<string>$(MARKETING_VERSION)</string>
2121
<key>CFBundleVersion</key>
22-
<string>1</string>
22+
<string>$(CURRENT_PROJECT_VERSION)</string>
2323
<key>LSMinimumSystemVersion</key>
2424
<string>$(MACOSX_DEPLOYMENT_TARGET)</string>
2525
<key>NSHumanReadableCopyright</key>

AMD Power Gadget/ViewController.swift

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,8 +105,9 @@ class ViewController: NSViewController, NSWindowDelegate {
105105
var numberOfCores: UInt64 = 0
106106
var outputCount: UInt32 = 1
107107

108-
var outputStr: [Float] = [Float](repeating: 0, count: 32)
109-
var outputStrCount: Int = 4 * 64
108+
let maxStrLength = 66 //MaxCpu + 2
109+
var outputStr: [Float] = [Float](repeating: 0, count: maxStrLength)
110+
var outputStrCount: Int = 4 * maxStrLength
110111
let res = IOConnectCallMethod(connect, 4, nil, 0, nil, 0,
111112
&numberOfCores, &outputCount,
112113
&outputStr, &outputStrCount)

SMCAMDProcessor.xcodeproj/project.pbxproj

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -252,11 +252,14 @@
252252
CODE_SIGN_ENTITLEMENTS = "AMD Power Gadget/AMD_Power_Gadget.entitlements";
253253
CODE_SIGN_STYLE = Automatic;
254254
COMBINE_HIDPI_IMAGES = YES;
255+
CURRENT_PROJECT_VERSION = 2;
255256
INFOPLIST_FILE = "AMD Power Gadget/Info.plist";
256257
LD_RUNPATH_SEARCH_PATHS = (
257258
"$(inherited)",
258259
"@executable_path/../Frameworks",
259260
);
261+
MACOSX_DEPLOYMENT_TARGET = 10.13;
262+
MARKETING_VERSION = 1.1;
260263
PRODUCT_BUNDLE_IDENTIFIER = "wtf.spinach.AMD-Power-Gadget";
261264
PRODUCT_NAME = "$(TARGET_NAME)";
262265
SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
@@ -272,11 +275,14 @@
272275
CODE_SIGN_ENTITLEMENTS = "AMD Power Gadget/AMD_Power_Gadget.entitlements";
273276
CODE_SIGN_STYLE = Automatic;
274277
COMBINE_HIDPI_IMAGES = YES;
278+
CURRENT_PROJECT_VERSION = 2;
275279
INFOPLIST_FILE = "AMD Power Gadget/Info.plist";
276280
LD_RUNPATH_SEARCH_PATHS = (
277281
"$(inherited)",
278282
"@executable_path/../Frameworks",
279283
);
284+
MACOSX_DEPLOYMENT_TARGET = 10.13;
285+
MARKETING_VERSION = 1.1;
280286
PRODUCT_BUNDLE_IDENTIFIER = "wtf.spinach.AMD-Power-Gadget";
281287
PRODUCT_NAME = "$(TARGET_NAME)";
282288
SWIFT_COMPILATION_MODE = wholemodule;
@@ -399,7 +405,7 @@
399405
buildSettings = {
400406
CODE_SIGN_STYLE = Manual;
401407
COMBINE_HIDPI_IMAGES = YES;
402-
CURRENT_PROJECT_VERSION = 1.0.1d1;
408+
CURRENT_PROJECT_VERSION = 1.1;
403409
GCC_PREPROCESSOR_DEFINITIONS = (
404410
"DEBUG=1",
405411
"$(inherited)",
@@ -412,7 +418,8 @@
412418
);
413419
INFOPLIST_FILE = SMCAMDProcessor/Info.plist;
414420
LIBRARY_SEARCH_PATHS = "$(PROJECT_DIR)/Lilu.kext/Contents/Resources/Library";
415-
MARKETING_VERSION = 1.0.1d1;
421+
MACOSX_DEPLOYMENT_TARGET = 10.13;
422+
MARKETING_VERSION = 1.1;
416423
MODULE_NAME = wtf.spinach.SMCAMDProcessor;
417424
MODULE_VERSION = 1.0.0d1;
418425
OTHER_CPLUSPLUSFLAGS = "-Wno-inconsistent-missing-override";
@@ -428,7 +435,7 @@
428435
buildSettings = {
429436
CODE_SIGN_STYLE = Manual;
430437
COMBINE_HIDPI_IMAGES = YES;
431-
CURRENT_PROJECT_VERSION = 1.0.1d1;
438+
CURRENT_PROJECT_VERSION = 1.1;
432439
GCC_PREPROCESSOR_DEFINITIONS = (
433440
"PRODUCT_NAME=$(PRODUCT_NAME)",
434441
"MODULE_VERSION=$(MODULE_VERSION)",
@@ -439,7 +446,8 @@
439446
);
440447
INFOPLIST_FILE = SMCAMDProcessor/Info.plist;
441448
LIBRARY_SEARCH_PATHS = "$(PROJECT_DIR)/Lilu.kext/Contents/Resources/Library";
442-
MARKETING_VERSION = 1.0.1d1;
449+
MACOSX_DEPLOYMENT_TARGET = 10.13;
450+
MARKETING_VERSION = 1.1;
443451
MODULE_NAME = wtf.spinach.SMCAMDProcessor;
444452
MODULE_VERSION = 1.0.0d1;
445453
OTHER_CPLUSPLUSFLAGS = "-Wno-inconsistent-missing-override";

SMCAMDProcessor/SMCAMDProcessor.cpp

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -265,7 +265,6 @@ void SMCAMDProcessor::updatePackageTemp(){
265265
// Offset table: https://github.com/torvalds/linux/blob/master/drivers/hwmon/k10temp.c#L78
266266
uint32_t totalNumberOfPhysicalCores = cpuTopology.totalPhysical();
267267

268-
269268
if(tempOffsetFlag) {
270269
if (totalNumberOfPhysicalCores == 6) // 1600X,1700X,1800X
271270
offset = -20.0f;
@@ -274,12 +273,10 @@ void SMCAMDProcessor::updatePackageTemp(){
274273
else if (totalNumberOfPhysicalCores == 12 || totalNumberOfPhysicalCores == 32) // TR1900,2900
275274
offset = -27.0f;
276275

277-
278-
if (tempOffsetFlag && (kF17H_TEMP_OFFSET_FLAG != 0))
276+
if (tempOffsetFlag)
279277
t += -49.0f;
280278
}
281279

282-
283280
if (offset < 0)
284281
t += offset;
285282

0 commit comments

Comments
 (0)