Пример #1
0
void							CELL_RC_GetData					()
{
	/* First map some default keys, map em later and they overwrite the ones loaded here */
#ifndef CELL_NO_SOFT_INPUT
	CELL_PAD_KEYBOARD_Map(4, HID_UP);
	CELL_PAD_KEYBOARD_Map(6, HID_DOWN);
	CELL_PAD_KEYBOARD_Map(7, HID_LEFT);
	CELL_PAD_KEYBOARD_Map(5, HID_RIGHT);
	CELL_PAD_KEYBOARD_Map(0, HID_TAB);
	CELL_PAD_KEYBOARD_Map(3, HID_RETURN);
	CELL_PAD_KEYBOARD_Map(9, HID_ESCAPE);
	CELL_PAD_KEYBOARD_Map(14, HID_LEFTBUTTON);
	CELL_PAD_KEYBOARD_Map(15, HID_RIGHTBUTTON);
#endif

	/* Read any rc file */
	if(RCFileSet && RCFile[0] == '/')
	{
		struct RCEntry* rcfile = ReadRCFile(RCFile);

#ifndef CELL_NO_SOFT_INPUT
		for(int i = 0; i != 16; i ++)
		{
			MapButton(ButtonNames[i], FindRCValue(rcfile, ButtonNames[i]));
		}
#endif

		MapUnderscan("screen_underscanx", FindRCValue(rcfile, "screen_underscanx"));
		MapUnderscan("screen_underscanY", FindRCValue(rcfile, "screen_underscany"));
#ifdef CELL_SHADER_SUPPORT
		MapShader("screen_shader", FindRCValue(rcfile, "screen_shader"));
#endif

		FreeRCFile(rcfile);
	}

	CalculateUnderscan();
}
Пример #2
0
//=============================================================================
void CManager::Update ()
{
    //byte newKeyState[256];
    //::GetKeyboardState(newKeyState);

    //for (uint i = 8; i < array_size(newKeyState); ++i)
    //{
    //    const bool newState = newKeyState[i] != 0;
    //    const bool oldState = m_keys[i] != 0;
    //    if (newState == oldState)
    //        continue;

    //    const EKey key = (EKey)i;
    //    m_keys[i] = newState;
    //    if (newState)
    //        m_notifier.Call(&CInputNotify::OnInputKeyDown, key);
    //    else
    //        m_notifier.Call(&CInputNotify::OnInputKeyUp, key);
    //}

    {
        XINPUT_STATE state;
        MemZero(state);
        const DWORD result = ::XInputGetState(0, &state);
        
        if (result == ERROR_SUCCESS)
        {
            m_gamepad.isAvailable = true;

            m_gamepad.axis[int(EGameAxis::LeftStickX)] = MapStick(state.Gamepad.sThumbLX);
            m_gamepad.axis[int(EGameAxis::LeftStickY)] = MapStick(state.Gamepad.sThumbLY);
            m_gamepad.axis[int(EGameAxis::LeftTrigger)] = MapTrigger(state.Gamepad.bLeftTrigger);

            m_gamepad.axis[int(EGameAxis::RightStickX)] = MapStick(state.Gamepad.sThumbRX);
            m_gamepad.axis[int(EGameAxis::RightStickY)] = MapStick(state.Gamepad.sThumbRY);
            m_gamepad.axis[int(EGameAxis::RightTrigger)] = MapTrigger(state.Gamepad.bRightTrigger);

            Update(EButton::LeftDpadUp, MapButton(state.Gamepad.wButtons, XINPUT_GAMEPAD_DPAD_UP));
            Update(EButton::LeftDpadUp, MapButton(state.Gamepad.wButtons, XINPUT_GAMEPAD_DPAD_UP));
            Update(EButton::LeftDpadRight, MapButton(state.Gamepad.wButtons, XINPUT_GAMEPAD_DPAD_RIGHT));
            Update(EButton::LeftDpadDown, MapButton(state.Gamepad.wButtons, XINPUT_GAMEPAD_DPAD_DOWN));
            Update(EButton::LeftDpadLeft, MapButton(state.Gamepad.wButtons, XINPUT_GAMEPAD_DPAD_LEFT));
            Update(EButton::LeftStick, MapButton(state.Gamepad.wButtons, XINPUT_GAMEPAD_LEFT_THUMB));
            Update(EButton::LeftShoulder, MapButton(state.Gamepad.wButtons, XINPUT_GAMEPAD_LEFT_SHOULDER));
            Update(EButton::LeftTrigger, (state.Gamepad.bLeftTrigger > XINPUT_GAMEPAD_TRIGGER_THRESHOLD));

            Update(EButton::RightDpadUp, MapButton(state.Gamepad.wButtons, XINPUT_GAMEPAD_Y));
            Update(EButton::RightDpadRight, MapButton(state.Gamepad.wButtons, XINPUT_GAMEPAD_X));
            Update(EButton::RightDpadDown, MapButton(state.Gamepad.wButtons, XINPUT_GAMEPAD_A));
            Update(EButton::RightDpadLeft, MapButton(state.Gamepad.wButtons, XINPUT_GAMEPAD_B));
            Update(EButton::RightStick, MapButton(state.Gamepad.wButtons, XINPUT_GAMEPAD_RIGHT_THUMB));
            Update(EButton::RightShoulder, MapButton(state.Gamepad.wButtons, XINPUT_GAMEPAD_RIGHT_SHOULDER));
            Update(EButton::RightTrigger, (state.Gamepad.bRightTrigger > XINPUT_GAMEPAD_TRIGGER_THRESHOLD));

            Update(EButton::CenterLeft, MapButton(state.Gamepad.wButtons, XINPUT_GAMEPAD_BACK));
            Update(EButton::CenterMiddle, false);
            Update(EButton::CenterRight, MapButton(state.Gamepad.wButtons, XINPUT_GAMEPAD_START));
        }
        else
        {
            MemZero(m_gamepad);
        }
    }
}
Пример #3
0
int ReadSettings(ONScripterLabel *pOns, const char *file)
{
	FILE *fp;
	char key[256];
	char value[256];
	int rt;
	//FILE *fp2;

#if defined(PSP)
	int value_int;

	putenv("SDL_ASPECT_RATIO=4:3");
#endif

	fp = fopen(file,"rt");
	//fp2 = fopen("setting.log","wb");
	if (!fp) return -1;
	
	while (!feof(fp))
	{
		rt = fscanf(fp, "%[^=\n]=%[^=\n]\n", key, value);
		if (rt==0 || rt==EOF) break;
		//fprintf(fp2, "KEY=%s, VALUE=%s\n", key, value);

		if (!stricmp(key, "FONT"))
		{
			pOns->setFontFile(value);
		}
		else if (!stricmp(key, "registry"))
		{
			pOns->setRegistryFile(value);
		}
		else if (!stricmp(key, "dll"))
		{
			pOns->setDLLFile(value);
		}
		else if (!stricmp(key, "root"))
		{
			pOns->setArchivePath(value);
		}
		else if (!stricmp(key, "fullscreen"))
		{
			if (!stricmp(value, "yes"))
				pOns->setFullscreenMode();
			else if (!stricmp(value, "no"))
				pOns->setWindowMode();
		}
			
#if defined(PSP)
		if (!stricmp(key, "RESOLUTION"))
		{
			value_int = atoi(value);
			if (value_int > 0 && value_int <= 360) os_screen_width=value_int;
		}
		else if (!stricmp(key, "SCREENSIZE"))
		{
			if (!stricmp(value,"NORMAL"))
			{
				putenv("SDL_ASPECT_RATIO=4:3");
			}
			else if (!stricmp(value,"FULL"))
			{
				putenv("SDL_ASPECT_RATIO=");
			}
		}
		else if (!stricmp(key, "CPUCLOCK"))
		{
			value_int = atoi(value);
			if (value_int > 0 && value_int <= 333)
				scePowerSetCpuClockFrequency(value_int);
		}
		else if (!stricmp(key, "BUSCLOCK"))
		{
			value_int = atoi(value);
			if (value_int > 0 && value_int <= 167)
				scePowerSetBusClockFrequency(value_int);
		}
		
		else if (!stricmp(key, "LMB_ONCE"))
		{
			MapButton(SDLK_SPACE, value);
		}
		else if (!stricmp(key, "LMB"))
		{
			MapButton(SDLK_RETURN, value);
		}
		else if (!stricmp(key, "RMB"))
		{
			MapButton(SDLK_ESCAPE, value);
		}
		else if (!stricmp(key, "CURSOR_PREV"))
		{
			MapButton(SDLK_UP ,value);
		}
		else if (!stricmp(key, "CURSOR_NEXT"))
		{
			MapButton(SDLK_DOWN, value);
		}
		else if (!stricmp(key, "SKIP"))
		{
			MapButton(SDLK_s, value);
		}
		else if (!stricmp(key, "PAGEFLIP"))
		{
			MapButton(SDLK_o, value);
		}
		else if (!stricmp(key, "MEM_UP"))
		{
			MapButton(SDLK_LEFT, value);
		}
		else if (!stricmp(key, "MEM_DOWN"))
		{
			MapButton(SDLK_RIGHT, value);
		}
		else if (!stricmp(key, "SKIPMODE"))
		{
			MapButton(SDLK_s, value);
		}
		else if (!stricmp(key, "AUTOMODE"))
		{
			MapButton(SDLK_a, value);
		}
		else if (!stricmp(key, "SPEED"))
		{
			MapButton(SDLK_0, value);
		}
		else if (!stricmp(key, "NONE"))
		{
			MapButton(SDLK_UNKNOWN, value);
		}
#endif
	}
	
	fclose(fp);
	//fclose(fp2);
	return 0;
}