Initial community commit

This commit is contained in:
Jef 2024-09-24 14:54:57 +02:00
parent 537bcbc862
commit fc06254474
16440 changed files with 4239995 additions and 2 deletions

View file

@ -0,0 +1,78 @@
#ifndef __API_MEMMGR_H
#define __API_MEMMGR_H
#include "../../bfc/dispatch.h"
#include "../../bfc/platform/types.h"
class NOVTABLE api_memmgr : public Dispatchable
{
protected:
api_memmgr() {}
~api_memmgr() {}
public:
void *sysMalloc(size_t size);
void sysFree(void *ptr);
void *sysRealloc(void *ptr, size_t newsize);
void sysMemChanged(void *ptr);
DISPATCH_CODES
{
API_MEMMGR_SYSMALLOC = 0,
API_MEMMGR_SYSFREE = 10,
API_MEMMGR_SYSREALLOC = 20,
API_MEMMGR_SYSMEMCHANGED = 30,
};
// Some helper templates to new and delete objects with the memory manager
// you need to be cautious with Delete() and inheritance, particularly if you're dealing with a base class
// as the pointer to the derived class might not equal to the pointer to the base class, particularly with multiple inheritance
// e.g. class C : public A, public B {}; C c; assert((A*)&c == (B*)&c); will likely fail
template <class Class>
void New(Class **obj)
{
size_t toAlloc = sizeof(Class);
void *mem = sysMalloc(toAlloc);
*obj = new (mem) Class;
}
template <class Class>
void Delete(Class *obj)
{
if (obj)
{
obj->~Class();
sysFree(obj);
}
}
};
inline void *api_memmgr::sysMalloc(size_t size)
{
return _call(API_MEMMGR_SYSMALLOC, (void *)NULL, size);
}
inline void api_memmgr::sysFree(void *ptr)
{
_voidcall(API_MEMMGR_SYSFREE, ptr);
}
inline void *api_memmgr::sysRealloc(void *ptr, size_t newsize)
{
return _call(API_MEMMGR_SYSREALLOC, (void *)NULL, ptr, newsize);
}
inline void api_memmgr::sysMemChanged(void *ptr)
{
_voidcall(API_MEMMGR_SYSMEMCHANGED, ptr);
}
// {000CF46E-4DF6-4a43-BBE7-40E7A3EA02ED}
static const GUID memMgrApiServiceGuid =
{ 0xcf46e, 0x4df6, 0x4a43, { 0xbb, 0xe7, 0x40, 0xe7, 0xa3, 0xea, 0x2, 0xed } };
//extern api_memmgr *memmgrApi;
#endif

View file

