Exploring the GameCube Service Disc gpl models

Preliminary Analysis of gpl files on the Service Disc

After a bit of research on gpl models, I’ve been lead to the Gamecube Service Disc v1.0/03.

Upon analysis of this disc, I’ve found that it contains gpl files created using version 12012000 of the geometry library (same as the Dolphin SDK), as well as version 6012001 (same as A Wonderful Life).

When booting the disc normally, it seems to load the v12012000 gpl files (e.g. disc:/gxDemos/CarDemo/f50.gpl) for the default Car Demo program (disc:/CarDemo/cardemo.dol).

Attempting to Swap Models

However, I can get it to load the 6012001 versions (e.g. disc:/CarDemo/f50.gpl) by replacing the main executable on the disc (disc:/main.dol; naming might vary depending on the tool used) with a special version of the Car Demo program (disc:/ntd/cardemoN.dol).

With this in mind, I should be able to (in theory) replace some of the models in the cardemo with files from AWL.

E.g. If I were to look at bass.arc from AWL, it contains all of the needed files (an act, a gpl, and tpl).

If I were to extract these files and adjust the files on the service disc as follows:

  • rename disc:/CarDemo/f50.act to disc:/CarDemo/f50.act.backup
  • rename disc:/main.dol to disc:/main.dol.backup
  • copy disc:/ntd/cardemoN.dol to disc:/main.dol
  • copy bass.act to disc:/CarDemo/f50.act
  • copy bass.gpl to disc/CarDemo/bass.gpl
  • copy bass.tpl to disc/CarDemo/bass.tpl

It should load the bass model when booting the disc, instead of the default ferrari.

However, it seems that the new model (in this case, bass.gpl) does not load correctly.

The bass model should be above the rectangular shadow in the middle.

I’m not sure why this is currently the case, but I plan on doing some further tests as I can.

Why a lot of AWL models won’t work

A lot of gpl files on the root of the AWL disc (which, it’s worth mentioning, aren’t actually used by the game) don’t seem to be configured correctly.

As an example, let’s look at boy_0.arc.

While this file contains a valid act and gpl, it has 3 seperate texture (tpl) files for the body (b0), eyes (f0_e), and mouth (f0_m).

This is a problem because most gpl files are coded to load one tpl file. In this case, we can open boy_0.gpl in a hex editor and see that it’s supposed to load all of it’s textures from a nonexistent Boy_0.tpl file.

As such, attempting to load the boy_0 model using the above method I tried for bass, will not work. The program will simply give an error “Could not find CarDemo/Boy_0.tpl” and freeze/crash.

Attempting to rename any of the other texture files (e.g. renaming boy_0_b0.tpl to Boy_0.tpl) also doesn’t work, it just causes a crash. This is likely because the elusive Boy_0.tpl file would include all body, eye, and mouth textures in one single tpl file.

More Research Required

I plan on doing more testing with the Service Disc and the CarDemoN program.

There’s also other demos, disc:/ntd/zebraA.dol and disc:/ntd/zebraS.dol, that could be useful for viewing models/animations.

There’s also a program disc:/ntd/preview.dol that might be useful for previewing models.

Hopefully I’ll be able to come up with something over the next few weeks.

Retail Serial Console Output Using Dolphin

As a follow-up to my previous post, I’ve now figured out how to view serial console/debug output using Dolphin (fan emulator).

This can be enabled by toggling the View -> Log and View -> Log Configuration options. Then, enabling OSReport in the Log Configuration.

Console output will appear in the Log tab.

I tried running some of the problematic gcm images I created from Previewer + GPL models from AWL (version-modified), and got the following output:

(wildplant.gpl) doesn’t match standard 8.3 format.

The error above is likely due to a long filename (wildplant). Early computing systems used a standard known as 8.3, restricting filenames to 8 characters or less, followed by the file extension. Since this file is used in the game, I presume that the notification was fulfilled and the restriction was removed in a later iteration of the Dolphin Character Pipeline.

I tried a few different files with shorter file names. However, they all also gave errors.

Unknown state setting for Display Object

It’s difficult to know what is causing the above error, but my best guess is that, since AWL was presumably built using an updated version of the Character Pipeline, it uses certain settings for gpl models that were only supported by the updated version.

If these findings are correct, then the models from the game could only be viewed using an updated build of Previewer from a newer version of the Character Pipeline. I’ll do some digging to see if I can find anything.


On a related note, now that I know about the Dolphin log feature, I’m going to try playing through some of AWL and AnWL to see if the games happen to have any serial console output as part of their code.

Huge thanks to Video James (sonic15783)#6150 on the Discord! This wouldn’t be possible without him!

Preparing and Running Previewer on Retail Hardware (+ Tutorial)

After my research in getting previewer running on my iBook, I found that the models from A Wonderful Life could only be viewed on HW2 systems (retail hardware or equivalent dev kits).

Through some more research, I am now able to compile a version of previewer to run on retail hardware.

Here’s how I did it…

1. Create a folder to serve as the dvd root, in this case I used C:\defroot. This folder will contain the files to be previewed in a folder called “preview”, including the required prevload.txt file.

2. Convert the HW2 version of previewer.elf to .dol format using makedol.

3. Create a new file in Notepad the following settings and save as
previewerD.ddf.

4. Use the NPDP program OdemMakeDlf to compile our ddf file into a dlf file.

5. Download a retail-patched version of makegcm.dll and put the appropriate SDK folder C:\DolphinSDK1.0\X86\bin, overwriting the original makegcm.dll file.

6. Run makegcm.exe to compile the dlf file to a functional gcm (gamecube disc image).


The resulting gcm file can run on a retail Gamecube, or be opened in the Dolphin fan emulator.

Zebra, now on Gamecube

I haven’t tried out any of the AWL files yet, but that will be the next step.

Overall, I’m leaps and bounds beyond where I was just a couple months ago.


Update

I’ve tried using the above method to preview some gpl files from A Wonderful Life. Unfortunately, the program freezes on a black screen immediately after the Gamecube logo.

I’m not sure what the error is since the retail method of loading doesn’t provide any output. To get that, I’d need to be using a development system (e.g. GDEV, TDEV) that could be hooked up to a PC for console output.

The alternative would be to try using an entirely different piece of software, dspin.

This software (I have version 0.94) allegedly has experimental gpl import support.

I’ll do some tests with this software tomorrow to see if I can get anywhere.

If dspin doesn’t work, I’ll just have to shift focus back to dialogue editing until a workaround can be found, such as a more updated previewer for Mac (i.e. newer than the version included with the April 2001 Character Pipeline).


Update II:

dspin didn’t seem to work. I renamed the file and put it in the dvdroot folder, but the program didn’t seem to do anything with it.

I’m not sure what I’m doing wrong. Further research needed.

GPL Model Trial and Error and Error and Error

I tried running some of the .gpl files from A Wonderful Life through the previewer program on my iBook.

I attempted to load farm.gpl, since it’s texture configuration is one of the simplest (one tpl + one gpl) amongst the AWL gpl models.

Unfortunately, all of the gpl files from AWL caused a version-mismatch error and I’m not well-versed enough to recompile the program for mac at this point.

Error when attempting to load gpl files from AWL.
Occurs on both SheepShaver and iBook.

Fortunately, after examining the gpl files, I was able to find that the version number can actually be changed in a hex editor by setting the view options to display as decimal, group by double words, and use a big endian byte order. In this case, the version of the gpl was 6012001. I changed the version field to what previewerD requires (version 12012000), and reran previewer.

Changing the gpl library version from 6012001 to 12012000.

This allows the file to open, but leads to a new error:


GXSetVtxAttrFmt(): Only valid scale for 8b pos or texcoord data is 0 on HW1 in “GXGeoVert.c” on line 263.
Occurs on both SheepShaver and iBook.

This is likely due to the gpl being initially exported for HW2 (retail Gamecube) which uses an updated graphics driver compared to HW1 (initial dev kits). Since the mac version of previewer appears to be built on the HW1 code, it leads to the error above.

It might be possible to get around this error by running the HW2 version of previewer.elf via Dolphin (fan emulator) or Swiss (Gamecube homebrew loader), but it would take some time to figure out the proper configuration. Further research will be needed.


I also attempted to load a more complex 3d model (boy_0.gpl, extracted from boy_0.arc). This file has multiple textures associated with it (boy_0_b0.tpl, boy_0_f0_e.tpl, and boy_0_f0_m.tpl).

Unfortunately it seems that the gpl is improperly configured. When loaded through previewer on iBook, it looks for a single nonexistent boy_0.tpl texture.

It’s worth noting that the files from this version of boy_0.arc aren’t actually used in-game (the actual models/textures are loaded from one of the clz archives). These are likely leftovers from some point in the games development.

For now, I’ll be sticking to research on the simpler models first (e.g. farm.gpl, grass.gpl, and various fish models) to see if I can get past the HW1/HW2 limitations.


I also attempted to change encoding of farm.gpl from big to little endian (grouped by double-words).

I ran it through my Windows version of previewerD.exe (recompiled with version-check removed). However, I got a new “component count” error.

This is likely due to some sort of error when I attempted to convert the file’s endianness. Further research will be needed.

Windows-Compatible .gpl Models

After having success exporting 3DS Max projects to gpl format, I decided to dive further.

The Dolphin Emulator e28 from the Gamecube SDK comes with a modified version of the 3DS Max plugin CPExport. This new version, called MaxConv.dle, is capable of exporting little-endian files.

I exported the Zebra demo from 3DS Max using the new plugin.

I opened up previewerD.exe and it was actually able to load the newly exported gpl.

Tiny .gpl zebra, now on Windows!

I was even able to navigate the previewer (somewhat) using my Logitech F310 controller. With that said, only some of the buttons would work:

  • Primary stick (mapped to my left analog stick)
  • Trackball/light control switch (mapped to Y on my controller)
  • Zoom out (mapped to A on my controller).

Most notably, the zoom in function is not working with any of the buttons on my F310.

I’ll try my controller with the iBook to see if it works. I also have a USB PlayStation 3 controller that I’ll try out on both the Windows and Mac versions of Previewer.

Even though it seems helpful to have models opening on the Windows version, it will only accept custom-exported gpl files. I might try looking at the gpl files in a hex editor to find exactly how the data is organized compared between Windows (little-endian) and PowerPC (big-endian) versions of the plugin.


Update: If I unplug my controller, the emulator defaults to keyboard controls:

Key Controller
Arrow keys Main Stick
`A’, `S’, `D’, `W’ Sub Stick
NumPad 2 A button
NumPad 4 B button
NumPad 6 X button
NumPad 8 Y button
NumPad 7 Trigger Left
NumPad 9 Trigger Right
NumPad 0 Menu button

This means that we can finally zoom in on our model using the Windows previewer (provided that the gpl file has been exported as big-endian).

Not-so-tiny zebra

We have Zebra!

A while back I tried running a program called previewer for viewing .gpl files (3d models).

There was a version of this program compiled for classic Macintosh computers. Since these computers (notably the PowerMac G3) had similar internal architecture to the Gamecube, they were used as testing environments for some areas of Gamecube development.

I had set up an emulator called SheepShaver so that I could try running the program. Unfortunately, SheepShaver (and all other modern classic Macintosh emulators) lack support for hardware-accelerated graphics. The lack of hardware-acceleration means that the previewer would not render correctly and would just lead to an empty black box.

I emailed around to a few used computer shops and managed to snag an old iBook G3 for $50.

The leaf fell off and the battery’s dead, but it still works just fine (when plugged in).

After setting it up with a copy of Mac OS 9.2.2, I was able to try launching the previewer program once again.

Unfortunately it got hung up a few times when trying to render some gpl files from the SDK.

Fortunately. I was able to open one of the 3DS Max projects included with the SDK. Special thanks to Video James (sonic15783)#6150 on the Discord for helping me get a copy of 3DS Max 3 up and running in my virtual machine!

Zebra.max in 3DS Max R3 3.0 in my Windows XP virtual machine

I was then able to export this from 3DS Max to a .gpl file using the cpexport.dle plugin included with the SDK Character Pipeline.

I tried previewing the gpl on the SheepShaver emulator (just to check if it was the emulator causing issues). Sure enough, I got the notorious black rendered screen.

Black screen render in SheepShaver

I tried viewing it on my iBook and, to my surprise, it rendered!

We have tiny .gpl Zebra!

Unfortunately the program freezes after this point and I have to force it to quit. This could be due to a number of reasons:
– The program might require a controller to function at all when something is rendered
– The laptop might not be powerful enough to do anything else once the model initially renders (doubtful)
– The program might be designed to function minimally in a mac test environment
– Something else

If anyone has a classic mac and would like to try out the Zebra demo, I’ve created a disc image [download]. Just burn the image to a CD and put it in the mac, then copy previewerD.bin to your Desktop and double-click to extract the program. Then, just double-click the newly extracted program to load the demo.

At this point, it’s a lot better than nothing.

I’ll try out some Harvest Moon gpl files over the weekend and see if I can get anywhere, of if I just get more black screens.

