Skip to content

migrate main segment data, rename some files, and various cleanup - #70

Open
Drahsid wants to merge 2 commits into
masterfrom
main_segment_migrate_data
Open

migrate main segment data, rename some files, and various cleanup#70
Drahsid wants to merge 2 commits into
masterfrom
main_segment_migrate_data

Conversation

@Drahsid

@Drahsid Drahsid commented Aug 15, 2026

Copy link
Copy Markdown
Owner

I have migrated all of the main segment data/rodata/bss to C, which is the vast majority of this PR. In doing this, I also did a bunch of minor cleanup:

  • consistently labeled incorrect prototype-related code, using // BUG: inconsistent prototype! at declaration; and // BUG: incorrect prototype! before header includes
  • minor fixed-unit related cleanup
  • top-of-file declarations have been cleaned up and made generally consistent and typically in vram order
  • named some data, used more enums/flags defines within data where I noticed it was missing
  • a ton of hard-coded address cleanup
  • symbol_addrs and undefined_syms now have many less entries
  • extracted embedded textures into their own files to save some vertical space; these files are in src/textures

I also renamed the following files and their relevant headers, though if you have better ideas, let me know:

  • 156F0 -> actor_physics: this file primarily has code doing actor velocity, position, physics callback tables, platform, and screen-space updates.
  • 26A00 -> asset_loader: this one pretty straightforwardly is responsible for DMAing assets
  • 134E0 -> collision_query: this has point/edge probes into the stage collision map and the code which reads the shape and collision flags
  • gameover -> continue_screen: more consistent with other file names and the behavior within the file
  • cosineTable ->cosine_table: snake_case
  • floatTable -> cosine_table_unused: snake_case and better describe contents
  • stage -> frontend: this has intro/title, debug sound and stage menus, world map, progression, ranks/times, transitions, and records screens; so I think frontend or top_menu are probably better
  • globals -> game_globals: make name slightly less ambiguous
  • soft_reset -> game_init: this isn't just used for soft reset (GameState_Loading is in here, for example,) this is really mostly code for initializing the game state
  • text -> game_text: make name slightly less ambiguous and also make it more distinct from font and osd_debug_text
  • 82DB0 -> marina_graphics: small file with the goal of decompressing marina's graphics
  • 5E230 -> overlay_abi: this only has functions which wrap the overlay abi
  • 59EA0 -> particles: this seems to exclusively deal with particle-effect actors
  • 48A30 -> marina_action_dispatch: I believe this is related to special input commands and/or guest/child player logic. See D_800BE5F4 and D_800D3D20
  • 4FEB0 -> player_actions: code for Marina's core movement; grab, dash, shake, throw, etc. The actual behavior/state machine.
  • 12DD0 -> player_control: this resets and initializes Marina's input state, and handles camera and scrolling
  • A540 -> render: this seems to be the primary renderer
  • E44A0 -> render_setup_data: this contains data used to setup the rendering; seems similar and is probably derived from an sdk demo, though I didn't check
  • 438E0 -> stage_runtime: this has code for the lifecycle of a stage (setup, step, exit)
  • 11820 -> stage_tilemap: this builds the 16x16 collision-byte map and maintains the visible 10x7 midground/environment/background tile grids
  • 17A70 -> actor_update: the single purpose of this file is the actor update functions

The newly introduced files are:

  • actor_attachment_offsets: data which seems to contain fixed-point offsets for child actors or attached actors
  • actor_query_data: seems to store/query data on the nearest actor
  • audio_data: mostly unused data (strings); likely part of music.c but I was able to split here
  • graphic_lists: most of the game's lists of graphic indices
  • palette_data: most of the game's palettes
  • stacks: game stacks

Note that I also have some ideas for naming other files. I'm not as confident in these, but maybe we can workshop something:

  • 80D90 appears to be related to rigging multi-part actors
  • 82920 appears to specifically be the rig for the cat
  • 8F080 I think this is all Calina and her magical girl transformation
  • 74A50 appears to mostly contain code for hostile enemies

Edit: I used git mv on all the files I renamed, but I guess some of these appear as file deletions and additions for some reason.

@queueRAM queueRAM left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very nice naming, data migration and cleanups! Just had a few whitespace and fixed unit questions.

Btw, any idea how badly will this conflict with #63 ?

Comment thread src/74A50.c Outdated
var_t3 = gActors[actor_index].var_158 / FIXED_UNIT(1);
gActors[actor_index].var_15C = gActors[actor_index].unk_114 * 393216.0f;
gActors[actor_index].var_160 = gActors[actor_index].unk_114 * -65536.0f;
gActors[actor_index].var_160 = gActors[actor_index].unk_114 * (f32)FIXED_UNIT(-1.0);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: was this indentation intentional?

Comment thread src/80D90.c Outdated
scale_2 = vals[2];
scale_2 += gActors[actor_1].var_154 / 65536.0f;
scale_2 += gActors[actor_index].var_154 / 65536.0f;
scale_2 += gActors[actor_1].var_154 / (f32)FIXED_UNIT(1.0);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this an instance where FROM_FIXED((f32)gActors[actor_1].var_154) here and TO_FIXED() below would be preferable?

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TO_FIXED doesn't work due to casting, but FROM_FIXED worked fine.

Comment thread src/8F080.c Outdated
angle = gActors[actor_index].unk_16C / FIXED_UNIT(1.0);
gActors[actor_index].velocityX.raw = Math_ApproachS32(gActors[actor_index].velocityX.raw, COS(angle) * 98304.0f, FIXED_UNIT(32.0/256));
gActors[actor_index].velocityY.raw = Math_ApproachS32(gActors[actor_index].velocityY.raw, SIN(angle) * 65536.0f, FIXED_UNIT(32.0/256));
gActors[actor_index].velocityY.raw = Math_ApproachS32(gActors[actor_index].velocityY.raw, SIN(angle) * (f32)FIXED_UNIT(1.0), FIXED_UNIT(32.0/256));

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: inconsistent indentation

@blackgamma7

Copy link
Copy Markdown
Contributor

suggested renames:

8F080 -> calina: I am also confident this is all her code.
82F80 -> text_texture: deals with adding text characters to a texture
game_text -> text_actor: differentiate from above - each character is instead treated as an actor
7D8E0 -> text_actor_2: different text actor types from above.

I also have a few renames of scripts in #63 ,

Co-Authored-By: queueRAM <129774+queueRAM@users.noreply.github.com>
@Drahsid

Drahsid commented Aug 16, 2026

Copy link
Copy Markdown
Owner Author

For any of the renames which have ambiguity between this and #63, let me know and I'll revert them here. I think it's mostly just the player/marina stuff.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants