-
Notifications
You must be signed in to change notification settings - Fork 68
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
[Feature Bounty - $350] MacOS Supported Version of BG3 SE #162
Comments
What are some common BG3 mods that use this script extender? I'm new to this repo. Is the point of this repo to basically add an API for Lua scripting so you can write scriptable mods for BG3? (I'm on a vanilla playthrough on my Mac still 😅) |
I'd pitch in $150 easily. Have an m3 max chip if needed to test as well |
Biggest ones I can think of are 5E Spells (https://www.nexusmods.com/baldursgate3/mods/125) and Appearance Edit Enhanced (https://www.nexusmods.com/baldursgate3/mods/899). Other smaller'ish' ones are the custom class and subclass mods that rely on 5E spells. |
Mods that allow you to get cut dialogue/encounters. Polyamory mods, etc. |
I could pitch in $50. I would really love for there to be a Mac version. I'm on a 2020 Intel iMac. |
I could pitch in $100, but I would like to add one mandatory requirement: the code should be merged to master branch (so we don't end with some bg3se fork with breaking changes that will quickly become outdated). @whispy what do you think? Also I'm on M1 Max macbook and can help with testing. Counting previous contributions, total bounty is now at $650 |
I'm interested in taking a look at porting this but I have only taken a cursory look at the code so not sure how much work or how feasible it is yet. A big part of it would be how similar the macOS build is to the Windows build. If they have the same code structure then we don't need to reverse engineer the game again and can just focus on porting. Otherwise it may require finding new entry-points to hook in the mods and that could be a lot of work. Seems like from Norbyte/ositools#43 that @Norbyte just doesn't have Macs and generally don't have the resources to do this but probably would be receptive to this idea at least? Also, does anyone know if @Norbyte is a commercial entity? Reason I'm asking is that the license for this repository (sorry, boring topic I know) is mostly an MIT license with an additional clause to prevent commercialization. It doesn't really stop us from having a bounty (since the resulting code will still be open source and public) but just wondering about it in general. Otherwise I may start to take a look during the holiday seasons (I'm still busy playing BG3 as I mentioned, so there are conflicting priorities here… 😅). Edit: If I do work on this I'll probably just set up a personal GitHub sponsor profile for this. Other than that I do have Macs to test this with (I maintain a macOS open source app) so hopefully won't need testing help until later on. |
My comment at the DOS2 SE issue is mostly valid for BG3 as well. One thing that should be noted though, is that porting to a different OS is not just a once-off thing. Every time the game is updated adjustments must be made in the SE to follow the changes Larian did to the binary. These aren't necessarily because so many changes were done in the code itself, but rather compilers taking different inlining or optimization decisions, different outcomes caused by PGO, etc. Because of this, updating SE after big patch is often a significant effort (days of work). If you support multiple platforms, every time a game update is made you have to perform the same remapping work on both platforms, test if everything works on every platform, etc. In addition, any time you add a new feature to the SE you need to map it on every supported platform. In essence, support for a new platform means:
He is very much not a commercial entity, just a dude with free time on his hands :P |
Do you have examples of what such multi-day tasks look like that need to be made to make SE work with a game update? I'm curious to see what is involved. Other than that yes, maintenance costs is a frequently ignored cost by anyone other than the maintainer since that person usually ends up having to bear the responsibility. I think if I implement this for macOS I wouldn't mind taking on some of the burden of keeping it up to date as I don't see how someone who doesn't have a Mac can realistically do this to begin with. Given that macOS now has a native port though I think it's at least a worthwhile goal as it's a first party platform for the game now. |
I would be willing to chip in towards the bounty as well. I would also be willing to help out in testing with my Intel Mac if needed. I see the two commits you linked, for those who are new to this process, are you able to share a little more on the steps required to generate those diffs? Is it something that could be partially scripted to lower the maintenance burden of supporting more than one platform? Thanks for all your hard work on this! |
Just coming back to reiterate my support/willingness to chip in for this to be made! :) |
I'd love to pitch in $20 more for this feature. Think that brings the total bounty to $670 if all parties are still interested in porting the Script Extender for Apple Silicone. |
I would also pitch in!! I just want Appearance Edit Enhanced so badly |
Multiple months of work, how much $ would that cost ? |
I don't think it would be months the complexity comes in the mappingsand just knowing the format. Once you have that it's game over. I'd also gladly donate a shoddy Mac mini. But I don't think he'd accept a Po box delivery for a mac |
@Norbyte I'm still looking into this on the side. I have some questions about how you decompiled the app. Seems like the manifest for the decompiled locations are in https://github.com/Norbyte/bg3se/blob/main/BG3Extender/GameHooks/BinaryMappings.xml, where functions like Otherwise, currently I'm looking into a good way to replace the Microsoft Detour usage with a macOS one. From the looks of it there are existing packages to do similar things but they are either unmaintained/barebones, or way over-complicated designed for other purposes. As such I'm debating just implementing it myself as at the basics it's essentially just replacing a couple instructions with a jump and then adding a trampoline function. But this won't be useful if we don't have the entry points for these functions mapped out and decompiled. |
Actually, my example was kind of not a good one because it's clear that Otherwise I'm not sure if porting to the Mac is doable by a third party like me as I'm new to this engine and it seems like a significant of reverse engineering was necessarily and I'm not sure if it's possible for me to retrace the steps on macOS (either for ARM or x86) without understanding how the process works in general to get to what it is right now. Either way I would agree that this seems like a decent amount of work to port. |
@ychin if you're asking what tool to use for reverse-engineering, you may look at IDA Pro, NSA Ghidra or radare2. As far as I know IDA Pro is what so-called "industry standard", although license cost is quite expensive; Ghidra and radare2 both free and open source. But I guess you're more curious how applications are reverse engineered in general, so that is whole different topic. You may want to take some course online before digging in (google: "reverse engineering for beginners" or something similar). |
I guess I'm more asking specifically about what the workflow for reverse engineering BG3 was. I can figure out how to use the tools. The job of a Mac port isn't to write a scripting interface like bg3se from scratch. It's to port the existing mappings to Mac, so I'm not trying to reproduce the months/years of work this project + ositools has done, but to figure out the process that went into each entry in say https://github.com/Norbyte/bg3se/blob/main/BG3Extender/GameHooks/BinaryMappings.xml, so we can generate a corresponding entry for macOS x86 / macOS ARM. But sure, there's a probably tradeoff about whether it's just easier to spend the bounty money on buying a Mac mini for @Norbyte instead which may just be faster. |
Hey! I am a mac user and have a few mods that I would like to use that depend on SE. I am willing to help porting this for Mac. @ychin Look like you already started some work, let me know how I can help. Based on the threads look like it would be helpful if @Norbyte can provide some high level steps (or some code pointers) how to achieve this in Mac. (n00b in the reverse-engineering world, but happy to get my hands dirty :) ) |
Sure @henryhoo I would definitely be interested to collaborate if we progress further. I haven't really started writing any code so to speak, but mostly researching 1) how to properly detour functions in macOS since this repo uses the Microsoft Detour library which is Windows-specific, and 2) how to retrace the reverse engineering done on the Windows/x86 side, as those rely on very explicit bit pattern matching (along with things like fixed string lookups). FWIW I haven't done that much reverse engineering before as well, but I did used to be a game engine/graphics programmer so I do have some experience working with game engine code, and I maintain a Mac app on GitHub so I have an Apple Developer account. |
@ychin, I am happy you're looking into this! Some options for hooking/detouring on MacOS are Mach Override (may be obsolete) and DYLD_INTERPOSE. There are probably other options, but those are just the ones that come to mind. |
And osxinj too |
@whispy I think the libraries you mentioned are there to support overriding loading code from dynamic libraries, similar to But this is also why I'm confused at names like Correct me if I'm wrong though. |
Id chip in $100 towards it as well as a bounty - would be a great thing |
Is there a place where I can follow this project, or will updates be sent here? don’t really have to money to support, but as a Mac player I would really love to keep an eye on this project as it progresses! |
I think this is the issue to track it. I think I and maybe @henryhoo are the people who expressed interests in porting this to Mac. I looked into this last month, but it's a little hard to make progress without any support from the maintainer due to how the detour bindings work. Since it's all done via reverse engineering, what we would need to do isn't just reverse engineering BG3 on the Mac, but also to replicate the steps done in the Windows version of this to provide the same hooks and bindings to the mods. FWIW, the bounty is just a nice bonus. I was going to recommend the bounty be split among people who work on it plus the maintainer of this project anyway since he would be doing a lot of the review work, maintenance, etc. Obviously this is @Norbyte's project though, so it's up to him if he has the time to support this which will be some extra effort for sure. |
I'd love to help with this effort - I've got some good RE experience under my belt, and would love to assist however I can. |
I am also interested in helping out! Having the SE on mac would be so nice 😍 |
does anyone have any status on this? / Anything holding them up? |
I would also be able to contribute $100 to the bounty. I'm on an M2 mac mini and could help test as well if it would be useful. I think that brings the bounty up to $870. |
Up |
@Norbyte I Assume you own BG3, so the cost of the game is not a problem for you if someone had a spare mac and was interested in lending it to you, or giving it to you. Would that be possible / Something you are interested in. Because at least from what i can read and see, the main problem is NOT that you have no interest, but that you just literally don't have a mac. if i could send it to you / lend / donate it. id not be opposed to it. (its not a powerhouse by any means, but its a dinky m1 air). Let me know! That being said, you would need the time and effort to do so, so i dont think its JUST the mac as the issue. But If it is. I can help! |
Now that patch 7 is out for everyone... is anyone working on this? |
I dont think so |
Related to Norbyte#162 Add MacOS support for BG3 SE. * Add mappings for MacOS binaries and Apple Silicon processors in `BG3Extender/GameHooks/BinaryMappings.xml`. * Add MacOS-specific hooks and configurations in `BG3Extender/Extender/ScriptExtender.cpp`. * Add MacOS-specific implementations in `BG3Extender/Extender/Client/ScriptExtenderClient.cpp`. * Add MacOS-specific declarations in `BG3Extender/Extender/Client/ScriptExtenderClient.h`. * Add MacOS-specific networking support in `BG3Extender/Extender/Shared/ExtenderNet.h`. * Add MacOS-specific hooks in `BG3Extender/Extender/Shared/Hooks.h`. * Implement MacOS-specific hooks in `BG3Extender/Extender/Shared/Hooks.cpp`. * Add MacOS-specific script helpers in `BG3Extender/Extender/Shared/ScriptHelpers.h`. * Implement MacOS-specific script helpers in `BG3Extender/Extender/Shared/ScriptHelpers.cpp`. * Add MacOS-specific utilities in `BG3Extender/Extender/Shared/Utils.h`. * Implement MacOS-specific utilities in `BG3Extender/Extender/Shared/Utils.cpp`. * Add MacOS-specific virtual texture support in `BG3Extender/Extender/Shared/VirtualTextures.h`. * Implement MacOS-specific virtual texture support in `BG3Extender/Extender/Shared/VirtualTextures.inl`.
What: A bounty that will be paid out when BG3 SE works on MacOS with the Mac port of BG3.
Amount: $350
Payment Method: Your choice (I am happy to post the bounty to an escrow service, but I don't know them. If you let me know a preferred one, I will add it there.)
Contributions to raise the bounty amount are welcome!
Please let me know if you have any questions. Thanks!
The text was updated successfully, but these errors were encountered: