Python scripting with Apollo¶
Apollo includes a built-in MicroPython interpreter that allows you to write custom scripts to manipulate save data. The following global variables are available to your scripts:
Global variables¶
- savedata¶
The raw binary save data being modified. You can read from and write to this bytearray to manipulate the save data.
- Type:
bytearray
- Value:
A byte array containing the raw binary save data.
- host_file_path¶
- Type:
bytearray
- Value:
The full path of the save data file being modified. (e.g., “/user/savegames/SAVEDATA.DAT”)
- host_sys_name¶
- Type:
bytearray
- Value:
The user-defined system name. (e.g., “PS3-1234”)
- host_username¶
- Type:
bytearray
- Value:
Current username. (e.g., “player1”)
- host_psid¶
- Type:
bytearray
- Value:
The system’s PSID value. (e.g.,
b"\x12\x34\x56\x78\x9A...")
- host_account_id¶
- Type:
bytearray
- Value:
The user’s account ID. (e.g.,
b"\x12\x34\x56\x78\x9A\xBC\xDE\xF0")
- host_lan_addr¶
- Type:
bytearray
- Value:
The system’s LAN MAC address. (e.g.,
b"\x12\x34\x56\x78\x9A\xBC")
- host_wlan_addr¶
- Type:
bytearray
- Value:
The system’s WLAN MAC address. (e.g.,
b"\x12\x34\x56\x78\x9A\xBC")
Libraries and micro-libraries¶
The following standard Python libraries have been “micro-ified” to fit in with the philosophy of MicroPython. They provide the core functionality of that module and are intended to be a drop-in replacement for the standard Python library.
apollo– binary data manipulation functionsgc– control the garbage collectormath– mathematical functionssys– system specific functionsubinascii– binary/ASCII conversionsucollections– collection and container typesucrypto– encryption related functionsuhashlib– hashing algorithmuheapq– heap queue algorithmuio– input/output streamsujson– JSON encoding and decodingumsgpack– MessagePack encoding and decodingure– regular expressionsustruct– pack and unpack primitive data typesutime– time related functionsuzlib– zlib compression functions