示例#1
0
bool CSerializePrxToMap::StartPrx(const char* szFilename, const PspModule *mod, u32 iSMask)
{
	u32 i;
	u32 addr;

	PrintComment(m_fpOut, "Generated by prxtool");
	PrintComment(m_fpOut, "Make sure to \"Load From Address 0xA0\" to skip the ELF header");
	PrintComment(m_fpOut, "Make sure to load the module as plain binary, not as ELF");
	fprintf(m_fpOut, "# File: %s\n", szFilename);

	addr = mod->addr;

	PrintOffset(m_fpOut, addr);
	fprintf(m_fpOut, ".word\t_module_flags\n");
	fprintf(m_fpOut, ".byte\t_module_name\n");
	for(i=0; i < (sizeof(mod->name)-2); i++)
		fprintf(m_fpOut, ".byte\n");	
	fprintf(m_fpOut, ".word\t_module_gp\n");
	fprintf(m_fpOut, ".word\t_module_exports\n");
	fprintf(m_fpOut, ".word\t_module_exp_end\n");
	fprintf(m_fpOut, ".word\t_module_imports\n");
	fprintf(m_fpOut, ".word\t_module_imp_end\n");

	return true;
}
示例#2
0
// DateOffset --------------------------------------------------------------------------------------
std::ostream & operator<<(std::ostream & ost, DateOffset const & offset)
{
  if (offset.HasWDayOffset())
  {
    ost << (offset.IsWDayOffsetPositive() ? '+' : '-')
        << offset.GetWDayOffset();
  }
  PrintOffset(ost, offset.GetOffset(), offset.HasWDayOffset());
  return ost;
}
示例#3
0
// Holiday -----------------------------------------------------------------------------------------
std::ostream & operator<<(std::ostream & ost, Holiday const & holiday)
{
  if (holiday.IsPlural())
  {
    ost << "PH";
  }
  else
  {
    ost << "SH";
    PrintOffset(ost, holiday.GetOffset(), true);
  }
  return ost;
}
示例#4
0
bool CSerializePrxToMap::SerializeExport(int num, const PspLibExport *exp)
{
	char str_export[128];
	int iLoop;
	u32 addr;
	snprintf(str_export, sizeof(str_export), "export_%d", num);

	addr = exp->addr;

	if(exp->stub.name != 0)
	{
		PrintOffset(m_fpOut, addr);
		fprintf(m_fpOut, ".word\t%s\t; %s\n", exp->name, BuildName(str_export, "name"));
	}
	else
	{
		PrintOffset(m_fpOut, addr);
		fprintf(m_fpOut, ".word\t%s\t; %s\n", str_export, BuildName(str_export, "name"));
	}
	
	fprintf(m_fpOut, ".word\t%s\n", BuildName(str_export, "flags"));
	fprintf(m_fpOut, ".word\t%s\n", BuildName(str_export, "counts"));
	fprintf(m_fpOut, ".word\t%s\n", BuildName(str_export, "exports"));
	
	for(iLoop = 0; iLoop < exp->f_count; iLoop++)
	{
		PrintOffset(m_fpOut, exp->funcs[iLoop].nid_addr);
		fprintf(m_fpOut, ".word\t%s\t; NID %08x\n", BuildName(str_export, exp->funcs[iLoop].name), exp->funcs[iLoop].nid);

		PrintOffset(m_fpOut, exp->funcs[iLoop].nid_addr + ((exp->v_count + exp->f_count) * 4));
		fprintf(m_fpOut, ".word\n");
		
		PrintOffset(m_fpOut, exp->funcs[iLoop].addr);		
		fprintf(m_fpOut, ".code\t%s\n", exp->funcs[iLoop].name);
	}

	for(iLoop = 0; iLoop < exp->v_count; iLoop++)
	{
		PrintOffset(m_fpOut, exp->funcs[iLoop].nid_addr);
		fprintf(m_fpOut, ".word\t%s\t; NID %08x\n", BuildName(str_export, exp->vars[iLoop].name), exp->vars[iLoop].nid);

		PrintOffset(m_fpOut, exp->vars[iLoop].nid_addr + ((exp->v_count + exp->f_count) * 4));
		fprintf(m_fpOut, ".word\t%s\n", exp->vars[iLoop].name);
	}

	return true;
}
示例#5
0
std::ostream & operator<<(std::ostream & ost, WeekdayRange const & range)
{
  ost << range.GetStart();
  if (range.HasEnd())
  {
    ost << '-' << range.GetEnd();
  }
  else
  {
    if (range.HasNth())
    {
      ost << '[';
      PrintVector(ost, range.GetNths(), ",");
      ost << ']';
    }
    PrintOffset(ost, range.GetOffset(), true);
  }
  return ost;
}
示例#6
0
bool CSerializePrxToMap::SerializeSect(int num, ElfSection &sect)
{
	u32 shFlags;
	u32 shType;
	u32 shAddr;
	u32 shSize;
	const char *pName;

	shFlags = sect.iFlags;
	shType = sect.iType;
	shAddr = sect.iAddr;
	shSize = sect.iSize;
	pName = sect.szName;

	/* Check if the section is loadable */
	if((shFlags & SHF_ALLOC) && ((shType == SHT_PROGBITS) || (shType == SHT_NOBITS)))
	{
		PrintOffset(m_fpOut, shAddr);
		fprintf(m_fpOut, ".word\t%s\t;", pName);

		if(shFlags & SHF_EXECINSTR)
		{
			fprintf(m_fpOut, " SEG_CODE");
		}
		else
		{
			if(shType == SHT_NOBITS)
			{
				fprintf(m_fpOut, " SEG_BSS");
			}
			else
			{
				fprintf(m_fpOut, " SEG_DATA");
			}
		}
		
		fprintf(m_fpOut, " 0x%08x - 0x%08x\n", shAddr, shAddr + shSize);
	}

	return true;
}