@@ -11,6 +11,7 @@ intptr_t SingleMode::pduel = 0;
1111bool SingleMode::is_closing = false ;
1212bool SingleMode::is_continuing = false ;
1313Replay SingleMode::last_replay;
14+ size_t SingleMode::last_replay_response_size = 0 ;
1415
1516bool SingleMode::StartPlay () {
1617 std::thread (SinglePlayThread).detach ();
@@ -25,8 +26,7 @@ void SingleMode::StopPlay(bool is_exiting) {
2526void SingleMode::SetResponse (unsigned char * resp, unsigned int len) {
2627 if (!pduel)
2728 return ;
28- last_replay.Write <uint8_t >(len);
29- last_replay.WriteData (resp, len);
29+ last_replay_response_size = last_replay.WriteResponse (resp, len);
3030 set_responseb (pduel, resp);
3131}
3232int SingleMode::SinglePlayThread () {
@@ -112,6 +112,7 @@ int SingleMode::SinglePlayThread() {
112112 if (len > 0 )
113113 is_continuing = SinglePlayAnalyze (engineBuffer.data (), len);
114114 last_replay.BeginRecord ();
115+ last_replay_response_size = 0 ;
115116 last_replay.WriteHeader (rh);
116117 uint16_t host_name[20 ]{};
117118 BufferIO::CopyCharArray (mainGame->dInfo .hostname , host_name);
@@ -191,6 +192,10 @@ bool SingleMode::SinglePlayAnalyze(unsigned char* msg, unsigned int len) {
191192 mainGame->dInfo .curMsg = BufferIO::Read<uint8_t >(pbuf);
192193 switch (mainGame->dInfo .curMsg ) {
193194 case MSG_RETRY : {
195+ if (last_replay_response_size) {
196+ last_replay.RemoveData (last_replay_response_size);
197+ last_replay_response_size = 0 ;
198+ }
194199 if (!DuelClient::ClientAnalyze (offset, pbuf - offset)) {
195200 mainGame->singleSignal .Reset ();
196201 mainGame->singleSignal .Wait ();
0 commit comments