예제 #1
0
void NWC24Config::ResetConfig()
{
  if (File::Exists(m_path))
    File::Delete(m_path);

  constexpr const char* urls[5] = {
      "https://amw.wc24.wii.com/cgi-bin/account.cgi", "http://rcw.wc24.wii.com/cgi-bin/check.cgi",
      "http://mtw.wc24.wii.com/cgi-bin/receive.cgi",  "http://mtw.wc24.wii.com/cgi-bin/delete.cgi",
      "http://mtw.wc24.wii.com/cgi-bin/send.cgi",
  };

  memset(&m_data, 0, sizeof(m_data));

  SetMagic(0x57634366);
  SetUnk(8);
  SetCreationStage(NWC24_IDCS_INITIAL);
  SetEnableBooting(0);
  SetEmail("@wii.com");

  for (int i = 0; i < URL_COUNT; ++i)
  {
    strncpy(m_data.http_urls[i], urls[i], MAX_URL_LENGTH);
  }

  SetChecksum(CalculateNwc24ConfigChecksum());

  WriteConfig();
}
예제 #2
0
// Error within the status packet is considered to be "parameter 0"
// So Pings receive 4 bytes of parameters.
// Also, data sent is overwritten with returned data. The buffer is reused.
bool TXRXPacket(uint8_t* data, int num_params_sending,
                int num_params_receiving) {
  SetChecksum(data, num_params_sending);
  // TRANSMIT PACKET
  bool result = TXPacket(data, BASE_PACKET_SIZE + num_params_sending);
  if (!result) {
    // printf("Couldn't send packet successfully.\n");
    return false;
  }

  // If broadcast, don't wait for reply.
  if (data[ID_ADDR] == BROADCAST_ID) {
    return true;
  }

  // RECEIVE PACKET
  int num_bytes_received;
  result = RXPacket(data, BASE_PACKET_SIZE + num_params_receiving,
                    &num_bytes_received);
  if (!result) {
    // printf("Couldn't receive packet successfully.\n");
    return false;
  }
  return true;
}
//// CCRefreshClient ////
CCRefreshClient::CCRefreshClient()
{
	SetCategory(0);
	Enable(false);
	SetChecksum(0);
	SetLastUpdatedTime(0);
}
bool CCRefreshClient::Sync(unsigned long nChecksum)
{
	if (OnSync(nChecksum) == true) {
		SetChecksum(nChecksum);
		return true;
	} else {
		return false;
	}
}
예제 #5
0
void HPingHeader::FormatSend(TUint aId, TUint aSeqNum)
//
// Format an ICMP packet to send
//
	{
	
	TUint type;
	TUint code;
	TChecksum sum;

	// Configure version
	if(iIPVersion == KAfInet)
		{
		type = KIPv4PingTypeEchoRequest;
		code = KIPv4PingCodeEcho;
		}
	else
		{
		type = KIPv6PingTypeEchoRequest;
		code = KIPv6PingCodeEcho;
		}

	// Fill header
	SetType(static_cast<TUint8>(type));
	SetCode(static_cast<TUint8>(code));
	SetIdentifier(static_cast<TUint16>(aId));
	SetSequence(static_cast<TUint16>(aSeqNum));

	// Compute checksum
	SetChecksum(0);
	sum.Add(reinterpret_cast<TUint16*>(this), HeaderLength());
	SetChecksum(sum.Sum());

	// Fill buffer
	iData->Des().Copy((TUint8*)this, HeaderLength());
	}
예제 #6
0
파일: p_nxsector.cpp 프로젝트: basecq/thug
NxNgc::sObjectHeader* CNgcSector::LoadFromFile( NxNgc::sObjectHeader* p_data )
{
	Dbg_Assert( mp_geom );

	CNgcGeom *p_geom = static_cast<CNgcGeom*>( mp_geom );
	
	// Hook up vars.
	p_geom->m_num_mesh = p_data->m_num_meshes;
//  	p_geom->mp_scene->GetEngineScene()->mp_dl->mp_object_header = p_data;

	char * p_skin = (char *)&p_data[1];
	int nbytes = p_data->m_skin.num_bytes;
	p_data->m_skin.p_data = p_skin;
	NxNgc::sDLHeader* p_dl = (NxNgc::sDLHeader*)&p_skin[nbytes];

	m_flags = p_dl->m_flags;
	SetChecksum( p_dl->m_checksum );

	for( uint m = 0; m < p_geom->m_num_mesh; ++m )
	{
		NxNgc::sMesh*	p_mesh = new NxNgc::sMesh;

		p_geom->AddMesh( p_mesh );

		// Setup mesh flags.
		if ( *((uint32*)(&p_dl->mp_col_pool)) & ( 0x00000100 | 0x00000400 ) )
		{
			p_mesh->m_flags |= NxNgc::sMesh::MESH_FLAG_NO_SKATER_SHADOW;
		}
		p_dl->mp_col_pool = NULL;

		// Setup bottom y.
		p_mesh->m_bottom_y = *((float*)(&p_dl->mp_pos_pool));
		p_dl->mp_pos_pool = NULL;

		if ( p_dl->m_size )
		{
			// Setup the DL.
			p_mesh->mp_dl = p_dl;
			p_mesh->mp_dl->mp_object_header = p_data;
			p_mesh->m_bone_idx = p_mesh->mp_dl->mp_object_header->m_bone_index;

			// Fix up the bounding sphere for billboards.
			switch ( p_mesh->mp_dl->mp_object_header->m_billboard_type )
			{
				case 1:
				case 2:
					p_mesh->mp_dl->m_sphere[X] += p_mesh->mp_dl->mp_object_header->m_origin[X];
					p_mesh->mp_dl->m_sphere[Y] += p_mesh->mp_dl->mp_object_header->m_origin[Y];
					p_mesh->mp_dl->m_sphere[Z] += p_mesh->mp_dl->mp_object_header->m_origin[Z];
					break;
				default:
					break;
			}

			p_dl = (NxNgc::sDLHeader*)&(((char *)&p_dl[1])[p_dl->m_size]);

			// Find the material.
			NxNgc::sMaterialHeader * p_mat_list = p_geom->mp_scene->GetEngineScene()->mp_material_header;
			bool found = false;
			for ( unsigned int lp = 0; lp < p_geom->mp_scene->GetEngineScene()->mp_scene_data->m_num_materials; lp++ )
			{
				if ( p_mat_list->m_checksum == p_mesh->mp_dl->m_material.checksum )
				{
					// Found it!
					p_mesh->mp_dl->m_material.p_header = p_mat_list;

//					NxNgc::MaterialBuild( p_mesh, p_geom->mp_scene->GetEngineScene(), false, true ); 

					found = true;
					break;
				}
				++p_mat_list;
			}
			if ( !found )
			{
				Dbg_MsgAssert( 0, ( "Unable to find material checksum 0x%08x\n", p_mesh->mp_dl->m_material.checksum ));
				p_mesh->mp_dl->m_material.p_header = NULL;
			}
		}
	}

	return (NxNgc::sObjectHeader*)p_dl;
}
//// CCRefreshCategory ////
CCRefreshCategory::CCRefreshCategory(int nCategory)
{
	m_nCategory = nCategory;
	SetChecksum(0);
	SetLastUpdateTick(0);
}