Initial community commit

This commit is contained in:
Jef
2024-09-24 14:54:57 +02:00
parent 537bcbc862
commit 20d28e80a5
16810 changed files with 4640254 additions and 2 deletions
@@ -0,0 +1,12 @@
// ----------------------------------------------------------------------------
// Generated by InterfaceFactory [Wed May 07 00:55:56 2003]
//
// File : api_application.cpp
// Class : api_application
// class layer : Dispatchable Interface
// ----------------------------------------------------------------------------
#include <precomp.h>
#include "api_application.h"
@@ -0,0 +1,416 @@
// ----------------------------------------------------------------------------
// Generated by InterfaceFactory [Wed May 07 00:55:56 2003]
//
// File : api_application.h
// Class : api_application
// class layer : Dispatchable Interface
// ----------------------------------------------------------------------------
#ifndef __API_APPLICATION_H
#define __API_APPLICATION_H
#include <bfc/dispatch.h>
#include <bfc/platform/guid.h>
#include <bfc/platform/platform.h>
#ifdef _WIN32
#include "ifc_messageprocessor.h"
#endif
// ----------------------------------------------------------------------------
enum
{
API_APPLICATION_SUCCESS = 0,
API_APPLICATION_FAILURE = 1,
};
enum
{
TRANSLATE_MODE_NORMAL = 0,
TRANSLATE_MODE_GLOBAL = 1,
TRANSLATE_MODE_CHILD = 2,
};
class NOVTABLE api_application: public Dispatchable
{
protected:
api_application() {}
~api_application() {}
public:
const wchar_t *main_getAppName(); // returns (e.g.) "Winamp"
const wchar_t *main_getVersionString(); // returns (e.g.) "Winamp 5.12"
const wchar_t *main_getVersionNumString(); // returns (e.g.) "5.12"
unsigned int main_getBuildNumber(); // returns (e.g.) 666
GUID main_getGUID();
#ifdef _WIN32
HANDLE main_getMainThreadHandle(); // This actually gives you a DuplicateHandle, so call CloseHandle() when you are done.
HINSTANCE main_gethInstance();
#endif // !_WIN32
const wchar_t *main_getCommandLine();
void main_shutdown( int deferred = TRUE );
void main_cancelShutdown();
int main_isShuttingDown();
const wchar_t *path_getAppPath();
const wchar_t *path_getUserSettingsPath();
// added for 5.58+ so gen_ff can fill @SKINSPATH@ in scripts correctly
const wchar_t *path_getSkinSettingsPath();
int app_getInitCount();
intptr_t app_messageLoopStep();
#ifdef _WIN32
void app_addMessageProcessor( ifc_messageprocessor *processor );
void app_removeMessageProcessor( ifc_messageprocessor *processor );
/* accelerators are 5.53+ */
void app_addAccelerators( HWND hwnd, HACCEL *phAccel, INT cAccel, UINT translateMode );
void app_removeAccelerators( HWND hwnd );
bool app_translateAccelerators( MSG *msg );
int app_getAccelerators( HWND hwnd, HACCEL *phAccel, INT cchAccelMax, BOOL bGlobal ); // phAccel == NULL && cchAccelMax == 0 -> returns accels count
/* register window as part of winamp global group (5.54+) */
void app_registerGlobalWindow( HWND hwnd );
void app_unregisterGlobalWindow( HWND hwnd );
/* 5.58 + */
bool DirectMouseWheel_RegisterSkipClass( ATOM klass );
bool DirectMouseWheel_UnregisterSkipClass( ATOM klass );
bool DirectMouseWheel_EnableConvertToMouseWheel( HWND hwnd, BOOL enable ); // !!! must be disabled before window destroyed !!!
/* 5.64 + */
BOOL DirectMouseWheel_ProcessDialogMessage( HWND hwnd, unsigned int uMsg, WPARAM wParam, LPARAM lParam, const int controls[], int controlslen );
/* 5.61 + */
void ActiveDialog_Register( HWND hwnd );
void ActiveDialog_Unregister( HWND hwnd );
HWND ActiveDialog_Get();
/* 5.64 + */
const wchar_t *getATFString(); // returns the current ATF formatting string
/* 5.66 + */
// used for dpi scaling so we're consistent in usage throughout the UI, etc
int getScaleX( int x );
int getScaleY( int y );
#endif // !_WIN32
/*
note: on windows, these two functions DON'T call Set/GetCurrentDirectory, Winamp maintains it's own path
because calling SetCurrentDirectory locks the folder
Added for 5.34
*/
const wchar_t *path_getWorkingPath(); // useful to call for populating lpstrInitialDir in GetOpenFileName
void path_setWorkingPath(const wchar_t *newPath); // useful to call for populating lpstrInitialDir in GetOpenFileName
/*
The following three function return you unique IDs you can use if you need
They are created anonymously, so information cannot be tracked back to a specific person
The main reason for their existence is that a few third party libraries require them
and some online media providers require this info for billing.
You can call this functions with a pointer to any 16 byte data structure cast to a GUID *
Added for 5.35
*/
// returns an ID unique to this computer, but not unique to the logged in user (two windows accts would share this ID)
int GetMachineID( GUID *id );
// returns an ID unique to this user. Another user logged in to the computer will have a different ID
// note that if Winamp was installed with "shared settings", the IDs of multiple users will probably be identical
// as we're just storing it in winamp.ini for now
int GetUserID( GUID *id );
// returns a unique ID for this session. Generated on the fly the first time someone calls this function
int GetSessionID( GUID *id );
/* 5.54 + */
size_t AllocateThreadStorage(); // returns an index, -1 for error
void *GetThreadStorage(size_t index);
void SetThreadStorage(size_t index, void *value);
protected:
enum
{
API_APPLICATION_MAIN_GETAPPNAME = 10,
API_APPLICATION_MAIN_GETVERSIONSTRING = 20,
API_APPLICATION_MAIN_GETVERSIONSTRING2 = 21,
API_APPLICATION_MAIN_GETBUILDNUMBER = 30,
API_APPLICATION_MAIN_GETGUID = 40,
API_APPLICATION_MAIN_GETMAINTHREADHANDLE = 50,
API_APPLICATION_MAIN_GETHINSTANCE = 60,
API_APPLICATION_MAIN_GETCOMMANDLINE = 70,
API_APPLICATION_MAIN_SHUTDOWN = 80,
API_APPLICATION_MAIN_CANCELSHUTDOWN = 90,
API_APPLICATION_MAIN_ISSHUTTINGDOWN = 100,
API_APPLICATION_PATH_GETAPPPATH = 110,
API_APPLICATION_PATH_GETUSERSETTINGSPATH = 120,
API_APPLICATION_APP_GETINITCOUNT = 130,
API_APPLICATION_APP_MESSAGELOOPSTEP = 140,
API_APPLICATION_APP_ADDMESSAGEPROCESSOR = 150,
API_APPLICATION_APP_REMOVEMESSAGEPROCESSOR = 160,
API_APPLICATION_APP_ADDMODELESSDIALOG = 170,
API_APPLICATION_APP_REMOVEMODELESSDIALOG = 180,
API_APPLICATION_PATH_GETWORKINGPATH = 190,
API_APPLICATION_PATH_SETWORKINGPATH = 200,
API_APPLICATION_GETMACHINEID = 210,
API_APPLICATION_GETUSERID = 220,
API_APPLICATION_GETSESSIONID = 230,
API_APPLICATION_APP_ADDACCELERATORS = 240,
API_APPLICATION_APP_REMOVEACCELERATORS = 250,
API_APPLICATION_APP_TRANSLATEACCELERATORS = 260,
API_APPLICATION_APP_GETACCELERATORS = 270,
API_APPLICATION_APP_REGISTERGLOBALWINDOW = 280,
API_APPLICATION_APP_UNREGISTERGLOBALWINDOW = 290,
API_APPLICATION_ALLOCATETHREADSTORAGE = 300,
API_APPLICATION_GETTHREADSTORAGE = 310,
API_APPLICATION_SETTHREADSTORAGE = 320,
API_APPLICATION_PATH_GETSKINSETTINGSPATH = 330,
API_APPLICATION_DIRECTMOUSEWHEEL_REGISTERSKIPCLASS = 340,
API_APPLICATION_DIRECTMOUSEWHEEL_UNREGISTERSKIPCLASS = 350,
API_APPLICATION_DIRECTMOUSEWHEEL_ENABLECONVERTTOMOUSEWHEEL = 360,
API_APPLICATION_DIRECTMOUSEWHEEL_PROCESSDIALOGMESSAGE = 365,
API_APPLICATION_ACTIVEDIALOG_REGISTER = 370,
API_APPLICATION_ACTIVEDIALOG_UNREGISTER = 380,
API_APPLICATION_ACTIVEDIALOG_GET = 390,
API_APPLICATION_GETATFSTRING = 400,
API_APPLICATION_GETSCALEX = 500,
API_APPLICATION_GETSCALEY = 510,
};
};
// ----------------------------------------------------------------------------
inline const wchar_t *api_application::main_getAppName()
{
const wchar_t *__retval = _call(API_APPLICATION_MAIN_GETAPPNAME, (const wchar_t *)0);
return __retval;
}
inline const wchar_t *api_application::main_getVersionString()
{
const wchar_t *__retval = _call(API_APPLICATION_MAIN_GETVERSIONSTRING, (const wchar_t *)0);
return __retval;
}
inline const wchar_t *api_application::main_getVersionNumString()
{
return _call(API_APPLICATION_MAIN_GETVERSIONSTRING2, (const wchar_t *)0);
}
inline unsigned int api_application::main_getBuildNumber()
{
return _call(API_APPLICATION_MAIN_GETBUILDNUMBER, 0);
}
inline GUID api_application::main_getGUID()
{
GUID __retval = _call(API_APPLICATION_MAIN_GETGUID, INVALID_GUID);
return __retval;
}
#ifdef _WIN32
inline HANDLE api_application::main_getMainThreadHandle()
{
HANDLE __retval = _call(API_APPLICATION_MAIN_GETMAINTHREADHANDLE, (HANDLE)NULL);
return __retval;
}
inline HINSTANCE api_application::main_gethInstance()
{
HINSTANCE __retval = _call(API_APPLICATION_MAIN_GETHINSTANCE, (HINSTANCE)NULL);
return __retval;
}
#endif
inline const wchar_t *api_application::main_getCommandLine()
{
const wchar_t *__retval = _call(API_APPLICATION_MAIN_GETCOMMANDLINE, (const wchar_t *)0);
return __retval;
}
inline void api_application::main_shutdown(int deferred)
{
_voidcall(API_APPLICATION_MAIN_SHUTDOWN, deferred);
}
inline void api_application::main_cancelShutdown()
{
_voidcall(API_APPLICATION_MAIN_CANCELSHUTDOWN);
}
inline int api_application::main_isShuttingDown()
{
int __retval = _call(API_APPLICATION_MAIN_ISSHUTTINGDOWN, (int)0);
return __retval;
}
inline const wchar_t *api_application::path_getAppPath()
{
const wchar_t *__retval = _call(API_APPLICATION_PATH_GETAPPPATH, (const wchar_t *)0);
return __retval;
}
inline const wchar_t *api_application::path_getUserSettingsPath()
{
return _call(API_APPLICATION_PATH_GETUSERSETTINGSPATH, (const wchar_t *)0);
}
inline const wchar_t *api_application::path_getSkinSettingsPath()
{
return _call(API_APPLICATION_PATH_GETSKINSETTINGSPATH, (const wchar_t *)0);
}
inline int api_application::app_getInitCount()
{
int __retval = _call(API_APPLICATION_APP_GETINITCOUNT, 0);
return __retval;
}
inline intptr_t api_application::app_messageLoopStep()
{
return _call(API_APPLICATION_APP_MESSAGELOOPSTEP, (intptr_t)1);
}
#ifdef _WIN32
inline void api_application::app_addMessageProcessor(ifc_messageprocessor *processor)
{
_voidcall(API_APPLICATION_APP_ADDMESSAGEPROCESSOR, processor);
}
inline void api_application::app_removeMessageProcessor(ifc_messageprocessor *processor)
{
_voidcall(API_APPLICATION_APP_REMOVEMESSAGEPROCESSOR, processor);
}
inline void api_application::app_addAccelerators(HWND hwnd, HACCEL *phAccel, INT cAccel, UINT translateMode)
{
_voidcall(API_APPLICATION_APP_ADDACCELERATORS, hwnd, phAccel, cAccel, translateMode);
}
inline void api_application::app_removeAccelerators(HWND hwnd)
{
_voidcall(API_APPLICATION_APP_REMOVEACCELERATORS, hwnd);
}
inline bool api_application::app_translateAccelerators(MSG *msg)
{
return _call(API_APPLICATION_APP_TRANSLATEACCELERATORS, (bool)false, msg);
}
inline int api_application::app_getAccelerators(HWND hwnd, HACCEL *phAccel, INT cchAccelMax, BOOL bGlobal)
{
return _call(API_APPLICATION_APP_GETACCELERATORS, (int)0, hwnd, phAccel, cchAccelMax, bGlobal);
}
inline void api_application::app_registerGlobalWindow(HWND hwnd)
{
_voidcall(API_APPLICATION_APP_REGISTERGLOBALWINDOW, hwnd);
}
inline void api_application::app_unregisterGlobalWindow(HWND hwnd)
{
_voidcall(API_APPLICATION_APP_UNREGISTERGLOBALWINDOW, hwnd);
}
inline bool api_application::DirectMouseWheel_RegisterSkipClass(ATOM klass)
{
return _call(API_APPLICATION_DIRECTMOUSEWHEEL_REGISTERSKIPCLASS, (bool)false, klass);
}
inline bool api_application::DirectMouseWheel_UnregisterSkipClass(ATOM klass)
{
return _call(API_APPLICATION_DIRECTMOUSEWHEEL_UNREGISTERSKIPCLASS, (bool)false, klass);
}
inline bool api_application::DirectMouseWheel_EnableConvertToMouseWheel(HWND hwnd, BOOL enable)
{
return _call(API_APPLICATION_DIRECTMOUSEWHEEL_ENABLECONVERTTOMOUSEWHEEL, (bool)false, hwnd, enable);
}
inline BOOL api_application::DirectMouseWheel_ProcessDialogMessage(HWND hwnd, unsigned int uMsg, WPARAM wParam, LPARAM lParam, const int controls[], int controlslen)
{
return _call(API_APPLICATION_DIRECTMOUSEWHEEL_PROCESSDIALOGMESSAGE, (BOOL)FALSE, hwnd, uMsg, wParam, lParam, controls, controlslen);
}
inline void api_application::ActiveDialog_Register(HWND hwnd)
{
_voidcall(API_APPLICATION_ACTIVEDIALOG_REGISTER, hwnd);
}
inline void api_application::ActiveDialog_Unregister(HWND hwnd)
{
_voidcall(API_APPLICATION_ACTIVEDIALOG_UNREGISTER, hwnd);
}
inline HWND api_application::ActiveDialog_Get()
{
return _call(API_APPLICATION_ACTIVEDIALOG_GET, (HWND)NULL);
}
inline const wchar_t *api_application::getATFString()
{
return _call(API_APPLICATION_GETATFSTRING, (wchar_t *)0);
}
inline int api_application::getScaleX(int x)
{
return _call(API_APPLICATION_GETSCALEX, (int)0, x);
}
inline int api_application::getScaleY(int y)
{
return _call(API_APPLICATION_GETSCALEY, (int)0, y);
}
#endif
inline const wchar_t *api_application::path_getWorkingPath()
{
return _call(API_APPLICATION_PATH_GETWORKINGPATH, (wchar_t *)0);
}
inline void api_application::path_setWorkingPath(const wchar_t *newPath)
{
_voidcall(API_APPLICATION_PATH_SETWORKINGPATH, newPath);
}
inline int api_application::GetMachineID(GUID *id)
{
return _call(API_APPLICATION_GETMACHINEID, (int)API_APPLICATION_FAILURE, id);
}
inline int api_application::GetUserID(GUID *id)
{
return _call(API_APPLICATION_GETUSERID, (int)API_APPLICATION_FAILURE, id);
}
inline int api_application::GetSessionID(GUID *id)
{
return _call(API_APPLICATION_GETSESSIONID, (int)API_APPLICATION_FAILURE, id);
}
inline size_t api_application::AllocateThreadStorage()
{
return _call(API_APPLICATION_ALLOCATETHREADSTORAGE, (size_t)-1);
}
inline void *api_application::GetThreadStorage(size_t index)
{
return _call(API_APPLICATION_GETTHREADSTORAGE, (void *)0, index);
}
inline void api_application::SetThreadStorage(size_t index, void *value)
{
_voidcall(API_APPLICATION_SETTHREADSTORAGE, index, value);
}
// ----------------------------------------------------------------------------
// {23B96771-09D7-46d3-9AE2-20DCEA6C86EA}
static const GUID applicationApiServiceGuid =
{
0x23b96771, 0x9d7, 0x46d3, { 0x9a, 0xe2, 0x20, 0xdc, 0xea, 0x6c, 0x86, 0xea }
};
extern api_application *applicationApi;
#endif // __API_APPLICATION_H
@@ -0,0 +1,204 @@
#include <precomp.h>
//<?#include "<class data="implementationheader"/>"
#include "api_applicationi.h"
//?>
#include <wasabicfg.h>
#include <api/application/pathmgr.h>
#include <api/application/version.h>
#include <api/apiinit.h>
#ifdef WA3COMPATIBILITY
#include <runtime/main.h> // CUT!
#include <wndmgr/layout.h> // CUT!
#include <skin/skinparse.h>
#endif
StringW g_resourcepath;
// {3CBD4483-DC44-11d3-B608-000086340885}
static const GUID _baseGUID =
{ 0x3cbd4483, 0xdc44, 0x11d3, { 0xb6, 0x8, 0x0, 0x0, 0x86, 0x34, 0x8, 0x85 } };
api_application *applicationApi = NULL;
api_applicationI::api_applicationI(HINSTANCE instance, const wchar_t *_userPath)
: appInstance(instance), mainthread(0), shuttingdown(0)
{
userPath = _userPath;
#ifndef _WASABIRUNTIME
#ifdef WASABI_DIRS_FROMEXEPATH
HINSTANCE hInst = GetModuleHandle(0);
#else
HINSTANCE hInst = appInstance;
#endif
StringW path;
{
wchar_t g[WA_MAX_PATH];
GetModuleFileNameW(hInst, g, WA_MAX_PATH - 1);
wchar_t *p = wcsrchr(g, '\\');
if (p) *p = 0;
path = g;
}
#ifdef WIN32
g_resourcepath = path;
#elif defined(LINUX)
g_resourcepath = "/usr/local/share/";
g_resourcepath += WasabiVersion::getAppName();
#endif
#ifdef LINUX
//char *file = getenv( "WASABI_LOG_FILE" );
//if (!ACCESS(file, 0)) UNLINK(file);
#endif
apppath = path;
g_resourcepath.AddBackslash();
#if defined(WASABI_COMPILE_SKIN) || defined(WASABI_COMPILE_IMGLDR)
g_resourcepath.AppendPath(WASABI_RESOURCES_SUBDIRECTORY);
#endif
#endif
#ifdef WIN32
HANDLE h = NULL;
DuplicateHandle(GetCurrentProcess(), GetCurrentThread(), GetCurrentProcess(), &h, 0, FALSE, DUPLICATE_SAME_ACCESS);
mainthread = h; // 32-bit writes assumed atomic
#endif
#ifdef LINUX
DebugString("portme: api main thread handle dup\n");
#endif
}
api_applicationI::~api_applicationI()
{
g_resourcepath.purge();
}
const wchar_t *api_applicationI::main_getAppName()
{
return WasabiVersion::getAppName();
}
const wchar_t *api_applicationI::main_getVersionString()
{
return WasabiVersion::getVersionString();
}
unsigned int api_applicationI::main_getBuildNumber()
{
return WasabiVersion::getBuildNumber();
}
GUID api_applicationI::main_getGUID()
{
return guid;
}
HANDLE api_applicationI::main_getMainThreadHandle()
{
if (mainthread == 0) return (HANDLE)0;
HANDLE h = (HANDLE)0;
#ifdef WIN32
DuplicateHandle(GetCurrentProcess(), mainthread, GetCurrentProcess(), &h, 0, FALSE, DUPLICATE_SAME_ACCESS);
#endif
#ifdef LINUX
DebugString("portme: dup handle\n");
#endif
return h;
}
HINSTANCE api_applicationI::main_gethInstance()
{
return appInstance;
}
const wchar_t *api_applicationI::main_getCommandLine()
{
return cmdLine;
}
void api_applicationI::main_shutdown(int deferred)
{
int x = 1;
#ifdef WASABI_CHECK_CAN_EXIT
WASABI_CHECK_CAN_EXIT(x)
#endif
if (!x) return ;
shuttingdown = 1;
#ifdef _WASABIRUNTIME
Main::doAction(ACTION_CLOSE, deferred);
#endif
#ifdef WASABI_CUSTOM_QUIT
WASABI_CUSTOM_QUITFN
#endif
}
void api_applicationI::main_cancelShutdown()
{
#ifdef _WASABIRUNTIME
Main::cancelShutdown();
#endif
shuttingdown = 0;
}
int api_applicationI::main_isShuttingDown()
{
return shuttingdown;
}
const wchar_t *api_applicationI::path_getAppPath()
{
#ifdef _WASABIRUNTIME
return Main::getMainAppPath();
#endif
return apppath;
}
const wchar_t *api_applicationI::path_getUserSettingsPath()
{
return userPath;
//return PathMgr::getUserSettingsPath();
}
void api_applicationI::setHInstance(HINSTANCE instance)
{
appInstance = instance;
};
void api_applicationI::setCommandLine(const wchar_t *cmdline)
{
cmdLine = cmdline;
}
void api_applicationI::setGUID(GUID g)
{
guid = g;
}
int api_applicationI::app_getInitCount()
{
return ApiInit::getInitCount();
}
int api_applicationI::app_messageLoopStep()
{
#if defined(WASABI_COMPILE_TIMERS) || defined(WASABI_COMPILE_WND)
MSG msg;
if (PeekMessage(&msg, NULL, 0, 0, PM_NOREMOVE))
{
if (!GetMessage( &msg, NULL, 0, 0 )) return 0;
#ifdef WASABI_COMPILE_WND
TranslateMessage( &msg );
#endif
DispatchMessage( &msg );
}
#endif
return 1;
}
@@ -0,0 +1,49 @@
#ifndef __API_APPLICATIONI_IMPL_H
#define __API_APPLICATIONI_IMPL_H
/*<?<autoheader/>*/
#include "api_application.h"
#include "api_applicationx.h"
/*?>*/
/*[interface.header.h]
#include "common/nsGUID.h"
class String;
*/
class api_applicationI : public api_applicationX {
public:
NODISPATCH api_applicationI(HINSTANCE instance, const wchar_t *_userPath);
NODISPATCH virtual ~api_applicationI();
DISPATCH(10) const wchar_t *main_getAppName();
DISPATCH(20) const wchar_t *main_getVersionString();
DISPATCH(30) unsigned int main_getBuildNumber();
DISPATCH(40) GUID main_getGUID();
DISPATCH(50) HANDLE main_getMainThreadHandle();
DISPATCH(60) HINSTANCE main_gethInstance();
DISPATCH(70) const wchar_t *main_getCommandLine();
DISPATCH(80) void main_shutdown(int deferred = TRUE);
DISPATCH(90) void main_cancelShutdown();
DISPATCH(100) int main_isShuttingDown();
DISPATCH(110) const wchar_t *path_getAppPath();
DISPATCH(120) const wchar_t *path_getUserSettingsPath();
DISPATCH(130) int app_getInitCount();
DISPATCH(140) int app_messageLoopStep();
NODISPATCH void setHInstance(HINSTANCE instance);
NODISPATCH void setCommandLine(const wchar_t *cmdline);
NODISPATCH void setGUID(GUID g);
protected:
HINSTANCE appInstance;
StringW cmdLine;
StringW userPath;
HANDLE mainthread;
GUID guid;
int shuttingdown;
StringW apppath;
};
#endif // __API_APPLICATIONI_IMPL_H
@@ -0,0 +1,33 @@
// ----------------------------------------------------------------------------
// Generated by InterfaceFactory [Wed May 07 00:55:56 2003]
//
// File : api_applicationx.cpp
// Class : api_application
// class layer : Dispatchable Receiver
// ----------------------------------------------------------------------------
#include <precomp.h>
#include "api_applicationx.h"
#ifdef CBCLASS
#undef CBCLASS
#endif
#define CBCLASS api_applicationX
START_DISPATCH;
CB(API_APPLICATION_MAIN_GETAPPNAME, main_getAppName);
CB(API_APPLICATION_MAIN_GETVERSIONSTRING, main_getVersionString);
CB(API_APPLICATION_MAIN_GETBUILDNUMBER, main_getBuildNumber);
CB(API_APPLICATION_MAIN_GETGUID, main_getGUID);
CB(API_APPLICATION_MAIN_GETMAINTHREADHANDLE, main_getMainThreadHandle);
CB(API_APPLICATION_MAIN_GETHINSTANCE, main_gethInstance);
CB(API_APPLICATION_MAIN_GETCOMMANDLINE, main_getCommandLine);
VCB(API_APPLICATION_MAIN_SHUTDOWN, main_shutdown);
VCB(API_APPLICATION_MAIN_CANCELSHUTDOWN, main_cancelShutdown);
CB(API_APPLICATION_MAIN_ISSHUTTINGDOWN, main_isShuttingDown);
CB(API_APPLICATION_PATH_GETAPPPATH, path_getAppPath);
CB(API_APPLICATION_PATH_GETUSERSETTINGSPATH, path_getUserSettingsPath);
CB(API_APPLICATION_APP_GETINITCOUNT, app_getInitCount);
CB(API_APPLICATION_APP_MESSAGELOOPSTEP, app_messageLoopStep);
END_DISPATCH;
#undef CBCLASS
@@ -0,0 +1,42 @@
// ----------------------------------------------------------------------------
// Generated by InterfaceFactory [Wed May 07 00:55:56 2003]
//
// File : api_applicationx.h
// Class : api_application
// class layer : Dispatchable Receiver
// ----------------------------------------------------------------------------
#ifndef __API_APPLICATIONX_H
#define __API_APPLICATIONX_H
#include "api_application.h"
// ----------------------------------------------------------------------------
class api_applicationX : public api_application {
protected:
api_applicationX() {}
public:
virtual const wchar_t *main_getAppName()=0;
virtual const wchar_t *main_getVersionString()=0;
virtual unsigned int main_getBuildNumber()=0;
virtual GUID main_getGUID()=0;
virtual HANDLE main_getMainThreadHandle()=0;
virtual HINSTANCE main_gethInstance()=0;
virtual const wchar_t *main_getCommandLine()=0;
virtual void main_shutdown(int deferred = TRUE)=0;
virtual void main_cancelShutdown()=0;
virtual int main_isShuttingDown()=0;
virtual const wchar_t *path_getAppPath()=0;
virtual const wchar_t *path_getUserSettingsPath()=0;
virtual int app_getInitCount()=0;
virtual int app_messageLoopStep()=0;
protected:
RECVS_DISPATCH;
};
#endif // __API_APPLICATIONX_H
@@ -0,0 +1 @@
#include "api_messageprocessor.h"
@@ -0,0 +1,26 @@
#ifndef __WASABI_IFC_MESSAGEPROCESSOR_H
#define __WASABI_IFC_MESSAGEPROCESSOR_H
#include <bfc/dispatch.h>
#include <windows.h>
class ifc_messageprocessor : public Dispatchable
{
protected:
ifc_messageprocessor() {}
~ifc_messageprocessor() {}
public:
bool ProcessMessage(MSG *msg); // return true to 'eat' the message
public:
DISPATCH_CODES
{
IFC_MESSAGEPROCESSOR_PROCESS_MESSAGE = 10,
};
};
inline bool ifc_messageprocessor::ProcessMessage(MSG *msg)
{
return _call(IFC_MESSAGEPROCESSOR_PROCESS_MESSAGE, false, msg);
}
typedef ifc_messageprocessor api_messageprocessor; // TODO: CUT!
#endif
@@ -0,0 +1,7 @@
#include "ifc_messageprocessori.h"
#define CBCLASS ifc_messageprocessorI
START_DISPATCH;
CB(IFC_MESSAGEPROCESSOR_PROCESS_MESSAGE, ProcessMessage)
END_DISPATCH;
#undef CBCLASS
@@ -0,0 +1,13 @@
#ifndef NULLSOFT_WASABI_MESSAGEPROCESSORI_H
#define NULLSOFT_WASABI_MESSAGEPROCESSORI_H
#include <api/application/ifc_messageprocessor.h>
class ifc_messageprocessorI: public ifc_messageprocessor
{
public:
virtual bool ProcessMessage(MSG *msg)=0;
protected:
RECVS_DISPATCH;
};
#endif
+97
View File
@@ -0,0 +1,97 @@
#include <precomp.h>
#ifdef WASABI_API_COMPONENT
#include <api/wac/main.h> //CUT!!!
#endif
#include "ipcs.h"
#ifdef LINUX
#include <api/linux/linuxapi.h>
#endif
using namespace IpcsCommand;
#ifdef WIN32
IpcsPtr::IpcsPtr(HWND h) {
hwnd = h;
}
#else
IpcsPtr::IpcsPtr(int q) {
qid = q;
}
#endif
void IpcsPtr::moveToForeground() {
#ifdef WIN32
if (IsIconic(hwnd)) ShowWindow(hwnd, SW_RESTORE);
// ShowWindow(hwnd,SW_SHOW); //FG> SW_RESTORE should take care of it and is trapped for taskbar button hiding. Explicitly showing the window will make an iconless button reapear if studio is set to not have a taskbar button
SetForegroundWindow(hwnd);
#else
DebugString( "portme -- IpcsPtr::moveToForeground\n" );
#endif
}
void IpcsPtr::sendWasabiCommand(int command, void *param, int paramlen) {
#ifdef WIN32
COPYDATASTRUCT cd;
cd.dwData=command;
cd.cbData=paramlen;
cd.lpData=param;
SendMessage(hwnd, WM_COPYDATA, NULL, (long)&cd);
#else
wa_msgbuf msg;
msg.mtype = command;
ASSERT( paramlen < IPC_MSGMAX - 4 );
msg.paramlen = paramlen;
MEMCPY( msg.param, param, paramlen );
if ( msgsnd( qid , &msg, IPC_MSGMAX, 0 ) == 1 ) {
perror( "msgsnd" );
}
#endif
}
void IpcsPtr::sendWasabiCommand(int command, const char *param) {
sendWasabiCommand(command, (void *)param, STRLEN(param)+1);
}
IpcsPtr *Ipcs::getOtherWasabiInstance() {
extern String ipcWindowClassName;
#ifdef WIN32
HWND hwnd_instance=FindWindow(ipcWindowClassName,NULL);
if(!hwnd_instance) return NULL;
return(new IpcsPtr(hwnd_instance));
#else
int key = ftok( ".", 'w' );
int qid = msgget( key, 0 );
if ( qid == -1 && errno == ENOENT ) {
qid = msgget( key, IPC_CREAT | IPC_EXCL | 0660 );
LinuxAPI::setIPCId( qid );
return NULL;
} else if ( qid == -1 ) {
return NULL;
} else {
return new IpcsPtr( qid );
}
#endif
}
#pragma warning(push)
#pragma warning(disable: 4060)
int Ipcs::onIpcsMessage(int command, void *param, int paramlen) {
switch(command) {
#ifdef WASABI_API_COMPONENT
case IPC_COMMANDLINE:
Main::processCommandLine((const char *)param);
return 0;
#endif
}
return 0;
}
#pragma warning(pop)
+60
View File
@@ -0,0 +1,60 @@
#ifndef _IPCS_H
#define _IPCS_H
// same value as winamp 2.x
#define WM_WA_IPC WM_USER
#ifdef LINUX
// Stolen from a webpage, I think Linux's is higher, but to be safe...
#define IPC_MSGMAX 4056
struct wa_msgbuf {
long mtype;
int paramlen;
char param[IPC_MSGMAX - 4];
};
#endif
namespace IpcsCommand {
enum {
#ifdef WASABI_API_MEDIACORE
// wa2.x IPC messages
IPC_PLAYFILE=100,
#endif
#ifdef WASABI_API_COMPONENT
// wa3 IPC messages
IPC_COMMANDLINE=1000,
#endif
};
};
class IpcsPtr {
public:
#ifdef WIN32
IpcsPtr(HWND hwnd);
#else
IpcsPtr(int qid);
#endif
void sendWasabiCommand(int command, void *param=0, int paramlen=0);
void sendWasabiCommand(int command, const char *param);
void moveToForeground();
private:
#ifdef WIN32
HWND hwnd;
#else
int qid;
#endif
};
class Ipcs {
public:
static IpcsPtr *getOtherWasabiInstance();
static int onIpcsMessage(int command, void *param, int paramlen);
};
#endif
+14
View File
@@ -0,0 +1,14 @@
#include <precomp.h>
#include "pathmgr.h"
#include <api/api.h>
#include <bfc/util/inifile.h>
#if !defined(WIN32) && !defined(LINUX)
#error port me
#endif
#ifdef WIN32
#include <shlobj.h>
#endif
+15
View File
@@ -0,0 +1,15 @@
#ifndef _PATHMGR_H
#define _PATHMGR_H
#include <bfc/std.h>
class PathMgr
{
public:
//static const char *getUserSettingsPath();
#ifdef WASABI_COMPILE_COMPONENTS
static const wchar_t *getComponentDataPath(GUID g);
#endif
};
#endif
+47
View File
@@ -0,0 +1,47 @@
#include <precomp.h>
#include "version.h"
#include <bfc/parse/pathparse.h>
static int buildno = -1;
static const wchar_t *WASABI_VERSION = L"";
#define STRFILEVER "1, 0, 0, 502\0"
static StringW version_string;
void WasabiVersion::setAppName(const wchar_t *name)
{
appname = name;
}
const wchar_t *WasabiVersion::getAppName()
{
return appname;
}
const wchar_t *WasabiVersion::getVersionString()
{
if (appname.isempty())
appname=L"";
if (version_string.isempty())
{
if (!appname.isempty())
version_string = appname.getValue();
if (wcslen(WASABI_VERSION))
{
version_string.cat(L" ");
version_string.cat(WASABI_VERSION);
}
}
return version_string;
}
unsigned int WasabiVersion::getBuildNumber()
{
if (buildno == -1)
{
PathParser pp(STRFILEVER, ",");
buildno = ATOI(pp.enumString(3));
}
return buildno;
}
+12
View File
@@ -0,0 +1,12 @@
#ifndef _VERSION_H
#define _VERSION_H
/*
class WasabiVersion {
public:
static void setAppName(const wchar_t *name);
static const wchar_t *getAppName();
static const wchar_t *getVersionString();
static unsigned int getBuildNumber();
};*/
#endif
+12
View File
@@ -0,0 +1,12 @@
#include <precomp.h>
#include "wkc.h"
#define CBCLASS WasabiKernelControllerI
START_DISPATCH;
CB(TESTCOMPONENT, testComponent);
CB(TESTSCRIPT, testScript);
CB(TESTSKIN, testSkin);
CB(TESTSKINFILE, testSkinFile);
END_DISPATCH;
#undef CBCLASS
+61
View File
@@ -0,0 +1,61 @@
#ifndef _WKC_H
#define _WKC_H
#include <bfc/dispatch.h>
/**
A callback class for the loader so it can determine which resources wasabi.dll should load.
*/
class NOVTABLE WasabiKernelController : public Dispatchable {
public:
/**
Check if a component should load.
*/
int testComponent(const char *filename);
int testScript(const char *filename, void *data, int datalen);
int testSkin(const char *skinname);
int testSkinFile(const char *filename);
protected:
enum {
TESTCOMPONENT=1000,
TESTSCRIPT=2000,
TESTSKIN=3000,
TESTSKINFILE=4000,
};
};
inline
int WasabiKernelController::testComponent(const char *filename) {
return _call(TESTCOMPONENT, TRUE, filename);
}
inline
int WasabiKernelController::testScript(const char *filename, void *data, int datalen) {
return _call(TESTSCRIPT, TRUE, filename, data, datalen);
}
inline
int WasabiKernelController::testSkin(const char *skinname) {
return _call(TESTSKIN, TRUE, skinname);
}
inline
int WasabiKernelController::testSkinFile(const char *filename) {
return _call(TESTSKINFILE, TRUE, filename);
}
// implementors derive from this one
class WasabiKernelControllerI : public WasabiKernelController {
public:
// default to OK
virtual int testComponent(const char *filename) { return 1; }
virtual int testScript(const char *filename, void *data, int datalen) { return 1; }
virtual int testSkin(const char *skinname) { return 1; }
virtual int testSkinFile(const char *filename) { return 1; }
protected:
RECVS_DISPATCH;
};
#endif