palcfg.h 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135
  1. /* -*- mode: c; tab-width: 4; c-basic-offset: 4; c-file-style: "linux" -*- */
  2. //
  3. // Copyright (c) 2016, Lou Yihua <louyihua@21cn.com>.
  4. // All rights reserved.
  5. //
  6. // This file is part of SDLPAL.
  7. //
  8. // SDLPAL is free software: you can redistribute it and/or modify
  9. // it under the terms of the GNU General Public License as published by
  10. // the Free Software Foundation, either version 3 of the License, or
  11. // (at your option) any later version.
  12. //
  13. // This program is distributed in the hope that it will be useful,
  14. // but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. // GNU General Public License for more details.
  17. //
  18. // You should have received a copy of the GNU General Public License
  19. // along with this program. If not, see <http://www.gnu.org/licenses/>.
  20. //
  21. #ifndef CONFIG_H
  22. #define CONFIG_H
  23. # ifdef __cplusplus
  24. extern "C"
  25. {
  26. # endif
  27. typedef enum tagPALCFG_ITEM
  28. {
  29. PALCFG_ALL_MIN = 0,
  30. PALCFG_BOOLEAN_MIN = PALCFG_ALL_MIN,
  31. /* Booleans */
  32. PALCFG_DOS = PALCFG_BOOLEAN_MIN,
  33. PALCFG_FULLSCREEN,
  34. PALCFG_KEEPASPECTRATIO,
  35. PALCFG_LAUNCHSETTING,
  36. PALCFG_STEREO,
  37. PALCFG_USEEMBEDDEDFONTS,
  38. PALCFG_USESURROUNDOPL,
  39. PALCFG_USETOUCHOVERLAY,
  40. /* Booleans */
  41. PALCFG_BOOLEAN_MAX,
  42. PALCFG_INTEGER_MIN = PALCFG_BOOLEAN_MAX,
  43. /* Integers */
  44. PALCFG_SURROUNDOPLOFFSET = PALCFG_INTEGER_MIN,
  45. /* Integers */
  46. PALCFG_INTEGER_MAX,
  47. PALCFG_UNSIGNED_MIN = PALCFG_INTEGER_MAX,
  48. /* Unsigneds */
  49. PALCFG_AUDIOBUFFERSIZE = PALCFG_UNSIGNED_MIN,
  50. PALCFG_CODEPAGE,
  51. PALCFG_OPLSAMPLERATE,
  52. PALCFG_RESAMPLEQUALITY,
  53. PALCFG_SAMPLERATE,
  54. PALCFG_VOLUME,
  55. PALCFG_WINDOWHEIGHT,
  56. PALCFG_WINDOWWIDTH,
  57. /* Unsigneds */
  58. PALCFG_UNSIGNED_MAX,
  59. PALCFG_STRING_MIN = PALCFG_UNSIGNED_MAX,
  60. /* Strings */
  61. PALCFG_CD = PALCFG_STRING_MIN,
  62. PALCFG_GAMEPATH,
  63. PALCFG_MESSAGEFILE,
  64. PALCFG_MUSIC,
  65. PALCFG_OPL,
  66. PALCFG_RIXEXTRAINIT,
  67. PALCFG_SAVEPATH,
  68. /* Strings */
  69. PALCFG_STRING_MAX,
  70. PALCFG_ALL_MAX = PALCFG_STRING_MAX
  71. } PALCFG_ITEM;
  72. typedef enum tagPALCFG_TYPE
  73. {
  74. PALCFG_STRING,
  75. PALCFG_BOOLEAN,
  76. PALCFG_INTEGER,
  77. PALCFG_UNSIGNED,
  78. } PALCFG_TYPE;
  79. typedef union tagConfigValue
  80. {
  81. LPCSTR sValue;
  82. DWORD uValue;
  83. INT iValue;
  84. BOOL bValue;
  85. } ConfigValue;
  86. typedef struct tagConfigItem
  87. {
  88. PALCFG_ITEM Item;
  89. PALCFG_TYPE Type;
  90. const char* Name;
  91. int NameLength;
  92. const ConfigValue DefaultValue;
  93. const ConfigValue MinValue;
  94. const ConfigValue MaxValue;
  95. } ConfigItem;
  96. BOOL
  97. PAL_ParseConfigLine(
  98. const char * line,
  99. const ConfigItem ** pItem,
  100. ConfigValue * pValue
  101. );
  102. ConfigValue
  103. PAL_DefaultConfig(
  104. PALCFG_ITEM item
  105. );
  106. const char *
  107. PAL_ConfigName(
  108. PALCFG_ITEM item
  109. );
  110. BOOL
  111. PAL_LimitConfig(
  112. PALCFG_ITEM item,
  113. ConfigValue * pValue
  114. );
  115. # ifdef __cplusplus
  116. }
  117. # endif
  118. #endif