Revert SetReadOnly() function

This commit is contained in:
adelikat 2012-05-28 01:29:43 +00:00
parent f7ee1dbbf3
commit 520dfcb37b
1 changed files with 87 additions and 93 deletions

View File

@ -30,16 +30,16 @@ namespace BizHawk.MultiClient
public bool PressFrameAdvance = false; public bool PressFrameAdvance = false;
public bool PressRewind = false; public bool PressRewind = false;
public bool FastForward = false; public bool FastForward = false;
public bool TurboFastForward = false; public bool TurboFastForward = false;
public bool StopOnEnd = false; public bool StopOnEnd = false;
//avi/wav state //avi/wav state
IVideoWriter CurrAviWriter = null; IVideoWriter CurrAviWriter = null;
/// <summary> /// <summary>
/// an audio proxy used for dumping /// an audio proxy used for dumping
/// </summary> /// </summary>
Emulation.Sound.Utilities.DualSound DumpProxy = null; Emulation.Sound.Utilities.DualSound DumpProxy = null;
//runloop control //runloop control
@ -272,7 +272,7 @@ namespace BizHawk.MultiClient
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param> /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing) protected override void Dispose(bool disposing)
{ {
if(Global.DisplayManager != null) Global.DisplayManager.Dispose(); if (Global.DisplayManager != null) Global.DisplayManager.Dispose();
Global.DisplayManager = null; Global.DisplayManager = null;
if (disposing && (components != null)) if (disposing && (components != null))
@ -715,16 +715,16 @@ namespace BizHawk.MultiClient
genControls.BindMulti("P1 Start", Global.Config.GenesisController[0].Start); genControls.BindMulti("P1 Start", Global.Config.GenesisController[0].Start);
Global.GenControls = genControls; Global.GenControls = genControls;
var agenControls = new AutofireController(Genesis.GenesisController); var agenControls = new AutofireController(Genesis.GenesisController);
agenControls.BindMulti("P1 Up", Global.Config.GenesisAutoController[0].Up); agenControls.BindMulti("P1 Up", Global.Config.GenesisAutoController[0].Up);
agenControls.BindMulti("P1 Left", Global.Config.GenesisAutoController[0].Left); agenControls.BindMulti("P1 Left", Global.Config.GenesisAutoController[0].Left);
agenControls.BindMulti("P1 Right", Global.Config.GenesisAutoController[0].Right); agenControls.BindMulti("P1 Right", Global.Config.GenesisAutoController[0].Right);
agenControls.BindMulti("P1 Down", Global.Config.GenesisAutoController[0].Down); agenControls.BindMulti("P1 Down", Global.Config.GenesisAutoController[0].Down);
agenControls.BindMulti("P1 A", Global.Config.GenesisAutoController[0].A); agenControls.BindMulti("P1 A", Global.Config.GenesisAutoController[0].A);
agenControls.BindMulti("P1 B", Global.Config.GenesisAutoController[0].B); agenControls.BindMulti("P1 B", Global.Config.GenesisAutoController[0].B);
agenControls.BindMulti("P1 C", Global.Config.GenesisAutoController[0].C); agenControls.BindMulti("P1 C", Global.Config.GenesisAutoController[0].C);
agenControls.BindMulti("P1 Start", Global.Config.GenesisAutoController[0].Start); agenControls.BindMulti("P1 Start", Global.Config.GenesisAutoController[0].Start);
Global.AutofireGenControls = agenControls; Global.AutofireGenControls = agenControls;
var a2600Controls = new Controller(Atari2600.Atari2600ControllerDefinition); var a2600Controls = new Controller(Atari2600.Atari2600ControllerDefinition);
a2600Controls.BindMulti("P1 Up", Global.Config.Atari2600Controller[0].Up); a2600Controls.BindMulti("P1 Up", Global.Config.Atari2600Controller[0].Up);
@ -974,7 +974,7 @@ namespace BizHawk.MultiClient
atariToolStripMenuItem.Visible = false; atariToolStripMenuItem.Visible = false;
switch (system) switch (system)
{ {
case "TI83": case "TI83":
tI83ToolStripMenuItem.Visible = true; tI83ToolStripMenuItem.Visible = true;
break; break;
@ -1777,29 +1777,29 @@ namespace BizHawk.MultiClient
runFrame = true; runFrame = true;
} }
MOVIEMODE movieMode = Global.MovieSession.Movie.Mode; MOVIEMODE movieMode = Global.MovieSession.Movie.Mode;
if (Global.Config.RewindEnabled && (Global.ClientControls["Rewind"] || PressRewind)) if (Global.Config.RewindEnabled && (Global.ClientControls["Rewind"] || PressRewind))
{ {
Rewind(1); Rewind(1);
suppressCaptureRewind = true; suppressCaptureRewind = true;
if (0 == RewindBuf.Count) if (0 == RewindBuf.Count)
{ {
runFrame = false; runFrame = false;
} }
else else
{ {
runFrame = true; runFrame = true;
} }
//Save this here and restore it later, we don't want to capture input when rewinding, even in record mode //Save this here and restore it later, we don't want to capture input when rewinding, even in record mode
movieMode = Global.MovieSession.Movie.Mode; movieMode = Global.MovieSession.Movie.Mode;
Global.MovieSession.Movie.Mode = MOVIEMODE.PLAY; Global.MovieSession.Movie.Mode = MOVIEMODE.PLAY;
} }
bool genSound = false; bool genSound = false;
if (runFrame) if (runFrame)
{ {
//client input-related duties //client input-related duties
Global.OSD.ClearGUIText(); Global.OSD.ClearGUIText();
UpdateToolsBefore(); UpdateToolsBefore();
#if WINDOWS #if WINDOWS
@ -1850,9 +1850,9 @@ namespace BizHawk.MultiClient
} }
} }
//the movie session makes sure that the correct input has been read and merged to its MovieControllerAdapter; //the movie session makes sure that the correct input has been read and merged to its MovieControllerAdapter;
//this has been wired to Global.MovieOutputHardpoint in RewireInputChain //this has been wired to Global.MovieOutputHardpoint in RewireInputChain
session.Movie.CommitFrame(Global.Emulator.Frame, Global.MovieOutputHardpoint); session.Movie.CommitFrame(Global.Emulator.Frame, Global.MovieOutputHardpoint);
if (Global.MovieSession.Movie.Mode == MOVIEMODE.INACTIVE || Global.MovieSession.Movie.Mode == MOVIEMODE.FINISHED) if (Global.MovieSession.Movie.Mode == MOVIEMODE.INACTIVE || Global.MovieSession.Movie.Mode == MOVIEMODE.FINISHED)
{ {
@ -1863,7 +1863,7 @@ namespace BizHawk.MultiClient
{ {
if (Global.MovieSession.Movie.Length() == Global.Emulator.Frame && true == StopOnEnd) if (Global.MovieSession.Movie.Length() == Global.Emulator.Frame && true == StopOnEnd)
{ {
StopOnEnd = false; StopOnEnd = false;
Global.MovieSession.Movie.SetMovieFinished(); Global.MovieSession.Movie.SetMovieFinished();
} }
} }
@ -1896,14 +1896,14 @@ namespace BizHawk.MultiClient
int samples = (int)(44100 / Global.Emulator.CoreOutputComm.VsyncRate); int samples = (int)(44100 / Global.Emulator.CoreOutputComm.VsyncRate);
short[] temp = new short[samples * 2]; short[] temp = new short[samples * 2];
//Global.Emulator.SoundProvider.GetSamples(temp); //Global.Emulator.SoundProvider.GetSamples(temp);
DumpProxy.GetSamples(temp); DumpProxy.GetSamples(temp);
//genSound = false; //genSound = false;
CurrAviWriter.AddFrame(Global.Emulator.VideoProvider); CurrAviWriter.AddFrame(Global.Emulator.VideoProvider);
CurrAviWriter.AddSamples(temp); CurrAviWriter.AddSamples(temp);
} }
if (Global.Emulator.IsLagFrame && Global.Config.AutofireLagFrames) if (Global.Emulator.IsLagFrame && Global.Config.AutofireLagFrames)
{ {
@ -1911,26 +1911,26 @@ namespace BizHawk.MultiClient
} }
PressFrameAdvance = false; PressFrameAdvance = false;
UpdateToolsAfter(); UpdateToolsAfter();
} }
if (Global.ClientControls["Rewind"] || PressRewind) if (Global.ClientControls["Rewind"] || PressRewind)
{ {
UpdateToolsAfter(); UpdateToolsAfter();
Global.MovieSession.Movie.Mode = movieMode; Global.MovieSession.Movie.Mode = movieMode;
PressRewind = false; PressRewind = false;
} }
if (genSound) if (genSound)
{ {
// change audio path if dumping is occuring // change audio path if dumping is occuring
if (DumpProxy != null) if (DumpProxy != null)
Global.Sound.UpdateSound(DumpProxy.secondpin); Global.Sound.UpdateSound(DumpProxy.secondpin);
else else
Global.Sound.UpdateSound(Global.Emulator.SoundProvider); Global.Sound.UpdateSound(Global.Emulator.SoundProvider);
} }
else else
Global.Sound.UpdateSound(NullSound.SilenceProvider); Global.Sound.UpdateSound(NullSound.SilenceProvider);
} }
/// <summary> /// <summary>
@ -1951,12 +1951,12 @@ namespace BizHawk.MultiClient
/// <summary> /// <summary>
/// Update all tools that are frame dependent like Ram Search after processing /// Update all tools that are frame dependent like Ram Search after processing
/// </summary> /// </summary>
public void UpdateToolsAfter() public void UpdateToolsAfter()
{ {
//The other tool updates are earlier, TAStudio needs to be later so it can display the latest //The other tool updates are earlier, TAStudio needs to be later so it can display the latest
//frame of execution in its list view. //frame of execution in its list view.
TAStudio1.UpdateValues(); TAStudio1.UpdateValues();
} }
private unsafe Image MakeScreenshotImage() private unsafe Image MakeScreenshotImage()
{ {
@ -2108,9 +2108,9 @@ namespace BizHawk.MultiClient
} }
reader.Close(); reader.Close();
UpdateToolsBefore(); UpdateToolsBefore();
UpdateToolsAfter(); UpdateToolsAfter();
Global.OSD.AddMessage("Loaded state: " + name); Global.OSD.AddMessage("Loaded state: " + name);
} }
else else
Global.OSD.AddMessage("Loadstate error!"); Global.OSD.AddMessage("Loadstate error!");
@ -2505,7 +2505,7 @@ namespace BizHawk.MultiClient
Global.Config.MainWndx = -1; Global.Config.MainWndx = -1;
Global.Config.MainWndy = -1; Global.Config.MainWndy = -1;
} }
if (Global.Config.ShowLogWindow) LogConsole.SaveConfigSettings(); if (Global.Config.ShowLogWindow) LogConsole.SaveConfigSettings();
ConfigService.Save(PathManager.DefaultIniPath, Global.Config); ConfigService.Save(PathManager.DefaultIniPath, Global.Config);
} }
@ -2594,16 +2594,10 @@ namespace BizHawk.MultiClient
public void SetReadOnly(bool read_only) public void SetReadOnly(bool read_only)
{ {
ReadOnly = read_only; ReadOnly = read_only;
if (ReadOnly) if (ReadOnly)
{ Global.OSD.AddMessage("Movie read-only mode");
Global.MovieSession.Movie.Mode = MOVIEMODE.PLAY; else
Global.OSD.AddMessage("Movie read-only mode"); Global.OSD.AddMessage("Movie read+write mode");
}
else
{
Global.MovieSession.Movie.Mode = MOVIEMODE.RECORD;
Global.OSD.AddMessage("Movie read+write mode");
}
} }
public void LoadRamWatch() public void LoadRamWatch()
@ -2721,8 +2715,8 @@ namespace BizHawk.MultiClient
//TODO - cores should be able to specify exact values for these instead of relying on this to calculate them //TODO - cores should be able to specify exact values for these instead of relying on this to calculate them
int fps = (int)(Global.Emulator.CoreOutputComm.VsyncRate * 0x01000000); int fps = (int)(Global.Emulator.CoreOutputComm.VsyncRate * 0x01000000);
IVideoWriter aw; IVideoWriter aw;
string ext = Path.GetExtension(sfd.FileName).ToLower(); string ext = Path.GetExtension(sfd.FileName).ToLower();
if (ext == ".jmd") if (ext == ".jmd")
aw = new JMDWriter(); aw = new JMDWriter();
@ -2738,12 +2732,12 @@ namespace BizHawk.MultiClient
aw.SetVideoParameters(Global.Emulator.VideoProvider.BufferWidth, Global.Emulator.VideoProvider.BufferHeight); aw.SetVideoParameters(Global.Emulator.VideoProvider.BufferWidth, Global.Emulator.VideoProvider.BufferHeight);
aw.SetAudioParameters(44100, 2, 16); aw.SetAudioParameters(44100, 2, 16);
var token = aw.AcquireVideoCodecToken(Global.MainForm.Handle); var token = aw.AcquireVideoCodecToken(Global.MainForm.Handle);
if (token == null) if (token == null)
{ {
Global.OSD.AddMessage("AVI capture canceled."); Global.OSD.AddMessage("AVI capture canceled.");
aw.Dispose(); aw.Dispose();
return; return;
} }
aw.SetVideoCodecToken(token); aw.SetVideoCodecToken(token);
aw.OpenFile(sfd.FileName); aw.OpenFile(sfd.FileName);
@ -2760,23 +2754,23 @@ namespace BizHawk.MultiClient
aw.Dispose(); aw.Dispose();
throw; throw;
} }
// buffersize here is entirely guess // buffersize here is entirely guess
DumpProxy = new Emulation.Sound.Utilities.DualSound(Global.Emulator.SoundProvider, 8192); DumpProxy = new Emulation.Sound.Utilities.DualSound(Global.Emulator.SoundProvider, 8192);
} }
public void StopAVI() public void StopAVI()
{ {
if (CurrAviWriter == null) if (CurrAviWriter == null)
{ {
DumpProxy = null; DumpProxy = null;
return; return;
} }
CurrAviWriter.CloseFile(); CurrAviWriter.CloseFile();
CurrAviWriter = null; CurrAviWriter = null;
Global.OSD.AddMessage("AVI capture stopped"); Global.OSD.AddMessage("AVI capture stopped");
AVIStatusLabel.Image = BizHawk.MultiClient.Properties.Resources.Blank; AVIStatusLabel.Image = BizHawk.MultiClient.Properties.Resources.Blank;
AVIStatusLabel.ToolTipText = ""; AVIStatusLabel.ToolTipText = "";
DumpProxy = null; // return to normal sound output DumpProxy = null; // return to normal sound output
} }
private void SwapBackupSavestate(string path) private void SwapBackupSavestate(string path)