Super Mario 64 Port for Dreamcast is possible ?

Place for discussing homebrew games, development, new releases and emulation.

Moderators: pcwzrd13, deluxux, VasiliyRS

MastaG
Quad Damage
Posts: 204

Re: Super Mario 64 Port for Dreamcast is possible ?

Post#201 » Mon Sep 28, 2020 5:22 pm

Esppiral wrote:Super Mario 64 Dreamcast Widescreen

Code: Select all

FIND
54 85 30 F3 11 1F 5A 40 20 F2 45 C7 08 F1 3C F6
REPLACE
55 85 04 F3 11 1F 5A 40 20 F2 45 C7 08 F1 3C F6


FIND
4E F7 2D F0 4E F1 1C F4 3D C7 08 F1
REPLACE
4E F7 2D F0 4E F1 1C F4 3D C7 08 F6


FIND
4C 41 EB 8C AB AA AA 3F
REPLACE
4C 41 EB 8C 00 00 80 3F

FIND
AB AA AA 3F 00 00 02 00 FF 88 01 89 A5 AE FF 70
REPLACE
00 00 80 3F 00 00 02 00 FF 88 01 89 A5 AE FF 70

FIND
AB AA AA 3F 3C 41 DE 8C
REPLACE
00 00 80 3F 3C 41 DE 8C



Thanks a lot for testing the cdi on gdemu bro!
Now we know it should also work from CD-R.

For widescreen it's possible these values will change when a new build is done.
Could it be possible you supply a patch file for the original sources?
https://github.com/mrneo240/sm64-port

Then I'll modify the build script to generate an original and 16:9 build from source.

kremiso
Rank 9
Posts: 966

Re: Super Mario 64 Port for Dreamcast is possible ?

Post#202 » Mon Sep 28, 2020 5:55 pm

dcsteve wrote:...I was once a Beats of Rage mod developer and admin at dcemulation.org.


kudos for this, my first source for DC emulators at time
welcome :)

mrneo240
Rank 9
Posts: 926

Re: Super Mario 64 Port for Dreamcast is possible ?

Post#203 » Mon Sep 28, 2020 8:29 pm

MastaG wrote:Alright, the URL is working now :)
If somebody could test the selfbooting cdi for me, that would be nice.


Where did you edit the Makefile to copy over fixed textures? I'd love to add this for psp+dc in the repo

User avatar
Anthony817
Shark Patrol
Posts: 4009

Re: Super Mario 64 Port for Dreamcast is possible ?

Post#204 » Mon Sep 28, 2020 8:47 pm

mistamontiel wrote:Fuzzcast on FB said he now upped one with audio but may need overclock for good FPS



I can confirm that a 20% overclock to 240mhz does not help at all. It is negligible. I just tested it now to test if it even helped, and from what I can tell MAYBE it ran 5% faster in some places. But that is not even enough to help it do much at the current state performance is with audio.

I can't even believe I didn't think to test it out in OC mode sooner haha! It can be touch and go on my DC to boot into it, so takes a few power cycles sometimes but when it works it is awesome.

Now, somebody with a dual memory mod with 32mb ram should be able to get it running full speed maybe? Shit, if I could install that mod I would literally have the Ultimate Dreamcast sans lacking the HDMI mod. :P
Image

MastaG
Quad Damage
Posts: 204

Re: Super Mario 64 Port for Dreamcast is possible ?

Post#205 » Tue Sep 29, 2020 10:48 am

mrneo240 wrote:
MastaG wrote:Alright, the URL is working now :)
If somebody could test the selfbooting cdi for me, that would be nice.


Where did you edit the Makefile to copy over fixed textures? I'd love to add this for psp+dc in the repo


I didn't alter the Makefile.
It's just part of my buildscript to copy the textures and redirect the output to the logfile.

Code: Select all

