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
List
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
nanahira
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
Hide 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) {
#include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include <memory.h>
#include <time.h>
#include <thread>
#include <mutex>
...
...
gframe/replay.h
View file @
ccdba4e7
...
...
@@ -2,7 +2,6 @@
#define REPLAY_H
#include "config.h"
#include <time.h>
namespace
ygo
{
...
...
@@ -53,7 +52,7 @@ public:
static
bool
RenameReplay
(
const
wchar_t
*
oldname
,
const
wchar_t
*
newname
);
bool
ReadNextResponse
(
unsigned
char
resp
[
64
]);
void
ReadName
(
wchar_t
*
data
);
void
ReadHeader
(
ReplayHeader
&
header
);
//
void ReadHeader(ReplayHeader& header);
void
ReadData
(
void
*
data
,
int
length
);
int
ReadInt32
();
short
ReadInt16
();
...
...
gframe/replay_mode.cpp
View file @
ccdba4e7
#include "replay_mode.h"
#include "duelclient.h"
#include "game.h"
#include "single_mode.h"
#include "../ocgcore/common.h"
#include "../ocgcore/mtrandom.h"
...
...
@@ -75,7 +74,7 @@ int ReplayMode::ReplayThread() {
mainGame
->
dInfo
.
isReplay
=
true
;
mainGame
->
dInfo
.
isReplaySkiping
=
(
skip_turn
>
0
);
std
::
vector
<
char
>
engineBuffer
;
engineBuffer
.
resize
(
MESSAGE_BUFFER_SIZE
);
engineBuffer
.
resize
(
SIZE_MESSAGE_BUFFER
);
is_continuing
=
true
;
skip_step
=
0
;
if
(
mainGame
->
dInfo
.
isSingleMode
)
{
...
...
@@ -874,77 +873,62 @@ bool ReplayMode::ReplayAnalyze(char* msg, unsigned int len) {
}
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
)
{
unsigned
char
queryBuffer
[
0x4000
];
/*int len = */
query_field_card
(
pduel
,
0
,
LOCATION_MZONE
,
flag
,
queryBuffer
,
0
);
mainGame
->
dField
.
UpdateFieldCard
(
mainGame
->
LocalPlayer
(
0
),
LOCATION_MZONE
,
(
char
*
)
queryBuffer
);
/*len = */
query_field_card
(
pduel
,
1
,
LOCATION_MZONE
,
flag
,
queryBuffer
,
0
);
mainGame
->
dField
.
UpdateFieldCard
(
mainGame
->
LocalPlayer
(
1
),
LOCATION_MZONE
,
(
char
*
)
queryBuffer
);
/*len = */
query_field_card
(
pduel
,
0
,
LOCATION_SZONE
,
flag
,
queryBuffer
,
0
);
mainGame
->
dField
.
UpdateFieldCard
(
mainGame
->
LocalPlayer
(
0
),
LOCATION_SZONE
,
(
char
*
)
queryBuffer
);
/*len = */
query_field_card
(
pduel
,
1
,
LOCATION_SZONE
,
flag
,
queryBuffer
,
0
);
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
);
std
::
vector
<
byte
>
queryBuffer
;
queryBuffer
.
reserve
(
SIZE_QUERY_BUFFER
);
ReloadLocation
(
0
,
LOCATION_MZONE
,
flag
,
queryBuffer
);
ReloadLocation
(
1
,
LOCATION_MZONE
,
flag
,
queryBuffer
);
ReloadLocation
(
0
,
LOCATION_SZONE
,
flag
,
queryBuffer
);
ReloadLocation
(
1
,
LOCATION_SZONE
,
flag
,
queryBuffer
);
ReloadLocation
(
0
,
LOCATION_HAND
,
flag
,
queryBuffer
);
ReloadLocation
(
1
,
LOCATION_HAND
,
flag
,
queryBuffer
);
}
void
ReplayMode
::
ReplayRefreshHand
(
int
player
,
int
flag
)
{
unsigned
char
queryBuffer
[
0x2000
];
/*int len = */
query_field_card
(
pduel
,
player
,
LOCATION_HAND
,
flag
,
queryBuffer
,
0
);
mainGame
->
dField
.
UpdateFieldCard
(
mainGame
->
LocalPlayer
(
player
),
LOCATION_HAND
,
(
char
*
)
queryBuffer
);
RefreshLocation
(
player
,
LOCATION_HAND
,
flag
);
}
void
ReplayMode
::
ReplayRefreshGrave
(
int
player
,
int
flag
)
{
unsigned
char
queryBuffer
[
0x2000
];
/*int len = */
query_field_card
(
pduel
,
player
,
LOCATION_GRAVE
,
flag
,
queryBuffer
,
0
);
mainGame
->
dField
.
UpdateFieldCard
(
mainGame
->
LocalPlayer
(
player
),
LOCATION_GRAVE
,
(
char
*
)
queryBuffer
);
RefreshLocation
(
player
,
LOCATION_GRAVE
,
flag
);
}
void
ReplayMode
::
ReplayRefreshDeck
(
int
player
,
int
flag
)
{
unsigned
char
queryBuffer
[
0x2000
];
/*int len = */
query_field_card
(
pduel
,
player
,
LOCATION_DECK
,
flag
,
queryBuffer
,
0
);
mainGame
->
dField
.
UpdateFieldCard
(
mainGame
->
LocalPlayer
(
player
),
LOCATION_DECK
,
(
char
*
)
queryBuffer
);
RefreshLocation
(
player
,
LOCATION_DECK
,
flag
);
}
void
ReplayMode
::
ReplayRefreshExtra
(
int
player
,
int
flag
)
{
unsigned
char
queryBuffer
[
0x2000
];
/*int len = */
query_field_card
(
pduel
,
player
,
LOCATION_EXTRA
,
flag
,
queryBuffer
,
0
);
mainGame
->
dField
.
UpdateFieldCard
(
mainGame
->
LocalPlayer
(
player
),
LOCATION_EXTRA
,
(
char
*
)
queryBuffer
);
RefreshLocation
(
player
,
LOCATION_EXTRA
,
flag
);
}
void
ReplayMode
::
ReplayRefreshSingle
(
int
player
,
int
location
,
int
sequence
,
int
flag
)
{
unsigned
char
queryBuffer
[
0x4000
];
/*int len = */
query_card
(
pduel
,
player
,
location
,
sequence
,
flag
,
queryBuffer
,
0
);
mainGame
->
dField
.
UpdateCard
(
mainGame
->
LocalPlayer
(
player
),
location
,
sequence
,
(
char
*
)
queryBuffer
);
std
::
vector
<
unsigned
char
>
queryBuffer
;
queryBuffer
.
reserve
(
SIZE_QUERY_BUFFER
);
/*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
()
{
unsigned
char
queryBuffer
[
0x4000
];
std
::
vector
<
unsigned
char
>
queryBuffer
;
queryBuffer
.
reserve
(
SIZE_QUERY_BUFFER
);
unsigned
int
flag
=
0xffdfff
;
/*int len = */
query_field_card
(
pduel
,
0
,
LOCATION_MZONE
,
flag
,
queryBuffer
,
0
);
mainGame
->
dField
.
UpdateFieldCard
(
mainGame
->
LocalPlayer
(
0
),
LOCATION_MZONE
,
(
char
*
)
queryBuffer
);
/*len = */
query_field_card
(
pduel
,
1
,
LOCATION_MZONE
,
flag
,
queryBuffer
,
0
);
mainGame
->
dField
.
UpdateFieldCard
(
mainGame
->
LocalPlayer
(
1
),
LOCATION_MZONE
,
(
char
*
)
queryBuffer
);
/*len = */
query_field_card
(
pduel
,
0
,
LOCATION_SZONE
,
flag
,
queryBuffer
,
0
);
mainGame
->
dField
.
UpdateFieldCard
(
mainGame
->
LocalPlayer
(
0
),
LOCATION_SZONE
,
(
char
*
)
queryBuffer
);
/*len = */
query_field_card
(
pduel
,
1
,
LOCATION_SZONE
,
flag
,
queryBuffer
,
0
);
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
);
/*len = */
query_field_card
(
pduel
,
0
,
LOCATION_DECK
,
flag
,
queryBuffer
,
0
);
mainGame
->
dField
.
UpdateFieldCard
(
mainGame
->
LocalPlayer
(
0
),
LOCATION_DECK
,
(
char
*
)
queryBuffer
);
/*len = */
query_field_card
(
pduel
,
1
,
LOCATION_DECK
,
flag
,
queryBuffer
,
0
);
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
);
ReloadLocation
(
0
,
LOCATION_MZONE
,
flag
,
queryBuffer
);
ReloadLocation
(
1
,
LOCATION_MZONE
,
flag
,
queryBuffer
);
ReloadLocation
(
0
,
LOCATION_SZONE
,
flag
,
queryBuffer
);
ReloadLocation
(
1
,
LOCATION_SZONE
,
flag
,
queryBuffer
);
ReloadLocation
(
0
,
LOCATION_HAND
,
flag
,
queryBuffer
);
ReloadLocation
(
1
,
LOCATION_HAND
,
flag
,
queryBuffer
);
ReloadLocation
(
0
,
LOCATION_DECK
,
flag
,
queryBuffer
);
ReloadLocation
(
1
,
LOCATION_DECK
,
flag
,
queryBuffer
);
ReloadLocation
(
0
,
LOCATION_EXTRA
,
flag
,
queryBuffer
);
ReloadLocation
(
1
,
LOCATION_EXTRA
,
flag
,
queryBuffer
);
ReloadLocation
(
0
,
LOCATION_GRAVE
,
flag
,
queryBuffer
);
ReloadLocation
(
1
,
LOCATION_GRAVE
,
flag
,
queryBuffer
);
ReloadLocation
(
0
,
LOCATION_REMOVED
,
flag
,
queryBuffer
);
ReloadLocation
(
1
,
LOCATION_REMOVED
,
flag
,
queryBuffer
);
}
int
ReplayMode
::
MessageHandler
(
intptr_t
fduel
,
int
type
)
{
if
(
!
enable_log
)
...
...
gframe/replay_mode.h
View file @
ccdba4e7
#ifndef REPLAY_MODE_H
#define REPLAY_MODE_H
#include "config.h"
#include "data_manager.h"
#include "deck_manager.h"
#include <stdint.h>
#include <vector>
#include "replay.h"
#include "../ocgcore/mtrandom.h"
namespace
ygo
{
...
...
@@ -39,6 +37,8 @@ public:
static
void
Undo
();
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
ReplayRefreshHand
(
int
player
,
int
flag
=
0x781fff
);
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