profuse/UniversalDiskImage.cpp
ksherlock f6018484ce cleanups for Linux
git-svn-id: https://profuse.googlecode.com/svn/trunk@17 aa027e90-d47c-11dd-86d7-074df07e0730
2009-01-09 21:57:02 +00:00

52 lines
966 B
C++

/*
* UniversalDiskImage.cpp
* profuse
*
* Created by Kelvin Sherlock on 1/6/09.
*
*/
#include "UniversalDiskImage.h"
#include "common.h"
#include <string.h>
bool UniversalDiskImage::Load(const uint8_t *buffer)
{
if (strncmp((const char *)buffer, "2IMG", 4) != 0) return false;
// all numbers little-endian.
magic_word = load32(&buffer[0]);
creator = load32(&buffer[0x04]);
header_size = load16(&buffer[0x08]);
version = load16(&buffer[0x0a]);
image_format = load32(&buffer[0x0c]);
flags = load32(&buffer[0x10]);
data_blocks = load32(&buffer[0x14]);
data_offset = load32(&buffer[0x18]);
data_size = load32(&buffer[0x1c]);
comment_offset = load32(&buffer[0x20]);
comment_size = load32(&buffer[0x24]);
creator_data_offset = load32(&buffer[0x28]);
creator_data_size = load32(&buffer[0x2c]);
// 16 bytes reserved.
return true;
}