Example #1
0
void tTJSByteCodeLoader::ReadDataArea( const tjs_uint8* buff, int offset, size_t size ) {
	int count = read4byte( &(buff[offset]) );
	offset += 4;
	if( count > 0 ) {
		ByteArray.set( (tjs_int8*)&buff[offset], count );
		int stride = ( count + 3 ) >> 2;
		offset += stride << 2;
	}
Example #2
0
tTJSScriptBlock* tTJSByteCodeLoader::ReadByteCode( tTJS* owner, const tjs_char* name, const tjs_uint8* buf, size_t size ) {
	ReadBuffer = buf;
	ReadIndex = 0;
	ReadSize = size;

	const tjs_uint8* databuff = ReadBuffer;

	// TJS2
	int tag = read4byte( databuff );
	if( tag != FILE_TAG_LE ) return NULL;
	// 100'\0'
	int ver = read4byte( &(databuff[4]) );
	if( ver != VER_TAG_LE ) return NULL;

	int filesize = read4byte( &(databuff[8]) );
	if( filesize != size ) return NULL;

	//// DATA
	tag = read4byte( &(databuff[12]) );
	if( tag != DATA_TAG_LE ) return NULL;
	size = read4byte( &(databuff[16]) );
	ReadDataArea( databuff, 20, size );

	int offset = 12 + size; // これがデータエリア後の位置
	// OBJS
	tag = read4byte( &(databuff[offset]) );
	offset+=4;
	if( tag != OBJ_TAG_LE ) return NULL;
	//int objsize = ibuff.get();
	int objsize = read4byte( &(databuff[offset]) );
	offset+=4;
	tTJSScriptBlock* block = new tTJSScriptBlock(owner, name, 0 );
	ReadObjects( block, databuff, offset, objsize );
	return block;
}
Example #3
0
/**
 * @brief	形状情報
 */
static UINT8* RT_MAP_GetSharpRecord(UINT8* aBin)
{
	UINT8* bin;
	UINT8 rlp;
	UINT32 ofs = ALLF32;

	if (NULL == aBin) {
		return (NULL);
	}

	bin = SC_MA_A_SHBIN_GET_DIR(aBin);
	for (rlp = 0; rlp < 16; rlp++) {
		ofs = read4byte(bin);
		move4byte(bin);
		if (ALLF32 != ofs) {
			break;
		}
	}
	if (ALLF32 == ofs) {
		return (NULL);
	}
	// バイナリ先頭取得
	return (SC_MA_A_RSHP_GET_BINARY(aBin) + (ofs * 4));
}
Example #4
0
	int objsize = read4byte( &(databuff[offset]) );
	offset+=4;
	tTJSScriptBlock* block = new tTJSScriptBlock(owner, name, 0 );
	ReadObjects( block, databuff, offset, objsize );
	return block;
}

void tTJSByteCodeLoader::ReadDataArea( const tjs_uint8* buff, int offset, size_t size ) {
	int count = read4byte( &(buff[offset]) );
	offset += 4;
	if( count > 0 ) {
		ByteArray.set( (tjs_int8*)&buff[offset], count );
		int stride = ( count + 3 ) >> 2;
		offset += stride << 2;
	}
	count = read4byte( &(buff[offset]) );
	offset += 4;
	if( count > 0 ) {	// load short
		ShortArray.clear();
		ShortArray.reserve( count );
		for( int i = 0; i < count; i++ ) {
			ShortArray.push_back( read2byte( &(buff[offset]) ) );
			offset += 2;
		}
		offset += (count & 1) << 1;
	}
	count = read4byte( &(buff[offset]) );
	offset += 4;
	if( count > 0 ) {
		LongArray.clear();
		LongArray.reserve( count );