def read_scoreframe(self) -> ScoreFrame: sf = ScoreFrame(*SCOREFRAME_FMT.unpack_from(self.body_view[:29])) self.body_view = self.body_view[29:] if sf.score_v2: sf.combo_portion = self.read_f64() sf.bonus_portion = self.read_f64() return sf
async def read_scoreframe(self) -> ScoreFrame: fmt = '<iBHHHHHHiHH?BB?' sf = ScoreFrame(struct.unpack_from(fmt, self._buf[:29])) self._buf = self._buf[29:] if sf.score_v2: sf.combo_portion = await self.read_f32() sf.bonus_portion = await self.read_f32() return sf
def read_scoreframe(self) -> ScoreFrame: fmt = '<iBHHHHHHiHH?BB?' sf = ScoreFrame(*struct.unpack_from(fmt, self.view[:29])) self.view = self.view[29:] if sf.score_v2: sf.combo_portion = self.read_f32() sf.bonus_portion = self.read_f32() return sf
async def read_scoreframe(data: memoryview) -> tuple[ScoreFrame, int]: """ Read an osu! scoreframe from `data`. """ offset = 29 s = ScoreFrame(*struct.unpack('<iBHHHHHHiHH?BB?', data[:offset])) if s.score_v2: s.combo_portion, s.bonus_portion = struct.unpack('<ff', data[offset:offset+8]) offset += 8 return s, offset