Enginuity 0.2.4 Alpha

git-svn-id: http://svn.3splooges.com/romraider-arch/trunk@17 d2e2e1cd-ba16-0410-be16-b7c4453c7c2d
This commit is contained in:
drees 2006-06-28 06:39:42 +00:00
parent 698a1e7e06
commit 3b4c1a9842
17 changed files with 766 additions and 150 deletions

View File

@ -5,31 +5,190 @@
<make>Subaru</make>
<model>Impreza</model>
<submodel>WRX</submodel>
<filesize>192kb</filesize>
</romid>
<table type="3D" name="Main Ignition" category="Timing" swapxy="false" flipx="false" flipy="false" storagetype="uint8" endian="big" sizex="16" sizey="15">
<scaling units="degrees" expression="(x-57)*360/1024" format="#.00" increment="1" />
<table type="X Axis" name="Engine Load" storagetype="uint16" endian="big" sizex="16">
<scaling units="grams" expression="x/8192" format="0.00" increment="256" />
</table>
<table type="Y Axis" name="Engine RPM" storagetype="uint16" endian="big" sizey="15">
<scaling units="RPM" expression="x/256*50" format="#" increment="256" />
</table>
<description>"This is a map of base ignition values."</description>
<table type="3D" name="Main Ignition" category="Timing" swapxy="false" flipx="false" flipy="false" storagetype="uint8" endian="big" sizex="16" sizey="15">
<scaling units="degrees" expression="(x-57)*360/1024" to_byte="x/360*1024+57" format="#.00" increment="1" />
<table type="X Axis" name="Engine Load" storagetype="uint16" endian="big" sizex="16">
<scaling units="grams" expression="x/8192" to_byte="x*8192" format="0.00" increment="256" />
</table>
<table type="Y Axis" name="Engine RPM" storagetype="uint16" endian="big" sizey="15">
<scaling units="RPM" expression="x/256*50" to_byte="x/50*256" format="#" increment="256" />
</table>
<description>"This is a map of base ignition values."</description>
</table>
<table type="3D" name="Ignition Correction" category="Timing" swapxy="false" flipx="false" flipy="false" storagetype="uint8" endian="big" sizex="13" sizey="16">
<scaling units="degrees" expression="x*360/1024" to_byte="x/360*1024" format="#.00" increment="1" />
<table type="X Axis" name="Engine Load" storagetype="uint16" endian="big" sizex="13">
<scaling units="grams" expression="x/8192" to_byte="x*8192" format="0.00" increment="256" />
</table>
<table type="Y Axis" name="Engine RPM" storagetype="uint16" endian="big" sizey="16">
<scaling units="RPM" expression="x/256*50" to_byte="x/50*256" format="#" increment="256" />
</table>
<description>"Ignition correction values, added * IAM / 16."</description>
</table>
<table type="3D" name="Wastegate Duty Cycle" category="Boost" swapxy="false" flipx="false" flipy="false" storagetype="uint8" endian="big" sizex="8" sizey="8">
<scaling units="%" expression="x/2.55" to_byte="x*2.55" format="#" increment="3" />
<table type="X Axis" name="Throttle" storagetype="uint16" endian="big" sizex="8">
<scaling units="%" expression="x/434" to_byte="x*434" format="#" increment="256" />
</table>
<table type="Y Axis" name="Engine RPM" storagetype="uint16" endian="big" sizey="8">
<scaling units="RPM" expression="x/256*50" to_byte="x/50*256" format="#" increment="256" />
</table>
<description>"Maximum allowed wastegate duty cycle."</description>
</table>
<table type="3D" name="Boost Target" category="Boost" swapxy="false" flipx="false" flipy="false" storagetype="uint8" endian="big" sizex="8" sizey="9">
<scaling units="psi" expression="(x-94)*.15425" to_byte="x/.15425+94" format="#0.00" increment="1" />
<table type="X Axis" name="Throttle" storagetype="uint16" endian="big" sizex="8">
<scaling units="%" expression="x/434" to_byte="x*434" format="#" increment="256" />
</table>
<table type="Y Axis" name="Engine RPM" storagetype="uint16" endian="big" sizey="9">
<scaling units="RPM" expression="x/256*50" to_byte="x/50*256" format="#" increment="256" />
</table>
<description>"Target boost level."</description>
</table>
<table type="3D" name="Fuel (Low Det)" category="Fuel" swapxy="false" flipx="false" flipy="false" storagetype="uint8" endian="big" sizex="14" sizey="16">
<scaling units="Air/Fuel Ratio" expression="14.7/(1+x/128)" to_byte="(14.7/x-1)*128" format="#.00" increment="1" />
<table type="X Axis" name="Engine Load" storagetype="uint16" endian="big" sizex="14">
<scaling units="grams" expression="x/8192" to_byte="x*8192" format="0.00" increment="256" />
</table>
<table type="Y Axis" name="Engine RPM" storagetype="uint16" endian="big" sizey="16">
<scaling units="RPM" expression="x/256*50" to_byte="x/50*256" format="#" increment="256" />
</table>
<description>"Low detonation fuel map, used when Ignition Advance Multiplier is greater than 4."</description>
</table>
<table type="3D" name="Fuel (High Det)" category="Fuel" swapxy="false" flipx="false" flipy="false" storagetype="uint8" endian="big" sizex="14" sizey="16">
<scaling units="Air/Fuel Ratio" expression="14.7/(1+x/128)" to_byte="(14.7/x-1)*128" format="#.00" increment="1" />
<table type="X Axis" name="Engine Load" storagetype="uint16" endian="big" sizex="14">
<scaling units="grams" expression="x/8192" to_byte="x*8192" format="0.00" increment="256" />
</table>
<table type="Y Axis" name="Engine RPM" storagetype="uint16" endian="big" sizey="16">
<scaling units="RPM" expression="x/256*50" to_byte="x/50*256" format="#" increment="256" />
</table>
<description>"Low detonation fuel map, used when Ignition Advance Multiplier is 4 or less."</description>
</table>
<table type="3D" name="EGT Limit" category="CEL" swapxy="false" flipx="false" flipy="false" storagetype="uint8" endian="big" sizex="2" sizey="2">
<scaling units="unknown" expression="(9/5)*((x-40)*5)+32" to_byte="x" format="#" increment="1" />
<table type="X Axis" name="Load" storagetype="uint16" endian="big" sizex="2">
<scaling units="grams" expression="x/8192" to_byte="x*8192" format="0.00" increment="256" />
</table>
<table type="Y Axis" name="Engine RPM" storagetype="uint16" endian="big" sizey="2">
<scaling units="RPM" expression="x/256*50" to_byte="x/50*256" format="#" increment="256" />
</table>
<description>"Maximum allowed Exhaust Gas Temperature limit before Check Engine Light."</description>
</table>
<table type="2D" name="Rev Limit" storagetype="uint16" endian="big" sizey="2">
<scaling units="RPM" expression="x/256*50" format="#" increment="256" />
<description>"RPM at which limiter turns on and off."</description>
<table type="Static Y Axis" name="Condition" units="" sizey="2">
<data>on</data>
<data>off</data>
</table>
</table>
<table type="1D" name="Injector Flow Scaling" category="Fuel" storagetype="uint16" endian="big" sizey="1">
<scaling units="cc" expression="2447960/x" format="#.00" increment="-17" />
<description>"Injector flow rating in cc/min"</description>
<table type="2D" name="Rev Limit" storagetype="uint16" endian="big" sizey="2">
<scaling units="RPM" expression="x/256*50" to_byte="x/50*256" format="#" increment="256" />
<description>"RPM at which limiter turns on and off."</description>
<table type="Static Y Axis" name="Condition" units="" sizey="2">
<data>on</data>
<data>off</data>
</table>
</table>
<table type="2D" name="Coarse Ignition Range (RPM)" storagetype="uint16" endian="big" sizey="4">
<scaling units="RPM" expression="x/256*50" to_byte="x/50*256" format="#" increment="256" />
<table type="Static Y Axis" name="Condition" sizey="4">
<data>On (AT)</data>
<data>On (MT)</data>
<data>Off (AT)</data>
<data>Off (MT)</data>
</table>
</table>
<table type="2D" name="Coarse Ignition Range (Load)" storagetype="uint16" endian="big" sizey="4">
<scaling units="grams" expression="x/8192" to_byte="x*8192" format="0.00" increment="256" />
<table type="Static Y Axis" name="Condition" sizey="4">
<data>On (AT)</data>
<data>On (MT)</data>
<data>Off (AT)</data>
<data>Off (MT)</data>
</table>
</table>
<table type="2D" name="Fuel Speed Limiting" storagetype="uint8" endian="big" sizey="4">
<scaling units="MPH" expression="x/1.609" to_byte="x*1.609" format="#" increment="1" />
<description>"Speed at which fuel is cut."</description>
<table type="Static Y Axis" name="Condition" sizey="4">
<data>On (AT)</data>
<data>On (MT)</data>
<data>Off (AT)</data>
<data>Off (MT)</data>
</table>
</table>
<table type="2D" name="Wastegate Speed Compensation" storagetype="uint8" endian="big" sizey="16">
<scaling units="%" expression="x/2.55" to_byte="x*2.55" format="#" increment="3" />
<table type="Y Axis" name="Vehicle Speed" storagetype="uint16" endian="big" sizey="16">
<scaling units="MPH" expression="x/1.609" to_byte="x*1.609" format="#" increment="1" />
</table>
</table>
<table type="1D" name="Injector Flow Scaling" category="Fuel" storagetype="uint16" endian="big" sizey="1">
<scaling units="cc" expression="2447960/x" to_byte="2447960/x" format="#.00" increment="-17" />
<description>"Fuel injector flow rating"</description>
</table>
<table type="1D" name="Injector Pulse Width" storagetype="uint16" endian="big" sizey="5">
<scaling units="?" format="#" increment="256" />
<description>"Injector opening time compensation."</description>
</table>
<table type="1D" name="Boost Speed Limiting" storagetype="uint8" endian="big" sizey="3">
<scaling units="MPH" expression="x/1.609" to_byte="x*1.609" format="#" increment="1" />
<description>"Speed at which boost is reduced to wastegate pressure."</description>
</table>
<table type="1D" name="MAF Sensor Scaling" storagetype="uint16" endian="big" sizey="48">
<scaling units="MAF" format="#" increment="256" />
<description>"Mass Air Flow sensor scaling."</description>
</table>
<table type="1D" name="Boost Limit (CEL) ?" storagetype="uint16" endian="big" sizey="5">
<scaling units="?" format="#" increment="256" />
<description>"Max boost before Check Engine Light."</description>
</table>
<table type="1D" name="Boost Limit (Fuel Cut) ?" storagetype="uint16" endian="big" sizey="5">
<scaling units="?" format="#" increment="256" />
<description>"Max boost before fuel cut."</description>
</table>
<table type="1D" name="CL Min Coolant Temp ?" storagetype="uint16" endian="big" sizey="1">
<scaling units="?" format="#" increment="256" />
<description>"Minimum coolant temp for closed loop fueling."</description>
</table>
<table type="1D" name="CL Max RPM ?" storagetype="uint16" endian="big" sizey="2">
<scaling units="RPM" expression="x/256*50" to_byte="x/50*256" format="#" increment="256" />
<description>"Maximum RPM for closed loop fueling."</description>
</table>
<table type="1D" name="CL Max Speed ?" storagetype="uint16" endian="big" sizey="1">
<scaling units="?" format="#" increment="256" />
<description>"Maximum vehicle speed for closed loop fueling."</description>
</table>
<table type="1D" name="CL Max EGT ?" storagetype="uint16" endian="big" sizey="1">
<scaling units="?" format="#" increment="256" />
<description>"Maximum exhaust gas temperature for closed loop fueling."</description>
</table>
<table type="1D" name="Tip-In Enrichment" storagetype="uint8" endian="big" sizey="18">
<scaling units="?" format="#" increment="1" />
<description>"Throttle delta fuel compensation (delta)."</description>
</table>
</rom>
<rom base="WRXBASE">
<romid>
<xmlid>A4TF400E</xmlid>
@ -43,60 +202,293 @@
<flashmethod>wrx04</flashmethod>
<memmodel>unknown</memmodel>
</romid>
<table name="Main Ignition" storageaddress="0x293EB">
<table type="X Axis" storageaddress="0x293C9" />
<table type="Y Axis" storageaddress="0x293AA" />
<table name="Main Ignition" storageaddress="0x293EB">
<table type="X Axis" storageaddress="0x293C9" />
<table type="Y Axis" storageaddress="0x293AA" />
</table>
<table name="Ignition Correction" storageaddress="0x298BD">
<table type="X Axis" storageaddress="0x298A1" />
<table type="Y Axis" storageaddress="0x29880" />
</table>
<table name="Wastegate Duty Cycle" storageaddress="0x2A68E">
<table type="X Axis" storageaddress="0x2A67C" />
<table type="Y Axis" storageaddress="0x2A66B" />
</table>
<table name="Boost Target" storageaddress="0x2A726">
<table type="X Axis" storageaddress="0x2A714" />
<table type="Y Axis" storageaddress="0x2A701" />
</table>
<table name="Fuel (Low Det)" storageaddress="0x28E0D">
<table type="X Axis" storageaddress="0x28DEF" />
<table type="Y Axis" storageaddress="0x28DCE" />
</table>
<table name="Fuel (High Det)" storageaddress="0x28F30">
<table type="X Axis" storageaddress="0x28F12" />
<table type="Y Axis" storageaddress="0x28EED" />
</table>
<table name="EGT Limit" storageaddress="0x2AFF8">
<table type="X Axis" storageaddress="0x2AFF2" />
<table type="Y Axis" storageaddress="0x2AFED" />
</table>
<table name="Rev Limit" storageaddress="0x291C8" />
<table name="Coarse Ignition Range (RPM)" storageaddress="0x2998E" />
<table name="Coarse Ignition Range (Load)" storageaddress="0x29996" />
<table name="Injector Flow Scaling" storageaddress="0x286BB" />
<table name="Injector Pulse Width" storageaddress="0x286C3" />
<table name="Boost Speed Limiting" storageaddress="0x2A7DC" />
<table name="Fuel Speed Limiting" storageaddress="0x291E9" />
<table name="MAF Sensor Scaling" storageaddress="0x2808A" />
<table name="Boost Limit (CEL) ?" storageaddress="0x2AEE1" />
<table name="Boost Limit (Fuel Cut) ?" storageaddress="0x291F9" />
<table name="CL Min Coolant Temp ?" storageaddress="0x291F9" />
<table name="CL Max RPM ?" storageaddress="0x28D62" />
<table name="Tip-In Enrichment" storageaddress="0x29107" />
</rom>
<rom base="A4TF400E">
<romid>
<xmlid>A4TF800E</xmlid>
<internalidaddress>200</internalidaddress>
<internalidstring>A4TF800E</internalidstring>
</romid>
<xmlid>A4TF800E</xmlid>
<internalidaddress>200</internalidaddress>
<internalidstring>A4TF800E</internalidstring>
</romid>
</rom>
<rom base="A4TF400E">
<romid>
<xmlid>A4TF300E</xmlid>
<internalidaddress>200</internalidaddress>
<internalidstring>A4TF300E</internalidstring>
</romid>
<xmlid>A4TF300E</xmlid>
<internalidaddress>200</internalidaddress>
<internalidstring>A4TF300E</internalidstring>
</romid>
</rom>
<rom base="A4TF400E">
<romid>
<xmlid>A4TF500F</xmlid>
<internalidaddress>200</internalidaddress>
<internalidstring>A4TF500F</internalidstring>
</romid>
<xmlid>A4TF500F</xmlid>
<internalidaddress>200</internalidaddress>
<internalidstring>A4TF500F</internalidstring>
</romid>
</rom>
<rom base="A4TF400E">
<romid>
<xmlid>A4TF510F</xmlid>
<internalidaddress>200</internalidaddress>
<internalidstring>A4TF510F</internalidstring>
</romid>
<xmlid>A4TF510F</xmlid>
<internalidaddress>200</internalidaddress>
<internalidstring>A4TF510F</internalidstring>
</romid>
</rom>
<rom base="A4TF400E">
<romid>
<xmlid>A4TF520F</xmlid>
<internalidaddress>200</internalidaddress>
<internalidstring>A4TF520F</internalidstring>
</romid>
<xmlid>A4TF520F</xmlid>
<internalidaddress>200</internalidaddress>
<internalidstring>A4TF520F</internalidstring>
</romid>
</rom>
<rom base="A4TF400E">
<romid>
<xmlid>A4TF800F</xmlid>
<internalidaddress>200</internalidaddress>
<internalidstring>A4TF800F</internalidstring>
</romid>
<xmlid>A4TF800F</xmlid>
<internalidaddress>200</internalidaddress>
<internalidstring>A4TF800F</internalidstring>
</romid>
</rom>
<rom base="WRXBASE">
<romid>
<xmlid>A4SGC00C</xmlid>
<internalidaddress>200</internalidaddress>
<internalidstring>A4SGC00C</internalidstring>
<caseid>?</caseid>
<ecuid>1</ecuid>
<market>USDM</market>
<transmission>?</transmission>
<year>2002</year>
<flashmethod>wrx02</flashmethod>
<memmodel>unknown</memmodel>
</romid>
<table name="Fuel (Low Det)" storageaddress="0x293A4" sizex="15">
<table type="X Axis" storageaddress="0x29384" />
<table type="Y Axis" storageaddress="0x29363" />
</table>
<table name="Fuel (High Det)" storageaddress="0x294E6">
<table type="X Axis" storageaddress="0x294C8" />
<table type="Y Axis" storageaddress="0x294A3" />
</table>
<table name="Main Ignition" storageaddress="0x29BB3">
<table type="X Axis" storageaddress="0x29B91" />
<table type="Y Axis" storageaddress="0x29B70" />
</table>
<table name="Ignition Correction" storageaddress="0x2A11E">
<table type="X Axis" storageaddress="0x2A102" />
<table type="Y Axis" storageaddress="0x2A0E1" />
</table>
<table base="Wastegate Duty Cycle" name="Wastegate Duty Cycle (MT)" storageaddress="0x2B367">
<table type="X Axis" storageaddress="0x2B355" />
<table type="Y Axis" storageaddress="0x2B344" />
</table>
<table base="Wastegate Duty Cycle" name="Wastegate Duty Cycle (AT)" storageaddress="0x2B304">
<table type="X Axis" storageaddress="0x2B2F2" />
<table type="Y Axis" storageaddress="0x2B2E1" />
</table>
<table base="Boost Target" name="Boost Target (MT)" storageaddress="0x2B3FF">
<table type="X Axis" storageaddress="0x2B3ED" />
<table type="Y Axis" storageaddress="0x2B3DA" />
</table>
<table base="Boost Target" name="Boost Target (AT)" storageaddress="0x2B46C">
<table type="X Axis" storageaddress="0x2B45A" />
<table type="Y Axis" storageaddress="0x2B447" />
</table>
<table name="EGT Limit" omit="true" />
<table name="Rev Limit" storageaddress="0x298B4" />
<table name="Injector Flow Scaling" storageaddress="0x28AE6" />
</rom>
<rom base="WRXBASE">
<romid>
<xmlid>A4TC300L</xmlid>
<internalidaddress>200</internalidaddress>
<internalidstring>A4TC300L</internalidstring>
<caseid>?</caseid>
<ecuid>1</ecuid>
<market>USDM</market>
<transmission>Manual</transmission>
<year>2003</year>
<flashmethod>wrx02</flashmethod>
<memmodel>unknown</memmodel>
</romid>
<table name="Fuel (Low Det)" storageaddress="0x28F35">
<table type="X Axis" storageaddress="0x28F17" />
<table type="Y Axis" storageaddress="0x28EF2" />
</table>
<table name="Main Ignition" storageaddress="0x293EF">
<table type="X Axis" storageaddress="0x293CD" />
<table type="Y Axis" storageaddress="0x293AE" />
</table>
<table name="Ignition Correction" storageaddress="0x298C1">
<table type="X Axis" storageaddress="0x298A5" />
<table type="Y Axis" storageaddress="0x29884" />
</table>
<table name="Wastegate Duty Cycle" storageaddress="0x2A69E">
<table type="X Axis" storageaddress="0x2A68C" />
<table type="Y Axis" storageaddress="0x2A67B" />
</table>
<table name="Boost Target" storageaddress="0x2A736">
<table type="X Axis" storageaddress="0x2A724" />
<table type="Y Axis" storageaddress="0x2A711" />
</table>
</rom>
<rom base="WRXBASE">
<romid>
<xmlid>A4SGD10C</xmlid>
<internalidaddress>200</internalidaddress>
<internalidstring>A4SGD10C</internalidstring>
<caseid>?</caseid>
<ecuid>1</ecuid>
<market>USDM</market>
<transmission>?</transmission>
<year>2002</year>
<flashmethod>wrx02</flashmethod>
<memmodel>unknown</memmodel>
</romid>
<table name="Fuel (Low Det)" storageaddress="0x293A4" sizex="15">
<table type="X Axis" storageaddress="0x29384" />
<table type="Y Axis" storageaddress="0x29363" />
</table>
<table name="Main Ignition" storageaddress="0x29BB3">
<table type="X Axis" storageaddress="0x29B91" />
<table type="Y Axis" storageaddress="0x29B70" />
</table>
<table name="Ignition Correction" storageaddress="0x2A11E">
<table type="X Axis" storageaddress="0x2A102" />
<table type="Y Axis" storageaddress="0x2A0E1" />
</table>
<table name="Wastegate Duty Cycle" storageaddress="0x2B308">
<table type="X Axis" storageaddress="0x2B2F6" />
<table type="Y Axis" storageaddress="0x2B2E5" />
</table>
<table name="Boost Target" storageaddress="0x2B470">
<table type="X Axis" storageaddress="0x2B45E" />
<table type="Y Axis" storageaddress="0x2B44B" />
</table>
</rom>
<rom base="WRXBASE">
<romid>
<xmlid>A4SG900C</xmlid>
<internalidaddress>200</internalidaddress>
<internalidstring>A4SG900C</internalidstring>
<caseid>?</caseid>
<ecuid>1</ecuid>
<market>?</market>
<transmission>?</transmission>
<year>2002</year>
<flashmethod>wrx02</flashmethod>
<memmodel>unknown</memmodel>
</romid>
<table name="Fuel (Low Det)" storageaddress="0x293A4" sizex="16" sizey="18">
<table type="X Axis" storageaddress="0x29382" />
<table type="Y Axis" storageaddress="0x2935D" />
</table>
<table name="Main Ignition" storageaddress="0x29BF7" sizey="18">
<table type="X Axis" storageaddress="0x29BD5" />
<table type="Y Axis" storageaddress="0x29BB0" />
</table>
<table name="Ignition Correction" storageaddress="0x2A18C" sizex="16" sizey="18">
<table type="X Axis" storageaddress="0x2A16A" />
<table type="Y Axis" storageaddress="0x2A145" />
</table>
<table name="Wastegate Duty Cycle" storageaddress="0x2B39E">
<table type="X Axis" storageaddress="0x2B38C" />
<table type="Y Axis" storageaddress="0x2B37B" />
</table>
<table name="Boost Target" storageaddress="0x2B499">
<table type="X Axis" storageaddress="0x2B487" />
<table type="Y Axis" storageaddress="0x2B474" />
</table>
</rom>
<rom base="WRXBASE">
<romid>
<xmlid>A4TE001G</xmlid>
<internalidaddress>200</internalidaddress>
<internalidstring>A4TE001G</internalidstring>
<caseid>?</caseid>
<ecuid>1</ecuid>
<market>EUDM</market>
<transmission>?</transmission>
<year>2003</year>
<flashmethod>wrx02</flashmethod>
<memmodel>unknown</memmodel>
<filesize>160kb</filesize>
</romid>
<table name="Fuel (Low Det)" storageaddress="0x20CB7" sizex="16" sizey="16">
<table type="X Axis" storageaddress="0x20C95" />
<table type="Y Axis" storageaddress="0x20C74" />
</table>
<table name="Main Ignition" storageaddress="0x212A3" sizey="16">
<table type="X Axis" storageaddress="0x21281" />
<table type="Y Axis" storageaddress="0x21260" />
</table>
<table name="Ignition Correction" storageaddress="0x217EA" sizex="13" sizey="16">
<table type="X Axis" storageaddress="0x217CE" />
<table type="Y Axis" storageaddress="0x217AD" />
</table>
<table name="Boost Target" storageaddress="0x22540">
<table type="X Axis" storageaddress="0x22534" storagetype="unit8">
<scaling expression="x/1.3" to_byte="x*1.3" />
</table>
<table type="Y Axis" storageaddress="0x22523" />
</table>
</rom>
</roms>

View File

@ -6,13 +6,22 @@ Enginuity is currently in ALPHA TEST status, meaning it is untested and not inte
Until Enginuity reaches a mature point, releases will be quite frequent and will usually contain significant changes. However, some times I may release a revision to add a single feature I'd like users to have, or maybe just to add a certain ECU version. Until more features are complete, version support will be quite limited. If you'd like your ECU version to be added, please visit openecu.org and post a message in the Technical Tuning Software forum, with your image attached.
0.2.3a Release Notes
0.2.4a Release Notes
--------------------
Yesterday's release (0.2.2a) was intended only as a very short term test release, and I got the fixes done about as quickly as I could have hoped. All known issues with current functionality have been dealt with and ECU definition include support is working quite well. We're now ready to move on to more fully developing the interface, which should make users happy. :)
Includes are now working much better than they were in 0.2.3a. Adding more definitions should be much more intuitive, and I plan on adding a good number before doing any more development. Coarse and absolute value input will make tuning more user friendly and faster. Also, the 160kb/192kb difference in ROMs dumped with and without RAM sectors is now accounted for, rather than just 192kb images. We're getting close to a stable release.
Changes:
--------
0.2.4a (3/21/2006)
------------------
- "Base" attribute for extending/duplicating tables
- "Omit" attribute not required to omit tables -- just set storageaddress to "0"
- Fine and coarse adjustment of values
- Direct value input
- Support for ROMs with or without RAM sectors
0.2.3a (2/27/2006)
------------------
- ECU definitions including each other (endless loop) is now handled

