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 Go to next message
BirdFlu is currently offline 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

Master Sergeant
Re: r7059 - crash when loading savegame[message #243563] Mon, 08 February 2010 23:08 Go to previous messageGo to next message
mgl is currently offline mgl

 
Messages:255
Registered:December 2007
Location: France
The most interesting thing is that this critical bug was introduced the week before Christmas and you are the first one to report about it eight weeks later. The number of people who play stracciatella must be very very low (at least from the svn repository). I myself haven't played since late october.

In case it's needed, this is the fix (replace "gWorldSector" by "sLoadSector").
--- Build/SaveLoadGame.cc.7059	2010-02-03 21:46:12.000000000 +0100
+++ Build/SaveLoadGame.cc	2010-02-08 21:53:34.000000000 +0100
@@ -703,7 +703,7 @@
 		SetWorldSectorInvalid();
 
 		//if we should load a sector (if the person didnt just start the game game)
-		if (gWorldSectorX != 0 && gWorldSectorY != 0)
+		if (sLoadSectorX != 0 && sLoadSectorY != 0)
 		{
 			//Load the sector
 			SetCurrentWorldSector(sLoadSectorX, sLoadSectorY, bLoadSectorZ);


Report message to a moderator

Master Sergeant
Re: r7059 - crash when loading savegame[message #243567] Mon, 08 February 2010 23:18 Go to previous messageGo to next message
BirdFlu is currently offline BirdFlu

 
Messages:438
Registered:September 2007
Location: Lampukistan
mgl
The number of people who play stracciatella must be very very low (at least from the svn repository).
Or they don't update frequently.

Report message to a moderator

Master Sergeant
Re: r7059 - crash when loading savegame[message #243623] Tue, 09 February 2010 15:26 Go to previous messageGo to next message
JohnHurricane is currently offline JohnHurricane
Messages:2
Registered:February 2010
Or they haven't encountered the bug so far... (speaking of me) Smile

Actually the only bug I encountered so far, which annoys me is that if I load a saved game all the enemies in a ongoing fight have disappeared... which restricts me to the Iron mode... Altough my programming skills aren't the best I try to hunt this one down. Are there any design documents around or do I just have to dig me through the code itself ? Thanks in advance

Report message to a moderator

Civilian
Re: r7059 - crash when loading savegame[message #243633] Tue, 09 February 2010 17:04 Go to previous messageGo to next message
mgl is currently offline mgl

 
Messages:255
Registered:December 2007
Location: France
If you use svn release 7059, your saved game shouldn't load at all but crash to desktop. It forgets about te current sector. If you save in strategic screen, it's not really a problem, but if you save in tactical, like when you are fighting, you are in big trouble. Try the fix I submitted and see if it happens again.

Or maybe you are playing the game with data from a rather uncommon language and the game engine can't find some of the files. I have played straciatella with english data for years and I have never seen your bug.

There is no document but you can see what happens in the game if you compile it with the JA2BETAVERSION and JA2TESTVERSION flags on in the makefile ('config.default', root folder). You will have messages on the game screen, on the standard or error output and in text files (I think they are in "$HOME/.ja2/data/" on a Unix OS).

Report message to a moderator

Master Sergeant
Re: r7059 - crash when loading savegame[message #243660] Tue, 09 February 2010 22:56 Go to previous messageGo to next message
JohnHurricane is currently offline JohnHurricane
Messages:2
Registered:February 2010
I just checked, I was running r7059.
And I didn't had any crashes but the funny bug of removing the enemy soldiers from the map by saving and loading (although the number of seen enemies was still displayed in the icons, just firing off one gun freed the section). Now with your patch they are there again Smile

thanks

and btw I am playing the gold version in english

Report message to a moderator

Civilian
Re: r7059 - crash when loading savegame[message #243668] Wed, 10 February 2010 00:25 Go to previous messageGo to next message
mgl is currently offline mgl

 
Messages:255
Registered:December 2007
Location: France
JohnHurricane
And I didn't had any crashes

Probably because you compiled it with none of the JA2BETAVERSION or JA2TESTVERSION on. It could explain why no one had reported the bug before. It looks less critical when all what you see is that your enemies disappeared.

Report message to a moderator

Master Sergeant
Re: r7059 - crash when loading savegame[message #243681] Wed, 10 February 2010 01:48 Go to previous messageGo to next message
BirdFlu is currently offline BirdFlu

 
Messages:438
Registered:September 2007
Location: Lampukistan
I think it's just the debug version. You usually don't play with a debug version.

Report message to a moderator

Master Sergeant
Re: r7059 - crash when loading savegame[message #250452] Tue, 27 April 2010 13:44 Go to previous messageGo to next message
Ddass is currently offline Ddass

 
Messages:26
Registered:April 2010
Tron's page list/offers 6011 as latest. Whats this 7059..

Report message to a moderator

Private 1st Class
Re: r7059 - crash when loading savegame[message #250495] Tue, 27 April 2010 23:01 Go to previous messageGo to next message
mgl is currently offline mgl

 
Messages:255
Registered:December 2007
Location: France
The source code of stracciatella is kept in a subversion repository on the internet. Anyone can download it from there with a subversion client program and build the executable file himself, but it's rather technical. The latest revision there is 7059 and no development was done since November 2009. That's why the revision 7059 becomes famous.

Normal users unaware of the subversion repository or unable to build the executable themselves use the latest snapshot that Tron released for them. It's older (roughly 6 months max, generally speaking) than the subversion repository.

I think 6011 was released in early summer 2009 while 7059 is from 2009-11-18. stracciatella is in a hiatus since this date.

Report message to a moderator

Master Sergeant
Re: r7059 - crash when loading savegame[message #250504] Tue, 27 April 2010 23:51 Go to previous messageGo to next message
Ddass is currently offline Ddass

 
Messages:26
Registered:April 2010
Thanks. Is there a changelog listing differences between 6011 and 7059? I couldnt find one in the open internet.

Report message to a moderator

Private 1st Class
Re: r7059 - crash when loading savegame[message #250508] Wed, 28 April 2010 00:27 Go to previous messageGo to next message
mgl is currently offline mgl

 
Messages:255
Registered:December 2007
Location: France
No. You can only see the changes through the use of a subversion client.

There are major changes like the data files in lower case, the enemies climb roofs, bug fixes. As you can guess from the revision numbers, there are more than 1000 updates in a few months between them. I can remember a radar map fix in the editor too. And there is at least a new bug, reported in this thread.

Report message to a moderator

Master Sergeant
Re: r7059 - crash when loading savegame[message #250529] Wed, 28 April 2010 08:54 Go to previous messageGo to next message
Ddass is currently offline 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 #250941] Tue, 04 May 2010 10:46 Go to previous messageGo to next message
Tron

 
Messages:225
Registered:August 2007
Location: Germany
I corrected this regression in r7060. BirdFlu, thanks for reporting the issue. mgl, thanks for providing a patch.

Report message to a moderator

Sergeant 1st Class
Re: r7059 - crash when loading savegame[message #251042] Fri, 07 May 2010 00:50 Go to previous messageGo to next message
BirdFlu is currently offline 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

Master Sergeant
Re: r7059 - crash when loading savegame[message #251709] Sun, 16 May 2010 21:43 Go to previous messageGo to next message
Tron

 
Messages:225
Registered:August 2007
Location: Germany
BirdFlu
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 ); 


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 #251724] Mon, 17 May 2010 01:29 Go to previous messageGo to next message
BirdFlu is currently offline BirdFlu

 
Messages:438
Registered:September 2007
Location: Lampukistan
Tron
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?

This 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.

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.

[Updated on: Mon, 17 May 2010 01:58] by Moderator

Report message to a moderator

Master Sergeant
Re: r7059 - crash when loading savegame[message #251737] Mon, 17 May 2010 07:36 Go to previous messageGo to next message
Tron

 
Messages:225
Registered:August 2007
Location: Germany
BirdFlu
This 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 Go to previous messageGo to next message
BirdFlu is currently offline BirdFlu

 
Messages:438
Registered:September 2007
Location: Lampukistan
Tron
It 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.

Tron
Quote:
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

Master Sergeant
Re: r7059 - crash when loading savegame[message #251801] Tue, 18 May 2010 10:15 Go to previous messageGo to next message
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 #251832] Tue, 18 May 2010 20:18 Go to previous messageGo to next message
BirdFlu is currently offline BirdFlu

 
Messages:438
Registered:September 2007
Location: Lampukistan
Thanks. It works with your fix.

I use Visual Studio 2008 and 2010.

Report message to a moderator

Master Sergeant
Re: r7059 - crash when loading savegame[message #257629] Tue, 27 July 2010 10:40 Go to previous message
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
Previous Topic: 0.12.1 - CTD bug
Next Topic: bold border on the inventory items
Goto Forum:
  


Current Time: Thu May 02 08:12:32 GMT+3 2024

Total time taken to generate the page: 0.01633 seconds