Skip to content

Commit

Permalink
GameCube and Wii: Corrected ambiguity between Flipper/Hollywood (the …
Browse files Browse the repository at this point in the history
…SoC) and their internal GPU.

Thanks @phire, @Pokechu22, @Masamune3210 and @aboood40091

Part of #151 and fixes #150
  • Loading branch information
flipacholas committed Dec 4, 2022
1 parent bfc0dc1 commit dd0dfdf
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 24 deletions.
26 changes: 13 additions & 13 deletions articles/gamecube.Rmd.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ supporting_imagery()

After the loss of SGI's dominance in the graphics market, Nintendo needed new players to partner up with.

![Construction of Gekko.](cpu/cpu_features.png){.open-float}
![Construction of Gekko.](cpu/cpu_features.png){.open-float .no-borders}

A promising candidate seems to be IBM: Apart from their famous work on mainframes, they recently allied with Motorola and Apple to create a CPU powerful enough to compete with Intel's ruling in the PC market. The resulting product is a series of processors carrying the name **PowerPC**, which were selected to *power* 99% of Apple's Macintoshes and some embedded systems.

Expand Down Expand Up @@ -135,7 +135,7 @@ In conclusion, with some clever tricks, these general-purpose capabilities enabl

This is one of the most critical sections of this console, it basically makes the Gamecube, a *Gamecube*.

