mirror of
https://github.com/digital-jellyfish/Virtu.git
synced 2024-05-29 02:41:28 +00:00
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:
parent
ae126d2552
commit
8bc3b239c5
|
@ -23,7 +23,7 @@
|
||||||
<DebugType>full</DebugType>
|
<DebugType>full</DebugType>
|
||||||
<Optimize>false</Optimize>
|
<Optimize>false</Optimize>
|
||||||
<OutputPath>bin\</OutputPath>
|
<OutputPath>bin\</OutputPath>
|
||||||
<DefineConstants>TRACE;DEBUG;CODE_ANALYSIS</DefineConstants>
|
<DefineConstants>TRACE;DEBUG;WINDOWS;CODE_ANALYSIS</DefineConstants>
|
||||||
<ErrorReport>prompt</ErrorReport>
|
<ErrorReport>prompt</ErrorReport>
|
||||||
<WarningLevel>4</WarningLevel>
|
<WarningLevel>4</WarningLevel>
|
||||||
<RunCodeAnalysis>false</RunCodeAnalysis>
|
<RunCodeAnalysis>false</RunCodeAnalysis>
|
||||||
|
@ -33,7 +33,7 @@
|
||||||
<DebugType>pdbonly</DebugType>
|
<DebugType>pdbonly</DebugType>
|
||||||
<Optimize>true</Optimize>
|
<Optimize>true</Optimize>
|
||||||
<OutputPath>bin\</OutputPath>
|
<OutputPath>bin\</OutputPath>
|
||||||
<DefineConstants>TRACE;CODE_ANALYSIS</DefineConstants>
|
<DefineConstants>TRACE;WINDOWS;CODE_ANALYSIS</DefineConstants>
|
||||||
<ErrorReport>prompt</ErrorReport>
|
<ErrorReport>prompt</ErrorReport>
|
||||||
<WarningLevel>4</WarningLevel>
|
<WarningLevel>4</WarningLevel>
|
||||||
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
|
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
using System.Diagnostics.CodeAnalysis;
|
using System.Diagnostics.CodeAnalysis;
|
||||||
|
using Jellyfish.Virtu.Services;
|
||||||
using Jellyfish.Virtu.Settings;
|
using Jellyfish.Virtu.Settings;
|
||||||
|
|
||||||
namespace Jellyfish.Virtu
|
namespace Jellyfish.Virtu
|
||||||
|
@ -12,6 +13,8 @@ public DiskII(Machine machine) :
|
||||||
|
|
||||||
public override void Initialize()
|
public override void Initialize()
|
||||||
{
|
{
|
||||||
|
_drives[0].InsertDisk("Default.dsk", StorageService.GetResourceStream("Default.dsk", 0x23000), false);
|
||||||
|
|
||||||
#if WINDOWS
|
#if WINDOWS
|
||||||
DiskIISettings settings = Machine.Settings.DiskII;
|
DiskIISettings settings = Machine.Settings.DiskII;
|
||||||
if (settings.Disk1.Name.Length > 0)
|
if (settings.Disk1.Name.Length > 0)
|
||||||
|
|
BIN
Virtu/Disks/Default.dsk
Normal file
BIN
Virtu/Disks/Default.dsk
Normal file
Binary file not shown.
|
@ -1,10 +1,8 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Diagnostics.CodeAnalysis;
|
using System.Diagnostics.CodeAnalysis;
|
||||||
using System.Globalization;
|
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Resources;
|
|
||||||
using Jellyfish.Library;
|
using Jellyfish.Library;
|
||||||
using Jellyfish.Virtu.Properties;
|
using Jellyfish.Virtu.Services;
|
||||||
|
|
||||||
namespace Jellyfish.Virtu
|
namespace Jellyfish.Virtu
|
||||||
{
|
{
|
||||||
|
@ -90,13 +88,13 @@ public override void Initialize()
|
||||||
_speaker = Machine.Speaker;
|
_speaker = Machine.Speaker;
|
||||||
_video = Machine.Video;
|
_video = Machine.Video;
|
||||||
|
|
||||||
Stream romStream = GetRomStream("AppleIIe.rom", 0x4000);
|
Stream romStream = StorageService.GetResourceStream("AppleIIe.rom", 0x4000);
|
||||||
romStream.Seek(0x0100, SeekOrigin.Current);
|
romStream.Seek(0x0100, SeekOrigin.Current);
|
||||||
romStream.ReadBlock(_romInternalRegionC1CF, 0x0000, 0x0F00);
|
romStream.ReadBlock(_romInternalRegionC1CF, 0x0000, 0x0F00);
|
||||||
romStream.ReadBlock(_romRegionD0DF, 0x0000, 0x1000);
|
romStream.ReadBlock(_romRegionD0DF, 0x0000, 0x1000);
|
||||||
romStream.ReadBlock(_romRegionE0FF, 0x0000, 0x2000);
|
romStream.ReadBlock(_romRegionE0FF, 0x0000, 0x2000);
|
||||||
|
|
||||||
romStream = GetRomStream("DiskII.rom", 0x0100);
|
romStream = StorageService.GetResourceStream("DiskII.rom", 0x0100);
|
||||||
romStream.ReadBlock(_romExternalRegionC1CF, 0x0500, 0x0100);
|
romStream.ReadBlock(_romExternalRegionC1CF, 0x0500, 0x0100);
|
||||||
|
|
||||||
if ((ReadRomRegionE0FF(0xFBB3) == 0x06) && (ReadRomRegionE0FF(0xFBBF) == 0xC1))
|
if ((ReadRomRegionE0FF(0xFBB3) == 0x06) && (ReadRomRegionE0FF(0xFBBF) == 0xC1))
|
||||||
|
@ -1371,18 +1369,6 @@ private static bool TestMask(int data, int mask, int value)
|
||||||
return ((data & mask) == value);
|
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)
|
private void ResetState(int mask)
|
||||||
{
|
{
|
||||||
_state &= ~mask;
|
_state &= ~mask;
|
||||||
|
|
15
Virtu/Properties/SR.Designer.cs
generated
15
Virtu/Properties/SR.Designer.cs
generated
|
@ -61,11 +61,20 @@ internal SR() {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Looks up a localized string similar to Rom '{0}' invalid..
|
/// Looks up a localized string similar to Resource '{0}' invalid..
|
||||||
/// </summary>
|
/// </summary>
|
||||||
internal static string RomInvalid {
|
internal static string ResourceInvalid {
|
||||||
get {
|
get {
|
||||||
return ResourceManager.GetString("RomInvalid", resourceCulture);
|
return ResourceManager.GetString("ResourceInvalid", resourceCulture);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Looks up a localized string similar to Resource '{0}' not found..
|
||||||
|
/// </summary>
|
||||||
|
internal static string ResourceNotFound {
|
||||||
|
get {
|
||||||
|
return ResourceManager.GetString("ResourceNotFound", resourceCulture);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -117,8 +117,11 @@
|
||||||
<resheader name="writer">
|
<resheader name="writer">
|
||||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
</resheader>
|
</resheader>
|
||||||
<data name="RomInvalid" xml:space="preserve">
|
<data name="ResourceNotFound" xml:space="preserve">
|
||||||
<value>Rom '{0}' invalid.</value>
|
<value>Resource '{0}' not found.</value>
|
||||||
|
</data>
|
||||||
|
<data name="ResourceInvalid" xml:space="preserve">
|
||||||
|
<value>Resource '{0}' invalid.</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="ServiceAlreadyPresent" xml:space="preserve">
|
<data name="ServiceAlreadyPresent" xml:space="preserve">
|
||||||
<value>Service type '{0}' already present.</value>
|
<value>Service type '{0}' already present.</value>
|
||||||
|
|
|
@ -1,5 +1,9 @@
|
||||||
using System;
|
using System;
|
||||||
|
using System.Globalization;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
|
using System.Reflection;
|
||||||
|
using System.Resources;
|
||||||
|
using Jellyfish.Virtu.Properties;
|
||||||
|
|
||||||
namespace Jellyfish.Virtu.Services
|
namespace Jellyfish.Virtu.Services
|
||||||
{
|
{
|
||||||
|
@ -10,6 +14,27 @@ protected StorageService(Machine machine) :
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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 Load(string path, Action<Stream> reader);
|
||||||
public abstract void Save(string path, Action<Stream> writer);
|
public abstract void Save(string path, Action<Stream> writer);
|
||||||
}
|
}
|
||||||
|
|
|
@ -205,6 +205,9 @@
|
||||||
</CodeAnalysisDictionary>
|
</CodeAnalysisDictionary>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
<Resource Include="..\Disks\Default.dsk">
|
||||||
|
<Link>Disks\Default.dsk</Link>
|
||||||
|
</Resource>
|
||||||
<None Include="Properties\OutOfBrowserSettings.xml" />
|
<None Include="Properties\OutOfBrowserSettings.xml" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<Import Project="$(MSBuildExtensionsPath)\Microsoft\Silverlight\v3.0\Microsoft.Silverlight.CSharp.targets" Condition="" />
|
<Import Project="$(MSBuildExtensionsPath)\Microsoft\Silverlight\v3.0\Microsoft.Silverlight.CSharp.targets" Condition="" />
|
||||||
|
|
|
@ -23,7 +23,7 @@
|
||||||
<DebugType>full</DebugType>
|
<DebugType>full</DebugType>
|
||||||
<Optimize>false</Optimize>
|
<Optimize>false</Optimize>
|
||||||
<OutputPath>bin\</OutputPath>
|
<OutputPath>bin\</OutputPath>
|
||||||
<DefineConstants>TRACE;DEBUG;CODE_ANALYSIS</DefineConstants>
|
<DefineConstants>TRACE;DEBUG;WINDOWS;CODE_ANALYSIS</DefineConstants>
|
||||||
<ErrorReport>prompt</ErrorReport>
|
<ErrorReport>prompt</ErrorReport>
|
||||||
<WarningLevel>4</WarningLevel>
|
<WarningLevel>4</WarningLevel>
|
||||||
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
|
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
|
||||||
|
@ -35,7 +35,7 @@
|
||||||
<DebugType>pdbonly</DebugType>
|
<DebugType>pdbonly</DebugType>
|
||||||
<Optimize>true</Optimize>
|
<Optimize>true</Optimize>
|
||||||
<OutputPath>bin\</OutputPath>
|
<OutputPath>bin\</OutputPath>
|
||||||
<DefineConstants>TRACE;CODE_ANALYSIS</DefineConstants>
|
<DefineConstants>TRACE;WINDOWS;CODE_ANALYSIS</DefineConstants>
|
||||||
<ErrorReport>prompt</ErrorReport>
|
<ErrorReport>prompt</ErrorReport>
|
||||||
<WarningLevel>4</WarningLevel>
|
<WarningLevel>4</WarningLevel>
|
||||||
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
|
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
|
||||||
|
@ -210,6 +210,11 @@
|
||||||
<Link>CustomDictionary.xml</Link>
|
<Link>CustomDictionary.xml</Link>
|
||||||
</CodeAnalysisDictionary>
|
</CodeAnalysisDictionary>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Resource Include="..\Disks\Default.dsk">
|
||||||
|
<Link>Disks\Default.dsk</Link>
|
||||||
|
</Resource>
|
||||||
|
</ItemGroup>
|
||||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
<!-- 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.
|
Other similar extension points exist, see Microsoft.Common.targets.
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
using System.Windows;
|
using System.Windows;
|
||||||
using System.Windows.Media;
|
using System.Windows.Media;
|
||||||
using Jellyfish.Virtu.Services;
|
using Jellyfish.Virtu.Services;
|
||||||
|
using Jellyfish.Virtu.Settings;
|
||||||
using Microsoft.Win32;
|
using Microsoft.Win32;
|
||||||
|
|
||||||
namespace Jellyfish.Virtu
|
namespace Jellyfish.Virtu
|
||||||
|
@ -62,6 +63,15 @@ private void OnDiskButtonClick(int drive)
|
||||||
{
|
{
|
||||||
_machine.Pause();
|
_machine.Pause();
|
||||||
_machine.DiskII.Drives[drive].InsertDisk(dialog.FileName, stream, false);
|
_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();
|
_machine.Unpause();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -257,6 +257,11 @@
|
||||||
<Name>Jellyfish.Library.Xna.Xbox</Name>
|
<Name>Jellyfish.Library.Xna.Xbox</Name>
|
||||||
</ProjectReference>
|
</ProjectReference>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Resource Include="..\Disks\Default.dsk">
|
||||||
|
<Link>Disks\Default.dsk</Link>
|
||||||
|
</Resource>
|
||||||
|
</ItemGroup>
|
||||||
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
|
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
|
||||||
<Import Project="$(MSBuildExtensionsPath)\Microsoft\XNA Game Studio\Microsoft.Xna.GameStudio.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.
|
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||||
|
|
|
@ -253,6 +253,11 @@
|
||||||
<Name>Jellyfish.Library.Xna</Name>
|
<Name>Jellyfish.Library.Xna</Name>
|
||||||
</ProjectReference>
|
</ProjectReference>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Resource Include="..\Disks\Default.dsk">
|
||||||
|
<Link>Disks\Default.dsk</Link>
|
||||||
|
</Resource>
|
||||||
|
</ItemGroup>
|
||||||
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
|
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
|
||||||
<Import Project="$(MSBuildExtensionsPath)\Microsoft\XNA Game Studio\Microsoft.Xna.GameStudio.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.
|
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||||
|
|
|
@ -29,8 +29,8 @@ public override void Update()
|
||||||
Joystick0 = GetJoystick(ref left, ref dpad);
|
Joystick0 = GetJoystick(ref left, ref dpad);
|
||||||
Joystick1 = GetJoystick(ref right);
|
Joystick1 = GetJoystick(ref right);
|
||||||
|
|
||||||
IsButton0Down = (_state.Buttons.A == ButtonState.Pressed);
|
IsButton0Down = ((_state.Buttons.A == ButtonState.Pressed) || (_state.Buttons.LeftShoulder == ButtonState.Pressed));
|
||||||
IsButton1Down = (_state.Buttons.B == ButtonState.Pressed);
|
IsButton1Down = ((_state.Buttons.B == ButtonState.Pressed) || (_state.Buttons.RightShoulder == ButtonState.Pressed));
|
||||||
IsButton2Down = (_state.Buttons.X == ButtonState.Pressed);
|
IsButton2Down = (_state.Buttons.X == ButtonState.Pressed);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user