mirror of
https://github.com/smartcmd/MinecraftConsoles.git
synced 2026-08-13 05:53:43 +08:00
Replace MSVC __debugbreak with cross-compiler DEBUG_BREAK macro. (#1540)
This commit is contained in:
@@ -208,7 +208,7 @@ void ArmorItem::setColor(shared_ptr<ItemInstance> item, int color)
|
||||
{
|
||||
#ifndef _CONTENT_PACKAGE
|
||||
printf("Can't dye non-leather!");
|
||||
__debugbreak();
|
||||
DEBUG_BREAK();
|
||||
#endif
|
||||
//throw new UnsupportedOperationException("Can't dye non-leather!");
|
||||
}
|
||||
|
||||
@@ -23,7 +23,7 @@ void BiomeDecorator::decorate(Level *level, Random *random, int xo, int zo)
|
||||
{
|
||||
app.DebugPrintf("BiomeDecorator::decorate - Already decorating!!\n");
|
||||
#ifndef _CONTENT_PACKAGE
|
||||
__debugbreak();
|
||||
DEBUG_BREAK();
|
||||
//throw new RuntimeException("Already decorating!!");
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -32,7 +32,7 @@ BiomeOverrideLayer::BiomeOverrideLayer(int seedMixup) : Layer(seedMixup)
|
||||
{
|
||||
|
||||
#ifdef _DURANGO
|
||||
__debugbreak(); // TODO
|
||||
DEBUG_BREAK(); // TODO
|
||||
DWORD bytesRead,dwFileSize = 0;
|
||||
#else
|
||||
DWORD bytesRead,dwFileSize = GetFileSize(file,nullptr);
|
||||
@@ -40,7 +40,7 @@ BiomeOverrideLayer::BiomeOverrideLayer(int seedMixup) : Layer(seedMixup)
|
||||
if(dwFileSize > m_biomeOverride.length)
|
||||
{
|
||||
app.DebugPrintf("Biomemap binary is too large!!\n");
|
||||
__debugbreak();
|
||||
DEBUG_BREAK();
|
||||
}
|
||||
BOOL bSuccess = ReadFile(file,m_biomeOverride.data,dwFileSize,&bytesRead,nullptr);
|
||||
|
||||
|
||||
@@ -184,7 +184,7 @@ void BiomeSource::getRawBiomeBlock(BiomeArray &biomes, int x, int z, int w, int
|
||||
if(biomes[i] == nullptr)
|
||||
{
|
||||
app.DebugPrintf("Tried to assign null biome %d\n", result[i]);
|
||||
__debugbreak();
|
||||
DEBUG_BREAK();
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#pragma once
|
||||
#include "Debug.h"
|
||||
using namespace std;
|
||||
class InputStream;
|
||||
|
||||
@@ -598,7 +599,7 @@ public:
|
||||
|
||||
if ( (m_falsePositives.size() > 0) || (m_falseNegatives.size() > 0) )
|
||||
{
|
||||
__debugbreak();
|
||||
DEBUG_BREAK();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -36,7 +36,7 @@ public:
|
||||
{
|
||||
#ifndef _CONTENT_PACKAGE
|
||||
printf("Tried to read NBT tag with too high complexity, depth > %d" , MAX_DEPTH);
|
||||
__debugbreak();
|
||||
DEBUG_BREAK();
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1065,7 +1065,7 @@ void CompressedTileStorage::compress(int upgradeBlock/*=-1*/)
|
||||
#ifndef _DURANGO
|
||||
MEMORYSTATUS memStatus;
|
||||
GlobalMemoryStatus(&memStatus);
|
||||
__debugbreak();
|
||||
DEBUG_BREAK();
|
||||
#endif
|
||||
}
|
||||
unsigned char *pucData = newIndicesAndData + 1024;
|
||||
|
||||
@@ -88,7 +88,7 @@ ConsoleSaveFileOriginal::ConsoleSaveFileOriginal(const wstring &fileName, LPVOID
|
||||
if( pagesCommitted != 0 )
|
||||
{
|
||||
#ifndef _CONTENT_PACKAGE
|
||||
__debugbreak();
|
||||
DEBUG_BREAK();
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -99,7 +99,7 @@ ConsoleSaveFileOriginal::ConsoleSaveFileOriginal(const wstring &fileName, LPVOID
|
||||
{
|
||||
#ifndef _CONTENT_PACKAGE
|
||||
// Out of physical memory
|
||||
__debugbreak();
|
||||
DEBUG_BREAK();
|
||||
#endif
|
||||
}
|
||||
pagesCommitted = pagesRequired;
|
||||
@@ -204,7 +204,7 @@ ConsoleSaveFileOriginal::ConsoleSaveFileOriginal(const wstring &fileName, LPVOID
|
||||
if( pvRet == nullptr )
|
||||
{
|
||||
// Out of physical memory
|
||||
__debugbreak();
|
||||
DEBUG_BREAK();
|
||||
}
|
||||
pagesCommitted = pagesRequired;
|
||||
}
|
||||
@@ -495,7 +495,7 @@ void ConsoleSaveFileOriginal::finalizeWrite()
|
||||
void *pvRet = VirtualAlloc(pvHeap, pagesRequired * CSF_PAGE_SIZE, COMMIT_ALLOCATION, PAGE_READWRITE);
|
||||
if( pvRet == NULL )
|
||||
{
|
||||
__debugbreak();
|
||||
DEBUG_BREAK();
|
||||
}
|
||||
pagesCommitted = pagesRequired;
|
||||
}
|
||||
@@ -529,7 +529,7 @@ void ConsoleSaveFileOriginal::MoveDataBeyond(FileEntry *file, DWORD nNumberOfByt
|
||||
if( pvRet == nullptr )
|
||||
{
|
||||
// Out of physical memory
|
||||
__debugbreak();
|
||||
DEBUG_BREAK();
|
||||
}
|
||||
pagesCommitted = pagesRequired;
|
||||
}
|
||||
|
||||
@@ -41,7 +41,7 @@ CustomLevelSource::CustomLevelSource(Level *level, int64_t seed, bool generateSt
|
||||
{
|
||||
|
||||
#ifdef _DURANGO
|
||||
__debugbreak(); // TODO
|
||||
DEBUG_BREAK(); // TODO
|
||||
DWORD bytesRead,dwFileSize = 0;
|
||||
#else
|
||||
DWORD bytesRead,dwFileSize = GetFileSize(file,nullptr);
|
||||
@@ -49,7 +49,7 @@ CustomLevelSource::CustomLevelSource(Level *level, int64_t seed, bool generateSt
|
||||
if(dwFileSize > m_heightmapOverride.length)
|
||||
{
|
||||
app.DebugPrintf("Heightmap binary is too large!!\n");
|
||||
__debugbreak();
|
||||
DEBUG_BREAK();
|
||||
}
|
||||
BOOL bSuccess = ReadFile(file,m_heightmapOverride.data,dwFileSize,&bytesRead,nullptr);
|
||||
|
||||
@@ -83,7 +83,7 @@ CustomLevelSource::CustomLevelSource(Level *level, int64_t seed, bool generateSt
|
||||
{
|
||||
|
||||
#ifdef _DURANGO
|
||||
__debugbreak(); // TODO
|
||||
DEBUG_BREAK(); // TODO
|
||||
DWORD bytesRead,dwFileSize = 0;
|
||||
#else
|
||||
DWORD bytesRead,dwFileSize = GetFileSize(file,nullptr);
|
||||
@@ -91,7 +91,7 @@ CustomLevelSource::CustomLevelSource(Level *level, int64_t seed, bool generateSt
|
||||
if(dwFileSize > m_waterheightOverride.length)
|
||||
{
|
||||
app.DebugPrintf("waterheight binary is too large!!\n");
|
||||
__debugbreak();
|
||||
DEBUG_BREAK();
|
||||
}
|
||||
BOOL bSuccess = ReadFile(file,m_waterheightOverride.data,dwFileSize,&bytesRead,nullptr);
|
||||
|
||||
|
||||
@@ -31,7 +31,7 @@ CustomPayloadPacket::CustomPayloadPacket(const wstring &identifier, byteArray da
|
||||
{
|
||||
app.DebugPrintf("Payload may not be larger than 32K\n");
|
||||
#ifndef _CONTENT_PACKAGE
|
||||
__debugbreak();
|
||||
DEBUG_BREAK();
|
||||
#endif
|
||||
//throw new IllegalArgumentException("Payload may not be larger than 32k");
|
||||
}
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
#pragma once
|
||||
#include <csignal>
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
#define DEBUG_BREAK() __debugbreak()
|
||||
#elif defined(__GNUC__) || defined(__clang__)
|
||||
#define DEBUG_BREAK() __builtin_trap()
|
||||
#elif defined(SIGTRAP)
|
||||
#define DEBUG_BREAK() std::raise(SIGTRAP)
|
||||
#else
|
||||
#define DEBUG_BREAK() ((void)0)
|
||||
#endif
|
||||
@@ -43,7 +43,7 @@ int _MapDataMappings::getDimension(int id)
|
||||
default:
|
||||
#ifndef _CONTENT_PACKAGE
|
||||
printf("Read invalid dimension from MapDataMapping\n");
|
||||
__debugbreak();
|
||||
DEBUG_BREAK();
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
@@ -72,7 +72,7 @@ void _MapDataMappings::setMapping(int id, PlayerUID xuid, int dimension)
|
||||
default:
|
||||
#ifndef _CONTENT_PACKAGE
|
||||
printf("Trinyg to set a MapDataMapping for an invalid dimension.\n");
|
||||
__debugbreak();
|
||||
DEBUG_BREAK();
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -83,7 +83,7 @@ void Enchantment::_init(int id)
|
||||
{
|
||||
app.DebugPrintf("Duplicate enchantment id!");
|
||||
#ifndef _CONTENT_PACKAGE
|
||||
__debugbreak();
|
||||
DEBUG_BREAK();
|
||||
#endif
|
||||
//throw new IllegalArgumentException("Duplicate enchantment id!");
|
||||
}
|
||||
|
||||
@@ -111,7 +111,7 @@ int Entity::getSmallId()
|
||||
return fallbackId;
|
||||
#else
|
||||
app.DebugPrintf("Out of small entity Ids... possible leak?\n");
|
||||
__debugbreak();
|
||||
DEBUG_BREAK();
|
||||
return -1;
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -239,7 +239,7 @@ bool File::renameTo(File dest)
|
||||
std::string sourcePath = wstringtofilename(getPath());
|
||||
const char *destPath = wstringtofilename(dest.getPath());
|
||||
#ifdef _DURANGO
|
||||
__debugbreak(); // TODO
|
||||
DEBUG_BREAK(); // TODO
|
||||
BOOL result = false;
|
||||
#else
|
||||
BOOL result = MoveFile(sourcePath.c_str(), destPath);
|
||||
|
||||
@@ -298,7 +298,7 @@ void FileHeader::ReadHeader( LPVOID saveMem, ESavePlatform plat /*= SAVE_FILE_PL
|
||||
default:
|
||||
#ifndef _CONTENT_PACKAGE
|
||||
app.DebugPrintf("********** Invalid save version %d\n",m_saveVersion);
|
||||
__debugbreak();
|
||||
DEBUG_BREAK();
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -44,7 +44,6 @@ FileInputStream::FileInputStream(const File &file)
|
||||
if( m_fileHandle == INVALID_HANDLE_VALUE )
|
||||
{
|
||||
// TODO 4J Stu - Any form of error/exception handling
|
||||
//__debugbreak();
|
||||
app.FatalLoadError();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,7 +23,7 @@ GameCommandPacket::GameCommandPacket(EGameCommand command, byteArray data)
|
||||
{
|
||||
app.DebugPrintf("Payload may not be larger than 32K\n");
|
||||
#ifndef _CONTENT_PACKAGE
|
||||
__debugbreak();
|
||||
DEBUG_BREAK();
|
||||
#endif
|
||||
//throw new IllegalArgumentException("Payload may not be larger than 32k");
|
||||
}
|
||||
|
||||
@@ -2411,7 +2411,7 @@ void Level::tickEntities()
|
||||
{
|
||||
if(isClientSide)
|
||||
{
|
||||
__debugbreak();
|
||||
DEBUG_BREAK();
|
||||
}
|
||||
it = tileEntityList.erase(it);
|
||||
}
|
||||
|
||||
@@ -38,7 +38,7 @@ void MoveEntityPacket::write(DataOutputStream *dos) //throws IOException
|
||||
if( (id < 0 ) || (id >= 16384 ) )
|
||||
{
|
||||
// We shouln't be tracking an entity that doesn't have a short type of id
|
||||
__debugbreak();
|
||||
DEBUG_BREAK();
|
||||
}
|
||||
dos->writeShort(static_cast<short>(id));
|
||||
}
|
||||
|
||||
@@ -22,7 +22,7 @@ MoveEntityPacketSmall::MoveEntityPacketSmall(int id)
|
||||
if( (id < 0 ) || (id >= 16384 ) )
|
||||
{
|
||||
// We shouln't be tracking an entity that doesn't have a short type of id
|
||||
__debugbreak();
|
||||
DEBUG_BREAK();
|
||||
}
|
||||
|
||||
this->id = id;
|
||||
@@ -45,7 +45,7 @@ void MoveEntityPacketSmall::write(DataOutputStream *dos) //throws IOException
|
||||
if( (id < 0 ) || (id >= 16384 ) )
|
||||
{
|
||||
// We shouln't be tracking an entity that doesn't have a short type of id
|
||||
__debugbreak();
|
||||
DEBUG_BREAK();
|
||||
}
|
||||
dos->writeShort(static_cast<short>(id));
|
||||
}
|
||||
@@ -102,7 +102,7 @@ void MoveEntityPacketSmall::PosRot::write(DataOutputStream *dos) //throws IOExce
|
||||
if( (id < 0 ) || (id >= 16384 ) )
|
||||
{
|
||||
// We shouln't be tracking an entity that doesn't have a short type of id
|
||||
__debugbreak();
|
||||
DEBUG_BREAK();
|
||||
}
|
||||
short idAndRot = id | yRot << 11;
|
||||
dos->writeShort(idAndRot);
|
||||
@@ -141,7 +141,7 @@ void MoveEntityPacketSmall::Pos::write(DataOutputStream *dos) //throws IOExcepti
|
||||
if( (id < 0 ) || (id >= 16384 ) )
|
||||
{
|
||||
// We shouln't be tracking an entity that doesn't have a short type of id
|
||||
__debugbreak();
|
||||
DEBUG_BREAK();
|
||||
}
|
||||
short idAndY = id | ya << 11;
|
||||
dos->writeShort(idAndY);
|
||||
@@ -179,7 +179,7 @@ void MoveEntityPacketSmall::Rot::write(DataOutputStream *dos) //throws IOExcepti
|
||||
if( (id < 0 ) || (id >= 16384 ) )
|
||||
{
|
||||
// We shouln't be tracking an entity that doesn't have a short type of id
|
||||
__debugbreak();
|
||||
DEBUG_BREAK();
|
||||
}
|
||||
short idAndRot = id | yRot << 11;
|
||||
dos->writeShort(idAndRot);
|
||||
|
||||
@@ -288,7 +288,7 @@ byteArray Packet::readBytes(DataInputStream *datainputstream)
|
||||
{
|
||||
app.DebugPrintf("Key was smaller than nothing! Weird key!");
|
||||
#ifndef _CONTENT_PACKAGE
|
||||
__debugbreak();
|
||||
DEBUG_BREAK();
|
||||
#endif
|
||||
return byteArray();
|
||||
//throw new IOException("Key was smaller than nothing! Weird key!");
|
||||
|
||||
@@ -28,7 +28,7 @@ int PressurePlateTile::getSignalStrength(Level *level, int x, int y, int z)
|
||||
if (sensitivity == everything) entities = level->getEntities(nullptr, getSensitiveAABB(x, y, z));
|
||||
else if (sensitivity == mobs) entities = level->getEntitiesOfClass(typeid(LivingEntity), getSensitiveAABB(x, y, z));
|
||||
else if (sensitivity == players) entities = level->getEntitiesOfClass(typeid(Player), getSensitiveAABB(x, y, z));
|
||||
else __debugbreak(); // 4J-JEV: We're going to delete something at a random location.
|
||||
else DEBUG_BREAK(); // 4J-JEV: We're going to delete something at a random location.
|
||||
|
||||
if (entities != nullptr && !entities->empty())
|
||||
{
|
||||
|
||||
@@ -299,7 +299,7 @@ void RegionFile::write(int x, int z, byte *data, int length) // TODO - was sync
|
||||
#ifndef _CONTENT_PACKAGE
|
||||
if(sectorNumber < 0)
|
||||
{
|
||||
__debugbreak();
|
||||
DEBUG_BREAK();
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
@@ -50,7 +50,7 @@ shared_ptr<SavedData> SavedDataStorage::get(const type_info& clazz, const wstrin
|
||||
else
|
||||
{
|
||||
// Handling of new SavedData class required
|
||||
__debugbreak();
|
||||
DEBUG_BREAK();
|
||||
}
|
||||
|
||||
ConsoleSaveFileInputStream fis = ConsoleSaveFileInputStream(levelStorage->getSaveFile(), file);
|
||||
|
||||
@@ -14,9 +14,6 @@ Objective *Scoreboard::addObjective(const wstring &name, ObjectiveCriteria *crit
|
||||
// Objective *objective = getObjective(name);
|
||||
// if (objective != nullptr)
|
||||
// {
|
||||
//#indef _CONTENT_PACKAGE
|
||||
// __debugbreak();
|
||||
//#endif
|
||||
// //throw new IllegalArgumentException("An objective with the name '" + name + "' already exists!");
|
||||
// }
|
||||
//
|
||||
|
||||
@@ -39,14 +39,14 @@ SetPlayerTeamPacket::SetPlayerTeamPacket(PlayerTeam *team, vector<wstring> *play
|
||||
{
|
||||
app.DebugPrintf("Method must be join or leave for player constructor");
|
||||
#ifndef _CONTENT_PACKAGE
|
||||
__debugbreak();
|
||||
DEBUG_BREAK();
|
||||
#endif
|
||||
}
|
||||
if (playerNames == nullptr || playerNames->empty())
|
||||
{
|
||||
app.DebugPrintf("Players cannot be null/empty");
|
||||
#ifndef _CONTENT_PACKAGE
|
||||
__debugbreak();
|
||||
DEBUG_BREAK();
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@@ -148,7 +148,7 @@ bool StrongholdFeature::isFeatureChunk(int x, int z,bool bIsSuperflat)
|
||||
#ifndef _CONTENT_PACKAGE
|
||||
if(position->x > 2560 || position->x < -2560 || position->z > 2560 || position->z < -2560)
|
||||
{
|
||||
__debugbreak();
|
||||
DEBUG_BREAK();
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@ WeighedRandomItem *WeighedRandom::getRandomItem(Random *random, vector<WeighedRa
|
||||
{
|
||||
if (totalWeight <= 0)
|
||||
{
|
||||
__debugbreak();
|
||||
DEBUG_BREAK();
|
||||
}
|
||||
|
||||
int selection = random->nextInt(totalWeight);
|
||||
@@ -50,7 +50,7 @@ WeighedRandomItem *WeighedRandom::getRandomItem(Random *random, WeighedRandomIte
|
||||
{
|
||||
if (totalWeight <= 0)
|
||||
{
|
||||
__debugbreak();
|
||||
DEBUG_BREAK();
|
||||
}
|
||||
|
||||
int selection = random->nextInt(totalWeight);
|
||||
|
||||
@@ -104,6 +104,7 @@ set(_MINECRAFT_WORLD_COMMON_CONSOLEJAVALIBS_INPUTOUTPUTSTREAM
|
||||
source_group("ConsoleJavaLibs/InputOutputStream" FILES ${_MINECRAFT_WORLD_COMMON_CONSOLEJAVALIBS_INPUTOUTPUTSTREAM})
|
||||
|
||||
set(_MINECRAFT_WORLD_COMMON_HEADER_FILES
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/Debug.h"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/LevelObjectInputStream.h"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/Minecraft.World.h"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/ParticleTypes.h"
|
||||
|
||||
@@ -126,6 +126,7 @@ typedef XUID GameSessionUID;
|
||||
#include "TilePos.h"
|
||||
#include "ChunkPos.h"
|
||||
#include "compression.h"
|
||||
#include "Debug.h"
|
||||
#include "PerformanceTimer.h"
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user