diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/user/paf.h | 93 | ||||
-rw-r--r-- | include/user/paf/common.h | 82 | ||||
-rw-r--r-- | include/user/paf/graphics.h | 107 | ||||
-rw-r--r-- | include/user/paf/misc.h | 282 | ||||
-rw-r--r-- | include/user/paf/resource.h | 30 | ||||
-rw-r--r-- | include/user/paf/thread.h | 123 | ||||
-rw-r--r-- | include/user/paf/toplevel.h | 73 | ||||
-rw-r--r-- | include/user/paf/widget.h | 696 |
8 files changed, 1333 insertions, 153 deletions
diff --git a/include/user/paf.h b/include/user/paf.h index 1a6a114..b0cc028 100644 --- a/include/user/paf.h +++ b/include/user/paf.h @@ -5,14 +5,103 @@ #ifndef _VDSUITE_USER_PAF_H #define _VDSUITE_USER_PAF_H +//Class forward declarations + +namespace paf { + + class Framework; + class Plugin; + + class Resource; + + class String; + class WString; + + namespace widget { + + class Widget; + class BusyIndicator; + class Text; + class TextBox; + class Plane; + class SpeechBalloon; + class Box; + class AppIcon2D; + class Button; + class CornerButton; + class Dialog; + class ImageButton; + class ImageSlidebar; + class CompositeDrawer; + class SlidingDrawer; + class ScrollViewParent; + class ScrollBar2D; + class ScrollBarTouch; + class ScrollBar; + class SlideBar; + class RichText; + class PageTurn; + class ProgressBar; + class ProgressBarTouch; + class ListItem; + class ListView; + class FileList; + class RadioBox; + class RadioButton; + class ItemSpin; + class NumSpin; + class PlaneButton; + class CheckBox; + class CompositeButton; + class SpinBase; + class AppIconBase; + } + + namespace graphics { + + class MemoryPool; + class Surface; + class Texture; + } + + namespace datetime { + + class DateTime; + } + + namespace io { + + class File; + class Dir; + } + + class Module; + class Sha1; + class Allocator; + + namespace thread { + + class DefaultThreadPriority; + class Thread; + class Sema; + class Mutex; + class Mutex2; + class Cond; + class RWLock; + class Queue; + class SyncCall; + class JobQueue; + } +} + #include <paf/stdc.h> +#include <paf/widget.h> #include <paf/common.h> #include <paf/graphics.h> +#include <paf/toplevel.h> #include <paf/misc.h> #include <paf/resource.h> #include <paf/thread.h> -#include <paf/toplevel.h> -#include <paf/widget.h> #endif /* _VDSUITE_USER_PAF_H */ diff --git a/include/user/paf/common.h b/include/user/paf/common.h index 81851cf..e3ecda5 100644 --- a/include/user/paf/common.h +++ b/include/user/paf/common.h @@ -13,6 +13,10 @@ namespace paf { class String; class WString; + namespace widget { + class Widget; + } + namespace common { enum CesFlags @@ -23,6 +27,8 @@ namespace paf { AllowSrcBufferEnd = 0x10 }; + static paf::widget::Widget *WidgetStateTransition(SceFloat32 delay, paf::widget::Widget *widget, SceUInt32 animationId, SceBool disableOnEnd, SceBool skipAnimation); + static paf::widget::Widget *WidgetStateTransitionReverse(SceFloat32 delay, paf::widget::Widget *widget, SceUInt32 animationId, SceBool disableOnEnd, SceBool skipAnimation); } @@ -30,14 +36,17 @@ namespace paf { { public: - String() : data(SCE_NULL), length(0) - { + String(const char *str); - } + String(const char *str, SceSize strLength); + + String(String *src); + + String(); ~String() { - if (data != SCE_NULL) + if (length != 0 && *data != 0) delete data; } @@ -56,12 +65,11 @@ namespace paf { if (data == s) return this; - if (data != SCE_NULL) + if (*data != 0) delete data; if (srcLength == 0 || s == SCE_NULL || s[0] == 0) { - data = SCE_NULL; - length = 0; + String(); return this; } @@ -71,12 +79,13 @@ namespace paf { data[length] = 0; return this; - } + }; String *Set(const char *s) { - return Set(s, sce_paf_strlen(s)); - } + Set(s, sce_paf_strlen(s)); + return this; + }; String *operator=(const String *s) { @@ -84,8 +93,7 @@ namespace paf { return this; if (s->length == 0) { - data = SCE_NULL; - length = 0; + String(); return this; } @@ -126,9 +134,9 @@ namespace paf { SceVoid Clear() { - if (data != SCE_NULL) { + if (length != 0 && data != SCE_NULL) { delete data; - data = SCE_NULL; + String(); } } @@ -150,9 +158,39 @@ namespace paf { } + WString(const SceWChar16 *s, SceSize srcLength) : data(SCE_NULL), length(0) + { + if (srcLength == 0 || s == SCE_NULL || s[0] == 0) { + return; + } + + data = new SceWChar16[srcLength + 1]; + length = srcLength; + sce_paf_wmemcpy((wchar_t*)data, (wchar_t*)s, length); + data[length] = 0; + + return; + } + + WString(const SceWChar16 *s) : data(SCE_NULL), length(0) + { + SceSize srcLength = sce_paf_wcslen((wchar_t*)s); + + if (srcLength == 0 || s == SCE_NULL || s[0] == 0) { + return; + } + + data = new SceWChar16[srcLength + 1]; + length = srcLength; + sce_paf_wmemcpy((wchar_t*)data, (wchar_t*)s, length); + data[length] = 0; + + return; + } + ~WString() { - if (data != SCE_NULL) + if (length != 0 && data != SCE_NULL) delete data; } @@ -186,12 +224,13 @@ namespace paf { data[length] = 0; return this; - } + }; WString *Set(const SceWChar16 *s) { - return Set(s, sce_paf_wcslen((wchar_t*)s)); - } + Set(s, sce_paf_wcslen((wchar_t *)s)); + return this; + }; WString *operator=(const WString *s) { @@ -241,8 +280,11 @@ namespace paf { SceVoid Clear() { - if (data != SCE_NULL) + if (length != 0 && data != SCE_NULL) { delete data; + length = 0; + data = SCE_NULL; + } } SceWChar16 *data; @@ -266,6 +308,8 @@ namespace paf { ~Utils(); static SceVoid AddMainThreadTask(MainThreadTaskEntryFunction entry, ScePVoid pArgBlock); + + static SceVoid RemoveMainThreadTask(MainThreadTaskEntryFunction entry, ScePVoid pArgBlock); }; } diff --git a/include/user/paf/graphics.h b/include/user/paf/graphics.h index 33889ee..101a94a 100644 --- a/include/user/paf/graphics.h +++ b/include/user/paf/graphics.h @@ -5,11 +5,116 @@ #ifndef _VDSUITE_USER_PAF_GRAPHICS_H #define _VDSUITE_USER_PAF_GRAPHICS_H +#include <kernel.h> +#include <gxm.h> #include <scetypes.h> +#include <paf/misc.h> namespace paf { + namespace graphics { + class MemoryPool + { + public: + + class InitParam + { + public: + + ScePVoid pMemory; + SceSize size; + char *pName; + paf::Allocator::Opt *pAllocatorOpt; + ScePVoid pUnkAllocatorOpt; + SceUInt32 memoryType; + }; + + MemoryPool(InitParam *pInitParam); + + MemoryPool(ScePVoid pMemory, SceSize size, const char *pName, paf::Allocator::Opt *pAllocatorOpt = SCE_NULL, SceUInt32 memoryType = 0); + + virtual ~MemoryPool(); + + virtual int unkf1(); + virtual int unkf2(); + virtual int unkf3(); + + enum MemoryType + { + MemoryType_UserNC, + MemoryType_CDRAM, + MemoryType_Shared, + }; + + enum MemoryTypeSpecial + { + MemoryTypeSpecial_Unused, + MemoryTypeSpecial_Unk0xCF08060, + MemoryTypeSpecial_Phycont + }; + + enum GpuMapType + { + GpuMapType_Normal, + GpuMapType_VertexUsse, + GpuMapType_FragmentUsse, + GpuMapType_NoMap, + }; + + class MemBlockOptParam + { + public: + + MemoryTypeSpecial memoryTypeSpecial; + SceKernelAllocMemBlockOpt *memBlockOpt; + GpuMapType gpuMapType; + SceUInt32 mapAttribs; + SceUInt32 usseOffset; + SceUInt32 unused; + }; + + static ScePVoid AllocMemBlock(MemoryType memoryType, SceSize size, const char *pName, ScePVoid pOptParam = SCE_NULL); + + static SceVoid FreeMemBlock(MemoryType memoryType, ScePVoid pMemory); + + static MemoryPool *GetDefaultMemoryPool(); + + private: + + SceUChar8 m_work[0x48]; + + }; + + class Surface + { + public: + + Surface(MemoryPool *pMemPool, SceUInt32 width, SceUInt32 height, SceUInt32 format, SceUInt32 orderType, SceInt32 a7, SceUInt32 numLevel, SceInt32 a9); + + virtual ~Surface(); + + virtual int unkf1(); + virtual int unkf2(); + virtual int unkf3(); + virtual int unkf4(); + virtual int unkf5(); + virtual int unkf6(); + virtual int unkf7(); + virtual int unkf8(); + virtual int unkf9(); + virtual int unkf10(); + + void* operator new(size_t size); + + void operator delete(void*); + + private: + + SceUChar8 m_work[0x44]; + + }; + class Texture { public: @@ -18,7 +123,7 @@ namespace paf { ~Texture() { }; - + Surface *texSurface; private: diff --git a/include/user/paf/misc.h b/include/user/paf/misc.h index 8b0d8db..bf21a65 100644 --- a/include/user/paf/misc.h +++ b/include/user/paf/misc.h @@ -6,40 +6,300 @@ #define _VDSUITE_USER_PAF_MISC_H #include <libsha1.h> +#include <kernel.h> +#include <rtc.h> +#include <paf/common.h> namespace paf { - namespace misc { + static SceBool IsDolce(); - class Misc + namespace datetime { + + class DateTime { public: - Misc(); + DateTime + ( + SceUInt16 year, + SceUInt16 month, + SceUInt16 day, + SceUInt16 hour, + SceUInt16 minute, + SceUInt16 second, + SceUInt32 microsecond + ); + + DateTime() { }; + + ~DateTime(); + + static SceInt32 IsLeapYear(SceInt32 year); + + static SceInt32 GetDaysInMonth(SceInt32 year, SceInt32 month); + + static SceInt32 GetCurrentTick(SceRtcTick *tick); + + static SceInt32 ConvertUtcToLoacalTime(const SceRtcTick *utc, SceRtcTick *localTime); + + static SceInt32 GetCurrentTickLocalTime(SceRtcTick *tick); + + static SceInt32 GetCurrentNetworkTick(SceRtcTick *tick); + + static SceInt32 ConvertLocalTimeToUtc(const SceRtcTick *localTime, SceRtcTick *utc); + + static SceInt32 FormatRFC3339(char *pszDateTime, SceRtcTick *tick, SceInt32 iTimeZoneMinutes); + + static SceInt32 FormatRFC3339LocalTime(char *pszDateTime, SceRtcTick *tick); + + static SceInt32 ParseRFC3339(SceRtcTick *tick, const char *pszDateTime); - ~Misc(); + SceVoid SetFromTick(SceRtcTick *tick); + + SceVoid SetFromRFC3339(const char *pszDateTime); + + SceVoid GetCurrentClockUtc(); + + SceVoid GetCurrentClockLocalTime(); + + SceVoid GetCurrentNetworkClock(); + + SceRtcTick ToRtcTick(); + + SceVoid ToRtcTick(SceRtcTick *tick); + + SceVoid Sum(const DateTime *s1, const DateTime *s2); + + SceBool operator<(const DateTime *pDt); + + SceUInt16 year; + SceUInt16 month; + SceUInt16 day; + SceUInt16 hour; + SceUInt16 minute; + SceUInt16 second; + SceUInt32 microsecond; + SceUInt32 unk_10; + SceUInt8 unk_14; - static SceBool IsDolce(); }; - class Sha1 + } + + namespace io { + + enum Error + { + SCE_PAF_ERROR_MISC_IO_INVALID_POINTER = 0x80AF5901 + }; + + class File { public: - Sha1(); + class AsyncResult + { + public: - ~Sha1() { }; + SceInt32 result; + SceInt32 unk_04; + }; - SceInt32 BlockUpdate(const ScePVoid plain, SceUInt32 len); + File(); - SceInt32 BlockResult(SceUChar8 *digest); + virtual ~File(); + + virtual SceInt32 Open(const char *filename, int flag, SceIoMode mode); + virtual SceInt32 Close(); + virtual SceInt32 Read(void *buf, SceSize nbyte); + virtual SceInt32 Write(const void *buf, SceSize nbyte); + virtual SceInt32 Lseek(SceOff offset, int whence); + virtual SceInt32 Sync(); + virtual SceInt32 OpenAsync(const char *filename, int flags, SceMode mode); + virtual SceInt32 CloseAsync(); + virtual SceInt32 ReadAsync(void *buf, SceSize nbyte); + virtual SceInt32 WriteAsync(const void *buf, SceSize nbyte); + virtual SceInt32 LseekAsync(SceInt32 a1, int whence, SceIoAsyncParam* asyncParam); + virtual SceInt32 SyncAsync(); + virtual SceInt32 WaitAsync(AsyncResult *pResult); + virtual SceInt32 PollAsync(AsyncResult *pResult); + virtual SceBool IsOpened(); + virtual SceInt32 unkFun_44(); + virtual SceInt32 CancelAsync(); + virtual SceOff GetSize(); + virtual SceInt32 GetStat(ScePVoid pafStat); + virtual SceInt32 SetPriority(SceUInt32 ioPriority); private: - SceSha1Context m_sha; + SceUChar8 m_work[0x2C]; }; + + class Dir + { + public: + + class Dirent + { + public: + + SceInt32 type; + paf::String name; + SceInt32 size; + SceUInt32 creationYear; + }; + + Dir() : uid(SCE_UID_INVALID_UID) { }; + + ~Dir() { }; + + SceInt32 Open(const char *dirname); + + SceInt32 Close(); + + SceInt32 Read(Dirent *stat); + + SceUID uid; + + }; + + static SceInt32 SetDefaultPriority(SceUInt32 ioPriority); + + static SceBool Exists(const char *path); + + static SceBool IsDir(const char *path); + + static SceInt32 Remove(const char *path); + + static SceInt32 RemoveRecursive(const char *path); + + static SceInt32 Mkdir(const char *dirname, SceIoMode mode); + + static SceInt32 MkdirRWSYS(const char *dirname); + + //dot-separated path list + static SceInt32 MkdirMulti(const char *dirnameList, SceIoMode mode); + + static SceInt32 MkdirMultiRWSYS(const char *dirnameList); } + + class Module + { + public: + + Module(const char *pPath, SceInt32 unused_a2, SceUInt32 flags, SceInt32 unused_a4); + + ~Module(); + + private: + + SceUChar8 m_work[0x4]; + + }; + + class Sha1 + { + public: + + Sha1(); + + ~Sha1() { }; + + SceInt32 BlockUpdate(const ScePVoid plain, SceUInt32 len); + + SceInt32 BlockResult(SceUChar8 *digest); + + private: + + SceSha1Context m_sha; + + }; + + class Allocator + { + public: + + class Opt + { + public: + + Opt() { }; + + ~Opt() { }; + + int a1; + int a2; + SceUInt8 a3_0; + SceUInt8 a3_1; + SceUInt8 a3_2; + SceUInt8 a3_3; + SceBool useCdlgMemory; + SceSize alignment; + }; + + Allocator(ScePVoid *membase, SceSize size, const char *name, Opt *pOpt = SCE_NULL); + + virtual ~Allocator(); + + static Allocator *GetGlobalAllocator(); + + SceSize GetSize(); + + SceVoid GetMemBlockBase(ScePVoid *membase, ScePVoid *membaseTop); + + SceVoid Deallocate(ScePVoid ptr); + + ScePVoid Allocate(SceSize size); + + ScePVoid AllocateAligned(SceSize alignment, SceSize size); + + private: + + SceUChar8 m_work[0x5C]; + + }; + + class Image + { + public: + + Image(); + + ~Image(); + + enum Type + { + Type_0, + Type_PNG, + Type_JPEG, + Type_TIFF, + Type_GIF, + Type_BMP, + Type_GIM, + Type_DDS + }; + + + class Result + { + public: + + Image *img; + ScePVoid unk_04; + }; + + static SceVoid Load(Result *pRes, const char *pPath, ScePVoid buf, SceInt32 a4, SceInt32 a5, SceInt32 a6, SceInt32 a7); + + static SceInt32 GetLastError(); + + static SceBool SetLastError(SceInt32 errorCode); + + SceInt32 GetType(); + + SceInt32 GetPaletteColorNum(); + }; } #endif /* _VDSUITE_USER_PAF_MISC_H */ diff --git a/include/user/paf/resource.h b/include/user/paf/resource.h index 156320f..f5470df 100644 --- a/include/user/paf/resource.h +++ b/include/user/paf/resource.h @@ -10,14 +10,34 @@ namespace paf { + class Allocator; + class Resource { public: - Resource(); + enum Error + { + SCE_PAF_ERROR_RESOURCE_NOT_FOUND = 0x80AF0601 + }; + + typedef void(*ResourceMemAllocator)(SceUInt32 opType, paf::Allocator *allocator, ScePVoid ptrIn, SceSize sizeIn, ScePVoid **ptrOut, SceSize *sizeOut); + + class LoadParam + { + public: + + SceUInt32 flags; + paf::Allocator *memAllocator; + ResourceMemAllocator memAllocFunction; + }; + + Resource(const char *resourcePath, LoadParam *resLoadParam); ~Resource(); + static SceVoid DefaultMemAllocator(SceUInt32 opType, paf::Allocator *allocator, ScePVoid ptrIn, SceSize sizeIn, ScePVoid **ptrOut, SceSize *sizeOut); + class Element { public: @@ -32,11 +52,15 @@ namespace paf { } - SceUInt32 GetHashByName(Element *src); + SceUInt32 GetHashById(Element *src); - paf::String name; + paf::String id; SceUInt32 hash; }; + + SceInt32 GetString(SceUInt32 hash, SceWChar16 **ppString, SceSize *pStringSize); + + SceInt32 GetString(const char *id, SceWChar16 **ppString, SceSize *pStringSize); }; } diff --git a/include/user/paf/thread.h b/include/user/paf/thread.h index 3470f40..2b4d683 100644 --- a/include/user/paf/thread.h +++ b/include/user/paf/thread.h @@ -26,18 +26,6 @@ namespace paf { }; - class ThreadOpt - { - public: - - ThreadOpt(); - - SceUInt32 attr; - SceInt32 cpuAffinityMask; - SceKernelMemBlockType stackMemoryType; - - }; - class Thread { public: @@ -47,8 +35,22 @@ namespace paf { SCE_PAF_ERROR_THREAD_THREAD_ALREADY_STARTED = 0x80AF0702 }; + class Opt + { + public: + + Opt(); - Thread(SceInt32 initPriority, SceSize stackSize, const char *pName, const ThreadOpt *opt = SCE_NULL); + ~Opt() { }; + + SceUInt32 attr; + SceInt32 cpuAffinityMask; + SceKernelMemBlockType stackMemoryType; + + }; + + + Thread(SceInt32 initPriority, SceSize stackSize, const char *pName, const Opt *opt = SCE_NULL); virtual ~Thread(); @@ -202,7 +204,7 @@ namespace paf { SceVoid Execute(); - SceUInt32 Size(); + SceUInt32 GetSize(); private: @@ -231,6 +233,99 @@ namespace paf { SceUChar8 m_work[0x10]; }; + + //Not usable yet + /*class JobQueue + { + public: + + enum Error + { + SCE_PAF_ERROR_THREAD_JOBQUEUE_ALREADY_PUSHED = 0x80AF0901, + SCE_PAF_ERROR_THREAD_JOBQUEUE_UNK = 0x80AF0902 + }; + + class Opt + { + public: + + Opt(); + + ~Opt() { }; + + SceInt32 workerPriority; + SceSize workerStackSize; + SceUInt32 workerNum; + Thread::Opt *workerOpt; + + }; + + class Item; + + class Request + { + public: + + typedef void(*RequestEntryFunction)(Item *job); + + Item *job; + SceInt32 unk_04; + SceInt32 unk_08; + RequestEntryFunction entry; + + }; + + class Item + { + public: + + Item(const char *pName); + + virtual ~Item(); + + virtual SceVoid SetSomething(); + + virtual SceVoid EntryFunction() = 0; + + virtual SceVoid FinishCallback() = 0; + + Request *req; + + private: + + SceUChar8 m_work[0x24]; + + }; + + typedef void(*QueueEntryFunction)(void *pArgBlock); + + JobQueue(const char *pName, Opt *opt = SCE_NULL); + + ~JobQueue(); + + static JobQueue *s_defaultJobQueue; + + static SceVoid CreateDefaultJobQueue(Opt *opt); + + static SceVoid DeleteDefaultJobQueue(); + + SceInt32 Push(Item *queueItem); + + SceVoid Join(); + + SceUInt32 GetSize(); + + SceVoid ChangeWorkerPriority(SceInt32 priority); + + SceVoid Execute(); + + SceVoid Execute2(); + + private: + + SceUChar8 m_work[0x2C]; + + };*/ } } diff --git a/include/user/paf/toplevel.h b/include/user/paf/toplevel.h index 51c13ab..e5ec819 100644 --- a/include/user/paf/toplevel.h +++ b/include/user/paf/toplevel.h @@ -6,12 +6,19 @@ #define _VDSUITE_USER_PAF_TOPLEVEL_H #include <kernel.h> -#include <paf/common.h> #include <paf/resource.h> -#include <paf/widget.h> namespace paf { + namespace graphics { + class Texture; + class MemoryPool; + } + + namespace widget { + class Widget; + } + class Plugin { public: @@ -28,7 +35,7 @@ namespace paf { RootWidgetInitParam(); - ~RootWidgetInitParam() { } ; + ~RootWidgetInitParam() { }; SceInt32 unk_00; SceInt32 unk_04; @@ -36,13 +43,36 @@ namespace paf { SceUChar8 unk_0C[0x20]; }; + class TemplateInitParam + { + public: + + TemplateInitParam(); + + ~TemplateInitParam() { }; + + SceInt32 unk_00; + SceInt32 unk_04; + }; + static Plugin *GetByName(const char *pluginName); - ui::Widget *SetRootWidget(paf::Resource::Element *widgetInfo, RootWidgetInitParam *initParam); + static SceVoid LoadTexture(paf::graphics::Texture *tex, Plugin *plugin, paf::Resource::Element *textureSearchParam); + + paf::widget::Widget *SetRootWidget(paf::Resource::Element *widgetInfo, RootWidgetInitParam *initParam); + + paf::widget::Widget *GetRootWidgetByHash(paf::Resource::Element *widgetInfo); + + SceInt32 AddWidgetFromTemplate(paf::widget::Widget *targetRoot, paf::Resource::Element *templateSearchParam, paf::Plugin::TemplateInitParam *param); + + SceUChar8 unk_00[0x4]; + char *name; + SceUChar8 unk_08[0xA8]; + Resource *resource; private: - SceUChar8 m_unk[0x4]; //size is unknown + SceUChar8 m_unk_B4[0x4]; //size is unknown }; @@ -83,8 +113,8 @@ namespace paf { SceUInt32 decodeHeapSize; SceUInt32 defaultPluginHeapSize; - SceInt32 unused_68; - SceInt32 unused_6C; + SceInt32 screenWidth; //unused + SceInt32 sceenHeight; //unused ApplicationMode applicationMode; SceInt32 optionalFeatureFlags; SceInt32 language; @@ -126,7 +156,15 @@ namespace paf { paf::Plugin::PluginCB unloadCB2; paf::String resourcePath; - SceUChar8 unk_38[0x5C]; + SceUChar8 unk_38[0x20]; + + SceInt32 unk_58; + + SceUChar8 unk_5C[0xC]; + + paf::String pluginPath; + + SceUChar8 unk_74[0x20]; }; typedef void(*LoadCRFinishCallback)(); @@ -137,12 +175,20 @@ namespace paf { ~Framework(); + static SceVoid InitializeDefaultJobQueue(); + static SceUInt32 GetFwLangBySystemLang(SceUInt32 systemLanguage); static SceVoid LoadPluginAsync(PluginInitParam *initParam, LoadPluginFinishCallback finishCallback = SCE_NULL, UnloadPluginFinishCallback unloadFinishCallback = SCE_NULL); static SceVoid LoadPlugin(PluginInitParam *initParam, LoadPluginFinishCallback finishCallback = SCE_NULL, UnloadPluginFinishCallback unloadFinishCallback = SCE_NULL); + static Framework *GetInstance(); + + static paf::graphics::MemoryPool *GetDefaultGraphicsMemoryPool(); + + static SceVoid LoadTexture(paf::graphics::Texture *tex, Framework *fw, paf::Resource::Element *searchParam); + SceVoid _LoadPluginAsync(PluginInitParam *initParam, LoadPluginFinishCallback finishCallback = SCE_NULL, UnloadPluginFinishCallback unloadFinishCallback = SCE_NULL); SceInt32 EnterRenderingLoop(); @@ -159,10 +205,17 @@ namespace paf { Plugin *FindPluginByName(const char *pluginName, SceBool enableSomeCheck = SCE_FALSE); - private: + ApplicationMode GetApplicationMode(); + + SceInt32 Test2(SceFloat32, SceInt32, SceInt32); + + paf::widget::Widget *GetRootWidget(); + + SceUChar8 unk_00[0x1C]; - SceUChar8 m_work[0x7C]; + Plugin *crPlugin; + SceUChar8 unk_20[0x5C]; }; } diff --git a/include/user/paf/widget.h b/include/user/paf/widget.h index 1fe0900..c7c25e9 100644 --- a/include/user/paf/widget.h +++ b/include/user/paf/widget.h @@ -5,11 +5,19 @@ #ifndef _VDSUITE_USER_PAF_WIDGET_H #define _VDSUITE_USER_PAF_WIDGET_H +#include <ctrl.h> #include <scetypes.h> #include <paf/resource.h> namespace paf { - namespace ui { + + class WString; + + namespace graphics { + class Texture; + } + + namespace widget { class Widget { @@ -49,7 +57,7 @@ namespace paf { if (this->eventHandler != 0) { this->eventHandler(eventId, self, a3, this->pUserData); } - ret = 0; + ret = SCE_OK; } else { ret = SCE_PAF_ERROR_UI_WIDGET_EVENT_CALLBACK_UNHANDLED; @@ -75,23 +83,19 @@ namespace paf { enum Type { - Unk0, - Unk1, - Text, - TextShadow, - Background, - Unk5 + Color_Text = 2, + Color_TextShadow, + Color_Background, + Color_Unk5, + Color_Unk6 }; - Color() : r(0.0), g(0.0), b(0.0), a(0.0) + Color() : r(0.0), g(0.0), b(0.0), a(0.0) { }; - ~Color() - { - - }; + ~Color() { }; SceFloat32 r; SceFloat32 g; @@ -99,97 +103,47 @@ namespace paf { SceFloat32 a; }; - Widget() {}; - - ~Widget() {}; - - SceInt32 SetColor(Color::Type type, SceInt32 a2, SceInt32 a3, const Color *pColor); - - enum Option - { - TextBold = 0x7, - TextShadow = 0xC, - TextExternalLine = 0xD - }; - - SceInt32 SetOption(Option option, SceInt32 a2, SceInt32 a3, SceBool enable); - - SceInt32 SetFontSize(SceFloat32 size, SceInt32 a2, SceSize pos, SceSize len); - - Widget *FindByHash(paf::Resource::Element *widgetInfo, SceUInt32 param); //param can be 0,1,2 - - SceInt32 SetPosition(SceFVector4 *position, SceFloat32 a2, SceInt32 a3, SceInt32 a4, SceInt32 a5, SceInt32 a6, SceInt32 a7); - - SceInt32 SetSize(SceFVector4 *size, SceFloat32 a2, SceInt32 a3, SceInt32 a4, SceInt32 a5, SceInt32 a6, SceInt32 a7); - - SceInt32 RegisterEventCallback(SceInt32 eventId, EventCallback *cb, SceBool a3); - - SceInt32 UnregisterEventCallback(SceInt32 eventId, SceInt32 a2, SceInt32 a3); - - SceInt32 RegisterLoopEventCallback(SceInt32 eventId, EventCallback *cb); - - SceInt32 AddEffect(SceInt32 effId, SceInt32 a2); - - //ScePafWidget_44B22ACA static - //ScePafWidget_F1176ACC - /*SceInt32 Test1(SceInt32, SceInt32, SceInt32); - static SceInt32 Test2(SceInt32, Widget*, SceInt32, SceInt32, SceInt32); + Widget(Widget *parent, SceInt32 a2); - SceInt32 Test3(SceInt32); - - SceInt32 Test4(SceFVector4 *size, SceInt32 a2, SceInt32 a3);*/ - - private: - - SceUChar8 unk[0x2D4]; - - }; - - class Label : public Widget - { - public: - - Label(Widget *parentWidget, SceInt32 flags); //flags: 0,2 or 4 - - virtual ~Label(); + virtual ~Widget(); //109 virtual functions here - virtual int unkFun_008(); - virtual int unkFun_00C(); - virtual int unkFun_010(); - virtual int unkFun_014(); - virtual int unkFun_018(); - virtual int unkFun_01C(); - virtual int unkFun_020(); - virtual int unkFun_024(); - virtual int unkFun_028(); - virtual int unkFun_02C(); + virtual int unkFun_008(SceInt32); + virtual int unkFun_00C(SceInt32); + virtual int unkFun_010(SceInt32); + virtual int unkFun_014(SceInt32); + virtual int unkFun_018(SceInt32); + virtual int unkFun_01C(SceInt32); + virtual int unkFun_020(SceInt32); + virtual int unkFun_024(SceInt32); + virtual int unkFun_028(SceInt32); + virtual int unkFun_02C(SceInt32); virtual int unkFun_030(); virtual int unkFun_034(); virtual int unkFun_038(); virtual int unkFun_03C(); - virtual int unkFun_040(); - virtual int unkFun_044(); - virtual int unkFun_048(); - virtual int unkFun_04C(); - virtual int unkFun_050(); + virtual int unkFun_040(SceInt32); + virtual int unkFun_044(SceInt32); + virtual int unkFun_048(SceInt32, SceInt32); + virtual SceVoid SetMarkerEnable(SceBool enable); + virtual int unkFun_050(SceInt32); virtual int unkFun_054(); - virtual int unkFun_058(); - virtual int unkFun_05C(); + virtual SceVoid SetTouchEnable(SceBool enable); + virtual SceBool GetTouchEnable(); virtual int unkFun_060(); - virtual int unkFun_064(); - virtual int unkFun_068(); + virtual SceBool ContainsType(const char *pTypeName); + virtual char *GetType(); virtual int unkFun_06C(); virtual int unkFun_070(); - virtual int unkFun_074(); + virtual int unkFun_074(SceInt32, SceInt32); virtual int unkFun_078(); virtual int unkFun_07C(); virtual int unkFun_080(); virtual int unkFun_084(); virtual int unkFun_088(); virtual int unkFun_08C(); - virtual int unkFun_090(); - virtual int unkFun_094(); + virtual int unkFun_090_anim(SceInt32 animationCode, SceBool setSomeFloat); + virtual int unkFun_094_animRev(SceInt32 animationCode, SceBool setSomeFloat); virtual int unkFun_098(); virtual int unkFun_09C(); virtual int unkFun_0A0(); @@ -214,22 +168,22 @@ namespace paf { virtual int unkFun_0EC(); virtual int unkFun_0F0(); virtual int unkFun_0F4(); - virtual int unkFun_0F8(); + virtual int unkFun_0F8(SceInt32); virtual int unkFun_0FC(); - virtual int unkFun_100(); + virtual int SetTexture(paf::graphics::Texture *tex); virtual int unkFun_104(); virtual int unkFun_108(); virtual int unkFun_10C(); virtual int unkFun_110(); virtual int unkFun_114(); - virtual int unkFun_118(); - virtual SceInt32 SetText(paf::WString *text); //ScePafWidget_922FF349 + virtual SceInt32 SetLabelWithFlag(paf::WString *text, SceInt32 flag); + virtual SceInt32 SetLabel(paf::WString *text); virtual int unkFun_120(); virtual int unkFun_124(); virtual int unkFun_128(); virtual int unkFun_12C(); virtual int unkFun_130(); - virtual int unkFun_134(); + virtual int unkFun_134(SceInt32); virtual int unkFun_138(); virtual int unkFun_13C(); virtual int unkFun_140(); @@ -244,7 +198,7 @@ namespace paf { virtual int unkFun_164(); virtual int unkFun_168(); virtual int unkFun_16C(); - virtual int unkFun_170(); + virtual int SendEvent(SceInt32 eventId, SceBool a2); virtual int unkFun_174(); virtual int unkFun_178(); virtual int unkFun_17C(); @@ -260,6 +214,562 @@ namespace paf { virtual int unkFun_1A4(); virtual int unkFun_1A8(); + static char *TypeText(); + + //ScePafWidget_90C77CC5 + //static char *TypeSupplier(); //constructors not exported + + static char *TypeTextBox(); + + static char *TypeBusyIndicator(); + + //ScePafWidget_8B0C4F14 + //static char *TypeStateButtonBase(); //constructors not exported + + //ScePafWidget_F1DBC5BB + //static char *TypeStyleStateButtonBase(); //constructors not exported + + //ScePafWidget_317FAD4E + //static char *TypeSoundStateButtonBase(); //constructors not exported + + static char *TypePlane(); + + static char *TypeBox(); + + static char *TypeAppIcon2D(); + + static char *TypeButton(); + + static char *TypeCornerButton(); + + static char *TypeDialog(); + + static char *TypeFileList(); + + static char *TypeImageButton(); + + static char *TypeImageSlidebar(); + + static char *TypeCompositeDrawer(); + + static char *TypeSlidingDrawer(); + + static char *TypeScrollViewParent(); + + static char *TypeScrollBar2D(); + + static char *TypeScrollBarTouch(); + + static char *TypeScrollBar(); + + static char *TypeSlideBar(); + + static char *TypeRichText(); + + static char *TypePageTurn(); + + static char *TypeProgressBar(); + + static char *TypeProgressBarTouch(); + + static char *TypeRadioBox(); + + static char *TypeRadioButton(); + + static char *TypeListItem(); + + static char *TypeListView(); + + static char *TypeNumSpin(); + + static char *TypeItemSpin(); + + static char *TypePlaneButton(); + + static char *TypeCheckBox(); + + static char *TypeCompositeButton(); + + static char *TypeAppIconBase(); + + static char *TypeSpinBase(); + + + SceInt32 SetColor(Color::Type type, SceInt32 a2, SceInt32 a3, const Color *pColor); + + SceInt32 GetColor(Color::Type type, SceInt32 a2, Color *pColor); + + SceInt32 SetFilterColor(const Color *pColor, SceFloat32 a2 = 0.0f, SceInt32 a3 = 0, SceInt32 a4 = 0x10001, SceInt32 a5 = 0, SceInt32 a6 = 0, SceInt32 a7 = 0); + + enum Option + { + Text_Bold = 0x7, + Text_Shadow = 0xC, + Text_ExternalLine = 0xD + }; + + SceInt32 SetOption(Option option, SceInt32 a2, SceInt32 a3, SceBool enable); + + SceInt32 SetFontSize(SceFloat32 size, SceInt32 a2, SceSize pos, SceSize len); + + Widget *GetChildByHash(paf::Resource::Element *widgetInfo, SceUInt32 param); //param can be 0,1,2 + + Widget *GetChildByNum(SceUInt32 childNum); + + Widget *GetParent(); + + SceInt32 SetPosition(const SceFVector4 *pPosition, SceFloat32 a2 = 0.0f, SceInt32 a3 = 0, SceInt32 a4 = 0x10000, SceInt32 a5 = 0, SceInt32 a6 = 0, SceInt32 a7 = 0); + + SceInt32 SetSize(const SceFVector4 *pSize, SceFloat32 a2 = 0.0f, SceInt32 a3 = 0, SceInt32 a4 = 0x10004, SceInt32 a5 = 0, SceInt32 a6 = 0, SceInt32 a7 = 0); + + SceInt32 SetZoom(const SceFVector4 *pZoom, SceFloat32 a2 = 0.0f, SceInt32 a3 = 0, SceInt32 a4 = 0x10005, SceInt32 a5 = 0, SceInt32 a6 = 0, SceInt32 a7 = 0); + + SceInt32 SetAdjust(SceBool x, SceBool y, SceBool z); + + SceInt32 RegisterEventCallback(SceInt32 eventId, EventCallback *cb, SceBool a3); + + SceInt32 UnregisterEventCallback(SceInt32 eventId, SceInt32 a2, SceInt32 a3); + + SceInt32 RegisterLoopEventCallback(SceInt32 eventId, EventCallback *cb); + + SceInt32 UnregisterLoopEventCallback(SceInt32 eventId); + + SceInt32 AssignButton(SceUInt32 buttons); + + SceInt32 SetDimFactor(SceFloat32 factor, SceInt32 a2 = 0, SceInt32 a3 = 0x10003, SceInt32 a4 = 0, SceInt32 a5 = 0, SceInt32 a6 = 0); + + SceVoid Disable(SceBool a1); + + SceVoid Enable(SceBool a1); + + SceVoid SetLimitedFpsMode(SceBool enable); + + enum Effect + { + Effect_None = 0, + Effect_1, + Effect_2, + Effect_3, + Effect_4, + Effect_5, + Effect_6, + Effect_7, + Effect_Paceholder = 0xff, + }; + + SceInt32 SetEffect(Effect effId, SceInt32 a2); + + enum Animation + { + Animation_Reset = 0xFF, + Animation_Fadein1 = 0, + Animation_Popup1 = 1, + Animation_Popup2 = 2, + Animation_SlideFromBottom1 = 3, + Animation_SlideFromRight1 = 4, + Animation_Fadein2 = 5, + Animation_SlideFromTop1 = 6, + Animation_SlideFromTop2 = 7, + Animation_SlideFromBottom2 = 8, + Animation_SlideFromBottom3 = 9, + Animation_Popup3 = 0xA, + Animation_Popup4 = 0xB, + Animation_Popup5 = 0xD, + Animation_SlideFromTop3 = 0xE, + Animation_SlideFromBottom4 = 0xF, + Animation_SlideFromLeft1 = 0x10, + Animation_SlideFromRight2 = 0x11, + Animation_SlideFromTop4 = 0x12, + Animation_SlideFromBottom5 = 0x13, + Animation_SlideFromLeft2 = 0x14, + Animation_SlideFromRight3 = 0x15, + Animation_3D_SlideFromFront = 0x16, + Animation_3D_SlideToBack1 = 0x17, + A18 = 0x18, + Animation_3D_SlideToBack2 = 0x19 + + }; + + SceInt32 PlayAnimation(Animation animId, EventCallback::EventHandler animCB = 0, ScePVoid pUserData = SCE_NULL); + + SceInt32 PlayAnimationReverse(Animation animId, EventCallback::EventHandler animCB = 0, ScePVoid pUserData = SCE_NULL); + + SceUChar8 unk_004[0x148]; + + SceUInt32 hash; + + SceUChar8 unk_150[0x24]; + + SceUInt32 childNum; + + SceUChar8 unk_178[0x1E]; + + SceUInt8 animationStatus; + + SceUChar8 unk_197[0xF5]; + + Color *pDisabledColor; + + SceUChar8 unk_290[0x5]; + + private: + + }; + + class BusyIndicator : public Widget + { + public: + + BusyIndicator(Widget *parent, SceInt32 a2); + + virtual ~BusyIndicator(); + + SceVoid Start(); + + SceVoid Stop(); + + SceVoid SetBallSize(SceFloat32 size); + + private: + + SceUChar8 unk_298[0x10]; + }; + + class Text : public Widget //0x2d4 + { + public: + + Text(Widget *parent, SceInt32 a2); + + virtual ~Text(); + + private: + + SceUChar8 unk_298[0x40]; + }; + + class TextBox : public Widget + { + public: + + TextBox(Widget *parent, SceInt32 a2); + + virtual ~TextBox(); + }; + + class Plane : public Widget + { + public: + + Plane(Widget *parent, SceInt32 a2); + + virtual ~Plane(); + }; + + class SpeechBalloon : public Widget + { + public: + + SpeechBalloon(Widget *parent, SceInt32 a2); + + virtual ~SpeechBalloon() { }; //destructors not exported + }; + + class Box : public Widget + { + public: + + Box(Widget *parent, SceInt32 a2); + + virtual ~Box(); + + private: + + SceUChar8 unk_298[0x568]; + }; + + class AppIcon2D : public Widget + { + public: + + AppIcon2D(Widget *parent, SceInt32 a2); + + virtual ~AppIcon2D(); + }; + + class Button : public Widget + { + public: + + Button(Widget *parent, SceInt32 a2); + + virtual ~Button(); + + SceVoid SetThreshold(SceInt32 threshold, SceInt32 repeatThreshold); + + private: + + SceUChar8 unk_295[0x28]; + }; + + class CornerButton : public Widget + { + public: + + CornerButton(Widget *parent, SceInt32 a2); + + virtual ~CornerButton(); + }; + + class Dialog : public Widget + { + public: + + Dialog(Widget *parent, SceInt32 a2); + + virtual ~Dialog(); + }; + + class ImageButton : public Widget + { + public: + + ImageButton(Widget *parent, SceInt32 a2); + + virtual ~ImageButton(); + }; + + class ImageSlidebar : public Widget + { + public: + + ImageSlidebar(Widget *parent, SceInt32 a2); + + virtual ~ImageSlidebar(); + }; + + class CompositeDrawer : public Widget + { + public: + + CompositeDrawer(Widget *parent, SceInt32 a2); + + virtual ~CompositeDrawer(); + }; + + class SlidingDrawer : public Widget + { + public: + + SlidingDrawer(Widget *parent, SceInt32 a2); + + virtual ~SlidingDrawer(); + }; + + class ScrollViewParent : public Widget + { + public: + + ScrollViewParent(Widget *parent, SceInt32 a2); + + virtual ~ScrollViewParent(); + }; + + class ScrollBar2D : public Widget + { + public: + + ScrollBar2D(Widget *parent, SceInt32 a2); + + virtual ~ScrollBar2D(); + }; + + class ScrollBarTouch : public Widget + { + public: + + ScrollBarTouch(Widget *parent, SceInt32 a2); + + virtual ~ScrollBarTouch(); + }; + + class ScrollBar : public Widget + { + public: + + ScrollBar(Widget *parent, SceInt32 a2); + + virtual ~ScrollBar(); + }; + + class SlideBar : public Widget + { + public: + + SlideBar(Widget *parent, SceInt32 a2); + + virtual ~SlideBar(); + }; + + class RichText : public Widget + { + public: + + RichText(Widget *parent, SceInt32 a2); + + virtual ~RichText(); + }; + + class PageTurn : public Widget + { + public: + + PageTurn(Widget *parent, SceInt32 a2); + + virtual ~PageTurn(); + }; + + class ProgressBar : public Widget + { + public: + + ProgressBar(Widget *parent, SceInt32 a2); + + virtual ~ProgressBar(); + }; + + class ProgressBarTouch : public Widget + { + public: + + ProgressBarTouch(Widget *parent, SceInt32 a2); + + virtual ~ProgressBarTouch(); + }; + + class ListItem : public Widget //0x2d0 + { + public: + + ListItem(Widget *parent, SceInt32 a2); + + virtual ~ListItem(); + + private: + + SceUChar8 unk_2C0[0x10]; + }; + + class ListView : public Widget + { + public: + + ListView(Widget *parent, SceInt32 a2); + + virtual ~ListView(); + }; + + class FileList : public Widget + { + public: + + FileList(Widget *parent, SceInt32 a2); + + virtual ~FileList(); + }; + + class RadioBox : public Widget + { + public: + + RadioBox(Widget *parent, SceInt32 a2); + + virtual ~RadioBox(); //destructors not exported + }; + + class RadioButton : public Widget + { + public: + + RadioButton(Widget *parent, SceInt32 a2); + + virtual ~RadioButton(); //destructors not exported + }; + + class ItemSpin : public Widget + { + public: + + ItemSpin(Widget *parent, SceInt32 a2); + + virtual ~ItemSpin() { }; //destructors not exported + }; + + class NumSpin : public Widget + { + public: + + NumSpin(Widget *parent, SceInt32 a2); + + virtual ~NumSpin() { }; //destructors not exported + }; + + class PlaneButton : public Widget + { + public: + + PlaneButton(Widget *parent, SceInt32 a2); + + virtual ~PlaneButton() { }; //destructors not exported + }; + + class CheckBox : public Widget + { + public: + + virtual int unkFun_1AC(); + virtual int unkFun_1B0(); + virtual int unkFun_1B4(); + virtual int unkFun_1B8(SceInt32); + virtual SceVoid SetChecked(SceFloat32 delay, SceBool checked, SceInt32 a3); + virtual SceVoid SwitchChecked(); + virtual int unkFun_1C4(); + virtual int unkFun_1C8(); + + CheckBox(Widget *parent, SceInt32 a2); + + virtual ~CheckBox() { }; //destructors not exported + + SceUChar8 unk_295[0x18]; + + SceUInt8 checked; + }; + + class CompositeButton : public Widget + { + public: + + CompositeButton(Widget *parent, SceInt32 a2); + + virtual ~CompositeButton() { }; //destructors not exported + }; + + class SpinBase : public Widget + { + public: + + SpinBase(Widget *parent, SceInt32 a2); + + virtual ~SpinBase() { }; //destructors not exported + }; + + class AppIconBase : public Widget + { + public: + + AppIconBase(Widget *parent, SceInt32 a2); + + virtual ~AppIconBase() { }; //destructors not exported }; } } |