diff --git a/packages/webamp-modern/src/maki/__tests__/--Orion--.wal b/packages/webamp-modern/src/maki/__tests__/--Orion--.wal new file mode 100644 index 00000000..71d1a92f Binary files /dev/null and b/packages/webamp-modern/src/maki/__tests__/--Orion--.wal differ diff --git a/packages/webamp-modern/src/maki/__tests__/--Suicide_Commando_1--.wal b/packages/webamp-modern/src/maki/__tests__/--Suicide_Commando_1--.wal new file mode 100644 index 00000000..6cd2c19e Binary files /dev/null and b/packages/webamp-modern/src/maki/__tests__/--Suicide_Commando_1--.wal differ diff --git a/packages/webamp-modern/src/maki/__tests__/--Suicide_Commando_2--.wal b/packages/webamp-modern/src/maki/__tests__/--Suicide_Commando_2--.wal new file mode 100644 index 00000000..ea849e3b Binary files /dev/null and b/packages/webamp-modern/src/maki/__tests__/--Suicide_Commando_2--.wal differ diff --git a/packages/webamp-modern/src/maki/__tests__/--Suicide_Commando_3--.wal b/packages/webamp-modern/src/maki/__tests__/--Suicide_Commando_3--.wal new file mode 100644 index 00000000..2874351b Binary files /dev/null and b/packages/webamp-modern/src/maki/__tests__/--Suicide_Commando_3--.wal differ diff --git a/packages/webamp-modern/src/maki/__tests__/--Vortex--.wal b/packages/webamp-modern/src/maki/__tests__/--Vortex--.wal new file mode 100644 index 00000000..4157e6c1 Binary files /dev/null and b/packages/webamp-modern/src/maki/__tests__/--Vortex--.wal differ diff --git a/packages/webamp-modern/src/maki/__tests__/-Flo-.wal b/packages/webamp-modern/src/maki/__tests__/-Flo-.wal new file mode 100644 index 00000000..d0022995 Binary files /dev/null and b/packages/webamp-modern/src/maki/__tests__/-Flo-.wal differ diff --git a/packages/webamp-modern/src/maki/__tests__/-Graviton-.wal b/packages/webamp-modern/src/maki/__tests__/-Graviton-.wal new file mode 100644 index 00000000..04d76868 Binary files /dev/null and b/packages/webamp-modern/src/maki/__tests__/-Graviton-.wal differ diff --git a/packages/webamp-modern/src/maki/__tests__/-I-M-S-72-.wal b/packages/webamp-modern/src/maki/__tests__/-I-M-S-72-.wal new file mode 100644 index 00000000..4368b640 Binary files /dev/null and b/packages/webamp-modern/src/maki/__tests__/-I-M-S-72-.wal differ diff --git a/packages/webamp-modern/src/maki/__tests__/-Lithium-.wal b/packages/webamp-modern/src/maki/__tests__/-Lithium-.wal new file mode 100644 index 00000000..0b83fa2a Binary files /dev/null and b/packages/webamp-modern/src/maki/__tests__/-Lithium-.wal differ diff --git a/packages/webamp-modern/src/maki/__tests__/-MfS3-.wal b/packages/webamp-modern/src/maki/__tests__/-MfS3-.wal new file mode 100644 index 00000000..04d4e2f0 Binary files /dev/null and b/packages/webamp-modern/src/maki/__tests__/-MfS3-.wal differ diff --git a/packages/webamp-modern/src/maki/__tests__/-Orbis-.wal b/packages/webamp-modern/src/maki/__tests__/-Orbis-.wal new file mode 100644 index 00000000..52b042d2 Binary files /dev/null and b/packages/webamp-modern/src/maki/__tests__/-Orbis-.wal differ diff --git a/packages/webamp-modern/src/maki/__tests__/-Sonara-.wal b/packages/webamp-modern/src/maki/__tests__/-Sonara-.wal new file mode 100644 index 00000000..2f6f2b39 Binary files /dev/null and b/packages/webamp-modern/src/maki/__tests__/-Sonara-.wal differ diff --git a/packages/webamp-modern/src/maki/__tests__/-Soundwave-.wal b/packages/webamp-modern/src/maki/__tests__/-Soundwave-.wal new file mode 100644 index 00000000..2209f367 Binary files /dev/null and b/packages/webamp-modern/src/maki/__tests__/-Soundwave-.wal differ diff --git a/packages/webamp-modern/src/maki/__tests__/MockSystem.ts b/packages/webamp-modern/src/maki/__tests__/MockSystem.ts index d3550426..2eff7436 100644 --- a/packages/webamp-modern/src/maki/__tests__/MockSystem.ts +++ b/packages/webamp-modern/src/maki/__tests__/MockSystem.ts @@ -47,6 +47,9 @@ class MockGroup { } return this.list; } + islayout() { + return true; + } } class MockGuiList { diff --git a/packages/webamp-modern/src/maki/__tests__/actioninfo.maki b/packages/webamp-modern/src/maki/__tests__/actioninfo.maki new file mode 100644 index 00000000..da61fe7b Binary files /dev/null and b/packages/webamp-modern/src/maki/__tests__/actioninfo.maki differ diff --git a/packages/webamp-modern/src/maki/__tests__/actioninfo2.maki b/packages/webamp-modern/src/maki/__tests__/actioninfo2.maki new file mode 100644 index 00000000..2e22ba41 Binary files /dev/null and b/packages/webamp-modern/src/maki/__tests__/actioninfo2.maki differ diff --git a/packages/webamp-modern/src/maki/__tests__/download.sh b/packages/webamp-modern/src/maki/__tests__/download.sh new file mode 100755 index 00000000..88fe98dd --- /dev/null +++ b/packages/webamp-modern/src/maki/__tests__/download.sh @@ -0,0 +1,50 @@ +#!/bin/bash + +# Define your JSON file here +JSON_FILE="modern_skins.json" + +# Define extraction directories +TEMP_DIR="temp_maki" +FINAL_DIR="extracted_maki" + +mkdir -p $TEMP_DIR +mkdir -p $FINAL_DIR + +# Function to download a file and extract .maki files +process_url() { + json_node=$(echo "${1}" | base64 --decode) + + url=$(echo "${json_node}" | jq -r '.download_url') + file=$(echo "${json_node}" | jq -r '.filename') + + echo "Downloading $url..." + # Use wget to download the file + wget -O $file $url + + echo "Extracting .maki files from $file..." + # Use unzip to extract .maki files to a temporary directory + unzip -j -o $file "*.maki" -d $TEMP_DIR + + # Extract the MD5 hash from the download URL + skin_md5_hash=$(basename $url | cut -d '.' -f1) + + # Move the files from temporary directory to the final directory with unique names + for extracted_file in $TEMP_DIR/*.maki; do + base_file=$(basename "$extracted_file") + file_md5_hash=$(md5sum "$extracted_file" | awk '{ print $1 }') + mv "$extracted_file" "$FINAL_DIR/${base_file%.*}_${skin_md5_hash}_${file_md5_hash}.maki" + done + + # Remove the downloaded zip file + rm $file + rm -r $TEMP_DIR +} + +export -f process_url +export TEMP_DIR +export FINAL_DIR + +# Run the function in parallel +jq -r '.data.modern_skins.nodes[] | @base64' $JSON_FILE | parallel -j 10 process_url + +echo "Download and extraction completed." \ No newline at end of file diff --git a/packages/webamp-modern/src/maki/__tests__/fixtures/.wal b/packages/webamp-modern/src/maki/__tests__/fixtures/.wal new file mode 100644 index 00000000..88cd121c Binary files /dev/null and b/packages/webamp-modern/src/maki/__tests__/fixtures/.wal differ diff --git a/packages/webamp-modern/src/maki/__tests__/fixtures/TestBedSkin.wal b/packages/webamp-modern/src/maki/__tests__/fixtures/TestBedSkin.wal new file mode 100644 index 00000000..9888b3a7 Binary files /dev/null and b/packages/webamp-modern/src/maki/__tests__/fixtures/TestBedSkin.wal differ diff --git a/packages/webamp-modern/src/maki/__tests__/fixtures/TestBedSkin/scripts/assertions.m b/packages/webamp-modern/src/maki/__tests__/fixtures/TestBedSkin/scripts/assertions.m index d47e48b4..fb9314ef 100755 --- a/packages/webamp-modern/src/maki/__tests__/fixtures/TestBedSkin/scripts/assertions.m +++ b/packages/webamp-modern/src/maki/__tests__/fixtures/TestBedSkin/scripts/assertions.m @@ -1,5 +1,7 @@ #include "lib/std.mi" // To compile in VM: +// Navitage to the directory containing this file; +// Z:\projects\webamp\packages\webamp-modern\src\maki\__tests__\fixtures\TestBedSkin\scripts // From within this directoy (so the compiled .maki file ends up here) // & '..\..\..\..\..\..\..\webamp-modern\resources\maki_compiler\v1.2.0 (Winamp 5.66)\mc.exe' .\assertions.m @@ -35,4 +37,85 @@ System.onScriptLoaded() assert(3 / 2 == 1.5, "3 / 2 == 1.5", "Division of two integers results in a float"); assert(1 + 1.5 == 2.5, "1 + 1.5 == 2.5", "Summing an integer and a float results in a float"); assert(1.5 + 1 == 2.5, "1.5 + 1 == 2.5", "Summing a float and an integer results in a float"); + assert("Hello" + " world" == "Hello world", "String concatenation", "String concatenation works"); + assert(1024 << 2 == 4096, "1024 << 2 == 4096", "Left shift works"); + assert(1024 >> 2 == 256, "1024 >> 2 == 256", "Right shift works"); + assert(-5 == -5, "-5 == -5", "Unary negative"); + + Int incrementMe = 5; + assert(incrementMe++ == 5, "5++ == 5", "Postfix increment works"); + incrementMe = 5; + assert((incrementMe += 1) == 6, "(incrementMe += 1) == 6", "Plus equals works"); + + incrementMe = 5; + assert((incrementMe -= 1) == 4, "(incrementMe -= 1) == 4", "Minus equals works"); + + incrementMe = 5; + assert((incrementMe /= 2) == 2.5, "(incrementMe /= 2) == 2.5", "Divide equals works"); + assert(incrementMe == 2.5, "(incrementMe /= 2) == 2.5", "Divide equals works"); + + incrementMe = 5; + assert(++incrementMe == 6, "++5 == 6", "Prefix increment works"); + + + // An opcode exists for this, but the compiler chokes on it. + // assert(~5 == -6, "~5 == -6", "Bitwise negation works"); + + // Assignment + Int x = 10; + Int y = x; + assert(x == y, "x == y", "Assignment works"); + Int z = x = 100; + assert(z == 100, "z == 10", "Assignment returns a value"); + assert(x == 100, "x == 10", "Assignment returns a value"); + + // Mov semantics + + // Maybe primitivs go on the stack as values, and objects go on the stack as pointers? + + // 1 + // "Hello" + // <-- Some object? + + // Move would not make sense on primitives? + + + // If pushing an object onto the stack just pushes a pointer (variables table offset) then, to mov + // woud look like: + + // mov 1, 2 + + // What if the values on the stack are all offsets into to variables + // but the value in the variables table is actualy a pointer to the heap? + + // In that case, a mov is saying lookup the pointer in variable 1 and set it + // as the pointer in variable 2 + + // For primitives, it could copy the actual values not pointers + + + Group myGroup = System.getScriptGroup(); + Group myOtherGroup = myGroup; + + assert(myGroup.isLayout() == true, "myGroup.isLayout() == true", "isLayout works on original value"); + assert(myOtherGroup.isLayout() == true, "myOtherGroup.isLayout() == true", "isLayout works on moved value"); + + // Question to answer: Are there such things as primitives which like + // exclusively on the stack and never get assigned into the variables table? + + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10; + + Int a = 12345; + a++; + + // I believe the stack can be thought of as consisting of offsets into the + // variables table. Every value that exists in maki has a place in the + // variables table, including primitives and values not assigned to + // variables. + + Double b = 12345.0; + + Int c = 155 + 255; + + Boolean x = new Group.isLayout(); } \ No newline at end of file diff --git a/packages/webamp-modern/src/maki/__tests__/fixtures/TestBedSkin/scripts/assertions.maki b/packages/webamp-modern/src/maki/__tests__/fixtures/TestBedSkin/scripts/assertions.maki index cb99489d..668075f6 100644 Binary files a/packages/webamp-modern/src/maki/__tests__/fixtures/TestBedSkin/scripts/assertions.maki and b/packages/webamp-modern/src/maki/__tests__/fixtures/TestBedSkin/scripts/assertions.maki differ diff --git a/packages/webamp-modern/src/maki/__tests__/fixtures/TestBedSkin/scripts/debug.maki b/packages/webamp-modern/src/maki/__tests__/fixtures/TestBedSkin/scripts/debug.maki new file mode 100644 index 00000000..92d78d41 Binary files /dev/null and b/packages/webamp-modern/src/maki/__tests__/fixtures/TestBedSkin/scripts/debug.maki differ diff --git a/packages/webamp-modern/src/maki/__tests__/fixtures/TestBedSkin/scripts/debug/debug-debug-with-comments.maki b/packages/webamp-modern/src/maki/__tests__/fixtures/TestBedSkin/scripts/debug/debug-debug-with-comments.maki new file mode 100644 index 00000000..4fd48c25 Binary files /dev/null and b/packages/webamp-modern/src/maki/__tests__/fixtures/TestBedSkin/scripts/debug/debug-debug-with-comments.maki differ diff --git a/packages/webamp-modern/src/maki/__tests__/fixtures/TestBedSkin/scripts/debug/debug-debug-with-indent.maki b/packages/webamp-modern/src/maki/__tests__/fixtures/TestBedSkin/scripts/debug/debug-debug-with-indent.maki new file mode 100644 index 00000000..19f1680a Binary files /dev/null and b/packages/webamp-modern/src/maki/__tests__/fixtures/TestBedSkin/scripts/debug/debug-debug-with-indent.maki differ diff --git a/packages/webamp-modern/src/maki/__tests__/fixtures/TestBedSkin/scripts/debug/debug-debug-with-moved-on-script-loaded.maki b/packages/webamp-modern/src/maki/__tests__/fixtures/TestBedSkin/scripts/debug/debug-debug-with-moved-on-script-loaded.maki new file mode 100644 index 00000000..87b9da74 Binary files /dev/null and b/packages/webamp-modern/src/maki/__tests__/fixtures/TestBedSkin/scripts/debug/debug-debug-with-moved-on-script-loaded.maki differ diff --git a/packages/webamp-modern/src/maki/__tests__/fixtures/TestBedSkin/scripts/debug/debug-debug.maki b/packages/webamp-modern/src/maki/__tests__/fixtures/TestBedSkin/scripts/debug/debug-debug.maki new file mode 100644 index 00000000..19f1680a Binary files /dev/null and b/packages/webamp-modern/src/maki/__tests__/fixtures/TestBedSkin/scripts/debug/debug-debug.maki differ diff --git a/packages/webamp-modern/src/maki/__tests__/fixtures/TestBedSkin/scripts/debug/debug.m b/packages/webamp-modern/src/maki/__tests__/fixtures/TestBedSkin/scripts/debug/debug.m new file mode 100644 index 00000000..5d1e38c5 --- /dev/null +++ b/packages/webamp-modern/src/maki/__tests__/fixtures/TestBedSkin/scripts/debug/debug.m @@ -0,0 +1,6 @@ +#include "lib/std.mi" + +System.onScriptLoaded() +{ + Int c = 155 + 255; +} \ No newline at end of file diff --git a/packages/webamp-modern/src/maki/__tests__/fixtures/TestBedSkin/scripts/debug/debug.maki b/packages/webamp-modern/src/maki/__tests__/fixtures/TestBedSkin/scripts/debug/debug.maki new file mode 100644 index 00000000..19f1680a Binary files /dev/null and b/packages/webamp-modern/src/maki/__tests__/fixtures/TestBedSkin/scripts/debug/debug.maki differ diff --git a/packages/webamp-modern/src/maki/__tests__/fixtures/TestBedSkin/scripts/debug/debug.sym b/packages/webamp-modern/src/maki/__tests__/fixtures/TestBedSkin/scripts/debug/debug.sym new file mode 100644 index 00000000..fa4f36d3 --- /dev/null +++ b/packages/webamp-modern/src/maki/__tests__/fixtures/TestBedSkin/scripts/debug/debug.sym @@ -0,0 +1,35 @@ +-- Variables Table --------------------------------------------------- +var# | Class | What +---------------------------------------------------------------------- +0000 | System | System* +0001 | Int | NULL +0002 | Int | __deprecated_runtime +0003 | Double | v +0004 | Int | 2 +0005 | Int | 65535 +0006 | Int | 1 +0007 | String | "runtimecheck" +0008 | Int | 0 +0009 | Int | last +000A | Int | now +000B | Int | 5000 +000C | String | "This script requires " +000D | String | "Winamp 5.66 (skin version 1.36)" +000E | String | "Error" +000F | String | "" +0010 | String | s +0011 | String | "DEBUG" +0012 | Int | s +0013 | Int | 155 +0014 | Int | 255 +0015 | Int | c +-- Events Table ------------------------------------------------------ +var# | Code Pointer | What +---------------------------------------------------------------------- +0000 | 0153 | S.o +-- User Functions Table ---------------------------------------------- + Code Pointer | What +---------------------------------------------------------------------- + 0000 | versionCheck + 00F2 | debug + 011D | debugInt diff --git a/packages/webamp-modern/src/maki/__tests__/fixtures/TestBedSkin/scripts/debug/lib/std.mi b/packages/webamp-modern/src/maki/__tests__/fixtures/TestBedSkin/scripts/debug/lib/std.mi new file mode 100644 index 00000000..352e0a2f --- /dev/null +++ b/packages/webamp-modern/src/maki/__tests__/fixtures/TestBedSkin/scripts/debug/lib/std.mi @@ -0,0 +1,2777 @@ +//---------------------------------------------------------------------------------------------------------------- +// std.mi +// +// standard definitions for internal objects +//---------------------------------------------------------------------------------------------------------------- + +#ifndef __STD_MI +#define __STD_MI + +#define MC_TARGET "Winamp 5.66 (skin version 1.36)" +#define VCPU_VERSION 2 + +#define deprecated // + +// GUIDS +extern class @{51654971-0D87-4a51-91E3-A6B53235F3E7}@ @{00000000-0000-0000-0000-000000000000}@ Object; +extern class @{D6F50F64-93FA-49b7-93F1-BA66EFAE3E98}@ Object _predecl System; +extern class @{E90DC47B-840D-4ae7-B02C-040BD275F7FC}@ Object Container; +deprecated extern class @{00C074A0-FEA2-49a0-BE8D-FABBDB161640}@ Object Wac; +extern class @{B2023AB5-434D-4ba1-BEAE-59637503F3C6}@ Object &List; +extern class @{87C65778-E743-49fe-85F9-09CC532AFD56}@ Object &BitList; +extern class @{38603665-461B-42a7-AA75-D83F6667BF73}@ Object ⤅ +extern class @{F4787AF4-B2BB-4ef7-9CFB-E74BA9BEA88D}@ Object &PopupMenu; +extern class @{3A370C02-3CBF-439f-84F1-86885BCF1E36}@ Object &Region; +extern class @{5D0C5BB6-7DE1-4b1f-A70F-8D1659941941}@ Object &Timer; +deprecated extern class @{A5376FA1-4E94-411a-83F6-05EC5EEA5F0A}@ Object &FeedWatcher; +extern class @{4EE3E199-C636-4bec-97CD-78BC9C8628B0}@ Object &GuiObject; +extern class @{45BE95E5-2072-4191-935C-BB5FF9F117FD}@ GuiObject &Group; +extern class @{60906D4E-537E-482e-B004-CC9461885672}@ Group &Layout; +extern class @{403ABCC0-6F22-4bd6-8BA4-10C829932547}@ GuiObject &WindowHolder; +extern class @{97AA3E4D-F4D0-4fa8-817B-0AF22A454983}@ GuiObject &ComponentBucket; +extern class @{64E4BBFA-81F4-49d9-B0C0-A85B2EC3BCFD}@ GuiObject &Edit; +extern class @{62B65E3F-375E-408d-8DEA-76814AB91B77}@ GuiObject &Slider; +extern class @{CE4F97BE-77B0-4e19-9956-D49833C96C27}@ GuiObject &Vis; +extern class @{A8C2200D-51EB-4b2a-BA7F-5D4BC65D4C71}@ GuiObject &Browser; +extern class @{8D1EBA38-489E-483e-B960-8D1F43C5C405}@ GuiObject &EqVis; +extern class @{0F08C940-AF39-4b23-80F3-B8C48F7EBB59}@ GuiObject &Status; +extern class @{EFAA8672-310E-41fa-B7DC-85A9525BCB4B}@ GuiObject &Text; +extern class @{7DFD3244-3751-4e7c-BF40-82AE5F3ADC33}@ GuiObject &Title; +extern class @{5AB9FA15-9A7D-4557-ABC8-6557A6C67CA9}@ GuiObject &Layer; +extern class @{698EDDCD-8F1E-4fec-9B12-F944F909FF45}@ GuiObject &Button; +extern class @{6B64CD27-5A26-4c4b-8C59-E6A70CF6493A}@ Layer &AnimatedLayer; +extern class @{6DCB05E4-8AC4-48c2-B193-49F0910EF54A}@ Layer &AlbumArtLayer; +extern class @{B4DCCFFF-81FE-4bcc-961B-720FD5BE0FFF}@ Button &ToggleButton; +extern class @{01E28CE1-B059-11d5-979F-E4DE6F51760A}@ GuiObject &GroupList; +extern class @{80F0F8BD-1BA5-42a6-A093-3236A00C8D4A}@ Group &CfgGroup; +deprecated extern class @{CDCB785D-81F2-4253-8F05-61B872283CFA}@ GuiObject &QueryList; +extern class @{9B2E341B-6C98-40fa-8B85-0C1B6EE89405}@ GuiObject &MouseRedir; +extern class @{36D59B71-03FD-4af8-9795-0502B7DB267A}@ GuiObject &DropDownList; +extern class @{7FD5F210-ACC4-48df-A6A0-5451576CDC76}@ GuiObject &LayoutStatus; +extern class @{B5BAA535-05B3-4dcb-ADC1-E618D28F6896}@ GuiObject &TabSheet; +extern class @{6129FEC1-DAB7-4d51-9165-01CA0C1B70DB}@ GuiObject &GuiList; +extern class @{D59514F7-ED36-45e8-980F-3F4EA0522CD9}@ GuiObject &GuiTree; +extern class @{9B3B4B82-667A-420e-8FFC-794115809C02}@ Object &TreeItem; +deprecated extern class @{1D8631C8-80D0-4792-9F98-BD5D36B49136}@ GuiObject &MenuButton; +extern class @{C7ED3199-5319-4798-9863-60B15A298CAA}@ GuiObject &CheckBox; +deprecated extern class @{2D2D1376-BE0A-4CB9-BC0C-57E6E4C999F5}@ GuiObject &Form; +extern class @{E2BBC14D-84F6-4173-BDB3-B2EB2F665550}@ GuiObject &Frame; // Winamp 5.5 +extern class @{73C00594-961F-401B-9B1B-672427AC4165}@ GuiObject &Menu; // Winamp 5.52 + +deprecated define Component WindowHolder + +#ifndef true +#define true 1 +#endif +#ifndef TRUE +#define TRUE 1 +#endif +#ifndef false +#define false 0 +#endif +#ifndef FALSE +#define FALSE 0 +#endif + +// class tree member functions & events + +//***************************************************************************** +// Object CLASS +//***************************************************************************** +/** + Object Class. + + @short This is the base class from which all other classes inherit. + @author Nullsoft Inc. + @ver 1.0 +*/ + +/** + getClassName() + + Returns the class name for the object. + + @ret The class name. +*/ +extern String Object.getClassName(); + +/** + getId() + +*/ +extern String Object.getId(); + +/** + onNotify() + + @ret + @param command + @param param + @param a + @param b +*/ +extern Int Object.onNotify(String command, String param, int a, int b); + +//***************************************************************************** +// System CLASS +//***************************************************************************** +/** + System Class. + + @short The system class are basic system functions accessible to all. + @author Nullsoft Inc. + @ver 1.0 +*/ + +/** + onScriptLoaded() + + Hookable. Event happens when script has just finished being loaded. + No params. +*/ +extern System.onScriptLoaded(); + +/** + onScriptUnloading() + + Hookable. Event happens when script is going to be unloaded. + No params. +*/ +extern System.onScriptUnloading(); + +/** + onQuit() + + Hookable. Event happens when the user quits the application. + No params. +*/ +extern System.onQuit(); + +/** + onSetXuiParam(String param, String value) + + Hookable. Event happens when the script is in a group implementing + an xuiobject and a parameter has not been recognized by the group or + the embedded object. + + No params. +*/ +extern System.onSetXuiParam(String param, String value); + +/** + onKeyDown() + + Hookable. Event happens when the user presses a key on the keyboard. + + @param key The key that was pressed. +*/ +extern System.onKeyDown(String key); + +/** + onAccelerator() + + Hookable. Event happens when the user presses an accelerator key. + + @param action The action to perform (from locales) + @param section The locales section for the accelerator. + @param key The key, ie: "tab", "ctrl+a". +*/ +extern System.onAccelerator(String action, String section, String key); + +/** + onCreateLayout() + + Hookable. Event happens when a layout is created. + + @param _layout The layout that was just created. +*/ +extern System.onCreateLayout(Layout _layout); + +/** + onShowLayout() + + Hookable. Event happens when a layout is about to be shown. + This even only happens if the layout was previously hidden. + + @param _layout The layout that's about to be shown. +*/ +extern System.onShowLayout(Layout _layout); + +/** + onHideLayout() + + Hookable. + + @param _layout The layout that's about to be hidden. +*/ +extern System.onHideLayout(Layout _layout); + +/** + onViewPortChanged() + + Hookable. Event happens when the Windows viewport has changed. + Note: The monitor Winamp is currently on may not be related to + the Windows message which led to generating this event. + + @param width The new viewport width or -1 if not given by the OS. + @param height The new viewport height or -1 if not given by the OS. +*/ +extern System.onViewPortChanged(int width, int height); + +/** + onStop() + + Hookable. Event happens when Winamp3 stops playing a file. + No params. +*/ +extern System.onStop(); + +/** + onPlay() + + Hookable. Event happens when Winamp3 starts playing a file. + No params. +*/ +extern System.onPlay(); + +/** + onPause() + + Hookable. Event happens when Winamp3 pauses playback. + No params. +*/ +extern System.onPause(); + +/** + onResume() + + Hookable. Event happens when Winamp3 resumes playback. + Event only happens when the song was previously set in a paused state. + No params. +*/ +extern System.onResume(); + +/** + onTitleChange() + + Hookable. Event happens when the song title changes. +*/ +extern System.onTitleChange(String newtitle); + +extern System.onTitle2Change(String newtitle2); +extern System.onUrlChange(String url); +extern System.onInfoChange(String info); +extern System.onStatusMsg(String msg); + +/** + onEqBandChanged() + + Hookable. Event happens when an equalizer band changes values. + The bands are numbered from 0 to 9 (0 being 60Hz and 9 being 16kHz) + and their values range from -127 to +127. + + @param band The frequency band that has changed. + @param newvalue The new value of the frequency band. +*/ +extern System.onEqBandChanged(int band, int newvalue); + +/** + onEqPreampChanged() + + Hookable. Event happens when the equalizer pre-amp has changed + values. Range of the value is from -127 to +127. + + @param newvalue The new pre-amp value. +*/ +extern System.onEqPreampChanged(int newvalue); + +/** + onEqChanged() + + Hookable. Event happens when the EQ is switched on or off. + 0 means the EQ was turned off. 1 means it was turned on. + You might want to use true and false to verify this, it's a bit + more elegant. :) + + @param newstatus The new status of the EQ. +*/ +extern System.onEqChanged(int newstatus); + +extern System.onEqFreqChanged(int isiso); //Requires 5.51 + +/** + onVolumeChanged() + + Hookable. Event happens when the volume was changed. + The range of the volume is from 0 to 255. + + @param newvol The new volume value. +*/ +extern System.onVolumeChanged(int newvol); + +/** + onSeek() + + Hookable. Event happens when the user seeks + to a position in the track. + + @param newpos The seekers new position. +*/ +extern System.onSeek(int newpos); + +/** + getContainer() + + @ret The requested container. + @param container_id The containers identifier string. +*/ +extern Container System.getContainer(String container_id); + +/** + newDynamicContainer() + + @ret The new container. + @param container_id The identifier for the container you want to create. +*/ +extern Container System.newDynamicContainer(String container_id); + +/** + newGroup() + + @ret The new group. + @param group_id The identifier for the group you want to create. +*/ +extern Group System.newGroup(String group_id); + +extern Layout System.newGroupAsLayout(String group_id); + +/** + getNumContainers() + + Get the number of containers currently created. + + @ret The number of containers. +*/ +extern Int System.getNumContainers(); + +/** + enumContainer() + + Returns the name of the container associated with it's number. + Use getNumContainers() to fetch the number of containers present. + The containers are numbered from 0 to the value returned by getNumContainers(). + + @ret The name of the specified container. + @param num The container's number for which you want to know the name. +*/ +extern Container System.enumContainer(Int num); + +extern String system.enumEmbedGUID(int num); //TODO + +/** + getWac() + + Gets the reference to the wac identified by the guid sent. + + @ret The requested WAC. + @param wac_guid The WAC's GUID. +*/ +deprecated extern Wac System.getWac(String wac_guid); + +/** + messageBox() + + Creates a message box. + The flag paramater lets you set the style of the message box. + Just use the OR bitwise operator to set the style you want. + Here's a list of the flags you can use: + + MSGBOX_OK Adds an OK button. (1) + MSGBOX_CANCEL Adds a CANCEL button. (2) + MSGBOX_YES Adds a YES button. (4) + MSGBOX_NO Adds a NO button. (8) + MSGBOX_ALL Adds ALL buttons. (16) + MSGBOX_NEXT Adds a NEXT button. (32) + MSGBOX_PREVIOUS Adds a PREVIOUS button. (64) + + Note that the notanymore_id parameter stores the users answer in the + configuration file with the entry name specified by it's value. + + @ret The value of the button that was pressed (example: if OK is pressed, 1 is returned). + @param message The message you want to display. + @param msgtitle The title of the message box. + @param flag The message box style you want. + @param notanymore_id Configuration item name in which to store the users answer. +*/ +extern Int System.messageBox(String message, String msgtitle, Int flag, String notanymore_id); + +/** + getPlayItemString() + + @ret The name of what is playing. +*/ +extern String System.getPlayItemString(); + +/** + getPlayItemLength() + + Get the length of the track currently playing, in milliseconds. + + @ret Length of the track, in seconds. +*/ +extern Int System.getPlayItemLength(); + +/** + getPlayItemMetaDataString() + + Get metadata for the track currently playing. The metadata field names that + are available are the following: + + title + album + artist + albumartist + comment + year + composer + bitrate + srate + stereo + vbr + replaygain_track_gain + replaygain_album_gain + replaygain_track_peak + replaygain_album_peak + gain + genre + track + length + disc + bpm + conductor + key + mood + subtitle + lyricist + ISRC + media + remixer + encoder + publisher + tool + pregap + postgap + numsamples + + + @ret The requested metadata. + @param metadataname The name of the metadata field you want to read. +*/ +extern String System.getPlayItemMetaDataString(String metadataname); +extern String System.getMetaDataString(String filename, String metadataname); // Requires 5.53 +extern String System.getPlayItemDisplayTitle(); + +extern Int System.getCurrentTrackRating(); //Requires 5.5 +extern System.onCurrentTrackRated(int rating); //Requires 5.5 +extern System.setCurrentTrackRating(int rating); //Requires 5.5 + +/** + getExtFamily() + + This one still return the same as getDecoderName() + + //Gets registered family for given extension (i.e. mp3 -> "Audio") + + @ret The registered family for given extension. + @param ext The extension in question. +*/ +extern String System.getExtFamily(String ext); + +extern String system.getDecoderName(string playitem); + +/** + playFile() + + Play the requested file. Path and filename are required + with proper extension (example: playFile("c:\music\mp3\file.mp3"); ). + It also works with URL's (example: playFile("http://myshoutcast.com:8000"); ). + + @param playitem The path and filename to play. +*/ +extern System.playFile(String playitem); + +extern Int System.getAlbumArt(String playitem); //Requires 5.5 // Will return 1 if an album art has been downloaded, otherwise 0 + +/** + downloadMedia() + + Hookable. Downloads a file from url and saves it as destination_filename. + If destinationPath is "" it will be saved in CD Ripping dir (=getDownloadPath()). + + @param url the file to be downloaded + @param destinationPath the path you want to store the file + @param wantAddToML set true if you wnt to add the file to ML database + @param notifyDownloadsList set true in order to list the download in Object +*/ +extern System.downloadMedia(String url, String destinationPath, boolean wantAddToML, boolean notifyDownloadsList); // Requires 5.54 +deprecated extern System.downloadURL(String url, String destination_filename, String progress_dialog_title); //Requires 5.5 // destination_filename is just a dummy parameter as well as progress_dialog_title - use download() instead + +extern System.onDownloadFinished(String url, boolean success, String filename); // Requires 5.53 +extern String System.getDownloadPath(); // Requires 5.53 // returns the CD Ripping Directory +extern System.setDownloadPath(String new_path); // Requires 5.53 // Sets the CD Ripping Directory + +/** + enqueueFile() + + Enqueque the requested file. Path and filename are required + with proper extension (example: playFile("c:\music\mp3\file.mp3"); ). + It also works with URL's (example: playFile("http://myshoutcast.com:8000"); ). + + @param playitem The path and filename to play. +*/ +extern System.enqueueFile(String playitem); //Requires 5.5 + +/** + getLeftVuMeter() + + Get the value of the left vu meter. + Range is from 0 to 255. Linear. + + @ret The value of the left vu meter. +*/ +extern Int System.getLeftVuMeter(); + +/** + getRightVuMeter() + + Get the value of the right vu meter. + Range is from 0 to 255. Linear. + + @ret The value of the left vu meter. +*/ +extern Int System.getRightVuMeter(); + +/** + getVolume() + + Get the current volume. Range is from 0 to 255. + + @ret The current volume. +*/ +extern Int System.getVolume(); + +/** + setVolume() + + Set the volume to the desired value. + Range is from 0 to 255. + + @param vol The desired volume value. +*/ +extern System.setVolume(Int vol); + +/** + play() + + Trigger the play event. +*/ +extern System.play(); + +/** + stop() + + Trigger the stop event. +*/ +extern System.stop(); + +/** + pause() + + Trigger the pause event. +*/ +extern System.pause(); + +/** + next() + + Trigger the next event. +*/ +extern System.next(); + +/** + previous() + + Trigger the previous event. +*/ +extern System.previous(); + +/** + eject() + + Trigger the eject event. +*/ +extern System.eject(); + +/** + seekTo() + + Seek to the desired position in the track. Range is from + 0 to SONG LENGTH (in milliseconds). +*/ +extern System.seekTo(Int pos); + +/** + getPosition() + + Get the current position in the track currently playing, + in milliseconds. + + @ret The current position in the track. +*/ +extern Int System.getPosition(); + +/** + setEqBand() + + Sets the requested equalizer band to the specified value. + The bands are numbered from 0 (60Hz) to 9 (16kHz) and + each range from -127 to +127. + + @param band The EQ band to set. + @param value The desired value for the specified band. +*/ +extern System.setEqBand(int band, Int value); + +/** + setEqPreamp() + + Set the equalizer pre-amp to the desired value. + Range is from -127 to +127 (0 means no preamp). + + @param value The desired value for the pre-amp. +*/ +extern System.setEqPreamp(Int value); + +/** + Set the equalizer to the desired state. On or off. + 0 is off, 1 is on. + + @param onoff The desired state for the eq. +*/ +extern System.setEq(Int onoff); + +/** + getEqBand() + + Get the value of an equalizer band. The bands + are numbered from 0 (60Hz) to 9 (16kHz). The return + value range is from -127 to +127. + + @ret The value of the band. + @param band The eq band number you want to get. +*/ +extern Int System.getEqBand(int band); + +/** + getEqPreamp() + + Get the equalizer preamp value. The value range is + from -127 to +127 (0 means no preamp). + + @ret The preamp's current value. +*/ +extern int System.getEqPreamp(); + +/** + getEq() + + Get the equalizer state. 0 for off, 1 for on. + Remember to compare return value to true and false. + + @ret The EQ's state. +*/ +extern int System.getEq(); + +/** + getMousePosX() + + This returns the X position of the mouse in the screen, + using the screen coordinate system. + + @ret The mouse's current X pos. +*/ +extern int System.getMousePosX(); + +/** + getMousePosY() + + This returns the Y position of the mouse in the screen, + using the screen coordinate system. + + @ret The mouse's current Y pos. +*/ +extern int System.getMousePosY(); + +/** + integerToString() + + Get the string representation of an integer. + + @ret The string equivalent of the integer. + @param value The integer to change into a string. +*/ +extern String System.integerToString(Int value); + +/** + StringToInteger() + + Get the integer representation of a string. + + @ret The integer equivalent of the string. + @param str The string to change into an integer. +*/ +extern Int System.StringToInteger(String str); + +/** + floatToString() + + Get the string representation of a floating point number. + + @ret The string representation of the float number. + @param value The float to convert. + @param ndigits Number of digits after the decimal point you want. +*/ +extern String System.floatToString(float value, int ndigits); + +/** + stringToFloat() + + Get the floating point representation of a string. + + @ret The float representation of the string. + @param str The string to convert. +*/ +extern Float System.stringToFloat(String str); + +/** + integerToLongTime() + + Convert a time in seconds to a HH:MM:SS value. + + @ret The string representation of the time (HH:MM:SS). + @param value Timestamp to use. +*/ +extern String System.integerToLongTime(Int value); + +/** + integerToTime() + + Convert a time in seconds to a MM:SS value. + + @ret The string representation of the time (MM:SS). + @param value Timestamp to use. +*/ +extern String System.integerToTime(Int value); + +extern String System.dateToTime(Int datetime); // prints the time from a date with the same format as integerToTime +extern String System.dateToLongTime(Int datetime); // prints the time from a date with the same format as integerToLongTime +extern String System.formatDate(Int datetime); // formats the date according to the locales - short date format +extern String System.formatLongDate(Int datetime); // formats the date according to the locales - long date format +extern Int System.getDateYear(Int datetime); // returns the datetime's year since 1900 +extern Int System.getDateMonth(Int datetime); // returns the datetime's month (0-11) +extern Int System.getDateDay(Int datetime); // returns the datetime's day of the month (1-31) +extern Int System.getDateDow(Int datetime); // returns the datetime's day of the week (0-6) +extern Int System.getDateDoy(Int datetime); // returns the datetime's day of the year (0-365) +extern Int System.getDateHour(Int datetime); // returns the datetime's hour (0-23) +extern Int System.getDateMin(Int datetime); // returns the datetime's minutes (0-59) +extern Int System.getDateSec(Int datetime); // returns the datetime's seconds (0-59) +extern Int System.getDateDst(Int datetime); // returns the datetime's daylight savings flag +extern Int System.getDate(); // returns the datetime, use with the above functions + +/** + strmid() + + Get a substring from a string. + + @ret The substring. + @param str The string. + @param start The start position. + @param len The length of the string to extract, from start position. +*/ +extern String System.strmid(String str, Int start, Int len); + +/** + strleft() + + Get a substring from a string, starting from the left. + + @ret The substring. + @param str The string. + @param nchars The length of the string to extract, from the left. +*/ +extern String System.strleft(string str, int nchars); + +/** + strright() + + Get a substring from a string, starting from the right. Since + the start point is the right of the string (or the end). It will + extract the string starting from the END going towards the BEGINNING. + + @ret The substring. + @param str The string. + @param nchars The length of the string to extract, from the right. +*/ +extern string System.strright(string str, int nchars); + +/** + strsearch() + + Search a string for any occurance of substring. If the substring was + found in the string, it will return the position of the substring in + the string searched. If the substring is not found, the return value + is -1. + + @ret Position at which the substring was found. + @param str The string to search in. + @param substr The substring to find. +*/ +extern int System.strsearch(string str, string substr); + +/** + strlen() + + Returns the length of the string. + + @ret The length of the string. + @param str The string. +*/ +extern int System.strlen(string str); + +/** + strupper() + + Convert a string to all uppercase. + + @ret The uppercase string. + @param str The string to uppercase. +*/ +extern string System.strupper(string str); + +/** + strlower() + + Convert a string to all lowercase. + + @ret The lowercase string. + @param str The string to lowercase. +*/ +extern string System.strlower(string str); + +/** + urlEncode() + + URL Encode a string. Characters that are NOT encoded + are: All letters, All digits, underscore (_), dash (-) and + period (.). + + @ret The URL encoded string. + @param url The string to URL encode. +*/ +extern string System.urlEncode(string url); + +extern string System.urlDecode(string url); // Requires 5.54 + +/** + parseATF() + + Pass a string through the ATF parser + + @ret The ATF encoded string. + @param topass The string to ATF encode. +*/ +//extern string System.parseATF(string topass); // To be done + +/** + removePath() + + Remove the path from a full filename. (example: + c:\music\mp3\test.mp3 -> test.mp3) + Also works on URLs. + + @ret The filename with the path removed. + @param str The fullpath of a file. +*/ +extern string System.removePath(string str); + +/** + getPath() + + Gets the path from a full filename. (example: + c:\music\mp3\test.mp3 -> c:\music\mp3) + Also works on URLs. + + @ret The path with the filename removed. + @param str The fullpath of a file. +*/ +extern string System.getPath(string str); + +/** + getExtension() + + Gets the extension from a filename. (example: + c:\music\mp3\test.mp3 -> mp3) + Also works on URLs. + + @ret The extension of the filename. + @param str The fullpath of a file. +*/ +extern string System.getExtension(string str); + +/** + getToken() + + Retreive a token from a list of tokens seperated by separator. + The index starts at 0, not 1, so be careful. + Here's a short example: + getToken("1,2,3,4,5", ",", 3); + Would return, 3. If the token you ask for doesn't exist, an + empty string is returned. + + @ret The token requested. + @param str The tokenenized string. + @param separator The separator to use. + @param tokennum The token to retreive. +*/ +extern string System.getToken(string str, string separator, int tokennum); + +/** + sin() + + Takes an angle in radians and returns the ratio of two sides of a right triangle. + The ratio is the length of the side opposite the angle divided by the length + of the hypotenuse. The result range is from -1 to 1. + + Converting from degrees to radians can be done by multiplying degrees by PI/180. + + @ret The sine value of the angle. + @param value The angle for which you want to know the sine value. +*/ +extern double System.sin(double value); + +/** + cos() + + Takes an angle in radians and returns the ratio of the two sides of a right triangle. + The ratio is the length of the side adjacent to the angle divided by the length of the + hypotenuse. The result is range is from -1 to 1. + + @ret The cosine value of the angle. + @param value The angle for which you want to know the cosine value. +*/ +extern double System.cos(double value); + +/** + tan() + + Takes an angle in radians and returns the ratio between two sides of a right triangle. + The ratio is sin(x) divided by cos(x). + + @ret The tangent value of the angle. + @param value The angle for which you want to know the tangent value. +*/ +extern double System.tan(double value); + +/** + asin() + + Takes a sine value ranging from -1 to 1 and returns the angle in radians. + The return value ranges from -PI/2 to +PI/2. + + @ret The angle in radians. + @param value The sine value for which you want to know the angle. +*/ +extern double System.asin(double value); + +/** + acos() + + Takes a cosine value ranging from -1 to 1 and returns the angle in radians. + The return value ranges from -PI/2 to +PI/2. + + @ret The angle in radians. + @param value The cosine value for which you want to know the angle. +*/ +extern double System.acos(double value); + +/** + atan() + + Takes an angle in radians and returns the ration between two sides of a right triangle. + The ratio is cos(x) divided by sin(x). + + @ret The arc tangent value of the angle. +*/ +extern double System.atan(double value); + +/** + atan2() + + @ret The arctangent of y/x. +*/ +extern double System.atan2(double y, double x); + + +/** + pow() + + Elevate a number to the N'th power. + + @ret The number + @param value The number you want to elevate to the N power. + @param pvalue The power to which you want to elevate the number. +*/ +extern double System.pow(double value, double pvalue); + +/** + sqr() + + Get the square of a number. + + @ret The number, squared. + @param value The number for which you want the square value. +*/ +extern double System.sqr(double value); + +extern double System.log10(double value); +extern double System.ln(double value); + +/** + sqrt() + + Get the square root of a number. + + @ret The square root of the number. + @param value The number for which you want the square root value. +*/ +extern double System.sqrt(double value); + +/** + random() + + Get a randomely generated number. The random number will not + be bigger than the max value indicated. Smallest value is 0. + + @ret The random number. + @param max The maximum value of the random number to return. +*/ +extern int System.random(int max); + +/** + setPrivateString() + + Create a private config entry for your script, of String type. + + @param section The section for the entry. + @param item The item name for the entry. + @param value The value of the entry. +*/ +extern System.setPrivateString(string section, string item, string value); + +/** + setPrivateInt() + + Create a private config entry for your script, of Int type. + + @param section The section for the entry. + @param item The item name for the entry. + @param value The value of the entry. +*/ +extern System.setPrivateInt(string section, string item, int value); + +/** + getPrivateString() + + Read a private config entry of String type. Returns + the specified default value if the section and item isn't + found. + + @ret The value of the config entry. + @param section The section from which to read the entry. + @param item The name of the item to read. + @param defvalue The default value to return if no item is found. +*/ +extern String System.getPrivateString(String section, String item, String defvalue); + +/** + getPrivateInt() + + Read a private config entry of Integer type. Returns + the specified default value if the section and item isn't + found. + + @ret The value of the config entry. + @param section The section from which to read the entry. + @param item The name of the item to read. + @param defvalue The defautl value to return if no item is found. +*/ +extern Int System.getPrivateInt(String section, String item, Int defvalue); + +/** + setPublicString() + + Create a public config entry for your script, of String type. + + @param item The item name for the entry. + @param value The value of the entry. +*/ +extern System.setPublicString(String item, String value); + +/** + setPublicInt() + + Create a public config entry for your script, of Int type. + + @param item The item name of the entry. + @param value The value of the entry. +*/ +extern System.setPublicInt(String item, Int value); + +/** + getPublicString() + + Read a public config entry of String type. Returns + the specified default value if the item isn't found. + + @ret The value of the config entry. + @param item The item name to read. + @param defvalue The default value to return if no item is found. +*/ +extern String System.getPublicString(String item, String defvalue); + +/** + getPublicInt() + + Read a public config entry of Integer type. Returns + the specified default value if the item isn't found. + + @ret The value of the config entry. + @param item The item name to read. + @param defvalue The default value to return if no item is found. +*/ +extern Int System.getPublicInt(String item, Int defvalue); + +/** + getParam() + + Get the parameters with which the script is called. + This is the 'param="..."' attribute in the