fix: resolve ByteBuffer hardcoded path and static const linker errors
Some checks are pending
Build (Linux, x86-64) / build-linux (push) Waiting to run
Format Check / clang-format (push) Waiting to run

This commit is contained in:
MatthewBeshay 2026-03-31 21:49:28 +11:00
parent a18cb3d484
commit 2f92b07c1f
15 changed files with 87 additions and 151 deletions

View file

@ -3803,33 +3803,11 @@ int CMinecraftApp::UnlockFullInviteReturned(void* pParam, int iPad,
bNoPlayer = true;
}
if (result == C4JStorage::EMessage_ResultAccept) {
if (ProfileManager.IsSignedInLive(iPad)) {
// 4J-PB - need to check this user can access the store
{
false, iPad, /*eSen_UpsellID_Full_Version_Of_Game*/ 0);
}
}
}
return 0;
}
int CMinecraftApp::UnlockFullSaveReturned(void* pParam, int iPad,
C4JStorage::EMessageResult result) {
// CMinecraftApp* pApp = (CMinecraftApp*)pParam;
Minecraft* pMinecraft = Minecraft::GetInstance();
if (result == C4JStorage::EMessage_ResultAccept) {
if (ProfileManager.IsSignedInLive(pMinecraft->player->GetXboxPad())) {
// 4J-PB - need to check this user can access the store
{
false, pMinecraft->player->GetXboxPad(),
/*eSen_UpsellID_Full_Version_Of_Game*/ 0);
}
}
}
return 0;
}
@ -3838,15 +3816,7 @@ int CMinecraftApp::UnlockFullExitReturned(void* pParam, int iPad,
CMinecraftApp* pApp = (CMinecraftApp*)pParam;
Minecraft* pMinecraft = Minecraft::GetInstance();
if (result == C4JStorage::EMessage_ResultAccept) {
if (ProfileManager.IsSignedInLive(pMinecraft->player->GetXboxPad())) {
// 4J-PB - need to check this user can access the store
{
false, pMinecraft->player->GetXboxPad(),
/*eSen_UpsellID_Full_Version_Of_Game*/ 0);
}
}
} else {
if (result != C4JStorage::EMessage_ResultAccept) {
pApp->SetAction(pMinecraft->player->GetXboxPad(),
eAppAction_ExitWorldTrial);
}
@ -3859,19 +3829,7 @@ int CMinecraftApp::TrialOverReturned(void* pParam, int iPad,
CMinecraftApp* pApp = (CMinecraftApp*)pParam;
Minecraft* pMinecraft = Minecraft::GetInstance();
if (result == C4JStorage::EMessage_ResultAccept) {
// we need a signed in user for the unlock
if (ProfileManager.IsSignedInLive(pMinecraft->player->GetXboxPad())) {
// 4J-PB - need to check this user can access the store
{
false, pMinecraft->player->GetXboxPad(),
/*eSen_UpsellID_Full_Version_Of_Game*/ 0);
}
} else {
pApp->SetAction(pMinecraft->player->GetXboxPad(),
eAppAction_ExitTrial);
}
} else {
if (result != C4JStorage::EMessage_ResultAccept) {
pApp->SetAction(pMinecraft->player->GetXboxPad(), eAppAction_ExitTrial);
}

View file

@ -999,9 +999,6 @@ void UIScene_MainMenu::LoadTrial(void) {
StorageManager.ResetSaveData();
// Need to set the mode as trial
ProfileManager.StartTrialGame();
// No saving in the trial
StorageManager.SetSaveDisabled(true);
app.SetGameHostOption(eGameHostOption_WasntSaveOwner, false);

View file

@ -43,10 +43,6 @@ void UIScene_TrialExitUpsell::handleInput(int iPad, int key, bool repeat,
// CD - Added for audio
ui.PlayUISFX(eSFX_Press);
// 4J-PB - need to check this user can access the store
{
false, iPad, /*eSen_UpsellID_Full_Version_Of_Game*/ 0);
}
}
break;
}

View file

@ -456,20 +456,6 @@ int UIScene_PauseMenu::UnlockFullSaveReturned(
void* pParam, int iPad, C4JStorage::EMessageResult result) {
Minecraft* pMinecraft = Minecraft::GetInstance();
if (result == C4JStorage::EMessage_ResultAccept) {
if (ProfileManager.IsSignedInLive(pMinecraft->player->GetXboxPad())) {
// 4J-PB - need to check this user can access the store
{
false, pMinecraft->player->GetXboxPad(),
/*eSen_UpsellID_Full_Version_Of_Game*/ 0);
}
}
} else {
// SentientManager.RecordUpsellResponded(iPad,
// eSen_UpsellID_Full_Version_Of_Game, app.m_dwOfferID,
// eSen_UpsellOutcome_Declined);
}
return 0;
}

View file

@ -6,12 +6,12 @@ class SharedConstants {
public:
static void staticCtor();
static const std::wstring VERSION_STRING;
static const int NETWORK_PROTOCOL_VERSION = 78;
static inline constexpr int NETWORK_PROTOCOL_VERSION = 78;
static const bool INGAME_DEBUG_OUTPUT = false;
// NOT texture resolution. How many sub-blocks each block face is made up
// of. 4J Added for texture packs
static const int WORLD_RESOLUTION = 16;
static inline constexpr int WORLD_RESOLUTION = 16;
static bool isAllowedChatCharacter(char ch);
@ -19,16 +19,16 @@ private:
static std::wstring readAcceptableChars();
public:
static const int maxChatLength = 100;
static inline constexpr int maxChatLength = 100;
static std::wstring acceptableLetters;
static const int ILLEGAL_FILE_CHARACTERS_LENGTH = 15;
static inline constexpr int ILLEGAL_FILE_CHARACTERS_LENGTH = 15;
static const wchar_t
ILLEGAL_FILE_CHARACTERS[ILLEGAL_FILE_CHARACTERS_LENGTH];
static const bool
TEXTURE_LIGHTING; // 4J - change brought forward from 1.8.2
static const int TICKS_PER_SECOND = 20;
static inline constexpr int TICKS_PER_SECOND = 20;
static const int FULLBRIGHT_LIGHTVALUE = 15 << 20 | 15 << 4;
static inline constexpr int FULLBRIGHT_LIGHTVALUE = 15 << 20 | 15 << 4;
};

View file

