RidersPyTools 0.0.1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (39) hide show
  1. riderspytools-0.0.1/.github/workflows/python-publish.yml +74 -0
  2. riderspytools-0.0.1/.idea/.gitignore +3 -0
  3. riderspytools-0.0.1/.idea/RidersPyTools.iml +10 -0
  4. riderspytools-0.0.1/.idea/inspectionProfiles/profiles_settings.xml +6 -0
  5. riderspytools-0.0.1/.idea/misc.xml +6 -0
  6. riderspytools-0.0.1/.idea/modules.xml +8 -0
  7. riderspytools-0.0.1/Examples/DiscordRPC.py +109 -0
  8. riderspytools-0.0.1/Examples/GetDataFromGame.py +31 -0
  9. riderspytools-0.0.1/Examples/GetSetValues.py +48 -0
  10. riderspytools-0.0.1/Examples/LapCheck.py +156 -0
  11. riderspytools-0.0.1/Examples/ReadInputs.py +15 -0
  12. riderspytools-0.0.1/LICENSE +19 -0
  13. riderspytools-0.0.1/PKG-INFO +76 -0
  14. riderspytools-0.0.1/README.md +61 -0
  15. riderspytools-0.0.1/pyproject.toml +29 -0
  16. riderspytools-0.0.1/requirements.txt +0 -0
  17. riderspytools-0.0.1/src/RidersPyTools_KC/Archetypes.py +24 -0
  18. riderspytools-0.0.1/src/RidersPyTools_KC/Characters.py +55 -0
  19. riderspytools-0.0.1/src/RidersPyTools_KC/DolphinProc.py +61 -0
  20. riderspytools-0.0.1/src/RidersPyTools_KC/GameState.py +98 -0
  21. riderspytools-0.0.1/src/RidersPyTools_KC/Gears.py +129 -0
  22. riderspytools-0.0.1/src/RidersPyTools_KC/MapParser.py +143 -0
  23. riderspytools-0.0.1/src/RidersPyTools_KC/Player.py +354 -0
  24. riderspytools-0.0.1/src/RidersPyTools_KC/RidersObject.py +125 -0
  25. riderspytools-0.0.1/src/RidersPyTools_KC/Stages.py +38 -0
  26. riderspytools-0.0.1/src/RidersPyTools_KC/__init__.py +1 -0
  27. riderspytools-0.0.1/src/RidersPyTools_KC/config.py +35 -0
  28. riderspytools-0.0.1/src/RidersPyTools_KC/include/Constants.py +105 -0
  29. riderspytools-0.0.1/src/RidersPyTools_KC/include/Controller.py +75 -0
  30. riderspytools-0.0.1/src/RidersPyTools_KC/include/GearStats.py +72 -0
  31. riderspytools-0.0.1/src/RidersPyTools_KC/include/GenericData.py +176 -0
  32. riderspytools-0.0.1/src/RidersPyTools_KC/include/OffsetAttr.py +26 -0
  33. riderspytools-0.0.1/src/RidersPyTools_KC/include/Structs.py +0 -0
  34. riderspytools-0.0.1/src/RidersPyTools_KC/include/__init__.py +0 -0
  35. riderspytools-0.0.1/src/__init__.py +0 -0
  36. riderspytools-0.0.1/structText/Controller.txt +16 -0
  37. riderspytools-0.0.1/structText/ConvertCStruct.py +93 -0
  38. riderspytools-0.0.1/structText/GearStats +14 -0
  39. riderspytools-0.0.1/structText/PlayerStructText.txt +1096 -0
@@ -0,0 +1,74 @@
1
+ # This workflow will upload a Python Package to PyPI when a release is created
2
+ # For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python#publishing-to-package-registries
3
+
4
+ # This workflow uses actions that are not certified by GitHub.
5
+ # They are provided by a third-party and are governed by
6
+ # separate terms of service, privacy policy, and support
7
+ # documentation.
8
+
9
+ name: Upload Python Package
10
+
11
+ on:
12
+ push:
13
+ release:
14
+ types: [published, edited]
15
+
16
+ permissions:
17
+ contents: read
18
+
19
+ jobs:
20
+ release-build:
21
+ runs-on: ubuntu-latest
22
+
23
+ steps:
24
+ - uses: actions/checkout@v4
25
+
26
+ - uses: actions/setup-python@v5
27
+ with:
28
+ python-version: "3.x"
29
+ - name: Install dependencies
30
+ run: |
31
+ python -m pip install --upgrade pip
32
+ pip install -r requirements.txt
33
+
34
+ - name: Build release distributions
35
+ run: |
36
+ # NOTE: put your own distribution build steps here.
37
+ python -m pip install build
38
+ python -m build
39
+
40
+ - name: Upload distributions
41
+ uses: actions/upload-artifact@v4
42
+ with:
43
+ name: release-dists
44
+ path: dist/
45
+
46
+ pypi-publish:
47
+ runs-on: ubuntu-latest
48
+ needs:
49
+ - release-build
50
+ permissions:
51
+ # IMPORTANT: this permission is mandatory for trusted publishing
52
+ id-token: write
53
+
54
+ # Dedicated environments with protections for publishing are strongly recommended.
55
+ # For more information, see: https://docs.github.com/en/actions/deployment/targeting-different-environments/using-environments-for-deployment#deployment-protection-rules
56
+ environment:
57
+ name: pypi
58
+ # OPTIONAL: uncomment and update to include your PyPI project URL in the deployment status:
59
+ url: https://pypi.org/p/RidersPyTools/
60
+ # ALTERNATIVE: if your GitHub Release name is the PyPI project version string
61
+ # ALTERNATIVE: exactly, uncomment the following line instead:
62
+ # url: https://pypi.org/project/YOURPROJECT/${{ github.event.release.name }}
63
+
64
+ steps:
65
+ - name: Retrieve release distributions
66
+ uses: actions/download-artifact@v4
67
+ with:
68
+ name: release-dists
69
+ path: dist/
70
+
71
+ - name: Publish release distributions to PyPI
72
+ uses: pypa/gh-action-pypi-publish@release/v1
73
+ with:
74
+ packages-dir: dist/
@@ -0,0 +1,3 @@
1
+ # Default ignored files
2
+ /shelf/
3
+ /workspace.xml
@@ -0,0 +1,10 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <module type="PYTHON_MODULE" version="4">
3
+ <component name="NewModuleRootManager">
4
+ <content url="file://$MODULE_DIR$">
5
+ <excludeFolder url="file://$MODULE_DIR$/.venv" />
6
+ </content>
7
+ <orderEntry type="jdk" jdkName="Python 3.12 (RidersPyTools)" jdkType="Python SDK" />
8
+ <orderEntry type="sourceFolder" forTests="false" />
9
+ </component>
10
+ </module>
@@ -0,0 +1,6 @@
1
+ <component name="InspectionProjectProfileManager">
2
+ <settings>
3
+ <option name="USE_PROJECT_PROFILE" value="false" />
4
+ <version value="1.0" />
5
+ </settings>
6
+ </component>
@@ -0,0 +1,6 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="Black">
4
+ <option name="sdkName" value="Python 3.12 (RidersPyTools)" />
5
+ </component>
6
+ </project>
@@ -0,0 +1,8 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="ProjectModuleManager">
4
+ <modules>
5
+ <module fileurl="file://$PROJECT_DIR$/.idea/RidersPyTools.iml" filepath="$PROJECT_DIR$/.idea/RidersPyTools.iml" />
6
+ </modules>
7
+ </component>
8
+ </project>
@@ -0,0 +1,109 @@
1
+ from src.RidersPyTools_KC.Characters import CHR_ID_TO_NAME, CHR_ID_TO_DEFAULT_GEAR_NAME
2
+ from src.RidersPyTools_KC.GameState import RaceState, ExitMethod, MODE_ID_TO_NAME, GameModes
3
+ from src.RidersPyTools_KC.Gears import GEAR_ID_TO_NAME, ALL_GEARS
4
+ from src.RidersPyTools_KC.Stages import STAGE_ID_TO_NAME
5
+ from src.RidersPyTools_KC.Archetypes import ARCH_ID_TO_NAME
6
+ from src.RidersPyTools_KC.Player import Player, DME
7
+ from src.RidersPyTools_KC.RidersObject import RidersObject
8
+ from src.RidersPyTools_KC.include.Constants import *
9
+
10
+ # Python imports
11
+ from pypresence import Presence, PyPresenceException
12
+ import time
13
+
14
+ def RPC_loop(client_id):
15
+ DME.hook()
16
+
17
+ player1 = Player(0, TE_PLAYER_PTR)
18
+
19
+ # These overrides are for TE 2.4.6.1
20
+ # Add a command line param to enable/disable these maybe?
21
+ object_overrides = {
22
+ "CurrentGameMode": 0x8053C2E0,
23
+ "geGame_ModeDetail": 0x8053C2E4,
24
+ "CurrentStage": 0x8053C2E8,
25
+ "ExitMethod": 0x8053C300,
26
+ "StageTimer": 0x8053C480
27
+ }
28
+ ridersObject1 = RidersObject(object_overrides)
29
+
30
+ RPC = Presence(client_id=client_id) # Initialize the client class
31
+ RPC.connect() # Start the handshake loop
32
+
33
+ while True: # The presence will stay on as long as the program is running
34
+ """
35
+ Things to get:
36
+ 1. Game and mod version.
37
+ 2. Mode.
38
+ 3. Stage (and image).
39
+ 4. Current time.
40
+ 5. If 1P, activity_type == "Playing". If 2P+, activity_type == "Competing"
41
+ """
42
+
43
+ game_id = ridersObject1.gameID
44
+ game_name = GAME_ID_TO_NAME[GameIDs(bytes(game_id))]
45
+
46
+ current_mode_id = ridersObject1.currentMode
47
+ current_mode = MODE_ID_TO_NAME[current_mode_id]
48
+
49
+ if current_mode_id is GameModes.MAIN_MENU_MODE:
50
+ state_string = "Mode Select"
51
+ else:
52
+ state_string = STAGE_ID_TO_NAME[ridersObject1.currentStage]
53
+
54
+ current_lap = player1.currentLap
55
+
56
+ # TODO: add TE-specific/other mod specific structs if vanilla characters don't check out.
57
+ # Get game version with game_name variable from above, use that to select a dict
58
+ try:
59
+ character = CHR_ID_TO_NAME[player1.character]
60
+ except KeyError:
61
+ character = str(player1.character)
62
+
63
+ try:
64
+ gear = GEAR_ID_TO_NAME[player1.extremeGear]
65
+ except KeyError:
66
+ gear = str(player1.extremeGear)
67
+
68
+ if gear == GEAR_ID_TO_NAME[255]:
69
+ # invalid gear
70
+ small_string = str(character + ", selecting a gear.")
71
+ small_image = str(character).lower() + "_default"
72
+ elif gear == GEAR_ID_TO_NAME[0]:
73
+ # If default gear, set string to char_default.
74
+ small_image = str(character).lower() + "_default"
75
+
76
+ try:
77
+ gear = CHR_ID_TO_DEFAULT_GEAR_NAME[player1.character]
78
+ except KeyError:
79
+ gear = GEAR_ID_TO_NAME[0]
80
+ small_string = str(character + " and " + gear)
81
+ else:
82
+ # TODO: use a translation map instead of multiple replacements
83
+ small_image = gear.replace(" ", "_").lower()
84
+ # Any extra characters like the apostrophe should also be removed for Board '70
85
+ small_image = small_image.replace("'", "")
86
+ # Covers e-rider
87
+ small_image = small_image.replace("-", "_")
88
+ small_string = str(character + " and " + gear)
89
+
90
+ lap_string = ""
91
+ if current_mode_id not in {GameModes.STAGE_SELECT,
92
+ GameModes.BATTLE_MODE,
93
+ GameModes.CUTSCENE_MODE,
94
+ GameModes.MAIN_MENU_MODE}:
95
+ lap_string = " - Race Start" if current_lap == 0 else " - Lap {}".format(current_lap)
96
+
97
+ RPC.update(
98
+ details=current_mode + lap_string,
99
+ state=state_string,
100
+ large_image=state_string.replace(" ", "_").lower(),
101
+ large_text=state_string,
102
+ small_image=small_image,
103
+ small_text=small_string,
104
+ name=game_name
105
+ )
106
+ time.sleep(1) # Can only update rich presence every X seconds
107
+
108
+ if __name__ == "__main__":
109
+ RPC_loop(1507118425951174706)
@@ -0,0 +1,31 @@
1
+ from src.RidersPyTools_KC.Characters import CHR_ID_TO_NAME
2
+ from src.RidersPyTools_KC.Gears import GEAR_ID_TO_NAME
3
+ from src.RidersPyTools_KC.Stages import STAGE_ID_TO_NAME
4
+ from src.RidersPyTools_KC.Archetypes import ARCH_ID_TO_NAME
5
+ from src.RidersPyTools_KC.Player import Player, DME
6
+ from src.RidersPyTools_KC.RidersObject import RidersObject
7
+ from src.RidersPyTools_KC.include.Constants import *
8
+
9
+ import time
10
+
11
+ if __name__ == "__main__":
12
+ # Hook Dolphin here
13
+ DME.hook()
14
+
15
+ # Instantiate player ptr on py side
16
+ player1 = Player(0, TE_PLAYER_PTR)
17
+
18
+ # Instantiate the stage timer for 2.4.6.1
19
+ # (at the time of writing, this is the only data in here)
20
+ object_overrides = {
21
+ "CurrentGameMode": 0x8053C2E0,
22
+ "geGame_ModeDetail": 0x8053C2E4,
23
+ "CurrentStage": 0x8053C2E8,
24
+ "ExitMethod": 0x8053C300,
25
+ "StageTimer": 0x8053C480
26
+ }
27
+ ridersObject1 = RidersObject(object_overrides)
28
+
29
+ print(ridersObject1.get_race_state(return_text=True))
30
+
31
+ print(ridersObject1.get_current_race_time())
@@ -0,0 +1,48 @@
1
+ from src.RidersPyTools_KC.Characters import CHR_ID_TO_NAME
2
+ from src.RidersPyTools_KC.Gears import GEAR_ID_TO_NAME
3
+ from src.RidersPyTools_KC.Archetypes import ARCH_ID_TO_NAME
4
+ from src.RidersPyTools_KC.Player import Player, DME, PlayerState
5
+ from src.RidersPyTools_KC.include.Constants import *
6
+ import time
7
+
8
+ if __name__ == "__main__":
9
+ DME.hook()
10
+
11
+ # Instantiate player ptr on py side
12
+ player1 = Player(0, TE_PLAYER_PTR)
13
+
14
+ # Test get values
15
+ try:
16
+ print("Character:", CHR_ID_TO_NAME[player1.character])
17
+ except KeyError:
18
+ print("Character ID:", int(player1.character))
19
+
20
+ try:
21
+ print("Extreme Gear:", GEAR_ID_TO_NAME[player1.extremeGear])
22
+ except KeyError:
23
+ print("Extreme Gear ID:", int(player1.extremeGear))
24
+
25
+ try:
26
+ print("Character archetype:", ARCH_ID_TO_NAME[player1.characterArchetype])
27
+ except KeyError:
28
+ print("Character archetype ID:", int(player1.characterArchetype))
29
+
30
+ print("Current lap:", player1.currentLap)
31
+ print("Player State:", PlayerState(player1.state).name)
32
+
33
+ # Let's adjust their rings!
34
+ print("Changing rings.")
35
+ print("Rings before change:", player1.rings)
36
+
37
+ # Set the ring value on the player
38
+ player1.rings = 100
39
+ print("Rings after change:", player1.rings)
40
+
41
+ # Play an animation for fun!
42
+ player1.currentAnimationID = 62
43
+
44
+ # Do a pause for a second since scripting does not frame match dolphin
45
+ time.sleep(0.05)
46
+
47
+ # Set boost speed
48
+ player1.gearStats[player1.level].boostSpeed = pSpeed(300.0)
@@ -0,0 +1,156 @@
1
+ import time
2
+
3
+ from src.RidersPyTools_KC.Characters import CHR_ID_TO_NAME
4
+ from src.RidersPyTools_KC.GameState import RaceState, ExitMethod
5
+ from src.RidersPyTools_KC.Gears import GEAR_ID_TO_NAME
6
+ from src.RidersPyTools_KC.Stages import STAGE_ID_TO_NAME
7
+ from src.RidersPyTools_KC.Archetypes import ARCH_ID_TO_NAME
8
+ from src.RidersPyTools_KC.Player import Player, DME
9
+ from src.RidersPyTools_KC.RidersObject import RidersObject
10
+ from src.RidersPyTools_KC.include.Constants import *
11
+
12
+ if __name__ == "__main__":
13
+ # Keep some globals for data checks
14
+ diff_min = 0
15
+ diff_sec = 0
16
+ diff_milli = 0
17
+
18
+ minutes = 0
19
+ seconds = 0
20
+ centiseconds = 0
21
+
22
+ is_reset = False
23
+
24
+ restart_count = 0
25
+
26
+ LAP_COUNT = 3
27
+
28
+ # Hook Dolphin here
29
+ DME.hook()
30
+
31
+ # Instantiate player ptr on py side
32
+ player1 = Player(0, TE_PLAYER_PTR)
33
+
34
+ # Instantiate the stage timer for 2.4.6.1
35
+ # (at the time of writing, this is the only data in here)
36
+ object_overrides = {
37
+ "CurrentGameMode": 0x8053C2E0,
38
+ "geGame_ModeDetail": 0x8053C2E4,
39
+ "CurrentStage": 0x8053C2E8,
40
+ "ExitMethod": 0x8053C300,
41
+ "StageTimer": 0x8053C480
42
+ }
43
+ ridersObject1 = RidersObject(object_overrides)
44
+
45
+ print(ridersObject1.get_race_state(return_text=True))
46
+
47
+ # Set a global lap counter as a lock mechanism
48
+ # Get current lap count (we do this so this counts even if they are past init)
49
+ # MAKE SURE TO TYPECAST TO GET THE INT VALUE
50
+ py_lap_count = player1.currentLap
51
+
52
+ print("Current stage:", STAGE_ID_TO_NAME[ridersObject1.currentStage])
53
+
54
+ # Get these values in human-readable form, else give the ID only
55
+ try:
56
+ print("Character:", CHR_ID_TO_NAME[player1.character])
57
+ except KeyError:
58
+ print("Character ID:", int(player1.character))
59
+
60
+ try:
61
+ print("Extreme Gear:", GEAR_ID_TO_NAME[player1.extremeGear])
62
+ except KeyError:
63
+ print("Extreme Gear ID:", int(player1.extremeGear))
64
+
65
+ try:
66
+ print("Character archetype:", ARCH_ID_TO_NAME[player1.characterArchetype])
67
+ except KeyError:
68
+ print("Character archetype ID:", int(player1.characterArchetype))
69
+
70
+ print("\nLap counter started on lap:", py_lap_count)
71
+ print("Current time: {:02d}:{:02d}:{:02d}".format(int(ridersObject1.stageTimer[2]), int(ridersObject1.stageTimer[1]), int(ridersObject1.stageTimer[0])))
72
+
73
+
74
+ # Use in-game lap count to check updates.
75
+ while True:
76
+ # If player state == startline and the lap counter is greater than 0, reset it.
77
+ if ridersObject1.exitMethod == ExitMethod.Retry and ridersObject1.get_race_state() in {RaceState.Init, RaceState.End} and not is_reset:
78
+ print("-" * 10)
79
+ print("Race restarted.")
80
+ is_reset = True
81
+ py_lap_count = 0
82
+ restart_count += 1
83
+ overall_time_diff = None
84
+ diff_min = 0
85
+ diff_sec = 0
86
+ diff_milli = 0
87
+ print("Restart count:", restart_count)
88
+ print("-"*10)
89
+
90
+ # If you reset and the race is counting down, turn off lock mechanism
91
+ if is_reset and ridersObject1.get_race_state() == RaceState.Countdown:
92
+ # print("Start new race")
93
+ is_reset = False
94
+
95
+ if is_reset:
96
+ continue
97
+
98
+ current_lap_in_game = player1.currentLap
99
+
100
+ if current_lap_in_game > py_lap_count:
101
+ # Increment lap count
102
+ py_lap_count = current_lap_in_game
103
+
104
+ if current_lap_in_game <= LAP_COUNT:
105
+ print("Lap:", current_lap_in_game)
106
+
107
+ if current_lap_in_game == 1:
108
+ minutes = int(ridersObject1.stageTimer[2])
109
+ seconds = int(ridersObject1.stageTimer[1])
110
+ centiseconds = int(ridersObject1.stageTimer[0])
111
+ print("Starting time: {:02d}:{:02d}:{:02d}".format(minutes, seconds, centiseconds))
112
+
113
+ # Don't show time diffs on lap 1, to mirror game behavior
114
+ if current_lap_in_game != 1:
115
+ # Always in centiseconds, divide by 100 to get actual seconds.
116
+ # Does not have minutes value, must convert.
117
+ last_lap_time = int(player1.lapTimeList[current_lap_in_game-2]) / 100
118
+
119
+ # Divide into minutes and seconds
120
+ minutes, seconds = divmod(last_lap_time, 60)
121
+
122
+ # Divide into seconds and centiseconds
123
+ seconds, centiseconds = divmod(seconds, 1)
124
+
125
+ # Round centiseconds to 2 places just like in-game
126
+ centiseconds = round(centiseconds, 2) * 100
127
+
128
+ # Print here
129
+ print("Lap time: {:02}:{:02}:{:02}".format(int(minutes), int(seconds), int(centiseconds)))
130
+
131
+ # Show time for lap.
132
+ minutes = int(ridersObject1.stageTimer[2])
133
+ seconds = int(ridersObject1.stageTimer[1])
134
+ centiseconds = int(ridersObject1.stageTimer[0])
135
+
136
+ if current_lap_in_game <= LAP_COUNT:
137
+ print("Current race time: {:02d}:{:02d}:{:02d}".format(minutes, seconds, centiseconds))
138
+
139
+ if current_lap_in_game > LAP_COUNT:
140
+ # Divide centiseconds to get minutes and seconds
141
+ final_lap_time = int(player1.lastSplitLapTime) / 100
142
+
143
+ # Divide into minutes and seconds
144
+ minutes, seconds = divmod(final_lap_time, 60)
145
+
146
+ # Divide into seconds and centiseconds
147
+ seconds, centiseconds = divmod(seconds, 1)
148
+
149
+ # Round centiseconds to 2 places just like in-game
150
+ centiseconds = round(centiseconds, 2) * 100
151
+
152
+ # Print here
153
+ print("Finish time: {:02}:{:02}:{:02}".format(int(minutes), int(seconds), int(centiseconds)))
154
+
155
+ time.sleep(0.02)
156
+ print("Speed: {}".format(player1.speedAsInt), "\n")
@@ -0,0 +1,15 @@
1
+ from src.RidersPyTools_KC.Player import Player, DME
2
+ from src.RidersPyTools_KC.include.Constants import *
3
+
4
+ if __name__ == "__main__":
5
+ DME.hook()
6
+
7
+ # Instantiate player ptr on py side
8
+ player1 = Player(0, TE_PLAYER_PTR)
9
+
10
+ # Test get
11
+ while True:
12
+ print("left stick horizontal, vertical: {} {}"
13
+ .format(player1.input.leftStickHorizontal,
14
+ player1.input.leftStickVertical),
15
+ end='\r')
@@ -0,0 +1,19 @@
1
+ Copyright (c) 2018 The Python Packaging Authority
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining a copy
4
+ of this software and associated documentation files (the "Software"), to deal
5
+ in the Software without restriction, including without limitation the rights
6
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
+ copies of the Software, and to permit persons to whom the Software is
8
+ furnished to do so, subject to the following conditions:
9
+
10
+ The above copyright notice and this permission notice shall be included in all
11
+ copies or substantial portions of the Software.
12
+
13
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19
+ SOFTWARE.
@@ -0,0 +1,76 @@
1
+ Metadata-Version: 2.4
2
+ Name: RidersPyTools
3
+ Version: 0.0.1
4
+ Summary: Tools to read/write data and scripts for Sonic Riders (GC) & mods on dolphin
5
+ Project-URL: Homepage, https://github.com/KidWizardOfTheWeb/RidersPyTools
6
+ Project-URL: Issues, https://github.com/KidWizardOfTheWeb/RidersPyTools/issues
7
+ Author-email: KidChameleon <smasih2020@gmail.com>
8
+ License-Expression: MIT
9
+ License-File: LICENSE
10
+ Classifier: Operating System :: OS Independent
11
+ Classifier: Programming Language :: Python :: 3
12
+ Requires-Python: >=3.12
13
+ Requires-Dist: dolphin-memory-engine>=1.3.0
14
+ Description-Content-Type: text/markdown
15
+
16
+ # RidersPyTools
17
+
18
+ Package designed to write scripts for Sonic Riders (GameCube) and Sonic Riders: Zero Gravity (Wii). Compatible with vanilla/all mods.
19
+
20
+ Still a MAJOR work in progress, but functional at a basic level for now.
21
+
22
+ ## Code style
23
+
24
+ We enforce the same standards as the Sonic Riders: Tournament Edition C++ codebase for Sonic Riders, aiming to be as close as possible in syntax to the existing decompilation.
25
+
26
+ In some cases, this isn't 100% possible, but it remains the goal, as this allows us to read code similarly between C++ and python,
27
+ as well as provide a bridge for newer users learning to program to jump into the C++ side of things.
28
+
29
+ Other games may have different data structures and syntax, feel free to add/modify classes as needed to fit your game.
30
+
31
+ Some concepts:
32
+
33
+ Ways to get a player pointer:
34
+ Instantiate a player object in Python:
35
+
36
+ `player1 = Player(0) # Instantiates a pointer to player 1, based on the current game version detected.`
37
+
38
+ Instantiate a player object starting at X address:
39
+
40
+ ```python
41
+ player1Vanilla = Player(0, 0x80609440) # Vanilla address
42
+ player1TE = Player(0, TE_PLAYER_PTR) # Some addresses are given identifiers for ease of use
43
+ ```
44
+
45
+ Things you can do:
46
+
47
+ Read data:
48
+
49
+ `print(player1.rings)`
50
+
51
+ Compare data:
52
+
53
+ ```python
54
+ player1 = Player(0, 0x80609440)
55
+ if player1.rings > 0:
56
+ print("You have at least one ring!")
57
+ ```
58
+
59
+ Write data:
60
+
61
+ ```python
62
+ player1 = Player(0, 0x80609440)
63
+ player1.currentAir = 100000
64
+ player1.gearStats[int(player1.level)].boostSpeed = pSpeed(300.0)
65
+ ```
66
+
67
+ Math operations:
68
+ ```python
69
+ player1 = Player(0, 0x80609440)
70
+ hundredRingDiff = 100 - int(player1.rings)
71
+ print(hundredRingDiff)
72
+ ```
73
+
74
+ And you can integrate this into other scripts too!
75
+
76
+ We use hatchling to compile the builds. Build compilation instructions coming soon.
@@ -0,0 +1,61 @@
1
+ # RidersPyTools
2
+
3
+ Package designed to write scripts for Sonic Riders (GameCube) and Sonic Riders: Zero Gravity (Wii). Compatible with vanilla/all mods.
4
+
5
+ Still a MAJOR work in progress, but functional at a basic level for now.
6
+
7
+ ## Code style
8
+
9
+ We enforce the same standards as the Sonic Riders: Tournament Edition C++ codebase for Sonic Riders, aiming to be as close as possible in syntax to the existing decompilation.
10
+
11
+ In some cases, this isn't 100% possible, but it remains the goal, as this allows us to read code similarly between C++ and python,
12
+ as well as provide a bridge for newer users learning to program to jump into the C++ side of things.
13
+
14
+ Other games may have different data structures and syntax, feel free to add/modify classes as needed to fit your game.
15
+
16
+ Some concepts:
17
+
18
+ Ways to get a player pointer:
19
+ Instantiate a player object in Python:
20
+
21
+ `player1 = Player(0) # Instantiates a pointer to player 1, based on the current game version detected.`
22
+
23
+ Instantiate a player object starting at X address:
24
+
25
+ ```python
26
+ player1Vanilla = Player(0, 0x80609440) # Vanilla address
27
+ player1TE = Player(0, TE_PLAYER_PTR) # Some addresses are given identifiers for ease of use
28
+ ```
29
+
30
+ Things you can do:
31
+
32
+ Read data:
33
+
34
+ `print(player1.rings)`
35
+
36
+ Compare data:
37
+
38
+ ```python
39
+ player1 = Player(0, 0x80609440)
40
+ if player1.rings > 0:
41
+ print("You have at least one ring!")
42
+ ```
43
+
44
+ Write data:
45
+
46
+ ```python
47
+ player1 = Player(0, 0x80609440)
48
+ player1.currentAir = 100000
49
+ player1.gearStats[int(player1.level)].boostSpeed = pSpeed(300.0)
50
+ ```
51
+
52
+ Math operations:
53
+ ```python
54
+ player1 = Player(0, 0x80609440)
55
+ hundredRingDiff = 100 - int(player1.rings)
56
+ print(hundredRingDiff)
57
+ ```
58
+
59
+ And you can integrate this into other scripts too!
60
+
61
+ We use hatchling to compile the builds. Build compilation instructions coming soon.
@@ -0,0 +1,29 @@
1
+ [build-system]
2
+ requires = ["hatchling >= 1.27.0"]
3
+ build-backend = "hatchling.build"
4
+
5
+ [project]
6
+ name = "RidersPyTools"
7
+ version = "0.0.1"
8
+ authors = [
9
+ { name="KidChameleon", email="smasih2020@gmail.com" },
10
+ ]
11
+ description = "Tools to read/write data and scripts for Sonic Riders (GC) & mods on dolphin"
12
+ readme = "README.md"
13
+ requires-python = ">=3.12"
14
+ dependencies = [
15
+ "dolphin-memory-engine>=1.3.0"
16
+ ]
17
+ classifiers = [
18
+ "Programming Language :: Python :: 3",
19
+ "Operating System :: OS Independent",
20
+ ]
21
+ license = "MIT"
22
+ license-files = ["LICEN[CS]E*"]
23
+
24
+ [project.urls]
25
+ Homepage = "https://github.com/KidWizardOfTheWeb/RidersPyTools"
26
+ Issues = "https://github.com/KidWizardOfTheWeb/RidersPyTools/issues"
27
+
28
+ [tool.hatch.build.targets.wheel]
29
+ packages = ["src/RidersPyTools_KC"]
Binary file