<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/">
<channel>
<title>Wiibrew Forums - Coding</title>
<description>General Wii programming questions go here</description><link>http://forum.wiibrew.org/list.php?11</link><lastBuildDate>Sun, 10 May 2026 23:21:33 +0200</lastBuildDate>
<generator>Phorum 5.2.23</generator>
<item>
<guid>http://forum.wiibrew.org/read.php?11,75126,75126#msg-75126</guid>
<title>Video Player Library? (3 replies)</title><link>http://forum.wiibrew.org/read.php?11,75126,75126#msg-75126</link><description><![CDATA[ I literally just want to make a simple wii program that can play an mp4 or some sort of video container, is there any library that can achieve this?]]></description>
<dc:creator>Nuber</dc:creator>
<category>Coding</category><pubDate>Tue, 21 Jun 2016 10:21:02 +0200</pubDate></item>
<item>
<guid>http://forum.wiibrew.org/read.php?11,75056,75056#msg-75056</guid>
<title>[SOLVED] Text not showing... (2 replies)</title><link>http://forum.wiibrew.org/read.php?11,75056,75056#msg-75056</link><description><![CDATA[ Hi!<br />I have trouble running the devkitPro template on my Wii...<br />The text is not showing, but the home button exit function works.<br />Can you help me?<br />[[url=https://youtu.be/SGYS__vL4CI]video[/url]]<br />Thanks,<br /><b>hugofest<u>A</u></b><br />P.S.: Sorry for spamming this topic.]]></description>
<dc:creator>hugofestA</dc:creator>
<category>Coding</category><pubDate>Sat, 06 Feb 2016 12:04:51 +0100</pubDate></item>
<item>
<guid>http://forum.wiibrew.org/read.php?11,75047,75047#msg-75047</guid>
<title>Can faulty .dol brick your Wii? (4 replies)</title><link>http://forum.wiibrew.org/read.php?11,75047,75047#msg-75047</link><description><![CDATA[ Hi!<br />I&#039;m afraid of bricking because if I run <a href="http://puu.sh/mUepv/184171dd02.dol" rel="nofollow">my .dol "app"</a> in an emulator it won&#039;t do anything.<br />Can this brick my Wii?<br />Thanks,<br /><b>hugofest<u>A</u></b>]]></description>
<dc:creator>hugofestA</dc:creator>
<category>Coding</category><pubDate>Thu, 04 Feb 2016 10:12:51 +0100</pubDate></item>
<item>
<guid>http://forum.wiibrew.org/read.php?11,75039,75039#msg-75039</guid>
<title>[SOLVED]Why it&#039;s not starting? (7 replies)</title><link>http://forum.wiibrew.org/read.php?11,75039,75039#msg-75039</link><description><![CDATA[ Hi! hugofest<b>A</b> here.<br />I got problems with running wii stuff with the gcube emulator comes with devkitPro.<br />I don&#039;t know why, but gcube launches, and it uses a lot of cpu, but nothing shows. Why? I&#039;m using the example code of devkitPro.<br />Thanks,<br /><b>hugofest<u>A</u></b>]]></description>
<dc:creator>hugofestA</dc:creator>
<category>Coding</category><pubDate>Wed, 03 Feb 2016 18:10:10 +0100</pubDate></item>
<item>
<guid>http://forum.wiibrew.org/read.php?11,75025,75025#msg-75025</guid>
<title>HELP: homebrew work on dolphin emu but not on real wii (6 replies)</title><link>http://forum.wiibrew.org/read.php?11,75025,75025#msg-75025</link><description><![CDATA[ Hi,<br />I&#039;m working (again) on wiimame.<br />Last useful meme version for this is 0.136 (mame changed too much after this version).<br />Well: .dol is generated, works ok on doplhin (with SD emulation) but on real wii I obtain only a black screen.<br /><br />I make the .dol with last version of compiler and library from devkitPro.org.<br /><br />No error, no crash, simply only black screen (forever).<br /><br />Someone would try to compile and run (and help me to debug :-) ) this version?<br /><br /><a href="https://onedrive.live.com/redir?resid=2F804BB8B7BD81EE!164&authkey=!AI4qRPlGk-bLXPs&ithint=file%2c7z" rel="nofollow">Full archive</a><br /><br />Run the file runme for make all (5) customized wiimame.]]></description>
<dc:creator>nebiun</dc:creator>
<category>Coding</category><pubDate>Wed, 16 Mar 2016 22:00:42 +0100</pubDate></item>
<item>
<guid>http://forum.wiibrew.org/read.php?11,75010,75010#msg-75010</guid>
<title>Center text on screen? (1 reply)</title><link>http://forum.wiibrew.org/read.php?11,75010,75010#msg-75010</link><description><![CDATA[ I&#039;m working on my first app, and would like to know how to center the text output.<br /><br />(I can&#039;t discuss the app itself here as I&#039;m unsure if it&#039;s a bannable topic.)]]></description>
<dc:creator>NovaPikmin</dc:creator>
<category>Coding</category><pubDate>Tue, 05 Jan 2016 02:07:10 +0100</pubDate></item>
<item>
<guid>http://forum.wiibrew.org/read.php?11,74990,74990#msg-74990</guid>
<title>net_socket() fails if left idle for 1 minute (3 replies)</title><link>http://forum.wiibrew.org/read.php?11,74990,74990#msg-74990</link><description><![CDATA[ I can connect and load a webpage fine (for my leaderboards) but if I stop making connections for more than a minute and then try again I get a -126 result from s32 socket = net_socket(AF_INET, SOCK_STREAM, IPPROTO_IP);<br /><br />I am not sure if this only happens to me on my router or if that is how the wii networking operates. How do I keep it alive? I don&#039;t really need to be constantly loading the page but I&#039;d like it to always be available for submiting scores.]]></description>
<dc:creator>owen</dc:creator>
<category>Coding</category><pubDate>Sat, 07 Nov 2015 02:03:40 +0100</pubDate></item>
<item>
<guid>http://forum.wiibrew.org/read.php?11,74916,74916#msg-74916</guid>
<title>How do I read pixels from an External Framebuffer as RGB values? (3 replies)</title><link>http://forum.wiibrew.org/read.php?11,74916,74916#msg-74916</link><description><![CDATA[ I wanted to improve upon the gdl::SaveScreen() function of my MTek-GDL library where I wanted it to read pixels from an external framebuffer instead of the embedded framebuffer of the GX as it is much faster to read pixels from main RAM instead of peeking pixels from the GX and it allows me to take screenshots in anti-aliased mode as well.<br /><br />However, I&#039;ve read that the pixel format of the external framebuffer is YUV2 which is a pixel format that I&#039;m not exactly familiar with and I couldn&#039;t find a single piece of code as to how to read and convert a pixel from it as an RGB8 color value.<br /><br />Also, is it advisable to just have one XFB and have the GX copy pixels from its EFB into it right after a VSync? To me, I think it&#039;ll work well since the GX can copy pixels from its EFB to the XFB fast enough that there&#039;s no flicker or screen tearing issues I&#039;ve seen based on a prototype I made that demonstrates a single XFB and it saves a few hundred kilobytes worth of 1T-SRAM when having only one XFB.<br /><br />Any useful help will be greatly appreciated...]]></description>
<dc:creator>TheCodingBrony</dc:creator>
<category>Coding</category><pubDate>Tue, 15 Sep 2015 00:28:59 +0200</pubDate></item>
<item>
<guid>http://forum.wiibrew.org/read.php?11,74856,74856#msg-74856</guid>
<title>[SOLVED] How do I properly setup multiple TEV stages? (6 replies)</title><link>http://forum.wiibrew.org/read.php?11,74856,74856#msg-74856</link><description><![CDATA[ I&#039;m currently working on a test program that demonstrates environment mapping (such as chrome) and cel-shading through the use of Texture matrices and certain TexGen settings. I wanted to be able to render a texture mapped model with cel-shading through the use of the TEV to blend both textures together but I can&#039;t figure out how to do it properly at the moment.<br /><br />What I want to do is to have my cel-shading texture blend over the model&#039;s base texture through the use of multiple TEV stages but I can&#039;t figure out how to do it properly. TexGens work properly but not the TEV stages as I always get bunch of black and white pixels jumbled all over the geometry. Am I missing some necessary parameters?<br /><br />Here&#039;s some pseudo-code on how I setup the TEV stages before rendering the model:<br /><pre class="bbcode">
GX_LoadTexObj(BarbTex.Texture.TexObj(), GX_TEXMAP0);
GX_LoadTexObj(CelTex.Texture.TexObj(), GX_TEXMAP1);

