123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261 |
- /* -*- mode: c; tab-width: 4; c-basic-offset: 4; c-file-style: "linux" -*- */
- //
- // Copyright (c) 2009-2011, Wei Mingzhi <whistler_wmz@users.sf.net>.
- // Copyright (c) 2011-2017, SDLPAL development team.
- // All rights reserved.
- //
- // This file is part of SDLPAL.
- //
- // SDLPAL is free software: you can redistribute it and/or modify
- // it under the terms of the GNU General Public License as published by
- // the Free Software Foundation, either version 3 of the License, or
- // (at your option) any later version.
- //
- // This program is distributed in the hope that it will be useful,
- // but WITHOUT ANY WARRANTY; without even the implied warranty of
- // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- // GNU General Public License for more details.
- //
- // You should have received a copy of the GNU General Public License
- // along with this program. If not, see <http://www.gnu.org/licenses/>.
- //
- // palcfg.h: Configuration definition.
- // @Author: Lou Yihua <louyihua@21cn.com>, 2016.
- //
- #ifndef CONFIG_H
- #define CONFIG_H
- #include "common.h"
- #include "palcommon.h"
- #define PAL_MAX_SAMPLERATE 48000
- #define PAL_MAX_VOLUME 100
- typedef enum tagPALCFG_ITEM
- {
- PALCFG_ALL_MIN = 0,
- PALCFG_BOOLEAN_MIN = PALCFG_ALL_MIN,
- /* Booleans */
- PALCFG_FULLSCREEN = PALCFG_BOOLEAN_MIN,
- PALCFG_KEEPASPECTRATIO,
- PALCFG_LAUNCHSETTING,
- PALCFG_STEREO,
- PALCFG_USEEMBEDDEDFONTS,
- PALCFG_USESURROUNDOPL,
- PALCFG_USETOUCHOVERLAY,
- /* Booleans */
- PALCFG_BOOLEAN_MAX,
- PALCFG_INTEGER_MIN = PALCFG_BOOLEAN_MAX,
- /* Integers */
- PALCFG_SURROUNDOPLOFFSET = PALCFG_INTEGER_MIN,
- PALCFG_LOGLEVEL,
- /* Integers */
- PALCFG_INTEGER_MAX,
- PALCFG_UNSIGNED_MIN = PALCFG_INTEGER_MAX,
- /* Unsigneds */
- PALCFG_AUDIOBUFFERSIZE = PALCFG_UNSIGNED_MIN,
- PALCFG_CODEPAGE,
- PALCFG_OPLSAMPLERATE,
- PALCFG_RESAMPLEQUALITY,
- PALCFG_SAMPLERATE,
- PALCFG_MUSICVOLUME,
- PALCFG_SOUNDVOLUME,
- PALCFG_WINDOWHEIGHT,
- PALCFG_WINDOWWIDTH,
- /* Unsigneds */
- PALCFG_UNSIGNED_MAX,
- PALCFG_STRING_MIN = PALCFG_UNSIGNED_MAX,
- /* Strings */
- PALCFG_CD = PALCFG_STRING_MIN,
- PALCFG_GAMEPATH,
- PALCFG_SAVEPATH,
- PALCFG_MESSAGEFILE,
- PALCFG_BDFFILE,
- PALCFG_MUSIC,
- PALCFG_OPL,
- PALCFG_LOGFILE,
- PALCFG_RIXEXTRAINIT,
- PALCFG_CLIMIDIPLAYER,
- /* Strings */
- PALCFG_STRING_MAX,
- PALCFG_ALL_MAX = PALCFG_STRING_MAX
- } PALCFG_ITEM;
- typedef enum tagPALCFG_TYPE
- {
- PALCFG_STRING,
- PALCFG_BOOLEAN,
- PALCFG_INTEGER,
- PALCFG_UNSIGNED,
- } PALCFG_TYPE;
- typedef union tagConfigValue
- {
- LPCSTR sValue;
- DWORD uValue;
- INT iValue;
- BOOL bValue;
- } ConfigValue;
- typedef struct tagConfigItem
- {
- PALCFG_ITEM Item;
- PALCFG_TYPE Type;
- const char* Name;
- int NameLength;
- const ConfigValue DefaultValue;
- const ConfigValue MinValue;
- const ConfigValue MaxValue;
- } ConfigItem;
- typedef struct tagSCREENLAYOUT
- {
- PAL_POS EquipImageBox;
- PAL_POS EquipRoleListBox;
- PAL_POS EquipItemName;
- PAL_POS EquipItemAmount;
- PAL_POS EquipLabels[MAX_PLAYER_EQUIPMENTS];
- PAL_POS EquipNames[MAX_PLAYER_EQUIPMENTS];
- PAL_POS EquipStatusLabels[5];
- PAL_POS EquipStatusValues[5];
- PAL_POS RoleName;
- PAL_POS RoleImage;
- PAL_POS RoleExpLabel;
- PAL_POS RoleLevelLabel;
- PAL_POS RoleHPLabel;
- PAL_POS RoleMPLabel;
- PAL_POS RoleStatusLabels[5];
- PAL_POS RoleCurrExp;
- PAL_POS RoleNextExp;
- PAL_POS RoleExpSlash;
- PAL_POS RoleLevel;
- PAL_POS RoleCurHP;
- PAL_POS RoleMaxHP;
- PAL_POS RoleHPSlash;
- PAL_POS RoleCurMP;
- PAL_POS RoleMaxMP;
- PAL_POS RoleMPSlash;
- PAL_POS RoleStatusValues[5];
- PAL_POS RoleEquipImageBoxes[MAX_PLAYER_EQUIPMENTS];
- PAL_POS RoleEquipNames[MAX_PLAYER_EQUIPMENTS];
- PAL_POS RolePoisonNames[MAX_POISONS];
- PAL_POS ExtraItemDescLines;
- PAL_POS ExtraMagicDescLines;
- } SCREENLAYOUT;
- typedef struct tagCONFIGURATION
- {
- union {
- SCREENLAYOUT ScreenLayout;
- PAL_POS ScreenLayoutArray[sizeof(SCREENLAYOUT) / sizeof(PAL_POS)];
- };
- enum {
- USE_8x8_FONT = 1,
- DISABLE_SHADOW = 2,
- } ScreenLayoutFlag[sizeof(SCREENLAYOUT) / sizeof(PAL_POS)];
- /* Configurable options */
- char *pszGamePath;
- char *pszSavePath;
- char *pszMsgFile;
- char *pszBdfFile;
- char *pszCLIMIDIPlayerPath;
- char *pszLogFile;
- CODEPAGE uCodePage;
- DWORD dwWordLength;
- DWORD dwScreenWidth;
- DWORD dwScreenHeight;
- INT iSurroundOPLOffset;
- INT iAudioChannels;
- INT iSampleRate;
- INT iOPLSampleRate;
- INT iResampleQuality;
- INT iMusicVolume;
- INT iSoundVolume;
- LOGLEVEL iLogLevel;
- MUSICTYPE eMusicType;
- MUSICTYPE eCDType;
- OPLTYPE eOPLType;
- WORD wAudioBufferSize;
- BOOL fIsWIN95;
- BOOL fUseEmbeddedFonts;
- BOOL fUseSurroundOPL;
- BOOL fKeepAspectRatio;
- BOOL fFullScreen;
- BOOL fEnableJoyStick;
- BOOL fUseCustomScreenLayout;
- BOOL fLaunchSetting;
- BOOL fUseTouchOverlay;
- #if USE_RIX_EXTRA_INIT
- uint32_t *pExtraFMRegs;
- uint8_t *pExtraFMVals;
- uint32_t dwExtraLength;
- #endif
- } CONFIGURATION, *LPCONFIGURATION;
- PAL_C_LINKAGE_BEGIN
- extern CONFIGURATION gConfig;
- void
- PAL_LoadConfig(
- BOOL fFromFile
- );
- BOOL
- PAL_SaveConfig(
- void
- );
- void
- PAL_FreeConfig(
- void
- );
- BOOL
- PAL_ParseConfigLine(
- const char * line,
- const ConfigItem ** pItem,
- ConfigValue * pValue
- );
- ConfigValue
- PAL_DefaultConfig(
- PALCFG_ITEM item
- );
- const char *
- PAL_ConfigName(
- PALCFG_ITEM item
- );
- BOOL
- PAL_LimitConfig(
- PALCFG_ITEM item,
- ConfigValue * pValue
- );
- BOOL
- PAL_GetConfigItem(
- const char * szName,
- ConfigValue * pValue,
- BOOL isDefault
- );
- BOOL
- PAL_SetConfigItem(
- const char * szName,
- const ConfigValue * pValue
- );
- PAL_C_LINKAGE_END
- #endif
|