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
MobiusMei
ygopro
Commits
afe6dbca
Commit
afe6dbca
authored
Jan 12, 2012
by
argon.sun
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
proto
parent
42ea0f69
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
27 additions
and
18 deletions
+27
-18
gframe/duelclient.cpp
gframe/duelclient.cpp
+23
-15
gframe/duelclient.h
gframe/duelclient.h
+2
-2
gframe/menu_handler.cpp
gframe/menu_handler.cpp
+1
-0
system.conf
system.conf
+1
-1
No files found.
gframe/duelclient.cpp
View file @
afe6dbca
...
@@ -13,7 +13,7 @@ char DuelClient::duel_client_read[0x2000];
...
@@ -13,7 +13,7 @@ char DuelClient::duel_client_read[0x2000];
char
DuelClient
::
duel_client_write
[
0x2000
];
char
DuelClient
::
duel_client_write
[
0x2000
];
bool
DuelClient
::
is_closing
=
false
;
bool
DuelClient
::
is_closing
=
false
;
bool
DuelClient
::
StartClient
(
unsigned
int
ip
,
unsigned
short
port
)
{
bool
DuelClient
::
StartClient
(
unsigned
int
ip
,
unsigned
short
port
,
bool
create_game
)
{
if
(
connect_state
)
if
(
connect_state
)
return
false
;
return
false
;
sockaddr_in
sin
;
sockaddr_in
sin
;
...
@@ -25,7 +25,7 @@ bool DuelClient::StartClient(unsigned int ip, unsigned short port) {
...
@@ -25,7 +25,7 @@ bool DuelClient::StartClient(unsigned int ip, unsigned short port) {
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_setcb
(
client_bev
,
ClientRead
,
NULL
,
ClientEvent
,
NULL
);
bufferevent_setcb
(
client_bev
,
ClientRead
,
NULL
,
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
);
return
false
;
return
false
;
...
@@ -63,25 +63,33 @@ void DuelClient::ClientRead(bufferevent* bev, void* ctx) {
...
@@ -63,25 +63,33 @@ void DuelClient::ClientRead(bufferevent* bev, void* ctx) {
len
-=
packet_len
+
2
;
len
-=
packet_len
+
2
;
}
}
}
}
void
DuelClient
::
ClientEvent
(
bufferevent
*
bev
,
short
events
,
void
*
ptr
)
{
void
DuelClient
::
ClientEvent
(
bufferevent
*
bev
,
short
events
,
void
*
ctx
)
{
if
(
events
&
BEV_EVENT_CONNECTED
)
{
if
(
events
&
BEV_EVENT_CONNECTED
)
{
bool
create_game
=
(
bool
)
ctx
;
mainGame
->
HideElement
(
mainGame
->
wCreateHost
);
mainGame
->
HideElement
(
mainGame
->
wCreateHost
);
mainGame
->
WaitFrameSignal
(
10
);
mainGame
->
WaitFrameSignal
(
10
);
CTOS_PlayerInfo
cspi
;
CTOS_PlayerInfo
cspi
;
BufferIO
::
CopyWStr
(
mainGame
->
ebNickName
->
getText
(),
cspi
.
name
,
20
);
BufferIO
::
CopyWStr
(
mainGame
->
ebNickName
->
getText
(),
cspi
.
name
,
20
);
SendPacketToServer
(
CTOS_PLAYER_INFO
,
cspi
);
SendPacketToServer
(
CTOS_PLAYER_INFO
,
cspi
);
CTOS_CreateGame
cscg
;
if
(
create_game
)
{
BufferIO
::
CopyWStr
(
mainGame
->
ebServerName
->
getText
(),
cscg
.
name
,
20
);
CTOS_CreateGame
cscg
;
BufferIO
::
CopyWStr
(
mainGame
->
ebServerPass
->
getText
(),
cscg
.
pass
,
20
);
BufferIO
::
CopyWStr
(
mainGame
->
ebServerName
->
getText
(),
cscg
.
name
,
20
);
cscg
.
info
.
rule
=
mainGame
->
cbRule
->
getSelected
();
BufferIO
::
CopyWStr
(
mainGame
->
ebServerPass
->
getText
(),
cscg
.
pass
,
20
);
cscg
.
info
.
mode
=
mainGame
->
cbMatchMode
->
getSelected
();
cscg
.
info
.
rule
=
mainGame
->
cbRule
->
getSelected
();
cscg
.
info
.
start_hand
=
_wtoi
(
mainGame
->
ebStartHand
->
getText
());
cscg
.
info
.
mode
=
mainGame
->
cbMatchMode
->
getSelected
();
cscg
.
info
.
start_lp
=
_wtoi
(
mainGame
->
ebStartLP
->
getText
());
cscg
.
info
.
start_hand
=
_wtoi
(
mainGame
->
ebStartHand
->
getText
());
cscg
.
info
.
draw_count
=
_wtoi
(
mainGame
->
ebDrawCount
->
getText
());
cscg
.
info
.
start_lp
=
_wtoi
(
mainGame
->
ebStartLP
->
getText
());
cscg
.
info
.
lflist
=
mainGame
->
cbLFlist
->
getItemData
(
mainGame
->
cbLFlist
->
getSelected
());
cscg
.
info
.
draw_count
=
_wtoi
(
mainGame
->
ebDrawCount
->
getText
());
cscg
.
info
.
no_check_deck
=
mainGame
->
chkNoCheckDeck
->
isChecked
();
cscg
.
info
.
lflist
=
mainGame
->
cbLFlist
->
getItemData
(
mainGame
->
cbLFlist
->
getSelected
());
cscg
.
info
.
no_shuffle_deck
=
mainGame
->
chkNoShuffleDeck
->
isChecked
();
cscg
.
info
.
no_check_deck
=
mainGame
->
chkNoCheckDeck
->
isChecked
();
SendPacketToServer
(
CTOS_CREATE_GAME
,
cscg
);
cscg
.
info
.
no_shuffle_deck
=
mainGame
->
chkNoShuffleDeck
->
isChecked
();
SendPacketToServer
(
CTOS_CREATE_GAME
,
cscg
);
}
else
{
CTOS_JoinGame
csjg
;
csjg
.
gameid
=
0
;
BufferIO
::
CopyWStr
(
mainGame
->
ebJoinPass
->
getText
(),
csjg
.
pass
,
20
);
SendPacketToServer
(
CTOS_JOIN_GAME
,
csjg
);
}
bufferevent_enable
(
bev
,
EV_READ
);
bufferevent_enable
(
bev
,
EV_READ
);
connect_state
=
2
;
connect_state
=
2
;
}
else
if
(
events
&
BEV_EVENT_ERROR
)
{
}
else
if
(
events
&
BEV_EVENT_ERROR
)
{
...
...
gframe/duelclient.h
View file @
afe6dbca
...
@@ -25,10 +25,10 @@ private:
...
@@ -25,10 +25,10 @@ private:
static
char
duel_client_write
[
0x2000
];
static
char
duel_client_write
[
0x2000
];
static
bool
is_closing
;
static
bool
is_closing
;
public:
public:
static
bool
StartClient
(
unsigned
int
ip
,
unsigned
short
port
);
static
bool
StartClient
(
unsigned
int
ip
,
unsigned
short
port
,
bool
create_game
=
true
);
static
void
StopClient
(
bool
is_exiting
=
false
);
static
void
StopClient
(
bool
is_exiting
=
false
);
static
void
ClientRead
(
bufferevent
*
bev
,
void
*
ctx
);
static
void
ClientRead
(
bufferevent
*
bev
,
void
*
ctx
);
static
void
ClientEvent
(
bufferevent
*
bev
,
short
events
,
void
*
ptr
);
static
void
ClientEvent
(
bufferevent
*
bev
,
short
events
,
void
*
ctx
);
static
int
ClientThread
(
void
*
param
);
static
int
ClientThread
(
void
*
param
);
static
void
HandleSTOCPacketLan
(
char
*
data
,
unsigned
int
len
);
static
void
HandleSTOCPacketLan
(
char
*
data
,
unsigned
int
len
);
static
void
SetResponseI
(
int
respI
);
static
void
SetResponseI
(
int
respI
);
...
...
gframe/menu_handler.cpp
View file @
afe6dbca
...
@@ -190,6 +190,7 @@ bool MenuHandler::OnEvent(const irr::SEvent& event) {
...
@@ -190,6 +190,7 @@ bool MenuHandler::OnEvent(const irr::SEvent& event) {
case
CHECKBOX_HS_READY
:
{
case
CHECKBOX_HS_READY
:
{
if
(
!
caller
->
isEnabled
())
if
(
!
caller
->
isEnabled
())
break
;
break
;
mainGame
->
env
->
setFocus
(
mainGame
->
wHostSingle
);
DuelClient
::
SendPacketToServer
(
CTOS_HS_READY
);
DuelClient
::
SendPacketToServer
(
CTOS_HS_READY
);
break
;
break
;
}
}
...
...
system.conf
View file @
afe6dbca
#config file
#config file
#nickname & gamename should be less than 20 characters
#nickname & gamename should be less than 20 characters
antialias
=
2
antialias
=
2
nickname
=
Player
1
锈蚀水雾
nickname
=
Player
gamename
=
Game
gamename
=
Game
lastdeck
=
infernity
lastdeck
=
infernity
textfont
=
c
:/
windows
/
fonts
/
simsun
.
ttc
textfont
=
c
:/
windows
/
fonts
/
simsun
.
ttc
...
...
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