An update on the Windows version of “Previewer”

After setting up a full software development environment in a Windows XP Virtual Machine using a combination of Visual Studio 6.0 and software from a recent AssemblerGames dump, I was able to make some progress with the SDK files.

I managed to delete the version-check code from C:\pcemu\build\charPipeline\geoPalette\src\geoPalette.c (a module used when previewing gpl geometry files).

I was then able to recompile geopalette.obj and charpipeline.lib (using the newly modified geopalette.c code) by opening C:\pcemu\build\charPipeline\win32\makeall.bat.

Once those were created, I could finally rebuild Previewer.exe and PreviewerD.exe (debug) by running the makefile located at C:\pcemu\build\demos\charPipeline\pcmakefile.

This means that the program will bypass the previous version mismatch error I was getting.

However, the program still will not actually load the model, and will crash shortly after displaying the “Loading” message.

After looking at the documentation that came with the SDK files, it seems that this issue is because the Windows version of Previewer needs gpl files exported specifically using little-endian, as opposed to big-endian (typical format for exporting for Gamecube/Mac test systems).

My best bet at this point would to continue my search for an OS 9 mac that I can run further tests on, or to find a way to convert the big-endian gpl files to little-endian for viewing on PC.

A Windows version of “Preview” existed this whole time!

After some digging around in the Dolphin/Gamecube SDK files I had, I’ve discovered that there was a version of the “preview” program (for viewing .gpl 3D models) for Windows this entire time!

I feel like an idiot for somehow not noticing this sooner.

The app launches just fine. Unfortunately, I got a version-mismatch error when trying to load any actual files (including the examples that came with the SDK).

With that said, the source code for the program included with the SDK. My plan of action right now is to try removing the version-check code, then recompile the program.

If this works, we might finally have a way of viewing 3D models from the game, without me resorting to trying an old 90’s-era Macintosh.

Getting Closer to 3D Model Previews

Namely, there was a “previewer” program compiled for old macs (old macs used a PowerPC architecture, similar to the Gamecube and Wii)

I’ve been fiddling around with some of the files from the Dolphin SDK.

I had tried running this before, but got stuck on the program looking for a “prevload.txt” file in a specific directory.

After some digging around in various documentation and script files, I finally figured out what I needed to do.

The program looks for an inserted disc with the volume label “cp”. It then looks for the folder “cp:/cpdata/preview/”. This folder must contain the file to be previewed (in this case, Zebra.gpl) as well as a text file called “prevload.txt” (which just contains the name of the file to be previewed).

With all of these conditions met, the program should display the requested file.

Unfortunately my virtual machine setup seems to freeze (or in some cases crash) at this point. This seems to be an issue with SheepShaver not supporting 3D hardware rendering.

Ultimately, the next (and only) step to get this software running would be to try it out on a real old-school mac. And even if that works, I’m not sure whether I’ll be able to navigate the program (since it seems to use some sort of game controller).

As always, I’ll keep you all updated.

SDK Software

I managed to figure out some of the software from the Gamecube SDK.

It looks like some of the SDK includes binaries built for the legacy mac platform.

Old Macintosh computers used the same PowerPC architecture (as opposed to other computers that used the Intel x86 architecture) as the Gamecube. This means that running software for the Gamecube would require either the actual dev kit hardware (known as HW1 or HW2), or a Mac.

There was also the official Dolphin emulator (not to be confused with the current fan project Dolphin Gamecube/Wii emulator), but that could only emulate certain aspects of the hardware.  You’d still need a mac or dev kit to run most things.

So, after some trial and error, I managed to get an old copy of Mac OS 9 running in a virtual machine known as SheepShaver.

I then got the preview program (an app from the SDK to view the character models/textures) to extract and open.  But when trying to run it, it fails after saying a needed file (prevload.txt) couldn’t be found. Documentation on getting this to run is sketchy at best.

I’ll need to do more digging to figure out the full configuration needed to get the app to run.  I read something about setting “CP_Root environment variables” in the SDK documentation, so that might be my next step.

I also tried getting my hands on a trial copy of 3DS Max (the software used by devs to create models). But then I found out that 3DS Max Plugins are version specific, so I’d need the old 3DS Max v3.1 to use the Gamecube plugins from the SDK to import/export models. And this will likely also require I use a virtual machine with an old version of Windows (e.g. Windows 98) to run it.

One step forward, two steps back.