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
nanahira
ygopro
Commits
4f7e8d97
Commit
4f7e8d97
authored
Jun 03, 2024
by
nanahira
Browse files
Options
Browse Files
Download
Plain Diff
Merge commit '
a8a1bac7
' of...
Merge commit '
a8a1bac7
' of github.com:Fluorohydride/ygopro into server
parents
13e1fbf9
a8a1bac7
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
62 additions
and
39 deletions
+62
-39
gframe/bufferio.h
gframe/bufferio.h
+44
-35
gframe/deck_manager.cpp
gframe/deck_manager.cpp
+1
-1
gframe/game.cpp
gframe/game.cpp
+1
-1
gframe/netserver.cpp
gframe/netserver.cpp
+14
-0
ocgcore
ocgcore
+1
-1
script
script
+1
-1
No files found.
gframe/bufferio.h
View file @
4f7e8d97
...
...
@@ -27,8 +27,9 @@ public:
inline
static
void
WriteInt8
(
unsigned
char
*&
p
,
char
val
)
{
buffer_write
<
char
>
(
p
,
val
);
}
// return: string length
template
<
typename
T1
,
typename
T2
>
inline
static
int
CopyWStr
(
T1
*
src
,
T2
*
pstr
,
int
bufsize
)
{
inline
static
int
CopyWStr
(
const
T1
*
src
,
T2
*
pstr
,
int
bufsize
)
{
int
l
=
0
;
while
(
src
[
l
]
&&
l
<
bufsize
-
1
)
{
pstr
[
l
]
=
(
T2
)
src
[
l
];
...
...
@@ -38,7 +39,7 @@ public:
return
l
;
}
template
<
typename
T1
,
typename
T2
>
inline
static
int
CopyWStrRef
(
T1
*
src
,
T2
*&
pstr
,
int
bufsize
)
{
inline
static
int
CopyWStrRef
(
const
T1
*
src
,
T2
*&
pstr
,
int
bufsize
)
{
int
l
=
0
;
while
(
src
[
l
]
&&
l
<
bufsize
-
1
)
{
pstr
[
l
]
=
(
T2
)
src
[
l
];
...
...
@@ -49,8 +50,8 @@ public:
return
l
;
}
// UTF-16/UTF-32 to UTF-8
template
<
size_t
N
>
static
int
EncodeUTF8
(
const
wchar_t
*
wsrc
,
char
(
&
str
)[
N
]
)
{
// return: string length
static
int
EncodeUTF8
String
(
const
wchar_t
*
wsrc
,
char
*
str
,
int
size
)
{
char
*
pstr
=
str
;
while
(
*
wsrc
!=
0
)
{
unsigned
cur
=
*
wsrc
;
...
...
@@ -63,36 +64,36 @@ public:
codepoint_size
=
3
;
else
codepoint_size
=
4
;
if
(
pstr
-
str
+
codepoint_size
>
N
-
1
)
if
(
pstr
-
str
+
codepoint_size
>
size
-
1
)
break
;
switch
(
codepoint_size
)
{
case
1
:
*
pstr
=
(
char
)
cur
;
break
;
case
2
:
pstr
[
0
]
=
((
cur
>>
6
)
&
0x1f
)
|
0xc0
;
pstr
[
1
]
=
(
cur
&
0x3f
)
|
0x80
;
break
;
case
3
:
pstr
[
0
]
=
((
cur
>>
12
)
&
0xf
)
|
0xe0
;
pstr
[
1
]
=
((
cur
>>
6
)
&
0x3f
)
|
0x80
;
pstr
[
2
]
=
(
cur
&
0x3f
)
|
0x80
;
break
;
case
4
:
if
(
sizeof
(
wchar_t
)
==
2
)
{
cur
=
0
;
cur
|=
((
unsigned
)
*
wsrc
&
0x3ff
)
<<
10
;
++
wsrc
;
cur
|=
(
unsigned
)
*
wsrc
&
0x3ff
;
cur
+=
0x10000
;
}
pstr
[
0
]
=
((
cur
>>
18
)
&
0x7
)
|
0xf0
;
pstr
[
1
]
=
((
cur
>>
12
)
&
0x3f
)
|
0x80
;
pstr
[
2
]
=
((
cur
>>
6
)
&
0x3f
)
|
0x80
;
pstr
[
3
]
=
(
cur
&
0x3f
)
|
0x80
;
break
;
default:
break
;
case
1
:
*
pstr
=
(
char
)
cur
;
break
;
case
2
:
pstr
[
0
]
=
((
cur
>>
6
)
&
0x1f
)
|
0xc0
;
pstr
[
1
]
=
(
cur
&
0x3f
)
|
0x80
;
break
;
case
3
:
pstr
[
0
]
=
((
cur
>>
12
)
&
0xf
)
|
0xe0
;
pstr
[
1
]
=
((
cur
>>
6
)
&
0x3f
)
|
0x80
;
pstr
[
2
]
=
(
cur
&
0x3f
)
|
0x80
;
break
;
case
4
:
if
(
sizeof
(
wchar_t
)
==
2
)
{
cur
=
0
;
cur
|=
((
unsigned
)
*
wsrc
&
0x3ff
)
<<
10
;
++
wsrc
;
cur
|=
(
unsigned
)
*
wsrc
&
0x3ff
;
cur
+=
0x10000
;
}
pstr
[
0
]
=
((
cur
>>
18
)
&
0x7
)
|
0xf0
;
pstr
[
1
]
=
((
cur
>>
12
)
&
0x3f
)
|
0x80
;
pstr
[
2
]
=
((
cur
>>
6
)
&
0x3f
)
|
0x80
;
pstr
[
3
]
=
(
cur
&
0x3f
)
|
0x80
;
break
;
default:
break
;
}
pstr
+=
codepoint_size
;
wsrc
++
;
...
...
@@ -101,8 +102,8 @@ public:
return
pstr
-
str
;
}
// UTF-8 to UTF-16/UTF-32
template
<
size_t
N
>
static
int
DecodeUTF8
(
const
char
*
src
,
wchar_t
(
&
wstr
)[
N
]
)
{
// return: string length
static
int
DecodeUTF8
String
(
const
char
*
src
,
wchar_t
*
wstr
,
int
size
)
{
const
char
*
p
=
src
;
wchar_t
*
wp
=
wstr
;
while
(
*
p
!=
0
)
{
...
...
@@ -116,7 +117,7 @@ public:
}
else
codepoint_size
=
1
;
if
(
wp
-
wstr
+
codepoint_size
>
N
-
1
)
if
(
wp
-
wstr
+
codepoint_size
>
size
-
1
)
break
;
if
((
cur
&
0x80
)
==
0
)
{
*
wp
=
*
p
;
...
...
@@ -144,6 +145,14 @@ public:
*
wp
=
0
;
return
wp
-
wstr
;
}
template
<
size_t
N
>
static
int
EncodeUTF8
(
const
wchar_t
*
src
,
char
(
&
dst
)[
N
])
{
return
EncodeUTF8String
(
src
,
dst
,
N
);
}
template
<
size_t
N
>
static
int
DecodeUTF8
(
const
char
*
src
,
wchar_t
(
&
dst
)[
N
])
{
return
DecodeUTF8String
(
src
,
dst
,
N
);
}
static
int
GetVal
(
const
wchar_t
*
pstr
)
{
unsigned
int
ret
=
0
;
while
(
*
pstr
>=
L'0'
&&
*
pstr
<=
L'9'
)
{
...
...
gframe/deck_manager.cpp
View file @
4f7e8d97
...
...
@@ -37,7 +37,7 @@ void DeckManager::LoadLFListSingle(const char* path) {
int
count
=
-
1
;
if
(
sscanf
(
linebuf
,
"%d %d"
,
&
code
,
&
count
)
!=
2
)
continue
;
if
(
code
<=
0
||
code
>
99999999
)
if
(
code
<=
0
||
code
>
0xfffffff
)
continue
;
if
(
count
<
0
||
count
>
2
)
continue
;
...
...
gframe/game.cpp
View file @
4f7e8d97
...
...
@@ -25,7 +25,7 @@ namespace irr {
#include "single_mode.h"
#endif //YGOPRO_SERVER_MODE
const
unsigned
short
PRO_VERSION
=
0x136
0
;
const
unsigned
short
PRO_VERSION
=
0x136
1
;
namespace
ygo
{
...
...
gframe/netserver.cpp
View file @
4f7e8d97
...
...
@@ -459,5 +459,19 @@ size_t NetServer::CreateChatPacket(unsigned char* src, int src_size, unsigned ch
buffer_write_block
(
pdst
,
src_msg
,
src_size
);
return
sizeof
(
dst_player_type
)
+
src_size
;
}
size_t
NetServer
::
CreateChatPacket
(
unsigned
char
*
src
,
int
src_size
,
unsigned
char
*
dst
,
uint16_t
dst_player_type
)
{
if
(
!
check_msg_size
(
src_size
))
return
0
;
uint16_t
src_msg
[
LEN_CHAT_MSG
];
std
::
memcpy
(
src_msg
,
src
,
src_size
);
const
int
src_len
=
src_size
/
sizeof
(
uint16_t
);
if
(
src_msg
[
src_len
-
1
]
!=
0
)
return
0
;
// STOC_Chat packet
auto
pdst
=
dst
;
buffer_write
<
uint16_t
>
(
pdst
,
dst_player_type
);
buffer_write_block
(
pdst
,
src_msg
,
src_size
);
return
sizeof
(
dst_player_type
)
+
src_size
;
}
}
ocgcore
@
8b10e2f3
Subproject commit
74520eb0c3980f3eb3b49147d11c402af4b28ae7
Subproject commit
8b10e2f3d92dbb35abebfa77869e5ab518571e44
script
@
b998e8d8
Subproject commit
c5271c21b3bdd1789e29fc09e83af44c8ff537bb
Subproject commit
b998e8d81b5aea0a6cedd6b34447e42d8011b865
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