Twitter

Ohloh membership

Hi, As you maybe already notest i have joined the Ohloh community. Some kind of Facebook community for open source projects. Most large open source projects (for example Firefox, Gcc, Bash, subversion, Apache, etc.) have joined this great community. It would be really nice that you give me some credits for my work in this community. So if you like the developed software, join the ohloh community and click on the “I USE THIS” button located on the detail project pages. 😆

Many thanks in advance.

TowerDefense 20.000 downloads

Since the launch (20 December 2009) of TowerDefense, it is downloaded over 20.000 times. Wow! :). So a very special thanks to everyone who’s been downloading, playing and commenting this game.

Official Count

Homebrew Browser 18.286 times
My website 1.682 times
Google Code Website 45 times
Total 20.013 times

Wii TowerDefense 0.93

PlaatSoft has released TowerDefense v0.93. The following changes were made:

22-01-2010 Version 0.93
GUI:
– Added weapon fire mode information on weapon help screen.
– Improve weapon reload delay initialisation.
– Added donate screen.
– Bugfix: Weapon fire sprites were 22 degree misaligned.
Core:
– Introduce different weapon fire modes.
– Fire at enemy in range nearest to base (Gun / Rifle)
– Fire at enemy in range with highest energy level (Cannon / Missile)
– Fire at fastest enemy in range (Laser / Nuke)
– Rebalance weapon specifications. Mix features more!
– Optimised some draw methods for beter performance. Thanks Crayon.
General:
– Build game with devkitPPC r19 compiler.

RedSquare 20.000 downloads

Since the launch of RedSquare for Nitendo Wii it was downloaded over 20.000 times. Wow! :). So a very special thanks to everyone who’s been downloading, playing and commenting this game.

Official Count

Homebrew Browser 17.062 times
My website 2,730 times
Google Code website 212 times
Total 20.004 times

SpaceBubble 25.000 downloads

Since the launch of SpaceBubble, it is downloaded over 25.000 times. Wow! :). So a very special thanks to everyone who’s been downloading, playing and commenting this game.

Official Count

Homebrew Browser 22.532 times
My website 2.571 times
Google Code Website 253 times
Total 25.356 times

Wii TowerDefense 0.92

PlaatSoft has released TowerDefense v0.92. The following changes were made:

16-01-2010 Version 0.92
GUI:
– Added 6 animated weapons. Thanks Applicant!
– Improve enemy animated sprite frame sequence.
– Improve help and level select screens.
– Lots of other small changes.
Core:
– Weapons now fire on strongest enemy in range.
– Increase bonus money when wave is cleared.
– Increase initial weapon power.
– Decrease weapon prices.
– Added weapon sell functionality with minus button.
– User initials are now default based on Wii nickname.
– Bugfix: Monsters can not be shooted before launch.
– Build game with devkitPPC r19 compiler.

TowerDefense 15.000 downloads

Since the launch (20 December 2009) of TowerDefense, it is downloaded over 15.000 times. Wow! :). So a very special thanks to everyone who’s been downloading, playing and commenting this game.

Official Count

Homebrew Browser 13.603 times
My website 1.172 times
Google Code Website 226 times
Total 15.001 times

GRRLIB 4.2.X Freetype support

In this post i have add information how to add freetype library support to the GRRLIB 4.2.X library

GRRLIB_free_print.h

void GRRLIB_InitFreetype();

void GRRLIB_initTexture(void);

void GRRLIB_Printf2(	int x, 
							int y, 
							const char *string, 
							unsigned int fontSize, 
							int color); 

GRRLIB_texImg* GRRLIB_GetTexture(void);

GRRLIB_free_print.c

#include <malloc.h>
#include <stdarg.h>
#include <stdio.h>

#include <grrlib.h>

#include <ft2build.h> /* I presume you have freetype for the Wii installed */
#include FT_FREETYPE_H

#include "font_ttf.h"

static FT_Library ftLibrary;
static FT_Face ftFace;

void *fontTempLayer=NULL;
void *fontTexture=NULL;
GRRLIB_texImg image;

extern  Mtx                  GXmodelView2D;

/* Static function prototypes */
static void BitmapTo4x4RGBA(const unsigned char *src, void *dst, const unsigned int width, const unsigned int height);
static bool BlitGlyph(FT_Bitmap *bitmap, int offset, int top, int color) ;

