ThirteenAG / WidescreenFixesPack

Plugins to make or improve widescreen resolutions support in games, add more features and fix bugs.
https://thirteenag.github.io/wfp
MIT License
2.27k stars 216 forks source link

[SH2] Fog fix/WineD3D/WSF incompatibilities #257

Closed seagull closed 7 years ago

seagull commented 7 years ago

Hi everyone; I've been doing a lot of my own research, but I can see I'm clearly in a very good group here, so I hope you'll all be patient with me and help me to work out the best combination of fixes for my device. I'm running an NVIDIA card, so SMAA shouldn't be an issue, at 1920x1200. In addition to the standard, boilerplate issues every SH2 fix remedies by now (looping sound, broken saving, single-core affinity, safe mode, screen resolution), here are the issues as I see them:

The biggest issue for me is that both WineD3D and the Fog Fix are called D3D8.dll. I tried using ThirteenAG's ultimate ASI loader but only the Fog Fix works with it, WineD3D doesn't – as such, the fix is pointless because it only works when they're running together. This basically forces users to choose between realistic fog or vertex shading. It's compounded by the fact that the fog fix is closed-source, making it impossible to merge into another project.

Has anyone been able to find a fix for this? I hate disabling my vertex shaders. Thanks everyone! Great work with this, you're doing a beautiful thing for SH fans.

Polymega commented 7 years ago

I believe that depends on your difficulty. Try playing it on the hardest difficulty and run into something. (Not at home at the moment.)

seagull commented 7 years ago

Well, now I feel dumb. You're absolutely right, he only does it on hard difficulty.

I have something smart to say in order to redeem myself, though – I figured out the difference between the two title screens, and it goes further than the graphics they display! Please try this yourselves with the version that displays graphics (that you all seem to have) and i's Compatible EXE. I found that the graphical version (I used the one Aero posted before but I reckon they're all the same) – by "graphical version" I mean that it displays graphics on the title screen instead of text – does not support analogue controls for the left stick. With my DS4Windows+Xpadder setup, it was always full-direction or nothing with the left stick, which I left unbound in Xpadder and SH2. Using the "Compatible EXE" I found 1:1 analogue control works fine!

Brunn0121 commented 7 years ago

Thanks for the info, so that's why SH3 shadows gets hard, even being a soft edged shadow, at 2048 resolution on the .ini file, that's why i set it to 512 for that perfect softness.

@seagull Because it's on hard, SH2 and 3 has this, if you shove your face on a wall it will do that animation. I don't think there is any cut animation/ content on the pc version, only SH3 has cur content, and its only the extra T-shirts

Polymega commented 7 years ago

I have something smart to say in order to redeem myself, though – I figured out the difference between the two title screens, and it goes further than the graphics they display!

What you said is very smart then as I don't think I fully understood it. :) I believe you are saying the "basic" main menu EXE has d-pad support for the menu right out the box? And the "fancy" main menu EXE doesn't? I know the "fancy" version doesn't but this issue can be fixed with Xinput Plus by going to the KeyAssign tab and under the Left Stick dropdown choosing "Multiple Key" and checking both Left Stick and DPAD for it.

Of course, doing this loses your ability to assign actions to the d-pad (as it turns the d-pad into another left stick input) but allows you to navigate menus now using the d-pad (which feels a lot more natural to me). I definitely prefer this as I always used the d-pad to control James in the original Xbox version.

Brunn0121 commented 7 years ago

@seagull Mine is the same version as your upload, only its in portuguese, i don't have the graphical version, so it is the same to me, and the analog works just fine, if i tilt it gently, James will walk slower than normal.

Only thing that really pisses me off is that they didn't implemented full 1:1 ps2 controls, so the same analog that makes james walk, is the same that makes his head move when in search mode, this is really annoying, specially when you try to move and look around at the same time, most the time james suddenly stops to look around, rather than walk and look... Thank god SH3 has no such problems, it has the full ps2 layout (if using xinput plus, of course)

seagull commented 7 years ago

I believe you are saying the "basic" main menu EXE has d-pad support for the menu right out the box? And the "fancy" main menu EXE doesn't?

I believe this to be the case @jdkubiak, yes. I don't use xinput plus because I'm on a DS4; I use an awkward combination of DS4Windows (to spoof my controller as an Xbox 360 input) and Xpadder. I don't map the left stick, however; it's just an analogue stick. The "basic" EXE supports this out-of-the-box – try it!

Red-Pyramid-Head commented 7 years ago

Hey guys,

Really love what you've been doing here, and how everyone is helping in making this happen.

@jdkubiak has pointed me to this GitHub page and I joined hoping to be able to give a hand in this 'project'.

seagull commented 7 years ago

Glad to have you on board. I know @Aero52 has very kindly agreed to look at the fog situation, but honestly, with the v2 Nemesis2000 posted I have to wonder how necessary it is. The only real thing that I can think of that keeps this from being picture-perfect is the 2D asset stretching option. If you're able to "give a hand" in that direction, you'd be contributing the last piece of the puzzle. I've got a little archive consisting of the right fixes and configuration files that anyone should be capable of downloading and pasting over their original installation. I reckon once we have everything where we want it I could release it with a guide to maybe finally put a cap on this.

At least until that mythical texture replacement tool surfaces...

AeroWidescreen commented 7 years ago

@Red-Pyramid-Head Welcome.

@seagull I was only going to do something for the fog if Nemesis2000 wasn't responding. He replied to my email and applied the necessary changes, so there's no need for me to do anything now. Saves me time, saves ThirteenAG a headache, and everyone is happy.

The only change I have planned at the moment is to adjust the PS2CameraSpeed values to more closely match the PS2 version.

Polymega commented 7 years ago

@Red-Pyramid-Head Awesome, thanks for signing up here! @Aero52 this is the man who said he'd take a look into making a new-and-improved SH Texture Explorer for us. With technical-minded people here (users and lurkers alike) I figured it can't hurt to have as much public correspondence over a potential new texture explorer.

Thanks again for joining us here, RPH!

AeroWidescreen commented 7 years ago

@jdkubiak I see.

@Red-Pyramid-Head Your help is greatly appreciated! I suggest starting with Silent Hill 2, because its textures are accessible in \data\pics. No archive to worry about. It's just a matter of converting images to that weird tex format I think.

This might help: TextureFinder

TextureFinder

Red-Pyramid-Head commented 7 years ago

Thank you all for the warm welcome.

@Aero52 Currently I'm at work, but will definitely check this out as soon as I get home tonight. Taking an optimistic view/approach: if the issue is just to convert those images to a specific format, I believe it shouldn't be much of a problem. What would worry me, and this I have mentioned to @jdkubiak, is that for some reason the game itself would default its texture values. But that is just me being negative.

I will try to test some stuff tonight and post back on what I hopefully manage to find out.

On that note, I apologize if I am missing some things you guys might have already went over, I have been trying to read all posts from the various sources to try to get up-to-date on this project.

Red-Pyramid-Head commented 7 years ago

@seagull Thank you. Again, I might be missing something or maybe I have the wrong idea. I do believe the issue with stretching the assets was causing the problem in the first place? Could it be that the way they were being stretched was being proportional or reducing the quality of the image?

seagull commented 7 years ago

I actually deleted my response because I'm not 100% sure where we are any more. If you're taking a look at the 2D asset stretching as I initially suspected, then possibly – sh2fix (which I'd recommend installing just to see how it does it) seems to scale things elegantly enough so that things like the save screen and the map aren't bordered on either side, but I'm not exactly sure how it does it or whether it's a method we'd seek to copy.

Polymega commented 7 years ago

I actually deleted my response because I'm not 100% sure where we are any more.

I haven't tried the "sh2fix" so I don't know how it does it but we're trying to get the static, 2D images properly scaled to a widescreen format with no stretching. This means opening/editing the original, full screen images and adjusting/cropping them for widescreen boundaries (so, changing their resolutions accordingly) without any distortion to them.

As Aero said, it's the biggest and probably only thing the HD Collection has over any other version of the game.

seagull commented 7 years ago

Right, I'm with you. So this will require its own asset pack. So be it.

Polymega commented 7 years ago

I reckon once we have everything where we want it I could release it with a guide to maybe finally put a cap on this.

Oh, I forgot to mention this. I had this same idea a few months back but with all the changes that have been occurring recently ("old" ASI loader as a temporary fix, new fog fix, etc.) I've held off mentioning this out loud but I guess I'll share: http://widescreenfix.townofsilenthill.com/SH2/

This is very much a work in progress. I still want to style/"pretty it up" and also add images and comparison shots/videos of before/after with the fixes in place. But I figured it's a good start for now.

The only thing that's currently majorly inaccurate is installing the Widescreen Fix because, as of the moment, we need to use the "old" ASI loader. I didn't mention this in the guide as I figure ThirteenAG will fix it sooner or later and this link is only being shared within this support community for the time being.

seagull commented 7 years ago

Wow. Really nice work. The only thing I'd add would be the Lavendy Xi driver because it adds vibration support.

AeroWidescreen commented 7 years ago

@Red-Pyramid-Head

What would worry me, and this I have mentioned to jdkubiak, is that for some reason the game itself would default its texture values. But that is just me being negative.

If you're talking about resolution, then I wouldn't worry about it. In Silent Hill 3 the splash screen images are rendered in 512x512 regardless of their size, but I'm able to increase that to whatever I want in the game's code. So even if we run into a similar problem in Silent Hill 2, then I should be able to fix that, but I doubt we will.

If you're talking about aspect ratio, then that's something we know how to control already and should be a non-issue.

Red-Pyramid-Head commented 7 years ago

@jdkubiak That looks like a nice guide to have published eventually! Great job! :)

@Aero52 Well, that is definitely a few less things to worry about. I have messed a bit with that TextureFinder application you have provided me with, and I guess I get a better idea of what is going on. Correct me if I am wrong, is the plan to convert edited texture back to .tex format and swap it with the original texture?

Polymega commented 7 years ago

Wow. Really nice work. The only thing I'd add would be the Lavendy Xi driver because it adds vibration support.

Thank you. Question @seagull : How did you get the driver to work? I downloaded the English one corresponding to my OS and installed the MSI then... nothing. Is there another step I'm missing?

AeroWidescreen commented 7 years ago

@Red-Pyramid-Head That's exactly the plan. Edit the existing textures and replace.

jdkubiak brought up an interesting idea about using the textures from the HD collection, since those have extra details drawn for 16:9 support, but someone would need a PS3/Xbox360 along with a good capture device to get them. I have neither, so I can't help in that department.

Polymega commented 7 years ago

jdkubiak brought up an interesting idea about using the textures from the HD collection, since those have extra details drawn for 16:9 support, but someone would need a PS3/Xbox360 along with a good capture device to get them. I have neither, so I can't help in that department.

I wouldn't be opposed to going that route (I'd just need to buy a quality capture card) but I'd prefer to use the files found already within the PC version as they'll all be accounted for there. Otherwise I'd be scared I'd miss over X amount of 2D images and having to go back-and-forth within the game itself to trigger them for capture. This also doesn't factor matching them up with the PC file's naming structures.

I was mostly thinking of just stealing the HD Collection's intro screen as that's the only re-designed graphic they did well.

Brunn0121 commented 7 years ago

Wow this project is looking good, so much options to approach this! But not every image on the HD edition looks enhanced, the apartment clock puzzle in SH2 is just awful, they added so much stuff to their sides that ended up hurting the original art.

seagull commented 7 years ago

jdkubiak brought up an interesting idea about using the textures from the HD collection

As previously stated, inadvisable. The HD collection wasn't reverse-engineered from release code (like all good remasters) and instead was cobbled together from beta code Konami had hanging around the office because they'd lost all the final build stuff. That Comic Sans sign is the tip of the iceberg; the whole thing is unsightly and unfinished.

How did you get the driver to work?

I don't use Xinput plus because I have a DS4. I use DS4Windows to make the pad think it's an Xbox 360 controller and then funnel this through XPadder. Try doing that (even if only in a rudimentary capacity) to see if it works for you. Don't forget to enable rumble in the options menu.

Red-Pyramid-Head commented 7 years ago

@Aero52 Thank you for confirming that. No matter which way we use, we still have to finally be able to convert those textures back to .tex format. I have been currently trying to look around for any possible information while also trying to examine the TextureFinder and SHTextureExplorer. I am literally going through multiple websites at the moment to find any information about this god damn .tex format. lol

Polymega commented 7 years ago

image image

As previously stated, inadvisable.

True story: I was so utterly appalled playing the HD Collection I stopped playing it once I reached the hospital in SH2 and never even finished the mall level in SH3. I quite literally remember near-nothing about the details of this release... and I'm happy to know so many of my brain cells have been spared retaining memory of this abomination of a re-release.

