MCPcopy Create free account
hub / github.com/bfbbdecomp/bfbb / iFileSeek

Function iFileSeek

src/SB/Core/gc/iFile.cpp:101–144  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

99}
100
101S32 iFileSeek(tag_xFile* file, S32 offset, S32 whence)
102{
103 tag_iFile* ps = &file->ps;
104 S32 position, new_pos;
105
106 switch (whence)
107 {
108 case IFILE_SEEK_SET:
109 {
110 new_pos = offset;
111 break;
112 }
113 case IFILE_SEEK_CUR:
114 {
115 if (DVDGetCommandBlockStatus(&ps->fileInfo.cb) == DVD_STATE_BUSY)
116 {
117 return -1;
118 }
119
120 new_pos = offset + ps->offset;
121 break;
122 }
123 case IFILE_SEEK_END:
124 {
125 new_pos = ps->fileInfo.length - offset;
126
127 if (new_pos < 0)
128 {
129 new_pos = 0;
130 }
131
132 break;
133 }
134 default:
135 {
136 new_pos = offset;
137 break;
138 }
139 }
140
141 ps->offset = new_pos;
142
143 return ps->offset;
144}
145
146static void ifilereadCB(tag_xFile* file)
147{

Callers 8

iCSAsyncReadCBFunction · 0.70
iCSFileOpenFunction · 0.70
iCSFileAsyncSkipFunction · 0.70
iFileOpenFunction · 0.70
iFileReadFunction · 0.70
BFD_readFunction · 0.50
BFD_seekFunction · 0.50
BFD_AsyncReadFunction · 0.50

Calls 1

DVDGetCommandBlockStatusFunction · 0.85

Tested by

no test coverage detected