Added PS Vita support
This commit is contained in:
44
src/dawnvita/debug/debug.hpp
Normal file
44
src/dawnvita/debug/debug.hpp
Normal file
@ -0,0 +1,44 @@
|
||||
// Copyright (c) 2023 Dominic Masters
|
||||
//
|
||||
// This software is released under the MIT License.
|
||||
// https://opensource.org/licenses/MIT
|
||||
|
||||
#pragma once
|
||||
#include "debug/debug.hpp"
|
||||
#include <vitasdk.h>
|
||||
#include "dawnopengl.hpp"
|
||||
|
||||
// Initialize sceMsgDialog widget with a given message text
|
||||
static int vitaMsgInit(const char *msg) {
|
||||
SceMsgDialogUserMessageParam msg_param;
|
||||
memset(&msg_param, 0, sizeof(msg_param));
|
||||
msg_param.buttonType = SCE_MSG_DIALOG_BUTTON_TYPE_OK;
|
||||
msg_param.msg = (SceChar8 *)msg;
|
||||
|
||||
SceMsgDialogParam param;
|
||||
sceMsgDialogParamInit(¶m);
|
||||
_sceCommonDialogSetMagicNumber(¶m.commonParam);
|
||||
param.mode = SCE_MSG_DIALOG_MODE_USER_MSG;
|
||||
param.userMsgParam = &msg_param;
|
||||
|
||||
return sceMsgDialogInit(¶m);
|
||||
}
|
||||
|
||||
// Gets current state for sceMsgDialog running widget
|
||||
static int vitaMsgGetResult(void) {
|
||||
if(sceMsgDialogGetStatus() != SCE_COMMON_DIALOG_STATUS_FINISHED) return 0;
|
||||
sceMsgDialogTerm();
|
||||
return 1;
|
||||
}
|
||||
|
||||
// Draws an error message on screen and force closes the app after user input
|
||||
template<typename... A>
|
||||
static void debugMessage(const char *fmt, A... args) {
|
||||
char string[512];
|
||||
sprintf(string, fmt, args...);
|
||||
vitaMsgInit(string);
|
||||
while(!vitaMsgGetResult()) {
|
||||
glClear(GL_COLOR_BUFFER_BIT);
|
||||
vglSwapBuffers(GL_TRUE);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user