Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Y
ygopro
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
MyCard
ygopro
Commits
ccdba4e7
Commit
ccdba4e7
authored
Dec 14, 2023
by
Chen Bill
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update class ReplayMode
parent
905bb0d9
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
48 additions
and
66 deletions
+48
-66
gframe/config.h
gframe/config.h
+0
-1
gframe/replay.h
gframe/replay.h
+1
-2
gframe/replay_mode.cpp
gframe/replay_mode.cpp
+43
-59
gframe/replay_mode.h
gframe/replay_mode.h
+4
-4
No files found.
gframe/config.h
View file @
ccdba4e7
...
@@ -69,7 +69,6 @@ inline int myswprintf(wchar_t(&buf)[N], const wchar_t* fmt, TR... args) {
...
@@ -69,7 +69,6 @@ inline int myswprintf(wchar_t(&buf)[N], const wchar_t* fmt, TR... args) {
#include <iostream>
#include <iostream>
#include <stdio.h>
#include <stdio.h>
#include <stdlib.h>
#include <stdlib.h>
#include <memory.h>
#include <time.h>
#include <time.h>
#include <thread>
#include <thread>
#include <mutex>
#include <mutex>
...
...
gframe/replay.h
View file @
ccdba4e7
...
@@ -2,7 +2,6 @@
...
@@ -2,7 +2,6 @@
#define REPLAY_H
#define REPLAY_H
#include "config.h"
#include "config.h"
#include <time.h>
namespace
ygo
{
namespace
ygo
{
...
@@ -53,7 +52,7 @@ public:
...
@@ -53,7 +52,7 @@ public:
static
bool
RenameReplay
(
const
wchar_t
*
oldname
,
const
wchar_t
*
newname
);
static
bool
RenameReplay
(
const
wchar_t
*
oldname
,
const
wchar_t
*
newname
);
bool
ReadNextResponse
(
unsigned
char
resp
[
64
]);
bool
ReadNextResponse
(
unsigned
char
resp
[
64
]);
void
ReadName
(
wchar_t
*
data
);
void
ReadName
(
wchar_t
*
data
);
void
ReadHeader
(
ReplayHeader
&
header
);
//
void ReadHeader(ReplayHeader& header);
void
ReadData
(
void
*
data
,
int
length
);
void
ReadData
(
void
*
data
,
int
length
);
int
ReadInt32
();
int
ReadInt32
();
short
ReadInt16
();
short
ReadInt16
();
...
...
gframe/replay_mode.cpp
View file @
ccdba4e7
#include "replay_mode.h"
#include "replay_mode.h"
#include "duelclient.h"
#include "duelclient.h"
#include "game.h"
#include "game.h"
#include "single_mode.h"
#include "../ocgcore/common.h"
#include "../ocgcore/common.h"
#include "../ocgcore/mtrandom.h"
#include "../ocgcore/mtrandom.h"
...
@@ -75,7 +74,7 @@ int ReplayMode::ReplayThread() {
...
@@ -75,7 +74,7 @@ int ReplayMode::ReplayThread() {
mainGame
->
dInfo
.
isReplay
=
true
;
mainGame
->
dInfo
.
isReplay
=
true
;
mainGame
->
dInfo
.
isReplaySkiping
=
(
skip_turn
>
0
);
mainGame
->
dInfo
.
isReplaySkiping
=
(
skip_turn
>
0
);
std
::
vector
<
char
>
engineBuffer
;
std
::
vector
<
char
>
engineBuffer
;
engineBuffer
.
resize
(
MESSAGE_BUFFER_SIZE
);
engineBuffer
.
resize
(
SIZE_MESSAGE_BUFFER
);
is_continuing
=
true
;
is_continuing
=
true
;
skip_step
=
0
;
skip_step
=
0
;
if
(
mainGame
->
dInfo
.
isSingleMode
)
{
if
(
mainGame
->
dInfo
.
isSingleMode
)
{
...
@@ -874,77 +873,62 @@ bool ReplayMode::ReplayAnalyze(char* msg, unsigned int len) {
...
@@ -874,77 +873,62 @@ bool ReplayMode::ReplayAnalyze(char* msg, unsigned int len) {
}
}
return
true
;
return
true
;
}
}
void
ReplayMode
::
ReloadLocation
(
int
player
,
int
location
,
int
flag
,
std
::
vector
<
unsigned
char
>&
queryBuffer
)
{
query_field_card
(
pduel
,
player
,
location
,
flag
,
queryBuffer
.
data
(),
0
);
mainGame
->
dField
.
UpdateFieldCard
(
mainGame
->
LocalPlayer
(
player
),
location
,
(
char
*
)
queryBuffer
.
data
());
}
void
ReplayMode
::
RefreshLocation
(
int
player
,
int
location
,
int
flag
)
{
std
::
vector
<
unsigned
char
>
queryBuffer
;
queryBuffer
.
reserve
(
SIZE_QUERY_BUFFER
);
ReloadLocation
(
player
,
location
,
flag
,
queryBuffer
);
}
void
ReplayMode
::
ReplayRefresh
(
int
flag
)
{
void
ReplayMode
::
ReplayRefresh
(
int
flag
)
{
unsigned
char
queryBuffer
[
0x4000
];
std
::
vector
<
byte
>
queryBuffer
;
/*int len = */
query_field_card
(
pduel
,
0
,
LOCATION_MZONE
,
flag
,
queryBuffer
,
0
);
queryBuffer
.
reserve
(
SIZE_QUERY_BUFFER
);
mainGame
->
dField
.
UpdateFieldCard
(
mainGame
->
LocalPlayer
(
0
),
LOCATION_MZONE
,
(
char
*
)
queryBuffer
);
ReloadLocation
(
0
,
LOCATION_MZONE
,
flag
,
queryBuffer
);
/*len = */
query_field_card
(
pduel
,
1
,
LOCATION_MZONE
,
flag
,
queryBuffer
,
0
);
ReloadLocation
(
1
,
LOCATION_MZONE
,
flag
,
queryBuffer
);
mainGame
->
dField
.
UpdateFieldCard
(
mainGame
->
LocalPlayer
(
1
),
LOCATION_MZONE
,
(
char
*
)
queryBuffer
);
ReloadLocation
(
0
,
LOCATION_SZONE
,
flag
,
queryBuffer
);
/*len = */
query_field_card
(
pduel
,
0
,
LOCATION_SZONE
,
flag
,
queryBuffer
,
0
);
ReloadLocation
(
1
,
LOCATION_SZONE
,
flag
,
queryBuffer
);
mainGame
->
dField
.
UpdateFieldCard
(
mainGame
->
LocalPlayer
(
0
),
LOCATION_SZONE
,
(
char
*
)
queryBuffer
);
ReloadLocation
(
0
,
LOCATION_HAND
,
flag
,
queryBuffer
);
/*len = */
query_field_card
(
pduel
,
1
,
LOCATION_SZONE
,
flag
,
queryBuffer
,
0
);
ReloadLocation
(
1
,
LOCATION_HAND
,
flag
,
queryBuffer
);
mainGame
->
dField
.
UpdateFieldCard
(
mainGame
->
LocalPlayer
(
1
),
LOCATION_SZONE
,
(
char
*
)
queryBuffer
);
/*len = */
query_field_card
(
pduel
,
0
,
LOCATION_HAND
,
flag
,
queryBuffer
,
0
);
mainGame
->
dField
.
UpdateFieldCard
(
mainGame
->
LocalPlayer
(
0
),
LOCATION_HAND
,
(
char
*
)
queryBuffer
);
/*len = */
query_field_card
(
pduel
,
1
,
LOCATION_HAND
,
flag
,
queryBuffer
,
0
);
mainGame
->
dField
.
UpdateFieldCard
(
mainGame
->
LocalPlayer
(
1
),
LOCATION_HAND
,
(
char
*
)
queryBuffer
);
}
}
void
ReplayMode
::
ReplayRefreshHand
(
int
player
,
int
flag
)
{
void
ReplayMode
::
ReplayRefreshHand
(
int
player
,
int
flag
)
{
unsigned
char
queryBuffer
[
0x2000
];
RefreshLocation
(
player
,
LOCATION_HAND
,
flag
);
/*int len = */
query_field_card
(
pduel
,
player
,
LOCATION_HAND
,
flag
,
queryBuffer
,
0
);
mainGame
->
dField
.
UpdateFieldCard
(
mainGame
->
LocalPlayer
(
player
),
LOCATION_HAND
,
(
char
*
)
queryBuffer
);
}
}
void
ReplayMode
::
ReplayRefreshGrave
(
int
player
,
int
flag
)
{
void
ReplayMode
::
ReplayRefreshGrave
(
int
player
,
int
flag
)
{
unsigned
char
queryBuffer
[
0x2000
];
RefreshLocation
(
player
,
LOCATION_GRAVE
,
flag
);
/*int len = */
query_field_card
(
pduel
,
player
,
LOCATION_GRAVE
,
flag
,
queryBuffer
,
0
);
mainGame
->
dField
.
UpdateFieldCard
(
mainGame
->
LocalPlayer
(
player
),
LOCATION_GRAVE
,
(
char
*
)
queryBuffer
);
}
}
void
ReplayMode
::
ReplayRefreshDeck
(
int
player
,
int
flag
)
{
void
ReplayMode
::
ReplayRefreshDeck
(
int
player
,
int
flag
)
{
unsigned
char
queryBuffer
[
0x2000
];
RefreshLocation
(
player
,
LOCATION_DECK
,
flag
);
/*int len = */
query_field_card
(
pduel
,
player
,
LOCATION_DECK
,
flag
,
queryBuffer
,
0
);
mainGame
->
dField
.
UpdateFieldCard
(
mainGame
->
LocalPlayer
(
player
),
LOCATION_DECK
,
(
char
*
)
queryBuffer
);
}
}
void
ReplayMode
::
ReplayRefreshExtra
(
int
player
,
int
flag
)
{
void
ReplayMode
::
ReplayRefreshExtra
(
int
player
,
int
flag
)
{
unsigned
char
queryBuffer
[
0x2000
];
RefreshLocation
(
player
,
LOCATION_EXTRA
,
flag
);
/*int len = */
query_field_card
(
pduel
,
player
,
LOCATION_EXTRA
,
flag
,
queryBuffer
,
0
);
mainGame
->
dField
.
UpdateFieldCard
(
mainGame
->
LocalPlayer
(
player
),
LOCATION_EXTRA
,
(
char
*
)
queryBuffer
);
}
}
void
ReplayMode
::
ReplayRefreshSingle
(
int
player
,
int
location
,
int
sequence
,
int
flag
)
{
void
ReplayMode
::
ReplayRefreshSingle
(
int
player
,
int
location
,
int
sequence
,
int
flag
)
{
unsigned
char
queryBuffer
[
0x4000
];
std
::
vector
<
unsigned
char
>
queryBuffer
;
/*int len = */
query_card
(
pduel
,
player
,
location
,
sequence
,
flag
,
queryBuffer
,
0
);
queryBuffer
.
reserve
(
SIZE_QUERY_BUFFER
);
mainGame
->
dField
.
UpdateCard
(
mainGame
->
LocalPlayer
(
player
),
location
,
sequence
,
(
char
*
)
queryBuffer
);
/*int len = */
query_card
(
pduel
,
player
,
location
,
sequence
,
flag
,
queryBuffer
.
data
(),
0
);
mainGame
->
dField
.
UpdateCard
(
mainGame
->
LocalPlayer
(
player
),
location
,
sequence
,
(
char
*
)
queryBuffer
.
data
());
}
}
void
ReplayMode
::
ReplayReload
()
{
void
ReplayMode
::
ReplayReload
()
{
unsigned
char
queryBuffer
[
0x4000
];
std
::
vector
<
unsigned
char
>
queryBuffer
;
queryBuffer
.
reserve
(
SIZE_QUERY_BUFFER
);
unsigned
int
flag
=
0xffdfff
;
unsigned
int
flag
=
0xffdfff
;
/*int len = */
query_field_card
(
pduel
,
0
,
LOCATION_MZONE
,
flag
,
queryBuffer
,
0
);
ReloadLocation
(
0
,
LOCATION_MZONE
,
flag
,
queryBuffer
);
mainGame
->
dField
.
UpdateFieldCard
(
mainGame
->
LocalPlayer
(
0
),
LOCATION_MZONE
,
(
char
*
)
queryBuffer
);
ReloadLocation
(
1
,
LOCATION_MZONE
,
flag
,
queryBuffer
);
/*len = */
query_field_card
(
pduel
,
1
,
LOCATION_MZONE
,
flag
,
queryBuffer
,
0
);
ReloadLocation
(
0
,
LOCATION_SZONE
,
flag
,
queryBuffer
);
mainGame
->
dField
.
UpdateFieldCard
(
mainGame
->
LocalPlayer
(
1
),
LOCATION_MZONE
,
(
char
*
)
queryBuffer
);
ReloadLocation
(
1
,
LOCATION_SZONE
,
flag
,
queryBuffer
);
/*len = */
query_field_card
(
pduel
,
0
,
LOCATION_SZONE
,
flag
,
queryBuffer
,
0
);
ReloadLocation
(
0
,
LOCATION_HAND
,
flag
,
queryBuffer
);
mainGame
->
dField
.
UpdateFieldCard
(
mainGame
->
LocalPlayer
(
0
),
LOCATION_SZONE
,
(
char
*
)
queryBuffer
);
ReloadLocation
(
1
,
LOCATION_HAND
,
flag
,
queryBuffer
);
/*len = */
query_field_card
(
pduel
,
1
,
LOCATION_SZONE
,
flag
,
queryBuffer
,
0
);
mainGame
->
dField
.
UpdateFieldCard
(
mainGame
->
LocalPlayer
(
1
),
LOCATION_SZONE
,
(
char
*
)
queryBuffer
);
ReloadLocation
(
0
,
LOCATION_DECK
,
flag
,
queryBuffer
);
/*len = */
query_field_card
(
pduel
,
0
,
LOCATION_HAND
,
flag
,
queryBuffer
,
0
);
ReloadLocation
(
1
,
LOCATION_DECK
,
flag
,
queryBuffer
);
mainGame
->
dField
.
UpdateFieldCard
(
mainGame
->
LocalPlayer
(
0
),
LOCATION_HAND
,
(
char
*
)
queryBuffer
);
ReloadLocation
(
0
,
LOCATION_EXTRA
,
flag
,
queryBuffer
);
/*len = */
query_field_card
(
pduel
,
1
,
LOCATION_HAND
,
flag
,
queryBuffer
,
0
);
ReloadLocation
(
1
,
LOCATION_EXTRA
,
flag
,
queryBuffer
);
mainGame
->
dField
.
UpdateFieldCard
(
mainGame
->
LocalPlayer
(
1
),
LOCATION_HAND
,
(
char
*
)
queryBuffer
);
ReloadLocation
(
0
,
LOCATION_GRAVE
,
flag
,
queryBuffer
);
/*len = */
query_field_card
(
pduel
,
0
,
LOCATION_DECK
,
flag
,
queryBuffer
,
0
);
ReloadLocation
(
1
,
LOCATION_GRAVE
,
flag
,
queryBuffer
);
mainGame
->
dField
.
UpdateFieldCard
(
mainGame
->
LocalPlayer
(
0
),
LOCATION_DECK
,
(
char
*
)
queryBuffer
);
ReloadLocation
(
0
,
LOCATION_REMOVED
,
flag
,
queryBuffer
);
/*len = */
query_field_card
(
pduel
,
1
,
LOCATION_DECK
,
flag
,
queryBuffer
,
0
);
ReloadLocation
(
1
,
LOCATION_REMOVED
,
flag
,
queryBuffer
);
mainGame
->
dField
.
UpdateFieldCard
(
mainGame
->
LocalPlayer
(
1
),
LOCATION_DECK
,
(
char
*
)
queryBuffer
);
/*len = */
query_field_card
(
pduel
,
0
,
LOCATION_EXTRA
,
flag
,
queryBuffer
,
0
);
mainGame
->
dField
.
UpdateFieldCard
(
mainGame
->
LocalPlayer
(
0
),
LOCATION_EXTRA
,
(
char
*
)
queryBuffer
);
/*len = */
query_field_card
(
pduel
,
1
,
LOCATION_EXTRA
,
flag
,
queryBuffer
,
0
);
mainGame
->
dField
.
UpdateFieldCard
(
mainGame
->
LocalPlayer
(
1
),
LOCATION_EXTRA
,
(
char
*
)
queryBuffer
);
/*len = */
query_field_card
(
pduel
,
0
,
LOCATION_GRAVE
,
flag
,
queryBuffer
,
0
);
mainGame
->
dField
.
UpdateFieldCard
(
mainGame
->
LocalPlayer
(
0
),
LOCATION_GRAVE
,
(
char
*
)
queryBuffer
);
/*len = */
query_field_card
(
pduel
,
1
,
LOCATION_GRAVE
,
flag
,
queryBuffer
,
0
);
mainGame
->
dField
.
UpdateFieldCard
(
mainGame
->
LocalPlayer
(
1
),
LOCATION_GRAVE
,
(
char
*
)
queryBuffer
);
/*len = */
query_field_card
(
pduel
,
0
,
LOCATION_REMOVED
,
flag
,
queryBuffer
,
0
);
mainGame
->
dField
.
UpdateFieldCard
(
mainGame
->
LocalPlayer
(
0
),
LOCATION_REMOVED
,
(
char
*
)
queryBuffer
);
/*len = */
query_field_card
(
pduel
,
1
,
LOCATION_REMOVED
,
flag
,
queryBuffer
,
0
);
mainGame
->
dField
.
UpdateFieldCard
(
mainGame
->
LocalPlayer
(
1
),
LOCATION_REMOVED
,
(
char
*
)
queryBuffer
);
}
}
int
ReplayMode
::
MessageHandler
(
intptr_t
fduel
,
int
type
)
{
int
ReplayMode
::
MessageHandler
(
intptr_t
fduel
,
int
type
)
{
if
(
!
enable_log
)
if
(
!
enable_log
)
...
...
gframe/replay_mode.h
View file @
ccdba4e7
#ifndef REPLAY_MODE_H
#ifndef REPLAY_MODE_H
#define REPLAY_MODE_H
#define REPLAY_MODE_H
#include "config.h"
#include <stdint.h>
#include "data_manager.h"
#include <vector>
#include "deck_manager.h"
#include "replay.h"
#include "replay.h"
#include "../ocgcore/mtrandom.h"
namespace
ygo
{
namespace
ygo
{
...
@@ -39,6 +37,8 @@ public:
...
@@ -39,6 +37,8 @@ public:
static
void
Undo
();
static
void
Undo
();
static
bool
ReplayAnalyze
(
char
*
msg
,
unsigned
int
len
);
static
bool
ReplayAnalyze
(
char
*
msg
,
unsigned
int
len
);
inline
static
void
ReloadLocation
(
int
player
,
int
location
,
int
flag
,
std
::
vector
<
unsigned
char
>&
queryBuffer
);
inline
static
void
RefreshLocation
(
int
player
,
int
location
,
int
flag
);
static
void
ReplayRefresh
(
int
flag
=
0xf81fff
);
static
void
ReplayRefresh
(
int
flag
=
0xf81fff
);
static
void
ReplayRefreshHand
(
int
player
,
int
flag
=
0x781fff
);
static
void
ReplayRefreshHand
(
int
player
,
int
flag
=
0x781fff
);
static
void
ReplayRefreshGrave
(
int
player
,
int
flag
=
0x181fff
);
static
void
ReplayRefreshGrave
(
int
player
,
int
flag
=
0x181fff
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment