Conflicts:
	qb/config.libs.sh
This commit is contained in:
Toad King 2012-05-28 02:27:25 -04:00
commit ec87f858f2
64 changed files with 2631 additions and 2864 deletions

View File

@ -26,7 +26,7 @@ static xdk360_video_font_t m_Font;
void xdk360_console_draw(void)
{
xdk360_video_t *vid = (xdk360_video_t*)g_d3d;
xdk360_video_t *vid = (xdk360_video_t*)driver.video_data;
D3DDevice *m_pd3dDevice = vid->d3d_render_device;
// The top line
@ -54,7 +54,7 @@ void xdk360_console_draw(void)
HRESULT xdk360_console_init( LPCSTR strFontFileName, unsigned long colBackColor,
unsigned long colTextColor)
{
xdk360_video_t *vid = (xdk360_video_t*)g_d3d;
xdk360_video_t *vid = (xdk360_video_t*)driver.video_data;
D3DDevice *m_pd3dDevice = vid->d3d_render_device;
video_console.first_message = true;
@ -217,31 +217,6 @@ void xdk360_console_format(_In_z_ _Printf_format_string_ LPCSTR strFormat, ... )
va_end( pArgList );
}
void xdk360_console_format_w(_In_z_ _Printf_format_string_ LPCWSTR wstrFormat, ... )
{
video_console.m_nCurLine = 0;
video_console.m_cCurLineLength = 0;
memset( video_console.m_Buffer, 0, video_console.m_cScreenHeightVirtual
* ( video_console.m_cScreenWidth + 1 ) * sizeof( wchar_t ) );
va_list pArgList;
va_start( pArgList, wstrFormat );
// Count the required length of the string
unsigned long dwStrLen = _vscwprintf( wstrFormat, pArgList ) + 1; // +1 = null terminator
wchar_t * strMessage = ( wchar_t * )_malloca( dwStrLen * sizeof( wchar_t ) );
vswprintf_s( strMessage, dwStrLen, wstrFormat, pArgList );
// Output the string to the console
unsigned long uStringLength = wcslen( strMessage );
for( unsigned long i = 0; i < uStringLength; i++ )
xdk360_console_add( strMessage[i] );
_freea( strMessage );
va_end( pArgList );
}
#define CALCFONTFILEHEADERSIZE(x) ( sizeof(unsigned long) + (sizeof(float)* 4) + sizeof(unsigned short) + (sizeof(wchar_t)*(x)) )
#define FONTFILEVERSION 5
@ -353,7 +328,7 @@ static HRESULT xdk360_video_font_create_shaders (xdk360_video_font_t * font)
};
// Cache this global into a register
xdk360_video_t *vid = (xdk360_video_t*)g_d3d;
xdk360_video_t *vid = (xdk360_video_t*)driver.video_data;
D3DDevice *pd3dDevice = vid->d3d_render_device;
hr = pd3dDevice->CreateVertexDeclaration( decl, &s_FontLocals.m_pFontVertexDecl );
@ -481,7 +456,7 @@ HRESULT xdk360_video_font_init(xdk360_video_font_t * font, const char * strFontF
return E_FAIL;
}
xdk360_video_t *vid = (xdk360_video_t*)g_d3d;
xdk360_video_t *vid = (xdk360_video_t*)driver.video_data;
D3DDevice *pd3dDevice = vid->d3d_render_device;
// Initialize the window
@ -603,7 +578,7 @@ void xdk360_video_font_begin (xdk360_video_font_t * font)
if( font->m_dwNestedBeginCount == 0 )
{
// Cache the global pointer into a register
xdk360_video_t *vid = (xdk360_video_t*)g_d3d;
xdk360_video_t *vid = (xdk360_video_t*)driver.video_data;
D3DDevice *pD3dDevice = vid->d3d_render_device;
// Save state
@ -680,7 +655,7 @@ void xdk360_video_font_end(xdk360_video_font_t * font)
if( font->m_bSaveState )
{
// Cache the global pointer into a register
xdk360_video_t *vid = (xdk360_video_t*)g_d3d;
xdk360_video_t *vid = (xdk360_video_t*)driver.video_data;
D3DDevice *pD3dDevice = vid->d3d_render_device;
D3DDevice_SetTexture_Inline(pD3dDevice, 0, NULL);
@ -710,7 +685,7 @@ void xdk360_video_font_draw_text(xdk360_video_font_t * font, float fOriginX, flo
if( strText == NULL || strText[0] == L'\0')
return;
xdk360_video_t *vid = (xdk360_video_t*)g_d3d;
xdk360_video_t *vid = (xdk360_video_t*)driver.video_data;
D3DDevice *pd3dDevice = vid->d3d_render_device;
// Set the color as a vertex shader constant

View File

@ -103,7 +103,6 @@ typedef struct
HRESULT xdk360_console_init ( LPCSTR strFontFileName, D3DCOLOR colBackColor, D3DCOLOR colTextColor);
void xdk360_console_deinit (void);
void xdk360_console_format (_In_z_ _Printf_format_string_ LPCSTR strFormat, ... );
void xdk360_console_format_w (_In_z_ _Printf_format_string_ LPCWSTR wstrFormat, ... );
void xdk360_console_draw (void);
HRESULT xdk360_video_font_init(xdk360_video_font_t * font, const char * strFontFileName);

View File

@ -418,8 +418,8 @@ int main(int argc, char *argv[])
init_settings(load_libretro_path);
init_libretro_sym();
xdk360_video_init();
xdk360_input_init();
video_xdk360.start();
input_xdk360.init();
rarch_input_set_default_keybind_names_for_emulator();
@ -453,7 +453,8 @@ begin_shutdown:
save_settings();
menu_deinit();
xdk360_video_deinit();
video_xdk360.stop();
input_xdk360.free(NULL);
rarch_exec();
return 0;

View File

@ -255,7 +255,7 @@ HRESULT CRetroArchSettings::OnControlNavigate(XUIMessageControlNavigate *pContro
{
char scalefactor[128];
int current_index;
xdk360_video_t *vid = (xdk360_video_t*)g_d3d;
xdk360_video_t *vid = (xdk360_video_t*)driver.video_data;
current_index = m_settingslist.GetCurSel();
@ -337,6 +337,7 @@ HRESULT CRetroArchQuickMenu::OnInit(XUIMessageInit * pInitData, BOOL& bHandled)
HRESULT CRetroArchQuickMenu::OnNotifyPress( HXUIOBJ hObjPressed, int & bHandled )
{
xdk360_video_t *d3d9 = (xdk360_video_t*)driver.video_data;
int current_index;
if ( hObjPressed == m_quickmenulist)
@ -365,7 +366,7 @@ HRESULT CRetroArchQuickMenu::OnNotifyPress( HXUIOBJ hObjPressed, int & bHandled
if(g_console.aspect_ratio_index >= ASPECT_RATIO_END)
g_console.aspect_ratio_index = 0;
video_xdk360.set_aspect_ratio(NULL, g_console.aspect_ratio_index);
gfx_ctx_set_aspect_ratio(d3d9, g_console.aspect_ratio_index);
char aspectratio_label[32];
snprintf(aspectratio_label, sizeof(aspectratio_label), "Aspect Ratio: %s", aspectratio_lut[g_console.aspect_ratio_index].name);
wchar_t * aspectratio_label_w = rarch_convert_char_to_wchar(aspectratio_label);
@ -397,7 +398,7 @@ HRESULT CRetroArchQuickMenu::OnNotifyPress( HXUIOBJ hObjPressed, int & bHandled
m_quickmenulist.SetText(MENU_ITEM_ORIENTATION, L"Orientation: Normal");
break;
}
video_xdk360.set_rotation(NULL, g_console.screen_orientation);
video_xdk360.set_rotation(driver.video_data, g_console.screen_orientation);
break;
case MENU_ITEM_RESIZE_MODE:
g_console.input_loop = INPUT_LOOP_RESIZE_MODE;
@ -657,7 +658,7 @@ HRESULT CRetroArchSettings::OnNotifyPress( HXUIOBJ hObjPressed, int & bHandled
case SETTING_SCALE_ENABLED:
g_console.fbo_enabled = !g_console.fbo_enabled;
m_settingslist.SetText(SETTING_SCALE_ENABLED, g_console.fbo_enabled ? L"Custom Scaling/Dual Shaders: ON" : L"Custom Scaling/Dual Shaders: OFF");
xdk360_set_fbo_enable(g_console.fbo_enabled);
gfx_ctx_set_fbo(g_console.fbo_enabled);
break;
}
}
@ -668,7 +669,7 @@ HRESULT CRetroArchSettings::OnNotifyPress( HXUIOBJ hObjPressed, int & bHandled
HRESULT CRetroArchMain::OnNotifyPress( HXUIOBJ hObjPressed, int & bHandled )
{
xdk360_video_t *vid = (xdk360_video_t*)g_d3d;
xdk360_video_t *vid = (xdk360_video_t*)driver.video_data;
hdmenus_allowed = vid->video_mode.fIsHiDef && (g_console.aspect_ratio_index >= ASPECT_RATIO_16_9);
@ -738,7 +739,7 @@ int menu_init (void)
{
HRESULT hr;
xdk360_video_t *vid = (xdk360_video_t*)g_d3d;
xdk360_video_t *vid = (xdk360_video_t*)driver.video_data;
hr = app.InitShared(vid->d3d_render_device, &vid->d3dpp, XuiPNGTextureLoader);
@ -785,33 +786,25 @@ void menu_deinit (void)
void menu_loop(void)
{
HRESULT hr;
xdk360_video_t *d3d9 = (xdk360_video_t*)driver.video_data;
g_console.menu_enable = true;
HRESULT hr;
xdk360_video_t *vid = (xdk360_video_t*)g_d3d;
if(g_console.emulator_initialized)
video_xdk360.set_swap_block_state(NULL, true);
d3d9->block_swap = true;
g_console.input_loop = INPUT_LOOP_MENU;
do
{
g_frame_count++;
if(g_console.emulator_initialized)
{
rarch_render_cached_frame();
}
else
vid->d3d_render_device->Clear(0, NULL, D3DCLEAR_TARGET,
D3DCOLOR_ARGB(255, 32, 32, 64), 1.0f, 0);
rarch_render_cached_frame();
XINPUT_STATE state;
XInputGetState(0, &state);
g_console.menu_enable = !((state.Gamepad.wButtons & XINPUT_GAMEPAD_LEFT_THUMB)
&& (state.Gamepad.wButtons & XINPUT_GAMEPAD_RIGHT_THUMB) && (g_console.emulator_initialized)
&& IS_TIMER_EXPIRED());
&& IS_TIMER_EXPIRED(d3d9));
g_console.mode_switch = g_console.menu_enable ? MODE_MENU : MODE_EMULATION;
switch(g_console.input_loop)
@ -833,7 +826,7 @@ void menu_loop(void)
if(g_console.mode_switch == MODE_EMULATION && !g_console.frame_advance_enable)
{
SET_TIMER_EXPIRATION(30);
SET_TIMER_EXPIRATION(d3d9, 30);
}
/* XBox 360 specific font code */
@ -842,22 +835,21 @@ void menu_loop(void)
if (msg)
{
if(IS_TIMER_EXPIRED() || g_first_msg)
if(IS_TIMER_EXPIRED(d3d9) || g_first_msg)
{
xdk360_console_format(msg);
g_first_msg = 0;
SET_TIMER_EXPIRATION(30);
SET_TIMER_EXPIRATION(d3d9, 30);
}
xdk360_console_draw();
}
}
video_xdk360.swap(NULL);
gfx_ctx_swap_buffers();
}while(g_console.menu_enable);
if(g_console.emulator_initialized)
video_xdk360.set_swap_block_state(NULL, false);
d3d9->block_swap = false;
g_console.ingame_menu_enable = false;
}

View File

@ -20,9 +20,8 @@
#include "../driver.h"
#include "../general.h"
#include "../libretro.h"
#include "../console/console_ext_input.h"
#include "../console/console_ext.h"
#include "xdk360_input.h"
#include "xdk360_video_general.h"
#include "shared.h"
#include "menu.h"
@ -71,14 +70,10 @@ static void xdk360_free_input(void *data)
}
static void* xdk360_input_initialize(void)
{
return (void*)-1;
}
void xdk360_input_init(void)
{
for(unsigned i = 0; i < 4; i++)
xdk360_input_map_dpad_to_stick(g_settings.input.dpad_emulation[i], i);
return (void*)-1;
}
void xdk360_input_map_dpad_to_stick(uint32_t map_dpad_enum, uint32_t controller_id)
@ -150,6 +145,7 @@ static bool xdk360_key_pressed(void *data, int key)
(void)data;
XINPUT_STATE state;
bool retval;
xdk360_video_t *d3d9 = (xdk360_video_t*)driver.video_data;
XInputGetState(0, &state);
retval = false;
@ -177,18 +173,18 @@ static bool xdk360_key_pressed(void *data, int key)
case RARCH_REWIND:
return ((state.Gamepad.sThumbRY > DEADZONE) && !(state.Gamepad.bRightTrigger > 128));
case RARCH_QUIT_KEY:
if(IS_TIMER_EXPIRED())
if(IS_TIMER_EXPIRED(d3d9))
{
uint32_t left_thumb_pressed = (state.Gamepad.wButtons & XINPUT_GAMEPAD_LEFT_THUMB);
uint32_t right_thumb_pressed = (state.Gamepad.wButtons & XINPUT_GAMEPAD_RIGHT_THUMB);
g_console.menu_enable = right_thumb_pressed && left_thumb_pressed && IS_TIMER_EXPIRED();
g_console.menu_enable = right_thumb_pressed && left_thumb_pressed && IS_TIMER_EXPIRED(d3d9);
g_console.ingame_menu_enable = right_thumb_pressed && !left_thumb_pressed;
if(g_console.menu_enable || (g_console.ingame_menu_enable && !g_console.menu_enable))
{
g_console.mode_switch = MODE_MENU;
SET_TIMER_EXPIRATION(30);
SET_TIMER_EXPIRATION(d3d9, 30);
retval = g_console.menu_enable;
}

View File

@ -25,11 +25,10 @@
#define XINPUT_GAMEPAD_RSTICK_RIGHT_MASK (2097152)
#define XINPUT_GAMEPAD_RSTICK_UP_MASK (4194304)
#define XINPUT_GAMEPAD_RSTICK_DOWN_MASK (8388608)
#define XINPUT_GAMEPAD_LEFT_TRIGGER (16777216)
#define XINPUT_GAMEPAD_LEFT_TRIGGER (16777216)
#define XINPUT_GAMEPAD_RIGHT_TRIGGER (33554432)
#define DEADZONE (16000)
#define DEADZONE (16000)
extern void xdk360_input_init(void);
extern void xdk360_input_map_dpad_to_stick(uint32_t map_dpad_enum, uint32_t controller_id);
extern void xdk360_input_loop(void);

View File

@ -15,13 +15,20 @@
*/
// Xbox 360-specific headers
#ifdef _XBOX
#include <xtl.h>
#include <xgraphics.h>
#endif
#include "../driver.h"
#include "xdk360_video.h"
#include "xdk360_video_resources.h"
#ifdef HAVE_HLSL
#include "../gfx/shader_hlsl.h"
#endif
#include "./../gfx/gfx_context.h"
#include "../console/console_ext.h"
#include "../general.h"
#include "../message.h"
@ -31,10 +38,7 @@
#include "config.h"
#endif
static bool g_quitting;
static bool g_first_msg;
unsigned g_frame_count;
void *g_d3d;
/* Xbox 360 specific code */
@ -167,9 +171,9 @@ HRESULT PackedResource::Create( const char * strFilename )
if( xprh.dwMagic != XPR2_MAGIC_VALUE )
{
RARCH_ERR( "Invalid Xbox Packed Resource (.xpr) file: Magic = 0x%08lx.\n", xprh.dwMagic );
CloseHandle( hFile );
return E_FAIL;
RARCH_ERR( "Invalid Xbox Packed Resource (.xpr) file: Magic = 0x%08lx.\n", xprh.dwMagic );
CloseHandle( hFile );
return E_FAIL;
}
// Compute memory requirements
@ -253,31 +257,50 @@ void PackedResource::Destroy()
/* end of Xbox 360 specific code */
static void xdk360_gfx_free(void * data)
static void check_window(xdk360_video_t *d3d9)
{
if (g_d3d)
return;
bool quit, resize;
xdk360_video_t *vid = (xdk360_video_t*)data;
gfx_ctx_check_window(&quit,
&resize, NULL, NULL,
d3d9->frame_count);
if (!vid)
return;
hlsl_deinit();
vid->d3d_render_device->Release();
vid->d3d_device->Release();
free(vid);
if (quit)
d3d9->quitting = true;
else if (resize)
d3d9->should_resize = true;
}
void set_viewport(bool force_full)
static void xdk360_free(void * data)
{
xdk360_video_t *vid = (xdk360_video_t*)g_d3d;
vid->d3d_render_device->Clear(0, NULL, D3DCLEAR_TARGET,
#ifdef RARCH_CONSOLE
if (driver.video_data)
return;
#endif
xdk360_video_t *d3d9 = (xdk360_video_t*)data;
if (!d3d9)
return;
#ifdef HAVE_HLSL
hlsl_deinit();
#endif
d3d9->d3d_render_device->Release();
d3d9->d3d_device->Release();
free(d3d9);
}
static void xdk360_set_viewport(bool force_full)
{
xdk360_video_t *d3d9 = (xdk360_video_t*)driver.video_data;
d3d9->d3d_render_device->Clear(0, NULL, D3DCLEAR_TARGET,
0xff000000, 1.0f, 0);
int width = vid->video_mode.fIsHiDef ? 1280 : 640;
int height = vid->video_mode.fIsHiDef ? 720 : 480;
int width = d3d9->video_mode.fIsHiDef ? 1280 : 640;
int height = d3d9->video_mode.fIsHiDef ? 720 : 480;
int m_viewport_x_temp, m_viewport_y_temp, m_viewport_width_temp, m_viewport_height_temp;
float m_zNear, m_zFar;
@ -327,7 +350,7 @@ void set_viewport(bool force_full)
vp.Y = m_viewport_y_temp;
vp.MinZ = m_zNear;
vp.MaxZ = m_zFar;
vid->d3d_render_device->SetViewport(&vp);
d3d9->d3d_render_device->SetViewport(&vp);
//if(gl->overscan_enable && !force_full)
//{
@ -337,10 +360,10 @@ void set_viewport(bool force_full)
//}
}
static void xdk360_set_orientation(void * data, uint32_t orientation)
static void xdk360_set_rotation(void * data, unsigned orientation)
{
(void)data;
xdk360_video_t *vid = (xdk360_video_t*)g_d3d;
xdk360_video_t *d3d9 = (xdk360_video_t*)data;
FLOAT angle;
switch(orientation)
@ -361,18 +384,8 @@ static void xdk360_set_orientation(void * data, uint32_t orientation)
/* TODO: Move to D3DXMATRIX here */
hlsl_set_proj_matrix(XMMatrixRotationZ(angle));
}
static void xdk360_set_aspect_ratio(void * data, uint32_t aspectratio_index)
{
(void)data;
if(g_console.aspect_ratio_index == ASPECT_RATIO_AUTO)
rarch_set_auto_viewport(g_extern.frame_cache.width, g_extern.frame_cache.height);
g_settings.video.aspect_ratio = aspectratio_lut[g_console.aspect_ratio_index].value;
g_settings.video.force_aspect = false;
set_viewport(false);
d3d9->should_resize = TRUE;
}
static void xdk360_convert_texture_to_as16_srgb( D3DTexture *pTexture )
@ -388,110 +401,103 @@ static void xdk360_convert_texture_to_as16_srgb( D3DTexture *pTexture )
pTexture->Format.DataFormat = g_MapLinearToSrgbGpuFormat[ (desc.Format & D3DFORMAT_TEXTUREFORMAT_MASK) >> D3DFORMAT_TEXTUREFORMAT_SHIFT ];
}
void xdk360_set_fbo_enable (bool enable)
static void xdk360_init_fbo(xdk360_video_t *d3d9)
{
xdk360_video_t *vid = (xdk360_video_t*)g_d3d;
vid->fbo_enabled = enable;
}
void xdk360_gfx_init_fbo(xdk360_video_t *vid)
{
if (vid->lpTexture_ot)
if (d3d9->lpTexture_ot)
{
vid->lpTexture_ot->Release();
vid->lpTexture_ot = NULL;
d3d9->lpTexture_ot->Release();
d3d9->lpTexture_ot = NULL;
}
if (vid->lpSurface)
if (d3d9->lpSurface)
{
vid->lpSurface->Release();
vid->lpSurface = NULL;
d3d9->lpSurface->Release();
d3d9->lpSurface = NULL;
}
vid->d3d_render_device->CreateTexture(512 * g_settings.video.fbo_scale_x, 512 * g_settings.video.fbo_scale_y,
d3d9->d3d_render_device->CreateTexture(512 * g_settings.video.fbo_scale_x, 512 * g_settings.video.fbo_scale_y,
1, 0, g_console.gamma_correction_enable ? ( D3DFORMAT )MAKESRGBFMT( D3DFMT_A8R8G8B8 ) : D3DFMT_A8R8G8B8,
0, &vid->lpTexture_ot, NULL);
0, &d3d9->lpTexture_ot, NULL);
vid->d3d_render_device->CreateRenderTarget(512 * g_settings.video.fbo_scale_x, 512 * g_settings.video.fbo_scale_y,
d3d9->d3d_render_device->CreateRenderTarget(512 * g_settings.video.fbo_scale_x, 512 * g_settings.video.fbo_scale_y,
g_console.gamma_correction_enable ? ( D3DFORMAT )MAKESRGBFMT( D3DFMT_A8R8G8B8 ) : D3DFMT_A8R8G8B8, D3DMULTISAMPLE_NONE,
0, 0, &vid->lpSurface, NULL);
0, 0, &d3d9->lpSurface, NULL);
vid->lpTexture_ot_as16srgb = *vid->lpTexture_ot;
xdk360_convert_texture_to_as16_srgb(vid->lpTexture);
xdk360_convert_texture_to_as16_srgb(&vid->lpTexture_ot_as16srgb);
d3d9->lpTexture_ot_as16srgb = *d3d9->lpTexture_ot;
xdk360_convert_texture_to_as16_srgb(d3d9->lpTexture);
xdk360_convert_texture_to_as16_srgb(&d3d9->lpTexture_ot_as16srgb);
}
static void *xdk360_gfx_init(const video_info_t *video, const input_driver_t **input, void **input_data)
static void *xdk360_init(const video_info_t *video, const input_driver_t **input, void **input_data)
{
if (g_d3d)
return g_d3d;
if (driver.video_data)
return driver.video_data;
xdk360_video_t *vid = (xdk360_video_t*)calloc(1, sizeof(xdk360_video_t));
if (!vid)
xdk360_video_t *d3d9 = (xdk360_video_t*)calloc(1, sizeof(xdk360_video_t));
if (!d3d9)
return NULL;
vid->d3d_device = Direct3DCreate9(D3D_SDK_VERSION);
if (!vid->d3d_device)
d3d9->d3d_device = Direct3DCreate9(D3D_SDK_VERSION);
if (!d3d9->d3d_device)
{
free(vid);
free(d3d9);
return NULL;
}
// Get video settings
memset(&vid->video_mode, 0, sizeof(vid->video_mode));
memset(&d3d9->video_mode, 0, sizeof(d3d9->video_mode));
XGetVideoMode(&vid->video_mode);
XGetVideoMode(&d3d9->video_mode);
memset(&vid->d3dpp, 0, sizeof(vid->d3dpp));
memset(&d3d9->d3dpp, 0, sizeof(d3d9->d3dpp));
// no letterboxing in 4:3 mode (if widescreen is
// unsupported
if(!vid->video_mode.fIsWideScreen)
vid->d3dpp.Flags |= D3DPRESENTFLAG_NO_LETTERBOX;
if(!d3d9->video_mode.fIsWideScreen)
d3d9->d3dpp.Flags |= D3DPRESENTFLAG_NO_LETTERBOX;
vid->d3dpp.BackBufferWidth = vid->video_mode.fIsHiDef ? 1280 : 640;
vid->d3dpp.BackBufferHeight = vid->video_mode.fIsHiDef ? 720 : 480;
d3d9->d3dpp.BackBufferWidth = d3d9->video_mode.fIsHiDef ? 1280 : 640;
d3d9->d3dpp.BackBufferHeight = d3d9->video_mode.fIsHiDef ? 720 : 480;
if(g_console.gamma_correction_enable)
{
vid->d3dpp.BackBufferFormat = g_console.color_format ? (D3DFORMAT)MAKESRGBFMT(D3DFMT_A8R8G8B8) : (D3DFORMAT)MAKESRGBFMT(D3DFMT_LIN_A1R5G5B5);
vid->d3dpp.FrontBufferFormat = (D3DFORMAT)MAKESRGBFMT(D3DFMT_LE_X8R8G8B8);
d3d9->d3dpp.BackBufferFormat = g_console.color_format ? (D3DFORMAT)MAKESRGBFMT(D3DFMT_A8R8G8B8) : (D3DFORMAT)MAKESRGBFMT(D3DFMT_LIN_A1R5G5B5);
d3d9->d3dpp.FrontBufferFormat = (D3DFORMAT)MAKESRGBFMT(D3DFMT_LE_X8R8G8B8);
}
else
{
vid->d3dpp.BackBufferFormat = g_console.color_format ? D3DFMT_A8R8G8B8 : D3DFMT_LIN_A1R5G5B5;
vid->d3dpp.FrontBufferFormat = D3DFMT_LE_X8R8G8B8;
d3d9->d3dpp.BackBufferFormat = g_console.color_format ? D3DFMT_A8R8G8B8 : D3DFMT_LIN_A1R5G5B5;
d3d9->d3dpp.FrontBufferFormat = D3DFMT_LE_X8R8G8B8;
}
vid->d3dpp.MultiSampleType = D3DMULTISAMPLE_NONE;
vid->d3dpp.MultiSampleQuality = 0;
vid->d3dpp.BackBufferCount = 2;
vid->d3dpp.EnableAutoDepthStencil = FALSE;
vid->d3dpp.SwapEffect = D3DSWAPEFFECT_DISCARD;
vid->d3dpp.PresentationInterval = video->vsync ? D3DPRESENT_INTERVAL_ONE : D3DPRESENT_INTERVAL_IMMEDIATE;
d3d9->d3dpp.MultiSampleType = D3DMULTISAMPLE_NONE;
d3d9->d3dpp.MultiSampleQuality = 0;
d3d9->d3dpp.BackBufferCount = 2;
d3d9->d3dpp.EnableAutoDepthStencil = FALSE;
d3d9->d3dpp.SwapEffect = D3DSWAPEFFECT_DISCARD;
d3d9->d3dpp.PresentationInterval = video->vsync ? D3DPRESENT_INTERVAL_ONE : D3DPRESENT_INTERVAL_IMMEDIATE;
// D3DCREATE_HARDWARE_VERTEXPROCESSING is ignored on 360
vid->d3d_device->CreateDevice(0, D3DDEVTYPE_HAL, NULL, D3DCREATE_HARDWARE_VERTEXPROCESSING,
&vid->d3dpp, &vid->d3d_render_device);
d3d9->d3d_device->CreateDevice(0, D3DDEVTYPE_HAL, NULL, D3DCREATE_HARDWARE_VERTEXPROCESSING,
&d3d9->d3dpp, &d3d9->d3d_render_device);
hlsl_init(g_settings.video.cg_shader_path, vid->d3d_render_device);
hlsl_init(g_settings.video.cg_shader_path, d3d9->d3d_render_device);
vid->d3d_render_device->CreateTexture(512, 512, 1, 0, D3DFMT_LIN_X1R5G5B5,
0, &vid->lpTexture, NULL);
d3d9->d3d_render_device->CreateTexture(512, 512, 1, 0, D3DFMT_LIN_X1R5G5B5,
0, &d3d9->lpTexture, NULL);
xdk360_gfx_init_fbo(vid);
xdk360_init_fbo(d3d9);
D3DLOCKED_RECT d3dlr;
vid->lpTexture->LockRect(0, &d3dlr, NULL, D3DLOCK_NOSYSLOCK);
d3d9->lpTexture->LockRect(0, &d3dlr, NULL, D3DLOCK_NOSYSLOCK);
memset(d3dlr.pBits, 0, 512 * d3dlr.Pitch);
vid->lpTexture->UnlockRect(0);
d3d9->lpTexture->UnlockRect(0);
vid->last_width = 512;
vid->last_height = 512;
d3d9->last_width = 512;
d3d9->last_height = 512;
vid->d3d_render_device->CreateVertexBuffer(4 * sizeof(DrawVerticeFormats),
0, 0, 0, &vid->vertex_buf, NULL);
d3d9->d3d_render_device->CreateVertexBuffer(4 * sizeof(DrawVerticeFormats),
0, 0, 0, &d3d9->vertex_buf, NULL);
static const DrawVerticeFormats init_verts[] = {
{ -1.0f, -1.0f, 0.0f, 1.0f },
@ -501,9 +507,9 @@ static void *xdk360_gfx_init(const video_info_t *video, const input_driver_t **i
};
void *verts_ptr;
vid->vertex_buf->Lock(0, 0, &verts_ptr, 0);
d3d9->vertex_buf->Lock(0, 0, &verts_ptr, 0);
memcpy(verts_ptr, init_verts, sizeof(init_verts));
vid->vertex_buf->Unlock();
d3d9->vertex_buf->Unlock();
static const D3DVERTEXELEMENT9 VertexElements[] =
{
@ -512,20 +518,20 @@ static void *xdk360_gfx_init(const video_info_t *video, const input_driver_t **i
D3DDECL_END()
};
vid->d3d_render_device->CreateVertexDeclaration(VertexElements, &vid->v_decl);
d3d9->d3d_render_device->CreateVertexDeclaration(VertexElements, &d3d9->v_decl);
vid->d3d_render_device->Clear(0, NULL, D3DCLEAR_TARGET,
d3d9->d3d_render_device->Clear(0, NULL, D3DCLEAR_TARGET,
0xff000000, 1.0f, 0);
vid->d3d_render_device->SetRenderState(D3DRS_CULLMODE, D3DCULL_NONE);
vid->d3d_render_device->SetRenderState(D3DRS_ZENABLE, FALSE);
d3d9->d3d_render_device->SetRenderState(D3DRS_CULLMODE, D3DCULL_NONE);
d3d9->d3d_render_device->SetRenderState(D3DRS_ZENABLE, FALSE);
D3DVIEWPORT9 vp = {0};
vp.Width = vid->video_mode.fIsHiDef ? 1280 : 640;
vp.Height = vid->video_mode.fIsHiDef ? 720 : 480;
vp.Width = d3d9->video_mode.fIsHiDef ? 1280 : 640;
vp.Height = d3d9->video_mode.fIsHiDef ? 720 : 480;
vp.MinZ = 0.0f;
vp.MaxZ = 1.0f;
vid->d3d_render_device->SetViewport(&vp);
d3d9->d3d_render_device->SetViewport(&vp);
if(g_console.viewports.custom_vp.width == 0)
g_console.viewports.custom_vp.width = vp.Width;
@ -533,27 +539,28 @@ static void *xdk360_gfx_init(const video_info_t *video, const input_driver_t **i
if(g_console.viewports.custom_vp.height == 0)
g_console.viewports.custom_vp.height = vp.Height;
xdk360_set_orientation(NULL, g_console.screen_orientation);
xdk360_set_rotation(d3d9, g_console.screen_orientation);
vid->fbo_enabled = 1;
d3d9->fbo_enabled = 1;
d3d9->vsync = video->vsync;
return vid;
return d3d9;
}
static bool xdk360_gfx_frame(void *data, const void *frame,
static bool xdk360_frame(void *data, const void *frame,
unsigned width, unsigned height, unsigned pitch, const char *msg)
{
xdk360_video_t *vid = (xdk360_video_t*)data;
xdk360_video_t *d3d9 = (xdk360_video_t*)data;
D3DSurface* pRenderTarget0;
bool menu_enabled = g_console.menu_enable;
if (vid->last_width != width || vid->last_height != height)
if (d3d9->last_width != width || d3d9->last_height != height)
{
D3DLOCKED_RECT d3dlr;
vid->lpTexture->LockRect(0, &d3dlr, NULL, D3DLOCK_NOSYSLOCK);
d3d9->lpTexture->LockRect(0, &d3dlr, NULL, D3DLOCK_NOSYSLOCK);
memset(d3dlr.pBits, 0, 512 * d3dlr.Pitch);
vid->lpTexture->UnlockRect(0);
d3d9->lpTexture->UnlockRect(0);
float tex_w = width / 512.0f;
float tex_h = height / 512.0f;
@ -573,31 +580,34 @@ static bool xdk360_gfx_frame(void *data, const void *frame,
}
void *verts_ptr;
vid->vertex_buf->Lock(0, 0, &verts_ptr, 0);
d3d9->vertex_buf->Lock(0, 0, &verts_ptr, 0);
memcpy(verts_ptr, verts, sizeof(verts));
vid->vertex_buf->Unlock();
d3d9->vertex_buf->Unlock();
vid->last_width = width;
vid->last_height = height;
d3d9->last_width = width;
d3d9->last_height = height;
}
if(vid->fbo_enabled)
if (d3d9->fbo_enabled)
{
vid->d3d_render_device->GetRenderTarget(0, &pRenderTarget0);
vid->d3d_render_device->SetRenderTarget(0, vid->lpSurface);
d3d9->d3d_render_device->GetRenderTarget(0, &pRenderTarget0);
d3d9->d3d_render_device->SetRenderTarget(0, d3d9->lpSurface);
}
vid->d3d_render_device->Clear(0, NULL, D3DCLEAR_TARGET,
0xff000000, 1.0f, 0);
g_frame_count++;
if (d3d9->should_resize)
xdk360_set_viewport(false);
vid->d3d_render_device->SetTexture(0, vid->lpTexture);
d3d9->d3d_render_device->Clear(0, NULL, D3DCLEAR_TARGET,
0xff000000, 1.0f, 0);
d3d9->frame_count++;
d3d9->d3d_render_device->SetTexture(0, d3d9->lpTexture);
hlsl_use(1);
if(vid->fbo_enabled)
if(d3d9->fbo_enabled)
{
hlsl_set_params(width, height, 512, 512, g_settings.video.fbo_scale_x * width,
g_settings.video.fbo_scale_y * height, g_frame_count);
g_settings.video.fbo_scale_y * height, d3d9->frame_count);
D3DVIEWPORT9 vp = {0};
vp.Width = g_settings.video.fbo_scale_x * width;
vp.Height = g_settings.video.fbo_scale_y * height;
@ -605,121 +615,98 @@ static bool xdk360_gfx_frame(void *data, const void *frame,
vp.Y = 0;
vp.MinZ = 0.0f;
vp.MaxZ = 1.0f;
vid->d3d_render_device->SetViewport(&vp);
d3d9->d3d_render_device->SetViewport(&vp);
}
else
{
hlsl_set_params(width, height, 512, 512, vid->d3dpp.BackBufferWidth,
vid->d3dpp.BackBufferHeight, g_frame_count);
hlsl_set_params(width, height, 512, 512, d3d9->d3dpp.BackBufferWidth,
d3d9->d3dpp.BackBufferHeight, d3d9->frame_count);
}
D3DLOCKED_RECT d3dlr;
vid->lpTexture->LockRect(0, &d3dlr, NULL, D3DLOCK_NOSYSLOCK);
d3d9->lpTexture->LockRect(0, &d3dlr, NULL, D3DLOCK_NOSYSLOCK);
for (unsigned y = 0; y < height; y++)
{
const uint8_t *in = (const uint8_t*)frame + y * pitch;
uint8_t *out = (uint8_t*)d3dlr.pBits + y * d3dlr.Pitch;
memcpy(out, in, width * sizeof(uint16_t));
}
vid->lpTexture->UnlockRect(0);
d3d9->lpTexture->UnlockRect(0);
vid->d3d_render_device->SetSamplerState(0, D3DSAMP_MINFILTER, g_settings.video.smooth ? D3DTEXF_LINEAR : D3DTEXF_POINT);
vid->d3d_render_device->SetSamplerState(0, D3DSAMP_MAGFILTER, g_settings.video.smooth ? D3DTEXF_LINEAR : D3DTEXF_POINT);
vid->d3d_render_device->SetSamplerState(0, D3DSAMP_ADDRESSU, D3DTADDRESS_BORDER);
vid->d3d_render_device->SetSamplerState(0, D3DSAMP_ADDRESSV, D3DTADDRESS_BORDER);
d3d9->d3d_render_device->SetSamplerState(0, D3DSAMP_MINFILTER, g_settings.video.smooth ? D3DTEXF_LINEAR : D3DTEXF_POINT);
d3d9->d3d_render_device->SetSamplerState(0, D3DSAMP_MAGFILTER, g_settings.video.smooth ? D3DTEXF_LINEAR : D3DTEXF_POINT);
d3d9->d3d_render_device->SetSamplerState(0, D3DSAMP_ADDRESSU, D3DTADDRESS_BORDER);
d3d9->d3d_render_device->SetSamplerState(0, D3DSAMP_ADDRESSV, D3DTADDRESS_BORDER);
vid->d3d_render_device->SetVertexDeclaration(vid->v_decl);
vid->d3d_render_device->SetStreamSource(0, vid->vertex_buf, 0, sizeof(DrawVerticeFormats));
d3d9->d3d_render_device->SetVertexDeclaration(d3d9->v_decl);
d3d9->d3d_render_device->SetStreamSource(0, d3d9->vertex_buf, 0, sizeof(DrawVerticeFormats));
vid->d3d_render_device->DrawPrimitive(D3DPT_TRIANGLESTRIP, 0, 2);
d3d9->d3d_render_device->DrawPrimitive(D3DPT_TRIANGLESTRIP, 0, 2);
if(vid->fbo_enabled)
if(d3d9->fbo_enabled)
{
vid->d3d_render_device->Resolve(D3DRESOLVE_RENDERTARGET0, NULL, vid->lpTexture_ot,
d3d9->d3d_render_device->Resolve(D3DRESOLVE_RENDERTARGET0, NULL, d3d9->lpTexture_ot,
NULL, 0, 0, NULL, 0, 0, NULL);
vid->d3d_render_device->SetRenderTarget(0, pRenderTarget0);
d3d9->d3d_render_device->SetRenderTarget(0, pRenderTarget0);
pRenderTarget0->Release();
vid->d3d_render_device->SetTexture(0, &vid->lpTexture_ot_as16srgb);
d3d9->d3d_render_device->SetTexture(0, &d3d9->lpTexture_ot_as16srgb);
hlsl_use(2);
hlsl_set_params(g_settings.video.fbo_scale_x * width, g_settings.video.fbo_scale_y * height, g_settings.video.fbo_scale_x * 512, g_settings.video.fbo_scale_y * 512, vid->d3dpp.BackBufferWidth,
vid->d3dpp.BackBufferHeight, g_frame_count);
set_viewport(false);
hlsl_set_params(g_settings.video.fbo_scale_x * width, g_settings.video.fbo_scale_y * height, g_settings.video.fbo_scale_x * 512, g_settings.video.fbo_scale_y * 512, d3d9->d3dpp.BackBufferWidth,
d3d9->d3dpp.BackBufferHeight, d3d9->frame_count);
xdk360_set_viewport(false);
vid->d3d_render_device->SetSamplerState(0, D3DSAMP_MINFILTER, g_settings.video.second_pass_smooth ? D3DTEXF_LINEAR : D3DTEXF_POINT);
vid->d3d_render_device->SetSamplerState(0, D3DSAMP_MAGFILTER, g_settings.video.second_pass_smooth ? D3DTEXF_LINEAR : D3DTEXF_POINT);
vid->d3d_render_device->SetSamplerState(0, D3DSAMP_ADDRESSU, D3DTADDRESS_BORDER);
vid->d3d_render_device->SetSamplerState(0, D3DSAMP_ADDRESSV, D3DTADDRESS_BORDER);
vid->d3d_render_device->SetVertexDeclaration(vid->v_decl);
vid->d3d_render_device->SetStreamSource(0, vid->vertex_buf, 0, sizeof(DrawVerticeFormats));
vid->d3d_render_device->DrawPrimitive(D3DPT_TRIANGLESTRIP, 0, 2);
d3d9->d3d_render_device->SetSamplerState(0, D3DSAMP_MINFILTER, g_settings.video.second_pass_smooth ? D3DTEXF_LINEAR : D3DTEXF_POINT);
d3d9->d3d_render_device->SetSamplerState(0, D3DSAMP_MAGFILTER, g_settings.video.second_pass_smooth ? D3DTEXF_LINEAR : D3DTEXF_POINT);
d3d9->d3d_render_device->SetSamplerState(0, D3DSAMP_ADDRESSU, D3DTADDRESS_BORDER);
d3d9->d3d_render_device->SetSamplerState(0, D3DSAMP_ADDRESSV, D3DTADDRESS_BORDER);
d3d9->d3d_render_device->SetVertexDeclaration(d3d9->v_decl);
d3d9->d3d_render_device->SetStreamSource(0, d3d9->vertex_buf, 0, sizeof(DrawVerticeFormats));
d3d9->d3d_render_device->DrawPrimitive(D3DPT_TRIANGLESTRIP, 0, 2);
}
/* XBox 360 specific font code */
if (msg && !menu_enabled)
{
if(IS_TIMER_EXPIRED() || g_first_msg)
if(IS_TIMER_EXPIRED(d3d9) || g_first_msg)
{
xdk360_console_format(msg);
g_first_msg = 0;
SET_TIMER_EXPIRATION(30);
SET_TIMER_EXPIRATION(d3d9, 30);
}
xdk360_console_draw();
}
if(!vid->block_swap)
vid->d3d_render_device->Present(NULL, NULL, NULL, NULL);
if(!d3d9->block_swap)
gfx_ctx_swap_buffers();
return true;
}
static void xdk360_set_swap_block_swap (void * data, bool toggle)
static void xdk360_set_nonblock_state(void *data, bool state)
{
xdk360_video_t *d3d9 = (xdk360_video_t*)data;
if(d3d9->vsync)
{
RARCH_LOG("D3D Vsync => %s\n", state ? "off" : "on");
gfx_ctx_set_swap_interval(state ? 0 : 1, TRUE);
}
}
static bool xdk360_alive(void *data)
{
xdk360_video_t *d3d9 = (xdk360_video_t*)data;
check_window(d3d9);
return !d3d9->quitting;
}
static bool xdk360_focus(void *data)
{
(void)data;
xdk360_video_t *vid = (xdk360_video_t*)g_d3d;
vid->block_swap = toggle;
if(toggle)
RARCH_LOG("Swap is set to blocked.\n");
else
RARCH_LOG("Swap is set to non-blocked.\n");
}
static void xdk360_swap (void * data)
{
(void)data;
xdk360_video_t *vid = (xdk360_video_t*)g_d3d;
vid->d3d_render_device->Present(NULL, NULL, NULL, NULL);
}
static void xdk360_gfx_set_nonblock_state(void *data, bool state)
{
xdk360_video_t *vid = (xdk360_video_t*)data;
RARCH_LOG("D3D Vsync => %s\n", state ? "off" : "on");
/* XBox 360 specific code */
if(state)
vid->d3d_render_device->SetRenderState(D3DRS_PRESENTINTERVAL, D3DPRESENT_INTERVAL_IMMEDIATE);
else
vid->d3d_render_device->SetRenderState(D3DRS_PRESENTINTERVAL, D3DPRESENT_INTERVAL_ONE);
}
static bool xdk360_gfx_alive(void *data)
{
(void)data;
return !g_quitting;
}
static bool xdk360_gfx_focus(void *data)
{
(void)data;
return true;
}
void xdk360_video_set_vsync(bool vsync)
{
xdk360_gfx_set_nonblock_state(g_d3d, vsync);
return gfx_ctx_window_has_focus();
}
// 360 needs a working graphics stack before RetroArch even starts.
@ -727,16 +714,21 @@ void xdk360_video_set_vsync(bool vsync)
// the top level module owns the instance, and is created beforehand.
// When RetroArch gets around to init it, it is already allocated.
// When RetroArch wants to free it, it is ignored.
void xdk360_video_init(void)
static void xdk360_start(void)
{
video_info_t video_info = {0};
video_info.vsync = g_settings.video.vsync;
video_info.force_aspect = false;
video_info.fullscreen = true;
video_info.smooth = g_settings.video.smooth;
video_info.input_scale = 2;
g_d3d = xdk360_gfx_init(&video_info, NULL, NULL);
driver.video_data = xdk360_init(&video_info, NULL, NULL);
xdk360_video_t *d3d9 = (xdk360_video_t*)driver.video_data;
gfx_ctx_set_swap_interval(d3d9->vsync ? 1 : 0, false);
g_first_msg = true;
@ -750,25 +742,29 @@ void xdk360_video_init(void)
}
}
void xdk360_video_deinit(void)
static void xdk360_restart(void)
{
void *data = g_d3d;
g_d3d = NULL;
}
static void xdk360_stop(void)
{
void *data = driver.video_data;
driver.video_data = NULL;
xdk360_console_deinit();
xdk360_gfx_free(data);
xdk360_free(data);
}
const video_driver_t video_xdk360 = {
xdk360_gfx_init,
xdk360_gfx_frame,
xdk360_gfx_set_nonblock_state,
xdk360_gfx_alive,
xdk360_gfx_focus,
xdk360_init,
xdk360_frame,
xdk360_set_nonblock_state,
xdk360_alive,
xdk360_focus,
NULL,
xdk360_gfx_free,
xdk360_free,
"xdk360",
xdk360_set_swap_block_swap,
xdk360_swap,
xdk360_set_aspect_ratio,
xdk360_set_orientation,
xdk360_start,
xdk360_stop,
xdk360_restart,
xdk360_set_rotation,
};

View File

@ -19,7 +19,6 @@
#include <stdint.h>
#include "fonts.h"
#include "xdk360_video_general.h"
#define DFONT_MAX 4096
#define PRIM_FVF (D3DFVF_XYZRHW | D3DFVF_TEX1)
@ -47,7 +46,10 @@ typedef struct xdk360_video
{
bool block_swap;
bool fbo_enabled;
bool vsync;
bool should_resize;
bool quitting;
bool vsync;
unsigned frame_count;
unsigned last_width;
unsigned last_height;
IDirect3D9* d3d_device;
@ -62,13 +64,6 @@ typedef struct xdk360_video
LPDIRECT3DSURFACE9 lpSurface;
} xdk360_video_t;
void xdk360_video_init (void);
void xdk360_video_deinit (void);
void xdk360_video_set_vsync (bool vsync);
void xdk360_set_fbo_enable (bool enable);
void xdk360_gfx_init_fbo(xdk360_video_t *vid);
void set_viewport(bool force_full);
extern void *g_d3d;
#endif

View File

@ -48,7 +48,7 @@ ifeq ($(HAVE_BSV_MOVIE), 1)
endif
ifeq ($(HAVE_NETPLAY), 1)
OBJ += netplay.o
OBJ += netplay.o network_cmd.o
endif
ifeq ($(HAVE_RSOUND), 1)
@ -102,12 +102,12 @@ ifeq ($(HAVE_COREAUDIO), 1)
endif
ifeq ($(HAVE_SDL), 1)
OBJ += gfx/sdl_gfx.o gfx/sdlwrap.o input/sdl_input.o audio/sdl_audio.o fifo_buffer.o
OBJ += gfx/sdl_gfx.o gfx/context/sdl_ctx.o input/sdl_input.o audio/sdl_audio.o fifo_buffer.o
DEFINES += $(SDL_CFLAGS) $(BSD_LOCAL_INC)
LIBS += $(SDL_LIBS)
ifeq ($(HAVE_OPENGL), 1)
OBJ += gfx/gl.o
OBJ += gfx/gl.o gfx/fonts/freetype.o
ifeq ($(OSX),1)
LIBS += -framework OpenGL
else
@ -154,7 +154,7 @@ ifeq ($(HAVE_DYLIB), 1)
endif
ifeq ($(HAVE_FREETYPE), 1)
OBJ += gfx/fonts.o
OBJ += gfx/fonts/fonts.o
LIBS += $(FREETYPE_LIBS)
DEFINES += $(FREETYPE_CFLAGS)
endif

View File

@ -68,7 +68,7 @@ endif
PPU_LDLIBS = -ldbgfont $(GL_LIBS) -lretro -lcgc -lgcm_cmd -lgcm_sys_stub -lresc_stub -lm -lio_stub -lfs_stub -lsysutil_stub -lsysutil_game_stub -lsysutil_screenshot_stub -lsysutil_np_stub -lpngdec_stub -ljpgdec_stub -lsysmodule_stub -laudio_stub -lnet_stub -lnetctl_stub -lpthread
DEFINES += -DRARCH_CONSOLE -DHAVE_OPENGL -DHAVE_OPENGLES -DHAVE_LIBDBGFONTS -DHAVE_CG -DHAVE_FILEBROWSER -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_GRIFFIN=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 += -DRARCH_CONSOLE -DHAVE_OPENGL -DHAVE_OPENGL_TEXREF -DHAVE_VID_CONTEXT -DHAVE_OPENGLES -DHAVE_CG -DHAVE_CG_MENU -DHAVE_FILEBROWSER -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_GRIFFIN=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)
PPU_OPTIMIZE_LV := -O0 -g

View File

@ -30,7 +30,7 @@ endif
libretro ?= -lretro
LIBS = -lm
DEFINES = -I. -DHAVE_CONFIGFILE -DHAVE_SCREENSHOTS -DHAVE_BSV_MOVIE -DPACKAGE_VERSION=\"0.9.6-rc1\"
DEFINES = -I. -DHAVE_CONFIGFILE -DHAVE_SDL -DHAVE_SCREENSHOTS -DHAVE_BSV_MOVIE -DPACKAGE_VERSION=\"0.9.6-rc1\"
LDFLAGS = -L. -static-libgcc
LDCXXFLAGS = -s
@ -39,7 +39,7 @@ ifeq ($(TDM_GCC),)
endif
ifeq ($(HAVE_SDL), 1)
OBJ += gfx/sdl_gfx.o gfx/gl.o gfx/sdlwrap.o input/sdl_input.o audio/sdl_audio.o fifo_buffer.o
OBJ += gfx/sdl_gfx.o gfx/gl.o gfx/fonts/freetype.o gfx/context/sdl_ctx.o input/sdl_input.o audio/sdl_audio.o fifo_buffer.o
LIBS += -lSDL
DEFINES += -ISDL -DHAVE_SDL
endif
@ -95,12 +95,12 @@ endif
ifeq ($(HAVE_NETPLAY), 1)
DEFINES += -DHAVE_NETPLAY
OBJ += netplay.o
OBJ += netplay.o network_cmd.o
LIBS += -lws2_32
endif
ifeq ($(HAVE_FREETYPE), 1)
OBJ += gfx/fonts.o
OBJ += gfx/fonts/fonts.o
DEFINES += -DHAVE_FREETYPE -Ifreetype2
LIBS += -lfreetype -lz
endif

View File

@ -284,6 +284,10 @@ static const bool savestate_auto_index = false;
// Slowmotion ratio.
static const float slowmotion_ratio = 3.0;
// Enable network command interface
static const bool network_cmd_enable = false;
static const uint16_t network_cmd_port = 55355;
////////////////////
// Keybinds, Joypad

View File

@ -17,6 +17,10 @@
#ifndef CONSOLE_EXT_H__
#define CONSOLE_EXT_H__
#define IS_TIMER_NOT_EXPIRED(handle) (handle->frame_count < g_console.timer_expiration_frame_count)
#define IS_TIMER_EXPIRED(handle) (!(IS_TIMER_NOT_EXPIRED(handle)))
#define SET_TIMER_EXPIRATION(handle, value) (g_console.timer_expiration_frame_count = handle->frame_count + value)
enum aspect_ratio
{
ASPECT_RATIO_1_1 = 0,
@ -44,6 +48,8 @@ enum aspect_ratio
ASPECT_RATIO_END,
};
#define LAST_ASPECT_RATIO ASPECT_RATIO_CUSTOM
enum rotation
{
ORIENTATION_NORMAL = 0,

View File

@ -36,28 +36,71 @@ CONFIG FILE
#undef __RARCH_MSVC_COMPAT_H
#undef strcasecmp
#endif
#ifdef HAVE_CONFIGFILE
#include "../../conf/config_file.c"
#endif
#include "func_hooks.h"
/*============================================================
VIDEO
VIDEO CONTEXT
============================================================ */
#ifdef HAVE_VID_CONTEXT
#if defined(__CELLOS_LV2__)
#include "../../gfx/shader_cg.c"
#include "../../ps3/ps3_video_psgl.c"
#include "../../ps3/image.c"
#include "../../gfx/context/ps3_ctx.c"
#elif defined(_XBOX)
#include "../../gfx/context/xdk360_ctx.c"
#endif
#endif
/*============================================================
VIDEO SHADERS
============================================================ */
#ifdef HAVE_CG
#include "../../gfx/shader_cg.c"
#endif
#ifdef HAVE_HLSL
#include "../../gfx/shader_hlsl.c"
#endif
/*============================================================
VIDEO IMAGE
============================================================ */
#if defined(__CELLOS_LV2__)
#include "../../ps3/image.c"
#endif
/*============================================================
VIDEO DRIVER
============================================================ */
#ifdef HAVE_OPENGL
#include "../../gfx/gl.c"
#endif
#if defined(_XBOX)
#include "../../360/xdk360_video.cpp"
#elif defined(GEKKO)
#include "../../wii/video.c"
#endif
#if defined(_XBOX)
/*============================================================
FONTS
============================================================ */
#if defined(__CELLOS_LV2__)
#include "../../gfx/fonts/ps3_libdbgfont.c"
#elif defined(_XBOX)
#include "../../360/fonts.cpp"
#elif defined(GEKKO)
#include "../../gfx/fonts.c"
#include "../../gfx/fonts/fonts.c"
#endif
/*============================================================
@ -72,7 +115,7 @@ INPUT
#endif
/*============================================================
SNES STATE
STATE TRACKER
============================================================ */
#include "../../gfx/state_tracker.c"
@ -175,7 +218,7 @@ THREAD
/*============================================================
NETPLAY
============================================================ */
#ifndef GEKKO
#ifdef HAVE_NETPLAY
#include "../../netplay.c"
#endif

View File

@ -37,8 +37,8 @@
#define video_focus_func() gl_focus(driver.video_data)
#define video_xml_shader_func(path) driver.video->xml_shader(driver.video_data, path)
#define video_free_func() gl_free(driver.video_data)
#define video_set_rotation_func(orientation) ps3graphics_set_orientation(driver.video_data, orientation)
#define video_set_aspect_ratio_func(aspectratio_idx) ps3graphics_set_aspect_ratio(driver.video_data, aspectratio_idx)
#define video_set_rotation_func(rotation) gl_set_rotation(driver.video_data, rotation)
#define video_set_aspect_ratio_func(aspectratio_idx) gfx_ctx_set_aspect_ratio(driver.video_data, aspectratio_idx)
#define input_init_func() ps3_input_initialize()
#define input_poll_func() ps3_input_poll(driver.input_data)
@ -54,16 +54,16 @@
#elif defined(_XBOX)
#define video_init_func(video_info, input, input_data) \
xdk360_gfx_init(video_info, input, input_data)
xdk360_init(video_info, input, input_data)
#define video_frame_func(data, width, height, pitch, msg) \
xdk360_gfx_frame(driver.video_data, data, width, height, pitch, msg)
xdk360_frame(driver.video_data, data, width, height, pitch, msg)
#define video_set_nonblock_state_func(state) driver.video->set_nonblock_state(driver.video_data, state)
#define video_alive_func() xdk360_gfx_alive(driver.video_data)
#define video_focus_func() xdk360_gfx_focus(driver.video_data)
#define video_alive_func() xdk360_alive(driver.video_data)
#define video_focus_func() xdk360_focus(driver.video_data)
#define video_xml_shader_func(path) driver.video->xml_shader(driver.video_data, path)
#define video_free_func() xdk360_gfx_free(driver.video_data)
#define video_set_rotation_func(orientation) xdk360_set_orientation(driver.video_data, orientation)
#define video_set_aspect_ratio_func(aspectratio_idx) xdk360_set_aspect_ratio(driver.video_data, aspectratio_idx)
#define video_free_func() xdk360_free(driver.video_data)
#define video_set_rotation_func(rotation) xdk360_set_rotation(driver.video_data, rotation)
#define video_set_aspect_ratio_func(aspectratio_idx) gfx_ctx_set_aspect_ratio(driver.video_data, aspectratio_idx)
#define input_init_func() xdk360_input_initialize()
#define input_poll_func() xdk360_input_poll(driver.input_data)

View File

@ -11,25 +11,18 @@
#define CGF_DEPTHREPLACE 0x02
#define CGF_PIXELKILL 0x04
typedef unsigned int Elf32_Addr;
typedef unsigned short Elf32_Half;
typedef short Elf32_Shalf;
typedef unsigned int Elf32_Off;
typedef signed int Elf32_Sword;
typedef unsigned int Elf32_Word;
typedef size_t ptrdiff_t;
typedef size_t ptrdiff_t;
typedef struct _Elf32_cgParameter {
Elf32_Word cgp_name;
Elf32_Word cgp_semantic;
Elf32_Half cgp_default;
Elf32_Half cgp_reloc;
Elf32_Half cgp_resource;
Elf32_Half cgp_resource_index;
unsigned int cgp_name;
unsigned int cgp_semantic;
unsigned short cgp_default;
unsigned short cgp_reloc;
unsigned short cgp_resource;
unsigned short cgp_resource_index;
unsigned char cgp_type;
Elf32_Half cgp_info;
unsigned short cgp_info;
unsigned char unused;
} Elf32_cgParameter;
@ -182,77 +175,77 @@ typedef struct _Elf32_cgParameter {
struct Elf32_Ehdr {
unsigned char e_ident[EI_NIDENT];
Elf32_Half e_type;
Elf32_Half e_machine;
Elf32_Word e_version;
Elf32_Addr e_entry;
Elf32_Off e_phoff;
Elf32_Off e_shoff;
Elf32_Word e_flags;
Elf32_Half e_ehsize;
Elf32_Half e_phentsize;
Elf32_Half e_phnum;
Elf32_Half e_shentsize;
Elf32_Half e_shnum;
Elf32_Half e_shstrndx;
unsigned short e_type;
unsigned short e_machine;
unsigned int e_version;
unsigned int e_entry;
unsigned int e_phoff;
unsigned int e_shoff;
unsigned int e_flags;
unsigned short e_ehsize;
unsigned short e_phentsize;
unsigned short e_phnum;
unsigned short e_shentsize;
unsigned short e_shnum;
unsigned short e_shstrndx;
};
struct Elf32_Shdr {
Elf32_Word sh_name;
Elf32_Word sh_type;
Elf32_Word sh_flags;
Elf32_Addr sh_addr;
Elf32_Off sh_offset;
Elf32_Word sh_size;
Elf32_Word sh_link;
Elf32_Word sh_info;
Elf32_Word sh_addralign;
Elf32_Word sh_entsize;
unsigned int sh_name;
unsigned int sh_type;
unsigned int sh_flags;
unsigned int sh_addr;
unsigned int sh_offset;
unsigned int sh_size;
unsigned int sh_link;
unsigned int sh_info;
unsigned int sh_addralign;
unsigned int sh_entsize;
};
struct Elf32_Phdr {
Elf32_Word p_type;
Elf32_Off p_offset;
Elf32_Addr p_vaddr;
Elf32_Addr p_paddr;
Elf32_Word p_filesz;
Elf32_Word p_memsz;
Elf32_Word p_flags;
Elf32_Word p_align;
unsigned int p_type;
unsigned int p_offset;
unsigned int p_vaddr;
unsigned int p_paddr;
unsigned int p_filesz;
unsigned int p_memsz;
unsigned int p_flags;
unsigned int p_align;
};
struct Elf32_Sym {
Elf32_Word st_name;
Elf32_Addr st_value;
Elf32_Word st_size;
unsigned int st_name;
unsigned int st_value;
unsigned int st_size;
unsigned char st_info;
unsigned char st_other;
Elf32_Half st_shndx;
unsigned short st_shndx;
};
struct Elf32_Note {
Elf32_Word n_namesz; /* Name size */
Elf32_Word n_descsz; /* Content size */
Elf32_Word n_type; /* Content type */
unsigned int n_namesz; /* Name size */
unsigned int n_descsz; /* Content size */
unsigned int n_type; /* Content type */
};
struct Elf32_Rel {
Elf32_Addr r_offset;
Elf32_Word r_info;
unsigned int r_offset;
unsigned int r_info;
};
struct Elf32_Rela {
Elf32_Addr r_offset;
Elf32_Word r_info;
Elf32_Sword r_addend;
unsigned int r_offset;
unsigned int r_info;
signed int r_addend;
};
struct Elf32_Dyn {
Elf32_Sword d_tag;
signed int d_tag;
union {
Elf32_Word d_val;
Elf32_Addr d_ptr;
unsigned int d_val;
unsigned int d_ptr;
} d_un;
};
@ -381,16 +374,16 @@ class isection
virtual int reference() const = 0;
virtual int release() const = 0;
virtual Elf32_Half index() const = 0;
virtual unsigned short index() const = 0;
virtual char *name() const = 0;
virtual Elf32_Word type() const = 0;
virtual Elf32_Word flags() const = 0;
virtual Elf32_Addr addr() const = 0;
virtual Elf32_Word size() const = 0;
virtual Elf32_Word link() const = 0;
virtual Elf32_Word info() const = 0;
virtual Elf32_Word addralign() const = 0;
virtual Elf32_Word entsize() const = 0;
virtual unsigned int type() const = 0;
virtual unsigned int flags() const = 0;
virtual unsigned int addr() const = 0;
virtual unsigned int size() const = 0;
virtual unsigned int link() const = 0;
virtual unsigned int info() const = 0;
virtual unsigned int addralign() const = 0;
virtual unsigned int entsize() const = 0;
virtual const char* data() const = 0;
};

View File

@ -109,7 +109,7 @@ static unsigned int stringTableAdd( STL_NAMESPACE vector<char> &stringTable, con
static unsigned int stringTableAddUnique( STL_NAMESPACE vector<char> &stringTable, const char* str );
template<class Type> static size_t array_size(STL_NAMESPACE vector<Type> &array);
template<class Type> static void array_push(char* &parameterOffset, STL_NAMESPACE vector<Type> &array);
inline static Elf32_Word swap16(const Elf32_Word v);
inline static unsigned int swap16(const unsigned int v);
static unsigned short getFlags(CGenum var, CGenum dir, int no, bool is_referenced, bool is_shared, int paramIndex);
static void fillStructureItems(_CGNVCONTAINERS &containers, CgStructureType *structure,
@ -211,16 +211,16 @@ int convertNvToElfFromMemory(const void *sourceData, size_t size, int endianness
cgShader.fragmentProgram.flags = CNV2END(flags);
}
Elf32_Word *tmp = (Elf32_Word *)nvbr->ucode();
unsigned int *tmp = (unsigned int *)nvbr->ucode();
const char *ucode;
Elf32_Word *buffer = NULL;
unsigned int *buffer = NULL;
if (doSwap)
{
int size = (int)nvbr->ucode_size()/sizeof(Elf32_Word);
buffer = new Elf32_Word[size];
int size = (int)nvbr->ucode_size()/sizeof(unsigned int);
buffer = new unsigned int[size];
for (int i=0;i<size;i++)
{
Elf32_Word val = ENDSWAP(tmp[i]);
unsigned int val = ENDSWAP(tmp[i]);
if (!bIsVertexProgram)
val = swap16(val);
buffer[i] = val;
@ -230,8 +230,8 @@ int convertNvToElfFromMemory(const void *sourceData, size_t size, int endianness
else
{
ucode = (const char*)tmp;
int size = (int)nvbr->ucode_size()/sizeof(Elf32_Word);
buffer = new Elf32_Word[size];
int size = (int)nvbr->ucode_size()/sizeof(unsigned int);
buffer = new unsigned int[size];
for (int i=0;i<size;i++)
{
buffer[i] = tmp[i];
@ -1033,7 +1033,7 @@ template<class Type> static void array_push(char* &parameterOffset, STL_NAMESPAC
parameterOffset += dataSize;
}
Elf32_Word inline static swap16(const Elf32_Word v)
unsigned int inline static swap16(const unsigned int v)
{
return (v>>16) | (v<<16);
}
@ -1041,7 +1041,8 @@ Elf32_Word inline static swap16(const Elf32_Word v)
unsigned short getFlags(CGenum var, CGenum dir, int no, bool is_referenced, bool is_shared, int paramIndex)
{
(void)paramIndex;
Elf32_Half flags = 0;
unsigned short flags = 0;
if (var == CG_VARYING)
flags |= CGPV_VARYING;
else if (var == CG_UNIFORM)

View File

@ -3,12 +3,6 @@
#define RGL_ALIGN_FAST_TRANSFER 128
typedef unsigned int Elf32_Addr;
typedef unsigned int Elf32_Off;
typedef unsigned short Elf32_Half;
typedef unsigned int Elf32_Word;
typedef int Elf32_Sword;
#define EI_MAG0 0
#define EI_MAG1 1
#define EI_MAG2 2
@ -48,19 +42,19 @@ typedef int Elf32_Sword;
typedef struct {
unsigned char e_ident[EI_NIDENT];
Elf32_Half e_type;
Elf32_Half e_machine;
Elf32_Word e_version;
Elf32_Addr e_entry;
Elf32_Off e_phoff;
Elf32_Off e_shoff;
Elf32_Word e_flags;
Elf32_Half e_ehsize;
Elf32_Half e_phentsize;
Elf32_Half e_phnum;
Elf32_Half e_shentsize;
Elf32_Half e_shnum;
Elf32_Half e_shstrndx;
unsigned short e_type;
unsigned short e_machine;
unsigned int e_version;
unsigned int e_entry;
unsigned int e_phoff;
unsigned int e_shoff;
unsigned int e_flags;
unsigned short e_ehsize;
unsigned short e_phentsize;
unsigned short e_phnum;
unsigned short e_shentsize;
unsigned short e_shnum;
unsigned short e_shstrndx;
} Elf32_Ehdr;
#define PT_NULL 0
@ -76,14 +70,14 @@ typedef struct {
#define PT_HIPROC 0x7fffffff
typedef struct {
Elf32_Word p_type;
Elf32_Off p_offset;
Elf32_Addr p_vaddr;
Elf32_Addr p_paddr;
Elf32_Word p_filesz;
Elf32_Word p_memsz;
Elf32_Word p_flags;
Elf32_Word p_align;
unsigned int p_type;
unsigned int p_offset;
unsigned int p_vaddr;
unsigned int p_paddr;
unsigned int p_filesz;
unsigned int p_memsz;
unsigned int p_flags;
unsigned int p_align;
} Elf32_Phdr;
#define SHT_NULL 0
@ -112,16 +106,16 @@ typedef struct {
typedef struct {
Elf32_Word sh_name;
Elf32_Word sh_type;
Elf32_Word sh_flags;
Elf32_Addr sh_addr;
Elf32_Off sh_offset;
Elf32_Word sh_size;
Elf32_Word sh_link;
Elf32_Word sh_info;
Elf32_Word sh_addralign;
Elf32_Word sh_entsize;
unsigned int sh_name;
unsigned int sh_type;
unsigned int sh_flags;
unsigned int sh_addr;
unsigned int sh_offset;
unsigned int sh_size;
unsigned int sh_link;
unsigned int sh_info;
unsigned int sh_addralign;
unsigned int sh_entsize;
} Elf32_Shdr;
#define SHN_UNDEF 0
@ -136,26 +130,26 @@ typedef struct {
#define SHN_HIRESERVE 0xffff
typedef struct {
Elf32_Word st_name;
Elf32_Word st_value;
Elf32_Word st_size;
unsigned int st_name;
unsigned int st_value;
unsigned int st_size;
unsigned char st_info;
unsigned char st_other;
Elf32_Half st_shndx;
unsigned short st_shndx;
} Elf32_Sym;
typedef struct
{
Elf32_Addr r_offset;
Elf32_Word r_info;
unsigned int r_offset;
unsigned int r_info;
} Elf32_Rel;
typedef struct
{
Elf32_Addr r_offset;
Elf32_Word r_info;
Elf32_Sword r_addend;
unsigned int r_offset;
unsigned int r_info;
int r_addend;
} Elf32_Rela;
#endif /* ELF_H */

View File

@ -313,6 +313,7 @@ extern "C"
GLAPI void APIENTRY glLoadIdentity( void );
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 glRotatef( GLfloat angle, GLfloat x, GLfloat y, GLfloat z );
GLAPI void APIENTRY glPixelStorei( GLenum pname, GLint param );
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 );

View File

@ -919,8 +919,6 @@ static GLboolean _RGLTextureIsValid( const jsTexture* texture )
static GLenum _RGLPlatformFramebufferCheckStatus( jsFramebuffer* framebuffer )
{
GLuint nBuffers = 0;
int width = 0;
int height = 0;
jsImage* image[_RGL_MAX_COLOR_ATTACHMENTS + 2] = {0};
@ -940,8 +938,6 @@ static GLenum _RGLPlatformFramebufferCheckStatus( jsFramebuffer* framebuffer )
}
image[nBuffers] = colorTexture->image;
width = image[nBuffers]->width;
height = image[nBuffers]->height;
if ( colorFormat && colorFormat != image[nBuffers]->internalFormat )
{
@ -2486,9 +2482,7 @@ static GmmBlock *gmmAllocBlock(GmmAllocator *pAllocator, uint32_t size)
{
pNewBlock = (GmmBlock *)gmmAllocFixed(0);
if (pNewBlock == NULL)
{
return NULL;
}
memset(pNewBlock, 0, sizeof(GmmBlock));
@ -2545,9 +2539,7 @@ static GmmTileBlock *gmmFindFreeTileBlock(
pNewBlock = (GmmTileBlock *)gmmAllocFixed(1);
if (pNewBlock == NULL)
{
return NULL;
}
memset(pNewBlock, 0, sizeof(GmmTileBlock));
@ -2580,9 +2572,7 @@ static GmmTileBlock *gmmCreateTileBlock(
address = pAllocator->tileStartAddress - size;
if (address > pAllocator->startAddress + pAllocator->size)
{
return NULL;
}
if (pAllocator->pTail &&
pAllocator->pTail->base.address + pAllocator->pTail->base.size > address)
@ -2629,23 +2619,15 @@ static void gmmFreeTileBlock(
GmmAllocator *pAllocator;
if (pTileBlock->pPrev)
{
pTileBlock->pPrev->pNext = pTileBlock->pNext;
}
if (pTileBlock->pNext)
{
pTileBlock->pNext->pPrev = pTileBlock->pPrev;
}
if (pTileBlock->base.isMain)
{
pAllocator = pGmmMainAllocator;
}
else
{
pAllocator = pGmmLocalAllocator;
}
if (pAllocator->pTileHead == pTileBlock)
{
@ -2757,9 +2739,7 @@ uint32_t gmmAllocExtendedTileBlock(const uint32_t size, const uint32_t tag)
}
if (retId == 0)
{
return GMM_ERROR;
}
if (!resizeSucceed)
{
@ -2778,9 +2758,7 @@ static GmmTileBlock *gmmAllocTileBlock(
GmmTileBlock *pBlock = gmmFindFreeTileBlock(pAllocator, size);
if (pBlock == NULL)
{
pBlock = gmmCreateTileBlock(pAllocator, size);
}
return pBlock;
}
@ -2792,32 +2770,22 @@ static void gmmFreeBlock(
GmmAllocator *pAllocator;
if (pBlock->pPrev)
{
pBlock->pPrev->pNext = pBlock->pNext;
}
if (pBlock->pNext)
{
pBlock->pNext->pPrev = pBlock->pPrev;
}
if (pBlock->base.isMain)
{
pAllocator = pGmmMainAllocator;
}
else
{
pAllocator = pGmmLocalAllocator;
}
if (pAllocator->pHead == pBlock)
{
pAllocator->pHead = pBlock->pNext;
if (pAllocator->pHead)
{
pAllocator->pHead->pPrev = NULL;
}
}
if (pAllocator->pTail == pBlock)
@ -2825,15 +2793,11 @@ static void gmmFreeBlock(
pAllocator->pTail = pBlock->pPrev;
if (pAllocator->pTail)
{
pAllocator->pTail->pNext = NULL;
}
}
if (pBlock->pPrev == NULL)
{
pAllocator->pSweepHead = pAllocator->pHead;
}
else if (pBlock->pPrev &&
(pAllocator->pSweepHead == NULL ||
(pAllocator->pSweepHead &&
@ -2854,13 +2818,9 @@ static void gmmAddPendingFree(
GmmAllocator *pAllocator;
if (pBlock->base.isMain)
{
pAllocator = pGmmMainAllocator;
}
else
{
pAllocator = pGmmLocalAllocator;
}
if (pAllocator->pPendingFreeTail)
{
@ -3015,9 +2975,7 @@ static inline void gmmMemcpy(const uint32_t dstOffset, const uint32_t srcOffset,
uint32_t iterations = (moveSize+moveBlockSize-1)/moveBlockSize;
for (uint32_t i=0; i<iterations; i++)
{
gmmLocalMemcpy(dstOffset+(i*moveBlockSize), srcOffset+(i*moveBlockSize), moveBlockSize);
}
gmmLocalMemcpy(dstOffset+(i*moveBlockSize), srcOffset+(i*moveBlockSize), moveBlockSize);
}
}
@ -5943,11 +5901,6 @@ GLAPI void APIENTRY glFinish (void)
_RGLFifoFinish( &_RGLState.fifo );
}
PSGLuint64 psglGetSystemTime()
{
return sys_time_get_system_time();
}
GLAPI const GLubyte* APIENTRY glGetString( GLenum name )
{
switch ( name )
@ -6696,11 +6649,6 @@ GLAPI void APIENTRY glViewport( GLint x, GLint y, GLsizei width, GLsizei height
LContext->ViewPort.XSize, LContext->ViewPort.YSize, 0.0f, 1.0f);
}
jsTexture *_RGLGetCurrentTexture( const jsTextureImageUnit *unit, GLenum target )
{
PSGLcontext* LContext = _CurrentContext;
@ -6713,21 +6661,6 @@ jsTexture *_RGLGetCurrentTexture( const jsTextureImageUnit *unit, GLenum target
return defaultTexture;
}
CgprogramHookFunction _cgProgramCreateHook = NULL;
CgprogramHookFunction _cgProgramDestroyHook = NULL;
CgprogramCopyHookFunction _cgProgramCopyHook = NULL;
@ -7488,31 +7421,6 @@ CG_API void cgDestroyProgram( CGprogram program )
return;
}
CG_API CGprofile cgGetProgramProfile( CGprogram prog )
{
if ( !CG_IS_PROGRAM( prog ) )
{
_RGLCgRaiseError( CG_INVALID_PROGRAM_HANDLE_ERROR );
return CG_PROFILE_UNKNOWN;
}
return ( CGprofile )_cgGetProgPtr( prog )->header.profile;
}
CG_API CGprofile cgGetProgramDomainProfile( CGprogram program, int index )
{
if ( !CG_IS_PROGRAM( program ) )
{
_RGLCgRaiseError( CG_INVALID_PROGRAM_HANDLE_ERROR );
return CG_PROFILE_UNKNOWN;
}
if ( index >= 1 )
return CG_PROFILE_UNKNOWN;
return ( CGprofile )_cgGetProgPtr( program )->header.profile;
}
static CGprogram _RGLCgUpdateProgramAtIndex( CGprogramGroup group, int index, int refcount )
{
if ( index < ( int )group->programCount )
@ -8374,41 +8282,20 @@ CGGL_API void cgGLSetTextureParameter( CGparameter param, GLuint texobj )
ptr->samplerSetter( ptr, &texobj, 0 );
}
CGGL_API GLuint cgGLGetTextureParameter( CGparameter param )
{
CgRuntimeParameter* ptr = _cgGLTestTextureParameter( param );
if ( ptr == NULL ) return 0;
if ( !( ptr->parameterEntry->flags & CGPF_REFERENCED ) ) { _RGLCgRaiseError( CG_INVALID_PARAMETER_ERROR ); return 0; }
return *( GLuint* )ptr->pushBufferPointer;
return 0;
}
CGGL_API void cgGLEnableTextureParameter( CGparameter param )
{
CgRuntimeParameter* ptr = _cgGLTestTextureParameter( param );
ptr->samplerSetter( ptr, NULL, 0 );
}
CGGL_API void cgGLDisableTextureParameter( CGparameter param )
{
if ( _cgGLTestTextureParameter( param ) )
{
}
}
CGGL_API void cgGLSetDebugMode( CGbool debug )
{
return;
}
void _RGLCgContextZero( _CGcontext* p )
static void _RGLCgContextZero( _CGcontext* p )
{
memset( p, 0, sizeof( *p ) );
p->compileType = CG_UNKNOWN;
}
void _RGLCgContextPushFront( _CGcontext* ctx )
static void _RGLCgContextPushFront( _CGcontext* ctx )
{
if ( _CurrentContext->RGLcgContextHead )
{
@ -8426,25 +8313,6 @@ static void destroy_context( _CGcontext*ctx )
free( ctx );
}
void _RGLCgContextPopFront()
{
if ( _CurrentContext->RGLcgContextHead )
{
_CGcontext* head = _cgGetContextPtr( _CurrentContext->RGLcgContextHead );
_CGcontext* temp = head->next;
destroy_context( head );
if ( temp )
{
_CurrentContext->RGLcgContextHead = temp->id;
}
else
{
_CurrentContext->RGLcgContextHead = 0;
}
}
}
CG_API CGcontext cgCreateContext( void )
{
_CGcontext* ptr = NULL;

View File

@ -1092,12 +1092,6 @@ void _RGLSetNativeCgFragmentProgram( const void *header );
clipY1 - clipY0, zNear, zFar, scale, offset );
}
#define PSGL_DEVICE_PARAMETERS_COLOR_FORMAT 0x0001
#define PSGL_DEVICE_PARAMETERS_DEPTH_FORMAT 0x0002
#define PSGL_DEVICE_PARAMETERS_MULTISAMPLING_MODE 0x0004
@ -1147,8 +1141,6 @@ void _RGLSetNativeCgFragmentProgram( const void *header );
#define PSGL_INIT_USE_PMQUERIES 0x0080
typedef unsigned long long int PSGLuint64;
extern void psglInit( PSGLinitOptions* options );
extern void psglExit();
@ -1167,8 +1159,6 @@ PSGLcontext* psglGetCurrentContext();
PSGLdevice* psglGetCurrentDevice();
void psglSwap( void );
PSGLuint64 psglGetSystemTime();
static inline void psglRescAdjustAspectRatio( const float horizontalScale, const float verticalScale )
{ cellRescAdjustAspectRatio( horizontalScale, verticalScale ); }

View File

@ -24,6 +24,14 @@
#include "msvc/msvc_compat.h"
#include "input/keysym.h"
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#ifdef HAVE_NETWORK_CMD
#include "network_cmd.h"
#endif
#define AUDIO_CHUNK_SIZE_BLOCKING 64
#define AUDIO_CHUNK_SIZE_NONBLOCKING 2048 // So we don't get complete line-noise when fast-forwarding audio.
#define AUDIO_MAX_RATIO 16
@ -152,10 +160,11 @@ typedef struct video_driver
// Callbacks essentially useless on PC, but useful on consoles where the drivers are used for more stuff.
#ifdef RARCH_CONSOLE
void (*set_swap_block_state)(void *data, bool toggle); // Block swapping from being called in ::frame().
void (*swap)(void *data); // Explicitly swap buffers. Only useful when set_swap_block_state() is set to true.
void (*set_aspect_ratio)(void *data, unsigned aspectratio_idx); // TODO: refactor this properly to float.
void (*start)(void);
void (*stop)(void);
void (*restart)(void);
#endif
void (*set_rotation)(void *data, unsigned rotation);
} video_driver_t;
@ -167,6 +176,10 @@ typedef struct driver
void *audio_data;
void *video_data;
void *input_data;
#ifdef HAVE_NETWORK_CMD
network_cmd_t *network_cmd;
#endif
} driver_t;
void init_drivers(void);
@ -245,8 +258,17 @@ extern const input_driver_t input_linuxraw;
#define input_poll_func() driver.input->poll(driver.input_data)
#define input_input_state_func(snes_keybinds, port, device, index, id) \
driver.input->input_state(driver.input_data, snes_keybinds, port, device, index, id)
#define input_key_pressed_func(key) driver.input->key_pressed(driver.input_data, key)
#define input_free_func() driver.input->free(driver.input_data)
static inline bool input_key_pressed_func(int key)
{
bool ret = driver.input->key_pressed(driver.input_data, key);
#ifdef HAVE_NETWORK_CMD
if (!ret && driver.network_cmd)
ret = network_cmd_get(driver.network_cmd, key);
#endif
return ret;
}
#endif
#endif

View File

@ -55,6 +55,10 @@
#include "netplay.h"
#endif
#ifdef HAVE_NETWORK_CMD
#include "network_cmd.h"
#endif
#include "audio/resampler.h"
#if defined(_WIN32) && !defined(_XBOX)
@ -177,6 +181,9 @@ struct settings
bool block_sram_overwrite;
bool savestate_auto_index;
bool network_cmd_enable;
uint16_t network_cmd_port;
};
// Settings and/or global state that is specific to a console-style implementation.
@ -194,6 +201,7 @@ struct console_settings
#ifdef __CELLOS_LV2__
bool custom_bgm_enable;
#endif
bool check_available_resolutions;
bool block_config_read;
bool default_sram_dir_enable;
bool default_savestate_dir_enable;

411
gfx/context/ps3_ctx.c Normal file
View File

@ -0,0 +1,411 @@
/* 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 "../../driver.h"
#include <stdint.h>
#include <sys/spu_initialize.h>
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include "../gl_common.h"
#include "../image.h"
#include "../../ps3/shared.h"
#include "ps3_ctx.h"
#ifdef HAVE_OPENGLES
#define glOrtho glOrthof
#endif
static struct texture_image menu_texture;
static PSGLdevice* gl_device;
static PSGLcontext* gl_context;
// Other vertex orientations
static const GLfloat vertexes_90[] = {
0, 1,
1, 1,
1, 0,
0, 0
};
static const GLfloat vertexes_180[] = {
1, 1,
1, 0,
0, 0,
0, 1
};
static const GLfloat vertexes_270[] = {
1, 0,
0, 0,
0, 1,
1, 1
};
//forward decls
extern const GLfloat *vertex_ptr;
extern const GLfloat *default_vertex_ptr;
void gfx_ctx_set_swap_interval(unsigned interval, bool inited)
{
(void)inited;
if (gl_context)
{
if (interval)
glEnable(GL_VSYNC_SCE);
else
glDisable(GL_VSYNC_SCE);
}
}
void gfx_ctx_check_window(bool *quit,
bool *resize, unsigned *width, unsigned *height, unsigned frame_count)
{
gl_t *gl = driver.video_data;
*quit = false;
*resize = false;
#ifdef HAVE_SYSUTILS
cellSysutilCheckCallback();
#endif
if (gl->quitting)
*quit = true;
if (gl->should_resize)
*resize = true;
}
bool gfx_ctx_window_has_focus(void)
{
return true;
}
void gfx_ctx_set_resize(unsigned width, unsigned height) { }
void gfx_ctx_swap_buffers(void)
{
psglSwap();
}
bool gfx_ctx_menu_init(void)
{
gl_t *gl = driver.video_data;
if (!gl)
return false;
#ifdef HAVE_CG_MENU
glGenTextures(1, &gl->menu_texture_id);
RARCH_LOG("Loading texture image for menu...\n");
if (!texture_image_load(DEFAULT_MENU_BORDER_FILE, &menu_texture))
{
RARCH_ERR("Failed to load texture image for menu.\n");
return false;
}
glBindTexture(GL_TEXTURE_2D, gl->menu_texture_id);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_BORDER);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_BORDER);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexImage2D(GL_TEXTURE_2D, 0, GL_ARGB_SCE, menu_texture.width, menu_texture.height, 0,
GL_ARGB_SCE, GL_UNSIGNED_INT_8_8_8_8, menu_texture.pixels);
glBindTexture(GL_TEXTURE_2D, gl->texture[gl->tex_index]);
free(menu_texture.pixels);
#endif
return true;
}
void gfx_ctx_update_window_title(bool reset) { }
void gfx_ctx_get_video_size(unsigned *width, unsigned *height)
{
psglGetDeviceDimensions(gl_device, width, height);
}
bool gfx_ctx_init(void)
{
PSGLinitOptions options = {
.enable = PSGL_INIT_MAX_SPUS | PSGL_INIT_INITIALIZE_SPUS,
.maxSPUs = 1,
.initializeSPUs = GL_FALSE,
};
#if CELL_SDK_VERSION < 0x340000
options.enable |= PSGL_INIT_HOST_MEMORY_SIZE;
#endif
// Initialize 6 SPUs but reserve 1 SPU as a raw SPU for PSGL
sys_spu_initialize(6, 1);
psglInit(&options);
PSGLdeviceParameters params;
params.enable = PSGL_DEVICE_PARAMETERS_COLOR_FORMAT |
PSGL_DEVICE_PARAMETERS_DEPTH_FORMAT |
PSGL_DEVICE_PARAMETERS_MULTISAMPLING_MODE;
params.colorFormat = GL_ARGB_SCE;
params.depthFormat = GL_NONE;
params.multisamplingMode = GL_MULTISAMPLING_NONE_SCE;
if (g_console.triple_buffering_enable)
{
params.enable |= PSGL_DEVICE_PARAMETERS_BUFFERING_MODE;
params.bufferingMode = PSGL_BUFFERING_MODE_TRIPLE;
}
if (g_console.current_resolution_id)
{
CellVideoOutResolution resolution;
cellVideoOutGetResolution(g_console.current_resolution_id, &resolution);
params.enable |= PSGL_DEVICE_PARAMETERS_WIDTH_HEIGHT;
params.width = resolution.width;
params.height = resolution.height;
}
gl_device = psglCreateDeviceExtended(&params);
gl_context = psglCreateContext();
psglMakeCurrent(gl_context, gl_device);
psglResetCurrentContext();
return true;
}
bool gfx_ctx_set_video_mode(
unsigned width, unsigned height,
unsigned bits, bool fullscreen)
{
return true;
}
void gfx_ctx_destroy(void)
{
psglDestroyContext(gl_context);
psglDestroyDevice(gl_device);
psglExit();
}
void gfx_ctx_input_driver(const input_driver_t **input, void **input_data) { }
void gfx_ctx_set_filtering(unsigned index, bool set_smooth)
{
gl_t *gl = driver.video_data;
if (!gl)
return;
if (index == 1)
{
// Apply to all PREV textures.
for (unsigned i = 0; i < TEXTURES; i++)
{
glBindTexture(GL_TEXTURE_2D, gl->texture[i]);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, set_smooth ? GL_LINEAR : GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, set_smooth ? GL_LINEAR : GL_NEAREST);
}
}
else if (index >= 2 && gl->fbo_inited)
{
glBindTexture(GL_TEXTURE_2D, gl->fbo_texture[index - 2]);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, set_smooth ? GL_LINEAR : GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, set_smooth ? GL_LINEAR : GL_NEAREST);
}
glBindTexture(GL_TEXTURE_2D, gl->texture[gl->tex_index]);
}
void gfx_ctx_set_fbo(bool enable)
{
gl_t *gl = driver.video_data;
gl->fbo_inited = enable;
gl->render_to_tex = enable;
}
/*============================================================
MISC
TODO: Refactor
============================================================ */
void gfx_ctx_get_available_resolutions (void)
{
bool defaultresolution;
uint32_t resolution_count;
uint16_t num_videomodes;
if (g_console.check_available_resolutions)
return;
defaultresolution = true;
uint32_t videomode[] = {
CELL_VIDEO_OUT_RESOLUTION_480, CELL_VIDEO_OUT_RESOLUTION_576,
CELL_VIDEO_OUT_RESOLUTION_960x1080, CELL_VIDEO_OUT_RESOLUTION_720,
CELL_VIDEO_OUT_RESOLUTION_1280x1080, CELL_VIDEO_OUT_RESOLUTION_1440x1080,
CELL_VIDEO_OUT_RESOLUTION_1600x1080, CELL_VIDEO_OUT_RESOLUTION_1080
};
num_videomodes = sizeof(videomode) / sizeof(uint32_t);
resolution_count = 0;
for (unsigned i = 0; i < num_videomodes; i++)
{
if (cellVideoOutGetResolutionAvailability(CELL_VIDEO_OUT_PRIMARY, videomode[i], CELL_VIDEO_OUT_ASPECT_AUTO, 0))
resolution_count++;
}
g_console.supported_resolutions = malloc(resolution_count * sizeof(uint32_t));
g_console.supported_resolutions_count = 0;
for (unsigned i = 0; i < num_videomodes; i++)
{
if (cellVideoOutGetResolutionAvailability(CELL_VIDEO_OUT_PRIMARY, videomode[i], CELL_VIDEO_OUT_ASPECT_AUTO, 0))
{
g_console.supported_resolutions[g_console.supported_resolutions_count++] = videomode[i];
g_console.initial_resolution_id = videomode[i];
if (g_console.current_resolution_id == videomode[i])
{
defaultresolution = false;
g_console.current_resolution_index = g_console.supported_resolutions_count-1;
}
}
}
/* In case we didn't specify a resolution - make the last resolution
that was added to the list (the highest resolution) the default resolution */
if (g_console.current_resolution_id > num_videomodes || defaultresolution)
g_console.current_resolution_index = g_console.supported_resolutions_count - 1;
g_console.check_available_resolutions = true;
}
void ps3_next_resolution (void)
{
if (g_console.current_resolution_index + 1 < g_console.supported_resolutions_count)
{
g_console.current_resolution_index++;
g_console.current_resolution_id = g_console.supported_resolutions[g_console.current_resolution_index];
}
}
void ps3_previous_resolution (void)
{
if (g_console.current_resolution_index)
{
g_console.current_resolution_index--;
g_console.current_resolution_id = g_console.supported_resolutions[g_console.current_resolution_index];
}
}
int ps3_check_resolution(uint32_t resolution_id)
{
return cellVideoOutGetResolutionAvailability(CELL_VIDEO_OUT_PRIMARY, resolution_id, CELL_VIDEO_OUT_ASPECT_AUTO, 0);
}
const char *ps3_get_resolution_label(uint32_t resolution)
{
switch (resolution)
{
case CELL_VIDEO_OUT_RESOLUTION_480:
return "720x480 (480p)";
case CELL_VIDEO_OUT_RESOLUTION_576:
return "720x576 (576p)";
case CELL_VIDEO_OUT_RESOLUTION_720:
return "1280x720 (720p)";
case CELL_VIDEO_OUT_RESOLUTION_960x1080:
return "960x1080";
case CELL_VIDEO_OUT_RESOLUTION_1280x1080:
return "1280x1080";
case CELL_VIDEO_OUT_RESOLUTION_1440x1080:
return "1440x1080";
case CELL_VIDEO_OUT_RESOLUTION_1600x1080:
return "1600x1080";
case CELL_VIDEO_OUT_RESOLUTION_1080:
return "1920x1080 (1080p)";
default:
return "Unknown";
}
}
void gfx_ctx_set_projection(gl_t *gl, const struct gl_ortho *ortho, bool allow_rotate)
{
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
if (allow_rotate)
{
switch (gl->rotation)
{
case 90:
vertex_ptr = vertexes_90;
break;
case 180:
vertex_ptr = vertexes_180;
break;
case 270:
vertex_ptr = vertexes_270;
break;
case 0:
default:
vertex_ptr = default_vertex_ptr;
break;
}
}
glVertexPointer(2, GL_FLOAT, 0, vertex_ptr);
glOrtho(ortho->left, ortho->right, ortho->bottom, ortho->top, ortho->znear, ortho->zfar);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
}
void gfx_ctx_set_aspect_ratio(void *data, unsigned aspectratio_index)
{
(void)data;
gl_t *gl = driver.video_data;
if (g_console.aspect_ratio_index == ASPECT_RATIO_AUTO)
rarch_set_auto_viewport(g_extern.frame_cache.width, g_extern.frame_cache.height);
g_settings.video.aspect_ratio = aspectratio_lut[g_console.aspect_ratio_index].value;
g_settings.video.force_aspect = false;
gl->keep_aspect = true;
gl->should_resize = true;
}
void gfx_ctx_set_overscan(void)
{
gl_t *gl = driver.video_data;
if (!gl)
return;
gl->should_resize = true;
}

View File

@ -1,7 +1,7 @@
/* 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.
@ -14,15 +14,7 @@
* If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef _XDK360_VIDEO_GENERAL_H
#define _XDK360_VIDEO_GENERAL_H
#define LAST_ASPECT_RATIO ASPECT_RATIO_CUSTOM
#define IS_TIMER_NOT_EXPIRED() (g_frame_count < g_console.timer_expiration_frame_count)
#define IS_TIMER_EXPIRED() (!(IS_TIMER_NOT_EXPIRED()))
#define SET_TIMER_EXPIRATION(value) g_console.timer_expiration_frame_count = g_frame_count + value;
extern unsigned g_frame_count;
#ifndef _PS3_CTX_H
#define _PS3_CTX_H
#endif

View File

@ -13,15 +13,20 @@
* If not, see <http://www.gnu.org/licenses/>.
*/
#include "sdlwrap.h"
#include "SDL_syswm.h"
#include "../general.h"
// Compatibility wrapper between SDL 1.2/1.3 for OpenGL.
// Wraps functions which differ in 1.2 and 1.3.
#include "../gfx_context.h"
#include "../gfx_common.h"
#include "../../general.h"
#ifdef __APPLE__
#include <OpenGL/OpenGL.h>
#include <OpenGL/gl.h>
#endif
#include "sdl_ctx.h"
// SDL 1.2 is portable, sure, but you still need some platform specific workarounds ;)
// Hopefully SDL 1.3 will solve this more cleanly :D
// Welcome to #ifdef HELL. :D
@ -35,7 +40,7 @@ static SDL_GLContext g_ctx;
static bool g_fullscreen;
static unsigned g_interval;
void sdlwrap_set_swap_interval(unsigned interval, bool inited)
void gfx_ctx_set_swap_interval(unsigned interval, bool inited)
{
g_interval = interval;
@ -67,14 +72,41 @@ void sdlwrap_set_swap_interval(unsigned interval, bool inited)
else
RARCH_WARN("Could not find GLX VSync call.\n");
#endif
}
#endif
if (!success)
RARCH_WARN("Failed to set swap interval.\n");
}
bool sdlwrap_init(void)
static void gfx_ctx_wm_set_caption(const char *str)
{
#if SDL_MODERN
SDL_SetWindowTitle(g_window, str);
#else
SDL_WM_SetCaption(str, NULL);
#endif
}
void gfx_ctx_update_window_title(bool reset)
{
if (reset)
gfx_window_title_reset();
char buf[128];
if (gfx_window_title(buf, sizeof(buf)))
gfx_ctx_wm_set_caption(buf);
}
void gfx_ctx_get_video_size(unsigned *width, unsigned *height)
{
const SDL_VideoInfo *video_info = SDL_GetVideoInfo();
rarch_assert(video_info);
*width = video_info->current_w;
*height = video_info->current_h;
}
bool gfx_ctx_init(void)
{
#if SDL_MODERN
bool ret = SDL_VideoInit(NULL) == 0;
@ -90,7 +122,7 @@ bool sdlwrap_init(void)
}
#if SDL_MODERN
void sdlwrap_destroy(void)
void gfx_ctx_destroy(void)
{
if (g_ctx)
SDL_GL_DeleteContext(g_ctx);
@ -102,13 +134,13 @@ void sdlwrap_destroy(void)
SDL_VideoQuit();
}
#else
void sdlwrap_destroy(void)
void gfx_ctx_destroy(void)
{
SDL_QuitSubSystem(SDL_INIT_VIDEO);
}
#endif
bool sdlwrap_set_video_mode(
bool gfx_ctx_set_video_mode(
unsigned width, unsigned height,
unsigned bits, bool fullscreen)
{
@ -167,7 +199,7 @@ bool sdlwrap_set_video_mode(
if (attr <= 0 && g_interval)
{
RARCH_WARN("SDL failed to setup VSync, attempting to recover using native calls.\n");
sdlwrap_set_swap_interval(g_interval, true);
gfx_ctx_set_swap_interval(g_interval, true);
}
#endif
@ -178,12 +210,15 @@ bool sdlwrap_set_video_mode(
if (attr <= 0)
RARCH_WARN("GL double buffer has not been enabled.\n");
// Remove that ugly mouse :D
SDL_ShowCursor(SDL_DISABLE);
return true;
}
// SDL 1.2 has an awkward model where you need to "confirm" window resizing.
// SDL 1.3 luckily removes this quirk.
void sdlwrap_set_resize(unsigned width, unsigned height)
void gfx_ctx_set_resize(unsigned width, unsigned height)
{
#if SDL_MODERN
(void)width;
@ -198,16 +233,7 @@ void sdlwrap_set_resize(unsigned width, unsigned height)
#endif
}
void sdlwrap_wm_set_caption(const char *str)
{
#if SDL_MODERN
SDL_SetWindowTitle(g_window, str);
#else
SDL_WM_SetCaption(str, NULL);
#endif
}
void sdlwrap_swap_buffers(void)
void gfx_ctx_swap_buffers(void)
{
#if SDL_MODERN
SDL_GL_SwapWindow(g_window);
@ -216,7 +242,7 @@ void sdlwrap_swap_buffers(void)
#endif
}
bool sdlwrap_key_pressed(int key)
bool gfx_ctx_key_pressed(int key)
{
int num_keys;
#if SDL_MODERN
@ -238,7 +264,7 @@ bool sdlwrap_key_pressed(int key)
// 1.2 specific workaround for tiling WMs. In 1.3 we call GetSize directly, so we don't need to rely on
// proper event handling (I hope).
#if !defined(__APPLE__) && !defined(_WIN32) && !SDL_MODERN && !defined(XENON)
static void sdlwrap_get_window_size(unsigned *width, unsigned *height)
static void gfx_ctx_get_window_size(unsigned *width, unsigned *height)
{
SDL_SysWMinfo info;
SDL_VERSION(&info.version);
@ -255,7 +281,7 @@ static void sdlwrap_get_window_size(unsigned *width, unsigned *height)
}
#endif
void sdlwrap_check_window(bool *quit,
void gfx_ctx_check_window(bool *quit,
bool *resize, unsigned *width, unsigned *height, unsigned frame_count)
{
*quit = false;
@ -320,7 +346,7 @@ void sdlwrap_check_window(bool *quit,
if (!*resize && !g_fullscreen)
{
unsigned new_width, new_height;
sdlwrap_get_window_size(&new_width, &new_height);
gfx_ctx_get_window_size(&new_width, &new_height);
if ((new_width != *width || new_height != *height) || (frame_count == 10)) // Ugly hack :D
{
*resize = true;
@ -333,7 +359,7 @@ void sdlwrap_check_window(bool *quit,
#endif
}
bool sdlwrap_get_wm_info(SDL_SysWMinfo *info)
bool gfx_ctx_get_wm_info(SDL_SysWMinfo *info)
{
#ifdef XENON
(void)info;
@ -348,7 +374,7 @@ bool sdlwrap_get_wm_info(SDL_SysWMinfo *info)
#endif
}
bool sdlwrap_window_has_focus(void)
bool gfx_ctx_window_has_focus(void)
{
#if SDL_MODERN
Uint32 flags = SDL_GetWindowFlags(g_window);
@ -359,3 +385,30 @@ bool sdlwrap_window_has_focus(void)
#endif
}
void gfx_ctx_input_driver(const input_driver_t **input, void **input_data)
{
void *sdl_input = input_sdl.init();
if (sdl_input)
{
*input = &input_sdl;
*input_data = sdl_input;
}
else
*input = NULL;
}
#ifdef HAVE_OPENGL
void gfx_ctx_set_projection(gl_t *gl, const struct gl_ortho *ortho, bool allow_rotate)
{
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
if (allow_rotate)
glRotatef(gl->rotation, 0, 0, 1);
glOrtho(ortho->left, ortho->right, ortho->bottom, ortho->top, ortho->znear, ortho->zfar);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
}
#endif

View File

@ -1,7 +1,5 @@
/* RetroArch - A frontend for libretro.
* Copyright (C) 2010-2012 - Hans-Kristian Arntzen
*
*
* RetroArch is free software: you can redistribute it and/or modify it under the terms
* of the GNU General Public License as published by the Free Software Found-
@ -15,17 +13,11 @@
* If not, see <http://www.gnu.org/licenses/>.
*/
// Compatibility wrapper between SDL 1.2/1.3 for OpenGL.
// Wraps functions which differ in 1.2 and 1.3.
#ifndef __SDLWRAP_H
#define __SDLWRAP_H
#include "../boolean.h"
#ifndef _SDL_CTX_H
#define _SDL_CTX_H
#include "SDL.h"
#include "SDL_version.h"
#include "SDL_syswm.h"
#if SDL_VERSION_ATLEAST(1, 3, 0)
#define SDL_MODERN 1
@ -40,29 +32,4 @@
memcpy(&(sym), &sym__, sizeof(void*)); \
}
void sdlwrap_set_swap_interval(unsigned interval, bool inited);
bool sdlwrap_set_video_mode(
unsigned width, unsigned height,
unsigned bits, bool fullscreen);
bool sdlwrap_init(void);
void sdlwrap_destroy(void);
void sdlwrap_wm_set_caption(const char *str);
void sdlwrap_swap_buffers(void);
bool sdlwrap_key_pressed(int key);
void sdlwrap_check_window(bool *quit,
bool *resize, unsigned *width, unsigned *height, unsigned frame_count);
void sdlwrap_set_resize(unsigned width, unsigned height);
bool sdlwrap_get_wm_info(SDL_SysWMinfo *info);
bool sdlwrap_window_has_focus(void);
#endif

135
gfx/context/xdk360_ctx.c Normal file
View File

@ -0,0 +1,135 @@
/* 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 "../../driver.h"
#include <stdint.h>
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include "xdk360_ctx.h"
#include "../../360/xdk360_video.h"
void gfx_ctx_set_swap_interval(unsigned interval, bool inited)
{
(void)inited;
xdk360_video_t *d3d9 = (xdk360_video_t*)driver.video_data;
if (interval)
d3d9->d3d_render_device->SetRenderState(D3DRS_PRESENTINTERVAL, D3DPRESENT_INTERVAL_ONE);
else
d3d9->d3d_render_device->SetRenderState(D3DRS_PRESENTINTERVAL, D3DPRESENT_INTERVAL_IMMEDIATE);
}
void gfx_ctx_check_window(bool *quit,
bool *resize, unsigned *width, unsigned *height, unsigned frame_count)
{
xdk360_video_t *d3d9 = (xdk360_video_t*)driver.video_data;
*quit = false;
*resize = false;
if (d3d9->quitting)
*quit = true;
if (d3d9->should_resize)
*resize = true;
}
bool gfx_ctx_window_has_focus(void)
{
return true;
}
void gfx_ctx_set_resize(unsigned width, unsigned height) { }
void gfx_ctx_swap_buffers(void)
{
xdk360_video_t *d3d9 = (xdk360_video_t*)driver.video_data;
d3d9->d3d_render_device->Present(NULL, NULL, NULL, NULL);
}
bool gfx_ctx_menu_init(void)
{
return true;
}
void gfx_ctx_update_window_title(bool reset) { }
void gfx_ctx_get_video_size(unsigned *width, unsigned *height)
{
(void)width;
(void)height;
}
bool gfx_ctx_init(void)
{
return true;
}
bool gfx_ctx_set_video_mode(
unsigned width, unsigned height,
unsigned bits, bool fullscreen)
{
return true;
}
void gfx_ctx_destroy(void)
{
}
void gfx_ctx_input_driver(const input_driver_t **input, void **input_data) { }
void gfx_ctx_set_filtering(unsigned index, bool set_smooth) { }
void gfx_ctx_set_fbo(bool enable)
{
xdk360_video_t *d3d9 = (xdk360_video_t*)driver.video_data;
d3d9->fbo_enabled = enable;
}
/*============================================================
MISC
TODO: Refactor
============================================================ */
void gfx_ctx_set_projection(xdk360_video_t *d3d9, const struct gl_ortho *ortho, bool allow_rotate) { }
void gfx_ctx_set_aspect_ratio(void *data, unsigned aspectratio_index)
{
(void)data;
xdk360_video_t *d3d9 = (xdk360_video_t*)driver.video_data;
if(g_console.aspect_ratio_index == ASPECT_RATIO_AUTO)
rarch_set_auto_viewport(g_extern.frame_cache.width, g_extern.frame_cache.height);
g_settings.video.aspect_ratio = aspectratio_lut[g_console.aspect_ratio_index].value;
g_settings.video.force_aspect = false;
d3d9->should_resize = true;
}
void gfx_ctx_set_overscan(void)
{
xdk360_video_t *d3d9 = (xdk360_video_t*)driver.video_data;
if (!d3d9)
return;
d3d9->should_resize = true;
}

20
gfx/context/xdk360_ctx.h Normal file
View File

@ -0,0 +1,20 @@
/* 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 _XDK360_CTX_H
#define _XDK360_CTX_H
#endif

View File

@ -22,11 +22,10 @@
#include <stdint.h>
#include "../dynamic.h"
#include "../general.h"
#include "sdlwrap.h"
#include "gfx_common.h"
#ifdef HAVE_FREETYPE
#include "fonts.h"
#include "fonts/fonts.h"
#endif
#ifdef HAVE_PYTHON

View File

@ -14,7 +14,7 @@
*/
#include "fonts.h"
#include "../file.h"
#include "../../file.h"
#include <string.h>
#include <stddef.h>
#include <stdlib.h>

295
gfx/fonts/freetype.c Normal file
View File

@ -0,0 +1,295 @@
/* 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 "../gl_common.h"
void gl_init_font(gl_t *gl, const char *font_path, unsigned font_size)
{
#ifdef HAVE_FREETYPE
if (!g_settings.video.font_enable)
return;
const char *path = font_path;
if (!*path)
path = font_renderer_get_default_font();
if (path)
{
gl->font = font_renderer_new(path, font_size);
if (gl->font)
{
glGenTextures(1, &gl->font_tex);
glBindTexture(GL_TEXTURE_2D, gl->font_tex);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_BORDER);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_BORDER);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glBindTexture(GL_TEXTURE_2D, gl->texture[gl->tex_index]);
}
else
RARCH_WARN("Couldn't init font renderer with font \"%s\"...\n", font_path);
}
else
RARCH_LOG("Did not find default font.\n");
for (unsigned i = 0; i < 4; i++)
{
gl->font_color[4 * i + 0] = g_settings.video.msg_color_r;
gl->font_color[4 * i + 1] = g_settings.video.msg_color_g;
gl->font_color[4 * i + 2] = g_settings.video.msg_color_b;
gl->font_color[4 * i + 3] = 1.0;
}
for (unsigned i = 0; i < 4; i++)
{
for (unsigned j = 0; j < 3; j++)
gl->font_color_dark[4 * i + j] = 0.3 * gl->font_color[4 * i + j];
gl->font_color_dark[4 * i + 3] = 1.0;
}
#else
(void)gl;
(void)font_path;
(void)font_size;
#endif
}
void gl_deinit_font(gl_t *gl)
{
#ifdef HAVE_FREETYPE
if (gl->font)
{
font_renderer_free(gl->font);
glDeleteTextures(1, &gl->font_tex);
if (gl->font_tex_empty_buf)
free(gl->font_tex_empty_buf);
}
#else
(void)gl;
#endif
}
#ifdef HAVE_FREETYPE
// Somewhat overwhelming code just to render some damn fonts.
// We aim to use NPOT textures for compatibility with old and shitty cards.
// Also, we want to avoid reallocating a texture for each glyph (performance dips), so we
// contruct the whole texture using one call, and copy straight to it with
// glTexSubImage.
struct font_rect
{
int x, y;
int width, height;
int pot_width, pot_height;
};
static void calculate_msg_geometry(const struct font_output *head, struct font_rect *rect)
{
int x_min = head->off_x;
int x_max = head->off_x + head->width;
int y_min = head->off_y;
int y_max = head->off_y + head->height;
while ((head = head->next))
{
int left = head->off_x;
int right = head->off_x + head->width;
int bottom = head->off_y;
int top = head->off_y + head->height;
if (left < x_min)
x_min = left;
if (right > x_max)
x_max = right;
if (bottom < y_min)
y_min = bottom;
if (top > y_max)
y_max = top;
}
rect->x = x_min;
rect->y = y_min;
rect->width = x_max - x_min;
rect->height = y_max - y_min;
}
static void adjust_power_of_two(gl_t *gl, struct font_rect *geom)
{
// Some systems really hate NPOT textures.
geom->pot_width = next_pow2(geom->width);
geom->pot_height = next_pow2(geom->height);
if ((geom->pot_width > gl->font_tex_w) || (geom->pot_height > gl->font_tex_h))
{
gl->font_tex_empty_buf = realloc(gl->font_tex_empty_buf, geom->pot_width * geom->pot_height);
memset(gl->font_tex_empty_buf, 0, geom->pot_width * geom->pot_height);
glPixelStorei(GL_UNPACK_ALIGNMENT, 8);
glPixelStorei(GL_UNPACK_ROW_LENGTH, geom->pot_width);
glTexImage2D(GL_TEXTURE_2D, 0, GL_INTENSITY8, geom->pot_width, geom->pot_height,
0, GL_LUMINANCE, GL_UNSIGNED_BYTE, gl->font_tex_empty_buf);
gl->font_tex_w = geom->pot_width;
gl->font_tex_h = geom->pot_height;
}
}
// Old style "blitting", so we can render all the fonts in one go.
// TODO: Is it possible that fonts could overlap if we blit without alpha blending?
static void blit_fonts(gl_t *gl, const struct font_output *head, const struct font_rect *geom)
{
// Clear out earlier fonts.
glPixelStorei(GL_UNPACK_ALIGNMENT, 8);
glPixelStorei(GL_UNPACK_ROW_LENGTH, gl->font_tex_w);
glTexSubImage2D(GL_TEXTURE_2D,
0, 0, 0, gl->font_tex_w, gl->font_tex_h,
GL_LUMINANCE, GL_UNSIGNED_BYTE, gl->font_tex_empty_buf);
while (head)
{
// head has top-left oriented coords.
int x = head->off_x - geom->x;
int y = head->off_y - geom->y;
y = gl->font_tex_h - head->height - y - 1;
glPixelStorei(GL_UNPACK_ALIGNMENT, get_alignment(head->pitch));
glPixelStorei(GL_UNPACK_ROW_LENGTH, head->pitch);
glTexSubImage2D(GL_TEXTURE_2D,
0, x, y, head->width, head->height,
GL_LUMINANCE, GL_UNSIGNED_BYTE, head->output);
head = head->next;
}
}
static void calculate_font_coords(gl_t *gl,
GLfloat font_vertex[8], GLfloat font_vertex_dark[8], GLfloat font_tex_coords[8])
{
GLfloat scale_factor = g_settings.video.font_scale ?
(GLfloat)gl->full_x / (GLfloat)gl->vp_width :
1.0f;
GLfloat lx = g_settings.video.msg_pos_x;
GLfloat hx = (GLfloat)gl->font_last_width / (gl->vp_width * scale_factor) + lx;
GLfloat ly = g_settings.video.msg_pos_y;
GLfloat hy = (GLfloat)gl->font_last_height / (gl->vp_height * scale_factor) + ly;
font_vertex[0] = lx;
font_vertex[1] = ly;
font_vertex[2] = lx;
font_vertex[3] = hy;
font_vertex[4] = hx;
font_vertex[5] = hy;
font_vertex[6] = hx;
font_vertex[7] = ly;
GLfloat shift_x = 2.0f / gl->vp_width;
GLfloat shift_y = 2.0f / gl->vp_height;
for (unsigned i = 0; i < 4; i++)
{
font_vertex_dark[2 * i + 0] = font_vertex[2 * i + 0] - shift_x;
font_vertex_dark[2 * i + 1] = font_vertex[2 * i + 1] - shift_y;
}
lx = 0.0f;
hx = (GLfloat)gl->font_last_width / gl->font_tex_w;
ly = 1.0f - (GLfloat)gl->font_last_height / gl->font_tex_h;
hy = 1.0f;
font_tex_coords[0] = lx;
font_tex_coords[1] = hy;
font_tex_coords[2] = lx;
font_tex_coords[3] = ly;
font_tex_coords[4] = hx;
font_tex_coords[5] = ly;
font_tex_coords[6] = hx;
font_tex_coords[7] = hy;
}
extern const GLfloat vertexes_flipped[];
extern const GLfloat white_color[];
#endif
void gl_render_msg_post(gl_t *gl)
{
#ifdef HAVE_FREETYPE
// Go back to old rendering path.
glTexCoordPointer(2, GL_FLOAT, 0, gl->tex_coords);
glVertexPointer(2, GL_FLOAT, 0, vertexes_flipped);
glColorPointer(4, GL_FLOAT, 0, white_color);
glBindTexture(GL_TEXTURE_2D, gl->texture[gl->tex_index]);
glDisable(GL_BLEND);
struct gl_ortho ortho = {0, 1, 0, 1, -1, 1};
gl_set_projection(gl, &ortho, true);
#else
(void)gl;
#endif
}
void gl_render_msg(gl_t *gl, const char *msg)
{
#ifdef HAVE_FREETYPE
if (!gl->font)
return;
gl_shader_use(0);
gl_set_viewport(gl, gl->win_width, gl->win_height, false, false);
glEnable(GL_BLEND);
GLfloat font_vertex[8];
GLfloat font_vertex_dark[8];
GLfloat font_tex_coords[8];
glBindTexture(GL_TEXTURE_2D, gl->font_tex);
glTexCoordPointer(2, GL_FLOAT, 0, font_tex_coords);
struct font_output_list out;
// If we get the same message, there's obviously no need to render fonts again ...
if (strcmp(gl->font_last_msg, msg) != 0)
{
font_renderer_msg(gl->font, msg, &out);
struct font_output *head = out.head;
struct font_rect geom;
calculate_msg_geometry(head, &geom);
adjust_power_of_two(gl, &geom);
blit_fonts(gl, head, &geom);
font_renderer_free_output(&out);
strlcpy(gl->font_last_msg, msg, sizeof(gl->font_last_msg));
gl->font_last_width = geom.width;
gl->font_last_height = geom.height;
}
calculate_font_coords(gl, font_vertex, font_vertex_dark, font_tex_coords);
glVertexPointer(2, GL_FLOAT, 0, font_vertex_dark);
glColorPointer(4, GL_FLOAT, 0, gl->font_color_dark);
glDrawArrays(GL_QUADS, 0, 4);
glVertexPointer(2, GL_FLOAT, 0, font_vertex);
glColorPointer(4, GL_FLOAT, 0, gl->font_color);
glDrawArrays(GL_QUADS, 0, 4);
#else
(void)gl;
(void)msg;
#endif
}

View File

@ -0,0 +1,49 @@
/* 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 <cell/dbgfont.h>
#include "../gl_common.h"
void gl_init_font(gl_t *gl, const char *font_path, unsigned font_size)
{
(void)font_path;
(void)font_size;
CellDbgFontConfig cfg = {
.bufSize = 512,
.screenWidth = gl->win_width,
.screenHeight = gl->win_height,
};
cellDbgFontInit(&cfg);
}
void gl_deinit_font(gl_t *gl)
{
cellDbgFontExit();
}
void gl_render_msg(gl_t *gl, const char *msg)
{
cellDbgFontPrintf(g_settings.video.msg_pos_x, g_settings.video.msg_pos_y, 1.11f, BLUE, msg);
cellDbgFontPrintf(g_settings.video.msg_pos_x, g_settings.video.msg_pos_y, 1.10f, WHITE, msg);
}
void gl_render_msg_post(gl_t *gl)
{
cellDbgFontDraw();
}

85
gfx/gfx_context.h Normal file
View File

@ -0,0 +1,85 @@
/* RetroArch - A frontend for libretro.
* Copyright (C) 2010-2012 - Hans-Kristian Arntzen
*
*
* RetroArch is free software: you can redistribute it and/or modify it under the terms
* of the GNU General Public License as published by the Free Software Found-
* ation, either version 3 of the License, or (at your option) any later version.
*
* 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 __GFX_CONTEXT_H
#define __GFX_CONTEXT_H
#include "../boolean.h"
#include "../driver.h"
#ifdef HAVE_CONFIG_H
#include "../config.h"
#endif
#ifdef HAVE_OPENGL
#include "gl_common.h"
#define VID_HANDLE gl_t
#endif
#ifdef HAVE_D3D9
#define VID_HANDLE xdk360_video_t
#endif
#ifdef HAVE_SDL
#include "SDL_syswm.h"
#endif
void gfx_ctx_set_swap_interval(unsigned interval, bool inited);
bool gfx_ctx_set_video_mode(
unsigned width, unsigned height,
unsigned bits, bool fullscreen);
bool gfx_ctx_init(void);
void gfx_ctx_destroy(void);
void gfx_ctx_get_video_size(unsigned *width, unsigned *height);
void gfx_ctx_update_window_title(bool reset);
void gfx_ctx_swap_buffers(void);
bool gfx_ctx_key_pressed(int key);
void gfx_ctx_check_window(bool *quit,
bool *resize, unsigned *width, unsigned *height, unsigned frame_count);
void gfx_ctx_set_resize(unsigned width, unsigned height);
#ifdef HAVE_SDL
bool gfx_ctx_get_wm_info(SDL_SysWMinfo *info);
#endif
bool gfx_ctx_window_has_focus(void);
void gfx_ctx_input_driver(const input_driver_t **input, void **input_data);
#ifdef HAVE_CG_MENU
bool gfx_ctx_menu_init(void);
#endif
#ifdef RARCH_CONSOLE
void gfx_ctx_set_filtering(unsigned index, bool set_smooth);
void gfx_ctx_get_available_resolutions(void);
#endif
#if defined(HAVE_OPENGL) || defined(HAVE_D3D9)
void gfx_ctx_set_projection(VID_HANDLE *gl, const struct gl_ortho *ortho, bool allow_rotate);
#endif
#endif

806
gfx/gl.c

File diff suppressed because it is too large Load Diff

View File

@ -17,6 +17,7 @@
#define __GL_COMMON_H
#include "../general.h"
#include "fonts/fonts.h"
#ifdef HAVE_CONFIG_H
#include "../config.h"
@ -67,6 +68,17 @@ static inline bool gl_check_error(void)
return false;
}
static inline unsigned get_alignment(unsigned pitch)
{
if (pitch & 1)
return 1;
if (pitch & 2)
return 2;
if (pitch & 4)
return 4;
return 8;
}
struct gl_fbo_rect
{
unsigned img_width;
@ -95,6 +107,16 @@ struct gl_fbo_scale
bool valid;
};
struct gl_ortho
{
GLfloat left;
GLfloat right;
GLfloat bottom;
GLfloat top;
GLfloat znear;
GLfloat zfar;
};
struct gl_tex_info
{
GLuint tex;
@ -103,6 +125,81 @@ struct gl_tex_info
GLfloat coord[8];
};
#define MAX_SHADERS 16
#if defined(HAVE_XML) || defined(HAVE_CG)
#define TEXTURES 8
#else
#define TEXTURES 1
#endif
#define TEXTURES_MASK (TEXTURES - 1)
typedef struct gl
{
#ifdef RARCH_CONSOLE
bool block_swap;
#endif
#ifdef HAVE_CG_MENU
bool menu_render;
GLuint menu_texture_id;
#endif
bool vsync;
GLuint texture[TEXTURES];
unsigned tex_index; // For use with PREV.
struct gl_tex_info prev_info[TEXTURES];
GLuint tex_filter;
void *empty_buf;
unsigned frame_count;
#ifdef HAVE_FBO
// Render-to-texture, multipass shaders
GLuint fbo[MAX_SHADERS];
GLuint fbo_texture[MAX_SHADERS];
struct gl_fbo_rect fbo_rect[MAX_SHADERS];
struct gl_fbo_scale fbo_scale[MAX_SHADERS];
bool render_to_tex;
int fbo_pass;
bool fbo_inited;
#endif
bool should_resize;
bool quitting;
bool fullscreen;
bool keep_aspect;
unsigned rotation;
unsigned full_x, full_y;
unsigned win_width;
unsigned win_height;
unsigned vp_width, vp_out_width;
unsigned vp_height, vp_out_height;
unsigned last_width[TEXTURES];
unsigned last_height[TEXTURES];
unsigned tex_w, tex_h;
GLfloat tex_coords[8];
#ifdef __CELLOS_LV2__
GLuint pbo;
#endif
GLenum texture_type; // XBGR1555 or ARGB
GLenum texture_fmt;
unsigned base_size; // 2 or 4
#ifdef HAVE_FREETYPE
font_renderer_t *font;
GLuint font_tex;
int font_tex_w, font_tex_h;
void *font_tex_empty_buf;
char font_last_msg[256];
int font_last_width, font_last_height;
GLfloat font_color[16];
GLfloat font_color_dark[16];
#endif
} gl_t;
// Windows ... <_<
#if (defined(HAVE_XML) || defined(HAVE_CG)) && defined(_WIN32)
extern PFNGLCLIENTACTIVETEXTUREPROC pglClientActiveTexture;
@ -112,4 +209,20 @@ extern PFNGLACTIVETEXTUREPROC pglActiveTexture;
#define pglActiveTexture glActiveTexture
#endif
#ifdef __CELLOS_LV2__
#define RARCH_GL_INTERNAL_FORMAT GL_ARGB_SCE
#define RARCH_GL_TEXTURE_TYPE GL_ARGB_SCE
#define RARCH_GL_FORMAT32 GL_UNSIGNED_INT_8_8_8_8
#define RARCH_GL_FORMAT16 GL_RGB5_A1
#else
#define RARCH_GL_INTERNAL_FORMAT GL_RGBA
#define RARCH_GL_TEXTURE_TYPE GL_BGRA
#define RARCH_GL_FORMAT32 GL_UNSIGNED_INT_8_8_8_8_REV
#define RARCH_GL_FORMAT16 GL_UNSIGNED_SHORT_1_5_5_5_REV
#endif
void gl_shader_use(unsigned index);
void gl_set_projection(gl_t *gl, struct gl_ortho *ortho, bool allow_rotate);
void gl_set_viewport(gl_t *gl, unsigned width, unsigned height, bool force_full, bool allow_rotate);
#endif

28
gfx/gl_font.h Normal file
View File

@ -0,0 +1,28 @@
/* RetroArch - A frontend for libretro.
* Copyright (C) 2010-2012 - Hans-Kristian Arntzen
*
* RetroArch is free software: you can redistribute it and/or modify it under the terms
* of the GNU General Public License as published by the Free Software Found-
* ation, either version 3 of the License, or (at your option) any later version.
*
* 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 GL_FONT_H__
#define GL_FONT_H__
#include "gl_common.h"
void gl_init_font(gl_t *gl, const char *font_path, unsigned font_size);
void gl_deinit_font(gl_t *gl);
void gl_render_msg(gl_t *gl, const char *msg);
void gl_render_msg_post(gl_t *gl);
#endif

View File

@ -26,7 +26,7 @@
#endif
#ifdef HAVE_FREETYPE
#include "fonts.h"
#include "fonts/fonts.h"
#endif
static void convert_15bit_15bit_direct(uint16_t *out, unsigned outpitch, const uint16_t *input, unsigned width, unsigned height, unsigned pitch, const SDL_PixelFormat *fmt);

View File

@ -32,7 +32,8 @@
#define NO_SDL_GLEXT
#include "sdlwrap.h"
#include "gfx_context.h"
#include "context/sdl_ctx.h"
#include "SDL_opengl.h"
#include <stdlib.h>

View File

@ -20,7 +20,7 @@
#include <signal.h>
#include <math.h>
#ifdef HAVE_FREETYPE
#include "fonts.h"
#include "fonts/fonts.h"
#endif
#include "gfx_common.h"

View File

@ -20,7 +20,7 @@
#include <stdlib.h>
#include <stddef.h>
#include <string.h>
#include "../gfx/sdlwrap.h"
#include "../gfx/gfx_context.h"
void sdl_dinput_free(sdl_dinput_t *di)
{
@ -108,7 +108,7 @@ sdl_dinput_t* sdl_dinput_init(void)
SDL_SysWMinfo info;
SDL_VERSION(&info.version);
if (!sdlwrap_get_wm_info(&info))
if (!gfx_ctx_get_wm_info(&info))
{
RARCH_ERR("Failed to get SysWM info.\n");
goto error;

View File

@ -15,7 +15,7 @@
#include "../driver.h"
#include "../gfx/sdlwrap.h"
#include "../gfx/gfx_context.h"
#include "../boolean.h"
#include "../general.h"
#include <stdint.h>
@ -183,7 +183,7 @@ static void *sdl_input_init(void)
static bool sdl_key_pressed(int key)
{
return sdlwrap_key_pressed(keysym_lut[key]);
return gfx_ctx_key_pressed(keysym_lut[key]);
}
#ifndef HAVE_DINPUT

View File

@ -113,7 +113,7 @@
<MinimalRebuild>true</MinimalRebuild>
<BufferSecurityCheck>false</BufferSecurityCheck>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
<PreprocessorDefinitions>_DEBUG;_XBOX;PACKAGE_VERSION="0.9.6-rc1";%(PreprocessorDefinitions);_CRT_SECURE_NO_WARNINGS;main=rarch_main;RARCH_CONSOLE;HAVE_CONFIGFILE;HAVE_FILEBROWSER;HAVE_NETPLAY;HAVE_SOCKET_LEGACY;HAVE_ZLIB;HAVE_RARCH_MAIN_WRAP;HAVE_RARCH_EXEC;HAVE_LIBRETRO_MANAGEMENT;D3DCOMPILE_USEVOIDS;HAVE_GRIFFIN</PreprocessorDefinitions>
<PreprocessorDefinitions>_DEBUG;_XBOX;PACKAGE_VERSION="0.9.6-rc1";%(PreprocessorDefinitions);_CRT_SECURE_NO_WARNINGS;main=rarch_main;RARCH_CONSOLE;HAVE_CONFIGFILE;HAVE_FILEBROWSER;HAVE_NETPLAY;HAVE_SOCKET_LEGACY;HAVE_ZLIB;HAVE_RARCH_MAIN_WRAP;HAVE_RARCH_EXEC;HAVE_LIBRETRO_MANAGEMENT;D3DCOMPILE_USEVOIDS;HAVE_GRIFFIN;HAVE_HLSL;HAVE_VID_CONTEXT;HAVE_D3D9</PreprocessorDefinitions>
<CallAttributedProfiling>Callcap</CallAttributedProfiling>
</ClCompile>
<Link>
@ -151,7 +151,7 @@
<PREfast>AnalyzeOnly</PREfast>
<BufferSecurityCheck>false</BufferSecurityCheck>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
<PreprocessorDefinitions>_DEBUG;_XBOX;%(PreprocessorDefinitions);PACKAGE_VERSION="0.9.6-rc1";_CRT_SECURE_NO_WARNINGS;main=rarch_main;HAVE_CONFIGFILE;HAVE_FILEBROWSER;RARCH_CONSOLE;HAVE_ZLIB;HAVE_RARCH_MAIN_WRAP;HAVE_RARCH_EXEC;HAVE_LIBRETRO_MANAGEMENT;D3DCOMPILE_USEVOIDS;HAVE_GRIFFIN</PreprocessorDefinitions>
<PreprocessorDefinitions>_DEBUG;_XBOX;%(PreprocessorDefinitions);PACKAGE_VERSION="0.9.6-rc1";_CRT_SECURE_NO_WARNINGS;main=rarch_main;HAVE_CONFIGFILE;HAVE_FILEBROWSER;RARCH_CONSOLE;HAVE_ZLIB;HAVE_RARCH_MAIN_WRAP;HAVE_RARCH_EXEC;HAVE_LIBRETRO_MANAGEMENT;D3DCOMPILE_USEVOIDS;HAVE_GRIFFIN;HAVE_HLSL;HAVE_VID_CONTEXT;HAVE_D3D9</PreprocessorDefinitions>
<CallAttributedProfiling>Callcap</CallAttributedProfiling>
</ClCompile>
<Link>
@ -190,7 +190,7 @@
<FavorSizeOrSpeed>Size</FavorSizeOrSpeed>
<BufferSecurityCheck>false</BufferSecurityCheck>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<PreprocessorDefinitions>NDEBUG;_XBOX;PROFILE;%(PreprocessorDefinitions);PACKAGE_VERSION="0.9.6-rc1";_CRT_SECURE_NO_WARNINGS;RARCH_CONSOLE;main=rarch_main;HAVE_CONFIGFILE;HAVE_FILEBROWSER;HAVE_ZLIB;HAVE_RARCH_MAIN_WRAP;HAVE_RARCH_EXEC;HAVE_LIBRETRO_MANAGEMENT;D3DCOMPILE_USEVOIDS;HAVE_GRIFFIN</PreprocessorDefinitions>
<PreprocessorDefinitions>NDEBUG;_XBOX;PROFILE;%(PreprocessorDefinitions);PACKAGE_VERSION="0.9.6-rc1";_CRT_SECURE_NO_WARNINGS;RARCH_CONSOLE;main=rarch_main;HAVE_CONFIGFILE;HAVE_FILEBROWSER;HAVE_ZLIB;HAVE_RARCH_MAIN_WRAP;HAVE_RARCH_EXEC;HAVE_LIBRETRO_MANAGEMENT;D3DCOMPILE_USEVOIDS;HAVE_GRIFFIN;HAVE_HLSL;HAVE_VID_CONTEXT;HAVE_D3D9</PreprocessorDefinitions>
<CallAttributedProfiling>Callcap</CallAttributedProfiling>
</ClCompile>
<Link>
@ -234,7 +234,7 @@
<FavorSizeOrSpeed>Size</FavorSizeOrSpeed>
<BufferSecurityCheck>false</BufferSecurityCheck>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<PreprocessorDefinitions>NDEBUG;_XBOX;PROFILE;FASTCAP;%(PreprocessorDefinitions);PACKAGE_VERSION="0.9.6-rc1";_CRT_SECURE_NO_WARNINGS;main=rarch_main;HAVE_CONFIGFILE;HAVE_FILEBROWSER;HAVE_ZLIB;HAVE_RARCH_MAIN_WRAP;HAVE_RARCH_EXEC;HAVE_LIBRETRO_MANAGEMENT;D3DCOMPILE_USEVOIDS;HAVE_GRIFFIN</PreprocessorDefinitions>
<PreprocessorDefinitions>NDEBUG;_XBOX;PROFILE;FASTCAP;%(PreprocessorDefinitions);PACKAGE_VERSION="0.9.6-rc1";_CRT_SECURE_NO_WARNINGS;main=rarch_main;HAVE_CONFIGFILE;HAVE_FILEBROWSER;HAVE_ZLIB;HAVE_RARCH_MAIN_WRAP;HAVE_RARCH_EXEC;HAVE_LIBRETRO_MANAGEMENT;D3DCOMPILE_USEVOIDS;HAVE_GRIFFIN;HAVE_HLSL;HAVE_VID_CONTEXT;HAVE_D3D9</PreprocessorDefinitions>
</ClCompile>
<Link>
<GenerateDebugInformation>true</GenerateDebugInformation>
@ -275,7 +275,7 @@
<ExceptionHandling>false</ExceptionHandling>
<BufferSecurityCheck>false</BufferSecurityCheck>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<PreprocessorDefinitions>NDEBUG;_XBOX;%(PreprocessorDefinitions);PACKAGE_VERSION="0.9.6-rc1";_CRT_SECURE_NO_WARNINGS;main=rarch_main;RARCH_CONSOLE=1;HAVE_CONFIGFILE;HAVE_FILEBROWSER;HAVE_NETPLAY;HAVE_SOCKET_LEGACY;HAVE_ZLIB;HAVE_RARCH_MAIN_WRAP;HAVE_RARCH_EXEC;HAVE_LIBRETRO_MANAGEMENT;D3DCOMPILE_USEVOIDS;HAVE_GRIFFIN</PreprocessorDefinitions>
<PreprocessorDefinitions>NDEBUG;_XBOX;%(PreprocessorDefinitions);PACKAGE_VERSION="0.9.6-rc1";_CRT_SECURE_NO_WARNINGS;main=rarch_main;RARCH_CONSOLE=1;HAVE_CONFIGFILE;HAVE_FILEBROWSER;HAVE_NETPLAY;HAVE_SOCKET_LEGACY;HAVE_ZLIB;HAVE_RARCH_MAIN_WRAP;HAVE_RARCH_EXEC;HAVE_LIBRETRO_MANAGEMENT;D3DCOMPILE_USEVOIDS;HAVE_GRIFFIN;HAVE_HLSL;HAVE_VID_CONTEXT;HAVE_D3D9</PreprocessorDefinitions>
</ClCompile>
<Link>
<GenerateDebugInformation>true</GenerateDebugInformation>
@ -316,7 +316,7 @@
<ExceptionHandling>false</ExceptionHandling>
<BufferSecurityCheck>false</BufferSecurityCheck>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<PreprocessorDefinitions>NDEBUG;_XBOX;LTCG;%(PreprocessorDefinitions);PACKAGE_VERSION="0.9.6-rc1";_CRT_SECURE_NO_WARNINGS;RARCH_CONSOLE;main=rarch_main;HAVE_CONFIGFILE;HAVE_FILEBROWSER;HAVE_NETPLAY;HAVE_SOCKET_LEGACY;HAVE_ZLIB;HAVE_RARCH_MAIN_WRAP;HAVE_RARCH_EXEC;HAVE_LIBRETRO_MANAGEMENT;D3DCOMPILE_USEVOIDS;HAVE_GRIFFIN</PreprocessorDefinitions>
<PreprocessorDefinitions>NDEBUG;_XBOX;LTCG;%(PreprocessorDefinitions);PACKAGE_VERSION="0.9.6-rc1";_CRT_SECURE_NO_WARNINGS;RARCH_CONSOLE;main=rarch_main;HAVE_CONFIGFILE;HAVE_FILEBROWSER;HAVE_NETPLAY;HAVE_SOCKET_LEGACY;HAVE_ZLIB;HAVE_RARCH_MAIN_WRAP;HAVE_RARCH_EXEC;HAVE_LIBRETRO_MANAGEMENT;D3DCOMPILE_USEVOIDS;HAVE_GRIFFIN;HAVE_HLSL;HAVE_VID_CONTEXT;HAVE_D3D9</PreprocessorDefinitions>
</ClCompile>
<Link>
<GenerateDebugInformation>true</GenerateDebugInformation>
@ -714,4 +714,4 @@
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>
</Project>

View File

@ -13,35 +13,7 @@
* If not, see <http://www.gnu.org/licenses/>.
*/
#if defined(_WIN32) && !defined(_XBOX)
#ifndef _WIN32_WINNT
#define _WIN32_WINNT 0x0501
#endif
#define WIN32_LEAN_AND_MEAN
#include <winsock2.h>
#include <windows.h>
#include <ws2tcpip.h>
#elif defined(_XBOX)
#define NOD3D
#include <xtl.h>
#else
#include <sys/select.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <netinet/tcp.h>
#include <arpa/inet.h>
#include <netdb.h>
#ifdef __CELLOS_LV2__
#include <cell/sysmodule.h>
#include <netex/net.h>
#else
#include <signal.h>
#endif
#endif
#include "netplay_compat.h"
#include "netplay.h"
#include "general.h"
#include "autosave.h"
@ -50,8 +22,6 @@
#include <stdlib.h>
#include <string.h>
#include "netplay_compat.h"
// Checks if input port/index is controlled by netplay or not.
static bool netplay_is_alive(netplay_t *handle);

View File

@ -57,3 +57,4 @@ void netplay_pre_frame(netplay_t *handle);
void netplay_post_frame(netplay_t *handle);
#endif

View File

@ -20,6 +20,35 @@
#include "config.h"
#endif
#if defined(_WIN32) && !defined(_XBOX)
#ifndef _WIN32_WINNT
#define _WIN32_WINNT 0x0501
#endif
#define WIN32_LEAN_AND_MEAN
#include <winsock2.h>
#include <windows.h>
#include <ws2tcpip.h>
#elif defined(_XBOX)
#define NOD3D
#include <xtl.h>
#else
#include <sys/select.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <netinet/tcp.h>
#include <arpa/inet.h>
#include <netdb.h>
#include <fcntl.h>
#ifdef __CELLOS_LV2__
#include <cell/sysmodule.h>
#include <netex/net.h>
#else
#include <signal.h>
#endif
#endif
#ifdef _XBOX
#define socklen_t int
#endif
@ -29,9 +58,7 @@
#define close(x) closesocket(x)
#define CONST_CAST (const char*)
#define NONCONST_CAST (char*)
#else
#define CONST_CAST
#define NONCONST_CAST
#include <sys/time.h>
@ -41,7 +68,6 @@
#define close(x) socketclose(x)
#define select(nfds, readfds, writefds, errorfds, timeout) socketselect(nfds, readfds, writefds, errorfds, timeout)
#endif
#endif
// Compatibility layer for legacy or incomplete BSD socket implementations.
@ -80,6 +106,5 @@ void freeaddrinfo(struct addrinfo *res);
// gai_strerror() not used, so we skip that.
#endif
#endif

192
network_cmd.c Normal file
View File

@ -0,0 +1,192 @@
/* RetroArch - A frontend for libretro.
* Copyright (C) 2010-2012 - Hans-Kristian Arntzen
*
* RetroArch is free software: you can redistribute it and/or modify it under the terms
* of the GNU General Public License as published by the Free Software Found-
* ation, either version 3 of the License, or (at your option) any later version.
*
* 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 "netplay_compat.h"
#include "network_cmd.h"
#include "driver.h"
#include "general.h"
#include <stdio.h>
#include <string.h>
struct network_cmd
{
int fd;
bool state[RARCH_BIND_LIST_END];
};
static bool socket_nonblock(int fd)
{
#ifdef _WIN32
u_long mode = 1;
return ioctlsocket(fd, FIONBIO, &mode) == 0;
#else
return fcntl(fd, F_SETFL, fcntl(fd, F_GETFL) | O_NONBLOCK) == 0;
#endif
}
network_cmd_t *network_cmd_new(uint16_t port)
{
network_cmd_t *handle = (network_cmd_t*)calloc(1, sizeof(*handle));
if (!handle)
return NULL;
handle->fd = -1;
struct addrinfo hints, *res = NULL;
memset(&hints, 0, sizeof(hints));
#if defined(_WIN32) || defined(HAVE_SOCKET_LEGACY)
hints.ai_family = AF_INET;
#else
hints.ai_family = AF_UNSPEC;
#endif
hints.ai_socktype = SOCK_DGRAM;
hints.ai_flags = AI_PASSIVE;
char port_buf[16];
int yes = 1;
snprintf(port_buf, sizeof(port_buf), "%hu", (unsigned short)port);
if (getaddrinfo(NULL, port_buf, &hints, &res) < 0)
goto error;
handle->fd = socket(res->ai_family, res->ai_socktype, res->ai_protocol);
if (handle->fd < 0)
goto error;
if (!socket_nonblock(handle->fd))
goto error;
setsockopt(handle->fd, SOL_SOCKET, SO_REUSEADDR, CONST_CAST &yes, sizeof(int));
if (bind(handle->fd, res->ai_addr, res->ai_addrlen) < 0)
{
RARCH_ERR("Failed to bind socket.\n");
goto error;
}
freeaddrinfo(res);
return handle;
error:
if (res)
freeaddrinfo(res);
network_cmd_free(handle);
return NULL;
}
void network_cmd_free(network_cmd_t *handle)
{
if (handle->fd >= 0)
close(handle->fd);
free(handle);
}
struct cmd_map
{
const char *str;
unsigned id;
};
static const struct cmd_map map[] = {
{ "FAST_FORWARD", RARCH_FAST_FORWARD_KEY },
{ "FAST_FORWARD_HOLD", RARCH_FAST_FORWARD_HOLD_KEY },
{ "LOAD_STATE", RARCH_LOAD_STATE_KEY },
{ "SAVE_STATE", RARCH_SAVE_STATE_KEY },
{ "FULLSCREEN_TOGGLE", RARCH_FULLSCREEN_TOGGLE_KEY },
{ "QUIT", RARCH_QUIT_KEY },
{ "STATE_SLOT_PLUS", RARCH_STATE_SLOT_PLUS },
{ "STATE_SLOT_MINUS", RARCH_STATE_SLOT_MINUS },
{ "AUDIO_INPUT_RATE_PLUS", RARCH_AUDIO_INPUT_RATE_PLUS },
{ "AUDIO_INPUT_RATE_MINUS", RARCH_AUDIO_INPUT_RATE_MINUS },
{ "REWIND", RARCH_REWIND },
{ "MOVIE_RECORD_TOGGLE", RARCH_MOVIE_RECORD_TOGGLE },
{ "PAUSE_TOGGLE", RARCH_PAUSE_TOGGLE },
{ "FRAMEADVANCE", RARCH_FRAMEADVANCE },
{ "RESET", RARCH_RESET },
{ "SHADER_NEXT", RARCH_SHADER_NEXT },
{ "SHADER_PREV", RARCH_SHADER_PREV },
{ "CHEAT_INDEX_PLUS", RARCH_CHEAT_INDEX_PLUS },
{ "CHEAT_INDEX_MINUS", RARCH_CHEAT_INDEX_MINUS },
{ "CHEAT_TOGGLE", RARCH_CHEAT_TOGGLE },
{ "SCREENSHOT", RARCH_SCREENSHOT },
{ "DSP_CONFIG", RARCH_DSP_CONFIG },
{ "MUTE", RARCH_MUTE },
{ "NETPLAY_FLIP", RARCH_NETPLAY_FLIP },
{ "SLOWMOTION", RARCH_SLOWMOTION },
};
static void parse_sub_msg(network_cmd_t *handle, const char *tok)
{
for (unsigned i = 0; i < sizeof(map) / sizeof(map[0]); i++)
{
if (strcmp(tok, map[i].str) == 0)
{
handle->state[map[i].id] = true;
return;
}
}
RARCH_WARN("Unrecognized command \"%s\" received.\n", tok);
}
static void parse_msg(network_cmd_t *handle, char *buf)
{
const char *tok = strtok(buf, "\n");
while (tok)
{
parse_sub_msg(handle, tok);
tok = strtok(NULL, "\n");
}
}
void network_cmd_set(network_cmd_t *handle, unsigned id)
{
if (id < RARCH_BIND_LIST_END)
handle->state[id] = true;
}
bool network_cmd_get(network_cmd_t *handle, unsigned id)
{
return id < RARCH_BIND_LIST_END && handle->state[id];
}
void network_cmd_pre_frame(network_cmd_t *handle)
{
memset(handle->state, 0, sizeof(handle->state));
fd_set fds;
FD_ZERO(&fds);
FD_SET(handle->fd, &fds);
struct timeval tmp_tv = {0};
if (select(handle->fd + 1, &fds, NULL, NULL, &tmp_tv) <= 0)
return;
if (!FD_ISSET(handle->fd, &fds))
return;
for (;;)
{
char buf[1024];
ssize_t ret = recvfrom(handle->fd, buf, sizeof(buf) - 1, 0, NULL, NULL);
if (ret <= 0)
break;
buf[ret] = '\0';
parse_msg(handle, buf);
}
}

32
network_cmd.h Normal file
View File

@ -0,0 +1,32 @@
/* RetroArch - A frontend for libretro.
* Copyright (C) 2010-2012 - Hans-Kristian Arntzen
*
* RetroArch is free software: you can redistribute it and/or modify it under the terms
* of the GNU General Public License as published by the Free Software Found-
* ation, either version 3 of the License, or (at your option) any later version.
*
* 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 NETWORK_CMD_H__
#define NETWORK_CMD_H__
#include <stdint.h>
#include "boolean.h"
typedef struct network_cmd network_cmd_t;
network_cmd_t *network_cmd_new(uint16_t port);
void network_cmd_free(network_cmd_t *handle);
void network_cmd_pre_frame(network_cmd_t *handle);
void network_cmd_set(network_cmd_t *handle, unsigned id);
bool network_cmd_get(network_cmd_t *handle, unsigned id);
#endif

View File

@ -320,12 +320,13 @@ static void callback_sysutil_exit(uint64_t status, uint64_t param, void *userdat
{
(void) param;
(void) userdata;
gl_t *gl = driver.video_data;
switch (status)
{
case CELL_SYSUTIL_REQUEST_EXITGAME:
g_console.menu_enable = false;
g_quitting = true;
gl->quitting = true;
g_console.ingame_menu_enable = false;
g_console.mode_switch = MODE_EXIT;
break;
@ -507,8 +508,10 @@ int main(int argc, char *argv[])
#endif
#endif
ps3graphics_video_init(true);
ps3_input_init();
video_gl.start();
input_ps3.init();
oskutil_init(&g_console.oskutil_handle, 0);
rarch_input_set_default_keybind_names_for_emulator();
@ -557,8 +560,10 @@ begin_shutdown:
save_settings();
if(g_console.emulator_initialized)
rarch_main_deinit();
cell_pad_input_deinit();
ps3_video_deinit();
input_ps3.free(NULL);
video_gl.stop();
if(g_console.oskutil_handle.is_running)
oskutil_unload(&g_console.oskutil_handle);
#ifdef HAVE_LOGGER

View File

@ -29,6 +29,7 @@
#include "../console/console_ext.h"
#include "ps3_video_psgl.h"
#include "../gfx/gl_common.h"
#include "shared.h"
#include "../file.h"
@ -174,6 +175,7 @@ static uint64_t old_state = 0;
static void set_delay_speed(unsigned delaymode)
{
unsigned speed;
gl_t * gl = driver.video_data;
speed = 0;
@ -196,18 +198,19 @@ static void set_delay_speed(unsigned delaymode)
}
strlcpy(special_action_msg, "", sizeof(special_action_msg));
SET_TIMER_EXPIRATION(g_console.control_timer_expiration_frame_count, speed);
SET_TIMER_EXPIRATION(gl, speed);
}
static void browser_update(filebrowser_t * b)
{
uint64_t state, diff_state, button_was_pressed;
gl_t * gl = driver.video_data;
state = cell_pad_input_poll_device(0);
diff_state = old_state ^ state;
button_was_pressed = old_state & diff_state;
if(IS_TIMER_EXPIRED(g_console.control_timer_expiration_frame_count))
if(IS_TIMER_EXPIRED(gl))
{
set_delay = DELAY_NONE;
@ -216,11 +219,7 @@ static void browser_update(filebrowser_t * b)
if(b->currently_selected < b->file_count-1)
{
FILEBROWSER_INCREMENT_ENTRY_POINTER(b);
if(g_console.emulator_initialized)
set_delay = DELAY_SMALL;
else
set_delay = DELAY_SMALLEST;
set_delay = DELAY_SMALLEST;
}
}
@ -229,10 +228,7 @@ static void browser_update(filebrowser_t * b)
if(b->currently_selected < b->file_count-1)
{
FILEBROWSER_INCREMENT_ENTRY_POINTER(b);
if(g_console.emulator_initialized)
set_delay = DELAY_SMALL;
else
set_delay = DELAY_SMALLEST;
set_delay = DELAY_SMALLEST;
}
}
@ -241,10 +237,7 @@ static void browser_update(filebrowser_t * b)
if(b->currently_selected > 0)
{
FILEBROWSER_DECREMENT_ENTRY_POINTER(b);
if(g_console.emulator_initialized)
set_delay = DELAY_SMALL;
else
set_delay = DELAY_SMALLEST;
set_delay = DELAY_SMALLEST;
}
}
@ -253,30 +246,20 @@ static void browser_update(filebrowser_t * b)
if(b->currently_selected > 0)
{
FILEBROWSER_DECREMENT_ENTRY_POINTER(b);
if(g_console.emulator_initialized)
set_delay = DELAY_SMALL;
else
set_delay = DELAY_SMALLEST;
set_delay = DELAY_SMALLEST;
}
}
if (CTRL_RIGHT(state))
{
b->currently_selected = (MIN(b->currently_selected + 5, b->file_count-1));
if(g_console.emulator_initialized)
set_delay = DELAY_MEDIUM;
else
set_delay = DELAY_SMALL;
set_delay = DELAY_SMALL;
}
if (CTRL_LSTICK_RIGHT(state))
{
b->currently_selected = (MIN(b->currently_selected + 5, b->file_count-1));
if(g_console.emulator_initialized)
set_delay = DELAY_SMALL;
else
set_delay = DELAY_SMALLEST;
set_delay = DELAY_SMALLEST;
}
if (CTRL_LEFT(state))
@ -286,10 +269,7 @@ static void browser_update(filebrowser_t * b)
else
b->currently_selected -= 5;
if(g_console.emulator_initialized)
set_delay = DELAY_MEDIUM;
else
set_delay = DELAY_SMALL;
set_delay = DELAY_SMALL;
}
if (CTRL_LSTICK_LEFT(state))
@ -299,10 +279,7 @@ static void browser_update(filebrowser_t * b)
else
b->currently_selected -= 5;
if(g_console.emulator_initialized)
set_delay = DELAY_SMALL;
else
set_delay = DELAY_SMALLEST;
set_delay = DELAY_SMALLEST;
}
if (CTRL_R1(state))
@ -805,18 +782,20 @@ static void menu_reinit_settings (void)
static void apply_scaling (unsigned init_mode)
{
gl_t *gl = driver.video_data;
switch(init_mode)
{
case FBO_DEINIT:
gl_deinit_fbo(g_gl);
gl_deinit_fbo(gl);
break;
case FBO_INIT:
gl_init_fbo(g_gl, RARCH_SCALE_BASE * INPUT_SCALE,
gl_init_fbo(gl, RARCH_SCALE_BASE * INPUT_SCALE,
RARCH_SCALE_BASE * INPUT_SCALE);
break;
case FBO_REINIT:
gl_deinit_fbo(g_gl);
gl_init_fbo(g_gl, RARCH_SCALE_BASE * INPUT_SCALE,
gl_deinit_fbo(gl);
gl_init_fbo(gl, RARCH_SCALE_BASE * INPUT_SCALE,
RARCH_SCALE_BASE * INPUT_SCALE);
break;
}
@ -827,6 +806,7 @@ static void select_file(uint32_t menu_id)
char extensions[256], title[256], object[256], comment[256], dir_path[MAX_PATH_LENGTH],
path[MAX_PATH_LENGTH], *separatorslash;
uint64_t state, diff_state, button_was_pressed;
gl_t * gl = driver.video_data;
state = cell_pad_input_poll_device(0);
diff_state = old_state ^ state;
@ -883,7 +863,7 @@ static void select_file(uint32_t menu_id)
browser_update(&tmpBrowser);
if(IS_TIMER_EXPIRED(g_console.control_timer_expiration_frame_count))
if(IS_TIMER_EXPIRED(gl))
{
if (CTRL_START(button_was_pressed))
filebrowser_reset_start_directory(&tmpBrowser, "/", extensions);
@ -969,6 +949,7 @@ static void select_directory(uint32_t menu_id)
{
char path[1024], newpath[1024], *separatorslash;
uint64_t state, diff_state, button_was_pressed;
gl_t * gl = driver.video_data;
state = cell_pad_input_poll_device(0);
diff_state = old_state ^ state;
@ -982,7 +963,7 @@ static void select_directory(uint32_t menu_id)
browser_update(&tmpBrowser);
if(IS_TIMER_EXPIRED(g_console.control_timer_expiration_frame_count))
if(IS_TIMER_EXPIRED(gl))
{
if (CTRL_START(button_was_pressed))
filebrowser_reset_start_directory(&tmpBrowser, "/","empty");
@ -1097,9 +1078,10 @@ static void rarch_filename_input_and_save (unsigned filename_type)
while(OSK_IS_RUNNING(g_console.oskutil_handle))
{
glClear(GL_COLOR_BUFFER_BIT);
gl_frame_menu();
video_gl.swap(NULL);
gfx_ctx_swap_buffers();
#ifdef HAVE_SYSUTILS
cellSysutilCheckCallback();
#endif
}
if(g_console.oskutil_handle.text_can_be_fetched)
@ -1131,8 +1113,10 @@ static void rarch_filename_input_and_save (unsigned filename_type)
{
/* OSK Util gets updated */
glClear(GL_COLOR_BUFFER_BIT);
video_gl.swap(NULL);
cellSysutilCheckCallback();
gfx_ctx_swap_buffers();
#ifdef HAVE_SYSUTILS
cellSysutilCheckCallback();
#endif
}
if(g_console.oskutil_handle.text_can_be_fetched)
@ -1189,13 +1173,13 @@ static void producesettingentry(menu * menu_obj, uint64_t switchvalue)
if(ps3_check_resolution(CELL_VIDEO_OUT_RESOLUTION_576))
{
//ps3graphics_set_pal60hz(Settings.PS3PALTemporalMode60Hz);
ps3graphics_video_reinit();
video_gl.restart();
}
}
else
{
//ps3graphics_set_pal60hz(0);
ps3graphics_video_reinit();
video_gl.restart();
}
}
break;
@ -1293,7 +1277,7 @@ static void producesettingentry(menu * menu_obj, uint64_t switchvalue)
if(g_console.aspect_ratio_index > 0)
{
g_console.aspect_ratio_index--;
video_gl.set_aspect_ratio(NULL, g_console.aspect_ratio_index);
gfx_ctx_set_aspect_ratio(NULL, g_console.aspect_ratio_index);
set_delay = DELAY_SMALL;
}
}
@ -1302,7 +1286,7 @@ static void producesettingentry(menu * menu_obj, uint64_t switchvalue)
g_console.aspect_ratio_index++;
if(g_console.aspect_ratio_index < ASPECT_RATIO_END)
{
video_gl.set_aspect_ratio(NULL, g_console.aspect_ratio_index);
gfx_ctx_set_aspect_ratio(NULL, g_console.aspect_ratio_index);
set_delay = DELAY_SMALL;
}
else
@ -1311,40 +1295,40 @@ static void producesettingentry(menu * menu_obj, uint64_t switchvalue)
if(CTRL_START(state))
{
g_console.aspect_ratio_index = ASPECT_RATIO_4_3;
video_gl.set_aspect_ratio(NULL, g_console.aspect_ratio_index);
gfx_ctx_set_aspect_ratio(NULL, g_console.aspect_ratio_index);
}
break;
case SETTING_HW_TEXTURE_FILTER:
if(CTRL_LEFT(state) || CTRL_LSTICK_LEFT(state) || CTRL_RIGHT(state) || CTRL_LSTICK_RIGHT(state) || CTRL_CROSS(state))
{
g_settings.video.smooth = !g_settings.video.smooth;
ps3_set_filtering(1, g_settings.video.smooth);
gfx_ctx_set_filtering(1, g_settings.video.smooth);
set_delay = DELAY_LONG;
}
if(CTRL_START(state))
{
g_settings.video.smooth = 1;
ps3_set_filtering(1, g_settings.video.smooth);
gfx_ctx_set_filtering(1, g_settings.video.smooth);
}
break;
case SETTING_HW_TEXTURE_FILTER_2:
if(CTRL_LEFT(state) || CTRL_LSTICK_LEFT(state) || CTRL_RIGHT(state) || CTRL_LSTICK_RIGHT(state) || CTRL_CROSS(state))
{
g_settings.video.second_pass_smooth = !g_settings.video.second_pass_smooth;
ps3_set_filtering(2, g_settings.video.second_pass_smooth);
gfx_ctx_set_filtering(2, g_settings.video.second_pass_smooth);
set_delay = DELAY_LONG;
}
if(CTRL_START(state))
{
g_settings.video.second_pass_smooth = 1;
ps3_set_filtering(2, g_settings.video.second_pass_smooth);
gfx_ctx_set_filtering(2, g_settings.video.second_pass_smooth);
}
break;
case SETTING_SCALE_ENABLED:
if(CTRL_LEFT(state) || CTRL_LSTICK_LEFT(state) || CTRL_RIGHT(state) || CTRL_LSTICK_RIGHT(state) || CTRL_CROSS(state))
{
g_console.fbo_enabled = !g_console.fbo_enabled;
gl_set_fbo_enable(g_console.fbo_enabled);
gfx_ctx_set_fbo(g_console.fbo_enabled);
set_delay = DELAY_MEDIUM;
@ -1402,7 +1386,7 @@ static void producesettingentry(menu * menu_obj, uint64_t switchvalue)
if(g_console.overscan_amount == 0.0f)
g_console.overscan_enable = false;
ps3graphics_set_overscan(g_console.overscan_enable, g_console.overscan_amount, 1);
gfx_ctx_set_overscan();
set_delay = DELAY_SMALLEST;
}
if(CTRL_RIGHT(state) || CTRL_LSTICK_RIGHT(state) || CTRL_CROSS(state))
@ -1413,27 +1397,27 @@ static void producesettingentry(menu * menu_obj, uint64_t switchvalue)
if(g_console.overscan_amount == 0.0f)
g_console.overscan_enable = 0;
ps3graphics_set_overscan(g_console.overscan_enable, g_console.overscan_amount, 1);
gfx_ctx_set_overscan();
set_delay = DELAY_SMALLEST;
}
if(CTRL_START(state))
{
g_console.overscan_amount = 0.0f;
g_console.overscan_enable = false;
ps3graphics_set_overscan(g_console.overscan_enable, g_console.overscan_amount, 1);
gfx_ctx_set_overscan();
}
break;
case SETTING_THROTTLE_MODE:
if(CTRL_LEFT(state) || CTRL_LSTICK_LEFT(state) || CTRL_RIGHT(state) || CTRL_LSTICK_RIGHT(state))
{
g_console.throttle_enable = !g_console.throttle_enable;
ps3graphics_set_vsync(g_console.throttle_enable);
gfx_ctx_set_swap_interval(g_console.throttle_enable, true);
set_delay = DELAY_MEDIUM;
}
if(CTRL_START(state))
{
g_console.throttle_enable = true;
ps3graphics_set_vsync(g_console.throttle_enable);
gfx_ctx_set_swap_interval(g_console.throttle_enable, true);
set_delay = DELAY_MEDIUM;
}
break;
@ -1441,7 +1425,7 @@ static void producesettingentry(menu * menu_obj, uint64_t switchvalue)
if(CTRL_LEFT(state) || CTRL_LSTICK_LEFT(state) || CTRL_RIGHT(state) || CTRL_LSTICK_RIGHT(state))
{
g_console.triple_buffering_enable = !g_console.triple_buffering_enable;
ps3graphics_video_reinit();
video_gl.restart();
set_delay = DELAY_MEDIUM;
}
if(CTRL_START(state))
@ -1449,7 +1433,7 @@ static void producesettingentry(menu * menu_obj, uint64_t switchvalue)
if(!g_console.triple_buffering_enable)
{
g_console.triple_buffering_enable = true;
ps3graphics_video_reinit();
video_gl.restart();
}
}
break;
@ -1538,8 +1522,10 @@ static void producesettingentry(menu * menu_obj, uint64_t switchvalue)
while(OSK_IS_RUNNING(g_console.oskutil_handle))
{
glClear(GL_COLOR_BUFFER_BIT);
video_gl.swap(NULL);
cellSysutilCheckCallback();
gfx_ctx_swap_buffers();
#ifdef HAVE_SYSUTILS
cellSysutilCheckCallback();
#endif
}
if(g_console.oskutil_handle.text_can_be_fetched)
@ -1818,12 +1804,13 @@ static void producesettingentry(menu * menu_obj, uint64_t switchvalue)
static void select_setting(menu * menu_obj)
{
uint64_t state, diff_state, button_was_pressed, i;
gl_t * gl = driver.video_data;
state = cell_pad_input_poll_device(0);
diff_state = old_state ^ state;
button_was_pressed = old_state & diff_state;
if(IS_TIMER_EXPIRED(g_console.control_timer_expiration_frame_count))
if(IS_TIMER_EXPIRED(gl))
{
set_delay = DELAY_NONE;
/* back to ROM menu if CIRCLE is pressed */
@ -1921,6 +1908,7 @@ static void select_rom(void)
{
char newpath[1024], *separatorslash;
uint64_t state, diff_state, button_was_pressed;
gl_t * gl = driver.video_data;
state = cell_pad_input_poll_device(0);
diff_state = old_state ^ state;
@ -1928,7 +1916,7 @@ static void select_rom(void)
browser_update(&browser);
if(IS_TIMER_EXPIRED(g_console.control_timer_expiration_frame_count))
if(IS_TIMER_EXPIRED(gl))
{
if (CTRL_SELECT(button_was_pressed))
{
@ -2023,6 +2011,7 @@ static void ingame_menu(uint32_t menu_id)
static uint32_t menuitem_colors[MENU_ITEM_LAST];
uint64_t state, stuck_in_loop;
static uint64_t blocking;
gl_t * gl = driver.video_data;
float x_position = 0.3f;
float font_size = 1.1f;
@ -2034,13 +2023,12 @@ static void ingame_menu(uint32_t menu_id)
menuitem_colors[g_console.ingame_menu_item] = RED;
gl_t * gl = g_gl;
state = cell_pad_input_poll_device(0);
stuck_in_loop = 1;
blocking = 0;
if(IS_TIMER_EXPIRED(g_console.control_timer_expiration_frame_count) && blocking == false)
if(IS_TIMER_EXPIRED(gl) && blocking == false)
{
set_delay = DELAY_NONE;
@ -2097,7 +2085,7 @@ static void ingame_menu(uint32_t menu_id)
if(g_console.aspect_ratio_index > 0)
{
g_console.aspect_ratio_index--;
video_gl.set_aspect_ratio(NULL, g_console.aspect_ratio_index);
gfx_ctx_set_aspect_ratio(NULL, g_console.aspect_ratio_index);
set_delay = DELAY_LONG;
}
}
@ -2106,7 +2094,7 @@ static void ingame_menu(uint32_t menu_id)
g_console.aspect_ratio_index++;
if(g_console.aspect_ratio_index < ASPECT_RATIO_END)
{
video_gl.set_aspect_ratio(NULL, g_console.aspect_ratio_index);
gfx_ctx_set_aspect_ratio(NULL, g_console.aspect_ratio_index);
set_delay = DELAY_LONG;
}
else
@ -2115,7 +2103,7 @@ static void ingame_menu(uint32_t menu_id)
if(CTRL_START(state))
{
g_console.aspect_ratio_index = ASPECT_RATIO_4_3;
video_gl.set_aspect_ratio(NULL, g_console.aspect_ratio_index);
gfx_ctx_set_aspect_ratio(NULL, g_console.aspect_ratio_index);
}
strlcpy(comment, "Press LEFT or RIGHT to change the [Aspect Ratio].\nPress START to reset back to default values.", sizeof(comment));
break;
@ -2128,7 +2116,7 @@ static void ingame_menu(uint32_t menu_id)
if(g_console.overscan_amount == 0.00f)
g_console.overscan_enable = false;
ps3graphics_set_overscan(g_console.overscan_enable, g_console.overscan_amount, 1);
gfx_ctx_set_overscan();
set_delay = DELAY_SMALLEST;
}
if(CTRL_RIGHT(state) || CTRL_LSTICK_RIGHT(state) || CTRL_CROSS(state) || CTRL_LSTICK_RIGHT(state))
@ -2138,14 +2126,14 @@ static void ingame_menu(uint32_t menu_id)
if(g_console.overscan_amount == 0.0f)
g_console.overscan_amount = false;
ps3graphics_set_overscan(g_console.overscan_enable, g_console.overscan_amount, 1);
gfx_ctx_set_overscan();
set_delay = DELAY_SMALLEST;
}
if(CTRL_START(state))
{
g_console.overscan_amount = 0.0f;
g_console.overscan_enable = false;
ps3graphics_set_overscan(g_console.overscan_enable, g_console.overscan_amount, 1);
gfx_ctx_set_overscan();
}
strlcpy(comment, "Press LEFT or RIGHT to change the [Overscan] settings.\nPress START to reset back to default values.", sizeof(comment));
break;
@ -2226,7 +2214,7 @@ static void ingame_menu(uint32_t menu_id)
if(CTRL_CROSS(state))
{
g_console.aspect_ratio_index = ASPECT_RATIO_CUSTOM;
video_gl.set_aspect_ratio(NULL, g_console.aspect_ratio_index);
gfx_ctx_set_aspect_ratio(NULL, g_console.aspect_ratio_index);
while(stuck_in_loop && g_console.ingame_menu_enable)
{
state = cell_pad_input_poll_device(0);
@ -2240,10 +2228,14 @@ static void ingame_menu(uint32_t menu_id)
rarch_render_cached_frame();
if(CTRL_SQUARE(~state))
{
gl_frame_menu();
}
if(CTRL_SQUARE(state))
{
gl->menu_render = false;
}
else
{
gl->menu_render = true;
}
if(CTRL_LSTICK_LEFT(state) || CTRL_LEFT(state))
g_console.viewports.custom_vp.x -= 1;
@ -2344,7 +2336,10 @@ static void ingame_menu(uint32_t menu_id)
cellDbgFontPrintf (0.09f, 0.83f, 0.91f, LIGHTBLUE, "Allows you to resize the screen by moving around the two analog sticks.\nPress TRIANGLE to reset to default values, and CIRCLE to go back to the menu.");
cellDbgFontDraw();
}
video_gl.swap(NULL);
gfx_ctx_swap_buffers();
#ifdef HAVE_SYSUTILS
cellSysutilCheckCallback();
#endif
if(CTRL_SQUARE(~state))
{
glDisable(GL_BLEND);
@ -2367,7 +2362,10 @@ static void ingame_menu(uint32_t menu_id)
rarch_render_cached_frame();
video_gl.swap(NULL);
gfx_ctx_swap_buffers();
#ifdef HAVE_SYSUTILS
cellSysutilCheckCallback();
#endif
}
}
@ -2536,6 +2534,8 @@ void menu_init (void)
void menu_loop(void)
{
gl_t * gl = driver.video_data;
menuStack[0] = menu_filebrowser;
menuStack[0].enum_id = FILE_BROWSER_MENU;
@ -2543,8 +2543,7 @@ void menu_loop(void)
menu_reinit_settings();
if(g_console.emulator_initialized)
video_gl.set_swap_block_state(NULL, true);
gl->block_swap = true;
if(g_console.ingame_menu_enable)
{
@ -2553,17 +2552,14 @@ void menu_loop(void)
menuStack[menuStackindex].enum_id = INGAME_MENU;
}
gl->menu_render = true;
do
{
glClear(GL_COLOR_BUFFER_BIT);
glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
glEnable(GL_BLEND);
if(g_console.emulator_initialized)
{
rarch_render_cached_frame();
}
gl_frame_menu();
rarch_render_cached_frame();
switch(menuStack[menuStackindex].enum_id)
{
@ -2599,7 +2595,7 @@ void menu_loop(void)
}
if(IS_TIMER_EXPIRED(g_console.control_timer_expiration_frame_count))
if(IS_TIMER_EXPIRED(gl))
{
// if we want to force goto the emulation loop, skip this
if(g_console.mode_switch != MODE_EMULATION)
@ -2628,18 +2624,22 @@ void menu_loop(void)
// press and holding L3 + R3 in the emulation loop (lasts for 30 frame ticks)
if(g_console.mode_switch == MODE_EMULATION && !g_console.frame_advance_enable)
{
SET_TIMER_EXPIRATION(g_console.timer_expiration_frame_count, 30);
SET_TIMER_EXPIRATION(gl, 30);
}
video_gl.swap(NULL);
gfx_ctx_swap_buffers();
#ifdef HAVE_SYSUTILS
cellSysutilCheckCallback();
#endif
glDisable(GL_BLEND);
}while (g_console.menu_enable);
gl->menu_render = false;
if(g_console.ingame_menu_enable)
menuStackindex--; // pop ingame menu from stack
if(g_console.emulator_initialized)
video_gl.set_swap_block_state(NULL, false);
gl->block_swap = false;
g_console.ingame_menu_enable = false;
}

View File

@ -40,11 +40,6 @@
static uint64_t state[MAX_PADS];
static unsigned pads_connected;
void cell_pad_input_deinit(void)
{
cellPadEnd();
}
uint32_t cell_pad_input_pads_connected(void)
{
#if(CELL_SDK_VERSION > 0x340000)
@ -249,18 +244,15 @@ void oskutil_unload(oskutil_params *params)
static void ps3_free_input(void *data)
{
(void)data;
cellPadEnd();
}
static void* ps3_input_initialize(void)
{
return (void*)-1;
}
void ps3_input_init(void)
{
cellPadInit(MAX_PADS);
for(unsigned i = 0; i < MAX_PADS; i++)
ps3_input_map_dpad_to_stick(g_settings.input.dpad_emulation[i], i);
return (void*)-1;
}
void ps3_input_map_dpad_to_stick(uint32_t map_dpad_enum, uint32_t controller_id)
@ -291,6 +283,8 @@ void ps3_input_map_dpad_to_stick(uint32_t map_dpad_enum, uint32_t controller_id)
static bool ps3_key_pressed(void *data, int key)
{
(void)data;
gl_t *gl = driver.video_data;
switch (key)
{
case RARCH_FAST_FORWARD_HOLD_KEY:
@ -314,18 +308,18 @@ static bool ps3_key_pressed(void *data, int key)
case RARCH_REWIND:
return CTRL_RSTICK_UP(state[0]) && CTRL_R2(~state[0]);
case RARCH_QUIT_KEY:
if(IS_TIMER_EXPIRED(g_console.timer_expiration_frame_count))
if(IS_TIMER_EXPIRED(gl))
{
uint32_t r3_pressed = CTRL_R3(state[0]);
uint32_t l3_pressed = CTRL_L3(state[0]);
bool retval = false;
g_console.menu_enable = (r3_pressed && l3_pressed && IS_TIMER_EXPIRED(g_console.timer_expiration_frame_count));
g_console.menu_enable = (r3_pressed && l3_pressed && IS_TIMER_EXPIRED(gl));
g_console.ingame_menu_enable = r3_pressed && !l3_pressed;
if(g_console.menu_enable || (g_console.ingame_menu_enable && !g_console.menu_enable))
{
g_console.mode_switch = MODE_MENU;
SET_TIMER_EXPIRATION(g_console.control_timer_expiration_frame_count, 30);
SET_TIMER_EXPIRATION(gl, 30);
retval = g_console.menu_enable;
}

View File

@ -121,14 +121,10 @@
typedef uint64_t cell_input_state_t;
int cell_pad_input_init(void);
void cell_pad_input_deinit(void);
uint32_t cell_pad_input_pads_connected(void);
cell_input_state_t cell_pad_input_poll_device(uint32_t id);
void ps3_input_init(void);
void ps3_input_map_dpad_to_stick(uint32_t map_dpad_enum, uint32_t controller_id);
typedef struct

File diff suppressed because it is too large Load Diff

View File

@ -21,94 +21,29 @@
#include "../gfx/gfx_common.h"
#include "../gfx/image.h"
#include "../console/console_ext.h"
#include <cell/dbgfont.h>
#define FBO_DEINIT 0
#define FBO_INIT 1
#define FBO_REINIT 2
enum
{
FBO_DEINIT = 0,
FBO_INIT,
FBO_REINIT
};
#define MIN_SCALING_FACTOR (1.0f)
#define MAX_SCALING_FACTOR (4.0f)
#define IS_TIMER_NOT_EXPIRED(getter) (g_frame_count < getter)
#define IS_TIMER_EXPIRED(getter) (!(IS_TIMER_NOT_EXPIRED(getter)))
#define SET_TIMER_EXPIRATION(setter, value) setter = g_frame_count + value;
#define RARCH_CG_MAX_SHADERS 16
#define RARCH_CG_MENU_SHADER_INDEX (RARCH_CG_MAX_SHADERS - 1)
typedef struct gl
{
bool vsync;
GLuint texture[TEXTURES];
unsigned tex_index; /* For use with PREV. */
struct gl_tex_info prev_info[TEXTURES];
GLuint tex_filter;
void *empty_buf;
bool block_swap;
bool fbo_enabled;
bool keep_aspect;
bool overscan_enable;
unsigned last_width[TEXTURES];
unsigned last_height[TEXTURES];
unsigned tex_w, tex_h;
unsigned vp_width, vp_out_width;
unsigned vp_height, vp_out_height;
unsigned win_width;
unsigned win_height;
GLfloat overscan_amount;
GLfloat tex_coords[8];
GLenum texture_type; /* XBGR1555 or ARGB*/
GLenum texture_fmt;
unsigned base_size; /* 2 or 4*/
#ifdef HAVE_FBO
/* Render-to-texture, multipass shaders */
GLuint fbo[MAX_SHADERS];
GLuint fbo_texture[MAX_SHADERS];
struct gl_fbo_rect fbo_rect[MAX_SHADERS];
struct gl_fbo_scale fbo_scale[MAX_SHADERS];
bool render_to_tex;
int fbo_pass;
bool fbo_inited;
#endif
GLuint menu_texture_id;
GLuint pbo;
CellVideoOutState g_video_state;
PSGLdevice* gl_device;
PSGLcontext* gl_context;
struct texture_image menu_texture;
} gl_t;
bool ps3_setup_texture(void);
const char * ps3_get_resolution_label(uint32_t resolution);
int ps3_check_resolution(uint32_t resolution_id);
void gl_frame_menu(void);
void gl_deinit_fbo(gl_t * gl);
void gl_init_fbo(gl_t * gl, unsigned width, unsigned height);
void gl_set_fbo_enable(bool enable);
void ps3_previous_resolution (void);
void ps3_next_resolution (void);
void ps3_set_filtering(unsigned index, bool set_smooth);
void ps3_video_deinit(void);
void ps3graphics_reinit_fbos (void);
void ps3graphics_set_overscan(bool overscan_enable, float amount, bool recalculate_viewport);
void ps3graphics_set_vsync(uint32_t vsync);
void ps3graphics_video_init(bool get_all_resolutions);
void ps3graphics_video_reinit(void);
void gl_deinit_fbo(gl_t * gl);
void gl_init_fbo(gl_t * gl, unsigned width, unsigned height);
bool gl_cg_reinit(const char *path);
bool gl_cg_save_cgp(const char *path, const struct gl_cg_cgp_info *info);
bool gl_cg_load_shader(unsigned index, const char *path);
unsigned gl_cg_get_lut_info(struct gl_cg_lut_info *info, unsigned elems);
extern void *g_gl;
extern unsigned g_frame_count;
#endif

View File

@ -73,9 +73,6 @@ enum {
#define MENU_ITEM_LAST MENU_ITEM_RETURN_TO_XMB+1
extern unsigned g_frame_count;
extern bool g_quitting;
extern char contentInfoPath[MAX_PATH_LENGTH];
extern char usrDirPath[MAX_PATH_LENGTH];
extern char DEFAULT_PRESET_FILE[MAX_PATH_LENGTH];

View File

@ -56,8 +56,12 @@ if [ $HAVE_NETPLAY = yes ]; then
else
HAVE_SOCKET_LEGACY=yes
fi
HAVE_NETWORK_CMD=yes
else
HAVE_NETWORK_CMD=no
fi
check_lib GETOPT_LONG -lc getopt_long
if [ $HAVE_DYLIB = no ] && [ $HAVE_DYNAMIC = yes ]; then
@ -150,7 +154,7 @@ check_pkgconf PYTHON python3
add_define_make OS $OS
# Creates config.mk and config.h.
VARS="ALSA OSS OSS_BSD OSS_LIB AL RSOUND ROAR JACK COREAUDIO PULSE SDL OPENGL DYLIB GETOPT_LONG THREADS CG XML SDL_IMAGE DYNAMIC FFMPEG AVCODEC AVFORMAT AVUTIL SWSCALE CONFIGFILE FREETYPE XVIDEO X11 XEXT NETPLAY SOCKET_LEGACY FBO STRL PYTHON FFMPEG_ALLOC_CONTEXT3 FFMPEG_AVCODEC_OPEN2 FFMPEG_AVIO_OPEN FFMPEG_AVFORMAT_WRITE_HEADER FFMPEG_AVFORMAT_NEW_STREAM FFMPEG_AVCODEC_ENCODE_AUDIO2 FFMPEG_AVCODEC_ENCODE_VIDEO2 X264RGB SINC BSV_MOVIE RPI"
VARS="ALSA OSS OSS_BSD OSS_LIB AL RSOUND ROAR JACK COREAUDIO PULSE SDL OPENGL DYLIB GETOPT_LONG THREADS CG XML SDL_IMAGE DYNAMIC FFMPEG AVCODEC AVFORMAT AVUTIL SWSCALE CONFIGFILE FREETYPE XVIDEO X11 XEXT NETPLAY NETWORK_CMD SOCKET_LEGACY FBO STRL PYTHON FFMPEG_ALLOC_CONTEXT3 FFMPEG_AVCODEC_OPEN2 FFMPEG_AVIO_OPEN FFMPEG_AVFORMAT_WRITE_HEADER FFMPEG_AVFORMAT_NEW_STREAM FFMPEG_AVCODEC_ENCODE_AUDIO2 FFMPEG_AVCODEC_ENCODE_VIDEO2 X264RGB SINC BSV_MOVIE RPI"
create_config_make config.mk $VARS
create_config_header config.h $VARS

164
qb/config.libs.sh.orig Normal file
View File

@ -0,0 +1,164 @@
. qb/qb.libs.sh
check_switch_c C99 -std=gnu99
check_critical C99 "Cannot find C99 compatible compiler."
check_switch_c NOUNUSED -Wno-unused-result
add_define_make NOUNUSED $HAVE_NOUNUSED
# There are still broken 64-bit Linux distros out there. :)
if [ -d /usr/lib64 ]; then
add_library_dirs /usr/lib64
fi
if [ -d /opt/local/lib ]; then
add_library_dirs /opt/local/lib
fi
if [ -d /opt/vc/lib ]; then
add_library_dirs /opt/vc/lib
add_include_dirs /opt/vc/include
# the gles library gets messed up with the gl library if available, so turn it off
HAVE_OPENGL=no
HAVE_RPI=yes
else
HAVE_RPI=no
fi
if [ $OS = BSD ]; then
DYLIB=-lc
else
DYLIB=-ldl
fi
if [ -z "$LIBRETRO" ]; then
LIBRETRO="-lretro"
else
echo "Explicit libsnes used, disabling dynamic libsnes loading ..."
HAVE_DYNAMIC=no
fi
if [ $HAVE_DYNAMIC != yes ]; then
check_lib_cxx RETRO $LIBRETRO retro_init $DYLIB
check_critical RETRO "Cannot find libretro."
add_define_make libretro $LIBRETRO
fi
check_lib THREADS -lpthread pthread_create
check_lib DYLIB $DYLIB dlopen
check_lib NETPLAY -lc socket
if [ $HAVE_NETPLAY = yes ]; then
HAVE_GETADDRINFO=auto
check_lib GETADDRINFO -lc getaddrinfo
if [ $HAVE_GETADDRINFO = yes ]; then
HAVE_SOCKET_LEGACY=no
else
HAVE_SOCKET_LEGACY=yes
fi
HAVE_NETWORK_CMD=yes
else
HAVE_NETWORK_CMD=no
fi
check_lib GETOPT_LONG -lc getopt_long
if [ $HAVE_DYLIB = no ] && [ $HAVE_DYNAMIC = yes ]; then
echo "Dynamic loading of libsnes is enabled, but your platform does not appear to have dlopen(), use --disable-dynamic or --with-libsnes=\"-lsnes\"".
exit 1
fi
check_pkgconf ALSA alsa
check_header OSS sys/soundcard.h
check_header OSS_BSD soundcard.h
check_lib OSS_LIB -lossaudio
if [ $OS = Darwin ]; then
check_lib AL "-framework OpenAL" alcOpenDevice
else
check_lib AL -lopenal alcOpenDevice
fi
if [ $OS = Darwin ]; then
check_lib FBO "-framework OpenGL" glFramebufferTexture2D
else
check_lib FBO -lGL glFramebufferTexture2D
fi
check_pkgconf RSOUND rsound 1.1
check_pkgconf ROAR libroar
check_pkgconf JACK jack 0.120.1
check_pkgconf PULSE libpulse
check_lib COREAUDIO "-framework AudioUnit" AudioUnitInitialize
check_pkgconf SDL sdl 1.2.10
check_critical SDL "Cannot find SDL library."
# On some distros, -lCg doesn't link against -lstdc++ it seems ...
if [ $HAVE_OPENGL != no ]; then
check_lib_cxx CG -lCg cgCreateContext
else
echo "Ignoring Cg. OpenGL is not enabled."
HAVE_CG=no
fi
check_pkgconf XML libxml-2.0
check_pkgconf SDL_IMAGE SDL_image
if [ $HAVE_THREADS != no ]; then
if [ $HAVE_FFMPEG != no ]; then
check_pkgconf AVCODEC libavcodec
check_pkgconf AVFORMAT libavformat
check_pkgconf AVUTIL libavutil
check_pkgconf SWSCALE libswscale
( [ $HAVE_FFMPEG = auto ] && ( [ $HAVE_AVCODEC = no ] || [ $HAVE_AVFORMAT = no ] || [ $HAVE_AVUTIL = no ] || [ $HAVE_SWSCALE = no ] ) && HAVE_FFMPEG=no ) || HAVE_FFMPEG=yes
fi
if [ $HAVE_FFMPEG = yes ]; then
check_lib FFMPEG_ALLOC_CONTEXT3 "$AVCODEC_LIBS" avcodec_alloc_context3
check_lib FFMPEG_AVCODEC_OPEN2 "$AVCODEC_LIBS" avcodec_open2
check_lib FFMPEG_AVCODEC_ENCODE_AUDIO2 "$AVCODEC_LIBS" avcodec_encode_audio2
check_lib FFMPEG_AVIO_OPEN "$AVFORMAT_LIBS" avio_open
check_lib FFMPEG_AVFORMAT_WRITE_HEADER "$AVFORMAT_LIBS" avformat_write_header
check_lib FFMPEG_AVFORMAT_NEW_STREAM "$AVFORMAT_LIBS" avformat_new_stream
check_lib FFMPEG_AVCODEC_ENCODE_VIDEO2 "$AVCODEC_LIBS" avcodec_encode_video2
fi
if [ $HAVE_FFMPEG = no ] && [ $HAVE_X264RGB = yes ]; then
echo "x264 RGB recording is enabled, but FFmpeg is not. --enable-x264rgb will not have any effect."
fi
else
echo "Not building with threading support. Will skip FFmpeg."
HAVE_FFMPEG=no
fi
check_lib DYNAMIC $DYLIB dlopen
check_pkgconf FREETYPE freetype2
check_pkgconf X11 x11
check_pkgconf XEXT xext
if [ $HAVE_X11 = yes ] && [ $HAVE_XEXT = yes ]; then
check_pkgconf XVIDEO xv
else
echo "X11 or Xext not present. Skipping XVideo."
HAVE_XVIDEO=no
fi
check_lib STRL -lc strlcpy
check_pkgconf PYTHON python3
add_define_make OS $OS
# Creates config.mk and config.h.
<<<<<<< HEAD
VARS="ALSA OSS OSS_BSD OSS_LIB AL RSOUND ROAR JACK COREAUDIO PULSE SDL OPENGL DYLIB GETOPT_LONG THREADS CG XML SDL_IMAGE DYNAMIC FFMPEG AVCODEC AVFORMAT AVUTIL SWSCALE CONFIGFILE FREETYPE XVIDEO X11 XEXT NETPLAY SOCKET_LEGACY FBO STRL PYTHON FFMPEG_ALLOC_CONTEXT3 FFMPEG_AVCODEC_OPEN2 FFMPEG_AVIO_OPEN FFMPEG_AVFORMAT_WRITE_HEADER FFMPEG_AVFORMAT_NEW_STREAM FFMPEG_AVCODEC_ENCODE_AUDIO2 FFMPEG_AVCODEC_ENCODE_VIDEO2 X264RGB SINC BSV_MOVIE RPI"
=======
VARS="ALSA OSS OSS_BSD OSS_LIB AL RSOUND ROAR JACK COREAUDIO PULSE SDL OPENGL DYLIB GETOPT_LONG THREADS CG XML SDL_IMAGE DYNAMIC FFMPEG AVCODEC AVFORMAT AVUTIL SWSCALE CONFIGFILE FREETYPE XVIDEO X11 XEXT NETPLAY NETWORK_CMD SOCKET_LEGACY FBO STRL PYTHON FFMPEG_ALLOC_CONTEXT3 FFMPEG_AVCODEC_OPEN2 FFMPEG_AVIO_OPEN FFMPEG_AVFORMAT_WRITE_HEADER FFMPEG_AVFORMAT_NEW_STREAM FFMPEG_AVCODEC_ENCODE_AUDIO2 FFMPEG_AVCODEC_ENCODE_VIDEO2 X264RGB SINC BSV_MOVIE"
>>>>>>> 232cf0d1224d219cb496316ee95c55bdde92ab25
create_config_make config.mk $VARS
create_config_header config.h $VARS

View File

@ -1343,6 +1343,27 @@ static void deinit_netplay(void)
}
#endif
#ifdef HAVE_NETWORK_CMD
static void init_network_cmd(void)
{
if (!g_settings.network_cmd_enable)
return;
driver.network_cmd = network_cmd_new(g_settings.network_cmd_port);
if (!driver.network_cmd)
RARCH_ERR("Failed to initialize network command interface.\n");
}
static void deinit_network_cmd(void)
{
if (driver.network_cmd)
{
network_cmd_free(driver.network_cmd);
driver.network_cmd = NULL;
}
}
#endif
static void init_libretro_cbs_plain(void)
{
pretro_set_video_refresh(video_frame);
@ -2358,6 +2379,10 @@ int rarch_main_init(int argc, char *argv[])
#ifdef HAVE_NETPLAY
init_netplay();
#endif
#ifdef HAVE_NETWORK_CMD
init_network_cmd();
#endif
init_drivers();
#ifdef HAVE_NETPLAY
@ -2431,6 +2456,11 @@ bool rarch_main_iterate(void)
!video_alive_func())
return false;
#ifdef HAVE_NETWORK_CMD
if (driver.network_cmd)
network_cmd_pre_frame(driver.network_cmd);
#endif
// Checks for stuff like fullscreen, save states, etc.
do_state_checks();
@ -2485,6 +2515,9 @@ void rarch_main_deinit(void)
#ifdef HAVE_NETPLAY
deinit_netplay();
#endif
#ifdef HAVE_NETWORK_CMD
deinit_network_cmd();
#endif
#ifdef HAVE_THREADS
if (g_extern.use_sram)

View File

@ -358,3 +358,7 @@
# Slowmotion ratio. When slowmotion, game will slow down by factor.
# slowmotion_ratio = 3.0
# Enable network command interface.
# network_cmd_enable = false
# network_cmd_port = 55355

View File

@ -193,6 +193,8 @@ void config_set_defaults(void)
g_settings.block_sram_overwrite = block_sram_overwrite;
g_settings.savestate_auto_index = savestate_auto_index;
g_settings.network_cmd_enable = network_cmd_enable;
g_settings.network_cmd_port = network_cmd_port;
rarch_assert(sizeof(g_settings.input.binds[0]) >= sizeof(snes_keybinds_1));
rarch_assert(sizeof(g_settings.input.binds[1]) >= sizeof(snes_keybinds_rest));
@ -459,6 +461,9 @@ bool config_load_file(const char *path)
CONFIG_GET_BOOL(block_sram_overwrite, "block_sram_overwrite");
CONFIG_GET_BOOL(savestate_auto_index, "savestate_auto_index");
CONFIG_GET_BOOL(network_cmd_enable, "network_cmd_enable");
CONFIG_GET_INT(network_cmd_port, "network_cmd_port");
if (config_get_string(conf, "environment_variables",
&g_extern.system.environment))
{

View File

@ -55,7 +55,7 @@ static void reset_callback(void)
g_quit = true;
}
void wii_input_init(void)
static void *wii_input_initialize(void)
{
PAD_Init();
#ifdef HW_RVL
@ -63,13 +63,6 @@ void wii_input_init(void)
#endif
SYS_SetResetCallback(reset_callback);
SYS_SetPowerCallback(reset_callback);
}
void wii_input_deinit(void)
{}
static void *wii_input_initialize(void)
{
return (void*)-1;
}

View File

@ -138,7 +138,7 @@ int main(void)
rarch_assert(g_extern.msg_queue = msg_queue_new(8));
wii_video_init();
wii_input_init();
input_wii.init();
rgui_handle_t *rgui = rgui_init("sd:/",
menu_framebuf, RGUI_WIDTH * sizeof(uint16_t),
@ -163,8 +163,8 @@ int main(void)
if(g_console.emulator_initialized)
rarch_main_deinit();
wii_input_deinit();
wii_video_deinit();
input_wii.free(NULL);
#ifdef HAVE_FILE_LOGGER
fclose(log_fp);

View File

@ -275,22 +275,6 @@ static void wii_free(void *data)
(void)data;
}
static void wii_swap(void * data)
{
(void)data;
/* TODO */
}
static void wii_set_aspect_ratio(void * data, uint32_t aspectratio_index)
{
(void)data;
g_settings.video.aspect_ratio = aspectratio_lut[g_console.aspect_ratio_index].value;
g_settings.video.force_aspect = false;
/* TODO */
}
static void wii_set_rotation(void * data, uint32_t orientation)
{
(void)data;
@ -299,12 +283,6 @@ static void wii_set_rotation(void * data, uint32_t orientation)
/* TODO */
}
static void wii_set_swap_block_state(void * data, bool toggle)
{
(void)data;
(void)toggle;
}
const video_driver_t video_wii = {
.init = wii_init,
.frame = wii_frame,
@ -313,8 +291,5 @@ const video_driver_t video_wii = {
.focus = wii_focus,
.free = wii_free,
.ident = "wii",
.set_swap_block_state = wii_set_swap_block_state,
.set_rotation = wii_set_rotation,
.set_aspect_ratio = wii_set_aspect_ratio,
.swap = wii_swap
};