Skip to content

Commit 134188d

Browse files
HerXayahLabyStudio
andauthored
Support latest Spotify update (#6)
* Update 64-bit offset * Clarify Versioning * Update 32-Bit Offset * Fixed detection of address * support old offsets * update playback offsets for latest Spotify version * version 1.1.15 --------- Co-authored-by: LabyStudio <[email protected]>
1 parent 322dd42 commit 134188d

File tree

3 files changed

+17
-11
lines changed

3 files changed

+17
-11
lines changed

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ plugins {
44
}
55

66
group 'de.labystudio'
7-
version '1.1.14'
7+
version '1.1.15'
88

99
compileJava {
1010
sourceCompatibility = '1.8'

src/main/java/de/labystudio/spotifyapi/platform/windows/api/playback/MemoryPlaybackAccessor.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,10 @@ public MemoryPlaybackAccessor(WinProcess process, long address) {
2929
this.process = process;
3030

3131
// Create pointer registry to calculate the absolute addresses using the relative offsets
32-
this.pointerRegistry = new PointerRegistry(0x0CFF4498, address);
33-
this.pointerRegistry.register("position", 0x0CFF4810);
34-
this.pointerRegistry.register("length", 0x0CFF4820);
35-
this.pointerRegistry.register("is_playing", 0x0CFF4850); // 1=true, 0=false
32+
this.pointerRegistry = new PointerRegistry(0x0AD59F08, address);
33+
this.pointerRegistry.register("position", 0x0AD5A290);
34+
this.pointerRegistry.register("length", 0x0AD5A2A0);
35+
this.pointerRegistry.register("is_playing", 0x0AD5A2D8); // 1=true, 0=false
3636

3737
this.update();
3838
}

src/main/java/de/labystudio/spotifyapi/platform/windows/api/spotify/SpotifyProcess.java

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,10 @@ public class SpotifyProcess extends WinProcess {
1818
// Spotify track id
1919
private static final String PREFIX_SPOTIFY_TRACK = "spotify:track:";
2020
private static final long[] OFFSETS_TRACK_ID = {
21-
0x1499F0, // Vanilla
22-
0xFEFE8 // Scoop
21+
0x14C9F0, // 64-Bit
22+
0x102178, // 32-Bit
23+
0x1499F0, // 64-Bit (Old)
24+
0xFEFE8 // 32-Bit (Old)
2325
};
2426

2527
private final long addressTrackId;
@@ -62,10 +64,14 @@ private long findTrackIdAddress() {
6264
long addressTrackId = -1;
6365
for (long trackIdOffset : OFFSETS_TRACK_ID) {
6466
addressTrackId = chromeElfAddress + trackIdOffset;
65-
if (addressTrackId == -1 || !this.isTrackIdValid(this.readTrackId(addressTrackId))) {
66-
throw new IllegalStateException("Could not find track id in memory");
67+
if (addressTrackId != -1 && this.isTrackIdValid(this.readTrackId(addressTrackId))) {
68+
// If the offset works, exit the loop
69+
break;
6770
}
68-
break;
71+
}
72+
73+
if (addressTrackId == -1) {
74+
throw new IllegalStateException("Could not find track id in memory");
6975
}
7076

7177
if (DEBUG) {
@@ -175,4 +181,4 @@ public boolean isTrackIdValid(String trackId) {
175181
}
176182
return true;
177183
}
178-
}
184+
}

0 commit comments

Comments
 (0)