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
赤子奈落
ygopro
Commits
d884e77c
Commit
d884e77c
authored
Dec 30, 2024
by
nanahira
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of github.com:Fluorohydride/ygopro
parents
aa01e901
cc18709f
Changes
8
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
469 additions
and
92 deletions
+469
-92
gframe/replay.cpp
gframe/replay.cpp
+18
-37
gframe/replay.h
gframe/replay.h
+15
-12
gframe/replay_mode.cpp
gframe/replay_mode.cpp
+2
-2
gframe/single_duel.cpp
gframe/single_duel.cpp
+1
-1
gframe/single_mode.cpp
gframe/single_mode.cpp
+2
-2
gframe/tag_duel.cpp
gframe/tag_duel.cpp
+1
-1
lflist.conf
lflist.conf
+428
-35
strings.conf
strings.conf
+2
-2
No files found.
gframe/replay.cpp
View file @
d884e77c
...
@@ -28,7 +28,6 @@ void Replay::BeginRecord() {
...
@@ -28,7 +28,6 @@ void Replay::BeginRecord() {
if
(
!
fp
)
if
(
!
fp
)
return
;
return
;
#endif
#endif
pwrite
=
replay_data
;
replay_size
=
0
;
replay_size
=
0
;
comp_size
=
0
;
comp_size
=
0
;
is_replaying
=
false
;
is_replaying
=
false
;
...
@@ -44,13 +43,13 @@ void Replay::WriteHeader(ReplayHeader& header) {
...
@@ -44,13 +43,13 @@ void Replay::WriteHeader(ReplayHeader& header) {
fflush
(
fp
);
fflush
(
fp
);
#endif
#endif
}
}
void
Replay
::
WriteData
(
const
void
*
data
,
in
t
length
,
bool
flush
)
{
void
Replay
::
WriteData
(
const
void
*
data
,
size_
t
length
,
bool
flush
)
{
if
(
!
is_recording
)
if
(
!
is_recording
)
return
;
return
;
if
(
length
<
0
||
(
int
)(
pwrite
-
replay_data
)
+
length
>
MAX_REPLAY_SIZE
)
if
(
replay_size
+
length
>
MAX_REPLAY_SIZE
)
return
;
return
;
std
::
memcpy
(
pwrit
e
,
data
,
length
);
std
::
memcpy
(
replay_data
+
replay_siz
e
,
data
,
length
);
pwrit
e
+=
length
;
replay_siz
e
+=
length
;
#ifdef _WIN32
#ifdef _WIN32
DWORD
size
;
DWORD
size
;
WriteFile
(
recording_fp
,
data
,
length
,
&
size
,
nullptr
);
WriteFile
(
recording_fp
,
data
,
length
,
&
size
,
nullptr
);
...
@@ -60,14 +59,8 @@ void Replay::WriteData(const void* data, int length, bool flush) {
...
@@ -60,14 +59,8 @@ void Replay::WriteData(const void* data, int length, bool flush) {
fflush
(
fp
);
fflush
(
fp
);
#endif
#endif
}
}
void
Replay
::
WriteInt32
(
int
data
,
bool
flush
)
{
void
Replay
::
WriteInt32
(
int32_t
data
,
bool
flush
)
{
WriteData
(
&
data
,
sizeof
data
,
flush
);
Write
<
int32_t
>
(
data
,
flush
);
}
void
Replay
::
WriteInt16
(
short
data
,
bool
flush
)
{
WriteData
(
&
data
,
sizeof
data
,
flush
);
}
void
Replay
::
WriteInt8
(
char
data
,
bool
flush
)
{
WriteData
(
&
data
,
sizeof
data
,
flush
);
}
}
void
Replay
::
Flush
()
{
void
Replay
::
Flush
()
{
if
(
!
is_recording
)
if
(
!
is_recording
)
...
@@ -85,7 +78,6 @@ void Replay::EndRecord() {
...
@@ -85,7 +78,6 @@ void Replay::EndRecord() {
#else
#else
fclose
(
fp
);
fclose
(
fp
);
#endif
#endif
replay_size
=
pwrite
-
replay_data
;
pheader
.
datasize
=
replay_size
;
pheader
.
datasize
=
replay_size
;
pheader
.
flag
|=
REPLAY_COMPRESSED
;
pheader
.
flag
|=
REPLAY_COMPRESSED
;
size_t
propsize
=
5
;
size_t
propsize
=
5
;
...
@@ -119,7 +111,7 @@ bool Replay::OpenReplay(const wchar_t* name) {
...
@@ -119,7 +111,7 @@ bool Replay::OpenReplay(const wchar_t* name) {
if
(
!
rfp
)
if
(
!
rfp
)
return
false
;
return
false
;
pdata
=
replay_data
;
data_position
=
0
;
is_recording
=
false
;
is_recording
=
false
;
is_replaying
=
false
;
is_replaying
=
false
;
replay_size
=
0
;
replay_size
=
0
;
...
@@ -209,37 +201,26 @@ bool Replay::ReadName(wchar_t* data) {
...
@@ -209,37 +201,26 @@ bool Replay::ReadName(wchar_t* data) {
BufferIO
::
CopyWStr
(
buffer
,
data
,
20
);
BufferIO
::
CopyWStr
(
buffer
,
data
,
20
);
return
true
;
return
true
;
}
}
bool
Replay
::
ReadData
(
void
*
data
,
int
length
)
{
void
Replay
::
ReadHeader
(
ReplayHeader
&
header
)
{
header
=
pheader
;
}
bool
Replay
::
ReadData
(
void
*
data
,
size_t
length
)
{
if
(
!
is_replaying
)
if
(
!
is_replaying
)
return
false
;
return
false
;
if
(
length
<
0
)
if
(
data_position
+
length
>
replay_size
)
{
return
false
;
if
((
int
)(
pdata
-
replay_data
)
+
length
>
(
int
)
replay_size
)
{
is_replaying
=
false
;
is_replaying
=
false
;
return
false
;
return
false
;
}
}
std
::
memcpy
(
data
,
pdata
,
length
);
if
(
length
)
pdata
+=
length
;
std
::
memcpy
(
data
,
&
replay_data
[
data_position
],
length
);
data_position
+=
length
;
return
true
;
return
true
;
}
}
template
<
typename
T
>
int32_t
Replay
::
ReadInt32
()
{
T
Replay
::
ReadValue
()
{
return
Read
<
int32_t
>
();
T
ret
{};
if
(
!
ReadData
(
&
ret
,
sizeof
ret
))
return
-
1
;
return
ret
;
}
int
Replay
::
ReadInt32
()
{
return
ReadValue
<
int32_t
>
();
}
short
Replay
::
ReadInt16
()
{
return
ReadValue
<
int16_t
>
();
}
char
Replay
::
ReadInt8
()
{
return
ReadValue
<
char
>
();
}
}
void
Replay
::
Rewind
()
{
void
Replay
::
Rewind
()
{
pdata
=
replay_data
;
data_position
=
0
;
}
}
}
}
gframe/replay.h
View file @
d884e77c
...
@@ -34,10 +34,12 @@ public:
...
@@ -34,10 +34,12 @@ public:
// record
// record
void
BeginRecord
();
void
BeginRecord
();
void
WriteHeader
(
ReplayHeader
&
header
);
void
WriteHeader
(
ReplayHeader
&
header
);
void
WriteData
(
const
void
*
data
,
int
length
,
bool
flush
=
true
);
void
WriteData
(
const
void
*
data
,
size_t
length
,
bool
flush
=
true
);
void
WriteInt32
(
int
data
,
bool
flush
=
true
);
template
<
typename
T
>
void
WriteInt16
(
short
data
,
bool
flush
=
true
);
void
Write
(
T
data
,
bool
flush
=
true
)
{
void
WriteInt8
(
char
data
,
bool
flush
=
true
);
WriteData
(
&
data
,
sizeof
(
T
),
flush
);
}
void
WriteInt32
(
int32_t
data
,
bool
flush
=
true
);
void
Flush
();
void
Flush
();
void
EndRecord
();
void
EndRecord
();
void
SaveReplay
(
const
wchar_t
*
name
);
void
SaveReplay
(
const
wchar_t
*
name
);
...
@@ -49,13 +51,15 @@ public:
...
@@ -49,13 +51,15 @@ 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
[]);
bool
ReadNextResponse
(
unsigned
char
resp
[]);
bool
ReadName
(
wchar_t
*
data
);
bool
ReadName
(
wchar_t
*
data
);
//
void ReadHeader(ReplayHeader& header);
void
ReadHeader
(
ReplayHeader
&
header
);
bool
ReadData
(
void
*
data
,
in
t
length
);
bool
ReadData
(
void
*
data
,
size_
t
length
);
template
<
typename
T
>
template
<
typename
T
>
T
ReadValue
();
T
Read
()
{
int
ReadInt32
();
T
ret
{};
short
ReadInt16
();
ReadData
(
&
ret
,
sizeof
(
T
));
char
ReadInt8
();
return
ret
;
}
int32_t
ReadInt32
();
void
Rewind
();
void
Rewind
();
FILE
*
fp
{
nullptr
};
FILE
*
fp
{
nullptr
};
...
@@ -70,8 +74,7 @@ public:
...
@@ -70,8 +74,7 @@ public:
private:
private:
unsigned
char
*
replay_data
;
unsigned
char
*
replay_data
;
size_t
replay_size
{};
size_t
replay_size
{};
unsigned
char
*
pwrite
{};
size_t
data_position
{};
unsigned
char
*
pdata
{};
bool
is_recording
{};
bool
is_recording
{};
bool
is_replaying
{};
bool
is_replaying
{};
};
};
...
...
gframe/replay_mode.cpp
View file @
d884e77c
...
@@ -230,8 +230,8 @@ bool ReplayMode::StartDuel() {
...
@@ -230,8 +230,8 @@ bool ReplayMode::StartDuel() {
}
}
}
else
{
}
else
{
char
filename
[
256
];
char
filename
[
256
];
int
slen
=
cur_replay
.
ReadInt16
();
auto
slen
=
cur_replay
.
Read
<
uint16_t
>
();
if
(
slen
<
0
||
slen
>
255
)
{
if
(
slen
>
sizeof
(
filename
)
-
1
)
{
return
false
;
return
false
;
}
}
cur_replay
.
ReadData
(
filename
,
slen
);
cur_replay
.
ReadData
(
filename
,
slen
);
...
...
gframe/single_duel.cpp
View file @
d884e77c
...
@@ -1432,7 +1432,7 @@ void SingleDuel::GetResponse(DuelPlayer* dp, unsigned char* pdata, unsigned int
...
@@ -1432,7 +1432,7 @@ void SingleDuel::GetResponse(DuelPlayer* dp, unsigned char* pdata, unsigned int
if
(
len
>
SIZE_RETURN_VALUE
)
if
(
len
>
SIZE_RETURN_VALUE
)
len
=
SIZE_RETURN_VALUE
;
len
=
SIZE_RETURN_VALUE
;
std
::
memcpy
(
resb
,
pdata
,
len
);
std
::
memcpy
(
resb
,
pdata
,
len
);
last_replay
.
Write
Int8
(
len
);
last_replay
.
Write
<
uint8_t
>
(
len
);
last_replay
.
WriteData
(
resb
,
len
);
last_replay
.
WriteData
(
resb
,
len
);
set_responseb
(
pduel
,
resb
);
set_responseb
(
pduel
,
resb
);
players
[
dp
->
type
]
->
state
=
0xff
;
players
[
dp
->
type
]
->
state
=
0xff
;
...
...
gframe/single_mode.cpp
View file @
d884e77c
...
@@ -25,7 +25,7 @@ void SingleMode::StopPlay(bool is_exiting) {
...
@@ -25,7 +25,7 @@ void SingleMode::StopPlay(bool is_exiting) {
void
SingleMode
::
SetResponse
(
unsigned
char
*
resp
,
unsigned
int
len
)
{
void
SingleMode
::
SetResponse
(
unsigned
char
*
resp
,
unsigned
int
len
)
{
if
(
!
pduel
)
if
(
!
pduel
)
return
;
return
;
last_replay
.
Write
Int8
(
len
);
last_replay
.
Write
<
uint8_t
>
(
len
);
last_replay
.
WriteData
(
resp
,
len
);
last_replay
.
WriteData
(
resp
,
len
);
set_responseb
(
pduel
,
resp
);
set_responseb
(
pduel
,
resp
);
}
}
...
@@ -122,7 +122,7 @@ int SingleMode::SinglePlayThread() {
...
@@ -122,7 +122,7 @@ int SingleMode::SinglePlayThread() {
last_replay
.
WriteInt32
(
start_hand
,
false
);
last_replay
.
WriteInt32
(
start_hand
,
false
);
last_replay
.
WriteInt32
(
draw_count
,
false
);
last_replay
.
WriteInt32
(
draw_count
,
false
);
last_replay
.
WriteInt32
(
opt
,
false
);
last_replay
.
WriteInt32
(
opt
,
false
);
last_replay
.
Write
Int16
(
slen
,
false
);
last_replay
.
Write
<
uint16_t
>
(
slen
,
false
);
last_replay
.
WriteData
(
filename
,
slen
,
false
);
last_replay
.
WriteData
(
filename
,
slen
,
false
);
last_replay
.
Flush
();
last_replay
.
Flush
();
start_duel
(
pduel
,
opt
);
start_duel
(
pduel
,
opt
);
...
...
gframe/tag_duel.cpp
View file @
d884e77c
...
@@ -1536,7 +1536,7 @@ void TagDuel::GetResponse(DuelPlayer* dp, unsigned char* pdata, unsigned int len
...
@@ -1536,7 +1536,7 @@ void TagDuel::GetResponse(DuelPlayer* dp, unsigned char* pdata, unsigned int len
if
(
len
>
SIZE_RETURN_VALUE
)
if
(
len
>
SIZE_RETURN_VALUE
)
len
=
SIZE_RETURN_VALUE
;
len
=
SIZE_RETURN_VALUE
;
std
::
memcpy
(
resb
,
pdata
,
len
);
std
::
memcpy
(
resb
,
pdata
,
len
);
last_replay
.
Write
Int8
(
len
);
last_replay
.
Write
<
uint8_t
>
(
len
);
last_replay
.
WriteData
(
resb
,
len
);
last_replay
.
WriteData
(
resb
,
len
);
set_responseb
(
pduel
,
resb
);
set_responseb
(
pduel
,
resb
);
players
[
dp
->
type
]
->
state
=
0xff
;
players
[
dp
->
type
]
->
state
=
0xff
;
...
...
lflist.conf
View file @
d884e77c
This diff is collapsed.
Click to expand it.
strings.conf
View file @
d884e77c
...
@@ -668,7 +668,7 @@
...
@@ -668,7 +668,7 @@
!
counter
0
x68
指示物(图腾柱)
!
counter
0
x68
指示物(图腾柱)
!
counter
0
x69
指示物(吠陀-优婆尼沙昙)
!
counter
0
x69
指示物(吠陀-优婆尼沙昙)
!
counter
0
x6a
响鸣指示物
!
counter
0
x6a
响鸣指示物
!
counter
0
x6b
狂爱指示物
!
counter
0
x
10
6b
狂爱指示物
!
counter
0
x6c
访问指示物
!
counter
0
x6c
访问指示物
!
counter
0
x6d
祝台指示物
!
counter
0
x6d
祝台指示物
#setnames, using tab for comment
#setnames, using tab for comment
...
@@ -1251,5 +1251,5 @@
...
@@ -1251,5 +1251,5 @@
!
setname
0
x1be
雷火沸动 ライゼオル
!
setname
0
x1be
雷火沸动 ライゼオル
!
setname
0
x1bf
码丽丝
M
∀
LICE
!
setname
0
x1bf
码丽丝
M
∀
LICE
!
setname
0
x1c0
龙华 竜華
!
setname
0
x1c0
龙华 竜華
!
setname
0
x1c1
阿
耳戈视☆将
星
ARG
☆
S
!
setname
0
x1c1
阿
尔戈☆群
星
ARG
☆
S
!
setname
0
x1c2
喷水引擎 アクア・ジェット
!
setname
0
x1c2
喷水引擎 アクア・ジェット
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