/* This is just a library of functions I wrote to make my life * as a gamecube programmer easier. It sets up GX, Video, * the console, and the BBA at current. It sets system state * flags, provides default FIFO and Framebuffers, and generally * lets you focus more on your demo and less on getting the * gamecube running. Thanks to Shagkur for writing libOGC. * Things you should know if you compile with gcc and not g++ - This stuff uses alot of default arguments, which technically aren't a part of C99, so GCC *shouldn't* let you use them when compiling with GCC (my copy won't). So I have included a few workarounds if you compile with GCC. If using GCC and you don't want to supply all the arguments to GXSetup and similar functions that have default args, you can pass 0 to most integer values and NULL to most others. The functions will work out the rest themselves. NOTE: This is how this *SHOULD* work. The console and video stuff works just fine, but for some reason the GXSetup() function craps out when compiled in C and not C++ (tho I have no idea why). If someone knows why, corrections are welcome. * Revision history: Aug 30, 2005: Renamed the library to GUL (Gamecube Utility Lib). Separated it into code/headers properly. Jan 30, 2005: Added autodetect code to VideoSetup() and renamed the functions to all have a common 'gul' preface, and left behind function pointers for backwards compatibility. Added a couple functions Copyright (C) 2005 Andrew Kesterson andrew@aklabs.net This program is free software; you can redistribute it and/or modify it under the terms of the AKLabs Standard License, included with this distribution. */ #ifndef _GUL_H_ #define _GUL_H_ #include #include #include #include #include #include #include #include #define SYSSTATE_GX_INIT 1 #define SYSSTATE_VIDEO_INIT 2 #define SYSSTATE_CONSOLE_INIT 3 #define SYSSTATE_NET_INIT 4 #define FIFO_SIZE (256*1024) // ------------- External function defs --------------- extern Mtx *gulDefaultViewMatrix(); extern Mtx *gulDefaultProjectionMatrix(); extern void *gulUserFrameBuffer(); extern GXFifoObj *gulDefaultFifo(); extern GXRModeObj *gulGXRMode(); /* copies the userland FB to the XFB */ extern void gulCopyXFB(u32 count); /* thisIP is the gamecube's IP, the gateway is the gateway to the world, and the netmask is of course the netmask. To get DHCP, just use gulSetupNetwork(true, NULL, NULL, NULL). */ extern u32 gulSetupNetwork(bool dhcp, char *thisIP, char *gateway, char *netmask); /* sets up video - call with -> VideoSetup(false, NULL, false) to setup xfb->efb copying on retrace or use VideoSetup(true, NULL, false) to setup direct XFB access (the XFB won't be cleared after each retrace) */ extern u32 gulVideoSetup(bool XFBdirect, VIRetraceCallback callback, bool blackout); /* setup the console */ extern void gulConsoleSetup(); /* sets up GX with a g_gxDefaultProjectionMatrix matrix * also sets up the vertex format for direct vertex data * (so you can just start throwing polys at it) */ extern void gulGXSetup(u8 cullMode, Vector *camVector, Vector *upVector, Vector *lookVector, f32 nearClip, f32 farClip); /* sets the framebuffer copy ready flag to true */ extern void gulGXCopyReady(); /* hits up the PSO reload vector * included so you don't ever have to worry again about * "have I got that reload vector set right?..." */ extern void gulReloadFromPSO(); /* checks for a given system init state */ extern bool gulWasInit(u32 subsys); #endif // _GUL_H