diff --git a/console/librsound/librsound.c b/console/librsound/librsound.c
index c3d4ce3596..798ec36429 100644
--- a/console/librsound/librsound.c
+++ b/console/librsound/librsound.c
@@ -1,3 +1,21 @@
+/* SSNES - A Super Ninteno Entertainment System (SNES) Emulator frontend for libsnes.
+ * Copyright (C) 2010-2012 - Hans-Kristian Arntzen
+ * Copyright (C) 2011-2012 - Daniel De Matteis
+ *
+ * Some code herein may be based on code found in BSNES.
+ *
+ * SSNES is free software: you can redistribute it and/or modify it under the terms
+ * of the GNU General Public License as published by the Free Software Found-
+ * ation, either version 3 of the License, or (at your option) any later version.
+ *
+ * SSNES is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with SSNES.
+ * If not, see .
+ */
+
/* RSound - A PCM audio client/server
* Copyright (C) 2010 - Hans-Kristian Arntzen
*
@@ -78,7 +96,7 @@ enum rsd_conn_type
static inline int rsnd_is_little_endian(void);
static inline void rsnd_swap_endian_16(uint16_t * x);
static inline void rsnd_swap_endian_32(uint32_t * x);
-static inline int rsnd_format_to_samplesize(enum rsd_format fmt);
+static inline int rsnd_format_to_samplesize(uint16_t fmt);
static int rsnd_connect_server(rsound_t *rd);
static int rsnd_send_header_info(rsound_t *rd);
static int rsnd_get_backend_info(rsound_t *rd);
@@ -137,7 +155,7 @@ static inline void rsnd_swap_endian_32 ( uint32_t * x )
(*x << 24);
}
-static inline int rsnd_format_to_samplesize ( enum rsd_format fmt )
+static inline int rsnd_format_to_samplesize ( uint16_t fmt )
{
switch(fmt)
{
@@ -178,6 +196,7 @@ int rsd_samplesize( rsound_t *rd )
static int rsnd_connect_server( rsound_t *rd )
{
struct sockaddr_in addr;
+ struct pollfd fd;
int i = 1;
memset(&addr, 0, sizeof(addr));
@@ -214,10 +233,8 @@ static int rsnd_connect_server( rsound_t *rd )
/* Nonblocking connect with 3 second timeout */
connect(rd->conn.socket, (struct sockaddr*)&addr, sizeof(addr));
- struct pollfd fd = {
- .fd = rd->conn.socket,
- .events = POLLOUT
- };
+ fd.fd = rd->conn.socket;
+ fd.events = POLLOUT;
rsnd_poll(&fd, 1, 3000);
if (!(fd.revents & POLLOUT))
diff --git a/general.h b/general.h
index 47cda8c995..e9cbd29606 100644
--- a/general.h
+++ b/general.h
@@ -189,6 +189,10 @@ struct console_settings
bool triple_buffering_enable;
float overscan_amount;
uint32_t aspect_ratio_index;
+ uint32_t custom_viewport_width;
+ uint32_t custom_viewport_height;
+ uint32_t custom_viewport_x;
+ uint32_t custom_viewport_y;
uint32_t emulator_initialized;
uint32_t external_launcher_support;
uint32_t screen_orientation;
@@ -197,6 +201,7 @@ struct console_settings
uint32_t ingame_menu_item;
uint32_t initial_resolution_id;
uint32_t mode_switch;
+ uint32_t sound_mode;
uint32_t *supported_resolutions;
uint32_t supported_resolutions_count;
uint32_t control_timer_expiration_frame_count;
@@ -207,6 +212,7 @@ struct console_settings
char cgp_path[PATH_MAX];
char input_cfg_path[PATH_MAX];
char rom_path[PATH_MAX];
+ char rsound_ip_address[PATH_MAX];
char aspect_ratio_name[PATH_MAX];
char default_rom_startup_dir[PATH_MAX];
char default_savestate_dir[PATH_MAX];
diff --git a/ps3/main.c b/ps3/main.c
index 28f3e5bfd4..6be2df3c7b 100644
--- a/ps3/main.c
+++ b/ps3/main.c
@@ -160,6 +160,11 @@ static void set_default_settings(void)
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.custom_viewport_width = 0;
+ g_console.custom_viewport_height = 0;
+ g_console.custom_viewport_x = 0;
+ g_console.custom_viewport_y = 0;
// g_extern
g_extern.state_slot = 0;
@@ -234,7 +239,12 @@ static void init_settings(bool load_libsnes_path)
CONFIG_GET_BOOL_CONSOLE(triple_buffering_enable, "triple_buffering_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(custom_viewport_x, "custom_viewport_x");
+ CONFIG_GET_INT_CONSOLE(custom_viewport_y, "custom_viewport_y");
+ CONFIG_GET_INT_CONSOLE(custom_viewport_width, "custom_viewport_width");
+ CONFIG_GET_INT_CONSOLE(custom_viewport_height, "custom_viewport_height");
CONFIG_GET_INT_CONSOLE(screen_orientation, "screen_orientation");
+ CONFIG_GET_INT_CONSOLE(sound_mode, "sound_mode");
CONFIG_GET_STRING_CONSOLE(aspect_ratio_name, "aspect_ratio_name");
CONFIG_GET_STRING_CONSOLE(default_rom_startup_dir, "default_rom_startup_dir");
CONFIG_GET_FLOAT_CONSOLE(menu_font_size, "menu_font_size");
@@ -282,8 +292,13 @@ static void save_settings(void)
config_set_bool(conf, "screenshots_enable", g_console.screenshots_enable);
config_set_bool(conf, "throttle_enable", g_console.throttle_enable);
config_set_bool(conf, "triple_buffering_enable", g_console.triple_buffering_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.custom_viewport_width);
+ config_set_int(conf, "custom_viewport_height", g_console.custom_viewport_height);
+ config_set_int(conf, "custom_viewport_x", g_console.custom_viewport_x);
+ config_set_int(conf, "custom_viewport_y", g_console.custom_viewport_y);
config_set_int(conf, "screen_orientation", g_console.screen_orientation);
config_set_string(conf, "aspect_ratio_name", g_console.aspect_ratio_name);
config_set_string(conf, "default_rom_startup_dir", g_console.default_rom_startup_dir);
@@ -643,7 +658,6 @@ begin_shutdown:
{
SSNES_LOG("SELF file is not of NPDRM type, trying another approach to boot it...\n");
sys_game_process_exitspawn(g_console.launch_app_on_exit, NULL, NULL, NULL, 0, 1000, SYS_PROCESS_PRIMARY_STACK_SIZE_1M);
-
}
sceNpTerm();
cellSysmoduleUnloadModule(CELL_SYSMODULE_SYSUTIL_NP);
diff --git a/ps3/menu.c b/ps3/menu.c
index e40a4f9b8e..95e4a8efdd 100644
--- a/ps3/menu.c
+++ b/ps3/menu.c
@@ -564,6 +564,21 @@ static void set_setting_label(menu * menu_obj, uint64_t currentsetting)
case SETTING_DEFAULT_VIDEO_ALL:
break;
case SETTING_SOUND_MODE:
+ switch(g_console.sound_mode)
+ {
+ case SOUND_MODE_NORMAL:
+ snprintf(menu_obj->items[currentsetting].comment, sizeof(menu_obj->items[currentsetting].comment), "INFO - [Sound Output] is set to 'Normal' - normal audio output will be\nused.");
+ snprintf(menu_obj->items[currentsetting].setting_text, sizeof(menu_obj->items[currentsetting].setting_text), "Normal");
+ break;
+ case SOUND_MODE_RSOUND:
+ snprintf(menu_obj->items[currentsetting].comment, sizeof(menu_obj->items[currentsetting].comment), "INFO - [Sound Output] is set to 'RSound' - the sound will be streamed over the\n network to the RSound audio server." );
+ snprintf(menu_obj->items[currentsetting].setting_text, sizeof(menu_obj->items[currentsetting].setting_text), "RSound");
+ break;
+ case SOUND_MODE_HEADSET:
+ snprintf(menu_obj->items[currentsetting].comment, sizeof(menu_obj->items[currentsetting].comment), "INFO - [Sound Output] is set to 'USB/Bluetooth Headset' - sound will\n be output through the headset");
+ snprintf(menu_obj->items[currentsetting].setting_text, sizeof(menu_obj->items[currentsetting].setting_text), "USB/Bluetooth Headset");
+ break;
+ }
break;
case SETTING_RSOUND_SERVER_IP_ADDRESS:
break;
@@ -1504,8 +1519,51 @@ static void producesettingentry(menu * menu_obj, uint64_t switchvalue)
case SETTING_DEFAULT_VIDEO_ALL:
break;
case SETTING_SOUND_MODE:
+ if(CTRL_LEFT(state) || CTRL_LSTICK_LEFT(state))
+ {
+ if(g_console.sound_mode != SOUND_MODE_NORMAL)
+ {
+ g_console.sound_mode--;
+ //emulator_toggle_sound(g_console.sound_mode);
+ set_delay = DELAY_MEDIUM;
+ }
+ }
+ if(CTRL_RIGHT(state) || CTRL_LSTICK_RIGHT(state) || CTRL_CROSS(state))
+ {
+ if(g_console.sound_mode < SOUND_MODE_HEADSET)
+ {
+ g_console.sound_mode++;
+ //emulator_toggle_sound(g_console.sound_mode);
+ set_delay = DELAY_MEDIUM;
+ }
+ }
+ if(CTRL_START(state))
+ {
+ g_console.sound_mode = SOUND_MODE_NORMAL;
+ //emulator_toggle_sound(g_console.sound_mode);
+ set_delay = DELAY_MEDIUM;
+ }
break;
case SETTING_RSOUND_SERVER_IP_ADDRESS:
+ if(CTRL_LEFT(state) || CTRL_LSTICK_LEFT(state) || CTRL_RIGHT(state) || CTRL_CROSS(state) | CTRL_LSTICK_RIGHT(state) )
+ {
+ oskutil_write_initial_message(&g_console.oskutil_handle, L"192.168.1.1");
+ oskutil_write_message(&g_console.oskutil_handle, L"Enter IP address for the RSound Server.");
+ oskutil_start(&g_console.oskutil_handle);
+ while(OSK_IS_RUNNING(g_console.oskutil_handle))
+ {
+ glClear(GL_COLOR_BUFFER_BIT);
+ ps3graphics_draw_menu();
+ video_gl.swap(NULL);
+ cell_console_poll();
+ cellSysutilCheckCallback();
+ }
+
+ if(g_console.oskutil_handle.text_can_be_fetched)
+ strcpy(g_console.rsound_ip_address, OUTPUT_TEXT_STRING(g_console.oskutil_handle));
+ }
+ if(CTRL_START(state))
+ strcpy(g_console.rsound_ip_address, "0.0.0.0");
break;
case SETTING_DEFAULT_AUDIO_ALL:
break;
diff --git a/ps3/ps3_audio.c b/ps3/ps3_audio.c
index 7d57edcdaf..cbcd953409 100644
--- a/ps3/ps3_audio.c
+++ b/ps3/ps3_audio.c
@@ -18,6 +18,7 @@
#include "../driver.h"
#include "../general.h"
+#include "shared.h"
#include
#include
#include
@@ -90,7 +91,10 @@ static void *ps3_audio_init(const char *device, unsigned rate, unsigned latency)
cellAudioInit();
params.nChannel = AUDIO_CHANNELS;
params.nBlock = AUDIO_BLOCKS;
- params.attr = 0;
+ if(g_console.sound_mode == SOUND_MODE_HEADSET)
+ params.attr = CELL_AUDIO_PORTATTR_OUT_SECONDARY;
+ else
+ params.attr = 0;
if (cellAudioPortOpen(¶ms, &data->audio_port) != CELL_OK)
{
diff --git a/ps3/ps3_video_psgl.c b/ps3/ps3_video_psgl.c
index 709a6c1ae1..62c8612041 100644
--- a/ps3/ps3_video_psgl.c
+++ b/ps3/ps3_video_psgl.c
@@ -1284,6 +1284,11 @@ void ps3graphics_video_init(bool get_all_resolutions)
gl_t * gl = g_gl;
+ gl->custom_viewport_width = g_console.custom_viewport_width;
+ gl->custom_viewport_height = g_console.custom_viewport_height;
+ gl->custom_viewport_x = g_console.custom_viewport_x;
+ gl->custom_viewport_y = g_console.custom_viewport_y;
+
gl->overscan_enable = g_console.overscan_enable;
gl->overscan_amount = g_console.overscan_amount;
diff --git a/ps3/shared.h b/ps3/shared.h
index a93712b451..d2a2688a66 100644
--- a/ps3/shared.h
+++ b/ps3/shared.h
@@ -59,6 +59,12 @@ enum {
INPUT_PRESET_FILE
};
+enum {
+ SOUND_MODE_NORMAL,
+ SOUND_MODE_RSOUND,
+ SOUND_MODE_HEADSET
+};
+
enum {
MENU_ITEM_LOAD_STATE = 0,
MENU_ITEM_SAVE_STATE,
|