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
baichixing
ygopro
Commits
bf2a2d57
Commit
bf2a2d57
authored
Jun 03, 2024
by
nanahira
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' into server
parents
5a36da46
82f1bd12
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 @
bf2a2d57
No preview for this file type
gframe/bufferio.h
View file @
bf2a2d57
...
@@ -37,8 +37,9 @@ public:
...
@@ -37,8 +37,9 @@ public:
inline
static
void
WriteInt8
(
unsigned
char
*&
p
,
char
val
)
{
inline
static
void
WriteInt8
(
unsigned
char
*&
p
,
char
val
)
{
buffer_write
<
char
>
(
p
,
val
);
buffer_write
<
char
>
(
p
,
val
);
}
}
// return: string length
template
<
typename
T1
,
typename
T2
>
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
;
int
l
=
0
;
while
(
src
[
l
]
&&
l
<
bufsize
-
1
)
{
while
(
src
[
l
]
&&
l
<
bufsize
-
1
)
{
pstr
[
l
]
=
(
T2
)
src
[
l
];
pstr
[
l
]
=
(
T2
)
src
[
l
];
...
@@ -48,7 +49,7 @@ public:
...
@@ -48,7 +49,7 @@ public:
return
l
;
return
l
;
}
}
template
<
typename
T1
,
typename
T2
>
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
;
int
l
=
0
;
while
(
src
[
l
]
&&
l
<
bufsize
-
1
)
{
while
(
src
[
l
]
&&
l
<
bufsize
-
1
)
{
pstr
[
l
]
=
(
T2
)
src
[
l
];
pstr
[
l
]
=
(
T2
)
src
[
l
];
...
@@ -59,8 +60,8 @@ public:
...
@@ -59,8 +60,8 @@ public:
return
l
;
return
l
;
}
}
// UTF-16/UTF-32 to UTF-8
// UTF-16/UTF-32 to UTF-8
template
<
size_t
N
>
// return: string length
static
int
EncodeUTF8
(
const
wchar_t
*
wsrc
,
char
(
&
str
)[
N
]
)
{
static
int
EncodeUTF8
String
(
const
wchar_t
*
wsrc
,
char
*
str
,
int
size
)
{
char
*
pstr
=
str
;
char
*
pstr
=
str
;
while
(
*
wsrc
!=
0
)
{
while
(
*
wsrc
!=
0
)
{
unsigned
cur
=
*
wsrc
;
unsigned
cur
=
*
wsrc
;
...
@@ -73,36 +74,36 @@ public:
...
@@ -73,36 +74,36 @@ public:
codepoint_size
=
3
;
codepoint_size
=
3
;
else
else
codepoint_size
=
4
;
codepoint_size
=
4
;
if
(
pstr
-
str
+
codepoint_size
>
N
-
1
)
if
(
pstr
-
str
+
codepoint_size
>
size
-
1
)
break
;
break
;
switch
(
codepoint_size
)
{
switch
(
codepoint_size
)
{
case
1
:
case
1
:
*
pstr
=
(
char
)
cur
;
*
pstr
=
(
char
)
cur
;
break
;
break
;
case
2
:
case
2
:
pstr
[
0
]
=
((
cur
>>
6
)
&
0x1f
)
|
0xc0
;
pstr
[
0
]
=
((
cur
>>
6
)
&
0x1f
)
|
0xc0
;
pstr
[
1
]
=
(
cur
&
0x3f
)
|
0x80
;
pstr
[
1
]
=
(
cur
&
0x3f
)
|
0x80
;
break
;
break
;
case
3
:
case
3
:
pstr
[
0
]
=
((
cur
>>
12
)
&
0xf
)
|
0xe0
;
pstr
[
0
]
=
((
cur
>>
12
)
&
0xf
)
|
0xe0
;
pstr
[
1
]
=
((
cur
>>
6
)
&
0x3f
)
|
0x80
;
pstr
[
1
]
=
((
cur
>>
6
)
&
0x3f
)
|
0x80
;
pstr
[
2
]
=
(
cur
&
0x3f
)
|
0x80
;
pstr
[
2
]
=
(
cur
&
0x3f
)
|
0x80
;
break
;
break
;
case
4
:
case
4
:
if
(
sizeof
(
wchar_t
)
==
2
)
{
if
(
sizeof
(
wchar_t
)
==
2
)
{
cur
=
0
;
cur
=
0
;
cur
|=
((
unsigned
)
*
wsrc
&
0x3ff
)
<<
10
;
cur
|=
((
unsigned
)
*
wsrc
&
0x3ff
)
<<
10
;
++
wsrc
;
++
wsrc
;
cur
|=
(
unsigned
)
*
wsrc
&
0x3ff
;
cur
|=
(
unsigned
)
*
wsrc
&
0x3ff
;
cur
+=
0x10000
;
cur
+=
0x10000
;
}
}
pstr
[
0
]
=
((
cur
>>
18
)
&
0x7
)
|
0xf0
;
pstr
[
0
]
=
((
cur
>>
18
)
&
0x7
)
|
0xf0
;
pstr
[
1
]
=
((
cur
>>
12
)
&
0x3f
)
|
0x80
;
pstr
[
1
]
=
((
cur
>>
12
)
&
0x3f
)
|
0x80
;
pstr
[
2
]
=
((
cur
>>
6
)
&
0x3f
)
|
0x80
;
pstr
[
2
]
=
((
cur
>>
6
)
&
0x3f
)
|
0x80
;
pstr
[
3
]
=
(
cur
&
0x3f
)
|
0x80
;
pstr
[
3
]
=
(
cur
&
0x3f
)
|
0x80
;
break
;
break
;
default:
default:
break
;
break
;
}
}
pstr
+=
codepoint_size
;
pstr
+=
codepoint_size
;
wsrc
++
;
wsrc
++
;
...
@@ -111,8 +112,8 @@ public:
...
@@ -111,8 +112,8 @@ public:
return
pstr
-
str
;
return
pstr
-
str
;
}
}
// UTF-8 to UTF-16/UTF-32
// UTF-8 to UTF-16/UTF-32
template
<
size_t
N
>
// return: string length
static
int
DecodeUTF8
(
const
char
*
src
,
wchar_t
(
&
wstr
)[
N
]
)
{
static
int
DecodeUTF8
String
(
const
char
*
src
,
wchar_t
*
wstr
,
int
size
)
{
const
char
*
p
=
src
;
const
char
*
p
=
src
;
wchar_t
*
wp
=
wstr
;
wchar_t
*
wp
=
wstr
;
while
(
*
p
!=
0
)
{
while
(
*
p
!=
0
)
{
...
@@ -126,7 +127,7 @@ public:
...
@@ -126,7 +127,7 @@ public:
}
}
else
else
codepoint_size
=
1
;
codepoint_size
=
1
;
if
(
wp
-
wstr
+
codepoint_size
>
N
-
1
)
if
(
wp
-
wstr
+
codepoint_size
>
size
-
1
)
break
;
break
;
if
((
cur
&
0x80
)
==
0
)
{
if
((
cur
&
0x80
)
==
0
)
{
*
wp
=
*
p
;
*
wp
=
*
p
;
...
@@ -154,6 +155,14 @@ public:
...
@@ -154,6 +155,14 @@ public:
*
wp
=
0
;
*
wp
=
0
;
return
wp
-
wstr
;
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
)
{
static
int
GetVal
(
const
wchar_t
*
pstr
)
{
unsigned
int
ret
=
0
;
unsigned
int
ret
=
0
;
while
(
*
pstr
>=
L'0'
&&
*
pstr
<=
L'9'
)
{
while
(
*
pstr
>=
L'0'
&&
*
pstr
<=
L'9'
)
{
...
...
gframe/deck_manager.cpp
View file @
bf2a2d57
...
@@ -38,7 +38,7 @@ void DeckManager::LoadLFListSingle(const char* path) {
...
@@ -38,7 +38,7 @@ void DeckManager::LoadLFListSingle(const char* path) {
int
count
=
-
1
;
int
count
=
-
1
;
if
(
sscanf
(
linebuf
,
"%d %d"
,
&
code
,
&
count
)
!=
2
)
if
(
sscanf
(
linebuf
,
"%d %d"
,
&
code
,
&
count
)
!=
2
)
continue
;
continue
;
if
(
code
<=
0
||
code
>
99999999
)
if
(
code
<=
0
||
code
>
0xfffffff
)
continue
;
continue
;
if
(
count
<
0
||
count
>
2
)
if
(
count
<
0
||
count
>
2
)
continue
;
continue
;
...
...
gframe/game.cpp
View file @
bf2a2d57
...
@@ -27,7 +27,7 @@ namespace irr {
...
@@ -27,7 +27,7 @@ namespace irr {
#include <regex>
#include <regex>
#endif //YGOPRO_SERVER_MODE
#endif //YGOPRO_SERVER_MODE
unsigned
short
PRO_VERSION
=
0x136
0
;
unsigned
short
PRO_VERSION
=
0x136
1
;
namespace
ygo
{
namespace
ygo
{
...
@@ -275,7 +275,7 @@ bool Game::Initialize() {
...
@@ -275,7 +275,7 @@ bool Game::Initialize() {
SetWindowsIcon
();
SetWindowsIcon
();
//main menu
//main menu
wchar_t
strbuf
[
256
];
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
=
env
->
addWindow
(
rect
<
s32
>
(
370
,
200
,
650
,
415
),
false
,
strbuf
);
wMainMenu
->
getCloseButton
()
->
setVisible
(
false
);
wMainMenu
->
getCloseButton
()
->
setVisible
(
false
);
btnLanMode
=
env
->
addButton
(
rect
<
s32
>
(
10
,
30
,
270
,
60
),
wMainMenu
,
BUTTON_LAN_MODE
,
dataManager
.
GetSysString
(
1200
));
btnLanMode
=
env
->
addButton
(
rect
<
s32
>
(
10
,
30
,
270
,
60
),
wMainMenu
,
BUTTON_LAN_MODE
,
dataManager
.
GetSysString
(
1200
));
...
...
gframe/network.h
View file @
bf2a2d57
...
@@ -10,7 +10,7 @@
...
@@ -10,7 +10,7 @@
#include <event2/thread.h>
#include <event2/thread.h>
#include <type_traits>
#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
{
namespace
ygo
{
constexpr
int
SIZE_NETWORK_BUFFER
=
0x2000
;
constexpr
int
SIZE_NETWORK_BUFFER
=
0x2000
;
...
@@ -113,6 +113,7 @@ struct STOC_HandResult {
...
@@ -113,6 +113,7 @@ struct STOC_HandResult {
check_trivially_copyable
(
STOC_HandResult
);
check_trivially_copyable
(
STOC_HandResult
);
static_assert
(
sizeof
(
STOC_HandResult
)
==
2
,
"size mismatch: STOC_HandResult"
);
static_assert
(
sizeof
(
STOC_HandResult
)
==
2
,
"size mismatch: STOC_HandResult"
);
// reserved for STOC_CREATE_GAME
struct
STOC_CreateGame
{
struct
STOC_CreateGame
{
uint32_t
gameid
;
uint32_t
gameid
;
};
};
...
@@ -131,6 +132,7 @@ struct STOC_TypeChange {
...
@@ -131,6 +132,7 @@ struct STOC_TypeChange {
check_trivially_copyable
(
STOC_TypeChange
);
check_trivially_copyable
(
STOC_TypeChange
);
static_assert
(
sizeof
(
STOC_TypeChange
)
==
1
,
"size mismatch: STOC_TypeChange"
);
static_assert
(
sizeof
(
STOC_TypeChange
)
==
1
,
"size mismatch: STOC_TypeChange"
);
// reserved for STOC_LEAVE_GAME
struct
STOC_ExitGame
{
struct
STOC_ExitGame
{
unsigned
char
pos
;
unsigned
char
pos
;
};
};
...
@@ -256,52 +258,48 @@ public:
...
@@ -256,52 +258,48 @@ public:
#define NETPLAYER_TYPE_PLAYER6 5
#define NETPLAYER_TYPE_PLAYER6 5
#define NETPLAYER_TYPE_OBSERVER 7
#define NETPLAYER_TYPE_OBSERVER 7
#define CTOS_RESPONSE 0x1
#define CTOS_RESPONSE 0x1 // byte array
#define CTOS_UPDATE_DECK 0x2
#define CTOS_UPDATE_DECK 0x2 // int32_t array
#define CTOS_HAND_RESULT 0x3
#define CTOS_HAND_RESULT 0x3 // CTOS_HandResult
#define CTOS_TP_RESULT 0x4
#define CTOS_TP_RESULT 0x4 // CTOS_TPResult
#define CTOS_PLAYER_INFO 0x10
#define CTOS_PLAYER_INFO 0x10 // CTOS_PlayerInfo
#define CTOS_CREATE_GAME 0x11
#define CTOS_CREATE_GAME 0x11 // CTOS_CreateGame
#define CTOS_JOIN_GAME 0x12
#define CTOS_JOIN_GAME 0x12 // CTOS_JoinGame
#define CTOS_LEAVE_GAME 0x13
#define CTOS_LEAVE_GAME 0x13 // no data
#define CTOS_SURRENDER 0x14
#define CTOS_SURRENDER 0x14 // no data
#define CTOS_TIME_CONFIRM 0x15
#define CTOS_TIME_CONFIRM 0x15 // no data
#define CTOS_CHAT 0x16
#define CTOS_CHAT 0x16 // uint16_t array
#define CTOS_HS_TODUELIST 0x20
#define CTOS_HS_TODUELIST 0x20 // no data
#define CTOS_HS_TOOBSERVER 0x21
#define CTOS_HS_TOOBSERVER 0x21 // no data
#define CTOS_HS_READY 0x22
#define CTOS_HS_READY 0x22 // no data
#define CTOS_HS_NOTREADY 0x23
#define CTOS_HS_NOTREADY 0x23 // no data
#define CTOS_HS_KICK 0x24
#define CTOS_HS_KICK 0x24 // CTOS_Kick
#define CTOS_HS_START 0x25
#define CTOS_HS_START 0x25 // no data
#ifdef YGOPRO_SERVER_MODE
#define CTOS_REQUEST_FIELD 0x30
#define CTOS_REQUEST_FIELD 0x30
#endif
#define STOC_GAME_MSG 0x1 // byte array
#define STOC_ERROR_MSG 0x2 // STOC_ErrorMsg
#define STOC_GAME_MSG 0x1
#define STOC_SELECT_HAND 0x3 // no data
#define STOC_ERROR_MSG 0x2
#define STOC_SELECT_TP 0x4 // no data
#define STOC_SELECT_HAND 0x3
#define STOC_HAND_RESULT 0x5 // STOC_HandResult
#define STOC_SELECT_TP 0x4
#define STOC_TP_RESULT 0x6 // reserved
#define STOC_HAND_RESULT 0x5
#define STOC_CHANGE_SIDE 0x7 // no data
#define STOC_TP_RESULT 0x6
#define STOC_WAITING_SIDE 0x8 // no data
#define STOC_CHANGE_SIDE 0x7
#define STOC_DECK_COUNT 0x9 // int16_t[6]
#define STOC_WAITING_SIDE 0x8
#define STOC_CREATE_GAME 0x11 // reserved
#define STOC_DECK_COUNT 0x9
#define STOC_JOIN_GAME 0x12 // STOC_JoinGame
#define STOC_CREATE_GAME 0x11
#define STOC_TYPE_CHANGE 0x13 // STOC_TypeChange
#define STOC_JOIN_GAME 0x12
#define STOC_LEAVE_GAME 0x14 // reserved
#define STOC_TYPE_CHANGE 0x13
#define STOC_DUEL_START 0x15 // no data
#define STOC_LEAVE_GAME 0x14
#define STOC_DUEL_END 0x16 // no data
#define STOC_DUEL_START 0x15
#define STOC_REPLAY 0x17 // ReplayHeader + byte array
#define STOC_DUEL_END 0x16
#define STOC_TIME_LIMIT 0x18 // STOC_TimeLimit
#define STOC_REPLAY 0x17
#define STOC_CHAT 0x19 // uint16_t + uint16_t array
#define STOC_TIME_LIMIT 0x18
#define STOC_HS_PLAYER_ENTER 0x20 // STOC_HS_PlayerEnter
#define STOC_CHAT 0x19
#define STOC_HS_PLAYER_CHANGE 0x21 // STOC_HS_PlayerChange
#define STOC_HS_PLAYER_ENTER 0x20
#define STOC_HS_WATCH_CHANGE 0x22 // STOC_HS_WatchChange
#define STOC_HS_PLAYER_CHANGE 0x21
#define STOC_TEAMMATE_SURRENDER 0x23 // no data
#define STOC_HS_WATCH_CHANGE 0x22
#define STOC_FIELD_FINISH 0x30
#define STOC_TEAMMATE_SURRENDER 0x23
#ifdef YGOPRO_SERVER_MODE
#define STOC_FIELD_FINISH 0x30
#endif
#define STOC_SRVPRO_ROOMLIST 0x31
#define STOC_SRVPRO_ROOMLIST 0x31
#define PLAYERCHANGE_OBSERVE 0x8
#define PLAYERCHANGE_OBSERVE 0x8
...
...
ocgcore
@
c4b71bb2
Subproject commit
f3813158d7afeb8508eb80082c0c997d4cb7be68
Subproject commit
c4b71bb212232a75ae13a61ce8d0fc67191d0116
premake/gframe/ygopro.rc
View file @
bf2a2d57
1 ICON "ygopro.ico"
1 ICON "ygopro.ico"
1 VERSIONINFO
1 VERSIONINFO
FILEVERSION 1, 0, 36,
0
FILEVERSION 1, 0, 36,
1
PRODUCTVERSION 1, 0, 36,
0
PRODUCTVERSION 1, 0, 36,
1
FILEOS 0x4
FILEOS 0x4
FILETYPE 0x1
FILETYPE 0x1
...
...
script
@
6aff241a
Subproject commit
bd4b306d4594b5884a1f4b4f653526484c0ae4c4
Subproject commit
6aff241a80b38289696a1fc52b7fcc754f6eb4b5
system.conf
View file @
bf2a2d57
...
@@ -2,7 +2,7 @@
...
@@ -2,7 +2,7 @@
#nickname & gamename should be less than 20 characters
#nickname & gamename should be less than 20 characters
use_d3d
=
0
use_d3d
=
0
use_image_scale
=
1
use_image_scale
=
1
pro_version
=
496
0
pro_version
=
496
1
antialias
=
2
antialias
=
2
errorlog
=
3
errorlog
=
3
nickname
=
Komeiji
Koishi
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