Skip to content

Commit

Permalink
Support latest Spotify update (#6)
Browse files Browse the repository at this point in the history
* 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 <labystudio@gmail.com>
  • Loading branch information
PrincessAkira and LabyStudio committed Sep 18, 2023
1 parent 322dd42 commit 134188d
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 11 deletions.
2 changes: 1 addition & 1 deletion build.gradle
Expand Up @@ -4,7 +4,7 @@ plugins {
}

group 'de.labystudio'
version '1.1.14'
version '1.1.15'

compileJava {
sourceCompatibility = '1.8'
Expand Down
Expand Up @@ -29,10 +29,10 @@ public MemoryPlaybackAccessor(WinProcess process, long address) {
this.process = process;

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

this.update();
}
Expand Down
Expand Up @@ -18,8 +18,10 @@ public class SpotifyProcess extends WinProcess {
// Spotify track id
private static final String PREFIX_SPOTIFY_TRACK = "spotify:track:";
private static final long[] OFFSETS_TRACK_ID = {
0x1499F0, // Vanilla
0xFEFE8 // Scoop
0x14C9F0, // 64-Bit
0x102178, // 32-Bit
0x1499F0, // 64-Bit (Old)
0xFEFE8 // 32-Bit (Old)
};

private final long addressTrackId;
Expand Down Expand Up @@ -62,10 +64,14 @@ private long findTrackIdAddress() {
long addressTrackId = -1;
for (long trackIdOffset : OFFSETS_TRACK_ID) {
addressTrackId = chromeElfAddress + trackIdOffset;
if (addressTrackId == -1 || !this.isTrackIdValid(this.readTrackId(addressTrackId))) {
throw new IllegalStateException("Could not find track id in memory");
if (addressTrackId != -1 && this.isTrackIdValid(this.readTrackId(addressTrackId))) {
// If the offset works, exit the loop
break;
}
break;
}

if (addressTrackId == -1) {
throw new IllegalStateException("Could not find track id in memory");
}

if (DEBUG) {
Expand Down Expand Up @@ -175,4 +181,4 @@ public boolean isTrackIdValid(String trackId) {
}
return true;
}
}
}

0 comments on commit 134188d

Please sign in to comment.