Merge branch 'master' of https://github.com/TASVideos/bizhawk into Release

This commit is contained in:
hegyak 2015-07-16 21:43:41 -07:00
commit 8e37d86b89
8 changed files with 41 additions and 26 deletions

View File

@ -343,6 +343,7 @@ namespace BizHawk.Client.Common
case DiscType.MegaCD: case DiscType.MegaCD:
game.System = "GEN"; game.System = "GEN";
break; break;
case DiscType.AudioDisc:
case DiscType.TurboCD: case DiscType.TurboCD:
case DiscType.UnknownCDFS: case DiscType.UnknownCDFS:
case DiscType.UnknownFormat: case DiscType.UnknownFormat:

View File

@ -54,7 +54,7 @@ namespace BizHawk.Client.EmuHawk
DisassemblyLines.Clear(); DisassemblyLines.Clear();
uint a = currentDisassemblerAddress; uint a = currentDisassemblerAddress;
for (int i = 0; i < line_count; ++i) for (int i = 0; i <= line_count; ++i)
{ {
int advance; int advance;
string line = Disassembler.Disassemble(MemoryDomains.SystemBus, a, out advance); string line = Disassembler.Disassemble(MemoryDomains.SystemBus, a, out advance);

View File

@ -116,7 +116,8 @@ namespace BizHawk.Client.EmuHawk
public void PlaceZone(IMovie movie) public void PlaceZone(IMovie movie)
{ {
// TODO: This should probably do something with undo history batches/naming. if (movie is TasMovie)
(movie as TasMovie).ChangeLog.BeginNewBatch("Place Macro at " + Start);
if (Start > movie.InputLogLength) if (Start > movie.InputLogLength)
{ // Cannot place a frame here. Find a nice way around this. { // Cannot place a frame here. Find a nice way around this.
@ -150,6 +151,7 @@ namespace BizHawk.Client.EmuHawk
if (movie is TasMovie) // Assume TAStudio is open? if (movie is TasMovie) // Assume TAStudio is open?
{ {
(movie as TasMovie).ChangeLog.EndBatch();
if (Global.Emulator.Frame > Start) if (Global.Emulator.Frame > Start)
{ {
// TODO: Go to start of macro? Ask TAStudio to do that? // TODO: Go to start of macro? Ask TAStudio to do that?

View File

@ -5,6 +5,7 @@ using System.Windows.Forms;
using System.Collections.Generic; using System.Collections.Generic;
using BizHawk.Emulation.Common.IEmulatorExtensions; using BizHawk.Emulation.Common.IEmulatorExtensions;
using BizHawk.Common.NumberExtensions;
using BizHawk.Client.Common; using BizHawk.Client.Common;
namespace BizHawk.Client.EmuHawk namespace BizHawk.Client.EmuHawk
@ -61,8 +62,6 @@ namespace BizHawk.Client.EmuHawk
} }
} }
private System.Timers.Timer _mouseWheelTimer;
// public static Color CurrentFrame_FrameCol = Color.FromArgb(0xCFEDFC); Why? // public static Color CurrentFrame_FrameCol = Color.FromArgb(0xCFEDFC); Why?
public static Color CurrentFrame_InputLog = Color.FromArgb(0xB5E7F7); public static Color CurrentFrame_InputLog = Color.FromArgb(0xB5E7F7);
@ -451,7 +450,21 @@ namespace BizHawk.Client.EmuHawk
JumpToGreenzone(); JumpToGreenzone();
// TODO: Turn off ChangeLog.IsRecording and handle the GeneralUndo here. // TODO: Turn off ChangeLog.IsRecording and handle the GeneralUndo here.
CurrentTasMovie.ChangeLog.BeginNewBatch("Right-Click Edit"); string undoStepName = "Right-Click Edit:";
if (_rightClickShift)
{
undoStepName += " Extend Input";
if (_rightClickControl)
undoStepName += ", Insert";
}
else
{
if (_rightClickControl)
undoStepName += " Copy";
else
undoStepName += " Move";
}
CurrentTasMovie.ChangeLog.BeginNewBatch(undoStepName);
} }
} }
} }
@ -487,6 +500,7 @@ namespace BizHawk.Client.EmuHawk
if (_rightClickFrame != -1) if (_rightClickFrame != -1)
{ {
_rightClickInput = null; _rightClickInput = null;
_rightClickOverInput = null;
_rightClickFrame = -1; _rightClickFrame = -1;
CurrentTasMovie.ChangeLog.EndBatch(); CurrentTasMovie.ChangeLog.EndBatch();
} }
@ -524,12 +538,6 @@ namespace BizHawk.Client.EmuHawk
GoToPreviousFrame(); GoToPreviousFrame();
} }
} }
if (_mouseWheelTimer.Enabled) // dunno if this is telling enough and nothing like bool _mouseWheelFast is needed, but we need to check on the first scroll event, and just decide by delta if it's fast enough to increase actual scrolling speed
{
_mouseWheelTimer.Stop();
}
_mouseWheelTimer.Start();
} }
private void TasView_MouseDoubleClick(object sender, MouseEventArgs e) private void TasView_MouseDoubleClick(object sender, MouseEventArgs e)
@ -618,7 +626,7 @@ namespace BizHawk.Client.EmuHawk
if (shouldInsert) if (shouldInsert)
{ {
for (int i = startVal + 1; i <= endVal; i++) for (int i = startVal + 1; i <= endVal; i++)
CurrentTasMovie.InsertInput(i, _rightClickInput[(i - _rightClickFrame) % _rightClickInput.Length]); CurrentTasMovie.InsertInput(i, _rightClickInput[(i - _rightClickFrame).Mod(_rightClickInput.Length)]);
} }
else else
{ {
@ -630,7 +638,7 @@ namespace BizHawk.Client.EmuHawk
else // Overwrite else // Overwrite
{ {
for (int i = startVal; i <= endVal; i++) for (int i = startVal; i <= endVal; i++)
CurrentTasMovie.SetFrame(i, _rightClickInput[(_rightClickFrame - i) % _rightClickInput.Length]); CurrentTasMovie.SetFrame(i, _rightClickInput[(i - _rightClickFrame).Mod(_rightClickInput.Length)]);
JumpToGreenzone(); JumpToGreenzone();
} }
} }

View File

@ -394,14 +394,16 @@ namespace BizHawk.Client.EmuHawk
{ {
if (TasView.SelectedRows.Any()) if (TasView.SelectedRows.Any())
{ {
var wasPaused = GlobalWin.MainForm.EmulatorPaused; bool wasPaused = GlobalWin.MainForm.EmulatorPaused;
var needsToRollback = !(TasView.FirstSelectedIndex > Emulator.Frame); bool needsToRollback = !(TasView.FirstSelectedIndex > Emulator.Frame);
var rollBackFrame = TasView.FirstSelectedIndex.Value; int rollBackFrame = TasView.FirstSelectedIndex.Value;
foreach (var frame in TasView.SelectedRows) CurrentTasMovie.ChangeLog.BeginNewBatch("Clear frames " + TasView.SelectedRows.Min() + "-" + TasView.SelectedRows.Max());
foreach (int frame in TasView.SelectedRows)
{ {
CurrentTasMovie.ClearFrame(frame); CurrentTasMovie.ClearFrame(frame);
} }
CurrentTasMovie.ChangeLog.EndBatch();
if (needsToRollback) if (needsToRollback)
{ {

View File

@ -300,11 +300,6 @@ namespace BizHawk.Client.EmuHawk
Global.Config.MovieEndAction = MovieEndAction.Record; Global.Config.MovieEndAction = MovieEndAction.Record;
GlobalWin.MainForm.SetMainformMovieInfo(); GlobalWin.MainForm.SetMainformMovieInfo();
Global.MovieSession.ReadOnly = true; Global.MovieSession.ReadOnly = true;
_mouseWheelTimer = new System.Timers.Timer(100); // consider sub 100 ms fast scrolling
_mouseWheelTimer.Elapsed += (s, e) =>
{
_mouseWheelTimer.Stop();
};
} }
#endregion #endregion
@ -452,7 +447,6 @@ namespace BizHawk.Client.EmuHawk
// Do not keep TAStudio's disk save states. // Do not keep TAStudio's disk save states.
if (Directory.Exists(PathManager.MakeAbsolutePath(Global.Config.PathEntries["Global", "TAStudio states"].Path, null))) if (Directory.Exists(PathManager.MakeAbsolutePath(Global.Config.PathEntries["Global", "TAStudio states"].Path, null)))
Directory.Delete(PathManager.MakeAbsolutePath(Global.Config.PathEntries["Global", "TAStudio states"].Path, null), true); Directory.Delete(PathManager.MakeAbsolutePath(Global.Config.PathEntries["Global", "TAStudio states"].Path, null), true);
_mouseWheelTimer.Dispose();
} }
/// <summary> /// <summary>
@ -555,7 +549,7 @@ namespace BizHawk.Client.EmuHawk
// frame == Emualtor.Frame when frame == 0 // frame == Emualtor.Frame when frame == 0
if (frame > Emulator.Frame) if (frame > Emulator.Frame)
{ {
if (GlobalWin.MainForm.EmulatorPaused || GlobalWin.MainForm.IsSeeking || _mouseWheelTimer.Enabled) // make seek frame keep up with emulation on fast scrolls if (GlobalWin.MainForm.EmulatorPaused || GlobalWin.MainForm.IsSeeking) // make seek frame keep up with emulation on fast scrolls
{ {
GlobalWin.MainForm.PauseOnFrame = frame; GlobalWin.MainForm.PauseOnFrame = frame;
GlobalWin.MainForm.UnpauseEmulator(); GlobalWin.MainForm.UnpauseEmulator();

View File

@ -98,5 +98,13 @@ namespace BizHawk.Common.NumberExtensions
return 16; return 16;
} }
/// <summary>
/// The % operator is a remainder operator. (e.g. -1 mod 4 returns -1, not 3.)
/// </summary>
public static int Mod(this int a, int b)
{
return a - (b * (int)System.Math.Floor((float)a / b));
}
} }
} }

View File

@ -130,7 +130,7 @@ namespace BizHawk.Emulation.DiscSystem
//we can read the 2048 bytes directly //we can read the 2048 bytes directly
var sector = disc.SynthProvider.Get(lba); var sector = disc.SynthProvider.Get(lba);
PrepareBuffer(buffer, offset, 2352); PrepareBuffer(buffer, offset, 2048);
PrepareJob(lba); PrepareJob(lba);
job.DestBuffer2448 = buf2442; job.DestBuffer2448 = buf2442;
job.DestOffset = 0; job.DestOffset = 0;
@ -147,7 +147,7 @@ namespace BizHawk.Emulation.DiscSystem
//we can read the 2048 bytes directly but we have to get them from the mode 2 data //we can read the 2048 bytes directly but we have to get them from the mode 2 data
var sector = disc.SynthProvider.Get(lba); var sector = disc.SynthProvider.Get(lba);
PrepareBuffer(buffer, offset, 2352); PrepareBuffer(buffer, offset, 2048);
PrepareJob(lba); PrepareJob(lba);
job.DestBuffer2448 = buf2442; job.DestBuffer2448 = buf2442;
job.DestOffset = 0; job.DestOffset = 0;