Splatlogger 1.6.1__tar.gz → 1.6.2__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: Splatlogger
3
- Version: 1.6.1
3
+ Version: 1.6.2
4
4
  Summary: A CLI PID (Principal ID)/PNID grabber and match logger for Splatoon.
5
5
  Author-email: Shadow Doggo <shadowdoggo@protonmail.com>
6
6
  License-Expression: MIT
@@ -38,12 +38,12 @@ Though if you already have Python installed, it's recommended to use the package
38
38
 
39
39
  To install the package from PyPI, run:
40
40
  ```
41
- python -m pip install Splatlogger
41
+ pip install Splatlogger
42
42
  ```
43
43
 
44
44
  Or download the latest release from Codeberg and run:
45
45
  ```
46
- python -m pip install path/to/Splatlogger-v1.x.zip
46
+ pip install path/to/Splatlogger-v1.x.zip
47
47
  ```
48
48
 
49
49
  If you do have Python installed but do not wish to install the package, you can run the module directly from the source code.
@@ -78,26 +78,27 @@ Options:
78
78
  - `extended` - Log all player information and additional match information.
79
79
  - `stats` - Same as above with the addition of player stats (points, K/D). Requires the match to end to finish logging.
80
80
 
81
- - `-auto [option]` - Enable auto logging. When enabled will automatically log every match you play (log level must be at least `standard`).
81
+ - `-auto [option]` - Enable auto logging. When enabled will automatically log every match you play. The log level must be at least `standard`.
82
82
  - `all` - Save a log of all matches you play (default).
83
83
  - `latest` - Save a log of only the latest match.
84
84
 
85
85
  - `-aroma` - Switch to Aroma mode. Enable if using the TCPGecko Aroma plugin.
86
86
 
87
87
  - `-cemu [PID]` - Switch to Cemu mode. The `-ip` argument is not required and will be ignored.
88
+ *Note: If you have ptrace protection enabled, you'll need to run python as root. It's best to run the module from source in that case.*
88
89
  - `PID` - PID of the Cemu process (optional).
89
90
 
90
- - `-stack Address (in hex)` - (Cemu only) Beginning address of the stack space for Default Core 1 (Debug > View PPC threads).
91
- Reuired for logging stats, not needed otherwise.
91
+ - `-stack Address (in hex)` - (Cemu only, optional) Beginning address of the stack space for Default Core 1 (Debug > View PPC threads).
92
+ Only required for logging stats. If the default values don't work, you'll need to specify this manually.
92
93
 
93
94
  <img src="stack.png" width="600" alt="(example)">
94
95
 
95
96
  - `-silent` - Disable printing logs to the console.
96
97
 
97
- Logs are saved in `/[User]/Documents/Splatlogger/logs/[Date]`.
98
+ Logs are saved in `(User)/Documents/Splatlogger/logs/(Date)/`.
98
99
 
99
100
  To always run with the same IP and options without having to type them in manually, create an `args.txt` file in
100
- `/[User]/Documents/Splatlogger` and put the arguments following `splatlogger` in there.
101
+ `(User)/Documents/Splatlogger/` and put the arguments following `splatlogger` in there.
101
102
  Afterward any arguments passed through the command line will be ignored.
102
103
 
103
104
  Only one program can be connected to TCPGecko at a time. If you have something else connected, disconnect it beforehand.
@@ -22,12 +22,12 @@ Though if you already have Python installed, it's recommended to use the package
22
22
 
23
23
  To install the package from PyPI, run:
24
24
  ```
25
- python -m pip install Splatlogger
25
+ pip install Splatlogger
26
26
  ```
27
27
 
28
28
  Or download the latest release from Codeberg and run:
29
29
  ```
30
- python -m pip install path/to/Splatlogger-v1.x.zip
30
+ pip install path/to/Splatlogger-v1.x.zip
31
31
  ```
32
32
 
33
33
  If you do have Python installed but do not wish to install the package, you can run the module directly from the source code.
@@ -62,26 +62,27 @@ Options:
62
62
  - `extended` - Log all player information and additional match information.
63
63
  - `stats` - Same as above with the addition of player stats (points, K/D). Requires the match to end to finish logging.
64
64
 
65
- - `-auto [option]` - Enable auto logging. When enabled will automatically log every match you play (log level must be at least `standard`).
65
+ - `-auto [option]` - Enable auto logging. When enabled will automatically log every match you play. The log level must be at least `standard`.
66
66
  - `all` - Save a log of all matches you play (default).
67
67
  - `latest` - Save a log of only the latest match.
68
68
 
69
69
  - `-aroma` - Switch to Aroma mode. Enable if using the TCPGecko Aroma plugin.
70
70
 
71
71
  - `-cemu [PID]` - Switch to Cemu mode. The `-ip` argument is not required and will be ignored.
72
+ *Note: If you have ptrace protection enabled, you'll need to run python as root. It's best to run the module from source in that case.*
72
73
  - `PID` - PID of the Cemu process (optional).
73
74
 
74
- - `-stack Address (in hex)` - (Cemu only) Beginning address of the stack space for Default Core 1 (Debug > View PPC threads).
75
- Reuired for logging stats, not needed otherwise.
75
+ - `-stack Address (in hex)` - (Cemu only, optional) Beginning address of the stack space for Default Core 1 (Debug > View PPC threads).
76
+ Only required for logging stats. If the default values don't work, you'll need to specify this manually.
76
77
 
77
78
  <img src="stack.png" width="600" alt="(example)">
78
79
 
79
80
  - `-silent` - Disable printing logs to the console.
80
81
 
81
- Logs are saved in `/[User]/Documents/Splatlogger/logs/[Date]`.
82
+ Logs are saved in `(User)/Documents/Splatlogger/logs/(Date)/`.
82
83
 
83
84
  To always run with the same IP and options without having to type them in manually, create an `args.txt` file in
84
- `/[User]/Documents/Splatlogger` and put the arguments following `splatlogger` in there.
85
+ `(User)/Documents/Splatlogger/` and put the arguments following `splatlogger` in there.
85
86
  Afterward any arguments passed through the command line will be ignored.
86
87
 
87
88
  Only one program can be connected to TCPGecko at a time. If you have something else connected, disconnect it beforehand.
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "Splatlogger"
7
- version = "1.6.1"
7
+ version = "1.6.2"
8
8
  authors = [
9
9
  { name="Shadow Doggo", email="shadowdoggo@protonmail.com" }
10
10
  ]
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: Splatlogger
3
- Version: 1.6.1
3
+ Version: 1.6.2
4
4
  Summary: A CLI PID (Principal ID)/PNID grabber and match logger for Splatoon.
5
5
  Author-email: Shadow Doggo <shadowdoggo@protonmail.com>
6
6
  License-Expression: MIT
@@ -38,12 +38,12 @@ Though if you already have Python installed, it's recommended to use the package
38
38
 
39
39
  To install the package from PyPI, run:
40
40
  ```
41
- python -m pip install Splatlogger
41
+ pip install Splatlogger
42
42
  ```
43
43
 
44
44
  Or download the latest release from Codeberg and run:
45
45
  ```
46
- python -m pip install path/to/Splatlogger-v1.x.zip
46
+ pip install path/to/Splatlogger-v1.x.zip
47
47
  ```
48
48
 
49
49
  If you do have Python installed but do not wish to install the package, you can run the module directly from the source code.
@@ -78,26 +78,27 @@ Options:
78
78
  - `extended` - Log all player information and additional match information.
79
79
  - `stats` - Same as above with the addition of player stats (points, K/D). Requires the match to end to finish logging.
80
80
 
81
- - `-auto [option]` - Enable auto logging. When enabled will automatically log every match you play (log level must be at least `standard`).
81
+ - `-auto [option]` - Enable auto logging. When enabled will automatically log every match you play. The log level must be at least `standard`.
82
82
  - `all` - Save a log of all matches you play (default).
83
83
  - `latest` - Save a log of only the latest match.
84
84
 
