mogzol / BrawlBuilder

The Ultimate Super Smash Bros Brawl ISO Builder
MIT License
51 stars 4 forks source link

Produces broken Project M ISOs #4

Closed cheatfreak47 closed 7 years ago

cheatfreak47 commented 7 years ago

Something I haven't seen mentioned anywhere is how this produces broken Project M ISOs.

Some levels just crash the console entirely. Particularly, Super Mario Sunshine (accessed by holding L on dolphino secret) and Wario Ware, both just crash the Wii.

Since this is a problem I assume there may be more unknown issues going on as well. Which is bad?

Any input?

mogzol commented 7 years ago

Yup, I am aware of this. Not sure what is causing it though, since some alt stages work fine and others don't. I assume my hack to enable loading alt stages from the ISO causes project m to freak out and crash in certain scenarios. You can try hacking around in debug mode in dolphin to see if you can find a solution. You can modify the hacks that BrawlBuilder applies by editing the CodePatches.txt file. If you find anything let me know!

cheatfreak47 commented 7 years ago

I would but the problem is I'm only able to test on real hardware. I don't play with dolphin, I play with USB Loader GX. I can't run dolphin. ^_^;

I also made a post on the reddit regarding this to see if anyone in the P:M community knows what the cause is. https://www.reddit.com/r/SSBPM/comments/51tl2p/building_a_working_project_m_iso_for_usb_loading/

Have you made any attempt to figure out the cause? I mean, this is a pretty serious issue with the builder, it producing ISOs with non-functional portions of the mods would definitely cause people headaches, especially considering this project has been around for a long time and I've seen no mention of the issue anywhere, until now.

mogzol commented 7 years ago

I have tried looking for the cause, I don't have much free time these days though, and trying to decipher powerpc assembly code is not the easiest task in the world. I don't see it as a super serious issue, at least most alternate stages are playable, I mean prior to BrawlBuilder 3.6 P:M ISOs couldn't access alternate stages at all.

If I get more free time in the future I'll try to fix this, as well as look into what is causing mods like Legacy M not to boot.

cheatfreak47 commented 7 years ago

That'd be much appreciated, it really would be quite nice to have a standalone ISO of project M available, glad to know I'm not alone with this issue at least.

Until then, I think what I'll probably do is use WIT to inject a new banner, edit the ID to Project M and set up my SD card so my USB Loader boots project M when I pick it.

Good luck figuring it out whenever you get around to it.

mogzol commented 7 years ago

Good news, I found the problem, I'll probably have a fix up later today! UPDATE: Ran into a bit of a roadblock, I'll try to get it updated before next week though.

If anyone reading this is curious as to what the problem was, it was that I overlooked a major quirk of the way project m handles loading alternate stage files. With an actual project m install, alternate stage file names are suffixed with an _Z (and then _Y, _X, etc. for multiple alternate stages). When loading these stages, project m will look on the SD card for the stage's .pac file, as well as the corresponding .rel file. So for example, Delfino Plaza's .pac file is called STGDOLPIC_Z.pac (since in Project M Delfino Plaza is an alternate stage), and Delfino's Secret (the Project M base stage) is just STGDOLPIC.pac.

Now when project m (and similar sd-based brawl mods) load files from the SD, if the file can't be found, it falls back to loading the original file from disc. With alternate stages, however, when it falls back to disc, the suffix is removed (since obviously the disc itself won't have alternate stages). This is why alternate stages didn't work with P:M 3.6 ISOs prior to BrawlBuilder. Project M would look for the alternate stage on SD, and not find it (since everything is on the disc) and then fall back to the base, non-alternate version on the disc.

BrawlBuilder modifies Project M's code a bit to trick it into looking for the SD files on the disc, rather than the SD. This solves the problem above, since it now searches the disc for the alternate stage files. Note that if a file isn't found, then it will still attempt to fall back to the disc in hopes of finding the original file (even though we were looking on the disc for the file in the first place). With alternate stages, this means that if it fails to find the alternate stage file on the disc, it will fall back to loading just the base stage file (since when it falls back it removes the suffix).

Now then, on to the issue. The Project M devs cleverly utilized this behaviour in a way that I was not expecting (though it makes sense, since it saves some space). With stages like Delfino Plaza, where they moved the original stage to be the alternate, and then used a new stage as the base, they only included the base stage's .rel file. So when you load the base stage, Delfino's Secret, which is STGDOLPIC.pac, project m loads stgdolpic.rel from the sd card. Good, that all makes sense and works fine. Now here's the tricky bit. When you load the alternate stage (which is the original Brawl Delfino Plaza) project m will load STGDOLPIC_Z.pac fine from the sd card, but then since the Project M devs did not include stgdolpic_z.rel (which would just be the original brawl stgdolpic.rel file), it falls back to loading stgdolpic.rel from the disc. This works great with an actual project m install, since Delfino Plaza originally came with Brawl, so using the original .rel file works perfectly. With BrawlBuilder, however, the stgdolpic.rel file was replaced with Delfino's Secret's .rel file (since all the project m files get copied to the disc, overwriting the originals). Depending on the stage, this will either cause some major issues or, in the case of Delfino Plaza, a full blown crash.

cheatfreak47 commented 7 years ago

So what I gather from this is that the appropriate solution is to copy the original stage's rel file from the brawl resources and rename it in the event that a _z stage exists but it's corresponding _z rel file doesn't?

Doesn't sound too difficult to me. Hope the fix will be added soon! Thanks for looking into it so quickly, btw. (:

mogzol commented 7 years ago

Essentially yes. It's a bit more complicated to account for all scenarios and actually implement in a somewhat clean/efficient way, but that's the basic idea. Shouldn't take too long, I'll probably be able to finish it after I get off work tomorrow. If not then then definitely over the weekend sometime.

mogzol commented 7 years ago

New release is up, it seems to have fixed the issue for me, give it a try

EDIT: screwed something up one sec

EDIT 2: Ok its fixed

cheatfreak47 commented 7 years ago

This may need to be re-opened for fixing the Wario Land alt stage crash.