LoneGazebo / Community-Patch-DLL

Community Patch for Civilization V - Brave New World
Other
280 stars 155 forks source link

ExCE CTDs and MiniDump #1432

Closed JFDaly closed 7 years ago

JFDaly commented 8 years ago

Good ol' ExCE is causing a CTD again, somewhere, but this time its impersistent. Could you please take a look at the MiniDump here and tell me if its decompiling to Lua or if its something else. Thanks.

This is with only ExCE, CP (12/03), and IGE.

LoneGazebo commented 8 years ago

Does it crash on the latest version of CP? I'm going to have a hard debugging that old of a CP.

JFDaly commented 8 years ago

Oh, lol, you Americans. Sorry = it does on the latest CP, the one you released yesterday (March 12th).

LoneGazebo commented 8 years ago

Oh. Right!

LoneGazebo commented 8 years ago

Alright, ran dump, it went to disassembly. So most definitely a lua bug. :/

JFDaly commented 8 years ago

Ugh. I wish there was something more I could do than blindly turn things off one by one and test - especially when it's irregular. Thanks anyway.

JFDaly commented 8 years ago

Is there a CvGameCoreDLL_FinalRelease2.pdb file that you have or something? According to this I might be able to read the MiniDump myself to find the part when it crashes, but I need that file. Of course, I might be entirely wrong here - but CID is causing some crashing too, now, and trying to diagnose is not enviable.

LoneGazebo commented 8 years ago

I think it would be a good idea for to setup visual studio 2010 and import the CP, then live debug it. Best way to catch a crash is live.

I can help setup if you need.

JFDaly commented 8 years ago

Yes, that would be helpful. Not sure where to start, though. Do I need to compile the CP DLL following Whoward's tutorial here?

LoneGazebo commented 8 years ago

