⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 mainun.pas

📁 pipe类 pipe类 pipe类 pipe类 pipe类
💻 PAS
📖 第 1 页 / 共 3 页
字号:
  CurrentCpuNum:=CpuSelectionV.ItemIndex;

  PrSignature.Caption:='OverSoft CPU Informer version '+VersionSignature;
  MainFrm.Text:='OverSoft CPU Informer '+VersionSignature;

  Standard1ff.Enabled:=CPUInfo[CurrentCpuNum].FeaturesFlags.std1ff.is_avail;
  Standard2ff.Enabled:=CPUInfo[CurrentCpuNum].FeaturesFlags.std2ff.is_avail;
  Extended1ff.Enabled:=CPUInfo[CurrentCpuNum].FeaturesFlags.ext1ff.is_avail;
  Extended2ff.Enabled:=CPUInfo[CurrentCpuNum].FeaturesFlags.ext2ff.is_avail;

  level2bt.Enabled:=CPUInfo[CurrentCpuNum].level2.is_l2_cache;
  level3bt.Enabled:=CPUInfo[CurrentCpuNum].level3.is_l3_cache;

  ShowCpuInfo(CurrentCpuNum);
  ShowClocksInfo(CurrentCpuNum);
  ShowMemoryInfo;

  ShowEPM;
  InitFIDVIDData;
  RefreshPMdata;

  ShowStd1ff(CurrentCpuNum);
  ShowLevel1(CurrentCpuNum);
  ShowInfoAtOnce;

  MainFrm.OnKeyDown:=FormKeyDown;
  MainFrm.OnKeyUp:=FormKeyUp;

  //Window size
  if (Screen.WorkAreaHeight - MainFrm.Height < 10) then
      begin
         MainFrm.Height:=Screen.WorkAreaHeight - 10;
         Nav_downB.Visible:=true;
         Nav_upB.Visible:=true;
      end;

  //Sceenshot dir init
  ScreenSSave:=ExtractFilePath(ParamSTR(0));
  except
    MessageBox(MainFrm.Handle,'Failed to start program!', 'Error!', MB_ICONINFORMATION);
    Application.Terminate;
  end;

  CreateSensorMenus;
end;

procedure TMainFrm.ShowMemoryInfo;
begin
  if MemInfo.fgRAMInfo.DRAMType<>'' then
  begin
    m_TypeV.Caption:=MemInfo.fgRAMInfo.DRAMType;
    m_Type.Font.Color:=$008D4803;
  end
  else begin
    m_Type.Font.Color:=$00CDB098;
  end;

  if MemInfo.fgRAMInfo.RamSize<>0 then
  begin
    m_SizeV.Caption:=format('%d MB', [MemInfo.fgRAMInfo.RamSize]);
    m_Size.Font.Color:=$008D4803;
  end
  else begin
    m_Size.Font.Color:=$00CDB098;
  end;

  if MemInfo.fgRAMInfo.DRAMClock<>0 then
  begin
    m_FreqV.Caption:=format('%f MHz', [MemInfo.fgRAMInfo.DRAMClock]);
    m_Freq.Font.Color:=$008D4803;
  end
  else begin
    m_Freq.Font.Color:=$00CDB098;
  end;

  if MemInfo.fgRAMInfo.DRAMCoef<>'' then
  begin
    m_DivV.Caption:=MemInfo.fgRAMInfo.DRAMCoef;
    m_Div.Font.Color:=$008D4803;
  end
  else begin
    m_Div.Font.Color:=$00CDB098;
  end;

  if MemInfo.fgRAMInfo.DRAMAccel<>'' then
  begin
    m_AccelV.Caption:=MemInfo.fgRAMInfo.DRAMAccel;
    m_Accel.Font.Color:=$008D4803;
  end
  else begin
    m_Accel.Font.Color:=$00CDB098;
  end;

  if MemInfo.fgRAMInfo.DRAMCnls<>'' then
  begin
    m_ChanV.Caption:=MemInfo.fgRAMInfo.DRAMCnls;
    m_Chan.Font.Color:=$008D4803;
  end
  else begin
    m_Chan.Font.Color:=$00CDB098;
  end;

  if MemInfo.fTimings.CAS<>0 then
  begin
    mt_CLV.Caption:=FloatToStr(MemInfo.fTimings.CAS);
    mt_CL.Font.Color:=$008D4803;
  end
  else begin
    mt_CL.Font.Color:=$00CDB098;
  end;

  if MemInfo.fTimings.RCD<>0 then
  begin
    mt_tRCDV.Caption:=FloatToStr(MemInfo.fTimings.RCD);
    mt_tRCD.Font.Color:=$008D4803;
  end
  else begin
    mt_tRCD.Font.Color:=$00CDB098;
  end;

  if MemInfo.fTimings.RP<>0 then
  begin
    mt_tRPV.Caption:=FloatToStr(MemInfo.fTimings.RP);
    mt_tRP.Font.Color:=$008D4803;
  end
  else begin
    mt_tRP.Font.Color:=$00CDB098;
  end;

  if MemInfo.fTimings.RAS<>0 then
  begin
    mt_tRASV.Caption:=FloatToStr(MemInfo.fTimings.RAS);
    mt_tRAS.Font.Color:=$008D4803;
  end
  else begin
    mt_tRAS.Font.Color:=$00CDB098;
  end;
end;

procedure TMainFrm.CpuSelectionVChange(Sender: TObject);
begin
  CurrentCpuNum:=CpuSelectionV.ItemIndex;

  ShowCpuInfo(CurrentCpuNum);
  ShowClocksInfo(CurrentCpuNum);
end;

procedure TMainFrm.ShowEPM;    //Power management
var
  st: string;
begin
  PMFeatV.Font.Style:=[];
  PMFeatV.Font.Color:=$00CDB098;
  PMFeatV.Caption:='None';

  if CPUInfo[0].PManagement.EIST=1 then
          begin
            PMFeatV.Font.Color:=$00000000;
            st:='EIST';
            st:=st+', ';
          end;

  if CPUInfo[0].PManagement.TM1=1 then
          begin
            PMFeatV.Font.Color:=$00000000;
            st:=st+'TM1';
            if CPUInfo[0].CheckTM=1 then st:=st+'(+)'
                                       else st:=st+'(-)';
            st:=st+', ';
          end;

  if CPUInfo[0].PManagement.TM2=1 then
          begin
            PMFeatV.Font.Color:=$00000000;
            st:=st+'TM2';
            if CPUInfo[0].CheckTM=2 then st:=st+'(+)'
                                       else st:=st+'(-)';
            st:=st+', ';
          end;

  if CPUInfo[0].PManagement.C1E=1 then
          begin
            PMFeatV.Font.Color:=$00000000;
            st:=st+'C1E';
            st:=st+', ';
          end;

  if CPUInfo[0].PManagement.ODCM=1 then
          begin
            PMFeatV.Font.Color:=$00000000;
            st:=st+'ODCM';
            if CPUInfo[0].CheckODCM=1000 then st:=st+'(-)'
                                            else st:=st+'(+)';
            st:=st+', ';
          end;

  if CPUInfo[0].PManagement.PowerNow=1 then
          begin
            PMFeatV.Font.Color:=$00000000;
            st:=st+'PowerNow';
            st:=st+', ';
          end;

  if CPUInfo[0].PManagement.CoolnQuiet=1 then
          begin
            PMFeatV.Font.Color:=$00000000;
            st:=st+'Cool''n''Quiet';
            st:=st+', ';
          end;

  if PMFeatV.Font.Color<>$00CDB098 then delete(st,length(st)-1,2);
  if st<>'' then PMFeatV.Caption:=st;
  //1.00
end;

procedure TMainFrm.InitFIDVIDData;
var
  d: single;
  i: byte;
