Author Topic: Fixing an 18 year and 7 month old Winamp3/wasabi/Winamp5 bug  (Read 2397 times)

Eris Lund

  • Replaced the Modern Skin's song time display through MAKI
  • Moderator
  • Hero Member
  • *****
  • Posts: 169
    • View Profile
    • Eris Lund's Github
Fixing an 18 year and 7 month old Winamp3/wasabi/Winamp5 bug
« on: March 13, 2021, 09:12:46 PM »
Recently I took it upon myself to fix an annoying bug that was introduced and never fixed in Winamp3 (as the title suggests), barely knowing any form of coding I went to work and spent about 2 days reimplementing essentially how Winamp Classic's song time display works, which should be 100% accurate (though there might be some bugs here and there that I haven't spotted yet).

This script does the following:
It appends a leading 0 where appropriate for both "Time remaining" and "Time elapsed", it also contains checks for streams/endless VGM playback where you won't be able to accidentally switch to "Time remaining" (internally it still does, but does not show the respective hyphen when doing so).
In cases of Winamp/WACUP accidentally managing to go beyond the song's length, the timer will still show you the proper time position for both modes, the same applies to input plugins allowing the song to play beyond the actual length (e.g. the OpenMPT plugin offering repeat modes for seamless repeating).

Don't know what I'm talking about?
Below is a screen recording of before applying the fix vs. after.

Before:


After:



While this script was written by someone who just started to get the gist of programming, there are areas of where it can be improved, but it does the job and that's all that matters for now. :)

I hereby invite everyone to take this script and include it in their own projects, in commercial use or not, this is for everyone to use and play with and I don't want any compensation for it.

Enjoy.

Edit: last patch version for a while (would even consider this safe to be included in WACUP)

changes v2.4:
added a menu for the timer to switch between time remaining or elapsed
re-added the progress bar glow that was accidentally deleted (specific to winamp modern)

changes v2.5 (optional update):
the timer now blinks, there are no real big changes and/or bugfixes on the surface, just a lot of under the hood things to minimize the script a bit

Screenrecording of the blinking in action:
« Last Edit: April 23, 2021, 07:39:40 PM by Eris Lund »
I made that one skin that one time.
https://github.com/0x5066/Winamp2000SP4
Current maintainer of the WACUP version of Winamp Modern.
https://github.com/0x5066/WinampModernForked

Aminifu

  • Beta Tester
  • Hero Member
  • *****
  • Posts: 554
    • View Profile
Re: Fixing an 18 and 7 month year old Winamp3/wasabi/Winamp5 bug
« Reply #1 on: March 14, 2021, 05:14:01 AM »
I'm not sure what error you are talking about. I'm able to toggle between time remaining and time elapsed by clicking on the time display. If you are talking about the 1 second discrepancy between the time remaining and time elapsed, then yes that error has existed for a long time.
Windows 10 Home 64-bit v21H1
Logitech Z906 5.1 speaker system

Eris Lund

  • Replaced the Modern Skin's song time display through MAKI
  • Moderator
  • Hero Member
  • *****
  • Posts: 169
    • View Profile
    • Eris Lund's Github
Re: Fixing an 18 and 7 month year old Winamp3/wasabi/Winamp5 bug
« Reply #2 on: March 14, 2021, 04:07:49 PM »
In case it wasn't clear from the beginning what the gifs were supposed to convey:

Before: Winamp Modern's timer will by default always display 00:00, though on playback it'll display 0:00 (basically going from MM:SS to M:SS)

After: I reimplemented (or reverse engineered by accident if you want to be fancy) the behavior of the Classic Skin's timer, where it always displays as MM:SS (Winamp Modern here in this case always shows MM:SS when stopped and when playing) + some other quirks inherited from the Classic Skins
I made that one skin that one time.
https://github.com/0x5066/Winamp2000SP4
Current maintainer of the WACUP version of Winamp Modern.
https://github.com/0x5066/WinampModernForked

ariszlo

  • Moderator
  • Hero Member
  • *****
  • Posts: 129
    • View Profile
Re: Fixing an 18 and 7 month year old Winamp3/wasabi/Winamp5 bug
« Reply #3 on: March 14, 2021, 05:22:45 PM »
Does your fix have anything to do with oldtimer.maki?

Eris Lund

  • Replaced the Modern Skin's song time display through MAKI
  • Moderator
  • Hero Member
  • *****
  • Posts: 169
    • View Profile
    • Eris Lund's Github
Re: Fixing an 18 and 7 month year old Winamp3/wasabi/Winamp5 bug
« Reply #4 on: March 14, 2021, 05:25:09 PM »
Does your fix have anything to do with oldtimer.maki?
This is the first time I've ever heard of this, so no.
I made that one skin that one time.
https://github.com/0x5066/Winamp2000SP4
Current maintainer of the WACUP version of Winamp Modern.
https://github.com/0x5066/WinampModernForked

Aminifu

  • Beta Tester
  • Hero Member
  • *****
  • Posts: 554
    • View Profile
Re: Fixing an 18 and 7 month year old Winamp3/wasabi/Winamp5 bug
« Reply #5 on: March 14, 2021, 10:52:42 PM »
...

Before: Winamp Modern's timer will by default always display 00:00, though on playback it'll display 0:00 (basically going from MM:SS to M:SS)

...

Ok, I now understand. I must admit I totally missed that. :)
Windows 10 Home 64-bit v21H1
Logitech Z906 5.1 speaker system

ariszlo

  • Moderator
  • Hero Member
  • *****
  • Posts: 129
    • View Profile
Re: Fixing an 18 and 7 month year old Winamp3/wasabi/Winamp5 bug
« Reply #6 on: March 15, 2021, 08:58:59 AM »
I wonder whether displaying the elapsed/remaining time with or without a leading 0 is really a bug or a feature.

Eris Lund

  • Replaced the Modern Skin's song time display through MAKI
  • Moderator
  • Hero Member
  • *****
  • Posts: 169
    • View Profile
    • Eris Lund's Github
Re: Fixing an 18 and 7 month year old Winamp3/wasabi/Winamp5 bug
« Reply #7 on: March 15, 2021, 10:58:11 AM »
I think it is more of a bug than it is a feature, because the leading 0 did exist in the Winamp3 betas, as shown below:


What stumps me the most is that it was removed during beta testing or before actual release, and the sheer fact that "timeroffstyle="1"" in Winamp Modern's player-normal-group.xml clearly defaults to the "00:00" display.

Which leads me to question if it was an oversight, or planned at some point to re-add the leading 0 in some unforeseen future

Edit: Upon testing oldtimer.maki, it doesn't seem to handle streamable/endless VGM playback all too well, since you can still click on the display to get the supposed "Time Remaining", however as such songs never end, you'll get this:

Edit 2: Upon testing, then closing WACUP my studio.xnf file has seemingly nuked itself...
« Last Edit: March 15, 2021, 11:06:17 AM by Gordon Freeman »
I made that one skin that one time.
https://github.com/0x5066/Winamp2000SP4
Current maintainer of the WACUP version of Winamp Modern.
https://github.com/0x5066/WinampModernForked

ariszlo

  • Moderator
  • Hero Member
  • *****
  • Posts: 129
    • View Profile
Re: Fixing an 18 year and 7 month old Winamp3/wasabi/Winamp5 bug
« Reply #8 on: March 15, 2021, 02:51:28 PM »
Yes, your wa2songtimer.m handles streams too with this conditional:
if(songlength == 0 || songlength == -1)

It could be simplified to this but it is good as it is:
if(songlength <= 0)

ariszlo

  • Moderator
  • Hero Member
  • *****
  • Posts: 129
    • View Profile
