Extended presence flags/Implementation Hints

From Custom Mario Kart
Jump to: navigation, search

This page consists of implementation hints for KMP tool creators and maintainers especially to support the extended presence flags.


Introduction

The Extended presence flags expands the usage of KMP section GOBJ: It uses usually unused bits of the object_id and of the presence_flags. Additional a padding member is used.

The issues with most KMP tools (except Wiimms SZS Tools and SZS Modifier) are:

  • The ignore the 16-bit padding at offset 2 completely: They don't scan it, the don't allow to edit it, and the always store value 0.
  • Some tools manage the object_id. The don't accept the additional bits and clear them or clear the complete object_id.

The following section describes, how to fix it.

Requirements

Object-ID

The Object-ID identifies the object to use. The Wii ignores all unknown ids. A KMP tool must not modify the object id automatically. Best is to display the object id as hexadecimal number, so that the user can detect flags easily.

If a tool supports object related information, it should implement the following algorithm:

  • If the Object-Id is between 0x0000 and 0x1fff, then a real object is linked. Mask out the bits 0-9 (and with 0x03ff) to find the related object.
  • Otherwise the object id is between 0x2000 and 0xffff. This is a special case and not related to any object.

Reference-Id (Padding)

The padding at offset 2 is now used as Reference-ID. The tool must read and scan the value, show it as hexadecimal number, and store it again. And if possible, create an edit field for it.

Presence flags

Nintendo defined the usage of bits 0-5 (mask 0x003f). All other bits are ignored by the Wii. A KMP Tool must accept all bits of this data member. Show it as hexadecimal number and allow to edit the complete range.