Skip to content

Commit c1bd5b4

Browse files
committed
use another way to find the chrome_elf.dll module, version 1.1.5
1 parent 62f1a46 commit c1bd5b4

File tree

3 files changed

+5
-9
lines changed

3 files changed

+5
-9
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ repositories {
2323
}
2424
2525
dependencies {
26-
implementation 'com.github.LabyStudio:java-spotify-api:1.1.4:all'
26+
implementation 'com.github.LabyStudio:java-spotify-api:1.1.5:all'
2727
}
2828
```
2929

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.4'
7+
version '1.1.5'
88

99
compileJava {
1010
sourceCompatibility = '1.8'

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

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,8 @@ public class SpotifyProcess extends WinProcess {
1313
private static final boolean DEBUG = System.getProperty("SPOTIFY_API_DEBUG") != null;
1414

1515
// Spotify track id
16-
private static final String CHROME_ELF_DLL = "chrome_elf.dll";
16+
private static final String CHROME_ELF_DLL_FUNCTION = "DumpHungProcessWithPtype_ExportThunk";
1717
private static final String PREFIX_SPOTIFY_TRACK = "spotify:track:";
18-
private static final long OFFSET_CHROME_ELF_2 = 4871;
19-
private static final long OFFSET_TRACK_ID = 105700;
2018

2119
// Spotify playback
2220
private static final byte[] PREFIX_CONTEXT = new byte[]{0x63, 0x6F, 0x6E, 0x74, 0x65, 0x78, 0x74};
@@ -44,10 +42,8 @@ public SpotifyProcess() {
4442
long timeScanStart = System.currentTimeMillis();
4543

4644
// Find address of track id (Located in the chrome_elf.dll module)
47-
this.addressTrackId = this.findAddressUsingRules(new SearchRule(CHROME_ELF_DLL, (address, index)
48-
-> this.hasText(address + OFFSET_CHROME_ELF_2, CHROME_ELF_DLL)
49-
&& this.hasText(address + OFFSET_TRACK_ID, PREFIX_SPOTIFY_TRACK)
50-
)) + OFFSET_TRACK_ID;
45+
long chromeElfAddress = this.findAddressOfText(0, CHROME_ELF_DLL_FUNCTION, 1);
46+
this.addressTrackId = this.findAddressOfText(chromeElfAddress, PREFIX_SPOTIFY_TRACK, 0);
5147

5248
if (this.addressTrackId == -1 || !this.isTrackIdValid(this.getTrackId())) {
5349
throw new IllegalStateException("Could not find track id in memory");

0 commit comments

Comments
 (0)