Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Y
YGOMobile-Cn-Ko-En
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
fallenstardust
YGOMobile-Cn-Ko-En
Commits
080df2c7
Commit
080df2c7
authored
Dec 26, 2024
by
fallenstardust
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update Gframe
parent
d65b2e45
Changes
14
Hide whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
70 additions
and
74 deletions
+70
-74
Classes/gframe/data_manager.cpp
Classes/gframe/data_manager.cpp
+28
-25
Classes/gframe/data_manager.h
Classes/gframe/data_manager.h
+4
-0
Classes/gframe/duelclient.cpp
Classes/gframe/duelclient.cpp
+14
-17
Classes/gframe/duelclient.h
Classes/gframe/duelclient.h
+4
-8
Classes/gframe/event_handler.cpp
Classes/gframe/event_handler.cpp
+2
-0
Classes/gframe/netserver.cpp
Classes/gframe/netserver.cpp
+6
-8
Classes/gframe/netserver.h
Classes/gframe/netserver.h
+0
-4
Classes/gframe/network.h
Classes/gframe/network.h
+4
-4
Classes/gframe/replay_mode.cpp
Classes/gframe/replay_mode.cpp
+1
-1
Classes/gframe/single_duel.cpp
Classes/gframe/single_duel.cpp
+2
-2
Classes/gframe/single_duel.h
Classes/gframe/single_duel.h
+1
-1
Classes/gframe/single_mode.cpp
Classes/gframe/single_mode.cpp
+1
-1
Classes/gframe/tag_duel.cpp
Classes/gframe/tag_duel.cpp
+2
-2
Classes/gframe/tag_duel.h
Classes/gframe/tag_duel.h
+1
-1
No files found.
Classes/gframe/data_manager.cpp
View file @
080df2c7
...
@@ -390,36 +390,26 @@ uint32_t DataManager::CardReader(uint32_t code, card_data* pData) {
...
@@ -390,36 +390,26 @@ uint32_t DataManager::CardReader(uint32_t code, card_data* pData) {
}
}
unsigned
char
*
DataManager
::
ScriptReaderEx
(
const
char
*
script_name
,
int
*
slen
)
{
unsigned
char
*
DataManager
::
ScriptReaderEx
(
const
char
*
script_name
,
int
*
slen
)
{
// default script name: ./script/c%d.lua
// default script name: ./script/c%d.lua
char
first
[
256
]{};
if
(
std
::
strncmp
(
script_name
,
"./script"
,
8
)
!=
0
)
char
second
[
256
]{};
return
DefaultScriptReader
(
script_name
,
slen
);
char
expansions_path
[
1024
]{};
std
::
snprintf
(
expansions_path
,
sizeof
expansions_path
,
"./expansions/%s"
,
script_name
+
2
);
if
(
mainGame
->
gameConf
.
prefer_expansion_script
)
{
if
(
mainGame
->
gameConf
.
prefer_expansion_script
)
{
snprintf
(
first
,
sizeof
first
,
"expansions/%s"
,
script_name
+
2
);
if
(
DefaultScriptReader
(
expansions_path
,
slen
))
snprintf
(
second
,
sizeof
second
,
"%s"
,
script_name
+
2
);
return
scriptBuffer
;
else
if
(
ScriptReaderZip
(
script_name
+
2
,
slen
))
return
scriptBuffer
;
else
if
(
DefaultScriptReader
(
script_name
,
slen
))
return
scriptBuffer
;
}
else
{
}
else
{
snprintf
(
first
,
sizeof
first
,
"%s"
,
script_name
+
2
);
if
(
DefaultScriptReader
(
script_name
,
slen
))
snprintf
(
second
,
sizeof
second
,
"expansions/%s"
,
script_name
+
2
);
return
scriptBuffer
;
}
else
if
(
DefaultScriptReader
(
expansions_path
,
slen
))
if
(
mainGame
->
gameConf
.
prefer_expansion_script
)
{
if
(
ScriptReader
(
first
,
slen
))
return
scriptBuffer
;
return
scriptBuffer
;
if
(
ScriptReader
(
second
,
slen
))
else
if
(
ScriptReaderZip
(
script_name
+
2
,
slen
))
return
scriptBuffer
;
return
scriptBuffer
;
}
}
if
(
ScriptReaderZip
(
first
,
slen
))
return
nullptr
;
return
scriptBuffer
;
else
return
ScriptReaderZip
(
second
,
slen
);
}
unsigned
char
*
DataManager
::
ScriptReader
(
const
char
*
script_name
,
int
*
slen
)
{
FILE
*
fp
=
fopen
(
script_name
,
"rb"
);
if
(
!
fp
)
return
0
;
int
len
=
fread
(
scriptBuffer
,
1
,
sizeof
(
scriptBuffer
),
fp
);
fclose
(
fp
);
if
(
len
>=
sizeof
(
scriptBuffer
))
return
0
;
*
slen
=
len
;
return
scriptBuffer
;
}
}
unsigned
char
*
DataManager
::
ScriptReaderZip
(
const
char
*
script_name
,
int
*
slen
)
{
unsigned
char
*
DataManager
::
ScriptReaderZip
(
const
char
*
script_name
,
int
*
slen
)
{
IReadFile
*
reader
=
FileSystem
->
createAndOpenFile
(
script_name
);
IReadFile
*
reader
=
FileSystem
->
createAndOpenFile
(
script_name
);
...
@@ -435,5 +425,18 @@ unsigned char* DataManager::ScriptReaderZip(const char* script_name, int* slen)
...
@@ -435,5 +425,18 @@ unsigned char* DataManager::ScriptReaderZip(const char* script_name, int* slen)
*
slen
=
(
int
)
size
;
*
slen
=
(
int
)
size
;
return
scriptBuffer
;
return
scriptBuffer
;
}
}
unsigned
char
*
DataManager
::
DefaultScriptReader
(
const
char
*
script_name
,
int
*
slen
)
{
wchar_t
fname
[
256
]{};
BufferIO
::
DecodeUTF8
(
script_name
,
fname
);
FILE
*
fp
=
myfopen
(
fname
,
"rb"
);
if
(
!
fp
)
return
nullptr
;
size_t
len
=
std
::
fread
(
scriptBuffer
,
1
,
sizeof
scriptBuffer
,
fp
);
std
::
fclose
(
fp
);
if
(
len
>=
sizeof
scriptBuffer
)
return
nullptr
;
*
slen
=
(
int
)
len
;
return
scriptBuffer
;
}
}
}
Classes/gframe/data_manager.h
View file @
080df2c7
...
@@ -54,7 +54,11 @@ public:
...
@@ -54,7 +54,11 @@ public:
static
const
wchar_t
*
unknown_string
;
static
const
wchar_t
*
unknown_string
;
static
uint32_t
CardReader
(
uint32_t
,
card_data
*
);
static
uint32_t
CardReader
(
uint32_t
,
card_data
*
);
static
unsigned
char
*
ScriptReaderEx
(
const
char
*
script_name
,
int
*
slen
);
static
unsigned
char
*
ScriptReaderEx
(
const
char
*
script_name
,
int
*
slen
);
//read by IFileSystem
static
unsigned
char
*
ScriptReader
(
const
char
*
script_name
,
int
*
slen
);
static
unsigned
char
*
ScriptReader
(
const
char
*
script_name
,
int
*
slen
);
//read by fread
static
unsigned
char
*
DefaultScriptReader
(
const
char
*
script_name
,
int
*
slen
);
static
unsigned
char
*
ScriptReaderZip
(
const
char
*
script_name
,
int
*
slen
);
static
unsigned
char
*
ScriptReaderZip
(
const
char
*
script_name
,
int
*
slen
);
static
IFileSystem
*
FileSystem
;
static
IFileSystem
*
FileSystem
;
...
...
Classes/gframe/duelclient.cpp
View file @
080df2c7
#include "config.h"
#include "duelclient.h"
#include "duelclient.h"
#include "client_card.h"
#include "client_card.h"
#include "materials.h"
#include "materials.h"
#include "image_manager.h"
#include "image_manager.h"
#include "sound_manager.h"
#include "single_mode.h"
#include "single_mode.h"
#include "../ocgcore/common.h"
#include "game.h"
#include "game.h"
#include "deck_manager.h"
#include "replay.h"
#include "replay.h"
#include "replay_mode.h"
#include <thread>
#include <thread>
#ifdef _IRR_ANDROID_PLATFORM_
#ifdef _IRR_ANDROID_PLATFORM_
#include <android/android_tools.h>
#include <android/android_tools.h>
...
@@ -16,7 +17,7 @@ namespace ygo {
...
@@ -16,7 +17,7 @@ namespace ygo {
unsigned
DuelClient
::
connect_state
=
0
;
unsigned
DuelClient
::
connect_state
=
0
;
unsigned
char
DuelClient
::
response_buf
[
SIZE_RETURN_VALUE
];
unsigned
char
DuelClient
::
response_buf
[
SIZE_RETURN_VALUE
];
unsigned
in
t
DuelClient
::
response_len
=
0
;
size_
t
DuelClient
::
response_len
=
0
;
unsigned
int
DuelClient
::
watching
=
0
;
unsigned
int
DuelClient
::
watching
=
0
;
unsigned
char
DuelClient
::
selftype
=
0
;
unsigned
char
DuelClient
::
selftype
=
0
;
bool
DuelClient
::
is_host
=
false
;
bool
DuelClient
::
is_host
=
false
;
...
@@ -29,7 +30,7 @@ int DuelClient::select_hint = 0;
...
@@ -29,7 +30,7 @@ int DuelClient::select_hint = 0;
int
DuelClient
::
select_unselect_hint
=
0
;
int
DuelClient
::
select_unselect_hint
=
0
;
int
DuelClient
::
last_select_hint
=
0
;
int
DuelClient
::
last_select_hint
=
0
;
unsigned
char
DuelClient
::
last_successful_msg
[
0x2000
];
unsigned
char
DuelClient
::
last_successful_msg
[
0x2000
];
unsigned
in
t
DuelClient
::
last_successful_msg_length
=
0
;
size_
t
DuelClient
::
last_successful_msg_length
=
0
;
wchar_t
DuelClient
::
event_string
[
256
];
wchar_t
DuelClient
::
event_string
[
256
];
mt19937
DuelClient
::
rnd
;
mt19937
DuelClient
::
rnd
;
...
@@ -51,7 +52,6 @@ bool DuelClient::StartClient(unsigned int ip, unsigned short port, bool create_g
...
@@ -51,7 +52,6 @@ bool DuelClient::StartClient(unsigned int ip, unsigned short port, bool create_g
sin
.
sin_addr
.
s_addr
=
htonl
(
ip
);
sin
.
sin_addr
.
s_addr
=
htonl
(
ip
);
sin
.
sin_port
=
htons
(
port
);
sin
.
sin_port
=
htons
(
port
);
client_bev
=
bufferevent_socket_new
(
client_base
,
-
1
,
BEV_OPT_CLOSE_ON_FREE
);
client_bev
=
bufferevent_socket_new
(
client_base
,
-
1
,
BEV_OPT_CLOSE_ON_FREE
);
bufferevent_setwatermark
(
client_bev
,
EV_READ
,
3
,
0
);
bufferevent_setcb
(
client_bev
,
ClientRead
,
nullptr
,
ClientEvent
,
(
void
*
)
create_game
);
bufferevent_setcb
(
client_bev
,
ClientRead
,
nullptr
,
ClientEvent
,
(
void
*
)
create_game
);
if
(
bufferevent_socket_connect
(
client_bev
,
(
sockaddr
*
)
&
sin
,
sizeof
(
sin
))
<
0
)
{
if
(
bufferevent_socket_connect
(
client_bev
,
(
sockaddr
*
)
&
sin
,
sizeof
(
sin
))
<
0
)
{
bufferevent_free
(
client_bev
);
bufferevent_free
(
client_bev
);
...
@@ -102,19 +102,16 @@ void DuelClient::StopClient(bool is_exiting) {
...
@@ -102,19 +102,16 @@ 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
);
if
(
len
<
2
)
return
;
unsigned
char
*
duel_client_read
=
new
unsigned
char
[
SIZE_NETWORK_BUFFER
];
unsigned
char
*
duel_client_read
=
new
unsigned
char
[
SIZE_NETWORK_BUFFER
];
u
nsigned
short
packet_len
;
u
int16_t
packet_len
=
0
;
while
(
len
>=
2
)
{
while
(
len
>=
2
)
{
evbuffer_copyout
(
input
,
&
packet_len
,
sizeof
packet_len
);
evbuffer_copyout
(
input
,
&
packet_len
,
sizeof
packet_len
);
if
(
packet_len
+
2
>
SIZE_NETWORK_BUFFER
)
{
delete
[]
duel_client_read
;
ClientEvent
(
bev
,
BEV_EVENT_ERROR
,
0
);
return
;
}
if
(
len
<
packet_len
+
2
)
if
(
len
<
packet_len
+
2
)
break
;
break
;
int
read_len
=
evbuffer_remove
(
input
,
duel_client_read
,
packet_len
+
2
);
int
read_len
=
evbuffer_remove
(
input
,
duel_client_read
,
packet_len
+
2
);
if
(
read_len
>
=
3
)
if
(
read_len
>
2
)
HandleSTOCPacketLan
(
&
duel_client_read
[
2
],
read_len
-
2
);
HandleSTOCPacketLan
(
&
duel_client_read
[
2
],
read_len
-
2
);
len
-=
packet_len
+
2
;
len
-=
packet_len
+
2
;
}
}
...
@@ -4110,11 +4107,11 @@ int DuelClient::ClientAnalyze(unsigned char* msg, unsigned int len) {
...
@@ -4110,11 +4107,11 @@ int DuelClient::ClientAnalyze(unsigned char* msg, unsigned int len) {
void
DuelClient
::
SwapField
()
{
void
DuelClient
::
SwapField
()
{
is_swapping
=
true
;
is_swapping
=
true
;
}
}
void
DuelClient
::
SetResponseI
(
int
respI
)
{
void
DuelClient
::
SetResponseI
(
int
32_t
respI
)
{
std
::
memcpy
(
response_buf
,
&
respI
,
sizeof
respI
);
std
::
memcpy
(
response_buf
,
&
respI
,
sizeof
respI
);
response_len
=
4
;
response_len
=
sizeof
respI
;
}
}
void
DuelClient
::
SetResponseB
(
void
*
respB
,
unsigned
in
t
len
)
{
void
DuelClient
::
SetResponseB
(
void
*
respB
,
size_
t
len
)
{
if
(
len
>
SIZE_RETURN_VALUE
)
if
(
len
>
SIZE_RETURN_VALUE
)
len
=
SIZE_RETURN_VALUE
;
len
=
SIZE_RETURN_VALUE
;
std
::
memcpy
(
response_buf
,
respB
,
len
);
std
::
memcpy
(
response_buf
,
respB
,
len
);
...
@@ -4172,7 +4169,7 @@ void DuelClient::BeginRefreshHost() {
...
@@ -4172,7 +4169,7 @@ void DuelClient::BeginRefreshHost() {
return
;
return
;
}
}
#else
#else
char
hname
[
256
];
char
hname
[
256
];
gethostname
(
hname
,
256
);
gethostname
(
hname
,
256
);
hostent
*
host
=
gethostbyname
(
hname
);
hostent
*
host
=
gethostbyname
(
hname
);
if
(
!
host
)
if
(
!
host
)
...
@@ -4286,7 +4283,7 @@ void DuelClient::BroadcastReply(evutil_socket_t fd, short events, void * arg) {
...
@@ -4286,7 +4283,7 @@ void DuelClient::BroadcastReply(evutil_socket_t fd, short events, void * arg) {
else
hoststr
.
append
(
dataManager
.
GetSysString
(
1248
));
else
hoststr
.
append
(
dataManager
.
GetSysString
(
1248
));
hoststr
.
append
(
L"]"
);
hoststr
.
append
(
L"]"
);
wchar_t
gamename
[
20
];
wchar_t
gamename
[
20
];
BufferIO
::
Copy
WStr
(
pHP
->
name
,
gamename
,
20
);
BufferIO
::
Copy
CharArray
(
pHP
->
name
,
gamename
);
hoststr
.
append
(
gamename
);
hoststr
.
append
(
gamename
);
mainGame
->
lstHostList
->
addItem
(
hoststr
.
c_str
());
mainGame
->
lstHostList
->
addItem
(
hoststr
.
c_str
());
mainGame
->
gMutex
.
unlock
();
mainGame
->
gMutex
.
unlock
();
...
...
Classes/gframe/duelclient.h
View file @
080df2c7
#ifndef DUELCLIENT_H
#ifndef DUELCLIENT_H
#define DUELCLIENT_H
#define DUELCLIENT_H
#include "config.h"
#include <vector>
#include <vector>
#include <set>
#include <set>
#include <utility>
#include "network.h"
#include "network.h"
#include "data_manager.h"
#include "deck_manager.h"
#include "../ocgcore/mtrandom.h"
#include "../ocgcore/mtrandom.h"
namespace
ygo
{
namespace
ygo
{
...
@@ -16,7 +12,7 @@ class DuelClient {
...
@@ -16,7 +12,7 @@ class DuelClient {
private:
private:
static
unsigned
int
connect_state
;
static
unsigned
int
connect_state
;
static
unsigned
char
response_buf
[
SIZE_RETURN_VALUE
];
static
unsigned
char
response_buf
[
SIZE_RETURN_VALUE
];
static
unsigned
in
t
response_len
;
static
size_
t
response_len
;
static
unsigned
int
watching
;
static
unsigned
int
watching
;
static
bool
is_host
;
static
bool
is_host
;
static
event_base
*
client_base
;
static
event_base
*
client_base
;
...
@@ -28,7 +24,7 @@ private:
...
@@ -28,7 +24,7 @@ private:
static
int
select_unselect_hint
;
static
int
select_unselect_hint
;
static
int
last_select_hint
;
static
int
last_select_hint
;
static
unsigned
char
last_successful_msg
[
0x2000
];
static
unsigned
char
last_successful_msg
[
0x2000
];
static
unsigned
in
t
last_successful_msg_length
;
static
size_
t
last_successful_msg_length
;
static
wchar_t
event_string
[
256
];
static
wchar_t
event_string
[
256
];
static
mt19937
rnd
;
static
mt19937
rnd
;
static
bool
is_refreshing
;
static
bool
is_refreshing
;
...
@@ -47,8 +43,8 @@ public:
...
@@ -47,8 +43,8 @@ public:
static
void
HandleSTOCPacketLan
(
unsigned
char
*
data
,
int
len
);
static
void
HandleSTOCPacketLan
(
unsigned
char
*
data
,
int
len
);
static
int
ClientAnalyze
(
unsigned
char
*
msg
,
unsigned
int
len
);
static
int
ClientAnalyze
(
unsigned
char
*
msg
,
unsigned
int
len
);
static
void
SwapField
();
static
void
SwapField
();
static
void
SetResponseI
(
int
respI
);
static
void
SetResponseI
(
int
32_t
respI
);
static
void
SetResponseB
(
void
*
respB
,
unsigned
in
t
len
);
static
void
SetResponseB
(
void
*
respB
,
size_
t
len
);
static
void
SendResponse
();
static
void
SendResponse
();
static
void
SendPacketToServer
(
unsigned
char
proto
)
{
static
void
SendPacketToServer
(
unsigned
char
proto
)
{
auto
p
=
duel_client_write
;
auto
p
=
duel_client_write
;
...
...
Classes/gframe/event_handler.cpp
View file @
080df2c7
...
@@ -6,6 +6,8 @@
...
@@ -6,6 +6,8 @@
#include "duelclient.h"
#include "duelclient.h"
#include "data_manager.h"
#include "data_manager.h"
#include "image_manager.h"
#include "image_manager.h"
#include "sound_manager.h"
#include "deck_manager.h"
#include "replay_mode.h"
#include "replay_mode.h"
#include "single_mode.h"
#include "single_mode.h"
#include "materials.h"
#include "materials.h"
...
...
Classes/gframe/netserver.cpp
View file @
080df2c7
#include "config.h"
#include "netserver.h"
#include "netserver.h"
#include "single_duel.h"
#include "single_duel.h"
#include "tag_duel.h"
#include "tag_duel.h"
#include "deck_manager.h"
#include <thread>
#include <thread>
namespace
ygo
{
namespace
ygo
{
...
@@ -108,7 +110,6 @@ void NetServer::ServerAccept(evconnlistener* listener, evutil_socket_t fd, socka
...
@@ -108,7 +110,6 @@ void NetServer::ServerAccept(evconnlistener* listener, evutil_socket_t fd, socka
dp
.
type
=
0xff
;
dp
.
type
=
0xff
;
dp
.
bev
=
bev
;
dp
.
bev
=
bev
;
users
[
bev
]
=
dp
;
users
[
bev
]
=
dp
;
bufferevent_setwatermark
(
bev
,
EV_READ
,
3
,
0
);
bufferevent_setcb
(
bev
,
ServerEchoRead
,
nullptr
,
ServerEchoEvent
,
nullptr
);
bufferevent_setcb
(
bev
,
ServerEchoRead
,
nullptr
,
ServerEchoEvent
,
nullptr
);
bufferevent_enable
(
bev
,
EV_READ
);
bufferevent_enable
(
bev
,
EV_READ
);
}
}
...
@@ -123,19 +124,16 @@ void NetServer::ServerAcceptError(evconnlistener* listener, void* ctx) {
...
@@ -123,19 +124,16 @@ 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
);
if
(
len
<
2
)
return
;
unsigned
char
*
net_server_read
=
new
unsigned
char
[
SIZE_NETWORK_BUFFER
];
unsigned
char
*
net_server_read
=
new
unsigned
char
[
SIZE_NETWORK_BUFFER
];
u
nsigned
short
packet_len
;
u
int16_t
packet_len
=
0
;
while
(
len
>=
2
)
{
while
(
len
>=
2
)
{
evbuffer_copyout
(
input
,
&
packet_len
,
sizeof
packet_len
);
evbuffer_copyout
(
input
,
&
packet_len
,
sizeof
packet_len
);
if
(
packet_len
+
2
>
SIZE_NETWORK_BUFFER
)
{
delete
[]
net_server_read
;
ServerEchoEvent
(
bev
,
BEV_EVENT_ERROR
,
0
);
return
;
}
if
(
len
<
packet_len
+
2
)
if
(
len
<
packet_len
+
2
)
break
;
break
;
int
read_len
=
evbuffer_remove
(
input
,
net_server_read
,
packet_len
+
2
);
int
read_len
=
evbuffer_remove
(
input
,
net_server_read
,
packet_len
+
2
);
if
(
read_len
>
=
3
)
if
(
read_len
>
2
)
HandleCTOSPacket
(
&
users
[
bev
],
&
net_server_read
[
2
],
read_len
-
2
);
HandleCTOSPacket
(
&
users
[
bev
],
&
net_server_read
[
2
],
read_len
-
2
);
len
-=
packet_len
+
2
;
len
-=
packet_len
+
2
;
}
}
...
...
Classes/gframe/netserver.h
View file @
080df2c7
#ifndef NETSERVER_H
#ifndef NETSERVER_H
#define NETSERVER_H
#define NETSERVER_H
#include "config.h"
#include "network.h"
#include "network.h"
#include "data_manager.h"
#include "deck_manager.h"
#include <set>
#include <unordered_map>
#include <unordered_map>
namespace
ygo
{
namespace
ygo
{
...
...
Classes/gframe/network.h
View file @
080df2c7
#ifndef NETWORK_H
#ifndef NETWORK_H
#define NETWORK_H
#define NETWORK_H
#include
"config.h"
#include
<cstdint>
#include
"deck_manager.h"
#include
<cstring>
#include <event2/event.h>
#include <event2/event.h>
#include <event2/listener.h>
#include <event2/listener.h>
#include <event2/bufferevent.h>
#include <event2/bufferevent.h>
...
@@ -13,7 +13,7 @@
...
@@ -13,7 +13,7 @@
#define check_trivially_copyable(T) static_assert(std::is_trivially_copyable<T>::value == true && std::is_standard_layout<T>::value == true, "not trivially copyable")
#define check_trivially_copyable(T) static_assert(std::is_trivially_copyable<T>::value == true && std::is_standard_layout<T>::value == true, "not trivially copyable")
namespace
ygo
{
namespace
ygo
{
constexpr
int
SIZE_NETWORK_BUFFER
=
0x2000
;
constexpr
int
SIZE_NETWORK_BUFFER
=
0x2000
0
;
constexpr
int
MAX_DATA_SIZE
=
SIZE_NETWORK_BUFFER
-
3
;
constexpr
int
MAX_DATA_SIZE
=
SIZE_NETWORK_BUFFER
-
3
;
constexpr
int
MAINC_MAX
=
250
;
// the limit of card_state
constexpr
int
MAINC_MAX
=
250
;
// the limit of card_state
constexpr
int
SIDEC_MAX
=
MAINC_MAX
;
constexpr
int
SIDEC_MAX
=
MAINC_MAX
;
...
@@ -191,7 +191,7 @@ struct DuelPlayer {
...
@@ -191,7 +191,7 @@ struct DuelPlayer {
inline
bool
check_msg_size
(
int
size
)
{
inline
bool
check_msg_size
(
int
size
)
{
// empty string is not allowed
// empty string is not allowed
if
(
size
<
2
*
sizeof
(
uint16_t
))
if
(
size
<
2
*
sizeof
(
uint16_t
))
return
false
;
return
false
;
if
(
size
>
LEN_CHAT_MSG
*
sizeof
(
uint16_t
))
if
(
size
>
LEN_CHAT_MSG
*
sizeof
(
uint16_t
))
return
false
;
return
false
;
...
...
Classes/gframe/replay_mode.cpp
View file @
080df2c7
#include "replay_mode.h"
#include "replay_mode.h"
#include "duelclient.h"
#include "duelclient.h"
#include "game.h"
#include "game.h"
#include "
../ocgcore/common
.h"
#include "
data_manager
.h"
#include "../ocgcore/mtrandom.h"
#include "../ocgcore/mtrandom.h"
#include <thread>
#include <thread>
...
...
Classes/gframe/single_duel.cpp
View file @
080df2c7
#include "config.h"
#include "single_duel.h"
#include "single_duel.h"
#include "netserver.h"
#include "netserver.h"
#include "game.h"
#include "game.h"
#include "../ocgcore/ocgapi.h"
#include "data_manager.h"
#include "../ocgcore/common.h"
#include "../ocgcore/mtrandom.h"
#include "../ocgcore/mtrandom.h"
namespace
ygo
{
namespace
ygo
{
...
...
Classes/gframe/single_duel.h
View file @
080df2c7
#ifndef SINGLE_DUEL_H
#ifndef SINGLE_DUEL_H
#define SINGLE_DUEL_H
#define SINGLE_DUEL_H
#include "config.h"
#include "network.h"
#include "network.h"
#include "deck_manager.h"
#include "replay.h"
#include "replay.h"
namespace
ygo
{
namespace
ygo
{
...
...
Classes/gframe/single_mode.cpp
View file @
080df2c7
#include "single_mode.h"
#include "single_mode.h"
#include "duelclient.h"
#include "duelclient.h"
#include "game.h"
#include "game.h"
#include "
../ocgcore/common
.h"
#include "
data_manager
.h"
#include "../ocgcore/mtrandom.h"
#include "../ocgcore/mtrandom.h"
#include <thread>
#include <thread>
...
...
Classes/gframe/tag_duel.cpp
View file @
080df2c7
#include "config.h"
#include "tag_duel.h"
#include "tag_duel.h"
#include "netserver.h"
#include "netserver.h"
#include "game.h"
#include "game.h"
#include "../ocgcore/ocgapi.h"
#include "data_manager.h"
#include "../ocgcore/common.h"
#include "../ocgcore/mtrandom.h"
#include "../ocgcore/mtrandom.h"
namespace
ygo
{
namespace
ygo
{
...
...
Classes/gframe/tag_duel.h
View file @
080df2c7
#ifndef TAG_DUEL_H
#ifndef TAG_DUEL_H
#define TAG_DUEL_H
#define TAG_DUEL_H
#include "config.h"
#include "network.h"
#include "network.h"
#include "deck_manager.h"
#include "replay.h"
#include "replay.h"
namespace
ygo
{
namespace
ygo
{
...
...
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