@ -11,30 +11,30 @@ class Entity;
class AddEntityPacket : public Packet,
public std::enable_shared_from_this<AddEntityPacket> {
public:
static const int BOAT = 1;
static const int ITEM = 2;
static const int MINECART = 10;
static const int PRIMED_TNT = 50;
static const int ENDER_CRYSTAL = 51;
static const int ARROW = 60;
static const int SNOWBALL = 61;
static const int EGG = 62;
static const int FIREBALL = 63;
static const int SMALL_FIREBALL = 64;
static const int THROWN_ENDERPEARL = 65;
static const int WITHER_SKULL = 66;
static const int FALLING = 70;
static const int ITEM_FRAME = 71;
static const int EYEOFENDERSIGNAL = 72;
static const int THROWN_POTION = 73;
static const int FALLING_EGG = 74;
static const int THROWN_EXPBOTTLE = 75;
static const int FIREWORKS = 76;
static const int LEASH_KNOT = 77;
static const int FISH_HOOK = 90;
static inline constexpr int BOAT = 1;
static inline constexpr int ITEM = 2;
static inline constexpr int MINECART = 10;
static inline constexpr int PRIMED_TNT = 50;
static inline constexpr int ENDER_CRYSTAL = 51;
static inline constexpr int ARROW = 60;
static inline constexpr int SNOWBALL = 61;
static inline constexpr int EGG = 62;
static inline constexpr int FIREBALL = 63;
static inline constexpr int SMALL_FIREBALL = 64;
static inline constexpr int THROWN_ENDERPEARL = 65;
static inline constexpr int WITHER_SKULL = 66;
static inline constexpr int FALLING = 70;
static inline constexpr int ITEM_FRAME = 71;
static inline constexpr int EYEOFENDERSIGNAL = 72;
static inline constexpr int THROWN_POTION = 73;
static inline constexpr int FALLING_EGG = 74;
static inline constexpr int THROWN_EXPBOTTLE = 75;
static inline constexpr int FIREWORKS = 76;
static inline constexpr int LEASH_KNOT = 77;
static inline constexpr int FISH_HOOK = 90;
// 4J Added TU9
static const int DRAGON_FIRE_BALL = 200;
static inline constexpr int DRAGON_FIRE_BALL = 200;
int id;
int x, y, z;

View file

@ -10,13 +10,13 @@ class Entity;
class AnimatePacket : public Packet,
public std::enable_shared_from_this<AnimatePacket> {
public:
static const int SWING = 1;
static const int HURT = 2;
static const int WAKE_UP = 3;
static const int RESPAWN = 4;
static const int EAT = 5; // 1.8.2
static const int CRITICAL_HIT = 6;
static const int MAGIC_CRITICAL_HIT = 7;
static inline constexpr int SWING = 1;
static inline constexpr int HURT = 2;
static inline constexpr int WAKE_UP = 3;
static inline constexpr int RESPAWN = 4;
static inline constexpr int EAT = 5; // 1.8.2
static inline constexpr int CRITICAL_HIT = 6;
static inline constexpr int MAGIC_CRITICAL_HIT = 7;
int id;
int action;

View file

@ -10,24 +10,24 @@ class ContainerOpenPacket
: public Packet,
public std::enable_shared_from_this<ContainerOpenPacket> {
public:
static const int CONTAINER = 0;
static const int WORKBENCH = 1;
static const int FURNACE = 2;
static const int TRAP = 3;
static const int ENCHANTMENT = 4;
static const int BREWING_STAND = 5;
static const int TRADER_NPC = 6;
static const int BEACON = 7;
static const int REPAIR_TABLE = 8;
static const int HOPPER = 9;
static const int DROPPER = 10;
static const int HORSE = 11;
static const int FIREWORKS = 12; // 4J Added
static const int BONUS_CHEST = 13; // 4J Added
static const int LARGE_CHEST = 14; // 4J Added
static const int ENDER_CHEST = 15; // 4J Added
static const int MINECART_CHEST = 16; // 4J Added
static const int MINECART_HOPPER = 17; // 4J Added
static inline constexpr int CONTAINER = 0;
static inline constexpr int WORKBENCH = 1;
static inline constexpr int FURNACE = 2;
static inline constexpr int TRAP = 3;
static inline constexpr int ENCHANTMENT = 4;
static inline constexpr int BREWING_STAND = 5;
static inline constexpr int TRADER_NPC = 6;
static inline constexpr int BEACON = 7;
static inline constexpr int REPAIR_TABLE = 8;
static inline constexpr int HOPPER = 9;
static inline constexpr int DROPPER = 10;
static inline constexpr int HORSE = 11;
static inline constexpr int FIREWORKS = 12; // 4J Added
static inline constexpr int BONUS_CHEST = 13; // 4J Added
static inline constexpr int LARGE_CHEST = 14; // 4J Added
static inline constexpr int ENDER_CHEST = 15; // 4J Added
static inline constexpr int MINECART_CHEST = 16; // 4J Added
static inline constexpr int MINECART_HOPPER = 17; // 4J Added
int containerId;
int type;

View file

@ -11,8 +11,8 @@ class SetEntityLinkPacket
: public Packet,
public std::enable_shared_from_this<SetEntityLinkPacket> {
public:
static const int RIDING = 0;
static const int LEASH = 1;
static inline constexpr int RIDING = 0;
static inline constexpr int LEASH = 1;
int type;
int sourceId, destId;

View file

@ -9,8 +9,8 @@ class TileEditorOpenPacket
: public Packet,
public std::enable_shared_from_this<TileEditorOpenPacket> {
public:
static const int SIGN = 0;
static const int COMMAND_BLOCK = 1;
static inline constexpr int SIGN = 0;
static inline constexpr int COMMAND_BLOCK = 1;
int editorType;
int x, y, z;

View file

@ -11,10 +11,10 @@ class TileEntityDataPacket
: public Packet,
public std::enable_shared_from_this<TileEntityDataPacket> {
public:
static const int TYPE_MOB_SPAWNER = 1;
static const int TYPE_ADV_COMMAND = 2;
static const int TYPE_BEACON = 3;
static const int TYPE_SKULL = 4;
static inline constexpr int TYPE_MOB_SPAWNER = 1;
static inline constexpr int TYPE_ADV_COMMAND = 2;
static inline constexpr int TYPE_BEACON = 3;
static inline constexpr int TYPE_SKULL = 4;
int x, y, z;
int type;

View file

@ -20,7 +20,7 @@ private:
public:
static const int TYPE_DEFAULT = 0;
static const int TYPE_WITHER = 1;
static inline constexpr int TYPE_WITHER = 1;
private:
RangedAttackGoal* bowGoal;

View file

@ -4,22 +4,22 @@ class MobEffectInstance;
class PotionBrewing {
public:
static const int POTION_ID_SPLASH_DAMAGE = 32732;
static const int POTION_ID_SPLASH_WEAKNESS = 32696;
static const int POTION_ID_SPLASH_SLOWNESS = 32698;
static const int POTION_ID_SPLASH_POISON = 32660;
static const int POTION_ID_HEAL = 16341;
static const int POTION_ID_SWIFTNESS = 16274;
static const int POTION_ID_FIRE_RESISTANCE = 16307;
static inline constexpr int POTION_ID_SPLASH_DAMAGE = 32732;
static inline constexpr int POTION_ID_SPLASH_WEAKNESS = 32696;
static inline constexpr int POTION_ID_SPLASH_SLOWNESS = 32698;
static inline constexpr int POTION_ID_SPLASH_POISON = 32660;
static inline constexpr int POTION_ID_HEAL = 16341;
static inline constexpr int POTION_ID_SWIFTNESS = 16274;
static inline constexpr int POTION_ID_FIRE_RESISTANCE = 16307;
static const bool SIMPLIFIED_BREWING = true;
// 4J Stu - Made #define so we can use it to select const initialisation
#define _SIMPLIFIED_BREWING 1
static const int BREWING_TIME_SECONDS = 20;
static inline constexpr int BREWING_TIME_SECONDS = 20;
static const int THROWABLE_BIT = 14;
static const int THROWABLE_MASK = (1 << THROWABLE_BIT);
static inline constexpr int THROWABLE_BIT = 14;
static inline constexpr int THROWABLE_MASK = (1 << THROWABLE_BIT);
static const std::wstring MOD_WATER;
static const std::wstring MOD_SUGAR;
@ -35,11 +35,11 @@ public:
static const std::wstring MOD_GUNPOWDER;
static const std::wstring MOD_GOLDENCARROT;
static const int BITS_FOR_MAX_NORMAL_EFFECT = 0xF;
static const int BITS_FOR_DURATION = (1 << 5);
static const int BITS_FOR_EXTENDED = (1 << 6);
static const int BITS_FOR_NORMAL = (1 << 13);
static const int BITS_FOR_SPLASH = (1 << 14);
static inline constexpr int BITS_FOR_MAX_NORMAL_EFFECT = 0xF;
static inline constexpr int BITS_FOR_DURATION = (1 << 5);
static inline constexpr int BITS_FOR_EXTENDED = (1 << 6);
static inline constexpr int BITS_FOR_NORMAL = (1 << 13);
static inline constexpr int BITS_FOR_SPLASH = (1 << 14);
private:
typedef std::unordered_map<int, std::wstring> intStringMap;
@ -49,13 +49,13 @@ private:
public:
static void staticCtor();
static const int NUM_BITS = 15;
static inline constexpr int NUM_BITS = 15;
// 4J Stu - Made public
static const int BREW_MASK = 0x7fff;
static inline constexpr int BREW_MASK = 0x7fff;
private:
static const int TOP_BIT = 0x4000;
static inline constexpr int TOP_BIT = 0x4000;
static bool isWrappedLit(int brew, int position);
@ -85,10 +85,10 @@ public:
static int getAppearanceName(int brew);
private:
static const int NO_COUNT = -1;
static const int EQUAL_COUNT = 0;
static const int GREATER_COUNT = 1;
static const int LESS_COUNT = 2;
static inline constexpr int NO_COUNT = -1;
static inline constexpr int EQUAL_COUNT = 0;
static inline constexpr int GREATER_COUNT = 1;
static inline constexpr int LESS_COUNT = 2;
static int constructParsedValue(bool isNot, bool hasMultiplier, bool isNeg,
int countCompare, int valuePart,

View file

@ -12,7 +12,7 @@ public:
public:
static const int TYPE_SKELETON = 0;
static const int TYPE_WITHER = 1;
static inline constexpr int TYPE_WITHER = 1;
static const int TYPE_ZOMBIE = 2;
static const int TYPE_CHAR = 3;
static const int TYPE_CREEPER = 4;

View file

@ -8,7 +8,6 @@
#include "java/IntBuffer.h"
#include "java/FloatBuffer.h"
#include "java/ByteBuffer.h"
#include "/home/tropical/Documents/GitHub/4jcraft/minecraft/Minecraft.World/ConsoleHelpers/Definitions.h"
#include "java/Buffer.h"
ByteBuffer::ByteBuffer(unsigned int capacity) : Buffer(capacity) {