9 0.0f, 0.017452f, 0.034899f, 0.052336f, 0.069756f, 0.087156f, 0.104528f, 0.121869f, 0.139173f,
10 0.156434f, 0.173648f, 0.190809f, 0.207912f, 0.224951f, 0.241922f, 0.258819f, 0.275637f, 0.292372f, 0.309017f,
11 0.325568f, 0.34202f, 0.358368f, 0.374607f, 0.390731f, 0.406737f, 0.422618f, 0.438371f, 0.45399f, 0.469472f,
12 0.48481f, 0.5f, 0.515038f, 0.529919f, 0.544639f, 0.559193f, 0.573576f, 0.587785f, 0.601815f, 0.615661f, 0.62932f,
13 0.642788f, 0.656059f, 0.669131f, 0.681998f, 0.694658f, 0.707107f, 0.71934f, 0.731354f, 0.743145f, 0.75471f,
14 0.766044f, 0.777146f, 0.788011f, 0.798636f, 0.809017f, 0.819152f, 0.829038f, 0.838671f, 0.848048f, 0.857167f,
15 0.866025f, 0.87462f, 0.882948f, 0.891007f, 0.898794f, 0.906308f, 0.913545f, 0.920505f, 0.927184f, 0.93358f,
16 0.939693f, 0.945519f, 0.951057f, 0.956305f, 0.961262f, 0.965926f, 0.970296f, 0.97437f, 0.978148f, 0.981627f,
17 0.984808f, 0.987688f, 0.990268f, 0.992546f, 0.994522f, 0.996195f, 0.997564f, 0.99863f, 0.999391f, 0.999848f, 1.0f
31 1.0f, 1.273187f, 1.27303f, 1.272768f, 1.272402f, 1.271932f, 1.271358f, 1.270681f, 1.269902f, 1.269021f, 1.268038f,
32 1.266956f, 1.265774f, 1.264494f, 1.263116f, 1.261643f, 1.260075f, 1.258413f, 1.256659f, 1.254815f, 1.252881f,
33 1.250859f, 1.248752f, 1.24656f, 1.244285f, 1.241929f, 1.239494f, 1.236981f, 1.234393f, 1.231731f, 1.228997f,
34 1.226192f, 1.22332f, 1.220382f, 1.217379f, 1.214315f, 1.211189f, 1.208006f, 1.204766f, 1.201471f, 1.198124f,
35 1.194727f, 1.191281f, 1.187787f, 1.18425f, 1.180669f, 1.177047f, 1.173386f, 1.169687f, 1.165952f, 1.162184f,
36 1.158384f, 1.154553f, 1.150693f, 1.146806f, 1.142893f, 1.138957f, 1.134998f, 1.131018f, 1.127019f, 1.123002f,
37 1.118969f, 1.11492f, 1.110858f, 1.106783f, 1.102697f, 1.098601f, 1.094496f, 1.090384f, 1.086266f, 1.082142f,
38 1.078014f, 1.073883f, 1.06975f, 1.065616f, 1.061482f, 1.057348f, 1.053216f, 1.049087f, 1.04496f, 1.040838f,
39 1.036721f, 1.03261f, 1.028504f, 1.024406f, 1.020316f, 1.016234f, 1.01216f, 1.008097f, 1.004043f, 1.0f
44 gsSPTexture(-1, -1, 0, G_TX_RENDERTILE, G_OFF),
45 gsDPSetCycleType(G_CYC_1CYCLE),
46 gsDPSetTexturePersp(G_TP_NONE),
47 gsDPSetTextureDetail(G_TD_CLAMP),
48 gsDPSetTextureLOD(G_TL_TILE),
49 gsDPSetTextureFilter(G_TF_POINT),
50 gsDPSetTextureLUT(G_TT_NONE),
51 gsDPSetTextureConvert(G_TC_FILT),
84 u32 smallestBlockFound;
91 debug_printf(
"warning: attempt to malloc less than 16 bytes\n");
95 smallestBlockFound = 0;
99 for (curHeapNode = head; ; curHeapNode = curHeapNode->
next) {
101 curBlockLength = curHeapNode->
length;
102 if ((curBlockLength >= size) && (curBlockLength < smallestBlockFound || !smallestBlockFound)) {
103 pPrevHeapNode = curHeapNode;
104 smallestBlockFound = curBlockLength;
105 nextHeapNode = curHeapNode->
next;
108 if (!curHeapNode->
next) {
115 newBlockSize = size +
sizeof(
HeapNode);
118 if (smallestBlockFound) {
119 if (smallestBlockFound >= newBlockSize) {
121 pPrevHeapNode->
next = (
HeapNode*)((u8*)pPrevHeapNode + newBlockSize);
122 pPrevHeapNode->
length = size;
128 pPrevHeapNode->
entryID = HeapEntryID;
131 curHeapNode = pPrevHeapNode->
next;
132 curHeapNode->
next = nextHeapNode;
133 curHeapNode->
length = smallestBlockFound - newBlockSize;
137 pPrevHeapNode->
next = nextHeapNode;
138 pPrevHeapNode->
length = smallestBlockFound;
145 pPrevHeapNode->
entryID = HeapEntryID2;
147 return (u8*)pPrevHeapNode +
sizeof(
HeapNode);
149 debug_printf(
"warning: out of memory\n");
295 newSizeAligned =
ALIGN16(newSize);
302 nextNode = curHeapAlloc->
next;
303 newNodeLength = curHeapAlloc->
length;
307 nodeToUpdate = nextNode;
309 nextNode = nextNode->
next;
314 nodeToUpdate = curHeapAlloc;
315 if (newNodeLength < newSizeAligned) {
317 curHeapAlloc =
_heap_malloc(heapNodeList, newSizeAligned);
318 if (curHeapAlloc == NULL) {
325 memcpy(curHeapAlloc, addr, newSizeAligned);
331 if (newSizeAligned +
sizeof(
HeapNode) < newNodeLength) {
333 newFreeBlock = (
HeapNode*)((u8*)addr + newSizeAligned);
336 nodeToUpdate->
next = newFreeBlock;
337 nodeToUpdate->
length = newSizeAligned;
340 nodeToUpdate = newFreeBlock;
341 nodeToUpdate->
next = nextNode;
342 nodeToUpdate->
length = (newNodeLength - newSizeAligned) -
sizeof(
HeapNode);
346 nodeToUpdate->
next = nextNode;
347 nodeToUpdate->
length = newNodeLength;
433 *outX = (mtx[0][0] * inX) + (mtx[1][0] * inY) + (mtx[2][0] * inZ) + mtx[3][0];
434 *outY = (mtx[0][1] * inX) + (mtx[1][1] * inY) + (mtx[2][1] * inZ) + mtx[3][1];
435 *outZ = (mtx[0][2] * inX) + (mtx[1][2] * inY) + (mtx[2][2] * inZ) + mtx[3][2];
436 *outW = (mtx[0][3] * inX) + (mtx[1][3] * inY) + (mtx[2][3] * inZ) + mtx[3][3];
479 OSMesgQueue osMesgQueue;
481 osWritebackDCache(dramAddr, size);
482 osCreateMesgQueue(&osMesgQueue, &osMesg, 1);
484 osIoMesg.hdr.pri = 0;
485 osIoMesg.hdr.retQueue = &osMesgQueue;
486 osIoMesg.dramAddr = dramAddr;
487 osIoMesg.devAddr = devAddr;
488 osIoMesg.size = size;
490 osEPiStartDma(nuPiCartHandle, &osIoMesg, 1);
491 osRecvMesg(&osMesgQueue, &osMesg, 1);
735f32
update_lerp(s32 easing, f32 start, f32 end, s32 elapsed, s32 duration) {
745 return start + (end - start) * elapsed / duration;
747 return start +
SQ(elapsed) * (end - start) /
SQ(duration);
749 return start +
CUBE(elapsed) * (end - start) /
CUBE(duration);
751 return start +
QUART(elapsed) * (end - start) /
QUART(duration);
753 return end - ((end - start) *
cos_rad(((f32)elapsed / duration) *
PI_D * 4.0) * (duration - elapsed) *
754 (duration - elapsed)) /
SQ((f32)duration);
756 return end - ((end - start) *
cos_rad((((f32)
SQ(elapsed) / duration) *
PI_D * 4.0) / 15.0) * (duration - elapsed) *
757 (duration - elapsed)) /
SQ((f32)duration);
759 timeLeft = duration - elapsed;
760 return start + (end - start) - ((
SQ(timeLeft) * (end - start))) /
SQ(duration);
762 timeLeft = duration - elapsed;
763 return start + (end - start) - ((
CUBE(timeLeft) * (end - start))) /
CUBE(duration);
765 timeLeft = duration - elapsed;
766 return start + (end - start) - ((
QUART(timeLeft) * (end - start))) /
QUART(duration);
768 absMag =
cos_rad((((f32)
SQ(elapsed) / duration) *
PI_D * 4.0) / 40.0) * (duration - elapsed) *
769 (duration - elapsed) /
SQ((f32)duration);
773 return end - (end - start) * absMag;
775 return start + (end - start) * (1.0 -
cos_rad(((f32)elapsed *
PI_D) / (f32)duration)) * 0.5;
777 return start + (end - start) *
sin_rad(((f32)elapsed * (
PI_D / 2)) / (f32)duration);
779 return start + (end - start) * (1.0 -
cos_rad(((f32)elapsed * (
PI_D / 2)) / (f32)duration));
790 gDPSetRenderMode(
gMainGfxPos++, G_RM_OPA_SURF, G_RM_OPA_SURF2);
793 gDPSetRenderMode(
gMainGfxPos++, G_RM_XLU_SURF, G_RM_XLU_SURF2);
794 gDPSetCombineMode(
gMainGfxPos++, G_CC_PRIMITIVE, G_CC_PRIMITIVE);
798 gDPFillRectangle(
gMainGfxPos++, left, top, right, bottom);
801 gDPSetRenderMode(
gMainGfxPos++, G_RM_TEX_EDGE, G_RM_TEX_EDGE2);
802 gDPSetCombineMode(
gMainGfxPos++, G_CC_DECALRGBA, G_CC_DECALRGBA);