Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
MantisMountainMobile authored Mar 16, 2022
1 parent 66f7936 commit fb8671e
Show file tree
Hide file tree
Showing 23 changed files with 1,385 additions and 761 deletions.
1 change: 1 addition & 0 deletions source/tc2ch/dll/dll.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -416,6 +416,7 @@
<ClCompile Include="subclock.c" />
<ClCompile Include="sysres.c" />
<ClCompile Include="tclock.c" />
<ClCompile Include="tempmon.c" />
<ClCompile Include="tooltip.c" />
<ClCompile Include="utl.c" />
</ItemGroup>
Expand Down
3 changes: 3 additions & 0 deletions source/tc2ch/dll/dll.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,9 @@
<ClCompile Include="gpumon.c">
<Filter>ソース ファイル</Filter>
</ClCompile>
<ClCompile Include="tempmon.c">
<Filter>ソース ファイル</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="resource.h">
Expand Down
102 changes: 65 additions & 37 deletions source/tc2ch/dll/format.c
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,9 @@ extern int nLogicalProcessors;
extern BOOL b_EnableClock2;

extern int numPDHGPUInstance;

extern int pdhTemperature;
extern double pdhTemperatureDouble;
extern BOOL b_TempAvailable;

/*------------------------------------------------
GetLocaleInfo() for 95/NT
Expand Down Expand Up @@ -865,18 +867,6 @@ void MakeFormat(char* s, char* s_info, SYSTEMTIME* pt, int beat100, char* fmt)
sp++;
}
}
//else if(*sp == 'R') // System Resources
//{
// int i, per, len, slen;
// BOOL bComma = FALSE;
// i = 3;
// if(*(sp + 1) == 'S') i = 0;
// else if(*(sp + 1) == 'G') i = 1;
// else if(*(sp + 1) == 'U') i = 2;

// *dp++ = *sp++;
// *infop++ = 0x01;
//}

// CPU Usage
else if(*sp == 'C')
Expand Down Expand Up @@ -1009,6 +999,37 @@ void MakeFormat(char* s, char* s_info, SYSTEMTIME* pt, int beat100, char* fmt)
}
}

//TEMPERATURE
else if (*sp == 'T' && (*(sp + 1) == 'E') && (*(sp + 2) == 'M') && (*(sp + 3) == 'P'))
{
int len, slen;
BOOL bComma = FALSE;
sp += 4;

if (!b_TempAvailable)
{
*dp++ = 'N'; *infop++ = 0x01;
*dp++ = 'A'; *infop++ = 0x01;
}
else
{
if (GetNumFormat(&sp, 'x', ',', &len, &slen, &bComma) == TRUE)
{
len_ret = SetNumFormat(&dp, pdhTemperature, len, slen, bComma);
for (int i = 0; i < len_ret; i++)*infop++ = 0x01;
}
else
{
if (pdhTemperature > 99) {
*dp++ = (char)((pdhTemperature % 1000) / 100 + '0'); *infop++ = 0x01;
}
*dp++ = (char)((pdhTemperature % 100) / 10 + '0'); *infop++ = 0x01;
*dp++ = (char)((pdhTemperature % 10) + '0'); *infop++ = 0x01;
}
}
}



// GPU Usage
else if (*sp == 'G')
Expand Down Expand Up @@ -2397,27 +2418,30 @@ DWORD FindFormat(char* fmt)
else
ret |= FORMAT_BEAT1;
}
else if(*sp == 'R' &&
(*(sp + 1) == 'S' || *(sp + 1) == 'G' || *(sp + 1) == 'U') )
{
sp += 2;
ret |= FORMAT_SYSINFO;
}
//else if(*sp == 'R' &&
// (*(sp + 1) == 'S' || *(sp + 1) == 'G' || *(sp + 1) == 'U') )
//{
// sp += 2;
// ret |= FORMAT_SYSINFO;
//}
else if(*sp == 'C' && *(sp + 1) == 'U' &&
(isdigit(*(sp + 2)) && *(sp + 2) != '8' && *(sp + 2) != '9') )
{
sp += 3;
ret |= FORMAT_PERMON;
//ret |= FORMAT_PERMON;
ret |= FORMAT_CPU;
}
else if(*sp == 'C' && *(sp + 1) == 'U')
{
sp += 2;
ret |= FORMAT_SYSINFO;
ret |= FORMAT_PERMON;
//ret |= FORMAT_SYSINFO;
//ret |= FORMAT_PERMON;
ret |= FORMAT_CPU;
}
else if(*sp == 'C' && *(sp + 1) == 'C')
{
sp += 2;
//ret |= FORMAT_PERMON;
ret |= FORMAT_CPU;
}
else if(*sp == 'B' && *(sp + 1) == 'L')
Expand Down Expand Up @@ -2453,21 +2477,21 @@ DWORD FindFormat(char* fmt)
sp += 4;
ret |= FORMAT_MEMORY;
}
else if(*sp == 'B' && *(sp + 1) == 'T')
{
sp += 2;
ret |= FORMAT_MOTHERBRD;
}
else if(*sp == 'B' && *(sp + 1) == 'V')
{
sp += 2;
ret |= FORMAT_MOTHERBRD;
}
else if(*sp == 'B' && *(sp + 1) == 'F')
{
sp += 2;
ret |= FORMAT_MOTHERBRD;
}
//else if(*sp == 'B' && *(sp + 1) == 'T')
//{
// sp += 2;
// ret |= FORMAT_MOTHERBRD;
//}
//else if(*sp == 'B' && *(sp + 1) == 'V')
//{
// sp += 2;
// ret |= FORMAT_MOTHERBRD;
//}
//else if(*sp == 'B' && *(sp + 1) == 'F')
//{
// sp += 2;
// ret |= FORMAT_MOTHERBRD;
//}
else if(*sp == 'N' &&
(*(sp + 1) == 'R' || *(sp + 1) == 'S') &&
(*(sp + 2) == 'S' || *(sp + 2) == 'A') &&
Expand Down Expand Up @@ -2510,6 +2534,10 @@ DWORD FindFormat(char* fmt)
sp += 2;
ret |= FORMAT_GPU;
}
else if (*sp == 'T' && (*(sp + 1) == 'E') && (*(sp + 2) == 'M') && (*(sp + 3) == 'P')) {
sp += 4;
ret |= FORMAT_TEMP;
}
else sp = CharNext(sp);
}
}
Expand Down
14 changes: 6 additions & 8 deletions source/tc2ch/dll/gpumon.c
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*-------------------------------------------------------------------------
permon.c
gpumon.c
get performance monitor counter
Kazubon 2001
Kazubon 2001 (permon.c) -> MantisMountainMobile 2022
---------------------------------------------------------------------------*/

