// ======================================================================
//
// Alife_Water_Page.cpp
// Copyright 2005, Sony Online Entertainment
// All Rights Reserved
//
// ======================================================================

//#include "sputypes.h"
#include <string.h>
#include <spupages/spu/spupages.h>
#include <spuutil/spu/spuutil.h>
#include <spu_intrinsics.h>
#include <spu_thread.h>
#include <spu_syscall.h>
#include <spu_mfc.h>
#include <spu_syscall.h>
#include <sys/types.h>
#include <math.h>

//#include <vectormath_aos.h>

//void spu_RenderWaterChunkPage( WaterPageData* wpd, uint8_t* resultBuffer );
typedef unsigned long int uint32_t;
typedef unsigned char uint8_t;

int main( unsigned int param0, unsigned int param1 )
{
    //char TextBuffer[256];
    //TextBuffer[0] = 'y';
    //TextBuffer[1] = 'o';
    //TextBuffer[2] = 0;
    //strcpy( TextBuffer, "yo" );

    float Region[4] = { 0.0f, 0.0f, 0.0f, 0.0f };

    uint32_t *pu32 = (uint32_t *) 0x00020000;
    uint8_t* incomingBuffer = (unsigned char*) GetLSDataPointer();

    float fval = sinf( 1.0f );

    pu32[0] = (uint32_t) incomingBuffer;

    //delete valp1;
    //delete valp0;

    return 0;

}

//unsigned int counterStart = spu_readch( spu_rd_decr_count );
//uint8_t* outgoingBuffer = reinterpret_cast< uint8_t*>( (reinterpret_cast< uint32_t >( incomingBuffer + param1 ) + 0x7f) & ~0x7f );
//spuutil_SetDecrementer( 0xffffffff );
//spuutil_QueueMFCTransfer( MFC_CMD_GET, 0, param0, incomingBuffer, param1, 0 );
//spuutil_WaitForDMATagGroups( 0x1, 0x2 );
//spuutil_QueueMFCTransfer( MFC_CMD_PUT, 0, headerAndIndexDestAddr, reinterpret_cast< uint8_t* >( header ), (headerTransferSize + indexTransferSize), 0 );
//spuutil_QueueMFCTransfer( MFC_CMD_PUT, 0, vertexDestAddr, reinterpret_cast< uint8_t* >( points ), vertexTransferSize, 0 );
//spuutil_WaitForDMATagGroups( 0x1, 0x2 );
//counterStop = spu_readch( spu_rd_decr_count );
//g_lastDMADown = (counterStart - counterStop);
//counterStop = spu_readch( spu_rd_decr_count );
//g_thisDMAUp = (counterStart - counterStop);
//WaterPageData* waterPageData = reinterpret_cast< WaterPageData* >( incomingBuffer );
//spu_RenderWaterChunkPage( waterPageData, outgoingBuffer );
