GTK GUI :

- Fixed some warnings
- Uninitialized memory should not be displayed anymore instead of a black screen
This commit is contained in:
bgk 2008-04-27 16:54:42 +00:00
parent 66dd396d85
commit 5c4600e4fc
6 changed files with 20 additions and 14 deletions

View File

@ -139,6 +139,7 @@ void ScreenAreaCairo::vUpdateSize()
m_puiPixels = new u32[(m_iScaledWidth + 1) * m_iScaledHeight]; m_puiPixels = new u32[(m_iScaledWidth + 1) * m_iScaledHeight];
m_puiDelta = new u8[(m_iWidth + 2) * (m_iHeight + 2) * sizeof(u32)]; m_puiDelta = new u8[(m_iWidth + 2) * (m_iHeight + 2) * sizeof(u32)];
memset(m_puiPixels, 0, (m_iScaledWidth + 1) * m_iScaledHeight * sizeof(u32));
memset(m_puiDelta, 255, (m_iWidth + 2) * (m_iHeight + 2) * sizeof(u32)); memset(m_puiDelta, 255, (m_iWidth + 2) * (m_iHeight + 2) * sizeof(u32));
set_size_request(m_iScale * m_iWidth, m_iScale * m_iHeight); set_size_request(m_iScale * m_iWidth, m_iScale * m_iHeight);

View File

