pal_utils.c 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. #include "main.h"
  2. #include <fat.h>
  3. static int input_event_filter(const SDL_Event *lpEvent, PALINPUTSTATE *state)
  4. {
  5. switch (lpEvent->type)
  6. {
  7. case SDL_JOYHATMOTION:
  8. switch (lpEvent->jhat.value)
  9. {
  10. case SDL_HAT_LEFT:
  11. state->prevdir = (gpGlobals->fInBattle ? kDirUnknown : state->dir);
  12. state->dir = kDirWest;
  13. state->dwKeyPress = kKeyLeft;
  14. break;
  15. case SDL_HAT_RIGHT:
  16. state->prevdir = (gpGlobals->fInBattle ? kDirUnknown : state->dir);
  17. state->dir = kDirEast;
  18. state->dwKeyPress = kKeyRight;
  19. break;
  20. case SDL_HAT_UP:
  21. state->prevdir = (gpGlobals->fInBattle ? kDirUnknown : state->dir);
  22. state->dir = kDirNorth;
  23. state->dwKeyPress = kKeyUp;
  24. break;
  25. case SDL_HAT_DOWN:
  26. state->prevdir = (gpGlobals->fInBattle ? kDirUnknown : state->dir);
  27. state->dir = kDirSouth;
  28. state->dwKeyPress = kKeyDown;
  29. break;
  30. }
  31. return 1;
  32. case SDL_JOYBUTTONDOWN:
  33. switch (lpEvent->jbutton.button)
  34. {
  35. case 2:
  36. state->dwKeyPress |= kKeyMenu;
  37. return 1;
  38. case 3:
  39. state->dwKeyPress |= kKeySearch;
  40. return 1;
  41. }
  42. }
  43. return 0;
  44. }
  45. BOOL
  46. UTIL_GetScreenSize(
  47. DWORD *pdwScreenWidth,
  48. DWORD *pdwScreenHeight
  49. )
  50. {
  51. return FALSE;
  52. }
  53. BOOL
  54. UTIL_IsAbsolutePath(
  55. LPCSTR lpszFileName
  56. )
  57. {
  58. return FALSE;
  59. }
  60. INT
  61. UTIL_Platform_Init(
  62. int argc,
  63. char* argv[]
  64. )
  65. {
  66. fatInitDefault();
  67. PAL_RegisterInputFilter(NULL, input_event_filter, NULL);
  68. gConfig.fLaunchSetting = FALSE;
  69. return 0;
  70. }
  71. VOID
  72. UTIL_Platform_Quit(
  73. VOID
  74. )
  75. {
  76. }