#include <windows.h>
Expand Down Expand Up @@ -29,7 +29,6 @@ typedef PDH_STATUS(WINAPI *pfnPdhCollectQueryData)(PDH_HQUERY);
typedef PDH_STATUS(WINAPI *pfnPdhGetFormattedCounterValue)(PDH_HCOUNTER, DWORD, LPDWORD, PPDH_FMT_COUNTERVALUE);
typedef PDH_STATUS(WINAPI *pfnPdhCloseQuery)(PDH_HQUERY);
typedef PDH_STATUS(WINAPI *pfnPdhRemoveCounter)(PDH_HCOUNTER);

typedef PDH_STATUS(WINAPI *pfnPdhAddCounterA)(PDH_HQUERY, LPCSTR, DWORD_PTR, PDH_HCOUNTER*);

static pfnPdhOpenQueryW pPdhOpenQueryW;
Expand All @@ -38,7 +37,6 @@ static pfnPdhCollectQueryData pPdhCollectQueryData;
static pfnPdhGetFormattedCounterValue pPdhGetFormattedCounterValue;
static pfnPdhCloseQuery pPdhCloseQuery;
static pfnPdhRemoveCounter pPdhRemoveCounter;

static pfnPdhAddCounterA pPdhAddCounterA;

void GPUMoni_start(void)
Expand Down Expand Up @@ -109,7 +107,7 @@ int SetGPUUsageCounter(void)

extern BOOL b_DebugLog;
if (b_DebugLog)writeDebugLog_Win10("[newCodes_Win10.cpp] SetGPUUsageCounter called.", 999);
int count = 0, numPDHGPUInstanceNew = 0;;
int count = 0, numPDHGPUInstanceNew = 0;
CONST PSTR COUNTER_OBJECT = "GPU Engine";


Expand Down Expand Up @@ -203,11 +201,11 @@ int SetGPUUsageCounter(void)
return 0;
}