Re: Fixing an 18 and 7 month year old Winamp3/wasabi/Winamp5 bug
« Reply #9 on: March 16, 2021, 12:24:24 AM »
Edit 2: Upon testing, then closing WACUP my studio.xnf file has seemingly nuked itself...

I tried to nuke my studio.xnf with oldtimer.maki but could not. Did you properly adapt it to your skin? You have "display.time" where oldtimer.maki expects "timer". Or perhaps wa2songtimer.maki was not commented out in main-player.xml while you were testing oldtimer.maki.

Edit: Upon testing oldtimer.maki, it doesn't seem to handle streamable/endless VGM playback all too well

It can be easily fixed. See the attachment.

ariszlo

  • Moderator
  • Hero Member
  • *****
  • Posts: 129
    • View Profile
Re: Fixing an 18 year and 7 month old Winamp3/wasabi/Winamp5 bug
« Reply #10 on: March 16, 2021, 08:58:18 AM »
This one handles both main and shade modes. oldtimer.maki should not be used along with wa2songtimer.maki so you should do this while testing it:
  • Comment out this line in main-player.xml:
    <script file="scripts\wa2songtimer.maki"/>
  • Add this line to skin.xml:
    <script file="scripts/oldtimer-wcm.maki"/>
If you add it to main-player.xml, it will not find shade.time, and if you add it to main-player-shade.xml then it will not find display.time. So you need to add it to skin.xml

Eris Lund

  • Replaced the Modern Skin's song time display through MAKI
  • Moderator
  • Hero Member
  • *****
  • Posts: 169
    • View Profile
    • Eris Lund's Github
Re: Fixing an 18 year and 7 month old Winamp3/wasabi/Winamp5 bug
« Reply #11 on: March 16, 2021, 02:00:23 PM »
I will have to admit, this is done better than what my attempt seeks at what it's doing, I will definitely take note of the section in onScriptLoaded that enables the script to be included within the skin.xml file (might as well update my Winamp Modern patch, heh.)
Though, as I was testing and playing some mod files, this happened:

This merely stems from setting the Repeat option in the OpenMPT decoder to either "Once" or "Forever" (as it will always keep the original song's length, for one reason or another dro plz fix), in hindsight there's a lot of cases to cover :)
I made that one skin that one time.
https://github.com/0x5066/Winamp2000SP4
Current maintainer of the WACUP version of Winamp Modern.
https://github.com/0x5066/WinampModernForked

ariszlo

  • Moderator
  • Hero Member
  • *****
  • Posts: 129
    • View Profile
Re: Fixing an 18 year and 7 month old Winamp3/wasabi/Winamp5 bug
« Reply #12 on: March 16, 2021, 02:43:07 PM »
oldtimer is definitely more compact than your script but your script has a visible advantage: it immediately shows the timer when the skin loads at startup, while with oldtimer the skin loads with a blank timer area and there is a visible delay.

Eris Lund

  • Replaced the Modern Skin's song time display through MAKI
  • Moderator
  • Hero Member
  • *****
  • Posts: 169
    • View Profile
    • Eris Lund's Github
Re: Fixing an 18 year and 7 month old Winamp3/wasabi/Winamp5 bug
« Reply #13 on: March 16, 2021, 02:48:51 PM »
Hehe, yeah, the comments to both StaticTime() and StaticTimeRemainder() state the reason as to why (some probably wouldn't notice, but it'd clearly bug me, which is why i took the path i went with)

As long as they run with each playback action then I'm happy :)
I made that one skin that one time.
https://github.com/0x5066/Winamp2000SP4
Current maintainer of the WACUP version of Winamp Modern.
https://github.com/0x5066/WinampModernForked

ariszlo

  • Moderator
  • Hero Member
  • *****
  • Posts: 129
    • View Profile
Re: Fixing an 18 year and 7 month old Winamp3/wasabi/Winamp5 bug
« Reply #14 on: March 30, 2021, 01:17:38 PM »
Just for fun: a user is asking how to get rid of the leading zero: Editing xmls and maki scripts