Segment Swap utility

They go by many names, P01, P59, VPW, '0411 etc. Also covering E38 and newer here.
User avatar
joukoy
Posts: 392
Joined: Tue Dec 17, 2019 3:27 am
cars: Pontiac Firebird 1978

Re: Segment Swap utility

Post by joukoy »

Gampy wrote: Attempting to open a read only file causes crash.
Fixed in 0.12.42
- Added parameters "FileAccess.Read, FileShare.ReadWrite"
User avatar
Gampy
Posts: 2331
Joined: Sat Dec 15, 2018 7:38 am

Re: Segment Swap utility

Post by Gampy »

Thank you!
Intelligence is in the details!

It is easier not to learn bad habits, then it is to break them!

If I was here to win a popularity contest, their would be no point, so I wouldn't be here!
User avatar
yoheer
Posts: 79
Joined: Sun Sep 06, 2020 10:04 pm

Re: Segment Swap utility

Post by yoheer »

hey guyz
is it possible to swap a segment with VATS system from stock non *603 os system to *603 OS bin file?

Or maybe somehow with universal patcher?
ironduke
Posts: 579
Joined: Thu Feb 13, 2020 11:32 pm
cars: Mainly GM trucks, a Cruze and an Equinox for dailys..

Re: Segment Swap utility

Post by ironduke »

Hey Joukoy, I don't want to sidetrack this topic too much, but..

How hard would it be to write some code that did this to assist in creating an XDF..
take any E38 bin
Search in the OS segment for 00 00 00 10 00 11 and read all the data including the 00 10 00 11 til it gets to 94 21 ff .. this data is made into a list of words(2 bytes)
Search in the diagnostic segment for 01 01 01 ff 00 06 and read the data including the 06 til you get to your first ff.. this data is made into a list of bytes
Each list should be the same size, add the 2 together and it makes up the DTC's AND the switch to make them A,B,C, or not reported and MIL on/off..

First in the list is all the P codes..
the codes that start with a 5 are C codes, carry a 1 for the code 5207 is c1207
the ones that start with a C are U codes, DON't carry a 1.. code c109 us U0109

00 MIL and reporting off
01 type A/no mil
02 type B/no mil
03 type C/no mil
04 not reported/no mil
05 type A/mil
06 type B/mil
07 type c/mil

I've created some XDF's by hand for OS's I have, but it would probably help everyone else if this could be automated a bit.. Lot of digging coming up with this, had some bins that had codes turned off, then kept on trying with my bench ecu setting codes then turning them off, etc..
User avatar
joukoy
Posts: 392
Joined: Tue Dec 17, 2019 3:27 am
cars: Pontiac Firebird 1978

Re: Segment Swap utility

Post by joukoy »

ironduke wrote:Hey Joukoy, I don't want to sidetrack this topic too much, but..

How hard would it be to write some code that did this to assist in creating an XDF..
take any E38 bin
Search in the OS segment for 00 00 00 10 00 11 and read all the data including the 00 10 00 11 til it gets to 94 21 ff .. this data is made into a list of words(2 bytes)
Search in the diagnostic segment for 01 01 01 ff 00 06 and read the data including the 06 til you get to your first ff.. this data is made into a list of bytes
Each list should be the same size, add the 2 together and it makes up the DTC's AND the switch to make them A,B,C, or not reported and MIL on/off..

First in the list is all the P codes..
the codes that start with a 5 are C codes, carry a 1 for the code 5207 is c1207
the ones that start with a C are U codes, DON't carry a 1.. code c109 us U0109

00 MIL and reporting off
01 type A/no mil
02 type B/no mil
03 type C/no mil
04 not reported/no mil
05 type A/mil
06 type B/mil
07 type c/mil

I've created some XDF's by hand for OS's I have, but it would probably help everyone else if this could be automated a bit.. Lot of digging coming up with this, had some bins that had codes turned off, then kept on trying with my bench ecu setting codes then turning them off, etc..
"Search in the diagnostic segment for 01 01 01 ff 00 06"
I have now two e38 files (07 Escalade and 09 Silverado), can't find this in either file. So, are you sure about bytes I should search?
Otherwise this is almost done.
ironduke
Posts: 579
Joined: Thu Feb 13, 2020 11:32 pm
cars: Mainly GM trucks, a Cruze and an Equinox for dailys..

Re: Segment Swap utility

Post by ironduke »

the 06 is for code p0010 so if it doesn't have variable cam it might not be there.. can you post up one of your bins so I can see, every one I checked with had that, but I'll check some more.. Thanks for looking into it!!

edited... nevermind posting a bin up, I found an 08 that doesn't fit this pattern... I didn't test enough, sorry... I'll do some digging.. maybe the end will match...
I did just find a 12614088 bin that doesn't have the ff at the end so that throws that out..

Can it be as simple as disregarding the third 00?? Nope, just found another bin without the 06.. that first DTC was turned off..

it does seem to work if you look only in the diag segment(to reduce false positives)
00 00 01 01 01 ff check this first
00 00 01 00 00 ff check this second if 1st one fails to find


Since you seem to be making this look so easy, I'm sure it's not, I do have another idea..

If you can search for and find a table with nothing but 00-06 then look at the size of the table, if it matches the size of the DTC list then it is very likely the table we want..

