コード例 #1
0
const char *D_Home(void)
{
    const char *userhome = NULL;

#ifdef ANDROID
    return "/data/data/org.srb2/";
#endif
#ifdef _arch_dreamcast
    char VMUHOME[] = "HOME=/vmu/a1";
    putenv(VMUHOME); //don't use I_PutEnv
#endif

    if (M_CheckParm("-home") && M_IsNextParm())
        userhome = M_GetNextParm();
    else
    {
#if defined (GP2X)
        usehome = false; //let use the CWD
        return NULL;
#elif !((defined (__unix__) && !defined (MSDOS)) || defined(__APPLE__) || defined (UNIXCOMMON)) && !defined (__APPLE__) && !defined(_WIN32_WCE)
        if (FIL_FileOK(CONFIGFILENAME))
            usehome = false; // Let's NOT use home
        else
#endif
        userhome = I_GetEnv("HOME"); //Alam: my new HOME for srb2
    }
#if defined (_WIN32) && !defined(_WIN32_WCE) //Alam: only Win32 have APPDATA and USERPROFILE
    if (!userhome && usehome) //Alam: Still not?
    {
        char *testhome = NULL;
        testhome = I_GetEnv("APPDATA");
        if (testhome != NULL
                && (FIL_FileOK(va("%s" PATHSEP "%s" PATHSEP CONFIGFILENAME, testhome, DEFAULTDIR))))
        {
            userhome = testhome;
        }
    }
#ifndef __CYGWIN__
    if (!userhome && usehome) //Alam: All else fails?
    {
        char *testhome = NULL;
        testhome = I_GetEnv("USERPROFILE");
        if (testhome != NULL
                && (FIL_FileOK(va("%s" PATHSEP "%s" PATHSEP CONFIGFILENAME, testhome, DEFAULTDIR))))
        {
            userhome = testhome;
        }
    }
#endif// !__CYGWIN__
#endif// _WIN32
    if (usehome) return userhome;
    else return NULL;
}
コード例 #2
0
ファイル: screen.c プロジェクト: Pupswoof117/SRB2-Public
// do some initial settings for the game loading screen
//
void SCR_Startup(void)
{
	const CPUInfoFlags *RCpuInfo = I_CPUInfo();
	if (!M_CheckParm("-NOCPUID") && RCpuInfo)
	{
#if defined (__i386__) || defined (_M_IX86) || defined (__WATCOMC__)
		R_486 = true;
#endif
		if (RCpuInfo->RDTSC)
			R_586 = true;
		if (RCpuInfo->MMX)
			R_MMX = true;
		if (RCpuInfo->AMD3DNow)
			R_3DNow = true;
		if (RCpuInfo->MMXExt)
			R_MMXExt = true;
		if (RCpuInfo->SSE2)
			R_SSE2 = true;

		if (RCpuInfo->CPUs > 1)
		{
			R_ASM = false; //with more than 1 CPU, ASM go BOOM!
		}
		CONS_Printf("CPU Info: 486: %i, 586: %i, MMX: %i, 3DNow: %i, MMXExt: %i, SSE2: %i\n",
		            R_486, R_586, R_MMX, R_3DNow, R_MMXExt, R_SSE2);
	}

	if (M_CheckParm("-noASM"))
		R_ASM = false;
	if (M_CheckParm("-486"))
		R_486 = true;
	if (M_CheckParm("-586"))
		R_586 = true;
	if (M_CheckParm("-MMX"))
		R_MMX = true;
	if (M_CheckParm("-3DNow"))
		R_3DNow = true;
	if (M_CheckParm("-MMXExt"))
		R_MMXExt = true;
	if (M_CheckParm("-SSE2"))
		R_SSE2 = true;

#if defined (_WIN32) && !defined (_WIN32_WCE) && !defined (_XBOX)
	if (!RCpuInfo || !RCpuInfo->CPUs) //bad CPUID code?
	{
		LPCSTR cNOP = I_GetEnv("NUMBER_OF_PROCESSORS");
		if (cNOP && atoi(cNOP) > 1 && !M_CheckParm("-ASM"))
		{
			R_ASM = false;
			CONS_Printf("Disabling ASM code\n");
		}
	}
#endif

	M_SetupMemcpy();

	if (dedicated)
	{
		V_Init();
		V_SetPalette(0);
		return;
	}

	vid.modenum = 0;

	vid.fdupx = (float)vid.width/BASEVIDWIDTH;
	vid.fdupy = (float)vid.height/BASEVIDHEIGHT;
	vid.dupx = (INT32)vid.fdupx;
	vid.dupy = (INT32)vid.fdupy;

	vid.baseratio = FRACUNIT;

#ifdef RUSEASM
	if (R_ASM)
		ASM_PatchRowBytes(vid.rowbytes);
//	if (R_486 || R_586 || R_MMX)
//		MMX_PatchRowBytes(vid.rowbytes);
#endif

	V_Init();
	CV_RegisterVar(&cv_ticrate);

	V_SetPalette(0);
}