void GRRLIB_InitFreetype(void) 
{
	unsigned int error = FT_Init_FreeType(&ftLibrary);
	if (error) 
	{
		exit(0);
	}

	error = FT_New_Memory_Face(ftLibrary, font_ttf, font_ttf_size, 0, &ftFace);
	if (error == FT_Err_Unknown_File_Format) 
	{
		exit(0);
	} 
	else if (error) 
	{
		/* Some other error */
		exit(0);
	}
}

void GRRLIB_initTexture(void)
{
   // Clear previous video frame buffer
   if (fontTexture!=NULL) free(fontTexture);

   fontTempLayer = (void*) calloc(1, 640 * 528 * 4);

   if (fontTempLayer == NULL) 
   {
	  /* Oops! Something went wrong! */
	  exit(0);
   }
}

void GRRLIB_Printf2(int x, int y, const char *string, unsigned int fontSize, int color) 
{
	unsigned int error = 0;
	int penX = 0;
	int penY = fontSize;
	FT_GlyphSlot slot = ftFace->glyph;
	FT_UInt glyphIndex = 0;
	FT_UInt previousGlyph = 0;
	FT_Bool hasKerning = FT_HAS_KERNING(ftFace);

    error = FT_Set_Pixel_Sizes(ftFace, 0, fontSize);
	if (error) 
	{
		/* Failed to set the font size to the requested size. 
		 * You probably should set a default size or something. 
		 * I'll leave that up to the reader. */
		 FT_Set_Pixel_Sizes(ftFace, 0, 12);
	}
	
	/* Convert the string to UTF32 */
	size_t length = strlen(string);
	wchar_t *utf32 = (wchar_t*)malloc(length * sizeof(wchar_t)); 
	length = mbstowcs(utf32, string, length);
	
	/* Loop over each character, drawing it on to the 4, until the 
	 * end of the string is reached, or until the pixel width is too wide */
	unsigned int loop = 0;
	for (loop = 0; loop < length; ++loop)
    {
		glyphIndex = FT_Get_Char_Index(ftFace, utf32[ loop ]);
		
		/* To the best of my knowledge, none of the other freetype 
		 * implementations use kerning, so my method ends up looking
		 * slightly better 🙂 */
		if (hasKerning && previousGlyph && glyphIndex) 
		{
			FT_Vector delta;
			FT_Get_Kerning(ftFace, previousGlyph, glyphIndex, FT_KERNING_DEFAULT, &delta);
			penX += delta.x >> 6;
		}
	
		error = FT_Load_Glyph(ftFace, glyphIndex, FT_LOAD_RENDER);
		if (error)
        {
			/* Whoops, something went wrong trying to load the glyph 
			 * for this character... you should handle this better */
			continue;
		}
	
		if (BlitGlyph(&slot->bitmap, penX + slot->bitmap_left+x, penY - slot->bitmap_top+y, color) == true) 
		{
			/* The glyph was successfully blitted to the buffer, move the pen forwards */
			penX += slot->advance.x >> 6;
			previousGlyph = glyphIndex;
		} 
		else 
		{
			/* BlitGlyph returned false, the line must be full */
			free(utf32);
			return;
		}
	}

	free(utf32);
}

/* Returns true if the character was draw on to the buffer, false if otherwise */
bool BlitGlyph(FT_Bitmap *bitmap, int offset, int top, int color) 
{
	int bitmapWidth = bitmap->width;
	int bitmapHeight = bitmap->rows;

	if (offset + bitmapWidth > 640) 
	{
		/* Drawing this character would over run the buffer, so don't draw it */
		return false;
	}

	/* Draw the glyph onto the buffer, blitting from the bottom up */
	/* CREDIT: Derived from a function by DragonMinded */
	unsigned char *p = fontTempLayer;
	unsigned int y = 0;
	for (y = 0; y < bitmapHeight; ++y) 
	{
		int sywidth = y * bitmapWidth;
		int dywidth = (y + top) * 640;

		unsigned int column = 0;
		for (column = 0; column < bitmapWidth; ++column)
        {
			unsigned int srcloc = column + sywidth;
			unsigned int dstloc = ((column + offset) + dywidth) << 2;
			
			/* Copy the alpha value for this pixel into the texture buffer */
			p[ dstloc + 0 ] = (color & 0xff);
			p[ dstloc + 1 ] = ((color >> 8) & 0xff);
			p[ dstloc + 2 ] = ((color >> 16) & 0xff);
			p[ dstloc + 3 ] = (bitmap->buffer[ srcloc ]);
		}
	}
	
	return true;
}

