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 > SH5 Mods Workshop
Forget password? Reset here

Reply
 
Thread Tools Display Modes
Old 05-07-13, 05:19 AM   #9916
Tonci87
Samurai Navy
 
Join Date: Jun 2012
Posts: 563
Downloads: 116
Uploads: 0


Default

I used that quite frequently, how are you going to improve it?
Tonci87 is offline   Reply With Quote
Old 05-07-13, 09:07 AM   #9917
TheDarkWraith
Black Magic
 
Join Date: Jun 2007
Posts: 11,962
Downloads: 147
Uploads: 5


Default

Quote:
Originally Posted by Tonci87 View Post
I used that quite frequently, how are you going to improve it?
Not improving it. It works great and as intended. Was just merely bringing it up in case users weren't aware of it. There are many things in the mod that most users aren't aware of
TheDarkWraith is offline   Reply With Quote
Old 05-07-13, 09:08 AM   #9918
Tonci87
Samurai Navy
 
Join Date: Jun 2012
Posts: 563
Downloads: 116
Uploads: 0


Default

Quote:
Originally Posted by TheDarkWraith View Post
Not improving it. It works great and as intended. Was just merely bringing it up in case users weren't aware of it. There are many things in the mod that most users aren't aware of

Damn that means that there is something I´m not aware of
Tonci87 is offline   Reply With Quote
Old 05-07-13, 09:10 AM   #9919
TheDarkWraith
Black Magic
 
Join Date: Jun 2007
Posts: 11,962
Downloads: 147
Uploads: 5


Default

Quote:
Originally Posted by Tonci87 View Post
Damn that means that there is something I´m not aware of
I forget everything that I added to the mod. I have to read over my own release notes to see what I did add. Then sometimes I have to look over my code to remember how to enable them
TheDarkWraith is offline   Reply With Quote
Old 05-07-13, 10:42 AM   #9920
Targor Avelany
Ace of the Deep
 
Join Date: Jan 2010
Location: Vancouver, BC, Canada
Posts: 1,183
Downloads: 225
Uploads: 0


Default

Quote:
Originally Posted by TheDarkWraith View Post
I forget everything that I added to the mod. I have to read over my own release notes to see what I did add. Then sometimes I have to look over my code to remember how to enable them
Ok, as much as me programming and you programming on a totally different level (will have to admit that you operate with stuff that I can only imagine about), this made me laugh to the point of falling off my chair. This is very familliar. Had to do similar thing recently.
Targor Avelany is offline   Reply With Quote
Old 05-07-13, 11:04 AM   #9921
TheDarkWraith
Black Magic
 
Join Date: Jun 2007
Posts: 11,962
Downloads: 147
Uploads: 5


Default

Quote:
Originally Posted by SkyBaron View Post
EDIT: I finally figured out how to do it. Never thought of looking at the .ini files, that was the problem. Now when I try to use Menu.PlaySound("sh.sdl sound name") I get this error:
Your problem was because of incorrect entries in Sh.sdl file. I see you used S3D to edit the file and that is probably why you got the errors. Hex editor or my SDL Editor app is best way to edit that file I sent you an early xmas present
TheDarkWraith is offline   Reply With Quote
Old 05-07-13, 12:36 PM   #9922
Lucky07
Torpedoman
 
Join Date: Feb 2011
Location: Ubooting
Posts: 118
Downloads: 246
Uploads: 0
Default

hi , congratulations for the mod , the less i check is really good , but i have some installation troubles maybe , at starting a game , some permanent winwos stay and , are unclosable , map , unsusable , any input is ignored , so ? any help ? i place the mod following the sobers megamod , no way of making it run properly , any help welcome
Lucky07 is offline   Reply With Quote
Old 05-07-13, 01:05 PM   #9923
volodya61
Ocean Warrior
 
volodya61's Avatar
 
Join Date: Feb 2012
Location: Rostov-on-Don, local time GMT+4
Posts: 3,300
Downloads: 374
Uploads: 0


Default

Quote:
Originally Posted by Lucky07 View Post
hi , congratulations for the mod , the less i check is really good , but i have some installation troubles maybe , at starting a game , some permanent winwos stay and , are unclosable , map , unsusable , any input is ignored , so ? any help ? i place the mod following the sobers megamod , no way of making it run properly , any help welcome
Two variants -
1. your game is not patched to v 1.2
2. corrupted files.. you should use 7zip to extract files and everything will be OK..
__________________
.
Where does human stupidity end?

.


El sueño de la razón produce monstruos © - and for some people awakening will be cruel
volodya61 is offline   Reply With Quote
Old 05-07-13, 01:11 PM   #9924
SkyBaron
Lieutenant
 
Join Date: Mar 2010
Location: South Atlantic
Posts: 262
Downloads: 673
Uploads: 2
Default

Quote:
Originally Posted by TheDarkWraith View Post
Your problem was because of incorrect entries in Sh.sdl file. I see you used S3D to edit the file and that is probably why you got the errors. Hex editor or my SDL Editor app is best way to edit that file I sent you an early xmas present
Thanks TDW, I got your PM! I'm starting to understand SH5 scripting a little better after reading your comments
After copying all your files, including the new sh.sdl, I still seem to be having the same problem Maybe it's my configuration or something else. The sound won't play, and if I remove the try/except block, I get the same error as before.
Now when I use a default sound like Menu.Click or Menu.Periscope.Move in my script it works fine. I've tried renaming the sound to Menu.Warning , make it the same length/bitrate/etc as the ones that played, but I either get the same error or it goes into the except block.
__________________


SkyBaron is offline   Reply With Quote
Old 05-07-13, 01:12 PM   #9925
Lucky07
Torpedoman
 
Join Date: Feb 2011
Location: Ubooting
Posts: 118
Downloads: 246
Uploads: 0
Default

Quote:
Originally Posted by volodya61 View Post
Two variants -
1. your game is not patched to v 1.2
2. corrupted files.. you should use 7zip to extract files and everything will be OK..
**** u are right ... im at 1.0.5 version , any link for safe download ? i cant found the oficial patch mirror
Lucky07 is offline   Reply With Quote
Old 05-07-13, 01:15 PM   #9926
volodya61
Ocean Warrior
 
volodya61's Avatar
 
Join Date: Feb 2012
Location: Rostov-on-Don, local time GMT+4
Posts: 3,300
Downloads: 374
Uploads: 0


Default

Quote:
Originally Posted by Lucky07 View Post
**** u are right ... im at 1.0.5 version , any link for safe download ? i cant found the oficial patch mirror
http://www.mediafire.com/download.php?gc6eg9ck5455bgs
__________________
.
Where does human stupidity end?

.


El sueño de la razón produce monstruos © - and for some people awakening will be cruel
volodya61 is offline   Reply With Quote
Old 05-07-13, 01:30 PM   #9927
Lucky07
Torpedoman
 
Join Date: Feb 2011
Location: Ubooting
Posts: 118
Downloads: 246
Uploads: 0
Default

pretty much apreciated volodya
Lucky07 is offline   Reply With Quote
Old 05-07-13, 04:11 PM   #9928
TheDarkWraith
Black Magic
 
Join Date: Jun 2007
Posts: 11,962
Downloads: 147
Uploads: 5


Default

Quote:
Originally Posted by SkyBaron View Post
Thanks TDW, I got your PM! I'm starting to understand SH5 scripting a little better after reading your comments
After copying all your files, including the new sh.sdl, I still seem to be having the same problem Maybe it's my configuration or something else. The sound won't play, and if I remove the try/except block, I get the same error as before.
Now when I use a default sound like Menu.Click or Menu.Periscope.Move in my script it works fine. I've tried renaming the sound to Menu.Warning , make it the same length/bitrate/etc as the ones that played, but I either get the same error or it goes into the except block.
Oh I didn't try it without the exception handler code. I'll try it again. That's probably why I never heard the sound play
TheDarkWraith is offline   Reply With Quote
Old 05-07-13, 06:36 PM   #9929
TheDarkWraith
Black Magic
 
Join Date: Jun 2007
Posts: 11,962
Downloads: 147
Uploads: 5


Default

Quote:
Originally Posted by SkyBaron View Post
Thanks TDW, I got your PM! I'm starting to understand SH5 scripting a little better after reading your comments
After copying all your files, including the new sh.sdl, I still seem to be having the same problem Maybe it's my configuration or something else. The sound won't play, and if I remove the try/except block, I get the same error as before.
Now when I use a default sound like Menu.Click or Menu.Periscope.Move in my script it works fine. I've tried renaming the sound to Menu.Warning , make it the same length/bitrate/etc as the ones that played, but I either get the same error or it goes into the except block.
Tried everything to make it work and kept getting the error. Finally decided to watch it in debugger to see what's going on. The answer became clear real fast - the game is hard coded to recognize only certain sounds for Menu.PlaySound() as evidenced by this snippet of code:

CPU Disasm
Address Hex dump Command Comments
05664C2E |> 8B4424 18 MOV EAX,DWORD PTR SS:[ESP+18] ; Case 3E8 of switch SHSound_act.5664BA9
05664C32 |. 389E 48010000 CMP BYTE PTR DS:[ESI+148],BL
05664C38 |.- 75 08 JNE SHORT SHSound_act.05664C42
05664C3A |. 3BC3 CMP EAX,EBX
05664C3C |.- 0F84 87010000 JE SHSound_act.05664DC9
05664C42 |> 8B4C86 50 MOV ECX,DWORD PTR DS:[EAX*4+ESI+50]
05664C46 |. 3BCB CMP ECX,EBX
05664C48 |.- 0F84 7B010000 JE SHSound_act.05664DC9
05664C4E |. 0FB681 460200 MOVZX EAX,BYTE PTR DS:[ECX+246]

what we're looking at is the index of the sound to play is loaded into EAX. EAX is compared to EBX (0). If 0 then sound doesn't exist and the function exits. If sound exists then pointer to the sound is loaded into ECX. Now here's where the error is coming from: the CMP EAX,EBX. The problem is if the game doesn't recognize the sound called for it passes -1 to the function. Comparing -1 to EBX (0) definitely isn't equal so game tries to load pointer from protected memory area and thus error occurs. I'm going to release a patch for this that will have the function fail gracefully if the sound isn't recognized thus preventing the error being thrown.

What this means is Menu.PlaySound() only plays sounds that are hard coded in the game - we cannot add new sounds for it
TheDarkWraith is offline   Reply With Quote
Old 05-07-13, 09:34 PM   #9930
SkyBaron
Lieutenant
 
Join Date: Mar 2010
Location: South Atlantic
Posts: 262
Downloads: 673
Uploads: 2
Default

Quote:
Originally Posted by TheDarkWraith View Post
Tried everything to make it work and kept getting the error. Finally decided to watch it in debugger to see what's going on. The answer became clear real fast - the game is hard coded to recognize only certain sounds for Menu.PlaySound() as evidenced by this snippet of code:

CPU Disasm
Address Hex dump Command Comments
05664C2E |> 8B4424 18 MOV EAX,DWORD PTR SS:[ESP+18] ; Case 3E8 of switch SHSound_act.5664BA9
05664C32 |. 389E 48010000 CMP BYTE PTR DS:[ESI+148],BL
05664C38 |.- 75 08 JNE SHORT SHSound_act.05664C42
05664C3A |. 3BC3 CMP EAX,EBX
05664C3C |.- 0F84 87010000 JE SHSound_act.05664DC9
05664C42 |> 8B4C86 50 MOV ECX,DWORD PTR DS:[EAX*4+ESI+50]
05664C46 |. 3BCB CMP ECX,EBX
05664C48 |.- 0F84 7B010000 JE SHSound_act.05664DC9
05664C4E |. 0FB681 460200 MOVZX EAX,BYTE PTR DS:[ECX+246]

what we're looking at is the index of the sound to play is loaded into EAX. EAX is compared to EBX (0). If 0 then sound doesn't exist and the function exits. If sound exists then pointer to the sound is loaded into ECX. Now here's where the error is coming from: the CMP EAX,EBX. The problem is if the game doesn't recognize the sound called for it passes -1 to the function. Comparing -1 to EBX (0) definitely isn't equal so game tries to load pointer from protected memory area and thus error occurs. I'm going to release a patch for this that will have the function fail gracefully if the sound isn't recognized thus preventing the error being thrown.

What this means is Menu.PlaySound() only plays sounds that are hard coded in the game - we cannot add new sounds for it

That explains it! Thanks for letting me know. In any case I wanted to try my hand at writing a C# .dll for sh5 and I can start by creating a sound dll (maybe similar to the one you made) it'll be good for compatibility with other UIs, and I'll also learn in the process!. I've seen a few C# DirectSound implementations online and they don't look too difficult (I'm not a professional programmer, but I find it very interesting).

I wanted to ask you a couple of technical questions. I'm playing around with the menu editor/scripting, trying to learn more stuff, and I wanted to know if any of these are possible:

1 - When I create a button and use its ".Clicked" property, the mouse click event is called when the mouse button is released. Is there a way to get a mouse event as soon as the user presses down the button instead of only when it is released? I've seen dials that do that, but I'm not sure if it's doable with buttons.

2 - I tried to create an EditBox to input some text, but they seem to be limited to 30 characters or something like that. Is there a way to increase this limit?

Thanks!
__________________


SkyBaron is offline   Reply With Quote
Reply

Tags
dbrn, favorite, new ui


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 12:59 PM.


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