#!/bin/bash
cd /opt/toolchains/dc/sm64-port/
git fetch
if [ ! $(git rev-parse HEAD) == $(git rev-parse master) ]
then
   echo "Update available, rebuilding..."
   # setup toolchain
   source /opt/toolchains/dc/kos/environ.sh
   # get date and save as variable
   date=$(date +%Y-%m-%d)
   # cleaning...
   make clean distclean
   rm -Rf output
   # update sources
   git checkout master
   git pull --rebase
   # get revision and save as variable
   build=$(git rev-parse HEAD)
   # create output directory for packaging
   mkdir output
   # extract assets and -- LOG IT --
   ./extract_assets.py us > output/build-${date}.log 2>&1
   # replace textures with fixed ones and -- LOG IT --
   cp -r -v psp/textures/* textures/ >> output/build-${date}.log 2>&1
   # build for dreamcast and -- LOG IT --
   make -j2 TARGET_DC=1 scramble >> output/build-${date}.log 2>&1
   # create unscrambled binary for packaging
   /opt/toolchains/dc/kos/utils/scramble/scramble -d build/us_dc/1ST_READ.bin output/1ST_READ.BIN.unscrambled
   # copy IP.BIN for packaging
   cp IP.BIN output/
   # copy scrambled binary for packaging
   cp build/us_dc/1ST_READ.bin output/1ST_READ.BIN
   # copy scrambled binary for patching for dreamshell
   cp build/us_dc/1ST_READ.bin build/us_dc/1ST_READ.bin.patch
   # patch holly register for dreamshell
   sed -i 's/\xE4\x74\x5F\xA0/\xEC\x74\x5F\xA0/g' build/us_dc/1ST_READ.bin.patch
   # create iso folder
   mkdir build/us_dc/iso
   # unscramble the holly-patched binary for use with dreamshell
   /opt/toolchains/dc/kos/utils/scramble/scramble -d build/us_dc/1ST_READ.bin.patch build/us_dc/iso/1ST_READ.BIN
   # remove the scrambled patched binary as we don't need it
   rm -f build/us_dc/1ST_READ.bin.patch
   # create iso for dreamshell
   mkisofs -V Mario64 -G ./IP.BIN -joliet -rock -l -o output/sm64-port-dreamshell.iso ./build/us_dc/iso
   # empty iso folder
   rm -f ./build/us_dc/iso/*
   # copy scrambled binary for selfboot image
   cp build/us_dc/1ST_READ.bin ./build/us_dc/iso/1ST_READ.BIN
   # create selfboot iso file
   mkisofs -V Mario64 -G ./IP.BIN -joliet -rock -l -o build/us_dc/sm64-port-selfboot.iso ./build/us_dc/iso
   # convert selfboot iso file to data/data cdi image
   cdi4dc build/us_dc/sm64-port-selfboot.iso output/sm64-port-selfboot.cdi -d
   # copy readme file for packaging
   cp README output/README.txt
   # replace values in readme file
   sed -i "s/REV/${build}/g" output/README.txt
   sed -i "s/DATE/${date}/g" output/README.txt
   # sync and package output directory
   sync
   cd output
   zip -9 ../sm64-port-${date}.zip *
   cd ..
   # upload to mega.nz cloud
   mega-login user pass
   mega-put ./sm64-port-${date}.zip sm64_dc
else
   echo "Already up to date..."
fi


As you can see there's only 3 times where I write to the build log.

mrneo240
Rank 9
Posts: 926

Re: Super Mario 64 Port for Dreamcast is possible ?

Post#206 » Tue Sep 29, 2020 10:37 pm

Esppiral wrote:Super Mario 64 Dreamcast Widescreen


Code: Select all

FIND
54 85 30 F3 11 1F 5A 40 20 F2 45 C7 08 F1 3C F6
REPLACE
55 85 04 F3 11 1F 5A 40 20 F2 45 C7 08 F1 3C F6

sm64-port/src/pc/gfx/gfx_retro_dc.c:1187 , offset 0009001C, 0x8c0A001C

Code: Select all

FIND
4E F7 2D F0 4E F1 1C F4 3D C7 08 F1
REPLACE
4E F7 2D F0 4E F1 1C F4 3D C7 08 F6

sm64-port/src/pc/gfx/gfx_retro_dc.c:1187 ,offset 00090040, 0x8c0A0040

Code: Select all

static void gfx_calc_and_set_viewport(const Vp_t *viewport) {
    // 2 bits fraction
    float width = 2.0f * viewport->vscale[0] / 4.0f;
    float height = 2.0f * viewport->vscale[1] / 4.0f;
/* LINE: 1187 */    float x = (viewport->vtrans[0] / 4.0f) - width / 2.0f;
    float y = SCREEN_HEIGHT - ((viewport->vtrans[1] / 4.0f) + height / 2.0f);
   
    width *= RATIO_X;
    height *= RATIO_Y;
    x *= RATIO_X;
    y *= RATIO_Y;
   
    rdp.viewport.x = x;
    rdp.viewport.y = y;
    rdp.viewport.width = width;
    rdp.viewport.height = height;
   
    rdp.viewport_or_scissor_changed = true;
}

