Exemplo n.º 1
0
int initinput(void)
{
	GXOpenInput();
	klist = GXGetDefaultKeys(GX_NORMALKEYS);
	
	joykey_map[0][0] = klist.vkUp;
	joykey_map[0][1] = klist.vkDown;
	joykey_map[0][2] = klist.vkLeft;
	joykey_map[0][3] = klist.vkRight;
	
	joykey_map[1][0] = klist.vkLeft;
	joykey_map[1][1] = klist.vkRight;
	joykey_map[1][2] = klist.vkDown;
	joykey_map[1][3] = klist.vkUp;
	
	joykey_map[2][0] = klist.vkRight;
	joykey_map[2][1] = klist.vkLeft;
	joykey_map[2][2] = klist.vkUp;
	joykey_map[2][3] = klist.vkDown;

	kbd_translation[KBDT_F3].winKey = klist.vkA;
	kbd_translation[KBDT_F2].winKey = klist.vkB;
	kbd_translation[KBDT_UI].winKey = klist.vkC;

	kbd_image = kbd_image_800;
	kbd_struct = kbd_struct_800;
	keys = sizeof(kbd_struct_800)/sizeof(kbd_struct_800[0]);

	clearkb();

	stylus_down = 0;

	return 0;
}
Exemplo n.º 2
0
bool Input::Init (bool fFirstInit_/*=false*/)
{
    if (fFirstInit_)
    {
        // Create the SIP
        g_hwndSIP = CreateSIP();

        // Grab control of all the buttons
        GXOpenInput();
    }

    // Keymap defined?
    if (*GetOption(keymap))
    {
        char szKeys[256];
        strncpy(szKeys, GetOption(keymap), sizeof(szKeys));
        char *psz = strtok(szKeys, ",");

        // Assign the SAM key code for each pad/button mapping
        for (int i = 0 ; i < sizeof(anKeyMap)/sizeof(anKeyMap[0]) ; i++)
        {
            int nKey = (psz && psz[0]) ? strtoul(psz, NULL, 0) : SK_NONE;
            anKeyMap[i] = (nKey < SK_MAX) ? nKey : SK_NONE;
            psz = strtok(NULL, ",");
        }
    }

    // Initialise SAM mouse
    Mouse::Init(fFirstInit_);

    return true;
}
Exemplo n.º 3
0
int initinput(void)
{
	GXOpenInput();
	klist = GXGetDefaultKeys(GX_NORMALKEYS);
	
	joykey_map[0][0] = klist.vkUp;
	joykey_map[0][1] = klist.vkDown;
	joykey_map[0][2] = klist.vkLeft;
	joykey_map[0][3] = klist.vkRight;
	
	joykey_map[1][0] = klist.vkLeft;
	joykey_map[1][1] = klist.vkRight;
	joykey_map[1][2] = klist.vkDown;
	joykey_map[1][3] = klist.vkUp;
	
	joykey_map[2][0] = klist.vkRight;
	joykey_map[2][1] = klist.vkLeft;
	joykey_map[2][2] = klist.vkUp;
	joykey_map[2][3] = klist.vkDown;

	if (smkeyhack)
	{
		klist.vkB ^= klist.vkC;
		klist.vkC ^= klist.vkB;
		klist.vkB ^= klist.vkC;
	}

	if (issmartphone)
	{
		kbd_translation[KBDT_F3].winKey = '8';
		kbd_translation[KBDT_F2].winKey = '7';
		kbd_translation[KBDT_UI].winKey = klist.vkC;
		kbd_translation[KBDT_F4].winKey = '9';
		kbd_translation[KBDT_RETURN].winKey = '0';
 
	}
	else
	{
		kbd_translation[KBDT_F3].winKey = klist.vkA;
		kbd_translation[KBDT_F2].winKey = klist.vkB;
		kbd_translation[KBDT_UI].winKey = klist.vkC;
	}

	kbd_image = kbd_image_800;
	kbd_struct = kbd_struct_800;
	keys = sizeof(kbd_struct_800)/sizeof(kbd_struct_800[0]);

	clearkb();

	stylus_down = 0;

	return 0;
}
Exemplo n.º 4
0
int WINAPI WinMain(HINSTANCE hInstance,
				   HINSTANCE hPrevInstance,
#ifdef _WIN32_WCE
				   LPWSTR lpCmdLine,
#else
				   LPSTR lpCmdLine,
#endif
				   int nShowCmd
) {
	MSG 	msg;
#ifdef _WIN32_WCE
	TCHAR wzExePath[GF_MAX_PATH];
#endif

	HWND 	hwndOld = NULL;
	const char *str;
	Bool initial_launch = 0;

	if (hwndOld = FindWindow(_T("Osmophone"), NULL))
	{
		SetForegroundWindow(hwndOld);
		return 0;
	}

	memset(&user, 0, sizeof(GF_User));
	term = NULL;

	g_hinst = hInstance;

	screen_w = GetSystemMetrics(SM_CXSCREEN);
	screen_h = GetSystemMetrics(SM_CYSCREEN);

	/*are we in low res or high res*/
	RawFrameBufferInfo Info;
	HDC DC = GetDC(NULL);
	ExtEscape(DC, GETRAWFRAMEBUFFER, 0, NULL, sizeof(RawFrameBufferInfo), (char*)&Info);
	ReleaseDC(NULL,DC);
	if (Info.pFramePointer) {
		recompute_res(Info.cxPixels, Info.cyPixels);
	} else {
		recompute_res(screen_w, screen_h);
	}



#ifdef _WIN32_WCE
	TCHAR      szBuf[MAX_PATH];
	SystemParametersInfo(SPI_GETPLATFORMTYPE, MAX_PATH, szBuf, 0);
	if (! lstrcmp(szBuf, __TEXT("PocketPC"))) is_ppc = 1;
	else if (! lstrcmp(szBuf, __TEXT("Palm PC2"))) is_ppc = 1;
#endif


	user.config = gf_cfg_init(NULL, &initial_launch);
	if (!user.config) {
		MessageBox(NULL, _T("Couldn't locate GPAC config file"), _T("Fatal Error"), MB_OK);
		return 0;
	}

    str = gf_cfg_get_key(user.config, "Compositor", "ScreenWidth");
	if (str) screen_w = atoi(str);
    str = gf_cfg_get_key(user.config, "Compositor", "ScreenHeight");
	if (str) screen_h = atoi(str);
	disp_w = screen_w;
#ifdef _WIN32_WCE
	disp_h = screen_h - menu_h /*- caption_h*/;
#else
	disp_h = screen_h;
#endif

	str = gf_cfg_get_key(user.config, "General", "ModulesDirectory");
	if (!str) {
		gf_cfg_del(user.config);
		MessageBox(NULL, _T("Couldn't locate GPAC plugins"), _T("Fatal Error"), MB_OK);
		return 0;
	}

	gf_sys_init(0);
	user.modules = gf_modules_new(str, user.config);
	if (!gf_modules_get_count(user.modules)) {
		MessageBox(GetForegroundWindow(), _T("No modules found"), _T("GPAC Init Error"), MB_OK);
		gf_modules_del(user.modules);
		gf_cfg_del(user.config);
		memset(&user, 0, sizeof(GF_User));
		gf_sys_close();
		return 0;
	}

	/*first launch, register all files ext*/
	if (initial_launch) {
		/*FFMPEG registration - FFMPEG DLLs compiled with CEGCC cannot be loaded directly under WM 6.1
		cf http://cegcc.sourceforge.net/docs/faq.html#DllDoesNotWorkWithWindowsMobile6.1
		*/
		HKEY hKey = NULL;
		DWORD dwSize;
		DWORD dwValue;
		RegCreateKeyEx(HKEY_LOCAL_MACHINE, _T("System\\Loader\\LoadModuleLow"), 0, NULL, REG_OPTION_NON_VOLATILE, KEY_WRITE, NULL, &hKey, &dwSize);
		dwSize = 4; dwValue = 1;
		LONG res = RegSetValueEx(hKey, _T("avcodec-52.dll"), NULL, REG_DWORD, (unsigned char *)&dwValue, dwSize);
		res = RegSetValueEx(hKey, _T("avformat-52.dll"), NULL, REG_DWORD, (unsigned char *)&dwValue, dwSize);
		res = RegSetValueEx(hKey, _T("avutil-50.dll"), NULL, REG_DWORD, (unsigned char *)&dwValue, dwSize);
		res = RegSetValueEx(hKey, _T("swscale-0.dll"), NULL, REG_DWORD, (unsigned char *)&dwValue, dwSize);
		RegCloseKey(hKey);

		u32 i;
		for (i=0; i<gf_modules_get_count(user.modules); i++) {
			GF_InputService *ifce = (GF_InputService *) gf_modules_load_interface(user.modules, i, GF_NET_CLIENT_INTERFACE);
			if (!ifce) continue;
			if (ifce) {
				ifce->CanHandleURL(ifce, "test.test");
				gf_modules_close_interface((GF_BaseInterface *)ifce);
			}
		}
		MessageBox(NULL, _T("Thank you for installing GPAC"), _T("Initial setup done"), MB_OK);
	}

	str = gf_cfg_get_key(user.config, "General", "Loop");
	loop = (!str || !stricmp(str, "yes")) ? 1 : 0;

	str = gf_cfg_get_key(user.config, "SAXLoader", "Progressive");
	use_svg_prog = (str && !strcmp(str, "yes")) ? 1 : 0;

	str = gf_cfg_get_key(user.config, "General", "RTIRefreshPeriod");
	if (str) {
		rti_update_time_ms = atoi(str);
	} else {
		gf_cfg_set_key(user.config, "General", "RTIRefreshPeriod", "200");
	}

	str = gf_cfg_get_key(user.config, "General", "ShowStatusBar");
	show_status = (str && !strcmp(str, "yes")) ? 1 : 0;


#ifdef _WIN32_WCE
	if (is_ppc) GXOpenInput();
#endif

	if (InitInstance(nShowCmd)) {
		SetForegroundWindow(g_hwnd);
		show_taskbar(0);

		force_2d_gl = gf_term_get_option(term, GF_OPT_USE_OPENGL);

		while (GetMessage(&msg, NULL, 0,0) == TRUE) {
			TranslateMessage (&msg);
			DispatchMessage (&msg);

			if (playlist_act) {
				switch_playlist(playlist_act-1);
				playlist_act = 0;
			}
		}
		show_taskbar(1);
	}
#ifdef _WIN32_WCE
	if (is_ppc) GXCloseInput();
#endif

	/*and destroy*/
	if (term) gf_term_del(term);
	if (user.modules) gf_modules_del(user.modules);
	if (user.config) gf_cfg_del(user.config);

	if (backlight_off) set_backlight_state(0);

	gf_sys_close();
	if (log_file) fclose(log_file);
	return 0;
}
Exemplo n.º 5
0
CMainFrame::CMainFrame()
{
	GXOpenInput();
	m_view_timing = 0;
	m_restore_fs = 0;
}
Exemplo n.º 6
0
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPWSTR lpCmdLine, int nShowCmd )
{
	LPTSTR wndname = _T("PocketStella");
	WNDCLASS wc = { CS_HREDRAW | CS_VREDRAW, WindowProc, 0, 0, hInstance, NULL, NULL, 
		(HBRUSH)GetStockObject(BLACK_BRUSH), NULL, wndname};
	RegisterClass(&wc);
	hWnd = CreateWindow(wndname, wndname, WS_VISIBLE | WS_POPUP, 0, 0, GetSystemMetrics(SM_CXSCREEN),
						GetSystemMetrics(SM_CYSCREEN), NULL, NULL, hInstance, NULL);
	if (!hWnd) return 1;
	SetWindowPos(hWnd, HWND_TOP, 0, 0, 0, 0, SWP_NOMOVE|SWP_NOSIZE);

	/* backlight */
	REG_bat = REG_ac = REG_disp = 2 * 60 * 60 * 1000; /* 2hrs should do it */
	backlight_xchg();
	SystemParametersInfo(SPI_GETBATTERYIDLETIMEOUT, 0, (void *) &bat_timeout, 0);
	SystemParametersInfo(SPI_SETBATTERYIDLETIMEOUT, 60 * 60 * 2, NULL, SPIF_SENDCHANGE);
	
	// pump the messages to get the window up
	MSG msg;
	while (PeekMessage(&msg, NULL, 0U, 0U, PM_REMOVE))
	{
		TranslateMessage(&msg);
		DispatchMessage(&msg);
	}

	LOGFONT f = {11, 0, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE, DEFAULT_CHARSET, OUT_DEFAULT_PRECIS,
				 OUT_DEFAULT_PRECIS, DEFAULT_QUALITY, DEFAULT_PITCH, _T("")};
	HFONT hFnt = CreateFontIndirect(&f);
	HDC hDC = GetDC(hWnd);
	SelectObject(hDC, hFnt);
	RECT RWnd;
	GetClipBox(hDC, &RWnd);
	SetTextColor(hDC, 0xA0A0A0);
	SetBkColor(hDC, 0);
	DrawText(hDC, _T("PocketStella Initializing..."), -1, &RWnd, DT_CENTER | DT_VCENTER);
	ReleaseDC(hWnd, hDC);
	DeleteObject(hFnt);
	
	theOSystem = new OSystemWinCE(((string) getcwd()) + '\\');
	SettingsWinCE theSettings(theOSystem);
	theOSystem->settings().loadConfig();
	theOSystem->settings().validate();
	bool loaddefaultkeys = (theOSystem->settings().getString("keymap") == EmptyString);
	theOSystem->create();
	if (loaddefaultkeys)
	{
		// setup the default keybindings the first time we're run
		theOSystem->eventHandler().addKeyMapping(Event::JoystickZeroFire, kEmulationMode, SDLK_F1);
		theOSystem->eventHandler().addKeyMapping(Event::LauncherMode, kEmulationMode, SDLK_BACKSPACE);
		theOSystem->eventHandler().addKeyMapping(Event::ConsoleReset, kEmulationMode, SDLK_F6);
		theOSystem->eventHandler().addKeyMapping(Event::ConsoleSelect, kEmulationMode, SDLK_F5);

		theOSystem->eventHandler().addKeyMapping(Event::UIPgUp, kMenuMode, SDLK_LEFT);
		theOSystem->eventHandler().addKeyMapping(Event::UIPgDown, kMenuMode, SDLK_RIGHT);
		theOSystem->eventHandler().addKeyMapping(Event::UISelect, kMenuMode, SDLK_F1);
		theOSystem->eventHandler().addKeyMapping(Event::UICancel, kMenuMode, SDLK_BACKSPACE);
	}

	if ( !GXOpenDisplay(hWnd, GX_FULLSCREEN) || !GXOpenInput() )
	{
		CleanUp();
		return 1;
	}
	KeySetup();

	string romfile = ((string) getcwd()) + ((string) "\\") + theSettings.getString("GameFilename");
	if (!FilesystemNode::fileExists(romfile))
		theOSystem->createLauncher();
	else
		theOSystem->createConsole(romfile);

	theOSystem->mainLoop();

	CleanUp();

	return 0;
}