Initial community commit
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,16 @@
|
||||
#ifndef NULLSOFT_APIH
|
||||
#define NULLSOFT_APIH
|
||||
|
||||
#include <api/service/api_service.h>
|
||||
#include "../Agave/Language/api_language.h"
|
||||
#include <api/service/waServiceFactory.h>
|
||||
#include <api/syscb/callbacks/browsercb.h>
|
||||
#include <api/syscb/callbacks/syscb.h>
|
||||
#include <api/syscb/api_syscb.h>
|
||||
extern api_syscb *WASABI_API_SYSCB;
|
||||
#define WASABI_API_SYSCB sysCallbackApi
|
||||
#include <api/application/api_application.h>
|
||||
extern api_application *applicationApi;
|
||||
#define WASABI_API_APP applicationApi
|
||||
|
||||
#endif
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,425 @@
|
||||
/*
|
||||
LICENSE
|
||||
-------
|
||||
Copyright 2005-2013 Nullsoft, Inc.
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification,
|
||||
are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright notice,
|
||||
this list of conditions and the following disclaimer.
|
||||
|
||||
* Redistributions in binary form must reproduce the above copyright notice,
|
||||
this list of conditions and the following disclaimer in the documentation
|
||||
and/or other materials provided with the distribution.
|
||||
|
||||
* Neither the name of Nullsoft nor the names of its contributors may be used to
|
||||
endorse or promote products derived from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
|
||||
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||
FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
||||
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
|
||||
IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
|
||||
OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include "api__vis_milk2.h"
|
||||
#include "pluginshell.h"
|
||||
#include "resource.h"
|
||||
#include "utility.h"
|
||||
#include <strsafe.h>
|
||||
|
||||
int g_nFontSize[] = { 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 18, 20, 22, 24, 26, 28, 30, 32,
|
||||
36, 40, 44, 48, 52, 56, 60, 64, 72, 80, 88, 96, 104, 112, 120, 128 };
|
||||
|
||||
int CALLBACK EnumFontsProc(
|
||||
CONST LOGFONT *lplf, // logical-font data
|
||||
CONST TEXTMETRIC *lptm, // physical-font data
|
||||
DWORD dwType, // font type
|
||||
LPARAM lpData // application-defined data
|
||||
)
|
||||
{
|
||||
SendMessage( GetDlgItem( (HWND)lpData, IDC_FONT1), CB_ADDSTRING, 0, (LPARAM)(lplf->lfFaceName));
|
||||
SendMessage( GetDlgItem( (HWND)lpData, IDC_FONT2), CB_ADDSTRING, 0, (LPARAM)(lplf->lfFaceName));
|
||||
SendMessage( GetDlgItem( (HWND)lpData, IDC_FONT3), CB_ADDSTRING, 0, (LPARAM)(lplf->lfFaceName));
|
||||
SendMessage( GetDlgItem( (HWND)lpData, IDC_FONT4), CB_ADDSTRING, 0, (LPARAM)(lplf->lfFaceName));
|
||||
SendMessage( GetDlgItem( (HWND)lpData, IDC_FONT5), CB_ADDSTRING, 0, (LPARAM)(lplf->lfFaceName));
|
||||
SendMessage( GetDlgItem( (HWND)lpData, IDC_FONT6), CB_ADDSTRING, 0, (LPARAM)(lplf->lfFaceName));
|
||||
SendMessage( GetDlgItem( (HWND)lpData, IDC_FONT7), CB_ADDSTRING, 0, (LPARAM)(lplf->lfFaceName));
|
||||
SendMessage( GetDlgItem( (HWND)lpData, IDC_FONT8), CB_ADDSTRING, 0, (LPARAM)(lplf->lfFaceName));
|
||||
SendMessage( GetDlgItem( (HWND)lpData, IDC_FONT9), CB_ADDSTRING, 0, (LPARAM)(lplf->lfFaceName));
|
||||
return 1;
|
||||
}
|
||||
|
||||
void SaveFont2(td_fontinfo *fi, DWORD ctrl1, DWORD ctrl2, DWORD bold_id, DWORD ital_id, DWORD aa_id, HWND hwnd)
|
||||
{
|
||||
HWND fontbox = GetDlgItem( hwnd, ctrl1 );
|
||||
HWND sizebox = GetDlgItem( hwnd, ctrl2 );
|
||||
|
||||
// font face
|
||||
int t = SendMessage( fontbox, CB_GETCURSEL, 0, 0);
|
||||
SendMessageW( fontbox, CB_GETLBTEXT, t, (LPARAM)fi->szFace);
|
||||
|
||||
// font size
|
||||
t = SendMessage( sizebox, CB_GETCURSEL, 0, 0);
|
||||
if (t != CB_ERR)
|
||||
{
|
||||
int nMax = sizeof(g_nFontSize)/sizeof(int);
|
||||
fi->nSize =g_nFontSize[nMax-1 - t];
|
||||
}
|
||||
|
||||
// font options
|
||||
fi->bBold = DlgItemIsChecked(hwnd, bold_id);
|
||||
fi->bItalic = DlgItemIsChecked(hwnd, ital_id);
|
||||
fi->bAntiAliased = DlgItemIsChecked(hwnd, aa_id);
|
||||
}
|
||||
|
||||
void InitFont2(td_fontinfo *fi, DWORD ctrl1, DWORD ctrl2, DWORD bold_id, DWORD ital_id, DWORD aa_id, HWND hwnd, DWORD ctrl4, wchar_t* szFontName)
|
||||
{
|
||||
HWND namebox = ctrl4 ? GetDlgItem( hwnd, ctrl4 ) : 0;
|
||||
HWND fontbox = GetDlgItem( hwnd, ctrl1 );
|
||||
HWND sizebox = GetDlgItem( hwnd, ctrl2 );
|
||||
ShowWindow(fontbox, SW_NORMAL);
|
||||
ShowWindow(sizebox, SW_NORMAL);
|
||||
ShowWindow(GetDlgItem(hwnd,bold_id), SW_NORMAL);
|
||||
ShowWindow(GetDlgItem(hwnd,ital_id), SW_NORMAL);
|
||||
ShowWindow(GetDlgItem(hwnd,aa_id), SW_NORMAL);
|
||||
if (namebox && szFontName && szFontName[0])
|
||||
{
|
||||
ShowWindow(namebox, SW_NORMAL);
|
||||
wchar_t buf[256];
|
||||
StringCbPrintfW(buf, sizeof(buf), L"%s:", szFontName);
|
||||
SetWindowTextW(GetDlgItem(hwnd,ctrl4), buf);
|
||||
}
|
||||
|
||||
// set selection
|
||||
int nPos = SendMessageW( fontbox, CB_FINDSTRINGEXACT, -1, (LPARAM)fi->szFace);
|
||||
if (nPos == CB_ERR)
|
||||
nPos = 0;
|
||||
SendMessage( fontbox, CB_SETCURSEL, nPos, 0);
|
||||
|
||||
//---------font size box-------------------
|
||||
int nSel = 0;
|
||||
int nMax = sizeof(g_nFontSize)/sizeof(int);
|
||||
for (int i=0; i<nMax; i++)
|
||||
{
|
||||
wchar_t buf[256];
|
||||
int s = g_nFontSize[nMax-1 - i];
|
||||
StringCbPrintfW(buf, sizeof(buf), L" %2d ", s);
|
||||
SendMessageW(sizebox, CB_ADDSTRING, i, (LPARAM)buf);
|
||||
if (s == fi->nSize)
|
||||
nSel = i;
|
||||
}
|
||||
SendMessage(sizebox, CB_SETCURSEL, nSel, 0);
|
||||
|
||||
//---------font options box-------------------
|
||||
CheckDlgButton(hwnd, bold_id, fi->bBold);
|
||||
CheckDlgButton(hwnd, ital_id, fi->bItalic);
|
||||
CheckDlgButton(hwnd, aa_id, fi->bAntiAliased);
|
||||
}
|
||||
|
||||
void SCOOT_CONTROL(HWND hwnd, int ctrl_id, int dx, int dy)
|
||||
{
|
||||
RECT r;
|
||||
GetWindowRect(GetDlgItem(hwnd,ctrl_id), &r);
|
||||
ScreenToClient(hwnd, (LPPOINT)&r);
|
||||
SetWindowPos (GetDlgItem(hwnd,ctrl_id), NULL, r.left + dx, r.top + dy, 0, 0, SWP_NOSIZE|SWP_NOZORDER);
|
||||
}
|
||||
|
||||
BOOL CALLBACK CPluginShell::FontDialogProc(HWND hwnd,UINT msg,WPARAM wParam,LPARAM lParam)
|
||||
{
|
||||
if (msg==WM_INITDIALOG && lParam > 0 && GetWindowLongPtr(hwnd,GWLP_USERDATA)==0)
|
||||
SetWindowLongPtr(hwnd, GWLP_USERDATA, lParam);
|
||||
|
||||
CPluginShell* p = (CPluginShell*)GetWindowLongPtr(hwnd,GWLP_USERDATA);
|
||||
|
||||
if (p)
|
||||
return p->PluginShellFontDialogProc(hwnd, msg, wParam, lParam);
|
||||
else
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
BOOL CPluginShell::PluginShellFontDialogProc(HWND hwnd,UINT msg,WPARAM wParam,LPARAM lParam)
|
||||
{
|
||||
#ifdef _DEBUG
|
||||
OutputDebugMessage("FontDlgProc: ", hwnd, msg, wParam, lParam);
|
||||
#endif
|
||||
|
||||
switch (msg)
|
||||
{
|
||||
case WM_DESTROY:
|
||||
return 0;
|
||||
|
||||
case WM_INITDIALOG:
|
||||
{
|
||||
// Initialize all font dialog global variables here:
|
||||
// ...
|
||||
|
||||
HDC hdc = GetDC(hwnd);
|
||||
if (hdc)
|
||||
{
|
||||
EnumFonts(hdc, NULL, &EnumFontsProc, (LPARAM)hwnd);
|
||||
ReleaseDC(hwnd, hdc);
|
||||
}
|
||||
|
||||
#define InitFont(n, m) InitFont2(&m_fontinfo[n-1], IDC_FONT##n, IDC_FONTSIZE##n, IDC_FONTBOLD##n, IDC_FONTITAL##n, IDC_FONTAA##n, hwnd, IDC_FONT_NAME_##n, m)
|
||||
InitFont(1, 0);
|
||||
InitFont(2, 0);
|
||||
InitFont(3, 0);
|
||||
InitFont(4, 0);
|
||||
#if (NUM_EXTRA_FONTS >= 1)
|
||||
InitFont(5, WASABI_API_LNGSTRINGW(IDS_EXTRA_FONT_1_NAME));
|
||||
#endif
|
||||
#if (NUM_EXTRA_FONTS >= 2)
|
||||
InitFont(6, WASABI_API_LNGSTRINGW(IDS_EXTRA_FONT_2_NAME));
|
||||
#endif
|
||||
#if (NUM_EXTRA_FONTS >= 3)
|
||||
InitFont(7, EXTRA_FONT_3_NAME);
|
||||
#endif
|
||||
#if (NUM_EXTRA_FONTS >= 4)
|
||||
InitFont(5, EXTRA_FONT_4_NAME);
|
||||
#endif
|
||||
#if (NUM_EXTRA_FONTS >= 5)
|
||||
InitFont(9, EXTRA_FONT_5_NAME);
|
||||
#endif
|
||||
|
||||
// Finally, if not all extra fonts are in use, shrink the window size, and
|
||||
// move up any controls that were at the bottom:
|
||||
RECT r;
|
||||
GetWindowRect(hwnd, &r);
|
||||
int scoot_factor = 128*(MAX_EXTRA_FONTS-NUM_EXTRA_FONTS)/MAX_EXTRA_FONTS;
|
||||
if (scoot_factor>0)
|
||||
{
|
||||
SetWindowPos(hwnd, NULL, 0, 0, r.right-r.left, r.bottom-r.top - scoot_factor, SWP_NOMOVE|SWP_NOZORDER);
|
||||
SCOOT_CONTROL(hwnd, IDC_FONT_TEXT, 0, -scoot_factor);
|
||||
SCOOT_CONTROL(hwnd, IDOK, 0, -scoot_factor);
|
||||
SCOOT_CONTROL(hwnd, IDCANCEL, 0, -scoot_factor);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case WM_COMMAND:
|
||||
{
|
||||
int id = LOWORD(wParam);
|
||||
switch(id)
|
||||
{
|
||||
case IDOK:
|
||||
|
||||
#define SaveFont(n) SaveFont2(&m_fontinfo[n-1], IDC_FONT##n, IDC_FONTSIZE##n, IDC_FONTBOLD##n, IDC_FONTITAL##n, IDC_FONTAA##n, hwnd)
|
||||
SaveFont(1);
|
||||
SaveFont(2);
|
||||
SaveFont(3);
|
||||
SaveFont(4);
|
||||
#if (NUM_EXTRA_FONTS >= 1)
|
||||
SaveFont(5);
|
||||
#endif
|
||||
#if (NUM_EXTRA_FONTS >= 2)
|
||||
SaveFont(6);
|
||||
#endif
|
||||
#if (NUM_EXTRA_FONTS >= 3)
|
||||
SaveFont(7);
|
||||
#endif
|
||||
#if (NUM_EXTRA_FONTS >= 4)
|
||||
SaveFont(5);
|
||||
#endif
|
||||
#if (NUM_EXTRA_FONTS >= 5)
|
||||
SaveFont(9);
|
||||
#endif
|
||||
|
||||
EndDialog(hwnd,id);
|
||||
break;
|
||||
|
||||
case IDCANCEL:
|
||||
EndDialog(hwnd,id);
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void EnableStuff(HWND hwnd, int bEnable)
|
||||
{
|
||||
EnableWindow(GetDlgItem(hwnd, IDC_CB_BOX), bEnable);
|
||||
EnableWindow(GetDlgItem(hwnd, IDC_CB_MANUAL_SCOOT), bEnable);
|
||||
EnableWindow(GetDlgItem(hwnd, IDC_DM_ALPHA_FIX_CAPTION), bEnable);
|
||||
EnableWindow(GetDlgItem(hwnd, IDC_DM_ALPHA_FIX), bEnable);
|
||||
}
|
||||
|
||||
BOOL CALLBACK CPluginShell::DesktopOptionsDialogProc(HWND hwnd,UINT msg,WPARAM wParam,LPARAM lParam)
|
||||
{
|
||||
if (msg==WM_INITDIALOG && lParam > 0 && GetWindowLongPtr(hwnd,GWLP_USERDATA)==0)
|
||||
SetWindowLongPtr(hwnd, GWLP_USERDATA, lParam);
|
||||
|
||||
CPluginShell* p = (CPluginShell*)GetWindowLongPtr(hwnd,GWLP_USERDATA);
|
||||
|
||||
if (p)
|
||||
return p->PluginShellDesktopOptionsDialogProc(hwnd, msg, wParam, lParam);
|
||||
else
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
BOOL CPluginShell::PluginShellDesktopOptionsDialogProc(HWND hwnd,UINT msg,WPARAM wParam,LPARAM lParam)
|
||||
{
|
||||
#ifdef _DEBUG
|
||||
OutputDebugMessage("DmDlgProc: ", hwnd, msg, wParam, lParam);
|
||||
#endif
|
||||
|
||||
switch (msg)
|
||||
{
|
||||
case WM_DESTROY:
|
||||
return 0;
|
||||
|
||||
case WM_INITDIALOG:
|
||||
{
|
||||
CheckDlgButton(hwnd, IDC_CB_SHOW_ICONS, m_desktop_show_icons );
|
||||
CheckDlgButton(hwnd, IDC_CB_BOX, m_desktop_textlabel_boxes );
|
||||
CheckDlgButton(hwnd, IDC_CB_MANUAL_SCOOT, m_desktop_manual_icon_scoot);
|
||||
|
||||
HWND ctrl = GetDlgItem(hwnd, IDC_DM_ALPHA_FIX);
|
||||
SendMessageW( ctrl, CB_ADDSTRING, 0, (LPARAM)WASABI_API_LNGSTRINGW(IDS_5_6_5_TEXTURE));
|
||||
SendMessageW( ctrl, CB_ADDSTRING, 1, (LPARAM)WASABI_API_LNGSTRINGW(IDS_5_5_5_TEXTURE));
|
||||
SendMessageW( ctrl, CB_ADDSTRING, 2, (LPARAM)WASABI_API_LNGSTRINGW(IDS_8_8_8_TEXTURE));
|
||||
SendMessageW( ctrl, CB_SETCURSEL, m_desktop_555_fix, 0 );
|
||||
|
||||
EnableStuff(hwnd, m_desktop_show_icons);
|
||||
}
|
||||
break;
|
||||
|
||||
case WM_COMMAND:
|
||||
{
|
||||
int id = LOWORD(wParam);
|
||||
switch(id)
|
||||
{
|
||||
case IDC_CB_SHOW_ICONS:
|
||||
m_desktop_show_icons = DlgItemIsChecked(hwnd, IDC_CB_SHOW_ICONS);
|
||||
EnableStuff(hwnd, m_desktop_show_icons);
|
||||
break;
|
||||
|
||||
case IDOK:
|
||||
m_desktop_show_icons = DlgItemIsChecked(hwnd, IDC_CB_SHOW_ICONS);
|
||||
m_desktop_textlabel_boxes = DlgItemIsChecked(hwnd, IDC_CB_BOX);
|
||||
m_desktop_manual_icon_scoot = DlgItemIsChecked(hwnd, IDC_CB_MANUAL_SCOOT);
|
||||
m_desktop_555_fix = SendMessage( GetDlgItem(hwnd, IDC_DM_ALPHA_FIX), CB_GETCURSEL, 0, 0 );
|
||||
|
||||
EndDialog(hwnd,id);
|
||||
break;
|
||||
|
||||
case IDCANCEL:
|
||||
EndDialog(hwnd,id);
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case WM_HELP:
|
||||
if (lParam)
|
||||
{
|
||||
HELPINFO *ph = (HELPINFO*)lParam;
|
||||
wchar_t title[1024];
|
||||
wchar_t buf[2048];
|
||||
wchar_t ctrl_name[1024];
|
||||
GetWindowTextW(GetDlgItem(hwnd, ph->iCtrlId), ctrl_name, sizeof(ctrl_name)/sizeof(*ctrl_name));
|
||||
RemoveSingleAmpersands(ctrl_name);
|
||||
buf[0] = 0;
|
||||
|
||||
switch(ph->iCtrlId)
|
||||
{
|
||||
case IDC_DM_ALPHA_FIX:
|
||||
case IDC_DM_ALPHA_FIX_CAPTION:
|
||||
WASABI_API_LNGSTRINGW_BUF(IDS_NO_ALPHA_FALLBACK, title, 1024);
|
||||
WASABI_API_LNGSTRINGW_BUF(IDS_NO_ALPHA_FALLBACK_HELP, buf, 2048);
|
||||
break;
|
||||
|
||||
case IDC_CB_SHOW_ICONS:
|
||||
StringCbPrintfW(title, sizeof(title), WASABI_API_LNGSTRINGW(IDS_HELP_ON_X_CHECKBOX), ctrl_name);
|
||||
WASABI_API_LNGSTRINGW_BUF(IDS_CB_SHOW_ICONS_HELP, buf, 2048);
|
||||
break;
|
||||
|
||||
case IDC_CB_BOX:
|
||||
WASABI_API_LNGSTRINGW_BUF(IDS_CB_BOX, title, 1024);
|
||||
WASABI_API_LNGSTRINGW_BUF(IDS_CB_BOX_HELP, buf, 2048);
|
||||
break;
|
||||
|
||||
case IDC_CB_MANUAL_SCOOT:
|
||||
WASABI_API_LNGSTRINGW_BUF(IDS_CB_MANUAL_SCOOT, title, 1024);
|
||||
WASABI_API_LNGSTRINGW_BUF(IDS_CB_MANUAL_SCOOT_HELP, buf, 2048);
|
||||
break;
|
||||
}
|
||||
|
||||
if (buf[0])
|
||||
MessageBoxW(hwnd, buf, title, MB_OK|MB_SETFOREGROUND|MB_TOPMOST|MB_TASKMODAL);
|
||||
}
|
||||
break;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
BOOL CALLBACK CPluginShell::DualheadDialogProc(HWND hwnd,UINT msg,WPARAM wParam,LPARAM lParam)
|
||||
{
|
||||
if (msg==WM_INITDIALOG && lParam > 0 && GetWindowLongPtr(hwnd,GWLP_USERDATA)==0)
|
||||
SetWindowLongPtr(hwnd, GWLP_USERDATA, lParam);
|
||||
|
||||
CPluginShell* p = (CPluginShell*)GetWindowLongPtr(hwnd,GWLP_USERDATA);
|
||||
|
||||
if (p)
|
||||
return p->PluginShellDualheadDialogProc(hwnd, msg, wParam, lParam);
|
||||
else
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
BOOL CPluginShell::PluginShellDualheadDialogProc(HWND hwnd,UINT msg,WPARAM wParam,LPARAM lParam)
|
||||
{
|
||||
#ifdef _DEBUG
|
||||
OutputDebugMessage("DHDlgProc: ", hwnd, msg, wParam, lParam);
|
||||
#endif
|
||||
|
||||
switch (msg)
|
||||
{
|
||||
case WM_DESTROY:
|
||||
return 0;
|
||||
|
||||
case WM_INITDIALOG:
|
||||
{
|
||||
HWND ctrl = GetDlgItem(hwnd, IDC_H_PICK);
|
||||
SendMessageW( ctrl, CB_ADDSTRING, 0, (LPARAM)WASABI_API_LNGSTRINGW(IDS_SPAN_BOTH_SCREENS));
|
||||
SendMessageW( ctrl, CB_ADDSTRING, 1, (LPARAM)WASABI_API_LNGSTRINGW(IDS_USE_LEFT_SCREEN_ONLY));
|
||||
SendMessageW( ctrl, CB_ADDSTRING, 2, (LPARAM)WASABI_API_LNGSTRINGW(IDS_USE_RIGHT_SCREEN_ONLY));
|
||||
SendMessage( ctrl, CB_SETCURSEL, m_dualhead_horz, 0 );
|
||||
|
||||
ctrl = GetDlgItem(hwnd, IDC_V_PICK);
|
||||
SendMessageW( ctrl, CB_ADDSTRING, 0, (LPARAM)WASABI_API_LNGSTRINGW(IDS_SPAN_BOTH_SCREENS));
|
||||
SendMessageW( ctrl, CB_ADDSTRING, 1, (LPARAM)WASABI_API_LNGSTRINGW(IDS_USE_TOP_SCREEN_ONLY));
|
||||
SendMessageW( ctrl, CB_ADDSTRING, 2, (LPARAM)WASABI_API_LNGSTRINGW(IDS_USE_BOTTOM_SCREEN_ONLY));
|
||||
SendMessage( ctrl, CB_SETCURSEL, m_dualhead_vert, 0 );
|
||||
}
|
||||
break;
|
||||
|
||||
case WM_COMMAND:
|
||||
{
|
||||
int id = LOWORD(wParam);
|
||||
switch(id)
|
||||
{
|
||||
case IDOK:
|
||||
m_dualhead_horz = SendMessage( GetDlgItem(hwnd, IDC_H_PICK), CB_GETCURSEL, 0, 0 );
|
||||
m_dualhead_vert = SendMessage( GetDlgItem(hwnd, IDC_V_PICK), CB_GETCURSEL, 0, 0 );
|
||||
|
||||
EndDialog(hwnd,id);
|
||||
break;
|
||||
|
||||
case IDCANCEL:
|
||||
EndDialog(hwnd,id);
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@@ -0,0 +1,223 @@
|
||||
/*
|
||||
LICENSE
|
||||
-------
|
||||
Copyright 2005-2012 Nullsoft, Inc.
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification,
|
||||
are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright notice,
|
||||
this list of conditions and the following disclaimer.
|
||||
|
||||
* Redistributions in binary form must reproduce the above copyright notice,
|
||||
this list of conditions and the following disclaimer in the documentation
|
||||
and/or other materials provided with the distribution.
|
||||
|
||||
* Neither the name of Nullsoft nor the names of its contributors may be used to
|
||||
endorse or promote products derived from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
|
||||
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||
FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
||||
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
|
||||
IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
|
||||
OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifndef __NULLSOFT_DX8_PLUGIN_SHELL_DEFINES_H__
|
||||
#define __NULLSOFT_DX8_PLUGIN_SHELL_DEFINES_H__ 1
|
||||
|
||||
// APPNAME should be something like "MyPlugin 1.0".
|
||||
// This is the name that will appear in Winamp's list of installed plugins.
|
||||
// Try to include the version number with the name.
|
||||
// Note: to change the name of the *file* (DLL) that the plugin is
|
||||
// compiled to, go to Project Settings -> Link tab -> and change the
|
||||
// 'output file name'. Don't forget to do it for both Debug AND
|
||||
// Release builds!
|
||||
#define SHORTNAME "MilkDrop 2" // used as window caption for both MilkDrop and the config panel. avoid numbers or punctuation; when 'integrate with winamp' option is enabled, these characters don't always work with all skins.
|
||||
#define LONGNAME "MilkDrop v2.25d" // appears at bottom of config panel
|
||||
#define LONGNAMEW L"MilkDrop v2.25d" // appears at bottom of config panel
|
||||
|
||||
// INT_VERSION is the major version #, multipled by 100 (ie. version 1.02
|
||||
// would be 102). If the app goes to read in the INI file and sees that
|
||||
// the INI file is from an older version of your plugin, it will ignore
|
||||
// their old settings and reset them to the defaults for the new version;
|
||||
// but that only works if you keep this value up-to-date. ***To disable this
|
||||
// behavior, just always leave this at 100. ***
|
||||
#define INT_VERSION 200
|
||||
// INT_SUBVERSION is the minor version #, counting up from 0 as you do
|
||||
// mini-releases. If the plugin goes to read the old INI file and sees that
|
||||
// the major version # is the same but the minor version # is not, it will,
|
||||
// again, ignore their old settings and reset them to the defaults for the
|
||||
// new version. ***To disable this behavior, just always leave this at 0. ***
|
||||
#define INT_SUBVERSION 5 //straight=0, a=1, b=2, ...
|
||||
|
||||
// SUBDIR puts milkdrop's documentation, INI file, presets folder, etc.
|
||||
// in a subdir underneath Winamp\Plugins.
|
||||
#define SUBDIR L"Milkdrop2\\" //""
|
||||
|
||||
// INIFILE is the name of the .INI file that will save the user's
|
||||
// config panel settings. Do not include a path; just give the filename.
|
||||
// The actual file will be stored in the WINAMP\PLUGINS directory,
|
||||
// OR POSSIBLY c:\application data\...(user)...\winamp\plugins!!! - if
|
||||
// they have sep. settings for each user!
|
||||
#define INIFILE L"milk2.ini" //*** DO NOT PUT IN A SUBDIR because on save, if dir doesn't already exist,
|
||||
// it won't be able to save the INI file.
|
||||
#define MSG_INIFILE L"milk2_msg.ini" //*** could be in c:\program files\winamp\plugins, or in
|
||||
#define IMG_INIFILE L"milk2_img.ini" // c:\application data\...user...\winamp\plugins !!
|
||||
#define ADAPTERSFILE L"milk2_adapters.txt"
|
||||
|
||||
// DOCFILE is the name of the documentation file that you'll write
|
||||
// for your users. Do not include a path; just give the filename.
|
||||
// When a user clicks the 'View Docs' button on the config panel,
|
||||
// the plugin will try to display this file, located in the
|
||||
// WINAMP\PLUGINS directory.
|
||||
//
|
||||
// ***Note that the button will be invisible (on the config panel)
|
||||
// at runtime if this string is empty.***
|
||||
#define DOCFILE SUBDIR L"docs\\milkdrop.html" // set this to something like "myplugin.html"
|
||||
|
||||
// PLUGIN_WEB_URL is the web address of the homepage for your plugin.
|
||||
// It should be a well-formed URL (http://...). When a user clicks
|
||||
// the 'View Webpage' button on the config panel, the plugin will
|
||||
// launch their default browser to display this page.
|
||||
//
|
||||
// ***Note that the button will be invisible (on the config panel)
|
||||
// at runtime if this string is empty.***
|
||||
#define PLUGIN_WEB_URL L"http://www.geisswerks.com/milkdrop/" // set this to something like "http://www.myplugin.com/"
|
||||
|
||||
// The following two strings - AUTHOR_NAME and COPYRIGHT - will be used
|
||||
// in a little box in the config panel, to identify the author & copyright
|
||||
// holder of the plugin. Keep them short so they fit in the box.
|
||||
#define AUTHOR_NAME L"Ryan Geiss"
|
||||
#define COPYRIGHT L"(c) 2001-2023 Winamp SA"
|
||||
|
||||
// CLASSNAME is the name of the window class that the plugin will
|
||||
// use. You don't want this to overlap with any other plugins
|
||||
// or applications that are running, so change this to something
|
||||
// that will probably be unique. For example, if your plugin was
|
||||
// called Libido, then "LibidoClass" would probably be a safe bet.
|
||||
#define CLASSNAME L"MilkDrop2"
|
||||
|
||||
// Here you can give names to the buttons (~tabs) along the top
|
||||
// of the config panel. Each button, when clicked, will bring
|
||||
// up the corresponding 'property page' (embedded dialog),
|
||||
// IDD_PROPPAGE_1 through IDD_PROPPAGE_8. If you want less than
|
||||
// 8 buttons to show up, just leave their names as blank. For
|
||||
// full instructions on how to add a new tab/page, see
|
||||
// DOCUMENTATION.TXT.
|
||||
//#define CONFIG_PANEL_BUTTON_1 " Common Settings " // nPage==1
|
||||
//#define CONFIG_PANEL_BUTTON_2 " MORE SETTINGS " // nPage==2
|
||||
//#define CONFIG_PANEL_BUTTON_3 " Artist Tools " // nPage==3
|
||||
//#define CONFIG_PANEL_BUTTON_4 " Transitions " // nPage==4
|
||||
//#define CONFIG_PANEL_BUTTON_5 "" // nPage==5
|
||||
//#define CONFIG_PANEL_BUTTON_6 "" // nPage==6
|
||||
//#define CONFIG_PANEL_BUTTON_7 "" // nPage==7
|
||||
//#define CONFIG_PANEL_BUTTON_8 "" // nPage==8
|
||||
// As if 2.0e, these strings are defined in the stringtable of the dll
|
||||
// and otherwise work the same as these header defines.
|
||||
// (The equivelent of "" in these is a single space now)
|
||||
|
||||
// adjust the defaults for the 4 built-in fonts here.
|
||||
// (note: if you want the font to be available on 98 + ME + 2k + XP, use one of the following...)
|
||||
// arial
|
||||
// courier 10-12-15
|
||||
// courier new
|
||||
// comic san[s] ms
|
||||
// lucida console
|
||||
// ms sans serif
|
||||
// ms serif
|
||||
// small fonts
|
||||
// symbol 8-10-12-14-18-24
|
||||
// tahoma
|
||||
// times new roman
|
||||
// verdana
|
||||
// webdings
|
||||
#define SIMPLE_FONT_DEFAULT_FACE L"Courier" //"MS Sans Serif" - changed to Courier because menus + code FAR more legible!
|
||||
#define SIMPLE_FONT_DEFAULT_SIZE 12 //16
|
||||
#define SIMPLE_FONT_DEFAULT_BOLD 0
|
||||
#define SIMPLE_FONT_DEFAULT_ITAL 0
|
||||
#define SIMPLE_FONT_DEFAULT_AA 0
|
||||
#define DECORATIVE_FONT_DEFAULT_FACE L"Times New Roman"
|
||||
#define DECORATIVE_FONT_DEFAULT_SIZE 24
|
||||
#define DECORATIVE_FONT_DEFAULT_BOLD 0
|
||||
#define DECORATIVE_FONT_DEFAULT_ITAL 1
|
||||
#define DECORATIVE_FONT_DEFAULT_AA 1
|
||||
#define HELPSCREEN_FONT_DEFAULT_FACE L"MS Sans Serif"
|
||||
#define HELPSCREEN_FONT_DEFAULT_SIZE 14 // NOTE: should fit on 640x480 screen!
|
||||
#define HELPSCREEN_FONT_DEFAULT_BOLD 1
|
||||
#define HELPSCREEN_FONT_DEFAULT_ITAL 0
|
||||
#define HELPSCREEN_FONT_DEFAULT_AA 0
|
||||
#define PLAYLIST_FONT_DEFAULT_FACE L"Arial"
|
||||
#define PLAYLIST_FONT_DEFAULT_SIZE 16
|
||||
#define PLAYLIST_FONT_DEFAULT_BOLD 0
|
||||
#define PLAYLIST_FONT_DEFAULT_ITAL 0
|
||||
#define PLAYLIST_FONT_DEFAULT_AA 0
|
||||
|
||||
// automatically add extra fonts to the config panel
|
||||
// by simply #defining them here, UP TO A MAX OF 5 EXTRA FONTS.
|
||||
// access the font by calling GetFont(EXTRA_1) for extra font #1,
|
||||
// GetExtraFont(EXTRA_2) for extra font #2, and so on.
|
||||
#define NUM_EXTRA_FONTS 2 // <- don't exceed 5 here!
|
||||
#define TOOLTIP_FONT EXTRA_1
|
||||
//#define EXTRA_FONT_1_NAME "Tooltips"
|
||||
// defined in the stringtable resources now since 2.0e
|
||||
#define EXTRA_FONT_1_DEFAULT_FACE L"Arial"
|
||||
#define EXTRA_FONT_1_DEFAULT_SIZE 14
|
||||
#define EXTRA_FONT_1_DEFAULT_BOLD 0
|
||||
#define EXTRA_FONT_1_DEFAULT_ITAL 0
|
||||
#define EXTRA_FONT_1_DEFAULT_AA 0
|
||||
#define SONGTITLE_FONT EXTRA_2
|
||||
//#define EXTRA_FONT_2_NAME "Animated Songtitles"
|
||||
// defined in the stringtable resources now since 2.0e
|
||||
#define EXTRA_FONT_2_DEFAULT_FACE L"Times New Roman"
|
||||
#define EXTRA_FONT_2_DEFAULT_SIZE 18
|
||||
#define EXTRA_FONT_2_DEFAULT_BOLD 0
|
||||
#define EXTRA_FONT_2_DEFAULT_ITAL 1
|
||||
#define EXTRA_FONT_2_DEFAULT_AA 1
|
||||
|
||||
#define WINDOWCAPTION SHORTNAME // the caption that will appear on the plugin window
|
||||
#define DLLDESC LONGNAME // the desc. of this DLL, as it appears in Winamp's list of viz plugins
|
||||
#define MODULEDESC LONGNAME // the desc. of this viz module within the DLL (..this framework is set up for just 1 module per DLL)
|
||||
|
||||
// Finally, a few parameters that will control how things are done
|
||||
// inside the plugin shell:
|
||||
#define NUM_WAVEFORM_SAMPLES 480 // RANGE: 32-576. This is the # of samples of waveform data that you want.
|
||||
// Note that if it is less than 576, then VMS will do its best
|
||||
// to line up the waveforms from frame to frame for you, using
|
||||
// the extra samples as 'squish' space.
|
||||
// Note: the more 'slush' samples you leave, the better the alignment
|
||||
// will be. 512 samples gives you decent alignment; 400 samples
|
||||
// leaves room for fantastic alignment.
|
||||
// Observe that if you specify a value here (say 400) and then only
|
||||
// render a sub-portion of that in some cases (say, 200 samples),
|
||||
// make sure you render the *middle* 200 samples (#100-300), because
|
||||
// the alignment happens *mostly at the center*.
|
||||
#define NUM_FREQUENCIES 512 // # of freq. samples you want *out* of the FFT, for 0-11kHz range.
|
||||
// ** this must be a power of 2!
|
||||
// ** the actual FFT will use twice this many frequencies **
|
||||
|
||||
#define TEXT_MARGIN 10 // the # of pixels of margin to leave between text and the edge of the screen
|
||||
#define PLAYLIST_INNER_MARGIN 4 // the extra margin between the playlist box and the text inside
|
||||
|
||||
#define PLAYLIST_COLOR_PLAYING_TRACK 0xFFCCFF00 // alpha|red|green|blue
|
||||
#define PLAYLIST_COLOR_HILITE_TRACK 0xFFFF5050
|
||||
#define PLAYLIST_COLOR_BOTH 0xFFFFCC22
|
||||
#define PLAYLIST_COLOR_NORMAL 0xFFCCCCCC
|
||||
|
||||
#define MENU_COLOR 0xFFCCCCCC
|
||||
#define MENU_HILITE_COLOR 0xFFFF4400
|
||||
#define DIR_COLOR 0xFF88CCFF
|
||||
#define TOOLTIP_COLOR 0xFFBBBBCC
|
||||
|
||||
#define MAX_PRESETS_PER_PAGE 32
|
||||
|
||||
//#define PRESS_F1_MSG "Press F1 for Help " // leave extra space @ end, so italicized fonts don't get clipped
|
||||
// defined in the stringtable resources now since 2.0e
|
||||
#define PRESS_F1_DUR 3.0f // in seconds
|
||||
#define PRESS_F1_EXP 10.0f // exponent for how quickly it accelerates to leave the screen. 1 = linear; >1 = stays & then dashes off @ end
|
||||
|
||||
#endif
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,151 @@
|
||||
/*
|
||||
LICENSE
|
||||
-------
|
||||
Copyright 2005-2013 Nullsoft, Inc.
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification,
|
||||
are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright notice,
|
||||
this list of conditions and the following disclaimer.
|
||||
|
||||
* Redistributions in binary form must reproduce the above copyright notice,
|
||||
this list of conditions and the following disclaimer in the documentation
|
||||
and/or other materials provided with the distribution.
|
||||
|
||||
* Neither the name of Nullsoft nor the names of its contributors may be used to
|
||||
endorse or promote products derived from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
|
||||
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||
FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
||||
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
|
||||
IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
|
||||
OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifndef __NULLSOFT_DX9_PLUGIN_SHELL_DXCONTEXT_H__
|
||||
#define __NULLSOFT_DX9_PLUGIN_SHELL_DXCONTEXT_H__ 1
|
||||
|
||||
#include <windows.h>
|
||||
#include "shell_defines.h"
|
||||
|
||||
#ifdef _DEBUG
|
||||
#define D3D_DEBUG_INFO // declare this before including d3d9.h
|
||||
#endif
|
||||
#include <d3d9.h>
|
||||
#include <d3dx9.h>
|
||||
|
||||
#define SNAP_WINDOWED_MODE_BLOCKSIZE 32 // or use 0 if you don't want snapping
|
||||
|
||||
typedef struct
|
||||
{
|
||||
eScrMode screenmode; // WINDOWED, FULLSCREEN, or FAKE FULLSCREEN
|
||||
int nbackbuf;
|
||||
int allow_page_tearing;
|
||||
GUID adapter_guid;
|
||||
char adapter_devicename[256];
|
||||
D3DDISPLAYMODE display_mode; // ONLY VALID FOR FULLSCREEN MODE.
|
||||
D3DMULTISAMPLE_TYPE multisamp;
|
||||
HWND parent_window;
|
||||
int m_dualhead_horz; // 0 = span both, 1 = left only, 2 = right only
|
||||
int m_dualhead_vert; // 0 = span both, 1 = top only, 2 = bottom only
|
||||
int m_skin;
|
||||
}
|
||||
DXCONTEXT_PARAMS;
|
||||
|
||||
#define MAX_DXC_ADAPTERS 32
|
||||
|
||||
class DXContext
|
||||
{
|
||||
public:
|
||||
// PUBLIC FUNCTIONS
|
||||
DXContext(HWND hWndWinamp,HINSTANCE hInstance,LPCWSTR szClassName,LPCSTR szWindowCaption,WNDPROC pProc,LONG_PTR uWindowLong, int minimize_winamp, wchar_t* szIniFile);
|
||||
~DXContext();
|
||||
BOOL StartOrRestartDevice(DXCONTEXT_PARAMS *pParams); // also serves as Init() function
|
||||
BOOL OnUserResizeWindow(RECT *new_window_rect, RECT *new_client_rect);
|
||||
inline HWND GetHwnd() { return m_hwnd; };
|
||||
inline int TempIgnoreDestroyMessages() { return m_ignore_wm_destroy; };
|
||||
void OnTrulyExiting() { m_truly_exiting = 1; }
|
||||
void UpdateMonitorWorkRect();
|
||||
int GetBitDepth() { return m_bpp; };
|
||||
inline D3DFORMAT GetZFormat() { return m_zFormat; };
|
||||
char* GetDriver() { return m_szDriver; };
|
||||
char* GetDesc() { return m_szDesc; };
|
||||
void SaveWindow();
|
||||
|
||||
// PUBLIC DATA - DO NOT WRITE TO THESE FROM OUTSIDE THE CLASS
|
||||
int m_ready;
|
||||
HRESULT m_lastErr;
|
||||
int m_window_width;
|
||||
int m_window_height;
|
||||
int m_client_width; //in windowed mode, these are the SNAPPED (locked to nearest 32x32)
|
||||
int m_client_height; // width and height
|
||||
int m_REAL_client_width; //these are the ACTUAL (raw) width and height -
|
||||
int m_REAL_client_height; // only valid in windowed mode!
|
||||
int m_fake_fs_covers_all;
|
||||
int m_frame_delay;
|
||||
RECT m_all_monitors_rect; // rect that encompasses all monitors that make up the desktop. The primary monitor's upper-left corner is (0,0).
|
||||
RECT m_monitor_rect; // rect for monitor the plugin is running on; for pseudo-multimon modes like 2048x768, if user decides to only run on half the monitor, this rect reflects that as well.
|
||||
RECT m_monitor_rect_orig; // same, but it's the original rect; does not account for pseudo-multimon modes like 2048x768
|
||||
RECT m_monitor_work_rect; // same, but excludes the taskbar area.
|
||||
RECT m_monitor_work_rect_orig; // original work rect; does not account for pseudo-multimon modes like 2048x768
|
||||
DXCONTEXT_PARAMS m_current_mode;
|
||||
LPDIRECT3DDEVICE9 m_lpDevice;
|
||||
D3DPRESENT_PARAMETERS m_d3dpp;
|
||||
LPDIRECT3D9 m_lpD3D;
|
||||
D3DCAPS9 m_caps;
|
||||
|
||||
protected:
|
||||
D3DMULTISAMPLE_TYPE m_multisamp;
|
||||
D3DFORMAT m_zFormat;
|
||||
D3DFORMAT m_orig_windowed_mode_format[MAX_DXC_ADAPTERS];
|
||||
HMODULE m_hmod_d3d9, m_hmod_d3dx9;
|
||||
int m_ordinal_adapter;
|
||||
HWND m_hwnd;
|
||||
HWND m_hwnd_winamp;
|
||||
LONG_PTR m_uWindowLong;
|
||||
ATOM m_classAtom;
|
||||
char m_szWindowCaption[512];
|
||||
wchar_t m_szIniFile[MAX_PATH];
|
||||
char m_szDriver[MAX_DEVICE_IDENTIFIER_STRING];
|
||||
char m_szDesc[MAX_DEVICE_IDENTIFIER_STRING];
|
||||
HINSTANCE m_hInstance;
|
||||
int m_ignore_wm_destroy;
|
||||
int m_minimize_winamp;
|
||||
int m_winamp_minimized;
|
||||
int m_truly_exiting;
|
||||
int m_bpp;
|
||||
|
||||
embedWindowState myWindowState;
|
||||
|
||||
void WriteSafeWindowPos();
|
||||
int GetWindowedModeAutoSize(int iteration);
|
||||
BOOL TestDepth(int ordinal_adapter, D3DFORMAT fmt);
|
||||
BOOL TestFormat(int ordinal_adapter, D3DFORMAT fmt);
|
||||
int CheckAndCorrectFullscreenDispMode(int ordinal_adapter, D3DDISPLAYMODE *pdm);
|
||||
void SetViewport();
|
||||
void MinimizeWinamp(HMONITOR hPluginMonitor);
|
||||
BOOL Internal_Init(DXCONTEXT_PARAMS *pParams, BOOL bFirstInit);
|
||||
void Internal_CleanUp();
|
||||
void RestoreWinamp();
|
||||
void GetSnappedClientSize(); //windowed mode only
|
||||
};
|
||||
|
||||
#define DXC_ERR_REGWIN -2
|
||||
#define DXC_ERR_CREATEWIN -3
|
||||
#define DXC_ERR_CREATE3D -4
|
||||
#define DXC_ERR_GETFORMAT -5
|
||||
#define DXC_ERR_FORMAT -6
|
||||
#define DXC_ERR_CREATEDEV_PROBABLY_OUTOFVIDEOMEMORY -7
|
||||
#define DXC_ERR_RESIZEFAILED -8
|
||||
#define DXC_ERR_CAPSFAIL -9
|
||||
#define DXC_ERR_BAD_FS_DISPLAYMODE -10
|
||||
#define DXC_ERR_USER_CANCELED -11
|
||||
#define DXC_ERR_CREATEDEV_NOT_AVAIL -12
|
||||
#define DXC_ERR_CREATEDDRAW -13
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,320 @@
|
||||
/*
|
||||
LICENSE
|
||||
-------
|
||||
Copyright 2005-2013 Nullsoft, Inc.
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification,
|
||||
are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright notice,
|
||||
this list of conditions and the following disclaimer.
|
||||
|
||||
* Redistributions in binary form must reproduce the above copyright notice,
|
||||
this list of conditions and the following disclaimer in the documentation
|
||||
and/or other materials provided with the distribution.
|
||||
|
||||
* Neither the name of Nullsoft nor the names of its contributors may be used to
|
||||
endorse or promote products derived from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
|
||||
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||
FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
||||
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
|
||||
IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
|
||||
OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <math.h>
|
||||
#include <memory.h>
|
||||
#include "fft.h"
|
||||
|
||||
#define PI 3.141592653589793238462643383279502884197169399f
|
||||
|
||||
#define SafeDeleteArray(x) { if (x) { delete [] x; x = 0; } }
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
FFT::FFT()
|
||||
{
|
||||
NFREQ = 0;
|
||||
|
||||
envelope = 0;
|
||||
equalize = 0;
|
||||
bitrevtable = 0;
|
||||
cossintable = 0;
|
||||
temp1 = 0;
|
||||
temp2 = 0;
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
FFT::~FFT()
|
||||
{
|
||||
CleanUp();
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
void FFT::Init(int samples_in, int samples_out, int bEqualize, float envelope_power)
|
||||
{
|
||||
// samples_in: # of waveform samples you'll feed into the FFT
|
||||
// samples_out: # of frequency samples you want out; MUST BE A POWER OF 2.
|
||||
// bEqualize: set to 1 if you want the magnitude of the basses and trebles
|
||||
// to be roughly equalized; 0 to leave them untouched.
|
||||
// envelope_power: set to -1 to disable the envelope; otherwise, specify
|
||||
// the envelope power you want here. See InitEnvelopeTable for more info.
|
||||
|
||||
CleanUp();
|
||||
|
||||
m_samples_in = samples_in;
|
||||
NFREQ = samples_out*2;
|
||||
|
||||
InitBitRevTable();
|
||||
InitCosSinTable();
|
||||
if (envelope_power > 0)
|
||||
InitEnvelopeTable(envelope_power);
|
||||
if (bEqualize)
|
||||
InitEqualizeTable();
|
||||
temp1 = new float[NFREQ];
|
||||
temp2 = new float[NFREQ];
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
void FFT::CleanUp()
|
||||
{
|
||||
SafeDeleteArray(envelope);
|
||||
SafeDeleteArray(equalize);
|
||||
SafeDeleteArray(bitrevtable);
|
||||
SafeDeleteArray(cossintable);
|
||||
SafeDeleteArray(temp1);
|
||||
SafeDeleteArray(temp2);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
void FFT::InitEqualizeTable()
|
||||
{
|
||||
int i;
|
||||
float scaling = -0.02f;
|
||||
float inv_half_nfreq = 1.0f/(float)(NFREQ/2);
|
||||
|
||||
equalize = new float[NFREQ/2];
|
||||
|
||||
for (i=0; i<NFREQ/2; i++)
|
||||
equalize[i] = scaling * logf( (float)(NFREQ/2-i)*inv_half_nfreq );
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
void FFT::InitEnvelopeTable(float power)
|
||||
{
|
||||
// this precomputation is for multiplying the waveform sample
|
||||
// by a bell-curve-shaped envelope, so we don't see the ugly
|
||||
// frequency response (oscillations) of a square filter.
|
||||
|
||||
// a power of 1.0 will compute the FFT with exactly one convolution.
|
||||
// a power of 2.0 is like doing it twice; the resulting frequency
|
||||
// output will be smoothed out and the peaks will be "fatter".
|
||||
// a power of 0.5 is closer to not using an envelope, and you start
|
||||
// to get the frequency response of the square filter as 'power'
|
||||
// approaches zero; the peaks get tighter and more precise, but
|
||||
// you also see small oscillations around their bases.
|
||||
|
||||
int i;
|
||||
float mult = 1.0f/(float)m_samples_in * 6.2831853f;
|
||||
|
||||
envelope = new float[m_samples_in];
|
||||
|
||||
if (power==1.0f)
|
||||
for (i=0; i<m_samples_in; i++)
|
||||
envelope[i] = 0.5f + 0.5f*sinf(i*mult - 1.5707963268f);
|
||||
else
|
||||
for (i=0; i<m_samples_in; i++)
|
||||
envelope[i] = powf(0.5f + 0.5f*sinf(i*mult - 1.5707963268f), power);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
void FFT::InitBitRevTable()
|
||||
{
|
||||
int i,j,m,temp;
|
||||
bitrevtable = new int[NFREQ];
|
||||
|
||||
for (i=0; i<NFREQ; i++)
|
||||
bitrevtable[i] = i;
|
||||
|
||||
for (i=0,j=0; i < NFREQ; i++)
|
||||
{
|
||||
if (j > i)
|
||||
{
|
||||
temp = bitrevtable[i];
|
||||
bitrevtable[i] = bitrevtable[j];
|
||||
bitrevtable[j] = temp;
|
||||
}
|
||||
|
||||
m = NFREQ >> 1;
|
||||
|
||||
while (m >= 1 && j >= m)
|
||||
{
|
||||
j -= m;
|
||||
m >>= 1;
|
||||
}
|
||||
|
||||
j += m;
|
||||
}
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
void FFT::InitCosSinTable()
|
||||
{
|
||||
|
||||
int i,dftsize,tabsize;
|
||||
float theta;
|
||||
|
||||
dftsize = 2;
|
||||
tabsize = 0;
|
||||
while (dftsize <= NFREQ)
|
||||
{
|
||||
tabsize++;
|
||||
dftsize <<= 1;
|
||||
}
|
||||
|
||||
cossintable = new float[tabsize][2];
|
||||
|
||||
dftsize = 2;
|
||||
i = 0;
|
||||
while (dftsize <= NFREQ)
|
||||
{
|
||||
theta = (float)(-2.0f*PI/(float)dftsize);
|
||||
cossintable[i][0] = (float)cosf(theta);
|
||||
cossintable[i][1] = (float)sinf(theta);
|
||||
i++;
|
||||
dftsize <<= 1;
|
||||
}
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
void FFT::time_to_frequency_domain(float *in_wavedata, float *out_spectraldata)
|
||||
{
|
||||
// Converts time-domain samples from in_wavedata[]
|
||||
// into frequency-domain samples in out_spectraldata[].
|
||||
// The array lengths are the two parameters to Init().
|
||||
|
||||
// The last sample of the output data will represent the frequency
|
||||
// that is 1/4th of the input sampling rate. For example,
|
||||
// if the input wave data is sampled at 44,100 Hz, then the last
|
||||
// sample of the spectral data output will represent the frequency
|
||||
// 11,025 Hz. The first sample will be 0 Hz; the frequencies of
|
||||
// the rest of the samples vary linearly in between.
|
||||
// Note that since human hearing is limited to the range 200 - 20,000
|
||||
// Hz. 200 is a low bass hum; 20,000 is an ear-piercing high shriek.
|
||||
// Each time the frequency doubles, that sounds like going up an octave.
|
||||
// That means that the difference between 200 and 300 Hz is FAR more
|
||||
// than the difference between 5000 and 5100, for example!
|
||||
// So, when trying to analyze bass, you'll want to look at (probably)
|
||||
// the 200-800 Hz range; whereas for treble, you'll want the 1,400 -
|
||||
// 11,025 Hz range.
|
||||
// If you want to get 3 bands, try it this way:
|
||||
// a) 11,025 / 200 = 55.125
|
||||
// b) to get the number of octaves between 200 and 11,025 Hz, solve for n:
|
||||
// 2^n = 55.125
|
||||
// n = log 55.125 / log 2
|
||||
// n = 5.785
|
||||
// c) so each band should represent 5.785/3 = 1.928 octaves; the ranges are:
|
||||
// 1) 200 - 200*2^1.928 or 200 - 761 Hz
|
||||
// 2) 200*2^1.928 - 200*2^(1.928*2) or 761 - 2897 Hz
|
||||
// 3) 200*2^(1.928*2) - 200*2^(1.928*3) or 2897 - 11025 Hz
|
||||
|
||||
// A simple sine-wave-based envelope is convolved with the waveform
|
||||
// data before doing the FFT, to emeliorate the bad frequency response
|
||||
// of a square (i.e. nonexistent) filter.
|
||||
|
||||
// You might want to slightly damp (blur) the input if your signal isn't
|
||||
// of a very high quality, to reduce high-frequency noise that would
|
||||
// otherwise show up in the output.
|
||||
|
||||
int j, m, i, dftsize, hdftsize, t;
|
||||
float wr, wi, wpi, wpr, wtemp, tempr, tempi;
|
||||
|
||||
if (!bitrevtable) return;
|
||||
//if (!envelope) return;
|
||||
//if (!equalize) return;
|
||||
if (!temp1) return;
|
||||
if (!temp2) return;
|
||||
if (!cossintable) return;
|
||||
|
||||
// 1. set up input to the fft
|
||||
if (envelope)
|
||||
{
|
||||
for (i=0; i<NFREQ; i++)
|
||||
{
|
||||
int idx = bitrevtable[i];
|
||||
if (idx < m_samples_in)
|
||||
temp1[i] = in_wavedata[idx] * envelope[idx];
|
||||
else
|
||||
temp1[i] = 0;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for (i=0; i<NFREQ; i++)
|
||||
{
|
||||
int idx = bitrevtable[i];
|
||||
if (idx < m_samples_in)
|
||||
temp1[i] = in_wavedata[idx];// * envelope[idx];
|
||||
else
|
||||
temp1[i] = 0;
|
||||
}
|
||||
}
|
||||
memset(temp2, 0, sizeof(float)*NFREQ);
|
||||
|
||||
// 2. perform FFT
|
||||
float *real = temp1;
|
||||
float *imag = temp2;
|
||||
dftsize = 2;
|
||||
t = 0;
|
||||
while (dftsize <= NFREQ)
|
||||
{
|
||||
wpr = cossintable[t][0];
|
||||
wpi = cossintable[t][1];
|
||||
wr = 1.0f;
|
||||
wi = 0.0f;
|
||||
hdftsize = dftsize >> 1;
|
||||
|
||||
for (m = 0; m < hdftsize; m+=1)
|
||||
{
|
||||
for (i = m; i < NFREQ; i+=dftsize)
|
||||
{
|
||||
j = i + hdftsize;
|
||||
tempr = wr*real[j] - wi*imag[j];
|
||||
tempi = wr*imag[j] + wi*real[j];
|
||||
real[j] = real[i] - tempr;
|
||||
imag[j] = imag[i] - tempi;
|
||||
real[i] += tempr;
|
||||
imag[i] += tempi;
|
||||
}
|
||||
|
||||
wr = (wtemp=wr)*wpr - wi*wpi;
|
||||
wi = wi*wpr + wtemp*wpi;
|
||||
}
|
||||
|
||||
dftsize <<= 1;
|
||||
t++;
|
||||
}
|
||||
|
||||
// 3. take the magnitude & equalize it (on a log10 scale) for output
|
||||
if (equalize)
|
||||
for (i=0; i<NFREQ/2; i++)
|
||||
out_spectraldata[i] = equalize[i] * sqrtf(temp1[i]*temp1[i] + temp2[i]*temp2[i]);
|
||||
else
|
||||
for (i=0; i<NFREQ/2; i++)
|
||||
out_spectraldata[i] = sqrtf(temp1[i]*temp1[i] + temp2[i]*temp2[i]);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
@@ -0,0 +1,60 @@
|
||||
/*
|
||||
LICENSE
|
||||
-------
|
||||
Copyright 2005-2013 Nullsoft, Inc.
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification,
|
||||
are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright notice,
|
||||
this list of conditions and the following disclaimer.
|
||||
|
||||
* Redistributions in binary form must reproduce the above copyright notice,
|
||||
this list of conditions and the following disclaimer in the documentation
|
||||
and/or other materials provided with the distribution.
|
||||
|
||||
* Neither the name of Nullsoft nor the names of its contributors may be used to
|
||||
endorse or promote products derived from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
|
||||
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||
FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
||||
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
|
||||
IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
|
||||
OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifndef __NULLSOFT_DX9_PLUGIN_SHELL_FFT_H__
|
||||
#define __NULLSOFT_DX9_PLUGIN_SHELL_FFT_H__ 1
|
||||
|
||||
class FFT
|
||||
{
|
||||
public:
|
||||
FFT();
|
||||
~FFT();
|
||||
void Init(int samples_in, int samples_out, int bEqualize=1, float envelope_power=1.0f);
|
||||
void time_to_frequency_domain(float *in_wavedata, float *out_spectraldata);
|
||||
int GetNumFreq() { return NFREQ; };
|
||||
void CleanUp();
|
||||
private:
|
||||
int m_ready;
|
||||
int m_samples_in;
|
||||
int NFREQ;
|
||||
|
||||
void InitEnvelopeTable(float power);
|
||||
void InitEqualizeTable();
|
||||
void InitBitRevTable();
|
||||
void InitCosSinTable();
|
||||
|
||||
int *bitrevtable;
|
||||
float *envelope;
|
||||
float *equalize;
|
||||
float *temp1;
|
||||
float *temp2;
|
||||
float (*cossintable)[2];
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,229 @@
|
||||
#ifndef __GSTRING_SMART_STRING_CLASS__
|
||||
#define __GSTRING_SMART_STRING_CLASS__ 1
|
||||
|
||||
// This is just a streamlined version of std::string.
|
||||
// It cleans itself up automatically, it can copy itself,
|
||||
// test for equality, etc.
|
||||
// and you can use .c_str() to get the string const, so it's
|
||||
// sytactically the same (usage-wise) as std::string.
|
||||
// Written by Ryan Geiss.
|
||||
|
||||
#include <windows.h>
|
||||
|
||||
class GString
|
||||
{
|
||||
public:
|
||||
GString()
|
||||
{
|
||||
m_data = new wchar_t[1];
|
||||
m_data[0] = 0;
|
||||
m_size = 1;
|
||||
}
|
||||
|
||||
GString(const wchar_t* src)
|
||||
{
|
||||
m_data = NULL;
|
||||
m_size = 0;
|
||||
operator=(src);
|
||||
}
|
||||
|
||||
GString(const GString &src_string)
|
||||
{
|
||||
m_data = NULL;
|
||||
m_size = 0;
|
||||
operator=(src_string);
|
||||
}
|
||||
|
||||
~GString()
|
||||
{
|
||||
delete m_data; // note: delete is safe on NULL ptrs
|
||||
m_data = NULL;
|
||||
m_size = 0;
|
||||
}
|
||||
|
||||
inline GString& operator=(const wchar_t* src)
|
||||
{
|
||||
if (src != m_data) // don't do anything on "x = x.c_str();"
|
||||
{
|
||||
delete m_data; // note: delete is safe on NULL ptrs
|
||||
if (src)
|
||||
{
|
||||
m_size = wcslen(src)+1;
|
||||
m_data = new wchar_t[m_size];
|
||||
memcpy(m_data, src, m_size*2);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_size = 1;
|
||||
m_data = new wchar_t[1];
|
||||
m_data[0] = 0;
|
||||
}
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
|
||||
inline GString& operator=(const GString &src_string)
|
||||
{
|
||||
if (&src_string != this) // don't do anything on "x = x;"
|
||||
{
|
||||
if (src_string.GetSize() != m_size) //optimization
|
||||
{
|
||||
delete m_data;
|
||||
m_size = src_string.GetSize();
|
||||
m_data = new wchar_t[m_size];
|
||||
}
|
||||
memcpy(m_data, src_string.c_str(), m_size*2);
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
|
||||
inline wchar_t operator[](int index) const
|
||||
{
|
||||
return m_data[index];
|
||||
}
|
||||
|
||||
inline bool operator==(const wchar_t* comp)
|
||||
{
|
||||
return (wcscmp(m_data,comp) == 0);
|
||||
}
|
||||
|
||||
inline bool operator==(const GString &comp)
|
||||
{
|
||||
if (m_size != comp.m_size) // shortcut
|
||||
return false;
|
||||
return (wcscmp(m_data,comp.c_str()) == 0); //return operator==(comp.m_data);
|
||||
}
|
||||
|
||||
inline const wchar_t* c_str() const
|
||||
{
|
||||
return m_data;
|
||||
}
|
||||
|
||||
// This is actually unsafe, but we need it for convenience, unless we really
|
||||
// feel like copying all data twice. BE WARNED! When this class reallocates
|
||||
// memory, all old references to _data are invalid!
|
||||
//operator const char*() const { return _data; }
|
||||
inline int GetSize() const //in bytes - including terminating NULL char.
|
||||
{
|
||||
return m_size;
|
||||
}
|
||||
|
||||
inline int GetLength() const
|
||||
{
|
||||
return (m_size >= 1) ? m_size-1 : 0;
|
||||
}
|
||||
|
||||
private:
|
||||
wchar_t* m_data;
|
||||
int m_size;
|
||||
};
|
||||
|
||||
class GStringA
|
||||
{
|
||||
public:
|
||||
GStringA()
|
||||
{
|
||||
m_data = new char[1];
|
||||
m_data[0] = 0;
|
||||
m_size = 1;
|
||||
}
|
||||
|
||||
GStringA(const char* src)
|
||||
{
|
||||
m_data = NULL;
|
||||
m_size = 0;
|
||||
operator=(src);
|
||||
}
|
||||
|
||||
GStringA(const GStringA &src_string)
|
||||
{
|
||||
m_data = NULL;
|
||||
m_size = 0;
|
||||
operator=(src_string);
|
||||
}
|
||||
|
||||
~GStringA()
|
||||
{
|
||||
delete m_data; // note: delete is safe on NULL ptrs
|
||||
m_data = NULL;
|
||||
m_size = 0;
|
||||
}
|
||||
|
||||
inline GStringA& operator=(const char* src)
|
||||
{
|
||||
if (src != m_data) // don't do anything on "x = x.c_str();"
|
||||
{
|
||||
delete m_data; // note: delete is safe on NULL ptrs
|
||||
if (src)
|
||||
{
|
||||
m_size = strlen(src)+1;
|
||||
m_data = new char[m_size];
|
||||
memcpy(m_data, src, m_size);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_size = 1;
|
||||
m_data = new char[1];
|
||||
m_data[0] = 0;
|
||||
}
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
|
||||
inline GStringA& operator=(const GStringA &src_string)
|
||||
{
|
||||
if (&src_string != this) // don't do anything on "x = x;"
|
||||
{
|
||||
if (src_string.GetSize() != m_size) //optimization
|
||||
{
|
||||
delete m_data;
|
||||
m_size = src_string.GetSize();
|
||||
m_data = new char[m_size];
|
||||
}
|
||||
memcpy(m_data, src_string.c_str(), m_size);
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
|
||||
inline char operator[](int index) const
|
||||
{
|
||||
return m_data[index];
|
||||
}
|
||||
|
||||
inline bool operator==(const char* comp)
|
||||
{
|
||||
return (strcmp(m_data,comp) == 0);
|
||||
}
|
||||
|
||||
inline bool operator==(const GStringA &comp)
|
||||
{
|
||||
if (m_size != comp.m_size) // shortcut
|
||||
return false;
|
||||
return (strcmp(m_data,comp.c_str()) == 0); //return operator==(comp.m_data);
|
||||
}
|
||||
|
||||
inline const char* c_str() const
|
||||
{
|
||||
return m_data;
|
||||
}
|
||||
|
||||
// This is actually unsafe, but we need it for convenience, unless we really
|
||||
// feel like copying all data twice. BE WARNED! When this class reallocates
|
||||
// memory, all old references to _data are invalid!
|
||||
//operator const char*() const { return _data; }
|
||||
inline int GetSize() const //in bytes - including terminating NULL char.
|
||||
{
|
||||
return m_size;
|
||||
}
|
||||
|
||||
inline int GetLength() const
|
||||
{
|
||||
return (m_size >= 1) ? m_size-1 : 0;
|
||||
}
|
||||
|
||||
private:
|
||||
char* m_data;
|
||||
int m_size;
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,49 @@
|
||||
/*
|
||||
LICENSE
|
||||
-------
|
||||
Copyright 2005-2013 Nullsoft, Inc.
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification,
|
||||
are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright notice,
|
||||
this list of conditions and the following disclaimer.
|
||||
|
||||
* Redistributions in binary form must reproduce the above copyright notice,
|
||||
this list of conditions and the following disclaimer in the documentation
|
||||
and/or other materials provided with the distribution.
|
||||
|
||||
* Neither the name of Nullsoft nor the names of its contributors may be used to
|
||||
endorse or promote products derived from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
|
||||
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||
FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
||||
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
|
||||
IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
|
||||
OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifndef __ICON_T_H__
|
||||
#define __ICON_T_H__ 1
|
||||
|
||||
#include <windows.h>
|
||||
#include <shlobj.h> // for ITEMIDLIST
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int x, y, selected, icon_bitmap_idx, checksum[3], bUpdate;
|
||||
DWORD dwReserved1;
|
||||
DWORD dwReserved2;
|
||||
DWORD dwReserved3;
|
||||
DWORD dwReserved4;
|
||||
RECT icon_rect;
|
||||
RECT label_rect;
|
||||
BYTE pidl[1024]; // when using this, cast it to an ITEMIDLIST
|
||||
TCHAR name[MAX_PATH];
|
||||
} icon_t;
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1 @@
|
||||
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0"><description>Nullsoft Winamp Milkdrop 2 (So You Don't Have To Keep Hacking The Plug-in Dll</description><dependency><dependentAssembly> <assemblyIdentity type="win32" name="Microsoft.VC90.CRT" version="9.0.21022.8" processorArchitecture="x86" publicKeyToken="1fc8b3b9a1e18e3b"></assemblyIdentity></dependentAssembly></dependency></assembly>
|
||||
@@ -0,0 +1,83 @@
|
||||
/*
|
||||
LICENSE
|
||||
-------
|
||||
Copyright 2005-2013 Nullsoft, Inc.
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification,
|
||||
are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright notice,
|
||||
this list of conditions and the following disclaimer.
|
||||
|
||||
* Redistributions in binary form must reproduce the above copyright notice,
|
||||
this list of conditions and the following disclaimer in the documentation
|
||||
and/or other materials provided with the distribution.
|
||||
|
||||
* Neither the name of Nullsoft nor the names of its contributors may be used to
|
||||
endorse or promote products derived from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
|
||||
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||
FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
||||
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
|
||||
IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
|
||||
OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifndef __MILKDROP_DEFINES_H__
|
||||
#define __MILKDROP_DEFINES_H__ 1
|
||||
|
||||
// IDENTIFIERS
|
||||
/*
|
||||
#define CURRENT_VERSION 220
|
||||
#define CURRENT_SUBVERSION 0 // 0=first release, 1=a, 2=b, 3=c...
|
||||
#define MODULEDESC "MilkDrop 2.2" // used for module desc (from Winamp/Prefs) + window title for fullscreen mode
|
||||
#define DLLDESC "MilkDrop 2.2"
|
||||
#define NAME "MilkDrop"
|
||||
#define TITLE "MilkDrop"
|
||||
#define CLASSNAME "MilkDrop" // window class name
|
||||
*/
|
||||
#define TEXT_WINDOW_CLASSNAME "MilkDrop Console [VJ Mode]"
|
||||
#define DEBUGFILE "c:\\m_debug.txt"
|
||||
//#define CONFIG_INIFILE "milkdrop_config.ini"
|
||||
//#define PRESET_INIFILE "milkdrop_presets.ini"
|
||||
#define DEBUGFILEHEADER "[milkdrop debug file]\n"
|
||||
|
||||
// define this to disable expression evaluation:
|
||||
// (...for some reason, evallib kills the debugger)
|
||||
#ifdef _DEBUG
|
||||
#define _NO_EXPR_ //FIXME
|
||||
#endif
|
||||
|
||||
#define MAX_GRID_X 192//128
|
||||
#define MAX_GRID_Y 144//96
|
||||
#define NUM_WAVES 8
|
||||
#define NUM_MODES 7
|
||||
#define LINEFEED_CONTROL_CHAR 1 // note: this char should be outside the ascii range from SPACE (32) to lowercase 'z' (122)
|
||||
#define MAX_CUSTOM_MESSAGE_FONTS 16 // 0-15
|
||||
#define MAX_CUSTOM_MESSAGES 100 // 00-99
|
||||
#define MAX_CUSTOM_WAVES 4
|
||||
#define MAX_CUSTOM_SHAPES 4
|
||||
|
||||
// aspect ratio makes the motion in the UV field [0..1] cover the screen appropriately,
|
||||
//#define ASPECT_X 1.00
|
||||
//#define ASPECT_Y 0.75 // ~h/w
|
||||
//#define ASPECT_X ( (m_nTexSizeY > m_nTexSizeX) ? m_nTexSizeX/(float)m_nTexSizeY : 1.0f ) //0.75f
|
||||
//#define ASPECT_Y ( (m_nTexSizeX > m_nTexSizeY) ? m_nTexSizeY/(float)m_nTexSizeX : 1.0f ) //0.75f
|
||||
// --> now stored in m_fAspectX, m_fInvAspectY, etc. <--
|
||||
|
||||
#define WM_MILKDROP_SYSTRAY_MSG WM_USER + 407
|
||||
#define IDC_MILKDROP_SYSTRAY_ICON 555
|
||||
#define ID_MILKDROP_SYSTRAY_CLOSE 556
|
||||
//#define ID_MILKDROP_SYSTRAY_RESUME 559
|
||||
//#define ID_MILKDROP_SYSTRAY_SUSPEND 560
|
||||
//#define ID_MILKDROP_SYSTRAY_HOTKEYS 561
|
||||
|
||||
#define NUMERIC_INPUT_MODE_CUST_MSG 0
|
||||
#define NUMERIC_INPUT_MODE_SPRITE 1
|
||||
#define NUMERIC_INPUT_MODE_SPRITE_KILL 2
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,751 @@
|
||||
/*
|
||||
LICENSE
|
||||
-------
|
||||
Copyright 2005-2013 Nullsoft, Inc.
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification,
|
||||
are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright notice,
|
||||
this list of conditions and the following disclaimer.
|
||||
|
||||
* Redistributions in binary form must reproduce the above copyright notice,
|
||||
this list of conditions and the following disclaimer in the documentation
|
||||
and/or other materials provided with the distribution.
|
||||
|
||||
* Neither the name of Nullsoft nor the names of its contributors may be used to
|
||||
endorse or promote products derived from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
|
||||
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||
FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
||||
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
|
||||
IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
|
||||
OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include "api__vis_milk2.h"
|
||||
#include "state.h" // for CBlendableFloat - fix this
|
||||
#include "menu.h"
|
||||
#include "plugin.h"
|
||||
#include <stdio.h>
|
||||
#include <math.h>
|
||||
#include <assert.h>
|
||||
#include "resource.h"
|
||||
|
||||
extern CPlugin g_plugin; // declared in main.cpp
|
||||
|
||||
//----------------------------------------
|
||||
|
||||
CMilkMenuItem::CMilkMenuItem()
|
||||
{
|
||||
WASABI_API_LNGSTRINGW_BUF(IDS_UNTITLED_MENU_ITEM,m_szName,64);
|
||||
m_szToolTip[0] = 0;
|
||||
m_type = MENUITEMTYPE_BUNK;
|
||||
m_fMin = 0.0f;
|
||||
m_fMax = 0.0f;
|
||||
m_var_offset = NULL;
|
||||
m_pCallbackFn = NULL;
|
||||
m_pNext = NULL;
|
||||
m_original_value = NULL;
|
||||
m_nLastCursorPos = 0;
|
||||
m_bEnabled = true;
|
||||
}
|
||||
|
||||
CMilkMenuItem::~CMilkMenuItem()
|
||||
{
|
||||
if (m_pNext)
|
||||
{
|
||||
delete m_pNext;
|
||||
m_pNext = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
//----------------------------------------
|
||||
|
||||
CMilkMenu::CMilkMenu()
|
||||
{
|
||||
//Reset();
|
||||
}
|
||||
|
||||
CMilkMenu::~CMilkMenu()
|
||||
{
|
||||
/*
|
||||
if (m_pFirstChildItem)
|
||||
{
|
||||
delete m_pFirstChildItem;
|
||||
m_pFirstChildItem = NULL;
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
//----------------------------------------
|
||||
|
||||
bool CMilkMenu::ItemIsEnabled(int j)
|
||||
{
|
||||
if (j < m_nChildMenus)
|
||||
return m_ppChildMenu[j]->IsEnabled();
|
||||
|
||||
int i = m_nChildMenus;
|
||||
CMilkMenuItem *pChild = m_pFirstChildItem;
|
||||
while (pChild && i<j)
|
||||
{
|
||||
pChild = pChild->m_pNext;
|
||||
i++;
|
||||
}
|
||||
if (pChild)
|
||||
return pChild->m_bEnabled;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
//----------------------------------------
|
||||
|
||||
void CMilkMenu::EnableItem(wchar_t* szName, bool bEnable)
|
||||
{
|
||||
//search submenus
|
||||
int i = 0;
|
||||
for (i=0; i<m_nChildMenus; i++) {
|
||||
if (!wcscmp(m_ppChildMenu[i]->GetName(), szName))
|
||||
{
|
||||
m_ppChildMenu[i]->Enable(bEnable);
|
||||
if (!bEnable)
|
||||
{
|
||||
while (m_nCurSel > 0 && !ItemIsEnabled(m_nCurSel))
|
||||
m_nCurSel--;
|
||||
if (m_nCurSel==0 && !ItemIsEnabled(m_nCurSel))
|
||||
while (m_nCurSel < m_nChildMenus+m_nChildItems-1 && !ItemIsEnabled(m_nCurSel))
|
||||
m_nCurSel++;
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
//search child items
|
||||
CMilkMenuItem *pChild = m_pFirstChildItem;
|
||||
while (pChild)
|
||||
{
|
||||
if (!wcscmp(pChild->m_szName, szName))
|
||||
{
|
||||
pChild->m_bEnabled = bEnable;
|
||||
if (!bEnable)
|
||||
{
|
||||
while (m_nCurSel > 0 && !ItemIsEnabled(m_nCurSel))
|
||||
m_nCurSel--;
|
||||
if (m_nCurSel==0 && !ItemIsEnabled(m_nCurSel))
|
||||
while (m_nCurSel < m_nChildMenus+m_nChildItems-1 && !ItemIsEnabled(m_nCurSel))
|
||||
m_nCurSel++;
|
||||
}
|
||||
return;
|
||||
}
|
||||
pChild = pChild->m_pNext;
|
||||
i++;
|
||||
}
|
||||
}
|
||||
|
||||
//----------------------------------------
|
||||
|
||||
void CMilkMenu::Reset()
|
||||
{
|
||||
m_pParentMenu = NULL;
|
||||
for (int i=0; i<MAX_CHILD_MENUS; i++)
|
||||
m_ppChildMenu[i] = NULL;
|
||||
m_pFirstChildItem = NULL;
|
||||
WASABI_API_LNGSTRINGW_BUF(IDS_UNTITLED_MENU,m_szMenuName,64);
|
||||
m_nChildMenus = 0;
|
||||
m_nChildItems = 0;
|
||||
m_nCurSel = 0;
|
||||
m_bEditingCurSel = false;
|
||||
m_bEnabled = true;
|
||||
}
|
||||
|
||||
//----------------------------------------
|
||||
|
||||
void CMilkMenu::Init(wchar_t *szName)
|
||||
{
|
||||
Reset();
|
||||
if (szName && szName[0])
|
||||
wcsncpy(m_szMenuName, szName, 64);
|
||||
}
|
||||
|
||||
void CMilkMenu::Finish()
|
||||
{
|
||||
if (m_pFirstChildItem)
|
||||
{
|
||||
delete m_pFirstChildItem;
|
||||
m_pFirstChildItem = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
//----------------------------------------
|
||||
|
||||
void CMilkMenu::AddChildMenu(CMilkMenu *pMenu)
|
||||
{
|
||||
if (m_nChildMenus < MAX_CHILD_MENUS)
|
||||
{
|
||||
m_ppChildMenu[m_nChildMenus++] = pMenu;
|
||||
pMenu->SetParentPointer(this);
|
||||
}
|
||||
}
|
||||
|
||||
//----------------------------------------
|
||||
|
||||
void CMilkMenu::AddItem(wchar_t *szName, void *var, MENUITEMTYPE type, wchar_t *szToolTip,
|
||||
float min, float max, MilkMenuCallbackFnPtr pCallback,
|
||||
unsigned int wParam, unsigned int lParam)
|
||||
{
|
||||
CMilkMenuItem *pLastItem = NULL;
|
||||
|
||||
// find last item in linked list
|
||||
if (!m_pFirstChildItem)
|
||||
{
|
||||
// first item
|
||||
m_pFirstChildItem = new CMilkMenuItem;
|
||||
pLastItem = m_pFirstChildItem;
|
||||
}
|
||||
else
|
||||
{
|
||||
pLastItem = m_pFirstChildItem;
|
||||
while (pLastItem->m_pNext)
|
||||
pLastItem = pLastItem->m_pNext;
|
||||
|
||||
// allocate a new CMilkMenuItem
|
||||
pLastItem->m_pNext = new CMilkMenuItem;
|
||||
pLastItem = pLastItem->m_pNext;
|
||||
}
|
||||
|
||||
// set its attributes
|
||||
wcsncpy(pLastItem->m_szName, szName, 64);
|
||||
wcsncpy(pLastItem->m_szToolTip, szToolTip, 1024);
|
||||
pLastItem->m_var_offset = (size_t)var - (size_t)(g_plugin.m_pState);
|
||||
pLastItem->m_type = type;
|
||||
pLastItem->m_fMin = min;
|
||||
pLastItem->m_fMax = max;
|
||||
pLastItem->m_wParam = wParam;
|
||||
pLastItem->m_lParam = lParam;
|
||||
if ((type==MENUITEMTYPE_LOGBLENDABLE || type==MENUITEMTYPE_LOGFLOAT) && min==max)
|
||||
{
|
||||
// special defaults
|
||||
pLastItem->m_fMin = 0.01f;
|
||||
pLastItem->m_fMax = 100.0f;
|
||||
}
|
||||
pLastItem->m_pCallbackFn = pCallback;
|
||||
|
||||
m_nChildItems++;
|
||||
}
|
||||
|
||||
//----------------------------------------
|
||||
|
||||
void MyMenuTextOut(eFontIndex font_index, wchar_t* str, DWORD color, RECT* pRect, int bCalcRect, RECT* pCalcRect)
|
||||
{
|
||||
if (bCalcRect)
|
||||
{
|
||||
RECT t = *pRect;
|
||||
pRect->top += g_plugin.m_text.DrawTextW(g_plugin.GetFont(font_index), str, -1, &t, DT_SINGLELINE | DT_END_ELLIPSIS | DT_CALCRECT, 0xFFFFFFFF, false);
|
||||
pCalcRect->bottom += t.bottom - t.top;
|
||||
//if (pCalcRect->bottom > pRect->bottom)
|
||||
// pCalcRect->bottom = pRect->bottom;
|
||||
pCalcRect->right = max(pCalcRect->right, pCalcRect->left + t.right - t.left);
|
||||
}
|
||||
else
|
||||
{
|
||||
pRect->top += g_plugin.m_text.DrawTextW(g_plugin.GetFont(font_index), str, -1, pRect, DT_SINGLELINE | DT_END_ELLIPSIS, color, false);
|
||||
}
|
||||
}
|
||||
|
||||
void CMilkMenu::DrawMenu(RECT rect, int xR, int yB, int bCalcRect, RECT* pCalcRect)
|
||||
{
|
||||
// 'rect' is the bounding rectangle in which we're allowed to draw the menu;
|
||||
// it's .top member is incremented as we draw downward.
|
||||
// if bCalcRect==1, then we return pCalcRect as the area that the menu actually
|
||||
// occupies, excluding any tooltips.
|
||||
|
||||
if (bCalcRect!=0 && pCalcRect==NULL)
|
||||
return;
|
||||
|
||||
if (bCalcRect)
|
||||
{
|
||||
pCalcRect->left = rect.left;
|
||||
pCalcRect->right = rect.left;
|
||||
pCalcRect->top = rect.top;
|
||||
pCalcRect->bottom = rect.top;
|
||||
}
|
||||
|
||||
if (!m_bEditingCurSel)
|
||||
{
|
||||
int nLines = (rect.bottom - rect.top - PLAYLIST_INNER_MARGIN*2) / g_plugin.GetFontHeight(SIMPLE_FONT) - 1; // save 1 line for the tooltip
|
||||
if (nLines<1) return;
|
||||
int nStart = (m_nCurSel/nLines)*nLines;
|
||||
|
||||
int nLinesDrawn = 0;
|
||||
int i = 0;
|
||||
for (i=0; i < m_nChildMenus; i++)
|
||||
{
|
||||
if (i >= nStart && i < nStart+nLines)
|
||||
{
|
||||
//rect.top += g_plugin.GetFont(SIMPLE_FONT)->DrawText(m_ppChildMenu[i]->m_szMenuName, -1, pRect, DT_SINGLELINE | DT_END_ELLIPSIS, (i == m_nCurSel) ? MENU_HILITE_COLOR : MENU_COLOR);
|
||||
if (m_ppChildMenu[i]->IsEnabled()) {
|
||||
MyMenuTextOut(SIMPLE_FONT, m_ppChildMenu[i]->m_szMenuName, (i == m_nCurSel) ? MENU_HILITE_COLOR : MENU_COLOR, &rect, bCalcRect, pCalcRect);
|
||||
nLinesDrawn++;
|
||||
}
|
||||
|
||||
if (g_plugin.m_bShowMenuToolTips && i == m_nCurSel && !bCalcRect)
|
||||
{
|
||||
// tooltip:
|
||||
g_plugin.DrawTooltip(WASABI_API_LNGSTRINGW(IDS_SZ_MENU_NAV_TOOLTIP), xR, yB);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
CMilkMenuItem *pItem = m_pFirstChildItem;
|
||||
|
||||
while (pItem && nLinesDrawn < nStart+nLines)
|
||||
{
|
||||
if (!pItem->m_bEnabled)
|
||||
{
|
||||
pItem = pItem->m_pNext;
|
||||
i++;
|
||||
continue;
|
||||
}
|
||||
|
||||
size_t addr = pItem->m_var_offset + (size_t)g_plugin.m_pState;
|
||||
if (i >= nStart)
|
||||
{
|
||||
wchar_t szItemText[256];
|
||||
switch(pItem->m_type)
|
||||
{
|
||||
case MENUITEMTYPE_STRING:
|
||||
lstrcpyW(szItemText, pItem->m_szName);
|
||||
break;
|
||||
case MENUITEMTYPE_BOOL:
|
||||
swprintf(szItemText, L"%s [%s]", pItem->m_szName,
|
||||
WASABI_API_LNGSTRINGW(*((bool *)(addr)) ? IDS_ON : IDS_OFF));
|
||||
break;
|
||||
default:
|
||||
lstrcpyW(szItemText, pItem->m_szName);
|
||||
break;
|
||||
}
|
||||
|
||||
if (i == m_nCurSel)
|
||||
{
|
||||
MyMenuTextOut(SIMPLE_FONT, szItemText, MENU_HILITE_COLOR, &rect, bCalcRect, pCalcRect);
|
||||
|
||||
if (g_plugin.m_bShowMenuToolTips && !bCalcRect)
|
||||
{
|
||||
// tooltip:
|
||||
g_plugin.DrawTooltip(pItem->m_szToolTip, xR, yB);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
MyMenuTextOut(SIMPLE_FONT, szItemText, MENU_COLOR, &rect, bCalcRect, pCalcRect);
|
||||
}
|
||||
nLinesDrawn++;
|
||||
}
|
||||
|
||||
pItem = pItem->m_pNext;
|
||||
i++;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// editing current selection
|
||||
|
||||
// find the item
|
||||
CMilkMenuItem *pItem = m_pFirstChildItem;
|
||||
for (int i=m_nChildMenus; i < m_nCurSel; i++)
|
||||
pItem = pItem->m_pNext;
|
||||
size_t addr = pItem->m_var_offset + (size_t)g_plugin.m_pState;
|
||||
|
||||
wchar_t buf[256];
|
||||
|
||||
MyMenuTextOut(SIMPLE_FONT, WASABI_API_LNGSTRINGW(IDS_USE_UP_DOWN_ARROW_KEYS), MENU_COLOR, &rect, bCalcRect, pCalcRect);
|
||||
swprintf(buf, WASABI_API_LNGSTRINGW(IDS_CURRENT_VALUE_OF_X), pItem->m_szName);
|
||||
MyMenuTextOut(SIMPLE_FONT, buf, MENU_COLOR, &rect, bCalcRect, pCalcRect);
|
||||
|
||||
switch(pItem->m_type)
|
||||
{
|
||||
case MENUITEMTYPE_INT:
|
||||
swprintf(buf, L" %d ", *((int*)(addr)) );
|
||||
break;
|
||||
case MENUITEMTYPE_FLOAT:
|
||||
case MENUITEMTYPE_LOGFLOAT:
|
||||
swprintf(buf, L" %5.3f ", *((float*)(addr)) );
|
||||
break;
|
||||
case MENUITEMTYPE_BLENDABLE:
|
||||
case MENUITEMTYPE_LOGBLENDABLE:
|
||||
swprintf(buf, L" %5.3f ", ((CBlendableFloat*)addr)->eval(-1) );
|
||||
break;
|
||||
default:
|
||||
lstrcpyW(buf, L" ? ");
|
||||
break;
|
||||
}
|
||||
|
||||
MyMenuTextOut(SIMPLE_FONT, buf, MENU_HILITE_COLOR, &rect, bCalcRect, pCalcRect);
|
||||
|
||||
// tooltip:
|
||||
if (g_plugin.m_bShowMenuToolTips && !bCalcRect)
|
||||
{
|
||||
g_plugin.DrawTooltip(pItem->m_szToolTip, xR, yB);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void CMilkMenu::OnWaitStringAccept(wchar_t *szNewString)
|
||||
{
|
||||
m_bEditingCurSel = false;
|
||||
|
||||
// find the item
|
||||
CMilkMenuItem *pItem = m_pFirstChildItem;
|
||||
for (int i=m_nChildMenus; i < m_nCurSel; i++)
|
||||
pItem = pItem->m_pNext;
|
||||
size_t addr = pItem->m_var_offset + (size_t)g_plugin.m_pState;
|
||||
|
||||
assert(pItem->m_type == MENUITEMTYPE_STRING);
|
||||
|
||||
// apply the edited string
|
||||
lstrcpyW((wchar_t *)(addr), szNewString);
|
||||
|
||||
// if user gave us a callback function pointer, call it now
|
||||
if (pItem->m_pCallbackFn)
|
||||
{
|
||||
pItem->m_pCallbackFn(0, 0);
|
||||
}
|
||||
|
||||
// remember the last cursor position
|
||||
pItem->m_nLastCursorPos = g_plugin.m_waitstring.nCursorPos;
|
||||
}
|
||||
|
||||
//----------------------------------------
|
||||
|
||||
LRESULT CMilkMenu::HandleKeydown(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
// all WM_KEYDOWNS that your app gets when a menu is up should be handled here,
|
||||
// by the menu that is currently active.
|
||||
|
||||
// return value: FALSE if it handled the key; TRUE if it didn't
|
||||
|
||||
int nRepeat = LOWORD(lParam);
|
||||
int rep;
|
||||
|
||||
if (!m_bEditingCurSel)
|
||||
{
|
||||
switch(wParam)
|
||||
{
|
||||
case VK_UP:
|
||||
for (rep=0; rep<nRepeat; rep++)
|
||||
{
|
||||
if (m_nCurSel==0)
|
||||
break;
|
||||
do {
|
||||
m_nCurSel--;
|
||||
} while (m_nCurSel > 0 && !ItemIsEnabled(m_nCurSel));
|
||||
}
|
||||
if (m_nCurSel < 0) m_nCurSel = 0;//m_nChildMenus + m_nChildItems - 1;
|
||||
while (m_nCurSel < m_nChildMenus + m_nChildItems - 1 && !ItemIsEnabled(m_nCurSel))
|
||||
m_nCurSel++;
|
||||
return 0; // we processed (or absorbed) the key
|
||||
|
||||
case VK_DOWN:
|
||||
for (rep=0; rep<nRepeat; rep++)
|
||||
{
|
||||
if (m_nCurSel == m_nChildMenus + m_nChildItems - 1)
|
||||
break;
|
||||
do {
|
||||
m_nCurSel++;
|
||||
} while (m_nCurSel < m_nChildMenus + m_nChildItems - 1 && !ItemIsEnabled(m_nCurSel));
|
||||
}
|
||||
if (m_nCurSel >= m_nChildMenus + m_nChildItems) m_nCurSel = m_nChildMenus + m_nChildItems - 1;//0;
|
||||
while (m_nCurSel > 0 && !ItemIsEnabled(m_nCurSel))
|
||||
m_nCurSel--;
|
||||
return 0; // we processed (or absorbed) the key
|
||||
|
||||
case VK_HOME:
|
||||
m_nCurSel = 0;
|
||||
return 0; // we processed (or absorbed) the key
|
||||
|
||||
case VK_END:
|
||||
m_nCurSel = m_nChildMenus + m_nChildItems - 1;
|
||||
return 0; // we processed (or absorbed) the key
|
||||
|
||||
case VK_ESCAPE:
|
||||
g_plugin.m_UI_mode = UI_REGULAR;
|
||||
return 0; // we processed (or absorbed) the key
|
||||
|
||||
case VK_BACK:
|
||||
case VK_LEFT:
|
||||
if (m_pParentMenu)
|
||||
g_plugin.m_pCurMenu = m_pParentMenu;
|
||||
else
|
||||
g_plugin.m_UI_mode = UI_REGULAR; // exit the menu
|
||||
return 0; // we processed (or absorbed) the key
|
||||
|
||||
case VK_RETURN:
|
||||
case VK_RIGHT:
|
||||
case VK_SPACE:
|
||||
if (m_nCurSel < m_nChildMenus)
|
||||
{
|
||||
// go to sub-menu
|
||||
g_plugin.m_pCurMenu = m_ppChildMenu[m_nCurSel];
|
||||
}
|
||||
else
|
||||
{
|
||||
// find the item
|
||||
CMilkMenuItem *pItem = GetCurItem();
|
||||
size_t addr = pItem->m_var_offset + (size_t)g_plugin.m_pState;
|
||||
|
||||
float fTemp;
|
||||
|
||||
// begin editing the item
|
||||
|
||||
switch(pItem->m_type)
|
||||
{
|
||||
case MENUITEMTYPE_UIMODE:
|
||||
g_plugin.m_UI_mode = (ui_mode)pItem->m_wParam;
|
||||
|
||||
if (g_plugin.m_UI_mode==UI_IMPORT_WAVE ||
|
||||
g_plugin.m_UI_mode==UI_EXPORT_WAVE ||
|
||||
g_plugin.m_UI_mode==UI_IMPORT_SHAPE ||
|
||||
g_plugin.m_UI_mode==UI_EXPORT_SHAPE)
|
||||
{
|
||||
g_plugin.m_bPresetLockedByCode = true;
|
||||
|
||||
// enter WaitString mode
|
||||
g_plugin.m_waitstring.bActive = true;
|
||||
g_plugin.m_waitstring.bFilterBadChars = false;
|
||||
g_plugin.m_waitstring.bDisplayAsCode = false;
|
||||
g_plugin.m_waitstring.nSelAnchorPos = -1;
|
||||
g_plugin.m_waitstring.nMaxLen = min(sizeof(g_plugin.m_waitstring.szText)-1, MAX_PATH - wcslen(g_plugin.GetPresetDir()) - 6); // 6 for the extension + null char. We set this because win32 LoadFile, MoveFile, etc. barf if the path+filename+ext are > MAX_PATH chars.
|
||||
swprintf(g_plugin.m_waitstring.szText, L"%sfile.dat", g_plugin.m_szPresetDir);
|
||||
if (g_plugin.m_UI_mode==UI_IMPORT_WAVE || g_plugin.m_UI_mode==UI_IMPORT_SHAPE)
|
||||
WASABI_API_LNGSTRINGW_BUF(IDS_LOAD_FROM_FILE,g_plugin.m_waitstring.szPrompt,512);
|
||||
else
|
||||
WASABI_API_LNGSTRINGW_BUF(IDS_SAVE_TO_FILE,g_plugin.m_waitstring.szPrompt,512);
|
||||
g_plugin.m_waitstring.szToolTip[0] = 0;
|
||||
g_plugin.m_waitstring.nCursorPos = wcslen(g_plugin.m_waitstring.szText); // set the starting edit position
|
||||
}
|
||||
break;
|
||||
case MENUITEMTYPE_BOOL:
|
||||
*((bool *)addr) = !(*((bool *)addr));
|
||||
break;
|
||||
case MENUITEMTYPE_INT:
|
||||
m_bEditingCurSel = true;
|
||||
pItem->m_original_value = (LPARAM)(*((int*)(addr)));
|
||||
break;
|
||||
case MENUITEMTYPE_FLOAT:
|
||||
case MENUITEMTYPE_LOGFLOAT:
|
||||
m_bEditingCurSel = true;
|
||||
pItem->m_original_value = (LPARAM)(*((float*)(addr))*10000L);
|
||||
break;
|
||||
case MENUITEMTYPE_BLENDABLE:
|
||||
case MENUITEMTYPE_LOGBLENDABLE:
|
||||
m_bEditingCurSel = true;
|
||||
{
|
||||
//CBlendableFloat *p = (CBlendableFloat*)(pItem->m_pVariable);
|
||||
//*p = 0.99f;
|
||||
fTemp = ((CBlendableFloat*)addr)->eval(-1);//p->eval(-1);
|
||||
}
|
||||
pItem->m_original_value = (LPARAM)(fTemp*10000L);
|
||||
break;
|
||||
case MENUITEMTYPE_STRING:
|
||||
// enter waitstring mode. ***This function will cease to receive keyboard input
|
||||
// while the string is being edited***
|
||||
g_plugin.m_UI_mode = UI_EDIT_MENU_STRING;
|
||||
g_plugin.m_waitstring.bActive = true;
|
||||
g_plugin.m_waitstring.bFilterBadChars = false;
|
||||
g_plugin.m_waitstring.bDisplayAsCode = true;
|
||||
g_plugin.m_waitstring.nSelAnchorPos = -1;
|
||||
g_plugin.m_waitstring.nMaxLen = pItem->m_wParam ? pItem->m_wParam : 8190;
|
||||
g_plugin.m_waitstring.nMaxLen = min(g_plugin.m_waitstring.nMaxLen, sizeof(g_plugin.m_waitstring.szText)-16);
|
||||
//lstrcpyW(g_plugin.m_waitstring.szText, (wchar_t *)addr);
|
||||
lstrcpyA((char*)g_plugin.m_waitstring.szText, (char*)addr);
|
||||
swprintf(g_plugin.m_waitstring.szPrompt, WASABI_API_LNGSTRINGW(IDS_ENTER_THE_NEW_STRING), pItem->m_szName);
|
||||
lstrcpyW(g_plugin.m_waitstring.szToolTip, pItem->m_szToolTip);
|
||||
g_plugin.m_waitstring.nCursorPos = strlen/*wcslen*/((char*)g_plugin.m_waitstring.szText);
|
||||
if (pItem->m_nLastCursorPos < g_plugin.m_waitstring.nCursorPos)
|
||||
g_plugin.m_waitstring.nCursorPos = pItem->m_nLastCursorPos;
|
||||
break;
|
||||
/*
|
||||
case MENUITEMTYPE_OSC:
|
||||
m_bEditingCurSel = true;
|
||||
pItem->m_bEditingSubSel = false;
|
||||
break;
|
||||
*/
|
||||
}
|
||||
}
|
||||
return 0; // we processed (or absorbed) the key
|
||||
|
||||
default:
|
||||
// key wasn't handled
|
||||
return TRUE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
else // m_bEditingCurSel
|
||||
{
|
||||
float fMult = 1.0f;
|
||||
bool bDec;
|
||||
|
||||
// find the item
|
||||
CMilkMenuItem *pItem = m_pFirstChildItem;
|
||||
for (int i=m_nChildMenus; i < m_nCurSel; i++)
|
||||
pItem = pItem->m_pNext;
|
||||
size_t addr = pItem->m_var_offset + (size_t)g_plugin.m_pState;
|
||||
|
||||
switch(wParam)
|
||||
{
|
||||
case VK_ESCAPE: // exit Edit mode & restore original value
|
||||
|
||||
switch(pItem->m_type)
|
||||
{
|
||||
case MENUITEMTYPE_INT:
|
||||
m_bEditingCurSel = false;
|
||||
*((int *)addr) = (int)pItem->m_original_value;
|
||||
break;
|
||||
case MENUITEMTYPE_FLOAT:
|
||||
m_bEditingCurSel = false;
|
||||
*((float *)addr) = ((float)pItem->m_original_value)*0.0001f;
|
||||
break;
|
||||
case MENUITEMTYPE_LOGFLOAT:
|
||||
m_bEditingCurSel = false;
|
||||
*((float *)addr) = ((float)pItem->m_original_value)*0.0001f;
|
||||
break;
|
||||
case MENUITEMTYPE_BLENDABLE:
|
||||
m_bEditingCurSel = false;
|
||||
*((CBlendableFloat *)(addr)) = ((float)(pItem->m_original_value))*0.0001f;
|
||||
break;
|
||||
case MENUITEMTYPE_LOGBLENDABLE:
|
||||
m_bEditingCurSel = false;
|
||||
*((CBlendableFloat *)(addr)) = ((float)(pItem->m_original_value))*0.0001f;
|
||||
break;
|
||||
//case MENUITEMTYPE_STRING:
|
||||
// won't ever happen - see OnWaitStringCancel()
|
||||
}
|
||||
return 0;
|
||||
|
||||
case VK_RETURN:
|
||||
|
||||
//if (pItem->m_type == MENUITEMTYPE_STRING)
|
||||
// ... won't ever happen - see OnWaitStringAccept()
|
||||
|
||||
m_bEditingCurSel = false;
|
||||
return 0;
|
||||
|
||||
|
||||
case VK_NEXT:
|
||||
case VK_PRIOR:
|
||||
fMult *= 10.0f;
|
||||
// break intentionally left out here...
|
||||
case VK_UP:
|
||||
case VK_DOWN:
|
||||
|
||||
{
|
||||
USHORT mask = 1 << (sizeof(USHORT)*8 - 1); // we want the highest-order bit
|
||||
bool bShiftHeldDown = (GetKeyState(VK_SHIFT) & mask) != 0;
|
||||
//bool bCtrlHeldDown = (GetKeyState(VK_CONTROL) & mask) != 0;
|
||||
if (bShiftHeldDown && (wParam==VK_UP || wParam==VK_DOWN))
|
||||
fMult *= 0.1f;
|
||||
}
|
||||
|
||||
bDec = (wParam == VK_DOWN || wParam == VK_NEXT);
|
||||
|
||||
switch(pItem->m_type)
|
||||
{
|
||||
case MENUITEMTYPE_INT:
|
||||
{
|
||||
int *pInt = ((int *)addr);
|
||||
if (fMult<1) fMult=1;
|
||||
(*pInt) += (int)((bDec) ? -fMult : fMult);
|
||||
if (*pInt < pItem->m_fMin) *pInt = (int)pItem->m_fMin;
|
||||
if (*pInt > pItem->m_fMax) *pInt = (int)pItem->m_fMax;
|
||||
}
|
||||
break;
|
||||
case MENUITEMTYPE_FLOAT:
|
||||
{
|
||||
float *pFloat = ((float *)addr);
|
||||
float fInc = (pItem->m_fMax - pItem->m_fMin)*0.01f*fMult;
|
||||
(*pFloat) += (bDec) ? -fInc : fInc;
|
||||
if (*pFloat < pItem->m_fMin) *pFloat = pItem->m_fMin;
|
||||
if (*pFloat > pItem->m_fMax) *pFloat = pItem->m_fMax;
|
||||
}
|
||||
break;
|
||||
case MENUITEMTYPE_LOGFLOAT:
|
||||
{
|
||||
float *pFloat = ((float *)addr);
|
||||
(*pFloat) *= (bDec) ? powf(1.0f/1.01f, fMult) : powf(1.01f, fMult);
|
||||
if (*pFloat < pItem->m_fMin) *pFloat = pItem->m_fMin;
|
||||
if (*pFloat > pItem->m_fMax) *pFloat = pItem->m_fMax;
|
||||
}
|
||||
break;
|
||||
case MENUITEMTYPE_BLENDABLE:
|
||||
{
|
||||
CBlendableFloat *pBlend = ((CBlendableFloat *)addr);
|
||||
float fInc = (pItem->m_fMax - pItem->m_fMin)*0.01f*fMult;
|
||||
(*pBlend) += (bDec) ? -fInc : fInc;
|
||||
if (pBlend->eval(-1) < pItem->m_fMin) *pBlend = pItem->m_fMin;
|
||||
if (pBlend->eval(-1) > pItem->m_fMax) *pBlend = pItem->m_fMax;
|
||||
}
|
||||
break;
|
||||
case MENUITEMTYPE_LOGBLENDABLE:
|
||||
{
|
||||
CBlendableFloat *pBlend = ((CBlendableFloat *)addr);
|
||||
(*pBlend) *= (bDec) ? powf(1.0f/1.01f, fMult) : powf(1.01f, fMult);
|
||||
if (pBlend->eval(-1) < pItem->m_fMin) *pBlend = pItem->m_fMin;
|
||||
if (pBlend->eval(-1) > pItem->m_fMax) *pBlend = pItem->m_fMax;
|
||||
}
|
||||
break;
|
||||
/*
|
||||
case MENUITEMTYPE_OSC:
|
||||
if (pItem->m_bEditingSubSel)
|
||||
{
|
||||
if (wParam == VK_UP)
|
||||
{
|
||||
pItem->m_nSubSel--;
|
||||
if (pItem->m_nSubSel < 0) pItem->m_nSubSel = 4;
|
||||
}
|
||||
else if (wParam == VK_DOWN)
|
||||
{
|
||||
pItem->m_nSubSel++;
|
||||
if (pItem->m_nSubSel > 4) pItem->m_nSubSel = 0;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
switch(pItem->m_nSubSel)
|
||||
{
|
||||
also to do: make 'drawtext' draw it properly
|
||||
|
||||
case 0:
|
||||
fixme - what are the bounds for each type? and are incs constant or log?
|
||||
break;
|
||||
case 1:
|
||||
fixme
|
||||
break;
|
||||
case 2:
|
||||
fixme
|
||||
break;
|
||||
case 3:
|
||||
fixme
|
||||
break;
|
||||
case 4:
|
||||
fixme
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
*/
|
||||
}
|
||||
return 0;
|
||||
|
||||
default:
|
||||
// key wasn't handled
|
||||
return TRUE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
@@ -0,0 +1,126 @@
|
||||
/*
|
||||
LICENSE
|
||||
-------
|
||||
Copyright 2005-2013 Nullsoft, Inc.
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification,
|
||||
are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright notice,
|
||||
this list of conditions and the following disclaimer.
|
||||
|
||||
* Redistributions in binary form must reproduce the above copyright notice,
|
||||
this list of conditions and the following disclaimer in the documentation
|
||||
and/or other materials provided with the distribution.
|
||||
|
||||
* Neither the name of Nullsoft nor the names of its contributors may be used to
|
||||
endorse or promote products derived from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
|
||||
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||
FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
||||
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
|
||||
IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
|
||||
OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifndef _MILKDROP_MENU_H_
|
||||
#define _MILKDROP_MENU_H_ 1
|
||||
|
||||
//----------------------------------------
|
||||
|
||||
#include <windows.h>
|
||||
|
||||
//----------------------------------------
|
||||
|
||||
typedef enum {
|
||||
MENUITEMTYPE_BUNK,
|
||||
MENUITEMTYPE_BOOL,
|
||||
MENUITEMTYPE_INT,
|
||||
MENUITEMTYPE_FLOAT,
|
||||
MENUITEMTYPE_LOGFLOAT,
|
||||
MENUITEMTYPE_BLENDABLE,
|
||||
MENUITEMTYPE_LOGBLENDABLE,
|
||||
MENUITEMTYPE_STRING,
|
||||
MENUITEMTYPE_UIMODE,
|
||||
//MENUITEMTYPE_OSC,
|
||||
} MENUITEMTYPE;
|
||||
#define MAX_CHILD_MENUS 16
|
||||
typedef void (*MilkMenuCallbackFnPtr)(LPARAM param1, LPARAM param2); // MilkMenuCallbackFnPtr is synonym for "pointer to function returning void, and taking 2 lparams"
|
||||
|
||||
//----------------------------------------
|
||||
class CMilkMenuItem
|
||||
{
|
||||
public:
|
||||
CMilkMenuItem();
|
||||
~CMilkMenuItem();
|
||||
|
||||
wchar_t m_szName[64];
|
||||
wchar_t m_szToolTip[1024];
|
||||
MENUITEMTYPE m_type;
|
||||
float m_fMin; // note: has different meanings based on the MENUITEMTYPE
|
||||
float m_fMax; // note: has different meanings based on the MENUITEMTYPE
|
||||
unsigned int m_wParam;
|
||||
unsigned int m_lParam;
|
||||
MilkMenuCallbackFnPtr m_pCallbackFn; // Callback Function pointer; if non-NULL, this functino will be called whenever the menu item is modified by the user.
|
||||
ptrdiff_t m_var_offset; // dist of variable's mem loc., in bytes, from pg->m_pState.
|
||||
LPARAM m_original_value; // can hold a float or int
|
||||
int m_nLastCursorPos; // for strings; remembers most recent pos. of the cursor
|
||||
bool m_bEnabled;
|
||||
|
||||
// special data used for MENUITEMTYPE_OSCILLATOR:
|
||||
//int m_nSubSel;
|
||||
//bool m_bEditingSubSel;
|
||||
|
||||
CMilkMenuItem *m_pNext;
|
||||
};
|
||||
//----------------------------------------
|
||||
|
||||
//----------------------------------------
|
||||
class CMilkMenu
|
||||
{
|
||||
public:
|
||||
CMilkMenu();
|
||||
~CMilkMenu();
|
||||
|
||||
void Init(wchar_t *szName);
|
||||
void Finish();
|
||||
void AddChildMenu(CMilkMenu *pChildMenu);
|
||||
void AddItem(wchar_t *szName, void *var, MENUITEMTYPE type, wchar_t *szToolTip,
|
||||
float min=0, float max=0, MilkMenuCallbackFnPtr pCallback=NULL,
|
||||
unsigned int wParam=0, unsigned int lParam=0);
|
||||
void SetParentPointer(CMilkMenu *pParentMenu) { m_pParentMenu = pParentMenu; }
|
||||
LRESULT HandleKeydown(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam);
|
||||
void DrawMenu(RECT rect, int xR, int yB, int bCalcRect=0, RECT* pCalcRect=NULL);
|
||||
void OnWaitStringAccept(wchar_t *szNewString);
|
||||
void EnableItem(wchar_t* szName, bool bEnable);
|
||||
CMilkMenuItem* GetCurItem() // NOTE: ONLY WORKS IF AN *ITEM* IS HIGHLIGHTED; NOT A CHILD MENU
|
||||
{
|
||||
CMilkMenuItem *pItem = m_pFirstChildItem;
|
||||
for (int i=m_nChildMenus; i < m_nCurSel; i++)
|
||||
pItem = pItem->m_pNext;
|
||||
return pItem;
|
||||
}
|
||||
const wchar_t* GetName() { return m_szMenuName; }
|
||||
void Enable(bool bEnabled) { m_bEnabled = bEnabled; }
|
||||
bool IsEnabled() { return m_bEnabled; }
|
||||
bool ItemIsEnabled(int i);
|
||||
|
||||
protected:
|
||||
void Reset();
|
||||
CMilkMenu *m_pParentMenu;
|
||||
CMilkMenu *m_ppChildMenu[MAX_CHILD_MENUS]; // pointers are kept here, but these should be cleaned up by the app.
|
||||
CMilkMenuItem *m_pFirstChildItem; // linked list; these are dynamically allocated, and automatically cleaned up in destructor
|
||||
wchar_t m_szMenuName[64];
|
||||
int m_nChildMenus;
|
||||
int m_nChildItems;
|
||||
int m_nCurSel;
|
||||
bool m_bEditingCurSel;
|
||||
bool m_bEnabled;
|
||||
};
|
||||
//----------------------------------------
|
||||
|
||||
#endif //_MILKDROP_MENU_H_
|
||||
@@ -0,0 +1,439 @@
|
||||
; LICENSE
|
||||
; -------
|
||||
; Copyright 2005-2013 Nullsoft, Inc.
|
||||
; All rights reserved.
|
||||
;
|
||||
; Redistribution and use in source and binary forms, with or without modification,
|
||||
; are permitted provided that the following conditions are met:
|
||||
;
|
||||
; * Redistributions of source code must retain the above copyright notice,
|
||||
; this list of conditions and the following disclaimer.
|
||||
;
|
||||
; * Redistributions in binary form must reproduce the above copyright notice,
|
||||
; this list of conditions and the following disclaimer in the documentation
|
||||
; and/or other materials provided with the distribution.
|
||||
;
|
||||
; * Neither the name of Nullsoft nor the names of its contributors may be used to
|
||||
; endorse or promote products derived from this software without specific prior written permission.
|
||||
;
|
||||
; THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
|
||||
; IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||
; FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
||||
; CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
; DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
; DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
|
||||
; IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
|
||||
; OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
; ----------------------------------------------------------------
|
||||
; NOTE: this .nsi script was last built with 'makensis.exe'
|
||||
; version 1.98. If you go to install it (unchanged) and get errors,
|
||||
; try tracking down that older version, or try to figure out what
|
||||
; has changed since then. You can get NSIS at:
|
||||
;
|
||||
; http://www.nullsoft.com/free/nsis/
|
||||
;
|
||||
; This installer will produce a single EXE file that, when run,
|
||||
; will decompress and install your plugin and all of its data files
|
||||
; to Winamp 2 or Winamp 3.
|
||||
; ----------------------------------------------------------------
|
||||
; MODIFYING THIS SCRIPT TO CREATE AN INSTALLER FOR YOUR OWN PLUGIN:
|
||||
; ----------------------------------------------------------------
|
||||
; 1) there are three sections below, each marked 'EDIT THIS SECTION
|
||||
; [x/3]' where 'x' is the section number. These are the 3
|
||||
; places where you need to make changes to customize this
|
||||
; installer script for your particular plugin. Go to each
|
||||
; and make the changes, reading the comments there for
|
||||
; more information.
|
||||
; 2) download NSIS from http://www.nullsoft.com/free/nsis/, if you
|
||||
; haven't already.
|
||||
; 3) run the command 'makensis.exe installer.nsi' to build
|
||||
; the executable. (note: ignore the warning message about
|
||||
; 'InstallRegKey' being used multiple times; this is necessary
|
||||
; to determine whether Winamp 2 or 3 is a better candidate
|
||||
; for the install.)
|
||||
; ----------------------------------------------------------------
|
||||
; WHAT THIS INSTALLER SCRIPT DOES:
|
||||
; ----------------------------------------------------------------
|
||||
; If Winamp 2 is installed, it will install your plugin to Winamp 2,
|
||||
; in the directory Winamp\Plugins (or whatever is specified as the
|
||||
; vis plugins path, in Winamp\winamp.ini). It will also select
|
||||
; the plugin as the current plugin. (Note that Winamp must be
|
||||
; closed to do this, so if it's open, the installer will ask the
|
||||
; user to close it before proceeding.) At the end of a successful
|
||||
; install, it asks if they'd like to run Winamp.
|
||||
;
|
||||
; If Winamp 2 is not present but Winamp 3 is, or if the user manually
|
||||
; selects the Winamp 3 directory to install to, the plugin will be
|
||||
; installed to Winamp 3 as a classic visualization plugin, to the
|
||||
; directory Winamp3\Plugins. At install time, if ClassicVis is not
|
||||
; installed, it will prompt the user to go download it. If they
|
||||
; don't download it, it will tell them the installation failed.
|
||||
; If they already had it, or after they presumably download it,
|
||||
; the installer will briefly tell them how to select their new
|
||||
; plugin and run it in Winamp 3, using ClassicVis. Finally, at
|
||||
; the end of a successful install, it asks if they'd like to run
|
||||
; Winamp 3.
|
||||
; ----------------------------------------------------------------
|
||||
|
||||
|
||||
|
||||
; -------------------- EDIT THIS SECTION [1/3] --------------------
|
||||
; -------------------- EDIT THIS SECTION [1/3] --------------------
|
||||
; -------------------- EDIT THIS SECTION [1/3] --------------------
|
||||
|
||||
!define PLUGIN_NAME "MilkDrop 2" ; Brief name of the component. Can have spaces in it.
|
||||
!define INSTALL_CAPTION "MilkDrop 2.2 Setup" ; Caption for the installer dialog
|
||||
!define PLUGIN_DLL "vis_milk2.dll" ; The filename of the actual plugin
|
||||
!define PLUGIN_OUTFILE "milkdrop_2.exe" ; Name of the installer to create
|
||||
|
||||
; ----------------------- END SECTION [1/3] -----------------------
|
||||
; ----------------------- END SECTION [1/3] -----------------------
|
||||
; ----------------------- END SECTION [1/3] -----------------------
|
||||
|
||||
; ----------------------------------------------------------------
|
||||
Name ${PLUGIN_NAME}
|
||||
Caption "${INSTALL_CAPTION}"
|
||||
OutFile ${PLUGIN_OUTFILE}
|
||||
; ----------------------------------------------------------------
|
||||
|
||||
; to determine the install directory, we start with Program Files\Winamp.
|
||||
; then, if winamp 3 is found, override this and use that directory.
|
||||
; finally, if winamp 2 is found, override again and use that directory.
|
||||
InstallDir $PROGRAMFILES\Winamp
|
||||
InstallDirRegKey HKEY_LOCAL_MACHINE "Software\Microsoft\Windows\CurrentVersion\Uninstall\Winamp3" "UninstallString"
|
||||
InstallDirRegKey HKEY_LOCAL_MACHINE "Software\Microsoft\Windows\CurrentVersion\Uninstall\Winamp" "UninstallString"
|
||||
DirText \
|
||||
"The installer has determined that this is the path to Winamp.$\rIf it is not correct, please change it. You will not be able to proceed$\runtil a valid path is found." \
|
||||
"Select the directory in which Winamp 2 or 3 is installed:"
|
||||
|
||||
Function .onInit
|
||||
IfFileExists $INSTDIR\winamp.exe End ; else if winamp.exe found (winamp2), we're good
|
||||
IfFileExists $INSTDIR\winamp3.exe End ; if winamp3.exe found (winamp3), we're good
|
||||
IfFileExists $INSTDIR\studio.exe End ; or if studio.exe found (older version of winamp3), we're good
|
||||
; the above will work fine if winamp 2 or 3 is installed,
|
||||
; but will break if winamp 2 or 3 was uninstalled *but the directory remains.*
|
||||
IfFileExists $PROGRAMFILES\Winamp\winamp.exe SelectNaturalWinamp2 ; last but not least, try the default winamp 2 directory
|
||||
IfFileExists $PROGRAMFILES\Winamp3\winamp3.exe SelectNaturalWinamp3 ; otherwise, try the default winamp 3 directory
|
||||
IfFileExists $PROGRAMFILES\Winamp3\studio.exe SelectNaturalWinamp3 ; otherwise, try the default winamp 3 directory
|
||||
; if all of these failed, no good path to Winamp (2 or 3) could be found,
|
||||
; and the 'Next' button will be disabled until the user can specify
|
||||
; the correct folder.
|
||||
Goto End
|
||||
|
||||
SelectNaturalWinamp3:
|
||||
strcpy $INSTDIR $PROGRAMFILES\Winamp3
|
||||
goto End
|
||||
|
||||
SelectNaturalWinamp2:
|
||||
strcpy $INSTDIR $PROGRAMFILES\Winamp
|
||||
goto End
|
||||
|
||||
End:
|
||||
FunctionEnd
|
||||
|
||||
|
||||
Function .onVerifyInstDir
|
||||
IfFileExists $INSTDIR\Winamp.exe DirOk
|
||||
IfFileExists $INSTDIR\Winamp3.exe DirOk
|
||||
IfFileExists $INSTDIR\Studio.exe DirOk
|
||||
Abort ; leaves the directory as the selected one, but disables the 'Next' button...
|
||||
|
||||
DirOk:
|
||||
FunctionEnd
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Function QueryWinampVisPath
|
||||
; input: $INSTDIR, the currently-selected install dir (path to winamp)
|
||||
; output: $1, the path to the winamp vis plugins subdirectory
|
||||
; -for winamp 3x, this is just $INSTDIR\plugins
|
||||
; -for winamp 2x, it comes from the winamp.ini file
|
||||
; (or just $INSTDIR\plugins if there is an error reading it.)
|
||||
IfFileExists $INSTDIR\Winamp.exe CaseWinamp2
|
||||
IfFileExists $INSTDIR\Winamp3.exe CaseWinamp3
|
||||
IfFileExists $INSTDIR\Studio.exe CaseWinamp3 ; legacy check
|
||||
goto CaseImpossible
|
||||
|
||||
CaseWinamp2:
|
||||
StrCpy $1 $INSTDIR\Plugins\MilkDrop2
|
||||
ReadINIStr $8 $INSTDIR\winamp.ini Winamp VisDir
|
||||
StrCmp $8 "" End
|
||||
IfFileExists $8 0 End
|
||||
StrCpy $1 $8 ; update dir
|
||||
goto end
|
||||
|
||||
CaseWinamp3:
|
||||
CaseImpossible:
|
||||
StrCpy $1 $INSTDIR\Plugins\MilkDrop2
|
||||
goto end
|
||||
|
||||
End:
|
||||
FunctionEnd
|
||||
|
||||
|
||||
; The stuff to install
|
||||
Section ""
|
||||
|
||||
CloseWinamp2:
|
||||
; make sure winamp is closed before we 1) try to install files
|
||||
; and 2) (later) edit winamp.ini. for 1), if they're running
|
||||
; (or were running) some other vms-based plugin using
|
||||
; vms_desktop.dll, then if winamp is still open, the installer
|
||||
; could have trouble overwriting vms_desktop.dll, or other files;
|
||||
; the user would get an abort/retry/ignore box, but it's easier
|
||||
; to just play it safe.
|
||||
FindWindow $R0 "winamp v1.x"
|
||||
StrCmp $R0 0 "" RequestCloseWinamp2
|
||||
goto Winamp2Closed
|
||||
RequestCloseWinamp2:
|
||||
MessageBox MB_OKCANCEL|MB_ICONEXCLAMATION "Winamp is currently running; please close it,$\rand then hit OK to continue..." \
|
||||
IDCANCEL WarnWinampStillOpen
|
||||
goto CloseWinamp2
|
||||
WarnWinampStillOpen:
|
||||
FindWindow $R0 "winamp v1.x"
|
||||
StrCmp $R0 0 "" WarnWinampStillOpen2
|
||||
goto Winamp2Closed
|
||||
WarnWinampStillOpen2:
|
||||
MessageBox MB_OK|MB_ICONEXCLAMATION "Warning: Winamp is still open; as a result, the installer$\rwill not be able to set ${PLUGIN_NAME} as the default plugin; you will$\rhave to do this yourself.$\r$\rTo do so, wait until the installation is finished. Then bring up $\rWinamp and hit CTRL+K. From there, you will be able to select$\r${PLUGIN_NAME} from the list of visualization plug-ins, and it will$\rbecome the new default."
|
||||
goto Winamp2Closed
|
||||
Winamp2Closed:
|
||||
|
||||
; this function sets $1 to point to the 'winamp\plugins\milkdrop2' folder:
|
||||
; (see function definition above)
|
||||
Call QueryWinampVisPath
|
||||
|
||||
; -------------------- EDIT THIS SECTION [2/3] --------------------
|
||||
; -------------------- EDIT THIS SECTION [2/3] --------------------
|
||||
; -------------------- EDIT THIS SECTION [2/3] --------------------
|
||||
|
||||
; LIST FILES TO INCLUDE WITH THE INSTALLER
|
||||
|
||||
; For each file we want to install onto the destination system,
|
||||
; we first set the output directory (relative to $1, which is
|
||||
; the PLUGINS directory) and then list files. The paths for
|
||||
; the files will be local paths on your hard disk, but fear not -
|
||||
; the files will be placed in the current output directory
|
||||
; (as last set by SetOutPath) on the destination system.
|
||||
|
||||
; So, first, we set the current output path (the folder to which
|
||||
; files will be decompressed on the user's system) to '$1',
|
||||
; which is the path to their winamp plugins folder.
|
||||
|
||||
SetOutPath $1
|
||||
File "C:\program files\winamp\plugins\${PLUGIN_DLL}"
|
||||
|
||||
SetOutPath $1\Milkdrop2\config
|
||||
File "C:\program files\winamp\plugins\milkdrop2\config\milk_msg.ini"
|
||||
File "C:\program files\winamp\plugins\milkdrop2\config\milk_img.ini"
|
||||
;File "C:\program files\winamp\plugins\milkdrop2\config\milkdrop.ini" ;this one will be generated - do not install
|
||||
|
||||
SetOutPath $1\Milkdrop2\data
|
||||
File "C:\program files\winamp\plugins\milkdrop2\data\vms_desktop.dll"
|
||||
File "C:\program files\winamp\plugins\milkdrop2\data\comp_ps.fx"
|
||||
File "C:\program files\winamp\plugins\milkdrop2\data\comp_vs.fx"
|
||||
File "C:\program files\winamp\plugins\milkdrop2\data\warp_ps.fx"
|
||||
File "C:\program files\winamp\plugins\milkdrop2\data\warp_vs.fx"
|
||||
File "C:\program files\winamp\plugins\milkdrop2\data\include.fx"
|
||||
|
||||
SetOutPath $1\Milkdrop2\docs
|
||||
File "C:\program files\winamp\plugins\milkdrop2\docs\milkdrop.html"
|
||||
File "C:\program files\winamp\plugins\milkdrop2\docs\milkdrop_preset_authoring.html"
|
||||
File "C:\program files\winamp\plugins\milkdrop2\docs\q_and_t_vars.gif"
|
||||
|
||||
SetOutPath $1\Milkdrop2\textures
|
||||
File "C:\program files\winamp\plugins\milkdrop2\textures\*.*"
|
||||
|
||||
SetOutPath $1\Milkdrop2\presets
|
||||
File "C:\program files\winamp\plugins\milkdrop2\presets\*.milk"
|
||||
|
||||
hmmm
|
||||
SetOutPath $1\MilkDrop2\presets\3d
|
||||
File "C:\program files\winamp\plugins\milkdrop2\presets\3d\*.milk"
|
||||
|
||||
hmmm
|
||||
SetOutPath $1\MilkDrop2\presets\inverted
|
||||
File "C:\program files\winamp\plugins\milkdrop2\presets\inverted\*.milk"
|
||||
|
||||
; ----------------------- END SECTION [2/3] -----------------------
|
||||
; ----------------------- END SECTION [2/3] -----------------------
|
||||
; ----------------------- END SECTION [2/3] -----------------------
|
||||
|
||||
|
||||
; now time to create the Uninstaller:
|
||||
|
||||
IfFileExists $INSTDIR\Winamp.exe UninstWinamp2
|
||||
IfFileExists $INSTDIR\Winamp3.exe UninstWinamp3
|
||||
IfFileExists $INSTDIR\Studio.exe UninstWinamp3 ; legacy check
|
||||
goto UninstDone
|
||||
|
||||
UninstWinamp3:
|
||||
WriteRegStr HKLM SOFTWARE\${PLUGIN_DLL}Winamp3 "Install_Dir" "$INSTDIR"
|
||||
WriteRegStr HKLM SOFTWARE\${PLUGIN_DLL}Winamp3 "Install_Plugins_Dir" $1
|
||||
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PLUGIN_DLL}Winamp3" "DisplayName" "${PLUGIN_NAME} for Winamp 3 (remove only)"
|
||||
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PLUGIN_DLL}Winamp3" "UninstallString" '"$INSTDIR\uninst-${PLUGIN_DLL}.exe"'
|
||||
WriteUninstaller "$INSTDIR\uninst-${PLUGIN_DLL}.exe"
|
||||
CreateDirectory "$SMPROGRAMS\Winamp3\Vis Plugin Uninstallers"
|
||||
CreateShortCut "$SMPROGRAMS\Winamp3\Vis Plugin Uninstallers\Uninstall ${PLUGIN_NAME}.lnk" "$INSTDIR\uninst-${PLUGIN_DLL}.exe" "" "$INSTDIR\uninst-${PLUGIN_DLL}.exe" 0
|
||||
goto UninstDone
|
||||
|
||||
UninstWinamp2:
|
||||
WriteRegStr HKLM SOFTWARE\${PLUGIN_DLL}Winamp "Install_Dir" "$INSTDIR"
|
||||
WriteRegStr HKLM SOFTWARE\${PLUGIN_DLL}Winamp "Install_Plugins_Dir" $1
|
||||
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PLUGIN_DLL}Winamp" "DisplayName" "${PLUGIN_NAME} for Winamp 2x (remove only)"
|
||||
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PLUGIN_DLL}Winamp" "UninstallString" '"$INSTDIR\uninst-${PLUGIN_DLL}.exe"'
|
||||
WriteUninstaller "$INSTDIR\uninst-${PLUGIN_DLL}.exe"
|
||||
CreateDirectory "$SMPROGRAMS\Winamp\Vis Plugin Uninstallers"
|
||||
CreateShortCut "$SMPROGRAMS\Winamp\Vis Plugin Uninstallers\Uninstall ${PLUGIN_NAME}.lnk" "$INSTDIR\uninst-${PLUGIN_DLL}.exe" "" "$INSTDIR\uninst-${PLUGIN_DLL}.exe" 0
|
||||
goto UninstDone
|
||||
|
||||
UninstDone:
|
||||
|
||||
SectionEnd
|
||||
|
||||
;----------------------------------------------------------------------
|
||||
|
||||
UninstallText "This will uninstall the ${PLUGIN_NAME} plugin. Hit next to continue."
|
||||
ShowUninstDetails Show
|
||||
|
||||
Section "Uninstall"
|
||||
|
||||
; This section is the code that will be run when the user goes
|
||||
; to Uninstall the plugin.
|
||||
|
||||
IfFileExists $INSTDIR\Winamp.exe UninstStep1Winamp2
|
||||
IfFileExists $INSTDIR\Winamp3.exe UninstStep1Winamp3
|
||||
IfFileExists $INSTDIR\Studio.exe UninstStep1Winamp3 ; legacy check
|
||||
goto UninstScriptDone
|
||||
|
||||
UninstStep1Winamp3:
|
||||
ReadRegStr $1 HKLM SOFTWARE\${PLUGIN_DLL}Winamp3 "Install_Plugins_Dir"
|
||||
goto UninstStep2
|
||||
UninstStep1Winamp2:
|
||||
ReadRegStr $1 HKLM SOFTWARE\${PLUGIN_DLL}Winamp "Install_Plugins_Dir"
|
||||
goto UninstStep2
|
||||
|
||||
UninstStep2:
|
||||
|
||||
; -------------------- EDIT THIS SECTION [3/3] --------------------
|
||||
; -------------------- EDIT THIS SECTION [3/3] --------------------
|
||||
; -------------------- EDIT THIS SECTION [3/3] --------------------
|
||||
|
||||
; LIST OF FILES TO DELETE WHEN USER RUNS THE UNINSTALL
|
||||
|
||||
Delete "$1\${PLUGIN_DLL}"
|
||||
;Delete "$1\vms_desktop.dll" ** DO NOT DELETE! **
|
||||
Delete "$1\milkdrop.html"
|
||||
Delete "$1\milkdrop_preset_authoring.html"
|
||||
Delete "$1\q_and_t_vars.gif"
|
||||
|
||||
MessageBox MB_YESNO|MB_ICONQUESTION \
|
||||
"Clear your saved settings?:$\r $1\milkdrop_config.ini$\r $1\milk_msg.ini$\r $1\milk_img.ini" \
|
||||
IDNO SaveSettings
|
||||
|
||||
Delete "$1\milkdrop_config.ini"
|
||||
Delete "$1\milk_msg.ini"
|
||||
Delete "$1\milk_img.ini"
|
||||
|
||||
SaveSettings:
|
||||
|
||||
MessageBox MB_YESNO|MB_ICONQUESTION \
|
||||
"Delete all presets in these 3 directories?:$\r $1\milkdrop$\r $1\milkdrop\3d$\r $1\milkdrop\inverted" \
|
||||
IDNO SavePresets
|
||||
|
||||
Delete "$1\milkdrop2\inverted\*.milk"
|
||||
Delete "$1\milkdrop2\3d\*.milk"
|
||||
Delete "$1\milkdrop2\*.milk"
|
||||
RMDir "$1\milkdrop2\inverted"
|
||||
RMDir "$1\milkdrop2\3d"
|
||||
RMDir "$1\milkdrop2"
|
||||
|
||||
SavePresets:
|
||||
|
||||
; ----------------------- END SECTION [3/3] -----------------------
|
||||
; ----------------------- END SECTION [3/3] -----------------------
|
||||
; ----------------------- END SECTION [3/3] -----------------------
|
||||
|
||||
IfFileExists $INSTDIR\Winamp.exe UninstStep3Winamp2
|
||||
IfFileExists $INSTDIR\Winamp3.exe UninstStep3Winamp3
|
||||
IfFileExists $INSTDIR\Studio.exe UninstStep3Winamp3 ; legacy check
|
||||
goto UninstScriptDone
|
||||
|
||||
UninstStep3Winamp3:
|
||||
DeleteRegKey HKLM SOFTWARE\${PLUGIN_DLL}Winamp3
|
||||
DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PLUGIN_DLL}Winamp3"
|
||||
Delete $INSTDIR\uninst-${PLUGIN_DLL}.exe
|
||||
Delete "$SMPROGRAMS\Winamp3\Vis Plugin Uninstallers\Uninstall ${PLUGIN_NAME}.lnk"
|
||||
RMDir "$SMPROGRAMS\Winamp3\Vis Plugin Uninstallers"
|
||||
goto UninstScriptDone
|
||||
UninstStep3Winamp2:
|
||||
DeleteRegKey HKLM SOFTWARE\${PLUGIN_DLL}Winamp
|
||||
DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PLUGIN_DLL}Winamp"
|
||||
Delete $INSTDIR\uninst-${PLUGIN_DLL}.exe
|
||||
Delete "$SMPROGRAMS\Winamp\Vis Plugin Uninstallers\Uninstall ${PLUGIN_NAME}.lnk"
|
||||
RMDir "$SMPROGRAMS\Winamp\Vis Plugin Uninstallers"
|
||||
goto UninstScriptDone
|
||||
|
||||
UninstScriptDone:
|
||||
SectionEnd
|
||||
|
||||
;----------------------------------------------------------------------
|
||||
|
||||
Function .onInstSuccess
|
||||
IfFileExists $INSTDIR\Winamp.exe CaseWinamp2
|
||||
IfFileExists $INSTDIR\Winamp3.exe CaseWinamp3
|
||||
IfFileExists $INSTDIR\Studio.exe CaseWinamp3 ; legacy check
|
||||
goto CaseImpossible
|
||||
|
||||
CaseWinamp3:
|
||||
IfFileExists $INSTDIR\wacs\classicvis.wac ClassicVisOk
|
||||
; no classicvis -> give them instructions
|
||||
MessageBox MB_YESNO|MB_ICONEXCLAMATION \
|
||||
"IMPORTANT: You must download and install the Classic Visualization$\rComponent before ${PLUGIN_NAME} will work with Winamp 3.$\r$\rWould you like to download it now?" \
|
||||
IDNO FailNoClassicVis
|
||||
ExecShell "open" "http://www.winamp.com/components3/detail.jhtml?componentId=122130"
|
||||
MessageBox MB_OK|MB_ICONINFORMATION \
|
||||
"Your web browser will now open and allow you to download$\rthe Classic Visualization Component. Please download$\rand install it.$\r$\rOnce it is installed, open Winamp 3 and hit CTRL+P$\rto open the Preferences screen. Then, on the left,$\rscroll to 'Classic Visualizations' and select it. From there,$\ryou can easily select, configure and run any plugins$\rinstalled to Winamp 2 or 3."
|
||||
goto end
|
||||
FailNoClassicVis:
|
||||
MessageBox MB_OK|MB_ICONSTOP "Installation failed."
|
||||
goto end
|
||||
ClassicVisOk:
|
||||
FindWindow $R0 "STUDIO"
|
||||
StrCmp $R0 0 "" DoneWinamp3
|
||||
MessageBox MB_YESNO|MB_ICONQUESTION \
|
||||
"${PLUGIN_NAME} was installed successfully.$\rWould you like to run Winamp 3 now?" \
|
||||
IDNO DoneWinamp3
|
||||
; to do here: update 'oldvisname' string in the *xml* file winamp3\studio.xnf,
|
||||
; and set 'oldvisidx' to "0"
|
||||
IfFileExists $INSTDIR\Winamp3.exe CaseWinamp3b
|
||||
Exec '"$INSTDIR\studio.exe"'
|
||||
goto DoneWinamp3
|
||||
CaseWinamp3b:
|
||||
Exec '"$INSTDIR\winamp3.exe"'
|
||||
goto DoneWinamp3
|
||||
DoneWinamp3:
|
||||
MessageBox MB_OK "While in Winamp 3, press CTRL+P to bring up the$\rPreferences screen, then scroll down and select$\rthe 'Classic Visualizations' option. From there,$\ryou can select, configure, and run the ${PLUGIN_NAME} plugin."
|
||||
goto end
|
||||
|
||||
CaseWinamp2:
|
||||
; note: winamp 2 should already be closed at this point.
|
||||
WriteINIStr "$INSTDIR\Winamp.ini" "Winamp" "visplugin_name" ${PLUGIN_DLL}
|
||||
WriteINIStr "$INSTDIR\Winamp.ini" "Winamp" "visplugin_num" "0"
|
||||
MessageBox MB_YESNO|MB_ICONQUESTION \
|
||||
"${PLUGIN_NAME} was installed successfully.$\r$\rWhile in Winamp, press ALT+K to configure it (optional);$\rpress CTRL+SHIFT+K to execute it.$\r$\rWould you like to run Winamp now?" \
|
||||
IDNO end
|
||||
Exec '"$INSTDIR\Winamp.exe"'
|
||||
Goto end
|
||||
|
||||
CaseImpossible:
|
||||
MessageBox MB_OK|MB_ICONEXCLAMATION "ERROR: unable to find winamp.exe (winamp2) or studio.exe/winamp3.exe (winamp3) in the install directory..."
|
||||
Goto end
|
||||
|
||||
End:
|
||||
FunctionEnd
|
||||
|
||||
; eof
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
Microsoft Developer Studio Workspace File, Format Version 6.00
|
||||
# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
|
||||
|
||||
###############################################################################
|
||||
|
||||
Project: "plugin"=.\plugin.dsp - Package Owner=<4>
|
||||
|
||||
Package=<5>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
Package=<4>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
###############################################################################
|
||||
|
||||
Global:
|
||||
|
||||
Package=<5>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
Package=<3>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
###############################################################################
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio Version 16
|
||||
VisualStudioVersion = 16.0.29709.97
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "vis_milk2", "plugin.vcxproj", "{881FB534-7396-485A-ADC2-6FBEBED7A0F4}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Win32 = Debug|Win32
|
||||
Release|Win32 = Release|Win32
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{881FB534-7396-485A-ADC2-6FBEBED7A0F4}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{881FB534-7396-485A-ADC2-6FBEBED7A0F4}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{881FB534-7396-485A-ADC2-6FBEBED7A0F4}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{881FB534-7396-485A-ADC2-6FBEBED7A0F4}.Release|Win32.Build.0 = Release|Win32
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
SolutionGuid = {0BFB0275-73AE-400C-9070-5C0471284DD5}
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
Binary file not shown.
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,74 @@
|
||||
/*
|
||||
Nullsoft Expression Evaluator Library (NS-EEL)
|
||||
Copyright (C) 1999-2003 Nullsoft, Inc.
|
||||
|
||||
ns-eel-addfuncs.h: defines macros useful for adding functions to the compiler
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
arising from the use of this software.
|
||||
|
||||
Permission is granted to anyone to use this software for any purpose,
|
||||
including commercial applications, and to alter it and redistribute it
|
||||
freely, subject to the following restrictions:
|
||||
|
||||
1. The origin of this software must not be misrepresented; you must not
|
||||
claim that you wrote the original software. If you use this software
|
||||
in a product, an acknowledgment in the product documentation would be
|
||||
appreciated but is not required.
|
||||
2. Altered source versions must be plainly marked as such, and must not be
|
||||
misrepresented as being the original software.
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
*/
|
||||
|
||||
#ifndef __NS_EEL_ADDFUNCS_H__
|
||||
#define __NS_EEL_ADDFUNCS_H__
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
struct _compileContext;
|
||||
typedef void (*NSEEL_PPPROC)(void *data, int data_size, struct _compileContext *userfunc_data);
|
||||
|
||||
void NSEEL_PProc_RAM(void *data, int data_size, struct _compileContext *ctx);
|
||||
void NSEEL_PProc_THIS(void *data, int data_size, struct _compileContext *ctx);
|
||||
|
||||
|
||||
void _asm_generic3parm(void); // 3 double * parms, returning double *
|
||||
void _asm_generic3parm_end(void);
|
||||
void _asm_generic3parm_retd(void); // 3 double * parms, returning double
|
||||
void _asm_generic3parm_retd_end(void);
|
||||
void _asm_generic2parm(void); // 2 double * parms, returning double *
|
||||
void _asm_generic2parm_end(void);
|
||||
void _asm_generic2parm_retd(void); // 2 double * parms, returning double
|
||||
void _asm_generic2parm_retd_end(void);
|
||||
void _asm_generic1parm(void); // 1 double * parms, returning double *
|
||||
void _asm_generic1parm_end(void);
|
||||
void _asm_generic1parm_retd(void); // 1 double * parms, returning double
|
||||
void _asm_generic1parm_retd_end(void);
|
||||
|
||||
void _asm_megabuf(void);
|
||||
void _asm_megabuf_end(void);
|
||||
|
||||
|
||||
|
||||
#if EEL_F_SIZE == 4
|
||||
#define EEL_F_SSTR "4"
|
||||
#define EEL_F_SUFFIX "s"
|
||||
#else
|
||||
#define EEL_F_SSTR "8"
|
||||
#define EEL_F_SUFFIX "l"
|
||||
#endif
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#define NSEEL_CGEN_CALL __cdecl
|
||||
#else
|
||||
#define NSEEL_CGEN_CALL
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
};
|
||||
|
||||
#endif
|
||||
#endif//__NS_EEL_ADDFUNCS_H__
|
||||
@@ -0,0 +1,227 @@
|
||||
/*
|
||||
Nullsoft Expression Evaluator Library (NS-EEL)
|
||||
Copyright (C) 1999-2003 Nullsoft, Inc.
|
||||
|
||||
ns-eel-int.h: internal code definition header.
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
arising from the use of this software.
|
||||
|
||||
Permission is granted to anyone to use this software for any purpose,
|
||||
including commercial applications, and to alter it and redistribute it
|
||||
freely, subject to the following restrictions:
|
||||
|
||||
1. The origin of this software must not be misrepresented; you must not
|
||||
claim that you wrote the original software. If you use this software
|
||||
in a product, an acknowledgment in the product documentation would be
|
||||
appreciated but is not required.
|
||||
2. Altered source versions must be plainly marked as such, and must not be
|
||||
misrepresented as being the original software.
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
*/
|
||||
|
||||
#ifndef __NS_EELINT_H__
|
||||
#define __NS_EELINT_H__
|
||||
|
||||
#ifdef _WIN32
|
||||
#include <windows.h>
|
||||
#else
|
||||
#include "../wdltypes.h"
|
||||
#endif
|
||||
|
||||
#include "ns-eel.h"
|
||||
#include "ns-eel-addfuncs.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define FN_ASSIGN 0
|
||||
#define FN_MULTIPLY 1
|
||||
#define FN_DIVIDE 2
|
||||
#define FN_MODULO 3
|
||||
#define FN_ADD 4
|
||||
#define FN_SUB 5
|
||||
#define FN_AND 6
|
||||
#define FN_OR 7
|
||||
#define FN_UMINUS 8
|
||||
#define FN_UPLUS 9
|
||||
|
||||
#define MATH_SIMPLE 0
|
||||
#define MATH_FN 1
|
||||
|
||||
#define YYSTYPE INT_PTR
|
||||
|
||||
#define NSEEL_CLOSEFACTOR 0.00001
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int srcByteCount;
|
||||
int destByteCount;
|
||||
} lineRecItem;
|
||||
|
||||
typedef struct _compileContext
|
||||
{
|
||||
EEL_F **varTable_Values;
|
||||
char **varTable_Names;
|
||||
int varTable_numBlocks;
|
||||
|
||||
int errVar;
|
||||
int colCount;
|
||||
INT_PTR result;
|
||||
char last_error_string[256];
|
||||
YYSTYPE yylval;
|
||||
int yychar; /* the lookahead symbol */
|
||||
int yynerrs; /* number of parse errors so far */
|
||||
char yytext[256];
|
||||
char lastVar[256];
|
||||
|
||||
char *llsave[16]; /* Look ahead buffer */
|
||||
char llbuf[100]; /* work buffer */
|
||||
char *llp1;// = &llbuf[0]; /* pointer to next avail. in token */
|
||||
char *llp2;// = &llbuf[0]; /* pointer to end of lookahead */
|
||||
char *llend;// = &llbuf[0]; /* pointer to end of token */
|
||||
char *llebuf;// = &llbuf[sizeof llbuf];
|
||||
int lleof;
|
||||
int yyline;// = 0;
|
||||
|
||||
void *tmpblocks_head,*blocks_head;
|
||||
int computTableTop; // make it abort on potential overflow =)
|
||||
int l_stats[4]; // source bytes, static code bytes, call code bytes, data bytes
|
||||
|
||||
lineRecItem *compileLineRecs;
|
||||
int compileLineRecs_size;
|
||||
int compileLineRecs_alloc;
|
||||
|
||||
void *ram_blocks; // this needs to be immediately followed by
|
||||
int ram_needfree;
|
||||
|
||||
void *gram_blocks;
|
||||
|
||||
void *caller_this;
|
||||
}
|
||||
compileContext;
|
||||
|
||||
#define NSEEL_VARS_PER_BLOCK 64
|
||||
|
||||
typedef struct {
|
||||
const char *name;
|
||||
void *afunc;
|
||||
void *func_e;
|
||||
int nParams;
|
||||
void *replptrs[4];
|
||||
NSEEL_PPPROC pProc;
|
||||
} functionType;
|
||||
|
||||
|
||||
extern functionType *nseel_getFunctionFromTable(int idx);
|
||||
|
||||
INT_PTR nseel_createCompiledValue(compileContext *ctx, EEL_F value, EEL_F *addrValue);
|
||||
INT_PTR nseel_createCompiledFunction1(compileContext *ctx, int fntype, INT_PTR fn, INT_PTR code);
|
||||
INT_PTR nseel_createCompiledFunction2(compileContext *ctx, int fntype, INT_PTR fn, INT_PTR code1, INT_PTR code2);
|
||||
INT_PTR nseel_createCompiledFunction3(compileContext *ctx, int fntype, INT_PTR fn, INT_PTR code1, INT_PTR code2, INT_PTR code3);
|
||||
|
||||
extern EEL_F nseel_globalregs[100];
|
||||
|
||||
void nseel_resetVars(compileContext *ctx);
|
||||
EEL_F *nseel_getVarPtr(compileContext *ctx, char *varName);
|
||||
EEL_F *nseel_registerVar(compileContext *ctx, char *varName);
|
||||
|
||||
INT_PTR *EEL_GLUE_set_immediate(void *_p, void *newv);
|
||||
|
||||
// other shat
|
||||
|
||||
|
||||
|
||||
INT_PTR nseel_setVar(compileContext *ctx, INT_PTR varNum);
|
||||
INT_PTR nseel_getVar(compileContext *ctx, INT_PTR varNum);
|
||||
void *nseel_compileExpression(compileContext *ctx, char *txt);
|
||||
|
||||
#define VALUE 258
|
||||
#define IDENTIFIER 259
|
||||
#define FUNCTION1 260
|
||||
#define FUNCTION2 261
|
||||
#define FUNCTION3 262
|
||||
#define UMINUS 263
|
||||
#define UPLUS 264
|
||||
|
||||
INT_PTR nseel_translate(compileContext *ctx, int type);
|
||||
void nseel_count(compileContext *ctx);
|
||||
void nseel_setLastVar(compileContext *ctx);
|
||||
INT_PTR nseel_lookup(compileContext *ctx, int *typeOfObject);
|
||||
int nseel_yyerror(compileContext *ctx);
|
||||
int nseel_yylex(compileContext *ctx, char **exp);
|
||||
int nseel_yyparse(compileContext *ctx, char *exp);
|
||||
void nseel_llinit(compileContext *ctx);
|
||||
int nseel_gettoken(compileContext *ctx, char *lltb, int lltbsiz);
|
||||
|
||||
struct lextab {
|
||||
int llendst; /* Last state number */
|
||||
char *lldefault; /* Default state table */
|
||||
char *llnext; /* Next state table */
|
||||
char *llcheck; /* Check table */
|
||||
int *llbase; /* Base table */
|
||||
int llnxtmax; /* Last in next table */
|
||||
int (*llmove)(); /* Move between states */
|
||||
char *llfinal; /* Final state descriptions */
|
||||
int (*llactr)(); /* Action routine */
|
||||
int *lllook; /* Look ahead vector if != NULL */
|
||||
char *llign; /* Ignore char vec if != NULL */
|
||||
char *llbrk; /* Break char vec if != NULL */
|
||||
char *llill; /* Illegal char vec if != NULL */
|
||||
};
|
||||
extern struct lextab nseel_lextab;
|
||||
|
||||
EEL_F * NSEEL_CGEN_CALL __NSEEL_RAMAlloc(EEL_F ***blocks, int w);
|
||||
EEL_F * NSEEL_CGEN_CALL __NSEEL_RAMAllocGMEM(EEL_F ***blocks, int w);
|
||||
EEL_F * NSEEL_CGEN_CALL __NSEEL_RAM_MemSet(EEL_F ***blocks,EEL_F *dest, EEL_F *v, EEL_F *lenptr);
|
||||
EEL_F * NSEEL_CGEN_CALL __NSEEL_RAM_MemFree(EEL_F ***blocks, EEL_F *which);
|
||||
EEL_F * NSEEL_CGEN_CALL __NSEEL_RAM_MemCpy(EEL_F ***blocks,EEL_F *dest, EEL_F *src, EEL_F *lenptr);
|
||||
|
||||
|
||||
|
||||
#ifndef max
|
||||
#define max(x,y) ((x)<(y)?(y):(x))
|
||||
#define min(x,y) ((x)<(y)?(x):(y))
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
#ifdef __ppc__
|
||||
|
||||
#define EEL_F2int(x) ((int)(x))
|
||||
|
||||
#elif defined (_WIN64)
|
||||
|
||||
// todo: AMD64 version?
|
||||
#define EEL_F2int(x) ((int)(x))
|
||||
|
||||
#elif defined(_MSC_VER)
|
||||
|
||||
static __inline int EEL_F2int(EEL_F d)
|
||||
{
|
||||
int tmp;
|
||||
__asm {
|
||||
fld d
|
||||
fistp tmp
|
||||
}
|
||||
return tmp;
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
static inline int EEL_F2int(EEL_F d)
|
||||
{
|
||||
int tmp;
|
||||
__asm__ __volatile__ ("fistpl %0" : "=m" (tmp) : "t" (d) : "st") ;
|
||||
return tmp;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif//__NS_EELINT_H__
|
||||
@@ -0,0 +1,155 @@
|
||||
/*
|
||||
Nullsoft Expression Evaluator Library (NS-EEL)
|
||||
Copyright (C) 1999-2003 Nullsoft, Inc.
|
||||
|
||||
ns-eel.h: main application interface header
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
arising from the use of this software.
|
||||
|
||||
Permission is granted to anyone to use this software for any purpose,
|
||||
including commercial applications, and to alter it and redistribute it
|
||||
freely, subject to the following restrictions:
|
||||
|
||||
1. The origin of this software must not be misrepresented; you must not
|
||||
claim that you wrote the original software. If you use this software
|
||||
in a product, an acknowledgment in the product documentation would be
|
||||
appreciated but is not required.
|
||||
2. Altered source versions must be plainly marked as such, and must not be
|
||||
misrepresented as being the original software.
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
*/
|
||||
|
||||
|
||||
#ifndef __NS_EEL_H__
|
||||
#define __NS_EEL_H__
|
||||
|
||||
// put standard includes here
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#define strcasecmp stricmp
|
||||
#define strncasecmp _strnicmp
|
||||
#endif
|
||||
|
||||
#ifndef EEL_F_SIZE
|
||||
#define EEL_F_SIZE 8
|
||||
#endif
|
||||
|
||||
#if EEL_F_SIZE == 4
|
||||
typedef float EEL_F;
|
||||
#else
|
||||
typedef double EEL_F;
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
// host should implement these (can be empty stub functions if no VM will execute code in multiple threads at once)
|
||||
|
||||
// implement if you will be running the code in same VM from multiple threads,
|
||||
// or VMs that have the same GRAM pointer from different threads, or multiple
|
||||
// VMs that have a NULL GRAM pointer from multiple threads.
|
||||
// if you give each VM it's own unique GRAM and only run each VM in one thread, then you can leave it blank.
|
||||
|
||||
// or if you're daring....
|
||||
|
||||
void NSEEL_HOSTSTUB_EnterMutex();
|
||||
void NSEEL_HOSTSTUB_LeaveMutex();
|
||||
|
||||
|
||||
int NSEEL_init(); // returns 0 on success. clears any added functions as well
|
||||
|
||||
#define NSEEL_addfunction(name,nparms,code,len) NSEEL_addfunctionex((name),(nparms),(code),(len),0,0)
|
||||
#define NSEEL_addfunctionex(name,nparms,code,len,pproc,fptr) NSEEL_addfunctionex2((name),(nparms),(code),(len),(pproc),(fptr),0)
|
||||
void NSEEL_addfunctionex2(const char *name, int nparms, char *code_startaddr, int code_len, void *pproc, void *fptr, void *fptr2);
|
||||
|
||||
void NSEEL_quit();
|
||||
|
||||
int *NSEEL_getstats(); // returns a pointer to 5 ints... source bytes, static code bytes, call code bytes, data bytes, number of code handles
|
||||
EEL_F *NSEEL_getglobalregs();
|
||||
|
||||
typedef void *NSEEL_VMCTX;
|
||||
typedef void *NSEEL_CODEHANDLE;
|
||||
|
||||
NSEEL_VMCTX NSEEL_VM_alloc(); // return a handle
|
||||
void NSEEL_VM_free(NSEEL_VMCTX ctx); // free when done with a VM and ALL of its code have been freed, as well
|
||||
|
||||
void NSEEL_VM_enumallvars(NSEEL_VMCTX ctx, int (*func)(const char *name, EEL_F *val, void *ctx), void *userctx); // return false from func to stop
|
||||
void NSEEL_VM_resetvars(NSEEL_VMCTX ctx); // clears all vars to 0.0.
|
||||
|
||||
EEL_F *NSEEL_VM_regvar(NSEEL_VMCTX ctx, const char *name); // register a variable (before compilation)
|
||||
|
||||
void NSEEL_VM_freeRAM(NSEEL_VMCTX ctx); // clears and frees all (VM) RAM used
|
||||
void NSEEL_VM_freeRAMIfCodeRequested(NSEEL_VMCTX); // call after code to free the script-requested memory
|
||||
int NSEEL_VM_wantfreeRAM(NSEEL_VMCTX ctx); // want NSEEL_VM_freeRAMIfCodeRequested?
|
||||
|
||||
// if you set this, it uses a local GMEM context.
|
||||
// Must be set before compilation.
|
||||
// void *p=NULL;
|
||||
// NSEEL_VM_SetGRAM(ctx,&p);
|
||||
// .. do stuff
|
||||
// NSEEL_VM_FreeGRAM(&p);
|
||||
void NSEEL_VM_SetGRAM(NSEEL_VMCTX ctx, void **gram);
|
||||
void NSEEL_VM_FreeGRAM(void **ufd); // frees a gmem context.
|
||||
void NSEEL_VM_SetCustomFuncThis(NSEEL_VMCTX ctx, void *thisptr);
|
||||
|
||||
|
||||
// note that you shouldnt pass a C string directly, since it may need to
|
||||
// fudge with the string during the compilation (it will always restore it to the
|
||||
// original value though).
|
||||
#ifdef __cplusplus
|
||||
NSEEL_CODEHANDLE NSEEL_code_compile(NSEEL_VMCTX ctx, char *code, int lineoffs=0);
|
||||
#else
|
||||
NSEEL_CODEHANDLE NSEEL_code_compile(NSEEL_VMCTX ctx, char *code, int lineoffs);
|
||||
#endif
|
||||
|
||||
char *NSEEL_code_getcodeerror(NSEEL_VMCTX ctx);
|
||||
void NSEEL_code_execute(NSEEL_CODEHANDLE code);
|
||||
void NSEEL_code_free(NSEEL_CODEHANDLE code);
|
||||
int *NSEEL_code_getstats(NSEEL_CODEHANDLE code); // 4 ints...source bytes, static code bytes, call code bytes, data bytes
|
||||
|
||||
|
||||
// global memory control/view
|
||||
extern unsigned int NSEEL_RAM_limitmem; // if nonzero, memory limit for user data, in bytes
|
||||
extern unsigned int NSEEL_RAM_memused;
|
||||
extern int NSEEL_RAM_memused_errors;
|
||||
|
||||
|
||||
|
||||
// configuration:
|
||||
|
||||
#define NSEEL_MAX_VARIABLE_NAMELEN 16
|
||||
// define this to override the max variable length (default is 16 bytes)
|
||||
|
||||
//#define NSEEL_MAX_TEMPSPACE_ENTRIES 2048
|
||||
// define this to override the maximum working space in 8 byte units.
|
||||
// 2048 is the default, and is way more than enough for most applications
|
||||
// but in theory you might be able to come up with an expression big enough? maybe?
|
||||
|
||||
|
||||
// maximum loop length
|
||||
#define NSEEL_LOOPFUNC_SUPPORT_MAXLEN 1048576 // scary, we can do a million entries. probably will never want to, though.
|
||||
#define NSEEL_LOOPFUNC_SUPPORT_MAXLEN_STR "1048576"
|
||||
|
||||
|
||||
|
||||
// when a VM ctx doesn't have a GRAM context set, make the global one this big
|
||||
#define NSEEL_SHARED_GRAM_SIZE (1<<20)
|
||||
|
||||
// 128*65536 = ~8million entries. (64MB RAM used)
|
||||
#define NSEEL_RAM_BLOCKS 128
|
||||
#define NSEEL_RAM_ITEMSPERBLOCK 65536
|
||||
|
||||
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif//__NS_EEL_H__
|
||||
@@ -0,0 +1,553 @@
|
||||
/*
|
||||
Expression Evaluator Library (NS-EEL) v2
|
||||
Copyright (C) 2004-2008 Cockos Incorporated
|
||||
Copyright (C) 1999-2003 Nullsoft, Inc.
|
||||
|
||||
nseel-caltab.c
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
arising from the use of this software.
|
||||
|
||||
Permission is granted to anyone to use this software for any purpose,
|
||||
including commercial applications, and to alter it and redistribute it
|
||||
freely, subject to the following restrictions:
|
||||
|
||||
1. The origin of this software must not be misrepresented; you must not
|
||||
claim that you wrote the original software. If you use this software
|
||||
in a product, an acknowledgment in the product documentation would be
|
||||
appreciated but is not required.
|
||||
2. Altered source versions must be plainly marked as such, and must not be
|
||||
misrepresented as being the original software.
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
*/
|
||||
|
||||
#include "ns-eel-int.h"
|
||||
|
||||
#define VALUE 258
|
||||
#define IDENTIFIER 259
|
||||
#define FUNCTION1 260
|
||||
#define FUNCTION2 261
|
||||
#define FUNCTION3 262
|
||||
#define UMINUS 263
|
||||
#define UPLUS 264
|
||||
|
||||
#define YYERROR(x) nseel_yyerror(ctx)
|
||||
|
||||
#define YYFINAL 51
|
||||
#define YYFLAG -32768
|
||||
#define YYNTBASE 21
|
||||
|
||||
#define YYTRANSLATE(x) ((unsigned)(x) <= 264 ? yytranslate[x] : 26)
|
||||
|
||||
static const char yytranslate[] = { 0,
|
||||
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
||||
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
||||
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
||||
2, 2, 2, 2, 2, 2, 14, 9, 2, 18,
|
||||
19, 12, 10, 20, 11, 2, 13, 2, 2, 2,
|
||||
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
||||
17, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
||||
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
||||
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
||||
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
||||
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
||||
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
||||
2, 2, 2, 8, 2, 2, 2, 2, 2, 2,
|
||||
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
||||
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
||||
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
||||
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
||||
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
||||
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
||||
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
||||
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
||||
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
||||
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
||||
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
||||
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
||||
2, 2, 2, 2, 2, 1, 2, 3, 4, 5,
|
||||
6, 7, 15, 16
|
||||
};
|
||||
|
||||
|
||||
static const short yyr1[] = { 0,
|
||||
21, 21, 22, 23, 23, 23, 24, 24, 24, 24,
|
||||
24, 24, 24, 24, 24, 24, 24, 25, 25, 25
|
||||
};
|
||||
|
||||
static const short yyr2[] = { 0,
|
||||
1, 3, 1, 1, 1, 3, 1, 3, 3, 3,
|
||||
3, 3, 3, 3, 2, 2, 1, 4, 6, 8
|
||||
};
|
||||
|
||||
static const short yydefact[] = { 0,
|
||||
3, 4, 0, 0, 0, 0, 0, 0, 5, 7,
|
||||
1, 17, 0, 0, 0, 0, 4, 16, 15, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 2, 0, 0,
|
||||
0, 6, 14, 13, 11, 12, 8, 9, 10, 18,
|
||||
0, 0, 0, 0, 19, 0, 0, 20, 0, 0,
|
||||
0
|
||||
};
|
||||
|
||||
static const short yydefgoto[] = { 49,
|
||||
9, 10, 11, 12
|
||||
};
|
||||
|
||||
static const short yypact[] = { 19,
|
||||
-32768, -11, -7, -5, -4, 38, 38, 38,-32768,-32768,
|
||||
136,-32768, 38, 38, 38, 38,-32768,-32768,-32768, 88,
|
||||
38, 38, 38, 38, 38, 38, 38, 136, 100, 49,
|
||||
62,-32768, 41, 54, -9, -9,-32768,-32768,-32768,-32768,
|
||||
38, 38, 112, 75,-32768, 38, 124,-32768, 12, 27,
|
||||
-32768
|
||||
};
|
||||
|
||||
static const short yypgoto[] = {-32768,
|
||||
-32768,-32768, -6,-32768
|
||||
};
|
||||
|
||||
|
||||
#define YYLAST 150
|
||||
|
||||
|
||||
static const short yytable[] = { 18,
|
||||
19, 20, 25, 26, 27, 13, 28, 29, 30, 31,
|
||||
14, 50, 15, 16, 33, 34, 35, 36, 37, 38,
|
||||
39, 1, 2, 3, 4, 5, 51, 0, 6, 7,
|
||||
0, 0, 0, 0, 43, 44, 8, 0, 0, 47,
|
||||
1, 17, 3, 4, 5, 0, 0, 6, 7, 22,
|
||||
23, 24, 25, 26, 27, 8, 21, 22, 23, 24,
|
||||
25, 26, 27, 23, 24, 25, 26, 27, 41, 21,
|
||||
22, 23, 24, 25, 26, 27, 0, 0, 0, 0,
|
||||
0, 42, 21, 22, 23, 24, 25, 26, 27, 0,
|
||||
0, 0, 0, 0, 46, 21, 22, 23, 24, 25,
|
||||
26, 27, 0, 0, 0, 0, 32, 21, 22, 23,
|
||||
24, 25, 26, 27, 0, 0, 0, 0, 40, 21,
|
||||
22, 23, 24, 25, 26, 27, 0, 0, 0, 0,
|
||||
45, 21, 22, 23, 24, 25, 26, 27, 0, 0,
|
||||
0, 0, 48, 21, 22, 23, 24, 25, 26, 27
|
||||
};
|
||||
|
||||
static const short yycheck[] = { 6,
|
||||
7, 8, 12, 13, 14, 17, 13, 14, 15, 16,
|
||||
18, 0, 18, 18, 21, 22, 23, 24, 25, 26,
|
||||
27, 3, 4, 5, 6, 7, 0, -1, 10, 11,
|
||||
-1, -1, -1, -1, 41, 42, 18, -1, -1, 46,
|
||||
3, 4, 5, 6, 7, -1, -1, 10, 11, 9,
|
||||
10, 11, 12, 13, 14, 18, 8, 9, 10, 11,
|
||||
12, 13, 14, 10, 11, 12, 13, 14, 20, 8,
|
||||
9, 10, 11, 12, 13, 14, -1, -1, -1, -1,
|
||||
-1, 20, 8, 9, 10, 11, 12, 13, 14, -1,
|
||||
-1, -1, -1, -1, 20, 8, 9, 10, 11, 12,
|
||||
13, 14, -1, -1, -1, -1, 19, 8, 9, 10,
|
||||
11, 12, 13, 14, -1, -1, -1, -1, 19, 8,
|
||||
9, 10, 11, 12, 13, 14, -1, -1, -1, -1,
|
||||
19, 8, 9, 10, 11, 12, 13, 14, -1, -1,
|
||||
-1, -1, 19, 8, 9, 10, 11, 12, 13, 14
|
||||
};
|
||||
|
||||
#define yyerrok (yyerrstatus = 0)
|
||||
#define yyclearin (ctx->yychar = YYEMPTY)
|
||||
#define YYEMPTY -2
|
||||
#define YYEOF 0
|
||||
#define YYACCEPT return(0)
|
||||
#define YYABORT return(1)
|
||||
|
||||
#define YYTERROR 1
|
||||
#define YYERRCODE 256
|
||||
|
||||
#define YYLEX nseel_yylex(ctx,&exp)
|
||||
|
||||
/* If nonreentrant, generate the variables here */
|
||||
|
||||
/* YYINITDEPTH indicates the initial size of the parser's stacks */
|
||||
|
||||
#define YYINITDEPTH 5000
|
||||
#define YYMAXDEPTH 5000
|
||||
|
||||
/* This is the most reliable way to avoid incompatibilities
|
||||
in available built-in functions on various systems. */
|
||||
#define __yy_bcopy(from,to,count) memcpy(to,from,(count)>0?(count):0)
|
||||
|
||||
//#ln 131 "bison.simple"
|
||||
int nseel_yyparse(compileContext *ctx, char *exp)
|
||||
{
|
||||
register int yystate;
|
||||
register int yyn;
|
||||
register short *yyssp;
|
||||
register YYSTYPE *yyvsp;
|
||||
int yyerrstatus; /* number of tokens to shift before error messages enabled */
|
||||
int yychar1; /* lookahead token as an internal (translated) token number */
|
||||
|
||||
short yyssa[YYINITDEPTH]; /* the state stack */
|
||||
YYSTYPE yyvsa[YYINITDEPTH]; /* the semantic value stack */
|
||||
|
||||
short *yyss = yyssa; /* refer to the stacks thru separate pointers */
|
||||
YYSTYPE *yyvs = yyvsa; /* to allow yyoverflow to reallocate them elsewhere */
|
||||
|
||||
int yystacksize = YYINITDEPTH;
|
||||
|
||||
YYSTYPE yyval; /* the variable used to return */
|
||||
/* semantic values from the action */
|
||||
/* routines */
|
||||
|
||||
int yylen;
|
||||
|
||||
ctx->yylval = 0;
|
||||
yystate = 0;
|
||||
yyerrstatus = 0;
|
||||
ctx->yynerrs = 0;
|
||||
ctx->yychar = YYEMPTY; /* Cause a token to be read. */
|
||||
|
||||
/* Initialize stack pointers.
|
||||
Waste one element of value and location stack
|
||||
so that they stay on the same level as the state stack. */
|
||||
|
||||
yyssp = yyss - 1;
|
||||
yyvsp = yyvs;
|
||||
|
||||
/* Push a new state, which is found in yystate . */
|
||||
/* In all cases, when you get here, the value and location stacks
|
||||
have just been pushed. so pushing a state here evens the stacks. */
|
||||
yynewstate:
|
||||
|
||||
*++yyssp = yystate;
|
||||
|
||||
if (yyssp >= yyss + yystacksize - 1)
|
||||
{
|
||||
/* Give user a chance to reallocate the stack */
|
||||
/* Use copies of these so that the &'s don't force the real ones into memory. */
|
||||
// YYSTYPE *yyvs1 = yyvs;
|
||||
// short *yyss1 = yyss;
|
||||
|
||||
/* Get the current used size of the three stacks, in elements. */
|
||||
int size = yyssp - yyss + 1;
|
||||
|
||||
if (yystacksize >= YYMAXDEPTH)
|
||||
{
|
||||
YYERROR("internal error: parser stack overflow");
|
||||
return 2;
|
||||
}
|
||||
|
||||
yyssp = yyss + size - 1;
|
||||
yyvsp = yyvs + size - 1;
|
||||
|
||||
|
||||
if (yyssp >= yyss + yystacksize - 1) YYABORT;
|
||||
}
|
||||
|
||||
|
||||
// yybackup:
|
||||
|
||||
/* Do appropriate processing given the current state. */
|
||||
/* Read a lookahead token if we need one and don't already have one. */
|
||||
/* yyresume: */
|
||||
|
||||
/* First try to decide what to do without reference to lookahead token. */
|
||||
|
||||
yyn = yypact[yystate];
|
||||
if (yyn == YYFLAG)
|
||||
goto yydefault;
|
||||
|
||||
/* Not known => get a lookahead token if don't already have one. */
|
||||
|
||||
/* yychar is either YYEMPTY or YYEOF
|
||||
or a valid token in external form. */
|
||||
|
||||
if (ctx->yychar == YYEMPTY)
|
||||
{
|
||||
// yyStackSize = yyssp - (yyss - 1);
|
||||
ctx->yychar = YYLEX;
|
||||
}
|
||||
|
||||
/* Convert token to internal form (in yychar1) for indexing tables with */
|
||||
|
||||
if (ctx->yychar <= 0) /* This means end of input. */
|
||||
{
|
||||
yychar1 = 0;
|
||||
ctx->yychar = YYEOF; /* Don't call YYLEX any more */
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
yychar1 = YYTRANSLATE(ctx->yychar);
|
||||
|
||||
}
|
||||
|
||||
yyn += yychar1;
|
||||
if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != yychar1)
|
||||
goto yydefault;
|
||||
|
||||
yyn = yytable[yyn];
|
||||
|
||||
/* yyn is what to do for this token type in this state.
|
||||
Negative => reduce, -yyn is rule number.
|
||||
Positive => shift, yyn is new state.
|
||||
New state is final state => don't bother to shift,
|
||||
just return success.
|
||||
0, or most negative number => error. */
|
||||
|
||||
if (yyn < 0)
|
||||
{
|
||||
if (yyn == YYFLAG)
|
||||
goto yyerrlab;
|
||||
yyn = -yyn;
|
||||
goto yyreduce;
|
||||
}
|
||||
else if (yyn == 0)
|
||||
goto yyerrlab;
|
||||
|
||||
if (yyn == YYFINAL)
|
||||
YYACCEPT;
|
||||
|
||||
/* Shift the lookahead token. */
|
||||
|
||||
|
||||
/* Discard the token being shifted unless it is eof. */
|
||||
if (ctx->yychar != YYEOF)
|
||||
ctx->yychar = YYEMPTY;
|
||||
|
||||
*++yyvsp = ctx->yylval;
|
||||
|
||||
/* count tokens shifted since error; after three, turn off error status. */
|
||||
if (yyerrstatus) yyerrstatus--;
|
||||
|
||||
yystate = yyn;
|
||||
goto yynewstate;
|
||||
|
||||
/* Do the default action for the current state. */
|
||||
yydefault:
|
||||
|
||||
yyn = yydefact[yystate];
|
||||
if (yyn == 0)
|
||||
goto yyerrlab;
|
||||
|
||||
/* Do a reduction. yyn is the number of a rule to reduce with. */
|
||||
yyreduce:
|
||||
yylen = yyr2[yyn];
|
||||
yyval = yyvsp[1-yylen]; /* implement default value of the action */
|
||||
|
||||
|
||||
switch (yyn) {
|
||||
|
||||
case 1:
|
||||
//#ln 32 "cal.y"
|
||||
{ yyval = yyvsp[0]; ctx->result = yyvsp[0]; ;
|
||||
break;}
|
||||
case 2:
|
||||
//#ln 34 "cal.y"
|
||||
{ {
|
||||
YYSTYPE i = nseel_setVar(ctx,yyvsp[-2]);
|
||||
YYSTYPE v=nseel_getVar(ctx,i);
|
||||
|
||||
yyval = nseel_createCompiledFunction2(ctx,MATH_SIMPLE, FN_ASSIGN, v, yyvsp[0]);
|
||||
ctx->result = yyval;
|
||||
}
|
||||
;
|
||||
break;}
|
||||
case 3:
|
||||
//#ln 50 "cal.y"
|
||||
{ yyval = yyvsp[0] ;
|
||||
break;}
|
||||
case 4:
|
||||
//#ln 55 "cal.y"
|
||||
{ yyval = nseel_getVar(ctx,yyvsp[0]);;
|
||||
break;}
|
||||
case 5:
|
||||
//#ln 57 "cal.y"
|
||||
{ yyval = yyvsp[0];;
|
||||
break;}
|
||||
case 6:
|
||||
//#ln 59 "cal.y"
|
||||
{ yyval = yyvsp[-1];;
|
||||
break;}
|
||||
case 7:
|
||||
//#ln 64 "cal.y"
|
||||
{ yyval = yyvsp[0]; ;
|
||||
break;}
|
||||
case 8:
|
||||
//#ln 66 "cal.y"
|
||||
{ yyval = nseel_createCompiledFunction2(ctx,MATH_SIMPLE, FN_MULTIPLY, yyvsp[-2], yyvsp[0]);
|
||||
break;}
|
||||
case 9:
|
||||
//#ln 72 "cal.y"
|
||||
{ yyval = nseel_createCompiledFunction2(ctx,MATH_SIMPLE, FN_DIVIDE, yyvsp[-2], yyvsp[0]);
|
||||
break;}
|
||||
case 10:
|
||||
//#ln 78 "cal.y"
|
||||
{ yyval = nseel_createCompiledFunction2(ctx,MATH_SIMPLE, FN_MODULO, yyvsp[-2], yyvsp[0]);
|
||||
break;}
|
||||
case 11:
|
||||
//#ln 84 "cal.y"
|
||||
{ yyval = nseel_createCompiledFunction2(ctx,MATH_SIMPLE, FN_ADD, yyvsp[-2], yyvsp[0]);
|
||||
break;}
|
||||
case 12:
|
||||
//#ln 90 "cal.y"
|
||||
{ yyval = nseel_createCompiledFunction2(ctx,MATH_SIMPLE, FN_SUB, yyvsp[-2], yyvsp[0]);
|
||||
break;}
|
||||
case 13:
|
||||
//#ln 96 "cal.y"
|
||||
{ yyval = nseel_createCompiledFunction2(ctx,MATH_SIMPLE, FN_AND, yyvsp[-2], yyvsp[0]);
|
||||
break;}
|
||||
case 14:
|
||||
//#ln 102 "cal.y"
|
||||
{ yyval = nseel_createCompiledFunction2(ctx,MATH_SIMPLE, FN_OR, yyvsp[-2], yyvsp[0]);
|
||||
break;}
|
||||
case 15:
|
||||
//#ln 108 "cal.y"
|
||||
{ yyval = nseel_createCompiledFunction1(ctx,MATH_SIMPLE, FN_UMINUS, yyvsp[0]);
|
||||
break;}
|
||||
case 16:
|
||||
//#ln 114 "cal.y"
|
||||
{ yyval = nseel_createCompiledFunction1(ctx,MATH_SIMPLE, FN_UPLUS, yyvsp[0]);
|
||||
break;}
|
||||
case 17:
|
||||
//#ln 120 "cal.y"
|
||||
{ yyval = yyvsp[0];
|
||||
break;}
|
||||
case 18:
|
||||
//#ln 125 "cal.y"
|
||||
{ yyval = nseel_createCompiledFunction1(ctx,MATH_FN, yyvsp[-3], yyvsp[-1]);
|
||||
break;}
|
||||
case 19:
|
||||
//#ln 131 "cal.y"
|
||||
{ yyval = nseel_createCompiledFunction2(ctx,MATH_FN, yyvsp[-5], yyvsp[-3], yyvsp[-1]);
|
||||
break;}
|
||||
case 20:
|
||||
//#ln 137 "cal.y"
|
||||
{ yyval = nseel_createCompiledFunction3(ctx,MATH_FN, yyvsp[-7], yyvsp[-5], yyvsp[-3], yyvsp[-1]);
|
||||
break;}
|
||||
}
|
||||
/* the action file gets copied in in place of this dollarsign */
|
||||
//#ln 362 "bison.simple"
|
||||
|
||||
yyvsp -= yylen;
|
||||
yyssp -= yylen;
|
||||
|
||||
*++yyvsp = yyval;
|
||||
|
||||
|
||||
/* Now "shift" the result of the reduction.
|
||||
Determine what state that goes to,
|
||||
based on the state we popped back to
|
||||
and the rule number reduced by. */
|
||||
|
||||
yyn = yyr1[yyn];
|
||||
|
||||
yystate = yypgoto[yyn - YYNTBASE] + *yyssp;
|
||||
if (yystate >= 0 && yystate <= YYLAST && yycheck[yystate] == *yyssp)
|
||||
yystate = yytable[yystate];
|
||||
else
|
||||
yystate = yydefgoto[yyn - YYNTBASE];
|
||||
|
||||
goto yynewstate;
|
||||
|
||||
yyerrlab: /* here on detecting error */
|
||||
|
||||
if (! yyerrstatus)
|
||||
/* If not already recovering from an error, report this error. */
|
||||
{
|
||||
++ctx->yynerrs;
|
||||
|
||||
#ifdef YYERROR_VERBOSE
|
||||
yyn = yypact[yystate];
|
||||
|
||||
if (yyn > YYFLAG && yyn < YYLAST)
|
||||
{
|
||||
int size = 0;
|
||||
char *msg;
|
||||
int x, count;
|
||||
|
||||
count = 0;
|
||||
for (x = 0; x < (sizeof(yytname) / sizeof(char *)); x++)
|
||||
if (yycheck[x + yyn] == x)
|
||||
size += strlen(yytname[x]) + 15, count++;
|
||||
#error this should not compile
|
||||
msg = (char *) xmalloc(size + 15);
|
||||
strcpy(msg, "syntax error");
|
||||
|
||||
if (count < 5)
|
||||
{
|
||||
count = 0;
|
||||
for (x = 0; x < (sizeof(yytname) / sizeof(char *)); x++)
|
||||
if (yycheck[x + yyn] == x)
|
||||
{
|
||||
strcat(msg, count == 0 ? ", expecting `" : " or `");
|
||||
strcat(msg, yytname[x]);
|
||||
strcat(msg, "'");
|
||||
count++;
|
||||
}
|
||||
}
|
||||
YYERROR(msg);
|
||||
free(msg);
|
||||
}
|
||||
else
|
||||
#endif /* YYERROR_VERBOSE */
|
||||
YYERROR("syntax error");
|
||||
}
|
||||
|
||||
//yyerrlab1: /* here on error raised explicitly by an action */
|
||||
|
||||
if (yyerrstatus == 3)
|
||||
{
|
||||
/* if just tried and failed to reuse lookahead token after an error, discard it. */
|
||||
|
||||
/* return failure if at end of input */
|
||||
if (ctx->yychar == YYEOF) YYABORT;
|
||||
|
||||
ctx->yychar = YYEMPTY;
|
||||
}
|
||||
|
||||
/* Else will try to reuse lookahead token
|
||||
after shifting the error token. */
|
||||
|
||||
yyerrstatus = 3; /* Each real token shifted decrements this */
|
||||
|
||||
goto yyerrhandle;
|
||||
|
||||
yyerrdefault: /* current state does not do anything special for the error token. */
|
||||
|
||||
#if 0
|
||||
/* This is wrong; only states that explicitly want error tokens
|
||||
should shift them. */
|
||||
yyn = yydefact[yystate]; /* If its default is to accept any token, ok. Otherwise pop it.*/
|
||||
if (yyn) goto yydefault;
|
||||
#endif
|
||||
|
||||
yyerrpop: /* pop the current state because it cannot handle the error token */
|
||||
|
||||
if (yyssp == yyss) YYABORT;
|
||||
yyvsp--;
|
||||
yystate = *--yyssp;
|
||||
|
||||
|
||||
yyerrhandle:
|
||||
|
||||
yyn = yypact[yystate];
|
||||
if (yyn == YYFLAG)
|
||||
goto yyerrdefault;
|
||||
|
||||
yyn += YYTERROR;
|
||||
if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != YYTERROR)
|
||||
goto yyerrdefault;
|
||||
|
||||
yyn = yytable[yyn];
|
||||
if (yyn < 0)
|
||||
{
|
||||
if (yyn == YYFLAG)
|
||||
goto yyerrpop;
|
||||
yyn = -yyn;
|
||||
goto yyreduce;
|
||||
}
|
||||
else if (yyn == 0)
|
||||
goto yyerrpop;
|
||||
|
||||
if (yyn == YYFINAL)
|
||||
YYACCEPT;
|
||||
|
||||
*++yyvsp = ctx->yylval;
|
||||
|
||||
yystate = yyn;
|
||||
goto yynewstate;
|
||||
}
|
||||
@@ -0,0 +1,131 @@
|
||||
/*
|
||||
Expression Evaluator Library (NS-EEL) v2
|
||||
Copyright (C) 2004-2008 Cockos Incorporated
|
||||
Copyright (C) 1999-2003 Nullsoft, Inc.
|
||||
|
||||
nseel-cfunc.c: assembly/C implementation of operator/function templates
|
||||
This file should be ideally compiled with optimizations towards "minimize size"
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
arising from the use of this software.
|
||||
|
||||
Permission is granted to anyone to use this software for any purpose,
|
||||
including commercial applications, and to alter it and redistribute it
|
||||
freely, subject to the following restrictions:
|
||||
|
||||
1. The origin of this software must not be misrepresented; you must not
|
||||
claim that you wrote the original software. If you use this software
|
||||
in a product, an acknowledgment in the product documentation would be
|
||||
appreciated but is not required.
|
||||
2. Altered source versions must be plainly marked as such, and must not be
|
||||
misrepresented as being the original software.
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
*/
|
||||
|
||||
|
||||
#include "ns-eel-int.h"
|
||||
#include <math.h>
|
||||
#include <stdio.h>
|
||||
|
||||
|
||||
|
||||
// these are used by our assembly code
|
||||
|
||||
|
||||
#define N 624
|
||||
#define M 397
|
||||
#define MATRIX_A 0x9908b0dfUL /* constant vector a */
|
||||
#define UPPER_MASK 0x80000000UL /* most significant w-r bits */
|
||||
#define LOWER_MASK 0x7fffffffUL /* least significant r bits */
|
||||
|
||||
static unsigned int genrand_int32(void)
|
||||
{
|
||||
|
||||
unsigned int y;
|
||||
static unsigned int mag01[2]={0x0UL, MATRIX_A};
|
||||
/* mag01[x] = x * MATRIX_A for x=0,1 */
|
||||
|
||||
static unsigned int mt[N]; /* the array for the state vector */
|
||||
static int mti; /* mti==N+1 means mt[N] is not initialized */
|
||||
|
||||
|
||||
if (!mti)
|
||||
{
|
||||
unsigned int s=0x4141f00d;
|
||||
mt[0]= s & 0xffffffffUL;
|
||||
for (mti=1; mti<N; mti++)
|
||||
{
|
||||
mt[mti] =
|
||||
(1812433253UL * (mt[mti-1] ^ (mt[mti-1] >> 30)) + mti);
|
||||
/* See Knuth TAOCP Vol2. 3rd Ed. P.106 for multiplier. */
|
||||
/* In the previous versions, MSBs of the seed affect */
|
||||
/* only MSBs of the array mt[]. */
|
||||
/* 2002/01/09 modified by Makoto Matsumoto */
|
||||
mt[mti] &= 0xffffffffUL;
|
||||
/* for >32 bit machines */
|
||||
}
|
||||
}
|
||||
|
||||
if (mti >= N) { /* generate N words at one time */
|
||||
int kk;
|
||||
|
||||
for (kk=0;kk<N-M;kk++) {
|
||||
y = (mt[kk]&UPPER_MASK)|(mt[kk+1]&LOWER_MASK);
|
||||
mt[kk] = mt[kk+M] ^ (y >> 1) ^ mag01[y & 0x1UL];
|
||||
}
|
||||
for (;kk<N-1;kk++) {
|
||||
y = (mt[kk]&UPPER_MASK)|(mt[kk+1]&LOWER_MASK);
|
||||
mt[kk] = mt[kk+(M-N)] ^ (y >> 1) ^ mag01[y & 0x1UL];
|
||||
}
|
||||
y = (mt[N-1]&UPPER_MASK)|(mt[0]&LOWER_MASK);
|
||||
mt[N-1] = mt[M-1] ^ (y >> 1) ^ mag01[y & 0x1UL];
|
||||
|
||||
mti = 0;
|
||||
}
|
||||
|
||||
y = mt[mti++];
|
||||
|
||||
/* Tempering */
|
||||
y ^= (y >> 11);
|
||||
y ^= (y << 7) & 0x9d2c5680UL;
|
||||
y ^= (y << 15) & 0xefc60000UL;
|
||||
y ^= (y >> 18);
|
||||
|
||||
return y;
|
||||
}
|
||||
|
||||
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------
|
||||
EEL_F NSEEL_CGEN_CALL nseel_int_rand(EEL_F *f)
|
||||
{
|
||||
EEL_F x=floor(*f);
|
||||
if (x < 1.0) x=1.0;
|
||||
|
||||
#ifdef NSEEL_EEL1_COMPAT_MODE
|
||||
return (EEL_F)(genrand_int32()%(int)x);
|
||||
#else
|
||||
return (EEL_F) (genrand_int32()*(1.0/(double)0xFFFFFFFF)*x);
|
||||
#endif
|
||||
// return (EEL_F)(rand()%EEL_F2int(x));
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
|
||||
#ifdef __ppc__
|
||||
#include "asm-nseel-ppc-gcc.c"
|
||||
#else
|
||||
#ifdef _MSC_VER
|
||||
#ifdef _WIN64
|
||||
//nasm
|
||||
#else
|
||||
#include "asm-nseel-x86-msvc.c"
|
||||
#endif
|
||||
#elif !defined(__LP64__)
|
||||
#include "asm-nseel-x86-gcc.c"
|
||||
#endif
|
||||
#endif
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,321 @@
|
||||
/*
|
||||
Expression Evaluator Library (NS-EEL) v2
|
||||
Copyright (C) 2004-2008 Cockos Incorporated
|
||||
Copyright (C) 1999-2003 Nullsoft, Inc.
|
||||
|
||||
nseel-eval.c
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
arising from the use of this software.
|
||||
|
||||
Permission is granted to anyone to use this software for any purpose,
|
||||
including commercial applications, and to alter it and redistribute it
|
||||
freely, subject to the following restrictions:
|
||||
|
||||
1. The origin of this software must not be misrepresented; you must not
|
||||
claim that you wrote the original software. If you use this software
|
||||
in a product, an acknowledgment in the product documentation would be
|
||||
appreciated but is not required.
|
||||
2. Altered source versions must be plainly marked as such, and must not be
|
||||
misrepresented as being the original software.
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
*/
|
||||
|
||||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
#include "ns-eel-int.h"
|
||||
|
||||
#define NSEEL_VARS_MALLOC_CHUNKSIZE 8
|
||||
#define NSEEL_GLOBALVAR_BASE (1<<24)
|
||||
|
||||
#ifndef NSEEL_MAX_VARIABLE_NAMELEN
|
||||
#define NSEEL_MAX_VARIABLE_NAMELEN 8
|
||||
#endif
|
||||
|
||||
#define strnicmp(x,y,z) strncasecmp(x,y,z)
|
||||
|
||||
|
||||
#define INTCONST 1
|
||||
#define DBLCONST 2
|
||||
#define HEXCONST 3
|
||||
#define VARIABLE 4
|
||||
#define OTHER 5
|
||||
|
||||
EEL_F nseel_globalregs[100];
|
||||
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
void *nseel_compileExpression(compileContext *ctx, char *exp)
|
||||
{
|
||||
ctx->errVar=0;
|
||||
nseel_llinit(ctx);
|
||||
if (!nseel_yyparse(ctx,exp) && !ctx->errVar)
|
||||
{
|
||||
return (void*)ctx->result;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
void nseel_setLastVar(compileContext *ctx)
|
||||
{
|
||||
nseel_gettoken(ctx,ctx->lastVar, sizeof(ctx->lastVar));
|
||||
}
|
||||
|
||||
void NSEEL_VM_enumallvars(NSEEL_VMCTX ctx, int (*func)(const char *name, EEL_F *val, void *ctx), void *userctx)
|
||||
{
|
||||
compileContext *tctx = (compileContext *) ctx;
|
||||
int wb;
|
||||
if (!tctx) return;
|
||||
|
||||
for (wb = 0; wb < tctx->varTable_numBlocks; wb ++)
|
||||
{
|
||||
int ti;
|
||||
int namepos=0;
|
||||
for (ti = 0; ti < NSEEL_VARS_PER_BLOCK; ti ++)
|
||||
{
|
||||
char *p=tctx->varTable_Names[wb]+namepos;
|
||||
if (!*p) break;
|
||||
|
||||
|
||||
if (!func(p,&tctx->varTable_Values[wb][ti],userctx))
|
||||
break;
|
||||
|
||||
namepos += NSEEL_MAX_VARIABLE_NAMELEN;
|
||||
}
|
||||
if (ti < NSEEL_VARS_PER_BLOCK)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
static INT_PTR register_var(compileContext *ctx, const char *name, EEL_F **ptr)
|
||||
{
|
||||
int wb;
|
||||
int ti=0;
|
||||
int i=0;
|
||||
char *nameptr;
|
||||
for (wb = 0; wb < ctx->varTable_numBlocks; wb ++)
|
||||
{
|
||||
int namepos=0;
|
||||
for (ti = 0; ti < NSEEL_VARS_PER_BLOCK; ti ++)
|
||||
{
|
||||
if (!ctx->varTable_Names[wb][namepos] || !strnicmp(ctx->varTable_Names[wb]+namepos,name,NSEEL_MAX_VARIABLE_NAMELEN))
|
||||
{
|
||||
break;
|
||||
}
|
||||
namepos += NSEEL_MAX_VARIABLE_NAMELEN;
|
||||
i++;
|
||||
}
|
||||
if (ti < NSEEL_VARS_PER_BLOCK)
|
||||
break;
|
||||
}
|
||||
if (wb == ctx->varTable_numBlocks)
|
||||
{
|
||||
ti=0;
|
||||
// add new block
|
||||
if (!(ctx->varTable_numBlocks&(NSEEL_VARS_MALLOC_CHUNKSIZE-1)) || !ctx->varTable_Values || !ctx->varTable_Names )
|
||||
{
|
||||
ctx->varTable_Values = (EEL_F **)realloc(ctx->varTable_Values,(ctx->varTable_numBlocks+NSEEL_VARS_MALLOC_CHUNKSIZE) * sizeof(EEL_F *));
|
||||
ctx->varTable_Names = (char **)realloc(ctx->varTable_Names,(ctx->varTable_numBlocks+NSEEL_VARS_MALLOC_CHUNKSIZE) * sizeof(char *));
|
||||
}
|
||||
ctx->varTable_numBlocks++;
|
||||
|
||||
ctx->varTable_Values[wb] = (EEL_F *)calloc(sizeof(EEL_F),NSEEL_VARS_PER_BLOCK);
|
||||
ctx->varTable_Names[wb] = (char *)calloc(NSEEL_MAX_VARIABLE_NAMELEN,NSEEL_VARS_PER_BLOCK);
|
||||
}
|
||||
|
||||
nameptr=ctx->varTable_Names[wb]+ti*NSEEL_MAX_VARIABLE_NAMELEN;
|
||||
if (!nameptr[0])
|
||||
{
|
||||
strncpy(nameptr,name,NSEEL_MAX_VARIABLE_NAMELEN);
|
||||
}
|
||||
if (ptr) *ptr = ctx->varTable_Values[wb] + ti;
|
||||
return i;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
INT_PTR nseel_setVar(compileContext *ctx, INT_PTR varNum)
|
||||
{
|
||||
if (varNum < 0) // adding new var
|
||||
{
|
||||
char *var=ctx->lastVar;
|
||||
if (!strnicmp(var,"reg",3) && strlen(var) == 5 && isdigit(var[3]) && isdigit(var[4]))
|
||||
{
|
||||
int i,x=atoi(var+3);
|
||||
if (x < 0 || x > 99) x=0;
|
||||
i=NSEEL_GLOBALVAR_BASE+x;
|
||||
return i;
|
||||
}
|
||||
|
||||
return register_var(ctx,ctx->lastVar,NULL);
|
||||
|
||||
}
|
||||
|
||||
// setting/getting oldvar
|
||||
|
||||
if (varNum >= NSEEL_GLOBALVAR_BASE && varNum < NSEEL_GLOBALVAR_BASE+100)
|
||||
{
|
||||
return varNum;
|
||||
}
|
||||
|
||||
{
|
||||
int wb,ti;
|
||||
char *nameptr;
|
||||
if (varNum < 0 || varNum >= ctx->varTable_numBlocks*NSEEL_VARS_PER_BLOCK) return -1;
|
||||
|
||||
wb=varNum/NSEEL_VARS_PER_BLOCK;
|
||||
ti=(varNum%NSEEL_VARS_PER_BLOCK);
|
||||
nameptr=ctx->varTable_Names[wb]+ti*NSEEL_MAX_VARIABLE_NAMELEN;
|
||||
if (!nameptr[0])
|
||||
{
|
||||
strncpy(nameptr,ctx->lastVar,NSEEL_MAX_VARIABLE_NAMELEN);
|
||||
}
|
||||
return varNum;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
INT_PTR nseel_getVar(compileContext *ctx, INT_PTR i)
|
||||
{
|
||||
if (i >= 0 && i < (NSEEL_VARS_PER_BLOCK*ctx->varTable_numBlocks))
|
||||
return nseel_createCompiledValue(ctx,0, ctx->varTable_Values[i/NSEEL_VARS_PER_BLOCK] + i%NSEEL_VARS_PER_BLOCK);
|
||||
if (i >= NSEEL_GLOBALVAR_BASE && i < NSEEL_GLOBALVAR_BASE+100)
|
||||
return nseel_createCompiledValue(ctx,0, nseel_globalregs+i-NSEEL_GLOBALVAR_BASE);
|
||||
|
||||
return nseel_createCompiledValue(ctx,0, NULL);
|
||||
}
|
||||
|
||||
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
EEL_F *NSEEL_VM_regvar(NSEEL_VMCTX _ctx, const char *var)
|
||||
{
|
||||
compileContext *ctx = (compileContext *)_ctx;
|
||||
EEL_F *r;
|
||||
if (!ctx) return 0;
|
||||
|
||||
if (!strnicmp(var,"reg",3) && strlen(var) == 5 && isdigit(var[3]) && isdigit(var[4]))
|
||||
{
|
||||
int x=atoi(var+3);
|
||||
if (x < 0 || x > 99) x=0;
|
||||
return nseel_globalregs + x;
|
||||
}
|
||||
|
||||
register_var(ctx,var,&r);
|
||||
|
||||
return r;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
INT_PTR nseel_translate(compileContext *ctx, int type)
|
||||
{
|
||||
int v;
|
||||
int n;
|
||||
*ctx->yytext = 0;
|
||||
nseel_gettoken(ctx,ctx->yytext, sizeof(ctx->yytext));
|
||||
|
||||
switch (type)
|
||||
{
|
||||
case INTCONST: return nseel_createCompiledValue(ctx,(EEL_F)atoi(ctx->yytext), NULL);
|
||||
case DBLCONST: return nseel_createCompiledValue(ctx,(EEL_F)atof(ctx->yytext), NULL);
|
||||
case HEXCONST:
|
||||
v=0;
|
||||
n=0;
|
||||
while (1)
|
||||
{
|
||||
int a=ctx->yytext[n++];
|
||||
if (a >= '0' && a <= '9') v=(v<<4)+a-'0';
|
||||
else if (a >= 'A' && a <= 'F') v=(v<<4)+10+a-'A';
|
||||
else if (a >= 'a' && a <= 'f') v=(v<<4)+10+a-'a';
|
||||
else break;
|
||||
}
|
||||
return nseel_createCompiledValue(ctx,(EEL_F)v, NULL);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
INT_PTR nseel_lookup(compileContext *ctx, int *typeOfObject)
|
||||
{
|
||||
int i, ti, wb;
|
||||
const char *nptr;
|
||||
nseel_gettoken(ctx,ctx->yytext, sizeof(ctx->yytext));
|
||||
|
||||
if (!strnicmp(ctx->yytext,"reg",3) && strlen(ctx->yytext) == 5 && isdigit(ctx->yytext[3]) && isdigit(ctx->yytext[4]) && (i=atoi(ctx->yytext+3))>=0 && i<100)
|
||||
{
|
||||
*typeOfObject=IDENTIFIER;
|
||||
return i+NSEEL_GLOBALVAR_BASE;
|
||||
}
|
||||
|
||||
i=0;
|
||||
for (wb = 0; wb < ctx->varTable_numBlocks; wb ++)
|
||||
{
|
||||
int namepos=0;
|
||||
for (ti = 0; ti < NSEEL_VARS_PER_BLOCK; ti ++)
|
||||
{
|
||||
if (!ctx->varTable_Names[wb][namepos]) break;
|
||||
|
||||
if (!strnicmp(ctx->varTable_Names[wb]+namepos,ctx->yytext,NSEEL_MAX_VARIABLE_NAMELEN))
|
||||
{
|
||||
*typeOfObject = IDENTIFIER;
|
||||
return i;
|
||||
}
|
||||
|
||||
namepos += NSEEL_MAX_VARIABLE_NAMELEN;
|
||||
i++;
|
||||
}
|
||||
if (ti < NSEEL_VARS_PER_BLOCK) break;
|
||||
}
|
||||
|
||||
|
||||
nptr = ctx->yytext;
|
||||
if (!strcasecmp(nptr,"if")) nptr="_if";
|
||||
else if (!strcasecmp(nptr,"bnot")) nptr="_not";
|
||||
else if (!strcasecmp(nptr,"assign")) nptr="_set";
|
||||
else if (!strcasecmp(nptr,"equal")) nptr="_equal";
|
||||
else if (!strcasecmp(nptr,"below")) nptr="_below";
|
||||
else if (!strcasecmp(nptr,"above")) nptr="_above";
|
||||
else if (!strcasecmp(nptr,"megabuf")) nptr="_mem";
|
||||
else if (!strcasecmp(nptr,"gmegabuf")) nptr="_gmem";
|
||||
else if (!strcasecmp(nptr,"int")) nptr="floor";
|
||||
|
||||
for (i=0;nseel_getFunctionFromTable(i);i++)
|
||||
{
|
||||
functionType *f=nseel_getFunctionFromTable(i);
|
||||
if (!strcasecmp(f->name, nptr))
|
||||
{
|
||||
switch (f->nParams)
|
||||
{
|
||||
case 1: *typeOfObject = FUNCTION1; break;
|
||||
case 2: *typeOfObject = FUNCTION2; break;
|
||||
case 3: *typeOfObject = FUNCTION3; break;
|
||||
default: *typeOfObject = IDENTIFIER; break;
|
||||
}
|
||||
return i;
|
||||
}
|
||||
}
|
||||
|
||||
*typeOfObject = IDENTIFIER;
|
||||
nseel_setLastVar(ctx);
|
||||
return nseel_setVar(ctx,-1);
|
||||
}
|
||||
|
||||
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
void nseel_count(compileContext *ctx)
|
||||
{
|
||||
nseel_gettoken(ctx,ctx->yytext, sizeof(ctx->yytext));
|
||||
ctx->colCount+=strlen(ctx->yytext);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
int nseel_yyerror(compileContext *ctx)
|
||||
{
|
||||
ctx->errVar = ctx->colCount;
|
||||
return 0;
|
||||
}
|
||||
@@ -0,0 +1,277 @@
|
||||
/*
|
||||
Expression Evaluator Library (NS-EEL) v2
|
||||
Copyright (C) 2004-2008 Cockos Incorporated
|
||||
Copyright (C) 1999-2003 Nullsoft, Inc.
|
||||
|
||||
nseel-lextab.c
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
arising from the use of this software.
|
||||
|
||||
Permission is granted to anyone to use this software for any purpose,
|
||||
including commercial applications, and to alter it and redistribute it
|
||||
freely, subject to the following restrictions:
|
||||
|
||||
1. The origin of this software must not be misrepresented; you must not
|
||||
claim that you wrote the original software. If you use this software
|
||||
in a product, an acknowledgment in the product documentation would be
|
||||
appreciated but is not required.
|
||||
2. Altered source versions must be plainly marked as such, and must not be
|
||||
misrepresented as being the original software.
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
*/
|
||||
|
||||
#include "ns-eel-int.h"
|
||||
|
||||
|
||||
#define LEXSKIP (-1)
|
||||
|
||||
static int _lmovb(struct lextab *lp, int c, int st)
|
||||
{
|
||||
int base;
|
||||
|
||||
while ((base = lp->llbase[st]+c) > lp->llnxtmax ||
|
||||
(lp->llcheck[base] & 0377) != st) {
|
||||
|
||||
if (st != lp->llendst) {
|
||||
base = lp->lldefault[st] & 0377;
|
||||
st = base;
|
||||
}
|
||||
else
|
||||
return(-1);
|
||||
}
|
||||
return(lp->llnext[base]&0377);
|
||||
}
|
||||
|
||||
#define INTCONST 1
|
||||
#define DBLCONST 2
|
||||
#define HEXCONST 3
|
||||
#define VARIABLE 4
|
||||
#define OTHER 5
|
||||
|
||||
static int _Alextab(compileContext *ctx, int __na__)
|
||||
{
|
||||
// fucko: JF> 17 -> 19?
|
||||
|
||||
if (__na__ >= 0 && __na__ <= 17)
|
||||
nseel_count(ctx);
|
||||
switch (__na__)
|
||||
{
|
||||
case 0:
|
||||
*ctx->yytext = 0;
|
||||
nseel_gettoken(ctx,ctx->yytext, sizeof(ctx->yytext));
|
||||
if (ctx->yytext[0] < '0' || ctx->yytext[0] > '9') // not really a hex value, lame
|
||||
{
|
||||
nseel_setLastVar(ctx); ctx->yylval = nseel_lookup(ctx,&__na__); return __na__;
|
||||
}
|
||||
ctx->yylval = nseel_translate(ctx,HEXCONST);
|
||||
return VALUE;
|
||||
case 1: ctx->yylval = nseel_translate(ctx,INTCONST); return VALUE;
|
||||
case 2: ctx->yylval = nseel_translate(ctx,INTCONST); return VALUE;
|
||||
case 3: ctx->yylval = nseel_translate(ctx,DBLCONST); return VALUE;
|
||||
case 4:
|
||||
case 5: nseel_setLastVar(ctx); ctx->yylval = nseel_lookup(ctx,&__na__); return __na__;
|
||||
case 6: return '+';
|
||||
case 7: return '-';
|
||||
case 8: return '*';
|
||||
case 9: return '/';
|
||||
case 10: return '%';
|
||||
case 11: return '&';
|
||||
case 12: return '|';
|
||||
case 13: return '(';
|
||||
case 14: return ')';
|
||||
case 15: return '=';
|
||||
case 16: return ',';
|
||||
case 17: return ';';
|
||||
}
|
||||
return (LEXSKIP);
|
||||
}
|
||||
|
||||
|
||||
static char _Flextab[] =
|
||||
{
|
||||
1, 18, 17, 16, 15, 14, 13, 12,
|
||||
11, 10, 9, 8, 7, 6, 4, 5,
|
||||
5, 4, 4, 3, 3, 3, 3, 4,
|
||||
0, 4, 5, 0, 5, 4, 1, 3,
|
||||
0, 2, -1, 1, -1,
|
||||
};
|
||||
|
||||
|
||||
static char _Nlextab[] =
|
||||
{
|
||||
36, 36, 36, 36, 36, 36, 36, 36,
|
||||
36, 1, 36, 36, 36, 36, 36, 36,
|
||||
36, 36, 36, 36, 36, 36, 36, 36,
|
||||
36, 36, 36, 36, 36, 36, 36, 36,
|
||||
1, 36, 36, 36, 36, 9, 8, 36,
|
||||
6, 5, 11, 13, 3, 12, 19, 10,
|
||||
30, 30, 30, 30, 30, 30, 30, 30,
|
||||
30, 30, 36, 2, 36, 4, 36, 36,
|
||||
36, 29, 29, 29, 29, 29, 29, 18,
|
||||
18, 18, 18, 18, 18, 18, 18, 18,
|
||||
18, 18, 18, 18, 18, 18, 18, 18,
|
||||
18, 18, 18, 36, 36, 36, 36, 18,
|
||||
36, 29, 29, 29, 29, 29, 23, 18,
|
||||
18, 18, 18, 18, 18, 18, 18, 18,
|
||||
18, 18, 18, 18, 18, 18, 14, 18,
|
||||
18, 18, 18, 36, 7, 15, 15, 15,
|
||||
15, 15, 15, 15, 15, 15, 15, 36,
|
||||
36, 36, 36, 36, 36, 36, 17, 17,
|
||||
17, 17, 17, 17, 17, 17, 17, 17,
|
||||
17, 17, 17, 17, 17, 17, 17, 17,
|
||||
17, 17, 17, 17, 17, 17, 17, 17,
|
||||
36, 36, 36, 36, 17, 36, 17, 17,
|
||||
17, 17, 17, 17, 17, 17, 17, 17,
|
||||
17, 17, 17, 17, 17, 17, 17, 17,
|
||||
17, 17, 17, 17, 17, 17, 17, 17,
|
||||
15, 15, 15, 15, 15, 15, 15, 15,
|
||||
15, 15, 36, 36, 36, 36, 36, 36,
|
||||
36, 16, 16, 16, 16, 16, 16, 16,
|
||||
16, 16, 16, 16, 16, 16, 16, 16,
|
||||
16, 16, 16, 16, 16, 16, 16, 16,
|
||||
16, 16, 16, 36, 36, 36, 36, 16,
|
||||
36, 16, 16, 16, 16, 16, 16, 16,
|
||||
16, 16, 16, 16, 16, 16, 16, 16,
|
||||
16, 16, 16, 16, 16, 16, 16, 16,
|
||||
16, 16, 16, 22, 22, 22, 22, 22,
|
||||
22, 22, 22, 22, 22, 21, 21, 21,
|
||||
21, 21, 21, 21, 21, 21, 21, 36,
|
||||
20, 26, 26, 26, 26, 26, 26, 26,
|
||||
26, 26, 26, 36, 36, 36, 36, 36,
|
||||
36, 36, 25, 25, 25, 25, 25, 25,
|
||||
36, 24, 36, 36, 36, 36, 36, 36,
|
||||
20, 36, 36, 36, 36, 36, 36, 36,
|
||||
36, 36, 36, 36, 36, 36, 36, 36,
|
||||
36, 36, 25, 25, 25, 25, 25, 25,
|
||||
36, 24, 26, 26, 26, 26, 26, 26,
|
||||
26, 26, 26, 26, 36, 36, 36, 36,
|
||||
36, 36, 36, 28, 28, 28, 28, 28,
|
||||
28, 36, 27, 36, 36, 36, 36, 36,
|
||||
36, 36, 36, 36, 36, 36, 36, 36,
|
||||
36, 36, 36, 36, 36, 36, 36, 36,
|
||||
36, 36, 36, 28, 28, 28, 28, 28,
|
||||
28, 31, 27, 35, 35, 35, 35, 35,
|
||||
35, 35, 35, 35, 35, 36, 36, 36,
|
||||
36, 36, 36, 36, 34, 34, 34, 33,
|
||||
34, 34, 36, 32, 36, 36, 36, 36,
|
||||
36, 36, 36, 36, 36, 36, 36, 36,
|
||||
36, 36, 36, 36, 36, 36, 36, 36,
|
||||
36, 36, 36, 36, 34, 34, 34, 33,
|
||||
34, 34, 36, 32, 34, 34, 34, 34,
|
||||
34, 34, 34, 34, 34, 34, 36, 36,
|
||||
36, 36, 36, 36, 36, 34, 34, 34,
|
||||
34, 34, 34, 36, 32, 36, 36, 36,
|
||||
36, 36, 36, 36, 36, 36, 36, 36,
|
||||
36, 36, 36, 36, 36, 36, 36, 36,
|
||||
36, 36, 36, 36, 36, 34, 34, 34,
|
||||
34, 34, 34, 36, 32,
|
||||
};
|
||||
|
||||
static char _Clextab[] =
|
||||
{
|
||||
-1, -1, -1, -1, -1, -1, -1, -1,
|
||||
-1, 0, -1, -1, -1, -1, -1, -1,
|
||||
-1, -1, -1, -1, -1, -1, -1, -1,
|
||||
-1, -1, -1, -1, -1, -1, -1, -1,
|
||||
0, -1, -1, -1, -1, 0, 0, -1,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, -1, 0, -1, 0, -1, -1,
|
||||
-1, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, -1, -1, -1, -1, 0,
|
||||
-1, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, -1, 0, 14, 14, 14,
|
||||
14, 14, 14, 14, 14, 14, 14, -1,
|
||||
-1, -1, -1, -1, -1, -1, 14, 14,
|
||||
14, 14, 14, 14, 14, 14, 14, 14,
|
||||
14, 14, 14, 14, 14, 14, 14, 14,
|
||||
14, 14, 14, 14, 14, 14, 14, 14,
|
||||
-1, -1, -1, -1, 14, -1, 14, 14,
|
||||
14, 14, 14, 14, 14, 14, 14, 14,
|
||||
14, 14, 14, 14, 14, 14, 14, 14,
|
||||
14, 14, 14, 14, 14, 14, 14, 14,
|
||||
15, 15, 15, 15, 15, 15, 15, 15,
|
||||
15, 15, -1, -1, -1, -1, -1, -1,
|
||||
-1, 15, 15, 15, 15, 15, 15, 15,
|
||||
15, 15, 15, 15, 15, 15, 15, 15,
|
||||
15, 15, 15, 15, 15, 15, 15, 15,
|
||||
15, 15, 15, -1, -1, -1, -1, 15,
|
||||
-1, 15, 15, 15, 15, 15, 15, 15,
|
||||
15, 15, 15, 15, 15, 15, 15, 15,
|
||||
15, 15, 15, 15, 15, 15, 15, 15,
|
||||
15, 15, 15, 19, 19, 19, 19, 19,
|
||||
19, 19, 19, 19, 19, 20, 20, 20,
|
||||
20, 20, 20, 20, 20, 20, 20, -1,
|
||||
19, 23, 23, 23, 23, 23, 23, 23,
|
||||
23, 23, 23, -1, -1, -1, -1, -1,
|
||||
-1, -1, 23, 23, 23, 23, 23, 23,
|
||||
-1, 23, -1, -1, -1, -1, -1, -1,
|
||||
19, -1, -1, -1, -1, -1, -1, -1,
|
||||
-1, -1, -1, -1, -1, -1, -1, -1,
|
||||
-1, -1, 23, 23, 23, 23, 23, 23,
|
||||
-1, 23, 26, 26, 26, 26, 26, 26,
|
||||
26, 26, 26, 26, -1, -1, -1, -1,
|
||||
-1, -1, -1, 26, 26, 26, 26, 26,
|
||||
26, -1, 26, -1, -1, -1, -1, -1,
|
||||
-1, -1, -1, -1, -1, -1, -1, -1,
|
||||
-1, -1, -1, -1, -1, -1, -1, -1,
|
||||
-1, -1, -1, 26, 26, 26, 26, 26,
|
||||
26, 30, 26, 30, 30, 30, 30, 30,
|
||||
30, 30, 30, 30, 30, -1, -1, -1,
|
||||
-1, -1, -1, -1, 30, 30, 30, 30,
|
||||
30, 30, -1, 30, -1, -1, -1, -1,
|
||||
-1, -1, -1, -1, -1, -1, -1, -1,
|
||||
-1, -1, -1, -1, -1, -1, -1, -1,
|
||||
-1, -1, -1, -1, 30, 30, 30, 30,
|
||||
30, 30, -1, 30, 33, 33, 33, 33,
|
||||
33, 33, 33, 33, 33, 33, -1, -1,
|
||||
-1, -1, -1, -1, -1, 33, 33, 33,
|
||||
33, 33, 33, -1, 33, -1, -1, -1,
|
||||
-1, -1, -1, -1, -1, -1, -1, -1,
|
||||
-1, -1, -1, -1, -1, -1, -1, -1,
|
||||
-1, -1, -1, -1, -1, 33, 33, 33,
|
||||
33, 33, 33, -1, 33,
|
||||
};
|
||||
|
||||
static char _Dlextab[] =
|
||||
{
|
||||
36, 36, 36, 36, 36, 36, 36, 36,
|
||||
36, 36, 36, 36, 36, 36, 36, 36,
|
||||
15, 14, 14, 36, 36, 20, 19, 14,
|
||||
14, 23, 15, 15, 26, 23, 36, 19,
|
||||
36, 36, 33, 30,
|
||||
};
|
||||
|
||||
static int _Blextab[] =
|
||||
{
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 77, 152,
|
||||
0, 0, 0, 227, 237, 0, 0, 249,
|
||||
0, 0, 306, 0, 0, 0, 363, 0,
|
||||
0, 420, 0, 0, 0,
|
||||
};
|
||||
|
||||
struct lextab nseel_lextab = {
|
||||
36,
|
||||
_Dlextab,
|
||||
_Nlextab,
|
||||
_Clextab,
|
||||
_Blextab,
|
||||
524,
|
||||
_lmovb,
|
||||
_Flextab,
|
||||
_Alextab,
|
||||
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
};
|
||||
|
||||
|
||||
@@ -0,0 +1,320 @@
|
||||
/*
|
||||
Expression Evaluator Library (NS-EEL) v2
|
||||
Copyright (C) 2004-2008 Cockos Incorporated
|
||||
Copyright (C) 1999-2003 Nullsoft, Inc.
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
arising from the use of this software.
|
||||
|
||||
Permission is granted to anyone to use this software for any purpose,
|
||||
including commercial applications, and to alter it and redistribute it
|
||||
freely, subject to the following restrictions:
|
||||
|
||||
1. The origin of this software must not be misrepresented; you must not
|
||||
claim that you wrote the original software. If you use this software
|
||||
in a product, an acknowledgment in the product documentation would be
|
||||
appreciated but is not required.
|
||||
2. Altered source versions must be plainly marked as such, and must not be
|
||||
misrepresented as being the original software.
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
*/
|
||||
|
||||
#include "ns-eel.h"
|
||||
#include "ns-eel-int.h"
|
||||
#include <math.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
|
||||
#ifdef _WIN32
|
||||
#include <malloc.h>
|
||||
#endif
|
||||
|
||||
unsigned int NSEEL_RAM_limitmem=0;
|
||||
unsigned int NSEEL_RAM_memused=0;
|
||||
int NSEEL_RAM_memused_errors=0;
|
||||
|
||||
|
||||
|
||||
int NSEEL_VM_wantfreeRAM(NSEEL_VMCTX ctx)
|
||||
{
|
||||
if (ctx)
|
||||
{
|
||||
compileContext *c=(compileContext*)ctx;
|
||||
if (c->ram_needfree)
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
void NSEEL_VM_freeRAMIfCodeRequested(NSEEL_VMCTX ctx) // check to see if our free flag was set
|
||||
{
|
||||
if (ctx)
|
||||
{
|
||||
compileContext *c=(compileContext*)ctx;
|
||||
if (c->ram_needfree)
|
||||
{
|
||||
NSEEL_HOSTSTUB_EnterMutex();
|
||||
if (c->ram_blocks)
|
||||
{
|
||||
INT_PTR startpos=((INT_PTR)c->ram_needfree)-1;
|
||||
EEL_F **blocks = (EEL_F **)c->ram_blocks;
|
||||
INT_PTR pos=0;
|
||||
int x;
|
||||
for (x = 0; x < NSEEL_RAM_BLOCKS; x ++)
|
||||
{
|
||||
if (pos >= startpos)
|
||||
{
|
||||
if (blocks[x])
|
||||
{
|
||||
if (NSEEL_RAM_memused >= sizeof(EEL_F) * NSEEL_RAM_ITEMSPERBLOCK)
|
||||
NSEEL_RAM_memused -= sizeof(EEL_F) * NSEEL_RAM_ITEMSPERBLOCK;
|
||||
else NSEEL_RAM_memused_errors++;
|
||||
}
|
||||
free(blocks[x]);
|
||||
blocks[x]=0;
|
||||
}
|
||||
pos+=NSEEL_RAM_ITEMSPERBLOCK;
|
||||
}
|
||||
if (!startpos)
|
||||
{
|
||||
free(blocks);
|
||||
c->ram_blocks=0;
|
||||
}
|
||||
}
|
||||
c->ram_needfree=0;
|
||||
NSEEL_HOSTSTUB_LeaveMutex();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
EEL_F * NSEEL_CGEN_CALL __NSEEL_RAMAllocGMEM(EEL_F ***blocks, int w)
|
||||
{
|
||||
static EEL_F * volatile gmembuf;
|
||||
if (blocks) return __NSEEL_RAMAlloc(blocks,w);
|
||||
|
||||
if (!gmembuf)
|
||||
{
|
||||
NSEEL_HOSTSTUB_EnterMutex();
|
||||
if (!gmembuf) gmembuf=(EEL_F*)calloc(sizeof(EEL_F),NSEEL_SHARED_GRAM_SIZE);
|
||||
NSEEL_HOSTSTUB_LeaveMutex();
|
||||
|
||||
if (!gmembuf) return 0;
|
||||
}
|
||||
|
||||
return gmembuf+(((unsigned int)w)&((NSEEL_SHARED_GRAM_SIZE)-1));
|
||||
}
|
||||
|
||||
EEL_F * NSEEL_CGEN_CALL __NSEEL_RAMAlloc(EEL_F ***blocks, int w)
|
||||
{
|
||||
int whichblock;
|
||||
EEL_F **pblocks=*blocks;
|
||||
|
||||
int is_locked=0;
|
||||
|
||||
if (!pblocks)
|
||||
{
|
||||
if (!is_locked) { is_locked=1; NSEEL_HOSTSTUB_EnterMutex(); }
|
||||
|
||||
if (!(pblocks=*blocks))
|
||||
{
|
||||
pblocks = *blocks = (EEL_F **)calloc(sizeof(EEL_F *),NSEEL_RAM_BLOCKS);
|
||||
if (!pblocks) {
|
||||
if (is_locked) NSEEL_HOSTSTUB_LeaveMutex();
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// fprintf(stderr,"got request at %d, %d\n",w/NSEEL_RAM_ITEMSPERBLOCK, w&(NSEEL_RAM_ITEMSPERBLOCK-1));
|
||||
if (w >= 0 && (whichblock = w/NSEEL_RAM_ITEMSPERBLOCK) < NSEEL_RAM_BLOCKS)
|
||||
{
|
||||
EEL_F *p=pblocks[whichblock];
|
||||
if (!p)
|
||||
{
|
||||
if (!is_locked) { is_locked=1; NSEEL_HOSTSTUB_EnterMutex(); }
|
||||
|
||||
if (!(p=pblocks[whichblock]))
|
||||
{
|
||||
|
||||
const int msize=sizeof(EEL_F) * NSEEL_RAM_ITEMSPERBLOCK;
|
||||
if (!NSEEL_RAM_limitmem || NSEEL_RAM_memused+msize < NSEEL_RAM_limitmem)
|
||||
{
|
||||
p=pblocks[whichblock]=(EEL_F *)calloc(sizeof(EEL_F),NSEEL_RAM_ITEMSPERBLOCK);
|
||||
if (p) NSEEL_RAM_memused+=msize;
|
||||
}
|
||||
if (!p) w=0;
|
||||
}
|
||||
}
|
||||
if (is_locked) NSEEL_HOSTSTUB_LeaveMutex();
|
||||
return p + (w&(NSEEL_RAM_ITEMSPERBLOCK-1));
|
||||
}
|
||||
if (is_locked) NSEEL_HOSTSTUB_LeaveMutex();
|
||||
// fprintf(stderr,"ret 0\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
EEL_F * NSEEL_CGEN_CALL __NSEEL_RAM_MemFree(EEL_F ***blocks, EEL_F *which)
|
||||
{
|
||||
int d=EEL_F2int(*which);
|
||||
if (d < 0) d=0;
|
||||
if (d < NSEEL_RAM_BLOCKS*NSEEL_RAM_ITEMSPERBLOCK) ((INT_PTR *)blocks)[1]=1+d;
|
||||
return which;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
EEL_F * NSEEL_CGEN_CALL __NSEEL_RAM_MemCpy(EEL_F ***blocks,EEL_F *dest, EEL_F *src, EEL_F *lenptr)
|
||||
{
|
||||
int dest_offs = EEL_F2int(*dest + 0.0001);
|
||||
int src_offs = EEL_F2int(*src + 0.0001);
|
||||
int len = EEL_F2int(*lenptr + 0.0001);
|
||||
|
||||
// trim to front
|
||||
if (src_offs<0)
|
||||
{
|
||||
len += src_offs;
|
||||
dest_offs -= src_offs;
|
||||
src_offs=0;
|
||||
}
|
||||
if (dest_offs<0)
|
||||
{
|
||||
len += dest_offs;
|
||||
src_offs -= dest_offs;
|
||||
dest_offs=0;
|
||||
}
|
||||
|
||||
while (len > 0)
|
||||
{
|
||||
EEL_F *srcptr,*destptr;
|
||||
int copy_len = len;
|
||||
int maxdlen=NSEEL_RAM_ITEMSPERBLOCK - (dest_offs&(NSEEL_RAM_ITEMSPERBLOCK-1));
|
||||
int maxslen=NSEEL_RAM_ITEMSPERBLOCK - (src_offs&(NSEEL_RAM_ITEMSPERBLOCK-1));
|
||||
|
||||
if (dest_offs >= NSEEL_RAM_BLOCKS*NSEEL_RAM_ITEMSPERBLOCK ||
|
||||
src_offs >= NSEEL_RAM_BLOCKS*NSEEL_RAM_ITEMSPERBLOCK) break;
|
||||
|
||||
if (copy_len > maxdlen) copy_len=maxdlen;
|
||||
if (copy_len > maxslen) copy_len=maxslen;
|
||||
|
||||
if (copy_len<1) break;
|
||||
|
||||
srcptr = __NSEEL_RAMAlloc(blocks,src_offs);
|
||||
destptr = __NSEEL_RAMAlloc(blocks,dest_offs);
|
||||
if (!srcptr || !destptr) break;
|
||||
|
||||
memmove(destptr,srcptr,sizeof(EEL_F)*copy_len);
|
||||
src_offs+=copy_len;
|
||||
dest_offs+=copy_len;
|
||||
len-=copy_len;
|
||||
}
|
||||
return dest;
|
||||
}
|
||||
|
||||
EEL_F * NSEEL_CGEN_CALL __NSEEL_RAM_MemSet(EEL_F ***blocks,EEL_F *dest, EEL_F *v, EEL_F *lenptr)
|
||||
{
|
||||
int offs = EEL_F2int(*dest + 0.0001);
|
||||
int len = EEL_F2int(*lenptr + 0.0001);
|
||||
EEL_F t;
|
||||
if (offs<0)
|
||||
{
|
||||
len += offs;
|
||||
offs=0;
|
||||
}
|
||||
if (offs >= NSEEL_RAM_BLOCKS*NSEEL_RAM_ITEMSPERBLOCK) return dest;
|
||||
|
||||
if (offs+len > NSEEL_RAM_BLOCKS*NSEEL_RAM_ITEMSPERBLOCK) len = NSEEL_RAM_BLOCKS*NSEEL_RAM_ITEMSPERBLOCK - offs;
|
||||
|
||||
if (len < 1) return dest;
|
||||
|
||||
|
||||
t=*v; // set value
|
||||
|
||||
// int lastBlock=-1;
|
||||
while (len > 0)
|
||||
{
|
||||
int lcnt;
|
||||
EEL_F *ptr=__NSEEL_RAMAlloc(blocks,offs);
|
||||
if (!ptr) break;
|
||||
|
||||
lcnt=NSEEL_RAM_ITEMSPERBLOCK-(offs&(NSEEL_RAM_ITEMSPERBLOCK-1));
|
||||
if (lcnt > len) lcnt=len;
|
||||
|
||||
len -= lcnt;
|
||||
offs += lcnt;
|
||||
|
||||
while (lcnt--)
|
||||
{
|
||||
*ptr++=t;
|
||||
}
|
||||
}
|
||||
return dest;
|
||||
}
|
||||
|
||||
|
||||
void NSEEL_VM_SetGRAM(NSEEL_VMCTX ctx, void **gram)
|
||||
{
|
||||
if (ctx)
|
||||
{
|
||||
compileContext *c=(compileContext*)ctx;
|
||||
c->gram_blocks = gram;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void NSEEL_VM_freeRAM(NSEEL_VMCTX ctx)
|
||||
{
|
||||
if (ctx)
|
||||
{
|
||||
int x;
|
||||
compileContext *c=(compileContext*)ctx;
|
||||
if (c->ram_blocks)
|
||||
{
|
||||
EEL_F **blocks = (EEL_F **)c->ram_blocks;
|
||||
for (x = 0; x < NSEEL_RAM_BLOCKS; x ++)
|
||||
{
|
||||
if (blocks[x])
|
||||
{
|
||||
if (NSEEL_RAM_memused >= sizeof(EEL_F) * NSEEL_RAM_ITEMSPERBLOCK)
|
||||
NSEEL_RAM_memused -= sizeof(EEL_F) * NSEEL_RAM_ITEMSPERBLOCK;
|
||||
else NSEEL_RAM_memused_errors++;
|
||||
}
|
||||
free(blocks[x]);
|
||||
blocks[x]=0;
|
||||
}
|
||||
free(blocks);
|
||||
c->ram_blocks=0;
|
||||
}
|
||||
c->ram_needfree=0; // no need to free anymore
|
||||
}
|
||||
}
|
||||
|
||||
void NSEEL_VM_FreeGRAM(void **ufd)
|
||||
{
|
||||
if (ufd[0])
|
||||
{
|
||||
EEL_F **blocks = (EEL_F **)ufd[0];
|
||||
int x;
|
||||
for (x = 0; x < NSEEL_RAM_BLOCKS; x ++)
|
||||
{
|
||||
if (blocks[x])
|
||||
{
|
||||
if (NSEEL_RAM_memused >= sizeof(EEL_F) * NSEEL_RAM_ITEMSPERBLOCK)
|
||||
NSEEL_RAM_memused -= sizeof(EEL_F) * NSEEL_RAM_ITEMSPERBLOCK;
|
||||
else NSEEL_RAM_memused_errors++;
|
||||
}
|
||||
free(blocks[x]);
|
||||
blocks[x]=0;
|
||||
}
|
||||
free(blocks);
|
||||
ufd[0]=0;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,163 @@
|
||||
/*
|
||||
Expression Evaluator Library (NS-EEL)
|
||||
Copyright (C) 2004-2008 Cockos Incorporated
|
||||
Copyright (C) 1999-2003 Nullsoft, Inc.
|
||||
|
||||
nseel-yylex.c
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
arising from the use of this software.
|
||||
|
||||
Permission is granted to anyone to use this software for any purpose,
|
||||
including commercial applications, and to alter it and redistribute it
|
||||
freely, subject to the following restrictions:
|
||||
|
||||
1. The origin of this software must not be misrepresented; you must not
|
||||
claim that you wrote the original software. If you use this software
|
||||
in a product, an acknowledgment in the product documentation would be
|
||||
appreciated but is not required.
|
||||
2. Altered source versions must be plainly marked as such, and must not be
|
||||
misrepresented as being the original software.
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
*/
|
||||
|
||||
|
||||
#include "ns-eel-int.h"
|
||||
|
||||
|
||||
#define NBPW 16
|
||||
#define EOF (-1)
|
||||
|
||||
|
||||
#define YYERRORVAL 256 /* yacc's value */
|
||||
|
||||
static int llset(compileContext *ctx);
|
||||
static int llinp(compileContext *ctx, char **exp);
|
||||
static int lexgetc(char **exp)
|
||||
{
|
||||
char c= **exp;
|
||||
if (c) (*exp)++;
|
||||
return( c != 0 ? c : -1);
|
||||
}
|
||||
static int tst__b(register int c, char tab[])
|
||||
{
|
||||
return (tab[(c >> 3) & 037] & (1 << (c & 07)) );
|
||||
}
|
||||
|
||||
int nseel_gettoken(compileContext *ctx, char *lltb, int lltbsiz)
|
||||
{
|
||||
register char *lp, *tp, *ep;
|
||||
|
||||
tp = lltb;
|
||||
ep = tp+lltbsiz-1;
|
||||
for (lp = ctx->llbuf; lp < ctx->llend && tp < ep;)
|
||||
*tp++ = *lp++;
|
||||
*tp = 0;
|
||||
return(tp-lltb);
|
||||
}
|
||||
|
||||
|
||||
int nseel_yylex(compileContext *ctx, char **exp)
|
||||
{
|
||||
register int c, st;
|
||||
int final, l, llk, i;
|
||||
register struct lextab *lp;
|
||||
char *cp;
|
||||
|
||||
while (1)
|
||||
{
|
||||
llk = 0;
|
||||
if (llset(ctx)) return(0);
|
||||
st = 0;
|
||||
final = -1;
|
||||
lp = &nseel_lextab;
|
||||
|
||||
do {
|
||||
if (lp->lllook && (l = lp->lllook[st])) {
|
||||
for (c=0; c<NBPW; c++)
|
||||
if (l&(1<<c))
|
||||
ctx->llsave[c] = ctx->llp1;
|
||||
llk++;
|
||||
}
|
||||
if ((i = lp->llfinal[st]) != -1) {
|
||||
final = i;
|
||||
ctx->llend = ctx->llp1;
|
||||
}
|
||||
if ((c = llinp(ctx,exp)) < 0)
|
||||
break;
|
||||
if ((cp = lp->llbrk) && llk==0 && tst__b(c, cp)) {
|
||||
ctx->llp1--;
|
||||
break;
|
||||
}
|
||||
} while ((st = (*lp->llmove)(lp, c, st)) != -1);
|
||||
|
||||
|
||||
if (ctx->llp2 < ctx->llp1)
|
||||
ctx->llp2 = ctx->llp1;
|
||||
if (final == -1) {
|
||||
ctx->llend = ctx->llp1;
|
||||
if (st == 0 && c < 0)
|
||||
return(0);
|
||||
if ((cp = lp->llill) && tst__b(c, cp)) {
|
||||
continue;
|
||||
}
|
||||
return(YYERRORVAL);
|
||||
}
|
||||
if ((c = (final >> 11) & 037))
|
||||
ctx->llend = ctx->llsave[c-1];
|
||||
if ((c = (*lp->llactr)(ctx,final&03777)) >= 0)
|
||||
return(c);
|
||||
}
|
||||
}
|
||||
|
||||
void nseel_llinit(compileContext *ctx)
|
||||
{
|
||||
ctx->llp1 = ctx->llp2 = ctx->llend = ctx->llbuf;
|
||||
ctx->llebuf = ctx->llbuf + sizeof(ctx->llbuf);
|
||||
ctx->lleof = ctx->yyline = 0;
|
||||
}
|
||||
|
||||
|
||||
static int llinp(compileContext *ctx, char **exp)
|
||||
{
|
||||
register int c;
|
||||
register struct lextab *lp;
|
||||
register char *cp;
|
||||
|
||||
lp = &nseel_lextab;
|
||||
cp = lp->llign; /* Ignore class */
|
||||
for (;;) {
|
||||
/*
|
||||
* Get the next character from the save buffer (if possible)
|
||||
* If the save buffer's empty, then return EOF or the next
|
||||
* input character. Ignore the character if it's in the
|
||||
* ignore class.
|
||||
*/
|
||||
c = (ctx->llp1 < ctx->llp2) ? *ctx->llp1 & 0377 : (ctx->lleof) ? EOF : lexgetc(exp);
|
||||
if (c >= 0) { /* Got a character? */
|
||||
if (cp && tst__b(c, cp))
|
||||
continue; /* Ignore it */
|
||||
if (ctx->llp1 >= ctx->llebuf) { /* No, is there room? */
|
||||
return -1;
|
||||
}
|
||||
*ctx->llp1++ = c; /* Store in token buff */
|
||||
} else
|
||||
ctx->lleof = 1; /* Set EOF signal */
|
||||
return(c);
|
||||
}
|
||||
}
|
||||
|
||||
static int llset(compileContext *ctx)
|
||||
/*
|
||||
* Return TRUE if EOF and nothing was moved in the look-ahead buffer
|
||||
*/
|
||||
{
|
||||
register char *lp1, *lp2;
|
||||
|
||||
for (lp1 = ctx->llbuf, lp2 = ctx->llend; lp2 < ctx->llp2;)
|
||||
*lp1++ = *lp2++;
|
||||
ctx->llend = ctx->llp1 = ctx->llbuf;
|
||||
ctx->llp2 = lp1;
|
||||
return(ctx->lleof && lp1 == ctx->llbuf);
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,304 @@
|
||||
# Microsoft Developer Studio Project File - Name="plugin" - Package Owner=<4>
|
||||
# Microsoft Developer Studio Generated Build File, Format Version 6.00
|
||||
# ** DO NOT EDIT **
|
||||
|
||||
# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
|
||||
|
||||
CFG=plugin - Win32 Debug
|
||||
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
|
||||
!MESSAGE use the Export Makefile command and run
|
||||
!MESSAGE
|
||||
!MESSAGE NMAKE /f "plugin.mak".
|
||||
!MESSAGE
|
||||
!MESSAGE You can specify a configuration when running NMAKE
|
||||
!MESSAGE by defining the macro CFG on the command line. For example:
|
||||
!MESSAGE
|
||||
!MESSAGE NMAKE /f "plugin.mak" CFG="plugin - Win32 Debug"
|
||||
!MESSAGE
|
||||
!MESSAGE Possible choices for configuration are:
|
||||
!MESSAGE
|
||||
!MESSAGE "plugin - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
|
||||
!MESSAGE "plugin - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library")
|
||||
!MESSAGE
|
||||
|
||||
# Begin Project
|
||||
# PROP AllowPerConfigDependencies 0
|
||||
# PROP Scc_ProjName ""
|
||||
# PROP Scc_LocalPath ""
|
||||
CPP=cl.exe
|
||||
MTL=midl.exe
|
||||
RSC=rc.exe
|
||||
|
||||
!IF "$(CFG)" == "plugin - Win32 Release"
|
||||
|
||||
# PROP BASE Use_MFC 0
|
||||
# PROP BASE Use_Debug_Libraries 0
|
||||
# PROP BASE Output_Dir "Release"
|
||||
# PROP BASE Intermediate_Dir "Release"
|
||||
# PROP BASE Target_Dir ""
|
||||
# PROP Use_MFC 0
|
||||
# PROP Use_Debug_Libraries 0
|
||||
# PROP Output_Dir "Release"
|
||||
# PROP Intermediate_Dir "Release"
|
||||
# PROP Ignore_Export_Lib 0
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "plugin_EXPORTS" /YX /FD /c
|
||||
# ADD CPP /nologo /MD /W3 /GX /O2 /I "..\SDKs\DirectX_9_Oct_2004\Include" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /FR /YX /FD /c
|
||||
# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
|
||||
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
|
||||
# ADD BASE RSC /l 0x409 /d "NDEBUG"
|
||||
# ADD RSC /l 0x409 /d "NDEBUG"
|
||||
BSC32=bscmake.exe
|
||||
# ADD BASE BSC32 /nologo
|
||||
# ADD BSC32 /nologo
|
||||
LINK32=link.exe
|
||||
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
|
||||
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib d3dx9.lib d3d9.lib Delayimp.lib /nologo /dll /machine:I386 /out:"c:\program files\winamp\plugins\vis_milk2.dll" /libpath:"..\SDKs\DirectX_9_Oct_2004\lib"
|
||||
# SUBTRACT LINK32 /pdb:none
|
||||
|
||||
!ELSEIF "$(CFG)" == "plugin - Win32 Debug"
|
||||
|
||||
# PROP BASE Use_MFC 0
|
||||
# PROP BASE Use_Debug_Libraries 1
|
||||
# PROP BASE Output_Dir "Debug"
|
||||
# PROP BASE Intermediate_Dir "Debug"
|
||||
# PROP BASE Target_Dir ""
|
||||
# PROP Use_MFC 0
|
||||
# PROP Use_Debug_Libraries 1
|
||||
# PROP Output_Dir "Debug"
|
||||
# PROP Intermediate_Dir "Debug"
|
||||
# PROP Ignore_Export_Lib 0
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "PLUGIN_EXPORTS" /YX /FD /GZ /c
|
||||
# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "..\SDKs\DirectX_9_Oct_2004\Include" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /FR /YX /FD /GZ /c
|
||||
# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
|
||||
# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
|
||||
# ADD BASE RSC /l 0x409 /d "_DEBUG"
|
||||
# ADD RSC /l 0x409 /d "_DEBUG"
|
||||
BSC32=bscmake.exe
|
||||
# ADD BASE BSC32 /nologo
|
||||
# ADD BSC32 /nologo
|
||||
LINK32=link.exe
|
||||
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
|
||||
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib d3dx9.lib d3d9.lib delayimp.lib /nologo /dll /debug /machine:I386 /out:"c:\program files\winamp\plugins\vis_milk2.dll" /pdbtype:sept /libpath:"..\SDKs\DirectX_9_Oct_2004\lib"
|
||||
|
||||
!ENDIF
|
||||
|
||||
# Begin Target
|
||||
|
||||
# Name "plugin - Win32 Release"
|
||||
# Name "plugin - Win32 Debug"
|
||||
# Begin Group "My Plugin Source Files"
|
||||
|
||||
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\menu.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\milkdropfs.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\plugin.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\plugin_icon.ico
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\state.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\support.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\texmgr.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\textmgr.cpp
|
||||
# End Source File
|
||||
# End Group
|
||||
# Begin Group "My Plugin Header Files"
|
||||
|
||||
# PROP Default_Filter "h;hpp;hxx;hm;inl"
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\defines.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\md_defines.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\menu.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\plugin.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\state.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\support.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\texmgr.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\textmgr.h
|
||||
# End Source File
|
||||
# End Group
|
||||
# Begin Group "Framework Files (do not edit)"
|
||||
|
||||
# PROP Default_Filter ""
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\config.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\config2.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\desktop_mode.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\dxcontext.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\dxcontext.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\fft.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\fft.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\gstring.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\icon_t.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\plugin.rc
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\pluginshell.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\pluginshell.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\resource.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\shell_defines.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\utility.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\utility.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\vis.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\vis.h
|
||||
# End Source File
|
||||
# End Group
|
||||
# Begin Group "evallib"
|
||||
|
||||
# PROP Default_Filter "*.c;*.h"
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\evallib\CAL_TAB.C
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\evallib\cal_tab.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\evallib\cfunc.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\evallib\Compiler.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\evallib\Compiler.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\evallib\eval.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\evallib\eval.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\evallib\Gettok.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\evallib\LEX.H
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\evallib\Lextab.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\evallib\LLSAVE.C
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\evallib\Yylex.c
|
||||
# End Source File
|
||||
# End Group
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\DOCUMENTATION.TXT
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\milkdrop.nsi
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\temp.ico
|
||||
# End Source File
|
||||
# End Target
|
||||
# End Project
|
||||
@@ -0,0 +1,729 @@
|
||||
/*
|
||||
LICENSE
|
||||
-------
|
||||
Copyright 2005-2013 Nullsoft, Inc.
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification,
|
||||
are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright notice,
|
||||
this list of conditions and the following disclaimer.
|
||||
|
||||
* Redistributions in binary form must reproduce the above copyright notice,
|
||||
this list of conditions and the following disclaimer in the documentation
|
||||
and/or other materials provided with the distribution.
|
||||
|
||||
* Neither the name of Nullsoft nor the names of its contributors may be used to
|
||||
endorse or promote products derived from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
|
||||
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||
FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
||||
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
|
||||
IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
|
||||
OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifndef __NULLSOFT_DX9_EXAMPLE_PLUGIN_H__
|
||||
#define __NULLSOFT_DX9_EXAMPLE_PLUGIN_H__ 1
|
||||
|
||||
#include "pluginshell.h"
|
||||
#include "md_defines.h"
|
||||
#include "menu.h"
|
||||
#include "support.h"
|
||||
#include "texmgr.h"
|
||||
#include "state.h"
|
||||
#include <vector>
|
||||
|
||||
#include "gstring.h"
|
||||
#include "ns-eel2/ns-eel.h"
|
||||
|
||||
|
||||
|
||||
extern "C" int (*warand)(void);
|
||||
|
||||
typedef enum { TEX_DISK, TEX_VS, TEX_BLUR0, TEX_BLUR1, TEX_BLUR2, TEX_BLUR3, TEX_BLUR4, TEX_BLUR5, TEX_BLUR6, TEX_BLUR_LAST } tex_code;
|
||||
typedef enum { UI_REGULAR, UI_MENU, UI_LOAD, UI_LOAD_DEL, UI_LOAD_RENAME, UI_SAVEAS, UI_SAVE_OVERWRITE, UI_EDIT_MENU_STRING, UI_CHANGEDIR, UI_IMPORT_WAVE, UI_EXPORT_WAVE, UI_IMPORT_SHAPE, UI_EXPORT_SHAPE, UI_UPGRADE_PIXEL_SHADER, UI_MASHUP } ui_mode;
|
||||
typedef struct { float rad; float ang; float a; float c; } td_vertinfo; // blending: mix = max(0,min(1,a*t + c));
|
||||
typedef char* CHARPTR;
|
||||
LRESULT CALLBACK WndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam);
|
||||
|
||||
#define MY_FFT_SAMPLES 512 // for old [pre-vms] milkdrop sound analysis
|
||||
typedef struct
|
||||
{
|
||||
float imm[3]; // bass, mids, treble (absolute)
|
||||
float imm_rel[3]; // bass, mids, treble (relative to song; 1=avg, 0.9~below, 1.1~above)
|
||||
float avg[3]; // bass, mids, treble (absolute)
|
||||
float avg_rel[3]; // bass, mids, treble (relative to song; 1=avg, 0.9~below, 1.1~above)
|
||||
float long_avg[3]; // bass, mids, treble (absolute)
|
||||
float fWave[2][576];
|
||||
float fSpecLeft[MY_FFT_SAMPLES];
|
||||
} td_mysounddata;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int bActive;
|
||||
int bFilterBadChars; // if true, it will filter out any characters that don't belong in a filename, plus the & symbol (because it doesn't display properly with DrawText)
|
||||
int bDisplayAsCode; // if true, semicolons will be followed by a newline, for display
|
||||
int nMaxLen; // can't be more than 511
|
||||
int nCursorPos;
|
||||
int nSelAnchorPos; // -1 if no selection made
|
||||
int bOvertypeMode;
|
||||
wchar_t szText[48000];
|
||||
wchar_t szPrompt[512];
|
||||
wchar_t szToolTip[512];
|
||||
char szClipboard[48000];
|
||||
wchar_t szClipboardW[48000];
|
||||
} td_waitstr;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int bBold;
|
||||
int bItal;
|
||||
wchar_t szFace[128];
|
||||
int nColorR; // 0..255
|
||||
int nColorG; // 0..255
|
||||
int nColorB; // 0..255
|
||||
}
|
||||
td_custom_msg_font;
|
||||
|
||||
enum
|
||||
{
|
||||
MD2_PS_NONE = 0,
|
||||
MD2_PS_2_0 = 2,
|
||||
MD2_PS_2_X = 3,
|
||||
MD2_PS_3_0 = 4,
|
||||
MD2_PS_4_0 = 5, // not supported by milkdrop
|
||||
};
|
||||
/*
|
||||
typedef struct
|
||||
{
|
||||
char szFace[256];
|
||||
int nSize;
|
||||
int bBold;
|
||||
int bItalic;
|
||||
} td_titlefontinfo;*/
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int nFont;
|
||||
float fSize; // 0..100
|
||||
float x;
|
||||
float y;
|
||||
float randx;
|
||||
float randy;
|
||||
float growth;
|
||||
float fTime; // total time to display the message, in seconds
|
||||
float fFade; // % (0..1) of the time that is spent fading in
|
||||
|
||||
// overrides
|
||||
int bOverrideBold;
|
||||
int bOverrideItal;
|
||||
int bOverrideFace;
|
||||
int bOverrideColorR;
|
||||
int bOverrideColorG;
|
||||
int bOverrideColorB;
|
||||
int nColorR; // 0..255
|
||||
int nColorG; // 0..255
|
||||
int nColorB; // 0..255
|
||||
int nRandR;
|
||||
int nRandG;
|
||||
int nRandB;
|
||||
int bBold;
|
||||
int bItal;
|
||||
wchar_t szFace[128];
|
||||
|
||||
wchar_t szText[256];
|
||||
}
|
||||
td_custom_msg;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int bRedrawSuperText; // true if it needs redraw
|
||||
int bIsSongTitle; // false for custom message, true for song title
|
||||
//char szText[256];
|
||||
wchar_t szTextW[256];
|
||||
wchar_t nFontFace[128];
|
||||
int bBold;
|
||||
int bItal;
|
||||
float fX;
|
||||
float fY;
|
||||
float fFontSize; // [0..100] for custom messages, [0..4] for song titles
|
||||
float fGrowth; // applies to custom messages only
|
||||
int nFontSizeUsed; // height IN PIXELS
|
||||
float fStartTime;
|
||||
float fDuration;
|
||||
float fFadeTime; // applies to custom messages only; song title fade times are handled specially
|
||||
int nColorR;
|
||||
int nColorG;
|
||||
int nColorB;
|
||||
}
|
||||
td_supertext;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
wchar_t texname[256]; // ~filename, but without path or extension!
|
||||
LPDIRECT3DBASETEXTURE9 texptr;
|
||||
int w,h,d;
|
||||
//D3DXHANDLE texsize_param;
|
||||
bool bEvictable;
|
||||
int nAge; // only valid if bEvictable is true
|
||||
int nSizeInBytes; // only valid if bEvictable is true
|
||||
} TexInfo;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
GString texname; // just for ref
|
||||
D3DXHANDLE texsize_param;
|
||||
int w,h;
|
||||
} TexSizeParamInfo;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
LPDIRECT3DBASETEXTURE9 texptr;
|
||||
bool bBilinear;
|
||||
bool bWrap;
|
||||
} SamplerInfo;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
GString msg;
|
||||
bool bBold; // true == red bkg; false == black bkg
|
||||
float birthTime;
|
||||
float expireTime;
|
||||
int category;
|
||||
} ErrorMsg;
|
||||
typedef std::vector<ErrorMsg> ErrorMsgList;
|
||||
|
||||
typedef std::vector<CShaderParams*> CShaderParamsList;
|
||||
|
||||
class CShaderParams
|
||||
{
|
||||
public:
|
||||
// float4 handles:
|
||||
D3DXHANDLE rand_frame ;
|
||||
D3DXHANDLE rand_preset;
|
||||
D3DXHANDLE const_handles[24];
|
||||
D3DXHANDLE q_const_handles[(NUM_Q_VAR+3)/4];
|
||||
D3DXHANDLE rot_mat[24];
|
||||
|
||||
typedef std::vector<TexSizeParamInfo> TexSizeParamInfoList;
|
||||
TexSizeParamInfoList texsize_params;
|
||||
|
||||
// sampler stages for various PS texture bindings:
|
||||
//int texbind_vs;
|
||||
//int texbind_disk[32];
|
||||
//int texbind_voronoi;
|
||||
//...
|
||||
SamplerInfo m_texture_bindings[16]; // an entry for each sampler slot. These are ALIASES - DO NOT DELETE.
|
||||
tex_code m_texcode[16]; // if ==TEX_VS, forget the pointer - texture bound @ that stage is the double-buffered VS.
|
||||
|
||||
void Clear();
|
||||
void CacheParams(LPD3DXCONSTANTTABLE pCT, bool bHardErrors);
|
||||
void OnTextureEvict(LPDIRECT3DBASETEXTURE9 texptr);
|
||||
CShaderParams();
|
||||
~CShaderParams();
|
||||
};
|
||||
|
||||
class VShaderInfo
|
||||
{
|
||||
public:
|
||||
IDirect3DVertexShader9* ptr;
|
||||
LPD3DXCONSTANTTABLE CT;
|
||||
CShaderParams params;
|
||||
VShaderInfo() { ptr=NULL; CT=NULL; params.Clear(); }
|
||||
~VShaderInfo() { Clear(); }
|
||||
void Clear();
|
||||
};
|
||||
|
||||
class PShaderInfo
|
||||
{
|
||||
public:
|
||||
IDirect3DPixelShader9* ptr;
|
||||
LPD3DXCONSTANTTABLE CT;
|
||||
CShaderParams params;
|
||||
PShaderInfo() { ptr=NULL; CT=NULL; params.Clear(); }
|
||||
~PShaderInfo() { Clear(); }
|
||||
void Clear();
|
||||
};
|
||||
|
||||
typedef struct
|
||||
{
|
||||
VShaderInfo vs;
|
||||
PShaderInfo ps;
|
||||
} ShaderPairInfo;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
PShaderInfo warp;
|
||||
PShaderInfo comp;
|
||||
} PShaderSet;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
VShaderInfo warp;
|
||||
VShaderInfo comp;
|
||||
} VShaderSet;
|
||||
|
||||
/*
|
||||
typedef struct
|
||||
{
|
||||
void* ptr; // to IDirect3DPixelShader9 or IDirect3DVertexShader9
|
||||
LPD3DXCONSTANTTABLE CT;
|
||||
CShaderParams params;
|
||||
} ShaderInfo;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
ShaderInfo warp;
|
||||
ShaderInfo comp;
|
||||
} ShaderSet;
|
||||
*/
|
||||
|
||||
typedef struct
|
||||
{
|
||||
GString szFilename; // without path
|
||||
float fRatingThis;
|
||||
float fRatingCum;
|
||||
} PresetInfo;
|
||||
typedef std::vector<PresetInfo> PresetList;
|
||||
|
||||
|
||||
class CPlugin : public CPluginShell
|
||||
{
|
||||
public:
|
||||
|
||||
//====[ 1. members added to create this specific example plugin: ]================================================
|
||||
|
||||
/// CONFIG PANEL SETTINGS THAT WE'VE ADDED (TAB #2)
|
||||
bool m_bFirstRun;
|
||||
float m_fBlendTimeAuto; // blend time when preset auto-switches
|
||||
float m_fBlendTimeUser; // blend time when user loads a new preset
|
||||
float m_fTimeBetweenPresets; // <- this is in addition to m_fBlendTimeAuto
|
||||
float m_fTimeBetweenPresetsRand; // <- this is in addition to m_fTimeBetweenPresets
|
||||
bool m_bSequentialPresetOrder;
|
||||
bool m_bHardCutsDisabled;
|
||||
float m_fHardCutLoudnessThresh;
|
||||
float m_fHardCutHalflife;
|
||||
float m_fHardCutThresh;
|
||||
//int m_nWidth;
|
||||
//int m_nHeight;
|
||||
//int m_nDispBits;
|
||||
int m_nCanvasStretch; // 0=Auto, 100=None, 125 = 1.25X, 133, 150, 167, 200, 300, 400 (4X).
|
||||
int m_nTexSizeX; // -1 = exact match to screen; -2 = nearest power of 2.
|
||||
int m_nTexSizeY;
|
||||
float m_fAspectX;
|
||||
float m_fAspectY;
|
||||
float m_fInvAspectX;
|
||||
float m_fInvAspectY;
|
||||
int m_nTexBitsPerCh;
|
||||
int m_nGridX;
|
||||
int m_nGridY;
|
||||
|
||||
bool m_bShowPressF1ForHelp;
|
||||
//char m_szMonitorName[256];
|
||||
bool m_bShowMenuToolTips;
|
||||
int m_n16BitGamma;
|
||||
bool m_bAutoGamma;
|
||||
//int m_nFpsLimit;
|
||||
//int m_cLeftEye3DColor[3];
|
||||
//int m_cRightEye3DColor[3];
|
||||
bool m_bEnableRating;
|
||||
//bool m_bInstaScan;
|
||||
bool m_bSongTitleAnims;
|
||||
float m_fSongTitleAnimDuration;
|
||||
float m_fTimeBetweenRandomSongTitles;
|
||||
float m_fTimeBetweenRandomCustomMsgs;
|
||||
int m_nSongTitlesSpawned;
|
||||
int m_nCustMsgsSpawned;
|
||||
|
||||
//bool m_bAlways3D;
|
||||
//float m_fStereoSep;
|
||||
//bool m_bAlwaysOnTop;
|
||||
//bool m_bFixSlowText;
|
||||
//bool m_bWarningsDisabled; // messageboxes
|
||||
bool m_bWarningsDisabled2; // warnings/errors in upper-right corner (m_szUserMessage)
|
||||
//bool m_bAnisotropicFiltering;
|
||||
bool m_bPresetLockOnAtStartup;
|
||||
bool m_bPreventScollLockHandling;
|
||||
int m_nMaxPSVersion_ConfigPanel; // -1 = auto, 0 = disable shaders, 2 = ps_2_0, 3 = ps_3_0
|
||||
int m_nMaxPSVersion_DX9; // 0 = no shader support, 2 = ps_2_0, 3 = ps_3_0
|
||||
int m_nMaxPSVersion; // this one will be the ~min of the other two. 0/2/3.
|
||||
int m_nMaxImages;
|
||||
int m_nMaxBytes;
|
||||
|
||||
/*
|
||||
char m_szFontFace[NUM_FONTS][128];
|
||||
int m_nFontSize[NUM_FONTS];
|
||||
bool m_bFontBold[NUM_FONTS];
|
||||
bool m_bFontItalic[NUM_FONTS];
|
||||
char m_szTitleFontFace[128];
|
||||
int m_nTitleFontSize; // percentage of screen width (0..100)
|
||||
bool m_bTitleFontBold;
|
||||
bool m_bTitleFontItalic;
|
||||
*/
|
||||
HFONT m_gdi_title_font_doublesize;
|
||||
LPD3DXFONT m_d3dx_title_font_doublesize;
|
||||
|
||||
// PIXEL SHADERS
|
||||
DWORD m_dwShaderFlags; // Shader compilation/linking flags
|
||||
//ID3DXFragmentLinker* m_pFragmentLinker; // Fragment linker interface
|
||||
//LPD3DXBUFFER m_pCompiledFragments; // Buffer containing compiled fragments
|
||||
LPD3DXBUFFER m_pShaderCompileErrors;
|
||||
VShaderSet m_fallbackShaders_vs; // *these are the only vertex shaders used for the whole app.*
|
||||
PShaderSet m_fallbackShaders_ps; // these are just used when the preset's pixel shaders fail to compile.
|
||||
PShaderSet m_shaders; // includes shader pointers and constant tables for warp & comp shaders, for cur. preset
|
||||
PShaderSet m_OldShaders; // includes shader pointers and constant tables for warp & comp shaders, for prev. preset
|
||||
PShaderSet m_NewShaders; // includes shader pointers and constant tables for warp & comp shaders, for coming preset
|
||||
ShaderPairInfo m_BlurShaders[2];
|
||||
bool m_bWarpShaderLock;
|
||||
bool m_bCompShaderLock;
|
||||
//bool LoadShaderFromFile( char* szFile, char* szFn, char* szProfile,
|
||||
// LPD3DXCONSTANTTABLE* ppConstTable, void** ppShader );
|
||||
#define SHADER_WARP 0
|
||||
#define SHADER_COMP 1
|
||||
#define SHADER_BLUR 2
|
||||
#define SHADER_OTHER 3
|
||||
bool LoadShaderFromMemory( const char* szShaderText, char* szFn, char* szProfile,
|
||||
LPD3DXCONSTANTTABLE* ppConstTable, void** ppShader, int shaderType, bool bHardErrors );
|
||||
bool RecompileVShader(const char* szShadersText, VShaderInfo *si, int shaderType, bool bHardErrors);
|
||||
bool RecompilePShader(const char* szShadersText, PShaderInfo *si, int shaderType, bool bHardErrors, int PSVersion);
|
||||
bool EvictSomeTexture();
|
||||
typedef std::vector<TexInfo> TexInfoList;
|
||||
TexInfoList m_textures;
|
||||
bool m_bNeedRescanTexturesDir;
|
||||
// vertex declarations:
|
||||
IDirect3DVertexDeclaration9* m_pSpriteVertDecl;
|
||||
IDirect3DVertexDeclaration9* m_pWfVertDecl;
|
||||
IDirect3DVertexDeclaration9* m_pMyVertDecl;
|
||||
|
||||
D3DXVECTOR4 m_rand_frame; // 4 random floats (0..1); randomized once per frame; fed to pixel shaders.
|
||||
|
||||
// RUNTIME SETTINGS THAT WE'VE ADDED
|
||||
float m_prev_time;
|
||||
bool m_bTexSizeWasAutoPow2;
|
||||
bool m_bTexSizeWasAutoExact;
|
||||
bool m_bPresetLockedByUser;
|
||||
bool m_bPresetLockedByCode;
|
||||
float m_fAnimTime;
|
||||
float m_fStartTime;
|
||||
float m_fPresetStartTime;
|
||||
float m_fNextPresetTime;
|
||||
float m_fSnapPoint;
|
||||
CState *m_pState; // points to current CState
|
||||
CState *m_pOldState; // points to previous CState
|
||||
CState *m_pNewState; // points to the coming CState - we're not yet blending to it b/c we're still compiling the shaders for it!
|
||||
int m_nLoadingPreset;
|
||||
wchar_t m_szLoadingPreset[MAX_PATH];
|
||||
float m_fLoadingPresetBlendTime;
|
||||
int m_nPresetsLoadedTotal; //important for texture eviction age-tracking...
|
||||
CState m_state_DO_NOT_USE[3]; // do not use; use pState and pOldState instead.
|
||||
ui_mode m_UI_mode; // can be UI_REGULAR, UI_LOAD, UI_SAVEHOW, or UI_SAVEAS
|
||||
|
||||
#define MASH_SLOTS 5
|
||||
#define MASH_APPLY_DELAY_FRAMES 1
|
||||
int m_nMashSlot; //0..MASH_SLOTS-1
|
||||
//char m_szMashDir[MASH_SLOTS][MAX_PATH];
|
||||
int m_nMashPreset[MASH_SLOTS];
|
||||
int m_nLastMashChangeFrame[MASH_SLOTS];
|
||||
|
||||
//td_playlist_entry *m_szPlaylist; // array of 128-char strings
|
||||
//int m_nPlaylistCurPos;
|
||||
//int m_nPlaylistLength;
|
||||
//int m_nTrackPlaying;
|
||||
//int m_nSongPosMS;
|
||||
//int m_nSongLenMS;
|
||||
bool m_bUserPagedUp;
|
||||
bool m_bUserPagedDown;
|
||||
float m_fMotionVectorsTempDx;
|
||||
float m_fMotionVectorsTempDy;
|
||||
|
||||
td_waitstr m_waitstring;
|
||||
void WaitString_NukeSelection();
|
||||
void WaitString_Cut();
|
||||
void WaitString_Copy();
|
||||
void WaitString_Paste();
|
||||
void WaitString_SeekLeftWord();
|
||||
void WaitString_SeekRightWord();
|
||||
int WaitString_GetCursorColumn();
|
||||
int WaitString_GetLineLength();
|
||||
void WaitString_SeekUpOneLine();
|
||||
void WaitString_SeekDownOneLine();
|
||||
|
||||
int m_nPresets; // the # of entries in the file listing. Includes directories and then files, sorted alphabetically.
|
||||
int m_nDirs; // the # of presets that are actually directories. Always between 0 and m_nPresets.
|
||||
int m_nPresetListCurPos;// Index of the currently-HIGHLIGHTED preset (the user must press Enter on it to select it).
|
||||
int m_nCurrentPreset; // Index of the currently-RUNNING preset.
|
||||
// Note that this is NOT the same as the currently-highlighted preset! (that's m_nPresetListCurPos)
|
||||
// Be careful - this can be -1 if the user changed dir. & a new preset hasn't been loaded yet.
|
||||
wchar_t m_szCurrentPresetFile[512]; // w/o path. this is always valid (unless no presets were found)
|
||||
PresetList m_presets;
|
||||
void UpdatePresetList(bool bBackground=false, bool bForce=false, bool bTryReselectCurrentPreset=true);
|
||||
wchar_t m_szUpdatePresetMask[MAX_PATH];
|
||||
bool m_bPresetListReady;
|
||||
//void UpdatePresetRatings();
|
||||
//int m_nRatingReadProgress; // equals 'm_nPresets' if all ratings are read in & ready to go; -1 if uninitialized; otherwise, it's still reading them in, and range is: [0 .. m_nPresets-1]
|
||||
bool m_bInitialPresetSelected;
|
||||
|
||||
// PRESET HISTORY
|
||||
#define PRESET_HIST_LEN (64+2) // make this 2 more than the # you REALLY want to be able to go back.
|
||||
GString m_presetHistory[PRESET_HIST_LEN]; //circular
|
||||
int m_presetHistoryPos;
|
||||
int m_presetHistoryBackFence;
|
||||
int m_presetHistoryFwdFence;
|
||||
void PrevPreset(float fBlendTime);
|
||||
void NextPreset(float fBlendTime); // if not retracing our former steps, it will choose a random one.
|
||||
void OnFinishedLoadingPreset();
|
||||
|
||||
FFT myfft;
|
||||
td_mysounddata mysound;
|
||||
|
||||
// stuff for displaying text to user:
|
||||
//int m_nTextHeightPixels; // this is for the menu/detail font; NOT the "fancy font"
|
||||
//int m_nTextHeightPixels_Fancy;
|
||||
bool m_bShowFPS;
|
||||
bool m_bShowRating;
|
||||
bool m_bShowPresetInfo;
|
||||
bool m_bShowDebugInfo;
|
||||
bool m_bShowSongTitle;
|
||||
bool m_bShowSongTime;
|
||||
bool m_bShowSongLen;
|
||||
float m_fShowRatingUntilThisTime;
|
||||
//float m_fShowUserMessageUntilThisTime;
|
||||
//char m_szUserMessage[512];
|
||||
//bool m_bUserMessageIsError;
|
||||
|
||||
#define ERR_ALL 0
|
||||
#define ERR_INIT 1 //specifically, loading a preset
|
||||
#define ERR_PRESET 2 //specifically, loading a preset
|
||||
#define ERR_MISC 3
|
||||
#define ERR_NOTIFY 4 // a simple notification - not an error at all. ("shuffle is now ON." etc.)
|
||||
// NOTE: each NOTIFY msg clears all the old NOTIFY messages!
|
||||
#define ERR_SCANNING_PRESETS 5
|
||||
ErrorMsgList m_errors;
|
||||
void AddError(wchar_t* szMsg, float fDuration, int category=ERR_ALL, bool bBold=true);
|
||||
void ClearErrors(int category=ERR_ALL); // 0=all categories
|
||||
|
||||
char m_szDebugMessage[512];
|
||||
wchar_t m_szSongTitle [512];
|
||||
wchar_t m_szSongTitlePrev[512];
|
||||
//HFONT m_hfont[3]; // 0=fancy font (for song titles, preset name)
|
||||
// 1=legible font (the main font)
|
||||
// 2=tooltip font (for tooltips in the menu system)
|
||||
//HFONT m_htitlefont[NUM_TITLE_FONTS]; // ~25 different sizes
|
||||
// stuff for menu system:
|
||||
CMilkMenu *m_pCurMenu; // should always be valid!
|
||||
CMilkMenu m_menuPreset;
|
||||
CMilkMenu m_menuWave;
|
||||
CMilkMenu m_menuAugment;
|
||||
CMilkMenu m_menuCustomWave;
|
||||
CMilkMenu m_menuCustomShape;
|
||||
CMilkMenu m_menuMotion;
|
||||
CMilkMenu m_menuPost;
|
||||
CMilkMenu m_menuWavecode[MAX_CUSTOM_WAVES];
|
||||
CMilkMenu m_menuShapecode[MAX_CUSTOM_SHAPES];
|
||||
bool m_bShowShaderHelp;
|
||||
|
||||
|
||||
|
||||
wchar_t m_szMilkdrop2Path[MAX_PATH]; // ends in a backslash
|
||||
wchar_t m_szMsgIniFile[MAX_PATH];
|
||||
wchar_t m_szImgIniFile[MAX_PATH];
|
||||
wchar_t m_szPresetDir[MAX_PATH];
|
||||
float m_fRandStart[4];
|
||||
|
||||
// DIRECTX 9:
|
||||
IDirect3DTexture9 *m_lpVS[2];
|
||||
#define NUM_BLUR_TEX 6
|
||||
#if (NUM_BLUR_TEX>0)
|
||||
IDirect3DTexture9 *m_lpBlur[NUM_BLUR_TEX]; // each is successively 1/2 size of prev.
|
||||
int m_nBlurTexW[NUM_BLUR_TEX];
|
||||
int m_nBlurTexH[NUM_BLUR_TEX];
|
||||
#endif
|
||||
int m_nHighestBlurTexUsedThisFrame;
|
||||
IDirect3DTexture9 *m_lpDDSTitle; // CAREFUL: MIGHT BE NULL (if not enough mem)!
|
||||
int m_nTitleTexSizeX, m_nTitleTexSizeY;
|
||||
MYVERTEX *m_verts;
|
||||
MYVERTEX *m_verts_temp;
|
||||
td_vertinfo *m_vertinfo;
|
||||
int *m_indices_strip;
|
||||
int *m_indices_list;
|
||||
|
||||
// for final composite grid:
|
||||
#define FCGSX 32 // final composite gridsize - # verts - should be EVEN.
|
||||
#define FCGSY 24 // final composite gridsize - # verts - should be EVEN.
|
||||
// # of grid *cells* is two less,
|
||||
// since we have redundant verts along the center line in X and Y (...for clean 'ang' interp)
|
||||
MYVERTEX m_comp_verts[FCGSX*FCGSY];
|
||||
int m_comp_indices[(FCGSX-2)*(FCGSY-2)*2*3];
|
||||
|
||||
bool m_bMMX;
|
||||
//bool m_bSSE;
|
||||
bool m_bHasFocus;
|
||||
bool m_bHadFocus;
|
||||
bool m_bOrigScrollLockState;
|
||||
//bool m_bMilkdropScrollLockState; // saved when focus is lost; restored when focus is regained
|
||||
|
||||
int m_nNumericInputMode; // NUMERIC_INPUT_MODE_CUST_MSG, NUMERIC_INPUT_MODE_SPRITE
|
||||
int m_nNumericInputNum;
|
||||
int m_nNumericInputDigits;
|
||||
td_custom_msg_font m_CustomMessageFont[MAX_CUSTOM_MESSAGE_FONTS];
|
||||
td_custom_msg m_CustomMessage[MAX_CUSTOM_MESSAGES];
|
||||
|
||||
texmgr m_texmgr; // for user sprites
|
||||
|
||||
td_supertext m_supertext; // **contains info about current Song Title or Custom Message.**
|
||||
|
||||
IDirect3DTexture9 *m_tracer_tex;
|
||||
|
||||
int m_nFramesSinceResize;
|
||||
|
||||
char m_szShaderIncludeText[32768]; // note: this still has char 13's and 10's in it - it's never edited on screen or loaded/saved with a preset.
|
||||
int m_nShaderIncludeTextLen; // # of chars, not including the final NULL.
|
||||
char m_szDefaultWarpVShaderText[32768]; // THIS HAS CHAR 13/10 CONVERTED TO LINEFEED_CONTROL_CHAR
|
||||
char m_szDefaultWarpPShaderText[32768]; // THIS HAS CHAR 13/10 CONVERTED TO LINEFEED_CONTROL_CHAR
|
||||
char m_szDefaultCompVShaderText[32768]; // THIS HAS CHAR 13/10 CONVERTED TO LINEFEED_CONTROL_CHAR
|
||||
char m_szDefaultCompPShaderText[32768]; // THIS HAS CHAR 13/10 CONVERTED TO LINEFEED_CONTROL_CHAR
|
||||
char m_szBlurVS[32768];
|
||||
char m_szBlurPSX[32768];
|
||||
char m_szBlurPSY[32768];
|
||||
//const char* GetDefaultWarpShadersText() { return m_szDefaultWarpShaderText; }
|
||||
//const char* GetDefaultCompShadersText() { return m_szDefaultCompShaderText; }
|
||||
void GenWarpPShaderText(char *szShaderText, float decay, bool bWrap);
|
||||
void GenCompPShaderText(char *szShaderText, float brightness, float ve_alpha, float ve_zoom, int ve_orient, float hue_shader, bool bBrighten, bool bDarken, bool bSolarize, bool bInvert);
|
||||
|
||||
//====[ 2. methods added: ]=====================================================================================
|
||||
|
||||
void RefreshTab2(HWND hwnd);
|
||||
void RenderFrame(int bRedraw);
|
||||
void AlignWave(int nSamples);
|
||||
|
||||
void DrawTooltip(wchar_t* str, int xR, int yB);
|
||||
void RandomizeBlendPattern();
|
||||
void GenPlasma(int x0, int x1, int y0, int y1, float dt);
|
||||
void LoadPerFrameEvallibVars(CState* pState);
|
||||
void LoadCustomWavePerFrameEvallibVars(CState* pState, int i);
|
||||
void LoadCustomShapePerFrameEvallibVars(CState* pState, int i, int instance);
|
||||
void WriteRealtimeConfig(); // called on Finish()
|
||||
void dumpmsg(wchar_t *s);
|
||||
void Randomize();
|
||||
void LoadRandomPreset(float fBlendTime);
|
||||
void LoadPreset(const wchar_t *szPresetFilename, float fBlendTime);
|
||||
void LoadPresetTick();
|
||||
void FindValidPresetDir();
|
||||
//char* GetConfigIniFile() { return m_szConfigIniFile; };
|
||||
wchar_t* GetMsgIniFile() { return m_szMsgIniFile; };
|
||||
wchar_t* GetPresetDir() { return m_szPresetDir; };
|
||||
void SavePresetAs(wchar_t *szNewFile); // overwrites the file if it was already there.
|
||||
void DeletePresetFile(wchar_t *szDelFile);
|
||||
void RenamePresetFile(wchar_t *szOldFile, wchar_t *szNewFile);
|
||||
void SetCurrentPresetRating(float fNewRating);
|
||||
void SeekToPreset(wchar_t cStartChar);
|
||||
bool ReversePropagatePoint(float fx, float fy, float *fx2, float *fy2);
|
||||
int HandleRegularKey(WPARAM wParam);
|
||||
bool OnResizeGraphicsWindow();
|
||||
bool OnResizeTextWindow();
|
||||
//bool InitFont();
|
||||
//void ToggleControlWindow(); // for Desktop Mode only
|
||||
//void DrawUI();
|
||||
void ClearGraphicsWindow(); // for windowed mode only
|
||||
//bool Update_Overlay();
|
||||
//void UpdatePlaylist();
|
||||
void LaunchCustomMessage(int nMsgNum);
|
||||
void ReadCustomMessages();
|
||||
void LaunchSongTitleAnim();
|
||||
|
||||
bool RenderStringToTitleTexture();
|
||||
void ShowSongTitleAnim(/*IDirect3DTexture9* lpRenderTarget,*/ int w, int h, float fProgress);
|
||||
void DrawWave(float *fL, float *fR);
|
||||
void DrawCustomWaves();
|
||||
void DrawCustomShapes();
|
||||
void DrawSprites();
|
||||
void ComputeGridAlphaValues();
|
||||
//void WarpedBlit();
|
||||
// note: 'bFlipAlpha' just flips the alpha blending in fixed-fn pipeline - not the values for culling tiles.
|
||||
void WarpedBlit_Shaders (int nPass, bool bAlphaBlend, bool bFlipAlpha, bool bCullTiles, bool bFlipCulling);
|
||||
void WarpedBlit_NoShaders(int nPass, bool bAlphaBlend, bool bFlipAlpha, bool bCullTiles, bool bFlipCulling);
|
||||
void ShowToUser_Shaders (int nPass, bool bAlphaBlend, bool bFlipAlpha, bool bCullTiles, bool bFlipCulling);
|
||||
void ShowToUser_NoShaders();
|
||||
void BlurPasses();
|
||||
void GetSafeBlurMinMax(CState* pState, float* blur_min, float* blur_max);
|
||||
void RunPerFrameEquations(int code);
|
||||
void DrawUserSprites();
|
||||
void MergeSortPresets(int left, int right);
|
||||
void BuildMenus();
|
||||
void SetMenusForPresetVersion(int WarpPSVersion, int CompPSVersion);
|
||||
//void ResetWindowSizeOnDisk();
|
||||
bool LaunchSprite(int nSpriteNum, int nSlot);
|
||||
void KillSprite(int iSlot);
|
||||
void DoCustomSoundAnalysis();
|
||||
void DrawMotionVectors();
|
||||
|
||||
bool LoadShaders(PShaderSet* sh, CState* pState, bool bTick);
|
||||
void UvToMathSpace(float u, float v, float* rad, float* ang);
|
||||
void ApplyShaderParams(CShaderParams* p, LPD3DXCONSTANTTABLE pCT, CState* pState);
|
||||
void RestoreShaderParams();
|
||||
bool AddNoiseTex(const wchar_t* szTexName, int size, int zoom_factor);
|
||||
bool AddNoiseVol(const wchar_t* szTexName, int size, int zoom_factor);
|
||||
|
||||
|
||||
//====[ 3. virtual functions: ]===========================================================================
|
||||
|
||||
virtual void OverrideDefaults();
|
||||
virtual void MyPreInitialize();
|
||||
virtual void MyReadConfig();
|
||||
virtual void MyWriteConfig();
|
||||
virtual int AllocateMyNonDx9Stuff();
|
||||
virtual void CleanUpMyNonDx9Stuff();
|
||||
virtual int AllocateMyDX9Stuff();
|
||||
virtual void CleanUpMyDX9Stuff(int final_cleanup);
|
||||
virtual void MyRenderFn(int redraw);
|
||||
virtual void MyRenderUI(int *upper_left_corner_y, int *upper_right_corner_y, int *lower_left_corner_y, int *lower_right_corner_y, int xL, int xR);
|
||||
virtual LRESULT MyWindowProc(HWND hWnd, unsigned uMsg, WPARAM wParam, LPARAM lParam);
|
||||
virtual BOOL MyConfigTabProc(int nPage, HWND hwnd,UINT msg,WPARAM wParam,LPARAM lParam);
|
||||
virtual void OnAltK();
|
||||
|
||||
//====[ 4. methods from base class: ]===========================================================================
|
||||
/*
|
||||
// 'GET' METHODS
|
||||
// ------------------------------------------------------------
|
||||
int GetFrame(); // returns current frame # (starts at zero)
|
||||
float GetTime(); // returns current animation time (in seconds) (starts at zero) (updated once per frame)
|
||||
float GetFps(); // returns current estimate of framerate (frames per second)
|
||||
eScrMode GetScreenMode(); // returns WINDOWED, FULLSCREEN, FAKE_FULLSCREEN, or NOT_YET_KNOWN (if called before or during OverrideDefaults()).
|
||||
HWND GetWinampWindow(); // returns handle to Winamp main window
|
||||
HINSTANCE GetInstance(); // returns handle to the plugin DLL module; used for things like loading resources (dialogs, bitmaps, icons...) that are built into the plugin.
|
||||
char* GetPluginsDirPath(); // usually returns 'c:\\program files\\winamp\\plugins\\'
|
||||
char* GetConfigIniFile(); // usually returns 'c:\\program files\\winamp\\plugins\\something.ini' - filename is determined from identifiers in 'defines.h'
|
||||
|
||||
// GET METHODS THAT ONLY WORK ONCE DIRECTX IS READY
|
||||
// ------------------------------------------------------------
|
||||
// The following 'Get' methods are only available after DirectX has been initialized.
|
||||
// If you call these from OverrideDefaults, MyPreInitialize, or MyReadConfig,
|
||||
// they will fail and return NULL (zero).
|
||||
// ------------------------------------------------------------
|
||||
HWND GetPluginWindow(); // returns handle to the plugin window. NOT persistent; can change.
|
||||
int GetWidth(); // returns width of plugin window interior, in pixels.
|
||||
int GetHeight(); // returns height of plugin window interior, in pixels.
|
||||
D3DFORMAT GetBackBufFormat(); // returns the pixelformat of the back buffer (probably D3DFMT_R8G8B8, D3DFMT_A8R8G8B8, D3DFMT_X8R8G8B8, D3DFMT_R5G6B5, D3DFMT_X1R5G5B5, D3DFMT_A1R5G5B5, D3DFMT_A4R4G4B4, D3DFMT_R3G3B2, D3DFMT_A8R3G3B2, D3DFMT_X4R4G4B4, or D3DFMT_UNKNOWN)
|
||||
D3DFORMAT GetBackBufZFormat(); // returns the pixelformat of the back buffer's Z buffer (probably D3DFMT_D16_LOCKABLE, D3DFMT_D32, D3DFMT_D15S1, D3DFMT_D24S8, D3DFMT_D16, D3DFMT_D24X8, D3DFMT_D24X4S4, or D3DFMT_UNKNOWN)
|
||||
D3DCAPS8* GetCaps(); // returns a pointer to the D3DCAPS8 structer for the device. NOT persistent; can change.
|
||||
LPDIRECT3DDEVICE8 GetDevice(); // returns a pointer to the DirectX 8 Device. NOT persistent; can change.
|
||||
|
||||
// FONTS & TEXT
|
||||
// ------------------------------------------------------------
|
||||
LPD3DXFONT GetFont(eFontIndex idx); // returns a handle to a D3DX font you can use to draw text on the screen
|
||||
int GetFontHeight(eFontIndex idx); // returns the height of the font, in pixels
|
||||
|
||||
// MISC
|
||||
// ------------------------------------------------------------
|
||||
td_soundinfo m_sound; // a structure always containing the most recent sound analysis information; defined in pluginshell.h.
|
||||
void SuggestHowToFreeSomeMem(); // gives the user a 'smart' messagebox that suggests how they can free up some video memory.
|
||||
*/
|
||||
//=====================================================================================================================
|
||||
};
|
||||
|
||||
#endif
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,419 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Debug|Win32">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Debug|x64">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|Win32">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|x64">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<ProjectName>vis_milk2</ProjectName>
|
||||
<ProjectGuid>{881FB534-7396-485A-ADC2-6FBEBED7A0F4}</ProjectGuid>
|
||||
<RootNamespace>vis_milk2</RootNamespace>
|
||||
<WindowsTargetPlatformVersion>10.0.19041.0</WindowsTargetPlatformVersion>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<PlatformToolset>v142</PlatformToolset>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<PlatformToolset>v142</PlatformToolset>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<PlatformToolset>v142</PlatformToolset>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<PlatformToolset>v142</PlatformToolset>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<LinkIncremental>false</LinkIncremental>
|
||||
<OutDir>$(PlatformShortName)_$(Configuration)\</OutDir>
|
||||
<IntDir>$(PlatformShortName)_$(Configuration)\</IntDir>
|
||||
<IncludePath>$(IncludePath)</IncludePath>
|
||||
<LibraryPath>$(LibraryPath)</LibraryPath>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<IncludePath>$(IncludePath)</IncludePath>
|
||||
<LibraryPath>$(LibraryPath)</LibraryPath>
|
||||
<LinkIncremental>false</LinkIncremental>
|
||||
<OutDir>$(PlatformShortName)_$(Configuration)\</OutDir>
|
||||
<IntDir>$(PlatformShortName)_$(Configuration)\</IntDir>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<LinkIncremental>false</LinkIncremental>
|
||||
<OutDir>$(PlatformShortName)_$(Configuration)\</OutDir>
|
||||
<IntDir>$(PlatformShortName)_$(Configuration)\</IntDir>
|
||||
<IncludePath>$(IncludePath)</IncludePath>
|
||||
<LibraryPath>$(LibraryPath)</LibraryPath>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<IncludePath>$(IncludePath)</IncludePath>
|
||||
<LibraryPath>$(LibraryPath)</LibraryPath>
|
||||
<LinkIncremental>false</LinkIncremental>
|
||||
<OutDir>$(PlatformShortName)_$(Configuration)\</OutDir>
|
||||
<IntDir>$(PlatformShortName)_$(Configuration)\</IntDir>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Label="Vcpkg">
|
||||
<VcpkgEnableManifest>false</VcpkgEnableManifest>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Label="Vcpkg" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<VcpkgInstalledDir>
|
||||
</VcpkgInstalledDir>
|
||||
<VcpkgUseStatic>false</VcpkgUseStatic>
|
||||
<VcpkgConfiguration>Debug</VcpkgConfiguration>
|
||||
<VcpkgTriplet>x86-windows-static-md</VcpkgTriplet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Label="Vcpkg" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<VcpkgInstalledDir>
|
||||
</VcpkgInstalledDir>
|
||||
<VcpkgUseStatic>false</VcpkgUseStatic>
|
||||
<VcpkgTriplet>x86-windows-static-md</VcpkgTriplet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Label="Vcpkg" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<VcpkgInstalledDir>
|
||||
</VcpkgInstalledDir>
|
||||
<VcpkgUseStatic>false</VcpkgUseStatic>
|
||||
<VcpkgTriplet>x86-windows-static-md</VcpkgTriplet>
|
||||
<VcpkgConfiguration>Debug</VcpkgConfiguration>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Label="Vcpkg" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<VcpkgInstalledDir>
|
||||
</VcpkgInstalledDir>
|
||||
<VcpkgUseStatic>false</VcpkgUseStatic>
|
||||
<VcpkgTriplet>x86-windows-static-md</VcpkgTriplet>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<ClCompile>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<AdditionalIncludeDirectories>..\..\..\;..\..\..\Wasabi;..\..\..\external_dependencies\microsoft_directx_sdk_2010\Include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>_WIN32_WINNT=0x0601;WINVER=0x0601;WIN32;_DEBUG;_WINDOWS;USE_VIS_HDR_HWND;STRSAFE_NO_DEPRECATE;NSEEL_REENTRANT_EXECUTION;_CRT_SECURE_NO_WARNINGS;_CRT_NON_CONFORMING_SWPRINTFS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<MinimalRebuild>false</MinimalRebuild>
|
||||
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
||||
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
|
||||
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
|
||||
<AssemblerListingLocation>$(IntDir)</AssemblerListingLocation>
|
||||
<ObjectFileName>$(IntDir)</ObjectFileName>
|
||||
<ProgramDataBaseFileName>$(IntDir)$(TargetName).pdb</ProgramDataBaseFileName>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||
<DisableSpecificWarnings>4473;4477;4996;%(DisableSpecificWarnings)</DisableSpecificWarnings>
|
||||
<BufferSecurityCheck>true</BufferSecurityCheck>
|
||||
</ClCompile>
|
||||
<ResourceCompile>
|
||||
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<Culture>0x0409</Culture>
|
||||
</ResourceCompile>
|
||||
<Link>
|
||||
<AdditionalDependencies>vms_desktop.lib;d3d9.lib;Shlwapi.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<OutputFile>$(OutDir)$(TargetName)$(TargetExt)</OutputFile>
|
||||
<AdditionalLibraryDirectories>..\..\..\external_dependencies\microsoft_directx_sdk_2010\Lib\$(PlatformShortName);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<DelayLoadDLLs>vms_desktop.dll;%(DelayLoadDLLs)</DelayLoadDLLs>
|
||||
<ProgramDatabaseFile>$(IntDir)$(TargetName).pdb</ProgramDatabaseFile>
|
||||
<RandomizedBaseAddress>false</RandomizedBaseAddress>
|
||||
<ImportLibrary>$(intDir)$(ProjectName).lib</ImportLibrary>
|
||||
<TargetMachine>MachineX86</TargetMachine>
|
||||
<ImageHasSafeExceptionHandlers>false</ImageHasSafeExceptionHandlers>
|
||||
</Link>
|
||||
<PostBuildEvent>
|
||||
<Command>xcopy /Y /D $(OutDir)$(TargetName)$(TargetExt) ..\..\..\..\Build\Winamp_$(PlatformShortName)_$(Configuration)\Plugins\
|
||||
xcopy /Y /D $(IntDir)$(TargetName).pdb ..\..\..\..\Build\Winamp_$(PlatformShortName)_$(Configuration)\Plugins\
|
||||
|
||||
xcopy /Y /D /S ..\..\..\resources\data\Milkdrop2 ..\..\..\..\Build\Winamp_$(PlatformShortName)_$(Configuration)\Plugins\Milkdrop2\
|
||||
xcopy /Y /D /S ..\..\..\resources\data\milk2_msg.ini ..\..\..\..\Build\Winamp_$(PlatformShortName)_$(Configuration)\Plugins\Milkdrop2\
|
||||
xcopy /Y /D /S ..\..\..\resources\data\milk2_img.ini ..\..\..\..\Build\Winamp_$(PlatformShortName)_$(Configuration)\Plugins\Milkdrop2\
|
||||
</Command>
|
||||
<Message>Copy resources: Milkdrop2, milk2_msg.ini, milk2_img.ini to ..\..\..\..\..\Build\Winamp_$(PlatformShortName)_$(Configuration)\Plugins\</Message>
|
||||
</PostBuildEvent>
|
||||
<ProjectReference>
|
||||
<UseLibraryDependencyInputs>false</UseLibraryDependencyInputs>
|
||||
</ProjectReference>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<ClCompile>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<AdditionalIncludeDirectories>..\..\..\;..\..\..\Wasabi;..\..\..\external_dependencies\microsoft_directx_sdk_2010\Include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>_WIN32_WINNT=0x0601;WINVER=0x0601;WIN32;WIN64;_DEBUG;_WINDOWS;USE_VIS_HDR_HWND;STRSAFE_NO_DEPRECATE;NSEEL_REENTRANT_EXECUTION;_CRT_SECURE_NO_WARNINGS;_CRT_NON_CONFORMING_SWPRINTFS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<MinimalRebuild>false</MinimalRebuild>
|
||||
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
||||
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
|
||||
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
|
||||
<AssemblerListingLocation>$(IntDir)</AssemblerListingLocation>
|
||||
<ObjectFileName>$(IntDir)</ObjectFileName>
|
||||
<ProgramDataBaseFileName>$(IntDir)$(TargetName).pdb</ProgramDataBaseFileName>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||
<DisableSpecificWarnings>4473;4477;4996;%(DisableSpecificWarnings)</DisableSpecificWarnings>
|
||||
<BufferSecurityCheck>true</BufferSecurityCheck>
|
||||
</ClCompile>
|
||||
<ResourceCompile>
|
||||
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<Culture>0x0409</Culture>
|
||||
</ResourceCompile>
|
||||
<Link>
|
||||
<AdditionalDependencies>vms_desktop.lib;d3d9.lib;Shlwapi.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<OutputFile>$(OutDir)$(TargetName)$(TargetExt)</OutputFile>
|
||||
<AdditionalLibraryDirectories>..\..\..\..\external_dependencies\microsoft_directx_sdk_2010\Lib\$(PlatformShortName);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<DelayLoadDLLs>vms_desktop.dll;%(DelayLoadDLLs)</DelayLoadDLLs>
|
||||
<ProgramDatabaseFile>$(IntDir)$(TargetName).pdb</ProgramDatabaseFile>
|
||||
<RandomizedBaseAddress>false</RandomizedBaseAddress>
|
||||
<ImportLibrary>$(intDir)$(TargetName).lib</ImportLibrary>
|
||||
<ImageHasSafeExceptionHandlers>false</ImageHasSafeExceptionHandlers>
|
||||
</Link>
|
||||
<PostBuildEvent>
|
||||
<Command>xcopy /Y /D $(OutDir)$(TargetName)$(TargetExt) ..\..\..\..\Build\Winamp_$(PlatformShortName)_$(Configuration)\Plugins\
|
||||
xcopy /Y /D $(IntDir)$(TargetName).pdb ..\..\..\..\Build\Winamp_$(PlatformShortName)_$(Configuration)\Plugins\
|
||||
|
||||
xcopy /Y /D /S ..\..\..\..\resources\data\Milkdrop2 ..\..\..\..\..\Build\Winamp_$(PlatformShortName)_$(Configuration)\Plugins\Milkdrop2\
|
||||
xcopy /Y /D /S ..\..\..\..\resources\data\milk2_msg.ini ..\..\..\..\..\Build\Winamp_$(PlatformShortName)_$(Configuration)\Plugins\Milkdrop2\
|
||||
xcopy /Y /D /S ..\..\..\..\resources\data\milk2_img.ini ..\..\..\..\..\Build\Winamp_$(PlatformShortName)_$(Configuration)\Plugins\Milkdrop2\
|
||||
</Command>
|
||||
<Message>Copy resources: Milkdrop2, milk2_msg.ini, milk2_img.ini to ..\..\..\..\..\Build\Winamp_$(PlatformShortName)_$(Configuration)\Plugins\</Message>
|
||||
</PostBuildEvent>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<ClCompile>
|
||||
<Optimization>MinSpace</Optimization>
|
||||
<InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion>
|
||||
<AdditionalIncludeDirectories>..\..\..\;..\..\..\Wasabi;..\..\..\external_dependencies\microsoft_directx_sdk_2010\Include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>_WIN32_WINNT=0x0601;WINVER=0x0601;WIN32;NDEBUG;_WINDOWS;USE_VIS_HDR_HWND;STRSAFE_NO_DEPRECATE;NSEEL_REENTRANT_EXECUTION;_CRT_SECURE_NO_WARNINGS;_CRT_NON_CONFORMING_SWPRINTFS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<StringPooling>true</StringPooling>
|
||||
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
||||
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
|
||||
<BufferSecurityCheck>true</BufferSecurityCheck>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<ForceConformanceInForLoopScope>true</ForceConformanceInForLoopScope>
|
||||
<AssemblerListingLocation>$(IntDir)</AssemblerListingLocation>
|
||||
<ObjectFileName>$(IntDir)</ObjectFileName>
|
||||
<ProgramDataBaseFileName>$(IntDir)$(TargetName).pdb</ProgramDataBaseFileName>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<DebugInformationFormat>None</DebugInformationFormat>
|
||||
<CompileAs>Default</CompileAs>
|
||||
<DisableSpecificWarnings>4473;4477;4996;%(DisableSpecificWarnings)</DisableSpecificWarnings>
|
||||
</ClCompile>
|
||||
<ResourceCompile>
|
||||
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<Culture>0x0409</Culture>
|
||||
</ResourceCompile>
|
||||
<Link>
|
||||
<AdditionalDependencies>vms_desktop.lib;d3d9.lib;Shlwapi.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<OutputFile>$(OutDir)$(TargetName)$(TargetExt)</OutputFile>
|
||||
<AdditionalLibraryDirectories>..\..\..\external_dependencies\microsoft_directx_sdk_2010\Lib\$(PlatformShortName);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<GenerateDebugInformation>false</GenerateDebugInformation>
|
||||
<DelayLoadDLLs>vms_desktop.dll;%(DelayLoadDLLs)</DelayLoadDLLs>
|
||||
<ProgramDatabaseFile>$(IntDir)$(TargetName).pdb</ProgramDatabaseFile>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<RandomizedBaseAddress>false</RandomizedBaseAddress>
|
||||
<ImportLibrary>$(intDir)$(TargetName).lib</ImportLibrary>
|
||||
<TargetMachine>MachineX86</TargetMachine>
|
||||
<ImageHasSafeExceptionHandlers>false</ImageHasSafeExceptionHandlers>
|
||||
</Link>
|
||||
<PostBuildEvent>
|
||||
<Command>xcopy /Y /D $(OutDir)$(TargetName)$(TargetExt) ..\..\..\..\Build\Winamp_$(PlatformShortName)_$(Configuration)\Plugins\
|
||||
xcopy /Y /D /S ..\..\..\resources\data\Milkdrop2 ..\..\..\..\Build\Winamp_$(PlatformShortName)_$(Configuration)\Plugins\Milkdrop2\
|
||||
xcopy /Y /D /S ..\..\..\resources\data\milk2_msg.ini ..\..\..\..\Build\Winamp_$(PlatformShortName)_$(Configuration)\Plugins\Milkdrop2\
|
||||
xcopy /Y /D /S ..\..\..\resources\data\milk2_img.ini ..\..\..\..\Build\Winamp_$(PlatformShortName)_$(Configuration)\Plugins\Milkdrop2\
|
||||
</Command>
|
||||
<Message>Copy resources: Milkdrop2, milk2_msg.ini, milk2_img.ini to ..\..\..\Build\Winamp_$(PlatformShortName)_$(Configuration)\Plugins\</Message>
|
||||
</PostBuildEvent>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<ClCompile>
|
||||
<Optimization>MinSpace</Optimization>
|
||||
<InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion>
|
||||
<AdditionalIncludeDirectories>..\..\..\;..\..\..\Wasabi;..\..\..\external_dependencies\microsoft_directx_sdk_2010\Include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>_WIN32_WINNT=0x0601;WINVER=0x0601;WIN32;WIN64;NDEBUG;_WINDOWS;USE_VIS_HDR_HWND;STRSAFE_NO_DEPRECATE;NSEEL_REENTRANT_EXECUTION;_CRT_SECURE_NO_WARNINGS;_CRT_NON_CONFORMING_SWPRINTFS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<StringPooling>true</StringPooling>
|
||||
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
||||
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
|
||||
<BufferSecurityCheck>true</BufferSecurityCheck>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<ForceConformanceInForLoopScope>true</ForceConformanceInForLoopScope>
|
||||
<AssemblerListingLocation>$(IntDir)</AssemblerListingLocation>
|
||||
<ObjectFileName>$(IntDir)</ObjectFileName>
|
||||
<ProgramDataBaseFileName>$(IntDir)$(TargetName).pdb</ProgramDataBaseFileName>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<DebugInformationFormat>None</DebugInformationFormat>
|
||||
<CompileAs>Default</CompileAs>
|
||||
<DisableSpecificWarnings>4473;4477;4996;%(DisableSpecificWarnings)</DisableSpecificWarnings>
|
||||
</ClCompile>
|
||||
<ResourceCompile>
|
||||
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<Culture>0x0409</Culture>
|
||||
</ResourceCompile>
|
||||
<Link>
|
||||
<AdditionalDependencies>vms_desktop.lib;d3d9.lib;Shlwapi.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<OutputFile>$(OutDir)$(TargetName)$(TargetExt)</OutputFile>
|
||||
<AdditionalLibraryDirectories>..\..\..\external_dependencies\microsoft_directx_sdk_2010\Lib\$(PlatformShortName);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<GenerateDebugInformation>false</GenerateDebugInformation>
|
||||
<DelayLoadDLLs>vms_desktop.dll;%(DelayLoadDLLs)</DelayLoadDLLs>
|
||||
<ProgramDatabaseFile>$(IntDir)$(TargetName).pdb</ProgramDatabaseFile>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<RandomizedBaseAddress>false</RandomizedBaseAddress>
|
||||
<ImportLibrary>$(intDir)$(TargetName).lib</ImportLibrary>
|
||||
<ImageHasSafeExceptionHandlers>false</ImageHasSafeExceptionHandlers>
|
||||
</Link>
|
||||
<PostBuildEvent>
|
||||
<Command>xcopy /Y /D $(OutDir)$(TargetName)$(TargetExt) ..\..\..\..\Build\Winamp_$(PlatformShortName)_$(Configuration)\Plugins\
|
||||
xcopy /Y /D /S ..\..\..\resources\data\Milkdrop2 ..\..\..\..\Build\Winamp_$(PlatformShortName)_$(Configuration)\Plugins\Milkdrop2\
|
||||
xcopy /Y /D /S ..\..\..\resources\data\milk2_msg.ini ..\..\..\..\Build\Winamp_$(PlatformShortName)_$(Configuration)\Plugins\Milkdrop2\
|
||||
xcopy /Y /D /S ..\..\..\resources\data\milk2_img.ini ..\..\..\..\Build\Winamp_$(PlatformShortName)_$(Configuration)\Plugins\Milkdrop2\
|
||||
</Command>
|
||||
<Message>Copy resources: Milkdrop2, milk2_msg.ini, milk2_img.ini to ..\..\..\..\..\Build\Winamp_$(PlatformShortName)_$(Configuration)\Plugins\</Message>
|
||||
</PostBuildEvent>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="ns-eel2\nseel-caltab.c" />
|
||||
<ClCompile Include="ns-eel2\nseel-cfunc.c" />
|
||||
<ClCompile Include="ns-eel2\nseel-compiler.c" />
|
||||
<ClCompile Include="ns-eel2\nseel-eval.c" />
|
||||
<ClCompile Include="ns-eel2\nseel-lextab.c" />
|
||||
<ClCompile Include="ns-eel2\nseel-ram.c" />
|
||||
<ClCompile Include="ns-eel2\nseel-yylex.c" />
|
||||
<ClCompile Include="config.cpp">
|
||||
<PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">_MBCS;</PreprocessorDefinitions>
|
||||
<PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">_MBCS;</PreprocessorDefinitions>
|
||||
<PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">_MBCS;</PreprocessorDefinitions>
|
||||
<PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|x64'">_MBCS;</PreprocessorDefinitions>
|
||||
</ClCompile>
|
||||
<ClCompile Include="config2.cpp" />
|
||||
<ClCompile Include="desktop_mode.cpp">
|
||||
<PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">_MBCS;</PreprocessorDefinitions>
|
||||
<PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">_MBCS;</PreprocessorDefinitions>
|
||||
<PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">_MBCS;</PreprocessorDefinitions>
|
||||
<PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|x64'">_MBCS;</PreprocessorDefinitions>
|
||||
</ClCompile>
|
||||
<ClCompile Include="dxcontext.cpp">
|
||||
<PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">_MBCS;</PreprocessorDefinitions>
|
||||
<PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">_MBCS;</PreprocessorDefinitions>
|
||||
<PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">_MBCS;</PreprocessorDefinitions>
|
||||
<PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|x64'">_MBCS;</PreprocessorDefinitions>
|
||||
</ClCompile>
|
||||
<ClCompile Include="fft.cpp" />
|
||||
<ClCompile Include="menu.cpp" />
|
||||
<ClCompile Include="milkdropfs.cpp">
|
||||
<PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">_MBCS;</PreprocessorDefinitions>
|
||||
<PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">_MBCS;</PreprocessorDefinitions>
|
||||
<PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">_MBCS;</PreprocessorDefinitions>
|
||||
<PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|x64'">_MBCS;</PreprocessorDefinitions>
|
||||
</ClCompile>
|
||||
<ClCompile Include="plugin.cpp">
|
||||
<PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">_MBCS;</PreprocessorDefinitions>
|
||||
<PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">_MBCS;</PreprocessorDefinitions>
|
||||
<PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">_MBCS;</PreprocessorDefinitions>
|
||||
<PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|x64'">_MBCS;</PreprocessorDefinitions>
|
||||
</ClCompile>
|
||||
<ClCompile Include="pluginshell.cpp">
|
||||
<PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">_MBCS;</PreprocessorDefinitions>
|
||||
<PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">_MBCS;</PreprocessorDefinitions>
|
||||
<PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">_MBCS;</PreprocessorDefinitions>
|
||||
<PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|x64'">_MBCS;</PreprocessorDefinitions>
|
||||
</ClCompile>
|
||||
<ClCompile Include="state.cpp" />
|
||||
<ClCompile Include="support.cpp" />
|
||||
<ClCompile Include="texmgr.cpp">
|
||||
<PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">_MBCS;</PreprocessorDefinitions>
|
||||
<PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">_MBCS;</PreprocessorDefinitions>
|
||||
<PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">_MBCS;</PreprocessorDefinitions>
|
||||
<PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|x64'">_MBCS;</PreprocessorDefinitions>
|
||||
</ClCompile>
|
||||
<ClCompile Include="textmgr.cpp">
|
||||
<PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">_MBCS;</PreprocessorDefinitions>
|
||||
<PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">_MBCS;</PreprocessorDefinitions>
|
||||
<PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">_MBCS;</PreprocessorDefinitions>
|
||||
<PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|x64'">_MBCS;</PreprocessorDefinitions>
|
||||
</ClCompile>
|
||||
<ClCompile Include="utility.cpp">
|
||||
<PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">_MBCS;</PreprocessorDefinitions>
|
||||
<PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">_MBCS;</PreprocessorDefinitions>
|
||||
<PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">_MBCS;</PreprocessorDefinitions>
|
||||
<PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|x64'">_MBCS;</PreprocessorDefinitions>
|
||||
</ClCompile>
|
||||
<ClCompile Include="vis.cpp" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Image Include="plugin_icon.ico" />
|
||||
<Image Include="temp.ico" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="..\..\..\nu\AutoCharFn.h" />
|
||||
<ClInclude Include="api__vis_milk2.h" />
|
||||
<ClInclude Include="defines.h" />
|
||||
<ClInclude Include="dxcontext.h" />
|
||||
<ClInclude Include="fft.h" />
|
||||
<ClInclude Include="gstring.h" />
|
||||
<ClInclude Include="icon_t.h" />
|
||||
<ClInclude Include="md_defines.h" />
|
||||
<ClInclude Include="menu.h" />
|
||||
<ClInclude Include="plugin.h" />
|
||||
<ClInclude Include="pluginshell.h" />
|
||||
<ClInclude Include="resource.h" />
|
||||
<ClInclude Include="shell_defines.h" />
|
||||
<ClInclude Include="state.h" />
|
||||
<ClInclude Include="support.h" />
|
||||
<ClInclude Include="texmgr.h" />
|
||||
<ClInclude Include="textmgr.h" />
|
||||
<ClInclude Include="utility.h" />
|
||||
<ClInclude Include="vis.h" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ResourceCompile Include="plugin.rc" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Text Include="DOCUMENTATION.TXT" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="milkdrop.nsi" />
|
||||
<None Include="text1.bin" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\..\tataki\tataki.vcxproj">
|
||||
<Project>{255b68b5-7ef8-45ef-a675-2d6b88147909}</Project>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\..\Wasabi\Wasabi.vcxproj">
|
||||
<Project>{3e0bfa8a-b86a-42e9-a33f-ec294f823f7f}</Project>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
||||
@@ -0,0 +1,164 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup>
|
||||
<ClCompile Include="vis.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="utility.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="textmgr.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="texmgr.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="support.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="state.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="pluginshell.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="plugin.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="ns-eel2\nseel-yylex.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="ns-eel2\nseel-ram.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="ns-eel2\nseel-lextab.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="ns-eel2\nseel-eval.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="ns-eel2\nseel-compiler.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="ns-eel2\nseel-cfunc.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="ns-eel2\nseel-caltab.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="milkdropfs.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="menu.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="fft.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="dxcontext.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="desktop_mode.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="config2.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="config.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="api__vis_milk2.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="defines.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="dxcontext.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="fft.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="gstring.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="icon_t.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="md_defines.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="menu.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="plugin.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="pluginshell.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="resource.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="shell_defines.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="state.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="support.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="vis.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="utility.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="textmgr.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="texmgr.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\nu\AutoCharFn.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Image Include="temp.ico">
|
||||
<Filter>Image Files</Filter>
|
||||
</Image>
|
||||
<Image Include="plugin_icon.ico">
|
||||
<Filter>Image Files</Filter>
|
||||
</Image>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="milkdrop.nsi" />
|
||||
<None Include="text1.bin" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Text Include="DOCUMENTATION.TXT" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Filter Include="Header Files">
|
||||
<UniqueIdentifier>{ce7fdde7-654e-45a5-b681-4fcbef840d29}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Ressource Files">
|
||||
<UniqueIdentifier>{4855ad07-70ea-4062-a58a-c2b86cd50226}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Source Files">
|
||||
<UniqueIdentifier>{e2bc9640-36e0-4507-a344-217bd59e980a}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Image Files">
|
||||
<UniqueIdentifier>{afa2593b-8914-4582-8765-a249b22e82af}</UniqueIdentifier>
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ResourceCompile Include="plugin.rc">
|
||||
<Filter>Ressource Files</Filter>
|
||||
</ResourceCompile>
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 7.2 KiB |
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,371 @@
|
||||
/*
|
||||
LICENSE
|
||||
-------
|
||||
Copyright 2005-2013 Nullsoft, Inc.
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification,
|
||||
are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright notice,
|
||||
this list of conditions and the following disclaimer.
|
||||
|
||||
* Redistributions in binary form must reproduce the above copyright notice,
|
||||
this list of conditions and the following disclaimer in the documentation
|
||||
and/or other materials provided with the distribution.
|
||||
|
||||
* Neither the name of Nullsoft nor the names of its contributors may be used to
|
||||
endorse or promote products derived from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
|
||||
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||
FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
||||
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
|
||||
IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
|
||||
OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifndef __NULLSOFT_DX9_PLUGIN_SHELL_H__
|
||||
#define __NULLSOFT_DX9_PLUGIN_SHELL_H__ 1
|
||||
|
||||
#include "shell_defines.h"
|
||||
#include "dxcontext.h"
|
||||
#include "fft.h"
|
||||
#include "defines.h"
|
||||
#include "textmgr.h"
|
||||
|
||||
#include "icon_t.h"
|
||||
#include <vector>
|
||||
|
||||
#define TIME_HIST_SLOTS 128 // # of slots used if fps > 60. half this many if fps==30.
|
||||
#define MAX_SONGS_PER_PAGE 40
|
||||
|
||||
typedef struct
|
||||
{
|
||||
wchar_t szFace[256];
|
||||
int nSize; // size requested @ font creation time
|
||||
int bBold;
|
||||
int bItalic;
|
||||
int bAntiAliased;
|
||||
} td_fontinfo;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
float imm[2][3]; // bass, mids, treble, no damping, for each channel (long-term average is 1)
|
||||
float avg[2][3]; // bass, mids, treble, some damping, for each channel (long-term average is 1)
|
||||
float med_avg[2][3]; // bass, mids, treble, more damping, for each channel (long-term average is 1)
|
||||
float long_avg[2][3]; // bass, mids, treble, heavy damping, for each channel (long-term average is 1)
|
||||
float infinite_avg[2][3]; // bass, mids, treble: winamp's average output levels. (1)
|
||||
float fWaveform[2][576]; // Not all 576 are valid! - only NUM_WAVEFORM_SAMPLES samples are valid for each channel (note: NUM_WAVEFORM_SAMPLES is declared in shell_defines.h)
|
||||
float fSpectrum[2][NUM_FREQUENCIES]; // NUM_FREQUENCIES samples for each channel (note: NUM_FREQUENCIES is declared in shell_defines.h)
|
||||
} td_soundinfo; // ...range is 0 Hz to 22050 Hz, evenly spaced.
|
||||
|
||||
class CPluginShell
|
||||
{
|
||||
public:
|
||||
// GET METHODS
|
||||
// ------------------------------------------------------------
|
||||
int GetFrame(); // returns current frame # (starts at zero)
|
||||
float GetTime(); // returns current animation time (in seconds) (starts at zero) (updated once per frame)
|
||||
float GetFps(); // returns current estimate of framerate (frames per second)
|
||||
eScrMode GetScreenMode(); // returns WINDOWED, FULLSCREEN, FAKE_FULLSCREEN, DESKTOP, or NOT_YET_KNOWN (if called before or during OverrideDefaults()).
|
||||
HWND GetWinampWindow(); // returns handle to Winamp main window
|
||||
HINSTANCE GetInstance(); // returns handle to the plugin DLL module; used for things like loading resources (dialogs, bitmaps, icons...) that are built into the plugin.
|
||||
wchar_t* GetPluginsDirPath(); // usually returns 'c:\\program files\\winamp\\plugins\\'
|
||||
wchar_t* GetConfigIniFile(); // usually returns 'c:\\program files\\winamp\\plugins\\something.ini' - filename is determined from identifiers in 'defines.h'
|
||||
char* GetConfigIniFileA();
|
||||
protected:
|
||||
|
||||
// GET METHODS THAT ONLY WORK ONCE DIRECTX IS READY
|
||||
// ------------------------------------------------------------
|
||||
// The following 'Get' methods are only available after DirectX has been initialized.
|
||||
// If you call these from OverrideDefaults, MyPreInitialize, or MyReadConfig,
|
||||
// they will return NULL (zero).
|
||||
// ------------------------------------------------------------
|
||||
HWND GetPluginWindow(); // returns handle to the plugin window. NOT persistent; can change!
|
||||
int GetWidth(); // returns width of plugin window interior, in pixels. Note: in windowed mode, this is a fudged, larger, aligned value, and on final display, it gets cropped.
|
||||
int GetHeight(); // returns height of plugin window interior, in pixels. Note: in windowed mode, this is a fudged, larger, aligned value, and on final display, it gets cropped.
|
||||
int GetBitDepth(); // returns 8, 16, 24 (rare), or 32
|
||||
LPDIRECT3DDEVICE9 GetDevice(); // returns a pointer to the DirectX 8 Device. NOT persistent; can change!
|
||||
D3DCAPS9* GetCaps(); // returns a pointer to the D3DCAPS9 structer for the device. NOT persistent; can change.
|
||||
D3DFORMAT GetBackBufFormat(); // returns the pixelformat of the back buffer (probably D3DFMT_R8G8B8, D3DFMT_A8R8G8B8, D3DFMT_X8R8G8B8, D3DFMT_R5G6B5, D3DFMT_X1R5G5B5, D3DFMT_A1R5G5B5, D3DFMT_A4R4G4B4, D3DFMT_R3G3B2, D3DFMT_A8R3G3B2, D3DFMT_X4R4G4B4, or D3DFMT_UNKNOWN)
|
||||
D3DFORMAT GetBackBufZFormat(); // returns the pixelformat of the back buffer's Z buffer (probably D3DFMT_D16_LOCKABLE, D3DFMT_D32, D3DFMT_D15S1, D3DFMT_D24S8, D3DFMT_D16, D3DFMT_D24X8, D3DFMT_D24X4S4, or D3DFMT_UNKNOWN)
|
||||
char* GetDriverFilename(); // returns a text string with the filename of the current display adapter driver, such as "nv4_disp.dll"
|
||||
char* GetDriverDescription(); // returns a text string describing the current display adapter, such as "NVIDIA GeForce4 Ti 4200"
|
||||
|
||||
// FONTS & TEXT
|
||||
// ------------------------------------------------------------
|
||||
public:
|
||||
LPD3DXFONT GetFont(eFontIndex idx); // returns a D3DX font handle for drawing text; see shell_defines.h for the definition of the 'eFontIndex' enum.
|
||||
int GetFontHeight(eFontIndex idx); // returns the height of the font, in pixels; see shell_defines.h for the definition of the 'eFontIndex' enum.
|
||||
CTextManager m_text;
|
||||
protected:
|
||||
|
||||
// MISC
|
||||
// ------------------------------------------------------------
|
||||
td_soundinfo m_sound; // a structure always containing the most recent sound analysis information; defined in pluginshell.h.
|
||||
void SuggestHowToFreeSomeMem(); // gives the user a 'smart' messagebox that suggests how they can free up some video memory.
|
||||
|
||||
// CONFIG PANEL SETTINGS
|
||||
// ------------------------------------------------------------
|
||||
// *** only read/write these values during CPlugin::OverrideDefaults! ***
|
||||
int m_start_fullscreen; // 0 or 1
|
||||
int m_start_desktop; // 0 or 1
|
||||
int m_fake_fullscreen_mode; // 0 or 1
|
||||
int m_max_fps_fs; // 1-120, or 0 for 'unlimited'
|
||||
int m_max_fps_dm; // 1-120, or 0 for 'unlimited'
|
||||
int m_max_fps_w; // 1-120, or 0 for 'unlimited'
|
||||
int m_show_press_f1_msg; // 0 or 1
|
||||
int m_allow_page_tearing_w; // 0 or 1
|
||||
int m_allow_page_tearing_fs; // 0 or 1
|
||||
int m_allow_page_tearing_dm; // 0 or 1
|
||||
int m_minimize_winamp; // 0 or 1
|
||||
int m_desktop_show_icons; // 0 or 1
|
||||
int m_desktop_textlabel_boxes; // 0 or 1
|
||||
int m_desktop_manual_icon_scoot; // 0 or 1
|
||||
int m_desktop_555_fix; // 0 = 555, 1 = 565, 2 = 888
|
||||
int m_dualhead_horz; // 0 = both, 1 = left, 2 = right
|
||||
int m_dualhead_vert; // 0 = both, 1 = top, 2 = bottom
|
||||
int m_save_cpu; // 0 or 1
|
||||
int m_skin; // 0 or 1
|
||||
int m_fix_slow_text; // 0 or 1
|
||||
td_fontinfo m_fontinfo[NUM_BASIC_FONTS + NUM_EXTRA_FONTS];
|
||||
D3DDISPLAYMODE m_disp_mode_fs; // a D3DDISPLAYMODE struct that specifies the width, height, refresh rate, and color format to use when the plugin goes fullscreen.
|
||||
|
||||
// PURE VIRTUAL FUNCTIONS (...must be implemented by derived classes)
|
||||
// ------------------------------------------------------------
|
||||
virtual void OverrideDefaults() = 0;
|
||||
virtual void MyPreInitialize() = 0;
|
||||
virtual void MyReadConfig() = 0;
|
||||
virtual void MyWriteConfig() = 0;
|
||||
virtual int AllocateMyNonDx9Stuff() = 0;
|
||||
virtual void CleanUpMyNonDx9Stuff() = 0;
|
||||
virtual int AllocateMyDX9Stuff() = 0;
|
||||
virtual void CleanUpMyDX9Stuff(int final_cleanup) = 0;
|
||||
virtual void MyRenderFn(int redraw) = 0;
|
||||
virtual void MyRenderUI(int *upper_left_corner_y, int *upper_right_corner_y, int *lower_left_corner_y, int *lower_right_corner_y, int xL, int xR) = 0;
|
||||
virtual LRESULT MyWindowProc(HWND hWnd, unsigned uMsg, WPARAM wParam, LPARAM lParam) = 0;
|
||||
virtual BOOL MyConfigTabProc(int nPage, HWND hwnd,UINT msg,WPARAM wParam,LPARAM lParam) = 0;
|
||||
virtual void OnAltK() { }; // doesn't *have* to be implemented
|
||||
|
||||
//=====================================================================================================================
|
||||
private:
|
||||
|
||||
// GENERAL PRIVATE STUFF
|
||||
eScrMode m_screenmode; // // WINDOWED, FULLSCREEN, or FAKE_FULLSCREEN (i.e. running in a full-screen-sized window)
|
||||
int m_frame; // current frame #, starting at zero
|
||||
float m_time; // current animation time in seconds; starts at zero.
|
||||
float m_fps; // current estimate of frames per second
|
||||
HWND m_hWndWinamp; // handle to Winamp window
|
||||
HINSTANCE m_hInstance; // handle to application instance
|
||||
DXContext* m_lpDX; // pointer to DXContext object
|
||||
wchar_t m_szPluginsDirPath[MAX_PATH]; // usually 'c:\\program files\\winamp\\plugins\\'
|
||||
wchar_t m_szConfigIniFile[MAX_PATH]; // usually 'c:\\program files\\winamp\\plugins\\something.ini' - filename is determined from identifiers in 'defines.h'
|
||||
char m_szConfigIniFileA[MAX_PATH]; // usually 'c:\\program files\\winamp\\plugins\\something.ini' - filename is determined from identifiers in 'defines.h'
|
||||
|
||||
// FONTS
|
||||
IDirect3DTexture9* m_lpDDSText;
|
||||
LPD3DXFONT m_d3dx_font[NUM_BASIC_FONTS + NUM_EXTRA_FONTS];
|
||||
LPD3DXFONT m_d3dx_desktop_font;
|
||||
HFONT m_font[NUM_BASIC_FONTS + NUM_EXTRA_FONTS];
|
||||
HFONT m_font_desktop;
|
||||
|
||||
// PRIVATE CONFIG PANEL SETTINGS
|
||||
D3DMULTISAMPLE_TYPE m_multisample_fullscreen;
|
||||
D3DMULTISAMPLE_TYPE m_multisample_desktop;
|
||||
D3DMULTISAMPLE_TYPE m_multisample_windowed;
|
||||
GUID m_adapter_guid_fullscreen;
|
||||
GUID m_adapter_guid_desktop;
|
||||
GUID m_adapter_guid_windowed;
|
||||
char m_adapter_devicename_fullscreen[256]; // these are also necessary sometimes,
|
||||
char m_adapter_devicename_desktop[256]; // for example, when a laptop (single adapter)
|
||||
char m_adapter_devicename_windowed[256]; // drives two displays! DeviceName will be \\.\Display1 and \\.\Display2 or something.
|
||||
|
||||
// PRIVATE RUNTIME SETTINGS
|
||||
int m_lost_focus; // ~mostly for fullscreen mode
|
||||
int m_hidden; // ~mostly for windowed mode
|
||||
int m_resizing; // ~mostly for windowed mode
|
||||
int m_show_help;
|
||||
int m_show_playlist;
|
||||
int m_playlist_pos; // current selection on (plugin's) playlist menu
|
||||
int m_playlist_pageups; // can be + or -
|
||||
int m_playlist_top_idx; // used to track when our little playlist cache (m_playlist) needs updated.
|
||||
int m_playlist_btm_idx; // used to track when our little playlist cache (m_playlist) needs updated.
|
||||
int m_playlist_width_pixels; // considered invalid whenever 'm_playlist_top_idx' is -1.
|
||||
wchar_t m_playlist[MAX_SONGS_PER_PAGE][256]; // considered invalid whenever 'm_playlist_top_idx' is -1.
|
||||
int m_exiting;
|
||||
int m_upper_left_corner_y;
|
||||
int m_lower_left_corner_y;
|
||||
int m_upper_right_corner_y;
|
||||
int m_lower_right_corner_y;
|
||||
int m_left_edge;
|
||||
int m_right_edge;
|
||||
int m_force_accept_WM_WINDOWPOSCHANGING;
|
||||
|
||||
// PRIVATE - GDI STUFF
|
||||
HMENU m_main_menu;
|
||||
HMENU m_context_menu;
|
||||
|
||||
// PRIVATE - DESKTOP MODE STUFF
|
||||
//typedef std::list<icon_t> IconList;
|
||||
typedef std::vector<icon_t> IconList;
|
||||
IconList m_icon_list;
|
||||
IDirect3DTexture9* m_desktop_icons_texture[MAX_ICON_TEXTURES];
|
||||
HWND m_hWndProgMan;
|
||||
HWND m_hWndDesktop;
|
||||
HWND m_hWndDesktopListView;
|
||||
char m_szDesktopFolder[MAX_PATH]; // *without* the final backslash
|
||||
int m_desktop_icon_size;
|
||||
int m_desktop_dragging; // '1' when user is dragging icons around
|
||||
int m_desktop_box; // '1' when user is drawing a box
|
||||
BYTE m_desktop_drag_pidl[1024]; // cast this to ITEMIDLIST
|
||||
POINT m_desktop_drag_startpos; // applies to dragging or box-drawing
|
||||
POINT m_desktop_drag_curpos; // applies to dragging or box-drawing
|
||||
int m_desktop_wc_registered;
|
||||
DWORD m_desktop_bk_color;
|
||||
DWORD m_desktop_text_color;
|
||||
DWORD m_desktop_sel_color;
|
||||
DWORD m_desktop_sel_text_color;
|
||||
int m_desktop_icon_state; // 0=uninit, 1=total refresh in progress, 2=ready, 3=update in progress
|
||||
int m_desktop_icon_count;
|
||||
int m_desktop_icon_update_frame;
|
||||
CRITICAL_SECTION m_desktop_cs;
|
||||
int m_desktop_icons_disabled;
|
||||
int m_vms_desktop_loaded;
|
||||
int m_desktop_hook_set;
|
||||
bool m_bClearVJWindow;
|
||||
|
||||
// PRIVATE - MORE TIMEKEEPING
|
||||
protected:
|
||||
double m_last_raw_time;
|
||||
LARGE_INTEGER m_high_perf_timer_freq; // 0 if high-precision timer not available
|
||||
private:
|
||||
float m_time_hist[TIME_HIST_SLOTS]; // cumulative
|
||||
int m_time_hist_pos;
|
||||
LARGE_INTEGER m_prev_end_of_frame;
|
||||
|
||||
// PRIVATE AUDIO PROCESSING DATA
|
||||
FFT m_fftobj;
|
||||
float m_oldwave[2][576]; // for wave alignment
|
||||
int m_prev_align_offset[2]; // for wave alignment
|
||||
int m_align_weights_ready;
|
||||
|
||||
public:
|
||||
CPluginShell();
|
||||
~CPluginShell();
|
||||
|
||||
// called by vis.cpp, on behalf of Winamp:
|
||||
int PluginPreInitialize(HWND hWinampWnd, HINSTANCE hWinampInstance);
|
||||
int PluginInitialize();
|
||||
int PluginRender(unsigned char *pWaveL, unsigned char *pWaveR);
|
||||
void PluginQuit();
|
||||
|
||||
void ToggleHelp();
|
||||
void TogglePlaylist();
|
||||
|
||||
void READ_FONT(int n);
|
||||
void WRITE_FONT(int n);
|
||||
|
||||
// config panel / windows messaging processes:
|
||||
static LRESULT CALLBACK WindowProc(HWND hWnd, unsigned uMsg, WPARAM wParam, LPARAM lParam);
|
||||
static LRESULT CALLBACK DesktopWndProc(HWND hWnd, unsigned uMsg, WPARAM wParam, LPARAM lParam);
|
||||
static LRESULT CALLBACK VJModeWndProc(HWND hWnd, unsigned uMsg, WPARAM wParam, LPARAM lParam);
|
||||
static INT_PTR CALLBACK ConfigDialogProc(HWND hwnd,UINT msg,WPARAM wParam,LPARAM lParam);
|
||||
static INT_PTR CALLBACK TabCtrlProc(HWND hwnd,UINT msg,WPARAM wParam,LPARAM lParam);
|
||||
static INT_PTR CALLBACK FontDialogProc(HWND hwnd,UINT msg,WPARAM wParam,LPARAM lParam);
|
||||
static INT_PTR CALLBACK DesktopOptionsDialogProc(HWND hwnd,UINT msg,WPARAM wParam,LPARAM lParam);
|
||||
static INT_PTR CALLBACK DualheadDialogProc(HWND hwnd,UINT msg,WPARAM wParam,LPARAM lParam);
|
||||
|
||||
private:
|
||||
void PushWindowToJustBeforeDesktop(HWND h);
|
||||
void DrawAndDisplay(int redraw);
|
||||
void ReadConfig();
|
||||
void WriteConfig();
|
||||
void DoTime();
|
||||
void AnalyzeNewSound(unsigned char *pWaveL, unsigned char *pWaveR);
|
||||
void AlignWaves();
|
||||
int InitDirectX();
|
||||
void CleanUpDirectX();
|
||||
int InitGDIStuff();
|
||||
void CleanUpGDIStuff();
|
||||
int AllocateDX9Stuff();
|
||||
void CleanUpDX9Stuff(int final_cleanup);
|
||||
int InitNondx9Stuff();
|
||||
void CleanUpNondx9Stuff();
|
||||
int InitVJStuff(RECT* pClientRect=NULL);
|
||||
void CleanUpVJStuff();
|
||||
int AllocateFonts(IDirect3DDevice9 *pDevice);
|
||||
void CleanUpFonts();
|
||||
void AllocateTextSurface();
|
||||
void ToggleDesktop();
|
||||
void OnUserResizeWindow();
|
||||
void OnUserResizeTextWindow();
|
||||
void PrepareFor2DDrawing_B(IDirect3DDevice9 *pDevice, int w, int h);
|
||||
void RenderBuiltInTextMsgs();
|
||||
int GetCanvasMarginX(); // returns the # of pixels that exist on the canvas, on each side, that the user will never see. Mainly here for windowed mode, where sometimes, up to 15 pixels get cropped at edges of the screen.
|
||||
int GetCanvasMarginY(); // returns the # of pixels that exist on the canvas, on each side, that the user will never see. Mainly here for windowed mode, where sometimes, up to 15 pixels get cropped at edges of the screen.
|
||||
public:
|
||||
void ToggleFullScreen();
|
||||
void DrawDarkTranslucentBox(RECT* pr);
|
||||
protected:
|
||||
void RenderPlaylist();
|
||||
void StuffParams(DXCONTEXT_PARAMS *pParams);
|
||||
void EnforceMaxFPS();
|
||||
|
||||
// DESKTOP MODE FUNCTIONS (found in desktop_mode.cpp)
|
||||
int InitDesktopMode();
|
||||
void CleanUpDesktopMode();
|
||||
int CreateDesktopIconTexture(IDirect3DTexture9** ppTex);
|
||||
void DeselectDesktop();
|
||||
void UpdateDesktopBitmaps();
|
||||
int StuffIconBitmaps(int iStartIconIdx, int iTexNum, int *show_msgs);
|
||||
void RenderDesktop();
|
||||
|
||||
// SEPARATE TEXT WINDOW (FOR VJ MODE)
|
||||
int m_vj_mode;
|
||||
int m_hidden_textwnd;
|
||||
int m_resizing_textwnd;
|
||||
protected:
|
||||
HWND m_hTextWnd;
|
||||
private:
|
||||
int m_nTextWndWidth;
|
||||
int m_nTextWndHeight;
|
||||
bool m_bTextWindowClassRegistered;
|
||||
LPDIRECT3D9 m_vjd3d9;
|
||||
LPDIRECT3DDEVICE9 m_vjd3d9_device;
|
||||
//HDC m_memDC; // memory device context
|
||||
//HBITMAP m_memBM, m_oldBM;
|
||||
//HBRUSH m_hBlackBrush;
|
||||
|
||||
// WINDOWPROC FUNCTIONS
|
||||
LRESULT PluginShellWindowProc(HWND hWnd, unsigned uMsg, WPARAM wParam, LPARAM lParam); // in windowproc.cpp
|
||||
LRESULT PluginShellDesktopWndProc(HWND hWnd, unsigned uMsg, WPARAM wParam, LPARAM lParam);
|
||||
LRESULT PluginShellVJModeWndProc(HWND hWnd, unsigned uMsg, WPARAM wParam, LPARAM lParam);
|
||||
|
||||
// CONFIG PANEL FUNCTIONS:
|
||||
BOOL PluginShellConfigDialogProc(HWND hwnd,UINT msg,WPARAM wParam,LPARAM lParam);
|
||||
BOOL PluginShellConfigTab1Proc(HWND hwnd,UINT msg,WPARAM wParam,LPARAM lParam);
|
||||
BOOL PluginShellFontDialogProc(HWND hwnd,UINT msg,WPARAM wParam,LPARAM lParam);
|
||||
BOOL PluginShellDesktopOptionsDialogProc(HWND hwnd,UINT msg,WPARAM wParam,LPARAM lParam);
|
||||
BOOL PluginShellDualheadDialogProc(HWND hwnd,UINT msg,WPARAM wParam,LPARAM lParam);
|
||||
bool InitConfig(HWND hDialogWnd);
|
||||
void EndConfig();
|
||||
void UpdateAdapters(int screenmode);
|
||||
void UpdateFSAdapterDispModes(); // (fullscreen only)
|
||||
void UpdateDispModeMultiSampling(int screenmode);
|
||||
void UpdateMaxFps(int screenmode);
|
||||
int GetCurrentlySelectedAdapter(int screenmode);
|
||||
void SaveDisplayMode();
|
||||
void SaveMultiSamp(int screenmode);
|
||||
void SaveAdapter(int screenmode);
|
||||
void SaveMaxFps(int screenmode);
|
||||
void OnTabChanged(int nNewTab);
|
||||
LPDIRECT3DDEVICE9 GetTextDevice() { return (m_vjd3d9_device) ? m_vjd3d9_device : m_lpDX->m_lpDevice; }
|
||||
|
||||
// CHANGES:
|
||||
friend class CShaderParams;
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,877 @@
|
||||
//{{NO_DEPENDENCIES}}
|
||||
// Microsoft Visual C++ generated include file.
|
||||
// Used by plugin.rc
|
||||
//
|
||||
#define IDS_ABOUT_STRING 1
|
||||
#define IDS_SZ_MENU_NAV_TOOLTIP 2
|
||||
#define ID_DOCS 3
|
||||
#define IDS_UNTITLED_MENU_ITEM 3
|
||||
#define IDLEFT 4
|
||||
#define IDS_UNTITLED_MENU 4
|
||||
#define ID_WEB 5
|
||||
#define IDS_ON 5
|
||||
#define IDRIGHT 6
|
||||
#define IDS_OFF 6
|
||||
#define ID_DEFAULTS 7
|
||||
#define IDS_USE_UP_DOWN_ARROW_KEYS 7
|
||||
#define ID_MSG 8
|
||||
#define IDS_CURRENT_VALUE_OF_X 8
|
||||
#define ID_SPRITE 9
|
||||
#define IDS_LOAD_FROM_FILE 9
|
||||
#define IDS_SAVE_TO_FILE 10
|
||||
#define IDS_ENTER_THE_NEW_STRING 11
|
||||
#define IDS_MILKDROP_ERROR 14
|
||||
#define IDS_MILKDROP_WARNING 19
|
||||
#define IDS_ERROR_CREATING_DOUBLE_SIZED_GDI_TITLE_FONT 20
|
||||
#define IDS_ERROR_CREATING_DOUBLE_SIZED_D3DX_TITLE_FONT 21
|
||||
#define IDS_RATING 23
|
||||
#define IDS_DISABLED 24
|
||||
#define IDS_ARE_YOU_SURE_YOU_WANT_TO_DELETE_PRESET 26
|
||||
#define IDS_PRESET_TO_DELETE 27
|
||||
#define IDS_FILE_ALREADY_EXISTS_OVERWRITE_IT 28
|
||||
#define IDS_FILE_IN_QUESTION_X_MILK 29
|
||||
#define IDS_ERROR_NO_PRESET_FILE_FOUND_IN_X_MILK 30
|
||||
#define IDS_LOAD_WHICH_PRESET_PLUS_COMMANDS 31
|
||||
#define IDS_PAGE_X_OF_X 32
|
||||
#define IDS_LOCKED 33
|
||||
#define IDS_ILLEGAL_CHARACTER 37
|
||||
#define IDS_STRING_TOO_LONG 38
|
||||
#define IDS_DIRECTORY_TO_JUMP_TO 39
|
||||
#define IDS_ERROR_IMPORTING_BAD_FILENAME 40
|
||||
#define IDS_ERROR_IMPORTING_BAD_FILENAME_OR_NOT_OVERWRITEABLE 41
|
||||
#define IDS_INVALID_PATH 42
|
||||
#define IDS_ENTER_THE_NEW_NAME_FOR_X 43
|
||||
#define IDS_PRESET_ORDER_IS_NOW_X 44
|
||||
#define IDS_SEQUENTIAL 45
|
||||
#define IDS_RANDOM 46
|
||||
#define IDS_SAVE_AS 50
|
||||
#define IDS_AUTO 51
|
||||
#define IDS_8X6_FAST 52
|
||||
#define IDS_16X12_FAST 53
|
||||
#define IDS_24X18 54
|
||||
#define IDS_32X24 55
|
||||
#define IDS_40X30 56
|
||||
#define IDS_48X36_DEFAULT 57
|
||||
#define IDS_64X48_SLOW 58
|
||||
#define IDS_80X60_SLOW 59
|
||||
#define IDS_96X72_SLOW 60
|
||||
#define IDS_128X96_SLOW 61
|
||||
#define IDS_ERROR_IN_SHELLEXECUTE 62
|
||||
#define IDS_MESH_SIZE 65
|
||||
#define IDS_MESH_SIZE_TEXT 66
|
||||
#define IDS_CB_ALWAYS3D 67
|
||||
#define IDS_DISABLE_PRESET_RATING 70
|
||||
#define IDS_DISABLE_PRESET_RATING_TEXT 71
|
||||
#define IDS_CB_NOWARN2 73
|
||||
#define IDS_START_WITH_PRESET_LOCK_ON 76
|
||||
#define IDS_START_WITH_PRESET_LOCK_ON_TEXT 77
|
||||
#define IDS_BRIGHT_SLIDER 78
|
||||
#define IDS_CB_AUTOGAMMA 79
|
||||
#define IDS_SPRITE 80
|
||||
#define IDS_MSG 81
|
||||
#define IDS_SONGTITLEANIM_DURATION_TEXT 86
|
||||
#define IDS_RAND_TITLE_TEXT 87
|
||||
#define IDS_RAND_MSG_TEXT 88
|
||||
#define IDS_TITLE_ANIMS_TEXT 89
|
||||
#define IDS_BETWEEN_TIME_TEXT 90
|
||||
#define IDS_BETWEEN_TIME_RANDOM_TEXT 91
|
||||
#define IDS_BLEND_AUTO_TEXT 92
|
||||
#define IDS_BLEND_USER_TEXT 93
|
||||
#define IDS_HARDCUT_BETWEEN_TIME_TEXT 94
|
||||
#define IDS_HARDCUT_LOUDNESS_TEXT 95
|
||||
#define IDS_CB_HARDCUTS 96
|
||||
#define IDS_EDIT_CURRENT_PRESET 98
|
||||
#define IDS_MOTION 99
|
||||
#define IDS_DRAWING_CUSTOM_SHAPES 100
|
||||
#define IDD_DIALOG1 101
|
||||
#define IDD_CONFIG 101
|
||||
#define IDS_DRAWING_CUSTOM_WAVES 101
|
||||
#define IDD_PROPPAGE_1 102
|
||||
#define IDS_DRAWING_SIMPLE_WAVEFORM 102
|
||||
#define IDD_PROPPAGE_2 103
|
||||
#define IDS_DRAWING_BORDERS_MOTION_VECTORS 103
|
||||
#define IDS_POST_PROCESSING_MISC 104
|
||||
#define IDS_CUSTOM_WAVE_X 105
|
||||
#define IDS_CUSTOM_SHAPE_X 106
|
||||
#define IDS_MENU_EDIT_PRESET_INIT_CODE 107
|
||||
#define IDS_MENU_EDIT_PRESET_INIT_CODE_TT 108
|
||||
#define IDS_MENU_EDIT_PER_FRAME_EQUATIONS 109
|
||||
#define IDR_WINDOWED_CONTEXT_MENU 110
|
||||
#define IDS_MENU_EDIT_PER_FRAME_EQUATIONS_TT 110
|
||||
#define IDS_MENU_WAVE_TYPE 113
|
||||
#define IDD_PROPPAGE_3 114
|
||||
#define IDS_MENU_WAVE_TYPE_TT 114
|
||||
#define IDD_PROPPAGE_4 115
|
||||
#define IDS_MENU_SIZE 115
|
||||
#define IDD_PROPPAGE_5 116
|
||||
#define IDS_MENU_SIZE_TT 116
|
||||
#define IDD_PROPPAGE_6 117
|
||||
#define IDS_MENU_SMOOTH 117
|
||||
#define IDD_PROPPAGE_7 118
|
||||
#define IDS_MENU_SMOOTH_TT 118
|
||||
#define IDD_PROPPAGE_8 119
|
||||
#define IDS_MENU_MYSTERY_PARAMETER 119
|
||||
#define IDI_PLUGIN_ICON 120
|
||||
#define IDS_MENU_MYSTERY_PARAMETER_TT 120
|
||||
#define IDD_FONTDIALOG 121
|
||||
#define IDS_MENU_POSITION_X 121
|
||||
#define IDD_DESKTOPMODE 122
|
||||
#define IDS_MENU_POSITION_X_TT 122
|
||||
#define IDD_DUALHEAD 123
|
||||
#define IDS_MENU_POSITION_Y 123
|
||||
#define IDS_MENU_POSITION_Y_TT 124
|
||||
#define IDS_MENU_COLOR_RED 125
|
||||
#define IDS_MENU_COLOR_RED_TT 126
|
||||
#define IDS_MENU_COLOR_GREEN 127
|
||||
#define IDS_MENU_COLOR_GREEN_TT 128
|
||||
#define IDR_TEXT1 129
|
||||
#define IDS_MENU_COLOR_BLUE 129
|
||||
#define IDR_TEXT2 130
|
||||
#define IDS_MENU_COLOR_BLUE_TT 130
|
||||
#define IDS_MENU_OPACITY 131
|
||||
#define IDS_MENU_OPACITY_TT 132
|
||||
#define IDS_MENU_USE_DOTS 133
|
||||
#define IDS_MENU_USE_DOTS_TT 134
|
||||
#define IDS_MENU_DRAW_THICK 135
|
||||
#define IDS_MENU_DRAW_THICK_TT 136
|
||||
#define IDS_MENU_MODULATE_OPACITY_BY_VOLUME 137
|
||||
#define IDS_MENU_MODULATE_OPACITY_BY_VOLUME_TT 138
|
||||
#define IDS_MENU_MODULATION_TRANSPARENT_VOLUME 139
|
||||
#define IDS_MENU_MODULATION_TRANSPARENT_VOLUME_TT 140
|
||||
#define IDS_MENU_MODULATION_OPAQUE_VOLUME 141
|
||||
#define IDS_MENU_MODULATION_OPAQUE_VOLUME_TT 142
|
||||
#define IDS_MENU_ADDITIVE_DRAWING 143
|
||||
#define IDS_MENU_ADDITIVE_DRAWING_TT 144
|
||||
#define IDS_MENU_COLOR_BRIGHTENING 145
|
||||
#define IDS_MENU_COLOR_BRIGHTENING_TT 146
|
||||
#define IDS_MENU_OUTER_BORDER_THICKNESS 147
|
||||
#define IDS_MENU_OUTER_BORDER_THICKNESS_TT 148
|
||||
#define IDS_MENU_COLOR_RED_OUTER 149
|
||||
#define IDS_MENU_COLOR_RED_OUTER_TT 150
|
||||
#define IDS_MENU_COLOR_GREEN_OUTER 151
|
||||
#define IDS_MENU_COLOR_GREEN_OUTER_TT 152
|
||||
#define IDS_MENU_COLOR_BLUE_OUTER 153
|
||||
#define IDS_MENU_COLOR_BLUE_OUTER_TT 154
|
||||
#define IDS_MENU_OPACITY_OUTER 155
|
||||
#define IDS_MENU_OPACITY_OUTER_TT 156
|
||||
#define IDS_MENU_INNER_BORDER_THICKNESS 157
|
||||
#define IDS_MENU_INNER_BORDER_THICKNESS_TT 160
|
||||
#define IDS_MENU_COLOR_RED_INNER_TT 161
|
||||
#define IDS_MENU_COLOR_GREEN_INNER_TT 162
|
||||
#define IDS_MENU_COLOR_BLUE_INNER_TT 163
|
||||
#define IDS_MENU_OPACITY_INNER_TT 164
|
||||
#define IDS_MENU_MOTION_VECTOR_OPACITY 165
|
||||
#define IDS_MENU_MOTION_VECTOR_OPACITY_TT 167
|
||||
#define IDS_MENU_NUM_MOT_VECTORS_X 168
|
||||
#define IDS_MENU_NUM_MOT_VECTORS_X_TT 169
|
||||
#define IDS_MENU_NUM_MOT_VECTORS_Y 170
|
||||
#define IDS_MENU_NUM_MOT_VECTORS_Y_TT 171
|
||||
#define IDS_MENU_OFFSET_X 172
|
||||
#define IDS_MENU_OFFSET_X_TT 173
|
||||
#define IDS_MENU_OFFSET_Y 174
|
||||
#define IDS_MENU_OFFSET_Y_TT 175
|
||||
#define IDS_MENU_TRAIL_LENGTH 176
|
||||
#define IDS_MENU_TRAIL_LENGTH_TT 177
|
||||
#define IDS_MENU_COLOR_RED_MOTION_VECTOR_TT 178
|
||||
#define IDS_MENU_COLOR_GREEN_MOTION_VECTOR_TT 179
|
||||
#define IDS_MENU_COLOR_BLUE_MOTION_VECTOR_TT 180
|
||||
#define IDS_MENU_ZOOM_AMOUNT 181
|
||||
#define IDS_MENU_ZOOM_AMOUNT_TT 182
|
||||
#define IDS_MENU_ZOOM_EXPONENT 183
|
||||
#define IDS_MENU_ZOOM_EXPONENT_TT 184
|
||||
#define IDS_MENU_WARP_AMOUNT 185
|
||||
#define IDS_MENU_WARP_AMOUNT_TT 186
|
||||
#define IDS_MENU_WARP_SCALE 187
|
||||
#define IDS_MENU_WARP_SCALE_TT 188
|
||||
#define IDS_MENU_WARP_SPEED 189
|
||||
#define IDS_MENU_WARP_SPEED_TT 190
|
||||
#define IDS_MENU_ROTATION_AMOUNT 191
|
||||
#define IDS_MENU_ROTATION_AMOUNT_TT 192
|
||||
#define IDS_MENU_ROTATION_CENTER_OF_X 193
|
||||
#define IDS_MENU_ROTATION_CENTER_OF_X_TT 194
|
||||
#define IDS_MENU_ROTATION_CENTER_OF_Y 195
|
||||
#define IDS_MENU_ROTATION_CENTER_OF_Y_TT 196
|
||||
#define IDS_MENU_TRANSLATION_X 197
|
||||
#define IDS_MENU_TRANSLATION_X_TT 198
|
||||
#define IDS_MENU_TRANSLATION_Y 199
|
||||
#define IDS_MENU_TRANSLATION_Y_TT 200
|
||||
#define IDS_MENU_SCALING_X 201
|
||||
#define IDS_MENU_SCALING_X_TT 202
|
||||
#define IDS_MENU_SCALING_Y 203
|
||||
#define IDS_MENU_SCALING_Y_TT 204
|
||||
#define IDS_MENU_SUSTAIN_LEVEL 205
|
||||
#define IDS_MENU_SUSTAIN_LEVEL_TT 206
|
||||
#define IDS_MENU_DARKEN_CENTER 207
|
||||
#define IDS_MENU_DARKEN_CENTER_TT 208
|
||||
#define IDS_MENU_GAMMA_ADJUSTMENT 209
|
||||
#define IDS_MENU_GAMMA_ADJUSTMENT_TT 210
|
||||
#define IDS_MENU_HUE_SHADER 211
|
||||
#define IDS_MENU_HUE_SHADER_TT 212
|
||||
#define IDS_MENU_VIDEO_ECHO_ALPHA 213
|
||||
#define IDS_MENU_VIDEO_ECHO_ALPHA_TT 214
|
||||
#define IDS_MENU_VIDEO_ECHO_ZOOM 215
|
||||
#define IDS_MENU_VIDEO_ECHO_ZOOM_TT 216
|
||||
#define IDS_MENU_VIDEO_ECHO_ORIENTATION 217
|
||||
#define IDS_MENU_VIDEO_ECHO_ORIENTATION_TT 218
|
||||
#define IDS_MENU_TEXTURE_WRAP 219
|
||||
#define IDS_MENU_TEXTURE_WRAP_TT 220
|
||||
#define IDS_MENU_FILTER_INVERT 223
|
||||
#define IDS_MENU_FILTER_INVERT_TT 224
|
||||
#define IDS_MENU_FILTER_BRIGHTEN 225
|
||||
#define IDS_MENU_FILTER_BRIGHTEN_TT 226
|
||||
#define IDS_MENU_FILTER_DARKEN 227
|
||||
#define IDS_MENU_FILTER_DARKEN_TT 228
|
||||
#define IDS_MENU_FILTER_SOLARIZE 229
|
||||
#define IDS_MENU_FILTER_SOLARIZE_TT 230
|
||||
#define IDS_MENU_ENABLED 231
|
||||
#define IDS_MENU_ENABLED_TT 232
|
||||
#define IDS_MENU_NUMBER_OF_SAMPLES 233
|
||||
#define IDS_MENU_NUMBER_OF_SAMPLES_TT 234
|
||||
#define IDS_MENU_L_R_SEPARATION 235
|
||||
#define IDS_MENU_L_R_SEPARATION_TT 236
|
||||
#define IDS_MENU_SCALING 237
|
||||
#define IDS_MENU_SCALING_TT 238
|
||||
#define IDS_MENU_SMOOTHING_TT 239
|
||||
#define IDS_MENU_OPACITY_WAVE_TT 240
|
||||
#define IDS_MENU_USE_SPECTRUM 241
|
||||
#define IDS_MENU_USE_SPECTRUM_TT 242
|
||||
#define IDS_MENU_USE_DOTS_WAVE_TT 243
|
||||
#define IDS_MENU_DRAW_THICK_WAVE_TT 244
|
||||
#define IDS_MENU_ADDITIVE_DRAWING_WAVE_TT 245
|
||||
#define IDS_MENU_EXPORT_TO_FILE 246
|
||||
#define IDS_MENU_EXPORT_TO_FILE_TT 247
|
||||
#define IDS_MENU_IMPORT_FROM_FILE 248
|
||||
#define IDS_MENU_IMPORT_FROM_FILE_TT 249
|
||||
#define IDS_MENU_EDIT_INIT_CODE 250
|
||||
#define IDS_MENU_EDIT_INIT_CODE_TT 251
|
||||
#define IDS_MENU_EDIT_PER_FRAME_CODE 252
|
||||
#define IDS_MENU_EDIT_PER_FRAME_CODE_TT 253
|
||||
#define IDS_MENU_EDIT_PER_POINT_CODE 254
|
||||
#define IDS_MENU_EDIT_PER_POINT_CODE_TT 255
|
||||
#define IDS_MENU_ENABLED_SHAPE_TT 256
|
||||
#define IDS_MENU_NUMBER_OF_SIDES 257
|
||||
#define IDS_MENU_NUMBER_OF_SIDES_TT 258
|
||||
#define IDS_MENU_DRAW_THICK_SHAPE_TT 259
|
||||
#define IDS_MENU_ADDITIVE_DRAWING_SHAPE_TT 260
|
||||
#define IDS_MENU_X_POSITION 261
|
||||
#define IDS_MENU_X_POSITION_TT 262
|
||||
#define IDS_MENU_Y_POSITION 263
|
||||
#define IDS_MENU_Y_POSITION_TT 264
|
||||
#define IDS_MENU_RADIUS 265
|
||||
#define IDS_MENU_RADIUS_TT 266
|
||||
#define IDS_MENU_ANGLE 267
|
||||
#define IDS_MENU_ANGLE_TT 268
|
||||
#define IDS_MENU_TEXTURED 269
|
||||
#define IDS_MENU_TEXTURED_TT 270
|
||||
#define IDS_MENU_TEXTURE_ZOOM 271
|
||||
#define IDS_MENU_TEXTURE_ZOOM_TT 272
|
||||
#define IDS_MENU_TEXTURE_ANGLE 273
|
||||
#define IDS_MENU_TEXTURE_ANGLE_TT 274
|
||||
#define IDS_MENU_INNER_COLOR_RED 275
|
||||
#define IDS_MENU_INNER_COLOR_RED_TT 276
|
||||
#define IDS_MENU_INNER_COLOR_GREEN 277
|
||||
#define IDS_MENU_INNER_COLOR_GREEN_TT 278
|
||||
#define IDS_MENU_INNER_COLOR_BLUE 279
|
||||
#define IDS_MENU_INNER_COLOR_BLUE_TT 280
|
||||
#define IDS_MENU_INNER_OPACITY 281
|
||||
#define IDS_MENU_INNER_OPACITY_TT 282
|
||||
#define IDS_MENU_OUTER_COLOR_RED 283
|
||||
#define IDS_MENU_OUTER_COLOR_RED_TT 284
|
||||
#define IDS_MENU_OUTER_COLOR_GREEN 285
|
||||
#define IDS_MENU_OUTER_COLOR_GREEN_TT 286
|
||||
#define IDS_MENU_OUTER_COLOR_BLUE 287
|
||||
#define IDS_MENU_OUTER_COLOR_BLUE_TT 288
|
||||
#define IDS_MENU_OUTER_OPACITY 289
|
||||
#define IDS_MENU_OUTER_OPACITY_TT 290
|
||||
#define IDS_MENU_BORDER_COLOR_RED 291
|
||||
#define IDS_MENU_BORDER_COLOR_RED_TT 292
|
||||
#define IDS_MENU_BORDER_COLOR_GREEN 293
|
||||
#define IDS_MENU_BORDER_COLOR_GREEN_TT 294
|
||||
#define IDS_MENU_BORDER_COLOR_BLUE 295
|
||||
#define IDS_MENU_BORDER_COLOR_BLUE_TT 296
|
||||
#define IDS_MENU_BORDER_OPACITY 297
|
||||
#define IDS_MENU_BORDER_OPACITY_TT 298
|
||||
#define IDS_MENU_EXPORT_TO_FILE_SHAPE_TT 299
|
||||
#define IDS_MENU_IMPORT_FROM_FILE_SHAPE_TT 300
|
||||
#define IDS_ERROR_UNABLE_TO_SAVE_THE_FILE 303
|
||||
#define IDS_SAVE_SUCCESSFUL 304
|
||||
#define IDS_ERROR_UNABLE_TO_DELETE_THE_FILE 305
|
||||
#define IDS_PRESET_X_DELETED 306
|
||||
#define IDS_ERROR_A_FILE_ALREADY_EXISTS_WITH_THAT_FILENAME 307
|
||||
#define IDS_ERROR_UNABLE_TO_RENAME_FILE 308
|
||||
#define IDS_RENAME_SUCCESSFUL 309
|
||||
#define IDS_SPRITE_X_WARNING_ERROR_IN_INIT_CODE 310
|
||||
#define IDS_SPRITE_X_WARNING_ERROR_IN_PER_FRAME_CODE 311
|
||||
#define IDS_SPRITE_X_ERROR_BAD_SLOT_INDEX 312
|
||||
#define IDS_SPRITE_X_ERROR_IMAGE_FILE_MISSING_OR_CORRUPT 313
|
||||
#define IDS_SPRITE_X_ERROR_OUT_OF_MEM 314
|
||||
#define IDS_WARNING_PRESET_X_ERROR_IN_WAVE_X_INIT_CODE 319
|
||||
#define IDS_WARNING_PRESET_X_ERROR_IN_WAVE_X_PER_FRAME_CODE 320
|
||||
#define IDS_WARNING_PRESET_X_ERROR_IN_WAVE_X_PER_POINT_CODE 321
|
||||
#define IDS_WARNING_PRESET_X_ERROR_IN_SHAPE_X_INIT_CODE 322
|
||||
#define IDS_WARNING_PRESET_X_ERROR_IN_SHAPE_X_PER_FRAME_CODE 323
|
||||
#define IDS_CONFIG_PANEL_BUTTON_1 324
|
||||
#define IDS_CONFIG_PANEL_BUTTON_2 325
|
||||
#define IDS_CONFIG_PANEL_BUTTON_3 326
|
||||
#define IDS_CONFIG_PANEL_BUTTON_4 327
|
||||
#define IDS_CONFIG_PANEL_BUTTON_5 328
|
||||
#define IDS_CONFIG_PANEL_BUTTON_6 329
|
||||
#define IDS_CONFIG_PANEL_BUTTON_7 330
|
||||
#define IDS_CONFIG_PANEL_BUTTON_8 331
|
||||
#define IDS_EXTRA_FONT_1_NAME 332
|
||||
#define IDS_EXTRA_FONT_2_NAME 333
|
||||
#define IDS_PRESS_F1_MSG 334
|
||||
#define IDS_GRAPHICS_SUBSYSTEM_IS_TEMPORARILY_UNSTABLE 335
|
||||
#define IDS_UNKNOWN 336
|
||||
#define IDS_DISABLED_PAGE_TEARING 337
|
||||
#define IDS_NONE 338
|
||||
#define IDS_UNLIMITED 339
|
||||
#define IDS_X_FRAME_SEC 340
|
||||
#define IDS_HELP_ON_X_BUTTON 341
|
||||
#define IDS_FONTS_HELP 342
|
||||
#define IDS_DUAL_HEAD_HELP 343
|
||||
#define IDS_MULTI_SAMPLING 344
|
||||
#define IDS_MULTI_SAMPLING_HELP 345
|
||||
#define IDS_MAX_FRAMERATE 346
|
||||
#define IDS_MAX_FRAMERATE_HELP 347
|
||||
#define IDS_FAKE_FULLSCREEN 348
|
||||
#define IDS_FAKE_FULLSCREEN_HELP 349
|
||||
#define IDS_FULLSCREEN_ADAPTER 350
|
||||
#define IDS_FULLSCREEN_ADAPTER_HELP 351
|
||||
#define IDS_WINDOWED_ADPATER 352
|
||||
#define IDS_WINDOWED_ADPATER_HELP 353
|
||||
#define IDS_DESKTOP_ADAPTER 354
|
||||
#define IDS_DESKTOP_ADAPTER_HELP 355
|
||||
#define IDS_HELP_ON_X_CHECKBOX 356
|
||||
#define IDS_HELP_ON_X_CHECKBOX_HELP 357
|
||||
#define IDS_FORCE_INTO_FS_MODE_HELP 358
|
||||
#define IDS_FORCE_INTO_DESKTOP_MODE_HELP 359
|
||||
#define IDS_HELP_ON_F1 360
|
||||
#define IDS_HELP_ON_F1_HELP 361
|
||||
#define IDS_CB_SKIN_HELP 362
|
||||
#define IDS_SAVE_CPU_CHECKBOX 363
|
||||
#define IDS_SAVE_CPU_CHECKBOX_HELP 364
|
||||
#define IDS_FS_DISPLAY_MODE 365
|
||||
#define IDS_FS_DISPLAY_MODE_HELP 366
|
||||
#define IDS_TRY_TO_FIX_SLOW_TEXT 369
|
||||
#define IDS_TRY_TO_FIX_SLOW_TEXT_HELP 370
|
||||
#define IDS_VJ_MODE 371
|
||||
#define IDS_VJ_MODE_HELP 372
|
||||
#define IDS_HELP_ON_X 373
|
||||
#define IDS_DMS_LABEL_HELP 374
|
||||
#define IDS_FS_LABEL_HELP 375
|
||||
#define IDS_W_LABEL_HELP 376
|
||||
#define IDS_DM_MORE_HELP 377
|
||||
#define IDS_INITCONFIG_FAILED 378
|
||||
#define IDS_UNABLE_TO_LOAD_TABS 379
|
||||
#define IDS_DOCUMENTATION_FILE_NOT_FOUND 380
|
||||
#define IDS_ACCESS_TO_DOCUMENTATION_FILE_DENIED 381
|
||||
#define IDS_ACCESS_TO_DOCUMENTATION_FILE_FAILED_DUE_TO_NO_ASSOC 382
|
||||
#define IDS_ACCESS_TO_DOCUMENTATION_FILE_FAILED_CODE_X 383
|
||||
#define IDS_ERROR_OPENING_DOCUMENTATION 384
|
||||
#define IDS_URL_COULD_NOT_OPEN 385
|
||||
#define IDS_ACCESS_TO_URL_WAS_DENIED 386
|
||||
#define IDS_ACCESS_TO_URL_FAILED_DUE_TO_NO_ASSOC 387
|
||||
#define IDS_ACCESS_TO_URL_FAILED_CODE_X 388
|
||||
#define IDS_ERROR_OPENING_URL 389
|
||||
#define IDS_RESTORE_ALL_DEFAULTS 390
|
||||
#define IDS_RESTORE_ALL_DEFAULTS_TITLE 391
|
||||
#define IDS_OK_HELP 392
|
||||
#define IDS_CANCEL_HELP 393
|
||||
#define IDS_RESTORE_DEFAULTS_HELP 394
|
||||
#define IDS_DOCUMENTATION_BUTTON_HELP 395
|
||||
#define IDS_VIEW_ONLINE_DOCS_HELP 396
|
||||
#define IDS_5_6_5_TEXTURE 397
|
||||
#define IDS_5_5_5_TEXTURE 398
|
||||
#define IDS_8_8_8_TEXTURE 399
|
||||
#define IDS_NO_ALPHA_FALLBACK 400
|
||||
#define IDS_NO_ALPHA_FALLBACK_HELP 401
|
||||
#define IDS_CB_SHOW_ICONS_HELP 402
|
||||
#define IDS_CB_BOX 403
|
||||
#define IDS_CB_BOX_HELP 404
|
||||
#define IDS_CB_MANUAL_SCOOT 405
|
||||
#define IDS_CB_MANUAL_SCOOT_HELP 406
|
||||
#define IDS_SPAN_BOTH_SCREENS 407
|
||||
#define IDS_USE_LEFT_SCREEN_ONLY 408
|
||||
#define IDS_USE_RIGHT_SCREEN_ONLY 409
|
||||
#define IDS_USE_TOP_SCREEN_ONLY 410
|
||||
#define IDS_USE_BOTTOM_SCREEN_ONLY 411
|
||||
#define IDS_COULD_NOT_FIND_FILE_FOR_DESKTOP_MODE_X 412
|
||||
#define IDS_MILKDROP_ERROR_FILE_MISSING 413
|
||||
#define IDS_ERROR_CREATING_GDI_DESKTOP_FONT 414
|
||||
#define IDS_ERROR_CREATING_DESKTOP_FONT 415
|
||||
#define IDS_ERROR_CREATING_TEXTURE_FOR_ICON_BITMAPS 416
|
||||
#define IDS_OUTDATED_VMS_DESKTOP_DLL_NEED_TO_REINSTALL 417
|
||||
#define IDS_ERROR_CREATING_HOOK_PROC_DESKTOP_ICONS_NOT_AVAILABLE 418
|
||||
#define IDS_ERROR_UPDATING_ICON_BITMAPS 419
|
||||
#define IDS_ERROR_UPDATING_ICON_BITMAPS_TOO_MANY_UNIQUE_ICON_BITMAPS 420
|
||||
#define IDS_ERROR_UPDATING_ICON_BITMAPS_COULD_NOT_GET_LEVEL_DESCRIPTION 421
|
||||
#define IDS_ERROR_UPDATING_ICON_BITMAPS_LOCKRECT_FAILED 422
|
||||
#define IDS_ERROR_UPDATING_ICON_BITMAPS_LR_PBITS_IS_NULL 423
|
||||
#define IDS_ERROR_UPDATING_ICON_BITMAPS_UNKNOWN_PIXEL_FORMAT 424
|
||||
#define IDS_ERROR_UPDATING_ICON_BITMAPS_COULDNT_GET_HDC 425
|
||||
#define IDS_ERROR_UPDATING_ICON_BITMAPS_CALL_TO_GETDIBITS_FAILED 426
|
||||
#define IDS_ERROR_UPDATING_ICON_BITMAPS_CALL_2_TO_GETDIBITS_FAILED 427
|
||||
#define IDS_ERROR_UPDATING_ICON_BITMAPS_GETICONINFO_FAILED 428
|
||||
#define IDS_ERROR_UPDATING_ICON_BITMAPS_SHGETFILEINFO_FAILED 429
|
||||
#define IDS_UNABLE_TO_REGISTER_WINDOW_CLASS 430
|
||||
#define IDS_DIRECTX_INIT_FAILED 431
|
||||
#define IDS_DXC_ERR_CAPSFAIL 432
|
||||
#define IDS_FS_DISPLAY_MODE_SELECTED_IS_INVALID 433
|
||||
#define IDS_CREATEWINDOW_FAILED 434
|
||||
#define IDS_TRYING_TO_ENTER_FS_MODE_WITH_MULTIPLE_DISPLAYS 435
|
||||
#define IDS_TIP 436
|
||||
#define IDS_TRYING_TO_ENTER_FS_MODE_WITH_MULTIPLE_DISPLAYS_2 437
|
||||
#define IDS_UNABLE_TO_CREATE_DIRECTX_DEVICE 438
|
||||
#define IDS_OLDER_DISPLAY_ADAPTER_CATENATION 439
|
||||
#define IDS_OLDER_DISPLAY_ADAPTER_CATENATION_2 440
|
||||
#define IDS_DIRECTX_INIT_FAILED_X 441
|
||||
#define IDS_WINDOW_RESIZE_FAILED 442
|
||||
#define IDS_OUT_OF_VIDEO_MEMORY 443
|
||||
#define IDS_ERROR_CREATING_GDI_FONTS 444
|
||||
#define IDS_ERROR_LOADING_MAIN_MENU 445
|
||||
#define IDS_ERROR_LOADING_CONTEXT_MENU 446
|
||||
#define IDS_ERROR_CREATING_DIRECT3D_DEVICE_FOR_VJ_MODE 447
|
||||
#define IDS_VJ_MODE_INIT_ERROR 448
|
||||
#define IDS_ERROR_REGISTERING_WINDOW_CLASS_FOR_TEXT_WINDOW 449
|
||||
#define IDS_ERROR_CREATING_VJ_WINDOW 450
|
||||
#define IDS_ERROR_CREATING_D3D_DEVICE_FOR_VJ_MODE 451
|
||||
#define IDS_ERROR_CREATING_D3DX_FONTS 452
|
||||
#define IDS_UNABLE_TO_INIT_DXCONTEXT 453
|
||||
#define IDS_TO_FREE_UP_SOME_MEMORY_RESTART_WINAMP_THEN_GO_TO_CONFIG 454
|
||||
#define IDS_TO_FREE_UP_SOME_MEMORY_RESTART_WINAMP_THEN_GO_TO_CONFIG_2 455
|
||||
#define IDS_TO_FREE_UP_SOME_MEMORY_RESTART_WINAMP_THEN_GO_TO_CONFIG_3 456
|
||||
#define IDS_TO_FREE_UP_VIDEO_MEMORY 457
|
||||
#define IDS_TO_FREE_UP_VIDEO_MEMORY_2 458
|
||||
#define IDS_MILKDROP_SUGGESTION 459
|
||||
#define IDS_DIRECTX_MISSING_OR_CORRUPT 460
|
||||
#define IDS_ERROR_THE_PLUGIN_IS_ALREADY_RUNNING 463
|
||||
#define IDS_THIS_PLUGIN_NEEDS_MUSIC_TO_RUN 464
|
||||
#define IDS_NO_MUSIC_PLAYING 465
|
||||
#define IDS_UNABLE_TO_READ_DATA_FILE_X 466
|
||||
#define IDS_COULD_NOT_CREATE_MY_VERTEX_DECLARATION 467
|
||||
#define IDS_COULD_NOT_CREATE_WF_VERTEX_DECLARATION 468
|
||||
#define IDS_COULD_NOT_CREATE_SPRITE_VERTEX_DECLARATION 469
|
||||
#define IDS_SHADER_MODEL_2 470
|
||||
#define IDS_SHADER_MODEL_3 471
|
||||
#define IDS_SHADER_MODEL_4 472
|
||||
#define IDS_UKNOWN_CASE_X 473
|
||||
#define IDS_FAILED_TO_COMPILE_PIXEL_SHADERS_USING_X 474
|
||||
#define IDS_FAILED_TO_COMPILE_PIXEL_SHADERS_HARDWARE_MIS_REPORT 475
|
||||
#define IDS_COULD_NOT_COMPILE_FALLBACK_WV_SHADER 476
|
||||
#define IDS_COULD_NOT_COMPILE_FALLBACK_CV_SHADER 477
|
||||
#define IDS_COULD_NOT_COMPILE_FALLBACK_CP_SHADER 478
|
||||
#define IDS_COULD_NOT_COMPILE_BLUR1_VERTEX_SHADER 479
|
||||
#define IDS_COULD_NOT_COMPILE_BLUR1_PIXEL_SHADER 480
|
||||
#define IDS_COULD_NOT_COMPILE_BLUR2_VERTEX_SHADER 481
|
||||
#define IDS_COULD_NOT_COMPILE_BLUR2_PIXEL_SHADER 482
|
||||
#define IDS_COULD_NOT_CREATE_INTERNAL_CANVAS_TEXTURE_SMALLER_DISPLAY 483
|
||||
#define IDS_COULD_NOT_CREATE_INTERNAL_CANVAS_TEXTURE_NOT_ENOUGH_VID_MEM_RECOMMENDATION 484
|
||||
#define IDS_COULD_NOT_CREATE_INTERNAL_CANVAS_TEXTURE_NOT_ENOUGH_VID_MEM 485
|
||||
#define IDS_SUCCESSFULLY_CREATED_VS0_VS1 486
|
||||
#define IDS_ERROR_CREATING_BLUR_TEXTURES 487
|
||||
#define IDS_COULD_NOT_CREATE_NOISE_TEXTURE 488
|
||||
#define IDS_COULD_NOT_LOCK_NOISE_TEXTURE 489
|
||||
#define IDS_NOISE_TEXTURE_BYTE_LAYOUT_NOT_RECOGNISED 490
|
||||
#define IDS_COULD_NOT_CREATE_3D_NOISE_TEXTURE 491
|
||||
#define IDS_COULD_NOT_LOCK_3D_NOISE_TEXTURE 492
|
||||
#define IDS_3D_NOISE_TEXTURE_BYTE_LAYOUT_NOT_RECOGNISED 493
|
||||
#define IDS_ERROR_CREATING_SHADER 498
|
||||
#define IDS_PLEASE_EXIT_VIS_BEFORE_RUNNING_CONFIG_PANEL 499
|
||||
#define IDS_FPS 500
|
||||
#define IDS_PF_MONITOR 501
|
||||
#define IDS_PRESS_F9_TO_HIDE_SHADER_QREF 502
|
||||
#define IDS_PRESS_F9_TO_SHOW_SHADER_QREF 503
|
||||
#define IDS_WARP_AND_COMPOSITE_SHADERS_LOCKED 504
|
||||
#define IDS_WARP_SHADER_LOCKED 505
|
||||
#define IDS_COMPOSITE_SHADER_LOCKED 506
|
||||
#define IDS_PRESET_USES_HIGHEST_PIXEL_SHADER_VERSION 507
|
||||
#define IDS_PRESET_HAS_MIXED_VERSIONS_OF_SHADERS 508
|
||||
#define IDS_UPGRADE_SHADERS_TO_USE_PS2 509
|
||||
#define IDS_UPGRADE_SHADERS_TO_USE_PS3 510
|
||||
#define IDS_PRESET_DOES_NOT_USE_PIXEL_SHADERS 511
|
||||
#define IDS_UPGRADE_TO_USE_PS2 512
|
||||
#define IDS_WARNING_OLD_GPU_MIGHT_NOT_WORK_WITH_PRESET 513
|
||||
#define IDS_PRESET_CURRENTLY_USES_PS2 514
|
||||
#define IDS_UPGRADE_TO_USE_PS3 515
|
||||
#define IDS_PRESET_CURRENTLY_USES_PS3 516
|
||||
#define IDS_UPGRADE_TO_USE_PS4 517
|
||||
#define IDS_WARNING_DO_NOT_FORGET_WARP_SHADER_WAS_LOCKED 518
|
||||
#define IDS_WARNING_DO_NOT_FORGET_COMPOSITE_SHADER_WAS_LOCKED 519
|
||||
#define IDS_PRESET_MASH_UP_TEXT1 520
|
||||
#define IDS_PRESET_CURRENTLY_USES_PS2X 521
|
||||
#define IDS_UPGRADE_TO_USE_PS2X 522
|
||||
#define IDS_PRESET_MASH_UP_TEXT2 524
|
||||
#define IDS_PRESET_MASH_UP_TEXT3 525
|
||||
#define IDS_PRESET_MASH_UP_TEXT4 526
|
||||
#define IDS_DIRECTORY_OF_X 527
|
||||
#define IDS_SHUFFLE_IS_NOW_OFF 528
|
||||
#define IDS_SHUFFLE_IS_NOW_ON 529
|
||||
#define IDS_COMPSHADER_LOCKED 530
|
||||
#define IDS_WARPSHADER_LOCKED 531
|
||||
#define IDS_ALLSHADERS_LOCKED 532
|
||||
#define IDS_ALLSHADERS_UNLOCKED 533
|
||||
#define IDS_UPGRADE_TO_USE_PS2B 534
|
||||
#define IDS_PS_AUTO_RECOMMENDED 535
|
||||
#define IDS_PS_DISABLED 536
|
||||
#define IDS_PS_SHADER_MODEL_2 537
|
||||
#define IDS_PS_SHADER_MODEL_3 538
|
||||
#define IDS_TX_8_BITS_PER_CHANNEL 539
|
||||
#define IDS_TX_16_BITS_PER_CHANNEL 540
|
||||
#define IDS_TX_32_BITS_PER_CHANNEL 541
|
||||
#define IDS_160X120_SLOW 542
|
||||
#define IDS_192X144_SLOW 543
|
||||
#define IDS_NONE_BEST_IMAGE_QUALITY 544
|
||||
#define IDS_1_25_X 545
|
||||
#define IDS_1_33_X 546
|
||||
#define IDS_1_5_X 547
|
||||
#define IDS_1_67_X 548
|
||||
#define IDS_2_X 549
|
||||
#define IDS_3_X 550
|
||||
#define IDS_4_X 551
|
||||
#define IDS_NEAREST_POWER_OF_2 552
|
||||
#define IDS_EXACT_RECOMMENDED 553
|
||||
#define IDS_PIXEL_SHADERS 554
|
||||
#define IDS_PIXEL_SHADERS_TEXT 555
|
||||
#define IDS_TEXFORMAT 556
|
||||
#define IDS_TEXFORMAT_TEXT 557
|
||||
#define IDS_CANVAS_SIZE 558
|
||||
#define IDS_CANVAS_SIZE_TEXT 559
|
||||
#define IDS_CANVAS_STRETCH 560
|
||||
#define IDS_CANVAS_STRETCH_TEXT 561
|
||||
#define IDS_MAX_IMAGES_BYTES_TEXT 562
|
||||
#define IDS_MENU_EDIT_WARP_SHADER 563
|
||||
#define IDS_MENU_EDIT_COMPOSITE_SHADER 564
|
||||
#define IDS_MENU_BLUR1_EDGE_DARKEN_AMOUNT 565
|
||||
#define IDS_MENU_BLUR1_EDGE_DARKEN_AMOUNT_TT 566
|
||||
#define IDS_MENU_BLUR1_MIN_COLOR_VALUE 567
|
||||
#define IDS_MENU_BLUR1_MIN_COLOR_VALUE_TT 568
|
||||
#define IDS_MENU_BLUR1_MAX_COLOR_VALUE 569
|
||||
#define IDS_MENU_BLUR1_MAX_COLOR_VALUE_TT 570
|
||||
#define IDS_MENU_BLUR2_MIN_COLOR_VALUE 571
|
||||
#define IDS_MENU_BLUR2_MIN_COLOR_VALUE_TT 572
|
||||
#define IDS_MENU_BLUR2_MAX_COLOR_VALUE 573
|
||||
#define IDS_MENU_BLUR2_MAX_COLOR_VALUE_TT 574
|
||||
#define IDS_MENU_BLUR3_MIN_COLOR_VALUE 575
|
||||
#define IDS_MENU_BLUR3_MIN_COLOR_VALUE_TT 576
|
||||
#define IDS_MENU_BLUR3_MAX_COLOR_VALUE 577
|
||||
#define IDS_MENU_BLUR3_MAX_COLOR_VALUE_TT 578
|
||||
#define IDS_MENU_EDIT_PER_VERTEX_EQUATIONS 579
|
||||
#define IDS_MENU_EDIT_PER_VERTEX_EQUATIONS_TT 580
|
||||
#define IDS_MENU_EDIT_WARP_SHADER_TT 581
|
||||
#define IDS_MENU_EDIT_COMPOSITE_SHADER_TT 582
|
||||
#define IDS_MENU_EDIT_UPGRADE_PRESET_PS_VERSION 583
|
||||
#define IDS_MENU_EDIT_UPGRADE_PRESET_PS_VERSION_TT 584
|
||||
#define IDS_MENU_EDIT_DO_A_PRESET_MASH_UP 585
|
||||
#define IDS_MENU_EDIT_DO_A_PRESET_MASH_UP_TT 586
|
||||
#define IDS_MENU_NUMBER_OF_INSTANCES 587
|
||||
#define IDS_MENU_NUMBER_OF_INSTANCES_TT 588
|
||||
#define IDS_MENU_EDIT_INIT_CODE_SHAPE_TT 589
|
||||
#define IDS_MENU_EDIT_PER_FRAME_INSTANCE_CODE 590
|
||||
#define IDS_MENU_EDIT_PER_FRAME_INSTANCE_CODE_TT 591
|
||||
#define IDS_ERROR_PRESET_NOT_FOUND_X 592
|
||||
#define IDS_ERROR_NO_PRESET_FILES_OR_DIRS_FOUND_IN_X 593
|
||||
#define IDS_SCANNING_PRESETS 594
|
||||
#define IDS_SPRITE_X_ERROR_COULD_NOT_FIND_IMG_OR_NOT_DEFINED 595
|
||||
#define IDS_WARNING_PRESET_X_ERROR_IN_PRESET_INIT_CODE 596
|
||||
#define IDS_WARNING_PRESET_X_ERROR_IN_PER_FRAME_CODE 597
|
||||
#define IDS_WARNING_PRESET_X_ERROR_IN_PER_VERTEX_CODE 598
|
||||
#define IDS_HZ 599
|
||||
#define IDS_HELP_MINIMIZE_WINAMP 600
|
||||
#define IDS_HELP_MINIMIZE_WINAMP_HELP 601
|
||||
#define IDS_DIRECTX_MISSING_OR_CORRUPT_TEXT 602
|
||||
#define IDS_PARENT_DIRECTORY 603
|
||||
#define IDS_RAND_TITLE 604
|
||||
#define IDS_RAND_MSG 605
|
||||
#define IDS_MAX_IMAGES_BYTES 606
|
||||
#define IDS_PAGE_X 607
|
||||
#define IDS_MB 608
|
||||
#define IDS_GB 609
|
||||
#define IDS_MASHUP_GENERAL_POSTPROC 610
|
||||
#define IDS_MASHUP_MOTION_EQUATIONS 611
|
||||
#define IDS_MASHUP_WAVEFORMS_SHAPES 612
|
||||
#define IDS_MASHUP_WARP_SHADER 613
|
||||
#define IDS_MASHUP_COMP_SHADER 614
|
||||
#define IDS_STRING615 615
|
||||
#define IDS_STRING616 616
|
||||
#define IDS_STRING617 617
|
||||
#define IDS_STRNG618 618
|
||||
#define IDS_STRING618 618
|
||||
#define IDS_STRING619 619
|
||||
#define IDS_STRING620 620
|
||||
#define IDS_STRING621 621
|
||||
#define IDS_STRING622 622
|
||||
#define IDS_STRING623 623
|
||||
#define IDS_STRING624 624
|
||||
#define IDS_STRING625 625
|
||||
#define IDS_STRING626 626
|
||||
#define IDS_STRING627 627
|
||||
#define IDS_STRING628 628
|
||||
#define IDS_STRING629 629
|
||||
#define IDS_STRING630 630
|
||||
#define IDS_STRING631 631
|
||||
#define IDS_STRING632 632
|
||||
#define IDS_STRING633 633
|
||||
#define IDS_STRING634 634
|
||||
#define IDS_STRING635 635
|
||||
#define IDS_UPGRADE_SHADERS_TO_USE_PS2X 636
|
||||
#define IDS_PRESS_ESC_TO_RETURN 637
|
||||
#define IDS_COULD_NOT_LOAD_TEXTURE_X 638
|
||||
#define IDS_ERROR_COMPILING_X_X_SHADER 639
|
||||
#define IDS_ERROR_PARSING_X_X_SHADER 640
|
||||
#define IDS_UNABLE_TO_RESOLVE_TEXSIZE_FOR_A_TEXTURE_NOT_IN_USE 641
|
||||
#define IDS_KEY_MAPPINGS 642
|
||||
#define IDC_CB_FOG 1000
|
||||
#define IDC_CB_SUPERTEX 1001
|
||||
#define IDC_CB_HELP_MSG 1001
|
||||
#define IDC_CB_PRESS_F1_MSG 1001
|
||||
#define IDC_DISP_MODE 1003
|
||||
#define IDC_CB_FS 1004
|
||||
#define IDC_CB_PT 1005
|
||||
#define IDC_CB_WPT 1005
|
||||
#define IDC_SZ_ABOUT 1006
|
||||
#define IDC_CB_MIN 1006
|
||||
#define IDC_ADAPTER_W 1007
|
||||
#define IDC_ADAPTER_TEXT 1008
|
||||
#define IDC_ADAPTER_W_CAPTION 1008
|
||||
#define IDC_ADAPTER_FFS 1008
|
||||
#define IDC_ADAPTER_DMS 1008
|
||||
#define IDC_DISP_MODE_TEXT 1009
|
||||
#define IDC_DISP_MODE_CAPTION 1009
|
||||
#define IDC_ADAPTER_FS 1010
|
||||
#define IDC_ADAPTER_TEXT2 1011
|
||||
#define IDC_ADAPTER_FS_CAPTION 1011
|
||||
#define IDC_FS_ADAPTER_CAPTION 1011
|
||||
#define IDC_CB_TWOPASS 1012
|
||||
#define IDC_CB_FFSPT 1012
|
||||
#define IDC_CB_DMSPT 1012
|
||||
#define IDC_CB_TRANS_HAIR 1013
|
||||
#define IDC_ADAPTER_FS_CAPTION2 1013
|
||||
#define IDC_W_ADAPTER_CAPTION 1013
|
||||
#define IDC_FONT2b 1013
|
||||
#define IDC_FONT2 1013
|
||||
#define IDC_CB_3B 1014
|
||||
#define IDC_ADD_STUFF_HERE 1014
|
||||
#define IDC_FFS_ADAPTER_CAPTION 1014
|
||||
#define IDC_DMS_ADAPTER_CAPTION 1014
|
||||
#define IDC_CB_DEBUGOUTPUT 1014
|
||||
#define IDC_FONT3b 1014
|
||||
#define IDC_FONT3 1014
|
||||
#define IDC_MQ 1015
|
||||
#define IDC_CB_FAKE 1015
|
||||
#define IDC_TEXSIZECOMBO 1015
|
||||
#define IDC_FONT4b 1015
|
||||
#define IDC_FONT4 1015
|
||||
#define IDC_DISP_MODE_TEXT2 1016
|
||||
#define IDC_CB_NO_FAKE_TIPS 1016
|
||||
#define IDC_TAB1 1016
|
||||
#define IDC_TABS 1016
|
||||
#define IDC_CB_FSPT 1016
|
||||
#define IDC_FONTSIZE 1016
|
||||
#define IDC_CB_AUTOGAMMA 1016
|
||||
#define IDC_FONT5b 1016
|
||||
#define IDC_FONT5 1016
|
||||
#define IDC_WMS 1017
|
||||
#define IDC_MESHSIZECOMBO 1017
|
||||
#define IDC_FONTSIZE3 1017
|
||||
#define IDC_DISP_MODE_TEXT3 1018
|
||||
#define IDC_MULTISAMPLING_CAPTION2 1018
|
||||
#define IDC_FS_BOX 1018
|
||||
#define IDC_W_MULTISAMPLING_CAPTION 1018
|
||||
#define IDC_BETWEEN_TIME 1018
|
||||
#define IDC_FONTSIZE4 1018
|
||||
#define IDC_FSMS 1019
|
||||
#define IDC_CB_ALWAYS3D 1019
|
||||
#define IDC_BETWEEN_TIME_RANDOM 1019
|
||||
#define IDC_FONT6b 1019
|
||||
#define IDC_FONT6 1019
|
||||
#define IDC_DISP_MODE_TEXT4 1020
|
||||
#define IDC_MULTISAMPLING_CAPTION 1020
|
||||
#define IDC_FRACTAL_RES_CAPTION 1020
|
||||
#define IDC_INITIAL_WAVEMODE_CAPTION 1020
|
||||
#define IDC_CB_DMS 1020
|
||||
#define IDC_HARDCUT_BETWEEN_TIME 1020
|
||||
#define IDC_FONTSIZE5 1020
|
||||
#define IDC_CB_SCROLLON 1020
|
||||
#define IDC_FS_LIMIT 1021
|
||||
#define IDC_FS_MAXFPS 1021
|
||||
#define IDC_FONTOPTIONS 1021
|
||||
#define IDC_TEXFORMAT 1021
|
||||
#define IDC_DISP_MODE_TEXT5 1022
|
||||
#define IDC_FRAME_DELAY_CAPTION 1022
|
||||
#define IDC_FS_FRAME_DELAY_CAPTION 1022
|
||||
#define IDC_FS_MAXFPS_CAPTION 1022
|
||||
#define IDC_FONTOPTIONS3 1022
|
||||
#define IDC_SHADERS 1022
|
||||
#define IDC_W_LIMIT 1023
|
||||
#define IDC_W_MAXFPS 1023
|
||||
#define IDC_CB_NOWARN 1023
|
||||
#define IDC_BLEND_AUTO 1023
|
||||
#define IDC_CB_SCROLLON2 1023
|
||||
#define IDC_DISP_MODE_TEXT6 1024
|
||||
#define IDC_FRAME_DELAY_CAPTION2 1024
|
||||
#define IDC_G_BOX 1024
|
||||
#define IDC_W_FRAME_DELAY_CAPTION 1024
|
||||
#define IDC_W_MAXFPS_CAPTION 1024
|
||||
#define IDC_CB_NOWARN2 1024
|
||||
#define IDC_BLEND_USER 1024
|
||||
#define IDC_W_BOX 1025
|
||||
#define IDC_CB_SAVE_CPU 1025
|
||||
#define IDC_FONT7b 1025
|
||||
#define IDC_FONT7 1025
|
||||
#define IDC_CB_ANISO 1025
|
||||
#define IDC_TABS_PLACEHOLDER 1026
|
||||
#define IDC_FFSMS 1026
|
||||
#define IDC_DMSMS 1026
|
||||
#define IDC_CB_NORATING 1026
|
||||
#define IDC_MULTISAMPLING_CAPTION3 1027
|
||||
#define IDC_FFS_MULTISAMPLING_CAPTION 1027
|
||||
#define IDC_FONTSIZE2 1027
|
||||
#define IDC_DMS_MULTISAMPLING_CAPTION 1027
|
||||
#define IDC_CB_INSTASCAN 1027
|
||||
#define IDC_FRAME_DELAY_CAPTION3 1028
|
||||
#define IDC_FFS_FRAME_DELAY_CAPTION 1028
|
||||
#define IDC_FFS_MAXFPS_CAPTION 1028
|
||||
#define IDC_FONTOPTIONS2 1028
|
||||
#define IDC_DMS_MAXFPS_CAPTION 1028
|
||||
#define IDC_STRETCH 1028
|
||||
#define IDC_FFS_LIMIT 1029
|
||||
#define IDC_FFS_MAXFPS 1029
|
||||
#define IDC_DMS_MAXFPS 1029
|
||||
#define IDC_FONTSIZE6 1029
|
||||
#define IDC_MAX_IMAGES 1029
|
||||
#define IDC_RECT 1030
|
||||
#define IDC_CB_SKIN 1030
|
||||
#define IDC_MAX_BYTES 1030
|
||||
#define IDC_Q 1031
|
||||
#define IDC_FRACTAL_RES 1031
|
||||
#define IDC_INITIAL_WAVEMODE 1031
|
||||
#define IDC_FONT8b 1031
|
||||
#define IDC_FONT8 1031
|
||||
#define IDC_CB_MIN2 1031
|
||||
#define IDC_CB_FIXSLOWTEXT 1031
|
||||
#define IDC_HS_ANIM_SPEED 1032
|
||||
#define IDC_BETWEEN_TIME_LABEL 1032
|
||||
#define IDC_FONTSIZE7 1032
|
||||
#define IDC_FS_MULTISAMPLING_CAPTION 1033
|
||||
#define IDC_BETWEEN_TIME_RANDOM_LABEL 1033
|
||||
#define IDC_HS_ANIM_SPEED_CAPTION 1034
|
||||
#define IDC_BLEND_AUTO_LABEL 1034
|
||||
#define IDC_FONT9b 1034
|
||||
#define IDC_FONT9 1034
|
||||
#define IDC_BLEND_USER_LABEL 1035
|
||||
#define IDC_FONTSIZE8 1035
|
||||
#define IDC_FFS_LABEL 1036
|
||||
#define IDC_DMS_LABEL 1036
|
||||
#define IDC_BLEND_USER_LABEL2 1036
|
||||
#define IDC_BETWEEN_TIME_LABEL2 1036
|
||||
#define IDC_RAND_TITLE_LABEL 1036
|
||||
#define IDC_HARDCUT_BETWEEN_TIME_LABEL 1036
|
||||
#define IDC_FS_LABEL 1037
|
||||
#define IDC_BLEND_USER_LABEL3 1037
|
||||
#define IDC_RAND_MSG_LABEL 1037
|
||||
#define IDC_W_LABEL 1038
|
||||
#define IDC_FONTSIZE9 1038
|
||||
#define IDC_3DSEP_LABEL 1038
|
||||
#define ID_FONTS 1039
|
||||
#define IDC_BRIGHT_SLIDER 1039
|
||||
#define IDC_FONT_CAPTION 1040
|
||||
#define ID_DM_MORE 1040
|
||||
#define IDC_FONTSIZE_CAPTION 1041
|
||||
#define ID_DUALHEAD 1041
|
||||
#define IDC_FONTOPTIONS_CAPTION 1042
|
||||
#define IDC_SYSTEM_FONT 1043
|
||||
#define IDC_CB_SEPTEXT 1043
|
||||
#define IDC_FONT_NAME_2 1043
|
||||
#define IDC_DECORATIVE_FONT 1044
|
||||
#define IDC_HARDCUT_LOUDNESS 1044
|
||||
#define IDC_FONT_NAME_1 1044
|
||||
#define IDC_CB_HARDCUTS 1045
|
||||
#define IDC_TITLE_FONT 1045
|
||||
#define IDC_FONT_NAME_3 1045
|
||||
#define IDC_CB_BOX 1046
|
||||
#define IDC_SONGTITLEANIM_DURATION 1046
|
||||
#define IDC_FONT_NAME_4 1046
|
||||
#define IDC_DM_ALPHA_FIX 1047
|
||||
#define IDC_CB_TITLE_ANIMS 1047
|
||||
#define IDC_FONT_NAME_5 1047
|
||||
#define IDC_DM_ALPHA_FIX_CAPTION 1048
|
||||
#define IDC_V_PICK 1048
|
||||
#define IDC_RAND_TITLE 1048
|
||||
#define IDC_FONT_NAME_6 1048
|
||||
#define IDC_CB_MANUAL_SCOOT 1049
|
||||
#define IDC_T1 1049
|
||||
#define IDC_RAND_MSG 1049
|
||||
#define IDC_FONT_NAME_7 1049
|
||||
#define IDC_T3 1050
|
||||
#define IDC_CB_SHOW_ICONS 1050
|
||||
#define IDC_FONT_NAME_8 1050
|
||||
#define IDC_3DSEP 1050
|
||||
#define IDC_H_PICK 1051
|
||||
#define IDC_T5 1051
|
||||
#define IDC_FONT_NAME_9 1051
|
||||
#define IDC_T2 1052
|
||||
#define IDC_FONTOPTIONS_CAPTION2 1052
|
||||
#define IDC_T4 1053
|
||||
#define IDC_FONTOPTIONS_CAPTION3 1053
|
||||
#define IDC_FONT_TEXT 1054
|
||||
#define IDC_TEXSIZECOMBO_CAPTION 1054
|
||||
#define IDC_MESHSIZECOMBO_CAPTION 1055
|
||||
#define IDC_BRIGHT_SLIDER_BOX 1056
|
||||
#define IDC_SONGTITLEANIM_DURATION_LABEL 1057
|
||||
#define IDC_TEXFORMAT_CAPTION 1057
|
||||
#define IDC_HARDCUT_LOUDNESS_LABEL 1058
|
||||
#define IDC_SHADERS_CAPTION 1058
|
||||
#define IDC_FONTSIZE1 1059
|
||||
#define IDC_HARDCUT_LOUDNESS_MIN 1059
|
||||
#define IDC_BRIGHT_SLIDER_BOX2 1059
|
||||
#define IDC_HARDCUT_LOUDNESS_MAX 1060
|
||||
#define IDC_STRETCH_CAPTION 1060
|
||||
#define IDC_CB_VJMODE 1061
|
||||
#define IDC_MAX_IMAGES_CAPTION 1061
|
||||
#define IDC_MAX_BYTES_CAPTION 1062
|
||||
#define IDC_FONTBOLD1 1063
|
||||
#define IDC_FONTITAL1 1064
|
||||
#define IDC_FONTAA1 1065
|
||||
#define IDC_FONTBOLD2 1066
|
||||
#define IDC_FONTITAL2 1067
|
||||
#define IDC_FONTAA2 1068
|
||||
#define IDC_FONTBOLD3 1069
|
||||
#define IDC_FONTITAL3 1070
|
||||
#define IDC_FONTAA3 1071
|
||||
#define IDC_FONTBOLD4 1072
|
||||
#define IDC_FONTITAL4 1073
|
||||
#define IDC_FONTAA4 1074
|
||||
#define IDC_FONTBOLD5 1075
|
||||
#define IDC_FONTITAL5 1076
|
||||
#define IDC_FONTAA5 1077
|
||||
#define IDC_FONTBOLD6 1078
|
||||
#define IDC_FONTITAL6 1079
|
||||
#define IDC_FONTAA6 1080
|
||||
#define IDC_FONTBOLD7 1084
|
||||
#define IDC_FONTITAL7 1085
|
||||
#define IDC_FONTAA7 1086
|
||||
#define IDC_FONTBOLD8 1087
|
||||
#define IDC_FONTITAL8 1088
|
||||
#define IDC_FONTAA8 1089
|
||||
#define IDC_FONTBOLD9 1090
|
||||
#define IDC_FONTITAL9 1091
|
||||
#define IDC_FONTAA9 1092
|
||||
#define IDC_FONT1b 1093
|
||||
#define IDC_FONT1 1093
|
||||
#define ID_QUIT 40006
|
||||
#define ID_GO_FS 40007
|
||||
#define ID_SHOWHELP 40008
|
||||
#define ID_SHOWPLAYLIST 40009
|
||||
#define ID_DESKTOP_MODE 40010
|
||||
|
||||
// Next default values for new objects
|
||||
//
|
||||
#ifdef APSTUDIO_INVOKED
|
||||
#ifndef APSTUDIO_READONLY_SYMBOLS
|
||||
#define _APS_NEXT_RESOURCE_VALUE 131
|
||||
#define _APS_NEXT_COMMAND_VALUE 40011
|
||||
#define _APS_NEXT_CONTROL_VALUE 1062
|
||||
#define _APS_NEXT_SYMED_VALUE 101
|
||||
#endif
|
||||
#endif
|
||||
@@ -0,0 +1,76 @@
|
||||
/*
|
||||
LICENSE
|
||||
-------
|
||||
Copyright 2005-2013 Nullsoft, Inc.
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification,
|
||||
are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright notice,
|
||||
this list of conditions and the following disclaimer.
|
||||
|
||||
* Redistributions in binary form must reproduce the above copyright notice,
|
||||
this list of conditions and the following disclaimer in the documentation
|
||||
and/or other materials provided with the distribution.
|
||||
|
||||
* Neither the name of Nullsoft nor the names of its contributors may be used to
|
||||
endorse or promote products derived from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
|
||||
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||
FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
||||
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
|
||||
IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
|
||||
OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifndef __NULLSOFT_DX9_PLUGIN_SHELL_SHELL_DEFINES_H__
|
||||
#define __NULLSOFT_DX9_PLUGIN_SHELL_SHELL_DEFINES_H__ 1
|
||||
|
||||
#include <windows.h>
|
||||
|
||||
#define DEFAULT_FULLSCREEN_WIDTH 640
|
||||
#define DEFAULT_FULLSCREEN_HEIGHT 480
|
||||
#define MAX_ICON_TEXTURES 8
|
||||
#define ICON_TEXTURE_SIZE 256
|
||||
#define DEFAULT_WINDOW_SIZE 0.625f // as a portion of the width or height of the screen (whichever is smaller)
|
||||
#define DESKTOP_MODE_KEYBOARD_INPUT_WINDOW_CLASSNAME "DESKTOP MODE KEYBOARD INPUT WINDOW"
|
||||
#define BGR2RGB(x) (((x>>16)&0xFF) | (x & 0xFF00) | ((x<<16)&0xFF0000))
|
||||
|
||||
#define NUM_BASIC_FONTS 4
|
||||
#define SYS_FONT 0
|
||||
#define DEC_FONT 1
|
||||
#define HELP_FONT 2
|
||||
#define DESK_FONT 3
|
||||
#define MAX_EXTRA_FONTS 5
|
||||
typedef enum
|
||||
{
|
||||
SIMPLE_FONT = 0, // aka 'system' font; should be legible
|
||||
DECORATIVE_FONT = 1,
|
||||
HELPSCREEN_FONT = 2,
|
||||
PLAYLIST_FONT = 3,
|
||||
EXTRA_1 = 4,
|
||||
EXTRA_2 = 5,
|
||||
EXTRA_3 = 6,
|
||||
EXTRA_4 = 7,
|
||||
EXTRA_5 = 8
|
||||
}
|
||||
eFontIndex;
|
||||
|
||||
// for m_screenmode:
|
||||
typedef enum
|
||||
{
|
||||
NOT_YET_KNOWN = -1,
|
||||
FULLSCREEN = 0,
|
||||
WINDOWED = 1,
|
||||
FAKE_FULLSCREEN = 2,
|
||||
DESKTOP = 3 // doesn't use overlays! =)
|
||||
}
|
||||
eScrMode;
|
||||
|
||||
#include "../Winamp/wa_ipc.h"
|
||||
|
||||
#endif
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,448 @@
|
||||
/*
|
||||
LICENSE
|
||||
-------
|
||||
Copyright 2005-2013 Nullsoft, Inc.
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification,
|
||||
are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright notice,
|
||||
this list of conditions and the following disclaimer.
|
||||
|
||||
* Redistributions in binary form must reproduce the above copyright notice,
|
||||
this list of conditions and the following disclaimer in the documentation
|
||||
and/or other materials provided with the distribution.
|
||||
|
||||
* Neither the name of Nullsoft nor the names of its contributors may be used to
|
||||
endorse or promote products derived from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
|
||||
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||
FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
||||
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
|
||||
IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
|
||||
OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifndef _MILKDROP_STATE_
|
||||
#define _MILKDROP_STATE_ 1
|
||||
|
||||
#include <memory.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include "gstring.h"
|
||||
#include "texmgr.h"
|
||||
|
||||
#include <d3dx9math.h> // for D3DXVECTOR3
|
||||
|
||||
//#include "evallib/eval.h"
|
||||
#include "ns-eel2/ns-eel.h"
|
||||
#include "md_defines.h"
|
||||
|
||||
// flags for CState::RecompileExpressions():
|
||||
#define RECOMPILE_PRESET_CODE 1
|
||||
#define RECOMPILE_WAVE_CODE 2
|
||||
#define RECOMPILE_SHAPE_CODE 4
|
||||
|
||||
#define NUM_Q_VAR 32
|
||||
#define NUM_T_VAR 8
|
||||
|
||||
#define MAX_BIGSTRING_LEN 32768
|
||||
|
||||
class CBlendableFloat
|
||||
{
|
||||
public:
|
||||
CBlendableFloat();
|
||||
~CBlendableFloat();
|
||||
|
||||
float operator = (float f) {
|
||||
val = f;
|
||||
m_bBlending = false;
|
||||
return val;
|
||||
};
|
||||
float operator *= (float f) {
|
||||
val *= f;
|
||||
m_bBlending = false;
|
||||
return val;
|
||||
};
|
||||
float operator /= (float f) {
|
||||
val /= f;
|
||||
m_bBlending = false;
|
||||
return val;
|
||||
};
|
||||
float operator -= (float f) {
|
||||
val -= f;
|
||||
m_bBlending = false;
|
||||
return val;
|
||||
};
|
||||
float operator += (float f) {
|
||||
val += f;
|
||||
m_bBlending = false;
|
||||
return val;
|
||||
};
|
||||
|
||||
float eval(float fTime); // call this from animation code. if fTime < 0, it will return unblended 'val'.
|
||||
void StartBlendFrom(CBlendableFloat *f_from, float fAnimTime, float fDuration);
|
||||
|
||||
protected:
|
||||
float val;
|
||||
bool m_bBlending;
|
||||
float m_fBlendStartTime;
|
||||
float m_fBlendDuration;
|
||||
float m_fBlendFrom;
|
||||
};
|
||||
|
||||
class CShape
|
||||
{
|
||||
public:
|
||||
int Import(FILE* f, const wchar_t* szFile, int i);
|
||||
int Export(FILE* f, const wchar_t* szFile, int i);
|
||||
|
||||
int enabled;
|
||||
int sides;
|
||||
int additive;
|
||||
int thickOutline;
|
||||
int textured;
|
||||
int instances;
|
||||
float x,y,rad,ang;
|
||||
float r,g,b,a;
|
||||
float r2,g2,b2,a2;
|
||||
float border_r,border_g,border_b,border_a;
|
||||
float tex_ang, tex_zoom;
|
||||
|
||||
char m_szInit[MAX_BIGSTRING_LEN]; // note: only executed once -> don't need to save codehandle
|
||||
char m_szPerFrame[MAX_BIGSTRING_LEN];
|
||||
//char m_szPerPoint[MAX_BIGSTRING_LEN];
|
||||
NSEEL_CODEHANDLE m_pf_codehandle;
|
||||
//int m_pp_codehandle;
|
||||
|
||||
|
||||
// for per-frame expression evaluation:
|
||||
NSEEL_VMCTX m_pf_eel;
|
||||
double *var_pf_time, *var_pf_fps;
|
||||
double *var_pf_frame;
|
||||
double *var_pf_progress;
|
||||
//double *var_pf_q1, *var_pf_q2, *var_pf_q3, *var_pf_q4, *var_pf_q5, *var_pf_q6, *var_pf_q7, *var_pf_q8;
|
||||
//double *var_pf_t1, *var_pf_t2, *var_pf_t3, *var_pf_t4, *var_pf_t5, *var_pf_t6, *var_pf_t7, *var_pf_t8;
|
||||
double* var_pf_q[NUM_Q_VAR];
|
||||
double* var_pf_t[NUM_T_VAR];
|
||||
double *var_pf_bass, *var_pf_mid, *var_pf_treb, *var_pf_bass_att, *var_pf_mid_att, *var_pf_treb_att;
|
||||
double *var_pf_r, *var_pf_g, *var_pf_b, *var_pf_a;
|
||||
double *var_pf_r2, *var_pf_g2, *var_pf_b2, *var_pf_a2;
|
||||
double *var_pf_border_r, *var_pf_border_g, *var_pf_border_b, *var_pf_border_a;
|
||||
double *var_pf_x, *var_pf_y, *var_pf_rad, *var_pf_ang;
|
||||
double *var_pf_sides, *var_pf_textured, *var_pf_additive, *var_pf_thick, *var_pf_instances, *var_pf_instance;
|
||||
double *var_pf_tex_zoom, *var_pf_tex_ang;
|
||||
|
||||
// for per-point expression evaluation:
|
||||
/*
|
||||
NSEEL_VMCTX m_pp_eel;
|
||||
double *var_pp_time, *var_pp_fps;
|
||||
double *var_pp_frame;
|
||||
double *var_pp_progress;
|
||||
double *var_pp_q1, *var_pp_q2, *var_pp_q3, *var_pp_q4, *var_pp_q5, *var_pp_q6, *var_pp_q7, *var_pp_q8;
|
||||
double *var_pp_t1, *var_pp_t2, *var_pp_t3, *var_pp_t4, *var_pp_t5, *var_pp_t6, *var_pp_t7, *var_pp_t8;
|
||||
double *var_pp_bass, *var_pp_mid, *var_pp_treb, *var_pp_bass_att, *var_pp_mid_att, *var_pp_treb_att;
|
||||
double *var_pp_r, *var_pp_g, *var_pp_b, *var_pp_a;
|
||||
double *var_pp_r2, *var_pp_g2, *var_pp_b2, *var_pp_a2;
|
||||
double *var_pp_border_r, *var_pp_border_g, *var_pp_border_b, *var_pp_border_a;
|
||||
double *var_pp_x, *var_pp_y, *var_pp_rad, *var_pp_ang, *var_pp_sides;
|
||||
*/
|
||||
|
||||
double t_values_after_init_code[NUM_T_VAR];
|
||||
};
|
||||
|
||||
class CWave
|
||||
{
|
||||
public:
|
||||
int Import(FILE* f, const wchar_t *szFile, int i);
|
||||
int Export(FILE* f, const wchar_t* szFile, int i);
|
||||
|
||||
int enabled;
|
||||
int samples;
|
||||
int sep;
|
||||
float scaling;
|
||||
float smoothing;
|
||||
float x,y,r,g,b,a;
|
||||
int bSpectrum;
|
||||
int bUseDots;
|
||||
int bDrawThick;
|
||||
int bAdditive;
|
||||
|
||||
char m_szInit[MAX_BIGSTRING_LEN]; // note: only executed once -> don't need to save codehandle
|
||||
char m_szPerFrame[MAX_BIGSTRING_LEN];
|
||||
char m_szPerPoint[MAX_BIGSTRING_LEN];
|
||||
NSEEL_CODEHANDLE m_pf_codehandle;
|
||||
NSEEL_CODEHANDLE m_pp_codehandle;
|
||||
|
||||
// for per-frame expression evaluation:
|
||||
NSEEL_VMCTX m_pf_eel;
|
||||
double *var_pf_time, *var_pf_fps;
|
||||
double *var_pf_frame;
|
||||
double *var_pf_progress;
|
||||
//double *var_pf_q1, *var_pf_q2, *var_pf_q3, *var_pf_q4, *var_pf_q5, *var_pf_q6, *var_pf_q7, *var_pf_q8;
|
||||
//double *var_pf_t1, *var_pf_t2, *var_pf_t3, *var_pf_t4, *var_pf_t5, *var_pf_t6, *var_pf_t7, *var_pf_t8;
|
||||
double* var_pf_q[NUM_Q_VAR];
|
||||
double* var_pf_t[NUM_T_VAR];
|
||||
double *var_pf_bass, *var_pf_mid, *var_pf_treb, *var_pf_bass_att, *var_pf_mid_att, *var_pf_treb_att;
|
||||
double *var_pf_r, *var_pf_g, *var_pf_b, *var_pf_a;
|
||||
double *var_pf_samples;
|
||||
|
||||
// for per-point expression evaluation:
|
||||
NSEEL_VMCTX m_pp_eel;
|
||||
double *var_pp_time, *var_pp_fps;
|
||||
double *var_pp_frame;
|
||||
double *var_pp_progress;
|
||||
//double *var_pp_q1, *var_pp_q2, *var_pp_q3, *var_pp_q4, *var_pp_q5, *var_pp_q6, *var_pp_q7, *var_pp_q8;
|
||||
//double *var_pp_t1, *var_pp_t2, *var_pp_t3, *var_pp_t4, *var_pp_t5, *var_pp_t6, *var_pp_t7, *var_pp_t8;
|
||||
double* var_pp_q[NUM_Q_VAR];
|
||||
double* var_pp_t[NUM_T_VAR];
|
||||
double *var_pp_bass, *var_pp_mid, *var_pp_treb, *var_pp_bass_att, *var_pp_mid_att, *var_pp_treb_att;
|
||||
double *var_pp_sample, *var_pp_value1, *var_pp_value2;
|
||||
double *var_pp_x, *var_pp_y, *var_pp_r, *var_pp_g, *var_pp_b, *var_pp_a;
|
||||
|
||||
double t_values_after_init_code[NUM_T_VAR];
|
||||
};
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int type;
|
||||
int in_var;
|
||||
int out_var;
|
||||
float constant;
|
||||
float min;
|
||||
float max;
|
||||
float in_scale;
|
||||
float amp; // for sine functions
|
||||
float freq; // for sine functions
|
||||
float freq2; // for sine functions
|
||||
float phase; // for sine functions
|
||||
float phase2; // for sine functions
|
||||
} td_modifier;
|
||||
|
||||
//#define MAX_EVALS 8
|
||||
|
||||
#define INVALID_PRESET_DESC L"<no description>" // this should contain invalid filename chars, so there is never a conflict...
|
||||
|
||||
#define STATE_GENERAL 1 // and postproc (old presets) or blur, etc. (new presets)
|
||||
#define STATE_MOTION 2 // and equations
|
||||
#define STATE_WAVE 4 // waves, shapes, motion vectors
|
||||
#define STATE_WARP 8
|
||||
#define STATE_COMP 16
|
||||
#define STATE_ALL (32-1)
|
||||
|
||||
#define CUR_MILKDROP_PRESET_VERSION 201
|
||||
// 200: milkdrop 2
|
||||
// 201: instead of just 1 variable for shader version, it tracks 2 (comp and warp) separately.
|
||||
|
||||
class CState
|
||||
{
|
||||
public:
|
||||
CState();
|
||||
~CState();
|
||||
|
||||
void Default(DWORD ApplyFlags=STATE_ALL);
|
||||
void Randomize(int nMode);
|
||||
void StartBlendFrom(CState *s_from, float fAnimTime, float fTimespan);
|
||||
bool Import(const wchar_t *szIniFile, float fTime, CState* pOldState, DWORD ApplyFlags=STATE_ALL);
|
||||
bool Export(const wchar_t *szIniFile);
|
||||
void RecompileExpressions(int flags=0xFFFFFFFF, int bReInit=1);
|
||||
void GenDefaultWarpShader();
|
||||
void GenDefaultCompShader();
|
||||
|
||||
wchar_t m_szDesc[512]; // this is just the filename, without a path or extension.
|
||||
//char m_szSection[256];
|
||||
|
||||
int m_nMinPSVersion; // the min of the warp & comp values...
|
||||
int m_nMaxPSVersion; // the max of the warp & comp values...
|
||||
int m_nWarpPSVersion; // 0 = milkdrop 1 era (no PS), 2 = ps_2_0, 3 = ps_3_0
|
||||
int m_nCompPSVersion; // 0 = milkdrop 1 era (no PS), 2 = ps_2_0, 3 = ps_3_0
|
||||
float m_fRating; // 0..5
|
||||
// post-processing:
|
||||
CBlendableFloat m_fGammaAdj; // +0 -> +1.0 (double), +2.0 (triple)...
|
||||
CBlendableFloat m_fVideoEchoZoom;
|
||||
CBlendableFloat m_fVideoEchoAlpha;
|
||||
float m_fVideoEchoAlphaOld;
|
||||
int m_nVideoEchoOrientation;
|
||||
int m_nVideoEchoOrientationOld;
|
||||
|
||||
// fps-dependant:
|
||||
CBlendableFloat m_fDecay; // 1.0 = none, 0.95 = heavy decay
|
||||
|
||||
// other:
|
||||
int m_nWaveMode;
|
||||
int m_nOldWaveMode;
|
||||
bool m_bAdditiveWaves;
|
||||
CBlendableFloat m_fWaveAlpha;
|
||||
CBlendableFloat m_fWaveScale;
|
||||
CBlendableFloat m_fWaveSmoothing;
|
||||
bool m_bWaveDots;
|
||||
bool m_bWaveThick;
|
||||
CBlendableFloat m_fWaveParam; // -1..1; 0 is normal
|
||||
bool m_bModWaveAlphaByVolume;
|
||||
CBlendableFloat m_fModWaveAlphaStart; // when relative volume hits this level, alpha -> 0
|
||||
CBlendableFloat m_fModWaveAlphaEnd; // when relative volume hits this level, alpha -> 1
|
||||
float m_fWarpAnimSpeed; // 1.0 = normal, 2.0 = double, 0.5 = half, etc.
|
||||
CBlendableFloat m_fWarpScale;
|
||||
CBlendableFloat m_fZoomExponent;
|
||||
CBlendableFloat m_fShader; // 0 = no color shader, 1 = full color shader
|
||||
bool m_bMaximizeWaveColor;
|
||||
bool m_bTexWrap;
|
||||
bool m_bDarkenCenter;
|
||||
bool m_bRedBlueStereo;
|
||||
bool m_bBrighten;
|
||||
bool m_bDarken;
|
||||
bool m_bSolarize;
|
||||
bool m_bInvert;
|
||||
/*
|
||||
bool m_bPlates;
|
||||
int m_nPlates;
|
||||
CBlendableFloat m_fPlateAlpha; // 0 = off, 0.1 = barely visible, 1.0 = solid
|
||||
CBlendableFloat m_fPlateR;
|
||||
CBlendableFloat m_fPlateG;
|
||||
CBlendableFloat m_fPlateB;
|
||||
CBlendableFloat m_fPlateWidth; // 1.0=normal, 2.0=double, etc.
|
||||
CBlendableFloat m_fPlateLength; // 1.0=normal, 2.0=double, etc.
|
||||
float m_fPlateSpeed; // 1.0=normal, 2.0=double, etc.
|
||||
bool m_bPlatesAdditive;
|
||||
*/
|
||||
|
||||
// map controls:
|
||||
CBlendableFloat m_fZoom;
|
||||
CBlendableFloat m_fRot;
|
||||
CBlendableFloat m_fRotCX;
|
||||
CBlendableFloat m_fRotCY;
|
||||
CBlendableFloat m_fXPush;
|
||||
CBlendableFloat m_fYPush;
|
||||
CBlendableFloat m_fWarpAmount;
|
||||
CBlendableFloat m_fStretchX;
|
||||
CBlendableFloat m_fStretchY;
|
||||
CBlendableFloat m_fWaveR;
|
||||
CBlendableFloat m_fWaveG;
|
||||
CBlendableFloat m_fWaveB;
|
||||
CBlendableFloat m_fWaveX;
|
||||
CBlendableFloat m_fWaveY;
|
||||
CBlendableFloat m_fOuterBorderSize;
|
||||
CBlendableFloat m_fOuterBorderR;
|
||||
CBlendableFloat m_fOuterBorderG;
|
||||
CBlendableFloat m_fOuterBorderB;
|
||||
CBlendableFloat m_fOuterBorderA;
|
||||
CBlendableFloat m_fInnerBorderSize;
|
||||
CBlendableFloat m_fInnerBorderR;
|
||||
CBlendableFloat m_fInnerBorderG;
|
||||
CBlendableFloat m_fInnerBorderB;
|
||||
CBlendableFloat m_fInnerBorderA;
|
||||
CBlendableFloat m_fMvX;
|
||||
CBlendableFloat m_fMvY;
|
||||
CBlendableFloat m_fMvDX;
|
||||
CBlendableFloat m_fMvDY;
|
||||
CBlendableFloat m_fMvL;
|
||||
CBlendableFloat m_fMvR;
|
||||
CBlendableFloat m_fMvG;
|
||||
CBlendableFloat m_fMvB;
|
||||
CBlendableFloat m_fMvA;
|
||||
CBlendableFloat m_fBlur1Min;
|
||||
CBlendableFloat m_fBlur2Min;
|
||||
CBlendableFloat m_fBlur3Min;
|
||||
CBlendableFloat m_fBlur1Max;
|
||||
CBlendableFloat m_fBlur2Max;
|
||||
CBlendableFloat m_fBlur3Max;
|
||||
CBlendableFloat m_fBlur1EdgeDarken;
|
||||
|
||||
CShape m_shape[MAX_CUSTOM_SHAPES];
|
||||
CWave m_wave[MAX_CUSTOM_WAVES];
|
||||
|
||||
// some random stuff for driving shaders:
|
||||
void RandomizePresetVars();
|
||||
D3DXVECTOR4 m_rand_preset; // 4 random floats (0..1); randomized @ preset load; fed to pixel shaders. --FIXME (blending)
|
||||
D3DXVECTOR3 m_xlate[20];
|
||||
D3DXVECTOR3 m_rot_base[20];
|
||||
D3DXVECTOR3 m_rot_speed[20];
|
||||
|
||||
//COscillator m_waveR;
|
||||
//COscillator m_waveG;
|
||||
//COscillator m_waveB;
|
||||
//COscillator m_wavePosX; // 0 = centered
|
||||
//COscillator m_wavePosY; // 0 = centered
|
||||
|
||||
// for arbitrary function evaluation:
|
||||
NSEEL_CODEHANDLE m_pf_codehandle;
|
||||
NSEEL_CODEHANDLE m_pp_codehandle;
|
||||
char m_szPerFrameInit[MAX_BIGSTRING_LEN];
|
||||
char m_szPerFrameExpr[MAX_BIGSTRING_LEN];
|
||||
char m_szPerPixelExpr[MAX_BIGSTRING_LEN];
|
||||
char m_szWarpShadersText[MAX_BIGSTRING_LEN]; // pixel shader code
|
||||
char m_szCompShadersText[MAX_BIGSTRING_LEN]; // pixel shader code
|
||||
void FreeVarsAndCode(bool bFree = true);
|
||||
void RegisterBuiltInVariables(int flags);
|
||||
void StripLinefeedCharsAndComments(char *src, char *dest);
|
||||
|
||||
bool m_bBlending;
|
||||
float m_fBlendStartTime;
|
||||
float m_fBlendDuration;
|
||||
float m_fBlendProgress; // 0..1; updated every frame based on StartTime and Duration.
|
||||
|
||||
// for once-per-frame expression evaluation: [although, these vars are also shared w/preset init expr eval]
|
||||
NSEEL_VMCTX m_pf_eel;
|
||||
double *var_pf_zoom, *var_pf_zoomexp, *var_pf_rot, *var_pf_warp, *var_pf_cx, *var_pf_cy, *var_pf_dx, *var_pf_dy, *var_pf_sx, *var_pf_sy;
|
||||
double *var_pf_time, *var_pf_fps;
|
||||
double *var_pf_bass, *var_pf_mid, *var_pf_treb, *var_pf_bass_att, *var_pf_mid_att, *var_pf_treb_att;
|
||||
double *var_pf_wave_a, *var_pf_wave_r, *var_pf_wave_g, *var_pf_wave_b, *var_pf_wave_x, *var_pf_wave_y, *var_pf_wave_mystery, *var_pf_wave_mode;
|
||||
double *var_pf_decay;
|
||||
double *var_pf_frame;
|
||||
//double *var_pf_q1, *var_pf_q2, *var_pf_q3, *var_pf_q4, *var_pf_q5, *var_pf_q6, *var_pf_q7, *var_pf_q8;
|
||||
double* var_pf_q[NUM_Q_VAR];
|
||||
double *var_pf_progress;
|
||||
double *var_pf_ob_size, *var_pf_ob_r, *var_pf_ob_g, *var_pf_ob_b, *var_pf_ob_a;
|
||||
double *var_pf_ib_size, *var_pf_ib_r, *var_pf_ib_g, *var_pf_ib_b, *var_pf_ib_a;
|
||||
double *var_pf_mv_x;
|
||||
double *var_pf_mv_y;
|
||||
double *var_pf_mv_dx;
|
||||
double *var_pf_mv_dy;
|
||||
double *var_pf_mv_l;
|
||||
double *var_pf_mv_r;
|
||||
double *var_pf_mv_g;
|
||||
double *var_pf_mv_b;
|
||||
double *var_pf_mv_a;
|
||||
double *var_pf_monitor;
|
||||
double *var_pf_echo_zoom, *var_pf_echo_alpha, *var_pf_echo_orient;
|
||||
// new in v1.04:
|
||||
double *var_pf_wave_usedots, *var_pf_wave_thick, *var_pf_wave_additive, *var_pf_wave_brighten;
|
||||
double *var_pf_darken_center, *var_pf_gamma, *var_pf_wrap;
|
||||
double *var_pf_invert, *var_pf_brighten, *var_pf_darken, *var_pf_solarize;
|
||||
double *var_pf_meshx, *var_pf_meshy;
|
||||
double *var_pf_pixelsx, *var_pf_pixelsy;
|
||||
double *var_pf_aspectx, *var_pf_aspecty;
|
||||
double *var_pf_blur1min;
|
||||
double *var_pf_blur2min;
|
||||
double *var_pf_blur3min;
|
||||
double *var_pf_blur1max;
|
||||
double *var_pf_blur2max;
|
||||
double *var_pf_blur3max;
|
||||
double *var_pf_blur1_edge_darken;
|
||||
|
||||
// for per-vertex expression evaluation:
|
||||
NSEEL_VMCTX m_pv_eel;
|
||||
double *var_pv_zoom, *var_pv_zoomexp, *var_pv_rot, *var_pv_warp, *var_pv_cx, *var_pv_cy, *var_pv_dx, *var_pv_dy, *var_pv_sx, *var_pv_sy;
|
||||
double *var_pv_time, *var_pv_fps;
|
||||
double *var_pv_bass, *var_pv_mid, *var_pv_treb, *var_pv_bass_att, *var_pv_mid_att, *var_pv_treb_att;
|
||||
double *var_pv_x, *var_pv_y, *var_pv_rad, *var_pv_ang;
|
||||
double *var_pv_frame;
|
||||
//double *var_pv_q1, *var_pv_q2, *var_pv_q3, *var_pv_q4, *var_pv_q5, *var_pv_q6, *var_pv_q7, *var_pv_q8;
|
||||
double* var_pv_q[NUM_Q_VAR];
|
||||
double *var_pv_progress;
|
||||
double *var_pv_meshx, *var_pv_meshy;
|
||||
double *var_pv_pixelsx, *var_pv_pixelsy;
|
||||
double *var_pv_aspectx, *var_pv_aspecty;
|
||||
|
||||
double q_values_after_init_code[NUM_Q_VAR];
|
||||
double monitor_after_init_code;
|
||||
|
||||
float GetPresetStartTime() { return m_fPresetStartTime; }
|
||||
float m_fPresetStartTime;
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,361 @@
|
||||
/*
|
||||
LICENSE
|
||||
-------
|
||||
Copyright 2005-2013 Nullsoft, Inc.
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification,
|
||||
are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright notice,
|
||||
this list of conditions and the following disclaimer.
|
||||
|
||||
* Redistributions in binary form must reproduce the above copyright notice,
|
||||
this list of conditions and the following disclaimer in the documentation
|
||||
and/or other materials provided with the distribution.
|
||||
|
||||
* Neither the name of Nullsoft nor the names of its contributors may be used to
|
||||
endorse or promote products derived from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
|
||||
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||
FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
||||
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
|
||||
IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
|
||||
OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include "support.h"
|
||||
#include "utility.h"
|
||||
#include "../Winamp/wa_ipc.h"
|
||||
|
||||
bool g_bDebugOutput = false;
|
||||
bool g_bDumpFileCleared = false;
|
||||
|
||||
//---------------------------------------------------
|
||||
void PrepareFor3DDrawing(
|
||||
IDirect3DDevice9 *pDevice,
|
||||
int viewport_width,
|
||||
int viewport_height,
|
||||
float fov_in_degrees,
|
||||
float near_clip,
|
||||
float far_clip,
|
||||
D3DXVECTOR3* pvEye,
|
||||
D3DXVECTOR3* pvLookat,
|
||||
D3DXVECTOR3* pvUp
|
||||
)
|
||||
{
|
||||
// This function sets up DirectX up for 3D rendering.
|
||||
// Only call it once per frame, as it is VERY slow.
|
||||
// INPUTS:
|
||||
// pDevice a pointer to the D3D device
|
||||
// viewport_width the width of the client area of the window
|
||||
// viewport_height the height of the client area of the window
|
||||
// fov_in_degrees the field of view, in degrees
|
||||
// near_clip the distance to the near clip plane; should be > 0!
|
||||
// far_clip the distance to the far clip plane
|
||||
// eye the eyepoint coordinates, in world space
|
||||
// lookat the point toward which the eye is looking, in world space
|
||||
// up a vector indicating which dir. is up; usually <0,1,0>
|
||||
//
|
||||
// What this function does NOT do:
|
||||
// 1. set the current texture (SetTexture)
|
||||
// 2. set up the texture stages for texturing (SetTextureStageState)
|
||||
// 3. set the current vertex format (SetVertexShader)
|
||||
// 4. set up the world matrix (SetTransform(D3DTS_WORLD, &my_world_matrix))
|
||||
|
||||
|
||||
// set up render state to some nice defaults:
|
||||
{
|
||||
// some defaults
|
||||
pDevice->SetRenderState( D3DRS_ZENABLE, TRUE );
|
||||
pDevice->SetRenderState( D3DRS_ZWRITEENABLE, TRUE );
|
||||
pDevice->SetRenderState( D3DRS_ZFUNC, D3DCMP_LESSEQUAL );
|
||||
pDevice->SetRenderState( D3DRS_CULLMODE, D3DCULL_NONE );
|
||||
pDevice->SetRenderState( D3DRS_CLIPPING, TRUE );
|
||||
pDevice->SetRenderState( D3DRS_LIGHTING, FALSE );
|
||||
pDevice->SetRenderState( D3DRS_COLORVERTEX, TRUE );
|
||||
pDevice->SetRenderState( D3DRS_SHADEMODE, D3DSHADE_GOURAUD );
|
||||
pDevice->SetRenderState( D3DRS_FILLMODE, D3DFILL_SOLID );
|
||||
pDevice->SetRenderState( D3DRS_ALPHABLENDENABLE, FALSE );
|
||||
|
||||
// turn fog off
|
||||
pDevice->SetRenderState( D3DRS_FOGENABLE, FALSE );
|
||||
pDevice->SetRenderState( D3DRS_RANGEFOGENABLE, FALSE );
|
||||
|
||||
// turn on high-quality bilinear interpolations
|
||||
pDevice->SetSamplerState(0, D3DSAMP_MAGFILTER, D3DTEXF_LINEAR);
|
||||
pDevice->SetSamplerState(1, D3DSAMP_MAGFILTER, D3DTEXF_LINEAR);
|
||||
pDevice->SetSamplerState(0, D3DSAMP_MINFILTER, D3DTEXF_LINEAR);
|
||||
pDevice->SetSamplerState(1, D3DSAMP_MINFILTER, D3DTEXF_LINEAR);
|
||||
pDevice->SetSamplerState(0, D3DSAMP_MIPFILTER, D3DTEXF_LINEAR);
|
||||
pDevice->SetSamplerState(1, D3DSAMP_MIPFILTER, D3DTEXF_LINEAR);
|
||||
}
|
||||
|
||||
// set up view & projection matrices (but not the world matrix!)
|
||||
{
|
||||
// if the window is not square, instead of distorting the scene,
|
||||
// clip it so that the longer dimension of the window has the
|
||||
// regular FOV, and the shorter dimension has a reduced FOV.
|
||||
float fov_x = fov_in_degrees * 3.1415927f/180.0f;
|
||||
float fov_y = fov_in_degrees * 3.1415927f/180.0f;
|
||||
float aspect = (float)viewport_height / (float)viewport_width;
|
||||
if (aspect < 1)
|
||||
fov_y *= aspect;
|
||||
else
|
||||
fov_x /= aspect;
|
||||
|
||||
if (near_clip < 0.1f)
|
||||
near_clip = 0.1f;
|
||||
if (far_clip < near_clip + 1.0f)
|
||||
far_clip = near_clip + 1.0f;
|
||||
|
||||
D3DXMATRIX proj;
|
||||
MakeProjectionMatrix(&proj, near_clip, far_clip, fov_x, fov_y);
|
||||
pDevice->SetTransform(D3DTS_PROJECTION, &proj);
|
||||
|
||||
D3DXMATRIX view;
|
||||
pMatrixLookAtLH(&view, pvEye, pvLookat, pvUp);
|
||||
pDevice->SetTransform(D3DTS_VIEW, &view);
|
||||
|
||||
// Optimization note: "You can minimize the number of required calculations
|
||||
// by concatenating your world and view matrices into a world-view matrix
|
||||
// that you set as the world matrix, and then setting the view matrix
|
||||
// to the identity."
|
||||
//D3DXMatrixMultiply(&world, &world, &view);
|
||||
//D3DXMatrixIdentity(&view);
|
||||
}
|
||||
}
|
||||
|
||||
void PrepareFor2DDrawing(IDirect3DDevice9 *pDevice)
|
||||
{
|
||||
// New 2D drawing area will have x,y coords in the range <-1,-1> .. <1,1>
|
||||
// +--------+ Y=-1
|
||||
// | |
|
||||
// | screen | Z=0: front of scene
|
||||
// | | Z=1: back of scene
|
||||
// +--------+ Y=1
|
||||
// X=-1 X=1
|
||||
// NOTE: After calling this, be sure to then call (at least):
|
||||
// 1. SetVertexShader()
|
||||
// 2. SetTexture(), if you need it
|
||||
// before rendering primitives!
|
||||
// Also, be sure your sprites have a z coordinate of 0.
|
||||
pDevice->SetRenderState( D3DRS_ZENABLE, TRUE );
|
||||
pDevice->SetRenderState( D3DRS_ZWRITEENABLE, TRUE );
|
||||
pDevice->SetRenderState( D3DRS_ZFUNC, D3DCMP_LESSEQUAL );
|
||||
pDevice->SetRenderState( D3DRS_SHADEMODE, D3DSHADE_FLAT );
|
||||
pDevice->SetRenderState( D3DRS_FILLMODE, D3DFILL_SOLID );
|
||||
pDevice->SetRenderState( D3DRS_FOGENABLE, FALSE );
|
||||
pDevice->SetRenderState( D3DRS_CULLMODE, D3DCULL_NONE );
|
||||
pDevice->SetRenderState( D3DRS_CLIPPING, TRUE );
|
||||
pDevice->SetRenderState( D3DRS_LIGHTING, FALSE );
|
||||
pDevice->SetRenderState( D3DRS_ALPHABLENDENABLE, FALSE );
|
||||
pDevice->SetRenderState( D3DRS_LOCALVIEWER, FALSE );
|
||||
|
||||
pDevice->SetTexture(0, NULL);
|
||||
pDevice->SetTexture(1, NULL);
|
||||
pDevice->SetSamplerState(0, D3DSAMP_MAGFILTER, D3DTEXF_POINT);//D3DTEXF_LINEAR);
|
||||
pDevice->SetSamplerState(1, D3DSAMP_MAGFILTER, D3DTEXF_POINT);//D3DTEXF_LINEAR);
|
||||
pDevice->SetTextureStageState(0, D3DTSS_TEXTURETRANSFORMFLAGS, D3DTTFF_DISABLE);
|
||||
pDevice->SetTextureStageState(1, D3DTSS_TEXTURETRANSFORMFLAGS, D3DTTFF_DISABLE);
|
||||
pDevice->SetTextureStageState(0, D3DTSS_COLOROP, D3DTOP_MODULATE );
|
||||
pDevice->SetTextureStageState(0, D3DTSS_COLORARG1, D3DTA_TEXTURE );
|
||||
pDevice->SetTextureStageState(0, D3DTSS_COLORARG2, D3DTA_CURRENT );
|
||||
pDevice->SetTextureStageState(1, D3DTSS_COLOROP, D3DTOP_DISABLE );
|
||||
|
||||
pDevice->SetTextureStageState(0, D3DTSS_ALPHAOP, D3DTOP_SELECTARG1 );
|
||||
pDevice->SetTextureStageState(0, D3DTSS_ALPHAARG1, D3DTA_DIFFUSE );
|
||||
pDevice->SetTextureStageState(1, D3DTSS_ALPHAOP, D3DTOP_DISABLE );
|
||||
|
||||
pDevice->SetRenderState( D3DRS_ALPHABLENDENABLE, FALSE );
|
||||
|
||||
// set up for 2D drawing:
|
||||
{
|
||||
D3DXMATRIX Ortho2D;
|
||||
D3DXMATRIX Identity;
|
||||
|
||||
pMatrixOrthoLH(&Ortho2D, 2.0f, -2.0f, 0.0f, 1.0f);
|
||||
D3DXMatrixIdentity(&Identity);
|
||||
|
||||
pDevice->SetTransform(D3DTS_PROJECTION, &Ortho2D);
|
||||
pDevice->SetTransform(D3DTS_WORLD, &Identity);
|
||||
pDevice->SetTransform(D3DTS_VIEW, &Identity);
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------
|
||||
|
||||
void MakeWorldMatrix( D3DXMATRIX* pOut,
|
||||
float xpos, float ypos, float zpos,
|
||||
float sx, float sy, float sz,
|
||||
float pitch, float yaw, float roll)
|
||||
{
|
||||
/*
|
||||
* The m_xPos, m_yPos, m_zPos variables contain the model's
|
||||
* location in world coordinates.
|
||||
* The m_fPitch, m_fYaw, and m_fRoll variables are floats that
|
||||
* contain the model's orientation in terms of pitch, yaw, and roll
|
||||
* angles, in radians.
|
||||
*/
|
||||
|
||||
D3DXMATRIX MatTemp;
|
||||
D3DXMatrixIdentity(pOut);
|
||||
|
||||
// 1. first, rotation
|
||||
if (pitch || yaw || roll)
|
||||
{
|
||||
D3DXMATRIX MatRot;
|
||||
D3DXMatrixIdentity(&MatRot);
|
||||
|
||||
pMatrixRotationX(&MatTemp, pitch); // Pitch
|
||||
pMatrixMultiply(&MatRot, &MatRot, &MatTemp);
|
||||
pMatrixRotationY(&MatTemp, yaw); // Yaw
|
||||
pMatrixMultiply(&MatRot, &MatRot, &MatTemp);
|
||||
pMatrixRotationZ(&MatTemp, roll); // Roll
|
||||
pMatrixMultiply(&MatRot, &MatRot, &MatTemp);
|
||||
|
||||
pMatrixMultiply(pOut, pOut, &MatRot);
|
||||
}
|
||||
|
||||
// 2. then, scaling
|
||||
pMatrixScaling(&MatTemp, sx, sy, sz);
|
||||
pMatrixMultiply(pOut, pOut, &MatTemp);
|
||||
|
||||
// 3. last, translation to final world pos.
|
||||
pMatrixTranslation(&MatTemp, xpos, ypos, zpos);
|
||||
pMatrixMultiply(pOut, pOut, &MatTemp);
|
||||
}
|
||||
|
||||
void MakeProjectionMatrix( D3DXMATRIX* pOut,
|
||||
const float near_plane, // Distance to near clipping plane
|
||||
const float far_plane, // Distance to far clipping plane
|
||||
const float fov_horiz, // Horizontal field of view angle, in radians
|
||||
const float fov_vert) // Vertical field of view angle, in radians
|
||||
{
|
||||
float w = (float)1/tanf(fov_horiz*0.5f); // 1/tan(x) == cot(x)
|
||||
float h = (float)1/tanf(fov_vert*0.5f); // 1/tan(x) == cot(x)
|
||||
float Q = far_plane/(far_plane - near_plane);
|
||||
|
||||
ZeroMemory(pOut, sizeof(D3DXMATRIX));
|
||||
pOut->_11 = w;
|
||||
pOut->_22 = h;
|
||||
pOut->_33 = Q;
|
||||
pOut->_43 = -Q*near_plane;
|
||||
pOut->_34 = 1;
|
||||
}
|
||||
|
||||
void GetWinampSongTitle(HWND hWndWinamp, wchar_t *szSongTitle, int nSize)
|
||||
{
|
||||
szSongTitle[0] = 0;
|
||||
lstrcpynW(szSongTitle, (wchar_t*)SendMessage(hWndWinamp, WM_WA_IPC,
|
||||
SendMessage(hWndWinamp, WM_WA_IPC, 0 , IPC_GETLISTPOS),
|
||||
IPC_GETPLAYLISTTITLEW), nSize);
|
||||
}
|
||||
|
||||
void GetWinampSongPosAsText(HWND hWndWinamp, wchar_t *szSongPos)
|
||||
{
|
||||
// note: size(szSongPos[]) must be at least 64.
|
||||
szSongPos[0] = 0;
|
||||
int nSongPosMS = SendMessage(hWndWinamp,WM_USER,0,105);
|
||||
if (nSongPosMS > 0)
|
||||
{
|
||||
wchar_t tmp[16];
|
||||
float time_s = nSongPosMS*0.001f;
|
||||
int minutes = (int)(time_s/60);
|
||||
time_s -= minutes*60;
|
||||
int seconds = (int)time_s;
|
||||
time_s -= seconds;
|
||||
int dsec = (int)(time_s*100);
|
||||
swprintf(tmp, L"%.02f", dsec/100.0f);
|
||||
swprintf(szSongPos, L"%d:%02d%s", minutes, seconds, tmp+1);
|
||||
}
|
||||
}
|
||||
|
||||
void GetWinampSongLenAsText(HWND hWndWinamp, wchar_t *szSongLen)
|
||||
{
|
||||
// note: size(szSongLen[]) must be at least 64.
|
||||
szSongLen[0] = 0;
|
||||
int nSongLenMS = SendMessage(hWndWinamp,WM_USER,1,105)*1000;
|
||||
if (nSongLenMS > 0)
|
||||
{
|
||||
int len_s = nSongLenMS/1000;
|
||||
int minutes = len_s/60;
|
||||
int seconds = len_s - minutes*60;
|
||||
swprintf(szSongLen, L"%d:%02d", minutes, seconds);
|
||||
}
|
||||
}
|
||||
|
||||
float GetWinampSongPos(HWND hWndWinamp)
|
||||
{
|
||||
// returns answer in seconds
|
||||
return (float)SendMessage(hWndWinamp,WM_USER,0,105)*0.001f;
|
||||
}
|
||||
|
||||
float GetWinampSongLen(HWND hWndWinamp)
|
||||
{
|
||||
// returns answer in seconds
|
||||
return (float)SendMessage(hWndWinamp,WM_USER,1,105);
|
||||
}
|
||||
|
||||
int GetDX9TexFormatBitsPerPixel(D3DFORMAT fmt)
|
||||
{
|
||||
switch(fmt)
|
||||
{
|
||||
case D3DFMT_DXT1: // 64 bits for each 4x4 pixels = 4 bits per pixel. No Alpha channel.
|
||||
return 4; // bytes per pixel
|
||||
|
||||
case D3DFMT_DXT2: // 128 bits for each 4x4 pixels = 8 bits per pixel. RGB+A.
|
||||
case D3DFMT_DXT3: // 128 bits for each 4x4 pixels = 8 bits per pixel. RGB+A.
|
||||
case D3DFMT_DXT4: // 128 bits for each 4x4 pixels = 8 bits per pixel. RGB+A.
|
||||
case D3DFMT_DXT5: // 128 bits for each 4x4 pixels = 8 bits per pixel. RGB+A.
|
||||
case D3DFMT_R3G3B2: // 8-bit RGB texture format using 3 bits for red, 3 bits for green, and 2 bits for blue.
|
||||
case D3DFMT_A8: // 8-bit alpha only.
|
||||
case D3DFMT_A8P8: // 8-bit color indexed with 8 bits of alpha.
|
||||
case D3DFMT_P8: // 8-bit color indexed.
|
||||
case D3DFMT_L8: // 8-bit luminance only.
|
||||
case D3DFMT_A4L4: // 8-bit using 4 bits each for alpha and luminance.
|
||||
return 8;
|
||||
|
||||
case D3DFMT_R5G6B5: // 16-bit RGB pixel format with 5 bits for red, 6 bits for green, and 5 bits for blue.
|
||||
case D3DFMT_X1R5G5B5: // 16-bit pixel format where 5 bits are reserved for each color.
|
||||
case D3DFMT_A1R5G5B5: // 16-bit pixel format where 5 bits are reserved for each color and 1 bit is reserved for alpha.
|
||||
case D3DFMT_A4R4G4B4: // 16-bit ARGB pixel format with 4 bits for each channel.
|
||||
case D3DFMT_R16F:
|
||||
case D3DFMT_A8R3G3B2: // 16-bit ARGB texture format using 8 bits for alpha, 3 bits each for red and green, and 2 bits for blue.
|
||||
case D3DFMT_X4R4G4B4: // 16-bit RGB pixel format using 4 bits for each color.
|
||||
case D3DFMT_L16: // 16-bit luminance only.
|
||||
case D3DFMT_A8L8: // 16-bit using 8 bits each for alpha and luminance.
|
||||
case D3DFMT_CxV8U8:
|
||||
case D3DFMT_V8U8:
|
||||
case D3DFMT_L6V5U5:
|
||||
return 16;
|
||||
|
||||
case D3DFMT_G16R16F:
|
||||
case D3DFMT_R32F: // 32-bit float format using 32 bits for the red channel.
|
||||
case D3DFMT_A8R8G8B8: // 32-bit ARGB pixel format with alpha, using 8 bits per channel.
|
||||
case D3DFMT_X8R8G8B8: // 32-bit RGB pixel format, where 8 bits are reserved for each color.
|
||||
case D3DFMT_A8B8G8R8: // 32-bit ARGB pixel format with alpha, using 8 bits per channel.
|
||||
case D3DFMT_X8B8G8R8: // 32-bit RGB pixel format, where 8 bits are reserved for each color.
|
||||
case D3DFMT_G16R16: // 32-bit pixel format using 16 bits each for green and red.
|
||||
case D3DFMT_A2R10G10B10: // 32-bit pixel format using 10 bits each for red, green, and blue, and 2 bits for alpha.
|
||||
case D3DFMT_A2B10G10R10: // 32-bit pixel format using 10 bits for each color and 2 bits for alpha.
|
||||
case D3DFMT_R8G8B8: // 24-bit RGB pixel format with 8 bits per channel.
|
||||
case D3DFMT_X8L8V8U8:
|
||||
case D3DFMT_Q8W8V8U8:
|
||||
case D3DFMT_V16U16:
|
||||
return 32;
|
||||
|
||||
case D3DFMT_A16B16G16R16F:
|
||||
case D3DFMT_A16B16G16R16: // 64-bit pixel format using 16 bits for each component.
|
||||
case D3DFMT_G32R32F: // 64-bit float format using 32 bits for the red channel and 32 bits for the green channel.
|
||||
return 64;
|
||||
|
||||
case D3DFMT_A32B32G32R32F:
|
||||
return 128;
|
||||
}
|
||||
|
||||
return 32;
|
||||
}
|
||||
@@ -0,0 +1,109 @@
|
||||
/*
|
||||
LICENSE
|
||||
-------
|
||||
Copyright 2005-2013 Nullsoft, Inc.
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification,
|
||||
are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright notice,
|
||||
this list of conditions and the following disclaimer.
|
||||
|
||||
* Redistributions in binary form must reproduce the above copyright notice,
|
||||
this list of conditions and the following disclaimer in the documentation
|
||||
and/or other materials provided with the distribution.
|
||||
|
||||
* Neither the name of Nullsoft nor the names of its contributors may be used to
|
||||
endorse or promote products derived from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
|
||||
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||
FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
||||
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
|
||||
IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
|
||||
OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifndef __NULLSOFT_DX9_EXAMPLE_PLUGIN_SUPPORT_H__
|
||||
#define __NULLSOFT_DX9_EXAMPLE_PLUGIN_SUPPORT_H__ 1
|
||||
|
||||
#include <d3dx9.h>
|
||||
|
||||
void MakeWorldMatrix( D3DXMATRIX* pOut,
|
||||
float xpos, float ypos, float zpos,
|
||||
float sx, float sy, float sz,
|
||||
float pitch, float yaw, float roll);
|
||||
void MakeProjectionMatrix( D3DXMATRIX* pOut,
|
||||
const float near_plane, // Distance to near clipping plane
|
||||
const float far_plane, // Distance to far clipping plane
|
||||
const float fov_horiz, // Horizontal field of view angle, in radians
|
||||
const float fov_vert); // Vertical field of view angle, in radians
|
||||
void PrepareFor3DDrawing(
|
||||
IDirect3DDevice9 *pDevice,
|
||||
int viewport_width,
|
||||
int viewport_height,
|
||||
float fov_in_degrees,
|
||||
float near_clip,
|
||||
float far_clip,
|
||||
D3DXVECTOR3* pvEye,
|
||||
D3DXVECTOR3* pvLookat,
|
||||
D3DXVECTOR3* pvUp
|
||||
);
|
||||
void PrepareFor2DDrawing(IDirect3DDevice9 *pDevice);
|
||||
|
||||
// Define vertex formats you'll be using here:
|
||||
// note: layout must match the vertex declaration in plugin.cpp!
|
||||
typedef struct _MYVERTEX
|
||||
{
|
||||
float x, y, z; // screen position + Z-buffer depth
|
||||
DWORD Diffuse; // diffuse color
|
||||
float tu, tv; // DYNAMIC
|
||||
float tu_orig, tv_orig; // STATIC
|
||||
float rad, ang; // STATIC
|
||||
} MYVERTEX, *LPMYVERTEX;
|
||||
|
||||
// note: layout must match the vertex declaration in plugin.cpp!
|
||||
typedef struct _WFVERTEX
|
||||
{
|
||||
float x, y, z;
|
||||
DWORD Diffuse; // diffuse color. also acts as filler; aligns struct to 16 bytes (good for random access/indexed prims)
|
||||
} WFVERTEX, *LPWFVERTEX;
|
||||
|
||||
// note: layout must match the vertex declaration in plugin.cpp!
|
||||
typedef struct _SPRITEVERTEX
|
||||
{
|
||||
float x, y; // screen position
|
||||
float z; // Z-buffer depth
|
||||
DWORD Diffuse; // diffuse color. also acts as filler; aligns struct to 16 bytes (good for random access/indexed prims)
|
||||
float tu, tv; // texture coordinates for texture #0
|
||||
} SPRITEVERTEX, *LPSPRITEVERTEX;
|
||||
|
||||
// Also prepare vertex format descriptors for each
|
||||
// of the 3 kinds of vertices we'll be using:
|
||||
// note: D3DFVF_TEXCOORDSIZEm(n): m = the dimension, n = the index
|
||||
// AVOID D3DFVF_TEXCOORDSIZE4 - I've seen probs (blending between shader and non-shader presets) on vaio laptop w/6200!
|
||||
#define MYVERTEX_FORMAT (D3DFVF_XYZ | D3DFVF_DIFFUSE | D3DFVF_TEX3 | D3DFVF_TEXCOORDSIZE2(0) | D3DFVF_TEXCOORDSIZE2(1) | D3DFVF_TEXCOORDSIZE2(2))
|
||||
#define WFVERTEX_FORMAT (D3DFVF_XYZ | D3DFVF_DIFFUSE )
|
||||
#define SPRITEVERTEX_FORMAT (D3DFVF_XYZ | D3DFVF_DIFFUSE | D3DFVF_TEX1 | D3DFVF_TEXCOORDSIZE2(0) )
|
||||
|
||||
void GetWinampSongTitle(HWND hWndWinamp, wchar_t *szSongTitle, int nSize);
|
||||
void GetWinampSongPosAsText(HWND hWndWinamp, wchar_t *szSongPos);
|
||||
void GetWinampSongLenAsText(HWND hWndWinamp, wchar_t *szSongLen);
|
||||
float GetWinampSongPos(HWND hWndWinamp); // returns answer in seconds
|
||||
float GetWinampSongLen(HWND hWndWinamp); // returns answer in seconds
|
||||
|
||||
//#define PROFILING
|
||||
#ifdef PROFILING
|
||||
#define PROFILE_BEGIN LARGE_INTEGER tx, freq, ty; QueryPerformanceCounter(&tx); QueryPerformanceFrequency(&freq);
|
||||
#define PROFILE_END(s) { QueryPerformanceCounter(&ty); float dt = (float)((double)(ty.QuadPart - tx.QuadPart) / (double)freq.QuadPart); char buf[256]; sprintf(buf, " %s = %.1f ms\n", s, dt*1000 ); OutputDebugString(buf); tx = ty; }
|
||||
#else
|
||||
#define PROFILE_BEGIN
|
||||
#define PROFILE_END(s)
|
||||
#endif
|
||||
|
||||
int GetDX9TexFormatBitsPerPixel(D3DFORMAT fmt);
|
||||
|
||||
#endif
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 7.2 KiB |
@@ -0,0 +1,752 @@
|
||||
/*
|
||||
LICENSE
|
||||
-------
|
||||
Copyright 2005-2013 Nullsoft, Inc.
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification,
|
||||
are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright notice,
|
||||
this list of conditions and the following disclaimer.
|
||||
|
||||
* Redistributions in binary form must reproduce the above copyright notice,
|
||||
this list of conditions and the following disclaimer in the documentation
|
||||
and/or other materials provided with the distribution.
|
||||
|
||||
* Neither the name of Nullsoft nor the names of its contributors may be used to
|
||||
endorse or promote products derived from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
|
||||
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||
FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
||||
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
|
||||
IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
|
||||
OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include "texmgr.h"
|
||||
//#include "jpegstuff.h"
|
||||
//#include "evallib/compiler.h"
|
||||
#include "ns-eel2/ns-eel.h"
|
||||
#include "support.h"
|
||||
#include "plugin.h"
|
||||
#include "utility.h"
|
||||
texmgr::texmgr()
|
||||
{
|
||||
}
|
||||
|
||||
texmgr::~texmgr()
|
||||
{
|
||||
//Finish();
|
||||
// DO NOT RELEASE OR DELETE m_lpDD; CLIENT SHOULD DO THIS!
|
||||
}
|
||||
|
||||
void texmgr::Finish()
|
||||
{
|
||||
for (int i=0; i<NUM_TEX; i++)
|
||||
{
|
||||
KillTex(i);
|
||||
/*
|
||||
if (m_tex[i].pSurface)
|
||||
{
|
||||
m_tex[i].pSurface->Release();
|
||||
m_tex[i].pSurface = NULL;
|
||||
}
|
||||
|
||||
FreeCode(i);
|
||||
FreeVars(i);
|
||||
*/
|
||||
NSEEL_VM_free(m_tex[i].tex_eel_ctx);
|
||||
}
|
||||
|
||||
// DO NOT RELEASE OR DELETE m_lpDD; CLIENT SHOULD DO THIS!
|
||||
}
|
||||
|
||||
void texmgr::Init(LPDIRECT3DDEVICE9 lpDD)
|
||||
{
|
||||
m_lpDD = lpDD;
|
||||
|
||||
for (int i=0; i<NUM_TEX; i++)
|
||||
{
|
||||
m_tex[i].pSurface = NULL;
|
||||
m_tex[i].szFileName[0] = 0;
|
||||
m_tex[i].m_codehandle = NULL;
|
||||
m_tex[i].m_szExpr[0] = 0;
|
||||
m_tex[i].tex_eel_ctx = NSEEL_VM_alloc();
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
bool texmgr::TryCreateDDrawSurface(int iSlot, int w, int h)
|
||||
{
|
||||
int loop = 1;
|
||||
int done = 0;
|
||||
int scaling = false;
|
||||
|
||||
do
|
||||
{
|
||||
//TEMP!!!
|
||||
//w = 2048;
|
||||
//h = 2048;
|
||||
switch(loop)
|
||||
{
|
||||
case 0:
|
||||
// first, try requesting surface w/original dimensions of image
|
||||
break;
|
||||
case 1:
|
||||
// then, try next-highest-power-of-two for w,h
|
||||
w = (int)powf(2.0f, ceilf(logf((float)w)/logf(2.0f)));
|
||||
h = (int)powf(2.0f, ceilf(logf((float)h)/logf(2.0f)));
|
||||
break;
|
||||
case 2:
|
||||
// then, try making it square
|
||||
if (w < h) w = h;
|
||||
if (h < w) h = w;
|
||||
break;
|
||||
default:
|
||||
if (!scaling)
|
||||
{
|
||||
if (w<256 || h<256)
|
||||
{
|
||||
w *= 2;
|
||||
h *= 2;
|
||||
}
|
||||
else
|
||||
{
|
||||
scaling = true;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (w>16 && h>16)
|
||||
{
|
||||
w /= 2;
|
||||
h /= 2;
|
||||
}
|
||||
else
|
||||
{
|
||||
done = 1;
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
if (done)
|
||||
break;
|
||||
|
||||
// TRY TO CREATE THE SURFACE IN SYSTEM MEMORY.
|
||||
ZeroMemory(&ddsd, sizeof(DDSURFACEDESC2));
|
||||
ddsd.dwSize = sizeof( ddsd );
|
||||
ddsd.dwFlags = DDSD_CAPS | DDSD_HEIGHT | DDSD_WIDTH;
|
||||
ddsd.ddsCaps.dwCaps = DDSCAPS_TEXTURE;//DDSCAPS_OFFSCREENPLAIN | DDSCAPS_SYSTEMMEMORY;// | DDSCAPS_3DDEVICE;// | DDSCAPS_LOCALVIDMEM | DDSCAPS_VIDEOMEMORY;
|
||||
ddsd.dwWidth = w;
|
||||
ddsd.dwHeight = h;
|
||||
|
||||
m_tex[iSlot].pSurface = NULL;
|
||||
//if (w<256 && h<256)
|
||||
if (m_lpDD->CreateSurface( &ddsd, &m_tex[iSlot].pSurface, NULL ) == DD_OK)
|
||||
break;
|
||||
m_tex[iSlot].pSurface = NULL;
|
||||
|
||||
loop++;
|
||||
}
|
||||
while (!done);
|
||||
|
||||
if (m_tex[iSlot].pSurface == NULL)
|
||||
return false;
|
||||
|
||||
// find out (& remember) actual size created:
|
||||
ZeroMemory(&ddsd, sizeof(ddsd));
|
||||
ddsd.dwSize = sizeof(ddsd);
|
||||
m_tex[iSlot].pSurface->GetSurfaceDesc(&ddsd);
|
||||
m_tex[iSlot].tex_w = ddsd.dwWidth;
|
||||
m_tex[iSlot].tex_h = ddsd.dwHeight;
|
||||
m_tex[iSlot].scale_x = 1.0f;
|
||||
m_tex[iSlot].scale_y = 1.0f;
|
||||
|
||||
memcpy(&m_tex[iSlot].ddpf, &ddsd.ddpfPixelFormat, sizeof(DDPIXELFORMAT));
|
||||
|
||||
return true;
|
||||
}
|
||||
*/
|
||||
|
||||
int texmgr::LoadTex(wchar_t *szFilename, int iSlot, char *szInitCode, char *szCode, float time, int frame, unsigned int ck)
|
||||
{
|
||||
if (iSlot < 0) return TEXMGR_ERR_BAD_INDEX;
|
||||
if (iSlot >= NUM_TEX) return TEXMGR_ERR_BAD_INDEX;
|
||||
|
||||
// first, if this texture is already loaded, just add another instance.
|
||||
bool bTextureInstanced = false;
|
||||
{
|
||||
for (int x=0; x<NUM_TEX; x++)
|
||||
if (m_tex[x].pSurface && _wcsicmp(m_tex[x].szFileName, szFilename)==0)
|
||||
{
|
||||
memcpy(&m_tex[iSlot], &m_tex[x], sizeof(td_tex));
|
||||
m_tex[iSlot].m_szExpr[0] = 0;
|
||||
m_tex[iSlot].m_codehandle = 0;
|
||||
|
||||
bTextureInstanced = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!bTextureInstanced)
|
||||
{
|
||||
// Free old resources:
|
||||
/*
|
||||
if (m_tex[iSlot].pSurface)
|
||||
{
|
||||
m_tex[iSlot].pSurface->Release();
|
||||
m_tex[iSlot].pSurface = NULL;
|
||||
}*/
|
||||
KillTex(iSlot);
|
||||
|
||||
wcscpy(m_tex[iSlot].szFileName, szFilename);
|
||||
|
||||
D3DXIMAGE_INFO info;
|
||||
HRESULT hr = pCreateTextureFromFileExW(
|
||||
m_lpDD,
|
||||
szFilename,
|
||||
D3DX_DEFAULT,
|
||||
D3DX_DEFAULT,
|
||||
D3DX_DEFAULT, // create a mip chain
|
||||
0,
|
||||
D3DFMT_UNKNOWN,
|
||||
D3DPOOL_DEFAULT,
|
||||
D3DX_DEFAULT,
|
||||
D3DX_DEFAULT,
|
||||
0xFF000000 | ck,
|
||||
&info,
|
||||
NULL,
|
||||
&m_tex[iSlot].pSurface
|
||||
);
|
||||
|
||||
if (hr != D3D_OK)
|
||||
{
|
||||
switch(hr)
|
||||
{
|
||||
case E_OUTOFMEMORY:
|
||||
case D3DERR_OUTOFVIDEOMEMORY:
|
||||
return TEXMGR_ERR_OUTOFMEM;
|
||||
default:
|
||||
return TEXMGR_ERR_BADFILE;
|
||||
}
|
||||
}
|
||||
|
||||
m_tex[iSlot].img_w = info.Width;
|
||||
m_tex[iSlot].img_h = info.Height;
|
||||
|
||||
/*
|
||||
unsigned int w_img;
|
||||
unsigned int h_img;
|
||||
unsigned int img_color_channels;
|
||||
|
||||
int ret = Begin_Jpeg_Read(szFilename, &w_img, &h_img, &img_color_channels);
|
||||
switch(ret)
|
||||
{
|
||||
case JPEGSTUFF_ERR_SUCCESS:
|
||||
break;
|
||||
case JPEGSTUFF_ERR_OPENING:
|
||||
return TEXMGR_ERR_OPENING;
|
||||
break;
|
||||
case JPEGSTUFF_ERR_MISC:
|
||||
return TEXMGR_ERR_FORMAT;
|
||||
break;
|
||||
}
|
||||
|
||||
sprintf(buf, "texmgr: w=%d, h=%d, channels=%d", w_img, h_img, img_color_channels);
|
||||
//g_dumpmsg(buf);
|
||||
|
||||
m_tex[iSlot].img_w = w_img;
|
||||
m_tex[iSlot].img_h = h_img;
|
||||
|
||||
if (img_color_channels != 3)
|
||||
{
|
||||
// error: not 24-bit!
|
||||
//g_dumpmsg("texmgr: image not 24-bit");
|
||||
End_Jpeg_Read();
|
||||
return TEXMGR_ERR_IMAGE_NOT_24_BIT;
|
||||
}
|
||||
|
||||
if ((w_img > 2048) ||
|
||||
(h_img > 2048)) // RG
|
||||
{
|
||||
// error: too large!
|
||||
//g_dumpmsg("texmgr: image too large");
|
||||
End_Jpeg_Read();
|
||||
return TEXMGR_ERR_IMAGE_TOO_LARGE;
|
||||
}
|
||||
|
||||
if (!TryCreateDDrawSurface(iSlot, w_img, h_img))
|
||||
{
|
||||
//g_dumpmsg("texmgr: unable to create ddraw surface");
|
||||
End_Jpeg_Read();
|
||||
return TEXMGR_ERR_CREATESURFACE_FAILED;
|
||||
}
|
||||
|
||||
unsigned int w_tex = m_tex[iSlot].tex_w;
|
||||
unsigned int h_tex = m_tex[iSlot].tex_h;
|
||||
unsigned int bpp_tex = m_tex[iSlot].ddpf.dwRGBBitCount;
|
||||
|
||||
sprintf(buf, "texmgr: created ddraw surface; %d x %d x %d", w_tex, h_tex, bpp_tex);
|
||||
//g_dumpmsg(buf);
|
||||
|
||||
DDSURFACEDESC2 ddsd;
|
||||
ZeroMemory(&ddsd, sizeof(DDSURFACEDESC2));
|
||||
ddsd.dwSize = sizeof( ddsd );
|
||||
|
||||
if (m_tex[iSlot].pSurface->Lock(0, &ddsd, DDLOCK_SURFACEMEMORYPTR|DDLOCK_WAIT|DDLOCK_NOSYSLOCK, 0) != DD_OK)
|
||||
{
|
||||
//g_dumpmsg("texmgr: unable to lock ddraw surface");
|
||||
End_Jpeg_Read();
|
||||
m_tex[iSlot].pSurface->Release();
|
||||
m_tex[iSlot].pSurface = NULL;
|
||||
return TEXMGR_ERR_LOCKSURFACE_FAILED;
|
||||
}
|
||||
|
||||
// analyze surface pixel format
|
||||
unsigned int zeroBits[3] = { 0, 0, 0 };
|
||||
unsigned int chopBits[3] = { 8, 8, 8 };
|
||||
unsigned int mask[3] = { ddsd.ddpfPixelFormat.dwRBitMask, ddsd.ddpfPixelFormat.dwGBitMask, ddsd.ddpfPixelFormat.dwBBitMask };
|
||||
|
||||
{
|
||||
int x,y;
|
||||
|
||||
for (x=0; x<3; x++)
|
||||
{
|
||||
for (y=0; y<32; y++)
|
||||
{
|
||||
if ((mask[x] & (1<<y)) == 0)
|
||||
zeroBits[x]++;
|
||||
else
|
||||
break;
|
||||
}
|
||||
mask[x] >>= zeroBits[x];
|
||||
for (y=0; y<32; y++)
|
||||
{
|
||||
if ((mask[x] & (1<<y)) != 0)
|
||||
chopBits[x]--;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
unsigned int ck_r1 = (ck_lo >> 16) & 0xFF;
|
||||
unsigned int ck_g1 = (ck_lo >> 8 ) & 0xFF;
|
||||
unsigned int ck_b1 = (ck_lo ) & 0xFF;
|
||||
unsigned int ck_r2 = (ck_hi >> 16) & 0xFF;
|
||||
unsigned int ck_g2 = (ck_hi >> 8 ) & 0xFF;
|
||||
unsigned int ck_b2 = (ck_hi ) & 0xFF;
|
||||
|
||||
// read jpeg in & store in directdraw surface
|
||||
// 2. read image into texture
|
||||
if (w_img > w_tex || h_img > h_tex)
|
||||
{
|
||||
// DOWNSAMPLING VERSION
|
||||
|
||||
unsigned int new_w_img = min(w_tex, w_img);
|
||||
unsigned int new_h_img = min(h_tex, h_img);
|
||||
|
||||
{
|
||||
char buf[256];
|
||||
sprintf(buf, "texmgr: downsampling image from %dx%d to %dx%d and storing in %dx%d texture.", w_img,h_img, new_w_img,new_h_img, w_tex,h_tex);
|
||||
//g_dumpmsg(buf);
|
||||
}
|
||||
|
||||
int downsample_buf[2048*3];
|
||||
memset(downsample_buf, 0, sizeof(downsample_buf));
|
||||
|
||||
float input_lines_per_output_line = h_img/(float)new_h_img;
|
||||
float lines = 0.0f;
|
||||
unsigned int out_y = 0;
|
||||
|
||||
for (int y=0; y<(int)h_img; y++)
|
||||
{
|
||||
unsigned int x;
|
||||
|
||||
unsigned char *buf = Jpeg_Read_Next_Line();
|
||||
if (!buf)
|
||||
{
|
||||
End_Jpeg_Read();
|
||||
m_tex[iSlot].pSurface->Release();
|
||||
m_tex[iSlot].pSurface = NULL;
|
||||
return TEXMGR_ERR_CORRUPT_JPEG;
|
||||
}
|
||||
|
||||
lines += 1.0f;
|
||||
int portion = (int)(min(256, max(0, (input_lines_per_output_line - lines)*256)));
|
||||
for (x=0; x<w_img*3; x++)
|
||||
downsample_buf[x] += ((int)buf[x] * portion) >> 4;
|
||||
|
||||
if (portion < 256)
|
||||
{
|
||||
// commit this line (out_y) & start a new one
|
||||
if (out_y < h_tex)
|
||||
{
|
||||
float input_cols_per_output_col = w_img/(float)new_w_img;
|
||||
float cols = 0.0f;
|
||||
int out_x = 0;
|
||||
|
||||
int buf2[2048*3];
|
||||
memset(buf2, 0, new_w_img*3);
|
||||
|
||||
for (x=0; x<w_img; x++)
|
||||
{
|
||||
cols += 1.0f;
|
||||
int portion = (int)(min(256, max(0, (input_cols_per_output_col - cols)*256)));
|
||||
buf2[out_x*3 ] += (downsample_buf[x*3 ] * portion) >> 4;
|
||||
buf2[out_x*3+1] += (downsample_buf[x*3+1] * portion) >> 4;
|
||||
buf2[out_x*3+2] += (downsample_buf[x*3+2] * portion) >> 4;
|
||||
|
||||
if (portion < 256)
|
||||
{
|
||||
cols -= input_cols_per_output_col;
|
||||
portion = 256 - portion;
|
||||
out_x++;
|
||||
buf2[out_x*3 ] = (downsample_buf[x*3 ] * portion) >> 4;
|
||||
buf2[out_x*3+1] = (downsample_buf[x*3+1] * portion) >> 4;
|
||||
buf2[out_x*3+2] = (downsample_buf[x*3+2] * portion) >> 4;
|
||||
}
|
||||
}
|
||||
|
||||
// now buf2[0..w_tex] has r,g,b colors in it (but scaled) -> SAVE TO TEXTURE.
|
||||
float scale_factor = 1.0f / (float)(16 * 16 * input_cols_per_output_col * input_lines_per_output_line);
|
||||
|
||||
if (bpp_tex == 16)
|
||||
{
|
||||
unsigned __int16 *dest16 = (unsigned __int16 *)ddsd.lpSurface;
|
||||
unsigned int tex_offset = (ddsd.lPitch/2) * out_y;
|
||||
for (x=0; x<new_w_img; x++)
|
||||
{
|
||||
unsigned int cr = (unsigned int)(buf2[x*3 ]*scale_factor);
|
||||
unsigned int cg = (unsigned int)(buf2[x*3+1]*scale_factor);
|
||||
unsigned int cb = (unsigned int)(buf2[x*3+2]*scale_factor);
|
||||
unsigned int color = (((cr >> chopBits[0]) & mask[0]) << zeroBits[0]) |
|
||||
(((cg >> chopBits[1]) & mask[1]) << zeroBits[1]) |
|
||||
(((cb >> chopBits[2]) & mask[2]) << zeroBits[2]);
|
||||
if (!(cr >= ck_r1 && cr <= ck_r2 &&
|
||||
cg >= ck_g1 && cg <= ck_g2 &&
|
||||
cb >= ck_b1 && cb <= ck_b2))
|
||||
color |= ddsd.ddpfPixelFormat.dwRGBAlphaBitMask;
|
||||
dest16[tex_offset++] = color;
|
||||
}
|
||||
}
|
||||
else if (bpp_tex == 32)
|
||||
{
|
||||
unsigned __int32 *dest32 = (unsigned __int32 *)ddsd.lpSurface;
|
||||
unsigned int tex_offset = (ddsd.lPitch/4) * out_y;
|
||||
for (x=0; x<new_w_img; x++)
|
||||
{
|
||||
unsigned int cr = (unsigned int)(buf2[x*3 ]*scale_factor);
|
||||
unsigned int cg = (unsigned int)(buf2[x*3+1]*scale_factor);
|
||||
unsigned int cb = (unsigned int)(buf2[x*3+2]*scale_factor);
|
||||
unsigned int color = (cr << zeroBits[0]) | (cg << zeroBits[1]) | (cb << zeroBits[2]);
|
||||
if (!(cr >= ck_r1 && cr <= ck_r2 &&
|
||||
cg >= ck_g1 && cg <= ck_g2 &&
|
||||
cb >= ck_b1 && cb <= ck_b2))
|
||||
color |= ddsd.ddpfPixelFormat.dwRGBAlphaBitMask;
|
||||
dest32[tex_offset++] = color;
|
||||
}
|
||||
}
|
||||
|
||||
out_y++;
|
||||
|
||||
}
|
||||
|
||||
// start next line:
|
||||
lines -= input_lines_per_output_line;
|
||||
portion = 256 - portion;
|
||||
for (x=0; x<w_img*3; x++)
|
||||
downsample_buf[x] = ((int)buf[x] * portion) >> 4;
|
||||
}
|
||||
}
|
||||
|
||||
m_tex[iSlot].scale_x = new_w_img/(float)w_img;
|
||||
m_tex[iSlot].scale_y = new_h_img/(float)h_img;
|
||||
m_tex[iSlot].img_w = new_w_img;
|
||||
m_tex[iSlot].img_h = new_h_img;
|
||||
w_img = new_w_img;
|
||||
h_img = new_h_img;
|
||||
}
|
||||
else
|
||||
{
|
||||
// 1:1 VERSION
|
||||
|
||||
if (bpp_tex == 16)
|
||||
{
|
||||
unsigned __int16 *dest16 = (unsigned __int16 *)ddsd.lpSurface;
|
||||
for (int y=0; y<(int)h_img; y++)
|
||||
{
|
||||
unsigned char *buf = Jpeg_Read_Next_Line();
|
||||
if (!buf)
|
||||
{
|
||||
End_Jpeg_Read();
|
||||
m_tex[iSlot].pSurface->Release();
|
||||
m_tex[iSlot].pSurface = NULL;
|
||||
return TEXMGR_ERR_CORRUPT_JPEG;
|
||||
}
|
||||
|
||||
unsigned int tex_offset = (ddsd.lPitch/2) * y;
|
||||
for (unsigned int x=0; x<w_img; x++)
|
||||
{
|
||||
unsigned int cr = buf[x*3 ];
|
||||
unsigned int cg = buf[x*3+1];
|
||||
unsigned int cb = buf[x*3+2];
|
||||
unsigned int color = (((cr >> chopBits[0]) & mask[0]) << zeroBits[0]) |
|
||||
(((cg >> chopBits[1]) & mask[1]) << zeroBits[1]) |
|
||||
(((cb >> chopBits[2]) & mask[2]) << zeroBits[2]);
|
||||
if (!(cr >= ck_r1 && cr <= ck_r2 &&
|
||||
cg >= ck_g1 && cg <= ck_g2 &&
|
||||
cb >= ck_b1 && cb <= ck_b2))
|
||||
color |= ddsd.ddpfPixelFormat.dwRGBAlphaBitMask;
|
||||
dest16[tex_offset++] = color;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (bpp_tex == 32)
|
||||
{
|
||||
unsigned __int32 *dest32 = (unsigned __int32 *)ddsd.lpSurface;
|
||||
for (int y=0; y<(int)h_img; y++)
|
||||
{
|
||||
unsigned char *buf = Jpeg_Read_Next_Line();
|
||||
if (!buf)
|
||||
{
|
||||
End_Jpeg_Read();
|
||||
m_tex[iSlot].pSurface->Release();
|
||||
m_tex[iSlot].pSurface = NULL;
|
||||
return TEXMGR_ERR_CORRUPT_JPEG;
|
||||
}
|
||||
|
||||
unsigned int tex_offset = (ddsd.lPitch/4) * y;
|
||||
for (unsigned int x=0; x<w_img; x++)
|
||||
{
|
||||
unsigned int cr = buf[x*3 ];
|
||||
unsigned int cg = buf[x*3+1];
|
||||
unsigned int cb = buf[x*3+2];
|
||||
unsigned int color = (cr << zeroBits[0]) | (cg << zeroBits[1]) | (cb << zeroBits[2]);
|
||||
if (!(cr >= ck_r1 && cr <= ck_r2 &&
|
||||
cg >= ck_g1 && cg <= ck_g2 &&
|
||||
cb >= ck_b1 && cb <= ck_b2))
|
||||
color |= ddsd.ddpfPixelFormat.dwRGBAlphaBitMask;
|
||||
dest32[tex_offset++] = color;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
m_tex[iSlot].pSurface->Unlock(0);
|
||||
|
||||
End_Jpeg_Read();
|
||||
*/
|
||||
}
|
||||
|
||||
m_tex[iSlot].fStartTime = time;
|
||||
m_tex[iSlot].nStartFrame = frame;
|
||||
|
||||
int ret = TEXMGR_ERR_SUCCESS;
|
||||
|
||||
// compile & run init. code:
|
||||
if (!RunInitCode(iSlot, szInitCode))
|
||||
ret |= TEXMGR_WARN_ERROR_IN_INIT_CODE;
|
||||
|
||||
// compile & save per-frame code:
|
||||
strcpy(m_tex[iSlot].m_szExpr, szCode);
|
||||
FreeCode(iSlot);
|
||||
if (!RecompileExpressions(iSlot))
|
||||
ret |= TEXMGR_WARN_ERROR_IN_REG_CODE;
|
||||
|
||||
//g_dumpmsg("texmgr: success");
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
void texmgr::KillTex(int iSlot)
|
||||
{
|
||||
if (iSlot < 0) return;
|
||||
if (iSlot >= NUM_TEX) return;
|
||||
|
||||
// Free old resources:
|
||||
if (m_tex[iSlot].pSurface)
|
||||
{
|
||||
// first, make sure no other sprites reference this texture!
|
||||
int refcount = 0;
|
||||
for (int x=0; x<NUM_TEX; x++)
|
||||
if (m_tex[x].pSurface == m_tex[iSlot].pSurface)
|
||||
refcount++;
|
||||
|
||||
if (refcount==1)
|
||||
m_tex[iSlot].pSurface->Release();
|
||||
m_tex[iSlot].pSurface = NULL;
|
||||
}
|
||||
m_tex[iSlot].szFileName[0] = 0;
|
||||
|
||||
FreeCode(iSlot);
|
||||
}
|
||||
|
||||
void texmgr::StripLinefeedCharsAndComments(char *src, char *dest)
|
||||
{
|
||||
// replaces all LINEFEED_CONTROL_CHAR characters in src with a space in dest;
|
||||
// also strips out all comments (beginning with '//' and going til end of line).
|
||||
// Restriction: sizeof(dest) must be >= sizeof(src).
|
||||
|
||||
int i2 = 0;
|
||||
int len = strlen(src);
|
||||
int bComment = false;
|
||||
for (int i=0; i<len; i++)
|
||||
{
|
||||
if (bComment)
|
||||
{
|
||||
if (src[i] == LINEFEED_CONTROL_CHAR)
|
||||
bComment = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
if ((src[i] =='\\' && src[i+1] =='\\') || (src[i] =='/' && src[i+1] =='/'))
|
||||
bComment = true;
|
||||
else if (src[i] != LINEFEED_CONTROL_CHAR)
|
||||
dest[i2++] = src[i];
|
||||
}
|
||||
}
|
||||
dest[i2] = 0;
|
||||
}
|
||||
|
||||
bool texmgr::RunInitCode(int iSlot, char *szInitCode)
|
||||
{
|
||||
// warning: destroys contents of m_tex[iSlot].m_szExpr,
|
||||
// so be sure to call RunInitCode before writing or
|
||||
// compiling that string!
|
||||
|
||||
FreeCode(iSlot);
|
||||
FreeVars(iSlot);
|
||||
RegisterBuiltInVariables(iSlot);
|
||||
|
||||
strcpy(m_tex[iSlot].m_szExpr, szInitCode);
|
||||
bool ret = RecompileExpressions(iSlot);
|
||||
|
||||
// set default values of output variables:
|
||||
// (by not setting these every frame, we allow the values to persist from frame-to-frame.)
|
||||
*(m_tex[iSlot].var_x) = 0.5;
|
||||
*(m_tex[iSlot].var_y) = 0.5;
|
||||
*(m_tex[iSlot].var_sx) = 1.0;
|
||||
*(m_tex[iSlot].var_sy) = 1.0;
|
||||
*(m_tex[iSlot].var_repeatx) = 1.0;
|
||||
*(m_tex[iSlot].var_repeaty) = 1.0;
|
||||
*(m_tex[iSlot].var_rot) = 0.0;
|
||||
*(m_tex[iSlot].var_flipx) = 0.0;
|
||||
*(m_tex[iSlot].var_flipy) = 0.0;
|
||||
*(m_tex[iSlot].var_r) = 1.0;
|
||||
*(m_tex[iSlot].var_g) = 1.0;
|
||||
*(m_tex[iSlot].var_b) = 1.0;
|
||||
*(m_tex[iSlot].var_a) = 1.0;
|
||||
*(m_tex[iSlot].var_blendmode)= 0.0;
|
||||
*(m_tex[iSlot].var_done) = 0.0;
|
||||
*(m_tex[iSlot].var_burn) = 1.0;
|
||||
|
||||
#ifndef _NO_EXPR_
|
||||
if (m_tex[iSlot].m_codehandle)
|
||||
NSEEL_code_execute(m_tex[iSlot].m_codehandle);
|
||||
#endif
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
bool texmgr::RecompileExpressions(int iSlot)
|
||||
{
|
||||
char *expr = m_tex[iSlot].m_szExpr;
|
||||
|
||||
// QUICK FIX: if the string ONLY has spaces and linefeeds, erase it,
|
||||
// because for some strange reason this would cause an error in compileCode().
|
||||
{
|
||||
char *p = expr;
|
||||
while (*p==' ' || *p==LINEFEED_CONTROL_CHAR) p++;
|
||||
if (*p == 0) expr[0] = 0;
|
||||
}
|
||||
|
||||
// replace linefeed control characters with spaces, so they don't mess up the code compiler,
|
||||
// and strip out any comments ('//') before sending to CompileCode().
|
||||
char buf[sizeof(m_tex[iSlot].m_szExpr)];
|
||||
StripLinefeedCharsAndComments(expr, buf);
|
||||
|
||||
if (buf[0])
|
||||
{
|
||||
#ifndef _NO_EXPR_
|
||||
//resetVars(m_tex[iSlot].m_vars);
|
||||
//g_dumpmsg("texmgr: compiling string: ");
|
||||
//g_dumpmsg(buf);
|
||||
if ( ! (m_tex[iSlot].m_codehandle = NSEEL_code_compile(m_tex[iSlot].tex_eel_ctx, buf)))
|
||||
{
|
||||
//g_dumpmsg(" -error!");
|
||||
//MessageBox( NULL, "error in per-frame code", "MILKDROP ERROR", MB_OK|MB_SETFOREGROUND|MB_TOPMOST );
|
||||
//sprintf(pg->m_szUserMessage, "warning: preset \"%s\": error in 'per_frame' code", m_szDesc);
|
||||
//pg->m_fShowUserMessageUntilThisTime = pg->m_fAnimTime + 6.0f;
|
||||
}
|
||||
else
|
||||
{
|
||||
//g_dumpmsg(" -ok!");
|
||||
//pg->m_fShowUserMessageUntilThisTime = pg->m_fAnimTime; // clear any old error msg.
|
||||
}
|
||||
//resetVars(NULL);
|
||||
|
||||
return (m_tex[iSlot].m_codehandle != 0);
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void texmgr::FreeVars(int iSlot)
|
||||
{
|
||||
// free the built-in variables AND any user variables
|
||||
}
|
||||
|
||||
void texmgr::FreeCode(int iSlot)
|
||||
{
|
||||
// free the compiled expressions
|
||||
if (m_tex[iSlot].m_codehandle)
|
||||
{
|
||||
NSEEL_code_free(m_tex[iSlot].m_codehandle);
|
||||
m_tex[iSlot].m_codehandle = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
void texmgr::RegisterBuiltInVariables(int iSlot)
|
||||
{
|
||||
NSEEL_VMCTX eel_ctx = m_tex[iSlot].tex_eel_ctx;
|
||||
NSEEL_VM_resetvars(eel_ctx);
|
||||
|
||||
// input variables
|
||||
m_tex[iSlot].var_time = NSEEL_VM_regvar(eel_ctx, "time");
|
||||
m_tex[iSlot].var_frame = NSEEL_VM_regvar(eel_ctx, "frame");
|
||||
m_tex[iSlot].var_fps = NSEEL_VM_regvar(eel_ctx, "fps");
|
||||
m_tex[iSlot].var_progress = NSEEL_VM_regvar(eel_ctx, "progress");
|
||||
m_tex[iSlot].var_bass = NSEEL_VM_regvar(eel_ctx, "bass");
|
||||
m_tex[iSlot].var_bass_att = NSEEL_VM_regvar(eel_ctx, "bass_att");
|
||||
m_tex[iSlot].var_mid = NSEEL_VM_regvar(eel_ctx, "mid");
|
||||
m_tex[iSlot].var_mid_att = NSEEL_VM_regvar(eel_ctx, "mid_att");
|
||||
m_tex[iSlot].var_treb = NSEEL_VM_regvar(eel_ctx, "treb");
|
||||
m_tex[iSlot].var_treb_att = NSEEL_VM_regvar(eel_ctx, "treb_att");
|
||||
|
||||
// output variables
|
||||
m_tex[iSlot].var_x = NSEEL_VM_regvar(eel_ctx, "x");
|
||||
m_tex[iSlot].var_y = NSEEL_VM_regvar(eel_ctx, "y");
|
||||
m_tex[iSlot].var_sx = NSEEL_VM_regvar(eel_ctx, "sx");
|
||||
m_tex[iSlot].var_sy = NSEEL_VM_regvar(eel_ctx, "sy");
|
||||
m_tex[iSlot].var_repeatx = NSEEL_VM_regvar(eel_ctx, "repeatx");
|
||||
m_tex[iSlot].var_repeaty = NSEEL_VM_regvar(eel_ctx, "repeaty");
|
||||
m_tex[iSlot].var_rot = NSEEL_VM_regvar(eel_ctx, "rot");
|
||||
m_tex[iSlot].var_flipx = NSEEL_VM_regvar(eel_ctx, "flipx");
|
||||
m_tex[iSlot].var_flipy = NSEEL_VM_regvar(eel_ctx, "flipy");
|
||||
m_tex[iSlot].var_r = NSEEL_VM_regvar(eel_ctx, "r");
|
||||
m_tex[iSlot].var_g = NSEEL_VM_regvar(eel_ctx, "g");
|
||||
m_tex[iSlot].var_b = NSEEL_VM_regvar(eel_ctx, "b");
|
||||
m_tex[iSlot].var_a = NSEEL_VM_regvar(eel_ctx, "a");
|
||||
m_tex[iSlot].var_blendmode = NSEEL_VM_regvar(eel_ctx, "blendmode");
|
||||
m_tex[iSlot].var_done = NSEEL_VM_regvar(eel_ctx, "done");
|
||||
m_tex[iSlot].var_burn = NSEEL_VM_regvar(eel_ctx, "burn");
|
||||
|
||||
// resetVars(NULL);
|
||||
}
|
||||
@@ -0,0 +1,120 @@
|
||||
/*
|
||||
LICENSE
|
||||
-------
|
||||
Copyright 2005-2013 Nullsoft, Inc.
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification,
|
||||
are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright notice,
|
||||
this list of conditions and the following disclaimer.
|
||||
|
||||
* Redistributions in binary form must reproduce the above copyright notice,
|
||||
this list of conditions and the following disclaimer in the documentation
|
||||
and/or other materials provided with the distribution.
|
||||
|
||||
* Neither the name of Nullsoft nor the names of its contributors may be used to
|
||||
endorse or promote products derived from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
|
||||
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||
FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
||||
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
|
||||
IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
|
||||
OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifndef GEISS_TEXTURE_MANAGER
|
||||
#define GEISS_TEXTURE_MANAGER 1
|
||||
|
||||
#define NUM_TEX 16
|
||||
|
||||
#ifdef _DEBUG
|
||||
#define D3D_DEBUG_INFO // declare this before including d3d9.h
|
||||
#endif
|
||||
#include <d3d9.h>
|
||||
#include "ns-eel2/ns-eel.h"
|
||||
#include "md_defines.h"
|
||||
|
||||
#define TEXMGR_ERROR_MASK 0x0F
|
||||
#define TEXMGR_ERR_SUCCESS 0
|
||||
#define TEXMGR_ERR_BAD_INDEX 1
|
||||
/*
|
||||
#define TEXMGR_ERR_OPENING 2
|
||||
#define TEXMGR_ERR_IMAGE_NOT_24_BIT 3
|
||||
#define TEXMGR_ERR_IMAGE_TOO_LARGE 4
|
||||
#define TEXMGR_ERR_CREATESURFACE_FAILED 5
|
||||
#define TEXMGR_ERR_LOCKSURFACE_FAILED 6
|
||||
#define TEXMGR_ERR_CORRUPT_JPEG 7
|
||||
*/
|
||||
#define TEXMGR_ERR_FORMAT 8
|
||||
#define TEXMGR_ERR_BADFILE 9
|
||||
#define TEXMGR_ERR_OUTOFMEM 10
|
||||
#define TEXMGR_WARNING_MASK 0xF0
|
||||
#define TEXMGR_WARN_ERROR_IN_INIT_CODE 0x10
|
||||
#define TEXMGR_WARN_ERROR_IN_REG_CODE 0x20
|
||||
|
||||
typedef struct
|
||||
{
|
||||
LPDIRECT3DTEXTURE9 pSurface;
|
||||
int img_w, img_h;
|
||||
/*
|
||||
int tex_w, tex_h;
|
||||
float scale_x, scale_y; // the factors by which the original image was squished to become (img_w x img_h) texels in size.
|
||||
DDPIXELFORMAT ddpf;
|
||||
*/
|
||||
wchar_t szFileName[512];
|
||||
float fStartTime;
|
||||
int nStartFrame;
|
||||
int nUserData;
|
||||
|
||||
// stuff for expressions:
|
||||
char m_szExpr[8192]; // for expression eval
|
||||
NSEEL_CODEHANDLE m_codehandle; // for expression eval
|
||||
// input variables for expression eval
|
||||
double *var_time, *var_frame, *var_fps, *var_progress;
|
||||
double *var_bass, *var_bass_att, *var_mid, *var_mid_att, *var_treb, *var_treb_att;
|
||||
// output variables for expression eval
|
||||
double *var_x, *var_y;
|
||||
double *var_sx, *var_sy, *var_rot, *var_flipx, *var_flipy;
|
||||
double *var_r, *var_g, *var_b, *var_a;
|
||||
double *var_blendmode;
|
||||
double *var_repeatx, *var_repeaty;
|
||||
double *var_done, *var_burn;
|
||||
NSEEL_VMCTX tex_eel_ctx;
|
||||
}
|
||||
td_tex;
|
||||
|
||||
class texmgr
|
||||
{
|
||||
public:
|
||||
texmgr();
|
||||
~texmgr();
|
||||
|
||||
// members
|
||||
void Init(LPDIRECT3DDEVICE9 lpDD); // DirectDraw object
|
||||
int LoadTex(wchar_t *szFilename, int iSlot, char *szInitCode, char *szCode, float time, int frame, unsigned int ck);
|
||||
void KillTex(int iSlot);
|
||||
void Finish();
|
||||
|
||||
// data
|
||||
td_tex m_tex[NUM_TEX];
|
||||
|
||||
protected:
|
||||
// members
|
||||
//bool TryCreateDDrawSurface(int iSlot, int w, int h);
|
||||
void FreeVars(int iSlot);
|
||||
void FreeCode(int iSlot);
|
||||
void RegisterBuiltInVariables(int iSlot);
|
||||
bool RunInitCode(int iSlot, char *szInitCode);
|
||||
bool RecompileExpressions(int iSlot);
|
||||
void StripLinefeedCharsAndComments(char *src, char *dest);
|
||||
|
||||
// data
|
||||
LPDIRECT3DDEVICE9 m_lpDD;
|
||||
};
|
||||
|
||||
#endif
|
||||
Binary file not shown.
@@ -0,0 +1,700 @@
|
||||
/*
|
||||
LICENSE
|
||||
-------
|
||||
Copyright 2005-2013 Nullsoft, Inc.
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification,
|
||||
are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright notice,
|
||||
this list of conditions and the following disclaimer.
|
||||
|
||||
* Redistributions in binary form must reproduce the above copyright notice,
|
||||
this list of conditions and the following disclaimer in the documentation
|
||||
and/or other materials provided with the distribution.
|
||||
|
||||
* Neither the name of Nullsoft nor the names of its contributors may be used to
|
||||
endorse or promote products derived from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
|
||||
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||
FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
||||
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
|
||||
IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
|
||||
OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include "textmgr.h"
|
||||
#include "support.h"
|
||||
#include "utility.h"
|
||||
|
||||
#define MAX_MSG_CHARS (65536*2)
|
||||
#define SafeRelease(x) { if (x) {x->Release(); x=NULL;} }
|
||||
wchar_t g_szMsgPool[2][MAX_MSG_CHARS];
|
||||
|
||||
/*
|
||||
NOTES ON CTextManager
|
||||
|
||||
*** -desktop mode was SLOOOW when songtitles are on!, esp. since anim. songtitles...
|
||||
-> decided to cache output of ID3DXFont by rendering to a (vidmem) texture,
|
||||
** only when things change. ** That became CTextManager.
|
||||
-uses GDI-based ID3DXFont to draw text to a 2nd (VIDEO MEMORY) surface,
|
||||
but each frame, it only draws what is necessary (what's changed
|
||||
since last frame). It then blits that image (additively) to
|
||||
the back buffer each frame. (note that dark boxes wouldn't work
|
||||
w/additive drawing, since they're black, so those have to be
|
||||
manually drawn (as black boxes) by the plugin shell, AS WELL AS
|
||||
entered into the CTextManager queue as dark boxes, to handle
|
||||
erasure, dirty rectangles, etc.)
|
||||
|
||||
PROS/CONS:
|
||||
(+) Supports all GDI features: italics, kerning, international fonts, formatting, &, etc.
|
||||
(-) takes a lot of memory
|
||||
(-) if texture can't be created @ proper size, fonts will appear too big
|
||||
-> so don't use texture at all, in that case.
|
||||
-> at least this way it will work well on all newer cards [w/memory]
|
||||
(-) it's still going to crawl *when the text changes*,
|
||||
because d3dx will upload textures to vidmem & blit them *once for each change*.
|
||||
|
||||
OTHER CONCERNS/KIV:
|
||||
-what if m_lpDDSText can't be created @ actual size of window?
|
||||
If it's bigger, that's ok; but if it's smaller, that should result
|
||||
in a clipped area for the text - hmm....
|
||||
*/
|
||||
|
||||
CTextManager::CTextManager()
|
||||
{
|
||||
}
|
||||
|
||||
CTextManager::~CTextManager()
|
||||
{
|
||||
}
|
||||
|
||||
void CTextManager::Init(LPDIRECT3DDEVICE9 lpDevice, IDirect3DTexture9* lpTextSurface, int bAdditive)
|
||||
{
|
||||
m_lpDevice = lpDevice;
|
||||
m_lpTextSurface = lpTextSurface;
|
||||
m_blit_additively = bAdditive;
|
||||
|
||||
m_b = 0;
|
||||
m_nMsg[0] = 0;
|
||||
m_nMsg[1] = 0;
|
||||
m_next_msg_start_ptr = g_szMsgPool[m_b];
|
||||
}
|
||||
|
||||
void CTextManager::Finish()
|
||||
{
|
||||
}
|
||||
|
||||
void CTextManager::ClearAll()
|
||||
{
|
||||
m_nMsg[m_b] = 0;
|
||||
m_next_msg_start_ptr = g_szMsgPool[m_b];
|
||||
}
|
||||
|
||||
void CTextManager::DrawBox(LPRECT pRect, DWORD boxColor)
|
||||
{
|
||||
if (!pRect)
|
||||
return;
|
||||
|
||||
if ((m_nMsg[m_b] < MAX_MSGS) &&
|
||||
(DWORD)m_next_msg_start_ptr - (DWORD)g_szMsgPool[m_b] + 0 + 1 < MAX_MSG_CHARS)
|
||||
{
|
||||
*m_next_msg_start_ptr = 0;
|
||||
|
||||
m_msg[m_b][m_nMsg[m_b]].msg = m_next_msg_start_ptr;
|
||||
m_msg[m_b][m_nMsg[m_b]].pfont = NULL;
|
||||
m_msg[m_b][m_nMsg[m_b]].rect = *pRect;
|
||||
m_msg[m_b][m_nMsg[m_b]].flags = 0;
|
||||
m_msg[m_b][m_nMsg[m_b]].color = 0xFFFFFFFF;
|
||||
m_msg[m_b][m_nMsg[m_b]].bgColor = boxColor;
|
||||
m_nMsg[m_b]++;
|
||||
m_next_msg_start_ptr += 1;
|
||||
}
|
||||
}
|
||||
|
||||
int CTextManager::DrawText(LPD3DXFONT pFont, char* szText, RECT* pRect, DWORD flags, DWORD color, bool bBox, DWORD boxColor)
|
||||
{
|
||||
// these aren't supported by D3DX9:
|
||||
flags &= ~(DT_WORD_ELLIPSIS | DT_END_ELLIPSIS | DT_NOPREFIX);
|
||||
|
||||
if (!(pFont && pRect && szText))
|
||||
return 0;
|
||||
|
||||
if (flags & DT_CALCRECT)
|
||||
return pFont->DrawText(NULL, szText, -1, pRect, flags, color);
|
||||
|
||||
if (!m_lpDevice /*|| !m_lpTextSurface*/)
|
||||
return 0;
|
||||
|
||||
int len = strlen(szText);
|
||||
|
||||
if ((m_nMsg[m_b] < MAX_MSGS) &&
|
||||
(DWORD)m_next_msg_start_ptr - (DWORD)g_szMsgPool[m_b] + len + 1 < MAX_MSG_CHARS)
|
||||
{
|
||||
wcscpy(m_next_msg_start_ptr, AutoWide(szText));
|
||||
|
||||
m_msg[m_b][m_nMsg[m_b]].msg = m_next_msg_start_ptr;
|
||||
m_msg[m_b][m_nMsg[m_b]].pfont = pFont;
|
||||
m_msg[m_b][m_nMsg[m_b]].rect = *pRect;
|
||||
m_msg[m_b][m_nMsg[m_b]].flags = flags;
|
||||
m_msg[m_b][m_nMsg[m_b]].color = color;
|
||||
m_msg[m_b][m_nMsg[m_b]].bgColor = boxColor;
|
||||
|
||||
// shrink rects on new frame's text strings; important for deletions
|
||||
int h = pFont->DrawText(NULL, szText, len, &m_msg[m_b][m_nMsg[m_b]].rect, flags | DT_CALCRECT, color);
|
||||
|
||||
m_nMsg[m_b]++;
|
||||
m_next_msg_start_ptr += len + 1;
|
||||
|
||||
if (bBox)
|
||||
{
|
||||
// adds a message with no text, but the rect is the same as the text, so it creates a black box
|
||||
DrawBox(&m_msg[m_b][m_nMsg[m_b]-1].rect, boxColor);
|
||||
// now swap it with the text that precedes it, so it draws first, and becomes a background
|
||||
td_string x = m_msg[m_b][m_nMsg[m_b]-1];
|
||||
m_msg[m_b][m_nMsg[m_b]-1] = m_msg[m_b][m_nMsg[m_b]-2];
|
||||
m_msg[m_b][m_nMsg[m_b]-2] = x;
|
||||
}
|
||||
return h;
|
||||
}
|
||||
|
||||
// no room for more text? ok, but still return accurate info:
|
||||
RECT r2 = *pRect;
|
||||
int h = pFont->DrawText(NULL, szText, len, &r2, flags | DT_CALCRECT, color);
|
||||
return h;
|
||||
}
|
||||
|
||||
int CTextManager::DrawTextW(LPD3DXFONT pFont, wchar_t* szText, RECT* pRect, DWORD flags, DWORD color, bool bBox, DWORD boxColor)
|
||||
{
|
||||
// these aren't supported by D3DX9:
|
||||
flags &= ~(DT_WORD_ELLIPSIS | DT_END_ELLIPSIS | DT_NOPREFIX);
|
||||
|
||||
if (!(pFont && pRect && szText))
|
||||
return 0;
|
||||
|
||||
if (flags & DT_CALCRECT)
|
||||
return pFont->DrawTextW(NULL, szText, -1, pRect, flags, color);
|
||||
|
||||
if (!m_lpDevice /*|| !m_lpTextSurface*/)
|
||||
return 0;
|
||||
|
||||
int len = wcslen(szText);
|
||||
|
||||
if ((m_nMsg[m_b] < MAX_MSGS) &&
|
||||
(DWORD)m_next_msg_start_ptr - (DWORD)g_szMsgPool[m_b] + len + 1 < MAX_MSG_CHARS)
|
||||
{
|
||||
wcscpy(m_next_msg_start_ptr, szText);
|
||||
|
||||
m_msg[m_b][m_nMsg[m_b]].msg = m_next_msg_start_ptr;
|
||||
m_msg[m_b][m_nMsg[m_b]].pfont = pFont;
|
||||
m_msg[m_b][m_nMsg[m_b]].rect = *pRect;
|
||||
m_msg[m_b][m_nMsg[m_b]].flags = flags;
|
||||
m_msg[m_b][m_nMsg[m_b]].color = color;
|
||||
m_msg[m_b][m_nMsg[m_b]].bgColor = boxColor;
|
||||
|
||||
// shrink rects on new frame's text strings; important for deletions
|
||||
int h = pFont->DrawTextW(NULL, szText, len, &m_msg[m_b][m_nMsg[m_b]].rect, flags | DT_CALCRECT, color);
|
||||
|
||||
m_nMsg[m_b]++;
|
||||
m_next_msg_start_ptr += len + 1;
|
||||
|
||||
if (bBox)
|
||||
{
|
||||
// adds a message with no text, but the rect is the same as the text, so it creates a black box
|
||||
DrawBox(&m_msg[m_b][m_nMsg[m_b]-1].rect, boxColor);
|
||||
// now swap it with the text that precedes it, so it draws first, and becomes a background
|
||||
td_string x = m_msg[m_b][m_nMsg[m_b]-1];
|
||||
m_msg[m_b][m_nMsg[m_b]-1] = m_msg[m_b][m_nMsg[m_b]-2];
|
||||
m_msg[m_b][m_nMsg[m_b]-2] = x;
|
||||
}
|
||||
return h;
|
||||
}
|
||||
|
||||
// no room for more text? ok, but still return accurate info:
|
||||
RECT r2 = *pRect;
|
||||
int h = pFont->DrawTextW(NULL, szText, len, &r2, flags | DT_CALCRECT, color);
|
||||
return h;
|
||||
}
|
||||
|
||||
#define MATCH(i,j) ( m_msg[m_b][i].pfont == m_msg[1-m_b][j].pfont && \
|
||||
m_msg[m_b][i].flags == m_msg[1-m_b][j].flags && \
|
||||
m_msg[m_b][i].color == m_msg[1-m_b][j].color && \
|
||||
m_msg[m_b][i].bgColor == m_msg[1-m_b][j].bgColor && \
|
||||
memcmp(&m_msg[m_b][i].rect, &m_msg[1-m_b][j].rect, sizeof(RECT))==0 && \
|
||||
wcscmp(m_msg[m_b][i].msg, m_msg[1-m_b][j].msg)==0 )
|
||||
|
||||
void CTextManager::DrawNow()
|
||||
{
|
||||
if (!m_lpDevice)
|
||||
return;
|
||||
|
||||
if (m_nMsg[m_b] > 0 || m_nMsg[1-m_b] > 0) // second condition req'd for clearing text in VJ mode
|
||||
{
|
||||
D3DXMATRIX Ortho2D;
|
||||
pMatrixOrthoLH(&Ortho2D, 2.0f, -2.0f, 0.0f, 1.0f);
|
||||
m_lpDevice->SetTransform(D3DTS_PROJECTION, &Ortho2D);
|
||||
|
||||
#define NUM_DIRTY_RECTS 3
|
||||
RECT dirty_rect[NUM_DIRTY_RECTS];
|
||||
int dirty_rects_ready = 0;
|
||||
|
||||
int bRTT = (m_lpTextSurface==NULL) ? 0 : 1;
|
||||
LPDIRECT3DSURFACE9 pBackBuffer=NULL;//, pZBuffer=NULL;
|
||||
D3DSURFACE_DESC desc_backbuf, desc_text_surface;
|
||||
|
||||
// clear added/deleted flags
|
||||
void* last_dark_box = NULL;
|
||||
for (int i=0; i<m_nMsg[m_b]; i++)
|
||||
{
|
||||
m_msg[m_b][i].deleted = m_msg[m_b][i].added = 0;
|
||||
m_msg[m_b][i].prev_dark_box_ptr = last_dark_box;
|
||||
last_dark_box = (m_msg[m_b][i].pfont) ? last_dark_box : (void*)&m_msg[m_b][i];
|
||||
}
|
||||
last_dark_box = NULL;
|
||||
int j = 0;
|
||||
for (j = 0; j<m_nMsg[1-m_b]; j++)
|
||||
{
|
||||
m_msg[1-m_b][j].deleted = m_msg[1-m_b][j].added = 0;
|
||||
m_msg[1-m_b][j].prev_dark_box_ptr = last_dark_box;
|
||||
last_dark_box = (m_msg[1-m_b][j].pfont) ? last_dark_box : (void*)&m_msg[1-m_b][j];
|
||||
}
|
||||
|
||||
int bRedrawText = 0;
|
||||
if (!bRTT || (m_nMsg[m_b]>0 && m_nMsg[1-m_b]==0))
|
||||
{
|
||||
bRedrawText = 2; // redraw ALL
|
||||
}
|
||||
else
|
||||
{
|
||||
// try to synchronize the text strings from last frame + this frame,
|
||||
// and label additions & deletions. algorithm will catch:
|
||||
// -insertion of any # of items in one spot
|
||||
// -deletion of any # of items from one spot
|
||||
// -changes to 1 item
|
||||
// -changes to 2 consecutive items
|
||||
// (provided that the 2 text strings immediately bounding the
|
||||
// additions/deletions/change(s) are left unchanged.)
|
||||
// in any other case, all the text is just re-rendered.
|
||||
|
||||
int i = 0;
|
||||
int j = 0;
|
||||
while (i < m_nMsg[m_b] && j < m_nMsg[1-m_b])
|
||||
{
|
||||
// MATCH macro: first idx is record # for current stuff; second idx is record # for prev frame stuff.
|
||||
if (MATCH(i,j))
|
||||
{
|
||||
i++;
|
||||
j++;
|
||||
}
|
||||
else
|
||||
{
|
||||
int continue_now = 0;
|
||||
|
||||
// scan to see if something was added:
|
||||
for (int i2=i+1; i2<m_nMsg[m_b]; i2++)
|
||||
if (MATCH(i2,j))
|
||||
{
|
||||
for (int i3=i; i3<i2; i3++)
|
||||
m_msg[m_b][i3].added = 1;
|
||||
i = i2;
|
||||
bRedrawText = 1;
|
||||
continue_now = 1;
|
||||
break;
|
||||
}
|
||||
if (continue_now)
|
||||
continue;
|
||||
|
||||
// scan to see if something was deleted:
|
||||
for (int j2=j+1; j2<m_nMsg[1-m_b]; j2++)
|
||||
if (MATCH(i,j2))
|
||||
{
|
||||
for (int j3=j; j3<j2; j3++)
|
||||
m_msg[1-m_b][j3].deleted = 1;
|
||||
j = j2;
|
||||
bRedrawText = 1;
|
||||
continue_now = 1;
|
||||
break;
|
||||
}
|
||||
if (continue_now)
|
||||
continue;
|
||||
|
||||
// scan to see if just a small group of 1-4 items were changed
|
||||
// [and are followed by two identical items again]
|
||||
int break_now = 0;
|
||||
for (int chgd=1; chgd<=4; chgd++)
|
||||
{
|
||||
if (i>=m_nMsg[m_b]-chgd || j>=m_nMsg[1-m_b]-chgd)
|
||||
{
|
||||
// only a few items left in one of the lists -> just finish it
|
||||
bRedrawText = 1;
|
||||
break_now = 1;
|
||||
break;
|
||||
}
|
||||
if (i<m_nMsg[m_b]-chgd && j<m_nMsg[1-m_b]-chgd && MATCH(i+chgd, j+chgd))
|
||||
{
|
||||
for (int k=0; k<chgd; k++)
|
||||
{
|
||||
m_msg[ m_b][i+k].added = 1;
|
||||
m_msg[1-m_b][j+k].deleted = 1;
|
||||
}
|
||||
i += chgd;
|
||||
j += chgd;
|
||||
|
||||
bRedrawText = 1;
|
||||
continue_now = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (break_now)
|
||||
break;
|
||||
if (continue_now)
|
||||
continue;
|
||||
|
||||
// otherwise, nontrivial case -> just re-render whole thing
|
||||
bRedrawText = 2; // redraw ALL
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (bRedrawText < 2)
|
||||
{
|
||||
while (i < m_nMsg[m_b])
|
||||
{
|
||||
m_msg[m_b][i].added = 1;
|
||||
bRedrawText = 1;
|
||||
i++;
|
||||
}
|
||||
|
||||
while (j < m_nMsg[1-m_b])
|
||||
{
|
||||
m_msg[1-m_b][j].deleted = 1;
|
||||
bRedrawText = 1;
|
||||
j++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------
|
||||
|
||||
// 0. remember old render target & get surface descriptions
|
||||
m_lpDevice->GetRenderTarget( 0, &pBackBuffer );
|
||||
pBackBuffer->GetDesc(&desc_backbuf);
|
||||
|
||||
if (bRTT)
|
||||
{
|
||||
//if (m_lpDevice->GetDepthStencilSurface( &pZBuffer ) != D3D_OK)
|
||||
// pZBuffer = NULL; // ok if return val != D3D_OK - just means there is no zbuffer.
|
||||
if (m_lpTextSurface->GetLevelDesc(0, &desc_text_surface) != D3D_OK)
|
||||
bRTT = 0;
|
||||
|
||||
m_lpDevice->SetTextureStageState(0, D3DTSS_COLOROP, D3DTOP_MODULATE );
|
||||
m_lpDevice->SetTextureStageState(0, D3DTSS_COLORARG1, D3DTA_TEXTURE );
|
||||
m_lpDevice->SetTextureStageState(0, D3DTSS_COLORARG2, D3DTA_CURRENT );
|
||||
m_lpDevice->SetTextureStageState(1, D3DTSS_COLOROP, D3DTOP_DISABLE );
|
||||
|
||||
m_lpDevice->SetTextureStageState(0, D3DTSS_ALPHAOP, D3DTOP_SELECTARG1 );
|
||||
m_lpDevice->SetTextureStageState(0, D3DTSS_ALPHAARG1, D3DTA_DIFFUSE );
|
||||
m_lpDevice->SetTextureStageState(1, D3DTSS_ALPHAOP, D3DTOP_DISABLE );
|
||||
|
||||
m_lpDevice->SetRenderState( D3DRS_ZENABLE, FALSE );
|
||||
}
|
||||
else
|
||||
{
|
||||
desc_text_surface = desc_backbuf;
|
||||
}
|
||||
|
||||
if (bRTT && bRedrawText)
|
||||
do
|
||||
{
|
||||
// 1. change render target
|
||||
m_lpDevice->SetTexture(0, NULL);
|
||||
|
||||
IDirect3DSurface9* pNewTarget = NULL;
|
||||
if (m_lpTextSurface->GetSurfaceLevel(0, &pNewTarget) != D3D_OK)
|
||||
{
|
||||
bRTT = 0;
|
||||
break;
|
||||
}
|
||||
if (m_lpDevice->SetRenderTarget(0, pNewTarget) != D3D_OK)
|
||||
{
|
||||
pNewTarget->Release();
|
||||
bRTT = 0;
|
||||
break;
|
||||
}
|
||||
//m_lpDevice->SetDepthStencilSurface( ??? );
|
||||
pNewTarget->Release();
|
||||
|
||||
m_lpDevice->SetTexture(0, NULL);
|
||||
|
||||
// 2. clear to black
|
||||
//m_lpDevice->SetTexture(0, NULL);
|
||||
m_lpDevice->SetRenderState(D3DRS_ALPHABLENDENABLE, FALSE);
|
||||
m_lpDevice->SetVertexShader( NULL );
|
||||
m_lpDevice->SetFVF( WFVERTEX_FORMAT );
|
||||
m_lpDevice->SetPixelShader( NULL );
|
||||
WFVERTEX v3[4];
|
||||
if (bRedrawText==2)
|
||||
{
|
||||
DWORD clearcolor = m_msg[m_b][j].bgColor;//0xFF000000;// | ((rand()%32)<<16) | ((rand()%32)<<8) | ((rand()%32));
|
||||
int i = 0;
|
||||
for (i=0; i<4; i++)
|
||||
{
|
||||
v3[i].x = -1.0f + 2.0f*(i%2);
|
||||
v3[i].y = -1.0f + 2.0f*(i/2);
|
||||
v3[i].z = 0;
|
||||
v3[i].Diffuse = clearcolor;
|
||||
}
|
||||
m_lpDevice->DrawPrimitiveUP(D3DPT_TRIANGLESTRIP, 2, v3, sizeof(WFVERTEX));
|
||||
}
|
||||
else
|
||||
{
|
||||
// 1. erase (draw black box over) any old text items deleted.
|
||||
// also, update the dirty rects; stuff that was ABOVE/BELOW these guys will need redrawn!
|
||||
// (..picture them staggered)
|
||||
int j = 0;
|
||||
for (j=0; j<m_nMsg[1-m_b]; j++)
|
||||
{
|
||||
// erase text from PREV frame if it was deleted.
|
||||
if (m_msg[1-m_b][j].deleted)
|
||||
{
|
||||
float x0 = -1.0f + 2.0f*m_msg[1-m_b][j].rect.left/(float)desc_text_surface.Width;
|
||||
float x1 = -1.0f + 2.0f*m_msg[1-m_b][j].rect.right/(float)desc_text_surface.Width;
|
||||
float y0 = -1.0f + 2.0f*m_msg[1-m_b][j].rect.top/(float)desc_text_surface.Height;
|
||||
float y1 = -1.0f + 2.0f*m_msg[1-m_b][j].rect.bottom/(float)desc_text_surface.Height;
|
||||
int i = 0;
|
||||
for (i=0; i<4; i++)
|
||||
{
|
||||
v3[i].x = (i%2) ? x0 : x1;
|
||||
v3[i].y = (i/2) ? y0 : y1;
|
||||
v3[i].z = 0;
|
||||
v3[i].Diffuse = m_msg[m_b][j].bgColor;//0xFF000000;//0xFF300000;
|
||||
}
|
||||
m_lpDevice->DrawPrimitiveUP(D3DPT_TRIANGLESTRIP, 2, v3, sizeof(WFVERTEX));
|
||||
|
||||
//----------------------------------
|
||||
|
||||
// special case:
|
||||
// if something is erased, but it's totally inside a dark box,
|
||||
// then don't add it to the dirty rectangle.
|
||||
td_string* pDarkBox = (td_string*)m_msg[1-m_b][j].prev_dark_box_ptr;
|
||||
int add_to_dirty_rect = 1;
|
||||
while (pDarkBox && add_to_dirty_rect)
|
||||
{
|
||||
RECT t;
|
||||
UnionRect(&t, &pDarkBox->rect, &m_msg[1-m_b][j].rect);
|
||||
if (EqualRect(&t, &pDarkBox->rect))
|
||||
add_to_dirty_rect = 0;
|
||||
pDarkBox = (td_string*)pDarkBox->prev_dark_box_ptr;
|
||||
}
|
||||
|
||||
// also, update dirty rects
|
||||
// first, check to see if this shares area or a border w/any of the going dirty rects,
|
||||
// and if so, expand that dirty rect.
|
||||
if (add_to_dirty_rect)
|
||||
{
|
||||
int done = 0;
|
||||
RECT t;
|
||||
RECT r1 = m_msg[1-m_b][j].rect;
|
||||
RECT r2 = m_msg[1-m_b][j].rect;
|
||||
r2.top -= 1;
|
||||
r2.left -= 1;
|
||||
r2.right += 1;
|
||||
r2.bottom += 1;
|
||||
for (i=0; i<dirty_rects_ready; i++)
|
||||
{
|
||||
if (IntersectRect(&t, &r2, &dirty_rect[i]))
|
||||
{
|
||||
// expand the dirty rect to include r1
|
||||
UnionRect(&t, &r1, &dirty_rect[i]);
|
||||
dirty_rect[i] = t;
|
||||
done = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (done==1) continue;
|
||||
|
||||
// if it's in a new spot, and there are still unused dirty rects, use those
|
||||
if (dirty_rects_ready < NUM_DIRTY_RECTS)
|
||||
{
|
||||
dirty_rect[dirty_rects_ready] = r1;
|
||||
dirty_rects_ready++;
|
||||
continue;
|
||||
}
|
||||
|
||||
// otherwise, find the closest dirty rect...
|
||||
float nearest_dist;
|
||||
int nearest_id;
|
||||
for (i=0; i<NUM_DIRTY_RECTS; i++)
|
||||
{
|
||||
int dx=0, dy=0;
|
||||
|
||||
if (r1.left > dirty_rect[i].right)
|
||||
dx = r1.left - dirty_rect[i].right;
|
||||
else if (dirty_rect[i].left > r1.right)
|
||||
dx = dirty_rect[i].left - r1.right;
|
||||
|
||||
if (r1.top > dirty_rect[i].bottom)
|
||||
dy = r1.top - dirty_rect[i].bottom;
|
||||
else if (dirty_rect[i].top > r1.bottom)
|
||||
dy = dirty_rect[i].top - r1.bottom;
|
||||
|
||||
float dist = sqrtf((float)(dx*dx + dy*dy));
|
||||
if (i==0 || dist < nearest_dist)
|
||||
{
|
||||
nearest_dist = dist;
|
||||
nearest_id = i;
|
||||
}
|
||||
}
|
||||
//...and expand it to include this one.
|
||||
UnionRect(&t, &r1, &dirty_rect[nearest_id]);
|
||||
dirty_rect[nearest_id] = t;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 2. erase AND REDRAW any of *this* frame's text that falls in dirty rects
|
||||
// from erasures of *prev* frame's deleted text:
|
||||
for (j=0; j<m_nMsg[m_b]; j++)
|
||||
{
|
||||
RECT t;
|
||||
// note: none of these could be 'deleted' status yet.
|
||||
if (!m_msg[m_b][j].added)
|
||||
{
|
||||
// check vs. dirty rects so far; if intersects any, erase + redraw this one.
|
||||
for (int i=0; i<dirty_rects_ready; i++)
|
||||
if (m_msg[m_b][j].pfont && // exclude dark boxes... //fixme?
|
||||
IntersectRect(&t, &dirty_rect[i], &m_msg[m_b][j].rect))
|
||||
{
|
||||
float x0 = -1.0f + 2.0f*m_msg[m_b][j].rect.left/(float)desc_text_surface.Width;
|
||||
float x1 = -1.0f + 2.0f*m_msg[m_b][j].rect.right/(float)desc_text_surface.Width;
|
||||
float y0 = -1.0f + 2.0f*m_msg[m_b][j].rect.top/(float)desc_text_surface.Height;
|
||||
float y1 = -1.0f + 2.0f*m_msg[m_b][j].rect.bottom/(float)desc_text_surface.Height;
|
||||
for (int i=0; i<4; i++)
|
||||
{
|
||||
v3[i].x = (i%2) ? x0 : x1;
|
||||
v3[i].y = (i/2) ? y0 : y1;
|
||||
v3[i].z = 0;
|
||||
v3[i].Diffuse = m_msg[m_b][j].bgColor;//0xFF000000;//0xFF000030;
|
||||
}
|
||||
m_lpDevice->DrawPrimitiveUP(D3DPT_TRIANGLESTRIP, 2, v3, sizeof(WFVERTEX));
|
||||
|
||||
m_msg[m_b][j].deleted = 1;
|
||||
m_msg[m_b][j].added = 1;
|
||||
bRedrawText = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
while (0);
|
||||
|
||||
// 3. render text to TEXT surface
|
||||
if (bRedrawText)
|
||||
{
|
||||
m_lpDevice->SetTexture(0, NULL);
|
||||
m_lpDevice->SetTexture(1, NULL);
|
||||
m_lpDevice->SetRenderState(D3DRS_ALPHABLENDENABLE, FALSE);
|
||||
m_lpDevice->SetVertexShader( NULL );
|
||||
m_lpDevice->SetPixelShader( NULL );
|
||||
m_lpDevice->SetFVF( WFVERTEX_FORMAT );
|
||||
|
||||
for (int i=0; i<m_nMsg[m_b]; i++)
|
||||
if (bRedrawText==2 || m_msg[m_b][i].added==1)
|
||||
if (m_msg[m_b][i].pfont) // dark boxes have pfont==NULL
|
||||
// warning: in DX9, the DT_WORD_ELLIPSIS and DT_NOPREFIX flags cause no text to render!!
|
||||
m_msg[m_b][i].pfont->DrawTextW(NULL, m_msg[m_b][i].msg, -1, &m_msg[m_b][i].rect, m_msg[m_b][i].flags, m_msg[m_b][i].color);
|
||||
else if (m_msg[m_b][i].added || bRedrawText==2 || !bRTT)
|
||||
{
|
||||
WFVERTEX v3[4];
|
||||
float x0 = -1.0f + 2.0f*m_msg[m_b][i].rect.left/(float)desc_text_surface.Width;
|
||||
float x1 = -1.0f + 2.0f*m_msg[m_b][i].rect.right/(float)desc_text_surface.Width;
|
||||
float y0 = -1.0f + 2.0f*m_msg[m_b][i].rect.top/(float)desc_text_surface.Height;
|
||||
float y1 = -1.0f + 2.0f*m_msg[m_b][i].rect.bottom/(float)desc_text_surface.Height;
|
||||
for (int k=0; k<4; k++)
|
||||
{
|
||||
v3[k].x = (k%2) ? x0 : x1;
|
||||
v3[k].y = (k/2) ? y0 : y1;
|
||||
v3[k].z = 0;
|
||||
v3[k].Diffuse = m_msg[m_b][i].bgColor;//0xFF303000;
|
||||
}
|
||||
m_lpDevice->DrawPrimitiveUP(D3DPT_TRIANGLESTRIP, 2, v3, sizeof(WFVERTEX));
|
||||
}
|
||||
}
|
||||
|
||||
if (bRTT)
|
||||
{
|
||||
// 4. restore render target
|
||||
if (bRedrawText)
|
||||
{
|
||||
m_lpDevice->SetTexture(0, NULL);
|
||||
m_lpDevice->SetRenderTarget( 0, pBackBuffer );//, pZBuffer );
|
||||
//m_lpDevice->SetDepthStencilSurface( pZBuffer );
|
||||
}
|
||||
|
||||
// 5. blit text surface to backbuffer
|
||||
m_lpDevice->SetTexture(0, m_lpTextSurface);
|
||||
m_lpDevice->SetRenderState(D3DRS_ALPHABLENDENABLE, m_blit_additively ? TRUE : FALSE);
|
||||
m_lpDevice->SetRenderState(D3DRS_SRCBLEND, D3DBLEND_ONE);
|
||||
m_lpDevice->SetRenderState(D3DRS_DESTBLEND, m_blit_additively ? D3DBLEND_ONE : D3DBLEND_ZERO);
|
||||
m_lpDevice->SetVertexShader( NULL );
|
||||
m_lpDevice->SetPixelShader( NULL );
|
||||
m_lpDevice->SetFVF( SPRITEVERTEX_FORMAT );
|
||||
|
||||
SPRITEVERTEX v3[4];
|
||||
ZeroMemory(v3, sizeof(SPRITEVERTEX)*4);
|
||||
float fx = desc_text_surface.Width / (float)desc_backbuf.Width ;
|
||||
float fy = desc_text_surface.Height / (float)desc_backbuf.Height;
|
||||
for (int i=0; i<4; i++)
|
||||
{
|
||||
v3[i].x = (i%2==0) ? -1 : -1 + 2*fx;
|
||||
v3[i].y = (i/2==0) ? -1 : -1 + 2*fy;
|
||||
v3[i].z = 0;
|
||||
v3[i].tu = ((i%2==0) ? 0.0f : 1.0f) + 0.5f/desc_text_surface.Width; // FIXES BLURRY TEXT even when bilinear interp. is on (which can't be turned off on all cards!)
|
||||
v3[i].tv = ((i/2==0) ? 0.0f : 1.0f) + 0.5f/desc_text_surface.Height; // FIXES BLURRY TEXT even when bilinear interp. is on (which can't be turned off on all cards!)
|
||||
v3[i].Diffuse = 0xFFFFFFFF;
|
||||
}
|
||||
|
||||
DWORD oldblend[3];
|
||||
//m_lpDevice->GetTextureStageState(0, D3DTSS_MAGFILTER, &oldblend[0]);
|
||||
//m_lpDevice->GetTextureStageState(1, D3DTSS_MINFILTER, &oldblend[1]);
|
||||
//m_lpDevice->GetTextureStageState(2, D3DTSS_MIPFILTER, &oldblend[2]);
|
||||
m_lpDevice->GetSamplerState(0, D3DSAMP_MAGFILTER, &oldblend[0]);
|
||||
m_lpDevice->GetSamplerState(1, D3DSAMP_MINFILTER, &oldblend[1]);
|
||||
m_lpDevice->GetSamplerState(2, D3DSAMP_MIPFILTER, &oldblend[2]);
|
||||
m_lpDevice->SetSamplerState(0, D3DSAMP_MAGFILTER, D3DTEXF_POINT);
|
||||
m_lpDevice->SetSamplerState(1, D3DSAMP_MINFILTER, D3DTEXF_POINT);
|
||||
m_lpDevice->SetSamplerState(2, D3DSAMP_MIPFILTER, D3DTEXF_POINT);
|
||||
|
||||
m_lpDevice->DrawPrimitiveUP(D3DPT_TRIANGLESTRIP, 2, v3, sizeof(SPRITEVERTEX));
|
||||
|
||||
m_lpDevice->SetSamplerState(0, D3DSAMP_MAGFILTER, oldblend[0]);
|
||||
m_lpDevice->SetSamplerState(1, D3DSAMP_MINFILTER, oldblend[1]);
|
||||
m_lpDevice->SetSamplerState(2, D3DSAMP_MIPFILTER, oldblend[2]);
|
||||
|
||||
m_lpDevice->SetRenderState(D3DRS_ALPHABLENDENABLE, FALSE);
|
||||
}
|
||||
|
||||
SafeRelease(pBackBuffer);
|
||||
//SafeRelease(pZBuffer);
|
||||
|
||||
m_lpDevice->SetTexture(0, NULL);
|
||||
m_lpDevice->SetTexture(1, NULL);
|
||||
m_lpDevice->SetRenderState(D3DRS_ALPHABLENDENABLE, FALSE);
|
||||
m_lpDevice->SetVertexShader( NULL );
|
||||
m_lpDevice->SetPixelShader( NULL );
|
||||
m_lpDevice->SetFVF( SPRITEVERTEX_FORMAT );
|
||||
|
||||
//D3DXMATRIX ident;
|
||||
//D3DXMatrixIdentity(&ident);
|
||||
//m_lpDevice->SetTransform(D3DTS_PROJECTION, &ident);
|
||||
}
|
||||
|
||||
// flip:
|
||||
m_b = 1 - m_b;
|
||||
|
||||
ClearAll();
|
||||
}
|
||||
@@ -0,0 +1,91 @@
|
||||
/*
|
||||
LICENSE
|
||||
-------
|
||||
Copyright 2005-2013 Nullsoft, Inc.
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification,
|
||||
are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright notice,
|
||||
this list of conditions and the following disclaimer.
|
||||
|
||||
* Redistributions in binary form must reproduce the above copyright notice,
|
||||
this list of conditions and the following disclaimer in the documentation
|
||||
and/or other materials provided with the distribution.
|
||||
|
||||
* Neither the name of Nullsoft nor the names of its contributors may be used to
|
||||
endorse or promote products derived from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
|
||||
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||
FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
||||
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
|
||||
IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
|
||||
OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifndef GEISS_TEXT_DRAWING_MANAGER
|
||||
#define GEISS_TEXT_DRAWING_MANAGER 1
|
||||
|
||||
#ifdef _DEBUG
|
||||
#define D3D_DEBUG_INFO // declare this before including d3d9.h
|
||||
#endif
|
||||
#include <d3d9.h>
|
||||
#include <d3dx9.h>
|
||||
#include "md_defines.h"
|
||||
#include "..\nu\AutoWide.h"
|
||||
|
||||
#define MAX_MSGS 4096
|
||||
|
||||
typedef struct
|
||||
{
|
||||
wchar_t* msg; // points to some character in g_szMsgPool[2][].
|
||||
LPD3DXFONT pfont; // note: iff this string is really a dark box, pfont will be NULL!
|
||||
RECT rect;
|
||||
DWORD flags;
|
||||
DWORD color;
|
||||
DWORD bgColor;
|
||||
int added, deleted; // temporary; used during DrawNow()
|
||||
void* prev_dark_box_ptr; // temporary; used during DrawNow()
|
||||
}
|
||||
td_string;
|
||||
|
||||
class CTextManager
|
||||
{
|
||||
public:
|
||||
CTextManager();
|
||||
~CTextManager();
|
||||
|
||||
// note: if you can't create lpTextSurface full-size, don't create it at all!
|
||||
void Init(LPDIRECT3DDEVICE9 lpDevice, IDirect3DTexture9* lpTextSurface, int bAdditive); // note: ok if lpTextSurface==NULL; in that case, text will be drawn directly to screen (but not til end anyway).
|
||||
void Finish();
|
||||
|
||||
// note: pFont must persist until DrawNow() is called!
|
||||
int DrawText(LPD3DXFONT pFont, char* szText, RECT* pRect, DWORD flags, DWORD color, bool bBlackBox, DWORD boxColor=0xFF000000); // actually queues the text!
|
||||
int DrawText(LPD3DXFONT pFont, char* szText, int len, RECT* pRect, DWORD flags, DWORD color, bool bBox, DWORD boxColor=0xFF000000) {
|
||||
return DrawTextW(pFont, AutoWide(szText), pRect, flags, color, bBox, boxColor);
|
||||
};
|
||||
int DrawTextW(LPD3DXFONT pFont, wchar_t* szText, RECT* pRect, DWORD flags, DWORD color, bool bBlackBox, DWORD boxColor=0xFF000000); // actually queues the text!
|
||||
int DrawTextW(LPD3DXFONT pFont, wchar_t* szText, int len, RECT* pRect, DWORD flags, DWORD color, bool bBox, DWORD boxColor=0xFF000000) {
|
||||
return DrawTextW(pFont, szText, pRect, flags, color, bBox, boxColor);
|
||||
};
|
||||
void DrawBox(LPRECT pRect, DWORD boxColor);
|
||||
void DrawDarkBox(LPRECT pRect) { DrawBox(pRect, 0xFF000000); }
|
||||
void DrawNow();
|
||||
void ClearAll(); // automatically called @ end of DrawNow()
|
||||
|
||||
protected:
|
||||
LPDIRECT3DDEVICE9 m_lpDevice;
|
||||
IDirect3DTexture9* m_lpTextSurface;
|
||||
int m_blit_additively;
|
||||
|
||||
int m_nMsg[2];
|
||||
td_string m_msg[2][MAX_MSGS];
|
||||
wchar_t* m_next_msg_start_ptr;
|
||||
int m_b;
|
||||
};
|
||||
|
||||
#endif
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,164 @@
|
||||
/*
|
||||
LICENSE
|
||||
-------
|
||||
Copyright 2005-2013 Nullsoft, Inc.
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification,
|
||||
are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright notice,
|
||||
this list of conditions and the following disclaimer.
|
||||
|
||||
* Redistributions in binary form must reproduce the above copyright notice,
|
||||
this list of conditions and the following disclaimer in the documentation
|
||||
and/or other materials provided with the distribution.
|
||||
|
||||
* Neither the name of Nullsoft nor the names of its contributors may be used to
|
||||
endorse or promote products derived from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
|
||||
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||
FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
||||
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
|
||||
IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
|
||||
OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifndef __NULLSOFT_DX9_PLUGIN_SHELL_UTILITY_H__
|
||||
#define __NULLSOFT_DX9_PLUGIN_SHELL_UTILITY_H__ 1
|
||||
|
||||
#include <windows.h>
|
||||
#include <crtdefs.h>
|
||||
#include <d3d9.h>
|
||||
#include <d3dx9.h>
|
||||
|
||||
#define SafeRelease(x) { if (x) {x->Release(); x=NULL;} }
|
||||
#define SafeDelete(x) { if (x) {delete x; x=NULL;} }
|
||||
#define IsNullGuid(lpGUID) ( ((int*)lpGUID)[0]==0 && ((int*)lpGUID)[1]==0 && ((int*)lpGUID)[2]==0 && ((int*)lpGUID)[3]==0 )
|
||||
#define DlgItemIsChecked(hDlg, nIDDlgItem) ((SendDlgItemMessage(hDlg, nIDDlgItem, BM_GETCHECK, (WPARAM) 0, (LPARAM) 0) == BST_CHECKED) ? true : false)
|
||||
#define CosineInterp(x) (0.5f - 0.5f*cosf((x) * 3.1415926535898f))
|
||||
#define InvCosineInterp(x) (acosf(1.0f - 2.0f*(x))/3.1415926535898f)
|
||||
float PowCosineInterp(float x, float pow);
|
||||
float AdjustRateToFPS(float per_frame_decay_rate_at_fps1, float fps1, float actual_fps);
|
||||
|
||||
//int GetPrivateProfileInt - part of Win32 API
|
||||
#define GetPrivateProfileBoolW(w,x,y,z) ((bool)(GetPrivateProfileIntW(w,x,y,z) != 0))
|
||||
#define GetPrivateProfileBOOLW(w,x,y,z) ((BOOL)(GetPrivateProfileIntW(w,x,y,z) != 0))
|
||||
float GetPrivateProfileFloatW(wchar_t *szSectionName, wchar_t *szKeyName, float fDefault, wchar_t *szIniFile);
|
||||
bool WritePrivateProfileIntW(int d, wchar_t *szKeyName, wchar_t *szIniFile, wchar_t *szSectionName);
|
||||
bool WritePrivateProfileFloatW(float f, wchar_t *szKeyName, wchar_t *szIniFile, wchar_t *szSectionName);
|
||||
|
||||
extern _locale_t g_use_C_locale;
|
||||
extern char keyMappings[8];
|
||||
|
||||
void SetScrollLock(int bNewState, bool bPreventHandling);
|
||||
void RemoveExtension(wchar_t *str);
|
||||
void RemoveSingleAmpersands(wchar_t *str);
|
||||
void TextToGuid(char *str, GUID *pGUID);
|
||||
void GuidToText(GUID *pGUID, char *str, int nStrLen);
|
||||
//int GetPentiumTimeRaw(unsigned __int64 *cpu_timestamp);
|
||||
//double GetPentiumTimeAsDouble(unsigned __int64 frequency);
|
||||
#ifdef _DEBUG
|
||||
void OutputDebugMessage(char *szStartText, HWND hwnd,UINT msg,WPARAM wParam,LPARAM lParam); // only available in RELEASE builds!
|
||||
#endif
|
||||
void MissingDirectX(HWND hwnd);
|
||||
bool CheckForMMX();
|
||||
bool CheckForSSE();
|
||||
void GetDesktopFolder(char *szDesktopFolder); // should be MAX_PATH len.
|
||||
|
||||
#include "icon_t.h"
|
||||
#include <shlobj.h>
|
||||
#include <list>
|
||||
|
||||
BOOL DoExplorerMenu (HWND hwnd, LPCTSTR pszPath, POINT point);
|
||||
BOOL DoExplorerMenu (HWND hwnd, LPITEMIDLIST pidl, POINT point);
|
||||
UINT GetItemCount (LPITEMIDLIST pidl);
|
||||
LPITEMIDLIST GetNextItem (LPITEMIDLIST pidl);
|
||||
LPITEMIDLIST DuplicateItem (LPMALLOC pMalloc, LPITEMIDLIST pidl);
|
||||
void FindDesktopWindows(HWND *desktop_progman, HWND *desktopview_wnd, HWND *listview_wnd);
|
||||
void ExecutePidl(LPITEMIDLIST pidl, char *szPathAndFile, char *szWorkingDirectory, HWND hWnd);
|
||||
int GetDesktopIconSize();
|
||||
|
||||
// handy functions for populating Combo Boxes:
|
||||
inline void AddItem(HWND ctrl, const wchar_t* text, DWORD itemdata) {
|
||||
LRESULT nPos = SendMessageW( ctrl, CB_ADDSTRING, 0, (LPARAM)text);
|
||||
SendMessage( ctrl, CB_SETITEMDATA, nPos, itemdata);
|
||||
}
|
||||
inline void SelectItemByPos(HWND ctrl, int pos) {
|
||||
SendMessage(ctrl, CB_SETCURSEL, pos, 0);
|
||||
}
|
||||
int SelectItemByValue(HWND ctrl, DWORD value);
|
||||
bool ReadCBValue(HWND hwnd, DWORD ctrl_id, int* pRetValue);
|
||||
|
||||
LRESULT GetWinampVersion(HWND winamp);
|
||||
void* GetTextResource(UINT id, int no_fallback);
|
||||
|
||||
HMODULE FindD3DX9(HWND winamp);
|
||||
|
||||
intptr_t myOpenURL(HWND hwnd, wchar_t *loc);
|
||||
|
||||
typedef HRESULT (WINAPI *D3DXCREATEFONTW)(LPDIRECT3DDEVICE9, INT, UINT, UINT, UINT, BOOL, DWORD, DWORD, DWORD, DWORD, LPCWSTR, LPD3DXFONT *);
|
||||
extern D3DXCREATEFONTW pCreateFontW;
|
||||
|
||||
typedef D3DXMATRIX *(WINAPI *D3DXMATRIXMULTIPLY)(D3DXMATRIX *pOut, CONST D3DXMATRIX *pM1, CONST D3DXMATRIX *pM2);
|
||||
extern D3DXMATRIXMULTIPLY pMatrixMultiply;
|
||||
|
||||
typedef D3DXMATRIX* (WINAPI *D3DXMATRIXTRANSLATION)( D3DXMATRIX *pOut, FLOAT x, FLOAT y, FLOAT z );
|
||||
extern D3DXMATRIXTRANSLATION pMatrixTranslation;
|
||||
|
||||
typedef D3DXMATRIX* (WINAPI *D3DXMATRIXSCALING)( D3DXMATRIX *pOut, FLOAT sx, FLOAT sy, FLOAT sz );
|
||||
extern D3DXMATRIXSCALING pMatrixScaling;
|
||||
|
||||
typedef D3DXMATRIX* (WINAPI *D3DXMATRIXROTATION)( D3DXMATRIX *pOut, FLOAT Angle );
|
||||
extern D3DXMATRIXROTATION pMatrixRotationX, pMatrixRotationY, pMatrixRotationZ;
|
||||
|
||||
typedef HRESULT (WINAPI *D3DXCREATETEXTUREFROMFILEEXW)(
|
||||
LPDIRECT3DDEVICE9 pDevice,
|
||||
LPCWSTR pSrcFile,
|
||||
UINT Width,
|
||||
UINT Height,
|
||||
UINT MipLevels,
|
||||
DWORD Usage,
|
||||
D3DFORMAT Format,
|
||||
D3DPOOL Pool,
|
||||
DWORD Filter,
|
||||
DWORD MipFilter,
|
||||
D3DCOLOR ColorKey,
|
||||
D3DXIMAGE_INFO* pSrcInfo,
|
||||
PALETTEENTRY* pPalette,
|
||||
LPDIRECT3DTEXTURE9* ppTexture);
|
||||
extern D3DXCREATETEXTUREFROMFILEEXW pCreateTextureFromFileExW;
|
||||
|
||||
typedef D3DXMATRIX* (WINAPI *D3DXMATRIXORTHOLH)(D3DXMATRIX *pOut, FLOAT w, FLOAT h, FLOAT zn, FLOAT zf);
|
||||
extern D3DXMATRIXORTHOLH pMatrixOrthoLH;
|
||||
|
||||
typedef HRESULT (WINAPI *D3DXCOMPILESHADER)(
|
||||
LPCSTR pSrcData,
|
||||
UINT SrcDataLen,
|
||||
CONST D3DXMACRO* pDefines,
|
||||
LPD3DXINCLUDE pInclude,
|
||||
LPCSTR pFunctionName,
|
||||
LPCSTR pProfile,
|
||||
DWORD Flags,
|
||||
LPD3DXBUFFER* ppShader,
|
||||
LPD3DXBUFFER* ppErrorMsgs,
|
||||
LPD3DXCONSTANTTABLE* ppConstantTable);
|
||||
extern D3DXCOMPILESHADER pCompileShader;
|
||||
|
||||
typedef D3DXMATRIX* (WINAPI *D3DXMATRIXLOOKATLH)( D3DXMATRIX *pOut, CONST D3DXVECTOR3 *pEye, CONST D3DXVECTOR3 *pAt, CONST D3DXVECTOR3 *pUp );
|
||||
extern D3DXMATRIXLOOKATLH pMatrixLookAtLH;
|
||||
|
||||
typedef HRESULT (WINAPI *D3DXCREATETEXTURE)(
|
||||
LPDIRECT3DDEVICE9 pDevice,
|
||||
UINT Width,
|
||||
UINT Height,
|
||||
UINT MipLevels,
|
||||
DWORD Usage,
|
||||
D3DFORMAT Format,
|
||||
D3DPOOL Pool,
|
||||
LPDIRECT3DTEXTURE9* ppTexture);
|
||||
extern D3DXCREATETEXTURE pCreateTexture;
|
||||
#endif
|
||||
@@ -0,0 +1,39 @@
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Version
|
||||
//
|
||||
#include "../../../Winamp/buildType.h"
|
||||
VS_VERSION_INFO VERSIONINFO
|
||||
FILEVERSION 2,25,4,0
|
||||
PRODUCTVERSION WINAMP_PRODUCTVER
|
||||
FILEFLAGSMASK 0x17L
|
||||
#ifdef _DEBUG
|
||||
FILEFLAGS 0x1L
|
||||
#else
|
||||
FILEFLAGS 0x0L
|
||||
#endif
|
||||
FILEOS 0x4L
|
||||
FILETYPE 0x2L
|
||||
FILESUBTYPE 0x0L
|
||||
BEGIN
|
||||
BLOCK "StringFileInfo"
|
||||
BEGIN
|
||||
BLOCK "040904b0"
|
||||
BEGIN
|
||||
VALUE "CompanyName", "Winamp SA"
|
||||
VALUE "FileDescription", "Winamp Visualization Plug-in"
|
||||
VALUE "FileVersion", "2,25,4,0"
|
||||
VALUE "InternalName", "Nullsoft Milkdrop v2"
|
||||
VALUE "LegalCopyright", "Copyright © 2001-2023 Winamp SA"
|
||||
VALUE "LegalTrademarks", "Nullsoft and Winamp are trademarks of Winamp SA"
|
||||
VALUE "OriginalFilename", "vis_milk2.dll"
|
||||
VALUE "ProductName", "Winamp"
|
||||
VALUE "ProductVersion", STR_WINAMP_PRODUCTVER
|
||||
END
|
||||
END
|
||||
BLOCK "VarFileInfo"
|
||||
BEGIN
|
||||
VALUE "Translation", 0x409, 1200
|
||||
END
|
||||
END
|
||||
@@ -0,0 +1,275 @@
|
||||
/*
|
||||
LICENSE
|
||||
-------
|
||||
Copyright 2005-2013 Nullsoft, Inc.
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification,
|
||||
are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright notice,
|
||||
this list of conditions and the following disclaimer.
|
||||
|
||||
* Redistributions in binary form must reproduce the above copyright notice,
|
||||
this list of conditions and the following disclaimer in the documentation
|
||||
and/or other materials provided with the distribution.
|
||||
|
||||
* Neither the name of Nullsoft nor the names of its contributors may be used to
|
||||
endorse or promote products derived from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
|
||||
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||
FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
||||
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
|
||||
IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
|
||||
OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include "api__vis_milk2.h"
|
||||
#include <windows.h>
|
||||
#include "vis.h"
|
||||
#include "plugin.h"
|
||||
#include "defines.h"
|
||||
#include "resource.h"
|
||||
#include "utility.h"
|
||||
|
||||
CPlugin g_plugin;
|
||||
_locale_t g_use_C_locale = 0;
|
||||
char keyMappings[8];
|
||||
bool g_bFullyExited = true;
|
||||
|
||||
// wasabi based services for localisation support
|
||||
api_service *WASABI_API_SVC = 0;
|
||||
api_language *WASABI_API_LNG = 0;
|
||||
api_application *WASABI_API_APP = 0;
|
||||
api_syscb *WASABI_API_SYSCB = 0;
|
||||
HINSTANCE WASABI_API_LNG_HINST = 0, WASABI_API_ORIG_HINST = 0;
|
||||
|
||||
void config(struct winampVisModule *this_mod); // configuration dialog
|
||||
int init(struct winampVisModule *this_mod); // initialization for module
|
||||
int render1(struct winampVisModule *this_mod); // rendering for module 1
|
||||
void quit(struct winampVisModule *this_mod); // deinitialization for module
|
||||
|
||||
// our only plugin module in this plugin:
|
||||
winampVisModule mod1 =
|
||||
{
|
||||
MODULEDESC,
|
||||
NULL, // hwndParent
|
||||
NULL, // hDllInstance
|
||||
0, // sRate
|
||||
0, // nCh
|
||||
0, // latencyMS - tells winamp how much in advance you want the audio data,
|
||||
// in ms.
|
||||
10, // delayMS - if winamp tells the plugin to render a frame and it takes
|
||||
// less than this # of milliseconds, winamp will sleep (go idle)
|
||||
// for the remainder. In effect, this limits the framerate of
|
||||
// the plugin. A value of 10 would cause a fps limit of ~100.
|
||||
// Derivation: (1000 ms/sec) / (10 ms/frame) = 100 fps.
|
||||
0, // spectrumNch
|
||||
2, // waveformNch
|
||||
{ 0, }, // spectrumData
|
||||
{ 0, }, // waveformData
|
||||
config,
|
||||
init,
|
||||
render1,
|
||||
quit
|
||||
};
|
||||
|
||||
// getmodule routine from the main header. Returns NULL if an invalid module was requested,
|
||||
// otherwise returns either mod1, mod2 or mod3 depending on 'which'.
|
||||
winampVisModule *getModule(int which)
|
||||
{
|
||||
switch (which)
|
||||
{
|
||||
case 0: return &mod1;
|
||||
//case 1: return &mod2;
|
||||
//case 2: return &mod3;
|
||||
default: return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
// Module header, includes version, description, and address of the module retriever function
|
||||
winampVisHeader hdr = { VIS_HDRVER, DLLDESC, getModule };
|
||||
|
||||
// use this to get our own HINSTANCE since overriding DllMain(..) causes instant crashes (should see why)
|
||||
static HINSTANCE GetMyInstance()
|
||||
{
|
||||
MEMORY_BASIC_INFORMATION mbi = {0};
|
||||
if(VirtualQuery(GetMyInstance, &mbi, sizeof(mbi)))
|
||||
return (HINSTANCE)mbi.AllocationBase;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
// this is the only exported symbol. returns our main header.
|
||||
// if you are compiling C++, the extern "C" { is necessary, so we just #ifdef it
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
__declspec( dllexport ) winampVisHeader *winampVisGetHeader(HWND hwndParent)
|
||||
{
|
||||
if(!WASABI_API_LNG_HINST)
|
||||
{
|
||||
// loader so that we can get the localisation service api for use
|
||||
WASABI_API_SVC = (api_service*)SendMessage(hwndParent, WM_WA_IPC, 0, IPC_GET_API_SERVICE);
|
||||
if (WASABI_API_SVC == (api_service*)1) WASABI_API_SVC = NULL;
|
||||
|
||||
waServiceFactory *sf = WASABI_API_SVC->service_getServiceByGuid(languageApiGUID);
|
||||
if (sf) WASABI_API_LNG = reinterpret_cast<api_language*>(sf->getInterface());
|
||||
|
||||
sf = WASABI_API_SVC->service_getServiceByGuid(applicationApiServiceGuid);
|
||||
if (sf) WASABI_API_APP = reinterpret_cast<api_application*>(sf->getInterface());
|
||||
|
||||
sf = WASABI_API_SVC->service_getServiceByGuid(syscbApiServiceGuid);
|
||||
if (sf) WASABI_API_SYSCB = reinterpret_cast<api_syscb*>(sf->getInterface());
|
||||
|
||||
// need to have this initialised before we try to do anything with localisation features
|
||||
WASABI_API_START_LANG(GetMyInstance(),VisMilkdropLangGUID);
|
||||
|
||||
/* added for v2.25 as a quick work around to allow partial
|
||||
/* keyboard mappings (mainly coming from de-de requirements)
|
||||
** [yY][Y][yY][zZ]
|
||||
** 1 2 3 4
|
||||
**
|
||||
** 1 - does yes for the 3 different prompt types
|
||||
** 2 - does Ctrl+Y for stopping display of custom message of song title
|
||||
** 3 - something for preset editing (not 100% sure what)
|
||||
** 4 - used for the previous track sent to Winamp
|
||||
*/
|
||||
WASABI_API_LNGSTRING_BUF(IDS_KEY_MAPPINGS, keyMappings, 8);
|
||||
|
||||
// as we're under a different thread we need to set the locale
|
||||
//WASABI_API_LNG->UseUserNumericLocale();
|
||||
g_use_C_locale = WASABI_API_LNG->Get_C_NumericLocale();
|
||||
}
|
||||
|
||||
return &hdr;
|
||||
}
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
bool WaitUntilPluginFinished(HWND hWndWinamp)
|
||||
{
|
||||
int slept = 0;
|
||||
while (!g_bFullyExited && slept < 1000)
|
||||
{
|
||||
Sleep(50);
|
||||
slept += 50;
|
||||
}
|
||||
|
||||
if (!g_bFullyExited)
|
||||
{
|
||||
wchar_t title[64];
|
||||
MessageBoxW(hWndWinamp, WASABI_API_LNGSTRINGW(IDS_ERROR_THE_PLUGIN_IS_ALREADY_RUNNING),
|
||||
WASABI_API_LNGSTRINGW_BUF(IDS_MILKDROP_ERROR, title, 64),
|
||||
MB_OK|MB_SETFOREGROUND|MB_TOPMOST);
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
HWND GetDialogBoxParent(HWND winamp)
|
||||
{
|
||||
HWND parent = (HWND)SendMessage(winamp, WM_WA_IPC, 0, IPC_GETDIALOGBOXPARENT);
|
||||
if (!parent || parent == (HWND)1)
|
||||
return winamp;
|
||||
return parent;
|
||||
}
|
||||
|
||||
// configuration. Passed this_mod, as a "this" parameter. Allows you to make one configuration
|
||||
// function that shares code for all your modules (you don't HAVE to use it though, you can make
|
||||
// config1(), config2(), etc...)
|
||||
void config(struct winampVisModule *this_mod)
|
||||
{
|
||||
if (!g_bFullyExited)
|
||||
{
|
||||
g_plugin.OnAltK();
|
||||
return;
|
||||
}
|
||||
|
||||
g_bFullyExited = false;
|
||||
g_plugin.PluginPreInitialize(this_mod->hwndParent, this_mod->hDllInstance);
|
||||
WASABI_API_DIALOGBOXPARAMW(IDD_CONFIG, GetDialogBoxParent(this_mod->hwndParent), g_plugin.ConfigDialogProc, (LPARAM)&g_plugin);
|
||||
g_bFullyExited = true;
|
||||
}
|
||||
|
||||
int (*warand)(void) = 0;
|
||||
|
||||
int fallback_rand_fn(void) {
|
||||
return rand();
|
||||
}
|
||||
|
||||
// initialization. Registers our window class, creates our window, etc. Again, this one works for
|
||||
// both modules, but you could make init1() and init2()...
|
||||
// returns 0 on success, 1 on failure.
|
||||
int init(struct winampVisModule *this_mod)
|
||||
{
|
||||
DWORD version = GetWinampVersion(mod1.hwndParent);
|
||||
|
||||
if (!warand)
|
||||
{
|
||||
warand = (int (*)(void))SendMessage(this_mod->hwndParent, WM_WA_IPC, 0, IPC_GET_RANDFUNC);
|
||||
if ((size_t)warand <= 1)
|
||||
{
|
||||
warand = fallback_rand_fn;
|
||||
}
|
||||
}
|
||||
|
||||
if (!WaitUntilPluginFinished(this_mod->hwndParent))
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (GetWinampVersion(mod1.hwndParent) < 0x4000)
|
||||
{
|
||||
// query winamp for its playback state
|
||||
LRESULT ret = SendMessage(this_mod->hwndParent, WM_USER, 0, 104);
|
||||
// ret=1: playing, ret=3: paused, other: stopped
|
||||
|
||||
if (ret != 1)
|
||||
{
|
||||
wchar_t title[64];
|
||||
MessageBoxW(this_mod->hwndParent, WASABI_API_LNGSTRINGW(IDS_THIS_PLUGIN_NEEDS_MUSIC_TO_RUN),
|
||||
WASABI_API_LNGSTRINGW_BUF(IDS_NO_MUSIC_PLAYING, title, 64),
|
||||
MB_OK|MB_SETFOREGROUND|MB_TOPMOST|MB_TASKMODAL );
|
||||
return 1; // failure
|
||||
}
|
||||
}
|
||||
|
||||
g_bFullyExited = false;
|
||||
|
||||
if (!g_plugin.PluginPreInitialize(this_mod->hwndParent, this_mod->hDllInstance))
|
||||
{
|
||||
g_plugin.PluginQuit();
|
||||
g_bFullyExited = true;
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (!g_plugin.PluginInitialize())
|
||||
{
|
||||
g_plugin.PluginQuit();
|
||||
g_bFullyExited = true;
|
||||
return 1;
|
||||
}
|
||||
|
||||
return 0; // success
|
||||
}
|
||||
|
||||
// render function for oscilliscope. Returns 0 if successful, 1 if visualization should end.
|
||||
int render1(struct winampVisModule *this_mod)
|
||||
{
|
||||
if (g_plugin.PluginRender(this_mod->waveformData[0], this_mod->waveformData[1]))
|
||||
return 0; // ok
|
||||
else
|
||||
return 1; // failed
|
||||
}
|
||||
|
||||
// cleanup (opposite of init()). Should destroy the window, unregister the window class, etc.
|
||||
void quit(struct winampVisModule *this_mod)
|
||||
{
|
||||
g_plugin.PluginQuit();
|
||||
g_bFullyExited = true;
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
#include "../Winamp/vis.h"
|
||||
Binary file not shown.
Reference in New Issue
Block a user