[GH-ISSUE #246] Music doesn't play through Parabot #5686

Open
opened 2026-05-28 12:20:08 +00:00 by Dark98 · 15 comments
Owner

Originally created by @dginovker on GitHub (Dec 9, 2019).
Original GitHub issue: https://github.com/2006-Scape/2006Scape/issues/246

You're likely going to want to be part of the Parabot slack to fix this, so comment below if you want an invite to that channel.

General instructions for setting up Parabot locally are in the Readme folder. At a high level, you use the hooks file to map classes from Parabot's interface to the client. If the hooks file is wrong, your server won't load up - so we know our hooks file "works", but there might be something else to it.

Parabot doesn't think it's on their end, and the raw .jar's music plays just fine. I don't personally know what's missing, but if anyone does, please share your thoughts.

Originally created by @dginovker on GitHub (Dec 9, 2019). Original GitHub issue: https://github.com/2006-Scape/2006Scape/issues/246 You're likely going to want to be part of the [Parabot slack](https://parabot.slack.com/) to fix this, so comment below if you want an invite to that channel. General instructions for setting up Parabot locally are in the Readme folder. At a high level, you use the hooks file to map classes from Parabot's interface to the client. If the hooks file is wrong, your server won't load up - so we know our hooks file "works", but there might be something else to it. Parabot doesn't think it's on their end, and the raw .jar's music plays just fine. I don't personally know what's missing, but if anyone does, please share your thoughts.
Dark98 added the Difficulty: Hard label 2026-05-28 12:20:08 +00:00
Author
Owner

@JKetelaar commented on GitHub (Dec 9, 2019):

image

<!-- gh-comment-id:563456794 --> @JKetelaar commented on GitHub (Dec 9, 2019): ![image](https://user-images.githubusercontent.com/3681904/70476070-90370780-1a9b-11ea-99c4-95af04fdf1ae.png)
Author
Owner

@JKetelaar commented on GitHub (Dec 9, 2019):

What different do you do from loading music and playing music from a clean 317 client and yours?

<!-- gh-comment-id:563461569 --> @JKetelaar commented on GitHub (Dec 9, 2019): What different do you do from loading music and playing music from a clean 317 client and yours?
Author
Owner

@mrextremez commented on GitHub (Dec 9, 2019):

Pretty sure this is the music system I added, seems that many others have used it as well

https://www.rune-server.ee/runescape-development/rs2-client/snippets/363314-sounds-music.html @JKetelaar

<!-- gh-comment-id:563465954 --> @mrextremez commented on GitHub (Dec 9, 2019): Pretty sure this is the music system I added, seems that many others have used it as well https://www.rune-server.ee/runescape-development/rs2-client/snippets/363314-sounds-music.html @JKetelaar
Author
Owner

@JKetelaar commented on GitHub (Dec 9, 2019):

Can you refer to this within your own code? So I can look through it

<!-- gh-comment-id:563475893 --> @JKetelaar commented on GitHub (Dec 9, 2019): Can you refer to this within your own code? So I can look through it
Author
Owner
<!-- gh-comment-id:563489630 --> @dginovker commented on GitHub (Dec 9, 2019): Client.java change: https://github.com/dginovker/2006rebotted/blob/master/2006Redone%20Client/src/Game.java#L6486 SoundPlayer.java: https://github.com/dginovker/2006rebotted/blob/master/2006Redone%20Client/src/SoundPlayer.java
Author
Owner

@JKetelaar commented on GitHub (Dec 10, 2019):

Does it ever reach #method90?
https://github.com/dginovker/2006rebotted/blob/master/2006Redone%20Client/src/Game.java#L6486

Can you check if the method is being called properly?

<!-- gh-comment-id:563742608 --> @JKetelaar commented on GitHub (Dec 10, 2019): Does it ever reach `#method90`? https://github.com/dginovker/2006rebotted/blob/master/2006Redone%20Client/src/Game.java#L6486 Can you check if the method is being called properly?
Author
Owner

@JKetelaar commented on GitHub (Dec 10, 2019):

And what happens if you run Parabot with -no_sec ?

<!-- gh-comment-id:563745205 --> @JKetelaar commented on GitHub (Dec 10, 2019): And what happens if you run Parabot with `-no_sec `?
Author
Owner

@dginovker commented on GitHub (Dec 10, 2019):

-no_sec fixes it!

Method90 gets called in non-Parabot client (but the same one that feeds in).

What should we do?

<!-- gh-comment-id:563821313 --> @dginovker commented on GitHub (Dec 10, 2019): `-no_sec` fixes it! Method90 gets called in non-Parabot client (but the same one that feeds in). What should we do?
Author
Owner

@JKetelaar commented on GitHub (Dec 10, 2019):

Apparently there is a redirect class that you are using;
https://github.com/Parabot/Parabot/tree/master/src/main/java/org/parabot/core/asm/redirect

It might be SystemRedirect, but you'll have to check this yourself.

You could go disable all redirects in:
https://github.com/Parabot/Parabot/blob/master/src/main/java/org/parabot/core/asm/RedirectClassAdapter.java#L26
And enable them one-by-one to ensure which is causing it, so you can debug further

<!-- gh-comment-id:563885089 --> @JKetelaar commented on GitHub (Dec 10, 2019): Apparently there is a redirect class that you are using; https://github.com/Parabot/Parabot/tree/master/src/main/java/org/parabot/core/asm/redirect It might be SystemRedirect, but you'll have to check this yourself. You could go disable all redirects in: https://github.com/Parabot/Parabot/blob/master/src/main/java/org/parabot/core/asm/RedirectClassAdapter.java#L26 And enable them one-by-one to ensure which is causing it, so you can debug further
Author
Owner

@JKetelaar commented on GitHub (Dec 10, 2019):

You might also want to enable print of stack traces (https://github.com/dginovker/2006rebotted/blob/master/2006Redone%20Client/src/Game.java#L3141), so you know where it's coming from

		} catch (IOException _ex) {
			dropClient();
			_ex.printStackTrace();
		} catch (Exception exception) {
			resetLogout();
			exception.printStackTrace();
		}
<!-- gh-comment-id:563885489 --> @JKetelaar commented on GitHub (Dec 10, 2019): You might also want to enable print of stack traces (https://github.com/dginovker/2006rebotted/blob/master/2006Redone%20Client/src/Game.java#L3141), so you know where it's coming from ``` } catch (IOException _ex) { dropClient(); _ex.printStackTrace(); } catch (Exception exception) { resetLogout(); exception.printStackTrace(); } ```
Author
Owner

@dginovker commented on GitHub (Dec 11, 2019):

The culprit is

redirects.put("java/awt/Toolkit", ToolkitRedirect.class); on line 27.

Disabling that makes it work.

When enabling the 2006rebotted stacktraces and loading it up in the Parabot client (even with -verbose flag), nothing shows up. I'm not sure if those print lines come through the PB client, though.

I checked out the ToolkitRedirect class and I see it's preventing malicious scripts from accessing parts of the host system. Which do you think is causing the problems?

<!-- gh-comment-id:564386044 --> @dginovker commented on GitHub (Dec 11, 2019): The culprit is `redirects.put("java/awt/Toolkit", ToolkitRedirect.class);` on line 27. Disabling that makes it work. When enabling the 2006rebotted stacktraces and loading it up in the Parabot client (even with `-verbose` flag), nothing shows up. I'm not sure if those print lines come through the PB client, though. I checked out the [ToolkitRedirect class](https://github.com/Parabot/Parabot/blob/master/src/main/java/org/parabot/core/asm/redirect/ToolkitRedirect.java) and I see it's preventing malicious scripts from accessing parts of the host system. Which do you think is causing the problems?
Author
Owner

@JKetelaar commented on GitHub (Dec 12, 2019):

So somewhere you are using java.awt.Toolkit and the method either doesn't exist in the ToolkitRedirect class or the method returns an error, because it protects its users

<!-- gh-comment-id:564788405 --> @JKetelaar commented on GitHub (Dec 12, 2019): So somewhere you are using `java.awt.Toolkit` and the method either doesn't exist in the ToolkitRedirect class or the method returns an error, because it protects its users
Author
Owner

@dginovker commented on GitHub (Dec 13, 2019):

So I've gone through the whole Client project and replaced all import java.awt.* with more restrictive imports, and removed all instances of java.awt.Toolkit (with the exception of Sprite.java), but still no music on compile. You can see my branch where I did this here: https://github.com/dginovker/2006rebotted/commit/9efafdff474e62b40bd8dfcf060d17730375ef22

As I was going through it, it didn't seem like anything used the Toolkit either (outside Sprite.java), least of all method90 & SoundPlayer, where the music is playing from.

Is there any way, by modifying the Parabot client perhaps, I could figure out what methods are being blocked?

<!-- gh-comment-id:565532955 --> @dginovker commented on GitHub (Dec 13, 2019): So I've gone through the whole Client project and replaced all `import java.awt.*` with more restrictive imports, and removed all instances of `java.awt.Toolkit` (with the exception of `Sprite.java`), but still no music on compile. You can see my branch where I did this here: https://github.com/dginovker/2006rebotted/commit/9efafdff474e62b40bd8dfcf060d17730375ef22 As I was going through it, it didn't seem like anything used the Toolkit either (outside Sprite.java), least of all method90 & SoundPlayer, where the music is playing from. Is there any way, by modifying the Parabot client perhaps, I could figure out what methods are being blocked?
Author
Owner

@JKetelaar commented on GitHub (Dec 16, 2019):

I am not sure, to be honest. Somewhere you are not printing your stack traces, therefore it causes an error that you cannot see (really bad practice). I would say ensure that every stack trace (everywhere) gets printed, so you can debug this further.

<!-- gh-comment-id:566158000 --> @JKetelaar commented on GitHub (Dec 16, 2019): I am not sure, to be honest. Somewhere you are not printing your stack traces, therefore it causes an error that you cannot see (really bad practice). I would say ensure that every stack trace (everywhere) gets printed, so you can debug this further.
Author
Owner

@JKetelaar commented on GitHub (Dec 16, 2019):

Another option you can do is run Parabot with -dump. This will create a dump of the client with the injected code (in documents/Parabot/dump.jar). Then you can use this dump to see where the ToolKit class gets used for the redirect.

<!-- gh-comment-id:566158263 --> @JKetelaar commented on GitHub (Dec 16, 2019): Another option you can do is run Parabot with `-dump`. This will create a dump of the client with the injected code (in `documents/Parabot/dump.jar`). Then you can use this dump to see where the ToolKit class gets used for the redirect.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: 2006-Scape/2006Scape#5686