mirror of
https://github.com/isledecomp/isle.git
synced 2024-11-22 07:37:59 -05:00
Build fixes for mingw (#245)
This commit is contained in:
parent
4c5c709af6
commit
e928fc9425
25 changed files with 64 additions and 42 deletions
|
@ -209,6 +209,9 @@ add_library(lego1 SHARED
|
|||
LEGO1/towtrackmissionstate.cpp
|
||||
LEGO1/viewmanager.cpp
|
||||
)
|
||||
if (MINGW)
|
||||
target_compile_definitions(lego1 PRIVATE DIRECTINPUT_VERSION=0x0500)
|
||||
endif()
|
||||
|
||||
# Additional include directories for both targets
|
||||
include_directories("${CMAKE_SOURCE_DIR}/3rdparty/vec")
|
||||
|
|
|
@ -31,7 +31,8 @@ static class msVC6_4786WorkAround { public: msVC6_4786WorkAround() {} } msVC6_47
|
|||
#include <algorithm>
|
||||
#include <list>
|
||||
#include <set>
|
||||
using namespace std;
|
||||
using std::list;
|
||||
using std::set;
|
||||
#endif
|
||||
|
||||
// We use `override` so newer compilers can tell us our vtables are valid,
|
||||
|
|
|
@ -1,8 +1,13 @@
|
|||
#ifndef DECOMP_H
|
||||
#define DECOMP_H
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
#define DECOMP_STATIC_ASSERT(V) namespace { typedef int foo[(V)?1:-1]; }
|
||||
#define DECOMP_SIZE_ASSERT(T, S) DECOMP_STATIC_ASSERT(sizeof(T) == S)
|
||||
#else
|
||||
#define DECOMP_STATIC_ASSERT(V)
|
||||
#define DECOMP_SIZE_ASSERT(T, S)
|
||||
#endif
|
||||
|
||||
#ifndef _countof
|
||||
#define _countof(arr) sizeof(arr) / sizeof(arr[0])
|
||||
|
|
|
@ -192,7 +192,7 @@ void LegoGameState::SetSavePath(char *p_savePath)
|
|||
}
|
||||
|
||||
// OFFSET: LEGO1 0x1003bbb0
|
||||
LegoState *LegoGameState::GetState(char *p_stateName)
|
||||
LegoState *LegoGameState::GetState(COMPAT_CONST char *p_stateName)
|
||||
{
|
||||
for (MxS32 i = 0; i < m_stateCount; ++i)
|
||||
if (m_stateArray[i]->IsA(p_stateName))
|
||||
|
@ -201,11 +201,11 @@ LegoState *LegoGameState::GetState(char *p_stateName)
|
|||
}
|
||||
|
||||
// OFFSET: LEGO1 0x1003bc00
|
||||
LegoState *LegoGameState::CreateState(char *p_stateName)
|
||||
LegoState *LegoGameState::CreateState(COMPAT_CONST char *p_stateName)
|
||||
{
|
||||
LegoState* newState = (LegoState*)ObjectFactory()->Create(p_stateName);
|
||||
RegisterState(newState);
|
||||
|
||||
|
||||
return newState;
|
||||
}
|
||||
|
||||
|
@ -245,4 +245,4 @@ void LegoGameState::FUN_1003a720(MxU32 p_unk)
|
|||
void LegoGameState::HandleAction(MxU32 p_unk)
|
||||
{
|
||||
// TODO
|
||||
}
|
||||
}
|
||||
|
|
|
@ -29,8 +29,8 @@ class LegoGameState
|
|||
__declspec(dllexport) void SerializeScoreHistory(MxS16 p);
|
||||
__declspec(dllexport) void SetSavePath(char *p);
|
||||
|
||||
LegoState *GetState(char *p_stateName);
|
||||
LegoState *CreateState(char *p_stateName);
|
||||
LegoState *GetState(COMPAT_CONST char *p_stateName);
|
||||
LegoState *CreateState(COMPAT_CONST char *p_stateName);
|
||||
|
||||
void GetFileSavePath(MxString *p_outPath, MxULong p_slotn);
|
||||
void FUN_1003a720(MxU32 p_unk);
|
||||
|
|
|
@ -19,11 +19,10 @@ MxCore *LegoObjectFactory::Create(const char *p_name)
|
|||
{
|
||||
MxAtomId atom(p_name, LookupMode_Exact);
|
||||
|
||||
if (0) {
|
||||
#define X(V) } else if (this->m_id##V == atom) { return new V;
|
||||
#define X(V) if (this->m_id##V == atom) { return new V; } else
|
||||
FOR_LEGOOBJECTFACTORY_OBJECTS(X)
|
||||
#undef X
|
||||
} else {
|
||||
{
|
||||
return MxObjectFactory::Create(p_name);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -303,7 +303,7 @@ void LegoOmni::Init()
|
|||
}
|
||||
|
||||
// OFFSET: LEGO1 0x10058e70 STUB
|
||||
MxResult LegoOmni::Create(COMPAT_CONST MxOmniCreateParam &p)
|
||||
MxResult LegoOmni::Create(MxOmniCreateParam &p)
|
||||
{
|
||||
MxOmni::Create(p);
|
||||
|
||||
|
|
|
@ -56,7 +56,7 @@ class LegoOmni : public MxOmni
|
|||
}
|
||||
|
||||
virtual void Init() override; // vtable+14
|
||||
virtual MxResult Create(COMPAT_CONST MxOmniCreateParam &p) override; // vtable+18
|
||||
virtual MxResult Create(MxOmniCreateParam &p) override; // vtable+18
|
||||
virtual void Destroy() override; // vtable+1c
|
||||
virtual MxResult Start(MxDSAction* action) override; // vtable+20
|
||||
virtual MxResult DeleteObject(MxDSAction &ds) override; // vtable+24
|
||||
|
|
|
@ -47,7 +47,7 @@ inline void GetDouble(char **p_source, T& p_dest)
|
|||
}
|
||||
|
||||
template <class T>
|
||||
inline void GetString(char **p_source, const char *&p_dest, T *p_obj, void (T::*p_setter)(const char*))
|
||||
inline void GetString(char **p_source, const char *p_dest, T *p_obj, void (T::*p_setter)(const char*))
|
||||
{
|
||||
(p_obj->*p_setter)(*p_source);
|
||||
*p_source += strlen(p_dest) + 1;
|
||||
|
|
|
@ -27,7 +27,7 @@ class MxActionNotificationParam : public MxNotificationParam
|
|||
}
|
||||
|
||||
// OFFSET: LEGO1 0x10051050
|
||||
inline virtual MxActionNotificationParam::~MxActionNotificationParam() override
|
||||
inline virtual ~MxActionNotificationParam() override
|
||||
{
|
||||
if (!this->m_realloc)
|
||||
return;
|
||||
|
@ -58,4 +58,4 @@ class MxEndActionNotificationParam : public MxActionNotificationParam
|
|||
virtual MxNotificationParam *Clone() override; // vtable+0x4
|
||||
};
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
|
|
@ -182,7 +182,7 @@ BOOL FAR PASCAL EnumerateCallback(GUID FAR *, LPSTR, LPSTR, LPVOID)
|
|||
}
|
||||
|
||||
// OFFSET: LEGO1 0x1009c730 STUB
|
||||
char *MxDeviceEnumerate::EnumerateErrorToString(HRESULT p_error)
|
||||
const char *MxDeviceEnumerate::EnumerateErrorToString(HRESULT p_error)
|
||||
{
|
||||
// TODO: This is a list of error messages, similar to the function in
|
||||
// MxDirectDraw, except that this one now contains the Direct3D errors.
|
||||
|
|
|
@ -27,7 +27,7 @@ class MxDeviceEnumerate
|
|||
virtual MxResult _DoEnumerate();
|
||||
BOOL FUN_1009c070();
|
||||
|
||||
char *EnumerateErrorToString(HRESULT p_error);
|
||||
const char *EnumerateErrorToString(HRESULT p_error);
|
||||
|
||||
undefined4 m_unk004;
|
||||
undefined4 m_unk008;
|
||||
|
@ -75,4 +75,4 @@ class MxDirect3D : public MxDirectDraw
|
|||
|
||||
BOOL FAR PASCAL EnumerateCallback(GUID FAR *, LPSTR, LPSTR, LPVOID);
|
||||
|
||||
#endif // MXDIRECT3D_H
|
||||
#endif // MXDIRECT3D_H
|
||||
|
|
|
@ -9,7 +9,7 @@ DECOMP_SIZE_ASSERT(MxDirectDraw::DeviceModesInfo, 0x17c);
|
|||
#endif
|
||||
|
||||
// GLOBAL OFFSET: LEGO1 0x10100C68
|
||||
extern BOOL g_is_PALETTEINDEXED8 = 0;
|
||||
BOOL g_is_PALETTEINDEXED8 = 0;
|
||||
|
||||
// OFFSET: LEGO1 0x1009DA20
|
||||
void EnableResizing(HWND hwnd, BOOL flag)
|
||||
|
|
|
@ -41,7 +41,7 @@ class MxDSObject : public MxCore
|
|||
inline void SetObjectId(MxU32 p_objectId) { this->m_objectId = p_objectId; }
|
||||
inline void SetUnknown24(MxS16 p_unk24) { this->m_unk24 = p_unk24; }
|
||||
|
||||
inline char *GetSourceName() const { return this->m_sourceName; }
|
||||
inline const char *GetSourceName() const { return this->m_sourceName; }
|
||||
|
||||
inline void SetType(MxDSType p_type) { this->m_type = p_type; }
|
||||
inline MxDSType GetType() const { return (MxDSType) this->m_type; }
|
||||
|
|
|
@ -9,6 +9,9 @@
|
|||
#define HASH_TABLE_OPT_EXPAND_ADD 1
|
||||
#define HASH_TABLE_OPT_EXPAND_MULTIPLY 2
|
||||
|
||||
template <class T>
|
||||
class MxHashTableCursor;
|
||||
|
||||
template <class T>
|
||||
class MxHashTableNode
|
||||
{
|
||||
|
@ -162,13 +165,13 @@ MxHashTable<T>::~MxHashTable()
|
|||
|
||||
while (t) {
|
||||
MxHashTableNode<T> *next = t->m_next;
|
||||
m_customDestructor(t->m_obj);
|
||||
this->m_customDestructor(t->m_obj);
|
||||
delete t;
|
||||
t = next;
|
||||
}
|
||||
}
|
||||
|
||||
m_numKeys = 0;
|
||||
this->m_numKeys = 0;
|
||||
memset(m_slots, 0, sizeof(MxHashTableNode<T> *) * m_numSlots);
|
||||
|
||||
delete[] m_slots;
|
||||
|
@ -196,7 +199,7 @@ inline void MxHashTable<T>::Resize()
|
|||
// FIXME: order? m_numKeys set after `rep stosd`
|
||||
m_slots = new_table;
|
||||
memset(m_slots, 0, sizeof(MxHashTableNode<T> *) * m_numSlots);
|
||||
m_numKeys = 0;
|
||||
this->m_numKeys = 0;
|
||||
|
||||
for (int i = 0; i != old_size; i++) {
|
||||
MxHashTableNode<T> *t = old_table[i];
|
||||
|
@ -223,13 +226,13 @@ inline void MxHashTable<T>::_NodeInsert(MxHashTableNode<T> *p_node)
|
|||
m_slots[bucket]->m_prev = p_node;
|
||||
|
||||
m_slots[bucket] = p_node;
|
||||
m_numKeys++;
|
||||
this->m_numKeys++;
|
||||
}
|
||||
|
||||
template <class T>
|
||||
inline void MxHashTable<T>::Add(T* p_newobj)
|
||||
{
|
||||
if (m_resizeOption && ((m_numKeys + 1) / m_numSlots) > m_autoResizeRatio)
|
||||
if (m_resizeOption && ((this->m_numKeys + 1) / m_numSlots) > m_autoResizeRatio)
|
||||
MxHashTable<T>::Resize();
|
||||
|
||||
MxU32 hash = Hash(p_newobj);
|
||||
|
@ -238,4 +241,4 @@ inline void MxHashTable<T>::Add(T* p_newobj)
|
|||
MxHashTable<T>::_NodeInsert(node);
|
||||
}
|
||||
|
||||
#endif // MXHASHTABLE_H
|
||||
#endif // MXHASHTABLE_H
|
||||
|
|
|
@ -4,6 +4,11 @@
|
|||
#include "mxtypes.h"
|
||||
#include "mxcore.h"
|
||||
|
||||
template <class T>
|
||||
class MxList;
|
||||
template <class T>
|
||||
class MxListCursor;
|
||||
|
||||
template <class T>
|
||||
class MxListEntry
|
||||
{
|
||||
|
@ -64,7 +69,7 @@ class MxList : protected MxListParent<T>
|
|||
void Append(T);
|
||||
void OtherAppend(T p_obj) { _InsertEntry(p_obj, this->m_last, NULL); };
|
||||
void DeleteAll();
|
||||
MxU32 GetCount() { return m_count; }
|
||||
MxU32 GetCount() { return this->m_count; }
|
||||
void SetDestroy(void (*p_customDestructor)(T)) { this->m_customDestructor = p_customDestructor; }
|
||||
|
||||
friend class MxListCursor<T>;
|
||||
|
@ -128,12 +133,12 @@ inline void MxList<T>::DeleteAll()
|
|||
break;
|
||||
|
||||
MxListEntry<T> *next = t->m_next;
|
||||
m_customDestructor(t->GetValue());
|
||||
this->m_customDestructor(t->GetValue());
|
||||
delete t;
|
||||
t = next;
|
||||
}
|
||||
|
||||
m_count = 0;
|
||||
this->m_count = 0;
|
||||
m_last = NULL;
|
||||
m_first = NULL;
|
||||
}
|
||||
|
@ -188,7 +193,7 @@ inline void MxList<T>::_DeleteEntry(MxListEntry<T> *match)
|
|||
m_last = *pPrev;
|
||||
|
||||
delete match;
|
||||
m_count--;
|
||||
this->m_count--;
|
||||
}
|
||||
|
||||
template <class T>
|
||||
|
|
|
@ -27,8 +27,8 @@ void MxMusicManager::DeinitializeMIDI()
|
|||
{
|
||||
m_MIDIInitialized = FALSE;
|
||||
midiStreamStop(m_MIDIStreamH);
|
||||
midiOutUnprepareHeader(m_MIDIStreamH, m_MIDIHdrP, sizeof(MIDIHDR));
|
||||
midiOutSetVolume(m_MIDIStreamH, m_MIDIVolume);
|
||||
midiOutUnprepareHeader((HMIDIOUT)m_MIDIStreamH, m_MIDIHdrP, sizeof(MIDIHDR));
|
||||
midiOutSetVolume((HMIDIOUT)m_MIDIStreamH, m_MIDIVolume);
|
||||
midiStreamClose(m_MIDIStreamH);
|
||||
delete m_MIDIHdrP;
|
||||
InitData();
|
||||
|
@ -106,7 +106,7 @@ void MxMusicManager::SetMIDIVolume()
|
|||
if (streamHandle)
|
||||
{
|
||||
MxS32 volume = CalculateVolume(result);
|
||||
midiOutSetVolume(streamHandle, volume);
|
||||
midiOutSetVolume((HMIDIOUT)streamHandle, volume);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -35,8 +35,6 @@ MxCore *MxObjectFactory::Create(const char *p_name)
|
|||
#define X(V) else if (this->m_id##V == atom) { object = new V; }
|
||||
FOR_MXOBJECTFACTORY_OBJECTS(X)
|
||||
#undef X
|
||||
else {}
|
||||
|
||||
return object;
|
||||
}
|
||||
|
||||
|
|
|
@ -40,7 +40,7 @@ class MxOmni : public MxCore
|
|||
|
||||
virtual MxLong Notify(MxParam &p) override; // vtable+04
|
||||
virtual void Init(); // vtable+14
|
||||
virtual MxResult Create(COMPAT_CONST MxOmniCreateParam &p); // vtable+18
|
||||
virtual MxResult Create(MxOmniCreateParam &p); // vtable+18
|
||||
virtual void Destroy(); // vtable+1c
|
||||
virtual MxResult Start(MxDSAction *p_dsAction); // vtable+20
|
||||
virtual MxResult DeleteObject(MxDSAction &p_dsAction); // vtable+24
|
||||
|
|
|
@ -17,6 +17,7 @@ class MxOmniCreateParam : public MxParam
|
|||
const MxString& GetMediaPath() const { return m_mediaPath; }
|
||||
const HWND GetWindowHandle() const { return m_windowHandle; }
|
||||
MxVideoParam& GetVideoParam() { return m_videoParam; }
|
||||
const MxVideoParam& GetVideoParam() const { return m_videoParam; }
|
||||
|
||||
private:
|
||||
MxString m_mediaPath;
|
||||
|
|
|
@ -164,9 +164,9 @@ void MxPresenter::Enable(MxBool p_enable)
|
|||
}
|
||||
|
||||
// OFFSET: LEGO1 0x100b5310
|
||||
char *PresenterNameDispatch(const MxDSAction &p_action)
|
||||
const char *PresenterNameDispatch(const MxDSAction &p_action)
|
||||
{
|
||||
char *name = p_action.GetSourceName();
|
||||
const char *name = p_action.GetSourceName();
|
||||
MxS32 format;
|
||||
|
||||
if (!name || strlen(name) == 0) {
|
||||
|
|
|
@ -87,6 +87,6 @@ class MxPresenter : public MxCore
|
|||
MxPresenter *m_unkPresenter; // 0x3c
|
||||
};
|
||||
|
||||
char *PresenterNameDispatch(const MxDSAction &);
|
||||
const char *PresenterNameDispatch(const MxDSAction &);
|
||||
|
||||
#endif // MXPRESENTER_H
|
||||
|
|
|
@ -104,7 +104,8 @@ void MxTransitionManager::Transition_Dissolve()
|
|||
// If we are starting the animation
|
||||
if (m_animationTimer == 0) {
|
||||
// Generate the list of columns in order...
|
||||
for (MxS32 i = 0; i < 640; i++) {
|
||||
MxS32 i;
|
||||
for (i = 0; i < 640; i++) {
|
||||
m_columnOrder[i] = i;
|
||||
}
|
||||
|
||||
|
@ -242,7 +243,8 @@ void MxTransitionManager::Transition_Pixelation()
|
|||
if (m_animationTimer == 0) {
|
||||
// Same init/shuffle steps as the dissolve transition, except that
|
||||
// we are using big blocky pixels and only need 64 columns.
|
||||
for (MxS32 i = 0; i < 64; i++) {
|
||||
MxS32 i;
|
||||
for (i = 0; i < 64; i++) {
|
||||
m_columnOrder[i] = i;
|
||||
}
|
||||
|
||||
|
|
|
@ -7,8 +7,13 @@ typedef unsigned short MxU16;
|
|||
typedef signed short MxS16;
|
||||
typedef unsigned int MxU32;
|
||||
typedef signed int MxS32;
|
||||
#ifdef _MSC_VER
|
||||
typedef unsigned __int64 MxU64;
|
||||
typedef signed __int64 MxS64;
|
||||
#else
|
||||
typedef unsigned long long int MxU64;
|
||||
typedef signed long long int MxS64;
|
||||
#endif
|
||||
typedef float MxFloat;
|
||||
typedef double MxDouble;
|
||||
|
||||
|
|
|
@ -27,7 +27,7 @@ class Pizza : public IsleActor
|
|||
}
|
||||
|
||||
// OFFSET: LEGO1 0x10037fa0
|
||||
inline MxBool Pizza::IsA(const char *name) const override //vtable+10
|
||||
inline MxBool IsA(const char *name) const override //vtable+10
|
||||
{
|
||||
return !strcmp(name, Pizza::ClassName()) || IsleActor::IsA(name);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue