Bitmask editing fails

Report bugs found in TunerPro. Please be sure to include as much info as possible, including system specs, OS, repro steps and TunerPro version number.

Moderators: Mangus, robertisaar, dex

Post Reply
Asmo
Posts: 7
Joined: Sun Dec 17, 2023 6:51 pm

Bitmask editing fails

Post by Asmo »

Build: 5.00.9993.0
Hello, I am having a trouble editing 4 bits from a byte.
I am using the bellow conversion:
X >> 4 & 0x0F
So let's say we have the byte 0x60, using the conversion above we read bits 0110, which converts to 6, the moment I am editing the decimal from 6 to 7 it sets the byte as 0xFF. Strangely enough it works for decimal value 8 and sets the byte to 0x80.

It's easy to reproduce.

Looking forward to your answer.
Best regards
Jim
User avatar
Mangus
TunerPro Author
Posts: 1926
Joined: Wed Mar 19, 2003 1:49 pm

Re: Bitmask editing fails

Post by Mangus »

This looks like it's probably a side effect of the way that I convert value entered in the editor back to the stored value. The algorithm isn't really designed with binary operators (and other situations, like multi-root equations), which is a problem in this case.

What I've had on my list to do is to allow the XDF author to specify a "reverse equation" for cases like this, which is to say, the value you input into the item editor will be passed through this reverse equation to come up with the binary value to be stored in the bin.
***************************************
TunerPro Author
1989 Trans Am
Asmo
Posts: 7
Joined: Sun Dec 17, 2023 6:51 pm

Re: Bitmask editing fails

Post by Asmo »

I guess that's not something that would be in your near future todo list then. We have a mapping that contains a lot of bitwise values, unfortunately for us.
User avatar
Mangus
TunerPro Author
Posts: 1926
Joined: Wed Mar 19, 2003 1:49 pm

Re: Bitmask editing fails

Post by Mangus »

I'll think about other ways to handle this. One way might be for me to add nibble support - for size, the option are currently 32, 16, 8 bit. I could add 4 bit upper nibble and 4 bit lower nibble. Something like that. It's really rare, though. Probably better to go for the flexible solution. I'll think more about this.
***************************************
TunerPro Author
1989 Trans Am
Asmo
Posts: 7
Joined: Sun Dec 17, 2023 6:51 pm

Re: Bitmask editing fails

Post by Asmo »

Better to have a proper solution and not a bandaid. Tunerstudio has a nice approach on this

You can simply specify something like this in the configuration file:

[0:2]
[3:5]
[6:6]
[7:7]
User avatar
Mangus
TunerPro Author
Posts: 1926
Joined: Wed Mar 19, 2003 1:49 pm

Re: Bitmask editing fails

Post by Mangus »

Where [0:2] means bits 0 through 2? That's a tidy solution.
***************************************
TunerPro Author
1989 Trans Am
Asmo
Posts: 7
Joined: Sun Dec 17, 2023 6:51 pm

Re: Bitmask editing fails

Post by Asmo »

Mangus wrote: Tue Jan 02, 2024 2:00 pm Where [0:2] means bits 0 through 2? That's a tidy solution.
Sorry for the late response, yes.
Post Reply