Skip to content

Commit

Permalink
Merge branch 'main' of https://github.com/orbitersim/orbiter into ter…
Browse files Browse the repository at this point in the history
…rain_elev
  • Loading branch information
jarmonik committed Jan 7, 2024
2 parents 6127042 + f3ffb61 commit 5318e92
Show file tree
Hide file tree
Showing 21 changed files with 8,941 additions and 7,524 deletions.
27 changes: 25 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,30 @@ jobs:
- name: Install
working-directory: ${{ github.workspace }}/out/build/windows-${{ matrix.architecture }}-release
run: cmake --install . --prefix ${{ github.workspace }}/out/install

- name: List exports
working-directory: ${{ github.workspace }}/out/install/Orbiter
shell: cmd
run: |
dumpbin /EXPORTS Modules\Server\Orbiter.exe /OUT:exports_tmp0.txt
type exports_tmp0.txt | find " ?" > exports_tmp1.txt
for /F "tokens=4" %%F in (exports_tmp1.txt) do @echo %%F >> exports_tmp2.txt
undname exports_tmp2.txt | sort > exports.txt
del /Q exports_tmp*.txt
- name: Diff exports with Orbiter 2016
if: ${{ matrix.architecture == 'x86' }}
shell: cmd
continue-on-error: true
run: git diff -U0 --ignore-cr-at-eol --ignore-space-at-eol --no-index exports.2016.txt out/install/Orbiter/exports.txt

- name: Upload exports
uses: actions/upload-artifact@v4
with:
name: exports-${{ matrix.architecture }}
path: ${{ github.workspace }}/out/install/Orbiter/exports.txt
retention-days: 1

- name: Pack
if: ${{ github.ref == 'refs/heads/main' }}
working-directory: ${{ github.workspace }}/out/install/Orbiter
Expand All @@ -87,7 +110,7 @@ jobs:

- name: Upload Build Artifact
if: ${{ github.ref == 'refs/heads/main' }}
uses: actions/upload-artifact@v3.1.3
uses: actions/upload-artifact@v4
with:
name: Orbiter-${{ matrix.architecture }}
# A file, directory or wildcard pattern that describes what to upload
Expand All @@ -111,7 +134,7 @@ jobs:
uses: actions/checkout@v4

- name: Download artifacts
uses: actions/download-artifact@v3
uses: actions/download-artifact@v4
with:
path: ./out

Expand Down
7,381 changes: 0 additions & 7,381 deletions GravityModels/jgmro_120d_sha.tab

This file was deleted.

7,381 changes: 7,381 additions & 0 deletions GravityModels/jgmro_120f_sha.tab

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions OVP/D3D9Client/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ configure_file(D3D9ClientConfig.h.in D3D9ClientConfig.h)
# set(CMAKE_CXX_STANDARD_REQUIRED True)

set(DXSDK_LIB_DIR ${DXSDK_DIR}/lib/${ARCH})
set(DXSDK_LIB_DIR2 "C:/Program Files (x86)/Windows Kits/10/Lib/10.0.19041.0/um/${ARCH}") #Must acquire d3d9.lib from here

set(D3D9_SOURCE_DIR ${CMAKE_SOURCE_DIR}/OVP/D3D9Client)
set(ShaderDir ${D3D9_SOURCE_DIR}/shaders)
Expand Down Expand Up @@ -174,6 +175,7 @@ target_include_directories(D3D9Client PUBLIC

target_link_directories(D3D9Client PUBLIC
${ORBITER_BINARY_SDK_DIR}/lib
${DXSDK_LIB_DIR2}
${DXSDK_LIB_DIR}
)

Expand Down
42 changes: 37 additions & 5 deletions OVP/D3D9Client/D3D9Client.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
#include "gcCore.h"
#include "gcConst.h"
#include <unordered_map>
#include <d3d9on12.h>


#if defined(_MSC_VER) && (_MSC_VER <= 1700 ) // Microsoft Visual Studio Version 2012 and lower
Expand All @@ -65,6 +66,7 @@ using namespace oapi;
HINSTANCE g_hInst = 0;
D3D9Client *g_client = 0;
class gcConst* g_pConst = 0;
IDirect3D9* g_pD3DObject = 0; // Made valid when VideoTab is created

D3D9Catalog<LPDIRECT3DTEXTURE9> *TileCatalog;

Expand Down Expand Up @@ -277,6 +279,7 @@ D3D9Client::~D3D9Client()
{
LogAlw("D3D9Client destructor called");
SAFE_DELETE(vtab);
SAFE_RELEASE(g_pD3DObject);
}


Expand Down Expand Up @@ -313,11 +316,28 @@ bool D3D9Client::clbkInitialise()
LogAlw("================ clbkInitialise ===============");
LogAlw("Orbiter Version = %d",oapiGetOrbiterVersion());

D3D9ON12_ARGS args = {};
args.Enable9On12 = Config->Enable9On12 != 0;

// NOTE: Link error 'unresolved external symbol' means that d3d9.lib is outdated, use the latest one.
g_pD3DObject = Direct3DCreate9On12(D3D_SDK_VERSION, &args, 1);

if (g_pD3DObject) {
oapiWriteLog("[D3D9] DirectX9 Created...");
if (Config->Enable9On12) oapiWriteLog("[D3D9] DX9 emulation via DX12");
else oapiWriteLog("[D3D9] Native Interface");
}
else {
oapiWriteLog("[D3D9][ERROR] Failed to create DirectX9");
return false;
}

// Perform default setup
if (GraphicsClient::clbkInitialise()==false) return false;
//Create the Launchpad video tab interface
oapiWriteLog("[D3D9] Initialize VideoTab...");
vtab = new VideoTab(this, ModuleInstance(), OrbiterInstance(), LaunchpadVideoTab());

oapiWriteLog("[D3D9] VideoTab Created...");
return true;
}

