Added default boot disk image which is read from an embedded resource.

--HG--
extra : convert_revision : svn%3Affd33b8c-2492-42e0-bdc5-587b920b7d6d/trunk%4035708
This commit is contained in:
Sean Fausett 2009-12-14 08:06:40 +00:00
parent ae126d2552
commit 8bc3b239c5
13 changed files with 82 additions and 28 deletions

View File

@ -23,7 +23,7 @@
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\</OutputPath>
<DefineConstants>TRACE;DEBUG;CODE_ANALYSIS</DefineConstants>
<DefineConstants>TRACE;DEBUG;WINDOWS;CODE_ANALYSIS</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<RunCodeAnalysis>false</RunCodeAnalysis>
@ -33,7 +33,7 @@
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\</OutputPath>
<DefineConstants>TRACE;CODE_ANALYSIS</DefineConstants>
<DefineConstants>TRACE;WINDOWS;CODE_ANALYSIS</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>

View File

@ -1,4 +1,5 @@
using System.Diagnostics.CodeAnalysis;
using Jellyfish.Virtu.Services;
using Jellyfish.Virtu.Settings;
namespace Jellyfish.Virtu
@ -12,6 +13,8 @@ namespace Jellyfish.Virtu
public override void Initialize()
{
_drives[0].InsertDisk("Default.dsk", StorageService.GetResourceStream("Default.dsk", 0x23000), false);
#if WINDOWS
DiskIISettings settings = Machine.Settings.DiskII;
if (settings.Disk1.Name.Length > 0)

BIN
Virtu/Disks/Default.dsk Normal file

Binary file not shown.

View File

@ -1,10 +1,8 @@
using System;
using System.Diagnostics.CodeAnalysis;
using System.Globalization;
using System.IO;
using System.Resources;
using Jellyfish.Library;
using Jellyfish.Virtu.Properties;
using Jellyfish.Virtu.Services;
namespace Jellyfish.Virtu
{
@ -90,13 +88,13 @@ namespace Jellyfish.Virtu
_speaker = Machine.Speaker;
_video = Machine.Video;
Stream romStream = GetRomStream("AppleIIe.rom", 0x4000);
Stream romStream = StorageService.GetResourceStream("AppleIIe.rom", 0x4000);
romStream.Seek(0x0100, SeekOrigin.Current);
romStream.ReadBlock(_romInternalRegionC1CF, 0x0000, 0x0F00);
romStream.ReadBlock(_romRegionD0DF, 0x0000, 0x1000);
romStream.ReadBlock(_romRegionE0FF, 0x0000, 0x2000);
romStream = GetRomStream("DiskII.rom", 0x0100);
romStream = StorageService.GetResourceStream("DiskII.rom", 0x0100);
romStream.ReadBlock(_romExternalRegionC1CF, 0x0500, 0x0100);
if ((ReadRomRegionE0FF(0xFBB3) == 0x06) && (ReadRomRegionE0FF(0xFBBF) == 0xC1))
@ -1371,18 +1369,6 @@ namespace Jellyfish.Virtu
return ((data & mask) == value);
}
private Stream GetRomStream(string romName, int romSize)
{
ResourceManager resourceManager = new ResourceManager("Jellyfish.Virtu.g", GetType().Assembly) { IgnoreCase = true };
Stream romStream = (Stream)resourceManager.GetObject(romName);
if (romStream.Length != romSize)
{
throw new InvalidOperationException(string.Format(CultureInfo.CurrentCulture, SR.RomInvalid, romName));
}
return romStream;
}
private void ResetState(int mask)
{
_state &= ~mask;

View File

@ -61,11 +61,20 @@ namespace Jellyfish.Virtu.Properties {
}
/// <summary>
/// Looks up a localized string similar to Rom &apos;{0}&apos; invalid..
/// Looks up a localized string similar to Resource &apos;{0}&apos; invalid..
/// </summary>
internal static string RomInvalid {
internal static string ResourceInvalid {
get {
return ResourceManager.GetString("RomInvalid", resourceCulture);
return ResourceManager.GetString("ResourceInvalid", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Resource &apos;{0}&apos; not found..
/// </summary>
internal static string ResourceNotFound {
get {
return ResourceManager.GetString("ResourceNotFound", resourceCulture);
}
}

View File

@ -117,8 +117,11 @@
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<data name="RomInvalid" xml:space="preserve">
<value>Rom '{0}' invalid.</value>
<data name="ResourceNotFound" xml:space="preserve">
<value>Resource '{0}' not found.</value>
</data>
<data name="ResourceInvalid" xml:space="preserve">
<value>Resource '{0}' invalid.</value>
</data>
<data name="ServiceAlreadyPresent" xml:space="preserve">
<value>Service type '{0}' already present.</value>

View File

@ -1,5 +1,9 @@
using System;
using System.Globalization;
using System.IO;
using System.Reflection;
using System.Resources;
using Jellyfish.Virtu.Properties;
namespace Jellyfish.Virtu.Services
{
@ -10,6 +14,27 @@ namespace Jellyfish.Virtu.Services
{
}
public static Stream GetResourceStream(string resourceName)
{
return GetResourceStream(resourceName, 0);
}
public static Stream GetResourceStream(string resourceName, int resourceSize)
{
ResourceManager resourceManager = new ResourceManager("Jellyfish.Virtu.g", Assembly.GetExecutingAssembly()) { IgnoreCase = true };
Stream resourceStream = (Stream)resourceManager.GetObject(resourceName);
if (resourceStream == null)
{
throw new InvalidOperationException(string.Format(CultureInfo.CurrentCulture, SR.ResourceNotFound, resourceName));
}
if ((resourceSize > 0) && (resourceStream.Length != resourceSize))
{
throw new InvalidOperationException(string.Format(CultureInfo.CurrentCulture, SR.ResourceInvalid, resourceName));
}
return resourceStream;
}
public abstract void Load(string path, Action<Stream> reader);
public abstract void Save(string path, Action<Stream> writer);
}

View File

@ -205,6 +205,9 @@
</CodeAnalysisDictionary>
</ItemGroup>
<ItemGroup>
<Resource Include="..\Disks\Default.dsk">
<Link>Disks\Default.dsk</Link>
</Resource>
<None Include="Properties\OutOfBrowserSettings.xml" />
</ItemGroup>
<Import Project="$(MSBuildExtensionsPath)\Microsoft\Silverlight\v3.0\Microsoft.Silverlight.CSharp.targets" Condition="" />

View File

@ -23,7 +23,7 @@
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\</OutputPath>
<DefineConstants>TRACE;DEBUG;CODE_ANALYSIS</DefineConstants>
<DefineConstants>TRACE;DEBUG;WINDOWS;CODE_ANALYSIS</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
@ -35,7 +35,7 @@
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\</OutputPath>
<DefineConstants>TRACE;CODE_ANALYSIS</DefineConstants>
<DefineConstants>TRACE;WINDOWS;CODE_ANALYSIS</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
@ -210,6 +210,11 @@
<Link>CustomDictionary.xml</Link>
</CodeAnalysisDictionary>
</ItemGroup>
<ItemGroup>
<Resource Include="..\Disks\Default.dsk">
<Link>Disks\Default.dsk</Link>
</Resource>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.

View File

@ -3,6 +3,7 @@ using System.IO;
using System.Windows;
using System.Windows.Media;
using Jellyfish.Virtu.Services;
using Jellyfish.Virtu.Settings;
using Microsoft.Win32;
namespace Jellyfish.Virtu
@ -62,6 +63,15 @@ namespace Jellyfish.Virtu
{
_machine.Pause();
_machine.DiskII.Drives[drive].InsertDisk(dialog.FileName, stream, false);
DiskIISettings settings = _machine.Settings.DiskII;
if (drive == 0)
{
settings.Disk1.Name = dialog.FileName;
}
else
{
settings.Disk2.Name = dialog.FileName;
}
_machine.Unpause();
}
}

View File

@ -257,6 +257,11 @@
<Name>Jellyfish.Library.Xna.Xbox</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<Resource Include="..\Disks\Default.dsk">
<Link>Disks\Default.dsk</Link>
</Resource>
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<Import Project="$(MSBuildExtensionsPath)\Microsoft\XNA Game Studio\Microsoft.Xna.GameStudio.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.

View File

@ -253,6 +253,11 @@
<Name>Jellyfish.Library.Xna</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<Resource Include="..\Disks\Default.dsk">
<Link>Disks\Default.dsk</Link>
</Resource>
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<Import Project="$(MSBuildExtensionsPath)\Microsoft\XNA Game Studio\Microsoft.Xna.GameStudio.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.

View File

@ -29,8 +29,8 @@ namespace Jellyfish.Virtu.Services
Joystick0 = GetJoystick(ref left, ref dpad);
Joystick1 = GetJoystick(ref right);
IsButton0Down = (_state.Buttons.A == ButtonState.Pressed);
IsButton1Down = (_state.Buttons.B == ButtonState.Pressed);
IsButton0Down = ((_state.Buttons.A == ButtonState.Pressed) || (_state.Buttons.LeftShoulder == ButtonState.Pressed));
IsButton1Down = ((_state.Buttons.B == ButtonState.Pressed) || (_state.Buttons.RightShoulder == ButtonState.Pressed));
IsButton2Down = (_state.Buttons.X == ButtonState.Pressed);
}
}