gonetz / GLideN64

A new generation, open-source graphics plugin for N64 emulators.
Other
770 stars 177 forks source link

RE2 bottom of the screen is being cut off #2617

Closed fzurita closed 2 years ago

fzurita commented 2 years ago

This seems to be relatively new. With RE2, the bottom of the screen is getting cut off:

Resident Evil 2 (U) (V1 1)  !

ghost commented 2 years ago

Bisected to 865e9b443e665730c3d24005b2c71acacc59ce2d

gonetz commented 2 years ago

Bisected to 865e9b4

Any idea, what is wrong?

ghost commented 2 years ago

The hack condition is no longer triggered after I changed the commented lines for starcraft. I changed it because the other one was working, I do not know what the correct behaviour is. Current master

                //f32 imageW = (f32)(_pObjScaleBg->imageW >> 2);
        //f32 imageH = (f32)(_pObjScaleBg->imageH >> 2);
        f32 imageW = (f32)gSP.bgImage.width;
        f32 imageH = (f32)gSP.bgImage.height;
gonetz commented 2 years ago

The correct behavior is to load data from uObjScaleBg structure. However, for all games but RE2 result should be the same:

    f32 imageW = (f32)(_pObjScaleBg->imageW >> 2);
    f32 imageH = (f32)(_pObjScaleBg->imageH >> 2);

vs

    const u32 imageW = _pBgInfo->imageW >> 2;
    const u32 imageH = _pBgInfo->imageH >> 2;
    gSP.bgImage.width = imageW - imageW % 2;
    gSP.bgImage.height = imageH - imageH % 2;

The only difference is that gSP.bgImage.width and gSP.bgImage.height are forced to be even. Can you try this fix:

        f32 imageW = (f32)((_pObjScaleBg->imageW >> 2) & 0xFFFFFFFE);
        f32 imageH = (f32)((_pObjScaleBg->imageH >> 2) & 0xFFFFFFFE);

? It makes width and height even. It may be wrong too if some game uses an image with odd sizes.

I also noticed a regression in C&C with one-piece bg: GLideN64_Command Conquer_000

ghost commented 2 years ago

It seem to work for RE2. About command and conquer, I don't know why it is happening so far. To be honest, I don't understand how the microcode works very well.