GX_SetNumTexGens(2);
GX_SetTexCoordGen(GX_TEXCOORD0, GX_TG_MTX2x4, GX_TG_TEX0, GX_IDENTITY);
GX_SetTexCoordGen(GX_TEXCOORD1, GX_TG_SRTG, GX_TG_COLOR0, GX_IDENTITY);

GX_SetNumTevStages(2);
GX_SetTevOrder(GX_TEVSTAGE0, GX_TEXCOORD0, GX_TEXMAP0, GX_COLOR0A0);
GX_SetTevOrder(GX_TEVSTAGE1, GX_TEXCOORD1, GX_TEXMAP1, GX_COLOR0A0);

object.RenderModel();</pre><br />I can&#039;t really release the full source code as it uses MTek-GDL and is a tad bit cluttered up but I can release it if the full source is absolutely necessary for solving this problem.<br /><br />Any useful help will be gladly appreciated! And no, don&#039;t discourage me from finding a way on how to use TEV stages properly as I want to make Wii homebrew that would look pretty as ever in the future.]]></description>
<dc:creator>TheCodingBrony</dc:creator>
<category>Coding</category><pubDate>Thu, 13 Aug 2015 04:31:36 +0200</pubDate></item>
<item>
<guid>http://forum.wiibrew.org/read.php?11,74852,74852#msg-74852</guid>
<title>Playing XM S3M IT files (no replies)</title><link>http://forum.wiibrew.org/read.php?11,74852,74852#msg-74852</link><description><![CDATA[ Hello~<br /><br />I was struggling recently in the coding again and after some search found out that I can only play MOD files as it is.<br />Converting from IT or S3M to MOD is like converting human where by converting in this one we mean cutting his hands and legs off...<br />I would like to know if there is some fairly easy, or at least not too hard method to play those files.<br />For now I&#039;m using MLLib but since it&#039;s a bit outdated I&#039;m willing to join other libraries or move completely to something else if that will be necessary.<br />Nintendo DS could utilize mikmod and maxmod later fairly easy, I know Wii can play those files without breaking sweat as well.<br /><br />Thank you for advance and have a nice day~<br /><br />iSubaru]]></description>
<dc:creator>iSubaru</dc:creator>
<category>Coding</category><pubDate>Fri, 07 Aug 2015 16:33:57 +0200</pubDate></item>
<item>
<guid>http://forum.wiibrew.org/read.php?11,74835,74835#msg-74835</guid>
<title>[SOLVED] Need help with connecting to a TCP server on the internet (6 replies)</title><link>http://forum.wiibrew.org/read.php?11,74835,74835#msg-74835</link><description><![CDATA[ I&#039;m working on this TCP client test program that tries to connect to a host name (www.google.com) and sends a GET request when a connection to it has been successfully established. So far, I only got the IP address resolving working but I cannot seem to connect to the addresses of the host name no matter what I do with my code.<br /><br />Is it because libogc is too crap to connect to a TCP server as a client? I don&#039;t think so as I&#039;ve seen numerous homebrew programs capable of downloading files off of a web server.<br /><br /><br />Here&#039;s my TCP client test program (now working):<br /><pre class="bbcode">
// Re-add the &lt;&gt; symbols on the include because Phorum will clear its contents for some reason
#include stdio.h
#include stdlib.h
#include string.h
#include malloc.h
#include unistd.h
#include network.h
#include errno.h

#include gccore.h
#include fat.h


#define HOST_NAME   "www.wiibrew.org"
#define GET_ADDR    "/"


#define MAX_MSG_LEN     4096


// Stuff for video and framebuffer
GXRModeObj	*videoMode;	// Video mode registers
void		*xfb=NULL;	// External framebuffer


// Declaration of the video init routine
void initVideo();


// Structure for holding socket data
typedef struct {
    sockaddr_in socketAddr;
    int         socket;
    char        socketBuff[MAX_MSG_LEN];
} hostSocket;


// Connect function
hostSocket *Connect(const char *ipAddr, int port) {

    hostSocket *handle = (hostSocket*)malloc(sizeof(hostSocket));
    memset(handle, 0x00, sizeof(hostSocket));


    // Set appropriate values to the socket address
    handle-&gt;socketAddr.sin_family = AF_INET;
    handle-&gt;socketAddr.sin_port = htons(port);
    handle-&gt;socketAddr.sin_addr.s_addr = inet_addr(ipAddr);


    // Create a socket handle
    handle-&gt;socket = net_socket(AF_INET, SOCK_STREAM, IPPROTO_IP);

    if (handle-&gt;socket &lt; 0) {
        printf("Cannot create socket.\n");
        free(handle);
        return(NULL);
    }


    printf("Socket created... Connecting to address %s... ", ipAddr);


    // Establish connection
    if (net_connect(handle-&gt;socket, (struct sockaddr*)&handle-&gt;socketAddr, sizeof(sockaddr_in)) == -1) {

        printf("Connect failed.\n");
        net_close(handle-&gt;socket);
        free(handle);
        return(NULL);

    }


    return(handle);

}


// Main function
int main(int argc, char *argv[]) {

	// Initialize video for console display
	initVideo();

	// Initialize console
	console_init(xfb, 20, 20, videoMode-&gt;fbWidth, videoMode-&gt;xfbHeight, videoMode-&gt;fbWidth*2);


    // Initialize file system for dumping received data to a file for analysis
	fatInitDefault();


	// Print Hello World message
	printf("\nInitializing network... ");
	if (net_init()) {
        printf("Failed to initialize network.\n");
        exit(EXIT_FAILURE);
	}
	printf("Ok!\n");


    // Get IP addresses of domain and print out the results
    printf("Resolving IP addresses to domain %s... ", HOST_NAME);
    hostent *host = net_gethostbyname(HOST_NAME);
    if (!host) {
        printf("Could not resolve domain address.\n");
        exit(EXIT_FAILURE);
    }
    printf("Ok!\n");

    printf("Address list:\n");
    for(int i=0; host-&gt;h_addr_list<i> != NULL; i++) {
        printf(" %s\n", inet_ntoa(*((in_addr*)host-&gt;h_addr_list<i>)));
    }

    char *ipAddr = strdup(inet_ntoa(*((in_addr*)host-&gt;h_addr_list[0])));


    printf("Connecting to %s... ", ipAddr);
    hostSocket *socket = Connect(ipAddr, 80);
    if (!socket) {
        exit(EXIT_FAILURE);
    }
    printf("Ok!\n");

    free(ipAddr);


    // Send GET request
    printf("Sending GET request... ");

    sprintf(socket-&gt;socketBuff, "GET %s HTTP/1.1\r\nHost: %s\r\n\r\n", GET_ADDR, HOST_NAME);
    if (net_send(socket-&gt;socket, socket-&gt;socketBuff, strlen(socket-&gt;socketBuff), 0) &lt; 0) {

        printf("Could not send request.\n");
        net_close(socket-&gt;socket);
        exit(EXIT_FAILURE);

    }

    printf("Ok.\n");


    // Print out and dump received data into a file
    FILE *fp = fopen("/dump.bin", "w");
    printf("\nReceived data:\n");

    while(1) {

        int bytes = net_recv(socket-&gt;socket, socket-&gt;socketBuff, MAX_MSG_LEN, 0);

        // net_recv() will return 0 if the connection has been closed by the server
        if (bytes &lt;= 0)
            break;

        // Write to file
        if (fp != NULL)
            fwrite(socket-&gt;socketBuff, 1, bytes, fp);

        // Print the data
        socket-&gt;socketBuff[bytes-1] = 0x00;
        printf("%s", socket-&gt;socketBuff);

    }


    // Close socket and file
    net_close(socket-&gt;socket);
    fclose(fp);

    printf("\n\nReceive complete and socket is closed.\n");


	// Wait until reset is pressed
	while(SYS_ResetButtonDown() == false) {
		VIDEO_WaitVSync();
	}

	printf("Exiting...\n");

}

