PCem

view src/win-status.c @ 125:0aa71a22757b

Fixed hang when opening status window.
author TomW
date Fri Jul 11 20:52:18 2014 +0100
parents c5989dbbc2ce
children 24b744b9a632
line source
1 #define BITMAP WINDOWS_BITMAP
2 #include <windows.h>
3 #include <windowsx.h>
4 #undef BITMAP
6 #include "ibm.h"
7 #include "device.h"
8 #include "video.h"
9 #include "resources.h"
10 #include "win.h"
12 HWND status_hwnd;
13 int status_is_open = 0;
15 extern int sreadlnum, swritelnum, segareads, segawrites, scycles_lost;
17 static BOOL CALLBACK status_dlgproc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam)
18 {
19 char s[256];
20 char device_s[4096];
21 switch (message)
22 {
23 case WM_INITDIALOG:
24 status_is_open = 1;
25 case WM_USER:
26 sprintf(device_s,
27 "CPU speed : %f MIPS\n"
28 "FPU speed : %f MFLOPS\n\n"
29 "Cache misses (read) : %i/sec\n"
30 "Cache misses (write) : %i/sec\n\n"
31 "Video throughput (read) : %i bytes/sec\n\n"
32 "Video throughput (write) : %i bytes/sec\n\n"
33 "Effective clockspeed : %iHz\n\n"
34 "Timer 0 frequency : %fHz\n\n",
35 mips,
36 flops,
37 sreadlnum,
38 swritelnum,
39 segareads,
40 segawrites,
41 clockrate - (sreadlnum*memwaitstate) - (swritelnum*memwaitstate) - scycles_lost,
42 pit_timer0_freq()
43 );
45 device_add_status_info(device_s, 4096);
46 SendDlgItemMessage(hdlg, IDC_STEXT_DEVICE, WM_SETTEXT, (WPARAM)NULL, (LPARAM)device_s);
47 return TRUE;
49 case WM_COMMAND:
50 switch (LOWORD(wParam))
51 {
52 case IDOK:
53 case IDCANCEL:
54 status_is_open = 0;
55 EndDialog(hdlg, 0);
56 return TRUE;
57 }
58 break;
59 }
60 return FALSE;
61 }
63 void status_open(HWND hwnd)
64 {
65 status_hwnd = CreateDialog(hinstance, TEXT("StatusDlg"), hwnd, status_dlgproc);
66 ShowWindow(status_hwnd, SW_SHOW);
67 }