Wing Commander
Reconstructed Win32 source (1996)
Toggle main menu visibility
Loading...
Searching...
No Matches
ixfile.cpp
Go to the documentation of this file.
1
/**
2
* @file
3
* @ingroup ixlib
4
* @brief stdio wrappers used by the streamer and its thread.
5
*
6
* Address range 461630-4617bf. A separate object from the LZO decoder before
7
* it: the linker pads to its 16-byte boundary with INT3 between the two, in
8
* WC1 and WC2 alike. Like the decoder it came from a library of its own,
9
* pulled only on LINK's second search pass.
10
*/
11
#include "
ix.h
"
12
#include <stdlib.h>
13
#include <string.h>
14
15
#pragma function(strcat)
16
17
/* Function start: 0x00461630 */
18
/* Unreferenced in WC1 and WC2 alike; the file module's empty init and
19
* shutdown entry points, by analogy with the other ix modules. */
20
extern
"C"
void
ix_file_init_hook
(
void
)
21
{
22
}
23
24
/* Function start: 0x00461640 */
25
extern
"C"
void
ix_file_shutdown_hook
(
void
)
26
{
27
}
28
29
/* Function start: 0x00461650 */
30
extern
"C"
FILE *
ix_file_open
(
const
char
*path,
int
mode)
31
{
32
char
modeString[4];
33
34
modeString[0] = 0;
35
if
((mode & 1) != 0)
36
strcat(modeString,
"r"
);
37
if
((mode & 2) != 0)
38
strcat(modeString,
"w"
);
39
strcat(modeString,
"b"
);
40
return
fopen(path, modeString);
41
}
42
43
/* Function start: 0x004616BE */
44
extern
"C"
void
ix_file_close
(FILE *file)
45
{
46
fclose(file);
47
}
48
49
/* Function start: 0x004616DA */
50
extern
"C"
void
ix_file_seek
(FILE *file,
long
position)
51
{
52
fseek(file, position, SEEK_SET);
53
}
54
55
/* Function start: 0x004616FC */
56
extern
"C"
long
ix_file_tell
(FILE *file)
57
{
58
return
ftell(file);
59
}
60
61
/* Function start: 0x00461718 */
62
extern
"C"
unsigned
int
ix_file_read
(FILE *file,
void
*destination,
63
unsigned
int
bytes)
64
{
65
return
fread(destination, 1, bytes, file);
66
}
67
68
/* Function start: 0x0046173E */
69
extern
"C"
unsigned
int
ix_file_write
(FILE *file,
const
void
*source,
70
unsigned
int
bytes)
71
{
72
return
fwrite(source, 1, bytes, file);
73
}
74
75
/* Function start: 0x00461764 */
76
extern
"C"
long
ix_file_size
(FILE *file)
77
{
78
long
position;
79
long
size;
80
81
position = ftell(file);
82
fseek(file, 0, SEEK_END);
83
size = ftell(file);
84
fseek(file, position, SEEK_SET);
85
return
size;
86
}
ix.h
The library's classes and shared declarations.
ix_file_close
void ix_file_close(FILE *file)
Definition
ixfile.cpp:44
ix_file_open
FILE * ix_file_open(const char *path, int mode)
Definition
ixfile.cpp:30
ix_file_write
unsigned int ix_file_write(FILE *file, const void *source, unsigned int bytes)
Definition
ixfile.cpp:69
ix_file_read
unsigned int ix_file_read(FILE *file, void *destination, unsigned int bytes)
Definition
ixfile.cpp:62
ix_file_seek
void ix_file_seek(FILE *file, long position)
Definition
ixfile.cpp:50
ix_file_tell
long ix_file_tell(FILE *file)
Definition
ixfile.cpp:56
ix_file_init_hook
void ix_file_init_hook(void)
Definition
ixfile.cpp:20
ix_file_size
long ix_file_size(FILE *file)
Definition
ixfile.cpp:76
ix_file_shutdown_hook
void ix_file_shutdown_hook(void)
Definition
ixfile.cpp:25
src
ix
ixfile.cpp
Generated by
1.18.0