• Which the release of FS2020 we see an explosition of activity on the forun and of course we are very happy to see this. But having all questions about FS2020 in one forum becomes a bit messy. So therefore we would like to ask you all to use the following guidelines when posting your questions:

    • Tag FS2020 specific questions with the MSFS2020 tag.
    • Questions about making 3D assets can be posted in the 3D asset design forum. Either post them in the subforum of the modelling tool you use or in the general forum if they are general.
    • Questions about aircraft design can be posted in the Aircraft design forum
    • Questions about airport design can be posted in the FS2020 airport design forum. Once airport development tools have been updated for FS2020 you can post tool speciifc questions in the subforums of those tools as well of course.
    • Questions about terrain design can be posted in the FS2020 terrain design forum.
    • Questions about SimConnect can be posted in the SimConnect forum.

    Any other question that is not specific to an aspect of development or tool can be posted in the General chat forum.

    By following these guidelines we make sure that the forums remain easy to read for everybody and also that the right people can find your post to answer it.

FS2004 New to gauge programming

Look in the \Debug folder. Among the dozens of interim files you should find one name projectname.dll

This is your compiled gauge file! It is named with a .dll extension (which is fine for FSX) and not .gau (which is required for FS9).

You can either change the .dll to a .gau extension, or more correctly open the Project's Properties page, look in the Linker/General section, and enter the name you want+extension.

Since I didn't bother doing this, the compiled .dll in my example is named "Waite.dll" (assumed the "Project Folder Name")

If you look closely at the "Sticky Posts" in my flightsim.com "Panel and Gauges" forum, you'll see illustrations on how to setup and use the VS IDE.

The buildlog.htm file lists everything that occurred "behind the curtain" which previously would have had to be done manually!

Code:
Creating temporary file "c:\Users\Bill\Documents\Visual Studio Projects\Gauges\Waite\Debug\RSP00000137206128.rsp" with contents
[
/Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_USRDLL" /D "WAITE_EXPORTS" /D "_WINDLL" /D "_UNICODE" /D "UNICODE" /Gm /EHsc /RTC1 /MDd /Fo"Debug\\" /Fd"Debug\vc80.pdb" /W3 /c /Wp64 /ZI /TP ".\ATP_torque.cpp"
]
Creating command line "cl.exe @"c:\Users\Bill\Documents\Visual Studio Projects\Gauges\Waite\Debug\RSP00000137206128.rsp" /nologo /errorReport:prompt"
Creating temporary file "c:\Users\Bill\Documents\Visual Studio Projects\Gauges\Waite\Debug\RSP00000237206128.rsp" with contents
[
/OUT:"C:\Users\Bill\Documents\Visual Studio Projects\Gauges\Waite\Debug\Waite.dll" /INCREMENTAL /DLL /MANIFEST /MANIFESTFILE:"Debug\Waite.dll.intermediate.manifest" /DEBUG /PDB:"c:\Users\Bill\Documents\Visual Studio Projects\Gauges\Waite\Debug\Waite.pdb" /SUBSYSTEM:WINDOWS /MACHINE:X86 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib

".\Debug\ATP_torque.obj"

".\Debug\ATP_Engine.res"

".\Debug\Waite.dll.embed.manifest.res"
]
Creating command line "link.exe @"c:\Users\Bill\Documents\Visual Studio Projects\Gauges\Waite\Debug\RSP00000237206128.rsp" /NOLOGO /ERRORREPORT:PROMPT"
Creating temporary file "c:\Users\Bill\Documents\Visual Studio Projects\Gauges\Waite\Debug\RSP00000337206128.rsp" with contents
[
/out:".\Debug\Waite.dll.embed.manifest" /notify_update /manifest

".\Debug\Waite.dll.intermediate.manifest"
]
Creating command line "mt.exe @"c:\Users\Bill\Documents\Visual Studio Projects\Gauges\Waite\Debug\RSP00000337206128.rsp" /nologo"
Creating temporary file "c:\Users\Bill\Documents\Visual Studio Projects\Gauges\Waite\Debug\BAT00000437206128.bat" with contents
[
@echo Manifest resource last updated at %TIME% on %DATE% > ".\Debug\mt.dep"
]
Creating command line """c:\Users\Bill\Documents\Visual Studio Projects\Gauges\Waite\Debug\BAT00000437206128.bat"""
 
Last edited:
I see, I was setting it up as a normal project instead of a Win32 Application.

More success, on the ATP compilation, I'm down to one error:

1>------ Rebuild All started: Project: torque, Configuration: Debug Win32 ------
1> ATP_Torque.cpp
1>c:\users\ron\panelprojects\gauges.h(4590): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
========== Rebuild All: 0 succeeded, 1 failed, 0 skipped ==========


Which takes me to this line in the gauges.h file:

typedef (*GAUGE_KEY_EVENT_HANDLER) (ID32 event, UINT32 evdata, PVOID userdata);

I really appreciate your patience and help, hopefully it will get easier as I do it more.
 
I see, I was setting it up as a normal project instead of a Win32 Application.

More success, on the ATP compilation, I'm down to one error:

