Wing Commander II
Reconstructed Win32 source (1996)
Toggle main menu visibility
Loading...
Searching...
No Matches
streamfile.cpp
Go to the documentation of this file.
1
/*
2
* ix stream-file methods. The filename is inferred from the class;
3
* no diagnostic string names this source file in the retail image.
4
*
5
* Retail address range: 0x0046DD00 - 0x0046DF07 (6 functions).
6
* The initial 16-byte boundary follows ten padding bytes after the
7
* thread helpers. See docs/ORDER.md for compilation-unit evidence.
8
*/
9
#include "
ix.h
"
10
11
/* Function start: 0x46DD00 */
12
unsigned
int
IxStreamFile::ix_stream_file_read
(
void
*newDestination,
13
unsigned
int
bytes)
14
{
15
ix_stream_file_wait
();
16
EnterCriticalSection(&
g_csStreamerFileFifo
);
17
if
(
position
+ bytes >
size
)
18
bytes =
size
-
position
;
19
if
(bytes > 0) {
20
destination
= (
unsigned
char
*)newDestination;
21
remaining
= bytes;
22
flags
|=
IX_STREAM_FILE_READING
;
23
if
(
previous
!= 0)
24
previous
->
next
=
next
;
25
if
(
next
== 0)
26
g_48_pPumpIdleFiles
=
previous
;
27
else
28
next
->
previous
=
previous
;
29
previous
=
g_1_pPlayerReadQueue
;
30
next
= 0;
31
if
(
g_1_pPlayerReadQueue
!= 0)
32
g_1_pPlayerReadQueue
->
next
=
this
;
33
g_1_pPlayerReadQueue
=
this
;
34
}
35
LeaveCriticalSection(&
g_csStreamerFileFifo
);
36
SetEvent(
g_1_hStreamRouseEvent
);
37
return
bytes;
38
}
39
40
/* Function start: 0x46DE09 */
41
void
IxStreamFile::ix_stream_file_seek
(
unsigned
int
newPosition)
42
{
43
ix_stream_file_wait
();
44
if
(newPosition >= 0)
45
position
=
size
< newPosition ?
size
: newPosition;
46
else
47
position
= 0;
48
}
49
50
/* Function start: 0x46DE5B */
51
unsigned
int
IxStreamFile::ix_stream_file_tell
(
void
)
52
{
53
ix_stream_file_wait
();
54
return
position
;
55
}
56
57
/* Function start: 0x46DE7F */
58
unsigned
int
IxStreamFile::ix_stream_file_size
(
void
)
59
{
60
return
size
;
61
}
62
63
/* Function start: 0x46DE9B */
64
void
IxStreamFile::ix_stream_file_wait
(
void
)
65
{
66
if
((
flags
&
IX_STREAM_FILE_READING
) != 0) {
67
WaitForSingleObject(
completionEvent
, INFINITE);
68
ResetEvent(
completionEvent
);
69
}
70
}
71
72
/* Function start: 0x46DED9 */
73
int
IxStreamFile::ix_stream_file_is_reading
(
void
)
74
{
75
return
(
flags
&
IX_STREAM_FILE_READING
) != 0;
76
}
ix.h
Audio classes, DirectSound interfaces and shared ix state.
IX_STREAM_FILE_READING
@ IX_STREAM_FILE_READING
Definition
ix.h:299
g_1_hStreamRouseEvent
HANDLE g_1_hStreamRouseEvent
Definition
streamer.cpp:37
g_48_pPumpIdleFiles
IxStreamFile * g_48_pPumpIdleFiles
Definition
streamer.cpp:19
g_csStreamerFileFifo
CRITICAL_SECTION g_csStreamerFileFifo
Definition
streamer.cpp:32
g_1_pPlayerReadQueue
IxStreamFile * g_1_pPlayerReadQueue
Definition
streamer.cpp:22
IxStreamFile::ix_stream_file_tell
unsigned int ix_stream_file_tell(void)
Definition
streamfile.cpp:51
IxStreamFile::ix_stream_file_read
unsigned int ix_stream_file_read(void *destination, unsigned int bytes)
Definition
streamfile.cpp:12
IxStreamFile::remaining
unsigned int remaining
Definition
ix.h:392
IxStreamFile::destination
unsigned char * destination
Definition
ix.h:393
IxStreamFile::size
unsigned int size
Definition
ix.h:388
IxStreamFile::previous
IxStreamFile * previous
Definition
ix.h:395
IxStreamFile::position
unsigned int position
Definition
ix.h:391
IxStreamFile::ix_stream_file_is_reading
int ix_stream_file_is_reading()
Definition
streamfile.cpp:73
IxStreamFile::ix_stream_file_size
unsigned int ix_stream_file_size(void)
Definition
streamfile.cpp:58
IxStreamFile::next
IxStreamFile * next
Definition
ix.h:396
IxStreamFile::ix_stream_file_seek
void ix_stream_file_seek(unsigned int position)
Definition
streamfile.cpp:41
IxStreamFile::flags
unsigned int flags
Definition
ix.h:385
IxStreamFile::completionEvent
HANDLE completionEvent
Definition
ix.h:394
IxStreamFile::ix_stream_file_wait
void ix_stream_file_wait()
Definition
streamfile.cpp:64
src
ix
streamfile.cpp
Generated by
1.18.0