Exemple #1
0
	static char ReadCharNN(vfsStream& f)
	{
		char c;
		while(!f.Eof())
		{
			f.Read(&c, 1);
			if(c != 0) break;
		}
			
		return c;
	}
Exemple #2
0
	static void GoToNN(vfsStream& f)
	{
		while(!f.Eof())
		{
			char c;
			f.Read(&c, 1);
			if(c != 0)
			{
				f.Seek(f.Tell() - 1);
				break;
			}
		}
	}
Exemple #3
0
	handler::error_code handler::init(vfsStream& stream)
	{
		m_stream_offset = stream.Tell();
		m_stream = &stream;

		return ok;
	}
Exemple #4
0
void ControlInfo::Load(vfsStream& f)
{
	type = Read32(f);
	size = Read32(f);
	next = Read64(f);

	if (type == 1)
	{
		control_flags.ctrl_flag1 = Read32(f);
		control_flags.unknown1 = Read32(f);
		control_flags.unknown2 = Read32(f);
		control_flags.unknown3 = Read32(f);
		control_flags.unknown4 = Read32(f);
		control_flags.unknown5 = Read32(f);
		control_flags.unknown6 = Read32(f);
		control_flags.unknown7 = Read32(f);
	}
	else if (type == 2)
	{
		if (size == 0x30)
		{
			f.Read(file_digest_30.digest, 20);
			file_digest_30.unknown = Read64(f);
		}
		else if (size == 0x40)
		{
			f.Read(file_digest_40.digest1, 20);
			f.Read(file_digest_40.digest2, 20);
			file_digest_40.unknown = Read64(f);
		}
	}
	else if (type == 3)
	{
		npdrm.magic = Read32(f);
		npdrm.unknown1 = Read32(f);
		npdrm.license = Read32(f);
		npdrm.type = Read32(f);
		f.Read(npdrm.content_id, 48);
		f.Read(npdrm.digest, 16);
		f.Read(npdrm.invdigest, 16);
		f.Read(npdrm.xordigest, 16);
		npdrm.unknown2 = Read64(f);
		npdrm.unknown3 = Read64(f);
	}
}
Exemple #5
0
u32 LoadSpuImage(vfsStream& stream)
{
	ELFLoader l(stream);
	l.LoadInfo();
	g_spu_offset = Memory.MainMem.Alloc(0xFFFFED - stream.GetSize());
	l.LoadData(g_spu_offset);

	return g_spu_offset + l.GetEntry();
}
Exemple #6
0
	static wxString ReadString(vfsStream& f, const u32 size)
	{
		wxString ret = wxEmptyString;

		for(uint i=0; i<size && !f.Eof(); ++i)
		{
			ret += ReadChar(f);
		}

		return ret;
	}
Exemple #7
0
	static wxString ReadString(vfsStream& f)
	{
		wxString ret = wxEmptyString;

		while(!f.Eof())
		{
			const char c = ReadChar(f);
			if(c == 0) break;
			ret += c;
		}
		
		return ret;
	}
Exemple #8
0
	bool loader::load(vfsStream& stream)
	{
		for (auto i : m_handlers)
		{
			i->set_status(i->init(stream));
			if (i->get_status() == handler::ok)
			{
				i->set_status(i->load());
				if (i->get_status() == handler::ok)
				{
					return true;
				}

				LOG_NOTICE(LOADER, "loader::load() failed: %s", i->get_error_code().c_str());
			}
			else
			{
				LOG_NOTICE(LOADER, "loader::init() failed: %s", i->get_error_code().c_str());
				stream.Seek(i->get_stream_offset());
			}
		}

		return false;
	}
Exemple #9
0
force_inline void Write64(vfsStream& f, const be_t<u64> data)
{
	f.Write(&data, sizeof(data));
}
Exemple #10
0
force_inline void Write16LE(vfsStream& f, const u16 data)
{
	f.Write(&data, sizeof(data));
}
Exemple #11
0
	static char ReadChar(vfsStream& f)
	{
		char c;
		f.Read(&c, 1);
		return c;
	}
Exemple #12
0
__forceinline void Write64LE(vfsStream& f, const u64 data)
{
	f.Write(&data, sizeof(data));
}
Exemple #13
0
__forceinline void Write8(vfsStream& f, const u8 data)
{
	f.Write(&data, sizeof(data));
}
Exemple #14
0
void Elf32_Phdr::LoadLE(vfsStream& f)
{
	f.Read(this, sizeof(*this));
}
Exemple #15
0
__forceinline u8 Read8(vfsStream& f)
{
	u8 ret;
	f.Read(&ret, sizeof(ret));
	return ret;
}
Exemple #16
0
void Signature::Load(vfsStream& f)
{
	f.Read(r, 21);
	f.Read(s, 21);
	f.Read(padding, 6);
}
Exemple #17
0
void SectionHash::Load(vfsStream& f)
{
	f.Read(sha1, 20);
	f.Read(padding, 12);
	f.Read(hmac_key, 64);
}
Exemple #18
0
force_inline void Write32LE(vfsStream& f, const u32 data)
{
	f.Write(&data, sizeof(data));
}
Exemple #19
0
__forceinline u16 Read16LE(vfsStream& f)
{
	u16 ret;
	f.Read(&ret, sizeof(ret));
	return ret;
}
Exemple #20
0
__forceinline u64 Read64(vfsStream& f)
{
	be_t<u64> ret;
	f.Read(&ret, sizeof(ret));
	return ret;
}
Exemple #21
0
__forceinline u32 Read32(vfsStream& f)
{
	be_t<u32> ret;
	f.Read(&ret, sizeof(ret));
	return ret;
}
Exemple #22
0
__forceinline u64 Read64LE(vfsStream& f)
{
	u64 ret;
	f.Read(&ret, sizeof(ret));
	return ret;
}
Exemple #23
0
__forceinline u32 Read32LE(vfsStream& f)
{
	u32 ret;
	f.Read(&ret, sizeof(ret));
	return ret;
}
Exemple #24
0
__forceinline u16 Read16(vfsStream& f)
{
	be_t<u16> ret;
	f.Read(&ret, sizeof(ret));
	return ret;
}