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