Skip to content

Commit

Permalink
WIP 1.2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
zhuowei committed Aug 13, 2017
1 parent 4c6b1c4 commit 8228f5a
Show file tree
Hide file tree
Showing 25 changed files with 263 additions and 199 deletions.
4 changes: 2 additions & 2 deletions jni/Application.mk
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@

APP_ABI := armeabi-v7a x86
APP_ABI := armeabi-v7a #x86
APP_PLATFORM := android-14
APP_CFLAGS := -O2 -std=gnu99 -Wall
APP_CPPFLAGS += -std=c++11 -Wno-invalid-offsetof -Wno-pmf-conversions
APP_CPPFLAGS += -std=c++14 -Wno-invalid-offsetof -Wno-pmf-conversions

APP_STL := gnustl_shared

Expand Down
2 changes: 1 addition & 1 deletion jni/fakeassets.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ static bool prefix(const char *pre, const char *str)
static const char kResourcePackPrefix[] = "resource_packs/vanilla/";
static const char kResourcePackDirPrefix[] = "resource_packs/vanilla";
AAsset* bl_AAssetManager_open_hook(AAssetManager *mgr, const char *filename, int mode) {
//BL_LOG("Asset: open %s", filename);
BL_LOG("Asset: open %s", filename);

// zero length filename or an absolute path (on the filesystem) definitely won't be in the assets.
if (strlen(filename) == 0 || filename[0] == '/') return nullptr;
Expand Down
5 changes: 3 additions & 2 deletions jni/mcpe/blockentity/signblockentity.h
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
#pragma once
#include <string>
#include "blockentity.h"
class UIProfanityContext;
class SignBlockEntity : public BlockEntity {
public:
std::string const& getMessage(int) const;
void setMessage(std::string const&, int);
std::string const& getMessage(UIProfanityContext const&);
void setMessage(std::string const&);
};
10 changes: 5 additions & 5 deletions jni/mcpe/blocksource.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,19 +10,19 @@ class Dimension;
class BlockSource {
public:
void setBlockAndData(int, int, int, FullBlock, int);
BlockID getBlockID(int, int, int);
BlockID getBlockID(BlockPos const&);
BlockID getBlockID(int, int, int) const;
BlockID getBlockID(BlockPos const&) const;
int getData(int, int, int);
int getData(BlockPos const&);
BlockBrightness getRawBrightness(int, int, int, bool);
BlockEntity* getBlockEntity(int, int, int);
int getGrassColor(BlockPos const&);
int getGrassColor(BlockPos const&) const;
void setGrassColor(int, BlockPos const&, int);
Biome* getBiome(BlockPos const&);
LevelChunk* getChunk(int, int);
LevelChunk* getChunk(int, int) const;
void fireBlockEvent(int, int, int, int, int);
Dimension* getDimension();
bool canSeeSky(int, int, int);
bool canSeeSky(int, int, int) const;
Level* getLevel();
unsigned short getExtraData(BlockPos const&);
void setExtraData(BlockPos const&, unsigned short);
Expand Down
3 changes: 2 additions & 1 deletion jni/mcpe/blocktessellator.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
#pragma once
class BlockOccluder;
class Tessellator;
class BlockTessellator {
public:
void tessellateInWorld(Block const&, BlockPos const&, unsigned char, bool);
void tessellateInWorld(Tessellator&, Block const&, BlockPos const&, unsigned char, bool);
BlockSource* getRegion() const;
};
12 changes: 7 additions & 5 deletions jni/mcpe/commandorigin.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#pragma once
// updated 1.2.0b2
class Minecraft;
class Player;
class CommandOrigin {
public:
CommandOrigin();
Expand All @@ -9,14 +11,14 @@ class DedicatedServerCommandOrigin : public CommandOrigin {
public:
DedicatedServerCommandOrigin(std::string const&, Minecraft&);
virtual ~DedicatedServerCommandOrigin();
char filler[168-4]; // 4 from DedicatedServerCommandOrigin::clone()
char filler[12-4]; // 4 from DedicatedServerCommandOrigin::clone()
};
static_assert(sizeof(DedicatedServerCommandOrigin) == 168, "dedicated server command size");
static_assert(sizeof(DedicatedServerCommandOrigin) == 12, "dedicated server command size");

class DevConsoleCommandOrigin : public CommandOrigin {
public:
DevConsoleCommandOrigin(EntityUniqueID const&, Level*);
DevConsoleCommandOrigin(Player&);
virtual ~DevConsoleCommandOrigin();
char filler[176-4]; // 4 from DevConsoleCommandOrigin::clone()
char filler[184-4]; // 4 from DevConsoleCommandOrigin::clone()
};
static_assert(sizeof(DevConsoleCommandOrigin) == 176, "dev console command size");
static_assert(sizeof(DevConsoleCommandOrigin) == 184, "dev console command size");
9 changes: 8 additions & 1 deletion jni/mcpe/gamemode.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
#pragma once
class ItemInstance;
class BlockPos;
class Vec3;
class ItemUseCallback;
class Player;
class GameMode {
public:
void _destroyBlockInternal(Player&, BlockPos, signed char);
Player* player;
void _destroyBlockInternal(BlockPos const&, signed char);
float getDestroyProgress();
void useItemOn(ItemInstance&, BlockPos const&, signed char, Vec3 const&, ItemUseCallback*);
};
7 changes: 7 additions & 0 deletions jni/mcpe/gamerenderer.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#pragma once
class MinecraftUIRenderContext;
class GameRenderer {
public:
char filler[12]; // 0
MinecraftUIRenderContext* uiRenderContext; // 12
};
5 changes: 2 additions & 3 deletions jni/mcpe/itemrenderer.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,11 @@ class ItemGraphics {
};
class ItemRenderer {
public:
char filler[4];
std::vector<ItemGraphics> itemGraphics; // 4
std::vector<ItemGraphics> itemGraphics; // 0
void _loadItemGraphics();
static mce::TexturePtr const& getGraphics(ItemInstance const&);
static mce::TexturePtr const& getGraphics(Item const&);
static std::vector<ItemGraphics> mItemGraphics;
static ItemRenderer instance;
};
static_assert(offsetof(ItemRenderer, itemGraphics) == 4, "itemrenderer offset wrong");
static_assert(offsetof(ItemRenderer, itemGraphics) == 0, "itemrenderer offset wrong");
6 changes: 3 additions & 3 deletions jni/mcpe/itemspriterenderer.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ namespace mce {
}
class ItemSpriteRenderer {
public:
char filler[240];
ItemSpriteRenderer(EntityRenderDispatcher&, mce::TextureGroup&, Item*, bool);
char filler[252];
ItemSpriteRenderer(mce::TextureGroup&, Item*, bool);
};
static_assert(sizeof(ItemSpriteRenderer) == 240, "item sprite renderer size");
static_assert(sizeof(ItemSpriteRenderer) == 252, "item sprite renderer size");
4 changes: 2 additions & 2 deletions jni/mcpe/mce/textureptr.h
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
#pragma once
#include <string>
#include "../resourcelocation.h"
enum TextureLocation {
TEXTURE_LOCATION_INTERNAL, // 0
};
class ResourceLocation;
namespace mce {
class TextureGroup;
class TextureDescription;
Expand All @@ -20,7 +20,7 @@ class TexturePtr {
std::string something; // 12
char filler2[4]; // 16
TexturePtr();
TexturePtr(TextureGroup&, ResourceLocation const&, bool a=false);
TexturePtr(TextureGroup&, ResourceLocation, bool a=false);
TexturePtr(TexturePtr&&);
~TexturePtr();
TexturePtr& operator=(TexturePtr&&);
Expand Down
8 changes: 7 additions & 1 deletion jni/mcpe/minecraft.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ class LevelRenderer;
class Vec3;
class ResourcePackManager;
class ClientInstance;
class EntityRenderDispatcher;
class ItemRenderer;
class UIProfanityContext;

enum GameType {
};
Expand Down Expand Up @@ -50,7 +53,10 @@ class ClientInstance {
void onResourcesLoaded();
LevelRenderer* getLevelRenderer() const;
void play(std::string const&, Vec3 const&, float, float);
void leaveGame(bool);
void startLeaveGame(bool);
Level* getLevel();
EntityRenderDispatcher& getEntityRenderDispatcher();
ItemRenderer* getItemRenderer();
UIProfanityContext const& getUIProfanityContext() const;
};
#define MinecraftClient ClientInstance
9 changes: 7 additions & 2 deletions jni/mcpe/minecraftcommands.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,13 @@ struct MCRESULT {
int filler;
};

class CommandRegistry {
public:
Command* findCommand(std::string const&) const;
};

class MinecraftCommands {
public:
std::shared_ptr<Command> getCommand(std::string const&, int) const;
MCRESULT requestCommandExecution(std::unique_ptr<CommandOrigin>, std::string const&, std::string&) const;
CommandRegistry* getRegistry();
MCRESULT requestCommandExecution(std::unique_ptr<CommandOrigin>, std::string const&, int, bool) const;
};
7 changes: 7 additions & 0 deletions jni/mcpe/minecraftuirendercontext.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#pragma once
#include "mce/textureptr.h"
class ResourceLocation;
class MinecraftUIRenderContext {
public:
mce::TexturePtr getTexture(ResourceLocation const&, bool) const;
};
8 changes: 4 additions & 4 deletions jni/mcpe/screenchooser.h
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
#pragma once
class AbstractScreen;
class AbstractScene;
class ScreenChooser {
public:
void popScreen(AbstractScreen&, int);
void popScreen(AbstractScene&, int);
};

class ScreenStack {
class SceneStack {
public:
void _popScreen(bool);
void pushScreen(std::shared_ptr<AbstractScreen>, bool);
void pushScreen(std::shared_ptr<AbstractScene>, bool);
std::string getScreenName() const;
};
3 changes: 2 additions & 1 deletion jni/mcpe/util.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#pragma once
//#include <gsl/string_span>
class Util {
public:
static std::string toLower(std::string const&);
//static gsl::string_span<> toLower(gsl::string_span<> const&);
};
Loading

0 comments on commit 8228f5a

Please sign in to comment.