diff --git a/build/win32/Cxbx.vcxproj b/build/win32/Cxbx.vcxproj
index 355645ac8..b60243436 100644
--- a/build/win32/Cxbx.vcxproj
+++ b/build/win32/Cxbx.vcxproj
@@ -404,6 +404,7 @@ $(SOLUTIONDIR)Export.bat
+
diff --git a/build/win32/Cxbx.vcxproj.filters b/build/win32/Cxbx.vcxproj.filters
index 1116505e9..be097bf2e 100644
--- a/build/win32/Cxbx.vcxproj.filters
+++ b/build/win32/Cxbx.vcxproj.filters
@@ -848,6 +848,9 @@
HLEDatabase\XG
+
+ HLEDatabase\XG
+
HLEDatabase\XOnline
diff --git a/src/CxbxKrnl/HLEDataBase.cpp b/src/CxbxKrnl/HLEDataBase.cpp
index 637246fd9..49578b36d 100644
--- a/src/CxbxKrnl/HLEDataBase.cpp
+++ b/src/CxbxKrnl/HLEDataBase.cpp
@@ -70,17 +70,7 @@ const char *Sec_XNET = "XNET";
#include "HLEDataBase/Xapi.OOVPA.inl"
#include "HLEDataBase/D3D8.OOVPA.inl"
#include "HLEDataBase/DSound.OOVPA.inl"
-#include "HLEDataBase/XG.1.0.3911.inl"
-#include "HLEDataBase/XG.1.0.4034.inl"
-#include "HLEDataBase/XG.1.0.4361.inl"
-#include "HLEDataBase/XG.1.0.4432.inl"
-#include "HLEDataBase/XG.1.0.4627.inl"
-#include "HLEDataBase/XG.1.0.5028.inl"
-#include "HLEDataBase/XG.1.0.5233.inl"
-#include "HLEDataBase/XG.1.0.5344.inl"
-#include "HLEDataBase/XG.1.0.5558.inl"
-#include "HLEDataBase/XG.1.0.5788.inl"
-#include "HLEDataBase/XG.1.0.5849.inl"
+#include "HLEDataBase/XG.OOVPA.inl"
#include "HLEDataBase/XNet.1.0.3911.inl"
#include "HLEDataBase/XNet.1.0.4627.inl"
#include "HLEDataBase/XOnline.1.0.4361.inl"
@@ -155,6 +145,7 @@ const HLEData HLEDataBase[] =
HLE_ENTRY(Lib_XACTENG, XactEng, 5788),
HLE_ENTRY(Lib_XACTENG, XactEng, 5849),
#endif
+#if ENABLE_LEGACY_XGRAPHC_DB
HLE_ENTRY(Lib_XGRAPHC, XG, 3911),
HLE_ENTRY(Lib_XGRAPHC, XG, 4034),
HLE_ENTRY(Lib_XGRAPHC, XG, 4361),
@@ -166,7 +157,7 @@ const HLEData HLEDataBase[] =
HLE_ENTRY(Lib_XGRAPHC, XG, 5558),
HLE_ENTRY(Lib_XGRAPHC, XG, 5788),
HLE_ENTRY(Lib_XGRAPHC, XG, 5849),
-
+#endif
HLE_ENTRY(Lib_XNETS, XNet, 3911),
HLE_ENTRY(Lib_XNETS, XNet, 4627),
@@ -207,8 +198,8 @@ const HLEDataV2 HLEDataBaseV2[] = {
//
{ Lib_XAPILIB,{ Sec_text, Sec_XPP }, XAPILIB_OOVPAV2, XAPILIB_OOVPA_SIZEV2 },
- //
- //{ Lib_XGRAPHC,{ Sec_XGRPH }, XGRAPHC_OOVPAV2, XGRAPHC_OOVPA_SIZEV2 },
+ // Support inline functions in .text section
+ { Lib_XGRAPHC,{ Sec_text, Sec_XGRPH }, XGRAPHC_OOVPAV2, XGRAPHC_OOVPA_SIZEV2 },
//
//{ Lib_XONLINE,{ Sec_XONLINE }, XONLINES_OOVPAV2, XONLINES_OOVPA_SIZEV2 },
diff --git a/src/CxbxKrnl/HLEDataBase/XG.OOVPA.inl b/src/CxbxKrnl/HLEDataBase/XG.OOVPA.inl
new file mode 100644
index 000000000..e330af410
--- /dev/null
+++ b/src/CxbxKrnl/HLEDataBase/XG.OOVPA.inl
@@ -0,0 +1,75 @@
+// ******************************************************************
+// *
+// * .,-::::: .,:: .::::::::. .,:: .:
+// * ,;;;'````' `;;; .,;; ;;;'';;' `;;; .,;;
+// * [[[ '[[,,[[' [[[__[[\. '[[,,[['
+// * $$$ Y$$$P $$""""Y$$ Y$$$P
+// * `88bo,__,o oP"``"Yo _88o,,od8P oP"``"Yo,
+// * "YUMMMMMP",m" "Mm,""YUMMMP" ,m" "Mm,
+// *
+// * Cxbx->Win32->CxbxKrnl->HLEDatabase->XG.OOVPA.inl
+// *
+// * This file is part of the Cxbx project.
+// *
+// * Cxbx and Cxbe are free software; you can redistribute them
+// * and/or modify them under the terms of the GNU General Public
+// * License as published by the Free Software Foundation; either
+// * version 2 of the license or (at your option) any later version.
+// *
+// * This program is distributed in the hope that it will be useful,
+// * but WITHOUT ANY WARRANTY; without even the implied warranty of
+// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// * GNU General Public License for more details.
+// *
+// * You should have recieved a copy of the GNU General Public License
+// * along with this program; see the file COPYING.
+// * If not write to the Free Software Foundation Inc.,
+// * 59 Temple Place - Suite 330 Bostom MA 02111-1307 USA.
+// *
+// * (c) 2017 jarupxx
+// *
+// * All rights reserved
+// *
+// ******************************************************************
+
+#ifndef XGRAPHC_OOVPA_INL
+#define XGRAPHC_OOVPA_INL
+
+#include "../OOVPA.h"
+
+#include "HLEDataBase/XG.1.0.3911.inl"
+#include "HLEDataBase/XG.1.0.4034.inl"
+#include "HLEDataBase/XG.1.0.4361.inl"
+#include "HLEDataBase/XG.1.0.4432.inl"
+#include "HLEDataBase/XG.1.0.4627.inl"
+#include "HLEDataBase/XG.1.0.5028.inl"
+#include "HLEDataBase/XG.1.0.5233.inl"
+#include "HLEDataBase/XG.1.0.5344.inl"
+#include "HLEDataBase/XG.1.0.5558.inl"
+#include "HLEDataBase/XG.1.0.5788.inl"
+#include "HLEDataBase/XG.1.0.5849.inl"
+
+// ******************************************************************
+// * XGRAPHC_OOVPA
+// ******************************************************************
+OOVPATable XGRAPHC_OOVPAV2[] = {
+
+ REGISTER_OOVPAS(XFONT_OpenBitmapFontFromMemory, XREF, 4361),
+ REGISTER_OOVPAS(XGCompressRect, XREF, 3911),
+ REGISTER_OOVPAS(XGIsSwizzledFormat, PATCH, 3911),
+ REGISTER_OOVPAS(XGSetIndexBufferHeader, XREF, 3911, 4361),
+ REGISTER_OOVPAS(XGSetTextureHeader, PATCH, 3911),
+ REGISTER_OOVPAS(XGSetVertexBufferHeader, XREF, 3911, 4361),
+ REGISTER_OOVPAS(XGSwizzleBox, PATCH, 3911),
+ // REGISTER_OOVPAS(XGSwizzleRect, UNPATCHED, 3911), // TODO : Uncomment
+ REGISTER_OOVPAS(XGUnswizzleBox, UNPATCHED, 3911),
+ // REGISTER_OOVPAS(XGUnswizzleRect, UNPATCHED, 3911), // TODO : Uncomment
+ REGISTER_OOVPAS(XGWriteSurfaceOrTextureToXPR, PATCH, 3911),
+};
+
+// ******************************************************************
+// * XGRAPHC_OOVPA_SIZE
+// ******************************************************************
+uint32 XGRAPHC_OOVPA_SIZEV2 = sizeof(XGRAPHC_OOVPAV2);
+
+#endif
diff --git a/src/CxbxKrnl/HLEIntercept.cpp b/src/CxbxKrnl/HLEIntercept.cpp
index 5e206505f..3320b437e 100644
--- a/src/CxbxKrnl/HLEIntercept.cpp
+++ b/src/CxbxKrnl/HLEIntercept.cpp
@@ -383,10 +383,12 @@ void EmuHLEIntercept(Xbe::Header *pXbeHeader)
if (bLLE_GPU)
continue;
+#if ENABLE_LEGACY_XGRAPHC_DB
if (BuildVersion == 3944)
BuildVersion = 3911;
if (OrigBuildVersion == 4531)
BuildVersion = 4361;
+#endif
}
if (strcmp(LibraryName.c_str(), Lib_XACTENG) == 0)
{