VS2005 DeviceEmulator
I have been playing around with deviceemulator.exe today, trying to install a new device image and have it show up in the "Device Emulator Manager" (can be found from VS 2005 menu: Tools->Device Emulator Manager).
Setting up an emulator should be relatively straight forward: there is a virtual PC environment, an OS image and a skin file. But my previous experiences have taught me to be wary as its always turned out more complex than first thought and I have ended up with 'GUID brain melt' syndrome several times!
It turns out the Windows Mobile 5.0 emulator setup is a whole lot simpler. I can’t claim to have my head round all of it yet but here is where I got too:
Using FileMon (SystInternals) I found two style sheet file (.xsl) in \Documents and Settings\All Users\Application Data\Microsoft\CoreCon\1.0\addons being loaded by Device Emulator Manager. These files have a guid for a name that has a link from HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\8.0\Platforms, but investigating down that route started to bring back memories of brain melt so I stopped pretty quick. Looking at the contents of these files suggests they are also used to describe mobile project wizards and control the form designer.
Anyway it’s enough to know that Device Emulator Manager can find these files and uses them to populate the list of available emulators. One of the xls files contains configuration info for Windows Mobile 5.0 Pocket PC emulators and the other is for Smartphone. The contents of the file is pretty straight forward. Here is an extract of the pocket pc section ( with lots cut out for brevity):
<DEVICE Protected="true" Name="Windows Mobile 5.0 Pocket PC Phone VGA Emulator" ID="4799B6FE-28DF-4ae0-970C-18DBF3560E65">
<PROPERTYCONTAINER>
<PROPERTY ID="OS_Version">5000</PROPERTY>
<PROPERTY ID="OS">default</PROPERTY>
<PROPERTY ID="CpuName">ARMV4I</PROPERTY>
…
<!-- Transport service property overrides -->
…
<!-- DMA Transport -->
…
<!-- Bootstrap service property overrides -->
< PROPERTYID = "VMID"Protected="false">{4799B6FE-28DF-4ae0-970C-18DBF3560E65}</PROPERTY>
< PROPERTYID = "OSBinImage"Protected="false">C:\Program Files\Windows CE Tools\wce500\Windows Mobile 5.0 Pocket PC SDK\DeviceEmulation\0409\PPC_USA_GSM_VGA_VR.BIN</PROPERTY>
<PROPERTY ID="ScreenWidth" Protected="false">480</PROPERTY>
<PROPERTY ID="ScreenHeight" Protected="false">640</PROPERTY>
<PROPERTY ID="ColorDepth" Protected="false">16</PROPERTY>
<PROPERTY ID="EthernetEnabled" Protected="false">yes</PROPERTY>
<PROPERTY ID="RAMSize" Protected="false">128</PROPERTY>
<PROPERTY ID="SerialPort0" Name="SerialPort0"></PROPERTY>
<PROPERTY ID="SerialPort1" Protected="false"></PROPERTY>
<PROPERTY ID="SerialPort2" Protected="false"></PROPERTY>
<PROPERTY ID="ParallelPort" Protected="false"></PROPERTY>
<PROPERTY ID="AlwaysOnTop" Name="AlwaysOnTop">no</PROPERTY>
<PROPERTY ID="EnableToolTips" Name="EnableToolTips">no</PROPERTY>
<PROPERTY ID="FlashFile" Name="FlashFile"></PROPERTY>
<PROPERTY ID="HostOnlyEthernetEnabled" Name="HostOnlyEthernetEnabled">no</PROPERTY>
<PROPERTY ID="Orientation" Name="Orientation">0</PROPERTY>
<PROPERTY ID="ShowSkin" Name="ShowSkin">yes</PROPERTY>
<PROPERTY ID="Zoom2x" Name="Zoom2x">no</PROPERTY>
< PROPERTYID = "Skin"Protected="false">C:\Program Files\Windows CE Tools\wce500\Windows Mobile 5.0 Pocket PC SDK\DeviceEmulation\Pocket_PC_Phone_VGA\Pocket_PC_PE_VGA.xml</PROPERTY>
…
</PROPERTYCONTAINER>
</DEVICE>
Let me highlight some of the interesting bits:
· The Name attribute of the first DEVICE section is what the Device Emulation Manager (DEM for short) displays on screen (you need to Exit DEM to re-load the file and pickup changes).
· Notice the CpuName property specifies ARMV4I as the processor – all WM 5.0 emulators target the Arm instruction set.
· Probably the most interesting bits are in the Bootstrap service section.
· The VMID property specifies a GUID that corresponds to a registry section (HKEY_CURRENT_USER\Software\Microsoft\Device Emulator\MAC Addresses) defining a dummy MAC address for the emulator instance – this makes it possible to run lots of emulator images at the same time. If you are adding a new image by hand then I would recommend you create a new, unique entry in the registry and update this section to point at it.
· The OSBinImage property points to the relevant OS image.
· The rest of this section is dedicated to describing how to start the image – width, height, RAM etc.
· Skin property points to an XML file that describes the skin to show around the emulation image. If you take a look at one of these you can see they are more than just a few images! The XML file describes the button values and a colour value used to locate the button on the first image file. There are three images: the first is a base image with template areas set out in specific colours to identify the buttons; the second image is a full image with all buttons in the up state; and the third image is with all buttons in the down state.
So why mess with this stuff? Well first of all you can get those ridiculously long emulator names down to a reasonable size. Duplicating entries in the file might also be useful to run two instances of the same image at the same time, or allow you to setup the same image to start in landscape or portrait, increased or decreased memory and so on.
Let me just say I haven’t fully tested out the effects of playing with these files so tread carefully as playing with this stuff is not going to be supported by MS, so if it all comes crashing down round your ears then you might need to re-install. You have been warned.
BTW I’m oof next week so probably a whole lot of silence on this blog for the next week.
Marcus
Comments
- Anonymous
August 05, 2005
Do you hate the long names in the device emulator manager in Visual Studio 2005? Want to know where Visual... - Anonymous
August 05, 2005
Clearly, somebody isn't giving Marcus enough real work to do so he's decided to figure out how the new... - Anonymous
August 08, 2005
So I decided not to blog much from O’ahu – not such a bad thing, eh?&nbsp; (..and I got sick of updating... - Anonymous
August 08, 2005
So I decided not to blog much from O’ahu – not such a bad thing, eh?&nbsp; (..and I got sick of updating... - Anonymous
August 10, 2005
You might want to consider an easier way to get new entries to play with in the CoreCon Datastore. In ToolsOptionsDevices, you can "clone" entries using the "Save As" button. This will let you specify a name for your entry and will copy all of the settings, including the image path.
Carl Brochu, Visual Studio - Anonymous
January 21, 2009
PingBack from http://www.keyongtech.com/466076-skin-for-emulator