New Release D3D9Client Development

BigMac

Active member
Joined
Jan 11, 2009
Messages
41
Reaction score
50
Points
33
Apologies if this isn't the right place to ask, however I'm running in to a problem building a project incorporating both the latest D3D9 client build against the beta (r1436), and the most recent release of OrbiterSound (5.0).
It appears that both libraries are built using different Runtime Libary settings - MT for Orbiteround, and MD for the D3D9 client, which means that I can include one or the other but trying to add both throws a LNK 2038 error.

Has anyone run in to a similar issue, or might have any suggestions as to how to get around this?

Thanks in advance.
 

jarmonik

Well-known member
Orbiter Contributor
Addon Developer
Beta Tester
Joined
Mar 28, 2008
Messages
2,369
Reaction score
436
Points
83
Website
users.kymp.net
If you are trying to compile your own add-on then you shouldn't try to link into the D3D9 at all. The linkage is established through Orbiter core.
But a different link library setting shouldn't be a problem as far as I can tell. Of course, I may have forgotten something. What version of Visual Studio are you using ?
 

BigMac

Active member
Joined
Jan 11, 2009
Messages
41
Reaction score
50
Points
33
If you are trying to compile your own add-on then you shouldn't try to link into the D3D9 at all. The linkage is established through Orbiter core.
But a different link library setting shouldn't be a problem as far as I can tell. Of course, I may have forgotten something. What version of Visual Studio are you using ?
Thanks for the response.
Sorry if I wasn't clear in my original post - I'm using VS 2017 and linking specifically with the gcAPI library, as I am making use of some of the functionality around custom cameras.

It's entirely possible that I'm being a bit stupid and missing something obvious.
 

jarmonik

Well-known member
Orbiter Contributor
Addon Developer
Beta Tester
Joined
Mar 28, 2008
Messages
2,369
Reaction score
436
Points
83
Website
users.kymp.net
Thanks for the response.
Sorry if I wasn't clear in my original post - I'm using VS 2017 and linking specifically with the gcAPI library, as I am making use of some of the functionality around custom cameras.

It's entirely possible that I'm being a bit stupid and missing something obvious.
Don't link into gcAPI.lib it is obsolete due to difficulties it creates. Use gcCore interface instead which doesn't require any link libraries.

C++:
#include "gcCore.h"

void VESSEL::YourInitProg()
{
    CAMERAHANDLE hCam = NULL;
    gcCore *pCore = gcGetCoreInterface();
    if (pCore) {
        hCam = pCore->SetupCustomCamera(...);
    }
}
 

BigMac

Active member
Joined
Jan 11, 2009
Messages
41
Reaction score
50
Points
33
Don't link into gcAPI.lib it is obsolete due to difficulties it creates. Use gcCore interface instead which doesn't require any link libraries.

C++:
#include "gcCore.h"

void VESSEL::YourInitProg()
{
    CAMERAHANDLE hCam = NULL;
    gcCore *pCore = gcGetCoreInterface();
    if (pCore) {
        hCam = pCore->SetupCustomCamera(...);
    }
}
Just what I was looking for - thanks for the help!
(y)
 

Blake

Addon Developer
Addon Developer
Joined
Mar 9, 2009
Messages
187
Reaction score
59
Points
43
I'm getting an error running SR71-R with the latest D3D9Client branch from github. Orbiter.log is below.

This appears to be happening while I'm trying to bitblt the MFD buttons from a texture.

Thanks.

**** Orbiter.log
000000.000: Build Feb 2 2022 [v.602931718]
000000.000: Timer precision: 1e-07 sec
000000.000: Found 0 joystick(s)
000000.000: Module AtlantisConfig.dll .... [Build 220121, API 220121]
000000.000: Module AtmConfig.dll ......... [Build 220121, API 220121]
000000.000: Module DGConfigurator.dll .... [Build 220121, API 220121]
000000.000: ---------------------------------------------------------------
000000.000: BaseDir : D:\git\orbiter-sr71r\Orbiter\
000000.000: ConfigDir : D:\git\orbiter-sr71r\Orbiter\Config\
000000.000: MeshDir : D:\git\orbiter-sr71r\Orbiter\Meshes\
000000.000: TextureDir : D:\git\orbiter-sr71r\Orbiter\Textures\
000000.000: HightexDir : D:\git\orbiter-sr71r\Orbiter\Textures2\
000000.000: ScenarioDir: D:\git\orbiter-sr71r\Orbiter\Scenarios\
000000.000: ---------------------------------------------------------------
000000.000: D3D9 DLLs : C:\WINDOWS\SYSTEM32\d3d9.dll [v 10.0.19041.1387]
000000.000: ---------------------------------------------------------------
000000.000: Module D3D9Client.dll ........ [Build 220202, API 220121]
000000.000:
000000.000: **** Creating simulation session
000000.000: D3D9: [DirectX 9 Initialized]
000000.000: D3D9: 3D-Adapter.............. : NVIDIA GeForce GTX 1660 Ti
000000.000: D3D9: MaxTextureWidth......... : 16384
000000.000: D3D9: MaxTextureHeight........ : 16384
000000.000: D3D9: MaxTextureRepeat........ : 8192
000000.000: D3D9: VolTexAddressCaps....... : 0x3F
000000.000: D3D9: NumSimultaneousRTs...... : 4
000000.000: D3D9: VertexDeclCaps.......... : 0x30F
000000.000: D3D9: MiscCaps................ : 0x2FCEF2
000000.000: D3D9: Vertex Texture.......... : Yes
000000.000: D3D9: Separate AlphaBlend..... : Yes
000000.000: D3D9: Shadow Mapping.......... : Yes
000000.000: D3D9: D3DFMT_A16B16G16R16F.... : Yes
000000.000: D3D9: D3DFMT_A32B32G32R32F.... : Yes
000000.000: D3D9: D3DFMT_D32F_LOCKABLE.... : Yes
000000.000: D3D9: D3DFMT_A2R10G10B10...... : Yes
000000.000: D3D9: D3DFMT_L8............... : Yes
000000.000: D3D9: D3DDTCAPS_DEC3N......... : No
000000.000: D3D9: D3DDTCAPS_FLOAT16_2..... : Yes
000000.000: D3D9: D3DDTCAPS_FLOAT16_4..... : Yes
000000.000: D3D9: Runs under WINE......... : No
000000.000: D3D9: D3D9Build Date.......... : 220202
000000.000: D3D9: Available Texture Memory : 4077 MB
000000.000: D3D9: [3DDevice Initialized]
000000.000: D3D9: [Loading Constellations]
000000.000: D3D9: [D3D9Client Initialized]
000000.000: Module Sun.dll ............... [Build 220121, API 220121]
000000.000: VSOP87(E) Sun: Precision 1.0e-06, Terms 554/6634
000000.000: Module Mercury.dll ........... [Build 220121, API 220121]
000000.000: VSOP87(B) Mercury: Precision 1.0e-05, Terms 167/7123
000000.000: Module Venus.dll ............. [Build 220121, API 220121]
000000.000: Module VenusAtm2006.dll ...... [Build 220121, API 220121]
000000.000: VSOP87(B) Venus: Precision 1.0e-05, Terms 79/1710
000000.000: Module Earth.dll ............. [Build 220121, API 220121]
000000.000: Module EarthAtmJ71G.dll ...... [Build 220121, API 220121]
000000.000: VSOP87(B) Earth: Precision 1.0e-08, Terms 2564/2564
000000.000: Module Moon.dll .............. [Build 220121, API 220121]
000000.000: ELP82: Precision 1.0e-05, Terms 116/829
000000.000: Module Mars.dll .............. [Build 220121, API 220121]
000000.000: Module MarsAtm2006.dll ....... [Build 220121, API 220121]
000000.000: VSOP87(B) Mars: Precision 1.0e-05, Terms 405/6400
000000.000: Module Phobos.dll ............ [Build ******, API 060425]
000000.000: Module Deimos.dll ............ [Build ******, API 060425]
000000.000: Module Galsat.dll ............ [Build 220121, API 220121]
000000.000: Module Jupiter.dll ........... [Build 220121, API 220121]
000000.000: VSOP87(B) Jupiter: Precision 1.0e-06, Terms 1624/3625
000000.000: Module Io.dll ................ [Build 220121, API 220121]
000000.000: Module Europa.dll ............ [Build 220121, API 220121]
000000.000: Module Ganymede.dll .......... [Build 220121, API 220121]
000000.000: Module Callisto.dll .......... [Build 220121, API 220121]
000000.000: Module Satsat.dll ............ [Build 220121, API 220121]
000000.000: Module Saturn.dll ............ [Build 220121, API 220121]
000000.000: VSOP87(B) Saturn: Precision 1.0e-06, Terms 2904/6365
000000.000: Module Mimas.dll ............. [Build 220121, API 220121]
000000.000: SATSAT Mimas: Terms 113
000000.000: Module Enceladus.dll ......... [Build 220121, API 220121]
000000.000: SATSAT Enceladus: Terms 33
000000.000: Module Tethys.dll ............ [Build 220121, API 220121]
000000.000: SATSAT Tethys: Terms 101
000000.000: Module Dione.dll ............. [Build 220121, API 220121]
000000.000: SATSAT Dione: Terms 59
000000.000: Module Rhea.dll .............. [Build 220121, API 220121]
000000.000: SATSAT Rhea: Terms 68
000000.000: Module Titan.dll ............. [Build 220121, API 220121]
000000.000: SATSAT Titan: Terms 100
000000.000: Module Iapetus.dll ........... [Build 220121, API 220121]
000000.000: SATSAT Iapetus: Terms 605
000000.000: Module Uranus.dll ............ [Build 220121, API 220121]
000000.000: VSOP87(B) Uranus: Precision 1.0e-06, Terms 1827/5269
000000.000: Module Miranda.dll ........... [Build ******, API 060425]
000000.000: Module Ariel.dll ............. [Build ******, API 060425]
000000.000: Module Umbriel.dll ........... [Build ******, API 060425]
000000.000: Module Titania.dll ........... [Build ******, API 060425]
000000.000: Module Oberon.dll ............ [Build ******, API 060425]
000000.000: Module Neptune.dll ........... [Build 220121, API 220121]
000000.000: VSOP87(B) Neptune: Precision 1.0e-06, Terms 391/2024
000000.000: Finished initialising world
000000.000: Module SR71R.dll ............. [Build 220120, API 220121]
000000.000: Finished initialising status
000000.000: Finished initialising camera
000000.000: Finished setting up render state
000000.000: D3D9: [Scene Initialized]
000000.000: Finished initialising panels
000000.010: D3D9ERROR: oapiBlt() Failed (End)
000000.010: D3D9ERROR: Source Rect (0,0,60,40) (w=60,h=40)
000000.010: D3D9ERROR: Target Rect (16,1547,76,1587) (w=60,h=40)
000000.010: D3D9ERROR: Source Data Below: ----------------------------------
000000.010: D3D9ERROR: Surface name is [clbkCreateSurfaceEx] OAPI_Handle=0x158572D8
000000.010: D3D9ERROR: OAPI_Attribs: OAPISURFACE_RENDERTARGET,
000000.010: DX9_DUMP: Type = Surface
000000.010: DX9_DUMP: Usage = RENDERTARGET
000000.010: DX9_DUMP: Pool = D3DPOOL_DEFAULT
000000.010: DX9_DUMP: Format = OAPISURFACE_PF_XRGB (22)
000000.010: DX9_DUMP: Multisample = 0
000000.010: DX9_DUMP: Size = (60, 40)
000000.010: D3D9ERROR: Target Data Below: ----------------------------------
000000.010: D3D9ERROR: Surface name is [SR71R_100_VC2.dds] OAPI_Handle=0x158578F0
000000.010: D3D9ERROR: Has a Surface Interface
000000.010: D3D9ERROR: OAPI_Attribs: OAPISURFACE_TEXTURE, OAPISURFACE_RENDERTARGET,
000000.010: DX9_DUMP: Mips = 1
000000.010: DX9_DUMP: Type = Texture
000000.010: DX9_DUMP: Usage = RENDERTARGET
000000.010: DX9_DUMP: Pool = D3DPOOL_DEFAULT
000000.010: DX9_DUMP: Format = OAPISURFACE_PF_ARGB (21)
000000.010: DX9_DUMP: Multisample = 0
000000.010: DX9_DUMP: Size = (2048, 2048)
 

