IPC (phatd-51d) protocol

From PhatHack Wiki
Jump to navigation Jump to search

NOTE: Preliminary info, will update as I get more

51d -> phatd

d820

special initial packet:
long op_code = 0x20;
long arg1 = 0;
long arg2 = PID + 1000;

followed by 

packet structure (0x218 bytes)
long op_code; (0x0 offset)
long arg1; (0x4 offset) usually 0x64 from phatd so far (signature for a reply?)
long arg2; (0x8 offset) 
long arg3; (0xC offset)
long arg4; (0x10 offset)
long arg5; (0x14 offset)
long arg6; (0x18 offset)



PHATLIB OP CODES (51d info):
'play':
	set: op_code=0x9:, arg2=disk_num, arg3=track_num, arg4=track_offset
	expect: arg1=0x64

0x1f or 0x34: query play mode
req num disks:
	set: op_code=0x1
	expect: arg1=0x64, arg3=num_disks
req num tracks:
	set: op_code=0x2, arg3=num_tracks
	expect: arg4=num_tracks

req name of disk:
	set: op_code=0x3, arg3=disk_num
	expect: arg1=0x64, char arg6[]="Disk Name\0"

req phat_filename:
	set: op_code=0x4, arg3=disk_num, arg4=track_num
	expect: arg1=0x64, char arg6[]="File Name\0"

req phat_desc:
	set: op_code=0x5, arg3=disk_num, arg4=track_num
	expect: arg1=0x64, char arg6[]="Track Name\0"

req phat_artist:
	set: op_code=0x6, arg3=disk_num, arg4=track_num
	expect: arg1=0x64, char arg6[]="Artist Name\0"

req phat_songname:
	set: op_code=0x7, arg3=disk_num, arg4=track_num
	expect: arg1=0x64, char arg6[]="Artist Name\0"

req phat_status: (multiple ways of calling, not sure about info)
	set: op_code=0x8, arg4=0x0
	expect: op_code=0x8, arg1=0x64, arg2=something+2, arg3=disk?, arg4=track?, arg5=offset?, char arg6[512]=Display Name (ie. Ace Of Base - All That She Wants)

phat_play:
	set: op_code=0x9, arg3=disk_num, arg4=track_num, arg5=track_offset
	expect: arg1=0x64, arg4=track_num

phat_recv_status: (This seems to just listen for status?)
	expect: op_code=0x8, arg1=0x64, arg2=something+2, arg3=disk?, arg4=track?, arg5=offset?, char arg6[512]=Display Name (ie. Ace Of Base - All That She Wants)

phat_stop:
	set: op_code=0xa
	expect: arg1=0x64

phat_playfile:
	set: op_code=0xb, arg5=int(length||0=all?), char arg6[512]=filename
	expect: arg1=0x64

phat_shutdown_server:
	set: op_code=0xd
	expect: arg1=0x64

req phat_genre:
	set: op_code=0xe, arg3=disk_num, arg4=track_num
	expect: arg1=0x64, char arg6[]="Current Genre\0"

req phat_comment:
	set: op_code=0xf, arg3=disk_num, arg4=track_num
	expect: arg1=0x64, char arg6[]="Comment\0"

phat_randdisk:
	set: op_code=0x17, arg3=??random??
	expect: arg1=0x64

phat_randall:
	set: op_code=0x18, arg3=??random??
	expect: arg1=0x64

phat_randoff:
	set: op_code=0x19, arg3=0
	expect: arg1=0x64

phat_repeatdisk:
	set: op_code=0x1a, arg3=0
	expect: arg1=0x64

phat_repeattrack:
	set: op_code=0x1b, arg3=0
	expect: arg1=0x64

phat_repeatoff:
	set: op_code=0x1c, arg3=0
	expect: arg1=0x64

phat_playmode:
	set: op_code=0x1f
	expect: arg1=0x64, arg3=play_mode

phat_announceon:
	set: op_code=0x2a, arg3=0
	expect: arg1=0x64

phat_announceoff:
	set: op_code=0x2b, arg3=0
	expect: arg1=0x64

phat_playmode_normal:
	set: op_code=0x2c, arg3=0
	expect: arg1=0x64

phat_playmode_artist:
	set: op_code=0x2d, arg3=0
	expect: arg1=0x64

phat_playmode_genre:
	set: op_code=0x2e, arg3=0
	expect: arg1=0x64

phat_playmode_album:
	set: op_code=0x2f, arg3=0
	expect: arg1=0x64

req phat_nexttrack:
	set: op_code=0x30, arg3=disk_num ,arg4=track_num
	expect: op_code=0x30, arg1=0x64

phat_playmode_eodstop: (play only current disk?)
	set: op_code=0x31, arg3=0
	expect: arg1=0x64

phat_setcur:
	set: op_code=0x32, arg3=disk_num?, arg4=track_num?
	expect: arg1=0x64

phat_playmode_alpha:
	set: op_code=0x35, arg3=0
	expect: arg1=0x64

phat_swap_channels:
	set: op_code=0x33, arg3=??random??
	expect: arg1=0x64

req phat_playlist:
	set: op_code=0x36, arg3=disk_num, arg4=track_num
	expect: arg1=0x64, char arg6[]="Playlist\0"

req phat_album:
	set: op_code=0x37, arg3=disk_num, arg4=track_num
	expect: arg1=0x64, char arg6[]="Album\0"

req phat_duration:
	set: op_code=0x37, arg3=disk_num, arg4=track_num
	expect: arg1=0x64, arg5=duration

phat_badtrack:
	set: op_code=0x51, arg3=0
	expect: arg1=0x64

phat_eot: (end of track)
	set: op_code=0x52, arg3=0
	expect: arg1=0x64

req phat_tid: (track ID? - unused by my 51d)
	set: op_code=0x64, arg3=disk_num ,arg4=track_num
	expect: arg1=0x64, arg5=phat_tid

phat_start_program:
	set: op_code=0x67, char arg6[]="Program\0"
	expect: arg1=0x64