Wing Commander
Reconstructed Win32 source (1996)
Toggle main menu visibility
Loading...
Searching...
No Matches
streamfile.cpp
Go to the documentation of this file.
1
/**
2
* @file
3
* @ingroup ixlib
4
* @brief Stream-file methods.
5
*
6
* Address range 444700-44490f. The six methods follow ten INT3 bytes after
7
* the worker thread's helpers. The original file name is not in the
8
* diagnostic strings.
9
*/
10
#include "
ix.h
"
11
12
/* Function start: 0x00444700 */
13
unsigned
int
IxStreamFile::ix_stream_file_read
(
void
*newDestination,
14
unsigned
int
bytes)
15
{
16
ix_stream_file_wait
();
17
EnterCriticalSection(&
csStreamerFileList
);
18
if
(
position
+ bytes >
size
)
19
bytes =
size
-
position
;
20
if
(bytes > 0) {
21
destination
= (
unsigned
char
*)newDestination;
22
remaining
= bytes;
23
flags
|=
IX_STREAM_FILE_READING
;
24
if
(
previous
!= 0)
25
previous
->
next
=
next
;
26
if
(
next
== 0)
27
pStreamIdleFiles
=
previous
;
28
else
29
next
->
previous
=
previous
;
30
previous
=
pStreamReadRequests
;
31
next
= 0;
32
if
(
pStreamReadRequests
!= 0)
33
pStreamReadRequests
->
next
=
this
;
34
pStreamReadRequests
=
this
;
35
}
36
LeaveCriticalSection(&
csStreamerFileList
);
37
SetEvent(
hStreamerWakeupEvent
);
38
return
bytes;
39
}
40
41
/* Function start: 0x00444809 */
42
void
IxStreamFile::ix_stream_file_seek
(
unsigned
int
newPosition)
43
{
44
ix_stream_file_wait
();
45
if
(newPosition >= 0)
46
position
=
size
< newPosition ?
size
: newPosition;
47
else
48
position
= 0;
49
}
50
51
/* Function start: 0x0044485B */
52
unsigned
int
IxStreamFile::ix_stream_file_tell
(
void
)
53
{
54
ix_stream_file_wait
();
55
return
position
;
56
}
57
58
/* Function start: 0x0044487F */
59
unsigned
int
IxStreamFile::ix_stream_file_size
(
void
)
60
{
61
return
size
;
62
}
63
64
/* Function start: 0x0044489B */
65
void
IxStreamFile::ix_stream_file_wait
(
void
)
66
{
67
if
((
flags
&
IX_STREAM_FILE_READING
) != 0) {
68
WaitForSingleObject(
completionEvent
, INFINITE);
69
ResetEvent(
completionEvent
);
70
}
71
}
72
73
/* Function start: 0x004448D9 */
74
int
IxStreamFile::ix_stream_file_is_reading
(
void
)
75
{
76
return
(
flags
&
IX_STREAM_FILE_READING
) != 0;
77
}
ix.h
The library's classes and shared declarations.
IX_STREAM_FILE_READING
@ IX_STREAM_FILE_READING
Definition
ix.h:341
pStreamIdleFiles
IxStreamFile * pStreamIdleFiles
Definition
streamer.cpp:22
csStreamerFileList
CRITICAL_SECTION csStreamerFileList
Definition
streamer.cpp:35
pStreamReadRequests
IxStreamFile * pStreamReadRequests
Definition
streamer.cpp:25
hStreamerWakeupEvent
HANDLE hStreamerWakeupEvent
Definition
streamer.cpp:40
IxStreamFile::ix_stream_file_tell
unsigned int ix_stream_file_tell(void)
Definition
streamfile.cpp:52
IxStreamFile::ix_stream_file_wait
void ix_stream_file_wait(void)
Definition
streamfile.cpp:65
IxStreamFile::ix_stream_file_read
unsigned int ix_stream_file_read(void *destination, unsigned int bytes)
Definition
streamfile.cpp:13
IxStreamFile::ix_stream_file_is_reading
int ix_stream_file_is_reading(void)
Definition
streamfile.cpp:74
IxStreamFile::remaining
unsigned int remaining
Definition
ix.h:434
IxStreamFile::destination
unsigned char * destination
Definition
ix.h:435
IxStreamFile::size
unsigned int size
Definition
ix.h:430
IxStreamFile::previous
IxStreamFile * previous
Definition
ix.h:437
IxStreamFile::position
unsigned int position
Definition
ix.h:433
IxStreamFile::ix_stream_file_size
unsigned int ix_stream_file_size(void)
Definition
streamfile.cpp:59
IxStreamFile::next
IxStreamFile * next
Definition
ix.h:438
IxStreamFile::ix_stream_file_seek
void ix_stream_file_seek(unsigned int position)
Definition
streamfile.cpp:42
IxStreamFile::flags
unsigned int flags
Definition
ix.h:427
IxStreamFile::completionEvent
HANDLE completionEvent
Definition
ix.h:436
src
ix
streamfile.cpp
Generated by
1.18.0