TODO:Crash Bandicoot Hacking Wikia

From Crash Bandicoot Hacking Wiki
Revision as of 19:40, 14 September 2015 by Wikia>WurlyFox (Created page with "==Remaining topics to discuss== *Entry Point *Main Loop *NS/Paging System #EID encoding/decoding; determining type from EID string #Filesystem Mapping? #Entry Querying #Page O...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Remaining topics to discuss

  • Entry Point
  • Main Loop
  • NS/Paging System
  1. EID encoding/decoding; determining type from EID string
  2. Filesystem Mapping?
  3. Entry Querying
  4. Page Operations
  a.  Initialization/Deinitialization
i.  Paging and Subsystem Initialization
ii. Paging and Subsystem Deinitialization
  b.  Page Management
i.    Page Allocation
    ii.   Page Deallocation (free)
    iii.  Page Creation
    iv.  Page Deletion (truncatePages)
  c.  Page Update
i.   Update Page (single)
- incl Page Chunk Decompression/Initialization
- Chunk Decompress Routine
ii.  Update Pages (global)
         - incl Update New Pages (called from level update when load new zone)
    iii. Update Page [chunk] Entries
  d.  Page Search and Request/Open  
    i.  Search
       A.  Find Hash Pair
       B.  Find Page (that contains entry w/EID)
    ii.  Request/Open
       A.  Page Chunk
       - Pages a single new page with req. CID, EID
       B.  Page Entry 
       - Variant intended to page a single new page with req. entry w/EID; since paging the new page requires Updating Page Entries, which replaces the data fields of hash pairs for its entries with pointers to them, this returns a pointer to the resolved entry in its hash pair
       C.  Open Entry
       - Variant intended to increment read requests for an already paged page with req. entry w/EID;will page chunk if it does not exist; can optionally schedule paging the chunk with req. entry as part of a 'group' of contiguous chunks, during next page update
         i) **Open Entry Given Container Chunk - also a variant, is just the bottom half of the open entry routine
       D.  Close Entry
       - Decrements read requests for an already paged page with req. entry w/EID; 
       E.  Unpage Chunk
       - Clears the chunk's entry in the page map
       F.  Close Entries and Unpage Chunk
       - Closes chunk's n last opened entries, and unpages if all have been closed     
  e.  Page Queries
A.  Get Number of Free or Available Pages
    B.  Get Number of Free or Available Pages With Specified List Entries
  f.  Texture Pages
    A.  Unpage Texture Page
  g.  Zone-Specific
    A.  Close Zone Entries and Unpage Zone Chunks
    B.  Unpage a Texture Page among Zone Entries [i.e. that is already paged]
 Misc/incomplete
  a.  Seek Disc to file
  b.  Find Audio Page?
  • Hardware Initialization
  1. Hardware Init Routine
  1. Hardware Deinit Routine
  • Drivers/Libraries
  1. Controller
a.  Controller Initialization
b.  Controller Read
2.  GPU
a.  GPU Initialization
b.  GPU Deinitialization
c.  GPU Shaders
d.  GPU Driver
A.  Clear Screen
B.  Fill Screen w/Black Tile
C.  Draw Sync
- incl root counter callback
D.  OT (prim list)
i.   Initialize OT
ii.  Get OT Pointer
E.  Swap Buffers and Render Stage
F.  Render Primitive
G. Game Rate Calculations
3.  GFX
a.  [Page] Texture Chunk to VRAM
b.  Global Matrices
A.  Set Projection and Screen Offset
B.  Generate View Matrix, Rot, Angles, World Models, etc.
C.  Generate Matrices for Map**
c.  Global Light Matrices
A.  Light Matrix Generation
d.  Matrix Transformation Routine
e.  Primitive Creation
A.  Objects
i.  Object SVTX Primitive Creation
- incl. 3 clipping-related routines
- incl. 2 svtx vertex shading (light) routines
- incl. assembly routine portion
ii.  Object CVTX Primitive Creation
iii. Object Sprite Primitive Creation
- incl. rotation assembly portion
- incl. assembly routine portion
iv.  Object Font Primitive Creation
B.  Worlds
i.   World Model Creation
- incl also sub_8001A460?
ii.  World Primitive Creation
- 7 Variations, incl 1 unused
- incl. optimized world model copying
- incl. assembly routine portion for each variation
f. Memory Card Images
A. 3 undocumented routines
g.  Audio Matrix Generation (assembly portion)

  

-GOOL/Objects