@ -0,0 +1,155 @@
// ----------------------------------------------------------------------------
// Generated by InterfaceFactory [Wed May 07 00:56:11 2003]
//
// File : api_service.h
// Class : api_service
// class layer : Dispatchable Interface
// ----------------------------------------------------------------------------
#ifndef __API_SERVICE_H
#define __API_SERVICE_H
#include "../../bfc/dispatch.h"
#include "../../bfc/platform/types.h"
namespace SvcNotify {
enum {
ONREGISTERED=100, // init yourself here -- not all other services are registered yet
ONSTARTUP=200, // everyone is initialized, safe to talk to other services
ONAPPRUNNING=210, // app is showing and processing events
ONSHUTDOWN=300, // studio is shutting down, release resources from other services
ONDEREGISTERED=400, // bye bye
ONDBREADCOMPLETE=500,// after db is read in (happens asynchronously after ONSTARTUP)
ONBEFORESHUTDOWN=600, // system is about to shutdown, call WASABI_API_APP->main_cancelShutdown() to cancel
};
}
class waServiceFactory;
// ----------------------------------------------------------------------------
class NOVTABLE api_service: public Dispatchable {
protected:
api_service() {}
~api_service() {}
public:
int service_register(waServiceFactory *svc);
int service_deregister(waServiceFactory *svc);
size_t service_getNumServices(FOURCC svc_type);
waServiceFactory *service_enumService(FOURCC svc_type, size_t n);
waServiceFactory *service_getServiceByGuid(GUID guid);
int service_lock(waServiceFactory *owner, void *svcptr);
int service_clientLock(void *svcptr);
int service_release(void *svcptr);
const char *service_getTypeName(FOURCC svc_type);
#ifdef WASABI_COMPILE_COMPONENTS
GUID service_getOwningComponent(void *svcptr);
GUID service_getLockingComponent(void *svcptr);
#endif // WASABI_COMPILE_COMPONENTS
int service_unlock(void *svcptr);
int service_isvalid(FOURCC svctype, waServiceFactory *service);
// removes "me" from the services list and finds a second service with the same GUID and puts it in the same position
// this is used by the lazy loader service factory - you shouldn't need it for any other purposes.
// returns 0 if compaction actually happened
int service_compactDuplicates(waServiceFactory *me);
protected:
enum {
API_SERVICE_SERVICE_REGISTER = 10,
API_SERVICE_SERVICE_DEREGISTER = 20,
API_SERVICE_SERVICE_GETNUMSERVICES = 30,
API_SERVICE_SERVICE_ENUMSERVICE = 40,
API_SERVICE_SERVICE_GETSERVICEBYGUID = 50,
API_SERVICE_SERVICE_LOCK = 60,
API_SERVICE_SERVICE_CLIENTLOCK = 70,
API_SERVICE_SERVICE_RELEASE = 80,
API_SERVICE_SERVICE_GETTYPENAME = 90,
#ifdef WASABI_COMPILE_COMPONENTS
API_SERVICE_SERVICE_GETOWNINGCOMPONENT = 100,
API_SERVICE_SERVICE_GETLOCKINGCOMPONENT = 110,
#endif // WASABI_COMPILE_COMPONENTS
API_SERVICE_SERVICE_UNLOCK = 120,
API_SERVICE_ISVALID = 130,
API_SERVICE_COMPACT_DUPLICATES = 140,
};
};
// ----------------------------------------------------------------------------
inline int api_service::service_register(waServiceFactory *svc) {
int __retval = _call(API_SERVICE_SERVICE_REGISTER, (int)0, svc);
return __retval;
}
inline int api_service::service_deregister(waServiceFactory *svc) {
int __retval = _call(API_SERVICE_SERVICE_DEREGISTER, (int)0, svc);
return __retval;
}
inline size_t api_service::service_getNumServices(FOURCC svc_type) {
int __retval = _call(API_SERVICE_SERVICE_GETNUMSERVICES, (int)0, svc_type);
return __retval;
}
inline waServiceFactory *api_service::service_enumService(FOURCC svc_type, size_t n) {
waServiceFactory *__retval = _call(API_SERVICE_SERVICE_ENUMSERVICE, (waServiceFactory *)0, svc_type, n);
return __retval;
}
inline waServiceFactory *api_service::service_getServiceByGuid(GUID guid) {
waServiceFactory *__retval = _call(API_SERVICE_SERVICE_GETSERVICEBYGUID, (waServiceFactory *)0, guid);
return __retval;
}
inline int api_service::service_lock(waServiceFactory *owner, void *svcptr) {
int __retval = _call(API_SERVICE_SERVICE_LOCK, (int)0, owner, svcptr);
return __retval;
}
inline int api_service::service_clientLock(void *svcptr) {
int __retval = _call(API_SERVICE_SERVICE_CLIENTLOCK, (int)0, svcptr);
return __retval;
}
inline int api_service::service_release(void *svcptr) {
int __retval = _call(API_SERVICE_SERVICE_RELEASE, (int)0, svcptr);
return __retval;
}
inline const char *api_service::service_getTypeName(FOURCC svc_type) {
const char *__retval = _call(API_SERVICE_SERVICE_GETTYPENAME, (const char *)0, svc_type);
return __retval;
}
#ifdef WASABI_COMPILE_COMPONENTS
inline GUID api_service::service_getOwningComponent(void *svcptr) {
GUID __retval = _call(API_SERVICE_SERVICE_GETOWNINGCOMPONENT, INVALID_GUID, svcptr);
return __retval;
}
inline GUID api_service::service_getLockingComponent(void *svcptr) {
GUID __retval = _call(API_SERVICE_SERVICE_GETLOCKINGCOMPONENT, INVALID_GUID, svcptr);
return __retval;
}
#endif // WASABI_COMPILE_COMPONENTS
inline int api_service::service_unlock(void *svcptr) {
int __retval = _call(API_SERVICE_SERVICE_UNLOCK, (int)0, svcptr);
return __retval;
}
inline int api_service::service_isvalid(FOURCC svctype, waServiceFactory *service) {
int __retval = _call(API_SERVICE_ISVALID, (int)0, svctype, service);
return __retval;
}
inline int api_service::service_compactDuplicates(waServiceFactory *me)
{
return _call(API_SERVICE_COMPACT_DUPLICATES, (int)1, me);
}
// ----------------------------------------------------------------------------
extern api_service *serviceApi;
#endif // __API_SERVICE_H