Long story short: @seagull is right; we should avoid using assets from the HD Collection at all costs.

seagull commented 7 years ago

@Red-Pyramid-Head is this of any use to you? https://github.com/HandsomeMatt/dont-starve-tools/releases

AeroWidescreen commented 7 years ago

@Red-Pyramid-Head Maybe these people can help you? I think they might know how to load SH3's tex files, so perhaps they could shed some light on this issue:

https://github.com/Palm-Studios/sh3redux https://github.com/Palm-Studios/sh3tools

@jdkubiak @seagull Okay, fair enough. That comic sans sign is hilarious and depressing at the same time.

Polymega commented 7 years ago

If you guys can think of any common troubleshoot questions (and their answers) please let me know: http://widescreenfix.townofsilenthill.com/SH2/#troubleshooting

AeroWidescreen commented 7 years ago

@Red-Pyramid-Head I think the tex files, at least for the maps, are simply DXT3 textures with a custom header. I edited one of the maps in Photoshop and saved it in the DXT3 format using NVIDIA's texture tools. Then I used a hex editor to replace the original texture data with the edited version, while keeping the original header, and...

Texture Replacement

Success! We still need to know how the tex header works though.

Polymega commented 7 years ago

PROGRESS!

source

AeroWidescreen commented 7 years ago

Well, I have good news and bad news to share. I was able to change the texture dimensions, but I think the game has a memory limitation. Increasing the texture size too much crashes the game, and increasing it marginally will work but corrupt other textures in the process.

I don't know too much about file formats, so maybe I'm just doing something wrong. I'll leave the rest for Red-Pyramid-Head.

Red-Pyramid-Head commented 7 years ago

@Aero52 Damn, you have posted so much in the past few hours! That is awesome! Also thank you for those links you have sent. I will be checking them out. Love your progress but ... upset you encountered the 'memory limitation' :'(

What I had been trying to do is to convert those .tex textures to .tga, which I could easily open in Photoshop. But as of yet I was not able to convert them back to .tex formats. I almost thought I could, but for some (still unknown) reasons it was failing to convert. The only other thing I 'found' out that I think .tex files are an extension from Corel PaintShop Pro, but I did not confirm that yet. That being said, I am not sure how we can counter the memory limitation issue, will have to dig deeper for that.

Are you able to physically share the file you have edited for the apartments map? Thanks!

AeroWidescreen commented 7 years ago

Absolutely. map texture.zip

AeroWidescreen commented 7 years ago

I made a wiki for all of the Silent Hill (and Need for Speed) widescreen fixes here. It's not meant to replace jdkubiak's SH2 installation guide. It's more for people who want a better understanding of what each widescreen fix does. What is this feature for? How does it work? Why can't I do this? Why isn't it working? etc.

Polymega commented 7 years ago

^ That is awesome and a much welcomed addition to your's/ThirteenAG's WSF work. And I'm absolutely going to link your Wiki settings explanations in the guide I made. Edit: Updated. :)

Any possibility to add revision numbers to the WSF releases as well to help with future troubleshooting? Maybe include the number in the .ini as a comment or something?

AeroWidescreen commented 7 years ago

Any possibility to add revision numbers to the WSF releases as well to help with future troubleshooting? Maybe include the number in the .ini as a comment or something?

I always wanted something like that, but I'm not sure how it would be handled. You have to ask ThirteenAG about it.

Also, not to nitpick, but I prefer going by "Aero_", not "Aero52". The numbers for my Github username was completely random since "Aero" was already taken.

Polymega commented 7 years ago

Also, not to nitpick, but I prefer going by "Aero_", not "Aero52". The numbers for my Github username was completely random since "Aero" was already taken.

Not nitpicking at all. Consider it done. The guide/video will go live tonight.

Quaker762 commented 7 years ago

Hey guys, sorry I haven't checked in on issue tracking for a while. Did you need any help with anything @Aero52 ?

@Red-Pyramid-Head We can decode every text format in the SH3Redux repo (look in texture.cpp). For the most part the textures are just raw RGB(A), however, the 8-bit textures are rather tricky. They're swizzled in the same way the Playstation 2 would expect them to be (as they just ripped the assets right from what I assume was the actual PS2 TEAM SILENT dev team). The format of the 8-bit texture is as follows (off the top of my head):

----------------------------------------------
|                            Header                          |
----------------------------------------------
|                                                                 |
|                                                                 |
|                        Data                                 |
|                                                                 |
|                                                                 |
|                                                                 |
|                                                                 |
---------------------------------------------
|                            Palette                          |
----------------------------------------------
|                                                                 |
----------------------------------------------

I can (try) field anymore questions if you have any more :)

Red-Pyramid-Head commented 7 years ago

@Aero52 Thank you for your help and providing the resource!

@Quaker762 Hey! Thank you for your assistance. Yes, that would be a great idea. I am still trying to mess with what @Aero52 had provided. I still cannot figure much about this .tex file format, definitely found out it is quite archaic though... I am also still wondering how we will be able to accomplish this would having the game crash or corrupt textures. I will have to definitely go into the SH3Redux repo and examine further...

Polymega commented 7 years ago

I have a friend who is extremely skilled with coding in various languages and whose also dabbled a little in Unity/game work and asked him about the static 2D images and soft shadows for SH2 PC:

Ok, here goes:

This falls pretty far outside my area of knowledge. While it does involve game development on the surface, this sort of programming is basically reverse engineering like you would do with virus scanners. Basically what the wide screen fix does is inject itself in the game’s exe or DLL and redirect or tweak the code in memory. This sort of thing is SUPER impressive and something I’ve only dabbled in very lightly.

Also based on the research I’ve done, and backed by things you told me, the issue with the textures isn’t so much that the file is corrupt but that the game has memory constraints or some other limiting factor. My guess would be an internal fixed size memory pool. Console game development is quite different than PC, and was even more so back in the PS1/2 era. As these games tending to be console based, I would guess a lot of the code is still designed that way.

Shadows. I know almost nothing about DirectX 8. I didn’t tinker with Direct X at all until DX 9. One of the major differences that I am aware of is that DX 9 introduced shaders, which allowed programmers to write code directly for the GPU. Before shaders, this was all done with raw API calls and extensions. However, my first thought on this is that on the PC the shadows are rendered with a NEAREST type filter as opposed to linear filtering. If this was Directx 9, it would be a matter of intercepting or replacing the shader code & changing the filter type, however, for DX 8, I have no idea how that’s done. Basically, for the shadow stuff, I have no idea how to even go about investigating how this could be changed.

Long story short, there’s really not a lot I can do to help with any of the things you’re looking to do. Sorry man. I wish I could help, but this is SOO far outside my area of expertise, that it would take me months just to learn enough to talk intelligently about this stuff.

While this falls outside of his realm of expertise I thought the info he found may help with leading us/others in a better direction.

AeroWidescreen commented 7 years ago

Do any of you guys know if the Xbox version suffers from the same reduction in sound quality?

@jdkubiak It at least increases the credibility of what we've been speculating.

@Red-Pyramid-Head The thing is, even if we can't increase the texture size it would still be helpful to have a new texture replacement tool in general. It might not be the most important thing now though.

@Quaker762 Not at all, I'm just trying to send Red-Pyramid-Head in the right direction. Thanks for replying.

seagull commented 7 years ago

@Aero52 – I think this video is what you're looking for,

Polymega commented 7 years ago

From the video:

*Not factoring the PC fixes for the FMVs and fog.

seagull commented 7 years ago

PC has the best torchlight only once the WineD3D binaries have been applied. With vertex shaders off to stave off the black texture issue, the torchlight is a real ugly mess.

Polymega commented 7 years ago

The flashlight has per pixel in the vanilla build for PC if you turn on Advance Filters.

seagull commented 7 years ago

There's an "Advanced Filters" setting?! And it was turned OFF for me?!

That's it, I'm playing through the campaign again. This is BS. [EDIT: So that's where those DoF effects I heard so much about went!]

Polymega commented 7 years ago

:) But if you've disabled vertex shaders (HACK DX_CONFIG_USE_VERTEX_SHADERS 0) in the device.fix file then the flashlight will remain "PS2 quality" even with Advance Filters on.

seagull commented 7 years ago

I don't honestly believe the two are linked. I got a lovely round torchlight effect even with Advanced Filters turned off (apparently), unless the advanced filters enhance it even further. The shape of it seems to be affected more by vertex shaders than anything else.