Discussion How to create DLL for selfdesigned launchpad

MaxBuzz

Well-known member
Joined
Sep 19, 2016
Messages
1,392
Reaction score
2,126
Points
128
Location
Kursk
dll is created by coding in a visual studio, but I think for the launch pad you can do with the usual config
 

xjflcf520

Member
Joined
Feb 26, 2021
Messages
70
Reaction score
6
Points
23
Location
Chana
dll is created by coding in a visual studio, but I think for the launch pad you can do with the usual config
I'm sorry that I don't know much about this. I want to make an interface for orbiter 2016. I can choose my own scene file for simulation, but I haven't found a tutorial on this
 

xjflcf520

Member
Joined
Feb 26, 2021
Messages
70
Reaction score
6
Points
23
Location
Chana
I have no idea from this sentence, what you are planning to do. Can you devote some more letters to your question?
I want to make a client like multiplayer, which can use orbiter's own engine to select its own scene for simulation.
 

N_Molson

Addon Developer
Addon Developer
Donator
Joined
Mar 5, 2010
Messages
9,271
Reaction score
3,244
Points
203
Location
Toulouse
dll is created by coding in a visual studio, but I think for the launch pad you can do with the usual config

Could be two very different things : create a custom launch facility with animated stuff such as fueling umbilicals, etc... in this case, yes you should implement it as a dll vessel,

or it could be a redesign of the Orbiter Launchpad app, which is a completely different thing....
 

xjflcf520

Member
Joined
Feb 26, 2021
Messages
70
Reaction score
6
Points
23
Location
Chana
Could be two very different things : create a custom launch facility with animated stuff such as fueling umbilicals, etc... in this case, yes you should implement it as a dll vessel,

or it could be a redesign of the Orbiter Launchpad app, which is a completely different thing....
Can I add the function of launchpad through DLL plug-in? If so, can I get a tutorial
 

N_Molson

Addon Developer
Addon Developer
Donator
Joined
Mar 5, 2010
Messages
9,271
Reaction score
3,244
Points
203
Location
Toulouse
Can I add the function of launchpad through DLL plug-in? If so, can I get a tutorial

What is a launchpad for you ? We simply don't understand what you mean. In american/english, a launchpad designs the area or the structure on which rockets stand prior to launch.

Maybe try to write it in your native language, with some luck Google Translate will help us ?
 

xjflcf520

Member
Joined
Feb 26, 2021
Messages
70
Reaction score
6
Points
23
Location
Chana
What is a launchpad for you ? We simply don't understand what you mean. In american/english, a launchpad designs the area or the structure on which rockets stand prior to launch.

Maybe try to write it in your native language, with some luck Google Translate will help us ?
I want to make a client like multiplayer to realize the function of selecting the scene file set by myself for simulation
 

xjflcf520

Member
Joined
Feb 26, 2021
Messages
70
Reaction score
6
Points
23
Location
Chana
屏幕截图(52)_LI.jpg
Just like this, after selecting the client in the module module, you can pop up the client designed by yourself and select the scene file and then use the orbiter to simulate
 

Face

Well-known member
Orbiter Contributor
Addon Developer
Beta Tester
Joined
Mar 18, 2008
Messages
4,390
Reaction score
577
Points
153
Location
Vienna
That is quite some hack, but you can find the code in the OMP distribution. Basically the module finds the Orbiter window handle, then finds the various controls for that window, then uses native window messages to manipulate the controls (e.g. replace the launch button, disable the scenario selection, selecting the placeholder scenario) and opens a dialog window. The module's own "connect" button is used to start the login sequence, and if it comes to actually launching the session, the hidden "launch" button is remotely clicked to initiate Orbiter's code.

However in my current project, I found that a better way to handle this is to create a separate application that configures Orbiter via config-file, creates a temporary scenario file, and then launches Orbiter with command-line parameters to immediately start into the temp scenario. The launcher app can then wait on the process to return and do some housekeeping on it (e.g. delete the temp scenario, restore config-file, clean-up auto-save scenario, etc.).
 

xjflcf520

