SDK Question Module Catagories

Hlynkacg

Aspiring rocket scientist
Addon Developer
Tutorial Publisher
Donator
Joined
Dec 27, 2010
Messages
1,870
Reaction score
3
Points
0
Location
San Diego
This may be a dumb question but how do I tell orbiter that my MFD is an MFD so that it will show up under the "MFD Modes" tab instead of the "Miscellaneous" Tab when I go to enable it?
 

ADSWNJ

Scientist
Addon Developer
Joined
Aug 5, 2011
Messages
1,667
Reaction score
3
Points
38
You need to compile in an .rc file.

Huh that sounds strange. Don;'t think I've ever done that (at least not consciously)! I'm away from my Dev environment until the weekend, but I think it's easier than this.

OP - go download MMTest 1+2 from OrbitHangar (it was an old proof of concept I did with Enjo for the Module Messaging Ext stuff). It's basically the smallest shell of a clean MFD. Maybe even a foundation for you to clone if you wish?

PM me if you need more.
 

orb

New member
News Reporter
Joined
Oct 30, 2009
Messages
14,020
Reaction score
4
Points
0
Huh that sounds strange. Don;'t think I've ever done that (at least not consciously)
Orbiter reads DLL's string resource of id 1001 (decimal) as the module type and string resource of id 1000 (decimal) as the module's description.

If you didn't put that in a resource file but you still see it set for your module in Orbiter, something else must have attached it (e.g. external dependency's object file). The default type assumed when you don't add its string to the string table is Miscellaneous.
 

Hlynkacg

Aspiring rocket scientist
Addon Developer
Tutorial Publisher
Donator
Joined
Dec 27, 2010
Messages
1,870
Reaction score
3
Points
0
Location
San Diego
Orbiter reads DLL's string resource of id 1001 (decimal) as the module type and string resource of id 1000 (decimal) as the module's description.

Again, this may be a dumb question but where/how do I set that?
 

Enjo

Mostly harmless
Addon Developer
Tutorial Publisher
Donator
Joined
Nov 25, 2007
Messages
1,665
Reaction score
13
Points
38
Location
Germany
Website
www.enderspace.de
Preferred Pronouns
Can't you smell my T levels?
... by compiling an RC file?
 

Hlynkacg

Aspiring rocket scientist
Addon Developer
Tutorial Publisher
Donator
Joined
Dec 27, 2010
Messages
1,870
Reaction score
3
Points
0
Location
San Diego
not at all helpful.

As far as I can tell "IDS_INFO" "IDS_TYPE" and the "STRINGTABLE" entity are all undefined, so how do go about defining them so that IDS_TYPE = "string resource of id 1001 (decimal)" and that reads "MFD Modes"?
 

orb

New member
News Reporter
Joined
Oct 30, 2009
Messages
14,020
Reaction score
4
Points
0
As far as I can tell "IDS_INFO" "IDS_TYPE" and the "STRINGTABLE" entity are all undefined, so how do go about defining them so that IDS_TYPE = "string resource of id 1001 (decimal)" and that reads "MFD Modes"?

IDS_INFO and IDS_TYPE should be usually defined in a resource.h file which is created by a resource editor. They don't have to be however defined. You can use numerical values instead if you don't intend to use their identifiers anywhere in your code.

STRINGTABLE is a keyword internally defined in the resource compiler.
 

Hlynkacg

Aspiring rocket scientist
Addon Developer
Tutorial Publisher
Donator
Joined
Dec 27, 2010
Messages
1,870
Reaction score
3
Points
0
Location
San Diego
I've been googling string tables and rc files in c++ but I haven't found anything on how to make string resource of id 1001 (decimal) = "MFD Modes" in visual studio.

Lots of stuff about resource files in VB and Java but nothing about using rc files in c++. is there a search term I'm missing?
 

ADSWNJ

Scientist
Addon Developer
Joined
Aug 5, 2011
Messages
1,667
Reaction score
3
Points
38
I am sure the .rc file stuff is taking you in the wrong direction. I do not use these at all, and I can set up MFD's at will. I think you derive your main class from MFD2, and implement the InitModule mandatory callback, put the .DLL in the modules directory, and it will show up in the module selection list.

If you want, download MMTest 1 + 2, and have a look at the structure. It's only a message passing demo, but it shows MFD persistence (a tricky concept, because Orbiter will kill your main class any time you change the view (e.g. with F8) or resize the External MFD, plus the button handling common code, plus how to talk to MM Ext.
 

Enjo

Mostly harmless
Addon Developer
Tutorial Publisher
Donator
Joined
Nov 25, 2007
Messages
1,665
Reaction score
13
Points
38
Location
Germany
Website
www.enderspace.de
Preferred Pronouns
Can't you smell my T levels?
I am sure the .rc file stuff is taking you in the wrong direction. I do not use these at all, and I can set up MFD's at will.
(...)
If you want, download MMTest 1 + 2, and have a look at the structure.
But Andrew... they're classified as Misc. and have no description at all...

I've been googling string tables and rc files in c++ but I haven't found anything on how to make string resource of id 1001 (decimal) = "MFD Modes" in visual studio.
I didn't have to do any googling to include the resource header that's right in front of your eyes.
Lots of stuff about resource files in VB and Java but nothing about using rc files in c++. is there a search term I'm missing?
Yes. I'd google this.
 
Last edited:

Enjo

Mostly harmless
Addon Developer
Tutorial Publisher
Donator
Joined
Nov 25, 2007
Messages
1,665
Reaction score
13
Points
38
Location
Germany
Website
www.enderspace.de
Preferred Pronouns
Can't you smell my T levels?
Have you got anything to add to the topic of the discussion?
 

Face

Well-known member
Orbiter Contributor
Addon Developer
Beta Tester
Joined
Mar 18, 2008
Messages
4,403
Reaction score
581
Points
153
Location
Vienna
Have you got anything to add to the topic of the discussion?

Sure I have, but given the abrasive tone here, I prefer to contact the OP in private.
 

Enjo

Mostly harmless
Addon Developer
Tutorial Publisher
Donator
Joined
Nov 25, 2007
Messages
1,665
Reaction score
13
Points
38
Location
Germany
Website
www.enderspace.de
Preferred Pronouns
Can't you smell my T levels?
Sure I have, but given the abrasive tone here, I prefer to contact the OP in private.
Great. I will be as easy as digesting what was already said. Everybody happy?
 

orb

New member
News Reporter
Joined
Oct 30, 2009
Messages
14,020
Reaction score
4
Points
0
I am sure the .rc file stuff is taking you in the wrong direction. I do not use these at all, and I can set up MFD's at will.
The problem here isn't the setup or working of the MFD in Orbiter. It's just its description/category in Orbiter's launchpad, which is set in resources and not in the code. No other problem, but just appropriate presentation in the list of plug-ins on the launchpad.


I've been googling string tables and rc files in c++ but I haven't found anything on how to make string resource of id 1001 (decimal) = "MFD Modes" in visual studio.

Lots of stuff about resource files in VB and Java but nothing about using rc files in c++. is there a search term I'm missing?

https://msdn.microsoft.com/en-us/library/windows/desktop/aa381050.aspx

E.g. if you are using a plain text editor:
Code:
STRINGTABLE 
BEGIN
    1000 "description of the module"
    1001 "category name"
END
or:
Code:
STRINGTABLE
{
    1000, "description of the module"
    1001, "category name"
}

If you are using some graphical resource editor, you simply create a string resource of id 1000 and put your module's description in its content and another string of id 1001 and put the name of the module's category there, and the resource editor will create appropriate .rc file containing them upon saving, which then can be compiled by resource compiler during the build process (if the .rc file has been included in the project) and linked with the DLL.
 

ADSWNJ

Scientist
Addon Developer
Joined
Aug 5, 2011
Messages
1,667
Reaction score
3
Points
38
The problem here isn't the setup or working of the MFD in Orbiter. It's just its description/category in Orbiter's launchpad, which is set in resources and not in the code. No other problem, but just appropriate presentation in the list of plug-ins on the launchpad.

Wow ... today I learned... :)

Thanks orb!
 

ADSWNJ

Scientist
Addon Developer
Joined
Aug 5, 2011
Messages
1,667
Reaction score
3
Points
38
So 18 months later, I've started using these resource files. Just documenting it for anyone finding this thread in future.

What is this? It's just helpers compiled into your MFD /DLL file, so Orbiter.exe knows where to list your MFD in the Plugin modules list, and then how to describe your MFD in the big grey box. You don't need any of this, but if you don't do this, then it's put by default under Miscellaneous, and with no description. (As Enjo was patiently trying to tell me 18 months ago, above!!) You can do it in regular Community Edition Visual Studio, so no need for anything fancy.

Walkthrough:

  • In Visual Studio (e.g. I am in VS2017 Community Edition), in your Solution Explorer, you should see these typical filters: References, External Dependencies, Header Files, Resource Files, Source Files. (Doesn't really matter, but it's useful if you have a Resource Files filter in here.)
  • Right-mouse on Resource Files, Add, New Item, Resource, Resource File (.rc) ... accept default name of Resource.rc, and Add.
  • Double click on Resource.rc. Resource view should open, with a blank Resource.rc.
  • Right mouse on Resource.rc, Add resource, String Table, New. String Table folder, appears under Resource.rc.Double click on it, and String Table appears with a little boxed ABC icon.
  • The default string should say something like: IDS_STRING102, 102, and blank, for ID, Value, and Caption.
  • Double click on IDS_STRING102 and rename to IDS_INFO. Make the value 1000. Make the caption your description for the Orbiter modules tab. Note ... if you want to make it multi-line, then include literal text: \r\n to force each new line you want to add.
  • In the next line, add another string: IDS_TYPE, value 1001, caption *exactly* MFD modes (note captialization).
  • Save everything, compile your MFD, and now when you start up Orbiter, your MFD will now appear in MFD modes instead of Miscellaneous, and the description will also show up when you select the MFD.


Sorry if this is obvious to others. Just putting this here, and I'll start moving all my MFDs over to the right place now!!!
 
Last edited:
Top