ereb-thanatos / cossacks-revamp-2017

163 stars 38 forks source link

Ogg music #21

Closed GreenMouseFan closed 3 years ago

GreenMouseFan commented 3 years ago

Is there any plan for a change, so that the music in-game plays from ogg files, instead of directly from CD? American Conquest originally plays music that way and the steam-version of Cossacks appears to have done this change. Will be this change included here?

ereb-thanatos commented 3 years ago

Hello,

I am not quite following you. What CD do you mean? All resources are packaged in the game archive. Also this project is no longer under active development.

Russianstory commented 3 years ago

Эреб дружище не бросайте не блокируйте меня прошу. Доброго дня. Пожалуйста выслушайте меня. ВЫ - единственный человек кто может услышать меня и помочь. Я про Казаки Снова война.

bargergo commented 3 years ago

I think I know what GreenMouseFan meant. The music tracks were played from the CD in the original retail version of the game (the CD was needed for launching the game). In the Steam version there is a Tracks folder with the music tracks with ogg extension.

I am not sure if these music tracks are included in this version or not, but I can not set the music volume, because it always get back to 0 when I apply the option changes in the game. So the music tracks are not played.

Are these tracks included? Does the game try to load these tracks? If it tries to load them, where should I put the music tracks?

bargergo commented 3 years ago

I think the code that handles the audio tracks is located in DeviceCD.cpp. In the bool CDeviceCD::Open() it seems to run on the happy path (FError is false). Maybe some code missing from true branch of the if statement?

FError = mciSendCommand(FDeviceID, MCI_SET, MCI_SET_TIME_FORMAT, (DWORD)(LPMCI_SET_PARMS)&SET_PARAMS);

if (!FError) { ; };

return TRUE;

In bool CDeviceCD::Play(DWORD Track) FError is 262 (true) after this command:

FError = mciSendCommand(FDeviceID, MCI_PLAY, MCI_NOTIFY | MCI_FROM | MCI_TO, (DWORD)(LPMCI_PLAY_PARMS)&PLAY_PARAMS);

Edit: If I insert the original CD before launching the game, it plays the audio tracks, but I can't change the music volume, as it jumps back to 0 on the slider and volume stays the same.

Edit 2: You don't actually need the original CD, any Audio CD is fine. If the music is played, when I exit from the game, it crashes, this error has something to do with ntdll.dll.

bargergo commented 3 years ago

I have managed to replace the audio playback from CD with playback from wav files. Link to the fork.

The original code in this repo uses the Media Control Interface (MCI) for playing audio from CD. MCI can be used for playing wav files, too so I changed the code. Playing ogg files using MCI did not work for me, I'm not sure that it is possible. Storing audio files in wav uses a lot more space, but converting is simple with FFmpeg.

ffmpeg -i "Track 1.ogg" "Track 1.wav"

The audio files should be placed in the tracks folder and named like Track 1.wav.

I could not figure out why there are 19 audio tracks according to the Track.cd file that is loaded from resources.GSC. In the Steam version there are only 18 tracks and on the original disc there are only 15 tracks.

I could not fix the problem with the volume settings, I don't know how to use CMixer class and MCI together. I'm not sure if there is a command to control the volume for waveaudio or audiocd in MCI. Did the game use originally MCI?

ereb-thanatos commented 3 years ago

Hi @bargergo , thanks for your input! Quite unexpected to find someone still working on the Cossacks code in 2021 : ) Sadly I can not answer your question. I did not spend much time on sound, since I always played without ambient tracks.

@Russianstory : Чем могу помочь?

bargergo commented 3 years ago

Well, I was always curious how Cossacks was written, but I have just recently discovered this repo : )

I have figured out if I use mpegvideo for device in MCI, then I can send commands to change the volume. I have managed to make the volume setting slider work.

I noticed that if I open the options menu, then SetCDVolume is always called in the processing loop, even if it is not changed at all, creating a lot of unnecessary function calls. I have found a bool value named Zaxvat in the VScrollbar class in Dialogs.h. If I only call SetCDVolume when Zaxvat is true. everything seems to be fine. I think the naming comes from Russian/Ukrainian. Does it mean changed or grabbed or something similar?

alexeik commented 3 years ago

@bargergo Zaxvat means taken :) taken unit or smth or captured:)

bargergo commented 3 years ago

@alexeik Thanks! I think this variable is used to store if the scrollbar is grabbed or not.

alexeik commented 3 years ago

@bargergo u r right:) nice suggestion

Russianstory commented 3 years ago

@ Уважаемый Эреб. Скажите, я долгое время бьюсь с вылетами Казаки снова Война из-за огромных армий как у меня так и у противника. Я нашёл отличный зарубежный ИИ который делает сотни юнитов и с которым играет сложно и интересно, особенно если ты один против 6 противников. Просто отлично!! Но вылетает бескомпромиссно. Это бич этой игры. Я же хочу дикого рубилова без вылетов и багов. Видел у вас это удалось реализовать. Но вот беда просто я пытался играть в разные патчи в том числе и ваш но как то не пошлО. Но у вас увидел, что вы смогли реализовать исправление вылета. Скажите, можно ли как-нибудь мне играть в оригинальные Казаки но только с вашим кусочком в плане вылетов. Нет ли просто лёгкой версии патча где исправлены ТОЛЬКО вылеты? Я бы себе скачал чтоб нормально поиграть и получить кайф. =) =) буду признателен. Разработчикам GSC я писал просьбу но они сказали, что не будут делать ничего минимум пока не релизнут СТАЛКЕР 2 (.

alexeik commented 3 years ago

@Russianstory чисто отвечу, потому что Эреб, редко отвечает. Такое провернуть нельзя в виде патчей. Отвечать за оригинал может только GSC, поэтому им искать этот баг. Вариан токо: какой то человек найдет баг в оригинале и будет его править - это и по времени и по знаниям дорого.

Russianstory commented 3 years ago

@alexeik А как же это? image

alexeik commented 3 years ago

Пойми, тут в этом месте, лежит переписанный движок игры. ПЕРЕПИСАННЫЙ с нуля. Это список изменений в этом движке :)

Russianstory commented 3 years ago

То есть не получится взять только то что я хотел? (( БЛин как же я был близко. Он получается пересобрал двигло Казаков заново?

Russianstory commented 3 years ago

Пойми, тут в этом месте, лежит переписанный движок игры. ПЕРЕПИСАННЫЙ с нуля. Это список изменений в этом движке :)

Объясни плз. ВОт он (движок) такой же как и оригинальные Казаки?? без всяких там настроек стартовых опций ?? Я это родной движок но очищенный от мусора и переписанный чтоли? Я не пойму

alexeik commented 3 years ago

Это другойдвижок,сделанный Эребом.

bargergo commented 3 years ago

If I understand correctly with Google translate, @Russianstory wants a version with only some of the changes. I am not sure, but I think this version is based on this repo https://github.com/GSC-fake/Cossacks-back-to-war But unfortunately the changes are not in the git log, so it is not that easy as cherry picking some of the commits.

Russianstory commented 3 years ago

Но, на нём можно играть? Полноценно как и в обычные?

Russianstory commented 3 years ago

@bargergo Yes, I really want only one thing - that the game never crashes with a large and huge number of units. The AI I installed is very strong ... and it is impossible to play due to the problem of the constant crash of the game.

Russianstory commented 3 years ago

@alexeik мне в этой сборке движка не понравилось только одно - что разрешение максимум 1920...у меня монитор вытягивает 3840х2160 я хочу с таким разрешением играть.....

alexeik commented 3 years ago

@bargergo yes u r right , but no cherry pick is possible @Russianstory ты поправь настройки. Врядли тут есть ограничения на экран. Скриншоты покажи, тут народ может поправит.

Russianstory commented 3 years ago

@alexeik премного благодарю. Установлю Казаки эти покажу. У меня завалялись два мощных ИИ на Снова война

КИРАСИР и просто "AI" пушечные, просто, по сложности! я рад !

Russianstory commented 3 years ago

Как я и говорил. У Эреба ращрешение не больще 1900.....Мне хотя бы 2500-1440 ... было бы здорово... (((

Russianstory commented 3 years ago

Также, проблема. У меня на МОИХ Казаках - изменённая графика некоторых юнитов! Я не могу перекинуть так чтоб на его сборке были мои юниты. Также не работает тот ИИ который у меня. Поэтому изначально я очень СЛЁЗНО просил тов. Эреба помочь только в одном - сделать латку в плане вылета игры из-за большого числа юнитов. Я могу предоставить свою сборку игры. С графикой из других модов, с моими звуками и настройками. Просто играть так невозможно...

ereb-thanatos commented 3 years ago

@Russianstory , @alexeik

Вы оба по-своему правы. Когда я начинал работу над Казаками, я не думал, что буду публиковать результат и код. Поэтому я не позаботился о чистой истории в git. Посыпаю голову пеплом :(

Есть относительно простой метод, чтобы отделить мои патчи от оригинального кода:

  1. Берём оригинальную репу и мой вариант.
  2. Прогоняем все исходные файлы через любую программу для форматирования кода (напр. clang-format).
  3. Сравниваем отформатированные репы между собой.

Затем можно форкнуть оригинальную репу и взять только те патчи, которые вам нужны.

Russianstory commented 3 years ago

@ereb-thanatos скажите а что получится в итоге? Получится что я смогу взять патч, устраняющий вылет игры от большого числа юнитов? Правильно понял? Я сам просто ни раз не программист и с кодом вообще не работал. Как это сделать? Прошу у Вас помощи пожалуйста. Иначе в это играть невозможно. Вылеты постоянные. Помогите. Всего одна просьба "Латка на устранение вылета игры при огромных армиях". Я могу кинуть свою версию игры. Помогите ну осталось тут немного, чтоб Казаки заиграли новыми красками.

Эреб очень Вас прошу о помощи

Russianstory commented 3 years ago

UP =) Очень нужна помощь!

Russianstory commented 3 years ago

@ereb-thanatos Друг дорогой ну помогите прошу ВАС, Одна заплатка на оригинальную Казаки Снова война. Одна - чтоб игра больше не вылетала никогда при огромных армиях. ПРошу вас... ОЧЕНЬ ПРОШУ

ereb-thanatos commented 3 years ago

Извините, @Russianstory , но я не могу вам помочь. Этот проект был мимолётным увлечением и я для себя его давно закрыл. Если вы найдёте кого-нибудь хотя бы немного понимающего в C, то у вас не должно возникнуть больших сложностей, если вы последуете совету в моём прошлом комментарии. Удачи вам.

Russianstory commented 2 years ago

Последний вопрос можно задать вам????????