diff --git a/build.xml b/build.xml
new file mode 100644
index 0000000..3d2cfc8
--- /dev/null
+++ b/build.xml
@@ -0,0 +1,73 @@
+
+
+
+
+
+
+
+
+
+
+ Builds, tests, and runs the project halfnes.
+
+
+
diff --git a/lib/OpenAL32.dll b/lib/OpenAL32.dll
new file mode 100644
index 0000000..b6f6f65
Binary files /dev/null and b/lib/OpenAL32.dll differ
diff --git a/lib/OpenAL64.dll b/lib/OpenAL64.dll
new file mode 100644
index 0000000..d835da5
Binary files /dev/null and b/lib/OpenAL64.dll differ
diff --git a/lib/jinput-dx8.dll b/lib/jinput-dx8.dll
new file mode 100644
index 0000000..e930dcb
Binary files /dev/null and b/lib/jinput-dx8.dll differ
diff --git a/lib/jinput-dx8_64.dll b/lib/jinput-dx8_64.dll
new file mode 100644
index 0000000..86413ed
Binary files /dev/null and b/lib/jinput-dx8_64.dll differ
diff --git a/lib/jinput-raw.dll b/lib/jinput-raw.dll
new file mode 100644
index 0000000..b312e96
Binary files /dev/null and b/lib/jinput-raw.dll differ
diff --git a/lib/jinput-raw_64.dll b/lib/jinput-raw_64.dll
new file mode 100644
index 0000000..ef512e6
Binary files /dev/null and b/lib/jinput-raw_64.dll differ
diff --git a/lib/jinput-wintab.dll b/lib/jinput-wintab.dll
new file mode 100644
index 0000000..0a6b8bb
Binary files /dev/null and b/lib/jinput-wintab.dll differ
diff --git a/lib/libjinput-linux.so b/lib/libjinput-linux.so
new file mode 100644
index 0000000..dba9e59
Binary files /dev/null and b/lib/libjinput-linux.so differ
diff --git a/lib/libjinput-linux64.so b/lib/libjinput-linux64.so
new file mode 100644
index 0000000..04840b6
Binary files /dev/null and b/lib/libjinput-linux64.so differ
diff --git a/lib/libjinput-osx.jnilib b/lib/libjinput-osx.jnilib
new file mode 100644
index 0000000..1cf6dbb
Binary files /dev/null and b/lib/libjinput-osx.jnilib differ
diff --git a/lib/liblwjgl.jnilib b/lib/liblwjgl.jnilib
new file mode 100644
index 0000000..3cca853
Binary files /dev/null and b/lib/liblwjgl.jnilib differ
diff --git a/lib/liblwjgl.so b/lib/liblwjgl.so
new file mode 100644
index 0000000..9f7a0ed
Binary files /dev/null and b/lib/liblwjgl.so differ
diff --git a/lib/liblwjgl64.so b/lib/liblwjgl64.so
new file mode 100644
index 0000000..97a2e2e
Binary files /dev/null and b/lib/liblwjgl64.so differ
diff --git a/lib/libopenal.so b/lib/libopenal.so
new file mode 100644
index 0000000..f2bf0ac
Binary files /dev/null and b/lib/libopenal.so differ
diff --git a/lib/libopenal64.so b/lib/libopenal64.so
new file mode 100644
index 0000000..361d137
Binary files /dev/null and b/lib/libopenal64.so differ
diff --git a/lib/libs/LICENSES/commons-io-LICENSE.txt b/lib/libs/LICENSES/commons-io-LICENSE.txt
new file mode 100644
index 0000000..6b0b127
--- /dev/null
+++ b/lib/libs/LICENSES/commons-io-LICENSE.txt
@@ -0,0 +1,203 @@
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright [yyyy] [name of copyright owner]
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
diff --git a/lib/libs/LICENSES/concurrent-LICENSE.txt b/lib/libs/LICENSES/concurrent-LICENSE.txt
new file mode 100644
index 0000000..239e5f7
--- /dev/null
+++ b/lib/libs/LICENSES/concurrent-LICENSE.txt
@@ -0,0 +1,11 @@
+The concurrent library is developed by Doug Lea on http://gee.cs.oswego.edu/dl/classes/EDU/oswego/cs/dl/util/concurrent/intro.html
+
+Here are some Release Notes:
+All classes are released to the public domain and may be used for any purpose whatsoever without permission
+or acknowledgment. Portions of the CopyOnWriteArrayList and ConcurrentReaderHashMap classes are adapted from
+Sun JDK source code. These are copyright of Sun Microsystems, Inc, and are used with their kind permission,
+as described in this license.
+
+You don't need a license to use the concurrent library, here is an answer for such question from Doug Lea:
+Do I need a license to use it? Can I get one?
+ No!
\ No newline at end of file
diff --git a/lib/libs/LICENSES/guava-io-LICENSE.txt b/lib/libs/LICENSES/guava-io-LICENSE.txt
new file mode 100644
index 0000000..6b0b127
--- /dev/null
+++ b/lib/libs/LICENSES/guava-io-LICENSE.txt
@@ -0,0 +1,203 @@
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright [yyyy] [name of copyright owner]
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
diff --git a/lib/libs/LICENSES/junit-LICENSE b/lib/libs/LICENSES/junit-LICENSE
new file mode 100644
index 0000000..b0c1af0
--- /dev/null
+++ b/lib/libs/LICENSES/junit-LICENSE
@@ -0,0 +1,215 @@
+Common Public License - v 1.0
+
+THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS COMMON PUBLIC
+LICENSE ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THE PROGRAM
+CONSTITUTES RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT.
+
+1. DEFINITIONS
+
+"Contribution" means:
+
+a) in the case of the initial Contributor, the initial code and
+documentation distributed under this Agreement, and
+b) in the case of each subsequent Contributor:
+
+i) changes to the Program, and
+
+ii) additions to the Program;
+
+where such changes and/or additions to the Program originate from and are
+distributed by that particular Contributor. A Contribution 'originates' from a
+Contributor if it was added to the Program by such Contributor itself or anyone
+acting on such Contributor's behalf. Contributions do not include additions to
+the Program which: (i) are separate modules of software distributed in
+conjunction with the Program under their own license agreement, and (ii) are
+not derivative works of the Program.
+
+"Contributor" means any person or entity that distributes the Program.
+
+"Licensed Patents " mean patent claims licensable by a Contributor which are
+necessarily infringed by the use or sale of its Contribution alone or when
+combined with the Program.
+
+"Program" means the Contributions distributed in accordance with this Agreement.
+
+"Recipient" means anyone who receives the Program under this Agreement,
+including all Contributors.
+
+2. GRANT OF RIGHTS
+
+a) Subject to the terms of this Agreement, each Contributor hereby grants
+Recipient a non-exclusive, worldwide, royalty-free copyright license to
+reproduce, prepare derivative works of, publicly display, publicly perform,
+distribute and sublicense the Contribution of such Contributor, if any, and
+such derivative works, in source code and object code form.
+
+b) Subject to the terms of this Agreement, each Contributor hereby grants
+Recipient a non-exclusive, worldwide, royalty-free patent license under
+Licensed Patents to make, use, sell, offer to sell, import and otherwise
+transfer the Contribution of such Contributor, if any, in source code and
+object code form. This patent license shall apply to the combination of the
+Contribution and the Program if, at the time the Contribution is added by the
+Contributor, such addition of the Contribution causes such combination to be
+covered by the Licensed Patents. The patent license shall not apply to any
+other combinations which include the Contribution. No hardware per se is
+licensed hereunder.
+
+c) Recipient understands that although each Contributor grants the
+licenses to its Contributions set forth herein, no assurances are provided by
+any Contributor that the Program does not infringe the patent or other
+intellectual property rights of any other entity. Each Contributor disclaims
+any liability to Recipient for claims brought by any other entity based on
+infringement of intellectual property rights or otherwise. As a condition to
+exercising the rights and licenses granted hereunder, each Recipient hereby
+assumes sole responsibility to secure any other intellectual property rights
+needed, if any. For example, if a third party patent license is required to
+allow Recipient to distribute the Program, it is Recipient's responsibility to
+acquire that license before distributing the Program.
+
+d) Each Contributor represents that to its knowledge it has sufficient
+copyright rights in its Contribution, if any, to grant the copyright license
+set forth in this Agreement.
+
+3. REQUIREMENTS
+
+A Contributor may choose to distribute the Program in object code form under
+its own license agreement, provided that:
+
+a) it complies with the terms and conditions of this Agreement; and
+
+b) its license agreement:
+
+i) effectively disclaims on behalf of all Contributors all warranties and
+conditions, express and implied, including warranties or conditions of title
+and non-infringement, and implied warranties or conditions of merchantability
+and fitness for a particular purpose;
+
+ii) effectively excludes on behalf of all Contributors all liability for
+damages, including direct, indirect, special, incidental and consequential
+damages, such as lost profits;
+
+iii) states that any provisions which differ from this Agreement are
+offered by that Contributor alone and not by any other party; and
+
+iv) states that source code for the Program is available from such
+Contributor, and informs licensees how to obtain it in a reasonable manner on
+or through a medium customarily used for software exchange.
+
+When the Program is made available in source code form:
+
+a) it must be made available under this Agreement; and
+
+b) a copy of this Agreement must be included with each copy of the
+Program.
+
+Contributors may not remove or alter any copyright notices contained within the
+Program.
+
+Each Contributor must identify itself as the originator of its Contribution, if
+any, in a manner that reasonably allows subsequent Recipients to identify the
+originator of the Contribution.
+
+4. COMMERCIAL DISTRIBUTION
+
+Commercial distributors of software may accept certain responsibilities with
+respect to end users, business partners and the like. While this license is
+intended to facilitate the commercial use of the Program, the Contributor who
+includes the Program in a commercial product offering should do so in a manner
+which does not create potential liability for other Contributors. Therefore, if
+a Contributor includes the Program in a commercial product offering, such
+Contributor ("Commercial Contributor") hereby agrees to defend and indemnify
+every other Contributor ("Indemnified Contributor") against any losses, damages
+and costs (collectively "Losses") arising from claims, lawsuits and other legal
+actions brought by a third party against the Indemnified Contributor to the
+extent caused by the acts or omissions of such Commercial Contributor in
+connection with its distribution of the Program in a commercial product
+offering. The obligations in this section do not apply to any claims or Losses
+relating to any actual or alleged intellectual property infringement. In order
+to qualify, an Indemnified Contributor must: a) promptly notify the Commercial
+Contributor in writing of such claim, and b) allow the Commercial Contributor
+to control, and cooperate with the Commercial Contributor in, the defense and
+any related settlement negotiations. The Indemnified Contributor may
+participate in any such claim at its own expense.
+
+For example, a Contributor might include the Program in a commercial product
+offering, Product X. That Contributor is then a Commercial Contributor. If that
+Commercial Contributor then makes performance claims, or offers warranties
+related to Product X, those performance claims and warranties are such
+Commercial Contributor's responsibility alone. Under this section, the
+Commercial Contributor would have to defend claims against the other
+Contributors related to those performance claims and warranties, and if a court
+requires any other Contributor to pay any damages as a result, the Commercial
+Contributor must pay those damages.
+
+5. NO WARRANTY
+
+EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, THE PROGRAM IS PROVIDED ON AN
+"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR
+IMPLIED INCLUDING, WITHOUT LIMITATION, ANY WARRANTIES OR CONDITIONS OF TITLE,
+NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Each
+Recipient is solely responsible for determining the appropriateness of using
+and distributing the Program and assumes all risks associated with its exercise
+of rights under this Agreement, including but not limited to the risks and
+costs of program errors, compliance with applicable laws, damage to or loss of
+data, programs or equipment, and unavailability or interruption of operations.
+
+6. DISCLAIMER OF LIABILITY
+
+EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, NEITHER RECIPIENT NOR ANY
+CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING WITHOUT LIMITATION LOST
+PROFITS), HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY
+WAY OUT OF THE USE OR DISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY RIGHTS
+GRANTED HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+
+7. GENERAL
+
+If any provision of this Agreement is invalid or unenforceable under applicable
+law, it shall not affect the validity or enforceability of the remainder of the
+terms of this Agreement, and without further action by the parties hereto, such
+provision shall be reformed to the minimum extent necessary to make such
+provision valid and enforceable.
+
+If Recipient institutes patent litigation against a Contributor with respect to
+a patent applicable to software (including a cross-claim or counterclaim in a
+lawsuit), then any patent licenses granted by that Contributor to such
+Recipient under this Agreement shall terminate as of the date such litigation
+is filed. In addition, if Recipient institutes patent litigation against any
+entity (including a cross-claim or counterclaim in a lawsuit) alleging that the
+Program itself (excluding combinations of the Program with other software or
+hardware) infringes such Recipient's patent(s), then such Recipient's rights
+granted under Section 2(b) shall terminate as of the date such litigation is
+filed.
+
+All Recipient's rights under this Agreement shall terminate if it fails to
+comply with any of the material terms or conditions of this Agreement and does
+not cure such failure in a reasonable period of time after becoming aware of
+such noncompliance. If all Recipient's rights under this Agreement terminate,
+Recipient agrees to cease use and distribution of the Program as soon as
+reasonably practicable. However, Recipient's obligations under this Agreement
+and any licenses granted by Recipient relating to the Program shall continue
+and survive.
+
+Everyone is permitted to copy and distribute copies of this Agreement, but in
+order to avoid inconsistency the Agreement is copyrighted and may only be
+modified in the following manner. The Agreement Steward reserves the right to
+publish new versions (including revisions) of this Agreement from time to time.
+No one other than the Agreement Steward has the right to modify this Agreement.
+IBM is the initial Agreement Steward. IBM may assign the responsibility to
+serve as the Agreement Steward to a suitable separate entity. Each new version
+of the Agreement will be given a distinguishing version number. The Program
+(including Contributions) may always be distributed subject to the version of
+the Agreement under which it was received. In addition, after a new version of
+the Agreement is published, Contributor may elect to distribute the Program
+(including its Contributions) under the new version. Except as expressly stated
+in Sections 2(a) and 2(b) above, Recipient receives no rights or licenses to
+the intellectual property of any Contributor under this Agreement, whether
+expressly, by implication, estoppel or otherwise. All rights in the Program not
+expressly granted under this Agreement are reserved.
+
+This Agreement is governed by the laws of the State of New York and the
+intellectual property laws of the United States of America. No party to this
+Agreement will bring a legal action under this Agreement more than one year
+after the cause of action arose. Each party waives its rights to a jury trial
+in any resulting litigation.
diff --git a/lib/libs/LICENSES/poi-LICENSE.txt b/lib/libs/LICENSES/poi-LICENSE.txt
new file mode 100644
index 0000000..6b0b127
--- /dev/null
+++ b/lib/libs/LICENSES/poi-LICENSE.txt
@@ -0,0 +1,203 @@
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright [yyyy] [name of copyright owner]
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
diff --git a/lib/libs/LICENSES/xstream-LICENSE.txt b/lib/libs/LICENSES/xstream-LICENSE.txt
new file mode 100644
index 0000000..b8ef4c6
--- /dev/null
+++ b/lib/libs/LICENSES/xstream-LICENSE.txt
@@ -0,0 +1,26 @@
+Copyright (c) 2003-2006, Joe Walnes
+Copyright (c) 2006-2009, XStream Committers
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+Redistributions of source code must retain the above copyright notice, this list of
+conditions and the following disclaimer. Redistributions in binary form must reproduce
+the above copyright notice, this list of conditions and the following disclaimer in
+the documentation and/or other materials provided with the distribution.
+
+Neither the name of XStream nor the names of its contributors may be used to endorse
+or promote products derived from this software without specific prior written
+permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
+EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
+SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
+TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY
+WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
+DAMAGE.
\ No newline at end of file
diff --git a/lib/lwjgl.dll b/lib/lwjgl.dll
new file mode 100644
index 0000000..ff9a1f8
Binary files /dev/null and b/lib/lwjgl.dll differ
diff --git a/lib/lwjgl64.dll b/lib/lwjgl64.dll
new file mode 100644
index 0000000..776de5c
Binary files /dev/null and b/lib/lwjgl64.dll differ
diff --git a/lib/nblibraries.properties b/lib/nblibraries.properties
new file mode 100644
index 0000000..0e92743
--- /dev/null
+++ b/lib/nblibraries.properties
@@ -0,0 +1,18 @@
+libs.JInput.classpath=\
+ ${base}/jinput.jar
+libs.JInput.displayName=JInput
+libs.LWJGL.classpath=\
+ ${base}/lwjgl.jar
+libs.LWJGL.displayName=LWJGL
+libs.LWJGL.javadoc=\
+ ${base}/javadoc/
+libs.LWJGL.src=\
+ ${base}/src/;\
+ ${base}/src/generated/;\
+ ${base}/src/java/
+libs.The_Happy_Library_test.classpath=\
+ ${base}/org.happy.library-1.3.jar:\
+ ${base}/libs/:\
+ ${base}/org.happy.library-1.3.jar:\
+ ${base}/org.happy.library-1.3.jar
+libs.The_Happy_Library_test.displayName=The Happy Library test
diff --git a/lib/openal.dylib b/lib/openal.dylib
new file mode 100644
index 0000000..cb8e458
Binary files /dev/null and b/lib/openal.dylib differ
diff --git a/manifest.mf b/manifest.mf
new file mode 100644
index 0000000..328e8e5
--- /dev/null
+++ b/manifest.mf
@@ -0,0 +1,3 @@
+Manifest-Version: 1.0
+X-COMMENT: Main-Class will be added automatically by build
+
diff --git a/nbproject/build-impl.xml b/nbproject/build-impl.xml
new file mode 100644
index 0000000..16da5e3
--- /dev/null
+++ b/nbproject/build-impl.xml
@@ -0,0 +1,1397 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Must set src.dir
+ Must set build.dir
+ Must set dist.dir
+ Must set build.classes.dir
+ Must set dist.javadoc.dir
+ Must set build.test.classes.dir
+ Must set build.test.results.dir
+ Must set build.classes.excludes
+ Must set dist.jar
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Must set javac.includes
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ No tests executed.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Must set JVM to use for profiling in profiler.info.jvm
+ Must set profiler agent JVM arguments in profiler.info.jvmargs.agent
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Must select some files in the IDE or set javac.includes
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ To run this application from the command line without Ant, try:
+
+ java -jar "${dist.jar.resolved}"
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Must select one file in the IDE or set run.class
+
+
+
+ Must select one file in the IDE or set run.class
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Must select one file in the IDE or set debug.class
+
+
+
+
+ Must select one file in the IDE or set debug.class
+
+
+
+
+ Must set fix.includes
+
+
+
+
+
+
+
+
+
+ This target only works when run from inside the NetBeans IDE.
+
+
+
+
+
+
+
+
+ Must select one file in the IDE or set profile.class
+ This target only works when run from inside the NetBeans IDE.
+
+
+
+
+
+
+
+
+ This target only works when run from inside the NetBeans IDE.
+
+
+
+
+
+
+
+
+
+
+
+
+ This target only works when run from inside the NetBeans IDE.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Must select one file in the IDE or set run.class
+
+
+
+
+
+ Must select some files in the IDE or set test.includes
+
+
+
+
+ Must select one file in the IDE or set run.class
+
+
+
+
+ Must select one file in the IDE or set applet.url
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Must select some files in the IDE or set javac.includes
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Some tests failed; see details above.
+
+
+
+
+
+
+
+
+ Must select some files in the IDE or set test.includes
+
+
+
+ Some tests failed; see details above.
+
+
+
+ Must select some files in the IDE or set test.class
+ Must select some method in the IDE or set test.method
+
+
+
+ Some tests failed; see details above.
+
+
+
+
+ Must select one file in the IDE or set test.class
+
+
+
+ Must select one file in the IDE or set test.class
+ Must select some method in the IDE or set test.method
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Must select one file in the IDE or set applet.url
+
+
+
+
+
+
+
+
+ Must select one file in the IDE or set applet.url
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/nbproject/configs/Raspberry_Pi.properties b/nbproject/configs/Raspberry_Pi.properties
new file mode 100644
index 0000000..e335255
--- /dev/null
+++ b/nbproject/configs/Raspberry_Pi.properties
@@ -0,0 +1,8 @@
+$label=Raspberry Pi
+$target.debug=debug-remote
+$target.profile=profile-remote
+$target.run=run-remote
+compile.on.save.unsupported.remote.platform=true
+debug-transport=dt_socket
+platform.runtime=Gluon_JavaFX_2
+run.jvmargs=-Djava.library.path=/usr/lib/jni -Xms256m
diff --git a/nbproject/genfiles.properties b/nbproject/genfiles.properties
new file mode 100644
index 0000000..78b675a
--- /dev/null
+++ b/nbproject/genfiles.properties
@@ -0,0 +1,8 @@
+build.xml.data.CRC32=53808b6e
+build.xml.script.CRC32=7256fdc0
+build.xml.stylesheet.CRC32=8064a381@1.75.2.48
+# This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml.
+# Do not edit this file. You may delete it but then the IDE will never regenerate such files for you.
+nbproject/build-impl.xml.data.CRC32=53808b6e
+nbproject/build-impl.xml.script.CRC32=9c512202
+nbproject/build-impl.xml.stylesheet.CRC32=876e7a8f@1.75.2.48
diff --git a/nbproject/project.properties b/nbproject/project.properties
new file mode 100644
index 0000000..467cd2e
--- /dev/null
+++ b/nbproject/project.properties
@@ -0,0 +1,89 @@
+annotation.processing.enabled=true
+annotation.processing.enabled.in.editor=false
+annotation.processing.processors.list=
+annotation.processing.run.all.processors=true
+annotation.processing.source.output=${build.generated.sources.dir}/ap-source-output
+application.title=halfnes
+application.vendor=sjc
+build.classes.dir=${build.dir}/classes
+build.classes.excludes=**/*.java,**/*.form
+# This directory is removed when the project is cleaned:
+build.dir=build
+build.generated.dir=${build.dir}/generated
+build.generated.sources.dir=${build.dir}/generated-sources
+# Only compile against the classpath explicitly listed here:
+build.sysclasspath=ignore
+build.test.classes.dir=${build.dir}/test/classes
+build.test.results.dir=${build.dir}/test/results
+# Uncomment to specify the preferred debugger connection transport:
+#debug.transport=dt_socket
+debug.classpath=\
+ ${run.classpath}
+debug.test.classpath=\
+ ${run.test.classpath}
+# Files in build.classes.dir which should be excluded from distribution jar
+dist.archive.excludes=
+# This directory is removed when the project is cleaned:
+dist.dir=dist
+dist.jar=${dist.dir}/halfnes.jar
+dist.javadoc.dir=${dist.dir}/javadoc
+endorsed.classpath=
+excludes=
+file.reference.halfnes-src=src
+file.reference.jinput-20100502.jar=lib/jinput-20100502.jar
+file.reference.jinput.jar=lib/jinput.jar
+file.reference.jutils-20100502.jar=lib/jutils-20100502.jar
+file.reference.jutils.jar=lib/jutils.jar
+file.reference.org.happy.library-1.3.jar=lib/org.happy.library-1.3.jar
+file.reference.pi4j-core.jar=lib/pi4j-core.jar
+includes=**
+jar.compress=false
+javac.classpath=\
+ ${file.reference.jinput.jar}:\
+ ${file.reference.org.happy.library-1.3.jar}:\
+ ${file.reference.jinput-20100502.jar}:\
+ ${file.reference.jutils-20100502.jar}:\
+ ${file.reference.jutils.jar}:\
+ ${file.reference.pi4j-core.jar}
+# Space-separated list of extra javac options
+javac.compilerargs=
+javac.deprecation=false
+javac.processorpath=\
+ ${javac.classpath}
+javac.source=1.8
+javac.target=1.8
+javac.test.classpath=\
+ ${javac.classpath}:\
+ ${build.classes.dir}
+javac.test.processorpath=\
+ ${javac.test.classpath}
+javadoc.additionalparam=
+javadoc.author=false
+javadoc.encoding=${source.encoding}
+javadoc.noindex=false
+javadoc.nonavbar=false
+javadoc.notree=false
+javadoc.private=false
+javadoc.reference.pi4j-core.jar=lib/pi4j-core-javadoc.jar
+javadoc.splitindex=true
+javadoc.use=true
+javadoc.version=false
+javadoc.windowtitle=
+main.class=com.grapeshot.halfnes.JavaFXNES
+manifest.file=manifest.mf
+meta.inf.dir=${src.dir}/META-INF
+mkdist.disabled=false
+platform.active=default_platform
+run.classpath=\
+ ${javac.classpath}:\
+ ${build.classes.dir}
+# Space-separated list of JVM arguments used when running the project.
+# You may also define separate properties like run-sys-prop.name=value instead of -Dname=value.
+# To set system properties for unit tests define test-sys-prop.name=value:
+run.jvmargs=-Djava.library.path=./lib -XX:UseSSE=3 -Xms256m
+run.test.classpath=\
+ ${javac.test.classpath}:\
+ ${build.test.classes.dir}
+source.encoding=UTF-8
+source.reference.pi4j-core.jar=lib/pi4j-core-sources.jar
+src.dir=${file.reference.halfnes-src}
diff --git a/nbproject/project.xml b/nbproject/project.xml
new file mode 100644
index 0000000..a307441
--- /dev/null
+++ b/nbproject/project.xml
@@ -0,0 +1,16 @@
+
+
+ org.netbeans.modules.java.j2seproject
+
+
+
+
+
+ halfnes
+
+
+
+
+
+
+
diff --git a/nbproject/remote-platform-impl.xml b/nbproject/remote-platform-impl.xml
new file mode 100644
index 0000000..83d1041
--- /dev/null
+++ b/nbproject/remote-platform-impl.xml
@@ -0,0 +1,213 @@
+
+
+
+
+
+
+
+
+
+ Runtime platform (platform.runtime) must be set.
+
+
+
+
+
+
+
+
+ Must set remote.platform.home.dir
+ Must set remote.platform.work.dir
+ Must set remote.platform.host
+ Must set remote.platform.port
+ Must set remote.platform.user
+ Must set remote.platform.auth
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Must set remote.platform.keyfile
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Must set remote.platform.keyfile
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/com/grapeshot/halfnes/APU.java b/src/com/grapeshot/halfnes/APU.java
index cac8679..aebc88c 100644
--- a/src/com/grapeshot/halfnes/APU.java
+++ b/src/com/grapeshot/halfnes/APU.java
@@ -10,7 +10,7 @@ public class APU {
public int samplerate = 1;
private final Timer[] timers = {new SquareTimer(8, 2), new SquareTimer(8, 2),
new TriangleTimer(), new NoiseTimer()};
- private double cyclespersample;
+ private int cyclespersample;
public final NES nes;
CPU cpu;
CPURAM cpuram;
@@ -45,7 +45,7 @@ public APU(final NES nes, final CPU cpu, final CPURAM cpuram) {
public final synchronized void setParameters() {
soundFiltering = PrefsSingleton.get().getBoolean("soundFiltering", true);
samplerate = PrefsSingleton.get().getInt("sampleRate", 44100);
- cyclespersample = 1789773.0 / samplerate;
+ cyclespersample = 1789773 / samplerate;
if (ai != null) {
ai.destroy();
}
@@ -71,12 +71,12 @@ public final int read(final int addr) {
//for future ref: NEED to put those ternary operators in parentheses!
//otherwise order of operations does the wrong thing.
final int returnval = ((lengthctr[0] > 0) ? 1 : 0)
- + ((lengthctr[1] > 0) ? 2 : 0)
- + ((lengthctr[2] > 0) ? 4 : 0)
- + ((lengthctr[3] > 0) ? 8 : 0)
- + ((dmcsamplesleft > 0) ? 16 : 0)
- + (statusframeint ? 64 : 0)
- + (statusdmcint ? 128 : 0);
+ | ((lengthctr[1] > 0) ? 2 : 0)
+ | ((lengthctr[2] > 0) ? 4 : 0)
+ | ((lengthctr[3] > 0) ? 8 : 0)
+ | ((dmcsamplesleft > 0) ? 16 : 0)
+ | (statusframeint ? 64 : 0)
+ | (statusdmcint ? 128 : 0);
if (statusframeint) {
//System.err.println("Frame interrupt ack at " + cpu.cycles);
--cpu.interrupt;
@@ -127,22 +127,22 @@ public final void write(final int reg, final int data) {
switch (reg) {
case 0x0:
//length counter 1 halt
- lenctrHalt[0] = utils.getbit(data, 5);
+ lenctrHalt[0] = (data & utils.BIT5) != 0;
// pulse 1 duty cycle
timers[0].setduty(dutylookup[data >> 6]);
// and envelope
- envConstVolume[0] = utils.getbit(data, 4);
+ envConstVolume[0] = (data & utils.BIT4) != 0;
envelopeValue[0] = data & 15;
//setvolumes();
break;
case 0x1:
//pulse 1 sweep setup
//sweep enabled
- sweepenable[0] = utils.getbit(data, 7);
+ sweepenable[0] = (data & utils.BIT7) != 0;
//sweep divider period
sweepperiod[0] = (data >> 4) & 7;
//sweep negate flag
- sweepnegate[0] = utils.getbit(data, 3);
+ sweepnegate[0] = (data & utils.BIT3) != 0;
//sweep shift count
sweepshift[0] = (data & 7);
sweepreload[0] = true;
@@ -164,22 +164,22 @@ public final void write(final int reg, final int data) {
break;
case 0x4:
//length counter 2 halt
- lenctrHalt[1] = utils.getbit(data, 5);
+ lenctrHalt[1] = (data & utils.BIT5) != 0;
// pulse 2 duty cycle
timers[1].setduty(dutylookup[data >> 6]);
// and envelope
- envConstVolume[1] = utils.getbit(data, 4);
+ envConstVolume[1] = (data & utils.BIT4) != 0;
envelopeValue[1] = data & 15;
//setvolumes();
break;
case 0x5:
//pulse 2 sweep setup
//sweep enabled
- sweepenable[1] = utils.getbit(data, 7);
+ sweepenable[1] = (data & utils.BIT7) != 0;
//sweep divider period
sweepperiod[1] = (data >> 4) & 7;
//sweep negate flag
- sweepnegate[1] = utils.getbit(data, 3);
+ sweepnegate[1] = (data & utils.BIT3) != 0;
//sweep shift count
sweepshift[1] = (data & 7);
sweepreload[1] = true;
@@ -202,7 +202,7 @@ public final void write(final int reg, final int data) {
//triangle linear counter load
linctrreload = data & 0x7f;
//and length counter halt
- lenctrHalt[2] = utils.getbit(data, 7);
+ lenctrHalt[2] = (data & utils.BIT7) != 0;
break;
case 0x9:
break;
@@ -221,15 +221,15 @@ public final void write(final int reg, final int data) {
break;
case 0xC:
//noise halt and envelope
- lenctrHalt[3] = utils.getbit(data, 5);
- envConstVolume[3] = utils.getbit(data, 4);
+ lenctrHalt[3] = (data & utils.BIT5) != 0;
+ envConstVolume[3] = (data & utils.BIT4) != 0;
envelopeValue[3] = data & 0xf;
//setvolumes();
break;
case 0xD:
break;
case 0xE:
- timers[3].setduty(utils.getbit(data, 7) ? 6 : 1);
+ timers[3].setduty((data & utils.BIT7) != 0 ? 6 : 1);
timers[3].setperiod(noiseperiod[data & 15]);
break;
case 0xF:
@@ -240,8 +240,8 @@ public final void write(final int reg, final int data) {
envelopeStartFlag[3] = true;
break;
case 0x10:
- dmcirq = utils.getbit(data, 7);
- dmcloop = utils.getbit(data, 6);
+ dmcirq = (data & utils.BIT7) != 0;
+ dmcloop = (data & utils.BIT6) != 0;
dmcrate = dmcperiods[data & 0xf];
if (!dmcirq && statusdmcint) {
--cpu.interrupt;
@@ -278,7 +278,7 @@ public final void write(final int reg, final int data) {
lengthctr[i] = 0;
}
}
- if (utils.getbit(data, 4)) {
+ if ((data & utils.BIT4) != 0) {
if (dmcsamplesleft == 0) {
restartdmc();
}
@@ -293,13 +293,13 @@ public final void write(final int reg, final int data) {
break;
case 0x16:
// latch controller 1 + 2
- nes.getcontroller1().output(utils.getbit(data, 0));
- nes.getcontroller2().output(utils.getbit(data, 0));
+ nes.getcontroller1().output((data & utils.BIT0) != 0);
+ nes.getcontroller2().output((data & utils.BIT0) != 0);
break;
case 0x17:
- ctrmode = utils.getbit(data, 7) ? 5 : 4;
+ ctrmode = (data & utils.BIT7) != 0 ? 5 : 4;
//System.err.println("reset " + ctrmode + ' ' + cpu.cycles);
- apuintflag = utils.getbit(data, 6);
+ apuintflag = (data & utils.BIT6) != 0;
//set is no interrupt, clear is an interrupt
framectr = 0;
framectrdiv = 7456 + 8;
@@ -322,7 +322,7 @@ public final void write(final int reg, final int data) {
}
private int framectrdiv = 7456;
- public final synchronized void updateto(final int cpucycle) {
+ public final void updateto(final int cpucycle) {
//still have to run this even if sound is disabled, some games rely on DMC IRQ etc.
if (soundFiltering) {
//linear sampling code
@@ -350,7 +350,7 @@ public final synchronized void updateto(final int cpucycle) {
}
accum += getOutputLevel();
- if ((apucycle % cyclespersample) < 1) {
+ if ((apucycle % cyclespersample) == 0) {
//not quite right - there's a non-integer # cycles per sample.
ai.outputSample(lowpass_filter(highpass_filter((int) (accum / remainder))));
remainder = 0;
@@ -367,7 +367,7 @@ public final synchronized void updateto(final int cpucycle) {
framectrdiv = 7456;
clockframecounter();
}
- if ((apucycle % cyclespersample) < 1) {
+ if ((apucycle % cyclespersample) == 0) {
//not quite right - there's a non-integer # cycles per sample.
timers[0].clock(remainder);
timers[1].clock(remainder);
@@ -393,8 +393,7 @@ private int getOutputLevel() {
int vol;
vol = square_lookup[volume[0] * timers[0].getval()
+ volume[1] * timers[1].getval()];
- vol += tnd_lookup[
- 3 * timers[2].getval()
+ vol += tnd_lookup[3 * timers[2].getval()
+ 2 * volume[3] * timers[3].getval()
+ dmcvalue];
if (!expnSound.isEmpty()) {
@@ -422,10 +421,12 @@ private int lowpass_filter(int sample) {
return lpaccum;
}
- public final void finishframe() {
+ public final void finishframe(boolean flush) {
updateto(29781);
apucycle = 0;
- ai.flushFrame(nes.isFrameLimiterOn());
+ if (flush) {
+ ai.flushFrame(nes.isFrameLimiterOn());
+ }
}
private boolean apuintflag = true, statusdmcint = false, statusframeint = false;
private int framectr = 0, ctrmode = 4;
@@ -493,7 +494,7 @@ private void clockdmc() {
}
}
if (!dmcsilence) {
- dmcvalue += (utils.getbit(dmcshiftregister, 0) ? 2 : -2);
+ dmcvalue += ((dmcshiftregister & utils.BIT0) != 0 ? 2 : -2);
//DMC output register doesn't wrap around
if (dmcvalue > 0x7f) {
dmcvalue = 0x7f;
@@ -503,7 +504,6 @@ private void clockdmc() {
}
dmcshiftregister >>= 1;
--dmcbitsleft;
-
}
}
}
diff --git a/src/com/grapeshot/halfnes/CPU.java b/src/com/grapeshot/halfnes/CPU.java
index 5b7a4e9..f2f375c 100644
--- a/src/com/grapeshot/halfnes/CPU.java
+++ b/src/com/grapeshot/halfnes/CPU.java
@@ -1,6 +1,7 @@
package com.grapeshot.halfnes;
//HalfNES, Copyright Andrew Hoffman, October 2010
+import static com.grapeshot.halfnes.CPURAM.unsafe;
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
@@ -90,7 +91,7 @@ public void stealcycles(int cyclestosteal) {
}
public final void runcycle(final int scanline, final int pixel) {
- ram.read(0x4000); //attempt to sync the APU every cycle and make dmc irqs work properly, which they still don't. Feh.
+// ram.read(0x4000); //attempt to sync the APU every cycle and make dmc irqs work properly, which they still don't. Feh.
++clocks;
if (ram.apu.sprdma_count > 0) {
@@ -131,21 +132,53 @@ public final void runcycle(final int scanline, final int pixel) {
}
pb = 0;
final int instr = ram.read(PC++);
- if (logging) {
- try {
- //note: this *might* trigger side effects if logging while executing
- //code from i/o registers. So don't do that.
- w.write(utils.hex(PC - 1) + " " + utils.hex(instr)
- + String.format(" %-14s ", opcodes[instr].replaceFirst("%1", utils.hex(ram.read(PC))).replaceFirst("%2", utils.hex(ram.read(PC + 1))).replaceFirst("%3", utils.hex(PC + (byte) (ram.read(PC)) + 1)))
- + status() + " CYC:" + pixel + " SL:" + scanline + "\n");
- if (cycles == 0) {
- w.flush();
- }
- } catch (IOException e) {
- System.err.println("Cannot write to debug log");
- }
+// if (logging) {
+// try {
+// //note: this *might* trigger side effects if logging while executing
+// //code from i/o registers. So don't do that.
+// w.write(utils.hex(PC - 1) + " " + utils.hex(instr)
+// + String.format(" %-14s ", opcodes[instr].replaceFirst("%1", utils.hex(ram.read(PC))).replaceFirst("%2", utils.hex(ram.read(PC + 1))).replaceFirst("%3", utils.hex(PC + (byte) (ram.read(PC)) + 1)))
+// + status() + " CYC:" + pixel + " SL:" + scanline + "\n");
+// if (cycles == 0) {
+// w.flush();
+// }
+// } catch (IOException e) {
+// System.err.println("Cannot write to debug log");
+// }
+// }
+ switch (instr) {
+ case 0xa5:
+ lda(zpg());
+ cycles += 3;
+ break;
+ case 0xD0:
+ branch(!zeroFlag);
+ cycles += 2 + pb;
+ break;
+ // JMP
+ case 0x4c:
+ PC = abs();
+ cycles += 3;
+ break;
+ case 0xe8:
+ X++;
+ X &= 0xFF;
+ setflags(X);
+ cycles += 2;
+ break;
+ case 0x10:
+ branch(!negativeFlag);
+ cycles += 2 + pb;
+ break;
+ default:
+ processInstruction(instr);
}
+ pb = 0;
+ PC &= 0xffff;
+ }
+ // less frequent instructions broken out to improve inlining
+ private void processInstruction(final int instr) {
switch (instr) {
// ADC
case 0x69:
@@ -180,7 +213,7 @@ public final void runcycle(final int scanline, final int pixel) {
adc(indY(dummy.ONCARRY));
cycles += 5 + pb;
break;
- // AHX (unofficial)
+ // AHX (unofficial)
case 0x93:
ahx(indY(dummy.ALWAYS));
cycles += 6;
@@ -189,12 +222,12 @@ public final void runcycle(final int scanline, final int pixel) {
ahx(abs(Y, dummy.ALWAYS));
cycles += 5;
break;
- // ALR (unofficial)
+ // ALR (unofficial)
case 0x4b:
alr(imm());
cycles += 2;
break;
- // ANC (unofficial)
+ // ANC (unofficial)
case 0x0b:
anc(imm());
cycles += 2;
@@ -203,7 +236,7 @@ public final void runcycle(final int scanline, final int pixel) {
anc(imm());
cycles += 2;
break;
- // AND
+ // AND
case 0x29:
and(imm());
cycles += 2;
@@ -236,12 +269,12 @@ public final void runcycle(final int scanline, final int pixel) {
and(indY(dummy.ONCARRY));
cycles += 5 + pb;
break;
- // ARR (unofficial)
+ // ARR (unofficial)
case 0x6b:
arr(imm());
cycles += 2;
break;
- // ASL
+ // ASL
case 0x0A:
aslA();
cycles += 2;
@@ -262,12 +295,12 @@ public final void runcycle(final int scanline, final int pixel) {
asl(abs(X, dummy.ALWAYS));
cycles += 7;
break;
- // AXS (unofficial)
+ // AXS (unofficial)
case 0xcb:
axs(imm());
cycles += 2;
break;
- // BIT
+ // BIT
case 0x24:
bit(zpg());
cycles += 3;
@@ -276,11 +309,7 @@ public final void runcycle(final int scanline, final int pixel) {
bit(abs());
cycles += 4;
break;
- // Branches: every branch uses rel. addressing
- case 0x10:
- branch(!negativeFlag);
- cycles += 2 + pb;
- break;
+ // Branches: every branch uses rel. addressing
case 0x30:
branch(negativeFlag);
cycles += 2 + pb;
@@ -301,21 +330,17 @@ public final void runcycle(final int scanline, final int pixel) {
branch(carryFlag);
cycles += 2 + pb;
break;
- case 0xD0:
- branch(!zeroFlag);
- cycles += 2 + pb;
- break;
case 0xF0:
branch(zeroFlag);
cycles += 2 + pb;
break;
- // BRK
+ // BRK
case 0x00:
//System.err.println("Hey! A break!");
breakinterrupt();
cycles += 7;
break;
- // CMP
+ // CMP
case 0xc9:
cmp(A, imm());
cycles += 2;
@@ -348,7 +373,7 @@ public final void runcycle(final int scanline, final int pixel) {
cmp(A, indY(dummy.ONCARRY));
cycles += 5 + pb;
break;
- // CPX
+ // CPX
case 0xe0:
cmp(X, imm());
cycles += 2;
@@ -361,7 +386,7 @@ public final void runcycle(final int scanline, final int pixel) {
cmp(X, abs());
cycles += 4;
break;
- // CPY
+ // CPY
case 0xc0:
cmp(Y, imm());
cycles += 2;
@@ -374,7 +399,7 @@ public final void runcycle(final int scanline, final int pixel) {
cmp(Y, abs());
cycles += 4;
break;
- // DEC
+ // DEC
case 0xc6:
dec(zpg());
cycles += 5;
@@ -391,7 +416,7 @@ public final void runcycle(final int scanline, final int pixel) {
dec(abs(X, dummy.ALWAYS));
cycles += 7;
break;
- // DCP (unofficial)
+ // DCP (unofficial)
case 0xc3:
dcp(A, indX());
cycles += 8;
@@ -420,7 +445,7 @@ public final void runcycle(final int scanline, final int pixel) {
dcp(A, abs(X, dummy.ALWAYS));
cycles += 7;
break;
- // EOR
+ // EOR
case 0x49:
eor(imm());
cycles += 2;
@@ -453,7 +478,7 @@ public final void runcycle(final int scanline, final int pixel) {
eor(indY(dummy.ONCARRY));
cycles += 5 + pb;
break;
- // Flag set/clear
+ // Flag set/clear
case 0x18:
carryFlag = false;
cycles += 2;
@@ -487,7 +512,7 @@ public final void runcycle(final int scanline, final int pixel) {
decimalModeFlag = true;
cycles += 2;
break;// do anything on NES
- // INC
+ // INC
case 0xe6:
inc(zpg());
cycles += 5;
@@ -504,7 +529,7 @@ public final void runcycle(final int scanline, final int pixel) {
inc(abs(X, dummy.ALWAYS));
cycles += 7;
break;
- // ISC (unofficial)
+ // ISC (unofficial)
case 0xe3:
isc(indX());
cycles += 8;
@@ -533,21 +558,16 @@ public final void runcycle(final int scanline, final int pixel) {
isc(abs(X, dummy.ALWAYS));
cycles += 7;
break;
- // JMP
- case 0x4c:
- PC = abs();
- cycles += 3;
- break;
case 0x6c:
PC = ind();
cycles += 5;
break;
- // JSR
+ // JSR
case 0x20:
jsr(abs());
cycles += 6;
break;
- // KIL (unofficial)
+ // KIL (unofficial)
case 0x02:
case 0x12:
case 0x22:
@@ -563,12 +583,12 @@ public final void runcycle(final int scanline, final int pixel) {
System.err.println("KIL - CPU locked");
ram.apu.nes.runEmulation = false;
break;
- // LAS (unofficial)
+ // LAS (unofficial)
case 0xbb:
las(abs(Y, dummy.ONCARRY));
cycles += 4 + pb;
break;
- // LAX (unofficial)
+ // LAX (unofficial)
case 0xa3:
lax(indX());
cycles += 6;
@@ -597,15 +617,11 @@ public final void runcycle(final int scanline, final int pixel) {
lax(abs(Y, dummy.ONCARRY));
cycles += 4 + pb;
break;
- // LDA
+ // LDA
case 0xa9:
lda(imm());
cycles += 2;
break;
- case 0xa5:
- lda(zpg());
- cycles += 3;
- break;
case 0xb5:
lda(zpg(X));
cycles += 4;
@@ -630,7 +646,7 @@ public final void runcycle(final int scanline, final int pixel) {
lda(indY(dummy.ONCARRY));
cycles += 5 + pb;
break;
- // LDX
+ // LDX
case 0xa2:
ldx(imm());
cycles += 2;
@@ -651,7 +667,7 @@ public final void runcycle(final int scanline, final int pixel) {
ldx(abs(Y, dummy.ONCARRY));
cycles += 4 + pb;
break;
- // LDY
+ // LDY
case 0xa0:
ldy(imm());
cycles += 2;
@@ -672,7 +688,7 @@ public final void runcycle(final int scanline, final int pixel) {
ldy(abs(X, dummy.ONCARRY));
cycles += 4 + pb;
break;
- // LSR
+ // LSR
case 0x4a:
lsrA();
cycles += 2;
@@ -693,7 +709,7 @@ public final void runcycle(final int scanline, final int pixel) {
lsr(abs(X, dummy.ALWAYS));
cycles += 7;
break;
- // NOP
+ // NOP
case 0x1a:
case 0x3a:
case 0x5a:
@@ -739,7 +755,7 @@ public final void runcycle(final int scanline, final int pixel) {
abs(X, dummy.ONCARRY);
cycles += 4 + pb;
break;
- // ORA
+ // ORA
case 0x09:
ora(imm());
cycles += 2;
@@ -772,7 +788,7 @@ public final void runcycle(final int scanline, final int pixel) {
ora(indY(dummy.ONCARRY));
cycles += 5 + pb;
break;
- // Register instrs.
+ // Register instrs.
case 0xAA:
X = A;
cycles += 2;
@@ -789,12 +805,6 @@ public final void runcycle(final int scanline, final int pixel) {
setflags(X);
cycles += 2;
break;
- case 0xe8:
- X++;
- X &= 0xFF;
- setflags(X);
- cycles += 2;
- break;
case 0xa8:
Y = A;
cycles += 2;
@@ -817,7 +827,7 @@ public final void runcycle(final int scanline, final int pixel) {
setflags(Y);
cycles += 2;
break;
- // RLA (unofficial)
+ // RLA (unofficial)
case 0x23:
rla(indX());
cycles += 8;
@@ -846,7 +856,7 @@ public final void runcycle(final int scanline, final int pixel) {
rla(abs(X, dummy.ALWAYS));
cycles += 7;
break;
- // ROL
+ // ROL
case 0x2a:
rolA();
cycles += 2;
@@ -867,7 +877,7 @@ public final void runcycle(final int scanline, final int pixel) {
rol(abs(X, dummy.ALWAYS));
cycles += 7;
break;
- // ROR
+ // ROR
case 0x6a:
rorA();
cycles += 2;
@@ -888,7 +898,7 @@ public final void runcycle(final int scanline, final int pixel) {
ror(abs(X, dummy.ALWAYS));
cycles += 7;
break;
- // RRA (unofficial)
+ // RRA (unofficial)
case 0x63:
rra(indX());
cycles += 8;
@@ -917,17 +927,17 @@ public final void runcycle(final int scanline, final int pixel) {
rra(abs(X, dummy.ALWAYS));
cycles += 7;
break;
- // RTI
+ // RTI
case 0x40:
rti();
cycles += 6;
break;
- // RTS
+ // RTS
case 0x60:
rts();
cycles += 6;
break;
- // SAX (unofficial)
+ // SAX (unofficial)
case 0x83:
sax(indX());
cycles += 6;
@@ -944,7 +954,7 @@ public final void runcycle(final int scanline, final int pixel) {
sax(abs());
cycles += 4;
break;
- // SBC
+ // SBC
case 0xE1:
sbc(indX());
cycles += 6;
@@ -981,17 +991,17 @@ public final void runcycle(final int scanline, final int pixel) {
sbc(abs(X, dummy.ONCARRY));
cycles += 4 + pb;
break;
- // SHX (unofficial)
+ // SHX (unofficial)
case 0x9e:
shx(abs(Y, dummy.ALWAYS));
cycles += 5;
break;
- // SHY (unofficial)
+ // SHY (unofficial)
case 0x9c:
shy(abs(X, dummy.ALWAYS));
cycles += 5;
break;
- // SLO (unofficial)
+ // SLO (unofficial)
case 0x03:
slo(indX());
cycles += 8;
@@ -1020,7 +1030,7 @@ public final void runcycle(final int scanline, final int pixel) {
slo(abs(X, dummy.ALWAYS));
cycles += 7;
break;
- // SRE (unofficial)
+ // SRE (unofficial)
case 0x43:
sre(indX());
cycles += 8;
@@ -1049,7 +1059,7 @@ public final void runcycle(final int scanline, final int pixel) {
sre(abs(X, dummy.ALWAYS));
cycles += 7;
break;
- // STA
+ // STA
case 0x85:
sta(zpg());
cycles += 3;
@@ -1078,7 +1088,7 @@ public final void runcycle(final int scanline, final int pixel) {
sta(indY(dummy.ALWAYS));
cycles += 6;
break;
- // Stack instructions
+ // Stack instructions
case 0x9A:
S = X;
cycles += 2;
@@ -1111,7 +1121,7 @@ public final void runcycle(final int scanline, final int pixel) {
bytetoflags(pop());
cycles += 4;
break;
- // STX
+ // STX
case 0x86:
stx(zpg());
cycles += 3;
@@ -1124,7 +1134,7 @@ public final void runcycle(final int scanline, final int pixel) {
stx(abs());
cycles += 4;
break;
- // STY
+ // STY
case 0x84:
sty(zpg());
cycles += 3;
@@ -1137,12 +1147,12 @@ public final void runcycle(final int scanline, final int pixel) {
sty(abs());
cycles += 4;
break;
- // TAS (unofficial)
+ // TAS (unofficial)
case 0x9b:
tas(abs(Y, dummy.ALWAYS));
cycles += 5;
break;
- // XAA (unofficial)
+ // XAA (unofficial)
case 0x8b:
xaa(imm());
cycles += 2;
@@ -1153,8 +1163,6 @@ public final void runcycle(final int scanline, final int pixel) {
+ utils.hex(PC - 1));
break;
}
- pb = 0;
- PC &= 0xffff;
}
private void delayInterrupt() {
@@ -1166,7 +1174,7 @@ private void rol(final int addr) {
int data = (ram.read(addr));
ram.write(addr, data); //dummy write
data = (data << 1) | (carryFlag ? 1 : 0);
- carryFlag = utils.getbit(data, 8);
+ carryFlag = (data & utils.BIT8) != 0;
data &= 0xFF;
setflags(data);
ram.write(addr, data);
@@ -1174,7 +1182,7 @@ private void rol(final int addr) {
private void rolA() {
A = A << 1 | (carryFlag ? 1 : 0);
- carryFlag = utils.getbit(A, 8);
+ carryFlag = (A & utils.BIT8) != 0;
A &= 0xFF;
setflags(A);
}
@@ -1183,7 +1191,7 @@ private void ror(final int addr) {
int data = ram.read(addr);
ram.write(addr, data); //dummy write
final boolean tmp = carryFlag;
- carryFlag = utils.getbit(data, 0);
+ carryFlag = (data & utils.BIT0) != 0;
data >>= 1;
data &= 0x7F;
data |= (tmp ? 0x80 : 0);
@@ -1193,7 +1201,7 @@ private void ror(final int addr) {
private void rorA() {
final boolean tmp = carryFlag;
- carryFlag = utils.getbit(A, 0);
+ carryFlag = (A & utils.BIT0) != 0;
A >>= 1;
A &= 0x7F;
A |= (tmp ? 128 : 0);
@@ -1261,7 +1269,7 @@ private void breakinterrupt() {
private void lsr(final int addr) {
int data = ram.read(addr);
ram.write(addr, data); //dummy write
- carryFlag = utils.getbit(data, 0);
+ carryFlag = (data & utils.BIT0) != 0;
data >>= 1;
data &= 0x7F;
ram.write(addr, data);
@@ -1269,7 +1277,7 @@ private void lsr(final int addr) {
}
private void lsrA() {
- carryFlag = utils.getbit(A, 0);
+ carryFlag = (A & utils.BIT0) != 0;
A >>= 1;
A &= 0x7F;
setflags(A);
@@ -1291,8 +1299,8 @@ private void ora(final int addr) {
private void bit(final int addr) {
final int data = ram.read(addr);
zeroFlag = ((data & A) == 0);
- negativeFlag = utils.getbit(data, 7);
- overflowFlag = utils.getbit(data, 6);
+ negativeFlag = (data & utils.BIT7) != 0;
+ overflowFlag = (data & utils.BIT6) != 0;
}
private void jsr(final int addr) {
@@ -1422,7 +1430,7 @@ private void and(final int addr) {
private void asl(final int addr) {
int data = ram.read(addr);
ram.write(addr, data); //dummy write
- carryFlag = utils.getbit(data, 7);
+ carryFlag = (data & utils.BIT7) != 0;
data = data << 1;
data &= 0xff;
setflags(data);
@@ -1430,7 +1438,7 @@ private void asl(final int addr) {
}
private void aslA() {
- carryFlag = utils.getbit(A, 7);
+ carryFlag = (A & utils.BIT7) != 0;
A <<= 1;
A &= 0xff;
setflags(A);
@@ -1440,7 +1448,7 @@ private void aslA() {
private void cmp(final int regval, final int addr) {
final int result = regval - ram.read(addr);
if (result < 0) {
- negativeFlag = utils.getbit(result, 7);
+ negativeFlag = (result & utils.BIT7) != 0;
carryFlag = false;
zeroFlag = false;
} else if (result == 0) {
@@ -1448,7 +1456,7 @@ private void cmp(final int regval, final int addr) {
carryFlag = true;
zeroFlag = true;
} else {
- negativeFlag = utils.getbit(result, 7);
+ negativeFlag = (result & utils.BIT7) != 0;
carryFlag = true;
zeroFlag = false;
}
@@ -1471,7 +1479,7 @@ private void ldy(final int addr) {
private void setflags(final int result) {
zeroFlag = (result == 0);
- negativeFlag = utils.getbit(result, 7);
+ negativeFlag = (result & utils.BIT7) != 0;
}
private void sta(final int addr) {
@@ -1511,8 +1519,8 @@ private void arr(final int addr) {
A = (((ram.read(addr) & A) >> 1) | (carryFlag ? 0x80 : 0x00));
setflags(A);
- carryFlag = utils.getbit(A, 6);
- overflowFlag = carryFlag ^ utils.getbit(A, 5);
+ carryFlag = (A & utils.BIT6) != 0;
+ overflowFlag = carryFlag ^ (A & utils.BIT5) != 0;
}
private void axs(final int addr) {
@@ -1604,32 +1612,32 @@ private void xaa(int addr) {
// Functions for memory address types; each returns the _memory_address_ for
// the next fn
- protected final int imm() {
+ private final int imm() {
return PC++;
}
- protected final int zpg() {
+ private final int zpg() {
// zero page mode
return ram.read(PC++);
}
- protected final int zpg(final int reg) {
+ private final int zpg(final int reg) {
// zero page added to register (modulus page boundary)
return (ram.read(PC++) + reg) & 0xff;
}
- protected final int rel() {
+ private final int rel() {
// returns actual value of PC, not memory location to look at
// because only branches use this
return ((byte) ram.read(PC++)) + PC;
}
- protected final int abs() {
+ private final int abs() {
// absolute mode
return ram.read(PC++) + (ram.read(PC++) << 8);
}
- protected final int abs(final int reg, final dummy dummy) {
+ private final int abs(final int reg, final dummy dummy) {
// absolute plus value from reg
final int addr = (ram.read(PC++) | (ram.read(PC++) << 8));
@@ -1649,7 +1657,7 @@ protected final int abs(final int reg, final dummy dummy) {
return (addr + reg) & 0xffff;
}
- protected final int ind() {
+ private final int ind() {
// weird mode. only used by jmp
final int readloc = abs();
return ram.read(readloc)
@@ -1659,7 +1667,7 @@ protected final int ind() {
//is taken from first byte on the page, not first byte on NEXT page.
}
- protected final int indX() {
+ private final int indX() {
// indirect mode
final int arg = ram.read(PC++);
return ram.read((arg + X) & 0xff)
@@ -1667,7 +1675,7 @@ protected final int indX() {
// doesn't suffer from the same bug as jump indirect
}
- protected final int indY(final dummy dummy) {
+ private final int indY(final dummy dummy) {
final int arg = ram.read(PC++);
final int addr = (ram.read((arg) & 0xff) | (ram.read((arg + 1) & 0xff) << 8));
diff --git a/src/com/grapeshot/halfnes/CPURAM.java b/src/com/grapeshot/halfnes/CPURAM.java
index 59b42de..34d4f78 100644
--- a/src/com/grapeshot/halfnes/CPURAM.java
+++ b/src/com/grapeshot/halfnes/CPURAM.java
@@ -6,8 +6,12 @@
import com.grapeshot.halfnes.cheats.Patch;
import com.grapeshot.halfnes.mappers.Mapper;
+import java.lang.reflect.Field;
+import java.security.AccessController;
+import java.security.PrivilegedAction;
import java.util.Arrays;
import java.util.HashMap;
+import sun.misc.Unsafe;
/**
*
@@ -15,10 +19,34 @@
*
*
*/
-public class CPURAM {
+public final class CPURAM {
+
+ static final Unsafe unsafe;
+ static final int INTEGER_ARRAY_BASE_OFFSET;
+
+ static {
+ unsafe = (Unsafe) AccessController.doPrivileged(
+ new PrivilegedAction