Files
psxrecomp/runtime/include/mdec.h
T
Matthew Stanley 265183872d widescreen: FMV 4:3 pillarbox + menu-2D coherence + HUD edge anchoring
- FMV: 24-bit frames AND streamed 15-bit MDEC video (Tomba plays its
  movies 15-bit; depth24 alone missed them — user-reported) present
  pinned to native 4:3. Detector = colour MDEC decode within the last
  30 vblanks (mdec_recently_active); texture-decompression luma
  decodes do not stamp. Both GL present paths take force_4_3; SW path
  centers a 4:3 dst rect. User-verified on the intro movies.
- Menu garble: full-2D screens (no tagged prims in flight for 2
  frames) now squash lines, polylines, flat rects and mono sprites
  too — dialog borders are drawn with these and stuck out past the
  squashed SPRT boxes. Full-width TILEs (fades) stay exempt; in-game
  non-textured prims stay untouched (may be world-anchored).
- HUD positioning: in-game untagged SPRTs pivot by thirds — outer-
  third elements anchor to their screen edge (16:9 corner position,
  native proportions), middle third to centre. Full-2D screens keep
  the single centre pivot so composites stay coherent.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-06-15 12:52:15 -07:00

84 lines
2.4 KiB
C

#ifndef PSXRECOMP_MDEC_H
#define PSXRECOMP_MDEC_H
#include <stdint.h>
#ifdef __cplusplus
extern "C" {
#endif
void mdec_init(void);
uint32_t mdec_read(uint32_t addr);
void mdec_write(uint32_t addr, uint32_t value);
void mdec_dma_write_word(uint32_t value);
uint32_t mdec_dma_read_word(void);
int mdec_dma_write_ready(void);
int mdec_dma_read_ready(void);
/* FMV detector: nonzero if a colour (15/24-bit) MDEC decode ran within the
* last `within_frames` vblanks. Streamed video decodes continuously; the
* widescreen present pins such frames to native 4:3 (FMVs are authored 4:3
* and get no GTE squash to compensate the stretch). */
int mdec_recently_active(uint32_t within_frames);
typedef struct MDECDebugState {
uint32_t command;
uint32_t expected_halfwords;
uint32_t input_count;
uint32_t output_size;
uint32_t output_pos;
uint32_t output_depth;
uint32_t output_signed;
uint32_t output_bit15;
uint32_t busy;
uint32_t input_full;
uint32_t enable_dma_in;
uint32_t enable_dma_out;
uint32_t last_status;
uint32_t decode_macroblocks;
uint32_t decode_blocks;
uint32_t decode_stop_reason;
uint32_t decode_input_pos;
uint32_t decode_input_end;
uint32_t dma_in_words;
uint32_t dma_out_words;
uint32_t dma_read_underflows;
} MDECDebugState;
typedef struct MDECDebugEvent {
uint64_t seq;
uint32_t frame;
uint32_t kind;
uint32_t value;
uint32_t command;
uint32_t input_count;
uint32_t expected_halfwords;
uint32_t output_size;
uint32_t output_pos;
uint32_t macroblocks;
uint32_t blocks;
uint32_t stop_reason;
uint32_t underruns;
} MDECDebugEvent;
/* Monotonic decode-invocation counter — frontend FMV detector samples this
* per display-frame to detect active MDEC video (FMV) vs idle. */
uint32_t mdec_get_decode_count(void);
void mdec_debug_get_state(MDECDebugState *out);
uint64_t mdec_debug_get_event_total(void);
uint32_t mdec_debug_copy_events(uint64_t seq_lo, uint64_t seq_hi,
MDECDebugEvent *out, uint32_t max_count);
void mdec_debug_clear(void);
void mdec_debug_dma_in_start(uint32_t addr, uint32_t words);
void mdec_debug_dma_in_end(uint32_t addr, uint32_t words);
void mdec_debug_dma_out_start(uint32_t addr, uint32_t words);
void mdec_debug_dma_out_end(uint32_t addr, uint32_t words);
#ifdef __cplusplus
}
#endif
#endif /* PSXRECOMP_MDEC_H */