Backports of isle-portable x64 fixes (#1044)

* Introduce LPD3DRM_APPDATA typedef for setting d3drm appdata

* Fix warning about assigning const string literals to variable char pointers

* Don't cast pointers to integers on non-32-bit architectures

* memset 2nd argument is int

* Assume cpuid is available on x86_64, needs testing on i386 and unavailable on anything else

* Store HFILE in its own member variable
This commit is contained in:
Anonymous Maarten
2024-06-25 17:56:30 +02:00
committed by GitHub
parent 62307e1819
commit 8113a17167
13 changed files with 115 additions and 57 deletions

View File

@@ -96,7 +96,7 @@ class LegoAnimationManager : public MxCore {
public:
// SIZE 0x18
struct Character {
char* m_name; // 0x00
const char* m_name; // 0x00
MxBool m_inExtras; // 0x04
MxS8 m_vehicleId; // 0x05
undefined m_unk0x06; // 0x06 (unused?)
@@ -112,9 +112,9 @@ public:
// SIZE 0x08
struct Vehicle {
char* m_name; // 0x00
MxBool m_unk0x04; // 0x04
MxBool m_unk0x05; // 0x05
const char* m_name; // 0x00
MxBool m_unk0x04; // 0x04
MxBool m_unk0x05; // 0x05
};
// SIZE 0x18

View File

@@ -7,17 +7,23 @@
#include "mxstl/stlcompat.h"
#include "mxtypes.h"
#if defined(_M_IX86) || defined(__i386__)
#define COMPARE_POINTER_TYPE MxS32
#else
#define COMPARE_POINTER_TYPE MxS32*
#endif
struct LegoPathActorSetCompare {
MxU32 operator()(const LegoPathActor* p_lhs, const LegoPathActor* p_rhs) const
{
return (MxS32) p_lhs < (MxS32) p_rhs;
return (COMPARE_POINTER_TYPE) p_lhs < (COMPARE_POINTER_TYPE) p_rhs;
}
};
struct LegoAnimPresenterSetCompare {
MxBool operator()(const LegoAnimPresenter* p_lhs, const LegoAnimPresenter* p_rhs) const
{
return (MxS32) p_lhs < (MxS32) p_rhs;
return (COMPARE_POINTER_TYPE) p_lhs < (COMPARE_POINTER_TYPE) p_rhs;
}
};

View File

@@ -14,6 +14,12 @@ class LegoWorld;
class MxAtomId;
class Vector3;
#if defined(_M_IX86) || defined(__i386__)
#define COMPARE_POINTER_TYPE MxS32
#else
#define COMPARE_POINTER_TYPE MxS32*
#endif
// VTABLE: LEGO1 0x100d7da8
// SIZE 0x40
struct LegoPathCtrlEdge : public LegoUnknown100db7f4 {};
@@ -21,7 +27,7 @@ struct LegoPathCtrlEdge : public LegoUnknown100db7f4 {};
struct LegoPathCtrlEdgeCompare {
MxU32 operator()(const LegoPathCtrlEdge* p_lhs, const LegoPathCtrlEdge* p_rhs) const
{
return (MxS32) p_lhs < (MxS32) p_rhs;
return (COMPARE_POINTER_TYPE) p_lhs < (COMPARE_POINTER_TYPE) p_rhs;
}
};

View File

@@ -12,8 +12,17 @@ class LegoEntityList;
class LegoPathBoundary;
class LegoHideAnimPresenter;
#if defined(_M_IX86) || defined(__i386__)
#define COMPARE_POINTER_TYPE MxS32
#else
#define COMPARE_POINTER_TYPE MxS32*
#endif
struct CoreSetCompare {
MxS32 operator()(MxCore* const& p_a, MxCore* const& p_b) const { return (MxS32) p_a < (MxS32) p_b; }
MxS32 operator()(MxCore* const& p_a, MxCore* const& p_b) const
{
return (COMPARE_POINTER_TYPE) p_a < (COMPARE_POINTER_TYPE) p_b;
}
};
typedef set<MxCore*, CoreSetCompare> MxCoreSet;

View File

@@ -15,9 +15,9 @@ DECOMP_SIZE_ASSERT(HistoryBook, 0x3e4)
// FUNCTION: LEGO1 0x100822f0
HistoryBook::HistoryBook()
{
memset(m_alphabet, NULL, sizeof(m_alphabet));
memset(m_names, NULL, sizeof(m_names));
memset(m_scores, NULL, sizeof(m_scores));
memset(m_alphabet, 0, sizeof(m_alphabet));
memset(m_names, 0, sizeof(m_names));
memset(m_scores, 0, sizeof(m_scores));
NotificationManager()->Register(this);
}