Kirby 64: The Crystal Shards

From en64 wiki
Jump to: navigation, search

Shygoo's GitHub repo:

  • A basic web-based model viewer
  • An awful web-based Collada DAE to Kirby64 geometry converter
  • Notes on various structures in ROM/RAM
  • Debugger script for Project64
  • Debugger symbol file for Project64 (N64 SDK function addresses)
  • A patch for analog stick support
  • Most notes seen here

OS and Audio Functions

0x8012d2f0,osSendMesg
0x8012d440,osStopThread
0x8012d500,osRecvMesg
0x8012d640,osSetIntMask
0x8012d6e0,__sinf/fsin/sinf
0x8012dca0,__ull_rshift
0x8012dccc,__ull_rem
0x8012dd08,__ull_div
0x8012dd44,__ll_lshift
0x8012dd70,__ll_rem
0x8012ddac,__ll_div
0x8012de08,__ll_mul
0x8012de38,__ull_divremi
0x8012de98,__ll_mod
0x8012df34,__ll_rshift
0x8012e870,__osDequeueThread
0x8012e8b0,bzero/_bzero/blkclr/_blkclr
0x8012fbe0,osCreateThread
0x8012ffa0,osVirtualToPhysical
0x80130020,osWritebackDCache
0x80130330,osPiRawReadIo
0x801303f0,__osSetSR
0x80130400,__osGetSR
0x80130450,__osSpRawStartDma
0x801305e0,osViBlack
0x80130650,__osSpRawReadIo
0x80130650,__osSiRawReadIo
0x801306a0,osSpTaskYield
0x80130d80,osViSetMode
0x80131410,__osProbeTLB
0x801314d0,osGetCount
0x801329d0,osPiRawStartDma
0x80132ab0,osSetEventMesg
0x80132b20,sqrtf
0x80132b50,osContStartQuery
0x80132bd4,osContGetQuery
0x801338c0,osEPiStartDma
0x80133a40,memcpy
0x80133a6c,strlen
0x80133a94,strchr
0x80133ae0,osCreateMesgQueue
0x80133b10,osInvalICache
0x80133b90,osInvalDCache
0x80133d30,__osSpDeviceBusy
0x80133d60,__osSiDeviceBusy
0x80133d90,osJamMesg
0x80133ee0,osSetThreadPri
0x80133fc0,osGetThreadPri
0x80133fe0,osViSwapBuffer
0x80134030,guMtxXFMF
0x801340d0,guMtxCatF
0x80134470,osSpTaskYielded
0x801344f0,bcmp/_bcmp
0x80134610,osGetTime
0x80134aa0,__osSetGlobalIntMask
0x80134af0,osAiSetFrequency
0x80134c50,guNormalize
0x80134ce0,__osSetCompare
0x80134d00,bcopy/_bcopy
0x80135010,alCopy
0x80135090,__osResetGlobalIntMask
0x80135360,__osDisableInt
0x80135380,__osRestoreInt
0x801357e0,osPiGetCmdQueue
0x80135810,__cosf/fcos/cosf
0x80135980,osSetTime
0x801359b0,osViSetEvent
0x80135d20,__osSetFpcCsr
0x80138ca0,osWritebackDCacheAll
0x80138cd0,osStartThread
0x80138e20,osViSetYScale
0x80138f30,__osAiDeviceBusy
0x801391f0,__osSpSetPc
0x8013fbac,__osThreadTail
0x8013fbb4,__osRunQueue
0x8013fbb8,__osActiveQueue
0x8013fbbc,__osRunningThread
0x8013fbc0,__osFaultedThread
0x8013fc60,osViModeNtscLan1
0x8013fcb0,osViModeMpalLan1
0x80141a30,__osRcpImTable
0x80141cc0,__libm_qnan_f

.blank Notes

Region (U)

Audio stuff

00250320 audio sequence table

800909B3 Music Modifier

80096480

Stage stuff

800D5E00 stage text



800F78B8 load next section of level




800D6B9C level to load?



800E9FE0 level selection?

800BE4F0 current screen?
800A3820 asm for next screen


800D1F98



800BE500 current world
800BE504 current stage



800D1F98 level table
0007A1E8 ROM

