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
wind2009
ygopro
Commits
c9a35976
Commit
c9a35976
authored
May 07, 2024
by
wind2009
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'upstream/master' into server-develop
parents
34603515
50df3b4b
Changes
8
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
157 additions
and
110 deletions
+157
-110
gframe/config.h
gframe/config.h
+1
-1
gframe/data_manager.cpp
gframe/data_manager.cpp
+14
-8
gframe/deck_manager.cpp
gframe/deck_manager.cpp
+14
-15
gframe/duelclient.cpp
gframe/duelclient.cpp
+8
-18
gframe/duelclient.h
gframe/duelclient.h
+1
-1
gframe/game.cpp
gframe/game.cpp
+115
-65
gframe/game.h
gframe/game.h
+3
-1
gframe/gframe.cpp
gframe/gframe.cpp
+1
-1
No files found.
gframe/config.h
View file @
c9a35976
...
...
@@ -97,7 +97,7 @@ using namespace io;
#endif
extern
const
unsigned
short
PRO_VERSION
;
extern
int
enable_log
;
extern
unsigned
int
enable_log
;
extern
bool
exit_on_return
;
extern
bool
open_file
;
extern
wchar_t
open_file_name
[
256
];
...
...
gframe/data_manager.cpp
View file @
c9a35976
...
...
@@ -169,24 +169,30 @@ bool DataManager::LoadStrings(IReadFile* reader) {
void
DataManager
::
ReadStringConfLine
(
const
char
*
linebuf
)
{
if
(
linebuf
[
0
]
!=
'!'
)
return
;
char
strbuf
[
256
];
int
value
;
wchar_t
strBuffer
[
4096
];
sscanf
(
linebuf
,
"!%s"
,
strbuf
);
char
strbuf
[
256
]{};
int
value
{};
wchar_t
strBuffer
[
4096
]{};
if
(
sscanf
(
linebuf
,
"!%63s"
,
strbuf
)
!=
1
)
return
;
if
(
!
strcmp
(
strbuf
,
"system"
))
{
sscanf
(
&
linebuf
[
7
],
"%d %240[^
\n
]"
,
&
value
,
strbuf
);
if
(
sscanf
(
&
linebuf
[
7
],
"%d %240[^
\n
]"
,
&
value
,
strbuf
)
!=
2
)
return
;
BufferIO
::
DecodeUTF8
(
strbuf
,
strBuffer
);
_sysStrings
[
value
]
=
strBuffer
;
}
else
if
(
!
strcmp
(
strbuf
,
"victory"
))
{
sscanf
(
&
linebuf
[
8
],
"%x %240[^
\n
]"
,
&
value
,
strbuf
);
if
(
sscanf
(
&
linebuf
[
8
],
"%x %240[^
\n
]"
,
&
value
,
strbuf
)
!=
2
)
return
;
BufferIO
::
DecodeUTF8
(
strbuf
,
strBuffer
);
_victoryStrings
[
value
]
=
strBuffer
;
}
else
if
(
!
strcmp
(
strbuf
,
"counter"
))
{
sscanf
(
&
linebuf
[
8
],
"%x %240[^
\n
]"
,
&
value
,
strbuf
);
if
(
sscanf
(
&
linebuf
[
8
],
"%x %240[^
\n
]"
,
&
value
,
strbuf
)
!=
2
)
return
;
BufferIO
::
DecodeUTF8
(
strbuf
,
strBuffer
);
_counterStrings
[
value
]
=
strBuffer
;
}
else
if
(
!
strcmp
(
strbuf
,
"setname"
))
{
sscanf
(
&
linebuf
[
8
],
"%x %240[^
\t\n
]"
,
&
value
,
strbuf
);
//using tab for comment
//using tab for comment
if
(
sscanf
(
&
linebuf
[
8
],
"%x %240[^
\t\n
]"
,
&
value
,
strbuf
)
!=
2
)
return
;
BufferIO
::
DecodeUTF8
(
strbuf
,
strBuffer
);
_setnameStrings
[
value
]
=
strBuffer
;
}
...
...
gframe/deck_manager.cpp
View file @
c9a35976
...
...
@@ -13,15 +13,16 @@ DeckManager deckManager;
void
DeckManager
::
LoadLFListSingle
(
const
char
*
path
)
{
LFList
*
cur
=
nullptr
;
FILE
*
fp
=
fopen
(
path
,
"r"
);
char
linebuf
[
256
];
wchar_t
strBuffer
[
256
];
char
linebuf
[
256
]
{}
;
wchar_t
strBuffer
[
256
]
{}
;
if
(
fp
)
{
while
(
fgets
(
linebuf
,
256
,
fp
))
{
if
(
linebuf
[
0
]
==
'#'
)
continue
;
if
(
linebuf
[
0
]
==
'!'
)
{
int
sa
=
BufferIO
::
DecodeUTF8
(
&
linebuf
[
1
],
strBuffer
);
while
(
strBuffer
[
sa
-
1
]
==
L'\r'
||
strBuffer
[
sa
-
1
]
==
L'\n'
)
sa
--
;
while
(
strBuffer
[
sa
-
1
]
==
L'\r'
||
strBuffer
[
sa
-
1
]
==
L'\n'
)
sa
--
;
strBuffer
[
sa
]
=
0
;
LFList
newlist
;
_lfList
.
push_back
(
newlist
);
...
...
@@ -30,20 +31,18 @@ void DeckManager::LoadLFListSingle(const char* path) {
cur
->
hash
=
0x7dfcee6a
;
continue
;
}
int
p
=
0
;
while
(
linebuf
[
p
]
!=
' '
&&
linebuf
[
p
]
!=
'\t'
&&
linebuf
[
p
]
!=
0
)
p
++
;
if
(
linebuf
[
p
]
==
0
)
if
(
linebuf
[
0
]
==
0
)
continue
;
linebuf
[
p
++
]
=
0
;
int
sa
=
p
;
int
code
=
atoi
(
linebuf
);
if
(
code
==
0
)
int
code
=
0
;
int
count
=
-
1
;
if
(
sscanf
(
linebuf
,
"%d %d"
,
&
code
,
&
count
)
!=
2
)
continue
;
if
(
code
<=
0
||
code
>
99999999
)
continue
;
if
(
count
<
0
||
count
>
2
)
continue
;
if
(
!
cur
)
continue
;
while
(
linebuf
[
p
]
==
' '
||
linebuf
[
p
]
==
'\t'
)
p
++
;
while
(
linebuf
[
p
]
!=
' '
&&
linebuf
[
p
]
!=
'\t'
&&
linebuf
[
p
]
!=
0
)
p
++
;
linebuf
[
p
]
=
0
;
int
count
=
atoi
(
&
linebuf
[
sa
]);
if
(
!
cur
)
continue
;
cur
->
content
[
code
]
=
count
;
cur
->
hash
=
cur
->
hash
^
((
code
<<
18
)
|
(
code
>>
14
))
^
((
code
<<
(
27
+
count
))
|
(
code
>>
(
5
-
count
)));
}
...
...
gframe/duelclient.cpp
View file @
c9a35976
...
...
@@ -403,6 +403,7 @@ void DuelClient::HandleSTOCPacketLan(unsigned char* data, unsigned int len) {
break
;
}
case
STOC_WAITING_SIDE
:
{
mainGame
->
dInfo
.
isInDuel
=
false
;
mainGame
->
gMutex
.
lock
();
mainGame
->
dField
.
Clear
();
mainGame
->
stHintMsg
->
setText
(
dataManager
.
GetSysString
(
1409
));
...
...
@@ -744,28 +745,17 @@ void DuelClient::HandleSTOCPacketLan(unsigned char* data, unsigned int len) {
case
STOC_CHAT
:
{
STOC_Chat
*
pkt
=
(
STOC_Chat
*
)
pdata
;
int
player
=
pkt
->
player
;
auto
play_sound
=
false
;
if
(
player
<
4
)
{
if
(
mainGame
->
chkIgnore1
->
isChecked
())
break
;
if
(
!
mainGame
->
dInfo
.
isTag
)
{
if
(
mainGame
->
dInfo
.
isInDuel
)
player
=
mainGame
->
LocalPlayer
(
player
);
}
else
{
if
(
mainGame
->
dInfo
.
isInDuel
&&
!
mainGame
->
dInfo
.
isFirst
)
player
^=
2
;
if
(
player
==
0
)
player
=
0
;
else
if
(
player
==
1
)
player
=
2
;
else
if
(
player
==
2
)
player
=
1
;
else
if
(
player
==
3
)
player
=
3
;
else
player
=
10
;
}
auto
localplayer
=
mainGame
->
ChatLocalPlayer
(
player
);
player
=
localplayer
&
0xf
;
if
(
!
(
localplayer
&
0x10
))
play_sound
=
true
;
}
else
{
if
(
player
==
8
)
{
//system custom message.
play_sound
=
true
;
if
(
mainGame
->
chkIgnore1
->
isChecked
())
break
;
}
else
if
(
player
<
11
||
player
>
19
)
{
...
...
@@ -777,7 +767,7 @@ void DuelClient::HandleSTOCPacketLan(unsigned char* data, unsigned int len) {
wchar_t
msg
[
256
];
BufferIO
::
CopyWStr
(
pkt
->
msg
,
msg
,
256
);
mainGame
->
gMutex
.
lock
();
mainGame
->
AddChatMsg
(
msg
,
player
);
mainGame
->
AddChatMsg
(
msg
,
player
,
play_sound
);
mainGame
->
gMutex
.
unlock
();
break
;
}
...
...
gframe/duelclient.h
View file @
c9a35976
...
...
@@ -23,7 +23,6 @@ private:
static
unsigned
char
response_buf
[
SIZE_RETURN_VALUE
];
static
unsigned
int
response_len
;
static
unsigned
int
watching
;
static
unsigned
char
selftype
;
static
bool
is_host
;
static
event_base
*
client_base
;
static
bufferevent
*
client_bev
;
...
...
@@ -39,6 +38,7 @@ private:
static
wchar_t
event_string
[
256
];
static
mt19937
rnd
;
public:
static
unsigned
char
selftype
;
static
bool
StartClient
(
unsigned
int
ip
,
unsigned
short
port
,
bool
create_game
=
true
);
static
void
ConnectTimeout
(
evutil_socket_t
fd
,
short
events
,
void
*
arg
);
static
void
StopClient
(
bool
is_exiting
=
false
);
...
...
gframe/game.cpp
View file @
c9a35976
This diff is collapsed.
Click to expand it.
gframe/game.h
View file @
c9a35976
...
...
@@ -170,7 +170,7 @@ public:
void
ShowCardInfo
(
int
code
,
bool
resize
=
false
);
void
ClearCardInfo
(
int
player
=
0
);
void
AddLog
(
const
wchar_t
*
msg
,
int
param
=
0
);
void
AddChatMsg
(
const
wchar_t
*
msg
,
int
player
);
void
AddChatMsg
(
const
wchar_t
*
msg
,
int
player
,
bool
play_sound
=
false
);
void
ClearChatMsg
();
void
AddDebugMsg
(
const
char
*
msgbuf
);
void
ErrorLog
(
const
char
*
msgbuf
);
...
...
@@ -180,6 +180,8 @@ public:
void
CloseDuelWindow
();
int
LocalPlayer
(
int
player
)
const
;
int
OppositePlayer
(
int
player
);
int
ChatLocalPlayer
(
int
player
);
const
wchar_t
*
LocalName
(
int
local_player
);
bool
HasFocus
(
EGUI_ELEMENT_TYPE
type
)
const
{
...
...
gframe/gframe.cpp
View file @
c9a35976
...
...
@@ -7,7 +7,7 @@
#import <CoreFoundation/CoreFoundation.h>
#endif
int
enable_log
=
0
;
unsigned
int
enable_log
=
0x3
;
#ifndef YGOPRO_SERVER_MODE
bool
exit_on_return
=
false
;
bool
open_file
=
false
;
...
...
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