FreeFalcon / freefalcon-central

A campaign based, multiplayer, open source flight simulator.
http://freefalcon.org/
BSD 2-Clause "Simplified" License
157 stars 99 forks source link

Failed assertions trying to get into 3D mode #13

Open vinnydiehl opened 11 years ago

vinnydiehl commented 11 years ago

Right as the first plane is lit up on the loading screen, there are two assertions that fail. Both message boxes pop up at roughly the same time, so let's look at these first.

One of them occurs in this switch. m_eSurfFmt is set to D3DX_SF_UNKNOWN at this point, and the switch falls through to the default case where there's a rather stupid way of erroring out (ShiAssert(false)? WTF).

The other simultaneous error is from this assertion here.

Accompanying these is this message on the console:

Texture: Failed to create texture  (Code: 80070057)
PeterMeyer commented 11 years ago

Hmm, regarding to the Code: 80070057 Errors, lookslike it cannot access some Bitmap/Imagefile and create an Texturemap. Maybe it cannot find the needed imagefile (file not found) or the image file format is not as expected.This looks like an COM (Component Object Modell) Error: HRESULT: 0x80070057 (2147942487) Name of the Exception: is: E_INVALIDARG. Maybe you can bypass it, but you get texture rendering errors in the scene.

PlutoniumHeart commented 11 years ago

@PeterMeyer Did you tried to by pass it and get to the 3D environment?

PeterMeyer commented 11 years ago

@PlutoniumHeart Yeah. I was able to bypass this Error. I simply commented out this Method:

bool TextureHandle::Load(UInt16 mip, UInt chroma, UInt8 *TexBuffer, bool bDoNotLoadBits, bool bDoNotCopyBits, int nImageDataStride) and set return to false.

Now the Consolelog output has changed to:

sion: 0, Build: 0 -- DXContext - Start of Caps report Device supports AGP texturing Insufficient color key support No color key blending support -- DXContext - End of Caps report ERROR: BID_FILE_DIS already in Index ERROR: WIN_ADD_SQUADRON already in Index Error opening index file (art\resource\music.idx) Got Scenario Stats. 0 craters Connecting to game: Uninitialized Image [2001] Not found in O_Output::SetImage(ID) Control=(0) Image [2001] Not found in O_Output::SetImage(ID) Control=(0) Starting local game. Got all campaign data! Starting it up!

Now a new Error is raised: Its an Clib Runtime Error: MS Visual C++ Debug Library c:\program files (x86)\microsoft visual studio 10.0\vc\include\xtree.cpp Line 256

Message: Expression: map/set Interator not incrementable

If you ignore it it occurs again with: Expression:"standard c++ library out of range" && 0

The debugger holds at:

(deep in the Microsoftland)

C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\crt\src\dbghook.c Line:67

declspec(noinline) void cdecl _CRT_DEBUGGER_HOOK(int _Reserved) { /* assign 0 to _debugger_hook_dummy so that the function is not folded in retail */ (_Reserved); _debugger_hook_dummy = 0; }

This condition is showing in Release and Debug config. This maybe has to to with the Debug Hook the former Microproose Developers has implemented in the Subproject crashhandler.lib but its just an idea and not sure.

There is an Stackoverflow Post where a Programmer migrating from VS2003 to VS2010 has also to do with this type of Error: http://stackoverflow.com/questions/8997503/map-set-iterator-not-incrementablemap-set-iterator-not-incrementable

PlutoniumHeart commented 11 years ago

@PeterMeyer I am still very much puzzled by the file structure of the FF6 and the EXE code we have, I was thinking that the tac reference uses the same 3D engine, so it would be easier to check that out first, but it keeps asking me for a strange file for the f-18 CFA18A.tga, there is no such file available, and so it fails, and the tacref also triggered the same assertion failure. I believe no texture file are readin what so ever because of the different file structure.

I think someone mentioned something about a working code using VS2003? I would be surprised if the code works with FF6 installation. And I would really love to have a look at that too.

PlutoniumHeart commented 11 years ago

I can actually see the F-18's model being rendered and is interactive with all the viewing controls, in the tac ref. by commeting out the assertion if else statement, but if I tab out to the desktop and tab back in it disappears...

I am wondering why void TextureBankClass::Reference(int id) function only updates the refCount but not doing any texture reading, everything indicates that it should. Can someone tell me where the texture is read in?

PlutoniumHeart commented 11 years ago

I just created a release build of the exe and put it in the FF6 folder, it looks like a lot of issues are only present in the debug build, I don't know why, with debug build in the tacRef, if you view more than 3 aircrafts, and then go back to a already viewed one, it give assertion failure and other more errors until the program crashes, but in the release it doesn't have this issue. Also in the relase the splash screen before entering the 3D actually goes to the last step before crash, but in the debug, it can't even go through the first step.

