Commit 6dd9a52f authored by edo9300's avatar edo9300

Lua64 bit replay mode

parent b8e1d14d
...@@ -10,6 +10,7 @@ namespace ygo { ...@@ -10,6 +10,7 @@ namespace ygo {
#define REPLAY_TAG 0x2 #define REPLAY_TAG 0x2
#define REPLAY_DECODED 0x4 #define REPLAY_DECODED 0x4
#define REPLAY_SINGLE_MODE 0x8 #define REPLAY_SINGLE_MODE 0x8
#define REPLAY_LUA64 0x10
struct ReplayHeader { struct ReplayHeader {
unsigned int id; unsigned int id;
......
...@@ -87,6 +87,7 @@ int ReplayMode::ReplayThread(void* param) { ...@@ -87,6 +87,7 @@ int ReplayMode::ReplayThread(void* param) {
set_message_handler((message_handler)MessageHandler); set_message_handler((message_handler)MessageHandler);
mainGame->dInfo.isSingleMode = false; mainGame->dInfo.isSingleMode = false;
} }
mainGame->dInfo.lua64 = (rh.flag & REPLAY_LUA64) ? 1 : 0;
pduel = create_duel(rnd.rand()); pduel = create_duel(rnd.rand());
int start_lp = cur_replay.ReadInt32(); int start_lp = cur_replay.ReadInt32();
int start_hand = cur_replay.ReadInt32(); int start_hand = cur_replay.ReadInt32();
...@@ -436,7 +437,7 @@ bool ReplayMode::ReplayAnalyze(char* msg, unsigned int len) { ...@@ -436,7 +437,7 @@ bool ReplayMode::ReplayAnalyze(char* msg, unsigned int len) {
return false; return false;
} }
case MSG_HINT: { case MSG_HINT: {
pbuf += 6; pbuf += (mainGame->dInfo.lua64) ? 10 : 6;
DuelClient::ClientAnalyze(offset, pbuf - offset); DuelClient::ClientAnalyze(offset, pbuf - offset);
break; break;
} }
...@@ -453,7 +454,7 @@ bool ReplayMode::ReplayAnalyze(char* msg, unsigned int len) { ...@@ -453,7 +454,7 @@ bool ReplayMode::ReplayAnalyze(char* msg, unsigned int len) {
case MSG_SELECT_BATTLECMD: { case MSG_SELECT_BATTLECMD: {
player = BufferIO::ReadInt8(pbuf); player = BufferIO::ReadInt8(pbuf);
count = BufferIO::ReadInt8(pbuf); count = BufferIO::ReadInt8(pbuf);
pbuf += count * 11; pbuf += count * (mainGame->dInfo.lua64) ? 15 : 11;
count = BufferIO::ReadInt8(pbuf); count = BufferIO::ReadInt8(pbuf);
pbuf += count * 8 + 2; pbuf += count * 8 + 2;
ReplayRefresh(); ReplayRefresh();
...@@ -472,24 +473,24 @@ bool ReplayMode::ReplayAnalyze(char* msg, unsigned int len) { ...@@ -472,24 +473,24 @@ bool ReplayMode::ReplayAnalyze(char* msg, unsigned int len) {
count = BufferIO::ReadInt8(pbuf); count = BufferIO::ReadInt8(pbuf);
pbuf += count * 7; pbuf += count * 7;
count = BufferIO::ReadInt8(pbuf); count = BufferIO::ReadInt8(pbuf);
pbuf += count * 11 + 3; pbuf += count * (mainGame->dInfo.lua64) ? 15 : 11 + 3;
ReplayRefresh(); ReplayRefresh();
return ReadReplayResponse(); return ReadReplayResponse();
} }
case MSG_SELECT_EFFECTYN: { case MSG_SELECT_EFFECTYN: {
player = BufferIO::ReadInt8(pbuf); player = BufferIO::ReadInt8(pbuf);
pbuf += 12; pbuf += (mainGame->dInfo.lua64) ? 16 : 12;
return ReadReplayResponse(); return ReadReplayResponse();
} }
case MSG_SELECT_YESNO: { case MSG_SELECT_YESNO: {
player = BufferIO::ReadInt8(pbuf); player = BufferIO::ReadInt8(pbuf);
pbuf += 4; pbuf += (mainGame->dInfo.lua64) ? 8 : 4;
return ReadReplayResponse(); return ReadReplayResponse();
} }
case MSG_SELECT_OPTION: { case MSG_SELECT_OPTION: {
player = BufferIO::ReadInt8(pbuf); player = BufferIO::ReadInt8(pbuf);
count = BufferIO::ReadInt8(pbuf); count = BufferIO::ReadInt8(pbuf);
pbuf += count * 4; pbuf += count * (mainGame->dInfo.lua64) ? 8 : 4;
return ReadReplayResponse(); return ReadReplayResponse();
} }
case MSG_SELECT_CARD: case MSG_SELECT_CARD:
...@@ -512,7 +513,7 @@ bool ReplayMode::ReplayAnalyze(char* msg, unsigned int len) { ...@@ -512,7 +513,7 @@ bool ReplayMode::ReplayAnalyze(char* msg, unsigned int len) {
case MSG_SELECT_CHAIN: { case MSG_SELECT_CHAIN: {
player = BufferIO::ReadInt8(pbuf); player = BufferIO::ReadInt8(pbuf);
count = BufferIO::ReadInt8(pbuf); count = BufferIO::ReadInt8(pbuf);
pbuf += 10 + count * 13; pbuf += 10 + count * (mainGame->dInfo.lua64) ? 17 : 13;
return ReadReplayResponse(); return ReadReplayResponse();
} }
case MSG_SELECT_PLACE: case MSG_SELECT_PLACE:
...@@ -709,7 +710,7 @@ bool ReplayMode::ReplayAnalyze(char* msg, unsigned int len) { ...@@ -709,7 +710,7 @@ bool ReplayMode::ReplayAnalyze(char* msg, unsigned int len) {
break; break;
} }
case MSG_CHAINING: { case MSG_CHAINING: {
pbuf += 16; pbuf += (mainGame->dInfo.lua64) ? 20 : 16;
DuelClient::ClientAnalyze(offset, pbuf - offset); DuelClient::ClientAnalyze(offset, pbuf - offset);
break; break;
} }
...@@ -899,16 +900,16 @@ bool ReplayMode::ReplayAnalyze(char* msg, unsigned int len) { ...@@ -899,16 +900,16 @@ bool ReplayMode::ReplayAnalyze(char* msg, unsigned int len) {
case MSG_ANNOUNCE_CARD_FILTER: { case MSG_ANNOUNCE_CARD_FILTER: {
player = BufferIO::ReadInt8(pbuf); player = BufferIO::ReadInt8(pbuf);
count = BufferIO::ReadInt8(pbuf); count = BufferIO::ReadInt8(pbuf);
pbuf += 4 * count; pbuf += (mainGame->dInfo.lua64) ? 8 : 4 * count;
return ReadReplayResponse(); return ReadReplayResponse();
} }
case MSG_CARD_HINT: { case MSG_CARD_HINT: {
pbuf += 9; pbuf += (mainGame->dInfo.lua64) ? 13 : 9;
DuelClient::ClientAnalyze(offset, pbuf - offset); DuelClient::ClientAnalyze(offset, pbuf - offset);
break; break;
} }
case MSG_PLAYER_HINT: { case MSG_PLAYER_HINT: {
pbuf += 6; pbuf += (mainGame->dInfo.lua64) ? 10 : 6;
DuelClient::ClientAnalyze(offset, pbuf - offset); DuelClient::ClientAnalyze(offset, pbuf - offset);
break; break;
} }
......
...@@ -393,7 +393,7 @@ void SingleDuel::TPResult(DuelPlayer* dp, unsigned char tp) { ...@@ -393,7 +393,7 @@ void SingleDuel::TPResult(DuelPlayer* dp, unsigned char tp) {
ReplayHeader rh; ReplayHeader rh;
rh.id = 0x31707279; rh.id = 0x31707279;
rh.version = PRO_VERSION; rh.version = PRO_VERSION;
rh.flag = 0; rh.flag = REPLAY_LUA64;
time_t seed = time(0); time_t seed = time(0);
rh.seed = seed; rh.seed = seed;
last_replay.BeginRecord(); last_replay.BeginRecord();
......
...@@ -81,7 +81,7 @@ int SingleMode::SinglePlayThread(void* param) { ...@@ -81,7 +81,7 @@ int SingleMode::SinglePlayThread(void* param) {
ReplayHeader rh; ReplayHeader rh;
rh.id = 0x31707279; rh.id = 0x31707279;
rh.version = PRO_VERSION; rh.version = PRO_VERSION;
rh.flag = REPLAY_SINGLE_MODE; rh.flag = REPLAY_SINGLE_MODE + REPLAY_LUA64;
rh.seed = seed; rh.seed = seed;
mainGame->gMutex.Lock(); mainGame->gMutex.Lock();
mainGame->HideElement(mainGame->wSinglePlay); mainGame->HideElement(mainGame->wSinglePlay);
......
...@@ -352,7 +352,7 @@ void TagDuel::TPResult(DuelPlayer* dp, unsigned char tp) { ...@@ -352,7 +352,7 @@ void TagDuel::TPResult(DuelPlayer* dp, unsigned char tp) {
ReplayHeader rh; ReplayHeader rh;
rh.id = 0x31707279; rh.id = 0x31707279;
rh.version = PRO_VERSION; rh.version = PRO_VERSION;
rh.flag = REPLAY_TAG; rh.flag = REPLAY_TAG + REPLAY_LUA64;
time_t seed = time(0); time_t seed = time(0);
rh.seed = seed; rh.seed = seed;
last_replay.BeginRecord(); last_replay.BeginRecord();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment