Skip to content

Commit 33f42ba

Browse files
committed
Fix CCAPI exports.
1 parent ca7fe04 commit 33f42ba

File tree

1 file changed

+31
-22
lines changed

1 file changed

+31
-22
lines changed

ps3api/ccapi.py

Lines changed: 31 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -8,31 +8,31 @@ class CCAPIError(CEnum):
88
CCAPI_OK = (0)
99
CCAPI_ERROR = (-1)
1010

11-
class ConsoleIdType(CEnum):
11+
class CCAPIConsoleIdType(CEnum):
1212
IDPS = (0)
1313
PSID = (1)
1414

15-
class ShutdownMode(CEnum):
15+
class CCAPIShutdownMode(CEnum):
1616
SHUTDOWN = (0)
1717
SOFT_REBOOT = (1)
1818
HARD_REBOOT = (2)
1919

20-
class BuzzerType(CEnum):
20+
class CCAPIBuzzerType(CEnum):
2121
CONTINIOUS = (0)
2222
SINGLE = (1)
2323
DOUBLE = (2)
2424
TRIPLE = (3)
2525

26-
class ColorLed(CEnum):
26+
class CCAPIColorLed(CEnum):
2727
GREEN = (0)
2828
RED = (1)
2929

30-
class StatusLed(CEnum):
30+
class CCAPIStatusLed(CEnum):
3131
OFF = (0)
3232
ON = (1)
3333
BLINK = (2)
3434

35-
class NotifyIcon(CEnum):
35+
class CCAPINotifyIcon(CEnum):
3636
NOTIFY_INFO = (0)
3737
NOTIFY_CAUTION = (1)
3838
NOTIFY_FRIEND = (2)
@@ -54,30 +54,39 @@ class NotifyIcon(CEnum):
5454
NOTIFY_TROPHY3 = (18)
5555
NOTIFY_TROPHY4 = (19)
5656

57-
class ConsoleType(CEnum):
57+
class CCAPIConsoleType(CEnum):
5858
UNK = (0)
5959
CEX = (1)
6060
DEX = (2)
6161
TOOL = (3)
6262

63-
class ConsoleId(Structure):
63+
class CCAPIConsoleId(Structure):
6464
_fields_ = [
65-
("value", c_uint8 * 16 )
65+
("value", c_char * 16 )
6666
]
6767

68-
class ProcessName(Structure):
68+
class CCAPIProcessName(Structure):
6969
_fields_ = [
70-
("value", c_uint8 * 512 )
70+
("value", c_char * 512 )
7171
]
7272

73-
class ConsoleName(Structure):
73+
class CCAPIConsoleName(Structure):
7474
_fields_ = [
75-
("value", c_uint8 * 256 )
75+
("value", c_char * 256 )
76+
]
77+
78+
class CCAPIConsoleIp(Structure):
79+
_fields_ = [
80+
("value", c_char * 256 )
7681
]
7782

7883
class CCAPIExports:
7984
def __init__(self):
85+
#
86+
# TODO: might need to bundle in future
87+
#
8088
os.add_dll_directory(os.getcwd())
89+
os.add_dll_directory(os.path.join(os.getenv('APPDATA'), "ControlConsoleAPI"))
8190

8291
self.CCAPI_DLL = CDLL("CCAPI.dll")
8392

@@ -113,8 +122,8 @@ def __init__(self):
113122
114123
Set the console ID that will be used on boot.
115124
'''
116-
self.CCAPISetBootConsoleIds = CCAPI_DLL.CCAPISetBootConsoleIds
117-
self.CCAPISetBootConsoleIds.argtypes = [ c_int32, c_int32, POINTER(ConsoleId) ]
125+
self.CCAPISetBootConsoleIds = self.CCAPI_DLL.CCAPISetBootConsoleIds
126+
self.CCAPISetBootConsoleIds.argtypes = [ c_int32, c_int32, POINTER(CCAPIConsoleId) ]
118127
self.CCAPISetBootConsoleIds.restype = CCAPIError
119128

120129
'''
@@ -123,7 +132,7 @@ def __init__(self):
123132
Set the current console ID.
124133
'''
125134
self.CCAPISetConsoleIds = self.CCAPI_DLL.CCAPISetConsoleIds
126-
self.CCAPISetConsoleIds.argtypes = [ c_int32, POINTER(ConsoleId) ]
135+
self.CCAPISetConsoleIds.argtypes = [ CCAPIConsoleIdType, POINTER(CCAPIConsoleId) ]
127136
self.CCAPISetConsoleIds.restype = CCAPIError
128137

129138
'''
@@ -149,17 +158,17 @@ def __init__(self):
149158
150159
Get the list of processes.
151160
'''
152-
self.CCAPIGetProcessList = self.CCAPI_DLL.CCAPIGetMemory
161+
self.CCAPIGetProcessList = self.CCAPI_DLL.CCAPIGetProcessList
153162
self.CCAPIGetProcessList.argtypes = [ POINTER(c_uint32), POINTER(c_uint32) ]
154-
self.CCAPIGetProcessList.restype = CCAPIError
163+
self.CCAPIGetProcessList.restype = c_ulong # seems to return something else 0x80001000
155164

156165
'''
157166
int CCAPIGetProcessName(u32 pid, ProcessName* name);
158167
159168
Get the name of the current attached process.
160169
'''
161170
self.CCAPIGetProcessName = self.CCAPI_DLL.CCAPIGetProcessName
162-
self.CCAPIGetProcessName.argtypes = [ c_uint32, POINTER(ProcessName) ]
171+
self.CCAPIGetProcessName.argtypes = [ c_uint32, POINTER(CCAPIProcessName) ]
163172
self.CCAPIGetProcessName.restype = CCAPIError
164173

165174
'''
@@ -235,13 +244,13 @@ def __init__(self):
235244
self.CCAPIGetNumberOfConsoles.restype = c_int32
236245

237246
'''
238-
int CCAPIGetConsoleInfo(int index, ConsoleName* name, ConsoleIp* ip);
247+
void CCAPIGetConsoleInfo(int index, ConsoleName* name, ConsoleIp* ip);
239248
240249
Get console name and ip.
241250
'''
242251
self.CCAPIGetConsoleInfo = self.CCAPI_DLL.CCAPIGetConsoleInfo
243-
self.CCAPIGetConsoleInfo.argtypes = [ c_uint32, POINTER(ConsoleName), POINTER(ConsoleIp) ]
244-
self.CCAPIGetConsoleInfo.restype = CCAPIError
252+
self.CCAPIGetConsoleInfo.argtypes = [ c_uint32, POINTER(CCAPIConsoleName), POINTER(CCAPIConsoleIp) ]
253+
self.CCAPIGetConsoleInfo.restype = None
245254

246255
'''
247256
int CCAPIGetDllVersion();

0 commit comments

Comments
 (0)