SoHL: Opposing Force? Created 3 years ago2020-12-29 11:19:27 UTC by blsha blsha

Created 3 years ago2020-12-29 11:19:27 UTC by blsha blsha

Posted 3 years ago2020-12-29 11:19:27 UTC Post #345112
So I've stumbled upon this nice thing:
https://github.com/Hammermaps-DEV/SOHL-V1.9-Opposing-Force-Edition
It contains all of OpFor content "merged" with Spirit 1.9 code. Unfortunately this SDK requires VS 2019 to compile it, and there's no way I can get this Studio on my ancient system ;(.

So, won't it be rude if ask someone here to compile the .dll-s and link them to me? Please?
blsha blshaWatching you.
Posted 3 years ago2020-12-30 09:40:51 UTC Post #345118
I'll try to compile them for ya this weekend.
Admer456 Admer456If it ain't broken, don't fox it!
Posted 3 years ago2020-12-30 09:53:03 UTC Post #345119
Oh god, Thank you! I started to think I'm not gettting any help here and your appearance is just a miracle!
blsha blshaWatching you.
Posted 3 years ago2020-12-31 17:48:39 UTC Post #345124
I'm compiling it right now, seems to have a bunch of issues in release mode. But I think I'll get it done in an hour or so.

Edit 2:
Nope, gonna continue tomorrow. My Internet speed is ABSOLUTE garbage right now, so I can't even upload a thing without timing out...

Edit:
Okay, the DLLs manage to compile in release mode. I've forked this thing and now I'm just gonna put a release there and post here again when that's done.
Admer456 Admer456If it ain't broken, don't fox it!
Posted 3 years ago2020-12-31 21:28:26 UTC Post #345125
DONE, try it out ^w^

https://github.com/Admer456/SOHL-V1.9-Opposing-Force-Edition/releases/tag/v1.0

Note: you may also need Cg.dll and those other ones which may come with SoHL 1.9
Admer456 Admer456If it ain't broken, don't fox it!
Posted 3 years ago2021-01-01 16:23:45 UTC Post #345126
Thank you in advance. Will try it as soon as I get to my PC and that means not today...
blsha blshaWatching you.
Posted 3 years ago2021-01-02 11:30:54 UTC Post #345129
Unfortunately there's something wrong with the client.dll, because every time when I try to load spirit I just get these two errors and game crashes:
User posted image
another link to images because TWHL doesn't show me images the regular way and I'm not shure whether you'll see them or not https://imgur.com/a/APN7sCz

Did you try it on your system? Maybe it's just me being unlucky :\
blsha blshaWatching you.
Posted 3 years ago2021-01-02 11:44:47 UTC Post #345130
You're linking the album, you need to link the actual image itself:
[img:https://i.imgur.com/ohF3X8y.png]
User posted image
This sounds like you need an old version of FMOD. You should be able to find FMOD DLLs in SoHL 1.8 or so.
Also, no, I haven't tried it on my system.
Admer456 Admer456If it ain't broken, don't fox it!
Posted 3 years ago2021-01-02 12:21:16 UTC Post #345131
Well, I tried moving client.dll around other mods' folders, I tried following your advice and replace it with fmods from older Spirits and always got the same result no matter what.
The problem is clearly with the client.dll itself, maybe it didn't compile properly?

note that server.dll is perfectly fine
blsha blshaWatching you.
Posted 3 years ago2021-01-02 15:43:48 UTC Post #345132
In that case, I'll try to get it running on my end. If I succeed, I'll tell you what is required.
Admer456 Admer456If it ain't broken, don't fox it!
Posted 3 years ago2021-01-02 22:31:07 UTC Post #345135
Be advised: That code was incomplete and only preliminary in it's release.
Posted 3 years ago2021-01-03 08:40:08 UTC Post #345138
But if it was released in public that means someone had it at least somewhat working...
blsha blshaWatching you.
Posted 3 years ago2021-01-03 11:44:39 UTC Post #345140
Ok, I got the VS 2019 and compiled the .dll myself. Yes, it is broken

Admer, if you feel tired you can leave me. Now when I've got a normal and modern IDE I can just take some code from this and original OpFor SDK and stuff it into my SoHL 1.9 SDK ( vs 2010 couldn't compile any of these properly)

Also this code is indeed weird: some of the commentaries in different .cpp-s still talk about Spirit 1.4, also it appears to have some code taken from different mods... And what in the God's name is monster_diablo?!
blsha blshaWatching you.
Posted 3 years ago2021-01-03 12:09:04 UTC Post #345141
I don't feel tired, but since you do have a modern IDE now (I'm guessing VS2017 or VS2019), I no longer feel the need to fix things.
You could try to compile in debug mode and see if that'll work at all.
Admer456 Admer456If it ain't broken, don't fox it!
Posted 3 years ago2021-01-04 10:35:26 UTC Post #345143
You were partially right, the problem is connected to sound. There're soundengine.cpp and .h in the SDK. The first error popped up because this client.dll requires fmodex.dll and not fmod.dll, I reanmed fmod to fmodex and this error is no longer appearing. Bu there's still "couldn't load functions" error which, I assume, has something to do with this:

void CSoundEngine::GetDllPointers()
{
char szPath[256];

strcpy(szPath, gEngfuncs.pfnGetGameDirectory());
strcat(szPath, "/cl_dlls/fmodex.dll");

m_hFmodDll = LoadLibrary(szPath);
if (!m_hFmodDll)
FatalError("Couldn't load %s!\n", szPath);

(FARPROC&)_FMOD_System_Create = GetProcAddress(m_hFmodDll, "FMOD_System_Create");
(FARPROC&)_FMOD_System_GetVersion = GetProcAddress(m_hFmodDll, "FMOD_System_GetVersion");
(FARPROC&)_FMOD_System_GetNumDrivers = GetProcAddress(m_hFmodDll, "FMOD_System_GetNumDrivers");
(FARPROC&)_FMOD_System_SetOutput = GetProcAddress(m_hFmodDll, "FMOD_System_SetOutput");
(FARPROC&)_FMOD_System_GetDriverCaps = GetProcAddress(m_hFmodDll, "FMOD_System_GetDriverCaps");
(FARPROC&)_FMOD_System_SetSpeakerMode = GetProcAddress(m_hFmodDll, "FMOD_System_SetSpeakerMode");
(FARPROC&)_FMOD_System_SetDSPBufferSize = GetProcAddress(m_hFmodDll, "FMOD_System_SetDSPBufferSize");
(FARPROC&)_FMOD_System_GetDriverInfo = GetProcAddress(m_hFmodDll, "FMOD_System_GetDriverInfo");
(FARPROC&)_FMOD_System_SetSoftwareFormat = GetProcAddress(m_hFmodDll, "FMOD_System_SetSoftwareFormat");
(FARPROC&)_FMOD_System_Init = GetProcAddress(m_hFmodDll, "FMOD_System_Init");
(FARPROC&)_FMOD_System_Set3DSettings = GetProcAddress(m_hFmodDll, "FMOD_System_Set3DSettings");
(FARPROC&)_FMOD_System_Release = GetProcAddress(m_hFmodDll, "FMOD_System_Release");
(FARPROC&)_FMOD_Channel_Stop = GetProcAddress(m_hFmodDll, "FMOD_Channel_Stop");
(FARPROC&)_FMOD_Sound_Release = GetProcAddress(m_hFmodDll, "FMOD_Sound_Release");
(FARPROC&)_FMOD_System_SetReverbAmbientProperties = GetProcAddress(m_hFmodDll, "FMOD_System_SetReverbAmbientProperties");
(FARPROC&)_FMOD_Channel_SetPaused = GetProcAddress(m_hFmodDll, "FMOD_Channel_SetPaused");
(FARPROC&)_FMOD_System_Update = GetProcAddress(m_hFmodDll, "FMOD_System_Update");
(FARPROC&)_FMOD_System_Set3DListenerAttributes = GetProcAddress(m_hFmodDll, "FMOD_System_Set3DListenerAttributes");
(FARPROC&)_FMOD_Channel_IsPlaying = GetProcAddress(m_hFmodDll, "FMOD_Channel_IsPlaying");
(FARPROC&)_FMOD_Channel_GetPaused = GetProcAddress(m_hFmodDll, "FMOD_Channel_GetPaused");
(FARPROC&)_FMOD_Channel_Set3DAttributes = GetProcAddress(m_hFmodDll, "FMOD_Channel_Set3DAttributes");
(FARPROC&)_FMOD_Channel_GetPosition = GetProcAddress(m_hFmodDll, "FMOD_Channel_GetPosition");
(FARPROC&)_FMOD_Channel_SetVolume = GetProcAddress(m_hFmodDll, "FMOD_Channel_SetVolume");
(FARPROC&)_FMOD_Channel_SetFrequency = GetProcAddress(m_hFmodDll, "FMOD_Channel_SetFrequency");
(FARPROC&)_FMOD_Channel_GetFrequency = GetProcAddress(m_hFmodDll, "FMOD_Channel_GetFrequency");
(FARPROC&)_FMOD_System_CreateSound = GetProcAddress(m_hFmodDll, "FMOD_System_CreateSound");
(FARPROC&)_FMOD_System_PlaySound = GetProcAddress(m_hFmodDll, "FMOD_System_PlaySound");
(FARPROC&)_FMOD_Channel_Set3DMinMaxDistance = GetProcAddress(m_hFmodDll, "FMOD_Channel_Set3DMinMaxDistance");
(FARPROC&)_FMOD_System_CreateStream = GetProcAddress(m_hFmodDll, "FMOD_System_CreateStream");
(FARPROC&)_FMOD_Channel_SetDelay = GetProcAddress(m_hFmodDll, "FMOD_Channel_SetDelay");
(FARPROC&)_FMOD_Channel_SetPosition = GetProcAddress(m_hFmodDll, "FMOD_Channel_SetPosition");
(FARPROC&)_FMOD_Sound_GetFormat = GetProcAddress(m_hFmodDll, "FMOD_Sound_GetFormat");

if (!_FMOD_System_Create ||
!_FMOD_System_GetVersion ||
!_FMOD_System_GetNumDrivers ||
!_FMOD_System_SetOutput ||
!_FMOD_System_GetDriverCaps ||
!_FMOD_System_SetSpeakerMode ||
!_FMOD_System_SetDSPBufferSize ||
!_FMOD_System_GetDriverInfo ||
!_FMOD_System_SetSoftwareFormat ||
!_FMOD_System_Init ||
!_FMOD_System_Set3DSettings ||
!_FMOD_System_Release ||
!_FMOD_Channel_Stop ||
!_FMOD_Sound_Release ||
!_FMOD_System_SetReverbAmbientProperties ||
!_FMOD_Channel_SetPaused ||
!_FMOD_System_Update ||
!_FMOD_System_Set3DListenerAttributes ||
!_FMOD_Channel_IsPlaying ||
!_FMOD_Channel_GetPaused ||
!_FMOD_Channel_Set3DAttributes ||
!_FMOD_Channel_GetPosition ||
!_FMOD_Channel_SetVolume ||
!_FMOD_Channel_SetFrequency ||
!_FMOD_Channel_GetFrequency ||
!_FMOD_System_CreateSound ||
!_FMOD_System_PlaySound ||
!_FMOD_Channel_Set3DMinMaxDistance ||
!_FMOD_System_CreateStream ||
!_FMOD_Channel_SetDelay ||
!_FMOD_Channel_SetPosition ||
!_FMOD_Sound_GetFormat)
{
FatalError("Couldn't load functions from %s\n", szPath);
}
}

