the game where you go into mines and start crafting! but for consoles (forked directly from smartcmd's github)
at main 92 lines 2.0 kB view raw
1#include "stdafx.h" 2 3#include <string> 4 5#include "..\..\..\Minecraft.World\File.h" 6#include "..\..\..\Minecraft.World\StringHelpers.h" 7#include "..\..\..\Minecraft.World\InputOutputStream.h" 8 9#include "DLCManager.h" 10#include "DLCGameRulesHeader.h" 11 12DLCGameRulesHeader::DLCGameRulesHeader(const wstring &path) : DLCGameRules(DLCManager::e_DLCType_GameRulesHeader,path) 13{ 14 m_pbData = NULL; 15 m_dwBytes = 0; 16 17 m_hasData = false; 18 19 m_grfPath = path.substr(0, path.length() - 4) + L".grf"; 20 21 lgo = NULL; 22} 23 24void DLCGameRulesHeader::addData(PBYTE pbData, DWORD dwBytes) 25{ 26 m_pbData = pbData; 27 m_dwBytes = dwBytes; 28 29 30#if 0 31 byteArray data(m_pbData, m_dwBytes); 32 ByteArrayInputStream bais(data); 33 DataInputStream dis(&bais); 34 35 // Init values. 36 int version_number; 37 byte compression_type; 38 wstring texturepackid; 39 40 // Read Datastream. 41 version_number = dis.readInt(); 42 compression_type = dis.readByte(); 43 m_defaultSaveName = dis.readUTF(); 44 m_displayName = dis.readUTF(); 45 texturepackid = dis.readUTF(); 46 m_grfPath = dis.readUTF(); 47 48 // Debug printout. 49 app.DebugPrintf ( 50 "DLCGameRulesHeader::readHeader:\n" 51 "\tversion_number = '%d',\n" 52 "\tcompression_type = '%d',\n" 53 "\tdefault_savename = '%s',\n" 54 "\tdisplayname = '%s',\n" 55 "\ttexturepackid = '%s',\n" 56 "\tgrf_path = '%s',\n", 57 58 version_number, compression_type, 59 60 wstringtofilename(m_defaultSaveName), 61 wstringtofilename(m_displayName), 62 wstringtofilename(texturepackid), 63 wstringtofilename(m_grfPath) 64 ); 65 66 // Texture Pack. 67 m_requiredTexturePackId = _fromString<long>(texturepackid); 68 m_bRequiresTexturePack = m_requiredTexturePackId > 0; 69 70 dis.close(); 71 bais.close(); 72 bais.reset(); 73#endif 74} 75 76PBYTE DLCGameRulesHeader::getData(DWORD &dwBytes) 77{ 78 dwBytes = m_dwBytes; 79 return m_pbData; 80} 81 82void DLCGameRulesHeader::setGrfData(PBYTE fData, DWORD fSize, StringTable *st) 83{ 84 if (!m_hasData) 85 { 86 m_hasData = true; 87 88 //app.m_gameRules.loadGameRules(lgo, fData, fSize); 89 90 app.m_gameRules.readRuleFile(lgo, fData, fSize, st); 91 } 92}