NefMoto

Technical => Reverse Engineering => Topic started by: masterj on August 23, 2014, 04:34:28 AM



Title: How to find factor and offset in IDA?
Post by: masterj on August 23, 2014, 04:34:28 AM
Hi guys!

Can someone advise me how can I find factor and offset of map axis? I already know how to find maps but could never figure out how to find offsets and factors. There should be some standard procedure...

Axis is @ 1CDD8 (2 bytes after 207h*4000h+0dd6h because it is 16bit map). Should I xref word_381F98+1 or something? Please tell me the easiest way


Title: Re: How to find factor and offset in IDA?
Post by: elRey on August 23, 2014, 02:16:44 PM
I asked a similar question a while back. Not sure if it's answer is all you're looking for:
http://nefariousmotorsports.com/forum/index.php?topic=1735.msg18480#msg18480


Title: Re: How to find factor and offset in IDA?
Post by: terminator on August 23, 2014, 05:29:10 PM
Thats a good question! I thought about it also today and wanted to create the same thread.
Here is the answer, but I understand nothing)
http://nefariousmotorsports.com/forum/index.php?topic=2851.msg27661#msg27661

Hope someone will shed some light on it.


Title: Re: How to find factor and offset in IDA?
Post by: phila_dot on August 23, 2014, 09:25:27 PM
There is no way to really explain it.

At the end of the day, it is just hex being relative in some way.

If you know the range and size (8 or 16 bit), then you can easily calculate it.

Some values are translated internally for tester, so you can see how they are converted in code.

See how it interacts with known variables.

There are some clues in the FR.

See how it interacts with constants.

Is it handled as signed or unsigned.

You just have to get a feel for figuring it out.

If you know what it is, then that can tell you how it is converted.


Title: Re: How to find factor and offset in IDA?
Post by: terminator on August 25, 2014, 12:38:18 PM
Its a quet difficult... :-[

Maybe I'm wrong but does ECU know factor at all? I mean values from maps(without factor?) stored into RAM and using me7logger we can use factor = 1.0
For example:
nmot            , {EngineSpeed}                     , 0x00F878,  1,  0x0000, {rpm}     , 0, 0,           40,      0, {Motordrehzahl}

So factor is 40, but I can change it to 1 and 6800rpm/40 will be 170.
And max possible rpm 10200/40=255 (8 bit).

And am I right ECU "sees" 170 instead of 6800? And factor used just for human understanding?


Title: Re: How to find factor and offset in IDA?
Post by: nyet on August 25, 2014, 01:28:52 PM
Yes. Factor is just used for human understanding... but it is important when asking the ECU to do calculations... e.g. it still needs to "know" what every value "means".


Title: Re: How to find factor and offset in IDA?
Post by: dream3R on August 25, 2014, 02:08:59 PM
I posted this about factors, it might help. 

http://nefariousmotorsports.com/forum/index.php?topic=5525.msg52371#msg52371



Title: Re: How to find factor and offset in IDA?
Post by: phila_dot on August 26, 2014, 12:04:24 AM
Everything is done in hex, there is no conversion.

The hex is relative.

The conversions only exist for the calibrator and diagnostics.

The ECU doesn't "see" 170 it "sees" AA.

dream3R - this is the reason that I don't use WinOLS. It isn't that the factor is wrong, it is rounded because WinOLS doesn't allow any further precision. This problem exists in many other conversions as well.


Title: Re: How to find factor and offset in IDA?
Post by: ddillenger on August 26, 2014, 12:27:00 AM
dream3R - this is the reason that I don't use WinOLS. It isn't that the factor is wrong, it is rounded because WinOLS doesn't allow any further precision. This problem exists in many other conversions as well.

The way the factor is displayed is rounded, yes. But if you put in more significant digits than winOLS can display, the data will still be correct.

As in, winOLS might report the factor as .000031, but if you paste in .000030567 it will use the value you entered regardless of how it's displayed.


Title: Re: How to find factor and offset in IDA?
Post by: dream3R on August 26, 2014, 01:12:58 AM
iirc, if you adjust the accuracy it sticks until the next time it's launched.



Title: Re: How to find factor and offset in IDA?
Post by: masterj on August 26, 2014, 05:09:50 AM
accuracy in winols is left as is unless you EDIT the map definition again.


Title: Re: How to find factor and offset in IDA?
Post by: phila_dot on August 26, 2014, 07:00:14 AM
The way the factor is displayed is rounded, yes. But if you put in more significant digits than winOLS can display, the data will still be correct.

As in, winOLS might report the factor as .000031, but if you paste in .000030567 it will use the value you entered regardless of how it's displayed.

I will have to try again, but I remember trying all that and be disappointed.

iirc, if you adjust the accuracy it sticks until the next time it's launched.
accuracy in winols is left as is unless you EDIT the map definition again.

Regarding the factor being rounded to 7 signifacant figures?


Title: Re: How to find factor and offset in IDA?
Post by: masterj on August 26, 2014, 08:32:47 AM
I will have to try again, but I remember trying all that and be disappointed.

Regarding the factor being rounded to 7 signifacant figures?

Yes (to the last question). If you define factor 0.0000000000000005 winols will use it unless you edit the map (then it will be rounded)


Title: Re: How to find factor and offset in IDA?
Post by: nyet on August 26, 2014, 08:56:27 AM
I recommend using 0.0030512 .. it will stick but you'll see 100 instead of 1.