@rwo
This is GetVPModeID to get the modeid, and GetDisplayInfoData to get height and width, small test case:
#include <exec/types.h>
#include <proto/exec.h>
#include <proto/dos.h>
#include <proto/intuition.h>
#include <proto/graphics.h>
#include <intuition/screens.h>
#include <graphics/displayinfo.h>
int main(void)
{
struct Library *GraphicsBase = NULL;
struct GraphicsIFace *IGraphics = NULL;
struct Library *IntuitionBase = NULL;
struct IntuitionIFace *IIntuition = NULL;
// Open libraries and interfaces
if (!(GraphicsBase = IExec->OpenLibrary("graphics.library", 54)) ||
!(IGraphics = (struct GraphicsIFace *)IExec->GetInterface(GraphicsBase, "main", 1, NULL)) ||
!(IntuitionBase = IExec->OpenLibrary("intuition.library", 51)) ||
!(IIntuition = (struct IntuitionIFace *)IExec->GetInterface(IntuitionBase, "main", 1, NULL)))
{
IDOS->Printf("Failed to open required libraries or interfaces.\n");
goto cleanup;
}
struct Screen *scr = IIntuition->LockPubScreen(NULL);
if (!scr) {
IDOS->Printf("Failed to lock public screen.\n");
goto cleanup;
}
// Get real ModeID using GetVPModeID()
ULONG modeid = IGraphics->GetVPModeID(&scr->ViewPort);
struct DimensionInfo di;
if (IGraphics->GetDisplayInfoData(NULL, (APTR)&di, sizeof(di), DTAG_DIMS, modeid)) {
ULONG w = di.Nominal.MaxX - di.Nominal.MinX + 1;
ULONG h = di.Nominal.MaxY - di.Nominal.MinY + 1;
IDOS->Printf("ModeID: 0x%08lx, Width: %lu, Height: %lu\n", modeid, w, h);
} else {
IDOS->Printf("Failed to get display info for ModeID 0x%08lx\n", modeid);
}
IIntuition->UnlockPubScreen(NULL, scr);
cleanup:
if (IIntuition) IExec->DropInterface((struct Interface *)IIntuition);
if (IntuitionBase) IExec->CloseLibrary(IntuitionBase);
if (IGraphics) IExec->DropInterface((struct Interface *)IGraphics);
if (GraphicsBase) IExec->CloseLibrary(GraphicsBase);
return RETURN_OK;
}