diff options
author | Treeki <treeki@gmail.com> | 2011-03-12 23:17:12 +0100 |
---|---|---|
committer | Treeki <treeki@gmail.com> | 2011-03-12 23:17:12 +0100 |
commit | 7d4e4c0b34a613dd3c0220475ae4e448197522c1 (patch) | |
tree | 4f5cee367de3fdef4f9a7c84af59ffe76a2bb1c3 /src/heapbar.cpp | |
download | kamek-7d4e4c0b34a613dd3c0220475ae4e448197522c1.tar.gz kamek-7d4e4c0b34a613dd3c0220475ae4e448197522c1.zip |
initial commit. now I can start playing with stuff!
Diffstat (limited to '')
-rw-r--r-- | src/heapbar.cpp | 147 |
1 files changed, 147 insertions, 0 deletions
diff --git a/src/heapbar.cpp b/src/heapbar.cpp new file mode 100644 index 0000000..3759b22 --- /dev/null +++ b/src/heapbar.cpp @@ -0,0 +1,147 @@ +#define GEKKO
+
+#include <common.h>
+#include "rvl/mtx.h"
+#include "rvl/GXEnum.h"
+#include "rvl/GXStruct.h"
+#include "rvl/GXTransform.h"
+#include "rvl/GXGeometry.h"
+#include "rvl/GXDispList.h"
+#include "rvl/GXLighting.h"
+#include "rvl/GXTev.h"
+#include "rvl/GXTexture.h"
+#include "rvl/GXCull.h"
+#include "rvl/GXPixel.h"
+#include "rvl/GXBump.h"
+//#include "rvl/GXVert.h"
+#include "rvl/vifuncs.h"
+
+extern u32 Global5758;
+
+#define GXPosition3f32(x,y,z) \
+ *((volatile float*)0xCC008000) = (x); \
+ *((volatile float*)0xCC008000) = (y); \
+ *((volatile float*)0xCC008000) = (z);
+
+#define GXColor1u32(x) \
+ *((volatile u32*)0xCC008000) = (x);
+
+
+extern "C" {
+
+
+void cppGXStart() {
+ Mtx44 ortho;
+
+ MTXOrtho(ortho, 0, 456, 0, 686, 0.0F, 1.0F);
+ GXSetProjection(ortho, GX_ORTHOGRAPHIC);
+
+ Mtx identity;
+ MTXIdentity(identity);
+
+ GXLoadPosMtxImm(identity, GX_PNMTX0);
+
+ GXSetNumTevStages(1);
+ GXSetTevOrder(GX_TEVSTAGE0, GX_TEXCOORD_NULL, GX_TEXMAP_NULL, GX_COLOR0A0);
+ GXSetTevOp(GX_TEVSTAGE0, GX_PASSCLR);
+ GXSetTevDirect(GX_TEVSTAGE0);
+
+ GXSetNumChans(1);
+ GXSetChanCtrl(GX_COLOR0A0, GX_DISABLE, GX_SRC_VTX, GX_SRC_VTX, GX_LIGHT_NULL, GX_DF_NONE, GX_AF_NONE);
+
+ GXClearVtxDesc();
+ GXSetVtxDesc(GX_VA_POS, GX_DIRECT);
+ GXSetVtxDesc(GX_VA_CLR0, GX_DIRECT);
+ GXSetVtxAttrFmt(GX_VTXFMT0, GX_VA_POS, GX_POS_XYZ, GX_F32, 0);
+ GXSetVtxAttrFmt(GX_VTXFMT0, GX_VA_CLR0, GX_CLR_RGBA, GX_RGBX8, 0);
+
+ GXSetZMode(GX_TRUE, GX_ALWAYS, GX_TRUE);
+}
+
+void cppGXEnd() {
+}
+
+
+
+float y_positions[] = {
+ -1,
+ 0.0,
+ 16.0
+};
+
+u32 colours[] = {
+ -1,
+ 0x0000ffff,
+ 0xff0000ff
+};
+
+u32 col_5758[] = {
+ 0x00ff00ff,
+ 0xffff00ff,
+ 0x00ffffff,
+ 0xf0ff0fff
+};
+
+void cppProcessHeap(u32 freeSize, u32 heapSize, int heapID, char *name) {
+ // get the info needed
+ float y_pos = y_positions[heapID];
+ u32 colour = colours[heapID];
+
+ // width: 686
+
+ //OSReport("%s => size %d, free %d\n", name, heapSize, freeSize);
+
+ float left = 0;
+ float right = ((heapSize - freeSize) * 686.0f) / heapSize;
+ float top = y_pos;
+ float bottom = y_pos+16;
+
+ GXBegin(GX_QUADS, GX_VTXFMT0, 4);
+
+ GXPosition3f32(left, top, 0.0);
+ GXColor1u32(colour);
+ GXPosition3f32(right, top, 0.0);
+ GXColor1u32(colour);
+ GXPosition3f32(right, bottom, 0.0);
+ GXColor1u32(colour);
+ GXPosition3f32(left, bottom, 0.0);
+ GXColor1u32(colour);
+
+ GXEnd();
+
+
+ GXBegin(GX_QUADS, GX_VTXFMT0, 16);
+
+ for (int i = 0; i < 4; i++) {
+ GXPosition3f32(16*i, 32, 0.0);
+ GXColor1u32(col_5758[i]);
+ GXPosition3f32(16*i+16, 32, 0.0);
+ GXColor1u32(col_5758[i]);
+ GXPosition3f32(16*i+16, 48, 0.0);
+ GXColor1u32(col_5758[i]);
+ GXPosition3f32(16*i, 48, 0.0);
+ GXColor1u32(col_5758[i]);
+ }
+
+ GXEnd();
+
+ for (int i = 0; i < 4; i++) {
+ if (Global5758 & (1 << i)) {
+ GXBegin(GX_QUADS, GX_VTXFMT0, 4);
+
+ GXPosition3f32(16*i, 48, 0.0);
+ GXColor1u32(0xffffffff);
+ GXPosition3f32(16*i+16, 48, 0.0);
+ GXColor1u32(0xffffffff);
+ GXPosition3f32(16*i+16, 56, 0.0);
+ GXColor1u32(0xffffffff);
+ GXPosition3f32(16*i, 56, 0.0);
+ GXColor1u32(0xffffffff);
+
+ GXEnd();
+ }
+ }
+}
+
+
+};
|