Project SkyFire Core
SkyFire 5.4.8 server core API documentation
Toggle main menu visibility
Loading...
Searching...
No Matches
mpqfile.h
Go to the documentation of this file.
1
/*
2
* This file is part of Project SkyFire https://www.projectskyfire.org.
3
* See LICENSE.md file for Copyright information
4
*/
5
6
#define _CRT_SECURE_NO_DEPRECATE
7
#ifndef _CRT_SECURE_NO_WARNINGS
// fuck the police^Wwarnings
8
#define _CRT_SECURE_NO_WARNINGS
9
#endif
10
11
#ifndef MPQ_H
12
#define MPQ_H
13
14
#include <string.h>
15
#include <ctype.h>
16
#include <vector>
17
#include <iostream>
18
#include <deque>
19
#include "StormLib.h"
20
21
#ifdef _WIN32
22
#include <Windows.h>
// mainly only HANDLE definition is required
23
typedef
__int64
int64
;
24
typedef
__int32
int32
;
25
typedef
__int16
int16
;
26
typedef
__int8
int8
;
27
typedef
unsigned
__int64
uint64
;
28
typedef
unsigned
__int32
uint32
;
29
typedef
unsigned
__int16
uint16
;
30
typedef
unsigned
__int8
uint8
;
31
#else
32
#include <stdint.h>
33
#ifndef uint64_t
34
#ifdef __linux__
35
#include <linux/types.h>
36
#endif
37
#endif
38
typedef
int64_t
int64
;
39
typedef
int32_t
int32
;
40
typedef
int16_t
int16
;
41
typedef
int8_t
int8
;
42
typedef
uint64_t
uint64
;
43
typedef
uint32_t
uint32
;
44
typedef
uint16_t
uint16
;
45
typedef
uint8_t
uint8
;
46
#endif
47
48
using namespace
std;
49
50
class
MPQFile
51
{
52
//MPQHANDLE handle;
53
bool
eof
;
54
char
*
buffer
;
55
size_t
pointer
,
size
;
56
57
// disable copying
58
MPQFile
(
const
MPQFile
&f);
59
void
operator=
(
const
MPQFile
&f);
60
61
public
:
62
MPQFile
(HANDLE mpq,
const
char
* filename,
bool
warnNoExist =
true
);
// filenames are not case sensitive
63
~MPQFile
() {
close
(); }
64
size_t
read
(
void
* dest,
size_t
bytes);
65
size_t
getSize
() {
return
size
; }
66
size_t
getPos
() {
return
pointer
; }
67
char
*
getBuffer
() {
return
buffer
; }
68
char
*
getPointer
() {
return
buffer
+
pointer
; }
69
bool
isEof
() {
return
eof
; }
70
void
seek
(
int
offset);
71
void
seekRelative
(
int
offset);
72
void
close
();
73
};
74
75
inline
void
flipcc
(
char
*fcc)
76
{
77
char
t;
78
t=fcc[0];
79
fcc[0]=fcc[3];
80
fcc[3]=t;
81
t=fcc[1];
82
fcc[1]=fcc[2];
83
fcc[2]=t;
84
}
85
86
#endif
int32
std::int32_t int32
Definition
Define.h:73
uint8
std::uint8_t uint8
Definition
Define.h:79
uint32
std::uint32_t uint32
Definition
Define.h:77
int8
std::int8_t int8
Definition
Define.h:75
uint64
std::uint64_t uint64
Definition
Define.h:76
int64
std::int64_t int64
Definition
Define.h:72
uint16
std::uint16_t uint16
Definition
Define.h:78
int16
std::int16_t int16
Definition
Define.h:74
MPQFile::getSize
size_t getSize()
Definition
mpqfile.h:65
MPQFile::read
size_t read(void *dest, size_t bytes)
Definition
mpqfile.cpp:58
MPQFile::MPQFile
MPQFile(const MPQFile &f)
MPQFile::buffer
char * buffer
Definition
mpqfile.h:54
MPQFile::pointer
size_t pointer
Definition
mpqfile.h:55
MPQFile::~MPQFile
~MPQFile()
Definition
mpqfile.h:63
MPQFile::getPointer
char * getPointer()
Definition
mpqfile.h:68
MPQFile::isEof
bool isEof()
Definition
mpqfile.h:69
MPQFile::size
size_t size
Definition
mpqfile.h:55
MPQFile::close
void close()
Definition
mpqfile.cpp:87
MPQFile::getPos
size_t getPos()
Definition
mpqfile.h:66
MPQFile::seek
void seek(int offset)
Definition
mpqfile.cpp:75
MPQFile::seekRelative
void seekRelative(int offset)
Definition
mpqfile.cpp:81
MPQFile::getBuffer
char * getBuffer()
Definition
mpqfile.h:67
MPQFile::eof
bool eof
Definition
mpqfile.h:53
MPQFile::operator=
void operator=(const MPQFile &f)
flipcc
void flipcc(char *fcc)
Definition
mpqfile.h:75
src
tools
vmap4_extractor
mpqfile.h
Generated on
for Project SkyFire Core by
1.17.0