refactor: decouple minecraft/ from app/ via IGameServices virtual interface

This commit is contained in:
MatthewBeshay 2026-04-06 16:14:25 +10:00 committed by Tropical
parent 7787015025
commit 5d9bcac156
246 changed files with 1897 additions and 2224 deletions

View file

@ -0,0 +1,463 @@
#include "app/common/AppGameServices.h"
#include "app/common/Game.h"
#include "java/Class.h" // eINSTANCEOF
AppGameServices::AppGameServices(Game& game, IMenuService& menus)
: game_(game), menus_(menus) {}
// -- Strings --
const wchar_t* AppGameServices::getString(int id) {
return Game::GetString(id);
}
// -- Debug settings --
bool AppGameServices::debugSettingsOn() {
return game_.DebugSettingsOn();
}
bool AppGameServices::debugArtToolsOn() {
return game_.DebugArtToolsOn();
}
unsigned int AppGameServices::debugGetMask(int iPad, bool overridePlayer) {
return game_.GetGameSettingsDebugMask(iPad, overridePlayer);
}
bool AppGameServices::debugMobsDontAttack() {
return game_.GetMobsDontAttackEnabled();
}
bool AppGameServices::debugMobsDontTick() {
return game_.GetMobsDontTickEnabled();
}
bool AppGameServices::debugFreezePlayers() {
return game_.GetFreezePlayers();
}
// -- Game host options --
unsigned int AppGameServices::getGameHostOption(eGameHostOption option) {
return game_.GetGameHostOption(option);
}
void AppGameServices::setGameHostOption(eGameHostOption option,
unsigned int value) {
game_.SetGameHostOption(option, value);
}
// -- Level generation --
LevelGenerationOptions* AppGameServices::getLevelGenerationOptions() {
return game_.getLevelGenerationOptions();
}
LevelRuleset* AppGameServices::getGameRuleDefinitions() {
return game_.getGameRuleDefinitions();
}
// -- Texture cache --
void AppGameServices::addMemoryTextureFile(const std::wstring& name,
std::uint8_t* data,
unsigned int size) {
game_.AddMemoryTextureFile(name, data, size);
}
void AppGameServices::removeMemoryTextureFile(const std::wstring& name) {
game_.RemoveMemoryTextureFile(name);
}
void AppGameServices::getMemFileDetails(const std::wstring& name,
std::uint8_t** data,
unsigned int* size) {
game_.GetMemFileDetails(name, data, size);
}
bool AppGameServices::isFileInMemoryTextures(const std::wstring& name) {
return game_.IsFileInMemoryTextures(name);
}
// -- Player settings --
unsigned char AppGameServices::getGameSettings(int iPad, int setting) {
return game_.GetGameSettings(iPad, static_cast<eGameSetting>(setting));
}
unsigned char AppGameServices::getGameSettings(int setting) {
return game_.GetGameSettings(static_cast<eGameSetting>(setting));
}
// -- App time --
float AppGameServices::getAppTime() {
return game_.getAppTime();
}
// -- Game state --
bool AppGameServices::getGameStarted() { return game_.GetGameStarted(); }
void AppGameServices::setGameStarted(bool val) { game_.SetGameStarted(val); }
bool AppGameServices::getTutorialMode() { return game_.GetTutorialMode(); }
void AppGameServices::setTutorialMode(bool val) { game_.SetTutorialMode(val); }
bool AppGameServices::isAppPaused() { return game_.IsAppPaused(); }
int AppGameServices::getLocalPlayerCount() { return game_.GetLocalPlayerCount(); }
bool AppGameServices::autosaveDue() { return game_.AutosaveDue(); }
void AppGameServices::setAutosaveTimerTime() { game_.SetAutosaveTimerTime(); }
int64_t AppGameServices::secondsToAutosave() { return game_.SecondsToAutosave(); }
void AppGameServices::setDisconnectReason(
DisconnectPacket::eDisconnectReason reason) {
game_.SetDisconnectReason(reason);
}
void AppGameServices::lockSaveNotification() { game_.lockSaveNotification(); }
void AppGameServices::unlockSaveNotification() { game_.unlockSaveNotification(); }
bool AppGameServices::getResetNether() { return game_.GetResetNether(); }
bool AppGameServices::getUseDPadForDebug() { return game_.GetUseDPadForDebug(); }
bool AppGameServices::getWriteSavesToFolderEnabled() {
return game_.GetWriteSavesToFolderEnabled();
}
bool AppGameServices::isLocalMultiplayerAvailable() {
return game_.IsLocalMultiplayerAvailable();
}
bool AppGameServices::dlcInstallPending() {
return game_.DLCInstallPending();
}
bool AppGameServices::dlcInstallProcessCompleted() {
return game_.DLCInstallProcessCompleted();
}
bool AppGameServices::canRecordStatsAndAchievements() {
return game_.CanRecordStatsAndAchievements();
}
bool AppGameServices::getTMSGlobalFileListRead() {
return game_.GetTMSGlobalFileListRead();
}
void AppGameServices::setRequiredTexturePackID(std::uint32_t id) {
game_.SetRequiredTexturePackID(id);
}
void AppGameServices::setSpecialTutorialCompletionFlag(int iPad, int index) {
game_.SetSpecialTutorialCompletionFlag(iPad, index);
}
void AppGameServices::setBanListCheck(int iPad, bool val) {
game_.SetBanListCheck(iPad, val);
}
bool AppGameServices::getBanListCheck(int iPad) {
return game_.GetBanListCheck(iPad);
}
unsigned int AppGameServices::getGameNewWorldSize() {
return game_.GetGameNewWorldSize();
}
unsigned int AppGameServices::getGameNewWorldSizeUseMoat() {
return game_.GetGameNewWorldSizeUseMoat();
}
unsigned int AppGameServices::getGameNewHellScale() {
return game_.GetGameNewHellScale();
}
// -- UI dispatch --
void AppGameServices::setAction(int iPad, eXuiAction action, void* param) {
game_.SetAction(iPad, action, param);
}
void AppGameServices::setXuiServerAction(int iPad, eXuiServerAction action,
void* param) {
game_.SetXuiServerAction(iPad, action, param);
}
eXuiAction AppGameServices::getXuiAction(int iPad) {
return game_.GetXuiAction(iPad);
}
eXuiServerAction AppGameServices::getXuiServerAction(int iPad) {
return game_.GetXuiServerAction(iPad);
}
void* AppGameServices::getXuiServerActionParam(int iPad) {
return game_.GetXuiServerActionParam(iPad);
}
void AppGameServices::setGlobalXuiAction(eXuiAction action) {
game_.SetGlobalXuiAction(action);
}
void AppGameServices::handleButtonPresses() {
game_.HandleButtonPresses();
}
void AppGameServices::setTMSAction(int iPad, eTMSAction action) {
game_.SetTMSAction(iPad, action);
}
// -- Skin / cape / animation --
std::wstring AppGameServices::getPlayerSkinName(int iPad) {
return game_.GetPlayerSkinName(iPad);
}
std::uint32_t AppGameServices::getPlayerSkinId(int iPad) {
return game_.GetPlayerSkinId(iPad);
}
std::wstring AppGameServices::getPlayerCapeName(int iPad) {
return game_.GetPlayerCapeName(iPad);
}
std::uint32_t AppGameServices::getPlayerCapeId(int iPad) {
return game_.GetPlayerCapeId(iPad);
}
std::uint32_t AppGameServices::getAdditionalModelPartsForPad(int iPad) {
return game_.GetAdditionalModelParts(iPad);
}
void AppGameServices::setAdditionalSkinBoxes(std::uint32_t dwSkinID,
SKIN_BOX* boxA,
unsigned int boxC) {
game_.SetAdditionalSkinBoxes(dwSkinID, boxA, boxC);
}
std::vector<SKIN_BOX*>* AppGameServices::getAdditionalSkinBoxes(
std::uint32_t dwSkinID) {
return game_.GetAdditionalSkinBoxes(dwSkinID);
}
std::vector<ModelPart*>* AppGameServices::getAdditionalModelParts(
std::uint32_t dwSkinID) {
return game_.GetAdditionalModelParts(dwSkinID);
}
std::vector<ModelPart*>* AppGameServices::setAdditionalSkinBoxesFromVec(
std::uint32_t dwSkinID, std::vector<SKIN_BOX*>* pvSkinBoxA) {
return game_.SetAdditionalSkinBoxes(dwSkinID, pvSkinBoxA);
}
void AppGameServices::setAnimOverrideBitmask(std::uint32_t dwSkinID,
unsigned int bitmask) {
game_.SetAnimOverrideBitmask(dwSkinID, bitmask);
}
unsigned int AppGameServices::getAnimOverrideBitmask(
std::uint32_t dwSkinID) {
return game_.GetAnimOverrideBitmask(dwSkinID);
}
std::uint32_t AppGameServices::getSkinIdFromPath(const std::wstring& skin) {
return Game::getSkinIdFromPath(skin);
}
std::wstring AppGameServices::getSkinPathFromId(std::uint32_t skinId) {
return Game::getSkinPathFromId(skinId);
}
bool AppGameServices::defaultCapeExists() {
return game_.DefaultCapeExists();
}
bool AppGameServices::isXuidNotch(PlayerUID xuid) {
return game_.isXuidNotch(xuid);
}
bool AppGameServices::isXuidDeadmau5(PlayerUID xuid) {
return game_.isXuidDeadmau5(xuid);
}
// -- Platform features --
void AppGameServices::fatalLoadError() { game_.FatalLoadError(); }
void AppGameServices::setRichPresenceContext(int iPad, int contextId) {
game_.SetRichPresenceContext(iPad, contextId);
}
void AppGameServices::captureSaveThumbnail() { game_.CaptureSaveThumbnail(); }
void AppGameServices::getSaveThumbnail(std::uint8_t** data,
unsigned int* size) {
game_.GetSaveThumbnail(data, size);
}
void AppGameServices::readBannedList(int iPad, eTMSAction action,
bool bCallback) {
game_.ReadBannedList(iPad, action, bCallback);
}
void AppGameServices::updatePlayerInfo(std::uint8_t networkSmallId,
int16_t playerColourIndex,
unsigned int playerPrivileges) {
game_.UpdatePlayerInfo(networkSmallId, playerColourIndex, playerPrivileges);
}
unsigned int AppGameServices::getPlayerPrivileges(
std::uint8_t networkSmallId) {
return game_.GetPlayerPrivileges(networkSmallId);
}
void AppGameServices::setGameSettingsDebugMask(int iPad, unsigned int uiVal) {
game_.SetGameSettingsDebugMask(iPad, uiVal);
}
// -- Schematics / terrain --
void AppGameServices::processSchematics(LevelChunk* chunk) {
game_.processSchematics(chunk);
}
void AppGameServices::processSchematicsLighting(LevelChunk* chunk) {
game_.processSchematicsLighting(chunk);
}
void AppGameServices::addTerrainFeaturePosition(_eTerrainFeatureType type,
int x, int z) {
game_.AddTerrainFeaturePosition(type, x, z);
}
bool AppGameServices::getTerrainFeaturePosition(_eTerrainFeatureType type,
int* pX, int* pZ) {
return game_.GetTerrainFeaturePosition(type, pX, pZ);
}
void AppGameServices::loadDefaultGameRules() {
game_.loadDefaultGameRules();
}
// -- Archive / resources --
bool AppGameServices::hasArchiveFile(const std::wstring& filename) {
return game_.hasArchiveFile(filename);
}
std::vector<std::uint8_t> AppGameServices::getArchiveFile(
const std::wstring& filename) {
return game_.getArchiveFile(filename);
}
// -- Strings / formatting / misc queries --
int AppGameServices::getHTMLColour(eMinecraftColour colour) {
return game_.GetHTMLColour(colour);
}
std::wstring AppGameServices::getEntityName(EntityTypeId type) {
return game_.getEntityName(static_cast<eINSTANCEOF>(type));
}
const wchar_t* AppGameServices::getGameRulesString(const std::wstring& key) {
return game_.GetGameRulesString(key);
}
unsigned int AppGameServices::createImageTextData(std::uint8_t* textMetadata,
int64_t seed, bool hasSeed,
unsigned int uiHostOptions,
unsigned int uiTexturePackId) {
return game_.CreateImageTextData(textMetadata, seed, hasSeed,
uiHostOptions, uiTexturePackId);
}
std::wstring AppGameServices::getFilePath(std::uint32_t packId,
std::wstring filename,
bool bAddDataFolder,
std::wstring mountPoint) {
return game_.getFilePath(packId, filename, bAddDataFolder, mountPoint);
}
char* AppGameServices::getUniqueMapName() {
return game_.GetUniqueMapName();
}
void AppGameServices::setUniqueMapName(char* name) {
game_.SetUniqueMapName(name);
}
unsigned int AppGameServices::getOpacityTimer(int iPad) {
return game_.GetOpacityTimer(iPad);
}
void AppGameServices::setOpacityTimer(int iPad) {
game_.SetOpacityTimer(iPad);
}
void AppGameServices::tickOpacityTimer(int iPad) {
game_.TickOpacityTimer(iPad);
}
bool AppGameServices::isInBannedLevelList(int iPad, PlayerUID xuid,
char* levelName) {
return game_.IsInBannedLevelList(iPad, xuid, levelName);
}
MOJANG_DATA* AppGameServices::getMojangDataForXuid(PlayerUID xuid) {
return game_.GetMojangDataForXuid(xuid);
}
void AppGameServices::debugPrintf(const char* msg) {
game_.DebugPrintf("%s", msg);
}
// -- DLC --
DLCSkinFile* AppGameServices::getDLCSkinFile(const std::wstring& name) {
return game_.m_dlcManager.getSkinFile(name);
}
bool AppGameServices::dlcNeedsCorruptCheck() {
return game_.m_dlcManager.NeedsCorruptCheck();
}
unsigned int AppGameServices::dlcCheckForCorrupt(bool showMessage) {
return game_.m_dlcManager.checkForCorruptDLCAndAlert(showMessage);
}
bool AppGameServices::dlcReadDataFile(unsigned int& filesProcessed,
const std::wstring& path,
DLCPack* pack, bool fromArchive) {
return game_.m_dlcManager.readDLCDataFile(filesProcessed, path, pack,
fromArchive);
}
void AppGameServices::dlcRemovePack(DLCPack* pack) {
game_.m_dlcManager.removePack(pack);
}
// -- Game rules --
LevelGenerationOptions* AppGameServices::loadGameRules(std::uint8_t* data,
unsigned int size) {
return game_.m_gameRules.loadGameRules(data, size);
}
void AppGameServices::saveGameRules(std::uint8_t** data, unsigned int* size) {
game_.m_gameRules.saveGameRules(data, size);
}
void AppGameServices::unloadCurrentGameRules() {
game_.m_gameRules.unloadCurrentGameRules();
}
void AppGameServices::setLevelGenerationOptions(LevelGenerationOptions* levelGen) {
game_.m_gameRules.setLevelGenerationOptions(levelGen);
}
// -- Shared data --
std::vector<std::wstring>& AppGameServices::getSkinNames() {
return game_.vSkinNames;
}
std::vector<FEATURE_DATA*>& AppGameServices::getTerrainFeatures() {
return *game_.m_terrainFeatureManager.features();
}
// -- Menu service --
IMenuService& AppGameServices::menus() { return menus_; }

View file

@ -0,0 +1,185 @@
#pragma once
#include "minecraft/IGameServices.h"
class Game;
class IMenuService;
class AppGameServices : public IGameServices {
public:
AppGameServices(Game& game, IMenuService& menus);
// -- Strings --
const wchar_t* getString(int id) override;
// -- Debug settings --
bool debugSettingsOn() override;
bool debugArtToolsOn() override;
unsigned int debugGetMask(int iPad, bool overridePlayer) override;
bool debugMobsDontAttack() override;
bool debugMobsDontTick() override;
bool debugFreezePlayers() override;
// -- Game host options --
unsigned int getGameHostOption(eGameHostOption option) override;
void setGameHostOption(eGameHostOption option,
unsigned int value) override;
// -- Level generation --
LevelGenerationOptions* getLevelGenerationOptions() override;
LevelRuleset* getGameRuleDefinitions() override;
// -- Texture cache --
void addMemoryTextureFile(const std::wstring& name, std::uint8_t* data,
unsigned int size) override;
void removeMemoryTextureFile(const std::wstring& name) override;
void getMemFileDetails(const std::wstring& name, std::uint8_t** data,
unsigned int* size) override;
bool isFileInMemoryTextures(const std::wstring& name) override;
// -- Player settings --
unsigned char getGameSettings(int iPad, int setting) override;
unsigned char getGameSettings(int setting) override;
// -- App time --
float getAppTime() override;
// -- Game state --
bool getGameStarted() override;
void setGameStarted(bool val) override;
bool getTutorialMode() override;
void setTutorialMode(bool val) override;
bool isAppPaused() override;
int getLocalPlayerCount() override;
bool autosaveDue() override;
void setAutosaveTimerTime() override;
int64_t secondsToAutosave() override;
void setDisconnectReason(
DisconnectPacket::eDisconnectReason reason) override;
void lockSaveNotification() override;
void unlockSaveNotification() override;
bool getResetNether() override;
bool getUseDPadForDebug() override;
bool getWriteSavesToFolderEnabled() override;
bool isLocalMultiplayerAvailable() override;
bool dlcInstallPending() override;
bool dlcInstallProcessCompleted() override;
bool canRecordStatsAndAchievements() override;
bool getTMSGlobalFileListRead() override;
void setRequiredTexturePackID(std::uint32_t id) override;
void setSpecialTutorialCompletionFlag(int iPad, int index) override;
void setBanListCheck(int iPad, bool val) override;
bool getBanListCheck(int iPad) override;
unsigned int getGameNewWorldSize() override;
unsigned int getGameNewWorldSizeUseMoat() override;
unsigned int getGameNewHellScale() override;
// -- UI dispatch --
void setAction(int iPad, eXuiAction action, void* param) override;
void setXuiServerAction(int iPad, eXuiServerAction action,
void* param) override;
eXuiAction getXuiAction(int iPad) override;
eXuiServerAction getXuiServerAction(int iPad) override;
void* getXuiServerActionParam(int iPad) override;
void setGlobalXuiAction(eXuiAction action) override;
void handleButtonPresses() override;
void setTMSAction(int iPad, eTMSAction action) override;
// -- Skin / cape / animation --
std::wstring getPlayerSkinName(int iPad) override;
std::uint32_t getPlayerSkinId(int iPad) override;
std::wstring getPlayerCapeName(int iPad) override;
std::uint32_t getPlayerCapeId(int iPad) override;
std::uint32_t getAdditionalModelPartsForPad(int iPad) override;
void setAdditionalSkinBoxes(std::uint32_t dwSkinID, SKIN_BOX* boxA,
unsigned int boxC) override;
std::vector<SKIN_BOX*>* getAdditionalSkinBoxes(
std::uint32_t dwSkinID) override;
std::vector<ModelPart*>* getAdditionalModelParts(
std::uint32_t dwSkinID) override;
std::vector<ModelPart*>* setAdditionalSkinBoxesFromVec(
std::uint32_t dwSkinID, std::vector<SKIN_BOX*>* pvSkinBoxA) override;
void setAnimOverrideBitmask(std::uint32_t dwSkinID,
unsigned int bitmask) override;
unsigned int getAnimOverrideBitmask(std::uint32_t dwSkinID) override;
std::uint32_t getSkinIdFromPath(const std::wstring& skin) override;
std::wstring getSkinPathFromId(std::uint32_t skinId) override;
bool defaultCapeExists() override;
bool isXuidNotch(PlayerUID xuid) override;
bool isXuidDeadmau5(PlayerUID xuid) override;
// -- Platform features --
void fatalLoadError() override;
void setRichPresenceContext(int iPad, int contextId) override;
void captureSaveThumbnail() override;
void getSaveThumbnail(std::uint8_t** data, unsigned int* size) override;
void readBannedList(int iPad, eTMSAction action,
bool bCallback) override;
void updatePlayerInfo(std::uint8_t networkSmallId,
int16_t playerColourIndex,
unsigned int playerPrivileges) override;
unsigned int getPlayerPrivileges(std::uint8_t networkSmallId) override;
void setGameSettingsDebugMask(int iPad, unsigned int uiVal) override;
// -- Schematics / terrain --
void processSchematics(LevelChunk* chunk) override;
void processSchematicsLighting(LevelChunk* chunk) override;
void addTerrainFeaturePosition(_eTerrainFeatureType type, int x,
int z) override;
bool getTerrainFeaturePosition(_eTerrainFeatureType type, int* pX,
int* pZ) override;
void loadDefaultGameRules() override;
// -- Archive / resources --
bool hasArchiveFile(const std::wstring& filename) override;
std::vector<std::uint8_t> getArchiveFile(
const std::wstring& filename) override;
// -- Strings / formatting / misc queries --
int getHTMLColour(eMinecraftColour colour) override;
std::wstring getEntityName(EntityTypeId type) override;
const wchar_t* getGameRulesString(const std::wstring& key) override;
unsigned int createImageTextData(std::uint8_t* textMetadata,
int64_t seed, bool hasSeed,
unsigned int uiHostOptions,
unsigned int uiTexturePackId) override;
std::wstring getFilePath(std::uint32_t packId, std::wstring filename,
bool bAddDataFolder,
std::wstring mountPoint) override;
char* getUniqueMapName() override;
void setUniqueMapName(char* name) override;
unsigned int getOpacityTimer(int iPad) override;
void setOpacityTimer(int iPad) override;
void tickOpacityTimer(int iPad) override;
bool isInBannedLevelList(int iPad, PlayerUID xuid,
char* levelName) override;
MOJANG_DATA* getMojangDataForXuid(PlayerUID xuid) override;
void debugPrintf(const char* msg) override;
// -- DLC --
DLCSkinFile* getDLCSkinFile(const std::wstring& name) override;
bool dlcNeedsCorruptCheck() override;
unsigned int dlcCheckForCorrupt(bool showMessage) override;
bool dlcReadDataFile(unsigned int& filesProcessed,
const std::wstring& path, DLCPack* pack,
bool fromArchive) override;
void dlcRemovePack(DLCPack* pack) override;
// -- Game rules --
LevelGenerationOptions* loadGameRules(std::uint8_t* data,
unsigned int size) override;
void saveGameRules(std::uint8_t** data, unsigned int* size) override;
void unloadCurrentGameRules() override;
void setLevelGenerationOptions(LevelGenerationOptions* levelGen) override;
// -- Shared data --
std::vector<std::wstring>& getSkinNames() override;
std::vector<FEATURE_DATA*>& getTerrainFeatures() override;
// -- Menu service --
IMenuService& menus() override;
private:
Game& game_;
IMenuService& menus_;
};

View file

@ -4,11 +4,12 @@
#include "platform/sdl2/Storage.h" #include "platform/sdl2/Storage.h"
#include "app/common/App_Defines.h" #include "app/common/App_Defines.h"
#include "app/common/App_enums.h" #include "minecraft/GameEnums.h"
#include "minecraft/GameTypes.h"
#include "app/common/Tutorial/TutorialEnum.h" #include "app/common/Tutorial/TutorialEnum.h"
#include "app/common/UI/All Platforms/UIEnums.h" #include "app/common/UI/All Platforms/UIEnums.h"
#include "platform/NetTypes.h" #include "platform/NetTypes.h"
#include "minecraft/client/SkinBox.h" #include "minecraft/client/model/SkinBox.h"
#include "platform/XboxStubs.h" #include "platform/XboxStubs.h"
typedef struct { typedef struct {
@ -144,12 +145,6 @@ typedef struct {
int uiStringID; int uiStringID;
} TIPSTRUCT; } TIPSTRUCT;
typedef struct {
eXUID eXuid;
wchar_t wchCape[MAX_CAPENAME_SIZE];
wchar_t wchSkin[MAX_CAPENAME_SIZE];
} MOJANG_DATA;
typedef struct { typedef struct {
eDLCContentType eDLCType; eDLCContentType eDLCType;
@ -162,11 +157,6 @@ typedef struct {
unsigned int uiSortIndex; unsigned int uiSortIndex;
} DLC_INFO; } DLC_INFO;
typedef struct {
int x, z;
_eTerrainFeatureType eTerrainFeature;
} FEATURE_DATA;
// banned list // banned list
typedef struct { typedef struct {
std::uint8_t* pBannedList; std::uint8_t* pBannedList;

View file

@ -4,7 +4,7 @@
#include <utility> #include <utility>
#include <vector> #include <vector>
#include "app/common/App_enums.h" #include "minecraft/GameEnums.h"
#include "util/StringHelpers.h" #include "util/StringHelpers.h"
#include "java/InputOutputStream/ByteArrayInputStream.h" #include "java/InputOutputStream/ByteArrayInputStream.h"
#include "java/InputOutputStream/DataInputStream.h" #include "java/InputOutputStream/DataInputStream.h"

View file

@ -3,7 +3,7 @@
#include <string> #include <string>
#include <unordered_map> #include <unordered_map>
#include "app/common/App_enums.h" #include "minecraft/GameEnums.h"
class ColourTable { class ColourTable {
private: private:

View file

@ -7,7 +7,7 @@
#include "DLCManager.h" #include "DLCManager.h"
#include "app/common/DLC/DLCFile.h" #include "app/common/DLC/DLCFile.h"
#include "app/linux/LinuxGame.h" #include "app/linux/LinuxGame.h"
#include "minecraft/client/SkinBox.h" #include "minecraft/client/model/SkinBox.h"
#include "platform/XboxStubs.h" #include "platform/XboxStubs.h"
DLCSkinFile::DLCSkinFile(const std::wstring& path) DLCSkinFile::DLCSkinFile(const std::wstring& path)

View file

@ -6,7 +6,7 @@
#include "DLCFile.h" #include "DLCFile.h"
#include "app/common/DLC/DLCManager.h" #include "app/common/DLC/DLCManager.h"
#include "minecraft/client/SkinBox.h" #include "minecraft/client/model/SkinBox.h"
#include "minecraft/client/model/HumanoidModel.h" #include "minecraft/client/model/HumanoidModel.h"
class DLCSkinFile : public DLCFile { class DLCSkinFile : public DLCFile {

View file

@ -7,7 +7,7 @@
#include "platform/sdl2/Render.h" #include "platform/sdl2/Render.h"
#include "platform/sdl2/Storage.h" #include "platform/sdl2/Storage.h"
#include "app/common/App_Defines.h" #include "app/common/App_Defines.h"
#include "app/common/App_enums.h" #include "minecraft/GameEnums.h"
#include "app/common/App_structs.h" #include "app/common/App_structs.h"
#include "app/common/Console_Debug_enum.h" #include "app/common/Console_Debug_enum.h"
#include "app/common/DLC/DLCManager.h" #include "app/common/DLC/DLCManager.h"
@ -23,7 +23,7 @@
#include "app/linux/Linux_UIController.h" #include "app/linux/Linux_UIController.h"
#include "app/linux/Stubs/winapi_stubs.h" #include "app/linux/Stubs/winapi_stubs.h"
#include "platform/NetTypes.h" #include "platform/NetTypes.h"
#include "minecraft/client/SkinBox.h" #include "minecraft/client/model/SkinBox.h"
#include "platform/XboxStubs.h" #include "platform/XboxStubs.h"
#include "platform/PlatformServices.h" #include "platform/PlatformServices.h"
#include "java/Class.h" #include "java/Class.h"
@ -114,8 +114,6 @@ const float Game::fSafeZoneX = 64.0f; // 5% of 1280
const float Game::fSafeZoneY = 36.0f; // 5% of 720 const float Game::fSafeZoneY = 36.0f; // 5% of 720
Game::Game() { Game::Game() {
GameHostOptions::init(&m_uiGameHostSettings);
if (GAME_SETTINGS_PROFILE_DATA_BYTES != sizeof(GAME_SETTINGS)) { if (GAME_SETTINGS_PROFILE_DATA_BYTES != sizeof(GAME_SETTINGS)) {
DebugPrintf( DebugPrintf(
"WARNING: The size of the profile GAME_SETTINGS struct has " "WARNING: The size of the profile GAME_SETTINGS struct has "
@ -414,12 +412,12 @@ void Game::FatalLoadError() {}
void Game::SetGameHostOption(eGameHostOption eVal, void Game::SetGameHostOption(eGameHostOption eVal,
unsigned int uiVal) { unsigned int uiVal) {
GameHostOptions::set(eVal, uiVal); GameHostOptions::set(m_uiGameHostSettings, eVal, uiVal);
} }
unsigned int Game::GetGameHostOption(eGameHostOption eVal) { unsigned int Game::GetGameHostOption(eGameHostOption eVal) {
return GameHostOptions::get(eVal); return GameHostOptions::get(m_uiGameHostSettings, eVal);
} }

View file

@ -31,7 +31,7 @@
#include "app/common/UI/All Platforms/ArchiveFile.h" #include "app/common/UI/All Platforms/ArchiveFile.h"
#include "app/common/UI/All Platforms/UIStructs.h" #include "app/common/UI/All Platforms/UIStructs.h"
#include "platform/NetTypes.h" #include "platform/NetTypes.h"
#include "minecraft/client/SkinBox.h" #include "minecraft/client/model/SkinBox.h"
#include "platform/XboxStubs.h" #include "platform/XboxStubs.h"
#include "minecraft/network/packet/DisconnectPacket.h" #include "minecraft/network/packet/DisconnectPacket.h"
#include "minecraft/world/entity/item/MinecartHopper.h" #include "minecraft/world/entity/item/MinecartHopper.h"

View file

@ -6,7 +6,7 @@
#include <unordered_set> #include <unordered_set>
#include <utility> #include <utility>
#include "app/common/App_enums.h" #include "minecraft/GameEnums.h"
#include "app/common/DLC/DLCGameRulesHeader.h" #include "app/common/DLC/DLCGameRulesHeader.h"
#include "app/common/DLC/DLCManager.h" #include "app/common/DLC/DLCManager.h"
#include "app/common/DLC/DLCPack.h" #include "app/common/DLC/DLCPack.h"

View file

@ -2,7 +2,7 @@
#include "app/common/Game.h" #include "app/common/Game.h"
#include "app/common/App_Defines.h" #include "app/common/App_Defines.h"
#include "app/common/App_enums.h" #include "minecraft/GameEnums.h"
#include "app/common/Console_Debug_enum.h" #include "app/common/Console_Debug_enum.h"
#include "app/common/Network/GameNetworkManager.h" #include "app/common/Network/GameNetworkManager.h"
#include "app/common/UI/All Platforms/UIEnums.h" #include "app/common/UI/All Platforms/UIEnums.h"

View file

@ -7,7 +7,7 @@
#include "platform/sdl2/Render.h" #include "platform/sdl2/Render.h"
#include "platform/sdl2/Storage.h" #include "platform/sdl2/Storage.h"
#include "app/common/App_Defines.h" #include "app/common/App_Defines.h"
#include "app/common/App_enums.h" #include "minecraft/GameEnums.h"
#include "app/common/App_structs.h" #include "app/common/App_structs.h"
#include "app/common/Console_Debug_enum.h" #include "app/common/Console_Debug_enum.h"
#include "app/common/DLC/DLCManager.h" #include "app/common/DLC/DLCManager.h"
@ -23,7 +23,7 @@
#include "app/linux/Linux_UIController.h" #include "app/linux/Linux_UIController.h"
#include "app/linux/Stubs/winapi_stubs.h" #include "app/linux/Stubs/winapi_stubs.h"
#include "platform/NetTypes.h" #include "platform/NetTypes.h"
#include "minecraft/client/SkinBox.h" #include "minecraft/client/model/SkinBox.h"
#include "platform/XboxStubs.h" #include "platform/XboxStubs.h"
#include "platform/PlatformServices.h" #include "platform/PlatformServices.h"
#include "java/Class.h" #include "java/Class.h"

View file

@ -2,7 +2,7 @@
#include <cstdint> #include <cstdint>
#include "app/common/App_enums.h" #include "minecraft/GameEnums.h"
class IPlatformGame { class IPlatformGame {
public: public:

View file

@ -6,7 +6,7 @@
#include <string> #include <string>
#include "app/common/App_enums.h" #include "minecraft/GameEnums.h"
#include "app/common/App_structs.h" #include "app/common/App_structs.h"
#include "app/common/Localisation/StringTable.h" #include "app/common/Localisation/StringTable.h"
#include "app/common/Colours/ColourTable.h" #include "app/common/Colours/ColourTable.h"

View file

@ -5,7 +5,7 @@
#include <unordered_map> #include <unordered_map>
#include <vector> #include <vector>
#include "app/common/App_enums.h" #include "minecraft/GameEnums.h"
#include "app/common/App_structs.h" #include "app/common/App_structs.h"
#include "platform/XboxStubs.h" #include "platform/XboxStubs.h"

View file

@ -13,7 +13,7 @@
#include "platform/sdl2/Profile.h" #include "platform/sdl2/Profile.h"
#include "platform/sdl2/Render.h" #include "platform/sdl2/Render.h"
#include "platform/sdl2/Storage.h" #include "platform/sdl2/Storage.h"
#include "app/common/App_enums.h" #include "minecraft/GameEnums.h"
#include "app/common/Game.h" #include "app/common/Game.h"
#include "app/common/GameRules/GameRuleManager.h" #include "app/common/GameRules/GameRuleManager.h"
#include "app/common/GameRules/LevelGeneration/LevelGenerationOptions.h" #include "app/common/GameRules/LevelGeneration/LevelGenerationOptions.h"

View file

@ -6,7 +6,7 @@
#include <qnet.h> #include <qnet.h>
#endif #endif
#include "platform/NetTypes.h" #include "platform/NetTypes.h"
#include "minecraft/client/SkinBox.h" #include "minecraft/client/model/SkinBox.h"
#include "NetworkPlayerInterface.h" #include "NetworkPlayerInterface.h"
#include "SessionInfo.h" #include "SessionInfo.h"
#include "platform/C4JThread.h" #include "platform/C4JThread.h"

View file

@ -6,7 +6,7 @@
#include "platform/PlatformTypes.h" #include "platform/PlatformTypes.h"
#include "platform/NetTypes.h" #include "platform/NetTypes.h"
#include "minecraft/client/SkinBox.h" #include "minecraft/client/model/SkinBox.h"
#include "platform/XboxStubs.h" #include "platform/XboxStubs.h"
#include "NetworkPlayerInterface.h" #include "NetworkPlayerInterface.h"
#include "platform/IPlatformNetwork.h" #include "platform/IPlatformNetwork.h"

View file

@ -7,7 +7,7 @@
#include <vector> #include <vector>
#include "app/common/App_structs.h" #include "app/common/App_structs.h"
#include "minecraft/client/SkinBox.h" #include "minecraft/client/model/SkinBox.h"
#include "platform/XboxStubs.h" #include "platform/XboxStubs.h"
class ModelPart; class ModelPart;

View file

@ -2,7 +2,7 @@
#include <vector> #include <vector>
#include "app/common/App_enums.h" #include "minecraft/GameEnums.h"
#include "app/common/App_structs.h" #include "app/common/App_structs.h"
class TerrainFeatureManager { class TerrainFeatureManager {

View file

@ -7,7 +7,7 @@
#include <vector> #include <vector>
#include "platform/sdl2/Input.h" #include "platform/sdl2/Input.h"
#include "app/common/App_enums.h" #include "minecraft/GameEnums.h"
#include "app/common/Tutorial/Constraints/InputConstraint.h" #include "app/common/Tutorial/Constraints/InputConstraint.h"
#include "app/common/Tutorial/Tasks/TutorialTask.h" #include "app/common/Tutorial/Tasks/TutorialTask.h"
#include "app/linux/LinuxGame.h" #include "app/linux/LinuxGame.h"

View file

@ -8,7 +8,7 @@
#include "platform/InputActions.h" #include "platform/InputActions.h"
#include "platform/sdl2/Profile.h" #include "platform/sdl2/Profile.h"
#include "app/common/App_enums.h" #include "minecraft/GameEnums.h"
#include "app/common/App_structs.h" #include "app/common/App_structs.h"
#include "app/common/Tutorial/Constraints/TutorialConstraint.h" #include "app/common/Tutorial/Constraints/TutorialConstraint.h"
#include "app/common/Tutorial/Hints/DiggerItemHint.h" #include "app/common/Tutorial/Hints/DiggerItemHint.h"

View file

@ -10,7 +10,7 @@
#include "platform/InputActions.h" #include "platform/InputActions.h"
#include "platform/sdl2/Input.h" #include "platform/sdl2/Input.h"
#include "platform/sdl2/Render.h" #include "platform/sdl2/Render.h"
#include "app/common/App_enums.h" #include "minecraft/GameEnums.h"
#include "app/common/Tutorial/Tutorial.h" #include "app/common/Tutorial/Tutorial.h"
#include "app/common/Tutorial/TutorialMode.h" #include "app/common/Tutorial/TutorialMode.h"
#include "app/common/UI/All Platforms/UIStructs.h" #include "app/common/UI/All Platforms/UIStructs.h"

View file

@ -5,7 +5,7 @@
#include <string> #include <string>
#include <vector> #include <vector>
#include "app/common/App_enums.h" #include "minecraft/GameEnums.h"
#include "app/common/UI/All Platforms/IUIScene_AbstractContainerMenu.h" #include "app/common/UI/All Platforms/IUIScene_AbstractContainerMenu.h"
#include "app/linux/LinuxGame.h" #include "app/linux/LinuxGame.h"
#include "java/InputOutputStream/ByteArrayOutputStream.h" #include "java/InputOutputStream/ByteArrayOutputStream.h"

View file

@ -10,7 +10,7 @@
#include "platform/InputActions.h" #include "platform/InputActions.h"
#include "platform/sdl2/Profile.h" #include "platform/sdl2/Profile.h"
#include "platform/sdl2/Render.h" #include "platform/sdl2/Render.h"
#include "app/common/App_enums.h" #include "minecraft/GameEnums.h"
#include "app/common/Console_Debug_enum.h" #include "app/common/Console_Debug_enum.h"
#include "app/common/Tutorial/Tutorial.h" #include "app/common/Tutorial/Tutorial.h"
#include "app/common/UI/All Platforms/UIEnums.h" #include "app/common/UI/All Platforms/UIEnums.h"

View file

@ -5,7 +5,7 @@
#include "platform/sdl2/Profile.h" #include "platform/sdl2/Profile.h"
#include "platform/sdl2/Render.h" #include "platform/sdl2/Render.h"
#include "app/common/App_enums.h" #include "minecraft/GameEnums.h"
#include "app/linux/LinuxGame.h" #include "app/linux/LinuxGame.h"
#include "app/linux/Linux_UIController.h" #include "app/linux/Linux_UIController.h"
#include "java/Class.h" #include "java/Class.h"

View file

@ -10,7 +10,7 @@
#include <vector> #include <vector>
#include "platform/sdl2/Profile.h" #include "platform/sdl2/Profile.h"
#include "app/common/App_enums.h" #include "minecraft/GameEnums.h"
#include "app/common/DLC/DLCManager.h" #include "app/common/DLC/DLCManager.h"
#include "app/common/DLC/DLCPack.h" #include "app/common/DLC/DLCPack.h"
#include "app/common/GameRules/GameRuleManager.h" #include "app/common/GameRules/GameRuleManager.h"

View file

@ -2,7 +2,7 @@
#include "platform/sdl2/Profile.h" #include "platform/sdl2/Profile.h"
#include "platform/sdl2/Render.h" #include "platform/sdl2/Render.h"
#include "app/common/App_enums.h" #include "minecraft/GameEnums.h"
#include "app/common/UI/All Platforms/UIEnums.h" #include "app/common/UI/All Platforms/UIEnums.h"
#include "app/common/UI/UILayer.h" #include "app/common/UI/UILayer.h"
#include "app/common/UI/UIScene.h" #include "app/common/UI/UIScene.h"

View file

@ -5,7 +5,7 @@
#include "platform/PlatformTypes.h" #include "platform/PlatformTypes.h"
#include "platform/InputActions.h" #include "platform/InputActions.h"
#include "platform/sdl2/Render.h" #include "platform/sdl2/Render.h"
#include "app/common/App_enums.h" #include "minecraft/GameEnums.h"
#include "app/common/UI/All Platforms/UIEnums.h" #include "app/common/UI/All Platforms/UIEnums.h"
#include "app/common/UI/UIScene.h" #include "app/common/UI/UIScene.h"
#include "app/common/UI/UIString.h" #include "app/common/UI/UIString.h"

View file

@ -5,7 +5,7 @@
#include <vector> #include <vector>
#include "platform/sdl2/Profile.h" #include "platform/sdl2/Profile.h"
#include "app/common/App_enums.h" #include "minecraft/GameEnums.h"
#include "app/common/Tutorial/Tutorial.h" #include "app/common/Tutorial/Tutorial.h"
#include "app/common/Tutorial/TutorialEnum.h" #include "app/common/Tutorial/TutorialEnum.h"
#include "app/common/UI/Controls/UIControl_Label.h" #include "app/common/UI/Controls/UIControl_Label.h"

View file

@ -5,7 +5,7 @@
#include <memory> #include <memory>
#include "platform/sdl2/Profile.h" #include "platform/sdl2/Profile.h"
#include "app/common/App_enums.h" #include "minecraft/GameEnums.h"
#include "app/common/UI/Components/UIComponent_Chat.h" #include "app/common/UI/Components/UIComponent_Chat.h"
#include "app/common/UI/Controls/UIControl_Label.h" #include "app/common/UI/Controls/UIControl_Label.h"
#include "app/common/UI/UILayer.h" #include "app/common/UI/UILayer.h"

View file

@ -6,7 +6,7 @@
#include <sstream> #include <sstream>
#include "platform/sdl2/Render.h" #include "platform/sdl2/Render.h"
#include "app/common/App_enums.h" #include "minecraft/GameEnums.h"
#include "app/common/UI/Controls/UIControl.h" #include "app/common/UI/Controls/UIControl.h"
#include "app/common/UI/Controls/UIControl_Button.h" #include "app/common/UI/Controls/UIControl_Button.h"
#include "app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_EnchantingMenu.h" #include "app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_EnchantingMenu.h"

View file

@ -7,7 +7,7 @@
#include <vector> #include <vector>
#include "platform/sdl2/Render.h" #include "platform/sdl2/Render.h"
#include "app/common/App_enums.h" #include "minecraft/GameEnums.h"
#include "app/common/UI/Controls/UIControl.h" #include "app/common/UI/Controls/UIControl.h"
#include "app/linux/Iggy/include/iggy.h" #include "app/linux/Iggy/include/iggy.h"
#ifndef _ENABLEIGGY #ifndef _ENABLEIGGY

View file

@ -6,7 +6,7 @@
#include "platform/InputActions.h" #include "platform/InputActions.h"
#include "platform/sdl2/Input.h" #include "platform/sdl2/Input.h"
#include "platform/sdl2/Profile.h" #include "platform/sdl2/Profile.h"
#include "app/common/App_enums.h" #include "minecraft/GameEnums.h"
#include "app/common/GameRules/LevelGeneration/ConsoleSchematicFile.h" #include "app/common/GameRules/LevelGeneration/ConsoleSchematicFile.h"
#include "app/common/UI/Controls/UIControl_Button.h" #include "app/common/UI/Controls/UIControl_Button.h"
#include "app/common/UI/Controls/UIControl_CheckBox.h" #include "app/common/UI/Controls/UIControl_CheckBox.h"

View file

@ -7,7 +7,7 @@
#include "platform/InputActions.h" #include "platform/InputActions.h"
#include "platform/sdl2/Profile.h" #include "platform/sdl2/Profile.h"
#include "app/common/App_enums.h" #include "minecraft/GameEnums.h"
#include "app/common/Tutorial/Tutorial.h" #include "app/common/Tutorial/Tutorial.h"
#include "app/common/UI/All Platforms/UIEnums.h" #include "app/common/UI/All Platforms/UIEnums.h"
#include "app/common/UI/Controls/UIControl_Button.h" #include "app/common/UI/Controls/UIControl_Button.h"

View file

@ -8,7 +8,7 @@
#include "platform/InputActions.h" #include "platform/InputActions.h"
#include "platform/sdl2/Input.h" #include "platform/sdl2/Input.h"
#include "platform/sdl2/Profile.h" #include "platform/sdl2/Profile.h"
#include "app/common/App_enums.h" #include "minecraft/GameEnums.h"
#include "app/common/UI/All Platforms/UIStructs.h" #include "app/common/UI/All Platforms/UIStructs.h"
#include "app/common/UI/Controls/UIControl_Button.h" #include "app/common/UI/Controls/UIControl_Button.h"
#include "app/common/UI/Controls/UIControl_CheckBox.h" #include "app/common/UI/Controls/UIControl_CheckBox.h"

View file

@ -11,7 +11,7 @@
#include "platform/sdl2/Input.h" #include "platform/sdl2/Input.h"
#include "platform/sdl2/Profile.h" #include "platform/sdl2/Profile.h"
#include "app/common/App_Defines.h" #include "app/common/App_Defines.h"
#include "app/common/App_enums.h" #include "minecraft/GameEnums.h"
#include "app/common/DLC/DLCManager.h" #include "app/common/DLC/DLCManager.h"
#include "app/common/DLC/DLCPack.h" #include "app/common/DLC/DLCPack.h"
#include "app/common/Network/GameNetworkManager.h" #include "app/common/Network/GameNetworkManager.h"

View file

@ -2,7 +2,7 @@
#include "UIScene_DLCMainMenu.h" #include "UIScene_DLCMainMenu.h"
#include "platform/InputActions.h" #include "platform/InputActions.h"
#include "app/common/App_enums.h" #include "minecraft/GameEnums.h"
#include "app/common/UI/All Platforms/UIStructs.h" #include "app/common/UI/All Platforms/UIStructs.h"
#include "app/common/UI/Controls/UIControl_ButtonList.h" #include "app/common/UI/Controls/UIControl_ButtonList.h"
#include "app/common/UI/Controls/UIControl_Label.h" #include "app/common/UI/Controls/UIControl_Label.h"

View file

@ -8,7 +8,7 @@
#include "platform/sdl2/Input.h" #include "platform/sdl2/Input.h"
#include "platform/sdl2/Profile.h" #include "platform/sdl2/Profile.h"
#include "app/common/App_Defines.h" #include "app/common/App_Defines.h"
#include "app/common/App_enums.h" #include "minecraft/GameEnums.h"
#include "app/common/UI/Controls/UIControl_Button.h" #include "app/common/UI/Controls/UIControl_Button.h"
#include "app/common/UI/Controls/UIControl_DynamicLabel.h" #include "app/common/UI/Controls/UIControl_DynamicLabel.h"
#include "app/common/UI/UILayer.h" #include "app/common/UI/UILayer.h"

View file

@ -8,7 +8,7 @@
#include "platform/InputActions.h" #include "platform/InputActions.h"
#include "platform/sdl2/Profile.h" #include "platform/sdl2/Profile.h"
#include "app/common/App_Defines.h" #include "app/common/App_Defines.h"
#include "app/common/App_enums.h" #include "minecraft/GameEnums.h"
#include "app/common/Network/GameNetworkManager.h" #include "app/common/Network/GameNetworkManager.h"
#include "app/common/Network/SessionInfo.h" #include "app/common/Network/SessionInfo.h"
#include "app/common/UI/All Platforms/UIStructs.h" #include "app/common/UI/All Platforms/UIStructs.h"

View file

@ -9,7 +9,7 @@
#include "platform/sdl2/Profile.h" #include "platform/sdl2/Profile.h"
#include "platform/sdl2/Render.h" #include "platform/sdl2/Render.h"
#include "app/common/App_Defines.h" #include "app/common/App_Defines.h"
#include "app/common/App_enums.h" #include "minecraft/GameEnums.h"
#include "app/common/UI/Controls/UIControl_CheckBox.h" #include "app/common/UI/Controls/UIControl_CheckBox.h"
#include "app/common/UI/Controls/UIControl_HTMLLabel.h" #include "app/common/UI/Controls/UIControl_HTMLLabel.h"
#include "app/common/UI/Controls/UIControl_Label.h" #include "app/common/UI/Controls/UIControl_Label.h"

View file

@ -9,7 +9,7 @@
#include "platform/sdl2/Profile.h" #include "platform/sdl2/Profile.h"
#include "platform/sdl2/Render.h" #include "platform/sdl2/Render.h"
#include "app/common/App_Defines.h" #include "app/common/App_Defines.h"
#include "app/common/App_enums.h" #include "minecraft/GameEnums.h"
#include "app/common/DLC/DLCManager.h" #include "app/common/DLC/DLCManager.h"
#include "app/common/DLC/DLCPack.h" #include "app/common/DLC/DLCPack.h"
#include "app/common/GameRules/LevelGeneration/LevelGenerationOptions.h" #include "app/common/GameRules/LevelGeneration/LevelGenerationOptions.h"

View file

@ -10,7 +10,7 @@
#include "platform/sdl2/Input.h" #include "platform/sdl2/Input.h"
#include "platform/sdl2/Profile.h" #include "platform/sdl2/Profile.h"
#include "app/common/App_Defines.h" #include "app/common/App_Defines.h"
#include "app/common/App_enums.h" #include "minecraft/GameEnums.h"
#include "app/common/DLC/DLCManager.h" #include "app/common/DLC/DLCManager.h"
#include "app/common/GameRules/LevelGeneration/LevelGenerationOptions.h" #include "app/common/GameRules/LevelGeneration/LevelGenerationOptions.h"
#include "app/common/Network/GameNetworkManager.h" #include "app/common/Network/GameNetworkManager.h"

View file

@ -11,7 +11,7 @@
#include "platform/sdl2/Profile.h" #include "platform/sdl2/Profile.h"
#include "platform/sdl2/Render.h" #include "platform/sdl2/Render.h"
#include "app/common/App_Defines.h" #include "app/common/App_Defines.h"
#include "app/common/App_enums.h" #include "minecraft/GameEnums.h"
#include "app/common/Network/GameNetworkManager.h" #include "app/common/Network/GameNetworkManager.h"
#include "app/common/UI/All Platforms/UIStructs.h" #include "app/common/UI/All Platforms/UIStructs.h"
#include "app/common/UI/Controls/UIControl_Button.h" #include "app/common/UI/Controls/UIControl_Button.h"

View file

@ -5,7 +5,7 @@
#include "platform/InputActions.h" #include "platform/InputActions.h"
#include "app/common/App_Defines.h" #include "app/common/App_Defines.h"
#include "app/common/App_enums.h" #include "minecraft/GameEnums.h"
#include "app/common/UI/Controls/UIControl_Button.h" #include "app/common/UI/Controls/UIControl_Button.h"
#include "app/common/UI/Controls/UIControl_DynamicLabel.h" #include "app/common/UI/Controls/UIControl_DynamicLabel.h"
#include "app/common/UI/UILayer.h" #include "app/common/UI/UILayer.h"

View file

@ -6,7 +6,7 @@
#include "platform/InputActions.h" #include "platform/InputActions.h"
#include "platform/sdl2/Input.h" #include "platform/sdl2/Input.h"
#include "app/common/App_enums.h" #include "minecraft/GameEnums.h"
#include "app/common/BuildVer/BuildVer.h" #include "app/common/BuildVer/BuildVer.h"
#include "app/common/UI/Controls/UIControl_Button.h" #include "app/common/UI/Controls/UIControl_Button.h"
#include "app/common/UI/Controls/UIControl_CheckBox.h" #include "app/common/UI/Controls/UIControl_CheckBox.h"

View file

@ -7,7 +7,7 @@
#include <vector> #include <vector>
#include "platform/InputActions.h" #include "platform/InputActions.h"
#include "app/common/App_enums.h" #include "minecraft/GameEnums.h"
#include "app/common/UI/Controls/UIControl_Label.h" #include "app/common/UI/Controls/UIControl_Label.h"
#include "app/common/UI/UIScene.h" #include "app/common/UI/UIScene.h"
#include "app/linux/LinuxGame.h" #include "app/linux/LinuxGame.h"

View file

@ -9,7 +9,7 @@
#include "app/common/UI/UIScene.h" #include "app/common/UI/UIScene.h"
#include "app/linux/Iggy/include/rrCore.h" #include "app/linux/Iggy/include/rrCore.h"
#include "platform/NetTypes.h" #include "platform/NetTypes.h"
#include "minecraft/client/SkinBox.h" #include "minecraft/client/model/SkinBox.h"
#include "platform/XboxStubs.h" #include "platform/XboxStubs.h"
class UILayer; class UILayer;

View file

@ -4,7 +4,7 @@
#include <wchar.h> #include <wchar.h>
#include "platform/InputActions.h" #include "platform/InputActions.h"
#include "app/common/App_enums.h" #include "minecraft/GameEnums.h"
#include "app/common/UI/Controls/UIControl_Slider.h" #include "app/common/UI/Controls/UIControl_Slider.h"
#include "app/common/UI/UILayer.h" #include "app/common/UI/UILayer.h"
#include "app/common/UI/UIScene.h" #include "app/common/UI/UIScene.h"

View file

@ -3,7 +3,7 @@
#include <wchar.h> #include <wchar.h>
#include "platform/InputActions.h" #include "platform/InputActions.h"
#include "app/common/App_enums.h" #include "minecraft/GameEnums.h"
#include "app/common/UI/Controls/UIControl_Slider.h" #include "app/common/UI/Controls/UIControl_Slider.h"
#include "app/common/UI/UILayer.h" #include "app/common/UI/UILayer.h"
#include "app/common/UI/UIScene.h" #include "app/common/UI/UIScene.h"

View file

@ -4,7 +4,7 @@
#include "platform/InputActions.h" #include "platform/InputActions.h"
#include "platform/sdl2/Profile.h" #include "platform/sdl2/Profile.h"
#include "app/common/App_enums.h" #include "minecraft/GameEnums.h"
#include "app/common/Network/GameNetworkManager.h" #include "app/common/Network/GameNetworkManager.h"
#include "app/common/UI/Controls/UIControl_CheckBox.h" #include "app/common/UI/Controls/UIControl_CheckBox.h"
#include "app/common/UI/Controls/UIControl_Slider.h" #include "app/common/UI/Controls/UIControl_Slider.h"

View file

@ -6,7 +6,7 @@
#include "platform/InputActions.h" #include "platform/InputActions.h"
#include "platform/sdl2/Profile.h" #include "platform/sdl2/Profile.h"
#include "platform/sdl2/Render.h" #include "platform/sdl2/Render.h"
#include "app/common/App_enums.h" #include "minecraft/GameEnums.h"
#include "app/common/Network/GameNetworkManager.h" #include "app/common/Network/GameNetworkManager.h"
#include "app/common/UI/Controls/UIControl_Button.h" #include "app/common/UI/Controls/UIControl_Button.h"
#include "app/common/UI/Controls/UIControl_CheckBox.h" #include "app/common/UI/Controls/UIControl_CheckBox.h"

View file

@ -5,7 +5,7 @@
#include "platform/InputActions.h" #include "platform/InputActions.h"
#include "platform/sdl2/Profile.h" #include "platform/sdl2/Profile.h"
#include "app/common/App_enums.h" #include "minecraft/GameEnums.h"
#include "app/common/UI/Controls/UIControl_CheckBox.h" #include "app/common/UI/Controls/UIControl_CheckBox.h"
#include "app/common/UI/Controls/UIControl_Slider.h" #include "app/common/UI/Controls/UIControl_Slider.h"
#include "app/common/UI/UILayer.h" #include "app/common/UI/UILayer.h"

View file

@ -20,7 +20,7 @@
#include "app/common/UI/UIScene.h" #include "app/common/UI/UIScene.h"
#include "app/linux/LinuxGame.h" #include "app/linux/LinuxGame.h"
#include "app/linux/Linux_UIController.h" #include "app/linux/Linux_UIController.h"
#include "minecraft/client/SkinBox.h" #include "minecraft/client/model/SkinBox.h"
#include "util/StringHelpers.h" #include "util/StringHelpers.h"
#include "minecraft/client/Minecraft.h" #include "minecraft/client/Minecraft.h"

View file

@ -15,7 +15,7 @@
#include "app/linux/Stubs/iggy_stubs.h" #include "app/linux/Stubs/iggy_stubs.h"
#endif #endif
#include "app/linux/Iggy/include/rrCore.h" #include "app/linux/Iggy/include/rrCore.h"
#include "minecraft/client/SkinBox.h" #include "minecraft/client/model/SkinBox.h"
#include "minecraft/world/entity/player/SkinTypes.h" #include "minecraft/world/entity/player/SkinTypes.h"
#include "minecraft/client/renderer/Textures.h" #include "minecraft/client/renderer/Textures.h"

View file

@ -6,7 +6,7 @@
#include "platform/InputActions.h" #include "platform/InputActions.h"
#include "platform/sdl2/Profile.h" #include "platform/sdl2/Profile.h"
#include "platform/sdl2/Storage.h" #include "platform/sdl2/Storage.h"
#include "app/common/App_enums.h" #include "minecraft/GameEnums.h"
#include "app/common/Network/GameNetworkManager.h" #include "app/common/Network/GameNetworkManager.h"
#include "app/common/Tutorial/Tutorial.h" #include "app/common/Tutorial/Tutorial.h"
#include "app/common/Tutorial/TutorialMode.h" #include "app/common/Tutorial/TutorialMode.h"

View file

@ -9,7 +9,7 @@
#include "platform/PlatformTypes.h" #include "platform/PlatformTypes.h"
#include "platform/InputActions.h" #include "platform/InputActions.h"
#include "platform/sdl2/Profile.h" #include "platform/sdl2/Profile.h"
#include "app/common/App_enums.h" #include "minecraft/GameEnums.h"
#include "app/common/Tutorial/Tutorial.h" #include "app/common/Tutorial/Tutorial.h"
#include "app/common/UI/UIScene.h" #include "app/common/UI/UIScene.h"
#include "app/linux/LinuxGame.h" #include "app/linux/LinuxGame.h"

View file

@ -4,7 +4,7 @@
#include <memory> #include <memory>
#include "platform/InputActions.h" #include "platform/InputActions.h"
#include "app/common/App_enums.h" #include "minecraft/GameEnums.h"
#include "app/common/Network/GameNetworkManager.h" #include "app/common/Network/GameNetworkManager.h"
#include "app/common/Network/NetworkPlayerInterface.h" #include "app/common/Network/NetworkPlayerInterface.h"
#include "app/common/UI/All Platforms/UIStructs.h" #include "app/common/UI/All Platforms/UIStructs.h"

View file

@ -5,7 +5,7 @@
#include "platform/PlatformTypes.h" #include "platform/PlatformTypes.h"
#include "platform/InputActions.h" #include "platform/InputActions.h"
#include "platform/sdl2/Profile.h" #include "platform/sdl2/Profile.h"
#include "app/common/App_enums.h" #include "minecraft/GameEnums.h"
#include "app/common/Console_Debug_enum.h" #include "app/common/Console_Debug_enum.h"
#include "app/common/Network/GameNetworkManager.h" #include "app/common/Network/GameNetworkManager.h"
#include "app/common/Network/NetworkPlayerInterface.h" #include "app/common/Network/NetworkPlayerInterface.h"

View file

@ -4,7 +4,7 @@
#include <memory> #include <memory>
#include "platform/InputActions.h" #include "platform/InputActions.h"
#include "app/common/App_enums.h" #include "minecraft/GameEnums.h"
#include "app/common/Network/GameNetworkManager.h" #include "app/common/Network/GameNetworkManager.h"
#include "app/common/Network/NetworkPlayerInterface.h" #include "app/common/Network/NetworkPlayerInterface.h"
#include "app/common/UI/All Platforms/UIStructs.h" #include "app/common/UI/All Platforms/UIStructs.h"

View file

@ -7,7 +7,7 @@
#include "platform/InputActions.h" #include "platform/InputActions.h"
#include "platform/sdl2/Profile.h" #include "platform/sdl2/Profile.h"
#include "app/common/App_enums.h" #include "minecraft/GameEnums.h"
#include "app/common/DLC/DLCManager.h" #include "app/common/DLC/DLCManager.h"
#include "app/common/DLC/DLCPack.h" #include "app/common/DLC/DLCPack.h"
#include "app/common/Network/GameNetworkManager.h" #include "app/common/Network/GameNetworkManager.h"

View file

@ -3,7 +3,7 @@
#include "platform/InputActions.h" #include "platform/InputActions.h"
#include "platform/sdl2/Profile.h" #include "platform/sdl2/Profile.h"
#include "app/common/App_enums.h" #include "minecraft/GameEnums.h"
#include "app/common/Network/GameNetworkManager.h" #include "app/common/Network/GameNetworkManager.h"
#include "app/common/UI/All Platforms/UIStructs.h" #include "app/common/UI/All Platforms/UIStructs.h"
#include "app/common/UI/Controls/UIControl_Button.h" #include "app/common/UI/Controls/UIControl_Button.h"

View file

@ -7,7 +7,7 @@
#include "platform/PlatformTypes.h" #include "platform/PlatformTypes.h"
#include "platform/InputActions.h" #include "platform/InputActions.h"
#include "platform/sdl2/Profile.h" #include "platform/sdl2/Profile.h"
#include "app/common/App_enums.h" #include "minecraft/GameEnums.h"
#include "app/common/Network/GameNetworkManager.h" #include "app/common/Network/GameNetworkManager.h"
#include "app/common/Tutorial/Tutorial.h" #include "app/common/Tutorial/Tutorial.h"
#include "app/common/UI/Controls/UIControl_Button.h" #include "app/common/UI/Controls/UIControl_Button.h"

View file

@ -12,7 +12,7 @@
#include "platform/sdl2/Input.h" #include "platform/sdl2/Input.h"
#include "platform/sdl2/Profile.h" #include "platform/sdl2/Profile.h"
#include "app/common/App_enums.h" #include "minecraft/GameEnums.h"
#include "app/common/Audio/SoundEngine.h" #include "app/common/Audio/SoundEngine.h"
#include "app/common/DLC/DLCManager.h" #include "app/common/DLC/DLCManager.h"
#include "app/common/Network/GameNetworkManager.h" #include "app/common/Network/GameNetworkManager.h"

View file

@ -7,7 +7,7 @@
#include "platform/sdl2/Profile.h" #include "platform/sdl2/Profile.h"
#include "platform/sdl2/Render.h" #include "platform/sdl2/Render.h"
#include "platform/sdl2/Storage.h" #include "platform/sdl2/Storage.h"
#include "app/common/App_enums.h" #include "minecraft/GameEnums.h"
#include "app/common/Game.h" #include "app/common/Game.h"
#include "app/common/Network/GameNetworkManager.h" #include "app/common/Network/GameNetworkManager.h"
#include "app/common/UI/All Platforms/UIStructs.h" #include "app/common/UI/All Platforms/UIStructs.h"

View file

@ -2,7 +2,7 @@
#include <cstdint> #include <cstdint>
#include "app/common/App_enums.h" #include "minecraft/GameEnums.h"
#include "app/common/Game.h" #include "app/common/Game.h"
class C4JStringTable; class C4JStringTable;

View file

@ -1,7 +1,5 @@
#include "app/common/AppGameServices.h"
#include "app/common/GameMenuService.h" #include "app/common/GameMenuService.h"
#include "minecraft/GameServices.h"
#include "minecraft/util/DebugSettings.h"
#include "minecraft/locale/Strings.h"
// Minecraft.cpp : Defines the entry point for the application. // Minecraft.cpp : Defines the entry point for the application.
// //
@ -455,153 +453,9 @@ int main(int argc, const char* argv[]) {
app.loadMediaArchive(); app.loadMediaArchive();
app.loadStringTable(); app.loadStringTable();
Strings::init([](int id) { return app.GetString(id); });
DebugSettings::init(
[] { return app.DebugSettingsOn(); },
[] { return app.DebugArtToolsOn(); },
[](int iPad, bool overridePlayer) {
return app.GetGameSettingsDebugMask(iPad, overridePlayer);
},
[] { return app.GetMobsDontAttackEnabled(); },
[] { return app.GetMobsDontTickEnabled(); },
[] { return app.GetFreezePlayers(); });
GameServices::initLevelGen(
[] { return app.getLevelGenerationOptions(); },
[] { return app.getGameRuleDefinitions(); });
GameServices::initTextureCache(
[](const std::wstring& n, std::uint8_t* d, unsigned int s) {
app.AddMemoryTextureFile(n, d, s);
},
[](const std::wstring& n) { app.RemoveMemoryTextureFile(n); },
[](const std::wstring& n, std::uint8_t** d, unsigned int* s) {
app.GetMemFileDetails(n, d, s);
},
[](const std::wstring& n) { return app.IsFileInMemoryTextures(n); });
GameServices::initPlayerSettings(
[](int iPad, int s) {
return app.GetGameSettings(iPad, static_cast<eGameSetting>(s));
},
[](int s) {
return app.GetGameSettings(static_cast<eGameSetting>(s));
});
GameServices::initAppTime([] { return app.getAppTime(); });
GameServices::initGameState(
[] { return app.GetGameStarted(); },
[](bool v) { app.SetGameStarted(v); },
[] { return app.GetTutorialMode(); },
[](bool v) { app.SetTutorialMode(v); },
[] { return app.IsAppPaused(); },
[] { return app.GetLocalPlayerCount(); },
[] { return app.AutosaveDue(); },
[] { app.SetAutosaveTimerTime(); },
[] { return app.SecondsToAutosave(); },
[](DisconnectPacket::eDisconnectReason r) { app.SetDisconnectReason(r); },
[] { app.lockSaveNotification(); },
[] { app.unlockSaveNotification(); },
[] { return app.GetResetNether(); },
[] { return app.GetUseDPadForDebug(); },
[] { return app.GetWriteSavesToFolderEnabled(); },
[] { return app.IsLocalMultiplayerAvailable(); },
[] { return app.DLCInstallPending(); },
[] { return app.DLCInstallProcessCompleted(); },
[] { return app.CanRecordStatsAndAchievements(); },
[] { return app.GetTMSGlobalFileListRead(); },
[](std::uint32_t id) { app.SetRequiredTexturePackID(id); },
[](int iPad, int idx) { app.SetSpecialTutorialCompletionFlag(iPad, idx); },
[](int iPad, bool v) { app.SetBanListCheck(iPad, v); },
[](int iPad) { return app.GetBanListCheck(iPad); },
[] { return app.GetGameNewWorldSize(); },
[] { return app.GetGameNewWorldSizeUseMoat(); },
[] { return app.GetGameNewHellScale(); }
);
GameServices::initUIDispatch(
[](int iPad, eXuiAction a, void* p) { app.SetAction(iPad, a, p); },
[](int iPad, eXuiServerAction a, void* p) { app.SetXuiServerAction(iPad, a, p); },
[](int iPad) { return app.GetXuiAction(iPad); },
[](int iPad) { return app.GetXuiServerAction(iPad); },
[](int iPad) { return app.GetXuiServerActionParam(iPad); },
[](eXuiAction a) { app.SetGlobalXuiAction(a); },
[] { app.HandleButtonPresses(); },
[](int iPad, eTMSAction a) { app.SetTMSAction(iPad, a); }
);
GameServices::initSkinCape(
[](int iPad) { return app.GetPlayerSkinName(iPad); },
[](int iPad) { return app.GetPlayerSkinId(iPad); },
[](int iPad) { return app.GetPlayerCapeName(iPad); },
[](int iPad) { return app.GetPlayerCapeId(iPad); },
[](int iPad) { return app.GetAdditionalModelParts(iPad); },
[](std::uint32_t id, SKIN_BOX* a, unsigned int c) {
app.SetAdditionalSkinBoxes(id, a, c);
},
[](std::uint32_t id) { return app.GetAdditionalSkinBoxes(id); },
[](std::uint32_t id) { return app.GetAdditionalModelParts(id); },
[](std::uint32_t id, std::vector<SKIN_BOX*>* v) {
return app.SetAdditionalSkinBoxes(id, v);
},
[](std::uint32_t id, unsigned int m) { app.SetAnimOverrideBitmask(id, m); },
[](std::uint32_t id) { return app.GetAnimOverrideBitmask(id); },
[](const std::wstring& s) { return Game::getSkinIdFromPath(s); },
[](std::uint32_t id) { return Game::getSkinPathFromId(id); },
[] { return app.DefaultCapeExists(); },
[](PlayerUID x) { return app.isXuidNotch(x); },
[](PlayerUID x) { return app.isXuidDeadmau5(x); }
);
GameServices::initPlatformFeatures(
[] { app.FatalLoadError(); },
[](int iPad, int ctx) { app.SetRichPresenceContext(iPad, ctx); },
[] { app.CaptureSaveThumbnail(); },
[](std::uint8_t** d, unsigned int* s) { app.GetSaveThumbnail(d, s); },
[](int iPad, eTMSAction a, bool cb) { app.ReadBannedList(iPad, a, cb); },
[](std::uint8_t id, int16_t col, unsigned int priv) {
app.UpdatePlayerInfo(id, col, priv);
},
[](std::uint8_t id) { return app.GetPlayerPrivileges(id); },
[](int iPad, unsigned int v) { app.SetGameSettingsDebugMask(iPad, v); }
);
GameServices::initSchematics(
[](LevelChunk* c) { app.processSchematics(c); },
[](LevelChunk* c) { app.processSchematicsLighting(c); },
[](_eTerrainFeatureType t, int x, int z) {
app.AddTerrainFeaturePosition(t, x, z);
},
[](_eTerrainFeatureType t, int* x, int* z) {
return app.GetTerrainFeaturePosition(t, x, z);
},
[] { app.loadDefaultGameRules(); }
);
GameServices::initArchive(
[](const std::wstring& f) { return app.hasArchiveFile(f); },
[](const std::wstring& f) { return app.getArchiveFile(f); }
);
GameServices::initStringsAndMisc(
[](eMinecraftColour c) { return app.GetHTMLColour(c); },
[](int type) { return app.getEntityName(static_cast<eINSTANCEOF>(type)); },
[](const std::wstring& k) { return app.GetGameRulesString(k); },
[](std::uint8_t* m, int64_t s, bool h, unsigned int ho, unsigned int tp) {
return app.CreateImageTextData(m, s, h, ho, tp);
},
[](std::uint32_t p, std::wstring f, bool a, std::wstring mp) {
return app.getFilePath(p, f, a, mp);
},
[] { return app.GetUniqueMapName(); },
[](char* n) { app.SetUniqueMapName(n); },
[](int iPad) { return app.GetOpacityTimer(iPad); },
[](int iPad) { app.SetOpacityTimer(iPad); },
[](int iPad) { app.TickOpacityTimer(iPad); },
[](int iPad, PlayerUID x, char* n) {
return app.IsInBannedLevelList(iPad, x, n);
},
[](PlayerUID x) { return app.GetMojangDataForXuid(x); },
[](const char* msg) { app.DebugPrintf("%s", msg); }
);
GameServices::initMemberAccess(
&app.m_dlcManager,
&app.m_gameRules,
&app.vSkinNames,
app.m_terrainFeatureManager.features()
);
static GameMenuService menuService(app); static GameMenuService menuService(app);
GameServices::initMenuService(&menuService); static AppGameServices services(app, menuService);
initGameServices(&services);
ui.init(1920, 1080); ui.init(1920, 1080);
// storage manager is needed for the trial key check // storage manager is needed for the trial key check
StorageManager.Init( StorageManager.Init(

View file

@ -1,25 +1,7 @@
#include "minecraft/GameHostOptions.h" #include "minecraft/GameHostOptions.h"
#include <cassert>
namespace GameHostOptions { namespace GameHostOptions {
static unsigned int* s_settings = nullptr;
void init(unsigned int* settingsPtr) {
s_settings = settingsPtr;
}
unsigned int get(eGameHostOption option) {
assert(s_settings);
return get(*s_settings, option);
}
void set(eGameHostOption option, unsigned int value) {
assert(s_settings);
set(*s_settings, option, value);
}
unsigned int get(unsigned int settings, eGameHostOption option) { unsigned int get(unsigned int settings, eGameHostOption option) {
switch (option) { switch (option) {
case eGameHostOption_FriendsOfFriends: case eGameHostOption_FriendsOfFriends:

View file

@ -3,16 +3,14 @@
#include <cstdint> #include <cstdint>
#include "app/common/App_Defines.h" #include "app/common/App_Defines.h"
#include "app/common/App_enums.h" #include "minecraft/GameEnums.h"
// Stateless bitfield utilities - no app dependency.
// The global-state overloads (get/set with no settings arg) have moved
// to IgameServices().getGameHostOption / setGameHostOption.
namespace GameHostOptions { namespace GameHostOptions {
unsigned int get(unsigned int settings, eGameHostOption option); unsigned int get(unsigned int settings, eGameHostOption option);
void set(unsigned int& settings, eGameHostOption option, unsigned int value); void set(unsigned int& settings, eGameHostOption option, unsigned int value);
// Global game settings - initialized by app layer at startup
void init(unsigned int* settingsPtr);
unsigned int get(eGameHostOption option);
void set(eGameHostOption option, unsigned int value);
} // namespace GameHostOptions } // namespace GameHostOptions

View file

@ -1,654 +0,0 @@
#include "minecraft/GameServices.h"
#include <cassert>
namespace GameServices {
// Level generation
static LevelGenOptsFn s_levelGenOpts = nullptr;
static GameRuleDefsFn s_gameRuleDefs = nullptr;
void initLevelGen(LevelGenOptsFn levelGenOpts, GameRuleDefsFn gameRuleDefs) {
s_levelGenOpts = levelGenOpts;
s_gameRuleDefs = gameRuleDefs;
}
LevelGenerationOptions* getLevelGenerationOptions() {
assert(s_levelGenOpts);
return s_levelGenOpts();
}
LevelRuleset* getGameRuleDefinitions() {
assert(s_gameRuleDefs);
return s_gameRuleDefs();
}
// Texture cache
static AddTexFn s_addTex = nullptr;
static RemoveTexFn s_removeTex = nullptr;
static GetTexDetailsFn s_getTexDetails = nullptr;
static HasTexFn s_hasTex = nullptr;
void initTextureCache(AddTexFn add, RemoveTexFn remove,
GetTexDetailsFn getDetails, HasTexFn has) {
s_addTex = add;
s_removeTex = remove;
s_getTexDetails = getDetails;
s_hasTex = has;
}
void addMemoryTextureFile(const std::wstring& name, std::uint8_t* data,
unsigned int size) {
if (s_addTex) s_addTex(name, data, size);
}
void removeMemoryTextureFile(const std::wstring& name) {
if (s_removeTex) s_removeTex(name);
}
void getMemFileDetails(const std::wstring& name, std::uint8_t** data,
unsigned int* size) {
if (s_getTexDetails) s_getTexDetails(name, data, size);
}
bool isFileInMemoryTextures(const std::wstring& name) {
return s_hasTex ? s_hasTex(name) : false;
}
// Per-player settings
static GetSettingsFn s_getSettings = nullptr;
static GetSettingsNoArgFn s_getSettingsNoArg = nullptr;
void initPlayerSettings(GetSettingsFn getSettings,
GetSettingsNoArgFn getSettingsNoArg) {
s_getSettings = getSettings;
s_getSettingsNoArg = getSettingsNoArg;
}
unsigned char getGameSettings(int iPad, int setting) {
return s_getSettings ? s_getSettings(iPad, setting) : 0;
}
unsigned char getGameSettings(int setting) {
return s_getSettingsNoArg ? s_getSettingsNoArg(setting) : 0;
}
// App time
static AppTimeFn s_appTime = nullptr;
void initAppTime(AppTimeFn fn) { s_appTime = fn; }
float getAppTime() { return s_appTime ? s_appTime() : 0.0f; }
// Game state
static bool (*s_getGameStarted)() = nullptr;
static void (*s_setGameStarted)(bool) = nullptr;
static bool (*s_getTutorialMode)() = nullptr;
static void (*s_setTutorialMode)(bool) = nullptr;
static bool (*s_isAppPaused)() = nullptr;
static int (*s_getLocalPlayerCount)() = nullptr;
static bool (*s_autosaveDue)() = nullptr;
static void (*s_setAutosaveTimerTime)() = nullptr;
static int64_t (*s_secondsToAutosave)() = nullptr;
static void (*s_setDisconnectReason)(DisconnectPacket::eDisconnectReason) = nullptr;
static void (*s_lockSaveNotify)() = nullptr;
static void (*s_unlockSaveNotify)() = nullptr;
static bool (*s_getResetNether)() = nullptr;
static bool (*s_getUseDPadForDebug)() = nullptr;
static bool (*s_getWriteSavesToFolderEnabled)() = nullptr;
static bool (*s_isLocalMultiplayerAvailable)() = nullptr;
static bool (*s_dlcInstallPending)() = nullptr;
static bool (*s_dlcInstallProcessCompleted)() = nullptr;
static bool (*s_canRecordStatsAndAchievements)() = nullptr;
static bool (*s_getTMSGlobalFileListRead)() = nullptr;
static void (*s_setRequiredTexturePackID)(std::uint32_t) = nullptr;
static void (*s_setSpecialTutorialCompletionFlag)(int, int) = nullptr;
static void (*s_setBanListCheck)(int, bool) = nullptr;
static bool (*s_getBanListCheck)(int) = nullptr;
static unsigned int (*s_getGameNewWorldSize)() = nullptr;
static unsigned int (*s_getGameNewWorldSizeUseMoat)() = nullptr;
static unsigned int (*s_getGameNewHellScale)() = nullptr;
void initGameState(
bool (*getGameStartedFn)(),
void (*setGameStartedFn)(bool),
bool (*getTutorialModeFn)(),
void (*setTutorialModeFn)(bool),
bool (*isAppPausedFn)(),
int (*getLocalPlayerCountFn)(),
bool (*autosaveDueFn)(),
void (*setAutosaveTimerTimeFn)(),
int64_t (*secondsToAutosaveFn)(),
void (*setDisconnectReasonFn)(DisconnectPacket::eDisconnectReason),
void (*lockSaveNotifyFn)(),
void (*unlockSaveNotifyFn)(),
bool (*getResetNetherFn)(),
bool (*getUseDPadForDebugFn)(),
bool (*getWriteSavesToFolderEnabledFn)(),
bool (*isLocalMultiplayerAvailableFn)(),
bool (*dlcInstallPendingFn)(),
bool (*dlcInstallProcessCompletedFn)(),
bool (*canRecordStatsAndAchievementsFn)(),
bool (*getTMSGlobalFileListReadFn)(),
void (*setRequiredTexturePackIDFn)(std::uint32_t),
void (*setSpecialTutorialCompletionFlagFn)(int, int),
void (*setBanListCheckFn)(int, bool),
bool (*getBanListCheckFn)(int),
unsigned int (*getGameNewWorldSizeFn)(),
unsigned int (*getGameNewWorldSizeUseMoatFn)(),
unsigned int (*getGameNewHellScaleFn)()
) {
s_getGameStarted = getGameStartedFn;
s_setGameStarted = setGameStartedFn;
s_getTutorialMode = getTutorialModeFn;
s_setTutorialMode = setTutorialModeFn;
s_isAppPaused = isAppPausedFn;
s_getLocalPlayerCount = getLocalPlayerCountFn;
s_autosaveDue = autosaveDueFn;
s_setAutosaveTimerTime = setAutosaveTimerTimeFn;
s_secondsToAutosave = secondsToAutosaveFn;
s_setDisconnectReason = setDisconnectReasonFn;
s_lockSaveNotify = lockSaveNotifyFn;
s_unlockSaveNotify = unlockSaveNotifyFn;
s_getResetNether = getResetNetherFn;
s_getUseDPadForDebug = getUseDPadForDebugFn;
s_getWriteSavesToFolderEnabled = getWriteSavesToFolderEnabledFn;
s_isLocalMultiplayerAvailable = isLocalMultiplayerAvailableFn;
s_dlcInstallPending = dlcInstallPendingFn;
s_dlcInstallProcessCompleted = dlcInstallProcessCompletedFn;
s_canRecordStatsAndAchievements = canRecordStatsAndAchievementsFn;
s_getTMSGlobalFileListRead = getTMSGlobalFileListReadFn;
s_setRequiredTexturePackID = setRequiredTexturePackIDFn;
s_setSpecialTutorialCompletionFlag = setSpecialTutorialCompletionFlagFn;
s_setBanListCheck = setBanListCheckFn;
s_getBanListCheck = getBanListCheckFn;
s_getGameNewWorldSize = getGameNewWorldSizeFn;
s_getGameNewWorldSizeUseMoat = getGameNewWorldSizeUseMoatFn;
s_getGameNewHellScale = getGameNewHellScaleFn;
}
bool getGameStarted() { return s_getGameStarted ? s_getGameStarted() : false; }
void setGameStarted(bool val) { if (s_setGameStarted) s_setGameStarted(val); }
bool getTutorialMode() { return s_getTutorialMode ? s_getTutorialMode() : false; }
void setTutorialMode(bool val) { if (s_setTutorialMode) s_setTutorialMode(val); }
bool isAppPaused() { return s_isAppPaused ? s_isAppPaused() : false; }
int getLocalPlayerCount() { return s_getLocalPlayerCount ? s_getLocalPlayerCount() : 0; }
bool autosaveDue() { return s_autosaveDue ? s_autosaveDue() : false; }
void setAutosaveTimerTime() { if (s_setAutosaveTimerTime) s_setAutosaveTimerTime(); }
int64_t secondsToAutosave() { return s_secondsToAutosave ? s_secondsToAutosave() : 0; }
void setDisconnectReason(DisconnectPacket::eDisconnectReason reason) {
if (s_setDisconnectReason) s_setDisconnectReason(reason);
}
void lockSaveNotification() { if (s_lockSaveNotify) s_lockSaveNotify(); }
void unlockSaveNotification() { if (s_unlockSaveNotify) s_unlockSaveNotify(); }
bool getResetNether() { return s_getResetNether ? s_getResetNether() : false; }
bool getUseDPadForDebug() { return s_getUseDPadForDebug ? s_getUseDPadForDebug() : false; }
bool getWriteSavesToFolderEnabled() {
return s_getWriteSavesToFolderEnabled ? s_getWriteSavesToFolderEnabled() : false;
}
bool isLocalMultiplayerAvailable() {
return s_isLocalMultiplayerAvailable ? s_isLocalMultiplayerAvailable() : false;
}
bool dlcInstallPending() { return s_dlcInstallPending ? s_dlcInstallPending() : false; }
bool dlcInstallProcessCompleted() {
return s_dlcInstallProcessCompleted ? s_dlcInstallProcessCompleted() : false;
}
bool canRecordStatsAndAchievements() {
return s_canRecordStatsAndAchievements ? s_canRecordStatsAndAchievements() : false;
}
bool getTMSGlobalFileListRead() {
return s_getTMSGlobalFileListRead ? s_getTMSGlobalFileListRead() : true;
}
void setRequiredTexturePackID(std::uint32_t id) {
if (s_setRequiredTexturePackID) s_setRequiredTexturePackID(id);
}
void setSpecialTutorialCompletionFlag(int iPad, int index) {
if (s_setSpecialTutorialCompletionFlag) s_setSpecialTutorialCompletionFlag(iPad, index);
}
void setBanListCheck(int iPad, bool val) {
if (s_setBanListCheck) s_setBanListCheck(iPad, val);
}
bool getBanListCheck(int iPad) {
return s_getBanListCheck ? s_getBanListCheck(iPad) : false;
}
unsigned int getGameNewWorldSize() {
return s_getGameNewWorldSize ? s_getGameNewWorldSize() : 0;
}
unsigned int getGameNewWorldSizeUseMoat() {
return s_getGameNewWorldSizeUseMoat ? s_getGameNewWorldSizeUseMoat() : 0;
}
unsigned int getGameNewHellScale() {
return s_getGameNewHellScale ? s_getGameNewHellScale() : 0;
}
// UI dispatch
static void (*s_setAction)(int, eXuiAction, void*) = nullptr;
static void (*s_setXuiServerAction)(int, eXuiServerAction, void*) = nullptr;
static eXuiAction (*s_getXuiAction)(int) = nullptr;
static eXuiServerAction (*s_getXuiServerAction)(int) = nullptr;
static void* (*s_getXuiServerActionParam)(int) = nullptr;
static void (*s_setGlobalXuiAction)(eXuiAction) = nullptr;
static void (*s_handleButtonPresses)() = nullptr;
static void (*s_setTMSAction)(int, eTMSAction) = nullptr;
void initUIDispatch(
void (*setActionFn)(int, eXuiAction, void*),
void (*setXuiServerActionFn)(int, eXuiServerAction, void*),
eXuiAction (*getXuiActionFn)(int),
eXuiServerAction (*getXuiServerActionFn)(int),
void* (*getXuiServerActionParamFn)(int),
void (*setGlobalXuiActionFn)(eXuiAction),
void (*handleButtonPressesFn)(),
void (*setTMSActionFn)(int, eTMSAction)
) {
s_setAction = setActionFn;
s_setXuiServerAction = setXuiServerActionFn;
s_getXuiAction = getXuiActionFn;
s_getXuiServerAction = getXuiServerActionFn;
s_getXuiServerActionParam = getXuiServerActionParamFn;
s_setGlobalXuiAction = setGlobalXuiActionFn;
s_handleButtonPresses = handleButtonPressesFn;
s_setTMSAction = setTMSActionFn;
}
void setAction(int iPad, eXuiAction action, void* param) {
if (s_setAction) s_setAction(iPad, action, param);
}
void setXuiServerAction(int iPad, eXuiServerAction action, void* param) {
if (s_setXuiServerAction) s_setXuiServerAction(iPad, action, param);
}
eXuiAction getXuiAction(int iPad) {
return s_getXuiAction ? s_getXuiAction(iPad) : eAppAction_Idle;
}
eXuiServerAction getXuiServerAction(int iPad) {
return s_getXuiServerAction ? s_getXuiServerAction(iPad) : eXuiServerAction_Idle;
}
void* getXuiServerActionParam(int iPad) {
return s_getXuiServerActionParam ? s_getXuiServerActionParam(iPad) : nullptr;
}
void setGlobalXuiAction(eXuiAction action) {
if (s_setGlobalXuiAction) s_setGlobalXuiAction(action);
}
void handleButtonPresses() {
if (s_handleButtonPresses) s_handleButtonPresses();
}
void setTMSAction(int iPad, eTMSAction action) {
if (s_setTMSAction) s_setTMSAction(iPad, action);
}
// Skin / cape / animation
static std::wstring (*s_getPlayerSkinName)(int) = nullptr;
static std::uint32_t (*s_getPlayerSkinId)(int) = nullptr;
static std::wstring (*s_getPlayerCapeName)(int) = nullptr;
static std::uint32_t (*s_getPlayerCapeId)(int) = nullptr;
static std::uint32_t (*s_getAdditionalModelPartsForPad)(int) = nullptr;
static void (*s_setAdditionalSkinBoxes)(std::uint32_t, SKIN_BOX*, unsigned int) = nullptr;
static std::vector<SKIN_BOX*>* (*s_getAdditionalSkinBoxes)(std::uint32_t) = nullptr;
static std::vector<ModelPart*>* (*s_getAdditionalModelParts)(std::uint32_t) = nullptr;
static std::vector<ModelPart*>* (*s_setAdditionalSkinBoxesFromVec)(
std::uint32_t, std::vector<SKIN_BOX*>*) = nullptr;
static void (*s_setAnimOverrideBitmask)(std::uint32_t, unsigned int) = nullptr;
static unsigned int (*s_getAnimOverrideBitmask)(std::uint32_t) = nullptr;
static std::uint32_t (*s_skinIdFromPath)(const std::wstring&) = nullptr;
static std::wstring (*s_skinPathFromId)(std::uint32_t) = nullptr;
static bool (*s_defaultCapeExists)() = nullptr;
static bool (*s_isXuidNotch)(PlayerUID) = nullptr;
static bool (*s_isXuidDeadmau5)(PlayerUID) = nullptr;
void initSkinCape(
std::wstring (*getPlayerSkinNameFn)(int),
std::uint32_t (*getPlayerSkinIdFn)(int),
std::wstring (*getPlayerCapeNameFn)(int),
std::uint32_t (*getPlayerCapeIdFn)(int),
std::uint32_t (*getAdditionalModelPartsForPadFn)(int),
void (*setAdditionalSkinBoxesFn)(std::uint32_t, SKIN_BOX*, unsigned int),
std::vector<SKIN_BOX*>* (*getAdditionalSkinBoxesFn)(std::uint32_t),
std::vector<ModelPart*>* (*getAdditionalModelPartsFn)(std::uint32_t),
std::vector<ModelPart*>* (*setAdditionalSkinBoxesFromVecFn)(
std::uint32_t, std::vector<SKIN_BOX*>*),
void (*setAnimOverrideBitmaskFn)(std::uint32_t, unsigned int),
unsigned int (*getAnimOverrideBitmaskFn)(std::uint32_t),
std::uint32_t (*skinIdFromPathFn)(const std::wstring&),
std::wstring (*skinPathFromIdFn)(std::uint32_t),
bool (*defaultCapeExistsFn)(),
bool (*isXuidNotchFn)(PlayerUID),
bool (*isXuidDeadmau5Fn)(PlayerUID)
) {
s_getPlayerSkinName = getPlayerSkinNameFn;
s_getPlayerSkinId = getPlayerSkinIdFn;
s_getPlayerCapeName = getPlayerCapeNameFn;
s_getPlayerCapeId = getPlayerCapeIdFn;
s_getAdditionalModelPartsForPad = getAdditionalModelPartsForPadFn;
s_setAdditionalSkinBoxes = setAdditionalSkinBoxesFn;
s_getAdditionalSkinBoxes = getAdditionalSkinBoxesFn;
s_getAdditionalModelParts = getAdditionalModelPartsFn;
s_setAdditionalSkinBoxesFromVec = setAdditionalSkinBoxesFromVecFn;
s_setAnimOverrideBitmask = setAnimOverrideBitmaskFn;
s_getAnimOverrideBitmask = getAnimOverrideBitmaskFn;
s_skinIdFromPath = skinIdFromPathFn;
s_skinPathFromId = skinPathFromIdFn;
s_defaultCapeExists = defaultCapeExistsFn;
s_isXuidNotch = isXuidNotchFn;
s_isXuidDeadmau5 = isXuidDeadmau5Fn;
}
std::wstring getPlayerSkinName(int iPad) {
return s_getPlayerSkinName ? s_getPlayerSkinName(iPad) : L"";
}
std::uint32_t getPlayerSkinId(int iPad) {
return s_getPlayerSkinId ? s_getPlayerSkinId(iPad) : 0;
}
std::wstring getPlayerCapeName(int iPad) {
return s_getPlayerCapeName ? s_getPlayerCapeName(iPad) : L"";
}
std::uint32_t getPlayerCapeId(int iPad) {
return s_getPlayerCapeId ? s_getPlayerCapeId(iPad) : 0;
}
std::uint32_t getAdditionalModelPartsForPad(int iPad) {
return s_getAdditionalModelPartsForPad ? s_getAdditionalModelPartsForPad(iPad) : 0;
}
void setAdditionalSkinBoxes(std::uint32_t dwSkinID, SKIN_BOX* boxA,
unsigned int boxC) {
if (s_setAdditionalSkinBoxes) s_setAdditionalSkinBoxes(dwSkinID, boxA, boxC);
}
std::vector<SKIN_BOX*>* getAdditionalSkinBoxes(std::uint32_t dwSkinID) {
return s_getAdditionalSkinBoxes ? s_getAdditionalSkinBoxes(dwSkinID) : nullptr;
}
std::vector<ModelPart*>* getAdditionalModelParts(std::uint32_t dwSkinID) {
return s_getAdditionalModelParts ? s_getAdditionalModelParts(dwSkinID) : nullptr;
}
std::vector<ModelPart*>* setAdditionalSkinBoxesFromVec(
std::uint32_t dwSkinID, std::vector<SKIN_BOX*>* pvSkinBoxA) {
return s_setAdditionalSkinBoxesFromVec
? s_setAdditionalSkinBoxesFromVec(dwSkinID, pvSkinBoxA)
: nullptr;
}
void setAnimOverrideBitmask(std::uint32_t dwSkinID, unsigned int bitmask) {
if (s_setAnimOverrideBitmask) s_setAnimOverrideBitmask(dwSkinID, bitmask);
}
unsigned int getAnimOverrideBitmask(std::uint32_t dwSkinID) {
return s_getAnimOverrideBitmask ? s_getAnimOverrideBitmask(dwSkinID) : 0;
}
std::uint32_t getSkinIdFromPath(const std::wstring& skin) {
return s_skinIdFromPath ? s_skinIdFromPath(skin) : 0;
}
std::wstring getSkinPathFromId(std::uint32_t skinId) {
return s_skinPathFromId ? s_skinPathFromId(skinId) : L"";
}
bool defaultCapeExists() {
return s_defaultCapeExists ? s_defaultCapeExists() : false;
}
bool isXuidNotch(PlayerUID xuid) {
return s_isXuidNotch ? s_isXuidNotch(xuid) : false;
}
bool isXuidDeadmau5(PlayerUID xuid) {
return s_isXuidDeadmau5 ? s_isXuidDeadmau5(xuid) : false;
}
// Platform features
static void (*s_fatalLoadError)() = nullptr;
static void (*s_setRichPresenceContext)(int, int) = nullptr;
static void (*s_captureSaveThumbnail)() = nullptr;
static void (*s_getSaveThumbnail)(std::uint8_t**, unsigned int*) = nullptr;
static void (*s_readBannedList)(int, eTMSAction, bool) = nullptr;
static void (*s_updatePlayerInfo)(std::uint8_t, int16_t, unsigned int) = nullptr;
static unsigned int (*s_getPlayerPrivileges)(std::uint8_t) = nullptr;
static void (*s_setGameSettingsDebugMask)(int, unsigned int) = nullptr;
void initPlatformFeatures(
void (*fatalLoadErrorFn)(),
void (*setRichPresenceContextFn)(int, int),
void (*captureSaveThumbnailFn)(),
void (*getSaveThumbnailFn)(std::uint8_t**, unsigned int*),
void (*readBannedListFn)(int, eTMSAction, bool),
void (*updatePlayerInfoFn)(std::uint8_t, int16_t, unsigned int),
unsigned int (*getPlayerPrivilegesFn)(std::uint8_t),
void (*setGameSettingsDebugMaskFn)(int, unsigned int)
) {
s_fatalLoadError = fatalLoadErrorFn;
s_setRichPresenceContext = setRichPresenceContextFn;
s_captureSaveThumbnail = captureSaveThumbnailFn;
s_getSaveThumbnail = getSaveThumbnailFn;
s_readBannedList = readBannedListFn;
s_updatePlayerInfo = updatePlayerInfoFn;
s_getPlayerPrivileges = getPlayerPrivilegesFn;
s_setGameSettingsDebugMask = setGameSettingsDebugMaskFn;
}
void fatalLoadError() {
if (s_fatalLoadError) s_fatalLoadError();
}
void setRichPresenceContext(int iPad, int contextId) {
if (s_setRichPresenceContext) s_setRichPresenceContext(iPad, contextId);
}
void captureSaveThumbnail() {
if (s_captureSaveThumbnail) s_captureSaveThumbnail();
}
void getSaveThumbnail(std::uint8_t** data, unsigned int* size) {
if (s_getSaveThumbnail) s_getSaveThumbnail(data, size);
}
void readBannedList(int iPad, eTMSAction action, bool bCallback) {
if (s_readBannedList) s_readBannedList(iPad, action, bCallback);
}
void updatePlayerInfo(std::uint8_t networkSmallId, int16_t playerColourIndex,
unsigned int playerPrivileges) {
if (s_updatePlayerInfo) s_updatePlayerInfo(networkSmallId, playerColourIndex, playerPrivileges);
}
unsigned int getPlayerPrivileges(std::uint8_t networkSmallId) {
return s_getPlayerPrivileges ? s_getPlayerPrivileges(networkSmallId) : 0;
}
void setGameSettingsDebugMask(int iPad, unsigned int uiVal) {
if (s_setGameSettingsDebugMask) s_setGameSettingsDebugMask(iPad, uiVal);
}
// Schematics / terrain
static void (*s_processSchematics)(LevelChunk*) = nullptr;
static void (*s_processSchematicsLighting)(LevelChunk*) = nullptr;
static void (*s_addTerrainFeaturePosition)(_eTerrainFeatureType, int, int) = nullptr;
static bool (*s_getTerrainFeaturePosition)(_eTerrainFeatureType, int*, int*) = nullptr;
static void (*s_loadDefaultGameRules)() = nullptr;
void initSchematics(
void (*processSchematicsFn)(LevelChunk*),
void (*processSchematicsLightingFn)(LevelChunk*),
void (*addTerrainFeaturePositionFn)(_eTerrainFeatureType, int, int),
bool (*getTerrainFeaturePositionFn)(_eTerrainFeatureType, int*, int*),
void (*loadDefaultGameRulesFn)()
) {
s_processSchematics = processSchematicsFn;
s_processSchematicsLighting = processSchematicsLightingFn;
s_addTerrainFeaturePosition = addTerrainFeaturePositionFn;
s_getTerrainFeaturePosition = getTerrainFeaturePositionFn;
s_loadDefaultGameRules = loadDefaultGameRulesFn;
}
void processSchematics(LevelChunk* chunk) {
if (s_processSchematics) s_processSchematics(chunk);
}
void processSchematicsLighting(LevelChunk* chunk) {
if (s_processSchematicsLighting) s_processSchematicsLighting(chunk);
}
void addTerrainFeaturePosition(_eTerrainFeatureType type, int x, int z) {
if (s_addTerrainFeaturePosition) s_addTerrainFeaturePosition(type, x, z);
}
bool getTerrainFeaturePosition(_eTerrainFeatureType type, int* pX, int* pZ) {
return s_getTerrainFeaturePosition ? s_getTerrainFeaturePosition(type, pX, pZ) : false;
}
void loadDefaultGameRules() {
if (s_loadDefaultGameRules) s_loadDefaultGameRules();
}
// Archive / resources
static bool (*s_hasArchiveFile)(const std::wstring&) = nullptr;
static std::vector<std::uint8_t> (*s_getArchiveFile)(const std::wstring&) = nullptr;
void initArchive(
bool (*hasArchiveFileFn)(const std::wstring&),
std::vector<std::uint8_t> (*getArchiveFileFn)(const std::wstring&)
) {
s_hasArchiveFile = hasArchiveFileFn;
s_getArchiveFile = getArchiveFileFn;
}
bool hasArchiveFile(const std::wstring& filename) {
return s_hasArchiveFile ? s_hasArchiveFile(filename) : false;
}
std::vector<std::uint8_t> getArchiveFile(const std::wstring& filename) {
return s_getArchiveFile ? s_getArchiveFile(filename) : std::vector<std::uint8_t>{};
}
// Strings / formatting / misc queries
static int (*s_getHTMLColour)(eMinecraftColour) = nullptr;
static std::wstring (*s_getEntityName)(EntityTypeId) = nullptr;
static const wchar_t* (*s_getGameRulesString)(const std::wstring&) = nullptr;
static unsigned int (*s_createImageTextData)(std::uint8_t*, int64_t, bool,
unsigned int, unsigned int) = nullptr;
static std::wstring (*s_getFilePath)(std::uint32_t, std::wstring, bool,
std::wstring) = nullptr;
static char* (*s_getUniqueMapName)() = nullptr;
static void (*s_setUniqueMapName)(char*) = nullptr;
static unsigned int (*s_getOpacityTimer)(int) = nullptr;
static void (*s_setOpacityTimer)(int) = nullptr;
static void (*s_tickOpacityTimer)(int) = nullptr;
static bool (*s_isInBannedLevelList)(int, PlayerUID, char*) = nullptr;
static MOJANG_DATA* (*s_getMojangDataForXuid)(PlayerUID) = nullptr;
static void (*s_debugPrintf)(const char*) = nullptr;
void initStringsAndMisc(
int (*getHTMLColourFn)(eMinecraftColour),
std::wstring (*getEntityNameFn)(EntityTypeId),
const wchar_t* (*getGameRulesStringFn)(const std::wstring&),
unsigned int (*createImageTextDataFn)(std::uint8_t*, int64_t, bool,
unsigned int, unsigned int),
std::wstring (*getFilePathFn)(std::uint32_t, std::wstring, bool,
std::wstring),
char* (*getUniqueMapNameFn)(),
void (*setUniqueMapNameFn)(char*),
unsigned int (*getOpacityTimerFn)(int),
void (*setOpacityTimerFn)(int),
void (*tickOpacityTimerFn)(int),
bool (*isInBannedLevelListFn)(int, PlayerUID, char*),
MOJANG_DATA* (*getMojangDataForXuidFn)(PlayerUID),
void (*debugPrintfFn)(const char*)
) {
s_getHTMLColour = getHTMLColourFn;
s_getEntityName = getEntityNameFn;
s_getGameRulesString = getGameRulesStringFn;
s_createImageTextData = createImageTextDataFn;
s_getFilePath = getFilePathFn;
s_getUniqueMapName = getUniqueMapNameFn;
s_setUniqueMapName = setUniqueMapNameFn;
s_getOpacityTimer = getOpacityTimerFn;
s_setOpacityTimer = setOpacityTimerFn;
s_tickOpacityTimer = tickOpacityTimerFn;
s_isInBannedLevelList = isInBannedLevelListFn;
s_getMojangDataForXuid = getMojangDataForXuidFn;
s_debugPrintf = debugPrintfFn;
}
int getHTMLColour(eMinecraftColour colour) {
return s_getHTMLColour ? s_getHTMLColour(colour) : 0;
}
int getHTMLColor(eMinecraftColour colour) { return getHTMLColour(colour); }
std::wstring getEntityName(EntityTypeId type) {
return s_getEntityName ? s_getEntityName(type) : L"";
}
const wchar_t* getGameRulesString(const std::wstring& key) {
return s_getGameRulesString ? s_getGameRulesString(key) : L"";
}
unsigned int createImageTextData(std::uint8_t* textMetadata, int64_t seed,
bool hasSeed, unsigned int uiHostOptions,
unsigned int uiTexturePackId) {
return s_createImageTextData
? s_createImageTextData(textMetadata, seed, hasSeed,
uiHostOptions, uiTexturePackId)
: 0;
}
std::wstring getFilePath(std::uint32_t packId, std::wstring filename,
bool bAddDataFolder, std::wstring mountPoint) {
return s_getFilePath ? s_getFilePath(packId, filename, bAddDataFolder, mountPoint) : L"";
}
char* getUniqueMapName() {
return s_getUniqueMapName ? s_getUniqueMapName() : nullptr;
}
void setUniqueMapName(char* name) {
if (s_setUniqueMapName) s_setUniqueMapName(name);
}
unsigned int getOpacityTimer(int iPad) {
return s_getOpacityTimer ? s_getOpacityTimer(iPad) : 0;
}
void setOpacityTimer(int iPad) {
if (s_setOpacityTimer) s_setOpacityTimer(iPad);
}
void tickOpacityTimer(int iPad) {
if (s_tickOpacityTimer) s_tickOpacityTimer(iPad);
}
bool isInBannedLevelList(int iPad, PlayerUID xuid, char* levelName) {
return s_isInBannedLevelList ? s_isInBannedLevelList(iPad, xuid, levelName) : false;
}
MOJANG_DATA* getMojangDataForXuid(PlayerUID xuid) {
return s_getMojangDataForXuid ? s_getMojangDataForXuid(xuid) : nullptr;
}
void debugPrintf(const char* msg) {
if (s_debugPrintf) s_debugPrintf(msg);
}
// Member variable access
static DLCManager* s_dlcManager = nullptr;
static GameRuleManager* s_gameRules = nullptr;
static std::vector<std::wstring>* s_skinNames = nullptr;
static std::vector<FEATURE_DATA*>* s_terrainFeatures = nullptr;
void initMemberAccess(
DLCManager* dlcManager,
GameRuleManager* gameRules,
std::vector<std::wstring>* skinNames,
std::vector<FEATURE_DATA*>* terrainFeatures
) {
s_dlcManager = dlcManager;
s_gameRules = gameRules;
s_skinNames = skinNames;
s_terrainFeatures = terrainFeatures;
}
DLCManager& getDLCManager() {
assert(s_dlcManager);
return *s_dlcManager;
}
GameRuleManager& getGameRules() {
assert(s_gameRules);
return *s_gameRules;
}
std::vector<std::wstring>& getSkinNames() {
assert(s_skinNames);
return *s_skinNames;
}
std::vector<FEATURE_DATA*>& getTerrainFeatures() {
assert(s_terrainFeatures);
return *s_terrainFeatures;
}
// Menu service
static IMenuService* s_menuService = nullptr;
void initMenuService(IMenuService* service) { s_menuService = service; }
IMenuService& menus() {
assert(s_menuService);
return *s_menuService;
}
} // namespace GameServices

View file

@ -1,305 +0,0 @@
#pragma once
#include <cstdint>
#include <string>
#include <vector>
// Forward declarations - minecraft types
class LevelGenerationOptions;
class LevelRuleset;
class LevelChunk;
class ModelPart;
// Forward declarations - app types (opaque pointers only)
class DLCManager;
class GameRuleManager;
// SKIN_BOX, FEATURE_DATA, MOJANG_DATA are C-style typedef'd structs
// that cannot be forward-declared. Include the lightweight headers.
#include "minecraft/client/SkinBox.h"
#include "app/common/App_structs.h"
// Enums needed by callers - pulled from app layer.
// These are small POD enums safe to include transitively.
#include "app/common/App_enums.h"
#include "platform/PlatformTypes.h" // PlayerUID
#include "minecraft/network/packet/DisconnectPacket.h" // eDisconnectReason
#include "minecraft/client/IMenuService.h"
// eINSTANCEOF lives in java/Class.h which is heavyweight.
// We use int here and cast at init/call sites.
using EntityTypeId = int;
namespace GameServices {
using LevelGenOptsFn = LevelGenerationOptions* (*)();
using GameRuleDefsFn = LevelRuleset* (*)();
void initLevelGen(LevelGenOptsFn levelGenOpts, GameRuleDefsFn gameRuleDefs);
[[nodiscard]] LevelGenerationOptions* getLevelGenerationOptions();
[[nodiscard]] LevelRuleset* getGameRuleDefinitions();
using AddTexFn = void (*)(const std::wstring&, std::uint8_t*, unsigned int);
using RemoveTexFn = void (*)(const std::wstring&);
using GetTexDetailsFn = void (*)(const std::wstring&, std::uint8_t**,
unsigned int*);
using HasTexFn = bool (*)(const std::wstring&);
void initTextureCache(AddTexFn add, RemoveTexFn remove,
GetTexDetailsFn getDetails, HasTexFn has);
void addMemoryTextureFile(const std::wstring& name, std::uint8_t* data,
unsigned int size);
void removeMemoryTextureFile(const std::wstring& name);
void getMemFileDetails(const std::wstring& name, std::uint8_t** data,
unsigned int* size);
[[nodiscard]] bool isFileInMemoryTextures(const std::wstring& name);
using GetSettingsFn = unsigned char (*)(int iPad, int setting);
using GetSettingsNoArgFn = unsigned char (*)(int setting);
void initPlayerSettings(GetSettingsFn getSettings,
GetSettingsNoArgFn getSettingsNoArg);
[[nodiscard]] unsigned char getGameSettings(int iPad, int setting);
[[nodiscard]] unsigned char getGameSettings(int setting);
using AppTimeFn = float (*)();
void initAppTime(AppTimeFn fn);
[[nodiscard]] float getAppTime();
// Game state
void initGameState(
bool (*getGameStarted)(),
void (*setGameStarted)(bool),
bool (*getTutorialMode)(),
void (*setTutorialMode)(bool),
bool (*isAppPaused)(),
int (*getLocalPlayerCount)(),
bool (*autosaveDue)(),
void (*setAutosaveTimerTime)(),
int64_t (*secondsToAutosave)(),
void (*setDisconnectReason)(DisconnectPacket::eDisconnectReason),
void (*lockSaveNotify)(),
void (*unlockSaveNotify)(),
bool (*getResetNether)(),
bool (*getUseDPadForDebug)(),
bool (*getWriteSavesToFolderEnabled)(),
bool (*isLocalMultiplayerAvailable)(),
bool (*dlcInstallPending)(),
bool (*dlcInstallProcessCompleted)(),
bool (*canRecordStatsAndAchievements)(),
bool (*getTMSGlobalFileListRead)(),
void (*setRequiredTexturePackID)(std::uint32_t),
void (*setSpecialTutorialCompletionFlag)(int iPad, int index),
void (*setBanListCheck)(int iPad, bool),
bool (*getBanListCheck)(int iPad),
unsigned int (*getGameNewWorldSize)(),
unsigned int (*getGameNewWorldSizeUseMoat)(),
unsigned int (*getGameNewHellScale)()
);
[[nodiscard]] bool getGameStarted();
void setGameStarted(bool val);
[[nodiscard]] bool getTutorialMode();
void setTutorialMode(bool val);
[[nodiscard]] bool isAppPaused();
[[nodiscard]] int getLocalPlayerCount();
[[nodiscard]] bool autosaveDue();
void setAutosaveTimerTime();
[[nodiscard]] int64_t secondsToAutosave();
void setDisconnectReason(DisconnectPacket::eDisconnectReason reason);
void lockSaveNotification();
void unlockSaveNotification();
[[nodiscard]] bool getResetNether();
[[nodiscard]] bool getUseDPadForDebug();
[[nodiscard]] bool getWriteSavesToFolderEnabled();
[[nodiscard]] bool isLocalMultiplayerAvailable();
[[nodiscard]] bool dlcInstallPending();
[[nodiscard]] bool dlcInstallProcessCompleted();
[[nodiscard]] bool canRecordStatsAndAchievements();
[[nodiscard]] bool getTMSGlobalFileListRead();
void setRequiredTexturePackID(std::uint32_t id);
void setSpecialTutorialCompletionFlag(int iPad, int index);
void setBanListCheck(int iPad, bool val);
[[nodiscard]] bool getBanListCheck(int iPad);
[[nodiscard]] unsigned int getGameNewWorldSize();
[[nodiscard]] unsigned int getGameNewWorldSizeUseMoat();
[[nodiscard]] unsigned int getGameNewHellScale();
// UI dispatch
void initUIDispatch(
void (*setAction)(int iPad, eXuiAction action, void* param),
void (*setXuiServerAction)(int iPad, eXuiServerAction action, void* param),
eXuiAction (*getXuiAction)(int iPad),
eXuiServerAction (*getXuiServerAction)(int iPad),
void* (*getXuiServerActionParam)(int iPad),
void (*setGlobalXuiAction)(eXuiAction action),
void (*handleButtonPresses)(),
void (*setTMSAction)(int iPad, eTMSAction action)
);
void setAction(int iPad, eXuiAction action, void* param = nullptr);
void setXuiServerAction(int iPad, eXuiServerAction action,
void* param = nullptr);
[[nodiscard]] eXuiAction getXuiAction(int iPad);
[[nodiscard]] eXuiServerAction getXuiServerAction(int iPad);
[[nodiscard]] void* getXuiServerActionParam(int iPad);
void setGlobalXuiAction(eXuiAction action);
void handleButtonPresses();
void setTMSAction(int iPad, eTMSAction action);
// Skin / cape / animation
void initSkinCape(
std::wstring (*getPlayerSkinName)(int iPad),
std::uint32_t (*getPlayerSkinId)(int iPad),
std::wstring (*getPlayerCapeName)(int iPad),
std::uint32_t (*getPlayerCapeId)(int iPad),
std::uint32_t (*getAdditionalModelPartsForPad)(int iPad),
void (*setAdditionalSkinBoxes)(std::uint32_t dwSkinID, SKIN_BOX* boxA,
unsigned int boxC),
std::vector<SKIN_BOX*>* (*getAdditionalSkinBoxes)(std::uint32_t dwSkinID),
std::vector<ModelPart*>* (*getAdditionalModelParts)(std::uint32_t dwSkinID),
std::vector<ModelPart*>* (*setAdditionalSkinBoxesFromVec)(
std::uint32_t dwSkinID, std::vector<SKIN_BOX*>* pvSkinBoxA),
void (*setAnimOverrideBitmask)(std::uint32_t dwSkinID, unsigned int bitmask),
unsigned int (*getAnimOverrideBitmask)(std::uint32_t dwSkinID),
std::uint32_t (*skinIdFromPath)(const std::wstring& skin),
std::wstring (*skinPathFromId)(std::uint32_t skinId),
bool (*defaultCapeExists)(),
bool (*isXuidNotch)(PlayerUID xuid),
bool (*isXuidDeadmau5)(PlayerUID xuid)
);
[[nodiscard]] std::wstring getPlayerSkinName(int iPad);
[[nodiscard]] std::uint32_t getPlayerSkinId(int iPad);
[[nodiscard]] std::wstring getPlayerCapeName(int iPad);
[[nodiscard]] std::uint32_t getPlayerCapeId(int iPad);
[[nodiscard]] std::uint32_t getAdditionalModelPartsForPad(int iPad);
void setAdditionalSkinBoxes(std::uint32_t dwSkinID, SKIN_BOX* boxA,
unsigned int boxC);
[[nodiscard]] std::vector<SKIN_BOX*>* getAdditionalSkinBoxes(
std::uint32_t dwSkinID);
[[nodiscard]] std::vector<ModelPart*>* getAdditionalModelParts(
std::uint32_t dwSkinID);
std::vector<ModelPart*>* setAdditionalSkinBoxesFromVec(
std::uint32_t dwSkinID, std::vector<SKIN_BOX*>* pvSkinBoxA);
void setAnimOverrideBitmask(std::uint32_t dwSkinID, unsigned int bitmask);
[[nodiscard]] unsigned int getAnimOverrideBitmask(std::uint32_t dwSkinID);
[[nodiscard]] std::uint32_t getSkinIdFromPath(const std::wstring& skin);
[[nodiscard]] std::wstring getSkinPathFromId(std::uint32_t skinId);
[[nodiscard]] bool defaultCapeExists();
[[nodiscard]] bool isXuidNotch(PlayerUID xuid);
[[nodiscard]] bool isXuidDeadmau5(PlayerUID xuid);
// Platform features
void initPlatformFeatures(
void (*fatalLoadError)(),
void (*setRichPresenceContext)(int iPad, int contextId),
void (*captureSaveThumbnail)(),
void (*getSaveThumbnail)(std::uint8_t**, unsigned int*),
void (*readBannedList)(int iPad, eTMSAction action, bool bCallback),
void (*updatePlayerInfo)(std::uint8_t networkSmallId,
int16_t playerColourIndex,
unsigned int playerPrivileges),
unsigned int (*getPlayerPrivileges)(std::uint8_t networkSmallId),
void (*setGameSettingsDebugMask)(int iPad, unsigned int uiVal)
);
void fatalLoadError();
void setRichPresenceContext(int iPad, int contextId);
void captureSaveThumbnail();
void getSaveThumbnail(std::uint8_t** data, unsigned int* size);
void readBannedList(int iPad, eTMSAction action = (eTMSAction)0,
bool bCallback = false);
void updatePlayerInfo(std::uint8_t networkSmallId, int16_t playerColourIndex,
unsigned int playerPrivileges);
[[nodiscard]] unsigned int getPlayerPrivileges(std::uint8_t networkSmallId);
void setGameSettingsDebugMask(int iPad, unsigned int uiVal);
// Schematics / terrain
void initSchematics(
void (*processSchematics)(LevelChunk* chunk),
void (*processSchematicsLighting)(LevelChunk* chunk),
void (*addTerrainFeaturePosition)(_eTerrainFeatureType, int, int),
bool (*getTerrainFeaturePosition)(_eTerrainFeatureType, int*, int*),
void (*loadDefaultGameRules)()
);
void processSchematics(LevelChunk* chunk);
void processSchematicsLighting(LevelChunk* chunk);
void addTerrainFeaturePosition(_eTerrainFeatureType type, int x, int z);
[[nodiscard]] bool getTerrainFeaturePosition(_eTerrainFeatureType type,
int* pX, int* pZ);
void loadDefaultGameRules();
// Archive / resources
void initArchive(
bool (*hasArchiveFile)(const std::wstring&),
std::vector<std::uint8_t> (*getArchiveFile)(const std::wstring&)
);
[[nodiscard]] bool hasArchiveFile(const std::wstring& filename);
[[nodiscard]] std::vector<std::uint8_t> getArchiveFile(
const std::wstring& filename);
// Strings / formatting / misc queries
void initStringsAndMisc(
int (*getHTMLColour)(eMinecraftColour),
std::wstring (*getEntityName)(EntityTypeId),
const wchar_t* (*getGameRulesString)(const std::wstring&),
unsigned int (*createImageTextData)(std::uint8_t*, int64_t, bool,
unsigned int, unsigned int),
std::wstring (*getFilePath)(std::uint32_t, std::wstring, bool,
std::wstring),
char* (*getUniqueMapName)(),
void (*setUniqueMapName)(char*),
unsigned int (*getOpacityTimer)(int iPad),
void (*setOpacityTimer)(int iPad),
void (*tickOpacityTimer)(int iPad),
bool (*isInBannedLevelList)(int iPad, PlayerUID xuid, char* levelName),
MOJANG_DATA* (*getMojangDataForXuid)(PlayerUID xuid),
void (*debugPrintf)(const char*)
);
[[nodiscard]] int getHTMLColour(eMinecraftColour colour);
[[nodiscard]] int getHTMLColor(eMinecraftColour colour);
[[nodiscard]] std::wstring getEntityName(EntityTypeId type);
[[nodiscard]] const wchar_t* getGameRulesString(const std::wstring& key);
[[nodiscard]] unsigned int createImageTextData(std::uint8_t* textMetadata,
int64_t seed, bool hasSeed,
unsigned int uiHostOptions,
unsigned int uiTexturePackId);
[[nodiscard]] std::wstring getFilePath(std::uint32_t packId,
std::wstring filename,
bool bAddDataFolder,
std::wstring mountPoint = L"TPACK:");
[[nodiscard]] char* getUniqueMapName();
void setUniqueMapName(char* name);
[[nodiscard]] unsigned int getOpacityTimer(int iPad);
void setOpacityTimer(int iPad);
void tickOpacityTimer(int iPad);
[[nodiscard]] bool isInBannedLevelList(int iPad, PlayerUID xuid,
char* levelName);
[[nodiscard]] MOJANG_DATA* getMojangDataForXuid(PlayerUID xuid);
void debugPrintf(const char* msg);
// Member variable access (opaque pointers)
void initMemberAccess(
DLCManager* dlcManager,
GameRuleManager* gameRules,
std::vector<std::wstring>* skinNames,
std::vector<FEATURE_DATA*>* terrainFeatures
);
[[nodiscard]] DLCManager& getDLCManager();
[[nodiscard]] GameRuleManager& getGameRules();
[[nodiscard]] std::vector<std::wstring>& getSkinNames();
[[nodiscard]] std::vector<FEATURE_DATA*>& getTerrainFeatures();
void initMenuService(IMenuService* service);
[[nodiscard]] IMenuService& menus();
} // namespace GameServices

View file

@ -0,0 +1,20 @@
#pragma once
#include <cstdint>
#include "minecraft/GameEnums.h"
#ifndef MAX_CAPENAME_SIZE
#define MAX_CAPENAME_SIZE 32
#endif
struct MOJANG_DATA {
eXUID eXuid;
wchar_t wchCape[MAX_CAPENAME_SIZE];
wchar_t wchSkin[MAX_CAPENAME_SIZE];
};
struct FEATURE_DATA {
int x, z;
_eTerrainFeatureType eTerrainFeature;
};

View file

@ -0,0 +1,15 @@
#include "minecraft/IGameServices.h"
#include <cassert>
static IGameServices* s_services = nullptr;
void initGameServices(IGameServices* services) {
s_services = services;
}
IGameServices& gameServices() {
assert(s_services &&
"initGameServices() must be called before gameServices()");
return *s_services;
}

View file

@ -0,0 +1,235 @@
#pragma once
#include <cstdint>
#include <string>
#include <vector>
// Forward declarations - minecraft types
class LevelGenerationOptions;
class LevelRuleset;
class LevelChunk;
class ModelPart;
// Forward declarations
class DLCSkinFile;
class DLCPack;
#include "minecraft/client/model/SkinBox.h"
#include "minecraft/GameTypes.h"
#include "minecraft/GameEnums.h"
#include "platform/PlatformTypes.h"
#include "minecraft/network/packet/DisconnectPacket.h"
#include "minecraft/client/IMenuService.h"
// eINSTANCEOF lives in java/Class.h which is heavyweight.
using EntityTypeId = int;
class IGameServices {
public:
virtual ~IGameServices() = default;
// -- Strings --
[[nodiscard]] virtual const wchar_t* getString(int id) = 0;
// -- Debug settings --
[[nodiscard]] virtual bool debugSettingsOn() = 0;
[[nodiscard]] virtual bool debugArtToolsOn() = 0;
[[nodiscard]] virtual unsigned int debugGetMask(int iPad = -1,
bool overridePlayer = false) = 0;
[[nodiscard]] virtual bool debugMobsDontAttack() = 0;
[[nodiscard]] virtual bool debugMobsDontTick() = 0;
[[nodiscard]] virtual bool debugFreezePlayers() = 0;
// -- Game host options (global settings via stored pointer) --
[[nodiscard]] virtual unsigned int getGameHostOption(eGameHostOption option) = 0;
virtual void setGameHostOption(eGameHostOption option,
unsigned int value) = 0;
// -- Level generation --
[[nodiscard]] virtual LevelGenerationOptions* getLevelGenerationOptions() = 0;
[[nodiscard]] virtual LevelRuleset* getGameRuleDefinitions() = 0;
// -- Texture cache --
virtual void addMemoryTextureFile(const std::wstring& name,
std::uint8_t* data,
unsigned int size) = 0;
virtual void removeMemoryTextureFile(const std::wstring& name) = 0;
virtual void getMemFileDetails(const std::wstring& name,
std::uint8_t** data,
unsigned int* size) = 0;
[[nodiscard]] virtual bool isFileInMemoryTextures(const std::wstring& name) = 0;
// -- Player settings --
[[nodiscard]] virtual unsigned char getGameSettings(int iPad, int setting) = 0;
[[nodiscard]] virtual unsigned char getGameSettings(int setting) = 0;
// -- App time --
[[nodiscard]] virtual float getAppTime() = 0;
// -- Game state --
[[nodiscard]] virtual bool getGameStarted() = 0;
virtual void setGameStarted(bool val) = 0;
[[nodiscard]] virtual bool getTutorialMode() = 0;
virtual void setTutorialMode(bool val) = 0;
[[nodiscard]] virtual bool isAppPaused() = 0;
[[nodiscard]] virtual int getLocalPlayerCount() = 0;
[[nodiscard]] virtual bool autosaveDue() = 0;
virtual void setAutosaveTimerTime() = 0;
[[nodiscard]] virtual int64_t secondsToAutosave() = 0;
virtual void setDisconnectReason(
DisconnectPacket::eDisconnectReason reason) = 0;
virtual void lockSaveNotification() = 0;
virtual void unlockSaveNotification() = 0;
[[nodiscard]] virtual bool getResetNether() = 0;
[[nodiscard]] virtual bool getUseDPadForDebug() = 0;
[[nodiscard]] virtual bool getWriteSavesToFolderEnabled() = 0;
[[nodiscard]] virtual bool isLocalMultiplayerAvailable() = 0;
[[nodiscard]] virtual bool dlcInstallPending() = 0;
[[nodiscard]] virtual bool dlcInstallProcessCompleted() = 0;
[[nodiscard]] virtual bool canRecordStatsAndAchievements() = 0;
[[nodiscard]] virtual bool getTMSGlobalFileListRead() = 0;
virtual void setRequiredTexturePackID(std::uint32_t id) = 0;
virtual void setSpecialTutorialCompletionFlag(int iPad, int index) = 0;
virtual void setBanListCheck(int iPad, bool val) = 0;
[[nodiscard]] virtual bool getBanListCheck(int iPad) = 0;
[[nodiscard]] virtual unsigned int getGameNewWorldSize() = 0;
[[nodiscard]] virtual unsigned int getGameNewWorldSizeUseMoat() = 0;
[[nodiscard]] virtual unsigned int getGameNewHellScale() = 0;
// -- UI dispatch --
virtual void setAction(int iPad, eXuiAction action,
void* param = nullptr) = 0;
virtual void setXuiServerAction(int iPad, eXuiServerAction action,
void* param = nullptr) = 0;
[[nodiscard]] virtual eXuiAction getXuiAction(int iPad) = 0;
[[nodiscard]] virtual eXuiServerAction getXuiServerAction(int iPad) = 0;
[[nodiscard]] virtual void* getXuiServerActionParam(int iPad) = 0;
virtual void setGlobalXuiAction(eXuiAction action) = 0;
virtual void handleButtonPresses() = 0;
virtual void setTMSAction(int iPad, eTMSAction action) = 0;
// -- Skin / cape / animation --
[[nodiscard]] virtual std::wstring getPlayerSkinName(int iPad) = 0;
[[nodiscard]] virtual std::uint32_t getPlayerSkinId(int iPad) = 0;
[[nodiscard]] virtual std::wstring getPlayerCapeName(int iPad) = 0;
[[nodiscard]] virtual std::uint32_t getPlayerCapeId(int iPad) = 0;
[[nodiscard]] virtual std::uint32_t getAdditionalModelPartsForPad(int iPad) = 0;
virtual void setAdditionalSkinBoxes(std::uint32_t dwSkinID,
SKIN_BOX* boxA,
unsigned int boxC) = 0;
[[nodiscard]] virtual std::vector<SKIN_BOX*>* getAdditionalSkinBoxes(
std::uint32_t dwSkinID) = 0;
[[nodiscard]] virtual std::vector<ModelPart*>* getAdditionalModelParts(
std::uint32_t dwSkinID) = 0;
virtual std::vector<ModelPart*>* setAdditionalSkinBoxesFromVec(
std::uint32_t dwSkinID, std::vector<SKIN_BOX*>* pvSkinBoxA) = 0;
virtual void setAnimOverrideBitmask(std::uint32_t dwSkinID,
unsigned int bitmask) = 0;
[[nodiscard]] virtual unsigned int getAnimOverrideBitmask(
std::uint32_t dwSkinID) = 0;
[[nodiscard]] virtual std::uint32_t getSkinIdFromPath(const std::wstring& skin) = 0;
[[nodiscard]] virtual std::wstring getSkinPathFromId(std::uint32_t skinId) = 0;
[[nodiscard]] virtual bool defaultCapeExists() = 0;
[[nodiscard]] virtual bool isXuidNotch(PlayerUID xuid) = 0;
[[nodiscard]] virtual bool isXuidDeadmau5(PlayerUID xuid) = 0;
// -- Platform features --
virtual void fatalLoadError() = 0;
virtual void setRichPresenceContext(int iPad, int contextId) = 0;
virtual void captureSaveThumbnail() = 0;
virtual void getSaveThumbnail(std::uint8_t** data,
unsigned int* size) = 0;
virtual void readBannedList(int iPad, eTMSAction action = (eTMSAction)0,
bool bCallback = false) = 0;
virtual void updatePlayerInfo(std::uint8_t networkSmallId,
int16_t playerColourIndex,
unsigned int playerPrivileges) = 0;
[[nodiscard]] virtual unsigned int getPlayerPrivileges(
std::uint8_t networkSmallId) = 0;
virtual void setGameSettingsDebugMask(int iPad,
unsigned int uiVal) = 0;
// -- Schematics / terrain --
virtual void processSchematics(LevelChunk* chunk) = 0;
virtual void processSchematicsLighting(LevelChunk* chunk) = 0;
virtual void addTerrainFeaturePosition(_eTerrainFeatureType type,
int x, int z) = 0;
[[nodiscard]] virtual bool getTerrainFeaturePosition(_eTerrainFeatureType type,
int* pX, int* pZ) = 0;
virtual void loadDefaultGameRules() = 0;
// -- Archive / resources --
[[nodiscard]] virtual bool hasArchiveFile(const std::wstring& filename) = 0;
[[nodiscard]] virtual std::vector<std::uint8_t> getArchiveFile(
const std::wstring& filename) = 0;
// -- Strings / formatting / misc queries --
[[nodiscard]] virtual int getHTMLColour(eMinecraftColour colour) = 0;
[[nodiscard]] virtual std::wstring getEntityName(EntityTypeId type) = 0;
[[nodiscard]] virtual const wchar_t* getGameRulesString(
const std::wstring& key) = 0;
[[nodiscard]] virtual unsigned int createImageTextData(
std::uint8_t* textMetadata, int64_t seed, bool hasSeed,
unsigned int uiHostOptions, unsigned int uiTexturePackId) = 0;
[[nodiscard]] virtual std::wstring getFilePath(std::uint32_t packId,
std::wstring filename,
bool bAddDataFolder,
std::wstring mountPoint = L"TPACK:") = 0;
[[nodiscard]] virtual char* getUniqueMapName() = 0;
virtual void setUniqueMapName(char* name) = 0;
[[nodiscard]] virtual unsigned int getOpacityTimer(int iPad) = 0;
virtual void setOpacityTimer(int iPad) = 0;
virtual void tickOpacityTimer(int iPad) = 0;
[[nodiscard]] virtual bool isInBannedLevelList(int iPad, PlayerUID xuid,
char* levelName) = 0;
[[nodiscard]] virtual MOJANG_DATA* getMojangDataForXuid(PlayerUID xuid) = 0;
virtual void debugPrintf(const char* msg) = 0;
// -- DLC --
[[nodiscard]] virtual DLCSkinFile* getDLCSkinFile(
const std::wstring& name) = 0;
[[nodiscard]] virtual bool dlcNeedsCorruptCheck() = 0;
[[nodiscard]] virtual unsigned int dlcCheckForCorrupt(bool showMessage = true) = 0;
[[nodiscard]] virtual bool dlcReadDataFile(unsigned int& filesProcessed,
const std::wstring& path, DLCPack* pack,
bool fromArchive = false) = 0;
virtual void dlcRemovePack(DLCPack* pack) = 0;
// -- Game rules --
virtual LevelGenerationOptions* loadGameRules(std::uint8_t* data,
unsigned int size) = 0;
virtual void saveGameRules(std::uint8_t** data,
unsigned int* size) = 0;
virtual void unloadCurrentGameRules() = 0;
virtual void setLevelGenerationOptions(
LevelGenerationOptions* levelGen) = 0;
// -- Shared data --
[[nodiscard]] virtual std::vector<std::wstring>& getSkinNames() = 0;
[[nodiscard]] virtual std::vector<FEATURE_DATA*>& getTerrainFeatures() = 0;
// -- Menu service --
[[nodiscard]] virtual IMenuService& menus() = 0;
};
// Global accessor - set once at startup, used everywhere in minecraft/
void initGameServices(IGameServices* services);
IGameServices& gameServices();

View file

@ -10,7 +10,7 @@
#include "app/common/DLC/DLCFile.h" #include "app/common/DLC/DLCFile.h"
#include "app/common/DLC/DLCManager.h" #include "app/common/DLC/DLCManager.h"
#include "app/common/DLC/DLCPack.h" #include "app/common/DLC/DLCPack.h"
#include "minecraft/GameServices.h" #include "minecraft/IGameServices.h"
#include "app/linux/Stubs/winapi_stubs.h" #include "app/linux/Stubs/winapi_stubs.h"
#include "PlatformTypes.h" #include "PlatformTypes.h"
#include "util/StringHelpers.h" #include "util/StringHelpers.h"
@ -98,8 +98,8 @@ BufferedImage::BufferedImage(const std::wstring& File,
&ImageInfo, &data[l]); &ImageInfo, &data[l]);
} else { } else {
std::wstring archiveKey = L"res/" + fileName; std::wstring archiveKey = L"res/" + fileName;
if (GameServices::hasArchiveFile(archiveKey)) { if (gameServices().hasArchiveFile(archiveKey)) {
std::vector<uint8_t> ba = GameServices::getArchiveFile(archiveKey); std::vector<uint8_t> ba = gameServices().getArchiveFile(archiveKey);
hr = RenderManager.LoadTextureData(ba.data(), ba.size(), hr = RenderManager.LoadTextureData(ba.data(), ba.size(),
&ImageInfo, &data[l]); &ImageInfo, &data[l]);
} }
@ -140,14 +140,14 @@ BufferedImage::BufferedImage(DLCPack* dlcPack, const std::wstring& File,
mipMapPath + L".png"); mipMapPath + L".png");
if (!dlcPack->doesPackContainFile(DLCManager::e_DLCType_All, name)) { if (!dlcPack->doesPackContainFile(DLCManager::e_DLCType_All, name)) {
if (l == 0) GameServices::fatalLoadError(); if (l == 0) gameServices().fatalLoadError();
return; return;
} }
DLCFile* dlcFile = dlcPack->getFile(DLCManager::e_DLCType_All, name); DLCFile* dlcFile = dlcPack->getFile(DLCManager::e_DLCType_All, name);
pbData = dlcFile->getData(dataBytes); pbData = dlcFile->getData(dataBytes);
if (pbData == nullptr || dataBytes == 0) { if (pbData == nullptr || dataBytes == 0) {
if (l == 0) GameServices::fatalLoadError(); if (l == 0) gameServices().fatalLoadError();
return; return;
} }
@ -175,7 +175,7 @@ BufferedImage::BufferedImage(std::uint8_t* pbData, std::uint32_t dataBytes) {
width = ImageInfo.Width; width = ImageInfo.Width;
height = ImageInfo.Height; height = ImageInfo.Height;
} else { } else {
GameServices::fatalLoadError(); gameServices().fatalLoadError();
} }
} }

View file

@ -1,7 +1,5 @@
#include "minecraft/GameServices.h" #include "minecraft/IGameServices.h"
#include "minecraft/client/IMenuService.h" #include "minecraft/client/IMenuService.h"
#include "minecraft/util/DebugSettings.h"
#include "minecraft/GameHostOptions.h"
#include "minecraft/util/Log.h" #include "minecraft/util/Log.h"
#include "Minecraft.h" #include "Minecraft.h"
@ -19,7 +17,7 @@
#include "platform/sdl2/Profile.h" #include "platform/sdl2/Profile.h"
#include "platform/sdl2/Render.h" #include "platform/sdl2/Render.h"
#include "platform/sdl2/Storage.h" #include "platform/sdl2/Storage.h"
#include "app/common/App_enums.h" #include "minecraft/GameEnums.h"
#include "app/common/Audio/SoundEngine.h" #include "app/common/Audio/SoundEngine.h"
#include "app/common/DLC/DLCManager.h" #include "app/common/DLC/DLCManager.h"
#include "app/common/Network/GameNetworkManager.h" #include "app/common/Network/GameNetworkManager.h"
@ -284,7 +282,7 @@ void Minecraft::clearConnectionFailed() {
m_connectionFailed[i] = false; m_connectionFailed[i] = false;
m_connectionFailedReason[i] = DisconnectPacket::eDisconnect_None; m_connectionFailedReason[i] = DisconnectPacket::eDisconnect_None;
} }
GameServices::setDisconnectReason(DisconnectPacket::eDisconnect_None); gameServices().setDisconnectReason(DisconnectPacket::eDisconnect_None);
} }
void Minecraft::connectTo(const std::wstring& server, int port) { void Minecraft::connectTo(const std::wstring& server, int port) {
@ -718,7 +716,7 @@ void Minecraft::updatePlayerViewportAssignments() {
for (int i = 0; i < XUSER_MAX_COUNT; i++) { for (int i = 0; i < XUSER_MAX_COUNT; i++) {
if (localplayers[i] != nullptr) { if (localplayers[i] != nullptr) {
// Primary player settings decide what the mode is // Primary player settings decide what the mode is
if (GameServices::getGameSettings(InputManager.GetPrimaryPad(), if (gameServices().getGameSettings(InputManager.GetPrimaryPad(),
eGameSetting_SplitScreenVertical)) { eGameSetting_SplitScreenVertical)) {
localplayers[i]->m_iScreenSection = localplayers[i]->m_iScreenSection =
C4JRender::VIEWPORT_TYPE_SPLIT_LEFT + found; C4JRender::VIEWPORT_TYPE_SPLIT_LEFT + found;
@ -741,7 +739,7 @@ void Minecraft::updatePlayerViewportAssignments() {
// allocations (as the players won't have seen them) This fixes // allocations (as the players won't have seen them) This fixes
// an issue with the primary player being the 4th controller // an issue with the primary player being the 4th controller
// quadrant, but ending up in the 3rd viewport. // quadrant, but ending up in the 3rd viewport.
if (GameServices::getGameStarted()) { if (gameServices().getGameStarted()) {
if ((localplayers[i]->m_iScreenSection >= if ((localplayers[i]->m_iScreenSection >=
C4JRender::VIEWPORT_TYPE_QUADRANT_TOP_LEFT) && C4JRender::VIEWPORT_TYPE_QUADRANT_TOP_LEFT) &&
(localplayers[i]->m_iScreenSection <= (localplayers[i]->m_iScreenSection <=
@ -790,7 +788,7 @@ void Minecraft::updatePlayerViewportAssignments() {
// 4J Stu - If the game is not running we do not want to do this yet, and // 4J Stu - If the game is not running we do not want to do this yet, and
// should wait until the task that caused the app to not be running is // should wait until the task that caused the app to not be running is
// finished // finished
if (GameServices::getGameStarted()) ui.UpdatePlayerBasePositions(); if (gameServices().getGameStarted()) ui.UpdatePlayerBasePositions();
} }
// Add a temporary player so that the viewports get re-arranged, and add the // Add a temporary player so that the viewports get re-arranged, and add the
@ -872,7 +870,7 @@ std::shared_ptr<MultiplayerLocalPlayer> Minecraft::createExtraLocalPlayer(
mpLevel->addClientConnection(clientConnection); mpLevel->addClientConnection(clientConnection);
} }
if (GameServices::getTutorialMode()) { if (gameServices().getTutorialMode()) {
localgameModes[idx] = localgameModes[idx] =
new FullTutorialMode(idx, this, clientConnection); new FullTutorialMode(idx, this, clientConnection);
} else { } else {
@ -926,7 +924,7 @@ std::shared_ptr<MultiplayerLocalPlayer> Minecraft::createExtraLocalPlayer(
// ClientConnection::handleMovePlayer // ClientConnection::handleMovePlayer
// // 4J-PB - can't call this when this function is called // // 4J-PB - can't call this when this function is called
// from the qnet thread (GetGameStarted will be false) // from the qnet thread (GetGameStarted will be false)
// if(GameServices::getGameStarted()) // if(gameServices().getGameStarted())
// { // {
// ui.CloseUIScenes(idx); // ui.CloseUIScenes(idx);
// } // }
@ -1069,7 +1067,7 @@ void Minecraft::run_middle() {
// set the timer // set the timer
bAutosaveTimerSet=true; bAutosaveTimerSet=true;
GameServices::setAutosaveTimerTime(); gameServices().setAutosaveTimerTime();
} }
else*/ else*/
{ {
@ -1078,7 +1076,7 @@ void Minecraft::run_middle() {
// player has a app action running , or has any crafting // player has a app action running , or has any crafting
// or containers open, don't autosave // or containers open, don't autosave
if (!StorageManager.GetSaveDisabled() && if (!StorageManager.GetSaveDisabled() &&
(GameServices::getXuiAction(InputManager.GetPrimaryPad()) == (gameServices().getXuiAction(InputManager.GetPrimaryPad()) ==
eAppAction_Idle)) { eAppAction_Idle)) {
if (!ui.IsPauseMenuDisplayed( if (!ui.IsPauseMenuDisplayed(
InputManager.GetPrimaryPad()) && InputManager.GetPrimaryPad()) &&
@ -1087,7 +1085,7 @@ void Minecraft::run_middle() {
// check if the autotimer countdown has reached // check if the autotimer countdown has reached
// zero // zero
unsigned char ucAutosaveVal = unsigned char ucAutosaveVal =
GameServices::getGameSettings( gameServices().getGameSettings(
InputManager.GetPrimaryPad(), InputManager.GetPrimaryPad(),
eGameSetting_Autosave); eGameSetting_Autosave);
bool bTrialTexturepack = false; bool bTrialTexturepack = false;
@ -1116,7 +1114,7 @@ void Minecraft::run_middle() {
// check whether we need to save this tick // check whether we need to save this tick
if ((ucAutosaveVal != 0) && if ((ucAutosaveVal != 0) &&
!bTrialTexturepack) { !bTrialTexturepack) {
if (GameServices::autosaveDue()) { if (gameServices().autosaveDue()) {
// disable the autosave countdown // disable the autosave countdown
ui.ShowAutosaveCountdownTimer(false); ui.ShowAutosaveCountdownTimer(false);
@ -1124,10 +1122,10 @@ void Minecraft::run_middle() {
Log::info("+++++++++++\n"); Log::info("+++++++++++\n");
Log::info("+++Autosave\n"); Log::info("+++Autosave\n");
Log::info("+++++++++++\n"); Log::info("+++++++++++\n");
GameServices::setAction( gameServices().setAction(
InputManager.GetPrimaryPad(), InputManager.GetPrimaryPad(),
eAppAction_AutosaveSaveGame); eAppAction_AutosaveSaveGame);
// GameServices::setAutosaveTimerTime(); // gameServices().setAutosaveTimerTime();
#if !defined(_CONTENT_PACKAGE) #if !defined(_CONTENT_PACKAGE)
{ {
// print the time // print the time
@ -1150,7 +1148,7 @@ void Minecraft::run_middle() {
#endif #endif
} else { } else {
int64_t uiTimeToAutosave = int64_t uiTimeToAutosave =
GameServices::secondsToAutosave(); gameServices().secondsToAutosave();
if (uiTimeToAutosave < 6) { if (uiTimeToAutosave < 6) {
ui.ShowAutosaveCountdownTimer(true); ui.ShowAutosaveCountdownTimer(true);
@ -1171,14 +1169,14 @@ void Minecraft::run_middle() {
// the level in their banned list and ask if they want to play // the level in their banned list and ask if they want to play
// it // it
for (int i = 0; i < XUSER_MAX_COUNT; i++) { for (int i = 0; i < XUSER_MAX_COUNT; i++) {
if (localplayers[i] && (GameServices::getBanListCheck(i) == false) && if (localplayers[i] && (gameServices().getBanListCheck(i) == false) &&
!Minecraft::GetInstance()->isTutorial() && !Minecraft::GetInstance()->isTutorial() &&
ProfileManager.IsSignedInLive(i) && ProfileManager.IsSignedInLive(i) &&
!ProfileManager.IsGuest(i)) { !ProfileManager.IsGuest(i)) {
// If there is a sys ui displayed, we can't display the // If there is a sys ui displayed, we can't display the
// message box here, so ignore until we can // message box here, so ignore until we can
if (!ProfileManager.IsSystemUIDisplayed()) { if (!ProfileManager.IsSystemUIDisplayed()) {
GameServices::setBanListCheck(i, true); gameServices().setBanListCheck(i, true);
// 4J-PB - check if the level is in the banned level // 4J-PB - check if the level is in the banned level
// list get the unique save name and xuid from // list get the unique save name and xuid from
// whoever is the host // whoever is the host
@ -1186,15 +1184,15 @@ void Minecraft::run_middle() {
g_NetworkManager.GetHostPlayer(); g_NetworkManager.GetHostPlayer();
PlayerUID xuid = pHostPlayer->GetUID(); PlayerUID xuid = pHostPlayer->GetUID();
if (GameServices::isInBannedLevelList( if (gameServices().isInBannedLevelList(
i, xuid, GameServices::getUniqueMapName())) { i, xuid, gameServices().getUniqueMapName())) {
// put up a message box asking if the player // put up a message box asking if the player
// would like to unban this level // would like to unban this level
Log::info("This level is banned\n"); Log::info("This level is banned\n");
// set the app action to bring up the message // set the app action to bring up the message
// box to give them the option to remove from // box to give them the option to remove from
// the ban list or exit the level // the ban list or exit the level
GameServices::setAction(i, eAppAction_LevelInBanLevelList, gameServices().setAction(i, eAppAction_LevelInBanLevelList,
(void*)true); (void*)true);
} }
} }
@ -1202,10 +1200,10 @@ void Minecraft::run_middle() {
} }
if (!ProfileManager.IsSystemUIDisplayed() && if (!ProfileManager.IsSystemUIDisplayed() &&
GameServices::dlcInstallProcessCompleted() && gameServices().dlcInstallProcessCompleted() &&
!GameServices::dlcInstallPending() && !gameServices().dlcInstallPending() &&
GameServices::getDLCManager().NeedsCorruptCheck()) { gameServices().dlcNeedsCorruptCheck()) {
GameServices::getDLCManager().checkForCorruptDLCAndAlert(); gameServices().dlcCheckForCorrupt();
} }
// When we go into the first loaded level, check if the console // When we go into the first loaded level, check if the console
@ -1218,7 +1216,7 @@ void Minecraft::run_middle() {
if (iFirstTimeCountdown == 0) { if (iFirstTimeCountdown == 0) {
bFirstTimeIntoGame = false; bFirstTimeIntoGame = false;
if (GameServices::isLocalMultiplayerAvailable()) { if (gameServices().isLocalMultiplayerAvailable()) {
for (int i = 0; i < XUSER_MAX_COUNT; i++) { for (int i = 0; i < XUSER_MAX_COUNT; i++) {
if ((localplayers[i] == nullptr) && if ((localplayers[i] == nullptr) &&
InputManager.IsPadConnected(i)) { InputManager.IsPadConnected(i)) {
@ -1297,7 +1295,7 @@ void Minecraft::run_middle() {
1LL << MINECRAFT_ACTION_GAME_INFO; 1LL << MINECRAFT_ACTION_GAME_INFO;
#if !defined(_FINAL_BUILD) #if !defined(_FINAL_BUILD)
if (DebugSettings::isOn() && GameServices::getUseDPadForDebug()) { if (gameServices().debugSettingsOn() && gameServices().getUseDPadForDebug()) {
localplayers[i]->ullDpad_last = 0; localplayers[i]->ullDpad_last = 0;
localplayers[i]->ullDpad_this = 0; localplayers[i]->ullDpad_this = 0;
localplayers[i]->ullDpad_filtered = 0; localplayers[i]->ullDpad_filtered = 0;
@ -1375,7 +1373,7 @@ void Minecraft::run_middle() {
// || InputManager.ButtonPressed(i, // || InputManager.ButtonPressed(i,
// MINECRAFT_ACTION_ACTION)) // MINECRAFT_ACTION_ACTION))
{ {
GameServices::setOpacityTimer(i); gameServices().setOpacityTimer(i);
} }
} else { } else {
// 4J Stu - This doesn't make any sense with the way we // 4J Stu - This doesn't make any sense with the way we
@ -1542,7 +1540,7 @@ void Minecraft::run_middle() {
// again // again
if (i != 0) { if (i != 0) {
InputManager.Tick(); InputManager.Tick();
GameServices::handleButtonPresses(); gameServices().handleButtonPresses();
} }
ticks++; ticks++;
@ -1662,12 +1660,12 @@ void Minecraft::run_middle() {
if (i == iPrimaryPad) { if (i == iPrimaryPad) {
// check to see if we need to capture a // check to see if we need to capture a
// screenshot for the save game thumbnail // screenshot for the save game thumbnail
switch (GameServices::getXuiAction(i)) { switch (gameServices().getXuiAction(i)) {
case eAppAction_ExitWorldCapturedThumbnail: case eAppAction_ExitWorldCapturedThumbnail:
case eAppAction_SaveGameCapturedThumbnail: case eAppAction_SaveGameCapturedThumbnail:
case eAppAction_AutosaveSaveGameCapturedThumbnail: case eAppAction_AutosaveSaveGameCapturedThumbnail:
// capture the save thumbnail // capture the save thumbnail
GameServices::captureSaveThumbnail(); gameServices().captureSaveThumbnail();
break; break;
default: default:
break; break;
@ -1780,7 +1778,7 @@ void Minecraft::run_middle() {
g_NetworkManager.GetPlayerCount() == 1 && g_NetworkManager.GetPlayerCount() == 1 &&
screen != nullptr && screen->isPauseScreen(); screen != nullptr && screen->isPauseScreen();
#else #else
pause = GameServices::isAppPaused(); pause = gameServices().isAppPaused();
#endif #endif
#if !defined(_CONTENT_PACKAGE) #if !defined(_CONTENT_PACKAGE)
@ -2015,7 +2013,7 @@ void Minecraft::tick(bool bFirst, bool bUpdateTextures) {
// Tick the opacity timer (to display the interface at default opacity for a // Tick the opacity timer (to display the interface at default opacity for a
// certain time if the user has been navigating it) // certain time if the user has been navigating it)
GameServices::tickOpacityTimer(iPad); gameServices().tickOpacityTimer(iPad);
// 4J added // 4J added
if (bFirst) levelRenderer->destroyedTileManager->tick(); if (bFirst) levelRenderer->destroyedTileManager->tick();
@ -3040,7 +3038,7 @@ void Minecraft::tick(bool bFirst, bool bUpdateTextures) {
// have the // have the
// privilege // privilege
{ {
if (GameHostOptions::get( if (gameServices().getGameHostOption(
eGameHostOption_PvP) && eGameHostOption_PvP) &&
player->isAllowedToAttackPlayers()) { player->isAllowedToAttackPlayers()) {
*piAction = IDS_TOOLTIPS_HIT; *piAction = IDS_TOOLTIPS_HIT;
@ -3366,7 +3364,7 @@ void Minecraft::tick(bool bFirst, bool bUpdateTextures) {
} }
} }
if (DebugSettings::isOn()) { if (gameServices().debugSettingsOn()) {
if (player->ullButtonsPressed & if (player->ullButtonsPressed &
(1LL << MINECRAFT_ACTION_CHANGE_SKIN)) { (1LL << MINECRAFT_ACTION_CHANGE_SKIN)) {
player->ChangePlayerSkin(); player->ChangePlayerSkin();
@ -3376,7 +3374,7 @@ void Minecraft::tick(bool bFirst, bool bUpdateTextures) {
if (player->missTime > 0) player->missTime--; if (player->missTime > 0) player->missTime--;
#if defined(_DEBUG_MENUS_ENABLED) #if defined(_DEBUG_MENUS_ENABLED)
if (DebugSettings::isOn()) { if (gameServices().debugSettingsOn()) {
// 4J-PB - debugoverlay for primary player only // 4J-PB - debugoverlay for primary player only
if (iPad == InputManager.GetPrimaryPad()) { if (iPad == InputManager.GetPrimaryPad()) {
if ((player->ullButtonsPressed & if ((player->ullButtonsPressed &
@ -3393,7 +3391,7 @@ void Minecraft::tick(bool bFirst, bool bUpdateTextures) {
if ((player->ullButtonsPressed & if ((player->ullButtonsPressed &
(1LL << MINECRAFT_ACTION_SPAWN_CREEPER)) && (1LL << MINECRAFT_ACTION_SPAWN_CREEPER)) &&
DebugSettings::mobsDontAttack()) { gameServices().debugMobsDontAttack()) {
// shared_ptr<Mob> mob = // shared_ptr<Mob> mob =
// std::dynamic_pointer_cast<Mob>(Creeper::_class->newInstance( // std::dynamic_pointer_cast<Mob>(Creeper::_class->newInstance(
// level )); shared_ptr<Mob> mob = // level )); shared_ptr<Mob> mob =
@ -3437,7 +3435,7 @@ void Minecraft::tick(bool bFirst, bool bUpdateTextures) {
#if defined(ENABLE_JAVA_GUIS) #if defined(ENABLE_JAVA_GUIS)
setScreen(new InventoryScreen(player)); setScreen(new InventoryScreen(player));
#else #else
GameServices::menus().openInventory(iPad, std::static_pointer_cast<LocalPlayer>(player)); gameServices().menus().openInventory(iPad, std::static_pointer_cast<LocalPlayer>(player));
#endif #endif
} }
@ -3458,7 +3456,7 @@ void Minecraft::tick(bool bFirst, bool bUpdateTextures) {
setScreen(new CreativeInventoryScreen(player)); setScreen(new CreativeInventoryScreen(player));
} }
#else #else
GameServices::menus().openCreative(iPad, std::static_pointer_cast<LocalPlayer>(player)); gameServices().menus().openCreative(iPad, std::static_pointer_cast<LocalPlayer>(player));
} }
// 4J-PB - Microsoft request that we use the 3x3 crafting if someone // 4J-PB - Microsoft request that we use the 3x3 crafting if someone
// presses X while at the workbench // presses X while at the workbench
@ -3475,7 +3473,7 @@ void Minecraft::tick(bool bFirst, bool bUpdateTextures) {
&hitResult->pos, false, &usedItem); &hitResult->pos, false, &usedItem);
} else { } else {
ui.PlayUISFX(eSFX_Press); ui.PlayUISFX(eSFX_Press);
GameServices::menus().openCrafting2x2(iPad, std::static_pointer_cast<LocalPlayer>(player)); gameServices().menus().openCrafting2x2(iPad, std::static_pointer_cast<LocalPlayer>(player));
} }
#endif #endif
} }
@ -3543,9 +3541,9 @@ void Minecraft::tick(bool bFirst, bool bUpdateTextures) {
// printf("Input Detected!\n"); // printf("Input Detected!\n");
// //
// // see if we can react to this // // see if we can react to this
// if(GameServices::getXuiAction(iPad)==eAppAction_Idle) // if(gameServices().getXuiAction(iPad)==eAppAction_Idle)
// { // {
// GameServices::setAction(iPad,eAppAction_DebugText,(void*)wchInput); // gameServices().setAction(iPad,eAppAction_DebugText,(void*)wchInput);
// } // }
// } // }
// } // }
@ -3972,7 +3970,7 @@ void Minecraft::fileDownloaded(const std::wstring& name, File* file) {
std::wstring Minecraft::gatherStats1() { std::wstring Minecraft::gatherStats1() {
// return levelRenderer->gatherStats1(); // return levelRenderer->gatherStats1();
return L"Time to autosave: " + return L"Time to autosave: " +
toWString<int64_t>(GameServices::secondsToAutosave()) + L"s"; toWString<int64_t>(gameServices().secondsToAutosave()) + L"s";
} }
std::wstring Minecraft::gatherStats2() { std::wstring Minecraft::gatherStats2() {
@ -4045,7 +4043,7 @@ void Minecraft::respawnPlayer(int iPad, int dimension, int newEntityId) {
} }
// Set the animation override if the skin has one // Set the animation override if the skin has one
std::uint32_t dwSkinID = GameServices::getSkinIdFromPath(player->customTextureUrl); std::uint32_t dwSkinID = gameServices().getSkinIdFromPath(player->customTextureUrl);
if (GET_IS_DLC_SKIN_FROM_BITMASK(dwSkinID)) { if (GET_IS_DLC_SKIN_FROM_BITMASK(dwSkinID)) {
player->setAnimOverrideBitmask( player->setAnimOverrideBitmask(
player->getSkinAnimOverrideBitmask(dwSkinID)); player->getSkinAnimOverrideBitmask(dwSkinID));
@ -4059,14 +4057,14 @@ void Minecraft::respawnPlayer(int iPad, int dimension, int newEntityId) {
createPrimaryLocalPlayer(iPad); createPrimaryLocalPlayer(iPad);
// update the debugoptions // update the debugoptions
GameServices::setGameSettingsDebugMask(InputManager.GetPrimaryPad(), gameServices().setGameSettingsDebugMask(InputManager.GetPrimaryPad(),
DebugSettings::getMask(-1, true)); gameServices().debugGetMask(-1, true));
} else { } else {
storeExtraLocalPlayer(iPad); storeExtraLocalPlayer(iPad);
} }
player->setShowOnMaps( player->setShowOnMaps(
GameHostOptions::get(eGameHostOption_Gamertags) != 0 ? true : false); gameServices().getGameHostOption(eGameHostOption_Gamertags) != 0 ? true : false);
player->resetPos(); player->resetPos();
level->addEntity(player); level->addEntity(player);
@ -4208,7 +4206,7 @@ void Minecraft::main() {
User::staticCtor(); User::staticCtor();
Tutorial::staticCtor(); Tutorial::staticCtor();
ColourTable::staticCtor(); ColourTable::staticCtor();
GameServices::loadDefaultGameRules(); gameServices().loadDefaultGameRules();
#if defined(_LARGE_WORLDS) #if defined(_LARGE_WORLDS)
LevelRenderer::staticCtor(); LevelRenderer::staticCtor();
@ -4436,7 +4434,7 @@ bool Minecraft::isTutorial() {
void Minecraft::playerStartedTutorial(int iPad) { void Minecraft::playerStartedTutorial(int iPad) {
// If the app doesn't think we are in a tutorial mode then just ignore this // If the app doesn't think we are in a tutorial mode then just ignore this
// add // add
if (GameServices::getTutorialMode()) if (gameServices().getTutorialMode())
m_inFullTutorialBits = m_inFullTutorialBits | (1 << iPad); m_inFullTutorialBits = m_inFullTutorialBits | (1 << iPad);
} }
@ -4444,13 +4442,13 @@ void Minecraft::playerLeftTutorial(int iPad) {
// 4J Stu - Fix for bug that was flooding Sentient with LevelStart events // 4J Stu - Fix for bug that was flooding Sentient with LevelStart events
// If the tutorial bits are already 0 then don't need to update anything // If the tutorial bits are already 0 then don't need to update anything
if (m_inFullTutorialBits == 0) { if (m_inFullTutorialBits == 0) {
GameServices::setTutorialMode(false); gameServices().setTutorialMode(false);
return; return;
} }
m_inFullTutorialBits = m_inFullTutorialBits & ~(1 << iPad); m_inFullTutorialBits = m_inFullTutorialBits & ~(1 << iPad);
if (m_inFullTutorialBits == 0) { if (m_inFullTutorialBits == 0) {
GameServices::setTutorialMode(false); gameServices().setTutorialMode(false);
} }
} }

View file

@ -1,5 +1,4 @@
#include "minecraft/GameServices.h" #include "minecraft/IGameServices.h"
#include "minecraft/GameHostOptions.h"
#include "minecraft/util/Log.h" #include "minecraft/util/Log.h"
#include "CreateWorldScreen.h" #include "CreateWorldScreen.h"
@ -13,7 +12,7 @@
#include "Button.h" #include "Button.h"
#include "EditBox.h" #include "EditBox.h"
#include "MessageScreen.h" #include "MessageScreen.h"
#include "app/common/App_enums.h" #include "minecraft/GameEnums.h"
#include "app/common/Network/GameNetworkManager.h" #include "app/common/Network/GameNetworkManager.h"
#include "app/common/UI/All Platforms/UIEnums.h" #include "app/common/UI/All Platforms/UIEnums.h"
#include "app/common/UI/All Platforms/UIStructs.h" #include "app/common/UI/All Platforms/UIStructs.h"
@ -253,38 +252,38 @@ void CreateWorldScreen::buttonClicked(Button* button) {
param->texturePackId = 0; param->texturePackId = 0;
param->settings = 0; param->settings = 0;
GameHostOptions::set(eGameHostOption_Difficulty, gameServices().setGameHostOption(eGameHostOption_Difficulty,
minecraft->options->difficulty); minecraft->options->difficulty);
GameHostOptions::set(eGameHostOption_FriendsOfFriends, gameServices().setGameHostOption(eGameHostOption_FriendsOfFriends,
moreOptionsParams->bAllowFriendsOfFriends); moreOptionsParams->bAllowFriendsOfFriends);
GameHostOptions::set(eGameHostOption_Gamertags, 1); gameServices().setGameHostOption(eGameHostOption_Gamertags, 1);
GameHostOptions::set(eGameHostOption_BedrockFog, 0); gameServices().setGameHostOption(eGameHostOption_BedrockFog, 0);
GameHostOptions::set(eGameHostOption_GameType, gameServices().setGameHostOption(eGameHostOption_GameType,
(gameMode == L"survival") (gameMode == L"survival")
? GameType::SURVIVAL->getId() ? GameType::SURVIVAL->getId()
: GameType::CREATIVE->getId()); : GameType::CREATIVE->getId());
GameHostOptions::set(eGameHostOption_LevelType, gameServices().setGameHostOption(eGameHostOption_LevelType,
moreOptionsParams->bFlatWorld); moreOptionsParams->bFlatWorld);
GameHostOptions::set(eGameHostOption_Structures, gameServices().setGameHostOption(eGameHostOption_Structures,
moreOptionsParams->bStructures); moreOptionsParams->bStructures);
GameHostOptions::set(eGameHostOption_BonusChest, gameServices().setGameHostOption(eGameHostOption_BonusChest,
moreOptionsParams->bBonusChest); moreOptionsParams->bBonusChest);
GameHostOptions::set(eGameHostOption_PvP, moreOptionsParams->bPVP); gameServices().setGameHostOption(eGameHostOption_PvP, moreOptionsParams->bPVP);
GameHostOptions::set(eGameHostOption_TrustPlayers, gameServices().setGameHostOption(eGameHostOption_TrustPlayers,
moreOptionsParams->bTrust); moreOptionsParams->bTrust);
GameHostOptions::set(eGameHostOption_FireSpreads, gameServices().setGameHostOption(eGameHostOption_FireSpreads,
moreOptionsParams->bFireSpreads); moreOptionsParams->bFireSpreads);
GameHostOptions::set(eGameHostOption_TNT, moreOptionsParams->bTNT); gameServices().setGameHostOption(eGameHostOption_TNT, moreOptionsParams->bTNT);
GameHostOptions::set(eGameHostOption_HostCanFly, gameServices().setGameHostOption(eGameHostOption_HostCanFly,
moreOptionsParams->bHostPrivileges); moreOptionsParams->bHostPrivileges);
GameHostOptions::set(eGameHostOption_HostCanChangeHunger, gameServices().setGameHostOption(eGameHostOption_HostCanChangeHunger,
moreOptionsParams->bHostPrivileges); moreOptionsParams->bHostPrivileges);
GameHostOptions::set(eGameHostOption_HostCanBeInvisible, gameServices().setGameHostOption(eGameHostOption_HostCanBeInvisible,
moreOptionsParams->bHostPrivileges); moreOptionsParams->bHostPrivileges);
GameHostOptions::set(eGameHostOption_CheatsEnabled, gameServices().setGameHostOption(eGameHostOption_CheatsEnabled,
moreOptionsParams->bHostPrivileges); moreOptionsParams->bHostPrivileges);
param->settings = GameHostOptions::get(eGameHostOption_All); param->settings = gameServices().getGameHostOption(eGameHostOption_All);
param->xzSize = LEVEL_MAX_WIDTH; param->xzSize = LEVEL_MAX_WIDTH;
param->hellScale = HELL_LEVEL_MAX_SCALE; param->hellScale = HELL_LEVEL_MAX_SCALE;
@ -297,7 +296,7 @@ void CreateWorldScreen::buttonClicked(Button* button) {
loadingParams->func = &CGameNetworkManager::RunNetworkGameThreadProc; loadingParams->func = &CGameNetworkManager::RunNetworkGameThreadProc;
loadingParams->lpParam = param; loadingParams->lpParam = param;
GameServices::setAutosaveTimerTime(); gameServices().setAutosaveTimerTime();
UIFullscreenProgressCompletionData* completionData = UIFullscreenProgressCompletionData* completionData =
new UIFullscreenProgressCompletionData(); new UIFullscreenProgressCompletionData();

View file

@ -1,5 +1,4 @@
#include "minecraft/GameServices.h" #include "minecraft/IGameServices.h"
#include "minecraft/locale/Strings.h"
#include "Gui.h" #include "Gui.h"
#include <cmath> #include <cmath>
@ -9,7 +8,7 @@
#include "platform/sdl2/Input.h" #include "platform/sdl2/Input.h"
#include "platform/sdl2/Render.h" #include "platform/sdl2/Render.h"
#include "Facing.h" #include "Facing.h"
#include "app/common/App_enums.h" #include "minecraft/GameEnums.h"
#include "app/common/App_structs.h" #include "app/common/App_structs.h"
#include "app/linux/LinuxGame.h" #include "app/linux/LinuxGame.h"
#include "app/linux/Linux_UIController.h" #include "app/linux/Linux_UIController.h"
@ -114,10 +113,10 @@ void Gui::render(float a, bool mouseFree, int xMouse, int yMouse) {
// 4J-PB - selected the gui scale based on the slider settings // 4J-PB - selected the gui scale based on the slider settings
if (minecraft->player->m_iScreenSection == if (minecraft->player->m_iScreenSection ==
C4JRender::VIEWPORT_TYPE_FULLSCREEN) { C4JRender::VIEWPORT_TYPE_FULLSCREEN) {
guiScale = GameServices::getGameSettings(iPad, eGameSetting_UISize) + 2; guiScale = gameServices().getGameSettings(iPad, eGameSetting_UISize) + 2;
} else { } else {
guiScale = guiScale =
GameServices::getGameSettings(iPad, eGameSetting_UISizeSplitscreen) + 2; gameServices().getGameSettings(iPad, eGameSetting_UISizeSplitscreen) + 2;
} }
ScreenSizeCalculator ssc(minecraft->options, minecraft->width, ScreenSizeCalculator ssc(minecraft->options, minecraft->width,
@ -248,11 +247,11 @@ void Gui::render(float a, bool mouseFree, int xMouse, int yMouse) {
// 4J-PB - turn off the slot display if a xui menu is up, or if we're // 4J-PB - turn off the slot display if a xui menu is up, or if we're
// autosaving // autosaving
bool bDisplayGui = !ui.GetMenuDisplayed(iPad) && bool bDisplayGui = !ui.GetMenuDisplayed(iPad) &&
!(GameServices::getXuiAction(iPad) == !(gameServices().getXuiAction(iPad) ==
eAppAction_AutosaveSaveGameCapturedThumbnail); eAppAction_AutosaveSaveGameCapturedThumbnail);
// if tooltips are off, set the y offset to zero // if tooltips are off, set the y offset to zero
if (GameServices::getGameSettings(iPad, eGameSetting_Tooltips) == 0 && bDisplayGui) { if (gameServices().getGameSettings(iPad, eGameSetting_Tooltips) == 0 && bDisplayGui) {
switch (minecraft->player->m_iScreenSection) { switch (minecraft->player->m_iScreenSection) {
case C4JRender::VIEWPORT_TYPE_FULLSCREEN: case C4JRender::VIEWPORT_TYPE_FULLSCREEN:
iTooltipsYOffset = screenHeight / 10; iTooltipsYOffset = screenHeight / 10;
@ -276,7 +275,7 @@ void Gui::render(float a, bool mouseFree, int xMouse, int yMouse) {
// 4J-PB - Turn off interface if eGameSetting_DisplayHUD is off - for screen // 4J-PB - Turn off interface if eGameSetting_DisplayHUD is off - for screen
// shots/videos. // shots/videos.
if (GameServices::getGameSettings(iPad, eGameSetting_DisplayHUD) == 0) { if (gameServices().getGameSettings(iPad, eGameSetting_DisplayHUD) == 0) {
bDisplayGui = false; bDisplayGui = false;
} }
@ -335,7 +334,7 @@ void Gui::render(float a, bool mouseFree, int xMouse, int yMouse) {
// 4J - this is where to set the blend factor for gui things // 4J - this is where to set the blend factor for gui things
// use the primary player's settings // use the primary player's settings
unsigned char ucAlpha = GameServices::getGameSettings( unsigned char ucAlpha = gameServices().getGameSettings(
InputManager.GetPrimaryPad(), eGameSetting_InterfaceOpacity); InputManager.GetPrimaryPad(), eGameSetting_InterfaceOpacity);
// If the user has started to navigate their quickselect bar, ignore the // If the user has started to navigate their quickselect bar, ignore the
@ -343,7 +342,7 @@ void Gui::render(float a, bool mouseFree, int xMouse, int yMouse) {
float fVal = fAlphaIncrementPerCent * (float)ucAlpha; float fVal = fAlphaIncrementPerCent * (float)ucAlpha;
if (ucAlpha < 80) { if (ucAlpha < 80) {
// check if we have the timer running for the opacity // check if we have the timer running for the opacity
unsigned int uiOpacityTimer = GameServices::getOpacityTimer(iPad); unsigned int uiOpacityTimer = gameServices().getOpacityTimer(iPad);
if (uiOpacityTimer != 0) { if (uiOpacityTimer != 0) {
if (uiOpacityTimer < 10) { if (uiOpacityTimer < 10) {
float fStep = (80.0f - (float)ucAlpha) / 10.0f; float fStep = (80.0f - (float)ucAlpha) / 10.0f;
@ -730,7 +729,7 @@ void Gui::render(float a, bool mouseFree, int xMouse, int yMouse) {
// positions worked out by hand from the xui implementation of the // positions worked out by hand from the xui implementation of the
// crouch icon // crouch icon
if (GameServices::getGameSettings(iPad, eGameSetting_AnimatedCharacter)) { if (gameServices().getGameSettings(iPad, eGameSetting_AnimatedCharacter)) {
// int playerIdx = minecraft->player->GetXboxPad(); // int playerIdx = minecraft->player->GetXboxPad();
static int characterDisplayTimer[4] = {0}; static int characterDisplayTimer[4] = {0};
@ -979,8 +978,8 @@ void Gui::render(float a, bool mouseFree, int xMouse, int yMouse) {
wfeature[eTerrainFeature_Village] = L"Village: "; wfeature[eTerrainFeature_Village] = L"Village: ";
wfeature[eTerrainFeature_Ravine] = L"Ravine: "; wfeature[eTerrainFeature_Ravine] = L"Ravine: ";
for (int i = 0; i < GameServices::getTerrainFeatures().size(); i++) { for (int i = 0; i < gameServices().getTerrainFeatures().size(); i++) {
FEATURE_DATA* pFeatureData = GameServices::getTerrainFeatures()[i]; FEATURE_DATA* pFeatureData = gameServices().getTerrainFeatures()[i];
std::wstring itemInfo = std::wstring itemInfo =
L"[" + toWString<int>(pFeatureData->x * 16) + L", " + L"[" + toWString<int>(pFeatureData->x * 16) + L", " +
@ -1467,7 +1466,7 @@ void Gui::addMessage(const std::wstring& _string, int iPad,
for (int i = 0; i < XUSER_MAX_COUNT; i++) { for (int i = 0; i < XUSER_MAX_COUNT; i++) {
if (minecraft->localplayers[i] && if (minecraft->localplayers[i] &&
!(bIsDeathMessage && !(bIsDeathMessage &&
GameServices::getGameSettings(i, eGameSetting_DeathMessages) == 0)) { gameServices().getGameSettings(i, eGameSetting_DeathMessages) == 0)) {
guiMessages[i].insert(guiMessages[i].begin(), guiMessages[i].insert(guiMessages[i].begin(),
GuiMessage(string)); GuiMessage(string));
while (guiMessages[i].size() > 50) { while (guiMessages[i].size() > 50) {
@ -1476,7 +1475,7 @@ void Gui::addMessage(const std::wstring& _string, int iPad,
} }
} }
} else if (!(bIsDeathMessage && } else if (!(bIsDeathMessage &&
GameServices::getGameSettings(iPad, eGameSetting_DeathMessages) == 0)) { gameServices().getGameSettings(iPad, eGameSetting_DeathMessages) == 0)) {
guiMessages[iPad].insert(guiMessages[iPad].begin(), GuiMessage(string)); guiMessages[iPad].insert(guiMessages[iPad].begin(), GuiMessage(string));
while (guiMessages[iPad].size() > 50) { while (guiMessages[iPad].size() > 50) {
guiMessages[iPad].pop_back(); guiMessages[iPad].pop_back();
@ -1511,7 +1510,7 @@ float Gui::getJukeboxOpacity(int iPad) {
void Gui::setNowPlaying(const std::wstring& string) { void Gui::setNowPlaying(const std::wstring& string) {
// overlayMessageString = L"Now playing: " + string; // overlayMessageString = L"Now playing: " + string;
overlayMessageString = Strings::get(IDS_NOWPLAYING) + string; overlayMessageString = gameServices().getString(IDS_NOWPLAYING) + string;
overlayMessageTime = 20 * 3; overlayMessageTime = 20 * 3;
animateOverlayMessageColor = true; animateOverlayMessageColor = true;
} }
@ -1519,7 +1518,7 @@ void Gui::setNowPlaying(const std::wstring& string) {
void Gui::displayClientMessage(int messageId, int iPad) { void Gui::displayClientMessage(int messageId, int iPad) {
// Language *language = Language::getInstance(); // Language *language = Language::getInstance();
std::wstring languageString = std::wstring languageString =
Strings::get(messageId); // language->getElement(messageId); gameServices().getString(messageId); // language->getElement(messageId);
addMessage(languageString, iPad); addMessage(languageString, iPad);
} }

View file

@ -9,7 +9,7 @@
#include "platform/sdl2/Render.h" #include "platform/sdl2/Render.h"
#include "Font.h" #include "Font.h"
#include "app/common/App_enums.h" #include "minecraft/GameEnums.h"
#include "app/common/Colours/ColourTable.h" #include "app/common/Colours/ColourTable.h"
#include "minecraft/client/BufferedImage.h" #include "minecraft/client/BufferedImage.h"
#include "minecraft/client/Minecraft.h" #include "minecraft/client/Minecraft.h"

View file

@ -1,4 +1,4 @@
#include "minecraft/GameServices.h" #include "minecraft/IGameServices.h"
#include "PauseScreen.h" #include "PauseScreen.h"
#include <math.h> #include <math.h>
@ -11,7 +11,7 @@
#include "platform/sdl2/Input.h" #include "platform/sdl2/Input.h"
#include "Button.h" #include "Button.h"
#include "MessageScreen.h" #include "MessageScreen.h"
#include "app/common/App_enums.h" #include "minecraft/GameEnums.h"
#include "app/common/Network/GameNetworkManager.h" #include "app/common/Network/GameNetworkManager.h"
#include "app/linux/LinuxGame.h" #include "app/linux/LinuxGame.h"
#include "OptionsScreen.h" #include "OptionsScreen.h"
@ -33,7 +33,7 @@ void PauseScreen::init() {
// 4jcraft: solves the issue of client-side only pausing in the java gui // 4jcraft: solves the issue of client-side only pausing in the java gui
if (g_NetworkManager.IsLocalGame() && if (g_NetworkManager.IsLocalGame() &&
g_NetworkManager.GetPlayerCount() == 1) g_NetworkManager.GetPlayerCount() == 1)
GameServices::setXuiServerAction(InputManager.GetPrimaryPad(), gameServices().setXuiServerAction(InputManager.GetPrimaryPad(),
eXuiServerAction_PauseServer, (void*)true); eXuiServerAction_PauseServer, (void*)true);
buttons.push_back(new Button(1, width / 2 - 100, height / 4 + 24 * 5 + yo, buttons.push_back(new Button(1, width / 2 - 100, height / 4 + 24 * 5 + yo,
I18n::get(L"menu.returnToMenu"))); I18n::get(L"menu.returnToMenu")));
@ -71,7 +71,7 @@ void PauseScreen::exitWorld(Minecraft* minecraft, bool save) {
if (g_NetworkManager.IsHost()) { if (g_NetworkManager.IsHost()) {
server->setSaveOnExit(save); server->setSaveOnExit(save);
} }
GameServices::setAction(minecraft->player->GetXboxPad(), eAppAction_ExitWorld); gameServices().setAction(minecraft->player->GetXboxPad(), eAppAction_ExitWorld);
} }
void PauseScreen::buttonClicked(Button* button) { void PauseScreen::buttonClicked(Button* button) {
@ -91,7 +91,7 @@ void PauseScreen::buttonClicked(Button* button) {
exitWorld(minecraft, true); exitWorld(minecraft, true);
} }
if (button->id == 4) { if (button->id == 4) {
GameServices::setXuiServerAction(InputManager.GetPrimaryPad(), gameServices().setXuiServerAction(InputManager.GetPrimaryPad(),
eXuiServerAction_PauseServer, (void*)false); eXuiServerAction_PauseServer, (void*)false);
minecraft->setScreen(nullptr); minecraft->setScreen(nullptr);
// minecraft->grabMouse(); // 4J - removed // minecraft->grabMouse(); // 4J - removed

View file

@ -1,11 +1,11 @@
#include "minecraft/GameServices.h" #include "minecraft/IGameServices.h"
#include "Screen.h" #include "Screen.h"
#include "platform/InputActions.h" #include "platform/InputActions.h"
#include "platform/sdl2/Input.h" #include "platform/sdl2/Input.h"
#include "platform/sdl2/Profile.h" #include "platform/sdl2/Profile.h"
#include "Button.h" #include "Button.h"
#include "app/common/App_enums.h" #include "minecraft/GameEnums.h"
#include "app/common/Audio/SoundEngine.h" #include "app/common/Audio/SoundEngine.h"
#include "app/common/Network/GameNetworkManager.h" #include "app/common/Network/GameNetworkManager.h"
#include "app/linux/LinuxGame.h" #include "app/linux/LinuxGame.h"
@ -44,7 +44,7 @@ void Screen::keyPressed(wchar_t eventCharacter, int eventKey) {
// unpausing is done in all scenarios // unpausing is done in all scenarios
if (g_NetworkManager.IsLocalGame() && if (g_NetworkManager.IsLocalGame() &&
g_NetworkManager.GetPlayerCount() == 1) g_NetworkManager.GetPlayerCount() == 1)
GameServices::setXuiServerAction(InputManager.GetPrimaryPad(), gameServices().setXuiServerAction(InputManager.GetPrimaryPad(),
eXuiServerAction_PauseServer, (void*)false); eXuiServerAction_PauseServer, (void*)false);
} }
} }

View file

@ -1,4 +1,4 @@
#include "minecraft/GameServices.h" #include "minecraft/IGameServices.h"
#include "AbstractContainerScreen.h" #include "AbstractContainerScreen.h"
#include <wchar.h> #include <wchar.h>
@ -249,7 +249,7 @@ void AbstractContainerScreen::renderTooltip(std::shared_ptr<ItemInstance> item,
} }
if (!cleanedLines.empty()) { if (!cleanedLines.empty()) {
lineColors[0] = GameServices::getHTMLColour(item->getRarity()->color); lineColors[0] = gameServices().getHTMLColour(item->getRarity()->color);
} }
renderTooltipInternal(cleanedLines, lineColors, xm, ym); renderTooltipInternal(cleanedLines, lineColors, xm, ym);

View file

@ -1,4 +1,4 @@
#include "minecraft/locale/Strings.h" #include "minecraft/IGameServices.h"
#include "BeaconPowerButton.h" #include "BeaconPowerButton.h"
#include <string> #include <string>
@ -35,7 +35,7 @@ void BeaconPowerButton::renderTooltip(int xm, int ym) {
MobEffect* effect = MobEffect::effects[effectId]; MobEffect* effect = MobEffect::effects[effectId];
if (!effect) return; if (!effect) return;
std::wstring name = Strings::get(effect->getDescriptionId()); std::wstring name = gameServices().getString(effect->getDescriptionId());
if (tier >= 3 && effect->id != MobEffect::regeneration->id) { if (tier >= 3 && effect->id != MobEffect::regeneration->id) {
name += L" II"; name += L" II";
} }

View file

@ -1,4 +1,4 @@
#include "minecraft/locale/Strings.h" #include "minecraft/IGameServices.h"
#include "CreativeInventoryScreen.h" #include "CreativeInventoryScreen.h"
#include <GL/gl.h> #include <GL/gl.h>
@ -412,7 +412,7 @@ void CreativeInventoryScreen::renderLabels() {
IUIScene_CreativeMenu::TabSpec* spec = IUIScene_CreativeMenu::TabSpec* spec =
IUIScene_CreativeMenu::specs[selectedTabIndex]; IUIScene_CreativeMenu::specs[selectedTabIndex];
if (spec) { if (spec) {
std::wstring tabName = Strings::get(spec->m_descriptionId); std::wstring tabName = gameServices().getString(spec->m_descriptionId);
font->draw(tabName, 8, 6, 0x404040); font->draw(tabName, 8, 6, 0x404040);
} }
} }
@ -590,7 +590,7 @@ bool CreativeInventoryScreen::renderIconTooltip(int tab, int mouseX,
glDisable(GL_LIGHTING); glDisable(GL_LIGHTING);
glDisable(GL_DEPTH_TEST); glDisable(GL_DEPTH_TEST);
renderTooltip( renderTooltip(
Strings::get(IUIScene_CreativeMenu::specs[tab]->m_descriptionId), gameServices().getString(IUIScene_CreativeMenu::specs[tab]->m_descriptionId),
mouseX, mouseY); mouseX, mouseY);
glEnable(GL_LIGHTING); glEnable(GL_LIGHTING);
glEnable(GL_DEPTH_TEST); glEnable(GL_DEPTH_TEST);

View file

@ -1,5 +1,5 @@
#pragma once #pragma once
#include "minecraft/client/SkinBox.h" #include "minecraft/client/model/SkinBox.h"
#include "minecraft/client/model/geom/Model.h" #include "minecraft/client/model/geom/Model.h"
class ModelPart; class ModelPart;

View file

@ -5,7 +5,7 @@
#include <unordered_map> #include <unordered_map>
#include <vector> #include <vector>
#include "minecraft/client/SkinBox.h" #include "minecraft/client/model/SkinBox.h"
#include "java/Random.h" #include "java/Random.h"
class Mob; class Mob;

View file

@ -2,7 +2,7 @@
#include <string> #include <string>
#include <vector> #include <vector>
#include "minecraft/client/SkinBox.h" #include "minecraft/client/model/SkinBox.h"
#include "Model.h" #include "Model.h"
#include "minecraft/client/model/Polygon.h" #include "minecraft/client/model/Polygon.h"
#include "minecraft/client/model/Vertex.h" #include "minecraft/client/model/Vertex.h"

File diff suppressed because it is too large Load diff

View file

@ -1,4 +1,4 @@
#include "minecraft/util/DebugSettings.h" #include "minecraft/IGameServices.h"
#include "MultiPlayerGameMode.h" #include "MultiPlayerGameMode.h"
#include <vector> #include <vector>
@ -150,8 +150,8 @@ void MultiPlayerGameMode::startDestroyBlock(int x, int y, int z, int face) {
if (t > 0 && if (t > 0 &&
(Tile::tiles[t]->getDestroyProgress( (Tile::tiles[t]->getDestroyProgress(
minecraft->player, minecraft->player->level, x, y, z) >= 1 minecraft->player, minecraft->player->level, x, y, z) >= 1
// ||(DebugSettings::isOn() && // ||(gameServices().debugSettingsOn() &&
// DebugSettings::getMask(InputManager.GetPrimaryPad())&(1L<<eDebugSetting_InstantDestroy)) // gameServices().debugGetMask(InputManager.GetPrimaryPad())&(1L<<eDebugSetting_InstantDestroy))
)) { )) {
destroyBlock(x, y, z, face); destroyBlock(x, y, z, face);
} else { } else {

View file

@ -1,4 +1,4 @@
#include "minecraft/util/DebugSettings.h" #include "minecraft/IGameServices.h"
#include "MultiPlayerLevel.h" #include "MultiPlayerLevel.h"
#include <float.h> #include <float.h>
@ -122,8 +122,8 @@ void MultiPlayerLevel::tick() {
// 4J: Debug setting added to keep it at day time // 4J: Debug setting added to keep it at day time
#if !defined(_FINAL_BUILD) #if !defined(_FINAL_BUILD)
bool freezeTime = bool freezeTime =
DebugSettings::isOn() && gameServices().debugSettingsOn() &&
DebugSettings::getMask(InputManager.GetPrimaryPad()) & gameServices().debugGetMask(InputManager.GetPrimaryPad()) &
(1L << eDebugSetting_FreezeTime); (1L << eDebugSetting_FreezeTime);
if (!freezeTime) if (!freezeTime)
#endif #endif

View file

@ -1,4 +1,4 @@
#include "minecraft/GameServices.h" #include "minecraft/IGameServices.h"
#include "minecraft/util/Log.h" #include "minecraft/util/Log.h"
#include "MultiPlayerLocalPlayer.h" #include "MultiPlayerLocalPlayer.h"
@ -74,11 +74,11 @@ void MultiplayerLocalPlayer::tick() {
// bool bIsisPrimaryHost=g_NetworkManager.IsHost() && // bool bIsisPrimaryHost=g_NetworkManager.IsHost() &&
// (InputManager.GetPrimaryPad()==m_iPad); // (InputManager.GetPrimaryPad()==m_iPad);
/*if((GameServices::getGameSettings(m_iPad,eGameSetting_PlayerVisibleInMap)!=0) != /*if((gameServices().getGameSettings(m_iPad,eGameSetting_PlayerVisibleInMap)!=0) !=
m_bShownOnMaps) m_bShownOnMaps)
{ {
m_bShownOnMaps = m_bShownOnMaps =
(GameServices::getGameSettings(m_iPad,eGameSetting_PlayerVisibleInMap)!=0); if (gameServices().getGameSettings(m_iPad,eGameSetting_PlayerVisibleInMap)!=0); if
(m_bShownOnMaps) connection->send( std::shared_ptr<PlayerCommandPacket>( new (m_bShownOnMaps) connection->send( std::shared_ptr<PlayerCommandPacket>( new
PlayerCommandPacket(shared_from_this(), PlayerCommandPacket::SHOW_ON_MAPS) ) PlayerCommandPacket(shared_from_this(), PlayerCommandPacket::SHOW_ON_MAPS) )
); else connection->send( std::shared_ptr<PlayerCommandPacket>( new ); else connection->send( std::shared_ptr<PlayerCommandPacket>( new
@ -379,7 +379,7 @@ void MultiplayerLocalPlayer::setAndBroadcastCustomSkin(std::uint32_t skinId) {
if (getCustomSkin() != oldSkinIndex) if (getCustomSkin() != oldSkinIndex)
connection->send(std::shared_ptr<TextureAndGeometryChangePacket>( connection->send(std::shared_ptr<TextureAndGeometryChangePacket>(
new TextureAndGeometryChangePacket( new TextureAndGeometryChangePacket(
shared_from_this(), GameServices::getPlayerSkinName(GetXboxPad())))); shared_from_this(), gameServices().getPlayerSkinName(GetXboxPad()))));
} }
void MultiplayerLocalPlayer::setAndBroadcastCustomCape(std::uint32_t capeId) { void MultiplayerLocalPlayer::setAndBroadcastCustomCape(std::uint32_t capeId) {
@ -392,7 +392,7 @@ void MultiplayerLocalPlayer::setAndBroadcastCustomCape(std::uint32_t capeId) {
if (getCustomCape() != oldCapeIndex) if (getCustomCape() != oldCapeIndex)
connection->send(std::make_shared<TextureChangePacket>( connection->send(std::make_shared<TextureChangePacket>(
shared_from_this(), TextureChangePacket::e_TextureChange_Cape, shared_from_this(), TextureChangePacket::e_TextureChange_Cape,
GameServices::getPlayerCapeName(GetXboxPad()))); gameServices().getPlayerCapeName(GetXboxPad())));
} }
// 4J added for testing. This moves the player in a repeated sequence of 2 // 4J added for testing. This moves the player in a repeated sequence of 2

View file

@ -1,6 +1,6 @@
#include "DragonBreathParticle.h" #include "DragonBreathParticle.h"
#include "app/common/App_enums.h" #include "minecraft/GameEnums.h"
#include "app/common/Colours/ColourTable.h" #include "app/common/Colours/ColourTable.h"
#include "java/JavaMath.h" #include "java/JavaMath.h"
#include "minecraft/client/Minecraft.h" #include "minecraft/client/Minecraft.h"

View file

@ -2,7 +2,7 @@
#include <cmath> #include <cmath>
#include "app/common/App_enums.h" #include "minecraft/GameEnums.h"
#include "app/common/Colours/ColourTable.h" #include "app/common/Colours/ColourTable.h"
#include "java/JavaMath.h" #include "java/JavaMath.h"
#include "minecraft/client/Minecraft.h" #include "minecraft/client/Minecraft.h"

View file

@ -1,6 +1,6 @@
#include "EnchantmentTableParticle.h" #include "EnchantmentTableParticle.h"
#include "app/common/App_enums.h" #include "minecraft/GameEnums.h"
#include "app/common/Colours/ColourTable.h" #include "app/common/Colours/ColourTable.h"
#include "java/JavaMath.h" #include "java/JavaMath.h"
#include "java/Random.h" #include "java/Random.h"

View file

@ -1,6 +1,6 @@
#include "EnderParticle.h" #include "EnderParticle.h"
#include "app/common/App_enums.h" #include "minecraft/GameEnums.h"
#include "app/common/Colours/ColourTable.h" #include "app/common/Colours/ColourTable.h"
#include "java/JavaMath.h" #include "java/JavaMath.h"
#include "java/Random.h" #include "java/Random.h"

View file

@ -1,6 +1,6 @@
#include "ExplodeParticle.h" #include "ExplodeParticle.h"
#include "app/common/App_enums.h" #include "minecraft/GameEnums.h"
#include "app/common/Colours/ColourTable.h" #include "app/common/Colours/ColourTable.h"
#include "java/JavaMath.h" #include "java/JavaMath.h"
#include "java/Random.h" #include "java/Random.h"

View file

@ -3,7 +3,7 @@
#include <GL/gl.h> #include <GL/gl.h>
#include "platform/sdl2/Render.h" #include "platform/sdl2/Render.h"
#include "app/common/App_enums.h" #include "minecraft/GameEnums.h"
#include "app/common/Colours/ColourTable.h" #include "app/common/Colours/ColourTable.h"
#include "java/Random.h" #include "java/Random.h"
#include "minecraft/client/Lighting.h" #include "minecraft/client/Lighting.h"

View file

@ -1,6 +1,6 @@
#include "NetherPortalParticle.h" #include "NetherPortalParticle.h"
#include "app/common/App_enums.h" #include "minecraft/GameEnums.h"
#include "app/common/Colours/ColourTable.h" #include "app/common/Colours/ColourTable.h"
#include "java/JavaMath.h" #include "java/JavaMath.h"
#include "java/Random.h" #include "java/Random.h"

Some files were not shown because too many files have changed in this diff Show more