-
Notifications
You must be signed in to change notification settings - Fork 1
/
gsegment.h
83 lines (71 loc) · 2.23 KB
/
gsegment.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
/*
* File: gsegment.h
* Author: Sir Gee of Five
*
* Created on May 29, 2011, 10:23 AM
*/
#ifndef GSEGMENT_H
#define GSEGMENT_H
#include <stdio.h>
#include <string.h>
#include <pspkerneltypes.h>
/** Indicates success. */
#define GSEGMENT_SUCCESS (0)
/** Indicates failure. */
#define GSEGMENT_FAILURE (-1)
/** Indicates a NULL pointer. */
#define GSEGMENT_NULLPTR (-2)
/** The maximum length of a Segment name. */
#define GSEGMENT_NAME_LEN (63)
#ifdef __cplusplus
extern "C" {
#endif
typedef enum _ESegmentType {
SET_None = 0,
SET_Text,
SET_Data,
SET_RoData,
SET_ModInfo
}
ESegmentType;
typedef struct _Gsegment {
/** The type of the segment. */
ESegmentType segmentType;
/** The first address in the segment. */
SceUInt32 startaddr;
/** The first address outside of the segment. */
SceUInt32 endaddr;
/** The name of the segment. */
char name[GSEGMENT_NAME_LEN + 1];
}
/** The Gsegment struct is used to represent a memory Segment. */
Gsegment;
/** Copy a Gsegment.
*
* @param pDest Pointer to a Gsegment struct representing the destination.
* @param pSrc Pointer to a Gsegment struct representing the source.
* @return 0 indicates success, <0 indicates failure.
*/
int gsegment_copy(Gsegment* pDest, Gsegment* pSrc);
/** Initialize a Gsegment.
*
* @param pSeg Pointer to the Gsegment struct to initialize.
* @return 0 indicates success, <0 indicates failure.
*/
int gsegment_init(Gsegment* pSeg);
/** Assign the values of a Gsegment.
*
* @param pSeg Pointer to a Gsegment struct representing the segment.
* @param startaddr SceUInt32 containing the first address in the segment.
* @param endaddr SceUInt32 containing the first address outside of the
* segment.
* @param segType ESegmentType indicating the type of segment.
* @param name The name of the segment.
* @return 0 indicates success, <0 indicates failure.
*/
int gsegment_set(Gsegment* pSeg, const SceUInt32 startaddr,
const SceUInt32 endaddr, const char* name, ESegmentType segType);
#ifdef __cplusplus
}
#endif
#endif /* GSEGMENT_H */