mirror of
https://github.com/libretro/RetroArch
synced 2025-03-25 16:44:01 +00:00
Merge branch 'master' into ratecontrol
This commit is contained in:
commit
744a433595
@ -193,7 +193,7 @@ static void set_default_settings (void)
|
|||||||
|
|
||||||
static void init_settings (void)
|
static void init_settings (void)
|
||||||
{
|
{
|
||||||
if(!filepath_exists(SYS_CONFIG_FILE))
|
if(!path_file_exists(SYS_CONFIG_FILE))
|
||||||
{
|
{
|
||||||
SSNES_ERR("Config file \"%s\" desn't exist. Creating...\n", "game:\\ssnes.cfg");
|
SSNES_ERR("Config file \"%s\" desn't exist. Creating...\n", "game:\\ssnes.cfg");
|
||||||
FILE * f;
|
FILE * f;
|
||||||
@ -219,7 +219,7 @@ static void init_settings (void)
|
|||||||
|
|
||||||
static void save_settings (void)
|
static void save_settings (void)
|
||||||
{
|
{
|
||||||
if(!filepath_exists(SYS_CONFIG_FILE))
|
if(!path_file_exists(SYS_CONFIG_FILE))
|
||||||
{
|
{
|
||||||
FILE * f;
|
FILE * f;
|
||||||
f = fopen(SYS_CONFIG_FILE, "w");
|
f = fopen(SYS_CONFIG_FILE, "w");
|
||||||
@ -363,7 +363,7 @@ begin_loop:
|
|||||||
goto begin_loop;
|
goto begin_loop;
|
||||||
|
|
||||||
begin_shutdown:
|
begin_shutdown:
|
||||||
if(filepath_exists(SYS_CONFIG_FILE))
|
if(path_file_exists(SYS_CONFIG_FILE))
|
||||||
save_settings();
|
save_settings();
|
||||||
xdk360_video_deinit();
|
xdk360_video_deinit();
|
||||||
}
|
}
|
||||||
|
@ -22,6 +22,7 @@
|
|||||||
|
|
||||||
#include "xdk360_video.h"
|
#include "xdk360_video.h"
|
||||||
#include "../general.h"
|
#include "../general.h"
|
||||||
|
#include "../message.h"
|
||||||
|
|
||||||
#ifdef HAVE_CONFIG_H
|
#ifdef HAVE_CONFIG_H
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
@ -71,7 +72,6 @@ static bool g_quitting;
|
|||||||
static bool g_first_msg;
|
static bool g_first_msg;
|
||||||
unsigned g_frame_count;
|
unsigned g_frame_count;
|
||||||
void *g_d3d;
|
void *g_d3d;
|
||||||
Console g_screen_console;
|
|
||||||
|
|
||||||
static void xdk360_gfx_free(void * data)
|
static void xdk360_gfx_free(void * data)
|
||||||
{
|
{
|
||||||
@ -283,12 +283,12 @@ static bool xdk360_gfx_frame(void *data, const void *frame,
|
|||||||
{
|
{
|
||||||
if(IS_TIMER_EXPIRED() || g_first_msg)
|
if(IS_TIMER_EXPIRED() || g_first_msg)
|
||||||
{
|
{
|
||||||
g_screen_console.Format(true, msg);
|
xdk360_console_format(msg);
|
||||||
g_first_msg = 0;
|
g_first_msg = 0;
|
||||||
SET_TIMER_EXPIRATION(60);
|
SET_TIMER_EXPIRATION(30);
|
||||||
}
|
}
|
||||||
|
|
||||||
g_screen_console.Render();
|
xdk360_console_draw();
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!vid->block_swap)
|
if(!vid->block_swap)
|
||||||
@ -363,7 +363,7 @@ void xdk360_video_init(void)
|
|||||||
|
|
||||||
g_first_msg = true;
|
g_first_msg = true;
|
||||||
|
|
||||||
HRESULT hr = g_screen_console.Create("game:\\media\\Arial_12.xpr",
|
HRESULT hr = xdk360_console_init("game:\\media\\Arial_12.xpr",
|
||||||
0xff000000, 0xffffffff );
|
0xff000000, 0xffffffff );
|
||||||
if(FAILED(hr))
|
if(FAILED(hr))
|
||||||
{
|
{
|
||||||
@ -375,6 +375,7 @@ void xdk360_video_deinit(void)
|
|||||||
{
|
{
|
||||||
void *data = g_d3d;
|
void *data = g_d3d;
|
||||||
g_d3d = NULL;
|
g_d3d = NULL;
|
||||||
|
xdk360_console_deinit();
|
||||||
xdk360_gfx_free(data);
|
xdk360_gfx_free(data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -58,7 +58,6 @@ void xdk360_video_init(void);
|
|||||||
void xdk360_video_deinit(void);
|
void xdk360_video_deinit(void);
|
||||||
void xdk360_video_set_vsync(bool vsync);
|
void xdk360_video_set_vsync(bool vsync);
|
||||||
|
|
||||||
extern Console g_screen_console;
|
|
||||||
extern unsigned g_frame_count;
|
extern unsigned g_frame_count;
|
||||||
extern void *g_d3d;
|
extern void *g_d3d;
|
||||||
|
|
||||||
|
@ -23,34 +23,56 @@
|
|||||||
#include "xdk360_video_debugfonts.h"
|
#include "xdk360_video_debugfonts.h"
|
||||||
#include "../general.h"
|
#include "../general.h"
|
||||||
|
|
||||||
Console::Console()
|
static video_console_t video_console;
|
||||||
{
|
static XdkFont m_Font;
|
||||||
first_message = true;
|
|
||||||
m_Buffer = NULL;
|
|
||||||
m_Lines = NULL;
|
|
||||||
m_nScrollOffset = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
Console::~Console()
|
void xdk360_console_draw(void)
|
||||||
{
|
|
||||||
Destroy();
|
|
||||||
}
|
|
||||||
|
|
||||||
HRESULT Console::Create( LPCSTR strFontFileName, unsigned long colBackColor,
|
|
||||||
unsigned long colTextColor, unsigned int nLines )
|
|
||||||
{
|
{
|
||||||
xdk360_video_t *vid = (xdk360_video_t*)g_d3d;
|
xdk360_video_t *vid = (xdk360_video_t*)g_d3d;
|
||||||
D3DDevice *m_pd3dDevice = vid->xdk360_render_device;
|
D3DDevice *m_pd3dDevice = vid->xdk360_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;
|
||||||
|
|
||||||
|
m_Font.Begin();
|
||||||
|
|
||||||
|
for( unsigned int nScreenLine = 0; nScreenLine < video_console.m_cScreenHeight; nScreenLine++ )
|
||||||
|
{
|
||||||
|
m_Font.DrawText( (float)( video_console.m_cxSafeAreaOffset ),
|
||||||
|
(float)( video_console.m_cySafeAreaOffset +
|
||||||
|
video_console.m_fLineHeight * nScreenLine ),
|
||||||
|
video_console.m_colTextColor,
|
||||||
|
video_console.m_Lines[nTextLine] );
|
||||||
|
|
||||||
|
nTextLine = ( nTextLine + 1 ) % video_console.m_cScreenHeightVirtual;
|
||||||
|
}
|
||||||
|
|
||||||
|
m_Font.End();
|
||||||
|
}
|
||||||
|
|
||||||
|
HRESULT xdk360_console_init( LPCSTR strFontFileName, unsigned long colBackColor,
|
||||||
|
unsigned long colTextColor)
|
||||||
|
{
|
||||||
|
xdk360_video_t *vid = (xdk360_video_t*)g_d3d;
|
||||||
|
D3DDevice *m_pd3dDevice = vid->xdk360_render_device;
|
||||||
|
|
||||||
|
video_console.first_message = true;
|
||||||
|
video_console.m_Buffer = NULL;
|
||||||
|
video_console.m_Lines = NULL;
|
||||||
|
video_console.m_nScrollOffset = 0;
|
||||||
|
|
||||||
// Calculate the safe area
|
// Calculate the safe area
|
||||||
unsigned int uiSafeAreaPct = vid->video_mode.fIsHiDef ? SAFE_AREA_PCT_HDTV
|
unsigned int uiSafeAreaPct = vid->video_mode.fIsHiDef ? SAFE_AREA_PCT_HDTV
|
||||||
: SAFE_AREA_PCT_4x3;
|
: SAFE_AREA_PCT_4x3;
|
||||||
|
|
||||||
m_cxSafeArea = ( vid->d3dpp.BackBufferWidth * uiSafeAreaPct ) / 100;
|
video_console.m_cxSafeArea = ( vid->d3dpp.BackBufferWidth * uiSafeAreaPct ) / 100;
|
||||||
m_cySafeArea = ( vid->d3dpp.BackBufferHeight * uiSafeAreaPct ) / 100;
|
video_console.m_cySafeArea = ( vid->d3dpp.BackBufferHeight * uiSafeAreaPct ) / 100;
|
||||||
|
|
||||||
m_cxSafeAreaOffset = ( vid->d3dpp.BackBufferWidth - m_cxSafeArea ) / 2;
|
video_console.m_cxSafeAreaOffset = ( vid->d3dpp.BackBufferWidth - video_console.m_cxSafeArea ) / 2;
|
||||||
m_cySafeAreaOffset = ( vid->d3dpp.BackBufferHeight - m_cySafeArea ) / 2;
|
video_console.m_cySafeAreaOffset = ( vid->d3dpp.BackBufferHeight - video_console.m_cySafeArea ) / 2;
|
||||||
|
|
||||||
// Create the font
|
// Create the font
|
||||||
HRESULT hr = m_Font.Create( strFontFileName );
|
HRESULT hr = m_Font.Create( strFontFileName );
|
||||||
@ -61,136 +83,84 @@ HRESULT Console::Create( LPCSTR strFontFileName, unsigned long colBackColor,
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Save the colors
|
// Save the colors
|
||||||
m_colBackColor = colBackColor;
|
video_console.m_colBackColor = colBackColor;
|
||||||
m_colTextColor = colTextColor;
|
video_console.m_colTextColor = colTextColor;
|
||||||
|
|
||||||
// Calculate the number of lines on the screen
|
// Calculate the number of lines on the screen
|
||||||
float fCharWidth, fCharHeight;
|
float fCharWidth, fCharHeight;
|
||||||
m_Font.GetTextExtent( L"i", &fCharWidth, &fCharHeight, FALSE );
|
m_Font.GetTextExtent( L"i", &fCharWidth, &fCharHeight, FALSE );
|
||||||
|
|
||||||
m_cScreenHeight = (unsigned int)( m_cySafeArea / fCharHeight );
|
video_console.m_cScreenHeight = (unsigned int)( video_console.m_cySafeArea / fCharHeight );
|
||||||
m_cScreenWidth = (unsigned int)( m_cxSafeArea / fCharWidth );
|
video_console.m_cScreenWidth = (unsigned int)( video_console.m_cxSafeArea / fCharWidth );
|
||||||
|
|
||||||
m_cScreenHeightVirtual = max( m_cScreenHeight, nLines );
|
video_console.m_cScreenHeightVirtual = video_console.m_cScreenHeight;
|
||||||
|
|
||||||
m_fLineHeight = fCharHeight;
|
video_console.m_fLineHeight = fCharHeight;
|
||||||
|
|
||||||
// Allocate memory to hold the lines
|
// Allocate memory to hold the lines
|
||||||
m_Buffer = new wchar_t[ m_cScreenHeightVirtual * ( m_cScreenWidth + 1 ) ];
|
video_console.m_Buffer = new wchar_t[ video_console.m_cScreenHeightVirtual * ( video_console.m_cScreenWidth + 1 ) ];
|
||||||
m_Lines = new wchar_t *[ m_cScreenHeightVirtual ];
|
video_console.m_Lines = new wchar_t *[ video_console.m_cScreenHeightVirtual ];
|
||||||
|
|
||||||
// Set the line pointers as indexes into the buffer
|
// Set the line pointers as indexes into the buffer
|
||||||
for( unsigned int i = 0; i < m_cScreenHeightVirtual; i++ )
|
for( unsigned int i = 0; i < video_console.m_cScreenHeightVirtual; i++ )
|
||||||
m_Lines[ i ] = m_Buffer + ( m_cScreenWidth + 1 ) * i;
|
video_console.m_Lines[ i ] = video_console.m_Buffer + ( video_console.m_cScreenWidth + 1 ) * i;
|
||||||
|
|
||||||
m_nCurLine = 0;
|
video_console.m_nCurLine = 0;
|
||||||
m_cCurLineLength = 0;
|
video_console.m_cCurLineLength = 0;
|
||||||
memset( m_Buffer, 0, m_cScreenHeightVirtual * ( m_cScreenWidth + 1 ) * sizeof( wchar_t ) );
|
memset( video_console.m_Buffer, 0, video_console.m_cScreenHeightVirtual * ( video_console.m_cScreenWidth + 1 ) * sizeof( wchar_t ) );
|
||||||
Render();
|
xdk360_console_draw();
|
||||||
|
|
||||||
return hr;
|
return hr;
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------
|
void xdk360_console_deinit()
|
||||||
// Name: Destroy()
|
|
||||||
// Desc: Tear everything down
|
|
||||||
//--------------------------------------------------------------------------------------
|
|
||||||
void Console::Destroy()
|
|
||||||
{
|
{
|
||||||
// Delete the memory we've allocated
|
// Delete the memory we've allocated
|
||||||
if( m_Lines )
|
if(video_console.m_Lines)
|
||||||
{
|
{
|
||||||
delete[] m_Lines;
|
delete[] video_console.m_Lines;
|
||||||
m_Lines = NULL;
|
video_console.m_Lines = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( m_Buffer )
|
if(video_console.m_Buffer)
|
||||||
{
|
{
|
||||||
delete[] m_Buffer;
|
delete[] video_console.m_Buffer;
|
||||||
m_Buffer = NULL;
|
video_console.m_Buffer = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Destroy the font
|
// Destroy the font
|
||||||
m_Font.Destroy();
|
m_Font.Destroy();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void xdk360_console_add( wchar_t wch )
|
||||||
//--------------------------------------------------------------------------------------
|
|
||||||
// Name: Render()
|
|
||||||
// Desc: Render the console to the screen
|
|
||||||
//--------------------------------------------------------------------------------------
|
|
||||||
void Console::Render()
|
|
||||||
{
|
|
||||||
xdk360_video_t *vid = (xdk360_video_t*)g_d3d;
|
|
||||||
D3DDevice *m_pd3dDevice = vid->xdk360_render_device;
|
|
||||||
|
|
||||||
// The top line
|
|
||||||
unsigned int nTextLine = ( m_nCurLine - m_cScreenHeight + m_cScreenHeightVirtual - m_nScrollOffset + 1 )
|
|
||||||
% m_cScreenHeightVirtual;
|
|
||||||
|
|
||||||
m_Font.Begin();
|
|
||||||
|
|
||||||
for( unsigned int nScreenLine = 0; nScreenLine < m_cScreenHeight; nScreenLine++ )
|
|
||||||
{
|
|
||||||
m_Font.DrawText( (float)( m_cxSafeAreaOffset ),
|
|
||||||
(float)( m_cySafeAreaOffset + m_fLineHeight * nScreenLine ),
|
|
||||||
m_colTextColor, m_Lines[nTextLine] );
|
|
||||||
|
|
||||||
nTextLine = ( nTextLine + 1 ) % m_cScreenHeightVirtual;
|
|
||||||
}
|
|
||||||
|
|
||||||
m_Font.End();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------
|
|
||||||
// Name: Add( CHAR )
|
|
||||||
// Desc: Convert ANSI to WCHAR and add to the current line
|
|
||||||
//--------------------------------------------------------------------------------------
|
|
||||||
void Console::Add( char ch )
|
|
||||||
{
|
|
||||||
wchar_t wch;
|
|
||||||
|
|
||||||
int ret = MultiByteToWideChar( CP_ACP, // ANSI code page
|
|
||||||
0, // No flags
|
|
||||||
&ch, // Character to convert
|
|
||||||
1, // Convert one byte
|
|
||||||
&wch, // Target wide character buffer
|
|
||||||
1 ); // One wide character
|
|
||||||
|
|
||||||
Add( wch );
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------
|
|
||||||
// Name: Add( WCHAR )
|
|
||||||
// Desc: Add a wide character to the current line
|
|
||||||
//--------------------------------------------------------------------------------------
|
|
||||||
void Console::Add( wchar_t wch )
|
|
||||||
{
|
{
|
||||||
// If this is a newline, just increment lines and move on
|
// If this is a newline, just increment lines and move on
|
||||||
if( wch == L'\n' )
|
if( wch == L'\n' )
|
||||||
{
|
{
|
||||||
m_nCurLine = ( m_nCurLine + 1 ) % m_cScreenHeightVirtual;
|
video_console.m_nCurLine = ( video_console.m_nCurLine + 1 )
|
||||||
m_cCurLineLength = 0;
|
% video_console.m_cScreenHeightVirtual;
|
||||||
memset( m_Lines[m_nCurLine], 0, ( m_cScreenWidth + 1 ) * sizeof( wchar_t ) );
|
video_console.m_cCurLineLength = 0;
|
||||||
|
memset(video_console.m_Lines[video_console.m_nCurLine], 0,
|
||||||
|
( video_console.m_cScreenWidth + 1 ) * sizeof( wchar_t ) );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
int bIncrementLine = FALSE; // Whether to wrap to the next line
|
int bIncrementLine = FALSE; // Whether to wrap to the next line
|
||||||
|
|
||||||
if( m_cCurLineLength == m_cScreenWidth )
|
if( video_console.m_cCurLineLength == video_console.m_cScreenWidth )
|
||||||
bIncrementLine = TRUE;
|
bIncrementLine = TRUE;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Try to append the character to the line
|
// Try to append the character to the line
|
||||||
m_Lines[ m_nCurLine ][ m_cCurLineLength ] = wch;
|
video_console.m_Lines[ video_console.m_nCurLine ]
|
||||||
|
[ video_console.m_cCurLineLength ] = wch;
|
||||||
|
|
||||||
if( m_Font.GetTextWidth( m_Lines[ m_nCurLine ] ) > m_cxSafeArea )
|
if( m_Font.GetTextWidth( video_console.m_Lines
|
||||||
|
[ video_console.m_nCurLine ] ) > video_console.m_cxSafeArea )
|
||||||
{
|
{
|
||||||
// The line is too long, we need to wrap the character to the next line
|
// The line is too long, we need to wrap the character to the next line
|
||||||
m_Lines[ m_nCurLine][ m_cCurLineLength ] = L'\0';
|
video_console.m_Lines[video_console.m_nCurLine]
|
||||||
|
[ video_console.m_cCurLineLength ] = L'\0';
|
||||||
bIncrementLine = TRUE;
|
bIncrementLine = TRUE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -198,80 +168,64 @@ void Console::Add( wchar_t wch )
|
|||||||
// If we need to skip to the next line, do so
|
// If we need to skip to the next line, do so
|
||||||
if( bIncrementLine )
|
if( bIncrementLine )
|
||||||
{
|
{
|
||||||
m_nCurLine = ( m_nCurLine + 1 ) % m_cScreenHeightVirtual;
|
video_console.m_nCurLine = ( video_console.m_nCurLine + 1 )
|
||||||
m_cCurLineLength = 0;
|
% video_console.m_cScreenHeightVirtual;
|
||||||
memset( m_Lines[m_nCurLine], 0, ( m_cScreenWidth + 1 ) * sizeof( wchar_t ) );
|
video_console.m_cCurLineLength = 0;
|
||||||
m_Lines[ m_nCurLine ][0] = wch;
|
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;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(IS_TIMER_EXPIRED())
|
video_console.m_cCurLineLength++;
|
||||||
m_cCurLineLength++;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void xdk360_console_format(_In_z_ _Printf_format_string_ LPCSTR strFormat, ... )
|
||||||
//--------------------------------------------------------------------------------------
|
|
||||||
// Name: Format()
|
|
||||||
// Desc: Output a variable argument list using a format string
|
|
||||||
//--------------------------------------------------------------------------------------
|
|
||||||
void Console::Format(int clear_screen, _In_z_ _Printf_format_string_ LPCSTR strFormat, ... )
|
|
||||||
{
|
{
|
||||||
if(clear_screen)
|
video_console.m_nCurLine = 0;
|
||||||
{
|
video_console.m_cCurLineLength = 0;
|
||||||
m_nCurLine = 0;
|
memset( video_console.m_Buffer, 0,
|
||||||
m_cCurLineLength = 0;
|
video_console.m_cScreenHeightVirtual *
|
||||||
memset( m_Buffer, 0, m_cScreenHeightVirtual * ( m_cScreenWidth + 1 ) * sizeof( wchar_t ) );
|
( video_console.m_cScreenWidth + 1 ) * sizeof( wchar_t ) );
|
||||||
}
|
|
||||||
|
|
||||||
va_list pArgList;
|
va_list pArgList;
|
||||||
va_start( pArgList, strFormat );
|
va_start( pArgList, strFormat );
|
||||||
FormatV( strFormat, pArgList );
|
|
||||||
va_end( pArgList );
|
// Count the required length of the string
|
||||||
|
unsigned long dwStrLen = _vscprintf( strFormat, pArgList ) + 1;
|
||||||
// Render the output
|
// +1 = null terminator
|
||||||
Render();
|
|
||||||
}
|
|
||||||
|
|
||||||
void Console::Format(int clear_screen, _In_z_ _Printf_format_string_ LPCWSTR wstrFormat, ... )
|
|
||||||
{
|
|
||||||
if(clear_screen)
|
|
||||||
{
|
|
||||||
m_nCurLine = 0;
|
|
||||||
m_cCurLineLength = 0;
|
|
||||||
memset( m_Buffer, 0, m_cScreenHeightVirtual * ( m_cScreenWidth + 1 ) * sizeof( wchar_t ) );
|
|
||||||
}
|
|
||||||
|
|
||||||
va_list pArgList;
|
|
||||||
va_start( pArgList, wstrFormat );
|
|
||||||
FormatV( wstrFormat, pArgList );
|
|
||||||
va_end( pArgList );
|
|
||||||
|
|
||||||
// Render the output
|
|
||||||
Render();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------
|
|
||||||
// Name: FormatV()
|
|
||||||
// Desc: Output a va_list using a format string
|
|
||||||
//--------------------------------------------------------------------------------------
|
|
||||||
void Console::FormatV( _In_z_ _Printf_format_string_ LPCSTR strFormat, va_list pArgList )
|
|
||||||
{
|
|
||||||
// Count the required length of the string
|
|
||||||
unsigned long dwStrLen = _vscprintf( strFormat, pArgList ) + 1; // +1 = null terminator
|
|
||||||
char * strMessage = ( char * )_malloca( dwStrLen );
|
char * strMessage = ( char * )_malloca( dwStrLen );
|
||||||
vsprintf_s( strMessage, dwStrLen, strFormat, pArgList );
|
vsprintf_s( strMessage, dwStrLen, strFormat, pArgList );
|
||||||
|
|
||||||
// Output the string to the console
|
// Output the string to the console
|
||||||
unsigned long uStringLength = strlen( strMessage );
|
unsigned long uStringLength = strlen( strMessage );
|
||||||
for( unsigned long i = 0; i < uStringLength; i++ )
|
for( unsigned long i = 0; i < uStringLength; i++ )
|
||||||
Add( strMessage[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 );
|
||||||
|
}
|
||||||
|
|
||||||
_freea( strMessage );
|
_freea( strMessage );
|
||||||
|
|
||||||
|
va_end( pArgList );
|
||||||
}
|
}
|
||||||
|
|
||||||
void Console::FormatV( _In_z_ _Printf_format_string_ LPCWSTR wstrFormat, va_list pArgList )
|
void xdk360_console_format_w(_In_z_ _Printf_format_string_ LPCWSTR wstrFormat, ... )
|
||||||
{
|
{
|
||||||
// Count the required length of the string
|
video_console.m_nCurLine = 0;
|
||||||
|
video_console.m_cCurLineLength = 0;
|
||||||
|
memset( video_console.m_Buffer, 0, video_console.m_cScreenHeightVirtual
|
||||||
|
* ( video_console.m_cScreenWidth + 1 ) * sizeof( wchar_t ) );
|
||||||
|
|
||||||
|
va_list pArgList;
|
||||||
|
va_start( pArgList, wstrFormat );
|
||||||
|
|
||||||
|
// Count the required length of the string
|
||||||
unsigned long dwStrLen = _vscwprintf( wstrFormat, pArgList ) + 1; // +1 = null terminator
|
unsigned long dwStrLen = _vscwprintf( wstrFormat, pArgList ) + 1; // +1 = null terminator
|
||||||
wchar_t * strMessage = ( wchar_t * )_malloca( dwStrLen * sizeof( wchar_t ) );
|
wchar_t * strMessage = ( wchar_t * )_malloca( dwStrLen * sizeof( wchar_t ) );
|
||||||
vswprintf_s( strMessage, dwStrLen, wstrFormat, pArgList );
|
vswprintf_s( strMessage, dwStrLen, wstrFormat, pArgList );
|
||||||
@ -279,7 +233,9 @@ void Console::FormatV( _In_z_ _Printf_format_string_ LPCWSTR wstrFormat, va_list
|
|||||||
// Output the string to the console
|
// Output the string to the console
|
||||||
unsigned long uStringLength = wcslen( strMessage );
|
unsigned long uStringLength = wcslen( strMessage );
|
||||||
for( unsigned long i = 0; i < uStringLength; i++ )
|
for( unsigned long i = 0; i < uStringLength; i++ )
|
||||||
Add( strMessage[i] );
|
xdk360_console_add( strMessage[i] );
|
||||||
|
|
||||||
_freea( strMessage );
|
_freea( strMessage );
|
||||||
}
|
|
||||||
|
va_end( pArgList );
|
||||||
|
}
|
@ -32,62 +32,30 @@
|
|||||||
#define SAFE_AREA_PCT_4x3 85
|
#define SAFE_AREA_PCT_4x3 85
|
||||||
#define SAFE_AREA_PCT_HDTV 90
|
#define SAFE_AREA_PCT_HDTV 90
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------
|
typedef struct
|
||||||
// Name: class Console
|
|
||||||
// Desc: Class to implement the console.
|
|
||||||
//--------------------------------------------------------------------------------------
|
|
||||||
class Console
|
|
||||||
{
|
{
|
||||||
public:
|
float m_fLineHeight; // height of a single line in pixels
|
||||||
Console();
|
unsigned int m_nScrollOffset; // offset to display text (in lines)
|
||||||
~Console();
|
unsigned int first_message;
|
||||||
|
unsigned int m_cxSafeArea;
|
||||||
// Initialization
|
|
||||||
HRESULT Create( LPCSTR strFontFileName,
|
|
||||||
D3DCOLOR colBackColor,
|
|
||||||
D3DCOLOR colTextColor,
|
|
||||||
unsigned int nLines = 0 );
|
|
||||||
|
|
||||||
void Destroy();
|
|
||||||
|
|
||||||
// Console output
|
|
||||||
void Format(int clear_screen, _In_z_ _Printf_format_string_ LPCSTR strFormat, ... );
|
|
||||||
void Format(int clear_screen, _In_z_ _Printf_format_string_ LPCWSTR wstrFormat, ... );
|
|
||||||
void FormatV( _In_z_ _Printf_format_string_ LPCSTR strFormat, va_list pArgList );
|
|
||||||
void FormatV( _In_z_ _Printf_format_string_ LPCWSTR wstrFormat, va_list pArgList );
|
|
||||||
|
|
||||||
// method for rendering the console
|
|
||||||
void Render();
|
|
||||||
// Font for rendering text
|
|
||||||
XdkFont m_Font;
|
|
||||||
private:
|
|
||||||
int first_message;
|
|
||||||
// Safe area dimensions
|
|
||||||
unsigned int m_cxSafeArea;
|
|
||||||
unsigned int m_cySafeArea;
|
unsigned int m_cySafeArea;
|
||||||
|
|
||||||
unsigned int m_cxSafeAreaOffset;
|
unsigned int m_cxSafeAreaOffset;
|
||||||
unsigned int m_cySafeAreaOffset;
|
unsigned int m_cySafeAreaOffset;
|
||||||
|
unsigned int m_nCurLine; // index of current line being written to
|
||||||
// Colors
|
unsigned int m_cCurLineLength; // length of the current line
|
||||||
unsigned long m_colBackColor;
|
unsigned long m_colBackColor;
|
||||||
unsigned long m_colTextColor;
|
unsigned long m_colTextColor;
|
||||||
|
unsigned int m_cScreenHeight; // height in lines of screen area
|
||||||
// Text Buffers
|
|
||||||
unsigned int m_cScreenHeight; // height in lines of screen area
|
|
||||||
unsigned int m_cScreenHeightVirtual; // height in lines of text storage buffer
|
unsigned int m_cScreenHeightVirtual; // height in lines of text storage buffer
|
||||||
unsigned int m_cScreenWidth; // width in characters
|
unsigned int m_cScreenWidth; // width in characters
|
||||||
float m_fLineHeight; // height of a single line in pixels
|
wchar_t * m_Buffer; // buffer big enough to hold a full screen
|
||||||
|
wchar_t ** m_Lines; // pointers to individual lines
|
||||||
|
} video_console_t;
|
||||||
|
|
||||||
wchar_t * m_Buffer; // buffer big enough to hold a full screen
|
HRESULT xdk360_console_init ( LPCSTR strFontFileName, D3DCOLOR colBackColor, D3DCOLOR colTextColor);
|
||||||
wchar_t ** m_Lines; // pointers to individual lines
|
void xdk360_console_deinit (void);
|
||||||
unsigned int m_nCurLine; // index of current line being written to
|
void xdk360_console_format (_In_z_ _Printf_format_string_ LPCSTR strFormat, ... );
|
||||||
unsigned int m_cCurLineLength; // length of the current line
|
void xdk360_console_format_w (_In_z_ _Printf_format_string_ LPCWSTR wstrFormat, ... );
|
||||||
int m_nScrollOffset; // offset to display text (in lines)
|
void xdk360_console_draw (void);
|
||||||
|
|
||||||
// Add a character to the current line
|
|
||||||
void Add( char ch );
|
|
||||||
void Add( wchar_t wch );
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -471,8 +471,6 @@ float XdkFont::GetTextWidth( const wchar_t * strText ) const
|
|||||||
//--------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------
|
||||||
VOID XdkFont::Begin()
|
VOID XdkFont::Begin()
|
||||||
{
|
{
|
||||||
PIXBeginNamedEvent( 0, "Text Rendering" );
|
|
||||||
|
|
||||||
// Set state on the first call
|
// Set state on the first call
|
||||||
if( m_dwNestedBeginCount == 0 )
|
if( m_dwNestedBeginCount == 0 )
|
||||||
{
|
{
|
||||||
@ -555,9 +553,9 @@ VOID XdkFont::Begin()
|
|||||||
// Desc: Draws text as textured polygons
|
// Desc: Draws text as textured polygons
|
||||||
//--------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------
|
||||||
VOID XdkFont::DrawText( unsigned long dwColor, const wchar_t * strText,
|
VOID XdkFont::DrawText( unsigned long dwColor, const wchar_t * strText,
|
||||||
unsigned long dwFlags, float fMaxPixelWidth )
|
float fMaxPixelWidth )
|
||||||
{
|
{
|
||||||
DrawText( m_fCursorX, m_fCursorY, dwColor, strText, dwFlags, fMaxPixelWidth );
|
DrawText( m_fCursorX, m_fCursorY, dwColor, strText, fMaxPixelWidth );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -568,20 +566,13 @@ VOID XdkFont::DrawText( unsigned long dwColor, const wchar_t * strText,
|
|||||||
// becomes available.
|
// becomes available.
|
||||||
//--------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------
|
||||||
VOID XdkFont::DrawText( float fOriginX, float fOriginY, unsigned long dwColor,
|
VOID XdkFont::DrawText( float fOriginX, float fOriginY, unsigned long dwColor,
|
||||||
const wchar_t * strText, unsigned long dwFlags, float fMaxPixelWidth )
|
const wchar_t * strText, float fMaxPixelWidth )
|
||||||
{
|
{
|
||||||
if( strText == NULL )
|
if( strText == NULL || strText[0] == L'\0')
|
||||||
return;
|
|
||||||
if( L'\0' == strText[0] )
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
xdk360_video_t *vid = (xdk360_video_t*)g_d3d;
|
xdk360_video_t *vid = (xdk360_video_t*)g_d3d;
|
||||||
D3DDevice *pd3dDevice = vid->xdk360_render_device;
|
D3DDevice *pd3dDevice = vid->xdk360_render_device;
|
||||||
|
|
||||||
// Create a PIX user-defined event that encapsulates all of the text draw calls.
|
|
||||||
// This makes DrawText calls easier to recognize in PIX captures, and it makes
|
|
||||||
// them take up fewer entries in the event list.
|
|
||||||
PIXBeginNamedEvent( dwColor, "DrawText: %S", strText );
|
|
||||||
|
|
||||||
// Set the color as a vertex shader constant
|
// Set the color as a vertex shader constant
|
||||||
float vColor[4];
|
float vColor[4];
|
||||||
@ -599,10 +590,10 @@ VOID XdkFont::DrawText( float fOriginX, float fOriginY, unsigned long dwColor,
|
|||||||
pd3dDevice->SetVertexShaderConstantF( 1, vColor, 1 );
|
pd3dDevice->SetVertexShaderConstantF( 1, vColor, 1 );
|
||||||
|
|
||||||
// Set the starting screen position
|
// Set the starting screen position
|
||||||
if( ( fOriginX < 0.0f ) || ( ( dwFlags & FONT_RIGHT ) && ( fOriginX <= 0.0f ) ) )
|
if((fOriginX < 0.0f))
|
||||||
fOriginX += ( m_rcWindow.x2 - m_rcWindow.x1 );
|
fOriginX += m_rcWindow.x2;
|
||||||
if( fOriginY < 0.0f )
|
if( fOriginY < 0.0f )
|
||||||
fOriginY += ( m_rcWindow.y2 - m_rcWindow.y1 );
|
fOriginY += m_rcWindow.y2;
|
||||||
|
|
||||||
m_fCursorX = floorf( fOriginX );
|
m_fCursorX = floorf( fOriginX );
|
||||||
m_fCursorY = floorf( fOriginY );
|
m_fCursorY = floorf( fOriginY );
|
||||||
@ -610,46 +601,14 @@ VOID XdkFont::DrawText( float fOriginX, float fOriginY, unsigned long dwColor,
|
|||||||
// Adjust for padding
|
// Adjust for padding
|
||||||
fOriginY -= m_fFontTopPadding;
|
fOriginY -= m_fFontTopPadding;
|
||||||
|
|
||||||
float fEllipsesPixelWidth = m_fXScaleFactor * 3.0f * ( m_Glyphs[m_TranslatorTable[L'.']].wOffset +
|
|
||||||
m_Glyphs[m_TranslatorTable[L'.']].wAdvance );
|
|
||||||
|
|
||||||
if( dwFlags & FONT_TRUNCATED )
|
|
||||||
{
|
|
||||||
// Check if we will really need to truncate the string
|
|
||||||
if( fMaxPixelWidth <= 0.0f )
|
|
||||||
dwFlags &= ( ~FONT_TRUNCATED );
|
|
||||||
else
|
|
||||||
{
|
|
||||||
float w, h;
|
|
||||||
GetTextExtent( strText, &w, &h, TRUE );
|
|
||||||
|
|
||||||
// If not, then clear the flag
|
|
||||||
if( w <= fMaxPixelWidth )
|
|
||||||
dwFlags &= ( ~FONT_TRUNCATED );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// If vertically centered, offset the starting m_fCursorY value
|
|
||||||
if( dwFlags & FONT_CENTER_Y )
|
|
||||||
{
|
|
||||||
float w, h;
|
|
||||||
GetTextExtent( strText, &w, &h );
|
|
||||||
m_fCursorY = floorf( m_fCursorY - (h * 0.5f) );
|
|
||||||
}
|
|
||||||
|
|
||||||
// Add window offsets
|
// Add window offsets
|
||||||
float Winx = static_cast<float>(m_rcWindow.x1);
|
float Winx = 0.0f;
|
||||||
float Winy = static_cast<float>(m_rcWindow.y1);
|
float Winy = 0.0f;
|
||||||
fOriginX += Winx;
|
fOriginX += Winx;
|
||||||
fOriginY += Winy;
|
fOriginY += Winy;
|
||||||
m_fCursorX += Winx;
|
m_fCursorX += Winx;
|
||||||
m_fCursorY += Winy;
|
m_fCursorY += Winy;
|
||||||
|
|
||||||
// Set a flag so we can determine initial justification effects
|
|
||||||
BOOL bStartingNewLine = TRUE;
|
|
||||||
|
|
||||||
unsigned long dwNumEllipsesToDraw = 0;
|
|
||||||
|
|
||||||
// Begin drawing the vertices
|
// Begin drawing the vertices
|
||||||
|
|
||||||
// Declared as volatile to force writing in ascending
|
// Declared as volatile to force writing in ascending
|
||||||
@ -658,7 +617,7 @@ VOID XdkFont::DrawText( float fOriginX, float fOriginY, unsigned long dwColor,
|
|||||||
|
|
||||||
volatile float * pVertex;
|
volatile float * pVertex;
|
||||||
|
|
||||||
unsigned long dwNumChars = wcslen( strText ) + ( dwFlags & FONT_TRUNCATED ? 3 : 0 );
|
unsigned long dwNumChars = wcslen(strText);
|
||||||
HRESULT hr = pd3dDevice->BeginVertices( D3DPT_QUADLIST, 4 * dwNumChars, sizeof( XMFLOAT4 ) ,
|
HRESULT hr = pd3dDevice->BeginVertices( D3DPT_QUADLIST, 4 * dwNumChars, sizeof( XMFLOAT4 ) ,
|
||||||
( VOID** )&pVertex );
|
( VOID** )&pVertex );
|
||||||
// The ring buffer may run out of space when tiling, doing z-prepasses,
|
// The ring buffer may run out of space when tiling, doing z-prepasses,
|
||||||
@ -666,51 +625,20 @@ VOID XdkFont::DrawText( float fOriginX, float fOriginY, unsigned long dwColor,
|
|||||||
if( FAILED( hr ) )
|
if( FAILED( hr ) )
|
||||||
SSNES_ERR( "Ring buffer out of memory.\n" );
|
SSNES_ERR( "Ring buffer out of memory.\n" );
|
||||||
|
|
||||||
bStartingNewLine = TRUE;
|
|
||||||
|
|
||||||
// Draw four vertices for each glyph
|
// Draw four vertices for each glyph
|
||||||
while( *strText )
|
while( *strText )
|
||||||
{
|
{
|
||||||
wchar_t letter;
|
wchar_t letter;
|
||||||
|
|
||||||
if( dwNumEllipsesToDraw )
|
// Get the current letter in the string
|
||||||
letter = L'.';
|
letter = *strText++;
|
||||||
else
|
|
||||||
|
// Handle the newline character
|
||||||
|
if( letter == L'\n' )
|
||||||
{
|
{
|
||||||
// If starting text on a new line, determine justification effects
|
m_fCursorX = fOriginX;
|
||||||
if( bStartingNewLine )
|
m_fCursorY += m_fFontYAdvance * m_fYScaleFactor;
|
||||||
{
|
continue;
|
||||||
if( dwFlags & ( FONT_RIGHT | FONT_CENTER_X ) )
|
|
||||||
{
|
|
||||||
// Get the extent of this line
|
|
||||||
float w, h;
|
|
||||||
GetTextExtent( strText, &w, &h, TRUE );
|
|
||||||
|
|
||||||
// Offset this line's starting m_fCursorX value
|
|
||||||
if( dwFlags & FONT_RIGHT )
|
|
||||||
m_fCursorX = floorf( fOriginX - w );
|
|
||||||
if( dwFlags & FONT_CENTER_X )
|
|
||||||
m_fCursorX = floorf( fOriginX - w * 0.5f );
|
|
||||||
}
|
|
||||||
bStartingNewLine = FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Get the current letter in the string
|
|
||||||
letter = *strText++;
|
|
||||||
|
|
||||||
// Handle the newline character
|
|
||||||
if( letter == L'\n' )
|
|
||||||
{
|
|
||||||
m_fCursorX = fOriginX;
|
|
||||||
m_fCursorY += m_fFontYAdvance * m_fYScaleFactor;
|
|
||||||
bStartingNewLine = TRUE;
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Handle carriage return characters by ignoring them. This helps when
|
|
||||||
// displaying text from a file.
|
|
||||||
if( letter == L'\r' )
|
|
||||||
continue;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Translate unprintable characters
|
// Translate unprintable characters
|
||||||
@ -721,20 +649,6 @@ VOID XdkFont::DrawText( float fOriginX, float fOriginY, unsigned long dwColor,
|
|||||||
float fWidth = m_fXScaleFactor * (float)pGlyph->wWidth;
|
float fWidth = m_fXScaleFactor * (float)pGlyph->wWidth;
|
||||||
float fHeight = m_fYScaleFactor * m_fFontHeight;
|
float fHeight = m_fYScaleFactor * m_fFontHeight;
|
||||||
|
|
||||||
if( 0 == dwNumEllipsesToDraw )
|
|
||||||
{
|
|
||||||
if( dwFlags & FONT_TRUNCATED )
|
|
||||||
{
|
|
||||||
// Check if we will be exceeded the max allowed width
|
|
||||||
if( m_fCursorX + fOffset + fWidth + fEllipsesPixelWidth > fOriginX + fMaxPixelWidth )
|
|
||||||
{
|
|
||||||
// Yup, draw the three ellipses dots instead
|
|
||||||
dwNumEllipsesToDraw = 3;
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Setup the screen coordinates
|
// Setup the screen coordinates
|
||||||
m_fCursorX += fOffset;
|
m_fCursorX += fOffset;
|
||||||
float X4 = m_fCursorX;
|
float X4 = m_fCursorX;
|
||||||
@ -795,13 +709,6 @@ VOID XdkFont::DrawText( float fOriginX, float fOriginY, unsigned long dwColor,
|
|||||||
reinterpret_cast<volatile unsigned long *>(pVertex)[15] = dwChannelSelector;
|
reinterpret_cast<volatile unsigned long *>(pVertex)[15] = dwChannelSelector;
|
||||||
pVertex+=16;
|
pVertex+=16;
|
||||||
|
|
||||||
// If drawing ellipses, exit when they're all drawn
|
|
||||||
if( dwNumEllipsesToDraw )
|
|
||||||
{
|
|
||||||
if( --dwNumEllipsesToDraw == 0 )
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
dwNumChars--;
|
dwNumChars--;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -838,9 +745,6 @@ VOID XdkFont::DrawText( float fOriginX, float fOriginY, unsigned long dwColor,
|
|||||||
|
|
||||||
// Call End() to complete the begin/end pair for drawing text
|
// Call End() to complete the begin/end pair for drawing text
|
||||||
End();
|
End();
|
||||||
|
|
||||||
// Close off the user-defined event opened with PIXBeginNamedEvent.
|
|
||||||
PIXEndNamedEvent();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -851,10 +755,7 @@ VOID XdkFont::DrawText( float fOriginX, float fOriginY, unsigned long dwColor,
|
|||||||
VOID XdkFont::End()
|
VOID XdkFont::End()
|
||||||
{
|
{
|
||||||
if( --m_dwNestedBeginCount > 0 )
|
if( --m_dwNestedBeginCount > 0 )
|
||||||
{
|
|
||||||
PIXEndNamedEvent();
|
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
|
|
||||||
// Restore state
|
// Restore state
|
||||||
if( m_bSaveState )
|
if( m_bSaveState )
|
||||||
@ -884,6 +785,4 @@ VOID XdkFont::End()
|
|||||||
pD3dDevice->SetSamplerState( 0, D3DSAMP_ADDRESSU, m_dwSavedState[ SAVEDSTATE_D3DSAMP_ADDRESSU ] );
|
pD3dDevice->SetSamplerState( 0, D3DSAMP_ADDRESSU, m_dwSavedState[ SAVEDSTATE_D3DSAMP_ADDRESSU ] );
|
||||||
pD3dDevice->SetSamplerState( 0, D3DSAMP_ADDRESSV, m_dwSavedState[ SAVEDSTATE_D3DSAMP_ADDRESSV ] );
|
pD3dDevice->SetSamplerState( 0, D3DSAMP_ADDRESSV, m_dwSavedState[ SAVEDSTATE_D3DSAMP_ADDRESSV ] );
|
||||||
}
|
}
|
||||||
|
|
||||||
PIXEndNamedEvent();
|
|
||||||
}
|
}
|
@ -30,12 +30,6 @@ typedef struct GLYPH_ATTR
|
|||||||
unsigned short wMask; // Channel mask
|
unsigned short wMask; // Channel mask
|
||||||
} GLYPH_ATTR;
|
} GLYPH_ATTR;
|
||||||
|
|
||||||
#define FONT_LEFT 0x00000000
|
|
||||||
#define FONT_RIGHT 0x00000001
|
|
||||||
#define FONT_CENTER_X 0x00000002
|
|
||||||
#define FONT_CENTER_Y 0x00000004
|
|
||||||
#define FONT_TRUNCATED 0x00000008
|
|
||||||
|
|
||||||
enum SavedStates
|
enum SavedStates
|
||||||
{
|
{
|
||||||
SAVEDSTATE_D3DRS_ALPHABLENDENABLE,
|
SAVEDSTATE_D3DRS_ALPHABLENDENABLE,
|
||||||
@ -72,17 +66,17 @@ public:
|
|||||||
float m_fXScaleFactor; // Scaling constants
|
float m_fXScaleFactor; // Scaling constants
|
||||||
float m_fYScaleFactor;
|
float m_fYScaleFactor;
|
||||||
|
|
||||||
D3DRECT m_rcWindow; // Bounds rect if the text window, modify via accessors only!
|
D3DRECT m_rcWindow; // Bounds rect of the text window, modify via accessors only!
|
||||||
float m_fCursorX; // Current text cursor
|
float m_fCursorX; // Current text cursor
|
||||||
float m_fCursorY;
|
float m_fCursorY;
|
||||||
|
|
||||||
// Translator table for supporting unicode ranges
|
// Translator table for supporting unicode ranges
|
||||||
unsigned long m_cMaxGlyph; // Number of entries in the translator table
|
unsigned long m_cMaxGlyph; // Number of entries in the translator table
|
||||||
wchar_t * m_TranslatorTable; // ASCII to glyph lookup table
|
wchar_t * m_TranslatorTable; // ASCII to glyph lookup table
|
||||||
|
|
||||||
// Glyph data for the font
|
// Glyph data for the font
|
||||||
unsigned long m_dwNumGlyphs; // Number of valid glyphs
|
unsigned long m_dwNumGlyphs; // Number of valid glyphs
|
||||||
const GLYPH_ATTR* m_Glyphs; // Array of glyphs
|
const GLYPH_ATTR* m_Glyphs; // Array of glyphs
|
||||||
|
|
||||||
// D3D rendering objects
|
// D3D rendering objects
|
||||||
D3DTexture* m_pFontTexture;
|
D3DTexture* m_pFontTexture;
|
||||||
@ -110,10 +104,10 @@ public:
|
|||||||
// performance, they should batch multiple calls together, bracketed by calls to
|
// performance, they should batch multiple calls together, bracketed by calls to
|
||||||
// Begin() and End().
|
// Begin() and End().
|
||||||
void Begin();
|
void Begin();
|
||||||
void DrawText( unsigned long dwColor, const wchar_t * strText, unsigned long dwFlags=0L,
|
void DrawText( unsigned long dwColor, const wchar_t * strText,
|
||||||
float fMaxPixelWidth = 0.0f );
|
float fMaxPixelWidth = 0.0f );
|
||||||
void DrawText( float sx, float sy, unsigned long dwColor, const wchar_t * strText,
|
void DrawText( float sx, float sy, unsigned long dwColor,
|
||||||
unsigned long dwFlags=0L, float fMaxPixelWidth = 0.0f );
|
const wchar_t * strText, float fMaxPixelWidth = 0.0f );
|
||||||
void End();
|
void End();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -160,9 +160,6 @@ HRESULT PackedResource::Create( const char * strFilename )
|
|||||||
D3DTexture* pTexture = ( D3DTexture* )&m_pSysMemData[m_pResourceTags[i].dwOffset];
|
D3DTexture* pTexture = ( D3DTexture* )&m_pSysMemData[m_pResourceTags[i].dwOffset];
|
||||||
// Adjust Base address according to where memory was allocated
|
// Adjust Base address according to where memory was allocated
|
||||||
XGOffsetBaseTextureAddress( pTexture, m_pVidMemData, m_pVidMemData );
|
XGOffsetBaseTextureAddress( pTexture, m_pVidMemData, m_pVidMemData );
|
||||||
|
|
||||||
// Let PIX know the name of the texture
|
|
||||||
PIXSetTextureName(pTexture, m_pResourceTags[i].strName);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
4
file.c
4
file.c
@ -555,9 +555,7 @@ static char *load_xml_map(const char *path)
|
|||||||
char *xml_buf = NULL;
|
char *xml_buf = NULL;
|
||||||
if (*path)
|
if (*path)
|
||||||
{
|
{
|
||||||
if (!read_file_string(path, &xml_buf))
|
if (read_file_string(path, &xml_buf))
|
||||||
SSNES_LOG("Did not find XML memory map in \"%s\"\n", path);
|
|
||||||
else
|
|
||||||
SSNES_LOG("Found XML memory map in \"%s\"\n", path);
|
SSNES_LOG("Found XML memory map in \"%s\"\n", path);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
30
ps3/menu.c
30
ps3/menu.c
@ -1650,21 +1650,14 @@ static void ingame_menu(uint32_t menu_id)
|
|||||||
}
|
}
|
||||||
if(CTRL_LEFT(state) || CTRL_LSTICK_LEFT(state))
|
if(CTRL_LEFT(state) || CTRL_LSTICK_LEFT(state))
|
||||||
{
|
{
|
||||||
if(g_extern.state_slot > 0)
|
ssnes_state_slot_decrease();
|
||||||
{
|
set_text_message("", 30);
|
||||||
char msg[512];
|
|
||||||
g_extern.state_slot--;
|
|
||||||
snprintf(msg, sizeof(msg), "Save state slot changed to: #%d", g_extern.state_slot);
|
|
||||||
set_text_message(msg, 30);
|
|
||||||
}
|
|
||||||
blocking = 0;
|
blocking = 0;
|
||||||
}
|
}
|
||||||
if(CTRL_RIGHT(state) || CTRL_LSTICK_RIGHT(state))
|
if(CTRL_RIGHT(state) || CTRL_LSTICK_RIGHT(state))
|
||||||
{
|
{
|
||||||
char msg[512];
|
ssnes_state_slot_increase();
|
||||||
g_extern.state_slot++;
|
set_text_message("", 30);
|
||||||
snprintf(msg, sizeof(msg), "Save state slot changed to: #%d", g_extern.state_slot);
|
|
||||||
set_text_message(msg, 30);
|
|
||||||
blocking = 0;
|
blocking = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1678,21 +1671,14 @@ static void ingame_menu(uint32_t menu_id)
|
|||||||
}
|
}
|
||||||
if(CTRL_LEFT(state) || CTRL_LSTICK_LEFT(state))
|
if(CTRL_LEFT(state) || CTRL_LSTICK_LEFT(state))
|
||||||
{
|
{
|
||||||
if(g_extern.state_slot > 0)
|
ssnes_state_slot_decrease();
|
||||||
{
|
set_text_message("", 30);
|
||||||
char msg[512];
|
|
||||||
g_extern.state_slot--;
|
|
||||||
snprintf(msg, sizeof(msg), "Save state slot changed to: #%d", g_extern.state_slot);
|
|
||||||
set_text_message(msg, 30);
|
|
||||||
}
|
|
||||||
blocking = 0;
|
blocking = 0;
|
||||||
}
|
}
|
||||||
if(CTRL_RIGHT(state) || CTRL_LSTICK_RIGHT(state))
|
if(CTRL_RIGHT(state) || CTRL_LSTICK_RIGHT(state))
|
||||||
{
|
{
|
||||||
char msg[512];
|
ssnes_state_slot_increase();
|
||||||
g_extern.state_slot++;
|
set_text_message("", 30);
|
||||||
snprintf(msg, sizeof(msg), "Save state slot changed to: #%d", g_extern.state_slot);
|
|
||||||
set_text_message(msg, 30);
|
|
||||||
blocking = 0;
|
blocking = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -418,17 +418,6 @@ static inline void gl_compute_fbo_geometry(gl_t *gl, unsigned width, unsigned he
|
|||||||
gl->render_to_tex = true; \
|
gl->render_to_tex = true; \
|
||||||
set_viewport(gl, gl->fbo_rect[0].img_width, gl->fbo_rect[0].img_height, true);
|
set_viewport(gl, gl->fbo_rect[0].img_width, gl->fbo_rect[0].img_height, true);
|
||||||
|
|
||||||
static inline unsigned get_alignment(unsigned pitch)
|
|
||||||
{
|
|
||||||
if (pitch & 1)
|
|
||||||
return 1;
|
|
||||||
if (pitch & 2)
|
|
||||||
return 2;
|
|
||||||
if (pitch & 4)
|
|
||||||
return 4;
|
|
||||||
return 8;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void set_viewport(gl_t *gl, unsigned width, unsigned height, bool force_full)
|
static void set_viewport(gl_t *gl, unsigned width, unsigned height, bool force_full)
|
||||||
{
|
{
|
||||||
uint32_t m_viewport_x_temp, m_viewport_y_temp, m_viewport_width_temp, m_viewport_height_temp;
|
uint32_t m_viewport_x_temp, m_viewport_y_temp, m_viewport_width_temp, m_viewport_height_temp;
|
||||||
@ -496,7 +485,7 @@ static void set_viewport(gl_t *gl, unsigned width, unsigned height, bool force_f
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void set_lut_texture_coords(const GLfloat *coords)
|
static void set_lut_texture_coords(const GLfloat *coords)
|
||||||
{
|
{
|
||||||
// For texture images.
|
// For texture images.
|
||||||
pglClientActiveTexture(GL_TEXTURE1);
|
pglClientActiveTexture(GL_TEXTURE1);
|
||||||
@ -505,13 +494,11 @@ static inline void set_lut_texture_coords(const GLfloat *coords)
|
|||||||
pglClientActiveTexture(GL_TEXTURE0);
|
pglClientActiveTexture(GL_TEXTURE0);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void set_texture_coords(GLfloat *coords, GLfloat xamt, GLfloat yamt)
|
#define set_texture_coords(coords, xamt, yamt) \
|
||||||
{
|
coords[1] = yamt; \
|
||||||
coords[1] = yamt;
|
coords[4] = xamt; \
|
||||||
coords[4] = xamt;
|
coords[6] = xamt; \
|
||||||
coords[6] = xamt;
|
|
||||||
coords[7] = yamt;
|
coords[7] = yamt;
|
||||||
}
|
|
||||||
|
|
||||||
void gl_frame_menu (void)
|
void gl_frame_menu (void)
|
||||||
{
|
{
|
||||||
@ -1293,7 +1280,7 @@ void ps3graphics_set_aspect_ratio(uint32_t aspectratio_index)
|
|||||||
strlcpy(g_console.aspect_ratio_name, "8:7", sizeof(g_console.aspect_ratio_name));
|
strlcpy(g_console.aspect_ratio_name, "8:7", sizeof(g_console.aspect_ratio_name));
|
||||||
break;
|
break;
|
||||||
case ASPECT_RATIO_16_9:
|
case ASPECT_RATIO_16_9:
|
||||||
g_settings.video.aspect_ratio = 1.77777777777;
|
g_settings.video.aspect_ratio = 1.777778;
|
||||||
strlcpy(g_console.aspect_ratio_name, "16:9", sizeof(g_console.aspect_ratio_name));
|
strlcpy(g_console.aspect_ratio_name, "16:9", sizeof(g_console.aspect_ratio_name));
|
||||||
break;
|
break;
|
||||||
case ASPECT_RATIO_16_10:
|
case ASPECT_RATIO_16_10:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user