Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Some info from messing around with kero blaster
import struct
#used to quickly dump all the available commands from the executable
fIn = open("PinkHour.exe","rb")
fIn.seek(0xD2180)
for i in range(0,164):
magic = ''.join(struct.unpack("cccc",fIn.read(4)))
CmdNum = struct.unpack("I",fIn.read(4))[0]
argcount = struct.unpack("I",fIn.read(4))[0]
print "{0:<13} | {1:<14} | {2}".format('`'+magic+'`',argcount,CmdNum)
fIn.close()

Scripts

Scripts are pxeve files located in the text directory

Command Bank

Total size: 12(0xC) bytes

Offset Type Description
0x0 uint32 Command magic ex: flag = 0x67616C66
0x4 uint32 Command ID
0x8 uint32 Command argument count

Command bank located at 0xD2180 of PinkHour binary:

struct CommandInfo
{
	uint32_t CommandMagic;
	uint32_t CommandID;
	uint32_t CommandArgCount
};
Function Name Argument count Command ID Description
armF 3 0
armS 2 1
blln 2 2
bllR 0 3
bnsD 0 4
cage 1 5
call 1 6
camp 3 7
chgN 2 8
chkP 3 9
cler 0 10
cont 0 11
crdG 1 12
crdt 1 13
cRsv 1 14
curN 1 15
dely 1 16
dirN 2 17
dl20 0 18 Delay for 20 frames(1/3 of a second)
dl60 0 19 Delay for 1 second
drug 1 20
dsSv 0 21
exit 0 22
fadC 0 23
fadE 3 24
fadF 3 25
fadI 0 26
fadM 0 27
fadO 0 28
fcsH 1 29
fcsM 1 30
fcsN 2 31
fcsO 2 32
fcsU 1 33
fcsV 1 34
flag 2 35
fldQ 2 36
fldS 2 37
flgC 2 38
flgF 2 39
flgI 0 40
flgM 1 41
flgO 2 42
flgP 1 43
flgR 1 44
flsh 0 45
free 0 46
frez 0 47
full 0 48
gaug 2 49
govr 0 50
gpfM 1 51
gpfP 1 52
grUp 1 53
hide 0 54
hito 0 55
home 0 56
isla 3 57
isPh 1 58
isUC 0 59
isUF 4 60
isUn 4 61
itmM 1 62
itmP 1 63
jmpA 2 64
jmpC 3 65
jmpD 1 66
jmpF 2 67
jmpG 2 68
jmpI 2 69
jmpM 2 70
jmpP 1 71
jmpS 4 72
jump 1 73 Jump to label
ldIm 1 74
life 1 75
lifm 1 76
lkFU 1 77
lump 1 78
mapc 1 79
mapR 3 80
mony 1 81
muCo 1 82
muFO 1 83
muLd 1 84
muLp 0 85
muOc 0 86
muSt 0 87
muWS 1 88
namA 1 89
namI 1 90
ncon 0 91
newA 2 92
newE 1 93
nodB 0 94
nodc 0 95
nodE 0 96
nxtl 0 97
oURL 0 98
pkup 2 99
plAc 1 100
plDi 1 101
plEq 1 102
plMv 2 103
plPo 1 104
plSf 2 105
plSt 0 106
posN 3 107
prm2 2 108
qOK_ 0 109
quie 0 110
regN 1 111
regT 1 112
rely 0 113
rema 1 114
remD 0 115
remR 0 116
repo 1 117
rmvB 0 119
rmvN 1 118
save 0 120
scrF 1 121
sftN 3 122
shoR 1 123
shwS 1 124
sign 1 125
skip 1 126
skpE 1 127
skLT 1 128
slPo 0 129
slPu 0 130
soul 1 131
sous 1 132
souv 1 133
stgB 4 134
stgR 0 135
stgS 1 136
stop 0 137
swtN 2 138
taBe 0 139
taCh 1 140
taFi 0 141
taJm 1 142
taRe 0 143
taSt 0 144
taSv 0 145
taZe 0 146
titl 0 147
trD2 2 148
trL2 2 150
trIn 0 149
trns 3 151
trR2 2 152
trU2 2 153
txtP 2 154
txtV 1 155
txtW 1 156
vfEn 0 157
vflg 2 158
whtI 0 159
whtO 0 160
wtCr 0 161
wtFc 0 162
wtNB 2 163