85
85
  - `-aroma` - Switch to Aroma mode. Enable if using the TCPGecko Aroma plugin.
86
86
 
87
87
  - `-cemu [PID]` - Switch to Cemu mode. The `-ip` argument is not required and will be ignored.
88
+ *Note: If you have ptrace protection enabled, you'll need to run python as root. It's best to run the module from source in that case.*
88
89
  - `PID` - PID of the Cemu process (optional).
89
90
 
90
- - `-stack Address (in hex)` - (Cemu only) Beginning address of the stack space for Default Core 1 (Debug > View PPC threads).
91
- Reuired for logging stats, not needed otherwise.
91
+ - `-stack Address (in hex)` - (Cemu only, optional) Beginning address of the stack space for Default Core 1 (Debug > View PPC threads).
92
+ Only required for logging stats. If the default values don't work, you'll need to specify this manually.
92
93
 
93
94
  <img src="stack.png" width="600" alt="(example)">
94
95
 
95
96
  - `-silent` - Disable printing logs to the console.
96
97
 
97
- Logs are saved in `/[User]/Documents/Splatlogger/logs/[Date]`.
98
+ Logs are saved in `(User)/Documents/Splatlogger/logs/(Date)/`.
98
99
 
99
100
  To always run with the same IP and options without having to type them in manually, create an `args.txt` file in
100
- `/[User]/Documents/Splatlogger` and put the arguments following `splatlogger` in there.
101
+ `(User)/Documents/Splatlogger/` and put the arguments following `splatlogger` in there.
101
102
  Afterward any arguments passed through the command line will be ignored.
102
103
 
103
104
  Only one program can be connected to TCPGecko at a time. If you have something else connected, disconnect it beforehand.
@@ -19,7 +19,7 @@ from .match_logger import MatchLogger
19
19
  from .tcpgecko import TCPGecko, TCPGeckoException
20
20
  from .tcpgecko_aroma import TCPGeckoAroma
21
21
 
22
- _VERSION = "1.6.1"
22
+ _VERSION = "1.6.2"
23
23
 
24
24
 
25
25
  class Options(NamedTuple):
@@ -58,8 +58,8 @@ def main() -> None:
58
58
  metavar="Address (in hex)")
59
59
  parser.add_argument("-silent", help="Disable printing logs to the console.", action="store_true")
60
60
 
61
- if os.path.isfile(f"{userpaths.get_my_documents()}/Splatlogger/args.txt"):
62
- with open(f"{userpaths.get_my_documents()}/Splatlogger/args.txt", encoding="utf-8") as f:
61
+ if os.path.isfile(os.path.join(userpaths.get_my_documents(), "Splatlogger/args.txt")):
62
+ with open((os.path.join(userpaths.get_my_documents(), "Splatlogger/args.txt")), encoding="utf-8") as f:
63
63
  args = parser.parse_args(f.read().split())
64
64
  else:
65
65
  args = parser.parse_args()
@@ -67,7 +67,7 @@ def main() -> None:
67
67
  if len(sys.argv) == 1:
68
68
  print('No arguments were provided. Run "splatlogger -h" for help.')
69
69
  print("Would you like to open the README? (y/n)")
70
- if input().lower() == "y":
70
+ if input().lower() in ("y", "yes"):
71
71
  webbrowser.open("https://codeberg.org/ShadowDoggo/Splatlogger/src/branch/main/README.md")
72
72
 
73
73
  sys.exit()
@@ -96,9 +96,6 @@ def main() -> None:
96
96
  gecko: TCPGecko | TCPGeckoAroma | CemuGecko
97
97
  if args.cemu:
98
98
  ptr_offset = 0x503000
99
- if args.log_level == "stats" and not args.stack:
100
- print("Stack space address must be specified for stats logging on Cemu (see README).")
101
- sys.exit()
102
99
  try:
103
100
  print("Opening Cemu process...")
104
101
  gecko = CemuGecko(int(args.cemu))
@@ -129,7 +126,7 @@ def main() -> None:
129
126
  print(f"\nAn error has occurred: {e}\nRetrying in 10 seconds...")
130
127
  time.sleep(10)
131
128
  except AssertionError:
132
- print("\nUnable to find StaticMem and PlayerInfoAry address.\nRetrying in 10 seconds...")
129
+ print("\nCould not find StaticMem and PlayerInfoAry address.\nRetrying in 10 seconds...")
133
130
  time.sleep(10)
134
131
  else:
135
132
  print("\nFailed after 3 tries.")
@@ -22,7 +22,7 @@ class CemuGecko:
22
22
 
23
23
  self._base_address = self._get_base_address()
24
24
  if self._base_address == 0:
25
- raise CemuGeckoException("Could not find Wii U memory space base address.")
25
+ raise CemuGeckoException("Could not find Cemu's Wii U memory space.")
26
26
 
27
27
  def peek_raw(self, address: int, length: int) -> bytes:
28
28
  """Read raw memory starting at address and ending at address + length.
@@ -50,13 +50,17 @@ class CemuGecko:
50
50
  return self.peek_raw(address, length).decode(encoding)
51
51
 
52
52
  def _get_base_address(self) -> int:
53
+ # Find Cemu's Wii U memory space and verify the pattern of bytes at the start of the game's memory.
54
+ # I'm pretty sure winterberry found the method for this, so credit goes to him.
53
55
  base_address = 0
54
56
  for memory_region in self._process.get_memory_regions():
55
57
  address = memory_region["address"]
56
58
  size = memory_region["size"]
57
59
  if size == 0x4E000000:
58
- base_address = address - 0x2000000
59
- break
60
+ pattern = bytes.fromhex("02D4E7")
61
+ if self._process.read_process_memory(address + 0xE000000, bytes, bufflength=20).find(pattern) != -1:
62
+ base_address = address - 0x2000000
63
+ break
60
64
 
61
65
  return base_address
62
66
 
@@ -1,6 +1,7 @@
1
1
  # Splatlogger (c) 2025 Shadow Doggo.
2
2
 
3
3
  import os
4
+ import platform
4
5
  import time
5
6
  from datetime import datetime
6
7
 
@@ -16,7 +17,7 @@ class MatchLogger:
16
17
  def __init__(self, gecko: TCPGecko | CemuGecko, log_level: str, auto_logging: bool, aroma: bool,
17
18
  cemu: bool, stack: int | None, static_mem_adr: int) -> None:
18
19
  self._gecko = gecko
19
- self._log_path = userpaths.get_my_documents() + "/Splatlogger/logs"
20
+ self._log_path = os.path.join(userpaths.get_my_documents(), "Splatlogger/logs")
20
21
  self._log_level = log_level
21
22
  self._auto_logging = auto_logging
22
23
  self._static_mem_adr = static_mem_adr
@@ -135,9 +136,14 @@ class MatchLogger:
135
136
  ptr_offset = 0
136
137
  if self._cemu:
137
138
  ptr_offset = 0x503000
138
- if isinstance(self._stack, int):
139
+ if self._stack:
139
140
  stats_adr = self._stack + Offsets.CEMU_STATS
140
141
  win_team_adr = self._stack + Offsets.CEMU_WIN_TEAM
142
+ else:
143
+ # Assume default values if stack is not provided. These seem consistent across various systems.
144
+ stack = 0xE101440 if platform.system() == "Windows" else 0xE175900
145
+ stats_adr = stack + Offsets.CEMU_STATS
146
+ win_team_adr = stack + Offsets.CEMU_WIN_TEAM
141
147
 
142
148
  if self._aroma:
143
149
  stats_adr -= 0x30
@@ -86,7 +86,7 @@ class TCPGecko:
86
86
  if status == b"\xb0":
87
87
  return b"\x00" * length
88
88
 
89
- raise TCPGeckoException("Unable to read memory.")
89
+ raise TCPGeckoException("Failed to read memory.")
90
90
 
91
91
  @staticmethod
92
92
  def _valid_range(address: int, length: int) -> bool:
File without changes