Move UI to start of banked data to reduce changes in data_ptrs.h causing cache misses
@@ -69,6 +69,7 @@ export const EVENT_MSG_PRE_AVATARS = "Preparing avatars...";
export const EVENT_MSG_PRE_SCENES = "Preparing scenes...";
export const EVENT_MSG_PRE_EVENTS = "Preparing events...";
export const EVENT_MSG_PRE_MUSIC = "Preparing music...";
+
export const EVENT_MSG_PRE_COMPLETE = "Preparation complete";
export const EVENT_MSG_COMPILING_EVENTS = "Compiling events...";
@@ -104,6 +105,12 @@ const compile = async (
bankController: isMBC1(cartType) ? MBC1 : MBC5,
});
+ // Add UI data
+ const fontImagePtr = banked.push(precompiled.fontTiles);
+ const frameImagePtr = banked.push(precompiled.frameTiles);
+ const cursorImagePtr = banked.push(precompiled.cursorTiles);
+ const emotesSpritePtr = banked.push(precompiled.emotesSprite);
+
progress(EVENT_MSG_COMPILING_EVENTS);
// Hacky small wait to allow console to update before event loop is blocked
// Can maybe move some of the compilation into workers to prevent this
@@ -280,13 +287,6 @@ const compile = async (
);
});
-
- // Add UI data
- const fontImagePtr = banked.push(precompiled.fontTiles);
- const frameImagePtr = banked.push(precompiled.frameTiles);
- const cursorImagePtr = banked.push(precompiled.cursorTiles);
- const emotesSpritePtr = banked.push(precompiled.emotesSprite);
-
// Add sprite data
const spritePtrs = precompiled.usedSprites.map((sprite) => {
return banked.push([].concat(sprite.frames, sprite.data));
