Skip to content

Run Windows games on Apple Silicon — free, open source, with an open compatibility database that tells you what actually works.

Highball 0.1: engine manifests, HighballKit + CLI, SwiftUI app, spike results

Gauthier Piarrette60f26ef6c5b6
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
new file mode 100644
index 0000000..b6bfe0b
--- /dev/null
+++ b/.github/workflows/ci.yml
@@ -0,0 +1,19 @@
+name: CI
+on:
+ push: { branches: [main] }
+ pull_request:
+jobs:
+ build-test:
+ runs-on: macos-14
+ steps:
+ - uses: actions/checkout@v4
+ - name: Build
+ run: swift build
+ - name: Unit tests
+ run: swift test
+ - name: Validate recipes against the CLI (from highball-db)
+ run: |
+ git clone --depth 1 https://github.com/gauthierpiarrette/highball-db.git ../highball-db
+ for f in ../highball-db/recipes/launchers/*.json ../highball-db/recipes/games/*.json; do
+ .build/debug/highball recipe show "$f" > /dev/null || exit 1
+ done
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..a13cbfd
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,7 @@
+.build/
+.swiftpm/
+*.xcodeproj/xcuserdata/
+DerivedData/
+.DS_Store
+dist/
+site/
diff --git a/LICENSE b/LICENSE
new file mode 100644
index 0000000..f288702
--- /dev/null
+++ b/LICENSE
@@ -0,0 +1,674 @@
+ GNU GENERAL PUBLIC LICENSE
+ Version 3, 29 June 2007
+
+ Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+ Preamble
+
+ The GNU General Public License is a free, copyleft license for
+software and other kinds of works.
+
+ The licenses for most software and other practical works are designed
+to take away your freedom to share and change the works. By contrast,
+the GNU General Public License is intended to guarantee your freedom to
+share and change all versions of a program--to make sure it remains free
+software for all its users. We, the Free Software Foundation, use the
+GNU General Public License for most of our software; it applies also to
+any other work released this way by its authors. You can apply it to
+your programs, too.
+
+ When we speak of free software, we are referring to freedom, not
+price. Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+them if you wish), that you receive source code or can get it if you
+want it, that you can change the software or use pieces of it in new
+free programs, and that you know you can do these things.
+
+ To protect your rights, we need to prevent others from denying you
+these rights or asking you to surrender the rights. Therefore, you have
+certain responsibilities if you distribute copies of the software, or if
+you modify it: responsibilities to respect the freedom of others.
+
+ For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must pass on to the recipients the same
+freedoms that you received. You must make sure that they, too, receive
+or can get the source code. And you must show them these terms so they
+know their rights.
+
+ Developers that use the GNU GPL protect your rights with two steps:
+(1) assert copyright on the software, and (2) offer you this License
+giving you legal permission to copy, distribute and/or modify it.
+
+ For the developers' and authors' protection, the GPL clearly explains
+that there is no warranty for this free software. For both users' and
+authors' sake, the GPL requires that modified versions be marked as
+changed, so that their problems will not be attributed erroneously to
+authors of previous versions.
+
+ Some devices are designed to deny users access to install or run
+modified versions of the software inside them, although the manufacturer
+can do so. This is fundamentally incompatible with the aim of
+protecting users' freedom to change the software. The systematic
+pattern of such abuse occurs in the area of products for individuals to
+use, which is precisely where it is most unacceptable. Therefore, we
+have designed this version of the GPL to prohibit the practice for those
+products. If such problems arise substantially in other domains, we
+stand ready to extend this provision to those domains in future versions
+of the GPL, as needed to protect the freedom of users.
+
+ Finally, every program is threatened constantly by software patents.
+States should not allow patents to restrict development and use of
+software on general-purpose computers, but in those that do, we wish to
+avoid the special danger that patents applied to a free program could
+make it effectively proprietary. To prevent this, the GPL assures that
+patents cannot be used to render the program non-free.
+
+ The precise terms and conditions for copying, distribution and
+modification follow.
+
+ TERMS AND CONDITIONS
+
+ 0. Definitions.
+
+ "This License" refers to version 3 of the GNU General Public License.
+
+ "Copyright" also means copyright-like laws that apply to other kinds of
+works, such as semiconductor masks.
+
+ "The Program" refers to any copyrightable work licensed under this
+License. Each licensee is addressed as "you". "Licensees" and
+"recipients" may be individuals or organizations.
+
+ To "modify" a work means to copy from or adapt all or part of the work
+in a fashion requiring copyright permission, other than the making of an
+exact copy. The resulting work is called a "modified version" of the
+earlier work or a work "based on" the earlier work.
+
+ A "covered work" means either the unmodified Program or a work based
+on the Program.
+
+ To "propagate" a work means to do anything with it that, without
+permission, would make you directly or secondarily liable for
+infringement under applicable copyright law, except executing it on a
+computer or modifying a private copy. Propagation includes copying,
+distribution (with or without modification), making available to the
+public, and in some countries other activities as well.
+
+ To "convey" a work means any kind of propagation that enables other
+parties to make or receive copies. Mere interaction with a user through
+a computer network, with no transfer of a copy, is not conveying.
+
+ An interactive user interface displays "Appropriate Legal Notices"
+to the extent that it includes a convenient and prominently visible
+feature that (1) displays an appropriate copyright notice, and (2)
+tells the user that there is no warranty for the work (except to the
+extent that warranties are provided), that licensees may convey the
+work under this License, and how to view a copy of this License. If
+the interface presents a list of user commands or options, such as a
+menu, a prominent item in the list meets this criterion.
+
+ 1. Source Code.
+
+ The "source code" for a work means the preferred form of the work
+for making modifications to it. "Object code" means any non-source
+form of a work.
+
+ A "Standard Interface" means an interface that either is an official
+standard defined by a recognized standards body, or, in the case of
+interfaces specified for a particular programming language, one that
+is widely used among developers working in that language.
+
+ The "System Libraries" of an executable work include anything, other
+than the work as a whole, that (a) is included in the normal form of
+packaging a Major Component, but which is not part of that Major
+Component, and (b) serves only to enable use of the work with that
+Major Component, or to implement a Standard Interface for which an
+implementation is available to the public in source code form. A
+"Major Component", in this context, means a major essential component
+(kernel, window system, and so on) of the specific operating system
+(if any) on which the executable work runs, or a compiler used to
+produce the work, or an object code interpreter used to run it.
+
+ The "Corresponding Source" for a work in object code form means all
+the source code needed to generate, install, and (for an executable
+work) run the object code and to modify the work, including scripts to
+control those activities. However, it does not include the work's
+System Libraries, or general-purpose tools or generally available free
+programs which are used unmodified in performing those activities but
+which are not part of the work. For example, Corresponding Source
+includes interface definition files associated with source files for
+the work, and the source code for shared libraries and dynamically
+linked subprograms that the work is specifically designed to require,
+such as by intimate data communication or control flow between those
+subprograms and other parts of the work.
+
+ The Corresponding Source need not include anything that users
+can regenerate automatically from other parts of the Corresponding
+Source.
+
+ The Corresponding Source for a work in source code form is that
+same work.
+
+ 2. Basic Permissions.
+
+ All rights granted under this License are granted for the term of
+copyright on the Program, and are irrevocable provided the stated
+conditions are met. This License explicitly affirms your unlimited
+permission to run the unmodified Program. The output from running a
+covered work is covered by this License only if the output, given its
+content, constitutes a covered work. This License acknowledges your
+rights of fair use or other equivalent, as provided by copyright law.
+
+ You may make, run and propagate covered works that you do not
+convey, without conditions so long as your license otherwise remains
+in force. You may convey covered works to others for the sole purpose
+of having them make modifications exclusively for you, or provide you
+with facilities for running those works, provided that you comply with
+the terms of this License in conveying all material for which you do
+not control copyright. Those thus making or running the covered works
+for you must do so exclusively on your behalf, under your direction
+and control, on terms that prohibit them from making any copies of
+your copyrighted material outside their relationship with you.
+
+ Conveying under any other circumstances is permitted solely under
+the conditions stated below. Sublicensing is not allowed; section 10
+makes it unnecessary.
+
+ 3. Protecting Users' Legal Rights From Anti-Circumvention Law.
+
+ No covered work shall be deemed part of an effective technological
+measure under any applicable law fulfilling obligations under article
+11 of the WIPO copyright treaty adopted on 20 December 1996, or
+similar laws prohibiting or restricting circumvention of such
+measures.
+
+ When you convey a covered work, you waive any legal power to forbid
+circumvention of technological measures to the extent such circumvention
+is effected by exercising rights under this License with respect to
+the covered work, and you disclaim any intention to limit operation or
+modification of the work as a means of enforcing, against the work's
+users, your or third parties' legal rights to forbid circumvention of
+technological measures.
+
+ 4. Conveying Verbatim Copies.
+
+ You may convey verbatim copies of the Program's source code as you
+receive it, in any medium, provided that you conspicuously and
+appropriately publish on each copy an appropriate copyright notice;
+keep intact all notices stating that this License and any
+non-permissive terms added in accord with section 7 apply to the code;
+keep intact all notices of the absence of any warranty; and give all
+recipients a copy of this License along with the Program.
+
+ You may charge any price or no price for each copy that you convey,
+and you may offer support or warranty protection for a fee.
+
+ 5. Conveying Modified Source Versions.
+
+ You may convey a work based on the Program, or the modifications to
+produce it from the Program, in the form of source code under the
+terms of section 4, provided that you also meet all of these conditions:
+
+ a) The work must carry prominent notices stating that you modified
+ it, and giving a relevant date.
+
+ b) The work must carry prominent notices stating that it is
+ released under this License and any conditions added under section
+ 7. This requirement modifies the requirement in section 4 to
+ "keep intact all notices".
+
+ c) You must license the entire work, as a whole, under this
+ License to anyone who comes into possession of a copy. This
+ License will therefore apply, along with any applicable section 7
+ additional terms, to the whole of the work, and all its parts,
+ regardless of how they are packaged. This License gives no
+ permission to license the work in any other way, but it does not
+ invalidate such permission if you have separately received it.
+
+ d) If the work has interactive user interfaces, each must display
+ Appropriate Legal Notices; however, if the Program has interactive
+ interfaces that do not display Appropriate Legal Notices, your
+ work need not make them do so.
+
+ A compilation of a covered work with other separate and independent
+works, which are not by their nature extensions of the covered work,
+and which are not combined with it such as to form a larger program,
+in or on a volume of a storage or distribution medium, is called an
+"aggregate" if the compilation and its resulting copyright are not
+used to limit the access or legal rights of the compilation's users
+beyond what the individual works permit. Inclusion of a covered work
+in an aggregate does not cause this License to apply to the other
+parts of the aggregate.
+
+ 6. Conveying Non-Source Forms.
+
+ You may convey a covered work in object code form under the terms
+of sections 4 and 5, provided that you also convey the
+machine-readable Corresponding Source under the terms of this License,
+in one of these ways:
+
+ a) Convey the object code in, or embodied in, a physical product
+ (including a physical distribution medium), accompanied by the
+ Corresponding Source fixed on a durable physical medium
+ customarily used for software interchange.
+
+ b) Convey the object code in, or embodied in, a physical product
+ (including a physical distribution medium), accompanied by a
+ written offer, valid for at least three years and valid for as
+ long as you offer spare parts or customer support for that product
+ model, to give anyone who possesses the object code either (1) a
+ copy of the Corresponding Source for all the software in the
+ product that is covered by this License, on a durable physical
+ medium customarily used for software interchange, for a price no
+ more than your reasonable cost of physically performing this
+ conveying of source, or (2) access to copy the
+ Corresponding Source from a network server at no charge.
+
+ c) Convey individual copies of the object code with a copy of the
+ written offer to provide the Corresponding Source. This
+ alternative is allowed only occasionally and noncommercially, and
+ only if you received the object code with such an offer, in accord
+ with subsection 6b.
+
+ d) Convey the object code by offering access from a designated
+ place (gratis or for a charge), and offer equivalent access to the
+ Corresponding Source in the same way through the same place at no
+ further charge. You need not require recipients to copy the
+ Corresponding Source along with the object code. If the place to
+ copy the object code is a network server, the Corresponding Source
+ may be on a different server (operated by you or a third party)
+ that supports equivalent copying facilities, provided you maintain
+ clear directions next to the object code saying where to find the
+ Corresponding Source. Regardless of what server hosts the
+ Corresponding Source, you remain obligated to ensure that it is
+ available for as long as needed to satisfy these requirements.
+
+ e) Convey the object code using peer-to-peer transmission, provided
+ you inform other peers where the object code and Corresponding
+ Source of the work are being offered to the general public at no
+ charge under subsection 6d.
+
+ A separable portion of the object code, whose source code is excluded
+from the Corresponding Source as a System Library, need not be
+included in conveying the object code work.
+
+ A "User Product" is either (1) a "consumer product", which means any
+tangible personal property which is normally used for personal, family,
+or household purposes, or (2) anything designed or sold for incorporation
+into a dwelling. In determining whether a product is a consumer product,
+doubtful cases shall be resolved in favor of coverage. For a particular
+product received by a particular user, "normally used" refers to a
+typical or common use of that class of product, regardless of the status
+of the particular user or of the way in which the particular user
+actually uses, or expects or is expected to use, the product. A product
+is a consumer product regardless of whether the product has substantial
+commercial, industrial or non-consumer uses, unless such uses represent
+the only significant mode of use of the product.
+
+ "Installation Information" for a User Product means any methods,
+procedures, authorization keys, or other information required to install
+and execute modified versions of a covered work in that User Product from
+a modified version of its Corresponding Source. The information must
+suffice to ensure that the continued functioning of the modified object
+code is in no case prevented or interfered with solely because
+modification has been made.
+
+ If you convey an object code work under this section in, or with, or
+specifically for use in, a User Product, and the conveying occurs as
+part of a transaction in which the right of possession and use of the
+User Product is transferred to the recipient in perpetuity or for a
+fixed term (regardless of how the transaction is characterized), the
+Corresponding Source conveyed under this section must be accompanied
+by the Installation Information. But this requirement does not apply
+if neither you nor any third party retains the ability to install
+modified object code on the User Product (for example, the work has
+been installed in ROM).
+
+ The requirement to provide Installation Information does not include a
+requirement to continue to provide support service, warranty, or updates
+for a work that has been modified or installed by the recipient, or for
+the User Product in which it has been modified or installed. Access to a
+network may be denied when the modification itself materially and
+adversely affects the operation of the network or violates the rules and
+protocols for communication across the network.
+
+ Corresponding Source conveyed, and Installation Information provided,
+in accord with this section must be in a format that is publicly
+documented (and with an implementation available to the public in
+source code form), and must require no special password or key for
+unpacking, reading or copying.
+
+ 7. Additional Terms.
+
+ "Additional permissions" are terms that supplement the terms of this
+License by making exceptions from one or more of its conditions.
+Additional permissions that are applicable to the entire Program shall
+be treated as though they were included in this License, to the extent
+that they are valid under applicable law. If additional permissions
+apply only to part of the Program, that part may be used separately
+under those permissions, but the entire Program remains governed by
+this License without regard to the additional permissions.
+
+ When you convey a copy of a covered work, you may at your option
+remove any additional permissions from that copy, or from any part of
+it. (Additional permissions may be written to require their own
+removal in certain cases when you modify the work.) You may place
+additional permissions on material, added by you to a covered work,
+for which you have or can give appropriate copyright permission.
+
+ Notwithstanding any other provision of this License, for material you
+add to a covered work, you may (if authorized by the copyright holders of
+that material) supplement the terms of this License with terms:
+
+ a) Disclaiming warranty or limiting liability differently from the
+ terms of sections 15 and 16 of this License; or
+
+ b) Requiring preservation of specified reasonable legal notices or
+ author attributions in that material or in the Appropriate Legal
+ Notices displayed by works containing it; or
+
+ c) Prohibiting misrepresentation of the origin of that material, or
+ requiring that modified versions of such material be marked in
+ reasonable ways as different from the original version; or
+
+ d) Limiting the use for publicity purposes of names of licensors or
+ authors of the material; or
+
+ e) Declining to grant rights under trademark law for use of some
+ trade names, trademarks, or service marks; or
+
+ f) Requiring indemnification of licensors and authors of that
+ material by anyone who conveys the material (or modified versions of
+ it) with contractual assumptions of liability to the recipient, for
+ any liability that these contractual assumptions directly impose on
+ those licensors and authors.
+
+ All other non-permissive additional terms are considered "further
+restrictions" within the meaning of section 10. If the Program as you
+received it, or any part of it, contains a notice stating that it is
+governed by this License along with a term that is a further
+restriction, you may remove that term. If a license document contains
+a further restriction but permits relicensing or conveying under this
+License, you may add to a covered work material governed by the terms
+of that license document, provided that the further restriction does
+not survive such relicensing or conveying.
+
+ If you add terms to a covered work in accord with this section, you
+must place, in the relevant source files, a statement of the
+additional terms that apply to those files, or a notice indicating
+where to find the applicable terms.
+
+ Additional terms, permissive or non-permissive, may be stated in the
+form of a separately written license, or stated as exceptions;
+the above requirements apply either way.
+
+ 8. Termination.
+
+ You may not propagate or modify a covered work except as expressly
+provided under this License. Any attempt otherwise to propagate or
+modify it is void, and will automatically terminate your rights under
+this License (including any patent licenses granted under the third
+paragraph of section 11).
+
+ However, if you cease all violation of this License, then your
+license from a particular copyright holder is reinstated (a)
+provisionally, unless and until the copyright holder explicitly and
+finally terminates your license, and (b) permanently, if the copyright
+holder fails to notify you of the violation by some reasonable means
+prior to 60 days after the cessation.
+
+ Moreover, your license from a particular copyright holder is
+reinstated permanently if the copyright holder notifies you of the
+violation by some reasonable means, this is the first time you have
+received notice of violation of this License (for any work) from that
+copyright holder, and you cure the violation prior to 30 days after
+your receipt of the notice.
+
+ Termination of your rights under this section does not terminate the
+licenses of parties who have received copies or rights from you under
+this License. If your rights have been terminated and not permanently
+reinstated, you do not qualify to receive new licenses for the same
+material under section 10.
+
+ 9. Acceptance Not Required for Having Copies.
+
+ You are not required to accept this License in order to receive or
+run a copy of the Program. Ancillary propagation of a covered work
+occurring solely as a consequence of using peer-to-peer transmission
+to receive a copy likewise does not require acceptance. However,
+nothing other than this License grants you permission to propagate or
+modify any covered work. These actions infringe copyright if you do
+not accept this License. Therefore, by modifying or propagating a
+covered work, you indicate your acceptance of this License to do so.
+
+ 10. Automatic Licensing of Downstream Recipients.
+
+ Each time you convey a covered work, the recipient automatically
+receives a license from the original licensors, to run, modify and
+propagate that work, subject to this License. You are not responsible
+for enforcing compliance by third parties with this License.
+
+ An "entity transaction" is a transaction transferring control of an
+organization, or substantially all assets of one, or subdividing an
+organization, or merging organizations. If propagation of a covered
+work results from an entity transaction, each party to that
+transaction who receives a copy of the work also receives whatever
+licenses to the work the party's predecessor in interest had or could
+give under the previous paragraph, plus a right to possession of the
+Corresponding Source of the work from the predecessor in interest, if
+the predecessor has it or can get it with reasonable efforts.
+
+ You may not impose any further restrictions on the exercise of the
+rights granted or affirmed under this License. For example, you may
+not impose a license fee, royalty, or other charge for exercise of
+rights granted under this License, and you may not initiate litigation
+(including a cross-claim or counterclaim in a lawsuit) alleging that
+any patent claim is infringed by making, using, selling, offering for
+sale, or importing the Program or any portion of it.
+
+ 11. Patents.
+
+ A "contributor" is a copyright holder who authorizes use under this
+License of the Program or a work on which the Program is based. The
+work thus licensed is called the contributor's "contributor version".
+
+ A contributor's "essential patent claims" are all patent claims
+owned or controlled by the contributor, whether already acquired or
+hereafter acquired, that would be infringed by some manner, permitted
+by this License, of making, using, or selling its contributor version,
+but do not include claims that would be infringed only as a
+consequence of further modification of the contributor version. For
+purposes of this definition, "control" includes the right to grant
+patent sublicenses in a manner consistent with the requirements of
+this License.
+
+ Each contributor grants you a non-exclusive, worldwide, royalty-free
+patent license under the contributor's essential patent claims, to
+make, use, sell, offer for sale, import and otherwise run, modify and
+propagate the contents of its contributor version.
+
+ In the following three paragraphs, a "patent license" is any express
+agreement or commitment, however denominated, not to enforce a patent
+(such as an express permission to practice a patent or covenant not to
+sue for patent infringement). To "grant" such a patent license to a
+party means to make such an agreement or commitment not to enforce a
+patent against the party.
+
+ If you convey a covered work, knowingly relying on a patent license,
+and the Corresponding Source of the work is not available for anyone
+to copy, free of charge and under the terms of this License, through a
+publicly available network server or other readily accessible means,
+then you must either (1) cause the Corresponding Source to be so
+available, or (2) arrange to deprive yourself of the benefit of the
+patent license for this particular work, or (3) arrange, in a manner
+consistent with the requirements of this License, to extend the patent
+license to downstream recipients. "Knowingly relying" means you have
+actual knowledge that, but for the patent license, your conveying the
+covered work in a country, or your recipient's use of the covered work
+in a country, would infringe one or more identifiable patents in that
+country that you have reason to believe are valid.
+
+ If, pursuant to or in connection with a single transaction or
+arrangement, you convey, or propagate by procuring conveyance of, a
+covered work, and grant a patent license to some of the parties
+receiving the covered work authorizing them to use, propagate, modify
+or convey a specific copy of the covered work, then the patent license
+you grant is automatically extended to all recipients of the covered
+work and works based on it.
+
+ A patent license is "discriminatory" if it does not include within
+the scope of its coverage, prohibits the exercise of, or is
+conditioned on the non-exercise of one or more of the rights that are
+specifically granted under this License. You may not convey a covered
+work if you are a party to an arrangement with a third party that is
+in the business of distributing software, under which you make payment
+to the third party based on the extent of your activity of conveying
+the work, and under which the third party grants, to any of the
+parties who would receive the covered work from you, a discriminatory
+patent license (a) in connection with copies of the covered work
+conveyed by you (or copies made from those copies), or (b) primarily
+for and in connection with specific products or compilations that
+contain the covered work, unless you entered into that arrangement,
+or that patent license was granted, prior to 28 March 2007.
+
+ Nothing in this License shall be construed as excluding or limiting
+any implied license or other defenses to infringement that may
+otherwise be available to you under applicable patent law.
+
+ 12. No Surrender of Others' Freedom.
+
+ If conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License. If you cannot convey a
+covered work so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you may
+not convey it at all. For example, if you agree to terms that obligate you
+to collect a royalty for further conveying from those to whom you convey
+the Program, the only way you could satisfy both those terms and this
+License would be to refrain entirely from conveying the Program.
+
+ 13. Use with the GNU Affero General Public License.
+
+ Notwithstanding any other provision of this License, you have
+permission to link or combine any covered work with a work licensed
+under version 3 of the GNU Affero General Public License into a single
+combined work, and to convey the resulting work. The terms of this
+License will continue to apply to the part which is the covered work,
+but the special requirements of the GNU Affero General Public License,
+section 13, concerning interaction through a network will apply to the
+combination as such.
+
+ 14. Revised Versions of this License.
+
+ The Free Software Foundation may publish revised and/or new versions of
+the GNU General Public License from time to time. Such new versions will
+be similar in spirit to the present version, but may differ in detail to
+address new problems or concerns.
+
+ Each version is given a distinguishing version number. If the
+Program specifies that a certain numbered version of the GNU General
+Public License "or any later version" applies to it, you have the
+option of following the terms and conditions either of that numbered
+version or of any later version published by the Free Software
+Foundation. If the Program does not specify a version number of the
+GNU General Public License, you may choose any version ever published
+by the Free Software Foundation.
+
+ If the Program specifies that a proxy can decide which future
+versions of the GNU General Public License can be used, that proxy's
+public statement of acceptance of a version permanently authorizes you
+to choose that version for the Program.
+
+ Later license versions may give you additional or different
+permissions. However, no additional obligations are imposed on any
+author or copyright holder as a result of your choosing to follow a
+later version.
+
+ 15. Disclaimer of Warranty.
+
+ THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
+APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
+HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
+OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
+THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
+IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
+ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
+
+ 16. Limitation of Liability.
+
+ IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
+THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
+GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
+USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
+DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
+PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
+EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
+SUCH DAMAGES.
+
+ 17. Interpretation of Sections 15 and 16.
+
+ If the disclaimer of warranty and limitation of liability provided
+above cannot be given local legal effect according to their terms,
+reviewing courts shall apply local law that most closely approximates
+an absolute waiver of all civil liability in connection with the
+Program, unless a warranty or assumption of liability accompanies a
+copy of the Program in return for a fee.
+
+ END OF TERMS AND CONDITIONS
+
+ How to Apply These Terms to Your New Programs
+
+ If you develop a new program, and you want it to be of the greatest
+possible use to the public, the best way to achieve this is to make it
+free software which everyone can redistribute and change under these terms.
+
+ To do so, attach the following notices to the program. It is safest
+to attach them to the start of each source file to most effectively
+state the exclusion of warranty; and each file should have at least
+the "copyright" line and a pointer to where the full notice is found.
+
+ <one line to give the program's name and a brief idea of what it does.>
+ Copyright (C) <year> <name of author>
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <https://www.gnu.org/licenses/>.
+
+Also add information on how to contact you by electronic and paper mail.
+
+ If the program does terminal interaction, make it output a short
+notice like this when it starts in an interactive mode:
+
+ <program> Copyright (C) <year> <name of author>
+ This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
+ This is free software, and you are welcome to redistribute it
+ under certain conditions; type `show c' for details.
+
+The hypothetical commands `show w' and `show c' should show the appropriate
+parts of the General Public License. Of course, your program's commands
+might be different; for a GUI interface, you would use an "about box".
+
+ You should also get your employer (if you work as a programmer) or school,
+if any, to sign a "copyright disclaimer" for the program, if necessary.
+For more information on this, and how to apply and follow the GNU GPL, see
+<https://www.gnu.org/licenses/>.
+
+ The GNU General Public License does not permit incorporating your program
+into proprietary programs. If your program is a subroutine library, you
+may consider it more useful to permit linking proprietary applications with
+the library. If this is what you want to do, use the GNU Lesser General
+Public License instead of this License. But first, please read
+<https://www.gnu.org/licenses/why-not-lgpl.html>.
diff --git a/Package.resolved b/Package.resolved
new file mode 100644
index 0000000..246d21f
--- /dev/null
+++ b/Package.resolved
@@ -0,0 +1,15 @@
+{
+ "originHash" : "50d600e85f260cc7c33f023304c744332d9c41d917015f19c6aa1e0b4c538d93",
+ "pins" : [
+ {
+ "identity" : "swift-argument-parser",
+ "kind" : "remoteSourceControl",
+ "location" : "https://github.com/apple/swift-argument-parser.git",
+ "state" : {
+ "revision" : "6a52f3251125d74daf04fcbd5e6f08a75d074382",
+ "version" : "1.8.2"
+ }
+ }
+ ],
+ "version" : 3
+}
diff --git a/Package.swift b/Package.swift
new file mode 100644
index 0000000..884e261
--- /dev/null
+++ b/Package.swift
@@ -0,0 +1,27 @@
+// swift-tools-version: 5.10
+import PackageDescription
+
+let package = Package(
+ name: "highball",
+ platforms: [.macOS(.v14)],
+ products: [
+ .library(name: "HighballKit", targets: ["HighballKit"]),
+ .executable(name: "highball", targets: ["highball"]),
+ .executable(name: "HighballApp", targets: ["HighballApp"]),
+ ],
+ dependencies: [
+ .package(url: "https://github.com/apple/swift-argument-parser.git", from: "1.5.0"),
+ ],
+ targets: [
+ .target(name: "HighballKit", path: "Sources/HighballKit", swiftSettings: [.enableUpcomingFeature("StrictConcurrency")]),
+ .executableTarget(
+ name: "highball",
+ dependencies: ["HighballKit", .product(name: "ArgumentParser", package: "swift-argument-parser")],
+ path: "Sources/highball"),
+ .executableTarget(
+ name: "HighballApp",
+ dependencies: ["HighballKit"],
+ path: "Sources/HighballApp"),
+ .testTarget(name: "HighballKitTests", dependencies: ["HighballKit"], path: "Tests/GinKitTests"),
+ ]
+)
diff --git a/README.md b/README.md
new file mode 100644
index 0000000..f786b85
--- /dev/null
+++ b/README.md
@@ -0,0 +1,89 @@
+# Highball
+
+**Run Windows games on Apple Silicon. Free, open, engine-agnostic.**
+
+Highball is the successor to the idea behind [Whisky](https://github.com/Whisky-App/Whisky):
+a native macOS app (and CLI) that sets up Wine, DXMT, D3DMetal and DXVK for you, installs
+Steam and other launchers with one click, and tells you honestly what runs, what doesn't,
+and which renderer to use — backed by an open, CC0 compatibility database.
+
+A highball is whisky made easy-drinking. Same idea.
+
+> Status: **pre-release**. The CLI works end to end (engine install → bottle → Steam →
+> game, with per-bottle renderer switching). The SwiftUI app is in progress.
+
+## Why Highball exists when Whisky died
+
+Whisky's developer archived it in 2025 after concluding it repackaged CodeWeavers' work
+while giving "practically zero" back to Wine. Highball is designed around that lesson:
+
+- **Zero Wine patches, zero hosted binaries.** Engines are assembled from *pinned,
+ SHA-256-verified* upstream releases ([Gcenx](https://github.com/Gcenx)'s builds,
+ [DXMT](https://github.com/3Shain/dxmt), the
+ [Sikarugir](https://github.com/Sikarugir-App/Sikarugir) runtime). An engine update is a
+ JSON pull request, not a build pipeline.
+- **The database is the product.** Recipes ("Steam needs `sync: none`; this game needs
+ DXVK") are versioned CC0 data anyone can use — including CrossOver users. Nothing like
+ it exists in the open today.
+- **Additive to the ecosystem.** Bugs go upstream, donations links point at Gcenx and
+ DXMT, and if you want commercial-grade support you should buy
+ [CrossOver](https://www.codeweavers.com/crossover) — it funds most of Wine's Mac work.
+
+## Install (CLI, today)
+
+Requires Apple Silicon, macOS 14+, Rosetta 2 (`softwareupdate --install-rosetta`).
+
+```sh
+swift build -c release
+.build/release/highball engine install spike/engine-manifest.json
+.build/release/highball engine accept x64-sikarugir10.0_6-r0 apple-gptk-license-2023-08-17 # optional: D3DMetal
+.build/release/highball bottle create play --recipe steam
+.build/release/highball run play steam
+```
+
+Everything lives in `~/Library/Application Support/Highball/`. Nothing touches `/usr` or
+`/Library`; deleting that folder is a full uninstall.
+
+## What works (verified 2026-08-23, M1 Pro, macOS 14.6)
+
+| | |
+|---|---|
+| Steam 64-bit client | ✅ login, store, downloads (`sync: none` required — see the recipe) |
+| Aperture Desk Job | ✅ DXVK correct ~31 fps · ⚠️ D3DMetal fast but corrupted · ❌ DXMT black screen |
+| Renderer switching | ✅ per bottle and per pinned program, no reinstall |
+| 32-bit programs | ✅ via Wine WoW64 (Steam's own 32-bit bootstrapper ran) |
+| Kernel anti-cheat (Valorant, Fortnite, Destiny 2…) | ❌ structurally impossible — flagged in the DB before you download 80 GB |
+
+## Architecture in one paragraph
+
+`highball` (CLI) and the app are thin views over **HighballKit**: an *engine* is a
+manifest-defined bundle (Wine + runtime dylibs + renderer overlays) laid out under
+`engines/<id>`; a *bottle* is a `WINEPREFIX` plus `bottle.json`; renderers (WineD3D /
+DXMT / D3DMetal / DXVK) are directory overlays selected per launch via
+`WINEDLLPATH_PREPEND`; *recipes* are declarative JSON steps (installer, registry,
+winetricks, sync, renderer, pin, note) applied to a bottle. D3DMetal is gated behind
+explicit acceptance of Apple's Game Porting Toolkit license and is never redistributed in
+this repository.
+
+## Contributing
+
+- **Reports**: run something, then `highball report <bottle> "<title>" --rating N` — it
+ opens a pre-filled issue on [highball-db](https://github.com/gauthierpiarrette/highball-db). Accepted reports are folded into `db/reports/` by CI.
+- **Recipes**: PRs to [highball-db](https://github.com/gauthierpiarrette/highball-db) `recipes/` with the CLI output attached. Every recipe carries
+ `lastVerified` (engine id, macOS, chip) so stale data is visible, not silently wrong.
+- **Engines**: manifest PRs bumping pinned versions, with a verification note.
+
+## Licensing
+
+App + CLI + HighballKit: **GPL-3.0** ([LICENSE](LICENSE)). Recipes and database:
+**CC0-1.0** (in [highball-db](https://github.com/gauthierpiarrette/highball-db)). Wine is LGPL; DXMT is MIT/LGPL; DXVK is
+Zlib; D3DMetal is Apple-licensed (non-commercial, downloaded separately, never modified).
+Highball has no paid tier and never will — that's a license requirement, not a promise.
+
+## Credits
+
+Standing on: [Wine](https://winehq.org) · [Gcenx](https://github.com/Gcenx) (the entire
+free Mac Wine supply chain) · [3Shain's DXMT](https://github.com/3Shain/dxmt) ·
+[Sikarugir](https://github.com/Sikarugir-App/Sikarugir) · Apple's Game Porting Toolkit ·
+[Whisky](https://github.com/Whisky-App/Whisky), whose honesty about its own limits shaped
+this design.
diff --git a/Scripts/make-app.sh b/Scripts/make-app.sh
new file mode 100755
index 0000000..0ff3def
--- /dev/null
+++ b/Scripts/make-app.sh
@@ -0,0 +1,37 @@
+#!/bin/zsh
+# Assemble dist/Highball.app from the SwiftPM build (ad-hoc signed; notarization needs an Apple Developer account).
+set -euo pipefail
+cd "$(dirname "$0")/.."
+CONFIG="${1:-release}"
+swift build -c "$CONFIG" --product HighballApp
+APP=dist/Highball.app
+rm -rf "$APP"; mkdir -p "$APP/Contents/MacOS" "$APP/Contents/Resources"
+cp ".build/$CONFIG/HighballApp" "$APP/Contents/MacOS/Highball"
+# Ship the manifest, recipes and the GPTK license text inside the bundle.
+cp spike/engine-manifest.json "$APP/Contents/Resources/engine-manifest.json"
+cp spike/d3dmetal-license.txt "$APP/Contents/Resources/d3dmetal-license.txt"
+# Recipes come from the highball-db repo (sibling checkout, or a shallow clone into .build).
+RECIPES="../highball-db/recipes"
+if [ ! -d "$RECIPES" ]; then
+ RECIPES=".build/highball-db/recipes"
+ [ -d "$RECIPES" ] || git clone --depth 1 https://github.com/gauthierpiarrette/highball-db.git .build/highball-db
+fi
+for f in "$RECIPES"/launchers/*.json "$RECIPES"/games/*.json; do cp "$f" "$APP/Contents/Resources/"; done
+cat > "$APP/Contents/Info.plist" <<PLIST
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0"><dict>
+ <key>CFBundleExecutable</key><string>Highball</string>
+ <key>CFBundleIdentifier</key><string>app.highball.Highball</string>
+ <key>CFBundleName</key><string>Highball</string>
+ <key>CFBundleDisplayName</key><string>Highball</string>
+ <key>CFBundlePackageType</key><string>APPL</string>
+ <key>CFBundleShortVersionString</key><string>0.1.0</string>
+ <key>CFBundleVersion</key><string>1</string>
+ <key>LSMinimumSystemVersion</key><string>14.0</string>
+ <key>NSHighResolutionCapable</key><true/>
+ <key>NSHumanReadableCopyright</key><string>GPL-3.0 — no paid tier, ever.</string>
+</dict></plist>
+PLIST
+codesign --force --deep -s - "$APP"
+echo "built $APP"
diff --git a/Sources/HighballApp/AppState.swift b/Sources/HighballApp/AppState.swift
new file mode 100644
index 0000000..fef2b02
--- /dev/null
+++ b/Sources/HighballApp/AppState.swift
@@ -0,0 +1,173 @@
+import Foundation
+import HighballKit
+import Observation
+
+@Observable @MainActor
+final class AppState {
+ var engines: [InstalledEngine] = []
+ var bottles: [Bottle] = []
+ var selectedBottle: String?
+
+ // Long-running work
+ var busy = false
+ var busyTitle = ""
+ var logLines: [String] = []
+ var showLog = false
+
+ // Onboarding
+ var rosettaInstalled = true
+ var needsOnboarding = false
+ var showGPTKLicense = false
+ var gptkLicenseText = ""
+
+ // Crash follow-up
+ var crashSuggestion: CrashSuggestion?
+ struct CrashSuggestion: Identifiable {
+ let id = UUID()
+ let program: String
+ let renderer: Renderer
+ let logPath: String
+ }
+
+ var errorMessage: String?
+
+ let paths = HighballPaths()
+ var engineStore: EngineStore { EngineStore(paths: paths) }
+ var bottleStore: BottleStore { BottleStore(paths: paths) }
+
+ func refresh() {
+ engines = (try? engineStore.installedEngines()) ?? []
+ bottles = (try? bottleStore.list()) ?? []
+ needsOnboarding = engines.isEmpty
+ rosettaInstalled = FileManager.default.fileExists(atPath: "/Library/Apple/usr/share/rosetta/rosetta")
+ if selectedBottle == nil { selectedBottle = bottles.first?.name }
+ }
+
+ func engine(for bottle: Bottle) -> InstalledEngine? {
+ (try? engineStore.engine(bottle.settings.engineID)) ?? engines.first
+ }
+
+ private func appendLog(_ line: String) {
+ logLines.append(line)
+ if logLines.count > 400 { logLines.removeFirst(logLines.count - 400) }
+ }
+
+ private func runBusy(_ title: String, showLogSheet: Bool = true, _ work: @escaping () async throws -> Void) {
+ busy = true; busyTitle = title; logLines = []; showLog = showLogSheet
+ Task {
+ do { try await work() } catch { errorMessage = "\(error)" }
+ busy = false
+ refresh()
+ }
+ }
+
+ // MARK: Actions
+
+ func installDefaultEngine(acceptGPTK: Bool) {
+ guard let manifestURL = Self.bundledManifest else {
+ errorMessage = "No engine manifest found. Reinstall Highball."; return
+ }
+ runBusy("Installing engine — about 500 MB of verified downloads") { [self] in
+ let manifest = try EngineManifest.load(from: manifestURL)
+ var accepted: Set<String> = []
+ if acceptGPTK { accepted.insert("apple-gptk-license-2023-08-17") }
+ _ = try await engineStore.install(manifest, accepted: accepted) { name, _, _ in
+ Task { @MainActor in self.appendLog("downloaded \(name)") }
+ }
+ await MainActor.run { self.appendLog("engine installed") }
+ }
+ }
+
+ func acceptGPTK(engine: InstalledEngine) {
+ do { _ = try engineStore.accept(license: "apple-gptk-license-2023-08-17", engine: engine); refresh() }
+ catch { errorMessage = "\(error)" }
+ }
+
+ func createBottle(name: String, recipeID: String?) {
+ guard let engine = engines.first else { return }
+ runBusy("Creating bottle '\(name)' — first boot takes about 90 seconds") { [self] in
+ let bottle = try await bottleStore.create(name: name, engine: engine)
+ await MainActor.run { self.appendLog("bottle created") }
+ if let recipeID, let recipe = Self.recipe(recipeID) {
+ var runner = RecipeRunner(paths: paths, engine: engine, bottle: bottle)
+ let notes = try await runner.apply(recipe) { line in Task { @MainActor in self.appendLog(line) } }
+ for n in notes { await MainActor.run { self.appendLog("note: \(n)") } }
+ }
+ await MainActor.run { self.selectedBottle = name }
+ }
+ }
+
+ func applyRecipe(_ id: String, to bottle: Bottle) {
+ guard let engine = engine(for: bottle), let recipe = Self.recipe(id) else { return }
+ runBusy("Installing \(recipe.title)") { [self] in
+ var runner = RecipeRunner(paths: paths, engine: engine, bottle: bottle)
+ let notes = try await runner.apply(recipe) { line in Task { @MainActor in self.appendLog(line) } }
+ for n in notes { await MainActor.run { self.appendLog("note: \(n)") } }
+ }
+ }
+
+ func launch(pin: Pin, in bottle: Bottle) {
+ guard let engine = engine(for: bottle) else { return }
+ runBusy("Running \(pin.name)", showLogSheet: false) { [self] in
+ let runner = WineRunner(paths: paths, engine: engine, bottle: bottle)
+ let result = try await runner.start(pin: pin) { line in Task { @MainActor in self.appendLog(line) } }
+ if result.crashedEarly {
+ let current = pin.renderer ?? bottle.settings.renderer
+ let next: Renderer = current == .dxmt ? .d3dmetal : (current == .d3dmetal ? .dxvk : .dxmt)
+ await MainActor.run {
+ self.crashSuggestion = CrashSuggestion(program: pin.name, renderer: next, logPath: result.log.path)
+ }
+ }
+ }
+ }
+
+ func update(_ bottle: Bottle) {
+ do { try bottleStore.update(bottle); refresh() } catch { errorMessage = "\(error)" }
+ }
+
+ func killBottle(_ bottle: Bottle) {
+ guard let engine = engine(for: bottle) else { return }
+ try? WineRunner(paths: paths, engine: engine, bottle: bottle).kill()
+ }
+
+ func loadGPTKLicense() {
+ for candidate in [Self.repoRoot?.appending(path: "spike/d3dmetal-license.txt"),
+ Bundle.main.url(forResource: "d3dmetal-license", withExtension: "txt")].compactMap({ $0 }) {
+ if let text = try? String(contentsOf: candidate, encoding: .utf8) { gptkLicenseText = text; return }
+ }
+ gptkLicenseText = "License text unavailable locally. Read it at github.com/Gcenx/game-porting-toolkit (License.pdf) before accepting."
+ }
+
+ // MARK: Resource lookup (repo checkout or app bundle)
+
+ static var repoRoot: URL? {
+ var dir = URL(fileURLWithPath: CommandLine.arguments[0]).deletingLastPathComponent()
+ for _ in 0..<6 {
+ if FileManager.default.fileExists(atPath: dir.appending(path: "spike/engine-manifest.json").path) { return dir }
+ dir.deleteLastPathComponent()
+ }
+ let cwd = URL(fileURLWithPath: FileManager.default.currentDirectoryPath)
+ if FileManager.default.fileExists(atPath: cwd.appending(path: "spike/engine-manifest.json").path) { return cwd }
+ return nil
+ }
+
+ static var bundledManifest: URL? {
+ Bundle.main.url(forResource: "engine-manifest", withExtension: "json")
+ ?? repoRoot?.appending(path: "spike/engine-manifest.json")
+ }
+
+ static func recipe(_ id: String) -> HighballKit.Recipe? {
+ if let url = Bundle.main.url(forResource: id, withExtension: "json"),
+ let r = try? HighballKit.Recipe.load(from: url) { return r }
+ guard let root = repoRoot else { return nil }
+ for base in [root.appending(path: "recipes"), root.deletingLastPathComponent().appending(path: "highball-db/recipes")] {
+ for sub in ["launchers", "games", "tweaks"] {
+ let url = base.appending(path: "\(sub)/\(id).json")
+ if let r = try? HighballKit.Recipe.load(from: url) { return r }
+ }
+ }
+ return nil
+ }
+
+ static let launcherRecipes = ["steam", "epic-games", "battle-net", "gog-galaxy", "ea-app", "ubisoft-connect", "rockstar"]
+}
diff --git a/Sources/HighballApp/BottleView.swift b/Sources/HighballApp/BottleView.swift
new file mode 100644
index 0000000..6868e78
--- /dev/null
+++ b/Sources/HighballApp/BottleView.swift
@@ -0,0 +1,207 @@
+import HighballKit
+import SwiftUI
+
+struct BottleView: View {
+ @Environment(AppState.self) private var state
+ let bottle: Bottle
+
+ private var engine: InstalledEngine? { state.engine(for: bottle) }
+ private var d3dmetalAvailable: Bool { engine?.rendererDir("d3dmetal") != nil }
+ private var d3dmetalPossible: Bool {
+ guard let engine else { return false }
+ return FileManager.default.fileExists(atPath: engine.frameworksDir.appending(path: "renderer/d3dmetal/wine").path)
+ }
+
+ var body: some View {
+ Form {
+ Section {
+ header
+ }
+ Section("Programs") {
+ if bottle.settings.pins.isEmpty {
+ Text("Nothing installed yet — add a launcher below.").foregroundStyle(.secondary)
+ }
+ ForEach(bottle.settings.pins) { pin in
+ HStack {
+ VStack(alignment: .leading) {
+ Text(pin.name)
+ Text(pin.path).font(.caption).foregroundStyle(.secondary).lineLimit(1)
+ }
+ Spacer()
+ if let r = pin.renderer { RendererBadge(renderer: r) }
+ Button("Run") { state.launch(pin: pin, in: bottle) }
+ .disabled(state.busy)
+ }
+ }
+ }
+ Section("Install a launcher") {
+ HStack(spacing: 8) {
+ ForEach(AppState.launcherRecipes.filter { id in !bottle.settings.recipes.contains(id) }, id: \.self) { id in
+ if let recipe = AppState.recipe(id) {
+ Button(recipe.title) { state.applyRecipe(id, to: bottle) }
+ .disabled(state.busy)
+ }
+ }
+ }
+ Text("Kernel anti-cheat titles (Valorant, Fortnite, Destiny 2…) can’t work through Wine — check the compatibility database before big downloads.")
+ .font(.caption).foregroundStyle(.secondary)
+ }
+ Section("Graphics & compatibility") {
+ settings
+ }
+ }
+ .formStyle(.grouped)
+ .navigationTitle(bottle.name)
+ .toolbar {
+ Button { state.killBottle(bottle) } label: { Label("Stop all", systemImage: "stop.circle") }
+ .help("Kill every Windows process in this bottle (wineserver -k)")
+ }
+ }
+
+ private var header: some View {
+ HStack(spacing: 14) {
+ Image(systemName: "wineglass.fill").font(.largeTitle).foregroundStyle(.tint)
+ VStack(alignment: .leading, spacing: 2) {
+ Text(bottle.name).font(.title2.bold())
+ Text("engine \(bottle.settings.engineID)").font(.caption).foregroundStyle(.secondary)
+ }
+ Spacer()
+ Button("Open C: drive") { NSWorkspace.shared.open(bottle.driveC) }
+ }
+ }
+
+ @ViewBuilder private var settings: some View {
+ Picker("Renderer", selection: binding(\.renderer)) {
+ Text("DXMT — D3D10/11 → Metal (default)").tag(Renderer.dxmt)
+ if d3dmetalAvailable {
+ Text("D3DMetal — D3D11/12, Apple").tag(Renderer.d3dmetal)
+ }
+ Text("DXVK — D3D9/10/11 → Vulkan").tag(Renderer.dxvk)
+ Text("WineD3D — slow fallback").tag(Renderer.wined3d)
+ }
+ if !d3dmetalAvailable && d3dmetalPossible {
+ HStack {
+ Text("D3DMetal (needed for DirectX 12) requires accepting Apple’s Game Porting Toolkit license.")
+ .font(.caption).foregroundStyle(.secondary)
+ Button("Review license…") {
+ state.loadGPTKLicense()
+ state.showGPTKLicense = true
+ }.controlSize(.small)
+ }
+ }
+ Picker("Synchronization", selection: binding(\.sync)) {
+ Text("None — required for Steam/CEF launchers").tag(SyncMode.none)
+ Text("msync — fastest for most games").tag(SyncMode.msync)
+ Text("esync").tag(SyncMode.esync)
+ }
+ Picker("Windows version", selection: binding(\.windowsVersion)) {
+ ForEach(WindowsVersion.allCases, id: \.self) { Text($0.rawValue).tag($0) }
+ }
+ Toggle("Metal performance HUD", isOn: binding(\.metalHUD))
+ Toggle("Advertise AVX to games (Rosetta)", isOn: binding(\.advertiseAVX))
+ }
+
+ private func binding<T>(_ keyPath: WritableKeyPath<BottleSettings, T>) -> Binding<T> {
+ Binding(
+ get: { bottle.settings[keyPath: keyPath] },
+ set: { newValue in
+ var copy = bottle
+ copy.settings[keyPath: keyPath] = newValue
+ state.update(copy)
+ })
+ }
+}
+
+struct RendererBadge: View {
+ let renderer: Renderer
+ var body: some View {
+ Text(renderer.rawValue.uppercased())
+ .font(.caption2.monospaced())
+ .padding(.horizontal, 5).padding(.vertical, 1)
+ .overlay(RoundedRectangle(cornerRadius: 3).stroke(.secondary.opacity(0.6)))
+ }
+}
+
+struct OnboardingView: View {
+ @Environment(AppState.self) private var state
+ @State private var acceptGPTK = false
+
+ var body: some View {
+ VStack(spacing: 18) {
+ Image(systemName: "wineglass.fill").font(.system(size: 52)).foregroundStyle(.tint)
+ Text("Highball").font(.system(size: 34, weight: .heavy, design: .rounded))
+ Text("Run Windows games on your Mac. Highball downloads a verified Wine engine (~500 MB) from public upstream releases — nothing is hosted by Highball itself.")
+ .multilineTextAlignment(.center).frame(maxWidth: 440).foregroundStyle(.secondary)
+
+ if !state.rosettaInstalled {
+ GroupBox {
+ VStack(alignment: .leading, spacing: 6) {
+ Label("Rosetta 2 is required", systemImage: "exclamationmark.triangle")
+ Text("Run in Terminal: softwareupdate --install-rosetta --agree-to-license").font(.caption.monospaced())
+ }
+ }.frame(maxWidth: 440)
+ }
+
+ Toggle(isOn: $acceptGPTK) {
+ VStack(alignment: .leading, spacing: 2) {
+ Text("Enable D3DMetal (DirectX 12 support)")
+ HStack(spacing: 4) {
+ Text("Requires accepting").font(.caption).foregroundStyle(.secondary)
+ Button("Apple’s Game Porting Toolkit license") {
+ state.loadGPTKLicense()
+ state.showGPTKLicense = true
+ }.buttonStyle(.link).font(.caption)
+ }
+ }
+ }
+ .toggleStyle(.checkbox)
+ .frame(maxWidth: 440, alignment: .leading)
+
+ Button {
+ state.installDefaultEngine(acceptGPTK: acceptGPTK)
+ } label: {
+ Text(state.busy ? "Installing…" : "Install engine")
+ .frame(minWidth: 180)
+ }
+ .buttonStyle(.borderedProminent)
+ .controlSize(.large)
+ .disabled(state.busy || !state.rosettaInstalled)
+
+ Text("Wine LGPL · DXMT MIT · DXVK Zlib · engine builds by Gcenx / Sikarugir — consider sponsoring them.")
+ .font(.caption2).foregroundStyle(.tertiary)
+ }
+ .padding(40)
+ }
+}
+
+struct GPTKLicenseSheet: View {
+ @Environment(AppState.self) private var state
+ @Environment(\.dismiss) private var dismiss
+
+ var body: some View {
+ VStack(alignment: .leading, spacing: 10) {
+ Text("Apple Game Porting Toolkit — Software License Agreement").font(.headline)
+ ScrollView {
+ Text(state.gptkLicenseText)
+ .font(.system(size: 11))
+ .frame(maxWidth: .infinity, alignment: .leading)
+ .textSelection(.enabled)
+ }
+ .frame(width: 640, height: 380)
+ .background(.quaternary.opacity(0.4))
+ HStack {
+ Text("Non-commercial use only · no modification · Apple hardware only")
+ .font(.caption).foregroundStyle(.secondary)
+ Spacer()
+ Button("Close") { dismiss() }
+ if let engine = state.engines.first, engine.rendererDir("d3dmetal") == nil {
+ Button("Accept & enable D3DMetal") {
+ state.acceptGPTK(engine: engine)
+ dismiss()
+ }.buttonStyle(.borderedProminent)
+ }
+ }
+ }
+ .padding(16)
+ }
+}
diff --git a/Sources/HighballApp/HighballApp.swift b/Sources/HighballApp/HighballApp.swift
new file mode 100644
index 0000000..d5ec987
--- /dev/null
+++ b/Sources/HighballApp/HighballApp.swift
@@ -0,0 +1,152 @@
+import AppKit
+import HighballKit
+import SwiftUI
+
+@main
+struct HighballApp: App {
+ @NSApplicationDelegateAdaptor(AppDelegate.self) var delegate
+ @State private var state = AppState()
+
+ var body: some Scene {
+ WindowGroup("Highball") {
+ ContentView()
+ .environment(state)
+ .frame(minWidth: 780, minHeight: 520)
+ .onAppear { state.refresh() }
+ }
+ .windowResizability(.contentSize)
+ }
+}
+
+final class AppDelegate: NSObject, NSApplicationDelegate {
+ func applicationDidFinishLaunching(_ notification: Notification) {
+ // Works as a bare SwiftPM executable during development: give it a real UI presence.
+ NSApp.setActivationPolicy(.regular)
+ NSApp.activate(ignoringOtherApps: true)
+ }
+ func applicationShouldTerminateAfterLastWindowClosed(_ sender: NSApplication) -> Bool { true }
+}
+
+struct ContentView: View {
+ @Environment(AppState.self) private var state
+ @State private var showCreate = false
+
+ var body: some View {
+ @Bindable var state = state
+ Group {
+ if state.needsOnboarding {
+ OnboardingView()
+ } else {
+ NavigationSplitView {
+ List(selection: $state.selectedBottle) {
+ Section("Bottles") {
+ ForEach(state.bottles, id: \.name) { bottle in
+ Label(bottle.name, systemImage: "wineglass")
+ .tag(bottle.name)
+ }
+ }
+ if let engine = state.engines.first {
+ Section("Engine") {
+ VStack(alignment: .leading, spacing: 2) {
+ Text(engine.id).font(.caption).lineLimit(1)
+ Text((try? engine.wineVersion()) ?? "")
+ .font(.caption2).foregroundStyle(.secondary)
+ }
+ }
+ }
+ }
+ .navigationSplitViewColumnWidth(min: 200, ideal: 230)
+ .toolbar {
+ Button { showCreate = true } label: { Label("New Bottle", systemImage: "plus") }
+ }
+ } detail: {
+ if let name = state.selectedBottle,
+ let bottle = state.bottles.first(where: { $0.name == name }) {
+ BottleView(bottle: bottle)
+ } else {
+ ContentUnavailableView("No bottle selected", systemImage: "wineglass",
+ description: Text("Create a bottle to install Steam and play."))
+ }
+ }
+ }
+ }
+ .sheet(isPresented: $showCreate) { CreateBottleSheet() }
+ .sheet(isPresented: $state.showLog) { LogSheet() }
+ .sheet(isPresented: $state.showGPTKLicense) { GPTKLicenseSheet() }
+ .alert("Something went wrong", isPresented: .init(
+ get: { state.errorMessage != nil },
+ set: { if !$0 { state.errorMessage = nil } })) {
+ Button("OK") { state.errorMessage = nil }
+ } message: { Text(state.errorMessage ?? "") }
+ .alert(item: $state.crashSuggestion) { s in
+ Alert(title: Text("\(s.program) exited right away"),
+ message: Text("That usually means the graphics backend doesn't suit it. Try \(s.renderer.rawValue.uppercased())? The log is at \(s.logPath)."),
+ primaryButton: .default(Text("Use \(s.renderer.rawValue.uppercased())")) {
+ if let name = state.selectedBottle, var bottle = state.bottles.first(where: { $0.name == name }) {
+ bottle.settings.renderer = s.renderer
+ state.update(bottle)
+ }
+ },
+ secondaryButton: .cancel(Text("Keep current")))
+ }
+ }
+}
+
+struct CreateBottleSheet: View {
+ @Environment(AppState.self) private var state
+ @Environment(\.dismiss) private var dismiss
+ @State private var name = "play"
+ @State private var installSteam = true
+
+ var body: some View {
+ VStack(alignment: .leading, spacing: 14) {
+ Text("New bottle").font(.title2.bold())
+ TextField("Name", text: $name).textFieldStyle(.roundedBorder).frame(width: 260)
+ Toggle("Install Steam in it (recommended)", isOn: $installSteam)
+ Text("A bottle is an isolated Windows environment. First boot takes about 90 seconds; the Steam install adds a download and a slow one-time client update.")
+ .font(.callout).foregroundStyle(.secondary).frame(maxWidth: 380, alignment: .leading)
+ HStack {
+ Spacer()
+ Button("Cancel") { dismiss() }
+ Button("Create") {
+ dismiss()
+ state.createBottle(name: name, recipeID: installSteam ? "steam" : nil)
+ }
+ .keyboardShortcut(.defaultAction)
+ .disabled(name.trimmingCharacters(in: .whitespaces).isEmpty)
+ }
+ }
+ .padding(24)
+ }
+}
+
+struct LogSheet: View {
+ @Environment(AppState.self) private var state
+ @Environment(\.dismiss) private var dismiss
+
+ var body: some View {
+ VStack(alignment: .leading, spacing: 8) {
+ HStack {
+ if state.busy { ProgressView().controlSize(.small) }
+ Text(state.busy ? state.busyTitle : "Done").font(.headline)
+ Spacer()
+ Button(state.busy ? "Hide" : "Close") { dismiss() }
+ }
+ ScrollViewReader { proxy in
+ ScrollView {
+ LazyVStack(alignment: .leading, spacing: 1) {
+ ForEach(Array(state.logLines.enumerated()), id: \.offset) { i, line in
+ Text(line).font(.system(size: 11, design: .monospaced))
+ .frame(maxWidth: .infinity, alignment: .leading)
+ .id(i)
+ }
+ }
+ }
+ .onChange(of: state.logLines.count) { _, n in proxy.scrollTo(max(0, n - 1)) }
+ }
+ .frame(width: 620, height: 320)
+ .background(.quaternary.opacity(0.4))
+ }
+ .padding(16)
+ }
+}
diff --git a/Sources/HighballKit/Bottle.swift b/Sources/HighballKit/Bottle.swift
new file mode 100644
index 0000000..a9d717b
--- /dev/null
+++ b/Sources/HighballKit/Bottle.swift
@@ -0,0 +1,166 @@
+import Foundation
+
+/// Graphics backend applied to a bottle (or overridden per program).
+public enum Renderer: String, Codable, CaseIterable, Sendable {
+ /// Wine's own D3D-on-OpenGL. Slow; last resort.
+ case wined3d
+ /// D3D10/11 → Metal. Gin's default.
+ case dxmt
+ /// Apple's D3D11/12 → Metal. Only D3D12 path. Apple-licensed, optional download.
+ case d3dmetal
+ /// D3D9/10/11 → Vulkan → MoltenVK. Use for D3D9 titles.
+ case dxvk
+
+ /// Environment contributed by this renderer, given the engine that hosts it.
+ public func environment(engine: InstalledEngine) throws -> [String: String] {
+ var env: [String: String] = [:]
+ switch self {
+ case .wined3d:
+ return env
+ case .dxmt:
+ guard let dir = engine.rendererDir("dxmt") else { throw HighballError.missing("dxmt renderer in engine \(engine.id)") }
+ env["WINEDLLPATH_PREPEND"] = dir.appending(path: "wine").path
+ case .d3dmetal:
+ guard let dir = engine.rendererDir("d3dmetal") else { throw HighballError.missing("d3dmetal renderer in engine \(engine.id) (optional component not installed?)") }
+ let external = dir.appending(path: "external").path
+ env["WINEDLLPATH_PREPEND"] = dir.appending(path: "wine").path
+ env["CX_D3DMETALPATH"] = external
+ env["DYLD_FALLBACK_LIBRARY_PATH+"] = external
+ env["DYLD_FALLBACK_FRAMEWORK_PATH+"] = external
+ case .dxvk:
+ guard let dir = engine.rendererDir("dxvk") else { throw HighballError.missing("dxvk renderer in engine \(engine.id)") }
+ env["WINEDLLPATH_PREPEND"] = dir.appending(path: "wine").path
+ env["WINEDLLOVERRIDES+"] = "dxgi,d3d9,d3d10core,d3d11=n,b"
+ }
+ return env
+ }
+}
+
+public enum WindowsVersion: String, Codable, CaseIterable, Sendable {
+ case win7, win8, win81, win10, win11
+}
+
+public enum SyncMode: String, Codable, CaseIterable, Sendable {
+ case none, esync, msync
+}
+
+/// A pinned program inside a bottle.
+public struct Pin: Codable, Sendable, Identifiable, Hashable {
+ public var id: UUID = UUID()
+ public var name: String
+ /// Path relative to the bottle's `drive_c`.
+ public var path: String
+ public var arguments: [String] = []
+ public var environment: [String: String] = [:]
+ public var renderer: Renderer? = nil
+
+ public init(name: String, path: String, arguments: [String] = [], environment: [String: String] = [:], renderer: Renderer? = nil) {
+ self.name = name; self.path = path; self.arguments = arguments; self.environment = environment; self.renderer = renderer
+ }
+}
+
+/// Persisted as `<bottle>/gin.json`.
+public struct BottleSettings: Codable, Sendable {
+ public var formatVersion: Int = 1
+ public var name: String
+ public var engineID: String
+ public var renderer: Renderer = .dxmt
+ public var windowsVersion: WindowsVersion = .win10
+ public var sync: SyncMode = .msync
+ public var metalHUD: Bool = false
+ public var advertiseAVX: Bool = false
+ public var environment: [String: String] = [:]
+ public var pins: [Pin] = []
+ public var recipes: [String] = []
+ public var created: Date = Date()
+
+ public init(name: String, engineID: String) {
+ self.name = name
+ self.engineID = engineID
+ }
+}
+
+public struct Bottle: Sendable {
+ public let url: URL
+ public var settings: BottleSettings
+
+ public var name: String { settings.name }
+ public var driveC: URL { url.appending(path: "drive_c", directoryHint: .isDirectory) }
+ public var settingsURL: URL { url.appending(path: "bottle.json") }
+
+ public init(url: URL, settings: BottleSettings) {
+ self.url = url
+ self.settings = settings
+ }
+
+ public static func load(_ url: URL) throws -> Bottle {
+ let modern = url.appending(path: "bottle.json")
+ let legacy = url.appending(path: "gin.json")
+ let file = FileManager.default.fileExists(atPath: modern.path) ? modern : legacy
+ let data = try Data(contentsOf: file)
+ let settings = try JSONDecoder.gin.decode(BottleSettings.self, from: data)
+ return Bottle(url: url, settings: settings)
+ }
+
+ public func save() throws {
+ try JSONEncoder.gin.encode(settings).write(to: settingsURL, options: .atomic)
+ }
+
+ /// Environment for running something in this bottle: engine base + bottle settings + renderer + extras.
+ /// Keys ending in `+` are appended to an existing value with `:` (paths) or `;` (WINEDLLOVERRIDES).
+ public func environment(engine: InstalledEngine, renderer: Renderer? = nil, extra: [String: String] = [:]) throws -> [String: String] {
+ var env = engine.baseEnvironment()
+ env["WINEPREFIX"] = url.path
+ env["WINEDEBUG"] = "fixme-all"
+ // Explicit 0s matter: Steam's CEF webhelper hangs under msync/esync on Wine 10 (see recipes/launchers/steam.json).
+ switch settings.sync {
+ case .none: env["WINEMSYNC"] = "0"; env["WINEESYNC"] = "0"
+ case .esync: env["WINEESYNC"] = "1"; env["WINEMSYNC"] = "0"
+ case .msync: env["WINEMSYNC"] = "1"; env["WINEESYNC"] = "0"
+ }
+ if settings.metalHUD { env["MTL_HUD_ENABLED"] = "1" }
+ if settings.advertiseAVX { env["ROSETTA_ADVERTISE_AVX"] = "1" }
+ merge(&env, settings.environment)
+ merge(&env, try (renderer ?? settings.renderer).environment(engine: engine))
+ merge(&env, extra)
+ return env
+ }
+
+ private func merge(_ env: inout [String: String], _ add: [String: String]) {
+ for (k, v) in add {
+ if k.hasSuffix("+") {
+ let key = String(k.dropLast())
+ let sep = key == "WINEDLLOVERRIDES" ? ";" : ":"
+ env[key] = [v, env[key]].compactMap { $0 }.filter { !$0.isEmpty }.joined(separator: sep)
+ } else {
+ env[k] = v
+ }
+ }
+ }
+
+ /// Convert a Windows path like `C:\Program Files (x86)\Steam\steam.exe` to a file URL inside the bottle.
+ public func resolve(windowsPath: String) -> URL {
+ var p = windowsPath
+ if p.lowercased().hasPrefix("c:") { p = String(p.dropFirst(2)) }
+ p = p.replacingOccurrences(of: "\\", with: "/")
+ if p.hasPrefix("/") { p.removeFirst() }
+ return driveC.appending(path: p)
+ }
+}
+
+extension JSONEncoder {
+ static var gin: JSONEncoder {
+ let e = JSONEncoder()
+ e.outputFormatting = [.prettyPrinted, .sortedKeys, .withoutEscapingSlashes]
+ e.dateEncodingStrategy = .iso8601
+ return e
+ }
+}
+
+extension JSONDecoder {
+ static var gin: JSONDecoder {
+ let d = JSONDecoder()
+ d.dateDecodingStrategy = .iso8601
+ return d
+ }
+}
diff --git a/Sources/HighballKit/BottleStore.swift b/Sources/HighballKit/BottleStore.swift
new file mode 100644
index 0000000..fb5ea0f
--- /dev/null
+++ b/Sources/HighballKit/BottleStore.swift
@@ -0,0 +1,47 @@
+import Foundation
+
+public struct BottleStore: Sendable {
+ public let paths: HighballPaths
+ public init(paths: HighballPaths = HighballPaths()) { self.paths = paths }
+
+ public func list() throws -> [Bottle] {
+ guard FileManager.default.fileExists(atPath: paths.bottles.path) else { return [] }
+ return try FileManager.default.contentsOfDirectory(at: paths.bottles, includingPropertiesForKeys: nil)
+ .compactMap { try? Bottle.load($0) }
+ .sorted { $0.name < $1.name }
+ }
+
+ public func get(_ name: String) throws -> Bottle {
+ try Bottle.load(paths.bottle(name))
+ }
+
+ /// Creates the directory + gin.json, then runs `wineboot -u` to populate the prefix.
+ public func create(name: String, engine: InstalledEngine, renderer: Renderer = .dxmt, windowsVersion: WindowsVersion = .win10) async throws -> Bottle {
+ try paths.ensure()
+ let url = paths.bottle(name)
+ guard !FileManager.default.fileExists(atPath: url.path) else { throw HighballError.invalid("bottle '\(name)' already exists") }
+ try FileManager.default.createDirectory(at: url, withIntermediateDirectories: true)
+ var settings = BottleSettings(name: name, engineID: engine.id)
+ settings.renderer = renderer
+ settings.windowsVersion = windowsVersion
+ let bottle = Bottle(url: url, settings: settings)
+ try bottle.save()
+ let runner = WineRunner(paths: paths, engine: engine, bottle: bottle)
+ let result = try await runner.wineboot()
+ guard result.exitStatus == 0 else {
+ throw HighballError.processFailed(command: "wineboot -u", status: result.exitStatus, output: "see \(result.log.path)")
+ }
+ if windowsVersion != .win10 { try await runner.setWindowsVersion(windowsVersion) }
+ return bottle
+ }
+
+ public func delete(_ name: String) throws {
+ let url = paths.bottle(name)
+ guard FileManager.default.fileExists(atPath: url.appending(path: "bottle.json").path) else {
+ throw HighballError.missing("bottle '\(name)'")
+ }
+ try FileManager.default.removeItem(at: url)
+ }
+
+ public func update(_ bottle: Bottle) throws { try bottle.save() }
+}
diff --git a/Sources/HighballKit/EngineStore.swift b/Sources/HighballKit/EngineStore.swift
new file mode 100644
index 0000000..3e23edf
--- /dev/null
+++ b/Sources/HighballKit/EngineStore.swift
@@ -0,0 +1,232 @@
+import CryptoKit
+import Foundation
+
+public enum HighballError: Error, CustomStringConvertible {
+ case checksumMismatch(file: String, expected: String, actual: String)
+ case processFailed(command: String, status: Int32, output: String)
+ case missing(String)
+ case invalid(String)
+
+ public var description: String {
+ switch self {
+ case let .checksumMismatch(file, expected, actual):
+ return "checksum mismatch for \(file): expected \(expected), got \(actual)"
+ case let .processFailed(command, status, output):
+ return "\(command) exited with \(status)\n\(output)"
+ case let .missing(what): return "missing: \(what)"
+ case let .invalid(what): return "invalid: \(what)"
+ }
+ }
+}
+
+/// Progress callback: (component name, bytes received, total bytes or nil).
+public typealias DownloadProgress = @Sendable (String, Int64, Int64?) -> Void
+
+/// Downloads, verifies and lays out engines from manifests.
+///
+/// Installed layout: `engines/<id>/{engine, frameworks, renderers/<name>/..., manifest.json}`
+public struct EngineStore: Sendable {
+ public let paths: HighballPaths
+
+ public init(paths: HighballPaths = HighballPaths()) { self.paths = paths }
+
+ // MARK: Query
+
+ public func installedEngines() throws -> [InstalledEngine] {
+ guard FileManager.default.fileExists(atPath: paths.engines.path) else { return [] }
+ let dirs = try FileManager.default.contentsOfDirectory(at: paths.engines, includingPropertiesForKeys: nil)
+ return dirs.compactMap { dir in
+ let manifest = dir.appending(path: "manifest.json")
+ guard let m = try? EngineManifest.load(from: manifest) else { return nil }
+ return InstalledEngine(manifest: m, root: dir)
+ }.sorted { $0.manifest.id < $1.manifest.id }
+ }
+
+ public func engine(_ id: String) throws -> InstalledEngine {
+ let root = paths.engine(id)
+ let m = try EngineManifest.load(from: root.appending(path: "manifest.json"))
+ return InstalledEngine(manifest: m, root: root)
+ }
+
+ // MARK: Install
+
+ /// Installs every component of `manifest`. Optional components are skipped unless their
+ /// `acceptance` id is in `accepted` (or they have no acceptance requirement and `includeOptional`).
+ public func install(
+ _ manifest: EngineManifest,
+ accepted: Set<String> = [],
+ includeOptional: Bool = true,
+ progress: DownloadProgress? = nil
+ ) async throws -> InstalledEngine {
+ try paths.ensure()
+ let root = paths.engine(manifest.id)
+ let staging = paths.engines.appending(path: ".\(manifest.id).partial", directoryHint: .isDirectory)
+ try? FileManager.default.removeItem(at: staging)
+ try FileManager.default.createDirectory(at: staging, withIntermediateDirectories: true)
+
+ for (name, component) in manifest.orderedComponents {
+ if component.isOptional {
+ if let acceptance = component.acceptance, !accepted.contains(acceptance) { continue }
+ if component.acceptance == nil, !includeOptional { continue }
+ }
+ let archive = try await download(component, name: name, progress: progress)
+ try extract(archive, component: component, name: name, into: staging)
+ }
+
+ var saved = manifest
+ saved.acceptedLicenses = Array(accepted).sorted()
+ try saved.save(to: staging.appending(path: "manifest.json"))
+ try linkRuntime(staging)
+ try? FileManager.default.removeItem(at: root)
+ try FileManager.default.moveItem(at: staging, to: root)
+ try stripQuarantine(root)
+ return InstalledEngine(manifest: saved, root: root)
+ }
+
+ /// Records acceptance of a license for an already-installed engine.
+ public func accept(license id: String, engine: InstalledEngine) throws -> InstalledEngine {
+ var m = engine.manifest
+ var set = Set(m.acceptedLicenses ?? []); set.insert(id)
+ m.acceptedLicenses = set.sorted()
+ try m.save(to: engine.root.appending(path: "manifest.json"))
+ return InstalledEngine(manifest: m, root: engine.root)
+ }
+
+ /// Downloads to `downloads/<basename>` and verifies SHA-256. Reuses a cached file if it verifies.
+ public func download(_ component: EngineManifest.Component, name: String, progress: DownloadProgress? = nil) async throws -> URL {
+ try paths.ensure()
+ let dest = paths.downloads.appending(path: component.url.lastPathComponent)
+ if FileManager.default.fileExists(atPath: dest.path), try sha256(of: dest) == component.sha256.lowercased() {
+ return dest
+ }
+ let (tmp, response) = try await URLSession.shared.download(from: component.url, delegate: nil)
+ if let http = response as? HTTPURLResponse, !(200..<300).contains(http.statusCode) {
+ throw HighballError.invalid("HTTP \(http.statusCode) for \(component.url)")
+ }
+ try? FileManager.default.removeItem(at: dest)
+ try FileManager.default.moveItem(at: tmp, to: dest)
+ let actual = try sha256(of: dest)
+ guard actual == component.sha256.lowercased() else {
+ try? FileManager.default.removeItem(at: dest)
+ throw HighballError.checksumMismatch(file: dest.lastPathComponent, expected: component.sha256, actual: actual)
+ }
+ progress?(name, Int64(component.size ?? 0), Int64(component.size ?? 0))
+ return dest
+ }
+
+ func extract(_ archive: URL, component: EngineManifest.Component, name: String, into root: URL) throws {
+ guard let ex = component.extract else {
+ // Plain file (e.g. winetricks script): copy into tools/.
+ let tools = root.appending(path: "tools", directoryHint: .isDirectory)
+ try FileManager.default.createDirectory(at: tools, withIntermediateDirectories: true)
+ let dest = tools.appending(path: archive.lastPathComponent)
+ try? FileManager.default.removeItem(at: dest)
+ try FileManager.default.copyItem(at: archive, to: dest)
+ try FileManager.default.setAttributes([.posixPermissions: 0o755], ofItemAtPath: dest.path)
+ return
+ }
+ let scratch = root.appending(path: ".extract-\(name)", directoryHint: .isDirectory)
+ try FileManager.default.createDirectory(at: scratch, withIntermediateDirectories: true)
+ try Shell.run("/usr/bin/tar", ["-xf", archive.path, "-C", scratch.path])
+
+ let source: URL
+ if let sub = ex.subpath ?? ex.strip {
+ source = scratch.appending(path: sub)
+ } else {
+ source = scratch
+ }
+ guard FileManager.default.fileExists(atPath: source.path) else {
+ throw HighballError.missing("\(ex.subpath ?? ex.strip ?? "") inside \(archive.lastPathComponent)")
+ }
+ let dest = root.appending(path: ex.into, directoryHint: .isDirectory)
+ try FileManager.default.createDirectory(at: dest.deletingLastPathComponent(), withIntermediateDirectories: true)
+ try? FileManager.default.removeItem(at: dest)
+ try FileManager.default.moveItem(at: source, to: dest)
+ try? FileManager.default.removeItem(at: scratch)
+ }
+
+ /// Symlinks the Template's runtime dylibs into engine/lib so Wine binaries resolve
+ /// @loader_path/../lib/… and @rpath names without any DYLD_* environment (which SIP
+ /// strips when a restricted binary like /bin/sh sits in the exec chain — winetricks does).
+ func linkRuntime(_ root: URL) throws {
+ let fm = FileManager.default
+ let engineLib = root.appending(path: "engine/lib", directoryHint: .isDirectory)
+ guard fm.fileExists(atPath: engineLib.path) else { return }
+ var sources = [root.appending(path: "frameworks", directoryHint: .isDirectory)]
+ sources.append(root.appending(path: "frameworks/GStreamer.framework/Versions/1.0/lib", directoryHint: .isDirectory))
+ for dir in sources {
+ guard let entries = try? fm.contentsOfDirectory(at: dir, includingPropertiesForKeys: nil) else { continue }
+ for entry in entries where entry.pathExtension == "dylib" {
+ let dest = engineLib.appending(path: entry.lastPathComponent)
+ if !fm.fileExists(atPath: dest.path) {
+ try? fm.createSymbolicLink(at: dest, withDestinationURL: entry)
+ }
+ }
+ }
+ // GStreamer.framework itself, for modules that reference it by framework path.
+ let fw = engineLib.appending(path: "GStreamer.framework")
+ if !fm.fileExists(atPath: fw.path) {
+ try? fm.createSymbolicLink(at: fw, withDestinationURL: root.appending(path: "frameworks/GStreamer.framework"))
+ }
+ }
+
+ func stripQuarantine(_ url: URL) throws {
+ try? Shell.run("/usr/bin/xattr", ["-dr", "com.apple.quarantine", url.path])
+ }
+
+ public func sha256(of url: URL) throws -> String {
+ let handle = try FileHandle(forReadingFrom: url)
+ defer { try? handle.close() }
+ var hasher = SHA256()
+ while let chunk = try handle.read(upToCount: 4 << 20), !chunk.isEmpty {
+ hasher.update(data: chunk)
+ }
+ return hasher.finalize().map { String(format: "%02x", $0) }.joined()
+ }
+}
+
+/// An engine that has been laid out on disk.
+public struct InstalledEngine: Sendable {
+ public let manifest: EngineManifest
+ public let root: URL
+
+ public var id: String { manifest.id }
+ public var engineDir: URL { root.appending(path: "engine", directoryHint: .isDirectory) }
+ public var frameworksDir: URL { root.appending(path: "frameworks", directoryHint: .isDirectory) }
+ public var renderersDir: URL { root.appending(path: "renderers", directoryHint: .isDirectory) }
+ public var wineBinary: URL { engineDir.appending(path: "bin/wine") }
+ public var wineserverBinary: URL { engineDir.appending(path: "bin/wineserver") }
+ public var winetricks: URL? {
+ let t = root.appending(path: "tools/winetricks")
+ return FileManager.default.fileExists(atPath: t.path) ? t : nil
+ }
+
+ /// Renderer overlay directory: Gin's own `renderers/<name>` wins over the Template's `frameworks/renderer/<name>`.
+ public func rendererDir(_ name: String) -> URL? {
+ if let gate = EngineManifest.gatedRenderers[name], !(manifest.acceptedLicenses ?? []).contains(gate) { return nil }
+ let own = renderersDir.appending(path: name, directoryHint: .isDirectory)
+ if FileManager.default.fileExists(atPath: own.appending(path: "wine").path) { return own }
+ let template = frameworksDir.appending(path: "renderer/\(name)", directoryHint: .isDirectory)
+ if FileManager.default.fileExists(atPath: template.appending(path: "wine").path) { return template }
+ return nil
+ }
+
+ public func wineVersion() throws -> String {
+ try Shell.capture(wineBinary.path, ["--version"], env: baseEnvironment()).trimmingCharacters(in: .whitespacesAndNewlines)
+ }
+
+ /// Environment every Wine process needs for this engine, before bottle/renderer settings.
+ public func baseEnvironment() -> [String: String] {
+ let fw = frameworksDir.path
+ var env: [String: String] = [
+ "DYLD_FALLBACK_LIBRARY_PATH": "\(fw):\(fw)/GStreamer.framework/Versions/1.0/lib",
+ "DYLD_FALLBACK_FRAMEWORK_PATH": fw,
+ "GST_PLUGIN_PATH": "\(fw)/GStreamer.framework/Versions/1.0/lib/gstreamer-1.0",
+ ]
+ for (k, v) in manifest.baseEnv ?? [:] {
+ env[k] = v.replacingOccurrences(of: "${frameworks}", with: fw)
+ .replacingOccurrences(of: "${renderers}", with: renderersDir.path)
+ }
+ return env
+ }
+}
diff --git a/Sources/HighballKit/Manifest.swift b/Sources/HighballKit/Manifest.swift
new file mode 100644
index 0000000..af6cbd7
--- /dev/null
+++ b/Sources/HighballKit/Manifest.swift
@@ -0,0 +1,73 @@
+import Foundation
+
+/// An engine manifest describes every binary Gin downloads to assemble one engine.
+/// Gin ships manifests, never binaries. See `spike/engine-manifest.json` for the
+/// first real one.
+public struct EngineManifest: Codable, Sendable, Identifiable {
+ public struct Extract: Codable, Sendable {
+ /// Path inside the archive to take (e.g. `Template-1.0.11.app/Contents/Frameworks`).
+ public var subpath: String?
+ /// Single top-level directory to strip (e.g. `wswine.bundle`). Equivalent to `subpath` for the common case.
+ public var strip: String?
+ /// Destination relative to the engine directory (`engine`, `frameworks`, `renderers/dxmt/wine`).
+ public var into: String
+ }
+
+ public struct Component: Codable, Sendable {
+ public var kind: String
+ public var url: URL
+ public var sha256: String
+ public var size: Int?
+ public var license: String?
+ public var optional: Bool?
+ /// Identifier of a license the user must accept before this component is downloaded.
+ public var acceptance: String?
+ public var extract: Extract?
+ public var note: String?
+ public var version: String?
+
+ public var isOptional: Bool { optional ?? false }
+ }
+
+ public var id: String
+ public var displayName: String
+ public var arch: String
+ public var minMacOS: String
+ public var requires: [String]?
+ public var notes: [String]?
+ public var components: [String: Component]
+ public var baseEnv: [String: String]?
+ /// License ids that gate optional renderers (e.g. `apple-gptk-license-2023-08-17` → d3dmetal).
+ public var licenses: [String: License]?
+ /// Filled in at install time with the license ids the user accepted.
+ public var acceptedLicenses: [String]?
+
+ public struct License: Codable, Sendable {
+ public var applies: [String]?
+ public var text: String?
+ public var summary: String?
+ }
+
+ /// Renderer overlay names gated behind a license id.
+ public static let gatedRenderers: [String: String] = ["d3dmetal": "apple-gptk-license-2023-08-17"]
+
+ public static func load(from url: URL) throws -> EngineManifest {
+ let data = try Data(contentsOf: url)
+ let decoder = JSONDecoder()
+ return try decoder.decode(EngineManifest.self, from: data)
+ }
+
+ public func save(to url: URL) throws {
+ let encoder = JSONEncoder()
+ encoder.outputFormatting = [.prettyPrinted, .sortedKeys, .withoutEscapingSlashes]
+ try encoder.encode(self).write(to: url, options: .atomic)
+ }
+
+ /// Components in a deterministic install order: required first, then optional.
+ public var orderedComponents: [(name: String, component: Component)] {
+ components.sorted { a, b in
+ if a.value.isOptional != b.value.isOptional { return !a.value.isOptional }
+ return a.key < b.key
+ }.map { ($0.key, $0.value) }
+ }
+}
diff --git a/Sources/HighballKit/Paths.swift b/Sources/HighballKit/Paths.swift
new file mode 100644
index 0000000..0b28b51
--- /dev/null
+++ b/Sources/HighballKit/Paths.swift
@@ -0,0 +1,35 @@
+import Foundation
+
+/// GitHub repo that receives community compatibility reports (owner/name).
+public let reportRepo = "gauthierpiarrette/highball-db"
+
+/// Filesystem layout for everything Gin owns. Mirrors the spike layout under
+/// `~/Library/Application Support/Gin`, overridable with `HIGHBALL_HOME` for tests.
+public struct HighballPaths: Sendable {
+ public let home: URL
+
+ public init(home: URL? = nil) {
+ if let home { self.home = home; return }
+ if let env = ProcessInfo.processInfo.environment["HIGHBALL_HOME"] {
+ self.home = URL(fileURLWithPath: env, isDirectory: true)
+ } else {
+ let support = FileManager.default.urls(for: .applicationSupportDirectory, in: .userDomainMask)[0]
+ self.home = support.appending(path: "Highball", directoryHint: .isDirectory)
+ }
+ }
+
+ public var downloads: URL { home.appending(path: "downloads", directoryHint: .isDirectory) }
+ public var engines: URL { home.appending(path: "engines", directoryHint: .isDirectory) }
+ public var bottles: URL { home.appending(path: "bottles", directoryHint: .isDirectory) }
+ public var logs: URL { home.appending(path: "logs", directoryHint: .isDirectory) }
+ public var manifests: URL { home.appending(path: "manifests", directoryHint: .isDirectory) }
+
+ public func engine(_ id: String) -> URL { engines.appending(path: id, directoryHint: .isDirectory) }
+ public func bottle(_ name: String) -> URL { bottles.appending(path: name, directoryHint: .isDirectory) }
+
+ public func ensure() throws {
+ for dir in [home, downloads, engines, bottles, logs, manifests] {
+ try FileManager.default.createDirectory(at: dir, withIntermediateDirectories: true)
+ }
+ }
+}
diff --git a/Sources/HighballKit/Recipe.swift b/Sources/HighballKit/Recipe.swift
new file mode 100644
index 0000000..45634ca
--- /dev/null
+++ b/Sources/HighballKit/Recipe.swift
@@ -0,0 +1,168 @@
+import Foundation
+
+/// A recipe is declarative data (JSON, CC0 in gin-db) describing how to install and configure
+/// a launcher or game inside a bottle. Steps run in order; each is idempotent where possible.
+public struct Recipe: Codable, Sendable, Identifiable {
+ public enum Kind: String, Codable, Sendable { case launcher, game, tweak }
+
+ public enum Step: Codable, Sendable {
+ /// Download a file (verified if sha256 given) and run it inside the bottle.
+ case installer(url: URL, sha256: String?, arguments: [String], label: String)
+ /// `wine reg add`.
+ case registry(key: String, name: String, type: String, data: String)
+ /// Run winetricks verbs (unattended).
+ case winetricks(verbs: [String])
+ /// Set a persistent environment variable on the bottle.
+ case environment(name: String, value: String)
+ /// Set the bottle's renderer.
+ case renderer(Renderer)
+ /// Set the bottle's synchronization mode (none | esync | msync).
+ case sync(SyncMode)
+ /// Write a text file inside drive_c.
+ case file(path: String, contents: String)
+ /// Add a pinned program to the bottle.
+ case pin(Pin)
+ /// Free-text instruction the UI surfaces to the user after install.
+ case note(String)
+
+ private enum CodingKeys: String, CodingKey { case type, url, sha256, arguments, label, key, name, value, valueType, data, verbs, renderer, sync, path, contents, pin, text }
+
+ public init(from decoder: Decoder) throws {
+ let c = try decoder.container(keyedBy: CodingKeys.self)
+ switch try c.decode(String.self, forKey: .type) {
+ case "installer":
+ self = .installer(url: try c.decode(URL.self, forKey: .url),
+ sha256: try c.decodeIfPresent(String.self, forKey: .sha256),
+ arguments: try c.decodeIfPresent([String].self, forKey: .arguments) ?? [],
+ label: try c.decodeIfPresent(String.self, forKey: .label) ?? "installer")
+ case "registry":
+ self = .registry(key: try c.decode(String.self, forKey: .key), name: try c.decode(String.self, forKey: .name),
+ type: try c.decodeIfPresent(String.self, forKey: .valueType) ?? "REG_DWORD", data: try c.decode(String.self, forKey: .data))
+ case "winetricks": self = .winetricks(verbs: try c.decode([String].self, forKey: .verbs))
+ case "environment": self = .environment(name: try c.decode(String.self, forKey: .name), value: try c.decode(String.self, forKey: .value))
+ case "renderer": self = .renderer(try c.decode(Renderer.self, forKey: .renderer))
+ case "sync": self = .sync(try c.decode(SyncMode.self, forKey: .sync))
+ case "file": self = .file(path: try c.decode(String.self, forKey: .path), contents: try c.decode(String.self, forKey: .contents))
+ case "pin": self = .pin(try c.decode(Pin.self, forKey: .pin))
+ case "note": self = .note(try c.decode(String.self, forKey: .text))
+ case let other: throw HighballError.invalid("unknown recipe step type '\(other)'")
+ }
+ }
+
+ public func encode(to encoder: Encoder) throws {
+ var c = encoder.container(keyedBy: CodingKeys.self)
+ switch self {
+ case let .installer(url, sha256, arguments, label):
+ try c.encode("installer", forKey: .type); try c.encode(url, forKey: .url)
+ try c.encodeIfPresent(sha256, forKey: .sha256); try c.encode(arguments, forKey: .arguments); try c.encode(label, forKey: .label)
+ case let .registry(key, name, type, data):
+ try c.encode("registry", forKey: .type); try c.encode(key, forKey: .key); try c.encode(name, forKey: .name)
+ try c.encode(type, forKey: .valueType); try c.encode(data, forKey: .data)
+ case let .winetricks(verbs): try c.encode("winetricks", forKey: .type); try c.encode(verbs, forKey: .verbs)
+ case let .environment(name, value): try c.encode("environment", forKey: .type); try c.encode(name, forKey: .name); try c.encode(value, forKey: .value)
+ case let .renderer(r): try c.encode("renderer", forKey: .type); try c.encode(r, forKey: .renderer)
+ case let .sync(m): try c.encode("sync", forKey: .type); try c.encode(m, forKey: .sync)
+ case let .file(path, contents): try c.encode("file", forKey: .type); try c.encode(path, forKey: .path); try c.encode(contents, forKey: .contents)
+ case let .pin(p): try c.encode("pin", forKey: .type); try c.encode(p, forKey: .pin)
+ case let .note(t): try c.encode("note", forKey: .type); try c.encode(t, forKey: .text)
+ }
+ }
+ }
+
+ public struct KnownIssue: Codable, Sendable {
+ public var symptom: String
+ public var cause: String?
+ public var fix: String?
+ }
+
+ public struct Verification: Codable, Sendable {
+ public var date: String
+ public var engine: String
+ public var macos: String
+ public var chip: String
+ public var result: String
+ }
+
+ public var id: String
+ public var kind: Kind
+ public var title: String
+ public var requires: [String]?
+ public var renderer: Renderer?
+ public var steps: [Step]
+ public var knownIssues: [KnownIssue]?
+ public var lastVerified: Verification?
+
+ public static func load(from url: URL) throws -> Recipe {
+ try JSONDecoder.gin.decode(Recipe.self, from: Data(contentsOf: url))
+ }
+}
+
+/// Applies a recipe to a bottle.
+public struct RecipeRunner: Sendable {
+ public let paths: HighballPaths
+ public let engine: InstalledEngine
+ public var bottle: Bottle
+ public let store: EngineStore
+
+ public init(paths: HighballPaths = HighballPaths(), engine: InstalledEngine, bottle: Bottle) {
+ self.paths = paths; self.engine = engine; self.bottle = bottle; self.store = EngineStore(paths: paths)
+ }
+
+ /// Runs every step. Returns the notes the UI should show afterwards.
+ public mutating func apply(_ recipe: Recipe, log: (@Sendable (String) -> Void)? = nil) async throws -> [String] {
+ var notes: [String] = []
+ if let r = recipe.renderer { bottle.settings.renderer = r }
+ for (i, step) in recipe.steps.enumerated() {
+ log?("[\(recipe.id)] step \(i + 1)/\(recipe.steps.count)")
+ let runner = WineRunner(paths: paths, engine: engine, bottle: bottle)
+ switch step {
+ case let .installer(url, sha256, arguments, label):
+ let component = EngineManifest.Component(kind: "installer", url: url, sha256: sha256 ?? "", size: nil, license: nil, optional: nil, acceptance: nil, extract: nil, note: nil, version: nil)
+ let file: URL
+ if sha256 != nil {
+ file = try await store.download(component, name: label)
+ } else {
+ file = try await downloadUnverified(url)
+ }
+ let isMSI = file.pathExtension.lowercased() == "msi" || url.lastPathComponent.lowercased().contains(".msi")
+ let wineArgs = isMSI ? ["msiexec", "/i", file.path, "/qn"] + arguments : [file.path] + arguments
+ let result = try await runner.run(wineArgs, renderer: .wined3d, label: label, onOutput: log)
+ guard result.exitStatus == 0 else {
+ throw HighballError.processFailed(command: label, status: result.exitStatus, output: "see \(result.log.path)")
+ }
+ case let .registry(key, name, type, data):
+ try await runner.regAdd(key: key, name: name, type: type, data: data)
+ case let .winetricks(verbs):
+ guard let wt = engine.winetricks else { throw HighballError.missing("winetricks in engine \(engine.id)") }
+ let env = try bottle.environment(engine: engine, renderer: .wined3d, extra: ["WINE": engine.wineBinary.path, "WINESERVER": engine.wineserverBinary.path])
+ try Shell.run("/bin/sh", [wt.path, "--unattended"] + verbs, env: env)
+ case let .environment(name, value):
+ bottle.settings.environment[name] = value
+ case let .renderer(r):
+ bottle.settings.renderer = r
+ case let .sync(m):
+ bottle.settings.sync = m
+ case let .file(path, contents):
+ let url = bottle.driveC.appending(path: path)
+ try FileManager.default.createDirectory(at: url.deletingLastPathComponent(), withIntermediateDirectories: true)
+ try contents.write(to: url, atomically: true, encoding: .utf8)
+ case let .pin(p):
+ if !bottle.settings.pins.contains(where: { $0.path == p.path }) { bottle.settings.pins.append(p) }
+ case let .note(t):
+ notes.append(t)
+ }
+ }
+ if !bottle.settings.recipes.contains(recipe.id) { bottle.settings.recipes.append(recipe.id) }
+ try bottle.save()
+ return notes
+ }
+
+ private func downloadUnverified(_ url: URL) async throws -> URL {
+ try paths.ensure()
+ let dest = paths.downloads.appending(path: url.lastPathComponent)
+ let (tmp, _) = try await URLSession.shared.download(from: url)
+ try? FileManager.default.removeItem(at: dest)
+ try FileManager.default.moveItem(at: tmp, to: dest)
+ return dest
+ }
+}
diff --git a/Sources/HighballKit/Shell.swift b/Sources/HighballKit/Shell.swift
new file mode 100644
index 0000000..2c38b72
--- /dev/null
+++ b/Sources/HighballKit/Shell.swift
@@ -0,0 +1,29 @@
+import Foundation
+
+/// Minimal process helpers. Wine itself is launched through `WineRunner`, which streams output;
+/// these are for short tools (tar, xattr, wine --version, reg queries).
+public enum Shell {
+ @discardableResult
+ public static func capture(_ executable: String, _ args: [String], env: [String: String]? = nil, cwd: URL? = nil) throws -> String {
+ let p = Process()
+ p.executableURL = URL(fileURLWithPath: executable)
+ p.arguments = args
+ if let env { p.environment = ProcessInfo.processInfo.environment.merging(env) { $1 } }
+ if let cwd { p.currentDirectoryURL = cwd }
+ let out = Pipe()
+ p.standardOutput = out
+ p.standardError = out
+ try p.run()
+ let data = out.fileHandleForReading.readDataToEndOfFile()
+ p.waitUntilExit()
+ let text = String(decoding: data, as: UTF8.self)
+ guard p.terminationStatus == 0 else {
+ throw HighballError.processFailed(command: ([executable] + args).joined(separator: " "), status: p.terminationStatus, output: text)
+ }
+ return text
+ }
+
+ public static func run(_ executable: String, _ args: [String], env: [String: String]? = nil) throws {
+ _ = try capture(executable, args, env: env)
+ }
+}
diff --git a/Sources/HighballKit/WineRunner.swift b/Sources/HighballKit/WineRunner.swift
new file mode 100644
index 0000000..7750af4
--- /dev/null
+++ b/Sources/HighballKit/WineRunner.swift
@@ -0,0 +1,125 @@
+import Foundation
+
+public struct LaunchResult: Sendable {
+ public let exitStatus: Int32
+ public let duration: TimeInterval
+ public let log: URL
+ /// Heuristic: exited non-zero (or at all) within 10 s of launch. The app uses this to suggest another renderer.
+ public var crashedEarly: Bool { duration < 10 && exitStatus != 0 }
+}
+
+/// Launches Wine processes for a bottle and captures their output to `logs/`.
+public struct WineRunner: Sendable {
+ public let paths: HighballPaths
+ public let engine: InstalledEngine
+ public let bottle: Bottle
+
+ public init(paths: HighballPaths = HighballPaths(), engine: InstalledEngine, bottle: Bottle) {
+ self.paths = paths
+ self.engine = engine
+ self.bottle = bottle
+ }
+
+ /// Runs `wine <args>` and waits. `onOutput` receives each line of combined stdout/stderr.
+ @discardableResult
+ public func run(
+ _ args: [String],
+ renderer: Renderer? = nil,
+ extraEnvironment: [String: String] = [:],
+ label: String? = nil,
+ onOutput: (@Sendable (String) -> Void)? = nil
+ ) async throws -> LaunchResult {
+ try paths.ensure()
+ let env = try bottle.environment(engine: engine, renderer: renderer, extra: extraEnvironment)
+ let stamp = ISO8601DateFormatter().string(from: Date()).replacingOccurrences(of: ":", with: "")
+ let logURL = paths.logs.appending(path: "\(stamp)-\(bottle.name)-\(label ?? args.first ?? "wine").log")
+ FileManager.default.createFile(atPath: logURL.path, contents: nil)
+ let logHandle = try FileHandle(forWritingTo: logURL)
+ let header = "# gin \(engine.id) bottle=\(bottle.name) renderer=\(renderer ?? bottle.settings.renderer)\n# wine \(args.joined(separator: " "))\n"
+ logHandle.write(Data(header.utf8))
+
+ let process = Process()
+ process.executableURL = engine.wineBinary
+ process.arguments = args
+ process.environment = ProcessInfo.processInfo.environment.merging(env) { $1 }
+ process.currentDirectoryURL = bottle.driveC
+ let pipe = Pipe()
+ process.standardOutput = pipe
+ process.standardError = pipe
+
+ let start = Date()
+ try process.run()
+
+ let reader = pipe.fileHandleForReading
+ let status: Int32 = await withCheckedContinuation { cont in
+ process.terminationHandler = { p in cont.resume(returning: p.terminationStatus) }
+ // Drain synchronously on a background thread; `readDataToEndOfFile` returns at EOF.
+ DispatchQueue.global(qos: .utility).async {
+ var buffer = Data()
+ while true {
+ let chunk = reader.availableData
+ if chunk.isEmpty { break }
+ logHandle.write(chunk)
+ buffer.append(chunk)
+ while let nl = buffer.firstIndex(of: 0x0A) {
+ let line = String(decoding: buffer[..<nl], as: UTF8.self)
+ buffer.removeSubrange(...nl)
+ onOutput?(line)
+ }
+ }
+ if !buffer.isEmpty { onOutput?(String(decoding: buffer, as: UTF8.self)) }
+ }
+ }
+ try? logHandle.close()
+ return LaunchResult(exitStatus: status, duration: Date().timeIntervalSince(start), log: logURL)
+ }
+
+ /// Runs the executable directly under `wine` (not `start /unix`) so the process stays attached and
+ /// everything it and its children print lands in the log. The call returns when the program exits.
+ @discardableResult
+ public func start(_ executable: URL, arguments: [String] = [], renderer: Renderer? = nil, extraEnvironment: [String: String] = [:], onOutput: (@Sendable (String) -> Void)? = nil) async throws -> LaunchResult {
+ try await run([executable.path] + arguments, renderer: renderer, extraEnvironment: extraEnvironment, label: executable.lastPathComponent, onOutput: onOutput)
+ }
+
+ /// Runs the pinned program, honouring its own renderer/env/args.
+ @discardableResult
+ public func start(pin: Pin, onOutput: (@Sendable (String) -> Void)? = nil) async throws -> LaunchResult {
+ let exe = bottle.driveC.appending(path: pin.path)
+ return try await start(exe, arguments: pin.arguments, renderer: pin.renderer, extraEnvironment: pin.environment, onOutput: onOutput)
+ }
+
+ public func wineboot() async throws -> LaunchResult {
+ try await run(["wineboot", "-u"], renderer: .wined3d, label: "wineboot")
+ }
+
+ public func kill() throws {
+ let env = try bottle.environment(engine: engine, renderer: .wined3d)
+ try Shell.run(engine.wineserverBinary.path, ["-k"], env: env)
+ }
+
+ // MARK: Registry helpers
+
+ public func regAdd(key: String, name: String, type: String, data: String) async throws {
+ _ = try await run(["reg", "add", key, "/v", name, "/t", type, "/d", data, "/f"], renderer: .wined3d, label: "reg")
+ }
+
+ public func regQuery(key: String, name: String) async throws -> String? {
+ var lines: [String] = []
+ let collector = Collector()
+ _ = try await run(["reg", "query", key, "/v", name], renderer: .wined3d, label: "reg") { collector.append($0) }
+ lines = collector.lines
+ guard let line = lines.first(where: { $0.contains("REG_") }) else { return nil }
+ return line.split(whereSeparator: \.isWhitespace).last.map(String.init)
+ }
+
+ public func setWindowsVersion(_ v: WindowsVersion) async throws {
+ _ = try await run(["winecfg", "-v", v.rawValue], renderer: .wined3d, label: "winecfg")
+ }
+}
+
+final class Collector: @unchecked Sendable {
+ private let lock = NSLock()
+ private var storage: [String] = []
+ func append(_ s: String) { lock.lock(); storage.append(s); lock.unlock() }
+ var lines: [String] { lock.lock(); defer { lock.unlock() }; return storage }
+}
diff --git a/Sources/highball/main.swift b/Sources/highball/main.swift
new file mode 100644
index 0000000..a5ba656
--- /dev/null
+++ b/Sources/highball/main.swift
@@ -0,0 +1,296 @@
+import ArgumentParser
+import Foundation
+import HighballKit
+
+@main
+struct Highball: AsyncParsableCommand {
+ static let configuration = CommandConfiguration(
+ commandName: "highball",
+ abstract: "Highball — run Windows games on Apple Silicon. Free, open, engine-agnostic.",
+ subcommands: [Engine.self, Bottle.self, Run.self, Recipe.self, Tricks.self, Env.self, Report.self],
+ defaultSubcommand: nil
+ )
+}
+
+func fail(_ message: String) -> Never {
+ FileHandle.standardError.write(Data("error: \(message)\n".utf8))
+ exit(1)
+}
+
+// MARK: - gin engine
+
+struct Engine: AsyncParsableCommand {
+ static let configuration = CommandConfiguration(abstract: "Manage engines (Wine + renderers).", subcommands: [List.self, Install.self, Accept.self])
+
+ struct Accept: AsyncParsableCommand {
+ static let configuration = CommandConfiguration(abstract: "Accept a license for an installed engine (e.g. apple-gptk-license-2023-08-17 to enable D3DMetal).")
+ @Argument var engine: String
+ @Argument var license: String
+ func run() async throws {
+ let store = EngineStore()
+ let e = try store.accept(license: license, engine: store.engine(engine))
+ print("accepted \(license) for \(e.id); renderers now: \(HighballKit.Renderer.allCases.filter { $0 == .wined3d || e.rendererDir($0.rawValue) != nil }.map(\.rawValue).joined(separator: ","))")
+ }
+ }
+
+ struct List: AsyncParsableCommand {
+ func run() async throws {
+ let engines = try EngineStore().installedEngines()
+ if engines.isEmpty { print("no engines installed — try: highball engine install spike/engine-manifest.json"); return }
+ for e in engines {
+ let v = (try? e.wineVersion()) ?? "?"
+ let renderers = HighballKit.Renderer.allCases.filter { $0 == .wined3d || e.rendererDir($0.rawValue) != nil }.map(\.rawValue).joined(separator: ",")
+ print("\(e.id)\t\(v)\trenderers: \(renderers)")
+ }
+ }
+ }
+
+ struct Install: AsyncParsableCommand {
+ @Argument(help: "Path to an engine manifest JSON.") var manifest: String
+ @Flag(name: .customLong("accept-d3dmetal-license"), help: "Accept Apple's Game Porting Toolkit license and install D3DMetal.") var acceptD3DMetal = false
+
+ func run() async throws {
+ let m = try EngineManifest.load(from: URL(fileURLWithPath: manifest))
+ print("installing \(m.id): \(m.displayName)")
+ var accepted: Set<String> = []
+ if acceptD3DMetal { accepted.insert("apple-gptk-license-2023-08-17") }
+ let engine = try await EngineStore().install(m, accepted: accepted) { name, got, total in
+ print(" \(name): \(got)/\(total ?? 0) bytes")
+ }
+ print("installed \(engine.id) at \(engine.root.path)")
+ print("wine: \(try engine.wineVersion())")
+ }
+ }
+}
+
+// MARK: - gin bottle
+
+struct Bottle: AsyncParsableCommand {
+ static let configuration = CommandConfiguration(abstract: "Manage bottles (Wine prefixes).", subcommands: [List.self, Create.self, Delete.self, Set.self, Kill.self])
+
+ struct List: AsyncParsableCommand {
+ func run() async throws {
+ let bottles = try BottleStore().list()
+ if bottles.isEmpty { print("no bottles"); return }
+ for b in bottles {
+ print("\(b.name)\tengine=\(b.settings.engineID)\trenderer=\(b.settings.renderer.rawValue)\tpins=\(b.settings.pins.count)\trecipes=\(b.settings.recipes.joined(separator: ","))")
+ }
+ }
+ }
+
+ struct Create: AsyncParsableCommand {
+ @Argument var name: String
+ @Option(help: "Engine id (default: first installed).") var engine: String?
+ @Option(help: "Renderer: wined3d|dxmt|d3dmetal|dxvk") var renderer: HighballKit.Renderer = .dxmt
+ @Option(help: "Apply this recipe after creation (id or path).") var recipe: String?
+
+ func run() async throws {
+ let store = EngineStore()
+ let eng = try engine.map { try store.engine($0) } ?? store.installedEngines().first
+ guard let eng else { fail("no engine installed") }
+ print("creating bottle '\(name)' with \(eng.id) (wineboot takes ~90 s the first time)…")
+ let bottle = try await BottleStore().create(name: name, engine: eng, renderer: renderer)
+ print("created \(bottle.url.path)")
+ if let recipe {
+ var r = RecipeRunner(engine: eng, bottle: bottle)
+ let notes = try await r.apply(try loadRecipe(recipe)) { print($0) }
+ for n in notes { print("note: \(n)") }
+ }
+ }
+ }
+
+ struct Delete: AsyncParsableCommand {
+ @Argument var name: String
+ func run() async throws { try BottleStore().delete(name); print("deleted \(name)") }
+ }
+
+ struct Set: AsyncParsableCommand {
+ static let configuration = CommandConfiguration(abstract: "Change a bottle setting: renderer, winver, sync, hud, avx, env KEY=VALUE")
+ @Argument var name: String
+ @Argument var setting: String
+ @Argument var value: String
+
+ func run() async throws {
+ let bs = BottleStore()
+ var b = try bs.get(name)
+ switch setting {
+ case "renderer": guard let r = HighballKit.Renderer(rawValue: value) else { fail("bad renderer") }; b.settings.renderer = r
+ case "winver":
+ guard let v = WindowsVersion(rawValue: value) else { fail("bad winver") }
+ b.settings.windowsVersion = v
+ let eng = try EngineStore().engine(b.settings.engineID)
+ try await WineRunner(engine: eng, bottle: b).setWindowsVersion(v)
+ case "sync": guard let s = SyncMode(rawValue: value) else { fail("bad sync") }; b.settings.sync = s
+ case "hud": b.settings.metalHUD = (value == "1" || value == "true")
+ case "avx": b.settings.advertiseAVX = (value == "1" || value == "true")
+ case "env":
+ let parts = value.split(separator: "=", maxSplits: 1).map(String.init)
+ guard parts.count == 2 else { fail("env expects KEY=VALUE") }
+ b.settings.environment[parts[0]] = parts[1]
+ default: fail("unknown setting \(setting)")
+ }
+ try bs.update(b)
+ print("ok")
+ }
+ }
+
+ struct Kill: AsyncParsableCommand {
+ @Argument var name: String
+ func run() async throws {
+ let b = try BottleStore().get(name)
+ let eng = try EngineStore().engine(b.settings.engineID)
+ try WineRunner(engine: eng, bottle: b).kill()
+ print("wineserver -k sent")
+ }
+ }
+}
+
+// MARK: - gin run
+
+struct Run: AsyncParsableCommand {
+ static let configuration = CommandConfiguration(abstract: "Run a program in a bottle: a pin name, a Windows path, or a Unix path.")
+ @Argument var bottle: String
+ @Argument var program: String
+ @Argument(parsing: .remaining, help: "Arguments for the program; put them after `--`.") var arguments: [String] = []
+ @Option var renderer: HighballKit.Renderer?
+ @Flag(help: "Print wine output to the terminal as well as the log.") var verbose = false
+
+ func run() async throws {
+ let b = try BottleStore().get(bottle)
+ let eng = try EngineStore().engine(b.settings.engineID)
+ let runner = WineRunner(engine: eng, bottle: b)
+ let echo: @Sendable (String) -> Void = { print($0) }
+ let out: (@Sendable (String) -> Void)? = verbose ? echo : nil
+ let result: LaunchResult
+ if let pin = b.settings.pins.first(where: { $0.name.lowercased() == program.lowercased() }) {
+ var p = pin
+ if let renderer { p.renderer = renderer }
+ p.arguments += arguments
+ result = try await runner.start(pin: p, onOutput: out)
+ } else {
+ let exe = program.contains(":") || program.contains("\\") ? b.resolve(windowsPath: program) : URL(fileURLWithPath: program)
+ result = try await runner.start(exe, arguments: arguments, renderer: renderer, onOutput: out)
+ }
+ print("exit=\(result.exitStatus) after \(Int(result.duration))s — log: \(result.log.path)")
+ if result.crashedEarly { print("hint: exited within 10 s; try another renderer (--renderer dxmt|d3dmetal|dxvk|wined3d)") }
+ }
+}
+
+// MARK: - gin recipe
+
+struct Recipe: AsyncParsableCommand {
+ static let configuration = CommandConfiguration(abstract: "Apply a recipe to a bottle.", subcommands: [Apply.self, Show.self])
+
+ struct Apply: AsyncParsableCommand {
+ @Argument var bottle: String
+ @Argument(help: "Recipe id (looked up in ./recipes/**) or path to a JSON file.") var recipe: String
+ func run() async throws {
+ let b = try BottleStore().get(bottle)
+ let eng = try EngineStore().engine(b.settings.engineID)
+ var r = RecipeRunner(engine: eng, bottle: b)
+ let notes = try await r.apply(try loadRecipe(recipe)) { print($0) }
+ for n in notes { print("note: \(n)") }
+ }
+ }
+
+ struct Show: AsyncParsableCommand {
+ @Argument var recipe: String
+ func run() async throws {
+ let r = try loadRecipe(recipe)
+ print("\(r.id) (\(r.kind.rawValue)) — \(r.title)")
+ for (i, s) in r.steps.enumerated() { print(" \(i + 1). \(s)") }
+ if let v = r.lastVerified { print(" verified \(v.date) on \(v.engine) / macOS \(v.macos) / \(v.chip): \(v.result)") }
+ }
+ }
+}
+
+// MARK: - gin env
+
+struct Env: AsyncParsableCommand {
+ static let configuration = CommandConfiguration(abstract: "Print the environment Gin would use for a bottle (for debugging or a terminal session).")
+ @Argument var bottle: String
+ @Option var renderer: HighballKit.Renderer?
+ func run() async throws {
+ let b = try BottleStore().get(bottle)
+ let eng = try EngineStore().engine(b.settings.engineID)
+ let env = try b.environment(engine: eng, renderer: renderer)
+ for (k, v) in env.sorted(by: { $0.key < $1.key }) { print("export \(k)=\"\(v)\"") }
+ print("export PATH=\"\(eng.engineDir.appending(path: "bin").path):$PATH\"")
+ }
+}
+
+// MARK: - highball tricks
+
+struct Tricks: AsyncParsableCommand {
+ static let configuration = CommandConfiguration(abstract: "Run winetricks verbs in a bottle (unattended).")
+ @Argument var bottle: String
+ @Argument(parsing: .remaining) var verbs: [String]
+ func run() async throws {
+ let b = try BottleStore().get(bottle)
+ let eng = try EngineStore().engine(b.settings.engineID)
+ guard let wt = eng.winetricks else { fail("winetricks not installed in engine \(eng.id)") }
+ var env = try b.environment(engine: eng, renderer: .wined3d)
+ env["WINE"] = eng.wineBinary.path
+ env["WINESERVER"] = eng.wineserverBinary.path
+ env["PATH"] = "\(eng.engineDir.appending(path: "bin").path):/usr/bin:/bin:/usr/sbin:/sbin"
+ let out = try Shell.capture("/bin/sh", [wt.path, "--unattended"] + verbs, env: env)
+ print(out.split(separator: "\n").suffix(12).joined(separator: "\n"))
+ }
+}
+
+// MARK: - highball report
+
+struct Report: AsyncParsableCommand {
+ static let configuration = CommandConfiguration(abstract: "Generate a compatibility report and open a pre-filled GitHub issue.")
+ @Argument var bottle: String
+ @Argument(help: "What you ran (game or launcher name).") var title: String
+ @Option(help: "Rating 1-5.") var rating: Int = 3
+ @Option(help: "Free-text notes.") var notes: String = ""
+ @Flag(help: "Print the issue URL instead of opening the browser.") var printOnly = false
+
+ func run() async throws {
+ let b = try BottleStore().get(bottle)
+ let hw = (try? Shell.capture("/usr/sbin/sysctl", ["-n", "machdep.cpu.brand_string"]).trimmingCharacters(in: .whitespacesAndNewlines)) ?? "unknown"
+ let os = (try? Shell.capture("/usr/bin/sw_vers", ["-productVersion"]).trimmingCharacters(in: .whitespacesAndNewlines)) ?? "unknown"
+ let body = """
+ ### Compatibility report
+ | field | value |
+ |---|---|
+ | title | \(title) |
+ | rating | \(rating)/5 |
+ | chip | \(hw) |
+ | macOS | \(os) |
+ | engine | \(b.settings.engineID) |
+ | renderer | \(b.settings.renderer.rawValue) |
+ | sync | \(b.settings.sync.rawValue) |
+
+ \(notes)
+ """
+ var comps = URLComponents(string: "https://github.com/\(HighballKit.reportRepo)/issues/new")!
+ comps.queryItems = [
+ .init(name: "labels", value: "report"),
+ .init(name: "title", value: "[report] \(title) — \(rating)/5"),
+ .init(name: "body", value: body),
+ ]
+ let url = comps.url!
+ if printOnly { print(url.absoluteString) } else {
+ try Shell.run("/usr/bin/open", [url.absoluteString])
+ print("opened issue form in browser")
+ }
+ }
+}
+
+// MARK: - helpers
+
+func loadRecipe(_ idOrPath: String) throws -> HighballKit.Recipe {
+ if idOrPath.hasSuffix(".json") { return try HighballKit.Recipe.load(from: URL(fileURLWithPath: idOrPath)) }
+ // Recipes live in the highball-db repo; search a sibling checkout and the legacy in-repo path.
+ let roots = ["../highball-db/recipes", "recipes"]
+ let candidates = roots.flatMap { root in
+ ["launchers", "games", "tweaks"].map { URL(fileURLWithPath: "\(root)/\($0)/\(idOrPath).json") }
+ }
+ for c in candidates where FileManager.default.fileExists(atPath: c.path) { return try HighballKit.Recipe.load(from: c) }
+ throw HighballError.missing("recipe \(idOrPath)")
+}
+
+extension HighballKit.Renderer: ExpressibleByArgument {}
diff --git a/Tests/GinKitTests/BottleTests.swift b/Tests/GinKitTests/BottleTests.swift
new file mode 100644
index 0000000..d41e30c
--- /dev/null
+++ b/Tests/GinKitTests/BottleTests.swift
@@ -0,0 +1,42 @@
+import XCTest
+@testable import HighballKit
+
+final class BottleTests: XCTestCase {
+ func testWindowsPathResolution() {
+ let b = Bottle(url: URL(fileURLWithPath: "/tmp/b"), settings: BottleSettings(name: "b", engineID: "e"))
+ XCTAssertEqual(b.resolve(windowsPath: "C:\\Program Files (x86)\\Steam\\steam.exe").path, "/tmp/b/drive_c/Program Files (x86)/Steam/steam.exe")
+ XCTAssertEqual(b.resolve(windowsPath: "windows\\system32\\notepad.exe").path, "/tmp/b/drive_c/windows/system32/notepad.exe")
+ }
+
+ func testSettingsRoundTrip() throws {
+ var s = BottleSettings(name: "play", engineID: "x64-test")
+ s.pins = [Pin(name: "Steam", path: "Program Files (x86)/Steam/steam.exe", renderer: .dxmt)]
+ s.environment["FOO"] = "bar"
+ let data = try JSONEncoder.gin.encode(s)
+ let back = try JSONDecoder.gin.decode(BottleSettings.self, from: data)
+ XCTAssertEqual(back.pins.first?.name, "Steam")
+ XCTAssertEqual(back.environment["FOO"], "bar")
+ XCTAssertEqual(back.renderer, .dxmt)
+ }
+
+ func testRecipeDecodes() throws {
+ let json = """
+ {"id":"t","kind":"launcher","title":"T","steps":[
+ {"type":"registry","key":"HKCU\\\\Software\\\\X","name":"Y","valueType":"REG_DWORD","data":"0"},
+ {"type":"note","text":"hello"},
+ {"type":"renderer","renderer":"d3dmetal"}]}
+ """
+ let r = try JSONDecoder.gin.decode(Recipe.self, from: Data(json.utf8))
+ XCTAssertEqual(r.steps.count, 3)
+ if case let .registry(key, _, _, _) = r.steps[0] { XCTAssertEqual(key, "HKCU\\Software\\X") } else { XCTFail() }
+ }
+
+ func testManifestDecodes() throws {
+ let url = URL(fileURLWithPath: #filePath).deletingLastPathComponent().deletingLastPathComponent().deletingLastPathComponent().appending(path: "spike/engine-manifest.json")
+ let m = try EngineManifest.load(from: url)
+ XCTAssertEqual(m.arch, "x86_64")
+ XCTAssertNotNil(m.licenses?["apple-gptk-license-2023-08-17"])
+ XCTAssertEqual(EngineManifest.gatedRenderers["d3dmetal"], "apple-gptk-license-2023-08-17")
+ XCTAssertEqual(m.orderedComponents.first?.name, "dxmt")
+ }
+}
diff --git a/spike/d3dmetal-license.txt b/spike/d3dmetal-license.txt
new file mode 100644
index 0000000..41d261c
--- /dev/null
+++ b/spike/d3dmetal-license.txt
@@ -0,0 +1,49 @@
+ ENGLISH
+APPLE INC.
+SOFTWARE LICENSE AGREEMENT FOR GAME PORTING TOOLKIT For use on Apple-branded Systems
+PLEASE READ THIS SOFTWARE LICENSE AGREEMENT (“AGREEMENT”) CAREFULLY BEFORE USING THIS APPLE SOFTWARE (DEFINED BELOW). BY USING THE APPLE SOFTWARE, YOU ARE AGREEING TO BE BOUND BY THE TERMS OF THIS AGREEMENT. IF YOU DO NOT AGREE TO THE TERMS OF THIS AGREEMENT, DO NOT INSTALL AND/OR USE THE APPLE SOFTWARE.
+IMPORTANT NOTE: You may only use this Apple Software in connection with non-copyrighted materials, materials in which you own the copyright, or materials you are authorized or legally permitted to use. If you are uncertain about your rights to any copyrighted material, you should contact your legal advisor.
+1. Definitions.
+Whenever capitalized in this Agreement:
+“Apple” means Apple Inc., a California corporation with its principal place of business at One Apple Park Way, Cupertino, California 95014, U.S.A.
+“Apple Software” means the Apple Game Porting Toolkit software, including the Redistributables and Framework, and documentation, updates, interfaces, content, fonts, and any data or other materials.
+“Framework” means the “D3DMetal.framework” within the Apple Game Porting Toolkit. “Redistributables” means components within the “/redist” directory of the Apple Game
+Porting Toolkit.
+1. General.
+A. The Apple Software is licensed, not sold, to you by Apple for use only under the terms of this Agreement, and you may only use the Apple Software for the purposes expressly set forth herein. Apple and/or Apple’s licensors retain ownership of the Apple Software itself and reserve all rights not expressly granted to you
+B. Apple, at its discretion, may make available future updates to the Apple Software. The Apple Software updates, if any, may not necessarily include all existing software features or may include new features. The terms of this Agreement will govern any software updates provided by Apple that replace and/or supplement the original Apple Software product, unless such update is accompanied by a separate license in which case the terms of that license will govern such update.
+
+ C. Title and intellectual property rights in and to any content displayed by or accessed through the Apple Software belongs to the respective content owner. Such content may be protected by copyright or other intellectual property laws and treaties, and may be subject to terms of use of the third party providing such content. This Agreement does not grant you any rights to use such content nor does it guarantee that such content will continue to be available to you.
+2. Permitted Agreement Uses and Restrictions.
+A. License. Subject to the terms and conditions of this License, you are granted a limited, non-exclusive, non-transferable, personal copyright license to (i) install, internally use, and test the Apple Software for the sole purpose of developing, testing, or evaluating video games for use on Apple-branded products; (ii) sublicense the Apple Software to your third-party service providers (“Third-Party Service Providers”) solely for the purpose of exercising the foregoing Section 2A(i) rights on your behalf; and (iii) distribute the Apple Software solely for non-commercial purposes and in accordance with this Agreement, including Section 2C. You may make only as many internal use copies of the Apple Software as reasonably necessary to use the Apple Software as permitted under this License; provided that you reproduce on each copy of the Apple Software or portion thereof, all copyright or other proprietary notices contained on the original. You will be responsible for Third Party Service Provider’s compliance with the terms and conditions of this Agreement.
+B. System Requirements. Please note that the Apple Software is supported only on Apple-branded hardware and software that meets specified system requirements as indicated by Apple.
+C. Other Use Restrictions; Backup Copy. The grants set forth in this Agreement do not permit you to, and you agree not to, install, use or run the Apple Software on any non- Apple-branded devices, or to enable others to do so. You may not rent, lease, lend, host, sell, or sublicense (except as expressly set forth in Section 2A) the Apple Software or any services, in whole or in part. The Apple Software is provided as part of a bundle and its components may not be separated from the Apple Software for distribution. Notwithstanding the foregoing, the Framework in its entirety or any part of the Redistributables may be distributed separately from the Apple Software. For clarity, all distribution of the Apple Software, including the Framework in its entirety and any individual Redistributables, are subject to the non-commercial restriction in Section 2(A) (iii). You may make one copy of the Apple Software in machine-readable form for backup purposes only; provided that the backup copy must include all copyright or other proprietary notices contained on the original. You agree not to use the Apple Software in connection with service bureau, time-sharing, terminal sharing or other similar types of services. You also agree not to use or offer the Apple Software, or any of its functionality, to provide service bureau, time-sharing, terminal sharing or other similar types of services to third parties.
+D. No Reverse Engineering. You may not, and you agree not to or to enable others to,
+
+ copy (except to the extent expressly permitted by this Agreement), decompile, reverse engineer, disassemble, attempt to derive the source code of, decrypt, modify, or create derivative works of the Apple Software or any services provided by the Apple Software or any part thereof (except as and only to the extent any foregoing restriction is prohibited by applicable law or to the extent as may be permitted by licensing terms governing use of open source components).
+3. Transfer. Any copy of the Apple Software that may be provided by Apple for promotional, evaluation, diagnostic or restorative purposes may only be used for such purposes and may not be resold or transferred.
+4. Consent to Use of Data.
+A. Analytics & Improvements. If you choose to share analytics with Apple, you agree that Apple and its subsidiaries and agents may collect, maintain, process and use diagnostic, technical, usage and related information, including but not limited to unique system or hardware identifiers, information about your computer, system and application software, and peripherals, that is gathered periodically to provide and improve Apple’s products and services, facilitate the provision of software updates, product support and other services to you (if any) related to the Apple Software, and to verify compliance with the terms of this Agreement.
+B. Privacy Policy. At all times your information will be treated in accordance with Apple’s Privacy Policy, which can be viewed at: www.apple.com/legal/privacy/.
+5. Termination. This Agreement is effective until terminated. Your rights under this Agreement will terminate automatically or otherwise cease to be effective (i) with notice from Apple, or (ii) without notice from Apple if you fail to comply with any term(s) of this Agreement. Upon the termination of this Agreement, you shall cease all use of the Apple Software and destroy all copies, full or partial, of the Apple Software. Sections 3, 5, 6, 7, 8, 9, 10, 11, 12, and 13 of this Agreement shall survive any such termination.
+6. Indemnification
+To the extent permitted by applicable law, you agree to indemnify, defend and hold harmless Apple, its directors, officers, employees, independent contractors and agents (each an “Apple Indemnified Party”) from any and all claims, losses, liabilities, damages, expenses and costs (including without limitation attorneys' fees and court costs) (collectively “Losses”) incurred by an Apple Indemnified Party as a result of your breach of this Agreement, a breach of any certification, covenant, representation or warranty made by you in this Agreement, any claims that you violate or infringe any third party intellectual property or proprietary rights, or otherwise related to or arising from your use of the Apple Software, your applications, your development of applications, or your loading of applications and limited distribution as permitted hereunder. In no event may You enter into any settlement or like agreement with a third party that affects Apple's rights or binds Apple in any way, without the prior written consent of Apple.
+
+ 7. Representations and Warranties.
+A. YOU EXPRESSLY ACKNOWLEDGE AND AGREE THAT, TO THE EXTENT PERMITTED BY APPLICABLE LAW, USE OF THE APPLE SOFTWARE AND ANY SERVICES PERFORMED BY OR ACCESSED THROUGH THE APPLE SOFTWARE IS AT YOUR SOLE RISK AND THAT THE ENTIRE RISK AS TO SATISFACTORY QUALITY, PERFORMANCE, ACCURACY AND EFFORT IS WITH YOU.
+B. YOU AGREE THAT TO THE EXTENT YOU USE THE APPLE SOFTWARE WITH MATERIALS NOT PROVIDED BY APPLE, IT WILL ONLY BE USED WITH NON- COPYRIGHTED MATERIALS, MATERIALS IN WHICH YOU OWN THE COPYRIGHT, OR MATERIALS YOU ARE AUTHORIZED OR LEGALLY PERMITTED TO USE.
+C. TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, THE APPLE SOFTWARE AND SERVICES ARE PROVIDED “AS IS” AND “AS AVAILABLE”, WITH ALL FAULTS AND WITHOUT WARRANTY OF ANY KIND, AND APPLE AND APPLE’S LICENSORS (COLLECTIVELY REFERRED TO AS “APPLE” FOR THE PURPOSES OF SECTIONS 7 AND 8) HEREBY DISCLAIM ALL WARRANTIES AND CONDITIONS WITH RESPECT TO THE APPLE SOFTWARE AND SERVICES, EITHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES AND/OR CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A PARTICULAR PURPOSE, ACCURACY, QUIET ENJOYMENT, AND NON-INFRINGEMENT OF THIRD PARTY RIGHTS.
+D. APPLE DOES NOT WARRANT AGAINST INTERFERENCE WITH YOUR ENJOYMENT OF THE APPLE SOFTWARE AND SERVICES, THAT THE FUNCTIONS CONTAINED IN, OR SERVICES PERFORMED OR PROVIDED BY, THE APPLE SOFTWARE WILL MEET YOUR REQUIREMENTS, THAT THE OPERATION OF THE APPLE SOFTWARE OR SERVICES WILL BE UNINTERRUPTED OR ERROR-FREE, THAT ANY SERVICES WILL CONTINUE TO BE MADE AVAILABLE, THAT THE APPLE SOFTWARE OR SERVICES WILL BE COMPATIBLE OR WORK WITH YOUR OR ANY THIRD PARTY SOFTWARE, APPLICATIONS OR SERVICES OR ANY OTHER APPLE PRODUCTS OR SERVICES, OR THAT DEFECTS IN THE APPLE SOFTWARE OR SERVICES WILL BE CORRECTED. INSTALLATION OF THIS APPLE SOFTWARE AND USE OF THE SERVICES MAY AFFECT THE USABILITY OF YOUR OR THIRD PARTY SOFTWARE, APPLICATIONS OR SERVICES AS WELL AS OTHER APPLE PRODUCTS OR SERVICES.
+E. YOU FURTHER ACKNOWLEDGE THAT THE APPLE SOFTWARE AND SERVICES ARE NOT INTENDED OR SUITABLE FOR USE IN SITUATIONS OR ENVIRONMENTS WHERE THE FAILURE OR TIME DELAYS OF, OR ERRORS OR INACCURACIES IN THE CONTENT, DATA OR INFORMATION PROVIDED BY, THE APPLE SOFTWARE OR SERVICES COULD LEAD TO DEATH, PERSONAL INJURY, OR SEVERE PHYSICAL OR ENVIRONMENTAL DAMAGE, INCLUDING WITHOUT LIMITATION THE OPERATION OF NUCLEAR FACILITIES, AIRCRAFT NAVIGATION OR COMMUNICATION SYSTEMS, AIR TRAFFIC CONTROL, LIFE SUPPORT OR WEAPONS SYSTEMS.
+
+ F. NO ORAL OR WRITTEN INFORMATION OR ADVICE GIVEN BY APPLE OR AN APPLE AUTHORIZED REPRESENTATIVE SHALL CREATE A WARRANTY. SHOULD THE APPLE SOFTWARE OR SERVICES PROVE DEFECTIVE, YOU ASSUME THE ENTIRE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. SOME JURISDICTIONS DO NOT ALLOW THE EXCLUSION OF IMPLIED WARRANTIES OR LIMITATIONS ON APPLICABLE STATUTORY RIGHTS OF A CONSUMER, SO THE ABOVE EXCLUSION AND LIMITATIONS MAY NOT APPLY TO YOU.
+8. Limitation of Liability. TO THE EXTENT NOT PROHIBITED BY APPLICABLE LAW, IN NO EVENT SHALL APPLE BE LIABLE FOR PERSONAL INJURY, OR ANY INCIDENTAL, SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES WHATSOEVER, INCLUDING, WITHOUT LIMITATION, DAMAGES FOR LOSS OF PROFITS, CORRUPTION OR LOSS OF DATA, BUSINESS INTERRUPTION OR ANY OTHER COMMERCIAL DAMAGES OR LOSSES, ARISING OUT OF OR RELATED TO YOUR USE OR INABILITY TO USE THE APPLE SOFTWARE OR SERVICES OR ANY SOFTWARE OR APPLICATIONS IN CONJUNCTION WITH THE APPLE SOFTWARE OR SERVICES, HOWEVER CAUSED, REGARDLESS OF THE THEORY OF LIABILITY (CONTRACT, TORT OR OTHERWISE) AND EVEN IF APPLE HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME JURISDICTIONS DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR PERSONAL INJURY, OR OF INCIDENTAL OR CONSEQUENTIAL DAMAGES, SO THIS LIMITATION MAY NOT APPLY TO YOU. In no event shall Apple’s total liability to you for all damages (other than as may be required by applicable law in cases involving personal injury) exceed the amount of fifty dollars ($50.00). The foregoing limitations will apply even if the above stated remedy fails of its essential purpose.
+9. Export Control. You may not use or otherwise export or re-export the Apple Software except as authorized by United States law and the laws of the jurisdiction in which the Apple Software was obtained. In particular, but without limitation, the Apple Software may not be exported or re-exported (a) into any U.S. embargoed countries or (b) to anyone on the U.S. Treasury Department’s list of Specially Designated Nationals or the U.S. Department of Commerce Denied Person’s List or Entity List or any other restricted party lists. By using the Apple Software, you represent and warrant that you are not located in any such country or on any such list. You also agree that you will not use the Apple Software for any purposes prohibited by United States law, including, without limitation, the development, design, manufacture or production of missiles, nuclear, chemical or biological weapons.
+10. Government End Users. The Apple Software and related documentation are “Commercial Items”, as that term is defined at 48 C.F.R. §2.101, consisting of “Commercial Computer Software” and “Commercial Computer Software Documentation”, as such terms are used in 48 C.F.R. §12.212 or 48 C.F.R. §227.7202, as applicable. Consistent with 48 C.F.R. §12.212 or 48 C.F.R. §227.7202-1 through 227.7202-4, as applicable, the Commercial Computer Software and Commercial
+
+ Computer Software Documentation are being licensed to U.S. Government end users (a) only as Commercial Items and (b) with only those rights as are granted to all other end users pursuant to the terms and conditions herein. Unpublished-rights reserved under the copyright laws of the United States.
+11. Controlling Law and Severability. This Agreement will be governed by and construed in accordance with the laws of the State of Delaware, excluding its conflict of law principles. This Agreement shall not be governed by the United Nations Convention on Contracts for the International Sale of Goods, the application of which is expressly excluded. If for any reason a court of competent jurisdiction finds any provision, or portion thereof, to be unenforceable, the remainder of this Agreement shall continue in full force and effect.
+12. Complete Agreement; Governing Language. This Agreement constitutes the entire agreement between you and Apple relating to the use of the Apple Software and supersedes all prior or contemporaneous understandings regarding such subject matter. No amendment to or modification of this Agreement will be binding unless in writing and signed by Apple. Any translation of this Agreement is done for local requirements and in the event of a dispute between the English and any non-English versions, the English version of this Agreement shall govern, to the extent not prohibited by local law in your jurisdiction.
+13. Open Source; Third Party Acknowledgements. Certain components of the Apple Software, and third party open source programs included with the Apple Software, may be made available by Apple on its open source website (opensource.apple.com). Acknowledgements, open source licensing terms and disclaimers for third party components of the Apple Software are also contained in the Acknowledgements file for the Apple Software. Please refer to the Acknowledgements file for such information since you may have additional rights in such open source components of the Apple Software. You expressly acknowledge that if failure or damage to Apple hardware results from modification of the open source components of the Apple Software, such failure or damage is excluded from the terms of the Apple hardware warranty.
+EA18380 8/17/2023
+
diff --git a/spike/engine-manifest.json b/spike/engine-manifest.json
new file mode 100644
index 0000000..72f8ac0
--- /dev/null
+++ b/spike/engine-manifest.json
@@ -0,0 +1,113 @@
+{
+ "$schema": "https://gin.app/schemas/engine-manifest/v0",
+ "id": "x64-sikarugir10.0_6-r0",
+ "displayName": "Wine 10.0 (Sikarugir) + DXMT 0.80 + D3DMetal 3.0",
+ "arch": "x86_64",
+ "minMacOS": "14.0",
+ "requires": [
+ "rosetta2"
+ ],
+ "notes": [
+ "Engine is Gcenx's Sikarugir build of upstream Wine 10.0: exports macdrv_functions from winemac.so (required by both DXMT and D3DMetal bridges) and supports WINEDLLPATH_PREPEND for per-bottle renderer overlays.",
+ "Vanilla Gcenx wine-devel 11.15 lacks the macdrv_functions export -> DXMT and D3DMetal do NOT work on it. Verified 2026-08-23 with nm.",
+ "Runtime dylibs (GStreamer, MoltenVK, gnutls, freetype, SDL2, icu...) are NOT inside the engine; they come from the Sikarugir Wrapper Template's Frameworks/ and are found via DYLD_FALLBACK_LIBRARY_PATH.",
+ "Wine 10 still ships a wine64 binary but the loader is `wine`; use `wine` so Wine 11 engines work unchanged.",
+ "D3DMetal is NOT downloaded separately: the Template's frameworks/renderer/d3dmetal overlay is used, but only exposed once the user has accepted the Apple GPTK license (recorded in manifest.json as acceptedLicenses)."
+ ],
+ "components": {
+ "wine": {
+ "kind": "engine",
+ "url": "https://github.com/Sikarugir-App/Engines/releases/download/v1.0/WS12WineSikarugir10.0_6.tar.xz",
+ "sha256": "9da7ee0cbf386522f3a9906943726d9c3c125dbbd9ab120e3cde80e88d6091b2",
+ "size": 166304096,
+ "license": "LGPL-2.1+",
+ "extract": {
+ "strip": "wswine.bundle",
+ "into": "engine"
+ },
+ "version": "wine-10.0 (Sikarugir) revision 6"
+ },
+ "runtime": {
+ "kind": "frameworks",
+ "url": "https://github.com/Sikarugir-App/Wrapper/releases/download/v1.0/Template-1.0.11.tar.xz",
+ "sha256": "9fa15479e7ff6abd99c1d07be285fb95f41fc6991586502427152b1f7d6ccb8a",
+ "size": 84533420,
+ "license": "mixed (LGPL-2.1 GStreamer, Apache-2.0 MoltenVK, LGPL gnutls, ...)",
+ "extract": {
+ "subpath": "Template-1.0.11.app/Contents/Frameworks",
+ "into": "frameworks"
+ },
+ "provides": [
+ "GStreamer.framework 1.0",
+ "libMoltenVK.dylib",
+ "renderer/dxmt v0.74",
+ "renderer/d3dmetal 3.0",
+ "renderer/dxvk 1.10.3-async",
+ "renderer/d9vk 1.10.4-async",
+ "renderer/cnc-ddraw 7.1.0.0"
+ ]
+ },
+ "dxmt": {
+ "kind": "renderer",
+ "url": "https://github.com/3Shain/dxmt/releases/download/v0.80/dxmt-v0.80-builtin.tar.gz",
+ "sha256": "8f260e36b5739e68f3bad613381441385c4dc7b85b78ba8de653d5a6a264529d",
+ "size": 18681669,
+ "license": "MIT",
+ "extract": {
+ "subpath": "v0.80",
+ "into": "renderers/dxmt/wine"
+ },
+ "layout": [
+ "x86_64-unix/winemetal.so",
+ "x86_64-windows/{d3d11,dxgi,d3d10core,winemetal,nvapi64,nvngx}.dll",
+ "i386-windows/{d3d11,dxgi,d3d10core,winemetal}.dll"
+ ],
+ "env": {
+ "WINEDLLPATH_PREPEND": "${renderers}/dxmt/wine"
+ },
+ "replacesTemplateRenderer": "dxmt v0.74"
+ },
+ "winetricks": {
+ "kind": "tool",
+ "url": "https://raw.githubusercontent.com/Winetricks/winetricks/master/src/winetricks",
+ "sha256": "f35c29737ca08a583569e6a3752d52fbe23333c5acfad5f16c4177d25eaf3f4b",
+ "license": "LGPL-2.1",
+ "note": "Unpinned upstream master at fetch time; Gin should pin a tagged release."
+ }
+ },
+ "alternatives": {
+ "wine-devel-11.15": {
+ "url": "https://github.com/Gcenx/macOS_Wine_builds/releases/download/11.15/wine-devel-11.15-osx64.tar.xz",
+ "sha256": "3f8e89a4874953a69e7be3dcdcc262d0346e462a9374bd116770fffb9e2a99d2",
+ "status": "usable for WineD3D/DXVK only; no macdrv_functions export; needs external GStreamer.framework (pkg install, sudo)"
+ },
+ "gptk-3.0-3": {
+ "url": "https://github.com/Gcenx/game-porting-toolkit/releases/download/Game-Porting-Toolkit-3.0-3/game-porting-toolkit-3.0-3.tar.xz",
+ "sha256": "d377683937340f914823dbb2e1252b329cbf834ff58907d0293db8cebf0e392e",
+ "size": 239200808,
+ "status": "canonical source of D3DMetal 3.0; not needed because the Template's renderer/d3dmetal carries the same framework with bridges built for this engine"
+ }
+ },
+ "baseEnv": {
+ "WINEDEBUG": "fixme-all",
+ "DYLD_FALLBACK_LIBRARY_PATH": "${frameworks}:${frameworks}/GStreamer.framework/Versions/1.0/lib",
+ "DYLD_FALLBACK_FRAMEWORK_PATH": "${frameworks}",
+ "GST_PLUGIN_PATH": "${frameworks}/GStreamer.framework/Versions/1.0/lib/gstreamer-1.0"
+ },
+ "verified": {
+ "date": "2026-08-23",
+ "macos": "14.6",
+ "chip": "Apple M1 Pro",
+ "wineboot": "ok (88s)",
+ "steam-install": "ok (13s)"
+ },
+ "licenses": {
+ "apple-gptk-license-2023-08-17": {
+ "applies": [
+ "renderers/d3dmetal (bundled in the Sikarugir Template: D3DMetal.framework sha1 1405e5c6… identical to GPTK 3.0-3)"
+ ],
+ "text": "spike/d3dmetal-license.txt",
+ "summary": "Apple Game Porting Toolkit license: non-commercial use/distribution only; no modification; use scoped to developing, testing or evaluating games on Apple hardware."
+ }
+ }
+}
\ No newline at end of file