800D1D10 G63 M6MIRACLE
800D1E30 ABE200
800D1E54 ABE100
800D1E9C EXERCISE01
800D1EE4 ENETEST1
800D1F08 ENETEST2
800D1F2C ITEM01
800D1F50 BREAKTEST1



Format

aaaabbbb ccccdddd eeeeffff
gggghhhh iiiijjjj kkkkllll
zzzzzzzz

aa = model bank? uses table at 800D00C4
bb = level model
gg = collision bank? uses table at 800D0184
hh = collision model/object data? uses table at 800CFCE0
zz = Level Name RAM Pointer


Kirby model numbers:
07 Kirby
08 Kirby Inhaling
09 Fat Kirby
0A Kirby Burning
0B Stone Kirby
0C Stone Kirby Ball
0D Freezing Kirby
61 Waddle Dee
6C Dedede
70 Adeliene


00076490 level model table?

0128E780 First Level Model





00077F38 texture table for 01D28720


802F4A10 level 1 level map info

xxxxxxxx yyyyyyyy zzzzzzzz


zz = objects



802F6670 level 1 map objects

2C long?

aabbccdd eeeeffff xxxxxxxx yyyyyyyy
zzzzzzzz pppppppp qqqqqqqq rrrrrrrr
jjjjjjjj kkkkkkkk llllllll


bb = object type?
  00 = enemy
  03 = item/object
cc = object
dd = variable

99999999 to end map object list

Enemy list

00 N-Z
01 Rocky
02 Bronto Burt
03 Skud
04 Gordo
05 Shotzo
06 Spark-i
07 Bouncy
08 Glunk

48 Mopoo
49 Zebon

Item list

00 Maxim Tomato
01 Sandwich
02 Cake
03 Meat
04 Popsicle
05 Invincibility
06 Yellow Star
07 Blue Star
08 Crystal Shard (crashes game)
09 1-Up
0A Mat you jump on (crashes game)
0B Dandelion
0C Fish
0D Butterfly

Enemy stuff

800FCC24
800FCD48
800FCAC4 asm to load enemy



800E77DC where fire enemy gets stored when walked by


801c29c0 enemy object table?

801C3EB4 fire enemy's shit?


00074F10 unknown table





00074A10 table for 011291B0?


0006C8F0 unknown table


Region (J)

Screen, model, animation, level stuff

800BCF93 Current screen

800d4564 table for asm of screens



8012CEF4 actions?


800A8DB0


800481F2 load button press


8016B648 asm set kirby's standing animation S3,S2


8012CEF4


800A8754 asm load animation table?

800A9960



800C6B04 animation table?
0006EDC8 ROM

801950E0 action table
000F5C00 ROM


80150DAC
80150760

80150500

000D4450

800D09C4 RAM
00078C88 Level Table


80007C18 load ram pointer when inhaling


800D5B7C p1 character multiplayer


8018CE98

80185D94 multiplayer models
80158FA8 models to load in level select


8016A8A0 Load Kirby Model
8016A800 function


800cebe6 level type?
80127588 table for level types

0006E590 object model table

07 Kirby
61 Waddle Dee
6C Dedede
70 Adeleine



800D6A58 where model pointers get written in RAM



80227BA4



8012CEF0 all of kirby's stuff?


800DECB3 Kirby's Current Model


8014FC6C asm to load title screen
8014FE70 JAL to write Kirby to Title Screen
8014FD78 JAL to write Waddle Dee to title Screen
8014FEE8 JAL to write Dedede to title Screen
8014FDF4 JAL to write Adeleine to title screen
8014FF54 asm to load fairy

8014FEC0 ASM Set Kirby's Animation 02DD
8014FDC8 ASM Set Waddl Dee's Animation
8014FF38 ASM Set Dedede's animations


80154AE0 set waddle dee running animation?

8015ABB0 asm for each character in title screen
001021D0 ROM




000D554B current song playing

Actions

800DC9B0 current action + 2

