| 73 | } |
| 74 | |
| 75 | st_PACKER_READ_DATA* PKR_ReadInit(void* userdata, char* pkgfile, U32 opts, S32* cltver, |
| 76 | st_PACKER_ASSETTYPE* typelist) |
| 77 | { |
| 78 | // I'm pretty sure this is just a pointer to an array on the heap |
| 79 | // But it needs to be an array of pointers to generate correct code ??? |
| 80 | char* tocbuf_RAW[1]; |
| 81 | tocbuf_RAW[0] = NULL; |
| 82 | st_PACKER_READ_DATA* pr = NULL; |
| 83 | S32 uselock = -1; |
| 84 | |
| 85 | PKR_alloc_chkidx(); |
| 86 | char* tocbuf_aligned = (char*)PKR_getmem('PTOC', 0x8000, 'PTOC', 0x40, 1, tocbuf_RAW); |
| 87 | |
| 88 | for (S32 i = 0; i < 16; i++) |
| 89 | { |
| 90 | if (!(g_loadlock & 1 << i)) |
| 91 | { |
| 92 | g_loadlock |= 1 << i; |
| 93 | pr = &g_readdatainst[i]; |
| 94 | uselock = i; |
| 95 | break; |
| 96 | } |
| 97 | } |
| 98 | |
| 99 | if (pr != NULL) |
| 100 | { |
| 101 | memset(pr, 0, sizeof(st_PACKER_READ_DATA)); |
| 102 | pr->lockid = uselock; |
| 103 | pr->userdata = userdata; |
| 104 | pr->opts = opts; |
| 105 | pr->types = typelist; |
| 106 | pr->cltver = -1; |
| 107 | strncpy(pr->packfile, pkgfile, 0x80); |
| 108 | |
| 109 | if (tocbuf_aligned == NULL) |
| 110 | { |
| 111 | pr->pkg = g_hiprf->create(pkgfile, NULL, 0); |
| 112 | } |
| 113 | else |
| 114 | { |
| 115 | pr->pkg = g_hiprf->create(pkgfile, tocbuf_aligned, 0x8000); |
| 116 | } |
| 117 | |
| 118 | if (pr->pkg != NULL) |
| 119 | { |
| 120 | pr->base_sector = g_hiprf->basesector(pr->pkg); |
| 121 | PKR_parse_TOC(pr->pkg, pr); |
| 122 | *cltver = pr->cltver; |
| 123 | g_hiprf->setBypass(pr->pkg, 1, 1); |
| 124 | } |
| 125 | else |
| 126 | { |
| 127 | PKR_ReadDone(pr); |
| 128 | pr = NULL; |
| 129 | *cltver = -1; |
| 130 | } |
| 131 | } |
| 132 | else |
nothing calls this directly
no test coverage detected