MCPcopy Create free account
hub / github.com/TASEmulators/fceux / setHeaderData

Method setHeaderData

src/drivers/Qt/iNesHeaderEditor.cpp:890–1225  ·  view source on GitHub ↗

----------------------------------------------------------------------------

Source from the content-addressed store, hash-verified

888}
889//----------------------------------------------------------------------------
890void iNesHeaderEditor_t::setHeaderData(iNES_HEADER* header)
891{
892 int i;
893 // Temporary buffers
894 char buf[256];
895
896 bool ines20 = (header->ROM_type2 & 0xC) == 8;
897 bool unofficial = false;
898
899 ToggleINES20( ines20 );
900
901 iNes1Btn->setChecked( !ines20 );
902 iNes2Btn->setChecked( ines20 );
903
904 // Mapper#
905 int mapper = header->ROM_type >> 4 | header->ROM_type2 & 0xF0;
906 if (ines20)
907 {
908 mapper |= (header->ROM_type3 & 0x0F) << 8;
909 }
910 for (i=0; i<mapperComboBox->count(); i++)
911 {
912 if ( mapperComboBox->itemData(i).toInt() > mapper )
913 {
914 sprintf( buf, "%i Unknown/unsupported", i);
915 mapperComboBox->insertItem( i, tr(buf), mapper);
916 mapperComboBox->setCurrentIndex(i);
917 break;
918 }
919 else if ( mapperComboBox->itemData(i).toInt() == mapper )
920 {
921 mapperComboBox->setCurrentIndex(i);
922 break;
923 }
924 }
925
926 // Sub Mapper
927 sprintf(buf, "%d", ines20 ? header->ROM_type3 >> 4 : 0);
928
929 mapperSubEdit->setText( tr(buf) );
930
931 // PRG ROM
932 int prg_rom = header->ROM_size;
933 if (ines20)
934 {
935 if ((header->Upper_ROM_VROM_size & 0xF) == 0xF)
936 prg_rom = pow(2, header->ROM_size >> 2) * ((header->ROM_size & 3) * 2 + 1);
937 else {
938 prg_rom |= (header->Upper_ROM_VROM_size & 0xF) << 8;
939 prg_rom *= 1024 * 16;
940 }
941 }
942 else
943 {
944 prg_rom *= 1024 * 16;
945 }
946
947 for (i=0; i<prgRomBox->count(); i++)

Callers

nothing calls this directly

Calls 5

ToggleINES20Function · 0.85
setTextMethod · 0.80
hideMethod · 0.80
showMethod · 0.80
trFunction · 0.50

Tested by

no test coverage detected