-
Notifications
You must be signed in to change notification settings - Fork 11
Macos support #28
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
base: main
Are you sure you want to change the base?
Macos support #28
Conversation
This PR contains many unrelated changes to formatting as well as a version bump that are wholly out of scope. Additionally this conflicts with my PR #20. Changes regarding Unleashed Recompiled should not be merged before the official release. Things are not set in stone and stuff like the name of the bundle may be subject to change still, which would break functionality here. |
jaydenpham@Skibidi-toilet-ohio-gyatt-rizz-sigma-alpha ~ % cd /Users/jaydenpham/Downloads/HedgeModManager/Source/HedgeModManager.UI Build failed with 1 error(s) in 0.5s do you know a fix? since you've already successfully built it do you think you could just drop the .app file? |
nevermind, I fixed it by using the command cd to go to the folder hedgemodmanager.ui, and then changing the terminal command to "dotnet publish -r osx-arm64 -c Release --self-contained true", which didn't create a .app file but it did give me what i needed to start the app with " ./HedgeModManager.UI". |
{ "Macos", new("UnleashedRecomp", "UnleashedRecomp") }, |
Status:
|
Keep in mind this only works with unleashed as of now If you pulled the latest changes, you will find under HedgeModManager/ModdableGameLocator that line 136 is commented. You need to uncomment it before building. |
Odd, I think your branch needs a rebase
FYI, I am pro a consistent formatting style but later using
I was mainly referring to the build method. I spoke to SuperSonic16 and afaik she would prefer if it was all contained within one PR. I'm happy to PR to your branch or vice versa.
I will need to review these changes closely; Unleashed Recomp is an outlier; all other Sonic games on macOS will need to be launched through Wine. |
I've rebased my changes on main |
if (SelectedGame.Game.ModLoaderConfiguration is ModLoaderConfiguration config) | ||
await config.Save(Path.Combine(SelectedGame.Game.Root, "cpkredir.ini")); | ||
{ | ||
// For macos, save under the user's Application Support directory. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
*macOS
if (OperatingSystem.IsMacOS()) | ||
{ | ||
var appSupportDir = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData); | ||
await config.Save(Path.Combine( appSupportDir,SelectedGame.Game.Executable, "cpkredir.ini")); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
await config.Save(Path.Combine(appSupportDir, SelectedGame.Game.Executable, "cpkredir.ini"));
Source/HedgeModManager/GameSimple.cs
Outdated
WorkingDirectory = Root, | ||
UseShellExecute = true | ||
}); | ||
// The command to launch macos apps is |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
*macOS
Source/HedgeModManager/GameSimple.cs
Outdated
}); | ||
// The command to launch macos apps is | ||
// open -a path/to/my/app/appname | ||
// When the app is inside the Application folder only the app's name is needed. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That being said, I think it would be better to opt for the full file path for specificity.
games.Add(game); | ||
} | ||
} | ||
if (OperatingSystem.IsMacOS() && gameInfo.PlatformInfos.TryGetValue("Macos", out var macosDesktopInfo)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Correct Macos
-> macOS
|
||
var gameSimple = new GameSimple( | ||
"Macos", macosDesktopInfo.ID, gameInfo.ID, | ||
"/Applications", macosDesktopInfo.Executable, "Macos", "" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You have to be careful assuming /Applications
. Things can also be installed to ~/Applications
macos/generate-bundle.bash
Outdated
mkdir "$APP_NAME/Contents/Resources" | ||
|
||
# Create Info.plist inside the bundle | ||
cat > "$APP_NAME/Contents/Info.plist" << EOF |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would prefer if this was actually a file in the repo instead of being cat'd out
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was so in github workflows, the version and bundle name can be passed as arguments. Though I don't disagree
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would like this to be in its own file if it can be easily done. Maybe you could look into string substitution, I think some people had used the sed
command.
docs/BUILDING.md
Outdated
``` | ||
```bash | ||
cd macos | ||
/bin/bash macos/generate-bundle.bash com.hedge_dev.hedgemodmanager 8.0.3 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As of macOS Catalina, zsh is the default shell on Mac
docs/BUILDING.md
Outdated
|
||
## 2. Build the project | ||
|
||
### Macos |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Macos
-> macOS
} | ||
if (OperatingSystem.IsMacOS() && gameInfo.PlatformInfos.TryGetValue("Macos", out var macosDesktopInfo)) | ||
{ | ||
// The root is actually not necessary on macos |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i feel like there should still be a root here as by default the data for unleashed is held in "~/Library/Application Support/UnleashedRecomp", and having the mod folder there makes it more similar to other platforms. maybe try something like this
// The root is actually not necessary on macos | |
string root = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.UserProfile), | |
"Library", "Application Support", "UnleashedRecomp"); | |
if (Directory.Exists(root)) | |
{ | |
var gameSimple = new GameSimple( | |
"Macos", macosDesktopInfo.ID, gameInfo.ID, | |
root, macosDesktopInfo.Executable, | |
"Macos", "", "" | |
); | |
var game = new ModdableGameGeneric(gameSimple) | |
{ | |
SupportsDirectLaunch = true, | |
SupportsLauncher = false, | |
Is64Bit = gameInfo.Is64Bit | |
}; | |
game.ModDatabase.SupportsCodeCompilation = gameInfo.SupportsCodes; | |
games.Add(game); | |
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Makes sense.
Will try the changes
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note that Application Support should be accessed using Environment.SpecialFolder.ApplicationData
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When I tried to pull and build the project, it didn't work right. It wouldn't save config files or be able to boot the game. I tried fixing the code myself, but it still had trouble detecting mods and saving.
The suggested fixes above worked, and HMM runs great for me.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have made changes to GameSimple
, though it should be simple to work around for macOS. What I changed is making it work a bit more like running a command instead of executable and arguments.
Also please change all the Macos
to macOS
or MacOS
, I think using the proper capitalisation would be good here.
my terminal says command not found dotnet what do i do |
is there a .app download? |
@adoobly you need to install dotnet and then run |
@thesupersonic16 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have made some comments and some change requests. Please reply to the comments.
Also make sure to update build-project.yml
aswell.
I'll go through the change requests. |
@thesupersonic16 Reverted the change to saving |
Check your PRs on your fork |
I believe it's the mod loaders that don't work with crossover. There is an issue on the HMM 7 repo about that. Ideally a standard needs to be made for this as I never heard macOS having a Steam client that runs the games. After that is worked out, code could be added to setup whatever is needed get the games running with the mod loaders. I really do not want HMM 8 to have code designed just to run under wine/crossover. |
macOS support has been merged into the main repo of UnleashedRecomp, I hope to see this PR cleaned up and merged soon to accompany that |
I cannot work on macOS support without having a machine that runs it. I am currently waiting for when this PR is ready for another review. |
I will try to pick up where I left this weekend |
You also have a PR on your repo, so you may want to look into that aswell. |
Adds support for Macs builds and UnleahsedRecomp
Can be built from code using the following command
TODO: