|
RomRaider
Documentation
Community
Developers
|
| Author |
Message |
|
Merp
|
Post subject: Re: Hacking with HEW Posted: Tue Jan 31, 2012 7:45 pm |
|
 |
| Experienced |
 |
Joined: Thu Jul 23, 2009 5:46 pm Posts: 863
|
|
Awesome! I will check this out later today, and probably re write my stuff on it.
My code compiled and everything, but after learning some more C I realize there are much better ways to go about it and the practice can't hurt..
I've also picked up some C#, started writing some console apps, and rewrote the c++ hex comparison console utility I was using to produce .dif files from scratch in C# with a simple forms gui.
_________________ Please do not send me support questions via PM, use the forum instead!
|
|
| Top |
|
 |
|
dschultz
|
Post subject: Re: Hacking with HEW Posted: Wed Feb 01, 2012 12:14 am |
|
 |
| RomRaider Developer |
Joined: Thu May 21, 2009 1:49 am Posts: 7323 Location: Canada eh!
|
|
| Top |
|
 |
|
nsfw
|
Post subject: Re: Hacking with HEW Posted: Wed Feb 01, 2012 3:28 am |
|
 |
| Moderator |
Joined: Thu Nov 23, 2006 2:23 am Posts: 2565
|
Yep, saw that. It's interesting that they feel that a hybrid solution is so useful. MAF blending might be unavoidable but I want to learn more about the issues with pure SD before I start working on MAF blending. But, I kinda like the idea of a small table (like 5x5 or so) that defines a MAF/SD ratio, based on MAP and RPM. You could put 0 in the top-left to have a MAF-based idle, and put 1.0 where you want pure SD, and blend between them wherever you want. I also like the alpha-N idea for vacuum conditions, because it seems like tip-in would cease to be necessary, so that's another thing I'd like to try. So many ideas, so little time. 
_________________ 2005 Legacy GT w/ ATP 3076, IWG, MBC, BCS, BC 272, LC, FFS, OMG Please don't send questions via PM. Post a thread and send me a link to it instead. Thanks!
|
|
| Top |
|
 |
|
nsfw
|
Post subject: Re: Hacking with HEW Posted: Wed Feb 01, 2012 8:38 am |
|
 |
| Moderator |
Joined: Thu Nov 23, 2006 2:23 am Posts: 2565
|
I just tested the SD patch from that last zip file, and it seems to work just fine, so... viewtopic.php?f=37&t=7818
_________________ 2005 Legacy GT w/ ATP 3076, IWG, MBC, BCS, BC 272, LC, FFS, OMG Please don't send questions via PM. Post a thread and send me a link to it instead. Thanks!
|
|
| Top |
|
 |
|
Merp
|
Post subject: Re: Hacking with HEW Posted: Sat Feb 04, 2012 3:40 am |
|
 |
| Experienced |
 |
Joined: Thu Jul 23, 2009 5:46 pm Posts: 863
|
Just about finished porting the latest to 07STi. I had to make a couple changes. The 07STi rom A2UJ000J does not use bitmasks on the clutch and fuel cut flags, just a test/comparison with 0 and 1. Essentially a LSb bitmask instead of MSb. I went through and replaced all of the hex values used in bitmasking with a #define RevLimitBitMask ((char)0x??) in ecuhacks.h. While going through that, I noticed this when the fuel cut is set. Is the extra cast as char pointer just leftover from previous code or is it serving some other purpose? Code: *((char*)pFlagsRevLimit) &= 0x7F // Actual code *pFlagsRevLimit &= !RevLimitBitMask; // Updated
_________________ Please do not send me support questions via PM, use the forum instead!
|
|
| Top |
|
 |
|
dschultz
|
Post subject: Re: Hacking with HEW Posted: Sat Feb 04, 2012 5:31 pm |
|
 |
| RomRaider Developer |
Joined: Thu May 21, 2009 1:49 am Posts: 7323 Location: Canada eh!
|
Merp wrote: Just about finished porting the latest to 07STi.
I had to make a couple changes. The 07STi rom A2UJ000J does not use bitmasks on the clutch and fuel cut flags, just a test/comparison with 0 and 1. Essentially a LSb bitmask instead of MSb. I went through and replaced all of the hex values used in bitmasking with a #define RevLimitBitMask ((char)0x??) in ecuhacks.h. As NSFW and I suspect, there's going to be a lot of #define tied to different CALIDs to make the code truly portable. Merp wrote: While going through that, I noticed this when the fuel cut is set. Is the extra cast as char pointer just leftover from previous code or is it serving some other purpose? Code: *((char*)pFlagsRevLimit) &= 0x7F // Actual code *pFlagsRevLimit &= !RevLimitBitMask; // Updated
This is the way I read it... - pFlagsRevLimit is an address (int) of the value you want to retrieve
- (char*)pFlagsRevLimit is a pointer to a char (byte) at address pFlagsRevLimit
- *((char*)pFlagsRevLimit) is the char (byte) value at pFlagsRevLimit
I think it also makes the compiler treat the dereferenced value as a char and forces the & operation to occur on char data types.
|
|
| Top |
|
 |
|
nsfw
|
Post subject: Re: Hacking with HEW Posted: Sat Feb 04, 2012 7:26 pm |
|
 |
| Moderator |
Joined: Thu Nov 23, 2006 2:23 am Posts: 2565
|
dschultz wrote: Merp wrote: Just about finished porting the latest to 07STi.
I had to make a couple changes. The 07STi rom A2UJ000J does not use bitmasks on the clutch and fuel cut flags, just a test/comparison with 0 and 1. Essentially a LSb bitmask instead of MSb. I went through and replaced all of the hex values used in bitmasking with a #define RevLimitBitMask ((char)0x??) in ecuhacks.h. As NSFW and I suspect, there's going to be a lot of #define tied to different CALIDs to make the code truly portable. Merp wrote: While going through that, I noticed this when the fuel cut is set. Is the extra cast as char pointer just leftover from previous code or is it serving some other purpose? Code: *((char*)pFlagsRevLimit) &= 0x7F // Actual code *pFlagsRevLimit &= !RevLimitBitMask; // Updated
This is the way I read it... - pFlagsRevLimit is an address (int) of the value you want to retrieve
- (char*)pFlagsRevLimit is a pointer to a char (byte) at address pFlagsRevLimit
- *((char*)pFlagsRevLimit) is the char (byte) value at pFlagsRevLimit
I think it also makes the compiler treat the dereferenced value as a char and forces the & operation to occur on char data types. The 2nd and 3rd one are definitely correct, but the first one actually depends on how pFlagsRevLimit was defined. int *pFlagsRevLimit; // you'd be correct char *pFlagsRevLimit; // you'd be mistaken - this actually makes the 1st and 2nd mean exactly the same thing ...so I think Merp was right, and the (char*) was left over from an earlier revision of the code. Dschultz and I exchanged a couple of PMs about portability and I'm going to rearrange things a bit to help with that in the next update. Ultimately I'd like to get to a point where there's one header file per ROM, with all of the ROM-specific stuff in it (addresses, mostly) and all you have to do is change one line of code to rebuild for a given ROM. However there are some ROM-specific things that are actually in the project configuration, so it won't be quite that simple, but hopefully it'll be close. The difference in rev limiter bits vs. bytes could be accomodated by something like this: #define pClutchSwitchByte ((char*) 0x12345) #define ClutchSwitchBitMask 1 if (*pClutchSwitchByte & ClutchSwitchBitMask) Plus I want to do dynamic fuel injector scaling for Z0rr0's ethanol sensor. I might do that first actually since it will take less work than rearranging everything.
_________________ 2005 Legacy GT w/ ATP 3076, IWG, MBC, BCS, BC 272, LC, FFS, OMG Please don't send questions via PM. Post a thread and send me a link to it instead. Thanks!
|
|
| Top |
|
 |
|
dschultz
|
Post subject: Re: Hacking with HEW Posted: Sat Feb 04, 2012 10:02 pm |
|
 |
| RomRaider Developer |
Joined: Thu May 21, 2009 1:49 am Posts: 7323 Location: Canada eh!
|
NSFW wrote: dschultz wrote: This is the way I read it... - pFlagsRevLimit is an address (int) of the value you want to retrieve
- (char*)pFlagsRevLimit is a pointer to a char (byte) at address pFlagsRevLimit
- *((char*)pFlagsRevLimit) is the char (byte) value at pFlagsRevLimit
I think it also makes the compiler treat the dereferenced value as a char and forces the & operation to occur on char data types. The 2nd and 3rd one are definitely correct, but the first one actually depends on how pFlagsRevLimit was defined. int *pFlagsRevLimit; // you'd be correct char *pFlagsRevLimit; // you'd be mistaken - this actually makes the 1st and 2nd mean exactly the same thing ...so I think Merp was right, and the (char*) was left over from an earlier revision of the code. So I can learn more about this strange language called C. I ran the two senarios through the pre-process seperately. The define is as such: #define pFlagsRevLimit (( char*) 0xFFFF5A40) The cpp output for "*(( char*)pFlagsRevLimit) &= 0x7F;" is: Code: *((char*)((char*) 0xFFFF5A40)) &= 0x7F; If I change the code line to "*pFlagsRevLimit &= 0x7F;" I get this: Code: *((char*) 0xFFFF5A40) &= 0x7F; In both cases the code compiles to be: Code: MOV.L @(H'0040:8,PC),R1 ; 0xFFFF5A40 MOV.L @(H'0040:8,PC),R2 ; 0xFFFF5A40 MOV.B @R2,R2 MOV #H'7F,R3 AND R3,R2 EXTS.B R2,R2 MOV.B R2,@R1 ; 0xFFFF5A40
In the end the same result is achieved, a byte is loaded ANDed with 0x7F and written back to the RAM location.
|
|
| Top |
|
 |
|
Merp
|
Post subject: Re: Hacking with HEW Posted: Sun Feb 12, 2012 10:37 pm |
|
 |
| Experienced |
 |
Joined: Thu Jul 23, 2009 5:46 pm Posts: 863
|
Merp wrote: Just about finished porting the latest to 07STi.
I had to make a couple changes. The 07STi rom A2UJ000J does not use bitmasks on the clutch and fuel cut flags, just a test/comparison with 0 and 1. Essentially a LSb bitmask instead of MSb. I went through and replaced all of the hex values used in bitmasking with a #define RevLimitBitMask ((char)0x??) in ecuhacks.h.
Finished the port and flashed on the tester's car. Everything is working so far (need to build VE table to test the rest). In addition to the changed bitmasking code I've added CEL flashing code (in C) with FBKC flashing & IAM recall. Also added a blending mode (3d rpm X map table) to the speed density code. Will be posting this project soon.. contemplating releasing it as is or waiting to add programming mode and/or spark cut. For the CAL ID, I changed A2UJ000J to A2UJ0SDJ.. thoughts?
_________________ Please do not send me support questions via PM, use the forum instead!
|
|
| Top |
|
 |
|
td-d
|
Post subject: Re: Hacking with HEW Posted: Mon Feb 13, 2012 12:04 pm |
|
 |
| Moderator |
Joined: Thu May 20, 2010 8:01 am Posts: 3117 Location: Johannesburg, South Africa
|
Personally, I would prefer if you posted it as is - but then again I'm biased 
_________________ He who dies with the most gadgets wins.
Please do not PM me - use the email option.
|
|
| Top |
|
 |
|
fastblueufo
|
Post subject: Re: Hacking with HEW Posted: Mon Feb 13, 2012 2:38 pm |
|
 |
| Senior Member |
Joined: Thu Mar 27, 2008 5:00 pm Posts: 1333 Location: Bama, 02 wrx, stroked ej22t, pt5857, ppg, E85 (fear the ear) ed@fastperformancetuning.com
|
NSFW wrote: Yep, saw that. It's interesting that they feel that a hybrid solution is so useful. MAF blending might be unavoidable but I want to learn more about the issues with pure SD before I start working on MAF blending. But, I kinda like the idea of a small table (like 5x5 or so) that defines a MAF/SD ratio, based on MAP and RPM. You could put 0 in the top-left to have a MAF-based idle, and put 1.0 where you want pure SD, and blend between them wherever you want. I also like the alpha-N idea for vacuum conditions, because it seems like tip-in would cease to be necessary, so that's another thing I'd like to try. So many ideas, so little time.  In the cobb software, they use a table with value 0,1,2. 0=maf, 1=sd, 2=maf/sd blend. When using blend there are three thresholds. One is rpm, one is map, one is tps. After the thresholds are met it will switch from maf to sd. Kinda like the utec is setup. There are two undefined smoothing factors for load in the gr sti roms. They use one of them for sd and recommend to not use a smoothing factor with sd. So it is set to 1= no smoothing. Stock is set for .127 iirc for maf. That gives a stronger smoothing factor. Map sensor voltage must be way more stable than maf volts. They use a true ve table for there sd. Its set up nicely and looks easy to tune. The realtime tuning will be great with sd. They did a really nice job. It was worth the wait.
Last edited by fastblueufo on Mon Feb 13, 2012 3:18 pm, edited 1 time in total.
|
|
| Top |
|
 |
|
dschultz
|
Post subject: Re: Hacking with HEW Posted: Mon Feb 13, 2012 2:40 pm |
|
 |
| RomRaider Developer |
Joined: Thu May 21, 2009 1:49 am Posts: 7323 Location: Canada eh!
|
Merp wrote: For the CAL ID, I changed A2UJ000J to A2UJ0SDJ.. thoughts? I don't think it really matters. I haven't seen any consistent pattern to the numbering scheme.
|
|
| Top |
|
 |
|
nsfw
|
Post subject: Re: Hacking with HEW Posted: Sun Feb 19, 2012 7:57 am |
|
 |
| Moderator |
Joined: Thu Nov 23, 2006 2:23 am Posts: 2565
|
|
I was hoping to have some flex-fuel stuff to share by now, and re-arrangement of the code for easier portability, but everything has taken a back seat to my day job. It's coming though. I have the code written (some time ago, actually) for fuel injector scaling via TGV input, with a bit of the portability work, I just need time to give it proper testing.
_________________ 2005 Legacy GT w/ ATP 3076, IWG, MBC, BCS, BC 272, LC, FFS, OMG Please don't send questions via PM. Post a thread and send me a link to it instead. Thanks!
|
|
| Top |
|
 |
|
Merp
|
Post subject: Re: Hacking with HEW Posted: Sat Mar 10, 2012 1:06 pm |
|
 |
| Experienced |
 |
Joined: Thu Jul 23, 2009 5:46 pm Posts: 863
|
|
I'm still having issues when trying to add more than 3 "patch" items in my metadata. I've verified that it isn't specific to any code, just the amount of items in the metadata. Rompatch returns a 'patch is null' error, but sniffing the patch shows that it looks legit.
Any ideas? I've consolidated all code into a single ROMHole section, but I need to run two more hooks that require patches.
_________________ Please do not send me support questions via PM, use the forum instead!
Last edited by Merp on Sun Mar 11, 2012 4:11 am, edited 1 time in total.
|
|
| Top |
|
 |
|
nsfw
|
Post subject: Re: Hacking with HEW Posted: Sat Mar 10, 2012 11:15 pm |
|
 |
| Moderator |
Joined: Thu Nov 23, 2006 2:23 am Posts: 2565
|
|
Can you post a ROM and a patch file? I'll need to watch RomPatch in a debugger to see what's going on. You can PM them to me if you'd rather.
_________________ 2005 Legacy GT w/ ATP 3076, IWG, MBC, BCS, BC 272, LC, FFS, OMG Please don't send questions via PM. Post a thread and send me a link to it instead. Thanks!
|
|
| Top |
|
 |
Who is online |
Users browsing this forum: No registered users and 10 guests |
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot post attachments in this forum
|
|