Fix gamepanel being off-center, add two-speed rewind, work started on auto-resizing window (wip, disabled)

This commit is contained in:
beirich 2011-01-25 13:24:06 +00:00
parent 5c847f50cd
commit c8650fd20b
2 changed files with 31 additions and 12 deletions

View File

@ -27,15 +27,18 @@ namespace BizHawk.MultiClient
{
Global.MainForm = this;
Global.Config = ConfigService.Load<Config>("config.ini");
InitializeComponent();
if (Global.Direct3D != null)
renderTarget = new ViewportPanel();
else renderTarget = retainedPanel = new RetainedViewportPanel();
if (Global.Direct3D != null)
renderTarget = new ViewportPanel();
else renderTarget = retainedPanel = new RetainedViewportPanel();
renderTarget.Dock = DockStyle.Fill;
renderTarget.BackColor = Color.Black;
Controls.Add(renderTarget);
InitializeComponent();
Database.LoadDatabase("gamedb.txt");
if (Global.Direct3D != null)
@ -313,7 +316,7 @@ namespace BizHawk.MultiClient
if (/*Global.Config.RewindEnabled && */Global.ClientControls["Rewind"])
{
Rewind();
Rewind(Global.ClientControls["Fast Forward"] ? 3 : 1);
return;
}
@ -819,5 +822,18 @@ namespace BizHawk.MultiClient
//TODO: autoload
RamSearch1.Show();
}
public void SignalFrameBufferResized()
{
var video = Global.Emulator.VideoProvider;
int targetZoom = 3;
int borderWidth = this.Size.Width - renderTarget.Size.Width;
int borderHeight = this.Size.Height - renderTarget.Size.Height;
ClientSize = new Size((video.BufferWidth*targetZoom) + borderWidth, (video.BufferHeight*targetZoom + borderHeight));
this.Invalidate();
}
}
}

View File

@ -148,14 +148,17 @@ namespace BizHawk.MultiClient
Global.Emulator.LoadStateBinary(new BinaryReader(output));
}
private void Rewind()
private void Rewind(int frames)
{
if (RewindBuf.Count == 0)
return;
if (LastState.Length < 0x10000)
Rewind64K();
else
RewindLarge();
for (int i = 0; i < frames; i++)
{
if (RewindBuf.Count == 0)
return;
if (LastState.Length < 0x10000)
Rewind64K();
else
RewindLarge();
}
Global.Emulator.FrameAdvance(true);
Global.Sound.UpdateSound(Global.Emulator.SoundProvider);