Skip to content

Commit

Permalink
Allow relativization of variables if they can be annotated again
Browse files Browse the repository at this point in the history
  • Loading branch information
zorgiepoo committed May 11, 2024
1 parent 35385f8 commit bcee32e
Showing 1 changed file with 3 additions and 15 deletions.
18 changes: 3 additions & 15 deletions Bit Slicer/ZGDocumentWindowController.m
Original file line number Diff line number Diff line change
Expand Up @@ -1444,8 +1444,6 @@ - (BOOL)validateUserInterfaceItem:(id <NSValidatedUserInterfaceItem>)userInterfa
return NO;
}

NSArray<ZGMachBinary *> *machBinaries = [ZGMachBinary machBinariesInProcess:self.currentProcess];
ZGMachBinary *mainMachBinary = [ZGMachBinary mainMachBinaryFromMachBinaries:machBinaries];
for (ZGVariable *variable in selectedVariables)
{
if (variable.type == ZGScript)
Expand All @@ -1454,19 +1452,9 @@ - (BOOL)validateUserInterfaceItem:(id <NSValidatedUserInterfaceItem>)userInterfa
}

// Allow "relativizing" variables if they can still be annotated further
if (variable.usesDynamicAddress && (variable.userAnnotated || variable.fullAttributedDescription.length != 0))
{
return NO;
}

ZGMachBinary *machBinary = [ZGMachBinary machBinaryNearestToAddress:variable.address fromMachBinaries:machBinaries];
if (machBinary == nil)
{
return NO;
}

ZGMachBinaryInfo *machBinaryInfo = [machBinary machBinaryInfoInProcess:self.currentProcess];
if (machBinaryInfo.slide == 0 && machBinary.headerAddress == mainMachBinary.headerAddress)
// This is including if they were annotated before, in case the annotation
// can be updated.
if (variable.usesDynamicAddress && variable.userAnnotated)
{
return NO;
}
Expand Down

0 comments on commit bcee32e

Please sign in to comment.