begin
  if (CPUInfo[0].PManagement.CoolnQuiet=1) or (CPUInfo[0].PManagement.PowerNow=1) then
      begin
        FVControl.Enabled:=true;
        if CPUInfo[0].PManagement.CoolnQuiet=1 then
          begin
            //VID fill
            VIDcb.Clear;
            d:=1.550;
            while (d>=0.800) do
              begin
                VIDcb.Items.Add(FormatFloat('0.000v', d));
                d:=d-0.025;
              end;
            VIDcb.ItemIndex:=0;
            //FID fill
            FIDcb.Clear;
		        d:=4.0;
            while (d<=25.0) do
              begin
                FIDcb.Items.Add(FormatFloat('0.0x', d));
                d:=d+0.5;
              end;
            FIDcb.ItemIndex:=0;
          end
        else if (CPUInfo[0].PManagement.PowerNow=1) and (CPUInfo[0].CPUid_m.std_family=6) then
          begin
            //VID fill
            VIDcb.Clear;
            for i:=0 to 31 do
              VIDcb.Items.Add(FormatFloat('0.000v', VIDTableAthlonM[i]));
            VIDcb.ItemIndex:=0;
            //FID fill
            FIDcb.Clear;
            for i:=0 to 31 do
              FIDcb.Items.Add(FormatFloat('0.0x', fK7MobileMultTable[fK7MobileMultTableDisp[i]]));
            FIDcb.ItemIndex:=0;
          end
        else if (CPUInfo[0].PManagement.PowerNow=1) and (CPUInfo[0].CPUid_m.std_family=5) then
          begin
            VIDcb.Enabled:=false;
            FIDcb.Clear;
            for i:=0 to 7 do
              FIDcb.Items.Add(FormatFloat('0.0x', fK6MultTable[fK6MultTableDisp[i]]));
            FIDcb.ItemIndex:=0;
          end;
      end
    else
      FVControl.Enabled:=false;
end;

procedure TMainFrm.RefreshPMdata;
begin
  //On-Demand Clock Modulation
  if CPUInfo[0].PManagement.ODCM=1 then
      begin
        ODCMGB.Enabled:=true;
        case CPUInfo[0].CheckODCM of
          125: odcm125.Checked:=true;
          250: odcm250.Checked:=true;
          375: odcm375.Checked:=true;
          500: odcm500.Checked:=true;
          635: odcm635.Checked:=true;
          750: odcm750.Checked:=true;
          875: odcm875.Checked:=true;
          1000: odcm1000.Checked:=true;
        end;
      end
    else
      ODCMGB.Enabled:=false;

  //Termal Monitor Control
  if (CPUInfo[0].PManagement.TM1=1) or (CPUInfo[0].PManagement.TM2=1) then
      begin
        TMCGB.Enabled:=true;
        case CPUInfo[0].CheckTM of
          0: TM0.Checked:=true;
          1: TM1.Checked:=true;
          2: TM2.Checked:=true;
        end;
        if CPUInfo[0].PManagement.TM1=0 then TM1.Enabled:=false
        else if CPUInfo[0].PManagement.TM2=0 then TM2.Enabled:=false;
      end
    else
      TMCGB.Enabled:=false;

  //FID/VID control
  if CPUInfo[0].PManagement.CoolnQuiet=1 then
    begin
      VIDcb.ItemIndex:=CPUInfo[0].GetVID;
      FIDcb.ItemIndex:=CPUInfo[0].GetFID;
    end
  else if (CPUInfo[0].PManagement.PowerNow=1) and (CPUInfo[0].CPUid_m.std_family=6) then
    begin
      VIDcb.ItemIndex:=CPUInfo[0].GetVID;
      FIDcb.ItemIndex:=fK7MobileMultTableMap[CPUInfo[0].GetFID];
    end
  else if (CPUInfo[0].PManagement.PowerNow=1) and (CPUInfo[0].CPUid_m.std_family=5) then
    begin
      FIDcb.ItemIndex:=fK6MultTableMap[CPUInfo[0].GetFID];
    end;

  ShowEPM;
end;

procedure TMainFrm.ApplyPMdata;
var
  tmp: string;
  Multtrg: Single;
begin
  //On-Demand Clock Modulation
  if CPUInfo[0].PManagement.ODCM=1 then
    begin
      if odcm125.Checked then CPUInfo[0].SetODCM(125)
      else if odcm250.Checked then CPUInfo[0].SetODCM(250)
      else if odcm375.Checked then CPUInfo[0].SetODCM(375)
      else if odcm500.Checked then CPUInfo[0].SetODCM(500)
      else if odcm635.Checked then CPUInfo[0].SetODCM(635)
      else if odcm750.Checked then CPUInfo[0].SetODCM(750)
      else if odcm875.Checked then CPUInfo[0].SetODCM(875)
      else if odcm1000.Checked then CPUInfo[0].SetODCM(1000);
    end;

  //Termal Monitor Control
  if (CPUInfo[0].PManagement.TM1=1) or (CPUInfo[0].PManagement.TM2=1) then
    begin
      if TM1.Checked then CPUInfo[0].SetTM(1)
      else if TM2.Checked then CPUInfo[0].SetTM(2)
      else if TM0.Checked then CPUInfo[0].SetTM(0);
    end;

  //FID/VID control
  if CPUInfo[0].PManagement.CoolnQuiet=1 then
    begin
      tmp:=FIDcb.Items[FIDcb.ItemIndex];
      Delete(tmp, Length(tmp), 1);
      Multtrg:=StrToFloat(tmp);

      if Multtrg>CPUInfo[0].Clocks.Multiplier then
              begin
                CPUInfo[0].SetVID(VIDcb.ItemIndex);
                CPUInfo[0].SetFID(FIDcb.ItemIndex);
              end
      else if Multtrg<CPUInfo[0].Clocks.Multiplier then
              begin
                CPUInfo[0].SetFID(FIDcb.ItemIndex);
                CPUInfo[0].SetVID(VIDcb.ItemIndex);
              end;
    end
  else if (CPUInfo[0].PManagement.PowerNow=1) and (CPUInfo[0].CPUid_m.std_family=6) then
    begin
      tmp:=FIDcb.Items[FIDcb.ItemIndex];
      Delete(tmp, Length(tmp), 1);
      Multtrg:=StrToFloat(tmp);

      if Multtrg>CPUInfo[0].Clocks.Multiplier then
              begin
                CPUInfo[0].SetVID(VIDcb.ItemIndex);
                CPUInfo[0].SetFID(fK7MobileMultTableDisp[FIDcb.ItemIndex]);
              end
      else if Multtrg<CPUInfo[0].Clocks.Multiplier then
              begin
                CPUInfo[0].SetFID(fK7MobileMultTableDisp[FIDcb.ItemIndex]);
                CPUInfo[0].SetVID(VIDcb.ItemIndex);
              end;
    end
   else if (CPUInfo[0].PManagement.PowerNow=1) and (CPUInfo[0].CPUid_m.std_family=5) then
    begin
      tmp:=FIDcb.Items[FIDcb.ItemIndex];
      Delete(tmp, Length(tmp), 1);
      Multtrg:=StrToFloat(tmp);
      CPUInfo[0].SetFID(fK6MultTableDisp[FIDcb.ItemIndex]);
    end;
end;

procedure TMainFrm.FormKeyDown(Sender: TObject; var Key: Word;
  Shift: TShiftState);
var
  fBitmap: tBitmap;
  fPNGImage: tPNGImage;
  SShotDir: AnsiString;
  fSaveDialog: tSaveDialog;
  i: byte;
