BrianPeek.com
A Compendium of Random Uselessness

May 2009 - Brian Peek's Blog

  • Facebook .NET Programmers Group Session on XNA 3.0


    image I will be giving a session on Tuesday, June 2nd at 6pm EST to the Facebook .NET Programmers group on XNA 3.0.  This is an online session and everyone is welcome to attend.

    Topic: Building a Video Game with XNA Game Studio 3.0
    Abstract: This session will demonstrate how to build a very simple 2D game (a Space Invaders clone) using XNA Game Studio 3.0. Attendees will learn how to effectively use the content pipeline, import 2D sprites into XNA, manage input from the keyboard, mouse, Xbox 360 controller and Zune, manage game state, and debug the resulting game. The sample code will be built on a PC and run on the PC, Xbox 360, and Zune platforms when complete.
    Date: June 2nd, 2009
    Time: 6PM Eastern | 10PM GMT/UTC - Get local event time in your city: http://tinyurl.com/l9hq65
    Add to Outlook: http://tinyurl.com/mpp5of
    RSVP and Event Details: http://www.facebook.com/event.php?eid=49178981206
    Live Meeting Link to join meeting: http://tinyurl.com/ago484

    I’ll also be giving away a copy or two of our Coding4Fun book.  Hope to “see” you all there!

    Filed under: , , ,

  • Install the Surface SDK SP1 Workstation Edition on x64


    image_thumb

    Update 11/20/09: The Surface SDK is now available to everyone at the new Surface website!  The instructions below should continue to work just fine…let me know if they don’t.

    Update 10/29/09: It appears that the version of the SDK available from the Microsoft Partner site comes as a straight .exe file.  To extract this back into the MSI file to follow the instructions below, execute the following command:

    "Microsoft Surface SDK 1.0 SP1, Workstation Edition.exe" /extract c:\surface

    This should spit out a MSI file to the c:\surface directory and you can continue on with the instructions below.  Thanks to Tim Hurst for the info!


    The Surface SDK SP1 Workstation Edition was released this week and while it will install (but is still unsupported) on Windows 7, it will not install on a 64-bit machine.  The installer has changed a bit, so my previous instructions will not work with this installer, but I have managed to get the new package to install and run.  And here’s how…

    As before, this is a totally unsupported setup, so if official support from Microsoft is required, this is not for you.

    Please note that you will still need to meet the other hardware and software requirements of the SDK.

    To perform the actions in this guide you will need to install Orca, a tool for editing MSI files, included with the Windows SDK.  Unfortunately, this utility isn’t available separately and will require you to download the full SDK to get it.  You can download the Windows Vista or Windows 7 SDK here.

    1) Extract the MSI to its individual files

    This can be done with the following command performed in an elevated cmd window:

    msiexec /a SurfaceSDKWE.msi /qb TARGETDIR=c:\surface (or some other TARGETDIR of your choosing)

    When complete, you will have a new directory at TARGETDIR filled with a smaller MSI and all the files contained within the original MSI.

    2) Remove the platform check from the MSI

    Open the newly extracted SurfaceSDKWE.msi file in Orca.  Select LaunchCondition from the left pane.  In the right pane, select the row labeled Installed OR NOT VersionNT64, right-click, and select Drop Row.  This will remove the check for a 64-bit OS.

    5-14-2009 5-52-27 AM

    After the rows are dropped, save the MSI using the standard File –> Save menu option.

    3) Patch the setupcustomaction.exe file

    This executable is called during the SDK installation process.  Because the installer will launch as a 64-bit application, so will this executable, which will force it to write some registry values into the wrong location.  Therefore we have to patch this file using the corflags.exe utility included in Visual Studio and the .NET SDK. 

    If you have the full Visual Studio installed, simply open an elevated Visual Studio Command Prompt from the Start Menu and the path to corflags.exe will automatically be loaded.  Otherwise, you should find this in the C:\Program Files\Microsoft SDKs\Windows\v6.1\Bin directory and you can set your PATH environment variable appropriately.

    With the path to corflags.exe in your PATH environment variable, change to the following directory:

    <TARGETDIR from above>\Microsoft Surface\v1.0

    Inside this directory, run the following command:

    corflags setupcustomaction.exe /32bit+ /force

    You will get a warning that the file is strong named signed.  You can safely ignore this.

    Administrator Visual Studio 2008 Command Prompt (2)

    4) Install the SDK

    Now that the MSI and setupcustomaction.exe have been patched, run the extracted and patched SurfaceSDKWE.msi file from the TARGETDIR location, not the original MSI file.  As long as you have the other prerequisites installed, the SDK will install without issue.

    5) Patch the executables / Build and fix the samples

    These steps are identical to last time, so I will just link to the original blog post here.

    And there we have it.  A patched and working Surface SDK SP1 running under Vista/Windows 7 x64.  As always, run this at your own risk, but let me know how it works out for you if you give it a try.

    Filed under: , ,

  • Windows Virtual PC and the Microsoft Device Emulator


    Windows 7 (as of RC1) now supports a pretty spiffy new feature known as Virtual Windows XP or Windows XP Mode based on what article you read.  At its core, it is a new version of the Virtual PC product, now named Windows Virtual PC, installed closer to the OS, combined with a Windows XP hard disk image which allow you to run legacy applications under Windows XP on your Windows 7 machine in a pretty seamless way.

    If you install the Windows Virtual PC add-on to Windows 7, you must first uninstall Virtual PC 2007.  By doing that, you remove the special network driver that is also required to use the Microsoft Device Emulator on the network.  The device emulator is typically used for Smart Device development.

    So the puzzle:  The Device Emulator doesn’t work with the new Windows Virtual PC driver, and you can’t install the old version of Virtual PC 2007 and expect the new Windows Virtual PC to keep working.  What to do?

    The answer is to extract the Virtual PC 2007 network service drivers out of the MSI package and manually install them in Windows 7.  So far this has provided the expected result for me:  Windows Virtual PC runs happily, and the Device Emulator now connects to the network.  So how do we do this?  Thanks for asking.  Here is a step-by-step guide to make this go.  Note that this is very much a “works on my machine” experience.  If it burns your house down, don’t hold me responsible.  Note that you should have a valid and complete backup before attempting this on your machine just in case…

    • Download the Virtual PC 2007 SP1 installer executable
    • Rename the installer from setup.exe to something else, such as vpc.exe
    • Open a cmd prompt, navigate to the setup executable, and run (assuming you renamed the file to vpc.exe):
      • vpc.exe /c
    • This will extract the executable to an MSI file at located in the %temp% directory
    • Change to the temp directory by running:
      • cd %temp%
    • In this directory, extract the MSI by running:
      • msiexec /a Virtual_PC_2007_Install.msi /qb TARGETDIR=c:\vpc
      • Of course, feel free to replace that directory with one of your choosing
    • This will extract the MSI file to c:\vpc (or the one you entered)
    • Open the Network and Sharing Center and select Change adapter settings
      adapter
    • Right-click the network adapter you have connected to the internet and select Properties
    • Click the Install… button
      install
    • Make sure Service is selected and click Add…
      type
    • Click Have Disk…
      disk
    • For x86 machines, navigate to:
      • C:\vpc\Program Files\Microsoft Virtual PC\Utility\VMNetSrv\
    • For x64 machines, navigate to:
      • C:\vpc\Program Files\Microsoft Virtual PC\Utility\VMNetSrv\x64
    • Select Virtual Machine Network Services and click OK
      vmns

    At this point the driver will be installed and attached to that network adapter.  If you have the need to attach this to multiple adapters, simply repeat the steps above to install the service on each adapter required.

    Once the driver is installed, you can then link the Device Emulator to the chosen adapter and connect to the network as always, as well as connect to the network in the new version of Virtual PC.

    Let me know how it works for you!