Skip to content

Changes necessary for a 64bit build on a modern compiler (VS2019) #404

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
**/.vs
**/*.user
11 changes: 11 additions & 0 deletions Generals/Code/3rdpartysources.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
NVASM
https://web.archive.org/web/20061006093538/http://developer.nvidia.com/object/nvasm.html

GameSpy
https://github.com/GameProgressive/UniSpySDK

LZHL (under libs/_lzhl
https://github.com/mistydemeo/quickbms/tree/5752a6a2a38e16211952553fcffa59570855ac42

DirectX 8
https://github.com/edgeforce/directx8
Comment on lines +1 to +11

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With the possible exception of LZHL (which has vague licensing), these are incompatible with the GPLv3 license. That alone renders this PR unable to be merged, even if this was reviewed.

1,505 changes: 1,505 additions & 0 deletions Generals/Code/GameEngine/GameEngine.vcxproj

Large diffs are not rendered by default.

3,489 changes: 3,489 additions & 0 deletions Generals/Code/GameEngine/GameEngine.vcxproj.filters

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion Generals/Code/GameEngine/Include/Common/AsciiString.h
Original file line number Diff line number Diff line change
Expand Up @@ -366,7 +366,7 @@ inline AsciiString::~AsciiString()
inline int AsciiString::getLength() const
{
validate();
return m_data ? strlen(peek()) : 0;
return m_data ? (int)strlen(peek()) : 0;
}

// -----------------------------------------------------
Expand Down
2 changes: 1 addition & 1 deletion Generals/Code/GameEngine/Include/Common/BezierSegment.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
#ifndef __BEZIERSEGMENT_H__
#define __BEZIERSEGMENT_H__

#include <D3DX8Math.h>
#include <D3DX9Math.h>
#include "Common/STLTypeDefs.h"

#define USUAL_TOLERANCE 1.0f
Expand Down
10 changes: 5 additions & 5 deletions Generals/Code/GameEngine/Include/Common/BitFlags.h
Original file line number Diff line number Diff line change
Expand Up @@ -155,12 +155,12 @@ class BitFlags

inline Int size() const
{
return m_bits.size();
return (int)m_bits.size();
}

inline Int count() const
{
return m_bits.count();
return (int)m_bits.count();
}

inline Bool any() const
Expand All @@ -182,15 +182,15 @@ class BitFlags
{
BitFlags tmp = *this;
tmp.m_bits &= that.m_bits;
return tmp.m_bits.count();
return (int)tmp.m_bits.count();
}

inline Int countInverseIntersection(const BitFlags& that) const
{
BitFlags tmp = *this;
tmp.m_bits.flip();
tmp.m_bits &= that.m_bits;
return tmp.m_bits.count();
return (int)tmp.m_bits.count();
}

inline Bool anyIntersectionWith(const BitFlags& that) const
Expand Down Expand Up @@ -249,7 +249,7 @@ class BitFlags
Int i = 0;
for(const char** name = s_bitNameList; *name; ++name, ++i )
{
if( stricmp( *name, token ) == 0 )
if( _stricmp( *name, token ) == 0 )
{
return i;
}
Expand Down
2 changes: 1 addition & 1 deletion Generals/Code/GameEngine/Include/Common/BitFlagsIO.h
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ void BitFlags<NUMBITS>::parse(INI* ini, AsciiString* str)
str->concat(token);
}

if (stricmp(token, "NONE") == 0)
if (_stricmp(token, "NONE") == 0)
{
if (foundNormal || foundAddOrSub)
{
Expand Down
16 changes: 8 additions & 8 deletions Generals/Code/GameEngine/Include/Common/BorderColors.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,14 @@ struct BorderColor

const BorderColor BORDER_COLORS[] =
{
{ "Orange", 0xFFFF8700, },
{ "Green", 0xFF00FF00, },
{ "Blue", 0xFF0000FF, },
{ "Cyan", 0xFF00FFFF, },
{ "Magenta", 0xFFFF00FF, },
{ "Yellow", 0xFFFFFF00, },
{ "Purple", 0xFF9E00FF, },
{ "Pink", 0xFFFF8670, },
{ "Orange", (int)0xFFFF8700, },
{ "Green", (int)0xFF00FF00, },
{ "Blue", (int)0xFF0000FF, },
{ "Cyan", (int)0xFF00FFFF, },
{ "Magenta", (int)0xFFFF00FF, },
{ "Yellow", (int)0xFFFFFF00, },
{ "Purple", (int)0xFF9E00FF, },
{ "Pink", (int)0xFFFF8670, },
};

const long BORDER_COLORS_SIZE = sizeof(BORDER_COLORS) / sizeof (BORDER_COLORS[0]);
2 changes: 1 addition & 1 deletion Generals/Code/GameEngine/Include/Common/DamageFX.h
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ class DamageFXStore : public SubsystemInterface

private:

typedef std::hash_map< NameKeyType, DamageFX, rts::hash<NameKeyType>, rts::equal_to<NameKeyType> > DamageFXMap;
typedef std::unordered_map< NameKeyType, DamageFX, rts::hash<NameKeyType>, rts::equal_to<NameKeyType> > DamageFXMap;
DamageFXMap m_dfxmap;

};
Expand Down
9 changes: 9 additions & 0 deletions Generals/Code/GameEngine/Include/Common/Debug.h
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,14 @@ class AsciiString;
} \
} while (0)

#include "windows.h"
#define DEBUG_WARNING(...) \
do { \
char temp[2048]; \
sprintf(temp, __VA_ARGS__); \
OutputDebugStringA(temp); \
} while(0)

#define DEBUG_ASSERTCRASH(c, m) do { { if (!(c)) DEBUG_CRASH(m); } } while (0)

//Note: RELEASE_CRASH(m) is now always defined.
Expand All @@ -200,6 +208,7 @@ class AsciiString;

#define DEBUG_CRASH(m) ((void)0)
#define DEBUG_ASSERTCRASH(c, m) ((void)0)
#define DEBUG_WARNING(...)

// DEBUG_EXTERN_C void ReleaseCrash(const char* reason);

Expand Down
2 changes: 1 addition & 1 deletion Generals/Code/GameEngine/Include/Common/DiscreteCircle.h
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ class DiscreteCircle
public:
DiscreteCircle(Int xCenter, Int yCenter, Int radius);
__inline const VecHorzLine &getEdges(void) const { return m_edges; }
__inline Int getEdgeCount(void) const { return m_edges.size(); }
__inline Int getEdgeCount(void) const { return (int)m_edges.size(); }
void drawCircle(ScanlineDrawFunc functionToDrawWith, void *parmToPass);

protected:
Expand Down
4 changes: 3 additions & 1 deletion Generals/Code/GameEngine/Include/Common/GameAudio.h
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ struct AudioRequest;
struct AudioSettings;
struct MiscAudio;

typedef std::hash_map<AsciiString, AudioEventInfo*, rts::hash<AsciiString>, rts::equal_to<AsciiString> > AudioEventInfoHash;
typedef std::unordered_map<AsciiString, AudioEventInfo*, rts::hash<AsciiString>, rts::equal_to<AsciiString> > AudioEventInfoHash;
typedef AudioEventInfoHash::iterator AudioEventInfoHashIt;
typedef UnsignedInt AudioHandle;

Expand Down Expand Up @@ -367,6 +367,8 @@ class AudioManager : public SubsystemInterface
Bool m_disallowSpeech : 1;
};

#ifdef HAS_BINK
extern AudioManager *TheAudio;
#endif

#endif // __COMMON_GAMEAUDIO_H_
4 changes: 2 additions & 2 deletions Generals/Code/GameEngine/Include/Common/GameCommon.h
Original file line number Diff line number Diff line change
Expand Up @@ -291,15 +291,15 @@ inline VeterancyLevelFlags clearVeterancyLevelFlag(VeterancyLevelFlags flags, Ve
}

// ----------------------------------------------------------------------------------------------
#define BOGUSPTR(p) ((((unsigned int)(p)) & 1) != 0)
#define BOGUSPTR(p) ((((uintptr_t)(p)) & 1) != 0)

// ----------------------------------------------------------------------------------------------
#define MAKE_DLINK_HEAD(OBJCLASS, LISTNAME) \
public: \
inline DLINK_ITERATOR<OBJCLASS> iterate_##LISTNAME() const \
{ \
DEBUG_ASSERTCRASH(!BOGUSPTR(m_dlinkhead_##LISTNAME.m_head), ("bogus head ptr")); \
return DLINK_ITERATOR<OBJCLASS>(m_dlinkhead_##LISTNAME.m_head, OBJCLASS::dlink_next_##LISTNAME); \
return DLINK_ITERATOR<OBJCLASS>(m_dlinkhead_##LISTNAME.m_head, &OBJCLASS::dlink_next_##LISTNAME); \
} \
inline OBJCLASS *getFirstItemIn_##LISTNAME() const \
{ \
Expand Down
2 changes: 2 additions & 0 deletions Generals/Code/GameEngine/Include/Common/GameEngine.h
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,9 @@ class GameEngine : public SubsystemInterface
virtual Radar *createRadar( void ) = 0; ///< Factory for radar
virtual WebBrowser *createWebBrowser( void ) = 0; ///< Factory for embedded browser
virtual ParticleSystemManager* createParticleSystemManager( void ) = 0;
#ifdef HAS_BINK
virtual AudioManager *createAudioManager( void ) = 0; ///< Factory for Audio Manager
#endif

Int m_maxFPS; ///< Maximum frames per second allowed
Bool m_quitting; ///< true when we need to quit the game
Expand Down
4 changes: 2 additions & 2 deletions Generals/Code/GameEngine/Include/Common/GameLOD.h
Original file line number Diff line number Diff line change
Expand Up @@ -168,8 +168,8 @@ class GameLODManager
Bool setDynamicLODLevel(DynamicGameLODLevel level); ///< set the current dynamic LOD level.
DynamicGameLODLevel getDynamicLODLevel(void) { return m_currentDynamicLOD;}
void init(void); ///<initialize tables of preset LOD's.
void setCurrentTextureReduction(Int val) {m_currentTextureReduction = val;}
Int getCurrentTextureReduction(void) {return m_currentTextureReduction;}
void setCurrentTextureReduction(Int val) {m_currentTextureReduction = (float)val;}
Int getCurrentTextureReduction(void) {return (int)m_currentTextureReduction;}
Int getStaticGameLODIndex(AsciiString name);
Int getDynamicGameLODIndex(AsciiString name);
inline Bool isParticleSkipped(void);
Expand Down
10 changes: 6 additions & 4 deletions Generals/Code/GameEngine/Include/Common/GameMemory.h
Original file line number Diff line number Diff line change
Expand Up @@ -608,7 +608,7 @@ private: \

// ----------------------------------------------------------------------------
#define MEMORY_POOL_GLUE_WITHOUT_GCMP(ARGCLASS) \
protected: \
public: \
virtual ~ARGCLASS(); \
public: \
enum ARGCLASS##MagicEnum { ARGCLASS##_GLUE_NOT_IMPLEMENTED = 0 }; \
Expand Down Expand Up @@ -862,6 +862,8 @@ extern void userMemoryAdjustPoolSize(const char *poolName, Int& initialAllocatio

#define _OPERATOR_NEW_DEFINED_

#include <new>

extern void * __cdecl operator new (size_t size);
extern void __cdecl operator delete (void *p);

Expand All @@ -878,13 +880,13 @@ extern void userMemoryAdjustPoolSize(const char *poolName, Int& initialAllocatio
// additional overloads for 'placement new'
//inline void* __cdecl operator new (size_t s, void *p) { return p; }
//inline void __cdecl operator delete (void *, void *p) { }
inline void* __cdecl operator new[] (size_t s, void *p) { return p; }
inline void __cdecl operator delete[] (void *, void *p) { }
//inline void* __cdecl operator new[] (size_t s, void *p) { return p; }
//inline void __cdecl operator delete[] (void *, void *p) { }

#endif

#ifdef MEMORYPOOL_DEBUG_CUSTOM_NEW
#define MSGNEW(MSG) new(MSG, 0)
#define MSGNEW(MSG) new MSG{}
#define NEW new(__FILE__, __LINE__)
#else
#define MSGNEW(MSG) new
Expand Down
2 changes: 1 addition & 1 deletion Generals/Code/GameEngine/Include/Common/GlobalData.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@

// FORWARD DECLARATIONS ///////////////////////////////////////////////////////////////////////////
struct FieldParse;
typedef enum _TerrainLOD;
enum _TerrainLOD;
class GlobalData;
class INI;
class WeaponBonusSet;
Expand Down
2 changes: 2 additions & 0 deletions Generals/Code/GameEngine/Include/Common/INI.h
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,9 @@ class INI
static void parseMultiplayerColorDefinition( INI* ini );
static void parseOnlineChatColorDefinition( INI* ini );
static void parseMapCacheDefinition( INI* ini );
#ifdef HAS_BINK
static void parseVideoDefinition( INI* ini );
#endif
static void parseCommandButtonDefinition( INI *ini );
static void parseCommandSetDefinition( INI *ini );
static void parseUpgradeDefinition( INI *ini );
Expand Down
18 changes: 9 additions & 9 deletions Generals/Code/GameEngine/Include/Common/MapReaderWriterInfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -66,34 +66,34 @@ class OutputStream {
variety of sources, such as FILE* or CFile. */
class InputStream {
public:
virtual Int read(void *pData, Int numBytes) = 0;
virtual intptr_t read(void *pData, intptr_t numBytes) = 0;
};

/** Virtual helper class, so that we can read in tile and map data from a
variety of sources, such as FILE* or CFile. */
class ChunkInputStream : public InputStream{
public:
virtual Int read(void *pData, Int numBytes) = 0;
virtual UnsignedInt tell(void) = 0;
virtual Bool absoluteSeek(UnsignedInt pos) = 0;
virtual intptr_t read(void *pData, intptr_t numBytes) = 0;
virtual intptr_t tell(void) = 0;
virtual Bool absoluteSeek(intptr_t pos) = 0;
virtual Bool eof(void) = 0;
};

/** An instance of InputStream that uses a FILE* to read data. */
class CachedFileInputStream : public ChunkInputStream
{
protected:
int m_size;
intptr_t m_size;
char* m_buffer;
int m_pos;
intptr_t m_pos;
public:
CachedFileInputStream(void);
~CachedFileInputStream(void);
Bool open(AsciiString path); ///< Returns true if open succeeded.
void close(void); ///< Explict close. Destructor closes if file is left open.
virtual Int read(void *pData, Int numBytes);
virtual UnsignedInt tell(void);
virtual Bool absoluteSeek(UnsignedInt pos);
virtual intptr_t read(void *pData, intptr_t numBytes);
virtual intptr_t tell(void);
virtual Bool absoluteSeek(intptr_t pos);
virtual Bool eof(void);
void rewind(void);
};
Expand Down
2 changes: 1 addition & 1 deletion Generals/Code/GameEngine/Include/Common/Module.h
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ private: \
public: \
static ModuleData* friend_newModuleData(INI* ini) \
{ \
clsmd* data = MSGNEW( "AllModuleData" ) clsmd; \
clsmd* data = new clsmd; \
if (ini) ini->initFromINIMultiProc(data, clsmd::buildFieldParse); \
return data; \
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ class MultiplayerSettings : public SubsystemInterface
inline Int getNumColors( void )
{
if (m_numColors == 0) {
m_numColors = m_colorList.size();
m_numColors = (int)m_colorList.size();
}
return m_numColors;
}
Expand Down
2 changes: 1 addition & 1 deletion Generals/Code/GameEngine/Include/Common/Player.h
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ struct SpecialPowerReadyTimerType


// ------------------------------------------------------------------------------------------------
typedef std::hash_map< PlayerIndex, Relationship, std::hash<PlayerIndex>, std::equal_to<PlayerIndex> > PlayerRelationMapType;
typedef std::unordered_map< PlayerIndex, Relationship, std::hash<PlayerIndex>, std::equal_to<PlayerIndex> > PlayerRelationMapType;
class PlayerRelationMap : public MemoryPoolObject,
public Snapshot
{
Expand Down
2 changes: 1 addition & 1 deletion Generals/Code/GameEngine/Include/Common/PlayerTemplate.h
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ class PlayerTemplateStore : public SubsystemInterface

const PlayerTemplate* getNthPlayerTemplate(Int i) const;
const PlayerTemplate* findPlayerTemplate(NameKeyType namekey) const;
inline Int getPlayerTemplateCount() const { return m_playerTemplates.size(); }
inline Int getPlayerTemplateCount() const { return (int)m_playerTemplates.size(); }


// This function will fill outStringList with all the sides found in all the templates
Expand Down
8 changes: 4 additions & 4 deletions Generals/Code/GameEngine/Include/Common/QuickTrig.h
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,8 @@ inline Real QMag(Real x, Real y, Real z)
//-----------------------------------------------------------------------------
inline Real QSin(Real a)
{
register Real angle = a;
register long sgn = 1;
Real angle = a;
long sgn = 1;

if (angle < 0) // DO POSITIVE MATH AND PRESERVE SIGN
{
Expand All @@ -108,8 +108,8 @@ inline Real QSin(Real a)
angle = PI - angle; // FLIP
}

register int index = REAL_TO_INT((angle/QUARTER_CIRCLE) * TheQuickTanTableCount);
register Real x = TheQuickSinTable[index];
int index = REAL_TO_INT((angle/QUARTER_CIRCLE) * TheQuickTanTableCount);
Real x = TheQuickSinTable[index];

return x * sgn;

Expand Down
12 changes: 7 additions & 5 deletions Generals/Code/GameEngine/Include/Common/STLTypedefs.h
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ enum DrawableID;

#include <algorithm>
#include <bitset>
#include <hash_map>
#include <unordered_map>
#include <list>
#include <map>
#include <queue>
Expand Down Expand Up @@ -190,10 +190,12 @@ namespace rts

template<> struct hash<AsciiString>
{
size_t operator()(AsciiString ast) const
{
std::hash<const char *> tmp;
return tmp((const char *) ast.str());
size_t operator()(const AsciiString& ast) const
{
#pragma message("Figure out the upgrade to C++17 or add a string hashing algorithm")
std::hash<std::string> tmp;
const char* str = (const char*) ast.str();
return tmp(str);
}
};

Expand Down
Loading