diff --git a/ports/thysword/README.md b/ports/thysword/README.md new file mode 100644 index 0000000000..90df65edac --- /dev/null +++ b/ports/thysword/README.md @@ -0,0 +1,19 @@ +## Notes + +Special thanks to [GamePhase](https://www.gamephase.net/) for making this awesome game! + +Source: https://store.steampowered.com/app/560300/Thy_Sword/ or https://gamephase.itch.io/thy-sword + +## Controls + +| Button | Action | +|--|--| +|D-pad|Movement| +|L1|Block| +|R1|Sword / Magic| +|East|Bow| +|South|Jump| +|West|Special| +|Start|Pause / Menu| + + diff --git a/ports/thysword/Thy Sword.sh b/ports/thysword/Thy Sword.sh new file mode 100644 index 0000000000..2f17eec15a --- /dev/null +++ b/ports/thysword/Thy Sword.sh @@ -0,0 +1,81 @@ +#!/bin/bash + +XDG_DATA_HOME=${XDG_DATA_HOME:-$HOME/.local/share} + +if [ -d "/opt/system/Tools/PortMaster/" ]; then + controlfolder="/opt/system/Tools/PortMaster" +elif [ -d "/opt/tools/PortMaster/" ]; then + controlfolder="/opt/tools/PortMaster" +elif [ -d "$XDG_DATA_HOME/PortMaster/" ]; then + controlfolder="$XDG_DATA_HOME/PortMaster" +else + controlfolder="/roms/ports/PortMaster" +fi + +source $controlfolder/control.txt +export PORT_32BIT="Y" + +get_controls +[ -f "${controlfolder}/mod_${CFW_NAME}.txt" ] && source "${controlfolder}/mod_${CFW_NAME}.txt" + +GAMEDIR="/$directory/ports/thysword" + +export LD_LIBRARY_PATH="/usr/lib32:$GAMEDIR/libs:$LD_LIBRARY_PATH" +export GMLOADER_DEPTH_DISABLE=1 +export GMLOADER_SAVEDIR="$GAMEDIR/gamedata/" +export GMLOADER_PLATFORM="os_windows" + +# We log the execution of the script into log.txt +> "$GAMEDIR/log.txt" && exec > >(tee "$GAMEDIR/log.txt") 2>&1 + +# Permissions +$ESUDO chmod +x $GAMEDIR/tools/SDL_swap_gpbuttons.py +$ESUDO chmod +x $GAMEDIR/gmloader + +# check if we have new enough version of PortMaster that contains xdelta3 +if [ ! -f "$controlfolder/xdelta3" ]; then + pm_message "This port requires the latest PortMaster to run, please go to https://portmaster.games/ for more info." + sleep 5 + exit 1 +fi + +# Change Drive and Patch Game +cd "$GAMEDIR" + +# If "gamedata/data.win" exists and matches the checksum of the itch or steam versions +if [ -f "./gamedata/data.win" ]; then + checksum=$(md5sum "./gamedata/data.win" | awk '{print $1}') + + # Checksum for the Steam version + if [ "$checksum" = "aefda0536e3f55e0deac7d8e150ceb27" ]; then + $ESUDO $controlfolder/xdelta3 -d -s gamedata/data.win -f ./tools/thyswordsteam.xdelta gamedata/game.droid && \ + rm gamedata/data.win + rm -f "gamedata/place data.win here" + pm_message "Steam version of the game has been patched" + # Checksum for the Itch version + elif [ "$checksum" = "05e81de7e15b109379f91886230f8d05" ]; then + $ESUDO $controlfolder/xdelta3 -d -s gamedata/data.win -f ./tools/thysworditch.xdelta gamedata/game.droid && \ + rm gamedata/data.win + rm -f "gamedata/place data.win here" + pm_message "Itch.io version of the game has been patched" + else + pm_message "Error: MD5 checksum of data.win does not match any expected version." + exit 1 + fi +fi + +# dos2unix in case we need it +dos2unix "$GAMEDIR/tools/SDL_swap_gpbuttons.py" + +# Swap buttons +"$GAMEDIR/tools/SDL_swap_gpbuttons.py" -i "$SDL_GAMECONTROLLERCONFIG_FILE" -o "$GAMEDIR/gamecontrollerdb_swapped.txt" -l "$GAMEDIR/SDL_swap_gpbuttons.txt" +export SDL_GAMECONTROLLERCONFIG_FILE="$GAMEDIR/gamecontrollerdb_swapped.txt" +export SDL_GAMECONTROLLERCONFIG="`echo "$SDL_GAMECONTROLLERCONFIG" | "$GAMEDIR/tools/SDL_swap_gpbuttons.py" -l "$GAMEDIR/SDL_swap_gpbuttons.txt"`" + +$GPTOKEYB "gmloader" & + +$ESUDO chmod +x "$GAMEDIR/gmloader" +pm_platform_helper "$GAMEDIR/gmloader" +./gmloader game.apk + +pm_finish diff --git a/ports/thysword/cover.png b/ports/thysword/cover.png new file mode 100644 index 0000000000..1ad463d0f2 Binary files /dev/null and b/ports/thysword/cover.png differ diff --git a/ports/thysword/gameinfo.xml b/ports/thysword/gameinfo.xml new file mode 100644 index 0000000000..6d2c2bf381 --- /dev/null +++ b/ports/thysword/gameinfo.xml @@ -0,0 +1,19 @@ + + + + ./Thy Sword.sh + Thy Sword + Thy Sword is a hack n' slash platformer with procedural levels and roguelike elements. + +Inspired by true classics like: Barbarian, Moonstone, Golden Axe and Bubble Bobble! + +Get ready for a heroic challenge! +Better yet, summon a friend for a truly epic co-op adventure, +...or a duel to the death. Whoever wins keeps his head. + 20171115T000000 + GamePhase + GamePhase + Platformer + ./thysword/cover.png + + \ No newline at end of file diff --git a/ports/thysword/port.json b/ports/thysword/port.json new file mode 100644 index 0000000000..530a00b4bc --- /dev/null +++ b/ports/thysword/port.json @@ -0,0 +1,31 @@ +{ + "version": 3, + "name": "thysword.zip", + "items": [ + "Thy Sword.sh", + "thysword" + ], + "items_opt": [], + "attr": { + "title": "Thy Sword", + "porter": [ + "Fraxinus88" + ], + "desc": "Thy Sword is a hack n' slash platformer with procedural levels and roguelike elements.", + "desc_md": null, + "inst": "Purchase the game from Steam OR Itch.io\nDownload the game and place the data.win into ports/thysword/gamedata", + "inst_md": "Purchase the game from [steam](https://store.steampowered.com/app/560300/Thy_Sword/) OR [Itch.io](https://gamephase.itch.io/thy-sword)\nDownload the game and place the data.win into ports/thysword/gamedata", + "genres": [ + "platformer" + ], + "image": null, + "rtr": false, + "exp": false, + "runtime": null, + "reqs": [], + "arch": [ + "armhf" + ], + "min_glibc": "" + } +} \ No newline at end of file diff --git a/ports/thysword/screenshot.png b/ports/thysword/screenshot.png new file mode 100644 index 0000000000..9c69f92465 Binary files /dev/null and b/ports/thysword/screenshot.png differ diff --git a/ports/thysword/thysword/SDL_swap_gpbuttons.txt b/ports/thysword/thysword/SDL_swap_gpbuttons.txt new file mode 100644 index 0000000000..a439ed3d83 --- /dev/null +++ b/ports/thysword/thysword/SDL_swap_gpbuttons.txt @@ -0,0 +1,2 @@ +a b +x y diff --git a/ports/thysword/thysword/game.apk b/ports/thysword/thysword/game.apk new file mode 100644 index 0000000000..f2ff629f7b Binary files /dev/null and b/ports/thysword/thysword/game.apk differ diff --git a/ports/thysword/thysword/gamedata/place data.win here b/ports/thysword/thysword/gamedata/place data.win here new file mode 100644 index 0000000000..e69de29bb2 diff --git a/ports/thysword/thysword/gamedata/splash.png b/ports/thysword/thysword/gamedata/splash.png new file mode 100644 index 0000000000..c9393af462 Binary files /dev/null and b/ports/thysword/thysword/gamedata/splash.png differ diff --git a/ports/thysword/thysword/gmloader b/ports/thysword/thysword/gmloader new file mode 100644 index 0000000000..168fc6ec09 Binary files /dev/null and b/ports/thysword/thysword/gmloader differ diff --git a/ports/thysword/thysword/libc++_shared.so b/ports/thysword/thysword/libc++_shared.so new file mode 100644 index 0000000000..fb45ef9052 Binary files /dev/null and b/ports/thysword/thysword/libc++_shared.so differ diff --git a/ports/thysword/thysword/libs/libcrypto.so.1.1 b/ports/thysword/thysword/libs/libcrypto.so.1.1 new file mode 100644 index 0000000000..12578440aa Binary files /dev/null and b/ports/thysword/thysword/libs/libcrypto.so.1.1 differ diff --git a/ports/thysword/thysword/libs/libssl.so.1.1 b/ports/thysword/thysword/libs/libssl.so.1.1 new file mode 100644 index 0000000000..f94835c02f Binary files /dev/null and b/ports/thysword/thysword/libs/libssl.so.1.1 differ diff --git a/ports/thysword/thysword/libs/libzip.so.4 b/ports/thysword/thysword/libs/libzip.so.4 new file mode 100644 index 0000000000..bc3ef2300d Binary files /dev/null and b/ports/thysword/thysword/libs/libzip.so.4 differ diff --git a/ports/thysword/thysword/license/LICENSE.libcrypto.txt b/ports/thysword/thysword/license/LICENSE.libcrypto.txt new file mode 100644 index 0000000000..49cc83d2ee --- /dev/null +++ b/ports/thysword/thysword/license/LICENSE.libcrypto.txt @@ -0,0 +1,177 @@ + + Apache License + Version 2.0, January 2004 + https://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 diff --git a/ports/thysword/thysword/license/LICENSE.libzip.txt b/ports/thysword/thysword/license/LICENSE.libzip.txt new file mode 100644 index 0000000000..fa70609611 --- /dev/null +++ b/ports/thysword/thysword/license/LICENSE.libzip.txt @@ -0,0 +1,31 @@ +Copyright (C) 1999-2020 Dieter Baron and Thomas Klausner + +The authors can be contacted at + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions +are met: + +1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + +2. 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. + +3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + +THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``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 AUTHORS 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. diff --git a/ports/thysword/thysword/license/LICENSE.openssl-ssleay.txt b/ports/thysword/thysword/license/LICENSE.openssl-ssleay.txt new file mode 100644 index 0000000000..9601ab4357 --- /dev/null +++ b/ports/thysword/thysword/license/LICENSE.openssl-ssleay.txt @@ -0,0 +1,125 @@ + + LICENSE ISSUES + ============== + + The OpenSSL toolkit stays under a double license, i.e. both the conditions of + the OpenSSL License and the original SSLeay license apply to the toolkit. + See below for the actual license texts. + + OpenSSL License + --------------- + +/* ==================================================================== + * Copyright (c) 1998-2019 The OpenSSL Project. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * 2. 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. + * + * 3. All advertising materials mentioning features or use of this + * software must display the following acknowledgment: + * "This product includes software developed by the OpenSSL Project + * for use in the OpenSSL Toolkit. (http://www.openssl.org/)" + * + * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to + * endorse or promote products derived from this software without + * prior written permission. For written permission, please contact + * openssl-core@openssl.org. + * + * 5. Products derived from this software may not be called "OpenSSL" + * nor may "OpenSSL" appear in their names without prior written + * permission of the OpenSSL Project. + * + * 6. Redistributions of any form whatsoever must retain the following + * acknowledgment: + * "This product includes software developed by the OpenSSL Project + * for use in the OpenSSL Toolkit (http://www.openssl.org/)" + * + * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY + * EXPRESSED 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 OpenSSL PROJECT OR + * ITS 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. + * ==================================================================== + * + * This product includes cryptographic software written by Eric Young + * (eay@cryptsoft.com). This product includes software written by Tim + * Hudson (tjh@cryptsoft.com). + * + */ + + Original SSLeay License + ----------------------- + +/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) + * All rights reserved. + * + * This package is an SSL implementation written + * by Eric Young (eay@cryptsoft.com). + * The implementation was written so as to conform with Netscapes SSL. + * + * This library is free for commercial and non-commercial use as long as + * the following conditions are aheared to. The following conditions + * apply to all code found in this distribution, be it the RC4, RSA, + * lhash, DES, etc., code; not just the SSL code. The SSL documentation + * included with this distribution is covered by the same copyright terms + * except that the holder is Tim Hudson (tjh@cryptsoft.com). + * + * Copyright remains Eric Young's, and as such any Copyright notices in + * the code are not to be removed. + * If this package is used in a product, Eric Young should be given attribution + * as the author of the parts of the library used. + * This can be in the form of a textual message at program startup or + * in documentation (online or textual) provided with the package. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the copyright + * notice, this list of conditions and the following disclaimer. + * 2. 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. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * "This product includes cryptographic software written by + * Eric Young (eay@cryptsoft.com)" + * The word 'cryptographic' can be left out if the rouines from the library + * being used are not cryptographic related :-). + * 4. If you include any Windows specific code (or a derivative thereof) from + * the apps directory (application code) you must include an acknowledgement: + * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" + * + * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``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 AUTHOR 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. + * + * The licence and distribution terms for any publically available version or + * derivative of this code cannot be changed. i.e. this code cannot simply be + * copied and put under another distribution licence + * [including the GNU Public Licence.] + */ + diff --git a/ports/thysword/thysword/tools/SDL_swap_gpbuttons.py b/ports/thysword/thysword/tools/SDL_swap_gpbuttons.py new file mode 100644 index 0000000000..317a2a0444 --- /dev/null +++ b/ports/thysword/thysword/tools/SDL_swap_gpbuttons.py @@ -0,0 +1,100 @@ +#!/usr/bin/env python3 +import sys +import argparse + +""" + name: swapabxy tool + description: swap buttons in SDL_GAMECONTROLLERCONFIG + author: kotzebuedog + usage: + export SDL_GAMECONTROLLERCONFIG="`echo "$SDL_GAMECONTROLLERCONFIG" | ./SDL_swap_gpbuttons.py -i - -o - -l swaplist.txt`" + + For example: + + # nintendo layout + 19009b4d4b4800000111000000010000,retrogame_joypad,a:b1,b:b0,dpdown:b14,dpleft:b15,+lefty:+a1,-leftx:-a0,+leftx:+a0,-lefty:-a1,leftshoulder:b4,leftstick:b11,lefttrigger:b6,dpright:b16,+righty:+a3,-rightx:-a2,+rightx:+a2,-righty:-a3,rightshoulder:b5,rightstick:b12,righttrigger:b7,back:b8,start:b9,dpup:b13,x:b2,y:b3,platform:Linux, + + becomes + + # nintendo layout + 19009b4d4b4800000111000000010000,retrogame_joypad,a:b0,b:b1,dpdown:b14,dpleft:b15,+lefty:+a1,-leftx:-a0,+leftx:+a0,-lefty:-a1,leftshoulder:b4,leftstick:b11,lefttrigger:b6,dpright:b16,+righty:+a3,-rightx:-a2,+rightx:+a2,-righty:-a3,rightshoulder:b5,rightstick:b12,righttrigger:b7,back:b8,start:b9,dpup:b13,x:b3,y:b2,platform:Linux, + + +""" + +def main(): + + parser = argparse.ArgumentParser(description='K-dog Gamepad button swapper tool: swap one or more pair of button in the SDL GAMECONTROLLER CONFIG') + parser.add_argument('-i', '--input', default="-",help='SDL GAMECONTROLLER CONFIG input file (by default stdin)') + parser.add_argument('-o', '--output', default="-",help='SDL GAMECONTROLLER CONFIG output file (by default stdout)') + parser.add_argument('-l', '--list-file',default="SDL_swap_gpbuttons.txt",help='Swap list file. 2-tuples of buttons to swap (eg. "a b" to swap a with b), one per line.') + + args = parser.parse_args() + + swaplist = [] + # Setup a list of swap 2-tuples + with open(args.list_file,'r') as list_file: + lines = list_file.readlines() + for _,line in enumerate(lines): + values = line.strip().split(' ') + if len(values) != 2: + # we skip this line + continue + else: + swaplist.append(values) + + if args.input != '-': + with open(args.input, 'r') as inputfile: + lines = inputfile.readlines() + else: + lines = sys.stdin + + if args.output != '-': + output = open(args.output, 'w') + else: + output = sys.stdout + + for line in lines: + # For each line we try to split the parameter with ',' as field delimiter + + splitted_line = line.rstrip().split(',') + + # For each pair of swap we try to find the two parameters and swap them in splitted_line + for _,swap in enumerate(swaplist): + # name for a,b fields + a_name = swap[0] + b_name = swap[1] + + # column index of the a,b fields + (a_idx, b_idx) = (-1, -1) + + # a,b gamepad configuration value (eg. "b1", "b2"...) + (a_val, b_val) = ("", "") + + # Look for a and b parameters in each field + for i,param in enumerate(splitted_line): + + # For each field split the parameter name (eg. "a") from its value (eg. "b1") + # delimiter is ":" + splitted_param = param.split(":") + + if splitted_param[0] == a_name: + # we have found parameter for a + a_val = splitted_param[1] + a_idx = i + elif splitted_param[0] == b_name: + # we have found parameter for b + b_val = splitted_param[1] + b_idx = i + + if a_idx > -1 and b_idx > -1: + # We have found a and b so we can swap them + splitted_line[a_idx] = f"{a_name}:{b_val}" + splitted_line[b_idx] = f"{b_name}:{a_val}" + + # Print the reconstitued line (even we haven't updated it) + output.write(','.join(splitted_line)) + output.write('\n') + +if __name__ == '__main__': + main() \ No newline at end of file diff --git a/ports/thysword/thysword/tools/thysworditch.xdelta b/ports/thysword/thysword/tools/thysworditch.xdelta new file mode 100644 index 0000000000..ba5f9ee913 Binary files /dev/null and b/ports/thysword/thysword/tools/thysworditch.xdelta differ diff --git a/ports/thysword/thysword/tools/thyswordsteam.xdelta b/ports/thysword/thysword/tools/thyswordsteam.xdelta new file mode 100644 index 0000000000..e68b84a0c2 Binary files /dev/null and b/ports/thysword/thysword/tools/thyswordsteam.xdelta differ