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
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
MyCard
ygopro
Commits
95ed3727
Commit
95ed3727
authored
Jun 27, 2025
by
nanahira
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'develop' into server-develop
parents
5c2835da
23be6f4c
Changes
18
Hide whitespace changes
Inline
Side-by-side
Showing
18 changed files
with
412 additions
and
18 deletions
+412
-18
.ci/assets-locale.sh
.ci/assets-locale.sh
+1
-0
.ci/pack-linux-dlc.sh
.ci/pack-linux-dlc.sh
+1
-1
.ci/pack-linux.sh
.ci/pack-linux.sh
+1
-1
.ci/pack-macos-dlc.sh
.ci/pack-macos-dlc.sh
+1
-1
.ci/pack-macos.sh
.ci/pack-macos.sh
+1
-1
.ci/pack-windows-7z.sh
.ci/pack-windows-7z.sh
+1
-1
.ci/pack-windows-dlc.sh
.ci/pack-windows-dlc.sh
+1
-1
.ci/pack-windows.sh
.ci/pack-windows.sh
+1
-1
.gitlab-ci.yml
.gitlab-ci.yml
+131
-4
gframe/data_manager.cpp
gframe/data_manager.cpp
+164
-0
gframe/data_manager.h
gframe/data_manager.h
+15
-0
gframe/duelclient.cpp
gframe/duelclient.cpp
+2
-1
gframe/game.cpp
gframe/game.cpp
+51
-6
gframe/game.h
gframe/game.h
+11
-0
gframe/menu_handler.cpp
gframe/menu_handler.cpp
+18
-0
servers.conf
servers.conf
+8
-0
strings.conf
strings.conf
+1
-0
system.conf
system.conf
+3
-0
No files found.
.ci/assets-locale.sh
View file @
95ed3727
...
...
@@ -6,6 +6,7 @@ source .ci/asset-branch
apt update
&&
apt
-y
install
wget git libarchive-tools sqlite3
git clone
--depth
=
1
-b
"
$ASSET_BRANCH_NAME
"
https://code.moenext.com/mycard/ygopro-database
cp
-rf
./ygopro-database/locales/
$TARGET_LOCALE
/strings.conf
.
cp
-rf
./ygopro-database/locales/
$TARGET_LOCALE
/servers.conf
.
rm
-f
cards.cdb
sqlite3 ./ygopro-database/locales/
$TARGET_LOCALE
/cards.cdb .dump | sqlite3 cards.cdb
# ygopro-images
...
...
.ci/pack-linux-dlc.sh
View file @
95ed3727
...
...
@@ -2,7 +2,7 @@
set
-x
set
-o
errexit
ARCHIVE_FILES
=(
ygopro cards.cdb locales fonts sound textures strings.conf system.conf pack
)
ARCHIVE_FILES
=(
ygopro cards.cdb locales fonts sound textures strings.conf system.conf
servers.conf
pack
)
if
[[
-z
"
$TARGET_PLATFORM
"
]]
;
then
TARGET_PLATFORM
=
linux
...
...
.ci/pack-linux.sh
View file @
95ed3727
...
...
@@ -2,7 +2,7 @@
set
-x
set
-o
errexit
ARCHIVE_FILES
=(
ygopro LICENSE README.md lflist.conf strings.conf system.conf cards.cdb script textures deck single pics replay windbot bot bot.conf locales fonts pack
)
ARCHIVE_FILES
=(
ygopro LICENSE README.md lflist.conf strings.conf system.conf
servers.conf
cards.cdb script textures deck single pics replay windbot bot bot.conf locales fonts pack
)
# TARGET_LOCALE
# ARCHIVE_SUFFIX
...
...
.ci/pack-macos-dlc.sh
View file @
95ed3727
...
...
@@ -2,7 +2,7 @@
set
-x
set
-o
errexit
ARCHIVE_FILES
=(
ygopro.app cards.cdb locales fonts sound textures strings.conf system.conf pack
)
ARCHIVE_FILES
=(
ygopro.app cards.cdb locales fonts sound textures strings.conf system.conf
servers.conf
pack
)
if
[[
-z
"
$TARGET_PLATFORM
"
]]
;
then
TARGET_PLATFORM
=
darwin
...
...
.ci/pack-macos.sh
View file @
95ed3727
...
...
@@ -2,7 +2,7 @@
set
-x
set
-o
errexit
ARCHIVE_FILES
=(
ygopro.app LICENSE README.md lflist.conf strings.conf system.conf cards.cdb script textures deck single pics replay sound windbot bot bot.conf locales fonts pack
)
ARCHIVE_FILES
=(
ygopro.app LICENSE README.md lflist.conf strings.conf system.conf
servers.conf
cards.cdb script textures deck single pics replay sound windbot bot bot.conf locales fonts pack
)
# TARGET_LOCALE
# ARCHIVE_SUFFIX
...
...
.ci/pack-windows-7z.sh
View file @
95ed3727
...
...
@@ -2,7 +2,7 @@
set
-x
set
-o
errexit
ARCHIVE_FILES
=(
ygopro.exe vcomp140.dll LICENSE README.md lflist.conf strings.conf system.conf cards.cdb script textures deck single pics replay sound bot.conf Bot.exe WindBot locales fonts skin pack
)
ARCHIVE_FILES
=(
ygopro.exe vcomp140.dll LICENSE README.md lflist.conf strings.conf system.conf
servers.conf
cards.cdb script textures deck single pics replay sound bot.conf Bot.exe WindBot locales fonts skin pack
)
if
[[
"
$TARGET_LOCALE
"
==
"zh-CN"
]]
;
then
ARCHIVE_FILES
=(
"
${
ARCHIVE_FILES
[@]
}
"
update-koishipro
)
...
...
.ci/pack-windows-dlc.sh
View file @
95ed3727
...
...
@@ -2,7 +2,7 @@
set
-x
set
-o
errexit
ARCHIVE_FILES
=(
ygopro.exe vcomp140.dll cards.cdb locales fonts sound textures strings.conf system.conf skin pack
)
ARCHIVE_FILES
=(
ygopro.exe vcomp140.dll cards.cdb locales fonts sound textures strings.conf system.conf s
ervers.conf s
kin pack
)
if
[[
-z
"
$TARGET_PLATFORM
"
]]
;
then
TARGET_PLATFORM
=
win32
...
...
.ci/pack-windows.sh
View file @
95ed3727
...
...
@@ -2,7 +2,7 @@
set
-x
set
-o
errexit
ARCHIVE_FILES
=(
ygopro.exe vcomp140.dll LICENSE README.md lflist.conf strings.conf system.conf cards.cdb script textures deck single pics replay sound bot.conf Bot.exe WindBot locales fonts skin pack
)
ARCHIVE_FILES
=(
ygopro.exe vcomp140.dll LICENSE README.md lflist.conf strings.conf system.conf
servers.conf
cards.cdb script textures deck single pics replay sound bot.conf Bot.exe WindBot locales fonts skin pack
)
if
[[
"
$TARGET_LOCALE
"
==
"zh-CN"
&&
"
$ARCHIVE_SUFFIX
"
!=
"zst"
]]
;
then
ARCHIVE_FILES
=(
"
${
ARCHIVE_FILES
[@]
}
"
update-koishipro
)
...
...
.gitlab-ci.yml
View file @
95ed3727
...
...
@@ -293,10 +293,137 @@ exec_macos:
-
exec_macos_x64_pro3
-
exec_macos_arm64_pro3
script
:
-
mkdir -p dist/macos
-
lipo -create -output dist/macos/ygopro dist/macos-x64/ygopro dist/macos-arm64/ygopro
-
lipo -create -output dist/macos/libygoserver.dylib dist/macos-x64/libygoserver.dylib dist/macos-arm64/libygoserver.dylib
-
rm -rf dist/macos-x64 dist/macos-arm64
-
mkdir -p ygopro.app/Contents/MacOS ygopro.app/Contents/Frameworks;
-
lipo -create -output ygopro.app/Contents/MacOS/ygopro $(ls -1 ygopro-platforms/ygopro-platform-*);
-
mkdir ygopro.app/Contents/Resources;
-
mv resource/gframe/ygopro.icns ygopro.app/Contents/Resources/Icon.icns;
-
defaults write "$PWD/ygopro.app/Contents/Info.plist" "CFBundleIconFile" "Icon.icns";
-
defaults write "$PWD/ygopro.app/Contents/Info.plist" "CFBundleIdentifier" "moe.mycard.ygopro";
artifacts
:
paths
:
-
ygopro.app
#exec_macos_sign:
# stage: sign
# tags:
# - macos
# dependencies:
# - exec_macos
# script: ./.ci/sign-macos.sh
# artifacts:
# paths:
# - ygopro.app
# only:
# - tags
# - master
assets
:
stage
:
prepare
tags
:
-
linux
script
:
-
apt update; apt -y install tar wget git
# starter pack
-
wget -O - https://code.moenext.com/mycard/ygopro-starter-pack/-/archive/master/ygopro-starter-pack-master.tar.gz | tar zfx -
-
mv ygopro-starter-pack-master/* .
# sound
-
wget -O - https://code.moenext.com/mycard/ygopro-sounds/-/archive/master/ygopro-sounds-master.tar.gz | tar zfx -
-
mv ygopro-sounds-master/sound/* sound
# fonts
-
git clone --depth=1 https://code.moenext.com/mycard/ygopro-fonts
-
mv ygopro-fonts/fonts .
# pack
-
git clone --depth=1 https://code.moenext.com/mycard/ygopro-card-list
-
mv ygopro-card-list/pack .
# locales
-
git clone --depth=1 https://code.moenext.com/nanahira/ygopro-database
-
mv ygopro-database/locales .
artifacts
:
paths
:
-
deck
-
single
-
sound
-
fonts
-
pack
-
locales
only
:
-
tags
-
master
assets_nonwindows
:
stage
:
prepare
tags
:
-
linux
script
:
-
apt update; apt -y install tar wget
-
wget -O - https://cdn02.moecube.com:444/windbot/windbot.tar.gz | tar zfx -
artifacts
:
paths
:
-
bot.conf
-
windbot
-
bot
only
:
-
tags
-
master
assets_windows
:
stage
:
prepare
tags
:
-
linux
script
:
-
wget https://cdn02.moecube.com:444/windbot/WindBot.7z
-
7z x -y WindBot.7z
-
aws s3 --endpoint=https://minio.mycard.moe:9000 sync s3://mycard/koishipro/contents/update-koishipro/ ./update-koishipro
-
rm -rf update-koishipro/.git ||
true
artifacts
:
paths
:
-
bot.conf
-
WindBot
-
Bot.exe
-
update-koishipro
only
:
-
tags
-
master
._locale_zh-CN
:
variables
:
TARGET_LOCALE
:
zh-CN
._locale_en-US
:
variables
:
TARGET_LOCALE
:
en-US
._assets_locale
:
stage
:
build
tags
:
-
linux
script
:
./.ci/assets-locale.sh
artifacts
:
paths
:
-
pics
-
cards.cdb
-
strings.conf
-
bot.conf
-
servers.conf
only
:
-
tags
-
master
assets_zh-CN
:
extends
:
-
._assets_locale
-
._locale_zh-CN
assets_en-US
:
extends
:
-
._assets_locale
-
._locale_en-US
._pack
:
stage
:
pack
tags
:
-
linux
artifacts
:
paths
:
-
dist
...
...
gframe/data_manager.cpp
View file @
95ed3727
...
...
@@ -145,6 +145,17 @@ bool DataManager::LoadStrings(const char* file) {
std
::
fclose
(
fp
);
return
true
;
}
bool
DataManager
::
LoadStrings
(
const
wchar_t
*
file
)
{
FILE
*
fp
=
mywfopen
(
file
,
"r"
);
if
(
!
fp
)
return
false
;
char
linebuf
[
TEXT_LINE_SIZE
]{};
while
(
std
::
fgets
(
linebuf
,
sizeof
linebuf
,
fp
))
{
ReadStringConfLine
(
linebuf
);
}
std
::
fclose
(
fp
);
return
true
;
}
bool
DataManager
::
LoadStrings
(
irr
::
io
::
IReadFile
*
reader
)
{
char
ch
{};
std
::
string
linebuf
;
...
...
@@ -191,6 +202,159 @@ void DataManager::ReadStringConfLine(const char* linebuf) {
_setnameStrings
[
value
]
=
strBuffer
;
}
}
bool
DataManager
::
LoadServerList
(
const
char
*
file
)
{
FILE
*
fp
=
myfopen
(
file
,
"r"
);
if
(
!
fp
)
return
false
;
char
linebuf
[
TEXT_LINE_SIZE
]{};
while
(
std
::
fgets
(
linebuf
,
sizeof
linebuf
,
fp
))
{
ReadServerConfLine
(
linebuf
);
}
std
::
fclose
(
fp
);
return
true
;
}
bool
DataManager
::
LoadServerList
(
const
wchar_t
*
file
)
{
FILE
*
fp
=
mywfopen
(
file
,
"r"
);
if
(
!
fp
)
return
false
;
char
linebuf
[
TEXT_LINE_SIZE
]{};
while
(
std
::
fgets
(
linebuf
,
sizeof
linebuf
,
fp
))
{
ReadServerConfLine
(
linebuf
);
}
std
::
fclose
(
fp
);
return
true
;
}
bool
DataManager
::
LoadServerList
(
irr
::
io
::
IReadFile
*
reader
)
{
char
ch
{};
std
::
string
linebuf
;
while
(
reader
->
read
(
&
ch
,
1
))
{
if
(
ch
==
'\0'
)
break
;
linebuf
.
push_back
(
ch
);
if
(
ch
==
'\n'
||
linebuf
.
size
()
>=
TEXT_LINE_SIZE
-
1
)
{
ReadServerConfLine
(
linebuf
.
data
());
linebuf
.
clear
();
}
}
reader
->
drop
();
return
true
;
}
void
DataManager
::
ReadServerConfLine
(
const
char
*
linebuf
)
{
char
buffer
[
1024
];
std
::
strncpy
(
buffer
,
linebuf
,
sizeof
(
buffer
)
-
1
);
buffer
[
sizeof
(
buffer
)
-
1
]
=
'\0'
;
buffer
[
strcspn
(
buffer
,
"
\n
"
)]
=
'\0'
;
char
*
sep1
=
std
::
strchr
(
buffer
,
'|'
);
if
(
sep1
!=
nullptr
)
{
*
sep1
=
'\0'
;
char
*
addrPart
=
sep1
+
1
;
wchar_t
wname
[
256
],
wip
[
512
];
// read the server name
BufferIO
::
DecodeUTF8
(
buffer
,
wname
);
// replace the first '|' with ':'
char
*
sep2
=
std
::
strchr
(
addrPart
,
'|'
);
if
(
sep2
)
{
*
sep2
=
':'
;
}
BufferIO
::
DecodeUTF8
(
addrPart
,
wip
);
_serverStrings
.
emplace_back
(
wname
,
wip
);
}
}
bool
DataManager
::
LoadCorresSrvIni
(
const
char
*
file
)
{
FILE
*
fp
=
myfopen
(
file
,
"r"
);
if
(
!
fp
)
return
false
;
char
linebuf
[
TEXT_LINE_SIZE
]{};
while
(
std
::
fgets
(
linebuf
,
sizeof
linebuf
,
fp
))
{
ReadCorresSrvIniLine
(
linebuf
);
}
std
::
fclose
(
fp
);
InsertServerList
();
return
true
;
}
bool
DataManager
::
LoadCorresSrvIni
(
const
wchar_t
*
file
)
{
FILE
*
fp
=
mywfopen
(
file
,
"r"
);
if
(
!
fp
)
return
false
;
char
linebuf
[
TEXT_LINE_SIZE
]{};
while
(
std
::
fgets
(
linebuf
,
sizeof
linebuf
,
fp
))
{
ReadCorresSrvIniLine
(
linebuf
);
}
std
::
fclose
(
fp
);
InsertServerList
();
return
true
;
}
bool
DataManager
::
LoadCorresSrvIni
(
irr
::
io
::
IReadFile
*
reader
)
{
char
ch
{};
std
::
string
linebuf
;
while
(
reader
->
read
(
&
ch
,
1
))
{
if
(
ch
==
'\0'
)
break
;
linebuf
.
push_back
(
ch
);
if
(
ch
==
'\n'
||
linebuf
.
size
()
>=
TEXT_LINE_SIZE
-
1
)
{
ReadCorresSrvIniLine
(
linebuf
.
data
());
linebuf
.
clear
();
}
}
reader
->
drop
();
InsertServerList
();
return
true
;
}
void
DataManager
::
ReadCorresSrvIniLine
(
const
char
*
linebuf
)
{
std
::
wstring
name
=
GetINIValue
(
linebuf
,
"ServerName = "
);
std
::
wstring
host
=
GetINIValue
(
linebuf
,
"ServerHost = "
);
std
::
wstring
port
=
GetINIValue
(
linebuf
,
"ServerPort = "
);
if
(
name
!=
L""
)
iniName
=
name
;
if
(
host
!=
L""
)
iniHost
=
host
;
if
(
port
!=
L""
)
iniPort
=
port
;
}
std
::
wstring
DataManager
::
GetINIValue
(
const
char
*
line
,
const
char
*
key
)
{
if
(
!
line
||
!
key
)
{
return
L""
;
}
const
char
*
keyPos
=
strstr
(
line
,
key
);
if
(
!
keyPos
)
{
return
L""
;
}
const
char
*
valStart
=
keyPos
+
strlen
(
key
);
while
(
*
valStart
==
' '
)
valStart
++
;
const
char
*
valEnd
=
valStart
;
while
(
*
valEnd
&&
*
valEnd
!=
'\n'
&&
*
valEnd
!=
'\r'
)
valEnd
++
;
if
(
valStart
==
valEnd
)
return
L""
;
std
::
string
narrowStr
(
valStart
,
valEnd
);
if
(
narrowStr
.
empty
())
return
L""
;
wchar_t
wbuf
[
1024
];
BufferIO
::
DecodeUTF8
(
narrowStr
.
c_str
(),
wbuf
);
return
wbuf
;
}
void
DataManager
::
InsertServerList
()
{
if
(
iniName
!=
L""
&&
iniHost
!=
L""
)
{
std
::
wstring
ip
=
iniHost
;
if
(
iniPort
!=
L""
)
{
ip
+=
L":"
;
ip
+=
iniPort
;
}
_serverStrings
.
emplace_back
(
iniName
,
ip
);
}
iniName
.
clear
();
iniHost
.
clear
();
iniPort
.
clear
();
}
#endif //YGOPRO_SERVER_MODE
bool
DataManager
::
Error
(
sqlite3
*
pDB
,
sqlite3_stmt
*
pStmt
)
{
std
::
snprintf
(
errmsg
,
sizeof
errmsg
,
"%s"
,
sqlite3_errmsg
(
pDB
));
...
...
gframe/data_manager.h
View file @
95ed3727
...
...
@@ -50,8 +50,19 @@ public:
#endif
#ifndef YGOPRO_SERVER_MODE
bool
LoadStrings
(
const
char
*
file
);
bool
LoadStrings
(
const
wchar_t
*
file
);
bool
LoadStrings
(
irr
::
io
::
IReadFile
*
reader
);
void
ReadStringConfLine
(
const
char
*
linebuf
);
bool
LoadServerList
(
const
char
*
file
);
bool
LoadServerList
(
const
wchar_t
*
file
);
bool
LoadServerList
(
irr
::
io
::
IReadFile
*
reader
);
void
ReadServerConfLine
(
const
char
*
linebuf
);
bool
LoadCorresSrvIni
(
const
char
*
file
);
bool
LoadCorresSrvIni
(
const
wchar_t
*
file
);
bool
LoadCorresSrvIni
(
irr
::
io
::
IReadFile
*
reader
);
void
ReadCorresSrvIniLine
(
const
char
*
linebuf
);
std
::
wstring
GetINIValue
(
const
char
*
line
,
const
char
*
key
);
void
InsertServerList
();
#endif
bool
Error
(
sqlite3
*
pDB
,
sqlite3_stmt
*
pStmt
=
nullptr
);
...
...
@@ -86,6 +97,7 @@ public:
std
::
unordered_map
<
unsigned
int
,
std
::
wstring
>
_victoryStrings
;
std
::
unordered_map
<
unsigned
int
,
std
::
wstring
>
_setnameStrings
;
std
::
unordered_map
<
unsigned
int
,
std
::
wstring
>
_sysStrings
;
std
::
vector
<
std
::
pair
<
std
::
wstring
,
std
::
wstring
>>
_serverStrings
;
#endif
char
errmsg
[
512
]{};
...
...
@@ -122,6 +134,9 @@ private:
std
::
unordered_map
<
unsigned
int
,
CardDataC
>
_datas
;
std
::
unordered_map
<
unsigned
int
,
CardString
>
_strings
;
std
::
unordered_map
<
unsigned
int
,
std
::
vector
<
uint16_t
>>
extra_setcode
;
std
::
wstring
iniName
;
std
::
wstring
iniHost
;
std
::
wstring
iniPort
;
};
extern
DataManager
dataManager
;
...
...
gframe/duelclient.cpp
View file @
95ed3727
...
...
@@ -386,7 +386,7 @@ void DuelClient::HandleSTOCPacketLan(unsigned char* data, int len) {
break
;
}
case
ERRMSG_VERERROR
:
{
if
(
temp_ver
)
{
if
(
temp_ver
||
!
mainGame
->
gameConf
.
freever
)
{
temp_ver
=
0
;
mainGame
->
btnCreateHost
->
setEnabled
(
true
);
mainGame
->
btnJoinHost
->
setEnabled
(
true
);
...
...
@@ -622,6 +622,7 @@ void DuelClient::HandleSTOCPacketLan(unsigned char* data, int len) {
mainGame
->
cbDeckSelect
->
setEnabled
(
true
);
mainGame
->
HideElement
(
mainGame
->
wCreateHost
);
mainGame
->
HideElement
(
mainGame
->
wLanWindow
);
mainGame
->
HideElement
(
mainGame
->
wServerList
);
mainGame
->
HideElement
(
mainGame
->
wSinglePlay
);
mainGame
->
ShowElement
(
mainGame
->
wHostPrepare
);
mainGame
->
ResizeChatInputWindow
();
...
...
gframe/game.cpp
View file @
95ed3727
...
...
@@ -180,6 +180,8 @@ bool Game::Initialize() {
ErrorLog
(
"Failed to load strings!"
);
return
false
;
}
if
(
dataManager
.
LoadServerList
(
GetLocaleDir
(
"servers.conf"
)))
{}
else
dataManager
.
LoadServerList
(
"servers.conf"
);
dataManager
.
LoadDB
(
L"specials/special.cdb"
);
env
=
device
->
getGUIEnvironment
();
numFont
=
irr
::
gui
::
CGUITTFont
::
createTTFont
(
env
,
gameConf
.
numfont
,
16
);
...
...
@@ -291,7 +293,8 @@ bool Game::Initialize() {
editbox_list
.
push_back
(
ebNickName
);
lstHostList
=
env
->
addListBox
(
irr
::
core
::
rect
<
irr
::
s32
>
(
10
,
60
,
570
,
320
),
wLanWindow
,
LISTBOX_LAN_HOST
,
true
);
lstHostList
->
setItemHeight
(
18
);
btnLanRefresh
=
env
->
addButton
(
irr
::
core
::
rect
<
irr
::
s32
>
(
240
,
325
,
340
,
350
),
wLanWindow
,
BUTTON_LAN_REFRESH
,
dataManager
.
GetSysString
(
1217
));
btnLanRefresh
=
env
->
addButton
(
irr
::
core
::
rect
<
irr
::
s32
>
(
150
,
325
,
250
,
350
),
wLanWindow
,
BUTTON_LAN_REFRESH
,
dataManager
.
GetSysString
(
1217
));
btnServerList
=
env
->
addButton
(
irr
::
core
::
rect
<
irr
::
s32
>
(
280
,
325
,
380
,
350
),
wLanWindow
,
BUTTON_SERVER_LIST
,
dataManager
.
GetSysString
(
1239
));
env
->
addStaticText
(
dataManager
.
GetSysString
(
1221
),
irr
::
core
::
rect
<
irr
::
s32
>
(
10
,
360
,
220
,
380
),
false
,
false
,
wLanWindow
);
ebJoinHost
=
env
->
addEditBox
(
gameConf
.
lasthost
,
irr
::
core
::
rect
<
irr
::
s32
>
(
110
,
355
,
420
,
380
),
true
,
wLanWindow
);
ebJoinHost
->
setTextAlignment
(
irr
::
gui
::
EGUIA_CENTER
,
irr
::
gui
::
EGUIA_CENTER
);
...
...
@@ -415,6 +418,15 @@ bool Game::Initialize() {
btnHostPrepNotReady
->
setVisible
(
false
);
btnHostPrepStart
=
env
->
addButton
(
irr
::
core
::
rect
<
irr
::
s32
>
(
230
,
280
,
340
,
305
),
wHostPrepare
,
BUTTON_HP_START
,
dataManager
.
GetSysString
(
1215
));
btnHostPrepCancel
=
env
->
addButton
(
irr
::
core
::
rect
<
irr
::
s32
>
(
350
,
280
,
460
,
305
),
wHostPrepare
,
BUTTON_HP_CANCEL
,
dataManager
.
GetSysString
(
1210
));
//server list
wServerList
=
env
->
addWindow
(
irr
::
core
::
rect
<
irr
::
s32
>
(
25
,
80
,
325
,
400
),
false
,
dataManager
.
GetSysString
(
1239
));
wServerList
->
getCloseButton
()
->
setVisible
(
false
);
wServerList
->
setVisible
(
false
);
wServerList
->
setDraggable
(
true
);
lstServerList
=
env
->
addListBox
(
irr
::
core
::
rect
<
irr
::
s32
>
(
10
,
20
,
290
,
270
),
wServerList
,
LISTBOX_SERVER_LIST
,
true
);
lstServerList
->
setItemHeight
(
18
);
RefreshServerList
();
btnServerReturn
=
env
->
addButton
(
irr
::
core
::
rect
<
irr
::
s32
>
(
100
,
280
,
200
,
310
),
wServerList
,
BUTTON_SERVER_RETURN
,
dataManager
.
GetSysString
(
1210
));
//img
wCardImg
=
env
->
addStaticText
(
L""
,
irr
::
core
::
rect
<
irr
::
s32
>
(
1
,
1
,
1
+
CARD_IMG_WIDTH
+
20
,
1
+
CARD_IMG_HEIGHT
+
18
),
true
,
false
,
0
,
-
1
,
true
);
wCardImg
->
setBackgroundColor
(
0xc0c0c0c0
);
...
...
@@ -1290,6 +1302,7 @@ std::wstring Game::SetStaticText(irr::gui::IGUIStaticText* pControl, irr::u32 cW
#endif //YGOPRO_SERVER_MODE
void
Game
::
LoadExpansions
(
const
wchar_t
*
expansions_path
)
{
bool
lflist_changed
=
false
;
bool
server_list_changed
=
false
;
FileSystem
::
TraversalDir
(
expansions_path
,
[
&
](
const
wchar_t
*
name
,
bool
isdir
)
{
if
(
isdir
)
return
;
...
...
@@ -1303,15 +1316,25 @@ void Game::LoadExpansions(const wchar_t* expansions_path) {
if
(
!
std
::
wcscmp
(
name
,
L"lflist.conf"
))
{
deckManager
.
LoadLFListSingle
(
fpath
,
true
);
lflist_changed
=
true
;
}
else
if
(
!
std
::
wcscmp
(
name
,
L"servers.conf"
))
{
#ifndef YGOPRO_SERVER_MODE
dataManager
.
LoadServerList
(
fpath
);
server_list_changed
=
true
;
#endif
}
else
{
#ifndef YGOPRO_SERVER_MODE
char
upath
[
1024
];
BufferIO
::
EncodeUTF8
(
fpath
,
upath
);
dataManager
.
LoadStrings
(
upath
);
dataManager
.
LoadStrings
(
fpath
);
#endif
}
return
;
}
#ifndef YGOPRO_SERVER_MODE
if
(
!
std
::
wcscmp
(
name
,
L"corres_srv.ini"
))
{
dataManager
.
LoadCorresSrvIni
(
fpath
);
server_list_changed
=
true
;
return
;
}
#endif
#if defined(SERVER_ZIP_SUPPORT) || !defined(YGOPRO_SERVER_MODE)
if
(
IsExtension
(
name
,
L".zip"
)
||
IsExtension
(
name
,
L".ypk"
))
{
#ifdef _WIN32
...
...
@@ -1353,6 +1376,11 @@ void Game::LoadExpansions(const wchar_t* expansions_path) {
if
(
!
std
::
wcscmp
(
fname
,
L"lflist.conf"
))
{
deckManager
.
LoadLFListSingle
(
reader
,
true
);
lflist_changed
=
true
;
}
else
if
(
!
std
::
wcscmp
(
fname
,
L"servers.conf"
))
{
#ifndef YGOPRO_SERVER_MODE
dataManager
.
LoadServerList
(
reader
);
server_list_changed
=
true
;
#endif
}
else
{
#ifndef YGOPRO_SERVER_MODE
dataManager
.
LoadStrings
(
reader
);
...
...
@@ -1361,6 +1389,10 @@ void Game::LoadExpansions(const wchar_t* expansions_path) {
continue
;
}
#ifndef YGOPRO_SERVER_MODE
if
(
!
std
::
wcscmp
(
fname
,
L"corres_srv.ini"
))
{
dataManager
.
LoadCorresSrvIni
(
createReader
());
server_list_changed
=
true
;
}
if
(
!
mywcsncasecmp
(
fname
,
L"pack/"
,
5
)
&&
IsExtension
(
fname
,
L".ydk"
))
{
deckBuilder
.
expansionPacks
.
push_back
(
fname
);
continue
;
...
...
@@ -1372,6 +1404,8 @@ void Game::LoadExpansions(const wchar_t* expansions_path) {
#ifndef YGOPRO_SERVER_MODE
if
(
lflist_changed
)
RefreshLFList
();
if
(
server_list_changed
)
RefreshServerList
();
#endif
}
void
Game
::
LoadExpansionsAll
()
{
...
...
@@ -1589,6 +1623,13 @@ void Game::RefreshBot() {
RefreshCategoryDeck
(
cbBotDeckCategory
,
cbBotDeck
);
}
}
void
Game
::
RefreshServerList
()
{
lstServerList
->
clear
();
for
(
const
auto
&
pair
:
dataManager
.
_serverStrings
)
{
const
wchar_t
*
key
=
pair
.
first
.
c_str
();
lstServerList
->
addItem
(
key
);
}
}
bool
Game
::
LoadConfigFromFile
(
const
char
*
file
)
{
FILE
*
fp
=
myfopen
(
file
,
"r"
);
if
(
!
fp
){
...
...
@@ -1606,12 +1647,14 @@ bool Game::LoadConfigFromFile(const char* file) {
gameConf
.
use_d3d
=
std
::
strtol
(
valbuf
,
nullptr
,
10
)
>
0
;
}
else
if
(
!
std
::
strcmp
(
strbuf
,
"use_image_scale"
))
{
gameConf
.
use_image_scale
=
std
::
strtol
(
valbuf
,
nullptr
,
10
)
>
0
;
}
else
if
(
!
std
::
strcmp
(
strbuf
,
"pro_version"
))
{
PRO_VERSION
=
std
::
strtol
(
valbuf
,
nullptr
,
10
);
}
else
if
(
!
std
::
strcmp
(
strbuf
,
"use_image_scale_multi_thread"
))
{
gameConf
.
use_image_scale_multi_thread
=
std
::
strtol
(
valbuf
,
nullptr
,
10
)
>
0
;
}
else
if
(
!
std
::
strcmp
(
strbuf
,
"use_image_load_background_thread"
))
{
gameConf
.
use_image_load_background_thread
=
std
::
strtol
(
valbuf
,
nullptr
,
10
)
>
0
;
}
else
if
(
!
std
::
strcmp
(
strbuf
,
"pro_version"
))
{
PRO_VERSION
=
std
::
strtol
(
valbuf
,
nullptr
,
10
);
}
else
if
(
!
std
::
strcmp
(
strbuf
,
"freever"
))
{
gameConf
.
freever
=
std
::
strtol
(
valbuf
,
nullptr
,
10
)
>
0
;
}
else
if
(
!
std
::
strcmp
(
strbuf
,
"errorlog"
))
{
unsigned
int
val
=
std
::
strtol
(
valbuf
,
nullptr
,
10
);
enable_log
=
val
&
0xff
;
...
...
@@ -1884,6 +1927,7 @@ void Game::SaveConfig() {
std
::
fprintf
(
fp
,
"use_image_scale_multi_thread = %d
\n
"
,
gameConf
.
use_image_scale_multi_thread
?
1
:
0
);
std
::
fprintf
(
fp
,
"use_image_load_background_thread = %d
\n
"
,
gameConf
.
use_image_load_background_thread
?
1
:
0
);
std
::
fprintf
(
fp
,
"pro_version = %d
\n
"
,
PRO_VERSION
);
std
::
fprintf
(
fp
,
"freever = %d
\n
"
,
gameConf
.
freever
?
1
:
0
);
std
::
fprintf
(
fp
,
"antialias = %d
\n
"
,
gameConf
.
antialias
);
std
::
fprintf
(
fp
,
"errorlog = %u
\n
"
,
enable_log
);
BufferIO
::
CopyWideString
(
ebNickName
->
getText
(),
gameConf
.
nickname
);
...
...
@@ -2286,6 +2330,7 @@ void Game::CloseDuelWindow() {
lstLog
->
clear
();
logParam
.
clear
();
lstHostList
->
clear
();
lstServerList
->
clear
();
DuelClient
::
hosts
.
clear
();
DuelClient
::
hosts_srvpro
.
clear
();
ClearTextures
();
...
...
gframe/game.h
View file @
95ed3727
...
...
@@ -65,6 +65,7 @@ struct Config {
#else
bool
use_image_load_background_thread
{
true
};
#endif
bool
freever
{
true
};
unsigned
short
antialias
{
0
};
unsigned
short
serverport
{
7911
};
unsigned
char
textfontsize
{
14
};
...
...
@@ -218,6 +219,7 @@ public:
void
RefreshBot
();
void
RefreshLocales
();
void
RefreshLFList
();
void
RefreshServerList
();
void
DrawSelectionLine
(
irr
::
video
::
S3DVertex
*
vec
,
bool
strip
,
int
width
,
float
*
cv
);
void
DrawSelectionLine
(
irr
::
gui
::
IGUIElement
*
element
,
int
width
,
irr
::
video
::
SColor
color
);
void
DrawBackGround
();
...
...
@@ -711,6 +713,11 @@ public:
irr
::
gui
::
IGUIButton
*
btnBigCardZoomIn
;
irr
::
gui
::
IGUIButton
*
btnBigCardZoomOut
;
irr
::
gui
::
IGUIButton
*
btnBigCardClose
;
//server list
irr
::
gui
::
IGUIButton
*
btnServerList
;
irr
::
gui
::
IGUIWindow
*
wServerList
;
irr
::
gui
::
IGUIListBox
*
lstServerList
;
irr
::
gui
::
IGUIButton
*
btnServerReturn
;
#endif //YGOPRO_SERVER_MODE
};
...
...
@@ -953,6 +960,10 @@ extern uint32_t duel_flags;
#define BUTTON_DECK_CODE_SAVE 390
#define BUTTON_DECK_CODE_CANCEL 391
#define BUTTON_SERVER_LIST 392
#define LISTBOX_SERVER_LIST 393
#define BUTTON_SERVER_RETURN 394
#define TEXTURE_DUEL 0
#define TEXTURE_DECK 1
#define TEXTURE_MENU 2
...
...
gframe/menu_handler.cpp
View file @
95ed3727
...
...
@@ -91,6 +91,7 @@ bool MenuHandler::OnEvent(const irr::SEvent& event) {
}
case
BUTTON_JOIN_CANCEL
:
{
mainGame
->
HideElement
(
mainGame
->
wLanWindow
);
mainGame
->
HideElement
(
mainGame
->
wServerList
);
mainGame
->
ShowElement
(
mainGame
->
wMainMenu
);
if
(
exit_on_return
)
mainGame
->
device
->
closeDevice
();
...
...
@@ -104,6 +105,7 @@ bool MenuHandler::OnEvent(const irr::SEvent& event) {
mainGame
->
btnHostConfirm
->
setEnabled
(
true
);
mainGame
->
btnHostCancel
->
setEnabled
(
true
);
mainGame
->
HideElement
(
mainGame
->
wLanWindow
);
mainGame
->
HideElement
(
mainGame
->
wServerList
);
mainGame
->
ShowElement
(
mainGame
->
wCreateHost
);
break
;
}
...
...
@@ -484,6 +486,15 @@ bool MenuHandler::OnEvent(const irr::SEvent& event) {
prev_sel
=
-
1
;
break
;
}
case
BUTTON_SERVER_LIST
:
{
mainGame
->
ShowElement
(
mainGame
->
wServerList
);
mainGame
->
PopupElement
(
mainGame
->
wServerList
);
break
;
}
case
BUTTON_SERVER_RETURN
:
{
mainGame
->
HideElement
(
mainGame
->
wServerList
);
break
;
}
}
break
;
}
...
...
@@ -595,6 +606,13 @@ bool MenuHandler::OnEvent(const irr::SEvent& event) {
mainGame
->
cbBotDeck
->
setVisible
(
mainGame
->
botInfo
[
sel
].
select_deckfile
);
break
;
}
case
LISTBOX_SERVER_LIST
:
{
int
sel
=
mainGame
->
lstServerList
->
getSelected
();
auto
target
=
sel
==
-
1
?
L""
:
dataManager
.
_serverStrings
[
sel
].
second
.
c_str
();
BufferIO
::
CopyWideString
(
target
,
mainGame
->
gameConf
.
lasthost
);
mainGame
->
ebJoinHost
->
setText
(
target
);
break
;
}
}
break
;
}
...
...
servers.conf
0 → 100644
View file @
95ed3727
Koishi
主服|
koishi
.
momobako
.
com
:
7210
Koishi
DL
服|
koishi
.
momobako
.
com
:
7373
Koishi
无禁服|
koishi
.
momobako
.
com
:
2337
万宁游戏王|
koishi
.
momobako
.
com
:
10000
决斗编年史|
dc
.
momobako
.
com
:
2333
233
服|
s1
.
ygo233
.
com
:
233
233
服
2
区|
s2
.
ygo233
.
com
:
233
2333
约战服|
s1
.
ygo233
.
com
:
2333
strings.conf
View file @
95ed3727
...
...
@@ -305,6 +305,7 @@
!
system
1236
规则:
!
system
1237
每回合时间:
!
system
1238
不洗切时回卡组改为回顶端
!
system
1239
服务器列表
!
system
1244
单局模式
!
system
1245
比赛模式
!
system
1246
TAG
...
...
system.conf
View file @
95ed3727
...
...
@@ -2,7 +2,10 @@
#nickname & gamename should be less than 20 characters
use_d3d
=
0
use_image_scale
=
1
use_image_scale_multi_thread
=
1
use_image_load_background_thread
=
0
pro_version
=
4961
freever
=
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