Skip to content

Lock nodes offset #48

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
Stridemann opened this issue Feb 28, 2018 · 17 comments
Open

Lock nodes offset #48

Stridemann opened this issue Feb 28, 2018 · 17 comments

Comments

@Stridemann
Copy link

Hi,
Thanks again for a program.

I just wanted to ask if it's possible to add LOCK node feature. When you lock node it's offset can't be broken after deleting/inserting bytes before/under it.
Sometimes we don't need to define types in whole structure, just some nodes at start, middle and end of structure.

Also this feature gives us other new awesome feature - we can delete some byte range we don't need (like "hide" in old reclass).

I know, this can be not easy task, just wanted to ask if this is possible.
Thanks you.

@Stridemann
Copy link
Author

Also adding options for inserting 1 and 2 bytes will be awesome too.

@KN4CK3R
Copy link
Member

KN4CK3R commented Mar 1, 2018

ye, locking something would be amazing, like the checkbox when u add a value in cheat engine, u press it, and it forces the value to it every 50 milisecond

That's not what he is talking about.

@KN4CK3R
Copy link
Member

KN4CK3R commented Mar 1, 2018

@Stridemann Currently that's not possible. There is a rewrite of the internal class representation planned. The new system may have support for that.

@Stridemann
Copy link
Author

Stridemann commented Mar 2, 2018

@KN4CK3R Thanks a lot for your work on this project. That will be really great.
I also working on free program for reversing (searching offsets) https://github.com/Stridemann/StructureSpiderAdvanced

I got one stable bug that throws crash error (can continue working, no data lost). Don't want to create a new issue due to low priority: When you double click on node to edit name (enable text input field) and then right click on any other place or node you will got error.

@KN4CK3R
Copy link
Member

KN4CK3R commented Mar 2, 2018

I got one stable bug that throws crash error (can continue working, no data lost). Don't want to create a new issue due to low priority: When you double click on node to edit name (enable text input field) and then right click on any other place or node you will got error.

But a crash is a real issue so you should have created another one.

KN4CK3R added a commit that referenced this issue Mar 2, 2018
@KN4CK3R KN4CK3R reopened this Mar 2, 2018
@KN4CK3R
Copy link
Member

KN4CK3R commented Mar 2, 2018

The original request isn't implemented...

@dot-visual
Copy link

dot-visual commented Aug 21, 2019

Still no fix for this? @KN4CK3R

@Timboy67678
Copy link
Contributor

Timboy67678 commented Aug 21, 2019 via email

@LoneDev6
Copy link

Hello!
I think this feature request is a must have to avoid doing using a top-down approach when reversing a structure.
Let us know what you think @KN4CK3R

@oculus472
Copy link

Does anyone know of a good way to handle this? At the moment redefining fields is a nightmare.

@LoneDev6
Copy link

LoneDev6 commented Jun 16, 2021

No idea sincerely, all the tools I tried have the same problem.
I always have to redefine all my structures from the ground up and use a top down approach

@ross-weir
Copy link

@KN4CK3R Is this still something you'd be interested having added?

If so I'd like to have a go at implementing this. Do you have any preferences/suggestions on how to go about it?

From a quick look I was thinking something like:

  • Before adding nodes in InsertBytes save all defined node offsets - defined nodes being those with a non empty Name value.
  • After adding nodes restore saved nodes to original offsets

@LoneDev6
Copy link

@KN4CK3R Is this still something you'd be interested having added?

If so I'd like to have a go at implementing this. Do you have any preferences/suggestions on how to go about it?

From a quick look I was thinking something like:

* Before adding nodes in `InsertBytes` save all defined node offsets - defined nodes being those with a non empty `Name` value.

* After adding nodes restore saved nodes to original offsets

Why not implementing it anyway, opening a pull request and in the meantime publish your fork?

@KN4CK3R
Copy link
Member

KN4CK3R commented Jun 18, 2021

You have to keep in mind that BaseNode.Offset is not intended to be frozen. Every action which changes the class layout recalculates the offset for all nodes.

@LoneDev6
Copy link

@KN4CK3R So basically this means that the program is structured in a way that this feature is very hard to implement without a lot of modifications?

@KN4CK3R
Copy link
Member

KN4CK3R commented Jun 19, 2021

Yes, you would have to insert HexNodes infront to increase a nodes offset or remove them. Removing will be a problem if there are no unused hex nodes to remove.
Something like this is already there:

if (ShouldCompensateSizeChanges)
{
var oldSize = oldNode.MemorySize;
var newSize = newNode.MemorySize;
if (newSize < oldSize)
{
InsertBytes(index + 1, oldSize - newSize, ref additionalCreatedNodes);
}
/*else if (newSize > oldSize)
{
RemoveNodes(index + 1, newSize - oldSize);
}*/
}

Commented out 5 years ago because I decided it's not worth it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

8 participants
@Timboy67678 @KN4CK3R @Stridemann @dot-visual @LoneDev6 @ross-weir @oculus472 and others