コード例 #1
0
ファイル: testmain.cpp プロジェクト: mekolat/ManaPlus
int TestMain::exec(const bool testAudio)
{
    initConfig();
    int softwareTest = invokeSoftwareRenderTest("1");
    int soundTest = -1;
    int rescaleTest[6];
    int softFps = 0;
    int normalOpenGLFps = 0;
    int safeOpenGLFps = 0;
    int modernOpenGLFps = 0;
    int textureSize[6];
    std::string textureSizeStr;

    RenderType openGLMode = RENDER_SOFTWARE;
    int detectMode = 0;
    for (int f = 0; f < 6; f ++)
    {
        rescaleTest[f] = -1;
        textureSize[f] = 1024;
    }
    std::string info;

    const int videoDetectTest = invokeTest("99");
    if (videoDetectTest == 0)
        detectMode = readValue2(99);

    int normalOpenGLTest = invokeNormalOpenGLRenderTest("2");
    int safeOpenGLTest = invokeSafeOpenGLRenderTest("3");
    int modernOpenGLTest = invokeModernOpenGLRenderTest("19");
    if (testAudio)
        soundTest = invokeTest4();
    else
        soundTest = 0;

    info.append(strprintf("%d.%d,%d,%d,%d.", soundTest, softwareTest,
        normalOpenGLTest, safeOpenGLTest, modernOpenGLTest));

    if (softwareTest == 0)
    {
        int softFpsTest = invokeSoftwareRenderTest("8");
        info.append(strprintf("%d", softFpsTest));
        if (softFpsTest == 0)
        {
            softFps = readValue2(8);
            info.append(strprintf(",%d", softFps));
            if (softFps == 0)
            {
                softwareTest = -1;
                softFpsTest = -1;
            }
            else
            {
                rescaleTest[0] = invokeSoftwareRenderTest("5");
                info.append(strprintf(",%d", rescaleTest[0]));
            }
        }
        else
        {
            softwareTest = -1;
        }
    }
    info.append(".");
    if (modernOpenGLTest == 0)
    {
        int modernOpenGLFpsTest = invokeModernOpenGLRenderTest("17");
        info.append(strprintf("%d", modernOpenGLFpsTest));
        if (modernOpenGLFpsTest == 0)
        {
            modernOpenGLFps = readValue2(17);
            info.append(strprintf(",%d", modernOpenGLFps));
            if (modernOpenGLFps == 0)
            {
                modernOpenGLTest = -1;
                modernOpenGLFpsTest = -1;
            }
            else
            {
                rescaleTest[3] = invokeModernOpenGLRenderTest("18");
                info.append(strprintf(",%d", rescaleTest[3]));
            }
        }
        else
        {
            modernOpenGLTest = -1;
        }
    }
    info.append(".");
    if (normalOpenGLTest == 0)
    {
        int normalOpenGLFpsTest = invokeNormalOpenGLRenderTest("9");
        info.append(strprintf("%d", normalOpenGLFpsTest));
        if (normalOpenGLFpsTest == 0)
        {
            normalOpenGLFps = readValue2(9);
            info.append(strprintf(",%d", normalOpenGLFps));
            if (normalOpenGLFps == 0)
            {
                normalOpenGLTest = -1;
                normalOpenGLFpsTest = -1;
            }
            else
            {
                rescaleTest[1] = invokeNormalOpenGLRenderTest("6");
                info.append(strprintf(",%d", rescaleTest[1]));
            }
        }
        else
        {
            normalOpenGLTest = -1;
        }
    }
    info.append(".");
    if (safeOpenGLTest == 0)
    {
        int safeOpenGLFpsTest = invokeSafeOpenGLRenderTest("10");
        info.append(strprintf("%d", safeOpenGLFpsTest));
        if (safeOpenGLFpsTest == 0)
        {
            safeOpenGLFps = readValue2(10);
            info.append(strprintf(",%d", safeOpenGLFps));
            if (safeOpenGLFps == 0)
            {
                safeOpenGLTest = -1;
                safeOpenGLFpsTest = -1;
            }
            else
            {
                rescaleTest[2] = invokeSafeOpenGLRenderTest("7");
                info.append(strprintf(",%d", rescaleTest[2]));
            }
        }
        else
        {
            safeOpenGLTest = -1;
        }
    }
    info.append(".");

    int maxFps = softFps;
    if (maxFps < normalOpenGLFps)
    {
        openGLMode = RENDER_NORMAL_OPENGL;
        maxFps = normalOpenGLFps;
    }
    if (maxFps < modernOpenGLFps)
    {
        openGLMode = RENDER_MODERN_OPENGL;
        maxFps = modernOpenGLFps;
    }
    if (maxFps < safeOpenGLFps)
    {
        openGLMode = RENDER_SAFE_OPENGL;
        maxFps = safeOpenGLFps;
    }

    int batchSize = 256;

    if (invokeNormalOpenBatchTest("11") == 0)
        batchSize = readValue2(11);
    if (batchSize < 256)
        batchSize = 256;

    if (invokeNormalOpenBatchTest("14") == 0)
    {
        textureSize[CAST_SIZE(RENDER_NORMAL_OPENGL)]
            = readValue2(14);
    }
    if (invokeModernOpenBatchTest("15") == 0)
    {
        textureSize[CAST_SIZE(RENDER_MODERN_OPENGL)]
            = readValue2(15);
    }
    if (invokeSafeOpenBatchTest("16") == 0)
    {
        textureSize[CAST_SIZE(RENDER_SAFE_OPENGL)]
            = readValue2(16);
    }
    if (invokeMobileOpenBatchTest("20") == 0)
    {
        textureSize[CAST_SIZE(RENDER_GLES_OPENGL)]
            = readValue2(20);
    }
    for (int f = 0; f < 6; f ++)
        info.append(strprintf(",%d", textureSize[f]));
    info.append(",-");

    textureSizeStr = toString(textureSize[0]);
    for (int f = 1; f < 6; f ++)
        textureSizeStr.append(strprintf(",%d", textureSize[f]));

    // if OpenGL implimentation is not good, disable it.
    if ((detectMode & 15) == 0)
        openGLMode = RENDER_SOFTWARE;

    writeConfig(openGLMode, rescaleTest[CAST_SIZE(openGLMode)],
        soundTest, info, batchSize, textureSizeStr, detectMode);
    return 0;
}
コード例 #2
0
ファイル: testmain.cpp プロジェクト: Evonline/ManaPlus
int TestMain::exec(bool testAudio)
{
    initConfig();
    int softwareTest = invokeSoftwareRenderTest("1");
    int fastOpenGLTest = -1;
    int safeOpenGLTest = -1;
    int videoDetectTest = -1;
    int soundTest = -1;
    int rescaleTest[3];
    int softFps = 0;
    int fastOpenGLFps = 0;
    int safeOpenGLFps = 0;

    int openGLMode = 0;
    int maxFps = 0;
    int detectMode = 0;
    rescaleTest[0] = -1;
    rescaleTest[1] = -1;
    rescaleTest[2] = -1;
    std::string info;

    videoDetectTest = invokeTest("99");
    if (!videoDetectTest)
        detectMode = readValue2(99);

    fastOpenGLTest = invokeFastOpenGLRenderTest("2");
    safeOpenGLTest = invokeSafeOpenGLRenderTest("3");
    if (testAudio)
        soundTest = invokeTest4();
    else
        soundTest = true;

    info += strprintf("%d.%d,%d,%d.", soundTest, softwareTest,
        fastOpenGLTest, safeOpenGLTest);

    if (!softwareTest)
    {
        int softFpsTest = invokeSoftwareRenderTest("8");
        info += strprintf ("%d", softFpsTest);
        if (!softFpsTest)
        {
            softFps = readValue2(8);
            info += strprintf (",%d", softFps);
            if (!softFps)
            {
                softwareTest = -1;
                softFpsTest = -1;
            }
            else
            {
                rescaleTest[0] = invokeSoftwareRenderTest("5");
                info += strprintf (",%d", rescaleTest[0]);
            }
        }
        else
        {
            softwareTest = -1;
        }
    }
    info += ".";
    if (!fastOpenGLTest)
    {
        int fastOpenGLFpsTest = invokeFastOpenGLRenderTest("9");
        info += strprintf ("%d", fastOpenGLFpsTest);
        if (!fastOpenGLFpsTest)
        {
            fastOpenGLFps = readValue2(9);
            info += strprintf (",%d", fastOpenGLFps);
            if (!fastOpenGLFps)
            {
                fastOpenGLTest = -1;
                fastOpenGLFpsTest = -1;
            }
            else
            {
                rescaleTest[1] = invokeFastOpenGLRenderTest("6");
                info += strprintf (",%d", rescaleTest[1]);
            }
        }
        else
        {
            fastOpenGLTest = -1;
        }
    }
    info += ".";
    if (!safeOpenGLTest)
    {
        int safeOpenGLFpsTest = invokeSafeOpenGLRenderTest("10");
        info += strprintf ("%d", safeOpenGLFpsTest);
        if (!safeOpenGLFpsTest)
        {
            safeOpenGLFps = readValue2(10);
            info += strprintf (",%d", safeOpenGLFps);
            if (!safeOpenGLFps)
            {
                safeOpenGLTest = -1;
                safeOpenGLFpsTest = -1;
            }
            else
            {
                rescaleTest[2] = invokeSafeOpenGLRenderTest("7");
                info += strprintf (",%d", rescaleTest[2]);
            }
        }
        else
        {
            safeOpenGLTest = -1;
        }
    }
    info += ".";

    maxFps = softFps;
    if (maxFps < fastOpenGLFps)
    {
        openGLMode = 1;
        maxFps = fastOpenGLFps;
    }
    if (maxFps < safeOpenGLFps)
    {
        openGLMode = 2;
        maxFps = safeOpenGLFps;
    }

    // if OpenGL implimentation is not good, disable it.
    if (!detectMode)
        openGLMode = 0;

    writeConfig(openGLMode, rescaleTest[openGLMode], soundTest, info);
    return 0;
}