This commit is contained in:
Toad King 2012-06-25 15:27:55 -04:00
commit ebf7259128
64 changed files with 1347 additions and 844 deletions

View File

@ -70,11 +70,11 @@ static void filebrowser_fetch_directory_entries(const char *path, filebrowser_t
rompath_title->SetText(strw_buffer);
romlist->DeleteItems(0, romlist->GetItemCount());
romlist->InsertItems(0, browser->current_dir.size);
for(unsigned i = 0; i < browser->current_dir.size; i++)
romlist->InsertItems(0, browser->current_dir.list->size);
for(unsigned i = 0; i < browser->current_dir.list->size; i++)
{
char fname_tmp[256];
fill_pathname_base(fname_tmp, browser->current_dir.elems[i], sizeof(fname_tmp));
fill_pathname_base(fname_tmp, browser->current_dir.list->elems[i].data, sizeof(fname_tmp));
rarch_convert_char_to_wchar(strw_buffer, fname_tmp, sizeof(strw_buffer));
romlist->SetText(i, strw_buffer);
}
@ -235,12 +235,12 @@ HRESULT CRetroArchSettings::OnInit(XUIMessageInit * pInitData, BOOL& bHandled)
m_settingslist.SetText(SETTING_HW_TEXTURE_FILTER, g_settings.video.smooth ? L"Hardware filtering shader #1: Linear interpolation" : L"Hardware filtering shader #1: Point filtering");
m_settingslist.SetText(SETTING_HW_TEXTURE_FILTER_2, g_settings.video.second_pass_smooth ? L"Hardware filtering shader #2: Linear interpolation" : L"Hardware filtering shader #2: Point filtering");
m_settingslist.SetText(SETTING_SCALE_ENABLED, g_console.fbo_enabled ? L"Custom Scaling/Dual Shaders: ON" : L"Custom Scaling/Dual Shaders: OFF");
rarch_settings_create_menu_item_label(strw_buffer, S_LBL_SHADER, sizeof(strw_buffer));
rarch_settings_create_menu_item_label_w(strw_buffer, S_LBL_SHADER, sizeof(strw_buffer));
m_settingslist.SetText(SETTING_SHADER, strw_buffer);
m_settingslist.SetText(SETTING_COLOR_FORMAT, g_console.color_format ? L"Color format: 32bit ARGB" : L"Color format: 16bit RGBA");
rarch_settings_create_menu_item_label(strw_buffer, S_LBL_SHADER_2, sizeof(strw_buffer));
rarch_settings_create_menu_item_label_w(strw_buffer, S_LBL_SHADER_2, sizeof(strw_buffer));
m_settingslist.SetText(SETTING_SHADER_2, strw_buffer);
rarch_settings_create_menu_item_label(strw_buffer, S_LBL_SCALE_FACTOR, sizeof(strw_buffer));
rarch_settings_create_menu_item_label_w(strw_buffer, S_LBL_SCALE_FACTOR, sizeof(strw_buffer));
m_settingslist.SetText(SETTING_SCALE_FACTOR, strw_buffer);
return 0;
@ -265,7 +265,7 @@ HRESULT CRetroArchSettings::OnControlNavigate(XUIMessageControlNavigate *pContro
{
rarch_settings_change(S_SCALE_FACTOR_DECREMENT);
//xdk360_gfx_init_fbo(vid);
rarch_settings_create_menu_item_label(strw_buffer, S_LBL_SCALE_FACTOR, sizeof(strw_buffer));
rarch_settings_create_menu_item_label_w(strw_buffer, S_LBL_SCALE_FACTOR, sizeof(strw_buffer));
m_settingslist.SetText(SETTING_SCALE_FACTOR, strw_buffer);
}
}
@ -283,7 +283,7 @@ HRESULT CRetroArchSettings::OnControlNavigate(XUIMessageControlNavigate *pContro
{
rarch_settings_change(S_SCALE_FACTOR_INCREMENT);
//xdk360_gfx_init_fbo(vid);
rarch_settings_create_menu_item_label(strw_buffer, S_LBL_SCALE_FACTOR, sizeof(strw_buffer));
rarch_settings_create_menu_item_label_w(strw_buffer, S_LBL_SCALE_FACTOR, sizeof(strw_buffer));
m_settingslist.SetText(SETTING_SCALE_FACTOR, strw_buffer);
}
}
@ -316,16 +316,16 @@ HRESULT CRetroArchQuickMenu::OnInit(XUIMessageInit * pInitData, BOOL& bHandled)
GetChildById(L"XuiQuickMenuList", &m_quickmenulist);
GetChildById(L"XuiBackButton", &m_back);
rarch_settings_create_menu_item_label(strw_buffer, S_LBL_ROTATION, sizeof(strw_buffer));
rarch_settings_create_menu_item_label_w(strw_buffer, S_LBL_ROTATION, sizeof(strw_buffer));
m_quickmenulist.SetText(MENU_ITEM_ORIENTATION, strw_buffer);
rarch_settings_create_menu_item_label(strw_buffer, S_LBL_ASPECT_RATIO, sizeof(strw_buffer));
rarch_settings_create_menu_item_label_w(strw_buffer, S_LBL_ASPECT_RATIO, sizeof(strw_buffer));
m_quickmenulist.SetText(MENU_ITEM_KEEP_ASPECT_RATIO, strw_buffer);
rarch_settings_create_menu_item_label(strw_buffer, S_LBL_LOAD_STATE_SLOT, sizeof(strw_buffer));
rarch_settings_create_menu_item_label_w(strw_buffer, S_LBL_LOAD_STATE_SLOT, sizeof(strw_buffer));
m_quickmenulist.SetText(MENU_ITEM_LOAD_STATE, strw_buffer);
rarch_settings_create_menu_item_label(strw_buffer, S_LBL_SAVE_STATE_SLOT, sizeof(strw_buffer));
rarch_settings_create_menu_item_label_w(strw_buffer, S_LBL_SAVE_STATE_SLOT, sizeof(strw_buffer));
m_quickmenulist.SetText(MENU_ITEM_SAVE_STATE, strw_buffer);
return 0;
@ -347,9 +347,9 @@ HRESULT CRetroArchQuickMenu::OnControlNavigate(XUIMessageControlNavigate *pContr
case MENU_ITEM_LOAD_STATE:
case MENU_ITEM_SAVE_STATE:
rarch_state_slot_decrease();
rarch_settings_create_menu_item_label(strw_buffer, S_LBL_LOAD_STATE_SLOT, sizeof(strw_buffer));
rarch_settings_create_menu_item_label_w(strw_buffer, S_LBL_LOAD_STATE_SLOT, sizeof(strw_buffer));
m_quickmenulist.SetText(MENU_ITEM_LOAD_STATE, strw_buffer);
rarch_settings_create_menu_item_label(strw_buffer, S_LBL_SAVE_STATE_SLOT, sizeof(strw_buffer));
rarch_settings_create_menu_item_label_w(strw_buffer, S_LBL_SAVE_STATE_SLOT, sizeof(strw_buffer));
m_quickmenulist.SetText(MENU_ITEM_SAVE_STATE, strw_buffer);
break;
case MENU_ITEM_KEEP_ASPECT_RATIO:
@ -358,7 +358,7 @@ HRESULT CRetroArchQuickMenu::OnControlNavigate(XUIMessageControlNavigate *pContr
break;
case MENU_ITEM_ORIENTATION:
rarch_settings_change(S_ROTATION_DECREMENT);
rarch_settings_create_menu_item_label(strw_buffer, S_LBL_ROTATION, sizeof(strw_buffer));
rarch_settings_create_menu_item_label_w(strw_buffer, S_LBL_ROTATION, sizeof(strw_buffer));
m_quickmenulist.SetText(MENU_ITEM_ORIENTATION, strw_buffer);
video_xdk360.set_rotation(driver.video_data, g_console.screen_orientation);
break;
@ -372,9 +372,9 @@ HRESULT CRetroArchQuickMenu::OnControlNavigate(XUIMessageControlNavigate *pContr
case MENU_ITEM_LOAD_STATE:
case MENU_ITEM_SAVE_STATE:
rarch_state_slot_increase();
rarch_settings_create_menu_item_label(strw_buffer, S_LBL_LOAD_STATE_SLOT, sizeof(strw_buffer));
rarch_settings_create_menu_item_label_w(strw_buffer, S_LBL_LOAD_STATE_SLOT, sizeof(strw_buffer));
m_quickmenulist.SetText(MENU_ITEM_LOAD_STATE, strw_buffer);
rarch_settings_create_menu_item_label(strw_buffer, S_LBL_SAVE_STATE_SLOT, sizeof(strw_buffer));
rarch_settings_create_menu_item_label_w(strw_buffer, S_LBL_SAVE_STATE_SLOT, sizeof(strw_buffer));
m_quickmenulist.SetText(MENU_ITEM_SAVE_STATE, strw_buffer);
break;
case MENU_ITEM_KEEP_ASPECT_RATIO:
@ -383,7 +383,7 @@ HRESULT CRetroArchQuickMenu::OnControlNavigate(XUIMessageControlNavigate *pContr
break;
case MENU_ITEM_ORIENTATION:
rarch_settings_change(S_ROTATION_INCREMENT);
rarch_settings_create_menu_item_label(strw_buffer, S_LBL_ROTATION, sizeof(strw_buffer));
rarch_settings_create_menu_item_label_w(strw_buffer, S_LBL_ROTATION, sizeof(strw_buffer));
m_quickmenulist.SetText(MENU_ITEM_ORIENTATION, strw_buffer);
video_xdk360.set_rotation(driver.video_data, g_console.screen_orientation);
break;
@ -399,7 +399,7 @@ HRESULT CRetroArchQuickMenu::OnControlNavigate(XUIMessageControlNavigate *pContr
if(aspectratio_changed)
{
gfx_ctx_set_aspect_ratio(d3d9, g_console.aspect_ratio_index);
rarch_settings_create_menu_item_label(strw_buffer, S_LBL_ASPECT_RATIO, sizeof(strw_buffer));
rarch_settings_create_menu_item_label_w(strw_buffer, S_LBL_ASPECT_RATIO, sizeof(strw_buffer));
m_quickmenulist.SetText(MENU_ITEM_KEEP_ASPECT_RATIO, strw_buffer);
}
@ -448,7 +448,7 @@ HRESULT CRetroArchQuickMenu::OnNotifyPress( HXUIOBJ hObjPressed, int & bHandled
rarch_settings_default(S_DEF_ASPECT_RATIO);
gfx_ctx_set_aspect_ratio(d3d9, g_console.aspect_ratio_index);
rarch_settings_create_menu_item_label(strw_buffer, S_LBL_ASPECT_RATIO, sizeof(strw_buffer));
rarch_settings_create_menu_item_label_w(strw_buffer, S_LBL_ASPECT_RATIO, sizeof(strw_buffer));
m_quickmenulist.SetText(MENU_ITEM_KEEP_ASPECT_RATIO, strw_buffer);
}
break;
@ -458,7 +458,7 @@ HRESULT CRetroArchQuickMenu::OnNotifyPress( HXUIOBJ hObjPressed, int & bHandled
break;
case MENU_ITEM_ORIENTATION:
rarch_settings_default(S_DEF_ROTATION);
rarch_settings_create_menu_item_label(strw_buffer, S_LBL_ROTATION, sizeof(strw_buffer));
rarch_settings_create_menu_item_label_w(strw_buffer, S_LBL_ROTATION, sizeof(strw_buffer));
m_quickmenulist.SetText(MENU_ITEM_ORIENTATION, strw_buffer);
video_xdk360.set_rotation(driver.video_data, g_console.screen_orientation);
break;
@ -517,7 +517,7 @@ HRESULT CRetroArchMain::OnInit(XUIMessageInit * pInitData, BOOL& bHandled)
rarch_convert_char_to_wchar(strw_buffer, core_text, sizeof(strw_buffer));
m_core.SetText(strw_buffer);
rarch_settings_create_menu_item_label(strw_buffer, S_LBL_RARCH_VERSION, sizeof(strw_buffer));
rarch_settings_create_menu_item_label_w(strw_buffer, S_LBL_RARCH_VERSION, sizeof(strw_buffer));
m_title.SetText(strw_buffer);
return 0;
@ -530,7 +530,7 @@ HRESULT CRetroArchFileBrowser::OnNotifyPress( HXUIOBJ hObjPressed, BOOL& bHandle
if(hObjPressed == m_romlist)
{
int index = m_romlist.GetCurSel();
if(path_file_exists(browser.current_dir.elems[index]))
if(path_file_exists(browser.current_dir.list->elems[index].data))
{
struct retro_system_info info;
retro_get_system_info(&info);
@ -550,7 +550,7 @@ HRESULT CRetroArchFileBrowser::OnNotifyPress( HXUIOBJ hObjPressed, BOOL& bHandle
rarch_settings_change(S_START_RARCH);
}
}
else if(path_is_directory(browser.current_dir.elems[index]))
else if(browser.current_dir.list->elems[index].attr.b)
{
const char * strbuffer = rarch_convert_wchar_to_const_char((const wchar_t *)m_romlist.GetText(index));
@ -583,7 +583,7 @@ HRESULT CRetroArchShaderBrowser::OnNotifyPress( HXUIOBJ hObjPressed, BOOL& bHand
if(hObjPressed == m_shaderlist)
{
int index = m_shaderlist.GetCurSel();
if(path_file_exists(tmp_browser.current_dir.elems[index]))
if(path_file_exists(tmp_browser.current_dir.list->elems[index].data))
{
const char * strbuffer = rarch_convert_wchar_to_const_char((const wchar_t *)m_shaderlist.GetText(index));
@ -604,7 +604,7 @@ HRESULT CRetroArchShaderBrowser::OnNotifyPress( HXUIOBJ hObjPressed, BOOL& bHand
if (g_console.info_msg_enable)
rarch_settings_msg(S_MSG_SHADER_LOADING_SUCCEEDED, S_DELAY_180);
}
else if(path_is_directory(tmp_browser.current_dir.elems[index]))
else if(tmp_browser.current_dir.list->elems[index].attr.b)
{
const char * strbuffer = rarch_convert_wchar_to_const_char((const wchar_t *)m_shaderlist.GetText(index));
snprintf(path, sizeof(path), "%s\\%s", filebrowser_get_current_dir(&tmp_browser), strbuffer);
@ -624,13 +624,13 @@ HRESULT CRetroArchCoreBrowser::OnNotifyPress( HXUIOBJ hObjPressed, BOOL& bHandle
if(hObjPressed == m_romlist)
{
int index = m_romlist.GetCurSel();
if(path_file_exists(tmp_browser.current_dir.elems[index]))
if(path_file_exists(tmp_browser.current_dir.list->elems[index].data))
{
const char * strbuffer = rarch_convert_wchar_to_const_char((const wchar_t *)m_romlist.GetText(index));
snprintf(g_console.launch_app_on_exit, sizeof(g_console.launch_app_on_exit), "%s\\%s", filebrowser_get_current_dir(&tmp_browser), strbuffer);
rarch_settings_change(S_RETURN_TO_LAUNCHER);
}
else if(path_is_directory(tmp_browser.current_dir.elems[index]))
else if(tmp_browser.current_dir.list->elems[index].attr.b)
{
const char * strbuffer = rarch_convert_wchar_to_const_char((const wchar_t *)m_romlist.GetText(index));
snprintf(path, sizeof(path), "%s%s\\", filebrowser_get_current_dir(&tmp_browser), strbuffer);

View File

@ -22,7 +22,7 @@
#include "../libretro.h"
#include "../console/console_ext.h"
#include "xdk360_input.h"
#include "frontend/menu.h"
#include "frontend-xdk/menu.h"
static uint64_t state[4];
static unsigned pads_connected;

View File

@ -547,9 +547,196 @@ static void *xdk360_init(const video_info_t *video, const input_driver_t **input
return d3d9;
}
extern video_console_t video_console;
extern xdk360_video_font_t m_Font;
static void xdk360_video_font_draw_text(xdk360_video_font_t * font,
float fOriginX, float fOriginY, const wchar_t * strText, float fMaxPixelWidth )
{
if( strText == NULL || strText[0] == L'\0')
return;
xdk360_video_t *vid = (xdk360_video_t*)driver.video_data;
D3DDevice *pd3dDevice = vid->d3d_render_device;
// Set the color as a vertex shader constant
float vColor[4];
vColor[0] = ( ( 0xffffffff & 0x00ff0000 ) >> 16L ) / 255.0F;
vColor[1] = ( ( 0xffffffff & 0x0000ff00 ) >> 8L ) / 255.0F;
vColor[2] = ( ( 0xffffffff & 0x000000ff ) >> 0L ) / 255.0F;
vColor[3] = ( ( 0xffffffff & 0xff000000 ) >> 24L ) / 255.0F;
d3d9_render_msg_pre(font);
// Perform the actual storing of the color constant here to prevent
// a load-hit-store by inserting work between the store and the use of
// the vColor array.
pd3dDevice->SetVertexShaderConstantF( 1, vColor, 1 );
// Set the starting screen position
if((fOriginX < 0.0f))
fOriginX += font->m_rcWindow.x2;
if( fOriginY < 0.0f )
fOriginY += font->m_rcWindow.y2;
font->m_fCursorX = floorf( fOriginX );
font->m_fCursorY = floorf( fOriginY );
// Adjust for padding
fOriginY -= font->m_fFontTopPadding;
// Add window offsets
float Winx = 0.0f;
float Winy = 0.0f;
fOriginX += Winx;
fOriginY += Winy;
font->m_fCursorX += Winx;
font->m_fCursorY += Winy;
// Begin drawing the vertices
// Declared as volatile to force writing in ascending
// address order. It prevents out of sequence writing in write combined
// memory.
volatile float * pVertex;
unsigned long dwNumChars = wcslen(strText);
HRESULT hr = pd3dDevice->BeginVertices( D3DPT_QUADLIST, 4 * dwNumChars, sizeof( XMFLOAT4 ) ,
( VOID** )&pVertex );
// The ring buffer may run out of space when tiling, doing z-prepasses,
// or using BeginCommandBuffer. If so, make the buffer larger.
if( hr < 0 )
RARCH_ERR( "Ring buffer out of memory.\n" );
// Draw four vertices for each glyph
while( *strText )
{
wchar_t letter;
// Get the current letter in the string
letter = *strText++;
// Handle the newline character
if( letter == L'\n' )
{
font->m_fCursorX = fOriginX;
font->m_fCursorY += font->m_fFontYAdvance * font->m_fYScaleFactor;
continue;
}
// Translate unprintable characters
const GLYPH_ATTR * pGlyph = &font->m_Glyphs[ ( letter <= font->m_cMaxGlyph )
? font->m_TranslatorTable[letter] : 0 ];
float fOffset = font->m_fXScaleFactor * (float)pGlyph->wOffset;
float fAdvance = font->m_fXScaleFactor * (float)pGlyph->wAdvance;
float fWidth = font->m_fXScaleFactor * (float)pGlyph->wWidth;
float fHeight = font->m_fYScaleFactor * font->m_fFontHeight;
// Setup the screen coordinates
font->m_fCursorX += fOffset;
float X4 = font->m_fCursorX;
float X1 = X4;
float X3 = X4 + fWidth;
float X2 = X1 + fWidth;
float Y1 = font->m_fCursorY;
float Y3 = Y1 + fHeight;
float Y2 = Y1;
float Y4 = Y3;
font->m_fCursorX += fAdvance;
// Add the vertices to draw this glyph
unsigned long tu1 = pGlyph->tu1; // Convert shorts to 32 bit longs for in register merging
unsigned long tv1 = pGlyph->tv1;
unsigned long tu2 = pGlyph->tu2;
unsigned long tv2 = pGlyph->tv2;
// NOTE: The vertexs are 2 floats for the screen coordinates,
// followed by two USHORTS for the u/vs of the character,
// terminated with the ARGB 32 bit color.
// This makes for 16 bytes per vertex data (Easier to read)
// Second NOTE: The uvs are merged and written using a DWORD due
// to the write combining hardware being only able to handle 32,
// 64 and 128 writes. Never store to write combined memory with
// 8 or 16 bit instructions. You've been warned.
pVertex[0] = X1;
pVertex[1] = Y1;
((volatile unsigned long *)pVertex)[2] = (tu1<<16)|tv1; // Merged using big endian rules
pVertex[3] = 0;
pVertex[4] = X2;
pVertex[5] = Y2;
((volatile unsigned long *)pVertex)[6] = (tu2<<16)|tv1; // Merged using big endian rules
pVertex[7] = 0;
pVertex[8] = X3;
pVertex[9] = Y3;
((volatile unsigned long *)pVertex)[10] = (tu2<<16)|tv2; // Merged using big endian rules
pVertex[11] = 0;
pVertex[12] = X4;
pVertex[13] = Y4;
((volatile unsigned long *)pVertex)[14] = (tu1<<16)|tv2; // Merged using big endian rules
pVertex[15] = 0;
pVertex+=16;
dwNumChars--;
}
// Since we allocated vertex data space based on the string length, we now need to
// add some dummy verts for any skipped characters (like newlines, etc.)
while( dwNumChars )
{
for(int i = 0; i < 16; i++)
pVertex[i] = 0;
pVertex += 16;
dwNumChars--;
}
// Stop drawing vertices
D3DDevice_EndVertices(pd3dDevice);
// Undo window offsets
font->m_fCursorX -= Winx;
font->m_fCursorY -= Winy;
d3d9_render_msg_post(font);
}
void xdk360_console_draw(void)
{
xdk360_video_t *vid = (xdk360_video_t*)driver.video_data;
D3DDevice *m_pd3dDevice = vid->d3d_render_device;
// The top line
unsigned int nTextLine = ( video_console.m_nCurLine -
video_console.m_cScreenHeight + video_console.m_cScreenHeightVirtual -
video_console.m_nScrollOffset + 1 )
% video_console.m_cScreenHeightVirtual;
d3d9_render_msg_pre(&m_Font);
for( unsigned int nScreenLine = 0; nScreenLine < video_console.m_cScreenHeight; nScreenLine++ )
{
xdk360_video_font_draw_text(&m_Font, (float)( video_console.m_cxSafeAreaOffset ),
(float)( video_console.m_cySafeAreaOffset + video_console.m_fLineHeight * nScreenLine ),
video_console.m_Lines[nTextLine], 0.0f );
nTextLine = ( nTextLine + 1 ) % video_console.m_cScreenHeightVirtual;
}
d3d9_render_msg_post(&m_Font);
}
static bool xdk360_frame(void *data, const void *frame,
unsigned width, unsigned height, unsigned pitch, const char *msg)
{
if (!frame)
return true;
xdk360_video_t *d3d9 = (xdk360_video_t*)data;
D3DSurface* pRenderTarget0;
bool menu_enabled = g_console.menu_enable;
@ -725,8 +912,7 @@ static void xdk360_start(void)
gfx_ctx_set_swap_interval(d3d9->vsync ? 1 : 0, false);
/* XBox 360 specific font code */
HRESULT hr = xdk360_console_init("game:\\media\\Arial_12.xpr",
0xff000000, 0xffffffff );
HRESULT hr = d3d9_init_font("game:\\media\\Arial_12.xpr");
if(hr < 0)
{
@ -742,7 +928,7 @@ static void xdk360_stop(void)
{
void *data = driver.video_data;
driver.video_data = NULL;
xdk360_console_deinit();
d3d9_deinit_font();
xdk360_free(data);
}

View File

@ -18,7 +18,7 @@
#define _XDK360_VIDEO_H
#include <stdint.h>
#include "fonts.h"
#include "../gfx/fonts/xdk360_fonts.h"
#define DFONT_MAX 4096
#define PRIM_FVF (D3DFVF_XYZRHW | D3DFVF_TEX1)

View File

@ -59,11 +59,6 @@ class PackedResource
HRESULT Create( const char * strFilename );
void Destroy();
D3DResource* RegisterResource( D3DResource* pResource ) const
{
return pResource;
}
void * GetData( unsigned long dwOffset ) const
{
return &m_pSysMemData[dwOffset];
@ -79,16 +74,6 @@ class PackedResource
return ( D3DTexture* )GetResource( dwOffset );
}
D3DArrayTexture* GetArrayTexture( unsigned long dwOffset ) const
{
return ( D3DArrayTexture* )GetResource( dwOffset );
}
D3DVertexBuffer* GetVertexBuffer( unsigned long dwOffset ) const
{
return ( D3DVertexBuffer* )GetResource( dwOffset );
}
void * GetData( const char * strName ) const;
D3DResource* GetResource( const char * strName ) const
@ -101,16 +86,6 @@ class PackedResource
return ( D3DTexture* )GetResource( strName );
}
D3DArrayTexture* GetArrayTexture( const char * strName ) const
{
return ( D3DArrayTexture* )GetResource( strName );
}
D3DVertexBuffer* GetVertexBuffer( const char * strName ) const
{
return ( D3DVertexBuffer* )GetResource( strName );
}
PackedResource();
~PackedResource();
};

View File

@ -108,7 +108,9 @@ RetroArch PS3 needs to be compiled in the following order:
<tt>make -f Makefile.ps3</tt>
Finally, you can add one of the following parameters to the above line in order to make a PKG file:
<b>PlayStation3 - Creating a PKG installable file</b><br />
You can add 'pkg' as a parameter in order to make a PKG file - for example:
<tt>make -f Makefile.ps3 pkg</tt>

View File

@ -85,10 +85,11 @@ static int parse_ports(char **dest_ports, const char **jports)
{
int parsed = 0;
const char *con = strtok(g_settings.audio.device, ",");
char *save;
const char *con = strtok_r(g_settings.audio.device, ",", &save);
if (con)
dest_ports[parsed++] = strdup(con);
con = strtok(NULL, ",");
con = strtok_r(NULL, ",", &save);
if (con)
dest_ports[parsed++] = strdup(con);

View File

@ -18,6 +18,7 @@
#include "dynamic.h"
#include "general.h"
#include "compat/strl.h"
#include "compat/posix_string.h"
#ifdef HAVE_CONFIG_H
#include "config.h"
@ -165,14 +166,15 @@ static void cheat_manager_load_config(cheat_manager_t *handle, const char *path,
return;
}
const char *num = strtok(str, ";");
char *save;
const char *num = strtok_r(str, ";", &save);
while (num)
{
unsigned index = strtoul(num, NULL, 0);
if (index < handle->size)
handle->cheats[index].state = true;
num = strtok(NULL, ";");
num = strtok_r(NULL, ";", &save);
}
free(str);

View File

@ -239,6 +239,7 @@ size_t strlcat(char *dest, const char *source, size_t size)
#undef strcasecmp
#undef strdup
#undef isblank
#undef strtok_r
#include <ctype.h>
#include <stdlib.h>
#include <stddef.h>
@ -278,5 +279,36 @@ int isblank_rarch__(int c)
return (c == ' ') || (c == '\t');
}
char *strtok_r_rarch__(char *str, const char *delim, char **saveptr)
{
if (!saveptr || !delim)
return NULL;
if (str)
*saveptr = str;
char *first = NULL;
do
{
first = *saveptr;
while (*first && strchr(delim, *first))
*first++ = '\0';
if (*first == '\0')
return NULL;
char *ptr = first + 1;
while (*ptr && !strchr(delim, *ptr))
ptr++;
*saveptr = ptr + (*ptr ? 1 : 0);
*ptr = '\0';
} while (strlen(first) == 0);
return first;
}
#endif

View File

@ -23,12 +23,17 @@ extern "C" {
#endif
#undef strcasecmp
#undef strdup
#undef isblank
#undef strtok_r
#define strcasecmp(a, b) strcasecmp_rarch__(a, b)
#define strdup(orig) strdup_rarch__(orig)
#define isblank(c) isblank_rarch__(c)
#define strtok_r(str, delim, saveptr) strtok_r_rarch__(str, delim, saveptr)
int strcasecmp(const char *a, const char *b);
char *strdup(const char *orig);
int isblank(int c);
char *strtok_r(char *str, const char *delim, char **saveptr);
#ifdef __cplusplus
}

View File

@ -110,11 +110,13 @@ static char *extract_value(char *line, bool is_value)
while (isspace(*line))
line++;
char *save;
// We have a full string. Read until next ".
if (*line == '"')
{
line++;
char *tok = strtok(line, "\"");
char *tok = strtok_r(line, "\"", &save);
if (!tok)
return NULL;
return strdup(tok);
@ -123,7 +125,7 @@ static char *extract_value(char *line, bool is_value)
return NULL;
else // We don't have that... Read till next space.
{
char *tok = strtok(line, " \n\t\f\r\v");
char *tok = strtok_r(line, " \n\t\f\r\v", &save);
if (tok)
return strdup(tok);
else

View File

@ -78,7 +78,7 @@ enum
#define VIDEO_DEFAULT_DRIVER VIDEO_WII
#elif defined(XENON)
#define VIDEO_DEFAULT_DRIVER VIDEO_XENON360
#elif defined(_XBOX)
#elif defined(_XBOX360)
#define VIDEO_DEFAULT_DRIVER VIDEO_XDK360
#elif defined(HAVE_XVIDEO)
#define VIDEO_DEFAULT_DRIVER VIDEO_XVIDEO
@ -94,7 +94,7 @@ enum
#define AUDIO_DEFAULT_DRIVER AUDIO_PS3
#elif defined(XENON)
#define AUDIO_DEFAULT_DRIVER AUDIO_XENON360
#elif defined(_XBOX)
#elif defined(_XBOX360)
#define AUDIO_DEFAULT_DRIVER AUDIO_XDK360
#elif defined(GEKKO)
#define AUDIO_DEFAULT_DRIVER AUDIO_WII
@ -128,7 +128,7 @@ enum
#if defined(XENON)
#define INPUT_DEFAULT_DRIVER INPUT_XENON360
#elif defined(_XBOX)
#elif defined(_XBOX360)
#define INPUT_DEFAULT_DRIVER INPUT_XDK360
#elif defined(HAVE_SDL)
#define INPUT_DEFAULT_DRIVER INPUT_SDL

View File

@ -285,7 +285,7 @@ static const struct platform_bind platform_keys[] = {
{ CTRL_UP_MASK | CTRL_RSTICK_UP_MASK, "RStick D-Pad Up" },
{ CTRL_DOWN_MASK | CTRL_RSTICK_DOWN_MASK, "RStick D-Pad Down" },
};
#elif defined(_XBOX)
#elif defined(_XBOX360)
static const struct platform_bind platform_keys[] = {
{ XINPUT_GAMEPAD_B, "B button" },
{ XINPUT_GAMEPAD_A, "A button" },
@ -471,7 +471,7 @@ void rarch_input_set_controls_default (void)
rarch_default_keybind_lut[RETRO_DEVICE_ID_JOYPAD_R3] = platform_keys[PS3_DEVICE_ID_JOYPAD_R3].joykey;
rarch_default_keybind_lut[RETRO_DEVICE_ID_JOYPAD_L2] = platform_keys[PS3_DEVICE_ID_JOYPAD_L2].joykey;
rarch_default_keybind_lut[RETRO_DEVICE_ID_JOYPAD_L3] = platform_keys[PS3_DEVICE_ID_JOYPAD_L3].joykey;
#elif defined(_XBOX)
#elif defined(_XBOX360)
rarch_default_keybind_lut[RETRO_DEVICE_ID_JOYPAD_B] = platform_keys[XDK360_DEVICE_ID_JOYPAD_A].joykey;
rarch_default_keybind_lut[RETRO_DEVICE_ID_JOYPAD_Y] = platform_keys[XDK360_DEVICE_ID_JOYPAD_X].joykey;
rarch_default_keybind_lut[RETRO_DEVICE_ID_JOYPAD_SELECT] = platform_keys[XDK360_DEVICE_ID_JOYPAD_BACK].joykey;
@ -756,15 +756,10 @@ void rarch_console_rsound_stop(void)
STRING HANDLING
============================================================ */
#ifdef _XBOX
void rarch_convert_char_to_wchar(wchar_t *buf, const char * str, size_t size)
{
unsigned long dwNum = MultiByteToWideChar(CP_ACP, 0, str, -1, NULL, 0);
size /= sizeof(wchar_t);
rarch_assert(size >= dwNum);
MultiByteToWideChar(CP_ACP, 0, str, -1, buf, dwNum);
mbstowcs(buf, str, size / sizeof(wchar_t));
}
#endif
const char * rarch_convert_wchar_to_const_char(const wchar_t * wstr)
{
@ -803,7 +798,8 @@ void rarch_config_load(const char * conf_name, const char * libretro_dir_path, c
if(!strcmp(g_settings.libretro, ""))
{
const char *first_file = rarch_manage_libretro_set_first_file(libretro_dir_path, exe_ext);
char first_file[PATH_MAX];
rarch_manage_libretro_set_first_file(first_file, sizeof(first_file), libretro_dir_path, exe_ext);
if(first_file != NULL)
strlcpy(g_settings.libretro, first_file, sizeof(g_settings.libretro));
}

View File

@ -218,12 +218,16 @@ bool rarch_console_rsound_start(const char *ip);
void rarch_console_rsound_stop(void);
#endif
#ifdef _XBOX
void rarch_convert_char_to_wchar(wchar_t *buf, const char * str, size_t size);
#endif
const char * rarch_convert_wchar_to_const_char(const wchar_t * wstr);
enum
{
CONFIG_FILE,
SHADER_PRESET_FILE,
INPUT_PRESET_FILE
};
void rarch_config_create_default(const char * conf_name);
void rarch_config_load(const char * conf_name, const char * libretro_dir_path, const char * exe_ext, bool find_libretro_path);
void rarch_config_save(const char * conf_name);

View File

@ -81,7 +81,7 @@ enum ps3_device_id
RARCH_LAST_PLATFORM_KEY
};
#elif defined(_XBOX)
#elif defined(_XBOX360)
#include "../360/xdk360_input.h"
enum xdk360_device_id

View File

@ -220,48 +220,41 @@ void rarch_settings_msg(unsigned setting, unsigned delay)
msg_queue_push(g_extern.msg_queue, str, 1, delay);
}
#ifdef _XBOX
void rarch_settings_create_menu_item_label(wchar_t * strwbuf, unsigned setting, size_t size)
#else
void rarch_settings_create_menu_item_label(char * str, unsigned setting, size_t size)
#endif
void rarch_settings_create_menu_item_label_w(wchar_t *strwbuf, unsigned setting, size_t size)
{
#ifdef _XBOX
char str[PATH_MAX];
size_t SIZEOF_STR = sizeof(str);
#else
size_t SIZEOF_STR = size;
#endif
rarch_settings_create_menu_item_label(str, setting, sizeof(str));
rarch_convert_char_to_wchar(strwbuf, str, size);
}
void rarch_settings_create_menu_item_label(char * str, unsigned setting, size_t size)
{
switch (setting)
{
case S_LBL_ASPECT_RATIO:
snprintf(str, SIZEOF_STR, "Aspect Ratio: %s", aspectratio_lut[g_console.aspect_ratio_index].name);
snprintf(str, size, "Aspect Ratio: %s", aspectratio_lut[g_console.aspect_ratio_index].name);
break;
case S_LBL_SHADER:
snprintf(str, SIZEOF_STR, "Shader #1: %s", g_settings.video.cg_shader_path);
snprintf(str, size, "Shader #1: %s", g_settings.video.cg_shader_path);
break;
case S_LBL_SHADER_2:
snprintf(str, SIZEOF_STR, "Shader #2: %s", g_settings.video.second_pass_shader);
snprintf(str, size, "Shader #2: %s", g_settings.video.second_pass_shader);
break;
case S_LBL_RARCH_VERSION:
snprintf(str, SIZEOF_STR, "RetroArch %s", PACKAGE_VERSION);
snprintf(str, size, "RetroArch %s", PACKAGE_VERSION);
break;
case S_LBL_SCALE_FACTOR:
snprintf(str, SIZEOF_STR, "Scale Factor: %f (X) / %f (Y)", g_settings.video.fbo_scale_x, g_settings.video.fbo_scale_y);
snprintf(str, size, "Scale Factor: %f (X) / %f (Y)", g_settings.video.fbo_scale_x, g_settings.video.fbo_scale_y);
break;
case S_LBL_ROTATION:
snprintf(str, SIZEOF_STR, "Rotation: %s", rotation_lut[g_console.screen_orientation]);
snprintf(str, size, "Rotation: %s", rotation_lut[g_console.screen_orientation]);
break;
case S_LBL_LOAD_STATE_SLOT:
snprintf(str, SIZEOF_STR, "Load State #%d", g_extern.state_slot);
snprintf(str, size, "Load State #%d", g_extern.state_slot);
break;
case S_LBL_SAVE_STATE_SLOT:
snprintf(str, SIZEOF_STR, "Save State #%d", g_extern.state_slot);
snprintf(str, size, "Save State #%d", g_extern.state_slot);
break;
}
#ifdef _XBOX
rarch_convert_char_to_wchar(strwbuf, str, size);
#endif
}

View File

@ -95,10 +95,7 @@ void rarch_settings_change(unsigned setting);
void rarch_settings_default(unsigned setting);
void rarch_settings_msg(unsigned setting, unsigned delay);
#ifdef _XBOX
void rarch_settings_create_menu_item_label(wchar_t * strwbuf, unsigned setting, size_t size);
#else
void rarch_settings_create_menu_item_label(char * str, unsigned setting, size_t size);
#endif
void rarch_settings_create_menu_item_label_w(wchar_t *strwbuf, unsigned setting, size_t size);
#endif

View File

@ -22,11 +22,10 @@ const char * path, const char * extensions)
strlcpy(filebrowser->dir[filebrowser->directory_stack_size], path,
sizeof(filebrowser->dir[filebrowser->directory_stack_size]));
filebrowser->current_dir.elems = dir_list_new(path, extensions, true);
filebrowser->current_dir.size = dir_list_size(filebrowser->current_dir.elems);
filebrowser->current_dir.list = dir_list_new(path, extensions, true);
filebrowser->current_dir.ptr = 0;
dir_list_sort(filebrowser->current_dir.elems, true);
dir_list_sort(filebrowser->current_dir.list, true);
}
static void filebrowser_new(filebrowser_t * filebrowser, const char * start_dir,
@ -43,16 +42,11 @@ void filebrowser_set_root(filebrowser_t *filebrowser, const char *root_dir)
strlcpy(filebrowser->root_dir, root_dir, sizeof(filebrowser->root_dir));
}
void filebrowser_set_current_path(filebrowser_t *filebrowser, const char *path)
{
}
void filebrowser_free(filebrowser_t * filebrowser)
{
dir_list_free(filebrowser->current_dir.elems);
dir_list_free(filebrowser->current_dir.list);
filebrowser->current_dir.elems = NULL;
filebrowser->current_dir.size = 0;
filebrowser->current_dir.list = NULL;
filebrowser->current_dir.ptr = 0;
}
@ -82,7 +76,12 @@ const char * filebrowser_get_current_dir (filebrowser_t *filebrowser)
const char * filebrowser_get_current_path (filebrowser_t *filebrowser)
{
return filebrowser->current_dir.elems[filebrowser->current_dir.ptr];
return filebrowser->current_dir.list->elems[filebrowser->current_dir.ptr].data;
}
bool filebrowser_get_current_path_isdir (filebrowser_t *filebrowser)
{
return filebrowser->current_dir.list->elems[filebrowser->current_dir.ptr].attr.b;
}
size_t filebrowser_get_current_index (filebrowser_t *filebrowser)
@ -98,15 +97,15 @@ void filebrowser_set_current_at (filebrowser_t *filebrowser, size_t pos)
static void filebrowser_set_current_increment (filebrowser_t *filebrowser, bool allow_wraparound)
{
filebrowser->current_dir.ptr++;
if (filebrowser->current_dir.ptr >= filebrowser->current_dir.size && allow_wraparound)
if (filebrowser->current_dir.ptr >= filebrowser->current_dir.list->size && allow_wraparound)
filebrowser->current_dir.ptr = 0;
}
static void filebrowser_set_current_decrement (filebrowser_t *filebrowser, bool allow_wraparound)
{
filebrowser->current_dir.ptr--;
if (filebrowser->current_dir.ptr >= filebrowser->current_dir.size && allow_wraparound)
filebrowser->current_dir.ptr = filebrowser->current_dir.size - 1;
if (filebrowser->current_dir.ptr >= filebrowser->current_dir.list->size && allow_wraparound)
filebrowser->current_dir.ptr = filebrowser->current_dir.list->size - 1;
}
void filebrowser_iterate(filebrowser_t *filebrowser, filebrowser_action_t action)
@ -129,7 +128,7 @@ void filebrowser_iterate(filebrowser_t *filebrowser, filebrowser_action_t action
break;
case FILEBROWSER_ACTION_RIGHT:
filebrowser->current_dir.ptr = (min(filebrowser->current_dir.ptr + 5,
filebrowser->current_dir.size-1));
filebrowser->current_dir.list->size-1));
break;
case FILEBROWSER_ACTION_SCROLL_UP:
if (filebrowser->current_dir.ptr <= entries_to_scroll)
@ -145,11 +144,11 @@ void filebrowser_iterate(filebrowser_t *filebrowser, filebrowser_action_t action
break;
case FILEBROWSER_ACTION_SCROLL_DOWN:
filebrowser->current_dir.ptr = (min(filebrowser->current_dir.ptr +
entries_to_scroll, filebrowser->current_dir.size-1));
entries_to_scroll, filebrowser->current_dir.list->size-1));
break;
case FILEBROWSER_ACTION_SCROLL_DOWN_SMOOTH:
filebrowser->current_dir.ptr = (min(filebrowser->current_dir.ptr + 50,
filebrowser->current_dir.size-1));
filebrowser->current_dir.list->size-1));
if(!filebrowser->current_dir.ptr) filebrowser->current_dir.ptr = 0;
break;
case FILEBROWSER_ACTION_OK:

View File

@ -28,8 +28,7 @@ typedef struct
uint32_t directory_stack_size;
char dir[MAX_DIR_STACK][512];
struct {
char **elems;
size_t size;
struct string_list *list;
size_t ptr;
} current_dir;
char root_dir[PATH_MAX];
@ -54,6 +53,7 @@ typedef enum
const char * filebrowser_get_current_dir (filebrowser_t *filebrowser);
const char * filebrowser_get_current_path (filebrowser_t *filebrowser);
bool filebrowser_get_current_path_isdir (filebrowser_t *filebrowser);
size_t filebrowser_get_current_index (filebrowser_t *filebrowser);
void filebrowser_set_root(filebrowser_t *filebrowser, const char *root_dir);
void filebrowser_free(filebrowser_t *filebrowser);

View File

@ -54,7 +54,7 @@ VIDEO CONTEXT
#if defined(__CELLOS_LV2__)
#include "../../gfx/context/ps3_ctx.c"
#elif defined(_XBOX)
#elif defined(_XBOX360)
#include "../../gfx/context/xdk360_ctx.c"
#endif
@ -86,7 +86,7 @@ VIDEO DRIVER
#ifdef HAVE_OPENGL
#include "../../gfx/gl.c"
#elif defined(_XBOX)
#elif defined(_XBOX360)
#include "../../360/xdk360_video.cpp"
#elif defined(GEKKO)
#include "../../wii/video.c"
@ -100,8 +100,8 @@ FONTS
#if defined(__CELLOS_LV2__)
#include "../../gfx/fonts/ps3_libdbgfont.c"
#elif defined(_XBOX)
#include "../../360/fonts.cpp"
#elif defined(_XBOX360)
#include "../../gfx/fonts/xdk360_fonts.cpp"
#elif defined(GEKKO)
#include "../../gfx/fonts/fonts.c"
#endif
@ -111,7 +111,7 @@ INPUT
============================================================ */
#if defined(__CELLOS_LV2__)
#include "../../ps3/ps3_input.c"
#elif defined(_XBOX)
#elif defined(_XBOX360)
#include "../../360/xdk360_input.c"
#elif defined(GEKKO)
#include "../../wii/input.c"
@ -157,7 +157,7 @@ AUDIO
============================================================ */
#if defined(__CELLOS_LV2__)
#include "../../ps3/ps3_audio.c"
#elif defined(_XBOX)
#elif defined(_XBOX360)
#include "../../360/xdk360_audio.cpp"
#elif defined(GEKKO)
#include "../../wii/audio.c"
@ -202,10 +202,10 @@ REWIND
/*============================================================
MAIN
============================================================ */
#if defined(_XBOX)
#include "../../360/frontend/main.c"
#if defined(_XBOX360)
#include "../../360/frontend-xdk/main.c"
#elif defined(GEKKO)
#include "../../wii/main.c"
#include "../../wii/frontend/main.c"
#endif
/*============================================================
@ -230,8 +230,8 @@ NETPLAY
/*============================================================
MENU
============================================================ */
#if defined(_XBOX)
#include "../../360/frontend/menu.cpp"
#if defined(_XBOX360)
#include "../../360/frontend-xdk/menu.cpp"
#elif defined(GEKKO)
#include "../rgui/rgui.c"
#include "../rgui/list.c"

View File

@ -1,58 +0,0 @@
/* RetroArch - A frontend for libretro.
* Copyright (C) 2010-2012 - Hans-Kristian Arntzen
* Copyright (C) 2011-2012 - Daniel De Matteis
*
* RetroArch is free software: you can redistribute it and/or modify it under the terms
* of the GNU General Public License as published by the Free Software Found-
* ation, either version 3 of the License, or (at your option) any later version.
*
* RetroArch is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along with RetroArch.
* If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef _RARCH_FUNC_HOOKS_H
#define _RARCH_FUNC_HOOKS_H
/*============================================================
PLAYSTATION3
============================================================ */
#ifdef __CELLOS_LV2__
#define HAVE_GRIFFIN_OVERRIDE_AUDIO_FLUSH_FUNC 1
static bool audio_flush(const int16_t *data, size_t samples)
{
const float *output_data = NULL;
unsigned output_frames = 0;
audio_convert_s16_to_float(g_extern.audio_data.data, data, samples);
struct resampler_data src_data = {0};
src_data.data_in = g_extern.audio_data.data;
src_data.data_out = g_extern.audio_data.outsamples;
src_data.input_frames = (samples / 2);
src_data.ratio = g_extern.audio_data.src_ratio;
if (g_extern.is_slowmotion)
src_data.ratio *= g_settings.slowmotion_ratio;
resampler_process(g_extern.audio_data.source, &src_data);
output_data = g_extern.audio_data.outsamples;
output_frames = src_data.output_frames;
if (audio_write_func(output_data, output_frames * sizeof(float) * 2) < 0)
return false;
return true;
}
#endif
#endif

View File

@ -74,23 +74,23 @@ done:
return retstr;
}
const char *rarch_manage_libretro_set_first_file(const char *libretro_path, const char * exe_ext)
void rarch_manage_libretro_set_first_file(char *first_file, size_t size_of_first_file, const char *libretro_path, const char * exe_ext)
{
//We need to set libretro to the first entry in the cores
//directory so that it will be saved to the config file
char ** dir_list = dir_list_new(libretro_path, exe_ext, false);
struct string_list *dir_list = dir_list_new(libretro_path, exe_ext, false);
const char * retstr = NULL;
const char * first_exe;
if (!dir_list)
{
RARCH_ERR("Couldn't read directory.\n");
goto error;
RARCH_ERR("Failed to set first entry to libretro path.\n");
goto end;
}
first_exe = dir_list[0];
first_exe = dir_list->elems[0].data;
if(first_exe)
{
@ -101,28 +101,24 @@ const char *rarch_manage_libretro_set_first_file(const char *libretro_path, cons
if(strcmp(fname_tmp, "RetroArch-Salamander.xex") == 0)
{
RARCH_WARN("First entry is RetroArch Salamander itself, increment entry by one and check if it exists.\n");
first_exe = dir_list[1];
first_exe = dir_list->elems[1].data;
fill_pathname_base(fname_tmp, first_exe, sizeof(fname_tmp));
if(!first_exe)
{
RARCH_ERR("Unlikely error happened - no second entry - no choice but to set it to RetroArch Salamander\n");
first_exe = dir_list[0];
first_exe = dir_list->elems[0].data;
fill_pathname_base(fname_tmp, first_exe, sizeof(fname_tmp));
}
}
retstr = fname_tmp;
strlcpy(first_file, fname_tmp, size_of_first_file);
#else
retstr = first_exe;
strlcpy(first_file, first_exe, size_of_first_file);
#endif
RARCH_LOG("Set first entry in libretro core dir to libretro path: [%s].\n", retstr);
goto end;
RARCH_LOG("Set first entry in libretro core dir to libretro path: [%s].\n", first_file);
}
error:
RARCH_ERR("Failed to set first entry to libretro path.\n");
end:
dir_list_free(dir_list);
return retstr;
}

View File

@ -28,6 +28,6 @@ enum
};
const char *rarch_manage_libretro_install(const char *full_path, const char *path, const char *exe_ext);
const char *rarch_manage_libretro_set_first_file(const char *libretro_path, const char * exe_ext);
void rarch_manage_libretro_set_first_file(char *first_file, size_t size_of_first_file, const char *libretro_path, const char * exe_ext);
#endif

View File

@ -21,7 +21,7 @@
#include "console/logger/logger.h"
#define RARCH_LOG(...) do { \
if (g_extern.verbose) logger_send("SSNES: " __VA_ARGS__); \
if (g_extern.verbose) logger_send("RetroArch: " __VA_ARGS__); \
} while(0)
#define RARCH_ERR(...) do { \
@ -36,7 +36,7 @@ extern FILE * log_fp;
#ifndef RARCH_LOG
#define RARCH_LOG(...) do { \
if (g_extern.verbose) \
fprintf(log_fp, "SSNES: " __VA_ARGS__); \
fprintf(log_fp, "RetroArch: " __VA_ARGS__); \
fflush(log_fp); \
} while (0)
#endif

View File

@ -70,7 +70,6 @@
#if defined(__CELLOS_LV2__)
static uint8_t np_pool[NP_POOL_SIZE];
char contentInfoPath[PATH_MAX];
char usrDirPath[PATH_MAX];
SYS_PROCESS_PARAM(1001, 0x100000)
#elif defined(_XBOX)
@ -81,59 +80,73 @@ char LIBRETRO_DIR_PATH[PATH_MAX];
char SYS_CONFIG_FILE[PATH_MAX];
char libretro_path[PATH_MAX];
static void rarch_manage_libretro_set_first_file(char *first_file, size_t size_of_first_file, const char *libretro_path, const char * exe_ext)
{
//We need to set libretro to the first entry in the cores
//directory so that it will be saved to the config file
struct string_list *dir_list = dir_list_new(libretro_path, exe_ext, false);
const char * first_exe;
if (!dir_list)
{
RARCH_ERR("Couldn't read directory.\n");
RARCH_ERR("Failed to set first entry to libretro path.\n");
goto end;
}
first_exe = dir_list->elems[0].data;
if(first_exe)
{
#ifdef _XBOX
char fname_tmp[PATH_MAX];
fill_pathname_base(fname_tmp, first_exe, sizeof(fname_tmp));
if(strcmp(fname_tmp, "RetroArch-Salamander.xex") == 0)
{
RARCH_WARN("First entry is RetroArch Salamander itself, increment entry by one and check if it exists.\n");
first_exe = dir_list->elems[1].data;
fill_pathname_base(fname_tmp, first_exe, sizeof(fname_tmp));
if(!first_exe)
{
RARCH_ERR("Unlikely error happened - no second entry - no choice but to set it to RetroArch Salamander\n");
first_exe = dir_list->elems[0].data;
fill_pathname_base(fname_tmp, first_exe, sizeof(fname_tmp));
}
}
strlcpy(first_file, fname_tmp, size_of_first_file);
#else
strlcpy(first_file, first_exe, size_of_first_file);
#endif
RARCH_LOG("Set first entry in libretro core dir to libretro path: [%s].\n", first_file);
}
end:
dir_list_free(dir_list);
}
static void find_and_set_first_file(void)
{
//Last fallback - we'll need to start the first executable file
// we can find in the RetroArch cores directory
char first_file[PATH_MAX];
rarch_manage_libretro_set_first_file(first_file, sizeof(first_file),
#if defined(_XBOX)
char ** dir_list = dir_list_new("game:\\", "xex", false);
"game:\\", "xex"
#elif defined(__CELLOS_LV2__)
char ** dir_list = dir_list_new(LIBRETRO_DIR_PATH, "SELF", false);
LIBRETRO_DIR_PATH, "SELF"
#endif
);
if (!dir_list)
{
RARCH_ERR("Failed last fallback - RetroArch Salamander will exit.\n");
return;
}
char * first_executable = dir_list[0];
if(first_executable)
{
#ifdef _XBOX
//Check if it's RetroArch Salamander itself - if so, first_executable needs to
//be overridden
char fname_tmp[PATH_MAX];
fill_pathname_base(fname_tmp, first_executable, sizeof(fname_tmp));
if(strcmp(fname_tmp, "RetroArch-Salamander.xex") == 0)
{
RARCH_WARN("First entry is RetroArch Salamander itself, increment entry by one and check if it exists.\n");
first_executable = dir_list[1];
fill_pathname_base(fname_tmp, first_executable, sizeof(fname_tmp));
if(!first_executable)
{
RARCH_WARN("There is no second entry - no choice but to boot RetroArch Salamander\n");
first_executable = dir_list[0];
fill_pathname_base(fname_tmp, first_executable, sizeof(fname_tmp));
}
}
snprintf(first_executable, sizeof(first_executable), "game:\\%s", fname_tmp);
#endif
RARCH_LOG("Start first entry in libretro cores dir: [%s].\n", first_executable);
strlcpy(libretro_path, first_executable, sizeof(libretro_path));
}
if(first_file)
strlcpy(libretro_path, first_file, sizeof(libretro_path));
else
{
RARCH_ERR("Failed last fallback - RetroArch Salamander will exit.\n");
}
dir_list_free(dir_list);
}
static void init_settings(void)
@ -238,6 +251,7 @@ static void get_environment_settings (void)
unsigned int get_attributes;
CellGameContentSize size;
char dirName[CELL_GAME_DIRNAME_SIZE];
char contentInfoPath[PATH_MAX];
memset(&size, 0x00, sizeof(CellGameContentSize));

View File

@ -69,7 +69,7 @@ static const audio_driver_t *audio_drivers[] = {
#ifdef XENON
&audio_xenon360,
#endif
#ifdef _XBOX
#ifdef _XBOX360
&audio_xdk360,
#endif
#ifdef GEKKO
@ -85,7 +85,7 @@ static const video_driver_t *video_drivers[] = {
#ifdef XENON
&video_xenon360,
#endif
#ifdef _XBOX
#ifdef _XBOX360
&video_xdk360,
#endif
#ifdef HAVE_SDL
@ -119,7 +119,7 @@ static const input_driver_t *input_drivers[] = {
#ifdef XENON
&input_xenon360,
#endif
#ifdef _XBOX
#ifdef _XBOX360
&input_xdk360,
#endif
#ifdef GEKKO
@ -484,28 +484,31 @@ static void deinit_filter(void)
#endif
#ifdef HAVE_XML
static void deinit_shader_dir(void)
{
// It handles NULL, no worries :D
dir_list_free(g_extern.shader_dir.list);
g_extern.shader_dir.list = NULL;
g_extern.shader_dir.ptr = 0;
}
static void init_shader_dir(void)
{
if (!*g_settings.video.shader_dir)
return;
g_extern.shader_dir.elems = dir_list_new(g_settings.video.shader_dir, "shader", false);
g_extern.shader_dir.size = dir_list_size(g_extern.shader_dir.elems);
g_extern.shader_dir.ptr = 0;
g_extern.shader_dir.list = dir_list_new(g_settings.video.shader_dir, "shader", false);
if (g_extern.shader_dir.list->size == 0)
{
deinit_shader_dir();
return;
}
dir_list_sort(g_extern.shader_dir.elems, false);
g_extern.shader_dir.ptr = 0;
dir_list_sort(g_extern.shader_dir.list, false);
for (unsigned i = 0; i < g_extern.shader_dir.size; i++)
RARCH_LOG("Found shader \"%s\"\n", g_extern.shader_dir.elems[i]);
}
static void deinit_shader_dir(void)
{
// It handles NULL, no worries :D
dir_list_free(g_extern.shader_dir.elems);
g_extern.shader_dir.elems = NULL;
g_extern.shader_dir.size = 0;
g_extern.shader_dir.ptr = 0;
for (unsigned i = 0; i < g_extern.shader_dir.list->size; i++)
RARCH_LOG("Found shader \"%s\"\n", g_extern.shader_dir.list->elems[i].data);
}
#endif

View File

@ -16,6 +16,7 @@
#include "dynamic.h"
#include "general.h"
#include "compat/strl.h"
#include "compat/posix_string.h"
#include <string.h>
#ifdef RARCH_CONSOLE
@ -367,8 +368,11 @@ static void set_environment(void)
// Assume SNES as defaults.
static void set_environment_defaults(void)
{
char *save;
// Split up environment variables beforehand.
if (g_extern.system.environment_split && strtok(g_extern.system.environment_split, ";"))
while (strtok(NULL, ";"));
if (g_extern.system.environment_split &&
strtok_r(g_extern.system.environment_split, ";", &save))
while (strtok_r(NULL, ";", &save));
}

31
file.h
View File

@ -36,13 +36,30 @@ void save_ram_file(const char *path, int type);
bool init_rom_file(enum rarch_game_type type);
// Returns a NULL-terminated list of files in a directory with full paths.
// If ext is NULL, any file will be picked.
// If non-NULL, only files with extension ext are added.
char **dir_list_new(const char *dir, const char *ext, bool include_dirs);
size_t dir_list_size(char * const *dir_list);
void dir_list_sort(char **dir_list, bool dir_first);
void dir_list_free(char **dir_list);
// Yep, this is C alright ;)
union string_list_elem_attr
{
bool b;
int i;
void *p;
};
struct string_list_elem
{
char *data;
union string_list_elem_attr attr;
};
struct string_list
{
struct string_list_elem *elems;
size_t size;
size_t cap;
};
struct string_list *dir_list_new(const char *dir, const char *ext, bool include_dirs);
void dir_list_sort(struct string_list *list, bool dir_first);
void dir_list_free(struct string_list *list);
bool path_is_directory(const char *path);
bool path_file_exists(const char *path);

View File

@ -23,9 +23,14 @@
#include "compat/posix_string.h"
#ifdef __CELLOS_LV2__
#include <unistd.h> //stat() is defined here
#define S_ISDIR(x) (x & CELL_FS_S_IFDIR)
#endif
#ifdef _XBOX
#include <xtl.h>
#endif
#if defined(_WIN32) && !defined(_XBOX)
#include <io.h>
#include <fcntl.h>
@ -34,7 +39,6 @@
#define setmode _setmode
#endif
#elif defined(_XBOX)
#include <xtl.h>
#define setmode _setmode
#define INVALID_FILE_ATTRIBUTES -1
#else
@ -43,111 +47,107 @@
#include <dirent.h>
#endif
// Yep, this is C alright ;)
struct string_list
static void string_list_free(struct string_list *list)
{
char **data;
size_t size;
size_t cap;
};
if (!list)
return;
for (size_t i = 0; i < list->size; i++)
free(list->elems[i].data);
free(list->elems);
free(list);
}
static bool string_list_capacity(struct string_list *list, size_t cap)
{
rarch_assert(cap > list->size);
char **new_data = (char**)realloc(list->data, cap * sizeof(char*));
struct string_list_elem *new_data = (struct string_list_elem*)realloc(list->elems, cap * sizeof(*new_data));
if (!new_data)
return false;
list->data = new_data;
list->cap = cap;
list->elems = new_data;
list->cap = cap;
return true;
}
static bool string_list_init(struct string_list *list)
static struct string_list *string_list_new(void)
{
memset(list, 0, sizeof(*list));
return string_list_capacity(list, 32);
struct string_list *list = (struct string_list*)calloc(1, sizeof(*list));
if (!list)
return NULL;
if (!string_list_capacity(list, 32))
{
string_list_free(list);
return NULL;
}
return list;
}
static bool string_list_append(struct string_list *list, const char *elem)
static bool string_list_append(struct string_list *list, const char *elem, union string_list_elem_attr attr)
{
if (list->size + 1 >= list->cap && !string_list_capacity(list, list->cap * 2))
if (list->size >= list->cap &&
!string_list_capacity(list, list->cap * 2))
return false;
if (!(list->data[list->size] = strdup(elem)))
char *dup = strdup(elem);
if (!dup)
return false;
list->elems[list->size].data = dup;
list->elems[list->size].attr = attr;
list->size++;
return true;
}
static char **string_list_finalize(struct string_list *list)
{
rarch_assert(list->cap > list->size);
list->data[list->size] = NULL;
return list->data;
}
static void string_list_cleanup(struct string_list *list)
{
for (size_t i = 0; i < list->size; i++)
free(list->data[i]);
free(list->data);
memset(list, 0, sizeof(*list));
}
static void string_list_free(char **list)
{
if (!list)
return;
char **orig = list;
while (*list)
free(*list++);
free(orig);
}
static char **string_split(const char *str, const char *delim)
static struct string_list *string_split(const char *str, const char *delim)
{
char *copy = NULL;
const char *tmp = NULL;
struct string_list list;
if (!string_list_init(&list))
struct string_list *list = string_list_new();
if (!list)
goto error;
copy = strdup(str);
if (!copy)
return NULL;
goto error;
tmp = strtok(copy, delim);
char *save;
tmp = strtok_r(copy, delim, &save);
while (tmp)
{
if (!string_list_append(&list, tmp))
union string_list_elem_attr attr;
memset(&attr, 0, sizeof(attr));
if (!string_list_append(list, tmp, attr))
goto error;
tmp = strtok(NULL, delim);
tmp = strtok_r(NULL, delim, &save);
}
free(copy);
return string_list_finalize(&list);
return list;
error:
string_list_cleanup(&list);
string_list_free(list);
free(copy);
return NULL;
}
static bool string_list_find_elem(char * const *list, const char *elem)
static bool string_list_find_elem(const struct string_list *list, const char *elem)
{
if (!list)
return false;
for (; *list; list++)
if (strcmp(*list, elem) == 0)
for (size_t i = 0; i < list->size; i++)
{
if (strcmp(list->elems[i].data, elem) == 0)
return true;
}
return false;
}
@ -161,50 +161,42 @@ static const char *path_get_extension(const char *path)
return "";
}
size_t dir_list_size(char * const *dir_list)
static int qstrcmp_plain(const void *a_, const void *b_)
{
if (!dir_list)
return 0;
const struct string_list_elem *a = (const struct string_list_elem*)a_;
const struct string_list_elem *b = (const struct string_list_elem*)b_;
size_t size = 0;
while (*dir_list++)
size++;
return size;
}
static int qstrcmp_plain(const void *a, const void *b)
{
return strcasecmp(*(const char * const*)a, *(const char * const*)b);
return strcasecmp(a->data, b->data);
}
static int qstrcmp_dir(const void *a_, const void *b_)
{
const char *a = *(const char * const*)a_;
const char *b = *(const char * const*)b_;
const struct string_list_elem *a = (const struct string_list_elem*)a_;
const struct string_list_elem *b = (const struct string_list_elem*)b_;
// Sort directories before files.
int a_dir = path_is_directory(a);
int b_dir = path_is_directory(b);
int a_dir = a->attr.b;
int b_dir = b->attr.b;
if (a_dir != b_dir)
return b_dir - a_dir;
return strcasecmp(a, b);
else
return strcasecmp(a->data, b->data);
}
void dir_list_sort(char **dir_list, bool dir_first)
void dir_list_sort(struct string_list *list, bool dir_first)
{
if (!dir_list)
if (!list)
return;
qsort(dir_list, dir_list_size(dir_list), sizeof(char*), dir_first ? qstrcmp_dir : qstrcmp_plain);
qsort(list->elems, list->size, sizeof(struct string_list_elem),
dir_first ? qstrcmp_dir : qstrcmp_plain);
}
#ifdef _WIN32 // Because the API is just fucked up ...
char **dir_list_new(const char *dir, const char *ext, bool include_dirs)
struct string_list *dir_list_new(const char *dir, const char *ext, bool include_dirs)
{
struct string_list list;
if (!string_list_init(&list))
struct string_list *list = string_list_new();
if (!list)
return NULL;
HANDLE hFind = INVALID_HANDLE_VALUE;
@ -213,7 +205,7 @@ char **dir_list_new(const char *dir, const char *ext, bool include_dirs)
char path_buf[PATH_MAX];
snprintf(path_buf, sizeof(path_buf), "%s\\*", dir);
char **ext_list = NULL;
struct string_list *ext_list = NULL;
if (ext)
ext_list = string_split(ext, "|");
@ -236,35 +228,38 @@ char **dir_list_new(const char *dir, const char *ext, bool include_dirs)
char file_path[PATH_MAX];
snprintf(file_path, sizeof(file_path), "%s\\%s", dir, name);
if (!string_list_append(&list, file_path))
union string_list_elem_attr attr;
attr.b = is_dir;
if (!string_list_append(list, file_path, attr))
goto error;
}
while (FindNextFile(hFind, &ffd) != 0);
FindClose(hFind);
string_list_free(ext_list);
return string_list_finalize(&list);
return list;
error:
RARCH_ERR("Failed to open directory: \"%s\"\n", dir);
if (hFind != INVALID_HANDLE_VALUE)
FindClose(hFind);
string_list_cleanup(&list);
string_list_free(list);
string_list_free(ext_list);
return NULL;
}
#else
char **dir_list_new(const char *dir, const char *ext, bool include_dirs)
struct string_list *dir_list_new(const char *dir, const char *ext, bool include_dirs)
{
struct string_list list;
if (!string_list_init(&list))
struct string_list *list = string_list_new();
if (!list)
return NULL;
DIR *directory = NULL;
const struct dirent *entry = NULL;
char **ext_list = NULL;
struct string_list *ext_list = NULL;
if (ext)
ext_list = string_split(ext, "|");
@ -287,14 +282,17 @@ char **dir_list_new(const char *dir, const char *ext, bool include_dirs)
char file_path[PATH_MAX];
snprintf(file_path, sizeof(file_path), "%s/%s", dir, name);
if (!string_list_append(&list, file_path))
union string_list_elem_attr attr;
attr.b = is_dir;
if (!string_list_append(list, file_path, attr))
goto error;
}
closedir(directory);
string_list_free(ext_list);
return string_list_finalize(&list);
return list;
error:
RARCH_ERR("Failed to open directory: \"%s\"\n", dir);
@ -302,15 +300,15 @@ error:
if (directory)
closedir(directory);
string_list_cleanup(&list);
string_list_free(list);
string_list_free(ext_list);
return NULL;
}
#endif
void dir_list_free(char **dir_list)
void dir_list_free(struct string_list *list)
{
string_list_free(dir_list);
string_list_free(list);
}
bool path_is_directory(const char *path)

View File

@ -42,7 +42,7 @@
#include <time/time.h>
#endif
#if defined(XENON) || defined(__CELLOS_LV2__)
#if defined(XENON) || defined(__CELLOS_LV2__) || defined(_XBOX1)
#undef PATH_MAX
#define PATH_MAX 4096
#endif
@ -245,7 +245,7 @@ struct console_settings
#ifdef RARCH_CONSOLE
uint32_t input_loop;
#endif
#ifdef _XBOX
#ifdef _XBOX360
uint32_t color_format;
DWORD volume_device_type;
#endif
@ -449,8 +449,7 @@ struct global
struct
{
char **elems;
size_t size;
struct string_list *list;
size_t ptr;
} shader_dir;
@ -502,8 +501,8 @@ extern struct console_settings g_console;
#endif
/////////
#if defined(RARCH_CONSOLE) && (defined(HAVE_LOGGER) || defined(HAVE_FILE_LOGGER))
#include "logger_override.h"
#if defined(RARCH_CONSOLE) && (defined(HAVE_LOGGER) || defined(HAVE_FILE_LOGGER) || defined(_XBOX1))
#include <logger_override.h>
#else
#ifndef RARCH_LOG

View File

@ -177,6 +177,9 @@ static void video_ext_set_nonblock_state(void *data, bool state)
static bool video_ext_frame(void *data, const void *frame, unsigned width, unsigned height, unsigned pitch, const char *msg)
{
if (!frame)
return true;
ext_t *ext = (ext_t*)data;
return ext->driver->frame(ext->handle, frame, width, height, pitch, msg);
}

View File

@ -16,12 +16,11 @@
#define NONET
#include <xtl.h>
#include "xdk360_video.h"
#include "fonts.h"
#include "../general.h"
#include "xdk360_fonts.h"
#include "../../general.h"
static video_console_t video_console;
static xdk360_video_font_t m_Font;
video_console_t video_console;
xdk360_video_font_t m_Font;
static PackedResource m_xprResource;
@ -38,9 +37,6 @@ typedef struct {
wchar_t m_TranslatorTable[1]; // ASCII to Glyph lookup table, NOTE: It's m_cMaxGlyph+1 in size.
} FontFileHeaderImage_t;
// Font strike array. Immediately follows the FontFileHeaderImage_t
// structure image
typedef struct {
unsigned long m_dwNumGlyphs; // Size of font strike array (First entry is the unknown glyph)
GLYPH_ATTR m_Glyphs[1]; // Array of font strike uv's etc... NOTE: It's m_dwNumGlyphs in size
@ -78,229 +74,15 @@ static const char g_strFontShader[] =
"}\n";
typedef struct {
D3DVertexDeclaration* m_pFontVertexDecl; // Shared vertex buffer
D3DVertexShader* m_pFontVertexShader; // Created vertex shader
D3DPixelShader* m_pFontPixelShader; // Created pixel shader
D3DVertexDeclaration* m_pFontVertexDecl;
D3DVertexShader* m_pFontVertexShader;
D3DPixelShader* m_pFontPixelShader;
} Font_Locals_t;
// All elements are defaulted to NULL
static Font_Locals_t s_FontLocals; // Global static instance
static void xdk360_video_font_draw_text(xdk360_video_font_t * font,
float fOriginX, float fOriginY, unsigned long dwColor,
const wchar_t * strText, float fMaxPixelWidth )
{
if( strText == NULL || strText[0] == L'\0')
return;
xdk360_video_t *vid = (xdk360_video_t*)driver.video_data;
D3DDevice *pd3dDevice = vid->d3d_render_device;
// Set the color as a vertex shader constant
float vColor[4];
vColor[0] = ( ( dwColor & 0x00ff0000 ) >> 16L ) / 255.0F;
vColor[1] = ( ( dwColor & 0x0000ff00 ) >> 8L ) / 255.0F;
vColor[2] = ( ( dwColor & 0x000000ff ) >> 0L ) / 255.0F;
vColor[3] = ( ( dwColor & 0xff000000 ) >> 24L ) / 255.0F;
// Set up stuff to prepare for drawing text
xdk360_video_font_begin(font);
// Perform the actual storing of the color constant here to prevent
// a load-hit-store by inserting work between the store and the use of
// the vColor array.
pd3dDevice->SetVertexShaderConstantF( 1, vColor, 1 );
// Set the starting screen position
if((fOriginX < 0.0f))
fOriginX += font->m_rcWindow.x2;
if( fOriginY < 0.0f )
fOriginY += font->m_rcWindow.y2;
font->m_fCursorX = floorf( fOriginX );
font->m_fCursorY = floorf( fOriginY );
// Adjust for padding
fOriginY -= font->m_fFontTopPadding;
// Add window offsets
float Winx = 0.0f;
float Winy = 0.0f;
fOriginX += Winx;
fOriginY += Winy;
font->m_fCursorX += Winx;
font->m_fCursorY += Winy;
// Begin drawing the vertices
// Declared as volatile to force writing in ascending
// address order. It prevents out of sequence writing in write combined
// memory.
volatile float * pVertex;
unsigned long dwNumChars = wcslen(strText);
HRESULT hr = pd3dDevice->BeginVertices( D3DPT_QUADLIST, 4 * dwNumChars, sizeof( XMFLOAT4 ) ,
( VOID** )&pVertex );
// The ring buffer may run out of space when tiling, doing z-prepasses,
// or using BeginCommandBuffer. If so, make the buffer larger.
if( hr < 0 )
RARCH_ERR( "Ring buffer out of memory.\n" );
// Draw four vertices for each glyph
while( *strText )
{
wchar_t letter;
// Get the current letter in the string
letter = *strText++;
// Handle the newline character
if( letter == L'\n' )
{
font->m_fCursorX = fOriginX;
font->m_fCursorY += font->m_fFontYAdvance * font->m_fYScaleFactor;
continue;
}
// Translate unprintable characters
const GLYPH_ATTR * pGlyph = &font->m_Glyphs[ ( letter <= font->m_cMaxGlyph )
? font->m_TranslatorTable[letter] : 0 ];
float fOffset = font->m_fXScaleFactor * (float)pGlyph->wOffset;
float fAdvance = font->m_fXScaleFactor * (float)pGlyph->wAdvance;
float fWidth = font->m_fXScaleFactor * (float)pGlyph->wWidth;
float fHeight = font->m_fYScaleFactor * font->m_fFontHeight;
// Setup the screen coordinates
font->m_fCursorX += fOffset;
float X4 = font->m_fCursorX;
float X1 = X4;
float X3 = X4 + fWidth;
float X2 = X1 + fWidth;
float Y1 = font->m_fCursorY;
float Y3 = Y1 + fHeight;
float Y2 = Y1;
float Y4 = Y3;
font->m_fCursorX += fAdvance;
// Select the RGBA channel that the compressed glyph is stored in
// Takes a 4 bit per pixel ARGB value and expand it to an 8 bit per pixel ARGB value
unsigned long dwChannelSelector = pGlyph->wMask; // Convert to 32 bit
// Perform the conversion without branching
// Splat the 4 bit per pixels from 0x1234 to 0x01020304
dwChannelSelector = ((dwChannelSelector&0xF000)<<(24-12))|((dwChannelSelector&0xF00)<<(16-8))|
((dwChannelSelector&0xF0)<<(8-4))|(dwChannelSelector&0xF);
// Perform a vectorized multiply to make 0x01020304 into 0x11223344
dwChannelSelector *= 0x11;
// Add the vertices to draw this glyph
unsigned long tu1 = pGlyph->tu1; // Convert shorts to 32 bit longs for in register merging
unsigned long tv1 = pGlyph->tv1;
unsigned long tu2 = pGlyph->tu2;
unsigned long tv2 = pGlyph->tv2;
// NOTE: The vertexs are 2 floats for the screen coordinates,
// followed by two USHORTS for the u/vs of the character,
// terminated with the ARGB 32 bit color.
// This makes for 16 bytes per vertex data (Easier to read)
// Second NOTE: The uvs are merged and written using a DWORD due
// to the write combining hardware being only able to handle 32,
// 64 and 128 writes. Never store to write combined memory with
// 8 or 16 bit instructions. You've been warned.
pVertex[0] = X1;
pVertex[1] = Y1;
reinterpret_cast<volatile unsigned long *>(pVertex)[2] = (tu1<<16)|tv1; // Merged using big endian rules
reinterpret_cast<volatile unsigned long *>(pVertex)[3] = dwChannelSelector;
pVertex[4] = X2;
pVertex[5] = Y2;
reinterpret_cast<volatile unsigned long *>(pVertex)[6] = (tu2<<16)|tv1; // Merged using big endian rules
reinterpret_cast<volatile unsigned long *>(pVertex)[7] = dwChannelSelector;
pVertex[8] = X3;
pVertex[9] = Y3;
reinterpret_cast<volatile unsigned long *>(pVertex)[10] = (tu2<<16)|tv2; // Merged using big endian rules
reinterpret_cast<volatile unsigned long *>(pVertex)[11] = dwChannelSelector;
pVertex[12] = X4;
pVertex[13] = Y4;
reinterpret_cast<volatile unsigned long *>(pVertex)[14] = (tu1<<16)|tv2; // Merged using big endian rules
reinterpret_cast<volatile unsigned long *>(pVertex)[15] = dwChannelSelector;
pVertex+=16;
dwNumChars--;
}
// Since we allocated vertex data space based on the string length, we now need to
// add some dummy verts for any skipped characters (like newlines, etc.)
while( dwNumChars )
{
pVertex[0] = 0;
pVertex[1] = 0;
pVertex[2] = 0;
pVertex[3] = 0;
pVertex[4] = 0;
pVertex[5] = 0;
pVertex[6] = 0;
pVertex[7] = 0;
pVertex[8] = 0;
pVertex[9] = 0;
pVertex[10] = 0;
pVertex[11] = 0;
pVertex[12] = 0;
pVertex[13] = 0;
pVertex[14] = 0;
pVertex[15] = 0;
pVertex+=16;
dwNumChars--;
}
// Stop drawing vertices
D3DDevice_EndVertices(pd3dDevice);
// Undo window offsets
font->m_fCursorX -= Winx;
font->m_fCursorY -= Winy;
// Call End() to complete the begin/end pair for drawing text
xdk360_video_font_end(font);
}
void xdk360_console_draw(void)
{
xdk360_video_t *vid = (xdk360_video_t*)driver.video_data;
D3DDevice *m_pd3dDevice = vid->d3d_render_device;
// The top line
unsigned int nTextLine = ( video_console.m_nCurLine -
video_console.m_cScreenHeight + video_console.m_cScreenHeightVirtual -
video_console.m_nScrollOffset + 1 )
% video_console.m_cScreenHeightVirtual;
xdk360_video_font_begin(&m_Font);
for( unsigned int nScreenLine = 0; nScreenLine < video_console.m_cScreenHeight; nScreenLine++ )
{
xdk360_video_font_draw_text(&m_Font, (float)( video_console.m_cxSafeAreaOffset ),
(float)( video_console.m_cySafeAreaOffset +
video_console.m_fLineHeight * nScreenLine ),
video_console.m_colTextColor,
video_console.m_Lines[nTextLine], 0.0f );
nTextLine = ( nTextLine + 1 ) % video_console.m_cScreenHeightVirtual;
}
xdk360_video_font_end(&m_Font);
}
static Font_Locals_t s_FontLocals;
static void xdk360_video_font_get_text_width(xdk360_video_font_t * font, const wchar_t * strText, float * pWidth, float * pHeight)
{
// Set default text extent in output parameters
int iWidth = 0;
float fHeight = 0.0f;
@ -322,11 +104,6 @@ static void xdk360_video_font_get_text_width(xdk360_video_font_t * font, const w
if (letter == L'\n')
break;
// Handle carriage return characters by ignoring them. This helps when
// displaying text from a file.
if( letter == L'\r' )
continue;
// Translate unprintable characters
const GLYPH_ATTR* pGlyph;
@ -453,26 +230,26 @@ static HRESULT xdk360_video_font_init(xdk360_video_font_t * font, const char * s
font->m_pFontTexture = pFontTexture;
// Check version of file (to make sure it matches up with the FontMaker tool)
const unsigned char * pData = static_cast<const unsigned char *>(pFontData);
unsigned long dwFileVersion = reinterpret_cast<const FontFileHeaderImage_t *>(pData)->m_dwFileVersion;
const unsigned char * pData = (const unsigned char*)pFontData;
unsigned long dwFileVersion = ((const FontFileHeaderImage_t *)pData)->m_dwFileVersion;
if( dwFileVersion == FONTFILEVERSION )
{
font->m_fFontHeight = reinterpret_cast<const FontFileHeaderImage_t *>(pData)->m_fFontHeight;
font->m_fFontTopPadding = reinterpret_cast<const FontFileHeaderImage_t *>(pData)->m_fFontTopPadding;
font->m_fFontBottomPadding = reinterpret_cast<const FontFileHeaderImage_t *>(pData)->m_fFontBottomPadding;
font->m_fFontYAdvance = reinterpret_cast<const FontFileHeaderImage_t *>(pData)->m_fFontYAdvance;
font->m_fFontHeight = ((const FontFileHeaderImage_t *)pData)->m_fFontHeight;
font->m_fFontTopPadding = ((const FontFileHeaderImage_t *)pData)->m_fFontTopPadding;
font->m_fFontBottomPadding = ((const FontFileHeaderImage_t *)pData)->m_fFontBottomPadding;
font->m_fFontYAdvance = ((const FontFileHeaderImage_t *)pData)->m_fFontYAdvance;
// Point to the translator string which immediately follows the 4 floats
font->m_cMaxGlyph = reinterpret_cast<const FontFileHeaderImage_t *>(pData)->m_cMaxGlyph;
font->m_cMaxGlyph = ((const FontFileHeaderImage_t *)pData)->m_cMaxGlyph;
font->m_TranslatorTable = const_cast<FontFileHeaderImage_t*>(reinterpret_cast<const FontFileHeaderImage_t *>(pData))->m_TranslatorTable;
font->m_TranslatorTable = const_cast<FontFileHeaderImage_t*>((const FontFileHeaderImage_t *)pData)->m_TranslatorTable;
pData += CALCFONTFILEHEADERSIZE( font->m_cMaxGlyph + 1 );
// Read the glyph attributes from the file
font->m_dwNumGlyphs = reinterpret_cast<const FontFileStrikesImage_t *>(pData)->m_dwNumGlyphs;
font->m_Glyphs = reinterpret_cast<const FontFileStrikesImage_t *>(pData)->m_Glyphs; // Pointer
font->m_dwNumGlyphs = ((const FontFileStrikesImage_t *)pData)->m_dwNumGlyphs;
font->m_Glyphs = ((const FontFileStrikesImage_t *)pData)->m_Glyphs; // Pointer
}
else
{
@ -504,13 +281,11 @@ static HRESULT xdk360_video_font_init(xdk360_video_font_t * font, const char * s
return 0;
}
HRESULT xdk360_console_init( LPCSTR strFontFileName, unsigned long colBackColor,
unsigned long colTextColor)
HRESULT d3d9_init_font(const char *font_path)
{
xdk360_video_t *vid = (xdk360_video_t*)driver.video_data;
D3DDevice *m_pd3dDevice = vid->d3d_render_device;
video_console.first_message = true;
video_console.m_Buffer = NULL;
video_console.m_Lines = NULL;
video_console.m_nScrollOffset = 0;
@ -526,17 +301,13 @@ HRESULT xdk360_console_init( LPCSTR strFontFileName, unsigned long colBackColor,
video_console.m_cySafeAreaOffset = ( vid->d3dpp.BackBufferHeight - video_console.m_cySafeArea ) / 2;
// Create the font
HRESULT hr = xdk360_video_font_init(&m_Font, strFontFileName );
HRESULT hr = xdk360_video_font_init(&m_Font, font_path);
if (hr < 0)
{
RARCH_ERR( "Could not create font.\n" );
return -1;
}
// Save the colors
video_console.m_colBackColor = colBackColor;
video_console.m_colTextColor = colTextColor;
// Calculate the number of lines on the screen
float fCharWidth, fCharHeight;
xdk360_video_font_get_text_width(&m_Font, L"i", &fCharWidth, &fCharHeight);
@ -564,32 +335,10 @@ HRESULT xdk360_console_init( LPCSTR strFontFileName, unsigned long colBackColor,
return hr;
}
static void xdk360_video_font_deinit(xdk360_video_font_t * font)
void d3d9_deinit_font(void)
{
font->m_pFontTexture = NULL;
font->m_dwNumGlyphs = 0L;
font->m_Glyphs = NULL;
font->m_cMaxGlyph = 0;
font->m_TranslatorTable = NULL;
font->m_dwNestedBeginCount = 0L;
xdk360_video_font_t *font = &m_Font;
// Safely release shaders
// NOTE: They are released in reverse order of creation
// to make sure any interdependencies are dealt with
if( ( s_FontLocals.m_pFontPixelShader != NULL ) && ( s_FontLocals.m_pFontPixelShader->Release() == 0 ) )
s_FontLocals.m_pFontPixelShader = NULL;
if( ( s_FontLocals.m_pFontVertexShader != NULL ) && ( s_FontLocals.m_pFontVertexShader->Release() == 0 ) )
s_FontLocals.m_pFontVertexShader = NULL;
if( ( s_FontLocals.m_pFontVertexDecl != NULL ) && ( s_FontLocals.m_pFontVertexDecl->Release() == 0 ) )
s_FontLocals.m_pFontVertexDecl = NULL;
if( m_xprResource.m_bInitialized)
m_xprResource.Destroy();
}
void xdk360_console_deinit()
{
// Delete the memory we've allocated
if(video_console.m_Lines)
{
@ -604,59 +353,24 @@ void xdk360_console_deinit()
}
// Destroy the font
xdk360_video_font_deinit(&m_Font);
font->m_pFontTexture = NULL;
font->m_dwNumGlyphs = 0L;
font->m_Glyphs = NULL;
font->m_cMaxGlyph = 0;
font->m_TranslatorTable = NULL;
font->m_dwNestedBeginCount = 0L;
if( ( s_FontLocals.m_pFontPixelShader != NULL ) && ( s_FontLocals.m_pFontPixelShader->Release() == 0 ) )
s_FontLocals.m_pFontPixelShader = NULL;
if( ( s_FontLocals.m_pFontVertexShader != NULL ) && ( s_FontLocals.m_pFontVertexShader->Release() == 0 ) )
s_FontLocals.m_pFontVertexShader = NULL;
if( ( s_FontLocals.m_pFontVertexDecl != NULL ) && ( s_FontLocals.m_pFontVertexDecl->Release() == 0 ) )
s_FontLocals.m_pFontVertexDecl = NULL;
if( m_xprResource.m_bInitialized)
m_xprResource.Destroy();
}
static void xdk360_console_add( wchar_t wch )
{
// If this is a newline, just increment lines and move on
if( wch == L'\n' )
{
video_console.m_nCurLine = ( video_console.m_nCurLine + 1 )
% video_console.m_cScreenHeightVirtual;
video_console.m_cCurLineLength = 0;
memset(video_console.m_Lines[video_console.m_nCurLine], 0,
( video_console.m_cScreenWidth + 1 ) * sizeof( wchar_t ) );
return;
}
int bIncrementLine = FALSE; // Whether to wrap to the next line
if( video_console.m_cCurLineLength == video_console.m_cScreenWidth )
bIncrementLine = TRUE;
else
{
// Try to append the character to the line
video_console.m_Lines[ video_console.m_nCurLine ][ video_console.m_cCurLineLength ] = wch;
float fTextWidth, fTextHeight;
xdk360_video_font_get_text_width(&m_Font, video_console.m_Lines[ video_console.m_nCurLine ], &fTextWidth,
&fTextHeight);
if( fTextHeight > video_console.m_cxSafeArea )
{
// The line is too long, we need to wrap the character to the next line
video_console.m_Lines[video_console.m_nCurLine][ video_console.m_cCurLineLength ] = L'\0';
bIncrementLine = TRUE;
}
}
// If we need to skip to the next line, do so
if( bIncrementLine )
{
video_console.m_nCurLine = ( video_console.m_nCurLine + 1 )
% video_console.m_cScreenHeightVirtual;
video_console.m_cCurLineLength = 0;
memset( video_console.m_Lines[video_console.m_nCurLine],
0, ( video_console.m_cScreenWidth + 1 ) * sizeof( wchar_t ) );
video_console.m_Lines[video_console.m_nCurLine ][0] = wch;
}
video_console.m_cCurLineLength++;
}
void xdk360_console_format(LPCSTR strFormat, ... )
void xdk360_console_format(const char * strFormat)
{
video_console.m_nCurLine = 0;
video_console.m_cCurLineLength = 0;
@ -665,36 +379,60 @@ void xdk360_console_format(LPCSTR strFormat, ... )
video_console.m_cScreenHeightVirtual *
( video_console.m_cScreenWidth + 1 ) * sizeof( wchar_t ) );
va_list pArgList;
va_start( pArgList, strFormat );
// Count the required length of the string
unsigned long dwStrLen = _vscprintf( strFormat, pArgList ) + 1;
// +1 = null terminator
char * strMessage = ( char * )malloc( dwStrLen );
vsprintf_s( strMessage, dwStrLen, strFormat, pArgList );
// Output the string to the console
unsigned long uStringLength = strlen( strMessage );
unsigned long uStringLength = strlen( strFormat );
for( unsigned long i = 0; i < uStringLength; i++ )
{
wchar_t wch;
int ret = MultiByteToWideChar(
CP_ACP, // ANSI code page
0, // No flags
&strMessage[i], // Character to convert
1, // Convert one byte
&wch, // Target wide character buffer
1 ); // One wide character
xdk360_console_add( wch );
rarch_convert_char_to_wchar(&wch, &strFormat[i], sizeof(wch));
// If this is a newline, just increment lines and move on
if( wch == L'\n' )
{
video_console.m_nCurLine = ( video_console.m_nCurLine + 1 )
% video_console.m_cScreenHeightVirtual;
video_console.m_cCurLineLength = 0;
memset(video_console.m_Lines[video_console.m_nCurLine], 0,
( video_console.m_cScreenWidth + 1 ) * sizeof( wchar_t ) );
continue;
}
int bIncrementLine = FALSE; // Whether to wrap to the next line
if( video_console.m_cCurLineLength == video_console.m_cScreenWidth )
bIncrementLine = TRUE;
else
{
float fTextWidth, fTextHeight;
// Try to append the character to the line
video_console.m_Lines[ video_console.m_nCurLine ][ video_console.m_cCurLineLength ] = wch;
xdk360_video_font_get_text_width(&m_Font, video_console.m_Lines[ video_console.m_nCurLine ], &fTextWidth,
&fTextHeight);
if( fTextHeight > video_console.m_cxSafeArea )
{
// The line is too long, we need to wrap the character to the next line
video_console.m_Lines[video_console.m_nCurLine][ video_console.m_cCurLineLength ] = L'\0';
bIncrementLine = TRUE;
}
}
// If we need to skip to the next line, do so
if( bIncrementLine )
{
video_console.m_nCurLine = ( video_console.m_nCurLine + 1 )
% video_console.m_cScreenHeightVirtual;
video_console.m_cCurLineLength = 0;
memset( video_console.m_Lines[video_console.m_nCurLine], 0,
( video_console.m_cScreenWidth + 1 ) * sizeof( wchar_t ) );
video_console.m_Lines[video_console.m_nCurLine ][0] = wch;
}
video_console.m_cCurLineLength++;
}
free(strMessage);
va_end( pArgList );
}
void xdk360_video_font_begin (xdk360_video_font_t * font)
void d3d9_render_msg_pre(xdk360_video_font_t * font)
{
// Set state on the first call
if( font->m_dwNestedBeginCount == 0 )
@ -706,24 +444,20 @@ void xdk360_video_font_begin (xdk360_video_font_t * font)
// Save state
if( font->m_bSaveState )
{
// Note, we are not saving the texture, vertex, or pixel shader,
// since it's not worth the performance. We're more interested
// in saving state that would cause hard to find problems.
pD3dDevice->GetRenderState( D3DRS_ALPHABLENDENABLE,
&font->m_dwSavedState[ SAVEDSTATE_D3DRS_ALPHABLENDENABLE ] );
pD3dDevice->GetRenderState( D3DRS_SRCBLEND, &font->m_dwSavedState[ SAVEDSTATE_D3DRS_SRCBLEND ] );
pD3dDevice->GetRenderState( D3DRS_DESTBLEND, &font->m_dwSavedState[ SAVEDSTATE_D3DRS_DESTBLEND ] );
pD3dDevice->GetRenderState( D3DRS_BLENDOP, &font->m_dwSavedState[ SAVEDSTATE_D3DRS_BLENDOP ] );
pD3dDevice->GetRenderState( D3DRS_ALPHATESTENABLE, &font->m_dwSavedState[ SAVEDSTATE_D3DRS_ALPHATESTENABLE ] );
pD3dDevice->GetRenderState( D3DRS_ALPHAREF, &font->m_dwSavedState[ SAVEDSTATE_D3DRS_ALPHAREF ] );
pD3dDevice->GetRenderState( D3DRS_ALPHAFUNC, &font->m_dwSavedState[ SAVEDSTATE_D3DRS_ALPHAFUNC ] );
pD3dDevice->GetRenderState( D3DRS_FILLMODE, &font->m_dwSavedState[ SAVEDSTATE_D3DRS_FILLMODE ] );
pD3dDevice->GetRenderState( D3DRS_CULLMODE, &font->m_dwSavedState[ SAVEDSTATE_D3DRS_CULLMODE ] );
pD3dDevice->GetRenderState( D3DRS_VIEWPORTENABLE, &font->m_dwSavedState[ SAVEDSTATE_D3DRS_VIEWPORTENABLE ] );
font->m_dwSavedState[ SAVEDSTATE_D3DSAMP_MINFILTER ] = D3DDevice_GetSamplerState_MinFilter( pD3dDevice, 0 );
font->m_dwSavedState[ SAVEDSTATE_D3DSAMP_MAGFILTER ] = D3DDevice_GetSamplerState_MagFilter( pD3dDevice, 0 );
font->m_dwSavedState[ SAVEDSTATE_D3DSAMP_ADDRESSU ] = D3DDevice_GetSamplerState_AddressU( pD3dDevice, 0);
font->m_dwSavedState[ SAVEDSTATE_D3DSAMP_ADDRESSV ] = D3DDevice_GetSamplerState_AddressV( pD3dDevice, 0);
pD3dDevice->GetRenderState( D3DRS_ALPHABLENDENABLE, &font->m_dwSavedState[ SAVEDSTATE_D3DRS_ALPHABLENDENABLE ] );
pD3dDevice->GetRenderState( D3DRS_SRCBLEND, &font->m_dwSavedState[ SAVEDSTATE_D3DRS_SRCBLEND ] );
pD3dDevice->GetRenderState( D3DRS_DESTBLEND, &font->m_dwSavedState[ SAVEDSTATE_D3DRS_DESTBLEND ] );
pD3dDevice->GetRenderState( D3DRS_BLENDOP, &font->m_dwSavedState[ SAVEDSTATE_D3DRS_BLENDOP ] );
pD3dDevice->GetRenderState( D3DRS_ALPHATESTENABLE, &font->m_dwSavedState[ SAVEDSTATE_D3DRS_ALPHATESTENABLE ] );
pD3dDevice->GetRenderState( D3DRS_ALPHAREF, &font->m_dwSavedState[ SAVEDSTATE_D3DRS_ALPHAREF ] );
pD3dDevice->GetRenderState( D3DRS_ALPHAFUNC, &font->m_dwSavedState[ SAVEDSTATE_D3DRS_ALPHAFUNC ] );
pD3dDevice->GetRenderState( D3DRS_FILLMODE, &font->m_dwSavedState[ SAVEDSTATE_D3DRS_FILLMODE ] );
pD3dDevice->GetRenderState( D3DRS_CULLMODE, &font->m_dwSavedState[ SAVEDSTATE_D3DRS_CULLMODE ] );
pD3dDevice->GetRenderState( D3DRS_VIEWPORTENABLE, &font->m_dwSavedState[ SAVEDSTATE_D3DRS_VIEWPORTENABLE ] );
font->m_dwSavedState[ SAVEDSTATE_D3DSAMP_MINFILTER ] = D3DDevice_GetSamplerState_MinFilter( pD3dDevice, 0 );
font->m_dwSavedState[ SAVEDSTATE_D3DSAMP_MAGFILTER ] = D3DDevice_GetSamplerState_MagFilter( pD3dDevice, 0 );
font->m_dwSavedState[ SAVEDSTATE_D3DSAMP_ADDRESSU ] = D3DDevice_GetSamplerState_AddressU( pD3dDevice, 0);
font->m_dwSavedState[ SAVEDSTATE_D3DSAMP_ADDRESSV ] = D3DDevice_GetSamplerState_AddressV( pD3dDevice, 0);
}
// Set the texture scaling factor as a vertex shader constant
@ -768,7 +502,7 @@ void xdk360_video_font_begin (xdk360_video_font_t * font)
font->m_dwNestedBeginCount++;
}
void xdk360_video_font_end(xdk360_video_font_t * font)
void d3d9_render_msg_post(xdk360_video_font_t * font)
{
if( --font->m_dwNestedBeginCount > 0 )
return;

View File

@ -32,15 +32,12 @@ typedef struct
{
float m_fLineHeight; // height of a single line in pixels
unsigned int m_nScrollOffset; // offset to display text (in lines)
unsigned int first_message;
unsigned int m_cxSafeArea;
unsigned int m_cySafeArea;
unsigned int m_cxSafeAreaOffset;
unsigned int m_cySafeAreaOffset;
unsigned int m_nCurLine; // index of current line being written to
unsigned int m_cCurLineLength; // length of the current line
unsigned long m_colBackColor;
unsigned long m_colTextColor;
unsigned int m_cScreenHeight; // height in lines of screen area
unsigned int m_cScreenHeightVirtual; // height in lines of text storage buffer
unsigned int m_cScreenWidth; // width in characters
@ -100,12 +97,12 @@ typedef struct
const GLYPH_ATTR* m_Glyphs; // Array of glyphs
} xdk360_video_font_t;
HRESULT xdk360_console_init ( LPCSTR strFontFileName, D3DCOLOR colBackColor, D3DCOLOR colTextColor);
void xdk360_console_deinit (void);
void xdk360_console_format (LPCSTR strFormat, ... );
void xdk360_console_draw (void);
HRESULT d3d9_init_font(const char *font_path);
void d3d9_deinit_font(void);
void xdk360_console_format(const char *strFormat);
void xdk360_console_draw(void);
void xdk360_video_font_begin (xdk360_video_font_t * font);
void xdk360_video_font_end (xdk360_video_font_t * font);
void d3d9_render_msg_pre(xdk360_video_font_t * font);
void d3d9_render_msg_post(xdk360_video_font_t * font);
#endif

View File

@ -897,9 +897,11 @@ static bool gl_frame(void *data, const void *frame, unsigned width, unsigned hei
gl_update_resize(gl);
}
gl_update_input_size(gl, width, height, pitch);
gl_copy_frame(gl, frame, width, height, pitch);
if (frame) // Can be NULL for frame dupe / NULL render.
{
gl_update_input_size(gl, width, height, pitch);
gl_copy_frame(gl, frame, width, height, pitch);
}
struct gl_tex_info tex_info = {0};
tex_info.tex = gl->texture[gl->tex_index];

View File

@ -208,7 +208,8 @@ static char *align_program(const char *program)
if (!new_prog)
return NULL;
char *line = dupe_newline(strtok(prog, "\n"));
char *save;
char *line = dupe_newline(strtok_r(prog, "\n", &save));
if (!line)
{
free(prog);
@ -227,7 +228,7 @@ static char *align_program(const char *program)
strlcat(new_prog, line + skip_len, prog_size);
free(line);
line = dupe_newline(strtok(NULL, "\n"));
line = dupe_newline(strtok_r(NULL, "\n", &save));
}
free(prog);

View File

@ -470,6 +470,9 @@ static void check_window(sdl_video_t *vid)
static bool sdl_gfx_frame(void *data, const void *frame, unsigned width, unsigned height, unsigned pitch, const char *msg)
{
if (!frame)
return true;
sdl_video_t *vid = (sdl_video_t*)data;
if (SDL_MUSTLOCK(vid->buffer))

View File

@ -500,7 +500,8 @@ static bool load_textures(const char *dir_path, config_file_t *conf)
if (!config_get_string(conf, "textures", &textures)) // No textures here ...
return true;
const char *id = strtok(textures, ";");;
char *save;
const char *id = strtok_r(textures, ";", &save);
while (id && lut_textures_num < MAX_TEXTURES)
{
char path[PATH_MAX];
@ -546,7 +547,7 @@ static bool load_textures(const char *dir_path, config_file_t *conf)
load_texture_data(&lut_textures[lut_textures_num], &img, smooth);
lut_textures_num++;
id = strtok(NULL, ";");
id = strtok_r(NULL, ";", &save);
}
end:
@ -573,7 +574,8 @@ static bool load_imports(const char *dir_path, config_file_t *conf)
char *script_class = NULL;
#endif
const char *id = strtok(imports, ";");
char *save;
const char *id = strtok_r(imports, ";", &save);
while (id && info_cnt < MAX_VARIABLES)
{
char semantic_buf[64];
@ -692,7 +694,7 @@ static bool load_imports(const char *dir_path, config_file_t *conf)
info_cnt++;
free(semantic);
id = strtok(NULL, ";");
id = strtok_r(NULL, ";", &save);
}
tracker_info.wram = (uint8_t*)pretro_get_memory_data(RETRO_MEMORY_SYSTEM_RAM);

View File

@ -700,6 +700,9 @@ static void xv_render_msg(xv_t *xv, const char *msg, unsigned width, unsigned he
static bool xv_frame(void *data, const void *frame, unsigned width, unsigned height, unsigned pitch, const char *msg)
{
if (!frame)
return true;
xv_t *xv = (xv_t*)data;
if (!check_resize(xv, width, height))

View File

@ -113,7 +113,7 @@
<MinimalRebuild>true</MinimalRebuild>
<BufferSecurityCheck>false</BufferSecurityCheck>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
<PreprocessorDefinitions>_DEBUG;_XBOX;%(PreprocessorDefinitions);HAVE_CONFIGFILE;_CRT_SECURE_NO_WARNINGS;RARCH_CONSOLE=1</PreprocessorDefinitions>
<PreprocessorDefinitions>_DEBUG;_XBOX;%(PreprocessorDefinitions);HAVE_CONFIGFILE;_CRT_SECURE_NO_WARNINGS;RARCH_CONSOLE=1;_XBOX360</PreprocessorDefinitions>
<CallAttributedProfiling>Callcap</CallAttributedProfiling>
</ClCompile>
<Link>
@ -136,7 +136,7 @@
<PREfast>AnalyzeOnly</PREfast>
<BufferSecurityCheck>false</BufferSecurityCheck>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
<PreprocessorDefinitions>_DEBUG;_XBOX;%(PreprocessorDefinitions);HAVE_CONFIGFILE;_CRT_SECURE_NO_WARNINGS;RARCH_CONSOLE=1</PreprocessorDefinitions>
<PreprocessorDefinitions>_DEBUG;_XBOX;%(PreprocessorDefinitions);HAVE_CONFIGFILE;_CRT_SECURE_NO_WARNINGS;RARCH_CONSOLE=1;_XBOX360</PreprocessorDefinitions>
<CallAttributedProfiling>Callcap</CallAttributedProfiling>
</ClCompile>
<Link>
@ -160,7 +160,7 @@
<FavorSizeOrSpeed>Size</FavorSizeOrSpeed>
<BufferSecurityCheck>false</BufferSecurityCheck>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<PreprocessorDefinitions>NDEBUG;_XBOX;PROFILE;%(PreprocessorDefinitions);HAVE_CONFIGFILE;_CRT_SECURE_NO_WARNINGS;RARCH_CONSOLE=1</PreprocessorDefinitions>
<PreprocessorDefinitions>NDEBUG;_XBOX;PROFILE;%(PreprocessorDefinitions);HAVE_CONFIGFILE;_CRT_SECURE_NO_WARNINGS;RARCH_CONSOLE=1;_XBOX360</PreprocessorDefinitions>
<CallAttributedProfiling>Callcap</CallAttributedProfiling>
</ClCompile>
<Link>
@ -189,7 +189,7 @@
<FavorSizeOrSpeed>Size</FavorSizeOrSpeed>
<BufferSecurityCheck>false</BufferSecurityCheck>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<PreprocessorDefinitions>NDEBUG;_XBOX;PROFILE;FASTCAP;%(PreprocessorDefinitions);HAVE_CONFIGFILE;_CRT_SECURE_NO_WARNINGS;RARCH_CONSOLE=1</PreprocessorDefinitions>
<PreprocessorDefinitions>NDEBUG;_XBOX;PROFILE;FASTCAP;%(PreprocessorDefinitions);HAVE_CONFIGFILE;_CRT_SECURE_NO_WARNINGS;RARCH_CONSOLE=1;_XBOX360</PreprocessorDefinitions>
</ClCompile>
<Link>
<GenerateDebugInformation>true</GenerateDebugInformation>
@ -215,7 +215,7 @@
<ExceptionHandling>false</ExceptionHandling>
<BufferSecurityCheck>false</BufferSecurityCheck>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<PreprocessorDefinitions>NDEBUG;_XBOX;%(PreprocessorDefinitions);HAVE_CONFIGFILE;_CRT_SECURE_NO_WARNINGS;RARCH_CONSOLE=1</PreprocessorDefinitions>
<PreprocessorDefinitions>NDEBUG;_XBOX;%(PreprocessorDefinitions);HAVE_CONFIGFILE;_CRT_SECURE_NO_WARNINGS;RARCH_CONSOLE=1;_XBOX360</PreprocessorDefinitions>
</ClCompile>
<Link>
<GenerateDebugInformation>true</GenerateDebugInformation>
@ -241,7 +241,7 @@
<ExceptionHandling>false</ExceptionHandling>
<BufferSecurityCheck>false</BufferSecurityCheck>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<PreprocessorDefinitions>NDEBUG;_XBOX;LTCG;%(PreprocessorDefinitions);HAVE_CONFIGFILE;_CRT_SECURE_NO_WARNINGS;RARCH_CONSOLE=1</PreprocessorDefinitions>
<PreprocessorDefinitions>NDEBUG;_XBOX;LTCG;%(PreprocessorDefinitions);HAVE_CONFIGFILE;_CRT_SECURE_NO_WARNINGS;RARCH_CONSOLE=1;_XBOX360</PreprocessorDefinitions>
</ClCompile>
<Link>
<GenerateDebugInformation>true</GenerateDebugInformation>
@ -278,4 +278,4 @@
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>
</Project>

View File

@ -3,7 +3,7 @@ Microsoft Visual Studio Solution File, Format Version 11.00
# Visual Studio 2010
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "RetroArch-360", "RetroArch-360\RetroArch-360.vcxproj", "{9CE8EEF7-CC1C-4A04-BB5C-62411CB5BADE}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "RetroArch-Salamander", "RetroArch-Salamander\RetroArch-Salamander.vcxproj", "{29D5B973-F267-4039-84E7-8D34E9D00800}"
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "RetroArch-Salamander", "RetroArch-360-Salamander\RetroArch-Salamander.vcxproj", "{29D5B973-F267-4039-84E7-8D34E9D00800}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution

View File

@ -113,7 +113,7 @@
<MinimalRebuild>true</MinimalRebuild>
<BufferSecurityCheck>false</BufferSecurityCheck>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
<PreprocessorDefinitions>_DEBUG;_XBOX;PACKAGE_VERSION="0.9.6";%(PreprocessorDefinitions);HAVE_DEFAULT_RETROPAD_INPUT;_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>
<PreprocessorDefinitions>_DEBUG;_XBOX;PACKAGE_VERSION="0.9.6";%(PreprocessorDefinitions);HAVE_DEFAULT_RETROPAD_INPUT;_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;_XBOX360</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";HAVE_DEFAULT_RETROPAD_INPUT;_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>
<PreprocessorDefinitions>_DEBUG;_XBOX;%(PreprocessorDefinitions);PACKAGE_VERSION="0.9.6";HAVE_DEFAULT_RETROPAD_INPUT;_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;_XBOX360</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";HAVE_DEFAULT_RETROPAD_INPUT;_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>
<PreprocessorDefinitions>NDEBUG;_XBOX;PROFILE;%(PreprocessorDefinitions);PACKAGE_VERSION="0.9.6";HAVE_DEFAULT_RETROPAD_INPUT;_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;_XBOX360</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";HAVE_DEFAULT_RETROPAD_INPUT;_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>
<PreprocessorDefinitions>NDEBUG;_XBOX;PROFILE;FASTCAP;%(PreprocessorDefinitions);PACKAGE_VERSION="0.9.6";HAVE_DEFAULT_RETROPAD_INPUT;_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;_XBOX360</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";_CRT_SECURE_NO_WARNINGS;HAVE_DEFAULT_RETROPAD_INPUT;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>
<PreprocessorDefinitions>NDEBUG;_XBOX;%(PreprocessorDefinitions);PACKAGE_VERSION="0.9.6";_CRT_SECURE_NO_WARNINGS;HAVE_DEFAULT_RETROPAD_INPUT;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;_XBOX360</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";_CRT_SECURE_NO_WARNINGS;HAVE_DEFAULT_RETROPAD_INPUT;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>
<PreprocessorDefinitions>NDEBUG;_XBOX;LTCG;%(PreprocessorDefinitions);PACKAGE_VERSION="0.9.6";_CRT_SECURE_NO_WARNINGS;HAVE_DEFAULT_RETROPAD_INPUT;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;_XBOX360</PreprocessorDefinitions>
</ClCompile>
<Link>
<GenerateDebugInformation>true</GenerateDebugInformation>
@ -714,4 +714,4 @@
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>
</Project>

View File

@ -30,9 +30,6 @@
<Filter Include="Header Files\compat">
<UniqueIdentifier>{cf25b88e-c7b2-4823-876a-ed0dd8020821}</UniqueIdentifier>
</Filter>
<Filter Include="Source Files\console\griffin">
<UniqueIdentifier>{c868cc96-a0ac-4672-a4ca-dd7c28277972}</UniqueIdentifier>
</Filter>
<Filter Include="Source Files\media\sd">
<UniqueIdentifier>{d50021e0-79f4-42c0-b190-1c31fa4fe2b2}</UniqueIdentifier>
</Filter>
@ -42,6 +39,9 @@
<Filter Include="Source Files\media\shaders">
<UniqueIdentifier>{3a05047b-b9ec-4821-bb28-d1b0e9e3e8bb}</UniqueIdentifier>
</Filter>
<Filter Include="Source Files\console\griffin">
<UniqueIdentifier>{c868cc96-a0ac-4672-a4ca-dd7c28277972}</UniqueIdentifier>
</Filter>
</ItemGroup>
<ItemGroup>
<ClCompile Include="..\..\console\rzlib\rzlib.c">

View File

@ -1,7 +1,7 @@

Microsoft Visual Studio Solution File, Format Version 11.00
# Visual Studio 2010
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "RetroArch-PS3", "RetroArch-PS3.vcxproj", "{EAC43BA5-5C6A-4FE4-8E50-CD9B5BD3E0F9}"
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "RetroArch-PS3", "RetroArch-PS3/RetroArch-PS3.vcxproj", "{EAC43BA5-5C6A-4FE4-8E50-CD9B5BD3E0F9}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution

30
msvc/RetroArch-Xbox1.sln Normal file
View File

@ -0,0 +1,30 @@
Microsoft Visual Studio Solution File, Format Version 8.00
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "RetroArch-Xbox1", "RetroArch-Xbox1/RetroArch-Xbox1.vcproj", "{D45CEB37-21F1-486B-92F0-569B10953978}"
ProjectSection(ProjectDependencies) = postProject
EndProjectSection
EndProject
Global
GlobalSection(SolutionConfiguration) = preSolution
Debug = Debug
Profile = Profile
Profile_FastCap = Profile_FastCap
Release = Release
Release_LTCG = Release_LTCG
EndGlobalSection
GlobalSection(ProjectConfiguration) = postSolution
{D45CEB37-21F1-486B-92F0-569B10953978}.Debug.ActiveCfg = Debug|Win32
{D45CEB37-21F1-486B-92F0-569B10953978}.Debug.Build.0 = Debug|Win32
{D45CEB37-21F1-486B-92F0-569B10953978}.Profile.ActiveCfg = Profile|Win32
{D45CEB37-21F1-486B-92F0-569B10953978}.Profile.Build.0 = Profile|Win32
{D45CEB37-21F1-486B-92F0-569B10953978}.Profile_FastCap.ActiveCfg = Profile_FastCap|Win32
{D45CEB37-21F1-486B-92F0-569B10953978}.Profile_FastCap.Build.0 = Profile_FastCap|Win32
{D45CEB37-21F1-486B-92F0-569B10953978}.Release.ActiveCfg = Release|Win32
{D45CEB37-21F1-486B-92F0-569B10953978}.Release.Build.0 = Release|Win32
{D45CEB37-21F1-486B-92F0-569B10953978}.Release_LTCG.ActiveCfg = Release_LTCG|Win32
{D45CEB37-21F1-486B-92F0-569B10953978}.Release_LTCG.Build.0 = Release_LTCG|Win32
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
EndGlobalSection
GlobalSection(ExtensibilityAddIns) = postSolution
EndGlobalSection
EndGlobal

View File

@ -0,0 +1,273 @@
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="7.10"
Name="RetroArch-Xbox1"
ProjectGUID="{D45CEB37-21F1-486B-92F0-569B10953978}"
RootNamespace="RetroArch-Xbox1"
Keyword="XboxProj">
<Platforms>
<Platform
Name="Win32"/>
</Platforms>
<Configurations>
<Configuration
Name="Debug|Win32"
OutputDirectory="Debug"
IntermediateDirectory="Debug"
ConfigurationType="1">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="&quot;$(SolutionDir)\msvc-stdint&quot;;&quot;$(SolutionDir)\msvc-71&quot;;&quot;$(VSInstallDir)\..\Microsoft Xbox SDK\xbox\include&quot;"
PreprocessorDefinitions="_XBOX;_XBOX1;RARCH_CONSOLE;PACKAGE_VERSION=\&quot;0.9.6\&quot;;__STDC_CONSTANT_MACROS;HAVE_ZLIB"
MinimalRebuild="TRUE"
BasicRuntimeChecks="3"
EnableEnhancedInstructionSet="1"
UsePrecompiledHeader="0"
WarningLevel="3"
Detect64BitPortabilityProblems="FALSE"
DebugInformationFormat="4"/>
<Tool
Name="VCCustomBuildTool"/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="$(ProjectDir)\$(IntDir)\libretro.lib &quot;$(VSInstallDir)..\Microsoft Xbox SDK\xbox\lib\xperf.lib&quot; &quot;$(VSInstallDir)..\Microsoft Xbox SDK\xbox\lib\xbdm.lib&quot; &quot;$(VSInstallDir)..\Microsoft Xbox SDK\xbox\lib\d3d8d.lib&quot; &quot;$(VSInstallDir)..\Microsoft Xbox SDK\xbox\lib\d3dx8d.lib&quot; &quot;$(VSInstallDir)..\Microsoft Xbox SDK\xbox\lib\xgraphicsd.lib&quot; &quot;$(VSInstallDir)..\Microsoft Xbox SDK\xbox\lib\dsoundd.lib&quot; &quot;$(VSInstallDir)..\Microsoft Xbox SDK\xbox\lib\xboxkrnl.lib&quot;"
GenerateDebugInformation="TRUE"
SubSystem="2"
TargetMachine="1"/>
<Tool
Name="VCMIDLTool"/>
<Tool
Name="VCPostBuildEventTool"/>
<Tool
Name="VCPreBuildEventTool"/>
<Tool
Name="VCPreLinkEventTool"/>
<Tool
Name="VCResourceCompilerTool"/>
<Tool
Name="VCWebServiceProxyGeneratorTool"/>
<Tool
Name="VCXMLDataGeneratorTool"/>
<Tool
Name="VCWebDeploymentTool"/>
<Tool
Name="VCManagedWrapperGeneratorTool"/>
<Tool
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
</Configuration>
<Configuration
Name="Profile|Win32"
OutputDirectory="Profile"
IntermediateDirectory="Profile"
ConfigurationType="1">
<Tool
Name="VCCLCompilerTool"
Optimization="3"
OmitFramePointers="TRUE"
AdditionalIncludeDirectories="&quot;$(SolutionDir)\msvc-stdint&quot;;&quot;$(SolutionDir)\msvc-71&quot;;&quot;$(VSInstallDir)\..\Microsoft Xbox SDK\xbox\include&quot;"
PreprocessorDefinitions="_XBOX;_XBOX1;RARCH_CONSOLE;PACKAGE_VERSION=\&quot;0.9.6\&quot;;__STDC_CONSTANT_MACROS;HAVE_ZLIB"
StringPooling="TRUE"
BufferSecurityCheck="TRUE"
EnableFunctionLevelLinking="TRUE"
EnableEnhancedInstructionSet="1"
UsePrecompiledHeader="0"
WarningLevel="3"
Detect64BitPortabilityProblems="FALSE"
DebugInformationFormat="3"/>
<Tool
Name="VCCustomBuildTool"/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="$(ProjectDir)\$(IntDir)\libretro.lib &quot;$(VSInstallDir)..\Microsoft Xbox SDK\xbox\lib\xperf.lib&quot; &quot;$(VSInstallDir)..\Microsoft Xbox SDK\xbox\lib\xbdm.lib&quot; &quot;$(VSInstallDir)..\Microsoft Xbox SDK\xbox\lib\d3d8d.lib&quot; &quot;$(VSInstallDir)..\Microsoft Xbox SDK\xbox\lib\d3dx8d.lib&quot; &quot;$(VSInstallDir)..\Microsoft Xbox SDK\xbox\lib\xgraphicsd.lib&quot; &quot;$(VSInstallDir)..\Microsoft Xbox SDK\xbox\lib\dsoundd.lib&quot; &quot;$(VSInstallDir)..\Microsoft Xbox SDK\xbox\lib\xboxkrnl.lib&quot;"
GenerateDebugInformation="TRUE"
SubSystem="2"
OptimizeReferences="2"
EnableCOMDATFolding="2"
TargetMachine="1"/>
<Tool
Name="VCMIDLTool"/>
<Tool
Name="VCPostBuildEventTool"/>
<Tool
Name="VCPreBuildEventTool"/>
<Tool
Name="VCPreLinkEventTool"/>
<Tool
Name="VCResourceCompilerTool"/>
<Tool
Name="VCWebServiceProxyGeneratorTool"/>
<Tool
Name="VCXMLDataGeneratorTool"/>
<Tool
Name="VCWebDeploymentTool"/>
<Tool
Name="VCManagedWrapperGeneratorTool"/>
<Tool
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
</Configuration>
<Configuration
Name="Profile_FastCap|Win32"
OutputDirectory="Profile_FastCap"
IntermediateDirectory="Profile_FastCap"
ConfigurationType="1">
<Tool
Name="VCCLCompilerTool"
Optimization="3"
OmitFramePointers="TRUE"
AdditionalIncludeDirectories="&quot;$(SolutionDir)\msvc-stdint&quot;;&quot;$(SolutionDir)\msvc-71&quot;;&quot;$(VSInstallDir)\..\Microsoft Xbox SDK\xbox\include&quot;"
PreprocessorDefinitions="_XBOX;_XBOX1;RARCH_CONSOLE;PACKAGE_VERSION=\&quot;0.9.6\&quot;;__STDC_CONSTANT_MACROS;HAVE_ZLIB"
StringPooling="TRUE"
EnableFunctionLevelLinking="TRUE"
EnableEnhancedInstructionSet="1"
UsePrecompiledHeader="0"
WarningLevel="3"
Detect64BitPortabilityProblems="FALSE"
DebugInformationFormat="3"/>
<Tool
Name="VCCustomBuildTool"/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="$(ProjectDir)\$(IntDir)\libretro.lib &quot;$(VSInstallDir)..\Microsoft Xbox SDK\xbox\lib\xperf.lib&quot; &quot;$(VSInstallDir)..\Microsoft Xbox SDK\xbox\lib\xbdm.lib&quot; &quot;$(VSInstallDir)..\Microsoft Xbox SDK\xbox\lib\d3d8d.lib&quot; &quot;$(VSInstallDir)..\Microsoft Xbox SDK\xbox\lib\d3dx8d.lib&quot; &quot;$(VSInstallDir)..\Microsoft Xbox SDK\xbox\lib\xgraphicsd.lib&quot; &quot;$(VSInstallDir)..\Microsoft Xbox SDK\xbox\lib\dsoundd.lib&quot; &quot;$(VSInstallDir)..\Microsoft Xbox SDK\xbox\lib\xboxkrnl.lib&quot;"/>
<Tool
Name="VCMIDLTool"/>
<Tool
Name="VCPostBuildEventTool"/>
<Tool
Name="VCPreBuildEventTool"/>
<Tool
Name="VCPreLinkEventTool"/>
<Tool
Name="VCResourceCompilerTool"/>
<Tool
Name="VCWebServiceProxyGeneratorTool"/>
<Tool
Name="VCXMLDataGeneratorTool"/>
<Tool
Name="VCWebDeploymentTool"/>
<Tool
Name="VCManagedWrapperGeneratorTool"/>
<Tool
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
</Configuration>
<Configuration
Name="Release|Win32"
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
IntermediateDirectory="$(ConfigurationName)"
ConfigurationType="1">
<Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories="&quot;$(SolutionDir)\msvc-stdint&quot;;&quot;$(SolutionDir)\msvc-71&quot;;&quot;$(VSInstallDir)\..\Microsoft Xbox SDK\xbox\include&quot;"
PreprocessorDefinitions="_XBOX;_XBOX1;RARCH_CONSOLE;PACKAGE_VERSION=\&quot;0.9.6\&quot;;__STDC_CONSTANT_MACROS;HAVE_ZLIB"
UsePrecompiledHeader="0"/>
<Tool
Name="VCCustomBuildTool"/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="$(ProjectDir)\$(IntDir)\libretro.lib &quot;$(VSInstallDir)..\Microsoft Xbox SDK\xbox\lib\xperf.lib&quot; &quot;$(VSInstallDir)..\Microsoft Xbox SDK\xbox\lib\xbdm.lib&quot; &quot;$(VSInstallDir)..\Microsoft Xbox SDK\xbox\lib\d3d8d.lib&quot; &quot;$(VSInstallDir)..\Microsoft Xbox SDK\xbox\lib\d3dx8d.lib&quot; &quot;$(VSInstallDir)..\Microsoft Xbox SDK\xbox\lib\xgraphicsd.lib&quot; &quot;$(VSInstallDir)..\Microsoft Xbox SDK\xbox\lib\dsoundd.lib&quot; &quot;$(VSInstallDir)..\Microsoft Xbox SDK\xbox\lib\xboxkrnl.lib&quot;"/>
<Tool
Name="VCMIDLTool"/>
<Tool
Name="VCPostBuildEventTool"/>
<Tool
Name="VCPreBuildEventTool"/>
<Tool
Name="VCPreLinkEventTool"/>
<Tool
Name="VCResourceCompilerTool"/>
<Tool
Name="VCWebServiceProxyGeneratorTool"/>
<Tool
Name="VCXMLDataGeneratorTool"/>
<Tool
Name="VCWebDeploymentTool"/>
<Tool
Name="VCManagedWrapperGeneratorTool"/>
<Tool
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
</Configuration>
<Configuration
Name="Release_LTCG|Win32"
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
IntermediateDirectory="$(ConfigurationName)"
ConfigurationType="1">
<Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories="&quot;$(SolutionDir)\msvc-stdint&quot;;&quot;$(SolutionDir)\msvc-71&quot;;&quot;$(VSInstallDir)\..\Microsoft Xbox SDK\xbox\include&quot;"
PreprocessorDefinitions="_XBOX;_XBOX1;RARCH_CONSOLE;PACKAGE_VERSION=\&quot;0.9.6\&quot;;__STDC_CONSTANT_MACROS;HAVE_ZLIB"
UsePrecompiledHeader="0"/>
<Tool
Name="VCCustomBuildTool"/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="$(ProjectDir)\$(IntDir)\libretro.lib &quot;$(VSInstallDir)..\Microsoft Xbox SDK\xbox\lib\xperf.lib&quot; &quot;$(VSInstallDir)..\Microsoft Xbox SDK\xbox\lib\xbdm.lib&quot; &quot;$(VSInstallDir)..\Microsoft Xbox SDK\xbox\lib\d3d8d.lib&quot; &quot;$(VSInstallDir)..\Microsoft Xbox SDK\xbox\lib\d3dx8d.lib&quot; &quot;$(VSInstallDir)..\Microsoft Xbox SDK\xbox\lib\xgraphicsd.lib&quot; &quot;$(VSInstallDir)..\Microsoft Xbox SDK\xbox\lib\dsoundd.lib&quot; &quot;$(VSInstallDir)..\Microsoft Xbox SDK\xbox\lib\xboxkrnl.lib&quot;"/>
<Tool
Name="VCMIDLTool"/>
<Tool
Name="VCPostBuildEventTool"/>
<Tool
Name="VCPreBuildEventTool"/>
<Tool
Name="VCPreLinkEventTool"/>
<Tool
Name="VCResourceCompilerTool"/>
<Tool
Name="VCWebServiceProxyGeneratorTool"/>
<Tool
Name="VCXMLDataGeneratorTool"/>
<Tool
Name="VCWebDeploymentTool"/>
<Tool
Name="VCManagedWrapperGeneratorTool"/>
<Tool
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
</Configuration>
</Configurations>
<References>
</References>
<Files>
<Filter
Name="src"
Filter="">
<File
RelativePath="..\..\console\griffin\griffin.c">
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCCLCompilerTool"
CompileAs="2"/>
</FileConfiguration>
<FileConfiguration
Name="Profile|Win32">
<Tool
Name="VCCLCompilerTool"
CompileAs="2"/>
</FileConfiguration>
<FileConfiguration
Name="Profile_FastCap|Win32">
<Tool
Name="VCCLCompilerTool"
CompileAs="2"/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32">
<Tool
Name="VCCLCompilerTool"
CompileAs="2"/>
</FileConfiguration>
<FileConfiguration
Name="Release_LTCG|Win32">
<Tool
Name="VCCLCompilerTool"
CompileAs="2"/>
</FileConfiguration>
</File>
<File
RelativePath="..\..\console\rzlib\rzlib.c">
</File>
</Filter>
</Files>
<Globals>
</Globals>
</VisualStudioProject>

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/>.
*/
#ifndef __MSVC_71_H
#define __MSVC_71_H
#include <stdarg.h>
static inline void RARCH_LOG(const char *msg, ...)
{
va_list ap;
va_start(ap, msg);
fprintf(stderr, "RetroArch: ");
vfprintf(stderr, msg, ap);
va_end(ap);
}
static inline void RARCH_WARN(const char *msg, ...)
{
va_list ap;
va_start(ap, msg);
fprintf(stderr, "RetroArch [WARN] :: ");
vfprintf(stderr, msg, ap);
va_end(ap);
}
static inline void RARCH_ERR(const char *msg, ...)
{
va_list ap;
va_start(ap, msg);
fprintf(stderr, "RetroArch [ERR] :: ");
vfprintf(stderr, msg, ap);
va_end(ap);
}
#endif

249
msvc/msvc-stdint/stdint.h Normal file
View File

@ -0,0 +1,249 @@
// ISO C9x compliant stdint.h for Microsoft Visual Studio
// Based on ISO/IEC 9899:TC2 Committee draft (May 6, 2005) WG14/N1124
//
// Copyright (c) 2006-2008 Alexander Chemeris
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are met:
//
// 1. Redistributions of source code must retain the above copyright notice,
// this list of conditions and the following disclaimer.
//
// 2. Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
//
// 3. The name of the author may be used to endorse or promote products
// derived from this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
// WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
// EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
// OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
// WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
// OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
// ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
///////////////////////////////////////////////////////////////////////////////
#ifndef __RARCH_STDINT_H
#define __RARCH_STDINT_H
#if _MSC_VER && (_MSC_VER < 1600)
//pre-MSVC 2010 needs an implementation of stdint.h
#if _MSC_VER > 1000
#pragma once
#endif
#include <limits.h>
// For Visual Studio 6 in C++ mode and for many Visual Studio versions when
// compiling for ARM we should wrap <wchar.h> include with 'extern "C++" {}'
// or compiler give many errors like this:
// error C2733: second C linkage of overloaded function 'wmemchr' not allowed
#ifdef __cplusplus
extern "C" {
#endif
# include <wchar.h>
#ifdef __cplusplus
}
#endif
// Define _W64 macros to mark types changing their size, like intptr_t.
#ifndef _W64
# if !defined(__midl) && (defined(_X86_) || defined(_M_IX86)) && _MSC_VER >= 1300
# define _W64 __w64
# else
# define _W64
# endif
#endif
// 7.18.1 Integer types
// 7.18.1.1 Exact-width integer types
// Visual Studio 6 and Embedded Visual C++ 4 doesn't
// realize that, e.g. char has the same size as __int8
// so we give up on __intX for them.
#if (_MSC_VER < 1300)
typedef signed char int8_t;
typedef signed short int16_t;
typedef signed int int32_t;
typedef unsigned char uint8_t;
typedef unsigned short uint16_t;
typedef unsigned int uint32_t;
#else
typedef signed __int8 int8_t;
typedef signed __int16 int16_t;
typedef signed __int32 int32_t;
typedef unsigned __int8 uint8_t;
typedef unsigned __int16 uint16_t;
typedef unsigned __int32 uint32_t;
#endif
typedef signed __int64 int64_t;
typedef unsigned __int64 uint64_t;
// 7.18.1.2 Minimum-width integer types
typedef int8_t int_least8_t;
typedef int16_t int_least16_t;
typedef int32_t int_least32_t;
typedef int64_t int_least64_t;
typedef uint8_t uint_least8_t;
typedef uint16_t uint_least16_t;
typedef uint32_t uint_least32_t;
typedef uint64_t uint_least64_t;
// 7.18.1.3 Fastest minimum-width integer types
typedef int8_t int_fast8_t;
typedef int16_t int_fast16_t;
typedef int32_t int_fast32_t;
typedef int64_t int_fast64_t;
typedef uint8_t uint_fast8_t;
typedef uint16_t uint_fast16_t;
typedef uint32_t uint_fast32_t;
typedef uint64_t uint_fast64_t;
// 7.18.1.4 Integer types capable of holding object pointers
#ifdef _WIN64 // [
typedef signed __int64 intptr_t;
typedef unsigned __int64 uintptr_t;
#else // _WIN64 ][
typedef _W64 signed int intptr_t;
typedef _W64 unsigned int uintptr_t;
#endif // _WIN64 ]
// 7.18.1.5 Greatest-width integer types
typedef int64_t intmax_t;
typedef uint64_t uintmax_t;
// 7.18.2 Limits of specified-width integer types
#if !defined(__cplusplus) || defined(__STDC_LIMIT_MACROS) // [ See footnote 220 at page 257 and footnote 221 at page 259
// 7.18.2.1 Limits of exact-width integer types
#define INT8_MIN ((int8_t)_I8_MIN)
#define INT8_MAX _I8_MAX
#define INT16_MIN ((int16_t)_I16_MIN)
#define INT16_MAX _I16_MAX
#define INT32_MIN ((int32_t)_I32_MIN)
#define INT32_MAX _I32_MAX
#define INT64_MIN ((int64_t)_I64_MIN)
#define INT64_MAX _I64_MAX
#define UINT8_MAX _UI8_MAX
#define UINT16_MAX _UI16_MAX
#define UINT32_MAX _UI32_MAX
#define UINT64_MAX _UI64_MAX
// 7.18.2.2 Limits of minimum-width integer types
#define INT_LEAST8_MIN INT8_MIN
#define INT_LEAST8_MAX INT8_MAX
#define INT_LEAST16_MIN INT16_MIN
#define INT_LEAST16_MAX INT16_MAX
#define INT_LEAST32_MIN INT32_MIN
#define INT_LEAST32_MAX INT32_MAX
#define INT_LEAST64_MIN INT64_MIN
#define INT_LEAST64_MAX INT64_MAX
#define UINT_LEAST8_MAX UINT8_MAX
#define UINT_LEAST16_MAX UINT16_MAX
#define UINT_LEAST32_MAX UINT32_MAX
#define UINT_LEAST64_MAX UINT64_MAX
// 7.18.2.3 Limits of fastest minimum-width integer types
#define INT_FAST8_MIN INT8_MIN
#define INT_FAST8_MAX INT8_MAX
#define INT_FAST16_MIN INT16_MIN
#define INT_FAST16_MAX INT16_MAX
#define INT_FAST32_MIN INT32_MIN
#define INT_FAST32_MAX INT32_MAX
#define INT_FAST64_MIN INT64_MIN
#define INT_FAST64_MAX INT64_MAX
#define UINT_FAST8_MAX UINT8_MAX
#define UINT_FAST16_MAX UINT16_MAX
#define UINT_FAST32_MAX UINT32_MAX
#define UINT_FAST64_MAX UINT64_MAX
// 7.18.2.4 Limits of integer types capable of holding object pointers
#ifdef _WIN64 // [
# define INTPTR_MIN INT64_MIN
# define INTPTR_MAX INT64_MAX
# define UINTPTR_MAX UINT64_MAX
#else // _WIN64 ][
# define INTPTR_MIN INT32_MIN
# define INTPTR_MAX INT32_MAX
# define UINTPTR_MAX UINT32_MAX
#endif // _WIN64 ]
// 7.18.2.5 Limits of greatest-width integer types
#define INTMAX_MIN INT64_MIN
#define INTMAX_MAX INT64_MAX
#define UINTMAX_MAX UINT64_MAX
// 7.18.3 Limits of other integer types
#ifdef _WIN64 // [
# define PTRDIFF_MIN _I64_MIN
# define PTRDIFF_MAX _I64_MAX
#else // _WIN64 ][
# define PTRDIFF_MIN _I32_MIN
# define PTRDIFF_MAX _I32_MAX
#endif // _WIN64 ]
#define SIG_ATOMIC_MIN INT_MIN
#define SIG_ATOMIC_MAX INT_MAX
#ifndef SIZE_MAX // [
# ifdef _WIN64 // [
# define SIZE_MAX _UI64_MAX
# else // _WIN64 ][
# define SIZE_MAX _UI32_MAX
# endif // _WIN64 ]
#endif // SIZE_MAX ]
// WCHAR_MIN and WCHAR_MAX are also defined in <wchar.h>
#ifndef WCHAR_MIN // [
# define WCHAR_MIN 0
#endif // WCHAR_MIN ]
#ifndef WCHAR_MAX // [
# define WCHAR_MAX _UI16_MAX
#endif // WCHAR_MAX ]
#define WINT_MIN 0
#define WINT_MAX _UI16_MAX
#endif // __STDC_LIMIT_MACROS ]
// 7.18.4 Limits of other integer types
#if !defined(__cplusplus) || defined(__STDC_CONSTANT_MACROS) // [ See footnote 224 at page 260
// 7.18.4.1 Macros for minimum-width integer constants
#define INT8_C(val) val##i8
#define INT16_C(val) val##i16
#define INT32_C(val) val##i32
#define INT64_C(val) val##i64
#define UINT8_C(val) val##ui8
#define UINT16_C(val) val##ui16
#define UINT32_C(val) val##ui32
#define UINT64_C(val) val##ui64
// 7.18.4.2 Macros for greatest-width integer constants
#define INTMAX_C INT64_C
#define UINTMAX_C UINT64_C
#endif // __STDC_CONSTANT_MACROS ]
#else
//sanity for everything else
#include <stdint.h>
#endif
#endif

View File

@ -153,11 +153,12 @@ static void parse_sub_msg(network_cmd_t *handle, const char *tok)
static void parse_msg(network_cmd_t *handle, char *buf)
{
const char *tok = strtok(buf, "\n");
char *save;
const char *tok = strtok_r(buf, "\n", &save);
while (tok)
{
parse_sub_msg(handle, tok);
tok = strtok(NULL, "\n");
tok = strtok_r(NULL, "\n", &save);
}
}
@ -283,11 +284,12 @@ bool network_cmd_send(const char *cmd_)
const char *port_ = NULL;
uint16_t port = DEFAULT_NETWORK_CMD_PORT;
cmd = strtok(command, ":");
char *save;
cmd = strtok_r(command, ":", &save);
if (cmd)
host = strtok(NULL, ":");
host = strtok_r(NULL, ":", &save);
if (host)
port_ = strtok(NULL, ":");
port_ = strtok_r(NULL, ":", &save);
if (!host)
{

View File

@ -15,7 +15,7 @@
*/
#include <stdint.h>
#include <stdbool.h>
#include "../../boolean.h"
#include <stddef.h>
#include <string.h>
@ -60,7 +60,6 @@
#define NP_POOL_SIZE (128*1024)
static uint8_t np_pool[NP_POOL_SIZE];
char contentInfoPath[PATH_MAX];
char usrDirPath[PATH_MAX];
char DEFAULT_PRESET_FILE[PATH_MAX];
char DEFAULT_BORDER_FILE[PATH_MAX];
@ -174,6 +173,7 @@ static void get_environment_settings(int argc, char *argv[])
unsigned int get_attributes;
CellGameContentSize size;
char dirName[CELL_GAME_DIRNAME_SIZE];
char contentInfoPath[PATH_MAX];
CellSysCacheParam param;
memset(&param, 0x00, sizeof(CellSysCacheParam));
strlcpy(param.cacheId,CACHE_ID, sizeof(CellSysCacheParam));

View File

@ -302,7 +302,7 @@ static void browser_update(filebrowser_t * b, const char *extensions)
static void browser_render(filebrowser_t * b)
{
gl_t *gl = driver.video_data;
uint32_t file_count = b->current_dir.size;
uint32_t file_count = b->current_dir.list->size;
int current_index, page_number, page_base, i;
float currentX, currentY, ySpacing;
@ -317,9 +317,9 @@ static void browser_render(filebrowser_t * b)
for ( i = page_base; i < file_count && i < page_base + NUM_ENTRY_PER_PAGE; ++i)
{
char fname_tmp[256];
fill_pathname_base(fname_tmp, b->current_dir.elems[i], sizeof(fname_tmp));
fill_pathname_base(fname_tmp, b->current_dir.list->elems[i].data, sizeof(fname_tmp));
currentY = currentY + ySpacing;
cellDbgFontPuts(currentX, currentY, FONT_SIZE, i == current_index ? RED : WHITE, fname_tmp);
cellDbgFontPuts(currentX, currentY, FONT_SIZE, i == current_index ? RED : b->current_dir.list->elems[i].attr.b ? GREEN : WHITE, fname_tmp);
gl_render_msg_post(gl);
}
gl_render_msg_post(gl);
@ -859,7 +859,7 @@ static void select_file(uint32_t menu_id)
if (CTRL_CROSS(button_was_pressed))
{
if(path_is_directory(filebrowser_get_current_path(&tmpBrowser)))
if(filebrowser_get_current_path_isdir(&tmpBrowser))
{
/*if 'filename' is in fact '..' - then pop back directory instead of
adding '..' to filename path */
@ -952,7 +952,7 @@ static void select_directory(uint32_t menu_id)
if (CTRL_SQUARE(button_was_pressed))
{
if(path_is_directory(filebrowser_get_current_path(&tmpBrowser)))
if(filebrowser_get_current_path_isdir(&tmpBrowser))
{
snprintf(path, sizeof(path), filebrowser_get_current_path(&tmpBrowser));
switch(menu_id)
@ -995,7 +995,7 @@ static void select_directory(uint32_t menu_id)
}
else if (CTRL_CROSS(button_was_pressed))
{
if(path_is_directory(filebrowser_get_current_path(&tmpBrowser)))
if(filebrowser_get_current_path_isdir(&tmpBrowser))
{
/* if 'filename' is in fact '..' - then pop back directory instead of
* adding '..' to filename path */
@ -1886,7 +1886,7 @@ static void menu_romselect_iterate(filebrowser_t *filebrowser, menu_romselect_ac
switch(action)
{
case MENU_ROMSELECT_ACTION_OK:
if(path_is_directory(filebrowser_get_current_path(filebrowser)))
if(filebrowser_get_current_path_isdir(filebrowser))
{
/*if 'filename' is in fact '..' - then pop back directory instead of adding '..' to filename path */
if(browser.current_dir.ptr == 0)
@ -1942,7 +1942,7 @@ static void select_rom(void)
menu_romselect_iterate(&browser, action);
}
if (path_is_directory(filebrowser_get_current_path(&browser)))
if (filebrowser_get_current_path_isdir(&browser))
{
if(!strcmp(filebrowser_get_current_path(&browser),"app_home") || !strcmp(filebrowser_get_current_path(&browser),"host_root"))
cellDbgFontPrintf(0.09f, 0.83f, 0.91f, RED, "WARNING - This path only works on DEX PS3 systems. Do not attempt to open\n this directory on CEX PS3 systems, or you might have to restart.");

View File

@ -17,14 +17,6 @@
#ifndef _PS3_SHARED_H
#define _PS3_SHARED_H
enum
{
CONFIG_FILE,
SHADER_PRESET_FILE,
INPUT_PRESET_FILE
};
extern char contentInfoPath[PATH_MAX];
extern char usrDirPath[PATH_MAX];
extern char DEFAULT_PRESET_FILE[PATH_MAX];
extern char DEFAULT_BORDER_FILE[PATH_MAX];

View File

@ -16,7 +16,6 @@
#include "../driver.h"
#include "../general.h"
#include "frontend/shared.h"
#include <stdlib.h>
#include <cell/audio.h>
#include <sys/timer.h>

View File

@ -33,7 +33,6 @@
#include "../console/console_ext.h"
#include "../libretro.h"
#include "../general.h"
#include "frontend/shared.h"
/*============================================================
PS3 MOUSE

View File

@ -198,27 +198,23 @@ static void video_frame(const void *data, unsigned width, unsigned height, size_
// Slightly messy code,
// but we really need to do processing before blocking on VSync for best possible scheduling.
bool is_dupe = !data;
#ifdef HAVE_FFMPEG
if (g_extern.recording && (!g_extern.filter.active || !g_settings.video.post_filter_record || is_dupe))
if (g_extern.recording && (!g_extern.filter.active || !g_settings.video.post_filter_record || !data))
{
struct ffemu_video_data ffemu_data = {0};
ffemu_data.data = data;
ffemu_data.pitch = pitch;
ffemu_data.width = width;
ffemu_data.height = height;
ffemu_data.is_dupe = is_dupe;
ffemu_data.is_dupe = !data;
ffemu_push_video(g_extern.rec, &ffemu_data);
}
#endif
if (is_dupe)
return;
const char *msg = msg_queue_pull(g_extern.msg_queue);
#ifdef HAVE_DYLIB
if (g_extern.filter.active)
if (g_extern.filter.active && data)
{
unsigned owidth = width;
unsigned oheight = height;
@ -248,16 +244,12 @@ static void video_frame(const void *data, unsigned width, unsigned height, size_
g_extern.video_active = false;
#endif
g_extern.frame_cache.data = data;
g_extern.frame_cache.width = width;
g_extern.frame_cache.data = data;
g_extern.frame_cache.width = width;
g_extern.frame_cache.height = height;
g_extern.frame_cache.pitch = pitch;
g_extern.frame_cache.pitch = pitch;
}
#ifdef HAVE_GRIFFIN
#include "console/griffin/rarch_func_hooks.h"
#endif
void rarch_render_cached_frame(void)
{
#ifdef HAVE_FFMPEG
@ -279,7 +271,6 @@ void rarch_render_cached_frame(void)
#endif
}
#ifndef HAVE_GRIFFIN_OVERRIDE_AUDIO_FLUSH_FUNC
static bool audio_flush(const int16_t *data, size_t samples)
{
#ifdef HAVE_FFMPEG
@ -302,24 +293,29 @@ static bool audio_flush(const int16_t *data, size_t samples)
audio_convert_s16_to_float(g_extern.audio_data.data, data, samples);
#ifdef HAVE_DYLIB
rarch_dsp_output_t dsp_output = {0};
dsp_output.should_resample = RARCH_TRUE;
#ifdef HAVE_DYLIB
rarch_dsp_input_t dsp_input = {0};
dsp_input.samples = g_extern.audio_data.data;
dsp_input.frames = samples / 2;
if (g_extern.audio_data.dsp_plugin)
g_extern.audio_data.dsp_plugin->process(g_extern.audio_data.dsp_handle, &dsp_output, &dsp_input);
#endif
if (dsp_output.should_resample)
{
#endif
struct resampler_data src_data = {0};
#ifdef HAVE_DYLIB
src_data.data_in = dsp_output.samples ? dsp_output.samples : g_extern.audio_data.data;
src_data.data_out = g_extern.audio_data.outsamples;
src_data.input_frames = dsp_output.samples ? dsp_output.frames : (samples / 2);
#else
src_data.data_in = g_extern.audio_data.data;
src_data.input_frames = (samples / 2);
#endif
src_data.data_out = g_extern.audio_data.outsamples;
if (g_extern.audio_data.rate_control)
readjust_audio_input_rate();
@ -332,8 +328,8 @@ static bool audio_flush(const int16_t *data, size_t samples)
output_data = g_extern.audio_data.outsamples;
output_frames = src_data.output_frames;
}
#ifdef HAVE_DYLIB
}
else
{
output_data = dsp_output.samples;
@ -374,7 +370,6 @@ static bool audio_flush(const int16_t *data, size_t samples)
return true;
}
#endif
static void audio_sample_rewind(int16_t left, int16_t right)
{
@ -1513,6 +1508,9 @@ static void set_savestate_auto_index(void)
if (!g_settings.savestate_auto_index)
return;
// Find the file in the same directory as g_extern.savestate_name with the largest numeral suffix.
// E.g. /foo/path/game.state, will try to find /foo/path/game.state%d, where %d is the largest number available.
char state_path[PATH_MAX];
strlcpy(state_path, g_extern.savestate_name, sizeof(state_path));
@ -1527,22 +1525,23 @@ static void set_savestate_auto_index(void)
*split = '\0';
base = split + 1;
}
else
dir = ".";
unsigned max_index = 0;
char **dir_list = dir_list_new(dir, NULL, false);
struct string_list *dir_list = dir_list_new(dir, NULL, false);
if (!dir_list)
return;
unsigned index = 0;
const char *dir_elem;
while ((dir_elem = dir_list[index++]))
for (size_t i = 0; i < dir_list->size; i++)
{
if (!strstr(dir_elem, base))
const char *dir_elem = dir_list->elems[i].data;
if (strstr(dir_elem, base) != dir_elem)
continue;
const char *end = dir_elem + strlen(dir_elem);
while ((end != dir_elem) && isdigit(end[-1])) end--;
while ((end > dir_elem) && isdigit(end[-1])) end--;
unsigned index = strtoul(end, NULL, 0);
if (index > max_index)
@ -2128,7 +2127,7 @@ static void check_shader_dir(void)
static bool old_pressed_next = false;
static bool old_pressed_prev = false;
if (!g_extern.shader_dir.elems || !driver.video->xml_shader)
if (!g_extern.shader_dir.list || !driver.video->xml_shader)
return;
bool should_apply = false;
@ -2137,20 +2136,20 @@ static void check_shader_dir(void)
if (pressed_next && !old_pressed_next)
{
should_apply = true;
g_extern.shader_dir.ptr = (g_extern.shader_dir.ptr + 1) % g_extern.shader_dir.size;
g_extern.shader_dir.ptr = (g_extern.shader_dir.ptr + 1) % g_extern.shader_dir.list->size;
}
else if (pressed_prev && !old_pressed_prev)
{
should_apply = true;
if (g_extern.shader_dir.ptr == 0)
g_extern.shader_dir.ptr = g_extern.shader_dir.size - 1;
g_extern.shader_dir.ptr = g_extern.shader_dir.list->size - 1;
else
g_extern.shader_dir.ptr--;
}
if (should_apply)
{
const char *shader = g_extern.shader_dir.elems[g_extern.shader_dir.ptr];
const char *shader = g_extern.shader_dir.list->elems[g_extern.shader_dir.ptr].data;
strlcpy(g_settings.video.bsnes_shader_path, shader, sizeof(g_settings.video.bsnes_shader_path));
g_settings.video.shader_type = RARCH_SHADER_BSNES;

View File

@ -16,11 +16,10 @@
#undef main
#include <stdbool.h>
#include "../console/rgui/rgui.h"
#include "../driver.h"
#include "../general.h"
#include "../libretro.h"
#include "driver.h"
#include "rgui.h"
#include "../../driver.h"
#include "../../general.h"
#include "../../libretro.h"
#include <stdlib.h>
#include <stddef.h>