Skip to content

Commit

Permalink
Updated the Installer
Browse files Browse the repository at this point in the history
Fixed an issue in the Desktop SoundEffect.cs class where it was trying to read a closed stream
Fixed a bug in the Game class under windows & linux where the Viewport was too small on startup
Added MonoDevelop.MonoGame addin assembly code. This is required to support .net 4.0 profile projects
Added nant build files to help build release packages quickly.
  • Loading branch information
dellis1972 committed Mar 17, 2012
1 parent d148d88 commit 90b501a
Show file tree
Hide file tree
Showing 19 changed files with 388 additions and 45 deletions.
13 changes: 10 additions & 3 deletions Installers/Windows/MonoGame.nsi
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ SetCompressor /SOLID /FINAL lzma
!define FrameworkPath "C:\Sandbox\MonoGame\"
!define VERSION "2.5"
!define REVISION "0.0"
!define INSTALLERFILENAME "MonoGame-MonoDevelop"
!define INSTALLERFILENAME "MonoGame"
!define APPNAME "MonoGame"

;Include Modern UI
Expand Down Expand Up @@ -53,8 +53,9 @@ RequestExecutionLevel admin
; The stuff to install
Section "MonoGame Core Components" ;No components page, name is not important
SectionIn RO
SetOutPath '$INSTDIR\Assemblies'
SetOutPath $INSTDIR
File '..\monogame.ico'
SetOutPath '$INSTDIR\Assemblies'
File /r '..\..\ThirdParty\Lidgren.Network\bin\Release\*.dll'
File /r '..\..\ThirdParty\Lidgren.Network\bin\Release\*.xml'

Expand Down Expand Up @@ -104,7 +105,13 @@ Section "MonoDevelop Templates"

SetOutPath "$0AddIns\MonoDevelop.MonoGame"
; install the Templates for MonoDevelop
File /r '..\..\ProjectTemplates\MonoDevelop.MonoGame.${VERSION}\*.*'
File '..\..\ProjectTemplates\MonoDevelop.MonoGame.${VERSION}\*.*'
File '..\..\ProjectTemplates\MonoDevelop.MonoGame.${VERSION}\MonoDevelop.MonoGame\MonoDevelop.MonoGame\bin\Release\MonoDevelop.MonoGame.dll'
SetOutPath "$0AddIns\MonoDevelop.MonoGame\icons"
File /r '..\..\ProjectTemplates\MonoDevelop.MonoGame.${VERSION}\icons\*.*'
SetOutPath "$0AddIns\MonoDevelop.MonoGame\templates"
File /r '..\..\ProjectTemplates\MonoDevelop.MonoGame.${VERSION}\templates\*.*'


SectionEnd

Expand Down
17 changes: 17 additions & 0 deletions Installers/default.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?xml version="1.0"?>
<project name="Aurora Ion Build Script" default="build" basedir=".">
<description>Default Ion Automated Build script</description>
<property name="os" value="${operating-system::get-platform(environment::get-operating-system())}" />



<target name="build" description="Build Installers">
<exec program="makensis" workingdir="Windows" basedir="C:\Program Files (x86)\NSIS">
<arg value="MonoGame.nsi"/>
</exec>
</target>




</project>
63 changes: 35 additions & 28 deletions MonoGame.Framework/Desktop/Audio/SoundEffect.cs
Original file line number Diff line number Diff line change
Expand Up @@ -119,34 +119,41 @@ public SoundEffect(byte[] buffer, int sampleRate, AudioChannels channels)
{
//buffer should contain 16-bit PCM wave data
short bitsPerSample = 16;

MemoryStream mStream = new MemoryStream(44+buffer.Length);
BinaryWriter writer = new BinaryWriter(mStream);

writer.Write("RIFF".ToCharArray()); //chunk id
writer.Write((int)(36+buffer.Length)); //chunk size
writer.Write("WAVE".ToCharArray()); //RIFF type

writer.Write("fmt ".ToCharArray()); //chunk id
writer.Write((int)16); //format header size
writer.Write((short)1); //format (PCM)
writer.Write((short)channels);
writer.Write((int)sampleRate);
short blockAlign = (short)((bitsPerSample/8)*(int)channels);
writer.Write((int)(sampleRate*blockAlign)); //byte rate
writer.Write((short)blockAlign);
writer.Write((short)bitsPerSample);

writer.Write("data".ToCharArray()); //chunk id
writer.Write((int)buffer.Length); //data size
writer.Write(buffer);

writer.Close();
mStream.Close();

//_data = mStream.ToArray();
_name = "";
_data = LoadAudioStream(mStream, 1.0f, false);

using (MemoryStream mStream = new MemoryStream(44 + buffer.Length))
{
using (BinaryWriter writer = new BinaryWriter(mStream))
{

writer.Write("RIFF".ToCharArray()); //chunk id
writer.Write((int)(36 + buffer.Length)); //chunk size
writer.Write("WAVE".ToCharArray()); //RIFF type

writer.Write("fmt ".ToCharArray()); //chunk id
writer.Write((int)16); //format header size
writer.Write((short)1); //format (PCM)
writer.Write((short)channels);
writer.Write((int)sampleRate);
short blockAlign = (short)((bitsPerSample / 8) * (int)channels);
writer.Write((int)(sampleRate * blockAlign)); //byte rate
writer.Write((short)blockAlign);
writer.Write((short)bitsPerSample);

writer.Write("data".ToCharArray()); //chunk id
writer.Write((int)buffer.Length); //data size
writer.Write(buffer);

// re position to the start otherwise we cannot read the stream
mStream.Seek(0, SeekOrigin.Begin);
//_data = mStream.ToArray();
_name = "";
_data = LoadAudioStream(mStream, 1.0f, false);

// close the steam after we have finished reading.
writer.Close();
mStream.Close();
}
}
//_sound = new Sound(_data, 1.0f, false);
}

