Merge branch 'master' of git://github.com/Themaister/RetroArch
Conflicts: console/retroarch_console.c console/retroarch_console_input.h wii/input.c
This commit is contained in:
commit
30b77de46c
|
@ -220,8 +220,4 @@ class CRetroArchControls: public CXuiSceneImpl
|
||||||
extern CRetroArch app;
|
extern CRetroArch app;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
int menu_init (void);
|
|
||||||
void menu_free (void);
|
|
||||||
void menu_loop (void);
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -17,9 +17,7 @@
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
#ifdef _XBOX
|
|
||||||
#include <xtl.h>
|
#include <xtl.h>
|
||||||
#endif
|
|
||||||
|
|
||||||
#include "../driver.h"
|
#include "../driver.h"
|
||||||
#include "../general.h"
|
#include "../general.h"
|
||||||
|
@ -29,6 +27,43 @@
|
||||||
static uint64_t state[4];
|
static uint64_t state[4];
|
||||||
static unsigned pads_connected;
|
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)
|
static void xinput_input_poll(void *data)
|
||||||
{
|
{
|
||||||
(void)data;
|
(void)data;
|
||||||
|
@ -73,7 +108,6 @@ static void xinput_input_free_input(void *data)
|
||||||
(void)data;
|
(void)data;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef _XBOX360
|
|
||||||
#include "../console/retroarch_console.h"
|
#include "../console/retroarch_console.h"
|
||||||
|
|
||||||
void xdk360_input_map_dpad_to_stick(uint32_t map_dpad_enum, uint32_t controller_id)
|
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;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
static void* xinput_input_init(void)
|
static void* xinput_input_init(void)
|
||||||
{
|
{
|
||||||
#ifdef _XBOX360
|
|
||||||
for(unsigned i = 0; i < 4; i++)
|
for(unsigned i = 0; i < 4; i++)
|
||||||
xdk360_input_map_dpad_to_stick(g_settings.input.dpad_emulation[i], i);
|
xdk360_input_map_dpad_to_stick(g_settings.input.dpad_emulation[i], i);
|
||||||
#endif
|
|
||||||
|
|
||||||
return (void*)-1;
|
return (void*)-1;
|
||||||
}
|
}
|
||||||
|
@ -116,7 +147,6 @@ static bool xinput_input_key_pressed(void *data, int key)
|
||||||
{
|
{
|
||||||
(void)data;
|
(void)data;
|
||||||
bool retval = false;
|
bool retval = false;
|
||||||
#ifdef _XBOX360
|
|
||||||
XINPUT_STATE state;
|
XINPUT_STATE state;
|
||||||
xdk_d3d_video_t *d3d = (xdk_d3d_video_t*)driver.video_data;
|
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;
|
retval = g_console.ingame_menu_enable ? g_console.ingame_menu_enable : g_console.menu_enable;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
return retval;
|
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 =
|
const input_driver_t input_xinput =
|
||||||
{
|
{
|
||||||
xinput_input_init,
|
xinput_input_init,
|
||||||
|
@ -175,5 +231,6 @@ const input_driver_t input_xinput =
|
||||||
xinput_input_state,
|
xinput_input_state,
|
||||||
xinput_input_key_pressed,
|
xinput_input_key_pressed,
|
||||||
xinput_input_free_input,
|
xinput_input_free_input,
|
||||||
|
xinput_set_default_keybind_lut,
|
||||||
"xinput"
|
"xinput"
|
||||||
};
|
};
|
||||||
|
|
|
@ -30,10 +30,46 @@ enum {
|
||||||
XINPUT_GAMEPAD_RIGHT_TRIGGER = 1 << 25
|
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)
|
#define DEADZONE (16000)
|
||||||
|
|
||||||
#ifdef _XBOX
|
|
||||||
extern void xdk360_input_map_dpad_to_stick(uint32_t map_dpad_enum, uint32_t controller_id);
|
extern void xdk360_input_map_dpad_to_stick(uint32_t map_dpad_enum, uint32_t controller_id);
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -41,6 +41,8 @@ else
|
||||||
PPU_CXXLD = $(CELL_SDK)/host-win32/ppu/bin/ppu-lv2-ld.exe
|
PPU_CXXLD = $(CELL_SDK)/host-win32/ppu/bin/ppu-lv2-ld.exe
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
PPU_RANLIB = $(CELL_SDK)/host-win32/ppu/bin/ppu-lv2-ranlib.exe
|
||||||
|
|
||||||
DEFINES += -DHAVE_DEFAULT_RETROPAD_INPUT -DHAVE_THREAD -DRARCH_CONSOLE -DHAVE_OPENGL -DHAVE_OPENGL_TEXREF -DHAVE_HEADSET -DHAVE_VID_CONTEXT -DHAVE_OPENGLES11 -DHAVE_CG -DHAVE_CG_MENU -DHAVE_FILEBROWSER -DHAVE_HDD_CACHE_PARTITION -DHAVE_FBO -DHAVE_RARCH_MAIN_WRAP -DHAVE_SYSMODULES -DHAVE_SYSUTILS -DHAVE_RARCH_EXEC -DHAVE_RGL -DHAVE_LIBRETRO_MANAGEMENT -DHAVE_RSOUND -DHAVE_ZLIB -D__CELLOS_LV2__ -DHAVE_CONFIGFILE=1 -DHAVE_NETPLAY=1 -DHAVE_SOCKET_LEGACY=1 -DHAVE_OSKUTIL -DHAVE_MOUSE -DHAVE_GRIFFIN=1 -DHAVE_MULTIMAN=1 -DPACKAGE_VERSION=\"$(RARCH_VERSION)\" -Dmain=rarch_main -DPC_DEVELOPMENT_IP_ADDRESS=\"$(PC_DEVELOPMENT_IP_ADDRESS)\" -DPC_DEVELOPMENT_UDP_PORT=$(PC_DEVELOPMENT_UDP_PORT)
|
DEFINES += -DHAVE_DEFAULT_RETROPAD_INPUT -DHAVE_THREAD -DRARCH_CONSOLE -DHAVE_OPENGL -DHAVE_OPENGL_TEXREF -DHAVE_HEADSET -DHAVE_VID_CONTEXT -DHAVE_OPENGLES11 -DHAVE_CG -DHAVE_CG_MENU -DHAVE_FILEBROWSER -DHAVE_HDD_CACHE_PARTITION -DHAVE_FBO -DHAVE_RARCH_MAIN_WRAP -DHAVE_SYSMODULES -DHAVE_SYSUTILS -DHAVE_RARCH_EXEC -DHAVE_RGL -DHAVE_LIBRETRO_MANAGEMENT -DHAVE_RSOUND -DHAVE_ZLIB -D__CELLOS_LV2__ -DHAVE_CONFIGFILE=1 -DHAVE_NETPLAY=1 -DHAVE_SOCKET_LEGACY=1 -DHAVE_OSKUTIL -DHAVE_MOUSE -DHAVE_GRIFFIN=1 -DHAVE_MULTIMAN=1 -DPACKAGE_VERSION=\"$(RARCH_VERSION)\" -Dmain=rarch_main -DPC_DEVELOPMENT_IP_ADDRESS=\"$(PC_DEVELOPMENT_IP_ADDRESS)\" -DPC_DEVELOPMENT_UDP_PORT=$(PC_DEVELOPMENT_UDP_PORT)
|
||||||
|
|
||||||
ifeq ($(DEBUG), 1)
|
ifeq ($(DEBUG), 1)
|
||||||
|
|
|
@ -34,6 +34,8 @@ else
|
||||||
PPU_AR = $(CELL_SDK)/host-win32/ppu/bin/ppu-lv2-ar.exe
|
PPU_AR = $(CELL_SDK)/host-win32/ppu/bin/ppu-lv2-ar.exe
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
PPU_RANLIB = $(CELL_SDK)/host-win32/ppu/bin/ppu-lv2-ranlib.exe
|
||||||
|
|
||||||
|
|
||||||
PPU_LDLIBS = -lio_stub
|
PPU_LDLIBS = -lio_stub
|
||||||
|
|
||||||
|
|
|
@ -26,7 +26,7 @@ LIBS := -lretro_psl1ght -laudio -lEGL -lGL -lio -lm -ljpgdec -lpngdec -lsysutil
|
||||||
|
|
||||||
OBJ = console/griffin/griffin.o console/rzlib/rzlib.o
|
OBJ = console/griffin/griffin.o console/rzlib/rzlib.o
|
||||||
|
|
||||||
#OBJ += console/rgl/ps3/device_ctx.o console/rgl/ps3/rgl.o console/rgl/ps3/cgbio.o console/rgl/ps3/cgnv2rt.o
|
OBJ += console/rgl/ps3/device_ctx.o console/rgl/ps3/rgl.o console/rgl/ps3/cgbio.o console/rgl/ps3/cgnv2rt.o
|
||||||
|
|
||||||
ifeq ($(HAVE_LOGGER), 1)
|
ifeq ($(HAVE_LOGGER), 1)
|
||||||
CFLAGS += -DHAVE_LOGGER
|
CFLAGS += -DHAVE_LOGGER
|
||||||
|
|
|
@ -21,6 +21,18 @@
|
||||||
// The caller does not have the priority level required for the function to
|
// The caller does not have the priority level required for the function to
|
||||||
// succeed
|
// succeed
|
||||||
#define DSERR_PRIOLEVELNEEDED MAKE_DSHRESULT(70)
|
#define DSERR_PRIOLEVELNEEDED MAKE_DSHRESULT(70)
|
||||||
|
// Send the audio signal (stereo, without attenuation) to all existing speakers
|
||||||
|
DSMIXBINVOLUMEPAIR dsmbvp[8] = {
|
||||||
|
{DSMIXBIN_FRONT_LEFT, DSBVOLUME_MAX},
|
||||||
|
{DSMIXBIN_FRONT_RIGHT, DSBVOLUME_MAX},
|
||||||
|
{DSMIXBIN_FRONT_CENTER, DSBVOLUME_MAX},
|
||||||
|
{DSMIXBIN_FRONT_CENTER, DSBVOLUME_MAX},
|
||||||
|
{DSMIXBIN_BACK_LEFT, DSBVOLUME_MAX},
|
||||||
|
{DSMIXBIN_BACK_RIGHT, DSBVOLUME_MAX},
|
||||||
|
{DSMIXBIN_LOW_FREQUENCY, DSBVOLUME_MAX},
|
||||||
|
{DSMIXBIN_LOW_FREQUENCY, DSBVOLUME_MAX}};
|
||||||
|
|
||||||
|
DSMIXBINS dsmb;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "../driver.h"
|
#include "../driver.h"
|
||||||
|
@ -338,6 +350,16 @@ static void *dsound_init(const char *device, unsigned rate, unsigned latency)
|
||||||
if (IDirectSound_CreateSoundBuffer(ds->ds, &bufdesc, &ds->dsb, 0) != DS_OK)
|
if (IDirectSound_CreateSoundBuffer(ds->ds, &bufdesc, &ds->dsb, 0) != DS_OK)
|
||||||
goto error;
|
goto error;
|
||||||
|
|
||||||
|
IDirectSoundBuffer_SetVolume(ds->dsb, DSBVOLUME_MAX);
|
||||||
|
|
||||||
|
#ifdef _XBOX
|
||||||
|
dsmb.dwMixBinCount = 8;
|
||||||
|
dsmb.lpMixBinVolumePairs = dsmbvp;
|
||||||
|
|
||||||
|
IDirectSoundBuffer_SetHeadroom(ds->dsb, DSBHEADROOM_MIN);
|
||||||
|
IDirectSoundBuffer_SetMixBins(ds->dsb, &dsmb);
|
||||||
|
#endif
|
||||||
|
|
||||||
IDirectSoundBuffer_SetCurrentPosition(ds->dsb, 0);
|
IDirectSoundBuffer_SetCurrentPosition(ds->dsb, 0);
|
||||||
|
|
||||||
dsound_clear_buffer(ds);
|
dsound_clear_buffer(ds);
|
||||||
|
|
|
@ -295,3 +295,76 @@ void rarch_settings_create_menu_item_label(char * str, unsigned setting, size_t
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void rarch_settings_set_default (const input_driver_t *input)
|
||||||
|
{
|
||||||
|
// g_settings
|
||||||
|
g_settings.rewind_enable = false;
|
||||||
|
strlcpy(g_settings.cheat_database, default_paths.port_dir, sizeof(g_settings.cheat_database));
|
||||||
|
|
||||||
|
#if defined(HAVE_CG) || defined(HAVE_HLSL) || defined(HAVE_GLSL)
|
||||||
|
strlcpy(g_settings.video.cg_shader_path, default_paths.shader_file, sizeof(g_settings.video.cg_shader_path));
|
||||||
|
strlcpy(g_settings.video.second_pass_shader, default_paths.shader_file, sizeof(g_settings.video.second_pass_shader));
|
||||||
|
g_settings.video.second_pass_smooth = true;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef HAVE_FBO
|
||||||
|
g_settings.video.fbo_scale_x = 2.0f;
|
||||||
|
g_settings.video.fbo_scale_y = 2.0f;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
g_settings.video.render_to_texture = true;
|
||||||
|
g_settings.video.smooth = true;
|
||||||
|
g_settings.video.vsync = true;
|
||||||
|
|
||||||
|
strlcpy(g_settings.system_directory, default_paths.system_dir, sizeof(g_settings.system_directory));
|
||||||
|
|
||||||
|
g_settings.video.msg_pos_x = 0.05f;
|
||||||
|
g_settings.video.msg_pos_y = 0.90f;
|
||||||
|
g_settings.video.aspect_ratio = -1.0f;
|
||||||
|
|
||||||
|
rarch_input_set_controls_default(input);
|
||||||
|
|
||||||
|
// g_console
|
||||||
|
g_console.block_config_read = true;
|
||||||
|
g_console.frame_advance_enable = false;
|
||||||
|
g_console.emulator_initialized = 0;
|
||||||
|
g_console.screenshots_enable = true;
|
||||||
|
g_console.throttle_enable = true;
|
||||||
|
g_console.initialize_rarch_enable = false;
|
||||||
|
g_console.triple_buffering_enable = true;
|
||||||
|
g_console.default_savestate_dir_enable = false;
|
||||||
|
g_console.default_sram_dir_enable = false;
|
||||||
|
|
||||||
|
#ifdef HAVE_FBO
|
||||||
|
g_console.fbo_enabled = true;
|
||||||
|
#else
|
||||||
|
g_console.fbo_enabled = false;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
g_console.mode_switch = MODE_MENU;
|
||||||
|
g_console.screen_orientation = ORIENTATION_NORMAL;
|
||||||
|
g_console.current_resolution_id = 0;
|
||||||
|
strlcpy(g_console.default_rom_startup_dir, default_paths.filesystem_root_dir, sizeof(g_console.default_rom_startup_dir));
|
||||||
|
strlcpy(g_console.default_savestate_dir, default_paths.savestate_dir, sizeof(g_console.default_savestate_dir));
|
||||||
|
strlcpy(g_console.default_sram_dir, default_paths.sram_dir, sizeof(g_console.default_sram_dir));
|
||||||
|
g_console.aspect_ratio_index = 0;
|
||||||
|
g_console.menu_font_size = 1.0f;
|
||||||
|
g_console.overscan_enable = false;
|
||||||
|
g_console.overscan_amount = 0.0f;
|
||||||
|
g_console.sound_mode = SOUND_MODE_NORMAL;
|
||||||
|
g_console.viewports.custom_vp.width = 0;
|
||||||
|
g_console.viewports.custom_vp.height = 0;
|
||||||
|
g_console.viewports.custom_vp.x = 0;
|
||||||
|
g_console.viewports.custom_vp.y = 0;
|
||||||
|
g_console.custom_bgm_enable = true;
|
||||||
|
g_console.info_msg_enable = true;
|
||||||
|
#ifdef _XBOX360
|
||||||
|
g_console.color_format = 0;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// g_extern
|
||||||
|
g_extern.state_slot = 0;
|
||||||
|
g_extern.audio_data.mute = 0;
|
||||||
|
g_extern.verbose = true;
|
||||||
|
}
|
||||||
|
|
|
@ -105,6 +105,7 @@ enum
|
||||||
void rarch_settings_change(unsigned setting);
|
void rarch_settings_change(unsigned setting);
|
||||||
void rarch_settings_default(unsigned setting);
|
void rarch_settings_default(unsigned setting);
|
||||||
void rarch_settings_msg(unsigned setting, unsigned delay);
|
void rarch_settings_msg(unsigned setting, unsigned delay);
|
||||||
|
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(char * str, unsigned setting, size_t size);
|
||||||
void rarch_settings_create_menu_item_label_w(wchar_t *strwbuf, 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
|
CONSOLE EXTENSIONS
|
||||||
============================================================ */
|
============================================================ */
|
||||||
|
#include "../retroarch_rom_ext.c"
|
||||||
#include "../retroarch_console.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"
|
#include "../console_settings.c"
|
||||||
|
|
||||||
#ifdef HAVE_LIBRETRO_MANAGEMENT
|
#ifdef HAVE_LIBRETRO_MANAGEMENT
|
||||||
|
@ -259,6 +271,15 @@ MENU
|
||||||
============================================================ */
|
============================================================ */
|
||||||
#if defined(_XBOX360)
|
#if defined(_XBOX360)
|
||||||
#include "../../360/frontend-xdk/menu.cpp"
|
#include "../../360/frontend-xdk/menu.cpp"
|
||||||
|
#elif defined(_XBOX1)
|
||||||
|
#include "../../xbox1/frontend/menu.cpp"
|
||||||
|
#include "../../xbox1/frontend/RetroLaunch/Font.cpp"
|
||||||
|
#include "../../xbox1/frontend/RetroLaunch/IoSupport.cpp"
|
||||||
|
#include "../../xbox1/frontend/RetroLaunch/MenuMain.cpp"
|
||||||
|
#include "../../xbox1/frontend/RetroLaunch/MenuManager.cpp"
|
||||||
|
#include "../../xbox1/frontend/RetroLaunch/Rom.cpp"
|
||||||
|
#include "../../xbox1/frontend/RetroLaunch/RomList.cpp"
|
||||||
|
#include "../../xbox1/frontend/RetroLaunch/Surface.cpp"
|
||||||
#elif defined(GEKKO)
|
#elif defined(GEKKO)
|
||||||
#include "../../wii/frontend/rgui.c"
|
#include "../../wii/frontend/rgui.c"
|
||||||
#include "../../wii/frontend/list.c"
|
#include "../../wii/frontend/list.c"
|
||||||
|
|
|
@ -65,7 +65,7 @@ static bool rarch_manage_libretro_install(char *libretro_core_installed, size_t
|
||||||
return ret;
|
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)
|
const char *libretro_path, const char *config_path, const char *extension)
|
||||||
{
|
{
|
||||||
bool libretro_core_was_installed = false;
|
bool libretro_core_was_installed = false;
|
||||||
|
@ -139,3 +139,16 @@ void rarch_manage_libretro_set_first_file(char *first_file, size_t size_of_first
|
||||||
end:
|
end:
|
||||||
dir_list_free(dir_list);
|
dir_list_free(dir_list);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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);
|
||||||
|
|
||||||
|
bool find_libretro_file = rarch_configure_libretro_core(full_path, path_prefix, path_prefix,
|
||||||
|
default_paths.config_file, extension);
|
||||||
|
|
||||||
|
rarch_settings_set_default(input);
|
||||||
|
rarch_config_load(default_paths.config_file, path_prefix, extension, find_libretro_file);
|
||||||
|
init_libretro_sym();
|
||||||
|
}
|
||||||
|
|
|
@ -18,6 +18,7 @@
|
||||||
#define LIBRETRO_MGMT_H__
|
#define LIBRETRO_MGMT_H__
|
||||||
|
|
||||||
#include "../boolean.h"
|
#include "../boolean.h"
|
||||||
|
#include "../driver.h"
|
||||||
|
|
||||||
enum
|
enum
|
||||||
{
|
{
|
||||||
|
@ -28,7 +29,6 @@ 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);
|
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,
|
void rarch_configure_libretro(const input_driver_t *input, const char *path_prefix, const char * extension);
|
||||||
const char *libretro_path, const char *config_path, const char *extension);
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -0,0 +1,188 @@
|
||||||
|
/* 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");
|
||||||
|
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);
|
||||||
|
#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);
|
||||||
|
}
|
||||||
|
}
|
|
@ -14,22 +14,18 @@
|
||||||
* If not, see <http://www.gnu.org/licenses/>.
|
* If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef _PS3_SHARED_H
|
#ifndef _RARCH_CONSOLE_CONFIG_H
|
||||||
#define _PS3_SHARED_H
|
#define _RARCH_CONSOLE_CONFIG_H
|
||||||
|
|
||||||
extern char usrDirPath[PATH_MAX];
|
enum
|
||||||
extern char systemDirPath[PATH_MAX];
|
{
|
||||||
extern char DEFAULT_PRESET_FILE[PATH_MAX];
|
CONFIG_FILE,
|
||||||
extern char DEFAULT_BORDER_FILE[PATH_MAX];
|
SHADER_PRESET_FILE,
|
||||||
extern char DEFAULT_MENU_BORDER_FILE[PATH_MAX];
|
INPUT_PRESET_FILE
|
||||||
extern char PRESETS_DIR_PATH[PATH_MAX];
|
};
|
||||||
extern char INPUT_PRESETS_DIR_PATH[PATH_MAX];
|
|
||||||
extern char BORDERS_DIR_PATH[PATH_MAX];
|
void rarch_config_create_default(const char * conf_name);
|
||||||
extern char SHADERS_DIR_PATH[PATH_MAX];
|
void rarch_config_load(const char * conf_name, const char * libretro_dir_path, const char * exe_ext, bool find_libretro_path);
|
||||||
extern char DEFAULT_SHADER_FILE[PATH_MAX];
|
void rarch_config_save(const char * conf_name);
|
||||||
extern char DEFAULT_MENU_SHADER_FILE[PATH_MAX];
|
|
||||||
extern char LIBRETRO_DIR_PATH[PATH_MAX];
|
|
||||||
extern char SYS_CONFIG_FILE[PATH_MAX];
|
|
||||||
extern char MULTIMAN_EXECUTABLE[PATH_MAX];
|
|
||||||
|
|
||||||
#endif
|
#endif
|
|
@ -18,7 +18,6 @@
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <ctype.h>
|
|
||||||
#include "../boolean.h"
|
#include "../boolean.h"
|
||||||
#include "../compat/strl.h"
|
#include "../compat/strl.h"
|
||||||
#include "../libretro.h"
|
#include "../libretro.h"
|
||||||
|
@ -27,614 +26,9 @@
|
||||||
#include "retroarch_console.h"
|
#include "retroarch_console.h"
|
||||||
#include "../file.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
|
#define MAX_ARGS 32
|
||||||
|
|
||||||
/*============================================================
|
default_paths_t default_paths;
|
||||||
ROM EXTENSIONS
|
|
||||||
============================================================ */
|
|
||||||
|
|
||||||
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 with ZIP file in unzGetCurrentFileInfo.\n", err);
|
|
||||||
return err;
|
|
||||||
}
|
|
||||||
|
|
||||||
size_t size_buf = WRITEBUFFERSIZE;
|
|
||||||
void *buf = malloc(size_buf);
|
|
||||||
if (!buf)
|
|
||||||
{
|
|
||||||
RARCH_ERR("Error allocating memory\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 with ZIP file in unzOpenCurrentFile.\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 with ZIP file in unzReadCurrentFile.\n", err);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (err > 0)
|
|
||||||
{
|
|
||||||
if (fwrite(buf, err, 1, fout) != 1)
|
|
||||||
{
|
|
||||||
RARCH_ERR("Error in writing extracted file.\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 with ZIP file in unzCloseCurrentFile.\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 with ZIP file in unzGetGlobalInfo \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 with ZIP file in unzGoToNextFile\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[] = {
|
|
||||||
{ 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
|
|
||||||
};
|
|
||||||
#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;
|
|
||||||
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;
|
|
||||||
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;
|
|
||||||
#elif defined(GEKKO)
|
|
||||||
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;
|
|
||||||
#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
|
VIDEO EXTENSIONS
|
||||||
|
@ -672,10 +66,10 @@ struct aspect_ratio_elem aspectratio_lut[ASPECT_RATIO_END] = {
|
||||||
|
|
||||||
char rotation_lut[ASPECT_RATIO_END][PATH_MAX] =
|
char rotation_lut[ASPECT_RATIO_END][PATH_MAX] =
|
||||||
{
|
{
|
||||||
"Normal",
|
"Normal",
|
||||||
"Vertical",
|
"Vertical",
|
||||||
"Flipped",
|
"Flipped",
|
||||||
"Flipped Rotated"
|
"Flipped Rotated"
|
||||||
};
|
};
|
||||||
|
|
||||||
void rarch_set_auto_viewport(unsigned width, unsigned height)
|
void rarch_set_auto_viewport(unsigned width, unsigned height)
|
||||||
|
@ -910,175 +304,3 @@ const char * rarch_convert_wchar_to_const_char(const wchar_t * wstr)
|
||||||
wcstombs(str, wstr, sizeof(str));
|
wcstombs(str, wstr, sizeof(str));
|
||||||
return str;
|
return str;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*============================================================
|
|
||||||
CONFIG
|
|
||||||
============================================================ */
|
|
||||||
|
|
||||||
#ifdef HAVE_CONFIGFILE
|
|
||||||
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 _XBOX
|
|
||||||
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");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
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_set_auto_viewport(unsigned width, unsigned height);
|
||||||
extern void rarch_load_shader(unsigned slot, const char *path);
|
extern void rarch_load_shader(unsigned slot, const char *path);
|
||||||
|
|
||||||
#include "retroarch_console_input.h"
|
|
||||||
|
|
||||||
/*============================================================
|
|
||||||
SOUND
|
|
||||||
============================================================ */
|
|
||||||
|
|
||||||
enum
|
enum
|
||||||
{
|
{
|
||||||
SOUND_MODE_NORMAL,
|
SOUND_MODE_NORMAL,
|
||||||
|
@ -131,43 +125,35 @@ enum
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
/*============================================================
|
typedef struct
|
||||||
ROM EXTENSIONS
|
{
|
||||||
============================================================ */
|
char menu_border_file[PATH_MAX];
|
||||||
|
char border_file[PATH_MAX];
|
||||||
void rarch_console_load_game(const char *path);
|
char border_dir[PATH_MAX];
|
||||||
|
#ifdef HAVE_HDD_CACHE_PARTITION
|
||||||
// Get rom extensions for current library.
|
char cache_dir[PATH_MAX];
|
||||||
// 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
|
#endif
|
||||||
|
char cgp_dir[PATH_MAX];
|
||||||
/*============================================================
|
char config_file[PATH_MAX];
|
||||||
INPUT EXTENSIONS
|
char core_dir[PATH_MAX];
|
||||||
============================================================ */
|
char executable_extension[PATH_MAX];
|
||||||
|
char filesystem_root_dir[PATH_MAX];
|
||||||
#ifdef HAVE_DEFAULT_RETROPAD_INPUT
|
char input_presets_dir[PATH_MAX];
|
||||||
const char *rarch_input_find_platform_key_label(uint64_t joykey);
|
#ifdef HAVE_MULTIMAN
|
||||||
uint64_t rarch_input_find_previous_platform_key(uint64_t joykey);
|
char multiman_self_file[PATH_MAX];
|
||||||
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
|
#endif
|
||||||
|
char port_dir[PATH_MAX];
|
||||||
|
char savestate_dir[PATH_MAX];
|
||||||
|
#if defined(HAVE_CG) || defined(HAVE_HLSL) || defined(HAVE_GLSL)
|
||||||
|
char menu_shader_file[PATH_MAX];
|
||||||
|
char shader_file[PATH_MAX];
|
||||||
|
char shader_dir[PATH_MAX];
|
||||||
|
#endif
|
||||||
|
char sram_dir[PATH_MAX];
|
||||||
|
char system_dir[PATH_MAX];
|
||||||
|
} default_paths_t;
|
||||||
|
|
||||||
|
extern default_paths_t default_paths;
|
||||||
|
|
||||||
/*============================================================
|
/*============================================================
|
||||||
RetroArch
|
RetroArch
|
||||||
|
@ -226,13 +212,9 @@ const char * rarch_convert_wchar_to_const_char(const wchar_t * wstr);
|
||||||
|
|
||||||
enum
|
enum
|
||||||
{
|
{
|
||||||
CONFIG_FILE,
|
MODE_EMULATION = 0,
|
||||||
SHADER_PRESET_FILE,
|
MODE_MENU,
|
||||||
INPUT_PRESET_FILE
|
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
|
#endif
|
||||||
|
|
|
@ -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
|
KEYBIND_DEFAULT
|
||||||
};
|
};
|
||||||
|
|
||||||
enum
|
|
||||||
{
|
|
||||||
MODE_EMULATION = 0,
|
|
||||||
MODE_MENU,
|
|
||||||
MODE_EXIT
|
|
||||||
};
|
|
||||||
|
|
||||||
enum
|
enum
|
||||||
{
|
{
|
||||||
DPAD_EMULATION_NONE = 0,
|
DPAD_EMULATION_NONE = 0,
|
||||||
|
@ -41,192 +34,23 @@ enum
|
||||||
DPAD_EMULATION_RSTICK
|
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 "../wii/wii_input.h"
|
|
||||||
|
|
||||||
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
|
|
||||||
|
|
||||||
extern uint64_t rarch_default_keybind_lut[RARCH_FIRST_META_KEY];
|
extern uint64_t rarch_default_keybind_lut[RARCH_FIRST_META_KEY];
|
||||||
extern char rarch_default_libretro_keybind_name_lut[RARCH_FIRST_META_KEY][256];
|
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
|
#endif
|
||||||
|
|
|
@ -0,0 +1,84 @@
|
||||||
|
/* 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 "console_settings.h"
|
||||||
|
|
||||||
|
#include "retroarch_rom_ext.h"
|
||||||
|
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
}
|
|
@ -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(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);
|
||||||
|
|
||||||
|
#endif
|
|
@ -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 <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)
|
||||||
|
{
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
|
char write_filename[PATH_MAX];
|
||||||
|
|
||||||
|
#ifdef HAVE_HDD_CACHE_PARTITION
|
||||||
|
snprintf(write_filename, sizeof(write_filename), "%s%s", default_paths.cache_dir, filename_inzip);
|
||||||
|
#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)
|
||||||
|
{
|
||||||
|
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;
|
||||||
|
}
|
|
@ -0,0 +1,26 @@
|
||||||
|
/* 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)
|
||||||
|
|
||||||
|
int rarch_extract_zipfile(const char *zip_path);
|
||||||
|
|
||||||
|
#endif
|
|
@ -14,16 +14,17 @@
|
||||||
typedef size_t ptrdiff_t;
|
typedef size_t ptrdiff_t;
|
||||||
typedef size_t ptrdiff_t;
|
typedef size_t ptrdiff_t;
|
||||||
|
|
||||||
typedef struct _Elf32_cgParameter {
|
typedef struct _Elf32_cgParameter
|
||||||
unsigned int cgp_name;
|
{
|
||||||
unsigned int cgp_semantic;
|
unsigned int cgp_name;
|
||||||
unsigned short cgp_default;
|
unsigned int cgp_semantic;
|
||||||
unsigned short cgp_reloc;
|
unsigned short cgp_default;
|
||||||
unsigned short cgp_resource;
|
unsigned short cgp_reloc;
|
||||||
unsigned short cgp_resource_index;
|
unsigned short cgp_resource;
|
||||||
unsigned char cgp_type;
|
unsigned short cgp_resource_index;
|
||||||
unsigned short cgp_info;
|
unsigned char cgp_type;
|
||||||
unsigned char unused;
|
unsigned short cgp_info;
|
||||||
|
unsigned char unused;
|
||||||
} Elf32_cgParameter;
|
} Elf32_cgParameter;
|
||||||
|
|
||||||
#define ET_NONE 0
|
#define ET_NONE 0
|
||||||
|
@ -173,21 +174,22 @@ typedef struct _Elf32_cgParameter {
|
||||||
#define R_RSX_NONE 0
|
#define R_RSX_NONE 0
|
||||||
#define R_RSX_FLOAT4 1
|
#define R_RSX_FLOAT4 1
|
||||||
|
|
||||||
struct Elf32_Ehdr {
|
struct Elf32_Ehdr
|
||||||
unsigned char e_ident[EI_NIDENT];
|
{
|
||||||
unsigned short e_type;
|
unsigned char e_ident[EI_NIDENT];
|
||||||
unsigned short e_machine;
|
unsigned short e_type;
|
||||||
unsigned int e_version;
|
unsigned short e_machine;
|
||||||
unsigned int e_entry;
|
unsigned int e_version;
|
||||||
unsigned int e_phoff;
|
unsigned int e_entry;
|
||||||
unsigned int e_shoff;
|
unsigned int e_phoff;
|
||||||
unsigned int e_flags;
|
unsigned int e_shoff;
|
||||||
unsigned short e_ehsize;
|
unsigned int e_flags;
|
||||||
unsigned short e_phentsize;
|
unsigned short e_ehsize;
|
||||||
unsigned short e_phnum;
|
unsigned short e_phentsize;
|
||||||
unsigned short e_shentsize;
|
unsigned short e_phnum;
|
||||||
unsigned short e_shnum;
|
unsigned short e_shentsize;
|
||||||
unsigned short e_shstrndx;
|
unsigned short e_shnum;
|
||||||
|
unsigned short e_shstrndx;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct Elf32_Shdr {
|
struct Elf32_Shdr {
|
||||||
|
@ -223,30 +225,31 @@ struct Elf32_Sym {
|
||||||
unsigned short st_shndx;
|
unsigned short st_shndx;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct Elf32_Note {
|
struct Elf32_Note
|
||||||
unsigned int n_namesz; /* Name size */
|
{
|
||||||
unsigned int n_descsz; /* Content size */
|
unsigned int n_namesz; /* Name size */
|
||||||
unsigned int n_type; /* Content type */
|
unsigned int n_descsz; /* Content size */
|
||||||
|
unsigned int n_type; /* Content type */
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
struct Elf32_Rel {
|
struct Elf32_Rel {
|
||||||
unsigned int r_offset;
|
unsigned int r_offset;
|
||||||
unsigned int r_info;
|
unsigned int r_info;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct Elf32_Rela {
|
struct Elf32_Rela {
|
||||||
unsigned int r_offset;
|
unsigned int r_offset;
|
||||||
unsigned int r_info;
|
unsigned int r_info;
|
||||||
signed int r_addend;
|
signed int r_addend;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct Elf32_Dyn {
|
struct Elf32_Dyn {
|
||||||
signed int d_tag;
|
signed int d_tag;
|
||||||
union {
|
union {
|
||||||
unsigned int d_val;
|
unsigned int d_val;
|
||||||
unsigned int d_ptr;
|
unsigned int d_ptr;
|
||||||
} d_un;
|
} d_un;
|
||||||
};
|
};
|
||||||
|
|
||||||
using std::istream;
|
using std::istream;
|
||||||
|
@ -255,21 +258,21 @@ namespace cgc {
|
||||||
namespace bio {
|
namespace bio {
|
||||||
|
|
||||||
enum CGBIO_ERROR {
|
enum CGBIO_ERROR {
|
||||||
CGBIO_ERROR_NO_ERROR,
|
CGBIO_ERROR_NO_ERROR,
|
||||||
CGBIO_ERROR_LOADED,
|
CGBIO_ERROR_LOADED,
|
||||||
CGBIO_ERROR_FILEIO,
|
CGBIO_ERROR_FILEIO,
|
||||||
CGBIO_ERROR_FORMAT,
|
CGBIO_ERROR_FORMAT,
|
||||||
CGBIO_ERROR_INDEX,
|
CGBIO_ERROR_INDEX,
|
||||||
CGBIO_ERROR_MEMORY,
|
CGBIO_ERROR_MEMORY,
|
||||||
CGBIO_ERROR_RELOC,
|
CGBIO_ERROR_RELOC,
|
||||||
CGBIO_ERROR_SYMBOL,
|
CGBIO_ERROR_SYMBOL,
|
||||||
CGBIO_ERROR_UNKNOWN_TYPE
|
CGBIO_ERROR_UNKNOWN_TYPE
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
CGBIODATANONE = ELFDATANONE,
|
CGBIODATANONE = ELFDATANONE,
|
||||||
CGBIODATALSB = ELFDATA2LSB,
|
CGBIODATALSB = ELFDATA2LSB,
|
||||||
CGBIODATAMSB = ELFDATA2MSB
|
CGBIODATAMSB = ELFDATA2MSB
|
||||||
} HOST_ENDIANNESS;
|
} HOST_ENDIANNESS;
|
||||||
|
|
||||||
class elf_reader
|
class elf_reader
|
||||||
|
|
|
@ -20,59 +20,61 @@
|
||||||
|
|
||||||
static unsigned int stringTableAdd( STL_NAMESPACE vector<char> &stringTable, const char* str )
|
static unsigned int stringTableAdd( STL_NAMESPACE vector<char> &stringTable, const char* str )
|
||||||
{
|
{
|
||||||
unsigned int ret = (unsigned int)stringTable.size();
|
unsigned int ret = (unsigned int)stringTable.size();
|
||||||
|
|
||||||
if ( ret == 0 )
|
if ( ret == 0 )
|
||||||
{
|
{
|
||||||
stringTable.push_back('\0');
|
stringTable.push_back('\0');
|
||||||
ret = 1;
|
ret = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t stringLength = strlen(str) + 1;
|
size_t stringLength = strlen(str) + 1;
|
||||||
stringTable.resize(ret + stringLength);
|
stringTable.resize(ret + stringLength);
|
||||||
memcpy(&stringTable[0] + ret,str,stringLength);
|
memcpy(&stringTable[0] + ret,str,stringLength);
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static unsigned int stringTableFind( STL_NAMESPACE vector<char> &stringTable, const char* str )
|
static unsigned int stringTableFind( STL_NAMESPACE vector<char> &stringTable, const char* str )
|
||||||
{
|
{
|
||||||
const char* data = &stringTable[0];
|
const char* data = &stringTable[0];
|
||||||
size_t size = stringTable.size();
|
size_t size = stringTable.size();
|
||||||
const char *end = data + size;
|
const char *end = data + size;
|
||||||
|
|
||||||
size_t length = strlen(str);
|
size_t length = strlen(str);
|
||||||
if (length+1 > size)
|
|
||||||
return 0;
|
|
||||||
data += length;
|
|
||||||
|
|
||||||
const char *p = (char*)memchr(data,'\0',end-data);
|
if (length+1 > size)
|
||||||
while (p && (end-data)>0)
|
return 0;
|
||||||
{
|
|
||||||
if (!memcmp(p - length, str, length))
|
data += length;
|
||||||
{
|
|
||||||
return (unsigned int)(p - length - &stringTable[0]);
|
const char *p = (char*)memchr(data,'\0',end-data);
|
||||||
}
|
while (p && (end-data)>0)
|
||||||
data = p+1;
|
{
|
||||||
p = (char*)memchr(data,'\0',end-data);
|
if (!memcmp(p - length, str, length))
|
||||||
}
|
return (unsigned int)(p - length - &stringTable[0]);
|
||||||
return 0;
|
|
||||||
|
data = p+1;
|
||||||
|
p = (char*)memchr(data,'\0',end-data);
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static unsigned int stringTableAddUnique( STL_NAMESPACE vector<char> &stringTable, const char* str )
|
static unsigned int stringTableAddUnique( STL_NAMESPACE vector<char> &stringTable, const char* str )
|
||||||
{
|
{
|
||||||
if ( stringTable.size() == 0 )
|
if ( stringTable.size() == 0 )
|
||||||
stringTable.push_back('\0');
|
stringTable.push_back('\0');
|
||||||
unsigned int ret = stringTableFind(stringTable, str);
|
|
||||||
if (ret == 0 && str[0] != '\0')
|
unsigned int ret = stringTableFind(stringTable, str);
|
||||||
ret = stringTableAdd(stringTable, str);
|
|
||||||
return ret;
|
if (ret == 0 && str[0] != '\0')
|
||||||
|
ret = stringTableAdd(stringTable, str);
|
||||||
|
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
int convertNvToElfFromFile(const char *sourceFile, int endianness, int constTableOffset, void **binaryShader, int *size,
|
int convertNvToElfFromFile(const char *sourceFile, int endianness, int constTableOffset, void **binaryShader, int *size, STL_NAMESPACE vector<char> &stringTable, STL_NAMESPACE vector<float> &defaultValues);
|
||||||
STL_NAMESPACE vector<char> &stringTable, STL_NAMESPACE vector<float> &defaultValues);
|
int convertNvToElfFromMemory(const void *sourceData, size_t size, int endianness, int constTableOffset, void **binaryShader, int *binarySize, STL_NAMESPACE vector<char> &stringTable, STL_NAMESPACE vector<float> &defaultValues);
|
||||||
int convertNvToElfFromMemory(const void *sourceData, size_t size, int endianness, int constTableOffset, void **binaryShader, int *binarySize,
|
|
||||||
STL_NAMESPACE vector<char> &stringTable, STL_NAMESPACE vector<float> &defaultValues);
|
|
||||||
|
|
||||||
int convertNvToElfFreeBinaryShader(void *binaryShader);
|
int convertNvToElfFreeBinaryShader(void *binaryShader);
|
||||||
|
|
||||||
|
|
|
@ -18,7 +18,11 @@
|
||||||
#include <sys/synchronization.h>
|
#include <sys/synchronization.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#include "../../../general.h"
|
||||||
|
|
||||||
|
#ifndef __PSL1GHT__
|
||||||
using namespace cell::Gcm;
|
using namespace cell::Gcm;
|
||||||
|
#endif
|
||||||
|
|
||||||
#define _RGL_MAX_TILED_REGIONS 15
|
#define _RGL_MAX_TILED_REGIONS 15
|
||||||
|
|
||||||
|
@ -185,8 +189,6 @@ void _RGLFifoFinish( RGLFifo *fifo )
|
||||||
{
|
{
|
||||||
if ( !_RGLFifoReferenceInUse( fifo, ref ) )
|
if ( !_RGLFifoReferenceInUse( fifo, ref ) )
|
||||||
break;
|
break;
|
||||||
|
|
||||||
sys_timer_usleep( 10 );
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -221,7 +223,6 @@ static void _RGLFifoInit( RGLFifo *fifo, void *dmaControl, unsigned long dmaPush
|
||||||
{
|
{
|
||||||
if ( _RGLFifoReadReference( fifo ) == 0 )
|
if ( _RGLFifoReadReference( fifo ) == 0 )
|
||||||
break;
|
break;
|
||||||
sys_timer_usleep( 10 );
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
fifo->dmaPushBufferGPU = dmaPushBuffer;
|
fifo->dmaPushBufferGPU = dmaPushBuffer;
|
||||||
|
@ -307,7 +308,7 @@ GLboolean _RGLInit( PSGLinitOptions* options, RGLResource *resource )
|
||||||
{
|
{
|
||||||
if ( !_RGLInitFromRM( resource ) )
|
if ( !_RGLInitFromRM( resource ) )
|
||||||
{
|
{
|
||||||
fprintf( stderr, "PSGL GCM failed initialisation" );
|
RARCH_ERR("RGL GCM failed initialisation.\n");
|
||||||
return GL_FALSE;
|
return GL_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -318,7 +319,7 @@ GLboolean _RGLInit( PSGLinitOptions* options, RGLResource *resource )
|
||||||
resource->hostMemoryBase + resource->hostMemoryReserved,
|
resource->hostMemoryBase + resource->hostMemoryReserved,
|
||||||
resource->hostMemorySize - resource->hostMemoryReserved ) == GMM_ERROR )
|
resource->hostMemorySize - resource->hostMemoryReserved ) == GMM_ERROR )
|
||||||
{
|
{
|
||||||
fprintf( stderr, "Could not init GPU memory manager" );
|
RARCH_ERR("Could not initialize GPU memory manager.\n");
|
||||||
_RGLDestroy();
|
_RGLDestroy();
|
||||||
return GL_FALSE;
|
return GL_FALSE;
|
||||||
}
|
}
|
||||||
|
@ -405,7 +406,7 @@ const VideoMode *_RGLDetectVideoMode (void)
|
||||||
int ret = cellVideoOutGetState( CELL_VIDEO_OUT_PRIMARY, 0, &videoState );
|
int ret = cellVideoOutGetState( CELL_VIDEO_OUT_PRIMARY, 0, &videoState );
|
||||||
if ( ret < 0 )
|
if ( ret < 0 )
|
||||||
{
|
{
|
||||||
printf("RGL WARN: couldn't read the video configuration, using a default 720p resolution.\n");
|
RARCH_WARN("Couldn't read the video configuration, using a default 720p resolution.\n");
|
||||||
videoState.displayMode.scanMode = CELL_VIDEO_OUT_SCAN_MODE_PROGRESSIVE;
|
videoState.displayMode.scanMode = CELL_VIDEO_OUT_SCAN_MODE_PROGRESSIVE;
|
||||||
videoState.displayMode.resolutionId = CELL_VIDEO_OUT_RESOLUTION_720;
|
videoState.displayMode.resolutionId = CELL_VIDEO_OUT_RESOLUTION_720;
|
||||||
}
|
}
|
||||||
|
@ -473,9 +474,8 @@ static unsigned int findValidPitch( unsigned int pitch )
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
for ( GLuint i = 0;i < validPitchCount - 1;++i )
|
for ( GLuint i = 0;i < validPitchCount - 1;++i )
|
||||||
{
|
|
||||||
if (( pitch > validPitch[i] ) && ( pitch <= validPitch[i+1] ) ) return validPitch[i+1];
|
if (( pitch > validPitch[i] ) && ( pitch <= validPitch[i+1] ) ) return validPitch[i+1];
|
||||||
}
|
|
||||||
return validPitch[validPitchCount-1];
|
return validPitch[validPitchCount-1];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -518,7 +518,6 @@ int32_t _RGLOutOfSpaceCallback( struct CellGcmContextData* fifoContext, uint32_t
|
||||||
|| (get < fifo->dmaPushBufferOffset) || (get > fifo->dmaPushBufferOffset +
|
|| (get < fifo->dmaPushBufferOffset) || (get > fifo->dmaPushBufferOffset +
|
||||||
fifo->dmaPushBufferSizeInWords*sizeof(uint32_t)))
|
fifo->dmaPushBufferSizeInWords*sizeof(uint32_t)))
|
||||||
{
|
{
|
||||||
sys_timer_usleep(30);
|
|
||||||
get = fifo->dmaControl->Get;
|
get = fifo->dmaControl->Get;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -538,15 +537,15 @@ void _RGLGraphicsHandler( const uint32_t head )
|
||||||
uint32_t *tmp = ( uint32_t * )(( char* )fifo->dmaPushBufferBegin - fifo->dmaPushBufferOffset + ( *(( volatile GLuint* ) & fifo->dmaControl->Get ) ) );
|
uint32_t *tmp = ( uint32_t * )(( char* )fifo->dmaPushBufferBegin - fifo->dmaPushBufferOffset + ( *(( volatile GLuint* ) & fifo->dmaControl->Get ) ) );
|
||||||
if (( tmp >= fifo->begin ) && ( tmp <= fifo->end ) ) fifo->lastGetRead = tmp;
|
if (( tmp >= fifo->begin ) && ( tmp <= fifo->end ) ) fifo->lastGetRead = tmp;
|
||||||
|
|
||||||
printf("RGL: Current PSGL FIFO info \n" );
|
RARCH_ERR("Current PSGL FIFO info:\n" );
|
||||||
printf("RGL: Fifo Begin %p End %p Current %p and Get %p \n",
|
RARCH_ERR("FIFO Begin %p End %p Current %p and Get %p \n",
|
||||||
_RGLState.fifo.begin, _RGLState.fifo.end, _RGLState.fifo.current,
|
_RGLState.fifo.begin, _RGLState.fifo.end, _RGLState.fifo.current,
|
||||||
_RGLState.fifo.lastGetRead );
|
_RGLState.fifo.lastGetRead );
|
||||||
|
|
||||||
printf("RGL: Last 10 words of the PSGL Fifo from the ppu put/current position \n" );
|
RARCH_ERR("Last 10 words of the PSGL Fifo from the ppu put/current position \n" );
|
||||||
_RGLPrintFifoFromPut( 10 );
|
_RGLPrintFifoFromPut( 10 );
|
||||||
|
|
||||||
printf("RGL: Last 10 words of the PSGL Fifo from the gpu get position \n" );
|
RARCH_ERR("Last 10 words of the PSGL Fifo from the gpu get position \n" );
|
||||||
_RGLPrintFifoFromGet( 10 );
|
_RGLPrintFifoFromGet( 10 );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -565,7 +564,7 @@ static int _RGLInitRM( RGLResource *gcmResource, unsigned int hostMemorySize, in
|
||||||
|
|
||||||
if ( cellGcmInit( _RGL_FIFO_SIZE, gcmResource->hostMemorySize, gcmResource->hostMemoryBase ) != 0 )
|
if ( cellGcmInit( _RGL_FIFO_SIZE, gcmResource->hostMemorySize, gcmResource->hostMemoryBase ) != 0 )
|
||||||
{
|
{
|
||||||
printf("RGL: RSXIF failed initialization\n" );
|
RARCH_ERR("RSXIF failed initialization.\n");
|
||||||
return GL_FALSE;
|
return GL_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -583,7 +582,7 @@ static int _RGLInitRM( RGLResource *gcmResource, unsigned int hostMemorySize, in
|
||||||
gcmResource->semaphores = ( RGLSemaphoreMemory * )cellGcmGetLabelAddress( 0 );
|
gcmResource->semaphores = ( RGLSemaphoreMemory * )cellGcmGetLabelAddress( 0 );
|
||||||
gcmResource->dmaControl = ( char* ) cellGcmGetControlRegister() - (( char * ) & (( RGLControlDma* )0 )->Put - ( char * )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->hostMemorySize -= dmaPushBufferSize + _RGL_DMA_PUSH_BUFFER_PREFETCH_PADDING;
|
||||||
gcmResource->dmaPushBuffer = gcmResource->hostMemoryBase + gcmResource->hostMemorySize;
|
gcmResource->dmaPushBuffer = gcmResource->hostMemoryBase + gcmResource->hostMemorySize;
|
||||||
|
@ -595,13 +594,14 @@ static int _RGLInitRM( RGLResource *gcmResource, unsigned int hostMemorySize, in
|
||||||
|
|
||||||
gCellGcmCurrentContext->callback = ( CellGcmContextCallback )_RGLOutOfSpaceCallback;
|
gCellGcmCurrentContext->callback = ( CellGcmContextCallback )_RGLOutOfSpaceCallback;
|
||||||
|
|
||||||
|
#ifdef LOG_VERBOSE
|
||||||
printf( "RGL: MClk: %f Mhz NVClk: %f Mhz\n", ( float )gcmResource->MemoryClock / 1E6, ( float )gcmResource->GraphicsClock / 1E6 );
|
RARCH_LOG("MClk: %f Mhz NVClk: %f Mhz.\n", ( float )gcmResource->MemoryClock / 1E6, ( float )gcmResource->GraphicsClock / 1E6 );
|
||||||
printf( "RGL: Video Memory: %i MB\n", gcmResource->localSize / ( 1024*1024 ) );
|
RARCH_LOG("Video Memory: %i MB.\n", gcmResource->localSize / ( 1024*1024 ) );
|
||||||
printf( "RGL: localAddress mapped at %p\n", gcmResource->localAddress );
|
RARCH_LOG("Local address mapped at %p.\n", gcmResource->localAddress );
|
||||||
printf( "RGL: push buffer at %p - %p (size = 0x%X), offset=0x%lx\n",
|
RARCH_LOG("Push buffer at %p - %p (size = 0x%X), offset=0x%lx.\n",
|
||||||
gcmResource->dmaPushBuffer, ( char* )gcmResource->dmaPushBuffer + gcmResource->dmaPushBufferSize, gcmResource->dmaPushBufferSize, gcmResource->dmaPushBufferOffset );
|
gcmResource->dmaPushBuffer, ( char* )gcmResource->dmaPushBuffer + gcmResource->dmaPushBufferSize, gcmResource->dmaPushBufferSize, gcmResource->dmaPushBufferOffset );
|
||||||
printf( "RGL: dma control at %p\n", gcmResource->dmaControl );
|
RARCH_LOG("DMA control at %p.\n", gcmResource->dmaControl );
|
||||||
|
#endif
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
@ -621,7 +621,7 @@ void _RGLDeviceInit( PSGLinitOptions* options )
|
||||||
|
|
||||||
if ( !_RGLInitRM( &_RGLResource, hostSize, 0, fifoSize ) )
|
if ( !_RGLInitRM( &_RGLResource, hostSize, 0, fifoSize ) )
|
||||||
{
|
{
|
||||||
printf("RGL: RM resource failed initialisation\n" );
|
RARCH_ERR("RM resource failed initialization.\n" );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -714,7 +714,9 @@ GLboolean _RGLAllocateColorSurface(
|
||||||
*pitchAllocated = 0;
|
*pitchAllocated = 0;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
printf("RGL: Allocating GPU memory (tiled): %d bytes allocated at id 0x%08x.\n", *bytesAllocated, *id );
|
{
|
||||||
|
RARCH_LOG("Allocating GPU memory (tiled): %d bytes allocated at id 0x%08x.\n", *bytesAllocated, *id );
|
||||||
|
}
|
||||||
|
|
||||||
return *bytesAllocated > 0;
|
return *bytesAllocated > 0;
|
||||||
}
|
}
|
||||||
|
@ -731,8 +733,7 @@ GLboolean _RGLAllocateColorSurface(
|
||||||
|
|
||||||
static void rescInit( const PSGLdeviceParameters* params, RGLDevice *gcmDevice )
|
static void rescInit( const PSGLdeviceParameters* params, RGLDevice *gcmDevice )
|
||||||
{
|
{
|
||||||
printf("RGL WARN: RESC is enabled.\n");
|
RARCH_WARN("RESC is enabled.\n");
|
||||||
GLboolean result = 0;
|
|
||||||
|
|
||||||
CellRescBufferMode dstBufferMode;
|
CellRescBufferMode dstBufferMode;
|
||||||
if ( params->width == 720 && params->height == 480 ) dstBufferMode = CELL_RESC_720x480;
|
if ( params->width == 720 && params->height == 480 ) dstBufferMode = CELL_RESC_720x480;
|
||||||
|
@ -742,7 +743,7 @@ static void rescInit( const PSGLdeviceParameters* params, RGLDevice *gcmDevice )
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
dstBufferMode = CELL_RESC_720x480;
|
dstBufferMode = CELL_RESC_720x480;
|
||||||
printf("RGL: Invalid display resolution for resolution conversion: %ux%u. Defaulting to 720x480...\n", params->width, params->height );
|
RARCH_ERR("Invalid display resolution for resolution conversion: %ux%u. Defaulting to 720x480...\n", params->width, params->height );
|
||||||
}
|
}
|
||||||
|
|
||||||
CellRescInitConfig conf;
|
CellRescInitConfig conf;
|
||||||
|
@ -763,7 +764,7 @@ static void rescInit( const PSGLdeviceParameters* params, RGLDevice *gcmDevice )
|
||||||
GLuint colorBuffersPitch;
|
GLuint colorBuffersPitch;
|
||||||
uint32_t numColorBuffers = cellRescGetNumColorBuffers( dstBufferMode, ( CellRescPalTemporalMode )conf.palTemporalMode, 0 );
|
uint32_t numColorBuffers = cellRescGetNumColorBuffers( dstBufferMode, ( CellRescPalTemporalMode )conf.palTemporalMode, 0 );
|
||||||
|
|
||||||
result = _RGLAllocateColorSurface( params->width, params->height * numColorBuffers,
|
_RGLAllocateColorSurface( params->width, params->height * numColorBuffers,
|
||||||
4*8, &(gcmDevice->RescColorBuffersId), &colorBuffersPitch, &size );
|
4*8, &(gcmDevice->RescColorBuffersId), &colorBuffersPitch, &size );
|
||||||
|
|
||||||
CellRescDsts dsts = { CELL_RESC_SURFACE_A8R8G8B8, colorBuffersPitch, 1 };
|
CellRescDsts dsts = { CELL_RESC_SURFACE_A8R8G8B8, colorBuffersPitch, 1 };
|
||||||
|
@ -814,13 +815,10 @@ static int _RGLPlatformCreateDevice( PSGLdevice* device )
|
||||||
jsTiledMemoryManager* mm = &_RGLTiledMemoryManager;
|
jsTiledMemoryManager* mm = &_RGLTiledMemoryManager;
|
||||||
|
|
||||||
_RGLDuringDestroyDevice = GL_FALSE;
|
_RGLDuringDestroyDevice = GL_FALSE;
|
||||||
GLboolean result = 0;
|
|
||||||
|
|
||||||
int32_t retVal;
|
|
||||||
|
|
||||||
memset( mm->region, 0, sizeof( mm->region ) );
|
memset( mm->region, 0, sizeof( mm->region ) );
|
||||||
for ( int i = 0;i < _RGL_MAX_TILED_REGIONS;++i )
|
for ( int i = 0;i < _RGL_MAX_TILED_REGIONS;++i )
|
||||||
retVal = cellGcmUnbindTile( i );
|
cellGcmUnbindTile( i );
|
||||||
|
|
||||||
|
|
||||||
const VideoMode *vm = NULL;
|
const VideoMode *vm = NULL;
|
||||||
|
@ -873,7 +871,7 @@ static int _RGLPlatformCreateDevice( PSGLdevice* device )
|
||||||
gcmDevice->color[i].pool = _RGL_SURFACE_POOL_LINEAR;
|
gcmDevice->color[i].pool = _RGL_SURFACE_POOL_LINEAR;
|
||||||
|
|
||||||
GLuint size;
|
GLuint size;
|
||||||
result = _RGLAllocateColorSurface(width, height,
|
_RGLAllocateColorSurface(width, height,
|
||||||
gcmDevice->color[i].bpp*8, &gcmDevice->color[i].dataId,
|
gcmDevice->color[i].bpp*8, &gcmDevice->color[i].dataId,
|
||||||
&gcmDevice->color[i].pitch, &size );
|
&gcmDevice->color[i].pitch, &size );
|
||||||
}
|
}
|
||||||
|
@ -961,7 +959,7 @@ static int _RGLPlatformCreateDevice( PSGLdevice* device )
|
||||||
|
|
||||||
if ( cellRescSetSrc( i, &rescSrc ) != CELL_OK )
|
if ( cellRescSetSrc( i, &rescSrc ) != CELL_OK )
|
||||||
{
|
{
|
||||||
printf("RGL: Registering display buffer %d failed\n", i );
|
RARCH_ERR("Registering display buffer %d failed.\n", i );
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -978,7 +976,7 @@ static int _RGLPlatformCreateDevice( PSGLdevice* device )
|
||||||
{
|
{
|
||||||
if ( cellGcmSetDisplayBuffer( i, gmmIdToOffset( gcmDevice->color[i].dataId ), gcmDevice->color[i].pitch , width, height ) != CELL_OK )
|
if ( cellGcmSetDisplayBuffer( i, gmmIdToOffset( gcmDevice->color[i].dataId ), gcmDevice->color[i].pitch , width, height ) != CELL_OK )
|
||||||
{
|
{
|
||||||
printf("RGL: Registering display buffer %d failed\n", i );
|
RARCH_ERR("Registering display buffer %d failed.\n", i );
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1221,7 +1219,7 @@ GLAPI void psglSwap( void )
|
||||||
int32_t res = cellRescSetConvertAndFlip(( uint8_t ) drawBuffer );
|
int32_t res = cellRescSetConvertAndFlip(( uint8_t ) drawBuffer );
|
||||||
if ( res != CELL_OK )
|
if ( res != CELL_OK )
|
||||||
{
|
{
|
||||||
printf("RGL WARN: RESC cellRescSetConvertAndFlip returned error code %d.\n", res);
|
RARCH_WARN("RESC cellRescSetConvertAndFlip returned error code %d.\n", res);
|
||||||
if ( _CurrentContext ) _CurrentContext->needValidate |= PSGL_VALIDATE_FRAMEBUFFER;
|
if ( _CurrentContext ) _CurrentContext->needValidate |= PSGL_VALIDATE_FRAMEBUFFER;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -1292,8 +1290,7 @@ static inline void _RGLUtilWaitForIdle (void)
|
||||||
cellGcmSetWriteBackEndLabelInline( &_RGLState.fifo, RGL_UTIL_LABEL_INDEX, _RGLState.labelValue);
|
cellGcmSetWriteBackEndLabelInline( &_RGLState.fifo, RGL_UTIL_LABEL_INDEX, _RGLState.labelValue);
|
||||||
cellGcmFlush();
|
cellGcmFlush();
|
||||||
|
|
||||||
while( *(cellGcmGetLabelAddress( RGL_UTIL_LABEL_INDEX)) != _RGLState.labelValue)
|
while( *(cellGcmGetLabelAddress( RGL_UTIL_LABEL_INDEX)) != _RGLState.labelValue);
|
||||||
sys_timer_usleep(30);
|
|
||||||
|
|
||||||
_RGLState.labelValue++;
|
_RGLState.labelValue++;
|
||||||
}
|
}
|
||||||
|
@ -1301,7 +1298,6 @@ static inline void _RGLUtilWaitForIdle (void)
|
||||||
GLboolean _RGLTryResizeTileRegion( GLuint address, GLuint size, void* data )
|
GLboolean _RGLTryResizeTileRegion( GLuint address, GLuint size, void* data )
|
||||||
{
|
{
|
||||||
jsTiledRegion* region = ( jsTiledRegion* )data;
|
jsTiledRegion* region = ( jsTiledRegion* )data;
|
||||||
int32_t retVal = 0;
|
|
||||||
|
|
||||||
if ( size == 0 )
|
if ( size == 0 )
|
||||||
{
|
{
|
||||||
|
@ -1312,7 +1308,7 @@ GLboolean _RGLTryResizeTileRegion( GLuint address, GLuint size, void* data )
|
||||||
if ( ! _RGLDuringDestroyDevice )
|
if ( ! _RGLDuringDestroyDevice )
|
||||||
{
|
{
|
||||||
_RGLUtilWaitForIdle();
|
_RGLUtilWaitForIdle();
|
||||||
retVal = cellGcmUnbindTile( region->id );
|
cellGcmUnbindTile( region->id );
|
||||||
_RGLFifoFinish( &_RGLState.fifo );
|
_RGLFifoFinish( &_RGLState.fifo );
|
||||||
}
|
}
|
||||||
return GL_TRUE;
|
return GL_TRUE;
|
||||||
|
@ -1322,11 +1318,11 @@ GLboolean _RGLTryResizeTileRegion( GLuint address, GLuint size, void* data )
|
||||||
|
|
||||||
_RGLUtilWaitForIdle();
|
_RGLUtilWaitForIdle();
|
||||||
|
|
||||||
retVal = cellGcmSetTileInfo(region->id, CELL_GCM_LOCATION_LOCAL,
|
cellGcmSetTileInfo(region->id, CELL_GCM_LOCATION_LOCAL,
|
||||||
region->offset, region->size, region->pitch, CELL_GCM_COMPMODE_DISABLED, 0,
|
region->offset, region->size, region->pitch, CELL_GCM_COMPMODE_DISABLED, 0,
|
||||||
region->bank );
|
region->bank );
|
||||||
|
|
||||||
retVal = cellGcmBindTile( region->id );
|
cellGcmBindTile( region->id );
|
||||||
|
|
||||||
_RGLFifoFinish( &_RGLState.fifo );
|
_RGLFifoFinish( &_RGLState.fifo );
|
||||||
|
|
||||||
|
|
|
@ -57,22 +57,22 @@ extern "C"
|
||||||
#define GLAPI extern
|
#define GLAPI extern
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
typedef unsigned int GLenum;
|
typedef unsigned int GLenum;
|
||||||
typedef unsigned char GLboolean;
|
typedef unsigned char GLboolean;
|
||||||
typedef unsigned int GLbitfield;
|
typedef unsigned int GLbitfield;
|
||||||
typedef signed char GLbyte;
|
typedef signed char GLbyte;
|
||||||
typedef short GLshort;
|
typedef short GLshort;
|
||||||
typedef int GLint;
|
typedef int GLint;
|
||||||
typedef int GLsizei;
|
typedef int GLsizei;
|
||||||
typedef unsigned char GLubyte;
|
typedef unsigned char GLubyte;
|
||||||
typedef unsigned short GLushort;
|
typedef unsigned short GLushort;
|
||||||
typedef unsigned int GLuint;
|
typedef unsigned int GLuint;
|
||||||
typedef float GLfloat;
|
typedef float GLfloat;
|
||||||
typedef float GLclampf;
|
typedef float GLclampf;
|
||||||
typedef void GLvoid;
|
typedef void GLvoid;
|
||||||
typedef int GLfixed;
|
typedef int GLfixed;
|
||||||
typedef int GLclampx;
|
typedef int GLclampx;
|
||||||
typedef void( *_GLfuncptr )();
|
typedef void( *_GLfuncptr )();
|
||||||
|
|
||||||
#define GL_OES_VERSION_1_0 1
|
#define GL_OES_VERSION_1_0 1
|
||||||
#define GL_OES_read_format 1
|
#define GL_OES_read_format 1
|
||||||
|
@ -290,35 +290,35 @@ extern "C"
|
||||||
#define GL_REPEAT 0x2901
|
#define GL_REPEAT 0x2901
|
||||||
#define GL_CLAMP_TO_EDGE 0x812F
|
#define GL_CLAMP_TO_EDGE 0x812F
|
||||||
|
|
||||||
GLAPI void APIENTRY glActiveTexture( GLenum texture );
|
GLAPI void APIENTRY glActiveTexture( GLenum texture );
|
||||||
GLAPI void APIENTRY glBindTexture( GLenum target, GLuint texture );
|
GLAPI void APIENTRY glBindTexture( GLenum target, GLuint texture );
|
||||||
GLAPI void APIENTRY glBlendFunc( GLenum sfactor, GLenum dfactor );
|
GLAPI void APIENTRY glBlendFunc( GLenum sfactor, GLenum dfactor );
|
||||||
GLAPI void APIENTRY glClear( GLbitfield mask );
|
GLAPI void APIENTRY glClear( GLbitfield mask );
|
||||||
GLAPI void APIENTRY glClearColor( GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha );
|
GLAPI void APIENTRY glClearColor( GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha );
|
||||||
GLAPI void APIENTRY glClearColorx( GLclampx red, GLclampx green, GLclampx blue, GLclampx alpha );
|
GLAPI void APIENTRY glClearColorx( GLclampx red, GLclampx green, GLclampx blue, GLclampx alpha );
|
||||||
GLAPI void APIENTRY glClientActiveTexture( GLenum texture );
|
GLAPI void APIENTRY glClientActiveTexture( GLenum texture );
|
||||||
GLAPI void APIENTRY glColorPointer( GLint size, GLenum type, GLsizei stride, const GLvoid *pointer );
|
GLAPI void APIENTRY glColorPointer( GLint size, GLenum type, GLsizei stride, const GLvoid *pointer );
|
||||||
GLAPI void APIENTRY glCopyTexSubImage2D( GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height );
|
GLAPI void APIENTRY glCopyTexSubImage2D( GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height );
|
||||||
GLAPI void APIENTRY glDeleteTextures( GLsizei n, const GLuint *textures );
|
GLAPI void APIENTRY glDeleteTextures( GLsizei n, const GLuint *textures );
|
||||||
GLAPI void APIENTRY glDisable( GLenum cap );
|
GLAPI void APIENTRY glDisable( GLenum cap );
|
||||||
GLAPI void APIENTRY glDisableClientState( GLenum array );
|
GLAPI void APIENTRY glDisableClientState( GLenum array );
|
||||||
GLAPI void APIENTRY glDrawArrays( GLenum mode, GLint first, GLsizei count );
|
GLAPI void APIENTRY glDrawArrays( GLenum mode, GLint first, GLsizei count );
|
||||||
GLAPI void APIENTRY glEnable( GLenum cap );
|
GLAPI void APIENTRY glEnable( GLenum cap );
|
||||||
GLAPI void APIENTRY glEnableClientState( GLenum array );
|
GLAPI void APIENTRY glEnableClientState( GLenum array );
|
||||||
GLAPI void APIENTRY glFinish( void );
|
GLAPI void APIENTRY glFinish( void );
|
||||||
GLAPI void APIENTRY glFlush( void );
|
GLAPI void APIENTRY glFlush( void );
|
||||||
GLAPI void APIENTRY glGenTextures( GLsizei n, GLuint *textures );
|
GLAPI void APIENTRY glGenTextures( GLsizei n, GLuint *textures );
|
||||||
GLAPI GLenum APIENTRY glGetError( void );
|
GLAPI GLenum APIENTRY glGetError( void );
|
||||||
GLAPI const GLubyte * APIENTRY glGetString( GLenum name );
|
GLAPI const GLubyte * APIENTRY glGetString( GLenum name );
|
||||||
GLAPI void APIENTRY glLoadIdentity( void );
|
GLAPI void APIENTRY glLoadIdentity( void );
|
||||||
GLAPI void APIENTRY glMatrixMode( GLenum mode );
|
GLAPI void APIENTRY glMatrixMode( GLenum mode );
|
||||||
GLAPI void APIENTRY glOrthof( GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat zNear, GLfloat zFar );
|
GLAPI void APIENTRY glOrthof( GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat zNear, GLfloat zFar );
|
||||||
GLAPI void APIENTRY glRotatef( GLfloat angle, GLfloat x, GLfloat y, GLfloat z );
|
GLAPI void APIENTRY glRotatef( GLfloat angle, GLfloat x, GLfloat y, GLfloat z );
|
||||||
GLAPI void APIENTRY glPixelStorei( GLenum pname, GLint param );
|
GLAPI void APIENTRY glPixelStorei( GLenum pname, GLint param );
|
||||||
GLAPI void APIENTRY glTexCoordPointer( GLint size, GLenum type, GLsizei stride, const GLvoid *pointer );
|
GLAPI void APIENTRY glTexCoordPointer( GLint size, GLenum type, GLsizei stride, const GLvoid *pointer );
|
||||||
GLAPI void APIENTRY glTexImage2D( GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid *pixels );
|
GLAPI void APIENTRY glTexImage2D( GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid *pixels );
|
||||||
GLAPI void APIENTRY glVertexPointer( GLint size, GLenum type, GLsizei stride, const GLvoid *pointer );
|
GLAPI void APIENTRY glVertexPointer( GLint size, GLenum type, GLsizei stride, const GLvoid *pointer );
|
||||||
GLAPI void APIENTRY glViewport( GLint x, GLint y, GLsizei width, GLsizei height );
|
GLAPI void APIENTRY glViewport( GLint x, GLint y, GLsizei width, GLsizei height );
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,9 +12,9 @@ extern "C"
|
||||||
{
|
{
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
typedef intptr_t GLintptr;
|
typedef intptr_t GLintptr;
|
||||||
typedef intptr_t GLsizeiptr;
|
typedef intptr_t GLsizeiptr;
|
||||||
typedef unsigned short GLhalfARB;
|
typedef unsigned short GLhalfARB;
|
||||||
|
|
||||||
#define GL_QUADS 0x0007
|
#define GL_QUADS 0x0007
|
||||||
#define GL_QUAD_STRIP 0x0008
|
#define GL_QUAD_STRIP 0x0008
|
||||||
|
@ -248,24 +248,24 @@ extern "C"
|
||||||
#define GL_BUFFER_SIZE 0x8764
|
#define GL_BUFFER_SIZE 0x8764
|
||||||
#define GL_BUFFER_PITCH_SCE 0x6041
|
#define GL_BUFFER_PITCH_SCE 0x6041
|
||||||
|
|
||||||
GLAPI void APIENTRY glBlendEquation( GLenum mode );
|
GLAPI void APIENTRY glBlendEquation( GLenum mode );
|
||||||
GLAPI void APIENTRY glBlendColor( GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha );
|
GLAPI void APIENTRY glBlendColor( GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha );
|
||||||
GLAPI void APIENTRY glGetFloatv( GLenum pname, GLfloat* params );
|
GLAPI void APIENTRY glGetFloatv( GLenum pname, GLfloat* params );
|
||||||
GLAPI void APIENTRY glTexParameteri( GLenum target, GLenum pname, GLint param );
|
GLAPI void APIENTRY glTexParameteri( GLenum target, GLenum pname, GLint param );
|
||||||
|
|
||||||
GLAPI void APIENTRY glBindBuffer( GLenum target, GLuint name );
|
GLAPI void APIENTRY glBindBuffer( GLenum target, GLuint name );
|
||||||
GLAPI void APIENTRY glDeleteBuffers( GLsizei n, const GLuint *buffers );
|
GLAPI void APIENTRY glDeleteBuffers( GLsizei n, const GLuint *buffers );
|
||||||
GLAPI void APIENTRY glGenBuffers( GLsizei n, GLuint *buffers );
|
GLAPI void APIENTRY glGenBuffers( GLsizei n, GLuint *buffers );
|
||||||
GLAPI void APIENTRY glBufferData( GLenum target, GLsizeiptr size, const GLvoid * data, GLenum usage );
|
GLAPI void APIENTRY glBufferData( GLenum target, GLsizeiptr size, const GLvoid * data, GLenum usage );
|
||||||
GLAPI void APIENTRY glBufferSubData( GLenum target, GLintptr offset, GLsizeiptr size, const GLvoid *data );
|
GLAPI void APIENTRY glBufferSubData( GLenum target, GLintptr offset, GLsizeiptr size, const GLvoid *data );
|
||||||
|
|
||||||
GLAPI void APIENTRY glBindFramebufferOES( GLenum, GLuint );
|
GLAPI void APIENTRY glBindFramebufferOES( GLenum, GLuint );
|
||||||
GLAPI void APIENTRY glDeleteFramebuffersOES( GLsizei, const GLuint * );
|
GLAPI void APIENTRY glDeleteFramebuffersOES( GLsizei, const GLuint * );
|
||||||
GLAPI void APIENTRY glGenFramebuffersOES( GLsizei, GLuint * );
|
GLAPI void APIENTRY glGenFramebuffersOES( GLsizei, GLuint * );
|
||||||
GLAPI GLenum APIENTRY glCheckFramebufferStatusOES( GLenum );
|
GLAPI GLenum APIENTRY glCheckFramebufferStatusOES( GLenum );
|
||||||
GLAPI void APIENTRY glFramebufferTexture2DOES( GLenum, GLenum, GLenum, GLuint, GLint );
|
GLAPI void APIENTRY glFramebufferTexture2DOES( GLenum, GLenum, GLenum, GLuint, GLint );
|
||||||
|
|
||||||
GLAPI void APIENTRY glTextureReferenceSCE( GLenum target, GLuint levels, GLuint baseWidth, GLuint baseHeight, GLuint baseDepth, GLenum internalFormat, GLuint pitch, GLintptr offset );
|
GLAPI void APIENTRY glTextureReferenceSCE( GLenum target, GLuint levels, GLuint baseWidth, GLuint baseHeight, GLuint baseDepth, GLenum internalFormat, GLuint pitch, GLintptr offset );
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,7 +12,6 @@ extern "C"
|
||||||
{
|
{
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
#define _RGL_EXTERN_C extern "C"
|
#define _RGL_EXTERN_C extern "C"
|
||||||
#else
|
#else
|
||||||
|
@ -52,8 +51,8 @@ extern PSGLdevice *_CurrentDevice;
|
||||||
|
|
||||||
typedef union
|
typedef union
|
||||||
{
|
{
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
float f;
|
float f;
|
||||||
} jsIntAndFloat;
|
} jsIntAndFloat;
|
||||||
|
|
||||||
static const jsIntAndFloat _RGLNan = {i: 0x7fc00000U};
|
static const jsIntAndFloat _RGLNan = {i: 0x7fc00000U};
|
||||||
|
@ -63,39 +62,36 @@ static const jsIntAndFloat _RGLInfinity = {i: 0x7f800000U};
|
||||||
typedef struct RGLRenderTargetEx RGLRenderTargetEx;
|
typedef struct RGLRenderTargetEx RGLRenderTargetEx;
|
||||||
struct RGLRenderTargetEx
|
struct RGLRenderTargetEx
|
||||||
{
|
{
|
||||||
RGLEnum colorFormat;
|
RGLEnum colorFormat;
|
||||||
GLuint colorBufferCount;
|
GLuint colorBufferCount;
|
||||||
GLuint colorId[RGL_SETRENDERTARGET_MAXCOUNT];
|
GLuint colorId[RGL_SETRENDERTARGET_MAXCOUNT];
|
||||||
GLuint colorIdOffset[RGL_SETRENDERTARGET_MAXCOUNT];
|
GLuint colorIdOffset[RGL_SETRENDERTARGET_MAXCOUNT];
|
||||||
GLuint colorPitch[RGL_SETRENDERTARGET_MAXCOUNT];
|
GLuint colorPitch[RGL_SETRENDERTARGET_MAXCOUNT];
|
||||||
GLboolean yInverted;
|
GLboolean yInverted;
|
||||||
GLuint xOffset;
|
GLuint xOffset;
|
||||||
GLuint yOffset;
|
GLuint yOffset;
|
||||||
GLuint width;
|
GLuint width;
|
||||||
GLuint height;
|
GLuint height;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct jsPlatformFramebuffer: public jsFramebuffer
|
struct jsPlatformFramebuffer: public jsFramebuffer
|
||||||
{
|
{
|
||||||
RGLRenderTargetEx rt;
|
RGLRenderTargetEx rt;
|
||||||
GLuint colorBufferMask;
|
GLuint colorBufferMask;
|
||||||
GLboolean complete;
|
GLboolean complete;
|
||||||
jsPlatformFramebuffer(): jsFramebuffer()
|
jsPlatformFramebuffer(): jsFramebuffer() { memset( &rt, 0, sizeof( rt ) ); };
|
||||||
{
|
virtual ~jsPlatformFramebuffer() {};
|
||||||
memset( &rt, 0, sizeof( rt ) );
|
|
||||||
};
|
|
||||||
virtual ~jsPlatformFramebuffer() {};
|
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef struct _RGLDriver_
|
typedef struct _RGLDriver_
|
||||||
{
|
{
|
||||||
RGLRenderTargetEx rt;
|
RGLRenderTargetEx rt;
|
||||||
GLuint colorBufferMask;
|
GLuint colorBufferMask;
|
||||||
GLboolean rtValid;
|
GLboolean rtValid;
|
||||||
GLboolean invalidateVertexCache;
|
GLboolean invalidateVertexCache;
|
||||||
GLuint flushBufferCount;
|
GLuint flushBufferCount;
|
||||||
GLuint fpLoadProgramId;
|
GLuint fpLoadProgramId;
|
||||||
GLuint fpLoadProgramOffset;
|
GLuint fpLoadProgramOffset;
|
||||||
}
|
}
|
||||||
RGLDriver;
|
RGLDriver;
|
||||||
|
|
||||||
|
@ -142,99 +138,99 @@ typedef struct
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
GLenum pool;
|
GLenum pool;
|
||||||
RGLTextureMethodParams gcmMethods;
|
RGLTextureMethodParams gcmMethods;
|
||||||
CellGcmTexture gcmTexture;
|
CellGcmTexture gcmTexture;
|
||||||
GLuint gpuAddressId;
|
GLuint gpuAddressId;
|
||||||
GLuint gpuAddressIdOffset;
|
GLuint gpuAddressIdOffset;
|
||||||
GLuint gpuSize;
|
GLuint gpuSize;
|
||||||
RGLTextureLayout gpuLayout;
|
RGLTextureLayout gpuLayout;
|
||||||
jsBufferObject* pbo;
|
jsBufferObject* pbo;
|
||||||
} RGLTexture;
|
} RGLTexture;
|
||||||
|
|
||||||
typedef struct _tagMODESTRUC
|
typedef struct _tagMODESTRUC
|
||||||
{
|
{
|
||||||
GLushort wHorizVisible;
|
GLushort wHorizVisible;
|
||||||
GLushort wVertVisible;
|
GLushort wVertVisible;
|
||||||
GLushort wInterlacedMode;
|
GLushort wInterlacedMode;
|
||||||
GLushort wRefresh;
|
GLushort wRefresh;
|
||||||
GLushort wHorizTotal;
|
GLushort wHorizTotal;
|
||||||
GLushort wHorizBlankStart;
|
GLushort wHorizBlankStart;
|
||||||
GLushort wHorizSyncStart;
|
GLushort wHorizSyncStart;
|
||||||
GLushort wHorizSyncEnd;
|
GLushort wHorizSyncEnd;
|
||||||
GLushort wHorizBlankEnd;
|
GLushort wHorizBlankEnd;
|
||||||
GLushort wVertTotal;
|
GLushort wVertTotal;
|
||||||
GLushort wVertBlankStart;
|
GLushort wVertBlankStart;
|
||||||
GLushort wVertSyncStart;
|
GLushort wVertSyncStart;
|
||||||
GLushort wVertSyncEnd;
|
GLushort wVertSyncEnd;
|
||||||
GLushort wVertBlankEnd;
|
GLushort wVertBlankEnd;
|
||||||
GLuint dwDotClock;
|
GLuint dwDotClock;
|
||||||
GLushort wHSyncPolarity;
|
GLushort wHSyncPolarity;
|
||||||
GLushort wVSyncPolarity;
|
GLushort wVSyncPolarity;
|
||||||
}
|
}
|
||||||
MODESTRUC;
|
MODESTRUC;
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
_RGL_SURFACE_SOURCE_TEMPORARY,
|
_RGL_SURFACE_SOURCE_TEMPORARY,
|
||||||
_RGL_SURFACE_SOURCE_DEVICE,
|
_RGL_SURFACE_SOURCE_DEVICE,
|
||||||
_RGL_SURFACE_SOURCE_TEXTURE,
|
_RGL_SURFACE_SOURCE_TEXTURE,
|
||||||
_RGL_SURFACE_SOURCE_PBO,
|
_RGL_SURFACE_SOURCE_PBO,
|
||||||
};
|
};
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
_RGL_SURFACE_POOL_NONE,
|
_RGL_SURFACE_POOL_NONE,
|
||||||
_RGL_SURFACE_POOL_LINEAR,
|
_RGL_SURFACE_POOL_LINEAR,
|
||||||
_RGL_SURFACE_POOL_SYSTEM,
|
_RGL_SURFACE_POOL_SYSTEM,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
GLenum source;
|
GLenum source;
|
||||||
GLuint width, height;
|
GLuint width, height;
|
||||||
GLuint bpp;
|
GLuint bpp;
|
||||||
GLuint pitch;
|
GLuint pitch;
|
||||||
RGLEnum format;
|
RGLEnum format;
|
||||||
GLenum pool;
|
GLenum pool;
|
||||||
char* ppuData;
|
char* ppuData;
|
||||||
GLuint dataId;
|
GLuint dataId;
|
||||||
GLuint dataIdOffset;
|
GLuint dataIdOffset;
|
||||||
} RGLSurface;
|
} RGLSurface;
|
||||||
|
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
RGLRenderTargetEx rt;
|
RGLRenderTargetEx rt;
|
||||||
RGLSurface color[3];
|
RGLSurface color[3];
|
||||||
GLuint drawBuffer;
|
GLuint drawBuffer;
|
||||||
GLuint scanBuffer;
|
GLuint scanBuffer;
|
||||||
GLuint RescColorBuffersId;
|
GLuint RescColorBuffersId;
|
||||||
GLuint RescVertexArrayId;
|
GLuint RescVertexArrayId;
|
||||||
GLuint RescFragmentShaderId;
|
GLuint RescFragmentShaderId;
|
||||||
|
|
||||||
const MODESTRUC *ms;
|
const MODESTRUC *ms;
|
||||||
GLboolean vsync;
|
GLboolean vsync;
|
||||||
GLenum deviceType;
|
GLenum deviceType;
|
||||||
GLenum TVStandard;
|
GLenum TVStandard;
|
||||||
GLenum TVFormat;
|
GLenum TVFormat;
|
||||||
GLuint swapFifoRef;
|
GLuint swapFifoRef;
|
||||||
GLuint swapFifoRef2;
|
GLuint swapFifoRef2;
|
||||||
GLboolean setOffset;
|
GLboolean setOffset;
|
||||||
GLboolean signal;
|
GLboolean signal;
|
||||||
GLuint semaValue;
|
GLuint semaValue;
|
||||||
unsigned int syncMethod;
|
unsigned int syncMethod;
|
||||||
} RGLDevice;
|
} RGLDevice;
|
||||||
|
|
||||||
int32_t _RGLOutOfSpaceCallback( struct CellGcmContextData *con, uint32_t space );
|
int32_t _RGLOutOfSpaceCallback( struct CellGcmContextData *con, uint32_t space );
|
||||||
|
|
||||||
typedef struct _RGLShader_
|
typedef struct _RGLShader_
|
||||||
{
|
{
|
||||||
GLuint loadAddressId;
|
GLuint loadAddressId;
|
||||||
CgBinaryProgram __attribute__(( aligned( 16 ) ) ) program;
|
CgBinaryProgram __attribute__(( aligned( 16 ) ) ) program;
|
||||||
} RGLShader;
|
} RGLShader;
|
||||||
|
|
||||||
|
|
||||||
void _RGLFifoFinish( RGLFifo *fifo );
|
void _RGLFifoFinish( RGLFifo *fifo );
|
||||||
|
|
||||||
#define _RGLFifoFlush(fifo) \
|
#define _RGLFifoFlush(fifo) \
|
||||||
{ \
|
{ \
|
||||||
|
@ -249,17 +245,16 @@ void _RGLFifoFinish( RGLFifo *fifo );
|
||||||
#define RGL_PAGE_SIZE 0x1000
|
#define RGL_PAGE_SIZE 0x1000
|
||||||
#define RGL_LM_MAX_TOTAL_QUERIES 800
|
#define RGL_LM_MAX_TOTAL_QUERIES 800
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
typedef struct RGLTextureState RGLTextureState;
|
typedef struct RGLTextureState RGLTextureState;
|
||||||
|
|
||||||
struct RGLTextureState
|
struct RGLTextureState
|
||||||
{
|
{
|
||||||
GLuint hwTexAddress;
|
GLuint hwTexAddress;
|
||||||
GLuint hwTexFilter;
|
GLuint hwTexFilter;
|
||||||
GLuint hwTexControl0;
|
GLuint hwTexControl0;
|
||||||
};
|
};
|
||||||
|
|
||||||
void _RGLDestroy( void );
|
void _RGLDestroy( void );
|
||||||
|
|
||||||
typedef void( * RGLcontextHookFunction )( PSGLcontext *context );
|
typedef void( * RGLcontextHookFunction )( PSGLcontext *context );
|
||||||
extern RGLcontextHookFunction _RGLContextCreateHook;
|
extern RGLcontextHookFunction _RGLContextCreateHook;
|
||||||
|
@ -283,22 +278,23 @@ extern void _RGLDeviceExit (void);
|
||||||
|
|
||||||
static inline GLuint RGL_QUICK_FLOAT2UINT( const GLfloat f )
|
static inline GLuint RGL_QUICK_FLOAT2UINT( const GLfloat f )
|
||||||
{
|
{
|
||||||
union
|
union
|
||||||
{
|
{
|
||||||
GLfloat f;
|
GLfloat f;
|
||||||
GLuint ui;
|
GLuint ui;
|
||||||
} t;
|
} t;
|
||||||
t.f = f + RGL_F0_DOT_0;
|
t.f = f + RGL_F0_DOT_0;
|
||||||
return t.ui & 0xffff;
|
return t.ui & 0xffff;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void RGL_CALC_COLOR_LE_ARGB8( GLuint *color0, const GLfloat r, const GLfloat g, const GLfloat b, const GLfloat a )
|
static inline void RGL_CALC_COLOR_LE_ARGB8( GLuint *color0, const GLfloat r,
|
||||||
|
const GLfloat g, const GLfloat b, const GLfloat a )
|
||||||
{
|
{
|
||||||
GLuint r2 = RGL_QUICK_FLOAT2UINT( r * 255.0f );
|
GLuint r2 = RGL_QUICK_FLOAT2UINT( r * 255.0f );
|
||||||
GLuint g2 = RGL_QUICK_FLOAT2UINT( g * 255.0f );
|
GLuint g2 = RGL_QUICK_FLOAT2UINT( g * 255.0f );
|
||||||
GLuint b2 = RGL_QUICK_FLOAT2UINT( b * 255.0f );
|
GLuint b2 = RGL_QUICK_FLOAT2UINT( b * 255.0f );
|
||||||
GLuint a2 = RGL_QUICK_FLOAT2UINT( a * 255.0f );
|
GLuint a2 = RGL_QUICK_FLOAT2UINT( a * 255.0f );
|
||||||
*color0 = ( a2 << 24 ) | ( r2 << 16 ) | ( g2 << 8 ) | ( b2 << 0 );
|
*color0 = ( a2 << 24 ) | ( r2 << 16 ) | ( g2 << 8 ) | ( b2 << 0 );
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline GLuint _RGLMapMinTextureFilter( GLenum filter )
|
static inline GLuint _RGLMapMinTextureFilter( GLenum filter )
|
||||||
|
@ -307,42 +303,30 @@ static inline GLuint _RGLMapMinTextureFilter( GLenum filter )
|
||||||
{
|
{
|
||||||
case GL_NEAREST:
|
case GL_NEAREST:
|
||||||
return CELL_GCM_TEXTURE_NEAREST;
|
return CELL_GCM_TEXTURE_NEAREST;
|
||||||
break;
|
|
||||||
case GL_LINEAR:
|
case GL_LINEAR:
|
||||||
return CELL_GCM_TEXTURE_LINEAR;
|
return CELL_GCM_TEXTURE_LINEAR;
|
||||||
break;
|
|
||||||
case GL_NEAREST_MIPMAP_NEAREST:
|
case GL_NEAREST_MIPMAP_NEAREST:
|
||||||
return CELL_GCM_TEXTURE_NEAREST_NEAREST;
|
return CELL_GCM_TEXTURE_NEAREST_NEAREST;
|
||||||
break;
|
|
||||||
case GL_NEAREST_MIPMAP_LINEAR:
|
case GL_NEAREST_MIPMAP_LINEAR:
|
||||||
return CELL_GCM_TEXTURE_NEAREST_LINEAR;
|
return CELL_GCM_TEXTURE_NEAREST_LINEAR;
|
||||||
break;
|
|
||||||
case GL_LINEAR_MIPMAP_NEAREST:
|
case GL_LINEAR_MIPMAP_NEAREST:
|
||||||
return CELL_GCM_TEXTURE_LINEAR_NEAREST;
|
return CELL_GCM_TEXTURE_LINEAR_NEAREST;
|
||||||
break;
|
|
||||||
case GL_LINEAR_MIPMAP_LINEAR:
|
case GL_LINEAR_MIPMAP_LINEAR:
|
||||||
return CELL_GCM_TEXTURE_LINEAR_LINEAR;
|
return CELL_GCM_TEXTURE_LINEAR_LINEAR;
|
||||||
break;
|
|
||||||
default:
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
return filter;
|
return filter;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline GLuint _RGLMapMagTextureFilter( GLenum filter )
|
static inline GLuint _RGLMapMagTextureFilter( GLenum filter )
|
||||||
{
|
{
|
||||||
switch ( filter )
|
switch ( filter )
|
||||||
{
|
{
|
||||||
case GL_NEAREST:
|
case GL_NEAREST:
|
||||||
return CELL_GCM_TEXTURE_NEAREST;
|
return CELL_GCM_TEXTURE_NEAREST;
|
||||||
break;
|
case GL_LINEAR:
|
||||||
case GL_LINEAR:
|
return CELL_GCM_TEXTURE_LINEAR;
|
||||||
return CELL_GCM_TEXTURE_LINEAR;
|
}
|
||||||
break;
|
return filter;
|
||||||
default:
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
return filter;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void _RGLMapTextureFormat( GLuint internalFormat, uint8_t & gcmFormat, uint32_t & remap )
|
static inline void _RGLMapTextureFormat( GLuint internalFormat, uint8_t & gcmFormat, uint32_t & remap )
|
||||||
|
@ -351,71 +335,58 @@ static inline void _RGLMapTextureFormat( GLuint internalFormat, uint8_t & gcmFor
|
||||||
|
|
||||||
switch ( internalFormat )
|
switch ( internalFormat )
|
||||||
{
|
{
|
||||||
case RGL_ALPHA8: // in_rgba = xxAx, out_rgba = 000A
|
case RGL_ALPHA8: // in_rgba = xxAx, out_rgba = 000A
|
||||||
{
|
gcmFormat = CELL_GCM_TEXTURE_B8;
|
||||||
gcmFormat = CELL_GCM_TEXTURE_B8;
|
remap = CELL_GCM_REMAP_MODE(
|
||||||
remap = CELL_GCM_REMAP_MODE(
|
CELL_GCM_TEXTURE_REMAP_ORDER_XYXY,
|
||||||
CELL_GCM_TEXTURE_REMAP_ORDER_XYXY,
|
CELL_GCM_TEXTURE_REMAP_FROM_B,
|
||||||
CELL_GCM_TEXTURE_REMAP_FROM_B,
|
CELL_GCM_TEXTURE_REMAP_FROM_R,
|
||||||
CELL_GCM_TEXTURE_REMAP_FROM_R,
|
CELL_GCM_TEXTURE_REMAP_FROM_B,
|
||||||
CELL_GCM_TEXTURE_REMAP_FROM_B,
|
CELL_GCM_TEXTURE_REMAP_FROM_B,
|
||||||
CELL_GCM_TEXTURE_REMAP_FROM_B,
|
CELL_GCM_TEXTURE_REMAP_REMAP,
|
||||||
CELL_GCM_TEXTURE_REMAP_REMAP,
|
CELL_GCM_TEXTURE_REMAP_ZERO,
|
||||||
CELL_GCM_TEXTURE_REMAP_ZERO,
|
CELL_GCM_TEXTURE_REMAP_ZERO,
|
||||||
CELL_GCM_TEXTURE_REMAP_ZERO,
|
CELL_GCM_TEXTURE_REMAP_ZERO );
|
||||||
CELL_GCM_TEXTURE_REMAP_ZERO );
|
|
||||||
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
case RGL_ARGB8: // in_rgba = RGBA, out_rgba = RGBA
|
case RGL_ARGB8: // in_rgba = RGBA, out_rgba = RGBA
|
||||||
{
|
gcmFormat = CELL_GCM_TEXTURE_A8R8G8B8;
|
||||||
gcmFormat = CELL_GCM_TEXTURE_A8R8G8B8;
|
remap = CELL_GCM_REMAP_MODE(
|
||||||
remap = CELL_GCM_REMAP_MODE(
|
CELL_GCM_TEXTURE_REMAP_ORDER_XYXY,
|
||||||
CELL_GCM_TEXTURE_REMAP_ORDER_XYXY,
|
CELL_GCM_TEXTURE_REMAP_FROM_A,
|
||||||
CELL_GCM_TEXTURE_REMAP_FROM_A,
|
CELL_GCM_TEXTURE_REMAP_FROM_R,
|
||||||
CELL_GCM_TEXTURE_REMAP_FROM_R,
|
CELL_GCM_TEXTURE_REMAP_FROM_G,
|
||||||
CELL_GCM_TEXTURE_REMAP_FROM_G,
|
CELL_GCM_TEXTURE_REMAP_FROM_B,
|
||||||
CELL_GCM_TEXTURE_REMAP_FROM_B,
|
CELL_GCM_TEXTURE_REMAP_REMAP,
|
||||||
CELL_GCM_TEXTURE_REMAP_REMAP,
|
CELL_GCM_TEXTURE_REMAP_REMAP,
|
||||||
CELL_GCM_TEXTURE_REMAP_REMAP,
|
CELL_GCM_TEXTURE_REMAP_REMAP,
|
||||||
CELL_GCM_TEXTURE_REMAP_REMAP,
|
CELL_GCM_TEXTURE_REMAP_REMAP );
|
||||||
CELL_GCM_TEXTURE_REMAP_REMAP );
|
|
||||||
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
case RGL_RGB5_A1_SCE: // in_rgba = RGBA, out_rgba = RGBA
|
case RGL_RGB5_A1_SCE: // in_rgba = RGBA, out_rgba = RGBA
|
||||||
{
|
gcmFormat = CELL_GCM_TEXTURE_A1R5G5B5;
|
||||||
gcmFormat = CELL_GCM_TEXTURE_A1R5G5B5;
|
remap = CELL_GCM_REMAP_MODE(
|
||||||
remap = CELL_GCM_REMAP_MODE(
|
CELL_GCM_TEXTURE_REMAP_ORDER_XXXY,
|
||||||
CELL_GCM_TEXTURE_REMAP_ORDER_XXXY,
|
CELL_GCM_TEXTURE_REMAP_FROM_A,
|
||||||
CELL_GCM_TEXTURE_REMAP_FROM_A,
|
CELL_GCM_TEXTURE_REMAP_FROM_R,
|
||||||
CELL_GCM_TEXTURE_REMAP_FROM_R,
|
CELL_GCM_TEXTURE_REMAP_FROM_G,
|
||||||
CELL_GCM_TEXTURE_REMAP_FROM_G,
|
CELL_GCM_TEXTURE_REMAP_FROM_B,
|
||||||
CELL_GCM_TEXTURE_REMAP_FROM_B,
|
CELL_GCM_TEXTURE_REMAP_REMAP,
|
||||||
CELL_GCM_TEXTURE_REMAP_REMAP,
|
CELL_GCM_TEXTURE_REMAP_REMAP,
|
||||||
CELL_GCM_TEXTURE_REMAP_REMAP,
|
CELL_GCM_TEXTURE_REMAP_REMAP,
|
||||||
CELL_GCM_TEXTURE_REMAP_REMAP,
|
CELL_GCM_TEXTURE_REMAP_REMAP );
|
||||||
CELL_GCM_TEXTURE_REMAP_REMAP );
|
|
||||||
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
case RGL_RGB565_SCE: // in_rgba = RGBA, out_rgba = RGBA
|
case RGL_RGB565_SCE: // in_rgba = RGBA, out_rgba = RGBA
|
||||||
{
|
gcmFormat = CELL_GCM_TEXTURE_R5G6B5;
|
||||||
gcmFormat = CELL_GCM_TEXTURE_R5G6B5;
|
remap = CELL_GCM_REMAP_MODE(
|
||||||
remap = CELL_GCM_REMAP_MODE(
|
CELL_GCM_TEXTURE_REMAP_ORDER_XXXY,
|
||||||
CELL_GCM_TEXTURE_REMAP_ORDER_XXXY,
|
CELL_GCM_TEXTURE_REMAP_FROM_A,
|
||||||
CELL_GCM_TEXTURE_REMAP_FROM_A,
|
CELL_GCM_TEXTURE_REMAP_FROM_R,
|
||||||
CELL_GCM_TEXTURE_REMAP_FROM_R,
|
CELL_GCM_TEXTURE_REMAP_FROM_G,
|
||||||
CELL_GCM_TEXTURE_REMAP_FROM_G,
|
CELL_GCM_TEXTURE_REMAP_FROM_B,
|
||||||
CELL_GCM_TEXTURE_REMAP_FROM_B,
|
CELL_GCM_TEXTURE_REMAP_ONE,
|
||||||
CELL_GCM_TEXTURE_REMAP_ONE,
|
CELL_GCM_TEXTURE_REMAP_REMAP,
|
||||||
CELL_GCM_TEXTURE_REMAP_REMAP,
|
CELL_GCM_TEXTURE_REMAP_REMAP,
|
||||||
CELL_GCM_TEXTURE_REMAP_REMAP,
|
CELL_GCM_TEXTURE_REMAP_REMAP );
|
||||||
CELL_GCM_TEXTURE_REMAP_REMAP );
|
|
||||||
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
break;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -9,61 +9,61 @@ extern "C" {
|
||||||
|
|
||||||
typedef struct _ELF_section_t
|
typedef struct _ELF_section_t
|
||||||
{
|
{
|
||||||
Elf32_Shdr header;
|
Elf32_Shdr header;
|
||||||
const char* name;
|
const char *name;
|
||||||
char* data;
|
char *data;
|
||||||
} ELF_section_t;
|
} ELF_section_t;
|
||||||
|
|
||||||
typedef struct _ELF_segment_t
|
typedef struct _ELF_segment_t
|
||||||
{
|
{
|
||||||
Elf32_Phdr header;
|
Elf32_Phdr header;
|
||||||
unsigned char* pointer;
|
unsigned char *pointer;
|
||||||
unsigned char* data;
|
unsigned char *data;
|
||||||
} ELF_segment_t;
|
} ELF_segment_t;
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
const char* name;
|
const char *name;
|
||||||
unsigned int vma;
|
unsigned int vma;
|
||||||
unsigned int size;
|
unsigned int size;
|
||||||
int section;
|
int section;
|
||||||
unsigned char resolved;
|
unsigned char resolved;
|
||||||
unsigned char foreign;
|
unsigned char foreign;
|
||||||
} ELF_symbol_t;
|
} ELF_symbol_t;
|
||||||
|
|
||||||
typedef struct _ELF_t
|
typedef struct _ELF_t
|
||||||
{
|
{
|
||||||
unsigned int endian;
|
unsigned int endian;
|
||||||
unsigned int relocatable;
|
unsigned int relocatable;
|
||||||
unsigned int sectionCount;
|
unsigned int sectionCount;
|
||||||
unsigned int segmentCount;
|
unsigned int segmentCount;
|
||||||
unsigned int symbolCount;
|
unsigned int symbolCount;
|
||||||
unsigned int entrypoint;
|
unsigned int entrypoint;
|
||||||
ELF_section_t* sections;
|
ELF_section_t *sections;
|
||||||
ELF_segment_t* segments;
|
ELF_segment_t *segments;
|
||||||
ELF_symbol_t* symbols;
|
ELF_symbol_t *symbols;
|
||||||
unsigned int symbolsSection;
|
unsigned int symbolsSection;
|
||||||
unsigned int symbolNamesSection;
|
unsigned int symbolNamesSection;
|
||||||
unsigned int paramSection;
|
unsigned int paramSection;
|
||||||
} ELF_t;
|
} ELF_t;
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
unsigned int relative;
|
unsigned int relative;
|
||||||
unsigned int shift;
|
unsigned int shift;
|
||||||
unsigned int size;
|
unsigned int size;
|
||||||
unsigned int position;
|
unsigned int position;
|
||||||
unsigned int mask;
|
unsigned int mask;
|
||||||
} ELF_rel_type_t;
|
} ELF_rel_type_t;
|
||||||
|
|
||||||
ELF_section_t* findSection(const ELF_t* elf,const char* name);
|
ELF_section_t *findSection(const ELF_t *elf, const char *name);
|
||||||
int lookupSymbol(const ELF_t* elf,const char* name);
|
int lookupSymbol(const ELF_t *elf, const char *name);
|
||||||
const Elf32_Sym* getSymbolByIndex(const ELF_t* elf,int idx);
|
const Elf32_Sym *getSymbolByIndex(const ELF_t *elf, int idx);
|
||||||
|
|
||||||
const char *findSectionInPlace(const char* memory,unsigned int size,const char *name,size_t *sectionSize);
|
const char *findSectionInPlace(const char* memory,unsigned int size,const char *name,size_t *sectionSize);
|
||||||
const char *findSymbolSectionInPlace(const char *memory, unsigned int size, size_t *symbolSize, size_t *symbolCount, const char **symbolstrtab);
|
const char *findSymbolSectionInPlace(const char *memory, unsigned int size, size_t *symbolSize, size_t *symbolCount, const char **symbolstrtab);
|
||||||
int lookupSymbolValueInPlace(const char* symbolSection, size_t symbolSize, size_t symbolCount, const char *symbolstrtab, const char *name);
|
int lookupSymbolValueInPlace(const char *symbolSection, size_t symbolSize, size_t symbolCount, const char *symbolstrtab, const char *name);
|
||||||
const char *getSymbolByIndexInPlace(const char* symbolSection, size_t symbolSize, size_t symbolCount, const char *symbolstrtab, int index);
|
const char *getSymbolByIndexInPlace(const char *symbolSection, size_t symbolSize, size_t symbolCount, const char *symbolstrtab, int index);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -1,10 +1,6 @@
|
||||||
// vector standard header
|
|
||||||
|
|
||||||
#ifndef _VECTOR_
|
#ifndef _VECTOR_
|
||||||
#define _VECTOR_
|
#define _VECTOR_
|
||||||
|
|
||||||
#define RGL_STD_VECTOR
|
|
||||||
|
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <stdexcept>
|
#include <stdexcept>
|
||||||
|
|
||||||
|
|
|
@ -171,7 +171,7 @@ static void init_settings(void)
|
||||||
char core_executable[1024];
|
char core_executable[1024];
|
||||||
#if defined(_XBOX360)
|
#if defined(_XBOX360)
|
||||||
snprintf(core_executable, sizeof(core_executable), "game:\\CORE.xex");
|
snprintf(core_executable, sizeof(core_executable), "game:\\CORE.xex");
|
||||||
#if defined(_XBOX1)
|
#elif defined(_XBOX1)
|
||||||
snprintf(core_executable, sizeof(core_executable), "D:\\CORE.xbe");
|
snprintf(core_executable, sizeof(core_executable), "D:\\CORE.xbe");
|
||||||
#elif defined(__CELLOS_LV2__)
|
#elif defined(__CELLOS_LV2__)
|
||||||
snprintf(core_executable, sizeof(core_executable), "%s/CORE.SELF", LIBRETRO_DIR_PATH);
|
snprintf(core_executable, sizeof(core_executable), "%s/CORE.SELF", LIBRETRO_DIR_PATH);
|
||||||
|
|
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);
|
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);
|
bool (*key_pressed)(void *data, int key);
|
||||||
void (*free)(void *data);
|
void (*free)(void *data);
|
||||||
|
#ifdef RARCH_CONSOLE
|
||||||
|
void (*set_default_keybind_lut)(void);
|
||||||
|
#endif
|
||||||
const char *ident;
|
const char *ident;
|
||||||
} input_driver_t;
|
} input_driver_t;
|
||||||
|
|
||||||
|
|
|
@ -26,7 +26,6 @@
|
||||||
|
|
||||||
#include "../gl_common.h"
|
#include "../gl_common.h"
|
||||||
#include "../image.h"
|
#include "../image.h"
|
||||||
#include "../../ps3/frontend/shared.h"
|
|
||||||
|
|
||||||
#include "ps3_ctx.h"
|
#include "ps3_ctx.h"
|
||||||
|
|
||||||
|
@ -137,7 +136,7 @@ bool gfx_ctx_menu_init(void)
|
||||||
glGenTextures(1, &gl->menu_texture_id);
|
glGenTextures(1, &gl->menu_texture_id);
|
||||||
|
|
||||||
RARCH_LOG("Loading texture image for menu...\n");
|
RARCH_LOG("Loading texture image for menu...\n");
|
||||||
if (!texture_image_load(DEFAULT_MENU_BORDER_FILE, &menu_texture))
|
if (!texture_image_load(default_paths.menu_border_file, &menu_texture))
|
||||||
{
|
{
|
||||||
RARCH_ERR("Failed to load texture image for menu.\n");
|
RARCH_ERR("Failed to load texture image for menu.\n");
|
||||||
return false;
|
return false;
|
||||||
|
|
4
gfx/gl.c
4
gfx/gl.c
|
@ -1065,9 +1065,9 @@ static void *gl_init(const video_info_t *video, const input_driver_t **input, vo
|
||||||
|
|
||||||
RARCH_LOG("GL: Using resolution %ux%u\n", gl->win_width, gl->win_height);
|
RARCH_LOG("GL: Using resolution %ux%u\n", gl->win_width, gl->win_height);
|
||||||
|
|
||||||
#ifdef HAVE_CG_MENU
|
#if defined(HAVE_CG_MENU) && defined(RARCH_CONSOLE)
|
||||||
RARCH_LOG("Initializing menu shader ...\n");
|
RARCH_LOG("Initializing menu shader ...\n");
|
||||||
gl_cg_set_menu_shader(DEFAULT_MENU_SHADER_FILE);
|
gl_cg_set_menu_shader(default_paths.menu_shader_file);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (!gl_shader_init())
|
if (!gl_shader_init())
|
||||||
|
|
1292
gfx/gles.c
1292
gfx/gles.c
File diff suppressed because it is too large
Load Diff
|
@ -51,12 +51,17 @@ static void null_input_free(void *data)
|
||||||
(void)data;
|
(void)data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void null_set_default_keybind_lut(void) { }
|
||||||
|
|
||||||
const input_driver_t input_null = {
|
const input_driver_t input_null = {
|
||||||
null_input_init,
|
null_input_init,
|
||||||
null_input_poll,
|
null_input_poll,
|
||||||
null_input_state,
|
null_input_state,
|
||||||
null_input_key_pressed,
|
null_input_key_pressed,
|
||||||
null_input_free,
|
null_input_free,
|
||||||
|
#ifdef RARCH_CONSOLE
|
||||||
|
null_set_default_keybind_lut,
|
||||||
|
#endif
|
||||||
"null",
|
"null",
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -51,7 +51,9 @@
|
||||||
Name="VCPreLinkEventTool"/>
|
Name="VCPreLinkEventTool"/>
|
||||||
<Tool
|
<Tool
|
||||||
Name="XboxDeploymentTool"
|
Name="XboxDeploymentTool"
|
||||||
RemotePath="xe:\$(SolutionName)\CORE.xbe"/>
|
RemotePath="xe:\$(SolutionName)\CORE.xbe"
|
||||||
|
AdditionalFiles="..\..\xbox1\Media;roms;system"
|
||||||
|
ForceCopy="TRUE"/>
|
||||||
<Tool
|
<Tool
|
||||||
Name="XboxImageTool"
|
Name="XboxImageTool"
|
||||||
StackSize="65536"
|
StackSize="65536"
|
||||||
|
@ -103,7 +105,9 @@
|
||||||
Name="VCPreLinkEventTool"/>
|
Name="VCPreLinkEventTool"/>
|
||||||
<Tool
|
<Tool
|
||||||
Name="XboxDeploymentTool"
|
Name="XboxDeploymentTool"
|
||||||
RemotePath="xe:\$(SolutionName)\CORE.xbe"/>
|
RemotePath="xe:\$(SolutionName)\CORE.xbe"
|
||||||
|
AdditionalFiles="..\..\xbox1\Media;roms;system"
|
||||||
|
ForceCopy="TRUE"/>
|
||||||
<Tool
|
<Tool
|
||||||
Name="XboxImageTool"
|
Name="XboxImageTool"
|
||||||
StackSize="65536"
|
StackSize="65536"
|
||||||
|
@ -156,7 +160,9 @@
|
||||||
Name="VCPreLinkEventTool"/>
|
Name="VCPreLinkEventTool"/>
|
||||||
<Tool
|
<Tool
|
||||||
Name="XboxDeploymentTool"
|
Name="XboxDeploymentTool"
|
||||||
RemotePath="xe:\$(SolutionName)\CORE.xbe"/>
|
RemotePath="xe:\$(SolutionName)\CORE.xbe"
|
||||||
|
AdditionalFiles="..\..\xbox1\Media;roms;system"
|
||||||
|
ForceCopy="TRUE"/>
|
||||||
<Tool
|
<Tool
|
||||||
Name="XboxImageTool"
|
Name="XboxImageTool"
|
||||||
StackSize="65536"
|
StackSize="65536"
|
||||||
|
@ -214,7 +220,9 @@
|
||||||
Name="VCPreLinkEventTool"/>
|
Name="VCPreLinkEventTool"/>
|
||||||
<Tool
|
<Tool
|
||||||
Name="XboxDeploymentTool"
|
Name="XboxDeploymentTool"
|
||||||
RemotePath="xe:\$(SolutionName)\CORE.xbe"/>
|
RemotePath="xe:\$(SolutionName)\CORE.xbe"
|
||||||
|
AdditionalFiles="..\..\xbox1\Media;roms;system"
|
||||||
|
ForceCopy="TRUE"/>
|
||||||
<Tool
|
<Tool
|
||||||
Name="XboxImageTool"
|
Name="XboxImageTool"
|
||||||
StackSize="65536"/>
|
StackSize="65536"/>
|
||||||
|
@ -265,7 +273,9 @@
|
||||||
Name="VCPreLinkEventTool"/>
|
Name="VCPreLinkEventTool"/>
|
||||||
<Tool
|
<Tool
|
||||||
Name="XboxDeploymentTool"
|
Name="XboxDeploymentTool"
|
||||||
RemotePath="xe:\$(SolutionName)\CORE.xbe"/>
|
RemotePath="xe:\$(SolutionName)\CORE.xbe"
|
||||||
|
AdditionalFiles="..\..\xbox1\Media;roms;system"
|
||||||
|
ForceCopy="TRUE"/>
|
||||||
<Tool
|
<Tool
|
||||||
Name="XboxImageTool"
|
Name="XboxImageTool"
|
||||||
StackSize="65536"/>
|
StackSize="65536"/>
|
||||||
|
@ -317,31 +327,31 @@
|
||||||
Name="Debug|Xbox">
|
Name="Debug|Xbox">
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCCLCompilerTool"
|
Name="VCCLCompilerTool"
|
||||||
CompileAs="2"/>
|
CompileAs="1"/>
|
||||||
</FileConfiguration>
|
</FileConfiguration>
|
||||||
<FileConfiguration
|
<FileConfiguration
|
||||||
Name="Profile|Xbox">
|
Name="Profile|Xbox">
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCCLCompilerTool"
|
Name="VCCLCompilerTool"
|
||||||
CompileAs="2"/>
|
CompileAs="1"/>
|
||||||
</FileConfiguration>
|
</FileConfiguration>
|
||||||
<FileConfiguration
|
<FileConfiguration
|
||||||
Name="Profile_FastCap|Xbox">
|
Name="Profile_FastCap|Xbox">
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCCLCompilerTool"
|
Name="VCCLCompilerTool"
|
||||||
CompileAs="2"/>
|
CompileAs="1"/>
|
||||||
</FileConfiguration>
|
</FileConfiguration>
|
||||||
<FileConfiguration
|
<FileConfiguration
|
||||||
Name="Release|Xbox">
|
Name="Release|Xbox">
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCCLCompilerTool"
|
Name="VCCLCompilerTool"
|
||||||
CompileAs="2"/>
|
CompileAs="1"/>
|
||||||
</FileConfiguration>
|
</FileConfiguration>
|
||||||
<FileConfiguration
|
<FileConfiguration
|
||||||
Name="Release_LTCG|Xbox">
|
Name="Release_LTCG|Xbox">
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCCLCompilerTool"
|
Name="VCCLCompilerTool"
|
||||||
CompileAs="2"/>
|
CompileAs="1"/>
|
||||||
</FileConfiguration>
|
</FileConfiguration>
|
||||||
</File>
|
</File>
|
||||||
</Filter>
|
</Filter>
|
||||||
|
|
|
@ -46,39 +46,21 @@
|
||||||
#include "../../gfx/gl_common.h"
|
#include "../../gfx/gl_common.h"
|
||||||
|
|
||||||
#include "../../console/retroarch_console.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.h"
|
||||||
#include "../../conf/config_file_macros.h"
|
#include "../../conf/config_file_macros.h"
|
||||||
#include "../../general.h"
|
#include "../../general.h"
|
||||||
#include "../../file.h"
|
#include "../../file.h"
|
||||||
|
|
||||||
#include "shared.h"
|
|
||||||
|
|
||||||
#include "menu.h"
|
#include "menu.h"
|
||||||
|
|
||||||
#define EMULATOR_CONTENT_DIR "SSNE10000"
|
#define EMULATOR_CONTENT_DIR "SSNE10000"
|
||||||
#define EMULATOR_CORE_DIR "cores"
|
|
||||||
|
|
||||||
#define CACHE_ID "ABCD12345"
|
#define CACHE_ID "ABCD12345"
|
||||||
#define NP_POOL_SIZE (128*1024)
|
#define NP_POOL_SIZE (128*1024)
|
||||||
|
|
||||||
static uint8_t np_pool[NP_POOL_SIZE];
|
static uint8_t np_pool[NP_POOL_SIZE];
|
||||||
char systemDirPath[PATH_MAX];
|
|
||||||
char usrDirPath[PATH_MAX];
|
|
||||||
char DEFAULT_PRESET_FILE[PATH_MAX];
|
|
||||||
char DEFAULT_BORDER_FILE[PATH_MAX];
|
|
||||||
char DEFAULT_MENU_BORDER_FILE[PATH_MAX];
|
|
||||||
char PRESETS_DIR_PATH[PATH_MAX];
|
|
||||||
char INPUT_PRESETS_DIR_PATH[PATH_MAX];
|
|
||||||
char BORDERS_DIR_PATH[PATH_MAX];
|
|
||||||
char SHADERS_DIR_PATH[PATH_MAX];
|
|
||||||
char LIBRETRO_DIR_PATH[PATH_MAX];
|
|
||||||
char DEFAULT_SHADER_FILE[PATH_MAX];
|
|
||||||
char DEFAULT_MENU_SHADER_FILE[PATH_MAX];
|
|
||||||
char SYS_CONFIG_FILE[PATH_MAX];
|
|
||||||
char EMULATOR_CORE_SELF[PATH_MAX];
|
|
||||||
#ifdef HAVE_MULTIMAN
|
|
||||||
char MULTIMAN_EXECUTABLE[PATH_MAX];
|
|
||||||
#endif
|
|
||||||
|
|
||||||
int rarch_main(int argc, char *argv[]);
|
int rarch_main(int argc, char *argv[]);
|
||||||
|
|
||||||
|
@ -86,62 +68,6 @@ SYS_PROCESS_PARAM(1001, 0x200000)
|
||||||
|
|
||||||
#undef main
|
#undef main
|
||||||
|
|
||||||
static void set_default_settings(void)
|
|
||||||
{
|
|
||||||
// g_settings
|
|
||||||
strlcpy(g_settings.cheat_database, usrDirPath, sizeof(g_settings.cheat_database));
|
|
||||||
g_settings.rewind_enable = false;
|
|
||||||
strlcpy(g_settings.video.cg_shader_path, DEFAULT_SHADER_FILE, sizeof(g_settings.video.cg_shader_path));
|
|
||||||
g_settings.video.fbo_scale_x = 2.0f;
|
|
||||||
g_settings.video.fbo_scale_y = 2.0f;
|
|
||||||
g_settings.video.render_to_texture = true;
|
|
||||||
strlcpy(g_settings.video.second_pass_shader, DEFAULT_SHADER_FILE, sizeof(g_settings.video.second_pass_shader));
|
|
||||||
g_settings.video.second_pass_smooth = true;
|
|
||||||
g_settings.video.smooth = true;
|
|
||||||
g_settings.video.vsync = true;
|
|
||||||
strlcpy(g_settings.cheat_database, usrDirPath, sizeof(g_settings.cheat_database));
|
|
||||||
strlcpy(g_settings.system_directory, systemDirPath, sizeof(g_settings.system_directory));
|
|
||||||
g_settings.video.msg_pos_x = 0.05f;
|
|
||||||
g_settings.video.msg_pos_y = 0.90f;
|
|
||||||
g_settings.video.aspect_ratio = -1.0f;
|
|
||||||
|
|
||||||
rarch_input_set_controls_default();
|
|
||||||
|
|
||||||
// g_console
|
|
||||||
g_console.block_config_read = true;
|
|
||||||
g_console.frame_advance_enable = false;
|
|
||||||
g_console.emulator_initialized = 0;
|
|
||||||
g_console.screenshots_enable = true;
|
|
||||||
g_console.throttle_enable = true;
|
|
||||||
g_console.initialize_rarch_enable = false;
|
|
||||||
g_console.triple_buffering_enable = true;
|
|
||||||
g_console.default_savestate_dir_enable = false;
|
|
||||||
g_console.default_sram_dir_enable = false;
|
|
||||||
g_console.fbo_enabled = true;
|
|
||||||
g_console.mode_switch = MODE_MENU;
|
|
||||||
g_console.screen_orientation = ORIENTATION_NORMAL;
|
|
||||||
g_console.current_resolution_id = 0;
|
|
||||||
strlcpy(g_console.default_rom_startup_dir, "/", sizeof(g_console.default_rom_startup_dir));
|
|
||||||
strlcpy(g_console.default_savestate_dir, usrDirPath, sizeof(g_console.default_savestate_dir));
|
|
||||||
strlcpy(g_console.default_sram_dir, usrDirPath, sizeof(g_console.default_sram_dir));
|
|
||||||
g_console.aspect_ratio_index = 0;
|
|
||||||
g_console.menu_font_size = 1.0f;
|
|
||||||
g_console.overscan_enable = false;
|
|
||||||
g_console.overscan_amount = 0.0f;
|
|
||||||
g_console.sound_mode = SOUND_MODE_NORMAL;
|
|
||||||
g_console.viewports.custom_vp.width = 0;
|
|
||||||
g_console.viewports.custom_vp.height = 0;
|
|
||||||
g_console.viewports.custom_vp.x = 0;
|
|
||||||
g_console.viewports.custom_vp.y = 0;
|
|
||||||
g_console.custom_bgm_enable = true;
|
|
||||||
g_console.info_msg_enable = true;
|
|
||||||
|
|
||||||
// g_extern
|
|
||||||
g_extern.state_slot = 0;
|
|
||||||
g_extern.audio_data.mute = 0;
|
|
||||||
g_extern.verbose = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef HAVE_SYSUTILS
|
#ifdef HAVE_SYSUTILS
|
||||||
static void callback_sysutil_exit(uint64_t status, uint64_t param, void *userdata)
|
static void callback_sysutil_exit(uint64_t status, uint64_t param, void *userdata)
|
||||||
{
|
{
|
||||||
|
@ -195,16 +121,16 @@ static void get_environment_settings(int argc, char *argv[])
|
||||||
if(argc > 1)
|
if(argc > 1)
|
||||||
{
|
{
|
||||||
/* launched from external launcher */
|
/* launched from external launcher */
|
||||||
strlcpy(MULTIMAN_EXECUTABLE, argv[2], sizeof(MULTIMAN_EXECUTABLE));
|
strlcpy(default_paths.multiman_self_file, argv[2], sizeof(default_paths.multiman_self_file));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* not launched from external launcher, set default path */
|
/* not launched from external launcher, set default path */
|
||||||
strlcpy(MULTIMAN_EXECUTABLE, "/dev_hdd0/game/BLES80608/USRDIR/RELOAD.SELF",
|
strlcpy(default_paths.multiman_self_file, "/dev_hdd0/game/BLES80608/USRDIR/RELOAD.SELF",
|
||||||
sizeof(MULTIMAN_EXECUTABLE));
|
sizeof(default_paths.multiman_self_file));
|
||||||
}
|
}
|
||||||
|
|
||||||
if(path_file_exists(MULTIMAN_EXECUTABLE) && argc > 1 && path_file_exists(argv[1]))
|
if(path_file_exists(default_paths.multiman_self_file) && argc > 1 && path_file_exists(argv[1]))
|
||||||
{
|
{
|
||||||
g_console.external_launcher_support = EXTERN_LAUNCHER_MULTIMAN;
|
g_console.external_launcher_support = EXTERN_LAUNCHER_MULTIMAN;
|
||||||
RARCH_LOG("Started from multiMAN, auto-game start enabled.\n");
|
RARCH_LOG("Started from multiMAN, auto-game start enabled.\n");
|
||||||
|
@ -242,13 +168,13 @@ static void get_environment_settings(int argc, char *argv[])
|
||||||
if((get_attributes & CELL_GAME_ATTRIBUTE_APP_HOME) == CELL_GAME_ATTRIBUTE_APP_HOME)
|
if((get_attributes & CELL_GAME_ATTRIBUTE_APP_HOME) == CELL_GAME_ATTRIBUTE_APP_HOME)
|
||||||
RARCH_LOG("RetroArch was launched from host machine (APP_HOME).\n");
|
RARCH_LOG("RetroArch was launched from host machine (APP_HOME).\n");
|
||||||
|
|
||||||
ret = cellGameContentPermit(contentInfoPath, usrDirPath);
|
ret = cellGameContentPermit(contentInfoPath, default_paths.port_dir);
|
||||||
|
|
||||||
#ifdef HAVE_MULTIMAN
|
#ifdef HAVE_MULTIMAN
|
||||||
if(g_console.external_launcher_support == EXTERN_LAUNCHER_MULTIMAN)
|
if(g_console.external_launcher_support == EXTERN_LAUNCHER_MULTIMAN)
|
||||||
{
|
{
|
||||||
snprintf(contentInfoPath, sizeof(contentInfoPath), "/dev_hdd0/game/%s", EMULATOR_CONTENT_DIR);
|
snprintf(contentInfoPath, sizeof(contentInfoPath), "/dev_hdd0/game/%s", EMULATOR_CONTENT_DIR);
|
||||||
snprintf(usrDirPath, sizeof(usrDirPath), "/dev_hdd0/game/%s/USRDIR", EMULATOR_CONTENT_DIR);
|
snprintf(default_paths.port_dir, sizeof(default_paths.port_dir), "/dev_hdd0/game/%s/USRDIR", EMULATOR_CONTENT_DIR);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -260,23 +186,30 @@ static void get_environment_settings(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
RARCH_LOG("cellGameContentPermit() OK.\n");
|
RARCH_LOG("cellGameContentPermit() OK.\n");
|
||||||
RARCH_LOG("contentInfoPath : [%s].\n", contentInfoPath);
|
RARCH_LOG("contentInfoPath : [%s].\n", contentInfoPath);
|
||||||
RARCH_LOG("usrDirPath : [%s].\n", usrDirPath);
|
RARCH_LOG("usrDirPath : [%s].\n", default_paths.port_dir);
|
||||||
}
|
}
|
||||||
|
|
||||||
snprintf(systemDirPath, sizeof(systemDirPath), "%s/%s/system", usrDirPath, EMULATOR_CORE_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);
|
||||||
|
snprintf(default_paths.filesystem_root_dir, sizeof(default_paths.filesystem_root_dir), "/");
|
||||||
|
snprintf(default_paths.sram_dir, sizeof(default_paths.sram_dir), "%s/sram", default_paths.core_dir);
|
||||||
|
|
||||||
|
snprintf(default_paths.system_dir, sizeof(default_paths.system_dir), "%s/system", default_paths.core_dir);
|
||||||
|
|
||||||
/* now we fill in all the variables */
|
/* now we fill in all the variables */
|
||||||
snprintf(DEFAULT_PRESET_FILE, sizeof(DEFAULT_PRESET_FILE), "%s/%s/presets/stock.conf", usrDirPath, EMULATOR_CORE_DIR);
|
snprintf(default_paths.border_file, sizeof(default_paths.border_file), "%s/borders/Centered-1080p/mega-man-2.png", default_paths.core_dir);
|
||||||
snprintf(DEFAULT_BORDER_FILE, sizeof(DEFAULT_BORDER_FILE), "%s/%s/borders/Centered-1080p/mega-man-2.png", usrDirPath, EMULATOR_CORE_DIR);
|
snprintf(default_paths.menu_border_file, sizeof(default_paths.menu_border_file), "%s/borders/Menu/main-menu.png", default_paths.core_dir);
|
||||||
snprintf(DEFAULT_MENU_BORDER_FILE, sizeof(DEFAULT_MENU_BORDER_FILE), "%s/%s/borders/Menu/main-menu.png", usrDirPath, EMULATOR_CORE_DIR);
|
snprintf(default_paths.cgp_dir, sizeof(default_paths.cgp_dir), "%s/presets", default_paths.core_dir);
|
||||||
snprintf(PRESETS_DIR_PATH, sizeof(PRESETS_DIR_PATH), "%s/%s/presets", usrDirPath, EMULATOR_CORE_DIR);
|
snprintf(default_paths.input_presets_dir, sizeof(default_paths.input_presets_dir), "%s/input", default_paths.cgp_dir);
|
||||||
snprintf(INPUT_PRESETS_DIR_PATH, sizeof(INPUT_PRESETS_DIR_PATH), "%s/input", PRESETS_DIR_PATH);
|
snprintf(default_paths.border_dir, sizeof(default_paths.border_dir), "%s/borders", default_paths.core_dir);
|
||||||
snprintf(LIBRETRO_DIR_PATH, sizeof(LIBRETRO_DIR_PATH), "%s/%s", usrDirPath, EMULATOR_CORE_DIR);
|
snprintf(default_paths.shader_dir, sizeof(default_paths.shader_dir), "%s/shaders", default_paths.core_dir);
|
||||||
snprintf(BORDERS_DIR_PATH, sizeof(BORDERS_DIR_PATH), "%s/%s/borders", usrDirPath, EMULATOR_CORE_DIR);
|
snprintf(default_paths.shader_file, sizeof(default_paths.shader_file), "%s/shaders/stock.cg", default_paths.core_dir);
|
||||||
snprintf(SHADERS_DIR_PATH, sizeof(SHADERS_DIR_PATH), "%s/%s/shaders", usrDirPath, EMULATOR_CORE_DIR);
|
snprintf(default_paths.menu_shader_file, sizeof(default_paths.menu_shader_file), "%s/shaders/Borders/Menu/border-only-rarch.cg", default_paths.core_dir);
|
||||||
snprintf(DEFAULT_SHADER_FILE, sizeof(DEFAULT_SHADER_FILE), "%s/%s/shaders/stock.cg", usrDirPath, EMULATOR_CORE_DIR);
|
snprintf(default_paths.config_file, sizeof(default_paths.config_file), "%s/retroarch.cfg", default_paths.port_dir);
|
||||||
snprintf(DEFAULT_MENU_SHADER_FILE, sizeof(DEFAULT_MENU_SHADER_FILE), "%s/%s/shaders/Borders/Menu/border-only-rarch.cg", usrDirPath, EMULATOR_CORE_DIR);
|
|
||||||
snprintf(SYS_CONFIG_FILE, sizeof(SYS_CONFIG_FILE), "%s/retroarch.cfg", usrDirPath);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
g_extern.verbose = false;
|
g_extern.verbose = false;
|
||||||
|
@ -312,17 +245,11 @@ int main(int argc, char *argv[])
|
||||||
get_environment_settings(argc, argv);
|
get_environment_settings(argc, argv);
|
||||||
|
|
||||||
config_set_defaults();
|
config_set_defaults();
|
||||||
|
input_ps3.init();
|
||||||
|
|
||||||
char full_path[1024], tmp_path[1024];
|
char tmp_path[PATH_MAX];
|
||||||
snprintf(full_path, sizeof(full_path), "%s/%s/CORE.SELF", usrDirPath, EMULATOR_CORE_DIR);
|
snprintf(tmp_path, sizeof(tmp_path), "%s/", default_paths.core_dir);
|
||||||
snprintf(tmp_path, sizeof(tmp_path), "%s/%s/", usrDirPath, EMULATOR_CORE_DIR);
|
rarch_configure_libretro(&input_ps3, tmp_path, default_paths.executable_extension);
|
||||||
|
|
||||||
bool find_libretro_file = rarch_configure_libretro_core(full_path, tmp_path, LIBRETRO_DIR_PATH,
|
|
||||||
SYS_CONFIG_FILE, ".SELF");
|
|
||||||
|
|
||||||
set_default_settings();
|
|
||||||
rarch_config_load(SYS_CONFIG_FILE, LIBRETRO_DIR_PATH, ".SELF", find_libretro_file);
|
|
||||||
init_libretro_sym();
|
|
||||||
|
|
||||||
#if(CELL_SDK_VERSION > 0x340000)
|
#if(CELL_SDK_VERSION > 0x340000)
|
||||||
if (g_console.screenshots_enable)
|
if (g_console.screenshots_enable)
|
||||||
|
@ -347,7 +274,6 @@ int main(int argc, char *argv[])
|
||||||
|
|
||||||
video_gl.start();
|
video_gl.start();
|
||||||
|
|
||||||
input_ps3.init();
|
|
||||||
|
|
||||||
#ifdef HAVE_OSKUTIL
|
#ifdef HAVE_OSKUTIL
|
||||||
oskutil_init(&g_console.oskutil_handle, 0);
|
oskutil_init(&g_console.oskutil_handle, 0);
|
||||||
|
@ -367,7 +293,7 @@ int main(int argc, char *argv[])
|
||||||
RARCH_LOG("Started from multiMAN, will auto-start game.\n");
|
RARCH_LOG("Started from multiMAN, will auto-start game.\n");
|
||||||
strlcpy(g_console.rom_path, argv[1], sizeof(g_console.rom_path));
|
strlcpy(g_console.rom_path, argv[1], sizeof(g_console.rom_path));
|
||||||
rarch_settings_change(S_START_RARCH);
|
rarch_settings_change(S_START_RARCH);
|
||||||
rarch_startup(SYS_CONFIG_FILE);
|
rarch_startup(default_paths.config_file);
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
default:
|
default:
|
||||||
|
@ -390,7 +316,7 @@ begin_loop:
|
||||||
else if(g_console.mode_switch == MODE_MENU)
|
else if(g_console.mode_switch == MODE_MENU)
|
||||||
{
|
{
|
||||||
menu_loop();
|
menu_loop();
|
||||||
rarch_startup(SYS_CONFIG_FILE);
|
rarch_startup(default_paths.config_file);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
goto begin_shutdown;
|
goto begin_shutdown;
|
||||||
|
@ -398,8 +324,8 @@ begin_loop:
|
||||||
goto begin_loop;
|
goto begin_loop;
|
||||||
|
|
||||||
begin_shutdown:
|
begin_shutdown:
|
||||||
if(path_file_exists(SYS_CONFIG_FILE))
|
if(path_file_exists(default_paths.config_file))
|
||||||
rarch_config_save(SYS_CONFIG_FILE);
|
rarch_config_save(default_paths.config_file);
|
||||||
|
|
||||||
if(g_console.emulator_initialized)
|
if(g_console.emulator_initialized)
|
||||||
rarch_main_deinit();
|
rarch_main_deinit();
|
||||||
|
|
|
@ -27,6 +27,13 @@
|
||||||
#include "../../console/fileio/file_browser.h"
|
#include "../../console/fileio/file_browser.h"
|
||||||
|
|
||||||
#include "../../console/retroarch_console.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_common.h"
|
||||||
#include "../../gfx/gl_font.h"
|
#include "../../gfx/gl_font.h"
|
||||||
|
@ -34,7 +41,6 @@
|
||||||
#include "../../gfx/context/ps3_ctx.h"
|
#include "../../gfx/context/ps3_ctx.h"
|
||||||
#include "../../gfx/shader_cg.h"
|
#include "../../gfx/shader_cg.h"
|
||||||
|
|
||||||
#include "shared.h"
|
|
||||||
#include "../../file.h"
|
#include "../../file.h"
|
||||||
#include "../../general.h"
|
#include "../../general.h"
|
||||||
|
|
||||||
|
@ -97,20 +103,20 @@ static void set_setting_label(menu * menu_obj, unsigned currentsetting)
|
||||||
snprintf(items_generalsettings[currentsetting].setting_text, sizeof(items_generalsettings[currentsetting].setting_text), ps3_get_resolution_label(g_console.supported_resolutions[g_console.current_resolution_index]));
|
snprintf(items_generalsettings[currentsetting].setting_text, sizeof(items_generalsettings[currentsetting].setting_text), ps3_get_resolution_label(g_console.supported_resolutions[g_console.current_resolution_index]));
|
||||||
break;
|
break;
|
||||||
case SETTING_SHADER_PRESETS:
|
case SETTING_SHADER_PRESETS:
|
||||||
set_setting_label_color(g_console.cgp_path == DEFAULT_PRESET_FILE, currentsetting);
|
set_setting_label_color(true, currentsetting);
|
||||||
fill_pathname_base(fname, g_console.cgp_path, sizeof(fname));
|
fill_pathname_base(fname, g_console.cgp_path, sizeof(fname));
|
||||||
snprintf(items_generalsettings[currentsetting].setting_text, sizeof(items_generalsettings[currentsetting].setting_text), fname);
|
snprintf(items_generalsettings[currentsetting].setting_text, sizeof(items_generalsettings[currentsetting].setting_text), fname);
|
||||||
break;
|
break;
|
||||||
case SETTING_SHADER:
|
case SETTING_SHADER:
|
||||||
fill_pathname_base(fname, g_settings.video.cg_shader_path, sizeof(fname));
|
fill_pathname_base(fname, g_settings.video.cg_shader_path, sizeof(fname));
|
||||||
snprintf(items_generalsettings[currentsetting].setting_text, sizeof(items_generalsettings[currentsetting].setting_text), "%s", fname);
|
snprintf(items_generalsettings[currentsetting].setting_text, sizeof(items_generalsettings[currentsetting].setting_text), "%s", fname);
|
||||||
set_setting_label_color(strcmp(g_settings.video.cg_shader_path,DEFAULT_SHADER_FILE) == 0,
|
set_setting_label_color(strcmp(g_settings.video.cg_shader_path, default_paths.shader_file) == 0,
|
||||||
currentsetting);
|
currentsetting);
|
||||||
break;
|
break;
|
||||||
case SETTING_SHADER_2:
|
case SETTING_SHADER_2:
|
||||||
fill_pathname_base(fname, g_settings.video.second_pass_shader, sizeof(fname));
|
fill_pathname_base(fname, g_settings.video.second_pass_shader, sizeof(fname));
|
||||||
snprintf(items_generalsettings[currentsetting].setting_text, sizeof(items_generalsettings[currentsetting].setting_text), "%s", fname);
|
snprintf(items_generalsettings[currentsetting].setting_text, sizeof(items_generalsettings[currentsetting].setting_text), "%s", fname);
|
||||||
set_setting_label_color(strcmp(g_settings.video.second_pass_shader,DEFAULT_SHADER_FILE) == 0,
|
set_setting_label_color(strcmp(g_settings.video.second_pass_shader, default_paths.shader_file) == 0,
|
||||||
currentsetting);
|
currentsetting);
|
||||||
break;
|
break;
|
||||||
case SETTING_FONT_SIZE:
|
case SETTING_FONT_SIZE:
|
||||||
|
@ -239,19 +245,19 @@ static void set_setting_label(menu * menu_obj, unsigned currentsetting)
|
||||||
snprintf(items_generalsettings[currentsetting].setting_text, sizeof(items_generalsettings[currentsetting].setting_text), g_console.default_rom_startup_dir);
|
snprintf(items_generalsettings[currentsetting].setting_text, sizeof(items_generalsettings[currentsetting].setting_text), g_console.default_rom_startup_dir);
|
||||||
break;
|
break;
|
||||||
case SETTING_PATH_SAVESTATES_DIRECTORY:
|
case SETTING_PATH_SAVESTATES_DIRECTORY:
|
||||||
set_setting_label_color(!(strcmp(g_console.default_savestate_dir, usrDirPath)), currentsetting);
|
set_setting_label_color(!(strcmp(g_console.default_savestate_dir, default_paths.port_dir)), currentsetting);
|
||||||
snprintf(items_generalsettings[currentsetting].setting_text, sizeof(items_generalsettings[currentsetting].setting_text), g_console.default_savestate_dir);
|
snprintf(items_generalsettings[currentsetting].setting_text, sizeof(items_generalsettings[currentsetting].setting_text), g_console.default_savestate_dir);
|
||||||
break;
|
break;
|
||||||
case SETTING_PATH_SRAM_DIRECTORY:
|
case SETTING_PATH_SRAM_DIRECTORY:
|
||||||
set_setting_label_color(!(strcmp(g_console.default_sram_dir, usrDirPath)), currentsetting);
|
set_setting_label_color(!(strcmp(g_console.default_sram_dir, default_paths.port_dir)), currentsetting);
|
||||||
snprintf(items_generalsettings[currentsetting].setting_text, sizeof(items_generalsettings[currentsetting].setting_text), g_console.default_sram_dir);
|
snprintf(items_generalsettings[currentsetting].setting_text, sizeof(items_generalsettings[currentsetting].setting_text), g_console.default_sram_dir);
|
||||||
break;
|
break;
|
||||||
case SETTING_PATH_CHEATS:
|
case SETTING_PATH_CHEATS:
|
||||||
set_setting_label_color(!(strcmp(g_settings.cheat_database, usrDirPath)), currentsetting);
|
set_setting_label_color(!(strcmp(g_settings.cheat_database, default_paths.port_dir)), currentsetting);
|
||||||
snprintf(items_generalsettings[currentsetting].setting_text, sizeof(items_generalsettings[currentsetting].setting_text), g_settings.cheat_database);
|
snprintf(items_generalsettings[currentsetting].setting_text, sizeof(items_generalsettings[currentsetting].setting_text), g_settings.cheat_database);
|
||||||
break;
|
break;
|
||||||
case SETTING_PATH_SYSTEM:
|
case SETTING_PATH_SYSTEM:
|
||||||
set_setting_label_color(!(strcmp(g_settings.system_directory, systemDirPath)), currentsetting);
|
set_setting_label_color(!(strcmp(g_settings.system_directory, default_paths.system_dir)), currentsetting);
|
||||||
snprintf(items_generalsettings[currentsetting].setting_text, sizeof(items_generalsettings[currentsetting].setting_text), g_settings.system_directory);
|
snprintf(items_generalsettings[currentsetting].setting_text, sizeof(items_generalsettings[currentsetting].setting_text), g_settings.system_directory);
|
||||||
break;
|
break;
|
||||||
case SETTING_ENABLE_SRAM_PATH:
|
case SETTING_ENABLE_SRAM_PATH:
|
||||||
|
@ -394,7 +400,7 @@ static void menu_stack_push(unsigned stack_idx, unsigned menu_id)
|
||||||
menuStack[stack_idx].category_id = CATEGORY_FILEBROWSER;
|
menuStack[stack_idx].category_id = CATEGORY_FILEBROWSER;
|
||||||
menu_stack_refresh(items_generalsettings, stack_idx);
|
menu_stack_refresh(items_generalsettings, stack_idx);
|
||||||
strlcpy(tmpBrowser.extensions, "self|SELF|bin|BIN", sizeof(tmpBrowser.extensions));
|
strlcpy(tmpBrowser.extensions, "self|SELF|bin|BIN", sizeof(tmpBrowser.extensions));
|
||||||
filebrowser_set_root(&tmpBrowser, LIBRETRO_DIR_PATH);
|
filebrowser_set_root(&tmpBrowser, default_paths.core_dir);
|
||||||
filebrowser_iterate(&tmpBrowser, FILEBROWSER_ACTION_RESET);
|
filebrowser_iterate(&tmpBrowser, FILEBROWSER_ACTION_RESET);
|
||||||
break;
|
break;
|
||||||
case PRESET_CHOICE:
|
case PRESET_CHOICE:
|
||||||
|
@ -405,7 +411,7 @@ static void menu_stack_push(unsigned stack_idx, unsigned menu_id)
|
||||||
menuStack[stack_idx].category_id = CATEGORY_FILEBROWSER;
|
menuStack[stack_idx].category_id = CATEGORY_FILEBROWSER;
|
||||||
menu_stack_refresh(items_generalsettings, stack_idx);
|
menu_stack_refresh(items_generalsettings, stack_idx);
|
||||||
strlcpy(tmpBrowser.extensions, "cgp|CGP", sizeof(tmpBrowser.extensions));
|
strlcpy(tmpBrowser.extensions, "cgp|CGP", sizeof(tmpBrowser.extensions));
|
||||||
filebrowser_set_root(&tmpBrowser, PRESETS_DIR_PATH);
|
filebrowser_set_root(&tmpBrowser, default_paths.cgp_dir);
|
||||||
filebrowser_iterate(&tmpBrowser, FILEBROWSER_ACTION_RESET);
|
filebrowser_iterate(&tmpBrowser, FILEBROWSER_ACTION_RESET);
|
||||||
break;
|
break;
|
||||||
case INPUT_PRESET_CHOICE:
|
case INPUT_PRESET_CHOICE:
|
||||||
|
@ -416,7 +422,7 @@ static void menu_stack_push(unsigned stack_idx, unsigned menu_id)
|
||||||
menuStack[stack_idx].category_id = CATEGORY_FILEBROWSER;
|
menuStack[stack_idx].category_id = CATEGORY_FILEBROWSER;
|
||||||
menu_stack_refresh(items_generalsettings, stack_idx);
|
menu_stack_refresh(items_generalsettings, stack_idx);
|
||||||
strlcpy(tmpBrowser.extensions, "cfg|CFG", sizeof(tmpBrowser.extensions));
|
strlcpy(tmpBrowser.extensions, "cfg|CFG", sizeof(tmpBrowser.extensions));
|
||||||
filebrowser_set_root(&tmpBrowser, INPUT_PRESETS_DIR_PATH);
|
filebrowser_set_root(&tmpBrowser, default_paths.input_presets_dir);
|
||||||
filebrowser_iterate(&tmpBrowser, FILEBROWSER_ACTION_RESET);
|
filebrowser_iterate(&tmpBrowser, FILEBROWSER_ACTION_RESET);
|
||||||
break;
|
break;
|
||||||
case SHADER_CHOICE:
|
case SHADER_CHOICE:
|
||||||
|
@ -427,7 +433,7 @@ static void menu_stack_push(unsigned stack_idx, unsigned menu_id)
|
||||||
menuStack[stack_idx].category_id = CATEGORY_FILEBROWSER;
|
menuStack[stack_idx].category_id = CATEGORY_FILEBROWSER;
|
||||||
menu_stack_refresh(items_generalsettings, stack_idx);
|
menu_stack_refresh(items_generalsettings, stack_idx);
|
||||||
strlcpy(tmpBrowser.extensions, "cg|CG", sizeof(tmpBrowser.extensions));
|
strlcpy(tmpBrowser.extensions, "cg|CG", sizeof(tmpBrowser.extensions));
|
||||||
filebrowser_set_root(&tmpBrowser, SHADERS_DIR_PATH);
|
filebrowser_set_root(&tmpBrowser, default_paths.shader_dir);
|
||||||
filebrowser_iterate(&tmpBrowser, FILEBROWSER_ACTION_RESET);
|
filebrowser_iterate(&tmpBrowser, FILEBROWSER_ACTION_RESET);
|
||||||
break;
|
break;
|
||||||
case BORDER_CHOICE:
|
case BORDER_CHOICE:
|
||||||
|
@ -438,7 +444,7 @@ static void menu_stack_push(unsigned stack_idx, unsigned menu_id)
|
||||||
menuStack[stack_idx].category_id = CATEGORY_FILEBROWSER;
|
menuStack[stack_idx].category_id = CATEGORY_FILEBROWSER;
|
||||||
menu_stack_refresh(items_generalsettings, stack_idx);
|
menu_stack_refresh(items_generalsettings, stack_idx);
|
||||||
strlcpy(tmpBrowser.extensions, "png|PNG|jpg|JPG|JPEG|jpeg", sizeof(tmpBrowser.extensions));
|
strlcpy(tmpBrowser.extensions, "png|PNG|jpg|JPG|JPEG|jpeg", sizeof(tmpBrowser.extensions));
|
||||||
filebrowser_set_root(&tmpBrowser, BORDERS_DIR_PATH);
|
filebrowser_set_root(&tmpBrowser, default_paths.border_dir);
|
||||||
filebrowser_iterate(&tmpBrowser, FILEBROWSER_ACTION_RESET);
|
filebrowser_iterate(&tmpBrowser, FILEBROWSER_ACTION_RESET);
|
||||||
break;
|
break;
|
||||||
case PATH_DEFAULT_ROM_DIR_CHOICE:
|
case PATH_DEFAULT_ROM_DIR_CHOICE:
|
||||||
|
@ -868,7 +874,7 @@ static void select_directory(void)
|
||||||
}
|
}
|
||||||
else if (input_state & (1 << RETRO_DEVICE_ID_JOYPAD_X))
|
else if (input_state & (1 << RETRO_DEVICE_ID_JOYPAD_X))
|
||||||
{
|
{
|
||||||
strlcpy(path, usrDirPath, sizeof(path));
|
strlcpy(path, default_paths.port_dir, sizeof(path));
|
||||||
switch(menu_id)
|
switch(menu_id)
|
||||||
{
|
{
|
||||||
case PATH_SAVESTATES_DIR_CHOICE:
|
case PATH_SAVESTATES_DIR_CHOICE:
|
||||||
|
@ -952,10 +958,10 @@ static void rarch_filename_input_and_save (unsigned filename_type)
|
||||||
case CONFIG_FILE:
|
case CONFIG_FILE:
|
||||||
break;
|
break;
|
||||||
case SHADER_PRESET_FILE:
|
case SHADER_PRESET_FILE:
|
||||||
snprintf(filepath, sizeof(filepath), "%s/%s.cgp", PRESETS_DIR_PATH, filename_tmp);
|
snprintf(filepath, sizeof(filepath), "%s/%s.cgp", default_paths.cgp_dir, filename_tmp);
|
||||||
break;
|
break;
|
||||||
case INPUT_PRESET_FILE:
|
case INPUT_PRESET_FILE:
|
||||||
snprintf(filepath, sizeof(filepath), "%s/%s.cfg", INPUT_PRESETS_DIR_PATH, filename_tmp);
|
snprintf(filepath, sizeof(filepath), "%s/%s.cfg", default_paths.input_presets_dir, filename_tmp);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1072,7 +1078,7 @@ static void producesettingentry(menu * menu_obj, unsigned switchvalue)
|
||||||
if(input_state & (1 << RETRO_DEVICE_ID_JOYPAD_START))
|
if(input_state & (1 << RETRO_DEVICE_ID_JOYPAD_START))
|
||||||
{
|
{
|
||||||
rarch_load_shader(1, NULL);
|
rarch_load_shader(1, NULL);
|
||||||
strlcpy(g_settings.video.cg_shader_path, DEFAULT_SHADER_FILE, sizeof(g_settings.video.cg_shader_path));
|
strlcpy(g_settings.video.cg_shader_path, default_paths.shader_file, sizeof(g_settings.video.cg_shader_path));
|
||||||
menu_stack_refresh(items_generalsettings, menuStackindex);
|
menu_stack_refresh(items_generalsettings, menuStackindex);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -1086,7 +1092,7 @@ static void producesettingentry(menu * menu_obj, unsigned switchvalue)
|
||||||
if(input_state & (1 << RETRO_DEVICE_ID_JOYPAD_START))
|
if(input_state & (1 << RETRO_DEVICE_ID_JOYPAD_START))
|
||||||
{
|
{
|
||||||
rarch_load_shader(2, NULL);
|
rarch_load_shader(2, NULL);
|
||||||
strlcpy(g_settings.video.second_pass_shader, DEFAULT_SHADER_FILE, sizeof(g_settings.video.second_pass_shader));
|
strlcpy(g_settings.video.second_pass_shader, default_paths.shader_file, sizeof(g_settings.video.second_pass_shader));
|
||||||
menu_stack_refresh(items_generalsettings, menuStackindex);
|
menu_stack_refresh(items_generalsettings, menuStackindex);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -1403,7 +1409,7 @@ static void producesettingentry(menu * menu_obj, unsigned switchvalue)
|
||||||
}
|
}
|
||||||
|
|
||||||
if(input_state & (1 << RETRO_DEVICE_ID_JOYPAD_START))
|
if(input_state & (1 << RETRO_DEVICE_ID_JOYPAD_START))
|
||||||
strlcpy(g_console.default_savestate_dir, usrDirPath, sizeof(g_console.default_savestate_dir));
|
strlcpy(g_console.default_savestate_dir, default_paths.savestate_dir, sizeof(g_console.default_savestate_dir));
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case SETTING_PATH_SRAM_DIRECTORY:
|
case SETTING_PATH_SRAM_DIRECTORY:
|
||||||
|
@ -1414,7 +1420,7 @@ static void producesettingentry(menu * menu_obj, unsigned switchvalue)
|
||||||
}
|
}
|
||||||
|
|
||||||
if(input_state & (1 << RETRO_DEVICE_ID_JOYPAD_START))
|
if(input_state & (1 << RETRO_DEVICE_ID_JOYPAD_START))
|
||||||
strlcpy(g_console.default_sram_dir, "", sizeof(g_console.default_sram_dir));
|
strlcpy(g_console.default_sram_dir, default_paths.sram_dir, sizeof(g_console.default_sram_dir));
|
||||||
break;
|
break;
|
||||||
case SETTING_PATH_CHEATS:
|
case SETTING_PATH_CHEATS:
|
||||||
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)))
|
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)))
|
||||||
|
@ -1424,7 +1430,7 @@ static void producesettingentry(menu * menu_obj, unsigned switchvalue)
|
||||||
}
|
}
|
||||||
|
|
||||||
if(input_state & (1 << RETRO_DEVICE_ID_JOYPAD_START))
|
if(input_state & (1 << RETRO_DEVICE_ID_JOYPAD_START))
|
||||||
strlcpy(g_settings.cheat_database, usrDirPath, sizeof(g_settings.cheat_database));
|
strlcpy(g_settings.cheat_database, default_paths.port_dir, sizeof(g_settings.cheat_database));
|
||||||
break;
|
break;
|
||||||
case SETTING_PATH_SYSTEM:
|
case SETTING_PATH_SYSTEM:
|
||||||
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)))
|
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)))
|
||||||
|
@ -1434,7 +1440,7 @@ static void producesettingentry(menu * menu_obj, unsigned switchvalue)
|
||||||
}
|
}
|
||||||
|
|
||||||
if(input_state & (1 << RETRO_DEVICE_ID_JOYPAD_START))
|
if(input_state & (1 << RETRO_DEVICE_ID_JOYPAD_START))
|
||||||
strlcpy(g_settings.system_directory, systemDirPath, sizeof(g_settings.system_directory));
|
strlcpy(g_settings.system_directory, default_paths.system_dir, sizeof(g_settings.system_directory));
|
||||||
break;
|
break;
|
||||||
case SETTING_ENABLE_SRAM_PATH:
|
case SETTING_ENABLE_SRAM_PATH:
|
||||||
if((input_state & (1 << RETRO_DEVICE_ID_JOYPAD_LEFT)) || (input_state & (1 << RETRO_DEVICE_ID_JOYPAD_RIGHT)))
|
if((input_state & (1 << RETRO_DEVICE_ID_JOYPAD_LEFT)) || (input_state & (1 << RETRO_DEVICE_ID_JOYPAD_RIGHT)))
|
||||||
|
@ -1464,8 +1470,8 @@ static void producesettingentry(menu * menu_obj, unsigned switchvalue)
|
||||||
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)) || (input_state & (1 << RETRO_DEVICE_ID_JOYPAD_START)))
|
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)) || (input_state & (1 << RETRO_DEVICE_ID_JOYPAD_START)))
|
||||||
{
|
{
|
||||||
strlcpy(g_console.default_rom_startup_dir, "/", sizeof(g_console.default_rom_startup_dir));
|
strlcpy(g_console.default_rom_startup_dir, "/", sizeof(g_console.default_rom_startup_dir));
|
||||||
strlcpy(g_console.default_savestate_dir, usrDirPath, sizeof(g_console.default_savestate_dir));
|
strlcpy(g_console.default_savestate_dir, default_paths.port_dir, sizeof(g_console.default_savestate_dir));
|
||||||
strlcpy(g_settings.cheat_database, usrDirPath, sizeof(g_settings.cheat_database));
|
strlcpy(g_settings.cheat_database, default_paths.port_dir, sizeof(g_settings.cheat_database));
|
||||||
strlcpy(g_console.default_sram_dir, "", sizeof(g_console.default_sram_dir));
|
strlcpy(g_console.default_sram_dir, "", sizeof(g_console.default_sram_dir));
|
||||||
|
|
||||||
menu_stack_refresh(items_generalsettings, menuStackindex);
|
menu_stack_refresh(items_generalsettings, menuStackindex);
|
||||||
|
@ -1988,9 +1994,9 @@ static void ingame_menu(void)
|
||||||
case MENU_ITEM_RETURN_TO_MULTIMAN:
|
case MENU_ITEM_RETURN_TO_MULTIMAN:
|
||||||
if(input_state & (1 << RETRO_DEVICE_ID_JOYPAD_B))
|
if(input_state & (1 << RETRO_DEVICE_ID_JOYPAD_B))
|
||||||
{
|
{
|
||||||
if(path_file_exists(MULTIMAN_EXECUTABLE))
|
if(path_file_exists(default_paths.multiman_self_file))
|
||||||
{
|
{
|
||||||
strlcpy(g_console.launch_app_on_exit, MULTIMAN_EXECUTABLE,
|
strlcpy(g_console.launch_app_on_exit, default_paths.multiman_self_file,
|
||||||
sizeof(g_console.launch_app_on_exit));
|
sizeof(g_console.launch_app_on_exit));
|
||||||
|
|
||||||
rarch_settings_change(S_RETURN_TO_DASHBOARD);
|
rarch_settings_change(S_RETURN_TO_DASHBOARD);
|
||||||
|
|
|
@ -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 lock_attr;
|
||||||
sys_lwmutex_attribute_t cond_lock_attr;
|
sys_lwmutex_attribute_t cond_lock_attr;
|
||||||
sys_lwcond_attribute_t cond_attr;
|
sys_lwcond_attribute_t cond_attr;
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef __PSL1GHT__
|
|
||||||
sys_lwmutex_attribute_initialize(lock_attr);
|
sys_lwmutex_attribute_initialize(lock_attr);
|
||||||
sys_lwmutex_attribute_initialize(cond_lock_attr);
|
sys_lwmutex_attribute_initialize(cond_lock_attr);
|
||||||
sys_lwcond_attribute_initialize(cond_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)
|
#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 uint64_t state[MAX_PADS];
|
||||||
static unsigned pads_connected;
|
static unsigned pads_connected;
|
||||||
#ifdef HAVE_MOUSE
|
#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 = {
|
const input_driver_t input_ps3 = {
|
||||||
.init = ps3_input_initialize,
|
.init = ps3_input_initialize,
|
||||||
.poll = ps3_input_poll,
|
.poll = ps3_input_poll,
|
||||||
.input_state = ps3_input_state,
|
.input_state = ps3_input_state,
|
||||||
.key_pressed = ps3_key_pressed,
|
.key_pressed = ps3_key_pressed,
|
||||||
.free = ps3_free_input,
|
.free = ps3_free_input,
|
||||||
|
.set_default_keybind_lut = ps3_set_default_keybind_lut,
|
||||||
.ident = "ps3",
|
.ident = "ps3",
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -156,6 +156,44 @@ typedef struct
|
||||||
CellOskDialogParam dialogParam;
|
CellOskDialogParam dialogParam;
|
||||||
} oskutil_params;
|
} 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_message(oskutil_params *params, const wchar_t* msg);
|
||||||
void oskutil_write_initial_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);
|
void oskutil_init(oskutil_params *params, unsigned int containersize);
|
||||||
|
|
|
@ -56,6 +56,7 @@
|
||||||
#define param_attrib attrib
|
#define param_attrib attrib
|
||||||
#define sys_lwmutex_attribute_t sys_lwmutex_attr_t
|
#define sys_lwmutex_attribute_t sys_lwmutex_attr_t
|
||||||
#define sys_lwcond_attribute_t sys_lwcond_attr_t
|
#define sys_lwcond_attribute_t sys_lwcond_attr_t
|
||||||
|
#define sys_semaphore_t sys_sem_t
|
||||||
|
|
||||||
#else
|
#else
|
||||||
#define numChannels nChannel
|
#define numChannels nChannel
|
||||||
|
@ -288,6 +289,14 @@
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/*============================================================
|
||||||
|
TIMER PROTOTYPES
|
||||||
|
============================================================ */
|
||||||
|
|
||||||
|
#ifdef __PSL1GHT__
|
||||||
|
#define sys_timer_usleep usleep
|
||||||
|
#endif
|
||||||
|
|
||||||
/*============================================================
|
/*============================================================
|
||||||
THREADING PROTOTYPES
|
THREADING PROTOTYPES
|
||||||
============================================================ */
|
============================================================ */
|
||||||
|
@ -318,17 +327,112 @@
|
||||||
#define CELL_GCM_FALSE GCM_FALSE
|
#define CELL_GCM_FALSE GCM_FALSE
|
||||||
#define CELL_GCM_TRUE GCM_TRUE
|
#define CELL_GCM_TRUE GCM_TRUE
|
||||||
|
|
||||||
#define CELL_GCM_TEXTURE_NEAREST GCM_TEXTURE_NEAREST
|
|
||||||
|
|
||||||
#define CELL_GCM_ONE GCM_ONE
|
#define CELL_GCM_ONE GCM_ONE
|
||||||
#define CELL_GCM_ZERO GCM_ZERO
|
#define CELL_GCM_ZERO GCM_ZERO
|
||||||
|
#define CELL_GCM_ALWAYS GCM_ALWAYS
|
||||||
|
|
||||||
#define CELL_GCM_SMOOTH GCM_SMOOTH
|
#define CELL_GCM_LOCATION_LOCAL GCM_LOCATION_RSX
|
||||||
|
#define CELL_GCM_LOCATION_MAIN GCM_LOCATION_CELL
|
||||||
|
|
||||||
|
#define CELL_GCM_MAX_RT_DIMENSION (4096)
|
||||||
|
|
||||||
|
#define CELL_GCM_TEXTURE_LINEAR_NEAREST GCM_TEXTURE_LINEAR_MIPMAP_NEAREST
|
||||||
|
#define CELL_GCM_TEXTURE_LINEAR_LINEAR GCM_TEXTURE_LINEAR_MIPMAP_LINEAR
|
||||||
|
#define CELL_GCM_TEXTURE_NEAREST_LINEAR GCM_TEXTURE_NEAREST_MIPMAP_LINEAR
|
||||||
|
#define CELL_GCM_TEXTURE_NEAREST_NEAREST GCM_TEXTURE_NEAREST_MIPMAP_NEAREST
|
||||||
|
#define CELL_GCM_TEXTURE_NEAREST GCM_TEXTURE_NEAREST
|
||||||
|
#define CELL_GCM_TEXTURE_LINEAR GCM_TEXTURE_LINEAR
|
||||||
|
|
||||||
|
#define CELL_GCM_TEXTURE_A8R8G8B8 GCM_TEXTURE_FORMAT_A8R8G8B8
|
||||||
|
#define CELL_GCM_TEXTURE_R5G6B5 GCM_TEXTURE_FORMAT_R5G6B5
|
||||||
|
#define CELL_GCM_TEXTURE_A1R5G5B5 GCM_TEXTURE_FORMAT_A1R5G5B5
|
||||||
|
|
||||||
|
#define CELL_GCM_TEXTURE_CLAMP_TO_EDGE GCM_TEXTURE_CLAMP_TO_EDGE
|
||||||
|
|
||||||
|
#define CELL_GCM_TEXTURE_MAX_ANISO_1 GCM_TEXTURE_MAX_ANISO_1
|
||||||
|
#define CELL_GCM_TEXTURE_CONVOLUTION_QUINCUNX GCM_TEXTURE_CONVOLUTION_QUINCUNX
|
||||||
|
#define CELL_GCM_TEXTURE_ZFUNC_NEVER GCM_TEXTURE_ZFUNC_NEVER
|
||||||
|
|
||||||
|
#define CELL_GCM_DISPLAY_HSYNC GCM_FLIP_HSYNC
|
||||||
|
#define CELL_GCM_DISPLAY_VSYNC GCM_FLIP_VSYNC
|
||||||
|
|
||||||
|
#define CELL_GCM_CLEAR_R GCM_CLEAR_R
|
||||||
|
#define CELL_GCM_CLEAR_G GCM_CLEAR_G
|
||||||
|
#define CELL_GCM_CLEAR_B GCM_CLEAR_B
|
||||||
|
#define CELL_GCM_CLEAR_A GCM_CLEAR_A
|
||||||
|
|
||||||
|
#define CELL_GCM_FUNC_ADD GCM_FUNC_ADD
|
||||||
|
|
||||||
|
#define CELL_RESC_720x480 RESC_720x480
|
||||||
|
#define CELL_RESC_720x576 RESC_720x576
|
||||||
|
#define CELL_RESC_1280x720 RESC_1280x720
|
||||||
|
#define CELL_RESC_1920x1080 RESC_1920x1080
|
||||||
|
|
||||||
|
#define CELL_RESC_FULLSCREEN RESC_FULLSCREEN
|
||||||
|
#define CELL_RESC_PANSCAN RESC_PANSCAN
|
||||||
|
#define CELL_RESC_LETTERBOX RESC_LETTERBOX
|
||||||
|
#define CELL_RESC_CONSTANT_VRAM RESC_CONSTANT_VRAM
|
||||||
|
#define CELL_RESC_MINIMUM_GPU_LOAD RESC_MINIMUM_GPU_LOAD
|
||||||
|
|
||||||
|
#define CELL_RESC_PAL_50 RESC_PAL_50
|
||||||
|
#define CELL_RESC_PAL_60_DROP RESC_PAL_60_DROP
|
||||||
|
#define CELL_RESC_PAL_60_INTERPOLATE RESC_PAL_60_INTERPOLATE
|
||||||
|
#define CELL_RESC_PAL_60_INTERPOLATE_30_DROP RESC_PAL_60_INTERPOLATE_30_DROP
|
||||||
|
#define CELL_RESC_PAL_60_INTERPOLATE_DROP_FLEXIBLE RESC_PAL_60_INTERPOLATE_DROP_FLEXIBLE
|
||||||
|
|
||||||
|
#define CELL_RESC_INTERLACE_FILTER RESC_INTERLACE_FILTER
|
||||||
|
#define CELL_RESC_NORMAL_BILINEAR RESC_NORMAL_BILINEAR
|
||||||
|
|
||||||
|
#define CELL_RESC_ELEMENT_HALF RESC_ELEMENT_HALF
|
||||||
|
|
||||||
|
#define CELL_VIDEO_OUT_ASPECT_AUTO VIDEO_ASPECT_AUTO
|
||||||
|
#define CELL_VIDEO_OUT_ASPECT_4_3 VIDEO_ASPECT_4_3
|
||||||
|
#define CELL_VIDEO_OUT_ASPECT_16_9 VIDEO_ASPECT_16_9
|
||||||
|
|
||||||
|
#define CELL_VIDEO_OUT_RESOLUTION_480 VIDEO_RESOLUTION_480
|
||||||
|
#define CELL_VIDEO_OUT_RESOLUTION_576 VIDEO_RESOLUTION_576
|
||||||
|
#define CELL_VIDEO_OUT_RESOLUTION_720 VIDEO_RESOLUTION_720
|
||||||
|
#define CELL_VIDEO_OUT_RESOLUTION_1080 VIDEO_RESOLUTION_1080
|
||||||
|
#define CELL_VIDEO_OUT_RESOLUTION_960x1080 VIDEO_RESOLUTION_960x1080
|
||||||
|
#define CELL_VIDEO_OUT_RESOLUTION_1280x1080 VIDEO_RESOLUTION_1280x1080
|
||||||
|
#define CELL_VIDEO_OUT_RESOLUTION_1440x1080 VIDEO_RESOLUTION_1440x1080
|
||||||
|
#define CELL_VIDEO_OUT_RESOLUTION_1600x1080 VIDEO_RESOLUTION_1600x1080
|
||||||
|
|
||||||
|
#define CELL_VIDEO_OUT_SCAN_MODE_PROGRESSIVE VIDEO_SCANMODE_PROGRESSIVE
|
||||||
|
|
||||||
|
#define CELL_VIDEO_OUT_PRIMARY VIDEO_PRIMARY
|
||||||
|
|
||||||
|
#define CELL_VIDEO_OUT_BUFFER_COLOR_FORMAT_X8R8G8B8 VIDEO_BUFFER_FORMAT_XRGB
|
||||||
|
#define CELL_VIDEO_OUT_BUFFER_COLOR_FORMAT_R16G16B16X16_FLOAT VIDEO_BUFFER_FORMAT_FLOAT
|
||||||
|
|
||||||
#define CellGcmSurface gcmSurface
|
#define CellGcmSurface gcmSurface
|
||||||
#define CellGcmTexture gcmTexture
|
#define CellGcmTexture gcmTexture
|
||||||
|
#define CellGcmContextData _gcmCtxData
|
||||||
|
#define CellGcmConfig gcmConfiguration
|
||||||
|
#define CellVideoOutConfiguration videoConfiguration
|
||||||
|
#define CellVideoOutResolution videoResolution
|
||||||
|
#define CellVideoOutState videoState
|
||||||
|
|
||||||
|
#define CellRescInitConfig rescInitConfig
|
||||||
|
#define CellRescSrc rescSrc
|
||||||
|
#define CellRescBufferMode rescBufferMode
|
||||||
|
|
||||||
|
#define resolutionId resolution
|
||||||
|
#define memoryFrequency memoryFreq
|
||||||
|
#define coreFrequency coreFreq
|
||||||
|
|
||||||
|
#define cellGcmFinish rsxFinish
|
||||||
|
|
||||||
|
#define cellGcmGetFlipStatus gcmGetFlipStatus
|
||||||
|
#define cellGcmResetFlipStatus gcmResetFlipStatus
|
||||||
#define cellGcmSetWaitFlip gcmSetWaitFlip
|
#define cellGcmSetWaitFlip gcmSetWaitFlip
|
||||||
|
#define cellGcmSetDebugOutputLevel gcmSetDebugOutputLevel
|
||||||
|
#define cellGcmSetDisplayBuffer gcmSetDisplayBuffer
|
||||||
|
#define cellGcmSetGraphicsHandler gcmSetGraphicsHandler
|
||||||
|
#define cellGcmSetFlipHandler gcmSetFlipHandler
|
||||||
|
#define cellGcmSetVBlankHandler gcmSetVBlankHandler
|
||||||
|
#define cellGcmGetConfiguration gcmGetConfiguration
|
||||||
|
#define cellGcmSetJumpCommand rsxSetJumpCommand
|
||||||
#define cellGcmFlush rsxFlushBuffer
|
#define cellGcmFlush rsxFlushBuffer
|
||||||
#define cellGcmSetFlipMode gcmSetFlipMode
|
#define cellGcmSetFlipMode gcmSetFlipMode
|
||||||
#define cellGcmSetFlip gcmSetFlip
|
#define cellGcmSetFlip gcmSetFlip
|
||||||
|
@ -337,6 +441,42 @@
|
||||||
#define cellGcmBindTile gcmBindTile
|
#define cellGcmBindTile gcmBindTile
|
||||||
#define cellGcmSetTileInfo gcmSetTileInfo
|
#define cellGcmSetTileInfo gcmSetTileInfo
|
||||||
#define cellGcmAddressToOffset gcmAddressToOffset
|
#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
|
||||||
|
#define cellRescSetVBlankHandler rescSetVBlankHandler
|
||||||
|
#define cellRescSetFlipHandler rescSetFlipHandler
|
||||||
|
#define cellRescAdjustAspectRatio rescAdjustAspectRatio
|
||||||
|
#define cellRescSetWaitFlip rescSetWaitFlip
|
||||||
|
#define cellRescSetSrc rescSetSrc
|
||||||
|
#define cellRescInit rescInit
|
||||||
|
#define cellRescExit rescExit
|
||||||
|
|
||||||
|
#define cellVideoOutConfigure videoConfigure
|
||||||
|
#define cellVideoOutGetState videoGetState
|
||||||
|
#define cellVideoOutGetResolution videoGetResolution
|
||||||
|
|
||||||
|
#define cellGcmSetViewportInline rsxSetViewport
|
||||||
|
#define cellGcmSetReferenceCommandInline rsxSetReferenceCommand
|
||||||
|
#define cellGcmSetBlendEquationInline rsxSetBlendEquation
|
||||||
|
#define cellGcmSetWriteBackEndLabelInline rsxSetWriteBackendLabel
|
||||||
|
#define cellGcmSetWaitLabelInline rsxSetWaitLabel
|
||||||
|
#define cellGcmSetDepthTestEnableInline rsxSetDepthTestEnable
|
||||||
|
#define cellGcmSetScissorInline rsxSetScissor
|
||||||
|
#define cellGcmSetBlendEnableInline rsxSetBlendEnable
|
||||||
|
#define cellGcmSetClearColorInline rsxSetClearColor
|
||||||
|
#define cellGcmSetBlendFuncInline rsxSetBlendFunc
|
||||||
|
#define cellGcmSetBlendColorInline rsxSetBlendColor
|
||||||
|
#define cellGcmSetTextureFilterInline rsxTextureFilter
|
||||||
|
#define cellGcmSetTextureControlInline rsxTextureControl
|
||||||
|
#define cellGcmSetCullFaceEnableInline rsxSetCullFaceEnable
|
||||||
|
#define cellGcmSetShadeModeInline rxSetShadeModel
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -200,7 +200,7 @@ int main(void)
|
||||||
|
|
||||||
wii_video_init();
|
wii_video_init();
|
||||||
input_wii.init();
|
input_wii.init();
|
||||||
rarch_input_set_controls_default();
|
rarch_input_set_controls_default(&input_wii);
|
||||||
|
|
||||||
rgui_handle_t *rgui = rgui_init("",
|
rgui_handle_t *rgui = rgui_init("",
|
||||||
menu_framebuf, RGUI_WIDTH * sizeof(uint16_t),
|
menu_framebuf, RGUI_WIDTH * sizeof(uint16_t),
|
||||||
|
|
113
wii/input.c
113
wii/input.c
|
@ -34,6 +34,97 @@
|
||||||
#define JOYSTICK_THRESHOLD 64
|
#define JOYSTICK_THRESHOLD 64
|
||||||
|
|
||||||
static uint64_t pad_state[4];
|
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 bool g_quit;
|
||||||
|
|
||||||
static int16_t wii_input_state(void *data, const struct retro_keybind **binds,
|
static int16_t wii_input_state(void *data, const struct retro_keybind **binds,
|
||||||
|
@ -279,12 +370,32 @@ static bool wii_key_pressed(void *data, int key)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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 = {
|
const input_driver_t input_wii = {
|
||||||
.init = wii_input_initialize,
|
.init = wii_input_initialize,
|
||||||
.poll = wii_input_poll,
|
.poll = wii_input_poll,
|
||||||
.input_state = wii_input_state,
|
.input_state = wii_input_state,
|
||||||
.key_pressed = wii_key_pressed,
|
.key_pressed = wii_key_pressed,
|
||||||
.free = wii_free_input,
|
.free = wii_free_input,
|
||||||
|
.set_default_keybind_lut = wii_set_default_keybind_lut,
|
||||||
.ident = "wii",
|
.ident = "wii",
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -81,6 +81,98 @@ enum
|
||||||
WII_NUNCHUK_RIGHT = 1ULL << 59,
|
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
|
||||||
|
};
|
||||||
|
|
||||||
uint64_t wii_input_update(unsigned port);
|
uint64_t wii_input_update(unsigned port);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
Binary file not shown.
Binary file not shown.
After Width: | Height: | Size: 6.3 KiB |
Binary file not shown.
After Width: | Height: | Size: 20 KiB |
Binary file not shown.
After Width: | Height: | Size: 3.1 KiB |
Binary file not shown.
After Width: | Height: | Size: 8.7 KiB |
|
@ -0,0 +1,214 @@
|
||||||
|
/**
|
||||||
|
* RetroLaunch 2012
|
||||||
|
*
|
||||||
|
* This program 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
|
||||||
|
* Foundation; either version 2 of the License, or (at your option) any later
|
||||||
|
* version. This program 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 this program; if not, write to the Free Software Foundation, Inc.,
|
||||||
|
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. To contact the
|
||||||
|
* authors: Surreal64 CE Team (http://www.emuxtras.net)
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
#include "Font.h"
|
||||||
|
|
||||||
|
#include "../../../general.h"
|
||||||
|
#include "../../xdk_d3d8.h"
|
||||||
|
|
||||||
|
Font g_font;
|
||||||
|
|
||||||
|
Font::Font(void)
|
||||||
|
{
|
||||||
|
m_pFont = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
Font::~Font(void)
|
||||||
|
{
|
||||||
|
if (m_pFont)
|
||||||
|
m_pFont->Release();
|
||||||
|
}
|
||||||
|
|
||||||
|
bool Font::Create()
|
||||||
|
{
|
||||||
|
if (m_pFont)
|
||||||
|
m_pFont->Release();
|
||||||
|
|
||||||
|
HRESULT g_hResult = XFONT_OpenTrueTypeFont(L"D:\\Media\\arial.ttf", 256 * 1024, &m_pFont);
|
||||||
|
|
||||||
|
if (FAILED(g_hResult))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Font::Render(const string &str, int x, int y, dword height, dword style, D3DXCOLOR color, int maxWidth, bool fade, Align alignment)
|
||||||
|
{
|
||||||
|
CSurface texture;
|
||||||
|
RenderToTexture(texture, str, height, style, color, maxWidth, fade);
|
||||||
|
|
||||||
|
if (alignment != Left)
|
||||||
|
{
|
||||||
|
word *wcBuf = StringToWChar(str);
|
||||||
|
dword dwRequiredWidth;
|
||||||
|
m_pFont->GetTextExtent(wcBuf, -1, &dwRequiredWidth);
|
||||||
|
delete [] wcBuf;
|
||||||
|
|
||||||
|
if (alignment == Center)
|
||||||
|
x -= (dwRequiredWidth / 2);
|
||||||
|
else if (alignment == Right)
|
||||||
|
x -= dwRequiredWidth;
|
||||||
|
}
|
||||||
|
|
||||||
|
texture.Render(x, y);
|
||||||
|
}
|
||||||
|
|
||||||
|
void Font::RenderToTexture(CSurface &texture, const string &str, dword height, dword style, D3DXCOLOR color, int maxWidth, bool fade)
|
||||||
|
{
|
||||||
|
xdk_d3d_video_t *d3d = (xdk_d3d_video_t*)driver.video_data;
|
||||||
|
if (m_pFont == NULL)
|
||||||
|
return;
|
||||||
|
|
||||||
|
m_pFont->SetTextHeight(height);
|
||||||
|
m_pFont->SetTextStyle(style);
|
||||||
|
m_pFont->SetTextColor(color);
|
||||||
|
|
||||||
|
dword dwMaxWidth = (maxWidth <= 0) ? 1000 : maxWidth;
|
||||||
|
|
||||||
|
// get the exact width and height required to display the string
|
||||||
|
dword dwRequiredWidth = GetRequiredWidth(str, height, style);
|
||||||
|
dword dwRequiredHeight = GetRequiredHeight(str, height, style);;
|
||||||
|
|
||||||
|
// calculate the texture width and height needed to display the font
|
||||||
|
dword dwTextureWidth = dwRequiredWidth * 2;
|
||||||
|
dword dwTextureHeight = dwRequiredHeight * 2;
|
||||||
|
{
|
||||||
|
// because the textures are swizzled we make sure
|
||||||
|
// the dimensions are a power of two
|
||||||
|
for(dword wmask = 1; dwTextureWidth &(dwTextureWidth - 1); wmask = (wmask << 1 ) + 1)
|
||||||
|
dwTextureWidth = (dwTextureWidth + wmask) & ~wmask;
|
||||||
|
|
||||||
|
for(dword hmask = 1; dwTextureHeight &(dwTextureHeight - 1); hmask = (hmask << 1) + 1)
|
||||||
|
dwTextureHeight = ( dwTextureHeight + hmask ) & ~hmask;
|
||||||
|
|
||||||
|
// also enforce a minimum pitch of 64 bytes
|
||||||
|
dwTextureWidth = max(64 / XGBytesPerPixelFromFormat(D3DFMT_A8R8G8B8), dwTextureWidth);
|
||||||
|
}
|
||||||
|
|
||||||
|
// create an temporary image surface to render to
|
||||||
|
D3DSurface *pTempSurface;
|
||||||
|
d3d->d3d_render_device->CreateImageSurface(dwTextureWidth, dwTextureHeight, D3DFMT_LIN_A8R8G8B8, &pTempSurface);
|
||||||
|
|
||||||
|
// clear the temporary surface
|
||||||
|
{
|
||||||
|
D3DLOCKED_RECT tmpLr;
|
||||||
|
pTempSurface->LockRect(&tmpLr, NULL, 0);
|
||||||
|
memset(tmpLr.pBits, 0, dwTextureWidth * dwTextureHeight * XGBytesPerPixelFromFormat(D3DFMT_A8R8G8B8));
|
||||||
|
pTempSurface->UnlockRect();
|
||||||
|
}
|
||||||
|
|
||||||
|
// render the text to the temporary surface
|
||||||
|
word *wcBuf = StringToWChar(str);
|
||||||
|
m_pFont->TextOut(pTempSurface, wcBuf, -1, 0, 0);
|
||||||
|
delete [] wcBuf;
|
||||||
|
|
||||||
|
// create the texture that will be drawn to the screen
|
||||||
|
texture.Destroy();
|
||||||
|
texture.Create(dwTextureWidth, dwTextureHeight);
|
||||||
|
|
||||||
|
// copy from the temporary surface to the final texture
|
||||||
|
{
|
||||||
|
D3DLOCKED_RECT tmpLr;
|
||||||
|
D3DLOCKED_RECT txtLr;
|
||||||
|
|
||||||
|
pTempSurface->LockRect(&tmpLr, NULL, 0);
|
||||||
|
texture.GetTexture()->LockRect(0, &txtLr, NULL, 0);
|
||||||
|
|
||||||
|
if (fade)
|
||||||
|
{
|
||||||
|
// draw the last 35 pixels of the string fading out to max width or texture width
|
||||||
|
dword dwMinFadeDistance = min(static_cast<dword>(dwTextureWidth * 0.35), 35);
|
||||||
|
dword dwFadeStart = min(dwTextureWidth, dwMaxWidth - dwMinFadeDistance);
|
||||||
|
dword dwFadeEnd = min(dwTextureWidth, dwMaxWidth);
|
||||||
|
dword dwFadeDistance = dwFadeEnd - dwFadeStart;
|
||||||
|
|
||||||
|
for (dword h = 0; h < dwTextureHeight; h++)
|
||||||
|
{
|
||||||
|
for (dword w = 0; w < dwFadeDistance; w++)
|
||||||
|
{
|
||||||
|
dword *pColor = reinterpret_cast<dword *>(tmpLr.pBits);
|
||||||
|
dword offset = (h * dwTextureWidth) + (dwFadeStart + w);
|
||||||
|
|
||||||
|
D3DXCOLOR color = D3DXCOLOR(pColor[offset]);
|
||||||
|
color.a = color.a * (1.0f - static_cast<float>(w) / static_cast<float>(dwFadeDistance));
|
||||||
|
pColor[offset] = color;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// dont draw anything > than max width
|
||||||
|
for (dword h = 0; h < dwTextureHeight; h++)
|
||||||
|
{
|
||||||
|
for (dword w = min(dwTextureWidth, dwMaxWidth); w < dwTextureWidth; w++)
|
||||||
|
{
|
||||||
|
dword *pColor = reinterpret_cast<dword *>(tmpLr.pBits);
|
||||||
|
dword offset = (h * dwTextureWidth) + w;
|
||||||
|
|
||||||
|
D3DXCOLOR color = D3DXCOLOR(pColor[offset]);
|
||||||
|
color.a = 0.0;
|
||||||
|
pColor[offset] = color;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// copy and swizzle the linear surface to the swizzled texture
|
||||||
|
XGSwizzleRect(tmpLr.pBits, tmpLr.Pitch, NULL, txtLr.pBits, dwTextureWidth, dwTextureHeight, NULL, 4);
|
||||||
|
|
||||||
|
texture.GetTexture()->UnlockRect(0);
|
||||||
|
pTempSurface->UnlockRect();
|
||||||
|
}
|
||||||
|
|
||||||
|
pTempSurface->Release();
|
||||||
|
}
|
||||||
|
|
||||||
|
int Font::GetRequiredWidth(const string &str, dword height, dword style)
|
||||||
|
{
|
||||||
|
word *wcBuf = StringToWChar(str);
|
||||||
|
dword reqWidth;
|
||||||
|
|
||||||
|
m_pFont->SetTextHeight(height);
|
||||||
|
m_pFont->SetTextStyle(style);
|
||||||
|
m_pFont->GetTextExtent(wcBuf, -1, &reqWidth);
|
||||||
|
|
||||||
|
delete [] wcBuf;
|
||||||
|
|
||||||
|
return reqWidth;
|
||||||
|
}
|
||||||
|
|
||||||
|
int Font::GetRequiredHeight(const string &str, dword height, dword style)
|
||||||
|
{
|
||||||
|
word *wcBuf = StringToWChar(str);
|
||||||
|
dword reqHeight;
|
||||||
|
|
||||||
|
m_pFont->SetTextHeight(height);
|
||||||
|
m_pFont->SetTextStyle(style);
|
||||||
|
m_pFont->GetFontMetrics(&reqHeight, NULL);
|
||||||
|
|
||||||
|
delete [] wcBuf;
|
||||||
|
|
||||||
|
return reqHeight;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
word *Font::StringToWChar(const string &str)
|
||||||
|
{
|
||||||
|
word *retVal = new word[(str.length() + 1) * 2];
|
||||||
|
memset(retVal, 0, (str.length() + 1) * 2 * sizeof(word));
|
||||||
|
|
||||||
|
if (str.length() > 0)
|
||||||
|
mbstowcs(retVal, str.c_str(), str.length());
|
||||||
|
|
||||||
|
return retVal;
|
||||||
|
}
|
|
@ -0,0 +1,46 @@
|
||||||
|
/**
|
||||||
|
* RetroLaunch 2012
|
||||||
|
*
|
||||||
|
* This program 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
|
||||||
|
* Foundation; either version 2 of the License, or (at your option) any later
|
||||||
|
* version. This program 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 this program; if not, write to the Free Software Foundation, Inc.,
|
||||||
|
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. To contact the
|
||||||
|
* authors: Surreal64 CE Team (http://www.emuxtras.net)
|
||||||
|
*/
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
#include "Global.h"
|
||||||
|
#include "Surface.h"
|
||||||
|
|
||||||
|
enum Align
|
||||||
|
{
|
||||||
|
Left,
|
||||||
|
Center,
|
||||||
|
Right
|
||||||
|
};
|
||||||
|
|
||||||
|
class Font
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
Font(void);
|
||||||
|
~Font(void);
|
||||||
|
|
||||||
|
bool Create();
|
||||||
|
|
||||||
|
void Render(const string &str, int x, int y, dword height, dword style = XFONT_NORMAL, D3DXCOLOR color = D3DCOLOR_XRGB(0, 0, 0), int dwMaxWidth = -1, bool fade = false, Align alignment = Left);
|
||||||
|
void RenderToTexture(CSurface &texture, const string &str, dword height, dword style = XFONT_NORMAL, D3DXCOLOR color = D3DCOLOR_XRGB(0, 0, 0), int maxWidth = -1, bool fade = false);
|
||||||
|
|
||||||
|
int GetRequiredWidth(const string &str, dword height, dword style);
|
||||||
|
int GetRequiredHeight(const string &str, dword height, dword style);
|
||||||
|
|
||||||
|
word *StringToWChar(const string &str);
|
||||||
|
private:
|
||||||
|
XFONT *m_pFont;
|
||||||
|
};
|
||||||
|
|
||||||
|
extern Font g_font;
|
|
@ -0,0 +1,41 @@
|
||||||
|
/**
|
||||||
|
* RetroLaunch 2012
|
||||||
|
*
|
||||||
|
* This program 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
|
||||||
|
* Foundation; either version 2 of the License, or (at your option) any later
|
||||||
|
* version. This program 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 this program; if not, write to the Free Software Foundation, Inc.,
|
||||||
|
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. To contact the
|
||||||
|
* authors: Surreal64 CE Team (http://www.emuxtras.net)
|
||||||
|
*/
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <io.h>
|
||||||
|
#include <iostream>
|
||||||
|
#include <fstream>
|
||||||
|
#include <sstream>
|
||||||
|
#include <direct.h>
|
||||||
|
#include <list>
|
||||||
|
#include <vector>
|
||||||
|
#include <algorithm>
|
||||||
|
#include <xtl.h>
|
||||||
|
#include <xgraphics.h>
|
||||||
|
|
||||||
|
using namespace std;
|
||||||
|
|
||||||
|
#define XBUILD "Launcher CE"
|
||||||
|
|
||||||
|
typedef unsigned __int8 byte;
|
||||||
|
typedef unsigned __int16 word;
|
||||||
|
typedef unsigned __int32 dword;
|
||||||
|
typedef unsigned __int64 qword;
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,190 @@
|
||||||
|
// IoSupport.cpp: implementation of the CIoSupport class.
|
||||||
|
//
|
||||||
|
//////////////////////////////////////////////////////////////////////
|
||||||
|
#include "iosupport.h"
|
||||||
|
#include "undocumented.h"
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
|
#define CTLCODE(DeviceType, Function, Method, Access) ( ((DeviceType) << 16) | ((Access) << 14) | ((Function) << 2) | (Method) )
|
||||||
|
#define FSCTL_DISMOUNT_VOLUME CTLCODE( FILE_DEVICE_FILE_SYSTEM, 0x08, METHOD_BUFFERED, FILE_ANY_ACCESS )
|
||||||
|
|
||||||
|
//////////////////////////////////////////////////////////////////////
|
||||||
|
// Construction/Destruction
|
||||||
|
//////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
CIoSupport g_IOSupport;
|
||||||
|
|
||||||
|
CIoSupport::CIoSupport()
|
||||||
|
{
|
||||||
|
m_dwLastTrayState = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
CIoSupport::~CIoSupport()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// szDrive e.g. "D:"
|
||||||
|
// szDevice e.g. "Cdrom0" or "Harddisk0\Partition6"
|
||||||
|
|
||||||
|
HRESULT CIoSupport::Mount(CHAR* szDrive, CHAR* szDevice)
|
||||||
|
{
|
||||||
|
CHAR szSourceDevice[48];
|
||||||
|
CHAR szDestinationDrive[16];
|
||||||
|
|
||||||
|
sprintf(szSourceDevice, "\\Device\\%s", szDevice);
|
||||||
|
sprintf(szDestinationDrive, "\\??\\%s", szDrive);
|
||||||
|
|
||||||
|
STRING DeviceName =
|
||||||
|
{
|
||||||
|
strlen(szSourceDevice),
|
||||||
|
strlen(szSourceDevice) + 1,
|
||||||
|
szSourceDevice
|
||||||
|
};
|
||||||
|
|
||||||
|
STRING LinkName =
|
||||||
|
{
|
||||||
|
strlen(szDestinationDrive),
|
||||||
|
strlen(szDestinationDrive) + 1,
|
||||||
|
szDestinationDrive
|
||||||
|
};
|
||||||
|
|
||||||
|
IoCreateSymbolicLink(&LinkName, &DeviceName);
|
||||||
|
|
||||||
|
return S_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// szDrive e.g. "D:"
|
||||||
|
|
||||||
|
HRESULT CIoSupport::Unmount(CHAR* szDrive)
|
||||||
|
{
|
||||||
|
char szDestinationDrive[16];
|
||||||
|
sprintf(szDestinationDrive, "\\??\\%s", szDrive);
|
||||||
|
|
||||||
|
STRING LinkName =
|
||||||
|
{
|
||||||
|
strlen(szDestinationDrive),
|
||||||
|
strlen(szDestinationDrive) + 1,
|
||||||
|
szDestinationDrive
|
||||||
|
};
|
||||||
|
|
||||||
|
IoDeleteSymbolicLink(&LinkName);
|
||||||
|
|
||||||
|
return S_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
HRESULT CIoSupport::Remount(CHAR* szDrive, CHAR* szDevice)
|
||||||
|
{
|
||||||
|
CHAR szSourceDevice[48];
|
||||||
|
sprintf(szSourceDevice, "\\Device\\%s", szDevice);
|
||||||
|
|
||||||
|
Unmount(szDrive);
|
||||||
|
|
||||||
|
ANSI_STRING filename;
|
||||||
|
OBJECT_ATTRIBUTES attributes;
|
||||||
|
IO_STATUS_BLOCK status;
|
||||||
|
HANDLE hDevice;
|
||||||
|
NTSTATUS error;
|
||||||
|
DWORD dummy;
|
||||||
|
|
||||||
|
RtlInitAnsiString(&filename, szSourceDevice);
|
||||||
|
InitializeObjectAttributes(&attributes, &filename, OBJ_CASE_INSENSITIVE, NULL);
|
||||||
|
|
||||||
|
if (!NT_SUCCESS(error = NtCreateFile(&hDevice, GENERIC_READ |
|
||||||
|
SYNCHRONIZE | FILE_READ_ATTRIBUTES, &attributes, &status, NULL, 0,
|
||||||
|
FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE, FILE_OPEN,
|
||||||
|
FILE_NON_DIRECTORY_FILE | FILE_SYNCHRONOUS_IO_NONALERT)))
|
||||||
|
{
|
||||||
|
return E_FAIL;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!DeviceIoControl(hDevice, FSCTL_DISMOUNT_VOLUME, NULL, 0, NULL, 0, &dummy, NULL))
|
||||||
|
{
|
||||||
|
CloseHandle(hDevice);
|
||||||
|
return E_FAIL;
|
||||||
|
}
|
||||||
|
|
||||||
|
CloseHandle(hDevice);
|
||||||
|
Mount(szDrive, szDevice);
|
||||||
|
|
||||||
|
return S_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
HRESULT CIoSupport::Remap(CHAR* szMapping)
|
||||||
|
{
|
||||||
|
char szMap[32];
|
||||||
|
strcpy(szMap, szMapping );
|
||||||
|
|
||||||
|
char* pComma = strstr(szMap, ",");
|
||||||
|
if (pComma)
|
||||||
|
{
|
||||||
|
*pComma = 0;
|
||||||
|
|
||||||
|
// map device to drive letter
|
||||||
|
Unmount(szMap);
|
||||||
|
Mount(szMap, &pComma[1]);
|
||||||
|
return S_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
return E_FAIL;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
HRESULT CIoSupport::EjectTray()
|
||||||
|
{
|
||||||
|
HalWriteSMBusValue(0x20, 0x0C, FALSE, 0); // eject tray
|
||||||
|
return S_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
HRESULT CIoSupport::CloseTray()
|
||||||
|
{
|
||||||
|
HalWriteSMBusValue(0x20, 0x0C, FALSE, 1); // close tray
|
||||||
|
return S_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
DWORD CIoSupport::GetTrayState()
|
||||||
|
{
|
||||||
|
HalReadSMCTrayState(&m_dwTrayState, &m_dwTrayCount);
|
||||||
|
|
||||||
|
if(m_dwTrayState == TRAY_CLOSED_MEDIA_PRESENT)
|
||||||
|
{
|
||||||
|
if (m_dwLastTrayState != TRAY_CLOSED_MEDIA_PRESENT)
|
||||||
|
{
|
||||||
|
m_dwLastTrayState = m_dwTrayState;
|
||||||
|
return DRIVE_CLOSED_MEDIA_PRESENT;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return DRIVE_READY;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if(m_dwTrayState == TRAY_CLOSED_NO_MEDIA)
|
||||||
|
{
|
||||||
|
m_dwLastTrayState = m_dwTrayState;
|
||||||
|
return DRIVE_CLOSED_NO_MEDIA;
|
||||||
|
}
|
||||||
|
else if(m_dwTrayState == TRAY_OPEN)
|
||||||
|
{
|
||||||
|
m_dwLastTrayState = m_dwTrayState;
|
||||||
|
return DRIVE_OPEN;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
m_dwLastTrayState = m_dwTrayState;
|
||||||
|
}
|
||||||
|
|
||||||
|
return DRIVE_NOT_READY;
|
||||||
|
}
|
||||||
|
|
||||||
|
HRESULT CIoSupport::Shutdown()
|
||||||
|
{
|
||||||
|
HalInitiateShutdown();
|
||||||
|
return S_OK;
|
||||||
|
}
|
|
@ -0,0 +1,49 @@
|
||||||
|
// IoSupport.h: interface for the CIoSupport class.
|
||||||
|
//
|
||||||
|
//////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
#if !defined(AFX_IOSUPPORT_H__F084A488_BD6E_49D5_8CD3_0BE62149DB40__INCLUDED_)
|
||||||
|
#define AFX_IOSUPPORT_H__F084A488_BD6E_49D5_8CD3_0BE62149DB40__INCLUDED_
|
||||||
|
|
||||||
|
#if _MSC_VER > 1000
|
||||||
|
#pragma once
|
||||||
|
#endif // _MSC_VER > 1000
|
||||||
|
#ifdef _XBOX
|
||||||
|
#include <xtl.h>
|
||||||
|
#include "global.h"
|
||||||
|
|
||||||
|
#define TRAY_OPEN 16
|
||||||
|
#define TRAY_CLOSED_NO_MEDIA 64
|
||||||
|
#define TRAY_CLOSED_MEDIA_PRESENT 96
|
||||||
|
|
||||||
|
#define DRIVE_OPEN 0 // Open...
|
||||||
|
#define DRIVE_NOT_READY 1 // Opening.. Closing...
|
||||||
|
#define DRIVE_READY 2
|
||||||
|
#define DRIVE_CLOSED_NO_MEDIA 3 // CLOSED...but no media in drive
|
||||||
|
#define DRIVE_CLOSED_MEDIA_PRESENT 4 // Will be send once when the drive just have closed
|
||||||
|
|
||||||
|
class CIoSupport
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
CIoSupport();
|
||||||
|
virtual ~CIoSupport();
|
||||||
|
|
||||||
|
HRESULT Mount(CHAR* szDrive, CHAR* szDevice);
|
||||||
|
HRESULT Unmount(CHAR* szDrive);
|
||||||
|
|
||||||
|
HRESULT Remount(CHAR* szDrive, CHAR* szDevice);
|
||||||
|
HRESULT Remap(CHAR* szMapping);
|
||||||
|
|
||||||
|
DWORD GetTrayState();
|
||||||
|
HRESULT EjectTray();
|
||||||
|
HRESULT CloseTray();
|
||||||
|
HRESULT Shutdown();
|
||||||
|
private:
|
||||||
|
DWORD m_dwTrayState;
|
||||||
|
DWORD m_dwTrayCount;
|
||||||
|
DWORD m_dwLastTrayState;
|
||||||
|
};
|
||||||
|
|
||||||
|
extern CIoSupport g_IOSupport;
|
||||||
|
#endif
|
||||||
|
#endif // !defined(AFX_IOSUPPORT_H__F084A488_BD6E_49D5_8CD3_0BE62149DB40__INCLUDED_)
|
|
@ -0,0 +1,226 @@
|
||||||
|
/**
|
||||||
|
* RetroLaunch 2012
|
||||||
|
*
|
||||||
|
* This program 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
|
||||||
|
* Foundation; either version 2 of the License, or (at your option) any later
|
||||||
|
* version. This program 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 this program; if not, write to the Free Software Foundation, Inc.,
|
||||||
|
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. To contact the
|
||||||
|
* authors: Surreal64 CE Team (http://www.emuxtras.net)
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "MenuMain.h"
|
||||||
|
#include "Font.h"
|
||||||
|
#include "RomList.h"
|
||||||
|
|
||||||
|
#include "../../console/retroarch_console.h"
|
||||||
|
#include "../../general.h"
|
||||||
|
|
||||||
|
CMenuMain g_menuMain;
|
||||||
|
|
||||||
|
CMenuMain::CMenuMain()
|
||||||
|
{
|
||||||
|
// we think that the rom list is unloaded until we know otherwise
|
||||||
|
m_bRomListLoadedState = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
CMenuMain::~CMenuMain()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
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;
|
||||||
|
|
||||||
|
m_menuMainBG_x = 0;
|
||||||
|
m_menuMainBG_y = 0;
|
||||||
|
//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
|
||||||
|
// 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
|
||||||
|
m_menuMainRomSelectPanel.Create("D:\\Media\\menuMainRomSelectPanel.png");
|
||||||
|
m_menuMainRomSelectPanel_x = m_menuMainRomListPos_x - 5;
|
||||||
|
m_menuMainRomSelectPanel_y = m_menuMainRomListPos_y - 2;
|
||||||
|
m_menuMainRomSelectPanel_w = 440;
|
||||||
|
m_menuMainRomSelectPanel_h = 20;
|
||||||
|
|
||||||
|
m_romListSelectedRom = 0;
|
||||||
|
|
||||||
|
//The first element in the romlist to render
|
||||||
|
m_romListBeginRender = 0;
|
||||||
|
|
||||||
|
//The last element in the romlist to render
|
||||||
|
m_romListEndRender = 18;
|
||||||
|
|
||||||
|
//The offset in the romlist
|
||||||
|
m_romListOffset = 0;
|
||||||
|
|
||||||
|
if(m_romListEndRender > g_romList.GetRomListSize() - 1)
|
||||||
|
m_romListEndRender = g_romList.GetRomListSize() - 1;
|
||||||
|
|
||||||
|
//Generate the rom list textures only once
|
||||||
|
vector<Rom *>::iterator i;
|
||||||
|
dword y = 0;
|
||||||
|
for (i = g_romList.m_romList.begin(); i != g_romList.m_romList.end(); i++)
|
||||||
|
{
|
||||||
|
Rom *rom = *i;
|
||||||
|
g_font.RenderToTexture(rom->GetTexture(), rom->GetFileName(), 18, XFONT_BOLD, 0xff808080, -1, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void CMenuMain::Render()
|
||||||
|
{
|
||||||
|
//Render background image
|
||||||
|
m_menuMainBG.Render(m_menuMainBG_x, m_menuMainBG_y);
|
||||||
|
|
||||||
|
//Display some text
|
||||||
|
//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?)
|
||||||
|
m_menuMainRomSelectPanel.Render(m_menuMainRomSelectPanel_x, m_menuMainRomSelectPanel_y, m_menuMainRomSelectPanel_w, m_menuMainRomSelectPanel_h);
|
||||||
|
|
||||||
|
dword dwSpacing = 0;
|
||||||
|
|
||||||
|
for (int i = m_romListBeginRender; i <= m_romListEndRender; i++)
|
||||||
|
{
|
||||||
|
g_romList.GetRomAt(i + m_romListOffset)->GetTexture().Render(m_menuMainRomListPos_x, m_menuMainRomListPos_y + dwSpacing);
|
||||||
|
dwSpacing += m_menuMainRomListSpacing;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static uint16_t old_input_state = 0;
|
||||||
|
|
||||||
|
void CMenuMain::ProcessInput()
|
||||||
|
{
|
||||||
|
uint16_t input_state = 0;
|
||||||
|
input_xinput.poll(NULL);
|
||||||
|
|
||||||
|
static const struct retro_keybind *binds[MAX_PLAYERS] = {
|
||||||
|
g_settings.input.binds[0],
|
||||||
|
g_settings.input.binds[1],
|
||||||
|
g_settings.input.binds[2],
|
||||||
|
g_settings.input.binds[3],
|
||||||
|
g_settings.input.binds[4],
|
||||||
|
g_settings.input.binds[5],
|
||||||
|
g_settings.input.binds[6],
|
||||||
|
g_settings.input.binds[7],
|
||||||
|
};
|
||||||
|
|
||||||
|
for (unsigned i = 0; i < RARCH_FIRST_META_KEY; i++)
|
||||||
|
{
|
||||||
|
input_state |= input_xinput.input_state(NULL, binds, false,
|
||||||
|
RETRO_DEVICE_JOYPAD, 0, i) ? (1 << i) : 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
uint16_t trigger_state = input_state & ~old_input_state;
|
||||||
|
|
||||||
|
if(trigger_state & (1 << RETRO_DEVICE_ID_JOYPAD_DOWN))
|
||||||
|
{
|
||||||
|
if(m_romListSelectedRom < g_romList.GetRomListSize())
|
||||||
|
{
|
||||||
|
if(m_menuMainRomSelectPanel_y < (m_menuMainRomListPos_y + (m_menuMainRomListSpacing * m_romListEndRender)))
|
||||||
|
{
|
||||||
|
m_menuMainRomSelectPanel_y += m_menuMainRomListSpacing;
|
||||||
|
m_romListSelectedRom++;
|
||||||
|
RARCH_LOG("SELECTED ROM: %d.\n", m_romListSelectedRom);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(m_menuMainRomSelectPanel_y > (m_menuMainRomListPos_y + (m_menuMainRomListSpacing * (m_romListEndRender))))
|
||||||
|
{
|
||||||
|
m_menuMainRomSelectPanel_y -= m_menuMainRomListSpacing;
|
||||||
|
m_romListSelectedRom++;
|
||||||
|
if(m_romListSelectedRom > g_romList.GetRomListSize() - 1)
|
||||||
|
m_romListSelectedRom = g_romList.GetRomListSize() - 1;
|
||||||
|
|
||||||
|
RARCH_LOG("SELECTED ROM AFTER CORRECTION: %d.\n", m_romListSelectedRom);
|
||||||
|
|
||||||
|
if(m_romListSelectedRom < g_romList.GetRomListSize() - 1 && m_romListOffset < g_romList.GetRomListSize() - 1 - m_romListEndRender - 1)
|
||||||
|
{
|
||||||
|
m_romListOffset++;
|
||||||
|
RARCH_LOG("OFFSET: %d.\n", m_romListOffset);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(trigger_state & (1 << RETRO_DEVICE_ID_JOYPAD_UP))
|
||||||
|
{
|
||||||
|
if(m_romListSelectedRom > -1)
|
||||||
|
{
|
||||||
|
if(m_menuMainRomSelectPanel_y > (m_menuMainRomListPos_y - m_menuMainRomListSpacing))
|
||||||
|
{
|
||||||
|
m_menuMainRomSelectPanel_y -= m_menuMainRomListSpacing;
|
||||||
|
m_romListSelectedRom--;
|
||||||
|
RARCH_LOG("SELECTED ROM: %d.\n", m_romListSelectedRom);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(m_menuMainRomSelectPanel_y < (m_menuMainRomListPos_y - m_menuMainRomListSpacing))
|
||||||
|
{
|
||||||
|
m_menuMainRomSelectPanel_y += m_menuMainRomListSpacing;
|
||||||
|
m_romListSelectedRom--;
|
||||||
|
if(m_romListSelectedRom < 0)
|
||||||
|
m_romListSelectedRom = 0;
|
||||||
|
|
||||||
|
RARCH_LOG("SELECTED ROM AFTER CORRECTION: %d.\n", m_romListSelectedRom);
|
||||||
|
|
||||||
|
if(m_romListSelectedRom > 0 && m_romListOffset > 0)
|
||||||
|
{
|
||||||
|
m_romListOffset--;
|
||||||
|
RARCH_LOG("OFFSET: %d.\n", m_romListOffset);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Press A to launch, selected rom filename is saved into T:\\tmp.retro
|
||||||
|
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());
|
||||||
|
|
||||||
|
if (trigger_state & (1 << RETRO_DEVICE_ID_JOYPAD_R3))
|
||||||
|
{
|
||||||
|
LD_LAUNCH_DASHBOARD LaunchData = { XLD_LAUNCH_DASHBOARD_MAIN_MENU };
|
||||||
|
XLaunchNewImage( NULL, (LAUNCH_DATA*)&LaunchData );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -0,0 +1,82 @@
|
||||||
|
/**
|
||||||
|
* RetroLaunch 2012
|
||||||
|
*
|
||||||
|
* This program 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
|
||||||
|
* Foundation; either version 2 of the License, or (at your option) any later
|
||||||
|
* version. This program 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 this program; if not, write to the Free Software Foundation, Inc.,
|
||||||
|
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. To contact the
|
||||||
|
* authors: Surreal64 CE Team (http://www.emuxtras.net)
|
||||||
|
*/
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
#include "Global.h"
|
||||||
|
#include "Surface.h"
|
||||||
|
|
||||||
|
class CMenuMain
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
CMenuMain();
|
||||||
|
~CMenuMain();
|
||||||
|
|
||||||
|
bool Create();
|
||||||
|
|
||||||
|
void Render();
|
||||||
|
|
||||||
|
void ProcessInput();
|
||||||
|
|
||||||
|
private:
|
||||||
|
/*
|
||||||
|
Texture,
|
||||||
|
_x = xpos,
|
||||||
|
_y = ypos,
|
||||||
|
_w = width,
|
||||||
|
_h = height,
|
||||||
|
_c = color,
|
||||||
|
*/
|
||||||
|
|
||||||
|
// Background image with coords
|
||||||
|
CSurface m_menuMainBG;
|
||||||
|
int m_menuMainBG_x;
|
||||||
|
int m_menuMainBG_y;
|
||||||
|
dword m_menuMainBG_w;
|
||||||
|
dword m_menuMainBG_h;
|
||||||
|
|
||||||
|
// Rom selector panel with coords
|
||||||
|
CSurface m_menuMainRomSelectPanel;
|
||||||
|
int m_menuMainRomSelectPanel_x;
|
||||||
|
int m_menuMainRomSelectPanel_y;
|
||||||
|
dword m_menuMainRomSelectPanel_w;
|
||||||
|
dword m_menuMainRomSelectPanel_h;
|
||||||
|
|
||||||
|
// Title coords with color
|
||||||
|
int m_menuMainTitle_x;
|
||||||
|
int m_menuMainTitle_y;
|
||||||
|
dword m_menuMainTitle_c;
|
||||||
|
|
||||||
|
// Rom list coords
|
||||||
|
int m_menuMainRomListPos_x;
|
||||||
|
int m_menuMainRomListPos_y;
|
||||||
|
int m_menuMainRomListSpacing;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The current loaded state the rom list is in
|
||||||
|
*/
|
||||||
|
bool m_bRomListLoadedState;
|
||||||
|
|
||||||
|
int m_romListBeginRender;
|
||||||
|
int m_romListEndRender;
|
||||||
|
int m_romListSelectedRom;
|
||||||
|
int m_romListOffset;
|
||||||
|
|
||||||
|
// Backbuffer width, height
|
||||||
|
int width;
|
||||||
|
int height;
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
extern CMenuMain g_menuMain;
|
|
@ -0,0 +1,77 @@
|
||||||
|
/**
|
||||||
|
* RetroLaunch 2012
|
||||||
|
*
|
||||||
|
* This program 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
|
||||||
|
* Foundation; either version 2 of the License, or (at your option) any later
|
||||||
|
* version. This program 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 this program; if not, write to the Free Software Foundation, Inc.,
|
||||||
|
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. To contact the
|
||||||
|
* authors: Surreal64 CE Team (http://www.emuxtras.net)
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "MenuManager.h"
|
||||||
|
#include "MenuMain.h"
|
||||||
|
|
||||||
|
#include "../../general.h"
|
||||||
|
|
||||||
|
|
||||||
|
CMenuManager g_menuManager;
|
||||||
|
|
||||||
|
CMenuManager::CMenuManager()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
CMenuManager::~CMenuManager()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
bool CMenuManager::Create()
|
||||||
|
{
|
||||||
|
//Create the MenuManager, set to Main Menu
|
||||||
|
RARCH_LOG("Create MenuManager, set state to MENU_MAIN.\n");
|
||||||
|
SetMenuState(MENU_MAIN);
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool CMenuManager::SetMenuState(int nMenuID)
|
||||||
|
{
|
||||||
|
m_pMenuID = nMenuID;
|
||||||
|
|
||||||
|
switch (m_pMenuID)
|
||||||
|
{
|
||||||
|
case MENU_MAIN:
|
||||||
|
//Create the Main Menu
|
||||||
|
g_menuMain.Create();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CMenuManager::Update()
|
||||||
|
{
|
||||||
|
ProcessInput();
|
||||||
|
|
||||||
|
switch (m_pMenuID)
|
||||||
|
{
|
||||||
|
case MENU_MAIN:
|
||||||
|
g_menuMain.ProcessInput();
|
||||||
|
g_menuMain.Render();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void CMenuManager::ProcessInput()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
int CMenuManager::GetMenuState()
|
||||||
|
{
|
||||||
|
return m_pMenuID;
|
||||||
|
}
|
||||||
|
|
|
@ -0,0 +1,49 @@
|
||||||
|
/**
|
||||||
|
* RetroLaunch 2012
|
||||||
|
*
|
||||||
|
* This program 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
|
||||||
|
* Foundation; either version 2 of the License, or (at your option) any later
|
||||||
|
* version. This program 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 this program; if not, write to the Free Software Foundation, Inc.,
|
||||||
|
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. To contact the
|
||||||
|
* authors: Surreal64 CE Team (http://www.emuxtras.net)
|
||||||
|
*/
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "Global.h"
|
||||||
|
|
||||||
|
enum eMenuState
|
||||||
|
{
|
||||||
|
MENU_MAIN = 0,
|
||||||
|
MENU_SETTINGS_SELECT,
|
||||||
|
MENU_SETTINGS_EMU,
|
||||||
|
MENU_SETTINGS_AUDIO,
|
||||||
|
MENU_SETTINGS_SKIN,
|
||||||
|
MENU_LAUNCHER
|
||||||
|
};
|
||||||
|
|
||||||
|
class CMenuManager
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
CMenuManager();
|
||||||
|
~CMenuManager();
|
||||||
|
|
||||||
|
bool Create();
|
||||||
|
bool SetMenuState(int nMenuID);
|
||||||
|
int GetMenuState();
|
||||||
|
bool Destroy();
|
||||||
|
void Update();
|
||||||
|
void ProcessInput();
|
||||||
|
|
||||||
|
|
||||||
|
private:
|
||||||
|
int m_pMenuID;
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
extern CMenuManager g_menuManager;
|
|
@ -0,0 +1,47 @@
|
||||||
|
/**
|
||||||
|
* Surreal 64 Launcher (C) 2003
|
||||||
|
*
|
||||||
|
* This program 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
|
||||||
|
* Foundation; either version 2 of the License, or (at your option) any later
|
||||||
|
* version. This program 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 this program; if not, write to the Free Software Foundation, Inc.,
|
||||||
|
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. To contact the
|
||||||
|
* authors: email: buttza@hotmail.com, lantus@lantus-x.com
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "Rom.h"
|
||||||
|
|
||||||
|
Rom::Rom()
|
||||||
|
{
|
||||||
|
m_bLoaded = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
Rom::~Rom(void)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
bool Rom::Load(const char *szFilename)
|
||||||
|
{
|
||||||
|
if (m_bLoaded)
|
||||||
|
return true;
|
||||||
|
|
||||||
|
m_szFilename = szFilename;
|
||||||
|
|
||||||
|
m_bLoaded = true;
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
string Rom::GetFileName()
|
||||||
|
{
|
||||||
|
return m_szFilename;
|
||||||
|
}
|
||||||
|
|
||||||
|
CSurface &Rom::GetTexture()
|
||||||
|
{
|
||||||
|
return m_texture;
|
||||||
|
}
|
|
@ -0,0 +1,35 @@
|
||||||
|
/**
|
||||||
|
* Surreal 64 Launcher (C) 2003
|
||||||
|
*
|
||||||
|
* This program 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
|
||||||
|
* Foundation; either version 2 of the License, or (at your option) any later
|
||||||
|
* version. This program 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 this program; if not, write to the Free Software Foundation, Inc.,
|
||||||
|
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. To contact the
|
||||||
|
* authors: email: buttza@hotmail.com, lantus@lantus-x.com
|
||||||
|
*/
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "Global.h"
|
||||||
|
#include "Surface.h"
|
||||||
|
|
||||||
|
class Rom
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
Rom();
|
||||||
|
~Rom();
|
||||||
|
|
||||||
|
bool Load(const char *szFilename);
|
||||||
|
|
||||||
|
string GetFileName();
|
||||||
|
CSurface &GetTexture();
|
||||||
|
private:
|
||||||
|
string m_szFilename;
|
||||||
|
bool m_bLoaded;
|
||||||
|
CSurface m_texture;
|
||||||
|
};
|
|
@ -0,0 +1,185 @@
|
||||||
|
/**
|
||||||
|
* RetroLaunch 2012
|
||||||
|
*
|
||||||
|
* This program 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
|
||||||
|
* Foundation; either version 2 of the License, or (at your option) any later
|
||||||
|
* version. This program 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 this program; if not, write to the Free Software Foundation, Inc.,
|
||||||
|
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. To contact the
|
||||||
|
* authors: Surreal64 CE Team (http://www.emuxtras.net)
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "RomList.h"
|
||||||
|
|
||||||
|
RomList g_romList;
|
||||||
|
|
||||||
|
bool RLessThan(Rom *elem1, Rom *elem2)
|
||||||
|
{
|
||||||
|
return (elem1->GetFileName() < elem2->GetFileName());
|
||||||
|
}
|
||||||
|
|
||||||
|
RomList::RomList(void)
|
||||||
|
{
|
||||||
|
m_iBaseIndex = 0;
|
||||||
|
m_bLoaded = false;
|
||||||
|
m_szRomPath = "D:\\";
|
||||||
|
}
|
||||||
|
|
||||||
|
RomList::~RomList(void)
|
||||||
|
{
|
||||||
|
Destroy();
|
||||||
|
}
|
||||||
|
|
||||||
|
void RomList::Refresh()
|
||||||
|
{
|
||||||
|
Destroy();
|
||||||
|
}
|
||||||
|
|
||||||
|
bool RomList::IsLoaded()
|
||||||
|
{
|
||||||
|
return m_bLoaded;
|
||||||
|
}
|
||||||
|
|
||||||
|
void RomList::AddRomToList(Rom *rom, int mode)
|
||||||
|
{
|
||||||
|
vector<Rom *> *pList;
|
||||||
|
|
||||||
|
pList = &m_romList;
|
||||||
|
|
||||||
|
// look to see if the rom is already in the list, we dont want duplicates
|
||||||
|
for (int i = 0; i < static_cast<int>(pList->size()); i++)
|
||||||
|
{
|
||||||
|
if (rom == (*pList)[i])
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
pList->push_back(rom);
|
||||||
|
sort(pList->begin(), pList->end(), RLessThan);
|
||||||
|
}
|
||||||
|
|
||||||
|
void RomList::RemoveRomFromList(Rom *rom, int mode)
|
||||||
|
{
|
||||||
|
vector<Rom *> *pList;
|
||||||
|
|
||||||
|
pList = &m_romList;
|
||||||
|
|
||||||
|
vector<Rom *>::iterator i;
|
||||||
|
|
||||||
|
// look to see if the rom is already in the list, we dont want duplicates
|
||||||
|
for (i = pList->begin(); i != pList->end(); i++)
|
||||||
|
{
|
||||||
|
if (rom == *i)
|
||||||
|
{
|
||||||
|
pList->erase(i);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
int RomList::GetBaseIndex()
|
||||||
|
{
|
||||||
|
if (m_iBaseIndex > GetRomListSize() - 1)
|
||||||
|
m_iBaseIndex = GetRomListSize() - 1;
|
||||||
|
if (m_iBaseIndex < 0)
|
||||||
|
m_iBaseIndex = 0;
|
||||||
|
|
||||||
|
return m_iBaseIndex;
|
||||||
|
}
|
||||||
|
|
||||||
|
void RomList::SetBaseIndex(int index)
|
||||||
|
{
|
||||||
|
if (index > GetRomListSize() - 1)
|
||||||
|
index = GetRomListSize() - 1;
|
||||||
|
if (index < 0)
|
||||||
|
index = 0;
|
||||||
|
|
||||||
|
m_iBaseIndex = index;
|
||||||
|
}
|
||||||
|
|
||||||
|
int RomList::GetRomListSize()
|
||||||
|
{
|
||||||
|
return m_romList.size();
|
||||||
|
}
|
||||||
|
|
||||||
|
Rom *RomList::GetRomAt(int index)
|
||||||
|
{
|
||||||
|
return m_romList[index];
|
||||||
|
}
|
||||||
|
|
||||||
|
void RomList::CleanUpTextures()
|
||||||
|
{
|
||||||
|
if (!IsLoaded())
|
||||||
|
return;
|
||||||
|
|
||||||
|
// keep the 25 textures above and below the base index
|
||||||
|
for (int i = 0; i < m_iBaseIndex - 25; i++)
|
||||||
|
m_romList[i]->GetTexture().Destroy();
|
||||||
|
|
||||||
|
for (int i = m_iBaseIndex + 25; i < GetRomListSize(); i++)
|
||||||
|
m_romList[i]->GetTexture().Destroy();
|
||||||
|
}
|
||||||
|
|
||||||
|
void RomList::DestroyAllTextures()
|
||||||
|
{
|
||||||
|
vector<Rom *>::iterator i;
|
||||||
|
|
||||||
|
for (i = m_romList.begin(); i != m_romList.end(); i++)
|
||||||
|
{
|
||||||
|
Rom *rom = *i;
|
||||||
|
rom->GetTexture().Destroy();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void RomList::Build()
|
||||||
|
{
|
||||||
|
WIN32_FIND_DATA fd;
|
||||||
|
|
||||||
|
HANDLE hFF = FindFirstFile((m_szRomPath + "*.*").c_str(), &fd);
|
||||||
|
|
||||||
|
do
|
||||||
|
{
|
||||||
|
char ext[_MAX_EXT];
|
||||||
|
|
||||||
|
// get the filename extension
|
||||||
|
_splitpath((m_szRomPath + fd.cFileName).c_str(),
|
||||||
|
NULL, NULL, NULL, ext);
|
||||||
|
|
||||||
|
if (
|
||||||
|
stricmp(ext, ".bin") == 0
|
||||||
|
|| stricmp(ext, ".cue") == 0
|
||||||
|
|| stricmp(ext, ".iso") == 0
|
||||||
|
|| stricmp(ext, ".mdf") == 0
|
||||||
|
|| stricmp(ext, ".gba") == 0
|
||||||
|
)
|
||||||
|
{
|
||||||
|
Rom *rom = new Rom();
|
||||||
|
bool bSuccess = rom->Load((m_szRomPath + fd.cFileName).c_str());
|
||||||
|
|
||||||
|
if (bSuccess)
|
||||||
|
m_romList.push_back(rom);
|
||||||
|
else
|
||||||
|
delete rom;
|
||||||
|
}
|
||||||
|
} while (FindNextFile(hFF, &fd));
|
||||||
|
|
||||||
|
sort(m_romList.begin(), m_romList.end(), RLessThan);
|
||||||
|
|
||||||
|
m_bLoaded = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
void RomList::Destroy()
|
||||||
|
{
|
||||||
|
m_bLoaded = false;
|
||||||
|
m_iBaseIndex = 0;
|
||||||
|
|
||||||
|
vector<Rom *>::iterator i;
|
||||||
|
|
||||||
|
for (i = m_romList.begin(); i != m_romList.end(); i++)
|
||||||
|
delete *i;
|
||||||
|
|
||||||
|
m_romList.clear();
|
||||||
|
}
|
|
@ -0,0 +1,57 @@
|
||||||
|
/**
|
||||||
|
* RetroLaunch 2012
|
||||||
|
*
|
||||||
|
* This program 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
|
||||||
|
* Foundation; either version 2 of the License, or (at your option) any later
|
||||||
|
* version. This program 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 this program; if not, write to the Free Software Foundation, Inc.,
|
||||||
|
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. To contact the
|
||||||
|
* authors: Surreal64 CE Team (http://www.emuxtras.net)
|
||||||
|
*/
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "Global.h"
|
||||||
|
#include "Rom.h"
|
||||||
|
|
||||||
|
class RomList
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
RomList(void);
|
||||||
|
~RomList(void);
|
||||||
|
|
||||||
|
void Refresh();
|
||||||
|
void Build();
|
||||||
|
|
||||||
|
bool IsLoaded();
|
||||||
|
|
||||||
|
void AddRomToList(Rom *rom, int mode);
|
||||||
|
void RemoveRomFromList(Rom *rom, int mode);
|
||||||
|
|
||||||
|
int GetBaseIndex();
|
||||||
|
void SetBaseIndex(int index);
|
||||||
|
|
||||||
|
int GetRomListSize();
|
||||||
|
|
||||||
|
Rom *GetRomAt(int index);
|
||||||
|
|
||||||
|
void CleanUpTextures();
|
||||||
|
void DestroyAllTextures();
|
||||||
|
|
||||||
|
int m_iBaseIndex;
|
||||||
|
|
||||||
|
vector<Rom *> m_romList;
|
||||||
|
|
||||||
|
private:
|
||||||
|
void Destroy();
|
||||||
|
|
||||||
|
private:
|
||||||
|
bool m_bLoaded;
|
||||||
|
string m_szRomPath;
|
||||||
|
};
|
||||||
|
|
||||||
|
extern RomList g_romList;
|
|
@ -0,0 +1,242 @@
|
||||||
|
/**
|
||||||
|
* Surreal 64 Launcher (C) 2003
|
||||||
|
*
|
||||||
|
* This program 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
|
||||||
|
* Foundation; either version 2 of the License, or (at your option) any later
|
||||||
|
* version. This program 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 this program; if not, write to the Free Software Foundation, Inc.,
|
||||||
|
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. To contact the
|
||||||
|
* authors: email: buttza@hotmail.com, lantus@lantus-x.com
|
||||||
|
*
|
||||||
|
* Additional code and cleanups: Surreal64 CE Team (http://www.emuxtras.net)
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "Surface.h"
|
||||||
|
|
||||||
|
#include "../../../general.h"
|
||||||
|
#include "../../xdk_d3d8.h"
|
||||||
|
|
||||||
|
CSurface::CSurface()
|
||||||
|
{
|
||||||
|
m_pTexture = NULL;
|
||||||
|
m_pVertexBuffer = NULL;
|
||||||
|
m_byOpacity = 255;
|
||||||
|
m_byR = 255;
|
||||||
|
m_byG = 255;
|
||||||
|
m_byB = 255;
|
||||||
|
m_bLoaded = false;
|
||||||
|
m_x = 0;
|
||||||
|
m_y = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
CSurface::~CSurface()
|
||||||
|
{
|
||||||
|
Destroy();
|
||||||
|
}
|
||||||
|
|
||||||
|
bool CSurface::Create(const char *szFilename)
|
||||||
|
{
|
||||||
|
xdk_d3d_video_t *d3d = (xdk_d3d_video_t*)driver.video_data;
|
||||||
|
if (m_bLoaded)
|
||||||
|
Destroy();
|
||||||
|
|
||||||
|
HRESULT g_hResult = D3DXCreateTextureFromFileExA(d3d->d3d_render_device, // d3d device
|
||||||
|
szFilename, // filename
|
||||||
|
D3DX_DEFAULT, D3DX_DEFAULT, // width/height
|
||||||
|
D3DX_DEFAULT, // mipmaps
|
||||||
|
0, // usage
|
||||||
|
D3DFMT_A8R8G8B8, // format
|
||||||
|
D3DPOOL_MANAGED, // memory class
|
||||||
|
D3DX_DEFAULT, // texture filter
|
||||||
|
D3DX_DEFAULT, // mipmapping
|
||||||
|
0, // colorkey
|
||||||
|
&m_imageInfo, // image info
|
||||||
|
NULL, // pallete
|
||||||
|
&m_pTexture); // texture
|
||||||
|
|
||||||
|
if (FAILED(g_hResult))
|
||||||
|
{
|
||||||
|
RARCH_ERR("Error occurred during D3DXCreateTextureFromFileExA().\n");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// create a vertex buffer for the quad that will display the texture
|
||||||
|
g_hResult = d3d->d3d_render_device->CreateVertexBuffer(4 * sizeof(DrawVerticeFormats),
|
||||||
|
D3DUSAGE_WRITEONLY,
|
||||||
|
D3DFVF_CUSTOMVERTEX,
|
||||||
|
D3DPOOL_MANAGED, &m_pVertexBuffer);
|
||||||
|
if (FAILED(g_hResult))
|
||||||
|
{
|
||||||
|
RARCH_ERR("Error occurred during CreateVertexBuffer().\n");
|
||||||
|
m_pTexture->Release();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
m_bLoaded = true;
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool CSurface::Create(dword width, dword height)
|
||||||
|
{
|
||||||
|
xdk_d3d_video_t *d3d = (xdk_d3d_video_t*)driver.video_data;
|
||||||
|
if (m_bLoaded)
|
||||||
|
Destroy();
|
||||||
|
|
||||||
|
HRESULT g_hResult = d3d->d3d_render_device->CreateTexture(width, height, 1, 0,
|
||||||
|
D3DFMT_A8R8G8B8, D3DPOOL_MANAGED,
|
||||||
|
&m_pTexture);
|
||||||
|
|
||||||
|
if (FAILED(g_hResult))
|
||||||
|
{
|
||||||
|
RARCH_ERR("Error occurred during CreateTexture().\n");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
m_imageInfo.Width = width;
|
||||||
|
m_imageInfo.Height = height;
|
||||||
|
m_imageInfo.Format = D3DFMT_A8R8G8B8;
|
||||||
|
|
||||||
|
// create a vertex buffer for the quad that will display the texture
|
||||||
|
g_hResult = d3d->d3d_render_device->CreateVertexBuffer(4 * sizeof(DrawVerticeFormats),
|
||||||
|
D3DUSAGE_WRITEONLY,
|
||||||
|
D3DFVF_CUSTOMVERTEX,
|
||||||
|
D3DPOOL_MANAGED, &m_pVertexBuffer);
|
||||||
|
if (FAILED(g_hResult))
|
||||||
|
{
|
||||||
|
RARCH_ERR("Error occurred during CreateVertexBuffer().\n");
|
||||||
|
m_pTexture->Release();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
m_bLoaded = true;
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CSurface::Destroy()
|
||||||
|
{
|
||||||
|
// free the vertex buffer
|
||||||
|
if (m_pVertexBuffer)
|
||||||
|
{
|
||||||
|
m_pVertexBuffer->Release();
|
||||||
|
m_pVertexBuffer = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
// free the texture
|
||||||
|
if (m_pTexture)
|
||||||
|
{
|
||||||
|
m_pTexture->Release();
|
||||||
|
m_pTexture = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
m_bLoaded = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool CSurface::IsLoaded()
|
||||||
|
{
|
||||||
|
return m_bLoaded;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool CSurface::Render()
|
||||||
|
{
|
||||||
|
return Render(m_x, m_y);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool CSurface::Render(int x, int y)
|
||||||
|
{
|
||||||
|
return Render(x, y, m_imageInfo.Width, m_imageInfo.Height);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool CSurface::Render(int x, int y, dword w, dword h)
|
||||||
|
{
|
||||||
|
xdk_d3d_video_t *d3d = (xdk_d3d_video_t*)driver.video_data;
|
||||||
|
if (m_pTexture == NULL || m_pVertexBuffer == NULL || m_bLoaded == false)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
float fX = static_cast<float>(x);
|
||||||
|
float fY = static_cast<float>(y);
|
||||||
|
|
||||||
|
// create the new vertices
|
||||||
|
/*CustomVertex*/DrawVerticeFormats newVerts[] =
|
||||||
|
{
|
||||||
|
// x, y, z, color, u ,v
|
||||||
|
{fX, fY, 0.0f, /*D3DCOLOR_ARGB(m_byOpacity, m_byR, m_byG, m_byB),*/ 0, 0, 0},
|
||||||
|
{fX + w, fY, 0.0f, /*D3DCOLOR_ARGB(m_byOpacity, m_byR, m_byG, m_byB),*/ 0, 1, 0},
|
||||||
|
{fX + w, fY + h, 0.0f, /*D3DCOLOR_ARGB(m_byOpacity, m_byR, m_byG, m_byB),*/ 0, 1, 1},
|
||||||
|
{fX, fY + h, 0.0f, /*D3DCOLOR_ARGB(m_byOpacity, m_byR, m_byG, m_byB),*/ 0, 0, 1}
|
||||||
|
};
|
||||||
|
|
||||||
|
// load the existing vertices
|
||||||
|
/*CustomVertex*/DrawVerticeFormats *pCurVerts;
|
||||||
|
|
||||||
|
HRESULT g_hResult = m_pVertexBuffer->Lock(0, 0, (byte **)&pCurVerts, 0);
|
||||||
|
|
||||||
|
if (FAILED(g_hResult))
|
||||||
|
{
|
||||||
|
RARCH_ERR("Error occurred during m_pVertexBuffer->Lock().\n");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
// copy the new verts over the old verts
|
||||||
|
memcpy(pCurVerts, newVerts, 4 * sizeof(DrawVerticeFormats));
|
||||||
|
|
||||||
|
m_pVertexBuffer->Unlock();
|
||||||
|
|
||||||
|
|
||||||
|
d3d->d3d_render_device->SetRenderState(D3DRS_ALPHABLENDENABLE, TRUE);
|
||||||
|
d3d->d3d_render_device->SetRenderState(D3DRS_SRCBLEND, D3DBLEND_SRCALPHA);
|
||||||
|
d3d->d3d_render_device->SetRenderState(D3DRS_DESTBLEND, D3DBLEND_INVSRCALPHA);
|
||||||
|
|
||||||
|
// also blend the texture with the set alpha value
|
||||||
|
d3d->d3d_render_device->SetTextureStageState(0, D3DTSS_ALPHAOP, D3DTOP_MODULATE);
|
||||||
|
d3d->d3d_render_device->SetTextureStageState(0, D3DTSS_ALPHAARG1, D3DTA_DIFFUSE);
|
||||||
|
d3d->d3d_render_device->SetTextureStageState(0, D3DTSS_ALPHAARG2, D3DTA_TEXTURE);
|
||||||
|
|
||||||
|
// draw the quad
|
||||||
|
d3d->d3d_render_device->SetTexture(0, m_pTexture);
|
||||||
|
d3d->d3d_render_device->SetStreamSource(0, m_pVertexBuffer, sizeof(DrawVerticeFormats));
|
||||||
|
d3d->d3d_render_device->SetVertexShader(D3DFVF_CUSTOMVERTEX);
|
||||||
|
d3d->d3d_render_device->DrawPrimitive(D3DPT_QUADLIST, 0, 1);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CSurface::SetOpacity(byte opacity)
|
||||||
|
{
|
||||||
|
m_byOpacity = opacity;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CSurface::MoveTo(int x, int y)
|
||||||
|
{
|
||||||
|
m_x = x;
|
||||||
|
m_y = y;
|
||||||
|
}
|
||||||
|
|
||||||
|
dword CSurface::GetWidth()
|
||||||
|
{
|
||||||
|
if (m_pTexture == NULL || m_pVertexBuffer == NULL)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
return m_imageInfo.Width;
|
||||||
|
}
|
||||||
|
|
||||||
|
dword CSurface::GetHeight()
|
||||||
|
{
|
||||||
|
if (m_pTexture == NULL || m_pVertexBuffer == NULL)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
return m_imageInfo.Height;
|
||||||
|
}
|
||||||
|
|
||||||
|
byte CSurface::GetOpacity()
|
||||||
|
{
|
||||||
|
return m_byOpacity;
|
||||||
|
}
|
||||||
|
|
||||||
|
IDirect3DTexture8 *CSurface::GetTexture()
|
||||||
|
{
|
||||||
|
return m_pTexture;
|
||||||
|
}
|
|
@ -0,0 +1,87 @@
|
||||||
|
/**
|
||||||
|
* Surreal 64 Launcher (C) 2003
|
||||||
|
*
|
||||||
|
* This program 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
|
||||||
|
* Foundation; either version 2 of the License, or (at your option) any later
|
||||||
|
* version. This program 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 this program; if not, write to the Free Software Foundation, Inc.,
|
||||||
|
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. To contact the
|
||||||
|
* authors: email: buttza@hotmail.com, lantus@lantus-x.com
|
||||||
|
*
|
||||||
|
* Additional code and cleanups: Surreal64 CE Team (http://www.emuxtras.net)
|
||||||
|
*/
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "Global.h"
|
||||||
|
|
||||||
|
class CSurface
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
CSurface();
|
||||||
|
~CSurface();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Do functions
|
||||||
|
*/
|
||||||
|
bool Create(const char *szFilename);
|
||||||
|
bool Create(dword width, dword height);
|
||||||
|
void Destroy();
|
||||||
|
|
||||||
|
bool IsLoaded();
|
||||||
|
|
||||||
|
bool Render();
|
||||||
|
bool Render(int x, int y);
|
||||||
|
bool Render(int x, int y, dword w, dword h);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set functions
|
||||||
|
*/
|
||||||
|
void SetOpacity(byte opacity);
|
||||||
|
|
||||||
|
void MoveTo(int x, int y);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get functions
|
||||||
|
*/
|
||||||
|
dword GetWidth();
|
||||||
|
dword GetHeight();
|
||||||
|
|
||||||
|
byte GetOpacity();
|
||||||
|
|
||||||
|
IDirect3DTexture8 *GetTexture();
|
||||||
|
|
||||||
|
private:
|
||||||
|
/**
|
||||||
|
* A d3d texture object that will contain the loaded texture
|
||||||
|
* and a d3d vertex buffer object that will contain the vertex
|
||||||
|
* buffer for the quad which will display the texture
|
||||||
|
*/
|
||||||
|
IDirect3DTexture8 *m_pTexture;
|
||||||
|
IDirect3DVertexBuffer8 *m_pVertexBuffer;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The default render position of the texture
|
||||||
|
*/
|
||||||
|
int m_x, m_y;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The width and height of the texture
|
||||||
|
*/
|
||||||
|
D3DXIMAGE_INFO m_imageInfo;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The opacity of the texture
|
||||||
|
*/
|
||||||
|
byte m_byOpacity;
|
||||||
|
byte m_byR, m_byG, m_byB;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Whether the texture has been created or not
|
||||||
|
*/
|
||||||
|
bool m_bLoaded;
|
||||||
|
};
|
File diff suppressed because it is too large
Load Diff
Binary file not shown.
After Width: | Height: | Size: 48 KiB |
|
@ -0,0 +1,78 @@
|
||||||
|
/* 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 "RetroLaunch/Global.h"
|
||||||
|
#include "RetroLaunch/IoSupport.h"
|
||||||
|
#include "RetroLaunch/Font.h"
|
||||||
|
#include "RetroLaunch/MenuManager.h"
|
||||||
|
#include "RetroLaunch/RomList.h"
|
||||||
|
|
||||||
|
int menu_init(void)
|
||||||
|
{
|
||||||
|
RARCH_LOG("Starting RetroLaunch.\n");
|
||||||
|
|
||||||
|
// Set file cache size
|
||||||
|
XSetFileCacheSize(8 * 1024 * 1024);
|
||||||
|
|
||||||
|
// Mount drives
|
||||||
|
g_IOSupport.Mount("A:", "cdrom0");
|
||||||
|
g_IOSupport.Mount("E:", "Harddisk0\\Partition1");
|
||||||
|
g_IOSupport.Mount("Z:", "Harddisk0\\Partition2");
|
||||||
|
g_IOSupport.Mount("F:", "Harddisk0\\Partition6");
|
||||||
|
g_IOSupport.Mount("G:", "Harddisk0\\Partition7");
|
||||||
|
|
||||||
|
// Load the rom list if it isn't already loaded
|
||||||
|
if (!g_romList.IsLoaded())
|
||||||
|
g_romList.Build();
|
||||||
|
|
||||||
|
// Load the font here
|
||||||
|
g_font.Create();
|
||||||
|
|
||||||
|
// Build menu here (Menu state -> Main Menu)
|
||||||
|
g_menuManager.Create();
|
||||||
|
|
||||||
|
g_console.mode_switch = MODE_MENU;
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
void menu_free(void) {}
|
||||||
|
|
||||||
|
void menu_loop(void)
|
||||||
|
{
|
||||||
|
xdk_d3d_video_t *d3d = (xdk_d3d_video_t*)driver.video_data;
|
||||||
|
|
||||||
|
g_console.menu_enable = true;
|
||||||
|
|
||||||
|
do
|
||||||
|
{
|
||||||
|
d3d->d3d_render_device->Clear(0, NULL, D3DCLEAR_TARGET,
|
||||||
|
D3DCOLOR_ARGB(0, 0, 0, 0),
|
||||||
|
1.0f, 0);
|
||||||
|
|
||||||
|
d3d->d3d_render_device->BeginScene();
|
||||||
|
d3d->d3d_render_device->SetFlickerFilter(1);
|
||||||
|
d3d->d3d_render_device->SetSoftDisplayFilter(1);
|
||||||
|
|
||||||
|
//g_input.GetInput();
|
||||||
|
g_menuManager.Update();
|
||||||
|
|
||||||
|
d3d->d3d_render_device->EndScene();
|
||||||
|
d3d->d3d_render_device->Present(NULL, NULL, NULL, NULL);
|
||||||
|
}while(g_console.menu_enable);
|
||||||
|
|
||||||
|
g_console.ingame_menu_enable = false;
|
||||||
|
}
|
|
@ -18,6 +18,11 @@
|
||||||
#define _XDK_VIDEO_H
|
#define _XDK_VIDEO_H
|
||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
||||||
|
#ifdef _XBOX1
|
||||||
|
#define XFONT_TRUETYPE // use true type fonts
|
||||||
|
#endif
|
||||||
|
|
||||||
#include <xfont.h>
|
#include <xfont.h>
|
||||||
|
|
||||||
#include "../xdk/xdk_defines.h"
|
#include "../xdk/xdk_defines.h"
|
||||||
|
@ -25,8 +30,7 @@
|
||||||
#define SHOW_DEBUG_INFO
|
#define SHOW_DEBUG_INFO
|
||||||
|
|
||||||
#define DFONT_MAX 4096
|
#define DFONT_MAX 4096
|
||||||
#define PRIM_FVF (D3DFVF_XYZRHW | D3DFVF_TEX1)
|
#define D3DFVF_CUSTOMVERTEX (D3DFVF_XYZRHW | D3DFVF_TEX1)
|
||||||
#define D3DFVF_CUSTOMVERTEX (D3DFVF_XYZ | D3DFVF_NORMAL)
|
|
||||||
|
|
||||||
#define MIN_SCALING_FACTOR (1.0f)
|
#define MIN_SCALING_FACTOR (1.0f)
|
||||||
#define MAX_SCALING_FACTOR (2.0f)
|
#define MAX_SCALING_FACTOR (2.0f)
|
||||||
|
@ -44,6 +48,7 @@ typedef struct
|
||||||
typedef struct DrawVerticeFormats
|
typedef struct DrawVerticeFormats
|
||||||
{
|
{
|
||||||
float x, y, z;
|
float x, y, z;
|
||||||
|
float rhw;
|
||||||
float u, v;
|
float u, v;
|
||||||
} DrawVerticeFormats;
|
} DrawVerticeFormats;
|
||||||
|
|
||||||
|
|
|
@ -26,12 +26,48 @@
|
||||||
#include "../libretro.h"
|
#include "../libretro.h"
|
||||||
#include "xinput_xbox_input.h"
|
#include "xinput_xbox_input.h"
|
||||||
|
|
||||||
static XINPUT_STATE state[4];
|
static uint64_t real_state[4];
|
||||||
HANDLE gamepads[4];
|
HANDLE gamepads[4];
|
||||||
DWORD dwDeviceMask;
|
DWORD dwDeviceMask;
|
||||||
bool bInserted[4];
|
bool bInserted[4];
|
||||||
bool bRemoved[4];
|
bool bRemoved[4];
|
||||||
XINPUT_CAPABILITIES caps[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)
|
#define DEADZONE (16000)
|
||||||
|
|
||||||
|
@ -48,6 +84,10 @@ static void xinput_input_poll(void *data)
|
||||||
|
|
||||||
for (unsigned i = 0; i < 4; i++)
|
for (unsigned i = 0; i < 4; i++)
|
||||||
{
|
{
|
||||||
|
XINPUT_STATE state[4];
|
||||||
|
XINPUT_CAPABILITIES caps[4];
|
||||||
|
(void)caps;
|
||||||
|
real_state[i] = 0;
|
||||||
// handle removed devices
|
// handle removed devices
|
||||||
bRemoved[i] = (dwRemovals & (1<<i)) ? true : false;
|
bRemoved[i] = (dwRemovals & (1<<i)) ? true : false;
|
||||||
|
|
||||||
|
@ -82,7 +122,26 @@ static void xinput_input_poll(void *data)
|
||||||
// XInputOpen, the device handle will be NULL
|
// XInputOpen, the device handle will be NULL
|
||||||
|
|
||||||
retval = XInputGetState(gamepads[i], &state[i]);
|
retval = XInputGetState(gamepads[i], &state[i]);
|
||||||
pads_connected += (retval != ERROR_SUCCESS) ? 0 : 1;
|
if(retval == ERROR_SUCCESS)
|
||||||
|
{
|
||||||
|
pads_connected++;
|
||||||
|
real_state[i] |= ((state[i].Gamepad.bAnalogButtons[XINPUT_GAMEPAD_B]) ? XINPUT1_GAMEPAD_B : 0);
|
||||||
|
real_state[i] |= ((state[i].Gamepad.bAnalogButtons[XINPUT_GAMEPAD_A]) ? XINPUT1_GAMEPAD_A : 0);
|
||||||
|
real_state[i] |= ((state[i].Gamepad.bAnalogButtons[XINPUT_GAMEPAD_Y]) ? XINPUT1_GAMEPAD_Y : 0);
|
||||||
|
real_state[i] |= ((state[i].Gamepad.bAnalogButtons[XINPUT_GAMEPAD_X]) ? XINPUT1_GAMEPAD_X : 0);
|
||||||
|
real_state[i] |= ((state[i].Gamepad.wButtons & XINPUT_GAMEPAD_DPAD_LEFT) || (state[i].Gamepad.sThumbLX < -DEADZONE) ? XINPUT1_GAMEPAD_DPAD_LEFT : 0);
|
||||||
|
real_state[i] |= ((state[i].Gamepad.wButtons & XINPUT_GAMEPAD_DPAD_RIGHT) || (state[i].Gamepad.sThumbLX > DEADZONE) ? XINPUT1_GAMEPAD_DPAD_RIGHT : 0);
|
||||||
|
real_state[i] |= ((state[i].Gamepad.wButtons & XINPUT_GAMEPAD_DPAD_UP) || (state[i].Gamepad.sThumbLY > DEADZONE) ? XINPUT1_GAMEPAD_DPAD_UP : 0);
|
||||||
|
real_state[i] |= ((state[i].Gamepad.wButtons & XINPUT_GAMEPAD_DPAD_DOWN)|| (state[i].Gamepad.sThumbLY < -DEADZONE) ? XINPUT1_GAMEPAD_DPAD_DOWN : 0);
|
||||||
|
real_state[i] |= ((state[i].Gamepad.wButtons & XINPUT_GAMEPAD_START) ? XINPUT1_GAMEPAD_START : 0);
|
||||||
|
real_state[i] |= ((state[i].Gamepad.wButtons & XINPUT_GAMEPAD_BACK) ? XINPUT1_GAMEPAD_BACK : 0);
|
||||||
|
real_state[i] |= ((state[i].Gamepad.bAnalogButtons[XINPUT_GAMEPAD_LEFT_TRIGGER]) ? XINPUT1_GAMEPAD_LEFT_TRIGGER : 0);
|
||||||
|
real_state[i] |= ((state[i].Gamepad.bAnalogButtons[XINPUT_GAMEPAD_RIGHT_TRIGGER]) ? XINPUT1_GAMEPAD_RIGHT_TRIGGER : 0);
|
||||||
|
real_state[i] |= ((state[i].Gamepad.bAnalogButtons[XINPUT_GAMEPAD_WHITE]) ? XINPUT1_GAMEPAD_WHITE : 0);
|
||||||
|
real_state[i] |= ((state[i].Gamepad.bAnalogButtons[XINPUT_GAMEPAD_BLACK]) ? XINPUT1_GAMEPAD_BLACK : 0);
|
||||||
|
real_state[i] |= ((state[i].Gamepad.wButtons & XINPUT_GAMEPAD_LEFT_THUMB) ? XINPUT1_GAMEPAD_LEFT_THUMB : 0);
|
||||||
|
real_state[i] |= ((state[i].Gamepad.wButtons & XINPUT_GAMEPAD_RIGHT_THUMB) ? XINPUT1_GAMEPAD_RIGHT_THUMB : 0);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -93,65 +152,9 @@ static int16_t xinput_input_state(void *data, const struct retro_keybind **binds
|
||||||
{
|
{
|
||||||
(void)data;
|
(void)data;
|
||||||
unsigned player = port;
|
unsigned player = port;
|
||||||
DWORD button = binds[player][id].joykey;
|
uint64_t button = binds[player][id].joykey;
|
||||||
int16_t retval = 0;
|
|
||||||
|
|
||||||
//FIXME: Hardcoded binds
|
return (real_state[player] & button) ? 1 : 0;
|
||||||
switch(id)
|
|
||||||
{
|
|
||||||
case RETRO_DEVICE_ID_JOYPAD_A:
|
|
||||||
retval = (state[player].Gamepad.bAnalogButtons[XINPUT_GAMEPAD_B]) ? 1 : 0;
|
|
||||||
break;
|
|
||||||
case RETRO_DEVICE_ID_JOYPAD_B:
|
|
||||||
retval = (state[player].Gamepad.bAnalogButtons[XINPUT_GAMEPAD_A]) ? 1 : 0;
|
|
||||||
break;
|
|
||||||
case RETRO_DEVICE_ID_JOYPAD_X:
|
|
||||||
retval = (state[player].Gamepad.bAnalogButtons[XINPUT_GAMEPAD_Y]) ? 1 : 0;
|
|
||||||
break;
|
|
||||||
case RETRO_DEVICE_ID_JOYPAD_Y:
|
|
||||||
retval = (state[player].Gamepad.bAnalogButtons[XINPUT_GAMEPAD_X]) ? 1 : 0;
|
|
||||||
break;
|
|
||||||
case RETRO_DEVICE_ID_JOYPAD_LEFT:
|
|
||||||
retval = (state[player].Gamepad.wButtons & XINPUT_GAMEPAD_DPAD_LEFT) || (state[player].Gamepad.sThumbLX < -DEADZONE) ? 1 : 0;
|
|
||||||
break;
|
|
||||||
case RETRO_DEVICE_ID_JOYPAD_RIGHT:
|
|
||||||
retval = (state[player].Gamepad.wButtons & XINPUT_GAMEPAD_DPAD_RIGHT) || (state[player].Gamepad.sThumbLX > DEADZONE) ? 1 : 0;
|
|
||||||
break;
|
|
||||||
case RETRO_DEVICE_ID_JOYPAD_UP:
|
|
||||||
retval = (state[player].Gamepad.wButtons & XINPUT_GAMEPAD_DPAD_UP) || (state[player].Gamepad.sThumbLY > DEADZONE) ? 1 : 0;
|
|
||||||
break;
|
|
||||||
case RETRO_DEVICE_ID_JOYPAD_DOWN:
|
|
||||||
retval = (state[player].Gamepad.wButtons & XINPUT_GAMEPAD_DPAD_DOWN)|| (state[player].Gamepad.sThumbLY < -DEADZONE) ? 1 : 0;
|
|
||||||
break;
|
|
||||||
case RETRO_DEVICE_ID_JOYPAD_START:
|
|
||||||
retval = (state[player].Gamepad.wButtons & XINPUT_GAMEPAD_START) ? 1 : 0;
|
|
||||||
break;
|
|
||||||
case RETRO_DEVICE_ID_JOYPAD_SELECT:
|
|
||||||
retval = (state[player].Gamepad.wButtons & XINPUT_GAMEPAD_BACK) ? 1 : 0;
|
|
||||||
break;
|
|
||||||
case RETRO_DEVICE_ID_JOYPAD_L:
|
|
||||||
retval = (state[player].Gamepad.bAnalogButtons[XINPUT_GAMEPAD_LEFT_TRIGGER]) ? 1 : 0;
|
|
||||||
break;
|
|
||||||
case RETRO_DEVICE_ID_JOYPAD_R:
|
|
||||||
retval = (state[player].Gamepad.bAnalogButtons[XINPUT_GAMEPAD_RIGHT_TRIGGER]) ? 1 : 0;
|
|
||||||
break;
|
|
||||||
case RETRO_DEVICE_ID_JOYPAD_L2:
|
|
||||||
retval = (state[player].Gamepad.bAnalogButtons[XINPUT_GAMEPAD_WHITE]) ? 1 : 0;
|
|
||||||
break;
|
|
||||||
case RETRO_DEVICE_ID_JOYPAD_R2:
|
|
||||||
retval = (state[player].Gamepad.bAnalogButtons[XINPUT_GAMEPAD_BLACK]) ? 1 : 0;
|
|
||||||
break;
|
|
||||||
case RETRO_DEVICE_ID_JOYPAD_L3:
|
|
||||||
retval = (state[player].Gamepad.wButtons & XINPUT_GAMEPAD_LEFT_THUMB) ? 1 : 0;
|
|
||||||
break;
|
|
||||||
case RETRO_DEVICE_ID_JOYPAD_R3:
|
|
||||||
retval = (state[player].Gamepad.wButtons & XINPUT_GAMEPAD_RIGHT_THUMB) ? 1 : 0;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
return retval;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void xinput_input_free_input(void *data)
|
static void xinput_input_free_input(void *data)
|
||||||
|
@ -189,6 +192,33 @@ static bool xinput_input_key_pressed(void *data, int key)
|
||||||
return retval;
|
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 =
|
const input_driver_t input_xinput =
|
||||||
{
|
{
|
||||||
xinput_input_init,
|
xinput_input_init,
|
||||||
|
@ -196,5 +226,6 @@ const input_driver_t input_xinput =
|
||||||
xinput_input_state,
|
xinput_input_state,
|
||||||
xinput_input_key_pressed,
|
xinput_input_key_pressed,
|
||||||
xinput_input_free_input,
|
xinput_input_free_input,
|
||||||
|
xinput_set_default_keybind_lut,
|
||||||
"xinput"
|
"xinput"
|
||||||
};
|
};
|
||||||
|
|
|
@ -44,4 +44,42 @@ enum {
|
||||||
XINPUT1_GAMEPAD_RSTICK_DOWN_MASK = 1 << 23,
|
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
|
#endif
|
||||||
|
|
|
@ -20,6 +20,8 @@
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
|
#include "../../xdk/menu_shared.h"
|
||||||
|
|
||||||
#ifdef _XBOX360
|
#ifdef _XBOX360
|
||||||
#include <xfilecache.h>
|
#include <xfilecache.h>
|
||||||
#include "../../360/frontend-xdk/menu.h"
|
#include "../../360/frontend-xdk/menu.h"
|
||||||
|
@ -36,174 +38,20 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "../../console/retroarch_console.h"
|
#include "../../console/retroarch_console.h"
|
||||||
|
#include "../../console/retroarch_config.h"
|
||||||
#include "../../conf/config_file.h"
|
#include "../../conf/config_file.h"
|
||||||
#include "../../conf/config_file_macros.h"
|
#include "../../conf/config_file_macros.h"
|
||||||
#include "../../file.h"
|
#include "../../file.h"
|
||||||
#include "../../general.h"
|
#include "../../general.h"
|
||||||
|
|
||||||
#define DEVICE_MEMORY_UNIT0 1
|
|
||||||
#define DEVICE_MEMORY_UNIT1 2
|
|
||||||
#define DEVICE_MEMORY_ONBOARD 3
|
|
||||||
#define DEVICE_CDROM0 4
|
|
||||||
#define DEVICE_HARDISK0_PART1 5
|
|
||||||
#define DEVICE_HARDISK0_SYSPART 6
|
|
||||||
#define DEVICE_USB0 7
|
|
||||||
#define DEVICE_USB1 8
|
|
||||||
#define DEVICE_USB2 9
|
|
||||||
#define DEVICE_TEST 10
|
|
||||||
#define DEVICE_CACHE 11
|
|
||||||
|
|
||||||
typedef struct _STRING {
|
|
||||||
unsigned short Length;
|
|
||||||
unsigned short MaximumLength;
|
|
||||||
char * Buffer;
|
|
||||||
} STRING;
|
|
||||||
|
|
||||||
char DEFAULT_SHADER_FILE[PATH_MAX];
|
|
||||||
char SYS_CONFIG_FILE[PATH_MAX];
|
|
||||||
|
|
||||||
#ifdef _XBOX360
|
|
||||||
extern "C" int __stdcall ObCreateSymbolicLink( STRING*, STRING*);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
int Mounted[20];
|
|
||||||
|
|
||||||
int rarch_main(int argc, char *argv[]);
|
int rarch_main(int argc, char *argv[]);
|
||||||
|
|
||||||
#undef main
|
#undef main
|
||||||
|
|
||||||
#ifdef _XBOX360
|
|
||||||
static int DriveMounted(std::string path)
|
|
||||||
{
|
|
||||||
WIN32_FIND_DATA findFileData;
|
|
||||||
memset(&findFileData,0,sizeof(WIN32_FIND_DATA));
|
|
||||||
std::string searchcmd = path + "\\*.*";
|
|
||||||
HANDLE hFind = FindFirstFile(searchcmd.c_str(), &findFileData);
|
|
||||||
|
|
||||||
if (hFind == INVALID_HANDLE_VALUE)
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
FindClose(hFind);
|
|
||||||
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int Mount( int Device, char* MountPoint )
|
|
||||||
{
|
|
||||||
char MountConv[260];
|
|
||||||
char * SysPath = NULL;
|
|
||||||
|
|
||||||
snprintf( MountConv, sizeof(MountConv), "\\??\\%s", MountPoint );
|
|
||||||
|
|
||||||
switch( Device )
|
|
||||||
{
|
|
||||||
case DEVICE_MEMORY_UNIT0:
|
|
||||||
SysPath = "\\Device\\Mu0";
|
|
||||||
break;
|
|
||||||
case DEVICE_MEMORY_UNIT1:
|
|
||||||
SysPath = "\\Device\\Mu1";
|
|
||||||
break;
|
|
||||||
case DEVICE_MEMORY_ONBOARD:
|
|
||||||
SysPath = "\\Device\\BuiltInMuSfc";
|
|
||||||
break;
|
|
||||||
case DEVICE_CDROM0:
|
|
||||||
SysPath = "\\Device\\Cdrom0";
|
|
||||||
break;
|
|
||||||
case DEVICE_HARDISK0_PART1:
|
|
||||||
SysPath = "\\Device\\Harddisk0\\Partition1";
|
|
||||||
break;
|
|
||||||
case DEVICE_HARDISK0_SYSPART:
|
|
||||||
SysPath = "\\Device\\Harddisk0\\SystemPartition";
|
|
||||||
break;
|
|
||||||
case DEVICE_USB0:
|
|
||||||
SysPath = "\\Device\\Mass0";
|
|
||||||
break;
|
|
||||||
case DEVICE_USB1:
|
|
||||||
SysPath = "\\Device\\Mass1";
|
|
||||||
break;
|
|
||||||
case DEVICE_USB2:
|
|
||||||
SysPath = "\\Device\\Mass2";
|
|
||||||
break;
|
|
||||||
case DEVICE_CACHE:
|
|
||||||
SysPath = "\\Device\\Harddisk0\\Cache0";
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
STRING sSysPath = { (USHORT)strlen( SysPath ), (USHORT)strlen( SysPath ) + 1, SysPath };
|
|
||||||
STRING sMountConv = { (USHORT)strlen( MountConv ), (USHORT)strlen( MountConv ) + 1, MountConv };
|
|
||||||
int res = ObCreateSymbolicLink( &sMountConv, &sSysPath );
|
|
||||||
|
|
||||||
if (res != 0)
|
|
||||||
return res;
|
|
||||||
|
|
||||||
return DriveMounted(MountPoint);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
static void set_default_settings (void)
|
|
||||||
{
|
|
||||||
//g_settings
|
|
||||||
g_settings.rewind_enable = false;
|
|
||||||
strlcpy(g_settings.video.cg_shader_path, DEFAULT_SHADER_FILE, sizeof(g_settings.video.cg_shader_path));
|
|
||||||
g_settings.video.fbo_scale_x = 2.0f;
|
|
||||||
g_settings.video.fbo_scale_y = 2.0f;
|
|
||||||
g_settings.video.render_to_texture = true;
|
|
||||||
strlcpy(g_settings.video.second_pass_shader, DEFAULT_SHADER_FILE, sizeof(g_settings.video.second_pass_shader));
|
|
||||||
g_settings.video.second_pass_smooth = true;
|
|
||||||
g_settings.video.smooth = true;
|
|
||||||
g_settings.video.vsync = true;
|
|
||||||
strlcpy(g_settings.cheat_database, "game:", sizeof(g_settings.cheat_database));
|
|
||||||
g_settings.video.aspect_ratio = -1.0f;
|
|
||||||
|
|
||||||
rarch_input_set_controls_default();
|
|
||||||
|
|
||||||
//g_console
|
|
||||||
g_console.block_config_read = true;
|
|
||||||
g_console.frame_advance_enable = false;
|
|
||||||
g_console.emulator_initialized = 0;
|
|
||||||
g_console.gamma_correction_enable = true;
|
|
||||||
g_console.initialize_rarch_enable = false;
|
|
||||||
g_console.fbo_enabled = true;
|
|
||||||
g_console.mode_switch = MODE_MENU;
|
|
||||||
g_console.screen_orientation = ORIENTATION_NORMAL;
|
|
||||||
g_console.throttle_enable = true;
|
|
||||||
g_console.aspect_ratio_index = 0;
|
|
||||||
strlcpy(g_console.default_rom_startup_dir, "game:", sizeof(g_console.default_rom_startup_dir));
|
|
||||||
g_console.viewports.custom_vp.width = 0;
|
|
||||||
g_console.viewports.custom_vp.height = 0;
|
|
||||||
g_console.viewports.custom_vp.x = 0;
|
|
||||||
g_console.viewports.custom_vp.y = 0;
|
|
||||||
g_console.color_format = 0;
|
|
||||||
g_console.info_msg_enable = true;
|
|
||||||
|
|
||||||
//g_extern
|
|
||||||
g_extern.state_slot = 0;
|
|
||||||
g_extern.audio_data.mute = 0;
|
|
||||||
g_extern.verbose = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void get_environment_settings (void)
|
static void get_environment_settings (void)
|
||||||
{
|
{
|
||||||
#ifdef _XBOX360
|
HRESULT ret;
|
||||||
DWORD ret;
|
(void)ret;
|
||||||
|
|
||||||
//for devkits only, we will need to mount all partitions for retail
|
|
||||||
//in a different way
|
|
||||||
//DmMapDevkitDrive();
|
|
||||||
|
|
||||||
memset(&Mounted, 0, 20);
|
|
||||||
|
|
||||||
Mounted[DEVICE_USB0] = Mount(DEVICE_USB0,"Usb0:");
|
|
||||||
Mounted[DEVICE_USB1] = Mount(DEVICE_USB1,"Usb1:");
|
|
||||||
Mounted[DEVICE_USB2] = Mount(DEVICE_USB2,"Usb2:");
|
|
||||||
Mounted[DEVICE_HARDISK0_PART1] = Mount(DEVICE_HARDISK0_PART1,"Hdd1:");
|
|
||||||
Mounted[DEVICE_HARDISK0_SYSPART] = Mount(DEVICE_HARDISK0_SYSPART,"HddX:");
|
|
||||||
Mounted[DEVICE_MEMORY_UNIT0] = Mount(DEVICE_MEMORY_UNIT0,"Memunit0:");
|
|
||||||
Mounted[DEVICE_MEMORY_UNIT1] = Mount(DEVICE_MEMORY_UNIT1,"Memunit1:");
|
|
||||||
Mounted[DEVICE_MEMORY_ONBOARD] = Mount(DEVICE_MEMORY_ONBOARD,"OnBoardMU:");
|
|
||||||
Mounted[DEVICE_CDROM0] = Mount(DEVICE_CDROM0,"Dvd:");
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef HAVE_HDD_CACHE_PARTITION
|
#ifdef HAVE_HDD_CACHE_PARTITION
|
||||||
ret = XSetFileCacheSize(0x100000);
|
ret = XSetFileCacheSize(0x100000);
|
||||||
|
|
||||||
|
@ -252,39 +100,24 @@ static void get_environment_settings (void)
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
strlcpy(DEFAULT_SHADER_FILE, "game:\\media\\shaders\\stock.cg", sizeof(DEFAULT_SHADER_FILE));
|
#if defined(_XBOX1)
|
||||||
#ifdef _XBOX1
|
|
||||||
/* FIXME: Hardcoded */
|
/* FIXME: Hardcoded */
|
||||||
strlcpy(SYS_CONFIG_FILE, "D:\\retroarch.cfg", sizeof(SYS_CONFIG_FILE));
|
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(g_settings.system_directory, "D:\\system\\", sizeof(g_settings.system_directory));
|
||||||
#else
|
strlcpy(default_paths.filesystem_root_dir, "D:\\", sizeof(default_paths.filesystem_root_dir));
|
||||||
strlcpy(SYS_CONFIG_FILE, "game:\\retroarch.cfg", sizeof(SYS_CONFIG_FILE));
|
strlcpy(default_paths.executable_extension, ".xbe", sizeof(default_paths.executable_extension));
|
||||||
|
#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(g_settings.system_directory, "game:\\system\\", sizeof(g_settings.system_directory));
|
||||||
|
strlcpy(default_paths.executable_extension, ".xex", sizeof(default_paths.executable_extension));
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
static void configure_libretro(const char *path_prefix, const char * extension)
|
|
||||||
{
|
|
||||||
char full_path[1024];
|
|
||||||
snprintf(full_path, sizeof(full_path), "%sCORE%s", path_prefix, extension);
|
|
||||||
|
|
||||||
bool find_libretro_file = rarch_configure_libretro_core(full_path, path_prefix, path_prefix,
|
|
||||||
SYS_CONFIG_FILE, extension);
|
|
||||||
|
|
||||||
set_default_settings();
|
|
||||||
rarch_config_load(SYS_CONFIG_FILE, path_prefix, extension, find_libretro_file);
|
|
||||||
init_libretro_sym();
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef _XBOX1
|
|
||||||
static void menu_init(void) {}
|
|
||||||
static void menu_free(void) {}
|
|
||||||
static void menu_loop(void)
|
|
||||||
{
|
|
||||||
rarch_console_load_game("D:\\ssf2x.gba");
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
rarch_main_clear_state();
|
rarch_main_clear_state();
|
||||||
|
@ -292,18 +125,14 @@ int main(int argc, char *argv[])
|
||||||
|
|
||||||
config_set_defaults();
|
config_set_defaults();
|
||||||
|
|
||||||
#ifdef _XBOX1
|
input_xinput.init();
|
||||||
configure_libretro("D:\\", ".xbe");
|
rarch_configure_libretro(&input_xinput, default_paths.filesystem_root_dir, default_paths.executable_extension);
|
||||||
#else
|
|
||||||
configure_libretro("game:\\", ".xex");
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined(HAVE_D3D8) || defined(HAVE_D3D9)
|
#if defined(HAVE_D3D8) || defined(HAVE_D3D9)
|
||||||
video_xdk_d3d.start();
|
video_xdk_d3d.start();
|
||||||
#else
|
#else
|
||||||
video_null.start();
|
video_null.start();
|
||||||
#endif
|
#endif
|
||||||
input_xinput.init();
|
|
||||||
|
|
||||||
rarch_input_set_default_keybind_names_for_emulator();
|
rarch_input_set_default_keybind_names_for_emulator();
|
||||||
|
|
||||||
|
@ -325,7 +154,7 @@ begin_loop:
|
||||||
else if(g_console.mode_switch == MODE_MENU)
|
else if(g_console.mode_switch == MODE_MENU)
|
||||||
{
|
{
|
||||||
menu_loop();
|
menu_loop();
|
||||||
rarch_startup(SYS_CONFIG_FILE);
|
rarch_startup(default_paths.config_file);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
goto begin_shutdown;
|
goto begin_shutdown;
|
||||||
|
@ -333,8 +162,8 @@ begin_loop:
|
||||||
goto begin_loop;
|
goto begin_loop;
|
||||||
|
|
||||||
begin_shutdown:
|
begin_shutdown:
|
||||||
if(path_file_exists(SYS_CONFIG_FILE))
|
if(path_file_exists(default_paths.config_file))
|
||||||
rarch_config_save(SYS_CONFIG_FILE);
|
rarch_config_save(default_paths.config_file);
|
||||||
|
|
||||||
menu_free();
|
menu_free();
|
||||||
#if defined(HAVE_D3D8) || defined(HAVE_D3D9)
|
#if defined(HAVE_D3D8) || defined(HAVE_D3D9)
|
||||||
|
|
|
@ -0,0 +1,24 @@
|
||||||
|
/* 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 _XDK_MENU_SHARED_H
|
||||||
|
#define _XDK_MENU_SHARED_H
|
||||||
|
|
||||||
|
int menu_init (void);
|
||||||
|
void menu_free (void);
|
||||||
|
void menu_loop (void);
|
||||||
|
|
||||||
|
#endif
|
Loading…
Reference in New Issue