@ -28,10 +28,10 @@ template<typename T> T max( T x, T y ) { return x > y ? x : y; }
ScreenAreaGl::ScreenAreaGl(int _iWidth, int _iHeight, int _iScale) : ScreenAreaGl::ScreenAreaGl(int _iWidth, int _iHeight, int _iScale) :
ScreenArea(_iWidth, _iHeight, _iScale), ScreenArea(_iWidth, _iHeight, _iScale),
m_puiPixels(NULL),
m_puiDelta(NULL),
m_iScaledWidth(_iWidth), m_iScaledWidth(_iWidth),
m_iScaledHeight(_iHeight) m_iScaledHeight(_iHeight),
m_puiPixels(NULL),
m_puiDelta(NULL)
{ {
Glib::RefPtr<Gdk::GL::Config> glconfig; Glib::RefPtr<Gdk::GL::Config> glconfig;
@ -135,6 +135,7 @@ void ScreenAreaGl::vUpdateSize()
m_puiPixels = new u32[(m_iScaledWidth + 1) * m_iScaledHeight]; m_puiPixels = new u32[(m_iScaledWidth + 1) * m_iScaledHeight];
m_puiDelta = new u8[(m_iWidth + 2) * (m_iHeight + 2) * sizeof(u32)]; m_puiDelta = new u8[(m_iWidth + 2) * (m_iHeight + 2) * sizeof(u32)];
memset(m_puiPixels, 0, (m_iScaledWidth + 1) * m_iScaledHeight * sizeof(u32));
memset(m_puiDelta, 255, (m_iWidth + 2) * (m_iHeight + 2) * sizeof(u32)); memset(m_puiDelta, 255, (m_iWidth + 2) * (m_iHeight + 2) * sizeof(u32));
set_size_request(m_iScale * m_iWidth, m_iScale * m_iHeight); set_size_request(m_iScale * m_iWidth, m_iScale * m_iHeight);
@ -152,6 +153,8 @@ void ScreenAreaGl::vOnWidgetResize()
bool ScreenAreaGl::on_configure_event(GdkEventConfigure * event) bool ScreenAreaGl::on_configure_event(GdkEventConfigure * event)
{ {
vOnWidgetResize(); vOnWidgetResize();
return true;
} }
bool ScreenAreaGl::on_expose_event(GdkEventExpose * _pstEvent) bool ScreenAreaGl::on_expose_event(GdkEventExpose * _pstEvent)

View File

@ -216,8 +216,8 @@ void ScreenAreaXv::vUpdateSize()
XShmAttach(m_pDisplay, &m_oShm); XShmAttach(m_pDisplay, &m_oShm);
m_puiPixels = new u32[iScaledWidth * iScaledHeight]; m_puiPixels = new u32[iScaledWidth * iScaledHeight];
m_puiDelta = new u8[(m_iWidth + 2) * (m_iHeight + 2) * 4]; m_puiDelta = new u8[(m_iWidth + 2) * (m_iHeight + 2) * 4];
memset(m_puiPixels, 0, iScaledWidth * iScaledHeight * sizeof(u32));
memset(m_puiDelta, 255, (m_iWidth + 2) * (m_iHeight + 2) * 4); memset(m_puiDelta, 255, (m_iWidth + 2) * (m_iHeight + 2) * 4);
set_size_request(m_iScale * m_iWidth, m_iScale* m_iHeight); set_size_request(m_iScale * m_iWidth, m_iScale* m_iHeight);
@ -295,6 +295,8 @@ void ScreenAreaXv::vOnWidgetResize()
bool ScreenAreaXv::on_configure_event(GdkEventConfigure * event) bool ScreenAreaXv::on_configure_event(GdkEventConfigure * event)
{ {
vOnWidgetResize(); vOnWidgetResize();
return true;
} }
} // namespace VBA } // namespace VBA

View File

@ -24,10 +24,10 @@ namespace VBA
{ {
ScreenArea::ScreenArea(int _iWidth, int _iHeight, int _iScale) : ScreenArea::ScreenArea(int _iWidth, int _iHeight, int _iScale) :
m_iFilterScale(1),
m_vFilter2x(NULL), m_vFilter2x(NULL),
m_vFilterIB(NULL), m_vFilterIB(NULL),
m_bShowCursor(true), m_bShowCursor(true)
m_iFilterScale(1)
{ {
g_assert(_iWidth >= 1 && _iHeight >= 1 && _iScale >= 1); g_assert(_iWidth >= 1 && _iHeight >= 1 && _iScale >= 1);

View File

@ -25,7 +25,7 @@ static u32 soundoffset;
static volatile u32 soundpos; static volatile u32 soundpos;
static u32 soundbufsize; static u32 soundbufsize;
static int audioFree() static unsigned int audioFree()
{ {
if (soundoffset > soundpos) if (soundoffset > soundpos)
return soundbufsize - soundoffset + soundpos; return soundbufsize - soundoffset + soundpos;
@ -39,7 +39,7 @@ static int patestCallback( const void *inputBuffer, void *outputBuffer,
PaStreamCallbackFlags statusFlags, PaStreamCallbackFlags statusFlags,
void *userData ) void *userData )
{ {
const int outBufferLength = framesPerBuffer * sizeof(u16) * 2; const unsigned int outBufferLength = framesPerBuffer * sizeof(u16) * 2;
u8 *out = (u8*)outputBuffer; u8 *out = (u8*)outputBuffer;
if (!emulating || soundPaused) if (!emulating || soundPaused)
@ -53,7 +53,7 @@ static int patestCallback( const void *inputBuffer, void *outputBuffer,
u8 *soundbuf = (u8 *)stereodata16; u8 *soundbuf = (u8 *)stereodata16;
for (int i = 0; i < outBufferLength; i++) for (unsigned int i = 0; i < outBufferLength; i++)
{ {
if (soundpos >= soundbufsize) if (soundpos >= soundbufsize)
soundpos = 0; soundpos = 0;
@ -69,7 +69,7 @@ void systemWriteDataToSoundBuffer()
{ {
u32 copy1size = 0, copy2size = 0; u32 copy1size = 0, copy2size = 0;
while (emulating && !speedup & !systemThrottle && (audioFree() < soundBufferLen)) while (emulating && !speedup & !systemThrottle && (audioFree() < (unsigned int)soundBufferLen))
{ {
#ifndef _WIN32 #ifndef _WIN32
usleep(1000); usleep(1000);
@ -78,7 +78,7 @@ void systemWriteDataToSoundBuffer()
#endif #endif
} }
if ((soundbufsize - soundoffset) < soundBufferLen) if ((soundbufsize - soundoffset) < (unsigned int)soundBufferLen)
{ {
copy1size = (soundbufsize - soundoffset); copy1size = (soundbufsize - soundoffset);
copy2size = soundBufferLen - copy1size; copy2size = soundBufferLen - copy1size;
@ -101,7 +101,6 @@ void systemWriteDataToSoundBuffer()
bool systemSoundInit() bool systemSoundInit()
{ {
int sampleRate; int sampleRate;
int buffersize = 0;
err = Pa_Initialize(); err = Pa_Initialize();
if (err != paNoError) goto error; if (err != paNoError) goto error;
@ -117,6 +116,7 @@ bool systemSoundInit()
sampleRate = 44100; sampleRate = 44100;
soundBufferLen = 1470*2; soundBufferLen = 1470*2;
break; break;
default:
case 2: case 2:
sampleRate = 22050; sampleRate = 22050;
soundBufferLen = 736*2; soundBufferLen = 736*2;

View File

@ -154,7 +154,7 @@ void Window::vOnFileSave()
void Window::vOnLoadGameMostRecent() void Window::vOnLoadGameMostRecent()
{ {
int iMostRecent = -1; int iMostRecent = -1;
time_t uiTimeMax; time_t uiTimeMax = 0;
for (int i = 0; i < 10; i++) for (int i = 0; i < 10; i++)
{ {
@ -190,7 +190,7 @@ void Window::vOnLoadGame(int _iSlot)
void Window::vOnSaveGameOldest() void Window::vOnSaveGameOldest()
{ {
int iOldest = -1; int iOldest = -1;
time_t uiTimeMin; time_t uiTimeMin = 0;
for (int i = 0; i < 10; i++) for (int i = 0; i < 10; i++)
{ {