예제 #1
0
static void salamander_init(void)
{
   CellPadData pad_data;
   cellPadInit(7);

   cellPadGetData(0, &pad_data);

   if(pad_data.button[CELL_PAD_BTN_OFFSET_DIGITAL2] & CELL_PAD_CTRL_TRIANGLE)
   {
      //override path, boot first executable in cores directory
      RARCH_LOG("Fallback - Will boot first executable in RetroArch cores/ directory.\n");
      find_and_set_first_file();
   }
   else
   {
      //normal executable loading path
      char tmp_str[PATH_MAX];
      bool config_file_exists = false;

      if (path_file_exists(config_path))
         config_file_exists = true;

      //try to find CORE executable
      char core_executable[1024];
      fill_pathname_join(core_executable, default_paths.core_dir, "CORE.SELF", sizeof(core_executable));

      if(path_file_exists(core_executable))
      {
         //Start CORE executable
         strlcpy(libretro_path, core_executable, sizeof(libretro_path));
         RARCH_LOG("Start [%s].\n", libretro_path);
      }
      else
      {
         if (config_file_exists)
         {
            config_file_t * conf = config_file_new(config_path);
            config_get_array(conf, "libretro_path", tmp_str, sizeof(tmp_str));
            config_file_free(conf);
            strlcpy(libretro_path, tmp_str, sizeof(libretro_path));
         }

         if (!config_file_exists || !strcmp(libretro_path, ""))
            find_and_set_first_file();
         else
            RARCH_LOG("Start [%s] found in retroarch.cfg.\n", libretro_path);

         if (!config_file_exists)
         {
            config_file_t *new_conf = config_file_new(NULL);
            config_set_string(new_conf, "libretro_path", libretro_path);
            config_file_write(new_conf, config_path);
            config_file_free(new_conf);
         }
      }
   }

   cellPadEnd();

}
예제 #2
0
static bool ps3_joypad_init(void *data)
{
   (void)data;

   cellPadInit(MAX_PADS);

   return true;
}
예제 #3
0
static void* ps3_input_init(void)
{
   cellPadInit(MAX_PADS);
#ifdef HAVE_MOUSE
   cellMouseInit(MAX_MICE);
#endif

   return (void*)-1;
}
예제 #4
0
파일: CellInput.cpp 프로젝트: cdenix/psmame
void				ESInput::Initialize						()
{
	cellPadInit(MAXPADS);

	cellPadGetInfo2(&PadInfo);
	
	Reset();

	Small = 0;
	Large = 0;
}
예제 #5
0
static void* ps3_input_init(void)
{
   ps3_input_t *ps3 = (ps3_input_t*)calloc(1, sizeof(*ps3));
   if (!ps3)
      return NULL;

   cellPadInit(MAX_PADS);
#ifdef HAVE_MOUSE
   cellMouseInit(MAX_MICE);
#endif

   return ps3;
}
예제 #6
0
//-----------------------------------------------------------------------------
// Purpose: Initialize libpad for controller input
//-----------------------------------------------------------------------------
bool CGameEnginePS3::BInitializeLibPad()
{
	int ret = cellPadInit( CELL_PAD_MAX_PORT_NUM );
	if ( ret != CELL_OK )
		return false;

	// We don't use pressure sensitivity or sixaxis
	for ( int i=0; i<CELL_PAD_MAX_PORT_NUM; ++i )
	{
		// May be we don't have all ports connected, but this setting will be set and persist anyway
		cellPadSetPortSetting( i, CELL_PAD_SETTING_PRESS_OFF | CELL_PAD_SETTING_SENSOR_OFF );
	}

	return true;
}
예제 #7
0
static bool ps3_joypad_init(void)
{
   unsigned autoconf_pad;

   cellPadInit(MAX_PADS);

   for (autoconf_pad = 0; autoconf_pad < MAX_USERS; autoconf_pad++)
   {
      strlcpy(g_settings.input.device_names[autoconf_pad],
            "SixAxis Controller",
            sizeof(g_settings.input.device_names[autoconf_pad]));
      /* TODO - implement VID/PID? */
      input_config_autoconfigure_joypad(autoconf_pad,
            ps3_joypad_name(autoconf_pad),
            0, 0,
            ps3_joypad.ident);
   }

   return true;
}
예제 #8
0
static void* ps3_input_init(void)
{
   cellPadInit(MAX_PADS);
#ifdef HAVE_MOUSE
   cellMouseInit(MAX_MICE);
#endif

   for(unsigned i = 0; i < MAX_PLAYERS; i++)
      if (driver.input->set_keybinds)
         driver.input->set_keybinds(driver.input_data, 0, i, 0,
               (1ULL << KEYBINDS_ACTION_SET_DEFAULT_BINDS));

   for(unsigned i = 0; i < MAX_PADS; i++)
   {
      unsigned keybind_action = 0;

      switch (g_settings.input.dpad_emulation[i])
      {
         case ANALOG_DPAD_LSTICK:
            keybind_action = (1ULL << KEYBINDS_ACTION_SET_ANALOG_DPAD_LSTICK);
            break;
         case ANALOG_DPAD_RSTICK:
            keybind_action = (1ULL << KEYBINDS_ACTION_SET_ANALOG_DPAD_RSTICK);
            break;
         case ANALOG_DPAD_NONE:
            keybind_action = (1ULL << KEYBINDS_ACTION_SET_ANALOG_DPAD_NONE);
            break;
         default:
            break;
      }

      if (keybind_action)
         if (driver.input->set_keybinds)
            driver.input->set_keybinds(driver.input_data, 0, i, 0,
                  keybind_action);
   }

   return (void*)-1;
}
예제 #9
0
//-----------------------------------------------------------------------------
// Description: Platform specific input initialization
// Parameters:	pPlatformData - Platform specific data
// Returns:
// Notes:
//-----------------------------------------------------------------------------
bool FWInput::platformInit(void *pPlatformData)
{
	FWInputDevicePad		*pPad;
	FWInputDeviceKeyboard	*pKeybd;
	FWInputDeviceMouse		*pMouse;
	long				i;

	// stop unused parameter warning
	(void)pPlatformData;

	cellPadInit(FW_MAX_PAD_NUM);

	for(i = 0; i < FW_MAX_PAD_NUM; i ++)
	{
		sOldPadStatus[i] = 0;
		pPad = new FWInputDevicePad((void *)new FWCellPadInfo(i));
	}

	cellKbInit(FW_MAX_KEYBD_NUM);

	for(i = 0; i < FW_MAX_KEYBD_NUM; i ++)
	{
		sOldKeybdStatus[i] = 0;
		pKeybd = new FWInputDeviceKeyboard((void *)i);

		cellKbSetCodeType(i, CELL_KB_CODETYPE_RAW);
	}

	cellMouseInit(FW_MAX_MOUSE_NUM);

	for(i = 0; i < FW_MAX_MOUSE_NUM; i ++)
	{
		sOldMouseStatus[i] = 0;
		pMouse = new FWInputDeviceMouse((void *)i);
	}

	return true;
}
예제 #10
0
int32_t CellInputFacade::Init()
{
	return cellPadInit( MAX_PADS );
}
예제 #11
0
파일: main.c 프로젝트: Wyrick/RetroArch
int main(int argc, char *argv[])
{
    int ret;
#if defined(_XBOX)
    XINPUT_STATE state;

    get_environment_settings();

    XInputGetState(0, &state);

    if(state.Gamepad.wButtons & XINPUT_GAMEPAD_Y)
    {
        //override path, boot first executable in cores directory
        RARCH_LOG("Fallback - Will boot first executable in RetroArch cores directory.\n");
        find_and_set_first_file();
    }
    else
    {
        //normal executable loading path
        init_settings();
    }

    XLaunchNewImage(libretro_path, NULL);
    RARCH_LOG("Launch libretro core: [%s] (return code: %x]).\n", libretro_path, ret);
#elif defined(__CELLOS_LV2__)
    CellPadData pad_data;
    char spawn_data[256], spawn_data_size[16];
    SceNpDrmKey * k_licensee = NULL;

    cellSysutilRegisterCallback(0, callback_sysutil_exit, NULL);

    cellSysmoduleLoadModule(CELL_SYSMODULE_IO);
    cellSysmoduleLoadModule(CELL_SYSMODULE_FS);
    cellSysmoduleLoadModule(CELL_SYSMODULE_SYSUTIL_GAME);
    cellSysmoduleLoadModule(CELL_SYSMODULE_NET);

    cellSysmoduleLoadModule(CELL_SYSMODULE_SYSUTIL_NP);

    sys_net_initialize_network();

#ifdef HAVE_LOGGER
    logger_init();
#endif

    sceNpInit(NP_POOL_SIZE, np_pool);

    get_environment_settings();

    cellPadInit(7);

    cellPadGetData(0, &pad_data);

    if(pad_data.button[CELL_PAD_BTN_OFFSET_DIGITAL2] & CELL_PAD_CTRL_TRIANGLE)
    {
        //override path, boot first executable in cores directory
        RARCH_LOG("Fallback - Will boot first executable in RetroArch cores/ directory.\n");
        find_and_set_first_file();
    }
    else
    {
        //normal executable loading path
        init_settings();
    }

    cellPadEnd();

#ifdef HAVE_LOGGER
    logger_shutdown();
#endif

    for(unsigned int i = 0; i < sizeof(spawn_data); ++i)
        spawn_data[i] = i & 0xff;

    snprintf(spawn_data_size, sizeof(spawn_data_size), "%d", 256);

    const char * const spawn_argv[] = {
        spawn_data_size,
        "test argv for",
        "sceNpDrmProcessExitSpawn2()",
        NULL
    };

    ret = sceNpDrmProcessExitSpawn2(k_licensee, libretro_path, (const char** const)spawn_argv, NULL, (sys_addr_t)spawn_data, 256, 1000, SYS_PROCESS_PRIMARY_STACK_SIZE_1M);
    RARCH_LOG("Launch libretro core: [%s] (return code: %x]).\n", libretro_path, ret);

    if(ret < 0)
    {
        RARCH_LOG("Executable file is not of NPDRM type, trying another approach to boot it...\n");
        sys_game_process_exitspawn2(libretro_path, NULL, NULL, NULL, 0, 1000, SYS_PROCESS_PRIMARY_STACK_SIZE_1M);
    }

    sceNpTerm();

    sys_net_finalize_network();

    cellSysmoduleUnloadModule(CELL_SYSMODULE_SYSUTIL_NP);

    cellSysmoduleUnloadModule(CELL_SYSMODULE_NET);
    cellSysmoduleUnloadModule(CELL_SYSMODULE_SYSUTIL_GAME);
    cellSysmoduleLoadModule(CELL_SYSMODULE_FS);
    cellSysmoduleLoadModule(CELL_SYSMODULE_IO);
#endif

    return 1;
}
예제 #12
0
static SDL_VideoDevice*	CELL_CreateDevice		(int devindex)
{
	/* Allocate memory for sdl video device */
	CELL_VideoDevice = (SDL_VideoDevice *)SDL_malloc(sizeof(SDL_VideoDevice));
	if(CELL_VideoDevice)
	{
		SDL_memset(CELL_VideoDevice, 0, (sizeof *CELL_VideoDevice));
		CELL_VideoDevice->hidden = &CELL_Video;
		SDL_memset(&CELL_Video, 0, sizeof(CELL_Video));
	}
	else
	{
		SDL_OutOfMemory();
		return(0);
	}

	/* Set the function pointers */
	//General
	CELL_VideoDevice->VideoInit = CELL_VideoInit;
	CELL_VideoDevice->ListModes = CELL_ListModes;
	CELL_VideoDevice->SetVideoMode = CELL_SetVideoMode;
	//ToggleFullScreen(this, int on)
	//UpdateMouse(this)
	//SDL_Overlay *(*CreateYUVOverlay)(_THIS, int width, int height, Uint32 format, SDL_Surface *display);
	CELL_VideoDevice->SetColors = CELL_SetColors;
	CELL_VideoDevice->UpdateRects = CELL_UpdateRects;
	CELL_VideoDevice->VideoQuit = CELL_VideoQuit;

	//Accel
	CELL_VideoDevice->AllocHWSurface = CELL_AllocHWSurface;
	//int (*CheckHWBlit)(_THIS, SDL_Surface *src, SDL_Surface *dst);
	CELL_VideoDevice->FillHWRect = CELL_FillHWRect;
	//int (*SetHWColorKey)(_THIS, SDL_Surface *surface, Uint32 key);
	//int (*SetHWAlpha)(_THIS, SDL_Surface *surface, Uint8 value);
	CELL_VideoDevice->LockHWSurface = CELL_LockHWSurface;
	CELL_VideoDevice->UnlockHWSurface = CELL_UnlockHWSurface;
	CELL_VideoDevice->FlipHWSurface = CELL_FlipHWSurface;
	CELL_VideoDevice->FreeHWSurface = CELL_FreeHWSurface;

	//Gamma
	//int (*SetGamma)(_THIS, float red, float green, float blue);
	//int (*GetGamma)(_THIS, float *red, float *green, float *blue);
	//int (*SetGammaRamp)(_THIS, Uint16 *ramp);
	//int (*GetGammaRamp)(_THIS, Uint16 *ramp);

	//OpenGL
	//int (*GL_LoadLibrary)(_THIS, const char *path);
	//void* (*GL_GetProcAddress)(_THIS, const char *proc);
	//int (*GL_GetAttribute)(_THIS, SDL_GLattr attrib, int* value);
	//int (*GL_MakeCurrent)(_THIS);
	//void (*GL_SwapBuffers)(_THIS);

	//Window manager
	CELL_VideoDevice->SetCaption = CELL_CAPTION_Set;
	//void (*SetIcon)(_THIS, SDL_Surface *icon, Uint8 *mask);
	//int (*IconifyWindow)(_THIS);
	//SDL_GrabMode (*GrabInput)(_THIS, SDL_GrabMode mode);
	//int (*GetWMInfo)(_THIS, SDL_SysWMinfo *info);

	//Cursor
	CELL_VideoDevice->FreeWMCursor = CELL_CURSOR_Free;
	CELL_VideoDevice->CreateWMCursor = CELL_CURSOR_Create;
	CELL_VideoDevice->ShowWMCursor = CELL_CURSOR_Show;
	//void (*WarpWMCursor)(_THIS, Uint16 x, Uint16 y);
	CELL_VideoDevice->MoveWMCursor = CELL_CURSOR_Move;
	//void (*CheckMouseMode)(_THIS);

	//Events
	CELL_VideoDevice->InitOSKeymap = CELL_EVENTS_Init;
	CELL_VideoDevice->PumpEvents = CELL_EVENTS_Pump;

	//Clean up
	CELL_VideoDevice->free = CELL_DeleteDevice;

	/* Initialize CELL input libs */
	cellKbInit(1);
	cellMouseInit(1);
	cellPadInit(7);

	/* Setup PSGL */
	CELL_PSGL_Setup(CELL_VideoDevice);

	/* Read the RC File */
	CELL_RC_GetData();
	return CELL_VideoDevice;
}
예제 #13
0
파일: PS3Pad.cpp 프로젝트: gwowen/indigo
void PS3Pad::setup() {
  int32_t ret = cellPadInit(MAX_PAD);
  if (ret != CELL_OK) {
    LOG(LOG_CHANNEL_INPUT, "Failed to init pad");
  }
}