Command Palette

Search for a command to run...

UnylyUnyly
Назад к скиллам

convert-asset-array

БесплатноБез исполняемых скриптовНе проверен

Convert arrays with hardcoded pointer addresses to use ROM_START/ROM_END symbols. This automates the process of adding USE_ASSET declarations, updating array…

cdlewisот cdlewis★ 200 звёзд на GitHub

Об этом скилле

Convert Asset Arrays to ROM Symbols

Overview

When working with data arrays that contain hardcoded ROM pointer addresses (like gCourseDataAssets or gSpriteAssets), you need to:

  1. Add USE_ASSET declarations for each unique address
  2. Convert the array to use ROM_START/ROM_END symbols
  3. Update snowboardkids2.yaml to add named segments with proper end markers

This skill automates that entire process.

When to use

Use this skill when you see arrays with hardcoded pointer addresses like:

Asset_56910 gCourseDataAssets[] = {
    { (void *)0x00224420, (void *)0x00226BA0, 0x000024A8 },
    { (void *)0x0023CB80, (void *)0x00240520, 0x00003468 },
    // ...
};

These should be converted to:

Asset_56910 gCourseDataAssets[] = {
    { (void *)&_224420_ROM_START, (void *)&_224420_ROM_END, 0x000024A8 },
    { (void *)&_23CB80_ROM_START, (void *)&_23CB80_ROM_END, 0x00003468 },
    // ...
};

How to use

Identify the array to convert

Look for arrays of type Asset_56910 or similar asset structures in src/data/course_data.c or other data files.

Extract the pattern

For each array entry, extract:

  • Start address (first pointer value)
  • End address (second pointer value)
  • Size field (third value, typically ignored for ROM_START/ROM_END)

Step 1: Add USE_ASSET declarations

In include/assets.h, add USE_ASSET declarations for each unique start address:

USE_ASSET(_224420);
USE_ASSET(_23CB80);
USE_ASSET(_24D6C0);
// ... etc, sorted numerically

Step 2: Update the array initialization

Convert the array entries from:

{ (void *)0x00224420, (void *)0x00226BA0, 0x000024A8 }

To:

{ (void *)&_224420_ROM_START, (void *)&_224420_ROM_END, 0x000024A8 }

The pattern is:

  • Remove leading 0x and 00 prefixes from addresses
  • Replace (void *)0xADDRESS with (void *)&_ADDRESS_ROM_START or _ROM_END
  • Keep the size field unchanged

Step 3: Update snowboardkids2.yaml

For each asset segment:

  1. Find the location - Search for the address in the YAML:

    grep -n "0x224420\|0x226BA0" snowboardkids2.yaml
    
  2. Add or convert segments - If you see:

    • [0x224420, bin] alone → Convert to named segment:

      - name: _224420
        type: bin
        vram: 0
        start: 0x224420
      
    • Named segment without end marker → Add end marker:

      - name: _224420
        type: bin
        vram: 0
        start: 0x224420
      
      - [0x226BA0, bin]  # This marks where _224420 ENDS
      
  3. Maintain proper ordering - Ensure segments are in ascending address order:

    • Named segment definition
    • End marker (next segment's start)
    • Next named segment

Example structure:

- name: _224420
  type: bin
  vram: 0
  start: 0x224420

- [0x226BA0, bin]  # End marker for _224420, also marks start of next

- name: _23CB80
  type: bin
  vram: 0
  start: 0x23CB80

- [0x240520, bin]  # End marker for _23CB80

Step 4: Validate

Build and verify:

./tools/build-and-verify.sh

Watch for errors:

  • Segment XXXXX has zero size - End marker followed by named segment at same address (remove redundant end marker)
  • Segments out of order - YAML entries not in ascending address order
  • Missing USE_ASSET - Undefined ROM_START/ROM_END symbols
  • Wrong segment size - End marker at wrong address causing data mismatch
  • Checksum mismatch - Use data_diff.py --find-first-mismatch to find the problematic symbol

Common Patterns

Pattern 1: Single address used by multiple entries

Why: Multiple array entries may reference the same asset (duplicates share data).

Pattern 2: Asset marker already exists as [0xADDRESS, bin]

If multiple array entries use the same start/end addresses (common for duplicate assets), only declare the asset once:

// Both entries 15 and 16 use the same addresses
{ (void *)&_34A2C0_ROM_START, (void *)&_34A2C0_ROM_END, 0x00000438 },
{ (void *)&_34A2C0_ROM_START, (void *)&_34A2C0_ROM_END, 0x00000438 },

Pattern 2: Asset marker already exists as [0xADDRESS, bin]

When you see [0x226BA0, bin] in the YAML:

  1. Add a named segment BEFORE it:

    - name: _224420
      type: bin
      vram: 0
      start: 0x224420
    
    - [0x226BA0, bin]  # End of _224420
    
  2. Convert the marker to a named segment with its own end marker:

    - name: _226BA0
      type: bin
      vram: 0
      start: 0x226BA0
    
    - [0x228400, bin]  # End of _226BA0
    

Pattern 3: Redundant end markers

WRONG: End marker followed by named segment at same address:

- name: _226BA0
  type: bin
  vram: 0
  start: 0x226BA0

- [0x228400, bin]        # REDUNDANT! _228400 starts at same address

- name: _228400
  type: bin
  vram: 0
  start: 0x228400

CORRECT: Named segment serves as boundary:

- name: _226BA0
  type: bin
  vram: 0
  start: 0x226BA0

- name: _228400          # Ends _226BA0, starts at 0x228400
  type: bin
Полный SKILL.md на GitHub

Установить convert-asset-array в Claude Code и Claude Desktop

Зарегайся, чтобы установить скилл

Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.

  • Открой команду установки в одну строку
  • Сохраняй скиллы в синхронизируемую библиотеку
  • Уведомления, когда скиллы обновляются
Зарегаться бесплатноУ меня уже есть аккаунт

Разрешённые инструменты

Инструменты, которые скиллу разрешено вызывать.

Без ограничений — скилл может использовать любой инструмент.

FAQ

Что делает скилл convert-asset-array?

Convert arrays with hardcoded pointer addresses to use ROM_START/ROM_END symbols. This automates the process of adding USE_ASSET declarations, updating array initialization, and configuring YAML segments.

Как установить скилл convert-asset-array?

Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.

Скилл convert-asset-array запускает скрипты?

Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.

Похожие скиллы

Сравнить convert-asset-array с