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
YGOPRO-520DIY
ygopro
Commits
24d07a16
Commit
24d07a16
authored
Mar 31, 2025
by
nanahira
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'develop' into server-develop
parents
290f45a0
6c8f835a
Changes
10
Show whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
74 additions
and
41 deletions
+74
-41
.ci/prepare-miniaudio.sh
.ci/prepare-miniaudio.sh
+2
-0
.github/workflows/build.yml
.github/workflows/build.yml
+9
-0
gframe/duelclient.cpp
gframe/duelclient.cpp
+9
-9
gframe/game.cpp
gframe/game.cpp
+1
-1
gframe/premake5.lua
gframe/premake5.lua
+1
-1
gframe/sound_manager.cpp
gframe/sound_manager.cpp
+46
-27
gframe/sound_manager.h
gframe/sound_manager.h
+3
-0
ocgcore
ocgcore
+1
-1
premake/miniaudio/premake5.lua
premake/miniaudio/premake5.lua
+1
-1
script
script
+1
-1
No files found.
.ci/prepare-miniaudio.sh
View file @
24d07a16
...
@@ -6,6 +6,8 @@ if [ ! -d "miniaudio" ]; then
...
@@ -6,6 +6,8 @@ if [ ! -d "miniaudio" ]; then
git clone
--depth
=
1
--branch
0.11.22 https://github.com/mackron/miniaudio
git clone
--depth
=
1
--branch
0.11.22 https://github.com/mackron/miniaudio
fi
fi
cp
-rf
miniaudio/extras/miniaudio_split/miniaudio.
*
miniaudio/
mkdir
-p
miniaudio/external
mkdir
-p
miniaudio/external
install_external
()
{
install_external
()
{
...
...
.github/workflows/build.yml
View file @
24d07a16
...
@@ -95,6 +95,9 @@ jobs:
...
@@ -95,6 +95,9 @@ jobs:
if
:
matrix.audiolib == 'miniaudio'
if
:
matrix.audiolib == 'miniaudio'
run
:
|
run
:
|
git clone --depth=1 --branch 0.11.22 https://github.com/mackron/miniaudio
git clone --depth=1 --branch 0.11.22 https://github.com/mackron/miniaudio
cd miniaudio
xcopy /Y extras\miniaudio_split\miniaudio.* .
cd ..
-
name
:
Download ogg
-
name
:
Download ogg
if
:
matrix.audiolib == 'miniaudio'
if
:
matrix.audiolib == 'miniaudio'
...
@@ -295,6 +298,9 @@ jobs:
...
@@ -295,6 +298,9 @@ jobs:
-
name
:
Download miniaudio
-
name
:
Download miniaudio
run
:
|
run
:
|
git clone --depth=1 --branch 0.11.22 https://github.com/mackron/miniaudio
git clone --depth=1 --branch 0.11.22 https://github.com/mackron/miniaudio
cd miniaudio
cp extras/miniaudio_split/miniaudio.* .
cd ..
-
name
:
Download irrlicht
-
name
:
Download irrlicht
run
:
|
run
:
|
...
@@ -387,6 +393,9 @@ jobs:
...
@@ -387,6 +393,9 @@ jobs:
-
name
:
Download miniaudio
-
name
:
Download miniaudio
run
:
|
run
:
|
git clone --depth=1 --branch 0.11.22 https://github.com/mackron/miniaudio
git clone --depth=1 --branch 0.11.22 https://github.com/mackron/miniaudio
cd miniaudio
cp extras/miniaudio_split/miniaudio.* .
cd ..
-
name
:
Download irrlicht
-
name
:
Download irrlicht
run
:
|
run
:
|
...
...
gframe/duelclient.cpp
View file @
24d07a16
...
@@ -1312,11 +1312,11 @@ bool DuelClient::ClientAnalyze(unsigned char* msg, int len) {
...
@@ -1312,11 +1312,11 @@ bool DuelClient::ClientAnalyze(unsigned char* msg, int len) {
}
}
//playing custom bgm
//playing custom bgm
case
21
:
{
//HINT_MUSIC
case
21
:
{
//HINT_MUSIC
char
BGMName
[
1024
];
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
,
BGMName
);
BufferIO
::
EncodeUTF8
(
textBuffer
,
textBufferU
);
soundManager
.
PlayCustomBGM
(
BGMName
);
soundManager
.
PlayCustomBGM
(
textBufferU
);
}
else
{
}
else
{
soundManager
.
StopBGM
();
soundManager
.
StopBGM
();
}
}
...
@@ -1324,11 +1324,11 @@ bool DuelClient::ClientAnalyze(unsigned char* msg, int len) {
...
@@ -1324,11 +1324,11 @@ bool DuelClient::ClientAnalyze(unsigned char* msg, int len) {
}
}
//playing custom sound effect
//playing custom sound effect
case
22
:
{
//HINT_SOUND
case
22
:
{
//HINT_SOUND
char
SoundName
[
1024
];
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
,
SoundName
);
BufferIO
::
EncodeUTF8
(
textBuffer
,
textBufferU
);
soundManager
.
PlayCustomSound
(
SoundName
);
soundManager
.
PlayCustomSound
(
textBufferU
);
}
else
{
}
else
{
soundManager
.
StopSound
();
soundManager
.
StopSound
();
}
}
...
@@ -1336,11 +1336,11 @@ bool DuelClient::ClientAnalyze(unsigned char* msg, int len) {
...
@@ -1336,11 +1336,11 @@ 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
char
BGMName
[
1024
];
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
,
BGMName
);
BufferIO
::
EncodeUTF8
(
textBuffer
,
textBufferU
);
soundManager
.
PlayCustomBGM
(
BGMName
);
soundManager
.
PlayCustomBGM
(
textBufferU
);
}
else
{
}
else
{
soundManager
.
StopBGM
();
soundManager
.
StopBGM
();
}
}
...
...
gframe/game.cpp
View file @
24d07a16
...
@@ -280,7 +280,7 @@ bool Game::Initialize() {
...
@@ -280,7 +280,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
Overdos
e"
,
(
PRO_VERSION
&
0xf000U
)
>>
12
,
(
PRO_VERSION
&
0x0ff0U
)
>>
4
,
PRO_VERSION
&
0x000fU
);
myswprintf
(
strbuf
,
L"KoishiPro %X.0%X.%X
Bumblebe
e"
,
(
PRO_VERSION
&
0xf000U
)
>>
12
,
(
PRO_VERSION
&
0x0ff0U
)
>>
4
,
PRO_VERSION
&
0x000fU
);
wMainMenu
=
env
->
addWindow
(
irr
::
core
::
rect
<
irr
::
s32
>
(
370
,
200
,
650
,
415
),
false
,
strbuf
);
wMainMenu
=
env
->
addWindow
(
irr
::
core
::
rect
<
irr
::
s32
>
(
370
,
200
,
650
,
415
),
false
,
strbuf
);
wMainMenu
->
getCloseButton
()
->
setVisible
(
false
);
wMainMenu
->
getCloseButton
()
->
setVisible
(
false
);
btnLanMode
=
env
->
addButton
(
irr
::
core
::
rect
<
irr
::
s32
>
(
10
,
30
,
270
,
60
),
wMainMenu
,
BUTTON_LAN_MODE
,
dataManager
.
GetSysString
(
1200
));
btnLanMode
=
env
->
addButton
(
irr
::
core
::
rect
<
irr
::
s32
>
(
10
,
30
,
270
,
60
),
wMainMenu
,
BUTTON_LAN_MODE
,
dataManager
.
GetSysString
(
1200
));
...
...
gframe/premake5.lua
View file @
24d07a16
...
@@ -85,7 +85,7 @@ end
...
@@ -85,7 +85,7 @@ end
defines
{
"YGOPRO_USE_AUDIO"
}
defines
{
"YGOPRO_USE_AUDIO"
}
if
AUDIO_LIB
==
"miniaudio"
then
if
AUDIO_LIB
==
"miniaudio"
then
defines
{
"YGOPRO_USE_MINIAUDIO"
}
defines
{
"YGOPRO_USE_MINIAUDIO"
}
includedirs
{
"../miniaudio
/extras/miniaudio_split
"
}
includedirs
{
"../miniaudio"
}
links
{
"miniaudio"
}
links
{
"miniaudio"
}
if
MINIAUDIO_SUPPORT_OPUS_VORBIS
then
if
MINIAUDIO_SUPPORT_OPUS_VORBIS
then
defines
{
"YGOPRO_MINIAUDIO_SUPPORT_OPUS_VORBIS"
}
defines
{
"YGOPRO_MINIAUDIO_SUPPORT_OPUS_VORBIS"
}
...
...
gframe/sound_manager.cpp
View file @
24d07a16
...
@@ -36,6 +36,7 @@ bool SoundManager::Init() {
...
@@ -36,6 +36,7 @@ bool SoundManager::Init() {
}
}
engineConfig
.
pResourceManager
=
&
resourceManager
;
engineConfig
.
pResourceManager
=
&
resourceManager
;
#endif
#endif
playingSoundEffect
=
FALSE
;
if
(
ma_engine_init
(
&
engineConfig
,
&
engineSound
)
!=
MA_SUCCESS
||
ma_engine_init
(
&
engineConfig
,
&
engineMusic
)
!=
MA_SUCCESS
)
{
if
(
ma_engine_init
(
&
engineConfig
,
&
engineSound
)
!=
MA_SUCCESS
||
ma_engine_init
(
&
engineConfig
,
&
engineMusic
)
!=
MA_SUCCESS
)
{
return
false
;
return
false
;
}
else
{
}
else
{
...
@@ -85,6 +86,29 @@ void SoundManager::RefershBGMDir(std::wstring path, int scene) {
...
@@ -85,6 +86,29 @@ void SoundManager::RefershBGMDir(std::wstring path, int scene) {
}
}
});
});
}
}
void
SoundManager
::
PlaySound
(
char
*
sound
)
{
#ifdef YGOPRO_USE_AUDIO
if
(
!
mainGame
->
chkEnableSound
->
isChecked
())
return
;
#ifdef YGOPRO_USE_MINIAUDIO
StopSound
();
SetSoundVolume
(
mainGame
->
gameConf
.
sound_volume
);
playingSoundEffect
=
TRUE
;
#ifdef _WIN32
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
,
&
soundEffect
);
#else
ma_sound_init_from_file
(
&
engineSound
,
sound
,
MA_SOUND_FLAG_ASYNC
|
MA_SOUND_FLAG_STREAM
,
nullptr
,
nullptr
,
&
soundEffect
);
#endif
ma_sound_start
(
&
soundEffect
);
#endif
#ifdef YGOPRO_USE_IRRKLANG
SetSoundVolume
(
mainGame
->
gameConf
.
sound_volume
);
engineSound
->
play2D
(
soundPath
);
#endif
#endif
}
void
SoundManager
::
PlaySoundEffect
(
int
sound
)
{
void
SoundManager
::
PlaySoundEffect
(
int
sound
)
{
#ifdef YGOPRO_USE_AUDIO
#ifdef YGOPRO_USE_AUDIO
if
(
!
mainGame
->
chkEnableSound
->
isChecked
())
if
(
!
mainGame
->
chkEnableSound
->
isChecked
())
...
@@ -156,7 +180,7 @@ void SoundManager::PlaySoundEffect(int sound) {
...
@@ -156,7 +180,7 @@ void SoundManager::PlaySoundEffect(int sound) {
break
;
break
;
}
}
case
SOUND_RECOVER
:
{
case
SOUND_RECOVER
:
{
strcpy
(
soundName
,
"
recover
"
);
strcpy
(
soundName
,
"
gainlp
"
);
break
;
break
;
}
}
case
SOUND_COUNTER_ADD
:
{
case
SOUND_COUNTER_ADD
:
{
...
@@ -168,11 +192,11 @@ void SoundManager::PlaySoundEffect(int sound) {
...
@@ -168,11 +192,11 @@ void SoundManager::PlaySoundEffect(int sound) {
break
;
break
;
}
}
case
SOUND_COIN
:
{
case
SOUND_COIN
:
{
strcpy
(
soundName
,
"coin"
);
strcpy
(
soundName
,
"coin
flip
"
);
break
;
break
;
}
}
case
SOUND_DICE
:
{
case
SOUND_DICE
:
{
strcpy
(
soundName
,
"dice"
);
strcpy
(
soundName
,
"dice
roll
"
);
break
;
break
;
}
}
case
SOUND_NEXT_TURN
:
{
case
SOUND_NEXT_TURN
:
{
...
@@ -212,7 +236,7 @@ void SoundManager::PlaySoundEffect(int sound) {
...
@@ -212,7 +236,7 @@ void SoundManager::PlaySoundEffect(int sound) {
break
;
break
;
}
}
case
SOUND_CHAT
:
{
case
SOUND_CHAT
:
{
strcpy
(
soundName
,
"chat"
);
strcpy
(
soundName
,
"chat
message
"
);
break
;
break
;
}
}
default:
default:
...
@@ -220,14 +244,7 @@ void SoundManager::PlaySoundEffect(int sound) {
...
@@ -220,14 +244,7 @@ void SoundManager::PlaySoundEffect(int sound) {
}
}
char
soundPath
[
40
];
char
soundPath
[
40
];
std
::
snprintf
(
soundPath
,
40
,
"./sound/%s.wav"
,
soundName
);
std
::
snprintf
(
soundPath
,
40
,
"./sound/%s.wav"
,
soundName
);
#ifdef YGOPRO_USE_MINIAUDIO
PlaySound
(
soundPath
);
ma_engine_set_volume
(
&
engineSound
,
mainGame
->
gameConf
.
sound_volume
);
ma_engine_play_sound
(
&
engineSound
,
soundPath
,
nullptr
);
#endif
#ifdef YGOPRO_USE_IRRKLANG
engineSound
->
setSoundVolume
(
mainGame
->
gameConf
.
sound_volume
);
engineSound
->
play2D
(
soundPath
);
#endif
#endif // YGOPRO_USE_AUDIO
#endif // YGOPRO_USE_AUDIO
}
}
void
SoundManager
::
PlayDialogSound
(
irr
::
gui
::
IGUIElement
*
element
)
{
void
SoundManager
::
PlayDialogSound
(
irr
::
gui
::
IGUIElement
*
element
)
{
...
@@ -268,15 +285,20 @@ void SoundManager::PlayMusic(char* song, bool loop) {
...
@@ -268,15 +285,20 @@ void SoundManager::PlayMusic(char* song, bool loop) {
return
;
return
;
if
(
!
IsCurrentlyPlaying
(
song
))
{
if
(
!
IsCurrentlyPlaying
(
song
))
{
StopBGM
();
StopBGM
();
SetMusicVolume
(
mainGame
->
gameConf
.
music_volume
);
#ifdef YGOPRO_USE_MINIAUDIO
#ifdef YGOPRO_USE_MINIAUDIO
strcpy
(
currentPlayingMusic
,
song
);
strcpy
(
currentPlayingMusic
,
song
);
#ifdef _WIN32
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
);
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
engineMusic
->
stopAllSounds
();
engineMusic
->
setSoundVolume
(
mainGame
->
gameConf
.
music_volume
);
soundBGM
=
engineMusic
->
play2D
(
song
,
loop
,
false
,
true
);
soundBGM
=
engineMusic
->
play2D
(
song
,
loop
,
false
,
true
);
#endif
#endif
}
}
...
@@ -321,18 +343,7 @@ void SoundManager::PlayCustomBGM(char* BGMName) {
...
@@ -321,18 +343,7 @@ void SoundManager::PlayCustomBGM(char* BGMName) {
#endif
#endif
}
}
void
SoundManager
::
PlayCustomSound
(
char
*
SoundName
)
{
void
SoundManager
::
PlayCustomSound
(
char
*
SoundName
)
{
#ifdef YGOPRO_USE_AUDIO
PlaySound
(
SoundName
);
if
(
!
mainGame
->
chkEnableSound
->
isChecked
())
return
;
#ifdef YGOPRO_USE_MINIAUDIO
ma_engine_set_volume
(
&
engineSound
,
mainGame
->
gameConf
.
sound_volume
);
ma_engine_play_sound
(
&
engineSound
,
SoundName
,
nullptr
);
#endif
#ifdef YGOPRO_USE_IRRKLANG
engineSound
->
setSoundVolume
(
mainGame
->
gameConf
.
sound_volume
);
engineSound
->
play2D
(
SoundName
);
#endif
#endif
}
}
void
SoundManager
::
StopBGM
()
{
void
SoundManager
::
StopBGM
()
{
#ifdef YGOPRO_USE_MINIAUDIO
#ifdef YGOPRO_USE_MINIAUDIO
...
@@ -346,7 +357,15 @@ void SoundManager::StopBGM() {
...
@@ -346,7 +357,15 @@ void SoundManager::StopBGM() {
#endif
#endif
}
}
void
SoundManager
::
StopSound
()
{
void
SoundManager
::
StopSound
()
{
// TODO: stop all sounds
#ifdef YGOPRO_USE_MINIAUDIO
if
(
!
playingSoundEffect
)
return
;
playingSoundEffect
=
FALSE
;
ma_sound_uninit
(
&
soundEffect
);
#endif
#ifdef YGOPRO_USE_IRRKLANG
engineSound
->
stopAllSounds
();
#endif
}
}
void
SoundManager
::
SetSoundVolume
(
double
volume
)
{
void
SoundManager
::
SetSoundVolume
(
double
volume
)
{
#ifdef YGOPRO_USE_MINIAUDIO
#ifdef YGOPRO_USE_MINIAUDIO
...
...
gframe/sound_manager.h
View file @
24d07a16
...
@@ -29,6 +29,8 @@ private:
...
@@ -29,6 +29,8 @@ private:
ma_engine
engineMusic
;
ma_engine
engineMusic
;
ma_sound
soundBGM
;
ma_sound
soundBGM
;
char
currentPlayingMusic
[
1024
]{};
char
currentPlayingMusic
[
1024
]{};
ma_sound
soundEffect
;
char
playingSoundEffect
;
#endif
#endif
#ifdef YGOPRO_USE_IRRKLANG
#ifdef YGOPRO_USE_IRRKLANG
irrklang
::
ISoundEngine
*
engineSound
;
irrklang
::
ISoundEngine
*
engineSound
;
...
@@ -40,6 +42,7 @@ private:
...
@@ -40,6 +42,7 @@ private:
public:
public:
bool
Init
();
bool
Init
();
void
RefreshBGMList
();
void
RefreshBGMList
();
void
PlaySound
(
char
*
sound
);
void
PlaySoundEffect
(
int
sound
);
void
PlaySoundEffect
(
int
sound
);
void
PlayDialogSound
(
irr
::
gui
::
IGUIElement
*
element
);
void
PlayDialogSound
(
irr
::
gui
::
IGUIElement
*
element
);
bool
IsCurrentlyPlaying
(
char
*
song
);
bool
IsCurrentlyPlaying
(
char
*
song
);
...
...
ocgcore
@
cd8598dd
Subproject commit
59563d732ecd7edf8a83d5547a3fbbf1dde2b44a
Subproject commit
cd8598dd962280fabc48971c5de0e434682bb1df
premake/miniaudio/premake5.lua
View file @
24d07a16
project
"miniaudio"
project
"miniaudio"
kind
"StaticLib"
kind
"StaticLib"
files
{
"
extras/miniaudio_split/miniaudio.*
"
}
files
{
"
miniaudio.c"
,
"miniaudio.h
"
}
defines
{
"MA_NO_ENCODING"
,
"MA_NO_GENERATION"
,
"MA_NO_NEON"
}
defines
{
"MA_NO_ENCODING"
,
"MA_NO_GENERATION"
,
"MA_NO_NEON"
}
if
MINIAUDIO_SUPPORT_OPUS_VORBIS
then
if
MINIAUDIO_SUPPORT_OPUS_VORBIS
then
...
...
script
@
9f141e8c
Subproject commit
28782ebd949a70081a9f3c5c867d12cba80e756d
Subproject commit
9f141e8cdfc7adee127eaca1a7981e816b555ae3
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