Skip to content

Extract DRA enemy definitions with asset tool - #3456

Open
mathisto wants to merge 3 commits into
Xeeynamo:masterfrom
mathisto:assets-dra-enemydefs
Open

Extract DRA enemy definitions with asset tool#3456
mathisto wants to merge 3 commits into
Xeeynamo:masterfrom
mathisto:assets-dra-enemydefs

Conversation

@mathisto

@mathisto mathisto commented Jul 31, 2026

Copy link
Copy Markdown
Contributor

Well met! Enemies decoded!

Summary

Adds an enemydefs asset handler that extracts the complete EnemyDef tables into editable YAML and regenerates C initializer headers in the existing compilation units. Introduces a new string handler with complete font tables for US, EU (contains special accent chars the US doesn't), and JP (including support for dakuten and handakuten encoding of the katakana). Though I don't know much Japanese, I did do some research and ensured the characters matched up. Much of the PR's line diff bulk is from the massive amount of deletions that will no longer need to be manually maintained. Go is not my lingua franca but I tried to keep your existing code conventions. Please dont hesitate to rip me apart; it might not be idiomatic.

This covers 2,805 records across seven tables:

  • US PlayStation: 400
  • Japanese PlayStation/HD: 400
  • PSP English, Spanish, Italian, German, and French: 401 each

The handler models the entire structure, including stats, elemental properties, item drops and rates, hitboxes, and flags. Element masks and item IDs use the existing Elements and ItemDrops enums, while stable IDs and expected record counts protect against missing or reordered entries.

Generated YAML and initializer headers remain ignored. Keeping the generated initializers inside the original source files lets the compiler continue to place and deduplicate the pointed-to strings instead of retaining hardcoded .rodata addresses.

Name encoding

Enemy names use the game's 8x8-font encoding. As mentioned, the shared string handler supports the PSX and PSP character tables, dakuten and handakuten composition, and the PSP European glyphs.

PSX and HD generated sources retain readable _S(...) strings. PSP headers contain pre-encoded strings because its string-processing step runs before generated includes are expanded.

The ordinary go test ./... reaches the existing unrelated vet failure in assets/spritesheet/handler.go:168 (fmt.Errorf uses %w with a string). Anyone have any more info on this failure? I'd love to take a swing at that as well.

@mathisto
mathisto marked this pull request as ready for review July 31, 2026 11:39
@@ -0,0 +1,209 @@
package sotn

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Wait until @Xeeynamo responds before changing but my opinion is we shouldn't duplicate sotn_str in the assets tool. You can just call it from go instead

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.

2 participants