Expand All @@ -331,6 +351,8 @@ HWND D3D9Client::clbkCreateRenderWindow()

LogAlw("================ clbkCreateRenderWindow ===============");

if (!g_pD3DObject) return NULL;

Config->WriteParams();

uEnableLog = Config->DebugLvl;
Expand Down Expand Up @@ -378,8 +400,6 @@ HWND D3D9Client::clbkCreateRenderWindow()

pFramework = new CD3DFramework9();

if (pFramework->GetDirect3D()==NULL) return NULL;

WriteLog("[DirectX 9 Initialized]");

HRESULT hr = pFramework->Initialize(hRenderWnd, GetVideoData());
Expand Down Expand Up @@ -969,6 +989,14 @@ void D3D9Client::clbkDestroyRenderWindow (bool fastclose)

}

// ==============================================================

void D3D9Client::clbkDebugString(const char* str)
{
D3D9DebugLog("%s", str);
}


// ==============================================================

void D3D9Client::PushSketchpad(SURFHANDLE surf, D3D9Pad *pSkp) const
Expand Down Expand Up @@ -2900,10 +2928,14 @@ void D3D9Client::SplashScreen()
DWORD m = d/100; d-=m*100;
if (m>12) m=0;

char dataA[256];
strcpy(dataA, "D3D9Client");
if (Config->Enable9On12) strcat_s(dataA, 256, " via D3D9on12 emulator");

#ifdef _DEBUG
char dataA[]={"Using D3D9Client (Debug Build)"};
strcat_s(dataA, 256, " (Debug Build)");
#else
char dataA[]={"Using D3D9Client (Release Build)"};
strcat_s(dataA, 256, " (Release Build)");
#endif

char dataB[128]; sprintf_s(dataB,128,"Build %s %lu 20%lu [%u]", months[m], d, y, oapiGetOrbiterVersion());
Expand Down
3 changes: 3 additions & 0 deletions OVP/D3D9Client/D3D9Client.h
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ typedef class SurfNative* lpSurfNative;
extern D3D9Catalog<LPDIRECT3DTEXTURE9> *TileCatalog;
extern set<D3D9Mesh*> MeshCatalog;
extern set<SurfNative*> SurfaceCatalog;
extern IDirect3D9* g_pD3DObject;


/**
Expand Down Expand Up @@ -207,6 +208,8 @@ class D3D9Client : public GraphicsClient
*/
void clbkOptionChanged(DWORD cat, DWORD item);

void clbkDebugString(const char* str);

/**
* \brief Texture request
*
Expand Down
3 changes: 3 additions & 0 deletions OVP/D3D9Client/D3D9Config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ D3D9Config::~D3D9Config ()

void D3D9Config::Reset ()
{
Enable9On12 = 0;
OrbitalShadowMult = 0.85;
PlanetPreloadMode = 0;
PlanetLoadFrequency = 20;
Expand Down Expand Up @@ -129,6 +130,7 @@ bool D3D9Config::ReadParams ()
FILEHANDLE hFile = oapiOpenFile(cfgfile, FILE_IN_ZEROONFAIL, ROOT);
if (!hFile) return false;

if (oapiReadItem_int (hFile, (char*)"EnableDX12Wrapper", i)) Enable9On12 = max(0, min(1, i));
if (oapiReadItem_float (hFile, (char*)"FrameRate", d)) FrameRate = max(0.0, min(300.0, d));
if (oapiReadItem_int (hFile, (char*)"EnableLimiter", i)) EnableLimiter = max(0, min(1, i));
if (oapiReadItem_int (hFile, (char*)"CustomCamMode", i)) CustomCamMode = max(0, min(1, i));
Expand Down Expand Up @@ -219,6 +221,7 @@ void D3D9Config::WriteParams ()
{
FILEHANDLE hFile = oapiOpenFile (cfgfile, FILE_OUT, ROOT);

oapiWriteItem_int (hFile, (char*)"EnableDX12Wrapper", Enable9On12);
oapiWriteItem_float (hFile, (char*)"FrameRate", FrameRate);
oapiWriteItem_int (hFile, (char*)"EnableLimiter", EnableLimiter);
oapiWriteItem_int (hFile, (char*)"CustomCamMode", CustomCamMode);
Expand Down
2 changes: 1 addition & 1 deletion OVP/D3D9Client/D3D9Config.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class D3D9Config {
static const int LABEL_DISPLAY_RECORD = 0x1; ///< Display label "Record" on active recording session
static const int LABEL_DISPLAY_REPLAY = 0x2; ///< Display label "Replay" on active playback session


int Enable9On12; ///< Enable DX9 through DX12
int PlanetPreloadMode; ///< Planet preload mode setting (0=load on demand, 1=preload)
int PlanetLoadFrequency; ///< Load frequency for on-demand textures \[Hz\] (1...1000)
int Anisotrophy; ///< Anisotropic filtering setting \[factor\] (1...16)
Expand Down
Loading

0 comments on commit 5318e92

Please sign in to comment.