Apolyton Archive  |  Preserved copy of the Apolyton Civilization Site and its forums as they stood in September 2005. Read-only; nothing here can be posted to or replied to.  |  Forum index |  About this archive |  The 1998–2001 UBB forums
Today on Apolyton WARDELL INTERVIEW PROMO A.C.S. HISTORY CHAPTER 4 GET CIV4 /w FREE PLUS! A.C.S. PHOTO GALLERY GET A.O.M. V1.1
Apolyton Civilization Forums
main| civ2| civ3| civ4| smac| ctp2| ron| moo3| galciv| galciv2| alt| about|
ApolytonPLUS | register | search | faq | new posts | pm (-/-) | upload | members
hall of fame new! | civgroups | civgroups news | interviews | the column | radio | chat | directory | news | store | PLUS
Apolyton Civilization Forums : Powered by vBulletin version 2.0.3 Apolyton Civilization Forums > Call To Power II > CtP2-Source Code Project > DEBUG: sucess with the sound! :)
Show a Printable Version | Email This Page to Someone! | Receive updates to this thread | Report this to Apolyton news!
CivGroups
CTP2 Source Code Project (59): Not a Member - Join

bottom of page
  
Author
Thread   
Pages (2): [ 1   2   ]
< Last Thread     Next Thread > Post New Thread     Post A Reply
jonwil is offline jonwil
Settler

Nov 2003
time: 05:31
  Old Post 04-11-2003 15:27
Edit/Delete Message Reply w/Quote
#1 Report this post to a moderator
sucess with the sound! :) Support Apolyton, buy Civilization 2

grab these:
http://users.tpgi.com.au/jonwil/mss32.lib
http://users.tpgi.com.au/jonwil/mss.h

and put them somewhere that the ctp2 build process can find them.

Neither of these contain anything thats (C) Rad Game Tools (I dont have the official MSS SDK to copy from even if I did want to

These files sucessfully compile an unmodified copy of the CTP2 tree (assuming you have the other build things like the SDKs that is)

Next step is for someone good at CTP2 to completly excercise the changes in-game and see if there are any problems.

If you get crashes, it probobly means the definition of one or more of the MSS32.dll functions is wrong (and will need to be fixed) which is in turn causing e.g. an int to be passed when a float is expected and give wrong results)

Fromafar is offline Fromafar
Prince

May 2003
time: 06:31
  Old Post 04-11-2003 16:06
Edit/Delete Message Reply w/Quote
#2 Report this post to a moderator
Browse Apolyton AD-FREE

The parameter and return types should be correct, except for the WINAPI AIL_redbook_track function. I expect that the return type will not be bool, but rather something like S32 or U32. You may have to remove the const qualifiers with the parameters (unlikely for an extern "C" interface).

The main issue will be finding the actual code values for the names in the enums. These are unlikely to be correct.

jonwil is offline jonwil
Settler

Nov 2003
time: 05:31
  Old Post 04-11-2003 16:35
Edit/Delete Message Reply w/Quote
#3 Report this post to a moderator
if you have donwloaded the files before Increase the size of your Attachments

go do it again, turns out that it wasnt compiling properly after all.
Now it should compile (using the *.lib I just uploaded)

Still havent been able to test it though (PC problems)

Somehow, it seems like the methods I was using to generate the Import Library werent working properly so I had to try a different method (which basicly involved creating a "mss32.dll" that only had the functions we know about and did absolutly nothing and using the resulting *.lib file)

Any problems with this, let me know

Asmodean is offline Asmodean
King
Aarhus, Denmark
Aug 1999
time: 06:31
  Old Post 04-11-2003 16:48 Visit Asmodean's homepage!
Edit/Delete Message Reply w/Quote
#4 Report this post to a moderator
Put an end to popups!

If this works, then you are bleedin' awesome, jonwil

Asmodean

jonwil is offline jonwil
Settler

Nov 2003
time: 05:31
  Old Post 04-11-2003 17:38
Edit/Delete Message Reply w/Quote
#5 Report this post to a moderator
Support Apolyton or Terrorists Win

BTW, this doesnt use anything that could be considered as (C) Rad Game Tools.
I didnt even do e.g. dumps on mss32.dll.
So there is no way they can claim that I am voilating their copyright

The Big Mc is offline The Big Mc
King
Of the universe / England
Oct 2001
time: 05:31
  Old Post 04-11-2003 18:20 Visit The Big Mc's homepage!
Edit/Delete Message Reply w/Quote
#6 Report this post to a moderator
Got spare money?

kiking

DDowell is offline DDowell
Chieftain
Västerås, Sweden
Nov 2001
time: 06:31
  Old Post 04-11-2003 18:47
Edit/Delete Message Reply w/Quote
#7 Report this post to a moderator
Put an end to popups!

Great work! Feels nice to have sound again

jonwil is offline jonwil
Settler

Nov 2003
time: 05:31
  Old Post 04-11-2003 18:55
Edit/Delete Message Reply w/Quote
#8 Report this post to a moderator
I assume that means... Lose 30 kilos (of popups)

That its actually working without crashes or problems?

DDowell is offline DDowell
Chieftain
Västerås, Sweden
Nov 2001
time: 06:31
  Old Post 04-11-2003 18:56
Edit/Delete Message Reply w/Quote
#9 Report this post to a moderator
Re: I assume that means... Support Apolyton, buy Civilization 2

quote:
Originally posted by jonwil
That its actually working without crashes or problems?


It does for me at least. Thanks again man!

Martin Gühmann is offline Martin Gühmann
Emperor
Berlin, Germany
Mar 2001
time: 06:31
Post  Old Post 04-11-2003 20:06 Visit Martin Gühmann's homepage!
Edit/Delete Message Reply w/Quote
#10 Report this post to a moderator
Re: I assume that means... Inflate your Upload Space

quote:
Originally posted by jonwil
That its actually working without crashes or problems?


I don't encounter any problems that weren't there before. But it works. By the way is there a linux version of the mss32.dll?

-Martin

J Bytheway is offline J Bytheway
Emperor
England
Jul 2001
time: 05:31
  Old Post 04-11-2003 20:11 Visit J Bytheway's homepage!
Edit/Delete Message Reply w/Quote
#11 Report this post to a moderator
Get a bigger avatar today!

Excellent. Will test soon.

centrifuge is offline centrifuge
Prince
USA
Apr 2002
time: 22:31
  Old Post 04-11-2003 20:20
Edit/Delete Message Reply w/Quote
#12 Report this post to a moderator
Support Apolyton, buy Alpha Centauri

Good work

jonwil is offline jonwil
Settler

Nov 2003
time: 05:31
  Old Post 05-11-2003 03:10
Edit/Delete Message Reply w/Quote
#13 Report this post to a moderator
Avatar Enlargement: We've got the solution

dont know if there is a linux version of mss32.dll or not.
But if there is, I dont have it

Locutus is offline Locutus
ACS CTP1/2 Manager & Civ4 Co-Manager
Hengelo, The Netherlands
Nov 1999
time: 06:31
  Old Post 05-11-2003 03:15 Visit Locutus<br><img src=/forums/images/staff-icon.gif>'s homepage!
Edit/Delete Message Reply w/Quote
#14 Report this post to a moderator
Browse Apolyton AD-FREE

So far seems to work okay. Brilliant work, jonwil

J Bytheway is offline J Bytheway
Emperor
England
Jul 2001
time: 05:31
  Old Post 05-11-2003 04:57 Visit J Bytheway's homepage!
Edit/Delete Message Reply w/Quote
#15 Report this post to a moderator
Support Apolyton, buy Civilization III: Complete

Seems to work just fine. I still have that ever-repeating track 1 bug, but that's not new...

kaan is offline kaan
Prince
Aarhus
Mar 2001
time: 05:31
  Old Post 05-11-2003 05:08
Edit/Delete Message Reply w/Quote
#16 Report this post to a moderator
Enter the AD-FREE zone

quote:
Originally posted by J Bytheway
Seems to work just fine. I still have that ever-repeating track 1 bug, but that's not new...


The solution to that one is in a clear text file called something akin to "playlist" somewhere in the gamedir as far as i can recall

Solver is offline Solver
Apolyton Duke Of Something
Latvia, Riga
Sep 2000
time: 07:31
  Old Post 05-11-2003 20:57 Visit Solver<br><img src=/forums/images/staff-icon.gif>'s homepage!
Edit/Delete Message Reply w/Quote
#17 Report this post to a moderator
Support Apolyton, pre-order Civilization IV

So... why am I getting the mss32.dll not found with this fix? Do I need to compile the DLL myself, or what?

MrBaggins is offline MrBaggins
King

May 1999
time: 05:31
  Old Post 05-11-2003 21:07
Edit/Delete Message Reply w/Quote
#18 Report this post to a moderator
Increase Your PM Length

where are you running the ctp2.exe from? that dll is in the regular game directory (along with mss16.dll)

Solver is offline Solver
Apolyton Duke Of Something
Latvia, Riga
Sep 2000
time: 07:31
  Old Post 05-11-2003 21:09 Visit Solver<br><img src=/forums/images/staff-icon.gif>'s homepage!
Edit/Delete Message Reply w/Quote
#19 Report this post to a moderator
Support Apolyton, buy GURPS/ Alpha Centauri

Bah, never figured I could look there...

rheinig is offline rheinig
Settler

Nov 2003
time: 05:31
  Old Post 07-11-2003 14:40
Edit/Delete Message Reply w/Quote
#20 Report this post to a moderator
const's Inflate your Upload Space

Beautiful. But I need to reiterate: some of the const declarations are obviously wrong and might damage optimized builds, namely:
AIL_quick_handles
AIL_quick_load_mem (I'd be unsure about a_Dataptr)
AIL_redbook_track_info

Just dropping a few const keywords should suffice.

Seeing someone confirmed this actually works - I'm dead curious how you found the correct values for the constants, especially the 4 redbook ones. lucky guess?

have phun...

Fromafar is offline Fromafar
Prince

May 2003
time: 06:31
  Old Post 07-11-2003 22:55
Edit/Delete Message Reply w/Quote
#21 Report this post to a moderator
Increase Your PM Length

Noone has claimed that these values are correct. Actually, I think it is pretty unlikely they are. From personal investigation with the debugger, I can confirm that at least the ..._ERROR values (first enum value = 0) are correct.

But I definitely would like to see someone with a working sound card confirm the values for QSTAT_DONE and REDBOOK_STOPPED. The other ones (REDBOOK_PLAYING and REDBOOK_PAUSED) are not that relevant. These are mentioned in the code (SoundManager.cpp), but do not trigger any action.

MrBaggins is offline MrBaggins
King

May 1999
time: 05:31
  Old Post 07-11-2003 22:59
Edit/Delete Message Reply w/Quote
#22 Report this post to a moderator
Increase the size of your Attachments

Right... but if these aren't working, why is it working?

Fromafar is offline Fromafar
Prince

May 2003
time: 06:31
  Old Post 08-11-2003 00:27
Edit/Delete Message Reply w/Quote
#23 Report this post to a moderator
Support Apolyton, buy Civilization: The Boardgame

Maybe it is working only most of the time, for not everyone?

The AIL_redbook_status will be checked every 4 seconds, so you may have all kinds of timing related issues that are difficult to trace.

ahenobarb is offline ahenobarb
Prince

Nov 2001
time: 05:31
  Old Post 08-11-2003 21:56
Edit/Delete Message Reply w/Quote
#24 Report this post to a moderator
Lose 30 kilos (of popups)

quote:
Originally posted by J Bytheway
Seems to work just fine. I still have that ever-repeating track 1 bug, but that's not new...


The problem is that everytime you start the game, Auto Repeat is always set to on unless you go into the options menu and change every time. (If you change it in the options menu before you start the game, the songs will cycle).

I looked through the code and the problem is a line in Soundmanager.cpp A variable there is always set to TRUE.

line 84 is:

code:
m_autoRepeat = TRUE;


change it to:
code:
m_autoRepeat = FALSE;


That should ensure that the default setting for auto repeat when the game starts is FALSE. My copy of VC++ hasn't arrived yet, so I can't test it, but it should fix the problem.

Last edited by ahenobarb on 09-11-2003 at 00:44

ahenobarb is offline ahenobarb
Prince

Nov 2001
time: 05:31
  Old Post 09-11-2003 08:52
Edit/Delete Message Reply w/Quote
#25 Report this post to a moderator
Support Apolyton, buy Alpha Centauri

Finally got my compiler and compiled the code. The change I suggested above fixes the problem. You don't have to manually set auto repeat to "off" everytime you start a game. What an annoyance!!

ahenobarb is offline ahenobarb
Prince

Nov 2001
time: 05:31
  Old Post 09-11-2003 12:42
Edit/Delete Message Reply w/Quote
#26 Report this post to a moderator
Inflate your Upload Space

Here's something else cool that I did. It's more of a GUI modification, but it pertains to the sound.

While I was tracking down why the game always seemed to play the same song, it occurred to me that there is no way to access the music options from the Options drop down on the menu bar. I thought It would be useful to be able to access the music options from the game, so I added it to the list of choices, just under “Sound”.

To do this, you must:

1) open keymap.h This file enumerates a type called KEY_FUNCTION. We need to added Music as an enumerator in this type.

Line 74 reads:

code:
KEY_FUNCTION_SOUND_OPTIONS,


add:
code:
KEY_FUNCTION_SOUND_OPTIONS, // MUSIC added by ahenobarb KEY_FUNCTION_MUSIC_OPTIONS,


2) open keymap.cpp This file is linked to keypress.cpp, which controls what function is executed when the item in the list is clicked. The name within the quotes is that name of the string (ommitting “str_ldl” – I don’t know why) in “ldl_str.txt” to print on the screen [see below].

on line 54, add:
code:
// MUSIC added by ahenobarb { 0, KEY_FUNCTION_MUSIC_OPTIONS, "MUSIC_OPTIONS"},


3) open keypress.cpp This file tell CTP2 what functions to execute when a key is pressed.

You need to include the header file for the musicsreen, so on line 90, add:
code:
// music added by ahenobarb #include "musicscreen.h"


musicscreen_displayMyWindow(); is the actual function that causes the music options screen to be displayed. On line 1162, add:
code:
// MUSIC added by ahenobarb case KEY_FUNCTION_MUSIC_OPTIONS: if(!g_modalWindow) { musicscreen_displayMyWindow(); } break;


4) Open controlpanelwindow.cpp, which control the items listed in the drop down menu on the menubar.

You need to include the header file for the musicsreen, so on line 37, add:
code:
// music added by ahenobarb #include "musicscreen.h"


You need to add music to the list of choices in the menu bar. [It should be noted that line 100 of controlwindowpanel.h enumerates the CP_MENU_ITEM type and limits the menu bar drop down lists to 15 items, if you need more than 15 items, you need to add them to CP_MENU_ITEM.] So in the OptionsMenuCallback function, we need to add “music” as a choice. The switch statement for the “Options” menu begins on line 858. On line 915, add:
code:
case CP_MENU_ITEM_12: musicscreen_displayMyWindow(); break;

**** It is not clear whether the function call to “musicscreen_displayMyWindow();” in keypress.cpp or controlpanelwindow.cpp actually calls the music options screen ***

Further down in the file on line 1063 is a ControlPanelWindow class member named RebuildMenus. The purpose of this function is to print the list items here on the screen, so the user can select them. This class member however is not used in the Debug build of the game, but it may be used in other builds. Therefore, you should add music to the list just in case. On line 1146, add:
code:
// MUSIC added by ahenobarb mb->AddMenuItem(menu,(char*)g_theStringDB->GetNameStr("str_ldl_Music"), KeyListItem::GetKeyFromKMScreen(theKeyMap->get_keycode(KEY_FUNCTION_MUSIC_OPTIONS)),(void *)CP_MENU_ITEM_12);


On line 1355 is a ControlPanelWindow class member named BuildOptionsMenu. This member has the same function as the RebuildMenus member, but it is the one that is actually used in the Debug version of the game. On line 1384, add:
code:
// MUSIC added by ahenobarb m_mainMenuBar->AddMenuItem(menu,(char*)g_theStringDB->GetNameStr("str_ldl_Music"), KeyListItem::GetKeyFromKMScreen(theKeyMap->get_keycode(KEY_FUNCTION_MUSIC_OPTIONS)),(void *)CP_MENU_ITEM_12);


5) The rest is just a matter of adding strings to text files.

In the “C:…\ctp2_code\ctp” directory open “userkeymap.txt” and add “^m Music” to the bottom of the list

In the GAME directory “C:…\Call To Power 2\ctp2_data\english\gamedata” not the source code directory, open “Add_str.txt” and add “Str_ldl_MusicHotKey “Ctl+m”” after “…SoundHotKey”

In “ldl_str.txt” under “#Options Menu Strings”, add “str_ldl_Music “Music”” then search for “str_ldl_SOUND” and underneath “..SOUND” and “..SOUND_OPTIONS” add similar entries for “..Music” – Do not put the text within the quotes in all caps, this is the text that will appear on the screen.

