- show IPS value in the status bar of the Bochs window (win32 and x11)

- Bochs now compiles with BX_SHOW_IPS enabled on MSVC
This commit is contained in:
Volker Ruppert 2006-01-22 12:31:16 +00:00
parent 6f28406d3a
commit a0f880b06d
4 changed files with 31 additions and 11 deletions

View File

@ -113,7 +113,7 @@
#define BX_SHOW_IPS 0
#if (BX_SHOW_IPS) && defined(__MINGW32__)
#if (BX_SHOW_IPS) && (defined(__MINGW32__) || defined(_MSC_VER))
#define SIGALRM 14
#endif

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: win32.cc,v 1.99 2005-11-12 16:09:55 vruppert Exp $
// $Id: win32.cc,v 1.100 2006-01-22 12:31:16 vruppert Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2002 MandrakeSoft S.A.
@ -50,6 +50,7 @@ public:
bx_win32_gui_c (void) {}
DECLARE_GUI_VIRTUAL_METHODS()
virtual void statusbar_setitem(int element, bx_bool active);
virtual void show_ips(Bit32u ips_count);
};
// declare one instance of the gui object and call macro to insert the
@ -456,7 +457,7 @@ Bit32u win32_to_bx_key[2][0x100] =
/* Macro to convert WM_ button state to BX button state */
#ifdef __MINGW32__
#if defined(__MINGW32__) || defined(_MSC_VER)
VOID CALLBACK MyTimer(HWND,UINT,UINT,DWORD);
void alarm(int);
void bx_signal_handler(int);
@ -2029,16 +2030,16 @@ void headerbar_click(int x)
}
}
#ifdef __MINGW32__
#if defined(__MINGW32__) || defined(_MSC_VER)
#if BX_SHOW_IPS
VOID CALLBACK MyTimer(HWND hwnd,UINT uMsg, UINT idEvent, DWORD dwTime)
{
bx_signal_handler(SIGALRM);
}
void alarm (int time)
void alarm(int time)
{
UINT idTimer;
UINT idTimer = 2;
SetTimer(stInfo.simWnd,idTimer,time*1000,MyTimer);
}
#endif
@ -2053,6 +2054,15 @@ bx_win32_gui_c::mouse_enabled_changed_specific (bx_bool val)
}
}
void bx_win32_gui_c::show_ips(Bit32u ips_count)
{
#if BX_SHOW_IPS
char ips_text[40];
sprintf(ips_text, "mIPS: %.3f", (float)ips_count / 1000000.0);
SetStatusText(0, ips_text, 0);
#endif
}
#if BX_USE_WINDOWS_FONTS
void DrawChar (HDC hdc, unsigned char c, int xStart, int yStart,

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: x.cc,v 1.97 2006-01-17 17:15:29 vruppert Exp $
// $Id: x.cc,v 1.98 2006-01-22 12:31:16 vruppert Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2002 MandrakeSoft S.A.
@ -67,6 +67,7 @@ public:
virtual void beep_off();
virtual void statusbar_setitem(int element, bx_bool active);
virtual void get_capabilities(Bit16u *xres, Bit16u *yres, Bit16u *bpp);
virtual void show_ips(Bit32u ips_count);
};
// declare one instance of the gui object and call macro to insert the
@ -1954,6 +1955,15 @@ bx_x_gui_c::get_capabilities(Bit16u *xres, Bit16u *yres, Bit16u *bpp)
}
void bx_x_gui_c::show_ips(Bit32u ips_count)
{
#if BX_SHOW_IPS
char ips_text[40];
sprintf(ips_text, "mIPS: %.3f", (float)ips_count / 1000000.0);
set_status_text(0, ips_text, 0);
#endif
}
void x11_create_button(Display *display, Drawable dialog, GC gc, int x, int y,
unsigned int width, unsigned int height, char *text)
{

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: main.cc,v 1.306 2006-01-18 18:35:37 sshwarts Exp $
// $Id: main.cc,v 1.307 2006-01-22 12:31:15 vruppert Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2002 MandrakeSoft S.A.
@ -58,7 +58,7 @@ extern "C" {
#include <signal.h>
}
#ifdef __MINGW32__
#if defined(__MINGW32__) || defined(_MSC_VER)
void alarm(int);
#endif
@ -914,7 +914,7 @@ int bx_init_hardware()
#endif
#if BX_SHOW_IPS
#ifndef __MINGW32__
#if !defined(__MINGW32__) && !defined(_MSC_VER)
signal(SIGALRM, bx_signal_handler);
#endif
alarm( 1 );
@ -1037,7 +1037,7 @@ void bx_signal_handler(int signum)
bx_gui->show_ips((Bit32u) ips_count);
ticks_count = bx_pc_system.time_ticks();
}
#ifndef __MINGW32__
#if !defined(__MINGW32__) && !defined(_MSC_VER)
signal(SIGALRM, bx_signal_handler);
alarm( 1 );
#endif