View Single Post
Old 08-28-11, 03:39 PM   #28
reaper7
sim2reality
 
Join Date: Jun 2007
Location: AM 82
Posts: 2,280
Downloads: 258
Uploads: 30
Default

Ok I believe I have a perfect working solution.

Its was a lot more complicated than I expected.

The problem with Hijacking dials is other function use them under the hood and so we get unwanted side effects.
My first attempt used the tgt_bearing dial which although was not being used visually by the TDC is being used by the Stadimeter and other areas.
This caused them to stop functioning correctly.

Solution find another dial that's not being used:

Well this proved impossible all dial types that are writable are being used.
There are 2 dial types:
  1. Ones writable by the user eg: Bearing
  2. Ones non-writable to the user eg clock seconds
So i need another workaround to use my code - after digging tru the command.cfg and the dial types available, I had an idea

Maybe its possible to use the Bearing dials after all there are 2 used for it.
  • Dial_Bearing
  • Dial_Bearing_10ths

So I converted my Dial over to the Dial_Bearing_10ths but my code didn't work, the dial_bearing10ths is non-writable or so it seemed
After digging about in Sh3's code I traced whats happening.
The Sim writes the Value of the Bearing to the Dial_Bearing and the using more code writes the bearings 1units to the Dial_Bearing_10ths. As the sim is constantly updating this value it will overwrite anything written to that location by my code (so appearing Read Only).

So loading the assembly I found the part of code that writes the value to the Dial_Bearing_10ths and, well basically blanked it .
So now nothing gets written to that area, leaving my code free to do so.
Thereby converting the Dial_Bearing_10ths needle into my Impact Angle Needle

Now as the games Bearing 10ths dial is no longer correctly bisplaying the bearings 1units (As its now an Impact Angle) that dial needs another trick to get it to work.
This I think can be done by turning that dial type back to a Dial_Bearing and converting the dials.cfg for that dial.

Code:
[Dial11]
Name=Sol_Bearing
Type=24; DIAL_SOL_BEARING
Cmd=Set_TDC_bearing
Dial=0x3B0D00FF
CrtVal=0x3B0D0001
NewVal=0x0
DialVal=0,360
RealVal=0,360; degrees
Circular=Yes
CmdOnDrag=Yes
SndStep=5
SndList=1,Menu.TDC.Bearing,360


[Dial12]
Name=Sol_Bearing10ths
Type=24; DIAL_SOL_BEARING; Converted Dial
Dial=0x0
CrtVal=0x3B0D0077
NewVal=0x0
DialVal=0,360
RealVal=0,360; degrees
Circular=Yes
Just need to work out the values needed for the lines above


EDIT:

Well it all works so far - need to test fully and send to Makman for indepth Testing - but its looking good.

Bearing_10ths dial is working using this fix:

Code:
[Dial11]
Name=Sol_Bearing
Type=24; DIAL_SOL_BEARING
Cmd=Set_TDC_bearing
Dial=0x3B0D00FF
CrtVal=0x3B0D0001
NewVal=0x0
DialVal=0,360
RealVal=0,360; degrees
Circular=Yes
CmdOnDrag=Yes
SndStep=5
SndList=1,Menu.TDC.Bearing,360


[Dial12]
Name=Sol_Bearing10ths
Type=24; DIAL_SOL_BEARING
Dial=0x0
CrtVal=0x3B0D0077
NewVal=0x0
DialVal=0,12960; Simulates the 1units
RealVal=0,360; degrees
Circular=Yes


Screenshot showing it in action using the same values in Makman pic above to show the Impact angle is displaying correctly.

AOB Gyro Bearing Impact Angle
106 -20 -14 100




As this will require editing the SH3 code, I'll have to do like H.Sie and Stiebler and release it as a Patcher - Once I figure out how to do that.

But this will allow a fully working Impact Angle without Interfering with any of the other dials or solution calculations used by Sh3's code.

Last edited by reaper7; 08-28-11 at 05:10 PM.
reaper7 is offline   Reply With Quote