5 | Usage: sfxobjdump <romfile> <vertex list address> <face data address>
6 |
7 | -f <n> Frame n only
8 | -b <basename> Set base filename.
9 | Output filenames will be be in format "Basename nn"
10 | -v Verbose output
11 | -t Validate only.
12 |
13 |
14 | Currently only outputs the data in .obj format. For animated objects, it will output one .obj for each frame.
15 |
16 | Does not currently handle textures from the rom, but is intended to be added. Contributors welcome.
17 |
18 | Should also work with Starfox 2, and is expected to work with all other SuperFX games such as Vortex, Stunt Race FX, and Dirt Trax.
19 |
--------------------------------------------------------------------------------
/src/ArrayList.cpp:
--------------------------------------------------------------------------------
1 | // sfxObj Object. Parser and container for Starfox (1991) and possibly
2 | // other Argonaut Software models. Copyright (C) 2018 JD Fenech (hordeking@users.noreply.github.com)
3 | //
4 | // This program is free software: you can redistribute it and/or modify
5 | // it under the terms of the GNU General Public License as published by
6 | // the Free Software Foundation, either version 3 of the License, or
7 | // (at your option) any later version.
8 | //
9 | // This program is distributed in the hope that it will be useful,
10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | // GNU General Public License for more details.
13 | //
14 | // You should have received a copy of the GNU General Public License
15 | // along with this program. If not, see .
16 |
17 | #include "ArrayList.h"
18 |
--------------------------------------------------------------------------------
/include/ArrayList.h:
--------------------------------------------------------------------------------
1 | // sfxObj Object. Parser and container for Starfox (1991) and possibly
2 | // other Argonaut Software models. Copyright (C) 2018 JD Fenech (hordeking@users.noreply.github.com)
3 | //
4 | // This program is free software: you can redistribute it and/or modify
5 | // it under the terms of the GNU General Public License as published by
6 | // the Free Software Foundation, either version 3 of the License, or
7 | // (at your option) any later version.
8 | //
9 | // This program is distributed in the hope that it will be useful,
10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | // GNU General Public License for more details.
13 | //
14 | // You should have received a copy of the GNU General Public License
15 | // along with this program. If not, see .
16 |
17 | #ifndef ARRAYLIST_H
18 | #define ARRAYLIST_H
19 |
20 | #include
21 |
22 | template
23 | class List: public std::vector {
24 |
25 | //If this causes memory leaks, implement it as a function in SFXObject, rather than here. We like this form better because it
26 | // is more object oriented, though.
27 | public: bool addAll(List inList){
28 |
29 | if (this == &inList)
30 | return false;
31 |
32 | this->insert( this->end(), std::begin(inList), std::end(inList));
33 | return true;
34 | }
35 |
36 | };
37 |
38 | #endif // ARRAYLIST_H
39 |
--------------------------------------------------------------------------------
/src/Face.cpp:
--------------------------------------------------------------------------------
1 | // sfxObj Object. Parser and container for Starfox (1991) and possibly
2 | // other Argonaut Software models. Copyright (C) 2018 JD Fenech
3 | // (hordeking@users.noreply.github.com) based on sfxObjReader by
4 | // Stéphane Dallongeville.
5 | //
6 | // This program is free software: you can redistribute it and/or modify
7 | // it under the terms of the GNU General Public License as published by
8 | // the Free Software Foundation, either version 3 of the License, or
9 | // (at your option) any later version.
10 | //
11 | // This program is distributed in the hope that it will be useful,
12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | // GNU General Public License for more details.
15 | //
16 | // You should have received a copy of the GNU General Public License
17 | // along with this program. If not, see .
18 |
19 | #include "Face.h"
20 |
21 | Face::Face()
22 | {
23 | //ctor
24 | }
25 |
26 | Face::Face(BufferReader & buf)
27 | {
28 | if (0xFE >= buf.getUByte() || !buf.good() ) return;
29 |
30 | nVerts = buf.nextUByte(); //nVerts;
31 | faceID = buf.nextUByte();
32 | color = buf.nextUByte();
33 | nx = buf.nextByte();
34 | ny = buf.nextByte();
35 | nz = buf.nextByte();
36 |
37 | for(size_t i = 0; i.
18 |
19 | #include "Normal.h"
20 |
21 | //Should really add a method to this one to allow it to calculate from any three vertices and/or one triangle.
22 |
23 | Normal::Normal(signed int nx, signed int ny, signed int nz): nx(nx), ny(ny), nz(nz)
24 | {
25 | //ctor
26 | }
27 |
28 | Normal::Normal(const Normal& other): nx(other.nx), ny(other.ny), nz(other.nz)
29 | {
30 | //copy ctor
31 | }
32 |
33 | Normal& Normal::operator=(const Normal& rhs)
34 | {
35 | if (this == &rhs) return *this; // handle self assignment
36 | //assignment operator
37 | nx = rhs.nx;
38 | ny = rhs.ny;
39 | nz = rhs.nz;
40 | return *this;
41 | }
42 |
43 | float Normal::length(void) { return sqrt(nx*nx+ny*ny+nz*nz); }
44 |
--------------------------------------------------------------------------------
/include/Normal.h:
--------------------------------------------------------------------------------
1 | // sfxObj Object. Parser and container for Starfox (1991) and possibly
2 | // other Argonaut Software models. Copyright (C) 2018 JD Fenech
3 | // (hordeking@users.noreply.github.com) based on sfxObjReader by
4 | // Stéphane Dallongeville.
5 | //
6 | // This program is free software: you can redistribute it and/or modify
7 | // it under the terms of the GNU General Public License as published by
8 | // the Free Software Foundation, either version 3 of the License, or
9 | // (at your option) any later version.
10 | //
11 | // This program is distributed in the hope that it will be useful,
12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | // GNU General Public License for more details.
15 | //
16 | // You should have received a copy of the GNU General Public License
17 | // along with this program. If not, see .
18 |
19 | #ifndef NORMAL_H
20 | #define NORMAL_H
21 |
22 | #include
23 |
24 | class Normal
25 | {
26 | public:
27 |
28 | Normal() { };
29 |
30 | /** Default constructor */
31 | Normal( signed int nx, signed int ny, signed int nz);
32 |
33 | /** Copy constructor
34 | * \param other Object to copy from
35 | */
36 | Normal(const Normal& other);
37 | /** Assignment operator
38 | * \param other Object to assign from
39 | *
eturn A reference to this
40 | */
41 | Normal& operator=(const Normal& other);
42 |
43 | float length(void);
44 |
45 | protected:
46 | signed int nx = 0;
47 | signed int ny = 0;
48 | signed int nz = 0;
49 |
50 | private:
51 |
52 | };
53 |
54 | #endif // NORMAL_H
55 |
--------------------------------------------------------------------------------
/include/BufferReader.h:
--------------------------------------------------------------------------------
1 | // sfxObj Object. Parser and container for Starfox (1991) and possibly
2 | // other Argonaut Software models. Copyright (C) 2018 JD Fenech
3 | // (hordeking@users.noreply.github.com) based on sfxObjReader by
4 | // Stéphane Dallongeville.
5 | //
6 | // This program is free software: you can redistribute it and/or modify
7 | // it under the terms of the GNU General Public License as published by
8 | // the Free Software Foundation, either version 3 of the License, or
9 | // (at your option) any later version.
10 | //
11 | // This program is distributed in the hope that it will be useful,
12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | // GNU General Public License for more details.
15 | //
16 | // You should have received a copy of the GNU General Public License
17 | // along with this program. If not, see .
18 |
19 | #ifndef BUFFERREADER_H
20 | #define BUFFERREADER_H
21 |
22 | #include
23 | #include
24 | #include
25 |
26 | class BufferReader : public std::stringstream {
27 |
28 | public: BufferReader(std::ifstream & input){ operator<<(input.rdbuf()); }
29 |
30 | public: uint8_t getUByte();
31 | public: uint16_t getUShort();
32 | public: uint32_t getUInt();
33 |
34 | public: int8_t getByte();
35 | public: int16_t getShort();
36 | public: int32_t getInt();
37 |
38 | public: uint8_t nextUByte();
39 | public: uint16_t nextUShort();
40 | public: uint32_t nextUInt();
41 |
42 | public: int8_t nextByte();
43 | public: int16_t nextShort();
44 | public: int32_t nextInt();
45 |
46 | };
47 |
48 | #endif // BUFFERREADER_H
49 |
--------------------------------------------------------------------------------
/src/Triangle.cpp:
--------------------------------------------------------------------------------
1 | // sfxObj Object. Parser and container for Starfox (1991) and possibly
2 | // other Argonaut Software models. Copyright (C) 2018 JD Fenech
3 | // (hordeking@users.noreply.github.com) based on sfxObjReader by
4 | // Stéphane Dallongeville.
5 | //
6 | // This program is free software: you can redistribute it and/or modify
7 | // it under the terms of the GNU General Public License as published by
8 | // the Free Software Foundation, either version 3 of the License, or
9 | // (at your option) any later version.
10 | //
11 | // This program is distributed in the hope that it will be useful,
12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | // GNU General Public License for more details.
15 | //
16 | // You should have received a copy of the GNU General Public License
17 | // along with this program. If not, see .
18 |
19 | #include "Triangle.h"
20 |
21 | //TODO: Add method to return all three vertices as an ordered array. Would be nice if we could just return the vertices themselves.
22 |
23 | Triangle::Triangle(unsigned int v1, unsigned int v2, unsigned int v3): v1(v1), v2(v2), v3(v3)
24 | {
25 |
26 | }
27 |
28 | Triangle::Triangle(const Triangle& other): v1(other.v1), v2(other.v2), v3(other.v3)
29 | {
30 |
31 | }
32 |
33 | Triangle& Triangle::operator=(const Triangle& rhs)
34 | {
35 | if (this == &rhs) return *this; // handle self assignment
36 | //assignment operator
37 | return *this;
38 | }
39 |
40 | std::string Triangle::getFormattedString()
41 | {
42 | return std::to_string(v1) +
43 | std::string(" ") +
44 | std::to_string(v2) +
45 | std::string(" ") +
46 | std::to_string(v3);
47 | }
48 |
--------------------------------------------------------------------------------
/include/Triangle.h:
--------------------------------------------------------------------------------
1 | // sfxObj Object. Parser and container for Starfox (1991) and possibly
2 | // other Argonaut Software models. Copyright (C) 2018 JD Fenech
3 | // (hordeking@users.noreply.github.com) based on sfxObjReader by
4 | // Stéphane Dallongeville.
5 | //
6 | // This program is free software: you can redistribute it and/or modify
7 | // it under the terms of the GNU General Public License as published by
8 | // the Free Software Foundation, either version 3 of the License, or
9 | // (at your option) any later version.
10 | //
11 | // This program is distributed in the hope that it will be useful,
12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | // GNU General Public License for more details.
15 | //
16 | // You should have received a copy of the GNU General Public License
17 | // along with this program. If not, see .
18 |
19 | #ifndef TRIANGLE_H
20 | #define TRIANGLE_H
21 |
22 | #include
23 |
24 | class Triangle
25 | {
26 | public:
27 | /** Set constructor */
28 | Triangle(unsigned int v1, unsigned int v2, unsigned int v3);
29 |
30 | /** Copy constructor
31 | * \param other Object to copy from
32 | */
33 | Triangle(const Triangle& other);
34 |
35 | /** Assignment operator
36 | * \param other Object to assign from
37 | *
eturn A reference to this
38 | */
39 | Triangle& operator=(const Triangle& other);
40 |
41 | std::string getFormattedString();
42 |
43 | unsigned int Getv1() { return v1;}
44 | unsigned int Getv2() { return v2;}
45 | unsigned int Getv3() { return v3;}
46 |
47 | protected:
48 |
49 | unsigned int v1;
50 | unsigned int v2;
51 | unsigned int v3;
52 |
53 | private:
54 | };
55 |
56 |
57 | #endif // TRIANGLE_H
58 |
--------------------------------------------------------------------------------
/include/Face.h:
--------------------------------------------------------------------------------
1 | // sfxObj Object. Parser and container for Starfox (1991) and possibly
2 | // other Argonaut Software models. Copyright (C) 2018 JD Fenech
3 | // (hordeking@users.noreply.github.com) based on sfxObjReader by
4 | // Stéphane Dallongeville.
5 | //
6 | // This program is free software: you can redistribute it and/or modify
7 | // it under the terms of the GNU General Public License as published by
8 | // the Free Software Foundation, either version 3 of the License, or
9 | // (at your option) any later version.
10 | //
11 | // This program is distributed in the hope that it will be useful,
12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | // GNU General Public License for more details.
15 | //
16 | // You should have received a copy of the GNU General Public License
17 | // along with this program. If not, see .
18 |
19 | #ifndef FACE_H
20 | #define FACE_H
21 |
22 | #include
23 | #include
24 |
25 | #include "BufferReader.h"
26 | #include "Vertex.h"
27 |
28 | class Face
29 | {
30 | public:
31 | /** Default constructor */
32 | Face();
33 | Face(BufferReader & buf);
34 | /** Default destructor */
35 | virtual ~Face();
36 |
37 | public: unsigned int nVerts;
38 | public: uint8_t faceID;
39 | public: uint8_t color;
40 | public: int8_t nx, ny, nz;
41 | public: std::vector vertex;
42 | public: std::string getFormattedString()
43 | {
44 | return std::string("nVerts: ")+std::to_string(int(nVerts))+
45 | std::string(" faceID: ")+std::to_string(faceID)+
46 | std::string(" Color: ")+std::to_string(int(color))+
47 | std::string(" Normal: [")+std::to_string(nx)+", "+std::to_string(ny)+", "+std::to_string(nz)+"]";
48 |
49 | }
50 | };
51 |
52 | #endif // FACE_H
53 |
--------------------------------------------------------------------------------
/sfxObjectDumper.cbp:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
--------------------------------------------------------------------------------
/src/BufferReader.cpp:
--------------------------------------------------------------------------------
1 | // sfxObj Object. Parser and container for Starfox (1991) and possibly
2 | // other Argonaut Software models. Copyright (C) 2018 JD Fenech
3 | // (hordeking@users.noreply.github.com) based on sfxObjReader by
4 | // Stéphane Dallongeville.
5 | //
6 | // This program is free software: you can redistribute it and/or modify
7 | // it under the terms of the GNU General Public License as published by
8 | // the Free Software Foundation, either version 3 of the License, or
9 | // (at your option) any later version.
10 | //
11 | // This program is distributed in the hope that it will be useful,
12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | // GNU General Public License for more details.
15 | //
16 | // You should have received a copy of the GNU General Public License
17 | // along with this program. If not, see .
18 |
19 | #include "BufferReader.h"
20 |
21 |
22 | uint8_t BufferReader::getUByte()
23 | {
24 | return getByte();
25 | }
26 |
27 | uint16_t BufferReader::getUShort()
28 | {
29 | return getShort();
30 | }
31 |
32 | uint32_t BufferReader::getUInt()
33 | {
34 | return getInt();
35 | }
36 |
37 |
38 | int8_t BufferReader::getByte()
39 | {
40 | int8_t output = 0;
41 | this->read((char *) &output, 1 );
42 | this->seekg(-1, std::stringstream::cur);
43 | return output;
44 | }
45 |
46 | int16_t BufferReader::getShort()
47 | {
48 | int16_t output = 0;
49 | this->read((char *) &output, 2 );
50 | this->seekg(-2, std::stringstream::cur);
51 | return output;
52 | }
53 | int32_t BufferReader::getInt()
54 | {
55 | int32_t output = 0;
56 | this->read((char *) &output, 4 );
57 | this->seekg(-4, std::stringstream::cur);
58 | return output;
59 | }
60 |
61 |
62 |
63 | uint8_t BufferReader::nextUByte()
64 | {
65 | return nextByte();
66 | }
67 |
68 | uint16_t BufferReader::nextUShort()
69 | {
70 | return nextShort();
71 | }
72 |
73 | uint32_t BufferReader::nextUInt()
74 | {
75 | return nextInt();
76 | }
77 |
78 |
79 |
80 | int8_t BufferReader::nextByte()
81 | {
82 | int8_t output = 0;
83 | read((char *) &output, 1 );
84 | return output;
85 | }
86 |
87 | int16_t BufferReader::nextShort()
88 | {
89 | int16_t output = 0;
90 | read((char *) &output, 2 );
91 | return output;
92 | }
93 |
94 | int32_t BufferReader::nextInt()
95 | {
96 | int32_t output = 0;
97 | read((char *) &output, 4 );
98 | return output;
99 | }
100 |
--------------------------------------------------------------------------------
/include/Vertex.h:
--------------------------------------------------------------------------------
1 | // sfxObj Object. Parser and container for Starfox (1991) and possibly
2 | // other Argonaut Software models. Copyright (C) 2018 JD Fenech
3 | // (hordeking@users.noreply.github.com) based on sfxObjReader by
4 | // Stéphane Dallongeville.
5 | //
6 | // This program is free software: you can redistribute it and/or modify
7 | // it under the terms of the GNU General Public License as published by
8 | // the Free Software Foundation, either version 3 of the License, or
9 | // (at your option) any later version.
10 | //
11 | // This program is distributed in the hope that it will be useful,
12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | // GNU General Public License for more details.
15 | //
16 | // You should have received a copy of the GNU General Public License
17 | // along with this program. If not, see .
18 |
19 | #ifndef VERTEX_H
20 | #define VERTEX_H
21 |
22 | #include
23 | #include
24 | #include "BufferReader.h"
25 |
26 | // Vertices are stored in the native Star Fox coordinate system.
27 | // +z forward
28 | // -y up
29 | // +x right
30 | // TODO: Build in a few different conversions, in particular +z forward to +x forward, -y up to +z up, +x right to -y right
31 |
32 | class Vertex
33 | {
34 | public:
35 | /** Default constructor */
36 | Vertex();
37 |
38 | /** Copy constructor
39 | * \param other Object to copy from
40 | */
41 | // Vertex(const Vertex& other);
42 |
43 | /** Assignment operator
44 | * \param other Object to assign from
45 | *
eturn A reference to this
46 | */
47 | Vertex& operator=(const Vertex& other);
48 |
49 | Vertex(signed int x, signed int y, signed int z, bool sh = false);
50 | Vertex(BufferReader & buf, bool sh = false);
51 |
52 | /** Flip Copy Constructor
53 | * \param v Object to copy from
54 | * \param xflip Mirror X coord
55 | * \param yflip Mirror Y coord
56 | * \param zflip Mirror Z coord
57 | */
58 | Vertex(const Vertex & v, bool xflip = false, bool yflip = false, bool zflip = false);
59 |
60 | std::vector getCoords(void);
61 |
62 | bool getCoordsType(void);
63 |
64 | std::string getFormattedString();
65 |
66 | protected:
67 | private:
68 | signed int x; //!< Member variable "x"
69 | signed int y; //!< Member variable "y"
70 | signed int z; //!< Member variable "z"
71 | bool sh; //!< Wide-Coordinate flag
72 | };
73 |
74 | #endif // VERTEX_H
75 |
--------------------------------------------------------------------------------
/src/Vertex.cpp:
--------------------------------------------------------------------------------
1 | // sfxObj Object. Parser and container for Starfox (1991) and possibly
2 | // other Argonaut Software models. Copyright (C) 2018 JD Fenech
3 | // (hordeking@users.noreply.github.com) based on sfxObjReader by
4 | // Stéphane Dallongeville.
5 | //
6 | // This program is free software: you can redistribute it and/or modify
7 | // it under the terms of the GNU General Public License as published by
8 | // the Free Software Foundation, either version 3 of the License, or
9 | // (at your option) any later version.
10 | //
11 | // This program is distributed in the hope that it will be useful,
12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | // GNU General Public License for more details.
15 | //
16 | // You should have received a copy of the GNU General Public License
17 | // along with this program. If not, see .
18 |
19 | #include "Vertex.h"
20 |
21 | #include
22 | using namespace std;
23 |
24 | Vertex::Vertex(): x(0), y(0), z(0), sh(false)
25 | {
26 | //ctor
27 | }
28 |
29 | Vertex::Vertex(signed int x, signed int y, signed int z, bool sh): x(x), y(y), z(z), sh(sh)
30 | {
31 | //Fancy ctor
32 | }
33 |
34 | Vertex::Vertex(const Vertex & v, bool xflip, bool yflip, bool zflip){
35 |
36 | //Copy and Mirror ctor
37 |
38 | sh = v.sh;
39 |
40 | x = xflip?(-v.x):(v.x);
41 | y = yflip?(-v.y):(v.y);
42 | z = zflip?(-v.z):(v.z);
43 |
44 | // if (xflip)
45 | // x = -v.x;
46 | // else
47 | // x = v.x;
48 |
49 | // if (yflip)
50 | // y = -v.y;
51 | // else
52 | // y = v.y;
53 |
54 |
55 | // if (zflip)
56 | // z = -v.z;
57 | // else
58 | // z = v.z;
59 |
60 | }
61 |
62 | Vertex::Vertex(BufferReader & buf, bool sh): sh(sh) {
63 |
64 | if (sh) {
65 | x = buf.nextShort();
66 | y = buf.nextShort();
67 | z = buf.nextShort();
68 | }
69 | else
70 | {
71 | x = buf.nextByte();
72 | y = buf.nextByte();
73 | z = buf.nextByte();
74 | }
75 |
76 | }
77 |
78 | //Vertex::Vertex(const Vertex& other): x(other.x), y(other.y), z(other.y), sh(other.sh)
79 | //{
80 | //copy ctor
81 | //}
82 |
83 | Vertex& Vertex::operator=(const Vertex& rhs)
84 | {
85 | if (this == &rhs) return *this; // handle self assignment
86 | //assignment operator
87 |
88 | x = rhs.x;
89 | y = rhs.y;
90 | z = rhs.z;
91 | sh = rhs.sh;
92 |
93 | return *this;
94 | }
95 |
96 | std::vector Vertex::getCoords(void){
97 | std::vector outval;
98 | outval.push_back(x);
99 | outval.push_back(y);
100 | outval.push_back(z);
101 | return outval;
102 | }
103 | bool Vertex::getCoordsType(void){
104 | return sh;
105 | }
106 | std::string Vertex::getFormattedString(){
107 | //Starfox Coords: +x-left, +z-forward
108 | return std::to_string(x) +
109 | std::string(" ") +
110 | std::to_string(y) +
111 | std::string(" ") +
112 | std::to_string(z);
113 |
114 | //Standard Coords: +x-left, +z-forward
115 | /* return std::to_string(z) +
116 | std::string(" ") +
117 | std::to_string(-x) +
118 | std::string(" ") +
119 | std::to_string(-y);
120 | */
121 | }
122 |
--------------------------------------------------------------------------------
/include/BSPTree.h:
--------------------------------------------------------------------------------
1 | // sfxObj Object. Parser and container for Starfox (1991) and possibly
2 | // other Argonaut Software models. Copyright (C) 2018 JD Fenech
3 | // (hordeking@users.noreply.github.com) based on sfxObjReader by
4 | // Stéphane Dallongeville.
5 | //
6 | // This program is free software: you can redistribute it and/or modify
7 | // it under the terms of the GNU General Public License as published by
8 | // the Free Software Foundation, either version 3 of the License, or
9 | // (at your option) any later version.
10 | //
11 | // This program is distributed in the hope that it will be useful,
12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | // GNU General Public License for more details.
15 | //
16 | // You should have received a copy of the GNU General Public License
17 | // along with this program. If not, see .
18 |
19 | #ifndef BSPTREE_H
20 | #define BSPTREE_H
21 |
22 | #include
23 | #include
24 | #include
25 |
26 | #include "BufferReader.h"
27 | #include "Face.h"
28 |
29 | class BSPTree
30 | {
31 | public:
32 | /** Default constructor */
33 | BSPTree();
34 |
35 | /** Copy Ctor */
36 | BSPTree(const BSPTree & rhs);
37 |
38 | BSPTree(BufferReader & buf);
39 |
40 | /** Default destructor */
41 | ~BSPTree();
42 |
43 | //Returns the status of the BSP Tree.
44 | bool isValid(void){
45 | // 0x28 is a little more complicated, but essentially how it works is this:
46 | // We can't call isValid() on a null pointer, and if it's null we pretty
47 | // much just return true (a termination condition), otherwise we call the
48 | // child's isValid(). Since non-leaf nodes also can be valid or not, we need
49 | // to also pass back up their validity. Thus the complicated construction.
50 | if (0x40==nodeType) return true; //Null nodes are always valid, basically deprecated since we're using null properly now.
51 | if (0x44==nodeType) return valid;
52 | if (0x28==nodeType) return (valid && (nullptr!=back?back->isValid():true) && (nullptr!=front?front->isValid():true));
53 | return false;
54 | }
55 |
56 | bool isNull(void){ return (0x40==nodeType); }
57 |
58 | std::vector getFacegroup(void) { return facegroup; }
59 | std::vector getAllFaces(void);
60 |
61 |
62 | BSPTree& operator=(const BSPTree& rhs);
63 |
64 | friend std::ostream & operator<<(std::ostream & out, const BSPTree & rhs){
65 | out << std::hex << std::setw(2) << std::setfill('0') << (unsigned int) rhs.nodeType << " ";
66 | if (0x28==rhs.nodeType) out << std::hex << std::setw(2) << std::setfill('0') << (unsigned int) rhs.splittingTriangle << " ";
67 | out << std::hex << std::setw(4) << std::setfill('0') << (unsigned int) rhs.facegroupOffset << " ";
68 | if (0x28==rhs.nodeType) out << std::hex << std::setw(2) << std::setfill('0') << (unsigned int) rhs.frontBranchOffset;
69 |
70 | if (nullptr!=rhs.back) !rhs.back->isNull()?(out << " " << *rhs.back):(out<<40);
71 | if (nullptr!=rhs.front && !rhs.front->isNull() ) (out << " " << *rhs.front);
72 |
73 | return out;}
74 |
75 | protected:
76 |
77 | std::vector facegroup;
78 |
79 | bool readFacegroup(BufferReader & buf);
80 |
81 | uint8_t nodeType = 0;
82 | uint8_t splittingTriangle = 0;
83 | size_t facegroupOffset = 0;
84 | size_t frontBranchOffset = 0;
85 | BSPTree * back = nullptr;
86 | BSPTree * front = nullptr;
87 |
88 | bool valid = false;
89 |
90 | private:
91 |
92 | template bool append(std::vector & fixedList, std::vector inList){
93 | if (&fixedList == &inList)
94 | return false;
95 |
96 | fixedList.insert( fixedList.end(), std::begin(inList), std::end(inList));
97 | return true;
98 | }
99 |
100 | };
101 |
102 | #endif // BSPTREE_H
103 |
--------------------------------------------------------------------------------
/include/SFXObject.h:
--------------------------------------------------------------------------------
1 | // sfxObj Object. Parser and container for Starfox (1991) and possibly
2 | // other Argonaut Software models. Copyright (C) 2018 JD Fenech
3 | // (hordeking@users.noreply.github.com) based on sfxObjReader by
4 | // Stéphane Dallongeville.
5 | //
6 | // This program is free software: you can redistribute it and/or modify
7 | // it under the terms of the GNU General Public License as published by
8 | // the Free Software Foundation, either version 3 of the License, or
9 | // (at your option) any later version.
10 | //
11 | // This program is distributed in the hope that it will be useful,
12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | // GNU General Public License for more details.
15 | //
16 | // You should have received a copy of the GNU General Public License
17 | // along with this program. If not, see .
18 |
19 | #ifndef SFXOBJECT_H
20 | #define SFXOBJECT_H
21 |
22 | #include
23 | #include
24 |
25 | #include "BufferReader.h"
26 | #include "Vertex.h"
27 | #include "Triangle.h"
28 | #include "BSPTree.h"
29 |
30 |
31 | class SFXObject
32 | {
33 | public:
34 |
35 | // This object will expect that data begins with proper object data
36 | // vertexAddress and faceAddress are really just holdovers from Stef's decoder, and not really necessary here.
37 | // We might use them to cross-check stuff, though.
38 | SFXObject(std::ifstream & inData, size_t vertexAddress=0, size_t facedataAddress=0);
39 | ~SFXObject(){ if (nullptr!=bspTree) delete bspTree;}
40 |
41 | // Returns the vertex list for a particular frame.
42 | std::vector getVertexList(size_t iFrame = 0) { return vertexList.at(iFrame); }
43 |
44 | // Returns the triangle list. All frames share the same polygon and triangle data.
45 | std::vector getTriangleList(void) { return triangles; }
46 |
47 | // Returns the triangle list. All frames share the same BSP Tree.
48 | BSPTree getBSPTree(void) { if (nullptr!=bspTree) return *bspTree; else throw; }
49 |
50 | // Returns the full face list. All frames share the same face list.
51 | std::vector getFaceList(void) { if (nullptr!=bspTree) return bspTree->getAllFaces(); else throw; }
52 |
53 | size_t frameCount(void) { return nFrames; }
54 |
55 | bool isValid(void);
56 |
57 | BSPTree * bspTree = nullptr;
58 |
59 | protected:
60 |
61 | BufferReader buf;
62 | size_t vertexAddress = 0;
63 | size_t facedataAddress = 0;
64 | size_t bsptreeAddress = 0;
65 | size_t facegroupsAddress = 0;
66 | bool valid = false;
67 |
68 | std::vector> vertexList;
69 | std::vector triangles;
70 |
71 | // We also need some auxilliary data from the header, like the palette and scaling. These should get passed in on creation.
72 |
73 | // We can use this to output the original object data, since we build this as we go.
74 | // This will be the original object as in the rom, not constructed from our interpretation of it.
75 | // In theory, this should be a correct object in the end, without any trailing rom data.
76 | std::stringstream rawObject_Final;
77 |
78 | // Some internal variables, for our use later
79 | // These refer to the offset from the beginning of the data lump we're given.
80 | // We'll set these as we parse through the object, saving them for later.
81 | size_t vertexArrayOffset = 0; //Always 0, only data in this lump anyway.
82 | size_t triangleArrayOffset = 0; //Always 0, first data in this lump.
83 | size_t bsptreeOffset = 0;
84 | size_t facegroupsOffset = 0;
85 |
86 | size_t nFrames = 1; // One frame by default
87 |
88 | std::vector buildVertexBloc();
89 | std::vector buildVertexSubBloc();
90 |
91 | void buildFace();
92 | void buildTriangle();
93 |
94 | private:
95 |
96 | template
97 | bool append(std::vector & fixedList, std::vector inList){
98 | if (&fixedList == &inList)
99 | return false;
100 |
101 | fixedList.insert( fixedList.end(), std::begin(inList), std::end(inList));
102 | return true;
103 | }
104 | };
105 |
106 | #endif // SFXOBJECT_H
107 |
--------------------------------------------------------------------------------
/Makefile:
--------------------------------------------------------------------------------
1 | #------------------------------------------------------------------------------#
2 | # This makefile was generated by 'cbp2make' tool rev.147 #
3 | #------------------------------------------------------------------------------#
4 |
5 |
6 | WORKDIR = `pwd`
7 |
8 | CC = gcc
9 | CXX = g++
10 | AR = ar
11 | LD = g++
12 | WINDRES = windres
13 |
14 | INC =
15 | CFLAGS = -Wall -fexceptions -std=c++17
16 | RESINC =
17 | LIBDIR =
18 | LIB =
19 | LDFLAGS =
20 |
21 | INC_DEBUG = $(INC) -Iinclude
22 | CFLAGS_DEBUG = $(CFLAGS) -g
23 | RESINC_DEBUG = $(RESINC)
24 | RCFLAGS_DEBUG = $(RCFLAGS)
25 | LIBDIR_DEBUG = $(LIBDIR)
26 | LIB_DEBUG = $(LIB)
27 | LDFLAGS_DEBUG = $(LDFLAGS)
28 | OBJDIR_DEBUG = obj/Debug
29 | DEP_DEBUG =
30 | OUT_DEBUG = bin/Debug/sfxobjdump
31 |
32 | INC_RELEASE = $(INC) -Iinclude
33 | CFLAGS_RELEASE = $(CFLAGS) -O2
34 | RESINC_RELEASE = $(RESINC)
35 | RCFLAGS_RELEASE = $(RCFLAGS)
36 | LIBDIR_RELEASE = $(LIBDIR)
37 | LIB_RELEASE = $(LIB)
38 | LDFLAGS_RELEASE = $(LDFLAGS) -s
39 | OBJDIR_RELEASE = obj/Release
40 | DEP_RELEASE =
41 | OUT_RELEASE = bin/Release/sfxobjdump
42 |
43 | OBJ_DEBUG = $(OBJDIR_DEBUG)/main.o $(OBJDIR_DEBUG)/src/BSPTree.o $(OBJDIR_DEBUG)/src/BufferReader.o $(OBJDIR_DEBUG)/src/Face.o $(OBJDIR_DEBUG)/src/Normal.o $(OBJDIR_DEBUG)/src/SFXObject.o $(OBJDIR_DEBUG)/src/Triangle.o $(OBJDIR_DEBUG)/src/Vertex.o
44 |
45 | OBJ_RELEASE = $(OBJDIR_RELEASE)/main.o $(OBJDIR_RELEASE)/src/BSPTree.o $(OBJDIR_RELEASE)/src/BufferReader.o $(OBJDIR_RELEASE)/src/Face.o $(OBJDIR_RELEASE)/src/Normal.o $(OBJDIR_RELEASE)/src/SFXObject.o $(OBJDIR_RELEASE)/src/Triangle.o $(OBJDIR_RELEASE)/src/Vertex.o
46 |
47 | all: debug release
48 |
49 | clean: clean_debug clean_release
50 |
51 | before_debug:
52 | test -d bin/Debug || mkdir -p bin/Debug
53 | test -d $(OBJDIR_DEBUG) || mkdir -p $(OBJDIR_DEBUG)
54 | test -d $(OBJDIR_DEBUG)/src || mkdir -p $(OBJDIR_DEBUG)/src
55 |
56 | after_debug:
57 |
58 | debug: before_debug out_debug after_debug
59 |
60 | out_debug: before_debug $(OBJ_DEBUG) $(DEP_DEBUG)
61 | $(LD) $(LIBDIR_DEBUG) -o $(OUT_DEBUG) $(OBJ_DEBUG) $(LDFLAGS_DEBUG) $(LIB_DEBUG)
62 |
63 | $(OBJDIR_DEBUG)/main.o: main.cpp
64 | $(CXX) $(CFLAGS_DEBUG) $(INC_DEBUG) -c main.cpp -o $(OBJDIR_DEBUG)/main.o
65 |
66 | $(OBJDIR_DEBUG)/src/BSPTree.o: src/BSPTree.cpp
67 | $(CXX) $(CFLAGS_DEBUG) $(INC_DEBUG) -c src/BSPTree.cpp -o $(OBJDIR_DEBUG)/src/BSPTree.o
68 |
69 | $(OBJDIR_DEBUG)/src/BufferReader.o: src/BufferReader.cpp
70 | $(CXX) $(CFLAGS_DEBUG) $(INC_DEBUG) -c src/BufferReader.cpp -o $(OBJDIR_DEBUG)/src/BufferReader.o
71 |
72 | $(OBJDIR_DEBUG)/src/Face.o: src/Face.cpp
73 | $(CXX) $(CFLAGS_DEBUG) $(INC_DEBUG) -c src/Face.cpp -o $(OBJDIR_DEBUG)/src/Face.o
74 |
75 | $(OBJDIR_DEBUG)/src/Normal.o: src/Normal.cpp
76 | $(CXX) $(CFLAGS_DEBUG) $(INC_DEBUG) -c src/Normal.cpp -o $(OBJDIR_DEBUG)/src/Normal.o
77 |
78 | $(OBJDIR_DEBUG)/src/SFXObject.o: src/SFXObject.cpp
79 | $(CXX) $(CFLAGS_DEBUG) $(INC_DEBUG) -c src/SFXObject.cpp -o $(OBJDIR_DEBUG)/src/SFXObject.o
80 |
81 | $(OBJDIR_DEBUG)/src/Triangle.o: src/Triangle.cpp
82 | $(CXX) $(CFLAGS_DEBUG) $(INC_DEBUG) -c src/Triangle.cpp -o $(OBJDIR_DEBUG)/src/Triangle.o
83 |
84 | $(OBJDIR_DEBUG)/src/Vertex.o: src/Vertex.cpp
85 | $(CXX) $(CFLAGS_DEBUG) $(INC_DEBUG) -c src/Vertex.cpp -o $(OBJDIR_DEBUG)/src/Vertex.o
86 |
87 | clean_debug:
88 | rm -f $(OBJ_DEBUG) $(OUT_DEBUG)
89 | rm -rf bin/Debug
90 | rm -rf $(OBJDIR_DEBUG)
91 | rm -rf $(OBJDIR_DEBUG)/src
92 |
93 | before_release:
94 | test -d bin/Release || mkdir -p bin/Release
95 | test -d $(OBJDIR_RELEASE) || mkdir -p $(OBJDIR_RELEASE)
96 | test -d $(OBJDIR_RELEASE)/src || mkdir -p $(OBJDIR_RELEASE)/src
97 |
98 | after_release:
99 |
100 | release: before_release out_release after_release
101 |
102 | out_release: before_release $(OBJ_RELEASE) $(DEP_RELEASE)
103 | $(LD) $(LIBDIR_RELEASE) -o $(OUT_RELEASE) $(OBJ_RELEASE) $(LDFLAGS_RELEASE) $(LIB_RELEASE)
104 |
105 | $(OBJDIR_RELEASE)/main.o: main.cpp
106 | $(CXX) $(CFLAGS_RELEASE) $(INC_RELEASE) -c main.cpp -o $(OBJDIR_RELEASE)/main.o
107 |
108 | $(OBJDIR_RELEASE)/src/BSPTree.o: src/BSPTree.cpp
109 | $(CXX) $(CFLAGS_RELEASE) $(INC_RELEASE) -c src/BSPTree.cpp -o $(OBJDIR_RELEASE)/src/BSPTree.o
110 |
111 | $(OBJDIR_RELEASE)/src/BufferReader.o: src/BufferReader.cpp
112 | $(CXX) $(CFLAGS_RELEASE) $(INC_RELEASE) -c src/BufferReader.cpp -o $(OBJDIR_RELEASE)/src/BufferReader.o
113 |
114 | $(OBJDIR_RELEASE)/src/Face.o: src/Face.cpp
115 | $(CXX) $(CFLAGS_RELEASE) $(INC_RELEASE) -c src/Face.cpp -o $(OBJDIR_RELEASE)/src/Face.o
116 |
117 | $(OBJDIR_RELEASE)/src/Normal.o: src/Normal.cpp
118 | $(CXX) $(CFLAGS_RELEASE) $(INC_RELEASE) -c src/Normal.cpp -o $(OBJDIR_RELEASE)/src/Normal.o
119 |
120 | $(OBJDIR_RELEASE)/src/SFXObject.o: src/SFXObject.cpp
121 | $(CXX) $(CFLAGS_RELEASE) $(INC_RELEASE) -c src/SFXObject.cpp -o $(OBJDIR_RELEASE)/src/SFXObject.o
122 |
123 | $(OBJDIR_RELEASE)/src/Triangle.o: src/Triangle.cpp
124 | $(CXX) $(CFLAGS_RELEASE) $(INC_RELEASE) -c src/Triangle.cpp -o $(OBJDIR_RELEASE)/src/Triangle.o
125 |
126 | $(OBJDIR_RELEASE)/src/Vertex.o: src/Vertex.cpp
127 | $(CXX) $(CFLAGS_RELEASE) $(INC_RELEASE) -c src/Vertex.cpp -o $(OBJDIR_RELEASE)/src/Vertex.o
128 |
129 | clean_release:
130 | rm -f $(OBJ_RELEASE) $(OUT_RELEASE)
131 | rm -rf bin/Release
132 | rm -rf $(OBJDIR_RELEASE)
133 | rm -rf $(OBJDIR_RELEASE)/src
134 |
135 | .PHONY: before_debug after_debug clean_debug before_release after_release clean_release
136 |
137 |
--------------------------------------------------------------------------------
/main.cpp:
--------------------------------------------------------------------------------
1 | // sfxObjdump. Driver program to test sfxObj object and dump
2 | // the contained model to wavefront obj. Copyright (C) 2018 JD Fenech
3 | // (hordeking@users.noreply.github.com) based on sfxObjReader by
4 | // Stéphane Dallongeville.
5 | //
6 | // This program is free software: you can redistribute it and/or modify
7 | // it under the terms of the GNU General Public License as published by
8 | // the Free Software Foundation, either version 3 of the License, or
9 | // (at your option) any later version.
10 | //
11 | // This program is distributed in the hope that it will be useful,
12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | // GNU General Public License for more details.
15 | //
16 | // You should have received a copy of the GNU General Public License
17 | // along with this program. If not, see .
18 |
19 | #include
20 |
21 | #include
22 | #include
23 | #include
24 | #include
25 | #include
26 |
27 | #include "SFXObject.h"
28 |
29 | using namespace std;
30 |
31 | void print_usage(void) {
32 | cerr << "Usage: sfxobjdump " << endl;
33 | cerr << endl;
34 | cerr << " -f Frame n only" << endl;
35 | cerr << " -b Set base filename.\n\t\t\tOutput filenames will be be in format \"Basename nn\"" << endl;
36 | cerr << " -v Verbose output" << endl;
37 | cerr << " -t Validate only." << endl;
38 | cerr << "\n\nsfxobjdump Copyright (C) 2018 JD Fenech\nThis is free software, and you are welcome to redistribute it under certain conditions;\nThis program comes with ABSOLUTELY NO WARRANTY; for details see COPYING file." << endl;
39 | cerr << endl;
40 | }
41 |
42 |
43 | int main(int argc, char * argv[])
44 | {
45 |
46 | int option = 0;
47 | size_t n = 0;
48 | bool verbose = false;
49 | bool testonly = false;
50 | bool singleframe = false;
51 | string base_filename("Model");
52 |
53 | if (argc<4) { print_usage(); return -1;}
54 |
55 | while ((option = getopt(argc, argv,"vtf:b:")) != -1) {
56 | switch (option) {
57 |
58 | case 'v' : //Verbose mode
59 | verbose = true;
60 | break;
61 |
62 | case 't' : //Validate object mode
63 | testonly = true;
64 | break;
65 |
66 | case 'b' : //List only
67 | base_filename = optarg;
68 | break;
69 |
70 | case 'f' :
71 | n = atoi(optarg);
72 | singleframe = true;
73 | break;
74 |
75 | default: print_usage();
76 | exit(EXIT_FAILURE);
77 | }
78 | }
79 |
80 | // TODO: Check that the user actually provided a filename for this.
81 | ifstream romfile(string(argv[optind]), ifstream::binary);
82 | if (!romfile.good()) { cerr << (string(argv[1]) + ": File not found, or unable to be opened.") << endl << endl; print_usage(); return -1;}
83 |
84 | // cout << stoull(string(argv[1]), nullptr, 0) << endl;
85 |
86 | SFXObject test(romfile, stoull(string(argv[optind+1]), nullptr, 0), stoull(string(argv[optind+2]), nullptr, 0));
87 |
88 | if (verbose) cerr << "This SFXObject is " << (test.isValid()?"valid.":"not valid.") << endl;
89 | if(!test.isValid()) return -1;
90 | if(testonly && test.isValid()) return 0;
91 |
92 | if (verbose) cerr << "Number of Frames: " << test.frameCount() << endl;
93 | if (verbose) cerr << "Base filename: " << base_filename << endl;
94 |
95 | /*
96 | cerr << endl << "Outputting frame " << n << " of this object in Stanford PLY format." << endl;
97 |
98 | cout << "ply" << endl << "format ascii 1.0" << endl << "element vertex " << test.getVertexList().size() << endl;
99 | cout << "property float x" << endl << "property float y" << endl << "property float z" << endl;
100 | cout << "element face " << test.getFaceList().size() << endl << "property list uchar int vertex_index" << endl;
101 | cout << "end_header" << endl;
102 |
103 | for(auto vertex: test.getVertexList(n))
104 | cout << vertex.getFormattedString() << endl;
105 |
106 | for(auto face: test.getFaceList()){
107 | cout << face.vertex.size();
108 |
109 | for(auto iVert: face.vertex) cout << " " << (unsigned int) iVert;
110 |
111 | cout << endl;
112 | }
113 | */
114 |
115 | for(;n1) out_modelname = out_modelname + "_" + ((test.frameCount()>=100&&n<100)?to_string(0):string()) + ((test.frameCount()>=10&&n<10)?to_string(0):string()) + to_string(n);
119 |
120 | ofstream outfile(out_modelname + string(".obj"));
121 |
122 | cerr << "Outputting frame " << n << " of this object in Wavefront OBJ format." << endl;
123 |
124 | outfile << "# Frame " << n << endl << endl;
125 |
126 | outfile << "o " << out_modelname << endl << endl;
127 |
128 | outfile << "# Vertex List. To convert float x' to signed 8bit x, x = floor(x'*127+.5)." << endl;
129 |
130 | for(auto vertex: test.getVertexList(n)){
131 | outfile << "v";
132 |
133 | for(auto coord: vertex.getCoords()){
134 | if (!vertex.getCoordsType())
135 | outfile << " " << coord/127.0f;
136 | else
137 | outfile << " " << coord/32767.0f;
138 | }
139 |
140 | outfile << endl;
141 | }
142 |
143 | outfile << endl << "# Normals components range from -1.0 to 1.0. To convert back to signed 8bit, x = floor(x'*127+.5)" << endl;
144 |
145 | outfile << endl << "usemtl Default" << endl;
146 |
147 | for(auto face: test.getFaceList()){
148 | //cout << face.vertex.size();
149 |
150 | float w = sqrt( face.nx*face.nx + face.ny*face.ny + face.nz*face.nz);
151 |
152 | if (0.
18 |
19 | #include "BSPTree.h"
20 |
21 | BSPTree::BSPTree(){nodeType=0x40;} //A null node has type 0x40
22 |
23 | BSPTree::BSPTree(BufferReader & buf)
24 | {
25 | //ctor
26 | nodeType = buf.getUByte();
27 |
28 | if (0x3c == nodeType) {
29 |
30 | // This just handles a potential situation where someone handed us the bsp with the start marker in it.
31 | // That should not happen in real life.
32 |
33 | // If it ever does get passed in, we should only see it once, at the very beginning.
34 | // The design of this object isn't really conducive to a keeping track of a single initial
35 | // marker.
36 |
37 | // If it does become needed for some reason to handle it, all we need to do is advance to the next byte.
38 | // For now, let's just fail.
39 | throw std::runtime_error("BSP Tree Initial Marker Found, but not handled by this object");
40 | buf.nextUByte(); // Just jump to the next byte, we'll be using that one.
41 | nodeType = buf.getUByte();
42 |
43 | }
44 |
45 | if (0x14 == nodeType) {
46 |
47 | // Not a real BSP Tree in the object. Just a facegroup.
48 | // This is meant to handle the situation where all we have is a facegroup.
49 | // If we just have a bare facegroup, then we create a single 0x44 node
50 | // and populate it with the facegroup.
51 |
52 | nodeType = 0x44; // A single node with no children
53 | facegroupOffset = 0x0000; // No jump to get to the facegroup.
54 |
55 | // If we want to serialize this thing, we can see if there's any offset at all.
56 | // If not, then we know there was really no tree to begin with.
57 | // If it turns out there really are 0x44 nodes with offset 0x0000, we'll have
58 | // to bite the bullet and add a flag to indicate this. That would get set here,
59 |
60 | // No need to seek, we should already be sitting at the beginning
61 | // of the face group.
62 | valid = readFacegroup(buf);
63 |
64 | return;
65 |
66 | }
67 |
68 | //Monarch dodora head seems to have a strange node that starts with 0x40. Is this a null node?
69 | //Moreover, do we need to handle this? Yes. See below.
70 |
71 | // Anything after this should be valid in a bsp tree, even a null node indicator.
72 | if(nodeType != 0x28 && nodeType != 0x44 && nodeType != 0x40) {
73 | throw std::runtime_error("Invalid BSP Tree Node");
74 | }
75 |
76 | buf.nextUByte(); // Advance offset by a byte, we haven't actually done that yet
77 |
78 | if (0x40 == nodeType){
79 | //This turns out to be a null child. Set it to valid and return.
80 | return;
81 | }
82 |
83 | if (nodeType == 0x28) splittingTriangle = buf.nextUByte(); // Only happens in a 0x28
84 |
85 | facegroupOffset = buf.nextShort(); // All nodes have a face group.
86 |
87 | size_t currentPosition = buf.tellg();
88 | buf.seekg(facegroupOffset-1, buf.cur); //Jump to the facegroup.
89 | valid = readFacegroup(buf); //Read in polygons
90 | buf.seekg(currentPosition, buf.beg); //Restore position as if we never left
91 |
92 | if (nodeType == 0x28) { // Only 0x28 nodes have children.
93 |
94 | frontBranchOffset = buf.nextUByte(); //Once we have this, we're actually at the left node now, and we can suck that node right in.
95 |
96 | //Allocate children.
97 |
98 | // Back child. This is the left branch. Always follows immediately in flat data.
99 | // Peek at the next node just to see if se should create it. If the node begins
100 | // with 0x40, it's actually a null node. Don't even fool with it.
101 | if (0x40!=buf.getUByte()){
102 | back = new BSPTree(buf); // Create branch
103 | }
104 | else {
105 | buf.nextUByte(); // Waste byte
106 | }
107 |
108 | //Front child. This is the right branch. Our node will have an offset that points at it.
109 | // We don't even need to seekg to it with the buffer, as once we process each back branch, we can move on to the front branch.
110 | // The front branch offset is more for direct traversal in live code, an efficiency which we don't actually need here.
111 | if (frontBranchOffset!=0x0000){
112 | front = new BSPTree(buf);
113 | }
114 | else {
115 | // Explicitly handle the potential situation where we have a null front/right child
116 | // Turns out this happens.
117 | //front = new BSPTree(); //Default ctor creates a null child.
118 | // Do nothing.
119 | }
120 | }
121 |
122 | return;
123 | }
124 |
125 | bool BSPTree::readFacegroup(BufferReader & buf){
126 |
127 | if(0x14==buf.nextUByte()){ //Face group start marker 0x14. Better have one.
128 | //std::cerr << "Valid face group marker at " << std::hex << size_t(buf.tellg())-1 << std::endl;
129 | }
130 | else {
131 | //std::cerr << "Invalid face group marker at " << std::hex << (int) (buf.tellg()-1) << std::endl;
132 | //throw std::runtime_error("Invalid face group marker.");
133 | return false;
134 | }
135 |
136 | while (0xFE > buf.getUByte() && buf.good() ){
137 |
138 | Face myPolygon;
139 |
140 | myPolygon.nVerts = buf.nextUByte(); //nVerts;
141 | myPolygon.faceID = buf.nextUByte();
142 | myPolygon.color = buf.nextUByte();
143 | myPolygon.nx = buf.nextByte();
144 | myPolygon.ny = buf.nextByte();
145 | myPolygon.nz = buf.nextByte();
146 |
147 | for(size_t i = 0; i BSPTree::getAllFaces(void) {
229 |
230 | std::vector tempFacegroup = facegroup;
231 |
232 | if (nullptr!=back) append(tempFacegroup, back->getAllFaces());
233 | if (nullptr!=front) append(tempFacegroup, front->getAllFaces());
234 | return tempFacegroup;
235 |
236 | }
237 |
--------------------------------------------------------------------------------
/src/SFXObject.cpp:
--------------------------------------------------------------------------------
1 | // sfxObj Object. Parser and container for Starfox (1991) and possibly
2 | // other Argonaut Software models. Copyright (C) 2018 JD Fenech
3 | // (hordeking@users.noreply.github.com) based on sfxObjReader by
4 | // Stéphane Dallongeville.
5 | //
6 | // This program is free software: you can redistribute it and/or modify
7 | // it under the terms of the GNU General Public License as published by
8 | // the Free Software Foundation, either version 3 of the License, or
9 | // (at your option) any later version.
10 | //
11 | // This program is distributed in the hope that it will be useful,
12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | // GNU General Public License for more details.
15 | //
16 | // You should have received a copy of the GNU General Public License
17 | // along with this program. If not, see .
18 |
19 | #include
20 | #include
21 |
22 | #include "SFXObject.h"
23 |
24 | SFXObject::SFXObject(std::ifstream & inData, size_t vertexAddress, size_t facedataAddress): buf(inData), vertexAddress(vertexAddress), facedataAddress(facedataAddress)
25 | {
26 |
27 | //Start by sucking in those vertices
28 |
29 | //std::vector> vertexAll;
30 | std::vector vertexFrame;
31 |
32 | buf.seekg(vertexAddress);
33 |
34 | size_t iFrame = 0;
35 |
36 | while ( (iFrame < nFrames) && buf.good() )
37 | {
38 | // add vertex bloc
39 | append(vertexFrame, buildVertexBloc() );
40 |
41 | uint8_t listType = buf.nextUByte();
42 |
43 | switch (listType)
44 | {
45 | case 0x0C: // end vertex list --> We will go to the next frame
46 | vertexList.push_back(vertexFrame);
47 | iFrame++;
48 | //This is intended to reset the buffer to the beginning of the object. We'll do a seekg with the vertex address to get this.
49 | buf.seekg(vertexAddress, buf.beg); //buf = new BufferReader(buf, 0);
50 | vertexFrame.clear(); //Clear vertexFrame so we can use it again.
51 | break;
52 |
53 | case 0x20: // jump marker
54 | //Jump to end of animated vertex list
55 | buf.seekg(buf.nextShort() -1 , buf.cur); //buf.offset += buf.nextUShort() + 1;
56 | break;
57 |
58 | case 0x1C: // animated vertex list --> update frame number
59 | nFrames = buf.nextUByte();
60 |
61 | // go to frame offset
62 | buf.seekg(iFrame*2, buf.cur); //buf.offset += iFrame * 2;
63 |
64 | // jump to offset for vertex
65 | buf.seekg(buf.nextShort() - 1, buf.cur); //buf.offset += buf.nextUShort() + 1;
66 | //std::cerr << "Animated Frame " << iFrame << std::endl;
67 | break;
68 |
69 | default:
70 | // unknown
71 | std::cerr << std::hex << std::setfill('0');
72 | std::cerr << "In Frame " << (int) iFrame << ", Unknown vertex list type 0x" << std::setw(2) << (int)listType << " at address 0x" << std::setw(8) << (unsigned int)buf.tellg()-1 << std::endl;
73 | std::cerr << std::setw(0) << std::setfill(' ') << std::dec;
74 | valid = false;
75 | return; //Return empty vector if failure.
76 |
77 | }
78 |
79 | }
80 |
81 | if (vertexList.size() <= 0) return; //If for some reason we wound up with no frames, then it isn't valid and don't even bother continuing.
82 |
83 | // We need to make sure each frame has the same number of elements.
84 | for(auto it = vertexList.begin(); it!=vertexList.end(); ++it){
85 |
86 | if ( vertexList.end()==(it+1) ) break;
87 |
88 | // If we're here, then we should be able to compare. Essentially we're doing a O(n) comparison of a[n] =? a[n+1]
89 | // Assuming that if any differ at all, we exit immediately. if they're all the same, then each one should be
90 | // equal to the previous, and they should all be equal to each other. Essentially, if A = B, and B = C, then A = C.
91 | // Conversely, if A != B, and B = C, then A != C, and we kick out immediately.
92 |
93 | //This looks a little wierd, because we have to dereference the iterators once we have the,
94 | if ((*it).size() != (*(it+1)).size() ) return; //If they aren't equal in size, then something is wrong.
95 | }
96 |
97 | // Probably not strictly required, but since the header can specify an address for the face-data,
98 | // we'll use that. Do any objects have face-triangle data that doesn't immediately follow the
99 | // vertex list?
100 | // YES. Strictly required. More objects need this than not. Some objects such as billboards do reuse vertex data,
101 | // while using their own face data. Since the face colors and textures are defined by the polygons in the face
102 | // groups, each facedata section is unique to that object, while the vertex data might be shared among many objects
103 | // that have the same shape such as asteroids, flat objects intended to display a texture, and ship reskins/repaints.
104 | buf.seekg(facedataAddress, buf.beg);
105 |
106 | uint8_t listType = buf.nextUByte();
107 |
108 | // is there a triangle list? Probably should not be optional.
109 | if (listType == 0x30)
110 | {
111 | const size_t nTriangles = buf.nextUByte();
112 |
113 | triangles.reserve(nTriangles);
114 |
115 | for (size_t i = 0; i < nTriangles; i++){
116 | const uint8_t tri_1 = buf.nextUByte(), tri_2 = buf.nextUByte(), tri_3 = buf.nextUByte();
117 | triangles.push_back(Triangle(tri_1, tri_2, tri_3));
118 | }
119 |
120 | // get next list type
121 | listType = buf.nextUByte();
122 | }
123 |
124 | /*
125 |
126 | // This is the model data for the Andross Square [ID: AC4D] (the comm sprite, or the one seen in the boss fight?)
127 | // It's interesting because it has no bsp tree, but it does have a face group.
128 | // This is probably more common when the object is flat (all vertices in the same plane) or isn't really splittable.
129 |
130 | // To be determined: If the object has one face group, the original object doesn't have a bsp tree. We can unify our
131 | // interface by simply creating a tree with node type 0x44 and creating the pointers to the face group. This might be
132 | // a little wierd if we ever try to push it back into code, but we can always try to do the reverse operation if our
133 | // tree only has the one node.
134 |
135 | // Is it possible for an object to have two face groups? A single-level bsp tree can do one group, and a two-level
136 | // can accomodate three group. Two groups might be done without using a tree at all?
137 |
138 | // This is the vertex list at 0x8f26a. All vertices are coplanar.
139 | // This particular vertex list is shared by several different objects.
140 | 38 02 64 64 00 9C 9C 00 0C
141 |
142 | // This is the face data at 0x8f282
143 | 30 02 // Two triangles
144 | 02 03 00 // Neither of which use vertex 01.
145 | 00 03 02 // It does get used in the face group polys (the real polygon list)
146 |
147 | // One face group with two faces, but no bsp tree. Probably common for much simpler objects such as billboard objects.
148 | 14
149 | 04 00 00 00 00 7F 02 03 00 01 // This is the front side, note the normal here is positive 0,0,127 and the vertex order
150 | 04 01 01 00 00 81 01 00 03 02 // This one is the back side. Normal is 0,0-127 with a vertex order exactly reversed
151 | FE 00
152 |
153 | */
154 |
155 | // is there a BSP Tree ?
156 | if (0x3C == listType)
157 | {
158 | bsptreeAddress = size_t(buf.tellg())-1;
159 | bsptreeOffset = bsptreeAddress - facedataAddress;
160 |
161 | bspTree = new BSPTree(buf);
162 |
163 | if( nullptr!=bspTree && !bspTree->isValid() ) return;
164 |
165 | // We've already read them in, but once we finish the bsp tree, the
166 | // buffer should be ppointed at the first byte of the first facegroup.
167 | facegroupsAddress = size_t(buf.tellg());
168 | facegroupsOffset = facegroupsAddress - facedataAddress;
169 |
170 | //If we got to this point, and the BSP Tree is valid, then the object is valid.
171 | valid = true;
172 |
173 | // Why do we return here instead of reading more? Easy, because if we have a
174 | // bsp tree, we've already read all of the face groups. If something went
175 | // wrong, we can handle it with the BSP tree.
176 |
177 | return;
178 | }
179 |
180 |
181 | // face group ?
182 | // Do we need to check this if we didn't have a bsp tree? YES!
183 | // Can we have facegroups without a bsp tree? YES! ABSOLUTELY!
184 |
185 | // I suspect that if we don't have a bsp tree, then we only wind up with one
186 | // face group in all cases. There are three face data lumps that are a little
187 | // strange. These are at 0x8f22d, 0x8f2c0, & 0x8f2ca
188 |
189 | //For the moment, if we got here, assume that our object is perfectly valid
190 | if (0x14==listType){
191 | buf.seekg(-1, buf.cur); //Reset the position back one, so that we also bring in the 0x14
192 | facegroupsAddress = size_t(buf.tellg());
193 | facegroupsOffset = facegroupsAddress - facedataAddress;
194 | bsptreeOffset = -1;
195 | if (nullptr==bspTree){ // Only do this if we don't already have a bsp tree.
196 | bspTree = new BSPTree(buf);
197 | if (nullptr!=bspTree) valid = bspTree->isValid();
198 | }
199 | }
200 |
201 |
202 | return;
203 |
204 | }
205 |
206 | std::vector SFXObject::buildVertexBloc()
207 | {
208 | std::vector result;
209 |
210 | while (true)
211 | {
212 | uint8_t listType = buf.getUByte(); // Peek at next byte
213 |
214 | switch (listType)
215 | {
216 | case 0x04: // pointsb
217 | case 0x08: // pointsw
218 | case 0x34: // pointsxw
219 | case 0x38: // pointsxb
220 | // add vertex bloc to result
221 | append(result, buildVertexSubBloc() );
222 | break;
223 |
224 | case 0x0C:
225 | // end vertex list
226 | case 0x20:
227 | // 16 bits offset jump
228 | case 0x1C:
229 | // animated vertex list (handled in parent)
230 | return result;
231 |
232 | default:
233 | // unknown
234 | std::cerr << std::hex << std::setfill('0');
235 | std::cerr << "Unknown vertex list type 0x" << std::setw(2) << (int) listType << " at address 0x" << std::setw(8) << (unsigned int)buf.tellg() << std::endl;
236 | std::cerr << std::setw(0) << std::setfill(' ') << std::dec;
237 | valid = false;
238 | exit(-1);
239 | return result;
240 | }
241 | }
242 |
243 | }
244 |
245 |
246 | std::vector SFXObject::buildVertexSubBloc()
247 | {
248 | bool xflip = false;
249 | bool yflip = false;
250 | bool sh = false;
251 |
252 | int listType = buf.nextUByte();
253 | //std::cerr << "List Type: " << listType << std::endl;
254 |
255 | switch (listType)
256 | {
257 | case 0x04:
258 | // normal vertex list
259 | break;
260 |
261 | case 0x08:
262 | // 16 bits vertex list
263 | sh = true;
264 | break;
265 |
266 | case 0x34:
267 | // 16 bits + X flip vertex list
268 | xflip = true;
269 | sh = true;
270 | break;
271 |
272 | case 0x38:
273 | // X flip vertex list
274 | xflip = true;
275 | break;
276 | }
277 |
278 | std::vector result;
279 | size_t num = buf.nextUByte(); // How many vertices to read in
280 |
281 | //std::cerr << num << " vertices in this subblock." << std::endl;
282 |
283 | for (size_t i = 0; i < num; i++)
284 | {
285 | Vertex v(buf, sh);
286 |
287 | result.push_back(v);
288 |
289 | if (xflip)
290 | result.push_back(Vertex(v, true, false, false));
291 | if (yflip)
292 | result.push_back(Vertex(v, false, true, false));
293 | }
294 |
295 | return result;
296 | }
297 |
298 | void SFXObject::buildFace()
299 | {
300 | /*
301 | if (buf.offset >= buf.buffer.length)
302 | {
303 | System.err.println("Face data address incorrect : " + Integer.toHexString(buf.offset));
304 | valid = false;
305 | return;
306 | }
307 |
308 | List faceGroupList = new ArrayList();
309 |
310 | int listType = buf.nextUByte();
311 |
312 | // is there a triangle list ?
313 | if (listType == 0x30)
314 | {
315 | triangles = new Triangle[buf.nextUByte()];
316 | for (int i = 0; i < triangles.length; i++)
317 | triangles[i] = new Triangle(buf);
318 |
319 | // get next list type
320 | listType = buf.nextUByte();
321 | }
322 |
323 | // is there a BSP Tree ?
324 | if (listType == 0x3C)
325 | {
326 | bspTree = new BSPTree(null, buf, triangles, faceGroups);
327 | buf.offset += bspTree.getTotalSize() - bspTree.size;
328 |
329 | // get next list type
330 | listType = buf.nextUByte();
331 | }
332 |
333 | // face group ?
334 | while (listType == 0x14)
335 | {
336 | faceGroupList.add(new FaceGroup(buf));
337 |
338 | // get next list type
339 | listType = buf.nextUByte();
340 | }
341 |
342 | if (faceGroupList.size() == 0x00)
343 | {
344 | System.err.println("No facegroup found !");
345 | valid = false;
346 | }
347 |
348 | faceGroups = faceGroupList.toArray(new FaceGroup[faceGroupList.size()]);
349 |
350 | // link facegroup address to facegroup object in BSP tree
351 | if (bspTree != null)
352 | bspTree.setFaceGroup(faceGroups);
353 |
354 | if (listType != 0x00)
355 | {
356 | System.err.println("00 end mark expected but " + Integer.toHexString(listType) + " found !");
357 | valid = false;
358 | }
359 | */
360 | }
361 |
362 | bool SFXObject::isValid(void) {
363 |
364 | /*if (nullptr!=bspTree) {
365 | return valid&&bspTree->isValid();
366 | }
367 | return false;
368 | */
369 | return valid;
370 |
371 | }
372 |
373 | void SFXObject::buildTriangle()
374 | {
375 | /*
376 | triangles = new Triangle[buf.nextUByte()];
377 | for (int i = 0; i < triangles.length; i++)
378 | triangles[i] = new Triangle(buf);
379 | */
380 | }
381 |
--------------------------------------------------------------------------------
/COPYING:
--------------------------------------------------------------------------------
1 | # GNU GENERAL PUBLIC LICENSE
2 | Version 3, 29 June 2007
3 |
4 | Copyright (C) 2007 [Free Software Foundation, Inc.](http://fsf.org/)
5 |
6 | Everyone is permitted to copy and distribute verbatim copies of this license
7 | document, but changing it is not allowed.
8 |
9 | ## Preamble
10 |
11 | The GNU General Public License is a free, copyleft license for software and
12 | other kinds of works.
13 |
14 | The licenses for most software and other practical works are designed to take
15 | away your freedom to share and change the works. By contrast, the GNU General
16 | Public License is intended to guarantee your freedom to share and change all
17 | versions of a program--to make sure it remains free software for all its users.
18 | We, the Free Software Foundation, use the GNU General Public License for most
19 | of our software; it applies also to any other work released this way by its
20 | authors. You can apply it to your programs, too.
21 |
22 | When we speak of free software, we are referring to freedom, not price. Our
23 | General Public Licenses are designed to make sure that you have the freedom to
24 | distribute copies of free software (and charge for them if you wish), that you
25 | receive source code or can get it if you want it, that you can change the
26 | software or use pieces of it in new free programs, and that you know you can do
27 | these things.
28 |
29 | To protect your rights, we need to prevent others from denying you these rights
30 | or asking you to surrender the rights. Therefore, you have certain
31 | responsibilities if you distribute copies of the software, or if you modify it:
32 | responsibilities to respect the freedom of others.
33 |
34 | For example, if you distribute copies of such a program, whether gratis or for
35 | a fee, you must pass on to the recipients the same freedoms that you received.
36 | You must make sure that they, too, receive or can get the source code. And you
37 | must show them these terms so they know their rights.
38 |
39 | Developers that use the GNU GPL protect your rights with two steps:
40 |
41 | 1. assert copyright on the software, and
42 | 2. offer you this License giving you legal permission to copy, distribute
43 | and/or modify it.
44 |
45 | For the developers' and authors' protection, the GPL clearly explains that
46 | there is no warranty for this free software. For both users' and authors' sake,
47 | the GPL requires that modified versions be marked as changed, so that their
48 | problems will not be attributed erroneously to authors of previous versions.
49 |
50 | Some devices are designed to deny users access to install or run modified
51 | versions of the software inside them, although the manufacturer can do so. This
52 | is fundamentally incompatible with the aim of protecting users' freedom to
53 | change the software. The systematic pattern of such abuse occurs in the area of
54 | products for individuals to use, which is precisely where it is most
55 | unacceptable. Therefore, we have designed this version of the GPL to prohibit
56 | the practice for those products. If such problems arise substantially in other
57 | domains, we stand ready to extend this provision to those domains in future
58 | versions of the GPL, as needed to protect the freedom of users.
59 |
60 | Finally, every program is threatened constantly by software patents. States
61 | should not allow patents to restrict development and use of software on
62 | general-purpose computers, but in those that do, we wish to avoid the special
63 | danger that patents applied to a free program could make it effectively
64 | proprietary. To prevent this, the GPL assures that patents cannot be used to
65 | render the program non-free.
66 |
67 | The precise terms and conditions for copying, distribution and modification
68 | follow.
69 |
70 | ## TERMS AND CONDITIONS
71 |
72 | ### 0. Definitions.
73 |
74 | *This License* refers to version 3 of the GNU General Public License.
75 |
76 | *Copyright* also means copyright-like laws that apply to other kinds of works,
77 | such as semiconductor masks.
78 |
79 | *The Program* refers to any copyrightable work licensed under this License.
80 | Each licensee is addressed as *you*. *Licensees* and *recipients* may be
81 | individuals or organizations.
82 |
83 | To *modify* a work means to copy from or adapt all or part of the work in a
84 | fashion requiring copyright permission, other than the making of an exact copy.
85 | The resulting work is called a *modified version* of the earlier work or a work
86 | *based on* the earlier work.
87 |
88 | A *covered work* means either the unmodified Program or a work based on the
89 | Program.
90 |
91 | To *propagate* a work means to do anything with it that, without permission,
92 | would make you directly or secondarily liable for infringement under applicable
93 | copyright law, except executing it on a computer or modifying a private copy.
94 | Propagation includes copying, distribution (with or without modification),
95 | making available to the public, and in some countries other activities as well.
96 |
97 | To *convey* a work means any kind of propagation that enables other parties to
98 | make or receive copies. Mere interaction with a user through a computer
99 | network, with no transfer of a copy, is not conveying.
100 |
101 | An interactive user interface displays *Appropriate Legal Notices* to the
102 | extent that it includes a convenient and prominently visible feature that
103 |
104 | 1. displays an appropriate copyright notice, and
105 | 2. tells the user that there is no warranty for the work (except to the
106 | extent that warranties are provided), that licensees may convey the work
107 | under this License, and how to view a copy of this License.
108 |
109 | If the interface presents a list of user commands or options, such as a menu, a
110 | prominent item in the list meets this criterion.
111 |
112 | ### 1. Source Code.
113 |
114 | The *source code* for a work means the preferred form of the work for making
115 | modifications to it. *Object code* means any non-source form of a work.
116 |
117 | A *Standard Interface* means an interface that either is an official standard
118 | defined by a recognized standards body, or, in the case of interfaces specified
119 | for a particular programming language, one that is widely used among developers
120 | working in that language.
121 |
122 | The *System Libraries* of an executable work include anything, other than the
123 | work as a whole, that (a) is included in the normal form of packaging a Major
124 | Component, but which is not part of that Major Component, and (b) serves only
125 | to enable use of the work with that Major Component, or to implement a Standard
126 | Interface for which an implementation is available to the public in source code
127 | form. A *Major Component*, in this context, means a major essential component
128 | (kernel, window system, and so on) of the specific operating system (if any) on
129 | which the executable work runs, or a compiler used to produce the work, or an
130 | object code interpreter used to run it.
131 |
132 | The *Corresponding Source* for a work in object code form means all the source
133 | code needed to generate, install, and (for an executable work) run the object
134 | code and to modify the work, including scripts to control those activities.
135 | However, it does not include the work's System Libraries, or general-purpose
136 | tools or generally available free programs which are used unmodified in
137 | performing those activities but which are not part of the work. For example,
138 | Corresponding Source includes interface definition files associated with source
139 | files for the work, and the source code for shared libraries and dynamically
140 | linked subprograms that the work is specifically designed to require, such as
141 | by intimate data communication or control flow between those subprograms and
142 | other parts of the work.
143 |
144 | The Corresponding Source need not include anything that users can regenerate
145 | automatically from other parts of the Corresponding Source.
146 |
147 | The Corresponding Source for a work in source code form is that same work.
148 |
149 | ### 2. Basic Permissions.
150 |
151 | All rights granted under this License are granted for the term of copyright on
152 | the Program, and are irrevocable provided the stated conditions are met. This
153 | License explicitly affirms your unlimited permission to run the unmodified
154 | Program. The output from running a covered work is covered by this License only
155 | if the output, given its content, constitutes a covered work. This License
156 | acknowledges your rights of fair use or other equivalent, as provided by
157 | copyright law.
158 |
159 | You may make, run and propagate covered works that you do not convey, without
160 | conditions so long as your license otherwise remains in force. You may convey
161 | covered works to others for the sole purpose of having them make modifications
162 | exclusively for you, or provide you with facilities for running those works,
163 | provided that you comply with the terms of this License in conveying all
164 | material for which you do not control copyright. Those thus making or running
165 | the covered works for you must do so exclusively on your behalf, under your
166 | direction and control, on terms that prohibit them from making any copies of
167 | your copyrighted material outside their relationship with you.
168 |
169 | Conveying under any other circumstances is permitted solely under the
170 | conditions stated below. Sublicensing is not allowed; section 10 makes it
171 | unnecessary.
172 |
173 | ### 3. Protecting Users' Legal Rights From Anti-Circumvention Law.
174 |
175 | No covered work shall be deemed part of an effective technological measure
176 | under any applicable law fulfilling obligations under article 11 of the WIPO
177 | copyright treaty adopted on 20 December 1996, or similar laws prohibiting or
178 | restricting circumvention of such measures.
179 |
180 | When you convey a covered work, you waive any legal power to forbid
181 | circumvention of technological measures to the extent such circumvention is
182 | effected by exercising rights under this License with respect to the covered
183 | work, and you disclaim any intention to limit operation or modification of the
184 | work as a means of enforcing, against the work's users, your or third parties'
185 | legal rights to forbid circumvention of technological measures.
186 |
187 | ### 4. Conveying Verbatim Copies.
188 |
189 | You may convey verbatim copies of the Program's source code as you receive it,
190 | in any medium, provided that you conspicuously and appropriately publish on
191 | each copy an appropriate copyright notice; keep intact all notices stating that
192 | this License and any non-permissive terms added in accord with section 7 apply
193 | to the code; keep intact all notices of the absence of any warranty; and give
194 | all recipients a copy of this License along with the Program.
195 |
196 | You may charge any price or no price for each copy that you convey, and you may
197 | offer support or warranty protection for a fee.
198 |
199 | ### 5. Conveying Modified Source Versions.
200 |
201 | You may convey a work based on the Program, or the modifications to produce it
202 | from the Program, in the form of source code under the terms of section 4,
203 | provided that you also meet all of these conditions:
204 |
205 | - a) The work must carry prominent notices stating that you modified it, and
206 | giving a relevant date.
207 | - b) The work must carry prominent notices stating that it is released under
208 | this License and any conditions added under section 7. This requirement
209 | modifies the requirement in section 4 to *keep intact all notices*.
210 | - c) You must license the entire work, as a whole, under this License to
211 | anyone who comes into possession of a copy. This License will therefore
212 | apply, along with any applicable section 7 additional terms, to the whole
213 | of the work, and all its parts, regardless of how they are packaged. This
214 | License gives no permission to license the work in any other way, but it
215 | does not invalidate such permission if you have separately received it.
216 | - d) If the work has interactive user interfaces, each must display
217 | Appropriate Legal Notices; however, if the Program has interactive
218 | interfaces that do not display Appropriate Legal Notices, your work need
219 | not make them do so.
220 |
221 | A compilation of a covered work with other separate and independent works,
222 | which are not by their nature extensions of the covered work, and which are not
223 | combined with it such as to form a larger program, in or on a volume of a
224 | storage or distribution medium, is called an *aggregate* if the compilation and
225 | its resulting copyright are not used to limit the access or legal rights of the
226 | compilation's users beyond what the individual works permit. Inclusion of a
227 | covered work in an aggregate does not cause this License to apply to the other
228 | parts of the aggregate.
229 |
230 | ### 6. Conveying Non-Source Forms.
231 |
232 | You may convey a covered work in object code form under the terms of sections 4
233 | and 5, provided that you also convey the machine-readable Corresponding Source
234 | under the terms of this License, in one of these ways:
235 |
236 | - a) Convey the object code in, or embodied in, a physical product (including
237 | a physical distribution medium), accompanied by the Corresponding Source
238 | fixed on a durable physical medium customarily used for software
239 | interchange.
240 | - b) Convey the object code in, or embodied in, a physical product (including
241 | a physical distribution medium), accompanied by a written offer, valid for
242 | at least three years and valid for as long as you offer spare parts or
243 | customer support for that product model, to give anyone who possesses the
244 | object code either
245 | 1. a copy of the Corresponding Source for all the software in the product
246 | that is covered by this License, on a durable physical medium
247 | customarily used for software interchange, for a price no more than your
248 | reasonable cost of physically performing this conveying of source, or
249 | 2. access to copy the Corresponding Source from a network server at no
250 | charge.
251 | - c) Convey individual copies of the object code with a copy of the written
252 | offer to provide the Corresponding Source. This alternative is allowed only
253 | occasionally and noncommercially, and only if you received the object code
254 | with such an offer, in accord with subsection 6b.
255 | - d) Convey the object code by offering access from a designated place
256 | (gratis or for a charge), and offer equivalent access to the Corresponding
257 | Source in the same way through the same place at no further charge. You
258 | need not require recipients to copy the Corresponding Source along with the
259 | object code. If the place to copy the object code is a network server, the
260 | Corresponding Source may be on a different server operated by you or a
261 | third party) that supports equivalent copying facilities, provided you
262 | maintain clear directions next to the object code saying where to find the
263 | Corresponding Source. Regardless of what server hosts the Corresponding
264 | Source, you remain obligated to ensure that it is available for as long as
265 | needed to satisfy these requirements.
266 | - e) Convey the object code using peer-to-peer transmission, provided you
267 | inform other peers where the object code and Corresponding Source of the
268 | work are being offered to the general public at no charge under subsection
269 | 6d.
270 |
271 | A separable portion of the object code, whose source code is excluded from the
272 | Corresponding Source as a System Library, need not be included in conveying the
273 | object code work.
274 |
275 | A *User Product* is either
276 |
277 | 1. a *consumer product*, which means any tangible personal property which is
278 | normally used for personal, family, or household purposes, or
279 | 2. anything designed or sold for incorporation into a dwelling.
280 |
281 | In determining whether a product is a consumer product, doubtful cases shall be
282 | resolved in favor of coverage. For a particular product received by a
283 | particular user, *normally used* refers to a typical or common use of that
284 | class of product, regardless of the status of the particular user or of the way
285 | in which the particular user actually uses, or expects or is expected to use,
286 | the product. A product is a consumer product regardless of whether the product
287 | has substantial commercial, industrial or non-consumer uses, unless such uses
288 | represent the only significant mode of use of the product.
289 |
290 | *Installation Information* for a User Product means any methods, procedures,
291 | authorization keys, or other information required to install and execute
292 | modified versions of a covered work in that User Product from a modified
293 | version of its Corresponding Source. The information must suffice to ensure
294 | that the continued functioning of the modified object code is in no case
295 | prevented or interfered with solely because modification has been made.
296 |
297 | If you convey an object code work under this section in, or with, or
298 | specifically for use in, a User Product, and the conveying occurs as part of a
299 | transaction in which the right of possession and use of the User Product is
300 | transferred to the recipient in perpetuity or for a fixed term (regardless of
301 | how the transaction is characterized), the Corresponding Source conveyed under
302 | this section must be accompanied by the Installation Information. But this
303 | requirement does not apply if neither you nor any third party retains the
304 | ability to install modified object code on the User Product (for example, the
305 | work has been installed in ROM).
306 |
307 | The requirement to provide Installation Information does not include a
308 | requirement to continue to provide support service, warranty, or updates for a
309 | work that has been modified or installed by the recipient, or for the User
310 | Product in which it has been modified or installed. Access to a network may be
311 | denied when the modification itself materially and adversely affects the
312 | operation of the network or violates the rules and protocols for communication
313 | across the network.
314 |
315 | Corresponding Source conveyed, and Installation Information provided, in accord
316 | with this section must be in a format that is publicly documented (and with an
317 | implementation available to the public in source code form), and must require
318 | no special password or key for unpacking, reading or copying.
319 |
320 | ### 7. Additional Terms.
321 |
322 | *Additional permissions* are terms that supplement the terms of this License by
323 | making exceptions from one or more of its conditions. Additional permissions
324 | that are applicable to the entire Program shall be treated as though they were
325 | included in this License, to the extent that they are valid under applicable
326 | law. If additional permissions apply only to part of the Program, that part may
327 | be used separately under those permissions, but the entire Program remains
328 | governed by this License without regard to the additional permissions.
329 |
330 | When you convey a copy of a covered work, you may at your option remove any
331 | additional permissions from that copy, or from any part of it. (Additional
332 | permissions may be written to require their own removal in certain cases when
333 | you modify the work.) You may place additional permissions on material, added
334 | by you to a covered work, for which you have or can give appropriate copyright
335 | permission.
336 |
337 | Notwithstanding any other provision of this License, for material you add to a
338 | covered work, you may (if authorized by the copyright holders of that material)
339 | supplement the terms of this License with terms:
340 |
341 | - a) Disclaiming warranty or limiting liability differently from the terms of
342 | sections 15 and 16 of this License; or
343 | - b) Requiring preservation of specified reasonable legal notices or author
344 | attributions in that material or in the Appropriate Legal Notices displayed
345 | by works containing it; or
346 | - c) Prohibiting misrepresentation of the origin of that material, or
347 | requiring that modified versions of such material be marked in reasonable
348 | ways as different from the original version; or
349 | - d) Limiting the use for publicity purposes of names of licensors or authors
350 | of the material; or
351 | - e) Declining to grant rights under trademark law for use of some trade
352 | names, trademarks, or service marks; or
353 | - f) Requiring indemnification of licensors and authors of that material by
354 | anyone who conveys the material (or modified versions of it) with
355 | contractual assumptions of liability to the recipient, for any liability
356 | that these contractual assumptions directly impose on those licensors and
357 | authors.
358 |
359 | All other non-permissive additional terms are considered *further restrictions*
360 | within the meaning of section 10. If the Program as you received it, or any
361 | part of it, contains a notice stating that it is governed by this License along
362 | with a term that is a further restriction, you may remove that term. If a
363 | license document contains a further restriction but permits relicensing or
364 | conveying under this License, you may add to a covered work material governed
365 | by the terms of that license document, provided that the further restriction
366 | does not survive such relicensing or conveying.
367 |
368 | If you add terms to a covered work in accord with this section, you must place,
369 | in the relevant source files, a statement of the additional terms that apply to
370 | those files, or a notice indicating where to find the applicable terms.
371 |
372 | Additional terms, permissive or non-permissive, may be stated in the form of a
373 | separately written license, or stated as exceptions; the above requirements
374 | apply either way.
375 |
376 | ### 8. Termination.
377 |
378 | You may not propagate or modify a covered work except as expressly provided
379 | under this License. Any attempt otherwise to propagate or modify it is void,
380 | and will automatically terminate your rights under this License (including any
381 | patent licenses granted under the third paragraph of section 11).
382 |
383 | However, if you cease all violation of this License, then your license from a
384 | particular copyright holder is reinstated
385 |
386 | - a) provisionally, unless and until the copyright holder explicitly and
387 | finally terminates your license, and
388 | - b) permanently, if the copyright holder fails to notify you of the
389 | violation by some reasonable means prior to 60 days after the cessation.
390 |
391 | Moreover, your license from a particular copyright holder is reinstated
392 | permanently if the copyright holder notifies you of the violation by some
393 | reasonable means, this is the first time you have received notice of violation
394 | of this License (for any work) from that copyright holder, and you cure the
395 | violation prior to 30 days after your receipt of the notice.
396 |
397 | Termination of your rights under this section does not terminate the licenses
398 | of parties who have received copies or rights from you under this License. If
399 | your rights have been terminated and not permanently reinstated, you do not
400 | qualify to receive new licenses for the same material under section 10.
401 |
402 | ### 9. Acceptance Not Required for Having Copies.
403 |
404 | You are not required to accept this License in order to receive or run a copy
405 | of the Program. Ancillary propagation of a covered work occurring solely as a
406 | consequence of using peer-to-peer transmission to receive a copy likewise does
407 | not require acceptance. However, nothing other than this License grants you
408 | permission to propagate or modify any covered work. These actions infringe
409 | copyright if you do not accept this License. Therefore, by modifying or
410 | propagating a covered work, you indicate your acceptance of this License to do
411 | so.
412 |
413 | ### 10. Automatic Licensing of Downstream Recipients.
414 |
415 | Each time you convey a covered work, the recipient automatically receives a
416 | license from the original licensors, to run, modify and propagate that work,
417 | subject to this License. You are not responsible for enforcing compliance by
418 | third parties with this License.
419 |
420 | An *entity transaction* is a transaction transferring control of an
421 | organization, or substantially all assets of one, or subdividing an
422 | organization, or merging organizations. If propagation of a covered work
423 | results from an entity transaction, each party to that transaction who receives
424 | a copy of the work also receives whatever licenses to the work the party's
425 | predecessor in interest had or could give under the previous paragraph, plus a
426 | right to possession of the Corresponding Source of the work from the
427 | predecessor in interest, if the predecessor has it or can get it with
428 | reasonable efforts.
429 |
430 | You may not impose any further restrictions on the exercise of the rights
431 | granted or affirmed under this License. For example, you may not impose a
432 | license fee, royalty, or other charge for exercise of rights granted under this
433 | License, and you may not initiate litigation (including a cross-claim or
434 | counterclaim in a lawsuit) alleging that any patent claim is infringed by
435 | making, using, selling, offering for sale, or importing the Program or any
436 | portion of it.
437 |
438 | ### 11. Patents.
439 |
440 | A *contributor* is a copyright holder who authorizes use under this License of
441 | the Program or a work on which the Program is based. The work thus licensed is
442 | called the contributor's *contributor version*.
443 |
444 | A contributor's *essential patent claims* are all patent claims owned or
445 | controlled by the contributor, whether already acquired or hereafter acquired,
446 | that would be infringed by some manner, permitted by this License, of making,
447 | using, or selling its contributor version, but do not include claims that would
448 | be infringed only as a consequence of further modification of the contributor
449 | version. For purposes of this definition, *control* includes the right to grant
450 | patent sublicenses in a manner consistent with the requirements of this
451 | License.
452 |
453 | Each contributor grants you a non-exclusive, worldwide, royalty-free patent
454 | license under the contributor's essential patent claims, to make, use, sell,
455 | offer for sale, import and otherwise run, modify and propagate the contents of
456 | its contributor version.
457 |
458 | In the following three paragraphs, a *patent license* is any express agreement
459 | or commitment, however denominated, not to enforce a patent (such as an express
460 | permission to practice a patent or covenant not to sue for patent
461 | infringement). To *grant* such a patent license to a party means to make such
462 | an agreement or commitment not to enforce a patent against the party.
463 |
464 | If you convey a covered work, knowingly relying on a patent license, and the
465 | Corresponding Source of the work is not available for anyone to copy, free of
466 | charge and under the terms of this License, through a publicly available
467 | network server or other readily accessible means, then you must either
468 |
469 | 1. cause the Corresponding Source to be so available, or
470 | 2. arrange to deprive yourself of the benefit of the patent license for this
471 | particular work, or
472 | 3. arrange, in a manner consistent with the requirements of this License, to
473 | extend the patent license to downstream recipients.
474 |
475 | *Knowingly relying* means you have actual knowledge that, but for the patent
476 | license, your conveying the covered work in a country, or your recipient's use
477 | of the covered work in a country, would infringe one or more identifiable
478 | patents in that country that you have reason to believe are valid.
479 |
480 | If, pursuant to or in connection with a single transaction or arrangement, you
481 | convey, or propagate by procuring conveyance of, a covered work, and grant a
482 | patent license to some of the parties receiving the covered work authorizing
483 | them to use, propagate, modify or convey a specific copy of the covered work,
484 | then the patent license you grant is automatically extended to all recipients
485 | of the covered work and works based on it.
486 |
487 | A patent license is *discriminatory* if it does not include within the scope of
488 | its coverage, prohibits the exercise of, or is conditioned on the non-exercise
489 | of one or more of the rights that are specifically granted under this License.
490 | You may not convey a covered work if you are a party to an arrangement with a
491 | third party that is in the business of distributing software, under which you
492 | make payment to the third party based on the extent of your activity of
493 | conveying the work, and under which the third party grants, to any of the
494 | parties who would receive the covered work from you, a discriminatory patent
495 | license
496 |
497 | - a) in connection with copies of the covered work conveyed by you (or copies
498 | made from those copies), or
499 | - b) primarily for and in connection with specific products or compilations
500 | that contain the covered work, unless you entered into that arrangement, or
501 | that patent license was granted, prior to 28 March 2007.
502 |
503 | Nothing in this License shall be construed as excluding or limiting any implied
504 | license or other defenses to infringement that may otherwise be available to
505 | you under applicable patent law.
506 |
507 | ### 12. No Surrender of Others' Freedom.
508 |
509 | If conditions are imposed on you (whether by court order, agreement or
510 | otherwise) that contradict the conditions of this License, they do not excuse
511 | you from the conditions of this License. If you cannot convey a covered work so
512 | as to satisfy simultaneously your obligations under this License and any other
513 | pertinent obligations, then as a consequence you may not convey it at all. For
514 | example, if you agree to terms that obligate you to collect a royalty for
515 | further conveying from those to whom you convey the Program, the only way you
516 | could satisfy both those terms and this License would be to refrain entirely
517 | from conveying the Program.
518 |
519 | ### 13. Use with the GNU Affero General Public License.
520 |
521 | Notwithstanding any other provision of this License, you have permission to
522 | link or combine any covered work with a work licensed under version 3 of the
523 | GNU Affero General Public License into a single combined work, and to convey
524 | the resulting work. The terms of this License will continue to apply to the
525 | part which is the covered work, but the special requirements of the GNU Affero
526 | General Public License, section 13, concerning interaction through a network
527 | will apply to the combination as such.
528 |
529 | ### 14. Revised Versions of this License.
530 |
531 | The Free Software Foundation may publish revised and/or new versions of the GNU
532 | General Public License from time to time. Such new versions will be similar in
533 | spirit to the present version, but may differ in detail to address new problems
534 | or concerns.
535 |
536 | Each version is given a distinguishing version number. If the Program specifies
537 | that a certain numbered version of the GNU General Public License *or any later
538 | version* applies to it, you have the option of following the terms and
539 | conditions either of that numbered version or of any later version published by
540 | the Free Software Foundation. If the Program does not specify a version number
541 | of the GNU General Public License, you may choose any version ever published by
542 | the Free Software Foundation.
543 |
544 | If the Program specifies that a proxy can decide which future versions of the
545 | GNU General Public License can be used, that proxy's public statement of
546 | acceptance of a version permanently authorizes you to choose that version for
547 | the Program.
548 |
549 | Later license versions may give you additional or different permissions.
550 | However, no additional obligations are imposed on any author or copyright
551 | holder as a result of your choosing to follow a later version.
552 |
553 | ### 15. Disclaimer of Warranty.
554 |
555 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE
556 | LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER
557 | PARTIES PROVIDE THE PROGRAM *AS IS* WITHOUT WARRANTY OF ANY KIND, EITHER
558 | EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
559 | MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE
560 | QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE
561 | DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR
562 | CORRECTION.
563 |
564 | ### 16. Limitation of Liability.
565 |
566 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY
567 | COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS THE PROGRAM AS
568 | PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL,
569 | INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE
570 | THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED
571 | INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE
572 | PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY
573 | HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
574 |
575 | ### 17. Interpretation of Sections 15 and 16.
576 |
577 | If the disclaimer of warranty and limitation of liability provided above cannot
578 | be given local legal effect according to their terms, reviewing courts shall
579 | apply local law that most closely approximates an absolute waiver of all civil
580 | liability in connection with the Program, unless a warranty or assumption of
581 | liability accompanies a copy of the Program in return for a fee.
582 |
583 | ## END OF TERMS AND CONDITIONS ###
584 |
585 | ### How to Apply These Terms to Your New Programs
586 |
587 | If you develop a new program, and you want it to be of the greatest possible
588 | use to the public, the best way to achieve this is to make it free software
589 | which everyone can redistribute and change under these terms.
590 |
591 | To do so, attach the following notices to the program. It is safest to attach
592 | them to the start of each source file to most effectively state the exclusion
593 | of warranty; and each file should have at least the *copyright* line and a
594 | pointer to where the full notice is found.
595 |
596 |
597 | Copyright (C)
598 |
599 | This program is free software: you can redistribute it and/or modify
600 | it under the terms of the GNU General Public License as published by
601 | the Free Software Foundation, either version 3 of the License, or
602 | (at your option) any later version.
603 |
604 | This program is distributed in the hope that it will be useful,
605 | but WITHOUT ANY WARRANTY; without even the implied warranty of
606 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
607 | GNU General Public License for more details.
608 |
609 | You should have received a copy of the GNU General Public License
610 | along with this program. If not, see .
611 |
612 | Also add information on how to contact you by electronic and paper mail.
613 |
614 | If the program does terminal interaction, make it output a short notice like
615 | this when it starts in an interactive mode:
616 |
617 | Copyright (C)
618 | This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
619 | This is free software, and you are welcome to redistribute it
620 | under certain conditions; type `show c' for details.
621 |
622 | The hypothetical commands `show w` and `show c` should show the appropriate
623 | parts of the General Public License. Of course, your program's commands might
624 | be different; for a GUI interface, you would use an *about box*.
625 |
626 | You should also get your employer (if you work as a programmer) or school, if
627 | any, to sign a *copyright disclaimer* for the program, if necessary. For more
628 | information on this, and how to apply and follow the GNU GPL, see
629 | [http://www.gnu.org/licenses/](http://www.gnu.org/licenses/).
630 |
631 | The GNU General Public License does not permit incorporating your program into
632 | proprietary programs. If your program is a subroutine library, you may consider
633 | it more useful to permit linking proprietary applications with the library. If
634 | this is what you want to do, use the GNU Lesser General Public License instead
635 | of this License. But first, please read
636 | [http://www.gnu.org/philosophy/why-not-lgpl.html](http://www.gnu.org/philosophy/why-not-lgpl.html).
637 |
638 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | GNU GENERAL PUBLIC LICENSE
2 | Version 3, 29 June 2007
3 |
4 | Copyright (C) 2007 Free Software Foundation, Inc.
5 | Everyone is permitted to copy and distribute verbatim copies
6 | of this license document, but changing it is not allowed.
7 |
8 | Preamble
9 |
10 | The GNU General Public License is a free, copyleft license for
11 | software and other kinds of works.
12 |
13 | The licenses for most software and other practical works are designed
14 | to take away your freedom to share and change the works. By contrast,
15 | the GNU General Public License is intended to guarantee your freedom to
16 | share and change all versions of a program--to make sure it remains free
17 | software for all its users. We, the Free Software Foundation, use the
18 | GNU General Public License for most of our software; it applies also to
19 | any other work released this way by its authors. You can apply it to
20 | your programs, too.
21 |
22 | When we speak of free software, we are referring to freedom, not
23 | price. Our General Public Licenses are designed to make sure that you
24 | have the freedom to distribute copies of free software (and charge for
25 | them if you wish), that you receive source code or can get it if you
26 | want it, that you can change the software or use pieces of it in new
27 | free programs, and that you know you can do these things.
28 |
29 | To protect your rights, we need to prevent others from denying you
30 | these rights or asking you to surrender the rights. Therefore, you have
31 | certain responsibilities if you distribute copies of the software, or if
32 | you modify it: responsibilities to respect the freedom of others.
33 |
34 | For example, if you distribute copies of such a program, whether
35 | gratis or for a fee, you must pass on to the recipients the same
36 | freedoms that you received. You must make sure that they, too, receive
37 | or can get the source code. And you must show them these terms so they
38 | know their rights.
39 |
40 | Developers that use the GNU GPL protect your rights with two steps:
41 | (1) assert copyright on the software, and (2) offer you this License
42 | giving you legal permission to copy, distribute and/or modify it.
43 |
44 | For the developers' and authors' protection, the GPL clearly explains
45 | that there is no warranty for this free software. For both users' and
46 | authors' sake, the GPL requires that modified versions be marked as
47 | changed, so that their problems will not be attributed erroneously to
48 | authors of previous versions.
49 |
50 | Some devices are designed to deny users access to install or run
51 | modified versions of the software inside them, although the manufacturer
52 | can do so. This is fundamentally incompatible with the aim of
53 | protecting users' freedom to change the software. The systematic
54 | pattern of such abuse occurs in the area of products for individuals to
55 | use, which is precisely where it is most unacceptable. Therefore, we
56 | have designed this version of the GPL to prohibit the practice for those
57 | products. If such problems arise substantially in other domains, we
58 | stand ready to extend this provision to those domains in future versions
59 | of the GPL, as needed to protect the freedom of users.
60 |
61 | Finally, every program is threatened constantly by software patents.
62 | States should not allow patents to restrict development and use of
63 | software on general-purpose computers, but in those that do, we wish to
64 | avoid the special danger that patents applied to a free program could
65 | make it effectively proprietary. To prevent this, the GPL assures that
66 | patents cannot be used to render the program non-free.
67 |
68 | The precise terms and conditions for copying, distribution and
69 | modification follow.
70 |
71 | TERMS AND CONDITIONS
72 |
73 | 0. Definitions.
74 |
75 | "This License" refers to version 3 of the GNU General Public License.
76 |
77 | "Copyright" also means copyright-like laws that apply to other kinds of
78 | works, such as semiconductor masks.
79 |
80 | "The Program" refers to any copyrightable work licensed under this
81 | License. Each licensee is addressed as "you". "Licensees" and
82 | "recipients" may be individuals or organizations.
83 |
84 | To "modify" a work means to copy from or adapt all or part of the work
85 | in a fashion requiring copyright permission, other than the making of an
86 | exact copy. The resulting work is called a "modified version" of the
87 | earlier work or a work "based on" the earlier work.
88 |
89 | A "covered work" means either the unmodified Program or a work based
90 | on the Program.
91 |
92 | To "propagate" a work means to do anything with it that, without
93 | permission, would make you directly or secondarily liable for
94 | infringement under applicable copyright law, except executing it on a
95 | computer or modifying a private copy. Propagation includes copying,
96 | distribution (with or without modification), making available to the
97 | public, and in some countries other activities as well.
98 |
99 | To "convey" a work means any kind of propagation that enables other
100 | parties to make or receive copies. Mere interaction with a user through
101 | a computer network, with no transfer of a copy, is not conveying.
102 |
103 | An interactive user interface displays "Appropriate Legal Notices"
104 | to the extent that it includes a convenient and prominently visible
105 | feature that (1) displays an appropriate copyright notice, and (2)
106 | tells the user that there is no warranty for the work (except to the
107 | extent that warranties are provided), that licensees may convey the
108 | work under this License, and how to view a copy of this License. If
109 | the interface presents a list of user commands or options, such as a
110 | menu, a prominent item in the list meets this criterion.
111 |
112 | 1. Source Code.
113 |
114 | The "source code" for a work means the preferred form of the work
115 | for making modifications to it. "Object code" means any non-source
116 | form of a work.
117 |
118 | A "Standard Interface" means an interface that either is an official
119 | standard defined by a recognized standards body, or, in the case of
120 | interfaces specified for a particular programming language, one that
121 | is widely used among developers working in that language.
122 |
123 | The "System Libraries" of an executable work include anything, other
124 | than the work as a whole, that (a) is included in the normal form of
125 | packaging a Major Component, but which is not part of that Major
126 | Component, and (b) serves only to enable use of the work with that
127 | Major Component, or to implement a Standard Interface for which an
128 | implementation is available to the public in source code form. A
129 | "Major Component", in this context, means a major essential component
130 | (kernel, window system, and so on) of the specific operating system
131 | (if any) on which the executable work runs, or a compiler used to
132 | produce the work, or an object code interpreter used to run it.
133 |
134 | The "Corresponding Source" for a work in object code form means all
135 | the source code needed to generate, install, and (for an executable
136 | work) run the object code and to modify the work, including scripts to
137 | control those activities. However, it does not include the work's
138 | System Libraries, or general-purpose tools or generally available free
139 | programs which are used unmodified in performing those activities but
140 | which are not part of the work. For example, Corresponding Source
141 | includes interface definition files associated with source files for
142 | the work, and the source code for shared libraries and dynamically
143 | linked subprograms that the work is specifically designed to require,
144 | such as by intimate data communication or control flow between those
145 | subprograms and other parts of the work.
146 |
147 | The Corresponding Source need not include anything that users
148 | can regenerate automatically from other parts of the Corresponding
149 | Source.
150 |
151 | The Corresponding Source for a work in source code form is that
152 | same work.
153 |
154 | 2. Basic Permissions.
155 |
156 | All rights granted under this License are granted for the term of
157 | copyright on the Program, and are irrevocable provided the stated
158 | conditions are met. This License explicitly affirms your unlimited
159 | permission to run the unmodified Program. The output from running a
160 | covered work is covered by this License only if the output, given its
161 | content, constitutes a covered work. This License acknowledges your
162 | rights of fair use or other equivalent, as provided by copyright law.
163 |
164 | You may make, run and propagate covered works that you do not
165 | convey, without conditions so long as your license otherwise remains
166 | in force. You may convey covered works to others for the sole purpose
167 | of having them make modifications exclusively for you, or provide you
168 | with facilities for running those works, provided that you comply with
169 | the terms of this License in conveying all material for which you do
170 | not control copyright. Those thus making or running the covered works
171 | for you must do so exclusively on your behalf, under your direction
172 | and control, on terms that prohibit them from making any copies of
173 | your copyrighted material outside their relationship with you.
174 |
175 | Conveying under any other circumstances is permitted solely under
176 | the conditions stated below. Sublicensing is not allowed; section 10
177 | makes it unnecessary.
178 |
179 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law.
180 |
181 | No covered work shall be deemed part of an effective technological
182 | measure under any applicable law fulfilling obligations under article
183 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or
184 | similar laws prohibiting or restricting circumvention of such
185 | measures.
186 |
187 | When you convey a covered work, you waive any legal power to forbid
188 | circumvention of technological measures to the extent such circumvention
189 | is effected by exercising rights under this License with respect to
190 | the covered work, and you disclaim any intention to limit operation or
191 | modification of the work as a means of enforcing, against the work's
192 | users, your or third parties' legal rights to forbid circumvention of
193 | technological measures.
194 |
195 | 4. Conveying Verbatim Copies.
196 |
197 | You may convey verbatim copies of the Program's source code as you
198 | receive it, in any medium, provided that you conspicuously and
199 | appropriately publish on each copy an appropriate copyright notice;
200 | keep intact all notices stating that this License and any
201 | non-permissive terms added in accord with section 7 apply to the code;
202 | keep intact all notices of the absence of any warranty; and give all
203 | recipients a copy of this License along with the Program.
204 |
205 | You may charge any price or no price for each copy that you convey,
206 | and you may offer support or warranty protection for a fee.
207 |
208 | 5. Conveying Modified Source Versions.
209 |
210 | You may convey a work based on the Program, or the modifications to
211 | produce it from the Program, in the form of source code under the
212 | terms of section 4, provided that you also meet all of these conditions:
213 |
214 | a) The work must carry prominent notices stating that you modified
215 | it, and giving a relevant date.
216 |
217 | b) The work must carry prominent notices stating that it is
218 | released under this License and any conditions added under section
219 | 7. This requirement modifies the requirement in section 4 to
220 | "keep intact all notices".
221 |
222 | c) You must license the entire work, as a whole, under this
223 | License to anyone who comes into possession of a copy. This
224 | License will therefore apply, along with any applicable section 7
225 | additional terms, to the whole of the work, and all its parts,
226 | regardless of how they are packaged. This License gives no
227 | permission to license the work in any other way, but it does not
228 | invalidate such permission if you have separately received it.
229 |
230 | d) If the work has interactive user interfaces, each must display
231 | Appropriate Legal Notices; however, if the Program has interactive
232 | interfaces that do not display Appropriate Legal Notices, your
233 | work need not make them do so.
234 |
235 | A compilation of a covered work with other separate and independent
236 | works, which are not by their nature extensions of the covered work,
237 | and which are not combined with it such as to form a larger program,
238 | in or on a volume of a storage or distribution medium, is called an
239 | "aggregate" if the compilation and its resulting copyright are not
240 | used to limit the access or legal rights of the compilation's users
241 | beyond what the individual works permit. Inclusion of a covered work
242 | in an aggregate does not cause this License to apply to the other
243 | parts of the aggregate.
244 |
245 | 6. Conveying Non-Source Forms.
246 |
247 | You may convey a covered work in object code form under the terms
248 | of sections 4 and 5, provided that you also convey the
249 | machine-readable Corresponding Source under the terms of this License,
250 | in one of these ways:
251 |
252 | a) Convey the object code in, or embodied in, a physical product
253 | (including a physical distribution medium), accompanied by the
254 | Corresponding Source fixed on a durable physical medium
255 | customarily used for software interchange.
256 |
257 | b) Convey the object code in, or embodied in, a physical product
258 | (including a physical distribution medium), accompanied by a
259 | written offer, valid for at least three years and valid for as
260 | long as you offer spare parts or customer support for that product
261 | model, to give anyone who possesses the object code either (1) a
262 | copy of the Corresponding Source for all the software in the
263 | product that is covered by this License, on a durable physical
264 | medium customarily used for software interchange, for a price no
265 | more than your reasonable cost of physically performing this
266 | conveying of source, or (2) access to copy the
267 | Corresponding Source from a network server at no charge.
268 |
269 | c) Convey individual copies of the object code with a copy of the
270 | written offer to provide the Corresponding Source. This
271 | alternative is allowed only occasionally and noncommercially, and
272 | only if you received the object code with such an offer, in accord
273 | with subsection 6b.
274 |
275 | d) Convey the object code by offering access from a designated
276 | place (gratis or for a charge), and offer equivalent access to the
277 | Corresponding Source in the same way through the same place at no
278 | further charge. You need not require recipients to copy the
279 | Corresponding Source along with the object code. If the place to
280 | copy the object code is a network server, the Corresponding Source
281 | may be on a different server (operated by you or a third party)
282 | that supports equivalent copying facilities, provided you maintain
283 | clear directions next to the object code saying where to find the
284 | Corresponding Source. Regardless of what server hosts the
285 | Corresponding Source, you remain obligated to ensure that it is
286 | available for as long as needed to satisfy these requirements.
287 |
288 | e) Convey the object code using peer-to-peer transmission, provided
289 | you inform other peers where the object code and Corresponding
290 | Source of the work are being offered to the general public at no
291 | charge under subsection 6d.
292 |
293 | A separable portion of the object code, whose source code is excluded
294 | from the Corresponding Source as a System Library, need not be
295 | included in conveying the object code work.
296 |
297 | A "User Product" is either (1) a "consumer product", which means any
298 | tangible personal property which is normally used for personal, family,
299 | or household purposes, or (2) anything designed or sold for incorporation
300 | into a dwelling. In determining whether a product is a consumer product,
301 | doubtful cases shall be resolved in favor of coverage. For a particular
302 | product received by a particular user, "normally used" refers to a
303 | typical or common use of that class of product, regardless of the status
304 | of the particular user or of the way in which the particular user
305 | actually uses, or expects or is expected to use, the product. A product
306 | is a consumer product regardless of whether the product has substantial
307 | commercial, industrial or non-consumer uses, unless such uses represent
308 | the only significant mode of use of the product.
309 |
310 | "Installation Information" for a User Product means any methods,
311 | procedures, authorization keys, or other information required to install
312 | and execute modified versions of a covered work in that User Product from
313 | a modified version of its Corresponding Source. The information must
314 | suffice to ensure that the continued functioning of the modified object
315 | code is in no case prevented or interfered with solely because
316 | modification has been made.
317 |
318 | If you convey an object code work under this section in, or with, or
319 | specifically for use in, a User Product, and the conveying occurs as
320 | part of a transaction in which the right of possession and use of the
321 | User Product is transferred to the recipient in perpetuity or for a
322 | fixed term (regardless of how the transaction is characterized), the
323 | Corresponding Source conveyed under this section must be accompanied
324 | by the Installation Information. But this requirement does not apply
325 | if neither you nor any third party retains the ability to install
326 | modified object code on the User Product (for example, the work has
327 | been installed in ROM).
328 |
329 | The requirement to provide Installation Information does not include a
330 | requirement to continue to provide support service, warranty, or updates
331 | for a work that has been modified or installed by the recipient, or for
332 | the User Product in which it has been modified or installed. Access to a
333 | network may be denied when the modification itself materially and
334 | adversely affects the operation of the network or violates the rules and
335 | protocols for communication across the network.
336 |
337 | Corresponding Source conveyed, and Installation Information provided,
338 | in accord with this section must be in a format that is publicly
339 | documented (and with an implementation available to the public in
340 | source code form), and must require no special password or key for
341 | unpacking, reading or copying.
342 |
343 | 7. Additional Terms.
344 |
345 | "Additional permissions" are terms that supplement the terms of this
346 | License by making exceptions from one or more of its conditions.
347 | Additional permissions that are applicable to the entire Program shall
348 | be treated as though they were included in this License, to the extent
349 | that they are valid under applicable law. If additional permissions
350 | apply only to part of the Program, that part may be used separately
351 | under those permissions, but the entire Program remains governed by
352 | this License without regard to the additional permissions.
353 |
354 | When you convey a copy of a covered work, you may at your option
355 | remove any additional permissions from that copy, or from any part of
356 | it. (Additional permissions may be written to require their own
357 | removal in certain cases when you modify the work.) You may place
358 | additional permissions on material, added by you to a covered work,
359 | for which you have or can give appropriate copyright permission.
360 |
361 | Notwithstanding any other provision of this License, for material you
362 | add to a covered work, you may (if authorized by the copyright holders of
363 | that material) supplement the terms of this License with terms:
364 |
365 | a) Disclaiming warranty or limiting liability differently from the
366 | terms of sections 15 and 16 of this License; or
367 |
368 | b) Requiring preservation of specified reasonable legal notices or
369 | author attributions in that material or in the Appropriate Legal
370 | Notices displayed by works containing it; or
371 |
372 | c) Prohibiting misrepresentation of the origin of that material, or
373 | requiring that modified versions of such material be marked in
374 | reasonable ways as different from the original version; or
375 |
376 | d) Limiting the use for publicity purposes of names of licensors or
377 | authors of the material; or
378 |
379 | e) Declining to grant rights under trademark law for use of some
380 | trade names, trademarks, or service marks; or
381 |
382 | f) Requiring indemnification of licensors and authors of that
383 | material by anyone who conveys the material (or modified versions of
384 | it) with contractual assumptions of liability to the recipient, for
385 | any liability that these contractual assumptions directly impose on
386 | those licensors and authors.
387 |
388 | All other non-permissive additional terms are considered "further
389 | restrictions" within the meaning of section 10. If the Program as you
390 | received it, or any part of it, contains a notice stating that it is
391 | governed by this License along with a term that is a further
392 | restriction, you may remove that term. If a license document contains
393 | a further restriction but permits relicensing or conveying under this
394 | License, you may add to a covered work material governed by the terms
395 | of that license document, provided that the further restriction does
396 | not survive such relicensing or conveying.
397 |
398 | If you add terms to a covered work in accord with this section, you
399 | must place, in the relevant source files, a statement of the
400 | additional terms that apply to those files, or a notice indicating
401 | where to find the applicable terms.
402 |
403 | Additional terms, permissive or non-permissive, may be stated in the
404 | form of a separately written license, or stated as exceptions;
405 | the above requirements apply either way.
406 |
407 | 8. Termination.
408 |
409 | You may not propagate or modify a covered work except as expressly
410 | provided under this License. Any attempt otherwise to propagate or
411 | modify it is void, and will automatically terminate your rights under
412 | this License (including any patent licenses granted under the third
413 | paragraph of section 11).
414 |
415 | However, if you cease all violation of this License, then your
416 | license from a particular copyright holder is reinstated (a)
417 | provisionally, unless and until the copyright holder explicitly and
418 | finally terminates your license, and (b) permanently, if the copyright
419 | holder fails to notify you of the violation by some reasonable means
420 | prior to 60 days after the cessation.
421 |
422 | Moreover, your license from a particular copyright holder is
423 | reinstated permanently if the copyright holder notifies you of the
424 | violation by some reasonable means, this is the first time you have
425 | received notice of violation of this License (for any work) from that
426 | copyright holder, and you cure the violation prior to 30 days after
427 | your receipt of the notice.
428 |
429 | Termination of your rights under this section does not terminate the
430 | licenses of parties who have received copies or rights from you under
431 | this License. If your rights have been terminated and not permanently
432 | reinstated, you do not qualify to receive new licenses for the same
433 | material under section 10.
434 |
435 | 9. Acceptance Not Required for Having Copies.
436 |
437 | You are not required to accept this License in order to receive or
438 | run a copy of the Program. Ancillary propagation of a covered work
439 | occurring solely as a consequence of using peer-to-peer transmission
440 | to receive a copy likewise does not require acceptance. However,
441 | nothing other than this License grants you permission to propagate or
442 | modify any covered work. These actions infringe copyright if you do
443 | not accept this License. Therefore, by modifying or propagating a
444 | covered work, you indicate your acceptance of this License to do so.
445 |
446 | 10. Automatic Licensing of Downstream Recipients.
447 |
448 | Each time you convey a covered work, the recipient automatically
449 | receives a license from the original licensors, to run, modify and
450 | propagate that work, subject to this License. You are not responsible
451 | for enforcing compliance by third parties with this License.
452 |
453 | An "entity transaction" is a transaction transferring control of an
454 | organization, or substantially all assets of one, or subdividing an
455 | organization, or merging organizations. If propagation of a covered
456 | work results from an entity transaction, each party to that
457 | transaction who receives a copy of the work also receives whatever
458 | licenses to the work the party's predecessor in interest had or could
459 | give under the previous paragraph, plus a right to possession of the
460 | Corresponding Source of the work from the predecessor in interest, if
461 | the predecessor has it or can get it with reasonable efforts.
462 |
463 | You may not impose any further restrictions on the exercise of the
464 | rights granted or affirmed under this License. For example, you may
465 | not impose a license fee, royalty, or other charge for exercise of
466 | rights granted under this License, and you may not initiate litigation
467 | (including a cross-claim or counterclaim in a lawsuit) alleging that
468 | any patent claim is infringed by making, using, selling, offering for
469 | sale, or importing the Program or any portion of it.
470 |
471 | 11. Patents.
472 |
473 | A "contributor" is a copyright holder who authorizes use under this
474 | License of the Program or a work on which the Program is based. The
475 | work thus licensed is called the contributor's "contributor version".
476 |
477 | A contributor's "essential patent claims" are all patent claims
478 | owned or controlled by the contributor, whether already acquired or
479 | hereafter acquired, that would be infringed by some manner, permitted
480 | by this License, of making, using, or selling its contributor version,
481 | but do not include claims that would be infringed only as a
482 | consequence of further modification of the contributor version. For
483 | purposes of this definition, "control" includes the right to grant
484 | patent sublicenses in a manner consistent with the requirements of
485 | this License.
486 |
487 | Each contributor grants you a non-exclusive, worldwide, royalty-free
488 | patent license under the contributor's essential patent claims, to
489 | make, use, sell, offer for sale, import and otherwise run, modify and
490 | propagate the contents of its contributor version.
491 |
492 | In the following three paragraphs, a "patent license" is any express
493 | agreement or commitment, however denominated, not to enforce a patent
494 | (such as an express permission to practice a patent or covenant not to
495 | sue for patent infringement). To "grant" such a patent license to a
496 | party means to make such an agreement or commitment not to enforce a
497 | patent against the party.
498 |
499 | If you convey a covered work, knowingly relying on a patent license,
500 | and the Corresponding Source of the work is not available for anyone
501 | to copy, free of charge and under the terms of this License, through a
502 | publicly available network server or other readily accessible means,
503 | then you must either (1) cause the Corresponding Source to be so
504 | available, or (2) arrange to deprive yourself of the benefit of the
505 | patent license for this particular work, or (3) arrange, in a manner
506 | consistent with the requirements of this License, to extend the patent
507 | license to downstream recipients. "Knowingly relying" means you have
508 | actual knowledge that, but for the patent license, your conveying the
509 | covered work in a country, or your recipient's use of the covered work
510 | in a country, would infringe one or more identifiable patents in that
511 | country that you have reason to believe are valid.
512 |
513 | If, pursuant to or in connection with a single transaction or
514 | arrangement, you convey, or propagate by procuring conveyance of, a
515 | covered work, and grant a patent license to some of the parties
516 | receiving the covered work authorizing them to use, propagate, modify
517 | or convey a specific copy of the covered work, then the patent license
518 | you grant is automatically extended to all recipients of the covered
519 | work and works based on it.
520 |
521 | A patent license is "discriminatory" if it does not include within
522 | the scope of its coverage, prohibits the exercise of, or is
523 | conditioned on the non-exercise of one or more of the rights that are
524 | specifically granted under this License. You may not convey a covered
525 | work if you are a party to an arrangement with a third party that is
526 | in the business of distributing software, under which you make payment
527 | to the third party based on the extent of your activity of conveying
528 | the work, and under which the third party grants, to any of the
529 | parties who would receive the covered work from you, a discriminatory
530 | patent license (a) in connection with copies of the covered work
531 | conveyed by you (or copies made from those copies), or (b) primarily
532 | for and in connection with specific products or compilations that
533 | contain the covered work, unless you entered into that arrangement,
534 | or that patent license was granted, prior to 28 March 2007.
535 |
536 | Nothing in this License shall be construed as excluding or limiting
537 | any implied license or other defenses to infringement that may
538 | otherwise be available to you under applicable patent law.
539 |
540 | 12. No Surrender of Others' Freedom.
541 |
542 | If conditions are imposed on you (whether by court order, agreement or
543 | otherwise) that contradict the conditions of this License, they do not
544 | excuse you from the conditions of this License. If you cannot convey a
545 | covered work so as to satisfy simultaneously your obligations under this
546 | License and any other pertinent obligations, then as a consequence you may
547 | not convey it at all. For example, if you agree to terms that obligate you
548 | to collect a royalty for further conveying from those to whom you convey
549 | the Program, the only way you could satisfy both those terms and this
550 | License would be to refrain entirely from conveying the Program.
551 |
552 | 13. Use with the GNU Affero General Public License.
553 |
554 | Notwithstanding any other provision of this License, you have
555 | permission to link or combine any covered work with a work licensed
556 | under version 3 of the GNU Affero General Public License into a single
557 | combined work, and to convey the resulting work. The terms of this
558 | License will continue to apply to the part which is the covered work,
559 | but the special requirements of the GNU Affero General Public License,
560 | section 13, concerning interaction through a network will apply to the
561 | combination as such.
562 |
563 | 14. Revised Versions of this License.
564 |
565 | The Free Software Foundation may publish revised and/or new versions of
566 | the GNU General Public License from time to time. Such new versions will
567 | be similar in spirit to the present version, but may differ in detail to
568 | address new problems or concerns.
569 |
570 | Each version is given a distinguishing version number. If the
571 | Program specifies that a certain numbered version of the GNU General
572 | Public License "or any later version" applies to it, you have the
573 | option of following the terms and conditions either of that numbered
574 | version or of any later version published by the Free Software
575 | Foundation. If the Program does not specify a version number of the
576 | GNU General Public License, you may choose any version ever published
577 | by the Free Software Foundation.
578 |
579 | If the Program specifies that a proxy can decide which future
580 | versions of the GNU General Public License can be used, that proxy's
581 | public statement of acceptance of a version permanently authorizes you
582 | to choose that version for the Program.
583 |
584 | Later license versions may give you additional or different
585 | permissions. However, no additional obligations are imposed on any
586 | author or copyright holder as a result of your choosing to follow a
587 | later version.
588 |
589 | 15. Disclaimer of Warranty.
590 |
591 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
592 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
593 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
594 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
595 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
596 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
597 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
598 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
599 |
600 | 16. Limitation of Liability.
601 |
602 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
603 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
604 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
605 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
606 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
607 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
608 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
609 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
610 | SUCH DAMAGES.
611 |
612 | 17. Interpretation of Sections 15 and 16.
613 |
614 | If the disclaimer of warranty and limitation of liability provided
615 | above cannot be given local legal effect according to their terms,
616 | reviewing courts shall apply local law that most closely approximates
617 | an absolute waiver of all civil liability in connection with the
618 | Program, unless a warranty or assumption of liability accompanies a
619 | copy of the Program in return for a fee.
620 |
621 | END OF TERMS AND CONDITIONS
622 |
623 | How to Apply These Terms to Your New Programs
624 |
625 | If you develop a new program, and you want it to be of the greatest
626 | possible use to the public, the best way to achieve this is to make it
627 | free software which everyone can redistribute and change under these terms.
628 |
629 | To do so, attach the following notices to the program. It is safest
630 | to attach them to the start of each source file to most effectively
631 | state the exclusion of warranty; and each file should have at least
632 | the "copyright" line and a pointer to where the full notice is found.
633 |
634 |
635 | Copyright (C)
636 |
637 | This program is free software: you can redistribute it and/or modify
638 | it under the terms of the GNU General Public License as published by
639 | the Free Software Foundation, either version 3 of the License, or
640 | (at your option) any later version.
641 |
642 | This program is distributed in the hope that it will be useful,
643 | but WITHOUT ANY WARRANTY; without even the implied warranty of
644 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
645 | GNU General Public License for more details.
646 |
647 | You should have received a copy of the GNU General Public License
648 | along with this program. If not, see .
649 |
650 | Also add information on how to contact you by electronic and paper mail.
651 |
652 | If the program does terminal interaction, make it output a short
653 | notice like this when it starts in an interactive mode:
654 |
655 | Copyright (C)
656 | This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
657 | This is free software, and you are welcome to redistribute it
658 | under certain conditions; type `show c' for details.
659 |
660 | The hypothetical commands `show w' and `show c' should show the appropriate
661 | parts of the General Public License. Of course, your program's commands
662 | might be different; for a GUI interface, you would use an "about box".
663 |
664 | You should also get your employer (if you work as a programmer) or school,
665 | if any, to sign a "copyright disclaimer" for the program, if necessary.
666 | For more information on this, and how to apply and follow the GNU GPL, see
667 | .
668 |
669 | The GNU General Public License does not permit incorporating your program
670 | into proprietary programs. If your program is a subroutine library, you
671 | may consider it more useful to permit linking proprietary applications with
672 | the library. If this is what you want to do, use the GNU Lesser General
673 | Public License instead of this License. But first, please read
674 | .
675 |
--------------------------------------------------------------------------------