Skip to content
Permalink
Browse files

Fix a large part of XTL-hell (#1731)

* Rename g_CurrentXboxVertexShaderHandle to g_Xbox_VertexShader_Handle

* Remove CxbxDrawContext.XboxVertexShaderHandle field, and replaced reads from this field by g_Xbox_VertexShader_Handle (since all writes to this field used that as source)

* Removed commented-out #include's

* Removed duplicate DEF_VSH_* defines, replaced usage by existing X_D3DVSD_*() defines.

* Removed commented-out #include's from src/vsbc

* Removed nearly all "namespace XTL"-wrappers around #includes; Instead, wrap applicable contents of these included files in namespace XTL. Removed all now-obsolete "XTL::" prefixes.

* Moved all host D3D9 symbols outside of namespace XTL (finally!)

* Removed all "using namespace XTL;" occurences (except one, which is marked with a TODO)

* Restored Unix EOL style (to avoid large diffs with upstream)

* Moved CxbxInitAudio outside XTL namespace (this was the last Cxbx* symbol in XTL)

* Removed final "using namespace XTL" occurence by cleaner wrapping of logging intrinsics inside and outside namespace XTL.

* Prefix a few Xbox types with X_ (and avoid compile-error by removing the now-obsolete duplicate of X_D3DCALLBACK).
Also nicely indent all Direct3D9 alias defines, introduced when porting from Direct3D8. Who knows, one day we might re-define them once again to port to more recent Direct3D versions?

* Made EmuXTL.h obsolete, by #include'ing specific headers instead of it.

* Removed unused #include's of EmuFS.h

* Remove #pragma once, when there's already an include guard present.

* Delete EmuXTL.h and XOnline.cpp, keep but disable XOnline.h for documentation purposes.

* Fix all compiler warnings that have no functional impact. What's left requires more research

* Remove GetVersion, retain Wine check
  • Loading branch information...
PatrickvL authored and RadWolfie committed Sep 24, 2019
1 parent fa38cd4 commit a6c0353c5beaf14766313050bfc0c9fe222147ac
Showing with 1,030 additions and 1,521 deletions.
  1. +0 −2 CMakeLists.txt
  2. +3 −3 import/OpenXDK/include/xboxkrnl/xboxkrnl.h
  3. +0 −4 src/Cxbx.h
  4. +8 −1 src/common/EmuEEPROM.h
  5. +0 −11 src/common/Logging.h
  6. +0 −1 src/common/ReservedMemory.h
  7. +1 −4 src/common/input/InputManager.cpp
  8. +4 −4 src/common/util/CPUID.h
  9. +1 −5 src/common/util/CxbxUtil.cpp
  10. +4 −3 src/common/win32/Threads.cpp
  11. +3 −2 src/common/xbe/Xbe.cpp
  12. +1 −3 src/common/xdvdfs-tools/xdvdfs.h
  13. +204 −212 src/core/hle/D3D8/Direct3D9/Direct3D9.cpp
  14. +18 −10 src/core/hle/D3D8/Direct3D9/Direct3D9.h
  15. +0 −1 src/core/hle/D3D8/Direct3D9/WalkIndexBuffer.h
  16. +176 −187 src/core/hle/D3D8/XbConvert.cpp
  17. +17 −29 src/core/hle/D3D8/XbConvert.h
  18. +4 −5 src/core/hle/D3D8/XbD3D8Logging.cpp
  19. +7 −8 src/core/hle/D3D8/XbD3D8Logging.h
  20. +39 −36 src/core/hle/D3D8/XbD3D8Types.h
  21. +30 −49 src/core/hle/D3D8/XbPixelShader.cpp
  22. +3 −3 src/core/hle/D3D8/XbPixelShader.h
  23. +13 −40 src/core/hle/D3D8/XbPushBuffer.cpp
  24. +69 −69 src/core/hle/D3D8/XbState.cpp
  25. +2 −0 src/core/hle/D3D8/XbState.h
  26. +18 −19 src/core/hle/D3D8/XbVertexBuffer.cpp
  27. +10 −13 src/core/hle/D3D8/XbVertexBuffer.h
  28. +80 −105 src/core/hle/D3D8/XbVertexShader.cpp
  29. +6 −10 src/core/hle/D3D8/XbVertexShader.h
  30. +2 −2 src/core/hle/DSOUND/DirectSound/DirectSound.cpp
  31. +12 −6 src/core/hle/DSOUND/DirectSound/DirectSound.hpp
  32. +0 −3 src/core/hle/DSOUND/DirectSound/DirectSoundLogging.cpp
  33. +1 −0 src/core/hle/DSOUND/XbDSoundLogging.cpp
  34. +2 −1 src/core/hle/DSOUND/XbDSoundLogging.hpp
  35. +7 −2 src/core/hle/DSOUND/XbDSoundTypes.h
  36. +2 −4 src/core/hle/Intercept.cpp
  37. +2 −1 src/core/hle/Patches.cpp
  38. +2 −3 src/core/hle/XACTENG/XactEng.cpp
  39. +4 −0 src/core/hle/XACTENG/XactEng.h
  40. +71 −72 src/core/hle/XAPI/Xapi.cpp
  41. +4 −0 src/core/hle/XAPI/Xapi.h
  42. +101 −101 src/core/hle/XAPI/XapiCxbxr.h
  43. +3 −2 src/core/hle/XGRAPHIC/XGraphic.cpp
  44. +6 −0 src/core/hle/XGRAPHIC/XGraphic.h
  45. +0 −298 src/core/hle/XONLINE/XOnline.cpp
  46. +8 −2 src/core/hle/XONLINE/XOnline.h
  47. +0 −2 src/core/kernel/exports/EmuKrnl.cpp
  48. +1 −1 src/core/kernel/exports/EmuKrnlAv.cpp
  49. +2 −2 src/core/kernel/exports/EmuKrnlKe.cpp
  50. +0 −9 src/core/kernel/exports/EmuKrnlLogging.cpp
  51. +0 −2 src/core/kernel/exports/EmuKrnlLogging.h
  52. +0 −2 src/core/kernel/exports/EmuKrnlPhy.cpp
  53. +0 −4 src/core/kernel/exports/EmuKrnlPs.cpp
  54. +16 −42 src/core/kernel/init/CxbxKrnl.cpp
  55. +4 −6 src/core/kernel/support/Emu.cpp
  56. +4 −3 src/core/kernel/support/EmuFS.cpp
  57. +0 −2 src/core/kernel/support/EmuFile.cpp
  58. +0 −46 src/core/kernel/support/EmuXTL.h
  59. +3 −2 src/devices/EmuNVNet.cpp
  60. +3 −3 src/devices/usb/Hub.cpp
  61. +6 −4 src/devices/usb/OHCI.cpp
  62. +4 −4 src/devices/usb/USBDevice.cpp
  63. +1 −1 src/devices/video/EmuNV2A_PRMCIO.cpp
  64. +1 −1 src/devices/video/EmuNV2A_PTIMER.cpp
  65. +1 −2 src/devices/video/nv2a.cpp
  66. +2 −2 src/devices/video/nv2a_int.h
  67. +2 −2 src/devices/x86/EmuX86.cpp
  68. +0 −1 src/gui/DbgConsole.cpp
  69. +0 −7 src/gui/DlgEepromConfig.cpp
  70. +14 −14 src/gui/DlgVideoConfig.cpp
  71. +0 −1 src/gui/DlgVirtualSBCFeedback.cpp
  72. +14 −14 src/gui/WndMain.cpp
  73. +0 −1 src/vsbc/CxbxVSBC.cpp
  74. +4 −3 src/vsbc/CxbxVSBC.h
  75. +0 −2 src/vsbc/DlgVirtualSBCFeedback.cpp
@@ -162,7 +162,6 @@ file (GLOB CXBXR_HEADER_EMU
"${CXBXR_ROOT_DIR}/src/core/kernel/support/EmuFile.h"
"${CXBXR_ROOT_DIR}/src/core/kernel/support/EmuFS.h"
"${CXBXR_ROOT_DIR}/src/core/kernel/support/EmuNtDll.h"
"${CXBXR_ROOT_DIR}/src/core/kernel/support/EmuXTL.h"
"${CXBXR_ROOT_DIR}/src/devices/ADM1032Device.h"
"${CXBXR_ROOT_DIR}/src/devices/EEPROMDevice.h"
"${CXBXR_ROOT_DIR}/src/devices/EmuNVNet.h"
@@ -275,7 +274,6 @@ file (GLOB CXBXR_SOURCE_EMU
"${CXBXR_ROOT_DIR}/src/core/hle/XACTENG/XactEng.cpp"
"${CXBXR_ROOT_DIR}/src/core/hle/XAPI/Xapi.cpp"
"${CXBXR_ROOT_DIR}/src/core/hle/XGRAPHIC/XGraphic.cpp"
"${CXBXR_ROOT_DIR}/src/core/hle/XONLINE/XOnline.cpp"
"${CXBXR_ROOT_DIR}/src/core/kernel/exports/EmuKrnl.cpp"
"${CXBXR_ROOT_DIR}/src/core/kernel/exports/EmuKrnlAv.cpp"
"${CXBXR_ROOT_DIR}/src/core/kernel/exports/EmuKrnlDbg.cpp"
@@ -175,6 +175,7 @@ typedef long NTSTATUS;
// * Registry value types
// ******************************************************************
// Used in ExQueryNonVolatileSetting and ExSaveNonVolatileSetting
#ifndef _WIN32 // Avoid "warning C4005: 'REG_NONE': macro redefinition" (conflicting with winnt.h)
#define REG_NONE ( 0 ) // No defined value type.
#define REG_SZ ( 1 ) // A null - terminated string. This will be either a Unicode or an ANSI string, depending on whether you use the Unicode or ANSI functions.
#define REG_EXPAND_SZ ( 2 ) // A null - terminated string that contains unexpanded references to environment variables (for example, "%PATH%"). It will be a Unicode or ANSI string depending on whether you use the Unicode or ANSI functions. To expand the environment variable references, use the ExpandEnvironmentStrings function.
@@ -187,6 +188,7 @@ typedef long NTSTATUS;
#define REG_RESOURCE_LIST ( 8 ) // Resource list in the resource map
#define REG_FULL_RESOURCE_DESCRIPTOR ( 9 ) // Resource list in the hardware description
#define REG_RESOURCE_REQUIREMENTS_LIST ( 10 )
#endif

// ******************************************************************
// * calling conventions
@@ -1831,11 +1833,9 @@ EXCEPTION_DISPOSITION, *PEXCEPTION_DISPOSITION;
// ******************************************************************
// * EXCEPTION_REGISTRATION_RECORD
// ******************************************************************
typedef struct _EXCEPTION_REGISTRATION_RECORD *PEXCEPTION_REGISTRATION_RECORD; // forward

typedef struct _EXCEPTION_REGISTRATION_RECORD
{
PEXCEPTION_REGISTRATION_RECORD Next;
struct _EXCEPTION_REGISTRATION_RECORD *Next; // Don't forward declare PEXCEPTION_REGISTRATION_RECORD to avoid conflict with winnt.h
PEXCEPTION_DISPOSITION Handler;
}
EXCEPTION_REGISTRATION_RECORD, *PEXCEPTION_REGISTRATION_RECORD;
@@ -88,10 +88,6 @@ extern bool g_SaveOnExit;
/*! runtime logging toggle boolean */
extern volatile bool g_bPrintfOn;

#ifdef _MSC_VER
#pragma warning(disable : 4477)
#endif

#if WIN32
#include "Win32\Threads.h"
#define CxbxSetThreadName(Name) SetCurrentThreadName(Name)
@@ -28,11 +28,18 @@
#define EMU_EEPROM_H

#if defined(__cplusplus)
#pragma once
extern "C"
{
#endif

// prevent name collisions
namespace xboxkrnl
{
#undef _WIN32 // Compile-in REG_DWORD and friends, since we lack a <windows> include here
#include <xboxkrnl/xboxkrnl.h> // For XC_VALUE_INDEX and XBOX_EEPROM
#define _WIN32
};

#define EEPROM_SIZE sizeof(xboxkrnl::XBOX_EEPROM)

typedef struct EEPROMInfo {
@@ -26,8 +26,6 @@
#ifndef _LOGGING_H
#define _LOGGING_H

#pragma once

#include <windows.h> // For DWORD
#include <sstream> // For std::stringstream
#include <iostream> // For std::cout
@@ -392,15 +390,6 @@ extern thread_local std::string _logThreadPrefix;
} \
} while(0)

#ifdef _MSC_VER
#pragma warning(push)
#pragma warning(disable : 4477)
#endif

#ifdef _MSC_VER
#pragma warning(pop)
#endif

//
// Short hand function logging defines :
//
@@ -26,7 +26,6 @@
#define RESERVEDMEMORY_H

#if defined(__cplusplus)
#pragma once
extern "C"
{
#endif
@@ -51,13 +51,10 @@ namespace xboxkrnl
#include "devices\usb\OHCI.h"

// hle input specific
namespace XTL
{
#include "core\hle\XAPI\Xapi.h"
}
#include "core\hle\XAPI\XapiCxbxr.h"

extern X_CONTROLLER_HOST_BRIDGE g_XboxControllerHostBridge[4]; // hle xinput
extern CXBX_CONTROLLER_HOST_BRIDGE g_XboxControllerHostBridge[4]; // hle xinput


InputDeviceManager g_InputDeviceManager;
@@ -29,10 +29,10 @@ class CPUID {
#endif
}

const std::bitset<32> &EAX() const { return regs[0]; }
const std::bitset<32> &EBX() const { return regs[1]; }
const std::bitset<32> &ECX() const { return regs[2]; }
const std::bitset<32> &EDX() const { return regs[3]; }
const std::bitset<32> &EAX() const { return (std::bitset<32> &)regs[0]; }
const std::bitset<32> &EBX() const { return (std::bitset<32> &)regs[1]; }
const std::bitset<32> &ECX() const { return (std::bitset<32> &)regs[2]; }
const std::bitset<32> &EDX() const { return (std::bitset<32> &)regs[3]; }
};

class SimdCaps {
@@ -60,9 +60,7 @@

// Disable a compiler warning relative to uint64_t -> uint32_t conversions in Muldiv64. This function is taken from
// QEMU so it should be safe regardless
#pragma warning(push)
#pragma warning(disable: 4244)

#pragma warning(suppress: 4244)
// Compute (a*b)/c with a 96 bit intermediate result
uint64_t Muldiv64(uint64_t a, uint32_t b, uint32_t c)
{
@@ -83,8 +81,6 @@ uint64_t Muldiv64(uint64_t a, uint32_t b, uint32_t c)
return res.ll;
}

#pragma warning(pop)

void IoVecReset(IOVector* qiov)
{
assert(qiov->AllocNumber != -1);
@@ -51,14 +51,15 @@ void SetThreadName(DWORD dwThreadID, const char* szThreadName)
info.szName = szThreadName;
info.dwThreadID = dwThreadID;
info.dwFlags = 0;
#pragma warning(push)
#pragma warning(disable: 6320 6322)
__try {
RaiseException(MS_VC_EXCEPTION, 0, sizeof(info) / sizeof(ULONG_PTR), (ULONG_PTR*)&info);
}
#pragma warning(suppress : 6320) // silence /analyze: Exception-filter expression is the constant
// EXCEPTION_EXECUTE_HANDLER. This might mask exceptions that were
// not intended to be handled
#pragma warning(suppress : 6322) // silence /analyze: Empty _except block
__except (EXCEPTION_EXECUTE_HANDLER) {
}
#pragma warning(pop)
}

void SetCurrentThreadName(const char* szThreadName)
@@ -40,7 +40,8 @@ namespace xboxkrnl
#include "core\kernel\init\CxbxKrnl.h" // For CxbxKrnlPrintUEM
#include "common\crypto\EmuSha.h" // For the SHA functions
#include "common\crypto\EmuRsa.h" // For the RSA functions
#include "core\kernel\support\EmuXTL.h" // For LDT_FROM_DASHBOARD and CxbxInitWindow
#include "core\hle\XAPI\Xapi.h" // For LDT_FROM_DASHBOARD
#include "core\hle\D3D8\Direct3D9\Direct3D9.h" // For CxbxInitWindow

namespace fs = std::experimental::filesystem;

@@ -72,7 +73,7 @@ Xbe::Xbe(const char *x_szFilename, bool bFromGUI)
// The dashboard could not be found on partition2. This is a fatal error on the Xbox so we display the UEM. The
// error code is different if we have a launch data page

XTL::CxbxInitWindow(false);
CxbxInitWindow(false);

ULONG FatalErrorCode = FATAL_ERROR_XBE_DASH_GENERIC;

@@ -4,8 +4,6 @@
#define __XDVDFS_H__

#ifdef __cplusplus
#pragma once

extern "C" {
#endif

@@ -163,4 +161,4 @@ extern DWORD XDVDFS_FileSeek(
}
#endif

#endif // __XDVDFS_H__
#endif // __XDVDFS_H__

0 comments on commit a6c0353

Please sign in to comment.
You can’t perform that action at this time.