setting ResolutionCap to limit the actual screen resolution

This commit is contained in:
Jens Hemprich 2007-02-09 22:39:59 +00:00
parent 8e1801a702
commit e1fb42b75b
5 changed files with 224 additions and 203 deletions

View File

@ -47,7 +47,7 @@ GlideSettings::IOErr GlideSettingsFSp::makeSettingsFolderFileSpec(const char* pa
/** /**
* Find/Create settings folder * Find/Create settings folder
* @return fnfErr means the CLassic environment wasn't found * @return fnfErr means the Classic environment wasn't found
*/ */
GlideSettings::IOErr GlideSettingsFSp::init(const char* applicationname) GlideSettings::IOErr GlideSettingsFSp::init(const char* applicationname)
{ {
@ -71,6 +71,7 @@ GlideSettings::IOErr GlideSettingsFSp::init(const char* applicationname)
} }
} }
// Make references to various files // Make references to various files
m_fsSettingsFile.vRefNum = 0;
if (err == noErr) if (err == noErr)
{ {
err = makeSettingsFolderFileSpec(&s_SettingsFolderName[1], s_LogFileName, &m_fsLogFile); err = makeSettingsFolderFileSpec(&s_SettingsFolderName[1], s_LogFileName, &m_fsLogFile);
@ -79,7 +80,6 @@ GlideSettings::IOErr GlideSettingsFSp::init(const char* applicationname)
err = makeSettingsFolderFileSpec(&s_SettingsFolderName[1], s_DefaultSettingsFileName, &m_fsDefaultSettingsFile); err = makeSettingsFolderFileSpec(&s_SettingsFolderName[1], s_DefaultSettingsFileName, &m_fsDefaultSettingsFile);
if (err == noErr) if (err == noErr)
{ {
m_fsSettingsFile.vRefNum = 0;
if (applicationname) if (applicationname)
{ {
err = makeSettingsFolderFileSpec(&s_SettingsFolderName[1], applicationname, &m_fsSettingsFile); err = makeSettingsFolderFileSpec(&s_SettingsFolderName[1], applicationname, &m_fsSettingsFile);
@ -143,7 +143,7 @@ GlideSettings::IOErr GlideSettingsFSp::read_settings_from_file(FSSpec* file, Gli
err = save(); err = save();
if (err == noErr) if (err == noErr)
{ {
// Now we have o load the file into memory to make the settings reader happy // Now we have to load the file into memory to make the settings reader happy
err = read_file(file, &m_FileBuffer, &m_FileBufferSize, &m_SettingsFileRefnum); err = read_file(file, &m_FileBuffer, &m_FileBufferSize, &m_SettingsFileRefnum);
} }
} }

View File

@ -26,7 +26,6 @@ protected:
IOErr create(); IOErr create();
IOErr read_defaults(); IOErr read_defaults();
IOErr read(); IOErr read();
inline bool isApplicationSpecific() {return m_fsSettingsFile.vRefNum != 0;};
IOErr put_raw(const char* string); IOErr put_raw(const char* string);
IOErr close(); IOErr close();
const unsigned char* PascalString(char* string); const unsigned char* PascalString(char* string);

View File

@ -63,6 +63,11 @@ bool GlideSettings::get(const char* setting, const char** value)
sscanf(v, "%255s", buffer); sscanf(v, "%255s", buffer);
found = true; found = true;
} }
else
{
// Wrong match, maybe a comment
v++;
}
} }
} }
*value = buffer; *value = buffer;
@ -127,6 +132,7 @@ void GlideSettings::defaults()
// OpenGL extensions that can be disabled via the config file must be set to // OpenGL extensions that can be disabled via the config file must be set to
// true in order to become enabled in ValidateUserConfig() // true in order to become enabled in ValidateUserConfig()
Resolution = 1; Resolution = 1;
ResolutionCap = 0;
MonitorRefreshRate = 0; MonitorRefreshRate = 0;
DepthBufferBits = 0; DepthBufferBits = 0;
FullSceneAntiAliasing = 0; FullSceneAntiAliasing = 0;
@ -140,29 +146,29 @@ void GlideSettings::defaults()
#endif #endif
ColorAlphaRenderMode = OpenGLideColorAlphaRenderMode_Automatic; ColorAlphaRenderMode = OpenGLideColorAlphaRenderMode_Automatic;
PrecisionFix = 1; PrecisionFix = 1;
/* /*
// Not bad // Not bad
GapFix = static_cast<OpenGLideGapFixFlags>(OpenGLideGapFixFlag_Enabled | GapFix = static_cast<OpenGLideGapFixFlags>(OpenGLideGapFixFlag_IncircleOr |
OpenGLideGapFixFlag_IncircleOr |
OpenGLideGapFixFlag_DepthFactor); OpenGLideGapFixFlag_DepthFactor);
GapFixParam1 = 3.0f; GapFixParam1 = 3.0f;
GapFixParam2 = 10.0f; GapFixParam2 = 10.0f;
GapFixParam3 = 3.0f; GapFixParam3 = 3.0f;
GapFixDepthFactor = 3.3f; GapFixDepthFactor = 3.3f;
*/ */
/* /*
// But this one is better // But this one is better
GapFix = static_cast<OpenGLideGapFixFlags>(OpenGLideGapFixFlag_Enabled | GapFix = static_cast<OpenGLideGapFixFlags>(OpenGLideGapFixFlag_VertexLengthSecondRadius |
OpenGLideGapFixFlag_VertexLengthSecondRadius |
OpenGLideGapFixFlag_DepthFactor); OpenGLideGapFixFlag_DepthFactor);
GapFixParam1 = 3.0f; GapFixParam1 = 3.0f;
GapFixParam2 = 25.0f; GapFixParam2 = 25.0f;
GapFixParam3 = 0.9f; GapFixParam3 = 0.9f;
GapFixDepthFactor = 3.3f; GapFixDepthFactor = 3.3f;
*/ */
// @todo: Let's make this even more better
GapFix = static_cast<OpenGLideGapFixFlags>(/*OpenGLideGapFixFlag_Enabled |*/ // @todo: Let's improve these default values even more
OpenGLideGapFixFlag_VertexLengthSecondRadius | GapFix = static_cast<OpenGLideGapFixFlags>(OpenGLideGapFixFlag_VertexLengthSecondRadius |
OpenGLideGapFixFlag_DepthFactor); OpenGLideGapFixFlag_DepthFactor);
GapFixParam1 = 3.0f; GapFixParam1 = 3.0f;
GapFixParam2 = 25.0f; GapFixParam2 = 25.0f;
@ -215,11 +221,11 @@ GlideSettings::IOErr GlideSettings::read_settings()
#ifdef OGL_DEBUG #ifdef OGL_DEBUG
GlideMsg("Reading values...\n"); GlideMsg("Reading values...\n");
#endif #endif
GlideSettings::IOErr err = noErr;
unsigned long value; unsigned long value;
get("DisplayMode", &value); get("DisplayMode", &value);
DisplayMode = static_cast<OpenGLideDisplayMode>(value); DisplayMode = static_cast<OpenGLideDisplayMode>(value);
get("Resolution", &Resolution); get("Resolution", &Resolution);
get("ResolutionCap", &ResolutionCap);
get("MonitorRefreshRate", &MonitorRefreshRate); get("MonitorRefreshRate", &MonitorRefreshRate);
get("DepthBufferBits", &DepthBufferBits); get("DepthBufferBits", &DepthBufferBits);
get("Mipmapping", &Mipmapping); get("Mipmapping", &Mipmapping);
@ -257,7 +263,7 @@ GlideSettings::IOErr GlideSettings::read_settings()
get("ShamelessPlug", &ShamelessPlug); get("ShamelessPlug", &ShamelessPlug);
get("UseApplicationSpecificSettings", &UseApplicationSpecificSettings); get("UseApplicationSpecificSettings", &UseApplicationSpecificSettings);
get("AutoEnableGameSpecificSettings", &AutoEnableGameSpecificSettings); get("AutoEnableGameSpecificSettings", &AutoEnableGameSpecificSettings);
return err; return noErr;
} }
GlideSettings::IOErr GlideSettings::load() GlideSettings::IOErr GlideSettings::load()
@ -279,29 +285,35 @@ GlideSettings::IOErr GlideSettings::load()
} }
if (success && strcmp(version, prefs_version) == 0) if (success && strcmp(version, prefs_version) == 0)
{ {
// Version match
err = read_settings(); err = read_settings();
} }
else if (!success) else if (!success)
{ {
GlideMsg(version_complaint, "default"); // Unable to read settings file version information - somethings seriously wrong
GlideError(version_complaint, "default");
} }
else else
{ {
// Write new settings file after settings file version change
GlideMsg("Configuration outdated - Creating new default settings %s...\n", prefs_version); GlideMsg("Configuration outdated - Creating new default settings %s...\n", prefs_version);
defaults(); defaults();
err = create_defaults(); err = create_defaults();
if (err == noErr) if (err == noErr)
{ {
err = saveSettings(); err = save();
} }
} }
if (err == noErr) if (err == noErr)
{ {
if (isApplicationSpecific() && UseApplicationSpecificSettings) // Default or application specific config?
if (UseApplicationSpecificSettings)
{ {
// Read application specific config
err = read(); err = read();
if (err == noErr) if (err == noErr)
{ {
// Version check
success = get("Version", &version); success = get("Version", &version);
if (success && strcmp(version, prefs_version) == 0) if (success && strcmp(version, prefs_version) == 0)
{ {
@ -314,16 +326,18 @@ GlideSettings::IOErr GlideSettings::load()
} }
else if (!success) else if (!success)
{ {
GlideMsg(version_complaint, "application specific"); // Unable to read settings file version information - somethings seriously wrong
GlideError(version_complaint, "application specific");
} }
else else
{ {
// Write new settings file after settings file version change
GlideMsg("Configuration outdated - Creating new application specific settings %s...\n", prefs_version); GlideMsg("Configuration outdated - Creating new application specific settings %s...\n", prefs_version);
defaults(); defaults();
err = create(); err = create();
if (err == noErr) if (err == noErr)
{ {
err = saveSettings(); err = save();
} }
} }
} }
@ -338,171 +352,182 @@ GlideSettings::IOErr GlideSettings::saveSettings()
#ifdef OGL_DEBUG #ifdef OGL_DEBUG
GlideMsg("Saving...\n"); GlideMsg("Saving...\n");
#endif #endif
put("Configuration File for MacGLide"); IOErr err = put("Configuration File for MacGLide");
put(); if (err == noErr)
put(); {
put("Current version number of the settings file:" ); put();
put("Version", OpenGLidePreferencesVersion); put();
put(); put("Current version number of the settings file:" );
put("Enable to apply application specific settings:"); put("Version", OpenGLidePreferencesVersion);
put("UseApplicationSpecificSettings", UseApplicationSpecificSettings); put();
put(); put("Enable to apply application specific settings:");
put("Video settings"); put("UseApplicationSpecificSettings", UseApplicationSpecificSettings);
put(); put();
put("Fullscreen display:"); put("Video settings");
put("0 for windowed mode, 1 for fullscreen display"); put();
put("DisplayMode", static_cast<unsigned long>(DisplayMode)); put("Fullscreen display:");
put(); put("0 for windowed mode, 1 for fullscreen display");
put("Display resolution:"); put("DisplayMode", static_cast<unsigned long>(DisplayMode));
put("1-8: Multiplier for Glide resolution as requested by the"); put();
put("game/application. Any value equal or greater than 512:"); put("Display resolution:");
put("fixed x resolution (y is computed for a 4/3 aspect ratio)"); put("0: Always use the resolution denoted by the ResolutionCap settings");
put("Resolution", Resolution); put("1-8: Multiplier for Glide resolution as requested by the");
put(); put("game/application. Any value equal or greater than 512:");
put("Refresh rate of the monitor:"); put("fixed x resolution (y is computed for a 4/3 aspect ratio)");
put("0 to use the Glide refresh rate as requested by the game/"); put("Resolution", Resolution);
put("application. Any other value equal or greater than 60(Hz):"); put();
put("Use fixed refresh rate"); put("Display resolution cap:");
put("MonitorRefreshRate", MonitorRefreshRate); put("0 to disable, otherwise the maximum");
put(); put("x resolution to use for the Glide display");
put("Gamma bias value for the Glide display:"); put("(y is computed for a 4/3 aspect ratio)");
put("Most games adjust the gamma correction of the display."); put("ResolutionCap", ResolutionCap);
put("For certain monitors and LCD display the resulting gamma"); put();
put("correction might be too bright (probably because the"); put("Refresh rate of the monitor:");
put("3Dfx-Hardware was never supposed to work with LCD displays)."); put("0 to use the Glide refresh rate as requested by the game/");
put("Although most games provide a way to adjust the gamma"); put("application. Any other value equal or greater than 60(Hz):");
put("correction via their configuration dialog, it might be"); put("Use fixed refresh rate");
put("necessary to set a reasonable default bias value."); put("MonitorRefreshRate", MonitorRefreshRate);
put("Reasonable bias values are -1.0 to 1.0."); put();
put("GammaBias", GammaBias); put("Gamma bias value for the Glide display:");
put(); put("Most games adjust the gamma correction of the display.");
put("Mip-Mapping: 0 to disable, 1 to enable mipmapped textures"); put("For certain monitors and LCD display the resulting gamma");
put("Mipmapping", Mipmapping); put("correction might be too bright (probably because the");
put(); put("3Dfx-Hardware was never supposed to work with LCD displays).");
put("Anisotropic filtering:"); put("Although most games provide a way to adjust the gamma");
put("0 or 1 to disable, 2, 4, 8, 16 to specify the quality"); put("correction via their configuration dialog, it might be");
put("level of anisotropic filtering"); put("necessary to set a reasonable default bias value.");
put("AnisotropylLevel", AnisotropylLevel); put("Reasonable bias values are -1.0 to 1.0.");
put(); put("GammaBias", GammaBias);
put("Fullscene antialiasing:"); put();
put("0 to disable, any other value to set number of samples to use"); put("Mip-Mapping: 0 to disable, 1 to enable mipmapped textures");
put("for antialiasing (currently this works with ATI cards only)"); put("Mipmapping", Mipmapping);
put("FullSceneAntiAliasing", FullSceneAntiAliasing); put();
put(); put("Anisotropic filtering:");
put(); put("0 or 1 to disable, 2, 4, 8, 16 to specify the quality");
put("Game specific settings (usually set automatically per application"); put("level of anisotropic filtering");
put(); put("AnisotropylLevel", AnisotropylLevel);
put("Enable game specific settings automatically:"); put();
put("0 to disable, 1 to automatically certain enable game specific settings"); put("Fullscene antialiasing:");
put("The settings in this section don't work with all games. To avoid"); put("0 to disable, any other value to set number of samples to use");
put("problems, these settings are usually set individually for each game."); put("for antialiasing (currently this works with ATI cards only)");
put("AutoEnableGameSpecificSettings", AutoEnableGameSpecificSettings); put("FullSceneAntiAliasing", FullSceneAntiAliasing);
put(); put();
put("Texture smoothing:"); put();
put("0 to disable, 1 to enable texture filtering. Overrides Glide"); put("Game specific settings (usually set automatically per application");
put("texture filter settings in order to suppress blocky pixels."); put();
put("Some games don't like these filter settings to be changed, for"); put("Enable game specific settings automatically:");
put("instance horizontal and vertical gaps may appear in texture-based"); put("0 to disable, 1 to automatically certain enable game specific settings");
put("menu screens"); put("The settings in this section don't work with all games. To avoid");
put("TextureSmoothing", TextureSmoothing); put("problems, these settings are usually set individually for each game.");
put(); put("AutoEnableGameSpecificSettings", AutoEnableGameSpecificSettings);
put("Texture artefact optimisation for Tomb Raider 1 & 2:"); put();
put("Tomb Raider joins a number of texture images within a"); put("Texture smoothing:");
put("larger texture object. In conjunction with ansisotropic"); put("0 to disable, 1 to enable texture filtering. Overrides Glide");
put("filtering and mipmapping this cause artefacts at the"); put("texture filter settings in order to suppress blocky pixels.");
put("edges of single tiles/triangles."); put("Some games don't like these filter settings to be changed, for");
put("0 to disable, n (power of 2) to place each texture image"); put("instance horizontal and vertical gaps may appear in texture-based");
put("into a seperate OpenGL texture object. The value determines"); put("menu screens");
put("the grid points and the minimal size of the generated"); put("TextureSmoothing", TextureSmoothing);
put("OpenGL textures."); put();
put("GenerateSubTextures", GenerateSubTextures); put("Texture artefact optimisation for Tomb Raider 1 & 2:");
put(); put("Tomb Raider joins a number of texture images within a");
put("Vertex gapfix optimisation for Tomb Raider 1 & 2:"); put("larger texture object. In conjunction with ansisotropic");
put("Reduces gaps between tiles in the tomb raider series"); put("filtering and mipmapping this cause artefacts at the");
put("(best observed in TR1, but TR2 is also affected)"); put("edges of single tiles/triangles.");
put("A combination of the following values:"); put("0 to disable, n (power of 2) to place each texture image");
put("1=Enable, 2=Debug, 4=DepthFactor, 16=IncircleOr,"); put("into a seperate OpenGL texture object. The value determines");
put("32=IncircleAnd, 64=IncircleSecondRadius,"); put("the grid points and the minimal size of the generated");
put("128=VertexLengthSecondRadius"); put("OpenGL textures.");
put("GapFix", static_cast<unsigned long>(GapFix)); put("GenerateSubTextures", GenerateSubTextures);
put(); put();
put("Minimum pixel incircle of a triangle for applying the gapfix"); put("Vertex gapfix optimisation for Tomb Raider 1 & 2:");
put("GapFixParam1", GapFixParam1); put("Reduces gaps between tiles in the tomb raider series");
put(); put("(best observed in TR1, but TR2 is also affected)");
put("Minimum value of the isoscelesness or the maximum vertex"); put("A combination of the following values:");
put("length of a triangle for applying the gapfix"); put("1=Enable, 2=Debug, 4=DepthFactor, 16=IncircleOr,");
put("(an isosceles triangle has a value of 10)"); put("32=IncircleAnd, 64=IncircleSecondRadius,");
put("GapFixParam2", GapFixParam2); put("128=VertexLengthSecondRadius");
put(); put("GapFix", static_cast<unsigned long>(GapFix));
put("Second minimum incircle of a triangle for applying the gapfix,"); put();
put(" this one is independent from the isoscelesness/vertex length"); put("Minimum pixel incircle of a triangle for applying the gapfix");
put("GapFixParam3", GapFixParam3); put("GapFixParam1", GapFixParam1);
put(); put();
put("Multiplies the incircles/isoscelesness with the vertex depth to"); put("Minimum value of the isoscelesness or the maximum vertex");
put("allow applying the gapfix to smaller triangles in the background"); put("length of a triangle for applying the gapfix");
put("GapFixDepthFactor", GapFixDepthFactor); put("(an isosceles triangle has a value of 10)");
put(); put("GapFixParam2", GapFixParam2);
put(); put();
put("Various settings that affect the rendering quality."); put("Second minimum incircle of a triangle for applying the gapfix,");
put(); put(" this one is independent from the isoscelesness/vertex length");
put("Fog emulation method:"); put("GapFixParam3", GapFixParam3);
put("0 to disable, 1 for simple, 2 for complete fog emulation"); put();
put("FogMode", static_cast<unsigned long>(FogMode)); put("Multiplies the incircles/isoscelesness with the vertex depth to");
put(); put("allow applying the gapfix to smaller triangles in the background");
put("The renderer to be used to emulate the Glide color and alpha"); put("GapFixDepthFactor", GapFixDepthFactor);
put("combine unit. 0 for automatic selection, 1 for simple (0.10),"); put();
put("2 for enhanced, and 3 for enhanced ATI optimised emulation"); put();
put("ColorAlphaRenderMode", static_cast<unsigned long>(ColorAlphaRenderMode)); put("Various settings that affect the rendering quality.");
put(); put();
put("Number of bits to use for the depth buffer:"); put("Fog emulation method:");
put("0: automatic (attempts to use the largest possible value)"); put("0 to disable, 1 for simple, 2 for complete fog emulation");
put("16, 24, 32: use the specified number of bits for the depth buffer"); put("FogMode", static_cast<unsigned long>(FogMode));
put("DepthBufferBits", DepthBufferBits); put();
put(); put("The renderer to be used to emulate the Glide color and alpha");
put("Depth precision fix: attempts to avoid depth precision"); put("combine unit. 0 for automatic selection, 1 for simple (0.10),");
put("problems on graphic cards with only 16bit-zbuffer depth"); put("2 for enhanced, and 3 for enhanced ATI optimised emulation");
put("0 = always off, 1 = automatic, 2 = always on"); put("ColorAlphaRenderMode", static_cast<unsigned long>(ColorAlphaRenderMode));
put("EnablePrecisionFix", PrecisionFix); put();
put(); put("Number of bits to use for the depth buffer:");
put(); put("0: automatic (attempts to use the largest possible value)");
put("Various debug settings"); put("16, 24, 32: use the specified number of bits for the depth buffer");
put(); put("DepthBufferBits", DepthBufferBits);
put("IgnorePaletteChange", IgnorePaletteChange); put();
put("EnableFrameBufferOverlays", EnableFrameBufferOverlays); put("Depth precision fix: attempts to avoid depth precision");
put("EnableFrameBufferUnderlays", EnableFrameBufferUnderlays); put("problems on graphic cards with only 16bit-zbuffer depth");
put("FramebufferIgnoreUnlock", FramebufferIgnoreUnlock); put("0 = always off, 1 = automatic, 2 = always on");
put("PedanticFrameBufferEmulation", PedanticFrameBufferEmulation); put("EnablePrecisionFix", PrecisionFix);
put("CompiledVertexArray", EXT_compiled_vertex_array); put();
put("EnableMultiTextureEXT", ARB_multitexture); put();
put("EnablePaletteEXT", EXT_paletted_texture); put("Various debug settings");
put("EXT_clip_volume_hint", EXT_clip_volume_hint); put();
put(); put("IgnorePaletteChange", IgnorePaletteChange);
put(); put("EnableFrameBufferOverlays", EnableFrameBufferOverlays);
put("Glide hardware settings"); put("EnableFrameBufferUnderlays", EnableFrameBufferUnderlays);
put(); put("FramebufferIgnoreUnlock", FramebufferIgnoreUnlock);
putv("Texture Memory goes from %d to %d", OGL_MIN_TEXTURE_BUFFER, OGL_MAX_TEXTURE_BUFFER); put("PedanticFrameBufferEmulation", PedanticFrameBufferEmulation);
put("TextureMemorySize", TextureMemorySize); put("CompiledVertexArray", EXT_compiled_vertex_array);
put(); put("EnableMultiTextureEXT", ARB_multitexture);
putv("Frame Buffer Memory goes from %d to %d", OGL_MIN_FRAME_BUFFER, OGL_MAX_FRAME_BUFFER); put("EnablePaletteEXT", EXT_paletted_texture);
put("FrameBufferMemorySize", FrameBufferMemorySize); put("EXT_clip_volume_hint", EXT_clip_volume_hint);
put(); put();
put("The hardware we're pretending to be emulating"); put();
put("(This has no effect on the emulation, but games may change"); put("Glide hardware settings");
put("their behaviour/features depending on this setting)"); put();
put("0 = Voodoo, 1 = SST-96, 2 = AT3D, 3 = Voodoo 2"); putv("Texture Memory goes from %d to %d", OGL_MIN_TEXTURE_BUFFER, OGL_MAX_TEXTURE_BUFFER);
put("BoardType", static_cast<unsigned long>(BoardType)); put("TextureMemorySize", TextureMemorySize);
put(); put();
put("The number of emulated Glide texture units (TMUs)"); putv("Frame Buffer Memory goes from %d to %d", OGL_MIN_FRAME_BUFFER, OGL_MAX_FRAME_BUFFER);
put("0 = as many as possible, 1-3 number of emulated TMUs"); put("FrameBufferMemorySize", FrameBufferMemorySize);
put("GlideTextureUnits", GlideTextureUnits); put();
put(); put("The hardware we're pretending to be emulating");
put("0 to display the cool splash animation on startup,"); put("(This has no effect on the emulation, but games may change");
put("or 1 to supress the annoying splash animation"); put("their behaviour/features depending on this setting)");
put("NoSplash", NoSplash); put("0 = Voodoo, 1 = SST-96, 2 = AT3D, 3 = Voodoo 2");
put(); put("BoardType", static_cast<unsigned long>(BoardType));
put("Shows the 3Dfx logo in the lower right corner of the screen"); put();
put("ShamelessPlug", ShamelessPlug); put("The number of emulated Glide texture units (TMUs)");
GlideSettings::IOErr err = close(); put("0 = as many as possible, 1-3 number of emulated TMUs");
put("GlideTextureUnits", GlideTextureUnits);
put();
put("0 to display the cool splash animation on startup,");
put("or 1 to supress the annoying splash animation");
put("NoSplash", NoSplash);
put();
put("Shows the 3Dfx logo in the lower right corner of the screen");
put("ShamelessPlug", ShamelessPlug);
// Get the error code of the last write in order to catch errors like "Disk full" etc.
err = put();
}
return err; return err;
} }
@ -616,19 +641,14 @@ GlideSettings::IOErr GlideSettings::put(const char* setting, bool value)
GlideSettings::IOErr GlideSettings::save() GlideSettings::IOErr GlideSettings::save()
{ {
IOErr err = noErr; IOErr err = saveSettings();
if (isApplicationSpecific()) if (err == noErr)
{ {
err = create(); err = close();
} }
else else
{ {
err = create_defaults(); close();
} }
if (err == noErr) return err;
{ }
err = saveSettings();
}
close();
return noErr;
}

View File

@ -69,6 +69,7 @@ struct ConfigStruct
{ {
OpenGLideDisplayMode DisplayMode; OpenGLideDisplayMode DisplayMode;
unsigned long Resolution; unsigned long Resolution;
unsigned long ResolutionCap;
unsigned long MonitorRefreshRate; unsigned long MonitorRefreshRate;
unsigned long DepthBufferBits; unsigned long DepthBufferBits;
unsigned long FullSceneAntiAliasing; unsigned long FullSceneAntiAliasing;
@ -143,7 +144,6 @@ protected:
void defaults(); void defaults();
virtual IOErr read_defaults()=0; virtual IOErr read_defaults()=0;
virtual IOErr read()=0; virtual IOErr read()=0;
virtual bool isApplicationSpecific()=0;
IOErr read_settings(); IOErr read_settings();
IOErr saveSettings(); IOErr saveSettings();
bool get(const char* setting, const char** value); bool get(const char* setting, const char** value);

View File

@ -225,13 +225,13 @@ grSstWinOpen(FxU32 hwnd,
} }
#endif #endif
Glide.WindowWidth = windowDimensions[ Glide.Resolution ].width; Glide.WindowWidth = windowDimensions[Glide.Resolution].width;
Glide.WindowHeight = windowDimensions[ Glide.Resolution ].height; Glide.WindowHeight = windowDimensions[Glide.Resolution].height;
// Set the size of the opengl window (might be different from Glide window size) // Set the size of the opengl window (might be different from Glide window size)
if (UserConfig.Resolution == 0) if (UserConfig.Resolution == 0)
{ {
// Does only work if the library is loaded at startup, before the game changes the screen resolution // Does only work if the library is loaded at startup, before the game changes the screen resolution
if (DisplayManager_GetDesktopDisplayResolution(OpenGL.WindowWidth, OpenGL.WindowHeight) != noErr) if (!DisplayManager_GetDesktopDisplayResolution(OpenGL.WindowWidth, OpenGL.WindowHeight))
{ {
// Use the resuolution requested by the game // Use the resuolution requested by the game
OpenGL.WindowWidth = Glide.WindowWidth; OpenGL.WindowWidth = Glide.WindowWidth;
@ -244,18 +244,20 @@ grSstWinOpen(FxU32 hwnd,
OpenGL.WindowWidth = Glide.WindowWidth * UserConfig.Resolution; OpenGL.WindowWidth = Glide.WindowWidth * UserConfig.Resolution;
OpenGL.WindowHeight = Glide.WindowHeight * UserConfig.Resolution; OpenGL.WindowHeight = Glide.WindowHeight * UserConfig.Resolution;
} }
else if (UserConfig.Resolution >= 512) else
{ {
// override the resolution // override the resolution
OpenGL.WindowWidth = UserConfig.Resolution; OpenGL.WindowWidth = UserConfig.Resolution;
// Glide games have a fixed 4/3 aspect ratio // Glide games have a fixed 4/3 aspect ratio
OpenGL.WindowHeight = UserConfig.Resolution * 3 / 4; OpenGL.WindowHeight = UserConfig.Resolution * 3 / 4;
} }
else // Limit the display size to the max allowed screen resolution
if (UserConfig.ResolutionCap)
{ {
// Use the resuolution requested by the game OpenGL.WindowWidth = min(OpenGL.WindowWidth,
OpenGL.WindowWidth = Glide.WindowWidth; UserConfig.ResolutionCap);
OpenGL.WindowHeight = Glide.WindowHeight; OpenGL.WindowHeight = min(OpenGL.WindowHeight,
UserConfig.ResolutionCap * 3 / 4);
} }
Glide.WindowTotalPixels = Glide.WindowWidth * Glide.WindowHeight; Glide.WindowTotalPixels = Glide.WindowWidth * Glide.WindowHeight;
Glide.Refresh = ref; Glide.Refresh = ref;