View File

@ -33,7 +33,7 @@ public class ECUEditor extends JFrame implements WindowListener {
private RomTree imageList = new RomTree(imageRoot);
private Vector<Rom> images = new Vector<Rom>();
private Settings settings = new Settings();
private String version = new String("0.2.3 Alpha");
private String version = new String("0.2.4 Alpha");
private String titleText = new String("Enginuity v" + version);
private JDesktopPane rightPanel = new JDesktopPane();
private Rom lastSelectedRom = null;

View File

@ -4,17 +4,18 @@ import java.awt.Color;
import java.awt.Font;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.io.Serializable;
import java.text.DecimalFormat;
import javax.swing.JLabel;
import javax.swing.border.LineBorder;
import org.nfunk.jep.JEP;
import org.nfunk.jep.*;
public class DataCell extends JLabel implements MouseListener {
public class DataCell extends JLabel implements MouseListener, Serializable {
private int binValue = 0;
private int originalValue = 0;
private Scale scale = new Scale();
private String realValue = "";
private String displayValue = "";
private Color scaledColor = new Color(0,0,0);
private Color highlightColor = new Color(155,155,255);
private Boolean selected = false;
@ -38,19 +39,20 @@ public class DataCell extends JLabel implements MouseListener {
this.addMouseListener(this);
}
public void calcRealValue() {
DecimalFormat formatter = new DecimalFormat(scale.getFormat());
// create parser
public void updateDisplayValue() {
DecimalFormat formatter = new DecimalFormat(scale.getFormat());
displayValue = formatter.format(calcDisplayValue(binValue, table.getScale().getExpression()));
this.setText(displayValue);
}
public double calcDisplayValue(int input, String expression) {
JEP parser = new JEP();
parser.initSymTab(); // clear the contents of the symbol table
parser.addStandardConstants();
parser.addComplex(); // among other things adds i to the symbol table
parser.addVariable("x", binValue);
parser.parseExpression(scale.getExpression());
realValue = formatter.format(parser.getValue());
this.setText(realValue);
parser.addVariable("x", input);
parser.parseExpression(expression);
return parser.getValue();
}
public void setColor(Color color) {
@ -58,9 +60,9 @@ public class DataCell extends JLabel implements MouseListener {
if (!selected) super.setBackground(color);
}
public void setRealValue(String realValue) {
this.realValue = realValue;
this.setText(realValue);
public void setDisplayValue(String displayValue) {
this.displayValue = displayValue;
this.setText(displayValue);
}
public void setBinValue(int binValue) {
@ -71,7 +73,7 @@ public class DataCell extends JLabel implements MouseListener {
} else if (binValue > Math.pow(256, table.getStorageType()) - 1) {
this.setBinValue((int)(Math.pow(256, table.getStorageType()) - 1));
}
this.calcRealValue();
this.updateDisplayValue();
if (binValue != getOriginalValue()) {
this.setBorder(new LineBorder(Color.RED, 3));
} else {
@ -84,7 +86,7 @@ public class DataCell extends JLabel implements MouseListener {
}
public String toString() {
return realValue;
return displayValue;
}
public Boolean isSelected() {
@ -98,6 +100,7 @@ public class DataCell extends JLabel implements MouseListener {
} else {
this.setBackground(scaledColor);
}
table.getFrame().getToolBar().setCoarseValue(table.getScale().getIncrement());
}
public void setHighlighted(Boolean highlighted) {
@ -134,12 +137,9 @@ public class DataCell extends JLabel implements MouseListener {
}
public void mouseExited(MouseEvent e) { }
public void increment() {
this.setBinValue(binValue + scale.getIncrement());
}
public void decrement() {
this.setBinValue(binValue - scale.getIncrement());
public void increment(int increment) {
if (table.getScale().getIncrement() < 0) increment = 0 - increment;
this.setBinValue(binValue + increment);
}
public void setTable(Table table) {
@ -174,4 +174,15 @@ public class DataCell extends JLabel implements MouseListener {
public void setRevertPoint() {
this.setOriginalValue(binValue);
}
public void setRealValue(String input) {
// create parser
JEP parser = new JEP();
parser.initSymTab(); // clear the contents of the symbol table
parser.addStandardConstants();
parser.addComplex(); // among other things adds i to the symbol table
parser.addVariable("x", Double.parseDouble(input));
parser.parseExpression(table.getScale().getByteExpression());
this.setBinValue((int)parser.getValue());
}
}

View File

@ -4,12 +4,13 @@ package Enginuity.Maps;
import Enginuity.ECUEditor;
import Enginuity.XML.TableNotFoundException;
import java.io.Serializable;
import java.util.Vector;
import javax.swing.JOptionPane;
//import Enginuity.
public class Rom {
public class Rom implements Serializable {
private RomID romID = new RomID();
private String fileName = "";
@ -51,7 +52,14 @@ public class Rom {
this.binData = binData;
for (int i = 0; i < getTables().size(); i++) {
try {
tables.get(i).populateTable(binData);
// if storageaddress has not been set (or is set to 0) omit table
if (tables.get(i).getStorageAddress() != 0) {
tables.get(i).populateTable(binData);
} else {
tables.remove(i);
// decrement i because length of vector has changed
i--;
}
} catch (ArrayIndexOutOfBoundsException ex) {
new JOptionPane().showMessageDialog(container, "Storage address for table \"" + tables.get(i).getName() + "\" is out of bounds.\nPlease check ECU definition file.", "ECU Definition Error", JOptionPane.ERROR_MESSAGE);
tables.remove(i);

View File

@ -2,7 +2,9 @@
package Enginuity.Maps;
public class RomID {
import java.io.Serializable;
public class RomID implements Serializable {
private String xmlid;//ID stored in XML
private int internalIdAddress;//address of ECU version in image
@ -17,6 +19,8 @@ public class RomID {
private int year;
private String flashMethod;//flash method string used for ecuflash
private String memModel;//model used for reflashing with ecuflash
private int fileSize;
private int ramOffset;
public String toString() {
return "\n ---- RomID " + xmlid + " ----" +
@ -141,4 +145,20 @@ public class RomID {
public void setMemModel(String memModel) {
this.memModel = memModel;
}
public int getRamOffset() {
return ramOffset;
}
public void setRamOffset(int ramOffset) {
this.ramOffset = ramOffset;
}
public int getFileSize() {
return fileSize;
}
public void setFileSize(int fileSize) {
this.fileSize = fileSize;
}
}

View File

@ -2,13 +2,16 @@
package Enginuity.Maps;
public class Scale {
import java.io.Serializable;
public class Scale implements Serializable {
public static final int LINEAR = 1;
public static final int INVERSE = 2;
private String unit;
private String expression;
private String expression = "x";
private String byteExpression = "x";
private String format;
private int increment;
@ -63,4 +66,12 @@ public class Scale {
return true;
}
public String getByteExpression() {
return byteExpression;
}
public void setByteExpression(String byteExpression) {
this.byteExpression = byteExpression;
}
}

View File

@ -5,11 +5,11 @@ import Enginuity.SwingComponents.TableFrame;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.GridLayout;
import java.io.Serializable;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
public abstract class Table extends JPanel {
public abstract class Table extends JPanel implements Serializable {
public static final int ENDIAN_LITTLE= 1;
public static final int ENDIAN_BIG = 2;
@ -39,12 +39,14 @@ public abstract class Table extends JPanel {
protected int cellHeight = 23;
protected int cellWidth = 45;
protected int minHeight = 100;
protected int minWidth = 200;
protected int minWidth = 370;
protected Rom container;
protected int highlightX;
protected int highlightY;
protected boolean highlight = false;
protected Table axisParent;
protected boolean beforeRam = false;
protected int ramOffset = 0;
public Table() {
this.setLayout(borderLayout);
@ -62,12 +64,14 @@ public abstract class Table extends JPanel {
public void populateTable(byte[] input) throws ArrayIndexOutOfBoundsException {
if (!isStatic) {
if (!beforeRam) ramOffset = container.getRomID().getRamOffset();
for (int i = 0; i < data.length; i++) {
if (data[i] == null) {
data[i] = new DataCell(scale);
data[i].setTable(this);
try {
data[i].setBinValue(RomAttributeParser.parseByteValue(input, endian, storageAddress + i * storageType, storageType));
data[i].setBinValue(RomAttributeParser.parseByteValue(input, endian, storageAddress + i * storageType - ramOffset, storageType));
} catch (ArrayIndexOutOfBoundsException ex) {
throw new ArrayIndexOutOfBoundsException();
}
@ -242,18 +246,18 @@ public abstract class Table extends JPanel {
return frame;
}
public void increment() {
public void increment(int increment) {
if (!isStatic) {
for (int i = 0; i < data.length; i++) {
if (data[i].isSelected()) data[i].increment();
if (data[i].isSelected()) data[i].increment(increment);
}
}
}
public void decrement() {
public void setRealValue(String realValue) {
if (!isStatic) {
for (int i = 0; i < data.length; i++) {
if (data[i].isSelected()) data[i].decrement();
if (data[i].isSelected()) data[i].setRealValue(realValue);
}
}
}
@ -316,6 +320,7 @@ public abstract class Table extends JPanel {
data[i].setOriginalValue(data[i].getBinValue());
}
}
colorize();
}
public void undoAll() {
@ -324,6 +329,7 @@ public abstract class Table extends JPanel {
data[i].setBinValue(data[i].getOriginalValue());
}
}
colorize();
}
public void undoSelected() {
@ -332,6 +338,7 @@ public abstract class Table extends JPanel {
if (data[i].isSelected()) data[i].setBinValue(data[i].getOriginalValue());
}
}
colorize();
}
public byte[] saveFile(byte[] binData) {
@ -340,10 +347,18 @@ public abstract class Table extends JPanel {
// need to deal with storage type (num bytes)
byte[] output = RomAttributeParser.parseIntegerValue(data[i].getBinValue(), endian, storageType);
for (int z = 0; z < storageType; z++) {
binData[i * storageType + z + storageAddress] = output[z];
binData[i * storageType + z + storageAddress - ramOffset] = output[z];
}
}
}
return binData;
}
public boolean isBeforeRam() {
return beforeRam;
}
public void setBeforeRam(boolean beforeRam) {
this.beforeRam = beforeRam;
}
}

View File

@ -1,8 +1,9 @@
package Enginuity.Maps;
import java.awt.Color;
import java.io.Serializable;
public class Table1D extends Table {
public class Table1D extends Table implements Serializable {
private boolean isAxis = false;

View File

@ -1,8 +1,9 @@
package Enginuity.Maps;
import Enginuity.SwingComponents.TableFrame;
import java.io.Serializable;
public class Table2D extends Table {
public class Table2D extends Table implements Serializable {
private Table1D axis = new Table1D();
@ -29,6 +30,7 @@ public class Table2D extends Table {
public void setFrame(TableFrame frame) {
this.frame = frame;
axis.setFrame(frame);
int height = verticalOverhead + cellHeight * 2;
int width = horizontalOverhead + data.length * cellWidth;
if (height < minHeight) height = minHeight;
@ -57,14 +59,9 @@ public class Table2D extends Table {
this.colorize();
}
public void increment() {
super.increment();
axis.increment();
}
public void decrement() {
super.decrement();
axis.decrement();
public void increment(int increment) {
super.increment(increment);
axis.increment(increment);
}
public void clearSelection() {
@ -94,4 +91,9 @@ public class Table2D extends Table {
binData = axis.saveFile(binData);
return binData;
}
public void setRealValue(String realValue) {
axis.setRealValue(realValue);
super.setRealValue(realValue);
}
}

View File

@ -7,11 +7,11 @@ import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Font;
import java.awt.GridLayout;
import java.io.Serializable;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
public class Table3D extends Table {
public class Table3D extends Table implements Serializable {
private Table1D xAxis = new Table1D();
private Table1D yAxis = new Table1D();
@ -87,10 +87,13 @@ public class Table3D extends Table {
public void populateTable(byte[] input) throws NullPointerException, ArrayIndexOutOfBoundsException {
// fill first empty cell
centerPanel.add(new JLabel());
if (!beforeRam) ramOffset = container.getRomID().getRamOffset();
// populate axiis
try {
xAxis.setContainer(container);
xAxis.populateTable(input);
yAxis.setContainer(container);
yAxis.populateTable(input);
} catch (ArrayIndexOutOfBoundsException ex) {
throw new ArrayIndexOutOfBoundsException();
@ -111,7 +114,7 @@ public class Table3D extends Table {
data[y][x].setBinValue(
RomAttributeParser.parseByteValue(input,
endian,
storageAddress + offset * storageType,
storageAddress + offset * storageType - ramOffset,
storageType));
} catch (ArrayIndexOutOfBoundsException ex) {
throw new ArrayIndexOutOfBoundsException();
@ -164,6 +167,8 @@ public class Table3D extends Table {
public void setFrame(TableFrame frame) {
this.frame = frame;
xAxis.setFrame(frame);
yAxis.setFrame(frame);
int height = verticalOverhead + cellHeight * data[0].length;
int width = horizontalOverhead + data.length * cellWidth;
if (height < minHeight) height = minHeight;
@ -182,28 +187,16 @@ public class Table3D extends Table {
yAxis;
}
public void increment() {
public void increment(int increment) {
if (!isStatic) {
for (int x = 0; x < this.getSizeX(); x++) {
for (int y = 0; y < this.getSizeY(); y++) {
if (data[x][y].isSelected()) data[x][y].increment();
if (data[x][y].isSelected()) data[x][y].increment(increment);
}
}
}
xAxis.increment();
yAxis.increment();
}
public void decrement() {
if (!isStatic) {
for (int x = 0; x < this.getSizeX(); x++) {
for (int y = 0; y < this.getSizeY(); y++) {
if (data[x][y].isSelected()) data[x][y].decrement();
}
}
}
xAxis.decrement();
yAxis.decrement();
xAxis.increment(increment);
yAxis.increment(increment);
}
public void clearSelection() {
@ -254,6 +247,7 @@ public class Table3D extends Table {
}
yAxis.setRevertPoint();
xAxis.setRevertPoint();
colorize();
}
public void undoAll() {
@ -264,6 +258,7 @@ public class Table3D extends Table {
}
yAxis.undoAll();
xAxis.undoAll();
colorize();
}
public void undoSelected() {
@ -274,6 +269,7 @@ public class Table3D extends Table {
}
yAxis.undoSelected();
xAxis.undoSelected();
colorize();
}
@ -286,11 +282,23 @@ public class Table3D extends Table {
for (int y = 0; y < xAxis.getDataSize(); y++) {
byte[] output = RomAttributeParser.parseIntegerValue(data[y][x].getBinValue(), endian, storageType);
for (int z = 0; z < storageType; z++) {
binData[offset * storageType + storageAddress] = output[z];
binData[offset * storageType + storageAddress - ramOffset] = output[z];
offset++;
}
}
}
return binData;
}
public void setRealValue(String realValue) {
if (!isStatic) {
for (int x = 0; x < this.getSizeX(); x++) {
for (int y = 0; y < this.getSizeY(); y++) {
if (data[x][y].isSelected()) data[x][y].setRealValue(realValue);
}
}
}
xAxis.setRealValue(realValue);
yAxis.setRealValue(realValue);
}
}

View File

@ -10,6 +10,7 @@ import javax.swing.event.InternalFrameListener;
public class TableFrame extends JInternalFrame implements InternalFrameListener {
private Table table;
private TableToolBar toolBar;
public TableFrame(Table table) {
super(table.getContainer().getFileName() + " - " + table.getName(), true, true);
@ -18,20 +19,27 @@ public class TableFrame extends JInternalFrame implements InternalFrameListener
this.setFrameIcon(null);
this.setBorder(BorderFactory.createBevelBorder(0));
this.setVisible(false);
this.add(new TableToolBar(table), BorderLayout.NORTH);
toolBar = new TableToolBar(table);
this.add(toolBar, BorderLayout.NORTH);
this.setJMenuBar(new TableMenuBar(table));
this.setDefaultCloseOperation(this.HIDE_ON_CLOSE);
table.setFrame(this);
this.addInternalFrameListener(this);
}
public TableToolBar getToolBar() {
return toolBar;
}
public void internalFrameActivated(InternalFrameEvent e) {
table.getContainer().getContainer().setLastSelectedRom(table.getContainer());
}
public void internalFrameOpened(InternalFrameEvent e) { }
public void internalFrameClosing(InternalFrameEvent e) { }
public void internalFrameClosed(InternalFrameEvent e) { }
public void internalFrameIconified(InternalFrameEvent e) { }
public void internalFrameDeiconified(InternalFrameEvent e) { }
public void internalFrameDeactivated(InternalFrameEvent e) { }
}

View File

@ -11,15 +11,15 @@ import javax.swing.JSeparator;
public class TableMenuBar extends JMenuBar implements ActionListener {
private Table table;
private JMenu fileMenu = new JMenu("Table");
private JMenuItem compare = new JMenuItem("Compare");
private JMenuItem copy = new JMenuItem("Copy");
private JMenuItem graph = new JMenuItem("View Graph");
private JMenuItem overlay = new JMenuItem("Overlay Log");
private JMenuItem undoSel = new JMenuItem("Undo Selected Changes");
private JMenuItem undoAll = new JMenuItem("Undo All Changes");
private JMenuItem revert = new JMenuItem("Set Revert Point");
private JMenuItem close = new JMenuItem("Close Table");
private JMenu fileMenu = new JMenu("Table");
private JMenuItem compare = new JMenuItem("Compare");
private JMenuItem copy = new JMenuItem("Copy");
private JMenuItem graph = new JMenuItem("View Graph");
private JMenuItem overlay = new JMenuItem("Overlay Log");
private JMenuItem undoSel = new JMenuItem("Undo Selected Changes");
private JMenuItem undoAll = new JMenuItem("Undo All Changes");
private JMenuItem revert = new JMenuItem("Set Revert Point");
private JMenuItem close = new JMenuItem("Close Table");
public TableMenuBar(Table table) {
super();

View File

@ -1,38 +1,91 @@
package Enginuity.SwingComponents;
import Enginuity.Maps.Table;
import java.awt.Dimension;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.text.DecimalFormat;
import javax.swing.JButton;
import javax.swing.JFormattedTextField;
import javax.swing.JLabel;
import javax.swing.JTextArea;
import javax.swing.JToolBar;
public class TableToolBar extends JToolBar implements MouseListener {
private JButton increment = new JButton(" + ");
private JButton decrement = new JButton(" - ");
private JLabel fineLabel = new JLabel(" Fine ");
private JButton incrementFine = new JButton(" + ");
private JButton decrementFine = new JButton(" - ");
private JLabel coarseLabel = new JLabel(" Coarse ");
private JButton incrementCoarse = new JButton(" + ");
private JButton decrementCoarse = new JButton(" - ");
private JButton setValue = new JButton("Set Value");
private JFormattedTextField incrementBy = new JFormattedTextField(new DecimalFormat("#"));
private JFormattedTextField setValueText = new JFormattedTextField(new DecimalFormat("#.#"));
private Table table;
public TableToolBar(Table table) {
this.table = table;
this.setFloatable(false);
this.add(increment);
this.add(decrement);
this.add(fineLabel);
this.add(incrementFine);
this.add(decrementFine);
this.add(new JLabel(" "));
this.add(coarseLabel);
this.add(incrementCoarse);
this.add(decrementCoarse);
this.add(new JLabel(" "));
this.add(incrementBy);
this.add(new JLabel(" "));
this.add(setValueText);
this.add(new JLabel(" "));
this.add(setValue);
increment.setToolTipText("Increment Value (Coarse)");
decrement.setToolTipText("Decrement Value (Coarse)");
incrementBy.setAlignmentX(JTextArea.CENTER_ALIGNMENT);
incrementBy.setAlignmentY(JTextArea.CENTER_ALIGNMENT);
incrementBy.setMaximumSize(new Dimension(35, 23));
setValueText.setAlignmentX(JTextArea.CENTER_ALIGNMENT);
setValueText.setAlignmentY(JTextArea.CENTER_ALIGNMENT);
setValueText.setMaximumSize(new Dimension(35, 23));
increment.addMouseListener(this);
decrement.addMouseListener(this);
incrementFine.setToolTipText("Increment Value (Fine)");
decrementFine.setToolTipText("Decrement Value (Fine)");
incrementCoarse.setToolTipText("Increment Value (Coarse)");
decrementCoarse.setToolTipText("Decrement Value (Coarse)");
setValue.setToolTipText("Set Absolute Value");
setValueText.setToolTipText("Set Absolute Value");
incrementBy.setToolTipText("Coarse Value Adjustment");
incrementFine.addMouseListener(this);
decrementFine.addMouseListener(this);
incrementCoarse.addMouseListener(this);
decrementCoarse.addMouseListener(this);
setValue.addMouseListener(this);
incrementBy.setValue(Math.abs(table.getScale().getIncrement()));
}
public void mouseClicked(MouseEvent e) {
if (e.getSource() == increment) {
table.increment();
} else if (e.getSource() == decrement) {
table.decrement();
if (e.getSource() == incrementCoarse) {
table.increment(Integer.parseInt(incrementBy.getValue()+""));
} else if (e.getSource() == decrementCoarse) {
table.increment(0 - Integer.parseInt(incrementBy.getValue()+""));
} else if (e.getSource() == incrementFine) {
if (table.getScale().getIncrement() > 0) table.increment(1);
else table.increment(-1);
} else if (e.getSource() == decrementFine) {
table.increment(1);
} else if (e.getSource() == setValue) {
table.setRealValue(setValueText.getValue()+"");
}
table.colorize();
}
public void setCoarseValue(int input) {
incrementBy.setText(input+"");
}
public void mousePressed(MouseEvent e) { }
public void mouseReleased(MouseEvent e) { }

View File

@ -29,8 +29,13 @@ public class DOMRomUnmarshaller {
RomID romID = unmarshallRomID(n2, new RomID());
String ecuID = new String(input, romID.getInternalIdAddress(), romID.getXmlid().length());
if (romID.getXmlid().equalsIgnoreCase(ecuID)) {
return unmarshallRom(n, new Rom());
Rom output = unmarshallRom(n, new Rom());
//set ram offset
output.getRomID().setRamOffset(output.getRomID().getFileSize() - input.length);
return output;
}
}
}
@ -66,7 +71,7 @@ public class DOMRomUnmarshaller {
} catch (TableNotFoundException e) { /* table does not already exist (do nothing) */ }
try {
table = unmarshallTable(n, table);
table = unmarshallTable(n, table, rom);
table.setContainer(rom);
rom.addTable(table);
} catch (TableIsOmittedException ex) { // table is not supported in inherited def (skip)
@ -146,6 +151,8 @@ public class DOMRomUnmarshaller {
romID.setFlashMethod(unmarshallText(n));
} else if (n.getNodeName().equalsIgnoreCase("memmodel")) {
romID.setMemModel(unmarshallText(n));
} else if (n.getNodeName().equalsIgnoreCase("filesize")) {
romID.setFileSize(RomAttributeParser.parseFileSize(unmarshallText(n)));
} else {
// unexpected element in RomID (skip)
}
@ -155,13 +162,32 @@ public class DOMRomUnmarshaller {
}
return romID;
}
private Table copyTable(Table input) {
Table output = input;
return output;
}
private Table unmarshallTable(Node tableNode, Table table) throws XMLParseException, TableIsOmittedException {
private Table unmarshallTable(Node tableNode, Table table, Rom rom) throws XMLParseException, TableIsOmittedException {
if (unmarshallAttribute(tableNode, "omit", "false").equalsIgnoreCase("true")) {
throw new TableIsOmittedException();
}
if (!unmarshallAttribute(tableNode, "base", "none").equalsIgnoreCase("none")) {
try {
table = (Table)ObjectCloner.deepCopy((Object)rom.getTable(unmarshallAttribute(tableNode, "base", "none")));
} catch (TableNotFoundException ex) {
// table not found
} catch (NullPointerException ex) {
ex.printStackTrace();
} catch (Exception ex) {
ex.printStackTrace();
}
}
try {
if (table.getType() < 1) { }
} catch (NullPointerException ex) { // if type is null or less than 0, create new instance (otherwise it is inherited)
@ -178,14 +204,14 @@ public class DOMRomUnmarshaller {
unmarshallAttribute(tableNode, "type", "unknown").equalsIgnoreCase("Static X Axis")) {
table = new Table1D();
} else {
if (table.getType() < 1) {;
table = new Table1D();
}
// huh?
System.out.println(table);
}
}
table.setName(unmarshallAttribute(tableNode, "name", table.getName()));
table.setType(RomAttributeParser.parseTableType(unmarshallAttribute(tableNode, "type", table.getType())));
if (unmarshallAttribute(tableNode, "beforeram", "false").equalsIgnoreCase("true")) table.setBeforeRam(true);
if (unmarshallAttribute(tableNode, "type", "unknown").equalsIgnoreCase("Static X Axis") ||
unmarshallAttribute(tableNode, "type", "unknown").equalsIgnoreCase("Static Y Axis")) {
@ -225,7 +251,7 @@ public class DOMRomUnmarshaller {
if (RomAttributeParser.parseTableType(unmarshallAttribute(n, "type", "unknown")) == Table.TABLE_Y_AXIS ||
RomAttributeParser.parseTableType(unmarshallAttribute(n, "type", "unknown")) == Table.TABLE_X_AXIS) {
Table1D tempTable = (Table1D)unmarshallTable(n, ((Table2D)table).getAxis());
Table1D tempTable = (Table1D)unmarshallTable(n, ((Table2D)table).getAxis(), rom);
if (tempTable.getDataSize() != table.getDataSize()) tempTable.setDataSize(table.getDataSize());
tempTable.setData(((Table2D)table).getAxis().getData());
tempTable.setAxisParent(table);
@ -235,7 +261,7 @@ public class DOMRomUnmarshaller {
} else if (table.getType() == Table.TABLE_3D) {
if (RomAttributeParser.parseTableType(unmarshallAttribute(n, "type", "unknown")) == Table.TABLE_X_AXIS) {
Table1D tempTable = (Table1D)unmarshallTable(n, ((Table3D)table).getXAxis());
Table1D tempTable = (Table1D)unmarshallTable(n, ((Table3D)table).getXAxis(), rom);
if (tempTable.getDataSize() != ((Table3D)table).getSizeX()) tempTable.setDataSize(((Table3D)table).getSizeX());
tempTable.setData(((Table3D)table).getXAxis().getData());
tempTable.setAxisParent(table);
@ -243,7 +269,7 @@ public class DOMRomUnmarshaller {
} else if (RomAttributeParser.parseTableType(unmarshallAttribute(n, "type", "unknown")) == Table.TABLE_Y_AXIS) {
Table1D tempTable = (Table1D)unmarshallTable(n, ((Table3D)table).getYAxis());
Table1D tempTable = (Table1D)unmarshallTable(n, ((Table3D)table).getYAxis(), rom);
if (tempTable.getDataSize() != ((Table3D)table).getSizeY()) tempTable.setDataSize(((Table3D)table).getSizeY());
tempTable.setData(((Table3D)table).getYAxis().getData());
tempTable.setAxisParent(table);
@ -255,7 +281,7 @@ public class DOMRomUnmarshaller {
} else if (n.getNodeName().equalsIgnoreCase("data")) {
// parse and add data to table
DataCell dataCell = new DataCell();
dataCell.setRealValue(unmarshallText(n));
dataCell.setDisplayValue(unmarshallText(n));
dataCell.setTable(table);
((Table1D)table).addStaticDataCell(dataCell);
} else {
@ -271,6 +297,7 @@ public class DOMRomUnmarshaller {
private Scale unmarshallScale (Node scaleNode, Scale scale) {
scale.setUnit(unmarshallAttribute(scaleNode, "units", scale.getUnit()));
scale.setExpression(unmarshallAttribute(scaleNode, "expression", scale.getExpression()));
scale.setByteExpression(unmarshallAttribute(scaleNode, "to_byte", scale.getByteExpression()));
scale.setFormat(unmarshallAttribute(scaleNode, "format", "#"));
scale.setIncrement(Integer.parseInt(unmarshallAttribute(scaleNode, "increment", scale.getIncrement())));

View File

@ -0,0 +1,38 @@
package Enginuity.XML;
import java.io.*;
public class ObjectCloner {
// so that nobody can accidentally create an ObjectCloner object
private ObjectCloner(){}
// returns a deep copy of an object
static public Object deepCopy(Object oldObj) throws Exception
{
ObjectOutputStream oos = null;
ObjectInputStream ois = null;
try
{
ByteArrayOutputStream bos =
new ByteArrayOutputStream(); // A
oos = new ObjectOutputStream(bos); // B
// serialize and pass the object
oos.writeObject(oldObj); // C
oos.flush(); // D
ByteArrayInputStream bin =
new ByteArrayInputStream(bos.toByteArray()); // E
ois = new ObjectInputStream(bin); // F
// return the new object
return ois.readObject(); // G
}
catch(Exception e)
{
System.out.println("Exception in ObjectCloner = " + e);
throw(e);
}
finally
{
oos.close();
ois.close();
}
}
}

View File

@ -97,4 +97,17 @@ public abstract class RomAttributeParser {
}
return output;
}
public static int parseFileSize(String input) throws NumberFormatException {
try {
return Integer.parseInt(input);
} catch (NumberFormatException ex) {
if (input.substring(input.length() - 2).equalsIgnoreCase("kb")) {
return Integer.parseInt(input.substring(0, input.length() - 2)) * 1024;
} else if (input.substring(input.length() - 2).equalsIgnoreCase("mb")) {
return Integer.parseInt(input.substring(0, input.length() - 2)) * 1024 * 1024;
}
throw new NumberFormatException();
}
}
}