1. OPAT Initialization/Deinitialization
2. sub_8001AC60?
3. Object Hierarchy
a. Object Left-parent/Right-sibling desc.
 b. Object Adoption
i. Add Child Object
ii. Remove Child Object
c) Object Traversal
i)   General Traversal
1) Pre-order traversal with callback
2) Post-order traversal with callback
3) List handle pre-order traversal with callback
4) List handle post-order traversal with callback
ii)  Object Find Traversal
1) Object Find traversal with callback   
- Callback routines: HasID, HasStateFlags
2) Object Find/Query traversal (no callback)
 - Find nearest object (incl. send asynchronously handled event-another routine)
4) Object Initialization, Creation, and Termination
a) Object Initialization
b) Object Creation
i)   Process Object 'Creation'
ii)  Entity Object Spawning
c) Object Termination  
i)   3 Object Termination variants
ii)  Mass Object Termination
5) Object Update
a) Object Trans Block Interpretation
b) Object Code Block Interpretation
c) Object Colors Update
d) Object Physics Update
- Object Paths
e) Object Primitive Creation
- Text Creation Routines
f) Object Bound Box Update
g) Object Bound Collision Registration
6) GOOL
a) Changing Object State
b) Sending Object Events
- incl. Object Collision Events
- incl. Broadcasting Events
- Incl. nearest object query
c) Interpret Object
- incl. GOOL Reference Translation
- incl. Reading Control Pad
- See also geometric computations and calculations for objects

  

-Geometric Computations/Calculations

1) For Objects
a) Object Rotation
- 2 Variations
2) Seek
3) Distance
a) Euclidean distance
- in 3 space
- in XYZ plane
b) Manhattan distance
c) Absolute 1D distance
4) Angles
a) Angular distance
b) Angle in XZ plane (btwn 2 vectors)
c) Angle in YZ plane (btwn 2 vectors)
5) Vector Operations
 a) Matrix Transformation
2 variations... (1 for visual, 1 for audio)
b) 2D Projection
6) Collision Test
a) Test 2 3D spaces for a collision
b) Test point for containment by 3D space
c) Test 3D space given by 2 points for collision with another 3D space
7) General Math Functions
a) Sine
b) Cosine
c) Square Root
d) Atan2 (ratan2)

-GOOL Globals Initialization...


-Level

1) Initialization
- LDAT Initialization
- GOOL Globals Reset
- Load Universal Entries
- Create HUD + Level Restart (*sub_8002E98C)
(Level Restart Creates Crash Object)
2) Level Update
- Zone
 A) Camera Path
i) Progress
- Update Sort List
- Camera Update
- incl update level misc
3) Level Current Zone Spawn Objects [outlier]
4) Level Save State
5) Level Restart
6) Level-Specific 
a) Level Specific World Vertex Shader Parameter Initialization
b) Level Specific Audio Vector Parameter Initialization

-Camera

1) Camera Update
 a) Camera Follow
A) Camera Get Projected Progress Non-forward
B) Camera Get Projected Progress Forward
C) Camera Adjust Progress (w/speed)
b) Other Camera Modes 
A) Camera Calculate Progress
B) Other: todo
c) Death Camera
TODO


-Sort List

1) Format
2) Encoding/Decoding

  

-Solid Surface Collision

1) Node Querying
-(one routine calls query routine for each zone)
2) Translation
-incl smooth, pull, and stop at solid
a) Stopping at Floor
- incl. Finding Highest Object Below
- incl. Finding Average Y
b) Stopping at Walls
A) Wall Plot 
i)   Initialization/Deinitialization (BINF)
ii)  Plotting a Wall
- 2 Variations
iii) Node Subdivision Wall Plotting
iv)  Object Sides Wall Plotting
v)   Zone Boundaries Wall Plotting
vi)  Testing the Wall Plot
- Replotting Walls
c) Stopping at Ceiling
- incl. Finding Ceiling
d) Stopping at Bottom Zone Bounds
e) Node Death Events
- incl. Handle Nodes...
3) GOOL Operations
a) Vector Rebound
b) Closest Solid Thing Above/Below or in Front/Behind
c) Highest Solid Thing Above
d) TODO remaining

-Audio/MIDI

TODO

-Memory Card

TODO

-Misc

1) Demo Mode
a) PBAK initialization
b) Demo mode routine
c) 4 Random Number routines



=============================================================

ALT outline



Topics to discuss

=====

-Entry Point

