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
1
Merge Requests
1
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
14e70e62
Commit
14e70e62
authored
Mar 28, 2024
by
mercury233
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'server' of git.mycard.moe:mycard/ygopro into server
parents
91d38707
0dae13ea
Changes
17
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
17 changed files
with
282 additions
and
69 deletions
+282
-69
cards.cdb
cards.cdb
+0
-0
gframe/CGUITTFont.cpp
gframe/CGUITTFont.cpp
+6
-6
gframe/config.h
gframe/config.h
+0
-2
gframe/data_manager.h
gframe/data_manager.h
+7
-7
gframe/drawing.cpp
gframe/drawing.cpp
+3
-3
gframe/duelclient.cpp
gframe/duelclient.cpp
+4
-4
gframe/duelclient.h
gframe/duelclient.h
+16
-8
gframe/game.cpp
gframe/game.cpp
+6
-6
gframe/netserver.cpp
gframe/netserver.cpp
+5
-5
gframe/netserver.h
gframe/netserver.h
+21
-13
gframe/network.h
gframe/network.h
+2
-0
gframe/single_mode.cpp
gframe/single_mode.cpp
+1
-1
lflist.conf
lflist.conf
+206
-11
ocgcore
ocgcore
+1
-1
script
script
+1
-1
strings.conf
strings.conf
+2
-1
system.conf
system.conf
+1
-0
No files found.
cards.cdb
View file @
14e70e62
No preview for this file type
gframe/CGUITTFont.cpp
View file @
14e70e62
...
...
@@ -79,9 +79,9 @@ video::IImage* SGUITTGlyph::createGlyphImage(const FT_Bitmap& bits, video::IVide
const
u32
image_pitch
=
image
->
getPitch
()
/
sizeof
(
u16
);
u16
*
image_data
=
(
u16
*
)
image
->
lock
();
u8
*
glyph_data
=
bits
.
buffer
;
for
(
s32
y
=
0
;
y
<
bits
.
rows
;
++
y
)
{
for
(
s32
y
=
0
;
y
<
(
s32
)
bits
.
rows
;
++
y
)
{
u16
*
row
=
image_data
;
for
(
s32
x
=
0
;
x
<
bits
.
width
;
++
x
)
{
for
(
s32
x
=
0
;
x
<
(
s32
)
bits
.
width
;
++
x
)
{
// Monochrome bitmaps store 8 pixels per byte. The left-most pixel is the bit 0x80.
// So, we go through the data each bit at a time.
if
((
glyph_data
[
y
*
bits
.
pitch
+
(
x
/
8
)]
&
(
0x80
>>
(
x
%
8
)))
!=
0
)
...
...
@@ -105,9 +105,9 @@ video::IImage* SGUITTGlyph::createGlyphImage(const FT_Bitmap& bits, video::IVide
const
u32
image_pitch
=
image
->
getPitch
()
/
sizeof
(
u32
);
u32
*
image_data
=
(
u32
*
)
image
->
lock
();
u8
*
glyph_data
=
bits
.
buffer
;
for
(
s32
y
=
0
;
y
<
bits
.
rows
;
++
y
)
{
for
(
s32
y
=
0
;
y
<
(
s32
)
bits
.
rows
;
++
y
)
{
u8
*
row
=
glyph_data
;
for
(
s32
x
=
0
;
x
<
bits
.
width
;
++
x
)
{
for
(
s32
x
=
0
;
x
<
(
s32
)
bits
.
width
;
++
x
)
{
image_data
[
y
*
image_pitch
+
x
]
|=
static_cast
<
u32
>
(
255.0
f
*
(
static_cast
<
float
>
(
*
row
++
)
/
gray_count
))
<<
24
;
//data[y * image_pitch + x] |= ((u32)(*bitsdata++) << 24);
}
...
...
@@ -154,8 +154,8 @@ void SGUITTGlyph::preload(u32 char_index, FT_Face face, video::IVideoDriver* dri
glyph_page
=
parent
->
getLastGlyphPageIndex
();
u32
texture_side_length
=
page
->
texture_size
.
Width
-
font_size
;
u32
margin
=
font_size
*
0.5
;
u32
sprite_size
=
font_size
*
1.5
;
u32
margin
=
(
u32
)(
font_size
*
0.5
)
;
u32
sprite_size
=
(
u32
)(
font_size
*
1.5
)
;
core
::
vector2di
page_position
(
(
s32
)(
page
->
used_slots
%
(
s32
)(
texture_side_length
/
sprite_size
))
*
sprite_size
+
margin
,
(
s32
)(
page
->
used_slots
/
(
s32
)(
texture_side_length
/
sprite_size
))
*
sprite_size
+
margin
...
...
gframe/config.h
View file @
14e70e62
...
...
@@ -96,8 +96,6 @@ using namespace irr;
using
namespace
io
;
#endif
typedef
int
BOOL
;
extern
const
unsigned
short
PRO_VERSION
;
extern
int
enable_log
;
extern
bool
exit_on_return
;
...
...
gframe/data_manager.h
View file @
14e70e62
...
...
@@ -54,13 +54,13 @@ public:
string_pointer
strings_begin
;
string_pointer
strings_end
;
wchar_t
numStrings
[
301
][
4
];
wchar_t
numBuffer
[
6
];
wchar_t
attBuffer
[
128
];
wchar_t
racBuffer
[
128
];
wchar_t
tpBuffer
[
128
];
wchar_t
scBuffer
[
128
];
wchar_t
lmBuffer
[
32
];
wchar_t
numStrings
[
301
][
4
]
{}
;
wchar_t
numBuffer
[
6
]
{}
;
wchar_t
attBuffer
[
128
]
{}
;
wchar_t
racBuffer
[
128
]
{}
;
wchar_t
tpBuffer
[
128
]
{}
;
wchar_t
scBuffer
[
128
]
{}
;
wchar_t
lmBuffer
[
32
]
{}
;
static
byte
scriptBuffer
[
0x20000
];
static
const
wchar_t
*
unknown_string
;
...
...
gframe/drawing.cpp
View file @
14e70e62
...
...
@@ -1197,10 +1197,10 @@ void Game::DrawDeckBd() {
dx
=
436.0
f
/
(
lx
-
1
);
}
int
padding
=
scrPackCards
->
getPos
()
*
lx
;
for
(
size_
t
i
=
0
;
i
<
mainsize
-
padding
&&
i
<
7
*
lx
;
++
i
)
{
size_
t
j
=
i
+
padding
;
for
(
in
t
i
=
0
;
i
<
mainsize
-
padding
&&
i
<
7
*
lx
;
++
i
)
{
in
t
j
=
i
+
padding
;
DrawThumb
(
deckManager
.
current_deck
.
main
[
j
],
position2di
(
314
+
(
i
%
lx
)
*
dx
,
164
+
(
i
/
lx
)
*
dy
),
deckBuilder
.
filterList
);
if
(
deckBuilder
.
hovered_pos
==
1
&&
deckBuilder
.
hovered_seq
==
(
int
)
j
)
if
(
deckBuilder
.
hovered_pos
==
1
&&
deckBuilder
.
hovered_seq
==
j
)
driver
->
draw2DRectangleOutline
(
Resize
(
313
+
(
i
%
lx
)
*
dx
,
163
+
(
i
/
lx
)
*
dy
,
359
+
(
i
%
lx
)
*
dx
,
228
+
(
i
/
lx
)
*
dy
));
}
if
(
!
deckBuilder
.
showing_pack
)
{
...
...
gframe/duelclient.cpp
View file @
14e70e62
...
...
@@ -19,8 +19,8 @@ unsigned char DuelClient::selftype = 0;
bool
DuelClient
::
is_host
=
false
;
event_base
*
DuelClient
::
client_base
=
0
;
bufferevent
*
DuelClient
::
client_bev
=
0
;
unsigned
char
DuelClient
::
duel_client_read
[
0x2000
];
unsigned
char
DuelClient
::
duel_client_write
[
0x2000
];
unsigned
char
DuelClient
::
duel_client_read
[
SIZE_NETWORK_BUFFER
];
unsigned
char
DuelClient
::
duel_client_write
[
SIZE_NETWORK_BUFFER
];
bool
DuelClient
::
is_closing
=
false
;
bool
DuelClient
::
is_swapping
=
false
;
int
DuelClient
::
select_hint
=
0
;
...
...
@@ -4023,8 +4023,8 @@ void DuelClient::BeginRefreshHost() {
SOCKET
sSend
=
socket
(
AF_INET
,
SOCK_DGRAM
,
IPPROTO_UDP
);
if
(
sSend
==
INVALID_SOCKET
)
break
;
BOOL
opt
=
TRUE
;
setsockopt
(
sSend
,
SOL_SOCKET
,
SO_BROADCAST
,
(
const
char
*
)
&
opt
,
sizeof
(
BOOL
)
);
int
opt
=
TRUE
;
setsockopt
(
sSend
,
SOL_SOCKET
,
SO_BROADCAST
,
(
const
char
*
)
&
opt
,
sizeof
opt
);
if
(
bind
(
sSend
,
(
sockaddr
*
)
&
local
,
sizeof
(
sockaddr
))
==
SOCKET_ERROR
)
{
closesocket
(
sSend
);
break
;
...
...
gframe/duelclient.h
View file @
14e70e62
...
...
@@ -27,8 +27,8 @@ private:
static
bool
is_host
;
static
event_base
*
client_base
;
static
bufferevent
*
client_bev
;
static
unsigned
char
duel_client_read
[
0x2000
];
static
unsigned
char
duel_client_write
[
0x2000
];
static
unsigned
char
duel_client_read
[
SIZE_NETWORK_BUFFER
];
static
unsigned
char
duel_client_write
[
SIZE_NETWORK_BUFFER
];
static
bool
is_closing
;
static
bool
is_swapping
;
static
int
select_hint
;
...
...
@@ -60,17 +60,25 @@ public:
template
<
typename
ST
>
static
void
SendPacketToServer
(
unsigned
char
proto
,
ST
&
st
)
{
auto
p
=
duel_client_write
;
BufferIO
::
WriteInt16
(
p
,
1
+
sizeof
(
ST
));
int
blen
=
sizeof
(
ST
);
if
(
blen
>
MAX_DATA_SIZE
)
blen
=
MAX_DATA_SIZE
;
BufferIO
::
WriteInt16
(
p
,
(
short
)(
1
+
blen
));
BufferIO
::
WriteInt8
(
p
,
proto
);
memcpy
(
p
,
&
st
,
sizeof
(
ST
)
);
bufferevent_write
(
client_bev
,
duel_client_write
,
sizeof
(
ST
)
+
3
);
memcpy
(
p
,
&
st
,
blen
);
bufferevent_write
(
client_bev
,
duel_client_write
,
blen
+
3
);
}
static
void
SendBufferToServer
(
unsigned
char
proto
,
void
*
buffer
,
size_t
len
)
{
auto
p
=
duel_client_write
;
BufferIO
::
WriteInt16
(
p
,
1
+
len
);
int
blen
=
len
;
if
(
blen
<
0
)
return
;
if
(
blen
>
MAX_DATA_SIZE
)
blen
=
MAX_DATA_SIZE
;
BufferIO
::
WriteInt16
(
p
,
(
short
)(
1
+
blen
));
BufferIO
::
WriteInt8
(
p
,
proto
);
memcpy
(
p
,
buffer
,
len
);
bufferevent_write
(
client_bev
,
duel_client_write
,
len
+
3
);
memcpy
(
p
,
buffer
,
b
len
);
bufferevent_write
(
client_bev
,
duel_client_write
,
b
len
+
3
);
}
protected:
...
...
gframe/game.cpp
View file @
14e70e62
...
...
@@ -827,7 +827,7 @@ bool Game::Initialize() {
btnCategoryOK
=
env
->
addButton
(
rect
<
s32
>
(
150
,
210
,
250
,
235
),
wCategories
,
BUTTON_CATEGORY_OK
,
dataManager
.
GetSysString
(
1211
));
int
catewidth
=
0
;
for
(
int
i
=
0
;
i
<
32
;
++
i
)
{
irr
::
core
::
dimension2d
<
unsigned
int
>
dtxt
=
mainGame
->
guiFont
->
getDimension
(
dataManager
.
GetSysString
(
1100
+
i
));
irr
::
core
::
dimension2d
<
unsigned
int
>
dtxt
=
guiFont
->
getDimension
(
dataManager
.
GetSysString
(
1100
+
i
));
if
((
int
)
dtxt
.
Width
+
40
>
catewidth
)
catewidth
=
dtxt
.
Width
+
40
;
}
...
...
@@ -1619,7 +1619,7 @@ void Game::ShowCardInfo(int code, bool resize) {
myswprintf
(
formatBuffer
,
L"[%ls] %ls/%ls"
,
dataManager
.
FormatType
(
cd
.
type
),
dataManager
.
FormatRace
(
cd
.
race
),
dataManager
.
FormatAttribute
(
cd
.
attribute
));
stInfo
->
setText
(
formatBuffer
);
int
offset_info
=
0
;
irr
::
core
::
dimension2d
<
unsigned
int
>
dtxt
=
mainGame
->
guiFont
->
getDimension
(
formatBuffer
);
irr
::
core
::
dimension2d
<
unsigned
int
>
dtxt
=
guiFont
->
getDimension
(
formatBuffer
);
if
(
dtxt
.
Width
>
(
300
*
xScale
-
13
)
-
15
)
offset_info
=
15
;
if
(
!
(
cd
.
type
&
TYPE_LINK
))
{
...
...
@@ -1653,7 +1653,7 @@ void Game::ShowCardInfo(int code, bool resize) {
}
stDataInfo
->
setText
(
formatBuffer
);
int
offset_arrows
=
offset_info
;
dtxt
=
mainGame
->
guiFont
->
getDimension
(
formatBuffer
);
dtxt
=
guiFont
->
getDimension
(
formatBuffer
);
if
(
dtxt
.
Width
>
(
300
*
xScale
-
13
)
-
15
)
offset_arrows
+=
15
;
stInfo
->
setRelativePosition
(
rect
<
s32
>
(
15
,
37
,
300
*
xScale
-
13
,
(
60
+
offset_info
)));
...
...
@@ -1989,8 +1989,8 @@ void Game::OnResize() {
scrTabSystem
->
setVisible
(
false
);
if
(
gameConf
.
resize_popup_menu
)
{
int
width
=
100
*
mainGame
->
xScale
;
int
height
=
(
mainGame
->
yScale
>=
0.666
)
?
21
*
mainGame
->
yScale
:
14
;
int
width
=
100
*
xScale
;
int
height
=
(
yScale
>=
0.666
)
?
21
*
yScale
:
14
;
wCmdMenu
->
setRelativePosition
(
recti
(
1
,
1
,
width
+
1
,
1
));
btnActivate
->
setRelativePosition
(
recti
(
1
,
1
,
width
,
height
));
btnSummon
->
setRelativePosition
(
recti
(
1
,
1
,
width
,
height
));
...
...
@@ -2170,7 +2170,7 @@ void Game::FlashWindow() {
#endif
}
void
Game
::
SetCursor
(
ECURSOR_ICON
icon
)
{
ICursorControl
*
cursor
=
mainGame
->
device
->
getCursorControl
();
ICursorControl
*
cursor
=
device
->
getCursorControl
();
if
(
cursor
->
getActiveIcon
()
!=
icon
)
{
cursor
->
setActiveIcon
(
icon
);
}
...
...
gframe/netserver.cpp
View file @
14e70e62
...
...
@@ -9,8 +9,8 @@ event_base* NetServer::net_evbase = 0;
event
*
NetServer
::
broadcast_ev
=
0
;
evconnlistener
*
NetServer
::
listener
=
0
;
DuelMode
*
NetServer
::
duel_mode
=
0
;
unsigned
char
NetServer
::
net_server_read
[
0x2000
];
unsigned
char
NetServer
::
net_server_write
[
0x2000
];
unsigned
char
NetServer
::
net_server_read
[
SIZE_NETWORK_BUFFER
];
unsigned
char
NetServer
::
net_server_write
[
SIZE_NETWORK_BUFFER
];
unsigned
short
NetServer
::
last_sent
=
0
;
#ifdef YGOPRO_SERVER_MODE
...
...
@@ -118,9 +118,9 @@ bool NetServer::StartBroadcast() {
if
(
!
net_evbase
)
return
false
;
SOCKET
udp
=
socket
(
AF_INET
,
SOCK_DGRAM
,
IPPROTO_UDP
);
BOOL
opt
=
TRUE
;
setsockopt
(
udp
,
SOL_SOCKET
,
SO_BROADCAST
,
(
const
char
*
)
&
opt
,
sizeof
(
BOOL
)
);
setsockopt
(
udp
,
SOL_SOCKET
,
SO_REUSEADDR
,
(
const
char
*
)
&
opt
,
sizeof
(
BOOL
)
);
int
opt
=
TRUE
;
setsockopt
(
udp
,
SOL_SOCKET
,
SO_BROADCAST
,
(
const
char
*
)
&
opt
,
sizeof
opt
);
setsockopt
(
udp
,
SOL_SOCKET
,
SO_REUSEADDR
,
(
const
char
*
)
&
opt
,
sizeof
opt
);
sockaddr_in
addr
;
memset
(
&
addr
,
0
,
sizeof
(
addr
));
addr
.
sin_family
=
AF_INET
;
...
...
gframe/netserver.h
View file @
14e70e62
...
...
@@ -20,8 +20,8 @@ private:
static
event
*
broadcast_ev
;
static
evconnlistener
*
listener
;
static
DuelMode
*
duel_mode
;
static
unsigned
char
net_server_read
[
0x2000
];
static
unsigned
char
net_server_write
[
0x2000
];
static
unsigned
char
net_server_read
[
SIZE_NETWORK_BUFFER
];
static
unsigned
char
net_server_write
[
SIZE_NETWORK_BUFFER
];
static
unsigned
short
last_sent
;
public:
...
...
@@ -52,26 +52,34 @@ public:
last_sent
=
3
;
if
(
!
dp
)
return
;
bufferevent_write
(
dp
->
bev
,
net_server_write
,
last_sent
);
bufferevent_write
(
dp
->
bev
,
net_server_write
,
3
);
}
template
<
typename
ST
>
static
void
SendPacketToPlayer
(
DuelPlayer
*
dp
,
unsigned
char
proto
,
ST
&
st
)
{
auto
p
=
net_server_write
;
BufferIO
::
WriteInt16
(
p
,
1
+
sizeof
(
ST
));
int
blen
=
sizeof
(
ST
);
if
(
blen
>
MAX_DATA_SIZE
)
blen
=
MAX_DATA_SIZE
;
BufferIO
::
WriteInt16
(
p
,
(
short
)(
1
+
blen
));
BufferIO
::
WriteInt8
(
p
,
proto
);
memcpy
(
p
,
&
st
,
sizeof
(
ST
)
);
last_sent
=
sizeof
(
ST
)
+
3
;
if
(
dp
)
bufferevent_write
(
dp
->
bev
,
net_server_write
,
last_sent
);
memcpy
(
p
,
&
st
,
blen
);
last_sent
=
blen
+
3
;
if
(
dp
)
bufferevent_write
(
dp
->
bev
,
net_server_write
,
blen
+
3
);
}
static
void
SendBufferToPlayer
(
DuelPlayer
*
dp
,
unsigned
char
proto
,
void
*
buffer
,
size_t
len
)
{
auto
p
=
net_server_write
;
BufferIO
::
WriteInt16
(
p
,
1
+
len
);
int
blen
=
len
;
if
(
blen
<
0
)
return
;
if
(
blen
>
MAX_DATA_SIZE
)
blen
=
MAX_DATA_SIZE
;
BufferIO
::
WriteInt16
(
p
,
(
short
)(
1
+
blen
));
BufferIO
::
WriteInt8
(
p
,
proto
);
memcpy
(
p
,
buffer
,
len
);
last_sent
=
len
+
3
;
if
(
dp
)
bufferevent_write
(
dp
->
bev
,
net_server_write
,
last_sent
);
memcpy
(
p
,
buffer
,
b
len
);
last_sent
=
b
len
+
3
;
if
(
dp
)
bufferevent_write
(
dp
->
bev
,
net_server_write
,
blen
+
3
);
}
static
void
ReSendToPlayer
(
DuelPlayer
*
dp
)
{
if
(
dp
)
...
...
gframe/network.h
View file @
14e70e62
...
...
@@ -10,6 +10,8 @@
#include <event2/thread.h>
namespace
ygo
{
constexpr
int
SIZE_NETWORK_BUFFER
=
0x2000
;
constexpr
int
MAX_DATA_SIZE
=
SIZE_NETWORK_BUFFER
-
3
;
struct
HostInfo
{
unsigned
int
lflist
{
0
};
...
...
gframe/single_mode.cpp
View file @
14e70e62
...
...
@@ -55,7 +55,7 @@ int SingleMode::SinglePlayThread() {
if
(
mainGame
->
chkSinglePlayReturnDeckTop
->
isChecked
())
opt
|=
DUEL_RETURN_DECK_TOP
;
char
filename
[
256
];
size_
t
slen
=
0
;
in
t
slen
=
0
;
if
(
open_file
)
{
open_file
=
false
;
slen
=
BufferIO
::
EncodeUTF8
(
open_file_name
,
filename
);
...
...
lflist.conf
View file @
14e70e62
This diff is collapsed.
Click to expand it.
ocgcore
@
dfef9c14
Subproject commit
c146c5493b5dd33db4026eb38b25fd45f8211b1
0
Subproject commit
dfef9c1415a6bc006c1b60909a9106a5a228ac0
0
script
@
e5433ecb
Subproject commit
d6202e392bb5e3aa53e4cc1b822c929c5bcc1aff
Subproject commit
e5433ecb3d214e4e9a5fd76f41904edeeba6f402
strings.conf
View file @
14e70e62
...
...
@@ -1183,7 +1183,7 @@
!
setname
0
x18f
防火 ファイアウォール
!
setname
0
x190
末那愚子族 マナドゥム
!
setname
0
x191
妮穆蕾莉娅 ネムレリア
!
setname
0
x192
金傲大奖赛
GP
(ゴールド・プライド)
!
setname
0
x192
黄金荣耀
GP
(ゴールド・プライド)
!
setname
0
x193
迷宫壁 ラビリンス・ウォール
!
setname
0
x194
至爱 フェイバリット
!
setname
0
x195
征服斗魂
VS
(ヴァンキッシュ・ソウル)
...
...
@@ -1211,3 +1211,4 @@
!
setname
0
x1aa
天杯龙 天盃龍
!
setname
0
x1ab
蕾祸 蕾禍
!
setname
0
x1ac
飞龙炎
Salamandra
!
setname
0
x1ad
灰尽
Ashened
system.conf
View file @
14e70e62
...
...
@@ -41,6 +41,7 @@ bot_deck_path = ./botdeck
quick_animation
=
0
auto_save_replay
=
0
draw_single_chain
=
0
hide_player_name
=
0
prefer_expansion_script
=
0
window_maximized
=
0
window_width
=
1280
...
...
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