nillerusr / source-engine

Modified source engine (2017) developed by valve and leaked in 2020. Not for commercial purporses
Other
1.34k stars 214 forks source link

Game crashed on startup [Error: Material "__background" uses unknown shader "UnlitGeneric_DX8"] #132

Open steadyfield opened 2 years ago

steadyfield commented 2 years ago

The game is built on Windows 10 VS2015 environment with https://github.com/nillerusr/source-engine/wiki/How-to-build , for Windows. I use the game asset files extracted from "main.22.com.nvidia.valvesoftware.halflife2.obb" and "patch.22.com.nvidia.valvesoftware.halflife2.obb". The game crashed on startup. After the game crashed, there is a "engine.log" file in the same folder of "hl2_launcher.exe". Here is the engine log:

`>>> Engine(arch:i386 commit:ba90de2) started at Wed Nov 2 17:36:52 2022

[0.1062] LoadLibrary: pModule: sourcevr.dll, path: D:\source_engine/bin/sourcevr.dll [0.1062] AppFramework : Unable to load module sourcevr.dll! [0.1063] LoadLibrary: pModule: shaderapidx9.dll, path: D:\source_engine/bin/shaderapidx9.dll [0.1063] LoadLibrary: pModule: video_quicktime, path: D:\source_engine/bin/video_quicktime [0.1063] LoadLibrary: pModule: video_bink, path: D:\source_engine/bin/video_bink [0.1080] Using Breakpad minidump system. Version: 0 AppID: 220 [0.1092] filesystem BaseDir: D:\source_engine [0.2330] Did not detect any valid joysticks. [0.2353] LoadLibrary: pModule: USER32.dll, path: D:\source_engine/bin/USER32.dll [0.2374] LoadLibrary: pModule: stdshader_dbg.dll, path: D:\source_engine/bin/stdshader_dbg.dll [0.2392] LoadLibrary: pModule: stdshader_dx6.dll, path: D:\source_engine/bin/stdshader_dx6.dll [0.2418] LoadLibrary: pModule: stdshader_dx7.dll, path: D:\source_engine/bin/stdshader_dx7.dll [0.2447] LoadLibrary: pModule: stdshader_dx8.dll, path: D:\source_engine/bin/stdshader_dx8.dll [0.2513] Convar mat_specular has conflicting FCVAR_CHEAT flags (child: FCVAR_CHEAT, parent: no FCVAR_CHEAT, parent wins) [0.2815] LoadLibrary: pModule: unicode, path: D:\source_engine/bin/unicode [0.7463] Error: Material "__background" uses unknown shader "UnlitGeneric_DX8" `

I tried replacing these background files in (hl2/materials/console/*) with the files on a PC version of HL2, ang the problem still occurs.

EnderZip commented 2 years ago

Use steam hl2 assets

LegendaryGuard commented 1 year ago

Same error. It happened in one of the PCs I'm testing in the non steam version. I'll check what will be. I don't know why, I had a feeling of installing Steam client and Garry's mod on it, after the installation, I open Gmod the first time in the PC, it installs Microsoft DirectX. Later, I uninstalled both of them to check if HL2 non steam version can load.

I don't know exactly what will be. Is a component from Microsoft DirectX required to run the game? It worked in another PC when I did that Steam setup steps I mentioned here. One of the weird ideas I got trying to solve this, I still don't consider as solved though.

steadyfield commented 1 year ago

Same error. It happened in one of the PCs I'm testing in the non steam version. I'll check what will be. I don't know why, I had a feeling of installing Steam client and Garry's mod on it, after the installation, I open Gmod the first time in the PC, it installs Microsoft DirectX. Later, I uninstalled both of them to check if HL2 non steam version can load.

I don't know exactly what will be. Is a component from Microsoft DirectX required to run the game? It worked in another PC when I did that Steam setup steps I mentioned here. One of the weird ideas I got trying to solve this, I still don't consider as solved though.

@LegendaryGuard Thanks for your reply. So if you use the steam version assets, it is working fine? Could you figure out what are the differences between the assets of these versions? Is there any binary file (DLL) from the steam version assets needed to run this?

It seems that something is wrong with shaderapidx9.dll. I attached visual studio to hl2_launcher.exe, running the game, VS stops at CDynamicMeshDX8::HasEnoughRoom in meshdx8.cpp, and says 'this->m_pVertexBuffer was a nullptr'.

I will get the steam version assets to see if it is working.

EnderZip commented 1 year ago

Attach the game to vs see where its crashing, otherwise just use steam assets. You are asking nillerusr to fix an user error. There's a reason why they specifically told us to use the steam assets ONLY.

steadyfield commented 1 year ago

Attach the game to vs see where its crashing, otherwise just use steam assets. You are asking nillerusr to fix an user error. There's a reason why they specifically told us to use the steam assets ONLY.

I'm NOT asking anyone to fix this problem. I just want to discuss with the others who are interested in fixing this.

EnderZip commented 1 year ago

I'm NOT asking anyone to fix this problem. I just want to discuss with the others who are interested in fixing this.

And i already told you the fix: Use the steam hl2 assets. The assets inside of those .obb files are made for the mobile version of the game, it is probably incompatible with the pc version.

steadyfield commented 1 year ago

I'm NOT asking anyone to fix this problem. I just want to discuss with the others who are interested in fixing this.

And i already told you the fix: Use the steam hl2 assets. The assets inside of those .obb files are made for the mobile version of the game, it is probably incompatible with the pc version.

I will get the steam version assets to see if it works.

LegendaryGuard commented 1 year ago

I checked deeply as I could. AFAIK, source engine games still don't work without steam using this repository. It should be something to rewrite that.

Also, I think there's a TODO about this topic in the README (maybe it'll be that):

EnderZip commented 1 year ago

I checked deeply as I could. AFAIK, source engine games still don't work without steam using this repository. It should be something to rewrite that.

Also, I think there's a TODO about this topic in the README (maybe it'll be that):

Steam is not supported on android, you remember this repo is for porting the engine to android right?

LegendaryGuard commented 1 year ago

Steam is not supported on android, you remember this repo is for porting the engine to android right?

Yeah. Unfortunately, without steam stuff won't work. It would be great to work without, everyone would have the liberty to modify the base as they want.

Also, it would be cool to work on old and low spec devices and PCs. I've one, an old laptop from ~2006, it's an Ubuntu 16.04 32-bits and has Intel Core 2 Duo processor T5550 1.83Ghz and 4gb DDR2 RAM, compiles successfully. I hope the game works, still it hasn't been tested though.

Wapitiii commented 1 year ago

I have the same error, i am using the original steam assets. Has anyone found a solution for this issue?

WitherOrNot commented 1 year ago

add -dxlevel 90 to the game launch args

steadyfield commented 1 year ago

add -dxlevel 90 to the game launch args

Thank you very much. the game is now working, but there are some other error/crashes. Now I can enter the map, but when walking forward a few steps in the game, the game crashes. There is no log about the crash in engine.log. Attach hl2_launcher.exe to Visual Studio, when the game crashes, VS stops at snd_dsp.cpp:

engine.dll!PSET_GetNextN(pset_t ppset, portable_samplepair_t pbuffer, int SampleCount, int op) Line 5555 C++

engine.dll!PSET_GetNextN(pset_t ppset, portable_samplepair_t pbuffer, int SampleCount, int op) Line 5555 C++ engine.dll!DSP_ProcessStereoToMono(dsp_t pdsp, portable_samplepair_t pbfront, portable_samplepair_t pbrear, int sampleCount, bool bcrossfading) Line 7385 C++ engine.dll!DSP_Process(int idsp, portable_samplepair_t pbfront, portable_samplepair_t pbrear, portable_samplepair_t pbcenter, int sampleCount) Line 8723 C++ engine.dll!CAudioDeviceBase::ApplyDSPEffects(int idsp, portable_samplepair_t pbuffront, portable_samplepair_t pbufrear, portable_samplepair_t pbufcenter, int samplecount) Line 420 C++ engine.dll!MIX_PaintChannels(int endtime, bool bIsUnderwater) Line 2427 C++ engine.dll!S_Update_Guts(float mixAheadTime) Line 6538 C++ engine.dll!S_Update(const AudioState_t pAudioState) Line 6325 C++ engine.dll!_Host_RunFrame_Sound() Line 2914 C++ engine.dll!_Host_RunFrame(float time) Line 3500 C++ engine.dll!Host_RunFrame(float time) Line 3616 C++ engine.dll!CHostState::State_Run(float frameTime) Line 505 C++ engine.dll!CHostState::FrameUpdate(float time) Line 649 C++ engine.dll!HostState_Frame(float time) Line 125 C++ engine.dll!CEngine::Frame() Line 432 C++ engine.dll!CEngineAPI::MainLoop() Line 1544 C++ engine.dll!CModAppSystemGroup::Main() Line 2113 C++ engine.dll!CAppSystemGroup::Run() Line 383 C++ engine.dll!CEngineAPI::RunListenServer() Line 1827 C++ engine.dll!StaticRunListenServer(void arg) Line 1843 C++ tier0.dll!CatchAndWriteContext_t::Invoke() Line 379 C++ tier0.dll!CatchAndWriteMiniDump_Impl(CatchAndWriteContext_t & ctx) Line 446 C++ tier0.dll!CatchAndWriteMiniDumpForVoidPtrFn(void()(void ) pfn, void pv, bool bExitQuietly) Line 524 C++ engine.dll!CEngineAPI::Run() Line 1921 C++ launcher.dll!CAppSystemGroup::Run() Line 383 C++ launcher.dll!LauncherMain(HINSTANCE * hInstance, HINSTANCE hPrevInstance, char lpCmdLine, int nCmdShow) Line 1487 C++ hl2_launcher.exe!WinMain(HINSTANCE * hInstance, HINSTANCE hPrevInstance, char lpCmdLine, int nCmdShow) Line 141 C++

it seems to be the problem of the sound system.

Edit: I have tried playing a simple map made by myself. The game is not crashing. But the game is crashing on the original hl2 levels. So it could be some sound effects in the original hl2 levels crashing the game.

steadyfield commented 1 year ago

add -dxlevel 90 to the game launch args

When I have run the game successfully with -dxlevel 90, the game is working even if -dxlevel 90 is removed from the launch args. Now there is another problem, some special sound effects in the levels are crashing the game. I'm trying to figure that out.

Edit: I have figured that out. The soundscapes are crashing the game. A temporary workaround is to open the soundscapes list file hl2\scripts\soundscapes_manifest.txt, and empty the list. Then the game won't crash. Of course the sound effects will gone.