char counterName[PDH_MAX_COUNTER_PATH];
for (pTemp = pwsInstanceListBuffer; *pTemp != 0; pTemp += strlen(pTemp) + 1)
{
// if (strstr(pTemp, "_0_eng_0_engtype_3D") || strstr(pTemp, "_0_eng_0_engtype_VideoDecode")) //Currently use limited instances
{
char counterName[PDH_MAX_COUNTER_PATH];
snprintf(counterName, PDH_MAX_COUNTER_PATH, "\\GPU Engine(%s)\\Utilization Percentage", pTemp); //shoud be "%%" because of using wsprintfW
if (pPdhAddCounterA(hQueryGPU, counterName, 0, &hGPUCounter[count]) == ERROR_SUCCESS)
{
Expand Down Expand Up @@ -284,11 +282,11 @@ int GPUMoni_get(void)
if (totalGPUUsage > 100)totalGPUUsage = 100;
}
else {
if (b_DebugLog) writeDebugLog_Win10("[gpumon.c][GPUMoni_get] hQueryGPU does not exist!", 999);
// if (b_DebugLog) writeDebugLog_Win10("[gpumon.c][GPUMoni_get] hQueryGPU does not exist!", 999);
}


if (b_DebugLog) writeDebugLog_Win10("[gpumon.c][GPUMoni_get] GPU usage = ", totalGPUUsage);
// if (b_DebugLog) writeDebugLog_Win10("[gpumon.c][GPUMoni_get] GPU usage = ", totalGPUUsage);

if (hmodPDH)SetGPUUsageCounter();

Expand Down
2 changes: 1 addition & 1 deletion source/tc2ch/dll/permon.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
#define MAX_PROCESSOR 64
#include "tcdll.h"


//moved to tcdll.c
void PerMoni_start(void);
int PerMoni_get(void);
void PerMoni_end(void);
Expand Down
17 changes: 13 additions & 4 deletions source/tc2ch/dll/tcdll.h
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,8 @@
#define CLOCKM_SLEEP_IN (WM_USER+220) //Added by TTTT
#define CLOCKM_SLEEP_AWAKE (WM_USER+221) //Added by TTTT

#define CLOCKM_REQUEST_TEMPCOUNTERINFO (WM_USER + 230)

#define IDC_EXIT 102
#define IDC_RESTART 40007

Expand Down Expand Up @@ -129,18 +131,19 @@ void InitFormat(SYSTEMTIME* lt);
void MakeFormat(char* s, char* s_info, SYSTEMTIME* pt, int beat100, char* fmt);
//void MakeFormat_Colored(char* s, COLORREF* s_col, SYSTEMTIME* pt, int beat100, char* fmt);
#define FORMAT_SECOND 0x0001
#define FORMAT_SYSINFO 0x0002
//#define FORMAT_SYSINFO 0x0002
#define FORMAT_BEAT1 0x0004
#define FORMAT_BEAT2 0x0008
#define FORMAT_BATTERY 0x0010
#define FORMAT_MEMORY 0x0020
#define FORMAT_MOTHERBRD 0x0040
#define FORMAT_PERMON 0x0080
//#define FORMAT_MOTHERBRD 0x0040
//#define FORMAT_PERMON 0x0080
#define FORMAT_NET 0x0100
#define FORMAT_HDD 0x0200
#define FORMAT_CPU 0x0400
#define FORMAT_VOL 0x0800
#define FORMAT_GPU 0x1000
#define FORMAT_TEMP 0x2000
DWORD FindFormat(char* fmt);

SYSTEMTIME CalcTimeDifference_Win10(SYSTEMTIME*, int, int, BOOL);
Expand Down Expand Up @@ -243,6 +246,12 @@ int SetGPUUsageCounter(void);
void GPUMoni_start(void);
void GPUMoni_end(void);

//tempmon.c
void TempMoni_start(void);
int TempMoni_get(int zone);
void TempMoni_end(void);
int SetThemalZoneCounter(void);

// net.c
void Net_start(void);
//void Net_restart(void);
Expand All @@ -263,7 +272,7 @@ void TooltipReadData(void);
void TooltipDeleteRes(void);
void TooltipEnd(HWND hwnd);
DWORD TooltipFindFormat(void);
void TooltipOnTimer(HWND hwnd);
void TooltipOnTimer(HWND hwnd, BOOL bForce);
void TooltipOnRefresh(HWND hwnd);
BOOL TooltipOnNotify(LRESULT *plRes, LPARAM lParam);
void TooltipOnMouseEvent(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam);
Expand Down
8 changes: 4 additions & 4 deletions source/tc2ch/dll/tcdll.rc
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ LANGUAGE LANG_JAPANESE, SUBLANG_DEFAULT
//

VS_VERSION_INFO VERSIONINFO
FILEVERSION 4,10,3,1
PRODUCTVERSION 4,10,3,1
FILEVERSION 4,11,5,1
PRODUCTVERSION 4,11,5,1
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS 0x1L
Expand All @@ -45,11 +45,11 @@ BEGIN
BEGIN
VALUE "Comments", "TClock DLL for Windows10 and Windows11"
VALUE "FileDescription", "DLL for TClock-Win10"
VALUE "FileVersion", "4.10.3.1"
VALUE "FileVersion", "4.11.5.1"
VALUE "InternalName", "TCDLL"
VALUE "OriginalFilename", "tcdll-win10.dll"
VALUE "ProductName", "TClock-Win10"
VALUE "ProductVersion", "4.10.3.1"
VALUE "ProductVersion", "4.11.5.1"
END
END
BLOCK "VarFileInfo"
Expand Down
Loading

0 comments on commit fb8671e

Please sign in to comment.