Jump to content


Photo

Spacewar Windows Starter Kit (patches)


  • Please log in to reply
6 replies to this topic

#1 openxdkman

openxdkman

    X-S Genius

  • Moderator
  • PipPipPipPip
  • 823 posts
  • Xbox Version:unk
  • 360 version:unknown

Posted 12 December 2006 - 01:39 PM

I will try to post in this thread needed patches for Spacewar Windows.
At first compilation and run, window is too small and my xbox360 controller does nothing.
Need to fix that first...


#2 openxdkman

openxdkman

    X-S Genius

  • Moderator
  • PipPipPipPip
  • 823 posts
  • Xbox Version:unk
  • 360 version:unknown

Posted 12 December 2006 - 04:14 PM

About joypad problem. I was using a wired xbox360 controller + XBCD driver + ControlMK
That's the best free configuration to play with all games on PC, and I use joypad instead of mouse when ps/2 mouse signal gets lost to avoid reboot (giant mobile phones antenas near my home sparkle EM spikes that do that sometimes) (see http://xbcd360guide.....com/guide.html for details about xbcd)

I retried with wired xbox360 controller + official driver. It worked.

Many people complain about xna not being able to use all existing joypad. I don't know what to think.
On one hand, it's frustrating, on other hand joypad is not expensive and forcing developpers to adopt same kind of button/trigger/stick configuration may make things easier for developers and players...
It seems there is a way to add a complete module that will handle all joypads, but MS won't write it I bet.
That will come from an independant developer surely, somedays. I doubt I can do it myself, I only have one usb joypad, it's the xbox360 controller... But I may try to see what prevents the xbcd from working.

For now, xbcd driver users, like me, need a way to quickly switch from a driver to another. The official xbox360 driver is a bit annoying to install, because the online automatic procedure may be slow sometimes.

I detected the files installed with official driver and found a way to put them in a directory with the appropriate structure so I can reinstall driver by just giving that directory path (so now it's faster to remove/add driver and you don't need internet) :

/oem30.inf (retrieve it from /Windows/Inf)
/oem30.PNF (retrieve it from /Windows/Inf)
/x86/WdfCoInstaller01001.dll (retrieve it from /Windows/System32/)
/x86/xusb20.sys (retrieve it from /Windows/System32/drivers)

/x86/wdf01000.sys (not needed probably)
/x86/wdfldr.sys (not needed probably)

About bad window size, I'm using 800x600 because I get better quality on my old plasma with that.
It seems some autodetection code is missing to get things right.
I will work on it.


#3 openxdkman

openxdkman

    X-S Genius

  • Moderator
  • PipPipPipPip
  • 823 posts
  • Xbox Version:unk
  • 360 version:unknown

Posted 12 December 2006 - 07:18 PM

For those without wired xbox360 controller and with wrong window size, on right appears :
B : Retro
A : Evolved
X : Info

The default keyboard mapping for Spacewar can be found in settings.xml (fits well qwerty keyboards)

Player1:

Start:LeftControl
Back:LeftShift
A:V
B:G
X:F
Y:T
ThumbstickLeftXmin:A
ThumbstickLeftXmax:D
ThumbstickLeftYmin:S
ThumbstickLeftYmax:W
Left:A
Right:D
Down:S
Up:W
LeftTrigger:Q
RightTrigger:E

Player2:

Start:RightControl
Back:RightShift
A:Home
B:End
X:PageUp
Y:PageDown
ThumbstickLeftXmin:Left
ThumbstickLeftXmax:Right
ThumbstickLeftYmin:Down
ThumbstickLeftYmax:Up
Left:Left
Right:Right
Down:Down
Up:Up
LeftTrigger:Insert
RightTrigger:Delete



#4 openxdkman

openxdkman

    X-S Genius

  • Moderator
  • PipPipPipPip
  • 823 posts
  • Xbox Version:unk
  • 360 version:unknown

Posted 12 December 2006 - 07:34 PM

Patch in order to have all Spacewar window visible in lower resolution than 1280x720 :

In SpacewarGame.cs, at line 151, replace


#else
enableDrawScaling = true;
#endif

with

#else
preferredWindowWidth = 800;
preferredWindowHeight = 600;
enableDrawScaling = true;
#endif

I'm currently looking for a way to set variables with the current width and height of current Windows desktop resolution. I will post it if I find it.

Edited by openxdkman, 12 December 2006 - 07:35 PM.


#5 openxdkman

openxdkman

    X-S Genius

  • Moderator
  • PipPipPipPip
  • 823 posts
  • Xbox Version:unk
  • 360 version:unknown

Posted 12 December 2006 - 08:35 PM

Ok, I found a way :

At line 175, replace :


// game initialization code here

with

