mirror of
https://github.com/libretro/ppsspp.git
synced 2024-11-29 03:10:28 +00:00
Implement sceUtilityMsgDialog
This commit is contained in:
parent
5596b98529
commit
75412b064b
@ -46,7 +46,6 @@ struct CtrlLatch {
|
||||
};
|
||||
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// STATE BEGIN
|
||||
static bool ctrlInited = false;
|
||||
@ -79,6 +78,12 @@ void UpdateLatch() {
|
||||
oldButtons = ctrl.buttons;
|
||||
}
|
||||
|
||||
|
||||
u32 __CtrlPeekButtons()
|
||||
{
|
||||
return ctrl.buttons;
|
||||
}
|
||||
|
||||
// Functions so that the rest of the emulator can control what the sceCtrl interface should return
|
||||
// to the game:
|
||||
|
||||
|
@ -36,3 +36,6 @@ void __CtrlButtonDown(u32 buttonBit);
|
||||
void __CtrlButtonUp(u32 buttonBit);
|
||||
// -1 to 1, try to keep it in the circle
|
||||
void __CtrlSetAnalog(float x, float y);
|
||||
|
||||
// For use by internal UI like MsgDialog
|
||||
u32 __CtrlPeekButtons();
|
@ -131,6 +131,13 @@ void hleEnterVblank(u64 userdata, int cyclesLate)
|
||||
|
||||
// Draw screen overlays before blitting. Saves and restores the Ge context.
|
||||
|
||||
/*
|
||||
if (g_Config.bShowGPUStats)
|
||||
{
|
||||
char stats[512];
|
||||
sprintf(stats, "Draw calls")
|
||||
}*/
|
||||
|
||||
/*
|
||||
PPGeBegin();
|
||||
PPGeDrawImage(I_LOGO, 5, 5, 0, 0xFFFFFFFF);
|
||||
|
@ -290,13 +290,15 @@ struct pspMessageDialog
|
||||
u32 buttonPressed; // 0=?, 1=Yes, 2=No, 3=Back
|
||||
};
|
||||
|
||||
static pspMessageDialog messageDialog;
|
||||
u32 messageDialogAddr;
|
||||
|
||||
void sceUtilityMsgDialogInitStart()
|
||||
{
|
||||
u32 structAddr = PARAM(0);
|
||||
DEBUG_LOG(HLE,"FAKE sceUtilityMsgDialogInitStart(%i)", structAddr);
|
||||
Memory::ReadStruct(structAddr, &messageDialog);
|
||||
messageDialogAddr = structAddr;
|
||||
pspMessageDialog messageDialog;
|
||||
Memory::ReadStruct(messageDialogAddr, &messageDialog);
|
||||
if (messageDialog.type == 0) // number
|
||||
{
|
||||
INFO_LOG(HLE, "MsgDialog: %08x", messageDialog.errorNum);
|
||||
@ -317,11 +319,78 @@ void sceUtilityMsgDialogShutdownStart()
|
||||
|
||||
void sceUtilityMsgDialogUpdate()
|
||||
{
|
||||
DEBUG_LOG(HLE,"FAKE sceUtilityMsgDialogUpdate(%i)", PARAM(0));
|
||||
__UtilityUpdate();
|
||||
// PPGeBegin();
|
||||
|
||||
// PPGeEnd();
|
||||
DEBUG_LOG(HLE,"sceUtilityMsgDialogUpdate(%i)", PARAM(0));
|
||||
|
||||
switch (utilityDialogState) {
|
||||
case SCE_UTILITY_STATUS_FINISHED:
|
||||
utilityDialogState = SCE_UTILITY_STATUS_SHUTDOWN;
|
||||
break;
|
||||
}
|
||||
|
||||
if (utilityDialogState != SCE_UTILITY_STATUS_RUNNING)
|
||||
{
|
||||
RETURN(0);
|
||||
return;
|
||||
}
|
||||
|
||||
pspMessageDialog messageDialog;
|
||||
Memory::ReadStruct(messageDialogAddr, &messageDialog);
|
||||
const char *text;
|
||||
if (messageDialog.type == 0) {
|
||||
char temp[256];
|
||||
sprintf(temp, "Error code: %08x", messageDialog.errorNum);
|
||||
text = temp;
|
||||
} else {
|
||||
text = messageDialog.string;
|
||||
}
|
||||
|
||||
PPGeBegin();
|
||||
|
||||
PPGeDraw4Patch(I_BUTTON, 0, 0, 480, 272, 0xcFFFFFFF);
|
||||
PPGeDrawText(text, 50, 50, PPGE_ALIGN_LEFT, 0.5f, 0xFFFFFFFF);
|
||||
|
||||
static u32 lastButtons = 0;
|
||||
u32 buttons = __CtrlPeekButtons();
|
||||
|
||||
if (messageDialog.options & 0x10) //yesnobutton
|
||||
{
|
||||
PPGeDrawImage(I_CROSS, 80, 220, 0, 0xFFFFFFFF);
|
||||
PPGeDrawText("Yes", 140, 220, PPGE_ALIGN_HCENTER, 1.0f, 0xFFFFFFFF);
|
||||
PPGeDrawImage(I_CIRCLE, 200, 220, 0, 0xFFFFFFFF);
|
||||
PPGeDrawText("No", 260, 220, PPGE_ALIGN_HCENTER, 1.0f, 0xFFFFFFFF);
|
||||
PPGeDrawImage(I_TRIANGLE, 320, 220, 0, 0xcFFFFFFF);
|
||||
PPGeDrawText("Back", 380, 220, PPGE_ALIGN_HCENTER, 1.0f, 0xcFFFFFFF);
|
||||
if (!lastButtons) {
|
||||
if (buttons & CTRL_TRIANGLE) {
|
||||
messageDialog.buttonPressed = 3; // back
|
||||
utilityDialogState = SCE_UTILITY_STATUS_FINISHED;
|
||||
} else if (buttons & CTRL_CROSS) {
|
||||
messageDialog.buttonPressed = 1;
|
||||
utilityDialogState = SCE_UTILITY_STATUS_FINISHED;
|
||||
} else if (buttons & CTRL_CIRCLE) {
|
||||
messageDialog.buttonPressed = 2;
|
||||
utilityDialogState = SCE_UTILITY_STATUS_FINISHED;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
PPGeDrawImage(I_CROSS, 150, 220, 0, 0xFFFFFFFF);
|
||||
PPGeDrawText("OK", 480/2, 220, PPGE_ALIGN_HCENTER, 1.0f, 0xFFFFFFFF);
|
||||
if (!lastButtons) {
|
||||
if (buttons & (CTRL_CROSS | CTRL_CIRCLE)) { // accept both
|
||||
messageDialog.buttonPressed = 1;
|
||||
utilityDialogState = SCE_UTILITY_STATUS_FINISHED;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
lastButtons = buttons;
|
||||
|
||||
Memory::WriteStruct(messageDialogAddr, &messageDialog);
|
||||
|
||||
PPGeEnd();
|
||||
|
||||
RETURN(0);
|
||||
}
|
||||
|
||||
|
@ -55,11 +55,11 @@ enum {
|
||||
// These functions must be called between PPGeBegin and PPGeEnd.
|
||||
|
||||
// Draws some text using the one font we have.
|
||||
void PPGeDrawText(const char *text, float x, float y, int align, float scale, u32 color);
|
||||
void PPGeDrawText(const char *text, float x, float y, int align, float scale = 1.0f, u32 color = 0xFFFFFFFF);
|
||||
|
||||
// Draws a "4-patch" for button-like things that can be resized
|
||||
void PPGeDraw4Patch(int atlasImage, float x, float y, float w, float h, u32 color);
|
||||
void PPGeDraw4Patch(int atlasImage, float x, float y, float w, float h, u32 color = 0xFFFFFFFF);
|
||||
|
||||
// Just blits an image to the screen, multiplied with the color.
|
||||
void PPGeDrawImage(int atlasImage, float x, float y, int align, u32 color);
|
||||
void PPGeDrawImage(int atlasImage, float x, float y, int align, u32 color = 0xFFFFFFFF);
|
||||
|
||||
|
@ -113,8 +113,8 @@ u32 GLES_GPU::EnqueueList(u32 listpc, u32 stall)
|
||||
{
|
||||
DisplayList dl;
|
||||
dl.id = dlIdGenerator++;
|
||||
dl.listpc = listpc&0xFFFFFFF;
|
||||
dl.stall = stall&0xFFFFFFF;
|
||||
dl.listpc = listpc & 0xFFFFFFF;
|
||||
dl.stall = stall & 0xFFFFFFF;
|
||||
dlQueue.push_back(dl);
|
||||
if (!ProcessDLQueue())
|
||||
return dl.id;
|
||||
|
Loading…
Reference in New Issue
Block a user