Fix rewind buffer size, was casting to int and causing large values to be 0

This commit is contained in:
adelikat 2013-07-28 20:33:26 +00:00
parent 9103546bc0
commit a798a9dc08
1 changed files with 6 additions and 3 deletions

View File

@ -6,7 +6,7 @@ namespace BizHawk.MultiClient
{ {
public partial class MainForm public partial class MainForm
{ {
private readonly StreamBlobDatabase RewindBuf = new StreamBlobDatabase(Global.Config.Rewind_OnDisk, Global.Config.Rewind_BufferSize * 1024 * 1024); private StreamBlobDatabase RewindBuf = new StreamBlobDatabase(Global.Config.Rewind_OnDisk, Global.Config.Rewind_BufferSize * (long)1024 * (long)1024);
private byte[] LastState; private byte[] LastState;
private bool RewindImpossible; private bool RewindImpossible;
@ -25,7 +25,7 @@ namespace BizHawk.MultiClient
mStream = null; mStream = null;
} }
public StreamBlobDatabase(bool onDisk, long capacity = 256*1024*1024) public StreamBlobDatabase(bool onDisk, long capacity)
{ {
mCapacity = capacity; mCapacity = capacity;
if (onDisk) if (onDisk)
@ -216,7 +216,7 @@ namespace BizHawk.MultiClient
void Test() void Test()
{ {
var sbb = new StreamBlobDatabase(false); var sbb = new StreamBlobDatabase(false, Global.Config.Rewind_BufferSize * 1024 * 1024);
var rand = new Random(0); var rand = new Random(0);
int timestamp = 0; int timestamp = 0;
for (; ; ) for (; ; )
@ -282,6 +282,9 @@ namespace BizHawk.MultiClient
public void DoRewindSettings() public void DoRewindSettings()
{ {
long cap = Global.Config.Rewind_BufferSize * (long)1024 * (long)1024;
RewindBuf = new StreamBlobDatabase(Global.Config.Rewind_OnDisk, cap);
// This is the first frame. Capture the state, and put it in LastState for future deltas to be compared against. // This is the first frame. Capture the state, and put it in LastState for future deltas to be compared against.
LastState = Global.Emulator.SaveStateBinary(); LastState = Global.Emulator.SaveStateBinary();