| 1 |
Readme for wxWidgets Interface |
| 2 |
Updated Tue Dec 24 09:54:00 CET 2013 |
| 3 |
|
| 4 |
Contributors to wxWidgets port: |
| 5 |
Don Becker (Psyon) |
| 6 |
Bryce Denney |
| 7 |
Dave Poirier |
| 8 |
Volker Ruppert |
| 9 |
|
| 10 |
wxWidgets Configuration Interface |
| 11 |
|
| 12 |
The wxWidgets (formerly called wxWindows) port began in June 2001 around the |
| 13 |
time of Bochs 1.2.1. Dave Poirier and Bryce Denney started adding a wxWidgets |
| 14 |
configuration interface. We made some progress, but stopped after a while. |
| 15 |
Then in March/April 2002 Bryce and Psyon revived the wxWidgets branch and turned |
| 16 |
it into a usable interface. Psyon did most of the work to get text and graphics |
| 17 |
working, and Bryce worked on event passing between threads, and keyboard |
| 18 |
mapping. Starting in August 2002, Bryce added lots of dialog boxes to allow you |
| 19 |
to set all the bochsrc parameters. At the time of release 2.0, there |
| 20 |
are still some bugs but it is pretty stable and usable. |
| 21 |
|
| 22 |
Bochs should be build with wxWidgets 2.3.3 or later. The release wxWidgets 2.3.3 |
| 23 |
includes a patch by Bryce Denney to allow us to get raw keycode data for several |
| 24 |
OSes. |
| 25 |
|
| 26 |
On any UNIX platform with wxWidgets installed, configure with |
| 27 |
--with-wx to enable the wxWidgets display library. |
| 28 |
|
| 29 |
To build in MS VC++: |
| 30 |
- edit .conf.win32-vcpp and add "--with-wx" to the configure line. |
| 31 |
If you want different configure options from what you see, change them |
| 32 |
too. |
| 33 |
- in cygwin, do "sh .conf.win32-vcpp" to run configure |
| 34 |
- unzip build/win32/wxworkspace.zip into the main directory. |
| 35 |
For cygwin: unzip build/win32/wxworkspace.zip |
| 36 |
or use winzip or whatever else. |
| 37 |
- open up bochs.dsw, the workspace file |
| 38 |
- edit project settings so that VC++ can find the wxWidgets include |
| 39 |
files and libraries on your system. Bryce installed them in |
| 40 |
d:/wx/wx233/include and d:/wx/wx233/lib. Specifically, edit |
| 41 |
- Project>Settings>C/C++>Category=Preprocessor: include directories. |
| 42 |
- Project>Settings>Link>Category=Input: additional library path. |
| 43 |
- build |
| 44 |
|
| 45 |
Note that the project is set up for wxWidgets 2.3.3. To use on other |
| 46 |
wxWidgets versions, you will have to change some of the names of the libraries |
| 47 |
to include. Use the samples that came with that version of wxWidgets for |
| 48 |
reference. |
| 49 |
|
| 50 |
------------------------------------------------------ |
| 51 |
|
| 52 |
Random notes follow |
| 53 |
|
| 54 |
Added some sketches. I'm thinking that the control |
| 55 |
panel will be able to basically show one of these screens at a time. When |
| 56 |
you first start you would see ChooseConfigScreen which chooses between the |
| 57 |
configurations that you have loaded recently (which it would remember |
| 58 |
by the pathname of their bochsrc). Whether you choose an existing |
| 59 |
configuration to be loaded or a new one, when you click Ok you go to |
| 60 |
the first configuration screen, ConfigDiskScreen. |
| 61 |
|
| 62 |
Each of the configuration screens takes up the whole control panel window. |
| 63 |
We could use tabs on the top and/or "<-Prev" and "Next->" buttons to make |
| 64 |
it quick to navigate the configuration screens. Each screen should |
| 65 |
probably have a Prev, Next, Revert to Saved, and Accept button. |
| 66 |
The menu choices like Disk..., VGA..., etc. just switch directly to |
| 67 |
that tab. |
| 68 |
|
| 69 |
|
| 70 |
------------------------------------------------------ |
| 71 |
Notes: |
| 72 |
|
| 73 |
events from gui to sim: |
| 74 |
- [async] key pressed or released |
| 75 |
- [async] mouse motion with button state |
| 76 |
- [sync] query parameter |
| 77 |
- [sync] change parameter |
| 78 |
- [async] start, pause, stop, reset simulation. Can be implemented |
| 79 |
as changing a parameter. |
| 80 |
- [async] request notification when some param changes |
| 81 |
|
| 82 |
events from sim to gui: |
| 83 |
- [async] log message to be displayed (or not) |
| 84 |
- [async] ask user how to proceed (like panic: action=ask) |
| 85 |
- [async] param value changed |
| 86 |
- make my thread sleep for X microseconds (call wxThread::sleep then return) |
| 87 |
|
| 88 |
In a synchronous event, the event object will contain space for the entire |
| 89 |
response. The sender allocates memory for the event and builds it. The |
| 90 |
receiver fills in blanks in the event structure (or could overwrite parts) |
| 91 |
and returns the same event pointer as a response. For async events, probably |
| 92 |
the sender will allocate and the receiver will have to delete it. |
| 93 |
|
| 94 |
implement the floppyA and floppyB change buttons using new event |
| 95 |
structure. How should it work? |
| 96 |
|
| 97 |
vga gui detects a click on floppyA bitmap |
| 98 |
construct a BxEvent type BX_EVT_ASK_PARAM |
| 99 |
post the event to the wxWidgets gui thread (somehow) and block for response |
| 100 |
when it arrives in the gui thread, show a modal dialog box |
| 101 |
get the answer back to the simulator thread |
| 102 |
|
| 103 |
|
| 104 |
right now, this is working ok within the simulator thread using |
| 105 |
wxMutexGuiEnter/Leave. Still I'm going to change it so that the |
| 106 |
siminterface.cc code builds an event structure and the gui code |
| 107 |
fills in the blank in the structure, instead of the stupid |
| 108 |
notify_get_int_arg stuff. |
| 109 |
|
| 110 |
|
| 111 |
Starting and Killing Threads |
| 112 |
|
| 113 |
When a detachable (default) thread finishes (returns from its Entry() |
| 114 |
function), wxWidgets frees the memory associated with that thread. |
| 115 |
Unless the thread is never going to end, it is potentially dangerous to have a |
| 116 |
pointer to it at all. Even if you try to "check if it's alive" first, you may |
| 117 |
be dereferencing the pointer after it has already been deleted, leading to it |
| 118 |
claiming to be alive when it's not, or a segfault. To solve this, the approach |
| 119 |
used in the wxWidgets threads example is to have code in the thread's OnExit() |
| 120 |
method remove the thread's pointer from the list of usable threads. In |
| 121 |
addition, any references or changes to the list of threads is controlled by a |
| 122 |
critical section to ensure that it stays correct. This post finally |
| 123 |
explained what I was seeing. |