Closed kas1e closed 3 years ago
Ok, now, when we exit from a game, we have "main.eldritchmastersave" file created in the PROGDIR:.eldritch (the same as prefs.cfg), but now it crashes on exit after doing "shutting down framework", in the ogles2.library, with such stack trace:
ShaderManagerFreeShaders->ShaderProgram->crash in ogles2.library
Also it crashes now when trying to load "main.eldritchmastersave", in the SaveLoad_MasterDataStream->ColorGradingTexture SimpleSTring->SimpleString
Probably when it tries to load back "main.eldritchmastersave" it needs to be "byte-swapped" read as well?
The crash in ogles2.library: I don't see anything suspicious in the code.
Currently, I just commented out in shadermanagment.cpp:
void ShaderManager::FreeShaders() {
#ifndef __amigaos4__
FOR_EACH_MAP(ProgramIter, m_ShaderPrograms, SShaderProgramKey,
IShaderProgram*) {
SafeDelete(ProgramIter.GetValue());
}
FOR_EACH_MAP(VSIter, m_VertexShaders, HashedString, IVertexShader*) {
SafeDelete(VSIter.GetValue());
}
FOR_EACH_MAP(PSIter, m_PixelShaders, HashedString, IPixelShader*) {
SafeDelete(PSIter.GetValue());
}
#endif
}
So it works, though it brings after a more easy crash: AL lib: (EE) alc_cleanup: 1 device not closed.
And have a warning window with "parent process has tried to exit before all children have". Error process "alsoft-mixer".
And stack tracepoint out on "ALCplaybackAHI_mixerProc"
Also find out compile error from last commit:
/amiga/Eldritch/code/Libraries/Workbench/src/Components/wbcomptransform.cpp:51:10: error: redeclaration of ‘Vector tmp’
Vector tmp = m_Velocity;
But you create a GPU memory leak by commenting this code, IIRC the amiga OS doesn't clean leftover stuff automatically.
For openal: all the closing code is here:
Look at Code/Libraries/Audio/src/openalaudiosystem.cpp
from line 42 to 53. The OpenALAudioSystem destructor close the context and the device properly.
maybe just the alutExit() should be placed just after alcMakeContextCurrent(nullptr)
?
Yeah, it at least, of course, I just comment it out currently for not crash on exit all the time for better tests until main things done.
As for compile error i change it like:
#if __amigaos4__
Vector tmp = m_Location;
littleBigEndian(&tmp.x);
littleBigEndian(&tmp.y);
littleBigEndian(&tmp.z);
Stream.Write(sizeof(Vector), &tmp);
Vector tmp2 = m_Velocity;
littleBigEndian(&tmp2.x);
littleBigEndian(&tmp2.y);
littleBigEndian(&tmp2.z);
Stream.Write(sizeof(Vector), &tmp2);
#else
Stream.Write(sizeof(Vector), &m_Location);
Stream.Write(sizeof(Vector), &m_Velocity);
#endif
And it compiles ok.
Then another typo:
wbcompeldplayer.cpp:1762:38: error: expected ‘}’ at end of input
Stream.Write(sizeof(Vector), &vtmp);
^
Also wbcompeldtransform.cpp:
/wbcompeldtransform.cpp:332:20: error: ‘tmp’ was not declared in this scope
littleBigEndian(&tmp.x);
And:
Components/wbcompeldplayer.cpp:1757: error: unterminated #else
#ifdef __amigaos4__
wbcompeldtrapbolt.cpp:262:20: error: expected ‘;’ before ‘littleBigEndian’
, forgotten ";"
and then:
/amiga/Eldritch/code/Projects/Eldritch/src/eldritchworld.cpp:2063:24: error: ‘struct SVoxelIrradiance’ has no member named ‘x’
littleBigEndian(&tmp.x);
^
/amiga/Eldritch/code/Projects/Eldritch/src/eldritchworld.cpp:2064:24: error: ‘struct SVoxelIrradiance’ has no member named ‘y’
littleBigEndian(&tmp.y);
^
/amiga/Eldritch/code/Projects/Eldritch/src/eldritchworld.cpp:2065:24: error: ‘struct SVoxelIrradiance’ has no member named ‘z’
littleBigEndian(&tmp.z);
^
/amiga/Eldritch/code/Projects/Eldritch/src/eldritchworld.cpp:2066:24: error: ‘struct SVoxelIrradiance’ has no member named ‘w’
littleBigEndian(&tmp.w);
^
Yeah, now compiles, through give the same crash when i tries to run game and it loads master-slave file (on the same SimpleString() stuff)
You probably need to erase the provious state first.
Yeah, done that of course, still crashes :(
Will try to rebuild the whole source from scratch from the repo just in case
Rebuild all from scratch, delete all content from .eldritch directory fully, run game, exit: file creates. Then run the game again and that crash :( And in the console I had that:
S/L: Flushing world files:
Assertion failed: "Iter.ISBalid()" ()
in unknown function in code/Libraries/Core/src/map.h at line 554
Assertion failed: "m_Node" ()
in unknown function in code/Libraries/Core/src/map.h at line 69
I fixed the saving of HashedString, that may explain all those crashes.
Thanks! Need to go for a hour, once will back will check everything
Tested latest commit: yeah! Didn't crashes anymore! Now to understand why it crashes on exit when free shaders and close audio stuff (will create another ticket about)
When I exit from a game we crash all the time because it tries to save ./main.eldritchmastersave" and says Couldn't open file ./main.eldritchmastersave, and then crashes with stack tracepoint out to the EldritchSaveLoad_SaveMaster. The same happens when we trying to restart a level, or when we go to the next world. For AmigaOS4 we need to put that file to the "PROGDIR:" (without ./ at the beginning), or to PROGDIR:.eldritch.