Permalink
Browse files

Finished slight rework of msg.

  • Loading branch information...
1 parent 1b08827 commit 66ce6f22ca15d276fe6fb592abdd283f895d54ce @Parlane Parlane committed Jan 8, 2011
View
24 psl1ght/include/io/msg.h
@@ -20,7 +20,7 @@ typedef enum {
MSGDIALOG_SINGLE_PROGRESSBAR = 4096,
MSGDIALOG_DOUBLE_PROGRESSBAR = 8192
-} msgtype;
+} msgType;
typedef enum {
@@ -31,23 +31,23 @@ typedef enum {
MSGDIALOG_BUTTON_NO,
MSGDIALOG_BUTTON_ESCAPE
-} msgbutton;
+} msgButton;
-typedef void (*MsgDialog)(msgbutton button, void *userdata);
+typedef void (*msgDialog)(msgButton button, void *userdata);
-s32 MsgDialogOpen(msgtype type, const char * msg, MsgDialog func, void * userdata, void *unused);
-s32 MsgDialogOpen_ex(msgtype type, const char * msg, opd32 * func, void * userdata, void *unused);
-s32 MsgDialogClose(void);
-s32 MsgDialogDelayedClose(float ms);
+s32 msgDialogOpen(msgType type, const char * msg, msgDialog func, void * userdata, void *unused);
+s32 msgDialogOpen_ex(msgType type, const char * msg, opd32 * func, void * userdata, void *unused);
+s32 msgDialogClose(void);
+s32 msgDialogDelayedClose(float ms);
-s32 MsgDialogErrorCode(u32 errorcode, MsgDialog func, void * userdata, void *unused);
-s32 MsgDialogErrorCode_ex(u32 errorcode, opd32 * func, void * userdata, void *unused);
+s32 msgDialogErrorCode(u32 errorcode, msgDialog func, void * userdata, void *unused);
+s32 msgDialogErrorCode_ex(u32 errorcode, opd32 * func, void * userdata, void *unused);
#define PROGRESSBAR_INDEX0 0
#define PROGRESSBAR_INDEX1 1
-s32 MsgDialogProgressBarMessage(u32 index, const char * msg);
-s32 MsgDialogResetProgressBar(u32 index);
-s32 MsgDialogIncProgressBar(u32 index, u32 percent);
+s32 msgDialogProgressBarMessage(u32 index, const char * msg);
+s32 msgDialogResetProgressBar(u32 index);
+s32 msgDialogIncProgressBar(u32 index, u32 percent);
EXTERN_END
View
10 psl1ght/libc-glue-ppu/source/libsysutil.c
@@ -1,17 +1,17 @@
#include "sysutil/events.h"
-#include "sysutil/msgdialog.h"
+#include "io/msg.h"
s32 sysRegisterCallback(sysEventSlot slot, sysCallback func, void * userdata)
{
return sysRegisterCallback_ex(slot, OPD32(func), userdata);
}
-s32 MsgDialogOpen(u32 type, const char * msg, MsgDialog func, void * userdata, void *unused)
+s32 msgDialogOpen(u32 type, const char * msg, msgDialog func, void * userdata, void *unused)
{
- return MsgDialogOpen_ex(type, msg, OPD32(func), userdata, unused);
+ return msgDialogOpen_ex(type, msg, OPD32(func), userdata, unused);
}
-s32 MsgDialogErrorCode(u32 errorcode, MsgDialog func, void * userdata, void *unused)
+s32 msgDialogErrorCode(u32 errorcode, msgDialog func, void * userdata, void *unused)
{
- return MsgDialogErrorCode_ex(errorcode, OPD32(func), userdata, unused);
+ return msgDialogErrorCode_ex(errorcode, OPD32(func), userdata, unused);
}
View
14 psl1ght/sprx/libsysutil/exports.h
@@ -15,15 +15,15 @@ EXPORT(sysRegisterCallback_ex, 0x9d98afa0);
EXPORT(sysCheckCallback, 0x189a74da);
EXPORT(sysUnregisterCallback, 0x02ff3c1b);
-
-EXPORT(msgDialogClose, 0x20543730);
-EXPORT(msgDialogOpenErrorCode, 0x3e22cb4b);
-EXPORT(msgDialogOpen, 0xf81eca25);
-EXPORT(msgDialogProgressBarInc, 0x94862702);
+EXPORT(msgDialogClose, 0x62b0f803);
+EXPORT(msgDialogDelayedClose, 0x20543730);
+EXPORT(msgDialogErrorCode_ex, 0x3e22cb4b);;
+EXPORT(msgDialogOpen_ex, 0xf81eca25);
+EXPORT(msgDialogIncProgressBar, 0x94862702);
EXPORT(msgDialogAbort, 0x62b0f803);
EXPORT(msgDialogOpen2, 0x7603d3db);
-EXPORT(msgDialogProgressBarReset, 0x7bc2c8a8);
-EXPORT(msgDialogProgressBarSetMsg, 0x9d6af72a);
+EXPORT(msgDialogResetProgressBar, 0x7bc2c8a8);
+EXPORT(msgDialogProgressBarMessage, 0x9d6af72a);
EXPORT(oskDialogGetInputText, 0x1d99c3ee);
EXPORT(oskDialogSetInitialInputDevice, 0xf3b4b43e);
View
64 samples/msgdialog/source/main.c
@@ -18,7 +18,7 @@
// for msgdialogs
#include "sysutil/events.h"
-#include "sysutil/msgdialog.h"
+#include "io/msg.h"
int currentBuffer = 0;
@@ -36,7 +36,7 @@ void my_flip()
volatile int dialog_action = 0;
-void my_dialog(msgbutton button, void *userdata)
+void my_dialog(msgButton button, void *userdata)
{
switch(button) {
@@ -64,121 +64,121 @@ void dialog()
// error code message
- MsgDialogErrorCode(0xBEBACAFE, my_dialog, (void *) 0xEEEE0001, NULL);
- MsgDialogDelayedClose(3000.0f); // 3 seconds
+ msgDialogErrorCode(0xBEBACAFE, my_dialog, (void *) 0xEEEE0001, NULL);
+ msgDialogDelayedClose(3000.0f); // 3 seconds
dialog_action = 0;
while(dialog_action!=-1)
{
sysCheckCallback();my_flip();
}
- MsgDialogClose();
+ msgDialogClose();
// yes/no message
- msgtype mdialogyesno = MSGDIALOG_NORMAL | MSGDIALOG_BUTTON_TYPE_YESNO | MSGDIALOG_DISABLE_CANCEL_ON | MSGDIALOG_DEFAULT_CURSOR_NO;
+ msgType mdialogyesno = MSGDIALOG_NORMAL | MSGDIALOG_BUTTON_TYPE_YESNO | MSGDIALOG_DISABLE_CANCEL_ON | MSGDIALOG_DEFAULT_CURSOR_NO;
- MsgDialogOpen(mdialogyesno, "Hey!!\nYou are Happy?", my_dialog, (void *) 0x11110001, NULL);
+ msgDialogOpen(mdialogyesno, "Hey!!\nYou are Happy?", my_dialog, (void *) 0x11110001, NULL);
dialog_action = 0;
while(!dialog_action)
{
sysCheckCallback();my_flip();
}
- MsgDialogClose();
+ msgDialogClose();
response = dialog_action;
// OK message
- msgtype mdialogok = MSGDIALOG_NORMAL | MSGDIALOG_BUTTON_TYPE_OK;
+ msgType mdialogok = MSGDIALOG_NORMAL | MSGDIALOG_BUTTON_TYPE_OK;
if(response == 1)
- MsgDialogOpen(mdialogok, "I'm glad you're happy :)\nMerry Christmas!!!", my_dialog, (void *) 0x22220001, NULL);
+ msgDialogOpen(mdialogok, "I'm glad you're happy :)\nMerry Christmas!!!", my_dialog, (void *) 0x22220001, NULL);
else
- MsgDialogOpen(mdialogok, "Ok, but removes your vinegar face :p\nIt's Christmas!!!", my_dialog, (void *) 0x22220002, NULL);
+ msgDialogOpen(mdialogok, "Ok, but removes your vinegar face :p\nIt's Christmas!!!", my_dialog, (void *) 0x22220002, NULL);
dialog_action = 0;
while(!dialog_action)
{
sysCheckCallback();my_flip();
}
- MsgDialogClose();
+ msgDialogClose();
// Single Progress bar
- msgtype mdialogprogress = MSGDIALOG_SINGLE_PROGRESSBAR;
+ msgType mdialogprogress = MSGDIALOG_SINGLE_PROGRESSBAR;
happypercent = 0;
- MsgDialogOpen(mdialogprogress, "Recharging happiness batteries...", my_dialog, (void *) 0x33330001, NULL);
- MsgDialogProgressBarMessage(PROGRESSBAR_INDEX0, "You're Happy");
- MsgDialogResetProgressBar(PROGRESSBAR_INDEX0);
+ msgDialogOpen(mdialogprogress, "Recharging happiness batteries...", my_dialog, (void *) 0x33330001, NULL);
+ msgDialogProgressBarMessage(PROGRESSBAR_INDEX0, "You're Happy");
+ msgDialogResetProgressBar(PROGRESSBAR_INDEX0);
dialog_action = 0;
while(!dialog_action)
{
- MsgDialogIncProgressBar(PROGRESSBAR_INDEX0, happypercent);
+ msgDialogIncProgressBar(PROGRESSBAR_INDEX0, happypercent);
sysCheckCallback();my_flip();
if(happypercent < 100) happypercent++;
usleep(100*1000);
}
- MsgDialogClose();
+ msgDialogClose();
// Double Progress bar
mdialogprogress = MSGDIALOG_DOUBLE_PROGRESSBAR;
moneypercent = 0;
- MsgDialogOpen(mdialogprogress, "Recharging Virtual money...", my_dialog, (void *) 0x33330002, NULL);
- MsgDialogProgressBarMessage(PROGRESSBAR_INDEX0, "You're Happy");
- MsgDialogResetProgressBar(PROGRESSBAR_INDEX0);
- MsgDialogProgressBarMessage(PROGRESSBAR_INDEX1, "Virtual money");
- MsgDialogResetProgressBar(PROGRESSBAR_INDEX1);
+ msgDialogOpen(mdialogprogress, "Recharging Virtual money...", my_dialog, (void *) 0x33330002, NULL);
+ msgDialogProgressBarMessage(PROGRESSBAR_INDEX0, "You're Happy");
+ msgDialogResetProgressBar(PROGRESSBAR_INDEX0);
+ msgDialogProgressBarMessage(PROGRESSBAR_INDEX1, "Virtual money");
+ msgDialogResetProgressBar(PROGRESSBAR_INDEX1);
dialog_action = 0;
while(!dialog_action)
{
- MsgDialogIncProgressBar(PROGRESSBAR_INDEX0, happypercent);
- MsgDialogIncProgressBar(PROGRESSBAR_INDEX1, moneypercent);
+ msgDialogIncProgressBar(PROGRESSBAR_INDEX0, happypercent);
+ msgDialogIncProgressBar(PROGRESSBAR_INDEX1, moneypercent);
sysCheckCallback();my_flip();
if(happypercent < 100) happypercent++;
if(moneypercent < 100) moneypercent++;
usleep(100*1000);
}
- MsgDialogClose();
+ msgDialogClose();
// OK with delay time
- MsgDialogOpen(mdialogok, "Congratulations!!!\nYou are now happy and you have virtual money :p", my_dialog, (void *) 0x22220003, NULL);
- MsgDialogDelayedClose(3000.0f); // 3 seconds
+ msgDialogOpen(mdialogok, "Congratulations!!!\nYou are now happy and you have virtual money :p", my_dialog, (void *) 0x22220003, NULL);
+ msgDialogDelayedClose(3000.0f); // 3 seconds
dialog_action = 0;
while(!dialog_action)
{
sysCheckCallback();my_flip();
}
- MsgDialogClose();
+ msgDialogClose();
// OK with delay time
- MsgDialogOpen(mdialogok, "Good bye!!", my_dialog, (void *) 0x22220004, NULL);
- MsgDialogDelayedClose(2000.0f); // 2 seconds
+ msgDialogOpen(mdialogok, "Good bye!!", my_dialog, (void *) 0x22220004, NULL);
+ msgDialogDelayedClose(2000.0f); // 2 seconds
dialog_action = 0;
while(!dialog_action)
{
sysCheckCallback();my_flip();
}
- MsgDialogClose();
+ msgDialogClose();
}

0 comments on commit 66ce6f2

Please sign in to comment.