If your busy with other things, no worries, I'm a little busy today but I'll make a point to check my work better and try to test my idea against more bins.. Hopefully we can get this working, I think it'll be a good start towards breaking down the E38's for us.. Even if we get it working for 80% of them I think it's still usable..
kur4o
Posts: 948
Joined: Sun Apr 10, 2016 9:20 pm

Re: Segment Swap utility

Post by kur4o »

ironduke,

That looks like a good piece of information. Can you provide some examples with samples how the thing works, and how it can be used by the program.

As far as I understand the dtcs available are hardcoded in the OS and there is some -and- table that is at the diag segment.

Is there any way to make a list of the OS by the DTC numbers that are used.
ironduke
Posts: 579
Joined: Thu Feb 13, 2020 11:32 pm
cars: Mainly GM trucks, a Cruze and an Equinox for dailys..

Re: Segment Swap utility

Post by ironduke »

kur4o wrote:ironduke,

That looks like a good piece of information. Can you provide some examples with samples how the thing works, and how it can be used by the program.

As far as I understand the dtcs available are hardcoded in the OS and there is some -and- table that is at the diag segment.

Is there any way to make a list of the OS by the DTC numbers that are used.
What your saying is what I've come up with as well..
I found the DTC enable/type table in the diag segment first, and I can find it in any E38 bin pretty easy but I've always been doing it manually.. If we can automate finding this and get it to work 100% then that would be great.. The problem I had is each OS has different DTC's so you don't know the DTC's this table is written for..

I then found out there is a table in the OS segment with a list of DTC's.. This list always matches up with the enable/disable table in the diag segment.. I can find them by hand pretty easily once you know what it looks like.

If I take these 2 tables and splice them I then know what DTC's are available with this OS and I also know it's priority/status for each DTC as far as being A,B,C, no report, MIL on,MIL off.. What I lack is the ability to automate this.. Well, I could give it a try but this is the place to work together on something like this.. I asked Joukoy because he has been AWESOME with his other projects and he seems to be able to work with XDF files with ease.. I'm sure it's harder than it looks, lol but I figured I'd ask him..

If you grab a 12639835 OS bin and follow along I'll try to show what I'm doing..
open it up in a hex editor.. It does help if you also open it up in Universal Patcher.. Doesn't HAVE to be done but it helps to make sure your looking in the right segment to reduce false positives..

seach for 00 00 00 10 00 11 in the OS segment.. You should find a table that starts at 0x8EB0A with the 00 10 00 11 .. It starts with the P codes and P0010 and P011 are the start of it.. Read my earlier post for how it breaks the codes down between P,C, and U codes.. This list is 2 bytes(Word) for each code and goes all the way til you get to 94 21 at 0x8EE28 I do not know what the 00 00 00 is in the beginning or the 94 21 is or means but I've found it at the end of every DTC table, lol.. This might change or not be true for every OS..

Now make that into a list.. see how many codes there are.. I think there's 399 of them if I remember right..

Now go into the diag segment.. search for 01 01 01 ff 00.. first hit is false positive, search again and you'll see that after 0x1c52e4 that is a bunch of data that is just 00-06.. That's the table we want, or at least it has been for me, lol.. This table is just single bytes.. don't count the first 00 after the ff in the search list but start counting after.. usually it's a 06.. make a list from that all the way til you get to ff.. make this into a single byte list.. Should be 399 just like the first list..

Put the 2 of them together and you now have what I have.. A list of all of t he DTC's this OS has and what each status of each DTC is.. you can then turn off/turn on as needed..

attached is a tuner pro table definitions for the OS I've just walked thru.. This is ONLY good for this OS, I assume it's good for any bin file with this OS but cannot guarantee that to be true 100%, should be though..
12639835.dtc.table.7z
Insert this into an XDF for this OS..
(1.45 KiB) Downloaded 136 times
kur4o
Posts: 948
Joined: Sun Apr 10, 2016 9:20 pm

Re: Segment Swap utility

Post by kur4o »

That is a great find. I will look at more deeply and hope to find some more patterns for ease of automation. It will be pretty easy to rip the supported dtcs and print the status of each. Not sure if it will be possible to edit in universal patcher and save.

What I miss is how the dtc number is encoded in hex in the OS. for example how p0134 will be encoded in hex at the OS part.

Do you think some similar strategy is used in the ls1 pcms. I was looking to add some for it, but never get the time.
ironduke
Posts: 579
Joined: Thu Feb 13, 2020 11:32 pm
cars: Mainly GM trucks, a Cruze and an Equinox for dailys..

Re: Segment Swap utility

Post by ironduke »

I don’t think we’d use universal patcher for the editing. Tuner pro works pretty good, that’s what I’ve been writing the xdf files for. Joukoy has already written the checksum/cvn plug-in for tuner pro for the e38 so its pretty nice to work with.

He’s more than welcome to go nuts incorporating all of this into his universal patcher but it might be a little overkill. Not sure how it would be used.. once we build the info for dtc’s for each os were done. We can use this as a start and work on adding bit by bit.

As far as encoding the dtc, not sure what your asking? The table starts with 0010 then 00 11. That’s p0010 and p0011 and so on, They do change when you get to the C and U codes but it’s pretty easy to figure out since only the first byte is altered and I’ve already explained how to read it..
Post Reply