Skip to content

Commit

Permalink
Merge branch 'disk-delta-fixes' of github.com:SaxxonPike/BizHawk into…
Browse files Browse the repository at this point in the history
… disk-delta-fixes
  • Loading branch information
SaxxonPike committed Jan 4, 2025
2 parents e9a978c + eca9b03 commit 5f26c3b
Show file tree
Hide file tree
Showing 17 changed files with 34 additions and 30 deletions.
8 changes: 4 additions & 4 deletions Dist/launch-scripts.nix
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,10 @@
* call as `redirect-output-to-files /target/stdout.txt /target/stderr.txt /path/to/bin arg1 arg2...`
*/
redirectOutputToFiles = writeShellScript "redirect-output-to-files" ''
mktemp='${lib.getBin mktemp}/bin/mktemp'
mktemp='${lib.getExe' mktemp "mktemp"}'
o="$("$mktemp" -u)"
e="$("$mktemp" -u)"
'${lib.getBin mkfifo}/bin/mkfifo' "$o" "$e"
'${lib.getExe' mkfifo "mkfifo"}' "$o" "$e"
tee "$1" <"$o" &
shift
tee "$1" <"$e" | sed "s/.*/$(tput setaf 1)&$(tput sgr0)/" >&2 &
Expand Down Expand Up @@ -112,7 +112,7 @@
fi
printf "(capturing output in %s/EmuHawkMono_last*.txt)\n" "$PWD" >&2
exec '${redirectOutputToFiles}' EmuHawkMono_laststdout.txt EmuHawkMono_laststderr.txt \
'${lib.getBin bizhawkAssemblies.mono}/bin/mono'${monoProfilerFlag} \
'${lib.getExe bizhawkAssemblies.mono}'${monoProfilerFlag} \
"$mainAppPath" --config=config.json "$@"
'';
in {
Expand All @@ -137,7 +137,7 @@ in {
${if profileManagedCalls == false then "" else ''printf "Will write profiling results to %s/*.mlpd\n" "$PWD"
''}export MONO_PATH="$BIZHAWK_HOME/dll"
${lib.optionalString (!debugPInvokes) "# "}export MONO_LOG_LEVEL=debug MONO_LOG_MASK=dll # pass `--arg debugPInvokes true` to nix-build to enable
exec '${lib.getBin bizhawkAssemblies.mono}/bin/mono'${monoProfilerFlag} \
exec '${lib.getExe bizhawkAssemblies.mono}'${monoProfilerFlag} \
"$BIZHAWK_HOME/DiscoHawk.exe" "$@"
'';
emuhawkNonNixOS = writeShellScript "emuhawk-mono-wrapper-non-nixos" ''exec '${nixGL}/bin/nixGL' '${emuhawk}' "$@"'';
Expand Down
4 changes: 2 additions & 2 deletions default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -114,15 +114,15 @@ in {
git
gnome-themes-extra gtk2-x11 libgdiplus libGL lua openal SDL2 udev zstd
buildConfig doCheck extraDefines extraDotnetBuildFlags;
mono = if mono != null
mono = lib.recursiveUpdate { meta.mainProgram = "mono"; } (if mono != null
then mono # allow older Mono if set explicitly
else if isVersionAtLeast "6.12.0.151" pkgs.mono.version
then pkgs.mono
else lib.trace "provided Mono too old, using Mono from Nixpkgs 23.05"
(import (fetchzip {
url = "https://github.com/NixOS/nixpkgs/archive/23.05.tar.gz";
hash = "sha512-REPJ9fRKxTefvh1d25MloT4bXJIfxI+1EvfVWq644Tzv+nuq2BmiGMiBNmBkyN9UT5fl2tdjqGliye3gZGaIGg==";
}) { inherit system; }).mono;
}) { inherit system; }).mono);
monoBasic = fetchzip {
url = "https://download.mono-project.com/repo/debian/pool/main/m/mono-basic/libmono-microsoft-visualbasic10.0-cil_4.7-0xamarin3+debian9b1_all.deb";
nativeBuildInputs = [ dpkg ];
Expand Down
2 changes: 1 addition & 1 deletion src/BizHawk.Client.Common/movie/MovieSession.cs
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ public void QueueNewMovie(

public void RunQueuedMovie(bool recordMode, IEmulator emulator)
{
MovieController = new Bk2Controller(emulator.ControllerDefinition);
MovieController = new Bk2Controller(emulator.ControllerDefinition, _queuedMovie.LogKey);

Movie = _queuedMovie;
Movie.Attach(emulator);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -506,6 +506,7 @@ private void DoSelectionBG(List<RollColumn> visibleColumns, Rectangle rect)
{
var visibleRows = FirstVisibleRow.RangeTo(LastVisibleRow);
int lastRow = -1;
var rowColor = _backColor;
foreach (Cell cell in _selectedItems)
{
if (!cell.RowIndex.HasValue || !visibleRows.Contains(cell.RowIndex.Value) || !VisibleColumns.Contains(cell.Column))
Expand All @@ -520,7 +521,6 @@ private void DoSelectionBG(List<RollColumn> visibleColumns, Rectangle rect)
};
relativeCell.RowIndex -= CountLagFramesAbsolute(relativeCell.RowIndex.Value);

var rowColor = _backColor;
if (QueryRowBkColor != null && lastRow != cell.RowIndex.Value)
{
QueryRowBkColor(cell.RowIndex.Value, ref rowColor);
Expand Down
3 changes: 0 additions & 3 deletions src/BizHawk.Client.EmuHawk/IMainFormForTools.cs
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,6 @@ public interface IMainFormForTools : IDialogController
/// <remarks>only referenced from <see cref="PlaybackBox"/></remarks>
bool PressRewind { get; set; }

/// <remarks>only referenced from <see cref="GenericDebugger"/></remarks>
event Action<bool> OnPauseChanged;

BitmapBuffer CaptureOSD();

/// <remarks>only referenced from <see cref="TAStudio"/></remarks>
Expand Down
4 changes: 1 addition & 3 deletions src/BizHawk.Client.EmuHawk/MainForm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -951,20 +951,18 @@ public bool EmulatorPaused
private set
{
_didMenuPause = false; // overwritten where relevant
if (_emulatorPaused == value) return;
if (_emulatorPaused && !value) // Unpausing
{
InitializeFpsData();
}

_emulatorPaused = value;
OnPauseChanged?.Invoke(_emulatorPaused);
}
}

public bool BlockFrameAdvance { get; set; }

public event Action<bool> OnPauseChanged;

public string CurrentlyOpenRom { get; private set; } // todo - delete me and use only args instead
public LoadRomArgs CurrentlyOpenRomArgs { get; private set; }
public bool PauseAvi { get; set; }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,17 +48,14 @@ private void UpdateDisassembler()
if (CanDisassemble)
{
Disassemble();
SetDisassemblerItemCount();
}
}

private void Disassemble()
{
int lineCount = DisassemblerView.RowCount * 6 + 2;

_disassemblyLines.Clear();
uint currentAddress = _currentDisassemblerAddress;
for (int i = 0; i <= lineCount; ++i)
for (int i = 0; i <= DisassemblerView.RowCount; ++i)
{
if (currentAddress >= BusMaxValue)
{
Expand Down Expand Up @@ -145,10 +142,7 @@ private void SetDisassemblerItemCount()
private void DisassemblerView_SizeChanged(object sender, EventArgs e)
{
SetDisassemblerItemCount();
if (CanDisassemble)
{
Disassemble();
}
UpdateDisassembler();
}

private void SmallIncrement()
Expand Down Expand Up @@ -204,11 +198,6 @@ private void CopySelectedDisassembler()
Clipboard.SetDataObject(blob.ToString());
}

private void OnPauseChanged(bool isPaused)
{
if (isPaused) FullUpdate();
}

private void DisassemblerContextMenu_Opening(object sender, EventArgs e)
{
AddBreakpointContextMenuItem.Enabled = DisassemblerView.AnyRowsSelected;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,13 @@ public override void Restart()
UpdateCapabilitiesProps();
DisengageDebugger();
EngageDebugger();
FullUpdate();
}

protected override void GeneralUpdate() => FullUpdate();

protected override void UpdateAfter()
{
if (MainForm.EmulatorPaused) FullUpdate();
}
}
}
2 changes: 0 additions & 2 deletions src/BizHawk.Client.EmuHawk/tools/Debugger/GenericDebugger.cs
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,6 @@ Control GenCPUPicker()
}

_disassemblyLines.Clear();
MainForm.OnPauseChanged += OnPauseChanged;
CancelSeekBtn.Enabled = false;
if (CanDisassemble)
{
Expand Down Expand Up @@ -149,7 +148,6 @@ Control GenCPUPicker()
private void DisengageDebugger()
{
BreakPointControl1.Shutdown();
MainForm.OnPauseChanged -= OnPauseChanged;
}

public void DisableRegisterBox()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ public void ResetCounters()

public void Dispose()
{
_memoryCallbacks.ActiveChanged -= SetMemoryCallbacks;
if (Context != IntPtr.Zero)
{
LibEmu83.TI83_DestroyContext(Context);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -300,5 +300,11 @@ private void CDReadCallback(int lba, IntPtr dst)
Marshal.Copy(_buf2352, 0, dst, 2352);
DriveLightOn = true;
}

public override void Dispose()
{
_memoryCallbacks.ActiveChanged -= SetMemoryCallbacks;
base.Dispose();
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,7 @@ public void ResetCounters()

public void Dispose()
{
_memorycallbacks.ActiveChanged -= SetMemoryCallbacks;
if (GambatteState != IntPtr.Zero)
{
LibGambatte.gambatte_destroy(GambatteState);
Expand Down
2 changes: 2 additions & 0 deletions src/BizHawk.Emulation.Cores/Consoles/Nintendo/NDS/MelonDS.cs
Original file line number Diff line number Diff line change
Expand Up @@ -539,6 +539,8 @@ public override void Dispose()
_glContext = null;
}

_memoryCallbacks.ActiveChanged -= SetMemoryCallbacks;

base.Dispose();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,7 @@ public void ResetCounters()

public void Dispose()
{
_memorycallbacks.ActiveChanged -= SetMemoryCallbacks;
if (SameboyState != IntPtr.Zero)
{
LibSameboy.sameboy_destroy(SameboyState);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ public void Dispose()
{
if (!_disposed)
{
_memoryCallbacks.ActiveChanged -= RefreshMemCallbacks;
_elf?.Dispose();

if (_cds != null)
Expand Down
2 changes: 2 additions & 0 deletions src/BizHawk.Emulation.Cores/Consoles/Sony/PSX/Octoshock.cs
Original file line number Diff line number Diff line change
Expand Up @@ -348,6 +348,8 @@ public void Dispose()

disposed = true;

_memoryCallbacks.ActiveChanged -= RefreshMemCallbacks;

//discs arent bound to shock core instances, but they may be mounted. kill the core instance first to effectively dereference the disc
OctoshockDll.shock_Destroy(psx);
psx = IntPtr.Zero;
Expand Down
2 changes: 2 additions & 0 deletions src/BizHawk.Emulation.Cores/Consoles/WonderSwan/WonderSwan.cs
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ public WonderSwan(byte[] file, bool deterministic, WonderSwan.Settings settings,

public void Dispose()
{
_inputCallbacks.ActiveChanged -= SetInputCallback;
_memorycallbacks.ActiveChanged -= SetMemoryCallbacks;
if (Core != IntPtr.Zero)
{
BizSwan.bizswan_delete(Core);
Expand Down

0 comments on commit 5f26c3b

Please sign in to comment.