Skip to main content

Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
TagsGame Engines
(1 edit)

Yes, just look for that line and simply comment it out. In case you want to restore it later. For me it worked well, and if it also works without it, that’s fine too. Especially in connection with my Farming Plugin from DSI I tinkered around with it. Give it a try. Maybe I also mixed something up: also try this fix I still have up my sleeve AND that ist only fix I actually use and it works for me:

//const _Scene_Boot_isReady = Scene_Boot.prototype.isReady;

//Scene_Boot.prototype.isReady = function () {

    // Make sure preloaded images are ready

  //  if (enablePreload) {

        // Check preload status

    //    const status = PermanentImageCache.getLoadingStatus();

      //  if (status.total > 0 && status.loaded + status.failed < status.total) {

        //    return false;

        //}

    //}

    //return _Scene_Boot_isReady.call(this);

//};

// === SF Safe Preload Hook (replaces the old isReady hook) ===================

// Purpose:

//  - Waits until the Hendrix preloader is finished (loaded+failed == total).

//  - Prevents infinite loops when files are missing or status gets stuck.

//  - Logs cleanly if a timeout occurs.

//

// Usage:

//  - Comment out the old block.

//  - Insert this block below.

//  - Can be used unchanged with your enablePreload flag.

// ============================================================================

const _Scene_Boot_isReady = Scene_Boot.prototype.isReady;

Scene_Boot.prototype.isReady = function () {

    try {

        // Only check if preload is enabled and the cache API exists

        if (typeof enablePreload !== "undefined" && enablePreload &&

            window.PermanentImageCache && typeof PermanentImageCache.getLoadingStatus === "function") {

            // Query status robustly (in case Hendrix’ method crashes)

            let status = { total: 0, loaded: 0, failed: 0 };

            try {

                const s = PermanentImageCache.getLoadingStatus();

                if (s && Number.isFinite(s.total) && Number.isFinite(s.loaded) && Number.isFinite(s.failed)) {

                    status = s;

                }

            } catch (e) {

                // If status cannot be read, continue boot but log once

                if (!this._sfPreloadLoggedStatusError) {

                    console.warn("[SF Preload] getLoadingStatus() threw an exception. Continuing boot.", e);

                    this._sfPreloadLoggedStatusError = true;

                }

                return _Scene_Boot_isReady.call(this);

            }

            // If there’s nothing to load → continue directly

            if (status.total <= 0) {

                return _Scene_Boot_isReady.call(this);

            }

            // Check progress

            const done = status.loaded + status.failed;

            const total = status.total;

            // Initialize progress tracker

            if (this._sfPreloadLastDone == null) this._sfPreloadLastDone = -1;

            if (this._sfPreloadStallFrames == null) this._sfPreloadStallFrames = 0;

            // If progress was made → reset stall counter

            if (done !== this._sfPreloadLastDone) {

                this._sfPreloadLastDone = done;

                this._sfPreloadStallFrames = 0;

            } else {

                // No progress this frame → increase stall counter

                this._sfPreloadStallFrames++;

            }

            // Maximum allowed wait frames (≈5 seconds at 60 FPS)

            const MAX_STALL_FRAMES = 300;

            // Not finished yet?

            if (done < total) {

                // As long as we see progress or are below timeout → wait

                if (this._sfPreloadStallFrames < MAX_STALL_FRAMES) {

                    return false; // Scene not ready yet

                } else {

                    // Timeout: continue anyway, but log a warning

                    if (!this._sfPreloadTimedOutOnce) {

                        console.warn(

                            `[SF Preload] Timeout after ${MAX_STALL_FRAMES} frames. `

                            + `Progress: ${done}/${total} (failed: ${status.failed}). `

                            + `Starting scene anyway.`

                        );

                        this._sfPreloadTimedOutOnce = true;

                    }

                    // Falls through and lets Scene_Boot continue normally

                }

            }

            // Finished (done >= total) → continue normally

        }

    } catch (err) {

        // If something unexpected happens here, don’t block boot

        console.warn("[SF Preload] Unexpected error in boot hook. Continuing.", err);

    }

    return _Scene_Boot_isReady.call(this);

};

// ============================================================================

// End SF Safe Preload Hook

other question: Do you use this plugin? https://qiujiu.itch.io/qj-mapprojectilemz I think it can collide hard with Hendrix plugins.

Hi thanks! So I can add the code below in a new .js file called SF_Safe_Preload_Hook.js behind the hendrix animation one to use it as a patch (so It would work with new updates) rather that edit the plugin each times right ? 

And yes I use qiujui map projectiles, It seems to work the only crash is if I shoot a projectile and change map before It reached his impact then It will crash.