Advertisement
IndieDeveloper

c++ engine keyboard 1.07

May 8th, 2016
171
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.13 KB | None | 0 0
  1. // 1.07 BOIII
  2. 0x59DE1C - void OSK(int localClientNum, const wchar_t *title, const wchar_t *presetMessage, unsigned int lenght, void(*completeFunction)(int localClientNum, const wchar_t *wstring, unsigned int textLenght, bool ifCanceled), int panelMode);
  3. size_t StringToWideCharacter(wchar_t *dest, const char *scr, size_t len)
  4. {
  5. int count = 0;
  6. if (len)
  7. {
  8. do
  9. {
  10. if ((*dest++ = (wchar_t)*scr++) == 0)
  11. break;
  12. count++;
  13. } while (--len);
  14. }
  15. return count;
  16. }
  17. size_t WideCharacterToString(char *dest, const wchar_t *scr, size_t len)
  18. {
  19. int count = 0;
  20. if (len)
  21. {
  22. do
  23. {
  24. if ((*dest++ = (char)*scr++) == 0)
  25. break;
  26. count++;
  27. } while (--len);
  28. }
  29. return count;
  30. }
  31. void KeyboardComplete(int localClientNum, const wchar_t *wText, int textLenght, bool ifCanceled)
  32. {
  33. if (!ifCanceled)
  34. {
  35. char textBuffer[0x400];
  36. if (WideCharacterToString(textBuffer, wText, 0x400))
  37. {
  38. Cbuf_AddText(localClientNum, textBuffer);
  39.  
  40. // put stuff you want to exec here (I would define what you are using with a switch or if statement)
  41. }
  42. }
  43. }
  44. void DrawKeyboard(const char *title, const char *presetMessage, unsigned int len, int panelMode)
  45. {
  46. *(bool*)0xE33724 = true;
  47. wchar_t titleBuffer[0x400], presetMessageBuffer[0x400];
  48. StringToWideCharacter(titleBuffer, title, 0x400);
  49. StringToWideCharacter(presetMessageBuffer, presetMessage, 0x400);
  50. OSK(0, titleBuffer, presetMessageBuffer, len, KeyboardComplete, panelMode);
  51. }
  52. // Example:
  53. // Alphabet
  54. DrawKeyboard("ABCD...", "", 0x100, CELL_OSKDIALOG_PANELMODE_ALPHABET);
  55. // Numeral
  56. DrawKeyboard("1234...", "", 0x100, CELL_OSKDIALOG_PANELMODE_NUMERAL);
  57. // Look in the PS3 SDK if you want other panelMode types
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement