rpcsx/rpcs3/Emu/Cell/Modules/cellOskDialog.cpp

265 lines
8.2 KiB
C++
Raw Normal View History

#include "stdafx.h"
2016-03-21 20:43:03 +01:00
#include "Emu/Cell/PPUModule.h"
2017-05-15 13:58:32 +02:00
#include "Emu/System.h"
#include "cellSysutil.h"
#include "cellOskDialog.h"
#include "cellMsgDialog.h"
2017-05-13 20:30:37 +02:00
logs::channel cellOskDialog("cellOskDialog");
2017-01-23 19:11:42 +01:00
static char16_t s_osk_text[CELL_OSKDIALOG_STRING_SIZE];
s32 cellOskDialogLoadAsync(u32 container, vm::ptr<CellOskDialogParam> dialogParam, vm::ptr<CellOskDialogInputFieldInfo> inputFieldInfo)
{
cellOskDialog.warning("cellOskDialogLoadAsync(container=0x%x, dialogParam=*0x%x, inputFieldInfo=*0x%x)", container, dialogParam, inputFieldInfo);
2017-01-23 19:11:42 +01:00
std::memset(s_osk_text, 0, sizeof(s_osk_text));
const auto osk = Emu.GetCallbacks().get_msg_dialog();
bool result = false;
osk->on_close = [&](s32 status)
{
2017-05-15 13:58:32 +02:00
sysutil_send_system_cmd(status == CELL_MSGDIALOG_BUTTON_OK ? CELL_SYSUTIL_OSKDIALOG_FINISHED : CELL_SYSUTIL_OSKDIALOG_INPUT_CANCELED, 0);
result = true;
};
2017-03-16 10:34:47 +01:00
osk->on_osk_input_entered = [&]()
{
sysutil_send_system_cmd(CELL_SYSUTIL_OSKDIALOG_INPUT_ENTERED, 0);
};
Emu.CallAfter([&]()
{
2017-01-23 19:11:42 +01:00
osk->CreateOsk("On Screen Keyboard", s_osk_text);
});
2017-03-16 10:34:47 +01:00
sysutil_send_system_cmd(CELL_SYSUTIL_OSKDIALOG_LOADED, 0);
while (!result)
{
2017-02-05 15:06:03 +01:00
thread_ctrl::wait_for(1000);
}
2017-05-15 13:58:32 +02:00
return CELL_OK;
}
s32 cellOskDialogUnloadAsync(vm::ptr<CellOskDialogCallbackReturnParam> OutputInfo)
{
cellOskDialog.warning("cellOskDialogUnloadAsync(OutputInfo=*0x%x)", OutputInfo);
OutputInfo->result = CELL_OSKDIALOG_INPUT_FIELD_RESULT_OK;
2017-05-15 13:58:32 +02:00
for (int i = 0; i < OutputInfo->numCharsResultString; i++)
{
OutputInfo->pResultString[i] = s_osk_text[i];
}
2017-03-16 10:34:47 +01:00
sysutil_send_system_cmd(CELL_SYSUTIL_OSKDIALOG_UNLOADED, 0);
2017-05-15 13:58:32 +02:00
return CELL_OK;
}
s32 cellOskDialogGetSize(vm::ptr<u16> width, vm::ptr<u16> height, vm::ptr<CellOskDialogType> dialogType)
{
cellOskDialog.warning("cellOskDialogGetSize(width=*0x%x, height=*0x%x, dialogType=*0x%x)", width, height, dialogType);
*width = 1;
*height = 1;
2017-05-15 13:58:32 +02:00
return CELL_OK;
}
s32 cellOskDialogAbort()
{
cellOskDialog.warning("cellOskDialogAbort()");
sysutil_send_system_cmd(CELL_SYSUTIL_OSKDIALOG_FINISHED, 0);
2017-05-15 13:58:32 +02:00
return CELL_OK;
}
s32 cellOskDialogSetDeviceMask(u32 deviceMask)
{
cellOskDialog.todo("cellOskDialogSetDeviceMask(deviceMask=0x%x)", deviceMask);
2017-05-15 13:58:32 +02:00
return CELL_OK;
}
s32 cellOskDialogSetSeparateWindowOption(vm::ptr<CellOskDialogSeparateWindowOption> windowOption)
{
cellOskDialog.todo("cellOskDialogSetSeparateWindowOption(windowOption=*0x%x)", windowOption);
2017-05-15 13:58:32 +02:00
return CELL_OK;
}
s32 cellOskDialogSetInitialInputDevice(vm::ptr<CellOskDialogInputDevice> inputDevice)
{
cellOskDialog.todo("cellOskDialogSetInitialInputDevice(inputDevice=*0x%x)", inputDevice);
2017-05-15 13:58:32 +02:00
return CELL_OK;
}
s32 cellOskDialogSetInitialKeyLayout(vm::ptr<CellOskDialogInitialKeyLayout> initialKeyLayout)
{
cellOskDialog.todo("cellOskDialogSetInitialKeyLayout(initialKeyLayout=*0x%x)", initialKeyLayout);
2017-05-15 13:58:32 +02:00
return CELL_OK;
}
s32 cellOskDialogDisableDimmer()
{
cellOskDialog.todo("cellOskDialogDisableDimmer()");
2017-05-15 13:58:32 +02:00
return CELL_OK;
}
s32 cellOskDialogSetKeyLayoutOption(u32 option)
{
cellOskDialog.todo("cellOskDialogSetKeyLayoutOption(option=0x%x)", option);
2017-05-15 13:58:32 +02:00
return CELL_OK;
}
s32 cellOskDialogAddSupportLanguage(u32 supportLanguage)
{
cellOskDialog.todo("cellOskDialogAddSupportLanguage(supportLanguage=0x%x)", supportLanguage);
2017-05-15 13:58:32 +02:00
return CELL_OK;
}
s32 cellOskDialogSetLayoutMode(s32 layoutMode)
{
cellOskDialog.todo("cellOskDialogSetLayoutMode(layoutMode=%d)", layoutMode);
2017-05-15 13:58:32 +02:00
return CELL_OK;
}
s32 cellOskDialogGetInputText(vm::ptr<CellOskDialogCallbackReturnParam> OutputInfo)
{
cellOskDialog.warning("cellOskDialogGetInputText(OutputInfo=*0x%x)", OutputInfo);
return cellOskDialogUnloadAsync(OutputInfo); //Same but for use with cellOskDialogSetSeparateWindowOption(). TODO.
}
s32 cellOskDialogExtInputDeviceUnlock()
{
cellOskDialog.todo("cellOskDialogExtInputDeviceUnlock()");
2017-05-15 13:58:32 +02:00
return CELL_OK;
}
2017-01-26 15:53:07 +01:00
s32 cellOskDialogExtRegisterKeyboardEventHookCallback(u16 hookEventMode, vm::ptr<cellOskDialogHardwareKeyboardEventHookCallback> pCallback)
{
2017-01-26 15:53:07 +01:00
cellOskDialog.todo("cellOskDialogExtRegisterKeyboardEventHookCallback(hookEventMode=%u, pCallback=*0x%x)", hookEventMode, pCallback);
2017-05-15 13:58:32 +02:00
return CELL_OK;
}
2017-01-26 15:53:07 +01:00
s32 cellOskDialogExtAddJapaneseOptionDictionary(vm::cpptr<char> filePath)
{
2017-01-26 15:53:07 +01:00
cellOskDialog.todo("cellOskDialogExtAddJapaneseOptionDictionary(filePath=**0x%0x)", filePath);
2017-05-15 13:58:32 +02:00
return CELL_OK;
}
s32 cellOskDialogExtEnableClipboard()
{
cellOskDialog.todo("cellOskDialogExtEnableClipboard()");
2017-05-15 13:58:32 +02:00
return CELL_OK;
}
2017-01-26 15:53:07 +01:00
s32 cellOskDialogExtSendFinishMessage(s32 /*CellOskDialogFinishReason*/ finishReason)
{
2017-01-26 15:53:07 +01:00
cellOskDialog.todo("cellOskDialogExtSendFinishMessage(finishReason=%d)", finishReason);
2017-05-15 13:58:32 +02:00
return CELL_OK;
}
s32 cellOskDialogExtAddOptionDictionary(vm::cptr<CellOskDialogImeDictionaryInfo> dictionaryInfo)
{
cellOskDialog.todo("cellOskDialogExtAddOptionDictionary(dictionaryInfo=*0x%x)", dictionaryInfo);
2017-05-15 13:58:32 +02:00
return CELL_OK;
}
s32 cellOskDialogExtSetInitialScale(f32 initialScale)
{
2017-01-26 15:53:07 +01:00
cellOskDialog.todo("cellOskDialogExtSetInitialScale(initialScale=%f)", initialScale);
2017-05-15 13:58:32 +02:00
return CELL_OK;
}
s32 cellOskDialogExtInputDeviceLock()
{
cellOskDialog.todo("cellOskDialogExtInputDeviceLock()");
2017-05-15 13:58:32 +02:00
return CELL_OK;
}
s32 cellOskDialogExtSetBaseColor(f32 red, f32 blue, f32 green, f32 alpha)
{
2017-01-26 15:53:07 +01:00
cellOskDialog.warning("cellOskDialogExtSetBaseColor(red=%f, blue=%f, green=%f, alpha=%f)", red, blue, green, alpha);
2017-05-15 13:58:32 +02:00
return CELL_OK;
}
2017-01-26 15:53:07 +01:00
s32 cellOskDialogExtRegisterConfirmWordFilterCallback(vm::ptr<cellOskDialogConfirmWordFilterCallback> pCallback)
{
2017-01-26 15:53:07 +01:00
cellOskDialog.todo("cellOskDialogExtRegisterConfirmWordFilterCallback(pCallback=*0x%x)", pCallback);
2017-05-15 13:58:32 +02:00
return CELL_OK;
}
s32 cellOskDialogExtUpdateInputText()
{
2017-01-26 15:53:07 +01:00
cellOskDialog.todo("cellOskDialogExtUpdateInputText()");
2017-05-15 13:58:32 +02:00
return CELL_OK;
}
s32 cellOskDialogExtDisableHalfByteKana()
{
2017-01-26 15:53:07 +01:00
cellOskDialog.todo("cellOskDialogExtDisableHalfByteKana()");
2017-05-15 13:58:32 +02:00
return CELL_OK;
}
s32 cellOskDialogExtSetPointerEnable(b8 enable)
{
cellOskDialog.todo("cellOskDialogExtSetPointerEnable(enable=%d)", enable);
2017-05-15 13:58:32 +02:00
return CELL_OK;
}
s32 cellOskDialogExtUpdatePointerDisplayPos()
{
2017-01-26 15:53:07 +01:00
cellOskDialog.todo("cellOskDialogExtUpdatePointerDisplayPos"); // Missing arguments
2017-05-15 13:58:32 +02:00
return CELL_OK;
}
s32 cellOskDialogExtEnableHalfByteKana()
{
cellOskDialog.todo("cellOskDialogExtEnableHalfByteKana()");
2017-05-15 13:58:32 +02:00
return CELL_OK;
}
2017-01-26 15:53:07 +01:00
s32 cellOskDialogExtRegisterForceFinishCallback(vm::ptr<cellOskDialogForceFinishCallback> pCallback)
{
2017-01-26 15:53:07 +01:00
cellOskDialog.todo("cellOskDialogExtRegisterForceFinishCallback(pCallback=*0x%x)", pCallback);
2017-05-15 13:58:32 +02:00
return CELL_OK;
}
void cellSysutil_OskDialog_init()
{
REG_FUNC(cellSysutil, cellOskDialogLoadAsync);
REG_FUNC(cellSysutil, cellOskDialogUnloadAsync);
REG_FUNC(cellSysutil, cellOskDialogGetSize);
REG_FUNC(cellSysutil, cellOskDialogAbort);
REG_FUNC(cellSysutil, cellOskDialogSetDeviceMask);
REG_FUNC(cellSysutil, cellOskDialogSetSeparateWindowOption);
REG_FUNC(cellSysutil, cellOskDialogSetInitialInputDevice);
REG_FUNC(cellSysutil, cellOskDialogSetInitialKeyLayout);
REG_FUNC(cellSysutil, cellOskDialogDisableDimmer);
REG_FUNC(cellSysutil, cellOskDialogSetKeyLayoutOption);
REG_FUNC(cellSysutil, cellOskDialogAddSupportLanguage);
REG_FUNC(cellSysutil, cellOskDialogSetLayoutMode);
REG_FUNC(cellSysutil, cellOskDialogGetInputText);
}
2016-03-21 20:43:03 +01:00
DECLARE(ppu_module_manager::cellOskDialog)("cellOskExtUtility", []()
{
REG_FUNC(cellOskExtUtility, cellOskDialogExtInputDeviceUnlock);
REG_FUNC(cellOskExtUtility, cellOskDialogExtRegisterKeyboardEventHookCallback);
REG_FUNC(cellOskExtUtility, cellOskDialogExtAddJapaneseOptionDictionary);
REG_FUNC(cellOskExtUtility, cellOskDialogExtEnableClipboard);
REG_FUNC(cellOskExtUtility, cellOskDialogExtSendFinishMessage);
REG_FUNC(cellOskExtUtility, cellOskDialogExtAddOptionDictionary);
REG_FUNC(cellOskExtUtility, cellOskDialogExtSetInitialScale);
REG_FUNC(cellOskExtUtility, cellOskDialogExtInputDeviceLock);
REG_FUNC(cellOskExtUtility, cellOskDialogExtSetBaseColor);
REG_FUNC(cellOskExtUtility, cellOskDialogExtRegisterConfirmWordFilterCallback);
REG_FUNC(cellOskExtUtility, cellOskDialogExtUpdateInputText);
REG_FUNC(cellOskExtUtility, cellOskDialogExtDisableHalfByteKana);
REG_FUNC(cellOskExtUtility, cellOskDialogExtSetPointerEnable);
REG_FUNC(cellOskExtUtility, cellOskDialogExtUpdatePointerDisplayPos);
REG_FUNC(cellOskExtUtility, cellOskDialogExtEnableHalfByteKana);
REG_FUNC(cellOskExtUtility, cellOskDialogExtRegisterForceFinishCallback);
});