mirror of
https://github.com/isledecomp/isle.git
synced 2025-03-21 20:30:06 -04:00
Fixes for building isle with mingw on Linux (#410)
* Add LEGO1.DLL resources * Rename smack files to lowercase This fixes casing issues with mingw on Linux Also use double quotes for #error * cmake: dxguid must come after dinput * cmake: create LEGO1.DLL instead of libLEGO1.DLL, when using mingw * act3actor.h was not including mxcore.h, and using incorrect override * g_mcoreCount seem to be signed integers * LegoCameraController: return references to static data in stub functions * Include string.h, stdlib.h and stdio.h for use of libc functions * Override MxAtomId::operator!= * Fix use of STL's std::map + std::vector * Fix template functions for mingw * iterator object is used after the for loop * IDirectDrawSurface::BltFast's first 2 arguments are x/y coordinates, not pointers * Add stub ViewLODListManager::Lookup * Fixes * Format * Remove unnecessary COMPAT_CONST use --------- Co-authored-by: Christian Semmler <mail@csemmler.com>
This commit is contained in:
parent
dac2a517c3
commit
dc3500f631
35 changed files with 114 additions and 24 deletions
3rdparty
CMakeLists.txtLEGO1
act3actor.hdefine.cppdefine.hlegocameracontroller.cpplegoeventnotificationparam.hlegogamestate.cpplegogamestate.hmxatomid.hmxcore.cppmxlist.hmxqueue.h
mxstl
mxstreamlist.cppmxstreamlist.hmxtransitionmanager.cppres
arrow.curbusy.curleaf_0.curleaf_1.curleaf_2.curleaf_3.curleaf_4.curleaf_5.curleaf_6.curleaf_7.curlego1.rcresource.h
viewmanager
util
2
3rdparty/flic/flic.h
vendored
2
3rdparty/flic/flic.h
vendored
|
@ -33,4 +33,4 @@ typedef struct {
|
|||
BYTE reserved3[40]; /* Set to zero */
|
||||
} FLIC_HEADER;
|
||||
|
||||
#endif FLIC_H // FLIC_H
|
||||
#endif // FLIC_H
|
||||
|
|
2
3rdparty/smack/RAD.H → 3rdparty/smack/rad.h
vendored
2
3rdparty/smack/RAD.H → 3rdparty/smack/rad.h
vendored
|
@ -82,7 +82,7 @@
|
|||
#endif
|
||||
|
||||
#if !defined(__RADDOS__) && !defined(__RADWIN__) && !defined(__RADMAC__)
|
||||
#error RAD.H didn'y detect your platform. Define __DOS__, __WINDOWS__, WIN32, macintosh, or powerc.
|
||||
#error "RAD.H didn'y detect your platform. Define __DOS__, __WINDOWS__, WIN32, macintosh, or powerc."
|
||||
#endif
|
||||
|
||||
#ifdef __RADMAC__
|
|
@ -207,6 +207,7 @@ add_library(lego1 SHARED
|
|||
LEGO1/realtime/realtimeview.cpp
|
||||
LEGO1/realtime/vector.cpp
|
||||
LEGO1/registrationbook.cpp
|
||||
LEGO1/res/lego1.rc
|
||||
LEGO1/score.cpp
|
||||
LEGO1/scorestate.cpp
|
||||
LEGO1/skateboard.cpp
|
||||
|
@ -254,10 +255,11 @@ endif()
|
|||
target_link_directories(lego1 PRIVATE "${CMAKE_SOURCE_DIR}/3rdparty/smack")
|
||||
|
||||
# Link libraries
|
||||
target_link_libraries(lego1 PRIVATE ddraw dsound dxguid dinput winmm d3drm smack)
|
||||
target_link_libraries(lego1 PRIVATE ddraw dsound dinput dxguid winmm d3drm smack)
|
||||
|
||||
# Make sure filenames are ALL CAPS
|
||||
set_property(TARGET lego1 PROPERTY OUTPUT_NAME LEGO1)
|
||||
set_property(TARGET lego1 PROPERTY PREFIX "")
|
||||
set_property(TARGET lego1 PROPERTY SUFFIX ".DLL")
|
||||
|
||||
if (ISLE_BUILD_APP)
|
||||
|
|
|
@ -1,12 +1,14 @@
|
|||
#ifndef ACT3ACTOR_H
|
||||
#define ACT3ACTOR_H
|
||||
|
||||
#include "mxcore.h"
|
||||
|
||||
// FIXME: Uncertain location. There are three vtables which eventually call this
|
||||
// class' ClassName() function, but none of them call it directly.
|
||||
class Act3Actor : public MxCore {
|
||||
public:
|
||||
// FUNCTION: LEGO1 0x100431b0
|
||||
inline virtual const char* ClassName() override
|
||||
inline virtual const char* ClassName() const override
|
||||
{
|
||||
// STRING: LEGO1 0x100f03ac
|
||||
return "Act3Actor";
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#include "define.h"
|
||||
|
||||
// GLOBAL: LEGO1 0x1010141c
|
||||
MxU32 g_mxcoreCount[101] = {0, -6643, -5643, -5058, -4643, -4321, -4058, -3836, -3643, -3473, -3321, -3184, -3058,
|
||||
MxS32 g_mxcoreCount[101] = {0, -6643, -5643, -5058, -4643, -4321, -4058, -3836, -3643, -3473, -3321, -3184, -3058,
|
||||
-2943, -2836, -2736, -2643, -2556, -2473, -2395, -2321, -2251, -2184, -2120, -2058, -2000,
|
||||
-1943, -1888, -1836, -1785, -1736, -1689, -1643, -1599, -1556, -1514, -1473, -1434, -1395,
|
||||
-1358, -1321, -1286, -1251, -1217, -1184, -1152, -1120, -1089, -1058, -1029, -1000, -971,
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
|
||||
#include "mxtypes.h"
|
||||
|
||||
extern MxU32 g_mxcoreCount[101];
|
||||
extern MxS32 g_mxcoreCount[101];
|
||||
extern const char* g_parseExtraTokens;
|
||||
extern const char* g_strWORLD;
|
||||
extern const char* g_strSOUND;
|
||||
|
|
|
@ -25,17 +25,23 @@ void LegoCameraController::FUN_100123e0(Matrix4Data& p_transform, MxU32)
|
|||
// STUB: LEGO1 0x10012740
|
||||
Vector3Data& LegoCameraController::FUN_10012740()
|
||||
{
|
||||
return Vector3Data();
|
||||
// Actually returns reference to a member
|
||||
static Vector3Data g_v;
|
||||
return g_v;
|
||||
}
|
||||
|
||||
// STUB: LEGO1 0x100127f0
|
||||
Vector3Data& LegoCameraController::FUN_100127f0()
|
||||
{
|
||||
return Vector3Data();
|
||||
// Actually returns reference to a member
|
||||
static Vector3Data g_v;
|
||||
return g_v;
|
||||
}
|
||||
|
||||
// STUB: LEGO1 0x100128a0
|
||||
Vector3Data& LegoCameraController::FUN_100128a0()
|
||||
{
|
||||
return Vector3Data();
|
||||
// Actually returns reference to a member
|
||||
static Vector3Data g_v;
|
||||
return g_v;
|
||||
}
|
||||
|
|
|
@ -4,6 +4,8 @@
|
|||
#include "mxnotificationparam.h"
|
||||
#include "mxtypes.h"
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
// VTABLE: LEGO1 0x100d6aa0
|
||||
class LegoEventNotificationParam : public MxNotificationParam {
|
||||
public:
|
||||
|
|
|
@ -9,6 +9,8 @@
|
|||
#include "mxstring.h"
|
||||
#include "mxvariabletable.h"
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
// Based on the highest dword offset (0x42c) referenced in the constructor.
|
||||
// There may be other members that come after.
|
||||
DECOMP_SIZE_ASSERT(LegoGameState, 0x430)
|
||||
|
@ -217,7 +219,7 @@ MxBool ROIHandlerFunction(char* p_input, char* p_output, MxU32 p_copyLen)
|
|||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x1003bbb0
|
||||
LegoState* LegoGameState::GetState(COMPAT_CONST char* p_stateName)
|
||||
LegoState* LegoGameState::GetState(const char* p_stateName)
|
||||
{
|
||||
for (MxS32 i = 0; i < m_stateCount; ++i)
|
||||
if (m_stateArray[i]->IsA(p_stateName))
|
||||
|
@ -226,7 +228,7 @@ LegoState* LegoGameState::GetState(COMPAT_CONST char* p_stateName)
|
|||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x1003bc00
|
||||
LegoState* LegoGameState::CreateState(COMPAT_CONST char* p_stateName)
|
||||
LegoState* LegoGameState::CreateState(const char* p_stateName)
|
||||
{
|
||||
LegoState* newState = (LegoState*) ObjectFactory()->Create(p_stateName);
|
||||
RegisterState(newState);
|
||||
|
|
|
@ -27,8 +27,8 @@ public:
|
|||
__declspec(dllexport) void SerializeScoreHistory(MxS16 p_flags);
|
||||
__declspec(dllexport) void SetSavePath(char*);
|
||||
|
||||
LegoState* GetState(COMPAT_CONST char* p_stateName);
|
||||
LegoState* CreateState(COMPAT_CONST char* p_stateName);
|
||||
LegoState* GetState(const char* p_stateName);
|
||||
LegoState* CreateState(const char* p_stateName);
|
||||
|
||||
void GetFileSavePath(MxString* p_outPath, MxULong p_slotn);
|
||||
void FUN_1003a720(MxU32);
|
||||
|
|
|
@ -20,6 +20,7 @@ public:
|
|||
MxAtomId() { this->m_internal = 0; }
|
||||
|
||||
inline MxBool operator==(const MxAtomId& p_atomId) const { return this->m_internal == p_atomId.m_internal; }
|
||||
inline MxBool operator!=(const MxAtomId& p_atomId) const { return this->m_internal != p_atomId.m_internal; }
|
||||
|
||||
void Clear();
|
||||
|
||||
|
|
|
@ -11,7 +11,7 @@ MxResult MxCore::Tickle()
|
|||
// FUNCTION: LEGO1 0x100ae1a0
|
||||
MxCore::MxCore()
|
||||
{
|
||||
m_id = g_mxcoreCount[0];
|
||||
m_id = (MxU32) g_mxcoreCount[0];
|
||||
g_mxcoreCount[0]++;
|
||||
}
|
||||
|
||||
|
|
|
@ -76,7 +76,10 @@ public:
|
|||
|
||||
static void Destroy(T* p_obj) { delete p_obj; };
|
||||
|
||||
void SetOwnership(MxBool p_ownership) { SetDestroy(p_ownership ? Destroy : MxCollection<T*>::Destroy); }
|
||||
void SetOwnership(MxBool p_ownership)
|
||||
{
|
||||
MxCollection<T*>::SetDestroy(p_ownership ? MxPtrList<T>::Destroy : MxCollection<T*>::Destroy);
|
||||
}
|
||||
};
|
||||
|
||||
template <class T>
|
||||
|
|
|
@ -13,10 +13,10 @@ public:
|
|||
|
||||
MxBool Dequeue(T& p_obj)
|
||||
{
|
||||
MxBool hasNext = (m_first != NULL);
|
||||
if (m_first) {
|
||||
p_obj = m_first->GetValue();
|
||||
DeleteEntry(m_first);
|
||||
MxBool hasNext = (this->m_first != NULL);
|
||||
if (this->m_first) {
|
||||
p_obj = this->m_first->GetValue();
|
||||
this->DeleteEntry(this->m_first);
|
||||
}
|
||||
|
||||
return hasNext;
|
||||
|
|
|
@ -10,9 +10,13 @@
|
|||
#else
|
||||
#include <algorithm>
|
||||
#include <list>
|
||||
#include <map>
|
||||
#include <set>
|
||||
#include <vector>
|
||||
using std::list;
|
||||
using std::map;
|
||||
using std::set;
|
||||
using std::vector;
|
||||
#endif
|
||||
|
||||
#endif // STLCOMPAT_H
|
||||
|
|
|
@ -26,7 +26,12 @@ MxDSAction* MxStreamListMxDSAction::Find(MxDSAction* p_action, MxBool p_delete)
|
|||
|
||||
MxDSAction* found = NULL;
|
||||
|
||||
#ifdef COMPAT_MODE
|
||||
iterator it;
|
||||
for (it = begin(); it != end(); it++) {
|
||||
#else
|
||||
for (iterator it = begin(); it != end(); it++) {
|
||||
#endif
|
||||
if (p_action->GetObjectId() == -1 || p_action->GetObjectId() == (*it)->GetObjectId()) {
|
||||
if (p_action->GetUnknown24() == -2 || p_action->GetUnknown24() == -3 ||
|
||||
p_action->GetUnknown24() == (*it)->GetUnknown24()) {
|
||||
|
|
|
@ -11,11 +11,11 @@ class MxStreamList : public list<T> {
|
|||
public:
|
||||
MxBool PopFront(T& p_obj)
|
||||
{
|
||||
if (empty())
|
||||
if (this->empty())
|
||||
return FALSE;
|
||||
|
||||
p_obj = front();
|
||||
pop_front();
|
||||
p_obj = this->front();
|
||||
this->pop_front();
|
||||
return TRUE;
|
||||
}
|
||||
};
|
||||
|
|
|
@ -229,7 +229,7 @@ void MxTransitionManager::TransitionDissolve()
|
|||
|
||||
if (VideoManager()->GetVideoParam().Flags().GetFlipSurfaces()) {
|
||||
LPDIRECTDRAWSURFACE surf = VideoManager()->GetDisplaySurface()->GetDirectDrawSurface1();
|
||||
surf->BltFast(NULL, NULL, m_ddSurface, &g_fullScreenRect, DDBLTFAST_WAIT);
|
||||
surf->BltFast(0, 0, m_ddSurface, &g_fullScreenRect, DDBLTFAST_WAIT);
|
||||
}
|
||||
|
||||
m_animationTimer++;
|
||||
|
@ -346,7 +346,7 @@ void MxTransitionManager::TransitionPixelation()
|
|||
|
||||
if (VideoManager()->GetVideoParam().Flags().GetFlipSurfaces()) {
|
||||
LPDIRECTDRAWSURFACE surf = VideoManager()->GetDisplaySurface()->GetDirectDrawSurface1();
|
||||
surf->BltFast(NULL, NULL, m_ddSurface, &g_fullScreenRect, DDBLTFAST_WAIT);
|
||||
surf->BltFast(0, 0, m_ddSurface, &g_fullScreenRect, DDBLTFAST_WAIT);
|
||||
}
|
||||
|
||||
m_animationTimer++;
|
||||
|
|
BIN
LEGO1/res/arrow.cur
Normal file
BIN
LEGO1/res/arrow.cur
Normal file
Binary file not shown.
After (image error) Size: 326 B |
BIN
LEGO1/res/busy.cur
Normal file
BIN
LEGO1/res/busy.cur
Normal file
Binary file not shown.
After (image error) Size: 326 B |
BIN
LEGO1/res/leaf_0.cur
Normal file
BIN
LEGO1/res/leaf_0.cur
Normal file
Binary file not shown.
After (image error) Size: 766 B |
BIN
LEGO1/res/leaf_1.cur
Normal file
BIN
LEGO1/res/leaf_1.cur
Normal file
Binary file not shown.
After (image error) Size: 766 B |
BIN
LEGO1/res/leaf_2.cur
Normal file
BIN
LEGO1/res/leaf_2.cur
Normal file
Binary file not shown.
After (image error) Size: 766 B |
BIN
LEGO1/res/leaf_3.cur
Normal file
BIN
LEGO1/res/leaf_3.cur
Normal file
Binary file not shown.
After (image error) Size: 766 B |
BIN
LEGO1/res/leaf_4.cur
Normal file
BIN
LEGO1/res/leaf_4.cur
Normal file
Binary file not shown.
After (image error) Size: 766 B |
BIN
LEGO1/res/leaf_5.cur
Normal file
BIN
LEGO1/res/leaf_5.cur
Normal file
Binary file not shown.
After (image error) Size: 766 B |
BIN
LEGO1/res/leaf_6.cur
Normal file
BIN
LEGO1/res/leaf_6.cur
Normal file
Binary file not shown.
After (image error) Size: 766 B |
BIN
LEGO1/res/leaf_7.cur
Normal file
BIN
LEGO1/res/leaf_7.cur
Normal file
Binary file not shown.
After (image error) Size: 766 B |
39
LEGO1/res/lego1.rc
Normal file
39
LEGO1/res/lego1.rc
Normal file
|
@ -0,0 +1,39 @@
|
|||
#include "resource.h"
|
||||
|
||||
LEGO1_LEAF4 CURSOR "leaf_4.cur"
|
||||
LEGO1_LEAF7 CURSOR "leaf_7.cur"
|
||||
LEGO1_LEAF1 CURSOR "leaf_1.cur"
|
||||
LEGO1_LEAF2 CURSOR "leaf_2.cur"
|
||||
LEGO1_LEAF6 CURSOR "leaf_6.cur"
|
||||
LEGO1_LEAF0 CURSOR "leaf_0.cur"
|
||||
LEGO1_LEAF5 CURSOR "leaf_5.cur"
|
||||
LEGO1_LEAF3 CURSOR "leaf_3.cur"
|
||||
LEGO1_ARROW CURSOR "arrow.cur"
|
||||
LEGO1_BUSY CURSOR "busy.cur"
|
||||
|
||||
1 VERSIONINFO
|
||||
FILEVERSION 1,1,0,0
|
||||
PRODUCTVERSION 1,1,0,0
|
||||
FILEOS 0x40004
|
||||
FILETYPE 0x2
|
||||
{
|
||||
BLOCK "StringFileInfo"
|
||||
{
|
||||
BLOCK "040904b0"
|
||||
{
|
||||
VALUE "CompanyName", "Mindscape, Inc."
|
||||
VALUE "FileDescription", "LegoOmni Library"
|
||||
VALUE "FileVersion", "1, 1, 0, 0"
|
||||
VALUE "InternalName", "LegoOmni Library"
|
||||
VALUE "LegalCopyright", "Copyright \xA9 1997"
|
||||
VALUE "OriginalFilename", "LegoOmni Library"
|
||||
VALUE "ProductName", "LegoOmni Library"
|
||||
VALUE "ProductVersion", "1, 1, 0, 0"
|
||||
}
|
||||
}
|
||||
|
||||
BLOCK "VarFileInfo"
|
||||
{
|
||||
VALUE "Translation", 0x0409, 0x04B0
|
||||
}
|
||||
}
|
12
LEGO1/res/resource.h
Normal file
12
LEGO1/res/resource.h
Normal file
|
@ -0,0 +1,12 @@
|
|||
#define LEGO1_ARROW 101
|
||||
#define LEGO1_LEAF4 102
|
||||
#define LEGO1_LEAF7 103
|
||||
#define LEGO1_LEAF1 104
|
||||
#define LEGO1_LEAF2 105
|
||||
#define LEGO1_LEAF6 106
|
||||
#define LEGO1_LEAF0 107
|
||||
#define LEGO1_LEAF5 108
|
||||
#define LEGO1_LEAF3 109
|
||||
#define LEGO1_BUSY 111
|
||||
|
||||
#define APP_ICON 105
|
|
@ -42,6 +42,12 @@ ViewLODList* ViewLODListManager::Create(const ROIName& rROIName, int lodCount)
|
|||
return pLODList;
|
||||
}
|
||||
|
||||
// STUB: LEGO1 0x100a75b0
|
||||
ViewLODList* ViewLODListManager::Lookup(const ROIName&) const
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
// STUB: LEGO1 0x100a7680
|
||||
void ViewLODListManager::Destroy(ViewLODList* lodList)
|
||||
{
|
||||
|
|
|
@ -6,6 +6,8 @@
|
|||
#include "assert.h"
|
||||
#include "compat.h"
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#pragma warning(disable : 4237)
|
||||
#pragma warning(disable : 4786)
|
||||
|
||||
|
|
|
@ -3,6 +3,10 @@
|
|||
|
||||
// Various macros to enable compiling with other/newer compilers.
|
||||
|
||||
#ifdef __MINGW32__
|
||||
#define COMPAT_MODE
|
||||
#endif
|
||||
|
||||
// Use `COMPAT_CONST` where something ought to be 'const', and a newer compiler would complain if it
|
||||
// wasn't, but we know it isn't 'const' in the original code.
|
||||
#ifdef __MINGW32__
|
||||
|
|
Loading…
Reference in a new issue