| 27 | } |
| 28 | |
| 29 | std::vector<std::unique_ptr<BiosThread>> getIOPThreads() |
| 30 | { |
| 31 | if (!VMManager::HasValidVM() || CurrentBiosInformation.iopThreadListAddr == 0) |
| 32 | return {}; |
| 33 | |
| 34 | std::vector<std::unique_ptr<BiosThread>> threads; |
| 35 | |
| 36 | u32 item = iopMemRead32(CurrentBiosInformation.iopThreadListAddr); |
| 37 | |
| 38 | for (int i = 0; item != 0; i++) |
| 39 | { |
| 40 | if (i > 1000) |
| 41 | return {}; |
| 42 | |
| 43 | IOPInternalThread data{}; |
| 44 | |
| 45 | u16 tag = iopMemRead16(item + 0x8); |
| 46 | if (tag != 0x7f01) |
| 47 | { |
| 48 | // something went wrong |
| 49 | return {}; |
| 50 | } |
| 51 | |
| 52 | data.stacMem = iopMemRead32(item + 0x3c); |
| 53 | data.stackSize = iopMemRead32(item + 0x40); |
| 54 | data.status = iopMemRead8(item + 0xc); |
| 55 | data.tid = iopMemRead16(item + 0xa); |
| 56 | data.entrypoint = iopMemRead32(item + 0x38); |
| 57 | data.waitstate = iopMemRead16(item + 0x1c); |
| 58 | data.waitId = iopMemRead32(item + 0x20); |
| 59 | data.initPriority = iopMemRead16(item + 0xe); |
| 60 | |
| 61 | data.regCtx = iopMemRead32(item + 0x10); |
| 62 | |
| 63 | data.PC = iopMemRead32(data.regCtx + 0x8c); |
| 64 | |
| 65 | threads.emplace_back(std::make_unique<IOPThread>(data)); |
| 66 | |
| 67 | item = iopMemRead32(item + 0x24); |
| 68 | } |
| 69 | |
| 70 | |
| 71 | return threads; |
| 72 | } |
| 73 | |
| 74 | std::vector<IopMod> getIOPModules() |
| 75 | { |
no test coverage detected