-Hardware Initialization

     1) Hardware Init Routines    

        a) Controller Initialization

        b) GPU Initialization

-Main Loop

  -Handle Pause Menu

     1) Object Creation

        a) Process Object 'Creation' (create pause menu obj.)

  -Level/NSF

     1) Initialization/Deinitialization

        * If level restarting

        - Create HUD + Level Restart (*sub_8002E98C)

          (Level Restart Creates Crash Object)

        * If new level loading

          * If a level is already loaded, unload it

            - Broadcast Kill event to all objects

            - Paging and Subsystem Deinitialization

          - Paging and Subsystem Initialization

            - LDAT Initialization

               1) Global Matrices

                  a) Set Projection and Screen Offset

            - OPAT Initialization/Deinitialization



          - Load Universal Entries

          - GOOL Globals Reset

     2) Update Pages

        a)  Update Pages (global)

            i)   Update Page (single)

                 - incl Page Chunk Decompression/Initialization

                 - Chunk Decompress Routine

    iii) Update Page [chunk] Entries

     3) Level Current Zone Spawn Objects

        a) Object Creation

           i)   Entity Object Spawning

                * Spawning Crash Object and no new level?

                  - Save Level State

                a) Object Initialization

                - incl. Object Adoption

                 1) Add Child Object

                 2) Remove Child Object

                 

        b) Object Termination?? 

           i)   Mass Object Termination?

     4) Level-Specific 

        a) Level Specific World Vertex Shader Parameter Initialization

        b) Level Specific Audio Vector Parameter Initialization

     5) Camera/Level Update 

        a) Death Camera

           TODO

        b) Other Camera Modes 

           A) Camera Calculate Progress

           B) Other: todo

        c) Camera Follow

           A) Camera Get Projected Progress Non-forward

           B) Camera Get Projected Progress Forward

           C) Camera Adjust Progress (w/speed)

        - Level Update

          - Zone

            A) Camera Path

               i) Progress

                  - Update Sort List

                    - Sort List

                      1) Format i.e. Encoding/Decoding

            B) Zone-Specific *if new zone, do for prev zone:

               i)   Close Zone Entries and Unpage Zone Chunks

               ii)  Unpage a Texture Page among Zone Entries [i.e. that is already paged]

          - incl Update New Pages 

          - Update Camera Coords

          - incl update level misc

  -Drivers/Libraries

     1) GFX

        a) Global Matrices

           - Generate View Matrix, Rot, Angles, World Models, etc.

        b) Primitive Creation

           A) Worlds

              i)   World Model Creation

                   - incl also sub_8001A460?

              ii)  World Primitive Creation

                   - 7 Variations, incl 1 unused

                     - incl. optimized world model copying 

                     - incl. assembly routine portion for each variation

  -GOOL/Objects

     - Use pre-order traversal on list handle objects (to update all)

     1) Object Update

        - incl. Controller Read

        a) Object Trans Block Interpretation

        b) Object Code Block Interpretation

           i) Interpret Object

           - incl. GOOL Reference Translation

           - incl. Reading Control Pad

           - incl. Changing Object State

           - incl. Sending Object Events

             - incl. Broadcasting Events

             - incl. Nearest object query

        c) Object Colors Update

        d) Object Physics Update

           - Object Paths

           - Solid Surface Collision

             1) Node Querying

                - (one routine calls query routine for each zone)

             2) Translation

                -incl smooth, pull, and stop at solid

                  a) Stopping at Floor

                  - incl. Finding Highest Object Below

                  - incl. Finding Average Y

                  b) Stopping at Walls

                     A) Wall Plot 

                        i)   Initialization/Deinitialization (BINF)

                        ii)  Plotting a Wall

                             - 2 Variations

                        iii) Node Subdivision Wall Plotting

                        iv)  Object Sides Wall Plotting

                        v)   Zone Boundaries Wall Plotting

                        vi)  Testing the Wall Plot

                             - Replotting Walls

                  c) Stopping at Ceiling

                     - incl. Finding Ceiling

                  d) Stopping at Bottom Zone Bounds

                  e) Node Death Events

                     - incl. Handle Nodes...

        e) Object Primitive Creation

           - Text Creation Routines

           A) GFX

              i)   Object SVTX Primitive Creation

                   - incl. Light Matrix Generation

                   - incl. 3 clipping-related routines

                   - incl. 2 svtx vertex shading (light) routines

                   - incl. assembly routine portion 

              ii)  Object CVTX Primitive Creation

              iii) Object Sprite Primitive Creation

                   - incl. rotation assembly portion

                   - incl. assembly routine portion

              iv)  Object Font Primitive Creation

        f) Object Bound Box Update

        g) Object Bound Collision Registration

           - incl. Object Collision Events




  4) Level Save State






