Home » PLAYER'S HQ 1.13 » JA2 Complete Mods & Sequels » Stracciatella Project (Platform Independent JA2) » r7059 - crash when loading savegame
r7059 - crash when loading savegame[message #243528]
|
Mon, 08 February 2010 16:51
|
|
BirdFlu |
|
Messages:438
Registered:September 2007 Location: Lampukistan |
|
|
There seem to be a new bug since the last revision. The game crashes when a savegame is loaded. I think the bug is in line 703 in SaveLoadGame.cc. Previously gbWorldSectorZ was set to "-1". Now the function SetWorldSectorInvalid is called, which also sets gWorldSectorX and gWorldSectorY to zero.
In line 706 this statement ( if (gWorldSectorX != 0 && gWorldSectorY != 0) ... ) doesn't apply anymore and the function "SetCurrentWorldSector(sLoadSectorX, sLoadSectorY, bLoadSectorZ)" is not called. Later the SECTOR(UINT,UINT) function triggers an assertion, because gWorldSectorX is zero.
Here is a stack trace.
Quote:
ja2smp_d.exe!_FailMessage(const char * pString=0x00000000, unsigned int uiLineNum=11, const char * pSourceFile=0x00ac35cc) Line 123 C++
ja2smp_d.exe!SECTOR(const unsigned int x=0, const unsigned int y=0) Line 11 + 0x23 bytes C++
ja2smp_d.exe!IsSectorDesert(const short x=0, const short y=0) Line 3593 + 0xf bytes C++
ja2smp_d.exe!SectorTemperature(unsigned int uiTime=420, short sSectorX=0, short sSectorY=0, char bSectorZ='
Report message to a moderator
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Re: r7059 - crash when loading savegame[message #250529]
|
Wed, 28 April 2010 08:54
|
|
Ddass |
|
Messages:26
Registered:April 2010 |
|
|
well here is a changelog for those w/o an SVN client
Quote:
(r7056) Fix a vanilla bug, which prevented enemies from climbing roofs.
(r7055) Fix a vanilla bug: When a soldier changed team (e.g. getting hostile), he lost his camouflage.
(r6933) Plug a vanilla one-time memory leak.
(r6926) Fix a vanilla bug: Due to a logic bug multiple terrorists could end up in the same sector.
(r6924) Fix a vanilla glitch in the editor: Pressing page up/down while an item is selected and the options menu is active caused some widgets of the items menu to be shown.
(r6864) Fix a vanilla glitch: Too few items could be drawn, if some items on the ground were not visible.
(r6777) Fix a vanilla glitch: When the SAM control in Meduna was rebuilt, a graphic with wrong orientation was used.
(r6758) Fix a vanilla out of bounds array access, when starting the creature quest.
(r6650) Fix a vanilla bug in the editor: When selecting a miner, he was turned into an elite soldier.
(r6622) Fix a vanilla glitch: While a merc is on a roof and planning to perform an action (usually giving first aid), the highlighted tile was incorrectly drawn on the floor level.
(r6606) All directory names (especially data/) are lowercase now.
(r6601) Fix a vanilla out of bounds array access, which happened when entering Bobby Ray's shipment page.
(r6418) Fix a vanilla bug: Mercs should train health a bit by travelling by foot, but due to an error in the calculation this did not work.
(r6404) Fix a vanilla bug: All soldiers had an additional need for sleep as if seriously wounded, even when at perfect health.
(r6298) Improve the vanilla behaviour of the scroll bar in the help screen: Now moving the mouse slowly does not cause it to hang anymore and the relative position of the mouse cursor to the bar is fixed.
(r6293) Enable scrolling in the help screen with the mouse wheel.
(r6270) Fix a vanilla glitch: Disable the prev/next buttons in the personnel screen not only when there is exactly one merc in the list, but also if there is none.
(r6253) Fix a vanilla glitch in the editor: The text for the brothel siren trap was missing.
(r6152) Instead of displaying nothing (vanilla) or asserting (till now) show "Unknown" if a weapon has an imprint by a nameless enemy soldier.
(r6147) Fix a vanilla out of bounds array access (now a null-pointer access) when not all three boxers are there.
(r6130) Fix a vanilla glitch: When switching between current and past mercs in the personnel screen, properly disable/enable the next/previous merc buttons.
(r6127, r6129) Fix a vanilla glitch: Prevent selecting an empty slot when looking at past mercs.
(r6126) Fix a vanilla glitch: Only enable the next page button in the personnel screen when there are more than 20 past mercs.
(r6125) Fix vanilla bugs (wrong portraits, out of bounds access) for displaying the portraits of past merc in the personnel screen when there are more than 20 past mercs.
(r6071) Fix a vanilla glitch: A merge recipe for the guardian vest was missing.
(r6043) Fix a vanilla display glitch in debug mode: When turning off the Z-buffer display, the screen was not redrawn.
Report message to a moderator
|
Private 1st Class
|
|
|
|
Re: r7059 - crash when loading savegame[message #251042]
|
Fri, 07 May 2010 00:50
|
|
BirdFlu |
|
Messages:438
Registered:September 2007 Location: Lampukistan |
|
|
Here are some more.
Didn't look if these are Vanilla bugs, but at least they look like bugs.
Editor\LoadScreen.cc
l.1044: if( gzFilename[0] != '\0' );
TacticalAI\AIUtils.cc
l.880: if (sDistToEnemy < sDistToClosestEnemy );
TacticalAI\FindLocations.cc
l.502: if ( sTempGridNo != sGridNo );
The following ones are not exactly bugs (for gcc), but when you try to compile with Visual Studio the TRANSPARENT and INPUT_MOUSE defines are problematic as they are already defined in some Windows headers. I changed them to TRANSPARENT_INDEX and SGP_INPUT_MOUSE
sgp\Types.h
l.143: #define TRANSPARENT ((UINT16)0)
-> TRANSPARENT_INDEX
sgp\Cursor_Control.cc
l.209: BltVideoObjectOutline(MOUSE_BUFFER, guiExternVo, gusExternVoSubIndex, 0, 0, TRANSPARENT);
sgp\VObject_Blitters.cc
l.6702: else if (outline != TRANSPARENT)
l.6923: else if (s16BPPColor != TRANSPARENT)
Tactical\Interface_Items.cc
l.803: UINT16 outline = TRANSPARENT;
l.2299: INVRenderItem(guiSAVEBUFFER, NULL, obj, item_x, item_y, item_w, item_h, DIRTYLEVEL2, RENDER_ITEM_ATTACHMENT1 + i, TRANSPARENT);
l.3873: INVRenderItem(FRAME_BUFFER, NULL, *gpItemPopupObject, sX, sY, 29, 23, DIRTYLEVEL2, RENDER_ITEM_NOSTATUS, TRANSPARENT);
l.4050: INVRenderItem(FRAME_BUFFER, NULL, o, x + 8, y, box_w - 8, box_h - 2, DIRTYLEVEL2, 0, TRANSPARENT);
l.4734: UINT16 const outline = (menu.pfSelectedArray[cnt + menu.ubScrollAnchor] ? outline_col : TRANSPARENT);
Tactical\Interface_Panels.cc
l.2949: INVRenderItem(buf, &s, s.inv[HANDPOS], x, y, w, h, dirty_level, 0, TRANSPARENT);
l.2960: INVRenderItem(buf, &s, s.inv[SECONDHANDPOS], x, y, w, h, dirty_level, 0, TRANSPARENT);
Tactical\ShopKeeper_Interface.cc
l.2056: outline = TRANSPARENT;
Strategic\Map_Screen_Interface_Map_Inventory.cc
l.208: const UINT16 outline = (fMapInventoryItemCompatable[iCurrentSlot] ? Get16BPPColor(FROMRGB(255, 255, 255)) : TRANSPARENT);
Strategic\MapScreen.cc
l.715: INVRenderItem(guiSAVEBUFFER, s, s->inv[HANDPOS], SOLDIER_HAND_X, SOLDIER_HAND_Y, 58, 23, DIRTYLEVEL2, 0, TRANSPARENT);
Laptop\AIMMembers.cc
l.899: BltVideoObjectOutline( FRAME_BUFFER, &item_vo, item.ubGraphicNum, sCenX, sCenY, TRANSPARENT);
Laptop\Personnel.cc
l.1166: BltVideoObjectOutline(FRAME_BUFFER, &gfx, item.ubGraphicNum, cen_x, cen_y, TRANSPARENT);
Editor\EditorItems.cc
l.319: DrawItemCentered(Item[item_id], eInfo.uiBuffer, x, y + 2, TRANSPARENT);
l.447: DrawItemCentered(*item, eInfo.uiBuffer, x, y + 2, TRANSPARENT);
Editor\EditorMercs.cc
l.2166: BltVideoObjectOutline(uiSrcID, &vo, item.ubGraphicNum, 0, 0, TRANSPARENT);
sgp\Input.h
l.21: #define INPUT_MOUSE 0x1FF8
-> SGP_INPUT_MOUSE
Build\GameLoop.cc
l.211: while (DequeueSpecificEvent(&InputEvent, INPUT_MOUSE))
The declaration of the function in the header differs from the definition.
sgp\STCI.h
l.7: SGPImage* LoadSTCIFileToImage(char const* filename, UINT16 fContents);
-> SGPImage* LoadSTCIFileToImage(char const* const filename, UINT16 const fContents);
see definition in sgp\STCI.cc
I also had a problem with the following line when scrolling in tactical mode (windows, Visual Studio).
sgp\Video.cc
l.390: SDL_BlitSurface(Source, &SrcRect, Dest, &DstRect);
As Source and Dest are defined like this
SDL_Surface* Source = ScreenBuffer; // Primary
SDL_Surface* Dest = ScreenBuffer; // Back
it kind of makes sense that reading from and writing to the same surface could fail. It does on the Visual Studio version.
I changed it to this
#if !defined(_MSC_VER)
SDL_BlitSurface(Source, &SrcRect, Dest, &DstRect);
#else
SDL_BlitSurface(Source, &SrcRect, Frame, &DstRect);
SDL_BlitSurface(Frame, &DstRect, Dest, &DstRect);
#endif
Report message to a moderator
|
|
|
|
Re: r7059 - crash when loading savegame[message #251709]
|
Sun, 16 May 2010 21:43
|
|
Tron |
|
Messages:225
Registered:August 2007 Location: Germany |
|
|
BirdFluHere are some more.
Didn't look if these are Vanilla bugs, but at least they look like bugs.
Editor\LoadScreen.cc
l.1044: if( gzFilename[0] != '\0' );
TacticalAI\AIUtils.cc
l.880: if (sDistToEnemy < sDistToClosestEnemy );
TacticalAI\FindLocations.cc
l.502: if ( sTempGridNo != sGridNo );
Right, I noticed these ages ago, but forgot about them. Thanks for reminding me.
Quote:The following ones are not exactly bugs (for gcc), but when you try to compile with Visual Studio the TRANSPARENT and INPUT_MOUSE defines are problematic as they are already defined in some Windows headers. I changed them to TRANSPARENT_INDEX and SGP_INPUT_MOUSE
I'll look into this.
Quote:The declaration of the function in the header differs from the definition.
sgp\STCI.h
l.7: SGPImage* LoadSTCIFileToImage(char const* filename, UINT16 fContents);
-> SGPImage* LoadSTCIFileToImage(char const* const filename, UINT16 const fContents);
see definition in sgp\STCI.cc
This is perfectly valid. The additional "const"s in the implementation just signify, that the variables cannot be changed in the function. This is irrelevant for the interface. There are hundreds of functions with this (non-)difference by now. Is there a reason why you picked only this one?
Quote:I also had a problem with the following line when scrolling in tactical mode (windows, Visual Studio).
sgp\Video.cc
l.390: SDL_BlitSurface(Source, &SrcRect, Dest, &DstRect);
As Source and Dest are defined like this
SDL_Surface* Source = ScreenBuffer; // Primary
SDL_Surface* Dest = ScreenBuffer; // Back
it kind of makes sense that reading from and writing to the same surface could fail. It does on the Visual Studio version.
I changed it to this
#if !defined(_MSC_VER)
SDL_BlitSurface(Source, &SrcRect, Dest, &DstRect);
#else
SDL_BlitSurface(Source, &SrcRect, Frame, &DstRect);
SDL_BlitSurface(Frame, &DstRect, Dest, &DstRect);
#endif
This is a bug in SDL up to version 1.2.13. On x86 they use some horribly inefficient inline assembler, which, to add insult to injury, is also wrong: It sets the direction flag when copying backwards, but does not reset it. It was corrected (using my patch) in SDL 1.2.14. Also see HACK000D (just below).
Report message to a moderator
|
Sergeant 1st Class
|
|
|
|
Re: r7059 - crash when loading savegame[message #251737]
|
Mon, 17 May 2010 07:36
|
|
Tron |
|
Messages:225
Registered:August 2007 Location: Germany |
|
|
BirdFluThis may be valid for gcc, but apparently not for msvc. The linker was not able to find the function anymore. Here is the error message.
Quote:
sgp.lib(HImage.obj) : error LNK2019: unresolved external symbol "struct SGPImage * __cdecl LoadSTCIFileToImage(char const *,unsigned short)" (?LoadSTCIFileToImage@@YAPAUSGPImage@@PBDG@Z) referenced in function "struct SGPImage * __cdecl CreateImage(char const *,unsigned short)" (?CreateImage@@YAPAUSGPImage@@PBDG@Z)
There were no other problems, only this function failed. I wouldn't have noticed it otherwise.
It is valid C++. This is a bug in MSVC then, I do not particularily care. Take a look at LoadPCXFileToImage(), which is called just one line below in LoadSTCIFileToImage(). There is exactly the same pattern:
sgp/HImage.cc:37: strcasecmp(ext, "STI") == 0 ? LoadSTCIFileToImage(filename, fContents) :
sgp/STCI.cc:16:SGPImage* LoadSTCIFileToImage(char const* const filename, UINT16 const fContents)
sgp/STCI.h:7:SGPImage* LoadSTCIFileToImage(char const* filename, UINT16 fContents);
sgp/HImage.cc:38: strcasecmp(ext, "PCX") == 0 ? LoadPCXFileToImage( filename, fContents) :
sgp/PCX.cc:35:SGPImage* LoadPCXFileToImage(char const* const filename, UINT16 const contents)
sgp/PCX.h:7:SGPImage* LoadPCXFileToImage(char const* filename, UINT16 fContents);
The same holds for LoadTGAFileToImage(). You will find hundreds of other functions with this pattern. Out of curiosity I'd like to know, how the name is mangled in the implementation.
Quote:Edit:
Quote:SDL stuff...
I tried version 1.2.14 and it works without my patch. With 1.2.13 it crashes on Windows 7 and only produces wrong visual results on Windows XP.
As I said above: This is a bug in SDL up to 1.2.13. It does not exactly matter, which kind of "wrong" happens. Just use SDL 1.2.14, if you use MSVC. HACK000D, to work around this bug, uses GCC-specific inline assembler syntax, so does not work on MSVC.
Report message to a moderator
|
Sergeant 1st Class
|
|
|
Re: r7059 - crash when loading savegame[message #251775]
|
Tue, 18 May 2010 00:29
|
|
BirdFlu |
|
Messages:438
Registered:September 2007 Location: Lampukistan |
|
|
TronIt is valid C++. This is a bug in MSVC then, I do not particularily care.
Good for you. But if i/we want to use Stracciatella for SMP and also want to support MSVC besides gcc, then i/we do care and have to "fix" it.
Tron Take a look at LoadPCXFileToImage(), which is called just one line below in LoadSTCIFileToImage(). There is exactly the same pattern:
sgp/HImage.cc:37: strcasecmp(ext, "STI") == 0 ? LoadSTCIFileToImage(filename, fContents) :
sgp/STCI.cc:16:SGPImage* LoadSTCIFileToImage(char const* const filename, UINT16 const fContents)
sgp/STCI.h:7:SGPImage* LoadSTCIFileToImage(char const* filename, UINT16 fContents);
sgp/HImage.cc:38: strcasecmp(ext, "PCX") == 0 ? LoadPCXFileToImage( filename, fContents) :
sgp/PCX.cc:35:SGPImage* LoadPCXFileToImage(char const* const filename, UINT16 const contents)
sgp/PCX.h:7:SGPImage* LoadPCXFileToImage(char const* filename, UINT16 fContents);
The same holds for LoadTGAFileToImage(). You will find hundreds of other functions with this pattern. Out of curiosity I'd like to know, how the name is mangled in the implementation.
?LoadSTCIFileToImage@@YAPAUSGPImage@@QBDG@Z
?LoadPCXFileToImage@@YAPAUSGPImage@@PBDG@Z
?LoadTGAFileToImage@@YAPAUSGPImage@@PBDG@Z
For some strange reason the symbol for 'LoadSTCIFileToImage' contains the 'QBDG' string, unlike the 'PBDG' string for the other two functions.
TronQuote:Edit:
I tried version 1.2.14 and it works without my patch. With 1.2.13 it crashes on Windows 7 and only produces wrong visual results on Windows XP.
As I said above: This is a bug in SDL up to 1.2.13. It does not exactly matter, which kind of "wrong" happens. Just use SDL 1.2.14, if you use MSVC. HACK000D, to work around this bug, uses GCC-specific inline assembler syntax, so does not work on MSVC. I looked through my log and i've seen that i fixed this problem on October 14th 2009. SDL 1.2.14 was released on October 17th 2009 or later (http://www.libsdl.org/release/). Bad luck, i guess.
Report message to a moderator
|
|
|
|
Re: r7059 - crash when loading savegame[message #251801]
|
Tue, 18 May 2010 10:15
|
|
Tron |
|
Messages:225
Registered:August 2007 Location: Germany |
|
|
BirdFlu?LoadSTCIFileToImage@@YAPAUSGPImage@@QBDG@Z
?LoadPCXFileToImage@@YAPAUSGPImage@@PBDG@Z
?LoadTGAFileToImage@@YAPAUSGPImage@@PBDG@Z
For some strange reason the symbol for 'LoadSTCIFileToImage' contains the 'QBDG' string, unlike the 'PBDG' string for the other two functions.
I think I identified the bug in MSVC: If it does not see the "const-less" declaration before the definition, it incorrectly mangles the outer const into the name.
There is a declaration for LoadSTCIFileToImage() in sgp/STCI.h and it is included in sgp/STCI.cc. But sgp/ImgFmt.h uses the same include guard as sgp/STCI.h and and is included into sgp/STCI.cc before sgp/STCI.h, so the contents of sgp/STCI.h were skipped. I now (r7065) use a different (and more appropriatly named) include guard in sgp/ImgFmt.h, which resolves the name clash and should resolve the problem.
Edit: Out of curiosity: Which version of MSVC do you use?
[Updated on: Tue, 18 May 2010 10:20] by Moderator Report message to a moderator
|
Sergeant 1st Class
|
|
|
|
Re: r7059 - crash when loading savegame[message #257629]
|
Tue, 27 July 2010 10:40
|
|
Tron |
|
Messages:225
Registered:August 2007 Location: Germany |
|
|
I resolved the name clashes in r7067 and r7068. Thanks for reporting these problems.
Report message to a moderator
|
Sergeant 1st Class
|
|
|
Goto Forum:
Current Time: Thu May 02 08:12:32 GMT+3 2024
Total time taken to generate the page: 0.01633 seconds
|