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,7 +27,6 @@ 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();
@ -36,6 +35,10 @@ namespace BizHawk.MultiClient
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,7 +148,9 @@ namespace BizHawk.MultiClient
Global.Emulator.LoadStateBinary(new BinaryReader(output)); Global.Emulator.LoadStateBinary(new BinaryReader(output));
} }
private void Rewind() private void Rewind(int frames)
{
for (int i = 0; i < frames; i++)
{ {
if (RewindBuf.Count == 0) if (RewindBuf.Count == 0)
return; return;
@ -156,6 +158,7 @@ namespace BizHawk.MultiClient
Rewind64K(); Rewind64K();
else else
RewindLarge(); RewindLarge();
}
Global.Emulator.FrameAdvance(true); Global.Emulator.FrameAdvance(true);
Global.Sound.UpdateSound(Global.Emulator.SoundProvider); Global.Sound.UpdateSound(Global.Emulator.SoundProvider);