Member
Joined
Feb 26, 2021
Messages
70
Reaction score
6
Points
23
Location
Chana
That is quite some hack, but you can find the code in the OMP distribution. Basically the module finds the Orbiter window handle, then finds the various controls for that window, then uses native window messages to manipulate the controls (e.g. replace the launch button, disable the scenario selection, selecting the placeholder scenario) and opens a dialog window. The module's own "connect" button is used to start the login sequence, and if it comes to actually launching the session, the hidden "launch" button is remotely clicked to initiate Orbiter's code.

However in my current project, I found that a better way to handle this is to create a separate application that configures Orbiter via config-file, creates a temporary scenario file, and then launches Orbiter with command-line parameters to immediately start into the temp scenario. The launcher app can then wait on the process to return and do some housekeeping on it (e.g. delete the temp scenario, restore config-file, clean-up auto-save scenario, etc.).
What I want to know is how to pop up a dialog box and display some specific scene files after checking the module, and then directly select the corresponding scene file in the module to call the orbiter for simulation,thanks
 

xjflcf520

Member
Joined
Feb 26, 2021
Messages
70
Reaction score
6
Points
23
Location
Chana
That is quite some hack, but you can find the code in the OMP distribution. Basically the module finds the Orbiter window handle, then finds the various controls for that window, then uses native window messages to manipulate the controls (e.g. replace the launch button, disable the scenario selection, selecting the placeholder scenario) and opens a dialog window. The module's own "connect" button is used to start the login sequence, and if it comes to actually launching the session, the hidden "launch" button is remotely clicked to initiate Orbiter's code.

However in my current project, I found that a better way to handle this is to create a separate application that configures Orbiter via config-file, creates a temporary scenario file, and then launches Orbiter with command-line parameters to immediately start into the temp scenario. The launcher app can then wait on the process to return and do some housekeeping on it (e.g. delete the temp scenario, restore config-file, clean-up auto-save scenario, etc.).
The corresponding code was not found in OMPClient.cpp
 

Face

Well-known member
Orbiter Contributor
Addon Developer
Beta Tester
Joined
Mar 18, 2008
Messages
4,390
Reaction score
577
Points
153
Location
Vienna
What I want to know is how to pop up a dialog box and display some specific scene files after checking the module, and then directly select the corresponding scene file in the module to call the orbiter for simulation,thanks
The corresponding code was not found in OMPClient.cpp

As I wrote, the method used by OMP is quite some hack. If you are not able to find the corresponding code in the file mentioned after my description (it contains comments like "Find Orbiter's main windows"), chances are you won't understand what you are doing there. It is definitely not standard Orbiter module behavior and not trivial to achieve.
Therefore I'd suggest to follow the second approach I wrote about: create a launcher application in the technology you are comfortable in, then launch Orbiter via command-line arguments to run a specific scenario. The command-line argument for this is "-s <c:\path\to\scenario\file.scn>". I think you will have quicker results that way.
 

xjflcf520

Member
Joined
Feb 26, 2021
Messages
70
Reaction score
6
Points
23
Location
Chana
As I wrote, the method used by OMP is quite some hack. If you are not able to find the corresponding code in the file mentioned after my description (it contains comments like "Find Orbiter's main windows"), chances are you won't understand what you are doing there. It is definitely not standard Orbiter module behavior and not trivial to achieve.
Therefore I'd suggest to follow the second approach I wrote about: create a launcher application in the technology you are comfortable in, then launch Orbiter via command-line arguments to run a specific scenario. The command-line argument for this is "-s <c:\path\to\scenario\file.scn>". I think you will have quicker results that way.
Thank you very much for your patience. I still have two questions: First, can I use C++ to build a startup program? Secondly, is the input of the command line performed in the startup program I created?
 

xjflcf520

Member
Joined
Feb 26, 2021
Messages
70
Reaction score
6
Points
23
Location
Chana
As I wrote, the method used by OMP is quite some hack. If you are not able to find the corresponding code in the file mentioned after my description (it contains comments like "Find Orbiter's main windows"), chances are you won't understand what you are doing there. It is definitely not standard Orbiter module behavior and not trivial to achieve.
Therefore I'd suggest to follow the second approach I wrote about: create a launcher application in the technology you are comfortable in, then launch Orbiter via command-line arguments to run a specific scenario. The command-line argument for this is "-s <c:\path\to\scenario\file.scn>". I think you will have quicker results that way.
屏幕截图(53)_LI.jpg
I tried to enter the command in cmd: start C:\Orbiter2016\orbiter.exe $CH-5$.scn, but it just opened orbiter.exe, and did not read the corresponding scn file for simulation
 

Urwumpe

Not funny anymore
Addon Developer
Donator
Joined
Feb 6, 2008
Messages
37,588
Reaction score
2,312
Points
203
Location
Wolfsburg
Preferred Pronouns
Sire
You have omitted the argument "-s" between orbiter.exe and the scenario.
 

Face

Well-known member
Orbiter Contributor
Addon Developer
Beta Tester
Joined
Mar 18, 2008
Messages
4,390
Reaction score
577
Points
153
Location
Vienna
I still have two questions: First, can I use C++ to build a startup program? Secondly, is the input of the command line performed in the startup program I created?

You can use whatever you want to build the startup program, because it is a separate application. In my current project I used .NET WPF technology to build the launcher.
Your startup program has to launch the Orbiter executable with the appropriate command line, yes. In my case, from .NET, it was like so:
Code:
                var startInfo = new ProcessStartInfo("cmd.exe")
                {
                    Arguments =
                        $"/C {(LaunchRegularOrbiter ? "orbiter.exe" : "Modules\\Server\\orbiter.exe")} -s \"{scenarioPath}\"",
                    UseShellExecute = false,
                    CreateNoWindow = true
                };
                var orbiter = Process.Start(startInfo);
                await Task.Run(() => orbiter.WaitForExit());

Note the "cmd.exe" trick, which is to achieve a waitable call (WaitForExit). Also note that I did not use the orbiter_ng.exe, but the orbiter.exe in the server path, because otherwise the "-s" option is not forwarded to OVP Orbiter.
 

kuddel

Donator
Donator
Joined
Apr 1, 2008
Messages
2,064
Reaction score
507
Points
113
Also note that I did not use the orbiter_ng.exe, but the orbiter.exe in the server path, because otherwise the "-s" option is not forwarded to OVP Orbiter.
To run the "NG-Version" you have to do thing a little different (as seen in the C# code of face):
Executable to run : Modules\Server\orbiter.exe (note the different path)
Arguments : -s "{scenarioPath}" (same as in "regular orbiter")
Working Directory : I would recommend to set the working directory to Orbiters root directory if possible. This prevents all sort of module-related things...
 

xjflcf520

Member
Joined
Feb 26, 2021
Messages
70
Reaction score
6
Points
23
Location
Chana
You can use whatever you want to build the startup program, because it is a separate application. In my current project I used .NET WPF technology to build the launcher.
Your startup program has to launch the Orbiter executable with the appropriate command line, yes. In my case, from .NET, it was like so:
Code:
                var startInfo = new ProcessStartInfo("cmd.exe")
                {
                    Arguments =
                        $"/C {(LaunchRegularOrbiter ? "orbiter.exe" : "Modules\\Server\\orbiter.exe")} -s \"{scenarioPath}\"",
                    UseShellExecute = false,
                    CreateNoWindow = true
                };
                var orbiter = Process.Start(startInfo);
                await Task.Run(() => orbiter.WaitForExit());

Note the "cmd.exe" trick, which is to achieve a waitable call (WaitForExit). Also note that I did not use the orbiter_ng.exe, but the orbiter.exe in the server path, because otherwise the "-s" option is not forwarded to OVP Orbiter.
屏幕截图(54).png
I typed in cmd: C:\Orbiter2016\Modules\Server\orbiter.exe -s "{C:\Orbiter2016\Scenarios\$CH-5%.scn}", but an error is displayed:Terminating after critical error. But there is nothing in the orbiter.log
 
Top