0 Replies Latest reply on Jul 27, 2012 9:14 PM by xandrios

    ADL SDK - having trouble with ADL_Overdrive5_ODParameters_Get in C#




      I'm trying to program a tool using the ADL SDK. I've ran into an issue too hard for me to crack. (ADL_Overdrive5_ODParameters_Get function)


      The code:

      /// <summary> ADLODPerformanceLevel Structure</summary>
      internal struct ADLODPerformanceLevel
          /// <summary> Engine clock </summary>
          internal int iEngineClock;
          /// <summary> Memory clock </summary>
          internal int iMemoryClock;
          /// <summary> Core voltage </summary>
          internal int iVddc;
      /// <summary> ADLODPerformanceLevels Structure</summary>
      internal struct ADLODPerformanceLevels
          /// <summary> Must be set to sizeof( ADLODPerformanceLevels ) + sizeof( ADLODPerformanceLevel ) * (ADLODParameters.iNumberOfPerformanceLevels - 1) </summary>
          internal int iSize;
          /// <summary> Reserved for future use </summary>
          internal int iReserved;
          /// <summary> Engine clock range</summary>
          internal ADLODPerformanceLevel[] aLevels;


      ADLODParameters adlod = new ADLODParameters();

      ADL.ADL_Overdrive5_ODParameters_Get(0, ref adlod);

      ADLODPerformanceLevels performancelevels = new ADLODPerformanceLevels();

      performancelevels.aLevels = new ADLODPerformanceLevel[adlod.iNumberOfPerformanceLevels];

      ADLODPerformanceLevel tmp = new ADLODPerformanceLevel();

      //iSize must be set to sizeof( ADLODPerformanceLevels ) + sizeof( ADLODPerformanceLevel ) * (ADLODParameters.iNumberOfPerformanceLevels - 1)

      performancelevels.iSize = Marshal.SizeOf(performancelevels) + Marshal.SizeOf(tmp) * (adlod.iNumberOfPerformanceLevels - 1);

      ADLODPerformanceLevels defaultPerformancelevels = new ADLODPerformanceLevels();

      if (null != ADL.ADL_Overdrive5_ODPerformanceLevels_Get)

          ADLRet = ADL.ADL_Overdrive5_ODPerformanceLevels_Get(0, 0, ref performancelevels);



      All code seems to work up until the last line. It looks like the performancelevels variable still isn't in a state it's supposed to be? (at least I think that's what the issue is)

      Bug says: ArgumentException was unhandled (exception of HRESULT: 0x80070057 (E_INVALIDARG))


      Any help would be appreciated. Thanks (If you need more info, just ask)