--- hatari/src/gui-sdl/dlgAlert.c 2019/04/01 07:11:58 1.1.1.1 +++ hatari/src/gui-sdl/dlgAlert.c 2019/04/01 07:13:17 1.1.1.3 @@ -14,18 +14,15 @@ * This file is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with ARAnyM; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * GNU General Public License (gpl.txt) for more details. */ -char DlgAlert_rcsid[] = "Hatari $Id: dlgAlert.c,v 1.1.1.1 2019/04/01 07:11:58 root Exp $"; +const char DlgAlert_rcsid[] = "Hatari $Id: dlgAlert.c,v 1.1.1.3 2019/04/01 07:13:17 root Exp $"; #include #include "main.h" #include "dialog.h" +#include "screen.h" #include "sdlgui.h" @@ -33,6 +30,14 @@ char DlgAlert_rcsid[] = "Hatari $Id: dlg static char dlglines[MAX_LINES][50+1]; +#ifdef ALERT_HOOKS + // The alert hook functions + extern int HookedAlertNotice(const char* szMessage); // Must return TRUE if OK clicked, FALSE otherwise + extern int HookedAlertQuery(const char* szMessage); // Must return TRUE if OK clicked, FALSE otherwise + + // Runtime switch to activate/deactivate alert hooks + BOOL useAlertHooks = FALSE; +#endif #define DLGALERT_OK 5 #define DLGALERT_CANCEL 6 @@ -136,13 +141,14 @@ static int DlgAlert_ShowDlg(const char * free(orig_t); - SDLGui_PrepareFont(); + if (SDLGui_SetScreen(sdlscrn)) + return FALSE; SDLGui_CenterDlg(alertdlg); bOldMouseVisibility = SDL_ShowCursor(SDL_QUERY); SDL_ShowCursor(SDL_ENABLE); - i = SDLGui_DoDialog(alertdlg); + i = SDLGui_DoDialog(alertdlg, NULL); SDL_ShowCursor(bOldMouseVisibility); @@ -156,6 +162,14 @@ static int DlgAlert_ShowDlg(const char * */ int DlgAlert_Notice(const char *text) { +#ifdef ALERT_HOOKS + // If activated, used the hooked function instead + if (useAlertHooks) + { + return HookedAlertNotice(text); + } +#endif + /* Hide "cancel" button: */ alertdlg[DLGALERT_CANCEL].type = SGTEXT; alertdlg[DLGALERT_CANCEL].txt = ""; @@ -174,6 +188,14 @@ int DlgAlert_Notice(const char *text) */ int DlgAlert_Query(const char *text) { +#ifdef ALERT_HOOKS + // If activated, used the hooked function instead + if (useAlertHooks) + { + return HookedAlertQuery(text); + } +#endif + /* Show "cancel" button: */ alertdlg[DLGALERT_CANCEL].type = SGBUTTON; alertdlg[DLGALERT_CANCEL].txt = "Cancel";