SUBSIM Radio Room Forums



SUBSIM: The Web's #1 resource for all submarine & naval simulations since 1997

Go Back   SUBSIM Radio Room Forums > Silent Hunter 3 - 4 - 5 > Silent Hunter 4: Wolves of the Pacific
Forget password? Reset here

Reply
 
Thread Tools Display Modes
Old 03-12-21, 12:40 PM   #1
propbeanie
CTD - it's not just a job
 
propbeanie's Avatar
 
Join Date: May 2016
Location: One hour from Music City USA!
Posts: 10,109
Downloads: 451
Uploads: 2


Default



"It's not nice to fool with Microsoft!!!"

The issue has more to do with the game's programming paradigm. When it was written (Windows XP, and 32-bit), there were only "dreams" of multi-tasking, and "fake" alternatives to it, of which, most of the current technologies really are nothing more than more "efficient" ways to simulate multi-tasking, based mostly on the hardware resources available in the 'modern' computer... but I digress. SH4 is a single-core game, that assumes its address space is the same, no matter what you do in windows. It is for this reason that "swapping out" to the OS "kills" the audio stream, sometimes resulting in an address change of the buffer for the game (from Windows, which leads, guides and directs all aspects of one's computer life), which sometimes results in "odd" behavior when the game once again gains focus. Your current technique apparently minimizes these "issues", but it still might just be a roll of the dice before you get the CO2 not clearing, or the cloud of steam following your boat about the seas of the world, or anyone of a varied sort of maladies yet to be encountered. To keep the audio stream "alive", the game needs to keep "focus", which of course negates the computer's use for anything other than SH4 exclusively.
__________________

"...and bollocks to the naysayers" - Jimbuna
propbeanie is offline   Reply With Quote
Old 03-12-21, 03:08 PM   #2
Mad Mardigan
Admiral
 
Mad Mardigan's Avatar
 
Join Date: Sep 2016
Location: Grand Rapids, Mi.
Posts: 2,327
Downloads: 491
Uploads: 0


SHO

Quote:
Originally Posted by propbeanie View Post


"It's not nice to fool with Microsoft!!!"

The issue has more to do with the game's programming paradigm. When it was written (Windows XP, and 32-bit), there were only "dreams" of multi-tasking, and "fake" alternatives to it, of which, most of the current technologies really are nothing more than more "efficient" ways to simulate multi-tasking, based mostly on the hardware resources available in the 'modern' computer... but I digress. SH4 is a single-core game, that assumes its address space is the same, no matter what you do in windows. It is for this reason that "swapping out" to the OS "kills" the audio stream, sometimes resulting in an address change of the buffer for the game (from Windows, which leads, guides and directs all aspects of one's computer life), which sometimes results in "odd" behavior when the game once again gains focus. Your current technique apparently minimizes these "issues", but it still might just be a roll of the dice before you get the CO2 not clearing, or the cloud of steam following your boat about the seas of the world, or anyone of a varied sort of maladies yet to be encountered. To keep the audio stream "alive", the game needs to keep "focus", which of course negates the computer's use for anything other than SH4 exclusively.
Which is why I recommended, seeing of using another computer (be it laptop or another desktop, if you have a big enough desk to handle 2 desktops on it... ) laptop, would be a more workable, feasible solution... Barring that, a tablet would also work.. or heck, even your so called 'smart' phone.

Of course, that is up to the 1 trying to do what is being discussed about doing by the main poster... not throwing rocks at their aspirations, just saying what I see of as more.. advisable options. From My perspective...

M. M.

__________________
Mad Mardigan is offline   Reply With Quote
Old 03-12-21, 05:33 PM   #3
3catcircus
Grey Wolf
 
Join Date: Sep 2011
Posts: 979
Downloads: 256
Uploads: 0
Default

What is the 1-pixel-less hack?
3catcircus is offline   Reply With Quote
Old 03-12-21, 06:40 PM   #4
themrwho
Torpedoman
 
Join Date: Jul 2010
Posts: 119
Downloads: 141
Uploads: 0


Default

Quote:
Originally Posted by propbeanie View Post
"It's not nice to fool with Microsoft!!!"
The issue has more to do with the game's programming paradigm. When it was written (Windows XP, and 32-bit)...<snip>
Nice video And yes, I understand this game is from a different age... With the current system resources, our computers of course can handle a SH4 and many extra tasks at the same time. While you explained the background of why it is implemented the way it is this thread is all about modifying the existing software to change its behaviour which may or may not succeed, eventually. I am happy to keep at it though, at least for now.

