lespalt / iRon

MIT License
135 stars 20 forks source link

irsdkClient::getVarFloat hits assert when building debug #14

Open eXifreXi opened 1 year ago

eXifreXi commented 1 year ago

Hey there,

I build the project from source and while the .exe, as well as release(x64) work fine, the debug(x64) asserts in irsdk_utils.cpp:297 when trying to get the TireChange in the DDU. Happens in other places too, so I think it's not directly related to the TireChange line, but just the first one to trigger it.

In release builds that assert is ignored, so the whole thing is just failing silently. Any idea if there is some check or condition missing before being allowed to access the data? Or is this just failing all the time and no one is noticing? I'm trying this on a Test Drive (maybe the data is not available here?).

Kind regards, Cedric

eXifreXi commented 1 year ago

Okay, I managed to fix it. All three variables: ir_dcBrakeBias ir_dpLTireChange and ir_dpRTireChange seem to be invalid (m_idx is -1), so just calling getFloat on them will cause an assert when debugging. I added an isValid() call (part of the irsdkCVar class) before accessing them and that seems to solve the issue. Just started out with it, so not sure if that's correct, or just hiding a more significant problem, but at least I can start in debug mode now.

byBlurr commented 1 year ago

@eXifreXi @lespalt Was this fix/temporary fix committed to this repo?