This commit is contained in:
upthorn 2019-01-14 17:10:45 -08:00
commit 435d717f7b
14 changed files with 93 additions and 49 deletions

View File

@ -63,7 +63,7 @@ namespace SevenZip
/// 7z.dll (from the 7-zip distribution) supports every InArchiveFormat for encoding and decoding.
/// </remarks>
//private static string _libraryFileName = ConfigurationManager.AppSettings["7zLocation"] ?? Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "7z.dll");
private static string _libraryFileName = Path.Combine(Path.GetDirectoryName(Assembly.GetEntryAssembly().Location), "7z.dll");
private static string _libraryFileName = Path.Combine(Path.GetDirectoryName(Assembly.GetEntryAssembly().Location), "dll\\7z.dll");
#endif
#if WINCE

View File

@ -65,7 +65,7 @@ namespace BizHawk.Client.Common
Markers = new TasMovieMarkerList(this);
Markers.CollectionChanged += Markers_CollectionChanged;
Markers.Add(0, startsFromSavestate ? "Savestate" : "Power on");
BindMarkersToInput = true;
BindMarkersToInput = false;
CurrentBranch = -1;
}
@ -84,7 +84,7 @@ namespace BizHawk.Client.Common
Markers = new TasMovieMarkerList(this);
Markers.CollectionChanged += Markers_CollectionChanged;
Markers.Add(0, startsFromSavestate ? "Savestate" : "Power on");
BindMarkersToInput = true;
BindMarkersToInput = false;
CurrentBranch = -1;
}
@ -509,17 +509,13 @@ namespace BizHawk.Client.Common
Log?.Dispose();
Log = branch.InputLog.Clone();
_lagLog.FromLagLog(branch.LagLog);
// if there are branch states, they will be loaded anyway
// but if there's none, or only *after* divergent point, don't invalidate the entire movie anymore
if (divergentPoint.HasValue)
{
_stateManager.Invalidate(divergentPoint.Value);
InvalidateAfter(divergentPoint.Value);
}
else
{
_stateManager.Invalidate(branch.InputLog.Count);
InvalidateAfter(branch.InputLog.Count);
}
if (BindMarkersToInput) // pretty critical not to erase them

View File

@ -45,7 +45,7 @@
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|AnyCPU'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>..\output\</OutputPath>
<DefineConstants>WINDOWS;DEBUG</DefineConstants>
<DefineConstants>DEBUG;WINDOWS;EXE_PROJECT</DefineConstants>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<DebugType>full</DebugType>
<PlatformTarget>AnyCPU</PlatformTarget>
@ -56,7 +56,7 @@
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|AnyCPU'">
<OutputPath>..\output\</OutputPath>
<DefineConstants>WINDOWS</DefineConstants>
<DefineConstants>WINDOWS;EXE_PROJECT</DefineConstants>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<Optimize>true</Optimize>
<DebugType>pdbonly</DebugType>
@ -113,6 +113,9 @@
<Reference Include="WindowsBase" />
</ItemGroup>
<ItemGroup>
<Compile Include="..\BizHawk.Common\PlatformLinkedLibSingleton.cs">
<Link>PlatformLinkedLibSingleton.cs</Link>
</Compile>
<Compile Include="..\Version\svnrev.cs">
<Link>svnrev.cs</Link>
</Compile>

View File

@ -3060,11 +3060,11 @@ namespace BizHawk.Client.EmuHawk
if (IsSeeking && Emulator.Frame == PauseOnFrame.Value)
{
PauseEmulator();
PauseOnFrame = null;
if (GlobalWin.Tools.IsLoaded<TAStudio>())
{
GlobalWin.Tools.TAStudio.StopSeeking();
}
PauseOnFrame = null;
}
}

View File

