mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-20 20:40:29 +08:00
bug fix for crash-on-quit with async load on 10.25 and earlier SDK - work around by not using async. also covers not using async on v9.
This commit is contained in:
@@ -256,6 +256,7 @@ static bool LoadOnePackage(const string& inPath, int pass);
|
|||||||
bool CSL_Init(
|
bool CSL_Init(
|
||||||
const char* inTexturePath)
|
const char* inTexturePath)
|
||||||
{
|
{
|
||||||
|
obj_init();
|
||||||
bool ok = OBJ_Init(inTexturePath);
|
bool ok = OBJ_Init(inTexturePath);
|
||||||
if (!ok)
|
if (!ok)
|
||||||
XPLMDump() << "XSB WARNING: we failed to find XSB's custom lighting texture at " << inTexturePath << ".\n";
|
XPLMDump() << "XSB WARNING: we failed to find XSB's custom lighting texture at " << inTexturePath << ".\n";
|
||||||
|
|||||||
@@ -24,13 +24,11 @@
|
|||||||
#include "XPMPMultiplayerObj8.h"
|
#include "XPMPMultiplayerObj8.h"
|
||||||
#include "XPMPMultiplayerVars.h"
|
#include "XPMPMultiplayerVars.h"
|
||||||
#include "XPLMScenery.h"
|
#include "XPLMScenery.h"
|
||||||
|
#include "XPLMUtilities.h"
|
||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
#define WANT_ASYNC 1
|
|
||||||
|
|
||||||
|
|
||||||
struct one_inst {
|
struct one_inst {
|
||||||
one_inst * next;
|
one_inst * next;
|
||||||
|
|
||||||
@@ -52,6 +50,27 @@ struct one_obj {
|
|||||||
static one_obj * s_worklist = NULL;
|
static one_obj * s_worklist = NULL;
|
||||||
|
|
||||||
|
|
||||||
|
static void (*XPLMLoadObjectAsync_p)(
|
||||||
|
const char * inPath,
|
||||||
|
XPLMObjectLoaded_f inCallback,
|
||||||
|
void * inRefcon)=NULL;
|
||||||
|
|
||||||
|
void obj_init()
|
||||||
|
{
|
||||||
|
int sim, xplm;
|
||||||
|
XPLMHostApplicationID app;
|
||||||
|
XPLMGetVersions(&sim,&xplm,&app);
|
||||||
|
// Ben says: we need the 2.10 SDK (e.g. X-Plane 10) to have async load at all. But we need 10.30 to pick up an SDK bug
|
||||||
|
// fix where async load crashes if we queue a second load before the first completes. So for users on 10.25, they get
|
||||||
|
// pauses.
|
||||||
|
if(sim >= 10300 && xplm >= 210)
|
||||||
|
{
|
||||||
|
XPLMLoadObjectAsync_p = (void (*)(const char *, XPLMObjectLoaded_f, void *)) XPLMFindSymbol("XPLMLoadObjectAsync");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
static void draw_objects_for_mode(one_obj * who, int want_translucent)
|
static void draw_objects_for_mode(one_obj * who, int want_translucent)
|
||||||
{
|
{
|
||||||
while(who)
|
while(who)
|
||||||
@@ -98,11 +117,10 @@ void obj_schedule_one_aircraft(
|
|||||||
if(model->handle == NULL &&
|
if(model->handle == NULL &&
|
||||||
!model->file.empty())
|
!model->file.empty())
|
||||||
{
|
{
|
||||||
#if WANT_ASYNC
|
if(XPLMLoadObjectAsync_p)
|
||||||
XPLMLoadObjectAsync(model->file.c_str(),obj_loaded_cb,(void *) &model->handle);
|
XPLMLoadObjectAsync_p(model->file.c_str(),obj_loaded_cb,(void *) &model->handle);
|
||||||
#else
|
else
|
||||||
model->handle = XPLMLoadObject(model->file.c_str());
|
model->handle = XPLMLoadObject(model->file.c_str());
|
||||||
#endif
|
|
||||||
model->file.clear();
|
model->file.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -59,6 +59,8 @@ struct obj_for_acf {
|
|||||||
|
|
||||||
struct CSLPlane_t;
|
struct CSLPlane_t;
|
||||||
|
|
||||||
|
void obj_init();
|
||||||
|
|
||||||
bool obj_load_one_attached_obj(
|
bool obj_load_one_attached_obj(
|
||||||
const char * file_name,
|
const char * file_name,
|
||||||
bool needs_anim,
|
bool needs_anim,
|
||||||
|
|||||||
Reference in New Issue
Block a user