jarmonik

Well-known member
Orbiter Contributor
Addon Developer
Beta Tester
Joined
Mar 28, 2008
Messages
2,369
Reaction score
436
Points
83
Website
users.kymp.net
I'm getting an error running SR71-R with the latest D3D9Client branch from github. Orbiter.log is below.

This appears to be happening while I'm trying to bitblt the MFD buttons from a texture.

Thanks.
Format conversion from XRGB to ARGB isn't supported from a non-texture source, because the GPU can read only from a texture and the auxiliary blitter can't do format conversion. So, the source surface (60, 40) should be created with "OAPISURFACE_TEXTURE, OAPISURFACE_RENDERTARGET" flags in place. Have you taken a look at Orbiter2DGraphics.pdf ?

This latest build of the client doesn't have automation in place to override a programmer because it creates a chaos where a programmer can never be sure what's actually happening.
 

Blake

Addon Developer
Addon Developer
Joined
Mar 9, 2009
Messages
187
Reaction score
59
Points
43
Thanks jarmonik, adding the 'D' to the mesh file texture resolved the issue.
 

Thymo

I like breaking things
Addon Developer
Joined
Jun 26, 2016
Messages
118
Reaction score
144
Points
58
Website
nassp.space
I can reproduce an issue that causes a CTD. If I open an external MFD and resize the window so the MFD panel is 0x0 pixels an abort is called in the D3D9 client.
You can find the crashdump here: https://puu.sh/IILOZ/5a485c5d9e.dmp

