| 72 | } |
| 73 | |
| 74 | std::vector<IopMod> getIOPModules() |
| 75 | { |
| 76 | if (!VMManager::HasValidVM() || CurrentBiosInformation.iopModListAddr == 0) |
| 77 | return {}; |
| 78 | |
| 79 | u32 maddr = iopMemRead32(CurrentBiosInformation.iopModListAddr); |
| 80 | std::vector<IopMod> modlist; |
| 81 | |
| 82 | for (int i = 0; maddr != 0; i++) |
| 83 | { |
| 84 | if (maddr >= Ps2MemSize::ExposedIopRam) |
| 85 | { |
| 86 | // outside of memory |
| 87 | return {}; |
| 88 | } |
| 89 | |
| 90 | if (i > 1000) |
| 91 | return {}; |
| 92 | |
| 93 | IopMod& mod = modlist.emplace_back(); |
| 94 | |
| 95 | u32 nstr = iopMemRead32(maddr + 4); |
| 96 | if (nstr) |
| 97 | { |
| 98 | mod.name = iopMemReadString(iopMemRead32(maddr + 4)); |
| 99 | } |
| 100 | else |
| 101 | { |
| 102 | mod.name = "(NULL)"; |
| 103 | } |
| 104 | |
| 105 | mod.version = iopMemRead16(maddr + 8); |
| 106 | mod.entry = iopMemRead32(maddr + 0x10); |
| 107 | mod.gp = iopMemRead32(maddr + 0x14); |
| 108 | mod.text_addr = iopMemRead32(maddr + 0x18); |
| 109 | mod.text_size = iopMemRead32(maddr + 0x1c); |
| 110 | mod.data_size = iopMemRead32(maddr + 0x20); |
| 111 | mod.bss_size = iopMemRead32(maddr + 0x24); |
| 112 | |
| 113 | maddr = iopMemRead32(maddr); |
| 114 | } |
| 115 | |
| 116 | return modlist; |
| 117 | } |
no test coverage detected