/* Render the text string to a 4x4RGBA texture, return a pointer to this texture */
GRRLIB_texImg* GRRLIB_GetTexture(void) 
{
	/* Create a new buffer, this time to hold the final texture 
	 * in a format suitable for the Wii */
	fontTexture = memalign(32, 640 * 528 * 4);

	/* Convert the RGBA temp buffer to a format usuable by GX */
	BitmapTo4x4RGBA(fontTempLayer, fontTexture, 640, 528);
	DCFlushRange(fontTexture, 640 * 528 * 4);

	/* The temp buffer is no longer required */
	free(fontTempLayer);
	image.data=fontTexture;
	image.w=640;
	image.h=528;
	
	return &image;
}

void BitmapTo4x4RGBA(const unsigned char *src, void *dst, const unsigned int width, const unsigned int height)
{
	unsigned int block = 0;
	unsigned int i = 0;
	unsigned int c = 0;
	unsigned int ar = 0;
	unsigned int gb = 0;
	unsigned char *p = (unsigned char*)dst;

	for (block = 0; block < height; block += 4) {
		for (i = 0; i < width; i += 4) {
			/* Alpha and Red */
			for (c = 0; c < 4; ++c) {
				for (ar = 0; ar < 4; ++ar) {
					/* Alpha pixels */
					*p++ = src[(((i + ar) + ((block + c) * width)) * 4) + 3];
					/* Red pixels */	
					*p++ = src[((i + ar) + ((block + c) * width)) * 4];
				}
			}
			
			/* Green and Blue */
			for (c = 0; c < 4; ++c) {
				for (gb = 0; gb < 4; ++gb) {
					/* Green pixels */
					*p++ = src[(((i + gb) + ((block + c) * width)) * 4) + 1];
					/* Blue pixels */
					*p++ = src[(((i + gb) + ((block + c) * width)) * 4) + 2];
				}
			}
		} /* i */
	} /* block */
}

Wii trace module

To debug better a Wii application / game i have created a trace C++ module with is logging trace event to file. Please checkout the following code. I hope it benefit someone!

trace.h

#ifndef TRACE_H
#define TRACE_H

class Trace
{
  private:
	FILE * fp;
	char * getDate();

  public:
  	// Constructor & Destructor
	Trace();
 	~Trace();
	
	// Methodes
	int open(const char *filename);
	int event( const char *functionName, int threadNr, const char *event, ...);
	int eventRaw( char character);
	int close();
};

#endif

trace.cpp

#include <stdio.h>
#include <gccore.h>
#include <ogcsys.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <ogcsys.h>
#include <stdarg.h>
#include <time.h>

#include "trace.h"

// Enable / Disable trace file functionality
bool traceOn = false;

// ------------------------------
// Constructor
// ------------------------------

Trace::Trace()
{
	fp=NULL;
}

// ------------------------------
// Destructor
// ------------------------------

Trace::~Trace()
{
  close();
}

// ------------------------------
// Methods
// ------------------------------

// Open trace file
int Trace::open(const char *filename)
{
   int returnValue=0;
   
   if (!traceOn) return -1;
         
   if((fp=fopen(filename, "wb"))==NULL) 
   {
      printf("Error: Cannot open trace file.\n");
      returnValue=-2;
   }   
   return returnValue;
}


// Close trace file
int Trace::close()
{
   int returnValue=0;
   
   if (fp!=NULL)
   {
       fclose(fp);
   }	
   return returnValue;
}


// Create trace timestamp
char * Trace::getDate()
{
  struct tm *now = NULL;
  time_t time_value = 0;
  static char buf[ 128 ] ;
  
  // Clear memory  
  memset(buf, sizeof(buf), 0x00);
  
  /* Get time value */
  time_value = time(NULL);          
  
  /* Get time and date structure */
  now = localtime(&time_value);     

  // Create time stamp
  sprintf(buf,"%02d-%02d-%04d %02d:%02d:%02d",
	now->tm_mday, now->tm_mon+1, now->tm_year+1900, 
	now->tm_hour,now->tm_min,now->tm_sec);
	
  return buf;
}

// Save trace event in trace file
int Trace::event( const char *functionName, int threadNr, const char *event, ...)
{
   int returnValue=0;
   char buf[ MAX_LEN ];
   
   // Clear memory  
   memset(buf, MAX_LEN, 0x00);
   
   if (!traceOn) return -1;
   
   // Expend event string
   va_list list;
   va_start(list, event );
   vsprintf(buf, event, list);
   
   if (fp!=NULL)
   {
      // Save string to file
	  fprintf(fp,"%s [thread%d-%s] %s\n",getDate(), threadNr, functionName, buf); 
	  fflush(fp); 
   }
   
   return returnValue;
}