Unfortunately I don't really understand what's going in that if (!_FMOD_System_Create || part and don't know what causes the error here
blsha blshaWatching you.
Posted 3 years ago2021-01-04 11:30:52 UTC Post #345144
Well, the problem is, you can't just rename fmod.dll to fmodex.dll, cuz' FMOD is basically "FMOD 3.x", and FMOD Ex is a designation for "FMOD 4.x". Nowadays you got FMOD Studio and FMOD Core.
The if (!_FMOD_System_Create || part checks if all the "functions were loaded", or to be exact, if any of the function pointers are nullptr.

Since fmod.dll and fmodex.dll have different functions, not all of these function pointers are gonna get properly initialised.
The biggest problem is, FMOD Ex seems impossible to find nowadays as well as any ancient FMOD version. (I think Sven Co-op uses FMOD Ex tho', you could find it there)

As a complete alternative, you could try ripping out FMOD Ex and integrating FMOD Core.
Admer456 Admer456If it ain't broken, don't fox it!
Posted 3 years ago2021-01-04 20:52:22 UTC Post #345145
I know the guy.. He helped me with my own code till we both discovered Solokillers work. Then he ceased development. The public code is even less sophisticated than the private one I own and even that it a total dev build. For instance many NPC actions spawn a spark on top their heads for verification that things worked as intended coding wise. Unfortunately I'm to stupid and limited in time to figure things out myself.

If you got the coding know how let me know and I'll send you that internal code. He fixed dozens of spirit related bugs and cleaned up the whole code of it big time. At least so he claimed but I believe that he did.
Posted 3 years ago2021-01-05 08:38:20 UTC Post #345148
Okay

First, Admer, I copied the fmodex.dll from Sven to my mod folder and these errors no longer appear... But now it says that this version of FMOD Ex is not the one that is required. Perhaps, if you still have the source code you could look at the cl_dll\soundengine.cpp yourself and tell me what version is required

Second, 23-down, I'm Interested to look at what you have, please

Third, as someone who came here from HLFX.ru I've never heard a single good word about Solokiller's HLEnhanced. What is this actually and which part of it makes a bunch of 30 years old slavs dislike it so much?
blsha blshaWatching you.
Posted 3 years ago2021-01-05 14:07:41 UTC Post #345152
It requires version 4.32.09
/*
    FMOD version number.  Check this against FMOD::System::getVersion.
    0xaaaabbcc -> aaaa = major version number.  bb = minor version number.  cc = development version number.
*/

#define FMOD_VERSION    0x00043209
HLFX.ru [...] HLEnhanced [...] dislike
Well, I'm a Slav myself (Bosnia and Herzegovina), yet I love many aspects of HLEnhanced. Oh, I'm not 30 though, much younger. :lol:

HLEnhanced is basically a very cleaned-up HL SDK with bug fixes and things done properly, also using a nice cross-platform build system that is CMake. And, most importantly, it's got documentation.

My guess is that they dislike it because it's different. HL SDK is one big mess of code, so if someone gets very used to it (especially for over 6 years), they start disliking and avoiding anything that's actually better, because they don't know better and don't wanna change. Design patterns? Style consistency? Namespaces? What are those? Global functions and variables everywhere! :walter:

Another guess is CMake and dependencies. You need to build the XercesC library, and use CMake to generate project files for Visual Studio, if I recall correctly. That probably pushes away many people, especially beginners. But then again, it's 2021, programmers are supposed to be familiar with at least one or two build systems. :/

So, with all that said, there aren't, almost any, valid reasons to dislike HLEnhanced. However, it's not being worked on any more, and Solo advises to not use it.
Admer456 Admer456If it ain't broken, don't fox it!
Posted 3 years ago2021-01-05 15:25:02 UTC Post #345153
I know the guy.. He helped me with my own code till we both discovered Solokillers work. Then he ceased development. The public code is even less sophisticated than the private one I own and even that it a total dev build. For instance many NPC actions spawn a spark on top their heads for verification that things worked as intended coding wise. Unfortunately I'm to stupid and limited in time to figure things out myself.
If you got the coding know how let me know and I'll send you that internal code. He fixed dozens of spirit related bugs and cleaned up the whole code of it big time. At least so he claimed but I believe that he did.
HLEnhanced was never really planned that well which is why i ceased development. I am planning to make a successor that does stuff properly (and with a unique name so it doesn't get confused for another mod).

That spark issue is actually vanilla HL behavior that happens in debug builds: https://github.com/ValveSoftware/halflife/blob/c7240b965743a53a29491dd49320c88eecf6257b/dlls/schedule.cpp#L184-L194

If you're looking for any functionality in particular you can always make a list and i'll see what i can do. The planned mod might be enough for your needs, but Asset Manager V1 has to be released first before i can work on that. That project is going into beta soon, once i get a few remaining features implemented and the installer setup done.
Another guess is CMake and dependencies. You need to build the XercesC library, and use CMake to generate project files for Visual Studio, if I recall correctly. That probably pushes away many people, especially beginners. But then again, it's 2021, programmers are supposed to be familiar with at least one or two build systems. :/
Yeah Xerces was a bad choice. There are XML parsing libraries that are lightweight, header only and don't have the separate dependency requirement. The only downside is they don't support the full XML spec, but i doubt anybody would ever use namespaces, entities and doctypes.

I can update HLEnhanced to replace the XML library, but it's still advised to not use it. I already have a library in mind for the replacement project so i can just update HLE first.

As far the FMOD Ex issues go, the library can no longer be downloaded from the official website so getting a compatible version is going to be difficult. For some reason the library was never included in Spirit installations so i don't know if you can find a compatible version anywhere. The web archive lists old download links but none of them work and the archived copy doesn't have the files either.

You might be able to get a copy if you can find a mod that uses that particular version of fmod, but it seems that the library was only renamed to fmodex.dll relatively shortly before being discontinued so that might not be possible. I do have an old version of it in an old HLMV installation, version 4.44.61 but i don't know if it's compatible or if it's even a release version.

You may be better off just upgrading the codebase to FMOD Studio instead. If you encounter issues with GetProcAddress calls you may be better off just using the import library and using delay loading to load it from cl_dlls.

The process for delay loading is described here: https://docs.microsoft.com/en-us/cpp/build/reference/linker-support-for-delay-loaded-dlls?view=msvc-160

But it's a bit verbose. The gist of it is that you need to handle loading yourself and can load from a different location on disk:
https://github.com/Solokiller/HLEnhanced/blob/master/game/shared/DelayLoad.h
https://github.com/Solokiller/HLEnhanced/blob/master/game/shared/DelayLoad.cpp

You also need to specify the library to be delay loaded in the linker settings for client.dll. In HLE this is done in the CMakeLists file, but for regular Visual Studio projects it's done through VS's properties dialog for client.dll.

You also need to link with the delayimp.lib library for this to work.

The library will be loaded when you first invoke any function imported from the library, so you need to make sure the client dll has at the very least received the engine pointers before it will work. Otherwise it will crash when trying to get the mod name from the engine.

If this is all too confusing i can take a look at the project and upgrade it to FMOD Studio along with delay loading support.
Posted 3 years ago2021-01-05 17:40:12 UTC Post #345155
Oof, now that sounds complicated. So yes, Solokiller, please help if you can and want to.

Also I will look around the internet for Fmodex v4.32.09 (which is the one I need). I think It's possible to find it somewhere on these old cryptic russian torrents or whatever...
blsha blshaWatching you.
Posted 3 years ago2021-01-06 07:54:35 UTC Post #345161
Okay, so I went to fmod.h and changed the #define FMOD_VERSION 0x00043209 to #define FMOD_VERSION 0x00043216 (because I managed to get the fmodex v4.32.16) and the game doesn't crash anymore.

This thing still has some issues though, but I think I'll manage to fix them...
blsha blshaWatching you.
Posted 3 years ago2021-01-06 08:25:47 UTC Post #345162
It needs a lot of particle .tga-s and I don't know where to get them:

// Pulled from BattleGrounds
const char SPARK_PARTICLE[MAX_PARTICLE_PATH] = "particles/spark01.tga";
const char WHITE_SMOKE_PARTICLE[MAX_PARTICLE_PATH] = "particles/smoke01.tga";
const char BROWN_SMOKE_PARTICLE[MAX_PARTICLE_PATH] = "particles/smoke01.tga";

// Default explosion
const char spark01[MAX_PARTICLE_PATH] = "particles/spark01.tga";
const char smoke09[MAX_PARTICLE_PATH] = "particles/smoke09.tga";
const char explo_strip[MAX_PARTICLE_PATH] = "particles/explo_strip.tga";
const char exp_tong[MAX_PARTICLE_PATH] = "particles/exp_tong.tga";
const char exp_glow[MAX_PARTICLE_PATH] = "particles/exp_glow.tga";
const char debris_concrete001a[MAX_PARTICLE_PATH] = "particles/debris_concrete001a.tga";

// Blood impact
const char blood_red_animated[MAX_PARTICLE_PATH] = "particles/blood_red_animated.tga";
const char blood_red_drips[MAX_PARTICLE_PATH] = "particles/blood_red_drips.tga";
const char blood_red_impact[MAX_PARTICLE_PATH] = "particles/blood_red_impact.tga";

#endif // PARTICLE_DEFS_H
blsha blshaWatching you.
Posted 3 years ago2021-01-06 11:25:40 UTC Post #345163
I tested a bit more and now it seems to work nearly fine, but I still need the damn particles and materials!
I PM-ed 23-down about this. He said he knows the original author and I hope he contacts the author, also I hope that mentioned author still has the necessary assets after all these years

Also the game now requires some .wav files too :/
blsha blshaWatching you.
Posted 3 years ago2021-01-06 13:02:53 UTC Post #345165
Well, that's not exactly how FMOD is supposed to be used but if it works it works. Do you still need me to upgrade it to FMOD Studio?
Posted 3 years ago2021-01-06 15:00:39 UTC Post #345166
Well, looks like I don't need this upgrade to Fmod Studio anymore.
Anyway thanks for such a generous offer as doing this work for me!

But I still got errors flying around the map instead of normal particles. Other than that everything is fine
blsha blshaWatching you.
You must be logged in to post a response.