vinnydiehl commented 11 years ago

I can't imagine it's any of the #ifdefs in debug, as there aren't that many in the areas where we have problems. I wonder if it has to do with compiler options?

PlutoniumHeart commented 11 years ago

I don't know if it is the right question to ask, but how did the old FF team do their business? Are those bugs we are having now only appeared when the code was moved to VS2010?

PeterMeyer commented 11 years ago

@PlutoniumHeart AS said erlier. Microsoft has done whole nr of "improvements" after the next Version of Visual Studio (this was VS2005). No one in the BMS Team or anywhere else in the FalconSphere was ever able to port this peace of shit to an newer Compiler then VS2003 VC++ 7.1) We are the fist Team who ever archived this Goal, having it compile. The old VS2003 Compiler allowed some Instructions nowday compilers will reject and mark as Error (default typing for example). This is why BMS is conding until today with VS2003 wich is not ready for Windows Vista/Win7/Win8 wich has a lot of Problems and the Support is ceased by Microsoft. I have done some VS2003 to VS2010 copares durning the Migration process and sometimes i was nearly giving up becaue it looks a migration to an higher Compiler then VS2003 is not possible.VS2003 will also not install on a Windows Version later then Windows XP and i think this is not the last suprise MS has for us. Under the GCC you would never see such a Idiocrazy and thadts why i want to change our Maincompiler to mingw-m64 on Windows to get rid of VC++ entirely.

PeterMeyer commented 11 years ago

Regarding Datafiles: I was able to get an FF50. an FF5.5 and an FF6.0 Installation. all 3 Versions are side by Side. You can change wich Installation Folder is used by our FFViper.exe If you adjust the Registrykey using FF5.0 Folder all the Errors here are gone, but one other Error wich has to do with initialization of SimMemoryPool with an negative value is showing. Dont forget. This Codebase is made for FF5.0 Datafiles, Airrcrafts, Textures, Textfiles ect and we trying to load FF6.0 Datafiles. Of cause this doesnt match but now we have to find out why.

PeterMeyer commented 11 years ago

This are the Registryvalues. Just change it to an another FreeFalcon Version No Directory and you completely diffrent FFViper.exe Results:

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\MicroProse] [HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\MicroProse\Falcon] [HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\MicroProse\Falcon\4.0] "baseDir"="F:\FreeFalcon5" "curTheater"="Korea" "misctexDir"="F:\FreeFalcon5\terrdata\misctex" "movieDir"="F:\FreeFalcon5\movies" "objectDir"="F:\FreeFalcon5\terrdata\objects" "theaterDir"="F:\FreeFalcon5\terrdata\korea" "FFver"="5.5" "PilotName"=hex:4a,6f,65,20,50,69,6c,6f,74,00,00,00,00,00,00,00,00,00,00,00 "PilotCallsign"=hex:56,69,70,65,72,00,00,00,00,00,00,00

[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\MicroProse\Falcon\4.0\MPR] "MPRDetect3Dx"=dword:00000001 "MPRDetectCPU"=dword:00000001 "MPRDetectMMX"=dword:00000001 "MPRDetectXMM"=dword:00000001

PeterMeyer commented 11 years ago

Regading missing texture. If you get an error msg because of a missing tga or other imagefile, just make some dummy imagefile and put it where it should load. If the Code loads without flaws, the next step is to get the correct file with the correct artwork in it.

vinnydiehl commented 11 years ago

17 made a lot of progress on this issue.

PeterMeyer commented 11 years ago

I have the RV Code as well and i didnt compile on VS2010. But this is not the topic here.

Stewie23 commented 11 years ago

okay i look a bit into the texture stuff, and it seems the tactical ref loads textures if u change https://github.com/FreeFalcon/freefalcon-central/blob/develop/src/graphics/bsplib/texbank.cpp#L556

to:

TexturePool[id].tex.flags = MPR_TI_DDS;

odly the function seemd to be in a status of rewriting note https://github.com/FreeFalcon/freefalcon-central/blob/develop/src/graphics/bsplib/texbank.cpp#L660-L771 (EDIT: Hm nope the N on the end of files is for Night, at least by Terraintiles) but there is no file [Number]N.dds in C:\Program Files (x86)\Games\FreeFalcon6\terrdata\objects

i hope this helps im totaly new to C++ and not realy sure what i actualy changed^^

Stewie23 commented 11 years ago

okay i also removed the stuff that tries to load .tga files, since i am a bit more confident about what i did there i try d the git stuff.