mirror of
https://github.com/Detanup01/gbe_fork.git
synced 2024-11-27 13:14:01 +08:00
* cleanup custom sound buffers on destroy + cleanup entire overlay class on destroy
* fix sound for auto-accept invites
This commit is contained in:
parent
22fc5038a2
commit
b01486c765
@ -95,7 +95,7 @@ Steam_Client::Steam_Client()
|
|||||||
set_env_variable("SteamOverlayGameId", appid_str);
|
set_env_variable("SteamOverlayGameId", appid_str);
|
||||||
}
|
}
|
||||||
|
|
||||||
steam_overlay = new Steam_Overlay(settings_client, callback_results_client, callbacks_client, run_every_runcb, network);
|
steam_overlay = new Steam_Overlay(settings_client, local_storage, callback_results_client, callbacks_client, run_every_runcb, network);
|
||||||
|
|
||||||
steam_user = new Steam_User(settings_client, local_storage, network, callback_results_client, callbacks_client);
|
steam_user = new Steam_User(settings_client, local_storage, network, callback_results_client, callbacks_client);
|
||||||
steam_friends = new Steam_Friends(settings_client, local_storage, network, callback_results_client, callbacks_client, run_every_runcb, steam_overlay);
|
steam_friends = new Steam_Friends(settings_client, local_storage, network, callback_results_client, callbacks_client, run_every_runcb, steam_overlay);
|
||||||
|
@ -65,17 +65,15 @@ static const char* valid_languages[] = {
|
|||||||
"croatian"
|
"croatian"
|
||||||
};
|
};
|
||||||
|
|
||||||
ImFontAtlas fonts_atlas{};
|
static ImFontAtlas fonts_atlas{};
|
||||||
ImFont *font_default{};
|
static ImFont *font_default{};
|
||||||
ImFont *font_notif{};
|
static ImFont *font_notif{};
|
||||||
|
|
||||||
std::recursive_mutex overlay_mutex{};
|
static std::recursive_mutex overlay_mutex{};
|
||||||
std::atomic<bool> setup_overlay_called = false;
|
static std::atomic<bool> setup_overlay_called = false;
|
||||||
|
|
||||||
char *notif_achievement_wav_custom{};
|
static char *notif_achievement_wav_custom{};
|
||||||
char *notif_invite_wav_custom{};
|
static char *notif_invite_wav_custom{};
|
||||||
bool notif_achievement_wav_custom_inuse = false;
|
|
||||||
bool notif_invite_wav_custom_inuse = false;
|
|
||||||
|
|
||||||
|
|
||||||
// ListBoxHeader() is deprecated and inlined inside <imgui.h>
|
// ListBoxHeader() is deprecated and inlined inside <imgui.h>
|
||||||
@ -145,6 +143,7 @@ Steam_Overlay::~Steam_Overlay()
|
|||||||
{
|
{
|
||||||
if (settings->disable_overlay) return;
|
if (settings->disable_overlay) return;
|
||||||
|
|
||||||
|
UnSetupOverlay();
|
||||||
this->network->rmCallback(CALLBACK_ID_STEAM_MESSAGES, settings->get_local_steam_id(), &Steam_Overlay::overlay_networking_callback, this);
|
this->network->rmCallback(CALLBACK_ID_STEAM_MESSAGES, settings->get_local_steam_id(), &Steam_Overlay::overlay_networking_callback, this);
|
||||||
run_every_runcb->remove(&Steam_Overlay::overlay_run_callback, this);
|
run_every_runcb->remove(&Steam_Overlay::overlay_run_callback, this);
|
||||||
}
|
}
|
||||||
@ -343,12 +342,10 @@ void Steam_Overlay::load_audio()
|
|||||||
if (i == 0) {
|
if (i == 0) {
|
||||||
notif_achievement_wav_custom = new char [length];
|
notif_achievement_wav_custom = new char [length];
|
||||||
myfile.read (notif_achievement_wav_custom, length);
|
myfile.read (notif_achievement_wav_custom, length);
|
||||||
notif_achievement_wav_custom_inuse = true;
|
|
||||||
}
|
}
|
||||||
if (i == 1) {
|
if (i == 1) {
|
||||||
notif_invite_wav_custom = new char [length];
|
notif_invite_wav_custom = new char [length];
|
||||||
myfile.read (notif_invite_wav_custom, length);
|
myfile.read (notif_invite_wav_custom, length);
|
||||||
notif_invite_wav_custom_inuse = true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
myfile.close();
|
myfile.close();
|
||||||
@ -534,11 +531,11 @@ void Steam_Overlay::obscure_game_input(bool state) {
|
|||||||
void Steam_Overlay::notify_sound_user_invite(friend_window_state& friend_state)
|
void Steam_Overlay::notify_sound_user_invite(friend_window_state& friend_state)
|
||||||
{
|
{
|
||||||
if (settings->disable_overlay_friend_notification) return;
|
if (settings->disable_overlay_friend_notification) return;
|
||||||
if (!(friend_state.window_state & window_state_show) || !show_overlay)
|
|
||||||
{
|
if (!(friend_state.window_state & window_state_show) || !show_overlay) {
|
||||||
friend_state.window_state |= window_state_need_attention;
|
friend_state.window_state |= window_state_need_attention;
|
||||||
#ifdef __WINDOWS__
|
#ifdef __WINDOWS__
|
||||||
if (notif_invite_wav_custom_inuse) {
|
if (notif_invite_wav_custom) {
|
||||||
PlaySoundA((LPCSTR)notif_invite_wav_custom, NULL, SND_ASYNC | SND_MEMORY);
|
PlaySoundA((LPCSTR)notif_invite_wav_custom, NULL, SND_ASYNC | SND_MEMORY);
|
||||||
} else {
|
} else {
|
||||||
PlaySoundA((LPCSTR)notif_invite_wav, NULL, SND_ASYNC | SND_MEMORY);
|
PlaySoundA((LPCSTR)notif_invite_wav, NULL, SND_ASYNC | SND_MEMORY);
|
||||||
@ -550,10 +547,10 @@ void Steam_Overlay::notify_sound_user_invite(friend_window_state& friend_state)
|
|||||||
void Steam_Overlay::notify_sound_user_achievement()
|
void Steam_Overlay::notify_sound_user_achievement()
|
||||||
{
|
{
|
||||||
if (settings->disable_overlay_achievement_notification) return;
|
if (settings->disable_overlay_achievement_notification) return;
|
||||||
if (!show_overlay)
|
|
||||||
{
|
if (!show_overlay) {
|
||||||
#ifdef __WINDOWS__
|
#ifdef __WINDOWS__
|
||||||
if (notif_achievement_wav_custom_inuse) {
|
if (notif_achievement_wav_custom) {
|
||||||
PlaySoundA((LPCSTR)notif_achievement_wav_custom, NULL, SND_ASYNC | SND_MEMORY);
|
PlaySoundA((LPCSTR)notif_achievement_wav_custom, NULL, SND_ASYNC | SND_MEMORY);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@ -563,8 +560,8 @@ void Steam_Overlay::notify_sound_user_achievement()
|
|||||||
void Steam_Overlay::notify_sound_auto_accept_friend_invite()
|
void Steam_Overlay::notify_sound_auto_accept_friend_invite()
|
||||||
{
|
{
|
||||||
#ifdef __WINDOWS__
|
#ifdef __WINDOWS__
|
||||||
if (notif_achievement_wav_custom_inuse) {
|
if (notif_invite_wav_custom) {
|
||||||
PlaySoundA((LPCSTR)notif_achievement_wav_custom, NULL, SND_ASYNC | SND_MEMORY);
|
PlaySoundA((LPCSTR)notif_invite_wav_custom, NULL, SND_ASYNC | SND_MEMORY);
|
||||||
} else {
|
} else {
|
||||||
PlaySoundA((LPCSTR)notif_invite_wav, NULL, SND_ASYNC | SND_MEMORY);
|
PlaySoundA((LPCSTR)notif_invite_wav, NULL, SND_ASYNC | SND_MEMORY);
|
||||||
}
|
}
|
||||||
@ -1708,6 +1705,16 @@ void Steam_Overlay::UnSetupOverlay()
|
|||||||
|
|
||||||
_renderer = nullptr;
|
_renderer = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (notif_achievement_wav_custom) {
|
||||||
|
delete[] notif_achievement_wav_custom;
|
||||||
|
notif_achievement_wav_custom = nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (notif_invite_wav_custom) {
|
||||||
|
delete[] notif_invite_wav_custom;
|
||||||
|
notif_invite_wav_custom = nullptr;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user