• 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.

GPWS gauge

Messages
13
Hello!

I'm trying to add the "Approaching Minimums" callout the rcbgp-33 gpws gauge but I'm completely new to xml programming.
I've searched for any kind of information regarding xml but I don't want to waste 2 years learning everything about xml just to make a minor modification of a file.

I would be grateful for any help.

I'm not going to upload it anywhere, it's purely for my own use.

Johan
 

Attachments

  • GPWS3_3_Default.xml
    32.5 KB · Views: 450
Never mind, I looked into it and did it myself, I've started to understand some xml now.

Now it seems like I have to do some C programming, something I don't know a thing about. I have no clue about the C "grammar" but all I want to do is to make a code that scans an FSUIPC offset.

If for example the offset 1234 equals 0 then (L:Something, bool) equals 0 and if 1234 equals 1 then (L:Something, bool) equals 1.

I've seen the tutorial about the topic but as I said, I don't know anything at all about C programming which makes it impossible to understand where what should be. I have no clue about where I should start.

And of course, I know more than well that it's very difficult to make C gauges talk to FS.

Could someone give me a hand? I've found the sd2gau28 tutorial but I get confused reading it.

Johan
 
Well, I managed to make a working "FSUIPC to XML Offset translator" C code.

The code can be found below, I just felt that if there are others who need to "translate" FSUIPC offsets to XML then one solution is available here.

Just remember that I'm only a C noob so this code might need some adjustments to be perfect but it works for me though.

Code:
----- project.h -----

#define         VERSION_MAJOR           1
#define         VERSION_MINOR           0
#define         VERSION_BUILD           0

// magic to get the preprocessor to do what we want
#define		lita(arg) #arg
#define		xlita(arg) lita(arg)
#define		cat3(w,x,z) w##.##x##.##z##\000
#define		xcat3(w,x,z) cat3(w,x,z)
#define		VERSION_STRING xlita(xcat3(VERSION_MAJOR,VERSION_MINOR,VERSION_BUILD))

#ifndef		VS_VERSION_INFO
#define		VS_VERSION_INFO		0x0001
#endif

#define		BMP_NAME_SMALL_BACKGROUND		0x1000



----- project.c -----

#include "gauges.h"
#include "FSUIPC_User.h"
#include "project.h"

#define		GAUGE_NAME			"NAME" // replace "name" with whatever your own GAUGE_NAME will be
#define		GAUGEHDR_VAR_NAME	gaugehdr_name  // 			-||-
#define		GAUGE_W				0

#include "project.code.c"

GAUGE_TABLE_BEGIN()
	GAUGE_TABLE_ENTRY(&gaugehdr_name)
GAUGE_TABLE_END()



----- project.code.c -----

char name_gauge_name[] = GAUGE_NAME;
extern PELEMENT_HEADER name_list;
GAUGE_CALLBACK gaugecall;
GAUGE_HEADER_FS700( GAUGE_W, name_gauge_name, &name_list, NULL, gaugecall, 0, 0, 0 );

DWORD dwResult;
int YOUR_VARIABLE = 0;	// replace YOUR_VARIABLE with your own variable name
ID YOUR_VARIABLE_id;	// 			-||-

void FSAPI gaugecall( PGAUGEHDR pgauge, int service_id, UINT32 extra_data )
{	
	switch(service_id)
	{
		case PANEL_SERVICE_PRE_INITIALIZE:
			FSUIPC_Open(SIM_FS2K4 , &dwResult); // Let's get connected to FSUIPC
	
			register_named_variable ( "XML_Variable_name" );
		break;

		case PANEL_SERVICE_PRE_UPDATE:
			FSUIPC_Read(0x0000, 0, &YOUR_VARIABLE, &dwResult); // 0x0000, is the FSUIPC offset and 0, is the size of the offset (see FSUIPC SDK for info regarding this)
			
			// If you need to read more variables then you can list them here aswell

			FSUIPC_Process(&dwResult);

			YOUR_VARIABLE_id = check_named_variable ( "XML_Variable_name" ) ;
			set_named_variable_value ( YOUR_VARIABLE_id, (FLOAT64)YOUR_VARIABLE) ;			
		break;
	}
}

MAKE_STATIC
(
	name_background,
	BMP_NAME_SMALL_BACKGROUND,
	NULL,
	NULL,
	IMAGE_USE_TRANSPARENCY,
	0,
	0,0
)

PELEMENT_HEADER		name_list	= &name_background.header;

#undef GAUGE_NAME
#undef GAUGEHDR_VAR_NAME
#undef GAUGE_W



----- project.rc -----

#include "dhread.h"

VS_VERSION_INFO VERSIONINFO
 FILEVERSION VERSION_MAJOR,VERSION_MINOR,0,VERSION_BUILD
 PRODUCTVERSION VERSION_MAJOR,VERSION_MINOR,0,VERSION_BUILD
 FILEFLAGSMASK 0x3fL
 FILEFLAGS 0x0L
 FILEOS 0x10004L
 FILETYPE 0x1L
 FILESUBTYPE 0x0L
BEGIN
    BLOCK "StringFileInfo"
    BEGIN
        BLOCK "040904b0"
        BEGIN
            VALUE "CompanyName", "\0"
            VALUE "FileDescription", "Flight Simulator 2004 Gauge\0"
            VALUE "FileVersion", VERSION_STRING
            VALUE "LegalCopyright", "\0"
            VALUE "ProductName", "\0"
            VALUE "ProductVersion", VERSION_STRING
        END
    END
    BLOCK "VarFileInfo"
    BEGIN
        VALUE "Translation", 0x409, 1200
    END
END

BMP_NAME_SMALL_BACKGROUND		BITMAP	DISCARDABLE		"res\\background.bg.BMP"
 
Back
Top