2015-07-30 03:43:03 +02:00
|
|
|
#include "stdafx.h"
|
2016-03-21 20:43:03 +01:00
|
|
|
#include "Emu/Cell/PPUModule.h"
|
2017-01-18 23:01:25 +01:00
|
|
|
#include "cellSysutil.h"
|
|
|
|
|
#include "cellOskDialog.h"
|
2017-01-23 18:14:12 +01:00
|
|
|
#include "cellMsgDialog.h"
|
|
|
|
|
#include <thread>
|
|
|
|
|
#include "Emu/System.h"
|
2015-07-30 03:43:03 +02:00
|
|
|
|
2016-05-13 15:55:34 +02:00
|
|
|
logs::channel cellOskDialog("cellOskDialog", logs::level::notice);
|
2015-07-30 03:43:03 +02:00
|
|
|
|
2017-01-23 18:14:12 +01:00
|
|
|
char16_t* osk_text;
|
|
|
|
|
|
2017-01-18 23:01:25 +01:00
|
|
|
s32 cellOskDialogLoadAsync(u32 container, vm::ptr<CellOskDialogParam> dialogParam, vm::ptr<CellOskDialogInputFieldInfo> inputFieldInfo)
|
2015-07-30 03:43:03 +02:00
|
|
|
{
|
2017-01-18 23:01:25 +01:00
|
|
|
cellOskDialog.warning("cellOskDialogLoadAsync(container=0x%x, dialogParam=*0x%x, inputFieldInfo=*0x%x)", container, dialogParam, inputFieldInfo);
|
2017-01-23 18:14:12 +01:00
|
|
|
|
|
|
|
|
osk_text = new char16_t[CELL_OSKDIALOG_STRING_SIZE];
|
|
|
|
|
std::memset(osk_text, 0, sizeof(osk_text));
|
|
|
|
|
|
|
|
|
|
const auto osk = Emu.GetCallbacks().get_msg_dialog();
|
|
|
|
|
bool result = false;
|
|
|
|
|
|
|
|
|
|
osk->on_close = [&](s32 status)
|
|
|
|
|
{
|
|
|
|
|
if (status == 1) {
|
|
|
|
|
sysutil_send_system_cmd(CELL_SYSUTIL_OSKDIALOG_FINISHED, 0);
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
sysutil_send_system_cmd(CELL_SYSUTIL_OSKDIALOG_INPUT_CANCELED, 0);
|
|
|
|
|
}
|
|
|
|
|
result = true;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
Emu.CallAfter([&]()
|
|
|
|
|
{
|
|
|
|
|
osk->CreateOsk("On Screen Keyboard", osk_text);
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
while (!result)
|
|
|
|
|
{
|
|
|
|
|
CHECK_EMU_STATUS;
|
|
|
|
|
std::this_thread::sleep_for(1ms);
|
|
|
|
|
}
|
|
|
|
|
|
2017-01-18 23:01:25 +01:00
|
|
|
return CELL_OSKDIALOG_OK;
|
2015-07-30 03:43:03 +02:00
|
|
|
}
|
|
|
|
|
|
2017-01-18 23:01:25 +01:00
|
|
|
s32 cellOskDialogUnloadAsync(vm::ptr<CellOskDialogCallbackReturnParam> OutputInfo)
|
2015-07-30 03:43:03 +02:00
|
|
|
{
|
2017-01-18 23:01:25 +01:00
|
|
|
cellOskDialog.warning("cellOskDialogUnloadAsync(OutputInfo=*0x%x)", OutputInfo);
|
|
|
|
|
OutputInfo->result = CELL_OSKDIALOG_INPUT_FIELD_RESULT_OK;
|
|
|
|
|
|
2017-01-23 18:14:12 +01:00
|
|
|
for (int i = 0; i < OutputInfo->numCharsResultString; i++) {
|
|
|
|
|
*(OutputInfo->pResultString + i) = (be_t<u16>)*(osk_text + i);
|
|
|
|
|
}
|
2017-01-18 23:01:25 +01:00
|
|
|
|
|
|
|
|
return CELL_OSKDIALOG_OK;
|
2015-07-30 03:43:03 +02:00
|
|
|
}
|
|
|
|
|
|
2017-01-18 23:01:25 +01:00
|
|
|
s32 cellOskDialogGetSize(vm::ptr<u16> width, vm::ptr<u16> height, vm::ptr<CellOskDialogType> dialogType)
|
2015-07-30 03:43:03 +02:00
|
|
|
{
|
2017-01-18 23:01:25 +01:00
|
|
|
cellOskDialog.warning("cellOskDialogGetSize(width=*0x%x, height=*0x%x, dialogType=*0x%x)", width, height, dialogType);
|
|
|
|
|
*width = 1;
|
|
|
|
|
*height = 1;
|
|
|
|
|
return CELL_OSKDIALOG_OK;
|
2015-07-30 03:43:03 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
s32 cellOskDialogAbort()
|
|
|
|
|
{
|
2017-01-23 18:14:12 +01:00
|
|
|
cellOskDialog.warning("cellOskDialogAbort()");
|
|
|
|
|
sysutil_send_system_cmd(CELL_SYSUTIL_OSKDIALOG_FINISHED, 0);
|
2017-01-18 23:01:25 +01:00
|
|
|
return CELL_OSKDIALOG_OK;
|
2015-07-30 03:43:03 +02:00
|
|
|
}
|
|
|
|
|
|
2017-01-18 23:01:25 +01:00
|
|
|
s32 cellOskDialogSetDeviceMask(u32 deviceMask)
|
2015-07-30 03:43:03 +02:00
|
|
|
{
|
2017-01-18 23:01:25 +01:00
|
|
|
cellOskDialog.todo("cellOskDialogSetDeviceMask(deviceMask=0x%x)", deviceMask);
|
|
|
|
|
return CELL_OSKDIALOG_OK;
|
2015-07-30 03:43:03 +02:00
|
|
|
}
|
|
|
|
|
|
2017-01-18 23:01:25 +01:00
|
|
|
s32 cellOskDialogSetSeparateWindowOption(vm::ptr<CellOskDialogSeparateWindowOption> windowOption)
|
2015-07-30 03:43:03 +02:00
|
|
|
{
|
2017-01-18 23:01:25 +01:00
|
|
|
cellOskDialog.todo("cellOskDialogSetSeparateWindowOption(windowOption=*0x%x)", windowOption);
|
|
|
|
|
return CELL_OSKDIALOG_OK;
|
2015-07-30 03:43:03 +02:00
|
|
|
}
|
|
|
|
|
|
2017-01-18 23:01:25 +01:00
|
|
|
s32 cellOskDialogSetInitialInputDevice(vm::ptr<CellOskDialogInputDevice> inputDevice)
|
2015-07-30 03:43:03 +02:00
|
|
|
{
|
2017-01-18 23:01:25 +01:00
|
|
|
cellOskDialog.todo("cellOskDialogSetInitialInputDevice(inputDevice=*0x%x)", inputDevice);
|
|
|
|
|
return CELL_OSKDIALOG_OK;
|
2015-07-30 03:43:03 +02:00
|
|
|
}
|
|
|
|
|
|
2017-01-18 23:01:25 +01:00
|
|
|
s32 cellOskDialogSetInitialKeyLayout(vm::ptr<CellOskDialogInitialKeyLayout> initialKeyLayout)
|
2015-07-30 03:43:03 +02:00
|
|
|
{
|
2017-01-18 23:01:25 +01:00
|
|
|
cellOskDialog.todo("cellOskDialogSetInitialKeyLayout(initialKeyLayout=*0x%x)", initialKeyLayout);
|
|
|
|
|
return CELL_OSKDIALOG_OK;
|
2015-07-30 03:43:03 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
s32 cellOskDialogDisableDimmer()
|
|
|
|
|
{
|
2017-01-18 23:01:25 +01:00
|
|
|
cellOskDialog.todo("cellOskDialogDisableDimmer()");
|
|
|
|
|
return CELL_OSKDIALOG_OK;
|
2015-07-30 03:43:03 +02:00
|
|
|
}
|
|
|
|
|
|
2017-01-18 23:01:25 +01:00
|
|
|
s32 cellOskDialogSetKeyLayoutOption(u32 option)
|
2015-07-30 03:43:03 +02:00
|
|
|
{
|
2017-01-18 23:01:25 +01:00
|
|
|
cellOskDialog.todo("cellOskDialogSetKeyLayoutOption(option=0x%x)", option);
|
|
|
|
|
return CELL_OSKDIALOG_OK;
|
2015-07-30 03:43:03 +02:00
|
|
|
}
|
|
|
|
|
|
2017-01-18 23:01:25 +01:00
|
|
|
s32 cellOskDialogAddSupportLanguage(u32 supportLanguage)
|
2015-07-30 03:43:03 +02:00
|
|
|
{
|
2017-01-18 23:01:25 +01:00
|
|
|
cellOskDialog.todo("cellOskDialogAddSupportLanguage(supportLanguage=0x%x)", supportLanguage);
|
|
|
|
|
return CELL_OSKDIALOG_OK;
|
2015-07-30 03:43:03 +02:00
|
|
|
}
|
|
|
|
|
|
2017-01-18 23:01:25 +01:00
|
|
|
s32 cellOskDialogSetLayoutMode(s32 layoutMode)
|
2015-07-30 03:43:03 +02:00
|
|
|
{
|
2017-01-18 23:01:25 +01:00
|
|
|
cellOskDialog.todo("cellOskDialogSetLayoutMode(layoutMode=%d)", layoutMode);
|
|
|
|
|
return CELL_OSKDIALOG_OK;
|
2015-07-30 03:43:03 +02:00
|
|
|
}
|
|
|
|
|
|
2017-01-18 23:01:25 +01:00
|
|
|
s32 cellOskDialogGetInputText(vm::ptr<CellOskDialogCallbackReturnParam> OutputInfo)
|
2015-07-30 03:43:03 +02:00
|
|
|
{
|
2017-01-18 23:01:25 +01:00
|
|
|
cellOskDialog.warning("cellOskDialogGetInputText(OutputInfo=*0x%x)", OutputInfo);
|
|
|
|
|
return cellOskDialogUnloadAsync(OutputInfo); //Same but for use with cellOskDialogSetSeparateWindowOption(). TODO.
|
2015-07-30 03:43:03 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
s32 cellOskDialogExtInputDeviceUnlock()
|
|
|
|
|
{
|
2017-01-18 23:01:25 +01:00
|
|
|
cellOskDialog.todo("cellOskDialogExtInputDeviceUnlock()");
|
|
|
|
|
return CELL_OSKDIALOG_OK;
|
2015-07-30 03:43:03 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
s32 cellOskDialogExtRegisterKeyboardEventHookCallback()
|
|
|
|
|
{
|
2016-08-08 18:01:06 +02:00
|
|
|
fmt::throw_exception("Unimplemented" HERE);
|
2015-07-30 03:43:03 +02:00
|
|
|
}
|
|
|
|
|
|
2017-01-18 23:01:25 +01:00
|
|
|
s32 cellOskDialogExtAddJapaneseOptionDictionary(vm::cptr<char> filePath)
|
2015-07-30 03:43:03 +02:00
|
|
|
{
|
2017-01-18 23:01:25 +01:00
|
|
|
cellOskDialog.todo("cellOskDialogExtAddJapaneseOptionDictionary(filePath=*0x%0x)", filePath);
|
|
|
|
|
return CELL_OSKDIALOG_OK;
|
2015-07-30 03:43:03 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
s32 cellOskDialogExtEnableClipboard()
|
|
|
|
|
{
|
2017-01-18 23:01:25 +01:00
|
|
|
cellOskDialog.todo("cellOskDialogExtEnableClipboard()");
|
|
|
|
|
return CELL_OSKDIALOG_OK;
|
2015-07-30 03:43:03 +02:00
|
|
|
}
|
|
|
|
|
|
2017-01-18 23:01:25 +01:00
|
|
|
s32 cellOskDialogExtSendFinishMessage(vm::ptr<CellOskDialogFinishReason> finishReason)
|
2015-07-30 03:43:03 +02:00
|
|
|
{
|
2017-01-18 23:01:25 +01:00
|
|
|
cellOskDialog.todo("cellOskDialogExtSendFinishMessage(finishReason=*0x%x)", finishReason);
|
|
|
|
|
return CELL_OSKDIALOG_OK;
|
2015-07-30 03:43:03 +02:00
|
|
|
}
|
|
|
|
|
|
2017-01-18 23:01:25 +01:00
|
|
|
s32 cellOskDialogExtAddOptionDictionary(vm::cptr<CellOskDialogImeDictionaryInfo> dictionaryInfo)
|
2015-07-30 03:43:03 +02:00
|
|
|
{
|
2017-01-18 23:01:25 +01:00
|
|
|
cellOskDialog.todo("cellOskDialogExtAddOptionDictionary(dictionaryInfo=*0x%x)", dictionaryInfo);
|
|
|
|
|
return CELL_OSKDIALOG_OK;
|
2015-07-30 03:43:03 +02:00
|
|
|
}
|
|
|
|
|
|
2017-01-18 23:01:25 +01:00
|
|
|
s32 cellOskDialogExtSetInitialScale(f32 initialScale)
|
2015-07-30 03:43:03 +02:00
|
|
|
{
|
2017-01-18 23:01:25 +01:00
|
|
|
cellOskDialog.todo("cellOskDialogExtSetInitialScale(initialScale=0x%x)", initialScale);
|
|
|
|
|
return CELL_OSKDIALOG_OK;
|
2015-07-30 03:43:03 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
s32 cellOskDialogExtInputDeviceLock()
|
|
|
|
|
{
|
2017-01-18 23:01:25 +01:00
|
|
|
cellOskDialog.todo("cellOskDialogExtInputDeviceLock()");
|
|
|
|
|
return CELL_OSKDIALOG_OK;
|
2015-07-30 03:43:03 +02:00
|
|
|
}
|
|
|
|
|
|
2017-01-18 23:01:25 +01:00
|
|
|
s32 cellOskDialogExtSetBaseColor(f32 red, f32 blue, f32 green, f32 alpha)
|
2015-07-30 03:43:03 +02:00
|
|
|
{
|
2017-01-18 23:01:25 +01:00
|
|
|
cellOskDialog.warning("cellOskDialogExtSetBaseColor(red=0x%x, blue=0x%x, green=0x%x, alpha=0x%x)", red, blue, green, alpha);
|
|
|
|
|
return CELL_OSKDIALOG_OK;
|
2015-07-30 03:43:03 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
s32 cellOskDialogExtRegisterConfirmWordFilterCallback()
|
|
|
|
|
{
|
2016-08-08 18:01:06 +02:00
|
|
|
fmt::throw_exception("Unimplemented" HERE);
|
2015-07-30 03:43:03 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
s32 cellOskDialogExtUpdateInputText()
|
|
|
|
|
{
|
2017-01-18 23:01:25 +01:00
|
|
|
cellOskDialog.todo("cellOskDialogExtUpdateInputText");
|
|
|
|
|
return CELL_OSKDIALOG_OK;
|
2015-07-30 03:43:03 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
s32 cellOskDialogExtDisableHalfByteKana()
|
|
|
|
|
{
|
2017-01-18 23:01:25 +01:00
|
|
|
cellOskDialog.todo("cellOskDialogExtDisableHalfByteKana");
|
|
|
|
|
return CELL_OSKDIALOG_OK;
|
2015-07-30 03:43:03 +02:00
|
|
|
}
|
|
|
|
|
|
2017-01-18 23:01:25 +01:00
|
|
|
s32 cellOskDialogExtSetPointerEnable(b8 enable)
|
2015-07-30 03:43:03 +02:00
|
|
|
{
|
2017-01-18 23:01:25 +01:00
|
|
|
cellOskDialog.todo("cellOskDialogExtSetPointerEnable(enable=%d)", enable);
|
|
|
|
|
return CELL_OSKDIALOG_OK;
|
2015-07-30 03:43:03 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
s32 cellOskDialogExtUpdatePointerDisplayPos()
|
|
|
|
|
{
|
2017-01-18 23:01:25 +01:00
|
|
|
cellOskDialog.todo("cellOskDialogExtUpdatePointerDisplayPos()");
|
|
|
|
|
return CELL_OSKDIALOG_OK;
|
2015-07-30 03:43:03 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
s32 cellOskDialogExtEnableHalfByteKana()
|
|
|
|
|
{
|
2017-01-18 23:01:25 +01:00
|
|
|
cellOskDialog.todo("cellOskDialogExtEnableHalfByteKana()");
|
|
|
|
|
return CELL_OSKDIALOG_OK;
|
2015-07-30 03:43:03 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
s32 cellOskDialogExtRegisterForceFinishCallback()
|
|
|
|
|
{
|
2017-01-18 23:01:25 +01:00
|
|
|
cellOskDialog.todo("cellOskDialogExtRegisterForceFinishCallback()");
|
|
|
|
|
return CELL_OSKDIALOG_OK;
|
2015-07-30 03:43:03 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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);
|
2015-07-30 03:43:03 +02:00
|
|
|
});
|