natinusala / borealis

Hardware accelerated, controller and TV oriented UI library for PC and Nintendo Switch (libnx)
Apache License 2.0
260 stars 83 forks source link

Set BOREALIS_RESOURCES to default to romfs:/ #33

Closed meganukebmp closed 4 years ago

meganukebmp commented 4 years ago

This fixes compilation under Windows paths without breaking unix paths

natinusala commented 4 years ago

You also need to remove the -D from the Switch Makefile

meganukebmp commented 4 years ago

I should probably do this type of stuff earlier through the day

natinusala commented 4 years ago

There is actually one use case that I had forgotten about, where the borealis resources are in a subfolder of romfs - EdiZon and sys-clk manager do that: BOREALIS_RESOURCES="romfs:/library/borealis. That way they can put their own resources in romfs next to the borealis ones.

I would rather not break that feature 😕

meganukebmp commented 4 years ago

Tracking this issue down further, I'm about to go insane. Might as well be an issue with MSYS2. Seems that the way it converts unix paths to windows ones and vice versa is some magic text parsing. Which in this event is attempting to flip the backslashes in the romfs escapes into unix forward slashes and making a big mess in the process. Disabling the conversion with MSYS2_ARG_CONV_EXCL="*" technically fixes the problem but only if it's being built out of the virtual root. If one tries to build out of the fake links to a windows path it fails miserably.

I still think this needs to be solved somehow. Either on this or on MSYS2. Could potentially be walling off new developers who arent yet ready to jump ship to *nix. I'll keep looking into it.

p-sam commented 4 years ago

Yeah this won't work, we already found a solution using MSYS2_ARG_CONV_EXCL this morning though. I'll push the PR to disable it for defines only, which seems to be a better solution. I don't really want to bury the default value inside headers, and apps overriding it would still be stuck with the same behavior happening.

meganukebmp commented 4 years ago

I figured it out as well. The problematic part is the macro expansion when passing the define to the preprocessor. -DBOREALIS_RESOURCES="\"$(BOREALIS_RESOURCES)\"" to be specific. The way MSYS2_ARG_CONV_EXCL works is that it can ignore values after specified prefixes. This is not a problem with the repository at hand. It's all sound here. It's Microsoft's genius of using the escape character as a path delimiter and the various hacks around all of it. I'm getting proper builds by exporting MSYS2_ARG_CONV_EXCL="-DBOREALIS_RESOURCES=" before running make. I feel like this should at the very least be documented somewhere. No need to change the repo, it's a platform specific problem. I'll do a PR on the readme.