mirror of
https://github.com/digital-jellyfish/Virtu.git
synced 2024-05-31 15:41:33 +00:00
Initial checkin.
--HG-- extra : convert_revision : svn%3Affd33b8c-2492-42e0-bdc5-587b920b7d6d/trunk%4019155
This commit is contained in:
commit
eaaab47a6c
15
Library/AssemblyCommentAttribute.cs
Normal file
15
Library/AssemblyCommentAttribute.cs
Normal file
|
@ -0,0 +1,15 @@
|
|||
using System;
|
||||
|
||||
namespace Jellyfish.Library
|
||||
{
|
||||
[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true, Inherited = false)]
|
||||
public sealed class AssemblyCommentAttribute : Attribute
|
||||
{
|
||||
public AssemblyCommentAttribute(string comment)
|
||||
{
|
||||
Comment = comment;
|
||||
}
|
||||
|
||||
public string Comment { get; private set; }
|
||||
}
|
||||
}
|
8
Library/CustomDictionary.xml
Normal file
8
Library/CustomDictionary.xml
Normal file
|
@ -0,0 +1,8 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Dictionary>
|
||||
<Words>
|
||||
<Recognized>
|
||||
<Word>Alloc</Word>
|
||||
</Recognized>
|
||||
</Words>
|
||||
</Dictionary>
|
19
Library/FileHelpers.cs
Normal file
19
Library/FileHelpers.cs
Normal file
|
@ -0,0 +1,19 @@
|
|||
using System.IO;
|
||||
|
||||
namespace Jellyfish.Library
|
||||
{
|
||||
public static class FileHelpers
|
||||
{
|
||||
public static byte[] ReadAllBytes(string path)
|
||||
{
|
||||
#if SILVERLIGHT || XBOX || ZUNE
|
||||
using (FileStream stream = new FileStream(path, FileMode.Open, FileAccess.Read, FileShare.Read))
|
||||
{
|
||||
return stream.ReadAllBytes();
|
||||
}
|
||||
#else
|
||||
return File.ReadAllBytes(path);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
280
Library/GeneralSecurity.cs
Normal file
280
Library/GeneralSecurity.cs
Normal file
|
@ -0,0 +1,280 @@
|
|||
using System;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Security.AccessControl;
|
||||
using System.Security.Principal;
|
||||
|
||||
namespace Jellyfish.Library
|
||||
{
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
public sealed class SecurityAttributes
|
||||
{
|
||||
public SecurityAttributes()
|
||||
{
|
||||
_length = Marshal.SizeOf(typeof(SecurityAttributes));
|
||||
}
|
||||
|
||||
public int Length { get { return _length; } }
|
||||
public IntPtr SecurityDescriptor { get { return _securityDescriptor; } set { _securityDescriptor = value; } }
|
||||
public bool InheritHandle { get { return _inheritHandle; } set { _inheritHandle = value; } }
|
||||
|
||||
private int _length;
|
||||
private IntPtr _securityDescriptor;
|
||||
private bool _inheritHandle;
|
||||
}
|
||||
|
||||
public sealed class GeneralAccessRule : AccessRule
|
||||
{
|
||||
public GeneralAccessRule(IdentityReference identity, int rights, AccessControlType type) :
|
||||
base(identity, rights, false, InheritanceFlags.None, PropagationFlags.None, type)
|
||||
{
|
||||
}
|
||||
|
||||
public GeneralAccessRule(IdentityReference identity, int rights, InheritanceFlags inheritance, PropagationFlags propagation, AccessControlType type) :
|
||||
base(identity, rights, false, inheritance, propagation, type)
|
||||
{
|
||||
}
|
||||
|
||||
public GeneralAccessRule(IdentityReference identity, int rights, bool isInherited, InheritanceFlags inheritance, PropagationFlags propagation,
|
||||
AccessControlType type) :
|
||||
base(identity, rights, isInherited, inheritance, propagation, type)
|
||||
{
|
||||
}
|
||||
|
||||
public int AccessRights { get { return AccessMask; } }
|
||||
}
|
||||
|
||||
public sealed class GeneralAuditRule : AuditRule
|
||||
{
|
||||
public GeneralAuditRule(IdentityReference identity, int rights, AuditFlags audit) :
|
||||
base(identity, rights, false, InheritanceFlags.None, PropagationFlags.None, audit)
|
||||
{
|
||||
}
|
||||
|
||||
public GeneralAuditRule(IdentityReference identity, int rights, InheritanceFlags inheritance, PropagationFlags propagation, AuditFlags audit) :
|
||||
base(identity, rights, false, inheritance, propagation, audit)
|
||||
{
|
||||
}
|
||||
|
||||
public GeneralAuditRule(IdentityReference identity, int rights, bool isInherited, InheritanceFlags inheritance, PropagationFlags propagation,
|
||||
AuditFlags audit) :
|
||||
base(identity, rights, isInherited, inheritance, propagation, audit)
|
||||
{
|
||||
}
|
||||
|
||||
public int AccessRights { get { return AccessMask; } }
|
||||
}
|
||||
|
||||
public sealed class GeneralSecurity : NativeObjectSecurity
|
||||
{
|
||||
public GeneralSecurity(bool isContainer, ResourceType resourceType) :
|
||||
base(isContainer, resourceType)
|
||||
{
|
||||
}
|
||||
|
||||
public GeneralSecurity(bool isContainer, ResourceType resourceType, SafeHandle handle) :
|
||||
base(isContainer, resourceType, handle, AccessControlSections.Access | AccessControlSections.Group | AccessControlSections.Owner)
|
||||
{
|
||||
}
|
||||
|
||||
public GeneralSecurity(bool isContainer, ResourceType resourceType, SafeHandle handle, AccessControlSections includeSections) :
|
||||
base(isContainer, resourceType, handle, includeSections)
|
||||
{
|
||||
}
|
||||
|
||||
public GeneralSecurity(bool isContainer, ResourceType resourceType, string name) :
|
||||
base(isContainer, resourceType, name, AccessControlSections.Access | AccessControlSections.Group | AccessControlSections.Owner)
|
||||
{
|
||||
}
|
||||
|
||||
public GeneralSecurity(bool isContainer, ResourceType resourceType, string name, AccessControlSections includeSections) :
|
||||
base(isContainer, resourceType, name, includeSections)
|
||||
{
|
||||
}
|
||||
|
||||
public override AccessRule AccessRuleFactory(IdentityReference identityReference, int accessMask, bool isInherited, InheritanceFlags inheritanceFlags,
|
||||
PropagationFlags propagationFlags, AccessControlType type)
|
||||
{
|
||||
return new GeneralAccessRule(identityReference, accessMask, isInherited, inheritanceFlags, propagationFlags, type);
|
||||
}
|
||||
|
||||
public override AuditRule AuditRuleFactory(IdentityReference identityReference, int accessMask, bool isInherited, InheritanceFlags inheritanceFlags,
|
||||
PropagationFlags propagationFlags, AuditFlags flags)
|
||||
{
|
||||
return new GeneralAuditRule(identityReference, accessMask, isInherited, inheritanceFlags, propagationFlags, flags);
|
||||
}
|
||||
|
||||
[SuppressMessage("Microsoft.Design", "CA1011:ConsiderPassingBaseTypesAsParameters")]
|
||||
public void AddAccessRule(GeneralAccessRule rule)
|
||||
{
|
||||
base.AddAccessRule(rule);
|
||||
}
|
||||
|
||||
[SuppressMessage("Microsoft.Design", "CA1011:ConsiderPassingBaseTypesAsParameters")]
|
||||
public void AddAuditRule(GeneralAuditRule rule)
|
||||
{
|
||||
base.AddAuditRule(rule);
|
||||
}
|
||||
|
||||
public void GetSecurityAttributes(bool inheritable, Action<SecurityAttributes> action)
|
||||
{
|
||||
GetSecurityAttributes(this, inheritable, action);
|
||||
}
|
||||
|
||||
public static void GetSecurityAttributes(ObjectSecurity security, bool inheritable, Action<SecurityAttributes> action)
|
||||
{
|
||||
if (security != null)
|
||||
{
|
||||
GCHandle gcHandle = new GCHandle();
|
||||
try
|
||||
{
|
||||
gcHandle = GCHandle.Alloc(security.GetSecurityDescriptorBinaryForm(), GCHandleType.Pinned);
|
||||
SecurityAttributes securityAttributes = new SecurityAttributes();
|
||||
securityAttributes.SecurityDescriptor = gcHandle.AddrOfPinnedObject();
|
||||
securityAttributes.InheritHandle = inheritable;
|
||||
action(securityAttributes);
|
||||
}
|
||||
finally
|
||||
{
|
||||
if (gcHandle.IsAllocated)
|
||||
{
|
||||
gcHandle.Free();
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (inheritable)
|
||||
{
|
||||
action(new SecurityAttributes() { InheritHandle = inheritable });
|
||||
}
|
||||
else
|
||||
{
|
||||
action(null);
|
||||
}
|
||||
}
|
||||
|
||||
[SuppressMessage("Microsoft.Design", "CA1011:ConsiderPassingBaseTypesAsParameters")]
|
||||
public bool RemoveAccessRule(GeneralAccessRule rule)
|
||||
{
|
||||
return base.RemoveAccessRule(rule);
|
||||
}
|
||||
|
||||
[SuppressMessage("Microsoft.Design", "CA1011:ConsiderPassingBaseTypesAsParameters")]
|
||||
public void RemoveAccessRuleAll(GeneralAccessRule rule)
|
||||
{
|
||||
base.RemoveAccessRuleAll(rule);
|
||||
}
|
||||
|
||||
[SuppressMessage("Microsoft.Design", "CA1011:ConsiderPassingBaseTypesAsParameters")]
|
||||
public void RemoveAccessRuleSpecific(GeneralAccessRule rule)
|
||||
{
|
||||
base.RemoveAccessRuleSpecific(rule);
|
||||
}
|
||||
|
||||
[SuppressMessage("Microsoft.Design", "CA1011:ConsiderPassingBaseTypesAsParameters")]
|
||||
public bool RemoveAuditRule(GeneralAuditRule rule)
|
||||
{
|
||||
return base.RemoveAuditRule(rule);
|
||||
}
|
||||
|
||||
[SuppressMessage("Microsoft.Design", "CA1011:ConsiderPassingBaseTypesAsParameters")]
|
||||
public void RemoveAuditRuleAll(GeneralAuditRule rule)
|
||||
{
|
||||
base.RemoveAuditRuleAll(rule);
|
||||
}
|
||||
|
||||
[SuppressMessage("Microsoft.Design", "CA1011:ConsiderPassingBaseTypesAsParameters")]
|
||||
public void RemoveAuditRuleSpecific(GeneralAuditRule rule)
|
||||
{
|
||||
base.RemoveAuditRuleSpecific(rule);
|
||||
}
|
||||
|
||||
[SuppressMessage("Microsoft.Design", "CA1011:ConsiderPassingBaseTypesAsParameters")]
|
||||
public void ResetAccessRule(GeneralAccessRule rule)
|
||||
{
|
||||
base.ResetAccessRule(rule);
|
||||
}
|
||||
|
||||
[SuppressMessage("Microsoft.Design", "CA1011:ConsiderPassingBaseTypesAsParameters")]
|
||||
public void SetAccessRule(GeneralAccessRule rule)
|
||||
{
|
||||
base.SetAccessRule(rule);
|
||||
}
|
||||
|
||||
[SuppressMessage("Microsoft.Design", "CA1011:ConsiderPassingBaseTypesAsParameters")]
|
||||
public void SetAuditRule(GeneralAuditRule rule)
|
||||
{
|
||||
base.SetAuditRule(rule);
|
||||
}
|
||||
|
||||
public void Persist(SafeHandle handle)
|
||||
{
|
||||
WriteLock();
|
||||
try
|
||||
{
|
||||
AccessControlSections sectionsModified = GetAccessControlSectionsModified();
|
||||
if (sectionsModified != AccessControlSections.None)
|
||||
{
|
||||
Persist(handle, sectionsModified);
|
||||
ResetAccessControlSectionsModified();
|
||||
}
|
||||
}
|
||||
finally
|
||||
{
|
||||
WriteUnlock();
|
||||
}
|
||||
}
|
||||
|
||||
public void Persist(string name)
|
||||
{
|
||||
WriteLock();
|
||||
try
|
||||
{
|
||||
AccessControlSections sectionsModified = GetAccessControlSectionsModified();
|
||||
if (sectionsModified != AccessControlSections.None)
|
||||
{
|
||||
Persist(name, sectionsModified);
|
||||
ResetAccessControlSectionsModified();
|
||||
}
|
||||
}
|
||||
finally
|
||||
{
|
||||
WriteUnlock();
|
||||
}
|
||||
}
|
||||
|
||||
private AccessControlSections GetAccessControlSectionsModified()
|
||||
{
|
||||
AccessControlSections sectionsModified = AccessControlSections.None;
|
||||
if (AccessRulesModified)
|
||||
{
|
||||
sectionsModified = AccessControlSections.Access;
|
||||
}
|
||||
if (AuditRulesModified)
|
||||
{
|
||||
sectionsModified |= AccessControlSections.Audit;
|
||||
}
|
||||
if (OwnerModified)
|
||||
{
|
||||
sectionsModified |= AccessControlSections.Owner;
|
||||
}
|
||||
if (GroupModified)
|
||||
{
|
||||
sectionsModified |= AccessControlSections.Group;
|
||||
}
|
||||
|
||||
return sectionsModified;
|
||||
}
|
||||
|
||||
private void ResetAccessControlSectionsModified()
|
||||
{
|
||||
AccessRulesModified = false;
|
||||
AuditRulesModified = false;
|
||||
OwnerModified = false;
|
||||
GroupModified = false;
|
||||
}
|
||||
|
||||
public override Type AccessRightType { get { return typeof(int); } }
|
||||
public override Type AccessRuleType { get { return typeof(GeneralAccessRule); } }
|
||||
public override Type AuditRuleType { get { return typeof(GeneralAuditRule); } }
|
||||
}
|
||||
}
|
3
Library/GlobalSuppressions.cs
Normal file
3
Library/GlobalSuppressions.cs
Normal file
|
@ -0,0 +1,3 @@
|
|||
using System.Diagnostics.CodeAnalysis;
|
||||
|
||||
[assembly: SuppressMessage("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields", Scope = "member", Target = "Jellyfish.Library.FrameRateCounter.#frameRateControl")]
|
16
Library/IEnumerableExtensions.cs
Normal file
16
Library/IEnumerableExtensions.cs
Normal file
|
@ -0,0 +1,16 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Jellyfish.Library
|
||||
{
|
||||
public static class IEnumerableExtensions
|
||||
{
|
||||
public static void ForEach<T>(this IEnumerable<T> source, Action<T> action)
|
||||
{
|
||||
foreach (T item in source)
|
||||
{
|
||||
action(item);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
44
Library/Jellyfish.Library.FxCop
Normal file
44
Library/Jellyfish.Library.FxCop
Normal file
|
@ -0,0 +1,44 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<FxCopProject Version="1.36" Name="My FxCop Project">
|
||||
<ProjectOptions>
|
||||
<SharedProject>True</SharedProject>
|
||||
<Stylesheet Apply="False">c:\program files\microsoft fxcop 1.36\Xml\FxCopReport.xsl</Stylesheet>
|
||||
<SaveMessages>
|
||||
<Project Status="Active, Excluded" NewOnly="False" />
|
||||
<Report Status="Active" NewOnly="False" />
|
||||
</SaveMessages>
|
||||
<ProjectFile Compress="True" DefaultTargetCheck="True" DefaultRuleCheck="True" SaveByRuleGroup="" Deterministic="True" />
|
||||
<EnableMultithreadedLoad>True</EnableMultithreadedLoad>
|
||||
<EnableMultithreadedAnalysis>True</EnableMultithreadedAnalysis>
|
||||
<SourceLookup>True</SourceLookup>
|
||||
<AnalysisExceptionsThreshold>10</AnalysisExceptionsThreshold>
|
||||
<RuleExceptionsThreshold>1</RuleExceptionsThreshold>
|
||||
<Spelling Locale="en-US" />
|
||||
<OverrideRuleVisibilities>False</OverrideRuleVisibilities>
|
||||
<CustomDictionaries SearchFxCopDir="True" SearchUserProfile="True" SearchProjectDir="True" />
|
||||
<SearchGlobalAssemblyCache>True</SearchGlobalAssemblyCache>
|
||||
<DeadlockDetectionTimeout>120</DeadlockDetectionTimeout>
|
||||
<IgnoreGeneratedCode>True</IgnoreGeneratedCode>
|
||||
<TargetFrameworkVersion>3.5</TargetFrameworkVersion>
|
||||
</ProjectOptions>
|
||||
<Targets>
|
||||
<Target Name="$(ProjectDir)/Wpf/bin/Jellyfish.Library.dll" Analyze="True" AnalyzeAllChildren="True" />
|
||||
<Target Name="$(ProjectDir)/Xna/bin/Jellyfish.Library.dll" Analyze="True" AnalyzeAllChildren="True" />
|
||||
</Targets>
|
||||
<Rules>
|
||||
<RuleFiles>
|
||||
<RuleFile Name="$(FxCopDir)\Rules\DesignRules.dll" Enabled="True" AllRulesEnabled="True" />
|
||||
<RuleFile Name="$(FxCopDir)\Rules\GlobalizationRules.dll" Enabled="True" AllRulesEnabled="True" />
|
||||
<RuleFile Name="$(FxCopDir)\Rules\InteroperabilityRules.dll" Enabled="True" AllRulesEnabled="True" />
|
||||
<RuleFile Name="$(FxCopDir)\Rules\MobilityRules.dll" Enabled="True" AllRulesEnabled="True" />
|
||||
<RuleFile Name="$(FxCopDir)\Rules\NamingRules.dll" Enabled="True" AllRulesEnabled="True" />
|
||||
<RuleFile Name="$(FxCopDir)\Rules\PerformanceRules.dll" Enabled="True" AllRulesEnabled="True" />
|
||||
<RuleFile Name="$(FxCopDir)\Rules\PortabilityRules.dll" Enabled="True" AllRulesEnabled="True" />
|
||||
<RuleFile Name="$(FxCopDir)\Rules\SecurityRules.dll" Enabled="True" AllRulesEnabled="True" />
|
||||
<RuleFile Name="$(FxCopDir)\Rules\UsageRules.dll" Enabled="True" AllRulesEnabled="True" />
|
||||
</RuleFiles>
|
||||
<Groups />
|
||||
<Settings />
|
||||
</Rules>
|
||||
<FxCopReport Version="1.36" />
|
||||
</FxCopProject>
|
100
Library/Jellyfish.Library.sln
Normal file
100
Library/Jellyfish.Library.sln
Normal file
|
@ -0,0 +1,100 @@
|
|||
|
||||
Microsoft Visual Studio Solution File, Format Version 10.00
|
||||
# Visual Studio 2008
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Jellyfish.Library.Silverlight", "Silverlight\Jellyfish.Library.Silverlight.csproj", "{DAB11A70-D08B-4A96-8A54-E81B1DE39681}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Jellyfish.Library.Wpf", "Wpf\Jellyfish.Library.Wpf.csproj", "{D47A24A9-1590-4E8A-A406-BC66D5891BFA}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Jellyfish.Library.Xna", "Xna\Jellyfish.Library.Xna.csproj", "{E246958B-EAD8-48E9-844B-54718C952869}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Jellyfish.Library.Xna.Xbox", "Xna\Jellyfish.Library.Xna.Xbox.csproj", "{6EE9A3C2-0BD8-480D-AED2-6A5A9EBF7AFA}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Jellyfish.Library.Xna.Zune", "Xna\Jellyfish.Library.Xna.Zune.csproj", "{8B5D5A39-10FA-434A-B8C4-09D4FDB96720}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Release|Any CPU = Release|Any CPU
|
||||
Debug|Mixed Platforms = Debug|Mixed Platforms
|
||||
Debug|x86 = Debug|x86
|
||||
Debug|Xbox 360 = Debug|Xbox 360
|
||||
Debug|Zune = Debug|Zune
|
||||
Release|Mixed Platforms = Release|Mixed Platforms
|
||||
Release|x86 = Release|x86
|
||||
Release|Xbox 360 = Release|Xbox 360
|
||||
Release|Zune = Release|Zune
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{DAB11A70-D08B-4A96-8A54-E81B1DE39681}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{DAB11A70-D08B-4A96-8A54-E81B1DE39681}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{DAB11A70-D08B-4A96-8A54-E81B1DE39681}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
|
||||
{DAB11A70-D08B-4A96-8A54-E81B1DE39681}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
|
||||
{DAB11A70-D08B-4A96-8A54-E81B1DE39681}.Debug|x86.ActiveCfg = Debug|Any CPU
|
||||
{DAB11A70-D08B-4A96-8A54-E81B1DE39681}.Debug|Xbox 360.ActiveCfg = Debug|Any CPU
|
||||
{DAB11A70-D08B-4A96-8A54-E81B1DE39681}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{DAB11A70-D08B-4A96-8A54-E81B1DE39681}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{DAB11A70-D08B-4A96-8A54-E81B1DE39681}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
|
||||
{DAB11A70-D08B-4A96-8A54-E81B1DE39681}.Release|Mixed Platforms.Build.0 = Release|Any CPU
|
||||
{DAB11A70-D08B-4A96-8A54-E81B1DE39681}.Release|x86.ActiveCfg = Release|Any CPU
|
||||
{DAB11A70-D08B-4A96-8A54-E81B1DE39681}.Release|Xbox 360.ActiveCfg = Release|Any CPU
|
||||
{D47A24A9-1590-4E8A-A406-BC66D5891BFA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{D47A24A9-1590-4E8A-A406-BC66D5891BFA}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{D47A24A9-1590-4E8A-A406-BC66D5891BFA}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
|
||||
{D47A24A9-1590-4E8A-A406-BC66D5891BFA}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
|
||||
{D47A24A9-1590-4E8A-A406-BC66D5891BFA}.Debug|x86.ActiveCfg = Debug|Any CPU
|
||||
{D47A24A9-1590-4E8A-A406-BC66D5891BFA}.Debug|Xbox 360.ActiveCfg = Debug|Any CPU
|
||||
{D47A24A9-1590-4E8A-A406-BC66D5891BFA}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{D47A24A9-1590-4E8A-A406-BC66D5891BFA}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{D47A24A9-1590-4E8A-A406-BC66D5891BFA}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
|
||||
{D47A24A9-1590-4E8A-A406-BC66D5891BFA}.Release|Mixed Platforms.Build.0 = Release|Any CPU
|
||||
{D47A24A9-1590-4E8A-A406-BC66D5891BFA}.Release|x86.ActiveCfg = Release|Any CPU
|
||||
{D47A24A9-1590-4E8A-A406-BC66D5891BFA}.Release|Xbox 360.ActiveCfg = Release|Any CPU
|
||||
{E246958B-EAD8-48E9-844B-54718C952869}.Debug|Mixed Platforms.ActiveCfg = Debug|x86
|
||||
{E246958B-EAD8-48E9-844B-54718C952869}.Debug|Mixed Platforms.Build.0 = Debug|x86
|
||||
{E246958B-EAD8-48E9-844B-54718C952869}.Debug|x86.ActiveCfg = Debug|x86
|
||||
{E246958B-EAD8-48E9-844B-54718C952869}.Debug|x86.Build.0 = Debug|x86
|
||||
{E246958B-EAD8-48E9-844B-54718C952869}.Debug|Xbox 360.ActiveCfg = Debug|x86
|
||||
{E246958B-EAD8-48E9-844B-54718C952869}.Debug|Zune.ActiveCfg = Debug|x86
|
||||
{E246958B-EAD8-48E9-844B-54718C952869}.Release|Mixed Platforms.ActiveCfg = Release|x86
|
||||
{E246958B-EAD8-48E9-844B-54718C952869}.Release|Mixed Platforms.Build.0 = Release|x86
|
||||
{E246958B-EAD8-48E9-844B-54718C952869}.Release|x86.ActiveCfg = Release|x86
|
||||
{E246958B-EAD8-48E9-844B-54718C952869}.Release|x86.Build.0 = Release|x86
|
||||
{E246958B-EAD8-48E9-844B-54718C952869}.Release|Xbox 360.ActiveCfg = Release|x86
|
||||
{E246958B-EAD8-48E9-844B-54718C952869}.Release|Zune.ActiveCfg = Release|x86
|
||||
{6EE9A3C2-0BD8-480D-AED2-6A5A9EBF7AFA}.Debug|Mixed Platforms.ActiveCfg = Debug|Xbox 360
|
||||
{6EE9A3C2-0BD8-480D-AED2-6A5A9EBF7AFA}.Debug|Mixed Platforms.Build.0 = Debug|Xbox 360
|
||||
{6EE9A3C2-0BD8-480D-AED2-6A5A9EBF7AFA}.Debug|x86.ActiveCfg = Debug|Xbox 360
|
||||
{6EE9A3C2-0BD8-480D-AED2-6A5A9EBF7AFA}.Debug|Xbox 360.ActiveCfg = Debug|Xbox 360
|
||||
{6EE9A3C2-0BD8-480D-AED2-6A5A9EBF7AFA}.Debug|Xbox 360.Build.0 = Debug|Xbox 360
|
||||
{6EE9A3C2-0BD8-480D-AED2-6A5A9EBF7AFA}.Debug|Zune.ActiveCfg = Debug|Xbox 360
|
||||
{6EE9A3C2-0BD8-480D-AED2-6A5A9EBF7AFA}.Release|Mixed Platforms.ActiveCfg = Release|Xbox 360
|
||||
{6EE9A3C2-0BD8-480D-AED2-6A5A9EBF7AFA}.Release|Mixed Platforms.Build.0 = Release|Xbox 360
|
||||
{6EE9A3C2-0BD8-480D-AED2-6A5A9EBF7AFA}.Release|x86.ActiveCfg = Release|Xbox 360
|
||||
{6EE9A3C2-0BD8-480D-AED2-6A5A9EBF7AFA}.Release|Xbox 360.ActiveCfg = Release|Xbox 360
|
||||
{6EE9A3C2-0BD8-480D-AED2-6A5A9EBF7AFA}.Release|Xbox 360.Build.0 = Release|Xbox 360
|
||||
{6EE9A3C2-0BD8-480D-AED2-6A5A9EBF7AFA}.Release|Zune.ActiveCfg = Release|Xbox 360
|
||||
{A96F5631-40E1-40B0-AEE2-6F2E3368E2AE}.Debug|Mixed Platforms.ActiveCfg = Debug|x86
|
||||
{A96F5631-40E1-40B0-AEE2-6F2E3368E2AE}.Debug|x86.ActiveCfg = Debug|x86
|
||||
{A96F5631-40E1-40B0-AEE2-6F2E3368E2AE}.Debug|Xbox 360.ActiveCfg = Debug|x86
|
||||
{A96F5631-40E1-40B0-AEE2-6F2E3368E2AE}.Debug|Zune.ActiveCfg = Debug|x86
|
||||
{A96F5631-40E1-40B0-AEE2-6F2E3368E2AE}.Release|Mixed Platforms.ActiveCfg = Release|x86
|
||||
{A96F5631-40E1-40B0-AEE2-6F2E3368E2AE}.Release|x86.ActiveCfg = Release|x86
|
||||
{A96F5631-40E1-40B0-AEE2-6F2E3368E2AE}.Release|Xbox 360.ActiveCfg = Release|x86
|
||||
{A96F5631-40E1-40B0-AEE2-6F2E3368E2AE}.Release|Zune.ActiveCfg = Release|x86
|
||||
{8B5D5A39-10FA-434A-B8C4-09D4FDB96720}.Debug|Mixed Platforms.ActiveCfg = Debug|Zune
|
||||
{8B5D5A39-10FA-434A-B8C4-09D4FDB96720}.Debug|Mixed Platforms.Build.0 = Debug|Zune
|
||||
{8B5D5A39-10FA-434A-B8C4-09D4FDB96720}.Debug|x86.ActiveCfg = Debug|Zune
|
||||
{8B5D5A39-10FA-434A-B8C4-09D4FDB96720}.Debug|Xbox 360.ActiveCfg = Debug|Zune
|
||||
{8B5D5A39-10FA-434A-B8C4-09D4FDB96720}.Debug|Zune.ActiveCfg = Debug|Zune
|
||||
{8B5D5A39-10FA-434A-B8C4-09D4FDB96720}.Debug|Zune.Build.0 = Debug|Zune
|
||||
{8B5D5A39-10FA-434A-B8C4-09D4FDB96720}.Release|Mixed Platforms.ActiveCfg = Release|Zune
|
||||
{8B5D5A39-10FA-434A-B8C4-09D4FDB96720}.Release|Mixed Platforms.Build.0 = Release|Zune
|
||||
{8B5D5A39-10FA-434A-B8C4-09D4FDB96720}.Release|x86.ActiveCfg = Release|Zune
|
||||
{8B5D5A39-10FA-434A-B8C4-09D4FDB96720}.Release|Xbox 360.ActiveCfg = Release|Zune
|
||||
{8B5D5A39-10FA-434A-B8C4-09D4FDB96720}.Release|Zune.ActiveCfg = Release|Zune
|
||||
{8B5D5A39-10FA-434A-B8C4-09D4FDB96720}.Release|Zune.Build.0 = Release|Zune
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
EndGlobal
|
37
Library/Lazy.cs
Normal file
37
Library/Lazy.cs
Normal file
|
@ -0,0 +1,37 @@
|
|||
using System;
|
||||
using System.Threading;
|
||||
|
||||
namespace Jellyfish.Library
|
||||
{
|
||||
public class Lazy<T> where T : class
|
||||
{
|
||||
public Lazy(Func<T> initializer)
|
||||
{
|
||||
_initializer = initializer;
|
||||
}
|
||||
|
||||
public T Value
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_value == null)
|
||||
{
|
||||
T value = _initializer();
|
||||
if (Interlocked.CompareExchange(ref _value, value, null) != null)
|
||||
{
|
||||
IDisposable disposable = value as IDisposable; // dispose preempted instance
|
||||
if (disposable != null)
|
||||
{
|
||||
disposable.Dispose();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return _value;
|
||||
}
|
||||
}
|
||||
|
||||
private Func<T> _initializer;
|
||||
private T _value;
|
||||
}
|
||||
}
|
15
Library/MathHelpers.cs
Normal file
15
Library/MathHelpers.cs
Normal file
|
@ -0,0 +1,15 @@
|
|||
namespace Jellyfish.Library
|
||||
{
|
||||
public static class MathHelpers
|
||||
{
|
||||
public static int Clamp(int value, int min, int max)
|
||||
{
|
||||
return (value < min) ? min : (value > max) ? max : value;
|
||||
}
|
||||
|
||||
public static int ClampByte(int value)
|
||||
{
|
||||
return Clamp(value, byte.MinValue, byte.MaxValue);
|
||||
}
|
||||
}
|
||||
}
|
137
Library/SafeAllocHandle.cs
Normal file
137
Library/SafeAllocHandle.cs
Normal file
|
@ -0,0 +1,137 @@
|
|||
using System;
|
||||
using System.ComponentModel;
|
||||
using System.Runtime.ConstrainedExecution;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Security;
|
||||
using System.Security.Permissions;
|
||||
using Microsoft.Win32.SafeHandles;
|
||||
|
||||
namespace Jellyfish.Library
|
||||
{
|
||||
[SecurityPermission(SecurityAction.InheritanceDemand, UnmanagedCode = true)]
|
||||
[SecurityPermission(SecurityAction.LinkDemand, UnmanagedCode = true)]
|
||||
public abstract class SafeAllocHandle : SafeHandleZeroOrMinusOneIsInvalid
|
||||
{
|
||||
[ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)]
|
||||
protected SafeAllocHandle(bool ownsHandle) :
|
||||
base(ownsHandle)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
[SecurityPermission(SecurityAction.LinkDemand, UnmanagedCode = true)]
|
||||
public sealed class SafeGlobalAllocHandle : SafeAllocHandle
|
||||
{
|
||||
[ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)]
|
||||
public SafeGlobalAllocHandle() :
|
||||
base(true)
|
||||
{
|
||||
}
|
||||
|
||||
[ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)]
|
||||
public SafeGlobalAllocHandle(IntPtr existingHandle, bool ownsHandle) :
|
||||
base(ownsHandle)
|
||||
{
|
||||
SetHandle(existingHandle);
|
||||
}
|
||||
|
||||
public static SafeGlobalAllocHandle Allocate(int size)
|
||||
{
|
||||
return Allocate(0x0, size);
|
||||
}
|
||||
|
||||
public static SafeGlobalAllocHandle Allocate(byte[] value)
|
||||
{
|
||||
SafeGlobalAllocHandle alloc = Allocate(value.Length);
|
||||
Marshal.Copy(value, 0, alloc.DangerousGetHandle(), value.Length);
|
||||
|
||||
return alloc;
|
||||
}
|
||||
|
||||
[ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
|
||||
protected override bool ReleaseHandle()
|
||||
{
|
||||
return (NativeMethods.GlobalFree(handle) == IntPtr.Zero);
|
||||
}
|
||||
|
||||
private static SafeGlobalAllocHandle Allocate(uint flags, int size)
|
||||
{
|
||||
SafeGlobalAllocHandle alloc = NativeMethods.GlobalAlloc(flags, (IntPtr)size);
|
||||
if (alloc.IsInvalid)
|
||||
{
|
||||
throw new Win32Exception();
|
||||
}
|
||||
|
||||
return alloc;
|
||||
}
|
||||
|
||||
[SuppressUnmanagedCodeSecurity]
|
||||
private static class NativeMethods
|
||||
{
|
||||
[DllImport("kernel32.dll", SetLastError = true)]
|
||||
public static extern SafeGlobalAllocHandle GlobalAlloc(uint dwFlags, IntPtr sizetBytes);
|
||||
|
||||
[DllImport("kernel32.dll", SetLastError = true)]
|
||||
[ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
|
||||
public static extern IntPtr GlobalFree(IntPtr hMem);
|
||||
}
|
||||
}
|
||||
|
||||
[SecurityPermission(SecurityAction.LinkDemand, UnmanagedCode = true)]
|
||||
public sealed class SafeLocalAllocHandle : SafeAllocHandle
|
||||
{
|
||||
[ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)]
|
||||
public SafeLocalAllocHandle() :
|
||||
base(true)
|
||||
{
|
||||
}
|
||||
|
||||
[ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)]
|
||||
public SafeLocalAllocHandle(IntPtr existingHandle, bool ownsHandle) :
|
||||
base(ownsHandle)
|
||||
{
|
||||
SetHandle(existingHandle);
|
||||
}
|
||||
|
||||
public static SafeLocalAllocHandle Allocate(int size)
|
||||
{
|
||||
return Allocate(0x0, size);
|
||||
}
|
||||
|
||||
public static SafeLocalAllocHandle Allocate(byte[] value)
|
||||
{
|
||||
SafeLocalAllocHandle alloc = Allocate(value.Length);
|
||||
Marshal.Copy(value, 0, alloc.DangerousGetHandle(), value.Length);
|
||||
|
||||
return alloc;
|
||||
}
|
||||
|
||||
[ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
|
||||
protected override bool ReleaseHandle()
|
||||
{
|
||||
return (NativeMethods.LocalFree(handle) == IntPtr.Zero);
|
||||
}
|
||||
|
||||
private static SafeLocalAllocHandle Allocate(uint flags, int size)
|
||||
{
|
||||
SafeLocalAllocHandle alloc = NativeMethods.LocalAlloc(flags, (IntPtr)size);
|
||||
if (alloc.IsInvalid)
|
||||
{
|
||||
throw new Win32Exception();
|
||||
}
|
||||
|
||||
return alloc;
|
||||
}
|
||||
|
||||
[SuppressUnmanagedCodeSecurity]
|
||||
private static class NativeMethods
|
||||
{
|
||||
[DllImport("kernel32.dll", SetLastError = true)]
|
||||
public static extern SafeLocalAllocHandle LocalAlloc(uint dwFlags, IntPtr sizetBytes);
|
||||
|
||||
[DllImport("kernel32.dll", SetLastError = true)]
|
||||
[ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
|
||||
public static extern IntPtr LocalFree(IntPtr hMem);
|
||||
}
|
||||
}
|
||||
}
|
90
Library/SafeFileHandle.cs
Normal file
90
Library/SafeFileHandle.cs
Normal file
|
@ -0,0 +1,90 @@
|
|||
using System;
|
||||
using System.ComponentModel;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.IO;
|
||||
using System.Runtime.ConstrainedExecution;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Security;
|
||||
using System.Security.AccessControl;
|
||||
using System.Security.Permissions;
|
||||
using Microsoft.Win32.SafeHandles;
|
||||
|
||||
namespace Jellyfish.Library
|
||||
{
|
||||
[SecurityPermission(SecurityAction.LinkDemand, UnmanagedCode = true)]
|
||||
public sealed class SafeFileHandle : SafeHandleZeroOrMinusOneIsInvalid
|
||||
{
|
||||
[ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)]
|
||||
public SafeFileHandle() :
|
||||
base(true)
|
||||
{
|
||||
}
|
||||
|
||||
[ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)]
|
||||
public SafeFileHandle(IntPtr existingHandle, bool ownsHandle) :
|
||||
base(ownsHandle)
|
||||
{
|
||||
SetHandle(existingHandle);
|
||||
}
|
||||
|
||||
public static SafeFileHandle CreateFile(string fileName, FileAccess fileAccess, FileShare fileShare, FileMode fileMode, GeneralSecurity fileSecurity)
|
||||
{
|
||||
if (fileMode == FileMode.Append)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
bool inheritable = ((fileShare & FileShare.Inheritable) != 0);
|
||||
fileShare &= ~FileShare.Inheritable;
|
||||
|
||||
return CreateFile(fileName, (uint)fileAccess, (uint)fileShare, (uint)fileMode, 0x0, fileSecurity, inheritable);
|
||||
}
|
||||
|
||||
[ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
|
||||
protected override bool ReleaseHandle()
|
||||
{
|
||||
return NativeMethods.CloseHandle(handle);
|
||||
}
|
||||
|
||||
[SuppressMessage("Microsoft.Design", "CA1024:UsePropertiesWhereAppropriate")]
|
||||
public GeneralSecurity GetAccessControl()
|
||||
{
|
||||
return new GeneralSecurity(false, ResourceType.FileObject, this);
|
||||
}
|
||||
|
||||
public void SetAccessControl(GeneralSecurity fileSecurity)
|
||||
{
|
||||
fileSecurity.Persist(this);
|
||||
}
|
||||
|
||||
private static SafeFileHandle CreateFile(string fileName, uint fileAccess, uint fileShare, uint fileMode, uint fileOptions, GeneralSecurity fileSecurity,
|
||||
bool inheritable)
|
||||
{
|
||||
SafeFileHandle file = new SafeFileHandle();
|
||||
|
||||
GeneralSecurity.GetSecurityAttributes(fileSecurity, inheritable, securityAttributes =>
|
||||
{
|
||||
file = NativeMethods.CreateFile(fileName, fileAccess, fileShare, securityAttributes, fileMode, fileOptions, IntPtr.Zero);
|
||||
if (file.IsInvalid)
|
||||
{
|
||||
throw new Win32Exception();
|
||||
}
|
||||
});
|
||||
|
||||
return file;
|
||||
}
|
||||
|
||||
[SuppressUnmanagedCodeSecurity]
|
||||
private static class NativeMethods
|
||||
{
|
||||
[DllImport("kernel32.dll", SetLastError = true)]
|
||||
[ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
|
||||
[return: MarshalAs(UnmanagedType.Bool)]
|
||||
public static extern bool CloseHandle(IntPtr handle);
|
||||
|
||||
[DllImport("kernel32.dll", CharSet = CharSet.Unicode, SetLastError = true)]
|
||||
public static extern SafeFileHandle CreateFile(string lpFileName, uint dwDesiredAccess, uint dwShareMode, SecurityAttributes lpSecurityAttributes,
|
||||
uint dwCreationDisposition, uint dwFlagsAndAttributes, IntPtr hTemplateFile);
|
||||
}
|
||||
}
|
||||
}
|
65
Library/Silverlight/ApplicationBase.cs
Normal file
65
Library/Silverlight/ApplicationBase.cs
Normal file
|
@ -0,0 +1,65 @@
|
|||
using System;
|
||||
using System.Text;
|
||||
using System.Windows;
|
||||
|
||||
namespace Jellyfish.Library
|
||||
{
|
||||
public class ApplicationBase : Application
|
||||
{
|
||||
public ApplicationBase() :
|
||||
this(null)
|
||||
{
|
||||
}
|
||||
|
||||
public ApplicationBase(string name)
|
||||
{
|
||||
Name = name;
|
||||
|
||||
UnhandledException += Application_UnhandledException;
|
||||
//AppDomain.CurrentDomain.UnhandledException += AppDomain_UnhandledException;
|
||||
}
|
||||
|
||||
private void Application_UnhandledException(object sender, ApplicationUnhandledExceptionEventArgs e)
|
||||
{
|
||||
MessageBox.Show(GetExceptionMessage(e.ExceptionObject), GetExceptionCaption("Application Exception", false), MessageBoxButton.OK);
|
||||
}
|
||||
|
||||
//private void AppDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e)
|
||||
//{
|
||||
// MessageBox.Show(GetExceptionMessage(e.ExceptionObject as Exception), GetExceptionCaption("AppDomain Exception", e.IsTerminating), MessageBoxButton.OK);
|
||||
//}
|
||||
|
||||
private string GetExceptionCaption(string title, bool isTerminating)
|
||||
{
|
||||
StringBuilder caption = new StringBuilder();
|
||||
if (!string.IsNullOrEmpty(Name))
|
||||
{
|
||||
caption.Append(Name);
|
||||
caption.Append(" ");
|
||||
}
|
||||
caption.Append(title);
|
||||
if (isTerminating)
|
||||
{
|
||||
caption.Append(" (Terminating)");
|
||||
}
|
||||
|
||||
return caption.ToString();
|
||||
}
|
||||
|
||||
private static string GetExceptionMessage(Exception exception)
|
||||
{
|
||||
StringBuilder message = new StringBuilder();
|
||||
if (exception != null)
|
||||
{
|
||||
message.Append(exception.Message.ToString());
|
||||
message.Append(Environment.NewLine);
|
||||
message.Append(Environment.NewLine);
|
||||
message.Append(exception.ToString()); // includes stack trace
|
||||
}
|
||||
|
||||
return message.ToString();
|
||||
}
|
||||
|
||||
public string Name { get; private set; }
|
||||
}
|
||||
}
|
13
Library/Silverlight/FrameRateCounter.xaml
Normal file
13
Library/Silverlight/FrameRateCounter.xaml
Normal file
|
@ -0,0 +1,13 @@
|
|||
<UserControl x:Class="Jellyfish.Library.FrameRateCounter" x:Name="frameRateControl"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:jl="clr-namespace:Jellyfish.Library;assembly=Jellyfish.Library">
|
||||
<UserControl.Resources>
|
||||
<jl:StringFormatConverter x:Key="StringFormatConverter"/>
|
||||
</UserControl.Resources>
|
||||
<TextBlock FontFamily="Consolas" FontSize="12" Foreground="White">
|
||||
<TextBlock.Text>
|
||||
<Binding Path="FrameRate" ElementName="frameRateControl" Converter="{StaticResource StringFormatConverter}" ConverterParameter="{}{0:D} fps"/>
|
||||
</TextBlock.Text>
|
||||
</TextBlock>
|
||||
</UserControl>
|
42
Library/Silverlight/FrameRateCounter.xaml.cs
Normal file
42
Library/Silverlight/FrameRateCounter.xaml.cs
Normal file
|
@ -0,0 +1,42 @@
|
|||
using System;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Media;
|
||||
|
||||
namespace Jellyfish.Library
|
||||
{
|
||||
public partial class FrameRateCounter : UserControl
|
||||
{
|
||||
public FrameRateCounter()
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
CompositionTarget.Rendering += CompositionTarget_Rendering;
|
||||
}
|
||||
|
||||
private void CompositionTarget_Rendering(object sender, EventArgs e)
|
||||
{
|
||||
_frameCount++;
|
||||
|
||||
long time = DateTime.UtcNow.Ticks;
|
||||
if (time - _lastTime >= TimeSpan.TicksPerSecond)
|
||||
{
|
||||
_lastTime = time;
|
||||
FrameRate = _frameCount;
|
||||
_frameCount = 0;
|
||||
}
|
||||
}
|
||||
|
||||
public static readonly DependencyProperty FrameRateProperty = DependencyProperty.Register("FrameRate", typeof(int), typeof(FrameRateCounter),
|
||||
new PropertyMetadata(0));
|
||||
|
||||
public int FrameRate
|
||||
{
|
||||
get { return (int)GetValue(FrameRateProperty); }
|
||||
set { SetValue(FrameRateProperty, value); }
|
||||
}
|
||||
|
||||
private int _frameCount;
|
||||
private long _lastTime;
|
||||
}
|
||||
}
|
111
Library/Silverlight/Jellyfish.Library.Silverlight.csproj
Normal file
111
Library/Silverlight/Jellyfish.Library.Silverlight.csproj
Normal file
|
@ -0,0 +1,111 @@
|
|||
<Project ToolsVersion="3.5" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProductVersion>9.0.30729</ProductVersion>
|
||||
<SchemaVersion>2.0</SchemaVersion>
|
||||
<ProjectGuid>{DAB11A70-D08B-4A96-8A54-E81B1DE39681}</ProjectGuid>
|
||||
<ProjectTypeGuids>{A1591282-1198-4647-A2B1-27E5FF5F6F3B};{fae04ec0-301f-11d3-bf4b-00c04f79efbc}</ProjectTypeGuids>
|
||||
<OutputType>Library</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>Jellyfish.Library</RootNamespace>
|
||||
<AssemblyName>Jellyfish.Library</AssemblyName>
|
||||
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
|
||||
<SilverlightApplication>false</SilverlightApplication>
|
||||
<ValidateXaml>true</ValidateXaml>
|
||||
<ThrowErrorsInValidation>false</ThrowErrorsInValidation>
|
||||
<SignAssembly>true</SignAssembly>
|
||||
<AssemblyOriginatorKeyFile>..\..\Jellyfish.snk</AssemblyOriginatorKeyFile>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\</OutputPath>
|
||||
<DefineConstants>TRACE;DEBUG;SILVERLIGHT;CODE_ANALYSIS</DefineConstants>
|
||||
<NoStdLib>true</NoStdLib>
|
||||
<NoConfig>true</NoConfig>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<RunCodeAnalysis>false</RunCodeAnalysis>
|
||||
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\</OutputPath>
|
||||
<DefineConstants>TRACE;SILVERLIGHT;CODE_ANALYSIS</DefineConstants>
|
||||
<NoStdLib>true</NoStdLib>
|
||||
<NoConfig>true</NoConfig>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System.Windows" />
|
||||
<Reference Include="mscorlib" />
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Xml" />
|
||||
<Reference Include="System.Net" />
|
||||
<Reference Include="System.Windows.Browser" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="..\AssemblyCommentAttribute.cs">
|
||||
<Link>AssemblyCommentAttribute.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\FileHelpers.cs">
|
||||
<Link>FileHelpers.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\GlobalSuppressions.cs">
|
||||
<Link>GlobalSuppressions.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\IEnumerableExtensions.cs">
|
||||
<Link>IEnumerableExtensions.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\Lazy.cs">
|
||||
<Link>Lazy.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\MathHelpers.cs">
|
||||
<Link>MathHelpers.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\SingletonFactory.cs">
|
||||
<Link>SingletonFactory.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\StreamExtensions.cs">
|
||||
<Link>StreamExtensions.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="ApplicationBase.cs" />
|
||||
<Compile Include="FrameRateCounter.xaml.cs">
|
||||
<DependentUpon>FrameRateCounter.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="StringFormatConverter.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Page Include="FrameRateCounter.xaml">
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
</Page>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<CodeAnalysisDictionary Include="..\CustomDictionary.xml">
|
||||
<Link>CustomDictionary.xml</Link>
|
||||
</CodeAnalysisDictionary>
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildExtensionsPath)\Microsoft\Silverlight\v3.0\Microsoft.Silverlight.CSharp.targets" Condition="" />
|
||||
<!-- 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.
|
||||
<Target Name="BeforeBuild">
|
||||
</Target>
|
||||
<Target Name="AfterBuild">
|
||||
</Target>
|
||||
-->
|
||||
<ProjectExtensions>
|
||||
<VisualStudio>
|
||||
<FlavorProperties GUID="{A1591282-1198-4647-A2B1-27E5FF5F6F3B}">
|
||||
<SilverlightProjectProperties />
|
||||
</FlavorProperties>
|
||||
</VisualStudio>
|
||||
</ProjectExtensions>
|
||||
</Project>
|
20
Library/Silverlight/Jellyfish.Library.Silverlight.sln
Normal file
20
Library/Silverlight/Jellyfish.Library.Silverlight.sln
Normal file
|
@ -0,0 +1,20 @@
|
|||
|
||||
Microsoft Visual Studio Solution File, Format Version 10.00
|
||||
# Visual Studio 2008
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Jellyfish.Library.Silverlight", "Jellyfish.Library.Silverlight.csproj", "{DAB11A70-D08B-4A96-8A54-E81B1DE39681}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Release|Any CPU = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{DAB11A70-D08B-4A96-8A54-E81B1DE39681}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{DAB11A70-D08B-4A96-8A54-E81B1DE39681}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{DAB11A70-D08B-4A96-8A54-E81B1DE39681}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{DAB11A70-D08B-4A96-8A54-E81B1DE39681}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
EndGlobal
|
21
Library/Silverlight/Properties/AssemblyInfo.cs
Normal file
21
Library/Silverlight/Properties/AssemblyInfo.cs
Normal file
|
@ -0,0 +1,21 @@
|
|||
using System;
|
||||
using System.Reflection;
|
||||
using System.Resources;
|
||||
using System.Runtime.InteropServices;
|
||||
using Jellyfish.Library;
|
||||
|
||||
[assembly: AssemblyTitle("Library")]
|
||||
[assembly: AssemblyDescription("Common Library")]
|
||||
[assembly: AssemblyProduct("Jellyfish.Library.Silverlight")]
|
||||
[assembly: AssemblyCompany("Digital Jellyfish Design Ltd")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2009 Digital Jellyfish Design Ltd")]
|
||||
[assembly: AssemblyComment("Developed by Sean Fausett")]
|
||||
|
||||
[assembly: AssemblyVersion("0.1.0.0")]
|
||||
[assembly: AssemblyFileVersion("0.1.0.0")]
|
||||
|
||||
[assembly: CLSCompliant(false)]
|
||||
[assembly: ComVisible(false)]
|
||||
[assembly: Guid("66034b9e-9f0b-47b0-aac4-cade9a748891")]
|
||||
|
||||
[assembly: NeutralResourcesLanguage("en")]
|
41
Library/Silverlight/StringFormatConverter.cs
Normal file
41
Library/Silverlight/StringFormatConverter.cs
Normal file
|
@ -0,0 +1,41 @@
|
|||
using System;
|
||||
using System.Globalization;
|
||||
using System.Windows;
|
||||
using System.Windows.Data;
|
||||
|
||||
namespace Jellyfish.Library
|
||||
{
|
||||
public class StringFormatConverter : IValueConverter // SL is missing Binding.StringFormat
|
||||
{
|
||||
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
if (targetType != typeof(string))
|
||||
{
|
||||
return DependencyProperty.UnsetValue;
|
||||
}
|
||||
|
||||
if (value == null)
|
||||
{
|
||||
return string.Empty;
|
||||
}
|
||||
|
||||
string format = parameter as string;
|
||||
if (!string.IsNullOrEmpty(format))
|
||||
{
|
||||
if (format.IndexOf('{') < 0)
|
||||
{
|
||||
format = "{0:" + format + "}";
|
||||
}
|
||||
|
||||
return string.Format(culture, format, value);
|
||||
}
|
||||
|
||||
return value.ToString();
|
||||
}
|
||||
|
||||
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
return DependencyProperty.UnsetValue; // one way only
|
||||
}
|
||||
}
|
||||
}
|
18
Library/SingletonFactory.cs
Normal file
18
Library/SingletonFactory.cs
Normal file
|
@ -0,0 +1,18 @@
|
|||
using System.Diagnostics.CodeAnalysis;
|
||||
|
||||
namespace Jellyfish.Library
|
||||
{
|
||||
public static class SingletonFactory<T> where T : class, new()
|
||||
{
|
||||
[SuppressMessage("Microsoft.Design", "CA1000:DoNotDeclareStaticMembersOnGenericTypes")]
|
||||
public static T Create()
|
||||
{
|
||||
return _instance;
|
||||
}
|
||||
|
||||
[SuppressMessage("Microsoft.Design", "CA1000:DoNotDeclareStaticMembersOnGenericTypes")]
|
||||
public static T Instance { get { return _instance; } }
|
||||
|
||||
private static readonly T _instance = new T();
|
||||
}
|
||||
}
|
29
Library/StreamExtensions.cs
Normal file
29
Library/StreamExtensions.cs
Normal file
|
@ -0,0 +1,29 @@
|
|||
using System.IO;
|
||||
|
||||
namespace Jellyfish.Library
|
||||
{
|
||||
public static class StreamExtensions
|
||||
{
|
||||
public static byte[] ReadAllBytes(this Stream stream)
|
||||
{
|
||||
int count = (int)stream.Length;
|
||||
byte[] buffer = new byte[count];
|
||||
ReadBlock(stream, buffer, 0, count);
|
||||
|
||||
return buffer;
|
||||
}
|
||||
|
||||
public static int ReadBlock(this Stream stream, byte[] buffer, int offset, int count)
|
||||
{
|
||||
int total = 0;
|
||||
int read;
|
||||
do
|
||||
{
|
||||
total += read = stream.Read(buffer, offset + total, count - total);
|
||||
}
|
||||
while ((read > 0) && (total < count));
|
||||
|
||||
return total;
|
||||
}
|
||||
}
|
||||
}
|
70
Library/Wpf/ApplicationBase.cs
Normal file
70
Library/Wpf/ApplicationBase.cs
Normal file
|
@ -0,0 +1,70 @@
|
|||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.Text;
|
||||
using System.Windows;
|
||||
using System.Windows.Threading;
|
||||
|
||||
namespace Jellyfish.Library
|
||||
{
|
||||
public class ApplicationBase : Application
|
||||
{
|
||||
public ApplicationBase() :
|
||||
this(null)
|
||||
{
|
||||
}
|
||||
|
||||
public ApplicationBase(string name)
|
||||
{
|
||||
Name = name;
|
||||
|
||||
DispatcherUnhandledException += Application_DispatcherUnhandledException;
|
||||
AppDomain.CurrentDomain.UnhandledException += AppDomain_UnhandledException;
|
||||
}
|
||||
|
||||
private void Application_DispatcherUnhandledException(object sender, DispatcherUnhandledExceptionEventArgs e)
|
||||
{
|
||||
MessageBox.Show(GetExceptionMessage(e.Exception), GetExceptionCaption("Application Dispatcher Exception", true));
|
||||
Shutdown();
|
||||
e.Handled = true;
|
||||
}
|
||||
|
||||
private void AppDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e)
|
||||
{
|
||||
MessageBox.Show(GetExceptionMessage(e.ExceptionObject as Exception), GetExceptionCaption("AppDomain Exception", e.IsTerminating));
|
||||
}
|
||||
|
||||
private string GetExceptionCaption(string title, bool isTerminating)
|
||||
{
|
||||
StringBuilder caption = new StringBuilder();
|
||||
caption.AppendFormat("[{0}] ", Process.GetCurrentProcess().Id);
|
||||
if (!string.IsNullOrEmpty(Name))
|
||||
{
|
||||
caption.Append(Name);
|
||||
caption.Append(" ");
|
||||
}
|
||||
caption.Append(title);
|
||||
if (isTerminating)
|
||||
{
|
||||
caption.Append(" (Terminating)");
|
||||
}
|
||||
|
||||
return caption.ToString();
|
||||
}
|
||||
|
||||
private static string GetExceptionMessage(Exception exception)
|
||||
{
|
||||
StringBuilder message = new StringBuilder();
|
||||
if (exception != null)
|
||||
{
|
||||
message.Append(exception.Message.ToString());
|
||||
message.Append(Environment.NewLine);
|
||||
message.Append(Environment.NewLine);
|
||||
message.Append(exception.ToString()); // includes stack trace
|
||||
}
|
||||
|
||||
return message.ToString();
|
||||
}
|
||||
|
||||
public string Name { get; private set; }
|
||||
}
|
||||
}
|
9
Library/Wpf/FrameRateCounter.xaml
Normal file
9
Library/Wpf/FrameRateCounter.xaml
Normal file
|
@ -0,0 +1,9 @@
|
|||
<UserControl x:Class="Jellyfish.Library.FrameRateCounter" x:Name="frameRateControl"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
|
||||
<TextBlock FontFamily="Consolas" FontSize="12" Foreground="White">
|
||||
<TextBlock.Text>
|
||||
<Binding Path="FrameRate" ElementName="frameRateControl" StringFormat="{}{0:D} fps"/>
|
||||
</TextBlock.Text>
|
||||
</TextBlock>
|
||||
</UserControl>
|
42
Library/Wpf/FrameRateCounter.xaml.cs
Normal file
42
Library/Wpf/FrameRateCounter.xaml.cs
Normal file
|
@ -0,0 +1,42 @@
|
|||
using System;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Media;
|
||||
|
||||
namespace Jellyfish.Library
|
||||
{
|
||||
public partial class FrameRateCounter : UserControl
|
||||
{
|
||||
public FrameRateCounter()
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
CompositionTarget.Rendering += CompositionTarget_Rendering;
|
||||
}
|
||||
|
||||
private void CompositionTarget_Rendering(object sender, EventArgs e)
|
||||
{
|
||||
_frameCount++;
|
||||
|
||||
long time = DateTime.UtcNow.Ticks;
|
||||
if (time - _lastTime >= TimeSpan.TicksPerSecond)
|
||||
{
|
||||
_lastTime = time;
|
||||
FrameRate = _frameCount;
|
||||
_frameCount = 0;
|
||||
}
|
||||
}
|
||||
|
||||
public static readonly DependencyProperty FrameRateProperty = DependencyProperty.Register("FrameRate", typeof(int), typeof(FrameRateCounter),
|
||||
new PropertyMetadata(0));
|
||||
|
||||
public int FrameRate
|
||||
{
|
||||
get { return (int)GetValue(FrameRateProperty); }
|
||||
set { SetValue(FrameRateProperty, value); }
|
||||
}
|
||||
|
||||
private int _frameCount;
|
||||
private long _lastTime;
|
||||
}
|
||||
}
|
123
Library/Wpf/Jellyfish.Library.Wpf.csproj
Normal file
123
Library/Wpf/Jellyfish.Library.Wpf.csproj
Normal file
|
@ -0,0 +1,123 @@
|
|||
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="3.5">
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProductVersion>9.0.30729</ProductVersion>
|
||||
<SchemaVersion>2.0</SchemaVersion>
|
||||
<ProjectGuid>{D47A24A9-1590-4E8A-A406-BC66D5891BFA}</ProjectGuid>
|
||||
<OutputType>Library</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>Jellyfish.Library</RootNamespace>
|
||||
<AssemblyName>Jellyfish.Library</AssemblyName>
|
||||
<SignAssembly>true</SignAssembly>
|
||||
<AssemblyOriginatorKeyFile>..\..\Jellyfish.snk</AssemblyOriginatorKeyFile>
|
||||
<FileUpgradeFlags>
|
||||
</FileUpgradeFlags>
|
||||
<OldToolsVersion>2.0</OldToolsVersion>
|
||||
<UpgradeBackupLocation>
|
||||
</UpgradeBackupLocation>
|
||||
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\</OutputPath>
|
||||
<DefineConstants>TRACE;DEBUG;CODE_ANALYSIS</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<RunCodeAnalysis>false</RunCodeAnalysis>
|
||||
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\</OutputPath>
|
||||
<DefineConstants>TRACE;CODE_ANALYSIS</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="PresentationCore">
|
||||
<RequiredTargetFramework>3.0</RequiredTargetFramework>
|
||||
</Reference>
|
||||
<Reference Include="PresentationFramework">
|
||||
<RequiredTargetFramework>3.0</RequiredTargetFramework>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Core">
|
||||
<RequiredTargetFramework>3.5</RequiredTargetFramework>
|
||||
</Reference>
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Xml" />
|
||||
<Reference Include="System.Xml.Linq">
|
||||
<RequiredTargetFramework>3.5</RequiredTargetFramework>
|
||||
</Reference>
|
||||
<Reference Include="WindowsBase">
|
||||
<RequiredTargetFramework>3.0</RequiredTargetFramework>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="..\AssemblyCommentAttribute.cs">
|
||||
<Link>AssemblyCommentAttribute.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\FileHelpers.cs">
|
||||
<Link>FileHelpers.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\GeneralSecurity.cs">
|
||||
<Link>GeneralSecurity.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\GlobalSuppressions.cs">
|
||||
<Link>GlobalSuppressions.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\IEnumerableExtensions.cs">
|
||||
<Link>IEnumerableExtensions.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\Lazy.cs">
|
||||
<Link>Lazy.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\MathHelpers.cs">
|
||||
<Link>MathHelpers.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\SafeAllocHandle.cs">
|
||||
<Link>SafeAllocHandle.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\SafeFileHandle.cs">
|
||||
<Link>SafeFileHandle.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\SingletonFactory.cs">
|
||||
<Link>SingletonFactory.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\StreamExtensions.cs">
|
||||
<Link>StreamExtensions.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\XmlSerializerHelpers.cs">
|
||||
<Link>XmlSerializerHelpers.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="ApplicationBase.cs" />
|
||||
<Compile Include="FrameRateCounter.xaml.cs">
|
||||
<DependentUpon>FrameRateCounter.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Page Include="FrameRateCounter.xaml">
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
</Page>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<CodeAnalysisDictionary Include="..\CustomDictionary.xml">
|
||||
<Link>CustomDictionary.xml</Link>
|
||||
</CodeAnalysisDictionary>
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildBinPath)\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.
|
||||
<Target Name="BeforeBuild">
|
||||
</Target>
|
||||
<Target Name="AfterBuild">
|
||||
</Target>
|
||||
-->
|
||||
</Project>
|
20
Library/Wpf/Jellyfish.Library.Wpf.sln
Normal file
20
Library/Wpf/Jellyfish.Library.Wpf.sln
Normal file
|
@ -0,0 +1,20 @@
|
|||
|
||||
Microsoft Visual Studio Solution File, Format Version 10.00
|
||||
# Visual Studio 2008
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Jellyfish.Library.Wpf", "Jellyfish.Library.Wpf.csproj", "{D47A24A9-1590-4E8A-A406-BC66D5891BFA}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Release|Any CPU = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{D47A24A9-1590-4E8A-A406-BC66D5891BFA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{D47A24A9-1590-4E8A-A406-BC66D5891BFA}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{D47A24A9-1590-4E8A-A406-BC66D5891BFA}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{D47A24A9-1590-4E8A-A406-BC66D5891BFA}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
EndGlobal
|
21
Library/Wpf/Properties/AssemblyInfo.cs
Normal file
21
Library/Wpf/Properties/AssemblyInfo.cs
Normal file
|
@ -0,0 +1,21 @@
|
|||
using System;
|
||||
using System.Reflection;
|
||||
using System.Resources;
|
||||
using System.Runtime.InteropServices;
|
||||
using Jellyfish.Library;
|
||||
|
||||
[assembly: AssemblyTitle("Library")]
|
||||
[assembly: AssemblyDescription("Common Library")]
|
||||
[assembly: AssemblyProduct("Jellyfish.Library.Wpf")]
|
||||
[assembly: AssemblyCompany("Digital Jellyfish Design Ltd")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2009 Digital Jellyfish Design Ltd")]
|
||||
[assembly: AssemblyComment("Developed by Sean Fausett")]
|
||||
|
||||
[assembly: AssemblyVersion("0.1.0.0")]
|
||||
[assembly: AssemblyFileVersion("0.1.0.0")]
|
||||
|
||||
[assembly: CLSCompliant(false)]
|
||||
[assembly: ComVisible(false)]
|
||||
[assembly: Guid("66034b9e-9f0b-47b0-aac4-cade9a748891")]
|
||||
|
||||
[assembly: NeutralResourcesLanguage("en")]
|
40
Library/XmlSerializerHelpers.cs
Normal file
40
Library/XmlSerializerHelpers.cs
Normal file
|
@ -0,0 +1,40 @@
|
|||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.IO;
|
||||
using System.Xml;
|
||||
using System.Xml.Serialization;
|
||||
|
||||
namespace Jellyfish.Library
|
||||
{
|
||||
public static class XmlSerializerHelpers
|
||||
{
|
||||
[SuppressMessage("Microsoft.Design", "CA1004:GenericMethodsShouldProvideTypeParameter")]
|
||||
public static T Deserialize<T>(Stream stream)
|
||||
{
|
||||
return Deserialize<T>(stream, null);
|
||||
}
|
||||
|
||||
[SuppressMessage("Microsoft.Design", "CA1004:GenericMethodsShouldProvideTypeParameter")]
|
||||
public static T Deserialize<T>(Stream stream, string defaultNamespace)
|
||||
{
|
||||
using (XmlReader reader = XmlReader.Create(stream))
|
||||
{
|
||||
XmlSerializer serializer = new XmlSerializer(typeof(T), defaultNamespace);
|
||||
return (T)serializer.Deserialize(reader);
|
||||
}
|
||||
}
|
||||
|
||||
public static void Serialize<T>(Stream stream, T instance)
|
||||
{
|
||||
Serialize<T>(stream, instance, null);
|
||||
}
|
||||
|
||||
public static void Serialize<T>(Stream stream, T instance, string defaultNamespace)
|
||||
{
|
||||
using (XmlWriter writer = XmlWriter.Create(stream))
|
||||
{
|
||||
XmlSerializer serializer = new XmlSerializer(typeof(T), defaultNamespace);
|
||||
serializer.Serialize(writer, instance);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
47
Library/Xna/Content/Content.contentproj
Normal file
47
Library/Xna/Content/Content.contentproj
Normal file
|
@ -0,0 +1,47 @@
|
|||
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="3.5">
|
||||
<PropertyGroup>
|
||||
<ProjectGuid>a96f5631-40e1-40b0-aee2-6f2e3368e2ae</ProjectGuid>
|
||||
<ProjectTypeGuids>{96E2B04D-8817-42c6-938A-82C39BA4D311};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">x86</Platform>
|
||||
<OutputType>Library</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
|
||||
<XnaFrameworkVersion>v3.0</XnaFrameworkVersion>
|
||||
<PlatformTarget>x86</PlatformTarget>
|
||||
<OutputPath>bin\$(Platform)\$(Configuration)</OutputPath>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
|
||||
<XnaPlatform>Windows</XnaPlatform>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
|
||||
<XnaPlatform>Windows</XnaPlatform>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="Microsoft.Xna.Framework.Content.Pipeline.EffectImporter, Version=3.0.0.0, Culture=neutral, PublicKeyToken=6d5c3888ef60e27d, processorArchitecture=MSIL">
|
||||
<Private>False</Private>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.Xna.Framework.Content.Pipeline.FBXImporter, Version=3.0.0.0, Culture=neutral, PublicKeyToken=6d5c3888ef60e27d, processorArchitecture=MSIL">
|
||||
<Private>False</Private>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.Xna.Framework.Content.Pipeline.TextureImporter, Version=3.0.0.0, Culture=neutral, PublicKeyToken=6d5c3888ef60e27d, processorArchitecture=MSIL">
|
||||
<Private>False</Private>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.Xna.Framework.Content.Pipeline.XImporter, Version=3.0.0.0, Culture=neutral, PublicKeyToken=6d5c3888ef60e27d, processorArchitecture=MSIL">
|
||||
<Private>False</Private>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.Xna.Framework.Content.Pipeline.AudioImporters, Version=3.0.0.0, Culture=neutral, PublicKeyToken=6d5c3888ef60e27d, processorArchitecture=MSIL">
|
||||
<Private>False</Private>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildExtensionsPath)\Microsoft\XNA Game Studio\v3.0\Microsoft.Xna.GameStudio.ContentPipeline.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.
|
||||
<Target Name="BeforeBuild">
|
||||
</Target>
|
||||
<Target Name="AfterBuild">
|
||||
</Target>
|
||||
-->
|
||||
|
||||
</Project>
|
73
Library/Xna/FrameRateCounter.cs
Normal file
73
Library/Xna/FrameRateCounter.cs
Normal file
|
@ -0,0 +1,73 @@
|
|||
using System;
|
||||
using System.Text;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
|
||||
namespace Jellyfish.Library
|
||||
{
|
||||
public class FrameRateCounter : DrawableGameComponent
|
||||
{
|
||||
public FrameRateCounter(GameBase game) :
|
||||
base(game)
|
||||
{
|
||||
_frameRateBuilder = new StringBuilder(); // cache builder; avoids garbage
|
||||
|
||||
FontColor = Color.White;
|
||||
FontName = "Default";
|
||||
|
||||
//game.IsFixedTimeStep = true; // fixed (default)
|
||||
//game.TargetElapsedTime = TimeSpan.FromSeconds(1f / 60f);
|
||||
|
||||
//game.IsFixedTimeStep = false; // flatout
|
||||
//game.GraphicsDeviceManager.SynchronizeWithVerticalRetrace = false;
|
||||
}
|
||||
|
||||
protected override void LoadContent()
|
||||
{
|
||||
_spriteBatch = new SpriteBatch(GraphicsDevice);
|
||||
_spriteFont = Game.Content.Load<SpriteFont>(FontName);
|
||||
|
||||
Rectangle titleSafeArea = Game.GraphicsDevice.DisplayMode.TitleSafeArea;
|
||||
Position = new Vector2(titleSafeArea.X, titleSafeArea.Y);
|
||||
}
|
||||
|
||||
public override void Draw(GameTime gameTime)
|
||||
{
|
||||
_frameCount++;
|
||||
|
||||
_frameRateBuilder.Length = 0;
|
||||
_frameRateBuilder.AppendWithoutGarbage(_frameRate).Append(" fps");
|
||||
|
||||
_spriteBatch.Begin(SpriteBlendMode.AlphaBlend, SpriteSortMode.Immediate, SaveStateMode.None);
|
||||
//_spriteBatch.DrawString(_spriteFont, fps, Position - Vector2.UnitX, Color.Black); // rough outline
|
||||
//_spriteBatch.DrawString(_spriteFont, fps, Position + Vector2.UnitX, Color.Black);
|
||||
//_spriteBatch.DrawString(_spriteFont, fps, Position - Vector2.UnitY, Color.Black);
|
||||
//_spriteBatch.DrawString(_spriteFont, fps, Position + Vector2.UnitY, Color.Black);
|
||||
_spriteBatch.DrawString(_spriteFont, _frameRateBuilder, Position, FontColor);
|
||||
_spriteBatch.End();
|
||||
}
|
||||
|
||||
public override void Update(GameTime gameTime)
|
||||
{
|
||||
_elapsedTime += gameTime.ElapsedGameTime.Ticks;
|
||||
|
||||
if (_elapsedTime >= TimeSpan.TicksPerSecond)
|
||||
{
|
||||
_elapsedTime -= TimeSpan.TicksPerSecond;
|
||||
_frameRate = _frameCount;
|
||||
_frameCount = 0;
|
||||
}
|
||||
}
|
||||
|
||||
public Color FontColor { get; set; }
|
||||
public string FontName { get; set; }
|
||||
public Vector2 Position { get; set; }
|
||||
|
||||
private SpriteBatch _spriteBatch;
|
||||
private SpriteFont _spriteFont;
|
||||
private long _elapsedTime;
|
||||
private int _frameCount;
|
||||
private int _frameRate;
|
||||
private StringBuilder _frameRateBuilder;
|
||||
}
|
||||
}
|
44
Library/Xna/GameBase.cs
Normal file
44
Library/Xna/GameBase.cs
Normal file
|
@ -0,0 +1,44 @@
|
|||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.GamerServices;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using Microsoft.Xna.Framework.Input;
|
||||
|
||||
namespace Jellyfish.Library
|
||||
{
|
||||
public class GameBase : Game
|
||||
{
|
||||
public GameBase() :
|
||||
this(null)
|
||||
{
|
||||
}
|
||||
|
||||
public GameBase(string name)
|
||||
{
|
||||
Name = name;
|
||||
|
||||
GraphicsDeviceManager = new GraphicsDeviceManager(this);
|
||||
GraphicsDeviceService = (IGraphicsDeviceService)Services.GetService(typeof(IGraphicsDeviceService));
|
||||
|
||||
Components.Add(new GamerServicesComponent(this));
|
||||
Content.RootDirectory = "Content";
|
||||
if (!string.IsNullOrEmpty(Name))
|
||||
{
|
||||
Window.Title = Name;
|
||||
}
|
||||
}
|
||||
|
||||
protected override void Update(GameTime gameTime)
|
||||
{
|
||||
GamePadState gamePadState = GamePad.GetState(PlayerIndex.One);
|
||||
if (gamePadState.Buttons.Back == ButtonState.Pressed)
|
||||
{
|
||||
Exit();
|
||||
}
|
||||
base.Update(gameTime);
|
||||
}
|
||||
|
||||
public string Name { get; private set; }
|
||||
public GraphicsDeviceManager GraphicsDeviceManager { get; private set; }
|
||||
public IGraphicsDeviceService GraphicsDeviceService { get; private set; }
|
||||
}
|
||||
}
|
176
Library/Xna/Jellyfish.Library.Xna.Xbox.csproj
Normal file
176
Library/Xna/Jellyfish.Library.Xna.Xbox.csproj
Normal file
|
@ -0,0 +1,176 @@
|
|||
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="3.5">
|
||||
<PropertyGroup>
|
||||
<ProjectGuid>{6EE9A3C2-0BD8-480D-AED2-6A5A9EBF7AFA}</ProjectGuid>
|
||||
<ProjectTypeGuids>{2DF5C3F4-5A5F-47a9-8E94-23B4456F55E2};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">Xbox 360</Platform>
|
||||
<OutputType>Library</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>Jellyfish.Library</RootNamespace>
|
||||
<AssemblyName>Jellyfish.Library</AssemblyName>
|
||||
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
|
||||
<XnaFrameworkVersion>v3.0</XnaFrameworkVersion>
|
||||
<XnaPlatform>Xbox 360</XnaPlatform>
|
||||
<XnaCrossPlatformGroupID>3289d0b6-d8a8-415e-8c29-dc355352cb54</XnaCrossPlatformGroupID>
|
||||
<PublishUrl>publish\</PublishUrl>
|
||||
<Install>true</Install>
|
||||
<InstallFrom>Disk</InstallFrom>
|
||||
<UpdateEnabled>false</UpdateEnabled>
|
||||
<UpdateMode>Foreground</UpdateMode>
|
||||
<UpdateInterval>7</UpdateInterval>
|
||||
<UpdateIntervalUnits>Days</UpdateIntervalUnits>
|
||||
<UpdatePeriodically>false</UpdatePeriodically>
|
||||
<UpdateRequired>false</UpdateRequired>
|
||||
<MapFileExtensions>true</MapFileExtensions>
|
||||
<ApplicationRevision>0</ApplicationRevision>
|
||||
<ApplicationVersion>1.0.0.%2a</ApplicationVersion>
|
||||
<IsWebBootstrapper>false</IsWebBootstrapper>
|
||||
<UseApplicationTrust>false</UseApplicationTrust>
|
||||
<BootstrapperEnabled>true</BootstrapperEnabled>
|
||||
<SignAssembly>true</SignAssembly>
|
||||
<AssemblyOriginatorKeyFile>..\..\Jellyfish.snk</AssemblyOriginatorKeyFile>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|Xbox 360' ">
|
||||
<OutputPath>bin\Xbox\</OutputPath>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<NoStdLib>true</NoStdLib>
|
||||
<UseVSHostingProcess>false</UseVSHostingProcess>
|
||||
<PlatformTarget>x86</PlatformTarget>
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<DefineConstants>TRACE;DEBUG;XBOX;XBOX360;CODE_ANALYSIS</DefineConstants>
|
||||
<XnaCompressContent>true</XnaCompressContent>
|
||||
<RunCodeAnalysis>false</RunCodeAnalysis>
|
||||
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|Xbox 360' ">
|
||||
<OutputPath>bin\Xbox\</OutputPath>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<NoStdLib>true</NoStdLib>
|
||||
<UseVSHostingProcess>false</UseVSHostingProcess>
|
||||
<PlatformTarget>x86</PlatformTarget>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<DefineConstants>TRACE;XBOX;XBOX360;CODE_ANALYSIS</DefineConstants>
|
||||
<XnaCompressContent>true</XnaCompressContent>
|
||||
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="..\AssemblyCommentAttribute.cs">
|
||||
<Link>AssemblyCommentAttribute.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\FileHelpers.cs">
|
||||
<Link>FileHelpers.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\GlobalSuppressions.cs">
|
||||
<Link>GlobalSuppressions.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\IEnumerableExtensions.cs">
|
||||
<Link>IEnumerableExtensions.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\Lazy.cs">
|
||||
<Link>Lazy.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\MathHelpers.cs">
|
||||
<Link>MathHelpers.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\SingletonFactory.cs">
|
||||
<Link>SingletonFactory.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\StreamExtensions.cs">
|
||||
<Link>StreamExtensions.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\XmlSerializerHelpers.cs">
|
||||
<Link>XmlSerializerHelpers.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="FrameRateCounter.cs" />
|
||||
<Compile Include="GameBase.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="StringBuilderExtensions.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<NestedContentProject Include="Content\Content.contentproj">
|
||||
<Project>a96f5631-40e1-40b0-aee2-6f2e3368e2ae</Project>
|
||||
<Visible>False</Visible>
|
||||
</NestedContentProject>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<BootstrapperPackage Include="Microsoft.Net.Client.3.5">
|
||||
<Visible>False</Visible>
|
||||
<ProductName>.NET Framework Client Profile</ProductName>
|
||||
<Install>false</Install>
|
||||
</BootstrapperPackage>
|
||||
<BootstrapperPackage Include="Microsoft.Net.Framework.2.0">
|
||||
<Visible>False</Visible>
|
||||
<ProductName>.NET Framework 2.0 %28x86%29</ProductName>
|
||||
<Install>false</Install>
|
||||
</BootstrapperPackage>
|
||||
<BootstrapperPackage Include="Microsoft.Net.Framework.3.0">
|
||||
<Visible>False</Visible>
|
||||
<ProductName>.NET Framework 3.0 %28x86%29</ProductName>
|
||||
<Install>false</Install>
|
||||
</BootstrapperPackage>
|
||||
<BootstrapperPackage Include="Microsoft.Net.Framework.3.5">
|
||||
<Visible>False</Visible>
|
||||
<ProductName>.NET Framework 3.5</ProductName>
|
||||
<Install>false</Install>
|
||||
</BootstrapperPackage>
|
||||
<BootstrapperPackage Include="Microsoft.Net.Framework.3.5.SP1">
|
||||
<Visible>False</Visible>
|
||||
<ProductName>.NET Framework 3.5 SP1</ProductName>
|
||||
<Install>true</Install>
|
||||
</BootstrapperPackage>
|
||||
<BootstrapperPackage Include="Microsoft.Windows.Installer.3.1">
|
||||
<Visible>False</Visible>
|
||||
<ProductName>Windows Installer 3.1</ProductName>
|
||||
<Install>true</Install>
|
||||
</BootstrapperPackage>
|
||||
<BootstrapperPackage Include="Microsoft.Xna.Framework.3.0">
|
||||
<Visible>False</Visible>
|
||||
<ProductName>Microsoft XNA Framework Redistributable 3.0</ProductName>
|
||||
<Install>true</Install>
|
||||
</BootstrapperPackage>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="Microsoft.Xna.Framework">
|
||||
<Private>False</Private>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.Xna.Framework.Game">
|
||||
<Private>False</Private>
|
||||
</Reference>
|
||||
<Reference Include="mscorlib">
|
||||
<Private>False</Private>
|
||||
</Reference>
|
||||
<Reference Include="System">
|
||||
<Private>False</Private>
|
||||
</Reference>
|
||||
<Reference Include="System.Core">
|
||||
<Private>False</Private>
|
||||
<RequiredTargetFramework>3.5</RequiredTargetFramework>
|
||||
</Reference>
|
||||
<Reference Include="System.Xml">
|
||||
<Private>False</Private>
|
||||
</Reference>
|
||||
<Reference Include="System.Xml.Linq">
|
||||
<Private>False</Private>
|
||||
<RequiredTargetFramework>3.5</RequiredTargetFramework>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<CodeAnalysisDictionary Include="..\CustomDictionary.xml">
|
||||
<Link>CustomDictionary.xml</Link>
|
||||
</CodeAnalysisDictionary>
|
||||
</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.
|
||||
Other similar extension points exist, see Microsoft.Common.targets.
|
||||
<Target Name="BeforeBuild">
|
||||
</Target>
|
||||
<Target Name="AfterBuild">
|
||||
</Target>
|
||||
-->
|
||||
</Project>
|
174
Library/Xna/Jellyfish.Library.Xna.Zune.csproj
Normal file
174
Library/Xna/Jellyfish.Library.Xna.Zune.csproj
Normal file
|
@ -0,0 +1,174 @@
|
|||
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="3.5">
|
||||
<PropertyGroup>
|
||||
<ProjectGuid>{8B5D5A39-10FA-434A-B8C4-09D4FDB96720}</ProjectGuid>
|
||||
<ProjectTypeGuids>{D399B71A-8929-442a-A9AC-8BEC78BB2433};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">Zune</Platform>
|
||||
<OutputType>Library</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>Jellyfish.Library</RootNamespace>
|
||||
<AssemblyName>Jellyfish.Library</AssemblyName>
|
||||
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
|
||||
<XnaFrameworkVersion>v3.0</XnaFrameworkVersion>
|
||||
<XnaPlatform>Zune</XnaPlatform>
|
||||
<XnaCrossPlatformGroupID>3289d0b6-d8a8-415e-8c29-dc355352cb54</XnaCrossPlatformGroupID>
|
||||
<PublishUrl>publish\</PublishUrl>
|
||||
<Install>true</Install>
|
||||
<InstallFrom>Disk</InstallFrom>
|
||||
<UpdateEnabled>false</UpdateEnabled>
|
||||
<UpdateMode>Foreground</UpdateMode>
|
||||
<UpdateInterval>7</UpdateInterval>
|
||||
<UpdateIntervalUnits>Days</UpdateIntervalUnits>
|
||||
<UpdatePeriodically>false</UpdatePeriodically>
|
||||
<UpdateRequired>false</UpdateRequired>
|
||||
<MapFileExtensions>true</MapFileExtensions>
|
||||
<ApplicationRevision>0</ApplicationRevision>
|
||||
<ApplicationVersion>1.0.0.%2a</ApplicationVersion>
|
||||
<IsWebBootstrapper>false</IsWebBootstrapper>
|
||||
<UseApplicationTrust>false</UseApplicationTrust>
|
||||
<BootstrapperEnabled>true</BootstrapperEnabled>
|
||||
<SignAssembly>true</SignAssembly>
|
||||
<AssemblyOriginatorKeyFile>..\..\Jellyfish.snk</AssemblyOriginatorKeyFile>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|Zune' ">
|
||||
<OutputPath>bin\Zune\</OutputPath>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<NoStdLib>true</NoStdLib>
|
||||
<UseVSHostingProcess>false</UseVSHostingProcess>
|
||||
<PlatformTarget>x86</PlatformTarget>
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<DefineConstants>TRACE;DEBUG;ZUNE;CODE_ANALYSIS</DefineConstants>
|
||||
<RunCodeAnalysis>false</RunCodeAnalysis>
|
||||
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|Zune' ">
|
||||
<OutputPath>bin\Zune\</OutputPath>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<NoStdLib>true</NoStdLib>
|
||||
<UseVSHostingProcess>false</UseVSHostingProcess>
|
||||
<PlatformTarget>x86</PlatformTarget>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<DefineConstants>TRACE;ZUNE;CODE_ANALYSIS</DefineConstants>
|
||||
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="..\AssemblyCommentAttribute.cs">
|
||||
<Link>AssemblyCommentAttribute.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\FileHelpers.cs">
|
||||
<Link>FileHelpers.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\GlobalSuppressions.cs">
|
||||
<Link>GlobalSuppressions.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\IEnumerableExtensions.cs">
|
||||
<Link>IEnumerableExtensions.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\Lazy.cs">
|
||||
<Link>Lazy.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\MathHelpers.cs">
|
||||
<Link>MathHelpers.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\SingletonFactory.cs">
|
||||
<Link>SingletonFactory.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\StreamExtensions.cs">
|
||||
<Link>StreamExtensions.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\XmlSerializerHelpers.cs">
|
||||
<Link>XmlSerializerHelpers.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="FrameRateCounter.cs" />
|
||||
<Compile Include="GameBase.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="StringBuilderExtensions.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<NestedContentProject Include="Content\Content.contentproj">
|
||||
<Project>a96f5631-40e1-40b0-aee2-6f2e3368e2ae</Project>
|
||||
<Visible>False</Visible>
|
||||
</NestedContentProject>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<BootstrapperPackage Include="Microsoft.Net.Client.3.5">
|
||||
<Visible>False</Visible>
|
||||
<ProductName>.NET Framework Client Profile</ProductName>
|
||||
<Install>false</Install>
|
||||
</BootstrapperPackage>
|
||||
<BootstrapperPackage Include="Microsoft.Net.Framework.2.0">
|
||||
<Visible>False</Visible>
|
||||
<ProductName>.NET Framework 2.0 %28x86%29</ProductName>
|
||||
<Install>false</Install>
|
||||
</BootstrapperPackage>
|
||||
<BootstrapperPackage Include="Microsoft.Net.Framework.3.0">
|
||||
<Visible>False</Visible>
|
||||
<ProductName>.NET Framework 3.0 %28x86%29</ProductName>
|
||||
<Install>false</Install>
|
||||
</BootstrapperPackage>
|
||||
<BootstrapperPackage Include="Microsoft.Net.Framework.3.5">
|
||||
<Visible>False</Visible>
|
||||
<ProductName>.NET Framework 3.5</ProductName>
|
||||
<Install>false</Install>
|
||||
</BootstrapperPackage>
|
||||
<BootstrapperPackage Include="Microsoft.Net.Framework.3.5.SP1">
|
||||
<Visible>False</Visible>
|
||||
<ProductName>.NET Framework 3.5 SP1</ProductName>
|
||||
<Install>true</Install>
|
||||
</BootstrapperPackage>
|
||||
<BootstrapperPackage Include="Microsoft.Windows.Installer.3.1">
|
||||
<Visible>False</Visible>
|
||||
<ProductName>Windows Installer 3.1</ProductName>
|
||||
<Install>true</Install>
|
||||
</BootstrapperPackage>
|
||||
<BootstrapperPackage Include="Microsoft.Xna.Framework.3.0">
|
||||
<Visible>False</Visible>
|
||||
<ProductName>Microsoft XNA Framework Redistributable 3.0</ProductName>
|
||||
<Install>true</Install>
|
||||
</BootstrapperPackage>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="Microsoft.Xna.Framework">
|
||||
<Private>False</Private>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.Xna.Framework.Game">
|
||||
<Private>False</Private>
|
||||
</Reference>
|
||||
<Reference Include="mscorlib">
|
||||
<Private>False</Private>
|
||||
</Reference>
|
||||
<Reference Include="System">
|
||||
<Private>False</Private>
|
||||
</Reference>
|
||||
<Reference Include="System.Core">
|
||||
<Private>False</Private>
|
||||
<RequiredTargetFramework>3.5</RequiredTargetFramework>
|
||||
</Reference>
|
||||
<Reference Include="System.Xml">
|
||||
<Private>False</Private>
|
||||
</Reference>
|
||||
<Reference Include="System.Xml.Linq">
|
||||
<Private>False</Private>
|
||||
<RequiredTargetFramework>3.5</RequiredTargetFramework>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<CodeAnalysisDictionary Include="..\CustomDictionary.xml">
|
||||
<Link>CustomDictionary.xml</Link>
|
||||
</CodeAnalysisDictionary>
|
||||
</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.
|
||||
Other similar extension points exist, see Microsoft.Common.targets.
|
||||
<Target Name="BeforeBuild">
|
||||
</Target>
|
||||
<Target Name="AfterBuild">
|
||||
</Target>
|
||||
-->
|
||||
</Project>
|
188
Library/Xna/Jellyfish.Library.Xna.csproj
Normal file
188
Library/Xna/Jellyfish.Library.Xna.csproj
Normal file
|
@ -0,0 +1,188 @@
|
|||
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="3.5">
|
||||
<PropertyGroup>
|
||||
<ProjectGuid>{E246958B-EAD8-48E9-844B-54718C952869}</ProjectGuid>
|
||||
<ProjectTypeGuids>{6D335F3A-9D43-41b4-9D22-F6F17C4BE596};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">x86</Platform>
|
||||
<OutputType>Library</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>Jellyfish.Library</RootNamespace>
|
||||
<AssemblyName>Jellyfish.Library</AssemblyName>
|
||||
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
|
||||
<XnaFrameworkVersion>v3.0</XnaFrameworkVersion>
|
||||
<XnaPlatform>Windows</XnaPlatform>
|
||||
<XnaCrossPlatformGroupID>3289d0b6-d8a8-415e-8c29-dc355352cb54</XnaCrossPlatformGroupID>
|
||||
<PublishUrl>publish\</PublishUrl>
|
||||
<Install>true</Install>
|
||||
<InstallFrom>Disk</InstallFrom>
|
||||
<UpdateEnabled>false</UpdateEnabled>
|
||||
<UpdateMode>Foreground</UpdateMode>
|
||||
<UpdateInterval>7</UpdateInterval>
|
||||
<UpdateIntervalUnits>Days</UpdateIntervalUnits>
|
||||
<UpdatePeriodically>false</UpdatePeriodically>
|
||||
<UpdateRequired>false</UpdateRequired>
|
||||
<MapFileExtensions>true</MapFileExtensions>
|
||||
<ApplicationRevision>0</ApplicationRevision>
|
||||
<ApplicationVersion>1.0.0.%2a</ApplicationVersion>
|
||||
<IsWebBootstrapper>false</IsWebBootstrapper>
|
||||
<UseApplicationTrust>false</UseApplicationTrust>
|
||||
<BootstrapperEnabled>true</BootstrapperEnabled>
|
||||
<SignAssembly>true</SignAssembly>
|
||||
<AssemblyOriginatorKeyFile>..\..\Jellyfish.snk</AssemblyOriginatorKeyFile>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\</OutputPath>
|
||||
<DefineConstants>TRACE;DEBUG;WINDOWS;CODE_ANALYSIS</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<NoStdLib>true</NoStdLib>
|
||||
<UseVSHostingProcess>false</UseVSHostingProcess>
|
||||
<PlatformTarget>x86</PlatformTarget>
|
||||
<XnaCompressContent>false</XnaCompressContent>
|
||||
<RunCodeAnalysis>false</RunCodeAnalysis>
|
||||
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\</OutputPath>
|
||||
<DefineConstants>TRACE;WINDOWS;CODE_ANALYSIS</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<NoStdLib>true</NoStdLib>
|
||||
<UseVSHostingProcess>false</UseVSHostingProcess>
|
||||
<PlatformTarget>x86</PlatformTarget>
|
||||
<XnaCompressContent>true</XnaCompressContent>
|
||||
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="Microsoft.Xna.Framework, Version=3.0.0.0, Culture=neutral, PublicKeyToken=6d5c3888ef60e27d, processorArchitecture=x86">
|
||||
<Private>False</Private>
|
||||
<SpecificVersion>True</SpecificVersion>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.Xna.Framework.Game, Version=3.0.0.0, Culture=neutral, PublicKeyToken=6d5c3888ef60e27d, processorArchitecture=MSIL">
|
||||
<Private>False</Private>
|
||||
<SpecificVersion>True</SpecificVersion>
|
||||
</Reference>
|
||||
<Reference Include="mscorlib">
|
||||
<Private>False</Private>
|
||||
</Reference>
|
||||
<Reference Include="System">
|
||||
<Private>False</Private>
|
||||
</Reference>
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Xml">
|
||||
<Private>False</Private>
|
||||
</Reference>
|
||||
<Reference Include="System.Core">
|
||||
<RequiredTargetFramework>3.5</RequiredTargetFramework>
|
||||
<Private>False</Private>
|
||||
</Reference>
|
||||
<Reference Include="System.Xml.Linq">
|
||||
<RequiredTargetFramework>3.5</RequiredTargetFramework>
|
||||
<Private>False</Private>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="..\AssemblyCommentAttribute.cs">
|
||||
<Link>AssemblyCommentAttribute.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\FileHelpers.cs">
|
||||
<Link>FileHelpers.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\GeneralSecurity.cs">
|
||||
<Link>GeneralSecurity.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\GlobalSuppressions.cs">
|
||||
<Link>GlobalSuppressions.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\IEnumerableExtensions.cs">
|
||||
<Link>IEnumerableExtensions.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\Lazy.cs">
|
||||
<Link>Lazy.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\MathHelpers.cs">
|
||||
<Link>MathHelpers.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\SafeAllocHandle.cs">
|
||||
<Link>SafeAllocHandle.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\SafeFileHandle.cs">
|
||||
<Link>SafeFileHandle.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\SingletonFactory.cs">
|
||||
<Link>SingletonFactory.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\StreamExtensions.cs">
|
||||
<Link>StreamExtensions.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\XmlSerializerHelpers.cs">
|
||||
<Link>XmlSerializerHelpers.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="FrameRateCounter.cs" />
|
||||
<Compile Include="GameBase.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="StringBuilderExtensions.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<NestedContentProject Include="Content\Content.contentproj">
|
||||
<Project>a96f5631-40e1-40b0-aee2-6f2e3368e2ae</Project>
|
||||
<Visible>False</Visible>
|
||||
</NestedContentProject>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<BootstrapperPackage Include="Microsoft.Net.Client.3.5">
|
||||
<Visible>False</Visible>
|
||||
<ProductName>.NET Framework Client Profile</ProductName>
|
||||
<Install>false</Install>
|
||||
</BootstrapperPackage>
|
||||
<BootstrapperPackage Include="Microsoft.Net.Framework.2.0">
|
||||
<Visible>False</Visible>
|
||||
<ProductName>.NET Framework 2.0 %28x86%29</ProductName>
|
||||
<Install>false</Install>
|
||||
</BootstrapperPackage>
|
||||
<BootstrapperPackage Include="Microsoft.Net.Framework.3.0">
|
||||
<Visible>False</Visible>
|
||||
<ProductName>.NET Framework 3.0 %28x86%29</ProductName>
|
||||
<Install>false</Install>
|
||||
</BootstrapperPackage>
|
||||
<BootstrapperPackage Include="Microsoft.Net.Framework.3.5">
|
||||
<Visible>False</Visible>
|
||||
<ProductName>.NET Framework 3.5</ProductName>
|
||||
<Install>false</Install>
|
||||
</BootstrapperPackage>
|
||||
<BootstrapperPackage Include="Microsoft.Net.Framework.3.5.SP1">
|
||||
<Visible>False</Visible>
|
||||
<ProductName>.NET Framework 3.5 SP1</ProductName>
|
||||
<Install>true</Install>
|
||||
</BootstrapperPackage>
|
||||
<BootstrapperPackage Include="Microsoft.Windows.Installer.3.1">
|
||||
<Visible>False</Visible>
|
||||
<ProductName>Windows Installer 3.1</ProductName>
|
||||
<Install>true</Install>
|
||||
</BootstrapperPackage>
|
||||
<BootstrapperPackage Include="Microsoft.Xna.Framework.3.0">
|
||||
<Visible>False</Visible>
|
||||
<ProductName>Microsoft XNA Framework Redistributable 3.0</ProductName>
|
||||
<Install>true</Install>
|
||||
</BootstrapperPackage>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<CodeAnalysisDictionary Include="..\CustomDictionary.xml">
|
||||
<Link>CustomDictionary.xml</Link>
|
||||
</CodeAnalysisDictionary>
|
||||
</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.
|
||||
Other similar extension points exist, see Microsoft.Common.targets.
|
||||
<Target Name="BeforeBuild">
|
||||
</Target>
|
||||
<Target Name="AfterBuild">
|
||||
</Target>
|
||||
-->
|
||||
</Project>
|
70
Library/Xna/Jellyfish.Library.Xna.sln
Normal file
70
Library/Xna/Jellyfish.Library.Xna.sln
Normal file
|
@ -0,0 +1,70 @@
|
|||
|
||||
Microsoft Visual Studio Solution File, Format Version 10.00
|
||||
# Visual Studio 2008
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Jellyfish.Library.Xna", "Jellyfish.Library.Xna.csproj", "{E246958B-EAD8-48E9-844B-54718C952869}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Jellyfish.Library.Xna.Xbox", "Jellyfish.Library.Xna.Xbox.csproj", "{6EE9A3C2-0BD8-480D-AED2-6A5A9EBF7AFA}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Jellyfish.Library.Xna.Zune", "Jellyfish.Library.Xna.Zune.csproj", "{8B5D5A39-10FA-434A-B8C4-09D4FDB96720}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Mixed Platforms = Debug|Mixed Platforms
|
||||
Debug|x86 = Debug|x86
|
||||
Debug|Xbox 360 = Debug|Xbox 360
|
||||
Debug|Zune = Debug|Zune
|
||||
Release|Mixed Platforms = Release|Mixed Platforms
|
||||
Release|x86 = Release|x86
|
||||
Release|Xbox 360 = Release|Xbox 360
|
||||
Release|Zune = Release|Zune
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{E246958B-EAD8-48E9-844B-54718C952869}.Debug|Mixed Platforms.ActiveCfg = Debug|x86
|
||||
{E246958B-EAD8-48E9-844B-54718C952869}.Debug|Mixed Platforms.Build.0 = Debug|x86
|
||||
{E246958B-EAD8-48E9-844B-54718C952869}.Debug|x86.ActiveCfg = Debug|x86
|
||||
{E246958B-EAD8-48E9-844B-54718C952869}.Debug|x86.Build.0 = Debug|x86
|
||||
{E246958B-EAD8-48E9-844B-54718C952869}.Debug|Xbox 360.ActiveCfg = Debug|x86
|
||||
{E246958B-EAD8-48E9-844B-54718C952869}.Debug|Zune.ActiveCfg = Debug|x86
|
||||
{E246958B-EAD8-48E9-844B-54718C952869}.Release|Mixed Platforms.ActiveCfg = Release|x86
|
||||
{E246958B-EAD8-48E9-844B-54718C952869}.Release|Mixed Platforms.Build.0 = Release|x86
|
||||
{E246958B-EAD8-48E9-844B-54718C952869}.Release|x86.ActiveCfg = Release|x86
|
||||
{E246958B-EAD8-48E9-844B-54718C952869}.Release|x86.Build.0 = Release|x86
|
||||
{E246958B-EAD8-48E9-844B-54718C952869}.Release|Xbox 360.ActiveCfg = Release|x86
|
||||
{E246958B-EAD8-48E9-844B-54718C952869}.Release|Zune.ActiveCfg = Release|x86
|
||||
{6EE9A3C2-0BD8-480D-AED2-6A5A9EBF7AFA}.Debug|Mixed Platforms.ActiveCfg = Debug|Xbox 360
|
||||
{6EE9A3C2-0BD8-480D-AED2-6A5A9EBF7AFA}.Debug|Mixed Platforms.Build.0 = Debug|Xbox 360
|
||||
{6EE9A3C2-0BD8-480D-AED2-6A5A9EBF7AFA}.Debug|x86.ActiveCfg = Debug|Xbox 360
|
||||
{6EE9A3C2-0BD8-480D-AED2-6A5A9EBF7AFA}.Debug|Xbox 360.ActiveCfg = Debug|Xbox 360
|
||||
{6EE9A3C2-0BD8-480D-AED2-6A5A9EBF7AFA}.Debug|Xbox 360.Build.0 = Debug|Xbox 360
|
||||
{6EE9A3C2-0BD8-480D-AED2-6A5A9EBF7AFA}.Debug|Zune.ActiveCfg = Debug|Xbox 360
|
||||
{6EE9A3C2-0BD8-480D-AED2-6A5A9EBF7AFA}.Release|Mixed Platforms.ActiveCfg = Release|Xbox 360
|
||||
{6EE9A3C2-0BD8-480D-AED2-6A5A9EBF7AFA}.Release|Mixed Platforms.Build.0 = Release|Xbox 360
|
||||
{6EE9A3C2-0BD8-480D-AED2-6A5A9EBF7AFA}.Release|x86.ActiveCfg = Release|Xbox 360
|
||||
{6EE9A3C2-0BD8-480D-AED2-6A5A9EBF7AFA}.Release|Xbox 360.ActiveCfg = Release|Xbox 360
|
||||
{6EE9A3C2-0BD8-480D-AED2-6A5A9EBF7AFA}.Release|Xbox 360.Build.0 = Release|Xbox 360
|
||||
{6EE9A3C2-0BD8-480D-AED2-6A5A9EBF7AFA}.Release|Zune.ActiveCfg = Release|Xbox 360
|
||||
{A96F5631-40E1-40B0-AEE2-6F2E3368E2AE}.Debug|Mixed Platforms.ActiveCfg = Debug|x86
|
||||
{A96F5631-40E1-40B0-AEE2-6F2E3368E2AE}.Debug|x86.ActiveCfg = Debug|x86
|
||||
{A96F5631-40E1-40B0-AEE2-6F2E3368E2AE}.Debug|Xbox 360.ActiveCfg = Debug|x86
|
||||
{A96F5631-40E1-40B0-AEE2-6F2E3368E2AE}.Debug|Zune.ActiveCfg = Debug|x86
|
||||
{A96F5631-40E1-40B0-AEE2-6F2E3368E2AE}.Release|Mixed Platforms.ActiveCfg = Release|x86
|
||||
{A96F5631-40E1-40B0-AEE2-6F2E3368E2AE}.Release|x86.ActiveCfg = Release|x86
|
||||
{A96F5631-40E1-40B0-AEE2-6F2E3368E2AE}.Release|Xbox 360.ActiveCfg = Release|x86
|
||||
{A96F5631-40E1-40B0-AEE2-6F2E3368E2AE}.Release|Zune.ActiveCfg = Release|x86
|
||||
{8B5D5A39-10FA-434A-B8C4-09D4FDB96720}.Debug|Mixed Platforms.ActiveCfg = Debug|Zune
|
||||
{8B5D5A39-10FA-434A-B8C4-09D4FDB96720}.Debug|Mixed Platforms.Build.0 = Debug|Zune
|
||||
{8B5D5A39-10FA-434A-B8C4-09D4FDB96720}.Debug|x86.ActiveCfg = Debug|Zune
|
||||
{8B5D5A39-10FA-434A-B8C4-09D4FDB96720}.Debug|Xbox 360.ActiveCfg = Debug|Zune
|
||||
{8B5D5A39-10FA-434A-B8C4-09D4FDB96720}.Debug|Zune.ActiveCfg = Debug|Zune
|
||||
{8B5D5A39-10FA-434A-B8C4-09D4FDB96720}.Debug|Zune.Build.0 = Debug|Zune
|
||||
{8B5D5A39-10FA-434A-B8C4-09D4FDB96720}.Release|Mixed Platforms.ActiveCfg = Release|Zune
|
||||
{8B5D5A39-10FA-434A-B8C4-09D4FDB96720}.Release|Mixed Platforms.Build.0 = Release|Zune
|
||||
{8B5D5A39-10FA-434A-B8C4-09D4FDB96720}.Release|x86.ActiveCfg = Release|Zune
|
||||
{8B5D5A39-10FA-434A-B8C4-09D4FDB96720}.Release|Xbox 360.ActiveCfg = Release|Zune
|
||||
{8B5D5A39-10FA-434A-B8C4-09D4FDB96720}.Release|Zune.ActiveCfg = Release|Zune
|
||||
{8B5D5A39-10FA-434A-B8C4-09D4FDB96720}.Release|Zune.Build.0 = Release|Zune
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
EndGlobal
|
29
Library/Xna/Properties/AssemblyInfo.cs
Normal file
29
Library/Xna/Properties/AssemblyInfo.cs
Normal file
|
@ -0,0 +1,29 @@
|
|||
using System;
|
||||
using System.Reflection;
|
||||
using System.Resources;
|
||||
using System.Runtime.InteropServices;
|
||||
using Jellyfish.Library;
|
||||
|
||||
[assembly: AssemblyTitle("Library")]
|
||||
[assembly: AssemblyDescription("Common Library")]
|
||||
#if XBOX
|
||||
[assembly: AssemblyProduct("Jellyfish.Library.Xna.Xbox")]
|
||||
#elif ZUNE
|
||||
[assembly: AssemblyProduct("Jellyfish.Library.Xna.Zune")]
|
||||
#else
|
||||
[assembly: AssemblyProduct("Jellyfish.Library.Xna")]
|
||||
#endif
|
||||
[assembly: AssemblyCompany("Digital Jellyfish Design Ltd")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2009 Digital Jellyfish Design Ltd")]
|
||||
[assembly: AssemblyComment("Developed by Sean Fausett")]
|
||||
|
||||
[assembly: AssemblyVersion("0.1.0.0")]
|
||||
#if WINDOWS
|
||||
[assembly: AssemblyFileVersion("0.1.0.0")]
|
||||
#endif
|
||||
|
||||
[assembly: CLSCompliant(false)]
|
||||
[assembly: ComVisible(false)]
|
||||
[assembly: Guid("66034b9e-9f0b-47b0-aac4-cade9a748891")]
|
||||
|
||||
[assembly: NeutralResourcesLanguage("en")]
|
27
Library/Xna/StringBuilderExtensions.cs
Normal file
27
Library/Xna/StringBuilderExtensions.cs
Normal file
|
@ -0,0 +1,27 @@
|
|||
using System.Text;
|
||||
|
||||
namespace Jellyfish.Library
|
||||
{
|
||||
public static class StringBuilderExtensions
|
||||
{
|
||||
public static StringBuilder AppendWithoutGarbage(this StringBuilder builder, int number)
|
||||
{
|
||||
if (number < 0)
|
||||
{
|
||||
builder.Append('-');
|
||||
}
|
||||
|
||||
int index = builder.Length;
|
||||
do
|
||||
{
|
||||
builder.Insert(index, _digits, (number % 10) + 9, 1);
|
||||
number /= 10;
|
||||
}
|
||||
while (number != 0);
|
||||
|
||||
return builder;
|
||||
}
|
||||
|
||||
private static readonly char[] _digits = new char[] { '9', '8', '7', '6', '5', '4', '3', '2', '1', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9' };
|
||||
}
|
||||
}
|
23
Virtu/Cassette.cs
Normal file
23
Virtu/Cassette.cs
Normal file
|
@ -0,0 +1,23 @@
|
|||
using System.Diagnostics.CodeAnalysis;
|
||||
|
||||
namespace Jellyfish.Virtu
|
||||
{
|
||||
public sealed class Cassette : MachineComponent
|
||||
{
|
||||
public Cassette(Machine machine) :
|
||||
base(machine)
|
||||
{
|
||||
}
|
||||
|
||||
[SuppressMessage("Microsoft.Performance", "CA1822:MarkMembersAsStatic")]
|
||||
public bool ReadInput()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
[SuppressMessage("Microsoft.Performance", "CA1822:MarkMembersAsStatic")]
|
||||
public void ToggleOutput()
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
8
Virtu/Constants.cs
Normal file
8
Virtu/Constants.cs
Normal file
|
@ -0,0 +1,8 @@
|
|||
using System;
|
||||
|
||||
namespace Jellyfish.Virtu.Properties
|
||||
{
|
||||
public static class Constants
|
||||
{
|
||||
}
|
||||
}
|
3254
Virtu/Cpu.cs
Normal file
3254
Virtu/Cpu.cs
Normal file
File diff suppressed because it is too large
Load Diff
88
Virtu/CpuData.cs
Normal file
88
Virtu/CpuData.cs
Normal file
|
@ -0,0 +1,88 @@
|
|||
using System;
|
||||
|
||||
namespace Jellyfish.Virtu
|
||||
{
|
||||
public partial class Cpu
|
||||
{
|
||||
private const int CyclesPerUpdate = 17030;
|
||||
private const int CyclesPerVSync = 17030;
|
||||
private const int CyclesPerSecond = 1022730;
|
||||
private static readonly long TicksPerVSync = TimeSpan.FromSeconds((double)CyclesPerVSync / (double)CyclesPerSecond).Ticks;
|
||||
|
||||
private const int OpcodeCount = 256;
|
||||
|
||||
private readonly Action[] ExecuteOpcode65N02;
|
||||
private readonly Action[] ExecuteOpcode65C02;
|
||||
|
||||
private const int PC = 0x01;
|
||||
private const int PZ = 0x02;
|
||||
private const int PI = 0x04;
|
||||
private const int PD = 0x08;
|
||||
private const int PB = 0x10;
|
||||
private const int PR = 0x20;
|
||||
private const int PV = 0x40;
|
||||
private const int PN = 0x80;
|
||||
|
||||
private const int DataCount = 256;
|
||||
|
||||
private static readonly int[] DataPN = new int[DataCount]
|
||||
{
|
||||
0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
|
||||
0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
|
||||
0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
|
||||
0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
|
||||
0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
|
||||
0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
|
||||
0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
|
||||
0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
|
||||
PN, PN, PN, PN, PN, PN, PN, PN, PN, PN, PN, PN, PN, PN, PN, PN,
|
||||
PN, PN, PN, PN, PN, PN, PN, PN, PN, PN, PN, PN, PN, PN, PN, PN,
|
||||
PN, PN, PN, PN, PN, PN, PN, PN, PN, PN, PN, PN, PN, PN, PN, PN,
|
||||
PN, PN, PN, PN, PN, PN, PN, PN, PN, PN, PN, PN, PN, PN, PN, PN,
|
||||
PN, PN, PN, PN, PN, PN, PN, PN, PN, PN, PN, PN, PN, PN, PN, PN,
|
||||
PN, PN, PN, PN, PN, PN, PN, PN, PN, PN, PN, PN, PN, PN, PN, PN,
|
||||
PN, PN, PN, PN, PN, PN, PN, PN, PN, PN, PN, PN, PN, PN, PN, PN,
|
||||
PN, PN, PN, PN, PN, PN, PN, PN, PN, PN, PN, PN, PN, PN, PN, PN
|
||||
};
|
||||
|
||||
private static readonly int[] DataPZ = new int[DataCount]
|
||||
{
|
||||
PZ, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
|
||||
0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
|
||||
0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
|
||||
0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
|
||||
0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
|
||||
0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
|
||||
0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
|
||||
0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
|
||||
0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
|
||||
0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
|
||||
0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
|
||||
0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
|
||||
0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
|
||||
0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
|
||||
0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
|
||||
0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0
|
||||
};
|
||||
|
||||
private static readonly int[] DataPNZ = new int[DataCount]
|
||||
{
|
||||
PZ, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
|
||||
0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
|
||||
0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
|
||||
0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
|
||||
0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
|
||||
0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
|
||||
0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
|
||||
0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
|
||||
PN, PN, PN, PN, PN, PN, PN, PN, PN, PN, PN, PN, PN, PN, PN, PN,
|
||||
PN, PN, PN, PN, PN, PN, PN, PN, PN, PN, PN, PN, PN, PN, PN, PN,
|
||||
PN, PN, PN, PN, PN, PN, PN, PN, PN, PN, PN, PN, PN, PN, PN, PN,
|
||||
PN, PN, PN, PN, PN, PN, PN, PN, PN, PN, PN, PN, PN, PN, PN, PN,
|
||||
PN, PN, PN, PN, PN, PN, PN, PN, PN, PN, PN, PN, PN, PN, PN, PN,
|
||||
PN, PN, PN, PN, PN, PN, PN, PN, PN, PN, PN, PN, PN, PN, PN, PN,
|
||||
PN, PN, PN, PN, PN, PN, PN, PN, PN, PN, PN, PN, PN, PN, PN, PN,
|
||||
PN, PN, PN, PN, PN, PN, PN, PN, PN, PN, PN, PN, PN, PN, PN, PN
|
||||
};
|
||||
}
|
||||
}
|
24
Virtu/CustomDictionary.xml
Normal file
24
Virtu/CustomDictionary.xml
Normal file
|
@ -0,0 +1,24 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Dictionary>
|
||||
<Acronyms>
|
||||
<CasingExceptions>
|
||||
<Acronym>CXXX</Acronym>
|
||||
<Acronym>RPC</Acronym>
|
||||
</CasingExceptions>
|
||||
</Acronyms>
|
||||
<Words>
|
||||
<Recognized>
|
||||
<Word>Annunciator</Word>
|
||||
<Word>Dsk</Word>
|
||||
<Word>Opcode</Word>
|
||||
<Word>Virtu</Word>
|
||||
<Word>Xna</Word>
|
||||
<Word>x</Word>
|
||||
<Word>y</Word>
|
||||
</Recognized>
|
||||
<Unrecognized>
|
||||
<Word>DownRight</Word>
|
||||
<Word>UpRight</Word>
|
||||
</Unrecognized>
|
||||
</Words>
|
||||
</Dictionary>
|
43
Virtu/Disk525.cs
Normal file
43
Virtu/Disk525.cs
Normal file
|
@ -0,0 +1,43 @@
|
|||
using System;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
|
||||
namespace Jellyfish.Virtu
|
||||
{
|
||||
public abstract class Disk525
|
||||
{
|
||||
protected Disk525(string name, byte[] data, bool isWriteProtected)
|
||||
{
|
||||
Name = name;
|
||||
Data = data;
|
||||
IsWriteProtected = true; // TODO use isWriteProtected
|
||||
}
|
||||
|
||||
public static Disk525 CreateDisk(string name, byte[] data, int volume, bool isWriteProtected)
|
||||
{
|
||||
if (name.EndsWith(".nib", StringComparison.OrdinalIgnoreCase) && (data.Length == TrackCount * TrackSize))
|
||||
{
|
||||
return new DiskNib(name, data, isWriteProtected);
|
||||
}
|
||||
else if (name.EndsWith(".dsk", StringComparison.OrdinalIgnoreCase) && (data.Length == TrackCount * SectorCount * SectorSize))
|
||||
{
|
||||
return new DiskDsk(name, data, volume, isWriteProtected);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public abstract void ReadTrack(int number, int fraction, byte[] buffer);
|
||||
public abstract void WriteTrack(int number, int fraction, byte[] buffer);
|
||||
|
||||
public string Name { get; private set; }
|
||||
public bool IsWriteProtected { get; private set; }
|
||||
|
||||
[SuppressMessage("Microsoft.Performance", "CA1819:PropertiesShouldNotReturnArrays")]
|
||||
protected byte[] Data { get; private set; }
|
||||
|
||||
public const int SectorCount = 16;
|
||||
public const int SectorSize = 0x100;
|
||||
public const int TrackCount = 35;
|
||||
public const int TrackSize = 0x1A00;
|
||||
}
|
||||
}
|
27
Virtu/DiskDsk.cs
Normal file
27
Virtu/DiskDsk.cs
Normal file
|
@ -0,0 +1,27 @@
|
|||
using System;
|
||||
|
||||
namespace Jellyfish.Virtu
|
||||
{
|
||||
public sealed class DiskDsk : Disk525
|
||||
{
|
||||
public DiskDsk(string name, byte[] data, int volume, bool isWriteProtected) :
|
||||
base(name, data, isWriteProtected)
|
||||
{
|
||||
Volume = volume;
|
||||
}
|
||||
|
||||
public override void ReadTrack(int number, int fraction, byte[] buffer)
|
||||
{
|
||||
// TODO
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public override void WriteTrack(int number, int fraction, byte[] buffer)
|
||||
{
|
||||
// TODO
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
private int Volume { get; set; }
|
||||
}
|
||||
}
|
232
Virtu/DiskII.cs
Normal file
232
Virtu/DiskII.cs
Normal file
|
@ -0,0 +1,232 @@
|
|||
using System.Diagnostics.CodeAnalysis;
|
||||
using Jellyfish.Virtu.Services;
|
||||
using Jellyfish.Virtu.Settings;
|
||||
|
||||
namespace Jellyfish.Virtu
|
||||
{
|
||||
public sealed class DiskII : MachineComponent
|
||||
{
|
||||
public DiskII(Machine machine) :
|
||||
base(machine)
|
||||
{
|
||||
}
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
_storageService = Machine.Services.GetService<StorageService>();
|
||||
|
||||
DiskIISettings settings = Machine.Settings.DiskII;
|
||||
if (settings.Disk1.Name.Length == 0)
|
||||
{
|
||||
settings.Disk1.Name = _storageService.GetDiskFile();
|
||||
}
|
||||
if (settings.Disk1.Name.Length > 0)
|
||||
{
|
||||
_drives[0].InsertDisk(settings.Disk1.Name, settings.Disk1.Volume, settings.Disk1.IsWriteProtected);
|
||||
}
|
||||
if (settings.Disk2.Name.Length > 0)
|
||||
{
|
||||
_drives[1].InsertDisk(settings.Disk2.Name, settings.Disk2.Volume, settings.Disk2.IsWriteProtected);
|
||||
}
|
||||
}
|
||||
|
||||
public override void Reset()
|
||||
{
|
||||
_phaseStates = 0;
|
||||
SetMotorOn(false);
|
||||
SetDriveNumber(0);
|
||||
_loadMode = false;
|
||||
_writeMode = false;
|
||||
}
|
||||
|
||||
public override void Uninitialize()
|
||||
{
|
||||
Flush();
|
||||
|
||||
DiskIISettings settings = Machine.Settings.DiskII; // TODO remove; reset filename to prompt on next start
|
||||
settings.Disk1.Name = string.Empty;
|
||||
settings.Disk2.Name = string.Empty;
|
||||
}
|
||||
|
||||
[SuppressMessage("Microsoft.Maintainability", "CA1502:AvoidExcessiveComplexity")]
|
||||
public int Read(int address)
|
||||
{
|
||||
switch (address & 0xF)
|
||||
{
|
||||
case 0x0: case 0x1: case 0x2: case 0x3: case 0x4: case 0x5: case 0x6: case 0x7:
|
||||
SetPhase(address);
|
||||
break;
|
||||
|
||||
case 0x8:
|
||||
SetMotorOn(false);
|
||||
break;
|
||||
|
||||
case 0x9:
|
||||
SetMotorOn(true);
|
||||
break;
|
||||
|
||||
case 0xA:
|
||||
SetDriveNumber(0);
|
||||
break;
|
||||
|
||||
case 0xB:
|
||||
SetDriveNumber(1);
|
||||
break;
|
||||
|
||||
case 0xC:
|
||||
_loadMode = false;
|
||||
if (_motorOn && !_writeMode)
|
||||
{
|
||||
return _latch = _drives[_driveNumber].Read();
|
||||
}
|
||||
break;
|
||||
|
||||
case 0xD:
|
||||
_loadMode = true;
|
||||
if (_motorOn && !_writeMode)
|
||||
{
|
||||
// write protect is forced if phase 1 is on [F9.7]
|
||||
_latch &= 0x7F;
|
||||
if (_drives[_driveNumber].IsWriteProtected ||
|
||||
(_phaseStates & Phase1On) != 0)
|
||||
{
|
||||
_latch |= 0x80;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case 0xE:
|
||||
_writeMode = false;
|
||||
break;
|
||||
|
||||
case 0xF:
|
||||
_writeMode = true;
|
||||
break;
|
||||
}
|
||||
|
||||
if ((address & 1) == 0)
|
||||
{
|
||||
// only even addresses return the latch
|
||||
if (_motorOn)
|
||||
{
|
||||
return _latch;
|
||||
}
|
||||
|
||||
// simple hack to fool DOS SAMESLOT drive spin check (usually at $BD34)
|
||||
_driveSpin = !_driveSpin;
|
||||
return _driveSpin ? 0x7E : 0x7F;
|
||||
}
|
||||
|
||||
return Machine.Video.ReadFloatingBus(); // [5-40]
|
||||
}
|
||||
|
||||
public void Write(int address, int data)
|
||||
{
|
||||
switch (address & 0xF)
|
||||
{
|
||||
case 0x0: case 0x1: case 0x2: case 0x3: case 0x4: case 0x5: case 0x6: case 0x7:
|
||||
SetPhase(address);
|
||||
break;
|
||||
|
||||
case 0x8:
|
||||
SetMotorOn(false);
|
||||
break;
|
||||
|
||||
case 0x9:
|
||||
SetMotorOn(true);
|
||||
break;
|
||||
|
||||
case 0xA:
|
||||
SetDriveNumber(0);
|
||||
break;
|
||||
|
||||
case 0xB:
|
||||
SetDriveNumber(1);
|
||||
break;
|
||||
|
||||
case 0xC:
|
||||
_loadMode = false;
|
||||
|
||||
// write protect is forced if phase 1 is on [F9.7]
|
||||
if ((_phaseStates & Phase1On) != 0)
|
||||
{
|
||||
_drives[_driveNumber].Write(_latch);
|
||||
}
|
||||
break;
|
||||
|
||||
case 0xD:
|
||||
_loadMode = true;
|
||||
break;
|
||||
|
||||
case 0xE:
|
||||
_writeMode = false;
|
||||
break;
|
||||
|
||||
case 0xF:
|
||||
_writeMode = true;
|
||||
break;
|
||||
}
|
||||
|
||||
if (_motorOn && _writeMode)
|
||||
{
|
||||
if (_loadMode)
|
||||
{
|
||||
// any address writes latch for sequencer LD; OE1/2 irrelevant ['323 datasheet]
|
||||
_latch = data;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void Flush()
|
||||
{
|
||||
_drives[_driveNumber].FlushTrack();
|
||||
}
|
||||
|
||||
private void SetDriveNumber(int driveNumber)
|
||||
{
|
||||
if (_driveNumber != driveNumber)
|
||||
{
|
||||
Flush();
|
||||
_driveNumber = driveNumber;
|
||||
}
|
||||
}
|
||||
|
||||
private void SetMotorOn(bool state)
|
||||
{
|
||||
if (_motorOn && !state)
|
||||
{
|
||||
Flush();
|
||||
}
|
||||
_motorOn = state;
|
||||
}
|
||||
|
||||
private void SetPhase(int address)
|
||||
{
|
||||
int phase = (address >> 1) & 0x3;
|
||||
int state = address & 1;
|
||||
_phaseStates &= ~(1 << phase);
|
||||
_phaseStates |= (state << phase);
|
||||
|
||||
if (_motorOn)
|
||||
{
|
||||
_drives[_driveNumber].ApplyPhaseChange(_phaseStates);
|
||||
}
|
||||
}
|
||||
|
||||
private const int Phase0On = 1 << 0;
|
||||
private const int Phase1On = 1 << 1;
|
||||
private const int Phase2On = 1 << 2;
|
||||
private const int Phase3On = 1 << 3;
|
||||
|
||||
private StorageService _storageService;
|
||||
|
||||
private Drive525[] _drives = new Drive525[] { new Drive525(), new Drive525() };
|
||||
private int _latch;
|
||||
private int _phaseStates;
|
||||
private bool _motorOn;
|
||||
private int _driveNumber;
|
||||
private bool _loadMode;
|
||||
private bool _writeMode;
|
||||
private bool _driveSpin;
|
||||
}
|
||||
}
|
23
Virtu/DiskNib.cs
Normal file
23
Virtu/DiskNib.cs
Normal file
|
@ -0,0 +1,23 @@
|
|||
using System;
|
||||
|
||||
namespace Jellyfish.Virtu
|
||||
{
|
||||
public sealed class DiskNib : Disk525
|
||||
{
|
||||
public DiskNib(string name, byte[] data, bool isWriteProtected) :
|
||||
base(name, data, isWriteProtected)
|
||||
{
|
||||
}
|
||||
|
||||
public override void ReadTrack(int number, int fraction, byte[] buffer)
|
||||
{
|
||||
Buffer.BlockCopy(Data, (number / 2) * TrackSize, buffer, 0, TrackSize);
|
||||
}
|
||||
|
||||
public override void WriteTrack(int number, int fraction, byte[] buffer)
|
||||
{
|
||||
// TODO
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
}
|
108
Virtu/Drive525.cs
Normal file
108
Virtu/Drive525.cs
Normal file
|
@ -0,0 +1,108 @@
|
|||
using System;
|
||||
using Jellyfish.Library;
|
||||
|
||||
namespace Jellyfish.Virtu
|
||||
{
|
||||
public class Drive525
|
||||
{
|
||||
public Drive525()
|
||||
{
|
||||
DriveArmStepDelta[0] = new int[] { 0, 0, 1, 1, 0, 0, 1, 1, -1, -1, 0, 0, -1, -1, 0, 0 }; // phase 0
|
||||
DriveArmStepDelta[1] = new int[] { 0, -1, 0, -1, 1, 0, 1, 0, 0, -1, 0, -1, 1, 0, 1, 0 }; // phase 1
|
||||
DriveArmStepDelta[2] = new int[] { 0, 0, -1, -1, 0, 0, -1, -1, 1, 1, 0, 0, 1, 1, 0, 0 }; // phase 2
|
||||
DriveArmStepDelta[3] = new int[] { 0, 1, 0, 1, -1, 0, -1, 0, 0, 1, 0, 1, -1, 0, -1, 0 }; // phase 3
|
||||
}
|
||||
|
||||
public void FlushTrack()
|
||||
{
|
||||
if (_trackChanged)
|
||||
{
|
||||
// TODO
|
||||
_trackChanged = false;
|
||||
}
|
||||
}
|
||||
|
||||
public void InsertDisk(string fileName, int volume, bool isWriteProtected)
|
||||
{
|
||||
FlushTrack();
|
||||
|
||||
// TODO handle null param/empty string for eject, or add Eject()
|
||||
|
||||
byte[] fileData = FileHelpers.ReadAllBytes(fileName);
|
||||
_disk = Disk525.CreateDisk(fileName, fileData, volume, isWriteProtected);
|
||||
_trackLoaded = false;
|
||||
}
|
||||
|
||||
public void ApplyPhaseChange(int phaseState)
|
||||
{
|
||||
// step the drive head according to stepper magnet changes
|
||||
int delta = DriveArmStepDelta[_trackNumber & 0x3][phaseState];
|
||||
if (delta != 0)
|
||||
{
|
||||
int newTrackNumber = MathHelpers.Clamp(_trackNumber + delta, 0, TrackNumberMax);
|
||||
if (newTrackNumber != _trackNumber)
|
||||
{
|
||||
_trackNumber = newTrackNumber;
|
||||
_trackOffset = 0;
|
||||
_trackLoaded = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public int Read()
|
||||
{
|
||||
if (LoadTrack())
|
||||
{
|
||||
int data = _trackData[_trackOffset++];
|
||||
if (_trackOffset >= Disk525.TrackSize)
|
||||
{
|
||||
_trackOffset = 0;
|
||||
}
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
return _random.Next(0x01, 0xFF);
|
||||
}
|
||||
|
||||
public void Write(int data)
|
||||
{
|
||||
if (LoadTrack())
|
||||
{
|
||||
_trackData[_trackOffset++] = (byte)data;
|
||||
if (_trackOffset >= Disk525.TrackSize)
|
||||
{
|
||||
_trackOffset = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private bool LoadTrack()
|
||||
{
|
||||
if (!_trackLoaded && (_disk != null))
|
||||
{
|
||||
_disk.ReadTrack(_trackNumber, 0, _trackData);
|
||||
_trackLoaded = true;
|
||||
}
|
||||
|
||||
return _trackLoaded;
|
||||
}
|
||||
|
||||
public bool IsWriteProtected { get { return _disk.IsWriteProtected; } }
|
||||
|
||||
private const int TrackNumberMax = 0x44;
|
||||
|
||||
private const int PhaseCount = 4;
|
||||
|
||||
private readonly int[][] DriveArmStepDelta = new int[PhaseCount][];
|
||||
|
||||
private Disk525 _disk;
|
||||
private bool _trackLoaded;
|
||||
private bool _trackChanged;
|
||||
private int _trackNumber;
|
||||
private int _trackOffset;
|
||||
private byte[] _trackData = new byte[Disk525.TrackSize];
|
||||
|
||||
private Random _random = new Random();
|
||||
}
|
||||
}
|
159
Virtu/GamePort.cs
Normal file
159
Virtu/GamePort.cs
Normal file
|
@ -0,0 +1,159 @@
|
|||
using System;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using Jellyfish.Library;
|
||||
using Jellyfish.Virtu.Properties;
|
||||
using Jellyfish.Virtu.Services;
|
||||
using Jellyfish.Virtu.Settings;
|
||||
|
||||
namespace Jellyfish.Virtu
|
||||
{
|
||||
public sealed class GamePort : MachineComponent
|
||||
{
|
||||
public GamePort(Machine machine) :
|
||||
base(machine)
|
||||
{
|
||||
_resetPaddle0StrobeEvent = ResetPaddle0StrobeEvent; // cache delegates; avoids garbage
|
||||
_resetPaddle1StrobeEvent = ResetPaddle1StrobeEvent;
|
||||
_resetPaddle2StrobeEvent = ResetPaddle2StrobeEvent;
|
||||
_resetPaddle3StrobeEvent = ResetPaddle3StrobeEvent;
|
||||
}
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
_keyboardService = Machine.Services.GetService<KeyboardService>();
|
||||
_gamePortService = Machine.Services.GetService<GamePortService>();
|
||||
}
|
||||
|
||||
public bool ReadButton0()
|
||||
{
|
||||
GamePortSettings settings = Machine.Settings.GamePort;
|
||||
|
||||
return (_gamePortService.IsButton0Down || _keyboardService.IsOpenAppleKeyDown ||
|
||||
(settings.UseKeyboard && (settings.Key.Button0 > 0) && _keyboardService.IsKeyDown(settings.Key.Button0)));
|
||||
}
|
||||
|
||||
public bool ReadButton1()
|
||||
{
|
||||
GamePortSettings settings = Machine.Settings.GamePort;
|
||||
|
||||
return (_gamePortService.IsButton1Down || _keyboardService.IsCloseAppleKeyDown ||
|
||||
(settings.UseKeyboard && (settings.Key.Button1 > 0) && _keyboardService.IsKeyDown(settings.Key.Button1)));
|
||||
}
|
||||
|
||||
public bool ReadButton2()
|
||||
{
|
||||
GamePortSettings settings = Machine.Settings.GamePort;
|
||||
|
||||
return (_gamePortService.IsButton2Down ||
|
||||
(settings.UseKeyboard && (settings.Key.Button2 > 0) && _keyboardService.IsKeyDown(settings.Key.Button2)));
|
||||
}
|
||||
|
||||
[SuppressMessage("Microsoft.Maintainability", "CA1502:AvoidExcessiveComplexity")]
|
||||
public void TriggerTimers()
|
||||
{
|
||||
int paddle0 = _gamePortService.Paddle0;
|
||||
int paddle1 = _gamePortService.Paddle1;
|
||||
int paddle2 = _gamePortService.Paddle2;
|
||||
int paddle3 = _gamePortService.Paddle3;
|
||||
|
||||
GamePortSettings settings = Machine.Settings.GamePort;
|
||||
|
||||
if (settings.UseKeyboard) // override
|
||||
{
|
||||
if (((settings.Key.Joystick0.UpLeft > 0) && _keyboardService.IsKeyDown(settings.Key.Joystick0.UpLeft)) ||
|
||||
((settings.Key.Joystick0.Left > 0) && _keyboardService.IsKeyDown(settings.Key.Joystick0.Left)) ||
|
||||
((settings.Key.Joystick0.DownLeft > 0) && _keyboardService.IsKeyDown(settings.Key.Joystick0.DownLeft)))
|
||||
{
|
||||
paddle0 -= 128;
|
||||
}
|
||||
if (((settings.Key.Joystick0.UpRight > 0) && _keyboardService.IsKeyDown(settings.Key.Joystick0.UpRight)) ||
|
||||
((settings.Key.Joystick0.Right > 0) && _keyboardService.IsKeyDown(settings.Key.Joystick0.Right)) ||
|
||||
((settings.Key.Joystick0.DownRight > 0) && _keyboardService.IsKeyDown(settings.Key.Joystick0.DownRight)))
|
||||
{
|
||||
paddle0 += 128;
|
||||
}
|
||||
if (((settings.Key.Joystick0.UpLeft > 0) && _keyboardService.IsKeyDown(settings.Key.Joystick0.UpLeft)) ||
|
||||
((settings.Key.Joystick0.Up > 0) && _keyboardService.IsKeyDown(settings.Key.Joystick0.Up)) ||
|
||||
((settings.Key.Joystick0.UpRight > 0) && _keyboardService.IsKeyDown(settings.Key.Joystick0.UpRight)))
|
||||
{
|
||||
paddle1 -= 128;
|
||||
}
|
||||
if (((settings.Key.Joystick0.DownLeft > 0) && _keyboardService.IsKeyDown(settings.Key.Joystick0.DownLeft)) ||
|
||||
((settings.Key.Joystick0.Down > 0) && _keyboardService.IsKeyDown(settings.Key.Joystick0.Down)) ||
|
||||
((settings.Key.Joystick0.DownRight > 0) && _keyboardService.IsKeyDown(settings.Key.Joystick0.DownRight)))
|
||||
{
|
||||
paddle1 += 128;
|
||||
}
|
||||
if (((settings.Key.Joystick1.UpLeft > 0) && _keyboardService.IsKeyDown(settings.Key.Joystick1.UpLeft)) ||
|
||||
((settings.Key.Joystick1.Left > 0) && _keyboardService.IsKeyDown(settings.Key.Joystick1.Left)) ||
|
||||
((settings.Key.Joystick1.DownLeft > 0) && _keyboardService.IsKeyDown(settings.Key.Joystick1.DownLeft)))
|
||||
{
|
||||
paddle2 -= 128;
|
||||
}
|
||||
if (((settings.Key.Joystick1.UpRight > 0) && _keyboardService.IsKeyDown(settings.Key.Joystick1.UpRight)) ||
|
||||
((settings.Key.Joystick1.Right > 0) && _keyboardService.IsKeyDown(settings.Key.Joystick1.Right)) ||
|
||||
((settings.Key.Joystick1.DownRight > 0) && _keyboardService.IsKeyDown(settings.Key.Joystick1.DownRight)))
|
||||
{
|
||||
paddle2 += 128;
|
||||
}
|
||||
if (((settings.Key.Joystick1.UpLeft > 0) && _keyboardService.IsKeyDown(settings.Key.Joystick1.UpLeft)) ||
|
||||
((settings.Key.Joystick1.Up > 0) && _keyboardService.IsKeyDown(settings.Key.Joystick1.Up)) ||
|
||||
((settings.Key.Joystick1.UpRight > 0) && _keyboardService.IsKeyDown(settings.Key.Joystick1.UpRight)))
|
||||
{
|
||||
paddle3 -= 128;
|
||||
}
|
||||
if (((settings.Key.Joystick1.DownLeft > 0) && _keyboardService.IsKeyDown(settings.Key.Joystick1.DownLeft)) ||
|
||||
((settings.Key.Joystick1.Down > 0) && _keyboardService.IsKeyDown(settings.Key.Joystick1.Down)) ||
|
||||
((settings.Key.Joystick1.DownRight > 0) && _keyboardService.IsKeyDown(settings.Key.Joystick1.DownRight)))
|
||||
{
|
||||
paddle3 += 128;
|
||||
}
|
||||
}
|
||||
|
||||
Paddle0Strobe = true;
|
||||
Paddle1Strobe = true;
|
||||
Paddle2Strobe = true;
|
||||
Paddle3Strobe = true;
|
||||
|
||||
Machine.Events.AddEvent(MathHelpers.ClampByte(paddle0) * CyclesPerValue, _resetPaddle0StrobeEvent); // [7-29]
|
||||
Machine.Events.AddEvent(MathHelpers.ClampByte(paddle1) * CyclesPerValue, _resetPaddle1StrobeEvent);
|
||||
Machine.Events.AddEvent(MathHelpers.ClampByte(paddle2) * CyclesPerValue, _resetPaddle2StrobeEvent);
|
||||
Machine.Events.AddEvent(MathHelpers.ClampByte(paddle3) * CyclesPerValue, _resetPaddle3StrobeEvent);
|
||||
}
|
||||
|
||||
private void ResetPaddle0StrobeEvent()
|
||||
{
|
||||
Paddle0Strobe = false;
|
||||
}
|
||||
|
||||
private void ResetPaddle1StrobeEvent()
|
||||
{
|
||||
Paddle1Strobe = false;
|
||||
}
|
||||
|
||||
private void ResetPaddle2StrobeEvent()
|
||||
{
|
||||
Paddle2Strobe = false;
|
||||
}
|
||||
|
||||
private void ResetPaddle3StrobeEvent()
|
||||
{
|
||||
Paddle3Strobe = false;
|
||||
}
|
||||
|
||||
public bool Paddle0Strobe { get; private set; }
|
||||
public bool Paddle1Strobe { get; private set; }
|
||||
public bool Paddle2Strobe { get; private set; }
|
||||
public bool Paddle3Strobe { get; private set; }
|
||||
|
||||
private const int CyclesPerValue = 11;
|
||||
|
||||
private Action _resetPaddle0StrobeEvent;
|
||||
private Action _resetPaddle1StrobeEvent;
|
||||
private Action _resetPaddle2StrobeEvent;
|
||||
private Action _resetPaddle3StrobeEvent;
|
||||
|
||||
private KeyboardService _keyboardService;
|
||||
private GamePortService _gamePortService;
|
||||
}
|
||||
}
|
185
Virtu/Jellyfish.Virtu.FxCop
Normal file
185
Virtu/Jellyfish.Virtu.FxCop
Normal file
|
@ -0,0 +1,185 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<FxCopProject Version="1.36" Name="My FxCop Project">
|
||||
<ProjectOptions>
|
||||
<SharedProject>True</SharedProject>
|
||||
<Stylesheet Apply="False">c:\program files\microsoft fxcop 1.36\Xml\FxCopReport.xsl</Stylesheet>
|
||||
<SaveMessages>
|
||||
<Project Status="Active, Excluded" NewOnly="False" />
|
||||
<Report Status="Active" NewOnly="False" />
|
||||
</SaveMessages>
|
||||
<ProjectFile Compress="True" DefaultTargetCheck="True" DefaultRuleCheck="True" SaveByRuleGroup="" Deterministic="True" />
|
||||
<EnableMultithreadedLoad>True</EnableMultithreadedLoad>
|
||||
<EnableMultithreadedAnalysis>True</EnableMultithreadedAnalysis>
|
||||
<SourceLookup>True</SourceLookup>
|
||||
<AnalysisExceptionsThreshold>10</AnalysisExceptionsThreshold>
|
||||
<RuleExceptionsThreshold>1</RuleExceptionsThreshold>
|
||||
<Spelling Locale="en-US" />
|
||||
<OverrideRuleVisibilities>False</OverrideRuleVisibilities>
|
||||
<CustomDictionaries SearchFxCopDir="True" SearchUserProfile="True" SearchProjectDir="True" />
|
||||
<SearchGlobalAssemblyCache>True</SearchGlobalAssemblyCache>
|
||||
<DeadlockDetectionTimeout>120</DeadlockDetectionTimeout>
|
||||
<IgnoreGeneratedCode>True</IgnoreGeneratedCode>
|
||||
<TargetFrameworkVersion>3.5</TargetFrameworkVersion>
|
||||
</ProjectOptions>
|
||||
<Targets>
|
||||
<Target Name="$(ProjectDir)/Wpf/bin/Jellyfish.Virtu.exe" Analyze="True" AnalyzeAllChildren="True" />
|
||||
<Target Name="$(ProjectDir)/Xna/bin/Jellyfish.Virtu.exe" Analyze="True" AnalyzeAllChildren="True" />
|
||||
</Targets>
|
||||
<Rules>
|
||||
<RuleFiles>
|
||||
<RuleFile Name="$(FxCopDir)\Rules\DesignRules.dll" Enabled="True" AllRulesEnabled="True" />
|
||||
<RuleFile Name="$(FxCopDir)\Rules\GlobalizationRules.dll" Enabled="True" AllRulesEnabled="True" />
|
||||
<RuleFile Name="$(FxCopDir)\Rules\InteroperabilityRules.dll" Enabled="True" AllRulesEnabled="True" />
|
||||
<RuleFile Name="$(FxCopDir)\Rules\MobilityRules.dll" Enabled="True" AllRulesEnabled="True" />
|
||||
<RuleFile Name="$(FxCopDir)\Rules\NamingRules.dll" Enabled="True" AllRulesEnabled="True" />
|
||||
<RuleFile Name="$(FxCopDir)\Rules\PerformanceRules.dll" Enabled="True" AllRulesEnabled="True" />
|
||||
<RuleFile Name="$(FxCopDir)\Rules\PortabilityRules.dll" Enabled="True" AllRulesEnabled="True" />
|
||||
<RuleFile Name="$(FxCopDir)\Rules\SecurityRules.dll" Enabled="True" AllRulesEnabled="True" />
|
||||
<RuleFile Name="$(FxCopDir)\Rules\UsageRules.dll" Enabled="True" AllRulesEnabled="True" />
|
||||
</RuleFiles>
|
||||
<Groups />
|
||||
<Settings />
|
||||
</Rules>
|
||||
<FxCopReport Version="1.36">
|
||||
<Targets>
|
||||
<Target Name="$(ProjectDir)/Xna/bin/Jellyfish.Virtu.exe">
|
||||
<Modules>
|
||||
<Module Name="jellyfish.virtu.exe">
|
||||
<Namespaces>
|
||||
<Namespace Name="Jellyfish.Virtu">
|
||||
<Types>
|
||||
<Type Name="Disk525">
|
||||
<Messages>
|
||||
<Message TypeName="AbstractTypesShouldNotHaveConstructors" Category="Microsoft.Design" CheckId="CA1012" Created="2009-04-13 00:02:55Z">
|
||||
<Issue>
|
||||
<Item>'Disk525'</Item>
|
||||
</Issue>
|
||||
</Message>
|
||||
</Messages>
|
||||
<Members>
|
||||
<Member Name="#.ctor(System.String,System.Byte[])">
|
||||
<Messages>
|
||||
<Message Id="fileData" TypeName="ReviewUnusedParameters" Category="Microsoft.Usage" CheckId="CA1801" Created="2009-04-13 00:02:55Z" FixCategory="DependsOnFix">
|
||||
<Issue>
|
||||
<Item>'fileData'</Item>
|
||||
<Item>'Disk525.Disk525(string, byte[])'</Item>
|
||||
</Issue>
|
||||
</Message>
|
||||
<Message Id="fileName" TypeName="ReviewUnusedParameters" Category="Microsoft.Usage" CheckId="CA1801" Created="2009-04-13 00:02:55Z" FixCategory="DependsOnFix">
|
||||
<Issue>
|
||||
<Item>'fileName'</Item>
|
||||
<Item>'Disk525.Disk525(string, byte[])'</Item>
|
||||
</Issue>
|
||||
</Message>
|
||||
</Messages>
|
||||
</Member>
|
||||
</Members>
|
||||
</Type>
|
||||
<Type Name="DiskII">
|
||||
<Members>
|
||||
<Member Name="#_writeModeOn">
|
||||
<Messages>
|
||||
<Message TypeName="AvoidUnusedPrivateFields" Category="Microsoft.Performance" CheckId="CA1823" Created="2009-04-13 00:02:55Z">
|
||||
<Issue>
|
||||
<Item>'DiskII._writeModeOn'</Item>
|
||||
</Issue>
|
||||
</Message>
|
||||
</Messages>
|
||||
</Member>
|
||||
<Member Name="#Write(System.Int32,System.Int32)">
|
||||
<Messages>
|
||||
<Message TypeName="MarkMembersAsStatic" Category="Microsoft.Performance" CheckId="CA1822" Created="2009-04-13 00:02:55Z" FixCategory="DependsOnFix">
|
||||
<Issue>
|
||||
<Item>'DiskII.Write(int, int)'</Item>
|
||||
</Issue>
|
||||
</Message>
|
||||
<Message Id="address" TypeName="ReviewUnusedParameters" Category="Microsoft.Usage" CheckId="CA1801" Created="2009-04-13 00:02:55Z" FixCategory="DependsOnFix">
|
||||
<Issue>
|
||||
<Item>'address'</Item>
|
||||
<Item>'DiskII.Write(int, int)'</Item>
|
||||
</Issue>
|
||||
</Message>
|
||||
<Message Id="data" TypeName="ReviewUnusedParameters" Category="Microsoft.Usage" CheckId="CA1801" Created="2009-04-13 00:02:55Z" FixCategory="DependsOnFix">
|
||||
<Issue>
|
||||
<Item>'data'</Item>
|
||||
<Item>'DiskII.Write(int, int)'</Item>
|
||||
</Issue>
|
||||
</Message>
|
||||
</Messages>
|
||||
</Member>
|
||||
</Members>
|
||||
</Type>
|
||||
<Type Name="Drive525">
|
||||
<Members>
|
||||
<Member Name="#driveArmStepDelta">
|
||||
<Messages>
|
||||
<Message Id="Member" TypeName="PreferJaggedArraysOverMultidimensional" Category="Microsoft.Performance" CheckId="CA1814" Created="2009-04-13 00:02:55Z">
|
||||
<Issue>
|
||||
<Item>'Drive525.driveArmStepDelta'</Item>
|
||||
</Issue>
|
||||
</Message>
|
||||
</Messages>
|
||||
</Member>
|
||||
<Member Name="#Reset()">
|
||||
<Messages>
|
||||
<Message TypeName="MarkMembersAsStatic" Category="Microsoft.Performance" CheckId="CA1822" Created="2009-04-13 00:02:55Z" FixCategory="DependsOnFix">
|
||||
<Issue>
|
||||
<Item>'Drive525.Reset()'</Item>
|
||||
</Issue>
|
||||
</Message>
|
||||
</Messages>
|
||||
</Member>
|
||||
</Members>
|
||||
</Type>
|
||||
<Type Name="Speaker">
|
||||
<Members>
|
||||
<Member Name="#ToggleOutput()">
|
||||
<Messages>
|
||||
<Message TypeName="MarkMembersAsStatic" Category="Microsoft.Performance" CheckId="CA1822" Created="2009-04-13 00:02:55Z" FixCategory="DependsOnFix">
|
||||
<Issue>
|
||||
<Item>'Speaker.ToggleOutput()'</Item>
|
||||
</Issue>
|
||||
</Message>
|
||||
</Messages>
|
||||
</Member>
|
||||
</Members>
|
||||
</Type>
|
||||
<Type Name="Video">
|
||||
<Members>
|
||||
<Member Name="#ReadFloatingBus()">
|
||||
<Messages>
|
||||
<Message TypeName="MarkMembersAsStatic" Category="Microsoft.Performance" CheckId="CA1822" Created="2009-04-13 00:02:55Z" FixCategory="DependsOnFix">
|
||||
<Issue>
|
||||
<Item>'Video.ReadFloatingBus()'</Item>
|
||||
</Issue>
|
||||
</Message>
|
||||
</Messages>
|
||||
</Member>
|
||||
</Members>
|
||||
</Type>
|
||||
</Types>
|
||||
</Namespace>
|
||||
</Namespaces>
|
||||
</Module>
|
||||
</Modules>
|
||||
</Target>
|
||||
</Targets>
|
||||
<Rules>
|
||||
<Rule TypeName="AbstractTypesShouldNotHaveConstructors" Category="Microsoft.Design" CheckId="CA1012">
|
||||
<Resolution Name="Default">Change the accessibility of all public constructors in {0} to protected.</Resolution>
|
||||
</Rule>
|
||||
<Rule TypeName="AvoidUnusedPrivateFields" Category="Microsoft.Performance" CheckId="CA1823">
|
||||
<Resolution Name="Default">It appears that field {0} is never used or is only ever assigned to. Use this field or remove it.</Resolution>
|
||||
</Rule>
|
||||
<Rule TypeName="MarkMembersAsStatic" Category="Microsoft.Performance" CheckId="CA1822">
|
||||
<Resolution Name="Default">The 'this' parameter (or 'Me' in Visual Basic) of {0} is never used. Mark the member as static (or Shared in Visual Basic) or use 'this'/'Me' in the method body or at least one property accessor, if appropriate.</Resolution>
|
||||
</Rule>
|
||||
<Rule TypeName="PreferJaggedArraysOverMultidimensional" Category="Microsoft.Performance" CheckId="CA1814">
|
||||
<Resolution Name="Default">{0} is a multidimensional array. Replace it with a jagged array if possible.</Resolution>
|
||||
</Rule>
|
||||
<Rule TypeName="ReviewUnusedParameters" Category="Microsoft.Usage" CheckId="CA1801">
|
||||
<Resolution Name="Default">Parameter {0} of {1} is never used. Remove the parameter or use it in the method body.</Resolution>
|
||||
</Rule>
|
||||
</Rules>
|
||||
</FxCopReport>
|
||||
</FxCopProject>
|
148
Virtu/Jellyfish.Virtu.sln
Normal file
148
Virtu/Jellyfish.Virtu.sln
Normal file
|
@ -0,0 +1,148 @@
|
|||
|
||||
Microsoft Visual Studio Solution File, Format Version 10.00
|
||||
# Visual Studio 2008
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Jellyfish.Virtu.Silverlight", "Silverlight\Jellyfish.Virtu.Silverlight.csproj", "{5AA9C39E-DB55-4AD9-92EB-E8951D5AD680}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Jellyfish.Virtu.Wpf", "Wpf\Jellyfish.Virtu.Wpf.csproj", "{D59B29AC-1105-410D-A88D-61E9C98B0C4B}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Jellyfish.Virtu.Xna", "Xna\Jellyfish.Virtu.Xna.csproj", "{F72C1068-E6F3-4A6C-A404-F88626B43B7C}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Jellyfish.Virtu.Xna.Xbox", "Xna\Jellyfish.Virtu.Xna.Xbox.csproj", "{1D3618DE-F050-4350-826E-5E84BC62DEE3}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Jellyfish.Library.Silverlight", "..\Library\Silverlight\Jellyfish.Library.Silverlight.csproj", "{DAB11A70-D08B-4A96-8A54-E81B1DE39681}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Jellyfish.Library.Wpf", "..\Library\Wpf\Jellyfish.Library.Wpf.csproj", "{D47A24A9-1590-4E8A-A406-BC66D5891BFA}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Jellyfish.Library.Xna", "..\Library\Xna\Jellyfish.Library.Xna.csproj", "{E246958B-EAD8-48E9-844B-54718C952869}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Jellyfish.Library.Xna.Xbox", "..\Library\Xna\Jellyfish.Library.Xna.Xbox.csproj", "{6EE9A3C2-0BD8-480D-AED2-6A5A9EBF7AFA}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Debug|Mixed Platforms = Debug|Mixed Platforms
|
||||
Debug|x86 = Debug|x86
|
||||
Debug|Xbox 360 = Debug|Xbox 360
|
||||
Release|Any CPU = Release|Any CPU
|
||||
Release|Mixed Platforms = Release|Mixed Platforms
|
||||
Release|x86 = Release|x86
|
||||
Release|Xbox 360 = Release|Xbox 360
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{5AA9C39E-DB55-4AD9-92EB-E8951D5AD680}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{5AA9C39E-DB55-4AD9-92EB-E8951D5AD680}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{5AA9C39E-DB55-4AD9-92EB-E8951D5AD680}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
|
||||
{5AA9C39E-DB55-4AD9-92EB-E8951D5AD680}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
|
||||
{5AA9C39E-DB55-4AD9-92EB-E8951D5AD680}.Debug|x86.ActiveCfg = Debug|Any CPU
|
||||
{5AA9C39E-DB55-4AD9-92EB-E8951D5AD680}.Debug|Xbox 360.ActiveCfg = Debug|Any CPU
|
||||
{5AA9C39E-DB55-4AD9-92EB-E8951D5AD680}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{5AA9C39E-DB55-4AD9-92EB-E8951D5AD680}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{5AA9C39E-DB55-4AD9-92EB-E8951D5AD680}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
|
||||
{5AA9C39E-DB55-4AD9-92EB-E8951D5AD680}.Release|Mixed Platforms.Build.0 = Release|Any CPU
|
||||
{5AA9C39E-DB55-4AD9-92EB-E8951D5AD680}.Release|x86.ActiveCfg = Release|Any CPU
|
||||
{5AA9C39E-DB55-4AD9-92EB-E8951D5AD680}.Release|Xbox 360.ActiveCfg = Release|Any CPU
|
||||
{D59B29AC-1105-410D-A88D-61E9C98B0C4B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{D59B29AC-1105-410D-A88D-61E9C98B0C4B}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{D59B29AC-1105-410D-A88D-61E9C98B0C4B}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
|
||||
{D59B29AC-1105-410D-A88D-61E9C98B0C4B}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
|
||||
{D59B29AC-1105-410D-A88D-61E9C98B0C4B}.Debug|x86.ActiveCfg = Debug|Any CPU
|
||||
{D59B29AC-1105-410D-A88D-61E9C98B0C4B}.Debug|Xbox 360.ActiveCfg = Debug|Any CPU
|
||||
{D59B29AC-1105-410D-A88D-61E9C98B0C4B}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{D59B29AC-1105-410D-A88D-61E9C98B0C4B}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{D59B29AC-1105-410D-A88D-61E9C98B0C4B}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
|
||||
{D59B29AC-1105-410D-A88D-61E9C98B0C4B}.Release|Mixed Platforms.Build.0 = Release|Any CPU
|
||||
{D59B29AC-1105-410D-A88D-61E9C98B0C4B}.Release|x86.ActiveCfg = Release|Any CPU
|
||||
{D59B29AC-1105-410D-A88D-61E9C98B0C4B}.Release|Xbox 360.ActiveCfg = Release|Any CPU
|
||||
{F72C1068-E6F3-4A6C-A404-F88626B43B7C}.Debug|Any CPU.ActiveCfg = Debug|x86
|
||||
{F72C1068-E6F3-4A6C-A404-F88626B43B7C}.Debug|Mixed Platforms.ActiveCfg = Debug|x86
|
||||
{F72C1068-E6F3-4A6C-A404-F88626B43B7C}.Debug|Mixed Platforms.Build.0 = Debug|x86
|
||||
{F72C1068-E6F3-4A6C-A404-F88626B43B7C}.Debug|x86.ActiveCfg = Debug|x86
|
||||
{F72C1068-E6F3-4A6C-A404-F88626B43B7C}.Debug|x86.Build.0 = Debug|x86
|
||||
{F72C1068-E6F3-4A6C-A404-F88626B43B7C}.Debug|Xbox 360.ActiveCfg = Debug|x86
|
||||
{F72C1068-E6F3-4A6C-A404-F88626B43B7C}.Release|Any CPU.ActiveCfg = Release|x86
|
||||
{F72C1068-E6F3-4A6C-A404-F88626B43B7C}.Release|Mixed Platforms.ActiveCfg = Release|x86
|
||||
{F72C1068-E6F3-4A6C-A404-F88626B43B7C}.Release|Mixed Platforms.Build.0 = Release|x86
|
||||
{F72C1068-E6F3-4A6C-A404-F88626B43B7C}.Release|x86.ActiveCfg = Release|x86
|
||||
{F72C1068-E6F3-4A6C-A404-F88626B43B7C}.Release|x86.Build.0 = Release|x86
|
||||
{F72C1068-E6F3-4A6C-A404-F88626B43B7C}.Release|Xbox 360.ActiveCfg = Release|x86
|
||||
{1D3618DE-F050-4350-826E-5E84BC62DEE3}.Debug|Any CPU.ActiveCfg = Debug|Xbox 360
|
||||
{1D3618DE-F050-4350-826E-5E84BC62DEE3}.Debug|Mixed Platforms.ActiveCfg = Debug|Xbox 360
|
||||
{1D3618DE-F050-4350-826E-5E84BC62DEE3}.Debug|Mixed Platforms.Build.0 = Debug|Xbox 360
|
||||
{1D3618DE-F050-4350-826E-5E84BC62DEE3}.Debug|x86.ActiveCfg = Debug|Xbox 360
|
||||
{1D3618DE-F050-4350-826E-5E84BC62DEE3}.Debug|Xbox 360.ActiveCfg = Debug|Xbox 360
|
||||
{1D3618DE-F050-4350-826E-5E84BC62DEE3}.Debug|Xbox 360.Build.0 = Debug|Xbox 360
|
||||
{1D3618DE-F050-4350-826E-5E84BC62DEE3}.Release|Any CPU.ActiveCfg = Release|Xbox 360
|
||||
{1D3618DE-F050-4350-826E-5E84BC62DEE3}.Release|Mixed Platforms.ActiveCfg = Release|Xbox 360
|
||||
{1D3618DE-F050-4350-826E-5E84BC62DEE3}.Release|Mixed Platforms.Build.0 = Release|Xbox 360
|
||||
{1D3618DE-F050-4350-826E-5E84BC62DEE3}.Release|x86.ActiveCfg = Release|Xbox 360
|
||||
{1D3618DE-F050-4350-826E-5E84BC62DEE3}.Release|Xbox 360.ActiveCfg = Release|Xbox 360
|
||||
{1D3618DE-F050-4350-826E-5E84BC62DEE3}.Release|Xbox 360.Build.0 = Release|Xbox 360
|
||||
{BFE4FBB9-2855-4A2B-9067-A82419579A7D}.Debug|Any CPU.ActiveCfg = Debug|x86
|
||||
{BFE4FBB9-2855-4A2B-9067-A82419579A7D}.Debug|Mixed Platforms.ActiveCfg = Debug|x86
|
||||
{BFE4FBB9-2855-4A2B-9067-A82419579A7D}.Debug|x86.ActiveCfg = Debug|x86
|
||||
{BFE4FBB9-2855-4A2B-9067-A82419579A7D}.Debug|Xbox 360.ActiveCfg = Debug|x86
|
||||
{BFE4FBB9-2855-4A2B-9067-A82419579A7D}.Release|Any CPU.ActiveCfg = Release|x86
|
||||
{BFE4FBB9-2855-4A2B-9067-A82419579A7D}.Release|Mixed Platforms.ActiveCfg = Release|x86
|
||||
{BFE4FBB9-2855-4A2B-9067-A82419579A7D}.Release|x86.ActiveCfg = Release|x86
|
||||
{BFE4FBB9-2855-4A2B-9067-A82419579A7D}.Release|Xbox 360.ActiveCfg = Release|x86
|
||||
{DAB11A70-D08B-4A96-8A54-E81B1DE39681}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{DAB11A70-D08B-4A96-8A54-E81B1DE39681}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{DAB11A70-D08B-4A96-8A54-E81B1DE39681}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
|
||||
{DAB11A70-D08B-4A96-8A54-E81B1DE39681}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
|
||||
{DAB11A70-D08B-4A96-8A54-E81B1DE39681}.Debug|x86.ActiveCfg = Debug|Any CPU
|
||||
{DAB11A70-D08B-4A96-8A54-E81B1DE39681}.Debug|Xbox 360.ActiveCfg = Debug|Any CPU
|
||||
{DAB11A70-D08B-4A96-8A54-E81B1DE39681}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{DAB11A70-D08B-4A96-8A54-E81B1DE39681}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{DAB11A70-D08B-4A96-8A54-E81B1DE39681}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
|
||||
{DAB11A70-D08B-4A96-8A54-E81B1DE39681}.Release|Mixed Platforms.Build.0 = Release|Any CPU
|
||||
{DAB11A70-D08B-4A96-8A54-E81B1DE39681}.Release|x86.ActiveCfg = Release|Any CPU
|
||||
{DAB11A70-D08B-4A96-8A54-E81B1DE39681}.Release|Xbox 360.ActiveCfg = Release|Any CPU
|
||||
{D47A24A9-1590-4E8A-A406-BC66D5891BFA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{D47A24A9-1590-4E8A-A406-BC66D5891BFA}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{D47A24A9-1590-4E8A-A406-BC66D5891BFA}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
|
||||
{D47A24A9-1590-4E8A-A406-BC66D5891BFA}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
|
||||
{D47A24A9-1590-4E8A-A406-BC66D5891BFA}.Debug|x86.ActiveCfg = Debug|Any CPU
|
||||
{D47A24A9-1590-4E8A-A406-BC66D5891BFA}.Debug|Xbox 360.ActiveCfg = Debug|Any CPU
|
||||
{D47A24A9-1590-4E8A-A406-BC66D5891BFA}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{D47A24A9-1590-4E8A-A406-BC66D5891BFA}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{D47A24A9-1590-4E8A-A406-BC66D5891BFA}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
|
||||
{D47A24A9-1590-4E8A-A406-BC66D5891BFA}.Release|Mixed Platforms.Build.0 = Release|Any CPU
|
||||
{D47A24A9-1590-4E8A-A406-BC66D5891BFA}.Release|x86.ActiveCfg = Release|Any CPU
|
||||
{D47A24A9-1590-4E8A-A406-BC66D5891BFA}.Release|Xbox 360.ActiveCfg = Release|Any CPU
|
||||
{E246958B-EAD8-48E9-844B-54718C952869}.Debug|Any CPU.ActiveCfg = Debug|x86
|
||||
{E246958B-EAD8-48E9-844B-54718C952869}.Debug|Mixed Platforms.ActiveCfg = Debug|x86
|
||||
{E246958B-EAD8-48E9-844B-54718C952869}.Debug|Mixed Platforms.Build.0 = Debug|x86
|
||||
{E246958B-EAD8-48E9-844B-54718C952869}.Debug|x86.ActiveCfg = Debug|x86
|
||||
{E246958B-EAD8-48E9-844B-54718C952869}.Debug|x86.Build.0 = Debug|x86
|
||||
{E246958B-EAD8-48E9-844B-54718C952869}.Debug|Xbox 360.ActiveCfg = Debug|x86
|
||||
{E246958B-EAD8-48E9-844B-54718C952869}.Release|Any CPU.ActiveCfg = Release|x86
|
||||
{E246958B-EAD8-48E9-844B-54718C952869}.Release|Mixed Platforms.ActiveCfg = Release|x86
|
||||
{E246958B-EAD8-48E9-844B-54718C952869}.Release|Mixed Platforms.Build.0 = Release|x86
|
||||
{E246958B-EAD8-48E9-844B-54718C952869}.Release|x86.ActiveCfg = Release|x86
|
||||
{E246958B-EAD8-48E9-844B-54718C952869}.Release|x86.Build.0 = Release|x86
|
||||
{E246958B-EAD8-48E9-844B-54718C952869}.Release|Xbox 360.ActiveCfg = Release|x86
|
||||
{A96F5631-40E1-40B0-AEE2-6F2E3368E2AE}.Debug|Any CPU.ActiveCfg = Debug|x86
|
||||
{A96F5631-40E1-40B0-AEE2-6F2E3368E2AE}.Debug|Mixed Platforms.ActiveCfg = Debug|x86
|
||||
{A96F5631-40E1-40B0-AEE2-6F2E3368E2AE}.Debug|x86.ActiveCfg = Debug|x86
|
||||
{A96F5631-40E1-40B0-AEE2-6F2E3368E2AE}.Debug|Xbox 360.ActiveCfg = Debug|x86
|
||||
{A96F5631-40E1-40B0-AEE2-6F2E3368E2AE}.Release|Any CPU.ActiveCfg = Release|x86
|
||||
{A96F5631-40E1-40B0-AEE2-6F2E3368E2AE}.Release|Mixed Platforms.ActiveCfg = Release|x86
|
||||
{A96F5631-40E1-40B0-AEE2-6F2E3368E2AE}.Release|x86.ActiveCfg = Release|x86
|
||||
{A96F5631-40E1-40B0-AEE2-6F2E3368E2AE}.Release|Xbox 360.ActiveCfg = Release|x86
|
||||
{6EE9A3C2-0BD8-480D-AED2-6A5A9EBF7AFA}.Debug|Any CPU.ActiveCfg = Debug|Xbox 360
|
||||
{6EE9A3C2-0BD8-480D-AED2-6A5A9EBF7AFA}.Debug|Mixed Platforms.ActiveCfg = Debug|Xbox 360
|
||||
{6EE9A3C2-0BD8-480D-AED2-6A5A9EBF7AFA}.Debug|Mixed Platforms.Build.0 = Debug|Xbox 360
|
||||
{6EE9A3C2-0BD8-480D-AED2-6A5A9EBF7AFA}.Debug|x86.ActiveCfg = Debug|Xbox 360
|
||||
{6EE9A3C2-0BD8-480D-AED2-6A5A9EBF7AFA}.Debug|Xbox 360.ActiveCfg = Debug|Xbox 360
|
||||
{6EE9A3C2-0BD8-480D-AED2-6A5A9EBF7AFA}.Debug|Xbox 360.Build.0 = Debug|Xbox 360
|
||||
{6EE9A3C2-0BD8-480D-AED2-6A5A9EBF7AFA}.Release|Any CPU.ActiveCfg = Release|Xbox 360
|
||||
{6EE9A3C2-0BD8-480D-AED2-6A5A9EBF7AFA}.Release|Mixed Platforms.ActiveCfg = Release|Xbox 360
|
||||
{6EE9A3C2-0BD8-480D-AED2-6A5A9EBF7AFA}.Release|Mixed Platforms.Build.0 = Release|Xbox 360
|
||||
{6EE9A3C2-0BD8-480D-AED2-6A5A9EBF7AFA}.Release|x86.ActiveCfg = Release|Xbox 360
|
||||
{6EE9A3C2-0BD8-480D-AED2-6A5A9EBF7AFA}.Release|Xbox 360.ActiveCfg = Release|Xbox 360
|
||||
{6EE9A3C2-0BD8-480D-AED2-6A5A9EBF7AFA}.Release|Xbox 360.Build.0 = Release|Xbox 360
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
EndGlobal
|
167
Virtu/Keyboard.cs
Normal file
167
Virtu/Keyboard.cs
Normal file
|
@ -0,0 +1,167 @@
|
|||
using System;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using Jellyfish.Virtu.Properties;
|
||||
using Jellyfish.Virtu.Services;
|
||||
using Jellyfish.Virtu.Settings;
|
||||
|
||||
namespace Jellyfish.Virtu
|
||||
{
|
||||
public sealed class Keyboard : MachineComponent
|
||||
{
|
||||
public Keyboard(Machine machine) :
|
||||
base(machine)
|
||||
{
|
||||
_pollEvent = PollEvent; // cache delegate; avoids garbage
|
||||
}
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
_keyboardService = Machine.Services.GetService<KeyboardService>();
|
||||
_gamePortService = Machine.Services.GetService<GamePortService>();
|
||||
|
||||
_keyboardService.AsciiKeyDown += (sender, e) => Latch = e.AsciiKey;
|
||||
|
||||
Machine.Events.AddEvent(CyclesPerPoll, _pollEvent);
|
||||
}
|
||||
|
||||
[SuppressMessage("Microsoft.Maintainability", "CA1502:AvoidExcessiveComplexity")]
|
||||
public int ReadLatch()
|
||||
{
|
||||
if (Strobe)
|
||||
{
|
||||
return Latch;
|
||||
}
|
||||
|
||||
KeyboardSettings settings = Machine.Settings.Keyboard;
|
||||
|
||||
if (settings.UseGamePort)
|
||||
{
|
||||
if ((settings.Key.Joystick0.UpLeft > 0) && _gamePortService.Joystick0.IsUp && _gamePortService.Joystick0.IsLeft)
|
||||
{
|
||||
Latch = settings.Key.Joystick0.UpLeft;
|
||||
}
|
||||
else if ((settings.Key.Joystick0.UpRight > 0) && _gamePortService.Joystick0.IsUp && _gamePortService.Joystick0.IsRight)
|
||||
{
|
||||
Latch = settings.Key.Joystick0.UpRight;
|
||||
}
|
||||
else if ((settings.Key.Joystick0.DownLeft > 0) && _gamePortService.Joystick0.IsDown && _gamePortService.Joystick0.IsLeft)
|
||||
{
|
||||
Latch = settings.Key.Joystick0.DownLeft;
|
||||
}
|
||||
else if ((settings.Key.Joystick0.DownRight > 0) && _gamePortService.Joystick0.IsDown && _gamePortService.Joystick0.IsRight)
|
||||
{
|
||||
Latch = settings.Key.Joystick0.DownRight;
|
||||
}
|
||||
else if ((settings.Key.Joystick0.Up > 0) && _gamePortService.Joystick0.IsUp)
|
||||
{
|
||||
Latch = settings.Key.Joystick0.Up;
|
||||
}
|
||||
else if ((settings.Key.Joystick0.Left > 0) && _gamePortService.Joystick0.IsLeft)
|
||||
{
|
||||
Latch = settings.Key.Joystick0.Left;
|
||||
}
|
||||
else if ((settings.Key.Joystick0.Right > 0) && _gamePortService.Joystick0.IsRight)
|
||||
{
|
||||
Latch = settings.Key.Joystick0.Right;
|
||||
}
|
||||
else if ((settings.Key.Joystick0.Down > 0) && _gamePortService.Joystick0.IsDown)
|
||||
{
|
||||
Latch = settings.Key.Joystick0.Down;
|
||||
}
|
||||
|
||||
if ((settings.Key.Joystick1.UpLeft > 0) && _gamePortService.Joystick1.IsUp && _gamePortService.Joystick1.IsLeft) // override
|
||||
{
|
||||
Latch = settings.Key.Joystick1.UpLeft;
|
||||
}
|
||||
else if ((settings.Key.Joystick1.UpRight > 0) && _gamePortService.Joystick1.IsUp && _gamePortService.Joystick1.IsRight)
|
||||
{
|
||||
Latch = settings.Key.Joystick1.UpRight;
|
||||
}
|
||||
else if ((settings.Key.Joystick1.DownLeft > 0) && _gamePortService.Joystick1.IsDown && _gamePortService.Joystick1.IsLeft)
|
||||
{
|
||||
Latch = settings.Key.Joystick1.DownLeft;
|
||||
}
|
||||
else if ((settings.Key.Joystick1.DownRight > 0) && _gamePortService.Joystick1.IsDown && _gamePortService.Joystick1.IsRight)
|
||||
{
|
||||
Latch = settings.Key.Joystick1.DownRight;
|
||||
}
|
||||
else if ((settings.Key.Joystick1.Up > 0) && _gamePortService.Joystick1.IsUp)
|
||||
{
|
||||
Latch = settings.Key.Joystick1.Up;
|
||||
}
|
||||
else if ((settings.Key.Joystick1.Left > 0) && _gamePortService.Joystick1.IsLeft)
|
||||
{
|
||||
Latch = settings.Key.Joystick1.Left;
|
||||
}
|
||||
else if ((settings.Key.Joystick1.Right > 0) && _gamePortService.Joystick1.IsRight)
|
||||
{
|
||||
Latch = settings.Key.Joystick1.Right;
|
||||
}
|
||||
else if ((settings.Key.Joystick1.Down > 0) && _gamePortService.Joystick1.IsDown)
|
||||
{
|
||||
Latch = settings.Key.Joystick1.Down;
|
||||
}
|
||||
|
||||
if ((settings.Key.Button0 > 0) && _gamePortService.IsButton0Down) // override
|
||||
{
|
||||
Latch = settings.Key.Button0;
|
||||
}
|
||||
else if ((settings.Key.Button1 > 0) && _gamePortService.IsButton1Down)
|
||||
{
|
||||
Latch = settings.Key.Button1;
|
||||
}
|
||||
else if ((settings.Key.Button2 > 0) && _gamePortService.IsButton2Down)
|
||||
{
|
||||
Latch = settings.Key.Button2;
|
||||
}
|
||||
}
|
||||
|
||||
return Latch;
|
||||
}
|
||||
|
||||
public void ResetStrobe()
|
||||
{
|
||||
Strobe = false;
|
||||
}
|
||||
|
||||
private void PollEvent()
|
||||
{
|
||||
if (_keyboardService.IsResetKeyDown)
|
||||
{
|
||||
Machine.Reset();
|
||||
_keyboardService.WaitForResetKeyUp();
|
||||
}
|
||||
else if (_keyboardService.IsCpuThrottleKeyDown)
|
||||
{
|
||||
Machine.Cpu.ToggleThrottle();
|
||||
_keyboardService.WaitForKeyUp();
|
||||
}
|
||||
else if (_keyboardService.IsVideoFullScreenKeyDown)
|
||||
{
|
||||
Machine.Video.ToggleFullScreen();
|
||||
_keyboardService.WaitForKeyUp();
|
||||
}
|
||||
else if (_keyboardService.IsVideoMonochromeKeyDown)
|
||||
{
|
||||
Machine.Video.ToggleMonochrome();
|
||||
_keyboardService.WaitForKeyUp();
|
||||
}
|
||||
|
||||
Machine.Events.AddEvent(CyclesPerPoll, _pollEvent);
|
||||
}
|
||||
|
||||
public bool IsAnyKeyDown { get { return _keyboardService.IsAnyKeyDown; } }
|
||||
public bool Strobe { get; private set; }
|
||||
|
||||
private int Latch { get { return _latch; } set { _latch = value; Strobe = true; } }
|
||||
|
||||
private const int CyclesPerPoll = 17030;
|
||||
|
||||
private Action _pollEvent;
|
||||
|
||||
private KeyboardService _keyboardService;
|
||||
private GamePortService _gamePortService;
|
||||
|
||||
private int _latch;
|
||||
}
|
||||
}
|
80
Virtu/Machine.cs
Normal file
80
Virtu/Machine.cs
Normal file
|
@ -0,0 +1,80 @@
|
|||
using System.Collections.ObjectModel;
|
||||
using System.Threading;
|
||||
using Jellyfish.Library;
|
||||
using Jellyfish.Virtu.Services;
|
||||
using Jellyfish.Virtu.Settings;
|
||||
|
||||
namespace Jellyfish.Virtu
|
||||
{
|
||||
public class Machine
|
||||
{
|
||||
public Machine()
|
||||
{
|
||||
Thread = new Thread(Run) { Name = "Machine" };
|
||||
Events = new MachineEvents();
|
||||
Services = new MachineServices();
|
||||
Settings = new MachineSettings();
|
||||
|
||||
Cpu = new Cpu(this);
|
||||
Memory = new Memory(this);
|
||||
DiskII = new DiskII(this);
|
||||
Keyboard = new Keyboard(this);
|
||||
GamePort = new GamePort(this);
|
||||
Cassette = new Cassette(this);
|
||||
Speaker = new Speaker(this);
|
||||
Video = new Video(this);
|
||||
|
||||
Components = new Collection<MachineComponent> { Cpu, Memory, DiskII, Keyboard, GamePort, Cassette, Speaker, Video };
|
||||
}
|
||||
|
||||
public void Reset()
|
||||
{
|
||||
Components.ForEach(component => component.Reset());
|
||||
}
|
||||
|
||||
public void Start()
|
||||
{
|
||||
_storageService = Services.GetService<StorageService>();
|
||||
_storageService.Load(MachineSettings.FileName, stream => Settings.Deserialize(stream));
|
||||
Thread.Start();
|
||||
}
|
||||
|
||||
public void Stop()
|
||||
{
|
||||
_stopPending = true;
|
||||
Thread.Join();
|
||||
_storageService.Save(MachineSettings.FileName, stream => Settings.Serialize(stream));
|
||||
}
|
||||
|
||||
private void Run()
|
||||
{
|
||||
Components.ForEach(component => component.Initialize());
|
||||
Reset();
|
||||
|
||||
do
|
||||
{
|
||||
Events.RaiseEvents(Cpu.Execute());
|
||||
}
|
||||
while (!_stopPending);
|
||||
|
||||
Components.ForEach(component => component.Uninitialize());
|
||||
}
|
||||
|
||||
public Thread Thread { get; private set; }
|
||||
public MachineEvents Events { get; private set; }
|
||||
public MachineServices Services { get; private set; }
|
||||
public MachineSettings Settings { get; private set; }
|
||||
public Collection<MachineComponent> Components { get; private set; }
|
||||
public Cpu Cpu { get; private set; }
|
||||
public Memory Memory { get; private set; }
|
||||
public DiskII DiskII { get; private set; }
|
||||
public Keyboard Keyboard { get; private set; }
|
||||
public GamePort GamePort { get; private set; }
|
||||
public Cassette Cassette { get; private set; }
|
||||
public Speaker Speaker { get; private set; }
|
||||
public Video Video { get; private set; }
|
||||
|
||||
private StorageService _storageService;
|
||||
private bool _stopPending;
|
||||
}
|
||||
}
|
24
Virtu/MachineComponent.cs
Normal file
24
Virtu/MachineComponent.cs
Normal file
|
@ -0,0 +1,24 @@
|
|||
namespace Jellyfish.Virtu
|
||||
{
|
||||
public abstract class MachineComponent
|
||||
{
|
||||
protected MachineComponent(Machine machine)
|
||||
{
|
||||
Machine = machine;
|
||||
}
|
||||
|
||||
public virtual void Initialize()
|
||||
{
|
||||
}
|
||||
|
||||
public virtual void Reset()
|
||||
{
|
||||
}
|
||||
|
||||
public virtual void Uninitialize()
|
||||
{
|
||||
}
|
||||
|
||||
protected Machine Machine { get; private set; }
|
||||
}
|
||||
}
|
103
Virtu/MachineEvents.cs
Normal file
103
Virtu/MachineEvents.cs
Normal file
|
@ -0,0 +1,103 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Globalization;
|
||||
|
||||
namespace Jellyfish.Virtu
|
||||
{
|
||||
public class MachineEvent
|
||||
{
|
||||
public MachineEvent(int delta, Action action)
|
||||
{
|
||||
Delta = delta;
|
||||
Action = action;
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return string.Format(CultureInfo.CurrentCulture, "Delta = {0} Action = {{{1}.{2}}}", Delta, Action.Method.DeclaringType.Name, Action.Method.Name);
|
||||
}
|
||||
|
||||
public int Delta { get; set; }
|
||||
public Action Action { get; set; }
|
||||
}
|
||||
|
||||
public class MachineEvents
|
||||
{
|
||||
public void AddEvent(int delta, Action action)
|
||||
{
|
||||
LinkedListNode<MachineEvent> node = _used.First;
|
||||
for (; node != null; node = node.Next)
|
||||
{
|
||||
if (delta < node.Value.Delta)
|
||||
{
|
||||
node.Value.Delta -= delta;
|
||||
break;
|
||||
}
|
||||
if (node.Value.Delta > 0)
|
||||
{
|
||||
delta -= node.Value.Delta;
|
||||
}
|
||||
}
|
||||
|
||||
LinkedListNode<MachineEvent> newNode = _free.First;
|
||||
if (newNode != null)
|
||||
{
|
||||
_free.RemoveFirst();
|
||||
newNode.Value.Delta = delta;
|
||||
newNode.Value.Action = action;
|
||||
}
|
||||
else
|
||||
{
|
||||
newNode = new LinkedListNode<MachineEvent>(new MachineEvent(delta, action));
|
||||
}
|
||||
|
||||
if (node != null)
|
||||
{
|
||||
_used.AddBefore(node, newNode);
|
||||
}
|
||||
else
|
||||
{
|
||||
_used.AddLast(newNode);
|
||||
}
|
||||
}
|
||||
|
||||
public int FindEvent(Action action)
|
||||
{
|
||||
int delta = 0;
|
||||
|
||||
for (LinkedListNode<MachineEvent> node = _used.First; node != null; node = node.Next)
|
||||
{
|
||||
delta += node.Value.Delta;
|
||||
if (object.ReferenceEquals(node.Value.Action, action)) // assumes delegate cached
|
||||
{
|
||||
return delta;
|
||||
}
|
||||
}
|
||||
|
||||
return delta;
|
||||
}
|
||||
|
||||
[SuppressMessage("Microsoft.Design", "CA1030:UseEventsWhereAppropriate")]
|
||||
public void RaiseEvents(int delta)
|
||||
{
|
||||
LinkedListNode<MachineEvent> node = _used.First;
|
||||
node.Value.Delta -= delta;
|
||||
|
||||
while (node.Value.Delta <= 0)
|
||||
{
|
||||
delta = node.Value.Delta;
|
||||
node.Value.Action();
|
||||
|
||||
_used.Remove(node);
|
||||
_free.AddFirst(node); // cache node; avoids garbage
|
||||
|
||||
node = _used.First;
|
||||
node.Value.Delta += delta;
|
||||
}
|
||||
}
|
||||
|
||||
private LinkedList<MachineEvent> _used = new LinkedList<MachineEvent>();
|
||||
private LinkedList<MachineEvent> _free = new LinkedList<MachineEvent>();
|
||||
}
|
||||
}
|
392
Virtu/MachineSettings.cs
Normal file
392
Virtu/MachineSettings.cs
Normal file
|
@ -0,0 +1,392 @@
|
|||
using System;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.IO;
|
||||
using System.Xml;
|
||||
using System.Xml.Linq;
|
||||
|
||||
namespace Jellyfish.Virtu.Settings
|
||||
{
|
||||
public class MachineSettings
|
||||
{
|
||||
public MachineSettings()
|
||||
{
|
||||
Cpu = new CpuSettings { Is65C02 = true, IsThrottled = true };
|
||||
DiskII = new DiskIISettings
|
||||
{
|
||||
Disk1 = new DiskSettings { Name = string.Empty, Volume = 0xFE, IsWriteProtected = false },
|
||||
Disk2 = new DiskSettings { Name = string.Empty, Volume = 0xFE, IsWriteProtected = false }
|
||||
};
|
||||
Keyboard = new KeyboardSettings
|
||||
{
|
||||
UseGamePort = false,
|
||||
Key = new KeySettings
|
||||
{
|
||||
Joystick0 = new JoystickSettings { UpLeft = 0, Up = 'E', UpRight = 0, Left = 'S', Right = 'F', DownLeft = 0, Down = 'D', DownRight = 0 },
|
||||
Joystick1 = new JoystickSettings { UpLeft = 0, Up = 'I', UpRight = 0, Left = 'J', Right = 'L', DownLeft = 0, Down = 'K', DownRight = 0 },
|
||||
Button0 = 0, Button1 = 0, Button2 = 0
|
||||
}
|
||||
};
|
||||
GamePort = new GamePortSettings
|
||||
{
|
||||
UseKeyboard = false,
|
||||
Key = new KeySettings
|
||||
{
|
||||
Joystick0 = new JoystickSettings { UpLeft = 0, Up = 0, UpRight = 0, Left = 0, Right = 0, DownLeft = 0, Down = 0, DownRight = 0 },
|
||||
Joystick1 = new JoystickSettings { UpLeft = 0, Up = 0, UpRight = 0, Left = 0, Right = 0, DownLeft = 0, Down = 0, DownRight = 0 },
|
||||
Button0 = 0, Button1 = 0, Button2 = 0
|
||||
}
|
||||
};
|
||||
Video = new VideoSettings
|
||||
{
|
||||
IsFullScreen = false, IsMonochrome = false, ScannerType = 0,
|
||||
Color = new ColorSettings
|
||||
{
|
||||
Black = 0x000000,
|
||||
DarkBlue = 0x000099,
|
||||
DarkGreen = 0x117722,
|
||||
MediumBlue = 0x0000FF,
|
||||
Brown = 0x885500,
|
||||
LightGrey = 0x99AAAA,
|
||||
Green = 0x00EE11,
|
||||
Aquamarine = 0x55FFAA,
|
||||
DeepRed = 0xFF1111,
|
||||
Purple = 0xDD00DD,
|
||||
DarkGrey = 0x445555,
|
||||
LightBlue = 0x33AAFF,
|
||||
Orange = 0xFF4411,
|
||||
Pink = 0xFF9988,
|
||||
Yellow = 0xFFFF11,
|
||||
White = 0xFFFFFF,
|
||||
Monochrome = 0x00AA00
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
[SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes")]
|
||||
public void Deserialize(Stream stream)
|
||||
{
|
||||
try
|
||||
{
|
||||
using (XmlReader reader = XmlReader.Create(stream))
|
||||
{
|
||||
XNamespace ns = Namespace;
|
||||
XElement root = XElement.Load(reader);
|
||||
XElement cpu = root.Element(ns + "Cpu");
|
||||
Cpu = new CpuSettings
|
||||
{
|
||||
Is65C02 = (bool)cpu.Attribute("Is65C02"),
|
||||
IsThrottled = (bool)cpu.Attribute("IsThrottled")
|
||||
};
|
||||
XElement diskII = root.Element(ns + "DiskII");
|
||||
XElement disk1 = diskII.Element(ns + "Disk1");
|
||||
XElement disk2 = diskII.Element(ns + "Disk2");
|
||||
DiskII = new DiskIISettings
|
||||
{
|
||||
Disk1 = new DiskSettings
|
||||
{
|
||||
Name = (string)disk1.Attribute("Name") ?? string.Empty,
|
||||
Volume = (int)disk1.Attribute("Volume"),
|
||||
IsWriteProtected = (bool)disk1.Attribute("IsWriteProtected")
|
||||
},
|
||||
Disk2 = new DiskSettings
|
||||
{
|
||||
Name = (string)disk2.Attribute("Name") ?? string.Empty,
|
||||
Volume = (int)disk2.Attribute("Volume"),
|
||||
IsWriteProtected = (bool)disk2.Attribute("IsWriteProtected")
|
||||
},
|
||||
};
|
||||
XElement keyboard = root.Element(ns + "Keyboard");
|
||||
XElement key = keyboard.Element(ns + "Key");
|
||||
XElement joystick0 = key.Element(ns + "Joystick0");
|
||||
XElement joystick1 = key.Element(ns + "Joystick1");
|
||||
XElement buttons = key.Element(ns + "Buttons");
|
||||
Keyboard = new KeyboardSettings
|
||||
{
|
||||
UseGamePort = (bool)keyboard.Attribute("UseGamePort"),
|
||||
Key = new KeySettings
|
||||
{
|
||||
Joystick0 = new JoystickSettings
|
||||
{
|
||||
UpLeft = (int)joystick0.Attribute("UpLeft"),
|
||||
Up = (int)joystick0.Attribute("Up"),
|
||||
UpRight = (int)joystick0.Attribute("UpRight"),
|
||||
Left = (int)joystick0.Attribute("Left"),
|
||||
Right = (int)joystick0.Attribute("Right"),
|
||||
DownLeft = (int)joystick0.Attribute("DownLeft"),
|
||||
Down = (int)joystick0.Attribute("Down"),
|
||||
DownRight = (int)joystick0.Attribute("DownRight")
|
||||
},
|
||||
Joystick1 = new JoystickSettings
|
||||
{
|
||||
UpLeft = (int)joystick1.Attribute("UpLeft"),
|
||||
Up = (int)joystick1.Attribute("Up"),
|
||||
UpRight = (int)joystick1.Attribute("UpRight"),
|
||||
Left = (int)joystick1.Attribute("Left"),
|
||||
Right = (int)joystick1.Attribute("Right"),
|
||||
DownLeft = (int)joystick1.Attribute("DownLeft"),
|
||||
Down = (int)joystick1.Attribute("Down"),
|
||||
DownRight = (int)joystick1.Attribute("DownRight")
|
||||
},
|
||||
Button0 = (int)buttons.Attribute("Button0"),
|
||||
Button1 = (int)buttons.Attribute("Button1"),
|
||||
Button2 = (int)buttons.Attribute("Button2")
|
||||
}
|
||||
};
|
||||
XElement gamePort = root.Element(ns + "GamePort");
|
||||
key = gamePort.Element(ns + "Key");
|
||||
joystick0 = key.Element(ns + "Joystick0");
|
||||
joystick1 = key.Element(ns + "Joystick1");
|
||||
buttons = key.Element(ns + "Buttons");
|
||||
GamePort = new GamePortSettings
|
||||
{
|
||||
UseKeyboard = (bool)gamePort.Attribute("UseKeyboard"),
|
||||
Key = new KeySettings
|
||||
{
|
||||
Joystick0 = new JoystickSettings
|
||||
{
|
||||
UpLeft = (int)joystick0.Attribute("UpLeft"),
|
||||
Up = (int)joystick0.Attribute("Up"),
|
||||
UpRight = (int)joystick0.Attribute("UpRight"),
|
||||
Left = (int)joystick0.Attribute("Left"),
|
||||
Right = (int)joystick0.Attribute("Right"),
|
||||
DownLeft = (int)joystick0.Attribute("DownLeft"),
|
||||
Down = (int)joystick0.Attribute("Down"),
|
||||
DownRight = (int)joystick0.Attribute("DownRight")
|
||||
},
|
||||
Joystick1 = new JoystickSettings
|
||||
{
|
||||
UpLeft = (int)joystick1.Attribute("UpLeft"),
|
||||
Up = (int)joystick1.Attribute("Up"),
|
||||
UpRight = (int)joystick1.Attribute("UpRight"),
|
||||
Left = (int)joystick1.Attribute("Left"),
|
||||
Right = (int)joystick1.Attribute("Right"),
|
||||
DownLeft = (int)joystick1.Attribute("DownLeft"),
|
||||
Down = (int)joystick1.Attribute("Down"),
|
||||
DownRight = (int)joystick1.Attribute("DownRight")
|
||||
},
|
||||
Button0 = (int)buttons.Attribute("Button0"),
|
||||
Button1 = (int)buttons.Attribute("Button1"),
|
||||
Button2 = (int)buttons.Attribute("Button2")
|
||||
}
|
||||
};
|
||||
XElement video = root.Element(ns + "Video");
|
||||
XElement color = video.Element(ns + "Color");
|
||||
Video = new VideoSettings
|
||||
{
|
||||
IsFullScreen = (bool)video.Attribute("IsFullScreen"),
|
||||
IsMonochrome = (bool)video.Attribute("IsMonochrome"),
|
||||
ScannerType = (int)video.Attribute("ScannerType"),
|
||||
Color = new ColorSettings
|
||||
{
|
||||
Black = (uint)color.Attribute("Black"),
|
||||
DarkBlue = (uint)color.Attribute("DarkBlue"),
|
||||
DarkGreen = (uint)color.Attribute("DarkGreen"),
|
||||
MediumBlue = (uint)color.Attribute("MediumBlue"),
|
||||
Brown = (uint)color.Attribute("Brown"),
|
||||
LightGrey = (uint)color.Attribute("LightGrey"),
|
||||
Green = (uint)color.Attribute("Green"),
|
||||
Aquamarine = (uint)color.Attribute("Aquamarine"),
|
||||
DeepRed = (uint)color.Attribute("DeepRed"),
|
||||
Purple = (uint)color.Attribute("Purple"),
|
||||
DarkGrey = (uint)color.Attribute("DarkGrey"),
|
||||
LightBlue = (uint)color.Attribute("LightBlue"),
|
||||
Orange = (uint)color.Attribute("Orange"),
|
||||
Pink = (uint)color.Attribute("Pink"),
|
||||
Yellow = (uint)color.Attribute("Yellow"),
|
||||
White = (uint)color.Attribute("White"),
|
||||
Monochrome = (uint)color.Attribute("Monochrome")
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
public void Serialize(Stream stream)
|
||||
{
|
||||
XNamespace ns = Namespace;
|
||||
XElement xml = new XElement(ns + "MachineSettings",
|
||||
new XElement(ns + "Cpu",
|
||||
new XAttribute("Is65C02", Cpu.Is65C02),
|
||||
new XAttribute("IsThrottled", Cpu.IsThrottled)),
|
||||
new XElement(ns + "DiskII",
|
||||
new XElement(ns + "Disk1",
|
||||
new XAttribute("Name", DiskII.Disk1.Name),
|
||||
new XAttribute("Volume", DiskII.Disk1.Volume),
|
||||
new XAttribute("IsWriteProtected", DiskII.Disk1.IsWriteProtected)),
|
||||
new XElement(ns + "Disk2",
|
||||
new XAttribute("Name", DiskII.Disk2.Name),
|
||||
new XAttribute("Volume", DiskII.Disk2.Volume),
|
||||
new XAttribute("IsWriteProtected", DiskII.Disk2.IsWriteProtected))),
|
||||
new XElement(ns + "Keyboard",
|
||||
new XAttribute("UseGamePort", Keyboard.UseGamePort),
|
||||
new XElement(ns + "Key",
|
||||
new XElement(ns + "Joystick0",
|
||||
new XAttribute("UpLeft", Keyboard.Key.Joystick0.UpLeft),
|
||||
new XAttribute("Up", Keyboard.Key.Joystick0.Up),
|
||||
new XAttribute("UpRight", Keyboard.Key.Joystick0.UpRight),
|
||||
new XAttribute("Left", Keyboard.Key.Joystick0.Left),
|
||||
new XAttribute("Right", Keyboard.Key.Joystick0.Right),
|
||||
new XAttribute("DownLeft", Keyboard.Key.Joystick0.DownLeft),
|
||||
new XAttribute("Down", Keyboard.Key.Joystick0.Down),
|
||||
new XAttribute("DownRight", Keyboard.Key.Joystick0.DownRight)),
|
||||
new XElement(ns + "Joystick1",
|
||||
new XAttribute("UpLeft", Keyboard.Key.Joystick1.UpLeft),
|
||||
new XAttribute("Up", Keyboard.Key.Joystick1.Up),
|
||||
new XAttribute("UpRight", Keyboard.Key.Joystick1.UpRight),
|
||||
new XAttribute("Left", Keyboard.Key.Joystick1.Left),
|
||||
new XAttribute("Right", Keyboard.Key.Joystick1.Right),
|
||||
new XAttribute("DownLeft", Keyboard.Key.Joystick1.DownLeft),
|
||||
new XAttribute("Down", Keyboard.Key.Joystick1.Down),
|
||||
new XAttribute("DownRight", Keyboard.Key.Joystick1.DownRight)),
|
||||
new XElement(ns + "Buttons",
|
||||
new XAttribute("Button0", Keyboard.Key.Button0),
|
||||
new XAttribute("Button1", Keyboard.Key.Button1),
|
||||
new XAttribute("Button2", Keyboard.Key.Button2)))),
|
||||
new XElement(ns + "GamePort",
|
||||
new XAttribute("UseKeyboard", GamePort.UseKeyboard),
|
||||
new XElement(ns + "Key",
|
||||
new XElement(ns + "Joystick0",
|
||||
new XAttribute("UpLeft", GamePort.Key.Joystick0.UpLeft),
|
||||
new XAttribute("Up", GamePort.Key.Joystick0.Up),
|
||||
new XAttribute("UpRight", GamePort.Key.Joystick0.UpRight),
|
||||
new XAttribute("Left", GamePort.Key.Joystick0.Left),
|
||||
new XAttribute("Right", GamePort.Key.Joystick0.Right),
|
||||
new XAttribute("DownLeft", GamePort.Key.Joystick0.DownLeft),
|
||||
new XAttribute("Down", GamePort.Key.Joystick0.Down),
|
||||
new XAttribute("DownRight", GamePort.Key.Joystick0.DownRight)),
|
||||
new XElement(ns + "Joystick1",
|
||||
new XAttribute("UpLeft", GamePort.Key.Joystick1.UpLeft),
|
||||
new XAttribute("Up", GamePort.Key.Joystick1.Up),
|
||||
new XAttribute("UpRight", GamePort.Key.Joystick1.UpRight),
|
||||
new XAttribute("Left", GamePort.Key.Joystick1.Left),
|
||||
new XAttribute("Right", GamePort.Key.Joystick1.Right),
|
||||
new XAttribute("DownLeft", GamePort.Key.Joystick1.DownLeft),
|
||||
new XAttribute("Down", GamePort.Key.Joystick1.Down),
|
||||
new XAttribute("DownRight", GamePort.Key.Joystick1.DownRight)),
|
||||
new XElement(ns + "Buttons",
|
||||
new XAttribute("Button0", Keyboard.Key.Button0),
|
||||
new XAttribute("Button1", Keyboard.Key.Button1),
|
||||
new XAttribute("Button2", Keyboard.Key.Button2)))),
|
||||
new XElement(ns + "Video",
|
||||
new XAttribute("IsFullScreen", Video.IsFullScreen),
|
||||
new XAttribute("IsMonochrome", Video.IsMonochrome),
|
||||
new XAttribute("ScannerType", Video.ScannerType),
|
||||
new XElement(ns + "Color",
|
||||
new XAttribute("Black", Video.Color.Black),
|
||||
new XAttribute("DarkBlue", Video.Color.DarkBlue),
|
||||
new XAttribute("DarkGreen", Video.Color.DarkGreen),
|
||||
new XAttribute("MediumBlue", Video.Color.MediumBlue),
|
||||
new XAttribute("Brown", Video.Color.Brown),
|
||||
new XAttribute("LightGrey", Video.Color.LightGrey),
|
||||
new XAttribute("Green", Video.Color.Green),
|
||||
new XAttribute("Aquamarine", Video.Color.Aquamarine),
|
||||
new XAttribute("DeepRed", Video.Color.DeepRed),
|
||||
new XAttribute("Purple", Video.Color.Purple),
|
||||
new XAttribute("DarkGrey", Video.Color.DarkGrey),
|
||||
new XAttribute("LightBlue", Video.Color.LightBlue),
|
||||
new XAttribute("Orange", Video.Color.Orange),
|
||||
new XAttribute("Pink", Video.Color.Pink),
|
||||
new XAttribute("Yellow", Video.Color.Yellow),
|
||||
new XAttribute("White", Video.Color.White),
|
||||
new XAttribute("Monochrome", Video.Color.Monochrome))));
|
||||
|
||||
using (XmlWriter writer = XmlWriter.Create(stream))
|
||||
{
|
||||
xml.WriteTo(writer);
|
||||
}
|
||||
}
|
||||
|
||||
public CpuSettings Cpu { get; set; }
|
||||
public DiskIISettings DiskII { get; set; }
|
||||
public KeyboardSettings Keyboard { get; set; }
|
||||
public GamePortSettings GamePort { get; set; }
|
||||
public VideoSettings Video { get; set; }
|
||||
|
||||
public const string FileName = "Settings.xml";
|
||||
public const string Namespace = "http://schemas.jellyfish.co.nz/virtu/settings";
|
||||
}
|
||||
|
||||
public class CpuSettings
|
||||
{
|
||||
public bool Is65C02 { get; set; }
|
||||
public bool IsThrottled { get; set; }
|
||||
}
|
||||
|
||||
public class DiskSettings
|
||||
{
|
||||
public string Name { get; set; }
|
||||
public int Volume { get; set; }
|
||||
public bool IsWriteProtected { get; set; }
|
||||
};
|
||||
|
||||
public class DiskIISettings
|
||||
{
|
||||
public DiskSettings Disk1 { get; set; }
|
||||
public DiskSettings Disk2 { get; set; }
|
||||
};
|
||||
|
||||
public class JoystickSettings
|
||||
{
|
||||
public int UpLeft { get; set; }
|
||||
public int Up { get; set; }
|
||||
public int UpRight { get; set; }
|
||||
public int Left { get; set; }
|
||||
public int Right { get; set; }
|
||||
public int DownLeft { get; set; }
|
||||
public int Down { get; set; }
|
||||
public int DownRight { get; set; }
|
||||
};
|
||||
|
||||
public class KeySettings
|
||||
{
|
||||
public JoystickSettings Joystick0 { get; set; }
|
||||
public JoystickSettings Joystick1 { get; set; }
|
||||
public int Button0 { get; set; }
|
||||
public int Button1 { get; set; }
|
||||
public int Button2 { get; set; }
|
||||
};
|
||||
|
||||
public class KeyboardSettings
|
||||
{
|
||||
public bool UseGamePort { get; set; }
|
||||
public KeySettings Key { get; set; }
|
||||
}
|
||||
|
||||
public class GamePortSettings
|
||||
{
|
||||
public bool UseKeyboard { get; set; }
|
||||
public KeySettings Key { get; set; }
|
||||
}
|
||||
|
||||
public class ColorSettings
|
||||
{
|
||||
public uint Black { get; set; }
|
||||
public uint DarkBlue { get; set; }
|
||||
public uint DarkGreen { get; set; }
|
||||
public uint MediumBlue { get; set; }
|
||||
public uint Brown { get; set; }
|
||||
public uint LightGrey { get; set; }
|
||||
public uint Green { get; set; }
|
||||
public uint Aquamarine { get; set; }
|
||||
public uint DeepRed { get; set; }
|
||||
public uint Purple { get; set; }
|
||||
public uint DarkGrey { get; set; }
|
||||
public uint LightBlue { get; set; }
|
||||
public uint Orange { get; set; }
|
||||
public uint Pink { get; set; }
|
||||
public uint Yellow { get; set; }
|
||||
public uint White { get; set; }
|
||||
public uint Monochrome { get; set; }
|
||||
}
|
||||
|
||||
public class VideoSettings
|
||||
{
|
||||
public bool IsFullScreen { get; set; }
|
||||
public bool IsMonochrome { get; set; }
|
||||
public int ScannerType { get; set; }
|
||||
public ColorSettings Color { get; set; }
|
||||
};
|
||||
}
|
1484
Virtu/Memory.cs
Normal file
1484
Virtu/Memory.cs
Normal file
File diff suppressed because it is too large
Load Diff
105
Virtu/MemoryData.cs
Normal file
105
Virtu/MemoryData.cs
Normal file
|
@ -0,0 +1,105 @@
|
|||
using System;
|
||||
|
||||
namespace Jellyfish.Virtu
|
||||
{
|
||||
public partial class Memory
|
||||
{
|
||||
private const int BankCount = 2;
|
||||
|
||||
private const int BankMain = 0;
|
||||
private const int BankAux = 1;
|
||||
|
||||
private const int RegionCount = 12;
|
||||
|
||||
private const int Region0001 = 0;
|
||||
private const int Region02BF = 1;
|
||||
private const int Region0407 = 2;
|
||||
private const int Region080B = 3;
|
||||
private const int Region203F = 4;
|
||||
private const int Region405F = 5;
|
||||
private const int RegionC0C0 = 6;
|
||||
private const int RegionC1C7 = 7;
|
||||
private const int RegionC3C3 = 8;
|
||||
private const int RegionC8CF = 9;
|
||||
private const int RegionD0DF = 10;
|
||||
private const int RegionE0FF = 11;
|
||||
|
||||
private static readonly int[] RegionBaseAddress = new int[RegionCount]
|
||||
{
|
||||
0x0000, 0x0200, 0x0200, 0x0200, 0x0200, 0x0200, 0xC000, 0xC100, 0xC100, 0xC100, 0xD000, 0xE000
|
||||
};
|
||||
|
||||
private const int PageCount = 256;
|
||||
|
||||
private static readonly int[] PageRegion = new int[PageCount]
|
||||
{
|
||||
Region0001, Region0001, Region02BF, Region02BF, Region0407, Region0407, Region0407, Region0407,
|
||||
Region080B, Region080B, Region080B, Region080B, Region02BF, Region02BF, Region02BF, Region02BF,
|
||||
Region02BF, Region02BF, Region02BF, Region02BF, Region02BF, Region02BF, Region02BF, Region02BF,
|
||||
Region02BF, Region02BF, Region02BF, Region02BF, Region02BF, Region02BF, Region02BF, Region02BF,
|
||||
Region203F, Region203F, Region203F, Region203F, Region203F, Region203F, Region203F, Region203F,
|
||||
Region203F, Region203F, Region203F, Region203F, Region203F, Region203F, Region203F, Region203F,
|
||||
Region203F, Region203F, Region203F, Region203F, Region203F, Region203F, Region203F, Region203F,
|
||||
Region203F, Region203F, Region203F, Region203F, Region203F, Region203F, Region203F, Region203F,
|
||||
Region405F, Region405F, Region405F, Region405F, Region405F, Region405F, Region405F, Region405F,
|
||||
Region405F, Region405F, Region405F, Region405F, Region405F, Region405F, Region405F, Region405F,
|
||||
Region405F, Region405F, Region405F, Region405F, Region405F, Region405F, Region405F, Region405F,
|
||||
Region405F, Region405F, Region405F, Region405F, Region405F, Region405F, Region405F, Region405F,
|
||||
Region02BF, Region02BF, Region02BF, Region02BF, Region02BF, Region02BF, Region02BF, Region02BF,
|
||||
Region02BF, Region02BF, Region02BF, Region02BF, Region02BF, Region02BF, Region02BF, Region02BF,
|
||||
Region02BF, Region02BF, Region02BF, Region02BF, Region02BF, Region02BF, Region02BF, Region02BF,
|
||||
Region02BF, Region02BF, Region02BF, Region02BF, Region02BF, Region02BF, Region02BF, Region02BF,
|
||||
Region02BF, Region02BF, Region02BF, Region02BF, Region02BF, Region02BF, Region02BF, Region02BF,
|
||||
Region02BF, Region02BF, Region02BF, Region02BF, Region02BF, Region02BF, Region02BF, Region02BF,
|
||||
Region02BF, Region02BF, Region02BF, Region02BF, Region02BF, Region02BF, Region02BF, Region02BF,
|
||||
Region02BF, Region02BF, Region02BF, Region02BF, Region02BF, Region02BF, Region02BF, Region02BF,
|
||||
Region02BF, Region02BF, Region02BF, Region02BF, Region02BF, Region02BF, Region02BF, Region02BF,
|
||||
Region02BF, Region02BF, Region02BF, Region02BF, Region02BF, Region02BF, Region02BF, Region02BF,
|
||||
Region02BF, Region02BF, Region02BF, Region02BF, Region02BF, Region02BF, Region02BF, Region02BF,
|
||||
Region02BF, Region02BF, Region02BF, Region02BF, Region02BF, Region02BF, Region02BF, Region02BF,
|
||||
RegionC0C0, RegionC1C7, RegionC1C7, RegionC3C3, RegionC1C7, RegionC1C7, RegionC1C7, RegionC1C7,
|
||||
RegionC8CF, RegionC8CF, RegionC8CF, RegionC8CF, RegionC8CF, RegionC8CF, RegionC8CF, RegionC8CF,
|
||||
RegionD0DF, RegionD0DF, RegionD0DF, RegionD0DF, RegionD0DF, RegionD0DF, RegionD0DF, RegionD0DF,
|
||||
RegionD0DF, RegionD0DF, RegionD0DF, RegionD0DF, RegionD0DF, RegionD0DF, RegionD0DF, RegionD0DF,
|
||||
RegionE0FF, RegionE0FF, RegionE0FF, RegionE0FF, RegionE0FF, RegionE0FF, RegionE0FF, RegionE0FF,
|
||||
RegionE0FF, RegionE0FF, RegionE0FF, RegionE0FF, RegionE0FF, RegionE0FF, RegionE0FF, RegionE0FF,
|
||||
RegionE0FF, RegionE0FF, RegionE0FF, RegionE0FF, RegionE0FF, RegionE0FF, RegionE0FF, RegionE0FF,
|
||||
RegionE0FF, RegionE0FF, RegionE0FF, RegionE0FF, RegionE0FF, RegionE0FF, RegionE0FF, RegionE0FF
|
||||
};
|
||||
|
||||
private const int State80Col = 0x000001;
|
||||
private const int StateText = 0x000002;
|
||||
private const int StateMixed = 0x000004;
|
||||
private const int StateHires = 0x000008;
|
||||
private const int StateDRes = 0x000010;
|
||||
private const int State80Store = 0x000020;
|
||||
private const int StateAltChrSet = 0x000040;
|
||||
private const int StateAltZP = 0x000080;
|
||||
private const int StateBank1 = 0x000100;
|
||||
private const int StateHRamRd = 0x000200;
|
||||
private const int StateHRamPreWrt = 0x000400;
|
||||
private const int StateHRamWrt = 0x000800;
|
||||
private const int StatePage2 = 0x001000;
|
||||
private const int StateRamRd = 0x002000;
|
||||
private const int StateRamWrt = 0x004000;
|
||||
private const int StateSlotC3Rom = 0x008000;
|
||||
private const int StateIntCXRom = 0x010000;
|
||||
private const int StateAn0 = 0x020000;
|
||||
private const int StateAn1 = 0x040000;
|
||||
private const int StateAn2 = 0x080000;
|
||||
private const int StateAn3 = 0x100000;
|
||||
private const int StateVideo = State80Col | StateText | StateMixed | StateHires | StateDRes;
|
||||
|
||||
private const int StateVideoModeCount = 32;
|
||||
|
||||
private static readonly int[] StateVideoMode = new int[StateVideoModeCount]
|
||||
{
|
||||
Video.Mode0, Video.Mode0, Video.Mode1, Video.Mode2, Video.Mode3, Video.Mode4, Video.Mode1, Video.Mode2,
|
||||
Video.Mode5, Video.Mode5, Video.Mode1, Video.Mode2, Video.Mode6, Video.Mode7, Video.Mode1, Video.Mode2,
|
||||
Video.Mode8, Video.Mode9, Video.Mode1, Video.Mode2, Video.ModeA, Video.ModeB, Video.Mode1, Video.Mode2,
|
||||
Video.ModeC, Video.ModeD, Video.Mode1, Video.Mode2, Video.ModeE, Video.ModeF, Video.Mode1, Video.Mode2
|
||||
};
|
||||
|
||||
private readonly Action<int, byte>[][][] WriteRamModeBankRegion;
|
||||
}
|
||||
}
|
159
Virtu/Properties/SR.Designer.cs
generated
Normal file
159
Virtu/Properties/SR.Designer.cs
generated
Normal file
|
@ -0,0 +1,159 @@
|
|||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by a tool.
|
||||
// Runtime Version:2.0.50727.3074
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace Jellyfish.Virtu.Properties {
|
||||
using System;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// A strongly-typed resource class, for looking up localized strings, formatting them, etc.
|
||||
/// </summary>
|
||||
// This class was auto-generated by the StronglyTypedResourceBuilderEx class via the ResXFileCodeGeneratorEx custom tool.
|
||||
// To add or remove a member, edit your .ResX file then rerun the ResXFileCodeGeneratorEx custom tool or rebuild your VS.NET project.
|
||||
// Copyright (c) Dmytro Kryvko 2006-2009 (http://dmytro.kryvko.googlepages.com/)
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("DMKSoftware.CodeGenerators.Tools.StronglyTypedResourceBuilderEx", "2.4.0.0")]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Naming", "CA1724:TypeNamesShouldNotMatchNamespaces")]
|
||||
public partial class SR {
|
||||
|
||||
private static global::System.Resources.ResourceManager _resourceManager;
|
||||
|
||||
private static object _internalSyncObject;
|
||||
|
||||
private static global::System.Globalization.CultureInfo _resourceCulture;
|
||||
|
||||
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
|
||||
public SR() {
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Thread safe lock object used by this class.
|
||||
/// </summary>
|
||||
public static object InternalSyncObject {
|
||||
get {
|
||||
if (object.ReferenceEquals(_internalSyncObject, null)) {
|
||||
global::System.Threading.Interlocked.CompareExchange(ref _internalSyncObject, new object(), null);
|
||||
}
|
||||
return _internalSyncObject;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns the cached ResourceManager instance used by this class.
|
||||
/// </summary>
|
||||
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||
public static global::System.Resources.ResourceManager ResourceManager {
|
||||
get {
|
||||
if (object.ReferenceEquals(_resourceManager, null)) {
|
||||
global::System.Threading.Monitor.Enter(InternalSyncObject);
|
||||
try {
|
||||
if (object.ReferenceEquals(_resourceManager, null)) {
|
||||
global::System.Threading.Interlocked.Exchange(ref _resourceManager, new global::System.Resources.ResourceManager("Jellyfish.Virtu.Properties.SR", typeof(SR).Assembly));
|
||||
}
|
||||
}
|
||||
finally {
|
||||
global::System.Threading.Monitor.Exit(InternalSyncObject);
|
||||
}
|
||||
}
|
||||
return _resourceManager;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Overrides the current thread's CurrentUICulture property for all
|
||||
/// resource lookups using this strongly typed resource class.
|
||||
/// </summary>
|
||||
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||
public static global::System.Globalization.CultureInfo Culture {
|
||||
get {
|
||||
return _resourceCulture;
|
||||
}
|
||||
set {
|
||||
_resourceCulture = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to 'Rom '{0}' invalid.'.
|
||||
/// </summary>
|
||||
public static string RomInvalid {
|
||||
get {
|
||||
return ResourceManager.GetString(ResourceNames.RomInvalid, _resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to 'Service type '{0}' already present.'.
|
||||
/// </summary>
|
||||
public static string ServiceAlreadyPresent {
|
||||
get {
|
||||
return ResourceManager.GetString(ResourceNames.ServiceAlreadyPresent, _resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to 'Service type '{0}' must be assignable from service provider '{1}'.'.
|
||||
/// </summary>
|
||||
public static string ServiceMustBeAssignable {
|
||||
get {
|
||||
return ResourceManager.GetString(ResourceNames.ServiceMustBeAssignable, _resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Formats a localized string similar to 'Rom '{0}' invalid.'.
|
||||
/// </summary>
|
||||
/// <param name="arg0">An object (0) to format.</param>
|
||||
/// <returns>A copy of format string in which the format items have been replaced by the String equivalent of the corresponding instances of Object in arguments.</returns>
|
||||
public static string RomInvalidFormat(object arg0) {
|
||||
return string.Format(_resourceCulture, RomInvalid, arg0);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Formats a localized string similar to 'Service type '{0}' already present.'.
|
||||
/// </summary>
|
||||
/// <param name="arg0">An object (0) to format.</param>
|
||||
/// <returns>A copy of format string in which the format items have been replaced by the String equivalent of the corresponding instances of Object in arguments.</returns>
|
||||
public static string ServiceAlreadyPresentFormat(object arg0) {
|
||||
return string.Format(_resourceCulture, ServiceAlreadyPresent, arg0);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Formats a localized string similar to 'Service type '{0}' must be assignable from service provider '{1}'.'.
|
||||
/// </summary>
|
||||
/// <param name="arg0">An object (0) to format.</param>
|
||||
/// <param name="arg1">An object (1) to format.</param>
|
||||
/// <returns>A copy of format string in which the format items have been replaced by the String equivalent of the corresponding instances of Object in arguments.</returns>
|
||||
public static string ServiceMustBeAssignableFormat(object arg0, object arg1) {
|
||||
return string.Format(_resourceCulture, ServiceMustBeAssignable, arg0, arg1);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Lists all the resource names as constant string fields.
|
||||
/// </summary>
|
||||
public class ResourceNames {
|
||||
|
||||
/// <summary>
|
||||
/// Stores the resource name 'RomInvalid'.
|
||||
/// </summary>
|
||||
public const string RomInvalid = "RomInvalid";
|
||||
|
||||
/// <summary>
|
||||
/// Stores the resource name 'ServiceAlreadyPresent'.
|
||||
/// </summary>
|
||||
public const string ServiceAlreadyPresent = "ServiceAlreadyPresent";
|
||||
|
||||
/// <summary>
|
||||
/// Stores the resource name 'ServiceMustBeAssignable'.
|
||||
/// </summary>
|
||||
public const string ServiceMustBeAssignable = "ServiceMustBeAssignable";
|
||||
}
|
||||
}
|
||||
}
|
129
Virtu/Properties/SR.resx
Normal file
129
Virtu/Properties/SR.resx
Normal file
|
@ -0,0 +1,129 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<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>
|
||||
<data name="ServiceAlreadyPresent" xml:space="preserve">
|
||||
<value>Service type '{0}' already present.</value>
|
||||
</data>
|
||||
<data name="ServiceMustBeAssignable" xml:space="preserve">
|
||||
<value>Service type '{0}' must be assignable from service provider '{1}'.</value>
|
||||
</data>
|
||||
</root>
|
BIN
Virtu/Roms/Printer.rom
Normal file
BIN
Virtu/Roms/Printer.rom
Normal file
Binary file not shown.
9
Virtu/Services/AudioService.cs
Normal file
9
Virtu/Services/AudioService.cs
Normal file
|
@ -0,0 +1,9 @@
|
|||
using System;
|
||||
|
||||
namespace Jellyfish.Virtu.Services
|
||||
{
|
||||
public class AudioService
|
||||
{
|
||||
public virtual void Update() { }
|
||||
}
|
||||
}
|
72
Virtu/Services/GamePortService.cs
Normal file
72
Virtu/Services/GamePortService.cs
Normal file
|
@ -0,0 +1,72 @@
|
|||
namespace Jellyfish.Virtu.Services
|
||||
{
|
||||
public struct Joystick
|
||||
{
|
||||
public Joystick(bool isUp, bool isLeft, bool isRight, bool isDown)
|
||||
{
|
||||
_isUp = isUp;
|
||||
_isLeft = isLeft;
|
||||
_isRight = isRight;
|
||||
_isDown = isDown;
|
||||
}
|
||||
|
||||
public override bool Equals(object obj)
|
||||
{
|
||||
return ((obj is Joystick) && (this == (Joystick)obj));
|
||||
}
|
||||
|
||||
public override int GetHashCode()
|
||||
{
|
||||
return (_isUp.GetHashCode() ^ _isLeft.GetHashCode() ^ _isRight.GetHashCode() ^ _isDown.GetHashCode());
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return !(_isUp || _isDown || _isLeft || _isRight) ? "Position = Center" :
|
||||
string.Concat("Position = ", _isUp ? "Up" : _isDown ? "Down" : string.Empty, _isLeft ? "Left" : _isRight ? "Right" : string.Empty);
|
||||
}
|
||||
|
||||
public static bool operator ==(Joystick joystick1, Joystick joystick2)
|
||||
{
|
||||
return ((joystick1._isUp == joystick2._isUp) && (joystick1._isLeft == joystick2._isLeft) &&
|
||||
(joystick1._isRight == joystick2._isRight) && (joystick1._isDown == joystick2._isDown));
|
||||
}
|
||||
|
||||
public static bool operator !=(Joystick joystick1, Joystick joystick2)
|
||||
{
|
||||
return !(joystick1 == joystick2);
|
||||
}
|
||||
|
||||
public bool IsUp { get { return _isUp; } } // no auto props
|
||||
public bool IsLeft { get { return _isLeft; } }
|
||||
public bool IsRight { get { return _isRight; } }
|
||||
public bool IsDown { get { return _isDown; } }
|
||||
|
||||
private bool _isUp;
|
||||
private bool _isLeft;
|
||||
private bool _isRight;
|
||||
private bool _isDown;
|
||||
}
|
||||
|
||||
public class GamePortService
|
||||
{
|
||||
public GamePortService()
|
||||
{
|
||||
Paddle0 = Paddle1 = Paddle2 = Paddle3 = 255; // not connected
|
||||
}
|
||||
|
||||
public virtual void Update() { }
|
||||
|
||||
public int Paddle0 { get; protected set; }
|
||||
public int Paddle1 { get; protected set; }
|
||||
public int Paddle2 { get; protected set; }
|
||||
public int Paddle3 { get; protected set; }
|
||||
|
||||
public Joystick Joystick0 { get; protected set; }
|
||||
public Joystick Joystick1 { get; protected set; }
|
||||
|
||||
public bool IsButton0Down { get; protected set; }
|
||||
public bool IsButton1Down { get; protected set; }
|
||||
public bool IsButton2Down { get; protected set; }
|
||||
}
|
||||
}
|
68
Virtu/Services/KeyboardService.cs
Normal file
68
Virtu/Services/KeyboardService.cs
Normal file
|
@ -0,0 +1,68 @@
|
|||
using System;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Threading;
|
||||
|
||||
namespace Jellyfish.Virtu.Services
|
||||
{
|
||||
public class AsciiKeyEventArgs : EventArgs
|
||||
{
|
||||
private AsciiKeyEventArgs()
|
||||
{
|
||||
}
|
||||
|
||||
public static AsciiKeyEventArgs Create(int asciiKey)
|
||||
{
|
||||
_instance.AsciiKey = asciiKey;
|
||||
|
||||
return _instance; // use singleton; avoids garbage
|
||||
}
|
||||
|
||||
public int AsciiKey { get; private set; }
|
||||
|
||||
private static readonly AsciiKeyEventArgs _instance = new AsciiKeyEventArgs();
|
||||
}
|
||||
|
||||
public abstract class KeyboardService
|
||||
{
|
||||
public abstract bool IsKeyDown(int key);
|
||||
|
||||
[SuppressMessage("Microsoft.Design", "CA1030:UseEventsWhereAppropriate")]
|
||||
protected void RaiseAsciiKeyDown(int asciiKey)
|
||||
{
|
||||
EventHandler<AsciiKeyEventArgs> handler = AsciiKeyDown;
|
||||
if (handler != null)
|
||||
{
|
||||
handler(this, AsciiKeyEventArgs.Create(asciiKey));
|
||||
}
|
||||
}
|
||||
|
||||
public abstract void Update();
|
||||
|
||||
public void WaitForKeyUp()
|
||||
{
|
||||
while (IsAnyKeyDown)
|
||||
{
|
||||
Thread.Sleep(100);
|
||||
}
|
||||
}
|
||||
|
||||
public void WaitForResetKeyUp()
|
||||
{
|
||||
while (IsResetKeyDown)
|
||||
{
|
||||
Thread.Sleep(100);
|
||||
}
|
||||
}
|
||||
|
||||
public event EventHandler<AsciiKeyEventArgs> AsciiKeyDown;
|
||||
|
||||
public bool IsAnyKeyDown { get; protected set; }
|
||||
public bool IsOpenAppleKeyDown { get; protected set; }
|
||||
public bool IsCloseAppleKeyDown { get; protected set; }
|
||||
public bool IsResetKeyDown { get; protected set; }
|
||||
|
||||
public bool IsCpuThrottleKeyDown { get; protected set; }
|
||||
public bool IsVideoFullScreenKeyDown { get; protected set; }
|
||||
public bool IsVideoMonochromeKeyDown { get; protected set; }
|
||||
}
|
||||
}
|
42
Virtu/Services/MachineServices.cs
Normal file
42
Virtu/Services/MachineServices.cs
Normal file
|
@ -0,0 +1,42 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using Jellyfish.Virtu.Properties;
|
||||
|
||||
namespace Jellyfish.Virtu.Services
|
||||
{
|
||||
public class MachineServices : IServiceProvider
|
||||
{
|
||||
public void AddService(Type serviceType, object serviceProvider)
|
||||
{
|
||||
if (_serviceProviders.ContainsKey(serviceType))
|
||||
{
|
||||
throw new ArgumentException(SR.ServiceAlreadyPresentFormat(serviceType.FullName), "serviceType");
|
||||
}
|
||||
if (!serviceType.IsAssignableFrom(serviceProvider.GetType()))
|
||||
{
|
||||
throw new ArgumentException(SR.ServiceMustBeAssignableFormat(serviceType.FullName, serviceProvider.GetType().FullName));
|
||||
}
|
||||
|
||||
_serviceProviders.Add(serviceType, serviceProvider);
|
||||
}
|
||||
|
||||
[SuppressMessage("Microsoft.Design", "CA1004:GenericMethodsShouldProvideTypeParameter")]
|
||||
public T GetService<T>()
|
||||
{
|
||||
return (T)GetService(typeof(T));
|
||||
}
|
||||
|
||||
public object GetService(Type serviceType)
|
||||
{
|
||||
return _serviceProviders.ContainsKey(serviceType) ? _serviceProviders[serviceType] : null;
|
||||
}
|
||||
|
||||
public void RemoveService(Type serviceType)
|
||||
{
|
||||
_serviceProviders.Remove(serviceType);
|
||||
}
|
||||
|
||||
private Dictionary<Type, object> _serviceProviders = new Dictionary<Type, object>();
|
||||
}
|
||||
}
|
14
Virtu/Services/StorageService.cs
Normal file
14
Virtu/Services/StorageService.cs
Normal file
|
@ -0,0 +1,14 @@
|
|||
using System;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.IO;
|
||||
|
||||
namespace Jellyfish.Virtu.Services
|
||||
{
|
||||
public abstract class StorageService
|
||||
{
|
||||
[SuppressMessage("Microsoft.Design", "CA1024:UsePropertiesWhereAppropriate")]
|
||||
public abstract string GetDiskFile();
|
||||
public abstract void Load(string path, Action<Stream> reader);
|
||||
public abstract void Save(string path, Action<Stream> writer);
|
||||
}
|
||||
}
|
17
Virtu/Services/VideoService.cs
Normal file
17
Virtu/Services/VideoService.cs
Normal file
|
@ -0,0 +1,17 @@
|
|||
using System;
|
||||
|
||||
namespace Jellyfish.Virtu.Services
|
||||
{
|
||||
public abstract class VideoService
|
||||
{
|
||||
public abstract void SetPixel(int x, int y, uint color);
|
||||
public abstract void Update();
|
||||
|
||||
public void ToggleFullScreen()
|
||||
{
|
||||
IsFullScreen ^= true;
|
||||
}
|
||||
|
||||
public bool IsFullScreen { get; private set; }
|
||||
}
|
||||
}
|
77
Virtu/Silverlight/Jellyfish.Virtu.Debug.html
Normal file
77
Virtu/Silverlight/Jellyfish.Virtu.Debug.html
Normal file
|
@ -0,0 +1,77 @@
|
|||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" >
|
||||
<!-- saved from url=(0014)about:internet -->
|
||||
<head>
|
||||
<title>Jellyfish.Virtu</title>
|
||||
|
||||
<style type="text/css">
|
||||
html, body {
|
||||
height: 100%;
|
||||
overflow: auto;
|
||||
}
|
||||
body {
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
}
|
||||
#silverlightControlHost {
|
||||
height: 100%;
|
||||
}
|
||||
</style>
|
||||
|
||||
<script type="text/javascript">
|
||||
function onSilverlightError(sender, args) {
|
||||
|
||||
var appSource = "";
|
||||
if (sender != null && sender != 0) {
|
||||
appSource = sender.getHost().Source;
|
||||
}
|
||||
var errorType = args.ErrorType;
|
||||
var iErrorCode = args.ErrorCode;
|
||||
|
||||
var errMsg = "Unhandled Error in Silverlight Application " + appSource + "\n" ;
|
||||
|
||||
errMsg += "Code: "+ iErrorCode + " \n";
|
||||
errMsg += "Category: " + errorType + " \n";
|
||||
errMsg += "Message: " + args.ErrorMessage + " \n";
|
||||
|
||||
if (errorType == "ParserError")
|
||||
{
|
||||
errMsg += "File: " + args.xamlFile + " \n";
|
||||
errMsg += "Line: " + args.lineNumber + " \n";
|
||||
errMsg += "Position: " + args.charPosition + " \n";
|
||||
}
|
||||
else if (errorType == "RuntimeError")
|
||||
{
|
||||
if (args.lineNumber != 0)
|
||||
{
|
||||
errMsg += "Line: " + args.lineNumber + " \n";
|
||||
errMsg += "Position: " + args.charPosition + " \n";
|
||||
}
|
||||
errMsg += "MethodName: " + args.methodName + " \n";
|
||||
}
|
||||
|
||||
throw new Error(errMsg);
|
||||
}
|
||||
</script>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<!-- Runtime errors from Silverlight will be displayed here.
|
||||
This will contain debugging information and should be removed or hidden when debugging is completed -->
|
||||
<div id='errorLocation' style="font-size: small;color: Gray;"></div>
|
||||
|
||||
<div id="silverlightControlHost">
|
||||
<object data="data:application/x-silverlight-2," type="application/x-silverlight-2" width="100%" height="100%" style="position:absolute;top:0px;left:0px;right:0px;bottom:0px;">
|
||||
<param name="source" value="bin/Jellyfish.Virtu.xap"/>
|
||||
<param name="onerror" value="onSilverlightError" />
|
||||
<param name="background" value="white" />
|
||||
<param name="minRuntimeVersion" value="3.0.40307.0" />
|
||||
<param name="autoUpgrade" value="true" />
|
||||
<a href="http://go.microsoft.com/fwlink/?LinkID=141205" style="text-decoration: none;">
|
||||
<img src="http://go.microsoft.com/fwlink/?LinkId=108181" alt="Get Microsoft Silverlight" style="border-style: none"/>
|
||||
</a>
|
||||
</object>
|
||||
<iframe style='visibility:hidden;height:0;width:0;border:0px'></iframe>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
223
Virtu/Silverlight/Jellyfish.Virtu.Silverlight.csproj
Normal file
223
Virtu/Silverlight/Jellyfish.Virtu.Silverlight.csproj
Normal file
|
@ -0,0 +1,223 @@
|
|||
<Project ToolsVersion="3.5" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProductVersion>9.0.30729</ProductVersion>
|
||||
<SchemaVersion>2.0</SchemaVersion>
|
||||
<ProjectGuid>{5AA9C39E-DB55-4AD9-92EB-E8951D5AD680}</ProjectGuid>
|
||||
<ProjectTypeGuids>{A1591282-1198-4647-A2B1-27E5FF5F6F3B};{fae04ec0-301f-11d3-bf4b-00c04f79efbc}</ProjectTypeGuids>
|
||||
<OutputType>Library</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>Jellyfish.Virtu</RootNamespace>
|
||||
<AssemblyName>Jellyfish.Virtu</AssemblyName>
|
||||
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
|
||||
<SilverlightApplication>true</SilverlightApplication>
|
||||
<SupportedCultures>
|
||||
</SupportedCultures>
|
||||
<XapOutputs>true</XapOutputs>
|
||||
<GenerateSilverlightManifest>true</GenerateSilverlightManifest>
|
||||
<XapFilename>Jellyfish.Virtu.xap</XapFilename>
|
||||
<SilverlightManifestTemplate>Properties\AppManifest.xml</SilverlightManifestTemplate>
|
||||
<SilverlightAppEntry>Jellyfish.Virtu.MainApp</SilverlightAppEntry>
|
||||
<TestPageFileName>TestPage.html</TestPageFileName>
|
||||
<CreateTestPage>true</CreateTestPage>
|
||||
<ValidateXaml>true</ValidateXaml>
|
||||
<ThrowErrorsInValidation>false</ThrowErrorsInValidation>
|
||||
<SignAssembly>true</SignAssembly>
|
||||
<AssemblyOriginatorKeyFile>..\..\Jellyfish.snk</AssemblyOriginatorKeyFile>
|
||||
<UsePlatformExtensions>false</UsePlatformExtensions>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\</OutputPath>
|
||||
<DefineConstants>TRACE;DEBUG;SILVERLIGHT;CODE_ANALYSIS</DefineConstants>
|
||||
<NoStdLib>true</NoStdLib>
|
||||
<NoConfig>true</NoConfig>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
|
||||
<NoWarn>
|
||||
</NoWarn>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\</OutputPath>
|
||||
<DefineConstants>TRACE;SILVERLIGHT;CODE_ANALYSIS</DefineConstants>
|
||||
<NoStdLib>true</NoStdLib>
|
||||
<NoConfig>true</NoConfig>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
|
||||
<NoWarn>
|
||||
</NoWarn>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System.Windows" />
|
||||
<Reference Include="mscorlib" />
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Net" />
|
||||
<Reference Include="System.Xml" />
|
||||
<Reference Include="System.Windows.Browser" />
|
||||
<Reference Include="System.Xml.Linq, Version=2.0.5.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="..\Cassette.cs">
|
||||
<Link>Core\Cassette.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\Cpu.cs">
|
||||
<Link>Core\Cpu.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\CpuData.cs">
|
||||
<Link>Core\CpuData.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\Disk525.cs">
|
||||
<Link>Core\Disk525.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\DiskDsk.cs">
|
||||
<Link>Core\DiskDsk.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\DiskII.cs">
|
||||
<Link>Core\DiskII.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\DiskNib.cs">
|
||||
<Link>Core\DiskNib.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\Drive525.cs">
|
||||
<Link>Core\Drive525.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\GamePort.cs">
|
||||
<Link>Core\GamePort.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\Keyboard.cs">
|
||||
<Link>Core\Keyboard.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\Machine.cs">
|
||||
<Link>Core\Machine.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\MachineComponent.cs">
|
||||
<Link>Core\MachineComponent.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\MachineEvents.cs">
|
||||
<Link>Core\MachineEvents.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\MachineSettings.cs">
|
||||
<Link>Core\MachineSettings.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\Memory.cs">
|
||||
<Link>Core\Memory.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\MemoryData.cs">
|
||||
<Link>Core\MemoryData.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\Properties\SR.Designer.cs">
|
||||
<Link>Properties\SR.Designer.cs</Link>
|
||||
<AutoGen>True</AutoGen>
|
||||
<DesignTime>True</DesignTime>
|
||||
<DependentUpon>SR.resx</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="..\Services\AudioService.cs">
|
||||
<Link>Services\AudioService.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\Services\GamePortService.cs">
|
||||
<Link>Services\GamePortService.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\Services\KeyboardService.cs">
|
||||
<Link>Services\KeyboardService.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\Services\MachineServices.cs">
|
||||
<Link>Services\MachineServices.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\Services\StorageService.cs">
|
||||
<Link>Services\StorageService.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\Services\VideoService.cs">
|
||||
<Link>Services\VideoService.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\Speaker.cs">
|
||||
<Link>Core\Speaker.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\Video.cs">
|
||||
<Link>Core\Video.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\VideoData.cs">
|
||||
<Link>Core\VideoData.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="MainApp.xaml.cs">
|
||||
<DependentUpon>MainApp.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="MainPage.xaml.cs">
|
||||
<DependentUpon>MainPage.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="Services\SilverlightKeyboardService.cs" />
|
||||
<Compile Include="Services\SilverlightStorageService.cs" />
|
||||
<Compile Include="Services\SilverlightVideoService.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ApplicationDefinition Include="MainApp.xaml">
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
</ApplicationDefinition>
|
||||
<Page Include="MainPage.xaml">
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
</Page>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Resource Include="..\Roms\Apple2e.rom">
|
||||
<Link>Roms\Apple2e.rom</Link>
|
||||
</Resource>
|
||||
<Resource Include="..\Roms\Printer.rom">
|
||||
<Link>Roms\Printer.rom</Link>
|
||||
</Resource>
|
||||
<None Include="Properties\AppManifest.xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<EmbeddedResource Include="..\Properties\SR.resx">
|
||||
<Link>Properties\SR.resx</Link>
|
||||
<Generator>ResXFileCodeGeneratorEx</Generator>
|
||||
<LastGenOutput>SR.Designer.cs</LastGenOutput>
|
||||
</EmbeddedResource>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\Library\Silverlight\Jellyfish.Library.Silverlight.csproj">
|
||||
<Project>{DAB11A70-D08B-4A96-8A54-E81B1DE39681}</Project>
|
||||
<Name>Jellyfish.Library.Silverlight</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<CodeAnalysisDictionary Include="..\CustomDictionary.xml">
|
||||
<Link>CustomDictionary.xml</Link>
|
||||
</CodeAnalysisDictionary>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="Jellyfish.Virtu.html">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</None>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="Jellyfish.Virtu.Debug.html" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildExtensionsPath)\Microsoft\Silverlight\v3.0\Microsoft.Silverlight.CSharp.targets" Condition="" />
|
||||
<!-- 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.
|
||||
<Target Name="BeforeBuild">
|
||||
</Target>
|
||||
<Target Name="AfterBuild">
|
||||
</Target>
|
||||
-->
|
||||
<ProjectExtensions>
|
||||
<VisualStudio>
|
||||
<FlavorProperties GUID="{A1591282-1198-4647-A2B1-27E5FF5F6F3B}">
|
||||
<SilverlightProjectProperties />
|
||||
</FlavorProperties>
|
||||
</VisualStudio>
|
||||
</ProjectExtensions>
|
||||
<PropertyGroup>
|
||||
<PostBuildEvent>del $(TargetDir)TestPage.html</PostBuildEvent>
|
||||
</PropertyGroup>
|
||||
</Project>
|
26
Virtu/Silverlight/Jellyfish.Virtu.Silverlight.sln
Normal file
26
Virtu/Silverlight/Jellyfish.Virtu.Silverlight.sln
Normal file
|
@ -0,0 +1,26 @@
|
|||
|
||||
Microsoft Visual Studio Solution File, Format Version 10.00
|
||||
# Visual Studio 2008
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Jellyfish.Virtu.Silverlight", "Jellyfish.Virtu.Silverlight.csproj", "{5AA9C39E-DB55-4AD9-92EB-E8951D5AD680}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Jellyfish.Library.Silverlight", "..\..\Library\Silverlight\Jellyfish.Library.Silverlight.csproj", "{DAB11A70-D08B-4A96-8A54-E81B1DE39681}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Release|Any CPU = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{5AA9C39E-DB55-4AD9-92EB-E8951D5AD680}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{5AA9C39E-DB55-4AD9-92EB-E8951D5AD680}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{5AA9C39E-DB55-4AD9-92EB-E8951D5AD680}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{5AA9C39E-DB55-4AD9-92EB-E8951D5AD680}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{DAB11A70-D08B-4A96-8A54-E81B1DE39681}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{DAB11A70-D08B-4A96-8A54-E81B1DE39681}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{DAB11A70-D08B-4A96-8A54-E81B1DE39681}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{DAB11A70-D08B-4A96-8A54-E81B1DE39681}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
EndGlobal
|
77
Virtu/Silverlight/Jellyfish.Virtu.html
Normal file
77
Virtu/Silverlight/Jellyfish.Virtu.html
Normal file
|
@ -0,0 +1,77 @@
|
|||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" >
|
||||
<!-- saved from url=(0014)about:internet -->
|
||||
<head>
|
||||
<title>Jellyfish.Virtu</title>
|
||||
|
||||
<style type="text/css">
|
||||
html, body {
|
||||
height: 100%;
|
||||
overflow: auto;
|
||||
}
|
||||
body {
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
}
|
||||
#silverlightControlHost {
|
||||
height: 100%;
|
||||
}
|
||||
</style>
|
||||
|
||||
<script type="text/javascript">
|
||||
function onSilverlightError(sender, args) {
|
||||
|
||||
var appSource = "";
|
||||
if (sender != null && sender != 0) {
|
||||
appSource = sender.getHost().Source;
|
||||
}
|
||||
var errorType = args.ErrorType;
|
||||
var iErrorCode = args.ErrorCode;
|
||||
|
||||
var errMsg = "Unhandled Error in Silverlight Application " + appSource + "\n" ;
|
||||
|
||||
errMsg += "Code: "+ iErrorCode + " \n";
|
||||
errMsg += "Category: " + errorType + " \n";
|
||||
errMsg += "Message: " + args.ErrorMessage + " \n";
|
||||
|
||||
if (errorType == "ParserError")
|
||||
{
|
||||
errMsg += "File: " + args.xamlFile + " \n";
|
||||
errMsg += "Line: " + args.lineNumber + " \n";
|
||||
errMsg += "Position: " + args.charPosition + " \n";
|
||||
}
|
||||
else if (errorType == "RuntimeError")
|
||||
{
|
||||
if (args.lineNumber != 0)
|
||||
{
|
||||
errMsg += "Line: " + args.lineNumber + " \n";
|
||||
errMsg += "Position: " + args.charPosition + " \n";
|
||||
}
|
||||
errMsg += "MethodName: " + args.methodName + " \n";
|
||||
}
|
||||
|
||||
throw new Error(errMsg);
|
||||
}
|
||||
</script>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<!-- Runtime errors from Silverlight will be displayed here.
|
||||
This will contain debugging information and should be removed or hidden when debugging is completed -->
|
||||
<div id='errorLocation' style="font-size: small;color: Gray;"></div>
|
||||
|
||||
<div id="silverlightControlHost">
|
||||
<object data="data:application/x-silverlight-2," type="application/x-silverlight-2" width="100%" height="100%" style="position:absolute;top:0px;left:0px;right:0px;bottom:0px;">
|
||||
<param name="source" value="Jellyfish.Virtu.xap"/>
|
||||
<param name="onerror" value="onSilverlightError" />
|
||||
<param name="background" value="white" />
|
||||
<param name="minRuntimeVersion" value="3.0.40307.0" />
|
||||
<param name="autoUpgrade" value="true" />
|
||||
<a href="http://go.microsoft.com/fwlink/?LinkID=141205" style="text-decoration: none;">
|
||||
<img src="http://go.microsoft.com/fwlink/?LinkId=108181" alt="Get Microsoft Silverlight" style="border-style: none"/>
|
||||
</a>
|
||||
</object>
|
||||
<iframe style='visibility:hidden;height:0;width:0;border:0px'></iframe>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
11
Virtu/Silverlight/MainApp.xaml
Normal file
11
Virtu/Silverlight/MainApp.xaml
Normal file
|
@ -0,0 +1,11 @@
|
|||
<jl:ApplicationBase x:Class="Jellyfish.Virtu.MainApp"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:jl="clr-namespace:Jellyfish.Library;assembly=Jellyfish.Library"
|
||||
xmlns:jv="clr-namespace:Jellyfish.Virtu;assembly=Jellyfish.Virtu">
|
||||
<Application.RootVisual>
|
||||
<jv:MainPage/>
|
||||
</Application.RootVisual>
|
||||
<Application.Resources>
|
||||
</Application.Resources>
|
||||
</jl:ApplicationBase>
|
13
Virtu/Silverlight/MainApp.xaml.cs
Normal file
13
Virtu/Silverlight/MainApp.xaml.cs
Normal file
|
@ -0,0 +1,13 @@
|
|||
using Jellyfish.Library;
|
||||
|
||||
namespace Jellyfish.Virtu
|
||||
{
|
||||
public partial class MainApp : ApplicationBase
|
||||
{
|
||||
public MainApp() :
|
||||
base("Virtu")
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
11
Virtu/Silverlight/MainPage.xaml
Normal file
11
Virtu/Silverlight/MainPage.xaml
Normal file
|
@ -0,0 +1,11 @@
|
|||
<UserControl x:Class="Jellyfish.Virtu.MainPage"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:jl="clr-namespace:Jellyfish.Library;assembly=Jellyfish.Library"
|
||||
xmlns:jv="clr-namespace:Jellyfish.Virtu;assembly=Jellyfish.Virtu">
|
||||
<Grid Background="Black" Cursor="None">
|
||||
<Image Name="_image" MinWidth="560" MinHeight="384"/>
|
||||
|
||||
<jl:FrameRateCounter/>
|
||||
</Grid>
|
||||
</UserControl>
|
60
Virtu/Silverlight/MainPage.xaml.cs
Normal file
60
Virtu/Silverlight/MainPage.xaml.cs
Normal file
|
@ -0,0 +1,60 @@
|
|||
using System;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Media;
|
||||
using Jellyfish.Virtu.Services;
|
||||
using System.Windows.Input;
|
||||
|
||||
namespace Jellyfish.Virtu
|
||||
{
|
||||
public partial class MainPage : UserControl
|
||||
{
|
||||
public MainPage()
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
_storageService = new SilverlightStorageService(this);
|
||||
_keyboardService = new SilverlightKeyboardService(this);
|
||||
_gamePortService = new GamePortService(); // not connected
|
||||
_audioService = new AudioService(); // not connected
|
||||
_videoService = new SilverlightVideoService(_image);
|
||||
|
||||
_machine = new Machine();
|
||||
_machine.Services.AddService(typeof(StorageService), _storageService);
|
||||
_machine.Services.AddService(typeof(KeyboardService), _keyboardService);
|
||||
_machine.Services.AddService(typeof(GamePortService), _gamePortService);
|
||||
_machine.Services.AddService(typeof(AudioService), _audioService);
|
||||
_machine.Services.AddService(typeof(VideoService), _videoService);
|
||||
|
||||
Loaded += MainPage_Loaded;
|
||||
CompositionTarget.Rendering += CompositionTarget_Rendering;
|
||||
Application.Current.Exit += MainApp_Exit;
|
||||
}
|
||||
|
||||
private void MainPage_Loaded(object sender, RoutedEventArgs e)
|
||||
{
|
||||
_machine.Start();
|
||||
}
|
||||
|
||||
private void CompositionTarget_Rendering(object sender, EventArgs e)
|
||||
{
|
||||
_keyboardService.Update();
|
||||
_gamePortService.Update();
|
||||
_audioService.Update();
|
||||
_videoService.Update();
|
||||
}
|
||||
|
||||
private void MainApp_Exit(object sender, EventArgs e)
|
||||
{
|
||||
_machine.Stop();
|
||||
}
|
||||
|
||||
private StorageService _storageService;
|
||||
private KeyboardService _keyboardService;
|
||||
private GamePortService _gamePortService;
|
||||
private AudioService _audioService;
|
||||
private VideoService _videoService;
|
||||
|
||||
private Machine _machine;
|
||||
}
|
||||
}
|
13
Virtu/Silverlight/Properties/AppManifest.xml
Normal file
13
Virtu/Silverlight/Properties/AppManifest.xml
Normal file
|
@ -0,0 +1,13 @@
|
|||
<Deployment xmlns="http://schemas.microsoft.com/client/2007/deployment"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
|
||||
<Deployment.ApplicationIdentity>
|
||||
<ApplicationIdentity ShortName="Virtu" Title="Virtu" Blurb="Apple IIe Emulator">
|
||||
<!--<ApplicationIdentity.Icons>
|
||||
<Icon Size="16x16">Properties/Apple16.png</Icon>
|
||||
<Icon Size="32x32">Properties/Apple32.png</Icon>
|
||||
<Icon Size="48x48">Properties/Apple48.png</Icon>
|
||||
<Icon Size="128x128">Properties/Apple128.png</Icon>
|
||||
</ApplicationIdentity.Icons>-->
|
||||
</ApplicationIdentity>
|
||||
</Deployment.ApplicationIdentity>
|
||||
</Deployment>
|
21
Virtu/Silverlight/Properties/AssemblyInfo.cs
Normal file
21
Virtu/Silverlight/Properties/AssemblyInfo.cs
Normal file
|
@ -0,0 +1,21 @@
|
|||
using System;
|
||||
using System.Reflection;
|
||||
using System.Resources;
|
||||
using System.Runtime.InteropServices;
|
||||
using Jellyfish.Library;
|
||||
|
||||
[assembly: AssemblyTitle("Virtu")]
|
||||
[assembly: AssemblyDescription("Apple IIe Emulator")]
|
||||
[assembly: AssemblyProduct("Jellyfish.Virtu.Silverlight")]
|
||||
[assembly: AssemblyCompany("Digital Jellyfish Design Ltd")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2009 Digital Jellyfish Design Ltd")]
|
||||
[assembly: AssemblyComment("Developed by Sean Fausett & Nick Westgate")]
|
||||
|
||||
[assembly: AssemblyVersion("0.6.0.0")]
|
||||
[assembly: AssemblyFileVersion("0.6.0.0")]
|
||||
|
||||
[assembly: CLSCompliant(false)]
|
||||
[assembly: ComVisible(false)]
|
||||
[assembly: Guid("89a50370-1ed9-4cf1-ad08-043b6e6f3c90")]
|
||||
|
||||
[assembly: NeutralResourcesLanguage("en")]
|
382
Virtu/Silverlight/Services/SilverlightKeyboardService.cs
Normal file
382
Virtu/Silverlight/Services/SilverlightKeyboardService.cs
Normal file
|
@ -0,0 +1,382 @@
|
|||
using System;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Linq;
|
||||
using System.Windows;
|
||||
using System.Windows.Browser;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Input;
|
||||
|
||||
namespace Jellyfish.Virtu.Services
|
||||
{
|
||||
public sealed class SilverlightKeyboardService : KeyboardService
|
||||
{
|
||||
public SilverlightKeyboardService(UserControl page)
|
||||
{
|
||||
_page = page;
|
||||
|
||||
_page.LostFocus += Page_LostFocus;
|
||||
_page.KeyDown += Page_KeyDown;
|
||||
_page.KeyUp += Page_KeyUp;
|
||||
}
|
||||
|
||||
public override bool IsKeyDown(int key)
|
||||
{
|
||||
return IsKeyDown((Key)key);
|
||||
}
|
||||
|
||||
public override void Update()
|
||||
{
|
||||
if (_updateAnyKeyDown) // SL is missing access to keyboard state; could lose track of keyboard state after Alt+Tab
|
||||
{
|
||||
_updateAnyKeyDown = false;
|
||||
IsAnyKeyDown = false;
|
||||
foreach (Key key in KeyValues)
|
||||
{
|
||||
if (IsKeyDown(key))
|
||||
{
|
||||
IsAnyKeyDown = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ModifierKeys modifiers = System.Windows.Input.Keyboard.Modifiers;
|
||||
IsOpenAppleKeyDown = ((modifiers & (ModifierKeys.Control | ModifierKeys.Alt)) == (ModifierKeys.Control | ModifierKeys.Alt)) ||
|
||||
(((modifiers & ModifierKeys.Control) != 0) && IsKeyDown(Key.Left));
|
||||
IsCloseAppleKeyDown = ((modifiers & (ModifierKeys.Control | ModifierKeys.Windows)) == (ModifierKeys.Control | ModifierKeys.Windows)) ||
|
||||
(((modifiers & ModifierKeys.Control) != 0) && IsKeyDown(Key.Right));
|
||||
IsResetKeyDown = ((modifiers & ModifierKeys.Control) != 0) && (IsKeyDown(Key.F12) || IsKeyDown(Key.Up));
|
||||
|
||||
IsCpuThrottleKeyDown = IsKeyDown(Key.F8);
|
||||
IsVideoFullScreenKeyDown = IsKeyDown(Key.F11);
|
||||
IsVideoMonochromeKeyDown = IsKeyDown(Key.F9);
|
||||
}
|
||||
|
||||
private bool IsKeyDown(Key key)
|
||||
{
|
||||
return _states[(int)key];
|
||||
}
|
||||
|
||||
private void Page_LostFocus(object sender, RoutedEventArgs e) // reset keyboard state on lost focus; can't access keyboard state on got focus
|
||||
{
|
||||
IsAnyKeyDown = false;
|
||||
foreach (Key key in KeyValues)
|
||||
{
|
||||
_states[(int)key] = false;
|
||||
}
|
||||
}
|
||||
|
||||
private void Page_KeyDown(object sender, KeyEventArgs e)
|
||||
{
|
||||
_states[(int)e.Key] = true;
|
||||
IsAnyKeyDown = true;
|
||||
|
||||
int asciiKey = GetAsciiKey(e.Key, e.PlatformKeyCode);
|
||||
if (asciiKey >= 0)
|
||||
{
|
||||
RaiseAsciiKeyDown(asciiKey);
|
||||
e.Handled = true;
|
||||
}
|
||||
}
|
||||
|
||||
private void Page_KeyUp(object sender, KeyEventArgs e)
|
||||
{
|
||||
_capsLock ^= (e.Key == Key.CapsLock); // SL is missing caps lock support; try to track manually
|
||||
_states[(int)e.Key] = false;
|
||||
_updateAnyKeyDown = true;
|
||||
}
|
||||
|
||||
[SuppressMessage("Microsoft.Maintainability", "CA1502:AvoidExcessiveComplexity")]
|
||||
[SuppressMessage("Microsoft.Maintainability", "CA1505:AvoidUnmaintainableCode")]
|
||||
private int GetAsciiKey(Key key, int platformKeyCode)
|
||||
{
|
||||
ModifierKeys modifiers = System.Windows.Input.Keyboard.Modifiers;
|
||||
bool control = ((modifiers & ModifierKeys.Control) == ModifierKeys.Control);
|
||||
bool shift = ((modifiers & ModifierKeys.Shift) == ModifierKeys.Shift);
|
||||
bool capsLock = shift ^ _capsLock;
|
||||
|
||||
switch (key)
|
||||
{
|
||||
case Key.Left:
|
||||
return 0x08;
|
||||
|
||||
case Key.Tab:
|
||||
return 0x09;
|
||||
|
||||
case Key.Down:
|
||||
return 0x0A;
|
||||
|
||||
case Key.Up:
|
||||
return 0x0B;
|
||||
|
||||
case Key.Enter:
|
||||
return 0x0D;
|
||||
|
||||
case Key.Right:
|
||||
return 0x15;
|
||||
|
||||
case Key.Escape:
|
||||
return 0x1B;
|
||||
|
||||
case Key.Back:
|
||||
return 0x7F;
|
||||
|
||||
case Key.Space:
|
||||
return ' ';
|
||||
|
||||
case Key.D1:
|
||||
return shift ? '!' : '1';
|
||||
|
||||
case Key.D2:
|
||||
return control ? 0x00 : shift ? '@' : '2';
|
||||
|
||||
case Key.D3:
|
||||
return shift ? '#' : '3';
|
||||
|
||||
case Key.D4:
|
||||
return shift ? '$' : '4';
|
||||
|
||||
case Key.D5:
|
||||
return shift ? '%' : '5';
|
||||
|
||||
case Key.D6:
|
||||
return control ? 0x1E : shift ? '^' : '6';
|
||||
|
||||
case Key.D7:
|
||||
return shift ? '&' : '7';
|
||||
|
||||
case Key.D8:
|
||||
return shift ? '*' : '8';
|
||||
|
||||
case Key.D9:
|
||||
return shift ? '(' : '9';
|
||||
|
||||
case Key.D0:
|
||||
return shift ? ')' : '0';
|
||||
|
||||
case Key.A:
|
||||
return control ? 0x01 : capsLock ? 'A' : 'a';
|
||||
|
||||
case Key.B:
|
||||
return control ? 0x02 : capsLock ? 'B' : 'b';
|
||||
|
||||
case Key.C:
|
||||
return control ? 0x03 : capsLock ? 'C' : 'c';
|
||||
|
||||
case Key.D:
|
||||
return control ? 0x04 : capsLock ? 'D' : 'd';
|
||||
|
||||
case Key.E:
|
||||
return control ? 0x05 : capsLock ? 'E' : 'e';
|
||||
|
||||
case Key.F:
|
||||
return control ? 0x06 : capsLock ? 'F' : 'f';
|
||||
|
||||
case Key.G:
|
||||
return control ? 0x07 : capsLock ? 'G' : 'g';
|
||||
|
||||
case Key.H:
|
||||
return control ? 0x08 : capsLock ? 'H' : 'h';
|
||||
|
||||
case Key.I:
|
||||
return control ? 0x09 : capsLock ? 'I' : 'i';
|
||||
|
||||
case Key.J:
|
||||
return control ? 0x0A : capsLock ? 'J' : 'j';
|
||||
|
||||
case Key.K:
|
||||
return control ? 0x0B : capsLock ? 'K' : 'k';
|
||||
|
||||
case Key.L:
|
||||
return control ? 0x0C : capsLock ? 'L' : 'l';
|
||||
|
||||
case Key.M:
|
||||
return control ? 0x0D : capsLock ? 'M' : 'm';
|
||||
|
||||
case Key.N:
|
||||
return control ? 0x0E : capsLock ? 'N' : 'n';
|
||||
|
||||
case Key.O:
|
||||
return control ? 0x0F : capsLock ? 'O' : 'o';
|
||||
|
||||
case Key.P:
|
||||
return control ? 0x10 : capsLock ? 'P' : 'p';
|
||||
|
||||
case Key.Q:
|
||||
return control ? 0x11 : capsLock ? 'Q' : 'q';
|
||||
|
||||
case Key.R:
|
||||
return control ? 0x12 : capsLock ? 'R' : 'r';
|
||||
|
||||
case Key.S:
|
||||
return control ? 0x13 : capsLock ? 'S' : 's';
|
||||
|
||||
case Key.T:
|
||||
return control ? 0x14 : capsLock ? 'T' : 't';
|
||||
|
||||
case Key.U:
|
||||
return control ? 0x15 : capsLock ? 'U' : 'u';
|
||||
|
||||
case Key.V:
|
||||
return control ? 0x16 : capsLock ? 'V' : 'v';
|
||||
|
||||
case Key.W:
|
||||
return control ? 0x17 : capsLock ? 'W' : 'w';
|
||||
|
||||
case Key.X:
|
||||
return control ? 0x18 : capsLock ? 'X' : 'x';
|
||||
|
||||
case Key.Y:
|
||||
return control ? 0x19 : capsLock ? 'Y' : 'y';
|
||||
|
||||
case Key.Z:
|
||||
return control ? 0x1A : capsLock ? 'Z' : 'z';
|
||||
|
||||
case Key.Unknown:
|
||||
if (Application.Current.RunningOffline)
|
||||
{
|
||||
// SL cannot access HtmlPage.BrowserInformation.Platform when out of browser
|
||||
}
|
||||
else if (HtmlPage.BrowserInformation.Platform.Equals("Win32", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
switch (platformKeyCode)
|
||||
{
|
||||
case 0xBA: // WinForms Keys.Oem1
|
||||
return shift ? ':' : ';';
|
||||
|
||||
case 0xBF: // WinForms Keys.Oem2
|
||||
return shift ? '?' : '/';
|
||||
|
||||
case 0xC0: // WinForms Keys.Oem3
|
||||
return shift ? '~' : '`';
|
||||
|
||||
case 0xDB: // WinForms Keys.Oem4
|
||||
return shift ? '{' : '[';
|
||||
|
||||
case 0xDC: // WinForms Keys.Oem5
|
||||
return control ? 0x1C : shift ? '|' : '\\';
|
||||
|
||||
case 0xDD: // WinForms Keys.Oem6
|
||||
return control ? 0x1D : shift ? '}' : ']';
|
||||
|
||||
case 0xDE: // WinForms Keys.Oem7
|
||||
return shift ? '"' : '\'';
|
||||
|
||||
case 0xBD: // WinForms Keys.OemMinus
|
||||
return control ? 0x1F : shift ? '_' : '-';
|
||||
|
||||
case 0xBB: // WinForms Keys.OemPlus
|
||||
return shift ? '+' : '=';
|
||||
|
||||
case 0xBC: // WinForms Keys.OemComma
|
||||
return shift ? '<' : ',';
|
||||
|
||||
case 0xBE: // WinForms Keys.OemPeriod
|
||||
return shift ? '>' : '.';
|
||||
}
|
||||
}
|
||||
else if (HtmlPage.BrowserInformation.Platform.Equals("MacIntel", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
switch (platformKeyCode)
|
||||
{
|
||||
case 0x29:
|
||||
return shift ? ':' : ';';
|
||||
|
||||
case 0x2C:
|
||||
return shift ? '?' : '/';
|
||||
|
||||
case 0x32:
|
||||
return shift ? '~' : '`';
|
||||
|
||||
case 0x21:
|
||||
return shift ? '{' : '[';
|
||||
|
||||
case 0x2A:
|
||||
return control ? 0x1C : shift ? '|' : '\\';
|
||||
|
||||
case 0x1E:
|
||||
return control ? 0x1D : shift ? '}' : ']';
|
||||
|
||||
case 0x27:
|
||||
return shift ? '"' : '\'';
|
||||
|
||||
case 0x1B:
|
||||
return control ? 0x1F : shift ? '_' : '-';
|
||||
|
||||
case 0x18:
|
||||
return shift ? '+' : '=';
|
||||
|
||||
case 0x2B:
|
||||
return shift ? '<' : ',';
|
||||
|
||||
case 0x2F:
|
||||
return shift ? '>' : '.';
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case Key.NumPad1:
|
||||
return '1';
|
||||
|
||||
case Key.NumPad2:
|
||||
return '2';
|
||||
|
||||
case Key.NumPad3:
|
||||
return '3';
|
||||
|
||||
case Key.NumPad4:
|
||||
return '4';
|
||||
|
||||
case Key.NumPad5:
|
||||
return '5';
|
||||
|
||||
case Key.NumPad6:
|
||||
return '6';
|
||||
|
||||
case Key.NumPad7:
|
||||
return '7';
|
||||
|
||||
case Key.NumPad8:
|
||||
return '8';
|
||||
|
||||
case Key.NumPad9:
|
||||
return '9';
|
||||
|
||||
case Key.NumPad0:
|
||||
return '0';
|
||||
|
||||
case Key.Decimal:
|
||||
return '.';
|
||||
|
||||
case Key.Divide:
|
||||
return '/';
|
||||
|
||||
case Key.Multiply:
|
||||
return '*';
|
||||
|
||||
case Key.Subtract:
|
||||
return '-';
|
||||
|
||||
case Key.Add:
|
||||
return '+';
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
private static readonly Key[] KeyValues =
|
||||
(from key in
|
||||
(from field in typeof(Key).GetFields() // missing Enum.GetValues; use reflection
|
||||
where field.IsLiteral
|
||||
select (Key)field.GetValue(typeof(Key)))
|
||||
where (key != Key.None) // filter Key.None
|
||||
select key).ToArray();
|
||||
|
||||
private static readonly int KeyCount = (int)(KeyValues.Max()) + 1;
|
||||
|
||||
private UserControl _page;
|
||||
private bool[] _states = new bool[KeyCount];
|
||||
private bool _capsLock;
|
||||
private bool _updateAnyKeyDown;
|
||||
}
|
||||
}
|
84
Virtu/Silverlight/Services/SilverlightStorageService.cs
Normal file
84
Virtu/Silverlight/Services/SilverlightStorageService.cs
Normal file
|
@ -0,0 +1,84 @@
|
|||
using System;
|
||||
using System.IO;
|
||||
using System.IO.IsolatedStorage;
|
||||
using System.Threading;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Threading;
|
||||
|
||||
namespace Jellyfish.Virtu.Services
|
||||
{
|
||||
public sealed class SilverlightStorageService : StorageService
|
||||
{
|
||||
public SilverlightStorageService(UserControl page)
|
||||
{
|
||||
_dispatcher = page.Dispatcher;
|
||||
}
|
||||
|
||||
public override string GetDiskFile()
|
||||
{
|
||||
string fileName = string.Empty;
|
||||
|
||||
// TODO
|
||||
//ManualResetEvent syncEvent = new ManualResetEvent(false);
|
||||
//DispatcherOperation operation = _dispatcher.BeginInvoke(() =>
|
||||
//{
|
||||
// try
|
||||
// {
|
||||
// OpenFileDialog dialog = new OpenFileDialog(); // SL expects all dialogs to be user initiated, ie from within an event handler.
|
||||
// dialog.Filter = "Disk Files (*.nib)|*.nib|All Files (*.*)|*.*";
|
||||
// bool? result = dialog.ShowDialog();
|
||||
// if (result.HasValue && result.Value)
|
||||
// {
|
||||
// fileName = dialog.File.FullName;
|
||||
// }
|
||||
// }
|
||||
// finally
|
||||
// {
|
||||
// syncEvent.Set();
|
||||
// }
|
||||
//});
|
||||
//syncEvent.WaitOne();
|
||||
|
||||
return fileName;
|
||||
}
|
||||
|
||||
public override void Load(string path, Action<Stream> reader)
|
||||
{
|
||||
try
|
||||
{
|
||||
using (IsolatedStorageFile store = IsolatedStorageFile.GetUserStoreForApplication())
|
||||
{
|
||||
using (IsolatedStorageFileStream stream = new IsolatedStorageFileStream(path, FileMode.Open, FileAccess.Read, FileShare.Read, store))
|
||||
{
|
||||
reader(stream);
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (FileNotFoundException)
|
||||
{
|
||||
}
|
||||
catch (IsolatedStorageException)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
public override void Save(string path, Action<Stream> writer)
|
||||
{
|
||||
try
|
||||
{
|
||||
using (IsolatedStorageFile store = IsolatedStorageFile.GetUserStoreForApplication())
|
||||
{
|
||||
using (IsolatedStorageFileStream stream = new IsolatedStorageFileStream(path, FileMode.Create, FileAccess.Write, FileShare.None, store))
|
||||
{
|
||||
writer(stream);
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (IsolatedStorageException)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
private Dispatcher _dispatcher;
|
||||
}
|
||||
}
|
84
Virtu/Silverlight/Services/SilverlightVideoService.cs
Normal file
84
Virtu/Silverlight/Services/SilverlightVideoService.cs
Normal file
|
@ -0,0 +1,84 @@
|
|||
using System;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Interop;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media.Imaging;
|
||||
|
||||
namespace Jellyfish.Virtu.Services
|
||||
{
|
||||
public sealed class SilverlightVideoService : VideoService
|
||||
{
|
||||
public SilverlightVideoService(Image image)
|
||||
{
|
||||
_image = image;
|
||||
SetImageSize();
|
||||
|
||||
_bitmap = new WriteableBitmap(BitmapWidth, BitmapHeight, BitmapPixelFormat);
|
||||
_pixels = new uint[BitmapWidth * BitmapHeight];
|
||||
|
||||
Application.Current.Host.Content.Resized += (sender, e) => SetImageSize();
|
||||
}
|
||||
|
||||
[SuppressMessage("Microsoft.Usage", "CA2233:OperationsShouldNotOverflow", MessageId = "y*560")]
|
||||
public override void SetPixel(int x, int y, uint color)
|
||||
{
|
||||
_pixels[y * BitmapWidth + x] = color;
|
||||
_pixelsDirty = true;
|
||||
}
|
||||
|
||||
public override void Update()
|
||||
{
|
||||
if (Application.Current.RunningOffline && /*_window.IsActive &&*/ (_isFullScreen != IsFullScreen))
|
||||
{
|
||||
if (IsFullScreen) // SL is missing out of browser window control
|
||||
{
|
||||
//_window.SizeToContent = SizeToContent.Manual;
|
||||
//_window.Topmost = true;
|
||||
//_window.WindowStyle = WindowStyle.None;
|
||||
//_window.WindowState = WindowState.Maximized;
|
||||
}
|
||||
else
|
||||
{
|
||||
//_window.WindowState = WindowState.Normal;
|
||||
//_window.WindowStyle = WindowStyle.SingleBorderWindow;
|
||||
//_window.Topmost = false;
|
||||
//_window.SizeToContent = SizeToContent.WidthAndHeight;
|
||||
}
|
||||
_isFullScreen = IsFullScreen;
|
||||
}
|
||||
|
||||
if (_pixelsDirty)
|
||||
{
|
||||
_pixelsDirty = false;
|
||||
_bitmap.Lock();
|
||||
for (int i = 0; i < BitmapWidth * BitmapHeight; i++)
|
||||
{
|
||||
_bitmap[i] = (int)_pixels[i];
|
||||
}
|
||||
_bitmap.Invalidate();
|
||||
_bitmap.Unlock();
|
||||
_image.Source = _bitmap; // shouldn't have to set source each frame; SL bug?
|
||||
}
|
||||
}
|
||||
|
||||
private void SetImageSize()
|
||||
{
|
||||
Content content = Application.Current.Host.Content;
|
||||
int uniformScale = Math.Min((int)content.ActualWidth / BitmapWidth, (int)content.ActualHeight / BitmapHeight);
|
||||
_image.Width = uniformScale * BitmapWidth;
|
||||
_image.Height = uniformScale * BitmapHeight;
|
||||
}
|
||||
|
||||
private const int BitmapWidth = 560;
|
||||
private const int BitmapHeight = 384;
|
||||
private static readonly PixelFormat BitmapPixelFormat = PixelFormats.Bgr32;
|
||||
|
||||
private Image _image;
|
||||
private WriteableBitmap _bitmap;
|
||||
private uint[] _pixels;
|
||||
private bool _pixelsDirty;
|
||||
private bool _isFullScreen;
|
||||
}
|
||||
}
|
24
Virtu/Speaker.cs
Normal file
24
Virtu/Speaker.cs
Normal file
|
@ -0,0 +1,24 @@
|
|||
using Jellyfish.Virtu.Services;
|
||||
|
||||
namespace Jellyfish.Virtu
|
||||
{
|
||||
public sealed class Speaker : MachineComponent
|
||||
{
|
||||
public Speaker(Machine machine) :
|
||||
base(machine)
|
||||
{
|
||||
}
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
_audioService = Machine.Services.GetService<AudioService>();
|
||||
}
|
||||
|
||||
public void ToggleOutput()
|
||||
{
|
||||
// TODO
|
||||
}
|
||||
|
||||
private AudioService _audioService;
|
||||
}
|
||||
}
|
974
Virtu/Video.cs
Normal file
974
Virtu/Video.cs
Normal file
|
@ -0,0 +1,974 @@
|
|||
using System;
|
||||
using Jellyfish.Virtu.Properties;
|
||||
using Jellyfish.Virtu.Services;
|
||||
using Jellyfish.Virtu.Settings;
|
||||
|
||||
namespace Jellyfish.Virtu
|
||||
{
|
||||
public sealed partial class Video : MachineComponent
|
||||
{
|
||||
public Video(Machine machine) :
|
||||
base(machine)
|
||||
{
|
||||
_flushRowEvent = FlushRowEvent; // cache delegates; avoids garbage
|
||||
_inverseTextEvent = InverseTextEvent;
|
||||
_leaveVBlankEvent = LeaveVBlankEvent;
|
||||
_resetVSyncEvent = ResetVSyncEvent;
|
||||
|
||||
FlushRowMode = new Action<int>[ModeCount]
|
||||
{
|
||||
FlushRowMode0, FlushRowMode1, FlushRowMode2, FlushRowMode3, FlushRowMode4, FlushRowMode5, FlushRowMode6, FlushRowMode7,
|
||||
FlushRowMode8, FlushRowMode9, FlushRowModeA, FlushRowModeB, FlushRowModeC, FlushRowModeD, FlushRowModeE, FlushRowModeF
|
||||
};
|
||||
}
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
_memory = Machine.Memory;
|
||||
_videoService = Machine.Services.GetService<VideoService>();
|
||||
|
||||
UpdateSettings();
|
||||
IsVBlank = true;
|
||||
|
||||
Machine.Events.AddEvent((CyclesPerVBlank / 2), _leaveVBlankEvent);
|
||||
Machine.Events.AddEvent(CyclesPerVSync, _resetVSyncEvent);
|
||||
Machine.Events.AddEvent(CyclesPerFlash, _inverseTextEvent);
|
||||
}
|
||||
|
||||
public override void Reset()
|
||||
{
|
||||
SetCharSet();
|
||||
DirtyScreen();
|
||||
FlushScreen();
|
||||
}
|
||||
|
||||
public void DirtyCell(int addressOffset)
|
||||
{
|
||||
_isCellDirty[CellIndex[addressOffset]] = true;
|
||||
}
|
||||
|
||||
public void DirtyCellMixed(int addressOffset)
|
||||
{
|
||||
int cellIndex = CellIndex[addressOffset];
|
||||
if (cellIndex < MixedCellIndex)
|
||||
{
|
||||
_isCellDirty[cellIndex] = true;
|
||||
}
|
||||
}
|
||||
|
||||
public void DirtyCellMixedText(int addressOffset)
|
||||
{
|
||||
int cellIndex = CellIndex[addressOffset];
|
||||
if (cellIndex >= MixedCellIndex)
|
||||
{
|
||||
_isCellDirty[cellIndex] = true;
|
||||
}
|
||||
}
|
||||
|
||||
public void DirtyScreen()
|
||||
{
|
||||
for (int i = 0; i < Height * CellColumns; i++)
|
||||
{
|
||||
_isCellDirty[i] = true;
|
||||
}
|
||||
}
|
||||
|
||||
public void DirtyScreenText()
|
||||
{
|
||||
if (_memory.IsText)
|
||||
{
|
||||
for (int i = 0; i < MixedHeight * CellColumns; i++)
|
||||
{
|
||||
_isCellDirty[i] = true;
|
||||
}
|
||||
}
|
||||
if (_memory.IsText || _memory.IsMixed)
|
||||
{
|
||||
for (int i = MixedHeight * CellColumns; i < Height * CellColumns; i++)
|
||||
{
|
||||
_isCellDirty[i] = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public int ReadFloatingBus()
|
||||
{
|
||||
// TODO
|
||||
return 0x00;
|
||||
}
|
||||
|
||||
public void SetCharSet()
|
||||
{
|
||||
_charSet = !_memory.IsCharSetAlternate ? CharSetPrimary : (_memory.Monitor == MonitorType.Standard) ? CharSetSecondaryStandard : CharSetSecondaryEnhanced;
|
||||
DirtyScreenText();
|
||||
}
|
||||
|
||||
public void ToggleFullScreen()
|
||||
{
|
||||
Machine.Settings.Video.IsFullScreen ^= true;
|
||||
_videoService.ToggleFullScreen();
|
||||
DirtyScreen();
|
||||
FlushScreen();
|
||||
}
|
||||
|
||||
public void ToggleMonochrome()
|
||||
{
|
||||
Machine.Settings.Video.IsMonochrome ^= true;
|
||||
DirtyScreen();
|
||||
FlushScreen();
|
||||
}
|
||||
|
||||
#region Draw Methods
|
||||
private void DrawText40(int data, int x, int y)
|
||||
{
|
||||
int color = Machine.Settings.Video.IsMonochrome ? ColorMono00 : ColorWhite00;
|
||||
int index = _charSet[data] * CharBitmapBytes;
|
||||
int inverseMask = (_isTextInversed && !_memory.IsCharSetAlternate && (0x40 <= data) && (data <= 0x7F)) ? 0x7F : 0x00;
|
||||
for (int i = 0; i < TextHeight; i++, y++)
|
||||
{
|
||||
data = CharBitmap[index + i] ^ inverseMask;
|
||||
SetPixel(x + 0, y, color | (data & 0x01));
|
||||
SetPixel(x + 1, y, color | (data & 0x01));
|
||||
SetPixel(x + 2, y, color | (data & 0x02));
|
||||
SetPixel(x + 3, y, color | (data & 0x02));
|
||||
SetPixel(x + 4, y, color | (data & 0x04));
|
||||
SetPixel(x + 5, y, color | (data & 0x04));
|
||||
SetPixel(x + 6, y, color | (data & 0x08));
|
||||
SetPixel(x + 7, y, color | (data & 0x08));
|
||||
SetPixel(x + 8, y, color | (data & 0x10));
|
||||
SetPixel(x + 9, y, color | (data & 0x10));
|
||||
SetPixel(x + 10, y, color | (data & 0x20));
|
||||
SetPixel(x + 11, y, color | (data & 0x20));
|
||||
SetPixel(x + 12, y, color | (data & 0x40));
|
||||
SetPixel(x + 13, y, color | (data & 0x40));
|
||||
}
|
||||
}
|
||||
|
||||
private void DrawText80(int data, int x, int y)
|
||||
{
|
||||
int color = Machine.Settings.Video.IsMonochrome ? ColorMono00 : ColorWhite00;
|
||||
int index = _charSet[data] * CharBitmapBytes;
|
||||
int mask = (_isTextInversed && !_memory.IsCharSetAlternate && (0x40 <= data) && (data <= 0x7F)) ? 0x7F : 0x00;
|
||||
for (int i = 0; i < TextHeight; i++, y++)
|
||||
{
|
||||
data = CharBitmap[index + i] ^ mask;
|
||||
SetPixel(x + 0, y, color | (data & 0x01));
|
||||
SetPixel(x + 1, y, color | (data & 0x02));
|
||||
SetPixel(x + 2, y, color | (data & 0x04));
|
||||
SetPixel(x + 3, y, color | (data & 0x08));
|
||||
SetPixel(x + 4, y, color | (data & 0x10));
|
||||
SetPixel(x + 5, y, color | (data & 0x20));
|
||||
SetPixel(x + 6, y, color | (data & 0x40));
|
||||
}
|
||||
}
|
||||
|
||||
private void DrawLores(int data, int x, int y)
|
||||
{
|
||||
if (Machine.Settings.Video.IsMonochrome)
|
||||
{
|
||||
if ((x & 0x02) == 0x02) // odd cell
|
||||
{
|
||||
data = ((data << 2) & 0xCC) | ((data >> 2) & 0x33);
|
||||
}
|
||||
for (int i = 0; i < LoresHeight; i++, y++)
|
||||
{
|
||||
SetPixel(x + 0, y, data & 0x01);
|
||||
SetPixel(x + 1, y, data & 0x02);
|
||||
SetPixel(x + 2, y, data & 0x04);
|
||||
SetPixel(x + 3, y, data & 0x08);
|
||||
SetPixel(x + 4, y, data & 0x01);
|
||||
SetPixel(x + 5, y, data & 0x02);
|
||||
SetPixel(x + 6, y, data & 0x04);
|
||||
SetPixel(x + 7, y, data & 0x08);
|
||||
SetPixel(x + 8, y, data & 0x01);
|
||||
SetPixel(x + 9, y, data & 0x02);
|
||||
SetPixel(x + 10, y, data & 0x04);
|
||||
SetPixel(x + 11, y, data & 0x08);
|
||||
SetPixel(x + 12, y, data & 0x01);
|
||||
SetPixel(x + 13, y, data & 0x02);
|
||||
}
|
||||
for (int i = 0; i < LoresHeight; i++, y++)
|
||||
{
|
||||
SetPixel(x + 0, y, data & 0x10);
|
||||
SetPixel(x + 1, y, data & 0x20);
|
||||
SetPixel(x + 2, y, data & 0x40);
|
||||
SetPixel(x + 3, y, data & 0x80);
|
||||
SetPixel(x + 4, y, data & 0x10);
|
||||
SetPixel(x + 5, y, data & 0x20);
|
||||
SetPixel(x + 6, y, data & 0x40);
|
||||
SetPixel(x + 7, y, data & 0x80);
|
||||
SetPixel(x + 8, y, data & 0x10);
|
||||
SetPixel(x + 9, y, data & 0x20);
|
||||
SetPixel(x + 10, y, data & 0x40);
|
||||
SetPixel(x + 11, y, data & 0x80);
|
||||
SetPixel(x + 12, y, data & 0x10);
|
||||
SetPixel(x + 13, y, data & 0x20);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
int color = ColorLores[data & 0x0F];
|
||||
for (int i = 0; i < LoresHeight; i++, y++)
|
||||
{
|
||||
SetPixel(x + 0, y, color);
|
||||
SetPixel(x + 1, y, color);
|
||||
SetPixel(x + 2, y, color);
|
||||
SetPixel(x + 3, y, color);
|
||||
SetPixel(x + 4, y, color);
|
||||
SetPixel(x + 5, y, color);
|
||||
SetPixel(x + 6, y, color);
|
||||
SetPixel(x + 7, y, color);
|
||||
SetPixel(x + 8, y, color);
|
||||
SetPixel(x + 9, y, color);
|
||||
SetPixel(x + 10, y, color);
|
||||
SetPixel(x + 11, y, color);
|
||||
SetPixel(x + 12, y, color);
|
||||
SetPixel(x + 13, y, color);
|
||||
}
|
||||
color = ColorLores[data >> 4];
|
||||
for (int i = 0; i < LoresHeight; i++, y++)
|
||||
{
|
||||
SetPixel(x + 0, y, color);
|
||||
SetPixel(x + 1, y, color);
|
||||
SetPixel(x + 2, y, color);
|
||||
SetPixel(x + 3, y, color);
|
||||
SetPixel(x + 4, y, color);
|
||||
SetPixel(x + 5, y, color);
|
||||
SetPixel(x + 6, y, color);
|
||||
SetPixel(x + 7, y, color);
|
||||
SetPixel(x + 8, y, color);
|
||||
SetPixel(x + 9, y, color);
|
||||
SetPixel(x + 10, y, color);
|
||||
SetPixel(x + 11, y, color);
|
||||
SetPixel(x + 12, y, color);
|
||||
SetPixel(x + 13, y, color);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void Draw7MLores(int data, int x, int y)
|
||||
{
|
||||
if (Machine.Settings.Video.IsMonochrome)
|
||||
{
|
||||
if ((x & 0x02) == 0x02) // odd cell
|
||||
{
|
||||
data = ((data << 2) & 0xCC) | ((data >> 2) & 0x33);
|
||||
}
|
||||
for (int i = 0; i < LoresHeight; i++, y++)
|
||||
{
|
||||
SetPixel(x + 0, y, data & 0x01);
|
||||
SetPixel(x + 1, y, data & 0x01);
|
||||
SetPixel(x + 2, y, data & 0x02);
|
||||
SetPixel(x + 3, y, data & 0x02);
|
||||
SetPixel(x + 4, y, data & 0x04);
|
||||
SetPixel(x + 5, y, data & 0x04);
|
||||
SetPixel(x + 6, y, data & 0x08);
|
||||
SetPixel(x + 7, y, data & 0x08);
|
||||
SetPixel(x + 8, y, data & 0x01);
|
||||
SetPixel(x + 9, y, data & 0x01);
|
||||
SetPixel(x + 10, y, data & 0x02);
|
||||
SetPixel(x + 11, y, data & 0x02);
|
||||
SetPixel(x + 12, y, data & 0x04);
|
||||
SetPixel(x + 13, y, data & 0x04);
|
||||
}
|
||||
for (int i = 0; i < LoresHeight; i++, y++)
|
||||
{
|
||||
SetPixel(x + 0, y, data & 0x10);
|
||||
SetPixel(x + 1, y, data & 0x10);
|
||||
SetPixel(x + 2, y, data & 0x20);
|
||||
SetPixel(x + 3, y, data & 0x20);
|
||||
SetPixel(x + 4, y, data & 0x40);
|
||||
SetPixel(x + 5, y, data & 0x40);
|
||||
SetPixel(x + 6, y, data & 0x80);
|
||||
SetPixel(x + 7, y, data & 0x80);
|
||||
SetPixel(x + 8, y, data & 0x10);
|
||||
SetPixel(x + 9, y, data & 0x10);
|
||||
SetPixel(x + 10, y, data & 0x20);
|
||||
SetPixel(x + 11, y, data & 0x20);
|
||||
SetPixel(x + 12, y, data & 0x40);
|
||||
SetPixel(x + 13, y, data & 0x40);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
int color = Color7MLores[((x & 0x02) << 3) | (data & 0x0F)];
|
||||
for (int i = 0; i < LoresHeight; i++, y++)
|
||||
{
|
||||
SetPixel(x + 0, y, color);
|
||||
SetPixel(x + 1, y, color);
|
||||
SetPixel(x + 2, y, color);
|
||||
SetPixel(x + 3, y, color);
|
||||
SetPixel(x + 4, y, color);
|
||||
SetPixel(x + 5, y, color);
|
||||
SetPixel(x + 6, y, color);
|
||||
SetPixel(x + 7, y, color);
|
||||
SetPixel(x + 8, y, color);
|
||||
SetPixel(x + 9, y, color);
|
||||
SetPixel(x + 10, y, color);
|
||||
SetPixel(x + 11, y, color);
|
||||
SetPixel(x + 12, y, color);
|
||||
SetPixel(x + 13, y, color);
|
||||
}
|
||||
color = Color7MLores[((x & 0x02) << 3) | (data >> 4)];
|
||||
for (int i = 0; i < LoresHeight; i++, y++)
|
||||
{
|
||||
SetPixel(x + 0, y, color);
|
||||
SetPixel(x + 1, y, color);
|
||||
SetPixel(x + 2, y, color);
|
||||
SetPixel(x + 3, y, color);
|
||||
SetPixel(x + 4, y, color);
|
||||
SetPixel(x + 5, y, color);
|
||||
SetPixel(x + 6, y, color);
|
||||
SetPixel(x + 7, y, color);
|
||||
SetPixel(x + 8, y, color);
|
||||
SetPixel(x + 9, y, color);
|
||||
SetPixel(x + 10, y, color);
|
||||
SetPixel(x + 11, y, color);
|
||||
SetPixel(x + 12, y, color);
|
||||
SetPixel(x + 13, y, color);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void DrawDLores(int data, int x, int y)
|
||||
{
|
||||
if (Machine.Settings.Video.IsMonochrome)
|
||||
{
|
||||
if ((x & 0x01) == 0x00) // even half cell
|
||||
{
|
||||
data = ((data << 1) & 0xEE) | ((data >> 3) & 0x11);
|
||||
}
|
||||
for (int i = 0; i < LoresHeight; i++, y++)
|
||||
{
|
||||
SetPixel(x + 0, y, data & 0x01);
|
||||
SetPixel(x + 1, y, data & 0x02);
|
||||
SetPixel(x + 2, y, data & 0x04);
|
||||
SetPixel(x + 3, y, data & 0x08);
|
||||
SetPixel(x + 4, y, data & 0x01);
|
||||
SetPixel(x + 5, y, data & 0x02);
|
||||
SetPixel(x + 6, y, data & 0x04);
|
||||
}
|
||||
for (int i = 0; i < LoresHeight; i++, y++)
|
||||
{
|
||||
SetPixel(x + 0, y, data & 0x10);
|
||||
SetPixel(x + 1, y, data & 0x20);
|
||||
SetPixel(x + 2, y, data & 0x40);
|
||||
SetPixel(x + 3, y, data & 0x80);
|
||||
SetPixel(x + 4, y, data & 0x10);
|
||||
SetPixel(x + 5, y, data & 0x20);
|
||||
SetPixel(x + 6, y, data & 0x40);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
int color = ColorDLores[((x & 0x01) << 4) | (data & 0x0F)];
|
||||
for (int i = 0; i < LoresHeight; i++, y++)
|
||||
{
|
||||
SetPixel(x + 0, y, color);
|
||||
SetPixel(x + 1, y, color);
|
||||
SetPixel(x + 2, y, color);
|
||||
SetPixel(x + 3, y, color);
|
||||
SetPixel(x + 4, y, color);
|
||||
SetPixel(x + 5, y, color);
|
||||
SetPixel(x + 6, y, color);
|
||||
}
|
||||
color = ColorDLores[((x & 0x01) << 4) | (data >> 4)];
|
||||
for (int i = 0; i < LoresHeight; i++, y++)
|
||||
{
|
||||
SetPixel(x + 0, y, color);
|
||||
SetPixel(x + 1, y, color);
|
||||
SetPixel(x + 2, y, color);
|
||||
SetPixel(x + 3, y, color);
|
||||
SetPixel(x + 4, y, color);
|
||||
SetPixel(x + 5, y, color);
|
||||
SetPixel(x + 6, y, color);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void DrawHires(int address, int x, int y)
|
||||
{
|
||||
if (Machine.Settings.Video.IsMonochrome)
|
||||
{
|
||||
int data = _memory.ReadRamMainRegion02BF(address);
|
||||
SetPixel(x + 0, y, data & 0x01);
|
||||
SetPixel(x + 1, y, data & 0x01);
|
||||
SetPixel(x + 2, y, data & 0x02);
|
||||
SetPixel(x + 3, y, data & 0x02);
|
||||
SetPixel(x + 4, y, data & 0x04);
|
||||
SetPixel(x + 5, y, data & 0x04);
|
||||
SetPixel(x + 6, y, data & 0x08);
|
||||
SetPixel(x + 7, y, data & 0x08);
|
||||
SetPixel(x + 8, y, data & 0x10);
|
||||
SetPixel(x + 9, y, data & 0x10);
|
||||
SetPixel(x + 10, y, data & 0x20);
|
||||
SetPixel(x + 11, y, data & 0x20);
|
||||
SetPixel(x + 12, y, data & 0x40);
|
||||
SetPixel(x + 13, y, data & 0x40);
|
||||
}
|
||||
else
|
||||
{
|
||||
// 3 2 1 0
|
||||
// 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0
|
||||
//
|
||||
// - - - - - - - - 0 0 0 0 0 0 0 0 + + + + + + + +
|
||||
// H 1 0 H 6 5 4 3 2 1 0 H 1 0
|
||||
|
||||
int data = _memory.ReadRamMainRegion02BF(address) << 8;
|
||||
if (x < Width - CellWidth)
|
||||
{
|
||||
data |= _memory.ReadRamMainRegion02BF(address + 1);
|
||||
SetPixel(x + 14, y, ColorHires[((~x & 0x02) << 3) | ((data >> 4) & 0x08) | ((data << 1) & 0x06) | ((data >> 14) & 0x01)]);
|
||||
SetPixel(x + 15, y, ColorHires[((~x & 0x02) << 3) | ((data >> 4) & 0x08) | ((data << 1) & 0x06) | ((data >> 14) & 0x01)]);
|
||||
}
|
||||
if (x > 0)
|
||||
{
|
||||
data |= _memory.ReadRamMainRegion02BF(address - 1) << 16;
|
||||
SetPixel(x - 2, y, ColorHires[((~x & 0x02) << 3) | ((data >> 20) & 0x08) | ((data >> 6) & 0x04) | ((data >> 21) & 0x03)]);
|
||||
SetPixel(x - 1, y, ColorHires[((~x & 0x02) << 3) | ((data >> 20) & 0x08) | ((data >> 6) & 0x04) | ((data >> 21) & 0x03)]);
|
||||
}
|
||||
SetPixel(x + 0, y, ColorHires[((x & 0x02) << 3) | ((data >> 12) & 0x08) | ((data >> 7) & 0x06) | ((data >> 22) & 0x01)]);
|
||||
SetPixel(x + 1, y, ColorHires[((x & 0x02) << 3) | ((data >> 12) & 0x08) | ((data >> 7) & 0x06) | ((data >> 22) & 0x01)]);
|
||||
SetPixel(x + 2, y, ColorHires[((~x & 0x02) << 3) | ((data >> 12) & 0x08) | ((data >> 8) & 0x07)]);
|
||||
SetPixel(x + 3, y, ColorHires[((~x & 0x02) << 3) | ((data >> 12) & 0x08) | ((data >> 8) & 0x07)]);
|
||||
SetPixel(x + 4, y, ColorHires[((x & 0x02) << 3) | ((data >> 12) & 0x08) | ((data >> 9) & 0x07)]);
|
||||
SetPixel(x + 5, y, ColorHires[((x & 0x02) << 3) | ((data >> 12) & 0x08) | ((data >> 9) & 0x07)]);
|
||||
SetPixel(x + 6, y, ColorHires[((~x & 0x02) << 3) | ((data >> 12) & 0x08) | ((data >> 10) & 0x07)]);
|
||||
SetPixel(x + 7, y, ColorHires[((~x & 0x02) << 3) | ((data >> 12) & 0x08) | ((data >> 10) & 0x07)]);
|
||||
SetPixel(x + 8, y, ColorHires[((x & 0x02) << 3) | ((data >> 12) & 0x08) | ((data >> 11) & 0x07)]);
|
||||
SetPixel(x + 9, y, ColorHires[((x & 0x02) << 3) | ((data >> 12) & 0x08) | ((data >> 11) & 0x07)]);
|
||||
SetPixel(x + 10, y, ColorHires[((~x & 0x02) << 3) | ((data >> 12) & 0x0F)]);
|
||||
SetPixel(x + 11, y, ColorHires[((~x & 0x02) << 3) | ((data >> 12) & 0x0F)]);
|
||||
SetPixel(x + 12, y, ColorHires[((x & 0x02) << 3) | ((data >> 12) & 0x08) | ((data << 2) & 0x04) | ((data >> 13) & 0x03)]);
|
||||
SetPixel(x + 13, y, ColorHires[((x & 0x02) << 3) | ((data >> 12) & 0x08) | ((data << 2) & 0x04) | ((data >> 13) & 0x03)]);
|
||||
}
|
||||
}
|
||||
|
||||
private void DrawNDHires(int address, int x, int y)
|
||||
{
|
||||
if (Machine.Settings.Video.IsMonochrome)
|
||||
{
|
||||
int data = _memory.ReadRamMainRegion02BF(address);
|
||||
SetPixel(x + 0, y, data & 0x01);
|
||||
SetPixel(x + 1, y, data & 0x01);
|
||||
SetPixel(x + 2, y, data & 0x02);
|
||||
SetPixel(x + 3, y, data & 0x02);
|
||||
SetPixel(x + 4, y, data & 0x04);
|
||||
SetPixel(x + 5, y, data & 0x04);
|
||||
SetPixel(x + 6, y, data & 0x08);
|
||||
SetPixel(x + 7, y, data & 0x08);
|
||||
SetPixel(x + 8, y, data & 0x10);
|
||||
SetPixel(x + 9, y, data & 0x10);
|
||||
SetPixel(x + 10, y, data & 0x20);
|
||||
SetPixel(x + 11, y, data & 0x20);
|
||||
SetPixel(x + 12, y, data & 0x40);
|
||||
SetPixel(x + 13, y, data & 0x40);
|
||||
}
|
||||
else
|
||||
{
|
||||
// 3 2 1 0
|
||||
// 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0
|
||||
//
|
||||
// - - - - - - - - 0 0 0 0 0 0 0 0 + + + + + + + +
|
||||
// X 1 0 X 6 5 4 3 2 1 0 X 1 0
|
||||
|
||||
int data = _memory.ReadRamMainRegion02BF(address) << 8;
|
||||
if (x < Width - CellWidth)
|
||||
{
|
||||
data |= _memory.ReadRamMainRegion02BF(address + 1);
|
||||
SetPixel(x + 14, y, ColorHires[((~x & 0x02) << 3) | ((data << 1) & 0x06) | ((data >> 14) & 0x01)]);
|
||||
SetPixel(x + 15, y, ColorHires[((~x & 0x02) << 3) | ((data << 1) & 0x06) | ((data >> 14) & 0x01)]);
|
||||
}
|
||||
if (x > 0)
|
||||
{
|
||||
data |= _memory.ReadRamMainRegion02BF(address - 1) << 16;
|
||||
SetPixel(x - 2, y, ColorHires[((~x & 0x02) << 3) | ((data >> 6) & 0x04) | ((data >> 21) & 0x03)]);
|
||||
SetPixel(x - 1, y, ColorHires[((~x & 0x02) << 3) | ((data >> 6) & 0x04) | ((data >> 21) & 0x03)]);
|
||||
}
|
||||
SetPixel(x + 0, y, ColorHires[((x & 0x02) << 3) | ((data >> 7) & 0x06) | ((data >> 22) & 0x01)]);
|
||||
SetPixel(x + 1, y, ColorHires[((x & 0x02) << 3) | ((data >> 7) & 0x06) | ((data >> 22) & 0x01)]);
|
||||
SetPixel(x + 2, y, ColorHires[((~x & 0x02) << 3) | ((data >> 8) & 0x07)]);
|
||||
SetPixel(x + 3, y, ColorHires[((~x & 0x02) << 3) | ((data >> 8) & 0x07)]);
|
||||
SetPixel(x + 4, y, ColorHires[((x & 0x02) << 3) | ((data >> 9) & 0x07)]);
|
||||
SetPixel(x + 5, y, ColorHires[((x & 0x02) << 3) | ((data >> 9) & 0x07)]);
|
||||
SetPixel(x + 6, y, ColorHires[((~x & 0x02) << 3) | ((data >> 10) & 0x07)]);
|
||||
SetPixel(x + 7, y, ColorHires[((~x & 0x02) << 3) | ((data >> 10) & 0x07)]);
|
||||
SetPixel(x + 8, y, ColorHires[((x & 0x02) << 3) | ((data >> 11) & 0x07)]);
|
||||
SetPixel(x + 9, y, ColorHires[((x & 0x02) << 3) | ((data >> 11) & 0x07)]);
|
||||
SetPixel(x + 10, y, ColorHires[((~x & 0x02) << 3) | ((data >> 12) & 0x07)]);
|
||||
SetPixel(x + 11, y, ColorHires[((~x & 0x02) << 3) | ((data >> 12) & 0x07)]);
|
||||
SetPixel(x + 12, y, ColorHires[((x & 0x02) << 3) | ((data << 2) & 0x04) | ((data >> 13) & 0x03)]);
|
||||
SetPixel(x + 13, y, ColorHires[((x & 0x02) << 3) | ((data << 2) & 0x04) | ((data >> 13) & 0x03)]);
|
||||
}
|
||||
}
|
||||
|
||||
private void DrawDHiresA(int address, int x, int y)
|
||||
{
|
||||
if (Machine.Settings.Video.IsMonochrome)
|
||||
{
|
||||
if ((x & 0x2) == 0x00) // even cell
|
||||
{
|
||||
int data = ((_memory.ReadRamMainRegion02BF(address) << 7) & 0x80) | (_memory.ReadRamAuxRegion02BF(address) & 0x7F);
|
||||
SetPixel(x + 0, y, data & 0x01);
|
||||
SetPixel(x + 1, y, data & 0x02);
|
||||
SetPixel(x + 2, y, data & 0x04);
|
||||
SetPixel(x + 3, y, data & 0x08);
|
||||
SetPixel(x + 4, y, data & 0x10);
|
||||
SetPixel(x + 5, y, data & 0x20);
|
||||
SetPixel(x + 6, y, data & 0x40);
|
||||
SetPixel(x + 7, y, data & 0x80);
|
||||
}
|
||||
else
|
||||
{
|
||||
int data = ((_memory.ReadRamMainRegion02BF(address) << 9) & 0xE00) | ((_memory.ReadRamAuxRegion02BF(address) << 2) & 0x1FC) |
|
||||
((_memory.ReadRamMainRegion02BF(address - 1) >> 5) & 0x003);
|
||||
SetPixel(x - 2, y, data & 0x01);
|
||||
SetPixel(x - 1, y, data & 0x02);
|
||||
SetPixel(x + 0, y, data & 0x04);
|
||||
SetPixel(x + 1, y, data & 0x08);
|
||||
SetPixel(x + 2, y, data & 0x10);
|
||||
SetPixel(x + 3, y, data & 0x20);
|
||||
SetPixel(x + 4, y, data & 0x40);
|
||||
SetPixel(x + 5, y, data & 0x80);
|
||||
SetPixel(x + 6, y, (data >> 8) & 0x01);
|
||||
SetPixel(x + 7, y, (data >> 8) & 0x02);
|
||||
SetPixel(x + 8, y, (data >> 8) & 0x04);
|
||||
SetPixel(x + 9, y, (data >> 8) & 0x08);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if ((x & 0x2) == 0x00) // even cell
|
||||
{
|
||||
int data = ((_memory.ReadRamMainRegion02BF(address) << 7) & 0x80) | (_memory.ReadRamAuxRegion02BF(address) & 0x7F);
|
||||
SetPixel(x + 0, y, ColorDHires0 | (data & 0x0F));
|
||||
SetPixel(x + 1, y, ColorDHires0 | (data & 0x0F));
|
||||
SetPixel(x + 2, y, ColorDHires0 | (data & 0x0F));
|
||||
SetPixel(x + 3, y, ColorDHires0 | (data & 0x0F));
|
||||
SetPixel(x + 4, y, ColorDHires0 | (data >> 4));
|
||||
SetPixel(x + 5, y, ColorDHires0 | (data >> 4));
|
||||
SetPixel(x + 6, y, ColorDHires0 | (data >> 4));
|
||||
SetPixel(x + 7, y, ColorDHires0 | (data >> 4));
|
||||
}
|
||||
else
|
||||
{
|
||||
int data = ((_memory.ReadRamMainRegion02BF(address) << 9) & 0xE00) | ((_memory.ReadRamAuxRegion02BF(address) << 2) & 0x1FC) |
|
||||
((_memory.ReadRamMainRegion02BF(address - 1) >> 5) & 0x003);
|
||||
SetPixel(x - 2, y, ColorDHires0 | (data & 0x0F));
|
||||
SetPixel(x - 1, y, ColorDHires0 | (data & 0x0F));
|
||||
SetPixel(x + 0, y, ColorDHires0 | (data & 0x0F));
|
||||
SetPixel(x + 1, y, ColorDHires0 | (data & 0x0F));
|
||||
SetPixel(x + 2, y, ColorDHires0 | ((data >> 4) & 0x0F));
|
||||
SetPixel(x + 3, y, ColorDHires0 | ((data >> 4) & 0x0F));
|
||||
SetPixel(x + 4, y, ColorDHires0 | ((data >> 4) & 0x0F));
|
||||
SetPixel(x + 5, y, ColorDHires0 | ((data >> 4) & 0x0F));
|
||||
SetPixel(x + 6, y, ColorDHires0 | (data >> 8));
|
||||
SetPixel(x + 7, y, ColorDHires0 | (data >> 8));
|
||||
SetPixel(x + 8, y, ColorDHires0 | (data >> 8));
|
||||
SetPixel(x + 9, y, ColorDHires0 | (data >> 8));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void DrawDHiresM(int address, int x, int y)
|
||||
{
|
||||
if (Machine.Settings.Video.IsMonochrome)
|
||||
{
|
||||
if ((x & 0x2) == 0x02) // odd cell
|
||||
{
|
||||
int data = ((_memory.ReadRamMainRegion02BF(address) << 1) & 0xFE) | ((_memory.ReadRamAuxRegion02BF(address) >> 6) & 0x01);
|
||||
SetPixel(x + 6, y, data & 0x01);
|
||||
SetPixel(x + 7, y, data & 0x02);
|
||||
SetPixel(x + 8, y, data & 0x04);
|
||||
SetPixel(x + 9, y, data & 0x08);
|
||||
SetPixel(x + 10, y, data & 0x10);
|
||||
SetPixel(x + 11, y, data & 0x20);
|
||||
SetPixel(x + 12, y, data & 0x40);
|
||||
SetPixel(x + 13, y, data & 0x80);
|
||||
}
|
||||
else
|
||||
{
|
||||
int data = ((_memory.ReadRamAuxRegion02BF(address + 1) << 10) & 0xC00) | ((_memory.ReadRamMainRegion02BF(address) << 3) & 0x3F8) |
|
||||
((_memory.ReadRamAuxRegion02BF(address) >> 4) & 0x007);
|
||||
SetPixel(x + 4, y, data & 0x01);
|
||||
SetPixel(x + 5, y, data & 0x02);
|
||||
SetPixel(x + 6, y, data & 0x04);
|
||||
SetPixel(x + 7, y, data & 0x08);
|
||||
SetPixel(x + 8, y, data & 0x10);
|
||||
SetPixel(x + 9, y, data & 0x20);
|
||||
SetPixel(x + 10, y, data & 0x40);
|
||||
SetPixel(x + 11, y, data & 0x80);
|
||||
SetPixel(x + 12, y, (data >> 8) & 0x01);
|
||||
SetPixel(x + 13, y, (data >> 8) & 0x02);
|
||||
SetPixel(x + 14, y, (data >> 8) & 0x04);
|
||||
SetPixel(x + 15, y, (data >> 8) & 0x08);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if ((x & 0x2) == 0x02) // odd cell
|
||||
{
|
||||
int data = ((_memory.ReadRamMainRegion02BF(address) << 1) & 0xFE) | ((_memory.ReadRamAuxRegion02BF(address) >> 6) & 0x01);
|
||||
SetPixel(x + 6, y, ColorDHires0 | (data & 0x0F));
|
||||
SetPixel(x + 7, y, ColorDHires0 | (data & 0x0F));
|
||||
SetPixel(x + 8, y, ColorDHires0 | (data & 0x0F));
|
||||
SetPixel(x + 9, y, ColorDHires0 | (data & 0x0F));
|
||||
SetPixel(x + 10, y, ColorDHires0 | (data >> 4));
|
||||
SetPixel(x + 11, y, ColorDHires0 | (data >> 4));
|
||||
SetPixel(x + 12, y, ColorDHires0 | (data >> 4));
|
||||
SetPixel(x + 13, y, ColorDHires0 | (data >> 4));
|
||||
}
|
||||
else
|
||||
{
|
||||
int data = ((_memory.ReadRamAuxRegion02BF(address + 1) << 10) & 0xC00) | ((_memory.ReadRamMainRegion02BF(address) << 3) & 0x3F8) |
|
||||
((_memory.ReadRamAuxRegion02BF(address) >> 4) & 0x007);
|
||||
SetPixel(x + 4, y, ColorDHires0 | (data & 0x0F));
|
||||
SetPixel(x + 5, y, ColorDHires0 | (data & 0x0F));
|
||||
SetPixel(x + 6, y, ColorDHires0 | (data & 0x0F));
|
||||
SetPixel(x + 7, y, ColorDHires0 | (data & 0x0F));
|
||||
SetPixel(x + 8, y, ColorDHires0 | ((data >> 4) & 0x0F));
|
||||
SetPixel(x + 9, y, ColorDHires0 | ((data >> 4) & 0x0F));
|
||||
SetPixel(x + 10, y, ColorDHires0 | ((data >> 4) & 0x0F));
|
||||
SetPixel(x + 11, y, ColorDHires0 | ((data >> 4) & 0x0F));
|
||||
SetPixel(x + 12, y, ColorDHires0 | (data >> 8));
|
||||
SetPixel(x + 13, y, ColorDHires0 | (data >> 8));
|
||||
SetPixel(x + 14, y, ColorDHires0 | (data >> 8));
|
||||
SetPixel(x + 15, y, ColorDHires0 | (data >> 8));
|
||||
}
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Flush Methods
|
||||
private void FlushRowMode0(int y)
|
||||
{
|
||||
int address = (!_memory.IsVideoPage2 ? 0x0400 : 0x0800) + AddressOffset[y];
|
||||
for (int x = 0; x < CellColumns; x++)
|
||||
{
|
||||
if (_isCellDirty[CellColumns * y + x])
|
||||
{
|
||||
_isCellDirty[CellColumns * y + x] = false;
|
||||
DrawLores(_memory.ReadRamMainRegion02BF(address + x), CellWidth * x, y); // lores
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void FlushRowMode1(int y)
|
||||
{
|
||||
int address = (!_memory.IsVideoPage2 ? 0x0400 : 0x0800) + AddressOffset[y];
|
||||
for (int x = 0; x < CellColumns; x++)
|
||||
{
|
||||
if (_isCellDirty[CellColumns * y + x])
|
||||
{
|
||||
_isCellDirty[CellColumns * y + x] = false;
|
||||
DrawText40(_memory.ReadRamMainRegion02BF(address + x), CellWidth * x, y); // text40
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void FlushRowMode2(int y)
|
||||
{
|
||||
int address = (!_memory.IsVideoPage2 ? 0x0400 : 0x0800) + AddressOffset[y];
|
||||
for (int x = 0; x < 2 * CellColumns; x += 2)
|
||||
{
|
||||
if (_isCellDirty[CellColumns * y + x / 2])
|
||||
{
|
||||
_isCellDirty[CellColumns * y + x / 2] = false;
|
||||
DrawText80(_memory.ReadRamAuxRegion02BF(address + x / 2), CellWidth / 2 * (x + 0), y); // text80
|
||||
DrawText80(_memory.ReadRamMainRegion02BF(address + x / 2), CellWidth / 2 * (x + 1), y);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void FlushRowMode3(int y)
|
||||
{
|
||||
if (y < MixedHeight)
|
||||
{
|
||||
FlushRowMode0(y); // lores
|
||||
}
|
||||
else
|
||||
{
|
||||
FlushRowMode1(y); // text40
|
||||
}
|
||||
}
|
||||
|
||||
private void FlushRowMode4(int y)
|
||||
{
|
||||
if (y < MixedHeight)
|
||||
{
|
||||
FlushRowMode0(y); // lores
|
||||
}
|
||||
else
|
||||
{
|
||||
FlushRowMode2(y); // text80
|
||||
}
|
||||
}
|
||||
|
||||
private void FlushRowMode5(int y)
|
||||
{
|
||||
int address = !_memory.IsVideoPage2 ? 0x2000 : 0x4000;
|
||||
for (int i = 0; i < CellHeight; i++, y++)
|
||||
{
|
||||
for (int x = 0; x < CellColumns; x++)
|
||||
{
|
||||
if (_isCellDirty[CellColumns * y + x])
|
||||
{
|
||||
_isCellDirty[CellColumns * y + x] = false;
|
||||
DrawHires(address + AddressOffset[y] + x, CellWidth * x, y); // hires
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void FlushRowMode6(int y)
|
||||
{
|
||||
if (y < MixedHeight)
|
||||
{
|
||||
FlushRowMode5(y); // hires
|
||||
}
|
||||
else
|
||||
{
|
||||
FlushRowMode1(y); // text40
|
||||
}
|
||||
}
|
||||
|
||||
private void FlushRowMode7(int y)
|
||||
{
|
||||
if (y < MixedHeight)
|
||||
{
|
||||
FlushRowMode5(y); // hires
|
||||
}
|
||||
else
|
||||
{
|
||||
FlushRowMode2(y); // text80
|
||||
}
|
||||
}
|
||||
|
||||
private void FlushRowMode8(int y)
|
||||
{
|
||||
int address = (!_memory.IsVideoPage2 ? 0x0400 : 0x0800) + AddressOffset[y];
|
||||
for (int x = 0; x < CellColumns; x++)
|
||||
{
|
||||
if (_isCellDirty[CellColumns * y + x])
|
||||
{
|
||||
_isCellDirty[CellColumns * y + x] = false;
|
||||
Draw7MLores(_memory.ReadRamMainRegion02BF(address + x), CellWidth * x, y); // 7mlores
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void FlushRowMode9(int y)
|
||||
{
|
||||
int address = (!_memory.IsVideoPage2 ? 0x0400 : 0x0800) + AddressOffset[y];
|
||||
for (int x = 0; x < 2 * CellColumns; x += 2)
|
||||
{
|
||||
if (_isCellDirty[CellColumns * y + x / 2])
|
||||
{
|
||||
_isCellDirty[CellColumns * y + x / 2] = false;
|
||||
DrawDLores(_memory.ReadRamAuxRegion02BF(address + x / 2), CellWidth / 2 * (x + 0), y); // dlores
|
||||
DrawDLores(_memory.ReadRamMainRegion02BF(address + x / 2), CellWidth / 2 * (x + 1), y);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void FlushRowModeA(int y)
|
||||
{
|
||||
if (y < MixedHeight)
|
||||
{
|
||||
FlushRowMode8(y); // 7mlores
|
||||
}
|
||||
else
|
||||
{
|
||||
FlushRowMode1(y); // text40
|
||||
}
|
||||
}
|
||||
|
||||
private void FlushRowModeB(int y)
|
||||
{
|
||||
if (y < MixedHeight)
|
||||
{
|
||||
FlushRowMode9(y); // dlores
|
||||
}
|
||||
else
|
||||
{
|
||||
FlushRowMode2(y); // text80
|
||||
}
|
||||
}
|
||||
|
||||
private void FlushRowModeC(int y)
|
||||
{
|
||||
int address = !_memory.IsVideoPage2 ? 0x2000 : 0x4000;
|
||||
for (int i = 0; i < CellHeight; i++, y++)
|
||||
{
|
||||
for (int x = 0; x < CellColumns; x++)
|
||||
{
|
||||
if (_isCellDirty[CellColumns * y + x])
|
||||
{
|
||||
_isCellDirty[CellColumns * y + x] = false;
|
||||
DrawNDHires(address + AddressOffset[y] + x, CellWidth * x, y); // ndhires
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void FlushRowModeD(int y)
|
||||
{
|
||||
int address = !_memory.IsVideoPage2 ? 0x2000 : 0x4000;
|
||||
for (int i = 0; i < CellHeight; i++, y++)
|
||||
{
|
||||
for (int x = 0; x < CellColumns; x++)
|
||||
{
|
||||
if (_isCellDirty[CellColumns * y + x])
|
||||
{
|
||||
_isCellDirty[CellColumns * y + x] = false;
|
||||
DrawDHiresA(address + AddressOffset[y] + x, CellWidth * x, y); // dhires
|
||||
DrawDHiresM(address + AddressOffset[y] + x, CellWidth * x, y);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void FlushRowModeE(int y)
|
||||
{
|
||||
if (y < MixedHeight)
|
||||
{
|
||||
FlushRowModeC(y); // ndhires
|
||||
}
|
||||
else
|
||||
{
|
||||
FlushRowMode1(y); // text40
|
||||
}
|
||||
}
|
||||
|
||||
private void FlushRowModeF(int y)
|
||||
{
|
||||
if (y < MixedHeight)
|
||||
{
|
||||
FlushRowModeD(y); // dhires
|
||||
}
|
||||
else
|
||||
{
|
||||
FlushRowMode2(y); // text80
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
private void FlushRowEvent()
|
||||
{
|
||||
int y = (CyclesPerVSync - (CyclesPerVBlank / 2) - Machine.Events.FindEvent(_resetVSyncEvent)) / CyclesPerHSync;
|
||||
|
||||
FlushRowMode[_memory.VideoMode](y - CellHeight); // in arrears
|
||||
|
||||
if (y < Height)
|
||||
{
|
||||
Machine.Events.AddEvent(CyclesPerFlush, _flushRowEvent);
|
||||
}
|
||||
else
|
||||
{
|
||||
IsVBlank = true;
|
||||
|
||||
Machine.Events.AddEvent(CyclesPerVBlank, _leaveVBlankEvent);
|
||||
}
|
||||
}
|
||||
|
||||
private void FlushScreen()
|
||||
{
|
||||
Action<int> flushRowMode = FlushRowMode[_memory.VideoMode];
|
||||
|
||||
for (int y = 0; y < Height; y += CellHeight)
|
||||
{
|
||||
flushRowMode(y);
|
||||
}
|
||||
}
|
||||
|
||||
private void InverseTextEvent()
|
||||
{
|
||||
_isTextInversed = !_isTextInversed;
|
||||
|
||||
DirtyScreenText();
|
||||
|
||||
Machine.Events.AddEvent(CyclesPerFlash, _inverseTextEvent);
|
||||
}
|
||||
|
||||
private void LeaveVBlankEvent()
|
||||
{
|
||||
IsVBlank = false;
|
||||
|
||||
Machine.Events.AddEvent(CyclesPerFlush, _flushRowEvent);
|
||||
}
|
||||
|
||||
private void ResetVSyncEvent()
|
||||
{
|
||||
UpdateSettings();
|
||||
|
||||
Machine.Events.AddEvent(CyclesPerVSync, _resetVSyncEvent);
|
||||
}
|
||||
|
||||
private void SetPixel(int x, int y, int color)
|
||||
{
|
||||
_videoService.SetPixel(x, 2 * y, _colorPalette[color]);
|
||||
}
|
||||
|
||||
private void UpdateSettings()
|
||||
{
|
||||
VideoSettings settings = Machine.Settings.Video;
|
||||
|
||||
_colorPalette[ColorMono00] = settings.Color.Black;
|
||||
_colorPalette[ColorMono01] = settings.Color.Monochrome;
|
||||
_colorPalette[ColorMono02] = settings.Color.Monochrome;
|
||||
_colorPalette[ColorMono04] = settings.Color.Monochrome;
|
||||
_colorPalette[ColorMono08] = settings.Color.Monochrome;
|
||||
_colorPalette[ColorMono10] = settings.Color.Monochrome;
|
||||
_colorPalette[ColorMono20] = settings.Color.Monochrome;
|
||||
_colorPalette[ColorMono40] = settings.Color.Monochrome;
|
||||
_colorPalette[ColorMono80] = settings.Color.Monochrome;
|
||||
|
||||
_colorPalette[ColorWhite00] = settings.Color.Black;
|
||||
_colorPalette[ColorWhite01] = settings.Color.White;
|
||||
_colorPalette[ColorWhite02] = settings.Color.White;
|
||||
_colorPalette[ColorWhite04] = settings.Color.White;
|
||||
_colorPalette[ColorWhite08] = settings.Color.White;
|
||||
_colorPalette[ColorWhite10] = settings.Color.White;
|
||||
_colorPalette[ColorWhite20] = settings.Color.White;
|
||||
_colorPalette[ColorWhite40] = settings.Color.White;
|
||||
_colorPalette[ColorWhite80] = settings.Color.White;
|
||||
|
||||
_colorPalette[ColorDHires0] = settings.Color.Black;
|
||||
_colorPalette[ColorDHires1] = settings.Color.DarkBlue;
|
||||
_colorPalette[ColorDHires2] = settings.Color.DarkGreen;
|
||||
_colorPalette[ColorDHires3] = settings.Color.MediumBlue;
|
||||
_colorPalette[ColorDHires4] = settings.Color.Brown;
|
||||
_colorPalette[ColorDHires5] = settings.Color.LightGrey;
|
||||
_colorPalette[ColorDHires6] = settings.Color.Green;
|
||||
_colorPalette[ColorDHires7] = settings.Color.Aquamarine;
|
||||
_colorPalette[ColorDHires8] = settings.Color.DeepRed;
|
||||
_colorPalette[ColorDHires9] = settings.Color.Purple;
|
||||
_colorPalette[ColorDHiresA] = settings.Color.DarkGrey;
|
||||
_colorPalette[ColorDHiresB] = settings.Color.LightBlue;
|
||||
_colorPalette[ColorDHiresC] = settings.Color.Orange;
|
||||
_colorPalette[ColorDHiresD] = settings.Color.Pink;
|
||||
_colorPalette[ColorDHiresE] = settings.Color.Yellow;
|
||||
_colorPalette[ColorDHiresF] = settings.Color.White;
|
||||
|
||||
if (_videoService.IsFullScreen != settings.IsFullScreen)
|
||||
{
|
||||
_videoService.ToggleFullScreen();
|
||||
}
|
||||
}
|
||||
|
||||
public bool IsVBlank { get; private set; }
|
||||
|
||||
private Action _flushRowEvent;
|
||||
private Action _inverseTextEvent;
|
||||
private Action _leaveVBlankEvent;
|
||||
private Action _resetVSyncEvent;
|
||||
|
||||
private Memory _memory;
|
||||
private VideoService _videoService;
|
||||
|
||||
private ushort[] _charSet;
|
||||
private uint[] _colorPalette = new uint[ColorPaletteCount];
|
||||
private bool[] _isCellDirty = new bool[Height * CellColumns + 1]; // includes sentinel
|
||||
private bool _isTextInversed;
|
||||
}
|
||||
}
|
1636
Virtu/VideoData.cs
Normal file
1636
Virtu/VideoData.cs
Normal file
File diff suppressed because it is too large
Load Diff
207
Virtu/Wpf/Jellyfish.Virtu.Wpf.csproj
Normal file
207
Virtu/Wpf/Jellyfish.Virtu.Wpf.csproj
Normal file
|
@ -0,0 +1,207 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="3.5" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProductVersion>9.0.30729</ProductVersion>
|
||||
<SchemaVersion>2.0</SchemaVersion>
|
||||
<ProjectGuid>{D59B29AC-1105-410D-A88D-61E9C98B0C4B}</ProjectGuid>
|
||||
<OutputType>WinExe</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>Jellyfish.Virtu</RootNamespace>
|
||||
<AssemblyName>Jellyfish.Virtu</AssemblyName>
|
||||
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<SignAssembly>true</SignAssembly>
|
||||
<AssemblyOriginatorKeyFile>..\..\Jellyfish.snk</AssemblyOriginatorKeyFile>
|
||||
<ApplicationIcon>Properties\AppleIcon.ico</ApplicationIcon>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\</OutputPath>
|
||||
<DefineConstants>TRACE;DEBUG;CODE_ANALYSIS</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
|
||||
<NoWarn>
|
||||
</NoWarn>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\</OutputPath>
|
||||
<DefineConstants>TRACE;CODE_ANALYSIS</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
|
||||
<NoWarn>
|
||||
</NoWarn>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Core">
|
||||
<RequiredTargetFramework>3.5</RequiredTargetFramework>
|
||||
</Reference>
|
||||
<Reference Include="System.Deployment" />
|
||||
<Reference Include="System.Xml.Linq">
|
||||
<RequiredTargetFramework>3.5</RequiredTargetFramework>
|
||||
</Reference>
|
||||
<Reference Include="System.Xml" />
|
||||
<Reference Include="WindowsBase">
|
||||
<RequiredTargetFramework>3.0</RequiredTargetFramework>
|
||||
</Reference>
|
||||
<Reference Include="PresentationCore">
|
||||
<RequiredTargetFramework>3.0</RequiredTargetFramework>
|
||||
</Reference>
|
||||
<Reference Include="PresentationFramework">
|
||||
<RequiredTargetFramework>3.0</RequiredTargetFramework>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ApplicationDefinition Include="MainApp.xaml">
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
</ApplicationDefinition>
|
||||
<Page Include="MainWindow.xaml">
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
</Page>
|
||||
<Compile Include="MainApp.xaml.cs">
|
||||
<DependentUpon>MainApp.xaml</DependentUpon>
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Compile Include="MainWindow.xaml.cs">
|
||||
<DependentUpon>MainWindow.xaml</DependentUpon>
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="..\Cassette.cs">
|
||||
<Link>Core\Cassette.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\Cpu.cs">
|
||||
<Link>Core\Cpu.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\CpuData.cs">
|
||||
<Link>Core\CpuData.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\Disk525.cs">
|
||||
<Link>Core\Disk525.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\DiskDsk.cs">
|
||||
<Link>Core\DiskDsk.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\DiskII.cs">
|
||||
<Link>Core\DiskII.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\DiskNib.cs">
|
||||
<Link>Core\DiskNib.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\Drive525.cs">
|
||||
<Link>Core\Drive525.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\GamePort.cs">
|
||||
<Link>Core\GamePort.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\Services\AudioService.cs">
|
||||
<Link>Services\AudioService.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\Services\GamePortService.cs">
|
||||
<Link>Services\GamePortService.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\Keyboard.cs">
|
||||
<Link>Core\Keyboard.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\Services\KeyboardService.cs">
|
||||
<Link>Services\KeyboardService.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\Machine.cs">
|
||||
<Link>Core\Machine.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\MachineComponent.cs">
|
||||
<Link>Core\MachineComponent.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\MachineEvents.cs">
|
||||
<Link>Core\MachineEvents.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\Services\MachineServices.cs">
|
||||
<Link>Services\MachineServices.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\MachineSettings.cs">
|
||||
<Link>Core\MachineSettings.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\Memory.cs">
|
||||
<Link>Core\Memory.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\MemoryData.cs">
|
||||
<Link>Core\MemoryData.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\Properties\SR.Designer.cs">
|
||||
<Link>Properties\SR.Designer.cs</Link>
|
||||
<AutoGen>True</AutoGen>
|
||||
<DesignTime>True</DesignTime>
|
||||
<DependentUpon>SR.resx</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="..\Services\StorageService.cs">
|
||||
<Link>Services\StorageService.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\Speaker.cs">
|
||||
<Link>Core\Speaker.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\Video.cs">
|
||||
<Link>Core\Video.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\VideoData.cs">
|
||||
<Link>Core\VideoData.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\Services\VideoService.cs">
|
||||
<Link>Services\VideoService.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="Properties\AssemblyInfo.cs">
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Services\WpfKeyboardService.cs" />
|
||||
<Compile Include="Services\WpfStorageService.cs" />
|
||||
<Compile Include="Services\WpfVideoService.cs" />
|
||||
<Resource Include="..\Roms\Apple2e.rom">
|
||||
<Link>Roms\Apple2e.rom</Link>
|
||||
</Resource>
|
||||
<Resource Include="..\Roms\Printer.rom">
|
||||
<Link>Roms\Printer.rom</Link>
|
||||
</Resource>
|
||||
<AppDesigner Include="Properties\" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<EmbeddedResource Include="..\Properties\SR.resx">
|
||||
<Link>Properties\SR.resx</Link>
|
||||
<Generator>ResXFileCodeGeneratorEx</Generator>
|
||||
<LastGenOutput>SR.Designer.cs</LastGenOutput>
|
||||
</EmbeddedResource>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Resource Include="Properties\AppleIcon.ico" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\Library\Wpf\Jellyfish.Library.Wpf.csproj">
|
||||
<Project>{D47A24A9-1590-4E8A-A406-BC66D5891BFA}</Project>
|
||||
<Name>Jellyfish.Library.Wpf</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<CodeAnalysisDictionary Include="..\CustomDictionary.xml">
|
||||
<Link>CustomDictionary.xml</Link>
|
||||
</CodeAnalysisDictionary>
|
||||
</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.
|
||||
<Target Name="BeforeBuild">
|
||||
</Target>
|
||||
<Target Name="AfterBuild">
|
||||
</Target>
|
||||
-->
|
||||
</Project>
|
26
Virtu/Wpf/Jellyfish.Virtu.Wpf.sln
Normal file
26
Virtu/Wpf/Jellyfish.Virtu.Wpf.sln
Normal file
|
@ -0,0 +1,26 @@
|
|||
|
||||
Microsoft Visual Studio Solution File, Format Version 10.00
|
||||
# Visual Studio 2008
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Jellyfish.Virtu.Wpf", "Jellyfish.Virtu.Wpf.csproj", "{D59B29AC-1105-410D-A88D-61E9C98B0C4B}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Jellyfish.Library.Wpf", "..\..\Library\Wpf\Jellyfish.Library.Wpf.csproj", "{D47A24A9-1590-4E8A-A406-BC66D5891BFA}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Release|Any CPU = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{D59B29AC-1105-410D-A88D-61E9C98B0C4B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{D59B29AC-1105-410D-A88D-61E9C98B0C4B}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{D59B29AC-1105-410D-A88D-61E9C98B0C4B}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{D59B29AC-1105-410D-A88D-61E9C98B0C4B}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{D47A24A9-1590-4E8A-A406-BC66D5891BFA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{D47A24A9-1590-4E8A-A406-BC66D5891BFA}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{D47A24A9-1590-4E8A-A406-BC66D5891BFA}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{D47A24A9-1590-4E8A-A406-BC66D5891BFA}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
EndGlobal
|
8
Virtu/Wpf/MainApp.xaml
Normal file
8
Virtu/Wpf/MainApp.xaml
Normal file
|
@ -0,0 +1,8 @@
|
|||
<jl:ApplicationBase x:Class="Jellyfish.Virtu.MainApp"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:jl="clr-namespace:Jellyfish.Library;assembly=Jellyfish.Library"
|
||||
StartupUri="MainWindow.xaml">
|
||||
<Application.Resources>
|
||||
</Application.Resources>
|
||||
</jl:ApplicationBase>
|
12
Virtu/Wpf/MainApp.xaml.cs
Normal file
12
Virtu/Wpf/MainApp.xaml.cs
Normal file
|
@ -0,0 +1,12 @@
|
|||
using Jellyfish.Library;
|
||||
|
||||
namespace Jellyfish.Virtu
|
||||
{
|
||||
public partial class MainApp : ApplicationBase
|
||||
{
|
||||
public MainApp() :
|
||||
base("Virtu")
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
11
Virtu/Wpf/MainWindow.xaml
Normal file
11
Virtu/Wpf/MainWindow.xaml
Normal file
|
@ -0,0 +1,11 @@
|
|||
<Window x:Class="Jellyfish.Virtu.MainWindow"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:jl="clr-namespace:Jellyfish.Library;assembly=Jellyfish.Library"
|
||||
Title="Virtu" ResizeMode="CanMinimize" SizeToContent="WidthAndHeight" WindowStartupLocation="CenterScreen">
|
||||
<Grid Background="Black" Cursor="None">
|
||||
<Image Name="_image" MinWidth="560" MinHeight="384" RenderOptions.BitmapScalingMode="NearestNeighbor"/>
|
||||
|
||||
<jl:FrameRateCounter/>
|
||||
</Grid>
|
||||
</Window>
|
58
Virtu/Wpf/MainWindow.xaml.cs
Normal file
58
Virtu/Wpf/MainWindow.xaml.cs
Normal file
|
@ -0,0 +1,58 @@
|
|||
using System;
|
||||
using System.Windows;
|
||||
using System.Windows.Media;
|
||||
using Jellyfish.Virtu.Services;
|
||||
|
||||
namespace Jellyfish.Virtu
|
||||
{
|
||||
public partial class MainWindow : Window
|
||||
{
|
||||
public MainWindow()
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
_storageService = new WpfStorageService();
|
||||
_keyboardService = new WpfKeyboardService(this);
|
||||
_gamePortService = new GamePortService(); // not connected
|
||||
_audioService = new AudioService(); // not connected
|
||||
_videoService = new WpfVideoService(this, _image);
|
||||
|
||||
_machine = new Machine();
|
||||
_machine.Services.AddService(typeof(StorageService), _storageService);
|
||||
_machine.Services.AddService(typeof(KeyboardService), _keyboardService);
|
||||
_machine.Services.AddService(typeof(GamePortService), _gamePortService);
|
||||
_machine.Services.AddService(typeof(AudioService), _audioService);
|
||||
_machine.Services.AddService(typeof(VideoService), _videoService);
|
||||
|
||||
Loaded += MainWindow_Loaded;
|
||||
CompositionTarget.Rendering += CompositionTarget_Rendering;
|
||||
Application.Current.Exit += MainApp_Exit;
|
||||
}
|
||||
|
||||
private void MainWindow_Loaded(object sender, RoutedEventArgs e)
|
||||
{
|
||||
_machine.Start();
|
||||
}
|
||||
|
||||
private void CompositionTarget_Rendering(object sender, EventArgs e)
|
||||
{
|
||||
_keyboardService.Update();
|
||||
_gamePortService.Update();
|
||||
_audioService.Update();
|
||||
_videoService.Update();
|
||||
}
|
||||
|
||||
private void MainApp_Exit(object sender, ExitEventArgs e)
|
||||
{
|
||||
_machine.Stop();
|
||||
}
|
||||
|
||||
private StorageService _storageService;
|
||||
private KeyboardService _keyboardService;
|
||||
private GamePortService _gamePortService;
|
||||
private AudioService _audioService;
|
||||
private VideoService _videoService;
|
||||
|
||||
private Machine _machine;
|
||||
}
|
||||
}
|
BIN
Virtu/Wpf/Properties/AppleIcon.ico
Normal file
BIN
Virtu/Wpf/Properties/AppleIcon.ico
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.4 KiB |
24
Virtu/Wpf/Properties/AssemblyInfo.cs
Normal file
24
Virtu/Wpf/Properties/AssemblyInfo.cs
Normal file
|
@ -0,0 +1,24 @@
|
|||
using System;
|
||||
using System.Reflection;
|
||||
using System.Resources;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Windows;
|
||||
using Jellyfish.Library;
|
||||
|
||||
[assembly: AssemblyTitle("Virtu")]
|
||||
[assembly: AssemblyDescription("Apple IIe Emulator")]
|
||||
[assembly: AssemblyProduct("Jellyfish.Virtu.Wpf")]
|
||||
[assembly: AssemblyCompany("Digital Jellyfish Design Ltd")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2009 Digital Jellyfish Design Ltd")]
|
||||
[assembly: AssemblyComment("Developed by Sean Fausett & Nick Westgate")]
|
||||
|
||||
[assembly: AssemblyVersion("0.6.0.0")]
|
||||
[assembly: AssemblyFileVersion("0.6.0.0")]
|
||||
|
||||
[assembly: CLSCompliant(false)]
|
||||
[assembly: ComVisible(false)]
|
||||
[assembly: Guid("89a50370-1ed9-4cf1-ad08-043b6e6f3c90")]
|
||||
|
||||
[assembly: NeutralResourcesLanguage("en")]
|
||||
|
||||
[assembly: ThemeInfo(ResourceDictionaryLocation.None, ResourceDictionaryLocation.SourceAssembly)]
|
320
Virtu/Wpf/Services/WpfKeyboardService.cs
Normal file
320
Virtu/Wpf/Services/WpfKeyboardService.cs
Normal file
|
@ -0,0 +1,320 @@
|
|||
using System;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Linq;
|
||||
using System.Windows;
|
||||
using System.Windows.Input;
|
||||
|
||||
namespace Jellyfish.Virtu.Services
|
||||
{
|
||||
public sealed class WpfKeyboardService : KeyboardService
|
||||
{
|
||||
public WpfKeyboardService(Window window)
|
||||
{
|
||||
_window = window;
|
||||
|
||||
_window.GotKeyboardFocus += Window_GotKeyboardFocus;
|
||||
_window.KeyDown += Window_KeyDown;
|
||||
_window.KeyUp += Window_KeyUp;
|
||||
}
|
||||
|
||||
public override bool IsKeyDown(int key)
|
||||
{
|
||||
return IsKeyDown((Key)key);
|
||||
}
|
||||
|
||||
public override void Update()
|
||||
{
|
||||
KeyboardDevice keyboard = System.Windows.Input.Keyboard.PrimaryDevice;
|
||||
if (_updateAnyKeyDown)
|
||||
{
|
||||
_updateAnyKeyDown = false;
|
||||
IsAnyKeyDown = false;
|
||||
foreach (Key key in KeyValues)
|
||||
{
|
||||
bool isKeyDown = keyboard.IsKeyDown(key);
|
||||
_states[(int)key] = isKeyDown;
|
||||
if (isKeyDown)
|
||||
{
|
||||
IsAnyKeyDown = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ModifierKeys modifiers = keyboard.Modifiers;
|
||||
IsOpenAppleKeyDown = keyboard.IsKeyDown(Key.LeftAlt);
|
||||
IsCloseAppleKeyDown = keyboard.IsKeyDown(Key.RightAlt);
|
||||
IsResetKeyDown = ((modifiers & ModifierKeys.Control) != 0) && keyboard.IsKeyDown(Key.F12);
|
||||
|
||||
IsCpuThrottleKeyDown = keyboard.IsKeyDown(Key.F8);
|
||||
IsVideoFullScreenKeyDown = keyboard.IsKeyDown(Key.F11);
|
||||
IsVideoMonochromeKeyDown = keyboard.IsKeyDown(Key.F9);
|
||||
}
|
||||
|
||||
private bool IsKeyDown(Key key)
|
||||
{
|
||||
return _states[(int)key];
|
||||
}
|
||||
|
||||
private void Window_GotKeyboardFocus(object sender, EventArgs e)
|
||||
{
|
||||
_updateAnyKeyDown = true;
|
||||
}
|
||||
|
||||
private void Window_KeyDown(object sender, KeyEventArgs e)
|
||||
{
|
||||
_states[(int)((e.Key == Key.System) ? e.SystemKey : e.Key)] = true;
|
||||
IsAnyKeyDown = true;
|
||||
|
||||
int asciiKey = GetAsciiKey(e.Key, e.KeyboardDevice);
|
||||
if (asciiKey >= 0)
|
||||
{
|
||||
RaiseAsciiKeyDown(asciiKey);
|
||||
e.Handled = true;
|
||||
}
|
||||
}
|
||||
|
||||
private void Window_KeyUp(object sender, KeyEventArgs e)
|
||||
{
|
||||
_states[(int)((e.Key == Key.System) ? e.SystemKey : e.Key)] = false;
|
||||
_updateAnyKeyDown = true;
|
||||
}
|
||||
|
||||
[SuppressMessage("Microsoft.Maintainability", "CA1502:AvoidExcessiveComplexity")]
|
||||
[SuppressMessage("Microsoft.Maintainability", "CA1505:AvoidUnmaintainableCode")]
|
||||
private static int GetAsciiKey(Key key, KeyboardDevice keyboard)
|
||||
{
|
||||
bool control = ((keyboard.Modifiers & ModifierKeys.Control) != 0);
|
||||
bool shift = ((keyboard.Modifiers & ModifierKeys.Shift) != 0);
|
||||
bool capsLock = shift ^ keyboard.IsKeyToggled(Key.CapsLock);
|
||||
|
||||
switch (key)
|
||||
{
|
||||
case Key.Left:
|
||||
return 0x08;
|
||||
|
||||
case Key.Tab:
|
||||
return 0x09;
|
||||
|
||||
case Key.Down:
|
||||
return 0x0A;
|
||||
|
||||
case Key.Up:
|
||||
return 0x0B;
|
||||
|
||||
case Key.Enter:
|
||||
return 0x0D;
|
||||
|
||||
case Key.Right:
|
||||
return 0x15;
|
||||
|
||||
case Key.Escape:
|
||||
return 0x1B;
|
||||
|
||||
case Key.Back:
|
||||
return 0x7F;
|
||||
|
||||
case Key.Space:
|
||||
return ' ';
|
||||
|
||||
case Key.D1:
|
||||
return shift ? '!' : '1';
|
||||
|
||||
case Key.D2:
|
||||
return control ? 0x00 : shift ? '@' : '2';
|
||||
|
||||
case Key.D3:
|
||||
return shift ? '#' : '3';
|
||||
|
||||
case Key.D4:
|
||||
return shift ? '$' : '4';
|
||||
|
||||
case Key.D5:
|
||||
return shift ? '%' : '5';
|
||||
|
||||
case Key.D6:
|
||||
return control ? 0x1E : shift ? '^' : '6';
|
||||
|
||||
case Key.D7:
|
||||
return shift ? '&' : '7';
|
||||
|
||||
case Key.D8:
|
||||
return shift ? '*' : '8';
|
||||
|
||||
case Key.D9:
|
||||
return shift ? '(' : '9';
|
||||
|
||||
case Key.D0:
|
||||
return shift ? ')' : '0';
|
||||
|
||||
case Key.A:
|
||||
return control ? 0x01 : capsLock ? 'A' : 'a';
|
||||
|
||||
case Key.B:
|
||||
return control ? 0x02 : capsLock ? 'B' : 'b';
|
||||
|
||||
case Key.C:
|
||||
return control ? 0x03 : capsLock ? 'C' : 'c';
|
||||
|
||||
case Key.D:
|
||||
return control ? 0x04 : capsLock ? 'D' : 'd';
|
||||
|
||||
case Key.E:
|
||||
return control ? 0x05 : capsLock ? 'E' : 'e';
|
||||
|
||||
case Key.F:
|
||||
return control ? 0x06 : capsLock ? 'F' : 'f';
|
||||
|
||||
case Key.G:
|
||||
return control ? 0x07 : capsLock ? 'G' : 'g';
|
||||
|
||||
case Key.H:
|
||||
return control ? 0x08 : capsLock ? 'H' : 'h';
|
||||
|
||||
case Key.I:
|
||||
return control ? 0x09 : capsLock ? 'I' : 'i';
|
||||
|
||||
case Key.J:
|
||||
return control ? 0x0A : capsLock ? 'J' : 'j';
|
||||
|
||||
case Key.K:
|
||||
return control ? 0x0B : capsLock ? 'K' : 'k';
|
||||
|
||||
case Key.L:
|
||||
return control ? 0x0C : capsLock ? 'L' : 'l';
|
||||
|
||||
case Key.M:
|
||||
return control ? 0x0D : capsLock ? 'M' : 'm';
|
||||
|
||||
case Key.N:
|
||||
return control ? 0x0E : capsLock ? 'N' : 'n';
|
||||
|
||||
case Key.O:
|
||||
return control ? 0x0F : capsLock ? 'O' : 'o';
|
||||
|
||||
case Key.P:
|
||||
return control ? 0x10 : capsLock ? 'P' : 'p';
|
||||
|
||||
case Key.Q:
|
||||
return control ? 0x11 : capsLock ? 'Q' : 'q';
|
||||
|
||||
case Key.R:
|
||||
return control ? 0x12 : capsLock ? 'R' : 'r';
|
||||
|
||||
case Key.S:
|
||||
return control ? 0x13 : capsLock ? 'S' : 's';
|
||||
|
||||
case Key.T:
|
||||
return control ? 0x14 : capsLock ? 'T' : 't';
|
||||
|
||||
case Key.U:
|
||||
return control ? 0x15 : capsLock ? 'U' : 'u';
|
||||
|
||||
case Key.V:
|
||||
return control ? 0x16 : capsLock ? 'V' : 'v';
|
||||
|
||||
case Key.W:
|
||||
return control ? 0x17 : capsLock ? 'W' : 'w';
|
||||
|
||||
case Key.X:
|
||||
return control ? 0x18 : capsLock ? 'X' : 'x';
|
||||
|
||||
case Key.Y:
|
||||
return control ? 0x19 : capsLock ? 'Y' : 'y';
|
||||
|
||||
case Key.Z:
|
||||
return control ? 0x1A : capsLock ? 'Z' : 'z';
|
||||
|
||||
case Key.Oem1:
|
||||
return shift ? ':' : ';';
|
||||
|
||||
case Key.Oem2:
|
||||
return shift ? '?' : '/';
|
||||
|
||||
case Key.Oem3:
|
||||
return shift ? '~' : '`';
|
||||
|
||||
case Key.Oem4:
|
||||
return shift ? '{' : '[';
|
||||
|
||||
case Key.Oem5:
|
||||
return control ? 0x1C : shift ? '|' : '\\';
|
||||
|
||||
case Key.Oem6:
|
||||
return control ? 0x1D : shift ? '}' : ']';
|
||||
|
||||
case Key.Oem7:
|
||||
return shift ? '"' : '\'';
|
||||
|
||||
case Key.OemMinus:
|
||||
return control ? 0x1F : shift ? '_' : '-';
|
||||
|
||||
case Key.OemPlus:
|
||||
return shift ? '+' : '=';
|
||||
|
||||
case Key.OemComma:
|
||||
return shift ? '<' : ',';
|
||||
|
||||
case Key.OemPeriod:
|
||||
return shift ? '>' : '.';
|
||||
|
||||
case Key.NumPad1:
|
||||
return '1';
|
||||
|
||||
case Key.NumPad2:
|
||||
return '2';
|
||||
|
||||
case Key.NumPad3:
|
||||
return '3';
|
||||
|
||||
case Key.NumPad4:
|
||||
return '4';
|
||||
|
||||
case Key.NumPad5:
|
||||
return '5';
|
||||
|
||||
case Key.NumPad6:
|
||||
return '6';
|
||||
|
||||
case Key.NumPad7:
|
||||
return '7';
|
||||
|
||||
case Key.NumPad8:
|
||||
return '8';
|
||||
|
||||
case Key.NumPad9:
|
||||
return '9';
|
||||
|
||||
case Key.NumPad0:
|
||||
return '0';
|
||||
|
||||
case Key.Decimal:
|
||||
return '.';
|
||||
|
||||
case Key.Divide:
|
||||
return '/';
|
||||
|
||||
case Key.Multiply:
|
||||
return '*';
|
||||
|
||||
case Key.Subtract:
|
||||
return '-';
|
||||
|
||||
case Key.Add:
|
||||
return '+';
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
private static readonly Key[] KeyValues =
|
||||
(from key in (Key[])Enum.GetValues(typeof(Key))
|
||||
where (key != Key.None) // filter Key.None; avoids validation exception
|
||||
select key).ToArray();
|
||||
|
||||
private static readonly int KeyCount = (int)(KeyValues.Max()) + 1;
|
||||
|
||||
private Window _window;
|
||||
private bool[] _states = new bool[KeyCount];
|
||||
private bool _updateAnyKeyDown;
|
||||
}
|
||||
}
|
73
Virtu/Wpf/Services/WpfStorageService.cs
Normal file
73
Virtu/Wpf/Services/WpfStorageService.cs
Normal file
|
@ -0,0 +1,73 @@
|
|||
using System;
|
||||
using System.Deployment.Application;
|
||||
using System.IO;
|
||||
using System.IO.IsolatedStorage;
|
||||
using System.Windows;
|
||||
using Microsoft.Win32;
|
||||
|
||||
namespace Jellyfish.Virtu.Services
|
||||
{
|
||||
public sealed class WpfStorageService : StorageService
|
||||
{
|
||||
public override string GetDiskFile()
|
||||
{
|
||||
string fileName = string.Empty;
|
||||
|
||||
Application.Current.Dispatcher.Invoke(new Action(() =>
|
||||
{
|
||||
OpenFileDialog dialog = new OpenFileDialog();
|
||||
dialog.Filter = "Disk Files (*.nib)|*.nib|All Files (*.*)|*.*";
|
||||
bool? result = dialog.ShowDialog();
|
||||
if (result.HasValue && result.Value)
|
||||
{
|
||||
fileName = dialog.FileName;
|
||||
}
|
||||
}));
|
||||
|
||||
return fileName;
|
||||
}
|
||||
|
||||
public override void Load(string path, Action<Stream> reader)
|
||||
{
|
||||
try
|
||||
{
|
||||
using (IsolatedStorageFile store = GetStore())
|
||||
{
|
||||
using (IsolatedStorageFileStream stream = new IsolatedStorageFileStream(path, FileMode.Open, FileAccess.Read, FileShare.Read, store))
|
||||
{
|
||||
reader(stream);
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (FileNotFoundException)
|
||||
{
|
||||
}
|
||||
catch (IsolatedStorageException)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
public override void Save(string path, Action<Stream> writer)
|
||||
{
|
||||
try
|
||||
{
|
||||
using (IsolatedStorageFile store = GetStore())
|
||||
{
|
||||
using (IsolatedStorageFileStream stream = new IsolatedStorageFileStream(path, FileMode.Create, FileAccess.Write, FileShare.None, store))
|
||||
{
|
||||
writer(stream);
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (IsolatedStorageException)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
private static IsolatedStorageFile GetStore()
|
||||
{
|
||||
return ApplicationDeployment.IsNetworkDeployed ? // clickonce
|
||||
IsolatedStorageFile.GetUserStoreForApplication() : IsolatedStorageFile.GetUserStoreForAssembly();
|
||||
}
|
||||
}
|
||||
}
|
82
Virtu/Wpf/Services/WpfVideoService.cs
Normal file
82
Virtu/Wpf/Services/WpfVideoService.cs
Normal file
|
@ -0,0 +1,82 @@
|
|||
using System;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media.Imaging;
|
||||
using Microsoft.Win32;
|
||||
|
||||
namespace Jellyfish.Virtu.Services
|
||||
{
|
||||
public sealed class WpfVideoService : VideoService
|
||||
{
|
||||
public WpfVideoService(Window window, Image image)
|
||||
{
|
||||
_window = window;
|
||||
_image = image;
|
||||
SetImageSize();
|
||||
|
||||
_bitmap = new WriteableBitmap(BitmapWidth, BitmapHeight, BitmapDpi, BitmapDpi, BitmapPixelFormat, null);
|
||||
_pixels = new uint[BitmapWidth * BitmapHeight];
|
||||
_image.Source = _bitmap;
|
||||
|
||||
SystemEvents.DisplaySettingsChanged += (sender, e) => SetImageSize();
|
||||
}
|
||||
|
||||
[SuppressMessage("Microsoft.Usage", "CA2233:OperationsShouldNotOverflow", MessageId = "y*560")]
|
||||
public override void SetPixel(int x, int y, uint color)
|
||||
{
|
||||
_pixels[y * BitmapWidth + x] = color;
|
||||
_pixelsDirty = true;
|
||||
}
|
||||
|
||||
public override void Update()
|
||||
{
|
||||
if (_window.IsActive && (_isFullScreen != IsFullScreen))
|
||||
{
|
||||
if (IsFullScreen)
|
||||
{
|
||||
_window.SizeToContent = SizeToContent.Manual;
|
||||
_window.Topmost = true;
|
||||
_window.WindowStyle = WindowStyle.None;
|
||||
_window.WindowState = WindowState.Maximized;
|
||||
}
|
||||
else
|
||||
{
|
||||
_window.WindowState = WindowState.Normal;
|
||||
_window.WindowStyle = WindowStyle.SingleBorderWindow;
|
||||
_window.Topmost = false;
|
||||
_window.SizeToContent = SizeToContent.WidthAndHeight;
|
||||
}
|
||||
_isFullScreen = IsFullScreen;
|
||||
}
|
||||
|
||||
if (_pixelsDirty)
|
||||
{
|
||||
_pixelsDirty = false;
|
||||
_bitmap.WritePixels(BitmapRect, _pixels, BitmapStride, 0);
|
||||
}
|
||||
}
|
||||
|
||||
private void SetImageSize()
|
||||
{
|
||||
int uniformScale = Math.Min((int)SystemParameters.PrimaryScreenWidth / BitmapWidth, (int)SystemParameters.PrimaryScreenHeight / BitmapHeight);
|
||||
_image.Width = uniformScale * BitmapWidth;
|
||||
_image.Height = uniformScale * BitmapHeight;
|
||||
}
|
||||
|
||||
private const int BitmapWidth = 560;
|
||||
private const int BitmapHeight = 384;
|
||||
private const int BitmapDpi = 96;
|
||||
private static readonly PixelFormat BitmapPixelFormat = PixelFormats.Bgr32;
|
||||
private static readonly int BitmapStride = (BitmapWidth * BitmapPixelFormat.BitsPerPixel + 7) / 8;
|
||||
private static readonly Int32Rect BitmapRect = new Int32Rect(0, 0, BitmapWidth, BitmapHeight);
|
||||
|
||||
private Window _window;
|
||||
private Image _image;
|
||||
private WriteableBitmap _bitmap;
|
||||
private uint[] _pixels;
|
||||
private bool _pixelsDirty;
|
||||
private bool _isFullScreen;
|
||||
}
|
||||
}
|
17
Virtu/Xna/Content/Consolas.spritefont
Normal file
17
Virtu/Xna/Content/Consolas.spritefont
Normal file
|
@ -0,0 +1,17 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<XnaContent xmlns:Graphics="Microsoft.Xna.Framework.Content.Pipeline.Graphics">
|
||||
<Asset Type="Graphics:FontDescription">
|
||||
<FontName>Consolas</FontName>
|
||||
<Size>12</Size>
|
||||
<Spacing>0</Spacing>
|
||||
<UseKerning>true</UseKerning>
|
||||
<Style>Regular</Style>
|
||||
<DefaultCharacter>*</DefaultCharacter>
|
||||
<CharacterRegions>
|
||||
<CharacterRegion>
|
||||
<Start> </Start>
|
||||
<End>~</End>
|
||||
</CharacterRegion>
|
||||
</CharacterRegions>
|
||||
</Asset>
|
||||
</XnaContent>
|
52
Virtu/Xna/Content/Content.contentproj
Normal file
52
Virtu/Xna/Content/Content.contentproj
Normal file
|
@ -0,0 +1,52 @@
|
|||
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="3.5">
|
||||
<PropertyGroup>
|
||||
<ProjectGuid>bfe4fbb9-2855-4a2b-9067-a82419579a7d</ProjectGuid>
|
||||
<ProjectTypeGuids>{96E2B04D-8817-42c6-938A-82C39BA4D311};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">x86</Platform>
|
||||
<OutputType>Library</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
|
||||
<XnaFrameworkVersion>v3.0</XnaFrameworkVersion>
|
||||
<PlatformTarget>x86</PlatformTarget>
|
||||
<OutputPath>bin\$(Platform)\$(Configuration)</OutputPath>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
|
||||
<XnaPlatform>Windows</XnaPlatform>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
|
||||
<XnaPlatform>Windows</XnaPlatform>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="Microsoft.Xna.Framework.Content.Pipeline.EffectImporter, Version=3.0.0.0, Culture=neutral, PublicKeyToken=6d5c3888ef60e27d, processorArchitecture=MSIL">
|
||||
<Private>False</Private>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.Xna.Framework.Content.Pipeline.FBXImporter, Version=3.0.0.0, Culture=neutral, PublicKeyToken=6d5c3888ef60e27d, processorArchitecture=MSIL">
|
||||
<Private>False</Private>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.Xna.Framework.Content.Pipeline.TextureImporter, Version=3.0.0.0, Culture=neutral, PublicKeyToken=6d5c3888ef60e27d, processorArchitecture=MSIL">
|
||||
<Private>False</Private>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.Xna.Framework.Content.Pipeline.XImporter, Version=3.0.0.0, Culture=neutral, PublicKeyToken=6d5c3888ef60e27d, processorArchitecture=MSIL">
|
||||
<Private>False</Private>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.Xna.Framework.Content.Pipeline.AudioImporters, Version=3.0.0.0, Culture=neutral, PublicKeyToken=6d5c3888ef60e27d, processorArchitecture=MSIL">
|
||||
<Private>False</Private>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Consolas.spritefont">
|
||||
<Name>Consolas</Name>
|
||||
<Importer>FontDescriptionImporter</Importer>
|
||||
<Processor>FontDescriptionProcessor</Processor>
|
||||
</Compile>
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildExtensionsPath)\Microsoft\XNA Game Studio\v3.0\Microsoft.Xna.GameStudio.ContentPipeline.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.
|
||||
<Target Name="BeforeBuild">
|
||||
</Target>
|
||||
<Target Name="AfterBuild">
|
||||
</Target>
|
||||
-->
|
||||
</Project>
|
262
Virtu/Xna/Jellyfish.Virtu.Xna.Xbox.csproj
Normal file
262
Virtu/Xna/Jellyfish.Virtu.Xna.Xbox.csproj
Normal file
|
@ -0,0 +1,262 @@
|
|||
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="3.5">
|
||||
<PropertyGroup>
|
||||
<ProjectGuid>{1D3618DE-F050-4350-826E-5E84BC62DEE3}</ProjectGuid>
|
||||
<ProjectTypeGuids>{2DF5C3F4-5A5F-47a9-8E94-23B4456F55E2};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">Xbox 360</Platform>
|
||||
<OutputType>WinExe</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>Jellyfish.Virtu</RootNamespace>
|
||||
<AssemblyName>Jellyfish.Virtu</AssemblyName>
|
||||
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
|
||||
<XnaFrameworkVersion>v3.0</XnaFrameworkVersion>
|
||||
<XnaPlatform>Xbox 360</XnaPlatform>
|
||||
<XnaCrossPlatformGroupID>5624fafb-e097-4935-a2af-35fe579b07ca</XnaCrossPlatformGroupID>
|
||||
<ApplicationIcon>
|
||||
</ApplicationIcon>
|
||||
<Thumbnail>Properties\AppleThumbnail.png</Thumbnail>
|
||||
<PublishUrl>publish\</PublishUrl>
|
||||
<Install>true</Install>
|
||||
<InstallFrom>Disk</InstallFrom>
|
||||
<UpdateEnabled>false</UpdateEnabled>
|
||||
<UpdateMode>Foreground</UpdateMode>
|
||||
<UpdateInterval>7</UpdateInterval>
|
||||
<UpdateIntervalUnits>Days</UpdateIntervalUnits>
|
||||
<UpdatePeriodically>false</UpdatePeriodically>
|
||||
<UpdateRequired>false</UpdateRequired>
|
||||
<MapFileExtensions>true</MapFileExtensions>
|
||||
<ApplicationRevision>0</ApplicationRevision>
|
||||
<ApplicationVersion>1.0.0.%2a</ApplicationVersion>
|
||||
<IsWebBootstrapper>false</IsWebBootstrapper>
|
||||
<UseApplicationTrust>false</UseApplicationTrust>
|
||||
<BootstrapperEnabled>true</BootstrapperEnabled>
|
||||
<SignAssembly>true</SignAssembly>
|
||||
<AssemblyOriginatorKeyFile>..\..\Jellyfish.snk</AssemblyOriginatorKeyFile>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|Xbox 360' ">
|
||||
<OutputPath>bin\Xbox\</OutputPath>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<NoStdLib>true</NoStdLib>
|
||||
<UseVSHostingProcess>false</UseVSHostingProcess>
|
||||
<PlatformTarget>x86</PlatformTarget>
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<DefineConstants>TRACE;DEBUG;XBOX;XBOX360;CODE_ANALYSIS</DefineConstants>
|
||||
<XnaCompressContent>true</XnaCompressContent>
|
||||
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
|
||||
<NoWarn>
|
||||
</NoWarn>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|Xbox 360' ">
|
||||
<OutputPath>bin\Xbox\</OutputPath>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<NoStdLib>true</NoStdLib>
|
||||
<UseVSHostingProcess>false</UseVSHostingProcess>
|
||||
<PlatformTarget>x86</PlatformTarget>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<DefineConstants>TRACE;XBOX;XBOX360;CODE_ANALYSIS</DefineConstants>
|
||||
<XnaCompressContent>true</XnaCompressContent>
|
||||
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
|
||||
<NoWarn>
|
||||
</NoWarn>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="..\Cassette.cs">
|
||||
<Link>Core\Cassette.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\Cpu.cs">
|
||||
<Link>Core\Cpu.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\CpuData.cs">
|
||||
<Link>Core\CpuData.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\Disk525.cs">
|
||||
<Link>Core\Disk525.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\DiskDsk.cs">
|
||||
<Link>Core\DiskDsk.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\DiskII.cs">
|
||||
<Link>Core\DiskII.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\DiskNib.cs">
|
||||
<Link>Core\DiskNib.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\Drive525.cs">
|
||||
<Link>Core\Drive525.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\GamePort.cs">
|
||||
<Link>Core\GamePort.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\Keyboard.cs">
|
||||
<Link>Core\Keyboard.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\Machine.cs">
|
||||
<Link>Core\Machine.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\MachineComponent.cs">
|
||||
<Link>Core\MachineComponent.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\MachineEvents.cs">
|
||||
<Link>Core\MachineEvents.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\MachineSettings.cs">
|
||||
<Link>Core\MachineSettings.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\Memory.cs">
|
||||
<Link>Core\Memory.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\MemoryData.cs">
|
||||
<Link>Core\MemoryData.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\Properties\SR.Designer.cs">
|
||||
<Link>Properties\SR.Designer.cs</Link>
|
||||
<AutoGen>True</AutoGen>
|
||||
<DesignTime>True</DesignTime>
|
||||
<DependentUpon>SR.resx</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="..\Services\AudioService.cs">
|
||||
<Link>Services\AudioService.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\Services\GamePortService.cs">
|
||||
<Link>Services\GamePortService.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\Services\KeyboardService.cs">
|
||||
<Link>Services\KeyboardService.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\Services\MachineServices.cs">
|
||||
<Link>Services\MachineServices.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\Services\StorageService.cs">
|
||||
<Link>Services\StorageService.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\Services\VideoService.cs">
|
||||
<Link>Services\VideoService.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\Speaker.cs">
|
||||
<Link>Core\Speaker.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\Video.cs">
|
||||
<Link>Core\Video.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\VideoData.cs">
|
||||
<Link>Core\VideoData.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="MainApp.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="MainGame.cs" />
|
||||
<Compile Include="Services\XnaGamePortService.cs" />
|
||||
<Compile Include="Services\XnaKeyboardService.cs" />
|
||||
<Compile Include="Services\XnaStorageService.cs" />
|
||||
<Compile Include="Services\XnaVideoService.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<CodeAnalysisDictionary Include="..\CustomDictionary.xml">
|
||||
<Link>CustomDictionary.xml</Link>
|
||||
</CodeAnalysisDictionary>
|
||||
<Content Include="Properties\AppleIcon.ico" />
|
||||
<Content Include="Properties\AppleThumbnail.png" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<NestedContentProject Include="Content\Content.contentproj">
|
||||
<Project>bfe4fbb9-2855-4a2b-9067-a82419579a7d</Project>
|
||||
<Visible>False</Visible>
|
||||
</NestedContentProject>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<BootstrapperPackage Include="Microsoft.Net.Client.3.5">
|
||||
<Visible>False</Visible>
|
||||
<ProductName>.NET Framework Client Profile</ProductName>
|
||||
<Install>false</Install>
|
||||
</BootstrapperPackage>
|
||||
<BootstrapperPackage Include="Microsoft.Net.Framework.2.0">
|
||||
<Visible>False</Visible>
|
||||
<ProductName>.NET Framework 2.0 %28x86%29</ProductName>
|
||||
<Install>false</Install>
|
||||
</BootstrapperPackage>
|
||||
<BootstrapperPackage Include="Microsoft.Net.Framework.3.0">
|
||||
<Visible>False</Visible>
|
||||
<ProductName>.NET Framework 3.0 %28x86%29</ProductName>
|
||||
<Install>false</Install>
|
||||
</BootstrapperPackage>
|
||||
<BootstrapperPackage Include="Microsoft.Net.Framework.3.5">
|
||||
<Visible>False</Visible>
|
||||
<ProductName>.NET Framework 3.5</ProductName>
|
||||
<Install>false</Install>
|
||||
</BootstrapperPackage>
|
||||
<BootstrapperPackage Include="Microsoft.Net.Framework.3.5.SP1">
|
||||
<Visible>False</Visible>
|
||||
<ProductName>.NET Framework 3.5 SP1</ProductName>
|
||||
<Install>true</Install>
|
||||
</BootstrapperPackage>
|
||||
<BootstrapperPackage Include="Microsoft.Windows.Installer.3.1">
|
||||
<Visible>False</Visible>
|
||||
<ProductName>Windows Installer 3.1</ProductName>
|
||||
<Install>true</Install>
|
||||
</BootstrapperPackage>
|
||||
<BootstrapperPackage Include="Microsoft.Xna.Framework.3.0">
|
||||
<Visible>False</Visible>
|
||||
<ProductName>Microsoft XNA Framework Redistributable 3.0</ProductName>
|
||||
<Install>true</Install>
|
||||
</BootstrapperPackage>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<EmbeddedResource Include="..\Properties\SR.resx">
|
||||
<Link>Properties\SR.resx</Link>
|
||||
<Generator>ResXFileCodeGeneratorEx</Generator>
|
||||
<LastGenOutput>SR.Designer.cs</LastGenOutput>
|
||||
</EmbeddedResource>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Resource Include="..\Roms\Apple2e.rom">
|
||||
<Link>Roms\Apple2e.rom</Link>
|
||||
</Resource>
|
||||
<Resource Include="..\Roms\Printer.rom">
|
||||
<Link>Roms\Printer.rom</Link>
|
||||
</Resource>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="Microsoft.Xna.Framework">
|
||||
<Private>False</Private>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.Xna.Framework.Game">
|
||||
<Private>False</Private>
|
||||
</Reference>
|
||||
<Reference Include="mscorlib">
|
||||
<Private>False</Private>
|
||||
</Reference>
|
||||
<Reference Include="System">
|
||||
<Private>False</Private>
|
||||
</Reference>
|
||||
<Reference Include="System.Core">
|
||||
<Private>False</Private>
|
||||
<RequiredTargetFramework>3.5</RequiredTargetFramework>
|
||||
</Reference>
|
||||
<Reference Include="System.Xml">
|
||||
<Private>False</Private>
|
||||
</Reference>
|
||||
<Reference Include="System.Xml.Linq">
|
||||
<Private>False</Private>
|
||||
<RequiredTargetFramework>3.5</RequiredTargetFramework>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\Library\Xna\Jellyfish.Library.Xna.Xbox.csproj">
|
||||
<Project>{6EE9A3C2-0BD8-480D-AED2-6A5A9EBF7AFA}</Project>
|
||||
<Name>Jellyfish.Library.Xna.Xbox</Name>
|
||||
</ProjectReference>
|
||||
</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.
|
||||
Other similar extension points exist, see Microsoft.Common.targets.
|
||||
<Target Name="BeforeBuild">
|
||||
</Target>
|
||||
<Target Name="AfterBuild">
|
||||
</Target>
|
||||
-->
|
||||
</Project>
|
264
Virtu/Xna/Jellyfish.Virtu.Xna.csproj
Normal file
264
Virtu/Xna/Jellyfish.Virtu.Xna.csproj
Normal file
|
@ -0,0 +1,264 @@
|
|||
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="3.5">
|
||||
<PropertyGroup>
|
||||
<ProjectGuid>{F72C1068-E6F3-4A6C-A404-F88626B43B7C}</ProjectGuid>
|
||||
<ProjectTypeGuids>{6D335F3A-9D43-41b4-9D22-F6F17C4BE596};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">x86</Platform>
|
||||
<OutputType>WinExe</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>Jellyfish.Virtu</RootNamespace>
|
||||
<AssemblyName>Jellyfish.Virtu</AssemblyName>
|
||||
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
|
||||
<XnaFrameworkVersion>v3.0</XnaFrameworkVersion>
|
||||
<XnaPlatform>Windows</XnaPlatform>
|
||||
<XnaCrossPlatformGroupID>5624fafb-e097-4935-a2af-35fe579b07ca</XnaCrossPlatformGroupID>
|
||||
<ApplicationIcon>Properties\AppleIcon.ico</ApplicationIcon>
|
||||
<Thumbnail>Properties\AppleThumbnail.png</Thumbnail>
|
||||
<PublishUrl>publish\</PublishUrl>
|
||||
<Install>true</Install>
|
||||
<InstallFrom>Disk</InstallFrom>
|
||||
<UpdateEnabled>false</UpdateEnabled>
|
||||
<UpdateMode>Foreground</UpdateMode>
|
||||
<UpdateInterval>7</UpdateInterval>
|
||||
<UpdateIntervalUnits>Days</UpdateIntervalUnits>
|
||||
<UpdatePeriodically>false</UpdatePeriodically>
|
||||
<UpdateRequired>false</UpdateRequired>
|
||||
<MapFileExtensions>true</MapFileExtensions>
|
||||
<ApplicationRevision>0</ApplicationRevision>
|
||||
<ApplicationVersion>1.0.0.%2a</ApplicationVersion>
|
||||
<IsWebBootstrapper>false</IsWebBootstrapper>
|
||||
<UseApplicationTrust>false</UseApplicationTrust>
|
||||
<BootstrapperEnabled>true</BootstrapperEnabled>
|
||||
<SignAssembly>true</SignAssembly>
|
||||
<AssemblyOriginatorKeyFile>..\..\Jellyfish.snk</AssemblyOriginatorKeyFile>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\</OutputPath>
|
||||
<DefineConstants>TRACE;DEBUG;WINDOWS;CODE_ANALYSIS</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<NoStdLib>true</NoStdLib>
|
||||
<UseVSHostingProcess>false</UseVSHostingProcess>
|
||||
<PlatformTarget>x86</PlatformTarget>
|
||||
<XnaCompressContent>false</XnaCompressContent>
|
||||
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
|
||||
<NoWarn>
|
||||
</NoWarn>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\</OutputPath>
|
||||
<DefineConstants>TRACE;WINDOWS;CODE_ANALYSIS</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<NoStdLib>true</NoStdLib>
|
||||
<UseVSHostingProcess>false</UseVSHostingProcess>
|
||||
<PlatformTarget>x86</PlatformTarget>
|
||||
<XnaCompressContent>true</XnaCompressContent>
|
||||
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
|
||||
<NoWarn>
|
||||
</NoWarn>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="Microsoft.Xna.Framework, Version=3.0.0.0, Culture=neutral, PublicKeyToken=6d5c3888ef60e27d, processorArchitecture=x86">
|
||||
<Private>False</Private>
|
||||
<SpecificVersion>True</SpecificVersion>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.Xna.Framework.Game, Version=3.0.0.0, Culture=neutral, PublicKeyToken=6d5c3888ef60e27d, processorArchitecture=MSIL">
|
||||
<Private>False</Private>
|
||||
<SpecificVersion>True</SpecificVersion>
|
||||
</Reference>
|
||||
<Reference Include="mscorlib">
|
||||
<Private>False</Private>
|
||||
</Reference>
|
||||
<Reference Include="System">
|
||||
<Private>False</Private>
|
||||
</Reference>
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Xml">
|
||||
<Private>False</Private>
|
||||
</Reference>
|
||||
<Reference Include="System.Core">
|
||||
<RequiredTargetFramework>3.5</RequiredTargetFramework>
|
||||
<Private>False</Private>
|
||||
</Reference>
|
||||
<Reference Include="System.Xml.Linq">
|
||||
<RequiredTargetFramework>3.5</RequiredTargetFramework>
|
||||
<Private>False</Private>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="..\Cassette.cs">
|
||||
<Link>Core\Cassette.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\Cpu.cs">
|
||||
<Link>Core\Cpu.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\CpuData.cs">
|
||||
<Link>Core\CpuData.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\Disk525.cs">
|
||||
<Link>Core\Disk525.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\DiskDsk.cs">
|
||||
<Link>Core\DiskDsk.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\DiskII.cs">
|
||||
<Link>Core\DiskII.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\DiskNib.cs">
|
||||
<Link>Core\DiskNib.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\Drive525.cs">
|
||||
<Link>Core\Drive525.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\GamePort.cs">
|
||||
<Link>Core\GamePort.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\Keyboard.cs">
|
||||
<Link>Core\Keyboard.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\Machine.cs">
|
||||
<Link>Core\Machine.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\MachineComponent.cs">
|
||||
<Link>Core\MachineComponent.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\MachineEvents.cs">
|
||||
<Link>Core\MachineEvents.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\MachineSettings.cs">
|
||||
<Link>Core\MachineSettings.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\Memory.cs">
|
||||
<Link>Core\Memory.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\MemoryData.cs">
|
||||
<Link>Core\MemoryData.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\Properties\SR.Designer.cs">
|
||||
<Link>Properties\SR.Designer.cs</Link>
|
||||
<AutoGen>True</AutoGen>
|
||||
<DesignTime>True</DesignTime>
|
||||
<DependentUpon>SR.resx</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="..\Services\AudioService.cs">
|
||||
<Link>Services\AudioService.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\Services\GamePortService.cs">
|
||||
<Link>Services\GamePortService.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\Services\KeyboardService.cs">
|
||||
<Link>Services\KeyboardService.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\Services\MachineServices.cs">
|
||||
<Link>Services\MachineServices.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\Services\StorageService.cs">
|
||||
<Link>Services\StorageService.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\Services\VideoService.cs">
|
||||
<Link>Services\VideoService.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\Speaker.cs">
|
||||
<Link>Core\Speaker.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\Video.cs">
|
||||
<Link>Core\Video.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\VideoData.cs">
|
||||
<Link>Core\VideoData.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="MainApp.cs" />
|
||||
<Compile Include="MainGame.cs" />
|
||||
<Compile Include="Services\XnaGamePortService.cs" />
|
||||
<Compile Include="Services\XnaKeyboardService.cs" />
|
||||
<Compile Include="Services\XnaStorageService.cs" />
|
||||
<Compile Include="Services\XnaVideoService.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<NestedContentProject Include="Content\Content.contentproj">
|
||||
<Project>bfe4fbb9-2855-4a2b-9067-a82419579a7d</Project>
|
||||
<Visible>False</Visible>
|
||||
</NestedContentProject>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<BootstrapperPackage Include="Microsoft.Net.Client.3.5">
|
||||
<Visible>False</Visible>
|
||||
<ProductName>.NET Framework Client Profile</ProductName>
|
||||
<Install>false</Install>
|
||||
</BootstrapperPackage>
|
||||
<BootstrapperPackage Include="Microsoft.Net.Framework.2.0">
|
||||
<Visible>False</Visible>
|
||||
<ProductName>.NET Framework 2.0 %28x86%29</ProductName>
|
||||
<Install>false</Install>
|
||||
</BootstrapperPackage>
|
||||
<BootstrapperPackage Include="Microsoft.Net.Framework.3.0">
|
||||
<Visible>False</Visible>
|
||||
<ProductName>.NET Framework 3.0 %28x86%29</ProductName>
|
||||
<Install>false</Install>
|
||||
</BootstrapperPackage>
|
||||
<BootstrapperPackage Include="Microsoft.Net.Framework.3.5">
|
||||
<Visible>False</Visible>
|
||||
<ProductName>.NET Framework 3.5</ProductName>
|
||||
<Install>false</Install>
|
||||
</BootstrapperPackage>
|
||||
<BootstrapperPackage Include="Microsoft.Net.Framework.3.5.SP1">
|
||||
<Visible>False</Visible>
|
||||
<ProductName>.NET Framework 3.5 SP1</ProductName>
|
||||
<Install>true</Install>
|
||||
</BootstrapperPackage>
|
||||
<BootstrapperPackage Include="Microsoft.Windows.Installer.3.1">
|
||||
<Visible>False</Visible>
|
||||
<ProductName>Windows Installer 3.1</ProductName>
|
||||
<Install>true</Install>
|
||||
</BootstrapperPackage>
|
||||
<BootstrapperPackage Include="Microsoft.Xna.Framework.3.0">
|
||||
<Visible>False</Visible>
|
||||
<ProductName>Microsoft XNA Framework Redistributable 3.0</ProductName>
|
||||
<Install>true</Install>
|
||||
</BootstrapperPackage>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<EmbeddedResource Include="..\Properties\SR.resx">
|
||||
<Link>Properties\SR.resx</Link>
|
||||
<Generator>ResXFileCodeGeneratorEx</Generator>
|
||||
<LastGenOutput>SR.Designer.cs</LastGenOutput>
|
||||
</EmbeddedResource>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Resource Include="..\Roms\Apple2e.rom">
|
||||
<Link>Roms\Apple2e.rom</Link>
|
||||
</Resource>
|
||||
<Resource Include="..\Roms\Printer.rom">
|
||||
<Link>Roms\Printer.rom</Link>
|
||||
</Resource>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<CodeAnalysisDictionary Include="..\CustomDictionary.xml">
|
||||
<Link>CustomDictionary.xml</Link>
|
||||
</CodeAnalysisDictionary>
|
||||
<Content Include="Properties\AppleIcon.ico" />
|
||||
<Content Include="Properties\AppleThumbnail.png" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\Library\Xna\Jellyfish.Library.Xna.csproj">
|
||||
<Project>{E246958B-EAD8-48E9-844B-54718C952869}</Project>
|
||||
<Name>Jellyfish.Library.Xna</Name>
|
||||
</ProjectReference>
|
||||
</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.
|
||||
Other similar extension points exist, see Microsoft.Common.targets.
|
||||
<Target Name="BeforeBuild">
|
||||
</Target>
|
||||
<Target Name="AfterBuild">
|
||||
</Target>
|
||||
-->
|
||||
</Project>
|
78
Virtu/Xna/Jellyfish.Virtu.Xna.sln
Normal file
78
Virtu/Xna/Jellyfish.Virtu.Xna.sln
Normal file
|
@ -0,0 +1,78 @@
|
|||
|
||||
Microsoft Visual Studio Solution File, Format Version 10.00
|
||||
# Visual Studio 2008
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Jellyfish.Virtu.Xna", "Jellyfish.Virtu.Xna.csproj", "{F72C1068-E6F3-4A6C-A404-F88626B43B7C}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Jellyfish.Virtu.Xna.Xbox", "Jellyfish.Virtu.Xna.Xbox.csproj", "{1D3618DE-F050-4350-826E-5E84BC62DEE3}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Jellyfish.Library.Xna", "..\..\Library\Xna\Jellyfish.Library.Xna.csproj", "{E246958B-EAD8-48E9-844B-54718C952869}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Jellyfish.Library.Xna.Xbox", "..\..\Library\Xna\Jellyfish.Library.Xna.Xbox.csproj", "{6EE9A3C2-0BD8-480D-AED2-6A5A9EBF7AFA}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Mixed Platforms = Debug|Mixed Platforms
|
||||
Debug|x86 = Debug|x86
|
||||
Debug|Xbox 360 = Debug|Xbox 360
|
||||
Release|Mixed Platforms = Release|Mixed Platforms
|
||||
Release|x86 = Release|x86
|
||||
Release|Xbox 360 = Release|Xbox 360
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{F72C1068-E6F3-4A6C-A404-F88626B43B7C}.Debug|Mixed Platforms.ActiveCfg = Debug|x86
|
||||
{F72C1068-E6F3-4A6C-A404-F88626B43B7C}.Debug|Mixed Platforms.Build.0 = Debug|x86
|
||||
{F72C1068-E6F3-4A6C-A404-F88626B43B7C}.Debug|x86.ActiveCfg = Debug|x86
|
||||
{F72C1068-E6F3-4A6C-A404-F88626B43B7C}.Debug|x86.Build.0 = Debug|x86
|
||||
{F72C1068-E6F3-4A6C-A404-F88626B43B7C}.Debug|Xbox 360.ActiveCfg = Debug|x86
|
||||
{F72C1068-E6F3-4A6C-A404-F88626B43B7C}.Release|Mixed Platforms.ActiveCfg = Release|x86
|
||||
{F72C1068-E6F3-4A6C-A404-F88626B43B7C}.Release|Mixed Platforms.Build.0 = Release|x86
|
||||
{F72C1068-E6F3-4A6C-A404-F88626B43B7C}.Release|x86.ActiveCfg = Release|x86
|
||||
{F72C1068-E6F3-4A6C-A404-F88626B43B7C}.Release|x86.Build.0 = Release|x86
|
||||
{F72C1068-E6F3-4A6C-A404-F88626B43B7C}.Release|Xbox 360.ActiveCfg = Release|x86
|
||||
{1D3618DE-F050-4350-826E-5E84BC62DEE3}.Debug|Mixed Platforms.ActiveCfg = Debug|Xbox 360
|
||||
{1D3618DE-F050-4350-826E-5E84BC62DEE3}.Debug|Mixed Platforms.Build.0 = Debug|Xbox 360
|
||||
{1D3618DE-F050-4350-826E-5E84BC62DEE3}.Debug|x86.ActiveCfg = Debug|Xbox 360
|
||||
{1D3618DE-F050-4350-826E-5E84BC62DEE3}.Debug|Xbox 360.ActiveCfg = Debug|Xbox 360
|
||||
{1D3618DE-F050-4350-826E-5E84BC62DEE3}.Debug|Xbox 360.Build.0 = Debug|Xbox 360
|
||||
{1D3618DE-F050-4350-826E-5E84BC62DEE3}.Release|Mixed Platforms.ActiveCfg = Release|Xbox 360
|
||||
{1D3618DE-F050-4350-826E-5E84BC62DEE3}.Release|Mixed Platforms.Build.0 = Release|Xbox 360
|
||||
{1D3618DE-F050-4350-826E-5E84BC62DEE3}.Release|x86.ActiveCfg = Release|Xbox 360
|
||||
{1D3618DE-F050-4350-826E-5E84BC62DEE3}.Release|Xbox 360.ActiveCfg = Release|Xbox 360
|
||||
{1D3618DE-F050-4350-826E-5E84BC62DEE3}.Release|Xbox 360.Build.0 = Release|Xbox 360
|
||||
{BFE4FBB9-2855-4A2B-9067-A82419579A7D}.Debug|Mixed Platforms.ActiveCfg = Debug|x86
|
||||
{BFE4FBB9-2855-4A2B-9067-A82419579A7D}.Debug|x86.ActiveCfg = Debug|x86
|
||||
{BFE4FBB9-2855-4A2B-9067-A82419579A7D}.Debug|Xbox 360.ActiveCfg = Debug|x86
|
||||
{BFE4FBB9-2855-4A2B-9067-A82419579A7D}.Release|Mixed Platforms.ActiveCfg = Release|x86
|
||||
{BFE4FBB9-2855-4A2B-9067-A82419579A7D}.Release|x86.ActiveCfg = Release|x86
|
||||
{BFE4FBB9-2855-4A2B-9067-A82419579A7D}.Release|Xbox 360.ActiveCfg = Release|x86
|
||||
{E246958B-EAD8-48E9-844B-54718C952869}.Debug|Mixed Platforms.ActiveCfg = Debug|x86
|
||||
{E246958B-EAD8-48E9-844B-54718C952869}.Debug|Mixed Platforms.Build.0 = Debug|x86
|
||||
{E246958B-EAD8-48E9-844B-54718C952869}.Debug|x86.ActiveCfg = Debug|x86
|
||||
{E246958B-EAD8-48E9-844B-54718C952869}.Debug|x86.Build.0 = Debug|x86
|
||||
{E246958B-EAD8-48E9-844B-54718C952869}.Debug|Xbox 360.ActiveCfg = Debug|x86
|
||||
{E246958B-EAD8-48E9-844B-54718C952869}.Release|Mixed Platforms.ActiveCfg = Release|x86
|
||||
{E246958B-EAD8-48E9-844B-54718C952869}.Release|Mixed Platforms.Build.0 = Release|x86
|
||||
{E246958B-EAD8-48E9-844B-54718C952869}.Release|x86.ActiveCfg = Release|x86
|
||||
{E246958B-EAD8-48E9-844B-54718C952869}.Release|x86.Build.0 = Release|x86
|
||||
{E246958B-EAD8-48E9-844B-54718C952869}.Release|Xbox 360.ActiveCfg = Release|x86
|
||||
{A96F5631-40E1-40B0-AEE2-6F2E3368E2AE}.Debug|Mixed Platforms.ActiveCfg = Debug|x86
|
||||
{A96F5631-40E1-40B0-AEE2-6F2E3368E2AE}.Debug|x86.ActiveCfg = Debug|x86
|
||||
{A96F5631-40E1-40B0-AEE2-6F2E3368E2AE}.Debug|Xbox 360.ActiveCfg = Debug|x86
|
||||
{A96F5631-40E1-40B0-AEE2-6F2E3368E2AE}.Release|Mixed Platforms.ActiveCfg = Release|x86
|
||||
{A96F5631-40E1-40B0-AEE2-6F2E3368E2AE}.Release|x86.ActiveCfg = Release|x86
|
||||
{A96F5631-40E1-40B0-AEE2-6F2E3368E2AE}.Release|Xbox 360.ActiveCfg = Release|x86
|
||||
{6EE9A3C2-0BD8-480D-AED2-6A5A9EBF7AFA}.Debug|Mixed Platforms.ActiveCfg = Debug|Xbox 360
|
||||
{6EE9A3C2-0BD8-480D-AED2-6A5A9EBF7AFA}.Debug|Mixed Platforms.Build.0 = Debug|Xbox 360
|
||||
{6EE9A3C2-0BD8-480D-AED2-6A5A9EBF7AFA}.Debug|x86.ActiveCfg = Debug|Xbox 360
|
||||
{6EE9A3C2-0BD8-480D-AED2-6A5A9EBF7AFA}.Debug|Xbox 360.ActiveCfg = Debug|Xbox 360
|
||||
{6EE9A3C2-0BD8-480D-AED2-6A5A9EBF7AFA}.Debug|Xbox 360.Build.0 = Debug|Xbox 360
|
||||
{6EE9A3C2-0BD8-480D-AED2-6A5A9EBF7AFA}.Release|Mixed Platforms.ActiveCfg = Release|Xbox 360
|
||||
{6EE9A3C2-0BD8-480D-AED2-6A5A9EBF7AFA}.Release|Mixed Platforms.Build.0 = Release|Xbox 360
|
||||
{6EE9A3C2-0BD8-480D-AED2-6A5A9EBF7AFA}.Release|x86.ActiveCfg = Release|Xbox 360
|
||||
{6EE9A3C2-0BD8-480D-AED2-6A5A9EBF7AFA}.Release|Xbox 360.ActiveCfg = Release|Xbox 360
|
||||
{6EE9A3C2-0BD8-480D-AED2-6A5A9EBF7AFA}.Release|Xbox 360.Build.0 = Release|Xbox 360
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
EndGlobal
|
15
Virtu/Xna/MainApp.cs
Normal file
15
Virtu/Xna/MainApp.cs
Normal file
|
@ -0,0 +1,15 @@
|
|||
using System;
|
||||
|
||||
namespace Jellyfish.Virtu
|
||||
{
|
||||
static class MainApp
|
||||
{
|
||||
static void Main()
|
||||
{
|
||||
using (MainGame game = new MainGame())
|
||||
{
|
||||
game.Run();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
68
Virtu/Xna/MainGame.cs
Normal file
68
Virtu/Xna/MainGame.cs
Normal file
|
@ -0,0 +1,68 @@
|
|||
using Jellyfish.Library;
|
||||
using Jellyfish.Virtu.Services;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
|
||||
namespace Jellyfish.Virtu
|
||||
{
|
||||
public sealed class MainGame : GameBase
|
||||
{
|
||||
public MainGame() :
|
||||
base("Virtu")
|
||||
{
|
||||
Components.Add(new FrameRateCounter(this) { DrawOrder = 1, FontName = "Consolas" });
|
||||
#if XBOX
|
||||
GraphicsDeviceManager.PreferredBackBufferWidth = 640;
|
||||
GraphicsDeviceManager.PreferredBackBufferHeight = 480;
|
||||
#else
|
||||
GraphicsDeviceManager.PreferredBackBufferWidth = 560;
|
||||
GraphicsDeviceManager.PreferredBackBufferHeight = 384;
|
||||
#endif
|
||||
_storageService = new XnaStorageService(this);
|
||||
_keyboardService = new XnaKeyboardService();
|
||||
_gamePortService = new XnaGamePortService();
|
||||
_audioService = new AudioService(); // not connected
|
||||
_videoService = new XnaVideoService(this);
|
||||
|
||||
_machine = new Machine();
|
||||
_machine.Services.AddService(typeof(StorageService), _storageService);
|
||||
_machine.Services.AddService(typeof(KeyboardService), _keyboardService);
|
||||
_machine.Services.AddService(typeof(GamePortService), _gamePortService);
|
||||
_machine.Services.AddService(typeof(AudioService), _audioService);
|
||||
_machine.Services.AddService(typeof(VideoService), _videoService);
|
||||
}
|
||||
|
||||
protected override void BeginRun()
|
||||
{
|
||||
_machine.Start();
|
||||
}
|
||||
|
||||
protected override void Update(GameTime gameTime)
|
||||
{
|
||||
_keyboardService.Update();
|
||||
_gamePortService.Update();
|
||||
_audioService.Update();
|
||||
base.Update(gameTime);
|
||||
}
|
||||
|
||||
protected override void Draw(GameTime gameTime)
|
||||
{
|
||||
GraphicsDevice.Clear(Color.Black);
|
||||
_videoService.Update();
|
||||
base.Draw(gameTime);
|
||||
}
|
||||
|
||||
protected override void EndRun()
|
||||
{
|
||||
_machine.Stop();
|
||||
}
|
||||
|
||||
private StorageService _storageService;
|
||||
private KeyboardService _keyboardService;
|
||||
private GamePortService _gamePortService;
|
||||
private AudioService _audioService;
|
||||
private VideoService _videoService;
|
||||
|
||||
private Machine _machine;
|
||||
}
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user