@ -23,14 +23,14 @@ namespace BizHawk.Client.EmuHawk
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
var libLoader = PlatformLinkedLibSingleton.LinkedLibManager;
var libLoader = EXE_PROJECT.PlatformLinkedLibSingleton.LinkedLibManager;
//http://www.codeproject.com/Articles/310675/AppDomain-AssemblyResolve-Event-Tips
//try loading libraries we know we'll need
//something in the winforms, etc. code below will cause .net to popup a missing msvcr100.dll in case that one's missing
//but oddly it lets us proceed and we'll then catch it here
var libExt = PlatformLinkedLibSingleton.RunningOnUnix ? ".dll.so" : ".dll";
var libExt = EXE_PROJECT.PlatformLinkedLibSingleton.RunningOnUnix ? ".dll.so" : ".dll";
var d3dx9 = libLoader.LoadPlatformSpecific($"d3dx9_43{libExt}");
var vc2015 = libLoader.LoadPlatformSpecific($"vcruntime140{libExt}");
var vc2012 = libLoader.LoadPlatformSpecific($"msvcr120{libExt}"); //TODO - check version?
@ -65,7 +65,7 @@ namespace BizHawk.Client.EmuHawk
libLoader.FreePlatformSpecific(vc2010);
libLoader.FreePlatformSpecific(vc2010p);
if (!PlatformLinkedLibSingleton.RunningOnUnix)
if (!EXE_PROJECT.PlatformLinkedLibSingleton.RunningOnUnix)
{
// this will look in subdirectory "dll" to load pinvoked stuff
string dllDir = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "dll");
@ -200,7 +200,7 @@ namespace BizHawk.Client.EmuHawk
}
}
}
private static PlatformSpecificMainLoopCrashHandler mainLoopCrashHandler = PlatformLinkedLibSingleton.RunningOnUnix
private static PlatformSpecificMainLoopCrashHandler mainLoopCrashHandler = EXE_PROJECT.PlatformLinkedLibSingleton.RunningOnUnix
? (PlatformSpecificMainLoopCrashHandler) new UnixMonoMainLoopCrashHandler()
: (PlatformSpecificMainLoopCrashHandler) new Win32MainLoopCrashHandler();
@ -265,7 +265,7 @@ namespace BizHawk.Client.EmuHawk
GlobalWin.GLManager = GLManager.Instance;
//now create the "GL" context for the display method. we can reuse the IGL_TK context if opengl display method is chosen
if (PlatformLinkedLibSingleton.RunningOnUnix) Global.Config.DispMethod = Config.EDispMethod.GdiPlus;
if (EXE_PROJECT.PlatformLinkedLibSingleton.RunningOnUnix) Global.Config.DispMethod = Config.EDispMethod.GdiPlus;
REDO_DISPMETHOD:
if (Global.Config.DispMethod == Config.EDispMethod.GdiPlus)
GlobalWin.GL = new Bizware.BizwareGL.Drivers.GdiPlus.IGL_GdiPlus();
@ -313,7 +313,7 @@ namespace BizHawk.Client.EmuHawk
goto REDO_DISPMETHOD;
}
if (!PlatformLinkedLibSingleton.RunningOnUnix)
if (!EXE_PROJECT.PlatformLinkedLibSingleton.RunningOnUnix)
{
//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".

View File

@ -117,7 +117,7 @@ namespace BizHawk.Client.EmuHawk
TasBranch branch = GetBranch(index);
if (branch != null)
{
var record = Tastudio.CurrentTasMovie[branch.Frame];
var record = Movie[branch.Frame];
if (index == Movie.CurrentBranch)
{
color = TAStudio.CurrentFrame_InputLog;
@ -146,7 +146,7 @@ namespace BizHawk.Client.EmuHawk
private TasBranch GetBranch(int index)
{
return Tastudio.CurrentTasMovie.GetBranch(index);
return Movie.GetBranch(index);
}
public void Branch()
@ -199,13 +199,14 @@ namespace BizHawk.Client.EmuHawk
return;
}
Tastudio.CurrentTasMovie.LoadBranch(branch);
Movie.LoadBranch(branch);
var stateInfo = new KeyValuePair<int, byte[]>(branch.Frame, branch.CoreData);
Tastudio.LoadState(stateInfo);
Movie.TasStateManager.Capture(true);
QuickBmpFile.Copy(new BitmapBufferVideoProvider(branch.OSDFrameBuffer), Tastudio.VideoProvider);
if (Tastudio.Settings.OldControlSchemeForBranches && Tastudio.TasPlaybackBox.RecordingMode)
Tastudio.CurrentTasMovie.Truncate(branch.Frame);
Movie.Truncate(branch.Frame);
GlobalWin.MainForm.PauseOnFrame = null;
Tastudio.RefreshDialog();
@ -242,7 +243,7 @@ namespace BizHawk.Client.EmuHawk
private void AddBranchToolStripMenuItem_Click(object sender, EventArgs e)
{
Branch();
CallSavedCallback(Tastudio.CurrentTasMovie.BranchCount - 1);
CallSavedCallback(Movie.BranchCount - 1);
GlobalWin.OSD.AddMessage("Added branch " + Movie.CurrentBranch.ToString());
}
@ -250,7 +251,7 @@ namespace BizHawk.Client.EmuHawk
{
Branch();
EditBranchTextPopUp(Movie.CurrentBranch);
CallSavedCallback(Tastudio.CurrentTasMovie.BranchCount - 1);
CallSavedCallback(Movie.BranchCount - 1);
GlobalWin.OSD.AddMessage("Added branch " + Movie.CurrentBranch.ToString());
}
@ -366,13 +367,13 @@ namespace BizHawk.Client.EmuHawk
if (_branchUndo == BranchUndo.Load)
{
LoadBranch(_backupBranch);
CallLoadedCallback(Tastudio.CurrentTasMovie.Branches.IndexOf(_backupBranch));
CallLoadedCallback(Movie.Branches.IndexOf(_backupBranch));
GlobalWin.OSD.AddMessage("Branch Load canceled");
}
else if (_branchUndo == BranchUndo.Update)
{
Movie.UpdateBranch(Movie.GetBranch(_backupBranch.UniqueIdentifier), _backupBranch);
CallSavedCallback(Tastudio.CurrentTasMovie.Branches.IndexOf(_backupBranch));
CallSavedCallback(Movie.Branches.IndexOf(_backupBranch));
GlobalWin.OSD.AddMessage("Branch Update canceled");
}
else if (_branchUndo == BranchUndo.Text)
@ -384,7 +385,7 @@ namespace BizHawk.Client.EmuHawk
{
Movie.AddBranch(_backupBranch);
BranchView.RowCount = Movie.BranchCount;
CallSavedCallback(Tastudio.CurrentTasMovie.Branches.IndexOf(_backupBranch));
CallSavedCallback(Movie.Branches.IndexOf(_backupBranch));
GlobalWin.OSD.AddMessage("Branch Removal canceled");
}

View File

@ -822,6 +822,7 @@ namespace BizHawk.Client.EmuHawk
SingleClickFloatEditMenuItem.Checked = Settings.SingleClickFloatEdit;
OldControlSchemeForBranchesMenuItem.Checked = Settings.OldControlSchemeForBranches;
LoadBranchOnDoubleclickMenuItem.Checked = Settings.LoadBranchOnDoubleClick;
BindMarkersToInputMenuItem.Checked = CurrentTasMovie.BindMarkersToInput;
}
private void SetMaxUndoLevelsMenuItem_Click(object sender, EventArgs e)

View File

@ -191,7 +191,7 @@ namespace BizHawk.Client.EmuHawk
this.Invoke(() => SavingProgressBar.Visible = true);
for (;;)
{
if (_seekBackgroundWorker.CancellationPending || !this.IsHandleCreated)
if (_seekBackgroundWorker.CancellationPending || !IsHandleCreated || !Mainform.PauseOnFrame.HasValue)
{
e.Cancel = true;
break;

View File

@ -1,9 +1,16 @@
using System;
using System.Runtime.InteropServices;
using System.Runtime.InteropServices;
//put in a different namespace for EXE so we can have an instance of this type (by linking to this file rather than copying it) built-in to the exe
//so the exe doesnt implicitly depend on the dll
#if EXE_PROJECT
namespace EXE_PROJECT
#else
namespace BizHawk.Common
{
public sealed class PlatformLinkedLibSingleton
#endif
{
public sealed class PlatformLinkedLibSingleton
{
public static readonly bool RunningOnUnix = Environment.OSVersion.Platform == PlatformID.Unix || Environment.OSVersion.Platform == PlatformID.MacOSX;
@ -83,4 +90,4 @@ namespace BizHawk.Common
}
}
}
}
}

View File

@ -82,7 +82,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBHawk
case 0xFF54: ret = HDMA_dest_lo; break; // HDMA4
case 0xFF55: ret = HDMA_ctrl; break; // HDMA5
case 0xFF68: ret = BG_pal_ret; break; // BGPI
case 0xFF69: ret = BG_bytes[BG_bytes_index]; break; // BGPD
case 0xFF69: ret = BG_PAL_read(); break; // BGPD
case 0xFF6A: ret = OBJ_pal_ret; break; // OBPI
case 0xFF6B: ret = OBJ_bytes[OBJ_bytes_index]; break; // OBPD
}
@ -90,6 +90,18 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBHawk
return ret;
}
public byte BG_PAL_read()
{
if (VRAM_access_read)
{
return BG_bytes[BG_bytes_index];
}
else
{
return 0xFF;
}
}
public override void WriteReg(int addr, byte value)
{
switch (addr)
@ -240,8 +252,11 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBHawk
BG_bytes_inc = ((value & 0x80) == 0x80);
break;
case 0xFF69: // BGPD
BG_transfer_byte = value;
BG_bytes[BG_bytes_index] = value;
if (VRAM_access_write)
{
BG_transfer_byte = value;
BG_bytes[BG_bytes_index] = value;
}
// change the appropriate palette color
color_compute_BG();

View File

@ -49,7 +49,14 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBHawk
if ((value & 1) > 0)
{
clk_internal = true;
clk_rate = 512;
if (((value & 2) > 0) && Core.GBC_compat)
{
clk_rate = 256;
}
else
{
clk_rate = 512;
}
serial_clock = clk_rate;
}
else
@ -64,7 +71,14 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBHawk
if ((value & 1) > 0)
{
clk_internal = true;
clk_rate = 512;
if (((value & 2) > 0) && Core.GBC_compat)
{
clk_rate = 256;
}
else
{
clk_rate = 512;
}
serial_clock = clk_rate;
}
else
@ -75,7 +89,15 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBHawk
}
}
serial_control = (byte)(0x7E | (value & 0x81)); // middle six bits always 1
if (Core.GBC_compat)
{
serial_control = (byte)(0x7C | (value & 0x83)); // extra CGB bit
}
else
{
serial_control = (byte)(0x7E | (value & 0x81)); // middle six bits always 1
}
break;
}
}