begin
  case Key of
    $10: isShiftDown:=true;
    $11: isCtrlDown:=true;
    $1B: Close; //Application.Terminate;
    $74: begin
      try
        fBitmap:=tBitmap.Create;
        fPNGImage:=tPNGImage.Create;
        GetScreenShot(fBitmap);
        fPNGImage.Assign(fBitmap);
        SShotDir:=ExtractFilePath(ParamSTR(0));
        case MainPC.ActivePageIndex of
          0:SShotDir:=SShotDir+'OSCIProc';
          1:SShotDir:=SShotDir+'OSCISystem';
          2:SShotDir:=SShotDir+'OSCIFlags';
          3:SShotDir:=SShotDir+'OSCICache';
          4:SShotDir:=SShotDir+'OSCIManag';
          5:SShotDir:=SShotDir+'OSCIAbout';
        end;
        fSaveDialog:=tSaveDialog.Create(Self);
        fSaveDialog.Filter:='Portable Network Graphics (*.png)|*.png';
        fSaveDialog.FileName:=SShotDir;
        if fSaveDialog.Execute then
        begin
          fPNGImage.SaveToFile(fSaveDialog.FileName+'.png');
          ScreenSSave:=fSaveDialog.GetNamePath;
        end;
        fSaveDialog.Destroy;
      finally
        fBitmap.Free;
        fPNGImage.Free;
      end;
    end;
    $75: begin
      try
        fBitmap:=tBitmap.Create;
        fPNGImage:=tPNGImage.Create;
        GetScreenShot(fBitmap);
        fPNGImage.Assign(fBitmap);
        SShotDir:=ScreenSSave;
        case MainPC.ActivePageIndex of
          0: SShotDir:=SShotDir+'OSCIProc.png';
          1: SShotDir:=SShotDir+'OSCISystem.png';
          2: SShotDir:=SShotDir+'OSCIFlags.png';
          3: SShotDir:=SShotDir+'OSCICache.png';
          4: SShotDir:=SShotDir+'OSCIManag.png';
          5: SShotDir:=SShotDir+'OSCIAbout.png';
        end;
        fPNGImage.SaveToFile(SShotDir);
      finally
        fBitmap.Free;
        fPNGImage.Free;
      end;
    end;
  end;
end;

procedure TMainFrm.FormKeyUp(Sender: TObject; var Key: Word;
  Shift: TShiftState);
begin
  case Key of
    $10: isShiftDown:=false;
    $11: isCtrlDown:=false;
  end;
end;

function TMainFrm.GetScreenShot(var AImage: TBitmap): Boolean;
var
  fBitmap: TBitmap;
  DC: HDC;
begin
  Result := False;
  DC := GetDC(GetDesktopWindow);
  if DC <> 0 then
      begin
        fBitmap:=TBitmap.Create;
        try
          fBitmap.Width:=MainFrm.Width;
          fBitmap.Height:=MainFrm.Height;
          fBitmap.PixelFormat:=pf32bit;
          bitblt(fBitmap.Canvas.Handle,0,0,MainFrm.Width,MainFrm.Height,DC,MainFrm.left,MainFrm.Top,SRCCopy);
          AImage.Assign(fBitmap);
          result:=true;
        finally
          fBitmap.Free;
        end;
      end;
end;

procedure TMainFrm.ThLb1Click(Sender: TObject);
begin
  ShellExecute(0, 'open', PChar('http://forums.overclockers.ru'), nil, nil, SW_SHOWNORMAL);
end;

//Navigation button "Down"
procedure TMainFrm.Nav_downBMouseEnter(Sender: TObject);
begin
Nav_downB.Color:=$00EADBCF;
end;

procedure TMainFrm.Nav_downBMouseLeave(Sender: TObject);
begin
Nav_downB.Color:=$00FCF6F1;
end;

//Navigation button "Up"
procedure TMainFrm.Nav_upBMouseEnter(Sender: TObject);
begin
Nav_upB.Color:=$00EADBCF;
end;

procedure TMainFrm.Nav_upBMouseLeave(Sender: TObject);
begin
Nav_upB.Color:=$00FCF6F1;
end;

//Navigation (for low resolutions)

procedure TMainFrm.Nav_downClick(Sender: TObject);

var Bottom, Delta: Integer;

begin

Bottom:= MainFrm.ClientHeight - (MainPC.Top + MainPC.Height);

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -