mirror of
https://github.com/libretro/RetroArch
synced 2025-02-11 06:40:48 +00:00
(Libxenon) Added (non-working) input driver
This commit is contained in:
parent
9c67452f10
commit
757fa71469
@ -18,11 +18,11 @@ PPU_TARGET_ADJUSTED := ssnes-libxenon.elf32
|
||||
LDDIRS = -L. -L$(DEVKITXENON)/usr/lib -L$(DEVKITXENON)/xenon/lib/32
|
||||
INCDIRS = -I. -I$(DEVKITXENON)/usr/include -I$(DEVKITXENON)/usr/include/SDL
|
||||
|
||||
OBJ = fifo_buffer.o ssnes.o driver.o file.o settings.o message.o rewind.o movie.o input/sdl.o audio/sdl.o gfx/sdl.o gfx/sdlwrap.o gfx/gfx_common.o ups.o bps.o strl.o screenshot.o audio/hermite.o dynamic.o audio/utils.o conf/config_file.o xenon/cond.o xenon/main.o xenon/xenon360_audio.o
|
||||
OBJ = fifo_buffer.o ssnes.o driver.o file.o settings.o message.o rewind.o movie.o input/sdl.o audio/sdl.o gfx/sdl.o gfx/sdlwrap.o gfx/gfx_common.o ups.o bps.o strl.o screenshot.o audio/hermite.o dynamic.o audio/utils.o conf/config_file.o xenon/cond.o xenon/main.o xenon/xenon360_audio.o xenon/xenon360_input.o
|
||||
|
||||
LIBS = -lsnes -lSDL -lxenon -lm -lc
|
||||
DEFINES = -std=gnu99 -DHAVE_CONFIGFILE=1 -DHAVE_SDL=1 -DPACKAGE_VERSION=\"0.9.3\" -DHAVE_GETOPT_LONG=1 -Dmain=ssnes_main
|
||||
DEFINES += -mno-altivec -mhard-float -m32 -mpowerpc64 -mcpu=cell -mtune=cell -fno-pic -g -Wall -DSDL -DXENON $(INCDIRS)
|
||||
DEFINES += -maltivec -mhard-float -m32 -mpowerpc64 -mcpu=cell -mtune=cell -fno-pic -g -Wall -DSDL -DXENON $(INCDIRS)
|
||||
DEFINES += -u read -u _start -u exc_base
|
||||
|
||||
ifeq ($(DEBUG), 1)
|
||||
|
@ -56,6 +56,7 @@
|
||||
#define INPUT_SDL 7
|
||||
#define INPUT_X 12
|
||||
#define INPUT_PS3 19
|
||||
#define INPUT_XENON360 21
|
||||
////////////////////////
|
||||
|
||||
#if defined(HAVE_OPENGL) || defined(__CELLOS_LV2__)
|
||||
@ -106,6 +107,8 @@
|
||||
#define INPUT_DEFAULT_DRIVER INPUT_SDL
|
||||
#elif defined(__CELLOS_LV2__)
|
||||
#define INPUT_DEFAULT_DRIVER INPUT_PS3
|
||||
#elif defined(XENON)
|
||||
#define INPUT_DEFAULT_DRIVER INPUT_XENON360
|
||||
#elif defined(HAVE_XVIDEO)
|
||||
#define INPUT_DEFAULT_DRIVER INPUT_X
|
||||
#else
|
||||
|
3
driver.c
3
driver.c
@ -98,6 +98,9 @@ static const input_driver_t *input_drivers[] = {
|
||||
#ifdef HAVE_XVIDEO
|
||||
&input_x,
|
||||
#endif
|
||||
#ifdef XENON
|
||||
&input_xenon360,
|
||||
#endif
|
||||
};
|
||||
|
||||
static void find_audio_driver(void)
|
||||
|
1
driver.h
1
driver.h
@ -176,6 +176,7 @@ extern const video_driver_t video_ext;
|
||||
extern const input_driver_t input_sdl;
|
||||
extern const input_driver_t input_x;
|
||||
extern const input_driver_t input_ps3;
|
||||
extern const input_driver_t input_xenon360;
|
||||
////////////////////////////////////////////////
|
||||
|
||||
#endif
|
||||
|
@ -115,6 +115,9 @@ static void set_defaults(void)
|
||||
case INPUT_X:
|
||||
def_input = "x";
|
||||
break;
|
||||
case INPUT_XENON360:
|
||||
def_input = "xenon360";
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
150
xenon/xenon360_input.c
Normal file
150
xenon/xenon360_input.c
Normal file
@ -0,0 +1,150 @@
|
||||
/* SSNES - A Super Ninteno Entertainment System (SNES) Emulator frontend for libsnes.
|
||||
* Copyright (C) 2010 - Hans-Kristian Arntzen
|
||||
* Copyright (C) 2011 - Daniel De Matteis
|
||||
*
|
||||
* Some code herein may be based on code found in BSNES.
|
||||
*
|
||||
* SSNES 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.
|
||||
*
|
||||
* SSNES 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 SSNES.
|
||||
* If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
|
||||
#include "../driver.h"
|
||||
#include <stdint.h>
|
||||
#include "../libsnes.hpp"
|
||||
|
||||
#include <input/input.h>
|
||||
#include <usb/usbmain.h>
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
struct controller_data_s pad[5];
|
||||
|
||||
static void xenon360_input_poll(void *data)
|
||||
{
|
||||
(void)data;
|
||||
for (unsigned i = 0; i < 5; i++)
|
||||
{
|
||||
usb_poll();
|
||||
get_controller_data(&pad[i], i);
|
||||
}
|
||||
}
|
||||
|
||||
static int16_t xenon360_input_state(void *data, const struct snes_keybind **binds,
|
||||
bool port, unsigned device,
|
||||
unsigned index, unsigned id)
|
||||
{
|
||||
(void)data;
|
||||
(void)binds;
|
||||
(void)index;
|
||||
|
||||
if (device != SNES_DEVICE_JOYPAD)
|
||||
return 0;
|
||||
|
||||
unsigned player = 0;
|
||||
if (port == SNES_PORT_2 && device == SNES_DEVICE_MULTITAP)
|
||||
player = index + 1;
|
||||
else if (port == SNES_PORT_2)
|
||||
player = 1;
|
||||
|
||||
uint64_t button = 0;
|
||||
|
||||
// Hardcoded binds.
|
||||
switch (id)
|
||||
{
|
||||
case SNES_DEVICE_ID_JOYPAD_A:
|
||||
button = pad[player].b ? 1 : 0;
|
||||
break;
|
||||
case SNES_DEVICE_ID_JOYPAD_B:
|
||||
button = pad[player].a ? 1 : 0;
|
||||
break;
|
||||
case SNES_DEVICE_ID_JOYPAD_X:
|
||||
button = pad[player].y ? 1 : 0;
|
||||
break;
|
||||
case SNES_DEVICE_ID_JOYPAD_Y:
|
||||
button = pad[player].x ? 1 : 0;
|
||||
break;
|
||||
case SNES_DEVICE_ID_JOYPAD_LEFT:
|
||||
button = pad[player].left ? 1 : 0;
|
||||
break;
|
||||
case SNES_DEVICE_ID_JOYPAD_RIGHT:
|
||||
button = pad[player].right ? 1 : 0;
|
||||
break;
|
||||
case SNES_DEVICE_ID_JOYPAD_UP:
|
||||
button = pad[player].up ? 1 : 0;
|
||||
break;
|
||||
case SNES_DEVICE_ID_JOYPAD_DOWN:
|
||||
button = pad[player].down ? 1 : 0;
|
||||
break;
|
||||
case SNES_DEVICE_ID_JOYPAD_START:
|
||||
button = pad[player].start ? 1 : 0;
|
||||
break;
|
||||
case SNES_DEVICE_ID_JOYPAD_SELECT:
|
||||
button = pad[player].select ? 1 : 0;
|
||||
break;
|
||||
case SNES_DEVICE_ID_JOYPAD_L:
|
||||
button = pad[player].lt ? 1 : 0;
|
||||
break;
|
||||
case SNES_DEVICE_ID_JOYPAD_R:
|
||||
button = pad[player].rt ? 1 : 0;
|
||||
break;
|
||||
default:
|
||||
button = 0;
|
||||
}
|
||||
|
||||
return button;
|
||||
}
|
||||
|
||||
static void xenon360_free_input(void *data)
|
||||
{
|
||||
(void)data;
|
||||
}
|
||||
|
||||
static void* xenon360_input_init(void)
|
||||
{
|
||||
return (void*)-1;
|
||||
}
|
||||
|
||||
static bool xenon360_key_pressed(void *data, int key)
|
||||
{
|
||||
(void)data;
|
||||
#if 0
|
||||
switch (key)
|
||||
{
|
||||
case SSNES_FAST_FORWARD_HOLD_KEY:
|
||||
return CTRL_RSTICK_UP(state[0]) && CTRL_R2(~state[0]);
|
||||
case SSNES_LOAD_STATE_KEY:
|
||||
return (CTRL_RSTICK_UP(state[0]) && CTRL_R2(state[0]));
|
||||
case SSNES_SAVE_STATE_KEY:
|
||||
return (CTRL_RSTICK_DOWN(state[0]) && CTRL_R2(state[0]));
|
||||
case SSNES_STATE_SLOT_PLUS:
|
||||
return (CTRL_RSTICK_RIGHT(state[0]) && CTRL_R2(state[0]));
|
||||
case SSNES_STATE_SLOT_MINUS:
|
||||
return (CTRL_RSTICK_LEFT(state[0]) && CTRL_R2(state[0]));
|
||||
case SSNES_REWIND:
|
||||
return CTRL_RSTICK_DOWN(state[0]) && CTRL_R2(~state[0]);
|
||||
default:
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
const input_driver_t input_xenon360 = {
|
||||
.init = xenon360_input_init,
|
||||
.poll = xenon360_input_poll,
|
||||
.input_state = xenon360_input_state,
|
||||
.key_pressed = xenon360_key_pressed,
|
||||
.free = xenon360_free_input,
|
||||
.ident = "xenon360",
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user