Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
R
rd-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
苍蓝
rd-ygopro
Commits
de3b0808
Commit
de3b0808
authored
Jun 03, 2024
by
nanahira
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'server' into server-develop
parents
ef4bdb4f
f07adc7a
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
97 additions
and
90 deletions
+97
-90
cards.cdb
cards.cdb
+0
-0
gframe/bufferio.h
gframe/bufferio.h
+44
-35
gframe/deck_manager.cpp
gframe/deck_manager.cpp
+1
-1
gframe/game.cpp
gframe/game.cpp
+2
-2
gframe/network.h
gframe/network.h
+45
-47
ocgcore
ocgcore
+1
-1
premake/gframe/ygopro.rc
premake/gframe/ygopro.rc
+2
-2
script
script
+1
-1
system.conf
system.conf
+1
-1
No files found.
cards.cdb
View file @
de3b0808
No preview for this file type
gframe/bufferio.h
View file @
de3b0808
...
...
@@ -37,8 +37,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
];
...
...
@@ -48,7 +49,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
];
...
...
@@ -59,8 +60,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
;
...
...
@@ -73,36 +74,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
++
;
...
...
@@ -111,8 +112,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
)
{
...
...
@@ -126,7 +127,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
;
...
...
@@ -154,6 +155,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 @
de3b0808
...
...
@@ -38,7 +38,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 @
de3b0808
...
...
@@ -27,7 +27,7 @@ namespace irr {
#include <regex>
#endif //YGOPRO_SERVER_MODE
unsigned
short
PRO_VERSION
=
0x136
0
;
unsigned short PRO_VERSION = 0x136
1
;
namespace ygo {
...
...
@@ -275,7 +275,7 @@ bool Game::Initialize() {
SetWindowsIcon();
//main menu
wchar_t strbuf[256];
myswprintf
(
strbuf
,
L"KoishiPro %X.0%X.%X
Natsukoi
"
,
PRO_VERSION
>>
12
,
(
PRO_VERSION
>>
4
)
&
0xff
,
PRO_VERSION
&
0xf
);
myswprintf(strbuf, L"KoishiPro %X.0%X.%X
GIGALODOON
", PRO_VERSION >> 12, (PRO_VERSION >> 4) & 0xff, PRO_VERSION & 0xf);
wMainMenu = env->addWindow(rect<s32>(370, 200, 650, 415), false, strbuf);
wMainMenu->getCloseButton()->setVisible(false);
btnLanMode = env->addButton(rect<s32>(10, 30, 270, 60), wMainMenu, BUTTON_LAN_MODE, dataManager.GetSysString(1200));
...
...
gframe/network.h
View file @
de3b0808
...
...
@@ -10,7 +10,7 @@
#include <event2/thread.h>
#include <type_traits>
#define check_trivially_copyable(T) static_assert(std::is_trivially_copyable<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
{
constexpr
int
SIZE_NETWORK_BUFFER
=
0x2000
;
...
...
@@ -113,6 +113,7 @@ struct STOC_HandResult {
check_trivially_copyable
(
STOC_HandResult
);
static_assert
(
sizeof
(
STOC_HandResult
)
==
2
,
"size mismatch: STOC_HandResult"
);
// reserved for STOC_CREATE_GAME
struct
STOC_CreateGame
{
uint32_t
gameid
;
};
...
...
@@ -131,6 +132,7 @@ struct STOC_TypeChange {
check_trivially_copyable
(
STOC_TypeChange
);
static_assert
(
sizeof
(
STOC_TypeChange
)
==
1
,
"size mismatch: STOC_TypeChange"
);
// reserved for STOC_LEAVE_GAME
struct
STOC_ExitGame
{
unsigned
char
pos
;
};
...
...
@@ -256,52 +258,48 @@ public:
#define NETPLAYER_TYPE_PLAYER6 5
#define NETPLAYER_TYPE_OBSERVER 7
#define CTOS_RESPONSE 0x1
#define CTOS_UPDATE_DECK 0x2
#define CTOS_HAND_RESULT 0x3
#define CTOS_TP_RESULT 0x4
#define CTOS_PLAYER_INFO 0x10
#define CTOS_CREATE_GAME 0x11
#define CTOS_JOIN_GAME 0x12
#define CTOS_LEAVE_GAME 0x13
#define CTOS_SURRENDER 0x14
#define CTOS_TIME_CONFIRM 0x15
#define CTOS_CHAT 0x16
#define CTOS_HS_TODUELIST 0x20
#define CTOS_HS_TOOBSERVER 0x21
#define CTOS_HS_READY 0x22
#define CTOS_HS_NOTREADY 0x23
#define CTOS_HS_KICK 0x24
#define CTOS_HS_START 0x25
#ifdef YGOPRO_SERVER_MODE
#define CTOS_REQUEST_FIELD 0x30
#endif
#define STOC_GAME_MSG 0x1
#define STOC_ERROR_MSG 0x2
#define STOC_SELECT_HAND 0x3
#define STOC_SELECT_TP 0x4
#define STOC_HAND_RESULT 0x5
#define STOC_TP_RESULT 0x6
#define STOC_CHANGE_SIDE 0x7
#define STOC_WAITING_SIDE 0x8
#define STOC_DECK_COUNT 0x9
#define STOC_CREATE_GAME 0x11
#define STOC_JOIN_GAME 0x12
#define STOC_TYPE_CHANGE 0x13
#define STOC_LEAVE_GAME 0x14
#define STOC_DUEL_START 0x15
#define STOC_DUEL_END 0x16
#define STOC_REPLAY 0x17
#define STOC_TIME_LIMIT 0x18
#define STOC_CHAT 0x19
#define STOC_HS_PLAYER_ENTER 0x20
#define STOC_HS_PLAYER_CHANGE 0x21
#define STOC_HS_WATCH_CHANGE 0x22
#define STOC_TEAMMATE_SURRENDER 0x23
#ifdef YGOPRO_SERVER_MODE
#define STOC_FIELD_FINISH 0x30
#endif
#define CTOS_RESPONSE 0x1 // byte array
#define CTOS_UPDATE_DECK 0x2 // int32_t array
#define CTOS_HAND_RESULT 0x3 // CTOS_HandResult
#define CTOS_TP_RESULT 0x4 // CTOS_TPResult
#define CTOS_PLAYER_INFO 0x10 // CTOS_PlayerInfo
#define CTOS_CREATE_GAME 0x11 // CTOS_CreateGame
#define CTOS_JOIN_GAME 0x12 // CTOS_JoinGame
#define CTOS_LEAVE_GAME 0x13 // no data
#define CTOS_SURRENDER 0x14 // no data
#define CTOS_TIME_CONFIRM 0x15 // no data
#define CTOS_CHAT 0x16 // uint16_t array
#define CTOS_HS_TODUELIST 0x20 // no data
#define CTOS_HS_TOOBSERVER 0x21 // no data
#define CTOS_HS_READY 0x22 // no data
#define CTOS_HS_NOTREADY 0x23 // no data
#define CTOS_HS_KICK 0x24 // CTOS_Kick
#define CTOS_HS_START 0x25 // no data
#define CTOS_REQUEST_FIELD 0x30
#define STOC_GAME_MSG 0x1 // byte array
#define STOC_ERROR_MSG 0x2 // STOC_ErrorMsg
#define STOC_SELECT_HAND 0x3 // no data
#define STOC_SELECT_TP 0x4 // no data
#define STOC_HAND_RESULT 0x5 // STOC_HandResult
#define STOC_TP_RESULT 0x6 // reserved
#define STOC_CHANGE_SIDE 0x7 // no data
#define STOC_WAITING_SIDE 0x8 // no data
#define STOC_DECK_COUNT 0x9 // int16_t[6]
#define STOC_CREATE_GAME 0x11 // reserved
#define STOC_JOIN_GAME 0x12 // STOC_JoinGame
#define STOC_TYPE_CHANGE 0x13 // STOC_TypeChange
#define STOC_LEAVE_GAME 0x14 // reserved
#define STOC_DUEL_START 0x15 // no data
#define STOC_DUEL_END 0x16 // no data
#define STOC_REPLAY 0x17 // ReplayHeader + byte array
#define STOC_TIME_LIMIT 0x18 // STOC_TimeLimit
#define STOC_CHAT 0x19 // uint16_t + uint16_t array
#define STOC_HS_PLAYER_ENTER 0x20 // STOC_HS_PlayerEnter
#define STOC_HS_PLAYER_CHANGE 0x21 // STOC_HS_PlayerChange
#define STOC_HS_WATCH_CHANGE 0x22 // STOC_HS_WatchChange
#define STOC_TEAMMATE_SURRENDER 0x23 // no data
#define STOC_FIELD_FINISH 0x30
#define STOC_SRVPRO_ROOMLIST 0x31
#define PLAYERCHANGE_OBSERVE 0x8
...
...
ocgcore
@
d4430f0a
Subproject commit
f3813158d7afeb8508eb80082c0c997d4cb7be68
Subproject commit
d4430f0ae3f415b322bd58de7b3c3fdec849feb3
premake/gframe/ygopro.rc
View file @
de3b0808
1 ICON "ygopro.ico"
1 VERSIONINFO
FILEVERSION 1, 0, 36,
0
PRODUCTVERSION 1, 0, 36,
0
FILEVERSION 1, 0, 36,
1
PRODUCTVERSION 1, 0, 36,
1
FILEOS 0x4
FILETYPE 0x1
...
...
script
@
6aff241a
Subproject commit
bd4b306d4594b5884a1f4b4f653526484c0ae4c4
Subproject commit
6aff241a80b38289696a1fc52b7fcc754f6eb4b5
system.conf
View file @
de3b0808
...
...
@@ -2,7 +2,7 @@
#nickname & gamename should be less than 20 characters
use_d3d
=
0
use_image_scale
=
1
pro_version
=
496
0
pro_version
=
496
1
antialias
=
2
errorlog
=
3
nickname
=
Komeiji
Koishi
...
...
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