Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix error when compiling with latest PS2 SDK #4

Merged
merged 4 commits into from
Jul 28, 2024

Conversation

CosmicScale
Copy link
Contributor

@CosmicScale CosmicScale commented Jul 18, 2024

Pull Request checklist

Note: these are not necessarily requirements

  • I reformatted the code with clang-format
  • I checked to make sure my submission worked
  • I am the author of submission or have permission from the original author
  • Requires update of the PS2SDK or other dependencies
  • Others (please specify below)

Pull Request description

@CosmicScale
Copy link
Contributor Author

With these modifications the code compiles without any errors or warnings on the latest PS2SDK however, when the app is run all that is displayed is a black screen. Any ideas?

@fjtrujy
Copy link

fjtrujy commented Jul 19, 2024

The linkfile from wLE is not right, it has a bug, actually the same bug that I solved here.
ps2dev/ps2link#56

I think this app was trying to load the app at the 0x84000 address, ps2link uses 0x94000 which allows us to load the ELF without the need of having another elf in the middle. Not sure if your app requires it to be at 0x84000 or if it can be safely at 0x94000.

Finally, keep in mind that if your app is going to use the 0x84000 load address, this will require a loader in the middle in order to work, which basically means, you need to try always the elf after running ps2-packer for instance.

Cheers

@fjtrujy
Copy link

fjtrujy commented Jul 19, 2024

With these modifications the code compiles without any errors or warnings on the latest PS2SDK however, when the app is run all that is displayed is a black screen. Any ideas?

Have you tried with PCSX2? Can you put printf messages to see what's happening?

@AKuHAK
Copy link
Member

AKuHAK commented Jul 19, 2024

@fjtrujy I think its safe to remove -Tlinkfile completely?

@fjtrujy
Copy link

fjtrujy commented Jul 19, 2024

@fjtrujy I think its safe to remove -Tlinkfile completely?

What do you mean? the one here?

@CosmicScale
Copy link
Contributor Author

Okay, I've replaced the linkfile with the one from ps2link and modified the Makefile to pack the elf. I think that did it! I'm unable to test it fully at the moment because I don't have access to my SCPH-50001 console BUT I've tested it on a PAL console with a PAL PS1 game and the game booted.

@fjtrujy
Copy link

fjtrujy commented Jul 19, 2024

Okay, I've replaced the linkfile with the one from ps2link and modified the Makefile to pack the elf. I think that did it! I'm unable to test it fully at the moment because I don't have access to my SCPH-50001 console BUT I've tested it on a PAL console with a PAL PS1 game and the game booted.

If you use the ps2link linkfile as it is, using the 0x94000 as start address you don’t even require to pack the elf.
To pack the elf was a solution in case you wanted to use the 0x84000 start address (that was the previous start address being used).
I think you can safely use 0x94000.

Anyway I’m happy to see it worked!

@CosmicScale
Copy link
Contributor Author

Thanks for the help @fjtrujy

@AKuHAK
Copy link
Member

AKuHAK commented Jul 22, 2024

@CosmicScale so, is the PR ready for merge?

@CosmicScale
Copy link
Contributor Author

@CosmicScale so, is the PR ready for merge?

Well, it compiles now but using the ps2link linkfile is not an ideal solution. Ideally the linkfile should be modified or better still, completely removed. I've been trying to implement gsKit into the code, that's a no go with this linkfile

@fjtrujy
Copy link

fjtrujy commented Jul 22, 2024

@CosmicScale so, is the PR ready for merge?

Well, it compiles now but using the ps2link linkfile is not an ideal solution. Ideally the linkfile should be modified or better still, completely removed. I've been trying to implement gsKit into the code, that's a no go with this linkfile

I think you might be wrong.
This repo requires to have a custom start address, as it needs to "live" outside of the memory region, and this is why we require to have a linkfile.
It is true that the linkfile could be in ps2sdk or similar, but the reality is that every single "strange app" (as this one), could have different requirements, making it impossible to have a single linkfile that fulfill all the requirements (I didn't collect all the possible scenarios).

Regarding the inclusion of gskit in this app, the use of a custom linkfile is not a "blocker" itself, the blocker you may phase is the available space possible to use.
Once again, this app needs to be executed in the "bram" that goes from 0x094000 to 0x10000 so you have around 432K (with some tricks you could start from 0x084000 having some more available space).
When including gskit it will force you to link with a couple of more dependencies and the size will increase for sure, however, I can't tell you if it will be enough or not.

So regarding the state of the PR, which is the question that @AKuHAK raised before if the project is currently compiling and working using the latest toolchain, I think it is already huge progress and should be merged.
Then additionally you can still keep working on including gsKit features, if possible on a separate branch or PR

Cheers

@CosmicScale
Copy link
Contributor Author

I didn't realise how strange this app was tbh.

I still haven't been able to fully test the app because I still haven't got access to my console that can play PS1 games from different regions. I guess everything should still work. If somebody could test and confirm functionality, it would be ready for merge.

@AKuHAK AKuHAK marked this pull request as ready for review July 22, 2024 19:03
@CosmicScale
Copy link
Contributor Author

I confirmed that the raw elf will not boot. I modified the Makefile to delete the raw elf after packing it to prevent confusion.

@fjtrujy
Copy link

fjtrujy commented Jul 23, 2024

I confirmed that the raw elf will not boot. I modified the Makefile to delete the raw elf after packing it to prevent confusion.

Using ps2link's linkfile it should boot even the uncompressed version, 0x094000 is a safe address to boot without loaders in the middle, it should boot if you use for instance PCSX2.

However, if you use wLe or OPL to bot it, it won't boot, and the reason is that those apps require an "elf loader binary", and this binary is allocated in the same region where you are allocating PS1VModeNeg.

This is why the packed version somehow skips this issue.

@CosmicScale
Copy link
Contributor Author

I confirmed that the raw elf will not boot. I modified the Makefile to delete the raw elf after packing it to prevent confusion.

Using ps2link's linkfile it should boot even the uncompressed version, 0x094000 is a safe address to boot without loaders in the middle, it should boot if you use for instance PCSX2.

However, if you use wLe or OPL to bot it, it won't boot, and the reason is that those apps require an "elf loader binary", and this binary is allocated in the same region where you are allocating PS1VModeNeg.

This is why the packed version somehow skips this issue.

Yeah, I tried it on PCSX2 and was wondering why it booted on there and not on original hardware. Now I know :)

@AKuHAK AKuHAK merged commit aa470fc into ps2homebrew:main Jul 28, 2024
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants