Page 1 of 1

Xbox Minecraft MCR (region) Files

Posted: Mon Apr 15, 2013 10:53 pm
by Rocky5
Hi, I made a hacky Batch + Swiss File Knife world extractor for the Xbox version of minecraft, I can get all the files out of the savegame.dat but the region files are compressed differently from the PC version.

PC version uses zlib compression, the xbox not sure, (gzip? or lzx?) the structure is identical to Minecraft 1.3 (PC) so the wiki has been helpful but I'm stuck at getting the files loaded in MCEdit (stable33 MCR version)

XBLA Minecraft World Extractor v1.0.zip

I have included the extractor + savegame.dat & also a Xbox region file as well as a PC Region file, for comparison.

any help would be very much appreciated as I have got so far & hit a roadblock.

Re: Xbox Minecraft MCR (region) Files

Posted: Tue Apr 16, 2013 4:26 am
by aluigi
The xbox version uses xmemcompress (MS LZX) with compressed size plus 0x80000000 followed by the uncompressed size.

Re: Xbox Minecraft MCR (region) Files

Posted: Tue Apr 16, 2013 2:23 pm
by Rocky5
Thank you, but sorry to ask how would I go about decompressing said files, I know where the everything is inside the region files, & where the compressed length value is located (I didn't know about the decompressed length value & the use for the 0x80000000)

I'm no programmer I dabble in batch files for doing simple tasks & no one has attempted what I have done, which I find strange, there more for the inventory editing :-/

Re: Xbox Minecraft MCR (region) Files

Posted: Tue Apr 16, 2013 2:48 pm
by aluigi
You need to use the xbox sdk to use that decompression library.

Regarding the format I have not found information about it, I simply wrote a lame script to do the job:
http://aluigi.org/papers/bms/others/minecraft_mcr.bms

Re: Xbox Minecraft MCR (region) Files

Posted: Tue Apr 16, 2013 4:51 pm
by lllccc
thanks aluigi ^_^

Re: Xbox Minecraft MCR (region) Files

Posted: Tue Apr 16, 2013 7:11 pm
by Rocky5
Bellow.

Re: Xbox Minecraft MCR (region) Files

Posted: Mon May 20, 2013 10:45 pm
by Rocky5
bellow

Re: Xbox Minecraft MCR (region) Files

Posted: Tue May 21, 2013 7:18 pm
by aluigi

Code: Select all

getdstring NAME 0x80
set NAME unicode NAME

Re: Xbox Minecraft MCR (region) Files

Posted: Tue May 21, 2013 9:01 pm
by Rocky5
aluigi wrote:....
Thank you very much :-D I tried everything, bar put NAME at the end of that set string :-/

My first scripts :-) - they have batches that does some work to :-) not included bellow.

The bellow Scripts will Decompress your Savegame.dat & extract the files from the decompressed save.

Save Decryption.

Code: Select all

#=================================================================================================
# MCXB_Save_Decrypt.bms
# (c) 25/05/2013 by Rocky5
#=================================================================================================

endian big
get NAME FILENAME				# Gets the file name

	comtype xmemdecompress
	get CSIZE long				# Compressed file size.
	math CSIZE -= 0x08
	goto 0x08					# Used to skip the NULLED bytes.
	get DSIZE long				# Uncompressed Size.

clog "tmp\0.tmp" 0xC CSIZE DSIZE
Save Encryption.

Code: Select all

#=================================================================================================
# MCXB_Save_Encrypt.bms
# (c) 25/05/2013 by Rocky5
#=================================================================================================

endian big
open "tmp" 0.tmp                        # Open uncompressed file.
get DSIZE ASIZE                        # Get uncompressed size.

   comtype xmemlzx_compress

clog "tmp\1.tmp" 0x0 DSIZE DSIZE         # Compress file.

open "tmp" 1.tmp
get CSIZE ASIZE                        # Get compressed size.
math CSIZE += 0x08                     # Needed for the Xbox to read the save

log MEMORY_FILE1 0x0 0x0               # Create a memory file.
put CSIZE long MEMORY_FILE1               # Puts file compressed size.
put 0     long MEMORY_FILE1               # Puts Nuls for 4 bytes.
put DSIZE long MEMORY_FILE1               # Puts file uncompressed size.

math CSIZE -= 0x08                     # Reset the compressed size

append
log MEMORY_FILE1 0x0 CSIZE               # Puts it all together.
append

get SIZE asize MEMORY_FILE1

log "tmp\savegame.dat" 0 SIZE MEMORY_FILE1
Save extractor.

Code: Select all

#=================================================================================================
# MCXB_Save_Extractor.bms
# (c) 25/05/2013 by Rocky5
#=================================================================================================
# First 4 Bytes are the index offset.
# The next 4 bytes are the file count.
# Each files Index is 144 in decimal & 0x90 hex.
# At Offset 0x80 4 bytes long on each file index is the Region size. (in hex)
# The next 4 bytes are the Region file starting offset.

# There are bytes after the above, but I don't know what there for. (Hash maybe?)

# The Region files are a similar format to Minecraft Beta 1.3 for the PC. There compressed using
# XmemCompress (LZX), it appears the Xbox format doesn't have padding in the chunks, instead it
# creates more files. A PC 1024x1024x127 map (Xbox map size) has 64, 81kbs files. the Xbox has
# 729 files ranging from 5kbs to 4kbs, with no padding, this is true on a flatland created world.
#
# PC Chunk files are 16x16x127 hence 64 files. 64 * 16 = 1024
# Xbox has a max of 729 chunk files but if going by the above that would mean there 1.**** chunks
# per file. 1024 / 729 = 1.404663923182442 - cant be this though.
#
# So Region files can be extracted, decompressed. But thats it for me.
#=================================================================================================

endian big
get FILESIZE asize
get INDEXOFFSET long
get FILEINDEXCOUNT long

for A = 0 < FILEINDEXCOUNT
	goto INDEXOFFSET           	# Jumps to the Index.
	getdstring NAME 0x80		# Gets bytes with the files names
	set NAME unicode NAME		# Translates them to unicode so 00 works.
	get SIZE long				# Size of the region file.
	get OFFSET long				# Offset for the start of the region file.
	get UNKNOWN1 long			# Just put that here to catch the next 4 bytes.
	get UNKNOWN2 long			# Just put that here to catch the next 4 bytes.
	math INDEXOFFSET += 0x90    # Starts on the next index entry.
	log NAME OFFSET SIZE		# Outputs the files.
next A