Skip to main content
The Message Dialog API allows you to display various types of dialog boxes including simple messages, yes/no prompts, and progress bars.

Dialog Functions

msgDialogOpen

Open a message dialog with a text message.
s32 msgDialogOpen(msgType type, const char *msg, msgDialogCallback cb, void *usrData, void *unused);
type
msgType
Dialog type flags (can be combined with OR).
msg
const char*
Message text to display in the dialog.
cb
msgDialogCallback
Callback function called when the dialog is closed. Receives:
  • button - Which button was pressed (msgButton)
  • usrData - User data pointer
usrData
void*
User data pointer passed to the callback.
unused
void*
Unused parameter, should be NULL.
return
s32
Returns 0 on success, nonzero on error.

msgDialogOpen2

Open a message dialog (alternative version).
s32 msgDialogOpen2(msgType type, const char *msg, msgDialogCallback cb, void *usrData, void *unused);
Parameters are identical to msgDialogOpen. This variant may provide slightly different behavior.

msgDialogOpenErrorCode

Open an error dialog displaying a system error code.
s32 msgDialogOpenErrorCode(u32 errorCode, msgDialogCallback cb, void *usrData, void *unused);
errorCode
u32
System error code to display.
cb
msgDialogCallback
Callback function called when the dialog is closed.
usrData
void*
User data pointer passed to the callback.
unused
void*
Unused parameter, should be NULL.
return
s32
Returns 0 on success, nonzero on error.

msgDialogClose

Close the currently open dialog.
s32 msgDialogClose(f32 waitMs);
waitMs
f32
Time to wait in milliseconds before closing the dialog.
return
s32
Returns 0 on success, nonzero on error.

msgDialogAbort

Abort and close the current dialog immediately.
s32 msgDialogAbort();
return
s32
Returns 0 on success, nonzero on error.

Progress Bar Functions

msgDialogProgressBarSetMsg

Set the message text for a progress bar.
s32 msgDialogProgressBarSetMsg(u32 index, const char *msg);
index
u32
Progress bar index.
  • MSG_PROGRESSBAR_INDEX0 (0) - First progress bar
  • MSG_PROGRESSBAR_INDEX1 (1) - Second progress bar (for double progress bar)
msg
const char*
Message text to display for the progress bar.
return
s32
Returns 0 on success, nonzero on error.

msgDialogProgressBarInc

Increment a progress bar by a percentage.
s32 msgDialogProgressBarInc(u32 index, u32 percent);
index
u32
Progress bar index (0 or 1).
percent
u32
Percentage to increment (0-100).
return
s32
Returns 0 on success, nonzero on error.

msgDialogProgressBarReset

Reset a progress bar to 0%.
s32 msgDialogProgressBarReset(u32 index);
index
u32
Progress bar index to reset (0 or 1).
return
s32
Returns 0 on success, nonzero on error.

Types and Enumerations

msgButton

Button values passed to the dialog callback.
typedef enum {
    MSG_DIALOG_BTN_NONE = -1,
    MSG_DIALOG_BTN_INVALID,
    MSG_DIALOG_BTN_OK,
    MSG_DIALOG_BTN_YES = 1,
    MSG_DIALOG_BTN_NO,
    MSG_DIALOG_BTN_ESCAPE
} msgButton;
MSG_DIALOG_BTN_NONE
-1
No button pressed.
MSG_DIALOG_BTN_INVALID
0
Invalid button.
MSG_DIALOG_BTN_OK
1
OK button pressed.
MSG_DIALOG_BTN_YES
1
Yes button pressed.
MSG_DIALOG_BTN_NO
2
No button pressed.
MSG_DIALOG_BTN_ESCAPE
3
Escape/Cancel button pressed.

msgDialogCallback

Callback function type for dialog events.
typedef void (*msgDialogCallback)(msgButton button, void *usrData);
button
msgButton
Which button was pressed to close the dialog.
usrData
void*
User data pointer provided when opening the dialog.

Example Usage

Simple Message Dialog

#include <sysutil/msg.h>
#include <stdio.h>

void messageCallback(msgButton button, void *usrData) {
    printf("Dialog closed with button: %d\n", button);
}

int main() {
    // Display a simple OK dialog
    msgDialogOpen(MSG_DIALOG_NORMAL | MSG_DIALOG_BTN_TYPE_OK,
                  "Hello, PlayStation 3!",
                  messageCallback,
                  NULL,
                  NULL);
    
    return 0;
}

Yes/No Confirmation Dialog

#include <sysutil/msg.h>
#include <stdio.h>

static int userChoice = -1;

void confirmCallback(msgButton button, void *usrData) {
    if (button == MSG_DIALOG_BTN_YES) {
        printf("User selected YES\n");
        userChoice = 1;
    } else if (button == MSG_DIALOG_BTN_NO) {
        printf("User selected NO\n");
        userChoice = 0;
    }
}

int main() {
    // Ask user a yes/no question
    msgDialogOpen(MSG_DIALOG_NORMAL | MSG_DIALOG_BTN_TYPE_YESNO,
                  "Do you want to continue?",
                  confirmCallback,
                  NULL,
                  NULL);
    
    // Wait for user response...
    while(userChoice == -1) {
        // Process system events
    }
    
    return 0;
}

Progress Bar Dialog

#include <sysutil/msg.h>
#include <stdio.h>

void progressCallback(msgButton button, void *usrData) {
    printf("Progress dialog closed\n");
}

int main() {
    // Open dialog with single progress bar
    msgDialogOpen(MSG_DIALOG_NORMAL | MSG_DIALOG_SINGLE_PROGRESSBAR,
                  "Loading...",
                  progressCallback,
                  NULL,
                  NULL);
    
    // Simulate a loading process
    for(int i = 0; i <= 100; i += 10) {
        msgDialogProgressBarSetMsg(MSG_PROGRESSBAR_INDEX0, "Loading data...");
        msgDialogProgressBarInc(MSG_PROGRESSBAR_INDEX0, 10);
        // Delay...
    }
    
    // Close dialog
    msgDialogClose(0.0f);
    
    return 0;
}

Error Code Dialog

#include <sysutil/msg.h>

void errorCallback(msgButton button, void *usrData) {
    // Handle error acknowledgment
}

int main() {
    u32 errorCode = 0x80010001; // Example error code
    
    msgDialogOpenErrorCode(errorCode, errorCallback, NULL, NULL);
    
    return 0;
}

Build docs developers (and LLMs) love