// Save trace event in trace file
int Trace::eventRaw( char character)
{
   int returnValue=0;
   
   if (!traceOn) return -1;
     
   if (fp!=NULL)
   {
      // Save string to file
	  fprintf(fp,"%c",character); 
	  fflush(fp); 
   }
   
   return returnValue;
}

Wii RedSquare 0.94

This evening RedSquare 0.94 for Nitendo Wii is released by PlaatSoft. The following changes were made:

11-01-2010 Version 0.94
– Added improve score calculation.
– Added extra help screen.
– Improve webservice call to store high score.
– Added support for 60HZ (640×480) TV mode.
– Use libogc 1.8.1 library as Wii interface engine.
– Use GRRLIB v4.2.0 as graphical engine.
– Build game with devkitPPC r19 compiler.

If anybody has a good idea how to improve this game, please post a comment

Wii TowerDefense 0.91

PlaatSoft has released TowerDefense v0.91. The following changes were made:

09-01-2010 Version 0.91
GUI:
– Added 25 animated enemy sprites. Thanks Applicant!
– Added game setting screen.
– Added intro screen 3
– Improve winter theme sprites.
– Improve first help screen.
– Improve main menu screen.
– Lots of other small GUI changes.
Core:
– Make game harder to play!
– Less start money.
– Enemy minimum / maximum speed depend on wave nr.
– Increase weapon prices.
– Increase maximum concurrent monsters in action.
– Decrease weapons effective range.
– Build game with devkitPPC r19 compiler.

Website upgrade

This morning I have upgraded my website.

The following changes were implemented:
– Upgrade to WordPress 2.9.1
– Move all the development Wii games source code to Google Code
– Game downloads are now handled by Google Code (Reduce Website traffic)

SpaceBubble 0.93

This evening SpaceBubble 0.93 is released by PlaatSoft. The following changes were made:

08-01-2010 Version 0.93
– Improve main menu screen.
– Added 60Hz (640×480) TV Mode support.
– Increase local highscore list to maximum 100 entries.
– Store current game score in highscore area also when game is quited.
– Added extra help screen with WiiMote control information.
– Use GRRLIB v4.2.0 library as graphical engine.
– Use libogc v1.8.1 library as Wii interface engine.
– Build game with devkitPPC r19 compiler.

If anybody has a good idea how to improve this game, please post a comment

Wii TowerDefense 10.000 downloads

Since the launch (20 December 2009) of TowerDefense, it is downloaded over 10.000 times. Wow! :). So a very special thanks to everyone who’s been downloading, playing and commenting this game.

Official Count

Homebrew Browser 8.919 times
My website 1.083 times
Total 10.002 times

Progress report TowerDefense

Hi everybody, Here a small update about the continues development of TowerDefense. On this moment Appliciant is designing new animated enemy and weapon sprites for the game. If all the enemies and weapons are ready i will bring out the next major release. To give your some idea were it is going too, check out the following art drawing. In the mean time if there are any bugs or new ideas please post them below!

Wii TowerDefense 0.90

PlaatSoft has released TowerDefense v0.90. The following changes were made:

02-01-2010 Version 0.90
GUI:
– Improve background images.
– Remove some english typos.
– Improve first intro screen.
– Added WiiMote control help screen.
Core:
– Improve first music track.
– Enable B button for faster building.
– Enable left and right button for faster weapon type selection.
– Build game with devkitPPC r19 compiler.

PlaatSoft 100.000 downloads!

Hi everybody, This year starts great. On the first day of 2010 PlaatSoft reach officially 100.000 game downloads. This is great news! Thanks for all the PlaatSoft Wii Homebrew supporters around the world 😆 Looking forward to provide you with more high quality Wii Homebrew games in 2010!

Official Count

Game PlaatSoft CodeMii Google Code Totals
Wii Pong2 3.077 33.718 0 36.795
Wii BibleQuiz 1.945 13.384 0 15.329
Wii RedSquare 2.620 15.735 0 18.355
Wii SpaceBubble 2.484 19.796 0 22.280
Wii TowerDefense 857 6.386 0 7.243
Totals 10.983 89.019 0 100.002

Happy New Year!

I wish you all a very good 2010! Greetings to everybody in the Wii Homebrew scene.