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) {
114 newBlockSize = size +
sizeof(
HeapNode);
117 if (smallestBlockFound) {
118 if (smallestBlockFound >= newBlockSize) {
120 pPrevHeapNode->
next = (
HeapNode*)((u8*)pPrevHeapNode + newBlockSize);
121 pPrevHeapNode->
length = size;
127 pPrevHeapNode->
entryID = HeapEntryID;
130 curHeapNode = pPrevHeapNode->
next;
131 curHeapNode->
next = nextHeapNode;
132 curHeapNode->
length = smallestBlockFound - newBlockSize;
136 pPrevHeapNode->
next = nextHeapNode;
137 pPrevHeapNode->
length = smallestBlockFound;
144 pPrevHeapNode->
entryID = HeapEntryID2;
146 return (u8*)pPrevHeapNode +
sizeof(
HeapNode);
148 debug_printf(
"warning: out of memory\n");
294 newSizeAligned =
ALIGN16(newSize);
301 nextNode = curHeapAlloc->
next;
302 newNodeLength = curHeapAlloc->
length;
306 nodeToUpdate = nextNode;
308 nextNode = nextNode->
next;
313 nodeToUpdate = curHeapAlloc;
314 if (newNodeLength < newSizeAligned) {
316 curHeapAlloc =
_heap_malloc(heapNodeList, newSizeAligned);
317 if (curHeapAlloc == NULL) {
324 memcpy(curHeapAlloc, addr, newSizeAligned);
330 if (newSizeAligned +
sizeof(
HeapNode) < newNodeLength) {
332 newFreeBlock = (
HeapNode*)((u8*)addr + newSizeAligned);
335 nodeToUpdate->
next = newFreeBlock;
336 nodeToUpdate->
length = newSizeAligned;
339 nodeToUpdate = newFreeBlock;
340 nodeToUpdate->
next = nextNode;
341 nodeToUpdate->
length = (newNodeLength - newSizeAligned) -
sizeof(
HeapNode);
345 nodeToUpdate->
next = nextNode;
346 nodeToUpdate->
length = newNodeLength;
432 *outX = (mtx[0][0] * inX) + (mtx[1][0] * inY) + (mtx[2][0] * inZ) + mtx[3][0];
433 *outY = (mtx[0][1] * inX) + (mtx[1][1] * inY) + (mtx[2][1] * inZ) + mtx[3][1];
434 *outZ = (mtx[0][2] * inX) + (mtx[1][2] * inY) + (mtx[2][2] * inZ) + mtx[3][2];
435 *outW = (mtx[0][3] * inX) + (mtx[1][3] * inY) + (mtx[2][3] * inZ) + mtx[3][3];
478 OSMesgQueue osMesgQueue;
480 osWritebackDCache(dramAddr, size);
481 osCreateMesgQueue(&osMesgQueue, &osMesg, 1);
483 osIoMesg.hdr.pri = 0;
484 osIoMesg.hdr.retQueue = &osMesgQueue;
485 osIoMesg.dramAddr = dramAddr;
486 osIoMesg.devAddr = devAddr;
487 osIoMesg.size = size;
489 osEPiStartDma(nuPiCartHandle, &osIoMesg, 1);
490 osRecvMesg(&osMesgQueue, &osMesg, 1);
734f32
update_lerp(s32 easing, f32 start, f32 end, s32 elapsed, s32 duration) {
744 return start + (end - start) * elapsed / duration;
746 return start +
SQ(elapsed) * (end - start) /
SQ(duration);
748 return start +
CUBE(elapsed) * (end - start) /
CUBE(duration);
750 return start +
QUART(elapsed) * (end - start) /
QUART(duration);
752 return end - ((end - start) *
cos_rad(((f32)elapsed / duration) *
PI_D * 4.0) * (duration - elapsed) *
753 (duration - elapsed)) /
SQ((f32)duration);
755 return end - ((end - start) *
cos_rad((((f32)
SQ(elapsed) / duration) *
PI_D * 4.0) / 15.0) * (duration - elapsed) *
756 (duration - elapsed)) /
SQ((f32)duration);
758 timeLeft = duration - elapsed;
759 return start + (end - start) - ((
SQ(timeLeft) * (end - start))) /
SQ(duration);
761 timeLeft = duration - elapsed;
762 return start + (end - start) - ((
CUBE(timeLeft) * (end - start))) /
CUBE(duration);
764 timeLeft = duration - elapsed;
765 return start + (end - start) - ((
QUART(timeLeft) * (end - start))) /
QUART(duration);
767 absMag =
cos_rad((((f32)
SQ(elapsed) / duration) *
PI_D * 4.0) / 40.0) * (duration - elapsed) *
768 (duration - elapsed) /
SQ((f32)duration);
772 return end - (end - start) * absMag;
774 return start + (end - start) * (1.0 -
cos_rad(((f32)elapsed *
PI_D) / (f32)duration)) * 0.5;
776 return start + (end - start) *
sin_rad(((f32)elapsed * (
PI_D / 2)) / (f32)duration);
778 return start + (end - start) * (1.0 -
cos_rad(((f32)elapsed * (
PI_D / 2)) / (f32)duration));
789 gDPSetRenderMode(
gMainGfxPos++, G_RM_OPA_SURF, G_RM_OPA_SURF2);
792 gDPSetRenderMode(
gMainGfxPos++, G_RM_XLU_SURF, G_RM_XLU_SURF2);
793 gDPSetCombineMode(
gMainGfxPos++, G_CC_PRIMITIVE, G_CC_PRIMITIVE);
797 gDPFillRectangle(
gMainGfxPos++, left, top, right, bottom);
800 gDPSetRenderMode(
gMainGfxPos++, G_RM_TEX_EDGE, G_RM_TEX_EDGE2);
801 gDPSetCombineMode(
gMainGfxPos++, G_CC_DECALRGBA, G_CC_DECALRGBA);