papermario/src/101b90_len_8f0.c

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

389 lines
12 KiB
C
Raw Normal View History

Splat refactor (#257) * all non-world rodata migrated * data disasm * kinda working * updated yaml * bloop * linker header * configure 2.0 * bin * mass rename to remove code_ * pause rename * battle partner stuff * whew * more renames * more renames * more renaming * it builds! * updates * remove main prefix * one more thing * crc, yay0 * .data, .rodata, .bss * img * dead_atan2 * it buildsgit add -A * split battle/partner/6FAD10 * rm &s on sleepy_sheep syms * sha1sum ninja rule description * OK but commented out PaperMarioMapFS and PaperMarioNpcSprites * uncomment * fix mapfs * match func_8003CFB4 * . * clean up and name npc_iter_no_op * npc.c * enable cc warnings * name npc_find_near * use singular options.asset_path * smores * cc_dsl only when needed * kinda fix configure for splat refactor2 * ok! * new msg format * remove old msg format docs * slight bug fixes, splat adjustment * git subrepo pull (merge) --force tools/splat subrepo: subdir: "tools/splat" merged: "cfc140bb76" upstream: origin: "https://github.com/ethteck/splat.git" branch: "master" commit: "cfc140bb76" git-subrepo: version: "0.4.3" origin: "https://github.com/ingydotnet/git-subrepo" commit: "2f68596" * git subrepo pull (merge) --force tools/splat subrepo: subdir: "tools/splat" merged: "85349befcd" upstream: origin: "https://github.com/ethteck/splat.git" branch: "master" commit: "85349befcd" git-subrepo: version: "0.4.3" origin: "https://github.com/ingydotnet/git-subrepo" commit: "2f68596" * Update symbol addrs * git subrepo pull tools/splat subrepo: subdir: "tools/splat" merged: "a44631e194" upstream: origin: "https://github.com/ethteck/splat.git" branch: "master" commit: "a44631e194" git-subrepo: version: "0.4.3" origin: "https://github.com/ingydotnet/git-subrepo" commit: "2f68596" Co-authored-by: Alex Bates <hi@imalex.xyz>
2021-04-13 09:47:52 +02:00
#include "common.h"
#include "sprite.h"
#include "nu/nusys.h"
#include "ld_addrs.h"
#include "sprite/player.h"
#ifdef SHIFT
#define SPRITE_ROM_START (u32) sprites_ROM_START + 0x10
#elif VERSION_US || VERSION_IQUE
#define SPRITE_ROM_START 0x1943000 + 0x10
#elif VERSION_PAL
#define SPRITE_ROM_START 0x1DF0000 + 0x10
#elif VERSION_JP
#define SPRITE_ROM_START 0x1A40000 + 0x10
#endif
extern s32 spr_allocateBtlComponentsOnWorldHeap;
Modern gcc + shiftability work (#942) * wip changes for modern gcc * more * wip * blah * Define explicit size for symbol * Clean up evt_handle_exec1 * wip * . * fixes & VLA macro * VLA innit * wipz * Fix potential UB * meowp * meowp2 * fixies * git subrepo pull --force tools/splat subrepo: subdir: "tools/splat" merged: "e1f0b17917" upstream: origin: "https://github.com/ethteck/splat.git" branch: "master" commit: "e1f0b17917" git-subrepo: version: "0.4.5" origin: "https://github.com/ingydotnet/git-subrepo" commit: "aa416e4" * fixules * git subrepo pull --force tools/splat subrepo: subdir: "tools/splat" merged: "3ba3277e57" upstream: origin: "https://github.com/ethteck/splat.git" branch: "master" commit: "3ba3277e57" git-subrepo: version: "0.4.5" origin: "https://github.com/ingydotnet/git-subrepo" commit: "aa416e4" * more shiftability + symbols work * git subrepo pull --force tools/splat subrepo: subdir: "tools/splat" merged: "02879e52a7" upstream: origin: "https://github.com/ethteck/splat.git" branch: "master" commit: "02879e52a7" git-subrepo: version: "0.4.5" origin: "https://github.com/ingydotnet/git-subrepo" commit: "aa416e4" * more * revert bss changes for now, new heaps overlay for aligning stuff to 0x1000 (not sure how necessary that is, so maybe will revert later on) * 'fixing' jp shift build * more * more syms * more progress * more * ididid * git subrepo pull --force tools/splat subrepo: subdir: "tools/splat" merged: "de54da38f5" upstream: origin: "https://github.com/ethteck/splat.git" branch: "master" commit: "de54da38f5" git-subrepo: version: "0.4.5" origin: "https://github.com/ingydotnet/git-subrepo" commit: "aa416e4" * git subrepo pull --force tools/splat subrepo: subdir: "tools/splat" merged: "a27dc436a6" upstream: origin: "https://github.com/ethteck/splat.git" branch: "master" commit: "a27dc436a6" git-subrepo: version: "0.4.5" origin: "https://github.com/ingydotnet/git-subrepo" commit: "aa416e4" * blah * stuff's broken, but at least it's maybe cleaner * modern gcc back * revert * shifting all overlays - works so far * progs * another * modern gcc flag, re-enabled all ifdef shift stuff * fixies * progress * fixes, matching build * heaps3 overlay and some symbol names * changies * PR comments & cleanup
2023-02-14 14:14:14 +01:00
extern HeapNode heap_generalHead;
extern HeapNode heap_spriteHead;
Shiftability work (#778) * move data includes * splat yaml comments * 8a160 data + funcs * naming things * 801b0 funcs * data stuff * BSS temp removal + new splat accommodations * git subrepo pull --force tools/splat subrepo: subdir: "tools/splat" merged: "e1abb4ece0" upstream: origin: "https://github.com/ethteck/splat.git" branch: "master" commit: "e1abb4ece0" git-subrepo: version: "0.4.3" origin: "https://github.com/ingydotnet/git-subrepo" commit: "2f68596" * splat accommodations * git subrepo pull --force tools/splat subrepo: subdir: "tools/splat" merged: "20bffc4ffc" upstream: origin: "https://github.com/ethteck/splat.git" branch: "master" commit: "20bffc4ffc" git-subrepo: version: "0.4.3" origin: "https://github.com/ingydotnet/git-subrepo" commit: "2f68596" * set vram for seg * git subrepo pull (merge) --force tools/splat subrepo: subdir: "tools/splat" merged: "c95002b315" upstream: origin: "https://github.com/ethteck/splat.git" branch: "master" commit: "c95002b315" git-subrepo: version: "0.4.3" origin: "https://github.com/ingydotnet/git-subrepo" commit: "2f68596" * more goods * git subrepo pull --force tools/splat subrepo: subdir: "tools/splat" merged: "470c358834" upstream: origin: "https://github.com/ethteck/splat.git" branch: "master" commit: "470c358834" git-subrepo: version: "0.4.3" origin: "https://github.com/ingydotnet/git-subrepo" commit: "2f68596" * git subrepo pull --force tools/splat subrepo: subdir: "tools/splat" merged: "df424333da" upstream: origin: "https://github.com/ethteck/splat.git" branch: "master" commit: "df424333da" git-subrepo: version: "0.4.3" origin: "https://github.com/ingydotnet/git-subrepo" commit: "2f68596" * git subrepo pull (merge) --force tools/splat subrepo: subdir: "tools/splat" merged: "18eb9cb2e6" upstream: origin: "https://github.com/ethteck/splat.git" branch: "master" commit: "18eb9cb2e6" git-subrepo: version: "0.4.3" origin: "https://github.com/ingydotnet/git-subrepo" commit: "2f68596" * git subrepo pull --force tools/splat subrepo: subdir: "tools/splat" merged: "285a549bc6" upstream: origin: "https://github.com/ethteck/splat.git" branch: "master" commit: "285a549bc6" git-subrepo: version: "0.4.3" origin: "https://github.com/ingydotnet/git-subrepo" commit: "2f68596" * git subrepo pull --force tools/splat subrepo: subdir: "tools/splat" merged: "c523ce1a3a" upstream: origin: "https://github.com/ethteck/splat.git" branch: "master" commit: "c523ce1a3a" git-subrepo: version: "0.4.3" origin: "https://github.com/ingydotnet/git-subrepo" commit: "2f68596" * hawaii push * shiftability work * DEG_TO_RAD * git subrepo pull tools/splat subrepo: subdir: "tools/splat" merged: "6c02ec5ecd" upstream: origin: "https://github.com/ethteck/splat.git" branch: "master" commit: "6c02ec5ecd" git-subrepo: version: "0.4.3" origin: "https://github.com/ingydotnet/git-subrepo.git" commit: "2f68596"
2022-09-17 21:10:37 +02:00
BSS s32 spr_asset_entry[2];
BSS s32 PlayerRasterLoadDescBuffer[101]; //NOTE: maximum rasters supported for a single player sprite is 101
BSS s32 PlayerRasterLoadDescNumLoaded;
BSS s32 PlayerRasterLoadDescBeginSpriteIndex[SPR_Peach3]; //TODO size linked to number of player sprites
Shiftability work (#778) * move data includes * splat yaml comments * 8a160 data + funcs * naming things * 801b0 funcs * data stuff * BSS temp removal + new splat accommodations * git subrepo pull --force tools/splat subrepo: subdir: "tools/splat" merged: "e1abb4ece0" upstream: origin: "https://github.com/ethteck/splat.git" branch: "master" commit: "e1abb4ece0" git-subrepo: version: "0.4.3" origin: "https://github.com/ingydotnet/git-subrepo" commit: "2f68596" * splat accommodations * git subrepo pull --force tools/splat subrepo: subdir: "tools/splat" merged: "20bffc4ffc" upstream: origin: "https://github.com/ethteck/splat.git" branch: "master" commit: "20bffc4ffc" git-subrepo: version: "0.4.3" origin: "https://github.com/ingydotnet/git-subrepo" commit: "2f68596" * set vram for seg * git subrepo pull (merge) --force tools/splat subrepo: subdir: "tools/splat" merged: "c95002b315" upstream: origin: "https://github.com/ethteck/splat.git" branch: "master" commit: "c95002b315" git-subrepo: version: "0.4.3" origin: "https://github.com/ingydotnet/git-subrepo" commit: "2f68596" * more goods * git subrepo pull --force tools/splat subrepo: subdir: "tools/splat" merged: "470c358834" upstream: origin: "https://github.com/ethteck/splat.git" branch: "master" commit: "470c358834" git-subrepo: version: "0.4.3" origin: "https://github.com/ingydotnet/git-subrepo" commit: "2f68596" * git subrepo pull --force tools/splat subrepo: subdir: "tools/splat" merged: "df424333da" upstream: origin: "https://github.com/ethteck/splat.git" branch: "master" commit: "df424333da" git-subrepo: version: "0.4.3" origin: "https://github.com/ingydotnet/git-subrepo" commit: "2f68596" * git subrepo pull (merge) --force tools/splat subrepo: subdir: "tools/splat" merged: "18eb9cb2e6" upstream: origin: "https://github.com/ethteck/splat.git" branch: "master" commit: "18eb9cb2e6" git-subrepo: version: "0.4.3" origin: "https://github.com/ingydotnet/git-subrepo" commit: "2f68596" * git subrepo pull --force tools/splat subrepo: subdir: "tools/splat" merged: "285a549bc6" upstream: origin: "https://github.com/ethteck/splat.git" branch: "master" commit: "285a549bc6" git-subrepo: version: "0.4.3" origin: "https://github.com/ingydotnet/git-subrepo" commit: "2f68596" * git subrepo pull --force tools/splat subrepo: subdir: "tools/splat" merged: "c523ce1a3a" upstream: origin: "https://github.com/ethteck/splat.git" branch: "master" commit: "c523ce1a3a" git-subrepo: version: "0.4.3" origin: "https://github.com/ingydotnet/git-subrepo" commit: "2f68596" * hawaii push * shiftability work * DEG_TO_RAD * git subrepo pull tools/splat subrepo: subdir: "tools/splat" merged: "6c02ec5ecd" upstream: origin: "https://github.com/ethteck/splat.git" branch: "master" commit: "6c02ec5ecd" git-subrepo: version: "0.4.3" origin: "https://github.com/ingydotnet/git-subrepo.git" commit: "2f68596"
2022-09-17 21:10:37 +02:00
BSS s32 D_802D0084[3]; // unused?
BSS s32 PlayerRasterLoadDesc[0x2E0]; // correct length?
Shiftability work (#778) * move data includes * splat yaml comments * 8a160 data + funcs * naming things * 801b0 funcs * data stuff * BSS temp removal + new splat accommodations * git subrepo pull --force tools/splat subrepo: subdir: "tools/splat" merged: "e1abb4ece0" upstream: origin: "https://github.com/ethteck/splat.git" branch: "master" commit: "e1abb4ece0" git-subrepo: version: "0.4.3" origin: "https://github.com/ingydotnet/git-subrepo" commit: "2f68596" * splat accommodations * git subrepo pull --force tools/splat subrepo: subdir: "tools/splat" merged: "20bffc4ffc" upstream: origin: "https://github.com/ethteck/splat.git" branch: "master" commit: "20bffc4ffc" git-subrepo: version: "0.4.3" origin: "https://github.com/ingydotnet/git-subrepo" commit: "2f68596" * set vram for seg * git subrepo pull (merge) --force tools/splat subrepo: subdir: "tools/splat" merged: "c95002b315" upstream: origin: "https://github.com/ethteck/splat.git" branch: "master" commit: "c95002b315" git-subrepo: version: "0.4.3" origin: "https://github.com/ingydotnet/git-subrepo" commit: "2f68596" * more goods * git subrepo pull --force tools/splat subrepo: subdir: "tools/splat" merged: "470c358834" upstream: origin: "https://github.com/ethteck/splat.git" branch: "master" commit: "470c358834" git-subrepo: version: "0.4.3" origin: "https://github.com/ingydotnet/git-subrepo" commit: "2f68596" * git subrepo pull --force tools/splat subrepo: subdir: "tools/splat" merged: "df424333da" upstream: origin: "https://github.com/ethteck/splat.git" branch: "master" commit: "df424333da" git-subrepo: version: "0.4.3" origin: "https://github.com/ingydotnet/git-subrepo" commit: "2f68596" * git subrepo pull (merge) --force tools/splat subrepo: subdir: "tools/splat" merged: "18eb9cb2e6" upstream: origin: "https://github.com/ethteck/splat.git" branch: "master" commit: "18eb9cb2e6" git-subrepo: version: "0.4.3" origin: "https://github.com/ingydotnet/git-subrepo" commit: "2f68596" * git subrepo pull --force tools/splat subrepo: subdir: "tools/splat" merged: "285a549bc6" upstream: origin: "https://github.com/ethteck/splat.git" branch: "master" commit: "285a549bc6" git-subrepo: version: "0.4.3" origin: "https://github.com/ingydotnet/git-subrepo" commit: "2f68596" * git subrepo pull --force tools/splat subrepo: subdir: "tools/splat" merged: "c523ce1a3a" upstream: origin: "https://github.com/ethteck/splat.git" branch: "master" commit: "c523ce1a3a" git-subrepo: version: "0.4.3" origin: "https://github.com/ingydotnet/git-subrepo" commit: "2f68596" * hawaii push * shiftability work * DEG_TO_RAD * git subrepo pull tools/splat subrepo: subdir: "tools/splat" merged: "6c02ec5ecd" upstream: origin: "https://github.com/ethteck/splat.git" branch: "master" commit: "6c02ec5ecd" git-subrepo: version: "0.4.3" origin: "https://github.com/ingydotnet/git-subrepo.git" commit: "2f68596"
2022-09-17 21:10:37 +02:00
BSS PlayerRastersHeader PlayerRasterHeader;
BSS s32 D_802E0C1C; // unused
BSS s32 PlayerSpriteRasterSets[SPR_Peach3 + 1]; //TODO size linked to number of player sprites
Shiftability work (#778) * move data includes * splat yaml comments * 8a160 data + funcs * naming things * 801b0 funcs * data stuff * BSS temp removal + new splat accommodations * git subrepo pull --force tools/splat subrepo: subdir: "tools/splat" merged: "e1abb4ece0" upstream: origin: "https://github.com/ethteck/splat.git" branch: "master" commit: "e1abb4ece0" git-subrepo: version: "0.4.3" origin: "https://github.com/ingydotnet/git-subrepo" commit: "2f68596" * splat accommodations * git subrepo pull --force tools/splat subrepo: subdir: "tools/splat" merged: "20bffc4ffc" upstream: origin: "https://github.com/ethteck/splat.git" branch: "master" commit: "20bffc4ffc" git-subrepo: version: "0.4.3" origin: "https://github.com/ingydotnet/git-subrepo" commit: "2f68596" * set vram for seg * git subrepo pull (merge) --force tools/splat subrepo: subdir: "tools/splat" merged: "c95002b315" upstream: origin: "https://github.com/ethteck/splat.git" branch: "master" commit: "c95002b315" git-subrepo: version: "0.4.3" origin: "https://github.com/ingydotnet/git-subrepo" commit: "2f68596" * more goods * git subrepo pull --force tools/splat subrepo: subdir: "tools/splat" merged: "470c358834" upstream: origin: "https://github.com/ethteck/splat.git" branch: "master" commit: "470c358834" git-subrepo: version: "0.4.3" origin: "https://github.com/ingydotnet/git-subrepo" commit: "2f68596" * git subrepo pull --force tools/splat subrepo: subdir: "tools/splat" merged: "df424333da" upstream: origin: "https://github.com/ethteck/splat.git" branch: "master" commit: "df424333da" git-subrepo: version: "0.4.3" origin: "https://github.com/ingydotnet/git-subrepo" commit: "2f68596" * git subrepo pull (merge) --force tools/splat subrepo: subdir: "tools/splat" merged: "18eb9cb2e6" upstream: origin: "https://github.com/ethteck/splat.git" branch: "master" commit: "18eb9cb2e6" git-subrepo: version: "0.4.3" origin: "https://github.com/ingydotnet/git-subrepo" commit: "2f68596" * git subrepo pull --force tools/splat subrepo: subdir: "tools/splat" merged: "285a549bc6" upstream: origin: "https://github.com/ethteck/splat.git" branch: "master" commit: "285a549bc6" git-subrepo: version: "0.4.3" origin: "https://github.com/ingydotnet/git-subrepo" commit: "2f68596" * git subrepo pull --force tools/splat subrepo: subdir: "tools/splat" merged: "c523ce1a3a" upstream: origin: "https://github.com/ethteck/splat.git" branch: "master" commit: "c523ce1a3a" git-subrepo: version: "0.4.3" origin: "https://github.com/ingydotnet/git-subrepo" commit: "2f68596" * hawaii push * shiftability work * DEG_TO_RAD * git subrepo pull tools/splat subrepo: subdir: "tools/splat" merged: "6c02ec5ecd" upstream: origin: "https://github.com/ethteck/splat.git" branch: "master" commit: "6c02ec5ecd" git-subrepo: version: "0.4.3" origin: "https://github.com/ingydotnet/git-subrepo.git" commit: "2f68596"
2022-09-17 21:10:37 +02:00
BSS s32 PlayerRasterCacheSize;
BSS s32 PlayerRasterMaxSize;
BSS s32 SpriteDataHeader[3];
Shiftability work (#778) * move data includes * splat yaml comments * 8a160 data + funcs * naming things * 801b0 funcs * data stuff * BSS temp removal + new splat accommodations * git subrepo pull --force tools/splat subrepo: subdir: "tools/splat" merged: "e1abb4ece0" upstream: origin: "https://github.com/ethteck/splat.git" branch: "master" commit: "e1abb4ece0" git-subrepo: version: "0.4.3" origin: "https://github.com/ingydotnet/git-subrepo" commit: "2f68596" * splat accommodations * git subrepo pull --force tools/splat subrepo: subdir: "tools/splat" merged: "20bffc4ffc" upstream: origin: "https://github.com/ethteck/splat.git" branch: "master" commit: "20bffc4ffc" git-subrepo: version: "0.4.3" origin: "https://github.com/ingydotnet/git-subrepo" commit: "2f68596" * set vram for seg * git subrepo pull (merge) --force tools/splat subrepo: subdir: "tools/splat" merged: "c95002b315" upstream: origin: "https://github.com/ethteck/splat.git" branch: "master" commit: "c95002b315" git-subrepo: version: "0.4.3" origin: "https://github.com/ingydotnet/git-subrepo" commit: "2f68596" * more goods * git subrepo pull --force tools/splat subrepo: subdir: "tools/splat" merged: "470c358834" upstream: origin: "https://github.com/ethteck/splat.git" branch: "master" commit: "470c358834" git-subrepo: version: "0.4.3" origin: "https://github.com/ingydotnet/git-subrepo" commit: "2f68596" * git subrepo pull --force tools/splat subrepo: subdir: "tools/splat" merged: "df424333da" upstream: origin: "https://github.com/ethteck/splat.git" branch: "master" commit: "df424333da" git-subrepo: version: "0.4.3" origin: "https://github.com/ingydotnet/git-subrepo" commit: "2f68596" * git subrepo pull (merge) --force tools/splat subrepo: subdir: "tools/splat" merged: "18eb9cb2e6" upstream: origin: "https://github.com/ethteck/splat.git" branch: "master" commit: "18eb9cb2e6" git-subrepo: version: "0.4.3" origin: "https://github.com/ingydotnet/git-subrepo" commit: "2f68596" * git subrepo pull --force tools/splat subrepo: subdir: "tools/splat" merged: "285a549bc6" upstream: origin: "https://github.com/ethteck/splat.git" branch: "master" commit: "285a549bc6" git-subrepo: version: "0.4.3" origin: "https://github.com/ingydotnet/git-subrepo" commit: "2f68596" * git subrepo pull --force tools/splat subrepo: subdir: "tools/splat" merged: "c523ce1a3a" upstream: origin: "https://github.com/ethteck/splat.git" branch: "master" commit: "c523ce1a3a" git-subrepo: version: "0.4.3" origin: "https://github.com/ingydotnet/git-subrepo" commit: "2f68596" * hawaii push * shiftability work * DEG_TO_RAD * git subrepo pull tools/splat subrepo: subdir: "tools/splat" merged: "6c02ec5ecd" upstream: origin: "https://github.com/ethteck/splat.git" branch: "master" commit: "6c02ec5ecd" git-subrepo: version: "0.4.3" origin: "https://github.com/ingydotnet/git-subrepo.git" commit: "2f68596"
2022-09-17 21:10:37 +02:00
BSS s32 D_802E0C6C; // unused?
BSS PlayerSpriteCacheEntry PlayerRasterCache[18];
#define ALIGN4(v) (((u32)(v) >> 2) << 2)
#define SPR_SWIZZLE(base,offset) ((void*)((s32)(offset) + (s32)(base)))
void spr_swizzle_anim_offsets(s32 arg0, s32 base, void* spriteData) {
u8* buffer;
SpriteAnimComponent*** animList;
SpriteAnimComponent** compList;
SpriteAnimComponent* comp;
s32 animOffset;
s32 compOffset;
s32 temp;
// required to match, spriteData->animList would be nicer
animList = (SpriteAnimComponent***) spriteData;
animList += 4;
while (TRUE) {
if (*animList == PTR_LIST_END) {
break;
}
compList = (SpriteAnimComponent**) ((s32)*animList - ALIGN4(base));
compList = SPR_SWIZZLE(ALIGN4(spriteData), compList);
*animList = compList;
while (TRUE) {
if (*compList == PTR_LIST_END) {
break;
}
*compList = comp = SPR_SWIZZLE(ALIGN4(spriteData), (s32)*compList - ALIGN4(base));
comp->cmdList = SPR_SWIZZLE(ALIGN4(spriteData), (s32)comp->cmdList - ALIGN4(base));
compList++;
}
animList++;
}
}
Splat refactor (#257) * all non-world rodata migrated * data disasm * kinda working * updated yaml * bloop * linker header * configure 2.0 * bin * mass rename to remove code_ * pause rename * battle partner stuff * whew * more renames * more renames * more renaming * it builds! * updates * remove main prefix * one more thing * crc, yay0 * .data, .rodata, .bss * img * dead_atan2 * it buildsgit add -A * split battle/partner/6FAD10 * rm &s on sleepy_sheep syms * sha1sum ninja rule description * OK but commented out PaperMarioMapFS and PaperMarioNpcSprites * uncomment * fix mapfs * match func_8003CFB4 * . * clean up and name npc_iter_no_op * npc.c * enable cc warnings * name npc_find_near * use singular options.asset_path * smores * cc_dsl only when needed * kinda fix configure for splat refactor2 * ok! * new msg format * remove old msg format docs * slight bug fixes, splat adjustment * git subrepo pull (merge) --force tools/splat subrepo: subdir: "tools/splat" merged: "cfc140bb76" upstream: origin: "https://github.com/ethteck/splat.git" branch: "master" commit: "cfc140bb76" git-subrepo: version: "0.4.3" origin: "https://github.com/ingydotnet/git-subrepo" commit: "2f68596" * git subrepo pull (merge) --force tools/splat subrepo: subdir: "tools/splat" merged: "85349befcd" upstream: origin: "https://github.com/ethteck/splat.git" branch: "master" commit: "85349befcd" git-subrepo: version: "0.4.3" origin: "https://github.com/ingydotnet/git-subrepo" commit: "2f68596" * Update symbol addrs * git subrepo pull tools/splat subrepo: subdir: "tools/splat" merged: "a44631e194" upstream: origin: "https://github.com/ethteck/splat.git" branch: "master" commit: "a44631e194" git-subrepo: version: "0.4.3" origin: "https://github.com/ingydotnet/git-subrepo" commit: "2f68596" Co-authored-by: Alex Bates <hi@imalex.xyz>
2021-04-13 09:47:52 +02:00
SpriteAnimData* spr_load_sprite(s32 idx, s32 isPlayerSprite, s32 useTailAlloc) {
SpriteAnimData* animData;
s32 base;
s32 i;
s32 compressedSize;
s32* ptr1;
IMG_PTR image;
s32 count;
s32** data;
s32** palettes;
if (isPlayerSprite) {
base = SpriteDataHeader[1];
} else {
base = SpriteDataHeader[2];
}
// read current and next sprite offsets, so we can find the difference
nuPiReadRom(base + idx * 4, &spr_asset_entry, sizeof(spr_asset_entry));
compressedSize = ALIGN8(spr_asset_entry[1] - spr_asset_entry[0]);
data = general_heap_malloc(compressedSize);
nuPiReadRom(base + spr_asset_entry[0], data, compressedSize);
ptr1 = (s32*)data;
// skip 4 bytes: 'YAY0' signature
ptr1++;
if (useTailAlloc) {
Modern gcc + shiftability work (#942) * wip changes for modern gcc * more * wip * blah * Define explicit size for symbol * Clean up evt_handle_exec1 * wip * . * fixes & VLA macro * VLA innit * wipz * Fix potential UB * meowp * meowp2 * fixies * git subrepo pull --force tools/splat subrepo: subdir: "tools/splat" merged: "e1f0b17917" upstream: origin: "https://github.com/ethteck/splat.git" branch: "master" commit: "e1f0b17917" git-subrepo: version: "0.4.5" origin: "https://github.com/ingydotnet/git-subrepo" commit: "aa416e4" * fixules * git subrepo pull --force tools/splat subrepo: subdir: "tools/splat" merged: "3ba3277e57" upstream: origin: "https://github.com/ethteck/splat.git" branch: "master" commit: "3ba3277e57" git-subrepo: version: "0.4.5" origin: "https://github.com/ingydotnet/git-subrepo" commit: "aa416e4" * more shiftability + symbols work * git subrepo pull --force tools/splat subrepo: subdir: "tools/splat" merged: "02879e52a7" upstream: origin: "https://github.com/ethteck/splat.git" branch: "master" commit: "02879e52a7" git-subrepo: version: "0.4.5" origin: "https://github.com/ingydotnet/git-subrepo" commit: "aa416e4" * more * revert bss changes for now, new heaps overlay for aligning stuff to 0x1000 (not sure how necessary that is, so maybe will revert later on) * 'fixing' jp shift build * more * more syms * more progress * more * ididid * git subrepo pull --force tools/splat subrepo: subdir: "tools/splat" merged: "de54da38f5" upstream: origin: "https://github.com/ethteck/splat.git" branch: "master" commit: "de54da38f5" git-subrepo: version: "0.4.5" origin: "https://github.com/ingydotnet/git-subrepo" commit: "aa416e4" * git subrepo pull --force tools/splat subrepo: subdir: "tools/splat" merged: "a27dc436a6" upstream: origin: "https://github.com/ethteck/splat.git" branch: "master" commit: "a27dc436a6" git-subrepo: version: "0.4.5" origin: "https://github.com/ingydotnet/git-subrepo" commit: "aa416e4" * blah * stuff's broken, but at least it's maybe cleaner * modern gcc back * revert * shifting all overlays - works so far * progs * another * modern gcc flag, re-enabled all ifdef shift stuff * fixies * progress * fixes, matching build * heaps3 overlay and some symbol names * changies * PR comments & cleanup
2023-02-14 14:14:14 +01:00
animData = _heap_malloc_tail(&heap_spriteHead, *ptr1);
} else {
Modern gcc + shiftability work (#942) * wip changes for modern gcc * more * wip * blah * Define explicit size for symbol * Clean up evt_handle_exec1 * wip * . * fixes & VLA macro * VLA innit * wipz * Fix potential UB * meowp * meowp2 * fixies * git subrepo pull --force tools/splat subrepo: subdir: "tools/splat" merged: "e1f0b17917" upstream: origin: "https://github.com/ethteck/splat.git" branch: "master" commit: "e1f0b17917" git-subrepo: version: "0.4.5" origin: "https://github.com/ingydotnet/git-subrepo" commit: "aa416e4" * fixules * git subrepo pull --force tools/splat subrepo: subdir: "tools/splat" merged: "3ba3277e57" upstream: origin: "https://github.com/ethteck/splat.git" branch: "master" commit: "3ba3277e57" git-subrepo: version: "0.4.5" origin: "https://github.com/ingydotnet/git-subrepo" commit: "aa416e4" * more shiftability + symbols work * git subrepo pull --force tools/splat subrepo: subdir: "tools/splat" merged: "02879e52a7" upstream: origin: "https://github.com/ethteck/splat.git" branch: "master" commit: "02879e52a7" git-subrepo: version: "0.4.5" origin: "https://github.com/ingydotnet/git-subrepo" commit: "aa416e4" * more * revert bss changes for now, new heaps overlay for aligning stuff to 0x1000 (not sure how necessary that is, so maybe will revert later on) * 'fixing' jp shift build * more * more syms * more progress * more * ididid * git subrepo pull --force tools/splat subrepo: subdir: "tools/splat" merged: "de54da38f5" upstream: origin: "https://github.com/ethteck/splat.git" branch: "master" commit: "de54da38f5" git-subrepo: version: "0.4.5" origin: "https://github.com/ingydotnet/git-subrepo" commit: "aa416e4" * git subrepo pull --force tools/splat subrepo: subdir: "tools/splat" merged: "a27dc436a6" upstream: origin: "https://github.com/ethteck/splat.git" branch: "master" commit: "a27dc436a6" git-subrepo: version: "0.4.5" origin: "https://github.com/ingydotnet/git-subrepo" commit: "aa416e4" * blah * stuff's broken, but at least it's maybe cleaner * modern gcc back * revert * shifting all overlays - works so far * progs * another * modern gcc flag, re-enabled all ifdef shift stuff * fixies * progress * fixes, matching build * heaps3 overlay and some symbol names * changies * PR comments & cleanup
2023-02-14 14:14:14 +01:00
animData = _heap_malloc(&heap_spriteHead, *ptr1);
}
decode_yay0(data, animData);
general_heap_free(data);
// swizzle raster array
data = (s32**)animData->rastersOffset;
data = SPR_SWIZZLE(ALIGN4(animData), data);
animData->rastersOffset = (SpriteRasterCacheEntry**)data;
while (TRUE) {
ptr1 = *data;
if (ptr1 == PTR_LIST_END) {
break;
}
// swizzle each raster cache entry
ptr1 = SPR_SWIZZLE(ALIGN4(animData), ptr1);
*data++ = ptr1;
image = ((SpriteRasterCacheEntry*)ptr1)->image;
if (!isPlayerSprite) {
// swizzle image pointer in the cache entry
image = SPR_SWIZZLE(ALIGN4(animData), image);
*ptr1 = (s32)image;
}
}
if (isPlayerSprite) {
PlayerRasterLoadDescBeginSpriteIndex[idx] = PlayerRasterLoadDescNumLoaded;
count = PlayerSpriteRasterSets[idx + 1] - PlayerSpriteRasterSets[idx];
// load a range of raster loading desciptors to a buffer and copy contents into PlayerRasterLoadDesc
nuPiReadRom(SpriteDataHeader[0] + PlayerRasterHeader.loadDescriptors + sizeof(u32) * PlayerSpriteRasterSets[idx],
PlayerRasterLoadDescBuffer, sizeof(PlayerRasterLoadDescBuffer));
for (i = 0; i < count; i++) {
PlayerRasterLoadDesc[PlayerRasterLoadDescNumLoaded++] = PlayerRasterLoadDescBuffer[i];
}
}
// swizzle palettes array
palettes = SPR_SWIZZLE(ALIGN4(animData), animData->palettesOffset);
animData->palettesOffset = (PAL_PTR*)palettes;
while (TRUE) {
ptr1 = *palettes;
if (ptr1 == PTR_LIST_END) {
break;
}
// swizzle each palette pointer
ptr1 = SPR_SWIZZLE(ALIGN4(animData), ptr1);
*palettes++ = ptr1;
}
spr_swizzle_anim_offsets(0, 0, animData);
return animData;
}
Splat refactor (#257) * all non-world rodata migrated * data disasm * kinda working * updated yaml * bloop * linker header * configure 2.0 * bin * mass rename to remove code_ * pause rename * battle partner stuff * whew * more renames * more renames * more renaming * it builds! * updates * remove main prefix * one more thing * crc, yay0 * .data, .rodata, .bss * img * dead_atan2 * it buildsgit add -A * split battle/partner/6FAD10 * rm &s on sleepy_sheep syms * sha1sum ninja rule description * OK but commented out PaperMarioMapFS and PaperMarioNpcSprites * uncomment * fix mapfs * match func_8003CFB4 * . * clean up and name npc_iter_no_op * npc.c * enable cc warnings * name npc_find_near * use singular options.asset_path * smores * cc_dsl only when needed * kinda fix configure for splat refactor2 * ok! * new msg format * remove old msg format docs * slight bug fixes, splat adjustment * git subrepo pull (merge) --force tools/splat subrepo: subdir: "tools/splat" merged: "cfc140bb76" upstream: origin: "https://github.com/ethteck/splat.git" branch: "master" commit: "cfc140bb76" git-subrepo: version: "0.4.3" origin: "https://github.com/ingydotnet/git-subrepo" commit: "2f68596" * git subrepo pull (merge) --force tools/splat subrepo: subdir: "tools/splat" merged: "85349befcd" upstream: origin: "https://github.com/ethteck/splat.git" branch: "master" commit: "85349befcd" git-subrepo: version: "0.4.3" origin: "https://github.com/ingydotnet/git-subrepo" commit: "2f68596" * Update symbol addrs * git subrepo pull tools/splat subrepo: subdir: "tools/splat" merged: "a44631e194" upstream: origin: "https://github.com/ethteck/splat.git" branch: "master" commit: "a44631e194" git-subrepo: version: "0.4.3" origin: "https://github.com/ingydotnet/git-subrepo" commit: "2f68596" Co-authored-by: Alex Bates <hi@imalex.xyz>
2021-04-13 09:47:52 +02:00
void spr_init_player_raster_cache(s32 cacheSize, s32 maxRasterSize) {
void* raster;
s32 i;
nuPiReadRom(SPRITE_ROM_START, &SpriteDataHeader, sizeof(SpriteDataHeader));
PlayerRasterCacheSize = cacheSize;
PlayerRasterMaxSize = maxRasterSize;
SpriteDataHeader[0] += SPRITE_ROM_START;
SpriteDataHeader[1] += SPRITE_ROM_START;
SpriteDataHeader[2] += SPRITE_ROM_START;
Modern gcc + shiftability work (#942) * wip changes for modern gcc * more * wip * blah * Define explicit size for symbol * Clean up evt_handle_exec1 * wip * . * fixes & VLA macro * VLA innit * wipz * Fix potential UB * meowp * meowp2 * fixies * git subrepo pull --force tools/splat subrepo: subdir: "tools/splat" merged: "e1f0b17917" upstream: origin: "https://github.com/ethteck/splat.git" branch: "master" commit: "e1f0b17917" git-subrepo: version: "0.4.5" origin: "https://github.com/ingydotnet/git-subrepo" commit: "aa416e4" * fixules * git subrepo pull --force tools/splat subrepo: subdir: "tools/splat" merged: "3ba3277e57" upstream: origin: "https://github.com/ethteck/splat.git" branch: "master" commit: "3ba3277e57" git-subrepo: version: "0.4.5" origin: "https://github.com/ingydotnet/git-subrepo" commit: "aa416e4" * more shiftability + symbols work * git subrepo pull --force tools/splat subrepo: subdir: "tools/splat" merged: "02879e52a7" upstream: origin: "https://github.com/ethteck/splat.git" branch: "master" commit: "02879e52a7" git-subrepo: version: "0.4.5" origin: "https://github.com/ingydotnet/git-subrepo" commit: "aa416e4" * more * revert bss changes for now, new heaps overlay for aligning stuff to 0x1000 (not sure how necessary that is, so maybe will revert later on) * 'fixing' jp shift build * more * more syms * more progress * more * ididid * git subrepo pull --force tools/splat subrepo: subdir: "tools/splat" merged: "de54da38f5" upstream: origin: "https://github.com/ethteck/splat.git" branch: "master" commit: "de54da38f5" git-subrepo: version: "0.4.5" origin: "https://github.com/ingydotnet/git-subrepo" commit: "aa416e4" * git subrepo pull --force tools/splat subrepo: subdir: "tools/splat" merged: "a27dc436a6" upstream: origin: "https://github.com/ethteck/splat.git" branch: "master" commit: "a27dc436a6" git-subrepo: version: "0.4.5" origin: "https://github.com/ingydotnet/git-subrepo" commit: "aa416e4" * blah * stuff's broken, but at least it's maybe cleaner * modern gcc back * revert * shifting all overlays - works so far * progs * another * modern gcc flag, re-enabled all ifdef shift stuff * fixies * progress * fixes, matching build * heaps3 overlay and some symbol names * changies * PR comments & cleanup
2023-02-14 14:14:14 +01:00
raster = _heap_malloc(&heap_spriteHead, maxRasterSize * cacheSize);
for (i = 0; i < ARRAY_COUNT(PlayerRasterCache); i++) {
PlayerRasterCache[i].raster = raster;
raster += PlayerRasterMaxSize;
PlayerRasterCache[i].lazyDeleteTime = 0;
PlayerRasterCache[i].rasterIndex = 0;
PlayerRasterCache[i].spriteIndex = 0xFF;
}
for (i = 0; i < ARRAY_COUNT(PlayerRasterLoadDescBeginSpriteIndex); i++) {
PlayerRasterLoadDescBeginSpriteIndex[i] = 0;
}
PlayerRasterLoadDescNumLoaded = 0;
nuPiReadRom(SpriteDataHeader[0], &PlayerRasterHeader, sizeof(PlayerRasterHeader));
nuPiReadRom(SpriteDataHeader[0] + PlayerRasterHeader.indexRanges, PlayerSpriteRasterSets, sizeof(PlayerSpriteRasterSets));
}
Splat refactor (#257) * all non-world rodata migrated * data disasm * kinda working * updated yaml * bloop * linker header * configure 2.0 * bin * mass rename to remove code_ * pause rename * battle partner stuff * whew * more renames * more renames * more renaming * it builds! * updates * remove main prefix * one more thing * crc, yay0 * .data, .rodata, .bss * img * dead_atan2 * it buildsgit add -A * split battle/partner/6FAD10 * rm &s on sleepy_sheep syms * sha1sum ninja rule description * OK but commented out PaperMarioMapFS and PaperMarioNpcSprites * uncomment * fix mapfs * match func_8003CFB4 * . * clean up and name npc_iter_no_op * npc.c * enable cc warnings * name npc_find_near * use singular options.asset_path * smores * cc_dsl only when needed * kinda fix configure for splat refactor2 * ok! * new msg format * remove old msg format docs * slight bug fixes, splat adjustment * git subrepo pull (merge) --force tools/splat subrepo: subdir: "tools/splat" merged: "cfc140bb76" upstream: origin: "https://github.com/ethteck/splat.git" branch: "master" commit: "cfc140bb76" git-subrepo: version: "0.4.3" origin: "https://github.com/ingydotnet/git-subrepo" commit: "2f68596" * git subrepo pull (merge) --force tools/splat subrepo: subdir: "tools/splat" merged: "85349befcd" upstream: origin: "https://github.com/ethteck/splat.git" branch: "master" commit: "85349befcd" git-subrepo: version: "0.4.3" origin: "https://github.com/ingydotnet/git-subrepo" commit: "2f68596" * Update symbol addrs * git subrepo pull tools/splat subrepo: subdir: "tools/splat" merged: "a44631e194" upstream: origin: "https://github.com/ethteck/splat.git" branch: "master" commit: "a44631e194" git-subrepo: version: "0.4.3" origin: "https://github.com/ingydotnet/git-subrepo" commit: "2f68596" Co-authored-by: Alex Bates <hi@imalex.xyz>
2021-04-13 09:47:52 +02:00
IMG_PTR spr_get_player_raster(s32 rasterIndex, s32 playerSpriteID) {
PlayerSpriteCacheEntry* cacheEntry;
u32 playerRasterInfo;
s32 idx = -1;
s32 i;
for (i = 0; i < PlayerRasterCacheSize; i++) {
if (PlayerRasterCache[i].lazyDeleteTime != 0) {
if (PlayerRasterCache[i].rasterIndex == rasterIndex && PlayerRasterCache[i].spriteIndex == playerSpriteID) {
PlayerRasterCache[i].lazyDeleteTime = 2;
return PlayerRasterCache[i].raster;
}
} else if (idx == -1) {
idx = i;
}
}
if (idx == -1) {
return NULL;
}
cacheEntry = &PlayerRasterCache[idx];
cacheEntry->rasterIndex = rasterIndex;
cacheEntry->spriteIndex = playerSpriteID;
cacheEntry->lazyDeleteTime = 2;
// each player raster load descriptor has image size (in bytes) and relative offset packed into one word
// upper three nibbles give size / 16, lower 5 give offset
playerRasterInfo = PlayerRasterLoadDesc[PlayerRasterLoadDescBeginSpriteIndex[playerSpriteID] + rasterIndex];
nuPiReadRom(SpriteDataHeader[0] + (playerRasterInfo & 0xFFFFF), cacheEntry->raster, (playerRasterInfo >> 0x10) & 0xFFF0);
return cacheEntry->raster;
}
Splat refactor (#257) * all non-world rodata migrated * data disasm * kinda working * updated yaml * bloop * linker header * configure 2.0 * bin * mass rename to remove code_ * pause rename * battle partner stuff * whew * more renames * more renames * more renaming * it builds! * updates * remove main prefix * one more thing * crc, yay0 * .data, .rodata, .bss * img * dead_atan2 * it buildsgit add -A * split battle/partner/6FAD10 * rm &s on sleepy_sheep syms * sha1sum ninja rule description * OK but commented out PaperMarioMapFS and PaperMarioNpcSprites * uncomment * fix mapfs * match func_8003CFB4 * . * clean up and name npc_iter_no_op * npc.c * enable cc warnings * name npc_find_near * use singular options.asset_path * smores * cc_dsl only when needed * kinda fix configure for splat refactor2 * ok! * new msg format * remove old msg format docs * slight bug fixes, splat adjustment * git subrepo pull (merge) --force tools/splat subrepo: subdir: "tools/splat" merged: "cfc140bb76" upstream: origin: "https://github.com/ethteck/splat.git" branch: "master" commit: "cfc140bb76" git-subrepo: version: "0.4.3" origin: "https://github.com/ingydotnet/git-subrepo" commit: "2f68596" * git subrepo pull (merge) --force tools/splat subrepo: subdir: "tools/splat" merged: "85349befcd" upstream: origin: "https://github.com/ethteck/splat.git" branch: "master" commit: "85349befcd" git-subrepo: version: "0.4.3" origin: "https://github.com/ingydotnet/git-subrepo" commit: "2f68596" * Update symbol addrs * git subrepo pull tools/splat subrepo: subdir: "tools/splat" merged: "a44631e194" upstream: origin: "https://github.com/ethteck/splat.git" branch: "master" commit: "a44631e194" git-subrepo: version: "0.4.3" origin: "https://github.com/ingydotnet/git-subrepo" commit: "2f68596" Co-authored-by: Alex Bates <hi@imalex.xyz>
2021-04-13 09:47:52 +02:00
void spr_update_player_raster_cache(void) {
s32 i;
func_8013A4D0();
for (i = 0; i < PlayerRasterCacheSize; i++) {
if (PlayerRasterCache[i].lazyDeleteTime != 0) {
PlayerRasterCache[i].lazyDeleteTime--;
}
}
}
Splat refactor (#257) * all non-world rodata migrated * data disasm * kinda working * updated yaml * bloop * linker header * configure 2.0 * bin * mass rename to remove code_ * pause rename * battle partner stuff * whew * more renames * more renames * more renaming * it builds! * updates * remove main prefix * one more thing * crc, yay0 * .data, .rodata, .bss * img * dead_atan2 * it buildsgit add -A * split battle/partner/6FAD10 * rm &s on sleepy_sheep syms * sha1sum ninja rule description * OK but commented out PaperMarioMapFS and PaperMarioNpcSprites * uncomment * fix mapfs * match func_8003CFB4 * . * clean up and name npc_iter_no_op * npc.c * enable cc warnings * name npc_find_near * use singular options.asset_path * smores * cc_dsl only when needed * kinda fix configure for splat refactor2 * ok! * new msg format * remove old msg format docs * slight bug fixes, splat adjustment * git subrepo pull (merge) --force tools/splat subrepo: subdir: "tools/splat" merged: "cfc140bb76" upstream: origin: "https://github.com/ethteck/splat.git" branch: "master" commit: "cfc140bb76" git-subrepo: version: "0.4.3" origin: "https://github.com/ingydotnet/git-subrepo" commit: "2f68596" * git subrepo pull (merge) --force tools/splat subrepo: subdir: "tools/splat" merged: "85349befcd" upstream: origin: "https://github.com/ethteck/splat.git" branch: "master" commit: "85349befcd" git-subrepo: version: "0.4.3" origin: "https://github.com/ingydotnet/git-subrepo" commit: "2f68596" * Update symbol addrs * git subrepo pull tools/splat subrepo: subdir: "tools/splat" merged: "a44631e194" upstream: origin: "https://github.com/ethteck/splat.git" branch: "master" commit: "a44631e194" git-subrepo: version: "0.4.3" origin: "https://github.com/ingydotnet/git-subrepo" commit: "2f68596" Co-authored-by: Alex Bates <hi@imalex.xyz>
2021-04-13 09:47:52 +02:00
void spr_load_npc_extra_anims(SpriteAnimData* header, u32* extraAnimList) {
u8* src;
s32 imgID;
s32 rasterSize;
s32 remaining;
u16 animCmd;
u16* cmdList;
u32 extraAnimID;
u8* dataPos;
void* copyEnd;
SpriteAnimComponent* comp;
SpriteAnimComponent** compList;
void* writePos;
SpriteRasterCacheEntry** rasterList;
SpriteRasterCacheEntry* raster;
u16** oldPalList;
u16* palette;
// one extra required for 'done' sentinel
s32 sawRaster[100 + 1];
s32 i;
for (i = 0; i < ARRAY_COUNT(sawRaster) - 1; i++) {
sawRaster[i] = FALSE;
}
while ((extraAnimID = *extraAnimList++) != -1) {
compList = header->animListStart[extraAnimID & 0xFF];
while ((comp = *compList++) != PTR_LIST_END) {
cmdList = comp->cmdList;
remaining = (s16) comp->cmdListSize / 2;
while (remaining > 0) {
animCmd = *cmdList++;
remaining--;
switch (animCmd & 0xF000) {
case 0x1000:
i = animCmd; // required to match
imgID = i & 0xFF;
if (imgID < ARRAY_COUNT(sawRaster) - 1) {
sawRaster[imgID] = TRUE;
}
break;
case 0x3000:
cmdList++;
remaining--;
// fallthrough
case 0x4000:
cmdList++;
remaining--;
// fallthrough
case 0x7000:
case 0x5000:
cmdList++;
remaining--;
// fallthrough
case 0x0000:
case 0x2000:
case 0x6000:
case 0x8000:
break;
}
}
}
}
rasterList = header->rastersOffset;
raster = *rasterList;
dataPos = raster->image;
for (i = 0; i < ARRAY_COUNT(sawRaster) - 1; i++) {
if ((raster = *rasterList) == PTR_LIST_END) {
break;
}
if (sawRaster[i]) {
src = raster->image;
rasterSize = (raster->width * raster->height) / 2;
copyEnd = &dataPos[rasterSize];
rasterSize += 8;
if (dataPos != src) {
raster->image = dataPos;
bcopy(src, dataPos, rasterSize);
}
*rasterList = copyEnd;
dataPos += rasterSize;
}
rasterList++;
}
// sentinel value to mark end of valid data
sawRaster[i] = TRUE;
writePos = dataPos;
// copy raster list
rasterList = header->rastersOffset;
header->rastersOffset = writePos;
for (i = 0; i < ARRAY_COUNT(sawRaster) - 1; i++) {
raster = *rasterList++;
if (sawRaster[i]) {
*(SpriteRasterCacheEntry**) writePos = raster;
} else {
*(SpriteRasterCacheEntry**) writePos = (SpriteRasterCacheEntry*) copyEnd;
}
writePos += 4;
if (raster == PTR_LIST_END) {
break;
}
}
// copy palette list
oldPalList = header->palettesOffset;
header->palettesOffset = writePos;
for (i = 0; i < ARRAY_COUNT(sawRaster) - 1; i++) {
raster = (SpriteRasterCacheEntry*)*oldPalList++; // required to match
*(u16**)writePos = (u16*)raster;
writePos += 4;
if (raster == PTR_LIST_END) {
break;
}
}
Modern gcc + shiftability work (#942) * wip changes for modern gcc * more * wip * blah * Define explicit size for symbol * Clean up evt_handle_exec1 * wip * . * fixes & VLA macro * VLA innit * wipz * Fix potential UB * meowp * meowp2 * fixies * git subrepo pull --force tools/splat subrepo: subdir: "tools/splat" merged: "e1f0b17917" upstream: origin: "https://github.com/ethteck/splat.git" branch: "master" commit: "e1f0b17917" git-subrepo: version: "0.4.5" origin: "https://github.com/ingydotnet/git-subrepo" commit: "aa416e4" * fixules * git subrepo pull --force tools/splat subrepo: subdir: "tools/splat" merged: "3ba3277e57" upstream: origin: "https://github.com/ethteck/splat.git" branch: "master" commit: "3ba3277e57" git-subrepo: version: "0.4.5" origin: "https://github.com/ingydotnet/git-subrepo" commit: "aa416e4" * more shiftability + symbols work * git subrepo pull --force tools/splat subrepo: subdir: "tools/splat" merged: "02879e52a7" upstream: origin: "https://github.com/ethteck/splat.git" branch: "master" commit: "02879e52a7" git-subrepo: version: "0.4.5" origin: "https://github.com/ingydotnet/git-subrepo" commit: "aa416e4" * more * revert bss changes for now, new heaps overlay for aligning stuff to 0x1000 (not sure how necessary that is, so maybe will revert later on) * 'fixing' jp shift build * more * more syms * more progress * more * ididid * git subrepo pull --force tools/splat subrepo: subdir: "tools/splat" merged: "de54da38f5" upstream: origin: "https://github.com/ethteck/splat.git" branch: "master" commit: "de54da38f5" git-subrepo: version: "0.4.5" origin: "https://github.com/ingydotnet/git-subrepo" commit: "aa416e4" * git subrepo pull --force tools/splat subrepo: subdir: "tools/splat" merged: "a27dc436a6" upstream: origin: "https://github.com/ethteck/splat.git" branch: "master" commit: "a27dc436a6" git-subrepo: version: "0.4.5" origin: "https://github.com/ingydotnet/git-subrepo" commit: "aa416e4" * blah * stuff's broken, but at least it's maybe cleaner * modern gcc back * revert * shifting all overlays - works so far * progs * another * modern gcc flag, re-enabled all ifdef shift stuff * fixies * progress * fixes, matching build * heaps3 overlay and some symbol names * changies * PR comments & cleanup
2023-02-14 14:14:14 +01:00
_heap_realloc(&heap_spriteHead, header, (s32)writePos - (s32)header);
}
SpriteComponent** spr_allocate_components(s32 count) {
s32 listSize;
SpriteComponent** listStart;
SpriteComponent* component;
SpriteComponent** listPos;
u32 totalSize;
s32 i;
// data will contain a -1 terminated list, followed by the SpriteComponents
// corresponding to that list
listSize = (count + 1) * 4;
totalSize = (count * sizeof(SpriteComponent)) + listSize;
if (spr_allocateBtlComponentsOnWorldHeap) {
listStart = _heap_malloc(&heap_generalHead, totalSize);
listPos = listStart;
component = (SpriteComponent*) listPos;
} else {
Modern gcc + shiftability work (#942) * wip changes for modern gcc * more * wip * blah * Define explicit size for symbol * Clean up evt_handle_exec1 * wip * . * fixes & VLA macro * VLA innit * wipz * Fix potential UB * meowp * meowp2 * fixies * git subrepo pull --force tools/splat subrepo: subdir: "tools/splat" merged: "e1f0b17917" upstream: origin: "https://github.com/ethteck/splat.git" branch: "master" commit: "e1f0b17917" git-subrepo: version: "0.4.5" origin: "https://github.com/ingydotnet/git-subrepo" commit: "aa416e4" * fixules * git subrepo pull --force tools/splat subrepo: subdir: "tools/splat" merged: "3ba3277e57" upstream: origin: "https://github.com/ethteck/splat.git" branch: "master" commit: "3ba3277e57" git-subrepo: version: "0.4.5" origin: "https://github.com/ingydotnet/git-subrepo" commit: "aa416e4" * more shiftability + symbols work * git subrepo pull --force tools/splat subrepo: subdir: "tools/splat" merged: "02879e52a7" upstream: origin: "https://github.com/ethteck/splat.git" branch: "master" commit: "02879e52a7" git-subrepo: version: "0.4.5" origin: "https://github.com/ingydotnet/git-subrepo" commit: "aa416e4" * more * revert bss changes for now, new heaps overlay for aligning stuff to 0x1000 (not sure how necessary that is, so maybe will revert later on) * 'fixing' jp shift build * more * more syms * more progress * more * ididid * git subrepo pull --force tools/splat subrepo: subdir: "tools/splat" merged: "de54da38f5" upstream: origin: "https://github.com/ethteck/splat.git" branch: "master" commit: "de54da38f5" git-subrepo: version: "0.4.5" origin: "https://github.com/ingydotnet/git-subrepo" commit: "aa416e4" * git subrepo pull --force tools/splat subrepo: subdir: "tools/splat" merged: "a27dc436a6" upstream: origin: "https://github.com/ethteck/splat.git" branch: "master" commit: "a27dc436a6" git-subrepo: version: "0.4.5" origin: "https://github.com/ingydotnet/git-subrepo" commit: "aa416e4" * blah * stuff's broken, but at least it's maybe cleaner * modern gcc back * revert * shifting all overlays - works so far * progs * another * modern gcc flag, re-enabled all ifdef shift stuff * fixies * progress * fixes, matching build * heaps3 overlay and some symbol names * changies * PR comments & cleanup
2023-02-14 14:14:14 +01:00
listStart = _heap_malloc(&heap_spriteHead, totalSize);
listPos = listStart;
component = (SpriteComponent*) listPos;
}
component = (SpriteComponent*)((s32)(component) + (listSize / 4) * 4);
// fill list values
for (i = 0; i < count; i++) {
*listPos++ = component;
component++;
}
*listPos = PTR_LIST_END;
return listStart;
}