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-520DIY
ygopro
Commits
03079ab0
Commit
03079ab0
authored
May 20, 2024
by
salix5
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
use std::memcpy in class Replay
parent
2e0af898
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
24 deletions
+17
-24
gframe/replay.cpp
gframe/replay.cpp
+3
-7
gframe/replay.h
gframe/replay.h
+14
-17
No files found.
gframe/replay.cpp
View file @
03079ab0
...
@@ -3,11 +3,7 @@
...
@@ -3,11 +3,7 @@
namespace
ygo
{
namespace
ygo
{
Replay
::
Replay
()
Replay
::
Replay
()
{
:
fp
(
nullptr
),
pheader
(),
pdata
(
nullptr
),
replay_size
(
0
),
comp_size
(
0
),
is_recording
(
false
),
is_replaying
(
false
)
{
#ifdef _WIN32
recording_fp
=
nullptr
;
#endif
replay_data
=
new
unsigned
char
[
MAX_REPLAY_SIZE
];
replay_data
=
new
unsigned
char
[
MAX_REPLAY_SIZE
];
comp_data
=
new
unsigned
char
[
MAX_COMP_SIZE
];
comp_data
=
new
unsigned
char
[
MAX_COMP_SIZE
];
}
}
...
@@ -134,8 +130,8 @@ void Replay::EndRecord() {
...
@@ -134,8 +130,8 @@ void Replay::EndRecord() {
comp_size
=
MAX_COMP_SIZE
;
comp_size
=
MAX_COMP_SIZE
;
int
ret
=
LzmaCompress
(
comp_data
,
&
comp_size
,
replay_data
,
replay_size
,
pheader
.
props
,
&
propsize
,
5
,
1
<<
24
,
3
,
0
,
2
,
32
,
1
);
int
ret
=
LzmaCompress
(
comp_data
,
&
comp_size
,
replay_data
,
replay_size
,
pheader
.
props
,
&
propsize
,
5
,
1
<<
24
,
3
,
0
,
2
,
32
,
1
);
if
(
ret
!=
SZ_OK
)
{
if
(
ret
!=
SZ_OK
)
{
*
((
int
*
)(
comp_data
))
=
ret
;
std
::
memcpy
(
comp_data
,
&
ret
,
sizeof
ret
)
;
comp_size
=
sizeof
(
ret
)
;
comp_size
=
sizeof
ret
;
}
}
is_recording
=
false
;
is_recording
=
false
;
}
}
...
...
gframe/replay.h
View file @
03079ab0
...
@@ -17,16 +17,13 @@ namespace ygo {
...
@@ -17,16 +17,13 @@ namespace ygo {
#define MAX_COMP_SIZE 0x2000
#define MAX_COMP_SIZE 0x2000
struct
ReplayHeader
{
struct
ReplayHeader
{
unsigned
int
id
;
unsigned
int
id
{};
unsigned
int
version
;
unsigned
int
version
{};
unsigned
int
flag
;
unsigned
int
flag
{};
unsigned
int
seed
;
unsigned
int
seed
{};
unsigned
int
datasize
;
unsigned
int
datasize
{};
unsigned
int
start_time
;
unsigned
int
start_time
{};
unsigned
char
props
[
8
];
unsigned
char
props
[
8
]{};
ReplayHeader
()
:
id
(
0
),
version
(
0
),
flag
(
0
),
seed
(
0
),
datasize
(
0
),
start_time
(
0
),
props
{
0
}
{}
};
};
class
Replay
{
class
Replay
{
...
@@ -59,21 +56,21 @@ public:
...
@@ -59,21 +56,21 @@ public:
char
ReadInt8
();
char
ReadInt8
();
void
Rewind
();
void
Rewind
();
FILE
*
fp
;
FILE
*
fp
{
nullptr
}
;
#ifdef _WIN32
#ifdef _WIN32
HANDLE
recording_fp
;
HANDLE
recording_fp
{
nullptr
}
;
#endif
#endif
ReplayHeader
pheader
;
ReplayHeader
pheader
;
unsigned
char
*
replay_data
;
unsigned
char
*
replay_data
;
unsigned
char
*
comp_data
;
unsigned
char
*
comp_data
;
size_t
replay_size
;
size_t
replay_size
{}
;
size_t
comp_size
;
size_t
comp_size
{}
;
private:
private:
unsigned
char
*
pdata
;
unsigned
char
*
pdata
{
nullptr
}
;
bool
is_recording
;
bool
is_recording
{}
;
bool
is_replaying
;
bool
is_replaying
{}
;
};
};
}
}
...
...
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