Quote:
Originally Posted by Mad Mardigan View Post
Which is why I recommended, seeing of using another computer (be it laptop or another desktop, if you have a big enough desk to handle 2 desktops on it...
Yup, that is the current "solution" and frankly it does work - can't argue with that.
If a software workaround can be found, I will be happy to reduce the total computer count by one - if one cannot be found, I will continue as is.
I have invested some time on this issue, and there is at least one more method I would like to try.

I will share the results here in case it benefits anyone else.

Meanwhile, this thread stays open, waiting for that miracle in case someone knows a way to implement this somehow

Quote:
Originally Posted by 3catcircus View Post
What is the 1-pixel-less hack?
https://www.subsim.com/radioroom/sho...92&postcount=9


Edit:
Quote:
Originally Posted by propbeanie View Post
<snip>Your current technique apparently minimizes these "issues", but it still might just be a roll of the dice before you get the CO2 not clearing, or the cloud of steam following your boat about the seas of the world, or anyone of a varied sort of maladies yet to be encountered.<snip>
You may be right in assuming that "the issues (such as CO2 bug) will eventually hit you" however I have had zero issues so far. I get that it would be pointless to say "I *feel* I will never have issues" but what I can say today is "zero obvious issues occurred so far" (that I am aware of).

Which makes me think: am I not having the issues due to the fullscreen borderless window approach I have taken? Are you using fullscreen or are you using 1-pixel-less (as described in the linked post above)?
If you have not tried the 1-pixel-less method yet, perhaps give it a try as I have been saying it seems to be perfect.

Last edited by themrwho; 03-12-21 at 06:58 PM. Reason: add response to propbeanie about real fullscreen vs borderless fullscreen-ish
themrwho is offline   Reply With Quote
Old 03-12-21, 08:59 PM   #5
propbeanie
CTD - it's not just a job
 
propbeanie's Avatar
 
Join Date: May 2016
Location: One hour from Music City USA!
Posts: 10,109
Downloads: 451
Uploads: 2


Default

I have implemented the windowed mode on my desktop downstairs, dual-screen, and I also have not had issue (yet). Curiosity has gotten the better of me on more than one occasion, but not here yet. I'll let you know if I do have issues. Of course, as you say, the 'modern' pc is quite the Hercules when compared to what we had in 2007 and around that era. If I remember correctly, PCIe was in its infancy? So most computers were AGP, and a ATI 9800 was top notch stuff... lol
__________________

"...and bollocks to the naysayers" - Jimbuna
propbeanie is offline   Reply With Quote
Old 03-12-21, 11:58 PM   #6
themrwho
Torpedoman
 
Join Date: Jul 2010
Posts: 119
Downloads: 141
Uploads: 0


Default

Script linked below is a workaround for now: it does not fix the core issue, and I am still after a better solution but until then, hopefully this will do.
Tested this only for an hour, more testing is needed but initial results are good.
Script just makes it easier (via AutoHotkey automation) to re-activate sh4 window without doing anything or clicking anything -- works simply by "waiting".
Script URL: https://gitlab.com/themrwho/focus-sh4

Script has three settings:
0=off
1=slight effort (activate sh4 window after 5s inactivity)
2=focused effort (activate sh4 window after 0.25s inactivity)

A global desktop shortcut (SHIFT+F2) changes toggles the setting (increments it by 1, after max value 2, another hit takes it to level 0).
Human voice (mp3) announces the new setting level as feedback.

With quick testing, I found the default and aggressive setting 2 -which is best for having maximum amount sh4 audio- difficult to use for doing anything more than a single click in the "other window".
However it works great for its intended purpose: if you're watching stuff on YouTube and also playing sh4 on the other screen (more like idling/patrolling, waiting for a contact etc.) you can click to a different point in time in the video, then you will get your sh4 audio back almost instantly.

When script activates sh4 window, what happens to the other-window?
The other-window (let's say web browser) stays mouse-wheel-controllable and as long as your mouse pointer is only hovering over on that other screen (i.e.: if you do NOT click into that other-window) you can keep mouse wheel controlling it forever, it will not deactivate sh4 window and thus will not lose sh4 audio.

Practical example: if you are on a forums thread, you can mouse wheel up/down, keep scrolling up/down and read the whole thing.
You could do all that without this script anyway.
With this script in its aggressive default setting (level 2) you can even click on the NEXT PAGE button then the script, in quarter of a second, will re-activate sh4 window for you and you'll regain audio without lifting a finger.
Effortless automation, combined with an adequate delay seems to be working well in the sense that I can now both browse/read forums and webpages, watch YouTube and also not lose sh4 audio which is what I wanted in the first place.

What I still cannot do is use the keyboard, for example while typing this message I have had to set the script to setting 0 (automation turned off) otherwise it would keep reactivating sh4 window when I don't want it to.
That's why I am still after a better solution, if I find one I will share that too. Meanwhile always happy for any more tips/assistance.

Just to be clear to benefit from this script, you need a dual (or better) screen setup and (probably) need to be running sh4 with (almost)-fullscreen-borderless mode, using the 1-pixel-less hack described in post #14 in this thread. Only after that you can freely move your mouse in the other screen without losing sh4 audio.
themrwho is offline   Reply With Quote
Old 03-13-21, 04:10 PM   #7
themrwho
Torpedoman
 
Join Date: Jul 2010
Posts: 119
Downloads: 141
Uploads: 0


Default

Playing the game now & testing this script which led to a few small improvements. The GitLab repo has been updated.

1) For announcing new focus effort level rather than using .MP3 files we are now using .WAV files (0.wav, 1.wav, 2.wav). This change make script 100% compatible pretty much with any Windows O/S you can play sh4 on - in other words potentially missing mp3 codec is a non-issue now.

2) After further testing, the announcement volume level bothered me as it was too high. I have modified the 3x wav files and made alternative versions which have audio gain reduced by 18dB.
Script by default tries to play the minus18dB WAV files but should you prefer original (loud) WAVs or loud MP3s then you can simply change the relevant lines to restore old behaviour.

With this change, announcement now is more like: "FYI this is the new level..."
Older version was more like 25th second of this clip:
themrwho is offline   Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -5. The time now is 05:46 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright © 1995- 2025 Subsim®
"Subsim" is a registered trademark, all rights reserved.