// game initialization code here
{
#if XBOX360
#else
GraphicsAdapter adapter;
adapter = graphics.GraphicsDevice.CreationParameters.Adapter;
preferredWindowWidth = adapter.CurrentDisplayMode.Width;
preferredWindowHeight = adapter.CurrentDisplayMode.Height;
ToggleFullScreen();
ToggleFullScreen();
#endif
}


I thought I could use this code where preferred sizes are first set, but it doesn't work.
Right after graphics creation, it's probably too soon. The GraphicsDevice member is not initialized yet.
So in game initialization area it works, but it's too late window is already created with hardcoded size.
So I call TogleFullScreen twice to switch to fullscreen (black screen syndrome on my xp+geforce7300) then immediately switch to window again but with new calculated size. Doesn't work too bad...

To manually toggle between fullscreen and windowed it's Alt+Return

All program should start in windowed mode by default, because full screen mode won't work at all on many PCs (my PC is quite recent and graphic card is recent too). There's a nasty issue in full screen mode I feel...


#6 openxdkman

openxdkman

    X-S Genius

  • Moderator
  • PipPipPipPip
  • 823 posts
  • Xbox Version:unk
  • 360 version:unknown

Posted 14 December 2006 - 04:53 PM

Fix for full screen mode (for many screens, refreshrate in fullscreen mode will be too high)

Replace

void PreparingDeviceSettings(object sender, PreparingDeviceSettingsEventArgs e)
{
// We turn off auto depth buffer creation when scaling output.
//
e.GraphicsDeviceInformation.PresentationParameters.EnableAutoDepthStencil = !enableDrawScaling;
}

with

void PreparingDeviceSettings(object sender, PreparingDeviceSettingsEventArgs e)
{
// We turn off auto depth buffer creation when scaling output.
//
e.GraphicsDeviceInformation.PresentationParameters.EnableAutoDepthStencil = !enableDrawScaling;
#if XBOX360
#else

if (e.GraphicsDeviceInformation.PresentationParameters.IsFullScreen)
e.GraphicsDeviceInformation.PresentationParameters.FullScreenRefreshRateInHz = 60;
#endif
}


I will look for a way to improve this patch (better to detect the current windows desktop resolution refreshrate and keep it for full screen mode)


#7 openxdkman

openxdkman

    X-S Genius

  • Moderator
  • PipPipPipPip
  • 823 posts
  • Xbox Version:unk
  • 360 version:unknown

Posted 14 December 2006 - 05:15 PM

Ok, that will be the last needed patch I think.
This one will set in fullscreen mode the same refreshrate detected in windowed mode :
(you can still force its value though if you wish)

At line 30, add a new variable

private int preferredRefreshRate = 0;
//0 will mean you want to set this variable when we are in windowed
//mode and reuse it later when we go back to fullscreen mode



replace

void PreparingDeviceSettings(object sender, PreparingDeviceSettingsEventArgs e)
{
// We turn off auto depth buffer creation when scaling output.
//
e.GraphicsDeviceInformation.PresentationParameters.EnableAutoDepthStencil = !enableDrawScaling;
}

with


void PreparingDeviceSettings(object sender, PreparingDeviceSettingsEventArgs e)
{
// We turn off auto depth buffer creation when scaling output.
//
e.GraphicsDeviceInformation.PresentationParameters.EnableAutoDepthStencil = !enableDrawScaling;

#if XBOX360
#else
if (e.GraphicsDeviceInformation.PresentationParameters.IsFullScreen)
{
if (preferredRefreshRate!=0)
e.GraphicsDeviceInformation.PresentationParameters.FullScreenRefreshRateInHz = preferredRefreshRate;
else //we never went in windowed mode before, dunno what is refreshrate yet
e.GraphicsDeviceInformation.PresentationParameters.FullScreenRefreshRateInHz = 60;
}
#endif
}



finally, replace

// going fullscreen, use desktop resolution to minimize display mode changes
// this also has the nice effect of working around some displays that lie about
// supporting 1280x720
GraphicsAdapter adapter = graphics.GraphicsDevice.CreationParameters.Adapter;
graphics.PreferredBackBufferWidth = adapter.CurrentDisplayMode.Width;
graphics.PreferredBackBufferHeight = adapter.CurrentDisplayMode.Height;

with

// going fullscreen, use desktop resolution to minimize display mode changes
// this also has the nice effect of working around some displays that lie about
// supporting 1280x720
GraphicsAdapter adapter = graphics.GraphicsDevice.CreationParameters.Adapter;
graphics.PreferredBackBufferWidth = adapter.CurrentDisplayMode.Width;
graphics.PreferredBackBufferHeight = adapter.CurrentDisplayMode.Height;
if (preferredRefreshRate==0) preferredRefreshRate = adapter.CurrentDisplayMode.RefreshRate;


Ok... now we can have fun!

Edited by openxdkman, 14 December 2006 - 05:21 PM.





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users