-NS/Paging System

1) EID encoding/decoding; determining type from EID string

2) Filesystem Mapping?

3) Entry Querying

4) Page Operations

  b) Page Management

    i)   Page Allocation

    ii)  Page Deallocation (free)

    iii) Page Creation

    iv)  Page Deletion (truncatePages)



  d) Page Search and Request/Open  

    i) Search

       A) Find Hash Pair

       B) Find Page (that contains entry w/EID)

    ii) Request/Open

       A) Page Chunk

       - Pages a single new page with req. CID, EID

       B) Page Entry 

       - Variant intended to page a single new page with req. entry w/EID;

         since paging the new page requires Updating Page Entries, which replaces the data fields of 

         hash pairs for its entries with pointers to them, this returns a pointer to the resolved 

         entry in its hash pair

       C) Open Entry

       - Variant intended to increment read requests for an already paged page with req. entry w/EID;

         will page chunk if not exists;

         can optionally schedule paging the chunk with req. entry as part of a 'group' 

         of contiguous chunks, during next page update

         i) **Open Entry Given Container Chunk - also a variant, is just the bottom half of the open entry 

         routine

       D) Close Entry

       - Decrements read requests for an already paged page with req. entry w/EID; 

       E) Unpage Chunk

       - Clears the chunks entry in the page map

       F) Close Entries and Unpage Chunk

       - Closes chunk's n last opened entries, and unpages if all have been closed     

  e) Page Queries

    A) Get Number of Free or Available Pages

    B) Get Number of Free or Available Pages With Specified List Entries

  f) Texture Pages

    A) Unpage Texture Page



5) Misc/incomplete

  a) Seek Disc to file

  a) Find Audio Page?

  



2) Hardware Deinit Routine

  

-Drivers/Libraries

1) Controller

2) GPU

  b) GPU Deinitialization

  c) GPU Shaders

  d) GPU Driver

     A) Clear Screen

     B) Fill Screen w/Black Tile

     C) Draw Sync

        - incl root counter callback 

     D) OT (prim list) 

        i)   Initialize OT 

        ii)  Get OT Pointer

     E) Swap Buffers and Render Stage

     F) Render Primitive

     G) Game Rate Calculations

3) GFX

  a) [Page] Texture Chunk to VRAM

  b) Global Matrices

     C) Generate Matrices for Map**

  d) Matrix Transformation Routine

  f) Memory Card Images

     A) 3 undocumented routines

  g) Audio Matrix Generation (assembly portion)

  

-GOOL/Objects

2) sub_8001AC60?

3) Object Hierarchy

   a) Object Left-parent/Right-sibling desc.



   c) Object Traversal

      i)   General Traversal

           1) Pre-order traversal with callback

           2) Post-order traversal with callback

           3) List handle pre-order traversal with callback

           4) List handle post-order traversal with callback

      ii)  Object Find Traversal

           1) Object Find traversal with callback   

           - Callback routines: HasID, HasStateFlags

  

-Geometric Computations/Calculations

1) For Objects

   a) Object Rotation

   - 2 Variations

2) Seek

3) Distance

   a) Euclidean distance

   - in 3 space

   - in XYZ plane

   b) Manhattan distance

   c) Absolute 1D distance

4) Angles

   a) Angular distance

   b) Angle in XZ plane (btwn 2 vectors)

   c) Angle in YZ plane (btwn 2 vectors)

5) Vector Operations

   a) Matrix Transformation

      2 variations... (1 for visual, 1 for audio)

   b) 2D Projection

6) Collision Test

   a) Test 2 3D spaces for a collision

   b) Test point for containment by 3D space

   c) Test 3D space given by 2 points for collision with another 3D space

7) General Math Functions

   a) Sine

   b) Cosine

   c) Square Root

   d) Atan2 (ratan2)

-GOOL Globals Initialization...












  

-Solid Surface Collision




3) GOOL Operations

   a) Vector Rebound

   b) Closest Solid Thing Above/Below or in Front/Behind

   c) Highest Solid Thing Above

   d) TODO remaining

   

-Audio/MIDI

TODO



-Memory Card

TODO



-Misc

1) Demo Mode

   a) PBAK initialization

   b) Demo mode routine

   c) 4 Random Number routines