Camera and photo import

Regional acquisition, conversion phases, thresholds and page ownership.

American and European V2 browse the DSi photo album. Japanese V2 instead acquires frames from the physical camera through NDMA. Their conversion code has now been mapped and executed against the same finite pixel corpus; matching conversion does not make their acquisition, state layout or UI identical. [1]

OperationUS V2EU V2JP V2
Enter02019C1802019C940201A0EC
Acquisition/conversion tick020198180201989402019928
Pixel conversion02019430020194AC02019510
Apply preview02019778020197F402019858
Merge selected ink02019344020193C002019424
Exit02019CBC02019D380201A1B4

Import, Cancel and Back

The PhotoEditor scene owns a Group, the shared Back control, threshold marker and named Next/Previous, Shutter and Shade controls. Import requests a full photo and enters busy/captured state; it does not insert an animation page immediately. While captured, thresholds remain adjustable. Back leaves photo mode and lets its exit owner accept or restore the page. The captured-state Cancel control instead clears the capture and conversion phase and restores Import/navigation; Back afterwards restores the original page. [1]

Next and Previous wrap the album index, reset conversion and start a six-tick cooldown, with sounds 0x89 and 0x8A. Import uses 0x87 and captured Cancel 0x88. American Import binds its animation before the request; the European handler requests sound first and has no corresponding animation-binding call there. Held transitions and pending capture prevent ordinary navigation. [1]

Scratch and regional fields

Entry clears 0x38000 shared scratch bytes and snapshots the existing working page. Source halfwords occupy 0x00000–0x17FFF, converted bytes 0x18000–0x23FFF and saved page 0x24000–0x2FFFF. The remaining cleared 0x8000 bytes have no established purpose in these owners. This does not allocate a new document page. [1]

FieldUS / EU offsetJP V2 offset
Captured flag04
Shade/line mode22
Transfer pending33
Processing enabled45
Deferred change56
Closing67
Capture/exit request78
Restart-related byte8, further meaning open9
Preview pointer1220
Saved page pointer1612
Source pointer2016
Phase2424

Offsets in that table are decimal. Japanese byte zero selects the camera; its toggle sets a deferred change and entry chooses SDK argument one or two. Those numeric arguments are not assigned inner/outer names without further SDK evidence. [1]

Album loading and resizing

The album index is read from photo:/private/ds/app/484E494A/pit.bin, with magic 0x50495430 and five hundred possible sixteen-byte entries. Selection is a filtered ordinal. Loader 020296E4 (European 02029558) writes into the existing camera source buffer. A thumbnail cache hit copies 98,304 bytes and skips file lookup, decoding, resizing and insertion. Otherwise the loader obtains shared scratch twice, placing decoded pixels 204,800 bytes after the second result. It opens, sizes, reads, decodes and closes the photo. A positive short read is passed to the decoder with the original file-size argument, rather than being rejected for unequal length. [1]

Open/read/decode failures clear the entire 256 × 192 halfword destination and clean its cache. Successful full-photo decoding uses bounds 640 × 480 and mode four; thumbnails use 160 × 120 and mode five. The full image samples floor(5X/2), floor(5Y/2). Thumbnail enlargement samples floor((5X + 4)/8), floor((5Y + 4)/8), not bilinear interpolation, and explicitly clears the rectangle X≥160 and Y≥180: 96 × 12 pixels. Its purpose remains unknown. [1]

The thumbnail cache is direct-mapped by album key modulo capacity, with key equality required on lookup. Insertion replaces that slot. For capacity three, keys seventeen and twenty collide; inserting twenty makes seventeen miss. Its owner stores capacity, stride, key pointer, current album index and pixel-buffer pointer. This is runtime state, not a file format. [1]

Japanese camera transfer

Original relocated SDK code configures a 256 × 192 window and four lines per block: 2,048 bytes or 512 words. Live phase zero sets pending, builds NDMA channel one and starts capture. Source is camera FIFO 04004204; total count is 24,576 words, block count 512, block-control two and control 0xCB044000. Callback 020198F8 waits for NDMA, clears capture-enable bit 0x8000, clears pending and performs the source-cache operation over 0x18000 bytes. [1]

