This commit is contained in:
JuiceyDev 2026-03-06 07:31:16 +01:00
parent 17ac8deddf
commit 9dd73aaa0d
11 changed files with 50 additions and 58 deletions

View file

@ -17,7 +17,7 @@ jobs:
- name: Install system dependencies
run: |
sudo apt-get update
sudo apt-get install -y build-essential python3 python3-pip python3-setuptools libgl1-mesa-dev libglu1-mesa-dev libglfw3-dev libpng-dev pkg-config clang ccache
sudo apt-get install -y build-essential python3 python3-pip python3-setuptools libgl1-mesa-dev libglu1-mesa-dev libglfw3-dev libpng-dev pkg-config clang lld ccache libssl-dev
# Set a reasonable ccache size
ccache -M 5G || true

View file

@ -30,7 +30,7 @@ public:
int compareTo(const TextureHolder *other) const;
};
typedef struct
struct TextureHolderLessThan
{
bool operator() (const TextureHolder *first, const TextureHolder *second) const { return first->compareTo(second) >= 0; }
} TextureHolderLessThan;
};

View file

@ -463,7 +463,7 @@ void ConsoleSaveFileSplit::_init(const wstring &fileName, LPVOID pvSaveData, DWO
unsigned char *regionDataCompressed;
unsigned int regionSizeCompressed;
StorageManager.GetSubfileDetails(i, &regionIndex, &regionDataCompressed, &regionSizeCompressed);
StorageManager.GetSubfileDetails(i, (int*)&regionIndex, (void**)&regionDataCompressed, &regionSizeCompressed);
RegionFileReference *regionFileRef = new RegionFileReference(i, regionIndex, regionSizeCompressed, regionDataCompressed);
if( regionSizeCompressed > 0 )

View file

@ -43,14 +43,12 @@ private:
//File(vector<wstring> *path);
};
typedef struct
struct FileKeyHash
{
int operator() (const File &k) const { return File::hash_fnct(k); }
};
} FileKeyHash;
typedef struct
struct FileKeyEq
{
bool operator() (const File &x, const File &y) const {return File::eq_test(x,y); }
} FileKeyEq;
bool operator() (const File &x, const File &y) const { return File::eq_test(x, y); }
};

View file

@ -34,7 +34,7 @@ FileInputStream::FileInputStream(const File &file)
NULL // Unsupported
);
#elif defined(__linux__)
m_fileHandle = open(pchFilename, O_RDONLY);
m_fileHandle = (HANDLE)(intptr_t)open(pchFilename, O_RDONLY);
#else
m_fileHandle = CreateFile(
pchFilename, // file name
@ -61,7 +61,7 @@ FileInputStream::~FileInputStream()
#ifndef __linux__
CloseHandle( m_fileHandle );
#else
::close( m_fileHandle );
::close( (int)(intptr_t)m_fileHandle );
#endif
}
@ -190,7 +190,7 @@ void FileInputStream::close()
return;
}
BOOL result = ::close( m_fileHandle );
int result = ::close( (int)(intptr_t)m_fileHandle );
if( result == 0 )
{

View file

@ -42,7 +42,7 @@ FileOutputStream::FileOutputStream(const File &file) : m_fileHandle( INVALID_HAN
char* convertedPath = new char[path.size() + 1];
std::wcstombs(convertedPath, path.c_str(), path.size() + 1);
m_fileHandle = open(convertedPath, O_WRONLY | O_CREAT | O_APPEND, S_IRUSR | S_IWUSR);
m_fileHandle = (HANDLE)(intptr_t)open(convertedPath, O_WRONLY | O_CREAT | O_APPEND, S_IRUSR | S_IWUSR);
delete[] convertedPath;
#else
m_fileHandle = CreateFile(
@ -66,7 +66,7 @@ FileOutputStream::FileOutputStream(const File &file) : m_fileHandle( INVALID_HAN
FileOutputStream::~FileOutputStream()
{
if( m_fileHandle != INVALID_HANDLE_VALUE )
::close( m_fileHandle );
::close( (int)(intptr_t)m_fileHandle );
}
//Writes the specified byte to this file output stream. Implements the write method of OutputStream.
@ -85,7 +85,7 @@ void FileOutputStream::write(unsigned int b)
NULL // overlapped buffer
);
#else // LINUX
int fileDescriptor = reinterpret_cast<int>(m_fileHandle);
int fileDescriptor = (int)(intptr_t)(m_fileHandle);
ssize_t numberOfBytesWritten = ::write(fileDescriptor, NULL, 1);
int result = static_cast<int>(numberOfBytesWritten);
#endif // _WIN32
@ -114,7 +114,7 @@ void FileOutputStream::write(byteArray b)
NULL // overlapped buffer
);
#else // Linux
int fileDescriptor = reinterpret_cast<int>(m_fileHandle);
int fileDescriptor = (int)(intptr_t)(m_fileHandle);
ssize_t numberOfBytesWritten = ::write(fileDescriptor, NULL, 1);
int result = static_cast<int>(numberOfBytesWritten);
#endif // _WIN32
@ -150,7 +150,7 @@ void FileOutputStream::write(byteArray b, unsigned int offset, unsigned int leng
NULL // overlapped buffer
);
#else
int fileDescriptor = reinterpret_cast<int>(m_fileHandle);
int fileDescriptor = (int)(intptr_t)(m_fileHandle);
ssize_t numberOfBytesWritten = ::write(fileDescriptor, static_cast<const void*>(&b[offset]), length);
int result = static_cast<int>(numberOfBytesWritten);
#endif // _WIN32
@ -173,7 +173,7 @@ void FileOutputStream::close()
#ifdef _WIN32
BOOL result = CloseHandle( m_fileHandle );
#else // __linux__
int result = ::close( m_fileHandle );
int result = ::close( (int)(intptr_t)m_fileHandle );
#endif // _WIN32
if( result == 0 )
{

View file

@ -28,13 +28,12 @@ public:
ChunkPos & operator= (const ChunkPos & other) { x = other.x; z = other.z; return *this; }
};
typedef struct
struct ChunkPosKeyHash
{
__int64 operator() (const ChunkPos &k) const { return ChunkPos::hash_fnct(k); }
};
} ChunkPosKeyHash;
typedef struct
struct ChunkPosKeyEq
{
bool operator() (const ChunkPos &x, const ChunkPos &y) const { return ChunkPos::eq_test(x, y); }
} ChunkPosKeyEq;
};

View file

@ -28,19 +28,17 @@ public:
static bool eq_test(const TickNextTickData &x, const TickNextTickData &y);
};
typedef struct
struct TickNextTickDataKeyHash
{
int operator() (const TickNextTickData &k) const { return TickNextTickData::hash_fnct (k); }
};
} TickNextTickDataKeyHash;
typedef struct
struct TickNextTickDataKeyEq
{
bool operator() (const TickNextTickData &x, const TickNextTickData &y) const { return TickNextTickData::eq_test (x, y); }
} TickNextTickDataKeyEq;
};
typedef struct
struct TickNextTickDataKeyCompare
{
bool operator() (const TickNextTickData &x, const TickNextTickData &y) const { return TickNextTickData::compare_fnct (x, y); }
} TickNextTickDataKeyCompare;
};

View file

@ -14,14 +14,13 @@ public:
static bool eq_test(const TilePos &x, const TilePos &y);
};
typedef struct
struct TilePosKeyHash
{
int operator() (const TilePos &k) const { return TilePos::hash_fnct (k); }
};
} TilePosKeyHash;
typedef struct
struct TilePosKeyEq
{
bool operator() (const TilePos &x, const TilePos &y) const { return TilePos::eq_test (x, y); }
} TilePosKeyEq;
};

View file

@ -539,13 +539,12 @@ private:
#endif
};
typedef struct
struct PlayerKeyHash
{
int operator() (const shared_ptr<Player> k) const { return Player::hash_fnct (k); }
};
} PlayerKeyHash;
typedef struct
struct PlayerKeyEq
{
bool operator() (const shared_ptr<Player> x, const shared_ptr<Player> y) const { return Player::eq_test (x, y); }
} PlayerKeyEq;
};

View file

@ -5,7 +5,7 @@
// would appear to be a bit expensive so matching the java one for now anyway. This code implements the supplemental
// hashing that happens in java so we can match what their maps are doing with ints.
typedef struct
struct IntKeyHash
{
int operator() (const int &k) const
{
@ -16,18 +16,17 @@ typedef struct
h ^= (((unsigned int)h) >> 10);
return h;
}
};
} IntKeyHash;
typedef struct
struct IntKeyEq
{
bool operator() (const int &x, const int &y) const { return x==y; }
} IntKeyEq;
};
// This hash functor is taken from the IntHashMap java class used by the game, so that we can use a standard std hashmap with this hash rather
// than implement the class itself
typedef struct
struct IntKeyHash2
{
int operator() (const int &k) const
{
@ -35,12 +34,12 @@ typedef struct
h ^= (h >> 20) ^ (h >> 12);
return (int)(h ^ (h >> 7) ^ (h >> 4));
}
} IntKeyHash2;
};
// This hash functor is taken from the LongHashMap java class used by the game, so that we can use a standard std hashmap with this hash rather
// than implement the class itself
typedef struct
struct LongKeyHash
{
int hash(const int &k) const
{
@ -53,14 +52,14 @@ typedef struct
{
return hash((int) ( k ^ (((__uint64)k) >> 32 )));
}
} LongKeyHash;
};
typedef struct
struct LongKeyEq
{
bool operator() (const __int64 &x, const __int64 &y) const { return x==y; }
} LongKeyEq;
};
typedef struct
struct eINSTANCEOFKeyHash
{
int operator() (const eINSTANCEOF &k) const
{
@ -68,10 +67,10 @@ typedef struct
h ^= (h >> 20) ^ (h >> 12);
return (int)(h ^ (h >> 7) ^ (h >> 4));
}
} eINSTANCEOFKeyHash;
};
typedef struct
struct eINSTANCEOFKeyEq
{
bool operator() (const eINSTANCEOF &x, const eINSTANCEOF &y) const { return x==y; }
} eINSTANCEOFKeyEq;
};