RetroArch/ps3/ps3_input.h

143 lines
4.2 KiB
C

/* RetroArch - A frontend for libretro.
* Copyright (C) 2010-2012 - Hans-Kristian Arntzen
* Copyright (C) 2011-2012 - Daniel De Matteis
*
* RetroArch is free software: you can redistribute it and/or modify it under the terms
* of the GNU General Public License as published by the Free Software Found-
* ation, either version 3 of the License, or (at your option) any later version.
*
* RetroArch is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along with RetroArch.
* If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef _PS3_INPUT_H_
#define _PS3_INPUT_H_
#include <stdbool.h>
#include <wchar.h>
#ifdef HAVE_OSKUTIL
#ifdef __PSL1GHT__
#include <sysutil/osk.h>
#else
#include <sysutil/sysutil_oskdialog.h>
#endif
#endif
#include "sdk_defines.h"
#ifdef HAVE_SYSUTILS
#include <sysutil/sysutil_common.h>
#endif
#ifndef __PSL1GHT__
#define MAX_PADS 7
#endif
#define DEADZONE_LOW 55
#define DEADZONE_HIGH 210
#define OSK_IS_RUNNING(object) object.is_running
#define OUTPUT_TEXT_STRING(object) object.osk_text_buffer_char
enum {
PS3_GAMEPAD_CIRCLE = 1 << 0,
PS3_GAMEPAD_CROSS = 1 << 1,
PS3_GAMEPAD_TRIANGLE = 1 << 2,
PS3_GAMEPAD_SQUARE = 1 << 3,
PS3_GAMEPAD_DPAD_UP = 1 << 4,
PS3_GAMEPAD_DPAD_DOWN = 1 << 5,
PS3_GAMEPAD_DPAD_LEFT = 1 << 6,
PS3_GAMEPAD_DPAD_RIGHT = 1 << 7,
PS3_GAMEPAD_SELECT = 1 << 8,
PS3_GAMEPAD_START = 1 << 9,
PS3_GAMEPAD_L1 = 1 << 10,
PS3_GAMEPAD_L2 = 1 << 11,
PS3_GAMEPAD_L3 = 1 << 12,
PS3_GAMEPAD_R1 = 1 << 13,
PS3_GAMEP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TICK_UP,
PS3_DEVICE_ID_RSTICK_DOWN,
PS3_DEVICE_ID_RSTICK_LEFT_DPAD,
PS3_DEVICE_ID_RSTICK_RIGHT_DPAD,
PS3_DEVICE_ID_RSTICK_UP_DPAD,
PS3_DEVICE_ID_RSTICK_DOWN_DPAD,
RARCH_LAST_PLATFORM_KEY
};
#ifdef HAVE_OSKUTIL
typedef struct
{
unsigned int osk_memorycontainer;
wchar_t init_message[CELL_OSKDIALOG_STRING_SIZE + 1];
wchar_t message[CELL_OSKDIALOG_STRING_SIZE + 1];
wchar_t osk_text_buffer[CELL_OSKDIALOG_STRING_SIZE + 1];
char osk_text_buffer_char[CELL_OSKDIALOG_STRING_SIZE + 1];
uint32_t flags;
bool is_running;
bool text_can_be_fetched;
sys_memory_container_t containerid;
CellOskDialogPoint pos;
CellOskDialogInputFieldInfo inputFieldInfo;
CellOskDialogCallbackReturnParam outputInfo;
CellOskDialogParam dialogParam;
} oskutil_params;
void oskutil_write_message(oskutil_params *params, const wchar_t* msg);
void oskutil_write_initial_message(oskutil_params *params, const wchar_t* msg);
void oskutil_init(oskutil_params *params, unsigned int containersize);
bool oskutil_start(oskutil_params *params);
void oskutil_stop(oskutil_params *params);
void oskutil_finished(oskutil_params *params);
void oskutil_close(oskutil_params *params);
void oskutil_unload(oskutil_params *params);
#endif
#endif