CapFrameX OSD with RTSS

Discussion in 'Rivatuner Statistics Server (RTSS) Forum' started by ZeroStrat, Nov 4, 2019.

  1. ZeroStrat

    ZeroStrat Member

    Messages:
    49
    Likes Received:
    17
    GPU:
    RTX 2080 Ti
    Hi,

    I'am the developer of CapFrameX, a new capture and analysis tool like OCAT or FrameView: https://github.com/DevTechProfile/CapFrameX

    I would like to use RTSS to create a custom OSD. What I want is to send status information to RTSS to visualize them. The first step could be to show a simple icon on the display.

    I need a developer guide/documentation to do so. A few code examples would be very helpful.

    Can you help me?

    Greets, ZeroStrat
     
    RodroG and SpajdrEX like this.
  2. Hilbert Hagedoorn

    Hilbert Hagedoorn Don Vito Corleone Staff Member

    Messages:
    39,157
    Likes Received:
    7,807
    GPU:
    AMD | NVIDIA
    Hey ZeroStrat, welcome - I actually use your software. An SDK can be found inside the RT installation directory.
     
    ZeroStrat, Andy_K and SpajdrEX like this.
  3. SpajdrEX

    SpajdrEX AMD Vanguard

    Messages:
    2,446
    Likes Received:
    760
    GPU:
    GB RTX3080 Eagle OC
    Welcome to forum ZeroStrat ;)
     
    ZeroStrat likes this.
  4. ZeroStrat

    ZeroStrat Member

    Messages:
    49
    Likes Received:
    17
    GPU:
    RTX 2080 Ti
    Hi!

    Yeah, I've already seen "suspicious" graphics here on guru3d. ^^ I hope you like it. And thanks for the tip with the SKD. I never noticed that, sorry. Ok, I checked the examples an they are very helpful I think. But one thing leaves questions unanswered. How can I display an icon/pic at a defined position?

    Greets, ZeroStrat.
     

  5. Unwinder

    Unwinder Moderator Staff Member

    Messages:
    14,921
    Likes Received:
    2,050
    OSD hypertext doesn’t support custom image rendering.
     
  6. ZeroStrat

    ZeroStrat Member

    Messages:
    49
    Likes Received:
    17
    GPU:
    RTX 2080 Ti
    OK, and how can frametime graphes be drawn on the display?
     
  7. Unwinder

    Unwinder Moderator Staff Member

    Messages:
    14,921
    Likes Received:
    2,050
    Embedded graphs rendering is demonstrated in open source sample code included in SDK.
     
    ZeroStrat likes this.
  8. ZeroStrat

    ZeroStrat Member

    Messages:
    49
    Likes Received:
    17
    GPU:
    RTX 2080 Ti
    Is support of custom image rendering planned in the future?

    One another question. Could it cause problems if CapFrameX and Afterburner access RTSS at the same time?
     
    Last edited: Nov 4, 2019
  9. Unwinder

    Unwinder Moderator Staff Member

    Messages:
    14,921
    Likes Received:
    2,050
    RTSS is designed to allow multiple clients to render text simultaneously. Apps like HwInfo/AIDA and MSI AB are safely rendering the text via RTSS at the same time for years.
    And no, I'm afraid cutom image rendering is not planned. It is completely useless thing for hardware monitoring purposes and at the same time it increases hypertext handling complexity drastically. So it doesn't worth the efforts from my POV.
     
    ZeroStrat likes this.
  10. ZeroStrat

    ZeroStrat Member

    Messages:
    49
    Likes Received:
    17
    GPU:
    RTX 2080 Ti
    Ok, many thanks for your help.
     

  11. ZeroStrat

    ZeroStrat Member

    Messages:
    49
    Likes Received:
    17
    GPU:
    RTX 2080 Ti
  12. ZeroStrat

    ZeroStrat Member

    Messages:
    49
    Likes Received:
    17
    GPU:
    RTX 2080 Ti
    @UnwinderI have a question about a special constant parameter.

    Code:
    DWORD RTSSCoreControl::EmbedGraph(DWORD dwOffset, FLOAT* lpBuffer, DWORD dwBufferPos, DWORD dwBufferSize, LONG dwWidth, LONG dwHeight, LONG dwMargin, FLOAT fltMin, FLOAT fltMax, DWORD dwFlags)
    {
      DWORD dwResult = 0;
    
      HANDLE hMapFile = OpenFileMapping(FILE_MAP_ALL_ACCESS, FALSE, "RTSSSharedMemoryV2");
    
      if (hMapFile)
      {
        LPVOID pMapAddr = MapViewOfFile(hMapFile, FILE_MAP_ALL_ACCESS, 0, 0, 0);
        LPRTSS_SHARED_MEMORY pMem = (LPRTSS_SHARED_MEMORY)pMapAddr;
    
        if (pMem)
        {
          if ((pMem->dwSignature == 'RTSS') &&
            (pMem->dwVersion >= 0x00020000))
          {
            for (DWORD dwPass = 0; dwPass < 2; dwPass++)
              //1st pass : find previously captured OSD slot
              //2nd pass : otherwise find the first unused OSD slot and capture it
            {
              for (DWORD dwEntry = 1; dwEntry < pMem->dwOSDArrSize; dwEntry++)
                //allow primary OSD clients (i.e. EVGA Precision / MSI Afterburner) to use the first slot exclusively, so third party
                //applications start scanning the slots from the second one
              {
                RTSS_SHARED_MEMORY::LPRTSS_SHARED_MEMORY_OSD_ENTRY pEntry = (RTSS_SHARED_MEMORY::LPRTSS_SHARED_MEMORY_OSD_ENTRY)((LPBYTE)pMem + pMem->dwOSDArrOffset + dwEntry * pMem->dwOSDEntrySize);
    
                if (dwPass)
                {
                  if (!strlen(pEntry->szOSDOwner))
                    strcpy_s(pEntry->szOSDOwner, sizeof(pEntry->szOSDOwner), "RTSSSharedMemorySample");
                }
    
                if (!strcmp(pEntry->szOSDOwner, "RTSSSharedMemorySample"))
                {
                  if (pMem->dwVersion >= 0x0002000c)
                    //embedded graphs are supported for v2.12 and higher shared memory
                  {
                    if (dwOffset + sizeof(RTSS_EMBEDDED_OBJECT_GRAPH) + dwBufferSize * sizeof(FLOAT) > sizeof(pEntry->buffer))
                      //validate embedded object offset and size and ensure that we don't overrun the buffer
                    {
                      UnmapViewOfFile(pMapAddr);
    
                      CloseHandle(hMapFile);
    
                      return 0;
                    }
    
                    LPRTSS_EMBEDDED_OBJECT_GRAPH lpGraph = (LPRTSS_EMBEDDED_OBJECT_GRAPH)(pEntry->buffer + dwOffset);
                    //get pointer to object in buffer
    
                    lpGraph->header.dwSignature = RTSS_EMBEDDED_OBJECT_GRAPH_SIGNATURE;
                    lpGraph->header.dwSize = sizeof(RTSS_EMBEDDED_OBJECT_GRAPH) + dwBufferSize * sizeof(FLOAT);
                    lpGraph->header.dwWidth = dwWidth;
                    lpGraph->header.dwHeight = dwHeight;
                    lpGraph->header.dwMargin = dwMargin;
                    lpGraph->dwFlags = dwFlags;
                    lpGraph->fltMin = fltMin;
                    lpGraph->fltMax = fltMax;
                    lpGraph->dwDataCount = dwBufferSize;
    
                    if (lpBuffer && dwBufferSize)
                    {
                      for (DWORD dwPos = 0; dwPos < dwBufferSize; dwPos++)
                      {
                        FLOAT fltData = lpBuffer[dwBufferPos];
    
                        lpGraph->fltData[dwPos] = (fltData == FLT_MAX) ? 0 : fltData;
    
                        dwBufferPos = (dwBufferPos + 1) & (dwBufferSize - 1);
                      }
                    }
    
                    dwResult = lpGraph->header.dwSize;
                  }
    
                  break;
                }
              }
    
              if (dwResult)
                break;
            }
          }
    
          UnmapViewOfFile(pMapAddr);
        }
    
        CloseHandle(hMapFile);
      }
    
      return dwResult;
    }
    What I mean is "RTSSSharedMemoryV2". If change this CX overlay doesn't work anymore. What's the problem here? Does it have anything to do with a kind of client registration? How can I register CapFrameX like AB does?

    Many thanks, ZeroStrat
     
  13. Unwinder

    Unwinder Moderator Staff Member

    Messages:
    14,921
    Likes Received:
    2,050
    That's a name of shared memory region as it is created by RTSS, you cannot change that.
     
  14. Unwinder

    Unwinder Moderator Staff Member

    Messages:
    14,921
    Likes Received:
    2,050
    You probably confuse it with "RTSSSharedMemorySample", which is a name of OSD slot owner in this sample.
     
  15. ZeroStrat

    ZeroStrat Member

    Messages:
    49
    Likes Received:
    17
    GPU:
    RTX 2080 Ti
    Oh man. Yes, I wanted to change "RTSSSharedMemorySample" and the CX overlay doesn't work anymore.
     

  16. Unwinder

    Unwinder Moderator Staff Member

    Messages:
    14,921
    Likes Received:
    2,050
    szOSDOwner can be set to any string constant uniquely identifying your application.
     
  17. ZeroStrat

    ZeroStrat Member

    Messages:
    49
    Likes Received:
    17
    GPU:
    RTX 2080 Ti
    Hm, gonna test it again this evening.
     
  18. Unwinder

    Unwinder Moderator Staff Member

    Messages:
    14,921
    Likes Received:
    2,050
    Just ensure that you update it in all places - in the code that captures, releases and validates your OSD slot owner name.
     
    ZeroStrat likes this.
  19. ZeroStrat

    ZeroStrat Member

    Messages:
    49
    Likes Received:
    17
    GPU:
    RTX 2080 Ti
    Yes, that was exactly the problem. Thanks.
     
    Last edited: Jan 14, 2020
  20. Unwinder

    Unwinder Moderator Staff Member

    Messages:
    14,921
    Likes Received:
    2,050
    Excellent, congrats.
     

Share This Page