Skip to content

Commit

Permalink
feat!: add REX (#273)
Browse files Browse the repository at this point in the history
  • Loading branch information
qudix authored Sep 21, 2024
1 parent 565f629 commit 61d8e46
Show file tree
Hide file tree
Showing 55 changed files with 5,595 additions and 3,507 deletions.
11 changes: 8 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -165,10 +165,14 @@ function(configure_target TARGET_NAME)
target_link_libraries(
${TARGET_NAME}
PUBLIC
advapi32.lib
bcrypt.lib
dbghelp.lib
dxgi.lib
ole32.lib
spdlog::spdlog
Version.lib
Dbghelp.lib
Ws2_32.lib
version.lib
ws2_32.lib
)

if(SFSE_SUPPORT_XBYAK)
Expand Down Expand Up @@ -233,6 +237,7 @@ install(
DIRECTORY
include/RE
include/REL
include/REX
include/SFSE
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
)
20 changes: 11 additions & 9 deletions include/RE/B/BGSAtmosphere.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
#include "RE/B/BGSReflectedForm.h"
#include "RE/B/BSTArray.h"

#include "REX/W32/D3D.h"

namespace RE
{
class BGSResource;
Expand Down Expand Up @@ -36,20 +38,20 @@ namespace RE
public:
struct alignas(4) RayleighSettings
{
float moleculesPerUnitVolume; // 00
float refractiveIndexOfAir; // 04
float depolarizationFactor; // 08
bool useOzoneAbsorptionApproximation; // 0C
DirectX::XMFLOAT4 ozoneAbsorptionCoef; // 10
DirectX::XMFLOAT4 rayleighCoef; // 20
float moleculesPerUnitVolume; // 00
float refractiveIndexOfAir; // 04
float depolarizationFactor; // 08
bool useOzoneAbsorptionApproximation; // 0C
REX::W32::XMFLOAT4 ozoneAbsorptionCoef; // 10
REX::W32::XMFLOAT4 rayleighCoef; // 20
};
static_assert(sizeof(RayleighSettings) == 0x30);

struct alignas(4) MieSettings
{
float aerosolDensity; // 00
float aerosolAbsorbtion; // 04
DirectX::XMFLOAT4 mieCoef; // 08
float aerosolDensity; // 00
float aerosolAbsorbtion; // 04
REX::W32::XMFLOAT4 mieCoef; // 08
};
static_assert(sizeof(MieSettings) == 0x18);

Expand Down
92 changes: 47 additions & 45 deletions include/RE/B/BGSCloudForm.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

#include "RE/B/BGSReflectedForm.h"

#include "REX/W32/D3D.h"

namespace RE
{
class BGSEffectSequenceForm;
Expand Down Expand Up @@ -29,58 +31,58 @@ namespace RE
{
public:
// members
BSFixedString name; // 00
BSFixedString colorTexture; // 08
BSFixedString thicknessTexture; // 10
BSFixedString normalTexture; // 18
BSFixedString opacityTexture; // 20
float elevationKm; // 28
float heightKm; // 2C
float distanceKm; // 30
float thickness; // 34
float textureShadowOffset; // 38
float textureShadowStrength; // 3C
float normalShadowStrength; // 40
std::uint32_t tiling; // 44
std::uint32_t verticalTiling; // 48
float topBlendDistanceKm; // 4C
float topBlendStartKm; // 50
float bottomBlendDistanceKm; // 54
float bottomBlendStartKm; // 58
float windScale; // 5C
float density; // 60
float coverage; // 64
float alphaAdd; // 68
float alphaMultiply; // 6C
DirectX::XMCOLOR tint; // 70
bool enableEditorRendering; // 74
BSFixedString name; // 00
BSFixedString colorTexture; // 08
BSFixedString thicknessTexture; // 10
BSFixedString normalTexture; // 18
BSFixedString opacityTexture; // 20
float elevationKm; // 28
float heightKm; // 2C
float distanceKm; // 30
float thickness; // 34
float textureShadowOffset; // 38
float textureShadowStrength; // 3C
float normalShadowStrength; // 40
std::uint32_t tiling; // 44
std::uint32_t verticalTiling; // 48
float topBlendDistanceKm; // 4C
float topBlendStartKm; // 50
float bottomBlendDistanceKm; // 54
float bottomBlendStartKm; // 58
float windScale; // 5C
float density; // 60
float coverage; // 64
float alphaAdd; // 68
float alphaMultiply; // 6C
REX::W32::XMCOLOR tint; // 70
bool enableEditorRendering; // 74
};
static_assert(sizeof(CloudLayer) == 0x78);

struct CloudPlane
{
public:
// members
BSFixedString name; // 00
BSFixedString colorTexture; // 08
BSFixedString thicknessTexture; // 10
BSFixedString normalTexture; // 18
BSFixedString opacityTexture; // 20
float elevationKm; // 28
float fadeStartKm; // 2C
float fadeDistanceKm; // 30
float thickness; // 34
float textureShadowOffset; // 38
float textureShadowStrength; // 3C
float normalShadowStrength; // 40
float tilingPerKm; // 44
float windScale; // 48
float density; // 4C
float coverage; // 50
float alphaAdd; // 54
float alphaMultiply; // 58
DirectX::XMCOLOR tint; // 5C
bool enableEditorRendering; // 60
BSFixedString name; // 00
BSFixedString colorTexture; // 08
BSFixedString thicknessTexture; // 10
BSFixedString normalTexture; // 18
BSFixedString opacityTexture; // 20
float elevationKm; // 28
float fadeStartKm; // 2C
float fadeDistanceKm; // 30
float thickness; // 34
float textureShadowOffset; // 38
float textureShadowStrength; // 3C
float normalShadowStrength; // 40
float tilingPerKm; // 44
float windScale; // 48
float density; // 4C
float coverage; // 50
float alphaAdd; // 54
float alphaMultiply; // 58
REX::W32::XMCOLOR tint; // 5C
bool enableEditorRendering; // 60
};
static_assert(sizeof(CloudPlane) == 0x68);

Expand Down
24 changes: 13 additions & 11 deletions include/RE/B/BGSFogVolumeForm.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

#include "RE/B/BGSReflectedForm.h"

#include "REX/W32/D3D.h"

namespace RE
{
class BGSFogVolumeForm : public BGSReflectedForm
Expand All @@ -13,17 +15,17 @@ namespace RE
~BGSFogVolumeForm() override; // 00

// members
DirectX::XMCOLOR albedo; // 30
float meanFreePath; // 34 - how far light can travel freely in meters [1, infinite]
float anisotropy; // 38
DirectX::XMFLOAT3 emittance; // 3C
float edgeFalloffStart; // 48
float edgeFalloffEnd; // 4C
float noiseContribution; // 50
float noiseScale; // 54
float noiseBias; // 58
DirectX::XMFLOAT3 noiseScrollingVelocity; // 5C
std::uint32_t pad68; // 68
REX::W32::XMCOLOR albedo; // 30
float meanFreePath; // 34 - how far light can travel freely in meters [1, infinite]
float anisotropy; // 38
REX::W32::XMFLOAT3 emittance; // 3C
float edgeFalloffStart; // 48
float edgeFalloffEnd; // 4C
float noiseContribution; // 50
float noiseScale; // 54
float noiseBias; // 58
REX::W32::XMFLOAT3 noiseScrollingVelocity; // 5C
std::uint32_t pad68; // 68
};
static_assert(sizeof(BGSFogVolumeForm) == 0x70);
}
4 changes: 3 additions & 1 deletion include/RE/B/BGSForceData.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

#include "RE/B/BGSReflectedForm.h"

#include "REX/W32/D3D.h"

namespace RE
{
class BGSCurveForm;
Expand Down Expand Up @@ -36,7 +38,7 @@ namespace RE
float verticalAngle; // 3C
float speed; // 40
float strength; // 44
DirectX::XMFLOAT3 vector; // 48
REX::W32::XMFLOAT3 vector; // 48
BGSCurveForm* falloffCurve; // 58
float turbulenceSpeedAmplitude; // 60
float turbulenceSpeedFrequency; // 64
Expand Down
28 changes: 15 additions & 13 deletions include/RE/B/BGSSunPresetForm.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

#include "RE/B/BGSReflectedForm.h"

#include "REX/W32/D3D.h"

namespace RE::BSGalaxy
{
class BGSSunPresetForm : public BGSReflectedForm
Expand All @@ -12,30 +14,30 @@ namespace RE::BSGalaxy

struct alignas(4) DawnDuskSettings
{
DirectX::XMFLOAT4 directionalColor; // 00
float transitionStartAngle; // 10
float transitionEndAngle; // 14
REX::W32::XMFLOAT4 directionalColor; // 00
float transitionStartAngle; // 10
float transitionEndAngle; // 14
};
static_assert(sizeof(DawnDuskSettings) == 0x18);

struct alignas(4) NightSettings
{
DirectX::XMFLOAT4 directionalColor; // 00
float directionalIlluminance; // 10
DirectX::XMFLOAT4 glareColor; // 14
REX::W32::XMFLOAT4 directionalColor; // 00
float directionalIlluminance; // 10
REX::W32::XMFLOAT4 glareColor; // 14
};
static_assert(sizeof(NightSettings) == 0x24);

~BGSSunPresetForm() override; // 00

// members
BGSSunPresetForm* parent; // 30
DirectX::XMFLOAT4 sunColor; // 38
float sunIlluminance; // 48
DirectX::XMFLOAT4 sunGlareColor; // 4C
DawnDuskSettings dawnDuskPreset; // 5C
NightSettings nightPreset; // 74
std::uint64_t unk98; // 98
BGSSunPresetForm* parent; // 30
REX::W32::XMFLOAT4 sunColor; // 38
float sunIlluminance; // 48
REX::W32::XMFLOAT4 sunGlareColor; // 4C
DawnDuskSettings dawnDuskPreset; // 5C
NightSettings nightPreset; // 74
std::uint64_t unk98; // 98
};
static_assert(sizeof(BGSSunPresetForm) == 0xA0);
}
4 changes: 3 additions & 1 deletion include/RE/B/BSBlendable.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#pragma once

#include "REX/W32/D3D.h"

namespace RE::BSBlendable
{
enum class BlendOp
Expand All @@ -15,7 +17,7 @@ namespace RE::BSBlendable
public:
// members
stl::enumeration<BlendOp, std::uint32_t> op; // 00
DirectX::XMFLOAT4 value; // 04
REX::W32::XMFLOAT4 value; // 04
float blendAmount; // 14
};
static_assert(sizeof(ColorValue) == 0x18);
Expand Down
8 changes: 5 additions & 3 deletions include/RE/B/BSResourceEnums.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#pragma once

#include "REX/W32/BASE.h"

namespace RE::BSResource
{
enum class ErrorCode : std::uint32_t
Expand Down Expand Up @@ -48,9 +50,9 @@ namespace RE::BSResource
{
public:
// members
WinAPI::FILETIME modifyTime; // 00
WinAPI::FILETIME createTime; // 08
std::uint64_t fileSize; // 10
REX::W32::FILETIME modifyTime; // 00
REX::W32::FILETIME createTime; // 08
std::uint64_t fileSize; // 10
};
static_assert(sizeof(Info) == 0x18);
}
4 changes: 3 additions & 1 deletion include/RE/I/idLogging.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#pragma once

#include "REX/W32/KERNEL32.h"

namespace RE
{
namespace idLogging
Expand Down Expand Up @@ -77,7 +79,7 @@ namespace RE
break;
}
snprintf(outputString, 1024, "%s: %s - [%s (%d)]\n", severitystr, msg, a_fileName, a_line_number);
WinAPI::OutputDebugString(outputString);
REX::W32::OutputDebugStringA(outputString);
}
};
}
14 changes: 8 additions & 6 deletions include/RE/I/idTCP.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#pragma once

#include "REX/W32/WS2_32.h"

namespace RE
{
enum class netadrtype_t
Expand All @@ -19,8 +21,8 @@ namespace RE
static_assert(sizeof(netadr_t) == 0xC);

const char* NET_ErrorString(void);
void Net_SockadrToNetadr(WinAPI::sockaddr* s, netadr_t* a); // They violated the naming convention here :(
bool NET_WaitForData(std::uintptr_t socket, std::uint32_t timeoutMs);
void Net_SockadrToNetadr(REX::W32::sockaddr* a_socket, netadr_t* a_addr); // They violated the naming convention here :(
bool NET_WaitForData(std::uintptr_t a_socket, std::uint32_t a_timeoutMs);
void Sys_InitNetworking();

class idTCP
Expand All @@ -30,11 +32,11 @@ namespace RE

virtual ~idTCP(); // 00

bool Listen(std::uint16_t port, bool blocking); // 'blocking' is ignored
bool Accept(const idTCP& listener);
bool Listen(std::uint16_t a_port, bool a_blocking); // 'blocking' is ignored
bool Accept(const idTCP& a_listener);
std::int32_t Close();
std::int32_t Read(void* buffer, std::uint32_t size);
std::int32_t Write(const void* buffer, std::uint32_t size, std::uint32_t timeoutMs);
std::int32_t Read(void* a_buffer, std::uint32_t a_size);
std::int32_t Write(const void* a_buffer, std::uint32_t a_size, std::uint32_t a_timeoutMs);

// members
netadr_t address; // 08
Expand Down
Loading

0 comments on commit 61d8e46

Please sign in to comment.