(GX) Change wii_ naming conventions to gx_

This commit is contained in:
Twinaphex 2012-08-09 03:54:27 +02:00
parent e277828526
commit 5e97b86e65
10 changed files with 121 additions and 113 deletions

View File

@ -82,23 +82,23 @@
#elif defined(GEKKO)
#define video_init_func(video_info, input, input_data) wii_init(video_info, input, input_data)
#define video_init_func(video_info, input, input_data) gx_init(video_info, input, input_data)
#define video_frame_func(data, width, height, pitch, msg) \
wii_frame(driver.video_data, data, width, height, pitch, msg)
#define video_set_nonblock_state_func(state) wii_set_nonblock_state(driver.video_data, state)
#define video_alive_func() wii_alive(driver.video_data)
#define video_focus_func() wii_focus(driver.video_data)
gx_frame(driver.video_data, data, width, height, pitch, msg)
#define video_set_nonblock_state_func(state) gx_set_nonblock_state(driver.video_data, state)
#define video_alive_func() gx_alive(driver.video_data)
#define video_focus_func() gx_focus(driver.video_data)
#define video_xml_shader_func(path) driver.video->xml_shader(driver.video_data, path)
#define video_free_func() wii_free(driver.video_data)
#define video_set_rotation_func(orientation) wii_set_rotation(driver.video_data, orientation)
#define video_set_aspect_ratio_func(aspectratio_idx) wii_set_aspect_ratio(driver.video_data, aspectratio_idx)
#define video_free_func() gx_free(driver.video_data)
#define video_set_rotation_func(orientation) gx_set_rotation(driver.video_data, orientation)
#define video_set_aspect_ratio_func(aspectratio_idx) gx_set_aspect_ratio(driver.video_data, aspectratio_idx)
#define input_init_func() wii_input_initialize()
#define input_poll_func() wii_input_poll(driver.input_data)
#define input_init_func() gx_input_initialize()
#define input_poll_func() gx_input_poll(driver.input_data)
#define input_input_state_func(retro_keybinds, port, device, index, id) \
wii_input_state(driver.input_data, retro_keybinds, port, device, index, id)
#define input_key_pressed_func(key) wii_key_pressed(driver.input_data, key)
#define input_free_func() wii_free_input(driver.input_data)
gx_input_state(driver.input_data, retro_keybinds, port, device, index, id)
#define input_key_pressed_func(key) gx_key_pressed(driver.input_data, key)
#define input_free_func() gx_free_input(driver.input_data)
#define gfx_ctx_window_has_focus() (true)
#else

View File

@ -447,21 +447,21 @@ static void rgui_settings_toggle_setting(rgui_file_type_t setting, rgui_action_t
{
rarch_settings_default(S_DEF_AUDIO_CONTROL_RATE);
#ifdef GEKKO
video_wii.set_rotation(NULL, g_console.screen_orientation);
video_gx.set_rotation(NULL, g_console.screen_orientation);
#endif
}
else if (action == RGUI_ACTION_LEFT)
{
rarch_settings_change(S_ROTATION_DECREMENT);
#ifdef GEKKO
video_wii.set_rotation(NULL, g_console.screen_orientation);
video_gx.set_rotation(NULL, g_console.screen_orientation);
#endif
}
else if (action == RGUI_ACTION_RIGHT)
{
rarch_settings_change(S_ROTATION_INCREMENT);
#ifdef GEKKO
video_wii.set_rotation(NULL, g_console.screen_orientation);
video_gx.set_rotation(NULL, g_console.screen_orientation);
#endif
}
break;
@ -507,9 +507,9 @@ static void rgui_settings_toggle_setting(rgui_file_type_t setting, rgui_action_t
else if (action == RGUI_ACTION_RIGHT)
g_settings.input.device[port]++;
g_settings.input.device[port] %= RARCH_DEVICE_LAST;
input_wii.set_default_keybind_lut(g_settings.input.device[port], port);
input_gx.set_default_keybind_lut(g_settings.input.device[port], port);
rarch_input_set_default_keybinds(port);
input_wii.set_analog_dpad_mapping(g_settings.input.device[port], g_settings.input.dpad_emulation[port], port);
input_gx.set_analog_dpad_mapping(g_settings.input.device[port], g_settings.input.dpad_emulation[port], port);
break;
case RGUI_SETTINGS_BIND_UP:
case RGUI_SETTINGS_BIND_DOWN:

View File

@ -73,7 +73,7 @@ static const audio_driver_t *audio_drivers[] = {
&audio_xdk360,
#endif
#ifdef GEKKO
&audio_wii,
&audio_gx,
#endif
&audio_null,
};
@ -98,7 +98,7 @@ static const video_driver_t *video_drivers[] = {
&video_ext,
#endif
#ifdef GEKKO
&video_wii,
&video_gx,
#endif
#ifdef HAVE_RPI
&video_rpi,
@ -123,7 +123,7 @@ static const input_driver_t *input_drivers[] = {
&input_xinput,
#endif
#ifdef GEKKO
&input_wii,
&input_gx,
#endif
#ifdef IS_LINUX
&input_linuxraw,

View File

@ -237,10 +237,10 @@ extern const audio_driver_t audio_coreaudio;
extern const audio_driver_t audio_xenon360;
extern const audio_driver_t audio_xdk360;
extern const audio_driver_t audio_ps3;
extern const audio_driver_t audio_wii;
extern const audio_driver_t audio_gx;
extern const audio_driver_t audio_null;
extern const video_driver_t video_gl;
extern const video_driver_t video_wii;
extern const video_driver_t video_gx;
extern const video_driver_t video_xenon360;
extern const video_driver_t video_xvideo;
extern const video_driver_t video_xdk_d3d;
@ -252,7 +252,7 @@ extern const input_driver_t input_sdl;
extern const input_driver_t input_x;
extern const input_driver_t input_ps3;
extern const input_driver_t input_xenon360;
extern const input_driver_t input_wii;
extern const input_driver_t input_gx;
extern const input_driver_t input_xinput;
extern const input_driver_t input_linuxraw;
extern const input_driver_t input_null;

View File

@ -50,7 +50,6 @@ uint32_t menu_framebuf[320 * 240];
rgui_handle_t *rgui;
char app_dir[PATH_MAX];
struct retro_system_info wii_core_info;
static const struct retro_keybind _wii_nav_binds[] = {
{ 0, 0, 0, GX_GC_UP | GX_GC_LSTICK_UP | GX_GC_RSTICK_UP | GX_CLASSIC_UP | GX_CLASSIC_LSTICK_UP | GX_CLASSIC_RSTICK_UP | GX_WIIMOTE_UP | GX_NUNCHUK_UP, 0 },
@ -151,11 +150,11 @@ static void menu_loop(void)
{
uint64_t input_state = 0;
input_wii.poll(NULL);
input_gx.poll(NULL);
for (unsigned i = 0; i < GX_DEVICE_NAV_LAST; i++)
{
input_state |= input_wii.input_state(NULL, wii_nav_binds, 0,
input_state |= input_gx.input_state(NULL, wii_nav_binds, 0,
RETRO_DEVICE_JOYPAD, 0, i) ? (1 << i) : 0;
}
@ -169,13 +168,13 @@ static void menu_loop(void)
_quit_binds
};
input_state |= input_wii.input_state(NULL, quit_binds, false,
input_state |= input_gx.input_state(NULL, quit_binds, false,
RETRO_DEVICE_JOYPAD, 0, 0) ? (GX_CLASSIC_HOME) : 0;
input_state |= input_wii.input_state(NULL, quit_binds, false,
input_state |= input_gx.input_state(NULL, quit_binds, false,
RETRO_DEVICE_JOYPAD, 0, 1) ? (GX_WIIMOTE_HOME) : 0;
input_state |= input_wii.input_state(NULL, quit_binds, false,
input_state |= input_gx.input_state(NULL, quit_binds, false,
RETRO_DEVICE_JOYPAD, 0, 2) ? (GX_QUIT_KEY) : 0;
@ -307,12 +306,9 @@ int main(void)
#endif
config_set_defaults();
input_wii.init();
input_gx.init();
retro_get_system_info(&wii_core_info);
RARCH_LOG("Core: %s\n", wii_core_info.library_name);
video_wii.start();
video_gx.start();
gx_video_t *gx = (gx_video_t*)driver.video_data;
gx->menu_data = menu_framebuf;
@ -328,11 +324,11 @@ int main(void)
bool find_libretro_file = rarch_configure_libretro_core(full_path, path_prefix, path_prefix,
default_paths.config_file, extension);
rarch_settings_set_default(&input_wii);
rarch_settings_set_default(&input_gx);
rarch_config_load(default_paths.config_file, path_prefix, extension, find_libretro_file);
init_libretro_sym();
input_wii.post_init();
input_gx.post_init();
menu_init();
@ -341,7 +337,7 @@ begin_loop:
{
bool repeat = false;
input_wii.poll(NULL);
input_gx.poll(NULL);
audio_start_func();
do{
@ -366,8 +362,8 @@ begin_shutdown:
if(g_console.emulator_initialized)
rarch_main_deinit();
input_wii.free(NULL);
video_wii.stop();
input_gx.free(NULL);
video_gx.stop();
menu_free();
#ifdef HAVE_FILE_LOGGER

View File

@ -38,9 +38,9 @@ typedef struct
lwpq_t cond;
bool nonblock;
} wii_audio_t;
} gx_audio_t;
static wii_audio_t *g_audio;
static gx_audio_t *g_audio;
static void dma_callback(void)
{
@ -53,7 +53,7 @@ static void dma_callback(void)
LWP_ThreadSignal(g_audio->cond);
}
static void *wii_audio_init(const char *device, unsigned rate, unsigned latency)
static void *gx_audio_init(const char *device, unsigned rate, unsigned latency)
{
AUDIO_Init(NULL);
AUDIO_RegisterDMACallback(dma_callback);
@ -91,9 +91,9 @@ static void *wii_audio_init(const char *device, unsigned rate, unsigned latency)
return g_audio;
}
static ssize_t wii_audio_write(void *data, const void *buf_, size_t size)
static ssize_t gx_audio_write(void *data, const void *buf_, size_t size)
{
wii_audio_t *wa = data;
gx_audio_t *wa = data;
size_t frames = size >> 2;
const uint32_t *buf = buf_;
@ -122,27 +122,27 @@ static ssize_t wii_audio_write(void *data, const void *buf_, size_t size)
return size;
}
static bool wii_audio_stop(void *data)
static bool gx_audio_stop(void *data)
{
(void)data;
AUDIO_StopDMA();
return true;
}
static void wii_audio_set_nonblock_state(void *data, bool state)
static void gx_audio_set_nonblock_state(void *data, bool state)
{
wii_audio_t *wa = data;
gx_audio_t *wa = data;
wa->nonblock = state;
}
static bool wii_audio_start(void *data)
static bool gx_audio_start(void *data)
{
(void)data;
AUDIO_StartDMA();
return true;
}
static void wii_audio_free(void *data)
static void gx_audio_free(void *data)
{
AUDIO_StopDMA();
AUDIO_RegisterDMACallback(NULL);
@ -156,27 +156,27 @@ static void wii_audio_free(void *data)
g_audio = NULL;
}
static size_t wii_audio_write_avail(void *data)
static size_t gx_audio_write_avail(void *data)
{
wii_audio_t *wa = data;
gx_audio_t *wa = data;
return ((wa->dma_busy - wa->dma_write + BLOCKS) & (BLOCKS - 1)) * CHUNK_SIZE;
}
static size_t wii_audio_buffer_size(void *data)
static size_t gx_audio_buffer_size(void *data)
{
(void)data;
return BLOCKS * CHUNK_SIZE;
}
const audio_driver_t audio_wii = {
.init = wii_audio_init,
.write = wii_audio_write,
.stop = wii_audio_stop,
.start = wii_audio_start,
.set_nonblock_state = wii_audio_set_nonblock_state,
.free = wii_audio_free,
.ident = "wii",
.write_avail = wii_audio_write_avail,
.buffer_size = wii_audio_buffer_size,
const audio_driver_t audio_gx = {
.init = gx_audio_init,
.write = gx_audio_write,
.stop = gx_audio_stop,
.start = gx_audio_start,
.set_nonblock_state = gx_audio_set_nonblock_state,
.free = gx_audio_free,
.ident = "gx",
.write_avail = gx_audio_write_avail,
.buffer_size = gx_audio_buffer_size,
};

View File

@ -131,7 +131,7 @@ const struct platform_bind platform_keys[] = {
const unsigned int platform_keys_size = sizeof(platform_keys);
static bool g_quit;
static int16_t wii_input_state(void *data, const struct retro_keybind **binds,
static int16_t gx_input_state(void *data, const struct retro_keybind **binds,
unsigned port, unsigned device,
unsigned index, unsigned id)
{
@ -144,7 +144,7 @@ static int16_t wii_input_state(void *data, const struct retro_keybind **binds,
return (binds[port][id].joykey & pad_state[port]) ? 1 : 0;
}
static void wii_free_input(void *data)
static void gx_free_input(void *data)
{
(void)data;
}
@ -154,7 +154,7 @@ static void reset_callback(void)
g_quit = true;
}
static void wii_input_set_analog_dpad_mapping(unsigned device, unsigned map_dpad_enum, unsigned controller_id)
static void gx_input_set_analog_dpad_mapping(unsigned device, unsigned map_dpad_enum, unsigned controller_id)
{
switch (device)
{
@ -233,7 +233,7 @@ static void wii_input_set_analog_dpad_mapping(unsigned device, unsigned map_dpad
}
}
static void *wii_input_initialize(void)
static void *gx_input_initialize(void)
{
PAD_Init();
#ifdef HW_RVL
@ -246,23 +246,25 @@ static void *wii_input_initialize(void)
#define STUB_DEVICE 0
static void wii_input_post_init(void)
static void gx_input_post_init(void)
{
for(unsigned i = 0; i < MAX_PADS; i++)
wii_input_set_analog_dpad_mapping(STUB_DEVICE, g_settings.input.dpad_emulation[i], i);
gx_input_set_analog_dpad_mapping(STUB_DEVICE, g_settings.input.dpad_emulation[i], i);
}
#define wii_stick_x(x) ((s8)((sin((x).ang * M_PI / 180.0f)) * (x).mag * 128.0f))
#define wii_stick_y(x) ((s8)((cos((x).ang * M_PI / 180.0f)) * (x).mag * 128.0f))
#define gx_stick_x(x) ((s8)((sin((x).ang * M_PI / 180.0f)) * (x).mag * 128.0f))
#define gx_stick_y(x) ((s8)((cos((x).ang * M_PI / 180.0f)) * (x).mag * 128.0f))
static void wii_input_poll(void *data)
static void gx_input_poll(void *data)
{
//TODO: Hack, analog stick twitchiness needs to be properly fixed
gx_video_t *gx = (gx_video_t*)driver.video_data;
(void)data;
bool quit_gc = false;
#ifdef HW_RVL
bool quit_classic = false;
bool quit_wiimote = false;
#endif
PAD_ScanPads();
#ifdef HW_RVL
@ -346,8 +348,8 @@ static void wii_input_poll(void *data)
state |= (down & WPAD_NUNCHUK_BUTTON_Z) ? GX_NUNCHUK_Z : 0;
state |= (down & WPAD_NUNCHUK_BUTTON_C) ? GX_NUNCHUK_C : 0;
s8 x = wii_stick_x(exp.nunchuk.js);
s8 y = wii_stick_y(exp.nunchuk.js);
s8 x = gx_stick_x(exp.nunchuk.js);
s8 y = gx_stick_y(exp.nunchuk.js);
if (abs(x) > JOYSTICK_THRESHOLD)
{
@ -383,16 +385,16 @@ static void wii_input_poll(void *data)
//TODO: Hack, analog stick twitchiness needs to be properly fixed
if(gx->menu_render)
{
s8 x = wii_stick_x(exp.classic.ljs);
s8 y = wii_stick_y(exp.classic.ljs);
s8 x = gx_stick_x(exp.classic.ljs);
s8 y = gx_stick_y(exp.classic.ljs);
if (abs(x) > JOYSTICK_THRESHOLD)
state |= x > 0 ? GX_CLASSIC_LSTICK_RIGHT : GX_CLASSIC_LSTICK_LEFT;
if (abs(y) > JOYSTICK_THRESHOLD)
state |= y > 0 ? GX_CLASSIC_LSTICK_UP : GX_CLASSIC_LSTICK_DOWN;
x = wii_stick_x(exp.classic.rjs);
y = wii_stick_y(exp.classic.rjs);
x = gx_stick_x(exp.classic.rjs);
y = gx_stick_y(exp.classic.rjs);
if (abs(x) > JOYSTICK_THRESHOLD)
state |= x > 0 ? GX_CLASSIC_RSTICK_RIGHT : GX_CLASSIC_RSTICK_LEFT;
@ -442,7 +444,11 @@ static void wii_input_poll(void *data)
state |= GX_WIIMOTE_HOME;
}
if (quit_gc || quit_wiimote || quit_classic)
if (quit_gc
#ifdef HW_RVL
|| quit_wiimote || quit_classic
#endif
)
state |= GX_QUIT_KEY;
pad_state[port] = state;
@ -455,7 +461,7 @@ static void wii_input_poll(void *data)
}
}
static bool wii_key_pressed(void *data, int key)
static bool gx_key_pressed(void *data, int key)
{
(void)data;
@ -466,11 +472,17 @@ static bool wii_key_pressed(void *data, int key)
case RARCH_QUIT_KEY:
if(IS_TIMER_EXPIRED(gx))
{
#ifdef HW_RVL
uint64_t goto_menu_pressed_classic = pad_state[0] & GX_CLASSIC_HOME;
uint64_t goto_menu_pressed_wiimote = pad_state[0] & GX_WIIMOTE_HOME;
#endif
uint64_t quit_rarch = pad_state[0] & GX_QUIT_KEY;
bool retval = false;
g_console.menu_enable = ((goto_menu_pressed_classic || goto_menu_pressed_wiimote || quit_rarch) && IS_TIMER_EXPIRED(gx));
g_console.menu_enable = ((quit_rarch
#ifdef HW_RVL
|| goto_menu_pressed_classic || goto_menu_pressed_wiimote)
#endif
&& IS_TIMER_EXPIRED(gx));
if(g_console.menu_enable)
{
@ -490,7 +502,7 @@ static bool wii_key_pressed(void *data, int key)
}
}
static void wii_set_default_keybind_lut(unsigned device, unsigned port)
static void gx_set_default_keybind_lut(unsigned device, unsigned port)
{
(void)port;
@ -575,15 +587,15 @@ static void wii_set_default_keybind_lut(unsigned device, unsigned port)
}
}
const input_driver_t input_wii = {
.init = wii_input_initialize,
.poll = wii_input_poll,
.input_state = wii_input_state,
.key_pressed = wii_key_pressed,
.free = wii_free_input,
.set_default_keybind_lut = wii_set_default_keybind_lut,
.set_analog_dpad_mapping = wii_input_set_analog_dpad_mapping,
.post_init = wii_input_post_init,
const input_driver_t input_gx = {
.init = gx_input_initialize,
.poll = gx_input_poll,
.input_state = gx_input_state,
.key_pressed = gx_key_pressed,
.free = gx_free_input,
.set_default_keybind_lut = gx_set_default_keybind_lut,
.set_analog_dpad_mapping = gx_input_set_analog_dpad_mapping,
.post_init = gx_input_post_init,
.max_pads = MAX_PADS,
.ident = "wii",
.ident = "gx",
};

View File

@ -85,7 +85,7 @@ enum
GX_QUIT_KEY = 1ULL << 60,
};
enum wii_device_id
enum gx_device_id
{
GX_DEVICE_GC_ID_JOYPAD_A = 0,
GX_DEVICE_GC_ID_JOYPAD_B,

View File

@ -193,7 +193,7 @@ static void gx_restart(void)
{
}
static void *wii_init(const video_info_t *video,
static void *gx_init(const video_info_t *video,
const input_driver_t **input, void **input_data)
{
if (driver.video_data)
@ -218,7 +218,7 @@ static void gx_start(void)
video_info.smooth = g_settings.video.smooth;
video_info.input_scale = 2;
driver.video_data = wii_init(&video_info, NULL, NULL);
driver.video_data = gx_init(&video_info, NULL, NULL);
//gx_video_t *gx = (gx_video_t*)driver.video_data;
VIDEO_Init();
@ -415,7 +415,7 @@ static void update_texture(const uint32_t *src,
GX_InvalidateTexAll();
}
static bool wii_frame(void *data, const void *frame,
static bool gx_frame(void *data, const void *frame,
unsigned width, unsigned height, unsigned pitch,
const char *msg)
{
@ -469,30 +469,30 @@ static bool wii_frame(void *data, const void *frame,
return true;
}
static void wii_set_nonblock_state(void *data, bool state)
static void gx_set_nonblock_state(void *data, bool state)
{
(void)data;
g_vsync = !state;
}
static bool wii_alive(void *data)
static bool gx_alive(void *data)
{
(void)data;
return true;
}
static bool wii_focus(void *data)
static bool gx_focus(void *data)
{
(void)data;
return true;
}
static void wii_free(void *data)
static void gx_free(void *data)
{
(void)data;
}
static void wii_set_rotation(void * data, uint32_t orientation)
static void gx_set_rotation(void * data, uint32_t orientation)
{
(void)data;
(void)orientation;
@ -516,15 +516,15 @@ static void wii_set_rotation(void * data, uint32_t orientation)
GX_SetArray(GX_VA_TEX0, vertex_ptr, 2 * sizeof(float));
}
const video_driver_t video_wii = {
.init = wii_init,
.frame = wii_frame,
.alive = wii_alive,
.set_nonblock_state = wii_set_nonblock_state,
.focus = wii_focus,
.free = wii_free,
.ident = "wii",
.set_rotation = wii_set_rotation,
const video_driver_t video_gx = {
.init = gx_init,
.frame = gx_frame,
.alive = gx_alive,
.set_nonblock_state = gx_set_nonblock_state,
.focus = gx_focus,
.free = gx_free,
.ident = "gx",
.set_rotation = gx_set_rotation,
.start = gx_start,
.stop = gx_stop,
.restart = gx_restart,

View File

@ -66,7 +66,7 @@ const char *config_get_default_audio(void)
case AUDIO_PS3:
return "ps3";
case AUDIO_WII:
return "wii";
return "gx";
case AUDIO_NULL:
return "null";
default:
@ -81,7 +81,7 @@ const char *config_get_default_video(void)
case VIDEO_GL:
return "gl";
case VIDEO_WII:
return "wii";
return "gx";
case VIDEO_XENON360:
return "xenon360";
case VIDEO_XDK_D3D:
@ -116,7 +116,7 @@ const char *config_get_default_input(void)
case INPUT_XINPUT:
return "xinput";
case INPUT_WII:
return "wii";
return "gx";
case INPUT_LINUXRAW:
return "linuxraw";
case INPUT_NULL: