ScePaf: Difference between revisions

From Vita Development Wiki
Jump to navigation Jump to search
 
(49 intermediate revisions by 3 users not shown)
Line 1: Line 1:
Much of this page is wrong because much of the PAF is written in C++ but it works as a "function".
A good resource (to merge here) can be found at [https://github.com/GrapheneCt/ScePaf-headers ScePaf-headers by Graphene].
== Module ==
== Module ==


<code>ScePaf</code> is a C++ runtime.
<code>ScePaf</code> is a C++ runtime.


Quick note on reversing. This module has many vtables that point to exported functions.
This module has many virtual tables that point to exported functions. It would be great to start from marking which function belongs to which vtable. This way we can restore initial class structure.


It would be great to start from marking which function belongs to which vtable.
{| class="wikitable"
|-
! Version !! World !! Privilege
|-
| 1.69-3.740.011 || Non-secure || User
|}
 
== Libraries ==


This way we can restore initial class structure.
TOOL version of libpaf module is different from CEX and DEX ones as it has an additional library: [[#ScePafAutoTestTty]]. Some TOOL system apps import this library and crash on CEX/DEX systems because of that missing library.


=== Known NIDs ===
=== Known NIDs ===
{| class="wikitable"
|-
! Version !! Name !! World !! Visibility !! NID
|-
| 3.60 || [[ScePaf#ScePafLowlayer|ScePafLowlayer]] || Non-secure || User || 0x2342266A
|-
| 3.60 || [[ScePaf#ScePafStdc|ScePafStdc]] || Non-secure || User || 0xA7D28DAE
|-
| 3.60 || [[ScePaf#ScePafMisc|ScePafMisc]] || Non-secure || User || 0x3D643CE8
|-
| 3.60 || [[ScePaf#ScePafCommon|ScePafCommon]] || Non-secure || User || 0x3C1965CD
|-
| 3.60 || [[ScePaf#ScePafGraphics|ScePafGraphics]] || Non-secure || User || 0xA070D6A7
|-
| 3.60 || [[ScePaf#ScePafThread|ScePafThread]] || Non-secure || User || 0x54276D19
|-
| 3.60 || [[ScePaf#ScePafResource|ScePafResource]] || Non-secure || User || 0x2836DC9B
|-
| 3.60 || [[ScePaf#ScePafToplevel|ScePafToplevel]] || Non-secure || User || 0x4D9A9DD0
|-
| 3.60 || [[ScePaf#ScePafWidget|ScePafWidget]] || Non-secure || User || 0x073F8C68
|-
| 3.68 TOOL || [[ScePaf#ScePafAutoTestTty|ScePafAutoTestTty]] || Non-secure || User || 0xC503BD7C
|}
== Types ==
<source lang="C">
typedef struct ScePafSha1Context { // size is 0x68
uint32_t h[5];
char unk[0x54];
} ScePafSha1Context;
typedef struct ScePafDateTime {
  SceDateTime data;
  int data_0x10;
  int data_0x14;
} ScePafDateTime;
typedef struct ScePafHeapContext { // size is 0x60
void *vtable;
void *heap;
void *membase;
SceSize size;
char name[0x20];
SceBool is_import_membase;
char data_0x30[3];
int data_0x34;
SceKernelLwMutexWork lw_mtx;
SceUID memblk_id;
int data_0x5C;              // ex:1
} ScePafHeapContext;
typedef struct ScePafHeapOpt { // size is 0x14
int a1;
int a2;
char a3[4];
int a4;
int a5;
} ScePafHeapOpt;
</source>
== ScePafLowlayer ==
== ScePafStdc ==
=== scePafDefaultHeapInfo ===
{| class="wikitable"
|-
! Version !! NID
|-
| 3.60 || 0x261CAF72
|}
<source lang="C">void *scePafDefaultHeapInfo(void);</source>
=== delete ===
{| class="wikitable"
|-
! Version !! NID
|-
| 3.60 || 0x347AFDD9
|}
<source lang="C">void delete(void *ptr);</source>
=== sce_paf_memalign ===
{| class="wikitable"
|-
! Version !! NID
|-
| 3.60 || 0xAA9952E0
|}
<source lang="C">void *sce_paf_memalign(SceSize align, SceSize length);</source>
== ScePafMisc ==
=== IsVitaTV ===
{| class="wikitable"
{| class="wikitable"
|-
|-
! Version !! Name !! World !! Privilege !! NID
! Version !! NID
|-
|-
| 1.69 || ScePaf || Non-secure || User || 0x614CFD65
| 3.60 || 0xAF4FC3F4
|}
 
This is a guessed name.
 
=== scePafGetCurrentClockLocalTime ===
{| class="wikitable"
|-
|-
| 3.60 || ScePaf || Non-secure || User || 0xCD679177
! Version !! NID
|-
| 3.60 || 0x96345146
|}
|}


== Libraries ==
<source lang="C">int scePafGetCurrentClockLocalTime(ScePafDateTime *data);</source>
 
=== scePafCreateHeap ===
{| class="wikitable"
|-
! Version !! NID
|-
| 3.60 || 0xA2B0BF4D
|}
 
<source lang="C">void scePafCreateHeap(ScePafHeapContext *context, void *membase, SceSize size, const char *name, ScePafHeapOpt *opt);</source>
 
=== scePafDeleteHeap ===
{| class="wikitable"
|-
! Version !! NID
|-
| 3.60 || 0x25238A3A
|}
 
<source lang="C">void scePafDeleteHeap(ScePafHeapContext *context);</source>
 
=== scePafMallocWithContext ===
{| class="wikitable"
|-
! Version !! NID
|-
| 3.60 || 0x89A1CE78
|}
 
<source lang="C">void *scePafMallocWithContext(ScePafHeapContext *context, SceSize len);</source>
 
=== scePafFreeWithContext ===
{| class="wikitable"
|-
! Version !! NID
|-
| 3.60 || 0xCE97B579
|}
 
<source lang="C">void scePafFreeWithContext(ScePafHeapContext *context, void *ptr);</source>
 
=== scePafMallocAlignWithContext ===
{| class="wikitable"
|-
! Version !! NID
|-
| 3.60 || 0x04716F15
|}
 
<source lang="C">void *scePafMallocAlignWithContext(ScePafHeapContext *context, SceUInt32 align, SceSize len);</source>
 
=== scePafReallocWithContext ===
{| class="wikitable"
|-
! Version !! NID
|-
| 3.60 || 0x74DB7F5D
|}


=== Known NIDs ===
<source lang="C">void *scePafReallocWithContext(ScePafHeapContext *context, void *ptr, SceSize len);</source>


=== scePafSha1Init ===
{| class="wikitable"
{| class="wikitable"
|-
|-
! Version !! Name !! World !! Visibility !! NID
! Version !! NID
|-
|-
| 3.60 || ScePafLowlayer || Non-secure || User || 0x2342266A
| 3.60 || 0xB38C53C0
|}
 
<source lang="C">int scePafSha1Init(ScePafSha1Context *context);</source>
 
=== scePafSha1Update ===
{| class="wikitable"
|-
|-
| 3.60 || ScePafStdc || Non-secure || User || 0xA7D28DAE
! Version !! NID
|-
|-
| 3.60 || ScePafMisc || Non-secure || User || 0x3D643CE8
| 3.60 || 0xE6BB459E
|}
 
<source lang="C">int scePafSha1Update(ScePafSha1Context *context, const void *data, SceSize length);</source>
 
=== scePafSha1Result ===
{| class="wikitable"
|-
|-
| 3.60 || ScePafCommon || Non-secure || User || 0x3C1965CD
! Version !! NID
|-
|-
| 3.60 || ScePafGraphics || Non-secure || User || 0xA070D6A7
| 3.60 || 0xB3BF59FC
|}
 
<source lang="C">int scePafSha1Result(ScePafSha1Context *context, void *dst);</source>
 
== ScePafCommon ==
 
=== scePafCommonCreateStartEventWatchdogThread ===
{| class="wikitable"
|-
|-
| 3.60 || ScePafThread || Non-secure || User || 0x54276D19
! Version !! NID
|-
|-
| 3.60 || ScePafResource || Non-secure || User || 0x2836DC9B
| 3.60 || 0x6735B503
|}
 
The created thread will run in loop.
 
<source lang="C">int scePafCommonCreateStartEventWatchdogThread(void* eventWatchdogEntry, int unk);</source>
 
=== scePafCommonFinalizeEventsWatchdogThread ===
{| class="wikitable"
|-
|-
| 3.60 || ScePafToplevel || Non-secure || User || 0x4D9A9DD0
! Version !! NID
|-
|-
| 3.60 || ScePafWidget || Non-secure || User || 0x073F8C68
| 3.60 || 0x4A8115D5
|}
|}
<source lang="C">int scePafCommonFinalizeEventsWatchdogThread(void* eventWatchdogEntry, int unk);</source>
== ScePafGraphics ==
=== scePafGraphicsUpdateCurrentWave ===
{| class="wikitable"
|-
! Version !! NID
|-
| 3.60 || 0x2E30F1B5
|}
This a guessed name.
Updates the rendering wave to the wave at the given index.
<source lang="C">int scePafGraphicsUpdateCurrentWave(SceUInt32 index, SceFloat32 update_interval);</source>
=== scePafGraphicsCurrentWave ===
{| class="wikitable"
|-
! Version !! NID
|-
| 3.60 || 0xE71DB07B
|}
This a guessed name.
<source lang="C">extern SceUInt32 scePafGraphicsCurrentWave;</source>
== ScePafThread ==
== ScePafResource ==
=== scePafResourceSearchIdByName ===
{| class="wikitable"
|-
! Version !! NID
|-
| 3.60 || 0x5F05DE68
|}
This is a guessed name. Temp name was scePafResourceGetIdByName.
Searches using sha-1.
<source lang="C">
typedef struct ScePafWidgetMainParam {
ScePafString name;
int unk_08;
unsigned int id;
} ScePafWidgetMainParam;
SceUInt32 scePafResourceSearchIdByName(ScePafWidgetMainParam *widgetToSearchFor, ScePafString *widgetName);
</source>
== ScePafToplevel ==
<pre>
//ScePafToplevel_F5354FEF
SceInt32 SetInterface(SceUInt32 slot, ScePVoid interfaceTable);
//ScePafToplevel_1DF2C6FD
ScePVoid GetInterface(SceUInt32 slot);
//ScePafToplevel_A5560E60, size of the struct is 0x1C0
void* scePafToplevelInitializeSystemParam(void* pafSystemParam);
//ScePafToplevel_907BA948, fills pafSystemParam with system-specific info to prepare for top level init
void* scePafToplevelSetSystemParam(void* pafSystemParam);
//ScePafToplevel_E2860A99, main init function, buffer size must be 0x7C
void* scePafToplevelInitialize(void* pafInitBuf, void* pafSystemParam);
//ScePafToplevel_3F0DB1BF, name is official
scePafToplevelLoadCommonResourceAsync(void* pafTopLevel, ScePafLoadCRFinishCallback finish_callback);
//ScePafToplevel_400F84CE, size of struct is 0x94
scePafToplevelInitializeResourceInitParam(void* pafRcoParam);
//ScePafToplevel_004D98CC
scePafToplevelAssignResourceName(const char* name);
//ScePafToplevel_F702E40A, name is official
scePafToplevelLoadResourceAsync(void* pafRcoParam, ScePafLoadResourceFinishCallback finish_callback);
//ScePafToplevel_12E33958, thread that calls it becomes locked (does all drawing)
scePafToplevelStartDrawing(void* pafTopLevel);
//ScePafToplevel_9A4B0DC4
scePafTopLevelStopDrawing(void* pafTopLevel);
//ScePafToplevel_32CE0577
scePafTopLevelFinalize(void* pafTopLevel);
//ScePafToplevel_004D98CC, selects from resources registered with scePafToplevelAssignResourceName()
scePafTopLevelSelectResource(const char* resourceName);
//ScePafToplevel_34FE1331, struct size is 0x2C
scePafTopLevelInitializePageData(void* pageData);
//ScePafToplevel_30B442D9
scePafTopLevelLoadPage(void* widgetGroup, ScePafWidgetMainParam* pageParam, void* pageData);
</pre>


== ScePafWidget ==
== ScePafWidget ==


=== scePafWidgetCreateNewWidget ===
widget
 
{| class="wikitable"
|-
! Type !! widget ctx size (bytes)
|-
| Plane || 0x280
|-
| Text || 0x2D8
|}
 
=== scePafWidgetCreateNewTextWidget ===
 
{| class="wikitable"
{| class="wikitable"
|-
|-
Line 55: Line 378:
| 3.60 || 0x5C2962E1
| 3.60 || 0x5C2962E1
|}
|}
Temp name was scePafWidgetCreateNewWidget.


<source lang="C">
<source lang="C">
Line 60: Line 385:
  * a2 is maybe parent widget?
  * a2 is maybe parent widget?
  */
  */
void *scePafWidgetCreateNewWidget(void *mem_ptr, void *a2, int a3);
void *scePafWidgetCreateNewTextWidget(void *mem_ptr, void *a2, int a3);
</source>
</source>


Line 101: Line 426:
|}
|}


??? scePafWidgetSetColorEnd ???
A possible name could be scePafWidgetSetColorEnd.


<source lang="C">
<source lang="C">int ScePafWidget_DDB0437F(void *pWidget);</source>
int ScePafWidget_DDB0437F(void *pWidget);
</source>


=== scePafWidgetSetTextOption ===
=== scePafWidgetSetTextOption ===
Line 157: Line 480:


<source lang="C">const char *scePafWidgetTypeButton(void);</source>
<source lang="C">const char *scePafWidgetTypeButton(void);</source>
=== scePafWidgetTypeText ===
{| class="wikitable"
|-
! Version !! NID
|-
| 3.60 || 0x723F6A4C
|}
<source lang="C">const char *scePafWidgetTypeText(void);</source>
=== scePafWidgetTypeText2 ===
{| class="wikitable"
|-
! Version !! NID
|-
| 3.60 || 0x45AA2058
|}
same to scePafWidgetTypeText
<source lang="C">const char *scePafWidgetTypeText2(void);</source>
=== scePafWidgetTypeBusyIndicator1 ===
{| class="wikitable"
|-
! Version !! NID
|-
| 3.60 || 0xDBCC58BB
|}
<source lang="C">const char *scePafWidgetTypeBusyIndicator1(void);</source>
=== scePafWidgetTypeBusyIndicator2 ===
{| class="wikitable"
|-
! Version !! NID
|-
| 3.60 || 0x1D1F5BF7
|}
same to scePafWidgetTypeBusyIndicator1
<source lang="C">const char *scePafWidgetTypeBusyIndicator2(void);</source>
=== scePafWidgetCmpTypeBase ===
{| class="wikitable"
|-
! Version !! NID
|-
| 3.60 || 0x8EDFDE19
|}
<source lang="C">int scePafWidgetCmpTypeBase(void *pWidget, const char *type);</source>
=== scePafWidgetCmpTypeBusyIndicator ===
{| class="wikitable"
|-
! Version !! NID
|-
| 3.60 || 0xB954B379
|}
<source lang="C">int scePafWidgetCmpTypeBusyIndicator(void *pWidget, const char *type);</source>


=== scePafWidgetSetFontSize ===
=== scePafWidgetSetFontSize ===
Line 178: Line 565:
</source>
</source>


=== scePafWidgetAddWidget ===
=== scePafWidgetSetPosition ===
{| class="wikitable"
{| class="wikitable"
|-
|-
Line 185: Line 572:
| 3.60 || 0xE29AB31F
| 3.60 || 0xE29AB31F
|}
|}
Temp name was scePafWidgetAddWidget.


<source lang="C">
<source lang="C">
Line 205: Line 594:
   float x;      // Distance from display center
   float x;      // Distance from display center
   float y;      // Distance from display center
   float y;      // Distance from display center
   int unk_0x04; // set 0
   float z;
   int unk_0x08; // set 0
   int unk_0x0C; // set 0
} ScePafWidgetPos;
} ScePafWidgetPos;


int scePafWidgetAddWidget(void *pWidget, ScePafWidgetPos *pWidgetPos, float a3, int a4, int a5, int a6, int a7, int a8);
int scePafWidgetSetPosition(void *pWidget, ScePafWidgetPos *pWidgetPos, float a3, int a4, int a5, int a6, int a7, int a8);


Example of use
Example of use


ScePafWidgetPos widget_pos;
ScePafWidgetPos widget_pos;
widget_pos.x        = x_pos - (960.0f / 2.0f);
widget_pos.x        = x_pos - (960.0f / 2.0f);
widget_pos.y        = (544.0f / 2.0f) - y_pos;
widget_pos.y        = (544.0f / 2.0f) - y_pos;
widget_pos.unk_0x04 = 0;
widget_pos.z        = 0.0f;
widget_pos.unk_0x08 = 0;
widget_pos.unk_0x08 = 0;
scePafWidgetAddWidget(p_widget, &widget_pos, 0.0f, 0, 0x10000, 0, 0, 0);
scePafWidgetSetPosition(p_widget, &widget_pos, 0.0f, 0, 0x10000, 0, 0, 0);
</source>
</source>


=== scePafWidgetSearchWidgetById ===
{| class="wikitable"
|-
! Version !! NID
|-
| 3.60 || 0x9D304F4A
|}
Searches the widget corresponding to a2->id from the group of a1 and returns pWidgetCtx if found
<source lang="C">
typedef struct ScePafWidgetSearchParam {
void *unk_0;
unsigned int unk_4;
void *unk_8;
unsigned int id;
} ScePafWidgetSearchParam;
void *scePafWidgetSearchWidgetById(void *a1, ScePafWidgetSearchParam *a2, int a3);
</source>
=== scePafWidgetShowBusyIndicator ===
{| class="wikitable"
|-
! Version !! NID
|-
| 3.60 || 0x04310E14
|}
<source lang="C">void scePafWidgetShowBusyIndicator(void *pWidget);</source>
=== scePafWidgetHideBusyIndicator ===
{| class="wikitable"
|-
! Version !! NID
|-
| 3.60 || 0x73D27A1B
|}
<source lang="C">void scePafWidgetHideBusyIndicator(void *pWidget);</source>
== ScePafAutoTestTty ==
=== paf::autotest::Dump ===
{| class="wikitable"
|-
! Version !! NID
|-
| 3.68 || 0x9E10E873
|}
Mangled name: _ZN3paf8autotest4DumpENS0_8TestTypeEPKcz.
Can serve both as normal debug printf and also dump some PAF objects as XML. On external version of libpaf this function does nothing because it does not open tty output.
<source lang="c++">paf::autotest::Dump(paf::autotest::TestType, char const*, ...);</source>
[[Category:ARM]]
[[Category:Usermode]]
[[Category:Modules]]
[[Category:Modules]]
[[Category:Userland]]
[[Category:Library]]

Latest revision as of 23:47, 28 March 2024

Much of this page is wrong because much of the PAF is written in C++ but it works as a "function".

A good resource (to merge here) can be found at ScePaf-headers by Graphene.

Module

ScePaf is a C++ runtime.

This module has many virtual tables that point to exported functions. It would be great to start from marking which function belongs to which vtable. This way we can restore initial class structure.

Version World Privilege
1.69-3.740.011 Non-secure User

Libraries

TOOL version of libpaf module is different from CEX and DEX ones as it has an additional library: #ScePafAutoTestTty. Some TOOL system apps import this library and crash on CEX/DEX systems because of that missing library.

Known NIDs

Version Name World Visibility NID
3.60 ScePafLowlayer Non-secure User 0x2342266A
3.60 ScePafStdc Non-secure User 0xA7D28DAE
3.60 ScePafMisc Non-secure User 0x3D643CE8
3.60 ScePafCommon Non-secure User 0x3C1965CD
3.60 ScePafGraphics Non-secure User 0xA070D6A7
3.60 ScePafThread Non-secure User 0x54276D19
3.60 ScePafResource Non-secure User 0x2836DC9B
3.60 ScePafToplevel Non-secure User 0x4D9A9DD0
3.60 ScePafWidget Non-secure User 0x073F8C68
3.68 TOOL ScePafAutoTestTty Non-secure User 0xC503BD7C

Types

typedef struct ScePafSha1Context { // size is 0x68
	uint32_t h[5];
	char unk[0x54];
} ScePafSha1Context;

typedef struct ScePafDateTime {
  SceDateTime data;
  int data_0x10;
  int data_0x14;
} ScePafDateTime;

typedef struct ScePafHeapContext { // size is 0x60
	void *vtable;
	void *heap;
	void *membase;
	SceSize size;
	char name[0x20];
	SceBool is_import_membase;
	char data_0x30[3];
	int data_0x34;
	SceKernelLwMutexWork lw_mtx;
	SceUID memblk_id;
	int data_0x5C;               // ex:1
} ScePafHeapContext;

typedef struct ScePafHeapOpt { // size is 0x14
	int a1;
	int a2;
	char a3[4];
	int a4;
	int a5;
} ScePafHeapOpt;

ScePafLowlayer

ScePafStdc

scePafDefaultHeapInfo

Version NID
3.60 0x261CAF72
void *scePafDefaultHeapInfo(void);

delete

Version NID
3.60 0x347AFDD9
void delete(void *ptr);

sce_paf_memalign

Version NID
3.60 0xAA9952E0
void *sce_paf_memalign(SceSize align, SceSize length);

ScePafMisc

IsVitaTV

Version NID
3.60 0xAF4FC3F4

This is a guessed name.

scePafGetCurrentClockLocalTime

Version NID
3.60 0x96345146
int scePafGetCurrentClockLocalTime(ScePafDateTime *data);

scePafCreateHeap

Version NID
3.60 0xA2B0BF4D
void scePafCreateHeap(ScePafHeapContext *context, void *membase, SceSize size, const char *name, ScePafHeapOpt *opt);

scePafDeleteHeap

Version NID
3.60 0x25238A3A
void scePafDeleteHeap(ScePafHeapContext *context);

scePafMallocWithContext

Version NID
3.60 0x89A1CE78
void *scePafMallocWithContext(ScePafHeapContext *context, SceSize len);

scePafFreeWithContext

Version NID
3.60 0xCE97B579
void scePafFreeWithContext(ScePafHeapContext *context, void *ptr);

scePafMallocAlignWithContext

Version NID
3.60 0x04716F15
void *scePafMallocAlignWithContext(ScePafHeapContext *context, SceUInt32 align, SceSize len);

scePafReallocWithContext

Version NID
3.60 0x74DB7F5D
void *scePafReallocWithContext(ScePafHeapContext *context, void *ptr, SceSize len);

scePafSha1Init

Version NID
3.60 0xB38C53C0
int scePafSha1Init(ScePafSha1Context *context);

scePafSha1Update

Version NID
3.60 0xE6BB459E
int scePafSha1Update(ScePafSha1Context *context, const void *data, SceSize length);

scePafSha1Result

Version NID
3.60 0xB3BF59FC
int scePafSha1Result(ScePafSha1Context *context, void *dst);

ScePafCommon

scePafCommonCreateStartEventWatchdogThread

Version NID
3.60 0x6735B503

The created thread will run in loop.

int scePafCommonCreateStartEventWatchdogThread(void* eventWatchdogEntry, int unk);

scePafCommonFinalizeEventsWatchdogThread

Version NID
3.60 0x4A8115D5
int scePafCommonFinalizeEventsWatchdogThread(void* eventWatchdogEntry, int unk);

ScePafGraphics

scePafGraphicsUpdateCurrentWave

Version NID
3.60 0x2E30F1B5

This a guessed name.

Updates the rendering wave to the wave at the given index.

int scePafGraphicsUpdateCurrentWave(SceUInt32 index, SceFloat32 update_interval);

scePafGraphicsCurrentWave

Version NID
3.60 0xE71DB07B

This a guessed name.

extern SceUInt32 scePafGraphicsCurrentWave;

ScePafThread

ScePafResource

scePafResourceSearchIdByName

Version NID
3.60 0x5F05DE68

This is a guessed name. Temp name was scePafResourceGetIdByName.

Searches using sha-1.

typedef struct ScePafWidgetMainParam {
	ScePafString name;
	int unk_08;
	unsigned int id;
} ScePafWidgetMainParam;

SceUInt32 scePafResourceSearchIdByName(ScePafWidgetMainParam *widgetToSearchFor, ScePafString *widgetName);

ScePafToplevel

//ScePafToplevel_F5354FEF
SceInt32 SetInterface(SceUInt32 slot, ScePVoid interfaceTable);

//ScePafToplevel_1DF2C6FD
ScePVoid GetInterface(SceUInt32 slot);

//ScePafToplevel_A5560E60, size of the struct is 0x1C0
void* scePafToplevelInitializeSystemParam(void* pafSystemParam);

//ScePafToplevel_907BA948, fills pafSystemParam with system-specific info to prepare for top level init
void* scePafToplevelSetSystemParam(void* pafSystemParam);

//ScePafToplevel_E2860A99, main init function, buffer size must be 0x7C
void* scePafToplevelInitialize(void* pafInitBuf, void* pafSystemParam);

//ScePafToplevel_3F0DB1BF, name is official
scePafToplevelLoadCommonResourceAsync(void* pafTopLevel, ScePafLoadCRFinishCallback finish_callback);

//ScePafToplevel_400F84CE, size of struct is 0x94
scePafToplevelInitializeResourceInitParam(void* pafRcoParam);

//ScePafToplevel_004D98CC
scePafToplevelAssignResourceName(const char* name);

//ScePafToplevel_F702E40A, name is official
scePafToplevelLoadResourceAsync(void* pafRcoParam, ScePafLoadResourceFinishCallback finish_callback);

//ScePafToplevel_12E33958, thread that calls it becomes locked (does all drawing)
scePafToplevelStartDrawing(void* pafTopLevel);

//ScePafToplevel_9A4B0DC4
scePafTopLevelStopDrawing(void* pafTopLevel);

//ScePafToplevel_32CE0577
scePafTopLevelFinalize(void* pafTopLevel);

//ScePafToplevel_004D98CC, selects from resources registered with scePafToplevelAssignResourceName()
scePafTopLevelSelectResource(const char* resourceName);

//ScePafToplevel_34FE1331, struct size is 0x2C
scePafTopLevelInitializePageData(void* pageData);

//ScePafToplevel_30B442D9
scePafTopLevelLoadPage(void* widgetGroup, ScePafWidgetMainParam* pageParam, void* pageData);

ScePafWidget

widget

Type widget ctx size (bytes)
Plane 0x280
Text 0x2D8

scePafWidgetCreateNewTextWidget

Version NID
3.60 0x5C2962E1

Temp name was scePafWidgetCreateNewWidget.

/*
 * a2 is maybe parent widget?
 */
void *scePafWidgetCreateNewTextWidget(void *mem_ptr, void *a2, int a3);

scePafWidgetSetColor

Version NID
3.60 0xCD20EF38
#define SCE_PAF_WIDGET_COLOR_UNKNOWN_1   (1)
#define SCE_PAF_WIDGET_COLOR_TEXT        (2)
#define SCE_PAF_WIDGET_COLOR_TEXT_SHADOW (3)
#define SCE_PAF_WIDGET_COLOR_BACK_BAR    (4)
#define SCE_PAF_WIDGET_COLOR_UNKNOWN_5   (5)

typedef struct ScePafWidgetColor {
  float red;
  float green;
  float blue;
  float alpha;
} ScePafWidgetColor;

/*
 * a2 - set SCE_PAF_WIDGET_COLOR
 * a3 - unknow, set 0
 * a4 - unknow, set 0
 */
int scePafWidgetSetColor(void *pWidget, int a2, int a3, int a4, const ScePafWidgetColor *pColoer);

ScePafWidget_DDB0437F

Version NID
3.60 0xDDB0437F

A possible name could be scePafWidgetSetColorEnd.

int ScePafWidget_DDB0437F(void *pWidget);

scePafWidgetSetTextOption

Version NID
3.60 0xF2A2E2E6
#define SCE_PAF_WIDGET_OPTION_TEXT_BOLD          (0x7)
#define SCE_PAF_WIDGET_OPTION_TEXT_SHADOW        (0xC)
#define SCE_PAF_WIDGET_OPTION_TEXT_EXTERNAL_LINE (0xD)

/*
 * a2 - set SCE_PAF_WIDGET_OPTION_TEXT
 * a3 - unknow, set 0
 * a4 - unknow, set 0
 */
int scePafWidgetSetTextOption(void *pWidget, int a2, int a3, int a4, int enable);

scePafWidgetSetTextOption2

Version NID
3.60 0xCCD58ACB
int scePafWidgetSetTextOption2(void *pWidget, int a2, int a3, int a4);

Example of use

/*
 * Display bar color according to character width?
 * If this function is not used, are all character widths treated as lowercase?
 */
scePafWidgetSetTextOption2(p_widget, 2, 2, 0);

scePafWidgetTypeButton

Version NID
3.60 0xB773464D
const char *scePafWidgetTypeButton(void);

scePafWidgetTypeText

Version NID
3.60 0x723F6A4C
const char *scePafWidgetTypeText(void);

scePafWidgetTypeText2

Version NID
3.60 0x45AA2058

same to scePafWidgetTypeText

const char *scePafWidgetTypeText2(void);

scePafWidgetTypeBusyIndicator1

Version NID
3.60 0xDBCC58BB
const char *scePafWidgetTypeBusyIndicator1(void);

scePafWidgetTypeBusyIndicator2

Version NID
3.60 0x1D1F5BF7

same to scePafWidgetTypeBusyIndicator1

const char *scePafWidgetTypeBusyIndicator2(void);

scePafWidgetCmpTypeBase

Version NID
3.60 0x8EDFDE19
int scePafWidgetCmpTypeBase(void *pWidget, const char *type);

scePafWidgetCmpTypeBusyIndicator

Version NID
3.60 0xB954B379
int scePafWidgetCmpTypeBusyIndicator(void *pWidget, const char *type);

scePafWidgetSetFontSize

Version NID
3.60 0x39B15B98
int scePafWidgetSetFontSize(void *pWidget, float size, int unk, SceSize pos, SceSize len);

Example of use

// Set the font size of the entire text
scePafWidgetSetFontSize(p_widget, 22.0f, 1, 0, 0);

// When changing the font size only for the 7th character from the 4th character of the text
scePafWidgetSetFontSize(p_widget, 22.0f, 1, 4, 3);

scePafWidgetSetPosition

Version NID
3.60 0xE29AB31F

Temp name was scePafWidgetAddWidget.

/*
     x -------------------------------->
    y|---------------------------------|
    ||                |                |
    ||     -x.x       |      +x.x      |
    ||     +y.y       |      +y.y      |
    ||                |                |
    ||----------------0----------------|
    ||                |                |
    ||     -x.x       |      +x.x      |
    ||     -y.y       |      -y.y      |
    ||                |                |
    v|---------------------------------|
*/

typedef struct ScePafWidgetPos {
  float x;      // Distance from display center
  float y;      // Distance from display center
  float z;
  int unk_0x0C; // set 0
} ScePafWidgetPos;

int scePafWidgetSetPosition(void *pWidget, ScePafWidgetPos *pWidgetPos, float a3, int a4, int a5, int a6, int a7, int a8);

Example of use

ScePafWidgetPos widget_pos;
widget_pos.x        = x_pos - (960.0f / 2.0f);
widget_pos.y        = (544.0f / 2.0f) - y_pos;
widget_pos.z        = 0.0f;
widget_pos.unk_0x08 = 0;
scePafWidgetSetPosition(p_widget, &widget_pos, 0.0f, 0, 0x10000, 0, 0, 0);

scePafWidgetSearchWidgetById

Version NID
3.60 0x9D304F4A

Searches the widget corresponding to a2->id from the group of a1 and returns pWidgetCtx if found

typedef struct ScePafWidgetSearchParam {
	void *unk_0;
	unsigned int unk_4;
	void *unk_8;
	unsigned int id;
} ScePafWidgetSearchParam;

void *scePafWidgetSearchWidgetById(void *a1, ScePafWidgetSearchParam *a2, int a3);

scePafWidgetShowBusyIndicator

Version NID
3.60 0x04310E14
void scePafWidgetShowBusyIndicator(void *pWidget);

scePafWidgetHideBusyIndicator

Version NID
3.60 0x73D27A1B
void scePafWidgetHideBusyIndicator(void *pWidget);

ScePafAutoTestTty

paf::autotest::Dump

Version NID
3.68 0x9E10E873

Mangled name: _ZN3paf8autotest4DumpENS0_8TestTypeEPKcz.

Can serve both as normal debug printf and also dump some PAF objects as XML. On external version of libpaf this function does nothing because it does not open tty output.

paf::autotest::Dump(paf::autotest::TestType, char const*, ...);