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.MainForm = this;
Global.Config = ConfigService.Load<Config>("config.ini"); Global.Config = ConfigService.Load<Config>("config.ini");
InitializeComponent();
if (Global.Direct3D != null) if (Global.Direct3D != null)
renderTarget = new ViewportPanel(); renderTarget = new ViewportPanel();
else renderTarget = retainedPanel = new RetainedViewportPanel(); else renderTarget = retainedPanel = new RetainedViewportPanel();
renderTarget.Dock = DockStyle.Fill; renderTarget.Dock = DockStyle.Fill;
renderTarget.BackColor = Color.Black; renderTarget.BackColor = Color.Black;
Controls.Add(renderTarget); Controls.Add(renderTarget);
InitializeComponent();
Database.LoadDatabase("gamedb.txt"); Database.LoadDatabase("gamedb.txt");
if (Global.Direct3D != null) if (Global.Direct3D != null)
@ -313,7 +316,7 @@ namespace BizHawk.MultiClient
if (/*Global.Config.RewindEnabled && */Global.ClientControls["Rewind"]) if (/*Global.Config.RewindEnabled && */Global.ClientControls["Rewind"])
{ {
Rewind(); Rewind(Global.ClientControls["Fast Forward"] ? 3 : 1);
return; return;
} }
@ -819,5 +822,18 @@ namespace BizHawk.MultiClient
//TODO: autoload //TODO: autoload
RamSearch1.Show(); 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)); Global.Emulator.LoadStateBinary(new BinaryReader(output));
} }
private void Rewind() private void Rewind(int frames)
{ {
if (RewindBuf.Count == 0) for (int i = 0; i < frames; i++)
return; {
if (LastState.Length < 0x10000) if (RewindBuf.Count == 0)
Rewind64K(); return;
else if (LastState.Length < 0x10000)
RewindLarge(); Rewind64K();
else
RewindLarge();
}
Global.Emulator.FrameAdvance(true); Global.Emulator.FrameAdvance(true);
Global.Sound.UpdateSound(Global.Emulator.SoundProvider); Global.Sound.UpdateSound(Global.Emulator.SoundProvider);