fgsfdsfgs / sm64-port

PS2, PS3, OG Xbox and DOS ports of sm64-port.
https://discord.gg/7bcNTPK
242 stars 38 forks source link

Working ps2 elf #72

Open xdccrlz opened 1 year ago

xdccrlz commented 1 year ago

Does anyone have a working elf going for the ps2 branch? If so, under which host system?

xdccrlz commented 1 year ago

I tried to collect all the options from 6.02.22 to 15.10.20: none works, even if it is being assembled and launched. Moreover, the elf turns out to be 14.3MB in size, that is, less than the 16 MB working elf available on the network.

xdccrlz commented 1 year ago

If the problem is in the new toolchain, is it possible to find out which toolchain is ok? I tried using different versions of ps2dev: either errors come out, or everything compiles, but it doesn't work.

xdccrlz commented 1 year ago

The problem is related to the sm64 docker image. If someone solves this problem, then anyone will do the assembly according to the instructions. In the current case, we can use the mkst sm64 docker image, which allows us to compile a working build.

xdccrlz commented 1 year ago

With the latest ps2dev update from 09/20/2022, everything is working correctly again...but only on emulator((( On the real ps2 black screen yet.

fgsfdsfgs commented 1 year ago

The last successful build I made was back in 2020, and now I no longer have a PS2, so unfortunately I can't help right now. If you're doing this after the build is done, the resulting ELF will be compressed and as such will take a pretty long time to decompress on a real PS2, during which time it will just show a black screen, so you might need to just wait a bit.

xdccrlz commented 1 year ago

Thank you very much for the answer. I'm not compressing the resulting ELF. ELF was loaded on Play+, but had no control, and on PCSX2 it worked with full functionality. On the real hardware (ps2 90004 pal and ps2 90004 ntsc) I had a black screen. If I use mkst docker sm64 image from 1 year ago, then ELF is compiled and loaded on emu and ps2.

metchebe commented 1 year ago

The problem is related to the sm64 docker image. If someone solves this problem, then anyone will do the assembly according to the instructions. In the current case, we can use the mkst sm64 docker image, which allows us to compile a working build.

Hi @xdccrlz . Could you please elaborate on this? I don't see a difference in the mkst dockerfile that would be of importance. Do you mean that you have kept a docker image built last year (presumably with a year-old sdk) that works?

xdccrlz commented 1 year ago

I believe that mkst has not updated its docker image since August last year, when work on the project stopped on active sm64-port/ps2 forks. At the same time, in August 21, the ps2dev version was released, as a result of which a working elf was compiled. Unlike the build of 20, it allowed only two correctly working modes: 480i and 480p, and it started working after applying more than one patch: for example, 60fps and widescreen. The assembly with the old toolchain allowed not only to apply patches, but also worked with all modes of progressive scan using gsm. After switching to the new toolchain, gsm became useless. And with the capabilities of gskit_hires, somehow they didn't really figure it out. As a result, after 09/20/12, new versions of ps2dev allow you to build a working build, but, as already mentioned, only in two modes, probably this is enough. It was important for me to get a high-quality full-screen picture without disproportions, I got it. But without finding out what exactly in the toolchain breaks the assembly without visible errors, we risk getting a black screen again at any time.

xdccrlz commented 1 year ago

And another important point, it's not the mkst docker file, which is not involved in the compilation at all, but the sm64 docker image, which contains a year-old "successful" version of ps2dev.

metchebe commented 1 year ago

And another important point, it's not the mkst docker file, which is not involved in the compilation at all, but the sm64 docker image, which contains a year-old "successful" version of ps2dev.

Yes thank you for the answer and clearing that up. Indeed I agree but if the docker image is built now according to the instructions (step 3), it will have the non-working SDK.

So the follow-up question is: how do I get or build the docker image today with the working sdk?

Sorry if I'm missing or not understanding something... thanks again for replying.

xdccrlz commented 1 year ago

Apparently, you need to purge docker from the old image, which is picked up by being detected locally. Then the first command with docker will go online for the latest ps2dev, which, as mentioned above, is quite a working one.

xdccrlz commented 1 year ago

I will add that the image should not only be removed from the images section, but also run command to purge in the docker settings.

xdccrlz commented 1 year ago

As I expected, the new ps2dev development build broke elf again: hello, black screen!

xdccrlz commented 1 year ago

IMHO the optimal build is obtained if:

  1. take the version from 4.08.21
  2. change the ps2dev version in the docker file from v1.1 to v1.2.0
  3. Raise the chroma from 16 to 24 bits in gfx wapi
  4. If desired / necessary, put patches. As a result: graphics with almost no artifacts, smooth running without screen twitching and fading/ acceleration after saving, and the ability to set any video mode up to 1080p 60 Hz via GSM.
metchebe commented 1 year ago

@xdccrlz excellent thank you.

Pardon my ignorance, would you mind explaining how to do step 3? Thanks.

xdccrlz commented 1 year ago

src/pc/gfx/gfx_ps2_wapi.c string 86 gs_global->PSM = GS_PSM_CT16 change to gs_global->PSM = GS_PSM_CT24

metchebe commented 1 year ago

Thanks! I saw that that color depth had been fixed in a recent PR. I wanted to build this with as many updates as possible, so instead of going back to code from 04.08.21 I tried the following based on your advice:

  1. Download latest ps2 branch with git.
  2. Change ps2dev from latest to 1.2.0.
  3. Undo pull requests #59, #56 and #55.
  4. Manually do the changes from pull request #59.
  5. Manually re-add files from ps2-audsrv dependency.
  6. Build, strip and pack.

Everything seems to be working ok with good colors and the gray bars removed from the main screen. Also packing the elf does not increase load times by much (if at all), at least from a usb drive and the resulting elf is 4.9 MiB.

xdccrlz commented 1 year ago

A good plan and a competent approach! Although, the amount does not change from changing the places of the terms. A typical dialectical story: the sm64 project for ps2 gave impetus to the development of ps2dev, which raised ps2 emulation to a new level, allowing the use of an extensive ps2 library on various devices with a quality exceeding the capabilities of ps2. But, at the same time, applications created on ps2dev stopped working correctly on a real ps2. Because the sdk is not intended for the console, but for its emulation. Head over heels.

xdccrlz commented 1 year ago

Thanks! I saw that that color depth had been fixed in a recent PR. I wanted to build this with as many updates as possible, so instead of going back to code from 04.08.21 I tried the following based on your advice:

  1. Download latest ps2 branch with git.
  2. Change ps2dev from latest to 1.2.0.
  3. Undo pull requests Update gfx_ps2_rapi.c #59, Improve timing for PS2 #56 and Improvements PS2 New toolchain #55.
  4. Manually do the changes from pull request Update gfx_ps2_rapi.c #59.
  5. Manually re-add files from ps2-audsrv dependency.
  6. Build, strip and pack.

Everything seems to be working ok with good colors and the gray bars removed from the main screen. Also packing the elf does not increase load times by much (if at all), at least from a usb drive and the resulting elf is 4.9 MiB.

Your approach is more elegant, thank you!

fgsfdsfgs commented 1 year ago

Instead of rolling back to the old SDK it would be more correct to look into why this doesn't work on real HW with the new one sometimes, because I'm pretty sure fjtrujy tested it after upgrading and it worked. But for now this would be the best solution.

xdccrlz commented 1 year ago

I completely agree, moreover, a few posts ago I stated the same thing. But, if I can still figure out the code of this project, then, alas, I have no way to look for a black cat in the ps2dev room. As for fjtrujy's requests, I can't support you so fervently, because, firstly, using his ps2dev fork, I also failed to get a working build, and secondly, all his pr from August 2021, imho, did not greatly improve the project, at least deprived it of the opportunity work with the GSM utility.

xdccrlz commented 1 year ago

In no case should take all of the above as a claim to anyone! All of you who are somehow involved in this project are great fellows and clever! Thank you for the fact that this project exists!

xdccrlz commented 1 year ago

fjtrujy today posted ps2dev. Build works only on emulators.

sounddrill31 commented 1 year ago

What patches exactly? I want to create a branch in a fork

xdccrlz commented 1 year ago

Widescreen and 60fps. Last patch must be fixed: it’s very old and conflict with some files.

sounddrill31 commented 1 year ago

Widescreen and 60fps. Last patch must be fixed: it’s very old and conflict with some files.

will try it out, thanks a lot. You mean the following, right? 60fps:https://mario64hacks.fandom.com/wiki/Super_Mario_64_in_60_FPS_Widescreen_4k_resolution (couldn't find widescreen I'm a dum dum)

sounddrill31 commented 1 year ago

Widescreen and 60fps. Last patch must be fixed: it’s very old and conflict with some files.

baserom hash error arising, any idea?

xdccrlz commented 1 year ago

You need to find the right rom file. Some info about http://www.sm64.com/hashes.html. The 60fps patch is located in the enhancements directory. Widescreen patch can be finded here: https://github.com/Reonu/sm64-widescreen

sounddrill31 commented 1 year ago

You need to find the right rom file. Some info about http://www.sm64.com/hashes.html. The 60fps patch is located in the enhancements directory. Widescreen patch can be finded here: https://github.com/Reonu/sm64-widescreen

Will try it out, thanks a bunch!

sounddrill31 commented 1 year ago

You need to find the right rom file. Some info about http://www.sm64.com/hashes.html. The 60fps patch is located in the enhancements directory. Widescreen patch can be finded here: https://github.com/Reonu/sm64-widescreen

So I take the widescreen file from enhancements folder, put it in my enhancements folder and run

tools/apply_patch.sh enhancements/[widescreen patch name]

in base folder using terminal, is that it?

sounddrill31 commented 1 year ago

You need to find the right rom file. Some info about http://www.sm64.com/hashes.html. The 60fps patch is located in the enhancements directory. Widescreen patch can be finded here: https://github.com/Reonu/sm64-widescreen

will skip the patches, the 60fps patch is causing major slowdowns on real hardware

xdccrlz commented 1 year ago

60fps.patch need a fix for gfx_ps2_wapi.c. Widescreen patch is very usefull on the hdtv.

sounddrill31 commented 1 year ago

I see. I am unable to get it working, but will try it out in the future. I personally don't need widescreen but if there's demand, sure.

uyjulian commented 1 year ago

The most common reason for working on real hardware and not on emulator is alignment issues. Buffers on EE should be aligned to 64 bytes, and those on IOP aligned to 16 bytes

sounddrill31 commented 1 year ago

The most common reason for working on real hardware and not on emulator is alignment issues. Buffers on EE should be aligned to 64 bytes, and those on IOP aligned to 16 bytes

I see

fgsfdsfgs commented 1 year ago

Might be fixed now courtesy of fjtrujy.

sounddrill31 commented 1 year ago

Might be fixed now courtesy of fjtrujy.

ooh, will test it out!

sounddrill31 commented 1 year ago

Might be fixed now courtesy of fjtrujy.

my save vanished :(

Will try to debug and see