mirror of
https://github.com/libretro/RetroArch
synced 2025-01-25 15:35:29 +00:00
Merge branch 'master' of github.com:Themaister/RetroArch
Conflicts: gfx/gfx_common.c
This commit is contained in:
commit
ff9820af68
@ -546,16 +546,8 @@ HRESULT CRetroArchFileBrowser::OnNotifyPress( HXUIOBJ hObjPressed, BOOL& bHandle
|
||||
const char *strbuffer = rarch_convert_wchar_to_const_char((const wchar_t *)m_romlist.GetText(index));
|
||||
if(path_file_exists(browser->current_dir.list->elems[index].data))
|
||||
{
|
||||
char path_tmp[1024];
|
||||
struct retro_system_info info;
|
||||
retro_get_system_info(&info);
|
||||
bool block_zip_extract = info.block_extract;
|
||||
|
||||
snprintf(path_tmp, sizeof(path_tmp), "%s\\%s", filebrowser_get_current_dir(browser), strbuffer);
|
||||
if((strstr(strbuffer, ".zip") || strstr(strbuffer, ".ZIP")) && !block_zip_extract)
|
||||
rarch_extract_zipfile(path_tmp);
|
||||
else
|
||||
rarch_console_load_game(path_tmp);
|
||||
snprintf(path, sizeof(path), "%s\\%s", filebrowser_get_current_dir(browser), strbuffer);
|
||||
rarch_console_load_game_wrap(path, S_DELAY_45);
|
||||
}
|
||||
else if(browser->current_dir.list->elems[index].attr.b)
|
||||
{
|
||||
|
@ -17,9 +17,7 @@
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#ifdef _XBOX
|
||||
#include <xtl.h>
|
||||
#endif
|
||||
|
||||
#include "../driver.h"
|
||||
#include "../general.h"
|
||||
@ -29,6 +27,43 @@
|
||||
static uint64_t state[4];
|
||||
static unsigned pads_connected;
|
||||
|
||||
const struct platform_bind platform_keys[] = {
|
||||
{ XINPUT_GAMEPAD_B, "B button" },
|
||||
{ XINPUT_GAMEPAD_A, "A button" },
|
||||
{ XINPUT_GAMEPAD_Y, "Y button" },
|
||||
{ XINPUT_GAMEPAD_X, "X button" },
|
||||
{ XINPUT_GAMEPAD_DPAD_UP, "D-Pad Up" },
|
||||
{ XINPUT_GAMEPAD_DPAD_DOWN, "D-Pad Down" },
|
||||
{ XINPUT_GAMEPAD_DPAD_LEFT, "D-Pad Left" },
|
||||
{ XINPUT_GAMEPAD_DPAD_RIGHT, "D-Pad Right" },
|
||||
{ XINPUT_GAMEPAD_BACK, "Back button" },
|
||||
{ XINPUT_GAMEPAD_START, "Start button" },
|
||||
{ XINPUT_GAMEPAD_LEFT_SHOULDER, "Left Shoulder" },
|
||||
{ XINPUT_GAMEPAD_LEFT_TRIGGER, "Left Trigger" },
|
||||
{ XINPUT_GAMEPAD_LEFT_THUMB, "Left Thumb" },
|
||||
{ XINPUT_GAMEPAD_RIGHT_SHOULDER, "Right Shoulder" },
|
||||
{ XINPUT_GAMEPAD_RIGHT_TRIGGER, "Right Trigger" },
|
||||
{ XINPUT_GAMEPAD_RIGHT_THUMB, "Right Thumb" },
|
||||
{ XINPUT_GAMEPAD_LSTICK_LEFT_MASK, "LStick Left" },
|
||||
{ XINPUT_GAMEPAD_LSTICK_RIGHT_MASK, "LStick Right" },
|
||||
{ XINPUT_GAMEPAD_LSTICK_UP_MASK, "LStick Up" },
|
||||
{ XINPUT_GAMEPAD_LSTICK_DOWN_MASK, "LStick Down" },
|
||||
{ XINPUT_GAMEPAD_DPAD_LEFT | XINPUT_GAMEPAD_LSTICK_LEFT_MASK, "LStick D-Pad Left" },
|
||||
{ XINPUT_GAMEPAD_DPAD_RIGHT | XINPUT_GAMEPAD_LSTICK_RIGHT_MASK, "LStick D-Pad Right" },
|
||||
{ XINPUT_GAMEPAD_DPAD_UP | XINPUT_GAMEPAD_LSTICK_UP_MASK, "LStick D-Pad Up" },
|
||||
{ XINPUT_GAMEPAD_DPAD_DOWN | XINPUT_GAMEPAD_LSTICK_DOWN_MASK, "LStick D-Pad Down" },
|
||||
{ XINPUT_GAMEPAD_RSTICK_LEFT_MASK, "RStick Left" },
|
||||
{ XINPUT_GAMEPAD_RSTICK_RIGHT_MASK, "RStick Right" },
|
||||
{ XINPUT_GAMEPAD_RSTICK_UP_MASK, "RStick Up" },
|
||||
{ XINPUT_GAMEPAD_RSTICK_DOWN_MASK, "RStick Down" },
|
||||
{ XINPUT_GAMEPAD_DPAD_LEFT | XINPUT_GAMEPAD_RSTICK_LEFT_MASK, "RStick D-Pad Left" },
|
||||
{ XINPUT_GAMEPAD_DPAD_RIGHT | XINPUT_GAMEPAD_RSTICK_RIGHT_MASK, "RStick D-Pad Right" },
|
||||
{ XINPUT_GAMEPAD_DPAD_UP | XINPUT_GAMEPAD_RSTICK_UP_MASK, "RStick D-Pad Up" },
|
||||
{ XINPUT_GAMEPAD_DPAD_DOWN | XINPUT_GAMEPAD_RSTICK_DOWN_MASK, "RStick D-Pad Down" },
|
||||
};
|
||||
|
||||
const unsigned int platform_keys_size = sizeof(platform_keys);
|
||||
|
||||
static void xinput_input_poll(void *data)
|
||||
{
|
||||
(void)data;
|
||||
@ -73,7 +108,6 @@ static void xinput_input_free_input(void *data)
|
||||
(void)data;
|
||||
}
|
||||
|
||||
#ifdef _XBOX360
|
||||
#include "../console/retroarch_console.h"
|
||||
|
||||
void xdk360_input_map_dpad_to_stick(uint32_t map_dpad_enum, uint32_t controller_id)
|
||||
@ -100,14 +134,11 @@ void xdk360_input_map_dpad_to_stick(uint32_t map_dpad_enum, uint32_t controller_
|
||||
break;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
static void* xinput_input_init(void)
|
||||
{
|
||||
#ifdef _XBOX360
|
||||
for(unsigned i = 0; i < 4; i++)
|
||||
xdk360_input_map_dpad_to_stick(g_settings.input.dpad_emulation[i], i);
|
||||
#endif
|
||||
|
||||
return (void*)-1;
|
||||
}
|
||||
@ -116,7 +147,6 @@ static bool xinput_input_key_pressed(void *data, int key)
|
||||
{
|
||||
(void)data;
|
||||
bool retval = false;
|
||||
#ifdef _XBOX360
|
||||
XINPUT_STATE state;
|
||||
xdk_d3d_video_t *d3d = (xdk_d3d_video_t*)driver.video_data;
|
||||
|
||||
@ -163,11 +193,37 @@ static bool xinput_input_key_pressed(void *data, int key)
|
||||
retval = g_console.ingame_menu_enable ? g_console.ingame_menu_enable : g_console.menu_enable;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
static void xinput_set_default_keybind_lut(void)
|
||||
{
|
||||
rarch_default_keybind_lut[RETRO_DEVICE_ID_JOYPAD_B] = platform_keys[XDK_DEVICE_ID_JOYPAD_A].joykey;
|
||||
rarch_default_keybind_lut[RETRO_DEVICE_ID_JOYPAD_Y] = platform_keys[XDK_DEVICE_ID_JOYPAD_X].joykey;
|
||||
rarch_default_keybind_lut[RETRO_DEVICE_ID_JOYPAD_SELECT] = platform_keys[XDK_DEVICE_ID_JOYPAD_BACK].joykey;
|
||||
rarch_default_keybind_lut[RETRO_DEVICE_ID_JOYPAD_START] = platform_keys[XDK_DEVICE_ID_JOYPAD_START].joykey;
|
||||
rarch_default_keybind_lut[RETRO_DEVICE_ID_JOYPAD_UP] = platform_keys[XDK_DEVICE_ID_JOYPAD_UP].joykey;
|
||||
rarch_default_keybind_lut[RETRO_DEVICE_ID_JOYPAD_DOWN] = platform_keys[XDK_DEVICE_ID_JOYPAD_DOWN].joykey;
|
||||
rarch_default_keybind_lut[RETRO_DEVICE_ID_JOYPAD_LEFT] = platform_keys[XDK_DEVICE_ID_JOYPAD_LEFT].joykey;
|
||||
rarch_default_keybind_lut[RETRO_DEVICE_ID_JOYPAD_RIGHT] = platform_keys[XDK_DEVICE_ID_JOYPAD_RIGHT].joykey;
|
||||
rarch_default_keybind_lut[RETRO_DEVICE_ID_JOYPAD_A] = platform_keys[XDK_DEVICE_ID_JOYPAD_B].joykey;
|
||||
rarch_default_keybind_lut[RETRO_DEVICE_ID_JOYPAD_X] = platform_keys[XDK_DEVICE_ID_JOYPAD_Y].joykey;
|
||||
#if defined(_XBOX1)
|
||||
rarch_default_keybind_lut[RETRO_DEVICE_ID_JOYPAD_L] = platform_keys[XDK_DEVICE_ID_JOYPAD_LEFT_TRIGGER].joykey;
|
||||
rarch_default_keybind_lut[RETRO_DEVICE_ID_JOYPAD_R] = platform_keys[XDK_DEVICE_ID_JOYPAD_RIGHT_TRIGGER].joykey;
|
||||
rarch_default_keybind_lut[RETRO_DEVICE_ID_JOYPAD_L2] = platform_keys[XDK_DEVICE_ID_JOYPAD_LB].joykey;
|
||||
rarch_default_keybind_lut[RETRO_DEVICE_ID_JOYPAD_R2] = platform_keys[XDK_DEVICE_ID_JOYPAD_RB].joykey;
|
||||
#elif defined(_XBOX360)
|
||||
rarch_default_keybind_lut[RETRO_DEVICE_ID_JOYPAD_L] = platform_keys[XDK_DEVICE_ID_JOYPAD_LB].joykey;
|
||||
rarch_default_keybind_lut[RETRO_DEVICE_ID_JOYPAD_R] = platform_keys[XDK_DEVICE_ID_JOYPAD_RB].joykey;
|
||||
rarch_default_keybind_lut[RETRO_DEVICE_ID_JOYPAD_L2] = platform_keys[XDK_DEVICE_ID_JOYPAD_LEFT_TRIGGER].joykey;
|
||||
rarch_default_keybind_lut[RETRO_DEVICE_ID_JOYPAD_R2] = platform_keys[XDK_DEVICE_ID_JOYPAD_RIGHT_TRIGGER].joykey;
|
||||
#endif
|
||||
rarch_default_keybind_lut[RETRO_DEVICE_ID_JOYPAD_L3] = platform_keys[XDK_DEVICE_ID_LSTICK_THUMB].joykey;
|
||||
rarch_default_keybind_lut[RETRO_DEVICE_ID_JOYPAD_R3] = platform_keys[XDK_DEVICE_ID_RSTICK_THUMB].joykey;
|
||||
}
|
||||
|
||||
const input_driver_t input_xinput =
|
||||
{
|
||||
xinput_input_init,
|
||||
@ -175,5 +231,6 @@ const input_driver_t input_xinput =
|
||||
xinput_input_state,
|
||||
xinput_input_key_pressed,
|
||||
xinput_input_free_input,
|
||||
xinput_set_default_keybind_lut,
|
||||
"xinput"
|
||||
};
|
||||
|
@ -30,10 +30,46 @@ enum {
|
||||
XINPUT_GAMEPAD_RIGHT_TRIGGER = 1 << 25
|
||||
};
|
||||
|
||||
enum xdk_device_id
|
||||
{
|
||||
XDK_DEVICE_ID_JOYPAD_B = 0,
|
||||
XDK_DEVICE_ID_JOYPAD_A,
|
||||
XDK_DEVICE_ID_JOYPAD_Y,
|
||||
XDK_DEVICE_ID_JOYPAD_X,
|
||||
XDK_DEVICE_ID_JOYPAD_UP,
|
||||
XDK_DEVICE_ID_JOYPAD_DOWN,
|
||||
XDK_DEVICE_ID_JOYPAD_LEFT,
|
||||
XDK_DEVICE_ID_JOYPAD_RIGHT,
|
||||
XDK_DEVICE_ID_JOYPAD_BACK,
|
||||
XDK_DEVICE_ID_JOYPAD_START,
|
||||
XDK_DEVICE_ID_JOYPAD_LB,
|
||||
XDK_DEVICE_ID_JOYPAD_LEFT_TRIGGER,
|
||||
XDK_DEVICE_ID_LSTICK_THUMB,
|
||||
XDK_DEVICE_ID_JOYPAD_RB,
|
||||
XDK_DEVICE_ID_JOYPAD_RIGHT_TRIGGER,
|
||||
XDK_DEVICE_ID_RSTICK_THUMB,
|
||||
XDK_DEVICE_ID_LSTICK_LEFT,
|
||||
XDK_DEVICE_ID_LSTICK_RIGHT,
|
||||
XDK_DEVICE_ID_LSTICK_UP,
|
||||
XDK_DEVICE_ID_LSTICK_DOWN,
|
||||
XDK_DEVICE_ID_LSTICK_LEFT_DPAD,
|
||||
XDK_DEVICE_ID_LSTICK_RIGHT_DPAD,
|
||||
XDK_DEVICE_ID_LSTICK_UP_DPAD,
|
||||
XDK_DEVICE_ID_LSTICK_DOWN_DPAD,
|
||||
XDK_DEVICE_ID_RSTICK_LEFT,
|
||||
XDK_DEVICE_ID_RSTICK_RIGHT,
|
||||
XDK_DEVICE_ID_RSTICK_UP,
|
||||
XDK_DEVICE_ID_RSTICK_DOWN,
|
||||
XDK_DEVICE_ID_RSTICK_LEFT_DPAD,
|
||||
XDK_DEVICE_ID_RSTICK_RIGHT_DPAD,
|
||||
XDK_DEVICE_ID_RSTICK_UP_DPAD,
|
||||
XDK_DEVICE_ID_RSTICK_DOWN_DPAD,
|
||||
|
||||
RARCH_LAST_PLATFORM_KEY
|
||||
};
|
||||
|
||||
#define DEADZONE (16000)
|
||||
|
||||
#ifdef _XBOX
|
||||
extern void xdk360_input_map_dpad_to_stick(uint32_t map_dpad_enum, uint32_t controller_id);
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
4
AUTHORS
4
AUTHORS
@ -1,5 +1,6 @@
|
||||
Hans-Kristian Arntzen - <maister@archlinux.us>
|
||||
- Main code, maintainer
|
||||
- Gamecube/Wii libogc port
|
||||
|
||||
Devin J. Pohly - <djpohly@djpohly.com>
|
||||
- Joypad axis support
|
||||
@ -10,7 +11,9 @@ Chris Moeller - <kode54@gmail.com>
|
||||
Daniel De Matteis - <autechre1024@hotmail.com>
|
||||
- PlayStation 3 port
|
||||
- XBox 360 XDK port
|
||||
- Libxenon port
|
||||
- XBox 1 port
|
||||
- Gamecube/Wii libogc port
|
||||
|
||||
David Reichelt - <freakdave@hotmail.com>
|
||||
- XBox 1 port
|
||||
@ -19,6 +22,7 @@ tukuyomi - <tukuyomi@free.fr>
|
||||
- Cleanups in quickbuild
|
||||
|
||||
Michael Lelli - <toadking@toadking.com>
|
||||
- Gamecube/Wii libogc port
|
||||
- Raspberry Pi video driver
|
||||
- Linux Raw keyboard input driver
|
||||
|
||||
|
@ -225,7 +225,20 @@ void rarch_settings_msg(unsigned setting, unsigned delay)
|
||||
snprintf(str, sizeof(str), "INFO - Press LEFT/RIGHT to change the controls, and press\n[RetroPad Start] to reset a button to default values.");
|
||||
break;
|
||||
case S_MSG_EXTRACTED_ZIPFILE:
|
||||
snprintf(str, sizeof(str), "INFO - ZIP file successfully extracted to cache partition.");
|
||||
switch(g_console.zip_extract_mode)
|
||||
{
|
||||
case ZIP_EXTRACT_TO_CURRENT_DIR:
|
||||
snprintf(str, sizeof(str), "INFO - ZIP file successfully extracted to current directory.");
|
||||
break;
|
||||
case ZIP_EXTRACT_TO_CURRENT_DIR_AND_LOAD_FIRST_FILE:
|
||||
snprintf(str, sizeof(str), "INFO - ZIP file successfully extracted, now loading first file.");
|
||||
break;
|
||||
#ifdef HAVE_HDD_CACHE_PARTITION
|
||||
case ZIP_EXTRACT_TO_CACHE_DIR:
|
||||
snprintf(str, sizeof(str), "INFO - ZIP file successfully extracted to cache partition.");
|
||||
break;
|
||||
#endif
|
||||
}
|
||||
break;
|
||||
case S_MSG_LOADING_ROM:
|
||||
fill_pathname_base(tmp, g_console.rom_path, sizeof(tmp));
|
||||
@ -296,7 +309,7 @@ void rarch_settings_create_menu_item_label(char * str, unsigned setting, size_t
|
||||
}
|
||||
}
|
||||
|
||||
void rarch_settings_set_default (void)
|
||||
void rarch_settings_set_default (const input_driver_t *input)
|
||||
{
|
||||
// g_settings
|
||||
g_settings.rewind_enable = false;
|
||||
@ -323,7 +336,7 @@ void rarch_settings_set_default (void)
|
||||
g_settings.video.msg_pos_y = 0.90f;
|
||||
g_settings.video.aspect_ratio = -1.0f;
|
||||
|
||||
rarch_input_set_controls_default();
|
||||
rarch_input_set_controls_default(input);
|
||||
|
||||
// g_console
|
||||
g_console.block_config_read = true;
|
||||
@ -362,6 +375,9 @@ void rarch_settings_set_default (void)
|
||||
#ifdef _XBOX360
|
||||
g_console.color_format = 0;
|
||||
#endif
|
||||
#ifdef HAVE_ZLIB
|
||||
g_console.zip_extract_mode = 0;
|
||||
#endif
|
||||
|
||||
// g_extern
|
||||
g_extern.state_slot = 0;
|
||||
|
@ -105,7 +105,7 @@ enum
|
||||
void rarch_settings_change(unsigned setting);
|
||||
void rarch_settings_default(unsigned setting);
|
||||
void rarch_settings_msg(unsigned setting, unsigned delay);
|
||||
void rarch_settings_set_default (void);
|
||||
void rarch_settings_set_default (const input_driver_t *input);
|
||||
|
||||
void rarch_settings_create_menu_item_label(char * str, unsigned setting, size_t size);
|
||||
void rarch_settings_create_menu_item_label_w(wchar_t *strwbuf, unsigned setting, size_t size);
|
||||
|
@ -21,7 +21,19 @@
|
||||
/*============================================================
|
||||
CONSOLE EXTENSIONS
|
||||
============================================================ */
|
||||
#include "../retroarch_rom_ext.c"
|
||||
#include "../retroarch_console.c"
|
||||
|
||||
#ifdef HAVE_CONFIGFILE
|
||||
#include "../retroarch_config.c"
|
||||
#endif
|
||||
|
||||
#include "../retroarch_console_input.c"
|
||||
|
||||
#ifdef HAVE_ZLIB
|
||||
#include "../retroarch_rzlib.c"
|
||||
#endif
|
||||
|
||||
#include "../console_settings.c"
|
||||
|
||||
#ifdef HAVE_LIBRETRO_MANAGEMENT
|
||||
@ -93,7 +105,7 @@ VIDEO DRIVER
|
||||
#elif defined(HAVE_OPENGLES20)
|
||||
#include "../../gfx/gles.c"
|
||||
#elif defined(GEKKO)
|
||||
#include "../../wii/video.c"
|
||||
#include "../../wii/gx_video.c"
|
||||
#endif
|
||||
|
||||
#include "../../gfx/gfx_common.c"
|
||||
@ -125,7 +137,7 @@ INPUT
|
||||
#if defined(__CELLOS_LV2__)
|
||||
#include "../../ps3/ps3_input.c"
|
||||
#elif defined(GEKKO)
|
||||
#include "../../wii/input.c"
|
||||
#include "../../wii/gx_input.c"
|
||||
#endif
|
||||
|
||||
#ifdef _XBOX
|
||||
@ -183,7 +195,7 @@ AUDIO
|
||||
#elif defined(_XBOX360)
|
||||
#include "../../360/xdk360_audio.cpp"
|
||||
#elif defined(GEKKO)
|
||||
#include "../../wii/audio.c"
|
||||
#include "../../wii/gx_audio.c"
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_DSOUND
|
||||
|
@ -65,7 +65,7 @@ static bool rarch_manage_libretro_install(char *libretro_core_installed, size_t
|
||||
return ret;
|
||||
}
|
||||
|
||||
bool rarch_configure_libretro_core(const char *full_path, const char *tmp_path,
|
||||
static bool rarch_configure_libretro_core(const char *full_path, const char *tmp_path,
|
||||
const char *libretro_path, const char *config_path, const char *extension)
|
||||
{
|
||||
bool libretro_core_was_installed = false;
|
||||
@ -140,7 +140,7 @@ end:
|
||||
dir_list_free(dir_list);
|
||||
}
|
||||
|
||||
void rarch_configure_libretro(const char *path_prefix, const char * extension)
|
||||
void rarch_configure_libretro(const input_driver_t *input, const char *path_prefix, const char * extension)
|
||||
{
|
||||
char full_path[1024];
|
||||
snprintf(full_path, sizeof(full_path), "%sCORE%s", path_prefix, extension);
|
||||
@ -148,7 +148,23 @@ void rarch_configure_libretro(const char *path_prefix, const char * extension)
|
||||
bool find_libretro_file = rarch_configure_libretro_core(full_path, path_prefix, path_prefix,
|
||||
default_paths.config_file, extension);
|
||||
|
||||
rarch_settings_set_default();
|
||||
rarch_settings_set_default(input);
|
||||
rarch_config_load(default_paths.config_file, path_prefix, extension, find_libretro_file);
|
||||
init_libretro_sym();
|
||||
}
|
||||
|
||||
bool rarch_manage_libretro_extension_supported(const char *filename)
|
||||
{
|
||||
bool ext_supported = false;
|
||||
struct string_list *ext_list = NULL;
|
||||
const char *file_ext = path_get_extension(filename);
|
||||
const char *ext = rarch_console_get_rom_ext();
|
||||
|
||||
if (ext)
|
||||
ext_list = string_split(ext, "|");
|
||||
|
||||
if (ext_list && string_list_find_elem(ext_list, file_ext))
|
||||
ext_supported = true;
|
||||
|
||||
return ext_supported;
|
||||
}
|
||||
|
@ -18,6 +18,7 @@
|
||||
#define LIBRETRO_MGMT_H__
|
||||
|
||||
#include "../boolean.h"
|
||||
#include "../driver.h"
|
||||
|
||||
enum
|
||||
{
|
||||
@ -28,8 +29,7 @@ enum
|
||||
};
|
||||
|
||||
void rarch_manage_libretro_set_first_file(char *first_file, size_t size_of_first_file, const char *libretro_path, const char * exe_ext);
|
||||
bool rarch_configure_libretro_core(const char *full_path, const char *tmp_path,
|
||||
const char *libretro_path, const char *config_path, const char *extension);
|
||||
void rarch_configure_libretro(const char *path_prefix, const char * extension);
|
||||
void rarch_configure_libretro(const input_driver_t *input, const char *path_prefix, const char * extension);
|
||||
bool rarch_manage_libretro_extension_supported(const char *filename);
|
||||
|
||||
#endif
|
||||
|
194
console/retroarch_config.c
Normal file
194
console/retroarch_config.c
Normal file
@ -0,0 +1,194 @@
|
||||
/* 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/>.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#include "retroarch_config.h"
|
||||
|
||||
#include "../conf/config_file.h"
|
||||
#include "../conf/config_file_macros.h"
|
||||
|
||||
void rarch_config_create_default(const char * conf_name)
|
||||
{
|
||||
FILE * f;
|
||||
RARCH_WARN("Config file \"%s\" doesn't exist. Creating...\n", conf_name);
|
||||
f = fopen(conf_name, "w");
|
||||
fclose(f);
|
||||
}
|
||||
|
||||
void rarch_config_load(const char * conf_name, const char * libretro_dir_path, const char * exe_ext, bool find_libretro_path)
|
||||
{
|
||||
if(!path_file_exists(conf_name))
|
||||
rarch_config_create_default(conf_name);
|
||||
else
|
||||
{
|
||||
config_file_t * conf = config_file_new(conf_name);
|
||||
|
||||
// g_settings
|
||||
|
||||
#ifdef HAVE_LIBRETRO_MANAGEMENT
|
||||
if(find_libretro_path)
|
||||
{
|
||||
CONFIG_GET_STRING(libretro, "libretro_path");
|
||||
|
||||
if(strcmp(g_settings.libretro, "") == 0)
|
||||
{
|
||||
char first_file[PATH_MAX];
|
||||
rarch_manage_libretro_set_first_file(first_file, sizeof(first_file), libretro_dir_path, exe_ext);
|
||||
if(first_file != NULL)
|
||||
strlcpy(g_settings.libretro, first_file, sizeof(g_settings.libretro));
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
CONFIG_GET_STRING(system_directory, "system_directory");
|
||||
CONFIG_GET_STRING(cheat_database, "cheat_database");
|
||||
CONFIG_GET_BOOL(rewind_enable, "rewind_enable");
|
||||
CONFIG_GET_STRING(video.cg_shader_path, "video_cg_shader");
|
||||
#ifdef HAVE_FBO
|
||||
CONFIG_GET_STRING(video.second_pass_shader, "video_second_pass_shader");
|
||||
CONFIG_GET_FLOAT(video.fbo_scale_x, "video_fbo_scale_x");
|
||||
CONFIG_GET_FLOAT(video.fbo_scale_y, "video_fbo_scale_y");
|
||||
CONFIG_GET_BOOL(video.render_to_texture, "video_render_to_texture");
|
||||
CONFIG_GET_BOOL(video.second_pass_smooth, "video_second_pass_smooth");
|
||||
#endif
|
||||
#ifdef _XBOX360
|
||||
CONFIG_GET_BOOL_CONSOLE(gamma_correction_enable, "gamma_correction_enable");
|
||||
CONFIG_GET_INT_CONSOLE(color_format, "color_format");
|
||||
#endif
|
||||
CONFIG_GET_BOOL(video.smooth, "video_smooth");
|
||||
CONFIG_GET_BOOL(video.vsync, "video_vsync");
|
||||
CONFIG_GET_FLOAT(video.aspect_ratio, "video_aspect_ratio");
|
||||
CONFIG_GET_STRING(audio.device, "audio_device");
|
||||
|
||||
for (unsigned i = 0; i < 7; i++)
|
||||
{
|
||||
char cfg[64];
|
||||
snprintf(cfg, sizeof(cfg), "input_dpad_emulation_p%u", i + 1);
|
||||
CONFIG_GET_INT(input.dpad_emulation[i], cfg);
|
||||
}
|
||||
|
||||
// g_console
|
||||
|
||||
#ifdef HAVE_FBO
|
||||
CONFIG_GET_BOOL_CONSOLE(fbo_enabled, "fbo_enabled");
|
||||
#endif
|
||||
#ifdef __CELLOS_LV2__
|
||||
CONFIG_GET_BOOL_CONSOLE(custom_bgm_enable, "custom_bgm_enable");
|
||||
#endif
|
||||
CONFIG_GET_BOOL_CONSOLE(overscan_enable, "overscan_enable");
|
||||
CONFIG_GET_BOOL_CONSOLE(screenshots_enable, "screenshots_enable");
|
||||
CONFIG_GET_BOOL_CONSOLE(throttle_enable, "throttle_enable");
|
||||
CONFIG_GET_BOOL_CONSOLE(triple_buffering_enable, "triple_buffering_enable");
|
||||
CONFIG_GET_BOOL_CONSOLE(info_msg_enable, "info_msg_enable");
|
||||
CONFIG_GET_INT_CONSOLE(aspect_ratio_index, "aspect_ratio_index");
|
||||
CONFIG_GET_INT_CONSOLE(current_resolution_id, "current_resolution_id");
|
||||
CONFIG_GET_INT_CONSOLE(viewports.custom_vp.x, "custom_viewport_x");
|
||||
CONFIG_GET_INT_CONSOLE(viewports.custom_vp.y, "custom_viewport_y");
|
||||
CONFIG_GET_INT_CONSOLE(viewports.custom_vp.width, "custom_viewport_width");
|
||||
CONFIG_GET_INT_CONSOLE(viewports.custom_vp.height, "custom_viewport_height");
|
||||
CONFIG_GET_INT_CONSOLE(screen_orientation, "screen_orientation");
|
||||
CONFIG_GET_INT_CONSOLE(sound_mode, "sound_mode");
|
||||
#ifdef HAVE_ZLIB
|
||||
CONFIG_GET_INT_CONSOLE(zip_extract_mode, "zip_extract_mode");
|
||||
#endif
|
||||
CONFIG_GET_STRING_CONSOLE(default_rom_startup_dir, "default_rom_startup_dir");
|
||||
CONFIG_GET_FLOAT_CONSOLE(menu_font_size, "menu_font_size");
|
||||
CONFIG_GET_FLOAT_CONSOLE(overscan_amount, "overscan_amount");
|
||||
|
||||
// g_extern
|
||||
CONFIG_GET_INT_EXTERN(state_slot, "state_slot");
|
||||
CONFIG_GET_INT_EXTERN(audio_data.mute, "audio_mute");
|
||||
}
|
||||
}
|
||||
|
||||
void rarch_config_save(const char * conf_name)
|
||||
{
|
||||
if(!path_file_exists(conf_name))
|
||||
rarch_config_create_default(conf_name);
|
||||
else
|
||||
{
|
||||
config_file_t * conf = config_file_new(conf_name);
|
||||
|
||||
if(conf == NULL)
|
||||
conf = config_file_new(NULL);
|
||||
|
||||
// g_settings
|
||||
config_set_string(conf, "libretro_path", g_settings.libretro);
|
||||
#ifdef HAVE_XML
|
||||
config_set_string(conf, "cheat_database_path", g_settings.cheat_database);
|
||||
#endif
|
||||
config_set_bool(conf, "rewind_enable", g_settings.rewind_enable);
|
||||
config_set_string(conf, "video_cg_shader", g_settings.video.cg_shader_path);
|
||||
config_set_float(conf, "video_aspect_ratio", g_settings.video.aspect_ratio);
|
||||
#ifdef HAVE_FBO
|
||||
config_set_float(conf, "video_fbo_scale_x", g_settings.video.fbo_scale_x);
|
||||
config_set_float(conf, "video_fbo_scale_y", g_settings.video.fbo_scale_y);
|
||||
config_set_string(conf, "video_second_pass_shader", g_settings.video.second_pass_shader);
|
||||
config_set_bool(conf, "video_render_to_texture", g_settings.video.render_to_texture);
|
||||
config_set_bool(conf, "video_second_pass_smooth", g_settings.video.second_pass_smooth);
|
||||
#endif
|
||||
config_set_bool(conf, "video_smooth", g_settings.video.smooth);
|
||||
config_set_bool(conf, "video_vsync", g_settings.video.vsync);
|
||||
config_set_string(conf, "audio_device", g_settings.audio.device);
|
||||
|
||||
for (unsigned i = 0; i < 7; i++)
|
||||
{
|
||||
char cfg[64];
|
||||
snprintf(cfg, sizeof(cfg), "input_dpad_emulation_p%u", i + 1);
|
||||
config_set_int(conf, cfg, g_settings.input.dpad_emulation[i]);
|
||||
}
|
||||
|
||||
#ifdef RARCH_CONSOLE
|
||||
config_set_bool(conf, "fbo_enabled", g_console.fbo_enabled);
|
||||
#ifdef __CELLOS_LV2__
|
||||
config_set_bool(conf, "custom_bgm_enable", g_console.custom_bgm_enable);
|
||||
#endif
|
||||
config_set_bool(conf, "overscan_enable", g_console.overscan_enable);
|
||||
config_set_bool(conf, "screenshots_enable", g_console.screenshots_enable);
|
||||
#ifdef _XBOX
|
||||
config_set_bool(conf, "gamma_correction_enable", g_console.gamma_correction_enable);
|
||||
config_set_int(conf, "color_format", g_console.color_format);
|
||||
#endif
|
||||
config_set_bool(conf, "throttle_enable", g_console.throttle_enable);
|
||||
config_set_bool(conf, "triple_buffering_enable", g_console.triple_buffering_enable);
|
||||
config_set_bool(conf, "info_msg_enable", g_console.info_msg_enable);
|
||||
config_set_int(conf, "sound_mode", g_console.sound_mode);
|
||||
config_set_int(conf, "aspect_ratio_index", g_console.aspect_ratio_index);
|
||||
config_set_int(conf, "current_resolution_id", g_console.current_resolution_id);
|
||||
config_set_int(conf, "custom_viewport_width", g_console.viewports.custom_vp.width);
|
||||
config_set_int(conf, "custom_viewport_height", g_console.viewports.custom_vp.height);
|
||||
config_set_int(conf, "custom_viewport_x", g_console.viewports.custom_vp.x);
|
||||
config_set_int(conf, "custom_viewport_y", g_console.viewports.custom_vp.y);
|
||||
config_set_int(conf, "screen_orientation", g_console.screen_orientation);
|
||||
config_set_string(conf, "default_rom_startup_dir", g_console.default_rom_startup_dir);
|
||||
config_set_float(conf, "menu_font_size", g_console.menu_font_size);
|
||||
config_set_float(conf, "overscan_amount", g_console.overscan_amount);
|
||||
#ifdef HAVE_ZLIB
|
||||
config_set_int(conf, "zip_extract_mode", g_console.zip_extract_mode);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// g_extern
|
||||
config_set_int(conf, "state_slot", g_extern.state_slot);
|
||||
config_set_int(conf, "audio_mute", g_extern.audio_data.mute);
|
||||
|
||||
if (!config_file_write(conf, conf_name))
|
||||
RARCH_ERR("Failed to write config file to \"%s\". Check permissions.\n", conf_name);
|
||||
|
||||
free(conf);
|
||||
}
|
||||
}
|
31
console/retroarch_config.h
Normal file
31
console/retroarch_config.h
Normal file
@ -0,0 +1,31 @@
|
||||
/* 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 _RARCH_CONSOLE_CONFIG_H
|
||||
#define _RARCH_CONSOLE_CONFIG_H
|
||||
|
||||
enum
|
||||
{
|
||||
CONFIG_FILE,
|
||||
SHADER_PRESET_FILE,
|
||||
INPUT_PRESET_FILE
|
||||
};
|
||||
|
||||
void rarch_config_create_default(const char * conf_name);
|
||||
void rarch_config_load(const char * conf_name, const char * libretro_dir_path, const char * exe_ext, bool find_libretro_path);
|
||||
void rarch_config_save(const char * conf_name);
|
||||
|
||||
#endif
|
@ -18,7 +18,6 @@
|
||||
#include <stdlib.h>
|
||||
#include <stddef.h>
|
||||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
#include "../boolean.h"
|
||||
#include "../compat/strl.h"
|
||||
#include "../libretro.h"
|
||||
@ -27,550 +26,10 @@
|
||||
#include "retroarch_console.h"
|
||||
#include "../file.h"
|
||||
|
||||
#ifdef HAVE_CONFIGFILE
|
||||
#include "../conf/config_file.h"
|
||||
#include "../conf/config_file_macros.h"
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_ZLIB
|
||||
#include "rzlib/zlib.h"
|
||||
#define WRITEBUFFERSIZE (1024 * 512)
|
||||
#endif
|
||||
|
||||
#ifdef _WIN32
|
||||
#include "../compat/posix_string.h"
|
||||
#endif
|
||||
|
||||
#define MAX_ARGS 32
|
||||
|
||||
/*============================================================
|
||||
ROM EXTENSIONS
|
||||
============================================================ */
|
||||
|
||||
default_paths_t default_paths;
|
||||
|
||||
void rarch_console_load_game(const char *path)
|
||||
{
|
||||
snprintf(g_console.rom_path, sizeof(g_console.rom_path), path);
|
||||
rarch_settings_change(S_START_RARCH);
|
||||
}
|
||||
|
||||
const char *rarch_console_get_rom_ext(void)
|
||||
{
|
||||
const char *retval = NULL;
|
||||
|
||||
struct retro_system_info info;
|
||||
#ifdef ANDROID
|
||||
pretro_get_system_info(&info);
|
||||
#else
|
||||
retro_get_system_info(&info);
|
||||
#endif
|
||||
|
||||
if (info.valid_extensions)
|
||||
retval = info.valid_extensions;
|
||||
else
|
||||
retval = "ZIP|zip";
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
void rarch_console_name_from_id(char *name, size_t size)
|
||||
{
|
||||
if (size == 0)
|
||||
return;
|
||||
|
||||
struct retro_system_info info;
|
||||
#ifdef ANDROID
|
||||
pretro_get_system_info(&info);
|
||||
#else
|
||||
retro_get_system_info(&info);
|
||||
#endif
|
||||
const char *id = info.library_name ? info.library_name : "Unknown";
|
||||
|
||||
if (!id || strlen(id) >= size)
|
||||
{
|
||||
name[0] = '\0';
|
||||
return;
|
||||
}
|
||||
|
||||
name[strlen(id)] = '\0';
|
||||
|
||||
for (size_t i = 0; id[i] != '\0'; i++)
|
||||
{
|
||||
char c = id[i];
|
||||
if (isspace(c) || isblank(c))
|
||||
name[i] = '_';
|
||||
else
|
||||
name[i] = tolower(c);
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef HAVE_ZLIB
|
||||
static int rarch_extract_currentfile_in_zip(unzFile uf)
|
||||
{
|
||||
char filename_inzip[PATH_MAX];
|
||||
FILE *fout = NULL;
|
||||
|
||||
unz_file_info file_info;
|
||||
int err = unzGetCurrentFileInfo(uf,
|
||||
&file_info, filename_inzip, sizeof(filename_inzip),
|
||||
NULL, 0, NULL, 0);
|
||||
|
||||
if (err != UNZ_OK)
|
||||
{
|
||||
RARCH_ERR("Error %d while trying to get ZIP file information.\n", err);
|
||||
return err;
|
||||
}
|
||||
|
||||
size_t size_buf = WRITEBUFFERSIZE;
|
||||
void *buf = malloc(size_buf);
|
||||
if (!buf)
|
||||
{
|
||||
RARCH_ERR("Error allocating memory for ZIP extract operation.\n");
|
||||
return UNZ_INTERNALERROR;
|
||||
}
|
||||
|
||||
char write_filename[PATH_MAX];
|
||||
|
||||
#ifdef HAVE_HDD_CACHE_PARTITION
|
||||
|
||||
#if defined(__CELLOS_LV2__)
|
||||
snprintf(write_filename, sizeof(write_filename), "/dev_hdd1/%s", filename_inzip);
|
||||
#elif defined(_XBOX)
|
||||
snprintf(write_filename, sizeof(write_filename), "cache:\\%s", filename_inzip);
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
err = unzOpenCurrentFile(uf);
|
||||
if (err != UNZ_OK)
|
||||
RARCH_ERR("Error %d while trying to open ZIP file.\n", err);
|
||||
else
|
||||
{
|
||||
/* success */
|
||||
fout = fopen(write_filename, "wb");
|
||||
|
||||
if (!fout)
|
||||
RARCH_ERR("Error opening %s.\n", write_filename);
|
||||
}
|
||||
|
||||
if (fout)
|
||||
{
|
||||
RARCH_LOG("Extracting: %s..\n", write_filename);
|
||||
|
||||
do
|
||||
{
|
||||
err = unzReadCurrentFile(uf, buf, size_buf);
|
||||
if (err < 0)
|
||||
{
|
||||
RARCH_ERR("Error %d while reading from ZIP file.\n", err);
|
||||
break;
|
||||
}
|
||||
|
||||
if (err > 0)
|
||||
{
|
||||
if (fwrite(buf, err, 1, fout) != 1)
|
||||
{
|
||||
RARCH_ERR("Error while extracting file(s) from ZIP.\n");
|
||||
err = UNZ_ERRNO;
|
||||
break;
|
||||
}
|
||||
}
|
||||
} while (err > 0);
|
||||
|
||||
if (fout)
|
||||
fclose(fout);
|
||||
}
|
||||
|
||||
if (err == UNZ_OK)
|
||||
{
|
||||
err = unzCloseCurrentFile (uf);
|
||||
if (err != UNZ_OK)
|
||||
RARCH_ERR("Error %d while trying to close ZIP file.\n", err);
|
||||
}
|
||||
else
|
||||
unzCloseCurrentFile(uf);
|
||||
|
||||
free(buf);
|
||||
return err;
|
||||
}
|
||||
|
||||
int rarch_extract_zipfile(const char *zip_path)
|
||||
{
|
||||
unzFile uf = unzOpen(zip_path);
|
||||
|
||||
unz_global_info gi;
|
||||
int err = unzGetGlobalInfo(uf, &gi);
|
||||
if (err != UNZ_OK)
|
||||
RARCH_ERR("Error %d while trying to get ZIP file global info.\n",err);
|
||||
|
||||
for (unsigned i = 0; i < gi.number_entry; i++)
|
||||
{
|
||||
if (rarch_extract_currentfile_in_zip(uf) != UNZ_OK)
|
||||
break;
|
||||
|
||||
if ((i + 1) < gi.number_entry)
|
||||
{
|
||||
err = unzGoToNextFile(uf);
|
||||
if (err != UNZ_OK)
|
||||
{
|
||||
RARCH_ERR("Error %d while trying to go to the next file in the ZIP archive.\n",err);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef HAVE_HDD_CACHE_PARTITION
|
||||
if(g_console.info_msg_enable)
|
||||
rarch_settings_msg(S_MSG_EXTRACTED_ZIPFILE, S_DELAY_180);
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
/*============================================================
|
||||
INPUT EXTENSIONS
|
||||
============================================================ */
|
||||
|
||||
#include "retroarch_console_input.h"
|
||||
|
||||
struct platform_bind
|
||||
{
|
||||
uint64_t joykey;
|
||||
const char *label;
|
||||
};
|
||||
|
||||
uint64_t rarch_default_keybind_lut[RARCH_FIRST_META_KEY];
|
||||
|
||||
char rarch_default_libretro_keybind_name_lut[RARCH_FIRST_META_KEY][256] = {
|
||||
"RetroPad Button B", /* RETRO_DEVICE_ID_JOYPAD_B */
|
||||
"RetroPad Button Y", /* RETRO_DEVICE_ID_JOYPAD_Y */
|
||||
"RetroPad Button Select", /* RETRO_DEVICE_ID_JOYPAD_SELECT */
|
||||
"RetroPad Button Start", /* RETRO_DEVICE_ID_JOYPAD_START */
|
||||
"RetroPad D-Pad Up", /* RETRO_DEVICE_ID_JOYPAD_UP */
|
||||
"RetroPad D-Pad Down", /* RETRO_DEVICE_ID_JOYPAD_DOWN */
|
||||
"RetroPad D-Pad Left", /* RETRO_DEVICE_ID_JOYPAD_LEFT */
|
||||
"RetroPad D-Pad Right", /* RETRO_DEVICE_ID_JOYPAD_RIGHT */
|
||||
"RetroPad Button A", /* RETRO_DEVICE_ID_JOYPAD_A */
|
||||
"RetroPad Button X", /* RETRO_DEVICE_ID_JOYPAD_X */
|
||||
"RetroPad Button L1", /* RETRO_DEVICE_ID_JOYPAD_L */
|
||||
"RetroPad Button R1", /* RETRO_DEVICE_ID_JOYPAD_R */
|
||||
"RetroPad Button L2", /* RETRO_DEVICE_ID_JOYPAD_L2 */
|
||||
"RetroPad Button R2", /* RETRO_DEVICE_ID_JOYPAD_R2 */
|
||||
"RetroPad Button L3", /* RETRO_DEVICE_ID_JOYPAD_L3 */
|
||||
"RetroPad Button R3", /* RETRO_DEVICE_ID_JOYPAD_R3 */
|
||||
};
|
||||
|
||||
#if defined(__CELLOS_LV2__)
|
||||
static const struct platform_bind platform_keys[] = {
|
||||
{ CTRL_CIRCLE_MASK, "Circle button" },
|
||||
{ CTRL_CROSS_MASK, "Cross button" },
|
||||
{ CTRL_TRIANGLE_MASK, "Triangle button" },
|
||||
{ CTRL_SQUARE_MASK, "Square button" },
|
||||
{ CTRL_UP_MASK, "D-Pad Up" },
|
||||
{ CTRL_DOWN_MASK, "D-Pad Down" },
|
||||
{ CTRL_LEFT_MASK, "D-Pad Left" },
|
||||
{ CTRL_RIGHT_MASK, "D-Pad Right" },
|
||||
{ CTRL_SELECT_MASK, "Select button" },
|
||||
{ CTRL_START_MASK, "Start button" },
|
||||
{ CTRL_L1_MASK, "L1 button" },
|
||||
{ CTRL_L2_MASK, "L2 button" },
|
||||
{ CTRL_L3_MASK, "L3 button" },
|
||||
{ CTRL_R1_MASK, "R1 button" },
|
||||
{ CTRL_R2_MASK, "R2 button" },
|
||||
{ CTRL_R3_MASK, "R3 button" },
|
||||
{ CTRL_LSTICK_LEFT_MASK, "LStick Left" },
|
||||
{ CTRL_LSTICK_RIGHT_MASK, "LStick Right" },
|
||||
{ CTRL_LSTICK_UP_MASK, "LStick Up" },
|
||||
{ CTRL_LSTICK_DOWN_MASK, "LStick Down" },
|
||||
{ CTRL_LEFT_MASK | CTRL_LSTICK_LEFT_MASK, "LStick D-Pad Left" },
|
||||
{ CTRL_RIGHT_MASK | CTRL_LSTICK_RIGHT_MASK, "LStick D-Pad Right" },
|
||||
{ CTRL_UP_MASK | CTRL_LSTICK_UP_MASK, "LStick D-Pad Up" },
|
||||
{ CTRL_DOWN_MASK | CTRL_LSTICK_DOWN_MASK, "LStick D-Pad Down" },
|
||||
{ CTRL_RSTICK_LEFT_MASK, "RStick Left" },
|
||||
{ CTRL_RSTICK_RIGHT_MASK, "RStick Right" },
|
||||
{ CTRL_RSTICK_UP_MASK, "RStick Up" },
|
||||
{ CTRL_RSTICK_DOWN_MASK, "RStick Down" },
|
||||
{ CTRL_LEFT_MASK | CTRL_RSTICK_LEFT_MASK, "RStick D-Pad Left" },
|
||||
{ CTRL_RIGHT_MASK | CTRL_RSTICK_RIGHT_MASK, "RStick D-Pad Right" },
|
||||
{ CTRL_UP_MASK | CTRL_RSTICK_UP_MASK, "RStick D-Pad Up" },
|
||||
{ CTRL_DOWN_MASK | CTRL_RSTICK_DOWN_MASK, "RStick D-Pad Down" },
|
||||
};
|
||||
#elif defined(_XBOX360)
|
||||
static const struct platform_bind platform_keys[] = {
|
||||
{ XINPUT_GAMEPAD_B, "B button" },
|
||||
{ XINPUT_GAMEPAD_A, "A button" },
|
||||
{ XINPUT_GAMEPAD_Y, "Y button" },
|
||||
{ XINPUT_GAMEPAD_X, "X button" },
|
||||
{ XINPUT_GAMEPAD_DPAD_UP, "D-Pad Up" },
|
||||
{ XINPUT_GAMEPAD_DPAD_DOWN, "D-Pad Down" },
|
||||
{ XINPUT_GAMEPAD_DPAD_LEFT, "D-Pad Left" },
|
||||
{ XINPUT_GAMEPAD_DPAD_RIGHT, "D-Pad Right" },
|
||||
{ XINPUT_GAMEPAD_BACK, "Back button" },
|
||||
{ XINPUT_GAMEPAD_START, "Start button" },
|
||||
{ XINPUT_GAMEPAD_LEFT_SHOULDER, "Left Shoulder" },
|
||||
{ XINPUT_GAMEPAD_LEFT_TRIGGER, "Left Trigger" },
|
||||
{ XINPUT_GAMEPAD_LEFT_THUMB, "Left Thumb" },
|
||||
{ XINPUT_GAMEPAD_RIGHT_SHOULDER, "Right Shoulder" },
|
||||
{ XINPUT_GAMEPAD_RIGHT_TRIGGER, "Right Trigger" },
|
||||
{ XINPUT_GAMEPAD_RIGHT_THUMB, "Right Thumb" },
|
||||
{ XINPUT_GAMEPAD_LSTICK_LEFT_MASK, "LStick Left" },
|
||||
{ XINPUT_GAMEPAD_LSTICK_RIGHT_MASK, "LStick Right" },
|
||||
{ XINPUT_GAMEPAD_LSTICK_UP_MASK, "LStick Up" },
|
||||
{ XINPUT_GAMEPAD_LSTICK_DOWN_MASK, "LStick Down" },
|
||||
{ XINPUT_GAMEPAD_DPAD_LEFT | XINPUT_GAMEPAD_LSTICK_LEFT_MASK, "LStick D-Pad Left" },
|
||||
{ XINPUT_GAMEPAD_DPAD_RIGHT | XINPUT_GAMEPAD_LSTICK_RIGHT_MASK, "LStick D-Pad Right" },
|
||||
{ XINPUT_GAMEPAD_DPAD_UP | XINPUT_GAMEPAD_LSTICK_UP_MASK, "LStick D-Pad Up" },
|
||||
{ XINPUT_GAMEPAD_DPAD_DOWN | XINPUT_GAMEPAD_LSTICK_DOWN_MASK, "LStick D-Pad Down" },
|
||||
{ XINPUT_GAMEPAD_RSTICK_LEFT_MASK, "RStick Left" },
|
||||
{ XINPUT_GAMEPAD_RSTICK_RIGHT_MASK, "RStick Right" },
|
||||
{ XINPUT_GAMEPAD_RSTICK_UP_MASK, "RStick Up" },
|
||||
{ XINPUT_GAMEPAD_RSTICK_DOWN_MASK, "RStick Down" },
|
||||
{ XINPUT_GAMEPAD_DPAD_LEFT | XINPUT_GAMEPAD_RSTICK_LEFT_MASK, "RStick D-Pad Left" },
|
||||
{ XINPUT_GAMEPAD_DPAD_RIGHT | XINPUT_GAMEPAD_RSTICK_RIGHT_MASK, "RStick D-Pad Right" },
|
||||
{ XINPUT_GAMEPAD_DPAD_UP | XINPUT_GAMEPAD_RSTICK_UP_MASK, "RStick D-Pad Up" },
|
||||
{ XINPUT_GAMEPAD_DPAD_DOWN | XINPUT_GAMEPAD_RSTICK_DOWN_MASK, "RStick D-Pad Down" },
|
||||
};
|
||||
#elif defined(_XBOX1)
|
||||
static const struct platform_bind platform_keys[] = {
|
||||
{ XINPUT1_GAMEPAD_B, "B button" },
|
||||
{ XINPUT1_GAMEPAD_A, "A button" },
|
||||
{ XINPUT1_GAMEPAD_Y, "Y button" },
|
||||
{ XINPUT1_GAMEPAD_X, "X button" },
|
||||
{ XINPUT1_GAMEPAD_DPAD_UP, "D-Pad Up" },
|
||||
{ XINPUT1_GAMEPAD_DPAD_DOWN, "D-Pad Down" },
|
||||
{ XINPUT1_GAMEPAD_DPAD_LEFT, "D-Pad Left" },
|
||||
{ XINPUT1_GAMEPAD_DPAD_RIGHT, "D-Pad Right" },
|
||||
{ XINPUT1_GAMEPAD_BACK, "Back button" },
|
||||
{ XINPUT1_GAMEPAD_START, "Start button" },
|
||||
{ XINPUT1_GAMEPAD_WHITE, "White button" },
|
||||
{ XINPUT1_GAMEPAD_LEFT_TRIGGER, "Left Trigger" },
|
||||
{ XINPUT1_GAMEPAD_LEFT_THUMB, "Left Thumb" },
|
||||
{ XINPUT1_GAMEPAD_BLACK, "Black button" },
|
||||
{ XINPUT1_GAMEPAD_RIGHT_TRIGGER, "Right Trigger" },
|
||||
{ XINPUT1_GAMEPAD_RIGHT_THUMB, "Right Thumb" },
|
||||
{ XINPUT1_GAMEPAD_LSTICK_LEFT_MASK, "LStick Left" },
|
||||
{ XINPUT1_GAMEPAD_LSTICK_RIGHT_MASK, "LStick Right" },
|
||||
{ XINPUT1_GAMEPAD_LSTICK_UP_MASK, "LStick Up" },
|
||||
{ XINPUT1_GAMEPAD_LSTICK_DOWN_MASK, "LStick Down" },
|
||||
{ XINPUT1_GAMEPAD_DPAD_LEFT | XINPUT1_GAMEPAD_LSTICK_LEFT_MASK, "LStick D-Pad Left" },
|
||||
{ XINPUT1_GAMEPAD_DPAD_RIGHT | XINPUT1_GAMEPAD_LSTICK_RIGHT_MASK, "LStick D-Pad Right" },
|
||||
{ XINPUT1_GAMEPAD_DPAD_UP | XINPUT1_GAMEPAD_LSTICK_UP_MASK, "LStick D-Pad Up" },
|
||||
{ XINPUT1_GAMEPAD_DPAD_DOWN | XINPUT1_GAMEPAD_LSTICK_DOWN_MASK, "LStick D-Pad Down" },
|
||||
{ XINPUT1_GAMEPAD_RSTICK_LEFT_MASK, "RStick Left" },
|
||||
{ XINPUT1_GAMEPAD_RSTICK_RIGHT_MASK, "RStick Right" },
|
||||
{ XINPUT1_GAMEPAD_RSTICK_UP_MASK, "RStick Up" },
|
||||
{ XINPUT1_GAMEPAD_RSTICK_DOWN_MASK, "RStick Down" },
|
||||
{ XINPUT1_GAMEPAD_DPAD_LEFT | XINPUT1_GAMEPAD_RSTICK_LEFT_MASK, "RStick D-Pad Left" },
|
||||
{ XINPUT1_GAMEPAD_DPAD_RIGHT | XINPUT1_GAMEPAD_RSTICK_RIGHT_MASK, "RStick D-Pad Right" },
|
||||
{ XINPUT1_GAMEPAD_DPAD_UP | XINPUT1_GAMEPAD_RSTICK_UP_MASK, "RStick D-Pad Up" },
|
||||
{ XINPUT1_GAMEPAD_DPAD_DOWN | XINPUT1_GAMEPAD_RSTICK_DOWN_MASK, "RStick D-Pad Down" },
|
||||
};
|
||||
#elif defined(GEKKO)
|
||||
static const struct platform_bind platform_keys[] = {
|
||||
{ PAD_BUTTON_B, "(NGC) B button" },
|
||||
{ PAD_BUTTON_A, "(NGC) A button" },
|
||||
{ PAD_BUTTON_Y, "(NGC) Y button" },
|
||||
{ PAD_BUTTON_X, "(NGC) X button" },
|
||||
{ PAD_BUTTON_UP, "(NGC) D-Pad Up" },
|
||||
{ PAD_BUTTON_DOWN, "(NGC) D-Pad Down" },
|
||||
{ PAD_BUTTON_LEFT, "(NGC) D-Pad Left" },
|
||||
{ PAD_BUTTON_RIGHT, "(NGC) D-Pad Right" },
|
||||
{ PAD_TRIGGER_Z, "(NGC) Z trigger" },
|
||||
{ PAD_BUTTON_START, "(NGC) Start button" },
|
||||
{ PAD_TRIGGER_L, "(NGC) Left Trigger" },
|
||||
{ PAD_TRIGGER_R, "(NGC) Right Trigger" },
|
||||
#ifdef HW_RVL
|
||||
{ WPAD_CLASSIC_BUTTON_B, "(Wii Classici) B button" },
|
||||
{ WPAD_CLASSIC_BUTTON_A, "(Wii Classic) A button" },
|
||||
{ WPAD_CLASSIC_BUTTON_Y, "(Wii Classic) Y button" },
|
||||
{ WPAD_CLASSIC_BUTTON_X, "(Wii Classic) X button" },
|
||||
{ WPAD_CLASSIC_BUTTON_UP, "(Wii Classic) D-Pad Up" },
|
||||
{ WPAD_CLASSIC_BUTTON_DOWN, "(Wii Classic) D-Pad Down" },
|
||||
{ WPAD_CLASSIC_BUTTON_LEFT, "(Wii Classic) D-Pad Left" },
|
||||
{ WPAD_CLASSIC_BUTTON_RIGHT, "(Wii Classic) D-Pad Right" },
|
||||
{ WPAD_CLASSIC_BUTTON_MINUS, "(Wii Classic) Select/Minus button" },
|
||||
{ WPAD_CLASSIC_BUTTON_PLUS, "(Wii Classic) Start/Plus button" },
|
||||
{ WPAD_CLASSIC_BUTTON_HOME, "(Wii Classic) Home button" },
|
||||
{ WPAD_CLASSIC_BUTTON_FULL_L, "(Wii Classic) Left Trigger" },
|
||||
{ WPAD_CLASSIC_BUTTON_FULL_R, "(Wii Classic) Right Trigger" },
|
||||
{ WPAD_CLASSIC_BUTTON_ZL, "(Wii Classic) ZL button" },
|
||||
{ WPAD_CLASSIC_BUTTON_ZR, "(Wii Classic) ZR button" },
|
||||
#endif
|
||||
};
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_DEFAULT_RETROPAD_INPUT
|
||||
|
||||
uint64_t rarch_input_find_previous_platform_key(uint64_t joykey)
|
||||
{
|
||||
size_t arr_size = sizeof(platform_keys) / sizeof(platform_keys[0]);
|
||||
|
||||
if (platform_keys[0].joykey == joykey)
|
||||
return joykey;
|
||||
|
||||
for (size_t i = 1; i < arr_size; i++)
|
||||
{
|
||||
if (platform_keys[i].joykey == joykey)
|
||||
return platform_keys[i - 1].joykey;
|
||||
}
|
||||
|
||||
return NO_BTN;
|
||||
}
|
||||
|
||||
uint64_t rarch_input_find_next_platform_key(uint64_t joykey)
|
||||
{
|
||||
size_t arr_size = sizeof(platform_keys) / sizeof(platform_keys[0]);
|
||||
if (platform_keys[arr_size - 1].joykey == joykey)
|
||||
return joykey;
|
||||
|
||||
for (size_t i = 0; i < arr_size - 1; i++)
|
||||
{
|
||||
if (platform_keys[i].joykey == joykey)
|
||||
return platform_keys[i + 1].joykey;
|
||||
}
|
||||
|
||||
return NO_BTN;
|
||||
}
|
||||
|
||||
const char *rarch_input_find_platform_key_label(uint64_t joykey)
|
||||
{
|
||||
if (joykey == NO_BTN)
|
||||
return "No button";
|
||||
|
||||
size_t arr_size = sizeof(platform_keys) / sizeof(platform_keys[0]);
|
||||
for (size_t i = 0; i < arr_size; i++)
|
||||
{
|
||||
if (platform_keys[i].joykey == joykey)
|
||||
return platform_keys[i].label;
|
||||
}
|
||||
|
||||
return "Unknown";
|
||||
}
|
||||
|
||||
|
||||
void rarch_input_set_keybind(unsigned player, unsigned keybind_action, uint64_t default_retro_joypad_id)
|
||||
{
|
||||
uint64_t *key = &g_settings.input.binds[player][default_retro_joypad_id].joykey;
|
||||
|
||||
switch (keybind_action)
|
||||
{
|
||||
case KEYBIND_DECREMENT:
|
||||
*key = rarch_input_find_previous_platform_key(*key);
|
||||
break;
|
||||
|
||||
case KEYBIND_INCREMENT:
|
||||
*key = rarch_input_find_next_platform_key(*key);
|
||||
break;
|
||||
|
||||
case KEYBIND_DEFAULT:
|
||||
*key = rarch_default_keybind_lut[default_retro_joypad_id];
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void rarch_input_set_default_keybinds(unsigned player)
|
||||
{
|
||||
for (unsigned i = 0; i < RARCH_FIRST_META_KEY; i++)
|
||||
{
|
||||
g_settings.input.binds[player][i].id = i;
|
||||
g_settings.input.binds[player][i].joykey = rarch_default_keybind_lut[i];
|
||||
}
|
||||
g_settings.input.dpad_emulation[player] = DPAD_EMULATION_LSTICK;
|
||||
}
|
||||
|
||||
void rarch_input_set_controls_default (void)
|
||||
{
|
||||
#if defined(__CELLOS_LV2__)
|
||||
rarch_default_keybind_lut[RETRO_DEVICE_ID_JOYPAD_B] = platform_keys[PS3_DEVICE_ID_JOYPAD_CROSS].joykey;
|
||||
rarch_default_keybind_lut[RETRO_DEVICE_ID_JOYPAD_Y] = platform_keys[PS3_DEVICE_ID_JOYPAD_SQUARE].joykey;
|
||||
rarch_default_keybind_lut[RETRO_DEVICE_ID_JOYPAD_SELECT] = platform_keys[PS3_DEVICE_ID_JOYPAD_SELECT].joykey;
|
||||
rarch_default_keybind_lut[RETRO_DEVICE_ID_JOYPAD_START] = platform_keys[PS3_DEVICE_ID_JOYPAD_START].joykey;
|
||||
rarch_default_keybind_lut[RETRO_DEVICE_ID_JOYPAD_UP] = platform_keys[PS3_DEVICE_ID_JOYPAD_UP].joykey;
|
||||
rarch_default_keybind_lut[RETRO_DEVICE_ID_JOYPAD_DOWN] = platform_keys[PS3_DEVICE_ID_JOYPAD_DOWN].joykey;
|
||||
rarch_default_keybind_lut[RETRO_DEVICE_ID_JOYPAD_LEFT] = platform_keys[PS3_DEVICE_ID_JOYPAD_LEFT].joykey;
|
||||
rarch_default_keybind_lut[RETRO_DEVICE_ID_JOYPAD_RIGHT] = platform_keys[PS3_DEVICE_ID_JOYPAD_RIGHT].joykey;
|
||||
rarch_default_keybind_lut[RETRO_DEVICE_ID_JOYPAD_A] = platform_keys[PS3_DEVICE_ID_JOYPAD_CIRCLE].joykey;
|
||||
rarch_default_keybind_lut[RETRO_DEVICE_ID_JOYPAD_X] = platform_keys[PS3_DEVICE_ID_JOYPAD_TRIANGLE].joykey;
|
||||
rarch_default_keybind_lut[RETRO_DEVICE_ID_JOYPAD_L] = platform_keys[PS3_DEVICE_ID_JOYPAD_L1].joykey;
|
||||
rarch_default_keybind_lut[RETRO_DEVICE_ID_JOYPAD_R] = platform_keys[PS3_DEVICE_ID_JOYPAD_R1].joykey;
|
||||
rarch_default_keybind_lut[RETRO_DEVICE_ID_JOYPAD_R2] = platform_keys[PS3_DEVICE_ID_JOYPAD_R2].joykey;
|
||||
rarch_default_keybind_lut[RETRO_DEVICE_ID_JOYPAD_R3] = platform_keys[PS3_DEVICE_ID_JOYPAD_R3].joykey;
|
||||
rarch_default_keybind_lut[RETRO_DEVICE_ID_JOYPAD_L2] = platform_keys[PS3_DEVICE_ID_JOYPAD_L2].joykey;
|
||||
rarch_default_keybind_lut[RETRO_DEVICE_ID_JOYPAD_L3] = platform_keys[PS3_DEVICE_ID_JOYPAD_L3].joykey;
|
||||
#elif defined(_XBOX)
|
||||
rarch_default_keybind_lut[RETRO_DEVICE_ID_JOYPAD_B] = platform_keys[XDK_DEVICE_ID_JOYPAD_A].joykey;
|
||||
rarch_default_keybind_lut[RETRO_DEVICE_ID_JOYPAD_Y] = platform_keys[XDK_DEVICE_ID_JOYPAD_X].joykey;
|
||||
rarch_default_keybind_lut[RETRO_DEVICE_ID_JOYPAD_SELECT] = platform_keys[XDK_DEVICE_ID_JOYPAD_BACK].joykey;
|
||||
rarch_default_keybind_lut[RETRO_DEVICE_ID_JOYPAD_START] = platform_keys[XDK_DEVICE_ID_JOYPAD_START].joykey;
|
||||
rarch_default_keybind_lut[RETRO_DEVICE_ID_JOYPAD_UP] = platform_keys[XDK_DEVICE_ID_JOYPAD_UP].joykey;
|
||||
rarch_default_keybind_lut[RETRO_DEVICE_ID_JOYPAD_DOWN] = platform_keys[XDK_DEVICE_ID_JOYPAD_DOWN].joykey;
|
||||
rarch_default_keybind_lut[RETRO_DEVICE_ID_JOYPAD_LEFT] = platform_keys[XDK_DEVICE_ID_JOYPAD_LEFT].joykey;
|
||||
rarch_default_keybind_lut[RETRO_DEVICE_ID_JOYPAD_RIGHT] = platform_keys[XDK_DEVICE_ID_JOYPAD_RIGHT].joykey;
|
||||
rarch_default_keybind_lut[RETRO_DEVICE_ID_JOYPAD_A] = platform_keys[XDK_DEVICE_ID_JOYPAD_B].joykey;
|
||||
rarch_default_keybind_lut[RETRO_DEVICE_ID_JOYPAD_X] = platform_keys[XDK_DEVICE_ID_JOYPAD_Y].joykey;
|
||||
#if defined(_XBOX1)
|
||||
rarch_default_keybind_lut[RETRO_DEVICE_ID_JOYPAD_L] = platform_keys[XDK_DEVICE_ID_JOYPAD_LEFT_TRIGGER].joykey;
|
||||
rarch_default_keybind_lut[RETRO_DEVICE_ID_JOYPAD_R] = platform_keys[XDK_DEVICE_ID_JOYPAD_RIGHT_TRIGGER].joykey;
|
||||
rarch_default_keybind_lut[RETRO_DEVICE_ID_JOYPAD_L2] = platform_keys[XDK_DEVICE_ID_JOYPAD_LB].joykey;
|
||||
rarch_default_keybind_lut[RETRO_DEVICE_ID_JOYPAD_R2] = platform_keys[XDK_DEVICE_ID_JOYPAD_RB].joykey;
|
||||
#elif defined(_XBOX360)
|
||||
rarch_default_keybind_lut[RETRO_DEVICE_ID_JOYPAD_L] = platform_keys[XDK_DEVICE_ID_JOYPAD_LB].joykey;
|
||||
rarch_default_keybind_lut[RETRO_DEVICE_ID_JOYPAD_R] = platform_keys[XDK_DEVICE_ID_JOYPAD_RB].joykey;
|
||||
rarch_default_keybind_lut[RETRO_DEVICE_ID_JOYPAD_L2] = platform_keys[XDK_DEVICE_ID_JOYPAD_LEFT_TRIGGER].joykey;
|
||||
rarch_default_keybind_lut[RETRO_DEVICE_ID_JOYPAD_R2] = platform_keys[XDK_DEVICE_ID_JOYPAD_RIGHT_TRIGGER].joykey;
|
||||
#endif
|
||||
rarch_default_keybind_lut[RETRO_DEVICE_ID_JOYPAD_L3] = platform_keys[XDK_DEVICE_ID_LSTICK_THUMB].joykey;
|
||||
rarch_default_keybind_lut[RETRO_DEVICE_ID_JOYPAD_R3] = platform_keys[XDK_DEVICE_ID_RSTICK_THUMB].joykey;
|
||||
#endif
|
||||
for(uint32_t x = 0; x < MAX_PLAYERS; x++)
|
||||
rarch_input_set_default_keybinds(x);
|
||||
}
|
||||
|
||||
const char *rarch_input_get_default_keybind_name(unsigned id)
|
||||
{
|
||||
return rarch_default_libretro_keybind_name_lut[id];
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
void rarch_input_set_default_keybind_names_for_emulator(void)
|
||||
{
|
||||
struct retro_system_info info;
|
||||
#ifdef ANDROID
|
||||
pretro_get_system_info(&info);
|
||||
#else
|
||||
retro_get_system_info(&info);
|
||||
#endif
|
||||
const char *id = info.library_name ? info.library_name : "Unknown";
|
||||
|
||||
// Genesis Plus GX/Next
|
||||
if (strstr(id, "Genesis Plus GX"))
|
||||
{
|
||||
strlcpy(rarch_default_libretro_keybind_name_lut[RETRO_DEVICE_ID_JOYPAD_B],
|
||||
"B button", sizeof(rarch_default_libretro_keybind_name_lut[RETRO_DEVICE_ID_JOYPAD_B]));
|
||||
strlcpy(rarch_default_libretro_keybind_name_lut[RETRO_DEVICE_ID_JOYPAD_A],
|
||||
"C button", sizeof(rarch_default_libretro_keybind_name_lut[RETRO_DEVICE_ID_JOYPAD_A]));
|
||||
strlcpy(rarch_default_libretro_keybind_name_lut[RETRO_DEVICE_ID_JOYPAD_X],
|
||||
"Y button", sizeof(rarch_default_libretro_keybind_name_lut[RETRO_DEVICE_ID_JOYPAD_X]));
|
||||
strlcpy(rarch_default_libretro_keybind_name_lut[RETRO_DEVICE_ID_JOYPAD_Y],
|
||||
"A button", sizeof(rarch_default_libretro_keybind_name_lut[RETRO_DEVICE_ID_JOYPAD_Y]));
|
||||
strlcpy(rarch_default_libretro_keybind_name_lut[RETRO_DEVICE_ID_JOYPAD_L],
|
||||
"X button", sizeof(rarch_default_libretro_keybind_name_lut[RETRO_DEVICE_ID_JOYPAD_L]));
|
||||
strlcpy(rarch_default_libretro_keybind_name_lut[RETRO_DEVICE_ID_JOYPAD_R],
|
||||
"Z button", sizeof(rarch_default_libretro_keybind_name_lut[RETRO_DEVICE_ID_JOYPAD_R]));
|
||||
strlcpy(rarch_default_libretro_keybind_name_lut[RETRO_DEVICE_ID_JOYPAD_SELECT],
|
||||
"Mode button", sizeof(rarch_default_libretro_keybind_name_lut[RETRO_DEVICE_ID_JOYPAD_SELECT]));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*============================================================
|
||||
VIDEO EXTENSIONS
|
||||
============================================================ */
|
||||
@ -846,174 +305,17 @@ const char * rarch_convert_wchar_to_const_char(const wchar_t * wstr)
|
||||
return str;
|
||||
}
|
||||
|
||||
/*============================================================
|
||||
CONFIG
|
||||
============================================================ */
|
||||
|
||||
#ifdef HAVE_CONFIGFILE
|
||||
void rarch_config_create_default(const char * conf_name)
|
||||
void rarch_extract_directory(char *buf, const char *path, size_t size)
|
||||
{
|
||||
FILE * f;
|
||||
RARCH_WARN("Config file \"%s\" doesn't exist. Creating...\n", conf_name);
|
||||
f = fopen(conf_name, "w");
|
||||
fclose(f);
|
||||
}
|
||||
strncpy(buf, path, size - 1);
|
||||
buf[size - 1] = '\0';
|
||||
|
||||
void rarch_config_load(const char * conf_name, const char * libretro_dir_path, const char * exe_ext, bool find_libretro_path)
|
||||
{
|
||||
if(!path_file_exists(conf_name))
|
||||
rarch_config_create_default(conf_name);
|
||||
char *base = strrchr(buf, '/');
|
||||
if (!base)
|
||||
base = strrchr(buf, '\\');
|
||||
|
||||
if (base)
|
||||
*base = '\0';
|
||||
else
|
||||
{
|
||||
config_file_t * conf = config_file_new(conf_name);
|
||||
|
||||
// g_settings
|
||||
|
||||
#ifdef HAVE_LIBRETRO_MANAGEMENT
|
||||
if(find_libretro_path)
|
||||
{
|
||||
CONFIG_GET_STRING(libretro, "libretro_path");
|
||||
|
||||
if(strcmp(g_settings.libretro, "") == 0)
|
||||
{
|
||||
char first_file[PATH_MAX];
|
||||
rarch_manage_libretro_set_first_file(first_file, sizeof(first_file), libretro_dir_path, exe_ext);
|
||||
if(first_file != NULL)
|
||||
strlcpy(g_settings.libretro, first_file, sizeof(g_settings.libretro));
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
CONFIG_GET_STRING(system_directory, "system_directory");
|
||||
CONFIG_GET_STRING(cheat_database, "cheat_database");
|
||||
CONFIG_GET_BOOL(rewind_enable, "rewind_enable");
|
||||
CONFIG_GET_STRING(video.cg_shader_path, "video_cg_shader");
|
||||
#ifdef HAVE_FBO
|
||||
CONFIG_GET_STRING(video.second_pass_shader, "video_second_pass_shader");
|
||||
CONFIG_GET_FLOAT(video.fbo_scale_x, "video_fbo_scale_x");
|
||||
CONFIG_GET_FLOAT(video.fbo_scale_y, "video_fbo_scale_y");
|
||||
CONFIG_GET_BOOL(video.render_to_texture, "video_render_to_texture");
|
||||
CONFIG_GET_BOOL(video.second_pass_smooth, "video_second_pass_smooth");
|
||||
#endif
|
||||
#ifdef _XBOX360
|
||||
CONFIG_GET_BOOL_CONSOLE(gamma_correction_enable, "gamma_correction_enable");
|
||||
CONFIG_GET_INT_CONSOLE(color_format, "color_format");
|
||||
#endif
|
||||
CONFIG_GET_BOOL(video.smooth, "video_smooth");
|
||||
CONFIG_GET_BOOL(video.vsync, "video_vsync");
|
||||
CONFIG_GET_FLOAT(video.aspect_ratio, "video_aspect_ratio");
|
||||
CONFIG_GET_STRING(audio.device, "audio_device");
|
||||
|
||||
for (unsigned i = 0; i < 7; i++)
|
||||
{
|
||||
char cfg[64];
|
||||
snprintf(cfg, sizeof(cfg), "input_dpad_emulation_p%u", i + 1);
|
||||
CONFIG_GET_INT(input.dpad_emulation[i], cfg);
|
||||
}
|
||||
|
||||
// g_console
|
||||
|
||||
#ifdef HAVE_FBO
|
||||
CONFIG_GET_BOOL_CONSOLE(fbo_enabled, "fbo_enabled");
|
||||
#endif
|
||||
#ifdef __CELLOS_LV2__
|
||||
CONFIG_GET_BOOL_CONSOLE(custom_bgm_enable, "custom_bgm_enable");
|
||||
#endif
|
||||
CONFIG_GET_BOOL_CONSOLE(overscan_enable, "overscan_enable");
|
||||
CONFIG_GET_BOOL_CONSOLE(screenshots_enable, "screenshots_enable");
|
||||
CONFIG_GET_BOOL_CONSOLE(throttle_enable, "throttle_enable");
|
||||
CONFIG_GET_BOOL_CONSOLE(triple_buffering_enable, "triple_buffering_enable");
|
||||
CONFIG_GET_BOOL_CONSOLE(info_msg_enable, "info_msg_enable");
|
||||
CONFIG_GET_INT_CONSOLE(aspect_ratio_index, "aspect_ratio_index");
|
||||
CONFIG_GET_INT_CONSOLE(current_resolution_id, "current_resolution_id");
|
||||
CONFIG_GET_INT_CONSOLE(viewports.custom_vp.x, "custom_viewport_x");
|
||||
CONFIG_GET_INT_CONSOLE(viewports.custom_vp.y, "custom_viewport_y");
|
||||
CONFIG_GET_INT_CONSOLE(viewports.custom_vp.width, "custom_viewport_width");
|
||||
CONFIG_GET_INT_CONSOLE(viewports.custom_vp.height, "custom_viewport_height");
|
||||
CONFIG_GET_INT_CONSOLE(screen_orientation, "screen_orientation");
|
||||
CONFIG_GET_INT_CONSOLE(sound_mode, "sound_mode");
|
||||
CONFIG_GET_STRING_CONSOLE(default_rom_startup_dir, "default_rom_startup_dir");
|
||||
CONFIG_GET_FLOAT_CONSOLE(menu_font_size, "menu_font_size");
|
||||
CONFIG_GET_FLOAT_CONSOLE(overscan_amount, "overscan_amount");
|
||||
|
||||
// g_extern
|
||||
CONFIG_GET_INT_EXTERN(state_slot, "state_slot");
|
||||
CONFIG_GET_INT_EXTERN(audio_data.mute, "audio_mute");
|
||||
}
|
||||
buf[0] = '\0';
|
||||
}
|
||||
|
||||
void rarch_config_save(const char * conf_name)
|
||||
{
|
||||
if(!path_file_exists(conf_name))
|
||||
rarch_config_create_default(conf_name);
|
||||
else
|
||||
{
|
||||
config_file_t * conf = config_file_new(conf_name);
|
||||
|
||||
if(conf == NULL)
|
||||
conf = config_file_new(NULL);
|
||||
|
||||
// g_settings
|
||||
config_set_string(conf, "libretro_path", g_settings.libretro);
|
||||
#ifdef HAVE_XML
|
||||
config_set_string(conf, "cheat_database_path", g_settings.cheat_database);
|
||||
#endif
|
||||
config_set_bool(conf, "rewind_enable", g_settings.rewind_enable);
|
||||
config_set_string(conf, "video_cg_shader", g_settings.video.cg_shader_path);
|
||||
config_set_float(conf, "video_aspect_ratio", g_settings.video.aspect_ratio);
|
||||
#ifdef HAVE_FBO
|
||||
config_set_float(conf, "video_fbo_scale_x", g_settings.video.fbo_scale_x);
|
||||
config_set_float(conf, "video_fbo_scale_y", g_settings.video.fbo_scale_y);
|
||||
config_set_string(conf, "video_second_pass_shader", g_settings.video.second_pass_shader);
|
||||
config_set_bool(conf, "video_render_to_texture", g_settings.video.render_to_texture);
|
||||
config_set_bool(conf, "video_second_pass_smooth", g_settings.video.second_pass_smooth);
|
||||
#endif
|
||||
config_set_bool(conf, "video_smooth", g_settings.video.smooth);
|
||||
config_set_bool(conf, "video_vsync", g_settings.video.vsync);
|
||||
config_set_string(conf, "audio_device", g_settings.audio.device);
|
||||
|
||||
for (unsigned i = 0; i < 7; i++)
|
||||
{
|
||||
char cfg[64];
|
||||
snprintf(cfg, sizeof(cfg), "input_dpad_emulation_p%u", i + 1);
|
||||
config_set_int(conf, cfg, g_settings.input.dpad_emulation[i]);
|
||||
}
|
||||
|
||||
#ifdef RARCH_CONSOLE
|
||||
config_set_bool(conf, "fbo_enabled", g_console.fbo_enabled);
|
||||
#ifdef __CELLOS_LV2__
|
||||
config_set_bool(conf, "custom_bgm_enable", g_console.custom_bgm_enable);
|
||||
#endif
|
||||
config_set_bool(conf, "overscan_enable", g_console.overscan_enable);
|
||||
config_set_bool(conf, "screenshots_enable", g_console.screenshots_enable);
|
||||
#ifdef _XBOX
|
||||
config_set_bool(conf, "gamma_correction_enable", g_console.gamma_correction_enable);
|
||||
config_set_int(conf, "color_format", g_console.color_format);
|
||||
#endif
|
||||
config_set_bool(conf, "throttle_enable", g_console.throttle_enable);
|
||||
config_set_bool(conf, "triple_buffering_enable", g_console.triple_buffering_enable);
|
||||
config_set_bool(conf, "info_msg_enable", g_console.info_msg_enable);
|
||||
config_set_int(conf, "sound_mode", g_console.sound_mode);
|
||||
config_set_int(conf, "aspect_ratio_index", g_console.aspect_ratio_index);
|
||||
config_set_int(conf, "current_resolution_id", g_console.current_resolution_id);
|
||||
config_set_int(conf, "custom_viewport_width", g_console.viewports.custom_vp.width);
|
||||
config_set_int(conf, "custom_viewport_height", g_console.viewports.custom_vp.height);
|
||||
config_set_int(conf, "custom_viewport_x", g_console.viewports.custom_vp.x);
|
||||
config_set_int(conf, "custom_viewport_y", g_console.viewports.custom_vp.y);
|
||||
config_set_int(conf, "screen_orientation", g_console.screen_orientation);
|
||||
config_set_string(conf, "default_rom_startup_dir", g_console.default_rom_startup_dir);
|
||||
config_set_float(conf, "menu_font_size", g_console.menu_font_size);
|
||||
config_set_float(conf, "overscan_amount", g_console.overscan_amount);
|
||||
#endif
|
||||
|
||||
// g_extern
|
||||
config_set_int(conf, "state_slot", g_extern.state_slot);
|
||||
config_set_int(conf, "audio_mute", g_extern.audio_data.mute);
|
||||
|
||||
if (!config_file_write(conf, conf_name))
|
||||
RARCH_ERR("Failed to write config file to \"%s\". Check permissions.\n", conf_name);
|
||||
|
||||
free(conf);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
@ -114,12 +114,6 @@ extern struct aspect_ratio_elem aspectratio_lut[ASPECT_RATIO_END];
|
||||
extern void rarch_set_auto_viewport(unsigned width, unsigned height);
|
||||
extern void rarch_load_shader(unsigned slot, const char *path);
|
||||
|
||||
#include "retroarch_console_input.h"
|
||||
|
||||
/*============================================================
|
||||
SOUND
|
||||
============================================================ */
|
||||
|
||||
enum
|
||||
{
|
||||
SOUND_MODE_NORMAL,
|
||||
@ -131,14 +125,14 @@ enum
|
||||
#endif
|
||||
};
|
||||
|
||||
/*============================================================
|
||||
ROM EXTENSIONS
|
||||
============================================================ */
|
||||
typedef struct
|
||||
{
|
||||
char menu_border_file[PATH_MAX];
|
||||
char border_file[PATH_MAX];
|
||||
char border_dir[PATH_MAX];
|
||||
#ifdef HAVE_HDD_CACHE_PARTITION
|
||||
char cache_dir[PATH_MAX];
|
||||
#endif
|
||||
char cgp_dir[PATH_MAX];
|
||||
char config_file[PATH_MAX];
|
||||
char core_dir[PATH_MAX];
|
||||
@ -161,40 +155,6 @@ typedef struct
|
||||
|
||||
extern default_paths_t default_paths;
|
||||
|
||||
void rarch_console_load_game(const char *path);
|
||||
|
||||
// Get rom extensions for current library.
|
||||
// Returns NULL if library doesn't have any preferences in particular.
|
||||
const char *rarch_console_get_rom_ext(void);
|
||||
|
||||
// Transforms a library id to a name suitable as a pathname.
|
||||
void rarch_console_name_from_id(char *name, size_t size);
|
||||
|
||||
#ifdef HAVE_ZLIB
|
||||
int rarch_extract_zipfile(const char *zip_path);
|
||||
#endif
|
||||
|
||||
/*============================================================
|
||||
INPUT EXTENSIONS
|
||||
============================================================ */
|
||||
|
||||
#ifdef HAVE_DEFAULT_RETROPAD_INPUT
|
||||
const char *rarch_input_find_platform_key_label(uint64_t joykey);
|
||||
uint64_t rarch_input_find_previous_platform_key(uint64_t joykey);
|
||||
uint64_t rarch_input_find_next_platform_key(uint64_t joykey);
|
||||
|
||||
// Sets custom default keybind names (some systems emulated by the emulator
|
||||
// will need different keybind names for buttons, etc.)
|
||||
void rarch_input_set_default_keybind_names_for_emulator(void);
|
||||
void rarch_input_set_default_keybinds(unsigned player);
|
||||
|
||||
void rarch_input_set_keybind(unsigned player, unsigned keybind_action, uint64_t default_retro_joypad_id);
|
||||
|
||||
void rarch_input_set_controls_default (void);
|
||||
const char *rarch_input_get_default_keybind_name (unsigned id);
|
||||
#endif
|
||||
|
||||
|
||||
/*============================================================
|
||||
RetroArch
|
||||
============================================================ */
|
||||
@ -249,16 +209,13 @@ void rarch_console_rsound_stop(void);
|
||||
|
||||
void rarch_convert_char_to_wchar(wchar_t *buf, const char * str, size_t size);
|
||||
const char * rarch_convert_wchar_to_const_char(const wchar_t * wstr);
|
||||
void rarch_extract_directory(char *buf, const char *path, size_t size);
|
||||
|
||||
enum
|
||||
{
|
||||
CONFIG_FILE,
|
||||
SHADER_PRESET_FILE,
|
||||
INPUT_PRESET_FILE
|
||||
MODE_EMULATION = 0,
|
||||
MODE_MENU,
|
||||
MODE_EXIT
|
||||
};
|
||||
|
||||
void rarch_config_create_default(const char * conf_name);
|
||||
void rarch_config_load(const char * conf_name, const char * libretro_dir_path, const char * exe_ext, bool find_libretro_path);
|
||||
void rarch_config_save(const char * conf_name);
|
||||
|
||||
#endif
|
||||
|
182
console/retroarch_console_input.c
Normal file
182
console/retroarch_console_input.c
Normal file
@ -0,0 +1,182 @@
|
||||
/* 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/>.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <stddef.h>
|
||||
#include <string.h>
|
||||
#include "../boolean.h"
|
||||
#include "retroarch_console_input.h"
|
||||
|
||||
struct platform_bind
|
||||
{
|
||||
uint64_t joykey;
|
||||
const char *label;
|
||||
};
|
||||
|
||||
uint64_t rarch_default_keybind_lut[RARCH_FIRST_META_KEY];
|
||||
|
||||
char rarch_default_libretro_keybind_name_lut[RARCH_FIRST_META_KEY][256] = {
|
||||
"RetroPad Button B", /* RETRO_DEVICE_ID_JOYPAD_B */
|
||||
"RetroPad Button Y", /* RETRO_DEVICE_ID_JOYPAD_Y */
|
||||
"RetroPad Button Select", /* RETRO_DEVICE_ID_JOYPAD_SELECT */
|
||||
"RetroPad Button Start", /* RETRO_DEVICE_ID_JOYPAD_START */
|
||||
"RetroPad D-Pad Up", /* RETRO_DEVICE_ID_JOYPAD_UP */
|
||||
"RetroPad D-Pad Down", /* RETRO_DEVICE_ID_JOYPAD_DOWN */
|
||||
"RetroPad D-Pad Left", /* RETRO_DEVICE_ID_JOYPAD_LEFT */
|
||||
"RetroPad D-Pad Right", /* RETRO_DEVICE_ID_JOYPAD_RIGHT */
|
||||
"RetroPad Button A", /* RETRO_DEVICE_ID_JOYPAD_A */
|
||||
"RetroPad Button X", /* RETRO_DEVICE_ID_JOYPAD_X */
|
||||
"RetroPad Button L1", /* RETRO_DEVICE_ID_JOYPAD_L */
|
||||
"RetroPad Button R1", /* RETRO_DEVICE_ID_JOYPAD_R */
|
||||
"RetroPad Button L2", /* RETRO_DEVICE_ID_JOYPAD_L2 */
|
||||
"RetroPad Button R2", /* RETRO_DEVICE_ID_JOYPAD_R2 */
|
||||
"RetroPad Button L3", /* RETRO_DEVICE_ID_JOYPAD_L3 */
|
||||
"RetroPad Button R3", /* RETRO_DEVICE_ID_JOYPAD_R3 */
|
||||
};
|
||||
|
||||
#ifdef HAVE_DEFAULT_RETROPAD_INPUT
|
||||
|
||||
extern const struct platform_bind platform_keys[];
|
||||
extern const unsigned int platform_keys_size;
|
||||
|
||||
uint64_t rarch_input_find_previous_platform_key(uint64_t joykey)
|
||||
{
|
||||
size_t arr_size = platform_keys_size / sizeof(platform_keys[0]);
|
||||
|
||||
if (platform_keys[0].joykey == joykey)
|
||||
return joykey;
|
||||
|
||||
for (size_t i = 1; i < arr_size; i++)
|
||||
{
|
||||
if (platform_keys[i].joykey == joykey)
|
||||
return platform_keys[i - 1].joykey;
|
||||
}
|
||||
|
||||
return NO_BTN;
|
||||
}
|
||||
|
||||
uint64_t rarch_input_find_next_platform_key(uint64_t joykey)
|
||||
{
|
||||
size_t arr_size = platform_keys_size / sizeof(platform_keys[0]);
|
||||
|
||||
if (platform_keys[arr_size - 1].joykey == joykey)
|
||||
return joykey;
|
||||
|
||||
for (size_t i = 0; i < arr_size - 1; i++)
|
||||
{
|
||||
if (platform_keys[i].joykey == joykey)
|
||||
return platform_keys[i + 1].joykey;
|
||||
}
|
||||
|
||||
return NO_BTN;
|
||||
}
|
||||
|
||||
const char *rarch_input_find_platform_key_label(uint64_t joykey)
|
||||
{
|
||||
if (joykey == NO_BTN)
|
||||
return "No button";
|
||||
|
||||
size_t arr_size = platform_keys_size / sizeof(platform_keys[0]);
|
||||
for (size_t i = 0; i < arr_size; i++)
|
||||
{
|
||||
if (platform_keys[i].joykey == joykey)
|
||||
return platform_keys[i].label;
|
||||
}
|
||||
|
||||
return "Unknown";
|
||||
}
|
||||
|
||||
|
||||
void rarch_input_set_keybind(unsigned player, unsigned keybind_action, uint64_t default_retro_joypad_id)
|
||||
{
|
||||
uint64_t *key = &g_settings.input.binds[player][default_retro_joypad_id].joykey;
|
||||
|
||||
switch (keybind_action)
|
||||
{
|
||||
case KEYBIND_DECREMENT:
|
||||
*key = rarch_input_find_previous_platform_key(*key);
|
||||
break;
|
||||
|
||||
case KEYBIND_INCREMENT:
|
||||
*key = rarch_input_find_next_platform_key(*key);
|
||||
break;
|
||||
|
||||
case KEYBIND_DEFAULT:
|
||||
*key = rarch_default_keybind_lut[default_retro_joypad_id];
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void rarch_input_set_default_keybinds(unsigned player)
|
||||
{
|
||||
for (unsigned i = 0; i < RARCH_FIRST_META_KEY; i++)
|
||||
{
|
||||
g_settings.input.binds[player][i].id = i;
|
||||
g_settings.input.binds[player][i].joykey = rarch_default_keybind_lut[i];
|
||||
}
|
||||
g_settings.input.dpad_emulation[player] = DPAD_EMULATION_LSTICK;
|
||||
}
|
||||
|
||||
void rarch_input_set_controls_default (const input_driver_t *input)
|
||||
{
|
||||
input->set_default_keybind_lut();
|
||||
|
||||
for(uint32_t x = 0; x < MAX_PLAYERS; x++)
|
||||
rarch_input_set_default_keybinds(x);
|
||||
}
|
||||
|
||||
const char *rarch_input_get_default_keybind_name(unsigned id)
|
||||
{
|
||||
return rarch_default_libretro_keybind_name_lut[id];
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
/* TODO: Hackish, try to do this in a cleaner, more extensible and less hardcoded way */
|
||||
|
||||
void rarch_input_set_default_keybind_names_for_emulator(void)
|
||||
{
|
||||
struct retro_system_info info;
|
||||
#ifdef ANDROID
|
||||
pretro_get_system_info(&info);
|
||||
#else
|
||||
retro_get_system_info(&info);
|
||||
#endif
|
||||
const char *id = info.library_name ? info.library_name : "Unknown";
|
||||
|
||||
// Genesis Plus GX/Next
|
||||
if (strstr(id, "Genesis Plus GX"))
|
||||
{
|
||||
strlcpy(rarch_default_libretro_keybind_name_lut[RETRO_DEVICE_ID_JOYPAD_B],
|
||||
"B button", sizeof(rarch_default_libretro_keybind_name_lut[RETRO_DEVICE_ID_JOYPAD_B]));
|
||||
strlcpy(rarch_default_libretro_keybind_name_lut[RETRO_DEVICE_ID_JOYPAD_A],
|
||||
"C button", sizeof(rarch_default_libretro_keybind_name_lut[RETRO_DEVICE_ID_JOYPAD_A]));
|
||||
strlcpy(rarch_default_libretro_keybind_name_lut[RETRO_DEVICE_ID_JOYPAD_X],
|
||||
"Y button", sizeof(rarch_default_libretro_keybind_name_lut[RETRO_DEVICE_ID_JOYPAD_X]));
|
||||
strlcpy(rarch_default_libretro_keybind_name_lut[RETRO_DEVICE_ID_JOYPAD_Y],
|
||||
"A button", sizeof(rarch_default_libretro_keybind_name_lut[RETRO_DEVICE_ID_JOYPAD_Y]));
|
||||
strlcpy(rarch_default_libretro_keybind_name_lut[RETRO_DEVICE_ID_JOYPAD_L],
|
||||
"X button", sizeof(rarch_default_libretro_keybind_name_lut[RETRO_DEVICE_ID_JOYPAD_L]));
|
||||
strlcpy(rarch_default_libretro_keybind_name_lut[RETRO_DEVICE_ID_JOYPAD_R],
|
||||
"Z button", sizeof(rarch_default_libretro_keybind_name_lut[RETRO_DEVICE_ID_JOYPAD_R]));
|
||||
strlcpy(rarch_default_libretro_keybind_name_lut[RETRO_DEVICE_ID_JOYPAD_SELECT],
|
||||
"Mode button", sizeof(rarch_default_libretro_keybind_name_lut[RETRO_DEVICE_ID_JOYPAD_SELECT]));
|
||||
}
|
||||
}
|
@ -27,13 +27,6 @@ enum keybind_set_id
|
||||
KEYBIND_DEFAULT
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
MODE_EMULATION = 0,
|
||||
MODE_MENU,
|
||||
MODE_EXIT
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
DPAD_EMULATION_NONE = 0,
|
||||
@ -41,101 +34,23 @@ enum
|
||||
DPAD_EMULATION_RSTICK
|
||||
};
|
||||
|
||||
#ifdef _XBOX360
|
||||
#include "../360/xinput_360_input.h"
|
||||
#endif
|
||||
|
||||
#if defined(__CELLOS_LV2__)
|
||||
#include "../ps3/ps3_input.h"
|
||||
enum ps3_device_id
|
||||
{
|
||||
PS3_DEVICE_ID_JOYPAD_CIRCLE = 0,
|
||||
PS3_DEVICE_ID_JOYPAD_CROSS,
|
||||
PS3_DEVICE_ID_JOYPAD_TRIANGLE,
|
||||
PS3_DEVICE_ID_JOYPAD_SQUARE,
|
||||
PS3_DEVICE_ID_JOYPAD_UP,
|
||||
PS3_DEVICE_ID_JOYPAD_DOWN,
|
||||
PS3_DEVICE_ID_JOYPAD_LEFT,
|
||||
PS3_DEVICE_ID_JOYPAD_RIGHT,
|
||||
PS3_DEVICE_ID_JOYPAD_SELECT,
|
||||
PS3_DEVICE_ID_JOYPAD_START,
|
||||
PS3_DEVICE_ID_JOYPAD_L1,
|
||||
PS3_DEVICE_ID_JOYPAD_L2,
|
||||
PS3_DEVICE_ID_JOYPAD_L3,
|
||||
PS3_DEVICE_ID_JOYPAD_R1,
|
||||
PS3_DEVICE_ID_JOYPAD_R2,
|
||||
PS3_DEVICE_ID_JOYPAD_R3,
|
||||
PS3_DEVICE_ID_LSTICK_LEFT,
|
||||
PS3_DEVICE_ID_LSTICK_RIGHT,
|
||||
PS3_DEVICE_ID_LSTICK_UP,
|
||||
PS3_DEVICE_ID_LSTICK_DOWN,
|
||||
PS3_DEVICE_ID_LSTICK_LEFT_DPAD,
|
||||
PS3_DEVICE_ID_LSTICK_RIGHT_DPAD,
|
||||
PS3_DEVICE_ID_LSTICK_UP_DPAD,
|
||||
PS3_DEVICE_ID_LSTICK_DOWN_DPAD,
|
||||
PS3_DEVICE_ID_RSTICK_LEFT,
|
||||
PS3_DEVICE_ID_RSTICK_RIGHT,
|
||||
PS3_DEVICE_ID_RSTICK_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
|
||||
};
|
||||
|
||||
#elif defined(_XBOX)
|
||||
|
||||
enum xdk_device_id
|
||||
{
|
||||
XDK_DEVICE_ID_JOYPAD_B = 0,
|
||||
XDK_DEVICE_ID_JOYPAD_A,
|
||||
XDK_DEVICE_ID_JOYPAD_Y,
|
||||
XDK_DEVICE_ID_JOYPAD_X,
|
||||
XDK_DEVICE_ID_JOYPAD_UP,
|
||||
XDK_DEVICE_ID_JOYPAD_DOWN,
|
||||
XDK_DEVICE_ID_JOYPAD_LEFT,
|
||||
XDK_DEVICE_ID_JOYPAD_RIGHT,
|
||||
XDK_DEVICE_ID_JOYPAD_BACK,
|
||||
XDK_DEVICE_ID_JOYPAD_START,
|
||||
XDK_DEVICE_ID_JOYPAD_LB,
|
||||
XDK_DEVICE_ID_JOYPAD_LEFT_TRIGGER,
|
||||
XDK_DEVICE_ID_LSTICK_THUMB,
|
||||
XDK_DEVICE_ID_JOYPAD_RB,
|
||||
XDK_DEVICE_ID_JOYPAD_RIGHT_TRIGGER,
|
||||
XDK_DEVICE_ID_RSTICK_THUMB,
|
||||
XDK_DEVICE_ID_LSTICK_LEFT,
|
||||
XDK_DEVICE_ID_LSTICK_RIGHT,
|
||||
XDK_DEVICE_ID_LSTICK_UP,
|
||||
XDK_DEVICE_ID_LSTICK_DOWN,
|
||||
XDK_DEVICE_ID_LSTICK_LEFT_DPAD,
|
||||
XDK_DEVICE_ID_LSTICK_RIGHT_DPAD,
|
||||
XDK_DEVICE_ID_LSTICK_UP_DPAD,
|
||||
XDK_DEVICE_ID_LSTICK_DOWN_DPAD,
|
||||
XDK_DEVICE_ID_RSTICK_LEFT,
|
||||
XDK_DEVICE_ID_RSTICK_RIGHT,
|
||||
XDK_DEVICE_ID_RSTICK_UP,
|
||||
XDK_DEVICE_ID_RSTICK_DOWN,
|
||||
XDK_DEVICE_ID_RSTICK_LEFT_DPAD,
|
||||
XDK_DEVICE_ID_RSTICK_RIGHT_DPAD,
|
||||
XDK_DEVICE_ID_RSTICK_UP_DPAD,
|
||||
XDK_DEVICE_ID_RSTICK_DOWN_DPAD,
|
||||
|
||||
RARCH_LAST_PLATFORM_KEY
|
||||
};
|
||||
|
||||
#ifdef _XBOX1
|
||||
#include "../xbox1/xinput_xbox_input.h"
|
||||
#endif
|
||||
#elif defined(GEKKO)
|
||||
#include <ogc/pad.h>
|
||||
#ifdef HW_RVL
|
||||
#include <wiiuse/wpad.h>
|
||||
#endif
|
||||
#endif
|
||||
|
||||
extern uint64_t rarch_default_keybind_lut[RARCH_FIRST_META_KEY];
|
||||
extern char rarch_default_libretro_keybind_name_lut[RARCH_FIRST_META_KEY][256];
|
||||
|
||||
#ifdef HAVE_DEFAULT_RETROPAD_INPUT
|
||||
const char *rarch_input_find_platform_key_label(uint64_t joykey);
|
||||
uint64_t rarch_input_find_previous_platform_key(uint64_t joykey);
|
||||
uint64_t rarch_input_find_next_platform_key(uint64_t joykey);
|
||||
|
||||
// Sets custom default keybind names (some systems emulated by the emulator
|
||||
// will need different keybind names for buttons, etc.)
|
||||
void rarch_input_set_default_keybind_names_for_emulator(void);
|
||||
void rarch_input_set_default_keybinds(unsigned player);
|
||||
|
||||
void rarch_input_set_keybind(unsigned player, unsigned keybind_action, uint64_t default_retro_joypad_id);
|
||||
|
||||
void rarch_input_set_controls_default (const input_driver_t *input);
|
||||
const char *rarch_input_get_default_keybind_name (unsigned id);
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
139
console/retroarch_rom_ext.c
Normal file
139
console/retroarch_rom_ext.c
Normal file
@ -0,0 +1,139 @@
|
||||
/* 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/>.
|
||||
*/
|
||||
|
||||
#include <stdint.h>
|
||||
#include <ctype.h>
|
||||
|
||||
#ifdef _WIN32
|
||||
#include "../compat/posix_string.h"
|
||||
#endif
|
||||
|
||||
#include "../general.h"
|
||||
#include "../file.h"
|
||||
|
||||
#include "console_settings.h"
|
||||
#include "retroarch_console.h"
|
||||
#include "retroarch_rom_ext.h"
|
||||
|
||||
#ifdef HAVE_ZLIB
|
||||
#include "retroarch_rzlib.h"
|
||||
#endif
|
||||
|
||||
static void rarch_console_load_game(const char *path)
|
||||
{
|
||||
snprintf(g_console.rom_path, sizeof(g_console.rom_path), path);
|
||||
rarch_settings_change(S_START_RARCH);
|
||||
}
|
||||
|
||||
void rarch_console_load_game_wrap(const char *path, unsigned delay)
|
||||
{
|
||||
const char *game_to_load;
|
||||
char first_file[PATH_MAX];
|
||||
char rom_path_temp[PATH_MAX];
|
||||
char dir_path_temp[PATH_MAX];
|
||||
struct retro_system_info info;
|
||||
bool block_zip_extract = false;
|
||||
|
||||
retro_get_system_info(&info);
|
||||
block_zip_extract = info.block_extract;
|
||||
|
||||
snprintf(rom_path_temp, sizeof(rom_path_temp), path);
|
||||
|
||||
#ifdef HAVE_ZLIB
|
||||
bool extract_zip_cond = (strstr(rom_path_temp, ".zip") || strstr(rom_path_temp, ".ZIP"))
|
||||
&& !block_zip_extract;
|
||||
bool extract_zip_and_load_game_cond = (extract_zip_cond &&
|
||||
g_console.zip_extract_mode == ZIP_EXTRACT_TO_CURRENT_DIR_AND_LOAD_FIRST_FILE && first_file);
|
||||
bool load_game = (extract_zip_and_load_game_cond) || (!extract_zip_cond);
|
||||
#else
|
||||
bool extract_zip_cond = false;
|
||||
bool extract_zip_and_load_game_cond = false;
|
||||
bool load_game = !extract_zip_cond;
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_ZLIB
|
||||
if(extract_zip_cond)
|
||||
{
|
||||
rarch_extract_directory(dir_path_temp, rom_path_temp, sizeof(dir_path_temp));
|
||||
rarch_extract_zipfile(rom_path_temp, dir_path_temp, first_file, sizeof(first_file));
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_ZLIB
|
||||
if(extract_zip_and_load_game_cond)
|
||||
game_to_load = first_file;
|
||||
else
|
||||
#endif
|
||||
game_to_load = path;
|
||||
|
||||
if(load_game)
|
||||
{
|
||||
rarch_console_load_game(game_to_load);
|
||||
|
||||
if (g_console.info_msg_enable)
|
||||
rarch_settings_msg(S_MSG_LOADING_ROM, delay);
|
||||
}
|
||||
}
|
||||
|
||||
const char *rarch_console_get_rom_ext(void)
|
||||
{
|
||||
const char *retval = NULL;
|
||||
|
||||
struct retro_system_info info;
|
||||
#ifdef ANDROID
|
||||
pretro_get_system_info(&info);
|
||||
#else
|
||||
retro_get_system_info(&info);
|
||||
#endif
|
||||
|
||||
if (info.valid_extensions)
|
||||
retval = info.valid_extensions;
|
||||
else
|
||||
retval = "ZIP|zip";
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
void rarch_console_name_from_id(char *name, size_t size)
|
||||
{
|
||||
if (size == 0)
|
||||
return;
|
||||
|
||||
struct retro_system_info info;
|
||||
#ifdef ANDROID
|
||||
pretro_get_system_info(&info);
|
||||
#else
|
||||
retro_get_system_info(&info);
|
||||
#endif
|
||||
const char *id = info.library_name ? info.library_name : "Unknown";
|
||||
|
||||
if (!id || strlen(id) >= size)
|
||||
{
|
||||
name[0] = '\0';
|
||||
return;
|
||||
}
|
||||
|
||||
name[strlen(id)] = '\0';
|
||||
|
||||
for (size_t i = 0; id[i] != '\0'; i++)
|
||||
{
|
||||
char c = id[i];
|
||||
if (isspace(c) || isblank(c))
|
||||
name[i] = '_';
|
||||
else
|
||||
name[i] = tolower(c);
|
||||
}
|
||||
}
|
29
console/retroarch_rom_ext.h
Normal file
29
console/retroarch_rom_ext.h
Normal file
@ -0,0 +1,29 @@
|
||||
/* 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 RARCH_ROM_EXT_H__
|
||||
#define RARCH_ROM_EXT_H__
|
||||
|
||||
void rarch_console_load_game_wrap(const char *path, unsigned delay);
|
||||
|
||||
// Get rom extensions for current library.
|
||||
// Returns NULL if library doesn't have any preferences in particular.
|
||||
const char *rarch_console_get_rom_ext(void);
|
||||
|
||||
// Transforms a library id to a name suitable as a pathname.
|
||||
void rarch_console_name_from_id(char *name, size_t size);
|
||||
|
||||
#endif
|
165
console/retroarch_rzlib.c
Normal file
165
console/retroarch_rzlib.c
Normal file
@ -0,0 +1,165 @@
|
||||
/* 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/>.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <stddef.h>
|
||||
#include <string.h>
|
||||
#include "../boolean.h"
|
||||
|
||||
#include "retroarch_rzlib.h"
|
||||
|
||||
static int rarch_extract_currentfile_in_zip(unzFile uf, const char *current_dir, char *slash, char *write_filename, size_t write_filename_size)
|
||||
{
|
||||
char filename_inzip[PATH_MAX];
|
||||
FILE *file_out = NULL;
|
||||
|
||||
unz_file_info file_info;
|
||||
int err = unzGetCurrentFileInfo(uf,
|
||||
&file_info, filename_inzip, sizeof(filename_inzip),
|
||||
NULL, 0, NULL, 0);
|
||||
|
||||
if (err != UNZ_OK)
|
||||
{
|
||||
RARCH_ERR("Error %d while trying to get ZIP file information.\n", err);
|
||||
return err;
|
||||
}
|
||||
|
||||
size_t size_buf = WRITEBUFFERSIZE;
|
||||
void *buf = malloc(size_buf);
|
||||
if (!buf)
|
||||
{
|
||||
RARCH_ERR("Error allocating memory for ZIP extract operation.\n");
|
||||
return UNZ_INTERNALERROR;
|
||||
}
|
||||
|
||||
switch(g_console.zip_extract_mode)
|
||||
{
|
||||
case ZIP_EXTRACT_TO_CURRENT_DIR:
|
||||
case ZIP_EXTRACT_TO_CURRENT_DIR_AND_LOAD_FIRST_FILE:
|
||||
snprintf(write_filename, write_filename_size, "%s%s%s", current_dir, slash, filename_inzip);
|
||||
break;
|
||||
#ifdef HAVE_HDD_CACHE_PARTITION
|
||||
case ZIP_EXTRACT_TO_CACHE_DIR:
|
||||
snprintf(write_filename, write_filename_size, "%s%s", default_paths.cache_dir, filename_inzip);
|
||||
break;
|
||||
#endif
|
||||
}
|
||||
|
||||
err = unzOpenCurrentFile(uf);
|
||||
if (err != UNZ_OK)
|
||||
RARCH_ERR("Error %d while trying to open ZIP file.\n", err);
|
||||
else
|
||||
{
|
||||
/* success */
|
||||
file_out = fopen(write_filename, "wb");
|
||||
|
||||
if (!file_out)
|
||||
RARCH_ERR("Error opening %s.\n", write_filename);
|
||||
}
|
||||
|
||||
if (file_out)
|
||||
{
|
||||
RARCH_LOG("Extracting: %s..\n", write_filename);
|
||||
|
||||
do
|
||||
{
|
||||
err = unzReadCurrentFile(uf, buf, size_buf);
|
||||
if (err < 0)
|
||||
{
|
||||
RARCH_ERR("Error %d while reading from ZIP file.\n", err);
|
||||
break;
|
||||
}
|
||||
|
||||
if (err > 0)
|
||||
{
|
||||
if (fwrite(buf, err, 1, file_out) != 1)
|
||||
{
|
||||
RARCH_ERR("Error while extracting file(s) from ZIP.\n");
|
||||
err = UNZ_ERRNO;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}while (err > 0);
|
||||
|
||||
if (file_out)
|
||||
fclose(file_out);
|
||||
}
|
||||
|
||||
if (err == UNZ_OK)
|
||||
{
|
||||
err = unzCloseCurrentFile (uf);
|
||||
if (err != UNZ_OK)
|
||||
RARCH_ERR("Error %d while trying to close ZIP file.\n", err);
|
||||
}
|
||||
else
|
||||
unzCloseCurrentFile(uf);
|
||||
|
||||
free(buf);
|
||||
return err;
|
||||
}
|
||||
|
||||
int rarch_extract_zipfile(const char *zip_path, const char *current_dir, char *first_file, size_t first_file_size)
|
||||
{
|
||||
bool found_first_file = false;
|
||||
unzFile uf = unzOpen(zip_path);
|
||||
|
||||
unz_global_info gi;
|
||||
int err = unzGetGlobalInfo(uf, &gi);
|
||||
if (err != UNZ_OK)
|
||||
RARCH_ERR("Error %d while trying to get ZIP file global info.\n",err);
|
||||
|
||||
for (unsigned i = 0; i < gi.number_entry; i++)
|
||||
{
|
||||
static char write_filename[PATH_MAX];
|
||||
char slash[6];
|
||||
#ifdef _XBOX
|
||||
snprintf(slash, sizeof(slash), "\\");
|
||||
#else
|
||||
snprintf(slash, sizeof(slash), "/");
|
||||
#endif
|
||||
if (rarch_extract_currentfile_in_zip(uf, current_dir, slash, write_filename, sizeof(write_filename)) != UNZ_OK)
|
||||
{
|
||||
RARCH_ERR("Failed to extract current file from ZIP archive.\n");
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
if(!found_first_file)
|
||||
{
|
||||
found_first_file = rarch_manage_libretro_extension_supported(write_filename);
|
||||
|
||||
if(found_first_file)
|
||||
snprintf(first_file, first_file_size, write_filename);
|
||||
}
|
||||
}
|
||||
|
||||
if ((i + 1) < gi.number_entry)
|
||||
{
|
||||
err = unzGoToNextFile(uf);
|
||||
if (err != UNZ_OK)
|
||||
{
|
||||
RARCH_ERR("Error %d while trying to go to the next file in the ZIP archive.\n",err);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(g_console.info_msg_enable)
|
||||
rarch_settings_msg(S_MSG_EXTRACTED_ZIPFILE, S_DELAY_180);
|
||||
|
||||
return 0;
|
||||
}
|
33
console/retroarch_rzlib.h
Normal file
33
console/retroarch_rzlib.h
Normal file
@ -0,0 +1,33 @@
|
||||
/* 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 _RARCH_CONSOLE_RZLIB_H
|
||||
#define _RARCH_CONSOLE_RZLIB_H
|
||||
|
||||
#include "rzlib/zlib.h"
|
||||
|
||||
#define WRITEBUFFERSIZE (1024 * 512)
|
||||
|
||||
enum
|
||||
{
|
||||
ZIP_EXTRACT_TO_CURRENT_DIR,
|
||||
ZIP_EXTRACT_TO_CURRENT_DIR_AND_LOAD_FIRST_FILE,
|
||||
ZIP_EXTRACT_TO_CACHE_DIR
|
||||
};
|
||||
|
||||
int rarch_extract_zipfile(const char *zip_path, const char *current_dir, char *first_file, size_t first_file_size);
|
||||
|
||||
#endif
|
@ -189,8 +189,6 @@ void _RGLFifoFinish( RGLFifo *fifo )
|
||||
{
|
||||
if ( !_RGLFifoReferenceInUse( fifo, ref ) )
|
||||
break;
|
||||
|
||||
sys_timer_usleep( 10 );
|
||||
}
|
||||
}
|
||||
|
||||
@ -225,7 +223,6 @@ static void _RGLFifoInit( RGLFifo *fifo, void *dmaControl, unsigned long dmaPush
|
||||
{
|
||||
if ( _RGLFifoReadReference( fifo ) == 0 )
|
||||
break;
|
||||
sys_timer_usleep( 10 );
|
||||
}
|
||||
}
|
||||
fifo->dmaPushBufferGPU = dmaPushBuffer;
|
||||
@ -521,7 +518,6 @@ int32_t _RGLOutOfSpaceCallback( struct CellGcmContextData* fifoContext, uint32_t
|
||||
|| (get < fifo->dmaPushBufferOffset) || (get > fifo->dmaPushBufferOffset +
|
||||
fifo->dmaPushBufferSizeInWords*sizeof(uint32_t)))
|
||||
{
|
||||
sys_timer_usleep(30);
|
||||
get = fifo->dmaControl->Get;
|
||||
}
|
||||
|
||||
@ -586,7 +582,7 @@ static int _RGLInitRM( RGLResource *gcmResource, unsigned int hostMemorySize, in
|
||||
gcmResource->semaphores = ( RGLSemaphoreMemory * )cellGcmGetLabelAddress( 0 );
|
||||
gcmResource->dmaControl = ( char* ) cellGcmGetControlRegister() - (( char * ) & (( RGLControlDma* )0 )->Put - ( char * )0 );
|
||||
|
||||
cellGcmFinish( 1 );
|
||||
cellGcmFinish(1);
|
||||
|
||||
gcmResource->hostMemorySize -= dmaPushBufferSize + _RGL_DMA_PUSH_BUFFER_PREFETCH_PADDING;
|
||||
gcmResource->dmaPushBuffer = gcmResource->hostMemoryBase + gcmResource->hostMemorySize;
|
||||
@ -1294,8 +1290,7 @@ static inline void _RGLUtilWaitForIdle (void)
|
||||
cellGcmSetWriteBackEndLabelInline( &_RGLState.fifo, RGL_UTIL_LABEL_INDEX, _RGLState.labelValue);
|
||||
cellGcmFlush();
|
||||
|
||||
while( *(cellGcmGetLabelAddress( RGL_UTIL_LABEL_INDEX)) != _RGLState.labelValue)
|
||||
sys_timer_usleep(30);
|
||||
while( *(cellGcmGetLabelAddress( RGL_UTIL_LABEL_INDEX)) != _RGLState.labelValue);
|
||||
|
||||
_RGLState.labelValue++;
|
||||
}
|
||||
|
@ -2414,8 +2414,6 @@ char *gmmIdToAddress(const uint32_t id)
|
||||
|
||||
if (cachedLockValue == 0)
|
||||
break;
|
||||
|
||||
sys_timer_usleep(30);
|
||||
}while(1);
|
||||
|
||||
return (char *)pBaseBlock->address;
|
||||
|
3
driver.h
3
driver.h
@ -159,6 +159,9 @@ typedef struct input_driver
|
||||
int16_t (*input_state)(void *data, const struct retro_keybind **retro_keybinds, unsigned port, unsigned device, unsigned index, unsigned id);
|
||||
bool (*key_pressed)(void *data, int key);
|
||||
void (*free)(void *data);
|
||||
#ifdef RARCH_CONSOLE
|
||||
void (*set_default_keybind_lut)(void);
|
||||
#endif
|
||||
const char *ident;
|
||||
} input_driver_t;
|
||||
|
||||
|
3
file.h
3
file.h
@ -60,9 +60,12 @@ struct string_list
|
||||
struct string_list *dir_list_new(const char *dir, const char *ext, bool include_dirs);
|
||||
void dir_list_sort(struct string_list *list, bool dir_first);
|
||||
void dir_list_free(struct string_list *list);
|
||||
bool string_list_find_elem(const struct string_list *list, const char *elem);
|
||||
struct string_list *string_split(const char *str, const char *delim);
|
||||
|
||||
bool path_is_directory(const char *path);
|
||||
bool path_file_exists(const char *path);
|
||||
const char *path_get_extension(const char *path);
|
||||
|
||||
// Path-name operations.
|
||||
// If any of these operation are detected to overflow, the application will be terminated.
|
||||
|
@ -103,7 +103,7 @@ static bool string_list_append(struct string_list *list, const char *elem, union
|
||||
return true;
|
||||
}
|
||||
|
||||
static struct string_list *string_split(const char *str, const char *delim)
|
||||
struct string_list *string_split(const char *str, const char *delim)
|
||||
{
|
||||
char *copy = NULL;
|
||||
const char *tmp = NULL;
|
||||
@ -138,7 +138,7 @@ error:
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static bool string_list_find_elem(const struct string_list *list, const char *elem)
|
||||
bool string_list_find_elem(const struct string_list *list, const char *elem)
|
||||
{
|
||||
if (!list)
|
||||
return false;
|
||||
@ -152,7 +152,7 @@ static bool string_list_find_elem(const struct string_list *list, const char *el
|
||||
return false;
|
||||
}
|
||||
|
||||
static const char *path_get_extension(const char *path)
|
||||
const char *path_get_extension(const char *path)
|
||||
{
|
||||
const char *ext = strrchr(path, '.');
|
||||
if (ext)
|
||||
|
@ -243,6 +243,9 @@ struct console_settings
|
||||
uint32_t control_timer_expiration_frame_count;
|
||||
uint32_t timer_expiration_frame_count;
|
||||
uint32_t input_loop;
|
||||
#ifdef HAVE_ZLIB
|
||||
uint32_t zip_extract_mode;
|
||||
#endif
|
||||
#ifdef _XBOX
|
||||
uint32_t color_format;
|
||||
DWORD volume_device_type;
|
||||
|
@ -1,6 +1,6 @@
|
||||
/* RetroArch - A frontend for libretro.
|
||||
* Copyright (C) 2010-2012 - Hans-Kristian Arntzen
|
||||
*
|
||||
*
|
||||
* 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.
|
||||
@ -31,6 +31,12 @@
|
||||
#include <sys/sys_time.h>
|
||||
#endif
|
||||
|
||||
#if IS_LINUX
|
||||
#include <unistd.h>
|
||||
#include <errno.h>
|
||||
#include <sys/wait.h>
|
||||
#endif
|
||||
|
||||
#if (defined(__CELLOS_LV2__) && !defined(__PSL1GHT__)) || defined(_MSC_VER)
|
||||
static int gettimeofday(struct timeval *val, void *dummy)
|
||||
{
|
||||
@ -105,6 +111,37 @@ bool gfx_window_title(char *buf, size_t size)
|
||||
return ret;
|
||||
}
|
||||
|
||||
#ifdef IS_LINUX
|
||||
void suspend_screensaver(Window wnd) {
|
||||
char wid[20];
|
||||
snprintf(wid, 20, "%d", (int) wnd);
|
||||
wid[19] = '\0';
|
||||
char* args[4];
|
||||
args[0] = "xdg-screensaver";
|
||||
args[1] = "suspend";
|
||||
args[2] = wid;
|
||||
args[3] = NULL;
|
||||
|
||||
int cpid = fork();
|
||||
if (cpid < 0) {
|
||||
RARCH_WARN("Could not suspend screen saver: %s\n", strerror(errno));
|
||||
return;
|
||||
}
|
||||
|
||||
if (!cpid) {
|
||||
execvp(args[0], args);
|
||||
exit(errno);
|
||||
}
|
||||
|
||||
int err = 0;
|
||||
waitpid(cpid, &err, 0);
|
||||
if (err) {
|
||||
RARCH_WARN("Could not suspend screen saver: %s\n", strerror(err));
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#if defined(_WIN32) && !defined(_XBOX)
|
||||
#include <windows.h>
|
||||
#include "../dynamic.h"
|
||||
|
@ -1,6 +1,6 @@
|
||||
/* RetroArch - A frontend for libretro.
|
||||
* Copyright (C) 2010-2012 - Hans-Kristian Arntzen
|
||||
*
|
||||
*
|
||||
* 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.
|
||||
@ -22,6 +22,11 @@
|
||||
bool gfx_window_title(char *buf, size_t size);
|
||||
void gfx_window_title_reset(void);
|
||||
|
||||
#ifdef IS_LINUX
|
||||
#include <X11/Xlib.h>
|
||||
void suspend_screensaver(Window wnd);
|
||||
#endif
|
||||
|
||||
#ifdef _WIN32
|
||||
void gfx_set_dwm(void);
|
||||
#endif
|
||||
|
@ -21,6 +21,10 @@
|
||||
#include "../input/rarch_sdl_input.h"
|
||||
#include "gfx_common.h"
|
||||
|
||||
#ifdef IS_LINUX
|
||||
#include "SDL_syswm.h"
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
@ -243,6 +247,21 @@ static void sdl_render_msg_32(sdl_video_t *vid, SDL_Surface *buffer, const char
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef IS_LINUX
|
||||
static Window sdl_get_window_id() {
|
||||
SDL_SysWMinfo sys_info;
|
||||
SDL_VERSION(&sys_info.version);
|
||||
|
||||
if(SDL_GetWMInfo(&sys_info) <= 0) {
|
||||
RARCH_WARN("%s", SDL_GetError());
|
||||
return -1;
|
||||
}
|
||||
|
||||
Window wid = sys_info.info.x11.window;
|
||||
return wid;
|
||||
}
|
||||
#endif
|
||||
|
||||
static void *sdl_gfx_init(const video_info_t *video, const input_driver_t **input, void **input_data)
|
||||
{
|
||||
#ifdef _WIN32
|
||||
@ -270,6 +289,13 @@ static void *sdl_gfx_init(const video_info_t *video, const input_driver_t **inpu
|
||||
vid->render32 = video->rgb32 && !g_settings.video.force_16bit;
|
||||
vid->screen = SDL_SetVideoMode(video->width, video->height, vid->render32 ? 32 : 15, SDL_HWSURFACE | SDL_HWACCEL | SDL_DOUBLEBUF | (video->fullscreen ? SDL_FULLSCREEN : 0));
|
||||
|
||||
#ifdef IS_LINUX
|
||||
int wid = sdl_get_window_id();
|
||||
if (wid > 0) {
|
||||
suspend_screensaver(wid);
|
||||
}
|
||||
#endif
|
||||
|
||||
if (!vid->screen && !g_settings.video.force_16bit && !video->rgb32)
|
||||
{
|
||||
vid->upsample = true;
|
||||
@ -301,7 +327,7 @@ static void *sdl_gfx_init(const video_info_t *video, const input_driver_t **inpu
|
||||
RARCH_SCALE_BASE * video->input_scale, 15,
|
||||
fmt->Rmask, fmt->Gmask, fmt->Bmask, fmt->Amask);
|
||||
}
|
||||
RARCH_LOG("[Debug]: SDL Pixel format: Rshift = %u, Gshift = %u, Bshift = %u\n",
|
||||
RARCH_LOG("[Debug]: SDL Pixel format: Rshift = %u, Gshift = %u, Bshift = %u\n",
|
||||
(unsigned)fmt->Rshift, (unsigned)fmt->Gshift, (unsigned)fmt->Bshift);
|
||||
|
||||
if (!vid->buffer)
|
||||
@ -491,7 +517,7 @@ static bool sdl_gfx_frame(void *data, const void *frame, unsigned width, unsigne
|
||||
// 32-bit -> 32-bit
|
||||
else
|
||||
vid->convert_32_func((uint32_t*)vid->buffer->pixels, vid->buffer->pitch, (const uint32_t*)frame, width, height, pitch, vid->screen->format);
|
||||
|
||||
|
||||
if (SDL_MUSTLOCK(vid->buffer))
|
||||
SDL_UnlockSurface(vid->buffer);
|
||||
|
||||
|
50
gfx/xvideo.c
50
gfx/xvideo.c
@ -1,6 +1,6 @@
|
||||
/* RetroArch - A frontend for libretro.
|
||||
* Copyright (C) 2010-2012 - Hans-Kristian Arntzen
|
||||
*
|
||||
*
|
||||
* 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.
|
||||
@ -109,7 +109,7 @@ static void init_yuv_tables(xv_t *xv)
|
||||
xv->utable = (uint8_t*)malloc(0x8000);
|
||||
xv->vtable = (uint8_t*)malloc(0x8000);
|
||||
|
||||
for (unsigned i = 0; i < 0x8000; i++)
|
||||
for (unsigned i = 0; i < 0x8000; i++)
|
||||
{
|
||||
// Extract RGB555 color data from i
|
||||
unsigned r = (i >> 10) & 0x1F, g = (i >> 5) & 0x1F, b = (i) & 0x1F;
|
||||
@ -212,14 +212,14 @@ static void xv_init_font(xv_t *xv, const char *font_path, unsigned font_size)
|
||||
}
|
||||
|
||||
// We render @ 2x scale to combat chroma downsampling. Also makes fonts more bearable :)
|
||||
static void render16_yuy2(xv_t *xv, const void *input_, unsigned width, unsigned height, unsigned pitch)
|
||||
static void render16_yuy2(xv_t *xv, const void *input_, unsigned width, unsigned height, unsigned pitch)
|
||||
{
|
||||
const uint16_t *input = (const uint16_t*)input_;
|
||||
uint8_t *output = (uint8_t*)xv->image->data;
|
||||
|
||||
for (unsigned y = 0; y < height; y++)
|
||||
for (unsigned y = 0; y < height; y++)
|
||||
{
|
||||
for (unsigned x = 0; x < width; x++)
|
||||
for (unsigned x = 0; x < width; x++)
|
||||
{
|
||||
uint16_t p = *input++;
|
||||
|
||||
@ -240,14 +240,14 @@ static void render16_yuy2(xv_t *xv, const void *input_, unsigned width, unsigned
|
||||
}
|
||||
}
|
||||
|
||||
static void render16_uyvy(xv_t *xv, const void *input_, unsigned width, unsigned height, unsigned pitch)
|
||||
static void render16_uyvy(xv_t *xv, const void *input_, unsigned width, unsigned height, unsigned pitch)
|
||||
{
|
||||
const uint16_t *input = (const uint16_t*)input_;
|
||||
uint8_t *output = (uint8_t*)xv->image->data;
|
||||
|
||||
for (unsigned y = 0; y < height; y++)
|
||||
for (unsigned y = 0; y < height; y++)
|
||||
{
|
||||
for (unsigned x = 0; x < width; x++)
|
||||
for (unsigned x = 0; x < width; x++)
|
||||
{
|
||||
uint16_t p = *input++;
|
||||
|
||||
@ -268,7 +268,7 @@ static void render16_uyvy(xv_t *xv, const void *input_, unsigned width, unsigned
|
||||
}
|
||||
}
|
||||
|
||||
static void render32_yuy2(xv_t *xv, const void *input_, unsigned width, unsigned height, unsigned pitch)
|
||||
static void render32_yuy2(xv_t *xv, const void *input_, unsigned width, unsigned height, unsigned pitch)
|
||||
{
|
||||
const uint32_t *input = (const uint32_t*)input_;
|
||||
uint8_t *output = (uint8_t*)xv->image->data;
|
||||
@ -297,12 +297,12 @@ static void render32_yuy2(xv_t *xv, const void *input_, unsigned width, unsigned
|
||||
}
|
||||
}
|
||||
|
||||
static void render32_uyvy(xv_t *xv, const void *input_, unsigned width, unsigned height, unsigned pitch)
|
||||
static void render32_uyvy(xv_t *xv, const void *input_, unsigned width, unsigned height, unsigned pitch)
|
||||
{
|
||||
const uint32_t *input = (const uint32_t*)input_;
|
||||
uint16_t *output = (uint16_t*)xv->image->data;
|
||||
|
||||
for (unsigned y = 0; y < height; y++)
|
||||
for (unsigned y = 0; y < height; y++)
|
||||
{
|
||||
for (unsigned x = 0; x < width; x++)
|
||||
{
|
||||
@ -364,16 +364,16 @@ static bool adaptor_set_format(xv_t *xv, Display *dpy, XvPortID port, const vide
|
||||
if (!format)
|
||||
return false;
|
||||
|
||||
for (int i = 0; i < format_count; i++)
|
||||
for (int i = 0; i < format_count; i++)
|
||||
{
|
||||
for (unsigned j = 0; j < sizeof(formats) / sizeof(formats[0]); j++)
|
||||
{
|
||||
if (format[i].type == XvYUV && format[i].bits_per_pixel == 16 && format[i].format == XvPacked)
|
||||
if (format[i].type == XvYUV && format[i].bits_per_pixel == 16 && format[i].format == XvPacked)
|
||||
{
|
||||
if (format[i].component_order[0] == formats[j].components[0] &&
|
||||
format[i].component_order[1] == formats[j].components[1] &&
|
||||
format[i].component_order[2] == formats[j].components[2] &&
|
||||
format[i].component_order[3] == formats[j].components[3])
|
||||
format[i].component_order[3] == formats[j].components[3])
|
||||
{
|
||||
xv->fourcc = format[i].id;
|
||||
xv->render_func = video->rgb32 ? formats[j].render_32 : formats[j].render_16;
|
||||
@ -426,7 +426,7 @@ static void *xv_init(const video_info_t *video, const input_driver_t **input, vo
|
||||
xv->port = 0;
|
||||
XvAdaptorInfo *adaptor_info;
|
||||
XvQueryAdaptors(xv->display, DefaultRootWindow(xv->display), &adaptor_count, &adaptor_info);
|
||||
for (unsigned i = 0; i < adaptor_count; i++)
|
||||
for (unsigned i = 0; i < adaptor_count; i++)
|
||||
{
|
||||
// Find adaptor that supports both input (memory->drawable) and image (drawable->screen) masks.
|
||||
if (adaptor_info[i].num_formats < 1) continue;
|
||||
@ -443,7 +443,7 @@ static void *xv_init(const video_info_t *video, const input_driver_t **input, vo
|
||||
}
|
||||
XvFreeAdaptorInfo(adaptor_info);
|
||||
|
||||
if (xv->port == 0)
|
||||
if (xv->port == 0)
|
||||
{
|
||||
RARCH_ERR("XVideo: Failed to find valid XvPort or format.\n");
|
||||
goto error;
|
||||
@ -454,7 +454,7 @@ static void *xv_init(const video_info_t *video, const input_driver_t **input, vo
|
||||
visualtemplate.depth = xv->depth;
|
||||
visualtemplate.visual = 0;
|
||||
visualinfo = XGetVisualInfo(xv->display, VisualIDMask | VisualScreenMask | VisualDepthMask, &visualtemplate, &visualmatches);
|
||||
if (visualmatches < 1 || !visualinfo->visual)
|
||||
if (visualmatches < 1 || !visualinfo->visual)
|
||||
{
|
||||
if (visualinfo) XFree(visualinfo);
|
||||
RARCH_ERR("XVideo: Unable to find Xv-compatible visual.\n");
|
||||
@ -495,7 +495,7 @@ static void *xv_init(const video_info_t *video, const input_driver_t **input, vo
|
||||
xv->height = geom->max_height;
|
||||
|
||||
xv->image = XvShmCreateImage(xv->display, xv->port, xv->fourcc, NULL, xv->width, xv->height, &xv->shminfo);
|
||||
if (!xv->image)
|
||||
if (!xv->image)
|
||||
{
|
||||
RARCH_ERR("XVideo: XShmCreateImage failed.\n");
|
||||
goto error;
|
||||
@ -506,7 +506,7 @@ static void *xv_init(const video_info_t *video, const input_driver_t **input, vo
|
||||
xv->shminfo.shmid = shmget(IPC_PRIVATE, xv->image->data_size, IPC_CREAT | 0777);
|
||||
xv->shminfo.shmaddr = xv->image->data = (char*)shmat(xv->shminfo.shmid, NULL, 0);
|
||||
xv->shminfo.readOnly = false;
|
||||
if (!XShmAttach(xv->display, &xv->shminfo))
|
||||
if (!XShmAttach(xv->display, &xv->shminfo))
|
||||
{
|
||||
RARCH_ERR("XVideo: XShmAttach failed.\n");
|
||||
goto error;
|
||||
@ -527,6 +527,8 @@ static void *xv_init(const video_info_t *video, const input_driver_t **input, vo
|
||||
xv_set_nonblock_state(xv, !video->vsync);
|
||||
xv->focus = true;
|
||||
|
||||
suspend_screensaver(xv->window);
|
||||
|
||||
xinput = input_x.init();
|
||||
if (xinput)
|
||||
{
|
||||
@ -579,7 +581,7 @@ static bool check_resize(xv_t *xv, unsigned width, unsigned height)
|
||||
|
||||
xv->shminfo.shmaddr = xv->image->data = (char*)shmat(xv->shminfo.shmid, NULL, 0);
|
||||
xv->shminfo.readOnly = false;
|
||||
|
||||
|
||||
if (!XShmAttach(xv->display, &xv->shminfo))
|
||||
{
|
||||
RARCH_ERR("Failed to reattch XvShm image.\n");
|
||||
@ -602,7 +604,7 @@ static void calc_out_rect(bool keep_aspect, unsigned *x, unsigned *y, unsigned *
|
||||
float desired_aspect = g_settings.video.aspect_ratio;
|
||||
float device_aspect = (float)vp_width / vp_height;
|
||||
|
||||
// If the aspect ratios of screen and desired aspect ratio are sufficiently equal (floating point stuff),
|
||||
// If the aspect ratios of screen and desired aspect ratio are sufficiently equal (floating point stuff),
|
||||
// assume they are actually equal.
|
||||
if (fabs(device_aspect - desired_aspect) < 0.0001)
|
||||
{
|
||||
@ -741,7 +743,7 @@ static bool xv_alive(void *data)
|
||||
XNextEvent(xv->display, &event);
|
||||
switch (event.type)
|
||||
{
|
||||
case ClientMessage:
|
||||
case ClientMessage:
|
||||
if ((Atom)event.xclient.data.l[0] == xv->quit_atom)
|
||||
return false;
|
||||
break;
|
||||
@ -776,9 +778,9 @@ static void xv_free(void *data)
|
||||
shmctl(xv->shminfo.shmid, IPC_RMID, NULL);
|
||||
XFree(xv->image);
|
||||
|
||||
if (xv->window)
|
||||
if (xv->window)
|
||||
XUnmapWindow(xv->display, xv->window);
|
||||
if (xv->colormap)
|
||||
if (xv->colormap)
|
||||
XFreeColormap(xv->display, xv->colormap);
|
||||
|
||||
XCloseDisplay(xv->display);
|
||||
|
@ -51,12 +51,17 @@ static void null_input_free(void *data)
|
||||
(void)data;
|
||||
}
|
||||
|
||||
static void null_set_default_keybind_lut(void) { }
|
||||
|
||||
const input_driver_t input_null = {
|
||||
null_input_init,
|
||||
null_input_poll,
|
||||
null_input_state,
|
||||
null_input_key_pressed,
|
||||
null_input_free,
|
||||
#ifdef RARCH_CONSOLE
|
||||
null_set_default_keybind_lut,
|
||||
#endif
|
||||
"null",
|
||||
};
|
||||
|
||||
|
@ -46,6 +46,8 @@
|
||||
#include "../../gfx/gl_common.h"
|
||||
|
||||
#include "../../console/retroarch_console.h"
|
||||
#include "../../console/retroarch_console_input.h"
|
||||
#include "../../console/retroarch_config.h"
|
||||
#include "../../conf/config_file.h"
|
||||
#include "../../conf/config_file_macros.h"
|
||||
#include "../../general.h"
|
||||
@ -187,6 +189,9 @@ static void get_environment_settings(int argc, char *argv[])
|
||||
RARCH_LOG("usrDirPath : [%s].\n", default_paths.port_dir);
|
||||
}
|
||||
|
||||
#ifdef HAVE_HDD_CACHE_PARTITION
|
||||
snprintf(default_paths.cache_dir, sizeof(default_paths.cache_dir), "/dev_hdd1/");
|
||||
#endif
|
||||
snprintf(default_paths.core_dir, sizeof(default_paths.core_dir), "%s/cores", default_paths.port_dir);
|
||||
snprintf(default_paths.executable_extension, sizeof(default_paths.executable_extension), ".SELF");
|
||||
snprintf(default_paths.savestate_dir, sizeof(default_paths.savestate_dir), "%s/savestates", default_paths.core_dir);
|
||||
@ -240,10 +245,11 @@ int main(int argc, char *argv[])
|
||||
get_environment_settings(argc, argv);
|
||||
|
||||
config_set_defaults();
|
||||
input_ps3.init();
|
||||
|
||||
char tmp_path[PATH_MAX];
|
||||
snprintf(tmp_path, sizeof(tmp_path), "%s/", default_paths.core_dir);
|
||||
rarch_configure_libretro(tmp_path, default_paths.executable_extension);
|
||||
rarch_configure_libretro(&input_ps3, tmp_path, default_paths.executable_extension);
|
||||
|
||||
#if(CELL_SDK_VERSION > 0x340000)
|
||||
if (g_console.screenshots_enable)
|
||||
@ -268,7 +274,6 @@ int main(int argc, char *argv[])
|
||||
|
||||
video_gl.start();
|
||||
|
||||
input_ps3.init();
|
||||
|
||||
#ifdef HAVE_OSKUTIL
|
||||
oskutil_init(&g_console.oskutil_handle, 0);
|
||||
|
@ -269,6 +269,17 @@ item items_generalsettings[MAX_NO_OF_CONTROLS_SETTINGS] =
|
||||
WHITE,
|
||||
0.83f,
|
||||
},
|
||||
{
|
||||
SETTING_ZIP_EXTRACT,
|
||||
"ZIP extract",
|
||||
"",
|
||||
0.0f,
|
||||
0.0f,
|
||||
YELLOW,
|
||||
"INFO - Select the [ZIP Extract] mode. This setting controls how ZIP files are extracted.",
|
||||
WHITE,
|
||||
0.83f,
|
||||
},
|
||||
{
|
||||
SETTING_RARCH_DEFAULT_EMU,
|
||||
"Default emulator core",
|
||||
|
@ -27,6 +27,13 @@
|
||||
#include "../../console/fileio/file_browser.h"
|
||||
|
||||
#include "../../console/retroarch_console.h"
|
||||
#include "../../console/retroarch_rom_ext.h"
|
||||
#include "../../console/retroarch_console_input.h"
|
||||
#include "../../console/retroarch_config.h"
|
||||
|
||||
#ifdef HAVE_ZLIB
|
||||
#include "../../console/retroarch_rzlib.h"
|
||||
#endif
|
||||
|
||||
#include "../../gfx/gl_common.h"
|
||||
#include "../../gfx/gl_font.h"
|
||||
@ -215,6 +222,24 @@ static void set_setting_label(menu * menu_obj, unsigned currentsetting)
|
||||
snprintf(items_generalsettings[currentsetting].comment, sizeof(items_generalsettings[currentsetting].comment), "INFO - [Rewind] feature is set to 'OFF'.");
|
||||
}
|
||||
break;
|
||||
case SETTING_ZIP_EXTRACT:
|
||||
set_setting_label_color(g_console.zip_extract_mode == ZIP_EXTRACT_TO_CURRENT_DIR, currentsetting);
|
||||
switch(g_console.zip_extract_mode)
|
||||
{
|
||||
case ZIP_EXTRACT_TO_CURRENT_DIR:
|
||||
snprintf(items_generalsettings[currentsetting].setting_text, sizeof(items_generalsettings[currentsetting].setting_text), "Current dir");
|
||||
snprintf(items_generalsettings[currentsetting].comment, sizeof(items_generalsettings[currentsetting].comment), "INFO - [ZIP Extract Mode] is set to 'Current dir'.\nZIP files are extracted to the current directory.");
|
||||
break;
|
||||
case ZIP_EXTRACT_TO_CURRENT_DIR_AND_LOAD_FIRST_FILE:
|
||||
snprintf(items_generalsettings[currentsetting].setting_text, sizeof(items_generalsettings[currentsetting].setting_text), "Current dir and load first file");
|
||||
snprintf(items_generalsettings[currentsetting].comment, sizeof(items_generalsettings[currentsetting].comment), "INFO - [ZIP Extract Mode] is set to 'Current dir and load first file'.\nZIP files are extracted to the current directory, and the first game is automatically loaded.");
|
||||
break;
|
||||
case ZIP_EXTRACT_TO_CACHE_DIR:
|
||||
snprintf(items_generalsettings[currentsetting].setting_text, sizeof(items_generalsettings[currentsetting].setting_text), "Cache dir");
|
||||
snprintf(items_generalsettings[currentsetting].comment, sizeof(items_generalsettings[currentsetting].comment), "INFO - [ZIP Extract Mode] is set to 'Cache dir'.\nZIP files are extracted to the cache directory (dev_hdd1).");
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case SETTING_RARCH_DEFAULT_EMU:
|
||||
fill_pathname_base(fname, g_settings.libretro, sizeof(fname));
|
||||
snprintf(items_generalsettings[currentsetting].setting_text, sizeof(items_generalsettings[currentsetting].setting_text), "%s", fname);
|
||||
@ -1343,6 +1368,22 @@ static void producesettingentry(menu * menu_obj, unsigned switchvalue)
|
||||
if(input_state & (1 << RETRO_DEVICE_ID_JOYPAD_START))
|
||||
g_settings.rewind_enable = false;
|
||||
break;
|
||||
case SETTING_ZIP_EXTRACT:
|
||||
if((input_state & (1 << RETRO_DEVICE_ID_JOYPAD_LEFT)))
|
||||
{
|
||||
if(g_console.zip_extract_mode > 0)
|
||||
g_console.zip_extract_mode--;
|
||||
}
|
||||
if((input_state & (1 << RETRO_DEVICE_ID_JOYPAD_RIGHT)) || (input_state & (1 << RETRO_DEVICE_ID_JOYPAD_B)))
|
||||
{
|
||||
if(g_console.zip_extract_mode < ZIP_EXTRACT_TO_CACHE_DIR)
|
||||
g_console.zip_extract_mode++;
|
||||
}
|
||||
if(input_state & (1 << RETRO_DEVICE_ID_JOYPAD_START))
|
||||
{
|
||||
g_console.zip_extract_mode = ZIP_EXTRACT_TO_CURRENT_DIR;
|
||||
}
|
||||
break;
|
||||
case SETTING_RARCH_DEFAULT_EMU:
|
||||
if((input_state & (1 << RETRO_DEVICE_ID_JOYPAD_LEFT)) || (input_state & (1 << RETRO_DEVICE_ID_JOYPAD_RIGHT)) || (input_state & (1 << RETRO_DEVICE_ID_JOYPAD_B)))
|
||||
{
|
||||
@ -1666,22 +1707,7 @@ static void menu_romselect_iterate(filebrowser_t *filebrowser, menu_romselect_ac
|
||||
filebrowser_iterate(filebrowser, FILEBROWSER_ACTION_OK);
|
||||
}
|
||||
else
|
||||
{
|
||||
char rom_path_temp[PATH_MAX];
|
||||
struct retro_system_info info;
|
||||
retro_get_system_info(&info);
|
||||
bool block_zip_extract = info.block_extract;
|
||||
|
||||
snprintf(rom_path_temp, sizeof(rom_path_temp), filebrowser_get_current_path(filebrowser));
|
||||
|
||||
if((strstr(rom_path_temp, ".zip") || strstr(rom_path_temp, ".ZIP")) && !block_zip_extract)
|
||||
rarch_extract_zipfile(rom_path_temp);
|
||||
else
|
||||
{
|
||||
rarch_console_load_game(filebrowser_get_current_path(filebrowser));
|
||||
rarch_settings_msg(S_MSG_LOADING_ROM, S_DELAY_45);
|
||||
}
|
||||
}
|
||||
rarch_console_load_game_wrap(filebrowser_get_current_path(filebrowser), S_DELAY_45);
|
||||
break;
|
||||
case MENU_ROMSELECT_ACTION_GOTO_SETTINGS:
|
||||
menu_stack_increment();
|
||||
|
@ -101,6 +101,7 @@ enum
|
||||
SETTING_DEFAULT_AUDIO_ALL,
|
||||
SETTING_EMU_CURRENT_SAVE_STATE_SLOT,
|
||||
SETTING_EMU_SHOW_INFO_MSG,
|
||||
SETTING_ZIP_EXTRACT,
|
||||
SETTING_RARCH_DEFAULT_EMU,
|
||||
SETTING_EMU_DEFAULT_ALL,
|
||||
SETTING_EMU_REWIND_ENABLED,
|
||||
|
@ -136,9 +136,7 @@ static void *ps3_audio_init(const char *device, unsigned rate, unsigned latency)
|
||||
sys_lwmutex_attribute_t lock_attr;
|
||||
sys_lwmutex_attribute_t cond_lock_attr;
|
||||
sys_lwcond_attribute_t cond_attr;
|
||||
#endif
|
||||
|
||||
#ifndef __PSL1GHT__
|
||||
sys_lwmutex_attribute_initialize(lock_attr);
|
||||
sys_lwmutex_attribute_initialize(cond_lock_attr);
|
||||
sys_lwcond_attribute_initialize(cond_attr);
|
||||
|
@ -97,6 +97,43 @@ CellMouseData ps3_mouse_input_poll_device(uint32_t id)
|
||||
|
||||
#define MAP(x) (x & 0xFF)
|
||||
|
||||
const struct platform_bind platform_keys[] = {
|
||||
{ CTRL_CIRCLE_MASK, "Circle button" },
|
||||
{ CTRL_CROSS_MASK, "Cross button" },
|
||||
{ CTRL_TRIANGLE_MASK, "Triangle button" },
|
||||
{ CTRL_SQUARE_MASK, "Square button" },
|
||||
{ CTRL_UP_MASK, "D-Pad Up" },
|
||||
{ CTRL_DOWN_MASK, "D-Pad Down" },
|
||||
{ CTRL_LEFT_MASK, "D-Pad Left" },
|
||||
{ CTRL_RIGHT_MASK, "D-Pad Right" },
|
||||
{ CTRL_SELECT_MASK, "Select button" },
|
||||
{ CTRL_START_MASK, "Start button" },
|
||||
{ CTRL_L1_MASK, "L1 button" },
|
||||
{ CTRL_L2_MASK, "L2 button" },
|
||||
{ CTRL_L3_MASK, "L3 button" },
|
||||
{ CTRL_R1_MASK, "R1 button" },
|
||||
{ CTRL_R2_MASK, "R2 button" },
|
||||
{ CTRL_R3_MASK, "R3 button" },
|
||||
{ CTRL_LSTICK_LEFT_MASK, "LStick Left" },
|
||||
{ CTRL_LSTICK_RIGHT_MASK, "LStick Right" },
|
||||
{ CTRL_LSTICK_UP_MASK, "LStick Up" },
|
||||
{ CTRL_LSTICK_DOWN_MASK, "LStick Down" },
|
||||
{ CTRL_LEFT_MASK | CTRL_LSTICK_LEFT_MASK, "LStick D-Pad Left" },
|
||||
{ CTRL_RIGHT_MASK | CTRL_LSTICK_RIGHT_MASK, "LStick D-Pad Right" },
|
||||
{ CTRL_UP_MASK | CTRL_LSTICK_UP_MASK, "LStick D-Pad Up" },
|
||||
{ CTRL_DOWN_MASK | CTRL_LSTICK_DOWN_MASK, "LStick D-Pad Down" },
|
||||
{ CTRL_RSTICK_LEFT_MASK, "RStick Left" },
|
||||
{ CTRL_RSTICK_RIGHT_MASK, "RStick Right" },
|
||||
{ CTRL_RSTICK_UP_MASK, "RStick Up" },
|
||||
{ CTRL_RSTICK_DOWN_MASK, "RStick Down" },
|
||||
{ CTRL_LEFT_MASK | CTRL_RSTICK_LEFT_MASK, "RStick D-Pad Left" },
|
||||
{ CTRL_RIGHT_MASK | CTRL_RSTICK_RIGHT_MASK, "RStick D-Pad Right" },
|
||||
{ CTRL_UP_MASK | CTRL_RSTICK_UP_MASK, "RStick D-Pad Up" },
|
||||
{ CTRL_DOWN_MASK | CTRL_RSTICK_DOWN_MASK, "RStick D-Pad Down" },
|
||||
};
|
||||
|
||||
const unsigned int platform_keys_size = sizeof(platform_keys);
|
||||
|
||||
static uint64_t state[MAX_PADS];
|
||||
static unsigned pads_connected;
|
||||
#ifdef HAVE_MOUSE
|
||||
@ -433,12 +470,33 @@ static bool ps3_key_pressed(void *data, int key)
|
||||
}
|
||||
}
|
||||
|
||||
static void ps3_set_default_keybind_lut(void)
|
||||
{
|
||||
rarch_default_keybind_lut[RETRO_DEVICE_ID_JOYPAD_B] = platform_keys[PS3_DEVICE_ID_JOYPAD_CROSS].joykey;
|
||||
rarch_default_keybind_lut[RETRO_DEVICE_ID_JOYPAD_Y] = platform_keys[PS3_DEVICE_ID_JOYPAD_SQUARE].joykey;
|
||||
rarch_default_keybind_lut[RETRO_DEVICE_ID_JOYPAD_SELECT] = platform_keys[PS3_DEVICE_ID_JOYPAD_SELECT].joykey;
|
||||
rarch_default_keybind_lut[RETRO_DEVICE_ID_JOYPAD_START] = platform_keys[PS3_DEVICE_ID_JOYPAD_START].joykey;
|
||||
rarch_default_keybind_lut[RETRO_DEVICE_ID_JOYPAD_UP] = platform_keys[PS3_DEVICE_ID_JOYPAD_UP].joykey;
|
||||
rarch_default_keybind_lut[RETRO_DEVICE_ID_JOYPAD_DOWN] = platform_keys[PS3_DEVICE_ID_JOYPAD_DOWN].joykey;
|
||||
rarch_default_keybind_lut[RETRO_DEVICE_ID_JOYPAD_LEFT] = platform_keys[PS3_DEVICE_ID_JOYPAD_LEFT].joykey;
|
||||
rarch_default_keybind_lut[RETRO_DEVICE_ID_JOYPAD_RIGHT] = platform_keys[PS3_DEVICE_ID_JOYPAD_RIGHT].joykey;
|
||||
rarch_default_keybind_lut[RETRO_DEVICE_ID_JOYPAD_A] = platform_keys[PS3_DEVICE_ID_JOYPAD_CIRCLE].joykey;
|
||||
rarch_default_keybind_lut[RETRO_DEVICE_ID_JOYPAD_X] = platform_keys[PS3_DEVICE_ID_JOYPAD_TRIANGLE].joykey;
|
||||
rarch_default_keybind_lut[RETRO_DEVICE_ID_JOYPAD_L] = platform_keys[PS3_DEVICE_ID_JOYPAD_L1].joykey;
|
||||
rarch_default_keybind_lut[RETRO_DEVICE_ID_JOYPAD_R] = platform_keys[PS3_DEVICE_ID_JOYPAD_R1].joykey;
|
||||
rarch_default_keybind_lut[RETRO_DEVICE_ID_JOYPAD_R2] = platform_keys[PS3_DEVICE_ID_JOYPAD_R2].joykey;
|
||||
rarch_default_keybind_lut[RETRO_DEVICE_ID_JOYPAD_R3] = platform_keys[PS3_DEVICE_ID_JOYPAD_R3].joykey;
|
||||
rarch_default_keybind_lut[RETRO_DEVICE_ID_JOYPAD_L2] = platform_keys[PS3_DEVICE_ID_JOYPAD_L2].joykey;
|
||||
rarch_default_keybind_lut[RETRO_DEVICE_ID_JOYPAD_L3] = platform_keys[PS3_DEVICE_ID_JOYPAD_L3].joykey;
|
||||
}
|
||||
|
||||
const input_driver_t input_ps3 = {
|
||||
.init = ps3_input_initialize,
|
||||
.poll = ps3_input_poll,
|
||||
.input_state = ps3_input_state,
|
||||
.key_pressed = ps3_key_pressed,
|
||||
.free = ps3_free_input,
|
||||
.set_default_keybind_lut = ps3_set_default_keybind_lut,
|
||||
.ident = "ps3",
|
||||
};
|
||||
|
||||
|
@ -156,6 +156,44 @@ typedef struct
|
||||
CellOskDialogParam dialogParam;
|
||||
} oskutil_params;
|
||||
|
||||
enum ps3_device_id
|
||||
{
|
||||
PS3_DEVICE_ID_JOYPAD_CIRCLE = 0,
|
||||
PS3_DEVICE_ID_JOYPAD_CROSS,
|
||||
PS3_DEVICE_ID_JOYPAD_TRIANGLE,
|
||||
PS3_DEVICE_ID_JOYPAD_SQUARE,
|
||||
PS3_DEVICE_ID_JOYPAD_UP,
|
||||
PS3_DEVICE_ID_JOYPAD_DOWN,
|
||||
PS3_DEVICE_ID_JOYPAD_LEFT,
|
||||
PS3_DEVICE_ID_JOYPAD_RIGHT,
|
||||
PS3_DEVICE_ID_JOYPAD_SELECT,
|
||||
PS3_DEVICE_ID_JOYPAD_START,
|
||||
PS3_DEVICE_ID_JOYPAD_L1,
|
||||
PS3_DEVICE_ID_JOYPAD_L2,
|
||||
PS3_DEVICE_ID_JOYPAD_L3,
|
||||
PS3_DEVICE_ID_JOYPAD_R1,
|
||||
PS3_DEVICE_ID_JOYPAD_R2,
|
||||
PS3_DEVICE_ID_JOYPAD_R3,
|
||||
PS3_DEVICE_ID_LSTICK_LEFT,
|
||||
PS3_DEVICE_ID_LSTICK_RIGHT,
|
||||
PS3_DEVICE_ID_LSTICK_UP,
|
||||
PS3_DEVICE_ID_LSTICK_DOWN,
|
||||
PS3_DEVICE_ID_LSTICK_LEFT_DPAD,
|
||||
PS3_DEVICE_ID_LSTICK_RIGHT_DPAD,
|
||||
PS3_DEVICE_ID_LSTICK_UP_DPAD,
|
||||
PS3_DEVICE_ID_LSTICK_DOWN_DPAD,
|
||||
PS3_DEVICE_ID_RSTICK_LEFT,
|
||||
PS3_DEVICE_ID_RSTICK_RIGHT,
|
||||
PS3_DEVICE_ID_RSTICK_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
|
||||
};
|
||||
|
||||
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);
|
||||
|
@ -413,7 +413,6 @@
|
||||
#define CellVideoOutResolution videoResolution
|
||||
#define CellVideoOutState videoState
|
||||
|
||||
#define CellRescPalTemporalMode rescPalTemporalMode
|
||||
#define CellRescInitConfig rescInitConfig
|
||||
#define CellRescSrc rescSrc
|
||||
#define CellRescBufferMode rescBufferMode
|
||||
@ -422,6 +421,8 @@
|
||||
#define memoryFrequency memoryFreq
|
||||
#define coreFrequency coreFreq
|
||||
|
||||
#define cellGcmFinish rsxFinish
|
||||
|
||||
#define cellGcmGetFlipStatus gcmGetFlipStatus
|
||||
#define cellGcmResetFlipStatus gcmResetFlipStatus
|
||||
#define cellGcmSetWaitFlip gcmSetWaitFlip
|
||||
@ -441,6 +442,11 @@
|
||||
#define cellGcmSetTileInfo gcmSetTileInfo
|
||||
#define cellGcmAddressToOffset gcmAddressToOffset
|
||||
|
||||
#define cellRescCreateInterlaceTable rescCreateInterlaceTable
|
||||
#define cellRescSetDisplayMode rescSetDisplayMode
|
||||
#define cellRescGetNumColorBuffers rescGetNumColorBuffers
|
||||
#define cellRescGetBufferSize rescGetBufferSize
|
||||
#define cellRescSetBufferAddress rescSetBufferAddress
|
||||
#define cellRescGetFlipStatus rescGetFlipStatus
|
||||
#define cellRescResetFlipStatus rescResetFlipStatus
|
||||
#define cellRescSetConvertAndFlip rescSetConvertAndFlip
|
||||
|
@ -1,5 +1,6 @@
|
||||
/* RetroArch - A frontend for libretro.
|
||||
* Copyright (C) 2010-2012 - Hans-Kristian Arntzen
|
||||
* Copyright (C) 2012 - Michael Lelli
|
||||
*
|
||||
* 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-
|
||||
@ -20,6 +21,7 @@
|
||||
#include "../../driver.h"
|
||||
#include "../../general.h"
|
||||
#include "../../libretro.h"
|
||||
#include "../../console/retroarch_console_input.h"
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stddef.h>
|
||||
@ -40,6 +42,36 @@ FILE * log_fp;
|
||||
|
||||
static uint16_t menu_framebuf[RGUI_WIDTH * RGUI_HEIGHT];
|
||||
|
||||
static const struct retro_keybind _wii_nav_binds[] = {
|
||||
{ 0, 0, 0, WII_GC_UP | WII_GC_LSTICK_UP | WII_GC_RSTICK_UP | WII_CLASSIC_UP | WII_CLASSIC_LSTICK_UP | WII_CLASSIC_RSTICK_UP | WII_WIIMOTE_UP | WII_NUNCHUK_UP, 0 },
|
||||
{ 0, 0, 0, WII_GC_DOWN | WII_GC_LSTICK_DOWN | WII_GC_RSTICK_DOWN | WII_CLASSIC_DOWN | WII_CLASSIC_LSTICK_DOWN | WII_CLASSIC_RSTICK_DOWN | WII_WIIMOTE_DOWN | WII_NUNCHUK_DOWN, 0 },
|
||||
{ 0, 0, 0, WII_GC_LEFT | WII_GC_LSTICK_LEFT | WII_GC_RSTICK_LEFT | WII_CLASSIC_LEFT | WII_CLASSIC_LSTICK_LEFT | WII_CLASSIC_RSTICK_LEFT | WII_WIIMOTE_LEFT | WII_NUNCHUK_LEFT, 0 },
|
||||
{ 0, 0, 0, WII_GC_RIGHT | WII_GC_LSTICK_RIGHT | WII_GC_RSTICK_RIGHT | WII_CLASSIC_RIGHT | WII_CLASSIC_LSTICK_RIGHT | WII_CLASSIC_RSTICK_RIGHT | WII_WIIMOTE_RIGHT | WII_NUNCHUK_RIGHT, 0 },
|
||||
{ 0, 0, 0, WII_GC_A | WII_CLASSIC_A | WII_WIIMOTE_A | WII_WIIMOTE_2, 0 },
|
||||
{ 0, 0, 0, WII_GC_B | WII_CLASSIC_B | WII_WIIMOTE_B | WII_WIIMOTE_1, 0 },
|
||||
{ 0, 0, 0, WII_GC_START | WII_CLASSIC_PLUS | WII_WIIMOTE_PLUS, 0 },
|
||||
{ 0, 0, 0, WII_GC_Z_TRIGGER | WII_CLASSIC_MINUS | WII_WIIMOTE_MINUS, 0 },
|
||||
{ 0, 0, 0, WII_WIIMOTE_HOME | WII_CLASSIC_HOME, 0 },
|
||||
};
|
||||
|
||||
static const struct retro_keybind *wii_nav_binds[] = {
|
||||
_wii_nav_binds
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
WII_DEVICE_NAV_UP = 0,
|
||||
WII_DEVICE_NAV_DOWN,
|
||||
WII_DEVICE_NAV_LEFT,
|
||||
WII_DEVICE_NAV_RIGHT,
|
||||
WII_DEVICE_NAV_A,
|
||||
WII_DEVICE_NAV_B,
|
||||
WII_DEVICE_NAV_START,
|
||||
WII_DEVICE_NAV_SELECT,
|
||||
WII_DEVICE_NAV_EXIT,
|
||||
WII_DEVICE_NAV_LAST
|
||||
};
|
||||
|
||||
static bool folder_cb(const char *directory, rgui_file_enum_cb_t file_cb,
|
||||
void *userdata, void *ctx)
|
||||
{
|
||||
@ -92,41 +124,50 @@ static bool get_rom_path(rgui_handle_t *rgui)
|
||||
for (;;)
|
||||
{
|
||||
uint16_t input_state = 0;
|
||||
|
||||
input_wii.poll(NULL);
|
||||
|
||||
if (input_wii.key_pressed(NULL, RARCH_QUIT_KEY))
|
||||
for (unsigned i = 0; i < WII_DEVICE_NAV_LAST; i++)
|
||||
{
|
||||
if (can_quit)
|
||||
return false;
|
||||
}
|
||||
else
|
||||
can_quit = true;
|
||||
|
||||
for (unsigned i = 0; i < RARCH_FIRST_META_KEY; i++)
|
||||
{
|
||||
input_state |= input_wii.input_state(NULL, NULL, false,
|
||||
input_state |= input_wii.input_state(NULL, wii_nav_binds, 0,
|
||||
RETRO_DEVICE_JOYPAD, 0, i) ? (1 << i) : 0;
|
||||
}
|
||||
|
||||
uint16_t trigger_state = input_state & ~old_input_state;
|
||||
|
||||
rgui_action_t action = RGUI_ACTION_NOOP;
|
||||
if (trigger_state & (1 << RETRO_DEVICE_ID_JOYPAD_B))
|
||||
action = RGUI_ACTION_CANCEL;
|
||||
else if (trigger_state & (1 << RETRO_DEVICE_ID_JOYPAD_A))
|
||||
action = RGUI_ACTION_OK;
|
||||
else if (trigger_state & (1 << RETRO_DEVICE_ID_JOYPAD_UP))
|
||||
action = RGUI_ACTION_UP;
|
||||
else if (trigger_state & (1 << RETRO_DEVICE_ID_JOYPAD_DOWN))
|
||||
action = RGUI_ACTION_DOWN;
|
||||
else if (trigger_state & (1 << RETRO_DEVICE_ID_JOYPAD_LEFT))
|
||||
action = RGUI_ACTION_LEFT;
|
||||
else if (trigger_state & (1 << RETRO_DEVICE_ID_JOYPAD_RIGHT))
|
||||
action = RGUI_ACTION_RIGHT;
|
||||
else if (trigger_state & (1 << RETRO_DEVICE_ID_JOYPAD_START))
|
||||
action = RGUI_ACTION_START;
|
||||
else if (trigger_state & (1 << RETRO_DEVICE_ID_JOYPAD_SELECT) && !first) // don't catch start+select+l+r when exiting
|
||||
action = RGUI_ACTION_SETTINGS;
|
||||
|
||||
// don't run anything first frame, only capture held inputs for old_input_state
|
||||
if (!first)
|
||||
{
|
||||
if (trigger_state & (1 << WII_DEVICE_NAV_EXIT))
|
||||
{
|
||||
if (can_quit)
|
||||
return false;
|
||||
}
|
||||
else
|
||||
can_quit = true;
|
||||
|
||||
if (trigger_state & (1 << WII_DEVICE_NAV_B))
|
||||
action = RGUI_ACTION_CANCEL;
|
||||
else if (trigger_state & (1 << WII_DEVICE_NAV_A))
|
||||
action = RGUI_ACTION_OK;
|
||||
else if (trigger_state & (1 << WII_DEVICE_NAV_UP))
|
||||
action = RGUI_ACTION_UP;
|
||||
else if (trigger_state & (1 << WII_DEVICE_NAV_DOWN))
|
||||
action = RGUI_ACTION_DOWN;
|
||||
else if (trigger_state & (1 << WII_DEVICE_NAV_LEFT))
|
||||
action = RGUI_ACTION_LEFT;
|
||||
else if (trigger_state & (1 << WII_DEVICE_NAV_RIGHT))
|
||||
action = RGUI_ACTION_RIGHT;
|
||||
else if (trigger_state & (1 << WII_DEVICE_NAV_START))
|
||||
action = RGUI_ACTION_START;
|
||||
else if (trigger_state & (1 << WII_DEVICE_NAV_SELECT))
|
||||
action = RGUI_ACTION_SETTINGS;
|
||||
}
|
||||
else
|
||||
{
|
||||
first = false;
|
||||
}
|
||||
|
||||
const char *ret = rgui_iterate(rgui, action);
|
||||
video_wii.frame(NULL, menu_framebuf,
|
||||
@ -142,7 +183,6 @@ static bool get_rom_path(rgui_handle_t *rgui)
|
||||
}
|
||||
|
||||
old_input_state = input_state;
|
||||
first = false;
|
||||
rarch_sleep(10);
|
||||
}
|
||||
}
|
||||
@ -172,6 +212,7 @@ int main(void)
|
||||
|
||||
wii_video_init();
|
||||
input_wii.init();
|
||||
rarch_input_set_controls_default(&input_wii);
|
||||
|
||||
rgui_handle_t *rgui = rgui_init("",
|
||||
menu_framebuf, RGUI_WIDTH * sizeof(uint16_t),
|
||||
|
@ -480,8 +480,7 @@ const char *rgui_iterate(rgui_handle_t *rgui, rgui_action_t action)
|
||||
else
|
||||
{
|
||||
snprintf(rgui->path_buf, sizeof(rgui->path_buf), "%s/%s", dir, path);
|
||||
rarch_console_load_game(rgui->path_buf);
|
||||
rarch_settings_msg(S_MSG_LOADING_ROM, S_DELAY_1);
|
||||
rarch_console_load_game_wrap(rgui->path_buf, S_DELAY_1);
|
||||
found = true;
|
||||
}
|
||||
break;
|
||||
|
399
wii/gx_input.c
Normal file
399
wii/gx_input.c
Normal file
@ -0,0 +1,399 @@
|
||||
/* RetroArch - A frontend for libretro.
|
||||
* Copyright (C) 2010-2012 - Hans-Kristian Arntzen
|
||||
* Copyright (C) 2011-2012 - Daniel De Matteis
|
||||
* Copyright (C) 2012 - Michael Lelli
|
||||
*
|
||||
* 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/>.
|
||||
*/
|
||||
|
||||
#include <stdint.h>
|
||||
#include <gccore.h>
|
||||
#include <ogc/pad.h>
|
||||
#ifdef HW_RVL
|
||||
#include <wiiuse/wpad.h>
|
||||
#endif
|
||||
#include <string.h>
|
||||
#include <math.h>
|
||||
|
||||
#ifndef M_PI
|
||||
#define M_PI 3.14159265358979323846264338327
|
||||
#endif
|
||||
|
||||
#include "gx_input.h"
|
||||
#include "../driver.h"
|
||||
#include "../libretro.h"
|
||||
#include <stdlib.h>
|
||||
|
||||
#define JOYSTICK_THRESHOLD 64
|
||||
|
||||
static uint64_t pad_state[4];
|
||||
|
||||
const struct platform_bind platform_keys[] = {
|
||||
{ WII_GC_A, "GC A button" },
|
||||
{ WII_GC_B, "GC B button" },
|
||||
{ WII_GC_X, "GC X button" },
|
||||
{ WII_GC_Y, "GC Y button" },
|
||||
{ WII_GC_UP, "GC D-Pad Up" },
|
||||
{ WII_GC_DOWN, "GC D-Pad Down" },
|
||||
{ WII_GC_LEFT, "GC D-Pad Left" },
|
||||
{ WII_GC_RIGHT, "GC D-Pad Right" },
|
||||
{ WII_GC_Z_TRIGGER, "GC Z Trigger" },
|
||||
{ WII_GC_START, "GC Start button" },
|
||||
{ WII_GC_L_TRIGGER, "GC Left Trigger" },
|
||||
{ WII_GC_R_TRIGGER, "GC Right Trigger" },
|
||||
{ WII_GC_LSTICK_LEFT, "GC Main Stick Left" },
|
||||
{ WII_GC_LSTICK_RIGHT, "GC Main Stick Right" },
|
||||
{ WII_GC_LSTICK_UP, "GC Main Stick Up" },
|
||||
{ WII_GC_LSTICK_DOWN, "GC Main Stick Down" },
|
||||
{ WII_GC_LSTICK_LEFT | WII_GC_LEFT, "GC Main Stick D-Pad Left" },
|
||||
{ WII_GC_LSTICK_RIGHT | WII_GC_RIGHT, "GC Main Stick D-Pad Right" },
|
||||
{ WII_GC_LSTICK_UP | WII_GC_UP, "GC Main Stick D-Pad Up" },
|
||||
{ WII_GC_LSTICK_DOWN | WII_GC_DOWN, "GC Main Stick D-Pad Down" },
|
||||
{ WII_GC_RSTICK_LEFT, "GC C-Stick Left" },
|
||||
{ WII_GC_RSTICK_RIGHT, "GC C-Stick Right" },
|
||||
{ WII_GC_RSTICK_UP, "GC C-Stick Up" },
|
||||
{ WII_GC_RSTICK_DOWN, "GC C-Stick Down" },
|
||||
{ WII_GC_RSTICK_LEFT | WII_GC_LEFT, "GC C-Stick D-Pad Left" },
|
||||
{ WII_GC_RSTICK_RIGHT | WII_GC_RIGHT, "GC C-Stick D-Pad Right" },
|
||||
{ WII_GC_RSTICK_UP | WII_GC_UP, "GC C-Stick D-Pad Up" },
|
||||
{ WII_GC_RSTICK_DOWN | WII_GC_DOWN, "GC C-Stick D-Pad Down" },
|
||||
|
||||
#ifdef HW_RVL
|
||||
// CLASSIC CONTROLLER
|
||||
{ WII_CLASSIC_A, "Classic A button" },
|
||||
{ WII_CLASSIC_B, "Classic B button" },
|
||||
{ WII_CLASSIC_X, "Classic X button" },
|
||||
{ WII_CLASSIC_Y, "Classic Y button" },
|
||||
{ WII_CLASSIC_UP, "Classic D-Pad Up" },
|
||||
{ WII_CLASSIC_DOWN, "Classic D-Pad Down" },
|
||||
{ WII_CLASSIC_LEFT, "Classic D-Pad Left" },
|
||||
{ WII_CLASSIC_RIGHT, "Classic D-Pad Right" },
|
||||
{ WII_CLASSIC_PLUS, "Classic Plus button" },
|
||||
{ WII_CLASSIC_MINUS, "Classic Minus button" },
|
||||
{ WII_CLASSIC_HOME, "Classic Home button" },
|
||||
{ WII_CLASSIC_L_TRIGGER, "Classic L Trigger" },
|
||||
{ WII_CLASSIC_R_TRIGGER, "Classic R Trigger" },
|
||||
{ WII_CLASSIC_ZL_TRIGGER, "Classic ZL Trigger" },
|
||||
{ WII_CLASSIC_ZR_TRIGGER, "Classic ZR Trigger" },
|
||||
{ WII_CLASSIC_LSTICK_LEFT, "Classic LStick Left" },
|
||||
{ WII_CLASSIC_LSTICK_RIGHT, "Classic LStick Right" },
|
||||
{ WII_CLASSIC_LSTICK_UP, "Classic LStick Up" },
|
||||
{ WII_CLASSIC_LSTICK_DOWN, "Classic LStick Down" },
|
||||
{ WII_CLASSIC_LSTICK_LEFT | WII_CLASSIC_LEFT, "Classic LStick D-Pad Left" },
|
||||
{ WII_CLASSIC_LSTICK_RIGHT | WII_CLASSIC_RIGHT, "Classic LStick D-Pad Right" },
|
||||
{ WII_CLASSIC_LSTICK_UP | WII_CLASSIC_UP, "Classic LStick D-Pad Up" },
|
||||
{ WII_CLASSIC_LSTICK_DOWN | WII_CLASSIC_DOWN, "Classic LStick D-Pad Down" },
|
||||
{ WII_CLASSIC_RSTICK_LEFT, "Classic RStick Left" },
|
||||
{ WII_CLASSIC_RSTICK_RIGHT, "Classic RStick Right" },
|
||||
{ WII_CLASSIC_RSTICK_UP, "Classic RStick Up" },
|
||||
{ WII_CLASSIC_RSTICK_DOWN, "Classic RStick Down" },
|
||||
{ WII_CLASSIC_RSTICK_LEFT | WII_CLASSIC_LEFT, "Classic RStick D-Pad Left" },
|
||||
{ WII_CLASSIC_RSTICK_RIGHT | WII_CLASSIC_RIGHT, "Classic RStick D-Pad Right" },
|
||||
{ WII_CLASSIC_RSTICK_UP | WII_CLASSIC_UP, "Classic RStick D-Pad Up" },
|
||||
{ WII_CLASSIC_RSTICK_DOWN | WII_CLASSIC_DOWN, "Classic RStick D-Pad Down" },
|
||||
|
||||
// WIIMOTE (PLUS OPTIONAL NUNCHUK)
|
||||
{ WII_WIIMOTE_A, "Wiimote A button" },
|
||||
{ WII_WIIMOTE_B, "Wiimote B button" },
|
||||
{ WII_WIIMOTE_1, "Wiimote 1 button" },
|
||||
{ WII_WIIMOTE_2, "Wiimote 2 button" },
|
||||
{ WII_WIIMOTE_UP, "Wiimote D-Pad Up" },
|
||||
{ WII_WIIMOTE_DOWN, "Wiimote D-Pad Down" },
|
||||
{ WII_WIIMOTE_LEFT, "Wiimote D-Pad Left" },
|
||||
{ WII_WIIMOTE_RIGHT, "Wiimote D-Pad Right" },
|
||||
{ WII_WIIMOTE_PLUS, "Wiimote Plus button" },
|
||||
{ WII_WIIMOTE_MINUS, "Wiimote Minus button" },
|
||||
{ WII_WIIMOTE_HOME, "Wiimote Home button" },
|
||||
{ WII_NUNCHUK_Z, "Nunchuk Z button" },
|
||||
{ WII_NUNCHUK_C, "Nunchuk C button" },
|
||||
{ WII_NUNCHUK_LEFT, "Nunchuk Stick Left" },
|
||||
{ WII_NUNCHUK_RIGHT, "Nunchuk Stick Right" },
|
||||
{ WII_NUNCHUK_UP, "Nunchuk Stick Up" },
|
||||
{ WII_NUNCHUK_DOWN, "Nunchuk Stick Down" },
|
||||
{ WII_NUNCHUK_LEFT | WII_WIIMOTE_LEFT, "Nunchuk Stick D-Pad Left" },
|
||||
{ WII_NUNCHUK_RIGHT | WII_WIIMOTE_RIGHT, "Nunchuk Stick D-Pad Right" },
|
||||
{ WII_NUNCHUK_UP | WII_WIIMOTE_UP, "Nunchuk Stick D-Pad Up" },
|
||||
{ WII_NUNCHUK_DOWN | WII_WIIMOTE_DOWN, "Nunchuk Stick D-Pad Down" },
|
||||
#endif
|
||||
};
|
||||
|
||||
const unsigned int platform_keys_size = sizeof(platform_keys);
|
||||
static bool g_quit;
|
||||
|
||||
static int16_t wii_input_state(void *data, const struct retro_keybind **binds,
|
||||
unsigned port, unsigned device,
|
||||
unsigned index, unsigned id)
|
||||
{
|
||||
(void)data;
|
||||
(void)index;
|
||||
|
||||
if (port >= 4 || device != RETRO_DEVICE_JOYPAD)
|
||||
return 0;
|
||||
|
||||
return (binds[port][id].joykey & pad_state[port]) ? 1 : 0;
|
||||
}
|
||||
|
||||
static void wii_free_input(void *data)
|
||||
{
|
||||
(void)data;
|
||||
}
|
||||
|
||||
static void reset_callback(void)
|
||||
{
|
||||
g_quit = true;
|
||||
}
|
||||
|
||||
void wii_input_map_dpad_to_stick(uint32_t map_dpad_enum, uint32_t controller_id)
|
||||
{
|
||||
// TODO: how do we choose a classic controller configuration over a gc controller one?
|
||||
switch(map_dpad_enum)
|
||||
{
|
||||
case DPAD_EMULATION_NONE:
|
||||
g_settings.input.binds[controller_id][RETRO_DEVICE_ID_JOYPAD_UP].joykey = platform_keys[WII_DEVICE_GC_ID_JOYPAD_UP].joykey;
|
||||
g_settings.input.binds[controller_id][RETRO_DEVICE_ID_JOYPAD_DOWN].joykey = platform_keys[WII_DEVICE_GC_ID_JOYPAD_DOWN].joykey;
|
||||
g_settings.input.binds[controller_id][RETRO_DEVICE_ID_JOYPAD_LEFT].joykey = platform_keys[WII_DEVICE_GC_ID_JOYPAD_LEFT].joykey;
|
||||
g_settings.input.binds[controller_id][RETRO_DEVICE_ID_JOYPAD_RIGHT].joykey = platform_keys[WII_DEVICE_GC_ID_JOYPAD_RIGHT].joykey;
|
||||
break;
|
||||
case DPAD_EMULATION_LSTICK:
|
||||
g_settings.input.binds[controller_id][RETRO_DEVICE_ID_JOYPAD_UP].joykey = platform_keys[WII_DEVICE_GC_ID_LSTICK_UP_DPAD].joykey;
|
||||
g_settings.input.binds[controller_id][RETRO_DEVICE_ID_JOYPAD_DOWN].joykey = platform_keys[WII_DEVICE_GC_ID_LSTICK_DOWN_DPAD].joykey;
|
||||
g_settings.input.binds[controller_id][RETRO_DEVICE_ID_JOYPAD_LEFT].joykey = platform_keys[WII_DEVICE_GC_ID_LSTICK_LEFT_DPAD].joykey;
|
||||
g_settings.input.binds[controller_id][RETRO_DEVICE_ID_JOYPAD_RIGHT].joykey = platform_keys[WII_DEVICE_GC_ID_LSTICK_RIGHT_DPAD].joykey;
|
||||
break;
|
||||
case DPAD_EMULATION_RSTICK:
|
||||
g_settings.input.binds[controller_id][RETRO_DEVICE_ID_JOYPAD_UP].joykey = platform_keys[WII_DEVICE_GC_ID_RSTICK_UP_DPAD].joykey;
|
||||
g_settings.input.binds[controller_id][RETRO_DEVICE_ID_JOYPAD_DOWN].joykey = platform_keys[WII_DEVICE_GC_ID_RSTICK_DOWN_DPAD].joykey;
|
||||
g_settings.input.binds[controller_id][RETRO_DEVICE_ID_JOYPAD_LEFT].joykey = platform_keys[WII_DEVICE_GC_ID_RSTICK_LEFT_DPAD].joykey;
|
||||
g_settings.input.binds[controller_id][RETRO_DEVICE_ID_JOYPAD_RIGHT].joykey = platform_keys[WII_DEVICE_GC_ID_RSTICK_RIGHT_DPAD].joykey;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void *wii_input_initialize(void)
|
||||
{
|
||||
PAD_Init();
|
||||
#ifdef HW_RVL
|
||||
WPAD_Init();
|
||||
#endif
|
||||
SYS_SetResetCallback(reset_callback);
|
||||
SYS_SetPowerCallback(reset_callback);
|
||||
for(unsigned i = 0; i < 4; i++)
|
||||
wii_input_map_dpad_to_stick(g_settings.input.dpad_emulation[i], i);
|
||||
return (void*)-1;
|
||||
}
|
||||
|
||||
#define wii_stick_x(x) ((s8)((sin((x).ang * M_PI / 180.0f)) * (x).mag * 128.0f))
|
||||
#define wii_stick_y(x) ((s8)((cos((x).ang * M_PI / 180.0f)) * (x).mag * 128.0f))
|
||||
|
||||
static void wii_input_poll(void *data)
|
||||
{
|
||||
(void)data;
|
||||
|
||||
unsigned pads = PAD_ScanPads();
|
||||
#ifdef HW_RVL
|
||||
unsigned wpads = WPAD_ScanPads();
|
||||
#endif
|
||||
|
||||
for (unsigned port = 0; port < 4; port++)
|
||||
{
|
||||
uint64_t state = 0;
|
||||
if (port < pads)
|
||||
{
|
||||
uint16_t down = PAD_ButtonsHeld(port) | PAD_ButtonsDown(port);
|
||||
down &= ~PAD_ButtonsUp(port);
|
||||
|
||||
state |= (down & PAD_BUTTON_A) ? WII_GC_A : 0;
|
||||
state |= (down & PAD_BUTTON_B) ? WII_GC_B : 0;
|
||||
state |= (down & PAD_BUTTON_X) ? WII_GC_X : 0;
|
||||
state |= (down & PAD_BUTTON_Y) ? WII_GC_Y : 0;
|
||||
state |= (down & PAD_BUTTON_UP) ? WII_GC_UP : 0;
|
||||
state |= (down & PAD_BUTTON_DOWN) ? WII_GC_DOWN : 0;
|
||||
state |= (down & PAD_BUTTON_LEFT) ? WII_GC_LEFT : 0;
|
||||
state |= (down & PAD_BUTTON_RIGHT) ? WII_GC_RIGHT : 0;
|
||||
state |= (down & PAD_BUTTON_START) ? WII_GC_START : 0;
|
||||
state |= (down & PAD_TRIGGER_Z) ? WII_GC_Z_TRIGGER : 0;
|
||||
state |= (PAD_TriggerL(port) > 127) ? WII_GC_L_TRIGGER : 0;
|
||||
state |= (PAD_TriggerR(port) > 127) ? WII_GC_R_TRIGGER : 0;
|
||||
|
||||
s8 x = PAD_StickX(port);
|
||||
s8 y = PAD_StickY(port);
|
||||
|
||||
if (abs(x) > JOYSTICK_THRESHOLD)
|
||||
{
|
||||
state |= x > 0 ? WII_GC_LSTICK_RIGHT : WII_GC_LSTICK_LEFT;
|
||||
}
|
||||
if (abs(y) > JOYSTICK_THRESHOLD)
|
||||
{
|
||||
state |= y > 0 ? WII_GC_LSTICK_UP : WII_GC_LSTICK_DOWN;
|
||||
}
|
||||
|
||||
x = PAD_SubStickX(port);
|
||||
y = PAD_SubStickY(port);
|
||||
|
||||
if (abs(x) > JOYSTICK_THRESHOLD)
|
||||
{
|
||||
state |= x > 0 ? WII_GC_RSTICK_RIGHT : WII_GC_RSTICK_LEFT;
|
||||
}
|
||||
if (abs(y) > JOYSTICK_THRESHOLD)
|
||||
{
|
||||
state |= y > 0 ? WII_GC_RSTICK_UP : WII_GC_RSTICK_DOWN;
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef HW_RVL
|
||||
if (port < wpads)
|
||||
{
|
||||
uint32_t down = WPAD_ButtonsHeld(port) | WPAD_ButtonsDown(port);
|
||||
down &= ~WPAD_ButtonsUp(port);
|
||||
|
||||
state |= (down & WPAD_BUTTON_A) ? WII_WIIMOTE_A : 0;
|
||||
state |= (down & WPAD_BUTTON_B) ? WII_WIIMOTE_B : 0;
|
||||
state |= (down & WPAD_BUTTON_1) ? WII_WIIMOTE_1 : 0;
|
||||
state |= (down & WPAD_BUTTON_2) ? WII_WIIMOTE_2 : 0;
|
||||
state |= (down & WPAD_BUTTON_PLUS) ? WII_WIIMOTE_PLUS : 0;
|
||||
state |= (down & WPAD_BUTTON_MINUS) ? WII_WIIMOTE_MINUS : 0;
|
||||
state |= (down & WPAD_BUTTON_HOME) ? WII_WIIMOTE_HOME : 0;
|
||||
|
||||
expansion_t exp;
|
||||
WPAD_Expansion(port, &exp);
|
||||
switch (exp.type)
|
||||
{
|
||||
case WPAD_EXP_NUNCHUK:
|
||||
{
|
||||
// wiimote is held upright with nunchuk, do not change d-pad orientation
|
||||
state |= (down & WPAD_BUTTON_UP) ? WII_WIIMOTE_UP : 0;
|
||||
state |= (down & WPAD_BUTTON_DOWN) ? WII_WIIMOTE_DOWN : 0;
|
||||
state |= (down & WPAD_BUTTON_LEFT) ? WII_WIIMOTE_LEFT : 0;
|
||||
state |= (down & WPAD_BUTTON_RIGHT) ? WII_WIIMOTE_RIGHT : 0;
|
||||
|
||||
state |= (down & WPAD_NUNCHUK_BUTTON_Z) ? WII_NUNCHUK_Z : 0;
|
||||
state |= (down & WPAD_NUNCHUK_BUTTON_C) ? WII_NUNCHUK_C : 0;
|
||||
|
||||
s8 x = wii_stick_x(exp.nunchuk.js);
|
||||
s8 y = wii_stick_y(exp.nunchuk.js);
|
||||
|
||||
if (abs(x) > JOYSTICK_THRESHOLD)
|
||||
{
|
||||
state |= x > 0 ? WII_NUNCHUK_RIGHT : WII_NUNCHUK_LEFT;
|
||||
}
|
||||
if (abs(y) > JOYSTICK_THRESHOLD)
|
||||
{
|
||||
state |= y > 0 ? WII_NUNCHUK_UP : WII_NUNCHUK_DOWN;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case WPAD_EXP_CLASSIC:
|
||||
{
|
||||
state |= (down & WPAD_CLASSIC_BUTTON_A) ? WII_CLASSIC_A : 0;
|
||||
state |= (down & WPAD_CLASSIC_BUTTON_B) ? WII_CLASSIC_B : 0;
|
||||
state |= (down & WPAD_CLASSIC_BUTTON_X) ? WII_CLASSIC_X : 0;
|
||||
state |= (down & WPAD_CLASSIC_BUTTON_Y) ? WII_CLASSIC_Y : 0;
|
||||
state |= (down & WPAD_CLASSIC_BUTTON_PLUS) ? WII_CLASSIC_PLUS : 0;
|
||||
state |= (down & WPAD_CLASSIC_BUTTON_MINUS) ? WII_CLASSIC_MINUS : 0;
|
||||
state |= (down & WPAD_CLASSIC_BUTTON_HOME) ? WII_CLASSIC_HOME : 0;
|
||||
state |= (down & WPAD_CLASSIC_BUTTON_FULL_L) ? WII_CLASSIC_L_TRIGGER : 0;
|
||||
state |= (down & WPAD_CLASSIC_BUTTON_FULL_R) ? WII_CLASSIC_R_TRIGGER : 0;
|
||||
state |= (down & WPAD_CLASSIC_BUTTON_ZL) ? WII_CLASSIC_ZL_TRIGGER : 0;
|
||||
state |= (down & WPAD_CLASSIC_BUTTON_ZR) ? WII_CLASSIC_ZR_TRIGGER : 0;
|
||||
|
||||
s8 x = wii_stick_x(exp.classic.ljs);
|
||||
s8 y = wii_stick_y(exp.classic.ljs);
|
||||
|
||||
if (abs(x) > JOYSTICK_THRESHOLD)
|
||||
{
|
||||
state |= x > 0 ? WII_CLASSIC_LSTICK_RIGHT : WII_CLASSIC_LSTICK_LEFT;
|
||||
}
|
||||
if (abs(y) > JOYSTICK_THRESHOLD)
|
||||
{
|
||||
state |= y > 0 ? WII_CLASSIC_LSTICK_UP : WII_CLASSIC_LSTICK_DOWN;
|
||||
}
|
||||
|
||||
x = wii_stick_x(exp.classic.rjs);
|
||||
y = wii_stick_y(exp.classic.rjs);
|
||||
|
||||
if (abs(x) > JOYSTICK_THRESHOLD)
|
||||
{
|
||||
state |= x > 0 ? WII_CLASSIC_RSTICK_RIGHT : WII_CLASSIC_RSTICK_LEFT;
|
||||
}
|
||||
if (abs(y) > JOYSTICK_THRESHOLD)
|
||||
{
|
||||
state |= y > 0 ? WII_CLASSIC_RSTICK_UP : WII_CLASSIC_RSTICK_DOWN;
|
||||
}
|
||||
// do not return, fall through for wiimote d-pad
|
||||
}
|
||||
default:
|
||||
// rotated d-pad
|
||||
state |= (down & WPAD_BUTTON_UP) ? WII_WIIMOTE_LEFT : 0;
|
||||
state |= (down & WPAD_BUTTON_DOWN) ? WII_WIIMOTE_RIGHT : 0;
|
||||
state |= (down & WPAD_BUTTON_LEFT) ? WII_WIIMOTE_DOWN : 0;
|
||||
state |= (down & WPAD_BUTTON_RIGHT) ? WII_WIIMOTE_UP : 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
if ((state & (WII_GC_START | WII_GC_Z_TRIGGER | WII_GC_L_TRIGGER | WII_GC_R_TRIGGER)) == (WII_GC_START | WII_GC_Z_TRIGGER | WII_GC_L_TRIGGER | WII_GC_R_TRIGGER))
|
||||
{
|
||||
state |= WII_WIIMOTE_HOME;
|
||||
}
|
||||
|
||||
pad_state[port] = state;
|
||||
}
|
||||
|
||||
if (g_quit)
|
||||
{
|
||||
pad_state[0] |= WII_WIIMOTE_HOME;
|
||||
g_quit = false;
|
||||
}
|
||||
}
|
||||
|
||||
static bool wii_key_pressed(void *data, int key)
|
||||
{
|
||||
(void)data;
|
||||
switch (key)
|
||||
{
|
||||
case RARCH_QUIT_KEY:
|
||||
return pad_state[0] & (WII_CLASSIC_HOME | WII_WIIMOTE_HOME) ? true : false;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
static void wii_set_default_keybind_lut(void)
|
||||
{
|
||||
rarch_default_keybind_lut[RETRO_DEVICE_ID_JOYPAD_B] = platform_keys[WII_DEVICE_GC_ID_JOYPAD_B].joykey;
|
||||
rarch_default_keybind_lut[RETRO_DEVICE_ID_JOYPAD_Y] = platform_keys[WII_DEVICE_GC_ID_JOYPAD_Y].joykey;
|
||||
rarch_default_keybind_lut[RETRO_DEVICE_ID_JOYPAD_SELECT] = platform_keys[WII_DEVICE_GC_ID_JOYPAD_Z_TRIGGER].joykey;
|
||||
rarch_default_keybind_lut[RETRO_DEVICE_ID_JOYPAD_START] = platform_keys[WII_DEVICE_GC_ID_JOYPAD_START].joykey;
|
||||
rarch_default_keybind_lut[RETRO_DEVICE_ID_JOYPAD_UP] = platform_keys[WII_DEVICE_GC_ID_JOYPAD_UP].joykey;
|
||||
rarch_default_keybind_lut[RETRO_DEVICE_ID_JOYPAD_DOWN] = platform_keys[WII_DEVICE_GC_ID_JOYPAD_DOWN].joykey;
|
||||
rarch_default_keybind_lut[RETRO_DEVICE_ID_JOYPAD_LEFT] = platform_keys[WII_DEVICE_GC_ID_JOYPAD_LEFT].joykey;
|
||||
rarch_default_keybind_lut[RETRO_DEVICE_ID_JOYPAD_RIGHT] = platform_keys[WII_DEVICE_GC_ID_JOYPAD_RIGHT].joykey;
|
||||
rarch_default_keybind_lut[RETRO_DEVICE_ID_JOYPAD_A] = platform_keys[WII_DEVICE_GC_ID_JOYPAD_A].joykey;
|
||||
rarch_default_keybind_lut[RETRO_DEVICE_ID_JOYPAD_X] = platform_keys[WII_DEVICE_GC_ID_JOYPAD_X].joykey;
|
||||
rarch_default_keybind_lut[RETRO_DEVICE_ID_JOYPAD_L] = platform_keys[WII_DEVICE_GC_ID_JOYPAD_L_TRIGGER].joykey;
|
||||
rarch_default_keybind_lut[RETRO_DEVICE_ID_JOYPAD_R] = platform_keys[WII_DEVICE_GC_ID_JOYPAD_R_TRIGGER].joykey;
|
||||
rarch_default_keybind_lut[RETRO_DEVICE_ID_JOYPAD_L2] = 0;
|
||||
rarch_default_keybind_lut[RETRO_DEVICE_ID_JOYPAD_R2] = 0;
|
||||
rarch_default_keybind_lut[RETRO_DEVICE_ID_JOYPAD_L3] = 0;
|
||||
rarch_default_keybind_lut[RETRO_DEVICE_ID_JOYPAD_R3] = 0;
|
||||
}
|
||||
|
||||
const input_driver_t input_wii = {
|
||||
.init = wii_input_initialize,
|
||||
.poll = wii_input_poll,
|
||||
.input_state = wii_input_state,
|
||||
.key_pressed = wii_key_pressed,
|
||||
.free = wii_free_input,
|
||||
.set_default_keybind_lut = wii_set_default_keybind_lut,
|
||||
.ident = "wii",
|
||||
};
|
177
wii/gx_input.h
Normal file
177
wii/gx_input.h
Normal file
@ -0,0 +1,177 @@
|
||||
/* RetroArch - A frontend for libretro.
|
||||
* Copyright (C) 2010-2012 - Hans-Kristian Arntzen
|
||||
* Copyright (C) 2011-2012 - Daniel De Matteis
|
||||
* Copyright (C) 2012 - Michael Lelli
|
||||
*
|
||||
* 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 _WII_INPUT_H
|
||||
#define _WII_INPUT_H
|
||||
|
||||
enum
|
||||
{
|
||||
WII_GC_A = 1ULL << 0,
|
||||
WII_GC_B = 1ULL << 1,
|
||||
WII_GC_X = 1ULL << 2,
|
||||
WII_GC_Y = 1ULL << 3,
|
||||
WII_GC_START = 1ULL << 4,
|
||||
WII_GC_Z_TRIGGER = 1ULL << 5,
|
||||
WII_GC_L_TRIGGER = 1ULL << 6,
|
||||
WII_GC_R_TRIGGER = 1ULL << 7,
|
||||
WII_GC_UP = 1ULL << 8,
|
||||
WII_GC_DOWN = 1ULL << 9,
|
||||
WII_GC_LEFT = 1ULL << 10,
|
||||
WII_GC_RIGHT = 1ULL << 11,
|
||||
WII_GC_LSTICK_UP = 1ULL << 12,
|
||||
WII_GC_LSTICK_DOWN = 1ULL << 13,
|
||||
WII_GC_LSTICK_LEFT = 1ULL << 14,
|
||||
WII_GC_LSTICK_RIGHT = 1ULL << 15,
|
||||
WII_GC_RSTICK_UP = 1ULL << 16,
|
||||
WII_GC_RSTICK_DOWN = 1ULL << 17,
|
||||
WII_GC_RSTICK_LEFT = 1ULL << 18,
|
||||
WII_GC_RSTICK_RIGHT = 1ULL << 19,
|
||||
WII_CLASSIC_A = 1ULL << 20,
|
||||
WII_CLASSIC_B = 1ULL << 21,
|
||||
WII_CLASSIC_X = 1ULL << 22,
|
||||
WII_CLASSIC_Y = 1ULL << 23,
|
||||
WII_CLASSIC_PLUS = 1ULL << 24,
|
||||
WII_CLASSIC_MINUS = 1ULL << 25,
|
||||
WII_CLASSIC_HOME = 1ULL << 26,
|
||||
WII_CLASSIC_L_TRIGGER = 1ULL << 27,
|
||||
WII_CLASSIC_R_TRIGGER = 1ULL << 28,
|
||||
WII_CLASSIC_ZL_TRIGGER = 1ULL << 29,
|
||||
WII_CLASSIC_ZR_TRIGGER = 1ULL << 30,
|
||||
WII_CLASSIC_UP = 1ULL << 31,
|
||||
WII_CLASSIC_DOWN = 1ULL << 32,
|
||||
WII_CLASSIC_LEFT = 1ULL << 33,
|
||||
WII_CLASSIC_RIGHT = 1ULL << 34,
|
||||
WII_CLASSIC_LSTICK_UP = 1ULL << 35,
|
||||
WII_CLASSIC_LSTICK_DOWN = 1ULL << 36,
|
||||
WII_CLASSIC_LSTICK_LEFT = 1ULL << 37,
|
||||
WII_CLASSIC_LSTICK_RIGHT = 1ULL << 38,
|
||||
WII_CLASSIC_RSTICK_UP = 1ULL << 39,
|
||||
WII_CLASSIC_RSTICK_DOWN = 1ULL << 40,
|
||||
WII_CLASSIC_RSTICK_LEFT = 1ULL << 41,
|
||||
WII_CLASSIC_RSTICK_RIGHT = 1ULL << 42,
|
||||
WII_WIIMOTE_A = 1ULL << 43,
|
||||
WII_WIIMOTE_B = 1ULL << 44,
|
||||
WII_WIIMOTE_1 = 1ULL << 45,
|
||||
WII_WIIMOTE_2 = 1ULL << 46,
|
||||
WII_WIIMOTE_PLUS = 1ULL << 47,
|
||||
WII_WIIMOTE_MINUS = 1ULL << 48,
|
||||
WII_WIIMOTE_HOME = 1ULL << 49,
|
||||
WII_WIIMOTE_UP = 1ULL << 50,
|
||||
WII_WIIMOTE_DOWN = 1ULL << 51,
|
||||
WII_WIIMOTE_LEFT = 1ULL << 52,
|
||||
WII_WIIMOTE_RIGHT = 1ULL << 53,
|
||||
WII_NUNCHUK_Z = 1ULL << 54,
|
||||
WII_NUNCHUK_C = 1ULL << 55,
|
||||
WII_NUNCHUK_UP = 1ULL << 56,
|
||||
WII_NUNCHUK_DOWN = 1ULL << 57,
|
||||
WII_NUNCHUK_LEFT = 1ULL << 58,
|
||||
WII_NUNCHUK_RIGHT = 1ULL << 59,
|
||||
};
|
||||
|
||||
enum wii_device_id
|
||||
{
|
||||
WII_DEVICE_GC_ID_JOYPAD_A = 0,
|
||||
WII_DEVICE_GC_ID_JOYPAD_B,
|
||||
WII_DEVICE_GC_ID_JOYPAD_X,
|
||||
WII_DEVICE_GC_ID_JOYPAD_Y,
|
||||
WII_DEVICE_GC_ID_JOYPAD_UP,
|
||||
WII_DEVICE_GC_ID_JOYPAD_DOWN,
|
||||
WII_DEVICE_GC_ID_JOYPAD_LEFT,
|
||||
WII_DEVICE_GC_ID_JOYPAD_RIGHT,
|
||||
WII_DEVICE_GC_ID_JOYPAD_Z_TRIGGER,
|
||||
WII_DEVICE_GC_ID_JOYPAD_START,
|
||||
WII_DEVICE_GC_ID_JOYPAD_L_TRIGGER,
|
||||
WII_DEVICE_GC_ID_JOYPAD_R_TRIGGER,
|
||||
WII_DEVICE_GC_ID_LSTICK_LEFT,
|
||||
WII_DEVICE_GC_ID_LSTICK_RIGHT,
|
||||
WII_DEVICE_GC_ID_LSTICK_UP,
|
||||
WII_DEVICE_GC_ID_LSTICK_DOWN,
|
||||
WII_DEVICE_GC_ID_LSTICK_LEFT_DPAD,
|
||||
WII_DEVICE_GC_ID_LSTICK_RIGHT_DPAD,
|
||||
WII_DEVICE_GC_ID_LSTICK_UP_DPAD,
|
||||
WII_DEVICE_GC_ID_LSTICK_DOWN_DPAD,
|
||||
WII_DEVICE_GC_ID_RSTICK_LEFT,
|
||||
WII_DEVICE_GC_ID_RSTICK_RIGHT,
|
||||
WII_DEVICE_GC_ID_RSTICK_UP,
|
||||
WII_DEVICE_GC_ID_RSTICK_DOWN,
|
||||
WII_DEVICE_GC_ID_RSTICK_LEFT_DPAD,
|
||||
WII_DEVICE_GC_ID_RSTICK_RIGHT_DPAD,
|
||||
WII_DEVICE_GC_ID_RSTICK_UP_DPAD,
|
||||
WII_DEVICE_GC_ID_RSTICK_DOWN_DPAD,
|
||||
|
||||
#ifdef HW_RVL
|
||||
// CLASSIC CONTROLLER
|
||||
WII_DEVICE_CLASSIC_ID_JOYPAD_A,
|
||||
WII_DEVICE_CLASSIC_ID_JOYPAD_B,
|
||||
WII_DEVICE_CLASSIC_ID_JOYPAD_X,
|
||||
WII_DEVICE_CLASSIC_ID_JOYPAD_Y,
|
||||
WII_DEVICE_CLASSIC_ID_JOYPAD_UP,
|
||||
WII_DEVICE_CLASSIC_ID_JOYPAD_DOWN,
|
||||
WII_DEVICE_CLASSIC_ID_JOYPAD_LEFT,
|
||||
WII_DEVICE_CLASSIC_ID_JOYPAD_RIGHT,
|
||||
WII_DEVICE_CLASSIC_ID_JOYPAD_PLUS,
|
||||
WII_DEVICE_CLASSIC_ID_JOYPAD_MINUS,
|
||||
WII_DEVICE_CLASSIC_ID_JOYPAD_HOME,
|
||||
WII_DEVICE_CLASSIC_ID_JOYPAD_L_TRIGGER,
|
||||
WII_DEVICE_CLASSIC_ID_JOYPAD_R_TRIGGER,
|
||||
WII_DEVICE_CLASSIC_ID_JOYPAD_ZL_TRIGGER,
|
||||
WII_DEVICE_CLASSIC_ID_JOYPAD_ZR_TRIGGER,
|
||||
WII_DEVICE_CLASSIC_ID_LSTICK_LEFT,
|
||||
WII_DEVICE_CLASSIC_ID_LSTICK_RIGHT,
|
||||
WII_DEVICE_CLASSIC_ID_LSTICK_UP,
|
||||
WII_DEVICE_CLASSIC_ID_LSTICK_DOWN,
|
||||
WII_DEVICE_CLASSIC_ID_LSTICK_LEFT_DPAD,
|
||||
WII_DEVICE_CLASSIC_ID_LSTICK_RIGHT_DPAD,
|
||||
WII_DEVICE_CLASSIC_ID_LSTICK_UP_DPAD,
|
||||
WII_DEVICE_CLASSIC_ID_LSTICK_DOWN_DPAD,
|
||||
WII_DEVICE_CLASSIC_ID_RSTICK_LEFT,
|
||||
WII_DEVICE_CLASSIC_ID_RSTICK_RIGHT,
|
||||
WII_DEVICE_CLASSIC_ID_RSTICK_UP,
|
||||
WII_DEVICE_CLASSIC_ID_RSTICK_DOWN,
|
||||
WII_DEVICE_CLASSIC_ID_RSTICK_LEFT_DPAD,
|
||||
WII_DEVICE_CLASSIC_ID_RSTICK_RIGHT_DPAD,
|
||||
WII_DEVICE_CLASSIC_ID_RSTICK_UP_DPAD,
|
||||
WII_DEVICE_CLASSIC_ID_RSTICK_DOWN_DPAD,
|
||||
|
||||
// WIIMOTE (PLUS OPTIONAL NUNCHUK)
|
||||
WII_DEVICE_WIIMOTE_ID_JOYPAD_A,
|
||||
WII_DEVICE_WIIMOTE_ID_JOYPAD_B,
|
||||
WII_DEVICE_WIIMOTE_ID_JOYPAD_1,
|
||||
WII_DEVICE_WIIMOTE_ID_JOYPAD_2,
|
||||
WII_DEVICE_WIIMOTE_ID_JOYPAD_UP,
|
||||
WII_DEVICE_WIIMOTE_ID_JOYPAD_DOWN,
|
||||
WII_DEVICE_WIIMOTE_ID_JOYPAD_LEFT,
|
||||
WII_DEVICE_WIIMOTE_ID_JOYPAD_RIGHT,
|
||||
WII_DEVICE_WIIMOTE_ID_JOYPAD_PLUS,
|
||||
WII_DEVICE_WIIMOTE_ID_JOYPAD_MINUS,
|
||||
WII_DEVICE_WIIMOTE_ID_JOYPAD_HOME,
|
||||
WII_DEVICE_WIIMOTE_ID_JOYPAD_Z,
|
||||
WII_DEVICE_WIIMOTE_ID_JOYPAD_C,
|
||||
WII_DEVICE_WIIMOTE_ID_LSTICK_LEFT,
|
||||
WII_DEVICE_WIIMOTE_ID_LSTICK_RIGHT,
|
||||
WII_DEVICE_WIIMOTE_ID_LSTICK_UP,
|
||||
WII_DEVICE_WIIMOTE_ID_LSTICK_DOWN,
|
||||
WII_DEVICE_WIIMOTE_ID_LSTICK_LEFT_DPAD,
|
||||
WII_DEVICE_WIIMOTE_ID_LSTICK_RIGHT_DPAD,
|
||||
WII_DEVICE_WIIMOTE_ID_LSTICK_UP_DPAD,
|
||||
WII_DEVICE_WIIMOTE_ID_LSTICK_DOWN_DPAD,
|
||||
#endif
|
||||
|
||||
RARCH_LAST_PLATFORM_KEY
|
||||
};
|
||||
|
||||
#endif
|
165
wii/input.c
165
wii/input.c
@ -1,165 +0,0 @@
|
||||
/* RetroArch - A frontend for libretro.
|
||||
* Copyright (C) 2012 - Hans-Kristian Arntzen
|
||||
*
|
||||
* 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/>.
|
||||
*/
|
||||
|
||||
#include <stdint.h>
|
||||
#include <gccore.h>
|
||||
#include <ogc/pad.h>
|
||||
#ifdef HW_RVL
|
||||
#include <wiiuse/wpad.h>
|
||||
#endif
|
||||
#include <string.h>
|
||||
|
||||
#include "../driver.h"
|
||||
#include "../libretro.h"
|
||||
#include <stdlib.h>
|
||||
|
||||
static bool pad_state[5][RARCH_FIRST_META_KEY]; /* Gamecube pads */
|
||||
#ifdef HW_RVL
|
||||
static bool wpad_state[5][RARCH_FIRST_META_KEY]; /* Wii Classic pads */
|
||||
#endif
|
||||
|
||||
static bool g_quit;
|
||||
|
||||
static int16_t wii_input_state(void *data, const struct retro_keybind **binds,
|
||||
unsigned port, unsigned device,
|
||||
unsigned index, unsigned id)
|
||||
{
|
||||
(void)data;
|
||||
(void)binds;
|
||||
(void)index;
|
||||
|
||||
unsigned player = port;
|
||||
|
||||
return pad_state[player][id]
|
||||
#ifdef HW_RVL
|
||||
|| wpad_state[player][id]
|
||||
#endif
|
||||
;
|
||||
}
|
||||
|
||||
static void wii_free_input(void *data)
|
||||
{
|
||||
(void)data;
|
||||
}
|
||||
|
||||
static void reset_callback(void)
|
||||
{
|
||||
g_quit = true;
|
||||
}
|
||||
|
||||
static void *wii_input_initialize(void)
|
||||
{
|
||||
PAD_Init();
|
||||
#ifdef HW_RVL
|
||||
WPAD_Init();
|
||||
#endif
|
||||
SYS_SetResetCallback(reset_callback);
|
||||
SYS_SetPowerCallback(reset_callback);
|
||||
return (void*)-1;
|
||||
}
|
||||
|
||||
static void wii_input_poll(void *data)
|
||||
{
|
||||
(void)data;
|
||||
|
||||
unsigned pads = PAD_ScanPads();
|
||||
#ifdef HW_RVL
|
||||
unsigned wpads = WPAD_ScanPads();
|
||||
#endif
|
||||
|
||||
/* Gamecube controller */
|
||||
for (unsigned i = 0; i < pads; i++)
|
||||
{
|
||||
uint16_t down = PAD_ButtonsHeld(i) | PAD_ButtonsDown(i);
|
||||
down &= ~PAD_ButtonsUp(i);
|
||||
|
||||
pad_state[i][RETRO_DEVICE_ID_JOYPAD_B] = down & PAD_BUTTON_B;
|
||||
pad_state[i][RETRO_DEVICE_ID_JOYPAD_Y] = down & PAD_BUTTON_Y;
|
||||
pad_state[i][RETRO_DEVICE_ID_JOYPAD_SELECT] = down & PAD_TRIGGER_Z;
|
||||
pad_state[i][RETRO_DEVICE_ID_JOYPAD_START] = down & PAD_BUTTON_START;
|
||||
pad_state[i][RETRO_DEVICE_ID_JOYPAD_UP] = down & PAD_BUTTON_UP;
|
||||
pad_state[i][RETRO_DEVICE_ID_JOYPAD_DOWN] = down & PAD_BUTTON_DOWN;
|
||||
pad_state[i][RETRO_DEVICE_ID_JOYPAD_LEFT] = down & PAD_BUTTON_LEFT;
|
||||
pad_state[i][RETRO_DEVICE_ID_JOYPAD_RIGHT] = down & PAD_BUTTON_RIGHT;
|
||||
pad_state[i][RETRO_DEVICE_ID_JOYPAD_A] = down & PAD_BUTTON_A;
|
||||
pad_state[i][RETRO_DEVICE_ID_JOYPAD_X] = down & PAD_BUTTON_X;
|
||||
pad_state[i][RETRO_DEVICE_ID_JOYPAD_L] = down & PAD_TRIGGER_L;
|
||||
pad_state[i][RETRO_DEVICE_ID_JOYPAD_R] = down & PAD_TRIGGER_R;
|
||||
}
|
||||
|
||||
#ifdef HW_RVL
|
||||
/* Wii Classic controller */
|
||||
for (unsigned i = 0; i < wpads; i++)
|
||||
{
|
||||
uint32_t down = WPAD_ButtonsHeld(i) | WPAD_ButtonsDown(i);
|
||||
down &= ~WPAD_ButtonsUp(i);
|
||||
|
||||
wpad_state[i][RETRO_DEVICE_ID_JOYPAD_B] = down & (WPAD_BUTTON_B | WPAD_CLASSIC_BUTTON_B);
|
||||
wpad_state[i][RETRO_DEVICE_ID_JOYPAD_Y] = down & WPAD_CLASSIC_BUTTON_Y;
|
||||
wpad_state[i][RETRO_DEVICE_ID_JOYPAD_SELECT] = down & (WPAD_BUTTON_MINUS | WPAD_CLASSIC_BUTTON_MINUS);
|
||||
wpad_state[i][RETRO_DEVICE_ID_JOYPAD_START] = down & (WPAD_BUTTON_PLUS | WPAD_CLASSIC_BUTTON_PLUS);
|
||||
wpad_state[i][RETRO_DEVICE_ID_JOYPAD_UP] = down & (WPAD_BUTTON_UP | WPAD_CLASSIC_BUTTON_UP);
|
||||
wpad_state[i][RETRO_DEVICE_ID_JOYPAD_DOWN] = down & (WPAD_BUTTON_DOWN | WPAD_CLASSIC_BUTTON_DOWN);
|
||||
wpad_state[i][RETRO_DEVICE_ID_JOYPAD_LEFT] = down & (WPAD_BUTTON_LEFT | WPAD_CLASSIC_BUTTON_LEFT);
|
||||
wpad_state[i][RETRO_DEVICE_ID_JOYPAD_RIGHT] = down & (WPAD_BUTTON_RIGHT | WPAD_CLASSIC_BUTTON_RIGHT);
|
||||
wpad_state[i][RETRO_DEVICE_ID_JOYPAD_A] = down & (WPAD_BUTTON_A | WPAD_CLASSIC_BUTTON_A);
|
||||
wpad_state[i][RETRO_DEVICE_ID_JOYPAD_X] = down & WPAD_CLASSIC_BUTTON_X;
|
||||
wpad_state[i][RETRO_DEVICE_ID_JOYPAD_L] = down & WPAD_CLASSIC_BUTTON_FULL_L;
|
||||
wpad_state[i][RETRO_DEVICE_ID_JOYPAD_R] = down & WPAD_CLASSIC_BUTTON_FULL_R;
|
||||
|
||||
if (down & (WPAD_BUTTON_HOME | WPAD_CLASSIC_BUTTON_HOME) && i == 0)
|
||||
wpad_state[0][RETRO_DEVICE_ID_JOYPAD_L] = wpad_state[0][RETRO_DEVICE_ID_JOYPAD_R] =
|
||||
wpad_state[0][RETRO_DEVICE_ID_JOYPAD_START] = wpad_state[0][RETRO_DEVICE_ID_JOYPAD_SELECT] = true;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
static bool wii_key_pressed(void *data, int key)
|
||||
{
|
||||
(void)data;
|
||||
switch (key)
|
||||
{
|
||||
case RARCH_QUIT_KEY:
|
||||
{
|
||||
bool r = g_quit ||
|
||||
(pad_state[0][RETRO_DEVICE_ID_JOYPAD_SELECT] &&
|
||||
pad_state[0][RETRO_DEVICE_ID_JOYPAD_START] &&
|
||||
pad_state[0][RETRO_DEVICE_ID_JOYPAD_L] &&
|
||||
pad_state[0][RETRO_DEVICE_ID_JOYPAD_R])
|
||||
#ifdef HW_RVL
|
||||
||
|
||||
(wpad_state[0][RETRO_DEVICE_ID_JOYPAD_SELECT] &&
|
||||
wpad_state[0][RETRO_DEVICE_ID_JOYPAD_START] &&
|
||||
wpad_state[0][RETRO_DEVICE_ID_JOYPAD_L] &&
|
||||
wpad_state[0][RETRO_DEVICE_ID_JOYPAD_R])
|
||||
#endif
|
||||
;
|
||||
g_quit = false;
|
||||
return r;
|
||||
}
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
const input_driver_t input_wii = {
|
||||
.init = wii_input_initialize,
|
||||
.poll = wii_input_poll,
|
||||
.input_state = wii_input_state,
|
||||
.key_pressed = wii_key_pressed,
|
||||
.free = wii_free_input,
|
||||
.ident = "wii",
|
||||
};
|
||||
|
BIN
xbox1/Media/menuMainBG_720p.png
Normal file
BIN
xbox1/Media/menuMainBG_720p.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 20 KiB |
@ -36,21 +36,38 @@ bool CMenuMain::Create()
|
||||
{
|
||||
RARCH_LOG("CMenuMain::Create().");
|
||||
|
||||
xdk_d3d_video_t *d3d = (xdk_d3d_video_t*)driver.video_data;
|
||||
|
||||
width = d3d->d3dpp.BackBufferWidth;
|
||||
//height = d3d->d3dpp.BackBufferHeight;
|
||||
|
||||
// Title coords with color
|
||||
m_menuMainTitle_x = 305;
|
||||
m_menuMainTitle_y = 30;
|
||||
m_menuMainTitle_c = 0xFFFFFFFF;
|
||||
|
||||
// Load background image
|
||||
m_menuMainBG.Create("D:\\Media\\menuMainBG.png");
|
||||
m_menuMainBG_x = 0;
|
||||
m_menuMainBG_y = 0;
|
||||
m_menuMainBG_w = 640;
|
||||
m_menuMainBG_h = 480;
|
||||
//m_menuMainBG_w = width;
|
||||
//m_menuMainBG_h = height;
|
||||
|
||||
// Quick hack to properly center the romlist in 720p,
|
||||
// it might need more work though (font size and rom selector size -> needs more memory)
|
||||
// Init rom list coords
|
||||
m_menuMainRomListPos_x = 100;
|
||||
m_menuMainRomListPos_y = 100;
|
||||
// Load background image
|
||||
if(width == 640)
|
||||
{
|
||||
m_menuMainBG.Create("D:\\Media\\menuMainBG.png");
|
||||
m_menuMainRomListPos_x = 100;
|
||||
m_menuMainRomListPos_y = 100;
|
||||
}
|
||||
else if(width == 1280)
|
||||
{
|
||||
m_menuMainBG.Create("D:\\Media\\menuMainBG_720p.png");
|
||||
m_menuMainRomListPos_x = 400;
|
||||
m_menuMainRomListPos_y = 150;
|
||||
}
|
||||
|
||||
m_menuMainRomListSpacing = 20;
|
||||
|
||||
// Load rom selector panel
|
||||
@ -93,7 +110,11 @@ void CMenuMain::Render()
|
||||
m_menuMainBG.Render(m_menuMainBG_x, m_menuMainBG_y);
|
||||
|
||||
//Display some text
|
||||
g_font.Render("Press RSTICK THUMB to exit. Press START and/or A to launch a rom.", 65, 430, 16, XFONT_NORMAL, m_menuMainTitle_c);
|
||||
//Center the text (hardcoded)
|
||||
int xpos = width == 640 ? 65 : 400;
|
||||
int ypos = width == 640 ? 430 : 670;
|
||||
|
||||
g_font.Render("Press RSTICK THUMB to exit. Press START and/or A to launch a rom.", xpos, ypos, 16, XFONT_NORMAL, m_menuMainTitle_c);
|
||||
|
||||
//Begin with the rom selector panel
|
||||
//FIXME: Width/Height needs to be current Rom texture width/height (or should we just leave it at a fixed size?)
|
||||
@ -192,9 +213,9 @@ void CMenuMain::ProcessInput()
|
||||
}
|
||||
}
|
||||
|
||||
// Press A to launch, selected rom filename is saved into T:\\tmp.retro
|
||||
// Press A to launch
|
||||
if (trigger_state & (1 << RETRO_DEVICE_ID_JOYPAD_B) || trigger_state & (1 << RETRO_DEVICE_ID_JOYPAD_START))
|
||||
rarch_console_load_game(g_romList.GetRomAt(m_romListSelectedRom)->GetFileName().c_str());
|
||||
rarch_console_load_game_wrap(g_romList.GetRomAt(m_romListSelectedRom)->GetFileName().c_str(), S_DELAY_1);
|
||||
|
||||
if (trigger_state & (1 << RETRO_DEVICE_ID_JOYPAD_R3))
|
||||
{
|
||||
|
@ -73,6 +73,10 @@ int m_romListEndRender;
|
||||
int m_romListSelectedRom;
|
||||
int m_romListOffset;
|
||||
|
||||
// Backbuffer width, height
|
||||
int width;
|
||||
int height;
|
||||
|
||||
};
|
||||
|
||||
extern CMenuMain g_menuMain;
|
||||
|
@ -64,7 +64,7 @@ void menu_loop(void)
|
||||
1.0f, 0);
|
||||
|
||||
d3d->d3d_render_device->BeginScene();
|
||||
d3d->d3d_render_device->SetFlickerFilter(5);
|
||||
d3d->d3d_render_device->SetFlickerFilter(1);
|
||||
d3d->d3d_render_device->SetSoftDisplayFilter(1);
|
||||
|
||||
//g_input.GetInput();
|
||||
|
@ -32,6 +32,43 @@ DWORD dwDeviceMask;
|
||||
bool bInserted[4];
|
||||
bool bRemoved[4];
|
||||
|
||||
const struct platform_bind platform_keys[] = {
|
||||
{ XINPUT1_GAMEPAD_B, "B button" },
|
||||
{ XINPUT1_GAMEPAD_A, "A button" },
|
||||
{ XINPUT1_GAMEPAD_Y, "Y button" },
|
||||
{ XINPUT1_GAMEPAD_X, "X button" },
|
||||
{ XINPUT1_GAMEPAD_DPAD_UP, "D-Pad Up" },
|
||||
{ XINPUT1_GAMEPAD_DPAD_DOWN, "D-Pad Down" },
|
||||
{ XINPUT1_GAMEPAD_DPAD_LEFT, "D-Pad Left" },
|
||||
{ XINPUT1_GAMEPAD_DPAD_RIGHT, "D-Pad Right" },
|
||||
{ XINPUT1_GAMEPAD_BACK, "Back button" },
|
||||
{ XINPUT1_GAMEPAD_START, "Start button" },
|
||||
{ XINPUT1_GAMEPAD_WHITE, "White button" },
|
||||
{ XINPUT1_GAMEPAD_LEFT_TRIGGER, "Left Trigger" },
|
||||
{ XINPUT1_GAMEPAD_LEFT_THUMB, "Left Thumb" },
|
||||
{ XINPUT1_GAMEPAD_BLACK, "Black button" },
|
||||
{ XINPUT1_GAMEPAD_RIGHT_TRIGGER, "Right Trigger" },
|
||||
{ XINPUT1_GAMEPAD_RIGHT_THUMB, "Right Thumb" },
|
||||
{ XINPUT1_GAMEPAD_LSTICK_LEFT_MASK, "LStick Left" },
|
||||
{ XINPUT1_GAMEPAD_LSTICK_RIGHT_MASK, "LStick Right" },
|
||||
{ XINPUT1_GAMEPAD_LSTICK_UP_MASK, "LStick Up" },
|
||||
{ XINPUT1_GAMEPAD_LSTICK_DOWN_MASK, "LStick Down" },
|
||||
{ XINPUT1_GAMEPAD_DPAD_LEFT | XINPUT1_GAMEPAD_LSTICK_LEFT_MASK, "LStick D-Pad Left" },
|
||||
{ XINPUT1_GAMEPAD_DPAD_RIGHT | XINPUT1_GAMEPAD_LSTICK_RIGHT_MASK, "LStick D-Pad Right" },
|
||||
{ XINPUT1_GAMEPAD_DPAD_UP | XINPUT1_GAMEPAD_LSTICK_UP_MASK, "LStick D-Pad Up" },
|
||||
{ XINPUT1_GAMEPAD_DPAD_DOWN | XINPUT1_GAMEPAD_LSTICK_DOWN_MASK, "LStick D-Pad Down" },
|
||||
{ XINPUT1_GAMEPAD_RSTICK_LEFT_MASK, "RStick Left" },
|
||||
{ XINPUT1_GAMEPAD_RSTICK_RIGHT_MASK, "RStick Right" },
|
||||
{ XINPUT1_GAMEPAD_RSTICK_UP_MASK, "RStick Up" },
|
||||
{ XINPUT1_GAMEPAD_RSTICK_DOWN_MASK, "RStick Down" },
|
||||
{ XINPUT1_GAMEPAD_DPAD_LEFT | XINPUT1_GAMEPAD_RSTICK_LEFT_MASK, "RStick D-Pad Left" },
|
||||
{ XINPUT1_GAMEPAD_DPAD_RIGHT | XINPUT1_GAMEPAD_RSTICK_RIGHT_MASK, "RStick D-Pad Right" },
|
||||
{ XINPUT1_GAMEPAD_DPAD_UP | XINPUT1_GAMEPAD_RSTICK_UP_MASK, "RStick D-Pad Up" },
|
||||
{ XINPUT1_GAMEPAD_DPAD_DOWN | XINPUT1_GAMEPAD_RSTICK_DOWN_MASK, "RStick D-Pad Down" },
|
||||
};
|
||||
|
||||
const unsigned int platform_keys_size = sizeof(platform_keys);
|
||||
|
||||
#define DEADZONE (16000)
|
||||
|
||||
static unsigned pads_connected;
|
||||
@ -49,6 +86,7 @@ static void xinput_input_poll(void *data)
|
||||
{
|
||||
XINPUT_STATE state[4];
|
||||
XINPUT_CAPABILITIES caps[4];
|
||||
(void)caps;
|
||||
real_state[i] = 0;
|
||||
// handle removed devices
|
||||
bRemoved[i] = (dwRemovals & (1<<i)) ? true : false;
|
||||
@ -154,6 +192,33 @@ static bool xinput_input_key_pressed(void *data, int key)
|
||||
return retval;
|
||||
}
|
||||
|
||||
static void xinput_set_default_keybind_lut(void)
|
||||
{
|
||||
rarch_default_keybind_lut[RETRO_DEVICE_ID_JOYPAD_B] = platform_keys[XDK_DEVICE_ID_JOYPAD_A].joykey;
|
||||
rarch_default_keybind_lut[RETRO_DEVICE_ID_JOYPAD_Y] = platform_keys[XDK_DEVICE_ID_JOYPAD_X].joykey;
|
||||
rarch_default_keybind_lut[RETRO_DEVICE_ID_JOYPAD_SELECT] = platform_keys[XDK_DEVICE_ID_JOYPAD_BACK].joykey;
|
||||
rarch_default_keybind_lut[RETRO_DEVICE_ID_JOYPAD_START] = platform_keys[XDK_DEVICE_ID_JOYPAD_START].joykey;
|
||||
rarch_default_keybind_lut[RETRO_DEVICE_ID_JOYPAD_UP] = platform_keys[XDK_DEVICE_ID_JOYPAD_UP].joykey;
|
||||
rarch_default_keybind_lut[RETRO_DEVICE_ID_JOYPAD_DOWN] = platform_keys[XDK_DEVICE_ID_JOYPAD_DOWN].joykey;
|
||||
rarch_default_keybind_lut[RETRO_DEVICE_ID_JOYPAD_LEFT] = platform_keys[XDK_DEVICE_ID_JOYPAD_LEFT].joykey;
|
||||
rarch_default_keybind_lut[RETRO_DEVICE_ID_JOYPAD_RIGHT] = platform_keys[XDK_DEVICE_ID_JOYPAD_RIGHT].joykey;
|
||||
rarch_default_keybind_lut[RETRO_DEVICE_ID_JOYPAD_A] = platform_keys[XDK_DEVICE_ID_JOYPAD_B].joykey;
|
||||
rarch_default_keybind_lut[RETRO_DEVICE_ID_JOYPAD_X] = platform_keys[XDK_DEVICE_ID_JOYPAD_Y].joykey;
|
||||
#if defined(_XBOX1)
|
||||
rarch_default_keybind_lut[RETRO_DEVICE_ID_JOYPAD_L] = platform_keys[XDK_DEVICE_ID_JOYPAD_LEFT_TRIGGER].joykey;
|
||||
rarch_default_keybind_lut[RETRO_DEVICE_ID_JOYPAD_R] = platform_keys[XDK_DEVICE_ID_JOYPAD_RIGHT_TRIGGER].joykey;
|
||||
rarch_default_keybind_lut[RETRO_DEVICE_ID_JOYPAD_L2] = platform_keys[XDK_DEVICE_ID_JOYPAD_LB].joykey;
|
||||
rarch_default_keybind_lut[RETRO_DEVICE_ID_JOYPAD_R2] = platform_keys[XDK_DEVICE_ID_JOYPAD_RB].joykey;
|
||||
#elif defined(_XBOX360)
|
||||
rarch_default_keybind_lut[RETRO_DEVICE_ID_JOYPAD_L] = platform_keys[XDK_DEVICE_ID_JOYPAD_LB].joykey;
|
||||
rarch_default_keybind_lut[RETRO_DEVICE_ID_JOYPAD_R] = platform_keys[XDK_DEVICE_ID_JOYPAD_RB].joykey;
|
||||
rarch_default_keybind_lut[RETRO_DEVICE_ID_JOYPAD_L2] = platform_keys[XDK_DEVICE_ID_JOYPAD_LEFT_TRIGGER].joykey;
|
||||
rarch_default_keybind_lut[RETRO_DEVICE_ID_JOYPAD_R2] = platform_keys[XDK_DEVICE_ID_JOYPAD_RIGHT_TRIGGER].joykey;
|
||||
#endif
|
||||
rarch_default_keybind_lut[RETRO_DEVICE_ID_JOYPAD_L3] = platform_keys[XDK_DEVICE_ID_LSTICK_THUMB].joykey;
|
||||
rarch_default_keybind_lut[RETRO_DEVICE_ID_JOYPAD_R3] = platform_keys[XDK_DEVICE_ID_RSTICK_THUMB].joykey;
|
||||
}
|
||||
|
||||
const input_driver_t input_xinput =
|
||||
{
|
||||
xinput_input_init,
|
||||
@ -161,5 +226,6 @@ const input_driver_t input_xinput =
|
||||
xinput_input_state,
|
||||
xinput_input_key_pressed,
|
||||
xinput_input_free_input,
|
||||
xinput_set_default_keybind_lut,
|
||||
"xinput"
|
||||
};
|
||||
|
@ -44,4 +44,42 @@ enum {
|
||||
XINPUT1_GAMEPAD_RSTICK_DOWN_MASK = 1 << 23,
|
||||
};
|
||||
|
||||
enum xdk_device_id
|
||||
{
|
||||
XDK_DEVICE_ID_JOYPAD_B = 0,
|
||||
XDK_DEVICE_ID_JOYPAD_A,
|
||||
XDK_DEVICE_ID_JOYPAD_Y,
|
||||
XDK_DEVICE_ID_JOYPAD_X,
|
||||
XDK_DEVICE_ID_JOYPAD_UP,
|
||||
XDK_DEVICE_ID_JOYPAD_DOWN,
|
||||
XDK_DEVICE_ID_JOYPAD_LEFT,
|
||||
XDK_DEVICE_ID_JOYPAD_RIGHT,
|
||||
XDK_DEVICE_ID_JOYPAD_BACK,
|
||||
XDK_DEVICE_ID_JOYPAD_START,
|
||||
XDK_DEVICE_ID_JOYPAD_LB,
|
||||
XDK_DEVICE_ID_JOYPAD_LEFT_TRIGGER,
|
||||
XDK_DEVICE_ID_LSTICK_THUMB,
|
||||
XDK_DEVICE_ID_JOYPAD_RB,
|
||||
XDK_DEVICE_ID_JOYPAD_RIGHT_TRIGGER,
|
||||
XDK_DEVICE_ID_RSTICK_THUMB,
|
||||
XDK_DEVICE_ID_LSTICK_LEFT,
|
||||
XDK_DEVICE_ID_LSTICK_RIGHT,
|
||||
XDK_DEVICE_ID_LSTICK_UP,
|
||||
XDK_DEVICE_ID_LSTICK_DOWN,
|
||||
XDK_DEVICE_ID_LSTICK_LEFT_DPAD,
|
||||
XDK_DEVICE_ID_LSTICK_RIGHT_DPAD,
|
||||
XDK_DEVICE_ID_LSTICK_UP_DPAD,
|
||||
XDK_DEVICE_ID_LSTICK_DOWN_DPAD,
|
||||
XDK_DEVICE_ID_RSTICK_LEFT,
|
||||
XDK_DEVICE_ID_RSTICK_RIGHT,
|
||||
XDK_DEVICE_ID_RSTICK_UP,
|
||||
XDK_DEVICE_ID_RSTICK_DOWN,
|
||||
XDK_DEVICE_ID_RSTICK_LEFT_DPAD,
|
||||
XDK_DEVICE_ID_RSTICK_RIGHT_DPAD,
|
||||
XDK_DEVICE_ID_RSTICK_UP_DPAD,
|
||||
XDK_DEVICE_ID_RSTICK_DOWN_DPAD,
|
||||
|
||||
RARCH_LAST_PLATFORM_KEY
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -38,6 +38,7 @@
|
||||
#endif
|
||||
|
||||
#include "../../console/retroarch_console.h"
|
||||
#include "../../console/retroarch_config.h"
|
||||
#include "../../conf/config_file.h"
|
||||
#include "../../conf/config_file_macros.h"
|
||||
#include "../../file.h"
|
||||
@ -99,17 +100,20 @@ static void get_environment_settings (void)
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef _XBOX1
|
||||
#if defined(_XBOX1)
|
||||
/* FIXME: Hardcoded */
|
||||
strlcpy(default_paths.config_file, "D:\\retroarch.cfg", sizeof(default_paths.config_file));
|
||||
strlcpy(g_settings.system_directory, "D:\\system\\", sizeof(g_settings.system_directory));
|
||||
strlcpy(default_paths.system_dir, "D:\\system\\", sizeof(default_paths.system_dir));
|
||||
strlcpy(default_paths.filesystem_root_dir, "D:\\", sizeof(default_paths.filesystem_root_dir));
|
||||
strlcpy(default_paths.executable_extension, ".xbe", sizeof(default_paths.executable_extension));
|
||||
#else
|
||||
#elif defined(_XBOX360)
|
||||
#ifdef HAVE_HDD_CACHE_PARTITION
|
||||
strlcpy(default_paths.cache_dir, "cache:\\", sizeof(default_paths.cache_dir));
|
||||
#endif
|
||||
strlcpy(default_paths.filesystem_root_dir, "game:\\", sizeof(default_paths.filesystem_root_dir));
|
||||
strlcpy(default_paths.shader_file, "game:\\media\\shaders\\stock.cg", sizeof(default_paths.shader_file));
|
||||
strlcpy(default_paths.config_file, "game:\\retroarch.cfg", sizeof(default_paths.config_file));
|
||||
strlcpy(g_settings.system_directory, "game:\\system\\", sizeof(g_settings.system_directory));
|
||||
strlcpy(default_paths.system_dir, "game:\\system\\", sizeof(default_paths.system_dir));
|
||||
strlcpy(default_paths.executable_extension, ".xex", sizeof(default_paths.executable_extension));
|
||||
#endif
|
||||
}
|
||||
@ -121,14 +125,14 @@ int main(int argc, char *argv[])
|
||||
|
||||
config_set_defaults();
|
||||
|
||||
rarch_configure_libretro(default_paths.filesystem_root_dir, default_paths.executable_extension);
|
||||
input_xinput.init();
|
||||
rarch_configure_libretro(&input_xinput, default_paths.filesystem_root_dir, default_paths.executable_extension);
|
||||
|
||||
#if defined(HAVE_D3D8) || defined(HAVE_D3D9)
|
||||
video_xdk_d3d.start();
|
||||
#else
|
||||
video_null.start();
|
||||
#endif
|
||||
input_xinput.init();
|
||||
|
||||
rarch_input_set_default_keybind_names_for_emulator();
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user