Issues arise before I get to 0x0, if I slowly shrink the panel to a tiny squere the panel turns black and stops wokring until you close the Ext. MFD and reopen it.
Could someone take a look? Thanks so much in advance! :)

1644703453331.png
 

kuddel

Donator
Donator
Joined
Apr 1, 2008
Messages
1,808
Reaction score
326
Points
83
It should be easy to fix in D3D9ClientSurface::ConvertToRenderTarget by adding a "zero dimension check"
C++:
bool D3D9ClientSurface::ConvertToRenderTarget(bool bLock)
{
    LPDIRECT3DSURFACE9 pTgt;

    if (bBackBuffer) return true;
    if (GetAttribs()&OAPISURFACE_SYSMEM) return false;
    if (GetAttribs()&OAPISURFACE_TEXTURE) return false;
    if ((bLockable==bLock) && (desc.Usage&D3DUSAGE_RENDERTARGET) && pTex==NULL) return true;
// ++++
    if (desc.Width == 0 || desc.Height == 0) return false; // <= either width or height to small ;)
// ++++

    if (pDevice->CreateRenderTarget(desc.Width, desc.Height, desc.Format, D3DMULTISAMPLE_NONE, 0, bLock, &pTgt, NULL)!=S_OK) {
        LogErr("CreateRenderTarget Failed in ConvertToRenderTarget(0x%X) W=%u, H=%u, usage=0x%X, Format=0x%X", this, desc.Width, desc.Height, desc.Usage, desc.Format);
        LogSpecs("Surface");
        assert(false);
        return false;
    }
    // ...
}
but I am curruntly so far from "in the development loop", that I don't even know where to commit.
...I lost track where the current development is going on (x64, Orbiter repository, or D3D9Client @ Face-1 github....) sorry ;)
 

n72.75

Addon Developer
Addon Developer
Tutorial Publisher
Donator
Joined
Mar 21, 2008
Messages
2,229
Reaction score
752
Points
128
Location
Biddeford ME
Website
mwhume.space
Preferred Pronouns
he/him
but I am curruntly so far from "in the development loop", that I don't even know where to commit.

That seems to be the state of things at the moment unfortunately. And I think most of us are far too busy with life/other projects to provide direction.
 

indy91

Addon Developer
Addon Developer
Joined
Oct 26, 2011
Messages
1,123
Reaction score
407
Points
98
I was working on labels for Earth landmarks and noticed that the DX9 client seems to read the color of the Label.cfg file wrong. Here the comparison:

Default:


DX9:


The RGB values for Airports are 255 255 128. That should be that yellow tone, not cyan. Is some DX9 client code using a different order for RGB in the Label.cfg?
 
  • Like
Reactions: GLS

kuddel

Donator
Donator
Joined
Apr 1, 2008
Messages
1,808
Reaction score
326
Points
83
You might be right, it seems the color definitions in label.cfg are RGB and D3D9Client internaly uses BGR:

D3DPad.h
C++:
    /**
     * \brief Set the foreground colour for text output.
     * \param col colour description (format: 0xBBGGRR)
     * \return Previous colour setting.
     * \default None, returns 0.
     */
    DWORD SetTextColor (DWORD col);
 

kuddel

Donator
Donator
Joined
Apr 1, 2008
Messages
1,808
Reaction score
326
Points
83
A little macro like this:
C++:
// DWORD colour conversion (RGB to BGR, keeping the 'A' untouched)
#define ARGB_2_ABGR(rgb) ( (rgb & 0xFF00FF00) | ((rgb & 0xFF)<<16) | ((rgb & 0xFF0000)>>16)  )
will do the trick, when used at TileLabel.cpp:
C++:
void TileLabel::Render (D3D9Pad *skp, oapi::Font **labelfont, int *fontidx)
{
    // ...
                if (nl = tile->smgr->Client()->GetSurfaceMarkerLegend(hPlanet, &lspec)) {
                    for (int j = 0; j < nl; ++j) {
                        if (renderlabel[i]->labeltype == lspec[j].labelId) {
                            symbol = lspec[j].markerId;
                            col = ARGB_2_ABGR(lspec[j].col);
                            active = lspec[j].active;
                            break;
                        }
                    }
                }
    // ...
}

Unfortunately -again- I am currently not really able to commit this into the right repository (git), so maybe @jarmonik can add this for us and generate a new client.
 
Last edited:

Kyle

Armchair Astronaut
Addon Developer
Joined
Mar 17, 2008
Messages
3,891
Reaction score
288
Points
123
Website
orbithangar.com
A bizarre issue I've encountered. Somehow, D3D9 no longer works on my orbiter installation. I tried reinstalling it and the runtimes, but no avail. When I go to my Plugin modules to select D3D9Client, there's a bunch of weird characters at the top (even with a fresh install of Orbiter). I have no idea what on Earth caused this to happen, other than a PC update to Windows 10 I had overnight. The video tab is also missing. No addons were installed between now and the Windows update.
 

Attachments

  • Untitled.png
    Untitled.png
    62.9 KB · Views: 9

GLS

Well-known member
Orbiter Contributor
Addon Developer
Joined
Mar 22, 2008
Messages
4,810
Reaction score
1,322
Points
138
A bizarre issue I've encountered. Somehow, D3D9 no longer works on my orbiter installation. I tried reinstalling it and the runtimes, but no avail. When I go to my Plugin modules to select D3D9Client, there's a bunch of weird characters at the top (even with a fresh install of Orbiter). I have no idea what on Earth caused this to happen, other than a PC update to Windows 10 I had overnight. The video tab is also missing. No addons were installed between now and the Windows update.
Anything in the log?
 

Kyle

Armchair Astronaut
Addon Developer
Joined
Mar 17, 2008
Messages
3,891
Reaction score
288
Points
123
Website
orbithangar.com
Anything in the log?

Nothing that looked helpful. Just tons of error codes indicating missing plugins.

Code:
**** Orbiter.log
000000.000: Build Aug 28 2016 [v.160828]
000000.000: Timer precision: 1e-007 sec
000000.000: Found 1 joystick(s)
============================ ERROR: ===========================
Failed loading module Modules\Startup\AtlantisConfig.dll (code 126)
[Orbiter::LoadModule | .\Orbiter.cpp | 600]
===============================================================
============================ ERROR: ===========================
Failed loading module Modules\Startup\AtmConfig.dll (code 126)
[Orbiter::LoadModule | .\Orbiter.cpp | 600]
===============================================================
============================ ERROR: ===========================
Failed loading module Modules\Startup\DGConfigurator.dll (code 126)
[Orbiter::LoadModule | .\Orbiter.cpp | 600]
===============================================================
============================ ERROR: ===========================
Failed loading module Modules\Startup\EnergyConfigurator.dll (code 126)
[Orbiter::LoadModule | .\Orbiter.cpp | 600]
===============================================================
============================ ERROR: ===========================
Failed loading module Modules\Startup\ProjectApolloConfigurator.dll (code 126)
[Orbiter::LoadModule | .\Orbiter.cpp | 600]
===============================================================
============================ ERROR: ===========================
Failed loading module Modules\Startup\ProjectOutpostsConfig.dll (code 126)
[Orbiter::LoadModule | .\Orbiter.cpp | 600]
===============================================================
============================ ERROR: ===========================
Failed loading module Modules\Plugin\D3D9Client.dll (code 126)
[Orbiter::LoadModule | .\Orbiter.cpp | 600]
===============================================================
============================ ERROR: ===========================
Failed loading module Modules\Plugin\D3D9Client.dll (code 126)
[Orbiter::LoadModule | .\Orbiter.cpp | 600]
===============================================================
 

gamer19

Well-known member
Joined
Jul 16, 2016
Messages
107
Reaction score
175
Points
58
you scared my kyle, now I don't have the courage to start my own Orbiter
had some troubles with games refusing to work with windows update before
that's something hard to fight with. maybe even impossible
I sure hope this isn't it
those... gibberish signs... can it be some kind of area mix up ?
did you tried gpu drivers reinstallation ?
 

GLS

Well-known member
Orbiter Contributor
Addon Developer
Joined
Mar 22, 2008
Messages
4,810
Reaction score
1,322
Points
138
Maybe Windows deleted some needed dll or file? You should run the Depends program on one of those files to see what is missing.
 

Ripley

Tutorial translator
Donator
Joined
Sep 12, 2010
Messages
3,011
Reaction score
284
Points
123
Location
Rome
Website
www.tuttovola.org
Missing video tab is/was a clear indication of something missing, but right now I can't remember what it was off the top of my head.
 
Top