In “keymap.txt” add at the bottom “^m MUSIC_OPTIONS”

**** It is important to note that if the string names listed in the .txt files do not agree in case with the string names list in the functions, the game will crash. That means that “ldl_str_MUSIC” listed in the .txt files will cause a crash if the string name is “ldl_str_Music” in the function

I compiled it and there are no problems. I attached a how-to file for downloading. Good luck!!

Attachment: add music to options.rtf
This has been downloaded 3 time(s).

Last edited by ahenobarb on 09-11-2003 at 23:24

Martin Gühmann is offline Martin Gühmann
Emperor
Berlin, Germany
Mar 2001
time: 06:31
Post  Old Post 09-11-2003 20:14 Visit Martin Gühmann's homepage!
Edit/Delete Message Reply w/Quote
#27 Report this post to a moderator
Help yourself to an AD-FREE life

To be precise there is a way to access the sound window from within the game, just press escape. But of course it has also to be on the drop down menue. And another tip ahenobarb, it is much easier to add your modification if you can provide edited files instaed of plain code.

-Martin

ahenobarb is offline ahenobarb
Prince

Nov 2001
time: 05:31
  Old Post 09-11-2003 23:30
Edit/Delete Message Reply w/Quote
#28 Report this post to a moderator
Help yourself to an AD-FREE life

Yes, but what fun would that be?

At anyrate, I learned how the menu bar is coded, so I can add stuff there later, if I want.

Attached is a .zip file with the modified code.

Attachment: music menu item.zip
This has been downloaded 12 time(s).

Martin Gühmann is offline Martin Gühmann
Emperor
Berlin, Germany
Mar 2001
time: 06:31
Post  Old Post 09-11-2003 23:37 Visit Martin Gühmann's homepage!
Edit/Delete Message Reply w/Quote
#29 Report this post to a moderator
Support Apolyton, buy Alpha Centauri

Thank you very much, looks like I can't include it into the nect version of the altered source files pack to many files.

-Martin

ahenobarb is offline ahenobarb
Prince

Nov 2001
time: 05:31
  Old Post 09-11-2003 23:49
Edit/Delete Message Reply w/Quote
#30 Report this post to a moderator
Support Apolyton, pre-order Civilization IV

Huh? Just copy these files over the originals in the Source Directories and recompile (It only takes a minute) then take add_str.txt, ldl_str.txt, and keymap.txt and put them in the game directories. It should work. Of course, if you have added your own strings to these .txt files you can cut and paste them in.

Of course, I may not be understanding your problem correctly. Let me know if I can help.

 
Pages (2): [ 1   2   ]
< Last Thread     Next Thread > Post New Thread     Post A Reply
All times are GMT. The time now is 05:31.
Apolyton Time is 00:31.
    top of page
Rate This Thread:
Forum Jump:
Forum Rules:
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is ON
vB code is ON
Smilies are ON
[IMG] code is ON
 




Contact Us - Apolyton Civilization Site - Support Us!

Building a better Apolyton through better information. Click here and take our poll!
Non-US visitors, click here!

Powered by: vBulletin Version 2.0.3
Copyright ©2000, 2001, Jelsoft Enterprises Limited.

Page generated in 0.0526 seconds (91.49% PHP - 8.51% MySQL) with 36 queries
Page Loading Time:

Support Apolyton: Amazon USA | Amazon UK | Amazon DE | Amazon FR |
Support Apolyton and get FREE PLUS, Buy from Chips&Bits: Galactic Civilizations | Galactic Civilizations: Deluxe Edition | Call to Power 2 | Civilization: The Boardgame | GURPS/ Alpha Centauri | Alpha Centauri | Civilization IV | Civilization III: Complete |


Front Page | Civilization IV | Civilization III | Civilization II | Call to Power II | Alpha Centauri | Master of Orion III
Rise of Nations | Galactic Civilizations | Galactic Civilizations II | Misc
Alt.Civs | Civ I | C:CtP I | About | News | Directory | Apolyton Store | Forums | Chat | Columns | Interviews | Newsletter
Scenario League | CSC | Clash of Civs | Spanish Site | CtP Maps | Cradle of Civ | WesW's Ctp1/2 Site | Civ3 Haven

apolyton.net | apolyton.com | civilization2.net | civilization3.net | civilization4.net | civilizationiv.info | calltopower.net | galciv.net | galciv2.net | moo3.net