Pissed about trying to fix a number of bugs

This commit is contained in:
2026-05-12 01:34:05 +01:00
parent 95ac0ec7c1
commit edb41bdb3a
8 changed files with 75 additions and 20 deletions

View File

@@ -11,8 +11,11 @@
<ItemGroup>
<None Remove="ROMS\Golden Axe Warrior.sms" />
<None Remove="ROMS\R-Type.sms" />
<None Remove="ROMS\SMSTestSuite.sms" />
<None Remove="ROMS\Sonic 2.sms" />
<None Remove="ROMS\Sonic.sms" />
<None Remove="ROMS\zexall.sms" />
<None Remove="ROMS\zexdoc.sms" />
</ItemGroup>
<ItemGroup>
@@ -22,12 +25,21 @@
<EmbeddedResource Include="ROMS\R-Type.sms">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</EmbeddedResource>
<EmbeddedResource Include="ROMS\SMSTestSuite.sms">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</EmbeddedResource>
<EmbeddedResource Include="ROMS\Sonic 2.sms">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</EmbeddedResource>
<EmbeddedResource Include="ROMS\Sonic.sms">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</EmbeddedResource>
<EmbeddedResource Include="ROMS\zexall.sms">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</EmbeddedResource>
<EmbeddedResource Include="ROMS\zexdoc.sms">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</EmbeddedResource>
</ItemGroup>
<ItemGroup>

View File

@@ -28,7 +28,6 @@
/// </summary>
private void InitializeComponent()
{
pbScreen = new PictureBox();
menuStrip1 = new MenuStrip();
fileToolStripMenuItem = new ToolStripMenuItem();
openToolStripMenuItem = new ToolStripMenuItem();
@@ -41,19 +40,9 @@
resetToolStripMenuItem = new ToolStripMenuItem();
helpToolStripMenuItem = new ToolStripMenuItem();
aboutToolStripMenuItem = new ToolStripMenuItem();
((System.ComponentModel.ISupportInitialize)pbScreen).BeginInit();
menuStrip1.SuspendLayout();
SuspendLayout();
//
// pbScreen
//
pbScreen.Location = new Point(12, 36);
pbScreen.Name = "pbScreen";
pbScreen.Size = new Size(768, 576);
pbScreen.SizeMode = PictureBoxSizeMode.Zoom;
pbScreen.TabIndex = 1;
pbScreen.TabStop = false;
//
// menuStrip1
//
menuStrip1.ImageScalingSize = new Size(24, 24);
@@ -145,13 +134,11 @@
AutoScaleDimensions = new SizeF(10F, 25F);
AutoScaleMode = AutoScaleMode.Font;
ClientSize = new Size(791, 622);
Controls.Add(pbScreen);
Controls.Add(menuStrip1);
MainMenuStrip = menuStrip1;
Margin = new Padding(4);
Name = "ParsonsForm1";
Text = "Form1";
((System.ComponentModel.ISupportInitialize)pbScreen).EndInit();
menuStrip1.ResumeLayout(false);
menuStrip1.PerformLayout();
ResumeLayout(false);
@@ -159,7 +146,6 @@
}
#endregion
private PictureBox pbScreen;
private MenuStrip menuStrip1;
private ToolStripMenuItem fileToolStripMenuItem;
private ToolStripMenuItem openToolStripMenuItem;

View File

@@ -40,6 +40,8 @@ namespace Desktop
this.KeyPreview = true;
this.KeyDown += Form1_KeyDown;
this.KeyUp += Form1_KeyUp;
this.DoubleBuffered = true;
this.ResizeRedraw = true;
}
private void DrawScreen()
@@ -48,11 +50,34 @@ namespace Desktop
var data = _screenBitmap.LockBits(new Rectangle(0, 0, 256, 192), ImageLockMode.WriteOnly, PixelFormat.Format32bppArgb);
Marshal.Copy(_machine.VideoProcessor.FrameBuffer, 0, data.Scan0, _machine.VideoProcessor.FrameBuffer.Length);
_screenBitmap.UnlockBits(data);
// Update the PictureBox
pbScreen.Image = _screenBitmap;
this.Invalidate();
TotalFrameCount++;
}
protected override void OnPaint(PaintEventArgs e)
{
// Always call the base method so Windows can draw your MenuStrip!
base.OnPaint(e);
if (_screenBitmap != null)
{
// 1. Set the rendering mode for perfect, chunky retro pixels!
e.Graphics.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.NearestNeighbor;
e.Graphics.PixelOffsetMode = System.Drawing.Drawing2D.PixelOffsetMode.Half;
// 2. Calculate the drawing area.
// We start drawing BELOW the MenuStrip so it doesn't get covered up.
int topOffset = menuStrip1.Height; // Change 'menuStrip1' if your menu has a different (Name)
Rectangle renderArea = new Rectangle(
0,
topOffset,
this.ClientSize.Width,
this.ClientSize.Height - topOffset
);
// 3. Blast the bitmap directly onto the graphics card buffer!
e.Graphics.DrawImage(_screenBitmap, renderArea);
}
}
public void StartEmulator()
{

Binary file not shown.

BIN
Desktop/ROMS/zexall.sms Normal file

Binary file not shown.

BIN
Desktop/ROMS/zexdoc.sms Normal file

Binary file not shown.