View Full Version : [TEC/REL] Workaround for radio repeating the broadcasts when loading a save
Misfit138
07-29-07, 12:41 AM
Ok, I'm pretty sure that most of you have already figured this out but those who haven't, this is for you. Besides, I figure this out only yesterday and been testing it to see if this really works and it seems to
This workaround is basicly very simple but kind of hard to explain so bare with me
An example
You were on a patrol and saved on December 13th 1941 16:31 and then exited the game. Normally when you load a save, you'll have to listen the radio broadcasts all over again from the beginning of the patrol. Well, not anymore!
First, before you start your game, open the radio folder (Silent Hunter IV/Data/Sound/Radio) and from there select the radio station you are using. For example the radio Washington folder. Then go into the Events folder and open the events.ini file with your notepad. You'll see the following code
;1941 news
;=========
[EVENT]
StartDate=07.12.1941
StartTime=19.00.00
MediaFile=News_Intro_Line_02.ogg
[EVENT]
StartDate=07.12.1941
StartTime=19.00.03
MediaFile=News_1941_01.ogg
[EVENT]
StartDate=07.12.1941
StartTime=20.00.00
MediaFile=News_Intro_Line_02.ogg
[EVENT]
StartDate=07.12.1941
StartTime=20.00.03
MediaFile=News_1941_02.ogg
[EVENT]
StartDate=08.12.1941
StartTime=19.00.00
MediaFile=News_Intro_Line_01.ogg
[EVENT]
StartDate=08.12.1941
StartTime=19.00.03
MediaFile=News_1941_03.ogg
[EVENT]
StartDate=08.12.1941
StartTime=20.00.00
MediaFile=News_Intro_Line_03.ogg
[EVENT]
StartDate=08.12.1941
StartTime=20.00.03
MediaFile=News_1941_04.ogg
[EVENT]
StartDate=09.12.1941
StartTime=20.00.00
MediaFile=News_Intro_Line_02.ogg
[EVENT]
StartDate=09.12.1941
StartTime=20.00.03
MediaFile=PearlHarbor.mp3
[EVENT]
StartDate=11.12.1941
StartTime=20.00.00
MediaFile=News_Intro_Line_02.ogg
[EVENT]
StartDate=11.12.1941
StartTime=20.00.03
MediaFile=News_1941_05.ogg
[EVENT]
StartDate=31.12.1941
StartTime=20.00.00
MediaFile=News_Intro_Line_01.ogg
[EVENT]
StartDate=31.12.1941
StartTime=20.00.03
MediaFile=News_1941_06.ogg
Etc. Etc.
Before you do any changes into this file you should make a backup so save it with a name events2.ini. Now open the events.ini and just remove all the markings from top to bottom to the date you saved. With my example this date would be the December 13th 1941 16:31. Now the code in your events.ini file should look like this
1941 news
;=========
[EVENT]
StartDate=31.12.1941
StartTime=20.00.00
MediaFile=News_Intro_Line_01.ogg
[EVENT]
StartDate=31.12.1941
StartTime=20.00.03
MediaFile=News_1941_06.ogg
Etc. Etc.
You'll have to do this to every events.ini file if you have more than just that radio Washington. If there is an easier way, please let me know :D
Von Manteuffel
07-29-07, 02:36 AM
Well done, Misfit.
I'm afraid, though, that for me, it's too fiddley - especially as I have a number of careers running simultaneously.
What's neded is something which will change the radio.ini "automatically".
It's as "simple" as a "find/replace" routine, where the station start-dates in the radio.ini are replaced with a date you type in.
JSGME might be able to do it and, when it appears, SH4 Skipper, I hope, will include it.
Till then, as an alternative, I'll continue to use the randomised tracks option, with individual tracks edited to sound like a continuous radio broadcast.
Why not try it and let me know what you think?
http://sh.xset.co.uk (http://sh.xset.co.uk/)
Misfit138
07-29-07, 02:56 AM
JSGME might be able to do it and, when it appears, SH4 Skipper, I hope, will include it.
I'm 100% sure that this kind of tweak is pretty much impossible to do with JSGME. Way too many varibles but I too was thinking that some kind of easy tweak might be possible with SH4 skipper... :hmm:
I'm really sorry that I'm not able to come up with anything easier. This whole radio feature is on my top 3 favourite improvements over the SH3 so this bug is really bugging me too :damn:
Misfit138
07-29-07, 03:59 AM
Been doing some more digging now. I noticed already sometime ago that current date in save files is always the start date so I tried to fix this radio bug by changing the date into what it was in the middle of the patrol but it didn't do anything. But I think this was with 1.2 or 1.1. Now with 1.3 when I try to do the same, I get a CTD after the "please wait" message
I think the whole source of this problem is related to not detecting the current date correctly. While middle of the patrol, that is
Misfit138
07-30-07, 04:44 PM
I apologize for bumping my own thread but some of you might be interested about the current progress
About 10 hours ago I started coding a tool to make the events.ini file adjustments easier and so far, I've been making really nice progress. Working backup function and capability to modify the events.ini file has already been implemented. Currently you can only adjust the radio Washington and this tool can be used only in command prompt but my main interest at the moment is only to make the code to do the absolutely required functions only. User friendly interface is going to be implemented before the final release. Can't even guess when that is going to happen and if it happens. Maybe they release 1.4 patch and fix this problem which would be pretty nice :smug:
Digital_Trucker
07-30-07, 06:45 PM
Just a suggestion, but why not save the whole events.ini files for the various radio stations in seperate folders (or with names that would point to the folders in the game) and have your program only copy the events for the selected date forward into the game. This way, there is no need to keep a backup since the whole file is stored unchanged.
If you then read through all the folders (or file names) that point to the radio station folders in the game install, you could create the events.ini files for all the radio stations in one shot.
Misfit138
07-31-07, 12:09 PM
Just a suggestion, but why not save the whole events.ini files for the various radio stations in seperate folders (or with names that would point to the folders in the game) and have your program only copy the events for the selected date forward into the game. This way, there is no need to keep a backup since the whole file is stored unchanged.
I'm not sure is this possible or even if I'm able to do this. Currently the backup function actually works pretty much the same as in JSGME so I guess it's good enough but suggestions are always welcome :)
I'll improve functions, code etc. as I make progress and learn to code more complicated stuff. Haven't been doing any C++ in 2-3 years so basicly I'm coding as I learn
Also, I decided to make this tool even if this radio bug will be fixed. I think it would be pretty handy to be able to adjust the events.ini files like for example, you want to listen the music but not the news and tweaks like that
Von Manteuffel
07-31-07, 02:02 PM
Way to go, Misfit138! :rock: I wish I could help, but I am to coding what the Mongols were to peace, love and international fraternity. Of course, if you can crack the problem, it means I've got to resume work on the Super-Station :doh:
Oh well!
All the best
VonM
Digital_Trucker
07-31-07, 02:58 PM
Misfit138, if there was a decent COBOL or Fortran IV compiler (showing my age here), I could whip something up real quick :rotfl: .
I've done a few things in Visual Basic, so I have an idea of how to do it, and it should be doable in C++ also. All it would invlolve would be reading through the original events.ini file and only writing out the events that occur on or after the date that you saved your career into the events.ini file in the radio station events folder.
You could place the original events.ini files from the radio stations into the blah,blah,blah...\Data\Sound\Radio folder and name them something like RadioStation.events (replace RadioStation with the name of the folder that the station is in). Then you could use your program to read the .events files and write to the .....RadioStation\events\events.ini file.
Misfit138
07-31-07, 03:49 PM
Misfit138, if there was a decent COBOL or Fortran IV compiler (showing my age here), I could whip something up real quick :rotfl: .
I've done a few things in Visual Basic, so I have an idea of how to do it, and it should be doable in C++ also. All it would invlolve would be reading through the original events.ini file and only writing out the events that occur on or after the date that you saved your career into the events.ini file in the radio station events folder.
You could place the original events.ini files from the radio stations into the blah,blah,blah...\Data\Sound\Radio folder and name them something like RadioStation.events (replace RadioStation with the name of the folder that the station is in). Then you could use your program to read the .events files and write to the .....RadioStation\events\events.ini file.
Oh yeah, Think I got it now. It is possible to do. Probable even with my skills! I'm not much of a programmer really. That's the reasons why I quit it in the first place but I'm gonna give this a try anyway
Sounds great guys. This would be a welcome addition for us radio junkies. :up:
While your in there, can anything be done to get Alvin & The Chipmunks out of my radio?
Thanks
Misfit138
07-31-07, 05:29 PM
While your in there, can anything be done to get Alvin & The Chipmunks out of my radio?
Sorry, can't help. I've read about this a couple of times but this has never happened to me
Von Manteuffel
08-01-07, 05:42 AM
Speeded-up ( or even slowed-down ) playback sometimes happens and, as yet, no-one has found a reason, or a cure. The effect is also intermittent - a station which sounds speeded up on one occasion can play out perfectly normally next time you start SH IV :doh: And in a run of stations, any number can play-out fine, but then there'll be the Chipmunks - then more normal stations.
I've tried playing around with all the available in-game sound settings, but haven't found a cure yet. I think it's simply a programming glitch. It's probably nothing to do with format, bitrate, or sample rates, otherwise the chances are that the fault would be more constant - i.e. happening every time to every station with audio at, say, a certain bitrate etc.
The answer I've found is to have a number of stations and if one does go wrong, simply tune to another which is OK. I also split content into "duplicate" stations - e.g. I run with 3 "Big Band" stations, each with around 12 hours of different tracks. If one happens to go "Chipmunk" I go to one of the other two.
Thanks. I started pulling files out of my folders when this would happen, but it would just happen to other files. I guess we will have to just live with it for now.
Misfit138
08-04-07, 08:21 AM
Think I'm going to leave this to somebody who actually knows how to code. Basicly I'm not doing any progress at all. Been fighting with this one thing for 4 days already but I just can't solve it and getting pretty frustrated
Like I mentioned this earlier, I'm not much of a programmer
Digital_Trucker
08-04-07, 09:03 AM
Sorry to hear that Misfit138. It was a good try, anyway. Thanks for the effort.
Since you brought up the workaround and in thinking about the comments that have been made here, I've come up with a plan for a "Radio Station Manager" application. It would allow you to create a radio station from scratch or modify existing stations. If I can work out the save file formats, I'll probably include a fix for the start date by retrieving the correct date that the career was saved. If not, I'll just let you enter it and do what's necessary to have the events start at the correct date.
I can't guarantee how fast I'll get it done because the combination of my rusty old brain and working with a programming language that I'm not totally familiar with (i.e. one that is NOT totally obsolete:rotfl: ) is not real conducive to speed.
Misfit138
08-04-07, 09:55 AM
Since you brought up the workaround and in thinking about the comments that have been made here, I've come up with a plan for a "Radio Station Manager" application. It would allow you to create a radio station from scratch or modify existing stations. If I can work out the save file formats, I'll probably include a fix for the start date by retrieving the correct date that the career was saved. If not, I'll just let you enter it and do what's necessary to have the events start at the correct date.
Damn, that sounds really good! :up:
I'm fairly certain that this whole date thingy has to be entered manually. But I'm trying to dig out how the game manages to keep the date correct when you load a save since the current date in save files is always the start date... :hmm:
JScones
08-04-07, 11:04 AM
If I may offer a suggestion, the easiest way to do it would be to present the user with a screen containing a text box (for either obtaining the patrol date or allowing the user to change the pre-populated date) and two buttons.
The first button would be your "Run" button. It would, broadly speaking, build a string list of the folders under \Silent Hunter IV\Data\Sound\Radio\.
Once you have the list of folders (ie stations), you can easily iterate through each events.ini file. To avoid version integrity problems, I would actually recommend NOT creating backups of the original events.ini files as you WILL become unstuck at some point. No, the easiest way would be to simply read through each events.ini, line by line, and comment out (prefix with a semicolon) all entries that are prior to the patrol date and uncomment all entries that are on or after the patrol date (a safety net in case the player has chosen a different career that is earlier in time from the last one). This approach makes your tool totally independant of events.ini in the sense that it does not matter what the file contains or whether it has been changed by the user in the meantime.
You'll end up with something like:
;;1941 news
;;=========
;
;[EVENT]
;StartDate=07.12.1941
;StartTime=19.00.00
;MediaFile=News_Intro_Line_02.ogg
;
;[EVENT]
;StartDate=07.12.1941
;StartTime=19.00.03
;MediaFile=News_1941_01.ogg
;
;[EVENT]
;StartDate=07.12.1941
;StartTime=20.00.00
;MediaFile=News_Intro_Line_02.ogg
;
;[EVENT]
;StartDate=07.12.1941
;StartTime=20.00.03
;MediaFile=News_1941_02.ogg
[EVENT]
StartDate=08.12.1941
StartTime=19.00.00
MediaFile=News_Intro_Line_01.ogg
[EVENT]
StartDate=08.12.1941
StartTime=19.00.03
MediaFile=News_1941_03.ogg
etc etc
So this is where your second button would come in. It would be a "Clean" button, where pressing it would merely go through and remove all the semicolons that you added, returning the file to how it was (some users would like this kinda thing). Not overly necessary, as the next time you "Run" you'll essentially remove/add semicolons as required for the latest career patrol date (do you see how this is working and why a backup is unnecessary?).
A crudish implementation - I would integrate it more with SH4 - but one which I'm sure you can achieve with some thought. I'd offer to write it in the language of your choice (heck, I already have such code written in a toolkit I developed for the GWX guys, so I know it would work, and very quickly too), but my time over the next few weeks will be *very* limited.
Good luck.
Misfit138
08-04-07, 11:38 AM
Yeah, I decided to ditch the backup function when I started to code MFC app. Replaced it with an idea of a Rollback button which removes all the markings made into the files with this tool thus restoring it in it's orginal state
This ofcourse requires commenting out the markings based on the user input but this is easier and cleanier to do than completely removing the markings so I guess I was on the right track :88)
PS. I solved the problem I've been fighting with those 4 long days but don't hold your breath. That was an easy one. From now on, it really starts to get difficult
@JScones, thanks for the offer. I'll give that a try myself first. I'd really like to learn more programming and this is the perfect opportunity but I'll probable end up asking you to write it :p
Digital_Trucker
08-04-07, 01:20 PM
Thanks for the suggestion, JScones. I hadn't thought of doing it that way, but it makes a hell of a lot of sense to allow for modifications outside of the app.
Misfit138, glad to hear you got past your hurdle. It's a satisfying feeling to code yourself past a problem (much more fun than coding yourself into a corner).
vBulletin® v3.8.11, Copyright ©2000-2025, vBulletin Solutions Inc.