News:

One Minute Game Review by The Happy Friar: https://ugetube.com/@OneMinteGameReviews
Also on Rumble: https://rumble.com/c/c-1115371

idTech 4 (aka Doom 3 tech) Discord Server! https://discord.gg/9wtCGHa

Main Menu

"map" is working but "startgame" craches

Started by bitterman, June 20, 2015, 10:49:59 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

bitterman

Hmmm... dhewm3 falls even earlier.

Ha-ha-ha... :(


motorsep

#16
Have you tried minimal assets package ?

Looking at the code in void idSessionLocal::HandleMainMenuCommands in session_menu.cpp :

if ( !idStr::Icmp( cmd, "startGame" ) ) {
cvarSystem->SetCVarInteger( "g_skill", guiMainMenu->State().GetInt( "skill" ) );
if ( icmd < args.Argc() ) {
StartNewGame( args.Argv( icmd++ ) );
} else {
StartNewGame( "game/mars_city1" );
}


So I would try changing             StartNewGame( "game/mars_city1" ); to             StartNewGame( "game/yourmap" ); in C++ and see if that works (you'd do cmd "startGame" without any arguments). If it still crashes, then you might be missing the following.

In void idSessionLocal::ExecuteMapChange in the same cpp file you have:

if ( !noFadeWipe ) {
// capture the current screen and start a wipe
StartWipe( "wipeMaterial", true );


and then later:

// capture the current screen and start a wipe
StartWipe( "wipe2Material" );


So you might have to have those materials setup.

There is also gui for map loading, and I recall we needed to have that (loading screen and progress bar).

bitterman

#17
    
Folder 'savegames' and file '.save' are created but seems does not occur write in this file.

After crash MSVC debugger is stay there: (see >>>...<<<):

/*
===============
idSessionLocal::SaveGame
===============
*/

// Open savegame file
idFile *fileOut = fileSystem->OpenFileWrite( gameFile );
...

// let the game save its state

>>> game->SaveGame( fileOut );<<<



This line is relevant with some assembler code but this in not source code of SaveGame( fileOut ):


/*
===========
idGameLocal::SaveGame

save the current player state, level name, and level state
the session may have written some data to the file already
============
*/
void idGameLocal::SaveGame( idFile *f ) {
int i;
idEntity *ent;
idEntity *link;

idSaveGame savegame( f );

if (g_flushSave.GetBool( ) == true ) {
// force flushing with each write... for tracking down
// save game bugs.
f->ForceFlush();
}


As I see guys from ID call this problem save game bugs :)

g_flushSave - is a next candidate to prepare.

Thanks for advice, motorsep.
Btw, I read your comments on github/dhewm :)

***********************

There is exception in line 214:

Quote214      guiActive->SetStateString( va("loadgame_item_%i", i), name);

in this function:

/*
/*
180 ===============
181 idSessionLocal::SetSaveGameGuiVars
182 ===============
183 */
184 void idSessionLocal::SetSaveGameGuiVars( void ) {
185  int i;
186  idStr name;
187  idStrList fileList;
188  idList<fileTIME_T> fileTimes;
189
190  loadGameList.Clear();
191  fileList.Clear();
192  fileTimes.Clear();
193
194  GetSaveGameList( fileList, fileTimes );
195
196  loadGameList.SetNum( fileList.Num() );
197  for ( i = 0; i < fileList.Num(); i++ ) {
198  loadGameList[i] = fileList[fileTimes[i].index];
199
200  idLexer src(LEXFL_NOERRORS|LEXFL_NOSTRINGCONCAT);
201  if ( src.LoadFile( va("savegames/%s.txt", loadGameList[i].c_str()) ) ) {
202  idToken tok;
203  src.ReadToken( &tok );
204  name = tok;
205  } else {
206  name = loadGameList[i];
207  }
208
209  name += "\t";
210
211  idStr date = Sys_TimeStampToStr( fileTimes[i].timeStamp );
212  name += date;
213
214  >>>>> guiActive->SetStateString( va("loadgame_item_%i", i), name); <<<<<
215  }
216  guiActive->DeleteStateVar( va("loadgame_item_%i", fileList.Num()) );
217
218  guiActive->SetStateString( "loadgame_sel_0", "-1" );
219  guiActive->SetStateString( "loadgame_shot", "guis/assets/blankLevelShot" );
220
221 }


Then it call eax but seems these area of memory is not initislized (see pics).

bitterman

#18
if(fileSystem->HasD3XP( )) {
                  guiMainMenu->SetStateString("game_list", common->GetLanguageDict( )-> GetString("#str_07202" ));
              } else {
              guiMainMenu->SetStateString("game_list", common->GetLanguageDict()->GetString( "#str_07212" ));}


Can anybody show me #str_07212 from base/string/english.lang?

oneofthe8devilz

I got six little friends and they all run faster than you ;)


Check out our mods at
moddb or the SPS Homepage

motorsep

#20
You are simply missing assets needed to be used when loading map. GUI assets most likely.

That's one of my gripes with idTech 4 after working with DarkPlaces. Darkplaces engine will never crash on missing assets. It will substitute it with default, code generated assets and will print warning or error (I forgot what exactly it did). idTech 4 crashes on missing assets and never tells you crap about it, leaving you in the dark.

bitterman

oneofthe8devilz suddenly :) Thanks!

motorsep yes but there is some progress.

Seems like engine try to initialize MainMenu with variables from other gui menu (perhaps intro.gui).


motorsep

Нафига лезть в ассеблер когда можно просто пролистать код и посмотреть какие ассеты требуются :)

ЕАХ тут непричем кстати.

bitterman

#23
After pressing ESC in the game the engine tries to return control to the main menu, the handle of which was previously stored in guiMainMenu.

However, as shown by the debugger, at this point in the handle are already placed an incorrect value.

Who (how) changes guiMainMenu in the execution of the main loop is not yet clear.

Then SetGUI (guiMainMenu) send us into space (call eax).

But we can try to force refresh guiMainMenu before SetGUI. It works:

Quote

// FIXME: add this to work around exit from game by ESC.

   guiMainMenu = uiManager->FindGui( "guis/mainmenu.gui", true, false, true );

// end FIXME

   SetGUI( guiMainMenu, NULL );
   guiMainMenu->HandleNamedEvent( playIntro ? "playIntro" : "noIntro" );

This is a big potential problem with incorrect work with others gui<Name>.

motorsep:o
личку глянь

motorsep

I really think you simply have to comply with how engine works. It asks for certain assets to be present and they should be present. I recall we had to make some (or all, don't recall right now) fullscreen guis to be able to run id Tech 4 (dhewm 3) bare bones.