View file

@ -0,0 +1,68 @@
#ifndef _SERVICES_H
#define _SERVICES_H
#include <bfc/std_mkncc.h> // for MKnCC()
// lower-case service names are reserved by Nullsoft for future use
// upper-case service names are for 3rd parties to extend the service system
// if you have a service that is unique to a component, make it type
// UNIQUE and register it by GUID
namespace WaSvc {
enum {
NONE=MK4CC('n','o','n','e'),
UNIQUE=MK4CC('u','n','i','q'), // for unique services, enumed by GUID
OBJECT=MK4CC('o','b','j','f'), // for unique objects, enumed by GUID
CONTEXTCMD=MK4CC('c','c','m','d'), // context menu command svc_contextCmd.h
DEVICE=MK3CC('d','e','v'), // portable device svc_device.h
FILEREADER=MK4CC('f','s','r','d'), // file system reader (disk, zip, http)
FILESELECTOR=MK4CC('f','s','e','l'), // file selector svc_filesel.h
STORAGEVOLENUM=MK4CC('f','s','e','n'), // storage volume enumerator.
IMAGEGENERATOR=MK4CC('i','m','g','n'), // image generator svc_imggen.h
IMAGELOADER=MK4CC('i','m','g','l'), // image loader svc_imgload.h
IMAGEWRITER=MK4CC('i','m','g','w'), // image writer
ITEMMANAGER=MK4CC('i','m','g','r'), // item manager svc_itemmgr.h
PLAYLISTREADER=MK4CC('p','l','r','d'), // playlist reader - DEPRECATED - only for wa3
PLAYLISTWRITER=MK4CC('p','l','w','r'), // playlist writer - DEPRECATED - only for wa3
MEDIACONVERTER=MK4CC('c','o','n','v'), // media converter
MEDIACORE=MK4CC('c','o','r','e'), // media core
MEDIARECORDER=MK4CC('m','r','e','c'), // media recorder
SCRIPTOBJECT=MK4CC('m','a','k','i'), // third party script object
// TRANSLATOR=MK4CC('x','l','a','t'), // text translator
WINDOWCREATE=MK4CC('w','n','d','c'), // window creator
XMLPROVIDER=MK4CC('x','m','l','p'), // xml provider
DB=MK2CC('d','b'), // database
SKINFILTER=MK4CC('f','l','t','r'), // bitmap/colorref skin filter
METADATA=MK4CC('m','t','d','t'), // play item meta data
METATAG=MK4CC('m','t','t','g'), // metadata tagging of play items
EVALUATOR=MK4CC('e','v','a','l'), // evaluate a string
MINIBROWSER=MK2CC('m','b'), // minibrowser
TOOLTIPSRENDERER=MK4CC('t','t','i','p'), // tooltips renderer
XUIOBJECT=MK4CC('x','u','i','o'), // xml gui objects
STRINGCONVERTER=MK4CC('u','t','f','8'), // unicode string conversion
ACTION=MK3CC('a','c','t'), // custom actions (ie: for buttons)
COREADMIN=MK4CC('c','a','d','m'), // core administrator
DROPTARGET=MK4CC('d','r','o','p'), // drop targets
OBJECTDIR=MK4CC('o','b','j','d'), // object directory
TEXTFEED=MK4CC('t','x','t','f'), // text feed, to send text to various XUI objects (ie: <Text> by using display="textfeedid"
ACCESSIBILITY=MK4CC('a','c','c','s'), // accessibility service
ACCESSIBILITYROLESERVER=MK4CC('r','o','l','e'), // accessibility roleServer services
EXPORTER=MK3CC('e','x','p'), // exporter
COLLECTION=MK4CC('c','l','c','t'), // named xml overridable collection
REDIRECT=MK4CC('r','e','d','r'), // filename redirect
FONTRENDER=MK4CC('f','o','n','t'), // font renderer (bitmap/truetype/freetype)
SRCCLASSFACTORY=MK4CC('c','l','f','a'), // source code class factory
SRCEDITOR=MK4CC('s','e','d','t'), // source code editor
MP4AUDIODECODER=MK4CC('m','4','a','d'), // mp4 audio decoder
PLAYLISTREADER_WA5=MK4CC('p','l','r','5'), // playlist reader
PLAYLISTWRITER_WA5=MK4CC('p','l','w','5'), // playlist writer
PLAYLISTHANDLER=MK3CC('p','l','h'), // playlist handler
TAGPROVIDER=MK4CC('t','a','g','z'), // tag provider (for ATF engine)
NSVFACTORY=MK4CC('n','s','v','f'), // NSV factory (to create NSV objects)
JSAPI2_APICREATOR=MK4CC('j','s','a','c'), // API Creator for the Javascript API
};
};
#endif

View file

@ -0,0 +1,97 @@
// ----------------------------------------------------------------------------
// Generated by InterfaceFactory [Wed May 07 00:57:16 2003]
//
// File : waservicefactory.h
// Class : waServiceFactory
// class layer : Dispatchable Interface
// ----------------------------------------------------------------------------
#ifndef __WASERVICEFACTORY_H
#define __WASERVICEFACTORY_H
#include "../../bfc/dispatch.h"
#include "../../bfc/nsguid.h"
#include "api_service.h"
// ----------------------------------------------------------------------------
class NOVTABLE waServiceFactory: public Dispatchable {
protected:
waServiceFactory() throw() {}
~waServiceFactory() throw() {}
protected:
public:
FOURCC getServiceType();
const char *getServiceName();
GUID getGuid();
void *getInterface(int global_lock = TRUE);
int supportNonLockingGetInterface();
int releaseInterface(void *ifc);
const wchar_t *getTestString();
int serviceNotify(int msg, intptr_t param1 = 0, intptr_t param2 = 0);
protected:
enum {
WASERVICEFACTORY_GETSERVICETYPE = 100,
WASERVICEFACTORY_GETSERVICENAME = 200,
WASERVICEFACTORY_GETGUID = 210,
WASERVICEFACTORY_GETINTERFACE = 300,
WASERVICEFACTORY_SUPPORTNONLOCKINGGETINTERFACE = 301,
WASERVICEFACTORY_RELEASEINTERFACE = 310,
WASERVICEFACTORY_GETTESTSTRING = 500,
WASERVICEFACTORY_SERVICENOTIFY = 600,
};
};
// ----------------------------------------------------------------------------
inline FOURCC waServiceFactory::getServiceType() {
FOURCC __retval = _call(WASERVICEFACTORY_GETSERVICETYPE, (FOURCC)NULL);
return __retval;
}
inline const char *waServiceFactory::getServiceName() {
const char *__retval = _call(WASERVICEFACTORY_GETSERVICENAME, (const char *)0);
return __retval;
}
inline GUID waServiceFactory::getGuid() {
GUID __retval = _call(WASERVICEFACTORY_GETGUID, INVALID_GUID);
return __retval;
}
inline void *waServiceFactory::getInterface(int global_lock) {
void *__retval = _call(WASERVICEFACTORY_GETINTERFACE, (void *)NULL, global_lock);
#if 0 // unused in Winamp 5
// -- generated code - edit in waservicefactoryi.h
// support old code that always locks even when global_lock==FALSE
if (!global_lock && __retval != NULL && !supportNonLockingGetInterface())
WASABI_API_SVC->service_unlock(__retval);
#endif
return __retval;
}
inline int waServiceFactory::supportNonLockingGetInterface() {
int __retval = _call(WASERVICEFACTORY_SUPPORTNONLOCKINGGETINTERFACE, (int)0);
return __retval;
}
inline int waServiceFactory::releaseInterface(void *ifc) {
int __retval = _call(WASERVICEFACTORY_RELEASEINTERFACE, (int)0, ifc);
return __retval;
}
inline const wchar_t *waServiceFactory::getTestString() {
return _call(WASERVICEFACTORY_GETTESTSTRING, (const wchar_t *)0);
}
inline int waServiceFactory::serviceNotify(int msg, intptr_t param1, intptr_t param2) {
int __retval = _call(WASERVICEFACTORY_SERVICENOTIFY, (int)0, msg, param1, param2);
return __retval;
}
// ----------------------------------------------------------------------------
#endif // __WASERVICEFACTORY_H