| 67 | : songTextOffset(0) {} |
| 68 | |
| 69 | void Video::Nsf::Load(const Nes::Nsf emulator) |
| 70 | { |
| 71 | struct Info |
| 72 | { |
| 73 | static cstring GoodName(cstring text) |
| 74 | { |
| 75 | if |
| 76 | ( |
| 77 | text && *text && |
| 78 | std::strcmp( text, "<?>" ) && |
| 79 | std::strcmp( text, "< ? >" ) && |
| 80 | std::strcmp( text, "?" ) |
| 81 | ) |
| 82 | return text; |
| 83 | |
| 84 | return NULL; |
| 85 | } |
| 86 | |
| 87 | static cstring GetMode(Nes::Nsf::TuneMode mode) |
| 88 | { |
| 89 | return |
| 90 | ( |
| 91 | mode == Nes::Nsf::TUNE_MODE_PAL ? " (PAL)" : |
| 92 | mode == Nes::Nsf::TUNE_MODE_NTSC ? " (NTSC)" : |
| 93 | " (NTSC/PAL)" |
| 94 | ); |
| 95 | } |
| 96 | }; |
| 97 | |
| 98 | text.Clear(); |
| 99 | |
| 100 | if (cstring name = Info::GoodName( emulator.GetName() )) |
| 101 | text.Import( name ); |
| 102 | else |
| 103 | text = "noname"; |
| 104 | |
| 105 | text << Info::GetMode( emulator.GetMode() ); |
| 106 | |
| 107 | cstring const artist = Info::GoodName( emulator.GetArtist() ); |
| 108 | cstring const copyright = Info::GoodName( emulator.GetCopyright() ); |
| 109 | |
| 110 | if (artist) |
| 111 | (text << "\r\n").Import( artist ); |
| 112 | |
| 113 | if (copyright) |
| 114 | (text << "\r\n").Import( copyright ); |
| 115 | |
| 116 | if (const uint chips = emulator.GetChips()) |
| 117 | { |
| 118 | text << (copyright || artist ? ", " : "\r\n"); |
| 119 | |
| 120 | if ( chips & Nes::Nsf::CHIP_MMC5 ) text << "MMC5 "; |
| 121 | if ( chips & Nes::Nsf::CHIP_FDS ) text << "FDS "; |
| 122 | if ( chips & Nes::Nsf::CHIP_VRC6 ) text << "VRC6 "; |
| 123 | if ( chips & Nes::Nsf::CHIP_VRC7 ) text << "VRC7 "; |
| 124 | if ( chips & Nes::Nsf::CHIP_N163 ) text << "N163 "; |
| 125 | if ( chips & Nes::Nsf::CHIP_S5B ) text << "Sunsoft5B "; |
| 126 |
no test coverage detected