elishacloud / Silent-Hill-2-Enhancements

A project designed to enhance Silent Hill 2 (SH2) graphics and audio for the PC. It also includes scripts to build or modify SH2 audio files (SFX, BGM and Dialog).
http://www.enhanced.townofsilenthill.com/SH2/
zlib License
539 stars 41 forks source link

Location of new 'DynamicResolution' settings and video aspect adjusting #397

Closed Psycho-A closed 2 years ago

Psycho-A commented 3 years ago

First, thanks for new update, and also including some of my advices and bug report's fixes.

I found you've added new 'DynamicResolution' param, which is very nice. But it seems it doesn't save the new game resolution values in game's .ini files. Where this setting is located now? I hope you kept game's portability as it was, not using registry or user profile's folders...

You also added auto-adjusting 2D images aspect ratio based on resolution changing. How about doing the same with videos? With this we could refuse manual overridings at all, or use them only in special cases to get non-standard look.

elishacloud commented 3 years ago

Where this setting is located now?

We could not use the settings.ini file because all it stores is the index to the resolution. However, since we are supporting dynamic resolution the same index may point to a different resolution if you launch the game at a different time. Thus we had to save it in a different location.

We are saving the new resolution here: HKEY_CURRENT_USER\SOFTWARE\Konami\Silent Hill 2\sh2e

You also added auto-adjusting 2D images aspect ratio based on resolution changing. How about doing the same with videos?

We are doing this with the videos. However, the videos are pre-recorded in a specific ratio. Thus all we can do is zoom in, zoom out or crop the video, which we are already doing. But there is a limit to how much we can do without losing important pieces of the video.

Psycho-A commented 3 years ago

Ah, I supposed such kind of issue with resolution indexes... But it's still possible to use native settings.ini instead of some external storages. The EE module just could write different param inside, like "DX_CONFIG_RES_EE" or "DX_CONFIG_DYNAMIC_RES" with value type needed by. The original game engine will ignore it as unrecognised, but EE module will read and write. This also will keep game's portability since it doesn't use registry with EE's modified .exe and it's not really beautiful to use it just because of one setting. The different way is to save this value directly in d3d8.ini (maybe into old ResX= and ResY= values which are still work), so users could even edit it manually if it's required.

However, the videos are pre-recorded in a specific ratio. Thus all we can do is zoom in, zoom out or crop the video, which we are already doing. But there is a limit to how much we can do without losing important pieces of the video.

I think the ratios wouldn't make sense if just make zooming to full screen by one of side that provides uncropped and unsquashed image with black boxes on the perpendicular side. Thus, if game resolution is wide or ultra-wide, then videos would fit by vertical size (of video), and if resulotion is square or even vertical, then videos would fit by horizontal size, keeping letterboxes on top and bottom. I don't think there's something different or complicated is needed here if this behavior will work.

Polymega commented 3 years ago

I'll leave this to Elisha, but want to say that we cannot add any lines/parameters to the settings.ini file. SH2 PC is very particular about this file, and if it sees extra lines added to it, it will remove these lines (and also add back parameters that might be missing that it needs in this file).

Psycho-A commented 3 years ago

I'll leave this to Elisha, but want to say that we cannot add any lines/parameters to the settings.ini file. SH2 PC is very particular about this file, and if it sees extra lines added to it, it will remove these lines (and also add back parameters that might be missing that it needs in this file).

Got it now. Well, still the variant with editable d3d8.ini is on your discretion, Elisha in particular... Also, maybe there some game config files that doesn't behave like this. F.e. options.ini or even local.fix...

elishacloud commented 3 years ago

By default SH2 will clear and regenerate all options in the settings.ini file each time you launch and exit game. We could certainly overwrite that behavior and add extra options into this file. However, if the user ever runs the game and disables our module then all the extra options would be lost.

"Also, maybe there some game config files that doesn't behave like this. F.e. options.ini or even local.fix..."

Yes, we could potentially add this to anther file in the Silent Hill 2 folder, but it is generally considered bad practice in Windows 7/10 to store user settings in the program folder. Thus settings like this should be stored in the user registry or the user's data folder.

Furthermore, there are cases where Silent Hill 2 is installed into the "Program Files" folder and applications generally don't have access to save data into this folder, meaning it may not work correctly on all systems. Again, for better or worse, Microsoft has designed their operating system to make it so that things work best when programs store their data in the user registry or the user's data folder.

Plus, I really don't want to have to deal with all the issues that could/would arrive with different users if I tried to store the data locally. We have already had to add a bunch of code to fix issues that happen because the game does this type of thing. I don't want to make it worse by doing the very thing that caused headaches for me in the past. I hope you understand. :-)

Psycho-A commented 3 years ago

but it is generally considered bad practice in Windows 7/10 to store user settings in the program folder

If the game or program is already designed to keep its settings inside of its folder, then the good practice is to keep this behavior untouched in further extensions to have holistic and familiar user experience. The classic SH games were never designed as multi-user programs, so using multi-user design of OS just because of one setting is a bit illogical.

Furthermore, there are cases where Silent Hill 2 is installed into the "Program Files" folder and applications generally don't have access to save data into this folder, meaning it may not work correctly on all systems.

Then all other native game settings and savegames wouldn't be writable too, and the resolution is not an exception. So better solution is just not to use "Program Files" for installation at all, as it's really bad practice for all games.

elishacloud commented 3 years ago

@Psycho-A, thanks for your comments. I am going to answer these in a different order than you listed them.

So better solution is just not to use "Program Files" for installation at all, as it's really bad practice for all games.

Agreed. However, the issue is actually related to the folder permissions, not folder path. Furthermore, many users have the game installed in the "Program Files" folder and we cannot prevent people from installing the game into that folder. I need to make sure that the sh2e module works good no mater where the user decides to install the game into.

If the game or program is already designed to keep its settings inside of its folder, then the good practice is to keep this behavior untouched in further extensions to have holistic and familiar user experience.

I am basing the good practice on the current OS recommendations, more specifically Microsoft's Gold Certification software requirements. Part of the goal of this project is to get the game to run good on newer OS's and as such I want to maintain good OS practices.

The classic SH games were never designed as multi-user programs, so using multi-user design of OS just because of one setting is a bit illogical.

True. I could have put this in the program data folder so this setting would be the same for all users, rather than per-user. However, to do that I would have had to save the data in some file rather than the registry, as I am not aware of any per-machine registry key that would be good for this purpose. I wanted to save it to the registry because it is easy to implement and I did not see any issues with having this option per-user option. Also, if you read Microsoft's Gold Certification requirements it requires applications to save this type of data in the per-user rather than the program data location in order to be certified.

I did briefly consider moving all of the game's settings into the per user registry rather than having them in the game folder, but decided against that for a number of reasons.

the game [...] is already designed to keep its settings inside of its folder

I believe the real issue is that I am saving this data in a different place then the game saves the rest of its data. I did think about this when I made the choice to save the data where I am saving it. I did this for the reasons I mentioned above. Also, I don't think anyone would ever need to change this data directly, as they can already change it from inside the game. So I did not think it really mattered were I saved it to. So following Microsoft's guidelines is usually best in these cases.

Psycho-A commented 3 years ago

@elishacloud Thanks for answers too! I got your point, although I'm still not support the idea to have only one setting far from the rest of all others. Also, the d3d8.ini module config is configured by users from game folder too, that makes to guess that everything must be here. And speaking of compatibility with modern OSes - indeed, having OS-independant settings is the forever compatibility trick, because no one knows which folder/registry structure will be used in the future. Also portable behavior is better for Wine under Linux. Anyway, it's all on your decision. I said all I thought...

elishacloud commented 3 years ago

This will be updated in the next release. The resolution will now be stored to a local binary file called d3d8.cfg. The settings will be migrated from the registry, if it exists, to the local file, if it does not exist.

Psycho-A commented 3 years ago

Thank you very much! But if we already have d3d8.ini, maybe it's better to write settings just into this one? If fact, it'll be already fourth file named "d3d8" in game folder. For users who uses disabled extensions by default in Windows, this may be confusing... Using old .ini we won't have extra new files, and users will also get ability to edit this setting, f.e. if they're launching game on different monitor than before. Just adding comment like # This setting is automatically updated by game would be enough for understanding the purpose of it.

Polymega commented 2 years ago

I believe Elisha has implemented these features. User-selected resolution is now stored in a local file and FMVs have a new "auto-scale" toggleable feature similar to how it works for the fullscreen images. I believe these features have already released but, if not, they'll be included with the next project update.

I'll close this ticket out. Thanks for your great work here, Elisha!