Yeah, so you'll need to grab VS2010 express (is free), install it, then download the CP github repo. Copy and paste all of the files from the repo (ignoring the EUI/No-EUI/CP/CBP/CSD/C4DF mod folders - those aren't needed). Load up the project, and then turn optimizatin off (right click the project, go to properties-> optimziation and set full to off.

Build the project, then drag and drop the DLL you make (it'll appear in the /mods folder of the root where you put the github repo) into the CP folder in your MODS folder. Leave the PDB where it is.

All that done, load up the game, then - once all the mods are loaded (but before you start the map generation), 'hook in' to the game in VS by clicking Tools->attach to process (then choose the civ.exe running). At that point, if all was done correctly, a DLL break from CTD will show you the precise spot where it happens (unless it is a lua error - but even lua errors may break in the DLL sometimes!)

I hope that makes sense...

JFDaly commented 8 years ago

I couldn't find the optimization setting, but managed to set everything else up correctly. There were a tonne of warnings or errors in the build phase ('cannot find or open the pdb file'), but I'm not sure if they're serious.

I'll test this out, but Civ is now constantly freezing everytime I try to load the CP DLL - doesn't matter which version. Might be my game/PC is having problems, causing the mod CTDs.

LoneGazebo commented 8 years ago

There are 30 warnings that appear every time. They're benign.

LoneGazebo commented 8 years ago

The optimization setting is available if you right click on the project on the left side (the expansion-2 project) and click options at the bottom.

JFDaly commented 8 years ago

I got an unhandled exception, which coincided with the game freezing (this could be normal; I'm not sure). Not really sure what I'm looking at: Callstack Output.

I thought it would point to the DLL method being called, as in the pictures on this thread.

LoneGazebo commented 8 years ago

Were you hooked into the DLL at the time? The fact that it doesn't point to a spot in the DLL specifically makes it more likely to be in the lua, which sucks.

LoneGazebo commented 8 years ago

First-chance exceptions are innocuous, btw.

JFDaly commented 8 years ago

Yea, I think so - I followed your instructions anyway. Does it highlighting the .exe mean anything? Because the last time it was a Lua error, it was related to the game not handling units upgrading into something without a production cost, so maybe its something similar this time.

Thanks for the help anyway.

JFDaly commented 8 years ago

This time it had a bit more info (imgur decided to die, so its a screenshot in my dropbox). Is this significant?

Iamblichos commented 8 years ago

JFD, are you using EUI?

JFDaly commented 8 years ago

Nope.

LoneGazebo commented 8 years ago

Yes, interesting. Are you on the 3/14 CP? If not, download it, replace your CvGameCoreDLL_Expansion2 folder with the new one then try it again. Ilteroi rewrote some stuff in that function (sounds like it was grabbing a bad plot, maybe?)

Is the map flat - i.e. has black edges?

JFDaly commented 8 years ago

The maps I've been using are the Earth ones, so not flat.

I'll try out 14/3 and report back.

LoneGazebo commented 8 years ago

Cool.

JFDaly commented 8 years ago

On Earth map, 14/3 (March 14th) CP + ExCE (only Attrition component active), I get this: test test.

I ran a few games before without Attrition enabled, and had no issues, so maybe something is interacting badly between the plot-based stuff and routes? EDIT: Couldn't re-create this in 3-6 games, 3 of which was Exploration+Attrition components, so not sure what to make of it. Will test out Tribes next, and thus ExCE as a whole. Since reinstalling Civ, though, things seem to be a bit more stable - as before I was having CTDs with E+A.

EDIT: Lol, spoke too soon: test. This time, it was on a flat map. Happened a third time after that.

LoneGazebo commented 8 years ago

What does the call stack on both of those look like? You can toggle that in the bottom right window - that's what we need to see.

JFDaly commented 8 years ago

I don't have the callstacks from those two instances, but I re-created the error easy enough: test

LoneGazebo commented 8 years ago

At the top of IsValidMovePlot, add this:

#if defined(MOD_BALANCE_CORE)
    if(!this || this == NULL)
        return false;
#endif
LoneGazebo commented 8 years ago

So it'll look like this:

//--------------------------------------------------------------------
// in updateImpassable we check terrain and features (per plot), combined with technologies (per team). here we additionally look at traits (per player). 
// result is a simplified version of canMoveInto. since we don't know the particular of the unit, we are more restrictive here
bool CvPlot::isValidMovePlot(PlayerTypes ePlayer, bool bCheckTerritory) const
{
#if defined(MOD_BALANCE_CORE)
    if(!this || this == NULL)
        return false;
#endif
    if ( getRouteType()!=NO_ROUTE && !IsRoutePillaged() && (!isCity() || getOwner()==ePlayer) ) //if it's a city, it needs to be our city
        return true;
LoneGazebo commented 8 years ago

Save that, compile, and then try it. Sounds like a script is trying to place a unit on a null tile.

JFDaly commented 8 years ago

Well, three test runs with Exploration+Attrition and three with Exploration+Attrition+Tribes (whole ExCE suite) and no issues (up to 300 turns, at least), so I think that's solved it. Would this have any adverse side-effects if implemented? Is there anything I need to/can do on my end?

LoneGazebo commented 8 years ago

I've integrated into the 3/15 version, so you can update to that and all is well. I'm curious as to why it didn't show up in the dmp you sent me, but oh well. Glad it is working now!

LoneGazebo commented 8 years ago

No, not adverse side effects. Essentially what was happening was that the AI was, somewhere, starting an operation without a muster plot (probably a null plot) and that was being called.

mwhiter commented 8 years ago

But wouldn't calling NULL->isValidMovePlot() crash the game regardless?

LoneGazebo commented 8 years ago

I put in earlier checks to avoid that. The problem was that it was looking for route data on a plot that was bad.

JFDaly commented 7 years ago

As I gear up toward releasing Sovereignty, I want to run through some AI games and debug any possible crashes in real time. I've download the latest repository here, but can't see to be able to build the project. I've followed the instructions found above. Any ideas?

screen EDIT: Ah, I thought I could re-open the thread myself. Let me know if you want this in a new issue.

Iamblichos commented 7 years ago

JFD, open the Vox Populi ... sln file in Visual Studio, set your solution configuration at the top pulldown to debug or Released depending on what you need.

LoneGazebo commented 7 years ago

@JFDaly, you should also grab VS Express 2013.

LoneGazebo commented 7 years ago

If you use that and download the current repo (and install the repo's solution file etc.) it should work out of the box.

JFDaly commented 7 years ago

Right, thanks. I'll try VS E 2013 and get back once its downloaded.

JFDaly commented 7 years ago

EDIT: hang on

JFDaly commented 7 years ago

Okay, these are my errors:

errors

All I did was install VS E 2013, load up the Vox Populi sIn file from a newly downloaded copy of the repo, and set it to build. Did I need to turn off optimization again? I must be missing something.

LoneGazebo commented 7 years ago

Debug mode should be 'de-optimized' - make sure you have the FirePlace folder installed from the repo.

@ilteroi, any idea why stackwalker is showing up there?

JFDaly commented 7 years ago

In the FireWorks folder? I have that folder, sitting in the Community-Patch-DLL-master folder. Am I supposed to do something more with it to install it?

LoneGazebo commented 7 years ago

No, should just go in your folder as you did it. Hmm...

https://mega.nz/#!SQUHVApT!YUj1e816SdBtiOGvhyUmsGO9oAZ9fx3zA4N4mknFaqg

Try unzipping that into your repo folder, overwriting stuff as needed.

JFDaly commented 7 years ago

Still no luck.

LoneGazebo commented 7 years ago

That's really odd. When you loaded the repo, you did not select the 'convert this solution' option in the popup, did you?

JFDaly commented 7 years ago

I haven't seen that option, so I don't think so.

JFDaly commented 7 years ago

Oh hang on, maybe I did - I didn't pay much attention to the first load. I'll re-try.

LoneGazebo commented 7 years ago

Yeah, go ahead and start from scratch and don't upgrade the solution. Solution needs to use the original structure, just in 2013 for compile.

JFDaly commented 7 years ago

Hm, nope, I only got this:

s

No prompt to convert otherwise.

LoneGazebo commented 7 years ago

Yeah, cancel that.