mirror of
https://github.com/digital-jellyfish/Virtu.git
synced 2024-06-02 12:41:31 +00:00
Modified Machine.State to use volatile field.
Added WPF and XNA define constants to projects. Modified default video colours to match platform format - BGRA for Silverlight and WPF; RGBA for everything else.
This commit is contained in:
parent
992d205c06
commit
7e09b214de
|
@ -206,7 +206,7 @@ private void Run() // machine thread
|
||||||
|
|
||||||
public MachineEvents Events { get; private set; }
|
public MachineEvents Events { get; private set; }
|
||||||
public MachineServices Services { get; private set; }
|
public MachineServices Services { get; private set; }
|
||||||
public MachineState State { get; private set; }
|
public MachineState State { get { return _state; } private set { _state = value; } }
|
||||||
|
|
||||||
public Cpu Cpu { get; private set; }
|
public Cpu Cpu { get; private set; }
|
||||||
public Memory Memory { get; private set; }
|
public Memory Memory { get; private set; }
|
||||||
|
@ -235,6 +235,7 @@ private void Run() // machine thread
|
||||||
|
|
||||||
private DebugService _debugService;
|
private DebugService _debugService;
|
||||||
private StorageService _storageService;
|
private StorageService _storageService;
|
||||||
|
private volatile MachineState _state;
|
||||||
|
|
||||||
private AutoResetEvent _pauseEvent = new AutoResetEvent(false);
|
private AutoResetEvent _pauseEvent = new AutoResetEvent(false);
|
||||||
private AutoResetEvent _unpauseEvent = new AutoResetEvent(false);
|
private AutoResetEvent _unpauseEvent = new AutoResetEvent(false);
|
||||||
|
|
|
@ -7,7 +7,10 @@ protected VideoService(Machine machine) :
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
public abstract void SetFullScreen(bool isFullScreen);
|
public virtual void SetFullScreen(bool isFullScreen)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
public abstract void SetPixel(int x, int y, uint color);
|
public abstract void SetPixel(int x, int y, uint color);
|
||||||
public abstract void Update(); // main thread
|
public abstract void Update(); // main thread
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,6 +29,7 @@ public override void Initialize()
|
||||||
_memory = Machine.Memory;
|
_memory = Machine.Memory;
|
||||||
_videoService = Machine.Services.GetService<VideoService>();
|
_videoService = Machine.Services.GetService<VideoService>();
|
||||||
|
|
||||||
|
#if SILVERLIGHT || WPF
|
||||||
_colorBlack = 0xFF000000; // BGRA
|
_colorBlack = 0xFF000000; // BGRA
|
||||||
_colorDarkBlue = 0xFF000099;
|
_colorDarkBlue = 0xFF000099;
|
||||||
_colorDarkGreen = 0xFF117722;
|
_colorDarkGreen = 0xFF117722;
|
||||||
|
@ -46,6 +47,25 @@ public override void Initialize()
|
||||||
_colorYellow = 0xFFFFFF11;
|
_colorYellow = 0xFFFFFF11;
|
||||||
_colorWhite = 0xFFFFFFFF;
|
_colorWhite = 0xFFFFFFFF;
|
||||||
_colorMonochrome = 0xFF00AA00;
|
_colorMonochrome = 0xFF00AA00;
|
||||||
|
#else
|
||||||
|
_colorBlack = 0xFF000000; // RGBA
|
||||||
|
_colorDarkBlue = 0xFF990000;
|
||||||
|
_colorDarkGreen = 0xFF227711;
|
||||||
|
_colorMediumBlue = 0xFFFF0000;
|
||||||
|
_colorBrown = 0xFF005588;
|
||||||
|
_colorLightGrey = 0xFFAAAA99;
|
||||||
|
_colorGreen = 0xFF11EE00;
|
||||||
|
_colorAquamarine = 0xFFAAFF55;
|
||||||
|
_colorDeepRed = 0xFF1111FF;
|
||||||
|
_colorPurple = 0xFFDD00DD;
|
||||||
|
_colorDarkGrey = 0xFF555544;
|
||||||
|
_colorLightBlue = 0xFFFFAA33;
|
||||||
|
_colorOrange = 0xFF1144FF;
|
||||||
|
_colorPink = 0xFF8899FF;
|
||||||
|
_colorYellow = 0xFF11FFFF;
|
||||||
|
_colorWhite = 0xFFFFFFFF;
|
||||||
|
_colorMonochrome = 0xFF00AA00;
|
||||||
|
#endif
|
||||||
SetPalette();
|
SetPalette();
|
||||||
|
|
||||||
IsFullScreen = false;
|
IsFullScreen = false;
|
||||||
|
|
|
@ -23,7 +23,7 @@
|
||||||
<DebugType>full</DebugType>
|
<DebugType>full</DebugType>
|
||||||
<Optimize>false</Optimize>
|
<Optimize>false</Optimize>
|
||||||
<OutputPath>bin\</OutputPath>
|
<OutputPath>bin\</OutputPath>
|
||||||
<DefineConstants>DEBUG;TRACE;WINDOWS;CODE_ANALYSIS</DefineConstants>
|
<DefineConstants>DEBUG;TRACE;WPF;WINDOWS;CODE_ANALYSIS</DefineConstants>
|
||||||
<ErrorReport>prompt</ErrorReport>
|
<ErrorReport>prompt</ErrorReport>
|
||||||
<WarningLevel>4</WarningLevel>
|
<WarningLevel>4</WarningLevel>
|
||||||
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
|
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
|
||||||
|
@ -35,7 +35,7 @@
|
||||||
<DebugType>pdbonly</DebugType>
|
<DebugType>pdbonly</DebugType>
|
||||||
<Optimize>true</Optimize>
|
<Optimize>true</Optimize>
|
||||||
<OutputPath>bin\</OutputPath>
|
<OutputPath>bin\</OutputPath>
|
||||||
<DefineConstants>TRACE;WINDOWS;CODE_ANALYSIS</DefineConstants>
|
<DefineConstants>TRACE;WPF;WINDOWS;CODE_ANALYSIS</DefineConstants>
|
||||||
<ErrorReport>prompt</ErrorReport>
|
<ErrorReport>prompt</ErrorReport>
|
||||||
<WarningLevel>4</WarningLevel>
|
<WarningLevel>4</WarningLevel>
|
||||||
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
|
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
|
||||||
|
|
|
@ -30,7 +30,7 @@
|
||||||
<DebugType>full</DebugType>
|
<DebugType>full</DebugType>
|
||||||
<Optimize>false</Optimize>
|
<Optimize>false</Optimize>
|
||||||
<OutputPath>bin\Windows Phone\</OutputPath>
|
<OutputPath>bin\Windows Phone\</OutputPath>
|
||||||
<DefineConstants>DEBUG;TRACE;WINDOWS_PHONE;CODE_ANALYSIS</DefineConstants>
|
<DefineConstants>DEBUG;TRACE;XNA;WINDOWS_PHONE;CODE_ANALYSIS</DefineConstants>
|
||||||
<ErrorReport>prompt</ErrorReport>
|
<ErrorReport>prompt</ErrorReport>
|
||||||
<WarningLevel>4</WarningLevel>
|
<WarningLevel>4</WarningLevel>
|
||||||
<NoStdLib>true</NoStdLib>
|
<NoStdLib>true</NoStdLib>
|
||||||
|
@ -45,7 +45,7 @@
|
||||||
<DebugType>pdbonly</DebugType>
|
<DebugType>pdbonly</DebugType>
|
||||||
<Optimize>true</Optimize>
|
<Optimize>true</Optimize>
|
||||||
<OutputPath>bin\Windows Phone\</OutputPath>
|
<OutputPath>bin\Windows Phone\</OutputPath>
|
||||||
<DefineConstants>TRACE;WINDOWS_PHONE;CODE_ANALYSIS</DefineConstants>
|
<DefineConstants>TRACE;XNA;WINDOWS_PHONE;CODE_ANALYSIS</DefineConstants>
|
||||||
<ErrorReport>prompt</ErrorReport>
|
<ErrorReport>prompt</ErrorReport>
|
||||||
<WarningLevel>4</WarningLevel>
|
<WarningLevel>4</WarningLevel>
|
||||||
<NoStdLib>true</NoStdLib>
|
<NoStdLib>true</NoStdLib>
|
||||||
|
|
|
@ -24,7 +24,7 @@
|
||||||
<DebugType>full</DebugType>
|
<DebugType>full</DebugType>
|
||||||
<Optimize>false</Optimize>
|
<Optimize>false</Optimize>
|
||||||
<OutputPath>bin\Xbox 360\</OutputPath>
|
<OutputPath>bin\Xbox 360\</OutputPath>
|
||||||
<DefineConstants>DEBUG;TRACE;XBOX;XBOX360;CODE_ANALYSIS</DefineConstants>
|
<DefineConstants>DEBUG;TRACE;XNA;XBOX;XBOX360;CODE_ANALYSIS</DefineConstants>
|
||||||
<ErrorReport>prompt</ErrorReport>
|
<ErrorReport>prompt</ErrorReport>
|
||||||
<WarningLevel>4</WarningLevel>
|
<WarningLevel>4</WarningLevel>
|
||||||
<NoStdLib>true</NoStdLib>
|
<NoStdLib>true</NoStdLib>
|
||||||
|
@ -39,7 +39,7 @@
|
||||||
<DebugType>pdbonly</DebugType>
|
<DebugType>pdbonly</DebugType>
|
||||||
<Optimize>true</Optimize>
|
<Optimize>true</Optimize>
|
||||||
<OutputPath>bin\Xbox 360\</OutputPath>
|
<OutputPath>bin\Xbox 360\</OutputPath>
|
||||||
<DefineConstants>TRACE;XBOX;XBOX360;CODE_ANALYSIS</DefineConstants>
|
<DefineConstants>TRACE;XNA;XBOX;XBOX360;CODE_ANALYSIS</DefineConstants>
|
||||||
<ErrorReport>prompt</ErrorReport>
|
<ErrorReport>prompt</ErrorReport>
|
||||||
<WarningLevel>4</WarningLevel>
|
<WarningLevel>4</WarningLevel>
|
||||||
<NoStdLib>true</NoStdLib>
|
<NoStdLib>true</NoStdLib>
|
||||||
|
|
|
@ -24,7 +24,7 @@
|
||||||
<DebugType>full</DebugType>
|
<DebugType>full</DebugType>
|
||||||
<Optimize>false</Optimize>
|
<Optimize>false</Optimize>
|
||||||
<OutputPath>bin\x86\</OutputPath>
|
<OutputPath>bin\x86\</OutputPath>
|
||||||
<DefineConstants>DEBUG;TRACE;WINDOWS;CODE_ANALYSIS</DefineConstants>
|
<DefineConstants>DEBUG;TRACE;XNA;WINDOWS;CODE_ANALYSIS</DefineConstants>
|
||||||
<ErrorReport>prompt</ErrorReport>
|
<ErrorReport>prompt</ErrorReport>
|
||||||
<WarningLevel>4</WarningLevel>
|
<WarningLevel>4</WarningLevel>
|
||||||
<NoStdLib>true</NoStdLib>
|
<NoStdLib>true</NoStdLib>
|
||||||
|
@ -39,7 +39,7 @@
|
||||||
<DebugType>pdbonly</DebugType>
|
<DebugType>pdbonly</DebugType>
|
||||||
<Optimize>true</Optimize>
|
<Optimize>true</Optimize>
|
||||||
<OutputPath>bin\x86\</OutputPath>
|
<OutputPath>bin\x86\</OutputPath>
|
||||||
<DefineConstants>TRACE;WINDOWS;CODE_ANALYSIS</DefineConstants>
|
<DefineConstants>TRACE;XNA;WINDOWS;CODE_ANALYSIS</DefineConstants>
|
||||||
<ErrorReport>prompt</ErrorReport>
|
<ErrorReport>prompt</ErrorReport>
|
||||||
<WarningLevel>4</WarningLevel>
|
<WarningLevel>4</WarningLevel>
|
||||||
<NoStdLib>true</NoStdLib>
|
<NoStdLib>true</NoStdLib>
|
||||||
|
|
|
@ -26,22 +26,22 @@ public XnaVideoService(Machine machine, GameBase game) :
|
||||||
_game.GraphicsDeviceService.DeviceCreated += OnGraphicsDeviceServiceDeviceCreated;
|
_game.GraphicsDeviceService.DeviceCreated += OnGraphicsDeviceServiceDeviceCreated;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if WINDOWS
|
||||||
public override void SetFullScreen(bool isFullScreen)
|
public override void SetFullScreen(bool isFullScreen)
|
||||||
{
|
{
|
||||||
#if WINDOWS
|
|
||||||
var graphicsDeviceManager = _game.GraphicsDeviceManager;
|
var graphicsDeviceManager = _game.GraphicsDeviceManager;
|
||||||
if (graphicsDeviceManager.IsFullScreen != isFullScreen)
|
if (graphicsDeviceManager.IsFullScreen != isFullScreen)
|
||||||
{
|
{
|
||||||
graphicsDeviceManager.IsFullScreen = isFullScreen;
|
graphicsDeviceManager.IsFullScreen = isFullScreen;
|
||||||
_game.SynchronizationContext.Send(state => graphicsDeviceManager.ApplyChanges(), null);
|
_game.SynchronizationContext.Send(state => graphicsDeviceManager.ApplyChanges(), null);
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
[SuppressMessage("Microsoft.Usage", "CA2233:OperationsShouldNotOverflow")]
|
[SuppressMessage("Microsoft.Usage", "CA2233:OperationsShouldNotOverflow")]
|
||||||
public override void SetPixel(int x, int y, uint color)
|
public override void SetPixel(int x, int y, uint color)
|
||||||
{
|
{
|
||||||
_pixels[y * TextureWidth + x] = (color & 0xFF00FF00) | ((color << 16) & 0x00FF0000) | ((color >> 16) & 0x000000FF); // RGBA
|
_pixels[y * TextureWidth + x] = color;
|
||||||
_pixelsDirty = true;
|
_pixelsDirty = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user