and RATIO_X + RATIO_Y are sourced from here

static void gfx_dc_get_dimensions(uint32_t *width, uint32_t *height) {
    *width = SCR_WIDTH; /* 640 */
    *height = SCR_HEIGHT; /* 480 */
}


what values there would i be aiming for? 854x480 for 16:9 ?


Code: Select all

FIND
4C 41 EB 8C AB AA AA 3F
REPLACE
4C 41 EB 8C 00 00 80 3F

sm64-port/src/game/skybox.c:286, offset 000116E6, 0x8c0216E6

Code: Select all

void *create_skybox_ortho_matrix(s8 player) {
    f32 left = sSkyBoxInfo[player].scaledX;
    f32 right = sSkyBoxInfo[player].scaledX + SCREEN_WIDTH;
    f32 bottom = sSkyBoxInfo[player].scaledY - SCREEN_HEIGHT;
    f32 top = sSkyBoxInfo[player].scaledY;
    Mtx *mtx = alloc_display_list(sizeof(*mtx));

#ifdef WIDESCREEN
    f32 half_width = (4.0f / 3.0f) / GFX_DIMENSIONS_ASPECT_RATIO * SCREEN_WIDTH / 2;
    f32 center = (sSkyBoxInfo[player].scaledX + SCREEN_WIDTH / 2);
    if (half_width < SCREEN_WIDTH / 2) {
        // A wider screen than 4:3
        left = center - half_width;
        right = center + half_width;
    }
#endif

    if (mtx != NULL) {
#if defined(TARGET_DC)
        guOrtho(mtx, left, right, bottom, top, -20.0f, 1.01f, 1.0f);
#else
        guOrtho(mtx, left, right, bottom, top, 0.0f, 3.0f, 1.0f);
#endif
    } else {
    }

    return mtx;
}

which could easily be changed here in guOrtho

Code: Select all

void guOrtho(Mtx *m, float left, float right, float bottom, float top, float near, float far,
             float scale) {
    float sp28[4][4];
    guOrthoF(sp28, left, right, bottom, top, near, far, scale);
    guMtxF2L(sp28, m);
}

like for the PSP for example, note my old comment ;)

Code: Select all

void guPerspective(Mtx *m, u16 *perspNorm, float fovy, float aspect, float near, float far,
                   float scale) {
    float mat[4][4];
/* Really this is a native 16:9 aspect rendering hack, could be used on dc for anamophic */
#if defined(TARGET_PSP)
    guPerspectiveF(mat, perspNorm, fovy, aspect*(1.0f/0.75555555555f), near, far, scale);
#else
    guPerspectiveF(mat, perspNorm, fovy, aspect, near, far, scale);
#endif
    guMtxF2L(mat, m);
}


Code: Select all

FIND
AB AA AA 3F 00 00 02 00 FF 88 01 89 A5 AE FF 70
REPLACE
00 00 80 3F 00 00 02 00 FF 88 01 89 A5 AE FF 70

sm64-port/src/pc/gfx/gfx_retro_dc.c:728, offset 0008FB4C, 0x8c09FB4C

i think you're hitting this.

