[Dark Cloud 2] Broken DMA GIF IMAGE transfer

Open
#123 1 comment 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 5 days

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
48/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Quiet
Tech stack
cpp
Domain
game-dev

Research direction

Start by locating mgLoadTextureZ__FiP8TM2_head and tracing how the runtime handles GIF IMAGE transfers. Compare the game's stated transfer-size calculation with the expected size for 4HH/4HL sheets. Done means the runtime does not give up after the first GIF IMAGE and handles the transfer at the correct size.

Written by the indexing model from the issue text.

Description

bug runime

Dark Cloud 2 has a function mgLoadTextureZ__FiP8TM2_head

The purpose of this function is to upload 4HH and 4HL font sheets into the upper 8 bits of the z buffer
However the game has a bug, it incorrectly calculates the size of the transfer

Because 4HH/4HL are measured in pixels per byte, the correct calculation is something like:
(width * height) / 2 / 16

But the game calculates
(width * height * bpp) / 16

This causes a transfer that is 8x it's actual size and thus the DMAC to run off the end of the stack
This seems to work on real hw/emulation but the current runtime seems to give up the transfer after the first GIF IMAGE instead.

Dominant language
C++
Stars
3.3k
Forks
149
Avg merge
8h 46m
Merged PRs (30d)
1

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from ran-j/PS2Recomp

All issues in ran-j/PS2Recomp

Similar issues

More C++ issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.