diff --git a/Makefile.psl1ght b/Makefile.psl1ght index c5791f455b..885b01a8f4 100644 --- a/Makefile.psl1ght +++ b/Makefile.psl1ght @@ -11,6 +11,7 @@ PC_DEVELOPMENT_IP_ADDRESS = "192.168.1.7" PC_DEVELOPMENT_UDP_PORT = 3490 CC = $(PS3DEV)/ppu/bin/ppu-gcc +CXX = $(PS3DEV)/ppu/bin/ppu-g++ LD = $(PS3DEV)/ppu/bin/ppu-ld ELF_TARGET := retroarch_psl1ght.elf @@ -19,12 +20,14 @@ INCLUDE := -I. -I$(PS3DEV)/ppu/include LIBDIRS := -L$(PS3DEV)/ppu/lib -L$(PS3DEV)/portlibs/ppu/lib -L. MACHDEP := -D__CELLOS_LV2__ -D__PSL1GHT__ -CFLAGS += -Wall -std=gnu99 $(MACHDEP) $(INCLUDE) +CFLAGS += -Wall $(MACHDEP) $(INCLUDE) LDFLAGS := $(MACHDEP) LIBS := -lretro_psl1ght -laudio -lEGL -lGL -lio -lm -ljpgdec -lpngdec -lsysutil 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 + ifeq ($(HAVE_LOGGER), 1) CFLAGS += -DHAVE_LOGGER CFLAGS += -DPC_DEVELOPMENT_IP_ADDRESS=\"$(PC_DEVELOPMENT_IP_ADDRESS)\" -DPC_DEVELOPMENT_UDP_PORT=$(PC_DEVELOPMENT_UDP_PORT) @@ -37,12 +40,15 @@ endif RSXGL_DEFINES = -D__RSX__ -DGL3_PROTOTYPES -CFLAGS += -std=gnu99 -DHAVE_FILEBROWSER -DHAVE_OPENGLES20 $(RSXGL_DEFINES) -DHAVE_OSKUTIL -DHAVE_MOUSE -DHAVE_DEFAULT_RETROPAD_INPUT -DRARCH_CONSOLE -DHAVE_CONFIGFILE=1 -DHAVE_ZLIB -DHAVE_RARCH_MAIN_WRAP -DHAVE_GRIFFIN=1 -DPACKAGE_VERSION=\"0.9.6\" -Dmain=rarch_main -Wno-char-subscripts +SHARED_FLAGS := -DHAVE_FILEBROWSER $(RSXGL_DEFINES) -DHAVE_OSKUTIL -DHAVE_MOUSE -DHAVE_DEFAULT_RETROPAD_INPUT -DRARCH_CONSOLE -DHAVE_CONFIGFILE=1 -DHAVE_ZLIB -DHAVE_RARCH_MAIN_WRAP -DHAVE_GRIFFIN=1 -DPACKAGE_VERSION=\"0.9.6\" -Dmain=rarch_main -Wno-char-subscripts +CFLAGS += -std=gnu99 $(SHARED_FLAGS) +CXXFLAGS += $(SHARED_FLAGS) ifeq ($(DEBUG), 1) CFLAGS += -O0 -g else - CLFAGS += -O3 + CFLAGS += -O3 + CXXFLAGS += -03 endif all: $(ELF_TARGET) @@ -53,6 +59,9 @@ $(ELF_TARGET): $(OBJ) %.o: %.c $(CC) $(CFLAGS) -c -o $@ $< +%.o: %.cpp + $(CXX) $(CFLAGS) -c -o $@ $< + clean: rm -f $(ELF_TARGET) rm -f $(OBJ) diff --git a/console/console_settings.c b/console/console_settings.c index fba27c8347..f85c94677f 100644 --- a/console/console_settings.c +++ b/console/console_settings.c @@ -34,6 +34,9 @@ void rarch_settings_change(unsigned setting) if(g_console.aspect_ratio_index < LAST_ASPECT_RATIO) g_console.aspect_ratio_index++; break; + case S_AUDIO_MUTE: + g_extern.audio_data.mute = !g_extern.audio_data.mute; + break; case S_FRAME_ADVANCE: g_console.frame_advance_enable = true; g_console.menu_enable = false; @@ -147,6 +150,9 @@ void rarch_settings_default(unsigned setting) case S_DEF_ASPECT_RATIO: g_console.aspect_ratio_index = ASPECT_RATIO_4_3; break; + case S_DEF_AUDIO_MUTE: + g_extern.audio_data.mute = false; + break; case S_DEF_HW_TEXTURE_FILTER: g_settings.video.smooth = 1; break; diff --git a/console/console_settings.h b/console/console_settings.h index 1aee227b48..a159097f5f 100644 --- a/console/console_settings.h +++ b/console/console_settings.h @@ -31,6 +31,7 @@ enum { S_ASPECT_RATIO_DECREMENT = 0, S_ASPECT_RATIO_INCREMENT, + S_AUDIO_MUTE, S_FRAME_ADVANCE, S_HW_TEXTURE_FILTER, S_HW_TEXTURE_FILTER_2, @@ -59,6 +60,7 @@ enum enum { S_DEF_ASPECT_RATIO = 0, + S_DEF_AUDIO_MUTE, S_DEF_HW_TEXTURE_FILTER, S_DEF_HW_TEXTURE_FILTER_2, S_DEF_OVERSCAN, diff --git a/console/rgl/ps3/device_ctx.cpp b/console/rgl/ps3/device_ctx.cpp index f2028956b4..967a51f911 100644 --- a/console/rgl/ps3/device_ctx.cpp +++ b/console/rgl/ps3/device_ctx.cpp @@ -2,11 +2,21 @@ #include "rgl.h" #include "private.h" #include +#ifdef __PSL1GHT__ +#include +#else #include #include #include +#endif +#include "../../../ps3/sdk_defines.h" + +#ifdef __PSL1GHT__ +#include +#else #include #include +#endif using namespace cell::Gcm; diff --git a/console/rgl/ps3/rgl.h b/console/rgl/ps3/rgl.h index e64ebf2134..b85fd5303a 100644 --- a/console/rgl/ps3/rgl.h +++ b/console/rgl/ps3/rgl.h @@ -5,7 +5,11 @@ #include "glext.h" #include "base.hpp" +#ifdef __PSL1GHT__ +#include +#else #include +#endif #define RGL_ALIGN_FAST_TRANSFER 128 #define _RGL_MAX_COLOR_ATTACHMENTS 4 diff --git a/general.h b/general.h index 5f48377bac..f1c7ded0bd 100644 --- a/general.h +++ b/general.h @@ -254,7 +254,7 @@ struct console_settings char default_sram_dir[PATH_MAX]; char launch_app_on_exit[PATH_MAX]; float menu_font_size; -#if defined(__CELLOS_LV2__) +#if defined(__CELLOS_LV2__) && !defined(__PSL1GHT__) oskutil_params oskutil_handle; #endif }; diff --git a/gfx/gfx_common.c b/gfx/gfx_common.c index 87b95c9ac1..f5475af8b7 100644 --- a/gfx/gfx_common.c +++ b/gfx/gfx_common.c @@ -26,10 +26,14 @@ #endif #ifdef __CELLOS_LV2__ +#ifdef __PSL1GHT__ +#include +#else #include #endif +#endif -#if defined(__CELLOS_LV2__) || defined(_MSC_VER) +#if defined(__CELLOS_LV2__) && !defined(__PSL1GHT__) || defined(_MSC_VER) static int gettimeofday(struct timeval *val, void *dummy) { (void)dummy; diff --git a/ps3/frontend/menu.c b/ps3/frontend/menu.c index 20c6dca347..c846f520e0 100644 --- a/ps3/frontend/menu.c +++ b/ps3/frontend/menu.c @@ -1357,11 +1357,10 @@ static void producesettingentry(menu * menu_obj, unsigned switchvalue) break; case SETTING_EMU_AUDIO_MUTE: 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))) - { - g_extern.audio_data.mute = !g_extern.audio_data.mute; - } + rarch_settings_change(S_AUDIO_MUTE); + if(input_state & (1 << RETRO_DEVICE_ID_JOYPAD_START)) - g_extern.audio_data.mute = false; + rarch_settings_default(S_DEF_AUDIO_MUTE); break; case SETTING_ENABLE_CUSTOM_BGM: 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))) diff --git a/ps3/image.c b/ps3/image.c index 294843212f..f0f66fee65 100644 --- a/ps3/image.c +++ b/ps3/image.c @@ -82,18 +82,18 @@ static bool ps3graphics_load_jpeg(const char *path, struct texture_image *out_im #ifndef __PSL1GHT__ CtrlMallocArg MallocArg; CtrlFreeArg FreeArg; - pJpgDecDataCtrlParam dCtrlParam; + CellJpgDecDataCtrlParam dCtrlParam; #endif - pJpgDecMainHandle mHandle = PTR_NULL; - pJpgDecSubHandle sHandle = PTR_NULL; - pJpgDecThreadInParam InParam; - pJpgDecThreadOutParam OutParam; - pJpgDecSrc src; - pJpgDecOpnInfo opnInfo; - pJpgDecInfo info; - pJpgDecInParam inParam; - pJpgDecOutParam outParam; - pJpgDecDataOutInfo dOutInfo; + CellJpgDecMainHandle mHandle = PTR_NULL; + CellJpgDecSubHandle sHandle = PTR_NULL; + CellJpgDecThreadInParam InParam; + CellJpgDecThreadOutParam OutParam; + CellJpgDecSrc src; + CellJpgDecOpnInfo opnInfo; + CellJpgDecInfo info; + CellJpgDecInParam inParam; + CellJpgDecOutParam outParam; + CellJpgDecDataOutInfo dOutInfo; InParam.spu_enable = CELL_JPGDEC_SPU_THREAD_ENABLE; InParam.ppu_prio = 1001; @@ -113,12 +113,12 @@ static bool ps3graphics_load_jpeg(const char *path, struct texture_image *out_im #endif int ret_jpeg, ret = -1; - ret_jpeg = pJpgDecCreate(&mHandle, &InParam, &OutParam); + ret_jpeg = cellJpgDecCreate(&mHandle, &InParam, &OutParam); if (ret_jpeg != CELL_OK) goto error; - memset(&src, 0, sizeof(pJpgDecSrc)); + memset(&src, 0, sizeof(CellJpgDecSrc)); src.stream_select = CELL_JPGDEC_FILE; #ifdef __PSL1GHT__ src.file_name = __get_addr32(path); @@ -132,12 +132,12 @@ static bool ps3graphics_load_jpeg(const char *path, struct texture_image *out_im src.spu_enable = CELL_JPGDEC_SPU_THREAD_ENABLE; - ret = pJpgDecOpen(mHandle, &sHandle, &src, &opnInfo); + ret = cellJpgDecOpen(mHandle, &sHandle, &src, &opnInfo); if (ret != CELL_OK) goto error; - ret = pJpgDecReadHeader(mHandle, sHandle, &info); + ret = cellJpgDecReadHeader(mHandle, sHandle, &info); if (ret != CELL_OK) goto error; @@ -148,17 +148,17 @@ static bool ps3graphics_load_jpeg(const char *path, struct texture_image *out_im inParam.color_space = CELL_JPG_ARGB; inParam.down_scale = 1; inParam.color_alpha = 0xfe; - ret = pJpgDecSetParameter(mHandle, sHandle, &inParam, &outParam); + ret = cellJpgDecSetParameter(mHandle, sHandle, &inParam, &outParam); if (ret != CELL_OK) goto error; #ifdef __PSL1GHT__ uint64_t output_bytes_per_line = outParam.output_width * 4; - ret = pJpgDecDecodeData(mHandle, sHandle, (uint8_t*)out_img->pixels, &output_bytes_per_line, &dOutInfo); + ret = cellJpgDecDecodeData(mHandle, sHandle, (uint8_t*)out_img->pixels, &output_bytes_per_line, &dOutInfo); #else dCtrlParam.output_bytes_per_line = outParam.output_width * 4; - ret = pJpgDecDecodeData(mHandle, sHandle, (uint8_t*)out_img->pixels, &dCtrlParam, &dOutInfo); + ret = cellJpgDecDecodeData(mHandle, sHandle, (uint8_t*)out_img->pixels, &dCtrlParam, &dOutInfo); #endif if (ret != CELL_OK || dOutInfo.status != CELL_JPGDEC_DEC_STATUS_FINISH) @@ -167,17 +167,17 @@ static bool ps3graphics_load_jpeg(const char *path, struct texture_image *out_im out_img->width = outParam.output_width; out_img->height = outParam.output_height; - pJpgDecClose(mHandle, sHandle); - pJpgDecDestroy(mHandle); + cellJpgDecClose(mHandle, sHandle); + cellJpgDecDestroy(mHandle); return true; error: RARCH_ERR("ps3graphics_load_jpeg(): error.\n"); if (mHandle && sHandle) - pJpgDecClose(mHandle, sHandle); + cellJpgDecClose(mHandle, sHandle); if (mHandle) - pJpgDecDestroy(mHandle); + cellJpgDecDestroy(mHandle); return false; } @@ -190,18 +190,18 @@ static bool ps3graphics_load_png(const char *path, struct texture_image *out_img #ifndef __PSL1GHT__ CtrlMallocArg MallocArg; CtrlFreeArg FreeArg; - pPngDecDataCtrlParam dCtrlParam; + CellPngDecDataCtrlParam dCtrlParam; #endif - pPngDecMainHandle mHandle = PTR_NULL; - pPngDecSubHandle sHandle = PTR_NULL; - pPngDecThreadInParam InParam; - pPngDecThreadOutParam OutParam; - pPngDecSrc src; - pPngDecOpnInfo opnInfo; - pPngDecInfo info; - pPngDecInParam inParam; - pPngDecOutParam outParam; - pPngDecDataOutInfo dOutInfo; + CellPngDecMainHandle mHandle = PTR_NULL; + CellPngDecSubHandle sHandle = PTR_NULL; + CellPngDecThreadInParam InParam; + CellPngDecThreadOutParam OutParam; + CellPngDecSrc src; + CellPngDecOpnInfo opnInfo; + CellPngDecInfo info; + CellPngDecInParam inParam; + CellPngDecOutParam outParam; + CellPngDecDataOutInfo dOutInfo; InParam.spu_enable = CELL_PNGDEC_SPU_THREAD_ENABLE; InParam.ppu_prio = 512; @@ -221,12 +221,12 @@ static bool ps3graphics_load_png(const char *path, struct texture_image *out_img #endif int ret_png, ret = -1; - ret_png = pPngDecCreate(&mHandle, &InParam, &OutParam); + ret_png = cellPngDecCreate(&mHandle, &InParam, &OutParam); if (ret_png != CELL_OK) goto error; - memset(&src, 0, sizeof(pPngDecSrc)); + memset(&src, 0, sizeof(CellPngDecSrc)); src.stream_select = CELL_PNGDEC_FILE; #ifdef __PSL1GHT__ src.file_name = __get_addr32(path); @@ -240,12 +240,12 @@ static bool ps3graphics_load_png(const char *path, struct texture_image *out_img src.spu_enable = CELL_PNGDEC_SPU_THREAD_ENABLE; - ret = pPngDecOpen(mHandle, &sHandle, &src, &opnInfo); + ret = cellPngDecOpen(mHandle, &sHandle, &src, &opnInfo); if (ret != CELL_OK) goto error; - ret = pPngDecReadHeader(mHandle, sHandle, &info); + ret = cellPngDecReadHeader(mHandle, sHandle, &info); if (ret != CELL_OK) goto error; @@ -256,17 +256,17 @@ static bool ps3graphics_load_png(const char *path, struct texture_image *out_img inParam.bit_depth = 8; inParam.pack_flag = CELL_PNGDEC_1BYTE_PER_1PIXEL; inParam.alpha_select = CELL_PNGDEC_STREAM_ALPHA; - ret = pPngDecSetParameter(mHandle, sHandle, &inParam, &outParam); + ret = cellPngDecSetParameter(mHandle, sHandle, &inParam, &outParam); if (ret != CELL_OK) goto error; #ifdef __PSL1GHT__ uint64_t output_bytes_per_line = outParam.output_width * 4; - ret = pPngDecDecodeData(mHandle, sHandle, (uint8_t*)out_img->pixels, &output_bytes_per_line, &dOutInfo); + ret = cellPngDecDecodeData(mHandle, sHandle, (uint8_t*)out_img->pixels, &output_bytes_per_line, &dOutInfo); #else dCtrlParam.output_bytes_per_line = outParam.output_width * 4; - ret = pPngDecDecodeData(mHandle, sHandle, (uint8_t*)out_img->pixels, &dCtrlParam, &dOutInfo); + ret = cellPngDecDecodeData(mHandle, sHandle, (uint8_t*)out_img->pixels, &dCtrlParam, &dOutInfo); #endif if (ret != CELL_OK || dOutInfo.status != CELL_PNGDEC_DEC_STATUS_FINISH) @@ -275,8 +275,8 @@ static bool ps3graphics_load_png(const char *path, struct texture_image *out_img out_img->width = outParam.output_width; out_img->height = outParam.output_height; - pPngDecClose(mHandle, sHandle); - pPngDecDestroy(mHandle); + cellPngDecClose(mHandle, sHandle); + cellPngDecDestroy(mHandle); return true; @@ -284,9 +284,9 @@ error: RARCH_ERR("ps3graphics_load_png(): error.\n"); if (mHandle && sHandle) - pPngDecClose(mHandle, sHandle); + cellPngDecClose(mHandle, sHandle); if (mHandle) - pPngDecDestroy(mHandle); + cellPngDecDestroy(mHandle); return false; } diff --git a/ps3/ps3_audio.c b/ps3/ps3_audio.c index 450b4cc4eb..993906e0a4 100644 --- a/ps3/ps3_audio.c +++ b/ps3/ps3_audio.c @@ -73,28 +73,28 @@ static void event_loop(uint64_t data) sys_ipc_key_t key; sys_event_t event; - pAudioCreateNotifyEventQueue(&id, &key); - pAudioSetNotifyEventQueue(key); + cellAudioCreateNotifyEventQueue(&id, &key); + cellAudioSetNotifyEventQueue(key); float out_tmp[CELL_AUDIO_BLOCK_SAMPLES * AUDIO_CHANNELS] __attribute__((aligned(16))); while (!aud->quit_thread) { - pSysEventQueueReceive(id, &event, SYS_NO_TIMEOUT); + sys_event_queue_receive(id, &event, SYS_NO_TIMEOUT); - pLwMutexLock(&aud->lock, SYS_NO_TIMEOUT); + sys_lwmutex_lock(&aud->lock, SYS_NO_TIMEOUT); if (fifo_read_avail(aud->buffer) >= sizeof(out_tmp)) fifo_read(aud->buffer, out_tmp, sizeof(out_tmp)); else memset(out_tmp, 0, sizeof(out_tmp)); - pLwMutexUnlock(&aud->lock); - pLwCondSignal(&aud->cond); + sys_lwmutex_unlock(&aud->lock); + sys_lwcond_signal(&aud->cond); - pAudioAddData(aud->audio_port, out_tmp, CELL_AUDIO_BLOCK_SAMPLES, 1.0); + cellAudioAddData(aud->audio_port, out_tmp, CELL_AUDIO_BLOCK_SAMPLES, 1.0); } - pAudioRemoveNotifyEventQueue(key); - pThreadExit(0); + cellAudioRemoveNotifyEventQueue(key); + sys_ppu_thread_exit(0); } static void *ps3_audio_init(const char *device, unsigned rate, unsigned latency) @@ -108,8 +108,8 @@ static void *ps3_audio_init(const char *device, unsigned rate, unsigned latency) if (!data) return NULL; - pAudioPortParam params; - pAudioInit(); + CellAudioPortParam params; + cellAudioInit(); params.numChannels = AUDIO_CHANNELS; params.numBlocks = AUDIO_BLOCKS; #ifdef HAVE_HEADSET @@ -119,9 +119,9 @@ static void *ps3_audio_init(const char *device, unsigned rate, unsigned latency) #endif params.param_attrib = 0; - if (pAudioPortOpen(¶ms, &data->audio_port) != CELL_OK) + if (cellAudioPortOpen(¶ms, &data->audio_port) != CELL_OK) { - pAudioQuit(); + cellAudioQuit(); free(data); return NULL; } @@ -139,21 +139,24 @@ static void *ps3_audio_init(const char *device, unsigned rate, unsigned latency) #endif #ifndef __PSL1GHT__ - pLwMutexAttributeInitialize(lock_attr); - pLwMutexAttributeInitialize(cond_lock_attr); + sys_lwmutex_attribute_initialize(lock_attr); + sys_lwmutex_attribute_initialize(cond_lock_attr); sys_lwcond_attribute_initialize(cond_attr); #endif - pLwMutexCreate(&data->lock, &lock_attr); - pLwMutexCreate(&data->cond_lock, &cond_lock_attr); - pLwCondCreate(&data->cond, &data->cond_lock, &cond_attr); + sys_lwmutex_create(&data->lock, &lock_attr); + sys_lwmutex_create(&data->cond_lock, &cond_lock_attr); + sys_lwcond_create(&data->cond, &data->cond_lock, &cond_attr); - pAudioPortStart(data->audio_port); + cellAudioPortStart(data->audio_port); + sys_ppu_thread_create(&data->thread, event_loop, #ifdef __PSL1GHT__ - pThreadCreate(&data->thread, event_loop, data, 1500, 0x1000, SYS_PPU_THREAD_CREATE_JOINABLE, (char*)"sound"); + data, #else - pThreadCreate(&data->thread, event_loop, (uint64_t)data, 1500, 0x1000, SYS_PPU_THREAD_CREATE_JOINABLE, (char*)"sound"); + (uint64_t)data, #endif + 1500, 0x1000, SYS_PPU_THREAD_CREATE_JOINABLE, (char*)"sound"); + return data; } @@ -169,26 +172,26 @@ static ssize_t ps3_audio_write(void *data, const void *buf, size_t size) else { while (fifo_write_avail(aud->buffer) < size) - pLwCondWait(&aud->cond, 0); + sys_lwcond_wait(&aud->cond, 0); } - pLwMutexLock(&aud->lock, SYS_NO_TIMEOUT); + sys_lwmutex_lock(&aud->lock, SYS_NO_TIMEOUT); fifo_write(aud->buffer, buf, size); - pLwMutexUnlock(&aud->lock); + sys_lwmutex_unlock(&aud->lock); return size; } static bool ps3_audio_stop(void *data) { ps3_audio_t *aud = data; - pAudioPortStop(aud->audio_port); + cellAudioPortStop(aud->audio_port); return true; } static bool ps3_audio_start(void *data) { ps3_audio_t *aud = data; - pAudioPortStart(aud->audio_port); + cellAudioPortStart(aud->audio_port); return true; } @@ -204,17 +207,17 @@ static void ps3_audio_free(void *data) ps3_audio_t *aud = data; aud->quit_thread = true; - pAudioPortStart(aud->audio_port); - pThreadJoin(aud->thread, &val); + cellAudioPortStart(aud->audio_port); + sys_ppu_thread_join(aud->thread, &val); - pAudioPortStop(aud->audio_port); - pAudioPortClose(aud->audio_port); - pAudioQuit(); + cellAudioPortStop(aud->audio_port); + cellAudioPortClose(aud->audio_port); + cellAudioQuit(); fifo_free(aud->buffer); - pLwMutexDestroy(&aud->lock); - pLwMutexDestroy(&aud->cond_lock); - pLwCondDestroy(&aud->cond); + sys_lwmutex_destroy(&aud->lock); + sys_lwmutex_destroy(&aud->cond_lock); + sys_lwcond_destroy(&aud->cond); free(data); } diff --git a/ps3/ps3_input.c b/ps3/ps3_input.c index b45755d667..24b1511367 100644 --- a/ps3/ps3_input.c +++ b/ps3/ps3_input.c @@ -69,22 +69,22 @@ static void ps3_mouse_input_deinit(void) { - pMouseEnd(); + cellMouseEnd(); } static uint32_t ps3_mouse_input_mice_connected(void) { - pMouseInfo mouse_info; - pMouseGetInfo(&mouse_info); + CellMouseInfo mouse_info; + cellMouseGetInfo(&mouse_info); return mouse_info.now_connect; } -pMouseData ps3_mouse_input_poll_device(uint32_t id) +CellMouseData ps3_mouse_input_poll_device(uint32_t id) { - pMouseData mouse_data; + CellMouseData mouse_data; // Get new pad data - pMouseGetData(id, &mouse_data); + cellMouseGetData(id, &mouse_data); return mouse_data; } @@ -105,11 +105,11 @@ static unsigned mice_connected; uint64_t cell_pad_input_poll_device(uint32_t id) { - pPadData pad_data; + CellPadData pad_data; static uint64_t ret[MAX_PADS]; // Get new pad data - pPadGetData(id, &pad_data); + cellPadGetData(id, &pad_data); if (pad_data.len != 0) { @@ -138,13 +138,13 @@ uint64_t cell_pad_input_poll_device(uint32_t id) } static void ps3_input_poll(void *data) { - pPadInfo pad_info; + CellPadInfo2 pad_info; (void)data; for (unsigned i = 0; i < MAX_PADS; i++) state[i] = cell_pad_input_poll_device(i); - pPadGetInfo(&pad_info); + cellPadGetInfo2(&pad_info); pads_connected = pad_info.now_connect; #ifdef HAVE_MOUSE mice_connected = ps3_mouse_input_mice_connected(); @@ -155,7 +155,7 @@ static void ps3_input_poll(void *data) static int16_t ps3_mouse_device_state(void *data, unsigned player, unsigned id) { - pMouseData mouse_state = ps3_mouse_input_poll_device(player); + CellMouseData mouse_state = ps3_mouse_input_poll_device(player); switch (id) { @@ -268,7 +268,7 @@ bool oskutil_start(oskutil_params *params) if (params->flags & OSK_IN_USE) return (true); - int ret = pSysMemContainerCreate(¶ms->containerid, params->osk_memorycontainer); + int ret = sys_memory_container_create(¶ms->containerid, params->osk_memorycontainer); if(ret < 0) return (false); @@ -326,7 +326,7 @@ void oskutil_finished(oskutil_params *params) void oskutil_unload(oskutil_params *params) { - pSysMemContainerDestroy(params->containerid); + sys_memory_container_destroy(params->containerid); params->is_running = false; } @@ -339,14 +339,14 @@ void oskutil_unload(oskutil_params *params) static void ps3_free_input(void *data) { (void)data; - //pPadEnd(); + //cellPadEnd(); } static void* ps3_input_initialize(void) { - pPadInit(MAX_PADS); + cellPadInit(MAX_PADS); #ifdef HAVE_MOUSE - pMouseInit(MAX_MICE); + cellMouseInit(MAX_MICE); #endif for(unsigned i = 0; i < MAX_PADS; i++) ps3_input_map_dpad_to_stick(g_settings.input.dpad_emulation[i], i); diff --git a/ps3/sdk_defines.h b/ps3/sdk_defines.h index d918beb4a3..35c36c1988 100644 --- a/ps3/sdk_defines.h +++ b/ps3/sdk_defines.h @@ -23,33 +23,33 @@ #ifdef __PSL1GHT__ /* define all the audio/audio port functions */ -#define pAudioQuit audioQuit -#define pAudioInit audioInit -#define pAudioPortStart audioPortStart -#define pAudioPortOpen audioPortOpen -#define pAudioPortClose audioPortClose -#define pAudioPortStop audioPortStop -#define pAudioPortParam audioPortParam -#define pAudioPortOpen audioPortOpen -#define pAudioAddData audioAddData +#define cellAudioQuit audioQuit +#define cellAudioInit audioInit +#define cellAudioPortStart audioPortStart +#define cellAudioPortOpen audioPortOpen +#define cellAudioPortClose audioPortClose +#define cellAudioPortStop audioPortStop +#define CellAudioPortParam audioPortParam +#define cellAudioPortOpen audioPortOpen +#define cellAudioAddData audioAddData /* define all the event queue functions */ -#define pSysEventQueueReceive sysEventQueueReceive -#define pAudioSetNotifyEventQueue audioSetNotifyEventQueue -#define pAudioRemoveNotifyEventQueue audioRemoveNotifyEventQueue -#define pAudioCreateNotifyEventQueue audioCreateNotifyEventQueue +#define sys_event_queue_receive sysEventQueueReceive +#define cellAudioSetNotifyEventQueue audioSetNotifyEventQueue +#define cellAudioRemoveNotifyEventQueue audioRemoveNotifyEventQueue +#define cellAudioCreateNotifyEventQueue audioCreateNotifyEventQueue /* define all the lightweight mutex functions */ -#define pLwMutexDestroy sysLwMutexDestroy -#define pLwMutexLock sysLwMutexLock -#define pLwMutexUnlock sysLwMutexUnlock -#define pLwMutexCreate sysLwMutexCreate +#define sys_lwmutex_destroy sysLwMutexDestroy +#define sys_lwmutex_lock sysLwMutexLock +#define sys_lwmutex_unlock sysLwMutexUnlock +#define sys_lwmutex_create sysLwMutexCreate /* define all the lightweight condition functions */ -#define pLwCondCreate sysLwCondCreate -#define pLwCondDestroy sysLwCondDestroy -#define pLwCondWait sysLwCondWait -#define pLwCondSignal sysLwCondSignal +#define sys_lwcond_create sysLwCondCreate +#define sys_lwcond_destroy sysLwCondDestroy +#define sys_lwcond_wait sysLwCondWait +#define sys_lwcond_signal sysLwCondSignal #define CELL_AUDIO_BLOCK_SAMPLES AUDIO_BLOCK_SAMPLES #define SYS_NO_TIMEOUT 0 @@ -58,36 +58,6 @@ #define sys_lwcond_attribute_t sys_lwcond_attr_t #else - -/* define all the audio/audio port functions */ -#define pAudioQuit cellAudioQuit -#define pAudioInit cellAudioInit -#define pAudioPortStart cellAudioPortStart -#define pAudioPortOpen cellAudioPortOpen -#define pAudioPortClose cellAudioPortClose -#define pAudioPortStop cellAudioPortStop -#define pAudioPortParam CellAudioPortParam -#define pAudioAddData cellAudioAddData - -/* define all the event queue functions */ -#define pSysEventQueueReceive sys_event_queue_receive -#define pAudioSetNotifyEventQueue cellAudioSetNotifyEventQueue -#define pAudioRemoveNotifyEventQueue cellAudioRemoveNotifyEventQueue -#define pAudioCreateNotifyEventQueue cellAudioCreateNotifyEventQueue - -/* define all the lightweight mutex functions */ -#define pLwMutexDestroy sys_lwmutex_destroy -#define pLwMutexUnlock sys_lwmutex_unlock -#define pLwMutexLock sys_lwmutex_lock -#define pLwMutexCreate sys_lwmutex_create -#define pLwMutexAttributeInitialize sys_lwmutex_attribute_initialize - -/* define all the lightweight condition functions */ -#define pLwCondCreate sys_lwcond_create -#define pLwCondDestroy sys_lwcond_destroy -#define pLwCondWait sys_lwcond_wait -#define pLwCondSignal sys_lwcond_signal - #define numChannels nChannel #define numBlocks nBlock #define param_attrib attr @@ -100,35 +70,16 @@ #ifdef __PSL1GHT__ /* define all the ps3 pad structs */ -#define pPadInfo padInfo2 -#define pPadData padData +#define CellPadInfo2 padInfo2 +#define CellPadData padData /* define all the ps3 pad functions */ -#define pPadGetInfo ioPadGetInfo2 -#define pPadGetData ioPadGetData -#define pPadInit ioPadInit -#define pPadEnd ioPadEnd +#define cellPadGetInfo2 ioPadGetInfo2 +#define cellPadGetData ioPadGetData +#define cellPadInit ioPadInit +#define cellPadEnd ioPadEnd #define now_connect connected - -#else -/* define all the ps3 pad structs */ -/* #if (CELL_SDK_VERSION > 0x340000) */ -#define pPadInfo CellPadInfo2 -#define pPadGetInfo cellPadGetInfo2 -/* -#else -#define pPadInfo CellPadInfo -#define pPadGetInfo cellPadGetInfo -#endif -*/ - -#define pPadData CellPadData - -/* define all the ps3 pad functions */ -#define pPadInit cellPadInit -#define pPadEnd cellPadEnd -#define pPadGetData cellPadGetData #endif /*============================================================ @@ -137,17 +88,16 @@ #ifdef HAVE_MOUSE - #ifdef __PSL1GHT__ /* define ps3 mouse structs */ -#define pMouseInfo mouseInfo -#define pMouseData mouseData +#define CellMouseInfo mouseInfo +#define CellMouseData mouseData /* define all the ps3 mouse functions */ -#define pMouseInit ioMouseInit -#define pMouseGetData ioMouseGetData -#define pMouseEnd ioMouseEnd -#define pMouseGetInfo ioMouseGetInfo +#define cellMouseInit ioMouseInit +#define cellMouseGetData ioMouseGetData +#define cellMouseEnd ioMouseEnd +#define cellMouseGetInfo ioMouseGetInfo /* PSL1GHT does not define these in its header */ #define CELL_MOUSE_BUTTON_1 (1 << 0) /* Button 1 */ @@ -159,16 +109,6 @@ #define CELL_MOUSE_BUTTON_7 (1 << 6) /* Button 7 */ #define CELL_MOUSE_BUTTON_8 (1 << 7) /* Button 8 */ -#else -/* define ps3 mouse structs */ -#define pMouseInfo CellMouseInfo -#define pMouseData CellMouseData - -/* define all the ps3 mouse functions */ -#define pMouseInit cellMouseInit -#define pMouseGetData cellMouseGetData -#define pMouseEnd cellMouseEnd -#define pMouseGetInfo cellMouseGetInfo #endif #endif @@ -249,28 +189,28 @@ #ifdef __PSL1GHT__ /* define all of the JPEG/PNG structs */ -#define pJpgDecMainHandle int -#define pPngDecMainHandle int -#define pJpgDecSubHandle int -#define pPngDecSubHandle int -#define pJpgDecThreadInParam jpgDecThreadInParam -#define pPngDecThreadInParam pngDecThreadInParam -#define pJpgDecThreadOutParam jpgDecThreadOutParam -#define pPngDecThreadOutParam pngDecThreadOutParam -#define pJpgDecSrc jpgDecSource -#define pPngDecSrc pngDecSource -#define pJpgDecOpnInfo uint32_t -#define pPngDecOpnInfo uint32_t -#define pJpgDecInfo jpgDecInfo -#define pPngDecInfo pngDecInfo -#define pJpgDecInParam jpgDecInParam -#define pPngDecInParam pngDecInParam -#define pJpgDecOutParam jpgDecOutParam -#define pPngDecOutParam pngDecOutParam -#define pJpgDecDataOutInfo jpgDecDataInfo -#define pPngDecDataOutInfo pngDecDataInfo -#define pJpgDecDataCtrlParam uint64_t -#define pPngDecDataCtrlParam uint64_t +#define CellJpgDecMainHandle int +#define CellPngDecMainHandle int +#define CellJpgDecSubHandle int +#define CellPngDecSubHandle int +#define CellJpgDecThreadInParam jpgDecThreadInParam +#define CellPngDecThreadInParam pngDecThreadInParam +#define CellJpgDecThreadOutParam jpgDecThreadOutParam +#define CellPngDecThreadOutParam pngDecThreadOutParam +#define CellJpgDecSrc jpgDecSource +#define CellPngDecSrc pngDecSource +#define CellJpgDecOpnInfo uint32_t +#define CellPngDecOpnInfo uint32_t +#define CellJpgDecInfo jpgDecInfo +#define CellPngDecInfo pngDecInfo +#define CellJpgDecInParam jpgDecInParam +#define CellPngDecInParam pngDecInParam +#define CellJpgDecOutParam jpgDecOutParam +#define CellPngDecOutParam pngDecOutParam +#define CellJpgDecDataOutInfo jpgDecDataInfo +#define CellPngDecDataOutInfo pngDecDataInfo +#define CellJpgDecDataCtrlParam uint64_t +#define CellPngDecDataCtrlParam uint64_t #define spu_enable enable #define stream_select stream @@ -282,21 +222,21 @@ #define output_height height /* define all of the JPEG/PNG functions */ -#define pJpgDecCreate jpgDecCreate -#define pJpgDecOpen jpgDecOpen -#define pJpgDecReadHeader jpgDecReadHeader -#define pJpgDecSetParameter jpgDecSetParameter -#define pJpgDecDecodeData jpgDecDecodeData -#define pJpgDecClose jpgDecClose -#define pJpgDecDestroy jpgDecDestroy +#define cellJpgDecCreate jpgDecCreate +#define cellJpgDecOpen jpgDecOpen +#define cellJpgDecReadHeader jpgDecReadHeader +#define cellJpgDecSetParameter jpgDecSetParameter +#define cellJpgDecDecodeData jpgDecDecodeData +#define cellJpgDecClose jpgDecClose +#define cellJpgDecDestroy jpgDecDestroy -#define pPngDecCreate pngDecCreate -#define pPngDecOpen pngDecOpen -#define pPngDecReadHeader pngDecReadHeader -#define pPngDecSetParameter pngDecSetParameter -#define pPngDecDecodeData pngDecDecodeData -#define pPngDecClose pngDecClose -#define pPngDecDestroy pngDecDestroy +#define cellPngDecCreate pngDecCreate +#define cellPngDecOpen pngDecOpen +#define cellPngDecReadHeader pngDecReadHeader +#define cellPngDecSetParameter pngDecSetParameter +#define cellPngDecDecodeData pngDecDecodeData +#define cellPngDecClose pngDecClose +#define cellPngDecDestroy pngDecDestroy /* define all of the JPEG/PNG defines */ #define CELL_PNGDEC_SPU_THREAD_ENABLE 1 @@ -317,30 +257,6 @@ #define PTR_NULL 0 #else -/* define all of the JPEG/PNG structs */ -#define pJpgDecMainHandle CellJpgDecMainHandle -#define pPngDecMainHandle CellPngDecMainHandle -#define pJpgDecSubHandle CellJpgDecSubHandle -#define pPngDecSubHandle CellPngDecSubHandle -#define pJpgDecThreadInParam CellJpgDecThreadInParam -#define pPngDecThreadInParam CellPngDecThreadInParam -#define pJpgDecThreadOutParam CellJpgDecThreadOutParam -#define pPngDecThreadOutParam CellPngDecThreadOutParam -#define pJpgDecSrc CellJpgDecSrc -#define pPngDecSrc CellPngDecSrc -#define pJpgDecOpnInfo CellJpgDecOpnInfo -#define pPngDecOpnInfo CellPngDecOpnInfo -#define pJpgDecInfo CellJpgDecInfo -#define pPngDecInfo CellPngDecInfo -#define pJpgDecInParam CellJpgDecInParam -#define pPngDecInParam CellPngDecInParam -#define pJpgDecOutParam CellJpgDecOutParam -#define pPngDecOutParam CellPngDecOutParam -#define pJpgDecDataOutInfo CellJpgDecDataOutInfo -#define pPngDecDataOutInfo CellPngDecDataOutInfo -#define pJpgDecDataCtrlParam CellJpgDecDataCtrlParam -#define pPngDecDataCtrlParam CellPngDecDataCtrlParam - /* define the JPEG/PNG struct member names */ #define spu_enable spuThreadEnable #define ppu_prio ppuThreadPriority @@ -368,23 +284,6 @@ #define pack_flag outputPackFlag #define alpha_select outputAlphaSelect -/* define all the JPEG/PNG functions */ -#define pJpgDecCreate cellJpgDecCreate -#define pJpgDecOpen cellJpgDecOpen -#define pJpgDecReadHeader cellJpgDecReadHeader -#define pJpgDecSetParameter cellJpgDecSetParameter -#define pJpgDecDecodeData cellJpgDecDecodeData -#define pJpgDecClose cellJpgDecClose -#define pJpgDecDestroy cellJpgDecDestroy - -#define pPngDecCreate cellPngDecCreate -#define pPngDecOpen cellPngDecOpen -#define pPngDecReadHeader cellPngDecReadHeader -#define pPngDecSetParameter cellPngDecSetParameter -#define pPngDecDecodeData cellPngDecDecodeData -#define pPngDecClose cellPngDecClose -#define pPngDecDestroy cellPngDecDestroy - #define PTR_NULL NULL #endif @@ -395,16 +294,11 @@ #ifdef __PSL1GHT__ /* define all the thread functions */ -#define pThreadCreate sysThreadCreate -#define pThreadJoin sysThreadJoin -#define pThreadExit sysThreadExit +#define sys_ppu_thread_create sysThreadCreate +#define sys_ppu_thread_join sysThreadJoin +#define sys_ppu_thread_exit sysThreadExit #define SYS_PPU_THREAD_CREATE_JOINABLE 0 /* FIXME - not sure if this is correct */ -#else -/* define all the thread functions */ -#define pThreadCreate sys_ppu_thread_create -#define pThreadJoin sys_ppu_thread_join -#define pThreadExit sys_ppu_thread_exit #endif /*============================================================ @@ -412,11 +306,37 @@ ============================================================ */ #ifdef __PSL1GHT__ -#define pSysMemContainerCreate sysMemContainerCreate -#define pSysMemContainerDestroy sysMemContainerDestroy -#else -#define pSysMemContainerCreate sys_memory_container_create -#define pSysMemContainerDestroy sys_memory_container_destroy +#define sys_memory_container_create sysMemContainerCreate +#define sys_memory_container_destroy sysMemContainerDestroy +#endif + +/*============================================================ + RSX PROTOTYPES +============================================================ */ + +#ifdef __PSL1GHT__ +#define CELL_GCM_FALSE GCM_FALSE +#define CELL_GCM_TRUE GCM_TRUE + +#define CELL_GCM_TEXTURE_NEAREST GCM_TEXTURE_NEAREST + +#define CELL_GCM_ONE GCM_ONE +#define CELL_GCM_ZERO GCM_ZERO + +#define CELL_GCM_SMOOTH GCM_SMOOTH + +#define CellGcmSurface gcmSurface +#define CellGcmTexture gcmTexture + +#define cellGcmSetWaitFlip gcmSetWaitFlip +#define cellGcmFlush rsxFlushBuffer +#define cellGcmSetFlipMode gcmSetFlipMode +#define cellGcmSetFlip gcmSetFlip +#define cellGcmGetLabelAddress gcmGetLabelAddress +#define cellGcmUnbindTile gcmUnbindTile +#define cellGcmBindTile gcmBindTile +#define cellGcmSetTileInfo gcmSetTileInfo +#define cellGcmAddressToOffset gcmAddressToOffset #endif #endif diff --git a/wii/frontend/main.c b/wii/frontend/main.c index c3805f9ca7..bddfa439d4 100644 --- a/wii/frontend/main.c +++ b/wii/frontend/main.c @@ -87,6 +87,7 @@ static bool get_rom_path(rgui_handle_t *rgui) { uint16_t old_input_state = 0; bool can_quit = false; + bool first = true; for (;;) { @@ -118,6 +119,8 @@ static bool get_rom_path(rgui_handle_t *rgui) action = RGUI_ACTION_UP; else if (trigger_state & (1 << RETRO_DEVICE_ID_JOYPAD_DOWN)) action = RGUI_ACTION_DOWN; + else if (trigger_state & (1 << RETRO_DEVICE_ID_JOYPAD_SELECT) && !first) // don't catch start+select+l+r when exiting + action = RGUI_ACTION_SETTINGS; const char *ret = rgui_iterate(rgui, action); video_wii.frame(NULL, menu_framebuf, @@ -133,6 +136,7 @@ static bool get_rom_path(rgui_handle_t *rgui) } old_input_state = input_state; + first = false; rarch_sleep(10); } } diff --git a/wii/frontend/rgui.c b/wii/frontend/rgui.c index be446ff4cf..005b4b0d29 100644 --- a/wii/frontend/rgui.c +++ b/wii/frontend/rgui.c @@ -44,6 +44,7 @@ struct rgui_handle rgui_list_t *folder_buf; size_t directory_ptr; bool need_refresh; + rgui_mode_t mode; char path_buf[PATH_MAX]; @@ -163,7 +164,7 @@ static void blit_line(rgui_handle_t *rgui, } } -static void render_text(rgui_handle_t *rgui, size_t begin, size_t end) +static void render_background(rgui_handle_t *rgui) { fill_rect(rgui->frame_buf, rgui->frame_buf_pitch, 0, 0, RGUI_WIDTH, RGUI_HEIGHT, gray_filler); @@ -179,11 +180,23 @@ static void render_text(rgui_handle_t *rgui, size_t begin, size_t end) fill_rect(rgui->frame_buf, rgui->frame_buf_pitch, RGUI_WIDTH - 10, 5, 5, RGUI_HEIGHT - 10, green_filler); +} - char title[TERM_WIDTH - 1]; - const char *dir; - rgui_list_back(rgui->path_stack, &dir, NULL, NULL); - snprintf(title, sizeof(title), "FILE BROWSER: %s", dir); +static void render_text(rgui_handle_t *rgui, size_t begin, size_t end) +{ + render_background(rgui); + + char title[TERM_WIDTH]; + if (rgui->mode == RGUI_FILEBROWSER) + { + const char *dir; + rgui_list_back(rgui->path_stack, &dir, NULL, NULL); + snprintf(title, sizeof(title), "FILE BROWSER: %s", dir); + } + else + { + snprintf(title, sizeof(title), "SETTINGS"); + } blit_line(rgui, TERM_START_X + 15, 15, title, true); unsigned x = TERM_START_X; @@ -197,22 +210,39 @@ static void render_text(rgui_handle_t *rgui, size_t begin, size_t end) char message[TERM_WIDTH + 1]; char *type_str; + int w; switch (type) { case RGUI_FILE_PLAIN: type_str = "(FILE)"; + w = 6; break; case RGUI_FILE_DIRECTORY: type_str = "(DIR)"; + w = 5; break; case RGUI_FILE_DEVICE: type_str = "(DEV)"; + w = 5; + break; + case RGUI_SETTINGS_VIDEO_FILTER: + type_str = g_settings.video.smooth ? "Bilinear filtering" : "Point filtering"; + w = 18; + break; + case RGUI_SETTINGS_AUDIO_MUTE: + type_str = g_extern.audio_data.mute ? "ON" : "OFF"; + w = 18; + break; + default: + type_str = ""; + w = 0; break; } - snprintf(message, sizeof(message), "%c %-*s %6s\n", + snprintf(message, sizeof(message), "%c %-*s %-*s\n", i == rgui->directory_ptr ? '>' : ' ', - TERM_WIDTH - (6 + 1 + 2), + TERM_WIDTH - (w + 1 + 2), path, + w, type_str); blit_line(rgui, x, y, message, i == rgui->directory_ptr); @@ -257,8 +287,105 @@ static void render_messagebox(rgui_handle_t *rgui, const char *message) free(msg); } +static void rgui_settings_toggle_setting(rgui_file_type_t setting) +{ + switch (setting) + { + /*case RGUI_SETTINGS_VIDEO_STRETCH: + + break;*/ + + case RGUI_SETTINGS_VIDEO_FILTER: + rarch_settings_change(S_HW_TEXTURE_FILTER); + break; + case RGUI_SETTINGS_AUDIO_MUTE: + rarch_settings_change(S_AUDIO_MUTE); + break; + default: + break; + } +} + +static void rgui_settings_populate_entries(rgui_handle_t *rgui) +{ + rgui_list_clear(rgui->folder_buf); + + rgui_list_push(rgui->folder_buf, "Hardware filtering", RGUI_SETTINGS_VIDEO_FILTER, 0); + rgui_list_push(rgui->folder_buf, "Mute Audio", RGUI_SETTINGS_AUDIO_MUTE, 0); +} + +static bool rgui_settings_iterate(rgui_handle_t *rgui, rgui_action_t action) +{ + switch (action) + { + case RGUI_ACTION_UP: + if (rgui->directory_ptr > 0) + rgui->directory_ptr--; + else + rgui->directory_ptr = rgui_list_size(rgui->folder_buf) - 1; + break; + + case RGUI_ACTION_DOWN: + if (rgui->directory_ptr + 1 < rgui_list_size(rgui->folder_buf)) + rgui->directory_ptr++; + else + rgui->directory_ptr = 0; + break; + + case RGUI_ACTION_LEFT: + case RGUI_ACTION_CANCEL: + case RGUI_ACTION_SETTINGS: + rgui->mode = RGUI_FILEBROWSER; + return true; + break; + + case RGUI_ACTION_RIGHT: + case RGUI_ACTION_OK: + { + rgui_file_type_t type; + rgui_list_at(rgui->folder_buf, rgui->directory_ptr, NULL, &type, NULL); + rgui_settings_toggle_setting(type); + break; + } + + case RGUI_ACTION_REFRESH: + rgui_settings_populate_entries(rgui); + rgui->directory_ptr = 0; + break; + + default: + break; + } + + size_t begin = rgui->directory_ptr >= TERM_HEIGHT / 2 ? + rgui->directory_ptr - TERM_HEIGHT / 2 : 0; + size_t end = rgui->directory_ptr + TERM_HEIGHT <= rgui_list_size(rgui->folder_buf) ? + rgui->directory_ptr + TERM_HEIGHT : rgui_list_size(rgui->folder_buf); + + if (end - begin > TERM_HEIGHT) + end = begin + TERM_HEIGHT; + + render_text(rgui, begin, end); + + return false; +} + const char *rgui_iterate(rgui_handle_t *rgui, rgui_action_t action) { + start: + if (rgui->mode == RGUI_SETTINGS) + { + if (rgui_settings_iterate(rgui, action)) + { + action = RGUI_ACTION_REFRESH; + goto start; + } + else + { + return NULL; + } + } + bool found = false; switch (action) { @@ -340,6 +467,11 @@ const char *rgui_iterate(rgui_handle_t *rgui, rgui_action_t action) rgui->need_refresh = true; break; + case RGUI_ACTION_SETTINGS: + rgui->mode = RGUI_SETTINGS; + action = RGUI_ACTION_REFRESH; + goto start; + default: break; } diff --git a/wii/frontend/rgui.h b/wii/frontend/rgui.h index ed06f12b04..454eed5002 100644 --- a/wii/frontend/rgui.h +++ b/wii/frontend/rgui.h @@ -29,7 +29,12 @@ typedef enum { RGUI_FILE_PLAIN, RGUI_FILE_DIRECTORY, - RGUI_FILE_DEVICE + RGUI_FILE_DEVICE, + + // settings options are done here too + //RGUI_SETTINGS_VIDEO_STRETCH, + RGUI_SETTINGS_VIDEO_FILTER, + RGUI_SETTINGS_AUDIO_MUTE } rgui_file_type_t; typedef enum @@ -41,11 +46,18 @@ typedef enum RGUI_ACTION_OK, RGUI_ACTION_CANCEL, RGUI_ACTION_REFRESH, + RGUI_ACTION_SETTINGS, RGUI_ACTION_NOOP } rgui_action_t; typedef struct rgui_handle rgui_handle_t; +typedef enum +{ + RGUI_FILEBROWSER = 0, + RGUI_SETTINGS +} rgui_mode_t; + typedef void (*rgui_file_enum_cb_t)(void *ctx, const char *path, rgui_file_type_t file_type, size_t directory_ptr); typedef bool (*rgui_folder_enum_cb_t)(const char *directory, diff --git a/wii/input.c b/wii/input.c index 3cf83e151a..f1a4ca8a52 100644 --- a/wii/input.c +++ b/wii/input.c @@ -42,7 +42,11 @@ static int16_t wii_input_state(void *data, const struct retro_keybind **binds, unsigned player = port; - return pad_state[player][id] || wpad_state[player][id]; + return pad_state[player][id] +#ifdef HW_RVL + || wpad_state[player][id] +#endif + ; } static void wii_free_input(void *data) @@ -102,18 +106,22 @@ static void wii_input_poll(void *data) uint32_t down = WPAD_ButtonsHeld(i) | WPAD_ButtonsDown(i); down &= ~WPAD_ButtonsUp(i); - wpad_state[i][RETRO_DEVICE_ID_JOYPAD_B] = down & WPAD_CLASSIC_BUTTON_B; + wpad_state[i][RETRO_DEVICE_ID_JOYPAD_B] = down & (WPAD_BUTTON_B | WPAD_CLASSIC_BUTTON_B); wpad_state[i][RETRO_DEVICE_ID_JOYPAD_Y] = down & WPAD_CLASSIC_BUTTON_Y; - wpad_state[i][RETRO_DEVICE_ID_JOYPAD_SELECT] = down & WPAD_CLASSIC_BUTTON_MINUS; - wpad_state[i][RETRO_DEVICE_ID_JOYPAD_START] = down & WPAD_CLASSIC_BUTTON_PLUS; - wpad_state[i][RETRO_DEVICE_ID_JOYPAD_UP] = down & WPAD_CLASSIC_BUTTON_UP; - wpad_state[i][RETRO_DEVICE_ID_JOYPAD_DOWN] = down & WPAD_CLASSIC_BUTTON_DOWN; - wpad_state[i][RETRO_DEVICE_ID_JOYPAD_LEFT] = down & WPAD_CLASSIC_BUTTON_LEFT; - wpad_state[i][RETRO_DEVICE_ID_JOYPAD_RIGHT] = down & WPAD_CLASSIC_BUTTON_RIGHT; - wpad_state[i][RETRO_DEVICE_ID_JOYPAD_A] = down & WPAD_CLASSIC_BUTTON_A; + wpad_state[i][RETRO_DEVICE_ID_JOYPAD_SELECT] = down & (WPAD_BUTTON_MINUS | WPAD_CLASSIC_BUTTON_MINUS); + wpad_state[i][RETRO_DEVICE_ID_JOYPAD_START] = down & (WPAD_BUTTON_PLUS | WPAD_CLASSIC_BUTTON_PLUS); + wpad_state[i][RETRO_DEVICE_ID_JOYPAD_UP] = down & (WPAD_BUTTON_UP | WPAD_CLASSIC_BUTTON_UP); + wpad_state[i][RETRO_DEVICE_ID_JOYPAD_DOWN] = down & (WPAD_BUTTON_DOWN | WPAD_CLASSIC_BUTTON_DOWN); + wpad_state[i][RETRO_DEVICE_ID_JOYPAD_LEFT] = down & (WPAD_BUTTON_LEFT | WPAD_CLASSIC_BUTTON_LEFT); + wpad_state[i][RETRO_DEVICE_ID_JOYPAD_RIGHT] = down & (WPAD_BUTTON_RIGHT | WPAD_CLASSIC_BUTTON_RIGHT); + wpad_state[i][RETRO_DEVICE_ID_JOYPAD_A] = down & (WPAD_BUTTON_A | WPAD_CLASSIC_BUTTON_A); wpad_state[i][RETRO_DEVICE_ID_JOYPAD_X] = down & WPAD_CLASSIC_BUTTON_X; wpad_state[i][RETRO_DEVICE_ID_JOYPAD_L] = down & WPAD_CLASSIC_BUTTON_FULL_L; wpad_state[i][RETRO_DEVICE_ID_JOYPAD_R] = down & WPAD_CLASSIC_BUTTON_FULL_R; + + if (down & (WPAD_BUTTON_HOME | WPAD_CLASSIC_BUTTON_HOME) && i == 0) + wpad_state[0][RETRO_DEVICE_ID_JOYPAD_L] = wpad_state[0][RETRO_DEVICE_ID_JOYPAD_R] = + wpad_state[0][RETRO_DEVICE_ID_JOYPAD_START] = wpad_state[0][RETRO_DEVICE_ID_JOYPAD_SELECT] = true; } #endif } @@ -124,19 +132,23 @@ static bool wii_key_pressed(void *data, int key) switch (key) { case RARCH_QUIT_KEY: - return g_quit || + { + bool r = g_quit || (pad_state[0][RETRO_DEVICE_ID_JOYPAD_SELECT] && pad_state[0][RETRO_DEVICE_ID_JOYPAD_START] && pad_state[0][RETRO_DEVICE_ID_JOYPAD_L] && pad_state[0][RETRO_DEVICE_ID_JOYPAD_R]) #ifdef HW_RVL - || + || (wpad_state[0][RETRO_DEVICE_ID_JOYPAD_SELECT] && wpad_state[0][RETRO_DEVICE_ID_JOYPAD_START] && wpad_state[0][RETRO_DEVICE_ID_JOYPAD_L] && wpad_state[0][RETRO_DEVICE_ID_JOYPAD_R]) #endif - ; + ; + g_quit = false; + return r; + } default: return false; }