Syntax

#####function calls Functions are called using a < character followed by a four character function name. Interally the four characters are interpreted as a 32 bit little endian integer to easily match the the function call with the proper subroutine.

<flag[Mute;1]
^  ^ ^  ^ ^^^
|  | |  | |||	
|  | |  | ||Argument list end
|  | |  | |Arguent 2
|  | |  | Argument separator ";"
|  | |  Argument 1
|  | Argument list begin
|  Function name (four characters)
Function call prefix

#####Labels Labels mark jump points that in code that can be jumped to. The IN label marks where the script should start execution.

*[IN]
^^ ^
|| |
|| |Label name (No spaces)
|Label name definition brackets
Label prefix

Labels are jumped to using the <jump[(Label name)] call.

File Types

####PxPack

PxPack files are identified with a 16 byte PXPACK121127a**\0 header followed by strings. Strings are in a stream format such that there is a uint8 length followed by the characters

struct KString
{
    unsigned char Length;
    char String[Length];
};

After the header, six strings are read and allowed a maximum size. Strings may also be of 0 length which is depicted as a 0 length byte and a single null terminator.

Description Max Length
Unknown 32
Script Name 16
Next Level 16
Prev Level 16
Link Level 16
Palette 16
struct KPalette
{
	KeroString Name;
	uint8_t Unknown1;
	uint8_t Unknown2;
};

After the header, two unknown shorts followed by 2 unknown chars follow. Then the actual map level data for up to three layers follows.

struct KLayer
{
    uint8_t PXMAP[8]; // pxMAP01\0
    uint16_t Width;
    uint16_t Height;
    uint8_t Flags; // ??
	// If flags is set to 1 or 2 then it seems to take in an extra 4 byte integer
	// have yet to encouter a map that does this
	// possibly determines static/scrolling layer or if
	// the layer is but a tiling image/floodfill
    uint8_t Data[Width*Height];
};

Misc Notes

Context object is possibly just a massive "Game session" object. 476(0x1DC) bytes in size

Initialization at sub_12C7630 along with another 20 byte global struct

//--------------------------------------
//--- 010 Editor v3.1 Binary Template
//
// File:
// Author:
// Revision:
// Purpose:
//--------------------------------------
struct KString
{
unsigned char Length;
char String[Length];
};
char Header[0x10]<bgcolor=cGreen>;
KString Unknown<bgcolor=cLtRed>;
KString ScriptName<bgcolor=cLtBlue>;
KString NextLevel<bgcolor=cLtGreen>;
KString PrevLevel<bgcolor=cLtYellow>;
KString LinkLevel<bgcolor=cLtAqua>;
KString NPCPalette<bgcolor=cLtPurple>;
unsigned short Ukwn1<bgcolor=cLtRed>;
unsigned short Ukwn2<bgcolor=cLtAqua>;
unsigned char Ukwn3<bgcolor=cLtGreen>;
unsigned char Ukwn4<bgcolor=cLtYellow>;
unsigned char Ukwn5<bgcolor=cLtBlue>;
unsigned char Ukwn6<bgcolor=cLtPurple>;
struct KPalette
{
KString Name<bgcolor=cLtRed>;
unsigned char Unkwn1<bgcolor=cLtAqua>;
unsigned char Unkwn2<bgcolor=cLtGreen>;
};
KPalette Layer1TileMap,
Layer2TileMap,
Layer3TileMap;
struct KLayer
{
char PXMAP[8]<bgcolor=cBlue>;
unsigned short Width<bgcolor=cLtGreen>;
unsigned short Height<bgcolor=cLtPurple>;
unsigned char Flags<bgcolor=cRed>;
unsigned char Data[Width*Height]<bgcolor=cLtGreen>;
};
KLayer Layer1;
KLayer Layer2;
KLayer Layer3;
struct KEntity
{
unsigned char Flags;
unsigned char Type;
unsigned short X,Y;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.