1>------ Rebuild All started: Project: torque, Configuration: Debug Win32 ------
1> ATP_Torque.cpp
1>c:\users\ron\panelprojects\gauges.h(4590): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
========== Rebuild All: 0 succeeded, 1 failed, 0 skipped ==========


Which takes me to this line in the gauges.h file:

typedef (*GAUGE_KEY_EVENT_HANDLER) (ID32 event, UINT32 evdata, PVOID userdata);

Ah, that's not really your fault. You see, the "default gauges.h" file is riddled with ancient and depecrated entries...

You'd be far better off using the file Dai includes with his "E-Book."

That specific typedef needs to be modified to this:

Code:
//typedef (*GAUGE_KEY_EVENT_HANDLER) (ID32 event, UINT32 evdata, PVOID userdata);

typedef void VGAUGE_KEY_EVENT_HANDLER (ID32 event, UINT32 evdata, PVOID userdata);

typedef VGAUGE_KEY_EVENT_HANDLER	*GAUGE_KEY_EVENT_HANDLER;

Alternatively, if you PM your email, or write to be directly at n4gix@comcast.net I'll send you my customized FS9Xgauges.h file, which incorporates a TON of "fixes" from Arne Bartels, Dai Griffiths, and myself... ;)

Code:
// Bill Leaming's modified file in the root /inc folder!

// gauges.h
// Copyright (c) 2003 Microsoft Corporation.  All rights reserved.
//

// modified spring 2004 by Arne Bartels arne.bartels@nwn.de:
//  - definitions imported from fs2k2gauges.h
//  - some redefinitions for BCC and GCC compability reasons

// Additional changes from Dai Griffith's sdkgau29 added 11/22/09

// Export table modified 01/03/10 to permit each gauge's instance to be exposed
// See: HINSTANCE dll_instance;
 
Great news! Thanks to your gauges.h file Bill, the gauge did successfully compile AND work in the simulator! :D Although, I cannot figure out why the needle points 90 degrees counter-clockwise of where it should be at any given time. I've got my non-linearity table set up for the right coordinates on the face's .bmp file so that zero is the twelve-o'clock position, but the sim displays the nine-o'clock position as the zero point. I imagine a simple changing in the coordinates of the non-linearity table to reflect the 90 degree offset will be the quick fix?

Either way, I'm just glad I've now got a working gauge in the simulator! :D Thank you so much for your help! :)
 
Great news! Thanks to your gauges.h file Bill, the gauge did successfully compile AND work in the simulator! :D Although, I cannot figure out why the needle points 90 degrees counter-clockwise of where it should be at any given time. I've got my non-linearity table set up for the right coordinates on the face's .bmp file so that zero is the twelve-o'clock position, but the sim displays the nine-o'clock position as the zero point. I imagine a simple changing in the coordinates of the non-linearity table to reflect the 90 degree offset will be the quick fix?

Either way, I'm just glad I've now got a working gauge in the simulator! :D Thank you so much for your help! :)

Terrific! Needles are -by default- assumed to have been drawn "pointing east" (i.e., 3 o'clock). That's why yours is pointing at 9 o'clock, precisely 90º CCW from your desired 12 o'clock!
 
Got an airspeed indicator coded and working. Though, the movement of the needle is very choppy (and sometimes even a little erratic), even though in the sub-gauges.cpp file I've got the update number set to refresh the needle every update cycle. Is there any remedy for this?
 
Got an airspeed indicator coded and working. Though, the movement of the needle is very choppy (and sometimes even a little erratic), even though in the sub-gauges.cpp file I've got the update number set to refresh the needle every update cycle. Is there any remedy for this?

Why fix what ain't broke? Airspeed indicators in a real a/c bounce like crazy all the time...

Congrats on getting your first gauge working. It's a nice feeling of accomplishment, that's for sure!
 
True, but instead of the smooth motion you should see from updating every cycle, it looks like it's updating every half-second.
 
I've gone back over the code several times and can't figure out what's wrong. It's making jumps in what seems to be 8-10 knot increments, then it will freeze and jump by 15 or so knots and repeat the process.

I even tried importing some of the callback code from Dai's ASI but that hasn't fixed the issue. I know I could code this gauge in XML, but the point is I want to figure out how to fix it for future occasions.
 
Last edited:
You could provide a more more entries for the nonlinearity table. It may help smooth out the interpolation.
 
Hi Ron

In the sd2gau archive there's a folder called 'Source Codes'. Amongst other things there's a 180knot ASI under the 'Aeromarine ASI' folder. Looking at this may help track down your problem.

What is out-of-date in that source code is that it still shows the day/night bitmap exchange that I devised back in the FS98 days to get rid of the much-despised 'Microsoft Orange' night lighting. It still works but there is a much more up-to-date method for night lighting in the 'Creating C-Gauges' document; you may like to try changing the old code for the new method as an exercise.


Bill: if you've been 'fixing my fixes' I'd be very interested in a copy. :) It might just push me into releasing sd2gau30.zip..... :P if you don't mind it being made public.


-Dai
 
Last edited:
Well, I actually haven't been, but should I ever do so I'll be certain to send 'em along to you... ;)
 
Back
Top