~ubuntu-branches/ubuntu/natty/spring/natty

« back to all changes in this revision

Viewing changes to rts/lib/hpiutil2/sqshstream.h

  • Committer: Bazaar Package Importer
  • Author(s): Scott Ritchie
  • Date: 2010-09-23 18:56:03 UTC
  • mfrom: (3.1.9 experimental)
  • Revision ID: james.westby@ubuntu.com-20100923185603-st97s5chplo42y7w
Tags: 0.82.5.1+dfsg1-1ubuntu1
* Latest upstream version for online play
* debian/control: Replace (rather than conflict) spring-engine
  - spring-engine will be a dummy package (LP: #612905)
  - also set maintainer to MOTU

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*
2
 
 * sqshstream.h
3
 
 * SQSH stream class definition
4
 
 * Copyright (C) 2005 Christopher Han <xiphux@gmail.com>
5
 
 *
6
 
 * This file is part of hpiutil2.
7
 
 *
8
 
 * hpiutil2 is free software; you can redistribute it and/or modify
9
 
 * it under the terms of the GNU General Public License as published by
10
 
 * the Free Software Foundation; either version 2 of the License, or
11
 
 * (at your option) any later version.
12
 
 *
13
 
 * hpiutil2 is distributed in the hope that it will be useful,
14
 
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15
 
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16
 
 * GNU General Public License for more details.
17
 
 *
18
 
 * You should have received a copy of the GNU General Public License
19
 
 * along with hpiutil2; if not, write to the Free Software
20
 
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
21
 
 */
22
 
 
23
 
#ifndef HPIUTIL2_SQSHSTREAM_H
24
 
#define HPIUTIL2_SQSHSTREAM_H
25
 
 
26
 
#include <sstream>
27
 
#include "substream.h"
28
 
 
29
 
#define HPI_NONE 0
30
 
#define HPI_LZ77 1
31
 
#define HPI_ZLIB 2
32
 
 
33
 
#define SQSH_MAGIC 0x48535153
34
 
#define SQSH_HEADER 19
35
 
 
36
 
namespace hpiutil
37
 
{
38
 
        
39
 
        class sqshstream
40
 
        {
41
 
        public:
42
 
                bool valid;
43
 
                boost::uint8_t encrypt;
44
 
                boost::uint8_t compress;
45
 
                boost::uint32_t position;
46
 
                sqshstream(substream &ss);
47
 
                ~sqshstream();
48
 
                boost::uint8_t read();
49
 
                boost::uint32_t read(boost::uint8_t *buf);
50
 
                boost::uint32_t read(boost::uint8_t *buf, const boost::uint32_t off, const boost::uint32_t len);
51
 
                boost::uint32_t readall(boost::uint8_t *buf);
52
 
                boost::uint32_t readint();
53
 
        private:
54
 
                bool decompress();
55
 
                boost::uint32_t decompresszlib(boost::uint8_t *src, boost::uint8_t *dest, const boost::uint32_t srcsize, const boost::uint32_t destsize);
56
 
                boost::uint32_t decompresslz77(boost::uint8_t *src, boost::uint8_t *dest, const boost::uint32_t srcsize, const boost::uint32_t destsize);
57
 
                substream *stream;
58
 
                std::istringstream *fullstream;
59
 
                boost::uint8_t *data;
60
 
                boost::uint32_t compressedsize;
61
 
                boost::uint32_t fullsize;
62
 
                boost::uint32_t checksum;
63
 
        };
64
 
 
65
 
}
66
 
 
67
 
#endif /* HPIUTIL2_SQSHSTREAM_H */