GCOS questions

Release threads for homebrew & utilities only
Post Reply
Borg Number One
Posts: 28
Joined: Sat Jan 30, 2021 8:02 pm

GCOS questions

Post by Borg Number One » Sat Jan 30, 2021 11:54 pm

Hi.

At first, I am new to this great forum and this is my first post.
So please, excuse me for my Nintendo Gamecube related euphoria.

I like it to read all the technical hardware, software and gc-linux related posts in the gc-forever.com/forums.
So I would like to thank all the people who did write them. Especially emu_kidid.
I am new to the Gamecube scene, but it seems to be that emu_kidid is the one or one of a GameCube guru.

Well, after finding and reactivating the Gamecube from my wife, I am completely fascinated from the GameCube and all its technical stuff (CPU, ATI Flipper / GX, EXI port, ARAM, Optical Drive and the special peculiarities of the Gamecube DVDs and all their hard to find related original Nintendo PDF documentations / original Nintendo SDKs ).

Furthermore I am also completely fascinated from what is possible with the Gamecube and non-Nintendo related stuff, like
file browser, loader, patcher --> swiss, sdload
homebrew demos
(solderless) modding --> GC Loader, GCvideo (& HDMI USB grabber for sharp, pixel perfect Gamecube screenshot and video grabbing)
software modding --> action replay -> SDGecko loader
gc-linux

After buying all the equipment (SD2SP2, Kaico GCvideo, GCLoader, BBA adapter, Keyboard-Mouse to PS2 adapter, PS2 to Gamecube controller adapter) and after a week of playing with the Gamecube hardware and homebrew stuff, I found the homebrew: GCOS.

My current joy about all the "new" Gamecube related stuff also moves me to learn more about programming - programming the gamecube.

So, I found this GCOS thread and I did a look into the sources and I have some questions:

Inside:

Code: Select all

../GCOS COMPLETE SOURCE (v1.0-v1.x)/GCoS 1.5/1.5/menu/menu.rle.c
there is a "thing" (An aray of bytes? I do not know the exact description of that "thing" not yet - I am still learning ;) ) :

Code: Select all

unsigned long MENU_RLE_Bitmap[10141]={

and inside the GCOS binaries (e.g.: "GCoS 1.5 (PSO).dol" ) I also could find the same aray of bytes:

Image


So, it seems to be the binary representation of the following logo, is not it? (with or without the texts?):

Image
(pixel perfect / lossless grabbed via: GCVideo, and Startech USB3HDCAP HDMI USB grabber ;) )


Are all the following bytes after "unsigned long MENU_RLE_Bitmap[10141]={" normal Run-Length encoded bitmap data like in 4bit/8bit RLE .BMPS?
Or is it a 24bit bitmap RLE compressed/encoded or something else?

Would it be possible to extract the bitmap data snipset from the GCoS 1.5 (PSO).dol and combine it with a RLE-bitmap header to get back a working bitmap?
(Just for fun / just for trying it out. ;) )

How or with the help of which tool could you realize this:
bitmap data to source code conversion?
Attachments
RCOS--MENU_RLE_Bitmap.png
(57.59 KiB) Not downloaded yet
RCOS-boot-animation.gif
(319.75 KiB) Not downloaded yet
RCOS-boot-10.png
(26.36 KiB) Not downloaded yet
RCOS-boot-09.png
(20.33 KiB) Not downloaded yet
RCOS-boot-08.png
(18.98 KiB) Not downloaded yet
User avatar
emu_kidid
Site Admin
Posts: 4936
Joined: Mon Mar 29, 2010 10:06 am
Location: Australia
Contact:

Re: GCOS Releases

Post by emu_kidid » Mon Feb 01, 2021 1:30 am

Welcome.

Yes those are bitmaps of some kind represented as byte arrays in .c/.h files.

Don't use GCOS as an example into programming for the GameCube, it's extremely outdated, you're better off looking at Swiss.

edit: made separate thread for this.
Image
User avatar
emu_kidid
Site Admin
Posts: 4936
Joined: Mon Mar 29, 2010 10:06 am
Location: Australia
Contact:

Re: GCOS questions

Post by emu_kidid » Wed Feb 03, 2021 1:10 am

I had a look, you're better off just using Dolphin and enable texture dumping to get it raw, or straight from your HDMI footage, it's a packed format and if you look at draw.c from the same source you'll see how it's unpacked and then directly drawn onto the framebuffer:
Spoiler
Show

Code: Select all

//Allocate some space to decompressed bmps
u32 *GCOSLogo = (u32*)0x81200000;


void DecompressRLEs(void) 
{
	DecompressRLE(MENU_RLE_Bitmap, GCOSLogo,   MENU_RLE_SIZE); 
	
}

void DecompressRLE(const unsigned long *pSouce, u32 *pDest, int iSize) 
{
	unsigned long oldChar = -1;
	unsigned long newChar;
	int offset=0;
	int i;

	for (i=0; i<iSize; i++)
	{
		newChar = pSouce[i];
		pDest[offset++]=newChar;
		if(newChar == oldChar) 
		{
			int len =pSouce[++i];
			while(len > 0) 
			{
				pDest[offset++]=newChar;
				len = len - 1;
			}
		}
		oldChar = newChar;
	}
}

void menuDrawLogo(u32 *curFrameBuffer, int scrX, int scrY, int iZoom)
{
	int w = MENU_RLE_WIDTH;
	int h = MENU_RLE_HEIGHT;
	int bufX = 0;
	int bufY = 0;
    int x, y, i, j, zx, zy, offset;

    scrX /= 2;
    w /= 2;
    for (y = scrY; y < scrY + h; y++) {
	for (x = scrX; x < scrX + w; x++) {
	    offset = x - scrX + bufX + ((y - scrY + bufY) * MENU_RLE_WIDTH) /2;
	    if (GCOSLogo[offset] != TRANSPARENCY) {
		zx = scrX + (x - scrX) * iZoom;
		zy = scrY + (y - scrY) * iZoom;
		for (i = 0; i < iZoom; i++) {
		    for (j = 0; j < iZoom; j++) {
		    curFrameBuffer[(zx + i) + SCR_WIDTH * (zy + j) /2] = GCOSLogo[offset];
		    }
		}
	    }
	}
    }
}
Like I said, it's really bad code :P
Image
Post Reply