Code: Select all

        float x = v->ob[0] * rsp.MP_matrix[0][0] + v->ob[1] * rsp.MP_matrix[1][0] + v->ob[2] * rsp.MP_matrix[2][0] + rsp.MP_matrix[3][0];
        float y = v->ob[0] * rsp.MP_matrix[0][1] + v->ob[1] * rsp.MP_matrix[1][1] + v->ob[2] * rsp.MP_matrix[2][1] + rsp.MP_matrix[3][1];
        float z = v->ob[0] * rsp.MP_matrix[0][2] + v->ob[1] * rsp.MP_matrix[1][2] + v->ob[2] * rsp.MP_matrix[2][2] + rsp.MP_matrix[3][2];
        float w = v->ob[0] * rsp.MP_matrix[0][3] + v->ob[1] * rsp.MP_matrix[1][3] + v->ob[2] * rsp.MP_matrix[2][3] + rsp.MP_matrix[3][3];

        x = gfx_adjust_x_for_aspect_ratio(x);

but that is only used for polygon clipping, and would adjust if the first change was made, as gfx_adjust_x_for_aspect_ratio() also uses the reported screen height+width

Code: Select all

FIND
AB AA AA 3F 3C 41 DE 8C
REPLACE
00 00 80 3F 3C 41 DE 8C


couldnt find this at all, whats the meaning of the change?

for reference: id love to work with you on this
https://github.com/mrneo240/sm64-port/blob/master/src/pc/gfx/gfx_retro_dc.c

https://github.com/mrneo240/sm64-port/blob/master/src/pc/gfx/gfx_gldc.c

dcsteve
undertow
Posts: 27

Re: Super Mario 64 Port for Dreamcast is possible ?

Post#207 » Mon Oct 05, 2020 6:41 pm

really, nobody replied to help him in almost a week? MrNeo, you should reach out to Simulant at https://gitlab.com/simulant/simulant. They recently reprogrammed the sound of their DC 3d game engine from OpenAL to AICA directly which sped up the engine substantially.

https://simulant.dev/blog/

mrneo240
Rank 9
Posts: 926

Re: Super Mario 64 Port for Dreamcast is possible ?

Post#208 » Mon Oct 05, 2020 9:36 pm

dcsteve wrote:really, nobody replied to help him in almost a week? MrNeo, you should reach out to Simulant at https://gitlab.com/simulant/simulant. They recently reprogrammed the sound of their DC 3d game engine from OpenAL to AICA directly which sped up the engine substantially.

https://simulant.dev/blog/

I was the third member to join, it's the place to be if you're doing current dev for dreamcast.

Unfortunately that isn't very applicable here, you would need to to rip out the entire sound and music engine from sm64 and rewrite one from scratch. It's not gonna be me ever.

But if someone wants to fork and do that it would be radical

User avatar
fafadou
Gold Lion
Posts: 1662

Re: Super Mario 64 Port for Dreamcast is possible ?

Post#209 » Tue Oct 06, 2020 3:08 am

If you have some time to care with a very beginner and if everything is explain step by step please tell me what should I do for it :-) :

I guess @dcsteve is talking about that :
"New Dreamcast Audio API
Previously Simulant used ALdc 1.0. This was an OpenAL implementation for the Dreamcast that did all mixing on the main SH4 processor, before sending audio over to the AICA sound processor.

Not only was this slow and wasteful, but there were a number of bugs that were never resolved. In preparation for Simulant 20.09 the Simulant team has reimplemented ALdc from scratch. Leveraging the AICA directly, and its 64 available channels to provide faster and better audio."

User avatar
Protofall
undertow
Posts: 28
Contact:

Re: Super Mario 64 Port for Dreamcast is possible ?

Post#210 » Tue Oct 06, 2020 6:39 am

fafadou wrote:If you have some time to care with a very beginner and if everything is explain step by step please tell me what should I do for it :-) :

I guess @dcsteve is talking about that :
"New Dreamcast Audio API
Previously Simulant used ALdc 1.0. This was an OpenAL implementation for the Dreamcast that did all mixing on the main SH4 processor, before sending audio over to the AICA sound processor.

Not only was this slow and wasteful, but there were a number of bugs that were never resolved. In preparation for Simulant 20.09 the Simulant team has reimplemented ALdc from scratch. Leveraging the AICA directly, and its 64 available channels to provide faster and better audio."


ALdc2 is an improvement, but the underlying sound code structure of SM64 needs to be re-done for DC specifically to get any real change.

  • Similar Topics
    Replies
    Views
    Last post

Return to “New Releases/Homebrew/Emulation”

Who is online

Users browsing this forum: No registered users