Further PERQ Emulator progress (and a download!)

Ray Arachelian ray at arachelian.com
Thu Jul 3 18:30:12 CDT 2008


Jim Battle wrote:
>
> Have a look at Qt.  Have a look at wxWidgets (which is what I use). 
> There is no need to write separate interfaces; in my experience, 98% 
> of the code is the same across windows and osx (I haven't attempted to 
> get a linux port running)
>
Indeed, I'm hearing very good things about Qt, and getting a bit of 
pressure to rewrite LisaEm using that instead of wxWidgets, but I find 
wxWidgets to be robust and perfectly fine for LisaEm.    I'm not sure 
what wxWidgets 3.0 will bring, but I'm looking forward to it.   There 
are of course licensing issues with Qt, but if you're not going to 
produce anything commercial, it's perfectly fine to use Qt.  Otherwise 
wx seems a better choice.

wx has a hidden interface for directly manipulating wxBitmaps.  wx is 
very fast at blitting these to the display, but slow at drawing inside 
wxBitmaps.  I've managed to use the hidden rawbitmap interface very 
nicely for both OS X and win32, however, under Linux it doesn't work too 
well, so I've instead uses the wxImage classes and convert the image to 
a wxBitmap before blitting.  It's a little bit slower, but works just fine.

The only serious problem I've see with wx is the lack of proper sound.  
It'll play WAV files just fine, but that's the problem - they must be 
files.  There is a way to load them in memory and play them back, but 
I've found it doesn't always work, and I've had to compose a WAV file in 
memory, write it to /tmp and then tell wx to play the file.  I'm sure I 
could use some other library such as Allegro for this, but meh, it 
really should be properly handled under wx.  (I've no idea if this is 
handled properly in Qt or not.) 

For sound emulation you want to be able to compose a sound buffer 
containing the wave and play it back on the fly and also you should be 
able to add more data to the sound buffer or somehow work with it like a 
circular buffer...  Lisa's sounds are very limited (just square waves 
produced by a VIA's shift register, so it's not too bad.)
Ideally you should be able to play MIDI files (or play them from 
memory), work with multiple voices, and be able to handle envelopes for 
notes, etc. it would be really cool for example to be able to build a 
C64 SID emulator using wxWidgets for example.


Of course the real problem is that since it was written in .NET it will 
have to be a whole rewrite into C or C++ or something that either Qt or 
wx supports.  I'd opt for pure C for all the low level stuff and C++ or 
something else for the UI.  mono and .Net are nice and all, but I'd say 
they're far from an ideal platform for an emulator.  Yes, I know, 
there's a PC emulator written in JAVA, today's machines are capable of 
running an emulator inside a virtual machine (ok, with JIT compilation), 
but why put up with all the overhead?

wxWidgets works beautifully under Linux with GTK.  I've had issues 
providing binaries that would work under multiple distros (it's hard to 
compile statically with GTK), so perhaps it's best to just provide 
source and contact the ports managers for the distros you're interested 
in. 

There's also a pure X11 version of wxWidgets that can be used, but I've 
found it clunky and slow compared to the GTK one - and also some stuff 
that worked under GTK didn't work under X11 there.  But GTK is fairly 
universal.  (Ok, it would be nice if a wxQT existed too, but that's less 
critical.)  I haven't been able to get LisaEm to work under Solaris, 
although it should, it's probably some sort of endian issue or 
something, but there is a wxMotif as well - certainly would work on any 
platform that still uses Motif, though it might run better if GTK+ was 
installed on Solaris...  :-)

One idea I'ved toyed with but haven't done anything with is using wxLua 
as the UI and C for the core emulation.  It might be worth looking at, 
well providing you allow the C code to do all the heavy work of 
refreshing the display as well.  The benefit here is that it makes it 
easier to edit the UI.


Anyway, I'm very happy to see a PERQ emulator, in any form.




More information about the cctech mailing list