The history of this console's GPU has some interesting connections: Wei Yen, the director of N64's GPU ([the RCP](nintendo-64#graphics)), later founded Artx and landed a contract with Nintendo to develop their next-gen GPU: **Flipper**.
The history of this console's GPU has some interesting connections: Wei Yen, the director of N64's SoC ([the RCP](nintendo-64#graphics)), later founded Artx and landed a contract with Nintendo to develop their next-gen chip: **Flipper**.

![Super Mario Sunshine (2002).](sunshine.png){.open-float}

Expand All @@ -147,11 +147,11 @@ During the development process, ArtX got acquired by ATI, which in turn was sold

### Architecture and design

Flipper handles multiple services, so let's focus on the graphics component for now (since it's the one responsible for bringing our geometry to life). If you've been reading the [N64 article](nintendo-64#graphics), just letting you know that the core is now functional out of the box, so programmers won't need to worry about injecting code to make it work. Nevertheless, there will be some interesting parts that are customisable.
Flipper is a complex block that handles multiple services [@graphics-cheng], so let's focus on the graphics component for now (since it's the one responsible for bringing our geometry to life). We'll call this area the **GPU** or **Graphics Engine** and, if you've been reading the [N64 article](nintendo-64#graphics), just letting you know that the core is now functional out of the box, so programmers won't need to worry about injecting code to make it work. Nevertheless, there will be some interesting parts that are customisable.

![Pipeline design of Flipper.](flipper_pipeline.png)
![Pipeline design of Flipper's GPU.](flipper_pipeline.png)

As always, in order to draw a frame on the screen, our data will be pumped through Flipper's pipeline. Data goes through lots of different components which we can group into four stages:
As always, in order to draw a frame on the screen, our data will be pumped through the GPU's pipeline. Data goes through lots of different components which we can group into four stages:

#### Database {.tabs .active}

Expand Down Expand Up @@ -182,7 +182,7 @@ Once loaded, the primitives can be **transformed**, **clipped**, **lighted** (ea

![Texture stage diagram using a default setup.](flipper_pipeline/texture.jpg){.tab-float}

Now it's time to apply textures and effects to our models, and for that Flipper includes multiple units which will process our pixels. Now, this is a very sophisticated (yet quite complex) procedure, so if you find it difficult to follow, just think of it as a big assembly line that processes pixels. Having said that, there are three groups of units available:
Now it's time to apply textures and effects to our models, and for that the GPU includes multiple units which will process our pixels. Now, this is a very sophisticated (yet quite complex) procedure, so if you find it difficult to follow, just think of it as a big assembly line that processes pixels. Having said that, there are three groups of units available:

- **Four parallel Pixel units** (also called 'pixel pipelines'): Rasterises our primitives (converts them to pixels). Having four units available enables to deliver up to 2x2 pixels on each cycle.
- **One Texture mapping unit** at the end of each Pixel unit (giving **four in total**): Together they process up to eight textures for our primitives (now mere pixels) at each cycle.
Expand Down Expand Up @@ -254,7 +254,7 @@ As you can see from the inner working of this pipeline, graphics technology has

![The Legend of Zelda: The Wind Waker (2003).](wind_waker.png){.open-float}

During the same time, PC graphics cards were starting to discard fixed-function pipelines in favour of **shader cores** (units that run small programs which define how pixels are operated). Flipper is still a fixed-function GPU, however by including components such as the TEV unit, one could argue that Nintendo provided their own shader-like solution.
During the same time, PC graphics cards were starting to discard fixed-function pipelines in favour of **shader cores** (units that run small programs which define how pixels are operated). Flipper still contains a fixed-function GPU, however, by including components such as the TEV unit, one could argue that Nintendo provided their own shader-like solution.

I guess one of the best examples of games that exploited this new capability is **The Legend of Zelda: Wind Waker** which implements a unique colour/lighting technique known as **Cel shading** to make its textures look *cartoonish*.

Expand Down Expand Up @@ -317,7 +317,9 @@ It seems that this generation is putting a lot of work into expandability and ac

### Internal I/O

Flipper is in charge of interfacing the CPU with the rest of the components so, apart from including sound and graphics circuitry, it also provides a collection of hardware named **(internal) Northbridge** composed of [@cpu-tree]:
![Main diagram of the Gamecube's architecture. In there, we find the 'Northbridge' which controls most of the I/O.](diagram.png)

Flipper is in charge of interfacing the CPU with the rest of the components so, apart from including sound and graphics circuitry, it also provides a collection of hardware named **Northbridge** that is composed of [@cpu-tree]:

- **Audio Interface** or 'AI': Connects the Audio Encoder.
- **Video Interface** or 'VI': Connects the Video Encoder.
Expand Down Expand Up @@ -365,7 +367,7 @@ Upon turning on the console, the CPU will start loading an operating system call

After finishing the boot process, the OS will load a small program *unofficially* called **Main Menu**.

![Main Menu with multiple settings available.](ipl/menu.png){.tabs-nested .active .open-float .tab-float title="Menu"}
![Main Menu with multiple settings available.](ipl/menu.png){.tabs-nested .active title="Menu"}

![Clock settings.](ipl/clock.png){.tab-nested title="Clock"}

Expand All @@ -378,13 +380,11 @@ This program is responsible for displaying the famous splash animation (the wee
- Manage saves on any Memory Card.
- Change sound settings and screen position.

`r close_float_group(with_markdown = TRUE)`

## Games

Nintendo provided developers with lots of tools to assist (and encourage) the development of games for their console [@games-sdk]:

- **Dolphin SDK**: The official set of APIs and useful libraries.
- **Dolphin SDK**: The official set of APIs and useful libraries. This includes the **GX** library in charge of programming Flipper's GPU.
- **C** and **C++** Compilers.
- **Debuggers** and **Testers**: Meant to be used with an official Dev Kit.
- **Cygnus**: Now known as 'Cygwin', it's basically used to replicate the UNIX environment on Windows.
Expand Down Expand Up @@ -460,7 +460,7 @@ Well, this is it, the **10^th^ article**!

I really tried to set a rough limit on the length of this article but you have to understand, technology has gotten *so complex* that if I accidentally skip anything important, the whole topic gets impossible to follow.

Anyway, I'd like to thank the #dolphin-dev IRC community for helping me understand the complicated pipeline of Flipper, these guys have been developing the Gamecube emulator for quite some years now and it's really impressive how much they had to put up with.
Anyway, I'd like to thank the #dolphin-dev IRC community for helping me understand the complicated pipeline of Flipper's GPU, these guys have been developing the Gamecube emulator for quite some years now and it's really impressive how much they had to put up with.

And finally, please consider [contributing](support) if you found it an interesting read. I strive to make it as complete as I can, and in the process, I forget how much time it's suddenly costing me, I find it a good investment nonetheless.

Expand Down
23 changes: 12 additions & 11 deletions articles/wii.Rmd.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,27 +68,28 @@ After having reviewed [Gekko](gamecube#cpu), I'm afraid there aren't many change

This one is an interesting bit, the old Gamecube memory layout has been re-arranged and enhanced with the following changes:

- Splash (24 MB of 1T-SRAM) now resides inside the GPU package, it is now referred to as **MEM1** [@operating_system-memory].
- Splash (24 MB of 1T-SRAM) now resides inside the Hollywood SoC (explained later) and it is now called **MEM1** [@operating_system-memory].
- ARAM (16 MB of serial SDRAM) is long **gone**, however...
- There's a new memory chip, **MEM2**, which includes **64 MB of GDDR3 SDRAM** for general purpose.
- This type of memory is based on the traditional DDR2 system but revamped with higher bandwidths (~2 times the original transfer rates) and reduced power consumption, which is ideal for GPUs.

### Backwards compatibility

(For now) You can think of this console as a superset of the GameCube and as such, compatibility with the previous generation of games is naturally inherited. That being said, in order to make the Wii *fully* backwards compatible, the old set of external ports were brought to the Wii, these include the GameCube controller and memory card ports.
However, there's a new constraint: The new memory map is incompatible with the old one. Thus, a thin 'emulation' layer was implemented in software (more details in the 'I/O' and 'Operating System' section).
For now, you can think of this console as a superset of the GameCube and as such, compatibility with the previous generation of games is naturally inherited. That being said, in order to make the Wii *fully* backwards compatible, the old set of external ports were brought to the Wii, these include the GameCube controller and memory card ports. However, there's a new constraint: The new memory map is incompatible with the old one. Thus, a thin 'emulation' layer was implemented in software (more details in the 'I/O' and 'Operating System' section).

Regarding the GameCube accessories using the Serial/Hi-Speed socket, I'm afraid the Wii didn't include these ports, so those accessories can't be used here.

In later years, new revisions of the Wii saw these ports removed, unfortunately.

## Graphics

The new graphics package is called **Hollywood**. It still performs the same tasks that [Flipper](gamecube#graphics) did back in the day but enjoys 1.5x the clock speed (**243 MHz**). This increase means that more geometry and effects can be processed during the same unit of time.
Similarly to the GameCube (where the graphics component, I/O interfaces and audio capabilities were combined into a single package called 'Flipper'), the Wii follows suit and houses a big chip next to Broadway called **Hollywood**. In here, we find the graphics subsystem which, to be fair, is identical to Flipper's albeit with minimal corrections.

Thus, Hollywood's GPU still performs the same tasks that [Flipper's counterpart](gamecube#graphics) did back in the day but now enjoys **1.5x** the clock speed (**243 MHz**). This increase means that more geometry and effects can be processed during the same unit of time.

### Functionality

The 3D engine is still [Flipper's](gamecube#graphics) but now called **GX**. So instead of repeating the pipeline overview, I will mention some interesting design changes that games had to undergo:
As the 3D engine is still [Flipper's](gamecube#graphics), instead of repeating the same pipeline overview, I will mention some interesting design changes that games had to undergo:

#### Standardised Widescreen {.tabs .active}

Expand All @@ -104,7 +105,7 @@ Super Mario Galaxy (2007).

:::

Gamecube games lacked proper support for widescreen displays (that is, composing 16:9 frames, departing from the traditional 4:3). Nevertheless, Flipper was already able to do so and a handful of games provided options to activate it, although this was still considered an exclusive feature.
Gamecube games lacked proper support for widescreen displays (that is, composing 16:9 frames, departing from the traditional 4:3). Nevertheless, Flipper's GPU was already able to do so and a handful of games provided options to activate it, although this was still considered an exclusive feature.

Be as it may, the framebuffer remains identical and the video encoder still outputs a PAL or NTSC-compliant frame, so this 'widescreen' feature is instead accomplished by **widening the field of view** in the projection matrix. The result is a scene rendered with a larger view angle that now appears squashed horizontally. However, the widescreen TV also plays a part in this process, as it will subsequently stretch the 4:3 frame (coming from the console) and the displayed image will thus look *more or less* in the correct ratio. If you are curious, this technique is not new, it's been used in film projection and it's referred to as **anamorphic widescreen**. Also, it's amusing how SNES developers had to deal with the [opposite effect](super-nintendo#display-modalities).

Expand Down Expand Up @@ -162,6 +163,8 @@ The I/O subsystem of this console is truly a game changer (*if you'll pardon the

Starlet is just an **ARM926EJ-S** CPU wired up to most of the internal components of this console. It resides inside Hollywood, runs at **243 MHz** (same as Hollywood) and contains its own ROM and RAM too. Thus, you can consider Starlet an independent computer running alongside the main CPU.

![Main diagram of the Wii's architecture. Notice how Starlet is able to control most of the I/O, and even hide some from Broadway.](diagram.png)

The core is similar to the one used on the [Nintendo DS](nintendo-ds), except for including two 'special' additions:

- A 'J' in its model name, which denotes the inclusion of **Jazelle**: A dedicated unit that executes 8-bit Java Bytecode. Java programs would still depend on the virtual machine (known as 'JVM'), but some opcodes may get executed directly from the CPU. Overall, this could accelerate the execution of compiled Java code.
Expand Down Expand Up @@ -220,7 +223,7 @@ Starlet runs a system *unofficially* referred to as **Input/Output Operating Sys
- **Processes**: Performs a task, such as network management or implementing a file system.
- **Cryptographic core**: Accelerates encryption-related operations (**AES and SHA-1 only**).

With this in mind, the **main job of IOS is to offload the workload of the main CPU** by abstracting I/O and security. For that reason, programmers don't have to worry about those matters. In order to accomplish this, Starlet **reserves between 12 and 16 MB** of GDDR3 RAM for its tasks, the rest is used by Broadway and GX.
With this in mind, the **main job of IOS is to offload the workload of the main CPU** by abstracting I/O and security. For that reason, programmers don't have to worry about those matters. In order to accomplish this, Starlet **reserves between 12 and 16 MB** of GDDR3 RAM for its tasks, the rest is used by Broadway and the GPU.

Broadway and Starlet communicate with each other using an **Inter-Process Communication** or 'IPC' protocol: In a nutshell, both CPUs share two registers each. One CPU can write on the other's registers (the written data may represent a command or a value) and from there, the receiver CPU can perform a function in response.

Expand All @@ -234,7 +237,7 @@ When a Gamecube game is inserted, a different thing happens: Startlet boots a **

This one is commonly known as the **System Menu** and effectively runs on the main PowerPC CPU (**Broadway**).

![System menu with _lots_ of channels installed.](system/home.png){.tabs-nested .open-float .tab-float .active title="Home"}
![System menu with _lots_ of channels installed.](system/home.png){.tabs-nested .active title="Home"}

![Settings menu used to change settings.](system/settings.png){.tab-nested title="Settings"}

Expand All @@ -250,8 +253,6 @@ Compared to IOS, I wouldn't consider this a 'fully fledged' OS, but more like a
- **Send/Receive messages**: Wiis have a unique ID (burned in their SEEPROM chip) which can be shared to exchange messages between other Wiis. Messages can be seen on the **Message Board**.
- Nintendo and Wii games also used this medium to provide a newsletter as well.

`r close_float_group(with_markdown = TRUE)`

Just like IOS, Nintendo released multiple updates to this system too. Some fixed security holes, others added more features. A notable new feature was the ability to store channels on the SD card.

Any program running on Broadway (including the System Menu) relies on a specific IOS version to work. When a game or a channel is booted, Starlet reboots itself using the declared version of IOS needed.
Expand Down Expand Up @@ -457,7 +458,7 @@ While further reversing IOS, it was discovered that signatures are only checked

![](system/homebrew/menu.png){.tab-nested title="Inside"}

The _unofficial_ Homebrew channel (2008).<br>The most user-friendly hack of all times.
The _unofficial_ Homebrew channel (2008).<br>Probably the most user-friendly hack of all times.

:::

Expand Down

0 comments on commit dd0dfdf

Please sign in to comment.