Expand Down
11 changes: 8 additions & 3 deletions MonoGame.Framework/Game.cs
Original file line number Diff line number Diff line change
Expand Up @@ -548,10 +548,15 @@ internal void applyChanges(GraphicsDeviceManager manager)
var viewport = new Viewport();

viewport.X = 0;
viewport.Y = 0;
viewport.Width = GraphicsDevice.PresentationParameters.BackBufferWidth;
viewport.Y = 0;
#if WINDOWS || LINUX
viewport.Width = manager.PreferredBackBufferWidth;// GraphicsDevice.PresentationParameters.BackBufferWidth;
viewport.Height = manager.PreferredBackBufferHeight;// GraphicsDevice.PresentationParameters.BackBufferHeight;
#else
viewport.Width = GraphicsDevice.PresentationParameters.BackBufferWidth;
viewport.Height = GraphicsDevice.PresentationParameters.BackBufferHeight;

#endif

GraphicsDevice.Viewport = viewport;
Platform.EndScreenDeviceChange(string.Empty, viewport.Width, viewport.Height);
}
Expand Down
8 changes: 8 additions & 0 deletions MonoGame.Framework/Net/NetworkSession.cs
Original file line number Diff line number Diff line change
Expand Up @@ -567,7 +567,11 @@ public static AvailableNetworkSessionCollection Find (
{
int hostGamer = -1;
hostGamer = GetHostingGamerIndex(localGamers);
#if WINDOWS_PHONE
return Find(sessionType, hostGamer, 4, null);
#else
return EndFind(BeginFind(sessionType, hostGamer, 4, searchProperties,null,null));
#endif
}

public static AvailableNetworkSessionCollection Find (
Expand Down Expand Up @@ -610,7 +614,11 @@ public NetworkGamer FindGamerById (byte gamerId)

public static NetworkSession Join (AvailableNetworkSession availableSession)
{
#if WINDOWS_PHONE
return JoinSession(availableSession);
#else
return EndJoin(BeginJoin(availableSession, null, null));
#endif

}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@

Microsoft Visual Studio Solution File, Format Version 11.00
# Visual Studio 2010
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MonoDevelop.MonoGame", "MonoDevelop.MonoGame\MonoDevelop.MonoGame.csproj", "{DEFFDDB9-F86B-452F-B1B2-6379DB6D10EA}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{DEFFDDB9-F86B-452F-B1B2-6379DB6D10EA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{DEFFDDB9-F86B-452F-B1B2-6379DB6D10EA}.Debug|Any CPU.Build.0 = Debug|Any CPU
{DEFFDDB9-F86B-452F-B1B2-6379DB6D10EA}.Release|Any CPU.ActiveCfg = Release|Any CPU
{DEFFDDB9-F86B-452F-B1B2-6379DB6D10EA}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(MonoDevelopProperties) = preSolution
StartupItem = MonoDevelop.MonoGame\MonoDevelop.MonoGame.csproj
EndGlobalSection
EndGlobal
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
using System.Reflection;
using System.Runtime.CompilerServices;

// Information about this assembly is defined by the following attributes.
// Change them to the values specific to your project.

[assembly: AssemblyTitle("MonoDevelop.MonoGame")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("")]
[assembly: AssemblyCopyright("d_ellis")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]

// The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}".
// The form "{Major}.{Minor}.*" will automatically update the build and revision,
// and "{Major}.{Minor}.{Build}.*" will update just the revision.

[assembly: AssemblyVersion("1.0.*")]

// The following attributes are used to specify the signing key for the assembly,
// if desired. See the Mono documentation for more information about signing.

//[assembly: AssemblyDelaySign(false)]
//[assembly: AssemblyKeyFile("")]

Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,14 @@
category = "Mono Game"
version = "2.5">


<Runtime>
<Import file = "templates/MonoGameAndroidProject.xpt.xml"/>
<Import file = "templates/MonoGameWindowsProject.xpt.xml"/>
<Import file = "templates/MonoGameLinuxProject.xpt.xml"/>
<Import file = "MonoDevelop.MonoGame.dll"/>
</Runtime>

<Dependencies>
<Addin id="Core" version="2.8"/>
<Addin id="Ide" version="2.8"/>
Expand All @@ -19,6 +27,10 @@
<Extension path = "/MonoDevelop/Core/StockIcons">
<StockIcon stockid = "monogame-project" file = "icons/monogame-project-32.png" />
</Extension>

<Extension path = "/MonoDevelop/ProjectModel/ProjectBindings">
<ProjectBinding id = "MonoGame" class = "MonoDevelop.MonoGame.MonoGameProjectBinding" />
</Extension>

<Extension path = "/MonoDevelop/Ide/ProjectTemplates">
<ProjectTemplate id = "MonoGameForAndroidProject" file = "templates/MonoGameAndroidProject.xpt.xml"/>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProductVersion>9.0.21022</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{DEFFDDB9-F86B-452F-B1B2-6379DB6D10EA}</ProjectGuid>
<OutputType>Library</OutputType>
<RootNamespace>MonoDevelop.MonoGame</RootNamespace>
<AssemblyName>MonoDevelop.MonoGame</AssemblyName>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>..\..\..\..\..\..\Program Files (x86)\MonoDevelop\AddIns\MonoDevelop.MonoGame</OutputPath>
<DefineConstants>DEBUG;</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<ConsolePause>false</ConsolePause>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>none</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Release\</OutputPath>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<ConsolePause>false</ConsolePause>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="MonoDevelop.Core">
<HintPath>..\..\..\..\..\..\Program Files %28x86%29\MonoDevelop\bin\MonoDevelop.Core.dll</HintPath>
</Reference>
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="AssemblyInfo.cs" />
<Compile Include="MonoGameProject.cs" />
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<ItemGroup>
<EmbeddedResource Include="MonoDevelop.MonoGame.addin.xml" />
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
using System;
using MonoDevelop.Projects;
using System.Xml;
using MonoDevelop.Core.Assemblies;

namespace MonoDevelop.MonoGame
{
public class MonoGameProject : DotNetAssemblyProject
{
public MonoGameProject ()
{
Init ();
}

public MonoGameProject (string languageName)
: base (languageName)
{
Init ();
}

public MonoGameProject (string languageName, ProjectCreateInformation info, XmlElement projectOptions)
: base (languageName, info, projectOptions)
{
Init ();
}

private void Init()
{
}

public override SolutionItemConfiguration CreateConfiguration (string name)
{
var conf = new MonoGameProjectConfiguration (name);
conf.CopyFrom (base.CreateConfiguration (name));
return conf;
}

public override bool SupportsFormat (FileFormat format)
{
return format.Id == "MSBuild10";
}

public override TargetFrameworkMoniker GetDefaultTargetFrameworkForFormat (FileFormat format)
{
return new TargetFrameworkMoniker("4.0");
}

public override bool SupportsFramework (MonoDevelop.Core.Assemblies.TargetFramework framework)
{
if (!framework.IsCompatibleWithFramework (MonoDevelop.Core.Assemblies.TargetFrameworkMoniker.NET_4_0))
return false;
else
return base.SupportsFramework (framework);
}
}

public class MonoGameProjectBinding : IProjectBinding
{
public Project CreateProject (ProjectCreateInformation info, System.Xml.XmlElement projectOptions)
{
string lang = projectOptions.GetAttribute ("language");
return new MonoGameProject (lang, info, projectOptions);
}

public Project CreateSingleFileProject (string sourceFile)
{
throw new InvalidOperationException ();
}

public bool CanCreateSingleFileProject (string sourceFile)
{
return false;
}

public string Name {
get { return "MonoGame"; }
}
}

public class MonoGameProjectConfiguration : DotNetProjectConfiguration
{
public MonoGameProjectConfiguration () : base ()
{
}

public MonoGameProjectConfiguration (string name) : base (name)
{
}

public override void CopyFrom (ItemConfiguration configuration)
{
base.CopyFrom (configuration);
}
}
}

Loading

0 comments on commit 90b501a

Please sign in to comment.