// Simple video init routine for displaying a text console
void initVideo() {

	// Initialize video subsystem
	VIDEO_Init();

	// Get preferred video mode according to the console&#039;s configuration
	videoMode = VIDEO_GetPreferredMode(NULL);

	// Create external framebuffer and clear it
	// (only one framebuffer since we&#039;re only going to display a text console)
	xfb = MEM_K0_TO_K1(SYS_AllocateFramebuffer(videoMode));
	VIDEO_ClearFrameBuffer(videoMode, xfb, 0x00000000);

	// Configure video system, set framebuffer and clear display mask
	VIDEO_Configure(videoMode);
	VIDEO_SetNextFramebuffer(xfb);
	VIDEO_SetBlack(FALSE);
	VIDEO_Flush();

}
</i></i></pre><br />And no, don&#039;t give me the &#039;Look for BSD Socket examples&#039; answer as I&#039;ve already looked through several of such examples and none of them worked for me... Unless the example works with libogc right off the bat that is.<br /><br />Any useful help will be greatly appreciated!]]></description>
<dc:creator>TheCodingBrony</dc:creator>
<category>Coding</category><pubDate>Thu, 30 Jul 2015 16:17:50 +0200</pubDate></item>
<item>
<guid>http://forum.wiibrew.org/read.php?11,74749,74749#msg-74749</guid>
<title>Playing mpeg 2/4 video on Wii (1 reply)</title><link>http://forum.wiibrew.org/read.php?11,74749,74749#msg-74749</link><description><![CDATA[ Hello,<br /><br />I looking for a library to play video on Linux. I found mPlayer&#039;s source code but i want just a simple code to decode mpeg2 or mpeg4 video.<br /><br />Can you help me ?<br /><br />Thank you !]]></description>
<dc:creator>Lovmy</dc:creator>
<category>Coding</category><pubDate>Mon, 27 Apr 2015 16:11:27 +0200</pubDate></item>
<item>
<guid>http://forum.wiibrew.org/read.php?11,74736,74736#msg-74736</guid>
<title>Box2D install script (no replies)</title><link>http://forum.wiibrew.org/read.php?11,74736,74736#msg-74736</link><description><![CDATA[ So the old version of Box2D on the wiki is <i>really</i> out of date, so I thought I&#039;d try building it from a newer source so that it&#039;d be compatible with <a href="http://box2d.org/manual.html" rel="nofollow">the manual</a>. You&#039;ll need to have CMake installed. Here&#039;s a build script; just copy and paste it into your terminal. Make sure you have $DEVKITPRO and $DEVKITPPC set. Good luck! :D<br /><pre class="bbcode">
git clone git://github.com/blackberry/box2d
cd Box2D/Build
cmake -DBOX2D_BUILD_EXAMPLES=OFF -DCMAKE_INSTALL_PREFIX=$DEVKITPRO/libogc \
  -DCMAKE_CXX_COMPILER=$DEVKITPPC/bin/powerpc-eabi-g++ \
  -DCMAKE_SYSTEM_NAME=Generic -DBOX2D_INSTALL=ON ..
make all install
cd $DEVKITPRO/libogc/lib
rm -rf Box2D
mv libBox2D.a wii</pre><br />In order to use it in your project, just add Box2D to your libraries in the Makefile and include the header wherever you end up using it.<br /><pre class="bbcode">
LIBS += -lBox2D</pre>
<pre class="bbcode">
#include &lt;Box2D/Box2D.h&gt;
</pre>]]></description>
<dc:creator>tweakdeveloper</dc:creator>
<category>Coding</category><pubDate>Tue, 07 Apr 2015 20:02:04 +0200</pubDate></item>
<item>
<guid>http://forum.wiibrew.org/read.php?11,74693,74693#msg-74693</guid>
<title>Help with writing to external framebuffer (4 replies)</title><link>http://forum.wiibrew.org/read.php?11,74693,74693#msg-74693</link><description><![CDATA[ Hi to all :)<br /><br />I have a question. I&#039;m new to Wii development and I want to understand a few low-level things. I&#039;m trying to display simple things (like lines) on screen by modifying the external framebuffer: I can write something like<br /><pre class="bbcode">
u32* tmp = xfb; //xfb is the external framebuffer
tmp[x+(640*y)/2] = 0x00FF0000; // a color</pre>
to paint the (x, y) point with my desired color. I&#039;ve noticed that xfb is only 320 points wide (xfb[319] is the last pixel in the first row, while xfb[320] is the first pixel in the second row), but upon closer inspection it seems that this way I&#039;m painting <i>two</i> adjacent pixels (I imagine that this is due to the fact that the screen is actually 640x480). Is there an explanation for this behavior? How can I paint a (true) single pixel?<br /><br />Pardon my noobness, it&#039;s the first time I venture outside of high-level programming :)]]></description>
<dc:creator>Neku89</dc:creator>
<category>Coding</category><pubDate>Fri, 13 Mar 2015 08:48:00 +0100</pubDate></item>
<item>
<guid>http://forum.wiibrew.org/read.php?11,74617,74617#msg-74617</guid>
<title>[Self-Solved] Mipmapping questions (5 replies)</title><link>http://forum.wiibrew.org/read.php?11,74617,74617#msg-74617</link><description><![CDATA[ What are the best options for gxtexconv when generating mipmapped textures and what additional texture parameters do I have to set to get mipmapping working on the Wii? I know I have to use GX_LIN_MIP_LIN and the textures must be a power of two but it didn&#039;t seem to work the last time I tried and I have no clue on how to do it properly.<br /><br />Also, what is the format of mipmapped textures exactly? Are the mipmaps simply appended onto the base texture from largest to smallest or do they have to be mixed together in some way and is there any detailed documentation with example C source of all the supported texture formats on the Wii/GC as I couldn&#039;t seem to find any from what I know so far.<br /><br />Any useful help will be greatly appreciated.]]></description>
<dc:creator>TheCodingBrony</dc:creator>
<category>Coding</category><pubDate>Thu, 15 Jan 2015 08:14:16 +0100</pubDate></item>
<item>
<guid>http://forum.wiibrew.org/read.php?11,74611,74611#msg-74611</guid>
<title>SDL Wii video mode (4 replies)</title><link>http://forum.wiibrew.org/read.php?11,74611,74611#msg-74611</link><description><![CDATA[ Making some tests and looking at SDL Wii code I found out the default bitdepth is 16 with RGB565 colour space (i.e the SDL surface obtained by SDL_SetVideoMode(width, height, 0, flags)).<br /><br />Surely this is neither the Wii hardware resolution nor the best resolution to use on the Wii.<br /><br />Wii uses YUY2 colour space where 8 bits are used for the luminance of one pixel, 8 bit for the luminance of the adjacent pixel and 16 bits for the 2 shared chrominance signals of the 2 pixels (total of 32 bits for 2 pixels). In this representation there are 2^24 colours even if 2 adjacent bits have the same chrominance signal (but different luminance). This format is used on television for historical reasons but also because the human eye is more sensible at the luminance that at the chrominance.<br /><br />[<a href="http://www.dbfinteractive.com/forum/index.php?topic=3660.0" rel="nofollow">www.dbfinteractive.com</a>]<br /><br />If we want to show a 24 bit RGB image on the screen through SDL Wii there is a big difference if we use 16 bit depth (the default) or 24 bits.<br /><br />If you use the default setting (16 bits) the colours number is reduced from 2^24 to 2^16 without any filter. This can cause a terrible posterization effect provided that we do not apply a filter to the image like this one:<br /><br />[<a href="http://registry.gimp.org/taxonomy/term/1595" rel="nofollow">registry.gimp.org</a>]<br /><br />Instead if we use 24 bit colour space this effect is not present and the image quality is much better.<br /><br />In both cases the SDL library loads the image in a texture which is passed to the GX rendering engine that makes the conversion into the YUY2 colour space and possibly the upscale, if a 320X240 resolution is used (this is what I understood from the Wii SDL code).<br /><br />The passage to YUY2 can cause some artefacts which are in any case less visible than the passage from RGB888 (24 bits) to RGB565 (16 bits)]]></description>
<dc:creator>oibaf</dc:creator>
<category>Coding</category><pubDate>Mon, 05 Jan 2015 12:25:41 +0100</pubDate></item>
<item>
<guid>http://forum.wiibrew.org/read.php?11,74581,74581#msg-74581</guid>
<title>Issue with displaying a textured quad (5 replies)</title><link>http://forum.wiibrew.org/read.php?11,74581,74581#msg-74581</link><description><![CDATA[ I&#039;m working on building my first Wii game and I&#039;m having a very, very confusing issue with texturing a quad. I&#039;m relatively certain that I figured out how to include the texture file itself and to get it to be compiled with the binary at build time, but at run-time, it&#039;s all screwed up (for lack of a better way to say it). Below are two screen shots; one of what *should* be appearing on screen and one of what I&#039;m seeing.<br /><br />Working: <a href="http://www.webetry.com/misc/WorkingTexture.png" rel="nofollow">http://www.webetry.com/misc/WorkingTexture.png</a><br />Broken: <a href="http://www.webetry.com/misc/BrokenTexture.png" rel="nofollow">http://www.webetry.com/misc/BrokenTexture.png</a><br /><br />The code that is being run at render time is as follows:<br /><br /><pre class="bbcode">
    // Before starting rendering
    guMtxIdentity(mGXmodelView2D);
    guMtxTransApply (mGXmodelView2D, mGXmodelView2D, 0.0F, 0.0F, -5.0F);
    GX_LoadPosMtxImm(mGXmodelView2D, GX_PNMTX0);


    // Begin Draw, set mode to Quads
    GX_Begin(GX_QUADS, GX_VTXFMT0, 4);
    
    // Top Left
    GX_Position2f32(quadCoords[0][0], quadCoords[0][1]);
    GX_TexCoord2f32(texCoords[0][0], texCoords[0][1]);

    // Top Right
    GX_Position2f32(quadCoords[1][0], quadCoords[1][1]);
    GX_TexCoord2f32(texCoords[1][0], texCoords[1][1]);
    
    // Bottom Right
    GX_Position2f32(quadCoords[2][0], quadCoords[2][1]);
    GX_TexCoord2f32(texCoords[2][0], texCoords[2][1]);
    
    // Bottom Left
    GX_Position2f32(quadCoords[3][0], quadCoords[3][1]);
    GX_TexCoord2f32(texCoords[3][0], texCoords[3][1]);
    
    // End Draw
    GX_End();


    // After rendering
    GX_DrawDone();
    
    GX_SetZMode(GX_TRUE, GX_LEQUAL, GX_TRUE);
    GX_SetBlendMode(GX_BM_BLEND, GX_BL_SRCALPHA, GX_BL_INVSRCALPHA, GX_LO_CLEAR);
    GX_SetAlphaUpdate(GX_TRUE);
    GX_SetColorUpdate(GX_TRUE);
    GX_CopyDisp(mFrameBuffers[mFrameBufferIndex], GX_TRUE);
    
    VIDEO_SetNextFramebuffer(mFrameBuffers[mFrameBufferIndex]);
    
    if(mFirstFrameBuffer)
    {
        VIDEO_SetBlack(FALSE);
        mFirstFrameBuffer = 0;
    }
    VIDEO_Flush();
    VIDEO_WaitVSync();
    mFrameBufferIndex ^= 1;</pre><br />The weird grayscale thing going on with the image makes me wonder if it&#039;s a format issue. In my .scf file, I have colfmt set to 6 for PNG. That is correct, right?<br /><br />Are there any quirks as far as image encoding, compression or color profiles that I need to be aware of when exporting graphical assets to use?]]></description>
<dc:creator>DaveB1980</dc:creator>
<category>Coding</category><pubDate>Wed, 24 Dec 2014 12:49:56 +0100</pubDate></item>
<item>
<guid>http://forum.wiibrew.org/read.php?11,74579,74579#msg-74579</guid>
<title>How would I do a basic Timer for regulating frame rate? (8 replies)</title><link>http://forum.wiibrew.org/read.php?11,74579,74579#msg-74579</link><description><![CDATA[ Hey all, first time poster and Wii Homebrew newbie here. Hopefully my first question isn&#039;t too stupid...<br /><br />Would anyone be able to provide some insight on how I could code a basic timer for regulating frame updates on the Wii? I&#039;ve tinkered with other libraries in the past on other platforms that had built-in/pre-made Timers I could use to get the number of "ticks" since the last iteration of my game loop. Is there something similar in DevKitPro, LibOGC or any of the other OOTB libraries in the toolchain I could utilize?<br /><br />Any help would be greatly appreciated!]]></description>
<dc:creator>DaveB1980</dc:creator>
<category>Coding</category><pubDate>Thu, 25 Dec 2014 03:39:20 +0100</pubDate></item>
<item>
<guid>http://forum.wiibrew.org/read.php?11,74547,74547#msg-74547</guid>
<title>[SOLVED] Need help with simple lighting on 3D models (7 replies)</title><link>http://forum.wiibrew.org/read.php?11,74547,74547#msg-74547</link><description><![CDATA[ I&#039;m working on a 3D model viewer example as part of my MTek-GDL library project which is working great so far... However, I&#039;m having trouble getting simple lighting to work and I couldn&#039;t even figure out how to incorporate normals into a display list properly without locking up the GP when the list gets called.<br /><br />The example uses my custom middleware libraries (mgdl-wii and plylib) which explains why I can&#039;t post a code listing here as the relevant parts are split between one of the modules... Even though they&#039;re pretty damn useful pieces of code, I don&#039;t recommend anyone to use my libraries yet since it is still under development.<br /><br />-- Download removed --<br /><br />Any useful help will be greatly appreciated! Just don&#039;t get offended by cutesy imagery and ponies (in high-poly 3D) which this example features...]]></description>
<dc:creator>TheCodingBrony</dc:creator>
<category>Coding</category><pubDate>Tue, 16 Dec 2014 15:34:05 +0100</pubDate></item>
<item>
<guid>http://forum.wiibrew.org/read.php?11,74539,74539#msg-74539</guid>
<title>Math question. Clarification on what some code actually is. (no replies)</title><link>http://forum.wiibrew.org/read.php?11,74539,74539#msg-74539</link><description><![CDATA[ Everyone I am so sorry for asking this I&#039;m sure it is a question that i should know already but I have been looking for the answer and confused myself to the point of not knowing if Im even asking the right questions.<br /><br />For a year or so I have been using a script to use my DJ Hero decks as MIDI controllers. My question is, in the expressions below, what exactly is Exp0, Exp5, I dont understand what that represents.<br /><br />or 0x3F or 0x10 it looks like its shortcode for something, I mean when followed by -31, to alter anything, should I be changing -31 or changing 0x3F?<br /><br />Example: var.LTT2 = that is the left turn table. I would like to increase the sensitivity of the device, to send more data, and therefor allowing me to fast forward or rewind using the deck as a jog wheel, faster than before, it was doing + a split second when it moves I want to instead + 4 seconds when it moves. Not those numbers exactly of course just attempting to ask the right question.<br /><br />I get that at the end of the code, if LTT2 = 0, its not moving, then assign it to control the MIDI controller 77. But the map range, -30,30,0,1, I&#039;m not understanding what those numbers are representing. So I cannot figure out which numbers to change to alter my device to either do more or less.<br /><br />If anyone could explain this to me, that would be awesome thank you so much. Or at least send me to a forum post where it is already explained I just don&#039;t know how to word the question to get the right answer from a search.<br /><br /><br /><pre class="bbcode">
var.SX2 = (wiimote2.Exp0 & 0x3F) - 31
var.SY2 = (wiimote2.Exp1 & 0x3F) - 31
var.BE2 = !(wiimote2.Exp5 & 0x10)
var.BM2 = !(wiimote2.Exp4 & 0x10)
var.BP2 = !(wiimote2.Exp4 & 0x04)
var.ED2 = ((wiimote2.Exp2 & 0x60) &gt;&gt; 2) + ((wiimote2.Exp3 & 0xE0) &gt;&gt; 5)
var.CS2 = ((wiimote2.Exp2 & 0x1E) &gt;&gt; 1) - 8
var.LTT2 = (wiimote2.Exp3 & 0x1F)
if (wiimote2.Exp4 & 0x01) var.LTT2 = var.LTT2 - 32

if not var.LTT2 == 0 then midi.Control77 = MapRange(var.LTT2,-30,30,0,1)
</pre>]]></description>
<dc:creator>gnunoob</dc:creator>
<category>Coding</category><pubDate>Fri, 05 Dec 2014 11:06:21 +0100</pubDate></item>
<item>
<guid>http://forum.wiibrew.org/read.php?11,74512,74512#msg-74512</guid>
<title>[Resolved]only render a certain sides of a QUAD (2 replies)</title><link>http://forum.wiibrew.org/read.php?11,74512,74512#msg-74512</link><description><![CDATA[ Hi, I was wondering if it is possible to only render certain sides of a QUAD(Cube/Block/Voxel using either/both GX(standalone) or/and GRRLIB<br />Lets say for example that I have this code:<br /><pre class="bbcode">
	GRRLIB_SetTexture(TextrueHere,0);
	GRRLIB_ObjectView(x,y,z, 0,0,0, 0.5,0.5,0.5);
	GX_Begin(GX_QUADS, GX_VTXFMT0, 24);
	
	/* Top */
	GX_Position3f32(-1.0f,1.0f,1.0f);
	GX_Color1u32(0xFFFFFFFF);
	GX_TexCoord2f32(0.0f,0.0f);
	GX_Position3f32(1.0f,1.0f,1.0f);
	GX_Color1u32(0xFFFFFFFF);
	GX_TexCoord2f32(1.0f,0.0f);
	GX_Position3f32(1.0f,-1.0f,1.0f);
	GX_Color1u32(0xFFFFFFFF);
	GX_TexCoord2f32(1.0f,1.0f);
	GX_Position3f32(-1.0f,-1.0f,1.0f);
	GX_Color1u32(0xFFFFFFFF);
	GX_TexCoord2f32(0.0f,1.0f);

	/* Bottom */
	GX_Position3f32(1.0f,1.0f,-1.0f);
	GX_Color1u32(0xFFFFFFFF);
	GX_TexCoord2f32(0.0f,0.0f);
	GX_Position3f32(-1.0f,1.0f,-1.0f);
	GX_Color1u32(0xFFFFFFFF);
	GX_TexCoord2f32(1.0f,0.0f);
	GX_Position3f32(-1.0f,-1.0f,-1.0f);
	GX_Color1u32(0xFFFFFFFF);
	GX_TexCoord2f32(1.0f,1.0f);
	GX_Position3f32(1.0f,-1.0f,-1.0f);
	GX_Color1u32(0xFFFFFFFF);
	GX_TexCoord2f32(0.0f,1.0f);

	/* Front */
	GX_Position3f32(1.0f,1.0f,1.0f);
	GX_Color1u32(0xFFFFFFFF);
	GX_TexCoord2f32(0.0f,0.0f);
	GX_Position3f32(1.0f,1.0f,-1.0f);
	GX_Color1u32(0xFFFFFFFF);
	GX_TexCoord2f32(1.0f,0.0f);
	GX_Position3f32(1.0f,-1.0f,-1.0f);
	GX_Color1u32(0xFFFFFFFF);
	GX_TexCoord2f32(1.0f,1.0f);
	GX_Position3f32(1.0f,-1.0f,1.0f);
	GX_Color1u32(0xFFFFFFFF);
	GX_TexCoord2f32(0.0f,1.0f);

	/* Back */
	GX_Position3f32(-1.0f,1.0f,-1.0f);
	GX_Color1u32(0xFFFFFFFF);
	GX_TexCoord2f32(0.0f,0.0f);
	GX_Position3f32(-1.0f,1.0f,1.0f);
	GX_Color1u32(0xFFFFFFFF);
	GX_TexCoord2f32(1.0f,0.0f);
	GX_Position3f32(-1.0f,-1.0f,1.0f);
	GX_Color1u32(0xFFFFFFFF);
	GX_TexCoord2f32(1.0f,1.0f);
	GX_Position3f32(-1.0f,-1.0f,-1.0f);
	GX_Color1u32(0xFFFFFFFF);
	GX_TexCoord2f32(0.0f,1.0f);

	/* Left */
	GX_Position3f32(-1.0f,1.0f,-1.0f); 
	GX_Color1u32(0xFFFFFFFF);
	GX_TexCoord2f32(0.0f,0.0f);
	GX_Position3f32(1.0f,1.0f,-1.0f);
	GX_Color1u32(0xFFFFFFFF);
	GX_TexCoord2f32(1.0f,0.0f);
	GX_Position3f32(1.0f,1.0f,1.0f);
	GX_Color1u32(0xFFFFFFFF);
	GX_TexCoord2f32(1.0f,1.0f);
	GX_Position3f32(-1.0f,1.0f,1.0f);
	GX_Color1u32(0xFFFFFFFF);
	GX_TexCoord2f32(0.0f,1.0f);

	/* Right */
	GX_Position3f32(1.0f,-1.0f,-1.0f);
	GX_Color1u32(0xFFFFFFFF);
	GX_TexCoord2f32(0.0f,0.0f);
	GX_Position3f32(-1.0f,-1.0f,-1.0f);
	GX_Color1u32(0xFFFFFFFF);
	GX_TexCoord2f32(1.0f,0.0f);
	GX_Position3f32(-1.0f,-1.0f,1.0f);
	GX_Color1u32(0xFFFFFFFF);
	GX_TexCoord2f32(1.0f,1.0f);
	GX_Position3f32(1.0f,-1.0f,1.0f);
	GX_Color1u32(0xFFFFFFFF);
	GX_TexCoord2f32(0.0f,1.0f);
	
	GX_End();</pre>
(don&#039;t know if the sides are right yet, kinda new to 3D (that counts for everything about anything: GS,GL,GX,DirectX etc) outside unity :P)<br /><br /><b>Approach 1</b><br />was to just remove the code for a side and lower the position count from 24 to 19 (24-5 = 19) which ofc not worked as its no longer a QUAD,<br /><br />any help would be lovely? Thanks :)]]></description>
<dc:creator>filfat</dc:creator>
<category>Coding</category><pubDate>Sat, 15 Nov 2014 16:19:07 +0100</pubDate></item>
<item>
<guid>http://forum.wiibrew.org/read.php?11,74500,74500#msg-74500</guid>
<title>Help with double GP FIFO buffers (4 replies)</title><link>http://forum.wiibrew.org/read.php?11,74500,74500#msg-74500</link><description><![CDATA[ I&#039;m working on a in-house graphics library as none of the existing libraries suit my needs and I want it to be highly optimized so I can get the most out of what the Wii can handle for my future projects.<br /><br />Currently, its stuck with the standard &#039;Immediate-mode&#039; FIFO protocol when sending commands to the GP and I believe that I could get some performance boost by having 2 FIFO buffers instead of 1 when pushing the GP to its peak as the CPU can continue to fill one buffer while the GP processes the other instead of having the CPU wait for the GP to finish.<br /><br />Basically, I wanted to send commands to the GP like this:<br />1. Allocate 2 FIFO buffers on init with FIFO[0] attached to the CPU and FIFO[1] attached to the GP.<br />2. Fill FIFO[0] with GP commands (while GP is idle or is processing FIFO[1]).<br />3. Wait for GP to finish processing commands in FIFO[1].<br />4. Switch framebuffers.<br />5. Attach FIFO[0] to GP and FIFO[1] to CPU.<br />6. Fill FIFO[1] with GP commands (while GP is processing FIFO[0]).<br />7. Wait for GP to finish processing commands in FIFO[0].<br />8. Switch framebuffers.<br />9. Attach FIFO[1] to GP and FIFO[0] to CPU.<br />10. Repeat step 2.<br /><br />According to the libogc docs, its possible to setup a multi-buffered GP FIFO protocol but I don&#039;t know where to start due to how vague and discrete the documentation is... Example code or any helpful advice would be greatly appreciated.]]></description>
<dc:creator>TheCodingBrony</dc:creator>
<category>Coding</category><pubDate>Thu, 30 Oct 2014 03:41:27 +0100</pubDate></item>
<item>
<guid>http://forum.wiibrew.org/read.php?11,74472,74472#msg-74472</guid>
<title>Detecting of pressing button on sprite (4 replies)</title><link>http://forum.wiibrew.org/read.php?11,74472,74472#msg-74472</link><description><![CDATA[ Hello<br /><br />I have been searching Regular Net as well as Under-Net for this info and couldn&#039;t find it, maybe because of Nintendo DS coding habbits I asked wrong phrase, anyway here is the thing I would like to achieve...<br />I would like to have in code something like this:<br />"If Wii Cursor is pointing at Sprite and A Button is pressed then [...]"<br />I load the sprites so far with GRRLIB_DrawTile for the purpose of having the tileset (frames).<br />I hope it&#039;s possible here as it was on DS :)<br /><br />Thank you in advance and have a nice day :)<br /><br />iSubaru]]></description>
<dc:creator>iSubaru</dc:creator>
<category>Coding</category><pubDate>Thu, 02 Oct 2014 01:52:32 +0200</pubDate></item>
<item>
<guid>http://forum.wiibrew.org/read.php?11,74456,74456#msg-74456</guid>
<title>Trying to do true 16:9 mode in homebrew (7 replies)</title><link>http://forum.wiibrew.org/read.php?11,74456,74456#msg-74456</link><description><![CDATA[ Hello<br /><br />I&#039;m trying to make a *very* simple homebrew (few buttons, a little math, really) but I have bumped into that little problem, I have 16:9 aka widescreen TV now so 4:3 background would end up either centered or stretched (dunno what&#039;s worse).<br />I got the idea that maybe there is a way to load widescreen background without stretching it so with proper "IF" which I have found already on the forums, it would automatically load proper background depending on the screen.<br /><br />The "IF" was delivered from this topic<br />[<a href="http://forum.wiibrew.org/read.php?11,74268" rel="nofollow">forum.wiibrew.org</a>]<br />and goes more or less like this<br /><pre class="bbcode">if (CONF_GetAspectRatio() == CONF_ASPECT_16_9) {
// do widescreen specific stuff
} else { // CONF_ASPECT_4_3 or error/unknown value
// do non-widescreen stuff
}</pre>
Exact attempt was like this:<br /><pre class="bbcode">if (CONF_GetAspectRatio() == CONF_ASPECT_16_9)
{
	// do widescreen specific stuff
	ML_DrawBackground(&boardBGw);
	ML_SetBackgroundSize(&boardBGw, 850, 480);
}
else // CONF_ASPECT_4_3 or error/unknown value
{
	// do non-widescreen stuff
	ML_DrawBackground(&boardBGs);
	ML_SetBackgroundSize(&boardBGs, 640, 480);
}</pre>
I have tried using MLLib because it was very simple and swift to use so far but I&#039;m willing to use any other libraries/frameworks/other-stuff for this, it doesn&#039;t have to be MLLib.<br /><br />The code I have tried was giving different results, either stretched and cut background or no background at all (the quoted version).<br /><br />What else to add...<br />I have a component cable plugged into Wii and TV (finally, I tought I will get crazy with composite all this years).<br />Wii is set up to EDTV/HDTV 480p or whatnot (third option at Screen Type) and of course 16:9 mode.<br /><br />If any other info is necessary I will try to provide it ASAP.<br /><br />Thank You in advance and have a nice day<br /><br />iSubaru<br /><br />EDIT #1<br />Fixed formatting in the code tags]]></description>
<dc:creator>iSubaru</dc:creator>
<category>Coding</category><pubDate>Wed, 24 Sep 2014 12:58:34 +0200</pubDate></item>
<item>
<guid>http://forum.wiibrew.org/read.php?11,74388,74388#msg-74388</guid>
<title>Any examples on how to stream mp3/ogg files? (3 replies)</title><link>http://forum.wiibrew.org/read.php?11,74388,74388#msg-74388</link><description><![CDATA[ I&#039;ve been searching all over the place trying to find an example on how to play mp3/ogg files without having to load such files entirely into memory (in other words, streaming) as I find that method kind of wasteful.<br /><br />There is this MP3Player_PlayFile() function in the mp3player library but I cannot find any examples or documentation on how to use it. Not sure if the same can be done with ogg files.]]></description>
<dc:creator>TheCodingBrony</dc:creator>
<category>Coding</category><pubDate>Thu, 19 Jun 2014 15:43:55 +0200</pubDate></item>
<item>
<guid>http://forum.wiibrew.org/read.php?11,74337,74337#msg-74337</guid>
<title>Textures and a few questions (5 replies)</title><link>http://forum.wiibrew.org/read.php?11,74337,74337#msg-74337</link><description><![CDATA[ I want to know how to manually upload raw textures into vram as I&#039;m planning to port a PlayStation homebrew game I made which has texture images embedded in its level files. I know I have to convert the texture data into an appropriate format using Metaphrasis but how do I upload the converted data into vram?<br /><br />Also, I don&#039;t know if it is possible to unload/delete textures on vram as I can&#039;t find a function in the libogc docs that does this and I also want to know the maximum texture resolution the Wii can handle which I guess is 1024x1024.<br /><br />I&#039;m also not sure what will happen if I set my texture vertex format as GX_U16 but I&#039;d like to know since calculating texture coordinates as floats can get very CPU intensive and that I want to address parts of the texture in pixel-perfect units.<br /><br />I also want to know the endianess of the Wii as I&#039;ve read that the PowerPC architecture is bi-endian but I don&#039;t have a clear idea of what type of endianess it is running on by default.<br /><br /><br />Any help will be greatly appreciated...<br />- TheCodingBrony]]></description>
<dc:creator>TheCodingBrony</dc:creator>
<category>Coding</category><pubDate>Fri, 09 May 2014 15:06:00 +0200</pubDate></item>
<item>
<guid>http://forum.wiibrew.org/read.php?11,74306,74306#msg-74306</guid>
<title>LWP_CreateThread fails to create 11th thread [RESOLVED] (4 replies)</title><link>http://forum.wiibrew.org/read.php?11,74306,74306#msg-74306</link><description><![CDATA[ I have been creating alot of threads lately with LWP_CreateThread() but after I create the 11th thread the function stops creating threads. It returns a failure value and I cannot seem to find a way to continue creating threads. I created the threads on demand but there is usually only one or 2 threads are running at any one a time. I always suspend threads after they are done and I reuse the thread pointers. What could the problem be?<br /><br />this is what I use to create the thread;<br /><pre class="bbcode">

	s32 result = LWP_CreateThread(&main_thread[current_thread], thread_func, NULL, 0, STACKSIZE, 66+current_thread);
      if (result == 0) return true;

	if(threading_debug) printf("thread failed to create.\n");
	return false;

</pre>]]></description>
<dc:creator>owen</dc:creator>
<category>Coding</category><pubDate>Wed, 16 Apr 2014 23:42:27 +0200</pubDate></item>
<item>
<guid>http://forum.wiibrew.org/read.php?11,74281,74281#msg-74281</guid>
<title>How can I draw textured and flat/gouraud shaded primitives in the same frame? (11 replies)</title><link>http://forum.wiibrew.org/read.php?11,74281,74281#msg-74281</link><description><![CDATA[ I&#039;m working on a tiny GX test program so I can learn more about how the GX functions work and I was able to figure out how to draw texture mapped primitives in a 2D plane. But I don&#039;t know how to &#039;unbind&#039; from a texture so I can draw plain flat/gouraud shaded quads on the same frame and none of the included samples demonstrate this.<br /><br />Here&#039;s the code of my test program:<br /><pre class="bbcode">
#include stdio.h
#include stdlib.h
#include string.h
#include malloc.h
#include math.h
#include gccore.h
#include wiiuse/wpad.h

// My test texture (any 128x256 texture should do)
#include "sampletex_tpl.h"
#include "sampletex.h"


#define DEFAULT_FIFO_SIZE	(256*1024)


GXRModeObj	*rmode		= NULL;
void		*gp_fifo	= NULL;
GXColor		ClearColor	= {0, 0, 0, 0xff};

Mtx			myView, myModel, myModelView;
Mtx44		myPersp;
void		*myFB[2]	= { NULL, NULL};
int			ActiveFB	= 0;


TPLFile		sampleTPL;
GXTexObj	texture;

// Function prototypes
int main();
void init();


int main() {
	
	
	// Initialize everything
	init();
	
	
	while(1) {
		
		WPAD_ScanPads();
		
		if (WPAD_ButtonsDown(0) & WPAD_BUTTON_HOME) exit(0);
		
		
		// Prepare for rendering
		GX_SetViewport(0, 0, rmode-&gt;fbWidth, rmode-&gt;efbHeight, 0, 1);
		
		
		// Set appropriate texturing modes
		GX_SetTevOp(GX_TEVSTAGE0, GX_MODULATE);
		GX_SetTevOrder(GX_TEVSTAGE0, GX_TEXCOORD0, GX_TEXMAP0, GX_COLOR0A0);
		
		
		// &#039;Bind&#039; to our texture
		GX_LoadTexObj(&texture, GX_TEXMAP0);
		
		
		
		// Set geometry stuff
		guMtxIdentity(myModelView);
		guMtxTransApply (myModelView, myModelView, 0.0F, 0.0F, 0.0F);
		GX_LoadPosMtxImm(myModelView, GX_PNMTX0);
		
		
		// Draw the texture
		GX_Begin(GX_QUADS, GX_VTXFMT0, 4);
			
			// Top-left
			GX_Position2f32(0, 0);
			GX_Color3f32(1.0f, 1.0f, 1.0f);
			GX_TexCoord2f32(0, 0);
			
			// Top-right
			GX_Position2f32(256, 0);
			GX_Color3f32(1.0f, 1.0f, 1.0f);
			GX_TexCoord2f32(1, 0);
			
			// Bottom-right
			GX_Position2f32(256, 512);
			GX_Color3f32(1.0f, 1.0f, 1.0f);
			GX_TexCoord2f32(1, 1);
			
			// Bottom-left
			GX_Position2f32(0, 512);
			GX_Color3f32(1.0f, 1.0f, 1.0f);
			GX_TexCoord2f32(0, 1);
			
		GX_End();
		
		
		/*
		// Draw a plain quad
		GX_Begin(GX_QUADS, GX_VTXFMT1, 4);
			
			// Top-left
			GX_Position2f32(300, 40);
			GX_Color3f32(1.0f, 1.0f, 1.0f);
			
			// Top-right
			GX_Position2f32(500, 40);
			GX_Color3f32(1.0f, 1.0f, 1.0f);
			
			// Bottom-right
			GX_Position2f32(500, 80);
			GX_Color3f32(1.0f, 1.0f, 1.0f);
			
			// Bottom-left
			GX_Position2f32(300, 80);
			GX_Color3f32(1.0f, 1.0f, 1.0f);
			
		GX_End();
		*/
		
		
		// Display the rendered scene
		
		
		ActiveFB ^= 1;
		GX_SetZMode(GX_FALSE, GX_LEQUAL, GX_FALSE);
		GX_SetColorUpdate(GX_TRUE);
		GX_CopyDisp(myFB[ActiveFB], GX_TRUE);
		
		GX_DrawDone();
		
		VIDEO_SetNextFramebuffer(myFB[ActiveFB]);
		VIDEO_Flush();
		VIDEO_WaitVSync();
		
		
	}
	
	
	return(0);
	
}

void init() {
	
	int		aspect=0;
	int		xfbHeight=0;
	float	yscale=0;

	
	if (CONF_GetAspectRatio() == CONF_ASPECT_16_9) {
		aspect = 1;
	} else {
		aspect = 0;
	}
	
	
	// Setup video
	VIDEO_Init();
	
	
	// Allocate memory blocks as our framebuffers (two for double buffering)
	rmode = VIDEO_GetPreferredMode(NULL);
	myFB[0] = MEM_K0_TO_K1(SYS_AllocateFramebuffer(rmode));
	myFB[1] = MEM_K0_TO_K1(SYS_AllocateFramebuffer(rmode));
	
	
	// To fully get rid of the border on widescreen TVs
	if (aspect) {
		rmode-&gt;viWidth += 58;
		if (rmode-&gt;viWidth &gt; 720)	rmode-&gt;viWidth = 720;
	}
	
	
	// More video init stuff
	VIDEO_Configure(rmode);
	VIDEO_SetNextFramebuffer(myFB[ActiveFB]);
	VIDEO_SetBlack(FALSE);
	VIDEO_Flush();
	VIDEO_WaitVSync();
	if (rmode-&gt;viTVMode & VI_NON_INTERLACE) VIDEO_WaitVSync();
	
	
	// Setup fifo and the &#039;flipper&#039;
	gp_fifo = memalign(32, DEFAULT_FIFO_SIZE);
	memset(gp_fifo, 0, DEFAULT_FIFO_SIZE);
	
	
	// Initialize the GX system
	GX_Init(gp_fifo, DEFAULT_FIFO_SIZE);
	
	
	// Clears the bg to color and z buffer
	GX_SetCopyClear(ClearColor, 0x00ffffff);
	
	
	// More GX setup stuff
	GX_SetViewport(0, 0, rmode-&gt;fbWidth, rmode-&gt;efbHeight, 0, 1);
	yscale = GX_GetYScaleFactor(rmode-&gt;efbHeight, rmode-&gt;xfbHeight);
	xfbHeight = GX_SetDispCopyYScale(yscale);
	GX_SetScissor(0, 0, rmode-&gt;fbWidth, rmode-&gt;efbHeight);
	GX_SetDispCopySrc(0, 0, rmode-&gt;fbWidth, rmode-&gt;efbHeight);
	GX_SetDispCopyDst(rmode-&gt;fbWidth, xfbHeight);
	GX_SetCopyFilter(rmode-&gt;aa, rmode-&gt;sample_pattern, GX_TRUE, rmode-&gt;vfilter);
	GX_SetFieldMode(rmode-&gt;field_rendering, ((rmode-&gt;viHeight == 2*rmode-&gt;xfbHeight)?GX_ENABLE:GX_DISABLE));
	
	if (rmode-&gt;aa)
		GX_SetPixelFmt(GX_PF_RGB565_Z16, GX_ZC_LINEAR);
	else
		GX_SetPixelFmt(GX_PF_RGB8_Z24, GX_ZC_LINEAR);
	
	GX_SetCullMode(GX_CULL_NONE);
	GX_CopyDisp(myFB[ActiveFB], GX_TRUE);
	GX_SetDispCopyGamma(GX_GM_1_0);
	
	
	GX_ClearVtxDesc();
	GX_SetVtxDesc(GX_VA_POS, GX_DIRECT);
	GX_SetVtxDesc(GX_VA_CLR0, GX_DIRECT);
	GX_SetVtxDesc(GX_VA_TEX0, GX_DIRECT);

	GX_SetVtxAttrFmt(GX_VTXFMT0, GX_VA_POS, GX_POS_XY, GX_F32, 0);
	GX_SetVtxAttrFmt(GX_VTXFMT0, GX_VA_TEX0, GX_TEX_ST, GX_F32, 0);
	GX_SetVtxAttrFmt(GX_VTXFMT0, GX_VA_CLR0, GX_CLR_RGBA, GX_RGB8, 0);

	
	
	GX_SetNumChans(1);
	GX_SetNumTexGens(1);
	GX_SetTexCoordGen(GX_TEXCOORD0, GX_TG_MTX2x4, GX_TG_TEX0, GX_IDENTITY);
	
	
	GX_InvVtxCache();
	GX_InvalidateTexAll();
	
	
	// Upload our texture	
	TPL_OpenTPLFromMemory(&sampleTPL, (void*)sampletex_tpl, sampletex_tpl_size);
	TPL_GetTexture(&sampleTPL, sampletex, &texture);
	
	
	// Setup orthogonal projection matrix
	if (aspect) {	// Anamorphic widescreen
		guOrtho(myPersp, 0, rmode-&gt;viHeight - 1, 0, (rmode-&gt;viWidth - 1) + 140, 0, 10);
	} else {		// Normal
		guOrtho(myPersp, 0, rmode-&gt;viHeight - 1, 0, rmode-&gt;viWidth - 1, 0, 10);
	}
	
	GX_LoadProjectionMtx(myPersp, GX_ORTHOGRAPHIC);
	
	
	WPAD_Init();
	
}</pre><br />Any help will be gladly appreciated.<br />- TheCodingBrony]]></description>
<dc:creator>TheCodingBrony</dc:creator>
<category>Coding</category><pubDate>Tue, 08 Apr 2014 17:32:16 +0200</pubDate></item>
<item>
<guid>http://forum.wiibrew.org/read.php?11,74268,74268#msg-74268</guid>
<title>I&#039;m having trouble getting widescreen to work with libogc (5 replies)</title><link>http://forum.wiibrew.org/read.php?11,74268,74268#msg-74268</link><description><![CDATA[ I&#039;m new to Wii homebrew programming and have been trying to get the hang of using devkitppc recently... No, I&#039;m not some average newbie (despite my username sounding like one, just tryin&#039; to be a lil&#039; silly for fun :)) like what most new members are as I&#039;ve been a hobbyist game programmer for 5 years and have also made some pretty impressive homebrew for the Sony PlayStation lately.<br /><br />Anyway, I&#039;m currently having trouble getting widescreen to work in my tiny GX test program because VIDEO_GetPreferredMode() doesn&#039;t seem to return the appropriate video mode parameters even though my Wii is set to run in Widescreen mode... Is it because libogc does not support it? Or do I have to do a fake &#039;anamorphic widescreen&#039; trick which to me looks terrible because there is still a small boarder on the sides of the screen.<br /><br />Any useful help will be gladly appreciated.<br />- TheCodingBrony]]></description>
<dc:creator>TheCodingBrony</dc:creator>
<category>Coding</category><pubDate>Fri, 11 Apr 2014 06:03:01 +0200</pubDate></item>
<item>
<guid>http://forum.wiibrew.org/read.php?11,74253,74253#msg-74253</guid>
<title>[SOLVED] USB (ntfs) access from program. (1 reply)</title><link>http://forum.wiibrew.org/read.php?11,74253,74253#msg-74253</link><description><![CDATA[ Well. My wii mame works good with games on SD.<br />But now I want play games from USB formatted in NTFS.<br />I downloaded and installed libntfs and modified mame code to work with USB, but...does not work.<br />Then I tried using the simple example from libntfs, but does not work either.<br />Simply "No NTFS volumes were found and/or mounted."<br />Loaders work very well with the same USB disk.<br />Someone can help me?<br /><br /><br />PS: I&#039;ve use "formatted code", but signs \&lt; and \&gt; are gone...<br /><pre class="bbcode">
/**
 * main.c - Directory listing example for NTFS-based devices.
 *
 * Copyright (c) 2009 Rhys "Shareese" Koedijk
 *
 * This program/include file is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License as published
 * by the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program/include file is distributed in the hope that it will be
 * useful, but WITHOUT ANY WARRANTY; without even the implied warranty
 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software Foundation,
 * Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */

#include <gctypes.h>
#include <gccore.h>
#include <wiiuse/wpad.h>

#include <fat.h>
#include <ntfs.h>

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <dirent.h>
#include <errno.h>

static void *xfb = NULL;
static GXRModeObj *rmode = NULL;

void list(const char *path, int depth)
{
    DIR *pdir;
    struct dirent *pent;
    struct stat st;
    char indent[PATH_MAX] = {0};
    char new_path[PATH_MAX] = {0};

    // Open the directory
    pdir = opendir(path);
    if (pdir) {

        // Make this our current directory
        chdir(path);

        // Build a directory indent (for better readability)
        memset(indent, &#039; &#039;, depth * 2);

        // List the contents of the directory
        while ((pent = readdir(pdir)) != NULL) {
            if ((strcmp(pent-&gt;d_name, ".") == 0) || (strcmp(pent-&gt;d_name, "..") == 0))
                continue;

            // Get the entries stats
            if (stat(pent-&gt;d_name, &st) == -1)
                continue;

            // List the entry
            if (S_ISDIR(st.st_mode)) {
                printf(" D %s%s/\n", indent, pent-&gt;d_name);

                // List the directories contents
                sprintf(new_path, "%s/%s", path, pent-&gt;d_name);
                list(new_path, depth + 1);
                chdir(path);

            } else if (S_ISREG(st.st_mode)) {
                printf(" F %s%s (%lu)\n", indent, pent-&gt;d_name, (unsigned long int)st.st_size);
            } else {
                printf(" ? %s%s\n", indent, pent-&gt;d_name);
            }

        }

        // Close the directory
        closedir(pdir);

    } else {
        printf("opendir(%s) failure.\n", path);
    }

    return;
}

//---------------------------------------------------------------------------------
int main(int argc, char **argv) {
//---------------------------------------------------------------------------------

    // Initialise the video system
    VIDEO_Init();

    // This function initialises the attached controllers
    WPAD_Init();

    // Obtain the preferred video mode from the system
    // This will correspond to the settings in the Wii menu
    rmode = VIDEO_GetPreferredMode(NULL);

    // Allocate memory for the display in the uncached region
    xfb = MEM_K0_TO_K1(SYS_AllocateFramebuffer(rmode));

    // Initialise the console, required for printf
    console_init(xfb, 20, 20, rmode-&gt;fbWidth, rmode-&gt;xfbHeight, rmode-&gt;fbWidth * VI_DISPLAY_PIX_SZ);

    // Set up the video registers with the chosen mode
    VIDEO_Configure(rmode);

    // Tell the video hardware where our display memory is
    VIDEO_SetNextFramebuffer(xfb);

    // Make the display visible
    VIDEO_SetBlack(FALSE);

    // Flush the video register changes to the hardware
    VIDEO_Flush();

    // Wait for Video setup to complete
    VIDEO_WaitVSync();
    if(rmode-&gt;viTVMode&VI_NON_INTERLACE) VIDEO_WaitVSync();


    // The console understands VT terminal escape codes
    // This positions the cursor on row 2, column 0
    // we can use variables for this with format codes too
    // e.g. printf ("\x1b[%d;%dH", row, column );
    printf("\x1b[2;0H");

    printf("\n");
    printf(" NTFS Directory Listing Example\n");
    printf("\n");
    printf(" - &#039;LEFT&#039; and &#039;RIGHT&#039; to select a volume\n");
    printf(" - &#039;A&#039; to enumerate the selected volume\n");
    printf(" - &#039;HOME&#039; to quit\n");
    printf("\n");

    bool listed = false;
    ntfs_md *mounts = NULL;
    int mountCount = 0;
    int mountIndex = 0;
    int i;

    // Mount FAT devices
    fatInitDefault();

    // Mount all NTFS volumes on all inserted block devices
    mountCount = ntfsMountAll(&mounts, NTFS_DEFAULT | NTFS_RECOVER);
    if (mountCount == -1)
        printf("Error whilst mounting devices (%i).\n", errno);
    else if (mountCount == 0)
        printf("No NTFS volumes were found and/or mounted.\n");
    else
        printf("%i NTFS volumes(s) mounted!\n\n", mountCount);

    // List all mounted NTFS volumes
    for (i = 0; i &lt; mountCount; i++)
        printf("%i - %s:/ (%s)\n", i + 1, mounts<i>.name, ntfsGetVolumeName(mounts<i>.name));

    printf("\n");
    while (1) {

        // Call WPAD_ScanPads each loop, this reads the latest controller states
        WPAD_ScanPads();

        // WPAD_ButtonsDown tells us which buttons were pressed in this loop
        // this is a "one shot" state which will not fire again until the button has been released
        u32 pressed = WPAD_ButtonsDown(0);

        // Break from main loop
        if (pressed & WPAD_BUTTON_HOME) break;

        // If there is at least one volume mounted and we have not yet listed one...
        if (mountCount &gt; 0 && !listed) {

            // Deincrement the selected volumes index
            if (pressed & WPAD_BUTTON_LEFT)
                mountIndex = MIN(MAX(mountIndex - 1, 0), mountCount - 1);

            // Increment the selected volumes index
            if (pressed & WPAD_BUTTON_RIGHT)
                mountIndex = MIN(MAX(mountIndex + 1, 0), mountCount - 1);

            // Enumerate the selected volumes contents
            if (pressed & WPAD_BUTTON_A) {
                printf("\n\n");

                // List the volumes root directory
                char path[PATH_MAX] = {0};
                strcpy(path, mounts[mountIndex].name);
                strcat(path, ":/");
                list(path, 0);
                listed = true;

                printf("\n");
                printf("Press &#039;HOME&#039; to quit.\n\n");

            }

            // If we have not listed a volume yet then prompt to select one
            if(!listed) {
                printf("\rSelect a NTFS volume: &lt; %i &gt;", mountIndex + 1);
            }

        }

        // Wait for the next frame
        VIDEO_WaitVSync();

    }

    // Unmount all NTFS volumes and clean up
    if (mounts) {
        for (i = 0; i &lt; mountCount; i++)
            ntfsUnmount(mounts<i>.name, true);
        free(mounts);
    }

    // We return to the launcher application via exit
    exit(0);

    return 0;
}
</i></i></i></pre>]]></description>
<dc:creator>nebiun</dc:creator>
<category>Coding</category><pubDate>Tue, 01 Apr 2014 19:28:02 +0200</pubDate></item>
</channel>
</rss>