palcfg.h 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134
  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. /* Strings */
  68. PALCFG_STRING_MAX,
  69. PALCFG_ALL_MAX = PALCFG_STRING_MAX
  70. } PALCFG_ITEM;
  71. typedef enum tagPALCFG_TYPE
  72. {
  73. PALCFG_STRING,
  74. PALCFG_BOOLEAN,
  75. PALCFG_INTEGER,
  76. PALCFG_UNSIGNED,
  77. } PALCFG_TYPE;
  78. typedef union tagConfigValue
  79. {
  80. LPCSTR sValue;
  81. DWORD uValue;
  82. INT iValue;
  83. BOOL bValue;
  84. } ConfigValue;
  85. typedef struct tagConfigItem
  86. {
  87. PALCFG_ITEM Item;
  88. PALCFG_TYPE Type;
  89. const char* Name;
  90. int NameLength;
  91. const ConfigValue DefaultValue;
  92. const ConfigValue MinValue;
  93. const ConfigValue MaxValue;
  94. } ConfigItem;
  95. BOOL
  96. PAL_ParseConfigLine(
  97. const char * line,
  98. const ConfigItem ** pItem,
  99. ConfigValue * pValue
  100. );
  101. ConfigValue
  102. PAL_DefaultConfig(
  103. PALCFG_ITEM item
  104. );
  105. const char *
  106. PAL_ConfigName(
  107. PALCFG_ITEM item
  108. );
  109. BOOL
  110. PAL_LimitConfig(
  111. PALCFG_ITEM item,
  112. ConfigValue * pValue
  113. );
  114. # ifdef __cplusplus
  115. }
  116. # endif
  117. #endif