fix bug in ReadGotoBeginning (to finally seek correctly)
This commit is contained in:
@@ -138,6 +138,7 @@ class CTRFF_API BCSTM {
|
||||
DSP_ADPCM_Param() {}
|
||||
PD::u16 Coefficients[0x10];
|
||||
};
|
||||
|
||||
struct DSP_ADPCM_Context {
|
||||
DSP_ADPCM_Context()
|
||||
: PredictorScale(0),
|
||||
|
||||
@@ -147,15 +147,10 @@ CTRFF_API void BCSTM::ReadGotoBeginning(bool use_loop_beg) {
|
||||
size_t off = pDataBlockRef.Ref.Offset + 0x20;
|
||||
/** Shift to loop start if enabled */
|
||||
if (use_loop_beg) {
|
||||
off += GetNumBlocks() * GetNumChannels() * GetLoopStart();
|
||||
// off += GetNumChannels() * pInfoBlock.StreamInfo.LoopStartFrame;
|
||||
}
|
||||
// block_size * channel_count * loop_start
|
||||
try {
|
||||
pFile.seekg(off, std::ios::beg);
|
||||
} catch (const std::exception& e) {
|
||||
throw std::runtime_error(e.what());
|
||||
off += GetLoopStart() * GetBlockSize() * GetNumChannels();
|
||||
}
|
||||
pFile.seekg(off, std::ios::beg);
|
||||
|
||||
if (pFile.tellg() > pHeader.FileSize) {
|
||||
throw std::runtime_error("BCSTM: Seeked Out of range!");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user