These are original register writes and callback execution with an explicit completion event and frame input. They do not simulate a sensor, interrupt delivery, exposure or image quality. Window registers are 04004210/214; setup also changes bits 0x4000/0x2000 at 04004202 and a four-bit line-count-minus-one field. Numeric SDK options remain numeric until their meanings are separately established. [1]

Conversion phases

StatePhasesWork
Live/browsing0Decode thumbnail or request Japanese NDMA
Live/browsing1–6Six blocks of thirty-two rows
Live/browsing7Present completed preview
Held full photo0–5Six blocks of thirty-two rows
Held full photo6Present if not closing
Held full photo7No conversion block

Pending source transfer and the application's busy predicate gate conversion. American/European live phase seven returns to phase one and reuses the source; Japanese phase seven returns to zero to acquire another frame. Preview does not modify the saved snapshot. [1]

Thresholds and line treatment

Conversion uses each source halfword's low five bits, not a generic RGB luminance function. Initial US/EU range is low/high/edge = 5/16/10; Japanese stores edge/high/low in that order. Normal treatment sets selected ink at or below low, clears it at or above high and dithers in between: [1]

phase = (X & 15) + 16 * (Y & 15)
d = (value - low) * (value - low)
s = (high - low) * (high - low)
clear_ink = (phase * d) % s < d

The original valid-range middle branch avoids a zero divisor. Line treatment adds three times the absolute below/current difference, twice current/previous difference and the absolute below-right/previous-below difference, then compares with edge threshold. Previous samples start at zero each row; the final row's response is zero. Below-right follows the linear buffer at the right edge, including one readable halfword beyond the normal image in the checked penultimate-row case. [1]

Selected-layer masks use 0x80/0x40 per working byte. Without Advanced Tools, setting ink also clears the other layer's corresponding ink; with Advanced Tools it preserves it. Unrelated working flags remain intact. [1]

Threshold control and accepting the result

Touch geometry normalises X as trunc((X − 128) × 256 / 192) and local Y as trunc((Y − 88) × 256 / 64), each requiring −128…127. With the scene's Y offset this admits physical X32–223/Y88–151. Normal treatment derives high from the X step and low from Y; line treatment fixes marker Y and uses edge 32 minus X step. The subsequent tick clamps low to 0–31, high to 1–32 with strict low<high, and edge to 1–32. Touch assignment and later clamping are distinct stages. [1]

Exit accepts only a captured photo when capacity permits. It merges saved = (saved & ~mask) | (live & mask), normally mask 0xC0C0 or the selected ink bits, copies that back, marks changed and reaches commit/invalidation. Cancel or full capacity restores the saved snapshot without ink merge or changed update. Every exit sets closing/deferred flags and clears pending change; processing is cleared on restore, not unconditionally at the same point on acceptance. No animation frame is inserted. Full scene rendering, capture timing, complete undo/compression and V1 camera behaviour remain unverified. [1]

Held and live sources use different phase schedules

American V2 camera routine 02019818 reads object 021A1A1C. With its held-source flag set, phases zero–five call 02019430 for six thirty-two-row strips, phase six applies through 02019778, and seven is idle before returning to zero. Live acquisition instead captures at zero, converts at one–six and applies at seven. The held phase can advance even when busy blocks processing; closing byte six suppresses the apply phase. Those busy/closing observations are static, separate from the unblocked execution cases. [2]

Eight complete cycles use original edge/dither code on an independently specified RGB16 luminance ramp, varying edge detection, mode and active layer. Basic mode copies the preview. Advanced layer zero preserves saved bit 40; advanced layer one preserves 80, ORing the other layer into the preview while retaining generated lower flags. Every source, preview, saved and working pixel and the whole camera state were checked at each phase. [2]

Pending-close byte seven is consumed near the end of the routine. If closing byte six is set, closing and active clear; otherwise it requests capture stop and can select held-source mode. Physical acquisition, album navigation, JPEG decoding within this cycle and busy/deferred-close execution remain unverified. [2]

Sources

  1. [1] Flipnote Decompilation Project — Original regional camera, photo controls and album ownership
  2. [2] Flipnote Decompilation Project — Held-photo conversion phases and layer preservation

← All documentation