diff options
author | Simon Howard | 2010-07-28 20:39:07 +0000 |
---|---|---|
committer | Simon Howard | 2010-07-28 20:39:07 +0000 |
commit | 232fba47e0a42af8c3ec0f934eaa855163c4ee35 (patch) | |
tree | 8f346dbddf947cbaab86882d39a9952697610f81 | |
parent | b457a1c95679a878e9508211117b11c53c9e90a4 (diff) | |
download | chocolate-doom-232fba47e0a42af8c3ec0f934eaa855163c4ee35.tar.gz chocolate-doom-232fba47e0a42af8c3ec0f934eaa855163c4ee35.tar.bz2 chocolate-doom-232fba47e0a42af8c3ec0f934eaa855163c4ee35.zip |
Add config file parameter to set OPL I/O port.
Subversion-branch: /trunk/chocolate-doom
Subversion-revision: 1947
-rw-r--r-- | setup/configfile.c | 9 | ||||
-rw-r--r-- | setup/sound.c | 1 | ||||
-rw-r--r-- | setup/sound.h | 1 | ||||
-rw-r--r-- | src/m_config.c | 31 |
4 files changed, 35 insertions, 7 deletions
diff --git a/setup/configfile.c b/setup/configfile.c index 97d87aaf..6db7f710 100644 --- a/setup/configfile.c +++ b/setup/configfile.c @@ -154,9 +154,10 @@ static int snd_sbirq = 0; static int snd_sbdma = 0; static int snd_mport = 0; -typedef enum +typedef enum { DEFAULT_INT, + DEFAULT_INT_HEX, DEFAULT_STRING, DEFAULT_FLOAT, DEFAULT_KEY, @@ -269,6 +270,7 @@ static default_t extra_defaults_list[] = {"mouse_acceleration", &mouse_acceleration, DEFAULT_FLOAT, 0, 0}, {"mouse_threshold", &mouse_threshold, DEFAULT_INT, 0, 0}, {"snd_samplerate", &snd_samplerate, DEFAULT_INT, 0, 0}, + {"opl_io_port", &opl_io_port, DEFAULT_INT_HEX, 0, 0}, {"show_endoom", &show_endoom, DEFAULT_INT, 0, 0}, {"vanilla_savegame_limit", &vanilla_savegame_limit, DEFAULT_INT, 0, 0}, {"vanilla_demo_limit", &vanilla_demo_limit, DEFAULT_INT, 0, 0}, @@ -435,6 +437,10 @@ static void SaveDefaultCollection(default_collection_t *collection) fprintf(f, "%i", v); break; + case DEFAULT_INT_HEX: + fprintf(f, "0x%x", * (int *) defaults[i].location); + break; + case DEFAULT_INT: fprintf(f, "%i", * (int *) defaults[i].location); break; @@ -528,6 +534,7 @@ static void LoadDefaultCollection(default_collection_t *collection) break; case DEFAULT_INT: + case DEFAULT_INT_HEX: * (int *) def->location = ParseIntParameter(strparm); break; diff --git a/setup/sound.c b/setup/sound.c index f7a9c6d4..59df0532 100644 --- a/setup/sound.c +++ b/setup/sound.c @@ -65,6 +65,7 @@ int snd_musicdevice = SNDDEVICE_GENMIDI; int musicVolume = 15; int snd_samplerate = 22050; +int opl_io_port = 0x388; int use_libsamplerate = 0; diff --git a/setup/sound.h b/setup/sound.h index 6c366151..eb386d6f 100644 --- a/setup/sound.h +++ b/setup/sound.h @@ -44,6 +44,7 @@ extern int snd_musicdevice; extern int musicVolume; extern int snd_samplerate; +extern int opl_io_port; extern int use_libsamplerate; diff --git a/src/m_config.c b/src/m_config.c index ef9c97e8..8744e98a 100644 --- a/src/m_config.c +++ b/src/m_config.c @@ -191,6 +191,7 @@ extern int vanilla_demo_limit; extern int snd_musicdevice; extern int snd_sfxdevice; extern int snd_samplerate; +extern int opl_io_port; // controls whether to use libsamplerate for sample rate conversions @@ -208,6 +209,7 @@ static int snd_mport = 0; typedef enum { DEFAULT_INT, + DEFAULT_INT_HEX, DEFAULT_STRING, DEFAULT_FLOAT, DEFAULT_KEY, @@ -243,14 +245,19 @@ typedef struct char *filename; } default_collection_t; +#define CONFIG_VARIABLE_GENERIC(name, variable, type) \ + { #name, &variable, type, 0, 0 } + #define CONFIG_VARIABLE_KEY(name, variable) \ - { #name, &variable, DEFAULT_KEY, 0, 0 } + CONFIG_VARIABLE_GENERIC(name, variable, DEFAULT_KEY) #define CONFIG_VARIABLE_INT(name, variable) \ - { #name, &variable, DEFAULT_INT, 0, 0 } + CONFIG_VARIABLE_GENERIC(name, variable, DEFAULT_INT) +#define CONFIG_VARIABLE_INT_HEX(name, variable) \ + CONFIG_VARIABLE_GENERIC(name, variable, DEFAULT_INT_HEX) #define CONFIG_VARIABLE_FLOAT(name, variable) \ - { #name, &variable, DEFAULT_FLOAT, 0, 0 } + CONFIG_VARIABLE_GENERIC(name, variable, DEFAULT_FLOAT) #define CONFIG_VARIABLE_STRING(name, variable) \ - { #name, &variable, DEFAULT_STRING, 0, 0 } + CONFIG_VARIABLE_GENERIC(name, variable, DEFAULT_STRING) //! @begin_config_file default.cfg @@ -625,20 +632,27 @@ static default_t extra_defaults_list[] = //! // Mouse acceleration threshold. When the speed of mouse movement - // exceeds this threshold value, the speed is multiplied by an + // exceeds this threshold value, the speed is multiplied by an // acceleration factor (mouse_acceleration). // CONFIG_VARIABLE_INT(mouse_threshold, mouse_threshold), //! - // Sound output sample rate, in Hz. Typical values to use are + // Sound output sample rate, in Hz. Typical values to use are // 11025, 22050, 44100 and 48000. // CONFIG_VARIABLE_INT(snd_samplerate, snd_samplerate), //! + // The I/O port to use to access the OPL chip. Only relevant when + // using native OPL music playback. + // + + CONFIG_VARIABLE_INT_HEX(opl_io_port, opl_io_port), + + //! // If non-zero, the ENDOOM screen is displayed when exiting the // game. If zero, the ENDOOM screen is not displayed. // @@ -1178,6 +1192,10 @@ static void SaveDefaultCollection(default_collection_t *collection) fprintf(f, "%i", * (int *) defaults[i].location); break; + case DEFAULT_INT_HEX: + fprintf(f, "0x%x", * (int *) defaults[i].location); + break; + case DEFAULT_FLOAT: fprintf(f, "%f", * (float *) defaults[i].location); break; @@ -1267,6 +1285,7 @@ static void LoadDefaultCollection(default_collection_t *collection) break; case DEFAULT_INT: + case DEFAULT_INT_HEX: * (int *) def->location = ParseIntParameter(strparm); break; |