diff --git a/BizHawk.Client.MultiHawk/App.config b/BizHawk.Client.MultiHawk/App.config deleted file mode 100644 index 45437954e0..0000000000 --- a/BizHawk.Client.MultiHawk/App.config +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - diff --git a/BizHawk.Client.MultiHawk/BizHawk.Client.MultiHawk.csproj b/BizHawk.Client.MultiHawk/BizHawk.Client.MultiHawk.csproj deleted file mode 100644 index daf4e4ecc3..0000000000 --- a/BizHawk.Client.MultiHawk/BizHawk.Client.MultiHawk.csproj +++ /dev/null @@ -1,250 +0,0 @@ - - - - true - ..\output\ - TRACE;DEBUG;WINDOWS - true - full - AnyCPU - prompt - - MinimumRecommendedRules.ruleset - - - ..\output\ - TRACE;WINDOWS - true - true - pdbonly - AnyCPU - prompt - - MinimumRecommendedRules.ruleset - - - - Debug - x86 - {B95649F5-A0AE-41EB-B62B-578A2AFF5E18} - WinExe - Properties - BizHawk.Client.MultiHawk - MultiHawk - v4.6.1 - 512 - - None - true - - - - - False - ..\References\Newtonsoft.Json.dll - - - ..\References\OpenTK.dll - - - False - ..\References\x64\SlimDX.dll - - - - - - - - - - - - - - - Form - - - PlayMovie.cs - - - Form - - - RecordMovie.cs - - - - Form - - - EmulatorWindow.cs - - - - - - - - Form - - - Mainform.cs - - - - - - - - PlayMovie.cs - - - RecordMovie.cs - - - EmulatorWindow.cs - - - Mainform.cs - - - ResXFileCodeGenerator - Resources.Designer.cs - Designer - - - True - Resources.resx - True - - - SettingsSingleFileGenerator - Settings.Designer.cs - - - True - Settings.settings - True - - - - - - - - - - {24a0aa3c-b25f-4197-b23d-476d6462dba0} - BizHawk.Client.Common - - - {dd448b37-ba3f-4544-9754-5406e8094723} - BizHawk.Client.EmuHawk - - - {866f8d13-0678-4ff9-80a4-a3993fd4d8a3} - BizHawk.Common - - - {e1a23168-b571-411c-b360-2229e7225e0e} - BizHawk.Emulation.Common - - - {197d4314-8a9f-49ba-977d-54acefaeb6ba} - BizHawk.Emulation.Cores - - - {f51946ea-827f-4d82-b841-1f2f6d060312} - BizHawk.Emulation.DiscSystem - - - {337ca23e-65e7-44e1-9411-97ee08bb8116} - BizHawk.Bizware.BizwareGL.GdiPlus - - - {5160cfb1-5389-47c1-b7f6-8a0dc97641ee} - BizHawk.Bizware.BizwareGL.OpenTK - - - {e6b436b1-a3cd-4c9a-8f76-5d7154726884} - BizHawk.Bizware.BizwareGL.SlimDX - - - {9f84a0b2-861e-4ef4-b89b-5e2a3f38a465} - BizHawk.Bizware.BizwareGL - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/BizHawk.Client.MultiHawk/BizHawk.Client.MultiHawk.csproj.DotSettings b/BizHawk.Client.MultiHawk/BizHawk.Client.MultiHawk.csproj.DotSettings deleted file mode 100644 index 73e96563f9..0000000000 --- a/BizHawk.Client.MultiHawk/BizHawk.Client.MultiHawk.csproj.DotSettings +++ /dev/null @@ -1,2 +0,0 @@ - - CSharp60 \ No newline at end of file diff --git a/BizHawk.Client.MultiHawk/DisplayManager/DisplayManager.cs b/BizHawk.Client.MultiHawk/DisplayManager/DisplayManager.cs deleted file mode 100644 index ceb67d81e7..0000000000 --- a/BizHawk.Client.MultiHawk/DisplayManager/DisplayManager.cs +++ /dev/null @@ -1,724 +0,0 @@ -//TODO -//we could flag textures as 'actually' render targets (keep a reference to the render target?) which could allow us to convert between them more quickly in some cases - -using System; -using System.IO; -using System.Collections.Generic; -using System.Diagnostics; -using System.Drawing; - -using BizHawk.Emulation.Common; -using BizHawk.Client.Common; -using BizHawk.Client.EmuHawk; -using BizHawk.Client.EmuHawk.FilterManager; -using BizHawk.Bizware.BizwareGL; - -using OpenTK; -using BizHawk.Bizware.BizwareGL.Drivers.SlimDX; -using BizHawk.Bizware.BizwareGL.Drivers.GdiPlus; - -namespace BizHawk.Client.MultiHawk -{ - /// - /// A DisplayManager is destined forevermore to drive the PresentationPanel it gets initialized with. - /// Its job is to receive OSD and emulator outputs, and produce one single buffer (BitampBuffer? Texture2d?) for display by the PresentationPanel. - /// Details TBD - /// - public class DisplayManager : IDisposable - { - class DisplayManagerRenderTargetProvider : IRenderTargetProvider - { - public DisplayManagerRenderTargetProvider(Func callback) { Callback = callback; } - Func Callback; - RenderTarget IRenderTargetProvider.Get(Size size) - { - return Callback(size); - } - } - - public DisplayManager(PresentationPanel presentationPanel, IGL gl, GLManager glManager) - { - GL = gl; - GLManager = glManager; - this.presentationPanel = presentationPanel; - GraphicsControl = this.presentationPanel.GraphicsControl; - CR_GraphicsControl = GLManager.GetContextForGraphicsControl(GraphicsControl); - - //it's sort of important for these to be initialized to something nonzero - currEmuWidth = currEmuHeight = 1; - - Renderer = GL.CreateRenderer(); - - VideoTextureFrugalizer = new TextureFrugalizer(GL); - - ShaderChainFrugalizers = new RenderTargetFrugalizer[16]; //hacky hardcoded limit.. need some other way to manage these - for (int i = 0; i < 16; i++) - { - ShaderChainFrugalizers[i] = new RenderTargetFrugalizer(GL); - } - - RefreshUserShader(); - } - - public bool Disposed { get; private set; } - - public void Dispose() - { - if (Disposed) return; - Disposed = true; - VideoTextureFrugalizer.Dispose(); - foreach (var f in LuaSurfaceFrugalizers.Values) - f.Dispose(); - foreach (var f in ShaderChainFrugalizers) - if (f != null) - f.Dispose(); - Renderer.Dispose(); - } - - //rendering resources: - IGL GL; - GLManager GLManager; - IGuiRenderer Renderer; - - //layer resources - PresentationPanel presentationPanel; //well, its the final layer's target, at least - GraphicsControl GraphicsControl; //well, its the final layer's target, at least - GLManager.ContextRef CR_GraphicsControl; - FilterProgram CurrentFilterProgram; - - /// - /// these variables will track the dimensions of the last frame's (or the next frame? this is confusing) emulator native output size - /// THIS IS OLD JUNK. I should get rid of it, I think. complex results from the last filter ingestion should be saved instead. - /// - int currEmuWidth, currEmuHeight; - - /// - /// additional pixels added at the unscaled level for the use of lua drawing. essentially increases the input video provider dimensions - /// - public System.Windows.Forms.Padding GameExtraPadding; - - /// - /// additional pixels added at the native level for the use of lua drawing. essentially just gets tacked onto the final calculated window sizes. - /// - public System.Windows.Forms.Padding ClientExtraPadding; - - /// - /// custom fonts that don't need to be installed on the user side - /// - public System.Drawing.Text.PrivateFontCollection CustomFonts = new System.Drawing.Text.PrivateFontCollection(); - - TextureFrugalizer VideoTextureFrugalizer; - Dictionary LuaSurfaceFrugalizers = new Dictionary(); - RenderTargetFrugalizer[] ShaderChainFrugalizers; - EmuHawk.Filters.RetroShaderChain ShaderChain_user; - - public void RefreshUserShader() - { - if (ShaderChain_user != null) - ShaderChain_user.Dispose(); - if (File.Exists(Global.Config.DispUserFilterPath)) - { - var fi = new FileInfo(Global.Config.DispUserFilterPath); - using (var stream = fi.OpenRead()) - ShaderChain_user = new EmuHawk.Filters.RetroShaderChain(GL, new EmuHawk.Filters.RetroShaderPreset(stream), Path.GetDirectoryName(Global.Config.DispUserFilterPath)); - } - } - - System.Windows.Forms.Padding CalculateCompleteContentPadding(bool user, bool source) - { - var padding = new System.Windows.Forms.Padding(); - - if(user) - padding += GameExtraPadding; - - //an experimental feature - if(source) - if (Global.Emulator is BizHawk.Emulation.Cores.Sony.PSX.Octoshock) - { - var psx = Global.Emulator as BizHawk.Emulation.Cores.Sony.PSX.Octoshock; - var core_padding = psx.VideoProvider_Padding; - padding.Left += core_padding.Width / 2; - padding.Right += core_padding.Width - core_padding.Width / 2; - padding.Top += core_padding.Height / 2; - padding.Bottom += core_padding.Height - core_padding.Height / 2; - } - - return padding; - } - - FilterProgram BuildDefaultChain(Size chain_insize, Size chain_outsize, bool includeOSD) - { - //select user special FX shader chain - Dictionary selectedChainProperties = new Dictionary(); - EmuHawk.Filters.RetroShaderChain selectedChain = null; - if (Global.Config.TargetDisplayFilter == 3 && ShaderChain_user != null && ShaderChain_user.Available) - selectedChain = ShaderChain_user; - - EmuHawk.Filters.FinalPresentation fPresent = new EmuHawk.Filters.FinalPresentation(chain_outsize); - EmuHawk.Filters.SourceImage fInput = new EmuHawk.Filters.SourceImage(chain_insize); - EmuHawk.Filters.OSD fOSD = new EmuHawk.Filters.OSD(); - fOSD.RenderCallback = () => - { - if (!includeOSD) - return; - var size = fOSD.FindInput().SurfaceFormat.Size; - Renderer.Begin(size.Width, size.Height); - Renderer.SetBlendState(GL.BlendNormal); - Renderer.End(); - }; - - var chain = new FilterProgram(); - - //add the first filter, encompassing output from the emulator core - chain.AddFilter(fInput, "input"); - - //if a non-zero padding is required, add a filter to allow for that - //note, we have two sources of padding right now.. one can come from the videoprovider and one from the user. - //we're combining these now and just using black, for sake of being lean, despite the discussion below: - //keep in mind, the videoprovider design in principle might call for another color. - //we havent really been using this very hard, but users will probably want black there (they could fill it to another color if needed tho) - var padding = CalculateCompleteContentPadding(true,true); - if (padding.Vertical != 0 || padding.Horizontal != 0) - { - //TODO - add another filter just for this, its cumbersome to use final presentation... I think. but maybe theres enough similarities to justify it. - Size size = chain_insize; - size.Width += padding.Horizontal; - size.Height += padding.Vertical; - EmuHawk.Filters.FinalPresentation fPadding = new EmuHawk.Filters.FinalPresentation(size); - chain.AddFilter(fPadding, "padding"); - fPadding.GuiRenderer = Renderer; - fPadding.GL = GL; - fPadding.Config_PadOnly = true; - fPadding.Padding = padding; - } - - if (Global.Config.DispPrescale != 1) - { - EmuHawk.Filters.PrescaleFilter fPrescale = new EmuHawk.Filters.PrescaleFilter() { Scale = Global.Config.DispPrescale }; - chain.AddFilter(fPrescale, "user_prescale"); - } - - //AutoPrescale makes no sense for a None final filter - if (Global.Config.DispAutoPrescale && Global.Config.DispFinalFilter != (int)EmuHawk.Filters.FinalPresentation.eFilterOption.None) - { - var apf = new EmuHawk.Filters.AutoPrescaleFilter(); - chain.AddFilter(apf, "auto_prescale"); - } - - //choose final filter - EmuHawk.Filters.FinalPresentation.eFilterOption finalFilter = EmuHawk.Filters.FinalPresentation.eFilterOption.None; - fPresent.FilterOption = finalFilter; - - //add final presentation - chain.AddFilter(fPresent, "presentation"); - - return chain; - } - - /// - /// This will receive an emulated output frame from an IVideoProvider and run it through the complete frame processing pipeline - /// Then it will stuff it into the bound PresentationPanel. - /// --- - /// If the int[] is size=1, then it contains an openGL texture ID (and the size should be as specified from videoProvider) - /// Don't worry about the case where the frontend isnt using opengl; DisplayManager deals with it - /// - public void UpdateSource(IVideoProvider videoProvider) - { - bool displayNothing = Global.Config.DispSpeedupFeatures == 0; - var job = new JobInfo - { - videoProvider = videoProvider, - simulate = displayNothing, - chain_outsize = GraphicsControl.Size, - includeOSD = true, - }; - UpdateSourceInternal(job); - } - - public BitmapBuffer RenderVideoProvider(IVideoProvider videoProvider) - { - //TODO - we might need to gather more Global.Config.DispXXX properties here, so they can be overridden - var targetSize = new Size(videoProvider.BufferWidth, videoProvider.BufferHeight); - var padding = CalculateCompleteContentPadding(true,true); - targetSize.Width += padding.Horizontal; - targetSize.Height += padding.Vertical; - - var job = new JobInfo - { - videoProvider = videoProvider, - simulate = false, - chain_outsize = targetSize, - offscreen = true, - includeOSD = false - }; - UpdateSourceInternal(job); - return job.offscreenBB; - } - - /// - /// Does the entire display process to an offscreen buffer, suitable for a 'client' screenshot. - /// - public BitmapBuffer RenderOffscreen(IVideoProvider videoProvider, bool includeOSD) - { - var job = new JobInfo - { - videoProvider = videoProvider, - simulate = false, - chain_outsize = GraphicsControl.Size, - offscreen = true, - includeOSD = includeOSD - }; - UpdateSourceInternal(job); - return job.offscreenBB; - } - - class FakeVideoProvider : IVideoProvider - { - public int[] GetVideoBuffer() { return new int[] {}; } - - public int VirtualWidth { get; set; } - public int VirtualHeight { get; set; } - - public int BufferWidth { get; set; } - public int BufferHeight { get; set; } - public int BackgroundColor { get; set; } - - public int VsyncNumerator - { - get { throw new InvalidOperationException(); } - } - - public int VsyncDenominator - { - get { throw new InvalidOperationException(); } - } - } - - void FixRatio(float x, float y, int inw, int inh, out int outw, out int outh) - { - float ratio = x / y; - if (ratio <= 1) - { - //taller. weird. expand height. - outw = inw; - outh = (int)((float)inw / ratio); - } - else - { - //wider. normal. expand width. - outw = (int)((float)inh * ratio); - outh = inh; - } - } - - /// - /// Attempts to calculate a good client size with the given zoom factor, considering the user's DisplayManager preferences - /// TODO - this needs to be redone with a concept different from zoom factor. - /// basically, each increment of a 'zoomlike' factor should definitely increase the viewable area somehow, even if it isnt strictly by an entire zoom level. - /// - public Size CalculateClientSize(IVideoProvider videoProvider, int zoom) - { - bool ar_active = Global.Config.DispFixAspectRatio; - bool ar_system = Global.Config.DispManagerAR == Config.EDispManagerAR.System; - bool ar_custom = Global.Config.DispManagerAR == Config.EDispManagerAR.Custom; - bool ar_customRatio = Global.Config.DispManagerAR == Config.EDispManagerAR.CustomRatio; - bool ar_correct = ar_system || ar_custom || ar_customRatio; - bool ar_unity = !ar_correct; - bool ar_integer = Global.Config.DispFixScaleInteger; - - int bufferWidth = videoProvider.BufferWidth; - int bufferHeight = videoProvider.BufferHeight; - int virtualWidth = videoProvider.VirtualWidth; - int virtualHeight = videoProvider.VirtualHeight; - - if (ar_custom) - { - virtualWidth = Global.Config.DispCustomUserARWidth; - virtualHeight = Global.Config.DispCustomUserARHeight; - } - - if (ar_customRatio) - { - FixRatio(Global.Config.DispCustomUserARX, Global.Config.DispCustomUserARY, videoProvider.BufferWidth, videoProvider.BufferHeight, out virtualWidth, out virtualHeight); - } - - var padding = CalculateCompleteContentPadding(true, false); - virtualWidth += padding.Horizontal; - virtualHeight += padding.Vertical; - - padding = CalculateCompleteContentPadding(true, true); - bufferWidth += padding.Horizontal; - bufferHeight += padding.Vertical; - - //Console.WriteLine("DISPZOOM " + zoom); //test - - //old stuff - var fvp = new FakeVideoProvider(); - fvp.BufferWidth = bufferWidth; - fvp.BufferHeight = bufferHeight; - fvp.VirtualWidth = virtualWidth; - fvp.VirtualHeight = virtualHeight; - - Size chain_outsize = new Size(fvp.BufferWidth * zoom, fvp.BufferHeight * zoom); - - if (ar_active) - { - if (ar_correct) - { - if (ar_integer) - { - //ALERT COPYPASTE LAUNDROMAT - Vector2 VS = new Vector2(virtualWidth, virtualHeight); - Vector2 BS = new Vector2(bufferWidth, bufferHeight); - Vector2 AR = Vector2.Divide(VS, BS); - float target_par = (AR.X / AR.Y); - - //this would malfunction for AR <= 0.5 or AR >= 2.0 - //EDIT - in fact, we have AR like that coming from PSX, sometimes, so maybe we should solve this better - Vector2 PS = new Vector2(1, 1); - - //here's how we define zooming, in this case: - //make sure each step is an increment of zoom for at least one of the dimensions (or maybe both of them) - //look for the increment which helps the AR the best - //TODO - this cant possibly support scale factors like 1.5x - //TODO - also, this might be messing up zooms and stuff, we might need to run this on the output size of the filter chain - for (int i = 1; i < zoom;i++) - { - //would not be good to run this per frame, but it seems to only run when the resolution changes, etc. - Vector2[] trials = new[] { - PS + new Vector2(1, 0), - PS + new Vector2(0, 1), - PS + new Vector2(1, 1) - }; - int bestIndex = -1; - float bestValue = 1000.0f; - for (int t = 0; t < trials.Length; t++) - { - //I. - float test_ar = trials[t].X / trials[t].Y; - - //II. - //Vector2 calc = Vector2.Multiply(trials[t], VS); - //float test_ar = calc.X / calc.Y; - - //not clear which approach is superior - float deviation_linear = Math.Abs(test_ar - target_par); - float deviation_geom = test_ar / target_par; - if (deviation_geom < 1) deviation_geom = 1.0f / deviation_geom; - - float value = deviation_linear; - if (value < bestValue) - { - bestIndex = t; - bestValue = value; - } - } - //is it possible to get here without selecting one? doubtful. - //EDIT: YES IT IS. it happened with an 0,0 buffer size. of course, that was a mistake, but we shouldnt crash - if(bestIndex != -1) //so, what now? well, this will result in 0,0 getting picked, so thats probably all we can do - PS = trials[bestIndex]; - } - - chain_outsize = new Size((int)(bufferWidth * PS.X), (int)(bufferHeight * PS.Y)); - } - else - { - //obey the AR, but allow free scaling: just zoom the virtual size - chain_outsize = new Size(virtualWidth * zoom, virtualHeight * zoom); - } - } - else - { - //ar_unity: - //just choose to zoom the buffer (make no effort to incorporate AR) - chain_outsize = new Size(bufferWidth * zoom, bufferHeight * zoom); - } - } - else - { - //!ar_active: - //just choose to zoom the buffer (make no effort to incorporate AR) - chain_outsize = new Size(bufferWidth * zoom, bufferHeight * zoom); - } - - chain_outsize.Width += ClientExtraPadding.Horizontal; - chain_outsize.Height += ClientExtraPadding.Vertical; - - var job = new JobInfo - { - videoProvider = fvp, - simulate = true, - chain_outsize = chain_outsize, - }; - var filterProgram = UpdateSourceInternal(job); - - var size = filterProgram.Filters[filterProgram.Filters.Count - 1].FindOutput().SurfaceFormat.Size; - - return size; - } - - class JobInfo - { - public IVideoProvider videoProvider; - public bool simulate; - public Size chain_outsize; - public bool offscreen; - public BitmapBuffer offscreenBB; - public bool includeOSD; - } - - FilterProgram UpdateSourceInternal(JobInfo job) - { - if (job.chain_outsize.Width == 0 || job.chain_outsize.Height == 0) - { - //this has to be a NOP, because lots of stuff will malfunction on a 0-sized viewport - return null; - } - - //no drawing actually happens. it's important not to begin drawing on a control - if (!job.simulate && !job.offscreen) - { - GLManager.Activate(CR_GraphicsControl); - } - - IVideoProvider videoProvider = job.videoProvider; - bool simulate = job.simulate; - Size chain_outsize = job.chain_outsize; - - //simulate = true; - - int vw = videoProvider.BufferWidth; - int vh = videoProvider.BufferHeight; - - if (Global.Config.DispFixAspectRatio) - { - if (Global.Config.DispManagerAR == Config.EDispManagerAR.System) - { - vw = videoProvider.VirtualWidth; - vh = videoProvider.VirtualHeight; - } - if (Global.Config.DispManagerAR == Config.EDispManagerAR.Custom) - { - vw = Global.Config.DispCustomUserARWidth; - vh = Global.Config.DispCustomUserARHeight; - } - if (Global.Config.DispManagerAR == Config.EDispManagerAR.CustomRatio) - { - FixRatio(Global.Config.DispCustomUserARX, Global.Config.DispCustomUserARY, videoProvider.BufferWidth, videoProvider.BufferHeight, out vw, out vh); - } - } - - var padding = CalculateCompleteContentPadding(true,false); - vw += padding.Horizontal; - vh += padding.Vertical; - - int[] videoBuffer = videoProvider.GetVideoBuffer(); - - int bufferWidth = videoProvider.BufferWidth; - int bufferHeight = videoProvider.BufferHeight; - bool isGlTextureId = videoBuffer.Length == 1; - - BitmapBuffer bb = null; - Texture2d videoTexture = null; - if (!simulate) - { - if (isGlTextureId) - { - //FYI: this is a million years from happening on n64, since it's all geriatric non-FBO code - //is it workable for saturn? - videoTexture = GL.WrapGLTexture2d(new IntPtr(videoBuffer[0]), bufferWidth, bufferHeight); - } - else - { - //wrap the videoprovider data in a BitmapBuffer (no point to refactoring that many IVideoProviders) - bb = new BitmapBuffer(bufferWidth, bufferHeight, videoBuffer); - bb.DiscardAlpha(); - - //now, acquire the data sent from the videoProvider into a texture - videoTexture = VideoTextureFrugalizer.Get(bb); - - //lets not use this. lets define BizwareGL to make clamp by default (TBD: check opengl) - //GL.SetTextureWrapMode(videoTexture, true); - } - } - - //record the size of what we received, since lua and stuff is gonna want to draw onto it - currEmuWidth = bufferWidth; - currEmuHeight = bufferHeight; - - //build the default filter chain and set it up with services filters will need - Size chain_insize = new Size(bufferWidth, bufferHeight); - - var filterProgram = BuildDefaultChain(chain_insize, chain_outsize, job.includeOSD); - filterProgram.GuiRenderer = Renderer; - filterProgram.GL = GL; - - //setup the source image filter - EmuHawk.Filters.SourceImage fInput = filterProgram["input"] as EmuHawk.Filters.SourceImage; - fInput.Texture = videoTexture; - - //setup the final presentation filter - EmuHawk.Filters.FinalPresentation fPresent = filterProgram["presentation"] as EmuHawk.Filters.FinalPresentation; - fPresent.VirtualTextureSize = new Size(vw, vh); - fPresent.TextureSize = new Size(bufferWidth, bufferHeight); - fPresent.BackgroundColor = videoProvider.BackgroundColor; - fPresent.GuiRenderer = Renderer; - fPresent.Flip = isGlTextureId; - fPresent.Config_FixAspectRatio = Global.Config.DispFixAspectRatio; - fPresent.Config_FixScaleInteger = Global.Config.DispFixScaleInteger; - fPresent.Padding = ClientExtraPadding; - fPresent.AutoPrescale = Global.Config.DispAutoPrescale; - - fPresent.GL = GL; - - filterProgram.Compile("default", chain_insize, chain_outsize, !job.offscreen); - - if (simulate) - { - } - else - { - CurrentFilterProgram = filterProgram; - UpdateSourceDrawingWork(job); - } - - //cleanup: - if (bb != null) bb.Dispose(); - - return filterProgram; - } - - void UpdateSourceDrawingWork(JobInfo job) - { - bool vsync = false; - bool alternateVsync = false; - //only used by alternate vsync - IGL_SlimDX9 dx9 = null; - - if (!job.offscreen) - { - //apply the vsync setting (should probably try to avoid repeating this) - vsync = Global.Config.VSyncThrottle || Global.Config.VSync; - - //ok, now this is a bit undesireable. - //maybe the user wants vsync, but not vsync throttle. - //this makes sense... but we dont have the infrastructure to support it now (we'd have to enable triple buffering or something like that) - //so what we're gonna do is disable vsync no matter what if throttling is off, and maybe nobody will notice. - //update 26-mar-2016: this upsets me. When fastforwarding and skipping frames, vsync should still work. But I'm not changing it yet - if (Global.DisableSecondaryThrottling) - vsync = false; - - //for now, it's assumed that the presentation panel is the main window, but that may not always be true - if (vsync && Global.Config.DispAlternateVsync && Global.Config.VSyncThrottle) - { - dx9 = GL as IGL_SlimDX9; - if (dx9 != null) - { - alternateVsync = true; - //unset normal vsync if we've chosen the alternate vsync - vsync = false; - } - } - - //TODO - whats so hard about triple buffering anyway? just enable it always, and change api to SetVsync(enable,throttle) - //maybe even SetVsync(enable,throttlemethod) or just SetVsync(enable,throttle,advanced) - - if (LastVsyncSetting != vsync || LastVsyncSettingGraphicsControl != presentationPanel.GraphicsControl) - { - if (LastVsyncSetting == null && vsync) - { - // Workaround for vsync not taking effect at startup (Intel graphics related?) - presentationPanel.GraphicsControl.SetVsync(false); - } - presentationPanel.GraphicsControl.SetVsync(vsync); - LastVsyncSettingGraphicsControl = presentationPanel.GraphicsControl; - LastVsyncSetting = vsync; - } - } - - //begin rendering on this context - //should this have been done earlier? - //do i need to check this on an intel video card to see if running excessively is a problem? (it used to be in the FinalTarget command below, shouldnt be a problem) - //GraphicsControl.Begin(); //CRITICAL POINT for yabause+GL - - //TODO - auto-create and age these (and dispose when old) - int rtCounter = 0; - - CurrentFilterProgram.RenderTargetProvider = new DisplayManagerRenderTargetProvider((size) => ShaderChainFrugalizers[rtCounter++].Get(size)); - - GL.BeginScene(); - - //run filter chain - Texture2d texCurr = null; - RenderTarget rtCurr = null; - bool inFinalTarget = false; - foreach (var step in CurrentFilterProgram.Program) - { - switch (step.Type) - { - case FilterProgram.ProgramStepType.Run: - { - int fi = (int)step.Args; - var f = CurrentFilterProgram.Filters[fi]; - f.SetInput(texCurr); - f.Run(); - var orec = f.FindOutput(); - if (orec != null) - { - if (orec.SurfaceDisposition == SurfaceDisposition.Texture) - { - texCurr = f.GetOutput(); - rtCurr = null; - } - } - break; - } - case FilterProgram.ProgramStepType.NewTarget: - { - var size = (Size)step.Args; - rtCurr = ShaderChainFrugalizers[rtCounter++].Get(size); - rtCurr.Bind(); - CurrentFilterProgram.CurrRenderTarget = rtCurr; - break; - } - case FilterProgram.ProgramStepType.FinalTarget: - { - var size = (Size)step.Args; - inFinalTarget = true; - rtCurr = null; - CurrentFilterProgram.CurrRenderTarget = null; - GL.BindRenderTarget(null); - break; - } - } - } - - GL.EndScene(); - - if (job.offscreen) - { - job.offscreenBB = rtCurr.Texture2d.Resolve(); - job.offscreenBB.DiscardAlpha(); - } - else - { - Debug.Assert(inFinalTarget); - - //wait for vsync to begin - if (alternateVsync) dx9.AlternateVsyncPass(0); - - //present and conclude drawing - presentationPanel.GraphicsControl.SwapBuffers(); - - //wait for vsync to end - if (alternateVsync) dx9.AlternateVsyncPass(1); - - //nope. dont do this. workaround for slow context switching on intel GPUs. just switch to another context when necessary before doing anything - //presentationPanel.GraphicsControl.End(); - } - } - - bool? LastVsyncSetting; - GraphicsControl LastVsyncSettingGraphicsControl; - } -} \ No newline at end of file diff --git a/BizHawk.Client.MultiHawk/EmulatorWindow.Designer.cs b/BizHawk.Client.MultiHawk/EmulatorWindow.Designer.cs deleted file mode 100644 index 5fbddd196c..0000000000 --- a/BizHawk.Client.MultiHawk/EmulatorWindow.Designer.cs +++ /dev/null @@ -1,48 +0,0 @@ -namespace BizHawk.Client.MultiHawk -{ - partial class EmulatorWindow - { - /// - /// Required designer variable. - /// - private System.ComponentModel.IContainer components = null; - - /// - /// Clean up any resources being used. - /// - /// true if managed resources should be disposed; otherwise, false. - protected override void Dispose(bool disposing) - { - if (disposing && (components != null)) - { - components.Dispose(); - } - base.Dispose(disposing); - } - - #region Windows Form Designer generated code - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - private void InitializeComponent() - { - this.SuspendLayout(); - // - // EmulatorWindow - // - this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(284, 262); - this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow; - this.Name = "EmulatorWindow"; - this.ShowIcon = false; - this.Load += new System.EventHandler(this.EmulatorWindow_Load); - this.ResumeLayout(false); - - } - - #endregion - } -} \ No newline at end of file diff --git a/BizHawk.Client.MultiHawk/EmulatorWindow.cs b/BizHawk.Client.MultiHawk/EmulatorWindow.cs deleted file mode 100644 index 0ea193c46c..0000000000 --- a/BizHawk.Client.MultiHawk/EmulatorWindow.cs +++ /dev/null @@ -1,411 +0,0 @@ -using System; -using System.Collections.Generic; -using System.ComponentModel; -using System.Data; -using System.Drawing; -using System.Linq; -using System.Text; -using System.Windows.Forms; - -using BizHawk.Common; -using BizHawk.Common.BufferExtensions; -using BizHawk.Client.EmuHawk; -using BizHawk.Bizware.BizwareGL; -using BizHawk.Client.Common; -using BizHawk.Emulation.Common; -using BizHawk.Emulation.Common.IEmulatorExtensions; -using System.IO; - - -namespace BizHawk.Client.MultiHawk -{ - // TODO: we can safely assume videoprovider cores are a requirement of multihawk, - // but fail sooner and with a clear message instead of making misc calls to AsVideoProvider that will fail - public partial class EmulatorWindow : Form - { - public EmulatorWindow(Mainform parent) - { - InitializeComponent(); - Closing += (o, e) => - { - ShutDown(); - }; - - MainForm = parent; - } - - private void EmulatorWindow_Load(object sender, EventArgs e) - { - if (Game != null) - { - Text = Game.Name; - } - } - - public Mainform MainForm { get; private set; } - public IEmulator Emulator { get; set; } - public CoreComm CoreComm { get; set; } - public GameInfo Game { get; set; } - public string CurrentRomPath { get; set; } - - public IGL GL { get; set; } - public GLManager.ContextRef CR_GL { get; set; } - public GLManager GLManager { get; set; } - - public PresentationPanel PresentationPanel { get; set; } - - //public Sound Sound; // TODO - public DisplayManager DisplayManager; - - - public void Init() - { - PresentationPanel = new PresentationPanel(this, GL); - CR_GL = GLManager.GetContextForIGL(GL); - DisplayManager = new DisplayManager(PresentationPanel, GL ,GLManager); - - Controls.Add(PresentationPanel); - Controls.SetChildIndex(PresentationPanel, 0); - } - - public void ShutDown() - { - SaveRam(); - MainForm.EmulatorWindowClosed(this); - Emulator.Dispose(); - GL.Dispose(); - } - - public void LoadQuickSave(string quickSlotName) - { - if (!Emulator.HasSavestates()) - { - return; - } - - var path = PathManager.SaveStatePrefix(Game) + "." + quickSlotName + ".State"; - - if (LoadStateFile(path, quickSlotName)) - { - // SetMainformMovieInfo(); // TODO - MainForm.AddMessage("Loaded state: " + quickSlotName); - } - else - { - MainForm.AddMessage("Loadstate error!"); - } - } - - public bool LoadStateFile(string path, string name) - { - var core = Emulator.AsStatable(); - - // try to detect binary first - var bl = BinaryStateLoader.LoadAndDetect(path); - if (bl != null) - { - try - { - var succeed = false; - - // TODO - if (IAmMaster) - { - if (Global.MovieSession.Movie.IsActive) - { - bl.GetLump(BinaryStateLump.Input, true, tr => succeed = Global.MovieSession.HandleMovieLoadState_HackyStep1(tr)); - if (!succeed) - { - return false; - } - - bl.GetLump(BinaryStateLump.Input, true, tr => succeed = Global.MovieSession.HandleMovieLoadState_HackyStep2(tr)); - if (!succeed) - { - return false; - } - } - } - - using (new SimpleTime("Load Core")) - bl.GetCoreState(br => core.LoadStateBinary(br), tr => core.LoadStateText(tr)); - - bl.GetLump(BinaryStateLump.Framebuffer, false, PopulateFramebuffer); - } - catch - { - return false; - } - finally - { - bl.Dispose(); - } - - return true; - } - else // text mode - { - if (Global.MovieSession.HandleMovieLoadState(path)) - { - using (var reader = new StreamReader(path)) - { - core.LoadStateText(reader); - - while (true) - { - var str = reader.ReadLine(); - if (str == null) - { - break; - } - - if (str.Trim() == "") - { - continue; - } - - var args = str.Split(' '); - if (args[0] == "Framebuffer") - { - Emulator.AsVideoProvider().GetVideoBuffer().ReadFromHex(args[1]); - } - } - } - - return true; - } - else - { - return false; - } - } - } - - public void PopulateFramebuffer(BinaryReader br) - { - try - { - using (new SimpleTime("Load Framebuffer")) - QuickBmpFile.Load(Emulator.AsVideoProvider(), br.BaseStream); - } - catch - { - var buff = Emulator.AsVideoProvider().GetVideoBuffer(); - try - { - for (int i = 0; i < buff.Length; i++) - { - int j = br.ReadInt32(); - buff[i] = j; - } - } - catch (EndOfStreamException) { } - } - } - - public void SaveQuickSave(string quickSlotName) - { - if (!Emulator.HasSavestates()) - { - return; - } - - var path = PathManager.SaveStatePrefix(Game) + "." + quickSlotName + ".State"; - - var file = new FileInfo(path); - if (file.Directory != null && file.Directory.Exists == false) - { - file.Directory.Create(); - } - - // TODO - // Make backup first - //if (Global.Config.BackupSavestates && file.Exists) - //{ - // var backup = path + ".bak"; - // var backupFile = new FileInfo(backup); - // if (backupFile.Exists) - // { - // backupFile.Delete(); - // } - - // File.Move(path, backup); - //} - - try - { - SaveStateFile(path, quickSlotName); - - MainForm.AddMessage("Saved state: " + quickSlotName); - } - catch (IOException) - { - MainForm.AddMessage("Unable to save state " + path); - } - - // TODO - } - - private void SaveStateFile(string filename, string name) - { - var core = Emulator.AsStatable(); - - using (var bs = new BinaryStateSaver(filename)) - { - if (Global.Config.SaveStateType == Config.SaveStateTypeE.Text || - (Global.Config.SaveStateType == Config.SaveStateTypeE.Default && !core.BinarySaveStatesPreferred)) - { - // text savestate format - using (new SimpleTime("Save Core")) - bs.PutLump(BinaryStateLump.CorestateText, (tw) => core.SaveStateText(tw)); - } - else - { - // binary core lump format - using (new SimpleTime("Save Core")) - bs.PutLump(BinaryStateLump.Corestate, bw => core.SaveStateBinary(bw)); - } - - if (true) //TODO: Global.Config.SaveScreenshotWithStates) - { - var vp = Emulator.AsVideoProvider(); - var buff = vp.GetVideoBuffer(); - - int out_w = vp.BufferWidth; - int out_h = vp.BufferHeight; - - // if buffer is too big, scale down screenshot - if (true /* !Global.Config.NoLowResLargeScreenshotWithStates*/ && buff.Length >= Global.Config.BigScreenshotSize) - { - out_w /= 2; - out_h /= 2; - } - using (new SimpleTime("Save Framebuffer")) - bs.PutLump(BinaryStateLump.Framebuffer, (s) => QuickBmpFile.Save(Emulator.AsVideoProvider(), s, out_w, out_h)); - } - - if (IAmMaster) - { - if (Global.MovieSession.Movie.IsActive) - { - bs.PutLump(BinaryStateLump.Input, - delegate(TextWriter tw) - { - // this never should have been a core's responsibility - tw.WriteLine("Frame {0}", Emulator.Frame); - Global.MovieSession.HandleMovieSaveState(tw); - }); - } - } - } - } - - public bool IAmMaster - { - get - { - return MainForm.EmulatorWindows.First() == this; - } - } - - public void FrameBufferResized() - { - // run this entire thing exactly twice, since the first resize may adjust the menu stacking - for (int i = 0; i < 2; i++) - { - var video = Emulator.AsVideoProvider(); - int zoom = Global.Config.TargetZoomFactors[Global.Emulator.SystemId]; - var area = Screen.FromControl(this).WorkingArea; - - int borderWidth = Size.Width - PresentationPanel.Control.Size.Width; - int borderHeight = Size.Height - PresentationPanel.Control.Size.Height; - - // start at target zoom and work way down until we find acceptable zoom - Size lastComputedSize = new Size(1, 1); - for (; zoom >= 1; zoom--) - { - lastComputedSize = DisplayManager.CalculateClientSize(video, zoom); - if ((((lastComputedSize.Width) + borderWidth) < area.Width) - && (((lastComputedSize.Height) + borderHeight) < area.Height)) - { - break; - } - } - Console.WriteLine("Selecting display size " + lastComputedSize.ToString()); - - // Change size - Size = new Size((lastComputedSize.Width) + borderWidth, ((lastComputedSize.Height) + borderHeight)); - PerformLayout(); - PresentationPanel.Resized = true; - - // Is window off the screen at this size? - if (area.Contains(Bounds) == false) - { - if (Bounds.Right > area.Right) // Window is off the right edge - { - Location = new Point(area.Right - Size.Width, Location.Y); - } - - if (Bounds.Bottom > area.Bottom) // Window is off the bottom edge - { - Location = new Point(Location.X, area.Bottom - Size.Height); - } - } - } - } - - private Size _lastVideoSize = new Size(-1, -1), _lastVirtualSize = new Size(-1, -1); - public void Render() - { - var video = Emulator.AsVideoProvider(); - - Size currVideoSize = new Size(video.BufferWidth, video.BufferHeight); - Size currVirtualSize = new Size(video.VirtualWidth, video.VirtualWidth); - if (currVideoSize != _lastVideoSize || currVirtualSize != _lastVirtualSize) - { - _lastVideoSize = currVideoSize; - _lastVirtualSize = currVirtualSize; - FrameBufferResized(); - } - - DisplayManager.UpdateSource(video); - } - - public void FrameAdvance() - { - Emulator.FrameAdvance(Global.ControllerOutput, true); - } - - public void SaveRam() - { - if (Emulator.HasSaveRam() && Emulator.AsSaveRam().SaveRamModified) - { - var path = PathManager.SaveRamPath(Global.Game); - var f = new FileInfo(path); - if (f.Directory != null && f.Directory.Exists == false) - { - f.Directory.Create(); - } - - // Make backup first - if (Global.Config.BackupSaveram && f.Exists) - { - var backup = path + ".bak"; - var backupFile = new FileInfo(backup); - if (backupFile.Exists) - { - backupFile.Delete(); - } - - f.CopyTo(backup); - } - - var writer = new BinaryWriter(new FileStream(path, FileMode.Create, FileAccess.Write)); - var saveram = Emulator.AsSaveRam().CloneSaveRam(); - - writer.Write(saveram, 0, saveram.Length); - writer.Close(); - } - } - } -} diff --git a/BizHawk.Client.MultiHawk/EmulatorWindow.resx b/BizHawk.Client.MultiHawk/EmulatorWindow.resx deleted file mode 100644 index 29dcb1b3a3..0000000000 --- a/BizHawk.Client.MultiHawk/EmulatorWindow.resx +++ /dev/null @@ -1,120 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - \ No newline at end of file diff --git a/BizHawk.Client.MultiHawk/EmulatorWindowList.cs b/BizHawk.Client.MultiHawk/EmulatorWindowList.cs deleted file mode 100644 index 1da78079a1..0000000000 --- a/BizHawk.Client.MultiHawk/EmulatorWindowList.cs +++ /dev/null @@ -1,66 +0,0 @@ -using System; -using System.Collections.Generic; -using System.IO; -using System.Linq; -using System.Text; -using Newtonsoft.Json; - -namespace BizHawk.Client.MultiHawk -{ - public class EmulatorWindowList : List - { - public string SessionName { get; set; } - - public EmulatorWindow Master - { - get - { - if (this.Any()) - { - return this.First(); - } - - return null; - } - } - - public IEnumerable Session - { - get - { - return this.Select(ew => new RomSessionEntry - { - RomName = ew.CurrentRomPath, - Wndx = ew.Location.X, - Wndy = ew.Location.Y - }); - } - } - - public string SessionJson - { - get - { - return JsonConvert.SerializeObject(Session); - } - } - - public static IEnumerable FromJson(string json) - { - return JsonConvert.DeserializeObject>(json); - } - - public new void Clear() - { - SessionName = ""; - base.Clear(); - } - - public class RomSessionEntry - { - public string RomName { get; set; } - public int Wndx { get; set; } - public int Wndy { get; set; } - } - } -} diff --git a/BizHawk.Client.MultiHawk/Extensions/ToolExtensions.cs b/BizHawk.Client.MultiHawk/Extensions/ToolExtensions.cs deleted file mode 100644 index 5648ebc66f..0000000000 --- a/BizHawk.Client.MultiHawk/Extensions/ToolExtensions.cs +++ /dev/null @@ -1,228 +0,0 @@ -using System; -using System.IO; -using System.Collections.Generic; -using System.Windows.Forms; -using System.Linq; - -using BizHawk.Common; - -using BizHawk.Emulation.Common; -using BizHawk.Client.Common; - -namespace BizHawk.Client.MultiHawk.ToolExtensions -{ - public static class ToolExtensions - { - public static ToolStripItem[] RecentMenu(this RecentFiles recent, Action loadFileCallback, bool autoload = false) - { - var items = new List(); - - if (recent.Empty) - { - var none = new ToolStripMenuItem { Enabled = false, Text = "None" }; - items.Add(none); - } - else - { - foreach (var filename in recent) - { - //TODO - do TSMI and TSDD need disposing? yuck - var temp = filename; - var item = new ToolStripMenuItem { Text = temp }; - items.Add(item); - - item.Click += (o, ev) => - { - loadFileCallback(temp); - }; - - //TODO - use standard methods to split filename (hawkfile acquire?) - var hf = new HawkFile(); - hf.Parse(temp); - bool canExplore = true; - if (!File.Exists(hf.FullPathWithoutMember)) - canExplore = false; - - var tsdd = new ToolStripDropDownMenu(); - - // TODO - if (canExplore) - { - //make a menuitem to show the last modified timestamp - // var timestamp = File.GetLastWriteTime(hf.FullPathWithoutMember); - // var tsmiTimestamp = new ToolStripLabel { Text = timestamp.ToString() }; - - // tsdd.Items.Add(tsmiTimestamp); - // tsdd.Items.Add(new ToolStripSeparator()); - - - - // if (hf.IsArchive) - // { - // //make a menuitem to let you copy the path - // var tsmiCopyCanonicalPath = new ToolStripMenuItem { Text = "&Copy Canonical Path" }; - // tsmiCopyCanonicalPath.Click += (o, ev) => { System.Windows.Forms.Clipboard.SetText(temp); }; - // tsdd.Items.Add(tsmiCopyCanonicalPath); - - // var tsmiCopyArchivePath = new ToolStripMenuItem { Text = "Copy Archive Path" }; - // tsmiCopyArchivePath.Click += (o, ev) => { System.Windows.Forms.Clipboard.SetText(hf.FullPathWithoutMember); }; - // tsdd.Items.Add(tsmiCopyArchivePath); - - // var tsmiOpenArchive = new ToolStripMenuItem { Text = "Open &Archive" }; - // tsmiOpenArchive.Click += (o, ev) => { System.Diagnostics.Process.Start(hf.FullPathWithoutMember); }; - // tsdd.Items.Add(tsmiOpenArchive); - // } - // else - // { - // //make a menuitem to let you copy the path - // var tsmiCopyPath = new ToolStripMenuItem { Text = "&Copy Path" }; - // tsmiCopyPath.Click += (o, ev) => { System.Windows.Forms.Clipboard.SetText(temp); }; - // tsdd.Items.Add(tsmiCopyPath); - // } - - // tsdd.Items.Add(new ToolStripSeparator()); - - // //make a menuitem to let you explore to it - // var tsmiExplore = new ToolStripMenuItem { Text = "&Explore" }; - // string explorePath = "\"" + hf.FullPathWithoutMember + "\""; - // tsmiExplore.Click += (o, ev) => { System.Diagnostics.Process.Start("explorer.exe", "/select, " + explorePath); }; - // tsdd.Items.Add(tsmiExplore); - - // var tsmiCopyFile = new ToolStripMenuItem { Text = "Copy &File" }; - // var lame = new System.Collections.Specialized.StringCollection(); - // lame.Add(hf.FullPathWithoutMember); - // tsmiCopyFile.Click += (o, ev) => { System.Windows.Forms.Clipboard.SetFileDropList(lame); }; - // tsdd.Items.Add(tsmiCopyFile); - - // var tsmiTest = new ToolStripMenuItem { Text = "&Shell Context Menu" }; - // tsmiTest.Click += (o, ev) => { - // var si = new GongSolutions.Shell.ShellItem(hf.FullPathWithoutMember); - // var scm = new GongSolutions.Shell.ShellContextMenu(si); - // var tsddi = o as ToolStripDropDownItem; - // tsddi.Owner.Update(); - // scm.ShowContextMenu(tsddi.Owner, new System.Drawing.Point(0, 0)); - // }; - // tsdd.Items.Add(tsmiTest); - - // tsdd.Items.Add(new ToolStripSeparator()); - //} - //else - //{ - // //make a menuitem to show the last modified timestamp - // var tsmiMissingFile = new ToolStripLabel { Text = "-Missing-" }; - // tsdd.Items.Add(tsmiMissingFile); - // tsdd.Items.Add(new ToolStripSeparator()); - //} - - ////in either case, make a menuitem to let you remove the path - //var tsmiRemovePath = new ToolStripMenuItem { Text = "&Remove" }; - //tsmiRemovePath.Click += (o, ev) => { recent.Remove(temp); }; - - //tsdd.Items.Add(tsmiRemovePath); - - //////experiment of popping open a submenu. doesnt work well. - ////item.MouseDown += (o, mev) => - ////{ - //// if (mev.Button != MouseButtons.Right) return; - //// //location of the menu containing this item that was just rightclicked - //// var pos = item.Owner.Bounds.Location; - //// //the offset within that menu of this item - //// var tsddi = item as ToolStripDropDownItem; - //// pos.Offset(tsddi.Bounds.Location); - //// //the offset of the click - //// pos.Offset(mev.Location); - //// //tsdd.OwnerItem = item; //has interesting promise, but breaks things otherwise - //// tsdd.Show(pos); - ////}; - - ////just add it to the submenu for now - //item.MouseDown += (o, mev) => - //{ - // if (mev.Button != MouseButtons.Right) return; - // if (item.DropDown != null) - // item.DropDown = tsdd; - // item.ShowDropDown(); - }; - } - } - - items.Add(new ToolStripSeparator()); - - var clearitem = new ToolStripMenuItem { Text = "&Clear", Enabled = !recent.Frozen }; - clearitem.Click += (o, ev) => recent.Clear(); - items.Add(clearitem); - - var freezeitem = new ToolStripMenuItem { Text = recent.Frozen ? "&Unfreeze" : "&Freeze" }; - freezeitem.Click += (o, ev) => recent.Frozen ^= true; - items.Add(freezeitem); - - if (autoload) - { - var auto = new ToolStripMenuItem { Text = "&Autoload", Checked = recent.AutoLoad }; - auto.Click += (o, ev) => recent.ToggleAutoLoad(); - items.Add(auto); - } - - // TODO - //var settingsitem = new ToolStripMenuItem { Text = "&Recent Settings..." }; - //settingsitem.Click += (o, ev) => - //{ - // using (var prompt = new InputPrompt - // { - // TextInputType = InputPrompt.InputType.Unsigned, - // Message = "Number of recent files to track", - // InitialValue = recent.MAX_RECENT_FILES.ToString() - // }) - // { - // var result = prompt.ShowDialog(); - // if (result == DialogResult.OK) - // { - // int val = int.Parse(prompt.PromptText); - // if (val > 0) - // recent.MAX_RECENT_FILES = val; - // } - // } - //}; - //items.Add(settingsitem); - - return items.ToArray(); - } - - public static void HandleLoadError(this RecentFiles recent, string path) - { - // TODO - //GlobalWin.Sound.StopSound(); - if (recent.Frozen) - { - var result = MessageBox.Show("Could not open " + path, "File not found", MessageBoxButtons.OK, MessageBoxIcon.Error); - } - else - { - var result = MessageBox.Show("Could not open " + path + "\nRemove from list?", "File not found", MessageBoxButtons.YesNo, MessageBoxIcon.Error); - if (result == DialogResult.Yes) - { - recent.Remove(path); - } - } - - //GlobalWin.Sound.StartSound(); - } - - public static IEnumerable MenuItems(this IMemoryDomains domains, Action setCallback, string selected = "", int? maxSize = null) - { - foreach (var domain in domains) - { - var name = domain.Name; - var item = new ToolStripMenuItem - { - Text = name, - Enabled = !(maxSize.HasValue && domain.Size > maxSize.Value), - Checked = name == selected - }; - item.Click += (o, ev) => setCallback(name); - - yield return item; - } - } - } -} diff --git a/BizHawk.Client.MultiHawk/GlobalWin.cs b/BizHawk.Client.MultiHawk/GlobalWin.cs deleted file mode 100644 index 45794b7700..0000000000 --- a/BizHawk.Client.MultiHawk/GlobalWin.cs +++ /dev/null @@ -1,25 +0,0 @@ -using BizHawk.Client.Common; -using BizHawk.Bizware.BizwareGL; -using SlimDX.DirectSound; - -namespace BizHawk.Client.MultiHawk -{ - public static class GlobalWin - { - public static Mainform MainForm; - //public static ToolManager Tools; - public static IGL GL; - public static Bizware.BizwareGL.Drivers.OpenTK.IGL_TK IGL_GL; - public static BizHawk.Client.EmuHawk.GLManager.ContextRef CR_GL; - //public static Sound Sound; - //public static PresentationPanel PresentationPanel; - //public static OSDManager OSD = new OSDManager(); - //public static DisplayManager DisplayManager; - public static BizHawk.Client.EmuHawk.GLManager GLManager; - - //input state which has been destined for game controller inputs are coalesced here - //public static ControllerInputCoalescer ControllerInputCoalescer = new ControllerInputCoalescer(); - //input state which has been destined for client hotkey consumption are colesced here - public static InputCoalescer HotkeyCoalescer = new InputCoalescer(); - } -} diff --git a/BizHawk.Client.MultiHawk/Input/GamePad.cs b/BizHawk.Client.MultiHawk/Input/GamePad.cs deleted file mode 100644 index 75e03c44a2..0000000000 --- a/BizHawk.Client.MultiHawk/Input/GamePad.cs +++ /dev/null @@ -1,235 +0,0 @@ -using System; -using System.Collections.Generic; -using SlimDX; -using SlimDX.DirectInput; - -namespace BizHawk.Client.MultiHawk -{ - public class GamePad - { - // ********************************** Static interface ********************************** - - static DirectInput dinput; - public static List Devices; - - public static void Initialize(IntPtr parent) - { - if (dinput == null) - dinput = new DirectInput(); - - Devices = new List(); - - foreach (DeviceInstance device in dinput.GetDevices(DeviceClass.GameController, DeviceEnumerationFlags.AttachedOnly)) - { - Console.WriteLine("joydevice: {0} `{1}`", device.InstanceGuid, device.ProductName); - - if (device.ProductName.Contains("XBOX 360")) - continue; // Don't input XBOX 360 controllers into here; we'll process them via XInput (there are limitations in some trigger axes when xbox pads go over xinput) - - var joystick = new Joystick(dinput, device.InstanceGuid); - joystick.SetCooperativeLevel(parent, CooperativeLevel.Background | CooperativeLevel.Nonexclusive); - foreach (DeviceObjectInstance deviceObject in joystick.GetObjects()) - { - if ((deviceObject.ObjectType & ObjectDeviceType.Axis) != 0) - joystick.GetObjectPropertiesById((int)deviceObject.ObjectType).SetRange(-1000, 1000); - } - joystick.Acquire(); - - GamePad p = new GamePad(device.InstanceName, device.InstanceGuid, joystick); - Devices.Add(p); - } - } - - public static void UpdateAll() - { - foreach (var device in Devices) - device.Update(); - } - - public static void CloseAll() - { - if (Devices != null) - { - foreach (var device in Devices) - device.joystick.Dispose(); - Devices.Clear(); - } - } - - // ********************************** Instance Members ********************************** - - readonly string name; - readonly Guid guid; - readonly Joystick joystick; - JoystickState state = new JoystickState(); - - GamePad(string name, Guid guid, Joystick joystick) - { - this.name = name; - this.guid = guid; - this.joystick = joystick; - Update(); - InitializeCallbacks(); - } - - public void Update() - { - try - { - if (joystick.Acquire().IsFailure) - return; - } - catch - { - return; - } - if (joystick.Poll().IsFailure) - return; - - state = joystick.GetCurrentState(); - if (Result.Last.IsFailure) - // do something? - return; - } - - public IEnumerable> GetFloats() - { - var pis = typeof(JoystickState).GetProperties(); - foreach (var pi in pis) - yield return new Tuple(pi.Name, 10.0f * (float)(int)pi.GetValue(state, null)); - } - - /// FOR DEBUGGING ONLY - public JoystickState GetInternalState() - { - return state; - } - - public string Name { get { return name; } } - public Guid Guid { get { return guid; } } - - - public string ButtonName(int index) - { - return names[index]; - } - public bool Pressed(int index) - { - return actions[index](); - } - public int NumButtons { get; private set; } - - private readonly List names = new List(); - private readonly List> actions = new List>(); - - void AddItem(string _name, Func callback) - { - names.Add(_name); - actions.Add(callback); - NumButtons++; - } - - void InitializeCallbacks() - { - const int dzp = 400; - const int dzn = -400; - - names.Clear(); - actions.Clear(); - NumButtons = 0; - - AddItem("AccelerationX+", () => state.AccelerationX >= dzp); - AddItem("AccelerationX-", () => state.AccelerationX <= dzn); - AddItem("AccelerationY+", () => state.AccelerationY >= dzp); - AddItem("AccelerationY-", () => state.AccelerationY <= dzn); - AddItem("AccelerationZ+", () => state.AccelerationZ >= dzp); - AddItem("AccelerationZ-", () => state.AccelerationZ <= dzn); - AddItem("AngularAccelerationX+", () => state.AngularAccelerationX >= dzp); - AddItem("AngularAccelerationX-", () => state.AngularAccelerationX <= dzn); - AddItem("AngularAccelerationY+", () => state.AngularAccelerationY >= dzp); - AddItem("AngularAccelerationY-", () => state.AngularAccelerationY <= dzn); - AddItem("AngularAccelerationZ+", () => state.AngularAccelerationZ >= dzp); - AddItem("AngularAccelerationZ-", () => state.AngularAccelerationZ <= dzn); - AddItem("AngularVelocityX+", () => state.AngularVelocityX >= dzp); - AddItem("AngularVelocityX-", () => state.AngularVelocityX <= dzn); - AddItem("AngularVelocityY+", () => state.AngularVelocityY >= dzp); - AddItem("AngularVelocityY-", () => state.AngularVelocityY <= dzn); - AddItem("AngularVelocityZ+", () => state.AngularVelocityZ >= dzp); - AddItem("AngularVelocityZ-", () => state.AngularVelocityZ <= dzn); - AddItem("ForceX+", () => state.ForceX >= dzp); - AddItem("ForceX-", () => state.ForceX <= dzn); - AddItem("ForceY+", () => state.ForceY >= dzp); - AddItem("ForceY-", () => state.ForceY <= dzn); - AddItem("ForceZ+", () => state.ForceZ >= dzp); - AddItem("ForceZ-", () => state.ForceZ <= dzn); - AddItem("RotationX+", () => state.RotationX >= dzp); - AddItem("RotationX-", () => state.RotationX <= dzn); - AddItem("RotationY+", () => state.RotationY >= dzp); - AddItem("RotationY-", () => state.RotationY <= dzn); - AddItem("RotationZ+", () => state.RotationZ >= dzp); - AddItem("RotationZ-", () => state.RotationZ <= dzn); - AddItem("TorqueX+", () => state.TorqueX >= dzp); - AddItem("TorqueX-", () => state.TorqueX <= dzn); - AddItem("TorqueY+", () => state.TorqueY >= dzp); - AddItem("TorqueY-", () => state.TorqueY <= dzn); - AddItem("TorqueZ+", () => state.TorqueZ >= dzp); - AddItem("TorqueZ-", () => state.TorqueZ <= dzn); - AddItem("VelocityX+", () => state.VelocityX >= dzp); - AddItem("VelocityX-", () => state.VelocityX <= dzn); - AddItem("VelocityY+", () => state.VelocityY >= dzp); - AddItem("VelocityY-", () => state.VelocityY <= dzn); - AddItem("VelocityZ+", () => state.VelocityZ >= dzp); - AddItem("VelocityZ-", () => state.VelocityZ <= dzn); - AddItem("X+", () => state.X >= dzp); - AddItem("X-", () => state.X <= dzn); - AddItem("Y+", () => state.Y >= dzp); - AddItem("Y-", () => state.Y <= dzn); - AddItem("Z+", () => state.Z >= dzp); - AddItem("Z-", () => state.Z <= dzn); - - // i don't know what the "Slider"s do, so they're omitted for the moment - - for (int i = 0; i < state.GetButtons().Length; i++) - { - int j = i; - AddItem($"B{i + 1}", () => state.IsPressed(j)); - } - - for (int i = 0; i < state.GetPointOfViewControllers().Length; i++) - { - int j = i; - AddItem($"POV{i + 1}U", - () => { int t = state.GetPointOfViewControllers()[j]; return (t >= 0 && t <= 4500) || (t >= 31500 && t < 36000); }); - AddItem($"POV{i + 1}D", - () => { int t = state.GetPointOfViewControllers()[j]; return t >= 13500 && t <= 22500; }); - AddItem($"POV{i + 1}L", - () => { int t = state.GetPointOfViewControllers()[j]; return t >= 22500 && t <= 31500; }); - AddItem($"POV{i + 1}R", - () => { int t = state.GetPointOfViewControllers()[j]; return t >= 4500 && t <= 13500; }); - } - } - - // Note that this does not appear to work at this time. I probably need to have more infos. - public void SetVibration(int left, int right) - { - int[] temp1, temp2; - // my first clue that it doesnt work is that LEFT and RIGHT _ARENT USED_ - // I should just look for C++ examples instead of trying to look for SlimDX examples - - var parameters = new EffectParameters - { - Duration = 0x2710, - Gain = 0x2710, - SamplePeriod = 0, - TriggerButton = 0, - TriggerRepeatInterval = 0x2710, - Flags = EffectFlags.None - }; - parameters.GetAxes(out temp1, out temp2); - parameters.SetAxes(temp1, temp2); - var effect = new Effect(joystick, EffectGuid.ConstantForce); - effect.SetParameters(parameters); - effect.Start(1); - } - } -} \ No newline at end of file diff --git a/BizHawk.Client.MultiHawk/Input/Input.cs b/BizHawk.Client.MultiHawk/Input/Input.cs deleted file mode 100644 index 9c3abc76f0..0000000000 --- a/BizHawk.Client.MultiHawk/Input/Input.cs +++ /dev/null @@ -1,511 +0,0 @@ -using System; -using System.Linq; -using System.Collections.Generic; -using System.Threading; -#if WINDOWS -using SlimDX.DirectInput; -#endif - -using BizHawk.Common; -using BizHawk.Client.Common; - -namespace BizHawk.Client.MultiHawk -{ - //coalesces events back into instantaneous states - public class InputCoalescer : SimpleController - { - public void Receive(Input.InputEvent ie) - { - bool state = ie.EventType == Input.InputEventType.Press; - - string button = ie.LogicalButton.ToString(); - Buttons[button] = state; - - //when a button is released, all modified variants of it are released as well - if (!state) - { - var releases = Buttons.Where(kvp => kvp.Key.Contains("+") && kvp.Key.EndsWith(ie.LogicalButton.Button)).ToArray(); - foreach (var kvp in releases) - Buttons[kvp.Key] = false; - } - } - } - - public class ControllerInputCoalescer : SimpleController - { - public void Receive(Input.InputEvent ie) - { - bool state = ie.EventType == Input.InputEventType.Press; - - string button = ie.LogicalButton.ToString(); - Buttons[button] = state; - - //For controller input, we want Shift+X to register as both Shift and X (for Keyboard controllers) - string[] subgroups = button.Split('+'); - if (subgroups.Length > 0) - { - foreach (string s in subgroups) - { - Buttons[s] = state; - } - } - - //when a button is released, all modified variants of it are released as well - if (!state) - { - var releases = Buttons.Where((kvp) => kvp.Key.Contains("+") && kvp.Key.EndsWith(ie.LogicalButton.Button)).ToArray(); - foreach (var kvp in releases) - Buttons[kvp.Key] = false; - } - } - } - - public class Input - { - [Flags] - public enum InputFocus - { - None = 0, - Mouse = 1, - Keyboard = 2, - Pad = 4 - } - - /// - /// If your form needs this kind of input focus, be sure to say so. - /// Really, this only makes sense for mouse, but I've started building it out for other things - /// Why is this receiving a control, but actually using it as a Form (where the WantingMouseFocus is checked?) - /// Because later we might change it to work off the control, specifically, if a control is supplied (normally actually a Form will be supplied) - /// - public void ControlInputFocus(System.Windows.Forms.Control c, InputFocus types, bool wants) - { - if (types.HasFlag(InputFocus.Mouse) && wants) WantingMouseFocus.Add(c); - if (types.HasFlag(InputFocus.Mouse) && !wants) WantingMouseFocus.Remove(c); - } - - HashSet WantingMouseFocus = new HashSet(); - - [Flags] - public enum ModifierKey - { - // Summary: - // The bitmask to extract modifiers from a key value. - Modifiers = -65536, - // - // Summary: - // No key pressed. - None = 0, - // - // Summary: - // The SHIFT modifier key. - Shift = 65536, - // - // Summary: - // The CTRL modifier key. - Control = 131072, - // - // Summary: - // The ALT modifier key. - Alt = 262144, - } - - public static Input Instance { get; private set; } - readonly Thread UpdateThread; - - private Input() - { -#if WINDOWS - UpdateThread = new Thread(UpdateThreadProc) - { - IsBackground = true, - Priority = ThreadPriority.AboveNormal //why not? this thread shouldn't be very heavy duty, and we want it to be responsive - }; - UpdateThread.Start(); -#endif - } - - public static void Initialize(IntPtr parent) - { -#if WINDOWS - KeyInput.Initialize(parent); - GamePad.Initialize(parent); - BizHawk.Client.EmuHawk.GamePad360.Initialize(); -#endif - Instance = new Input(); - } - - public enum InputEventType - { - Press, Release - } - public struct LogicalButton - { - public LogicalButton(string button, ModifierKey modifiers) - { - Button = button; - Modifiers = modifiers; - } - public readonly string Button; - public readonly ModifierKey Modifiers; - - public bool Alt { get { return ((Modifiers & ModifierKey.Alt) != 0); } } - public bool Control { get { return ((Modifiers & ModifierKey.Control) != 0); } } - public bool Shift { get { return ((Modifiers & ModifierKey.Shift) != 0); } } - - public override string ToString() - { - string ret = ""; - if (Control) ret += "Ctrl+"; - if (Alt) ret += "Alt+"; - if (Shift) ret += "Shift+"; - ret += Button; - return ret; - } - public override bool Equals(object obj) - { - var other = (LogicalButton)obj; - return other == this; - } - public override int GetHashCode() - { - return Button.GetHashCode() ^ Modifiers.GetHashCode(); - } - public static bool operator ==(LogicalButton lhs, LogicalButton rhs) - { - return lhs.Button == rhs.Button && lhs.Modifiers == rhs.Modifiers; - } - public static bool operator !=(LogicalButton lhs, LogicalButton rhs) - { - return !(lhs == rhs); - } - } - public class InputEvent - { - public LogicalButton LogicalButton; - public InputEventType EventType; - public override string ToString() => $"{EventType.ToString()}:{LogicalButton.ToString()}"; - } - - private readonly WorkingDictionary ModifierState = new WorkingDictionary(); - private readonly WorkingDictionary LastState = new WorkingDictionary(); - private readonly WorkingDictionary UnpressState = new WorkingDictionary(); - private readonly HashSet IgnoreKeys = new HashSet(new[] { "LeftShift", "RightShift", "LeftControl", "RightControl", "LeftAlt", "RightAlt" }); - private readonly WorkingDictionary FloatValues = new WorkingDictionary(); - private readonly WorkingDictionary FloatDeltas = new WorkingDictionary(); - private bool trackdeltas = false; - - void HandleButton(string button, bool newState) - { - bool isModifier = IgnoreKeys.Contains(button); - if (EnableIgnoreModifiers && isModifier) return; - if (LastState[button] && newState) return; - if (!LastState[button] && !newState) return; - - //apply - //NOTE: this is not quite right. if someone held leftshift+rightshift it would be broken. seems unlikely, though. - if (button == "LeftShift") - { - _Modifiers &= ~ModifierKey.Shift; - if (newState) - _Modifiers |= ModifierKey.Shift; - } - if (button == "RightShift") { _Modifiers &= ~ModifierKey.Shift; if (newState) _Modifiers |= ModifierKey.Shift; } - if (button == "LeftControl") { _Modifiers &= ~ModifierKey.Control; if (newState) _Modifiers |= ModifierKey.Control; } - if (button == "RightControl") { _Modifiers &= ~ModifierKey.Control; if (newState) _Modifiers |= ModifierKey.Control; } - if (button == "LeftAlt") { _Modifiers &= ~ModifierKey.Alt; if (newState) _Modifiers |= ModifierKey.Alt; } - if (button == "RightAlt") { _Modifiers &= ~ModifierKey.Alt; if (newState) _Modifiers |= ModifierKey.Alt; } - - if (UnpressState.ContainsKey(button)) - { - if (newState) return; - Console.WriteLine($"Removing Unpress {button} with {nameof(newState)} {newState}"); - UnpressState.Remove(button); - LastState[button] = false; - return; - } - - - //dont generate events for things like Ctrl+LeftControl - ModifierKey mods = _Modifiers; - if (button == "LeftShift") mods &= ~ModifierKey.Shift; - if (button == "RightShift") mods &= ~ModifierKey.Shift; - if (button == "LeftControl") mods &= ~ModifierKey.Control; - if (button == "RightControl") mods &= ~ModifierKey.Control; - if (button == "LeftAlt") mods &= ~ModifierKey.Alt; - if (button == "RightAlt") mods &= ~ModifierKey.Alt; - - var ie = new InputEvent - { - EventType = newState ? InputEventType.Press : InputEventType.Release, - LogicalButton = new LogicalButton(button, mods) - }; - LastState[button] = newState; - - //track the pressed events with modifiers that we send so that we can send corresponding unpresses with modifiers - //this is an interesting idea, which we may need later, but not yet. - //for example, you may see this series of events: press:ctrl+c, release:ctrl, release:c - //but you might would rather have press:ctr+c, release:ctrl+c - //this code relates the releases to the original presses. - //UPDATE - this is necessary for the frame advance key, which has a special meaning when it gets stuck down - //so, i am adding it as of 11-sep-2011 - if (newState) - { - ModifierState[button] = ie.LogicalButton; - } - else - { - if (ModifierState[button] != null) - { - LogicalButton alreadyReleased = ie.LogicalButton; - var ieModified = new InputEvent - { - LogicalButton = (LogicalButton)ModifierState[button], - EventType = InputEventType.Release - }; - if (ieModified.LogicalButton != alreadyReleased) - _NewEvents.Add(ieModified); - } - ModifierState[button] = null; - } - - _NewEvents.Add(ie); - } - - ModifierKey _Modifiers; - private readonly List _NewEvents = new List(); - - //do we need this? - public void ClearEvents() - { - lock (this) - { - InputEvents.Clear(); - } - } - - private readonly Queue InputEvents = new Queue(); - public InputEvent DequeueEvent() - { - lock (this) - { - if (InputEvents.Count == 0) return null; - else return InputEvents.Dequeue(); - } - } - void EnqueueEvent(InputEvent ie) - { - lock (this) - { - InputEvents.Enqueue(ie); - } - } - - public List> GetFloats() - { - List> FloatValuesCopy = new List>(); - lock (FloatValues) - { - foreach (var kvp in FloatValues) - FloatValuesCopy.Add(new Tuple(kvp.Key, kvp.Value)); - } - return FloatValuesCopy; - } - -#if WINDOWS - void UpdateThreadProc() - { - for (; ; ) - { - var keyEvents = KeyInput.Update(); - GamePad.UpdateAll(); - BizHawk.Client.EmuHawk.GamePad360.UpdateAll(); - - //this block is going to massively modify data structures that the binding method uses, so we have to lock it all - lock (this) - { - _NewEvents.Clear(); - - //analyze keys - foreach (var ke in keyEvents) - HandleButton(ke.Key.ToString(), ke.Pressed); - - lock (FloatValues) - { - //FloatValues.Clear(); - - //analyze xinput - foreach (var pad in BizHawk.Client.EmuHawk.GamePad360.EnumerateDevices()) - { - string xname = "X" + pad.PlayerNumber + " "; - for (int b = 0; b < pad.NumButtons; b++) - HandleButton(xname + pad.ButtonName(b), pad.Pressed(b)); - foreach (var sv in pad.GetFloats()) - { - string n = xname + sv.Item1; - float f = sv.Item2; - if (trackdeltas) - FloatDeltas[n] += Math.Abs(f - FloatValues[n]); - FloatValues[n] = f; - } - } - - //analyze joysticks - for (int i = 0; i < GamePad.Devices.Count; i++) - { - var pad = GamePad.Devices[i]; - string jname = "J" + (i + 1) + " "; - - for (int b = 0; b < pad.NumButtons; b++) - HandleButton(jname + pad.ButtonName(b), pad.Pressed(b)); - foreach (var sv in pad.GetFloats()) - { - string n = jname + sv.Item1; - float f = sv.Item2; - //if (n == "J5 RotationZ") - // System.Diagnostics.Debugger.Break(); - if (trackdeltas) - FloatDeltas[n] += Math.Abs(f - FloatValues[n]); - FloatValues[n] = f; - } - } - - // analyse moose - // other sorts of mouse api (raw input) could easily be added as a separate listing under a different class - if (WantingMouseFocus.Contains(System.Windows.Forms.Form.ActiveForm)) - { - var P = System.Windows.Forms.Control.MousePosition; - if (trackdeltas) - { - // these are relative to screen coordinates, but that's not terribly important - FloatDeltas["WMouse X"] += Math.Abs(P.X - FloatValues["WMouse X"]) * 50; - FloatDeltas["WMouse Y"] += Math.Abs(P.Y - FloatValues["WMouse Y"]) * 50; - } - // coordinate translation happens later - FloatValues["WMouse X"] = P.X; - FloatValues["WMouse Y"] = P.Y; - - var B = System.Windows.Forms.Control.MouseButtons; - HandleButton("WMouse L", (B & System.Windows.Forms.MouseButtons.Left) != 0); - HandleButton("WMouse C", (B & System.Windows.Forms.MouseButtons.Middle) != 0); - HandleButton("WMouse R", (B & System.Windows.Forms.MouseButtons.Right) != 0); - HandleButton("WMouse 1", (B & System.Windows.Forms.MouseButtons.XButton1) != 0); - HandleButton("WMouse 2", (B & System.Windows.Forms.MouseButtons.XButton2) != 0); - } - else - { - //dont do this: for now, it will interfere with the virtualpad. dont do something similar for the mouse position either - //unpress all buttons - //HandleButton("WMouse L", false); - //HandleButton("WMouse C", false); - //HandleButton("WMouse R", false); - //HandleButton("WMouse 1", false); - //HandleButton("WMouse 2", false); - } - - } - - bool swallow = !GlobalWin.MainForm.AllowInput; - - foreach (var ie in _NewEvents) - { - //events are swallowed in some cases: - if (ie.EventType == InputEventType.Press && swallow) - { } - else - EnqueueEvent(ie); - } - } //lock(this) - - //arbitrary selection of polling frequency: - Thread.Sleep(10); - } - } -#endif - - public void StartListeningForFloatEvents() - { - lock (FloatValues) - { - FloatDeltas.Clear(); - trackdeltas = true; - } - } - - public string GetNextFloatEvent() - { - lock (FloatValues) - { - foreach (var kvp in FloatDeltas) - { - // need to wiggle the stick a bit - if (kvp.Value >= 20000.0f) - return kvp.Key; - } - } - return null; - } - - public void StopListeningForFloatEvents() - { - lock (FloatValues) - { - trackdeltas = false; - } - } - - public void Update() - { - //TODO - for some reason, we may want to control when the next event processing step happens - //so i will leave this method here for now.. - } - - //returns the next Press event, if available. should be useful - public string GetNextBindEvent() - { - //this whole process is intimately involved with the data structures, which can conflict with the input thread. - lock (this) - { - if (InputEvents.Count == 0) return null; - if (!GlobalWin.MainForm.AllowInput) return null; - - //we only listen to releases for input binding, because we need to distinguish releases of pure modifierkeys from modified keys - //if you just pressed ctrl, wanting to bind ctrl, we'd see: pressed:ctrl, unpressed:ctrl - //if you just pressed ctrl+c, wanting to bind ctrl+c, we'd see: pressed:ctrl, pressed:ctrl+c, unpressed:ctrl+c, unpressed:ctrl - //so its the first unpress we need to listen for - - while (InputEvents.Count != 0) - { - var ie = DequeueEvent(); - - //as a special perk, we'll accept escape immediately - if (ie.EventType == InputEventType.Press && ie.LogicalButton.Button == "Escape") - goto ACCEPT; - - if (ie.EventType == InputEventType.Press) continue; - - ACCEPT: - Console.WriteLine("Bind Event: {0} ", ie); - - foreach (var kvp in LastState) - if (kvp.Value) - { - Console.WriteLine("Unpressing " + kvp.Key); - UnpressState[kvp.Key] = true; - } - - InputEvents.Clear(); - - return ie.LogicalButton.ToString(); - } - - return null; - } - } - - //controls whether modifier keys will be ignored as key press events - //this should be used by hotkey binders, but we may want modifier key events - //to get triggered in the main form - public bool EnableIgnoreModifiers = false; - - } -} diff --git a/BizHawk.Client.MultiHawk/Input/Keyboard.cs b/BizHawk.Client.MultiHawk/Input/Keyboard.cs deleted file mode 100644 index 33f5ba938a..0000000000 --- a/BizHawk.Client.MultiHawk/Input/Keyboard.cs +++ /dev/null @@ -1,132 +0,0 @@ -using System.Collections.Generic; -using SlimDX; -using SlimDX.DirectInput; -using System; - -namespace BizHawk.Client.MultiHawk -{ - public static class KeyInput - { - private static DirectInput dinput; - private static Keyboard keyboard; - private static KeyboardState state = new KeyboardState(); - - public static void Initialize(IntPtr parent) - { - if (dinput == null) - dinput = new DirectInput(); - - if (keyboard == null || keyboard.Disposed) - keyboard = new Keyboard(dinput); - keyboard.SetCooperativeLevel(parent, CooperativeLevel.Background | CooperativeLevel.Nonexclusive); - keyboard.Properties.BufferSize = 8; - } - - static List EmptyList = new List(); - static List EventList = new List(); - - public static IEnumerable Update() - { - EventList.Clear(); - - if (keyboard.Acquire().IsFailure) - return EmptyList; - if (keyboard.Poll().IsFailure) - return EmptyList; - - for (; ; ) - { - var events = keyboard.GetBufferedData(); - if (Result.Last.IsFailure) - return EventList; - if (events.Count == 0) - break; - foreach (var e in events) - { - foreach (var k in e.PressedKeys) - EventList.Add(new KeyEvent { Key = k, Pressed = true }); - foreach (var k in e.ReleasedKeys) - EventList.Add(new KeyEvent { Key = k, Pressed = false }); - } - } - - return EventList; - } - - public struct KeyEvent - { - public Key Key; - public bool Pressed; - } - - - public static bool IsPressed(Key key) - { - if (state.IsPressed(key)) - return true; - - if (key == Key.LeftShift && state.IsPressed(Key.RightShift)) - return true; - if (key == Key.LeftControl && state.IsPressed(Key.RightControl)) - return true; - if (key == Key.LeftAlt && state.IsPressed(Key.RightAlt)) - return true; - - return false; - } - - public static bool ShiftModifier - { - get - { - if (state.IsPressed(Key.LeftShift)) return true; - if (state.IsPressed(Key.RightShift)) return true; - return false; - } - } - - public static bool CtrlModifier - { - get - { - if (state.IsPressed(Key.LeftControl)) return true; - if (state.IsPressed(Key.RightControl)) return true; - return false; - } - } - - public static bool AltModifier - { - get - { - if (state.IsPressed(Key.LeftAlt)) return true; - if (state.IsPressed(Key.RightAlt)) return true; - return false; - } - } - - public static Input.ModifierKey GetModifierKeysAsKeys() - { - Input.ModifierKey ret = Input.ModifierKey.None; - if (ShiftModifier) ret |= Input.ModifierKey.Shift; - if (CtrlModifier) ret |= Input.ModifierKey.Control; - if (AltModifier) ret |= Input.ModifierKey.Alt; - return ret; - } - - } - - internal static class KeyExtensions - { - public static bool IsModifier(this Key key) - { - if (key == Key.LeftShift) return true; - if (key == Key.RightShift) return true; - if (key == Key.LeftControl) return true; - if (key == Key.RightControl) return true; - if (key == Key.LeftAlt) return true; - if (key == Key.RightAlt) return true; - return false; - } - } -} diff --git a/BizHawk.Client.MultiHawk/InputManager.cs b/BizHawk.Client.MultiHawk/InputManager.cs deleted file mode 100644 index a1e7470727..0000000000 --- a/BizHawk.Client.MultiHawk/InputManager.cs +++ /dev/null @@ -1,121 +0,0 @@ -using System.Collections.Generic; -using System.Linq; - -using BizHawk.Emulation.Common; -using BizHawk.Client.Common.InputAdapterExtensions; - -using BizHawk.Client.Common; - -namespace BizHawk.Client.MultiHawk -{ - public class InputManager - { - Mainform _mainForm; - - public InputManager(Mainform mainForm) - { - _mainForm = mainForm; - } - - public void RewireInputChain() - { - Global.ControllerInputCoalescer.Clear(); - Global.ControllerInputCoalescer.Definition = Global.ActiveController.Definition; - - // TODO? - //Global.UD_LR_ControllerAdapter.Source = Global.ActiveController.Or(Global.AutoFireController); - Global.UD_LR_ControllerAdapter.Source = Global.ActiveController; - - Global.StickyXORAdapter.Source = Global.UD_LR_ControllerAdapter; - - // TODO? - //Global.AutofireStickyXORAdapter.Source = Global.StickyXORAdapter; - - //Global.MultitrackRewiringAdapter.Source = Global.AutofireStickyXORAdapter; - - Global.MultitrackRewiringAdapter.Source = Global.StickyXORAdapter; - Global.MovieInputSourceAdapter.Source = Global.MultitrackRewiringAdapter; - Global.ControllerOutput.Source = Global.MovieOutputHardpoint; - - Global.MovieSession.MovieControllerAdapter.Definition = Global.MovieInputSourceAdapter.Definition; - - // connect the movie session before MovieOutputHardpoint if it is doing anything - // otherwise connect the MovieInputSourceAdapter to it, effectively bypassing the movie session - if (Global.MovieSession != null) - { - Global.MovieOutputHardpoint.Source = Global.MovieSession.MovieControllerAdapter; - } - else - { - Global.MovieOutputHardpoint.Source = Global.MovieInputSourceAdapter; - } - } - - public void SyncControls() - { - var def = _mainForm.EmulatorWindows.First().Emulator.ControllerDefinition; - - Global.ActiveController = BindToDefinition(def, Global.Config.AllTrollers, Global.Config.AllTrollersAnalog); - // TODO? - //Global.AutoFireController = BindToDefinitionAF(def, Global.Config.AllTrollersAutoFire); - - // allow propogating controls that are in the current controller definition but not in the prebaked one - // these two lines shouldn't be required anymore under the new system? - Global.ActiveController.ForceType(new ControllerDefinition(def)); - Global.ClickyVirtualPadController.Definition = new ControllerDefinition(def); - RewireInputChain(); - } - - private Controller BindToDefinition(ControllerDefinition def, IDictionary> allbinds, IDictionary> analogbinds) - { - var ret = new Controller(def); - Dictionary binds; - if (allbinds.TryGetValue(def.Name, out binds)) - { - foreach (var cbutton in def.BoolButtons) - { - string bind; - if (binds.TryGetValue(cbutton, out bind)) - { - ret.BindMulti(cbutton, bind); - } - } - } - - Dictionary abinds; - if (analogbinds.TryGetValue(def.Name, out abinds)) - { - foreach (var cbutton in def.FloatControls) - { - Config.AnalogBind bind; - if (abinds.TryGetValue(cbutton, out bind)) - { - ret.BindFloat(cbutton, bind); - } - } - } - - return ret; - } - - // TODO? - //private AutofireController BindToDefinitionAF(ControllerDefinition def, IDictionary> allbinds) - //{ - // var ret = new AutofireController(def); - // Dictionary binds; - // if (allbinds.TryGetValue(def.Name, out binds)) - // { - // foreach (var cbutton in def.BoolButtons) - // { - // string bind; - // if (binds.TryGetValue(cbutton, out bind)) - // { - // ret.BindMulti(cbutton, bind); - // } - // } - // } - - // return ret; - //} - } -} \ No newline at end of file diff --git a/BizHawk.Client.MultiHawk/Mainform.Designer.cs b/BizHawk.Client.MultiHawk/Mainform.Designer.cs deleted file mode 100644 index 51157dee4f..0000000000 --- a/BizHawk.Client.MultiHawk/Mainform.Designer.cs +++ /dev/null @@ -1,548 +0,0 @@ -namespace BizHawk.Client.MultiHawk -{ - partial class Mainform - { - /// - /// Required designer variable. - /// - private System.ComponentModel.IContainer components = null; - - /// - /// Clean up any resources being used. - /// - /// true if managed resources should be disposed; otherwise, false. - protected override void Dispose(bool disposing) - { - if (disposing && (components != null)) - { - components.Dispose(); - } - base.Dispose(disposing); - } - - #region Windows Form Designer generated code - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - private void InitializeComponent() - { - this.components = new System.ComponentModel.Container(); - this.MainformMenu = new MenuStripEx(); - this.FileSubMenu = new System.Windows.Forms.ToolStripMenuItem(); - this.NewSessionMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.OpenSessionMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.SaveSessionMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.SaveSessionAsMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.RecentSessionSubMenu = new System.Windows.Forms.ToolStripMenuItem(); - this.toolStripSeparator6 = new System.Windows.Forms.ToolStripSeparator(); - this.toolStripSeparator7 = new System.Windows.Forms.ToolStripSeparator(); - this.OpenRomMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.RecentRomSubMenu = new System.Windows.Forms.ToolStripMenuItem(); - this.toolStripSeparator1 = new System.Windows.Forms.ToolStripSeparator(); - this.toolStripSeparator5 = new System.Windows.Forms.ToolStripSeparator(); - this.RebootCoresMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.toolStripSeparator3 = new System.Windows.Forms.ToolStripSeparator(); - this.ExitMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.ViewSubMenu = new System.Windows.Forms.ToolStripMenuItem(); - this._1xMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this._2xMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this._3xMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this._4xMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.MovieSubMenu = new System.Windows.Forms.ToolStripMenuItem(); - this.RecordMovieMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.PlayMovieMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.StopMovieMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.RestartMovieMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.RecentMovieSubMenu = new System.Windows.Forms.ToolStripMenuItem(); - this.toolStripSeparator8 = new System.Windows.Forms.ToolStripSeparator(); - this.toolStripSeparator2 = new System.Windows.Forms.ToolStripSeparator(); - this.ToggleReadonlyMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.configToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.controllerConfigToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.hotkeyConfigToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.toolStripSeparator4 = new System.Windows.Forms.ToolStripSeparator(); - this.saveConfigToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.WorkspacePanel = new System.Windows.Forms.Panel(); - this.MainStatusBar = new System.Windows.Forms.StatusStrip(); - this.toolStripStatusLabel1 = new System.Windows.Forms.ToolStripStatusLabel(); - this.FameStatusBarLabel = new System.Windows.Forms.ToolStripStatusLabel(); - this.PlayRecordStatusButton = new System.Windows.Forms.ToolStripDropDownButton(); - this.StatusBarMessageLabel = new System.Windows.Forms.ToolStripStatusLabel(); - this.contextMenuStrip1 = new System.Windows.Forms.ContextMenuStrip(this.components); - this.RecordMovieContextMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.PlayMovieContextMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.LoadLastMovieContextMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.StopMovieContextMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.RestartMovieContextMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.MainformMenu.SuspendLayout(); - this.WorkspacePanel.SuspendLayout(); - this.MainStatusBar.SuspendLayout(); - this.contextMenuStrip1.SuspendLayout(); - this.SuspendLayout(); - // - // MainformMenu - // - this.MainformMenu.ClickThrough = true; - this.MainformMenu.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { - this.FileSubMenu, - this.ViewSubMenu, - this.MovieSubMenu, - this.configToolStripMenuItem}); - this.MainformMenu.Location = new System.Drawing.Point(0, 0); - this.MainformMenu.Name = "MainformMenu"; - this.MainformMenu.Size = new System.Drawing.Size(655, 24); - this.MainformMenu.TabIndex = 0; - this.MainformMenu.Text = "menuStrip1"; - // - // FileSubMenu - // - this.FileSubMenu.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { - this.NewSessionMenuItem, - this.OpenSessionMenuItem, - this.SaveSessionMenuItem, - this.SaveSessionAsMenuItem, - this.RecentSessionSubMenu, - this.toolStripSeparator7, - this.OpenRomMenuItem, - this.RecentRomSubMenu, - this.toolStripSeparator5, - this.RebootCoresMenuItem, - this.toolStripSeparator3, - this.ExitMenuItem}); - this.FileSubMenu.Name = "FileSubMenu"; - this.FileSubMenu.Size = new System.Drawing.Size(37, 20); - this.FileSubMenu.Text = "&File"; - this.FileSubMenu.DropDownOpened += new System.EventHandler(this.FileSubMenu_DropDownOpened); - // - // NewSessionMenuItem - // - this.NewSessionMenuItem.Name = "NewSessionMenuItem"; - this.NewSessionMenuItem.Size = new System.Drawing.Size(165, 22); - this.NewSessionMenuItem.Text = "&New Session"; - this.NewSessionMenuItem.Click += new System.EventHandler(this.NewSessionMenuItem_Click); - // - // OpenSessionMenuItem - // - this.OpenSessionMenuItem.Name = "OpenSessionMenuItem"; - this.OpenSessionMenuItem.Size = new System.Drawing.Size(165, 22); - this.OpenSessionMenuItem.Text = "&Open Session"; - this.OpenSessionMenuItem.Click += new System.EventHandler(this.OpenSessionMenuItem_Click); - // - // SaveSessionMenuItem - // - this.SaveSessionMenuItem.Name = "SaveSessionMenuItem"; - this.SaveSessionMenuItem.Size = new System.Drawing.Size(165, 22); - this.SaveSessionMenuItem.Text = "&Save Session"; - this.SaveSessionMenuItem.Click += new System.EventHandler(this.SaveSessionMenuItem_Click); - // - // SaveSessionAsMenuItem - // - this.SaveSessionAsMenuItem.Name = "SaveSessionAsMenuItem"; - this.SaveSessionAsMenuItem.Size = new System.Drawing.Size(165, 22); - this.SaveSessionAsMenuItem.Text = "Save Session &As..."; - this.SaveSessionAsMenuItem.Click += new System.EventHandler(this.SaveSessionAsMenuItem_Click); - // - // RecentSessionSubMenu - // - this.RecentSessionSubMenu.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { - this.toolStripSeparator6}); - this.RecentSessionSubMenu.Name = "RecentSessionSubMenu"; - this.RecentSessionSubMenu.Size = new System.Drawing.Size(165, 22); - this.RecentSessionSubMenu.Text = "Recent Session"; - this.RecentSessionSubMenu.DropDownOpened += new System.EventHandler(this.RecentSessionSubMenu_DropDownOpened); - // - // toolStripSeparator6 - // - this.toolStripSeparator6.Name = "toolStripSeparator6"; - this.toolStripSeparator6.Size = new System.Drawing.Size(57, 6); - // - // toolStripSeparator7 - // - this.toolStripSeparator7.Name = "toolStripSeparator7"; - this.toolStripSeparator7.Size = new System.Drawing.Size(162, 6); - // - // OpenRomMenuItem - // - this.OpenRomMenuItem.Image = global::BizHawk.Client.MultiHawk.Properties.Resources.OpenFile; - this.OpenRomMenuItem.Name = "OpenRomMenuItem"; - this.OpenRomMenuItem.Size = new System.Drawing.Size(165, 22); - this.OpenRomMenuItem.Text = "Open ROM"; - this.OpenRomMenuItem.Click += new System.EventHandler(this.OpenRomMenuItem_Click); - // - // RecentRomSubMenu - // - this.RecentRomSubMenu.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { - this.toolStripSeparator1}); - this.RecentRomSubMenu.Image = global::BizHawk.Client.MultiHawk.Properties.Resources.Recent; - this.RecentRomSubMenu.Name = "RecentRomSubMenu"; - this.RecentRomSubMenu.Size = new System.Drawing.Size(165, 22); - this.RecentRomSubMenu.Text = "Recent"; - this.RecentRomSubMenu.DropDownOpened += new System.EventHandler(this.RecentRomSubMenu_DropDownOpened); - // - // toolStripSeparator1 - // - this.toolStripSeparator1.Name = "toolStripSeparator1"; - this.toolStripSeparator1.Size = new System.Drawing.Size(57, 6); - // - // toolStripSeparator5 - // - this.toolStripSeparator5.Name = "toolStripSeparator5"; - this.toolStripSeparator5.Size = new System.Drawing.Size(162, 6); - // - // RebootCoresMenuItem - // - this.RebootCoresMenuItem.Name = "RebootCoresMenuItem"; - this.RebootCoresMenuItem.Size = new System.Drawing.Size(165, 22); - this.RebootCoresMenuItem.Text = "Reboot Cores"; - this.RebootCoresMenuItem.Click += new System.EventHandler(this.RebootCoresMenuItem_Click); - // - // toolStripSeparator3 - // - this.toolStripSeparator3.Name = "toolStripSeparator3"; - this.toolStripSeparator3.Size = new System.Drawing.Size(162, 6); - // - // ExitMenuItem - // - this.ExitMenuItem.Name = "ExitMenuItem"; - this.ExitMenuItem.ShortcutKeyDisplayString = "Alt+F4"; - this.ExitMenuItem.Size = new System.Drawing.Size(165, 22); - this.ExitMenuItem.Text = "E&xit"; - this.ExitMenuItem.Click += new System.EventHandler(this.ExitMenuItem_Click); - // - // ViewSubMenu - // - this.ViewSubMenu.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { - this._1xMenuItem, - this._2xMenuItem, - this._3xMenuItem, - this._4xMenuItem}); - this.ViewSubMenu.Enabled = false; - this.ViewSubMenu.Name = "ViewSubMenu"; - this.ViewSubMenu.Size = new System.Drawing.Size(44, 20); - this.ViewSubMenu.Text = "&View"; - this.ViewSubMenu.DropDownOpened += new System.EventHandler(this.ViewSubMenu_DropDownOpened); - // - // _1xMenuItem - // - this._1xMenuItem.Name = "_1xMenuItem"; - this._1xMenuItem.Size = new System.Drawing.Size(85, 22); - this._1xMenuItem.Text = "&1x"; - this._1xMenuItem.Click += new System.EventHandler(this._1xMenuItem_Click); - // - // _2xMenuItem - // - this._2xMenuItem.Name = "_2xMenuItem"; - this._2xMenuItem.Size = new System.Drawing.Size(85, 22); - this._2xMenuItem.Text = "&2x"; - this._2xMenuItem.Click += new System.EventHandler(this._2xMenuItem_Click); - // - // _3xMenuItem - // - this._3xMenuItem.Name = "_3xMenuItem"; - this._3xMenuItem.Size = new System.Drawing.Size(85, 22); - this._3xMenuItem.Text = "&3x"; - this._3xMenuItem.Click += new System.EventHandler(this._3xMenuItem_Click); - // - // _4xMenuItem - // - this._4xMenuItem.Name = "_4xMenuItem"; - this._4xMenuItem.Size = new System.Drawing.Size(85, 22); - this._4xMenuItem.Text = "&4x"; - this._4xMenuItem.Click += new System.EventHandler(this._4xMenuItem_Click); - // - // MovieSubMenu - // - this.MovieSubMenu.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { - this.RecordMovieMenuItem, - this.PlayMovieMenuItem, - this.StopMovieMenuItem, - this.RestartMovieMenuItem, - this.RecentMovieSubMenu, - this.toolStripSeparator2, - this.ToggleReadonlyMenuItem}); - this.MovieSubMenu.Name = "MovieSubMenu"; - this.MovieSubMenu.Size = new System.Drawing.Size(52, 20); - this.MovieSubMenu.Text = "&Movie"; - this.MovieSubMenu.DropDownOpened += new System.EventHandler(this.MovieSubMenu_DropDownOpened); - // - // RecordMovieMenuItem - // - this.RecordMovieMenuItem.Image = global::BizHawk.Client.MultiHawk.Properties.Resources.RecordHS; - this.RecordMovieMenuItem.Name = "RecordMovieMenuItem"; - this.RecordMovieMenuItem.Size = new System.Drawing.Size(168, 22); - this.RecordMovieMenuItem.Text = "Record Movie"; - this.RecordMovieMenuItem.Click += new System.EventHandler(this.RecordMovieMenuItem_Click); - // - // PlayMovieMenuItem - // - this.PlayMovieMenuItem.Image = global::BizHawk.Client.MultiHawk.Properties.Resources.Play; - this.PlayMovieMenuItem.Name = "PlayMovieMenuItem"; - this.PlayMovieMenuItem.Size = new System.Drawing.Size(168, 22); - this.PlayMovieMenuItem.Text = "Play Movie"; - this.PlayMovieMenuItem.Click += new System.EventHandler(this.PlayMovieMenuItem_Click); - // - // StopMovieMenuItem - // - this.StopMovieMenuItem.Image = global::BizHawk.Client.MultiHawk.Properties.Resources.Stop; - this.StopMovieMenuItem.Name = "StopMovieMenuItem"; - this.StopMovieMenuItem.Size = new System.Drawing.Size(168, 22); - this.StopMovieMenuItem.Text = "&Stop Movie"; - this.StopMovieMenuItem.Click += new System.EventHandler(this.StopMovieMenuItem_Click); - // - // RestartMovieMenuItem - // - this.RestartMovieMenuItem.Image = global::BizHawk.Client.MultiHawk.Properties.Resources.restart; - this.RestartMovieMenuItem.Name = "RestartMovieMenuItem"; - this.RestartMovieMenuItem.Size = new System.Drawing.Size(168, 22); - this.RestartMovieMenuItem.Text = "Restart Movie"; - this.RestartMovieMenuItem.Click += new System.EventHandler(this.RestartMovieMenuItem_Click); - // - // RecentMovieSubMenu - // - this.RecentMovieSubMenu.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { - this.toolStripSeparator8}); - this.RecentMovieSubMenu.Name = "RecentMovieSubMenu"; - this.RecentMovieSubMenu.Size = new System.Drawing.Size(168, 22); - this.RecentMovieSubMenu.Text = "Recent"; - this.RecentMovieSubMenu.DropDownOpened += new System.EventHandler(this.RecentMovieSubMenu_DropDownOpened); - // - // toolStripSeparator8 - // - this.toolStripSeparator8.Name = "toolStripSeparator8"; - this.toolStripSeparator8.Size = new System.Drawing.Size(57, 6); - // - // toolStripSeparator2 - // - this.toolStripSeparator2.Name = "toolStripSeparator2"; - this.toolStripSeparator2.Size = new System.Drawing.Size(165, 6); - // - // ToggleReadonlyMenuItem - // - this.ToggleReadonlyMenuItem.Image = global::BizHawk.Client.MultiHawk.Properties.Resources.ReadOnly; - this.ToggleReadonlyMenuItem.Name = "ToggleReadonlyMenuItem"; - this.ToggleReadonlyMenuItem.Size = new System.Drawing.Size(168, 22); - this.ToggleReadonlyMenuItem.Text = "Toggle Read-only"; - this.ToggleReadonlyMenuItem.Click += new System.EventHandler(this.ToggleReadonlyMenuItem_Click); - // - // configToolStripMenuItem - // - this.configToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { - this.controllerConfigToolStripMenuItem, - this.hotkeyConfigToolStripMenuItem, - this.toolStripSeparator4, - this.saveConfigToolStripMenuItem}); - this.configToolStripMenuItem.Name = "configToolStripMenuItem"; - this.configToolStripMenuItem.Size = new System.Drawing.Size(55, 20); - this.configToolStripMenuItem.Text = "&Config"; - // - // controllerConfigToolStripMenuItem - // - this.controllerConfigToolStripMenuItem.Image = global::BizHawk.Client.MultiHawk.Properties.Resources.GameController; - this.controllerConfigToolStripMenuItem.Name = "controllerConfigToolStripMenuItem"; - this.controllerConfigToolStripMenuItem.Size = new System.Drawing.Size(166, 22); - this.controllerConfigToolStripMenuItem.Text = "Controller Config"; - this.controllerConfigToolStripMenuItem.Click += new System.EventHandler(this.controllerConfigToolStripMenuItem_Click); - // - // hotkeyConfigToolStripMenuItem - // - this.hotkeyConfigToolStripMenuItem.Image = global::BizHawk.Client.MultiHawk.Properties.Resources.HotKeys; - this.hotkeyConfigToolStripMenuItem.Name = "hotkeyConfigToolStripMenuItem"; - this.hotkeyConfigToolStripMenuItem.Size = new System.Drawing.Size(166, 22); - this.hotkeyConfigToolStripMenuItem.Text = "Hotkey Config"; - this.hotkeyConfigToolStripMenuItem.Click += new System.EventHandler(this.hotkeyConfigToolStripMenuItem_Click); - // - // toolStripSeparator4 - // - this.toolStripSeparator4.Name = "toolStripSeparator4"; - this.toolStripSeparator4.Size = new System.Drawing.Size(163, 6); - // - // saveConfigToolStripMenuItem - // - this.saveConfigToolStripMenuItem.Image = global::BizHawk.Client.MultiHawk.Properties.Resources.Save; - this.saveConfigToolStripMenuItem.Name = "saveConfigToolStripMenuItem"; - this.saveConfigToolStripMenuItem.Size = new System.Drawing.Size(166, 22); - this.saveConfigToolStripMenuItem.Text = "Save Config"; - this.saveConfigToolStripMenuItem.Click += new System.EventHandler(this.saveConfigToolStripMenuItem_Click); - // - // WorkspacePanel - // - this.WorkspacePanel.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) - | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this.WorkspacePanel.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D; - this.WorkspacePanel.Controls.Add(this.MainStatusBar); - this.WorkspacePanel.Location = new System.Drawing.Point(0, 25); - this.WorkspacePanel.Name = "WorkspacePanel"; - this.WorkspacePanel.Size = new System.Drawing.Size(655, 405); - this.WorkspacePanel.TabIndex = 1; - // - // MainStatusBar - // - this.MainStatusBar.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { - this.toolStripStatusLabel1, - this.FameStatusBarLabel, - this.PlayRecordStatusButton, - this.StatusBarMessageLabel}); - this.MainStatusBar.Location = new System.Drawing.Point(0, 379); - this.MainStatusBar.Name = "MainStatusBar"; - this.MainStatusBar.Size = new System.Drawing.Size(651, 22); - this.MainStatusBar.TabIndex = 0; - this.MainStatusBar.Text = "statusStrip1"; - // - // toolStripStatusLabel1 - // - this.toolStripStatusLabel1.Name = "toolStripStatusLabel1"; - this.toolStripStatusLabel1.Size = new System.Drawing.Size(46, 17); - this.toolStripStatusLabel1.Text = "Frame: "; - // - // FameStatusBarLabel - // - this.FameStatusBarLabel.Name = "FameStatusBarLabel"; - this.FameStatusBarLabel.Size = new System.Drawing.Size(13, 17); - this.FameStatusBarLabel.Text = "0"; - // - // PlayRecordStatusButton - // - this.PlayRecordStatusButton.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image; - this.PlayRecordStatusButton.Image = global::BizHawk.Client.MultiHawk.Properties.Resources.Blank; - this.PlayRecordStatusButton.ImageTransparentColor = System.Drawing.Color.Magenta; - this.PlayRecordStatusButton.Name = "PlayRecordStatusButton"; - this.PlayRecordStatusButton.Size = new System.Drawing.Size(29, 20); - this.PlayRecordStatusButton.Text = "No movie is active"; - // - // StatusBarMessageLabel - // - this.StatusBarMessageLabel.Name = "StatusBarMessageLabel"; - this.StatusBarMessageLabel.Size = new System.Drawing.Size(35, 17); - this.StatusBarMessageLabel.Text = "Hello"; - // - // contextMenuStrip1 - // - this.contextMenuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { - this.RecordMovieContextMenuItem, - this.PlayMovieContextMenuItem, - this.RestartMovieContextMenuItem, - this.StopMovieContextMenuItem, - this.LoadLastMovieContextMenuItem}); - this.contextMenuStrip1.Name = "contextMenuStrip1"; - this.contextMenuStrip1.Size = new System.Drawing.Size(161, 114); - this.contextMenuStrip1.Opening += new System.ComponentModel.CancelEventHandler(this.contextMenuStrip1_Opening); - // - // RecordMovieContextMenuItem - // - this.RecordMovieContextMenuItem.Image = global::BizHawk.Client.MultiHawk.Properties.Resources.RecordHS; - this.RecordMovieContextMenuItem.Name = "RecordMovieContextMenuItem"; - this.RecordMovieContextMenuItem.Size = new System.Drawing.Size(160, 22); - this.RecordMovieContextMenuItem.Text = "Record Movie"; - this.RecordMovieContextMenuItem.Click += new System.EventHandler(this.RecordMovieMenuItem_Click); - // - // PlayMovieContextMenuItem - // - this.PlayMovieContextMenuItem.Image = global::BizHawk.Client.MultiHawk.Properties.Resources.Play; - this.PlayMovieContextMenuItem.Name = "PlayMovieContextMenuItem"; - this.PlayMovieContextMenuItem.Size = new System.Drawing.Size(160, 22); - this.PlayMovieContextMenuItem.Text = "Play Movie"; - this.PlayMovieContextMenuItem.Click += new System.EventHandler(this.PlayMovieMenuItem_Click); - // - // LoadLastMovieContextMenuItem - // - this.LoadLastMovieContextMenuItem.Image = global::BizHawk.Client.MultiHawk.Properties.Resources.Recent; - this.LoadLastMovieContextMenuItem.Name = "LoadLastMovieContextMenuItem"; - this.LoadLastMovieContextMenuItem.Size = new System.Drawing.Size(160, 22); - this.LoadLastMovieContextMenuItem.Text = "Load Last Movie"; - this.LoadLastMovieContextMenuItem.Click += new System.EventHandler(this.LoadLastMovieMenuItem_Click); - // - // StopMovieContextMenuItem - // - this.StopMovieContextMenuItem.Image = global::BizHawk.Client.MultiHawk.Properties.Resources.Stop; - this.StopMovieContextMenuItem.Name = "StopMovieContextMenuItem"; - this.StopMovieContextMenuItem.Size = new System.Drawing.Size(160, 22); - this.StopMovieContextMenuItem.Text = "Stop Movie"; - this.StopMovieContextMenuItem.Click += new System.EventHandler(this.StopMovieMenuItem_Click); - // - // RestartMovieContextMenuItem - // - this.RestartMovieContextMenuItem.Image = global::BizHawk.Client.MultiHawk.Properties.Resources.restart; - this.RestartMovieContextMenuItem.Name = "RestartMovieContextMenuItem"; - this.RestartMovieContextMenuItem.Size = new System.Drawing.Size(160, 22); - this.RestartMovieContextMenuItem.Text = "Restart Movie"; - this.RestartMovieContextMenuItem.Click += new System.EventHandler(this.RestartMovieMenuItem_Click); - // - // Mainform - // - this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(655, 431); - this.ContextMenuStrip = this.contextMenuStrip1; - this.Controls.Add(this.WorkspacePanel); - this.Controls.Add(this.MainformMenu); - this.MainMenuStrip = this.MainformMenu; - this.Name = "Mainform"; - this.Text = "MultiHawk"; - this.Load += new System.EventHandler(this.Mainform_Load); - this.MainformMenu.ResumeLayout(false); - this.MainformMenu.PerformLayout(); - this.WorkspacePanel.ResumeLayout(false); - this.WorkspacePanel.PerformLayout(); - this.MainStatusBar.ResumeLayout(false); - this.MainStatusBar.PerformLayout(); - this.contextMenuStrip1.ResumeLayout(false); - this.ResumeLayout(false); - this.PerformLayout(); - - } - - #endregion - - private MenuStripEx MainformMenu; - private System.Windows.Forms.ToolStripMenuItem FileSubMenu; - private System.Windows.Forms.ToolStripMenuItem OpenRomMenuItem; - private System.Windows.Forms.Panel WorkspacePanel; - private System.Windows.Forms.StatusStrip MainStatusBar; - private System.Windows.Forms.ToolStripStatusLabel toolStripStatusLabel1; - private System.Windows.Forms.ToolStripStatusLabel FameStatusBarLabel; - private System.Windows.Forms.ToolStripStatusLabel StatusBarMessageLabel; - private System.Windows.Forms.ToolStripMenuItem RecentRomSubMenu; - private System.Windows.Forms.ToolStripSeparator toolStripSeparator1; - private System.Windows.Forms.ToolStripMenuItem MovieSubMenu; - private System.Windows.Forms.ToolStripMenuItem RecordMovieMenuItem; - private System.Windows.Forms.ToolStripMenuItem PlayMovieMenuItem; - private System.Windows.Forms.ToolStripMenuItem StopMovieMenuItem; - private System.Windows.Forms.ToolStripSeparator toolStripSeparator2; - private System.Windows.Forms.ToolStripMenuItem ToggleReadonlyMenuItem; - private System.Windows.Forms.ToolStripDropDownButton PlayRecordStatusButton; - private System.Windows.Forms.ToolStripMenuItem configToolStripMenuItem; - private System.Windows.Forms.ToolStripMenuItem controllerConfigToolStripMenuItem; - private System.Windows.Forms.ToolStripMenuItem hotkeyConfigToolStripMenuItem; - private System.Windows.Forms.ToolStripSeparator toolStripSeparator3; - private System.Windows.Forms.ToolStripMenuItem ExitMenuItem; - private System.Windows.Forms.ToolStripSeparator toolStripSeparator4; - private System.Windows.Forms.ToolStripMenuItem saveConfigToolStripMenuItem; - private System.Windows.Forms.ToolStripSeparator toolStripSeparator5; - private System.Windows.Forms.ToolStripMenuItem RebootCoresMenuItem; - private System.Windows.Forms.ToolStripMenuItem OpenSessionMenuItem; - private System.Windows.Forms.ToolStripMenuItem SaveSessionMenuItem; - private System.Windows.Forms.ToolStripMenuItem RecentSessionSubMenu; - private System.Windows.Forms.ToolStripMenuItem NewSessionMenuItem; - private System.Windows.Forms.ToolStripMenuItem SaveSessionAsMenuItem; - private System.Windows.Forms.ToolStripSeparator toolStripSeparator6; - private System.Windows.Forms.ToolStripSeparator toolStripSeparator7; - private System.Windows.Forms.ToolStripMenuItem ViewSubMenu; - private System.Windows.Forms.ToolStripMenuItem _1xMenuItem; - private System.Windows.Forms.ToolStripMenuItem _2xMenuItem; - private System.Windows.Forms.ToolStripMenuItem _3xMenuItem; - private System.Windows.Forms.ToolStripMenuItem _4xMenuItem; - private System.Windows.Forms.ContextMenuStrip contextMenuStrip1; - private System.Windows.Forms.ToolStripMenuItem LoadLastMovieContextMenuItem; - private System.Windows.Forms.ToolStripMenuItem RecentMovieSubMenu; - private System.Windows.Forms.ToolStripSeparator toolStripSeparator8; - private System.Windows.Forms.ToolStripMenuItem RecordMovieContextMenuItem; - private System.Windows.Forms.ToolStripMenuItem StopMovieContextMenuItem; - private System.Windows.Forms.ToolStripMenuItem PlayMovieContextMenuItem; - private System.Windows.Forms.ToolStripMenuItem RestartMovieMenuItem; - private System.Windows.Forms.ToolStripMenuItem RestartMovieContextMenuItem; - } -} - diff --git a/BizHawk.Client.MultiHawk/Mainform.cs b/BizHawk.Client.MultiHawk/Mainform.cs deleted file mode 100644 index 10ca3fab7e..0000000000 --- a/BizHawk.Client.MultiHawk/Mainform.cs +++ /dev/null @@ -1,1560 +0,0 @@ -using System; -using System.Collections.Generic; -using System.ComponentModel; -using System.Data; -using System.Diagnostics; -using System.Drawing; -using System.IO; -using System.Linq; -using System.Text; -using System.Threading; -using System.Threading.Tasks; -using System.Windows.Forms; - -using BizHawk.Common; -using BizHawk.Common.IOExtensions; -using BizHawk.Client.EmuHawk; -using BizHawk.Bizware.BizwareGL; -using BizHawk.Emulation.Common; -using BizHawk.Emulation.Common.IEmulatorExtensions; -using BizHawk.Emulation.Cores.Nintendo.NES; -using BizHawk.Client.Common; -using BizHawk.Client.MultiHawk.ToolExtensions; - -namespace BizHawk.Client.MultiHawk -{ - public partial class Mainform : Form - { - static Mainform() - { - // If this isnt here, then our assemblyresolving hacks wont work due to the check for MainForm.INTERIM - // its.. weird. dont ask. - } - - public Mainform(string[] args) - { - GLManager.CreateInstance(GlobalWin.IGL_GL); - - InitializeComponent(); - _throttle = new BizHawk.Client.EmuHawk.Throttle(); - _inputManager = new InputManager(this); - Global.Config = ConfigService.Load(PathManager.DefaultIniPath); - Global.Config.DispFixAspectRatio = false; // TODO: don't hardcode this - Global.Config.ResolveDefaults(); - GlobalWin.MainForm = this; - - Global.ControllerInputCoalescer = new ControllerInputCoalescer(); - Global.FirmwareManager = new FirmwareManager(); - Global.MovieSession = new MovieSession - { - Movie = MovieService.DefaultInstance, - MovieControllerAdapter = MovieService.DefaultInstance.LogGeneratorInstance().MovieControllerAdapter, - MessageCallback = AddMessage, - - AskYesNoCallback = StateErrorAskUser, - PauseCallback = PauseEmulator, - ModeChangedCallback = SetMainformMovieInfo - }; - - new AutoResetEvent(false); - // TODO - //Icon = Properties.Resources.logo; - Global.Game = GameInfo.NullInstance; - - // In order to allow late construction of this database, we hook up a delegate here to dearchive the data and provide it on demand - // we could background thread this later instead if we wanted to be real clever - NES.BootGodDB.GetDatabaseBytes = () => - { - string xmlPath = Path.Combine(PathManager.GetExeDirectoryAbsolute(), "gamedb", "NesCarts.xml"); - string x7zPath = Path.Combine(PathManager.GetExeDirectoryAbsolute(), "gamedb", "NesCarts.7z"); - bool loadXml = File.Exists(xmlPath); - using (var NesCartFile = new HawkFile(loadXml ? xmlPath : x7zPath)) - { - if (!loadXml) { NesCartFile.BindFirst(); } - return NesCartFile - .GetStream() - .ReadAllBytes(); - } - }; - - Database.LoadDatabase(Path.Combine(PathManager.GetExeDirectoryAbsolute(), "gamedb", "gamedb.txt")); - - Input.Initialize(this.Handle); - InitControls(); - - // TODO - //CoreFileProvider.SyncCoreCommInputSignals(); - - Global.ActiveController = new Controller(NullController.Instance.Definition); - Global.AutoFireController = AutofireNullControls; - Global.AutofireStickyXORAdapter.SetOnOffPatternFromConfig(); - - Closing += (o, e) => - { - Global.MovieSession.Movie.Stop(); - - foreach (var ew in EmulatorWindows) - { - ew.ShutDown(); - } - - SaveConfig(); - }; - - if (Global.Config.MainWndx != -1 && Global.Config.MainWndy != -1 && Global.Config.SaveWindowPosition) - { - Location = new Point(Global.Config.MainWndx, Global.Config.MainWndy); - } - } - - // TODO: make this an actual property, set it when loading a Rom, and pass it dialogs, etc - // This is a quick hack to reduce the dependency on Global.Emulator - public IEmulator Emulator - { - get { return Global.Emulator; } - set { Global.Emulator = value; } - } - - private static bool StateErrorAskUser(string title, string message) - { - var result = MessageBox.Show( - message, - title, - MessageBoxButtons.YesNo, - MessageBoxIcon.Question - ); - - return result == DialogResult.Yes; - } - - private void Mainform_Load(object sender, EventArgs e) - { - SetMainformMovieInfo(); - - if (Global.Config.RecentRomSessions.AutoLoad) - { - LoadRomSessionFromRecent(Global.Config.RecentRomSessions.MostRecent); - - if (Global.Config.RecentMovies.AutoLoad && !Global.Config.RecentMovies.Empty) - { - LoadMoviesFromRecent(Global.Config.RecentMovies.MostRecent); - } - } - - if (Global.Config.SaveWindowPosition && Global.Config.MainWidth > 0 && Global.Config.MainHeight > 0) - { - this.Size = new Size(Global.Config.MainWidth, Global.Config.MainHeight); - - } - } - - public EmulatorWindowList EmulatorWindows = new EmulatorWindowList(); - private AutofireController AutofireNullControls; - private bool _exit; - - protected override void OnClosed(EventArgs e) - { - _exit = true; - base.OnClosed(e); - } - - private void SaveConfig() - { - if (Global.Config.SaveWindowPosition) - { - if (Global.Config.MainWndx != -32000) // When minimized location is -32000, don't save this into the config file! - { - Global.Config.MainWndx = Location.X; - } - - if (Global.Config.MainWndy != -32000) - { - Global.Config.MainWndy = Location.Y; - } - } - else - { - Global.Config.MainWndx = -1; - Global.Config.MainWndy = -1; - } - - Global.Config.MainWidth = this.Width; - Global.Config.MainHeight = this.Height; - - ConfigService.Save(PathManager.DefaultIniPath, Global.Config); - } - - private void InitControls() - { - var controls = new Controller( - new ControllerDefinition - { - Name = "Emulator Frontend Controls", - BoolButtons = Global.Config.HotkeyBindings.Select(x => x.DisplayName).ToList() - }); - - foreach (var b in Global.Config.HotkeyBindings) - { - controls.BindMulti(b.DisplayName, b.Bindings); - } - - Global.ClientControls = controls; - AutofireNullControls = new AutofireController(NullController.Instance.Definition, Emulator); - } - - private void OpenRomMenuItem_Click(object sender, EventArgs e) - { - var ofd = new OpenFileDialog - { - InitialDirectory = PathManager.GetExeDirectoryAbsolute() - }; - - ofd.Filter = FormatFilter( - "Rom Files", "*.nes;*.fds;*.sms;*.gg;*.sg;*.pce;*.sgx;*.bin;*.smd;*.rom;*.a26;*.a78;*.lnx;*.m3u;*.cue;*.ccd;*.exe;*.gb;*.gbc;*.gba;*.gen;*.md;*.col;.int;*.smc;*.sfc;*.prg;*.d64;*.g64;*.crt;*.sgb;*.xml;*.z64;*.v64;*.n64;*.ws;*.wsc;%ARCH%", - "Music Files", "*.psf;*.sid", - "Disc Images", "*.cue;*.ccd;*.m3u", - "NES", "*.nes;*.fds;%ARCH%", - "Super NES", "*.smc;*.sfc;*.xml;%ARCH%", - "Master System", "*.sms;*.gg;*.sg;%ARCH%", - "PC Engine", "*.pce;*.sgx;*.cue;*.ccd;%ARCH%", - "TI-83", "*.rom;%ARCH%", - "Archive Files", "%ARCH%", - "Savestate", "*.state", - "Atari 2600", "*.a26;*.bin;%ARCH%", - "Atari 7800", "*.a78;*.bin;%ARCH%", - "Atari Lynx", "*.lnx;%ARCH%", - "Genesis", "*.gen;*.smd;*.bin;*.md;*.cue;*.ccd;%ARCH%", - "Gameboy", "*.gb;*.gbc;*.sgb;%ARCH%", - "Gameboy Advance", "*.gba;%ARCH%", - "Colecovision", "*.col;%ARCH%", - "Intellivision (very experimental)", "*.int;*.bin;*.rom;%ARCH%", - "PSX Executables (experimental)", "*.exe", - "PSF Playstation Sound File", "*.psf;*.minipsf", - "Commodore 64 (experimental)", "*.prg; *.d64, *.g64; *.crt;%ARCH%", - "SID Commodore 64 Music File", "*.sid;%ARCH%", - "Nintendo 64", "*.z64;*.v64;*.n64", - "WonderSwan", "*.ws;*.wsc;%ARCH%", - "All Files", "*.*"); - - var result = ofd.ShowDialog(); - if (result != DialogResult.OK) - { - return; - } - - LoadRom(ofd.FileName); - } - - private readonly InputManager _inputManager; - - private bool ReloadRom(EmulatorWindow ew) - { - bool deterministic = ew.Emulator.DeterministicEmulation; - string path = ew.CurrentRomPath; - - var loader = new RomLoader - { - ChooseArchive = LoadArhiveChooser, - ChoosePlatform = ChoosePlatformForRom, - Deterministic = deterministic, - MessageCallback = AddMessage - }; - - - loader.OnLoadError += ShowLoadError; - loader.OnLoadSettings += CoreSettings; - loader.OnLoadSyncSettings += CoreSyncSettings; - - var nextComm = new CoreComm(ShowMessageCoreComm, AddMessage); - - var result = loader.LoadRom(path, nextComm); - - if (result) - { - ew.SaveRam(); - ew.Emulator.Dispose(); - ew.Emulator = loader.LoadedEmulator; - ew.CoreComm = nextComm; - - _inputManager.SyncControls(); - - if (EmulatorWindows.First() == ew) - { - Emulator = ew.Emulator; - } - - return true; - } - else - { - return false; - } - } - - private string StripArchivePath(string path) - { - if (path.Contains("|")) - { - return path.Split('|').Last(); - } - - return path; - } - - private bool LoadRom(string path) - { - bool deterministic = true; - - var loader = new RomLoader - { - ChooseArchive = LoadArhiveChooser, - ChoosePlatform = ChoosePlatformForRom, - Deterministic = deterministic, - MessageCallback = AddMessage - }; - - - loader.OnLoadError += ShowLoadError; - loader.OnLoadSettings += CoreSettings; - loader.OnLoadSyncSettings += CoreSyncSettings; - - var nextComm = new CoreComm(ShowMessageCoreComm, AddMessage); - nextComm.CoreFileProvider = new CoreFileProvider(s => MessageBox.Show(s)); - - var result = loader.LoadRom(path, nextComm); - - if (result) - { - var ew = new EmulatorWindow(this) - { - TopLevel = false, - Text = Path.GetFileNameWithoutExtension(StripArchivePath(path)), - Emulator = loader.LoadedEmulator, - GL = new Bizware.BizwareGL.Drivers.OpenTK.IGL_TK(2,0,false), - //GL = new Bizware.BizwareGL.Drivers.SlimDX.IGL_SlimDX9(), - GLManager = GLManager.Instance, - Game = loader.Game, - CurrentRomPath = loader.CanonicalFullPath - }; - - nextComm.ReleaseGLContext = (o) => GlobalWin.GLManager.ReleaseGLContext(o); - nextComm.RequestGLContext = (major, minor, forward) => GlobalWin.GLManager.CreateGLContext(major, minor, forward); - nextComm.ActivateGLContext = (gl) => GlobalWin.GLManager.Activate((GLManager.ContextRef)gl); - nextComm.DeactivateGLContext = () => GlobalWin.GLManager.Deactivate(); - - ew.CoreComm = nextComm; - ew.Init(); - - if (EmulatorWindows.Any()) - { - // Attempt to open the window is a smart location - var last = EmulatorWindows.Last(); - - int x = last.Location.X + last.Width + 5; - int y = last.Location.Y; - if (x + (last.Width / 2) > Width) // If it will go too far off screen - { - y += last.Height + 5; - x = EmulatorWindows.First().Location.X; - } - - ew.Location = new Point(x, y); - } - - - EmulatorWindows.Add(ew); - - WorkspacePanel.Controls.Add(ew); - ew.Show(); - - Global.Config.RecentRoms.Add(loader.CanonicalFullPath); - - if (EmulatorWindows.Count == 1) - { - Emulator = ew.Emulator; - ViewSubMenu.Enabled = true; - } - - _inputManager.SyncControls(); - - return true; - } - else - { - return false; - } - } - - /// - /// Controls whether the app generates input events. should be turned off for most modal dialogs - /// - public bool AllowInput - { - get - { - // the main form gets input - if (ActiveForm == this) - { - return true; - } - - // modals that need to capture input for binding purposes get input, of course - if (ActiveForm is BizHawk.Client.EmuHawk.HotkeyConfig - || ActiveForm is BizHawk.Client.EmuHawk.ControllerConfig - //|| ActiveForm is TAStudio - //|| ActiveForm is VirtualpadTool - ) - { - return true; - } - - return false; - } - } - - private static string FormatFilter(params string[] args) - { - var sb = new StringBuilder(); - if (args.Length % 2 != 0) - { - throw new ArgumentException(); - } - - var num = args.Length / 2; - for (int i = 0; i < num; i++) - { - sb.AppendFormat("{0} ({1})|{1}", args[i * 2], args[i * 2 + 1]); - if (i != num - 1) - { - sb.Append('|'); - } - } - - var str = sb.ToString().Replace("%ARCH%", "*.zip;*.rar;*.7z;*.gz"); - str = str.Replace(";", "; "); - return str; - } - - public void AddMessage(string message) - { - StatusBarMessageLabel.Text = message; - } - - private string ChoosePlatformForRom(RomGame rom) - { - // TODO - return null; - } - - private int? LoadArhiveChooser(HawkFile file) - { - var ac = new BizHawk.Client.EmuHawk.ArchiveChooser(file); - if (ac.ShowDialog(this) == DialogResult.OK) - { - return ac.SelectedMemberIndex; - } - else - { - return null; - } - } - - private void ShowLoadError(object sender, RomLoader.RomErrorArgs e) - { - string title = "load error"; - if (e.AttemptedCoreLoad != null) - { - title = e.AttemptedCoreLoad + " load error"; - } - - MessageBox.Show(this, e.Message, title, MessageBoxButtons.OK, MessageBoxIcon.Error); - } - - private static void CoreSettings(object sender, RomLoader.SettingsLoadArgs e) - { - e.Settings = Global.Config.GetCoreSettings(e.Core); - } - - private void CoreSyncSettings(object sender, RomLoader.SettingsLoadArgs e) - { - if (Global.MovieSession.QueuedMovie != null) - { - if (!string.IsNullOrWhiteSpace(Global.MovieSession.QueuedMovie.SyncSettingsJson)) - { - e.Settings = ConfigService.LoadWithType(Global.MovieSession.QueuedMovie.SyncSettingsJson); - } - else - { - MessageBox.Show( - "No sync settings found, using currently configured settings for this core.", - "No sync settings found", - MessageBoxButtons.OK, - MessageBoxIcon.Warning - ); - - e.Settings = Global.Config.GetCoreSyncSettings(e.Core); - } - } - else - { - e.Settings = Global.Config.GetCoreSyncSettings(e.Core); - } - - } - - public void FlagNeedsReboot() - { - // TODO - } - - private void ShowMessageCoreComm(string message) - { - MessageBox.Show(this, message, "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning); - } - - private static void CheckMessages() - { - Application.DoEvents(); - if (ActiveForm != null) - { - BizHawk.Client.EmuHawk.ScreenSaver.ResetTimerPeriodically(); - } - } - - // sends an alt+mnemonic combination - private void SendAltKeyChar(char c) - { - typeof(ToolStrip).InvokeMember("ProcessMnemonicInternal", System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.InvokeMethod | System.Reflection.BindingFlags.Instance, null, MainformMenu, new object[] { c }); - } - - // sends a simulation of a plain alt key keystroke - private void SendPlainAltKey(int lparam) - { - var m = new Message { WParam = new IntPtr(0xF100), LParam = new IntPtr(lparam), Msg = 0x0112, HWnd = Handle }; - base.WndProc(ref m); - } - - public void ProcessInput() - { - ControllerInputCoalescer conInput = Global.ControllerInputCoalescer as ControllerInputCoalescer; - - for (; ; ) - { - - // loop through all available events - var ie = Input.Instance.DequeueEvent(); - if (ie == null) { break; } - - // look for hotkey bindings for this key - var triggers = Global.ClientControls.SearchBindings(ie.LogicalButton.ToString()); - if (triggers.Count == 0) - { - // Maybe it is a system alt-key which hasnt been overridden - if (ie.EventType == Input.InputEventType.Press) - { - if (ie.LogicalButton.Alt && ie.LogicalButton.Button.Length == 1) - { - var c = ie.LogicalButton.Button.ToLower()[0]; - if ((c >= 'a' && c <= 'z') || c == ' ') - { - SendAltKeyChar(c); - } - } - if (ie.LogicalButton.Alt && ie.LogicalButton.Button == "Space") - { - SendPlainAltKey(32); - } - } - } - - bool handled; - switch (Global.Config.Input_Hotkey_OverrideOptions) - { - default: - case 0: // Both allowed - conInput.Receive(ie); - - handled = false; - if (ie.EventType == Input.InputEventType.Press) - { - handled = triggers.Aggregate(handled, (current, trigger) => current | CheckHotkey(trigger)); - } - - // hotkeys which arent handled as actions get coalesced as pollable virtual client buttons - if (!handled) - { - GlobalWin.HotkeyCoalescer.Receive(ie); - } - - break; - case 1: // Input overrides Hokeys - conInput.Receive(ie); - if (!Global.ActiveController.HasBinding(ie.LogicalButton.ToString())) - { - handled = false; - if (ie.EventType == Input.InputEventType.Press) - { - handled = triggers.Aggregate(handled, (current, trigger) => current | CheckHotkey(trigger)); - } - - // hotkeys which arent handled as actions get coalesced as pollable virtual client buttons - if (!handled) - { - GlobalWin.HotkeyCoalescer.Receive(ie); - } - } - break; - case 2: // Hotkeys override Input - handled = false; - if (ie.EventType == Input.InputEventType.Press) - { - handled = triggers.Aggregate(handled, (current, trigger) => current | CheckHotkey(trigger)); - } - - // hotkeys which arent handled as actions get coalesced as pollable virtual client buttons - if (!handled) - { - GlobalWin.HotkeyCoalescer.Receive(ie); - conInput.Receive(ie); - } - break; - } - } - } - - public void ProgramRunLoop() - { - CheckMessages(); - - for (; ; ) - { - Input.Instance.Update(); - - // handle events and dispatch as a hotkey action, or a hotkey button, or an input button - ProcessInput(); - Global.ClientControls.LatchFromPhysical(GlobalWin.HotkeyCoalescer); - - Global.ActiveController.LatchFromPhysical(Global.ControllerInputCoalescer); - - // TODO - //Global.ActiveController.ApplyAxisConstraints( - // (Emulator is N64 && Global.Config.N64UseCircularAnalogConstraint) ? "Natural Circle" : null); - - Global.ActiveController.OR_FromLogical(Global.ClickyVirtualPadController); - Global.AutoFireController.LatchFromPhysical(Global.ControllerInputCoalescer); - - if (Global.ClientControls["Autohold"]) - { - Global.StickyXORAdapter.MassToggleStickyState(Global.ActiveController.PressedButtons); - Global.AutofireStickyXORAdapter.MassToggleStickyState(Global.AutoFireController.PressedButtons); - } - else if (Global.ClientControls["Autofire"]) - { - Global.AutofireStickyXORAdapter.MassToggleStickyState(Global.ActiveController.PressedButtons); - } - - // autohold/autofire must not be affected by the following inputs - Global.ActiveController.Overrides(Global.LuaAndAdaptor); - - if (EmulatorWindows.Any()) - { - StepRunLoop_Core(); - StepRunLoop_Throttle(); - - foreach (var window in EmulatorWindows) - { - window.Render(); - } - } - - CheckMessages(); - - if (_exit) - { - break; - } - - Thread.Sleep(0); - } - - Shutdown(); - } - - private void Shutdown() - { - //TODO - //if (_currAviWriter != null) - //{ - // _currAviWriter.CloseFile(); - // _currAviWriter = null; - //} - } - - public void LoadQuickSave(string quickSlotName) - { - try - { - foreach (var window in EmulatorWindows) - { - window.LoadQuickSave(quickSlotName); - } - } - catch - { - MessageBox.Show("Could not load " + quickSlotName); - } - } - - public void SaveQuickSave(string quickSlotName) - { - try - { - foreach (var window in EmulatorWindows) - { - window.SaveQuickSave(quickSlotName); - } - } - catch - { - MessageBox.Show("Could not save " + quickSlotName); - } - } - - private void SelectSlot(int num) - { - Global.Config.SaveSlot = num; - UpdateStatusSlots(); - } - - private void UpdateStatusSlots() - { - // TODO - SaveSlotSelectedMessage(); - UpdateAfterFrameChanged(); - } - - private void SaveSlotSelectedMessage() - { - AddMessage("Slot " + Global.Config.SaveSlot + " selected."); - } - - public void TogglePause() - { - EmulatorPaused ^= true; - //SetPauseStatusbarIcon(); // TODO - } - private bool CheckHotkey(string trigger) - { - switch (trigger) - { - default: - return false; - - case "Pause": - TogglePause(); - break; - case "Reboot Core": - RebootCoresMenuItem_Click(null, null); - break; - case "Quick Load": - LoadQuickSave("QuickSave" + Global.Config.SaveSlot); - break; - case "Quick Save": - SaveQuickSave("QuickSave" + Global.Config.SaveSlot); - break; - - // Save States - case "Save State 0": - SaveQuickSave("QuickSave0"); - Global.Config.SaveSlot = 0; - UpdateStatusSlots(); - break; - case "Save State 1": - SaveQuickSave("QuickSave1"); - Global.Config.SaveSlot = 1; - UpdateStatusSlots(); - break; - case "Save State 2": - SaveQuickSave("QuickSave2"); - Global.Config.SaveSlot = 2; - UpdateStatusSlots(); - break; - case "Save State 3": - SaveQuickSave("QuickSave3"); - Global.Config.SaveSlot = 3; - UpdateStatusSlots(); - break; - case "Save State 4": - SaveQuickSave("QuickSave4"); - Global.Config.SaveSlot = 4; - UpdateStatusSlots(); - break; - case "Save State 5": - SaveQuickSave("QuickSave5"); - Global.Config.SaveSlot = 5; - UpdateStatusSlots(); - break; - case "Save State 6": - SaveQuickSave("QuickSave6"); - Global.Config.SaveSlot = 6; - UpdateStatusSlots(); - break; - case "Save State 7": - SaveQuickSave("QuickSave7"); - Global.Config.SaveSlot = 7; - UpdateStatusSlots(); - break; - case "Save State 8": - SaveQuickSave("QuickSave8"); - Global.Config.SaveSlot = 8; - UpdateStatusSlots(); - break; - case "Save State 9": - SaveQuickSave("QuickSave9"); - Global.Config.SaveSlot = 9; - //UpdateStatusSlots(); - break; - case "Load State 0": - LoadQuickSave("QuickSave0"); - Global.Config.SaveSlot = 0; - UpdateStatusSlots(); - break; - case "Load State 1": - LoadQuickSave("QuickSave1"); - Global.Config.SaveSlot = 1; - UpdateStatusSlots(); - break; - case "Load State 2": - LoadQuickSave("QuickSave2"); - Global.Config.SaveSlot = 2; - UpdateStatusSlots(); - break; - case "Load State 3": - LoadQuickSave("QuickSave3"); - Global.Config.SaveSlot = 3; - UpdateStatusSlots(); - break; - case "Load State 4": - LoadQuickSave("QuickSave4"); - Global.Config.SaveSlot = 4; - UpdateStatusSlots(); - break; - case "Load State 5": - LoadQuickSave("QuickSave5"); - Global.Config.SaveSlot = 5; - UpdateStatusSlots(); - break; - case "Load State 6": - LoadQuickSave("QuickSave6"); - Global.Config.SaveSlot = 6; - UpdateStatusSlots(); - break; - case "Load State 7": - LoadQuickSave("QuickSave7"); - Global.Config.SaveSlot = 7; - break; - case "Load State 8": - LoadQuickSave("QuickSave8"); - Global.Config.SaveSlot = 8; - UpdateStatusSlots(); - break; - case "Load State 9": - LoadQuickSave("QuickSave9"); - Global.Config.SaveSlot = 9; - UpdateStatusSlots(); - break; - - case "Select State 0": - SelectSlot(0); - break; - case "Select State 1": - SelectSlot(1); - break; - case "Select State 2": - SelectSlot(2); - break; - case "Select State 3": - SelectSlot(3); - break; - case "Select State 4": - SelectSlot(4); - break; - case "Select State 5": - SelectSlot(5); - break; - case "Select State 6": - SelectSlot(6); - break; - case "Select State 7": - SelectSlot(7); - break; - case "Select State 8": - SelectSlot(8); - break; - case "Select State 9": - SelectSlot(9); - break; - - // Movie - case "Stop Movie": - StopMovieMenuItem_Click(null, null); - break; - case "Toggle read-only": - ToggleReadonlyMenuItem_Click(null, null); - break; - // TODO - //case "Play from beginning": - // RestartMovie(); - // break; - // TODO - //case "Save Movie": - // SaveMovie(); - // break; - } - - return true; - } - - public bool PressFrameAdvance = false; - public bool PressRewind = false; - public bool FastForward = false; - public bool TurboFastForward = false; - public bool EmulatorPaused = true; - private readonly BizHawk.Client.EmuHawk.Throttle _throttle; - //private bool _unthrottled; // TODO - private bool _runloopFrameAdvance; - private bool _runloopFrameProgress; - private long _frameAdvanceTimestamp; - private bool _runloopLastFf; - private int _runloopFps; - private long _runloopSecond; - private int _runloopLastFps; - - public bool IsTurboing - { - get - { - return Global.ClientControls["Turbo"]; - } - } - - private void SyncThrottle() - { - // "unthrottled" = throttle was turned off with "Toggle Throttle" hotkey - // "turbo" = throttle is off due to the "Turbo" hotkey being held - // They are basically the same thing but one is a toggle and the other requires a - // hotkey to be held. There is however slightly different behavior in that turbo - // skips outputting the audio. There's also a third way which is when no throttle - // method is selected, but the clock throttle determines that by itself and - // everything appears normal here. - - var fastForward = Global.ClientControls["Fast Forward"] || FastForward; - var turbo = IsTurboing; - - int speedPercent = fastForward ? Global.Config.SpeedPercentAlternate : Global.Config.SpeedPercent; - - Global.DisableSecondaryThrottling = /*_unthrottled || TODO */ turbo || fastForward; - - // realtime throttle is never going to be so exact that using a double here is wrong - _throttle.SetCoreFps(EmulatorWindows.Master.Emulator.VsyncRate()); - _throttle.signal_paused = EmulatorPaused; - _throttle.signal_unthrottle = /*_unthrottled || TODO */ turbo; - _throttle.signal_overrideSecondaryThrottle = fastForward && (Global.Config.SoundThrottle || Global.Config.VSyncThrottle || Global.Config.VSync); - _throttle.SetSpeedPercent(speedPercent); - } - - private void StepRunLoop_Throttle() - { - SyncThrottle(); - _throttle.signal_frameAdvance = _runloopFrameAdvance; - _throttle.signal_continuousFrameAdvancing = _runloopFrameProgress; - - _throttle.Step(true, -1); - } - - public void PauseEmulator() - { - EmulatorPaused = true; - //SetPauseStatusbarIcon(); // TODO - } - - public void UnpauseEmulator() - { - EmulatorPaused = false; - //SetPauseStatusbarIcon(); // TODO - } - - private void StepRunLoop_Core() - { - var runFrame = false; - _runloopFrameAdvance = false; - var currentTimestamp = Stopwatch.GetTimestamp(); - double frameAdvanceTimestampDeltaMs = (double)(currentTimestamp - _frameAdvanceTimestamp) / Stopwatch.Frequency * 1000.0; - bool frameProgressTimeElapsed = frameAdvanceTimestampDeltaMs >= Global.Config.FrameProgressDelayMs; - - if (Global.ClientControls["Frame Advance"]) - { - // handle the initial trigger of a frame advance - if (_frameAdvanceTimestamp == 0) - { - PauseEmulator(); - runFrame = true; - _runloopFrameAdvance = true; - _frameAdvanceTimestamp = currentTimestamp; - } - else - { - // handle the timed transition from countdown to FrameProgress - if (frameProgressTimeElapsed) - { - runFrame = true; - _runloopFrameProgress = true; - UnpauseEmulator(); - } - } - } - else - { - // handle release of frame advance: do we need to deactivate FrameProgress? - if (_runloopFrameProgress) - { - _runloopFrameProgress = false; - PauseEmulator(); - } - - _frameAdvanceTimestamp = 0; - } - - if (!EmulatorPaused) - { - runFrame = true; - } - - if (runFrame) - { - var isFastForwarding = Global.ClientControls["Fast Forward"] || IsTurboing; - var updateFpsString = _runloopLastFf != isFastForwarding; - _runloopLastFf = isFastForwarding; - _runloopFps++; - - if ((double)(currentTimestamp - _runloopSecond) / Stopwatch.Frequency >= 1.0) - { - _runloopLastFps = _runloopFps; - _runloopSecond = currentTimestamp; - _runloopFps = 0; - updateFpsString = true; - } - - if (updateFpsString) - { - var fps_string = _runloopLastFps + " fps"; - if (IsTurboing) - { - fps_string += " >>>>"; - } - else if (isFastForwarding) - { - fps_string += " >>"; - } - - //GlobalWin.OSD.FPS = fps_string; // TODO - } - - Global.MovieSession.HandleMovieOnFrameLoop(); - - foreach (var window in EmulatorWindows) - { - window.FrameAdvance(); - } - - PressFrameAdvance = false; - - UpdateAfterFrameChanged(); - } - } - - private void UpdateAfterFrameChanged() - { - if (EmulatorWindows.Any()) - { - string frame = EmulatorWindows.Master.Emulator.Frame.ToString(); - - if (Global.MovieSession.Movie.IsActive) - { - if (Global.MovieSession.Movie.IsFinished) - { - frame += $" / {Global.MovieSession.Movie.FrameCount} (finished)"; - } - else if (Global.MovieSession.Movie.IsPlaying) - { - frame += $" / {Global.MovieSession.Movie.FrameCount}"; - } - } - - FameStatusBarLabel.Text = frame; - } - } - - private void FileSubMenu_DropDownOpened(object sender, EventArgs e) - { - SaveSessionMenuItem.Enabled = !string.IsNullOrWhiteSpace(EmulatorWindows.SessionName); - SaveSessionAsMenuItem.Enabled = EmulatorWindows.Any(); - } - - private void LoadRomFromRecent(string rom) - { - if (!LoadRom(rom)) - { - Global.Config.RecentRoms.HandleLoadError(rom); - } - } - - private void MovieSubMenu_DropDownOpened(object sender, EventArgs e) - { - PlayMovieMenuItem.Enabled = - RecordMovieMenuItem.Enabled = - EmulatorWindows.Any(); - - StopMovieMenuItem.Enabled = - RestartMovieMenuItem.Enabled = - Global.MovieSession.Movie.IsActive; - } - - private void RecordMovieMenuItem_Click(object sender, EventArgs e) - { - new RecordMovie(Emulator).ShowDialog(); - UpdateMainText(); - UpdateAfterFrameChanged(); - } - - private void PlayMovieMenuItem_Click(object sender, EventArgs e) - { - new PlayMovie().ShowDialog(); - UpdateMainText(); - UpdateAfterFrameChanged(); - } - - private void StopMovieMenuItem_Click(object sender, EventArgs e) - { - Global.MovieSession.StopMovie(true); - SetMainformMovieInfo(); - UpdateMainText(); - UpdateAfterFrameChanged(); - //UpdateStatusSlots(); // TODO - } - - private void ToggleReadonlyMenuItem_Click(object sender, EventArgs e) - { - Global.MovieSession.ReadOnly ^= true; - if (Global.MovieSession.ReadOnly) - { - AddMessage("Movie is now Read-only"); - } - else - { - AddMessage("Movie is now read+write"); - } - } - - private void LoadMoviesFromRecent(string path) - { - if (File.Exists(path)) - { - var movie = MovieService.Get(path); - Global.MovieSession.ReadOnly = true; - StartNewMovie(movie, false); - } - else - { - Global.Config.RecentMovies.HandleLoadError(path); - } - } - - public void SetMainformMovieInfo() - { - if (Global.MovieSession.Movie.IsPlaying) - { - PlayRecordStatusButton.Image = Properties.Resources.Play; - PlayRecordStatusButton.ToolTipText = "Movie is in playback mode"; - PlayRecordStatusButton.Visible = true; - } - else if (Global.MovieSession.Movie.IsRecording) - { - PlayRecordStatusButton.Image = Properties.Resources.RecordHS; - PlayRecordStatusButton.ToolTipText = "Movie is in record mode"; - PlayRecordStatusButton.Visible = true; - } - else if (!Global.MovieSession.Movie.IsActive) - { - PlayRecordStatusButton.Image = Properties.Resources.Blank; - PlayRecordStatusButton.ToolTipText = "No movie is active"; - PlayRecordStatusButton.Visible = false; - } - } - - public bool StartNewMovie(IMovie movie, bool record) - { - if (movie.IsActive) - { - movie.Save(); - } - - try - { - Global.MovieSession.QueueNewMovie(movie, record, Emulator); - } - catch (MoviePlatformMismatchException ex) - { - MessageBox.Show(this, ex.Message, "Movie/Platform Mismatch", MessageBoxButtons.OK, MessageBoxIcon.Error); - return false; - } - - RebootCoresMenuItem_Click(null, null); - - Emulator = EmulatorWindows.Master.Emulator; - - if (Global.MovieSession.PreviousNES_InQuickNES.HasValue) - { - Global.Config.NES_InQuickNES = Global.MovieSession.PreviousNES_InQuickNES.Value; - Global.MovieSession.PreviousNES_InQuickNES = null; - } - - if (Global.MovieSession.PreviousSNES_InSnes9x.HasValue) - { - Global.Config.SNES_InSnes9x = Global.MovieSession.PreviousSNES_InSnes9x.Value; - Global.MovieSession.PreviousSNES_InSnes9x = null; - } - - if (Global.MovieSession.PreviousGBA_UsemGBA.HasValue) - { - Global.Config.GBA_UsemGBA = Global.MovieSession.PreviousGBA_UsemGBA.Value; - Global.MovieSession.PreviousGBA_UsemGBA = null; - } - - Global.Config.RecentMovies.Add(movie.Filename); - - if (EmulatorWindows.Master.Emulator.HasSavestates() && movie.StartsFromSavestate) - { - if (movie.TextSavestate != null) - { - EmulatorWindows.Master.Emulator.AsStatable().LoadStateText(new StringReader(movie.TextSavestate)); - } - else - { - EmulatorWindows.Master.Emulator.AsStatable().LoadStateBinary(new BinaryReader(new MemoryStream(movie.BinarySavestate, false))); - } - - foreach (var ew in EmulatorWindows) - { - ew.Emulator.ResetCounters(); - } - } - - Global.MovieSession.RunQueuedMovie(record); - - SetMainformMovieInfo(); - UpdateAfterFrameChanged(); - return true; - } - - private void hotkeyConfigToolStripMenuItem_Click(object sender, EventArgs e) - { - if (new BizHawk.Client.EmuHawk.HotkeyConfig().ShowDialog() == DialogResult.OK) - { - InitControls(); - _inputManager.SyncControls(); - } - } - - private void controllerConfigToolStripMenuItem_Click(object sender, EventArgs e) - { - var controller = new BizHawk.Client.EmuHawk.ControllerConfig(EmulatorWindows.Master.Emulator.ControllerDefinition); - if (controller.ShowDialog() == DialogResult.OK) - { - InitControls(); - _inputManager.SyncControls(); - } - } - - public void EmulatorWindowClosed(EmulatorWindow ew) - { - EmulatorWindows.Remove(ew); - WorkspacePanel.Controls.Remove(ew); - - if (ew.Emulator == Emulator) - { - if (EmulatorWindows.Any()) - { - Emulator = EmulatorWindows.Master.Emulator; - } - else - { - Emulator = null; - ViewSubMenu.Enabled = false; - } - } - } - - private void ExitMenuItem_Click(object sender, EventArgs e) - { - Close(); - } - - private void saveConfigToolStripMenuItem_Click(object sender, EventArgs e) - { - SaveConfig(); - AddMessage("Saved settings"); - } - - private void RebootCoresMenuItem_Click(object sender, EventArgs e) - { - foreach (var ew in EmulatorWindows) - { - ReloadRom(ew); - } - - AddMessage("Rebooted all cores"); - } - - private void SaveSessionMenuItem_Click(object sender, EventArgs e) - { - if (!string.IsNullOrWhiteSpace(EmulatorWindows.SessionName)) - { - File.WriteAllText(EmulatorWindows.SessionName, EmulatorWindows.SessionJson); - AddMessage("Session saved."); - } - } - - private void SaveSessionAsMenuItem_Click(object sender, EventArgs e) - { - if (EmulatorWindows.Any()) - { - var file = GetSaveFileFromUser(); - if (file != null) - { - EmulatorWindows.SessionName = file.FullName; - Global.Config.RecentRomSessions.Add(file.FullName); - SaveSessionMenuItem_Click(sender, e); - UpdateMainText(); - } - } - } - - private FileInfo GetSaveFileFromUser() - { - var sfd = new SaveFileDialog(); - if (!string.IsNullOrWhiteSpace(EmulatorWindows.SessionName)) - { - sfd.FileName = Path.GetFileNameWithoutExtension(EmulatorWindows.SessionName); - sfd.InitialDirectory = Path.GetDirectoryName(EmulatorWindows.SessionName); - } - else if (EmulatorWindows.Master != null) - { - sfd.FileName = PathManager.FilesystemSafeName(EmulatorWindows.Master.Game); - sfd.InitialDirectory = PathManager.GetRomsPath("Global"); - } - else - { - sfd.FileName = "NULL"; - sfd.InitialDirectory = PathManager.GetRomsPath("Global"); - } - - sfd.Filter = "Rom Session Files (*.romses)|*.romses|All Files|*.*"; - sfd.RestoreDirectory = true; - var result = sfd.ShowDialog(); - if (result != DialogResult.OK) - { - return null; - } - - return new FileInfo(sfd.FileName); - } - - private void OpenSessionMenuItem_Click(object sender, EventArgs e) - { - var file = GetFileFromUser("Rom Session Files (*.romses)|*.romses|All Files|*.*"); - if (file != null) - { - NewSessionMenuItem_Click(null, null); - var json = File.ReadAllText(file.FullName); - EmulatorWindows.SessionName = file.FullName; - LoadRomSession(EmulatorWindowList.FromJson(json)); - Global.Config.RecentRomSessions.Add(file.FullName); - UpdateMainText(); - } - } - - private void UpdateMainText() - { - string text = "MultiHawk"; - - if (!string.IsNullOrWhiteSpace(EmulatorWindows.SessionName)) - { - text += " - " + Path.GetFileNameWithoutExtension(EmulatorWindows.SessionName); - } - - if (Global.MovieSession.Movie.IsActive) - { - text += " - " + Path.GetFileNameWithoutExtension(Global.MovieSession.Movie.Filename); - } - - Text = text; - } - - private static FileInfo GetFileFromUser(string filter) - { - var ofd = new OpenFileDialog - { - InitialDirectory = PathManager.GetRomsPath("Global"), - Filter = filter, - RestoreDirectory = true - }; - - if (!Directory.Exists(ofd.InitialDirectory)) - { - Directory.CreateDirectory(ofd.InitialDirectory); - } - - var result = ofd.ShowDialog(); - return result == DialogResult.OK ? new FileInfo(ofd.FileName) : null; - } - - private void CloseAllWindows() - { - foreach (var ew in EmulatorWindows) - { - ew.Close(); - } - - EmulatorWindows.Clear(); - } - - private void NewSessionMenuItem_Click(object sender, EventArgs e) - { - foreach (var ew in EmulatorWindows) - { - ew.Close(); - } - - EmulatorWindows.Clear(); - UpdateMainText(); - } - - private void LoadRomSession(IEnumerable entries) - { - foreach (var entry in entries) - { - LoadRom(entry.RomName); - EmulatorWindows.Last().Location = new Point(entry.Wndx, entry.Wndy); - UpdateMainText(); - } - } - - private void LoadRomSessionFromRecent(string path) - { - var file = new FileInfo(path); - if (file.Exists) - { - NewSessionMenuItem_Click(null, null); - var json = File.ReadAllText(file.FullName); - EmulatorWindows.SessionName = file.FullName; - LoadRomSession(EmulatorWindowList.FromJson(json)); - Global.Config.RecentRomSessions.Add(file.FullName); - UpdateMainText(); - } - else - { - Global.Config.RecentRomSessions.HandleLoadError(path); - } - } - - private void RecentSessionSubMenu_DropDownOpened(object sender, EventArgs e) - { - RecentSessionSubMenu.DropDownItems.Clear(); - RecentSessionSubMenu.DropDownItems.AddRange( - Global.Config.RecentRomSessions.RecentMenu(LoadRomSessionFromRecent, autoload: true)); - } - - private void RecentRomSubMenu_DropDownOpened(object sender, EventArgs e) - { - RecentRomSubMenu.DropDownItems.Clear(); - RecentRomSubMenu.DropDownItems.AddRange( - Global.Config.RecentRoms.RecentMenu(LoadRomFromRecent, autoload: false)); - } - - private void ViewSubMenu_DropDownOpened(object sender, EventArgs e) - { - _1xMenuItem.Checked = Global.Config.TargetZoomFactors[Emulator.SystemId] == 1; - _2xMenuItem.Checked = Global.Config.TargetZoomFactors[Emulator.SystemId] == 2; - _3xMenuItem.Checked = Global.Config.TargetZoomFactors[Emulator.SystemId] == 3; - _4xMenuItem.Checked = Global.Config.TargetZoomFactors[Emulator.SystemId] == 4; - } - - private void _1xMenuItem_Click(object sender, EventArgs e) - { - Global.Config.TargetZoomFactors[Emulator.SystemId] = 1; - ReRenderAllWindows(); - } - - private void _2xMenuItem_Click(object sender, EventArgs e) - { - Global.Config.TargetZoomFactors[Emulator.SystemId] = 2; - ReRenderAllWindows(); - } - - private void _3xMenuItem_Click(object sender, EventArgs e) - { - Global.Config.TargetZoomFactors[Emulator.SystemId] = 3; - ReRenderAllWindows(); - } - - private void _4xMenuItem_Click(object sender, EventArgs e) - { - Global.Config.TargetZoomFactors[Emulator.SystemId] = 4; - ReRenderAllWindows(); - } - - private void ReRenderAllWindows() - { - foreach (var ew in EmulatorWindows) - { - ew.FrameBufferResized(); - ew.Render(); - } - } - - private void LoadLastMovieMenuItem_Click(object sender, EventArgs e) - { - LoadMoviesFromRecent(Global.Config.RecentMovies.MostRecent); - } - - private void contextMenuStrip1_Opening(object sender, CancelEventArgs e) - { - LoadLastMovieContextMenuItem.Visible = !Global.Config.RecentMovies.Empty; - PlayMovieContextMenuItem.Visible = - RecordMovieContextMenuItem.Visible = - !Global.MovieSession.Movie.IsActive; - - StopMovieContextMenuItem.Visible = - RestartMovieContextMenuItem.Visible = - Global.MovieSession.Movie.IsActive; - - } - - private void RecentMovieSubMenu_DropDownOpened(object sender, EventArgs e) - { - RecentMovieSubMenu.DropDownItems.Clear(); - RecentMovieSubMenu.DropDownItems.AddRange( - Global.Config.RecentMovies.RecentMenu(LoadMoviesFromRecent, autoload: true)); - } - - private void RestartMovieMenuItem_Click(object sender, EventArgs e) - { - if (Global.MovieSession.Movie.IsActive) - { - StartNewMovie(Global.MovieSession.Movie, false); - AddMessage("Replaying movie file in read-only mode"); - } - } - } -} diff --git a/BizHawk.Client.MultiHawk/Mainform.resx b/BizHawk.Client.MultiHawk/Mainform.resx deleted file mode 100644 index bdf629369a..0000000000 --- a/BizHawk.Client.MultiHawk/Mainform.resx +++ /dev/null @@ -1,132 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - 17, 17 - - - 153, 17 - - - 153, 17 - - - 283, 17 - - \ No newline at end of file diff --git a/BizHawk.Client.MultiHawk/PresentationPanel.cs b/BizHawk.Client.MultiHawk/PresentationPanel.cs deleted file mode 100644 index 881f13960a..0000000000 --- a/BizHawk.Client.MultiHawk/PresentationPanel.cs +++ /dev/null @@ -1,64 +0,0 @@ -using System; -using System.Drawing; -using sd=System.Drawing; -using sysdrawingfont=System.Drawing.Font; -using sysdrawing2d=System.Drawing.Drawing2D; -using System.IO; -using System.Threading; -using System.Windows.Forms; -#if WINDOWS -using SlimDX; -#endif - -using BizHawk.Client.Common; -using BizHawk.Bizware.BizwareGL; - -using OpenTK.Graphics.OpenGL; - -namespace BizHawk.Client.MultiHawk -{ - /// - /// Thinly wraps a BizwareGL.GraphicsControl for EmuHawk's needs - /// - public class PresentationPanel - { - public PresentationPanel(Form parent, IGL gl) - { - GL = gl; - - GraphicsControl = new GraphicsControl(GL); - GraphicsControl.Dock = DockStyle.Fill; - GraphicsControl.BackColor = Color.Black; - - //pass through these events to the form. we might need a more scalable solution for mousedown etc. for zapper and whatnot. - //http://stackoverflow.com/questions/547172/pass-through-mouse-events-to-parent-control (HTTRANSPARENT) - - // TODO - //GraphicsControl.MouseClick += (o, e) => GlobalWin.MainForm.MainForm_MouseClick(o, e); - } - - bool IsDisposed = false; - public void Dispose() - { - if (IsDisposed) return; - IsDisposed = true; - GraphicsControl.Dispose(); - } - - //graphics resources - public IGL GL { get; set; } - public GraphicsControl GraphicsControl; - - public Control Control { get { return GraphicsControl; } } - public static implicit operator Control(PresentationPanel self) { return self.GraphicsControl; } - - public bool Resized { get; set; } - - public Size NativeSize { get { return GraphicsControl.ClientSize; } } - } - - - - public interface IBlitterFont { } - -} diff --git a/BizHawk.Client.MultiHawk/Program.cs b/BizHawk.Client.MultiHawk/Program.cs deleted file mode 100644 index 9ee5ddddc7..0000000000 --- a/BizHawk.Client.MultiHawk/Program.cs +++ /dev/null @@ -1,171 +0,0 @@ -using System; -using System.IO; -using System.Collections.Generic; -using System.Reflection; -using System.Runtime.InteropServices; -using System.Windows.Forms; -#if WINDOWS -using SlimDX.DirectSound; -using Microsoft.VisualBasic.ApplicationServices; -#endif - -using BizHawk.Common; -using BizHawk.Client.Common; - -namespace BizHawk.Client.MultiHawk -{ - static class Program - { - static Program() - { - //http://www.codeproject.com/Articles/310675/AppDomain-AssemblyResolve-Event-Tips -#if WINDOWS - // this will look in subdirectory "dll" to load pinvoked stuff - string dllDir = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "dll"); - SetDllDirectory(dllDir); - - //in case assembly resolution fails, such as if we moved them into the dll subdiretory, this event handler can reroute to them - AppDomain.CurrentDomain.AssemblyResolve += new ResolveEventHandler(CurrentDomain_AssemblyResolve); - - //but before we even try doing that, whack the MOTW from everything in that directory (thats a dll) - //otherwise, some people will have crashes at boot-up due to .net security disliking MOTW. - //some people are getting MOTW through a combination of browser used to download bizhawk, and program used to dearchive it - WhackAllMOTW(dllDir); -#endif - } - - - /// - /// The main entry point for the application. - /// - [STAThread] - static void Main(string[] args) - { - SubMain(args); - } - - - //NoInlining should keep this code from getting jammed into Main() which would create dependencies on types which havent been setup by the resolver yet... or something like that - [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)] - static void SubMain(string[] args) - { - Application.EnableVisualStyles(); - Application.SetCompatibleTextRenderingDefault(false); - string iniPath = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "config.ini"); - Global.Config = ConfigService.Load(iniPath); - Global.Config.ResolveDefaults(); - HawkFile.ArchiveHandlerFactory = new SevenZipSharpArchiveHandler(); - - //super hacky! this needs to be done first. still not worth the trouble to make this system fully proper - for (int i = 0; i < args.Length; i++) - { - var arg = args[i].ToLower(); - if (arg.StartsWith("--gdi")) - { - Global.Config.DispMethod = Config.EDispMethod.GdiPlus; - } - } - - - //WHY do we have to do this? some intel graphics drivers (ig7icd64.dll 10.18.10.3304 on an unknown chip on win8.1) are calling SetDllDirectory() for the process, which ruins stuff. - //The relevant initialization happened just before in "create IGL context". - //It isn't clear whether we need the earlier SetDllDirectory(), but I think we do. - //note: this is pasted instead of being put in a static method due to this initialization code being sensitive to things like that, and not wanting to cause it to break - //pasting should be safe (not affecting the jit order of things) - string dllDir = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "dll"); - SetDllDirectory(dllDir); - - try - { - using (var mf = new Mainform(args)) - { - var title = mf.Text; - mf.Show(); - mf.Text = title; - try - { - mf.ProgramRunLoop(); - } - catch (Exception e) when (Global.MovieSession.Movie.IsActive) - { - var result = MessageBox.Show( - "EmuHawk has thrown a fatal exception and is about to close.\nA movie has been detected. Would you like to try to save?\n(Note: Depending on what caused this error, this may or may not succeed)", - "Fatal error: " + e.GetType().Name, - MessageBoxButtons.YesNo, - MessageBoxIcon.Exclamation - ); - if (result == DialogResult.Yes) - { - Global.MovieSession.Movie.Save(); - } - } - } - } - catch (Exception e) - { - string message = e.ToString(); - if (e.InnerException != null) - { - message += "\n\nInner Exception:\n\n" + e.InnerException; - } - - message += "\n\nStackTrace:\n" + e.StackTrace; - MessageBox.Show(message); - } -#if WINDOWS - finally - { - GamePad.CloseAll(); - } -#endif - } - - - static Assembly CurrentDomain_AssemblyResolve(object sender, ResolveEventArgs args) - { - lock (AppDomain.CurrentDomain) - { - var asms = AppDomain.CurrentDomain.GetAssemblies(); - foreach (var asm in asms) - if (asm.FullName == args.Name) - return asm; - - //load missing assemblies by trying to find them in the dll directory - string dllname = new AssemblyName(args.Name).Name + ".dll"; - string directory = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "dll"); - string fname = Path.Combine(directory, dllname); - if (!File.Exists(fname)) return null; - //it is important that we use LoadFile here and not load from a byte array; otherwise mixed (managed/unamanged) assemblies can't load - return Assembly.LoadFile(fname); - } - } - - //declared here instead of a more usual place to avoid dependencies on the more usual place -#if WINDOWS - [DllImport("kernel32.dll", SetLastError = true)] - static extern uint SetDllDirectory(string lpPathName); - - [DllImport("kernel32.dll", EntryPoint = "DeleteFileW", SetLastError = true, CharSet = CharSet.Unicode, ExactSpelling = true)] - static extern bool DeleteFileW([MarshalAs(UnmanagedType.LPWStr)]string lpFileName); - static void RemoveMOTW(string path) - { - DeleteFileW(path + ":Zone.Identifier"); - } - - static void WhackAllMOTW(string dllDir) - { - var todo = new Queue(new[] { new DirectoryInfo(dllDir) }); - while (todo.Count > 0) - { - var di = todo.Dequeue(); - foreach (var disub in di.GetDirectories()) todo.Enqueue(disub); - foreach (var fi in di.GetFiles("*.dll")) - RemoveMOTW(fi.FullName); - foreach (var fi in di.GetFiles("*.exe")) - RemoveMOTW(fi.FullName); - } - - } -#endif - } -} diff --git a/BizHawk.Client.MultiHawk/Properties/AssemblyInfo.cs b/BizHawk.Client.MultiHawk/Properties/AssemblyInfo.cs deleted file mode 100644 index e0b3f137d4..0000000000 --- a/BizHawk.Client.MultiHawk/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,36 +0,0 @@ -using System.Reflection; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; - -// General Information about an assembly is controlled through the following -// set of attributes. Change these attribute values to modify the information -// associated with an assembly. -[assembly: AssemblyTitle("BizHawk.Client.MultiHawk")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("BizHawk.Client.MultiHawk")] -[assembly: AssemblyCopyright("Copyright © 2015")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -// Setting ComVisible to false makes the types in this assembly not visible -// to COM components. If you need to access a type in this assembly from -// COM, set the ComVisible attribute to true on that type. -[assembly: ComVisible(false)] - -// The following GUID is for the ID of the typelib if this project is exposed to COM -[assembly: Guid("fcf20c42-6452-46c7-bb88-bc9f5bd0ce71")] - -// Version information for an assembly consists of the following four values: -// -// Major Version -// Minor Version -// Build Number -// Revision -// -// You can specify all the values or you can default the Build and Revision Numbers -// by using the '*' as shown below: -// [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/BizHawk.Client.MultiHawk/Properties/Resources.Designer.cs b/BizHawk.Client.MultiHawk/Properties/Resources.Designer.cs deleted file mode 100644 index 3855218b5a..0000000000 --- a/BizHawk.Client.MultiHawk/Properties/Resources.Designer.cs +++ /dev/null @@ -1,293 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by a tool. -// Runtime Version:4.0.30319.34209 -// -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. -// -//------------------------------------------------------------------------------ - -namespace BizHawk.Client.MultiHawk.Properties { - using System; - - - /// - /// A strongly-typed resource class, for looking up localized strings, etc. - /// - // This class was auto-generated by the StronglyTypedResourceBuilder - // class via a tool like ResGen or Visual Studio. - // To add or remove a member, edit your .ResX file then rerun ResGen - // with the /str option, or rebuild your VS project. - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - internal class Resources { - - private static global::System.Resources.ResourceManager resourceMan; - - private static global::System.Globalization.CultureInfo resourceCulture; - - [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - internal Resources() { - } - - /// - /// Returns the cached ResourceManager instance used by this class. - /// - [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] - internal static global::System.Resources.ResourceManager ResourceManager { - get { - if (object.ReferenceEquals(resourceMan, null)) { - global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("BizHawk.Client.MultiHawk.Properties.Resources", typeof(Resources).Assembly); - resourceMan = temp; - } - return resourceMan; - } - } - - /// - /// Overrides the current thread's CurrentUICulture property for all - /// resource lookups using this strongly typed resource class. - /// - [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] - internal static global::System.Globalization.CultureInfo Culture { - get { - return resourceCulture; - } - set { - resourceCulture = value; - } - } - - /// - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// - internal static System.Drawing.Bitmap Blank { - get { - object obj = ResourceManager.GetObject("Blank", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Byte[]. - /// - internal static byte[] courier16px { - get { - object obj = ResourceManager.GetObject("courier16px", resourceCulture); - return ((byte[])(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// - internal static System.Drawing.Bitmap courier16px_0 { - get { - object obj = ResourceManager.GetObject("courier16px_0", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Byte[]. - /// - internal static byte[] courier16px1 { - get { - object obj = ResourceManager.GetObject("courier16px1", resourceCulture); - return ((byte[])(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// - internal static System.Drawing.Bitmap CutHS { - get { - object obj = ResourceManager.GetObject("CutHS", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// - internal static System.Drawing.Bitmap ExclamationRed { - get { - object obj = ResourceManager.GetObject("ExclamationRed", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// - internal static System.Drawing.Bitmap GameController { - get { - object obj = ResourceManager.GetObject("GameController", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// - internal static System.Drawing.Bitmap GreenCheck { - get { - object obj = ResourceManager.GetObject("GreenCheck", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// - internal static System.Drawing.Bitmap Help { - get { - object obj = ResourceManager.GetObject("Help", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// - internal static System.Drawing.Bitmap HotKeys { - get { - object obj = ResourceManager.GetObject("HotKeys", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// - internal static System.Drawing.Bitmap OpenFile { - get { - object obj = ResourceManager.GetObject("OpenFile", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// - internal static System.Drawing.Bitmap Pause { - get { - object obj = ResourceManager.GetObject("Pause", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// - internal static System.Drawing.Bitmap Play { - get { - object obj = ResourceManager.GetObject("Play", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// - internal static System.Drawing.Bitmap ReadOnly { - get { - object obj = ResourceManager.GetObject("ReadOnly", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// - internal static System.Drawing.Bitmap reboot { - get { - object obj = ResourceManager.GetObject("reboot", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// - internal static System.Drawing.Bitmap Recent { - get { - object obj = ResourceManager.GetObject("Recent", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// - internal static System.Drawing.Bitmap RecordHS { - get { - object obj = ResourceManager.GetObject("RecordHS", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// - internal static System.Drawing.Bitmap restart { - get { - object obj = ResourceManager.GetObject("restart", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// - internal static System.Drawing.Bitmap Save { - get { - object obj = ResourceManager.GetObject("Save", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// - internal static System.Drawing.Bitmap SaveAllHS { - get { - object obj = ResourceManager.GetObject("SaveAllHS", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// - internal static System.Drawing.Bitmap SaveAs { - get { - object obj = ResourceManager.GetObject("SaveAs", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// - internal static System.Drawing.Bitmap Scan { - get { - object obj = ResourceManager.GetObject("Scan", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// - internal static System.Drawing.Bitmap Stop { - get { - object obj = ResourceManager.GetObject("Stop", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - } -} diff --git a/BizHawk.Client.MultiHawk/Properties/Resources.resx b/BizHawk.Client.MultiHawk/Properties/Resources.resx deleted file mode 100644 index 88761a4c4d..0000000000 --- a/BizHawk.Client.MultiHawk/Properties/Resources.resx +++ /dev/null @@ -1,190 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - - ..\images\Blank.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Resources\courier16px.bmfc;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - ..\Resources\courier16px.fnt;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - ..\Resources\courier16px_0.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\images\CutHS.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\images\ExclamationRed.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\images\GreenCheck.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\images\OpenFile.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\images\Pause.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\images\Play.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\images\ReadOnly.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\images\reboot.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\images\Recent.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\images\RecordHS.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\images\SaveAllHS.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\images\SaveAs.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\images\Scan.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\images\Stop.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\images\GameController.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\images\Help.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\images\HotKeys.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\images\Save.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\images\restart.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - \ No newline at end of file diff --git a/BizHawk.Client.MultiHawk/Properties/Settings.Designer.cs b/BizHawk.Client.MultiHawk/Properties/Settings.Designer.cs deleted file mode 100644 index fb9499495c..0000000000 --- a/BizHawk.Client.MultiHawk/Properties/Settings.Designer.cs +++ /dev/null @@ -1,26 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by a tool. -// Runtime Version:4.0.30319.42000 -// -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. -// -//------------------------------------------------------------------------------ - -namespace BizHawk.Client.MultiHawk.Properties { - - - [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "14.0.0.0")] - internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { - - private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); - - public static Settings Default { - get { - return defaultInstance; - } - } - } -} diff --git a/BizHawk.Client.MultiHawk/Properties/Settings.settings b/BizHawk.Client.MultiHawk/Properties/Settings.settings deleted file mode 100644 index abf36c5d3d..0000000000 --- a/BizHawk.Client.MultiHawk/Properties/Settings.settings +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - diff --git a/BizHawk.Client.MultiHawk/Resources/courier16px.bmfc b/BizHawk.Client.MultiHawk/Resources/courier16px.bmfc deleted file mode 100644 index df09355333..0000000000 --- a/BizHawk.Client.MultiHawk/Resources/courier16px.bmfc +++ /dev/null @@ -1,55 +0,0 @@ -# AngelCode Bitmap Font Generator configuration file -fileVersion=1 - -# font settings -fontName=Courier -fontFile= -charSet=0 -fontSize=16 -aa=1 -scaleH=100 -useSmoothing=0 -isBold=1 -isItalic=0 -useUnicode=1 -disableBoxChars=1 -outputInvalidCharGlyph=1 -dontIncludeKerningPairs=0 -useHinting=1 -renderFromOutline=0 -useClearType=1 - -# character alignment -paddingDown=0 -paddingUp=0 -paddingRight=0 -paddingLeft=0 -spacingHoriz=1 -spacingVert=1 -useFixedHeight=0 -forceZero=0 - -# output file -outWidth=128 -outHeight=256 -outBitDepth=32 -fontDescFormat=1 -fourChnlPacked=0 -textureFormat=png -textureCompression=0 -alphaChnl=0 -redChnl=4 -greenChnl=4 -blueChnl=4 -invA=0 -invR=0 -invG=0 -invB=0 - -# outline -outlineThickness=0 - -# selected chars -chars=32-127,129,141,143-144,157,160-255 - -# imported icon images diff --git a/BizHawk.Client.MultiHawk/Resources/courier16px.fnt b/BizHawk.Client.MultiHawk/Resources/courier16px.fnt deleted file mode 100644 index 0e8d5e8a1f..0000000000 --- a/BizHawk.Client.MultiHawk/Resources/courier16px.fnt +++ /dev/null @@ -1,208 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/BizHawk.Client.MultiHawk/Resources/courier16px_0.png b/BizHawk.Client.MultiHawk/Resources/courier16px_0.png deleted file mode 100644 index 36d5051db4..0000000000 Binary files a/BizHawk.Client.MultiHawk/Resources/courier16px_0.png and /dev/null differ diff --git a/BizHawk.Client.MultiHawk/images/Blank.png b/BizHawk.Client.MultiHawk/images/Blank.png deleted file mode 100644 index c8d0a51cc0..0000000000 Binary files a/BizHawk.Client.MultiHawk/images/Blank.png and /dev/null differ diff --git a/BizHawk.Client.MultiHawk/images/CutHS.png b/BizHawk.Client.MultiHawk/images/CutHS.png deleted file mode 100644 index dd40e93a2a..0000000000 Binary files a/BizHawk.Client.MultiHawk/images/CutHS.png and /dev/null differ diff --git a/BizHawk.Client.MultiHawk/images/ExclamationRed.png b/BizHawk.Client.MultiHawk/images/ExclamationRed.png deleted file mode 100644 index e1e238ad30..0000000000 Binary files a/BizHawk.Client.MultiHawk/images/ExclamationRed.png and /dev/null differ diff --git a/BizHawk.Client.MultiHawk/images/GameController.png b/BizHawk.Client.MultiHawk/images/GameController.png deleted file mode 100644 index 3d0131cd16..0000000000 Binary files a/BizHawk.Client.MultiHawk/images/GameController.png and /dev/null differ diff --git a/BizHawk.Client.MultiHawk/images/GreenCheck.png b/BizHawk.Client.MultiHawk/images/GreenCheck.png deleted file mode 100644 index 9f243dcd9d..0000000000 Binary files a/BizHawk.Client.MultiHawk/images/GreenCheck.png and /dev/null differ diff --git a/BizHawk.Client.MultiHawk/images/Help.png b/BizHawk.Client.MultiHawk/images/Help.png deleted file mode 100644 index 30a424bbf1..0000000000 Binary files a/BizHawk.Client.MultiHawk/images/Help.png and /dev/null differ diff --git a/BizHawk.Client.MultiHawk/images/HotKeys.png b/BizHawk.Client.MultiHawk/images/HotKeys.png deleted file mode 100644 index 962eb51ed7..0000000000 Binary files a/BizHawk.Client.MultiHawk/images/HotKeys.png and /dev/null differ diff --git a/BizHawk.Client.MultiHawk/images/OpenFile.png b/BizHawk.Client.MultiHawk/images/OpenFile.png deleted file mode 100644 index 0bc670e2c0..0000000000 Binary files a/BizHawk.Client.MultiHawk/images/OpenFile.png and /dev/null differ diff --git a/BizHawk.Client.MultiHawk/images/Pause.png b/BizHawk.Client.MultiHawk/images/Pause.png deleted file mode 100644 index 206c71c233..0000000000 Binary files a/BizHawk.Client.MultiHawk/images/Pause.png and /dev/null differ diff --git a/BizHawk.Client.MultiHawk/images/Play.png b/BizHawk.Client.MultiHawk/images/Play.png deleted file mode 100644 index b8f7541b05..0000000000 Binary files a/BizHawk.Client.MultiHawk/images/Play.png and /dev/null differ diff --git a/BizHawk.Client.MultiHawk/images/ReadOnly.png b/BizHawk.Client.MultiHawk/images/ReadOnly.png deleted file mode 100644 index 119d155206..0000000000 Binary files a/BizHawk.Client.MultiHawk/images/ReadOnly.png and /dev/null differ diff --git a/BizHawk.Client.MultiHawk/images/Recent.png b/BizHawk.Client.MultiHawk/images/Recent.png deleted file mode 100644 index 42c559ad27..0000000000 Binary files a/BizHawk.Client.MultiHawk/images/Recent.png and /dev/null differ diff --git a/BizHawk.Client.MultiHawk/images/RecordHS.png b/BizHawk.Client.MultiHawk/images/RecordHS.png deleted file mode 100644 index 581741d36c..0000000000 Binary files a/BizHawk.Client.MultiHawk/images/RecordHS.png and /dev/null differ diff --git a/BizHawk.Client.MultiHawk/images/Save.png b/BizHawk.Client.MultiHawk/images/Save.png deleted file mode 100644 index 5ec0a2d762..0000000000 Binary files a/BizHawk.Client.MultiHawk/images/Save.png and /dev/null differ diff --git a/BizHawk.Client.MultiHawk/images/SaveAllHS.png b/BizHawk.Client.MultiHawk/images/SaveAllHS.png deleted file mode 100644 index 7bde10a6d2..0000000000 Binary files a/BizHawk.Client.MultiHawk/images/SaveAllHS.png and /dev/null differ diff --git a/BizHawk.Client.MultiHawk/images/SaveAs.png b/BizHawk.Client.MultiHawk/images/SaveAs.png deleted file mode 100644 index 5ca4d10623..0000000000 Binary files a/BizHawk.Client.MultiHawk/images/SaveAs.png and /dev/null differ diff --git a/BizHawk.Client.MultiHawk/images/Scan.png b/BizHawk.Client.MultiHawk/images/Scan.png deleted file mode 100644 index ea5e620d8f..0000000000 Binary files a/BizHawk.Client.MultiHawk/images/Scan.png and /dev/null differ diff --git a/BizHawk.Client.MultiHawk/images/Stop.png b/BizHawk.Client.MultiHawk/images/Stop.png deleted file mode 100644 index ef00c0f811..0000000000 Binary files a/BizHawk.Client.MultiHawk/images/Stop.png and /dev/null differ diff --git a/BizHawk.Client.MultiHawk/images/reboot.png b/BizHawk.Client.MultiHawk/images/reboot.png deleted file mode 100644 index 2d355ac56c..0000000000 Binary files a/BizHawk.Client.MultiHawk/images/reboot.png and /dev/null differ diff --git a/BizHawk.Client.MultiHawk/images/restart.png b/BizHawk.Client.MultiHawk/images/restart.png deleted file mode 100644 index 89eebbbd04..0000000000 Binary files a/BizHawk.Client.MultiHawk/images/restart.png and /dev/null differ diff --git a/BizHawk.Client.MultiHawk/movie/PlayMovie.Designer.cs b/BizHawk.Client.MultiHawk/movie/PlayMovie.Designer.cs deleted file mode 100644 index 39e0289bb3..0000000000 --- a/BizHawk.Client.MultiHawk/movie/PlayMovie.Designer.cs +++ /dev/null @@ -1,406 +0,0 @@ -namespace BizHawk.Client.MultiHawk -{ - partial class PlayMovie - { - /// - /// Required designer variable. - /// - private System.ComponentModel.IContainer components = null; - - /// - /// Clean up any resources being used. - /// - /// true if managed resources should be disposed; otherwise, false. - protected override void Dispose(bool disposing) - { - if (disposing && (components != null)) - { - components.Dispose(); - } - base.Dispose(disposing); - } - - #region Windows Form Designer generated code - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - private void InitializeComponent() - { - this.components = new System.ComponentModel.Container(); - System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(PlayMovie)); - this.Cancel = new System.Windows.Forms.Button(); - this.OK = new System.Windows.Forms.Button(); - this.BrowseMovies = new System.Windows.Forms.Button(); - this.DetailsView = new System.Windows.Forms.ListView(); - this.columnHeader5 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); - this.columnHeader6 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); - this.groupBox1 = new System.Windows.Forms.GroupBox(); - this.SubtitlesBtn = new System.Windows.Forms.Button(); - this.CommentsBtn = new System.Windows.Forms.Button(); - this.MovieCount = new System.Windows.Forms.Label(); - this.ReadOnlyCheckBox = new System.Windows.Forms.CheckBox(); - this.IncludeSubDirectories = new System.Windows.Forms.CheckBox(); - this.Scan = new System.Windows.Forms.Button(); - this.toolTip1 = new System.Windows.Forms.ToolTip(this.components); - this.MatchHashCheckBox = new System.Windows.Forms.CheckBox(); - this.contextMenuStrip1 = new System.Windows.Forms.ContextMenuStrip(this.components); - this.editToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.StopOnFrameCheckbox = new System.Windows.Forms.CheckBox(); - this.StopOnFrameTextBox = new BizHawk.Client.EmuHawk.WatchValueBox(); - this.MovieView = new BizHawk.Client.EmuHawk.VirtualListView(); - this.columnHeader1 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); - this.columnHeader2 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); - this.columnHeader3 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); - this.columnHeader4 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); - this.LastFrameCheckbox = new System.Windows.Forms.CheckBox(); - this.TurboCheckbox = new System.Windows.Forms.CheckBox(); - this.groupBox1.SuspendLayout(); - this.contextMenuStrip1.SuspendLayout(); - this.SuspendLayout(); - // - // Cancel - // - this.Cancel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); - this.Cancel.DialogResult = System.Windows.Forms.DialogResult.Cancel; - this.Cancel.Location = new System.Drawing.Point(687, 363); - this.Cancel.Name = "Cancel"; - this.Cancel.Size = new System.Drawing.Size(75, 23); - this.Cancel.TabIndex = 55; - this.Cancel.Text = "&Cancel"; - this.Cancel.UseVisualStyleBackColor = true; - this.Cancel.Click += new System.EventHandler(this.Cancel_Click); - // - // OK - // - this.OK.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); - this.OK.Location = new System.Drawing.Point(606, 363); - this.OK.Name = "OK"; - this.OK.Size = new System.Drawing.Size(75, 23); - this.OK.TabIndex = 50; - this.OK.Text = "&OK"; - this.toolTip1.SetToolTip(this.OK, "Load selected movie"); - this.OK.UseVisualStyleBackColor = true; - this.OK.Click += new System.EventHandler(this.Ok_Click); - // - // BrowseMovies - // - this.BrowseMovies.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); - this.BrowseMovies.Image = global::BizHawk.Client.MultiHawk.Properties.Resources.OpenFile; - this.BrowseMovies.Location = new System.Drawing.Point(12, 364); - this.BrowseMovies.Name = "BrowseMovies"; - this.BrowseMovies.Size = new System.Drawing.Size(31, 23); - this.BrowseMovies.TabIndex = 25; - this.toolTip1.SetToolTip(this.BrowseMovies, "Browse for additional movie files"); - this.BrowseMovies.UseVisualStyleBackColor = true; - this.BrowseMovies.Click += new System.EventHandler(this.BrowseMovies_Click); - // - // DetailsView - // - this.DetailsView.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) - | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this.DetailsView.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] { - this.columnHeader5, - this.columnHeader6}); - this.DetailsView.FullRowSelect = true; - this.DetailsView.GridLines = true; - this.DetailsView.HideSelection = false; - this.DetailsView.Location = new System.Drawing.Point(15, 19); - this.DetailsView.Name = "DetailsView"; - this.DetailsView.Size = new System.Drawing.Size(228, 261); - this.DetailsView.TabIndex = 10; - this.toolTip1.SetToolTip(this.DetailsView, "Contains the header information for the selected movie"); - this.DetailsView.UseCompatibleStateImageBehavior = false; - this.DetailsView.View = System.Windows.Forms.View.Details; - this.DetailsView.ColumnClick += new System.Windows.Forms.ColumnClickEventHandler(this.DetailsView_ColumnClick); - // - // columnHeader5 - // - this.columnHeader5.Text = "Header"; - this.columnHeader5.Width = 102; - // - // columnHeader6 - // - this.columnHeader6.Text = "Value"; - this.columnHeader6.Width = 121; - // - // groupBox1 - // - this.groupBox1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); - this.groupBox1.Controls.Add(this.SubtitlesBtn); - this.groupBox1.Controls.Add(this.CommentsBtn); - this.groupBox1.Controls.Add(this.DetailsView); - this.groupBox1.Location = new System.Drawing.Point(503, 28); - this.groupBox1.Name = "groupBox1"; - this.groupBox1.Size = new System.Drawing.Size(259, 322); - this.groupBox1.TabIndex = 6; - this.groupBox1.TabStop = false; - this.groupBox1.Text = "Details"; - // - // SubtitlesBtn - // - this.SubtitlesBtn.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); - this.SubtitlesBtn.Enabled = false; - this.SubtitlesBtn.Location = new System.Drawing.Point(125, 286); - this.SubtitlesBtn.Name = "SubtitlesBtn"; - this.SubtitlesBtn.Size = new System.Drawing.Size(75, 23); - this.SubtitlesBtn.TabIndex = 20; - this.SubtitlesBtn.Text = "Subtitles"; - this.SubtitlesBtn.UseVisualStyleBackColor = true; - this.SubtitlesBtn.Click += new System.EventHandler(this.SubtitlesBtn_Click); - // - // CommentsBtn - // - this.CommentsBtn.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); - this.CommentsBtn.Enabled = false; - this.CommentsBtn.Location = new System.Drawing.Point(15, 286); - this.CommentsBtn.Name = "CommentsBtn"; - this.CommentsBtn.Size = new System.Drawing.Size(75, 23); - this.CommentsBtn.TabIndex = 15; - this.CommentsBtn.Text = "Comments"; - this.CommentsBtn.UseVisualStyleBackColor = true; - this.CommentsBtn.Click += new System.EventHandler(this.CommentsBtn_Click); - // - // MovieCount - // - this.MovieCount.AutoSize = true; - this.MovieCount.Location = new System.Drawing.Point(12, 9); - this.MovieCount.Name = "MovieCount"; - this.MovieCount.Size = new System.Drawing.Size(31, 13); - this.MovieCount.TabIndex = 7; - this.MovieCount.Text = " "; - // - // ReadOnlyCheckBox - // - this.ReadOnlyCheckBox.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); - this.ReadOnlyCheckBox.AutoSize = true; - this.ReadOnlyCheckBox.Checked = true; - this.ReadOnlyCheckBox.CheckState = System.Windows.Forms.CheckState.Checked; - this.ReadOnlyCheckBox.Location = new System.Drawing.Point(503, 367); - this.ReadOnlyCheckBox.Name = "ReadOnlyCheckBox"; - this.ReadOnlyCheckBox.Size = new System.Drawing.Size(74, 17); - this.ReadOnlyCheckBox.TabIndex = 45; - this.ReadOnlyCheckBox.Text = "Read only"; - this.ReadOnlyCheckBox.UseVisualStyleBackColor = true; - // - // IncludeSubDirectories - // - this.IncludeSubDirectories.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); - this.IncludeSubDirectories.AutoSize = true; - this.IncludeSubDirectories.Location = new System.Drawing.Point(94, 375); - this.IncludeSubDirectories.Name = "IncludeSubDirectories"; - this.IncludeSubDirectories.Size = new System.Drawing.Size(131, 17); - this.IncludeSubDirectories.TabIndex = 35; - this.IncludeSubDirectories.Text = "Include Subdirectories"; - this.IncludeSubDirectories.UseVisualStyleBackColor = true; - this.IncludeSubDirectories.CheckedChanged += new System.EventHandler(this.IncludeSubDirectories_CheckedChanged); - // - // Scan - // - this.Scan.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); - this.Scan.Image = global::BizHawk.Client.MultiHawk.Properties.Resources.Scan; - this.Scan.Location = new System.Drawing.Point(49, 364); - this.Scan.Name = "Scan"; - this.Scan.Size = new System.Drawing.Size(27, 23); - this.Scan.TabIndex = 30; - this.toolTip1.SetToolTip(this.Scan, "Rescan Movie folder for movie files"); - this.Scan.UseVisualStyleBackColor = true; - this.Scan.Click += new System.EventHandler(this.Scan_Click); - // - // MatchHashCheckBox - // - this.MatchHashCheckBox.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); - this.MatchHashCheckBox.AutoSize = true; - this.MatchHashCheckBox.Location = new System.Drawing.Point(94, 357); - this.MatchHashCheckBox.Name = "MatchHashCheckBox"; - this.MatchHashCheckBox.Size = new System.Drawing.Size(147, 17); - this.MatchHashCheckBox.TabIndex = 56; - this.MatchHashCheckBox.Text = "Match current game hash"; - this.MatchHashCheckBox.UseVisualStyleBackColor = true; - this.MatchHashCheckBox.CheckedChanged += new System.EventHandler(this.MatchHashCheckBox_CheckedChanged); - // - // contextMenuStrip1 - // - this.contextMenuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { - this.editToolStripMenuItem}); - this.contextMenuStrip1.Name = "contextMenuStrip1"; - this.contextMenuStrip1.Size = new System.Drawing.Size(93, 26); - // - // editToolStripMenuItem - // - this.editToolStripMenuItem.Image = global::BizHawk.Client.MultiHawk.Properties.Resources.CutHS; - this.editToolStripMenuItem.Name = "editToolStripMenuItem"; - this.editToolStripMenuItem.Size = new System.Drawing.Size(92, 22); - this.editToolStripMenuItem.Text = "&Edit"; - this.editToolStripMenuItem.Click += new System.EventHandler(this.EditMenuItem_Click); - // - // StopOnFrameCheckbox - // - this.StopOnFrameCheckbox.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); - this.StopOnFrameCheckbox.AutoSize = true; - this.StopOnFrameCheckbox.Location = new System.Drawing.Point(342, 357); - this.StopOnFrameCheckbox.Name = "StopOnFrameCheckbox"; - this.StopOnFrameCheckbox.Size = new System.Drawing.Size(95, 17); - this.StopOnFrameCheckbox.TabIndex = 57; - this.StopOnFrameCheckbox.Text = "Stop on frame:"; - this.StopOnFrameCheckbox.UseVisualStyleBackColor = true; - this.StopOnFrameCheckbox.CheckedChanged += new System.EventHandler(this.StopOnFrameCheckbox_CheckedChanged); - // - // StopOnFrameTextBox - // - this.StopOnFrameTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); - this.StopOnFrameTextBox.ByteSize = BizHawk.Client.Common.WatchSize.DWord; - this.StopOnFrameTextBox.CharacterCasing = System.Windows.Forms.CharacterCasing.Upper; - this.StopOnFrameTextBox.Location = new System.Drawing.Point(438, 355); - this.StopOnFrameTextBox.MaxLength = 10; - this.StopOnFrameTextBox.Name = "StopOnFrameTextBox"; - this.StopOnFrameTextBox.Nullable = true; - this.StopOnFrameTextBox.Size = new System.Drawing.Size(54, 20); - this.StopOnFrameTextBox.TabIndex = 58; - this.StopOnFrameTextBox.Type = BizHawk.Client.Common.DisplayType.Unsigned; - this.StopOnFrameTextBox.TextChanged += new System.EventHandler(this.StopOnFrameTextBox_TextChanged_1); - // - // MovieView - // - this.MovieView.AllowDrop = true; - this.MovieView.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this.MovieView.BlazingFast = false; - this.MovieView.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] { - this.columnHeader1, - this.columnHeader2, - this.columnHeader3, - this.columnHeader4}); - this.MovieView.ContextMenuStrip = this.contextMenuStrip1; - this.MovieView.FullRowSelect = true; - this.MovieView.GridLines = true; - this.MovieView.HideSelection = false; - this.MovieView.ItemCount = 0; - this.MovieView.Location = new System.Drawing.Point(12, 28); - this.MovieView.MultiSelect = false; - this.MovieView.Name = "MovieView"; - this.MovieView.SelectAllInProgress = false; - this.MovieView.selectedItem = -1; - this.MovieView.Size = new System.Drawing.Size(480, 322); - this.MovieView.TabIndex = 5; - this.MovieView.UseCompatibleStateImageBehavior = false; - this.MovieView.UseCustomBackground = true; - this.MovieView.View = System.Windows.Forms.View.Details; - this.MovieView.ColumnClick += new System.Windows.Forms.ColumnClickEventHandler(this.MovieView_ColumnClick); - this.MovieView.SelectedIndexChanged += new System.EventHandler(this.MovieView_SelectedIndexChanged); - this.MovieView.DragDrop += new System.Windows.Forms.DragEventHandler(this.MovieView_DragDrop); - this.MovieView.DragEnter += new System.Windows.Forms.DragEventHandler(this.MovieView_DragEnter); - this.MovieView.DoubleClick += new System.EventHandler(this.MovieView_DoubleClick); - this.MovieView.KeyDown += new System.Windows.Forms.KeyEventHandler(this.MovieView_KeyDown); - // - // columnHeader1 - // - this.columnHeader1.Text = "File"; - this.columnHeader1.Width = 221; - // - // columnHeader2 - // - this.columnHeader2.Text = "SysID"; - this.columnHeader2.Width = 43; - // - // columnHeader3 - // - this.columnHeader3.Text = "Game"; - this.columnHeader3.Width = 129; - // - // columnHeader4 - // - this.columnHeader4.Text = "Length (est.)"; - this.columnHeader4.Width = 82; - // - // LastFrameCheckbox - // - this.LastFrameCheckbox.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); - this.LastFrameCheckbox.AutoSize = true; - this.LastFrameCheckbox.Location = new System.Drawing.Point(342, 376); - this.LastFrameCheckbox.Name = "LastFrameCheckbox"; - this.LastFrameCheckbox.Size = new System.Drawing.Size(75, 17); - this.LastFrameCheckbox.TabIndex = 59; - this.LastFrameCheckbox.Text = "Last frame"; - this.LastFrameCheckbox.UseVisualStyleBackColor = true; - this.LastFrameCheckbox.CheckedChanged += new System.EventHandler(this.LastFrameCheckbox_CheckedChanged); - // - // TurboCheckbox - // - this.TurboCheckbox.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); - this.TurboCheckbox.AutoSize = true; - this.TurboCheckbox.Location = new System.Drawing.Point(438, 376); - this.TurboCheckbox.Name = "TurboCheckbox"; - this.TurboCheckbox.Size = new System.Drawing.Size(54, 17); - this.TurboCheckbox.TabIndex = 60; - this.TurboCheckbox.Text = "Turbo"; - this.TurboCheckbox.UseVisualStyleBackColor = true; - // - // PlayMovie - // - this.AcceptButton = this.OK; - this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.CancelButton = this.Cancel; - this.ClientSize = new System.Drawing.Size(774, 398); - this.Controls.Add(this.TurboCheckbox); - this.Controls.Add(this.LastFrameCheckbox); - this.Controls.Add(this.StopOnFrameTextBox); - this.Controls.Add(this.StopOnFrameCheckbox); - this.Controls.Add(this.MatchHashCheckBox); - this.Controls.Add(this.Scan); - this.Controls.Add(this.IncludeSubDirectories); - this.Controls.Add(this.ReadOnlyCheckBox); - this.Controls.Add(this.MovieCount); - this.Controls.Add(this.groupBox1); - this.Controls.Add(this.MovieView); - this.Controls.Add(this.BrowseMovies); - this.Controls.Add(this.OK); - this.Controls.Add(this.Cancel); - this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); - this.MaximizeBox = false; - this.MinimizeBox = false; - this.MinimumSize = new System.Drawing.Size(547, 228); - this.Name = "PlayMovie"; - this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; - this.Text = "Play Movie"; - this.Load += new System.EventHandler(this.PlayMovie_Load); - this.groupBox1.ResumeLayout(false); - this.contextMenuStrip1.ResumeLayout(false); - this.ResumeLayout(false); - this.PerformLayout(); - - } - - #endregion - - private System.Windows.Forms.Button Cancel; - private System.Windows.Forms.Button OK; - private System.Windows.Forms.Button BrowseMovies; - private BizHawk.Client.EmuHawk.VirtualListView MovieView; - private System.Windows.Forms.ColumnHeader columnHeader1; - private System.Windows.Forms.ColumnHeader columnHeader2; - private System.Windows.Forms.ColumnHeader columnHeader3; - private System.Windows.Forms.ColumnHeader columnHeader4; - private System.Windows.Forms.ListView DetailsView; - private System.Windows.Forms.ColumnHeader columnHeader5; - private System.Windows.Forms.ColumnHeader columnHeader6; - private System.Windows.Forms.GroupBox groupBox1; - private System.Windows.Forms.Button SubtitlesBtn; - private System.Windows.Forms.Button CommentsBtn; - private System.Windows.Forms.Label MovieCount; - private System.Windows.Forms.CheckBox ReadOnlyCheckBox; - private System.Windows.Forms.CheckBox IncludeSubDirectories; - private System.Windows.Forms.Button Scan; - private System.Windows.Forms.ToolTip toolTip1; - private System.Windows.Forms.CheckBox MatchHashCheckBox; - private System.Windows.Forms.ContextMenuStrip contextMenuStrip1; - private System.Windows.Forms.ToolStripMenuItem editToolStripMenuItem; - private System.Windows.Forms.CheckBox StopOnFrameCheckbox; - private BizHawk.Client.EmuHawk.WatchValueBox StopOnFrameTextBox; - private System.Windows.Forms.CheckBox LastFrameCheckbox; - private System.Windows.Forms.CheckBox TurboCheckbox; - } -} \ No newline at end of file diff --git a/BizHawk.Client.MultiHawk/movie/PlayMovie.cs b/BizHawk.Client.MultiHawk/movie/PlayMovie.cs deleted file mode 100644 index 279ce50ee4..0000000000 --- a/BizHawk.Client.MultiHawk/movie/PlayMovie.cs +++ /dev/null @@ -1,673 +0,0 @@ -using System; -using System.Threading.Tasks; -using System.Collections.Generic; -using System.Drawing; -using System.IO; -using System.Linq; -using System.Text; -using System.Windows.Forms; - -using BizHawk.Client.Common; -using BizHawk.Common; -using BizHawk.Client.EmuHawk; -namespace BizHawk.Client.MultiHawk -{ - public partial class PlayMovie : Form - { - private readonly PlatformFrameRates PlatformFrameRates = new PlatformFrameRates(); - - private List _movieList = new List(); - private bool _sortReverse; - private string _sortedCol; - - private bool _sortDetailsReverse; - private string _sortedDetailsCol; - - public PlayMovie() - { - InitializeComponent(); - MovieView.QueryItemText += MovieView_QueryItemText; - MovieView.VirtualMode = true; - _sortReverse = false; - _sortedCol = ""; - - _sortDetailsReverse = false; - _sortedDetailsCol = ""; - } - - private void PlayMovie_Load(object sender, EventArgs e) - { - IncludeSubDirectories.Checked = Global.Config.PlayMovie_IncludeSubdir; - MatchHashCheckBox.Checked = Global.Config.PlayMovie_MatchHash; - ScanFiles(); - PreHighlightMovie(); - TurboCheckbox.Checked = Global.Config.TurboSeek; - } - - private void MovieView_QueryItemText(int index, int column, out string text) - { - text = ""; - if (column == 0) // File - { - text = Path.GetFileName(_movieList[index].Filename); - } - - if (column == 1) // System - { - text = _movieList[index].SystemID; - } - - if (column == 2) // Game - { - text = _movieList[index].GameName; - } - - if (column == 3) // Time - { - text = PlatformFrameRates.MovieTime(_movieList[index]).ToString(@"hh\:mm\:ss\.fff"); - } - } - - private void Run() - { - var indices = MovieView.SelectedIndices; - if (indices.Count > 0) // Import file if necessary - { - GlobalWin.MainForm.StartNewMovie(_movieList[MovieView.SelectedIndices[0]], false); - } - } - - private int? AddMovieToList(string filename, bool force) - { - using (var file = new HawkFile(filename)) - { - if (!file.Exists) - { - return null; - } - - var index = IsDuplicateOf(filename); - if (!index.HasValue) - { - //System.Diagnostics.Stopwatch watch = new System.Diagnostics.Stopwatch(); watch.Start(); - var movie = PreLoadMovieFile(file, force); - if (movie == null) - { - return null; - } - //watch.Stop(); Console.WriteLine("[{0}] {1}",watch.ElapsedMilliseconds,Path.GetFileName(filename)); - - lock (_movieList) - { - _movieList.Add(movie); - index = _movieList.Count - 1; - } - - _sortReverse = false; - _sortedCol = ""; - } - - return index; - } - - } - - private int? IsDuplicateOf(string filename) - { - for (var i = 0; i < _movieList.Count; i++) - { - if (_movieList[i].Filename == filename) - { - return i; - } - } - - return null; - } - - private IMovie PreLoadMovieFile(HawkFile hf, bool force) - { - var movie = MovieService.Get(hf.CanonicalFullPath); - - try - { - movie.PreLoadHeaderAndLength(hf); - - // Don't do this from browse - if (movie.Hash == Global.Game.Hash || - Global.Config.PlayMovie_MatchHash == false || force) - { - return movie; - } - } - catch (Exception ex) - { - // TODO: inform the user that a movie failed to parse in some way - Console.WriteLine(ex.Message); - } - - return null; - } - - private void UpdateList() - { - MovieView.Refresh(); - MovieCount.Text = _movieList.Count + " movie" - + (_movieList.Count != 1 ? "s" : ""); - } - - private void PreHighlightMovie() - { - if (Global.Game == null) - { - return; - } - - var indices = new List(); - - // Pull out matching names - for (var i = 0; i < _movieList.Count; i++) - { - if (PathManager.FilesystemSafeName(Global.Game) == _movieList[i].GameName) - { - indices.Add(i); - } - } - - if (indices.Count == 0) - { - return; - } - - if (indices.Count == 1) - { - HighlightMovie(indices[0]); - return; - } - - // Prefer tas files - var tas = new List(); - for (var i = 0; i < indices.Count; i++) - { - foreach (var ext in MovieService.MovieExtensions) - { - if (Path.GetExtension(_movieList[indices[i]].Filename).ToUpper() == "." + ext) - { - tas.Add(i); - } - } - } - - if (tas.Count == 1) - { - HighlightMovie(tas[0]); - return; - } - - if (tas.Count > 1) - { - indices = new List(tas); - } - - // Final tie breaker - Last used file - var file = new FileInfo(_movieList[indices[0]].Filename); - var time = file.LastAccessTime; - var mostRecent = indices.First(); - for (var i = 1; i < indices.Count; i++) - { - file = new FileInfo(_movieList[indices[0]].Filename); - if (file.LastAccessTime > time) - { - time = file.LastAccessTime; - mostRecent = indices[i]; - } - } - - HighlightMovie(mostRecent); - return; - } - - private void HighlightMovie(int index) - { - MovieView.SelectedIndices.Clear(); - MovieView.setSelection(index); - MovieView.SelectItem(index, true); - } - - private void ScanFiles() - { - _movieList.Clear(); - MovieView.ItemCount = 0; - MovieView.Update(); - - var directory = PathManager.MakeAbsolutePath(Global.Config.PathEntries.MoviesPathFragment, null); - if (!Directory.Exists(directory)) - { - Directory.CreateDirectory(directory); - } - - var dpTodo = new Queue(); - var fpTodo = new List(); - dpTodo.Enqueue(directory); - Dictionary ordinals = new Dictionary(); - - while (dpTodo.Count > 0) - { - string dp = dpTodo.Dequeue(); - - //enqueue subdirectories if appropriate - if (Global.Config.PlayMovie_IncludeSubdir) - foreach(var subdir in Directory.GetDirectories(dp)) - dpTodo.Enqueue(subdir); - - //add movies - fpTodo.AddRange(Directory.GetFiles(dp, "*." + MovieService.DefaultExtension)); - fpTodo.AddRange(Directory.GetFiles(dp, "*." + TasMovie.Extension)); - } - - //in parallel, scan each movie - Parallel.For(0, fpTodo.Count, (i) => - //for(int i=0;i ordinals[a.Filename].CompareTo(ordinals[b.Filename])); - - RefreshMovieList(); - } - - #region Events - - #region Movie List - - void RefreshMovieList() - { - MovieView.ItemCount = _movieList.Count; - UpdateList(); - } - - private void MovieView_DragEnter(object sender, DragEventArgs e) - { - e.Effect = e.Data.GetDataPresent(DataFormats.FileDrop) ? DragDropEffects.Copy : DragDropEffects.None; - } - - private void MovieView_DragDrop(object sender, DragEventArgs e) - { - var filePaths = (string[])e.Data.GetData(DataFormats.FileDrop); - - foreach (var path in filePaths.Where(path => MovieService.MovieExtensions.Contains(Path.GetExtension(path).Replace(".", "")))) - { - AddMovieToList(path, force: true); - } - - RefreshMovieList(); - } - - private void MovieView_KeyDown(object sender, KeyEventArgs e) - { - if (e.Control && e.KeyCode == Keys.C) - { - var indexes = MovieView.SelectedIndices; - if (indexes.Count > 0) - { - var copyStr = new StringBuilder(); - foreach (int index in indexes) - { - copyStr - .Append(_movieList[index].Filename).Append('\t') - .Append(_movieList[index].SystemID).Append('\t') - .Append(_movieList[index].GameName).Append('\t') - .Append(PlatformFrameRates.MovieTime(_movieList[index]).ToString(@"hh\:mm\:ss\.fff")) - .AppendLine(); - } - Clipboard.SetDataObject(copyStr.ToString()); - } - } - } - - private void MovieView_DoubleClick(object sender, EventArgs e) - { - Run(); - Close(); - } - - private void MovieView_ColumnClick(object sender, ColumnClickEventArgs e) - { - var columnName = MovieView.Columns[e.Column].Text; - switch (columnName) - { - case "File": - default: - _movieList = _movieList.OrderBy(x => Path.GetFileName(x.Filename)) - .ThenBy(x => x.SystemID) - .ThenBy(x => x.GameName) - .ThenBy(x => x.FrameCount) - .ToList(); - break; - case "SysID": - _movieList = _movieList.OrderBy(x => x.SystemID) - .ThenBy(x => Path.GetFileName(x.Filename)) - .ThenBy(x => x.GameName) - .ThenBy(x => x.FrameCount) - .ToList(); - break; - case "Game": - _movieList = _movieList.OrderBy(x => x.GameName) - .ThenBy(x => Path.GetFileName(x.Filename)) - .ThenBy(x => x.SystemID) - .ThenBy(x => x.FrameCount) - .ToList(); - break; - case "Length (est.)": - _movieList = _movieList.OrderBy(x => x.FrameCount) - .ThenBy(x => Path.GetFileName(x.Filename)) - .ThenBy(x => x.SystemID) - .ThenBy(x => x.GameName) - .ToList(); - break; - } - if (_sortedCol == columnName && _sortReverse) - { - _movieList.Reverse(); - _sortReverse = false; - } - else - { - _sortReverse = true; - _sortedCol = columnName; - } - MovieView.Refresh(); - } - - private void MovieView_SelectedIndexChanged(object sender, EventArgs e) - { - toolTip1.SetToolTip(DetailsView, ""); - DetailsView.Items.Clear(); - if (MovieView.SelectedIndices.Count < 1) - { - OK.Enabled = false; - return; - } - - OK.Enabled = true; - - var firstIndex = MovieView.SelectedIndices[0]; - MovieView.ensureVisible(firstIndex); - - foreach (var kvp in _movieList[firstIndex].HeaderEntries) - { - var item = new ListViewItem(kvp.Key); - item.SubItems.Add(kvp.Value); - - bool add = true; - - switch (kvp.Key) - { - case HeaderKeys.SHA1: - if (kvp.Value != Global.Game.Hash) - { - item.BackColor = Color.Pink; - toolTip1.SetToolTip(DetailsView, "Current SHA1: " + Global.Game.Hash); - } - break; - // TODO - //case HeaderKeys.EMULATIONVERSION: - // if (kvp.Value != VersionInfo.GetEmuVersion()) - // { - // item.BackColor = Color.Yellow; - // } - // break; - case HeaderKeys.PLATFORM: - if (kvp.Value != Global.Game.System) - { - item.BackColor = Color.Pink; - } - break; - } - - if(add) - DetailsView.Items.Add(item); - } - - var FpsItem = new ListViewItem("Fps"); - FpsItem.SubItems.Add($"{Fps(_movieList[firstIndex]):0.#######}"); - DetailsView.Items.Add(FpsItem); - - var FramesItem = new ListViewItem("Frames"); - FramesItem.SubItems.Add(_movieList[firstIndex].FrameCount.ToString()); - DetailsView.Items.Add(FramesItem); - CommentsBtn.Enabled = _movieList[firstIndex].Comments.Any(); - SubtitlesBtn.Enabled = _movieList[firstIndex].Subtitles.Any(); - } - - public double Fps(IMovie movie) - { - var system = movie.HeaderEntries[HeaderKeys.PLATFORM]; - var pal = movie.HeaderEntries.ContainsKey(HeaderKeys.PAL) && - movie.HeaderEntries[HeaderKeys.PAL] == "1"; - - return new PlatformFrameRates()[system, pal]; - - } - - private void EditMenuItem_Click(object sender, EventArgs e) - { - foreach (var movie in MovieView.SelectedIndices.Cast() - .Select(index => _movieList[index])) - { - System.Diagnostics.Process.Start(movie.Filename); - } - } - - #endregion - - #region Details - - private void DetailsView_ColumnClick(object sender, ColumnClickEventArgs e) - { - var detailsList = new List(); - for (var i = 0; i < DetailsView.Items.Count; i++) - { - detailsList.Add(new MovieDetails - { - Keys = DetailsView.Items[i].Text, - Values = DetailsView.Items[i].SubItems[1].Text, - BackgroundColor = DetailsView.Items[i].BackColor - }); - } - - var columnName = DetailsView.Columns[e.Column].Text; - if (_sortedDetailsCol != columnName) - { - _sortDetailsReverse = false; - } - - switch (columnName) - { - // Header, Value - case "Header": - if (_sortDetailsReverse) - { - detailsList = detailsList - .OrderByDescending(x => x.Keys) - .ThenBy(x => x.Values).ToList(); - } - else - { - detailsList = detailsList - .OrderBy(x => x.Keys) - .ThenBy(x => x.Values).ToList(); - } - - break; - case "Value": - if (_sortDetailsReverse) - { - detailsList = detailsList - .OrderByDescending(x => x.Values) - .ThenBy(x => x.Keys).ToList(); - } - else - { - detailsList = detailsList - .OrderBy(x => x.Values) - .ThenBy(x => x.Keys).ToList(); - } - - break; - } - - DetailsView.Items.Clear(); - foreach (var detail in detailsList) - { - var item = new ListViewItem { Text = detail.Keys, BackColor = detail.BackgroundColor }; - item.SubItems.Add(detail.Values); - DetailsView.Items.Add(item); - } - - _sortedDetailsCol = columnName; - _sortDetailsReverse = !_sortDetailsReverse; - } - - private void CommentsBtn_Click(object sender, EventArgs e) - { - var indices = MovieView.SelectedIndices; - if (indices.Count > 0) - { - var form = new EditCommentsForm(); - form.GetMovie(_movieList[MovieView.SelectedIndices[0]]); - form.Show(); - } - } - - private void SubtitlesBtn_Click(object sender, EventArgs e) - { - var indices = MovieView.SelectedIndices; - if (indices.Count > 0) - { - var s = new EditSubtitlesForm { ReadOnly = true }; - s.GetMovie(_movieList[MovieView.SelectedIndices[0]]); - s.Show(); - } - } - - #endregion - - #region Misc Widgets - - private void BrowseMovies_Click(object sender, EventArgs e) - { - var ofd = new OpenFileDialog - { - Filter = "Movie Files (*." + MovieService.DefaultExtension + ")|*." + MovieService.DefaultExtension + - "|TAS project Files (*." + TasMovie.Extension + ")|*." + TasMovie.Extension + - "|All Files|*.*", - InitialDirectory = PathManager.MakeAbsolutePath(Global.Config.PathEntries.MoviesPathFragment, null) - }; - - var result = ofd.ShowDialog(); - if (result == DialogResult.OK) - { - var file = new FileInfo(ofd.FileName); - if (!file.Exists) - { - return; - } - - int? index = AddMovieToList(ofd.FileName, true); - RefreshMovieList(); - if (index.HasValue) - { - MovieView.SelectedIndices.Clear(); - MovieView.setSelection(index.Value); - MovieView.SelectItem(index.Value, true); - } - } - } - - private void Scan_Click(object sender, EventArgs e) - { - ScanFiles(); - PreHighlightMovie(); - } - - private void IncludeSubDirectories_CheckedChanged(object sender, EventArgs e) - { - Global.Config.PlayMovie_IncludeSubdir = IncludeSubDirectories.Checked; - ScanFiles(); - PreHighlightMovie(); - } - - private void MatchHashCheckBox_CheckedChanged(object sender, EventArgs e) - { - Global.Config.PlayMovie_MatchHash = MatchHashCheckBox.Checked; - ScanFiles(); - PreHighlightMovie(); - } - - private void Ok_Click(object sender, EventArgs e) - { - Global.Config.TurboSeek = TurboCheckbox.Checked; - Run(); - Global.MovieSession.ReadOnly = ReadOnlyCheckBox.Checked; - - if (StopOnFrameCheckbox.Checked && - (StopOnFrameTextBox.ToRawInt().HasValue || LastFrameCheckbox.Checked)) - { - if (LastFrameCheckbox.Checked) - { - // TODO - //GlobalWin.MainForm.PauseOnFrame = Global.MovieSession.Movie.InputLogLength; - } - else - { - //GlobalWin.MainForm.PauseOnFrame = StopOnFrameTextBox.ToRawInt(); - } - } - - Close(); - } - - private void Cancel_Click(object sender, EventArgs e) - { - Close(); - } - - #endregion - - private bool _programmaticallyChangingStopFrameCheckbox = false; - private void StopOnFrameCheckbox_CheckedChanged(object sender, EventArgs e) - { - if (!_programmaticallyChangingStopFrameCheckbox) - { - StopOnFrameTextBox.Focus(); - } - } - - private void StopOnFrameTextBox_TextChanged_1(object sender, EventArgs e) - { - _programmaticallyChangingStopFrameCheckbox = true; - StopOnFrameCheckbox.Checked = !string.IsNullOrWhiteSpace(StopOnFrameTextBox.Text); - _programmaticallyChangingStopFrameCheckbox = false; - } - - private void LastFrameCheckbox_CheckedChanged(object sender, EventArgs e) - { - if (LastFrameCheckbox.Checked == true) - { - _programmaticallyChangingStopFrameCheckbox = true; - StopOnFrameCheckbox.Checked = true; - _programmaticallyChangingStopFrameCheckbox = false; - } - - StopOnFrameTextBox.Enabled = !LastFrameCheckbox.Checked; - } - - #endregion - } -} diff --git a/BizHawk.Client.MultiHawk/movie/PlayMovie.resx b/BizHawk.Client.MultiHawk/movie/PlayMovie.resx deleted file mode 100644 index b726d762b7..0000000000 --- a/BizHawk.Client.MultiHawk/movie/PlayMovie.resx +++ /dev/null @@ -1,155 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - 17, 17 - - - 114, 17 - - - - - AAABAAEAEBAAAAAAAABoBQAAFgAAACgAAAAQAAAAIAAAAAEACAAAAAAAQAEAAAAAAAAAAAAAAAAAAAAA - AAAAAAAA////AP64aABQUFAAwNjwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAMDAAMDAwAAAAAAAAAAAAMCAgMDAwMDAwAAAAMDAAADAgICAwMDAwMDAwMCAgMAAAMCAwMD - AwMDAwMDAgIDAAMEBAQDAgMDAwMDAwICAgMDBAQEAwICAwQDAwQDAgIDAAMDAwICAgMCAgIDAwMDAAAA - AwICAgMCAgIDAgMAAAAAAAAAAwMEBAQEBAQCAwAAAAAAAwMEBAQDAwMDAwMAAAAAAwQEAwMEBAMEBAQC - AwAAAAMEBAMDBAMEBAQEAgMAAAAAAwMDBAQDBAMDAwIDAAAAAAMCAgICAgICAgMEBAMAAAAAAwICAgIC - AwMEBAQDAAAAAAADAwMDAwAAAwMDAJH/AAAAcwAAAAEAAIABAAAAAAAAAAAAAIABAADABwAA8AMAAOAD - AADAAQAAwAEAAOABAADgAAAA8AAAAPgxAAA= - - - \ No newline at end of file diff --git a/BizHawk.Client.MultiHawk/movie/RecordMovie.Designer.cs b/BizHawk.Client.MultiHawk/movie/RecordMovie.Designer.cs deleted file mode 100644 index 252508deab..0000000000 --- a/BizHawk.Client.MultiHawk/movie/RecordMovie.Designer.cs +++ /dev/null @@ -1,210 +0,0 @@ -namespace BizHawk.Client.MultiHawk -{ - partial class RecordMovie - { - /// - /// Required designer variable. - /// - private System.ComponentModel.IContainer components = null; - - /// - /// Clean up any resources being used. - /// - /// true if managed resources should be disposed; otherwise, false. - protected override void Dispose(bool disposing) - { - if (disposing && (components != null)) - { - components.Dispose(); - } - base.Dispose(disposing); - } - - #region Windows Form Designer generated code - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - private void InitializeComponent() - { - System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(RecordMovie)); - this.Cancel = new System.Windows.Forms.Button(); - this.OK = new System.Windows.Forms.Button(); - this.BrowseBtn = new System.Windows.Forms.Button(); - this.RecordBox = new System.Windows.Forms.TextBox(); - this.StartFromCombo = new System.Windows.Forms.ComboBox(); - this.groupBox1 = new System.Windows.Forms.GroupBox(); - this.DefaultAuthorCheckBox = new System.Windows.Forms.CheckBox(); - this.AuthorBox = new System.Windows.Forms.TextBox(); - this.label3 = new System.Windows.Forms.Label(); - this.label2 = new System.Windows.Forms.Label(); - this.label1 = new System.Windows.Forms.Label(); - this.groupBox1.SuspendLayout(); - this.SuspendLayout(); - // - // Cancel - // - this.Cancel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); - this.Cancel.DialogResult = System.Windows.Forms.DialogResult.Cancel; - this.Cancel.Location = new System.Drawing.Point(391, 139); - this.Cancel.Name = "Cancel"; - this.Cancel.Size = new System.Drawing.Size(75, 23); - this.Cancel.TabIndex = 1; - this.Cancel.Text = "&Cancel"; - this.Cancel.UseVisualStyleBackColor = true; - this.Cancel.Click += new System.EventHandler(this.Cancel_Click); - // - // OK - // - this.OK.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); - this.OK.Location = new System.Drawing.Point(310, 139); - this.OK.Name = "OK"; - this.OK.Size = new System.Drawing.Size(75, 23); - this.OK.TabIndex = 0; - this.OK.Text = "&OK"; - this.OK.UseVisualStyleBackColor = true; - this.OK.Click += new System.EventHandler(this.Ok_Click); - // - // BrowseBtn - // - this.BrowseBtn.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); - this.BrowseBtn.Image = global::BizHawk.Client.MultiHawk.Properties.Resources.OpenFile; - this.BrowseBtn.Location = new System.Drawing.Point(423, 13); - this.BrowseBtn.Name = "BrowseBtn"; - this.BrowseBtn.Size = new System.Drawing.Size(25, 23); - this.BrowseBtn.TabIndex = 1; - this.BrowseBtn.UseVisualStyleBackColor = true; - this.BrowseBtn.Click += new System.EventHandler(this.BrowseBtn_Click); - // - // RecordBox - // - this.RecordBox.AllowDrop = true; - this.RecordBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this.RecordBox.Location = new System.Drawing.Point(83, 13); - this.RecordBox.Name = "RecordBox"; - this.RecordBox.Size = new System.Drawing.Size(334, 20); - this.RecordBox.TabIndex = 0; - this.RecordBox.DragDrop += new System.Windows.Forms.DragEventHandler(this.RecordBox_DragDrop); - this.RecordBox.DragEnter += new System.Windows.Forms.DragEventHandler(this.RecordBox_DragEnter); - // - // StartFromCombo - // - this.StartFromCombo.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; - this.StartFromCombo.Enabled = false; - this.StartFromCombo.FormattingEnabled = true; - this.StartFromCombo.Items.AddRange(new object[] { - "Power-On"}); - this.StartFromCombo.Location = new System.Drawing.Point(83, 65); - this.StartFromCombo.MaxDropDownItems = 32; - this.StartFromCombo.Name = "StartFromCombo"; - this.StartFromCombo.Size = new System.Drawing.Size(152, 21); - this.StartFromCombo.TabIndex = 3; - // - // groupBox1 - // - this.groupBox1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this.groupBox1.Controls.Add(this.DefaultAuthorCheckBox); - this.groupBox1.Controls.Add(this.AuthorBox); - this.groupBox1.Controls.Add(this.StartFromCombo); - this.groupBox1.Controls.Add(this.BrowseBtn); - this.groupBox1.Controls.Add(this.label3); - this.groupBox1.Controls.Add(this.label2); - this.groupBox1.Controls.Add(this.label1); - this.groupBox1.Controls.Add(this.RecordBox); - this.groupBox1.Location = new System.Drawing.Point(12, 12); - this.groupBox1.Name = "groupBox1"; - this.groupBox1.Size = new System.Drawing.Size(454, 112); - this.groupBox1.TabIndex = 0; - this.groupBox1.TabStop = false; - // - // DefaultAuthorCheckBox - // - this.DefaultAuthorCheckBox.Anchor = System.Windows.Forms.AnchorStyles.Right; - this.DefaultAuthorCheckBox.AutoSize = true; - this.DefaultAuthorCheckBox.Location = new System.Drawing.Point(327, 64); - this.DefaultAuthorCheckBox.Name = "DefaultAuthorCheckBox"; - this.DefaultAuthorCheckBox.Size = new System.Drawing.Size(121, 17); - this.DefaultAuthorCheckBox.TabIndex = 6; - this.DefaultAuthorCheckBox.Text = "Make default author"; - this.DefaultAuthorCheckBox.UseVisualStyleBackColor = true; - // - // AuthorBox - // - this.AuthorBox.AllowDrop = true; - this.AuthorBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this.AuthorBox.Location = new System.Drawing.Point(83, 39); - this.AuthorBox.Name = "AuthorBox"; - this.AuthorBox.Size = new System.Drawing.Size(365, 20); - this.AuthorBox.TabIndex = 2; - // - // label3 - // - this.label3.AutoSize = true; - this.label3.Location = new System.Drawing.Point(36, 41); - this.label3.Name = "label3"; - this.label3.Size = new System.Drawing.Size(41, 13); - this.label3.TabIndex = 2; - this.label3.Text = "Author:"; - // - // label2 - // - this.label2.AutoSize = true; - this.label2.Location = new System.Drawing.Point(6, 68); - this.label2.Name = "label2"; - this.label2.Size = new System.Drawing.Size(71, 13); - this.label2.TabIndex = 5; - this.label2.Text = "Record From:"; - // - // label1 - // - this.label1.AutoSize = true; - this.label1.Location = new System.Drawing.Point(51, 16); - this.label1.Name = "label1"; - this.label1.Size = new System.Drawing.Size(26, 13); - this.label1.TabIndex = 4; - this.label1.Text = "File:"; - // - // RecordMovie - // - this.AcceptButton = this.OK; - this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.CancelButton = this.Cancel; - this.ClientSize = new System.Drawing.Size(478, 163); - this.Controls.Add(this.groupBox1); - this.Controls.Add(this.OK); - this.Controls.Add(this.Cancel); - this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); - this.MaximizeBox = false; - this.MaximumSize = new System.Drawing.Size(1440, 201); - this.MinimizeBox = false; - this.MinimumSize = new System.Drawing.Size(425, 201); - this.Name = "RecordMovie"; - this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; - this.Text = "Record Movie"; - this.Load += new System.EventHandler(this.RecordMovie_Load); - this.groupBox1.ResumeLayout(false); - this.groupBox1.PerformLayout(); - this.ResumeLayout(false); - - } - - #endregion - - private System.Windows.Forms.Button Cancel; - private System.Windows.Forms.Button OK; - private System.Windows.Forms.Button BrowseBtn; - private System.Windows.Forms.TextBox RecordBox; - private System.Windows.Forms.ComboBox StartFromCombo; - private System.Windows.Forms.GroupBox groupBox1; - private System.Windows.Forms.Label label3; - private System.Windows.Forms.Label label2; - private System.Windows.Forms.Label label1; - private System.Windows.Forms.TextBox AuthorBox; - private System.Windows.Forms.CheckBox DefaultAuthorCheckBox; - } -} \ No newline at end of file diff --git a/BizHawk.Client.MultiHawk/movie/RecordMovie.cs b/BizHawk.Client.MultiHawk/movie/RecordMovie.cs deleted file mode 100644 index 4c5cdb4e66..0000000000 --- a/BizHawk.Client.MultiHawk/movie/RecordMovie.cs +++ /dev/null @@ -1,179 +0,0 @@ -using System; -using System.IO; -using System.Windows.Forms; -using System.Linq; - -using BizHawk.Common.ReflectionExtensions; -using BizHawk.Emulation.Common; -using BizHawk.Emulation.Common.IEmulatorExtensions; -using BizHawk.Client.Common; -using BizHawk.Client.Common.MovieConversionExtensions; - -namespace BizHawk.Client.MultiHawk -{ - public partial class RecordMovie : Form - { - private IEmulator Emulator; - - // TODO - Allow relative paths in record textbox - public RecordMovie(IEmulator core) - { - InitializeComponent(); - - Emulator = core; - - if (!Emulator.HasSavestates()) - { - StartFromCombo.Items.Remove( - StartFromCombo.Items - .OfType() - .First(i => i.ToString() - .ToLower() == "now")); - } - } - - private string MakePath() - { - var path = RecordBox.Text; - - if (!string.IsNullOrWhiteSpace(path)) - { - if (path.LastIndexOf(Path.DirectorySeparatorChar) == -1) - { - if (path[0] != Path.DirectorySeparatorChar) - { - path = path.Insert(0, Path.DirectorySeparatorChar.ToString()); - } - - path = PathManager.MakeAbsolutePath(Global.Config.PathEntries.MoviesPathFragment, null) + path; - - if (!MovieService.MovieExtensions.Contains(Path.GetExtension(path))) - { - // If no valid movie extension, add movie extension - path += "." + MovieService.DefaultExtension; - } - } - } - - return path; - } - - private void Ok_Click(object sender, EventArgs e) - { - var path = MakePath(); - if (!string.IsNullOrWhiteSpace(path)) - { - var test = new FileInfo(path); - if (test.Exists) - { - var result = MessageBox.Show(path + " already exists, overwrite?", "Confirm overwrite", MessageBoxButtons.OKCancel, MessageBoxIcon.Warning); - if (result == DialogResult.Cancel) - { - return; - } - } - - var movieToRecord = MovieService.Get(path); - - var fileInfo = new FileInfo(path); - if (!fileInfo.Exists) - { - Directory.CreateDirectory(fileInfo.DirectoryName); - } - - //if (StartFromCombo.SelectedItem.ToString() == "Now" && Emulator.HasSavestates()) - //{ - // var core = Emulator.AsStatable(); - - // movieToRecord.StartsFromSavestate = true; - - // if (core.BinarySaveStatesPreferred) - // { - // movieToRecord.BinarySavestate = (byte[])core.SaveStateBinary().Clone(); - // } - // else - // { - // using (var sw = new StringWriter()) - // { - // core.SaveStateText(sw); - // movieToRecord.TextSavestate = sw.ToString(); - // } - // } - // // TODO: do we want to support optionally not saving this? - // if (true) - // { - // // hack: some IMovies eat the framebuffer, so don't bother with them - // movieToRecord.SavestateFramebuffer = new int[0]; - // if (movieToRecord.SavestateFramebuffer != null) - // { - - // movieToRecord.SavestateFramebuffer = (int[])Emulator.VideoProvider().GetVideoBuffer().Clone(); - // } - // } - //} - - movieToRecord.PopulateWithDefaultHeaderValues(AuthorBox.Text); - movieToRecord.Save(); - GlobalWin.MainForm.StartNewMovie(movieToRecord, true); - - Global.Config.UseDefaultAuthor = DefaultAuthorCheckBox.Checked; - if (DefaultAuthorCheckBox.Checked) - { - Global.Config.DefaultAuthor = AuthorBox.Text; - } - - Close(); - } - else - { - MessageBox.Show("Please select a movie to record", "File selection error", MessageBoxButtons.OK, MessageBoxIcon.Error); - } - } - - private void Cancel_Click(object sender, EventArgs e) - { - Close(); - } - - private void BrowseBtn_Click(object sender, EventArgs e) - { - var sfd = new SaveFileDialog - { - InitialDirectory = PathManager.MakeAbsolutePath(Global.Config.PathEntries.MoviesPathFragment, null), - DefaultExt = "." + Global.MovieSession.Movie.PreferredExtension, - FileName = RecordBox.Text, - OverwritePrompt = false, - Filter = "Movie Files (*." + Global.MovieSession.Movie.PreferredExtension + ")|*." + Global.MovieSession.Movie.PreferredExtension + "|All Files|*.*" - }; - - var result = sfd.ShowDialog(); - if (result == DialogResult.OK - && !string.IsNullOrWhiteSpace(sfd.FileName)) - { - RecordBox.Text = sfd.FileName; - } - } - - private void RecordMovie_Load(object sender, EventArgs e) - { - RecordBox.Text = PathManager.FilesystemSafeName(GlobalWin.MainForm.EmulatorWindows.First().Game); - StartFromCombo.SelectedIndex = 0; - DefaultAuthorCheckBox.Checked = Global.Config.UseDefaultAuthor; - if (Global.Config.UseDefaultAuthor) - { - AuthorBox.Text = Global.Config.DefaultAuthor; - } - } - - private void RecordBox_DragEnter(object sender, DragEventArgs e) - { - e.Effect = e.Data.GetDataPresent(DataFormats.FileDrop) ? DragDropEffects.Copy : DragDropEffects.None; - } - - private void RecordBox_DragDrop(object sender, DragEventArgs e) - { - var filePaths = (string[])e.Data.GetData(DataFormats.FileDrop); - RecordBox.Text = filePaths[0]; - } - } -} diff --git a/BizHawk.Client.MultiHawk/movie/RecordMovie.resx b/BizHawk.Client.MultiHawk/movie/RecordMovie.resx deleted file mode 100644 index fb80888459..0000000000 --- a/BizHawk.Client.MultiHawk/movie/RecordMovie.resx +++ /dev/null @@ -1,149 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - - - AAABAAEAEBAAAAAAAABoBQAAFgAAACgAAAAQAAAAIAAAAAEACAAAAAAAQAEAAAAAAAAAAAAAAAAAAAAA - AAAAAAAA////AP64aABQUFAAwNjwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAMDAAMDAwAAAAAAAAAAAAMCAgMDAwMDAwAAAAMDAAADAgICAwMDAwMDAwMCAgMAAAMCAwMD - AwMDAwMDAgIDAAMEBAQDAgMDAwMDAwICAgMDBAQEAwICAwQDAwQDAgIDAAMDAwICAgMCAgIDAwMDAAAA - AwICAgMCAgIDAgMAAAAAAAAAAwMEBAQEBAQCAwAAAAAAAwMEBAQDAwMDAwMAAAAAAwQEAwMEBAMEBAQC - AwAAAAMEBAMDBAMEBAQEAgMAAAAAAwMDBAQDBAMDAwIDAAAAAAMCAgICAgICAgMEBAMAAAAAAwICAgIC - AwMEBAQDAAAAAAADAwMDAwAAAwMDAJH/AAAAcwAAAAEAAIABAAAAAAAAAAAAAIABAADABwAA8AMAAOAD - AADAAQAAwAEAAOABAADgAAAA8AAAAPgxAAA= - - - \ No newline at end of file diff --git a/BizHawk.sln b/BizHawk.sln index 53559fc6dc..64985e34d0 100644 --- a/BizHawk.sln +++ b/BizHawk.sln @@ -55,8 +55,6 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BizHawk.Bizware.BizwareGL.G EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BizHawk.Bizware.BizwareGL.SlimDX", "Bizware\BizHawk.Bizware.BizwareGL.SlimDX\BizHawk.Bizware.BizwareGL.SlimDX.csproj", "{E6B436B1-A3CD-4C9A-8F76-5D7154726884}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BizHawk.Client.MultiHawk", "BizHawk.Client.MultiHawk\BizHawk.Client.MultiHawk.csproj", "{B95649F5-A0AE-41EB-B62B-578A2AFF5E18}" -EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BizHawk.Client.ApiHawk", "BizHawk.Client.ApiHawk\BizHawk.Client.ApiHawk.csproj", "{8E2F11F2-3955-4382-8C3A-CEBA1276CAEA}" EndProject Global @@ -117,10 +115,6 @@ Global {E6B436B1-A3CD-4C9A-8F76-5D7154726884}.Debug|Any CPU.Build.0 = Debug|Any CPU {E6B436B1-A3CD-4C9A-8F76-5D7154726884}.Release|Any CPU.ActiveCfg = Release|Any CPU {E6B436B1-A3CD-4C9A-8F76-5D7154726884}.Release|Any CPU.Build.0 = Release|Any CPU - {B95649F5-A0AE-41EB-B62B-578A2AFF5E18}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {B95649F5-A0AE-41EB-B62B-578A2AFF5E18}.Debug|Any CPU.Build.0 = Debug|Any CPU - {B95649F5-A0AE-41EB-B62B-578A2AFF5E18}.Release|Any CPU.ActiveCfg = Release|Any CPU - {B95649F5-A0AE-41EB-B62B-578A2AFF5E18}.Release|Any CPU.Build.0 = Release|Any CPU {8E2F11F2-3955-4382-8C3A-CEBA1276CAEA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {8E2F11F2-3955-4382-8C3A-CEBA1276CAEA}.Debug|Any CPU.Build.0 = Debug|Any CPU {8E2F11F2-3955-4382-8C3A-CEBA1276CAEA}.Release|Any CPU.ActiveCfg = Release|Any CPU @@ -141,7 +135,6 @@ Global {2D2890A8-C338-4439-AD8B-CB9EE85A94F9} = {B51F1139-3D2C-41BE-A762-EF1F9B41EACA} {337CA23E-65E7-44E1-9411-97EE08BB8116} = {0540A9A6-977E-466D-8BD3-1D8590BD5282} {E6B436B1-A3CD-4C9A-8F76-5D7154726884} = {0540A9A6-977E-466D-8BD3-1D8590BD5282} - {B95649F5-A0AE-41EB-B62B-578A2AFF5E18} = {B51F1139-3D2C-41BE-A762-EF1F9B41EACA} {8E2F11F2-3955-4382-8C3A-CEBA1276CAEA} = {B51F1139-3D2C-41BE-A762-EF1F9B41EACA} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution