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
70a6e002
Commit
70a6e002
authored
Sep 11, 2024
by
mercury233
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of
https://github.com/Fluorohydride/ygopro
into server
parents
5a4fb607
a8ccdbb1
Changes
15
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
15 changed files
with
678 additions
and
242 deletions
+678
-242
gframe/bufferio.h
gframe/bufferio.h
+125
-48
gframe/config.h
gframe/config.h
+16
-2
gframe/deck_manager.cpp
gframe/deck_manager.cpp
+4
-10
gframe/duelclient.cpp
gframe/duelclient.cpp
+3
-3
gframe/game.cpp
gframe/game.cpp
+1
-1
gframe/menu_handler.cpp
gframe/menu_handler.cpp
+4
-9
gframe/netserver.cpp
gframe/netserver.cpp
+3
-3
gframe/replay.cpp
gframe/replay.cpp
+63
-120
gframe/replay.h
gframe/replay.h
+7
-4
gframe/single_duel.cpp
gframe/single_duel.cpp
+4
-4
gframe/tag_duel.cpp
gframe/tag_duel.cpp
+3
-3
lflist.conf
lflist.conf
+431
-26
ocgcore
ocgcore
+1
-1
script
script
+1
-1
strings.conf
strings.conf
+12
-7
No files found.
gframe/bufferio.h
View file @
70a6e002
...
@@ -6,30 +6,30 @@
...
@@ -6,30 +6,30 @@
class
BufferIO
{
class
BufferIO
{
public:
public:
inline
static
int
ReadInt32
(
unsigned
char
*&
p
)
{
static
int
ReadInt32
(
unsigned
char
*&
p
)
{
return
buffer_read
<
int32_t
>
(
p
);
return
buffer_read
<
int32_t
>
(
p
);
}
}
inline
static
short
ReadInt16
(
unsigned
char
*&
p
)
{
static
short
ReadInt16
(
unsigned
char
*&
p
)
{
return
buffer_read
<
int16_t
>
(
p
);
return
buffer_read
<
int16_t
>
(
p
);
}
}
inline
static
char
ReadInt8
(
unsigned
char
*&
p
)
{
static
char
ReadInt8
(
unsigned
char
*&
p
)
{
return
buffer_read
<
char
>
(
p
);
return
buffer_read
<
char
>
(
p
);
}
}
inline
static
unsigned
char
ReadUInt8
(
unsigned
char
*&
p
)
{
static
unsigned
char
ReadUInt8
(
unsigned
char
*&
p
)
{
return
buffer_read
<
unsigned
char
>
(
p
);
return
buffer_read
<
unsigned
char
>
(
p
);
}
}
inline
static
void
WriteInt32
(
unsigned
char
*&
p
,
int
val
)
{
static
void
WriteInt32
(
unsigned
char
*&
p
,
int
val
)
{
buffer_write
<
int32_t
>
(
p
,
val
);
buffer_write
<
int32_t
>
(
p
,
val
);
}
}
inline
static
void
WriteInt16
(
unsigned
char
*&
p
,
short
val
)
{
static
void
WriteInt16
(
unsigned
char
*&
p
,
short
val
)
{
buffer_write
<
int16_t
>
(
p
,
val
);
buffer_write
<
int16_t
>
(
p
,
val
);
}
}
inline
static
void
WriteInt8
(
unsigned
char
*&
p
,
char
val
)
{
static
void
WriteInt8
(
unsigned
char
*&
p
,
char
val
)
{
buffer_write
<
char
>
(
p
,
val
);
buffer_write
<
char
>
(
p
,
val
);
}
}
// return: string length
// return: string length
template
<
typename
T1
,
typename
T2
>
template
<
typename
T1
,
typename
T2
>
inline
static
int
CopyWStr
(
const
T1
*
src
,
T2
*
pstr
,
int
bufsize
)
{
static
int
CopyWStr
(
const
T1
*
src
,
T2
*
pstr
,
int
bufsize
)
{
int
l
=
0
;
int
l
=
0
;
while
(
src
[
l
]
&&
l
<
bufsize
-
1
)
{
while
(
src
[
l
]
&&
l
<
bufsize
-
1
)
{
pstr
[
l
]
=
(
T2
)
src
[
l
];
pstr
[
l
]
=
(
T2
)
src
[
l
];
...
@@ -39,7 +39,7 @@ public:
...
@@ -39,7 +39,7 @@ public:
return
l
;
return
l
;
}
}
template
<
typename
T1
,
typename
T2
>
template
<
typename
T1
,
typename
T2
>
inline
static
int
CopyWStrRef
(
const
T1
*
src
,
T2
*&
pstr
,
int
bufsize
)
{
static
int
CopyWStrRef
(
const
T1
*
src
,
T2
*&
pstr
,
int
bufsize
)
{
int
l
=
0
;
int
l
=
0
;
while
(
src
[
l
]
&&
l
<
bufsize
-
1
)
{
while
(
src
[
l
]
&&
l
<
bufsize
-
1
)
{
pstr
[
l
]
=
(
T2
)
src
[
l
];
pstr
[
l
]
=
(
T2
)
src
[
l
];
...
@@ -49,22 +49,117 @@ public:
...
@@ -49,22 +49,117 @@ public:
*
pstr
=
0
;
*
pstr
=
0
;
return
l
;
return
l
;
}
}
template
<
typename
T
>
static
bool
CheckUTF8Byte
(
const
T
*
str
,
int
len
)
{
for
(
int
i
=
1
;
i
<
len
;
++
i
)
{
if
((
str
[
i
]
&
0xc0U
)
!=
0x80U
)
return
false
;
}
return
true
;
}
static
unsigned
int
ConvertUTF8
(
const
char
*&
p
)
{
unsigned
int
cur
=
0
;
if
((
p
[
0
]
&
0x80U
)
==
0
)
{
cur
=
p
[
0
]
&
0xffU
;
p
++
;
}
else
if
((
p
[
0
]
&
0xe0U
)
==
0xc0U
)
{
if
(
!
CheckUTF8Byte
(
p
,
2
))
{
p
++
;
return
UINT32_MAX
;
}
cur
=
((
p
[
0
]
&
0x1fU
)
<<
6
)
|
(
p
[
1
]
&
0x3fU
);
p
+=
2
;
if
(
cur
<
0x80U
)
return
UINT32_MAX
;
}
else
if
((
p
[
0
]
&
0xf0U
)
==
0xe0U
)
{
if
(
!
CheckUTF8Byte
(
p
,
3
))
{
p
++
;
return
UINT32_MAX
;
}
cur
=
((
p
[
0
]
&
0xfU
)
<<
12
)
|
((
p
[
1
]
&
0x3fU
)
<<
6
)
|
(
p
[
2
]
&
0x3fU
);
p
+=
3
;
if
(
cur
<
0x800U
)
return
UINT32_MAX
;
}
else
if
((
p
[
0
]
&
0xf8U
)
==
0xf0U
)
{
if
(
!
CheckUTF8Byte
(
p
,
4
))
{
p
++
;
return
UINT32_MAX
;
}
cur
=
((
p
[
0
]
&
0x7U
)
<<
18
)
|
((
p
[
1
]
&
0x3fU
)
<<
12
)
|
((
p
[
2
]
&
0x3fU
)
<<
6
)
|
(
p
[
3
]
&
0x3fU
);
p
+=
4
;
if
(
cur
<
0x10000U
)
return
UINT32_MAX
;
}
else
{
p
++
;
return
UINT32_MAX
;
}
return
cur
;
}
static
bool
IsHighSurrogate
(
unsigned
int
c
)
{
return
(
c
>=
0xd800U
&&
c
<=
0xdbffU
);
}
static
bool
IsLowSurrogate
(
unsigned
int
c
)
{
return
(
c
>=
0xdc00U
&&
c
<=
0xdfffU
);
}
static
bool
IsUnicodeChar
(
unsigned
int
c
)
{
if
(
IsHighSurrogate
(
c
))
return
false
;
if
(
IsLowSurrogate
(
c
))
return
false
;
if
(
c
>
0x10ffffU
)
return
false
;
return
true
;
}
// UTF-16/UTF-32 to UTF-8
// UTF-16/UTF-32 to UTF-8
// return: string length
// return: string length
static
int
EncodeUTF8String
(
const
wchar_t
*
wsrc
,
char
*
str
,
int
size
)
{
static
int
EncodeUTF8String
(
const
wchar_t
*
wsrc
,
char
*
str
,
int
size
)
{
char
*
pstr
=
str
;
auto
pw
=
wsrc
;
while
(
*
wsrc
!=
0
)
{
auto
pstr
=
str
;
unsigned
cur
=
*
wsrc
;
while
(
*
pw
!=
0
)
{
unsigned
cur
=
0
;
int
codepoint_size
=
0
;
int
codepoint_size
=
0
;
if
(
sizeof
(
wchar_t
)
==
2
)
{
if
(
IsHighSurrogate
(
pw
[
0
]))
{
if
(
pw
[
1
]
==
0
)
break
;
if
(
IsLowSurrogate
(
pw
[
1
]))
{
cur
=
((
pw
[
0
]
&
0x3ffU
)
<<
10
)
|
(
pw
[
1
]
&
0x3ffU
);
cur
+=
0x10000
;
pw
+=
2
;
}
else
{
pw
++
;
continue
;
}
}
else
if
(
IsLowSurrogate
(
pw
[
0
]))
{
pw
++
;
continue
;
}
else
{
cur
=
*
pw
;
pw
++
;
}
}
else
{
cur
=
*
pw
;
pw
++
;
}
if
(
!
IsUnicodeChar
(
cur
))
continue
;
if
(
cur
<
0x80U
)
if
(
cur
<
0x80U
)
codepoint_size
=
1
;
codepoint_size
=
1
;
else
if
(
cur
<
0x800U
)
else
if
(
cur
<
0x800U
)
codepoint_size
=
2
;
codepoint_size
=
2
;
else
if
(
cur
<
0x10000U
&&
(
cur
<
0xd800U
||
cur
>
0xdfffU
)
)
else
if
(
cur
<
0x10000U
)
codepoint_size
=
3
;
codepoint_size
=
3
;
else
else
codepoint_size
=
4
;
codepoint_size
=
4
;
if
(
pstr
-
str
+
codepoint_size
>
size
-
1
)
if
(
(
int
)(
pstr
-
str
)
+
codepoint_size
>
size
-
1
)
break
;
break
;
switch
(
codepoint_size
)
{
switch
(
codepoint_size
)
{
case
1
:
case
1
:
...
@@ -80,13 +175,6 @@ public:
...
@@ -80,13 +175,6 @@ public:
pstr
[
2
]
=
(
cur
&
0x3f
)
|
0x80
;
pstr
[
2
]
=
(
cur
&
0x3f
)
|
0x80
;
break
;
break
;
case
4
:
case
4
:
if
(
sizeof
(
wchar_t
)
==
2
)
{
cur
=
0
;
cur
|=
(
*
wsrc
&
0x3ffU
)
<<
10
;
++
wsrc
;
cur
|=
*
wsrc
&
0x3ffU
;
cur
+=
0x10000
;
}
pstr
[
0
]
=
((
cur
>>
18
)
&
0x7
)
|
0xf0
;
pstr
[
0
]
=
((
cur
>>
18
)
&
0x7
)
|
0xf0
;
pstr
[
1
]
=
((
cur
>>
12
)
&
0x3f
)
|
0x80
;
pstr
[
1
]
=
((
cur
>>
12
)
&
0x3f
)
|
0x80
;
pstr
[
2
]
=
((
cur
>>
6
)
&
0x3f
)
|
0x80
;
pstr
[
2
]
=
((
cur
>>
6
)
&
0x3f
)
|
0x80
;
...
@@ -96,10 +184,9 @@ public:
...
@@ -96,10 +184,9 @@ public:
break
;
break
;
}
}
pstr
+=
codepoint_size
;
pstr
+=
codepoint_size
;
wsrc
++
;
}
}
*
pstr
=
0
;
*
pstr
=
0
;
return
pstr
-
str
;
return
(
int
)(
pstr
-
str
)
;
}
}
// UTF-8 to UTF-16/UTF-32
// UTF-8 to UTF-16/UTF-32
// return: string length
// return: string length
...
@@ -107,9 +194,11 @@ public:
...
@@ -107,9 +194,11 @@ public:
const
char
*
p
=
src
;
const
char
*
p
=
src
;
wchar_t
*
wp
=
wstr
;
wchar_t
*
wp
=
wstr
;
while
(
*
p
!=
0
)
{
while
(
*
p
!=
0
)
{
const
unsigned
cur
=
*
p
&
0xffU
;
unsigned
int
cur
=
ConvertUTF8
(
p
)
;
int
codepoint_size
=
0
;
int
codepoint_size
=
0
;
if
((
cur
&
0xf8
)
==
0xf0
)
{
if
(
!
IsUnicodeChar
(
cur
))
continue
;
if
(
cur
>=
0x10000
)
{
if
(
sizeof
(
wchar_t
)
==
2
)
if
(
sizeof
(
wchar_t
)
==
2
)
codepoint_size
=
2
;
codepoint_size
=
2
;
else
else
...
@@ -117,30 +206,18 @@ public:
...
@@ -117,30 +206,18 @@ public:
}
}
else
else
codepoint_size
=
1
;
codepoint_size
=
1
;
if
(
wp
-
wstr
+
codepoint_size
>
size
-
1
)
if
(
(
int
)(
wp
-
wstr
)
+
codepoint_size
>
size
-
1
)
break
;
break
;
if
((
cur
&
0x80
)
==
0
)
{
if
(
codepoint_size
==
1
)
{
*
wp
=
*
p
;
wp
[
0
]
=
cur
;
p
++
;
wp
++
;
}
else
if
((
cur
&
0xe0
)
==
0xc0
)
{
}
*
wp
=
((
p
[
0
]
&
0x1fU
)
<<
6
)
|
(
p
[
1
]
&
0x3fU
);
else
{
p
+=
2
;
cur
-=
0x10000U
;
}
else
if
((
cur
&
0xf0
)
==
0xe0
)
{
wp
[
0
]
=
(
cur
>>
10
)
|
0xd800
;
*
wp
=
((
p
[
0
]
&
0xfU
)
<<
12
)
|
((
p
[
1
]
&
0x3fU
)
<<
6
)
|
(
p
[
2
]
&
0x3fU
);
wp
[
1
]
=
(
cur
&
0x3ff
)
|
0xdc00
;
p
+=
3
;
wp
+=
2
;
}
else
if
((
cur
&
0xf8
)
==
0xf0
)
{
}
if
(
sizeof
(
wchar_t
)
==
2
)
{
unsigned
unicode
=
((
p
[
0
]
&
0x7U
)
<<
18
)
|
((
p
[
1
]
&
0x3fU
)
<<
12
)
|
((
p
[
2
]
&
0x3fU
)
<<
6
)
|
(
p
[
3
]
&
0x3fU
);
unicode
-=
0x10000
;
*
wp
++
=
(
unicode
>>
10
)
|
0xd800
;
*
wp
=
(
unicode
&
0x3ff
)
|
0xdc00
;
}
else
{
*
wp
=
((
p
[
0
]
&
0x7U
)
<<
18
)
|
((
p
[
1
]
&
0x3fU
)
<<
12
)
|
((
p
[
2
]
&
0x3fU
)
<<
6
)
|
(
p
[
3
]
&
0x3fU
);
}
p
+=
4
;
}
else
p
++
;
wp
++
;
}
}
*
wp
=
0
;
*
wp
=
0
;
return
wp
-
wstr
;
return
wp
-
wstr
;
...
...
gframe/config.h
View file @
70a6e002
...
@@ -43,7 +43,7 @@
...
@@ -43,7 +43,7 @@
#define mystrncasecmp strncasecmp
#define mystrncasecmp strncasecmp
#endif
#endif
#include <
string
>
#include <
wchar.h
>
template
<
size_t
N
,
typename
...
TR
>
template
<
size_t
N
,
typename
...
TR
>
inline
int
myswprintf
(
wchar_t
(
&
buf
)[
N
],
const
wchar_t
*
fmt
,
TR
...
args
)
{
inline
int
myswprintf
(
wchar_t
(
&
buf
)[
N
],
const
wchar_t
*
fmt
,
TR
...
args
)
{
return
swprintf
(
buf
,
N
,
fmt
,
args
...);
return
swprintf
(
buf
,
N
,
fmt
,
args
...);
...
@@ -51,13 +51,27 @@ inline int myswprintf(wchar_t(&buf)[N], const wchar_t* fmt, TR... args) {
...
@@ -51,13 +51,27 @@ inline int myswprintf(wchar_t(&buf)[N], const wchar_t* fmt, TR... args) {
#include <stdio.h>
#include <stdio.h>
#include <stdlib.h>
#include <stdlib.h>
#include <wchar.h>
#include <iostream>
#include <iostream>
#include <algorithm>
#include <algorithm>
#include <string>
#include "bufferio.h"
#include "bufferio.h"
#include "../ocgcore/ocgapi.h"
#include "../ocgcore/ocgapi.h"
#include "../ocgcore/common.h"
#include "../ocgcore/common.h"
inline
FILE
*
myfopen
(
const
char
*
filename
,
const
char
*
mode
)
{
FILE
*
fp
{};
#ifdef _WIN32
wchar_t
wname
[
256
]{};
wchar_t
wmode
[
20
]{};
BufferIO
::
DecodeUTF8
(
filename
,
wname
);
BufferIO
::
CopyWStr
(
mode
,
wmode
,
sizeof
wmode
/
sizeof
wmode
[
0
]);
fp
=
_wfopen
(
wname
,
wmode
);
#else
fp
=
fopen
(
filename
,
mode
);
#endif
return
fp
;
}
#ifndef YGOPRO_SERVER_MODE
#ifndef YGOPRO_SERVER_MODE
#include <irrlicht.h>
#include <irrlicht.h>
using
namespace
irr
;
using
namespace
irr
;
...
...
gframe/deck_manager.cpp
View file @
70a6e002
...
@@ -273,15 +273,9 @@ void DeckManager::GetDeckFile(wchar_t* ret, irr::gui::IGUIComboBox* cbCategory,
...
@@ -273,15 +273,9 @@ void DeckManager::GetDeckFile(wchar_t* ret, irr::gui::IGUIComboBox* cbCategory,
}
}
}
}
FILE
*
DeckManager
::
OpenDeckFile
(
const
wchar_t
*
file
,
const
char
*
mode
)
{
FILE
*
DeckManager
::
OpenDeckFile
(
const
wchar_t
*
file
,
const
char
*
mode
)
{
#ifdef WIN32
char
fullname
[
256
]{};
wchar_t
wmode
[
20
]{};
BufferIO
::
EncodeUTF8
(
file
,
fullname
);
BufferIO
::
CopyWStr
(
mode
,
wmode
,
sizeof
wmode
/
sizeof
wmode
[
0
]);
FILE
*
fp
=
myfopen
(
fullname
,
mode
);
FILE
*
fp
=
_wfopen
(
file
,
wmode
);
#else
char
file2
[
256
];
BufferIO
::
EncodeUTF8
(
file
,
file2
);
FILE
*
fp
=
fopen
(
file2
,
mode
);
#endif
return
fp
;
return
fp
;
}
}
IReadFile
*
DeckManager
::
OpenDeckReader
(
const
wchar_t
*
file
)
{
IReadFile
*
DeckManager
::
OpenDeckReader
(
const
wchar_t
*
file
)
{
...
@@ -314,7 +308,7 @@ bool DeckManager::LoadCurrentDeck(const wchar_t* file, bool is_packlist) {
...
@@ -314,7 +308,7 @@ bool DeckManager::LoadCurrentDeck(const wchar_t* file, bool is_packlist) {
reader
->
drop
();
reader
->
drop
();
return
false
;
return
false
;
}
}
memset
(
deckBuffer
,
0
,
sizeof
(
deckBuffer
)
);
std
::
memset
(
deckBuffer
,
0
,
sizeof
deckBuffer
);
reader
->
read
(
deckBuffer
,
size
);
reader
->
read
(
deckBuffer
,
size
);
reader
->
drop
();
reader
->
drop
();
std
::
istringstream
deckStream
(
deckBuffer
);
std
::
istringstream
deckStream
(
deckBuffer
);
...
...
gframe/duelclient.cpp
View file @
70a6e002
...
@@ -44,7 +44,7 @@ bool DuelClient::StartClient(unsigned int ip, unsigned short port, bool create_g
...
@@ -44,7 +44,7 @@ bool DuelClient::StartClient(unsigned int ip, unsigned short port, bool create_g
client_base
=
event_base_new
();
client_base
=
event_base_new
();
if
(
!
client_base
)
if
(
!
client_base
)
return
false
;
return
false
;
memset
(
&
sin
,
0
,
sizeof
(
sin
)
);
std
::
memset
(
&
sin
,
0
,
sizeof
sin
);
sin
.
sin_family
=
AF_INET
;
sin
.
sin_family
=
AF_INET
;
sin
.
sin_addr
.
s_addr
=
htonl
(
ip
);
sin
.
sin_addr
.
s_addr
=
htonl
(
ip
);
sin
.
sin_port
=
htons
(
port
);
sin
.
sin_port
=
htons
(
port
);
...
@@ -100,7 +100,7 @@ void DuelClient::StopClient(bool is_exiting) {
...
@@ -100,7 +100,7 @@ void DuelClient::StopClient(bool is_exiting) {
void
DuelClient
::
ClientRead
(
bufferevent
*
bev
,
void
*
ctx
)
{
void
DuelClient
::
ClientRead
(
bufferevent
*
bev
,
void
*
ctx
)
{
evbuffer
*
input
=
bufferevent_get_input
(
bev
);
evbuffer
*
input
=
bufferevent_get_input
(
bev
);
int
len
=
evbuffer_get_length
(
input
);
int
len
=
evbuffer_get_length
(
input
);
unsigned
char
*
duel_client_read
=
new
unsigned
char
[
std
::
min
(
len
,
SIZE_NETWORK_BUFFER
)
];
unsigned
char
*
duel_client_read
=
new
unsigned
char
[
SIZE_NETWORK_BUFFER
];
unsigned
short
packet_len
;
unsigned
short
packet_len
;
while
(
len
>=
2
)
{
while
(
len
>=
2
)
{
evbuffer_copyout
(
input
,
&
packet_len
,
sizeof
packet_len
);
evbuffer_copyout
(
input
,
&
packet_len
,
sizeof
packet_len
);
...
@@ -4062,7 +4062,7 @@ void DuelClient::BeginRefreshHost() {
...
@@ -4062,7 +4062,7 @@ void DuelClient::BeginRefreshHost() {
return
;
return
;
SOCKET
reply
=
socket
(
AF_INET
,
SOCK_DGRAM
,
IPPROTO_UDP
);
SOCKET
reply
=
socket
(
AF_INET
,
SOCK_DGRAM
,
IPPROTO_UDP
);
sockaddr_in
reply_addr
;
sockaddr_in
reply_addr
;
memset
(
&
reply_addr
,
0
,
sizeof
(
reply_addr
)
);
std
::
memset
(
&
reply_addr
,
0
,
sizeof
reply_addr
);
reply_addr
.
sin_family
=
AF_INET
;
reply_addr
.
sin_family
=
AF_INET
;
reply_addr
.
sin_port
=
htons
(
7921
);
reply_addr
.
sin_port
=
htons
(
7921
);
reply_addr
.
sin_addr
.
s_addr
=
0
;
reply_addr
.
sin_addr
.
s_addr
=
0
;
...
...
gframe/game.cpp
View file @
70a6e002
#include "config.h"
#include "config.h"
#include "game.h"
#include "game.h"
#ifdef YGOPRO_SERVER_MODE
#ifdef YGOPRO_SERVER_MODE
#include <thread>
#include "myfilesystem.h"
#include "myfilesystem.h"
#include "data_manager.h"
#include "data_manager.h"
#include "deck_manager.h"
#include "deck_manager.h"
...
@@ -27,6 +26,7 @@ namespace irr {
...
@@ -27,6 +26,7 @@ namespace irr {
#include "netserver.h"
#include "netserver.h"
#include "single_mode.h"
#include "single_mode.h"
#endif //YGOPRO_SERVER_MODE
#endif //YGOPRO_SERVER_MODE
#include <thread>
const
unsigned
short
PRO_VERSION
=
0x1361
;
const
unsigned
short
PRO_VERSION
=
0x1361
;
...
...
gframe/menu_handler.cpp
View file @
70a6e002
...
@@ -78,7 +78,7 @@ bool MenuHandler::OnEvent(const irr::SEvent& event) {
...
@@ -78,7 +78,7 @@ bool MenuHandler::OnEvent(const irr::SEvent& event) {
BufferIO
::
CopyWStr
(
mainGame
->
ebJoinPort
->
getText
(),
port
,
6
);
BufferIO
::
CopyWStr
(
mainGame
->
ebJoinPort
->
getText
(),
port
,
6
);
struct
evutil_addrinfo
hints
;
struct
evutil_addrinfo
hints
;
struct
evutil_addrinfo
*
answer
=
NULL
;
struct
evutil_addrinfo
*
answer
=
NULL
;
memset
(
&
hints
,
0
,
sizeof
(
hints
)
);
std
::
memset
(
&
hints
,
0
,
sizeof
hints
);
hints
.
ai_family
=
AF_INET
;
hints
.
ai_family
=
AF_INET
;
hints
.
ai_socktype
=
SOCK_STREAM
;
hints
.
ai_socktype
=
SOCK_STREAM
;
hints
.
ai_protocol
=
IPPROTO_TCP
;
hints
.
ai_protocol
=
IPPROTO_TCP
;
...
@@ -570,14 +570,9 @@ bool MenuHandler::OnEvent(const irr::SEvent& event) {
...
@@ -570,14 +570,9 @@ bool MenuHandler::OnEvent(const irr::SEvent& event) {
const
wchar_t
*
name
=
mainGame
->
lstSinglePlayList
->
getListItem
(
sel
);
const
wchar_t
*
name
=
mainGame
->
lstSinglePlayList
->
getListItem
(
sel
);
wchar_t
fname
[
256
];
wchar_t
fname
[
256
];
myswprintf
(
fname
,
L"./single/%ls"
,
name
);
myswprintf
(
fname
,
L"./single/%ls"
,
name
);
FILE
*
fp
;
char
fullname
[
256
]{};
#ifdef _WIN32
BufferIO
::
EncodeUTF8
(
fname
,
fullname
);
fp
=
_wfopen
(
fname
,
L"rb"
);
FILE
*
fp
=
myfopen
(
fullname
,
"rb"
);
#else
char
filename
[
256
];
BufferIO
::
EncodeUTF8
(
fname
,
filename
);
fp
=
fopen
(
filename
,
"rb"
);
#endif
if
(
!
fp
)
{
if
(
!
fp
)
{
mainGame
->
stSinglePlayInfo
->
setText
(
L""
);
mainGame
->
stSinglePlayInfo
->
setText
(
L""
);
break
;
break
;
...
...
gframe/netserver.cpp
View file @
70a6e002
...
@@ -86,7 +86,7 @@ bool NetServer::StartServer(unsigned short port) {
...
@@ -86,7 +86,7 @@ bool NetServer::StartServer(unsigned short port) {
if
(
!
net_evbase
)
if
(
!
net_evbase
)
return
false
;
return
false
;
sockaddr_in
sin
;
sockaddr_in
sin
;
memset
(
&
sin
,
0
,
sizeof
(
sin
)
);
std
::
memset
(
&
sin
,
0
,
sizeof
sin
);
server_port
=
port
;
server_port
=
port
;
sin
.
sin_family
=
AF_INET
;
sin
.
sin_family
=
AF_INET
;
#ifdef SERVER_PRO2_SUPPORT
#ifdef SERVER_PRO2_SUPPORT
...
@@ -122,7 +122,7 @@ bool NetServer::StartBroadcast() {
...
@@ -122,7 +122,7 @@ bool NetServer::StartBroadcast() {
setsockopt
(
udp
,
SOL_SOCKET
,
SO_BROADCAST
,
(
const
char
*
)
&
opt
,
sizeof
opt
);
setsockopt
(
udp
,
SOL_SOCKET
,
SO_BROADCAST
,
(
const
char
*
)
&
opt
,
sizeof
opt
);
setsockopt
(
udp
,
SOL_SOCKET
,
SO_REUSEADDR
,
(
const
char
*
)
&
opt
,
sizeof
opt
);
setsockopt
(
udp
,
SOL_SOCKET
,
SO_REUSEADDR
,
(
const
char
*
)
&
opt
,
sizeof
opt
);
sockaddr_in
addr
;
sockaddr_in
addr
;
memset
(
&
addr
,
0
,
sizeof
(
addr
)
);
std
::
memset
(
&
addr
,
0
,
sizeof
addr
);
addr
.
sin_family
=
AF_INET
;
addr
.
sin_family
=
AF_INET
;
addr
.
sin_port
=
htons
(
7920
);
addr
.
sin_port
=
htons
(
7920
);
addr
.
sin_addr
.
s_addr
=
0
;
addr
.
sin_addr
.
s_addr
=
0
;
...
@@ -206,7 +206,7 @@ void NetServer::ServerAcceptError(evconnlistener* listener, void* ctx) {
...
@@ -206,7 +206,7 @@ void NetServer::ServerAcceptError(evconnlistener* listener, void* ctx) {
void
NetServer
::
ServerEchoRead
(
bufferevent
*
bev
,
void
*
ctx
)
{
void
NetServer
::
ServerEchoRead
(
bufferevent
*
bev
,
void
*
ctx
)
{
evbuffer
*
input
=
bufferevent_get_input
(
bev
);
evbuffer
*
input
=
bufferevent_get_input
(
bev
);
int
len
=
evbuffer_get_length
(
input
);
int
len
=
evbuffer_get_length
(
input
);
unsigned
char
*
net_server_read
=
new
unsigned
char
[
std
::
min
(
len
,
SIZE_NETWORK_BUFFER
)
];
unsigned
char
*
net_server_read
=
new
unsigned
char
[
SIZE_NETWORK_BUFFER
];
unsigned
short
packet_len
;
unsigned
short
packet_len
;
while
(
len
>=
2
)
{
while
(
len
>=
2
)
{
evbuffer_copyout
(
input
,
&
packet_len
,
sizeof
packet_len
);
evbuffer_copyout
(
input
,
&
packet_len
,
sizeof
packet_len
);
...
...
gframe/replay.cpp
View file @
70a6e002
...
@@ -58,7 +58,7 @@ void Replay::BeginRecord() {
...
@@ -58,7 +58,7 @@ void Replay::BeginRecord() {
#ifdef YGOPRO_SERVER_MODE
#ifdef YGOPRO_SERVER_MODE
}
}
#endif //YGOPRO_SERVER_MODE
#endif //YGOPRO_SERVER_MODE
p
data
=
replay_data
;
p
write
=
replay_data
;
replay_size
=
0
;
replay_size
=
0
;
comp_size
=
0
;
comp_size
=
0
;
is_replaying
=
false
;
is_replaying
=
false
;
...
@@ -80,10 +80,10 @@ void Replay::WriteHeader(ReplayHeader& header) {
...
@@ -80,10 +80,10 @@ void Replay::WriteHeader(ReplayHeader& header) {
void
Replay
::
WriteData
(
const
void
*
data
,
int
length
,
bool
flush
)
{
void
Replay
::
WriteData
(
const
void
*
data
,
int
length
,
bool
flush
)
{
if
(
!
is_recording
)
if
(
!
is_recording
)
return
;
return
;
if
(
length
<
0
||
(
pdata
-
replay_data
)
+
length
>
MAX_REPLAY_SIZE
)
if
(
length
<
0
||
(
int
)(
pwrite
-
replay_data
)
+
length
>
MAX_REPLAY_SIZE
)
return
;
return
;
std
::
memcpy
(
p
data
,
data
,
length
);
std
::
memcpy
(
p
write
,
data
,
length
);
p
data
+=
length
;
p
write
+=
length
;
#ifdef YGOPRO_SERVER_MODE
#ifdef YGOPRO_SERVER_MODE
if
(
!
(
replay_mode
&
REPLAY_MODE_SAVE_IN_SERVER
))
return
;
if
(
!
(
replay_mode
&
REPLAY_MODE_SAVE_IN_SERVER
))
return
;
#endif
#endif
...
@@ -97,58 +97,13 @@ void Replay::WriteData(const void* data, int length, bool flush) {
...
@@ -97,58 +97,13 @@ void Replay::WriteData(const void* data, int length, bool flush) {
#endif
#endif
}
}
void
Replay
::
WriteInt32
(
int
data
,
bool
flush
)
{
void
Replay
::
WriteInt32
(
int
data
,
bool
flush
)
{
if
(
!
is_recording
)
WriteData
(
&
data
,
sizeof
data
,
flush
);
return
;
if
((
pdata
-
replay_data
)
+
4
>
MAX_REPLAY_SIZE
)
return
;
BufferIO
::
WriteInt32
(
pdata
,
data
);
#ifdef YGOPRO_SERVER_MODE
if
(
!
(
replay_mode
&
REPLAY_MODE_SAVE_IN_SERVER
))
return
;
#endif
#ifdef _WIN32
DWORD
size
;
WriteFile
(
recording_fp
,
&
data
,
sizeof
(
int
),
&
size
,
NULL
);
#else
fwrite
(
&
data
,
sizeof
(
int
),
1
,
fp
);
if
(
flush
)
fflush
(
fp
);
#endif
}
}
void
Replay
::
WriteInt16
(
short
data
,
bool
flush
)
{
void
Replay
::
WriteInt16
(
short
data
,
bool
flush
)
{
if
(
!
is_recording
)
WriteData
(
&
data
,
sizeof
data
,
flush
);
return
;
if
((
pdata
-
replay_data
)
+
2
>
MAX_REPLAY_SIZE
)
return
;
BufferIO
::
WriteInt16
(
pdata
,
data
);
#ifdef YGOPRO_SERVER_MODE
if
(
!
(
replay_mode
&
REPLAY_MODE_SAVE_IN_SERVER
))
return
;
#endif
#ifdef _WIN32
DWORD
size
;
WriteFile
(
recording_fp
,
&
data
,
sizeof
(
short
),
&
size
,
NULL
);
#else
fwrite
(
&
data
,
sizeof
(
short
),
1
,
fp
);
if
(
flush
)
fflush
(
fp
);
#endif
}
}
void
Replay
::
WriteInt8
(
char
data
,
bool
flush
)
{
void
Replay
::
WriteInt8
(
char
data
,
bool
flush
)
{
if
(
!
is_recording
)
WriteData
(
&
data
,
sizeof
data
,
flush
);
return
;
if
((
pdata
-
replay_data
)
+
1
>
MAX_REPLAY_SIZE
)
return
;
BufferIO
::
WriteInt8
(
pdata
,
data
);
#ifdef YGOPRO_SERVER_MODE
if
(
!
(
replay_mode
&
REPLAY_MODE_SAVE_IN_SERVER
))
return
;
#endif
#ifdef _WIN32
DWORD
size
;
WriteFile
(
recording_fp
,
&
data
,
sizeof
(
char
),
&
size
,
NULL
);
#else
fwrite
(
&
data
,
sizeof
(
char
),
1
,
fp
);
if
(
flush
)
fflush
(
fp
);
#endif
}
}
void
Replay
::
Flush
()
{
void
Replay
::
Flush
()
{
if
(
!
is_recording
)
if
(
!
is_recording
)
...
@@ -175,10 +130,7 @@ void Replay::EndRecord() {
...
@@ -175,10 +130,7 @@ void Replay::EndRecord() {
#ifdef YGOPRO_SERVER_MODE
#ifdef YGOPRO_SERVER_MODE
}
}
#endif
#endif
if
(
pdata
-
replay_data
>
0
&&
pdata
-
replay_data
<=
MAX_REPLAY_SIZE
)
replay_size
=
pwrite
-
replay_data
;
replay_size
=
pdata
-
replay_data
;
else
replay_size
=
0
;
pheader
.
datasize
=
replay_size
;
pheader
.
datasize
=
replay_size
;
pheader
.
flag
|=
REPLAY_COMPRESSED
;
pheader
.
flag
|=
REPLAY_COMPRESSED
;
size_t
propsize
=
5
;
size_t
propsize
=
5
;
...
@@ -195,39 +147,26 @@ void Replay::SaveReplay(const wchar_t* name) {
...
@@ -195,39 +147,26 @@ void Replay::SaveReplay(const wchar_t* name) {
return
;
return
;
wchar_t
fname
[
256
];
wchar_t
fname
[
256
];
myswprintf
(
fname
,
L"./replay/%ls.yrp"
,
name
);
myswprintf
(
fname
,
L"./replay/%ls.yrp"
,
name
);
#ifdef WIN32
char
fullname
[
256
]{};
fp
=
_wfopen
(
fname
,
L"wb"
);
BufferIO
::
EncodeUTF8
(
fname
,
fullname
);
#else
FILE
*
rfp
=
myfopen
(
fullname
,
"wb"
);
char
fname2
[
256
];
if
(
!
rfp
)
BufferIO
::
EncodeUTF8
(
fname
,
fname2
);
fp
=
fopen
(
fname2
,
"wb"
);
#endif
if
(
!
fp
)
return
;
return
;
fwrite
(
&
pheader
,
sizeof
(
pheader
),
1
,
fp
);
fwrite
(
&
pheader
,
sizeof
pheader
,
1
,
r
fp
);
fwrite
(
comp_data
,
comp_size
,
1
,
fp
);
fwrite
(
comp_data
,
comp_size
,
1
,
r
fp
);
fclose
(
fp
);
fclose
(
r
fp
);
}
}
bool
Replay
::
OpenReplay
(
const
wchar_t
*
name
)
{
bool
Replay
::
OpenReplay
(
const
wchar_t
*
name
)
{
#ifdef WIN32
char
fullname
[
256
]{};
fp
=
_wfopen
(
name
,
L"rb"
);
BufferIO
::
EncodeUTF8
(
name
,
fullname
);
#else
FILE
*
rfp
=
myfopen
(
fullname
,
"rb"
);
char
name2
[
256
];
if
(
!
rfp
)
{
BufferIO
::
EncodeUTF8
(
name
,
name2
);
fp
=
fopen
(
name2
,
"rb"
);
#endif
if
(
!
fp
)
{
wchar_t
fname
[
256
];
wchar_t
fname
[
256
];
myswprintf
(
fname
,
L"./replay/%ls"
,
name
);
myswprintf
(
fname
,
L"./replay/%ls"
,
name
);
#ifdef WIN32
BufferIO
::
EncodeUTF8
(
fname
,
fullname
);
fp
=
_wfopen
(
fname
,
L"rb"
);
rfp
=
myfopen
(
fullname
,
"rb"
);
#else
char
fname2
[
256
];
BufferIO
::
EncodeUTF8
(
fname
,
fname2
);
fp
=
fopen
(
fname2
,
"rb"
);
#endif
}
}
if
(
!
fp
)
if
(
!
r
fp
)
return
false
;
return
false
;
pdata
=
replay_data
;
pdata
=
replay_data
;
...
@@ -235,13 +174,13 @@ bool Replay::OpenReplay(const wchar_t* name) {
...
@@ -235,13 +174,13 @@ bool Replay::OpenReplay(const wchar_t* name) {
is_replaying
=
false
;
is_replaying
=
false
;
replay_size
=
0
;
replay_size
=
0
;
comp_size
=
0
;
comp_size
=
0
;
if
(
fread
(
&
pheader
,
sizeof
(
pheader
),
1
,
fp
)
<
1
)
{
if
(
fread
(
&
pheader
,
sizeof
pheader
,
1
,
r
fp
)
<
1
)
{
fclose
(
fp
);
fclose
(
r
fp
);
return
false
;
return
false
;
}
}
if
(
pheader
.
flag
&
REPLAY_COMPRESSED
)
{
if
(
pheader
.
flag
&
REPLAY_COMPRESSED
)
{
comp_size
=
fread
(
comp_data
,
1
,
MAX_COMP_SIZE
,
fp
);
comp_size
=
fread
(
comp_data
,
1
,
MAX_COMP_SIZE
,
r
fp
);
fclose
(
fp
);
fclose
(
r
fp
);
if
((
int
)
pheader
.
datasize
<
0
&&
(
int
)
pheader
.
datasize
>
MAX_REPLAY_SIZE
)
if
((
int
)
pheader
.
datasize
<
0
&&
(
int
)
pheader
.
datasize
>
MAX_REPLAY_SIZE
)
return
false
;
return
false
;
replay_size
=
pheader
.
datasize
;
replay_size
=
pheader
.
datasize
;
...
@@ -252,8 +191,8 @@ bool Replay::OpenReplay(const wchar_t* name) {
...
@@ -252,8 +191,8 @@ bool Replay::OpenReplay(const wchar_t* name) {
return
false
;
return
false
;
}
}
}
else
{
}
else
{
replay_size
=
fread
(
replay_data
,
1
,
MAX_REPLAY_SIZE
,
fp
);
replay_size
=
fread
(
replay_data
,
1
,
MAX_REPLAY_SIZE
,
r
fp
);
fclose
(
fp
);
fclose
(
r
fp
);
comp_size
=
0
;
comp_size
=
0
;
}
}
is_replaying
=
true
;
is_replaying
=
true
;
...
@@ -262,24 +201,20 @@ bool Replay::OpenReplay(const wchar_t* name) {
...
@@ -262,24 +201,20 @@ bool Replay::OpenReplay(const wchar_t* name) {
bool
Replay
::
CheckReplay
(
const
wchar_t
*
name
)
{
bool
Replay
::
CheckReplay
(
const
wchar_t
*
name
)
{
wchar_t
fname
[
256
];
wchar_t
fname
[
256
];
myswprintf
(
fname
,
L"./replay/%ls"
,
name
);
myswprintf
(
fname
,
L"./replay/%ls"
,
name
);
#ifdef WIN32
char
fullname
[
256
]{};
FILE
*
rfp
=
_wfopen
(
fname
,
L"rb"
);
BufferIO
::
EncodeUTF8
(
fname
,
fullname
);
#else
FILE
*
rfp
=
myfopen
(
fullname
,
"rb"
);
char
fname2
[
256
];
BufferIO
::
EncodeUTF8
(
fname
,
fname2
);
FILE
*
rfp
=
fopen
(
fname2
,
"rb"
);
#endif
if
(
!
rfp
)
if
(
!
rfp
)
return
false
;
return
false
;
ReplayHeader
rheader
;
ReplayHeader
rheader
;
size_t
count
=
fread
(
&
rheader
,
sizeof
(
ReplayHeader
)
,
1
,
rfp
);
size_t
count
=
fread
(
&
rheader
,
sizeof
rheader
,
1
,
rfp
);
fclose
(
rfp
);
fclose
(
rfp
);
return
count
==
1
&&
rheader
.
id
==
0x31707279
&&
rheader
.
version
>=
0x12d0u
&&
(
rheader
.
version
<
0x1353u
||
(
rheader
.
flag
&
REPLAY_UNIFORM
));
return
count
==
1
&&
rheader
.
id
==
0x31707279
&&
rheader
.
version
>=
0x12d0u
&&
(
rheader
.
version
<
0x1353u
||
(
rheader
.
flag
&
REPLAY_UNIFORM
));
}
}
bool
Replay
::
DeleteReplay
(
const
wchar_t
*
name
)
{
bool
Replay
::
DeleteReplay
(
const
wchar_t
*
name
)
{
wchar_t
fname
[
256
];
wchar_t
fname
[
256
];
myswprintf
(
fname
,
L"./replay/%ls"
,
name
);
myswprintf
(
fname
,
L"./replay/%ls"
,
name
);
#ifdef WIN32
#ifdef
_
WIN32
BOOL
result
=
DeleteFileW
(
fname
);
BOOL
result
=
DeleteFileW
(
fname
);
return
!!
result
;
return
!!
result
;
#else
#else
...
@@ -294,7 +229,7 @@ bool Replay::RenameReplay(const wchar_t* oldname, const wchar_t* newname) {
...
@@ -294,7 +229,7 @@ bool Replay::RenameReplay(const wchar_t* oldname, const wchar_t* newname) {
wchar_t
newfname
[
256
];
wchar_t
newfname
[
256
];
myswprintf
(
oldfname
,
L"./replay/%ls"
,
oldname
);
myswprintf
(
oldfname
,
L"./replay/%ls"
,
oldname
);
myswprintf
(
newfname
,
L"./replay/%ls"
,
newname
);
myswprintf
(
newfname
,
L"./replay/%ls"
,
newname
);
#ifdef WIN32
#ifdef
_
WIN32
BOOL
result
=
MoveFileW
(
oldfname
,
newfname
);
BOOL
result
=
MoveFileW
(
oldfname
,
newfname
);
return
!!
result
;
return
!!
result
;
#else
#else
...
@@ -307,45 +242,53 @@ bool Replay::RenameReplay(const wchar_t* oldname, const wchar_t* newname) {
...
@@ -307,45 +242,53 @@ bool Replay::RenameReplay(const wchar_t* oldname, const wchar_t* newname) {
#endif
#endif
}
}
bool
Replay
::
ReadNextResponse
(
unsigned
char
resp
[])
{
bool
Replay
::
ReadNextResponse
(
unsigned
char
resp
[])
{
if
(
pdata
-
replay_data
>=
(
int
)
replay_size
)
unsigned
char
len
{};
if
(
!
ReadData
(
&
len
,
sizeof
len
))
return
false
;
if
(
len
>
SIZE_RETURN_VALUE
)
{
is_replaying
=
false
;
return
false
;
return
false
;
int
len
=
*
pdata
++
;
}
if
(
len
>
SIZE_RETURN_VALUE
)
if
(
!
ReadData
(
resp
,
len
)
)
return
false
;
return
false
;
std
::
memcpy
(
resp
,
pdata
,
len
);
pdata
+=
len
;
return
true
;
return
true
;
}
}
void
Replay
::
ReadName
(
wchar_t
*
data
)
{
void
Replay
::
ReadName
(
wchar_t
*
data
)
{
if
(
!
is_replaying
)
uint16_t
buffer
[
20
]{};
if
(
!
ReadData
(
buffer
,
sizeof
buffer
))
{
data
[
0
]
=
0
;
return
;
return
;
unsigned
short
buffer
[
20
];
}
ReadData
(
buffer
,
40
);
BufferIO
::
CopyWStr
(
buffer
,
data
,
20
);
BufferIO
::
CopyWStr
(
buffer
,
data
,
20
);
}
}
void
Replay
::
ReadData
(
void
*
data
,
int
length
)
{
bool
Replay
::
ReadData
(
void
*
data
,
int
length
)
{
if
(
!
is_replaying
)
if
(
!
is_replaying
)
return
;
return
false
;
if
(
length
<
0
)
return
false
;
if
((
int
)(
pdata
-
replay_data
)
+
length
>
(
int
)
replay_size
)
{
is_replaying
=
false
;
return
false
;
}
std
::
memcpy
(
data
,
pdata
,
length
);
std
::
memcpy
(
data
,
pdata
,
length
);
pdata
+=
length
;
pdata
+=
length
;
return
true
;
}
}
int
Replay
::
ReadInt32
()
{
template
<
typename
T
>
if
(
!
is_replaying
)
T
Replay
::
ReadValue
()
{
T
ret
{};
if
(
!
ReadData
(
&
ret
,
sizeof
ret
))
return
-
1
;
return
-
1
;
int
ret
=
BufferIO
::
ReadInt32
(
pdata
);
return
ret
;
return
ret
;
}
}
int
Replay
::
ReadInt32
()
{
return
ReadValue
<
int32_t
>
();
}
short
Replay
::
ReadInt16
()
{
short
Replay
::
ReadInt16
()
{
if
(
!
is_replaying
)
return
ReadValue
<
int16_t
>
();
return
-
1
;
short
ret
=
BufferIO
::
ReadInt16
(
pdata
);
return
ret
;
}
}
char
Replay
::
ReadInt8
()
{
char
Replay
::
ReadInt8
()
{
if
(
!
is_replaying
)
return
ReadValue
<
char
>
();
return
-
1
;
char
ret
=
BufferIO
::
ReadInt8
(
pdata
);
return
ret
;
}
}
void
Replay
::
Rewind
()
{
void
Replay
::
Rewind
()
{
pdata
=
replay_data
;
pdata
=
replay_data
;
...
...
gframe/replay.h
View file @
70a6e002
...
@@ -56,7 +56,9 @@ public:
...
@@ -56,7 +56,9 @@ public:
bool
ReadNextResponse
(
unsigned
char
resp
[]);
bool
ReadNextResponse
(
unsigned
char
resp
[]);
void
ReadName
(
wchar_t
*
data
);
void
ReadName
(
wchar_t
*
data
);
//void ReadHeader(ReplayHeader& header);
//void ReadHeader(ReplayHeader& header);
void
ReadData
(
void
*
data
,
int
length
);
bool
ReadData
(
void
*
data
,
int
length
);
template
<
typename
T
>
T
ReadValue
();
int
ReadInt32
();
int
ReadInt32
();
short
ReadInt16
();
short
ReadInt16
();
char
ReadInt8
();
char
ReadInt8
();
...
@@ -68,13 +70,14 @@ public:
...
@@ -68,13 +70,14 @@ public:
#endif
#endif
ReplayHeader
pheader
;
ReplayHeader
pheader
;
unsigned
char
*
replay_data
;
unsigned
char
*
comp_data
;
unsigned
char
*
comp_data
;
size_t
replay_size
{};
size_t
comp_size
{};
size_t
comp_size
{};
private:
private:
unsigned
char
*
pdata
{
nullptr
};
unsigned
char
*
replay_data
;
size_t
replay_size
{};
unsigned
char
*
pwrite
{};
unsigned
char
*
pdata
{};
bool
is_recording
{};
bool
is_recording
{};
bool
is_replaying
{};
bool
is_replaying
{};
};
};
...
...
gframe/single_duel.cpp
View file @
70a6e002
...
@@ -1965,7 +1965,7 @@ if(!dp || dp == players[player])
...
@@ -1965,7 +1965,7 @@ if(!dp || dp == players[player])
continue
;
continue
;
auto
position
=
GetPosition
(
qbuf
,
8
);
auto
position
=
GetPosition
(
qbuf
,
8
);
if
(
position
&
POS_FACEDOWN
)
if
(
position
&
POS_FACEDOWN
)
memset
(
qbuf
,
0
,
clen
-
4
);
std
::
memset
(
qbuf
,
0
,
clen
-
4
);
qbuf
+=
clen
-
4
;
qbuf
+=
clen
-
4
;
}
}
#ifdef YGOPRO_SERVER_MODE
#ifdef YGOPRO_SERVER_MODE
...
@@ -2008,7 +2008,7 @@ if(!dp || dp == players[player])
...
@@ -2008,7 +2008,7 @@ if(!dp || dp == players[player])
continue
;
continue
;
auto
position
=
GetPosition
(
qbuf
,
8
);
auto
position
=
GetPosition
(
qbuf
,
8
);
if
(
position
&
POS_FACEDOWN
)
if
(
position
&
POS_FACEDOWN
)
memset
(
qbuf
,
0
,
clen
-
4
);
std
::
memset
(
qbuf
,
0
,
clen
-
4
);
qbuf
+=
clen
-
4
;
qbuf
+=
clen
-
4
;
}
}
#ifdef YGOPRO_SERVER_MODE
#ifdef YGOPRO_SERVER_MODE
...
@@ -2051,7 +2051,7 @@ if(!dp || dp == players[player])
...
@@ -2051,7 +2051,7 @@ if(!dp || dp == players[player])
continue
;
continue
;
auto
position
=
GetPosition
(
qbuf
,
8
);
auto
position
=
GetPosition
(
qbuf
,
8
);
if
(
!
(
position
&
POS_FACEUP
))
if
(
!
(
position
&
POS_FACEUP
))
memset
(
qbuf
,
0
,
slen
-
4
);
std
::
memset
(
qbuf
,
0
,
slen
-
4
);
qbuf
+=
slen
-
4
;
qbuf
+=
slen
-
4
;
}
}
#ifdef YGOPRO_SERVER_MODE
#ifdef YGOPRO_SERVER_MODE
...
@@ -2180,7 +2180,7 @@ void SingleDuel::RefreshSingle(int player, int location, int sequence, int flag)
...
@@ -2180,7 +2180,7 @@ void SingleDuel::RefreshSingle(int player, int location, int sequence, int flag)
if
(
position
&
POS_FACEDOWN
)
{
if
(
position
&
POS_FACEDOWN
)
{
BufferIO
::
WriteInt32
(
qbuf
,
QUERY_CODE
);
BufferIO
::
WriteInt32
(
qbuf
,
QUERY_CODE
);
BufferIO
::
WriteInt32
(
qbuf
,
0
);
BufferIO
::
WriteInt32
(
qbuf
,
0
);
memset
(
qbuf
,
0
,
clen
-
12
);
std
::
memset
(
qbuf
,
0
,
clen
-
12
);
}
}
NetServer
::
SendBufferToPlayer
(
players
[
1
-
player
],
STOC_GAME_MSG
,
query_buffer
,
len
+
4
);
NetServer
::
SendBufferToPlayer
(
players
[
1
-
player
],
STOC_GAME_MSG
,
query_buffer
,
len
+
4
);
for
(
auto
pit
=
observers
.
begin
();
pit
!=
observers
.
end
();
++
pit
)
for
(
auto
pit
=
observers
.
begin
();
pit
!=
observers
.
end
();
++
pit
)
...
...
gframe/tag_duel.cpp
View file @
70a6e002
...
@@ -2080,7 +2080,7 @@ if(!dp || dp == players[pid])
...
@@ -2080,7 +2080,7 @@ if(!dp || dp == players[pid])
continue
;
continue
;
auto
position
=
GetPosition
(
qbuf
,
8
);
auto
position
=
GetPosition
(
qbuf
,
8
);
if
(
position
&
POS_FACEDOWN
)
if
(
position
&
POS_FACEDOWN
)
memset
(
qbuf
,
0
,
clen
-
4
);
std
::
memset
(
qbuf
,
0
,
clen
-
4
);
qbuf
+=
clen
-
4
;
qbuf
+=
clen
-
4
;
}
}
pid
=
2
-
pid
;
pid
=
2
-
pid
;
...
@@ -2133,7 +2133,7 @@ if(!dp || dp == players[pid])
...
@@ -2133,7 +2133,7 @@ if(!dp || dp == players[pid])
continue
;
continue
;
auto
position
=
GetPosition
(
qbuf
,
8
);
auto
position
=
GetPosition
(
qbuf
,
8
);
if
(
position
&
POS_FACEDOWN
)
if
(
position
&
POS_FACEDOWN
)
memset
(
qbuf
,
0
,
clen
-
4
);
std
::
memset
(
qbuf
,
0
,
clen
-
4
);
qbuf
+=
clen
-
4
;
qbuf
+=
clen
-
4
;
}
}
pid
=
2
-
pid
;
pid
=
2
-
pid
;
...
@@ -2181,7 +2181,7 @@ if(!dp || dp == cur_player[player])
...
@@ -2181,7 +2181,7 @@ if(!dp || dp == cur_player[player])
continue
;
continue
;
auto
position
=
GetPosition
(
qbuf
,
8
);
auto
position
=
GetPosition
(
qbuf
,
8
);
if
(
!
(
position
&
POS_FACEUP
))
if
(
!
(
position
&
POS_FACEUP
))
memset
(
qbuf
,
0
,
slen
-
4
);
std
::
memset
(
qbuf
,
0
,
slen
-
4
);
qbuf
+=
slen
-
4
;
qbuf
+=
slen
-
4
;
}
}
for
(
int
i
=
0
;
i
<
4
;
++
i
)
for
(
int
i
=
0
;
i
<
4
;
++
i
)
...
...
lflist.conf
View file @
70a6e002
This diff is collapsed.
Click to expand it.
ocgcore
@
fc6cb4cd
Subproject commit
15c1afb88913d2fd22b8b8192df5e523e1d95906
Subproject commit
fc6cb4cd3384476a6db86fe74ff0bad1f6570e05
script
@
d6ab1ea8
Subproject commit
e9e531084c99616bc911be29acb5db165f22a5eb
Subproject commit
d6ab1ea861870c15aeb8b8d567754de59449cd88
strings.conf
View file @
70a6e002
...
@@ -748,8 +748,11 @@
...
@@ -748,8 +748,11 @@
!
setname
0
x3a
遗式 リチュア
!
setname
0
x3a
遗式 リチュア
!
setname
0
x3b
真红眼 レッドアイズ
!
setname
0
x3b
真红眼 レッドアイズ
!
setname
0
x3c
爬虫妖 レプティレス
!
setname
0
x3c
爬虫妖 レプティレス
!
setname
0
x3d
六武众 六武衆
#setname 0x3d 六武
!
setname
0
x103d
影六武众 影六武衆
!
setname
0
x103d
六武众 六武衆
!
setname
0
x203d
六武式
#setname 0x503d 真六武众 真六武衆
!
setname
0
x903d
影六武众 影六武衆
!
setname
0
x3e
异虫 ワーム
!
setname
0
x3e
异虫 ワーム
!
setname
0
x3f
救世 セイヴァー
!
setname
0
x3f
救世 セイヴァー
!
setname
0
x40
被封印 封印されし
!
setname
0
x40
被封印 封印されし
...
@@ -1231,8 +1234,10 @@
...
@@ -1231,8 +1234,10 @@
!
setname
0
x1b8
鲨 シャーク
!
setname
0
x1b8
鲨 シャーク
!
setname
0
x11b8
鲨龙兽 シャーク・ドレイク
!
setname
0
x11b8
鲨龙兽 シャーク・ドレイク
!
setname
0
x1b9
原石
!
setname
0
x1b9
原石
!
setname
0
x1ba
六武式
!
setname
0
x1ba
金属化 メタル化
!
setname
0
x1bb
金属化 メタル化
!
setname
0
x1bb
魔瞳 モルガナイト
!
setname
0
x1bc
魔瞳 モルガナイト
!
setname
0
x1bc
蓟花 アザミナ
!
setname
0
x1bd
蓟花 アザミナ
!
setname
0
x1bd
祝台
!
setname
0
x1be
祝台
!
setname
0
x1be
雷火沸动 ライゼオル
!
setname
0
x1bf
码丽丝
M
∀
LICE
!
setname
0
x1c0
龙华 竜華
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