State of the PHPInSimMod.
I've just finished the packet abstraction code, that's 48 lines long and took me over 8 hours to complete (damn research). It allows the core devs, Myself, Ripnet, Morpha; to add packets very easily to the list should InSim get new packets in the future, with packet definitions being simplified to this in most cases:
<?php
class IS_TINY extends Struct {
const PACK = 'CCCC';
const UNPACK = 'CSize/CType/CReqI/CZero';
public $Size = 4;
public $Type = ISP_TINY;
public $ReqI;
public $Zero;
}
?>
With the abstract class Struct containing all of the logic code for 95% of the packets, ISP_MCI, ISP_NLP & IRP_HOS being the odd balls, it makes it many times more easy to maintain code. The Struct class itself contains the unpack and pack functions, and even the constructor that has been simplified and made cross packet compatible. You can write to the object in any way that you wish, from directly editing the property one by one, to feeding it a bit stream and having it parse the information into it's self. It's also flexable on the way out, should you wish to make it a string (to send over the socket connection for example) the __toString magic method is already defined and will pack it self, and return it's value as if it where still just a bunch of bits. The only thing to add would be a single line, out of order expression handler, so I'll work on that next and the packet system will be done!