Skip to content

Commit

Permalink
Change base address to non-default alternate option
Browse files Browse the repository at this point in the history
  • Loading branch information
zorgiepoo committed Dec 21, 2023
1 parent fd99f98 commit 05660df
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 11 deletions.
16 changes: 14 additions & 2 deletions Bit Slicer/Base.lproj/MainMenu.xib
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="21507" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES">
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="22504" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES">
<dependencies>
<deployment identifier="macosx"/>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="21507"/>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="22504"/>
</dependencies>
<objects>
<customObject id="-2" userLabel="File's Owner" customClass="NSApplication">
Expand Down Expand Up @@ -662,11 +662,23 @@ CA
<action selector="watchVariable:" target="-1" id="1051"/>
</connections>
</menuItem>
<menuItem title="Write Accesses to Base Address…" alternate="YES" keyEquivalent="l" id="gOJ-hH-dww">
<modifierMask key="keyEquivalentModifierMask" option="YES" command="YES"/>
<connections>
<action selector="watchVariable:" target="-1" id="vEa-Yp-bYI"/>
</connections>
</menuItem>
<menuItem title="Read &amp; Write Accesses…" tag="1" keyEquivalent="L" id="1052">
<connections>
<action selector="watchVariable:" target="-1" id="1053"/>
</connections>
</menuItem>
<menuItem title="Read &amp; Write Accesses to Base Address…" tag="1" alternate="YES" keyEquivalent="L" id="KQm-HB-Xdh">
<modifierMask key="keyEquivalentModifierMask" option="YES" command="YES"/>
<connections>
<action selector="watchVariable:" target="-1" id="FQr-XO-g8t"/>
</connections>
</menuItem>
</items>
</menu>
</menuItem>
Expand Down
24 changes: 18 additions & 6 deletions Bit Slicer/Base.lproj/Search Document Window.xib
Original file line number Diff line number Diff line change
Expand Up @@ -171,12 +171,24 @@
<action selector="watchVariable:" target="-1" id="100794"/>
</connections>
</menuItem>
<menuItem title="Watch Write Accesses to Base Address…" alternate="YES" id="LKg-Ix-res">
<modifierMask key="keyEquivalentModifierMask" option="YES"/>
<connections>
<action selector="watchVariable:" target="-1" id="Ja7-17-kya"/>
</connections>
</menuItem>
<menuItem title="Watch Read &amp; Write Accesses…" tag="1" id="100885">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="watchVariable:" target="-1" id="100886"/>
</connections>
</menuItem>
<menuItem title="Watch Read &amp; Write Accesses to Base Address…" tag="1" alternate="YES" id="Ule-bH-KzF">
<modifierMask key="keyEquivalentModifierMask" option="YES"/>
<connections>
<action selector="watchVariable:" target="-1" id="arU-1i-akx"/>
</connections>
</menuItem>
<menuItem isSeparatorItem="YES" id="100789"/>
<menuItem title="Show in Memory Viewer" id="100781">
<modifierMask key="keyEquivalentModifierMask"/>
Expand Down Expand Up @@ -217,7 +229,7 @@
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<clipView key="contentView" id="4wx-3S-yE8">
<rect key="frame" x="0.0" y="0.0" width="762" height="194"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<tableView verticalHuggingPriority="750" allowsExpansionToolTips="YES" columnAutoresizingStyle="firstColumnOnly" alternatingRowBackgroundColors="YES" emptySelection="NO" autosaveColumns="NO" rowHeight="14" headerView="FQj-2P-but" id="HbN-z0-Vcf" customClass="ZGTableView">
<rect key="frame" x="0.0" y="0.0" width="762" height="177"/>
Expand Down Expand Up @@ -643,7 +655,7 @@
<toolbarItem implicitItemIdentifier="7067EEED-50B2-47C5-B940-15BDC90F3B87" label="Target" paletteLabel="Target" title="Item_1" sizingBehavior="auto" id="jO3-Z2-Pv7">
<nil key="toolTip"/>
<popUpButton key="view" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="1ts-DF-nZQ">
<rect key="frame" x="0.0" y="14" width="74" height="25"/>
<rect key="frame" x="-3" y="-4" width="167" height="25"/>
<popUpButtonCell key="cell" type="roundTextured" title="Item_1" bezelStyle="texturedRounded" alignment="left" lineBreakMode="truncatingTail" state="on" borderStyle="border" imageScaling="proportionallyDown" inset="2" selectedItem="MWD-2T-28b" id="ftJ-ti-LVO">
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
<font key="font" metaFont="menu"/>
Expand Down Expand Up @@ -701,12 +713,12 @@
<popUpButton key="view" verticalHuggingPriority="750" id="t3M-9G-Seh" userLabel="Textured Rounded Button">
<rect key="frame" x="0.0" y="14" width="84" height="25"/>
<autoresizingMask key="autoresizingMask"/>
<popUpButtonCell key="cell" type="roundTextured" title="value" bezelStyle="texturedRounded" alignment="left" lineBreakMode="truncatingTail" borderStyle="border" imageScaling="proportionallyDown" inset="2" selectedItem="NpW-LA-vBl" id="dsV-bj-atW">
<popUpButtonCell key="cell" type="roundTextured" title="value" bezelStyle="texturedRounded" alignment="left" lineBreakMode="truncatingTail" state="on" borderStyle="border" imageScaling="proportionallyDown" inset="2" selectedItem="NpW-LA-vBl" id="dsV-bj-atW">
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
<font key="font" metaFont="menu"/>
<menu key="menu" title="OtherViews" id="R5h-SD-hix">
<items>
<menuItem title="value" id="NpW-LA-vBl"/>
<menuItem title="value" state="on" id="NpW-LA-vBl"/>
<menuItem title="address" tag="1" id="v88-2O-5zY"/>
</items>
</menu>
Expand All @@ -719,7 +731,7 @@
<toolbarItem implicitItemIdentifier="8E5DA537-8055-458D-9CED-FB55D84CC763" label="Operator" paletteLabel="Operator" title="Item_1" sizingBehavior="auto" id="moB-Wu-fvx">
<nil key="toolTip"/>
<popUpButton key="view" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="Icp-Tb-DVJ">
<rect key="frame" x="0.0" y="14" width="74" height="25"/>
<rect key="frame" x="-3" y="-4" width="127" height="25"/>
<popUpButtonCell key="cell" type="roundTextured" title="Item_1" bezelStyle="texturedRounded" alignment="left" lineBreakMode="truncatingTail" state="on" borderStyle="border" imageScaling="proportionallyDown" inset="2" selectedItem="gJQ-Bu-nkf" id="25Z-9U-W3R">
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
<font key="font" metaFont="menu"/>
Expand Down Expand Up @@ -758,7 +770,7 @@
<toolbarItem implicitItemIdentifier="52E16CE5-DDC6-4458-A993-F5F7CF90040C" label="Search" paletteLabel="Search" sizingBehavior="auto" id="x8t-Jw-Hi9" userLabel="Search">
<nil key="toolTip"/>
<searchField key="view" wantsLayer="YES" focusRingType="none" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="WaT-8a-dxh">
<rect key="frame" x="0.0" y="14" width="200" height="22"/>
<rect key="frame" x="0.0" y="0.0" width="200" height="22"/>
<constraints>
<constraint firstAttribute="width" relation="greaterThanOrEqual" constant="150" id="Jey-Lt-NQ6"/>
</constraints>
Expand Down
9 changes: 6 additions & 3 deletions Bit Slicer/ZGDocumentWindowController.m
Original file line number Diff line number Diff line change
Expand Up @@ -1449,11 +1449,12 @@ - (BOOL)validateUserInterfaceItem:(id <NSValidatedUserInterfaceItem>)userInterfa
}

BOOL usesDynamicPointerAddress = selectedVariable.usesDynamicPointerAddress;
BOOL watchingBaseAccesess = (usesDynamicPointerAddress && menuItem.alternate);

NSString *localizableTitleKey = [NSString stringWithFormat:@"watchAccesses_%ld_%d", menuItem.tag, usesDynamicPointerAddress];
NSString *localizableTitleKey = [NSString stringWithFormat:@"watchAccesses_%ld_%d", menuItem.tag, watchingBaseAccesess];
menuItem.title = ZGLocalizableSearchDocumentString(localizableTitleKey);

if (!usesDynamicPointerAddress)
if (!watchingBaseAccesess)
{
ZGMemoryAddress memoryAddress = selectedVariable.address;
ZGMemorySize memorySize = selectedVariable.size;
Expand Down Expand Up @@ -1873,7 +1874,9 @@ - (IBAction)watchVariable:(id)sender

ZGVariable *watchVariable;
ZGMemoryAddress baseAddress = 0x0;
if (selectedVariable.usesDynamicPointerAddress && [_tableController getBaseAddress:&baseAddress variable:selectedVariable])
BOOL watchingBaseAccesess = (selectedVariable.usesDynamicPointerAddress && [(NSMenuItem *)sender isAlternate]);

if (watchingBaseAccesess && [_tableController getBaseAddress:&baseAddress variable:selectedVariable])
{
ZGMemorySize pointerSize = self.currentProcess.pointerSize;
watchVariable = [[ZGVariable alloc] initWithValue:NULL size:pointerSize address:baseAddress type:ZGPointer qualifier:0 pointerSize:pointerSize];
Expand Down

0 comments on commit 05660df

Please sign in to comment.