View File

@ -14,11 +14,6 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBHawkLink
public ControllerDefinition ControllerDefinition => _controllerDeck.Definition;
public byte controller_state;
public bool in_vblank_old;
public bool in_vblank;
public bool vblank_rise;
public void FrameAdvance(IController controller, bool render, bool rendersound)
{
//Console.WriteLine("-----------------------FRAME-----------------------");
@ -105,7 +100,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBHawkLink
R.do_single_step();
// the signal to shift out a bit is when serial_clock = 1
if (L.serialport.serial_clock == 1)
if ((L.serialport.serial_clock == 1) || (L.serialport.serial_clock == 2))
{
if (LinkConnected)
{
@ -113,7 +108,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBHawkLink
if ((R.serialport.clk_rate == -1) && R.serialport.serial_start)
{
R.serialport.serial_clock = 1;
R.serialport.serial_clock = L.serialport.serial_clock;
R.serialport.send_external_bit((byte)(R.serialport.serial_data & 0x80));
R.serialport.coming_in = L.serialport.going_out;
}
@ -121,7 +116,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBHawkLink
L.serialport.coming_in = R.serialport.going_out;
}
}
else if (R.serialport.serial_clock == 1)
else if ((R.serialport.serial_clock == 1) || (R.serialport.serial_clock == 2))
{
if (LinkConnected)
{
@ -129,7 +124,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBHawkLink
if ((L.serialport.clk_rate == -1) && L.serialport.serial_start)
{
L.serialport.serial_clock = 1;
L.serialport.serial_clock = R.serialport.serial_clock;
L.serialport.send_external_bit((byte)(L.serialport.serial_data & 0x80));
L.serialport.coming_in = R.serialport.going_out;
}

View File

@ -60,6 +60,8 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBHawkLink
ser.Sync("_cableconnected", ref _cableconnected);
ser.Sync("_cablediscosignal", ref _cablediscosignal);
_controllerDeck.SyncState(ser);
LinkConnected = _cableconnected;
}
}
}

View File

@ -21,7 +21,8 @@ namespace BizHawk.Emulation.Cores.Consoles.Nintendo.QuickNES
{
static QuickNES()
{
QN = BizInvoker.GetInvoker<LibQuickNES>(new DynamicLibraryImportResolver(LibQuickNES.dllname), CallingConventionAdapters.Native);
Resolver = new DynamicLibraryImportResolver(LibQuickNES.dllname);
QN = BizInvoker.GetInvoker<LibQuickNES>(Resolver, CallingConventionAdapters.Native);
QN.qn_setup_mappers();
}
@ -73,6 +74,7 @@ namespace BizHawk.Emulation.Cores.Consoles.Nintendo.QuickNES
}
static readonly LibQuickNES QN;
static readonly DynamicLibraryImportResolver Resolver;
public IEmulatorServiceProvider ServiceProvider { get; private set; }