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
xiaoye
ygopro
Commits
2885569d
Commit
2885569d
authored
May 02, 2025
by
nanahira
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'develop' into another-develop
parents
a18289de
cb1ef41e
Changes
18
Hide whitespace changes
Inline
Side-by-side
Showing
18 changed files
with
164 additions
and
89 deletions
+164
-89
.ci/build-opus.sh
.ci/build-opus.sh
+1
-1
.ci/pack-linux-dlc.sh
.ci/pack-linux-dlc.sh
+2
-2
.ci/pack-linux.sh
.ci/pack-linux.sh
+2
-2
.gitlab-ci.yml
.gitlab-ci.yml
+5
-2
cards.cdb
cards.cdb
+0
-0
gframe/config.h
gframe/config.h
+15
-0
gframe/data_manager.cpp
gframe/data_manager.cpp
+2
-4
gframe/deck_manager.cpp
gframe/deck_manager.cpp
+2
-1
gframe/duelclient.cpp
gframe/duelclient.cpp
+3
-9
gframe/event_handler.cpp
gframe/event_handler.cpp
+0
-4
gframe/game.cpp
gframe/game.cpp
+7
-6
gframe/gframe.cpp
gframe/gframe.cpp
+6
-2
gframe/replay.cpp
gframe/replay.cpp
+1
-1
gframe/sound_manager.cpp
gframe/sound_manager.cpp
+36
-40
gframe/sound_manager.h
gframe/sound_manager.h
+8
-8
ocgcore
ocgcore
+1
-1
premake5.lua
premake5.lua
+72
-5
script
script
+1
-1
No files found.
.ci/build-opus.sh
View file @
2885569d
...
@@ -22,7 +22,7 @@ build_single_thing() {
...
@@ -22,7 +22,7 @@ build_single_thing() {
cd
"external/
$lib_name
"
cd
"external/
$lib_name
"
shift
shift
maybe_patch_configure
maybe_patch_configure
PKG_CONFIG_PATH
=
"
$external_built_dir
/lib/pkgconfig"
./configure
--prefix
=
"
$external_built_dir
"
--enable-static
=
yes
--enable-shared
=
no
"
$@
"
PKG_CONFIG_PATH
=
"
$external_built_dir
/lib/pkgconfig"
CFLAGS
=
"
$OPUS_FLAGS
"
CXXFLAGS
=
"
$OPUS_FLAGS
"
./configure
--prefix
=
"
$external_built_dir
"
--enable-static
=
yes
--enable-shared
=
no
"
$@
"
make
-j
$(
nproc
)
make
-j
$(
nproc
)
make
install
make
install
cd
../..
cd
../..
...
...
.ci/pack-linux-dlc.sh
View file @
2885569d
...
@@ -8,9 +8,9 @@ if [[ -z "$TARGET_PLATFORM" ]]; then
...
@@ -8,9 +8,9 @@ if [[ -z "$TARGET_PLATFORM" ]]; then
TARGET_PLATFORM
=
linux
TARGET_PLATFORM
=
linux
fi
fi
if
[[
"
$TARGET_PLATFORM
"
!=
"linuxarm"
]]
;
then
#
if [[ "$TARGET_PLATFORM" != "linuxarm" ]]; then
ARCHIVE_FILES+
=(
sound
)
ARCHIVE_FILES+
=(
sound
)
fi
#
fi
apt update
&&
apt
-y
install tar
zstd
apt update
&&
apt
-y
install tar
zstd
mkdir
dist replay
mkdir
dist replay
...
...
.ci/pack-linux.sh
View file @
2885569d
...
@@ -10,9 +10,9 @@ if [[ -z "$TARGET_PLATFORM" ]]; then
...
@@ -10,9 +10,9 @@ if [[ -z "$TARGET_PLATFORM" ]]; then
TARGET_PLATFORM
=
linux
TARGET_PLATFORM
=
linux
fi
fi
if
[[
"
$TARGET_PLATFORM
"
!=
"linuxarm"
]]
;
then
#
if [[ "$TARGET_PLATFORM" != "linuxarm" ]]; then
ARCHIVE_FILES+
=(
sound
)
ARCHIVE_FILES+
=(
sound
)
fi
#
fi
apt update
&&
apt
-y
install tar
git zstd
apt update
&&
apt
-y
install tar
git zstd
mkdir
dist replay
mkdir
dist replay
...
...
.gitlab-ci.yml
View file @
2885569d
...
@@ -162,6 +162,9 @@ exec_linuxarm:
...
@@ -162,6 +162,9 @@ exec_linuxarm:
extends
:
.exec_linux
extends
:
.exec_linux
tags
:
tags
:
-
arm
-
arm
variables
:
OPUS_FLAGS
:
'
-fPIC'
# force position independent code for arm
image
:
git-registry.moenext.com/mycard/docker-ygopro-builder:fpic
# use a special docker image for arm build, which has fPIC enabled by default
._exec_macos_platform
:
._exec_macos_platform
:
extends
:
._exec_build
extends
:
._exec_build
...
@@ -185,8 +188,8 @@ exec_macos_platform_m1:
...
@@ -185,8 +188,8 @@ exec_macos_platform_m1:
extends
:
._exec_macos_platform
extends
:
._exec_macos_platform
tags
:
tags
:
-
macos-m1
-
macos-m1
variables
:
#
variables:
MAC_ARM
:
1
#
MAC_ARM: 1
exec_macos
:
exec_macos
:
stage
:
combine
stage
:
combine
...
...
cards.cdb
View file @
2885569d
No preview for this file type
gframe/config.h
View file @
2885569d
...
@@ -79,6 +79,21 @@ inline FILE* mywfopen(const wchar_t* filename, const char* mode) {
...
@@ -79,6 +79,21 @@ inline FILE* mywfopen(const wchar_t* filename, const char* mode) {
return
fp
;
return
fp
;
}
}
#if !defined(_WIN32)
#define myfopen std::fopen
#elif defined(WDK_NTDDI_VERSION) && (WDK_NTDDI_VERSION >= 0x0A000005) // Redstone 4, Version 1803, Build 17134.
#define FOPEN_WINDOWS_SUPPORT_UTF8
#define myfopen std::fopen
#else
inline
FILE
*
myfopen
(
const
char
*
filename
,
const
char
*
mode
)
{
wchar_t
wfilename
[
256
]{};
BufferIO
::
DecodeUTF8
(
filename
,
wfilename
);
wchar_t
wmode
[
20
]{};
BufferIO
::
CopyCharArray
(
mode
,
wmode
);
return
_wfopen
(
wfilename
,
wmode
);
}
#endif
#include <irrlicht.h>
#include <irrlicht.h>
extern
unsigned
short
PRO_VERSION
;
extern
unsigned
short
PRO_VERSION
;
...
...
gframe/data_manager.cpp
View file @
2885569d
...
@@ -108,7 +108,7 @@ bool DataManager::LoadDB(const wchar_t* wfile) {
...
@@ -108,7 +108,7 @@ bool DataManager::LoadDB(const wchar_t* wfile) {
return
ret
;
return
ret
;
}
}
bool
DataManager
::
LoadStrings
(
const
char
*
file
)
{
bool
DataManager
::
LoadStrings
(
const
char
*
file
)
{
FILE
*
fp
=
std
::
fopen
(
file
,
"r"
);
FILE
*
fp
=
my
fopen
(
file
,
"r"
);
if
(
!
fp
)
if
(
!
fp
)
return
false
;
return
false
;
char
linebuf
[
TEXT_LINE_SIZE
]{};
char
linebuf
[
TEXT_LINE_SIZE
]{};
...
@@ -437,9 +437,7 @@ unsigned char* DataManager::ReadScriptFromIrrFS(const char* script_name, int* sl
...
@@ -437,9 +437,7 @@ unsigned char* DataManager::ReadScriptFromIrrFS(const char* script_name, int* sl
return
scriptBuffer
;
return
scriptBuffer
;
}
}
unsigned
char
*
DataManager
::
ReadScriptFromFile
(
const
char
*
script_name
,
int
*
slen
)
{
unsigned
char
*
DataManager
::
ReadScriptFromFile
(
const
char
*
script_name
,
int
*
slen
)
{
wchar_t
fname
[
256
]{};
FILE
*
fp
=
myfopen
(
script_name
,
"rb"
);
BufferIO
::
DecodeUTF8
(
script_name
,
fname
);
FILE
*
fp
=
mywfopen
(
fname
,
"rb"
);
if
(
!
fp
)
if
(
!
fp
)
return
nullptr
;
return
nullptr
;
size_t
len
=
std
::
fread
(
scriptBuffer
,
1
,
sizeof
scriptBuffer
,
fp
);
size_t
len
=
std
::
fread
(
scriptBuffer
,
1
,
sizeof
scriptBuffer
,
fp
);
...
...
gframe/deck_manager.cpp
View file @
2885569d
...
@@ -11,7 +11,7 @@ DeckManager deckManager;
...
@@ -11,7 +11,7 @@ DeckManager deckManager;
void
DeckManager
::
LoadLFListSingle
(
const
char
*
path
)
{
void
DeckManager
::
LoadLFListSingle
(
const
char
*
path
)
{
auto
cur
=
_lfList
.
rend
();
auto
cur
=
_lfList
.
rend
();
FILE
*
fp
=
std
::
fopen
(
path
,
"r"
);
FILE
*
fp
=
my
fopen
(
path
,
"r"
);
char
linebuf
[
256
]{};
char
linebuf
[
256
]{};
wchar_t
strBuffer
[
256
]{};
wchar_t
strBuffer
[
256
]{};
if
(
fp
)
{
if
(
fp
)
{
...
@@ -45,6 +45,7 @@ void DeckManager::LoadLFListSingle(const char* path) {
...
@@ -45,6 +45,7 @@ void DeckManager::LoadLFListSingle(const char* path) {
}
}
void
DeckManager
::
LoadLFList
()
{
void
DeckManager
::
LoadLFList
()
{
LoadLFListSingle
(
"expansions/lflist.conf"
);
LoadLFListSingle
(
"expansions/lflist.conf"
);
LoadLFListSingle
(
"specials/lflist.conf"
);
LoadLFListSingle
(
"lflist.conf"
);
LoadLFListSingle
(
"lflist.conf"
);
LFList
nolimit
;
LFList
nolimit
;
nolimit
.
listName
=
L"N/A"
;
nolimit
.
listName
=
L"N/A"
;
...
...
gframe/duelclient.cpp
View file @
2885569d
...
@@ -1366,10 +1366,8 @@ bool DuelClient::ClientAnalyze(unsigned char* msg, int len) {
...
@@ -1366,10 +1366,8 @@ bool DuelClient::ClientAnalyze(unsigned char* msg, int len) {
//playing custom bgm
//playing custom bgm
case
21
:
{
//HINT_MUSIC
case
21
:
{
//HINT_MUSIC
if
(
data
)
{
if
(
data
)
{
char
textBufferU
[
1024
];
myswprintf
(
textBuffer
,
L"./sound/BGM/custom/%ls.mp3"
,
dataManager
.
GetDesc
(
data
));
myswprintf
(
textBuffer
,
L"./sound/BGM/custom/%ls.mp3"
,
dataManager
.
GetDesc
(
data
));
BufferIO
::
EncodeUTF8
(
textBuffer
,
textBufferU
);
soundManager
.
PlayCustomBGM
(
textBuffer
);
soundManager
.
PlayCustomBGM
(
textBufferU
);
}
else
{
}
else
{
soundManager
.
StopBGM
();
soundManager
.
StopBGM
();
}
}
...
@@ -1378,10 +1376,8 @@ bool DuelClient::ClientAnalyze(unsigned char* msg, int len) {
...
@@ -1378,10 +1376,8 @@ bool DuelClient::ClientAnalyze(unsigned char* msg, int len) {
//playing custom sound effect
//playing custom sound effect
case
22
:
{
//HINT_SOUND
case
22
:
{
//HINT_SOUND
if
(
data
)
{
if
(
data
)
{
char
textBufferU
[
1024
];
myswprintf
(
textBuffer
,
L"./sound/custom/%ls.wav"
,
dataManager
.
GetDesc
(
data
));
myswprintf
(
textBuffer
,
L"./sound/custom/%ls.wav"
,
dataManager
.
GetDesc
(
data
));
BufferIO
::
EncodeUTF8
(
textBuffer
,
textBufferU
);
soundManager
.
PlayCustomSound
(
textBuffer
);
soundManager
.
PlayCustomSound
(
textBufferU
);
}
else
{
}
else
{
soundManager
.
StopSound
();
soundManager
.
StopSound
();
}
}
...
@@ -1390,10 +1386,8 @@ bool DuelClient::ClientAnalyze(unsigned char* msg, int len) {
...
@@ -1390,10 +1386,8 @@ bool DuelClient::ClientAnalyze(unsigned char* msg, int len) {
//playing custom bgm in ogg format
//playing custom bgm in ogg format
case
23
:
{
//HINT_MUSIC_OGG
case
23
:
{
//HINT_MUSIC_OGG
if
(
data
)
{
if
(
data
)
{
char
textBufferU
[
1024
];
myswprintf
(
textBuffer
,
L"./sound/BGM/custom/%ls.ogg"
,
dataManager
.
GetDesc
(
data
));
myswprintf
(
textBuffer
,
L"./sound/BGM/custom/%ls.ogg"
,
dataManager
.
GetDesc
(
data
));
BufferIO
::
EncodeUTF8
(
textBuffer
,
textBufferU
);
soundManager
.
PlayCustomBGM
(
textBuffer
);
soundManager
.
PlayCustomBGM
(
textBufferU
);
}
else
{
}
else
{
soundManager
.
StopBGM
();
soundManager
.
StopBGM
();
}
}
...
...
gframe/event_handler.cpp
View file @
2885569d
...
@@ -1934,7 +1934,6 @@ bool ClientField::OnCommonEvent(const irr::SEvent& event) {
...
@@ -1934,7 +1934,6 @@ bool ClientField::OnCommonEvent(const irr::SEvent& event) {
return
true
;
return
true
;
break
;
break
;
}
}
#ifdef YGOPRO_USE_AUDIO
case
CHECKBOX_ENABLE_MUSIC
:
{
case
CHECKBOX_ENABLE_MUSIC
:
{
if
(
!
mainGame
->
chkEnableMusic
->
isChecked
())
if
(
!
mainGame
->
chkEnableMusic
->
isChecked
())
soundManager
.
StopBGM
();
soundManager
.
StopBGM
();
...
@@ -1947,7 +1946,6 @@ bool ClientField::OnCommonEvent(const irr::SEvent& event) {
...
@@ -1947,7 +1946,6 @@ bool ClientField::OnCommonEvent(const irr::SEvent& event) {
return
true
;
return
true
;
break
;
break
;
}
}
#endif
case
CHECKBOX_DISABLE_CHAT
:
{
case
CHECKBOX_DISABLE_CHAT
:
{
bool
show
=
(
mainGame
->
is_building
&&
!
mainGame
->
is_siding
)
?
false
:
true
;
bool
show
=
(
mainGame
->
is_building
&&
!
mainGame
->
is_siding
)
?
false
:
true
;
mainGame
->
wChat
->
setVisible
(
show
);
mainGame
->
wChat
->
setVisible
(
show
);
...
@@ -2053,7 +2051,6 @@ bool ClientField::OnCommonEvent(const irr::SEvent& event) {
...
@@ -2053,7 +2051,6 @@ bool ClientField::OnCommonEvent(const irr::SEvent& event) {
return
true
;
return
true
;
break
;
break
;
}
}
#ifdef YGOPRO_USE_AUDIO
case
SCROLL_VOLUME
:
{
case
SCROLL_VOLUME
:
{
mainGame
->
gameConf
.
sound_volume
=
(
double
)
mainGame
->
scrSoundVolume
->
getPos
()
/
100
;
mainGame
->
gameConf
.
sound_volume
=
(
double
)
mainGame
->
scrSoundVolume
->
getPos
()
/
100
;
mainGame
->
gameConf
.
music_volume
=
(
double
)
mainGame
->
scrMusicVolume
->
getPos
()
/
100
;
mainGame
->
gameConf
.
music_volume
=
(
double
)
mainGame
->
scrMusicVolume
->
getPos
()
/
100
;
...
@@ -2062,7 +2059,6 @@ bool ClientField::OnCommonEvent(const irr::SEvent& event) {
...
@@ -2062,7 +2059,6 @@ bool ClientField::OnCommonEvent(const irr::SEvent& event) {
return
true
;
return
true
;
break
;
break
;
}
}
#endif
case
SCROLL_TAB_HELPER
:
{
case
SCROLL_TAB_HELPER
:
{
irr
::
core
::
rect
<
irr
::
s32
>
pos
=
mainGame
->
tabHelper
->
getRelativePosition
();
irr
::
core
::
rect
<
irr
::
s32
>
pos
=
mainGame
->
tabHelper
->
getRelativePosition
();
mainGame
->
tabHelper
->
setRelativePosition
(
irr
::
core
::
recti
(
0
,
mainGame
->
scrTabHelper
->
getPos
()
*
-
1
,
pos
.
LowerRightCorner
.
X
,
pos
.
LowerRightCorner
.
Y
));
mainGame
->
tabHelper
->
setRelativePosition
(
irr
::
core
::
recti
(
0
,
mainGame
->
scrTabHelper
->
getPos
()
*
-
1
,
pos
.
LowerRightCorner
.
X
,
pos
.
LowerRightCorner
.
Y
));
...
...
gframe/game.cpp
View file @
2885569d
...
@@ -141,6 +141,7 @@ bool Game::Initialize() {
...
@@ -141,6 +141,7 @@ bool Game::Initialize() {
return
false
;
return
false
;
}
}
LoadExpansions
();
LoadExpansions
();
dataManager
.
LoadDB
(
L"specials/special.cdb"
);
env
=
device
->
getGUIEnvironment
();
env
=
device
->
getGUIEnvironment
();
numFont
=
irr
::
gui
::
CGUITTFont
::
createTTFont
(
env
,
gameConf
.
numfont
,
16
);
numFont
=
irr
::
gui
::
CGUITTFont
::
createTTFont
(
env
,
gameConf
.
numfont
,
16
);
if
(
!
numFont
)
{
if
(
!
numFont
)
{
...
@@ -1397,9 +1398,9 @@ void Game::RefreshBot() {
...
@@ -1397,9 +1398,9 @@ void Game::RefreshBot() {
if
(
!
gameConf
.
enable_bot_mode
)
if
(
!
gameConf
.
enable_bot_mode
)
return
;
return
;
botInfo
.
clear
();
botInfo
.
clear
();
FILE
*
fp
=
std
::
fopen
(
GetLocaleDir
(
"bot.conf"
),
"r"
);
FILE
*
fp
=
my
fopen
(
GetLocaleDir
(
"bot.conf"
),
"r"
);
if
(
!
fp
)
if
(
!
fp
)
fp
=
std
::
fopen
(
"bot.conf"
,
"r"
);
fp
=
my
fopen
(
"bot.conf"
,
"r"
);
char
linebuf
[
256
]{};
char
linebuf
[
256
]{};
char
strbuf
[
256
]{};
char
strbuf
[
256
]{};
if
(
fp
)
{
if
(
fp
)
{
...
@@ -1460,7 +1461,7 @@ void Game::RefreshBot() {
...
@@ -1460,7 +1461,7 @@ void Game::RefreshBot() {
}
}
}
}
bool
Game
::
LoadConfigFromFile
(
const
char
*
file
)
{
bool
Game
::
LoadConfigFromFile
(
const
char
*
file
)
{
FILE
*
fp
=
std
::
fopen
(
file
,
"r"
);
FILE
*
fp
=
my
fopen
(
file
,
"r"
);
if
(
!
fp
){
if
(
!
fp
){
return
false
;
return
false
;
}
}
...
@@ -1733,9 +1734,9 @@ void Game::LoadConfig() {
...
@@ -1733,9 +1734,9 @@ void Game::LoadConfig() {
}
}
void
Game
::
SaveConfig
()
{
void
Game
::
SaveConfig
()
{
#ifdef YGOPRO_COMPAT_MYCARD
#ifdef YGOPRO_COMPAT_MYCARD
FILE
*
fp
=
std
::
fopen
(
"system.conf"
,
"w"
);
FILE
*
fp
=
my
fopen
(
"system.conf"
,
"w"
);
#else
#else
FILE
*
fp
=
std
::
fopen
(
"system_user.conf"
,
"w"
);
FILE
*
fp
=
my
fopen
(
"system_user.conf"
,
"w"
);
#endif //YGOPRO_COMPAT_MYCARD
#endif //YGOPRO_COMPAT_MYCARD
std
::
fprintf
(
fp
,
"#config file
\n
#nickname & gamename should be less than 20 characters
\n
"
);
std
::
fprintf
(
fp
,
"#config file
\n
#nickname & gamename should be less than 20 characters
\n
"
);
char
linebuf
[
CONFIG_LINE_SIZE
];
char
linebuf
[
CONFIG_LINE_SIZE
];
...
@@ -2001,7 +2002,7 @@ void Game::AddDebugMsg(const char* msg) {
...
@@ -2001,7 +2002,7 @@ void Game::AddDebugMsg(const char* msg) {
}
}
}
}
void
Game
::
ErrorLog
(
const
char
*
msg
)
{
void
Game
::
ErrorLog
(
const
char
*
msg
)
{
FILE
*
fp
=
std
::
fopen
(
"error.log"
,
"a"
);
FILE
*
fp
=
my
fopen
(
"error.log"
,
"a"
);
if
(
!
fp
)
if
(
!
fp
)
return
;
return
;
time_t
nowtime
=
std
::
time
(
nullptr
);
time_t
nowtime
=
std
::
time
(
nullptr
);
...
...
gframe/gframe.cpp
View file @
2885569d
...
@@ -29,8 +29,12 @@ void ClickButton(irr::gui::IGUIElement* btn) {
...
@@ -29,8 +29,12 @@ void ClickButton(irr::gui::IGUIElement* btn) {
}
}
int
main
(
int
argc
,
char
*
argv
[])
{
int
main
(
int
argc
,
char
*
argv
[])
{
#ifndef _WIN32
#if defined(FOPEN_WINDOWS_SUPPORT_UTF8)
std
::
setlocale
(
LC_CTYPE
,
"UTF-8"
);
std
::
setlocale
(
LC_CTYPE
,
".UTF-8"
);
#elif defined(__APPLE__)
std
::
setlocale
(
LC_CTYPE
,
"C.UTF-8"
);
#elif !defined(_WIN32)
std
::
setlocale
(
LC_CTYPE
,
""
);
#endif
#endif
#ifdef __APPLE__
#ifdef __APPLE__
CFURLRef
bundle_url
=
CFBundleCopyBundleURL
(
CFBundleGetMainBundle
());
CFURLRef
bundle_url
=
CFBundleCopyBundleURL
(
CFBundleGetMainBundle
());
...
...
gframe/replay.cpp
View file @
2885569d
...
@@ -25,7 +25,7 @@ void Replay::BeginRecord() {
...
@@ -25,7 +25,7 @@ void Replay::BeginRecord() {
#else
#else
if
(
is_recording
)
if
(
is_recording
)
std
::
fclose
(
fp
);
std
::
fclose
(
fp
);
fp
=
std
::
fopen
(
"./replay/_LastReplay.yrp"
,
"wb"
);
fp
=
my
fopen
(
"./replay/_LastReplay.yrp"
,
"wb"
);
if
(
!
fp
)
if
(
!
fp
)
return
;
return
;
#endif
#endif
...
...
gframe/sound_manager.cpp
View file @
2885569d
...
@@ -85,7 +85,7 @@ void SoundManager::RefershBGMDir(std::wstring path, int scene) {
...
@@ -85,7 +85,7 @@ void SoundManager::RefershBGMDir(std::wstring path, int scene) {
}
}
});
});
}
}
void
SoundManager
::
PlaySound
(
char
*
sound
)
{
void
SoundManager
::
PlaySound
(
wchar_t
*
sound
)
{
#ifdef YGOPRO_USE_AUDIO
#ifdef YGOPRO_USE_AUDIO
if
(
!
mainGame
->
chkEnableSound
->
isChecked
())
if
(
!
mainGame
->
chkEnableSound
->
isChecked
())
return
;
return
;
...
@@ -111,17 +111,13 @@ void SoundManager::PlaySound(char* sound) {
...
@@ -111,17 +111,13 @@ void SoundManager::PlaySound(char* sound) {
usingSoundEffectPointer
=
playingSoundEffect
[
0
];
usingSoundEffectPointer
=
playingSoundEffect
[
0
];
ma_sound_uninit
(
usingSoundEffectPointer
);
ma_sound_uninit
(
usingSoundEffectPointer
);
}
}
#ifdef _WIN32
ma_sound_init_from_file_w
(
&
engineSound
,
sound
,
MA_SOUND_FLAG_ASYNC
|
MA_SOUND_FLAG_STREAM
,
nullptr
,
nullptr
,
usingSoundEffectPointer
);
wchar_t
sound_w
[
1024
];
BufferIO
::
DecodeUTF8
(
sound
,
sound_w
);
ma_sound_init_from_file_w
(
&
engineSound
,
sound_w
,
MA_SOUND_FLAG_ASYNC
|
MA_SOUND_FLAG_STREAM
,
nullptr
,
nullptr
,
usingSoundEffectPointer
);
#else
ma_sound_init_from_file
(
&
engineSound
,
sound
,
MA_SOUND_FLAG_ASYNC
|
MA_SOUND_FLAG_STREAM
,
nullptr
,
nullptr
,
usingSoundEffectPointer
);
#endif
ma_sound_start
(
usingSoundEffectPointer
);
ma_sound_start
(
usingSoundEffectPointer
);
#endif
#endif
#ifdef YGOPRO_USE_IRRKLANG
#ifdef YGOPRO_USE_IRRKLANG
engineSound
->
play2D
(
soundPath
);
char
csound
[
1024
];
BufferIO
::
EncodeUTF8
(
sound
,
csound
);
engineSound
->
play2D
(
csound
);
#endif
#endif
#endif
#endif
}
}
...
@@ -257,15 +253,14 @@ void SoundManager::PlaySoundEffect(int sound) {
...
@@ -257,15 +253,14 @@ void SoundManager::PlaySoundEffect(int sound) {
}
}
if
(
mainGame
->
soundSequenceFile
)
if
(
mainGame
->
soundSequenceFile
)
fprintf
(
mainGame
->
soundSequenceFile
,
"%llu %s
\n
"
,
mainGame
->
totalFrame
,
soundName
);
fprintf
(
mainGame
->
soundSequenceFile
,
"%llu %s
\n
"
,
mainGame
->
totalFrame
,
soundName
);
if
(
!
mainGame
->
chkEnableSound
->
isChecked
())
return
;
#ifdef YGOPRO_USE_AUDIO
#ifdef YGOPRO_USE_AUDIO
char
soundPath
[
40
];
wchar_t
soundPathW
[
40
];
std
::
snprintf
(
soundPath
,
40
,
"./sound/%s.wav"
,
soundName
);
myswprintf
(
soundPathW
,
L
"./sound/%s.wav"
,
soundName
);
PlaySound
(
soundPath
);
PlaySound
(
soundPath
W
);
#endif // YGOPRO_USE_AUDIO
#endif // YGOPRO_USE_AUDIO
}
}
void
SoundManager
::
PlayDialogSound
(
irr
::
gui
::
IGUIElement
*
element
)
{
void
SoundManager
::
PlayDialogSound
(
irr
::
gui
::
IGUIElement
*
element
)
{
#ifdef YGOPRO_USE_AUDIO
if
(
element
==
mainGame
->
wMessage
)
{
if
(
element
==
mainGame
->
wMessage
)
{
PlaySoundEffect
(
SOUND_INFO
);
PlaySoundEffect
(
SOUND_INFO
);
}
else
if
(
element
==
mainGame
->
wQuery
)
{
}
else
if
(
element
==
mainGame
->
wQuery
)
{
...
@@ -287,37 +282,44 @@ void SoundManager::PlayDialogSound(irr::gui::IGUIElement * element) {
...
@@ -287,37 +282,44 @@ void SoundManager::PlayDialogSound(irr::gui::IGUIElement * element) {
}
else
if
(
element
==
mainGame
->
wFTSelect
)
{
}
else
if
(
element
==
mainGame
->
wFTSelect
)
{
PlaySoundEffect
(
SOUND_QUESTION
);
PlaySoundEffect
(
SOUND_QUESTION
);
}
}
#endif // YGOPRO_USE_AUDIO
}
}
bool
SoundManager
::
Is
CurrentlyPlaying
(
char
*
song
)
{
bool
SoundManager
::
Is
PlayingMusic
(
wchar_t
*
music
)
{
#ifdef YGOPRO_USE_MINIAUDIO
#ifdef YGOPRO_USE_MINIAUDIO
return
currentPlayingMusic
[
0
]
&&
strcmp
(
currentPlayingMusic
,
song
)
==
0
&&
ma_sound_is_playing
(
&
soundBGM
);
if
(
music
)
{
return
!
mywcsncasecmp
(
currentPlayingMusic
,
music
,
1024
)
&&
ma_sound_is_playing
(
&
soundBGM
);
}
else
{
return
ma_sound_is_playing
(
&
soundBGM
);
}
#endif
#endif
#ifdef YGOPRO_USE_IRRKLANG
#ifdef YGOPRO_USE_IRRKLANG
return
engineMusic
->
isCurrentlyPlaying
(
song
);
if
(
music
)
{
char
cmusic
[
1024
];
BufferIO
::
EncodeUTF8
(
music
,
cmusic
);
return
engineMusic
->
isCurrentlyPlaying
(
cmusic
);
}
else
{
return
soundBGM
&&
!
soundBGM
->
isFinished
();
}
#endif
#endif
return
false
;
return
false
;
}
}
void
SoundManager
::
PlayMusic
(
char
*
song
,
bool
loop
)
{
void
SoundManager
::
PlayMusic
(
wchar_t
*
music
,
bool
loop
)
{
#ifdef YGOPRO_USE_AUDIO
#ifdef YGOPRO_USE_AUDIO
if
(
!
mainGame
->
chkEnableMusic
->
isChecked
())
if
(
!
mainGame
->
chkEnableMusic
->
isChecked
())
return
;
return
;
if
(
!
Is
CurrentlyPlaying
(
song
))
{
if
(
!
Is
PlayingMusic
(
music
))
{
StopBGM
();
StopBGM
();
SetMusicVolume
(
mainGame
->
gameConf
.
music_volume
);
SetMusicVolume
(
mainGame
->
gameConf
.
music_volume
);
#ifdef YGOPRO_USE_MINIAUDIO
#ifdef YGOPRO_USE_MINIAUDIO
strcpy
(
currentPlayingMusic
,
song
);
BufferIO
::
CopyWStr
(
music
,
currentPlayingMusic
,
1024
);
#ifdef _WIN32
ma_sound_init_from_file_w
(
&
engineMusic
,
music
,
MA_SOUND_FLAG_ASYNC
|
MA_SOUND_FLAG_STREAM
,
nullptr
,
nullptr
,
&
soundBGM
);
wchar_t
song_w
[
1024
];
BufferIO
::
DecodeUTF8
(
song
,
song_w
);
ma_sound_init_from_file_w
(
&
engineMusic
,
song_w
,
MA_SOUND_FLAG_ASYNC
|
MA_SOUND_FLAG_STREAM
,
nullptr
,
nullptr
,
&
soundBGM
);
#else
ma_sound_init_from_file
(
&
engineMusic
,
song
,
MA_SOUND_FLAG_ASYNC
|
MA_SOUND_FLAG_STREAM
,
nullptr
,
nullptr
,
&
soundBGM
);
#endif
ma_sound_set_looping
(
&
soundBGM
,
loop
);
ma_sound_set_looping
(
&
soundBGM
,
loop
);
ma_sound_start
(
&
soundBGM
);
ma_sound_start
(
&
soundBGM
);
#endif
#endif
#ifdef YGOPRO_USE_IRRKLANG
#ifdef YGOPRO_USE_IRRKLANG
soundBGM
=
engineMusic
->
play2D
(
song
,
loop
,
false
,
true
);
char
cmusic
[
1024
];
BufferIO
::
EncodeUTF8
(
music
,
cmusic
);
soundBGM
=
engineMusic
->
play2D
(
cmusic
,
loop
,
false
,
true
);
#endif
#endif
}
}
#endif
#endif
...
@@ -328,28 +330,22 @@ void SoundManager::PlayBGM(int scene) {
...
@@ -328,28 +330,22 @@ void SoundManager::PlayBGM(int scene) {
return
;
return
;
if
(
!
mainGame
->
chkMusicMode
->
isChecked
())
if
(
!
mainGame
->
chkMusicMode
->
isChecked
())
scene
=
BGM_ALL
;
scene
=
BGM_ALL
;
char
BGMName
[
1024
];
if
((
scene
!=
bgm_scene
)
&&
(
bgm_scene
!=
BGM_CUSTOM
)
||
(
scene
!=
previous_bgm_scene
)
&&
(
bgm_scene
==
BGM_CUSTOM
)
||
!
IsPlayingMusic
())
{
#if defined(YGOPRO_USE_MINIAUDIO)
if
((
scene
!=
bgm_scene
)
&&
(
bgm_scene
!=
BGM_CUSTOM
)
||
(
scene
!=
previous_bgm_scene
)
&&
(
bgm_scene
==
BGM_CUSTOM
)
||
!
IsCurrentlyPlaying
(
currentPlayingMusic
))
{
#elif defined(YGOPRO_USE_IRRKLANG)
if
((
scene
!=
bgm_scene
)
&&
(
bgm_scene
!=
BGM_CUSTOM
)
||
(
scene
!=
previous_bgm_scene
)
&&
(
bgm_scene
==
BGM_CUSTOM
)
||
(
soundBGM
&&
soundBGM
->
isFinished
()))
{
#endif
int
count
=
BGMList
[
scene
].
size
();
int
count
=
BGMList
[
scene
].
size
();
if
(
count
<=
0
)
if
(
count
<=
0
)
return
;
return
;
bgm_scene
=
scene
;
bgm_scene
=
scene
;
int
bgm
=
rnd
.
get_random_integer
(
0
,
count
-
1
);
int
bgm
=
rnd
.
get_random_integer
(
0
,
count
-
1
);
auto
name
=
BGMList
[
scene
][
bgm
].
c_str
();
auto
name
=
BGMList
[
scene
][
bgm
].
c_str
();
wchar_t
fname
[
1024
];
wchar_t
BGMName
[
1024
];
myswprintf
(
fname
,
L"./sound/BGM/%ls"
,
name
);
myswprintf
(
BGMName
,
L"./sound/BGM/%ls"
,
name
);
BufferIO
::
EncodeUTF8
(
fname
,
BGMName
);
PlayMusic
(
BGMName
,
false
);
PlayMusic
(
BGMName
,
false
);
}
}
#endif
#endif
}
}
void
SoundManager
::
PlayCustomBGM
(
char
*
BGMName
)
{
void
SoundManager
::
PlayCustomBGM
(
wchar_t
*
BGMName
)
{
#ifdef YGOPRO_USE_AUDIO
#ifdef YGOPRO_USE_AUDIO
if
(
!
mainGame
->
chkEnableMusic
->
isChecked
()
||
!
mainGame
->
chkMusicMode
->
isChecked
()
||
bgm_process
||
Is
CurrentlyPlaying
(
BGMName
))
if
(
!
mainGame
->
chkEnableMusic
->
isChecked
()
||
!
mainGame
->
chkMusicMode
->
isChecked
()
||
bgm_process
||
Is
PlayingMusic
(
BGMName
))
return
;
return
;
bgm_process
=
true
;
bgm_process
=
true
;
int
pscene
=
bgm_scene
;
int
pscene
=
bgm_scene
;
...
@@ -360,7 +356,7 @@ void SoundManager::PlayCustomBGM(char* BGMName) {
...
@@ -360,7 +356,7 @@ void SoundManager::PlayCustomBGM(char* BGMName) {
bgm_process
=
false
;
bgm_process
=
false
;
#endif
#endif
}
}
void
SoundManager
::
PlayCustomSound
(
char
*
SoundName
)
{
void
SoundManager
::
PlayCustomSound
(
wchar_t
*
SoundName
)
{
PlaySound
(
SoundName
);
PlaySound
(
SoundName
);
}
}
void
SoundManager
::
StopBGM
()
{
void
SoundManager
::
StopBGM
()
{
...
...
gframe/sound_manager.h
View file @
2885569d
...
@@ -15,8 +15,8 @@ namespace ygo {
...
@@ -15,8 +15,8 @@ namespace ygo {
class
SoundManager
{
class
SoundManager
{
private:
private:
std
::
vector
<
std
::
wstring
>
BGMList
[
9
];
std
::
vector
<
std
::
wstring
>
BGMList
[
9
];
int
bgm_scene
;
int
bgm_scene
{}
;
int
previous_bgm_scene
;
int
previous_bgm_scene
{}
;
bool
bgm_process
;
bool
bgm_process
;
mt19937
rnd
;
mt19937
rnd
;
#ifdef YGOPRO_USE_MINIAUDIO
#ifdef YGOPRO_USE_MINIAUDIO
...
@@ -28,7 +28,7 @@ private:
...
@@ -28,7 +28,7 @@ private:
ma_engine
engineSound
;
ma_engine
engineSound
;
ma_engine
engineMusic
;
ma_engine
engineMusic
;
ma_sound
soundBGM
;
ma_sound
soundBGM
;
char
currentPlayingMusic
[
1024
]{};
wchar_t
currentPlayingMusic
[
1024
]{};
ma_sound
*
playingSoundEffect
[
10
]{};
ma_sound
*
playingSoundEffect
[
10
]{};
#endif
#endif
#ifdef YGOPRO_USE_IRRKLANG
#ifdef YGOPRO_USE_IRRKLANG
...
@@ -41,14 +41,14 @@ private:
...
@@ -41,14 +41,14 @@ private:
public:
public:
bool
Init
();
bool
Init
();
void
RefreshBGMList
();
void
RefreshBGMList
();
void
PlaySound
(
char
*
sound
);
void
PlaySound
(
wchar_t
*
sound
);
void
PlaySoundEffect
(
int
sound
);
void
PlaySoundEffect
(
int
sound
);
void
PlayDialogSound
(
irr
::
gui
::
IGUIElement
*
element
);
void
PlayDialogSound
(
irr
::
gui
::
IGUIElement
*
element
);
bool
Is
CurrentlyPlaying
(
char
*
song
);
bool
Is
PlayingMusic
(
wchar_t
*
music
=
0
);
void
PlayMusic
(
char
*
song
,
bool
loop
);
void
PlayMusic
(
wchar_t
*
music
,
bool
loop
);
void
PlayBGM
(
int
scene
);
void
PlayBGM
(
int
scene
);
void
PlayCustomBGM
(
char
*
BGMName
);
void
PlayCustomBGM
(
wchar_t
*
BGMName
);
void
PlayCustomSound
(
char
*
SoundName
);
void
PlayCustomSound
(
wchar_t
*
SoundName
);
void
StopBGM
();
void
StopBGM
();
void
StopSound
();
void
StopSound
();
void
SetSoundVolume
(
double
volume
);
void
SetSoundVolume
(
double
volume
);
...
...
ocgcore
@
8c8f4a9c
Subproject commit
ca5bd0f5e1b4113d7e046d8228b70fc2281d08eb
Subproject commit
8c8f4a9ca3f2844fe537ec7577af6d2e4dfcc711
premake5.lua
View file @
2885569d
...
@@ -100,6 +100,7 @@ boolOptions = {
...
@@ -100,6 +100,7 @@ boolOptions = {
"no-lua-safe"
,
"no-lua-safe"
,
"message-debug"
,
"message-debug"
,
"no-side-check"
,
"no-side-check"
,
"log-lua-memory-size"
,
}
}
for
_
,
boolOption
in
ipairs
(
boolOptions
)
do
for
_
,
boolOption
in
ipairs
(
boolOptions
)
do
...
@@ -112,6 +113,7 @@ numberOptions = {
...
@@ -112,6 +113,7 @@ numberOptions = {
"min-deck"
,
"min-deck"
,
"max-extra"
,
"max-extra"
,
"max-side"
,
"max-side"
,
"lua-memory-size"
,
}
}
for
_
,
numberOption
in
ipairs
(
numberOptions
)
do
for
_
,
numberOption
in
ipairs
(
numberOptions
)
do
...
@@ -269,13 +271,70 @@ end
...
@@ -269,13 +271,70 @@ end
if
GetParam
(
"winxp-support"
)
and
os
.
istarget
(
"windows"
)
then
if
GetParam
(
"winxp-support"
)
and
os
.
istarget
(
"windows"
)
then
WINXP_SUPPORT
=
true
WINXP_SUPPORT
=
true
end
end
if
os
.
istarget
(
"macosx"
)
then
MAC_ARM
=
false
IS_ARM
=
false
if
GetParam
(
"mac-arm"
)
then
MAC_ARM
=
true
function
spawn
(
cmd
)
local
handle
=
io.popen
(
cmd
)
if
not
handle
then
return
nil
end
local
result
=
handle
:
read
(
"*a"
)
handle
:
close
()
if
result
and
#
result
>
0
then
return
result
else
return
nil
end
end
function
isRunningUnderRosetta
()
local
rosetta_result
=
spawn
(
"sysctl -n sysctl.proc_translated 2>/dev/null"
)
return
tonumber
(
rosetta_result
)
==
1
end
function
IsRunningUnderARM
()
-- os.hostarch() is over premake5 beta3,
if
os
.
hostarch
then
local
host_arch
=
os
.
hostarch
()
local
possible_archs
=
{
"ARM"
,
"ARM64"
,
"loongarch64"
,
"armv5"
,
"armv7"
,
"aarch64"
}
for
_
,
arch
in
ipairs
(
possible_archs
)
do
if
host_arch
:
lower
():
match
(
arch
:
lower
())
then
return
true
end
end
else
-- use command 'arch' to detect the architecture on macOS or Linux
local
arch_result
=
spawn
(
"arch 2>/dev/null"
)
if
arch_result
then
arch_result
=
arch_result
:
lower
():
gsub
(
"%s+"
,
""
)
if
arch_result
==
"arm64"
or
arch_result
==
"aarch64"
then
return
true
elseif
arch_result
==
"arm"
or
arch_result
==
"armv7"
or
arch_result
==
"armv5"
then
return
true
-- for ARMv5, ARMv7, etc.
elseif
arch_result
==
"loongarch64"
then
return
true
-- for loongarch64
end
end
end
return
false
end
function
isARM
()
if
IsRunningUnderARM
()
then
return
true
end
if
os
.
istarget
(
"macosx"
)
and
isRunningUnderRosetta
()
then
-- macOS under rosetta will report x86_64, but it is running on ARM
print
(
"Detected running under Rosetta on macOS, treating as ARM"
)
return
true
end
end
return
false
end
end
IS_ARM
=
isARM
()
or
GetParam
(
"mac-arm"
)
-- detect if the current system is ARM
MAC_ARM
=
os
.
istarget
(
"macosx"
)
and
IS_ARM
workspace
"YGOPro"
workspace
"YGOPro"
location
"build"
location
"build"
language
"C++"
language
"C++"
...
@@ -337,9 +396,17 @@ workspace "YGOPro"
...
@@ -337,9 +396,17 @@ workspace "YGOPro"
filter
{
"configurations:Release"
,
"not action:vs*"
}
filter
{
"configurations:Release"
,
"not action:vs*"
}
symbols
"On"
symbols
"On"
defines
"NDEBUG"
defines
"NDEBUG"
if
not
MAC
_ARM
then
if
not
IS
_ARM
then
buildoptions
"-march=native"
buildoptions
"-march=native"
end
end
if
IS_ARM
and
not
MAC_ARM
then
buildoptions
{
"-march=armv8-a"
,
"-mtune=cortex-a72"
,
"-Wno-psabi"
}
pic
"On"
end
filter
{
"configurations:Debug"
,
"action:vs*"
}
filter
{
"configurations:Debug"
,
"action:vs*"
}
disablewarnings
{
"6011"
,
"6031"
,
"6054"
,
"6262"
}
disablewarnings
{
"6011"
,
"6031"
,
"6054"
,
"6262"
}
...
...
script
@
1c8a21cd
Subproject commit
3e5aeb86a3e4fc20bdf14a89fb3b4ba2f35f1cbe
Subproject commit
1c8a21cd877e82b9bbdd95fe71f0a1b58b909797
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