ScePaf

From Vita Development Wiki
Jump to navigation Jump to search

Module

ScePaf is a C++ runtime.

Quick note on reversing. This module has many vtables 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.

Known NIDs

Version Name World Privilege NID
1.69 ScePaf Non-secure User 0x614CFD65
3.60 ScePaf Non-secure User 0xCD679177

Libraries

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

ScePafWidget

scePafWidgetCreateNewWidget

Version NID
3.60 0x5C2962E1
/*
 * a2 is maybe parent widget?
 */
void *scePafWidgetCreateNewWidget(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

??? 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);

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);

scePafWidgetAddWidget

Version NID
3.60 0xE29AB31F
/*
     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
  int unk_0x04; // set 0
  int unk_0x08; // set 0
} ScePafWidgetPos;

int scePafWidgetAddWidget(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.unk_0x04 = 0;
widget_pos.unk_0x08 = 0;
scePafWidgetAddWidget(p_widget, &widget_pos, 0.0f, 0, 0x10000, 0, 0, 0);