00 Standing
01 Walking
02 Running
03 Jumping
04 Landing
05 Falling
06 Landing
07 Landing
08 Crouching
09
0A Going underneath platform
0B Floating
12 Toss Star Upwards
16 Sucking in Air
18 Blow out air
19 Toss Star Forwards
21 Burning
22 Stone
23 Ice
24 Needle
25 Bombsss
26 Spark
27 Cutter
28 Super Fireball (Burning + Burning)
29 Volcano (Burning + Stone)
2A Melting Ice Block (Burning + Ice)
2B Flaming Arrow (Burning + Needle)
2C Fireworks (Burning + Bomb)
2D Giant Stone Kirby (Stone + Stone)
2E Drill (Stone +Needle)
2F Dynamite (Stone + Bomb)
30 Curling Stone (Stone + Ice)
31 Giant Spiny Snowflake (Ice + Needle)
32 Explosive Snowman (Ice + Bomb)
33 Refrigerator Kirby (Ice + Spark)
34 Rolling Snowbal (Ice + Ice)
35 Swiss Army Kirby (Needle + Needle)
36 Spike Bomb (Needle + Bomb)
37 Tri-Missile Attack (Bomb + Bomb)
38 Match (Spark + Burning)
39 Lightning Boulder (Spark + Stone)
3A Lightning Rod (Spark + Needle)
3B Light Bulb (Spark + Bomb)
3C Super Electric Energy Field (Spark + Spark)
3D Sword of Fire (Cutter + Burning)
3E Animal Statue (Cutter + Stone)
3F Ice Skating (Cutter + Ice)
40 Giant Claws (Cutter + Needle)
41 Explosive Ninja Star (Cutter + Bomb)
42 Double-Bladed Laser Sword (Cutter + Spark)
43 Super Boomerang (Cutter + Cutter)
44 Standing (can't Move)
45 Running
46 Grabbing Crystal Shard
47 Walking

Shygoo's notes

ROM hacking doc
shygoo 2017

ROM/RAM Misc.

     ROM      RAM      Description
CODE -------- 80034240 DMA subroutine
     -------- 800A8BAC img_id_to_virtual (A0 = img_id_pair)
DATA -------- 800DF4D0 Holds pointer to segment 04
     -------- 800EC9F8 EEPROM Mirror A
	 -------- 800ECBB0 EEPROM Mirror B
CODE -------- 800FC9C0 spawn_entity (A0 = ??, A1 = struct entity*, A2 = ??)
     00042D28 -------- "RSP Gfx ucode F3DEX fifo 2.04H Yoshitaka Yasumoto 1998 Nintendo"
	 00076498 -------- Table of geometry block start/end ROM address pairs
     00076B2C -------- "Bank 7" offset list
	 00077CD4 -------- Another offset list
	 000783F4 -------- Main stage table
	 007DFA70 803448C0 Kirby character vertex data 
     -------- 80346A00 Kirby character microcode
     -------- 80348240 Kirby texture
     0128E770 80349F50 Stage 1-1 Area 0 geometry block
	 01BD5C80 -------- "Bank 7"; contains images for level geometry
	 01CE5A2A -------- Last resource in "Bank 7"
     01D43468 802F4A10 State 1-1 Area 0 settings block (0x2058 bytes)

Main stage table

The table at 000783F4 (800D01A4) controls how each area of a stage is loaded.
For each stage there is an array of area structs. Each list is terminated with an empty struct.

Area structure

  0x00: list_index geo_block_a  List-index of primary Geometry block
  0x04: list_index geo_block_b  List-index of secondary Geometry block
  0x08: u16        skybox_id    Skybox ID
  0x0A: ??
  0x0C: int        music_id     Music ID
  0x10: bank_index level_block  Bank-index of Level settings block 
  0x14: ??
  0x16: ??                      (0009 plays cutscene and crashes)
  0x18: bank_index dust_block   Bank-index of Dust particle settings
  0x1C: bank_index dust_img     Bank-index of Dust particle image
  0x20: char*      area_name    Pointer to dev ASCII level name
  
  See Resource addressing systems for details on bank_index and list_index.

Geometry block

When a level starts, the entire block is loaded into segment 04.
A table exists at 00076498 with the start and end addresses of each block.
There are multiple lists in ROM that consist of start-end address pairs of the geometry blocks:

Block structure

   1. Header
   2. Vertices
   3. Microcode
   4. G_SETTIMG references
   5. G_VTX references
   6. Entry point groups (Optional)
   7. Layout
   8. Texture scroll settings (Optional)
   9. Unknown2 (Optional)

Header

The header is 32 bytes in size and references assets within the block.
On load, all segptrs in the header are converted to virtual addresses in-place.

   0x00: segptr layout           Points to the Layout section
   0x04: segptr tex_scroll       Points to the Texture scroll section (Optional)
   0x08: int    rendering_mode   Determines how the Layout section is interpreted
   0x0C: segptr img_refs         Points to the G_SETTIMG reference list
   0x10: segptr vtx_refs         Points to the G_VTX reference list
   0x14: int    n_unknown2       Number of entries in the Unknown2 section
   0x18: segptr unknown2         Points the the Unknown2 section (Optional)
   0x1C: int    ??
   
   b_have_unknown2 checked by code @ 800A9424, 800F6F3C, 800F7110
   0x1C *4|1, passed to 0x800A8358
   unknown2 last 12 bytes of the file? (optional field?)
   rendering_mode is index of the subroutine table at 0x800D4F10, called every frame

Vertices

16 bytes each, stored buffer-ready:

   0x00: s16 Vx
   0x02: s16 Vy
   0x04: s16 Vz
   0x06: u16 unused
   0x08: s16 U
   0x0A: s16 V
   0x0C: u8  R
   0x0D: u8  G
   0x0E: u8  B
   0x0F: u8  A

Microcode

All G_SETTIMG addresses for level geometry are stored as bank-indeces.
On load, each bank-index is converted to a virtual address in-place.
[When reading the addresses, if the resource is not in memory, the game loads it?]
All G_VTX addresses are segptrs referencing vertices within the block.


If texture scroll settings are used, there will be jumps to segment 0x0E (Texture scroll settings).

G_SETTIMG reference list

Zero-terminated list of segptrs, all pointing to microcode beginning with G_SETTIMG (0xFD) commands.
[Used to fill in the virtual addresses?]
If there are no images, there will still be a pointer in the header, but the list will just consist of a single 0x00000000.

G_VTX reference list

Zero-terminated list of segptrs, all pointing to microcode beginning with G_VTX (0x01) commands.

Entry point groups

(Optional section for rendering modes 0x18, ....)

Groups display lists together with lists of segptrs to their entry points. Each struct is 8 bytes in size:

   0x00: int    command
   0x04: segptr entry_point
   

The command field seems to be:

00000000: Start group
   00000001: Continue group
   00000004: End group (entry_point will be NULL)

Layout

The interpretation of this section depends on the rendering mode defined in the header.

The following modes are used for the stages and characters:

   
    0x13: ?
    0x14: List of entry points?
    0x17: List of entry points with matrices
    0x18: List of groups with matrices
    0x1B: ? only on dev level
    0x1C: ? only on dev level

Mode 0x14:

Zero-terminated list of segptrs to microcode entry points.
All elements will be placed without changes to position, rotation, or scaling.

    Mode 0x17:                  |  Mode 0x18:
                                |   
     0x00: int    command?      |   0x00: int    command?
     0x04: segptr entry_point   |   0x04: segptr group
     0x08: float  x_translation |   0x08: float  x_translation
     0x0C: float  y_translation |   0x0C: float  y_translation
     0x10: float  z_translation |   0x10: float  z_translation
     0x14: float  x_rotation    |   0x14: float  x_rotation
     0x18: float  y_rotation    |   0x18: float  y_rotation
     0x1C: float  z_rotation    |   0x1C: float  z_rotation
     0x20: float  x_scale       |   0x20: float  x_scale
     0x24: float  y_scale       |   0x24: float  y_scale
     0x28: float  z_scale       |   0x28: float  z_scale

It seems if entry_point_list is NULL, the settings are multipliers for following matrices.

	For mode 0x17 and 0x18, command 0x12 seems to terminate the list.
    (Seen command values = 00000000 (always first), 00000001, 00000002, 00000012, 00060000)

Texture scroll settings

(Optional section)

Inserts G_DL branches and dynamic G_SETTILESIZE commands into segment 0x0E for texture scrolling.

Structure

   
   1. Header 0x20 (32) bytes
   2. Big structs 0x78 (120) bytes each
   3. List A?
   4. List B?
   
   The header and lists are followed by 0x99999999, maybe an end-marker
   
   1. Header
    ....?
    0x0C: segptr to segptr list A
    0x10: segptr to segptr list B
    ....?
	
   2. Big structs
   
   3/4. List A/B
   
    Zero-terminated list of segptrs, all pointing to Big structs

Unknown2

(Optional section)

One or more bank-index pairs? Count is determined by the header's n_unknown2 field.

Level settings block

The level settings block controls the camera, collisions,
Basic structure

   1. Header
   2. Unknown1
   3. Unknown2
   3. Secondary header?
   4. Entity List

Header

   0x00: u32 Offset to unknown 2
   0x04: u32 Offset of secondary header (collisions/camera)
   0x08: u32 Offset of Entity list

When the entity block is loaded, the offsets are converted to virtual addresses in-place.

Entity list

Each entity struct is 0x2C (44) bytes in size and contains information like type, position, and scale:

   0x00: u8 ?
   0x01: u8 ?
   0x02: u8 entity_id
   0x04: u8 ?
   0x05: u8 ?
   0x06: u16 ?
   ....: ?
   0x20: float scale
   0x24: x position
   ....

See kirby-entity-ids.txt for a list of entity IDs.
The subroutine at 800FC9C0 ("spawn_entity") is used to spawn individual entities when Kirby is within range.
There is a 4-byte end marker 0x99999999 at the end of the list.

Particle settings block

Determines how dust particles move around in a level.

Structure
1. Number of particles
2. Particle offset list
3. Particle settings


Variable-length structures? (The floats seem to control the speed of the particles)

Resource addressing systems

A few different addressing systems are used to reference and load resources from ROM.

Bank-index addressing

[AA AA] [BB BB]
   A = Bank number, selects bank ROM address
   B = Index, selects bank offset
   (Index+1 is used to calculate the size of the resource.)


Misc banks
(Level settings, particle images, ...)
The function at 800A9AA8 is used to load the resource and return its RAM address. (800D0184 table of pointers to offset lists?)

   Bank  Address  Offsets
   0000  004F3290 0006CA0C
   0001  007BACA0 0006FA64
   0002  00964660 000712D0
   0003  00BD6DB0 000730C4
   0007  01D28720 00077F30

Image banks
Bank-indeces for images are used for addresses for G_SETTIMG commands in display lists.
The function at 800A8BAC is used to load the resource and return its RAM address.

   Bank Address  Offsets
   0000
   0001 005B5360 0006D1E4
   0002 00858740
   0003 009D8CB0 000D9268
   0005 011291B0 00074A0C
   0007 01BD5C80 00076B28


List-index addressing
(geometry blocks only?)

[AA AA] [BB BB]
   A = List number, selects the list
   B = Index, selects the ROM start-end address pair from the list

Geometry block list
There are multiple lists of ROM start-end address pairs for geometry blocks.
The function at 800A9864 is used to load the resource and return its RAM address.

<br

   List Addresses Description
   0000 0006C8F0
   0001 0006CA44
   0002 0006FA94
   0003 00071300
   ....
   0007 00076490  Level geometry

EEPROM

===Structure===
EEPROM is 0x118 bytes. Software mirrors of it are kept at 0x800EC9F8 and 0x800ECBB0 in RAM.<br>
*It consists of a header and three files.
*Each section is ended with a checksum.<br>
The checksum is generated by adding 0x97538642 to the sum of all words in a section. (Routine 0x800B8F34)
 <pre>
 0x00 Header
 0x10 File 1
 0x68 File 2
 0xC0 File 3

Header
Header is 0x10 bytes
Offset 0x0C checksum

Files
Three files, 0x58 bytes each
File+0x18 u16 minigame jumping record

36.6 = 1310
32.84 = 988

File+0x54 is a checksum
Checksum is generated by adding the sum of all words in file to const 0x97538642 (Routine 0x800B8F34)

Entity IDs

shygoo 2017
 
For names:
 http://strategywiki.org/wiki/Kirby_64:_The_Crystal_Shards/Enemies
 http://kirby.wikia.com/wiki/Enemy_Info_Card


 00 00 N-Z
 00 01 Rocky
 00 02 Bronto Burt
 00 03 Skud
 00 04 Gordo
 00 05 Shotzo
 00 06 Spark-i
 00 07 Bouncy
 00 08 Glunk
 00 09 [?? explodes]
 00 0A Chilly
 00 0B Propeller
 00 0C Glom
 00 0D Mahall
 00 0E Poppy Bros. Jr.
 00 0F Bivolt
 00 10 Splinter
 00 11 Gobblin
 00 12 Kany
 00 13 Bivolt again?
 00 14 Sirkibble
 00 15 Gabon
 00 16 Mariel
 00 17 Large I3
 00 18 Snipper
 00 19 [?? explodes again?]
 00 1A Bonehead
 00 1B Squibbly
 00 1C Bobo
 00 1D Bo
 00 1E Punc
 00 1F Mite
 00 20 Sandman
 00 21 Flopper
 00 22 Kapar
 00 23 Maw
 00 24 Drop
 00 25 Pedo
 00 26 Noo
 00 27 Tick
 00 28 Cairn
 00 29 [?? invisible]
 00 2A Pompey
 00 2B Hack
 00 2C Burnis
 00 2D Fishbone
 00 2E Frigis
 00 2F Sawyer
 00 30 Turbite
 00 31 Plugg
 00 32 Ghost knight
 00 33 Zoos
 00 34 Kakti
 00 35 Rockn
 00 36 Chacha
 00 37 Galbo
 00 38 Bumber
 00 39 Scarfy
 00 3A Nruff
 00 3B Emp
 00 3C Magoo
 00 3D Yariko
 00 3E invisible?
 00 3F Wall Shotzo
 00 40 Keke
 00 41 Sparky
 00 42 Ignus // falling rocks
 00 43 Flora
 00 44 Putt
 00 45 Pteran
 00 46 Mumbies
 00 47 Pupa
 00 48 Mopoo
 00 49 Zebon
 00 4A [invisible?]
 00 4B [falling rocks sometimes blue]
 00 4C [falling rocks sometimes blue bigger?]

 01 00 Waddle Dee Boss
 01 01 Ado Boss
 01 02 DeeDeeDee Boss
 
 02 00 Whispy Woods
 02 01 Waddle Dee (Boss)
 
 03 00 Maxim Tomato
 03 01 Sandwich
 03 02 Cake
 03 03 Steak
 03 04 Ice Cream Bar
 03 05 Invinsible Candy
 03 06 Yellow Star
 03 07 Blue Star
 03 08 [crashes]
 03 09 1up
 03 0A [crashes] // used in picnic area
 03 0B Flower
 03 0C School of fish
 03 0D Butterfly
 
 05 // warps
 
 07 01 Ado (Gives maxim tomato)

 08 00 N-Z Boss
 08 01 Bouncy Boss
 08 02 Kakti Boss
 08 03 ?
 08 04 Spark-i Boss
 08 05 Tick Boss
 08 06 Kany Boss
 08 07 Kapar Boss
 08 08 Blowfish boss
 08 09 Galbo boss
 08 0A drop boss?

"Rough" Notes

shygoo 2017
f3dex2
http://wiki.cloudmodding.com/oot/F3DZEX

-----------------------------

geometry file

header+0x04 is scrolling texture settings

for each struct in the section, there is a jump to segment 0E in the microcode

target grows by 8 for each eg

0E000000, 0E000008, 0E0000010

Segment 0E structure

 802C97F0: DE010000 802C9828 // G_DL branch 802C9828
 802C97F8: DE010000 802C9838 // G_DL branch 802C9838
 ...
 802C9828: F20AC021 001A421D // G_SETTILESIZE <- Coordinates change actively to scroll texture
 802C9830: DF000000 00000000 // G_ENDDL
 802C9838: F20AC021 001A421D // G_SETTILESIZE <- Coordinates change actively to scroll texture
 802C9830: DF000000 00000000 // G_ENDDL
 
 For each list of segptrs to the scroll setting structs,
 there is a set of branches and g_settilesize instructions

 level 0 has a list of 7 and another list of 14
 https://i.gyazo.com/77ee78dbb5cf2c5b4173863ba7377a87.png
 
 
8036F1B8 scrolling structs
 8036F1B8
 8036F230
 8036F2A8
 8036F320
 8036F398
 
800CE248 geometry block addresses in ram 
 
-----------------------------

Geo block loading
800F6E30
 800A9864 loadResource(a0 = resource id) // 00070001 = stage model
  800A9250 loadResource(a0 = resource id)
   80002E48 (romaddr & size)

 @800A92C4 watch a0 for addresses
 
------------------------------

Entity/camera block loading
800F78E4
 800A9AA8 calculates block size using the offset of the next block
  80002E48 a0 = address of entity table
  
@800A9B2C watch t2 & t3 for bank-offsets

0007003B -> 01D28720 + (0001AD48 : 0001CDA0)

1D43468 : 1D454C0

0007000D 01D28720 00004540 : 0000495C

------------------------------
Image loading
800A8BAC
 800A8B0C
  80002E48

  00858740 00000844
  

000783F4 800D01A4 resource ID for stage 1-1 area 0 sits here (00070001)

-------------------------

Primary level table?

000783F4 800D01A4: structs, 0x24 (36) bytes in size

  800D00A4
  
00       04       08   0A   0C       10       14   16
00070001 00000000 0002 007F 0000000D 0007003B 003C 0000 0007000D 0007000E 800D5E00
00070002 00000000 0003 007F 00000022 0007003C 003C 000A 0007001F 00070020 800D5E0C
00070003 00000000 0004 007F 0000000D 0007003D 003C 0000 0007000D 0007000E 800D5E18
 
-------------------

Different bank contexts

800A9AA8 & 800A8B0C are nearly identical
800A9250

all call 80002E48 to dma

-------------------


8012E990 kirby xyz


8012E968 u32, float x, float y, float z
copied from here to kirby xyz

800E2950 z copied from here


kirby init pos

800E25d0


z pos copied from here 8012E974
copied from here 801926D4

800E2950
-----------------------------

Level settings


01D43468 802F4A10 State 1-1 area 0 block (0x2058 bytes)

00001268 = 802F5C78
 116 bytes?
00001C50 = 802F6660
 00000009 00001BC0 00001AF4 00001B48
 v
 00000009 802F65d0 802F6504 802F6558
          ^ camera & collision stuff?
		

		
  802F65d0:
   802f55b4 802f5cec 802f64c4 00020000
 
 
00001C60 = 802F6670 object positions


00001C50:
 00000009 number of items
 00001BC0 offset to some structs (3 offsets & a number) (9 structs)
  
  000015A4 offset of something 144 bytes
  000012DC offset of something 72 bytes
  00001AB4 offset of something 8 bytes
  00020000
  ...
   
 00001AF4 offset to some bytes
 00001B48 offset to some floats (30 of them)

 12DC

80047510 ptr to current collision?

802F568C first white block
802F56BC on bridge
802F577C platform
802F579C on block
802F58FC 

collision struct 0x30 bytes?

0x0C: Y

collision struct can be applied to multiple places

---------

Environment particle block

1. Number of particles
2. Particle offset list
3. Particle settings

00000009

00000028 00000074 00000104 00000198 00000228 000002B8 00000310 00000378 000003BC

00000000 000000C0 00000000 3F800000 3F800000 00000000 00000000 00000000 00000000 00000000 3D4CCCCD 00000000 00000000 00000000 03D9792C A50001A5 0002A500 03A50004 01FF0000
00000000 000100C0 00000003 3C23D70A 3F800000 3FC00000 3FE66666 00000000 00000000 00000000 BF800000 41200000 00000000 00000000 03D9792C 4000A844 48000000 00000043 C80000AD A0004100 0000D700 FFFFFFCF 00F0A0D7 C8BA0707 0F002040 A0404140 0000CF40 F0B4EB40 BA07070A 002038A0 6041C800 00CF60FF FFFF00FA 20993CA3 D70A01FB 2028FF00
00000000 000100C0 00000003 3C23D70A 3F800000 3F99999A 3FF33333 00000000 00000000 00000000 BF800000 41200000 00000000 00000000 03D9792C 4000A844 48000000 00000043 C80000A6 00640080 ADA00041 000000D7 00FFFFFF CF00DCDC 3CC8BA11 11000020 34A02041 400000CF 20F0F0D2 40BA0707 00002030 A04041C8 0000CF40 FFFFFF00 FA14993C F5C28F01 FB04FF00
00000000 00010080 00000003 3C23D70A 3F800000 3FC00000 40200000 00000000 00000000 00000000 BF800000 41200000 00000000 00000000 03D9792C 4000A844 48000000 00000043 C80000AD A0004100 0000D700 FFFFFFCF 00DC9655 C8BA1134 00002034 A0204140 0000CF20 F0F0B440 BA070700 002030A0 4041C800 00CF4019 FFFF00FA 14993CA3 D70A01FB 08FF30A8
00000000 000100C0 00000003 3C23D70A 3F800000 3FB33333 3FE00000 3F800000 00000000 00000000 BF800000 41200000 00000000 00000000 03D9792C 4000A844 48000000 00000043 C80000AD A0004100 0000D700 5FDC5FCF 0078C878 C8BA001B 00002040 A0404140 0000CF40 C8F04640 BA000700 002038A0 6041C800 00CF60FF FFFF00FA 20993CA3 D70A01FB 2028FF6A
00000001 0001001E 00000002 3F800000 3F800000 00000000 41A00000 00000000 00000000 3FC90FDA C1700000 41700000 00000000 00000000 03D9792C 4000A23E 99999AA3 3F59999A AC003F80 000041A0 000014C8 0A000AFF
00000000 00010014 00000000 3F800000 3F800000 00000000 41000000 3F800000 C1F00000 3F5F66F3 C1A00000 41200000 00000000 00000000 03D9792C 4000ADD7 00FFFFFF CF00FFFF FFA00ABD 40000000 41200000 A23FA000 00A01442 480000B4 C814000A FFC18E71
00000001 0001001E 00000000 3F800000 3F800000 00000000 00000000 00000000 00000000 00000000 BF800000 41700000 00000000 00000000 03D9792C A50005A5 000601FF
00000000 00010019 00000000 3F800000 3F800000 00000000 41200000 41F00000 00000000 3FC90FDA C1700000 42480000 00000000 00000000 03D9792C 4000ADD7 00FFFFFF CF00FFFF FF64A23F 0CCCCDA3 3F333333 0AA01442 C80000C8 14000FFF

---------

802F5E5C floats here mess with the collision

----

007DFA70 007E38C0 kirby character geometry block
6FA94 rom address list


___________________

Image address conversion

800A8BAC (A0 = bank_id_pair)

 void* bank_table[] @ 800D0104
 
 int bankno = (bank_id_pair >> 0x10) // upper
 int id = (bank_id_pair & 0xFFFF) // lower
 
 void* bank[] = bank_table[bankno]
 void* img_addr = bank[id]

0x01BD5C80 ROM Bank 7?
0x00076B2C Offset list

01BD5C80 + 00068A0A (image address)
passed to 80002E48

01BD5C80 + 0010FDAA

00078300: 01BD5C80 ; a reference to bank7 ?

______________________________________________________

fire thing position
800E6C48

800FC9C0 spawn_entity function

  a0 = ptr
  a1 = ptr to entity struct
  a2 = ptr
  
  800FCD14
  
  a0 = ?
  a1 = ?
  a2 = float x_pos
  
  802F4A10
   + 1268 = 802f5c78
   + 1C50 = 802F6660 more offsets converted to pointers within block?
      00000009 00001BC0 00001AF4 00001B48 becomes...
      00000009 802F65D0 802F6504 802F6558 
   + 1C60 = 802F6670 objects array
    
-----------


code at 800a9420 converts segptrs to ptrs in geo block

level screen selection
800E9918
800E991C
800E9FE0

level loading related, entity block is in memory after this is called
800075C0 JAL 0x8000708C ; does not return to pc+8
800072F0 JALR RA, V1
 V1 = *(n + 0x88)
 n = {
  8015A064 ; game start
  8015A064 ; into screen
  8015A064 ; title screen
  8015AAC4 ; select file screen
  
  8015C074 ; planet selection
  8015A7DC ; stage selection
  80123F64 ; popstar 1
  
  8015AAC4 ; copy ability prompt
 
 
800F6600 JAL 0x800F8274
800F8348 JAL 0x800F78E4

800F793C
 800a9aa8 converts offsets to pointers in the entity block